vfs: Add go-billy dependency and make sure vfs.Handle implements billy.File

billy defines a common file system interface that is used in multiple go packages.
vfs.Handle implements billy.File mostly, only two methods needed to be added to
make it compliant.

An interface check is added as well.

This is a preliminary work for adding serve nfs command.
This commit is contained in:
Saleh Dindar
2023-10-04 10:25:57 -07:00
committed by Nick Craig-Wood
parent 7801b160f2
commit 25f59b2918
5 changed files with 32 additions and 5 deletions

View File

@@ -30,6 +30,16 @@ type RWFileHandle struct {
writeCalled bool // if any Write() methods have been called
}
// Lock performs Unix locking, not supported
func (fh *RWFileHandle) Lock() error {
return os.ErrInvalid
}
// Unlock performs Unix unlocking, not supported
func (fh *RWFileHandle) Unlock() error {
return os.ErrInvalid
}
func newRWFileHandle(d *Dir, f *File, flags int) (fh *RWFileHandle, err error) {
defer log.Trace(f.Path(), "")("err=%v", &err)
// get an item to represent this from the cache