RemoveXattr implementation
parent
77e8f7f767
commit
8aade5c71f
|
@ -420,6 +420,19 @@ func convertInMessage(
|
||||||
Flags: fusekernel.InitFlags(in.Flags),
|
Flags: fusekernel.InitFlags(in.Flags),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case fusekernel.OpRemovexattr:
|
||||||
|
buf := inMsg.ConsumeBytes(inMsg.Len())
|
||||||
|
n := len(buf)
|
||||||
|
if n == 0 || buf[n-1] != '\x00' {
|
||||||
|
err = errors.New("Corrupt OpRemovexattr")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
o = &fuseops.RemoveXattrOp{
|
||||||
|
Inode: fuseops.InodeID(inMsg.Header().Nodeid),
|
||||||
|
Name: string(buf[:n-1]),
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
o = &unknownOp{
|
o = &unknownOp{
|
||||||
OpCode: inMsg.Header().Opcode,
|
OpCode: inMsg.Header().Opcode,
|
||||||
|
@ -623,6 +636,9 @@ func (c *Connection) kernelResponseForOp(
|
||||||
out.St.Bsize = o.IoSize
|
out.St.Bsize = o.IoSize
|
||||||
out.St.Frsize = o.BlockSize
|
out.St.Frsize = o.BlockSize
|
||||||
|
|
||||||
|
case *fuseops.RemoveXattrOp:
|
||||||
|
// Empty response
|
||||||
|
|
||||||
case *initOp:
|
case *initOp:
|
||||||
out := (*fusekernel.InitOut)(m.Grow(int(unsafe.Sizeof(fusekernel.InitOut{}))))
|
out := (*fusekernel.InitOut)(m.Grow(int(unsafe.Sizeof(fusekernel.InitOut{}))))
|
||||||
|
|
||||||
|
|
|
@ -767,3 +767,16 @@ type ReadSymlinkOp struct {
|
||||||
// Set by the file system: the target of the symlink.
|
// Set by the file system: the target of the symlink.
|
||||||
Target string
|
Target string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// eXtended attributes
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Remove an extended attribute
|
||||||
|
type RemoveXattrOp struct {
|
||||||
|
// The inode that we are reading
|
||||||
|
Inode InodeID
|
||||||
|
|
||||||
|
// The name of the extended attribute
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ type FileSystem interface {
|
||||||
FlushFile(context.Context, *fuseops.FlushFileOp) error
|
FlushFile(context.Context, *fuseops.FlushFileOp) error
|
||||||
ReleaseFileHandle(context.Context, *fuseops.ReleaseFileHandleOp) error
|
ReleaseFileHandle(context.Context, *fuseops.ReleaseFileHandleOp) error
|
||||||
ReadSymlink(context.Context, *fuseops.ReadSymlinkOp) error
|
ReadSymlink(context.Context, *fuseops.ReadSymlinkOp) error
|
||||||
|
RemoveXattr(context.Context, *fuseops.RemoveXattrOp) error
|
||||||
|
|
||||||
// Regard all inodes (including the root inode) as having their lookup counts
|
// Regard all inodes (including the root inode) as having their lookup counts
|
||||||
// decremented to zero, and clean up any resources associated with the file
|
// decremented to zero, and clean up any resources associated with the file
|
||||||
|
@ -186,6 +187,9 @@ func (s *fileSystemServer) handleOp(
|
||||||
|
|
||||||
case *fuseops.ReadSymlinkOp:
|
case *fuseops.ReadSymlinkOp:
|
||||||
err = s.fs.ReadSymlink(ctx, typed)
|
err = s.fs.ReadSymlink(ctx, typed)
|
||||||
|
|
||||||
|
case *fuseops.RemoveXattrOp:
|
||||||
|
err = s.fs.RemoveXattr(ctx, typed)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Reply(ctx, err)
|
c.Reply(ctx, err)
|
||||||
|
|
|
@ -183,5 +183,12 @@ func (fs *NotImplementedFileSystem) ReadSymlink(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (fs *NotImplementedFileSystem) RemoveXattr(
|
||||||
|
ctx context.Context,
|
||||||
|
op *fuseops.RemoveXattrOp) (err error) {
|
||||||
|
err = fuse.ENOSYS
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (fs *NotImplementedFileSystem) Destroy() {
|
func (fs *NotImplementedFileSystem) Destroy() {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue