Deleted old kernelResponse methods.
parent
6389e8773f
commit
dce2ceffdb
146
fuseops/ops.go
146
fuseops/ops.go
|
@ -88,15 +88,6 @@ func (o *LookUpInodeOp) ShortDesc() (desc string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *LookUpInodeOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
size := fusekernel.EntryOutSize(o.protocol)
|
|
||||||
b = buffer.NewOutMessage(size)
|
|
||||||
out := (*fusekernel.EntryOut)(b.Grow(size))
|
|
||||||
convertChildInodeEntry(&o.Entry, out)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh the attributes for an inode whose ID was previously returned in a
|
// Refresh the attributes for an inode whose ID was previously returned in a
|
||||||
// LookUpInodeOp. The kernel sends this when the FUSE VFS layer's cache of
|
// LookUpInodeOp. The kernel sends this when the FUSE VFS layer's cache of
|
||||||
// inode attributes is stale. This is controlled by the AttributesExpiration
|
// inode attributes is stale. This is controlled by the AttributesExpiration
|
||||||
|
@ -123,16 +114,6 @@ func (o *GetInodeAttributesOp) DebugString() string {
|
||||||
o.Attributes.DebugString())
|
o.Attributes.DebugString())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *GetInodeAttributesOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
size := fusekernel.AttrOutSize(o.protocol)
|
|
||||||
b = buffer.NewOutMessage(size)
|
|
||||||
out := (*fusekernel.AttrOut)(b.Grow(size))
|
|
||||||
out.AttrValid, out.AttrValidNsec = convertExpirationTime(o.AttributesExpiration)
|
|
||||||
convertAttributes(o.Inode, &o.Attributes, &out.Attr)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change attributes for an inode.
|
// Change attributes for an inode.
|
||||||
//
|
//
|
||||||
// The kernel sends this for obvious cases like chmod(2), and for less obvious
|
// The kernel sends this for obvious cases like chmod(2), and for less obvious
|
||||||
|
@ -157,16 +138,6 @@ type SetInodeAttributesOp struct {
|
||||||
AttributesExpiration time.Time
|
AttributesExpiration time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *SetInodeAttributesOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
size := fusekernel.AttrOutSize(o.protocol)
|
|
||||||
b = buffer.NewOutMessage(size)
|
|
||||||
out := (*fusekernel.AttrOut)(b.Grow(size))
|
|
||||||
out.AttrValid, out.AttrValidNsec = convertExpirationTime(o.AttributesExpiration)
|
|
||||||
convertAttributes(o.Inode, &o.Attributes, &out.Attr)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Decrement the reference count for an inode ID previously issued by the file
|
// Decrement the reference count for an inode ID previously issued by the file
|
||||||
// system.
|
// system.
|
||||||
//
|
//
|
||||||
|
@ -216,11 +187,6 @@ type ForgetInodeOp struct {
|
||||||
N uint64
|
N uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ForgetInodeOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
// No response.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Inode creation
|
// Inode creation
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -259,15 +225,6 @@ func (o *MkDirOp) ShortDesc() (desc string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *MkDirOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
size := fusekernel.EntryOutSize(o.protocol)
|
|
||||||
b = buffer.NewOutMessage(size)
|
|
||||||
out := (*fusekernel.EntryOut)(b.Grow(size))
|
|
||||||
convertChildInodeEntry(&o.Entry, out)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a file inode and open it.
|
// Create a file inode and open it.
|
||||||
//
|
//
|
||||||
// The kernel sends this when the user asks to open a file with the O_CREAT
|
// The kernel sends this when the user asks to open a file with the O_CREAT
|
||||||
|
@ -311,19 +268,6 @@ func (o *CreateFileOp) ShortDesc() (desc string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *CreateFileOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
eSize := fusekernel.EntryOutSize(o.protocol)
|
|
||||||
b = buffer.NewOutMessage(eSize + unsafe.Sizeof(fusekernel.OpenOut{}))
|
|
||||||
|
|
||||||
e := (*fusekernel.EntryOut)(b.Grow(eSize))
|
|
||||||
convertChildInodeEntry(&o.Entry, e)
|
|
||||||
|
|
||||||
oo := (*fusekernel.OpenOut)(b.Grow(unsafe.Sizeof(fusekernel.OpenOut{})))
|
|
||||||
oo.Fh = uint64(o.Handle)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a symlink inode. If the name already exists, the file system should
|
// Create a symlink inode. If the name already exists, the file system should
|
||||||
// return EEXIST (cf. the notes on CreateFileOp and MkDirOp).
|
// return EEXIST (cf. the notes on CreateFileOp and MkDirOp).
|
||||||
type CreateSymlinkOp struct {
|
type CreateSymlinkOp struct {
|
||||||
|
@ -357,15 +301,6 @@ func (o *CreateSymlinkOp) ShortDesc() (desc string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *CreateSymlinkOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
size := fusekernel.EntryOutSize(o.protocol)
|
|
||||||
b = buffer.NewOutMessage(size)
|
|
||||||
out := (*fusekernel.EntryOut)(b.Grow(size))
|
|
||||||
convertChildInodeEntry(&o.Entry, out)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Unlinking
|
// Unlinking
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -418,11 +353,6 @@ type RenameOp struct {
|
||||||
NewName string
|
NewName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *RenameOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unlink a directory from its parent. Because directories cannot have a link
|
// Unlink a directory from its parent. Because directories cannot have a link
|
||||||
// count above one, this means the directory inode should be deleted as well
|
// count above one, this means the directory inode should be deleted as well
|
||||||
// once the kernel sends ForgetInodeOp.
|
// once the kernel sends ForgetInodeOp.
|
||||||
|
@ -439,11 +369,6 @@ type RmDirOp struct {
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *RmDirOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unlink a file or symlink from its parent. If this brings the inode's link
|
// Unlink a file or symlink from its parent. If this brings the inode's link
|
||||||
// count to zero, the inode should be deleted once the kernel sends
|
// count to zero, the inode should be deleted once the kernel sends
|
||||||
// ForgetInodeOp. It may still be referenced before then if a user still has
|
// ForgetInodeOp. It may still be referenced before then if a user still has
|
||||||
|
@ -459,11 +384,6 @@ type UnlinkOp struct {
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *UnlinkOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Directory handles
|
// Directory handles
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -491,14 +411,6 @@ type OpenDirOp struct {
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OpenDirOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(unsafe.Sizeof(fusekernel.OpenOut{}))
|
|
||||||
out := (*fusekernel.OpenOut)(b.Grow(unsafe.Sizeof(fusekernel.OpenOut{})))
|
|
||||||
out.Fh = uint64(o.Handle)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read entries from a directory previously opened with OpenDir.
|
// Read entries from a directory previously opened with OpenDir.
|
||||||
type ReadDirOp struct {
|
type ReadDirOp struct {
|
||||||
commonOp
|
commonOp
|
||||||
|
@ -589,12 +501,6 @@ type ReadDirOp struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ReadDirOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(uintptr(len(o.Data)))
|
|
||||||
b.Append(o.Data)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release a previously-minted directory handle. The kernel sends this when
|
// Release a previously-minted directory handle. The kernel sends this when
|
||||||
// there are no more references to an open directory: all file descriptors are
|
// there are no more references to an open directory: all file descriptors are
|
||||||
// closed and all memory mappings are unmapped.
|
// closed and all memory mappings are unmapped.
|
||||||
|
@ -612,11 +518,6 @@ type ReleaseDirHandleOp struct {
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ReleaseDirHandleOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// File handles
|
// File handles
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -643,14 +544,6 @@ type OpenFileOp struct {
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OpenFileOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(unsafe.Sizeof(fusekernel.OpenOut{}))
|
|
||||||
out := (*fusekernel.OpenOut)(b.Grow(unsafe.Sizeof(fusekernel.OpenOut{})))
|
|
||||||
out.Fh = uint64(o.Handle)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read data from a file previously opened with CreateFile or OpenFile.
|
// Read data from a file previously opened with CreateFile or OpenFile.
|
||||||
//
|
//
|
||||||
// Note that this op is not sent for every call to read(2) by the end user;
|
// Note that this op is not sent for every call to read(2) by the end user;
|
||||||
|
@ -680,12 +573,6 @@ type ReadFileOp struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ReadFileOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(uintptr(len(o.Data)))
|
|
||||||
b.Append(o.Data)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write data to a file previously opened with CreateFile or OpenFile.
|
// Write data to a file previously opened with CreateFile or OpenFile.
|
||||||
//
|
//
|
||||||
// When the user writes data using write(2), the write goes into the page
|
// When the user writes data using write(2), the write goes into the page
|
||||||
|
@ -756,14 +643,6 @@ type WriteFileOp struct {
|
||||||
Data []byte
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *WriteFileOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(unsafe.Sizeof(fusekernel.WriteOut{}))
|
|
||||||
out := (*fusekernel.WriteOut)(b.Grow(unsafe.Sizeof(fusekernel.WriteOut{})))
|
|
||||||
out.Size = uint32(len(o.Data))
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Synchronize the current contents of an open file to storage.
|
// Synchronize the current contents of an open file to storage.
|
||||||
//
|
//
|
||||||
// vfs.txt documents this as being called for by the fsync(2) system call
|
// vfs.txt documents this as being called for by the fsync(2) system call
|
||||||
|
@ -788,11 +667,6 @@ type SyncFileOp struct {
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *SyncFileOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Flush the current state of an open file to storage upon closing a file
|
// Flush the current state of an open file to storage upon closing a file
|
||||||
// descriptor.
|
// descriptor.
|
||||||
//
|
//
|
||||||
|
@ -848,11 +722,6 @@ type FlushFileOp struct {
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *FlushFileOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -870,11 +739,6 @@ type ReleaseFileHandleOp struct {
|
||||||
Handle HandleID
|
Handle HandleID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ReleaseFileHandleOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// A sentinel used for unknown ops. The user is expected to respond with a
|
// A sentinel used for unknown ops. The user is expected to respond with a
|
||||||
// non-nil error.
|
// non-nil error.
|
||||||
type unknownOp struct {
|
type unknownOp struct {
|
||||||
|
@ -888,10 +752,6 @@ func (o *unknownOp) ShortDesc() (desc string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *unknownOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
panic(fmt.Sprintf("Should never get here for unknown op: %s", o.ShortDesc()))
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Reading symlinks
|
// Reading symlinks
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -907,12 +767,6 @@ type ReadSymlinkOp struct {
|
||||||
Target string
|
Target string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *ReadSymlinkOp) kernelResponse() (b buffer.OutMessage) {
|
|
||||||
b = buffer.NewOutMessage(uintptr(len(o.Target)))
|
|
||||||
b.AppendString(o.Target)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Internal
|
// Internal
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue