vfs: factor duplicated Open code into vfs from mount/cmount

This commit is contained in:
Nick Craig-Wood
2017-10-30 10:14:39 +00:00
parent a5dc62f6c1
commit 190367d917
7 changed files with 106 additions and 104 deletions

View File

@@ -19,11 +19,27 @@ func newDirHandle(d *Dir) *DirHandle {
}
}
// String converts it to printable
func (fh *DirHandle) String() string {
if fh == nil {
return "<nil *DirHandle>"
}
if fh.d == nil {
return "<nil *DirHandle.d>"
}
return fh.d.String() + " (r)"
}
// Stat returns info about the current directory
func (fh *DirHandle) Stat() (fi os.FileInfo, err error) {
return fh.d, nil
}
// Node returns the Node assocuated with this - satisfies Noder interface
func (fh *DirHandle) Node() Node {
return fh.d
}
// Readdir reads the contents of the directory associated with file and returns
// a slice of up to n FileInfo values, as would be returned by Lstat, in
// directory order. Subsequent calls on the same file will yield further