Commit 47d385f2 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add OnForget to FsNode interface.

parent 55831d20
...@@ -27,12 +27,15 @@ type FsNode interface { ...@@ -27,12 +27,15 @@ type FsNode interface {
// The following are called by the FileSystemConnector // The following are called by the FileSystemConnector
Inode() *Inode Inode() *Inode
SetInode(node *Inode) SetInode(node *Inode)
// RmChild and AddChild run inside the critical section for
// the mutex behind Inode().LockTree().
RmChild(name string, child FsNode) RmChild(name string, child FsNode)
AddChild(name string, child FsNode) AddChild(name string, child FsNode)
Lookup(name string) (fi *os.FileInfo, node FsNode, code Status) Lookup(name string) (fi *os.FileInfo, node FsNode, code Status)
OnForget()
// Misc. // Misc.
Access(mode uint32, context *Context) (code Status) Access(mode uint32, context *Context) (code Status)
Readlink(c *Context) ([]byte, Status) Readlink(c *Context) ([]byte, Status)
......
...@@ -40,6 +40,9 @@ func (me *DefaultFsNode) Inode() *Inode { ...@@ -40,6 +40,9 @@ func (me *DefaultFsNode) Inode() *Inode {
return me.inode return me.inode
} }
func (me *DefaultFsNode) OnForget() {
}
func (me *DefaultFsNode) RmChild(name string, child FsNode) { func (me *DefaultFsNode) RmChild(name string, child FsNode) {
} }
......
...@@ -139,6 +139,7 @@ func (me *FileSystemConnector) considerDropInode(n *Inode) (drop bool) { ...@@ -139,6 +139,7 @@ func (me *FileSystemConnector) considerDropInode(n *Inode) (drop bool) {
if ch == nil { if ch == nil {
panic(fmt.Sprintf("trying to del child %q, but not present", k)) panic(fmt.Sprintf("trying to del child %q, but not present", k))
} }
ch.fsInode.OnForget()
me.inodeMap.Forget(ch.nodeId) me.inodeMap.Forget(ch.nodeId)
} }
......
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