Commit 50a64bf6 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Implement null lookup for MemTreeFs.

parent 19509970
......@@ -17,6 +17,10 @@ type memNode struct {
file MemFile
}
// MemTreeFs creates a tree of internal Inodes. Since the tree is
// loaded in memory completely at startup, it does not need to inode
// discovery through Lookup() at serve time.
type MemTreeFs struct {
fuse.DefaultNodeFileSystem
root memNode
......@@ -59,6 +63,11 @@ func (me *memNode) Print(indent int) {
}
}
// We construct the tree at mount, so we never need to look anything up.
func (me *memNode) Lookup(name string) (fi *os.FileInfo, node FsNode, code Status) {
return nil, nil, ENOENT
}
func (me *memNode) OpenDir(context *fuse.Context) (stream chan fuse.DirEntry, code fuse.Status) {
children := me.Inode().Children()
stream = make(chan fuse.DirEntry, len(children))
......
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