Added a WriteFile method.
parent
87f8ec9ead
commit
dcf4c93dfd
|
@ -150,11 +150,16 @@ type FileSystem interface {
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *OpenFileRequest) (*OpenFileResponse, error)
|
req *OpenFileRequest) (*OpenFileResponse, error)
|
||||||
|
|
||||||
// Read data from a file previously opened with OpenFile.
|
// Read data from a file previously opened with CreateFile or OpenFile.
|
||||||
ReadFile(
|
ReadFile(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
req *ReadFileRequest) (*ReadFileResponse, error)
|
req *ReadFileRequest) (*ReadFileResponse, error)
|
||||||
|
|
||||||
|
// Write data to a file previously opened with CreateFile or OpenFile.
|
||||||
|
WriteFile(
|
||||||
|
ctx context.Context,
|
||||||
|
req *WriteFileRequest) (*WriteFileResponse, error)
|
||||||
|
|
||||||
// Release a previously-minted file handle. The kernel calls this when there
|
// Release a previously-minted file handle. The kernel calls this when there
|
||||||
// are no more references to an open file: all file descriptors are closed
|
// are no more references to an open file: all file descriptors are closed
|
||||||
// and all memory mappings are unmapped.
|
// and all memory mappings are unmapped.
|
||||||
|
@ -437,6 +442,7 @@ type CreateFileResponse struct {
|
||||||
// The handle may be supplied to the following methods:
|
// The handle may be supplied to the following methods:
|
||||||
//
|
//
|
||||||
// * ReadFile
|
// * ReadFile
|
||||||
|
// * WriteFile
|
||||||
// * ReleaseFileHandle
|
// * ReleaseFileHandle
|
||||||
//
|
//
|
||||||
// The file system must ensure this ID remains valid until a later call to
|
// The file system must ensure this ID remains valid until a later call to
|
||||||
|
@ -602,6 +608,7 @@ type OpenFileResponse struct {
|
||||||
// The handle may be supplied to the following methods:
|
// The handle may be supplied to the following methods:
|
||||||
//
|
//
|
||||||
// * ReadFile
|
// * ReadFile
|
||||||
|
// * WriteFile
|
||||||
// * ReleaseFileHandle
|
// * ReleaseFileHandle
|
||||||
//
|
//
|
||||||
// The file system must ensure this ID remains valid until a later call to
|
// The file system must ensure this ID remains valid until a later call to
|
||||||
|
@ -613,7 +620,7 @@ type ReadFileRequest struct {
|
||||||
Header RequestHeader
|
Header RequestHeader
|
||||||
|
|
||||||
// The file inode that we are reading, and the handle previously returned by
|
// The file inode that we are reading, and the handle previously returned by
|
||||||
// OpenFile when opening that inode.
|
// CreateFile or OpenFile when opening that inode.
|
||||||
Inode InodeID
|
Inode InodeID
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
|
|
||||||
|
@ -634,6 +641,30 @@ type ReadFileResponse struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WriteFileRequest struct {
|
||||||
|
Header RequestHeader
|
||||||
|
|
||||||
|
// The file inode that we are modifying, and the handle previously returned
|
||||||
|
// by CreateFile or OpenFile when opening that inode.
|
||||||
|
Inode InodeID
|
||||||
|
Handle HandleID
|
||||||
|
|
||||||
|
// The data to write, and the offset at which to write it.
|
||||||
|
//
|
||||||
|
// The FUSE documentation requires that exactly the number of bytes supplied
|
||||||
|
// be written, except on error (http://goo.gl/KUpwwn). This appears to be
|
||||||
|
// because it uses file mmapping machinery (http://goo.gl/SGxnaN) to write a
|
||||||
|
// page at a time.
|
||||||
|
//
|
||||||
|
// TODO(jacobsa): Figure out what the posix semantics are for extending the
|
||||||
|
// file, and document them here.
|
||||||
|
Data []byte
|
||||||
|
Offset int64
|
||||||
|
}
|
||||||
|
|
||||||
|
type WriteFileResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
type ReleaseFileHandleRequest struct {
|
type ReleaseFileHandleRequest struct {
|
||||||
Header RequestHeader
|
Header RequestHeader
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue