Fix Flock build breakage

go-fuse has added a new method to the nodefs.File interface that
caused this build error:

  internal/fusefrontend/file.go:75: cannot use file literal (type *file) as type nodefs.File in return argument:
  	*file does not implement nodefs.File (missing Flock method)

Fixes https://github.com/rfjakob/gocryptfs/issues/104 and
prevents the problem from happening again.
This commit is contained in:
Jakob Unterwurzacher 2017-04-23 00:06:56 +02:00
parent 8ed89a13ac
commit 9777e4bf7e

View File

@ -52,6 +52,10 @@ type file struct {
lastOpCount uint64 lastOpCount uint64
// Parent filesystem // Parent filesystem
fs *FS fs *FS
// We embed a nodefs.NewDefaultFile() that returns ENOSYS for every operation we
// have not implemented. This prevents build breakage when the go-fuse library
// adds new methods to the nodefs.File interface.
nodefs.File
} }
// NewFile returns a new go-fuse File instance. // NewFile returns a new go-fuse File instance.
@ -73,6 +77,7 @@ func NewFile(fd *os.File, writeOnly bool, fs *FS) (nodefs.File, fuse.Status) {
fileTableEntry: t, fileTableEntry: t,
loopbackFile: nodefs.NewLoopbackFile(fd), loopbackFile: nodefs.NewLoopbackFile(fd),
fs: fs, fs: fs,
File: nodefs.NewDefaultFile(),
}, fuse.OK }, fuse.OK
} }