func (n *Inode) RmChild(name string) (ch *Inode) {
	n.mount.treeLock.Lock()
	ch = n.rmChild(name)
	n.mount.treeLock.Unlock()
	return
}
RmChild removes an inode by name, and returns it. It returns nil if
child does not exist.
package nodefs
import (
	"log"
	"sync"
	"github.com/hanwen/go-fuse/fuse"
)
type parentData struct {
	parent *Inode
	name   string
}
type Inode struct {
	handled handled
	generation uint64
	openFilesMutex sync.Mutex
	openFiles      []*openedFile
	fsInode Node
	mount *fileSystemMount
	children map[string]*Inode
	parents map[parentData]struct{}
	mountPoint *fileSystemMount
}
func newInode(isDir bool, fsNode Node) *Inode {
	me := new(Inode)
	me.parents = map[parentData]struct{}{}
	if isDir {
		me.children = make(map[string]*Inode, initDirSize)
	}
	me.fsInode = fsNode
	me.fsInode.SetInode(me)
	return me
}
func (n *Inode) AnyFile() (file File) {
	n.openFilesMutex.Lock()
	for _, f := range n.openFiles {
		if file == nil || f.WithFlags.OpenFlags&fuse.O_ANYWRITE != 0 {
			file = f.WithFlags.File
		}
	}
	n.openFilesMutex.Unlock()
	return file
}
func (n *Inode) Children() (out map[string]*Inode) {
	n.mount.treeLock.RLock()
	out = make(map[string]*Inode, len(n.children))
	for k, v := range n.children {
		out[k] = v
	}
	n.mount.treeLock.RUnlock()
	return out
}
func (n *Inode) Parent() (parent *Inode, name string) {
	if n.mountPoint != nil {
		return nil, ""
	}
	for k := range n.parents {
		return k.parent, k.name
	}
	return nil, ""
}
func (n *Inode) FsChildren() (out map[string]*Inode) {
	n.mount.treeLock.RLock()
	out = map[string]*Inode{}
	for k, v := range n.children {
		if v.mount == n.mount {
			out[k] = v
		}
	}
	n.mount.treeLock.RUnlock()
	return out
}
func (n *Inode) Node() Node {
	return n.fsInode
}
func (n *Inode) Files(mask uint32) (files []WithFlags) {
	n.openFilesMutex.Lock()
	for _, f := range n.openFiles {
		if mask == 0 || f.WithFlags.OpenFlags&mask != 0 {
			files = append(files, f.WithFlags)
		}
	}
	n.openFilesMutex.Unlock()
	return files
}
func (n *Inode) IsDir() bool {
	return n.children != nil
}
func (n *Inode) NewChild(name string, isDir bool, fsi Node) *Inode {
	ch := newInode(isDir, fsi)
	ch.mount = n.mount
	n.AddChild(name, ch)
	return ch
}
func (n *Inode) GetChild(name string) (child *Inode) {
	n.mount.treeLock.RLock()
	child = n.children[name]
	n.mount.treeLock.RUnlock()
	return child
}
func (n *Inode) AddChild(name string, child *Inode) {
	if child == nil {
		log.Panicf("adding nil child as %q", name)
	}
	n.mount.treeLock.Lock()
	n.addChild(name, child)
	n.mount.treeLock.Unlock()
}
type TreeWatcher interface {
	OnAdd(parent *Inode, name string)
	OnRemove(parent *Inode, name string)
}