vfs: stop reading File members from outside file.go

This also fixes locking for ReadFileHandle and WriteFileHandle
accessing File members
This commit is contained in:
Nick Craig-Wood
2020-04-14 18:03:45 +01:00
parent 268fcbb973
commit 238f26cc90
3 changed files with 15 additions and 8 deletions

View File

@@ -607,6 +607,13 @@ func (f *File) VFS() *VFS {
return f.d.vfs
}
// Fs returns the underlying Fs for the file
func (f *File) Fs() fs.Fs {
f.mu.RLock()
defer f.mu.RUnlock()
return f.d.f
}
// Open a file according to the flags provided
//
// O_RDONLY open the file read-only.