Defined the new API for ReadFileOp and ReadDirOp.
parent
314b93c7c0
commit
f5d80cf9ab
|
@ -384,25 +384,25 @@ type ReadDirOp struct {
|
||||||
// offset, and return array offsets into that cached listing.
|
// offset, and return array offsets into that cached listing.
|
||||||
Offset DirOffset
|
Offset DirOffset
|
||||||
|
|
||||||
// The maximum number of bytes to return in ReadDirResponse.Data. A smaller
|
// The destination buffer, whose length gives the size of the read.
|
||||||
// number is acceptable.
|
|
||||||
Size int
|
|
||||||
|
|
||||||
// Set by the file system: a buffer consisting of a sequence of FUSE
|
|
||||||
// directory entries in the format generated by fuse_add_direntry
|
|
||||||
// (http://goo.gl/qCcHCV), which is consumed by parse_dirfile
|
|
||||||
// (http://goo.gl/2WUmD2). Use fuseutil.AppendDirent to generate this data.
|
|
||||||
//
|
//
|
||||||
// The buffer must not exceed the length specified in ReadDirRequest.Size. It
|
// The output data should consist of a sequence of FUSE directory entries in
|
||||||
// is okay for the final entry to be truncated; parse_dirfile copes with this
|
// the format generated by fuse_add_direntry (http://goo.gl/qCcHCV), which is
|
||||||
// by ignoring the partial record.
|
// consumed by parse_dirfile (http://goo.gl/2WUmD2). Use
|
||||||
|
// fuseutil.AppendDirent to generate this data.
|
||||||
|
//
|
||||||
|
// It is okay for the final entry to be truncated if it doesn't fit;
|
||||||
|
// parse_dirfile copes with this by ignoring the partial record.
|
||||||
//
|
//
|
||||||
// Each entry returned exposes a directory offset to the user that may later
|
// Each entry returned exposes a directory offset to the user that may later
|
||||||
// show up in ReadDirRequest.Offset. See notes on that field for more
|
// show up in ReadDirRequest.Offset. See notes on that field for more
|
||||||
// information.
|
// information.
|
||||||
//
|
Dst []byte
|
||||||
// An empty buffer indicates the end of the directory has been reached.
|
|
||||||
Data []byte
|
// Set by the file system: the number of bytes read into Dst. It is okay for
|
||||||
|
// this to be less than len(Dst) if there is less data available. A value of
|
||||||
|
// zero means that the end of the directory has been reached.
|
||||||
|
BytesRead int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release a previously-minted directory handle. The kernel sends this when
|
// Release a previously-minted directory handle. The kernel sends this when
|
||||||
|
@ -455,20 +455,21 @@ type ReadFileOp struct {
|
||||||
Inode InodeID
|
Inode InodeID
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
|
||||||
// The range of the file to read.
|
// The offset within the file at which to read.
|
||||||
|
Offset int64
|
||||||
|
|
||||||
|
// The destination buffer, whose length gives the size of the read.
|
||||||
|
Dst []byte
|
||||||
|
|
||||||
|
// Set by the file system: the number of bytes read.
|
||||||
//
|
//
|
||||||
// The FUSE documentation requires that exactly the number of bytes be
|
// The FUSE documentation requires that exactly the requested number of bytes
|
||||||
// returned, except in the case of EOF or error (http://goo.gl/ZgfBkF). This
|
// be returned, except in the case of EOF or error (http://goo.gl/ZgfBkF).
|
||||||
// appears to be because it uses file mmapping machinery
|
// This appears to be because it uses file mmapping machinery
|
||||||
// (http://goo.gl/SGxnaN) to read a page at a time. It appears to understand
|
// (http://goo.gl/SGxnaN) to read a page at a time. It appears to understand
|
||||||
// where EOF is by checking the inode size (http://goo.gl/0BkqKD), returned
|
// where EOF is by checking the inode size (http://goo.gl/0BkqKD), returned
|
||||||
// by a previous call to LookUpInode, GetInodeAttributes, etc.
|
// by a previous call to LookUpInode, GetInodeAttributes, etc.
|
||||||
Offset int64
|
BytesRead int
|
||||||
Size int
|
|
||||||
|
|
||||||
// Set by the file system: the data read. If this is less than the requested
|
|
||||||
// size, it indicates EOF. An error should not be returned in this case.
|
|
||||||
Data []byte
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write data to a file previously opened with CreateFile or OpenFile.
|
// Write data to a file previously opened with CreateFile or OpenFile.
|
||||||
|
|
Loading…
Reference in New Issue