Commit 6625411c authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fs: return OK for unimplemented Flush

This simplifies writing R/O filesystems, which do not need flushing.

Change-Id: I428627799904e30f486ff82bcafe2f9c4db88d01
parent 817939f6
...@@ -296,10 +296,11 @@ type NodeFsyncer interface { ...@@ -296,10 +296,11 @@ type NodeFsyncer interface {
Fsync(ctx context.Context, f FileHandle, flags uint32) syscall.Errno Fsync(ctx context.Context, f FileHandle, flags uint32) syscall.Errno
} }
// Flush is called for close() call on a file descriptor. In // Flush is called for the close(2) call on a file descriptor. In case
// case of duplicated descriptor, it may be called more than // of a descriptor that was duplicated using dup(2), it may be called
// once for a file. The default implementation forwards to the // more than once for the same FileHandle. The default implementation
// FileHandle. // forwards to the FileHandle, or if the handle does not support
// FileFlusher, returns OK.
type NodeFlusher interface { type NodeFlusher interface {
Flush(ctx context.Context, f FileHandle) syscall.Errno Flush(ctx context.Context, f FileHandle) syscall.Errno
} }
......
...@@ -743,8 +743,7 @@ func (b *rawBridge) Flush(cancel <-chan struct{}, input *fuse.FlushIn) fuse.Stat ...@@ -743,8 +743,7 @@ func (b *rawBridge) Flush(cancel <-chan struct{}, input *fuse.FlushIn) fuse.Stat
if fl, ok := f.file.(FileFlusher); ok { if fl, ok := f.file.(FileFlusher); ok {
return errnoToStatus(fl.Flush(&fuse.Context{Caller: input.Caller, Cancel: cancel})) return errnoToStatus(fl.Flush(&fuse.Context{Caller: input.Caller, Cancel: cancel}))
} }
// XXX should return OK to reflect r/o filesystem? return 0
return fuse.ENOTSUP
} }
func (b *rawBridge) Fsync(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.Status { func (b *rawBridge) Fsync(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.Status {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment