From 6f8dbe44b0f6364fcaeb81dd021724479762b36f Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Tue, 19 May 2015 15:52:28 +1000 Subject: [PATCH] Restored lost code. --- samples/memfs/inode.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/samples/memfs/inode.go b/samples/memfs/inode.go index b74c4dc..07ee86f 100644 --- a/samples/memfs/inode.go +++ b/samples/memfs/inode.go @@ -168,6 +168,26 @@ func (in *inode) isFile() bool { return !(in.isDir() || in.isSymlink()) } +// Return the index of the child within in.entries, if it exists. +// +// REQUIRES: in.dir +// LOCKS_REQUIRED(in.mu) +func (in *inode) findChild(name string) (i int, ok bool) { + if !in.isDir() { + panic("findChild called on non-directory.") + } + + var e fuseutil.Dirent + for i, e = range in.entries { + if e.Name == name { + ok = true + return + } + } + + return +} + //////////////////////////////////////////////////////////////////////// // Public methods ////////////////////////////////////////////////////////////////////////