diff --git a/conversions.go b/conversions.go index 02ce121..72dee19 100644 --- a/conversions.go +++ b/conversions.go @@ -489,7 +489,7 @@ func convertInMessage( type input fusekernel.FsyncIn in := (*input)(inMsg.Consume(unsafe.Sizeof(input{}))) if in == nil { - return nil, errors.New("Corrupt OpFsync") + return nil, errors.New("Corrupt OpFsync/OpFsyncdir") } o = &fuseops.SyncFileOp{ @@ -502,6 +502,18 @@ func convertInMessage( }, } + case fusekernel.OpSyncFS: + type input fusekernel.SyncFSIn + in := (*input)(inMsg.Consume(unsafe.Sizeof(input{}))) + if in == nil { + return nil, errors.New("Corrupt OpSyncFS") + } + + o = &fuseops.SyncFSOp{ + Inode: fuseops.InodeID(inMsg.Header().Nodeid), + OpContext: fuseops.OpContext{Pid: inMsg.Header().Pid}, + } + case fusekernel.OpFlush: type input fusekernel.FlushIn in := (*input)(inMsg.Consume(unsafe.Sizeof(input{}))) @@ -969,6 +981,9 @@ func (c *Connection) kernelResponseForOp( case *fuseops.FallocateOp: // Empty response + case *fuseops.SyncFSOp: + // Empty response + case *initOp: out := (*fusekernel.InitOut)(m.Grow(int(unsafe.Sizeof(fusekernel.InitOut{})))) diff --git a/fuseops/ops.go b/fuseops/ops.go index f6df6d4..9f75541 100644 --- a/fuseops/ops.go +++ b/fuseops/ops.go @@ -1004,3 +1004,8 @@ type FallocateOp struct { Mode uint32 OpContext OpContext } + +type SyncFSOp struct { + Inode InodeID + OpContext OpContext +} diff --git a/fuseutil/file_system.go b/fuseutil/file_system.go index 43f1791..107e427 100644 --- a/fuseutil/file_system.go +++ b/fuseutil/file_system.go @@ -63,6 +63,7 @@ type FileSystem interface { ListXattr(context.Context, *fuseops.ListXattrOp) error SetXattr(context.Context, *fuseops.SetXattrOp) error Fallocate(context.Context, *fuseops.FallocateOp) error + SyncFS(context.Context, *fuseops.SyncFSOp) error // Regard all inodes (including the root inode) as having their lookup counts // decremented to zero, and clean up any resources associated with the file @@ -236,6 +237,9 @@ func (s *fileSystemServer) handleOp( case *fuseops.FallocateOp: err = s.fs.Fallocate(ctx, typed) + + case *fuseops.SyncFSOp: + err = s.fs.SyncFS(ctx, typed) } c.Reply(ctx, err) diff --git a/fuseutil/not_implemented_file_system.go b/fuseutil/not_implemented_file_system.go index cfb116c..e47e02b 100644 --- a/fuseutil/not_implemented_file_system.go +++ b/fuseutil/not_implemented_file_system.go @@ -204,5 +204,11 @@ func (fs *NotImplementedFileSystem) Fallocate( return fuse.ENOSYS } +func (fs *NotImplementedFileSystem) SyncFS( + ctx context.Context, + op *fuseops.SyncFSOp) error { + return fuse.ENOSYS +} + func (fs *NotImplementedFileSystem) Destroy() { } diff --git a/internal/fusekernel/fuse_kernel.go b/internal/fusekernel/fuse_kernel.go index 3f17351..47d5795 100644 --- a/internal/fusekernel/fuse_kernel.go +++ b/internal/fusekernel/fuse_kernel.go @@ -46,7 +46,7 @@ const ( ProtoVersionMinMajor = 7 ProtoVersionMinMinor = 18 ProtoVersionMaxMajor = 7 - ProtoVersionMaxMinor = 31 + ProtoVersionMaxMinor = 34 ) const ( @@ -391,6 +391,14 @@ const ( OpPoll = 40 // Linux? OpBatchForget = 42 OpFallocate = 43 + OpReaddirplus = 44 + // + OpRename2 = 45 + OpLseek = 46 + OpCopyFileRange = 47 + OpSetupMapping = 48 + OpRemoveMapping = 49 + OpSyncFS = 50 // OS X OpSetvolname = 61 @@ -803,3 +811,7 @@ type NotifyInvalEntryOut struct { Namelen uint32 padding uint32 } + +type SyncFSIn struct { + Padding uint64 +}