From 93ed47299ecff33faf861538662cceaf49782fd2 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Mon, 2 Mar 2015 15:19:20 +1100 Subject: [PATCH] Implemented memDir.LookUpInode. --- samples/memfs/dir.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/samples/memfs/dir.go b/samples/memfs/dir.go index 9f127b1..3e96f91 100644 --- a/samples/memfs/dir.go +++ b/samples/memfs/dir.go @@ -50,4 +50,17 @@ func (d *memDir) checkInvariants() { // Find the inode ID of the child with the given name. // // LOCKS_EXCLUDED(d.mu) -func (d *memDir) LookUpInode(name string) (id fuse.InodeID, ok bool) +func (d *memDir) LookUpInode(name string) (id fuse.InodeID, ok bool) { + d.mu.RLock() + defer d.mu.RUnlock() + + for _, e := range d.entries { + if e.Name == name { + ok = true + id = e.Inode + return + } + } + + return +}