Commit c5f5d8c0 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Add documentation TODO.

parent c403ae36
package fuse package fuse
// This file contains the internal logic of the // This file contains the internal logic of the
// FileSystemConnector. The functions for satisfying the raw interface are in // FileSystemConnector. The functions for satisfying the raw interface
// fsops.go // are in fsops.go
/* TODO - document overall structure and locking strategy.
"at a first glance, questions that come up: why doesn't fsconnector
have the lock, why does every node need it? (I have some ideas, but
they take a while to verify)"
"a short sum up on how the forget count is handled"
*/
import ( import (
"fmt" "fmt"
"log" "log"
...@@ -47,7 +56,7 @@ func NewFileSystemConnector(nodeFs NodeFileSystem, opts *FileSystemOptions) (me ...@@ -47,7 +56,7 @@ func NewFileSystemConnector(nodeFs NodeFileSystem, opts *FileSystemOptions) (me
// FUSE does not issue a LOOKUP for 1 (obviously), but it does // FUSE does not issue a LOOKUP for 1 (obviously), but it does
// issue a forget. This lookupCount is to make the counts match. // issue a forget. This lookupCount is to make the counts match.
me.lookupUpdate(me.rootNode) me.lookupUpdate(me.rootNode)
me.verify() me.verify()
me.MountRoot(nodeFs, opts) me.MountRoot(nodeFs, opts)
return me return me
...@@ -75,7 +84,7 @@ func (me *FileSystemConnector) createChild(parent *Inode, name string, fi *os.Fi ...@@ -75,7 +84,7 @@ func (me *FileSystemConnector) createChild(parent *Inode, name string, fi *os.Fi
parent.addChild(name, child) parent.addChild(name, child)
} }
me.lookupUpdate(child) me.lookupUpdate(child)
out = parent.mount.fileInfoToEntry(fi) out = parent.mount.fileInfoToEntry(fi)
out.Ino = child.nodeId out.Ino = child.nodeId
out.NodeId = child.nodeId out.NodeId = child.nodeId
...@@ -121,7 +130,7 @@ func (me *FileSystemConnector) forgetUpdate(node *Inode, forgetCount int) { ...@@ -121,7 +130,7 @@ func (me *FileSystemConnector) forgetUpdate(node *Inode, forgetCount int) {
} else if node.lookupCount < 0 { } else if node.lookupCount < 0 {
panic(fmt.Sprintf("lookupCount underflow: %d: %v", node.lookupCount, me)) panic(fmt.Sprintf("lookupCount underflow: %d: %v", node.lookupCount, me))
} }
me.recursiveConsiderDropInode(node) me.recursiveConsiderDropInode(node)
} }
...@@ -317,7 +326,7 @@ func (me *FileSystemConnector) Unmount(node *Inode) Status { ...@@ -317,7 +326,7 @@ func (me *FileSystemConnector) Unmount(node *Inode) Status {
parentNode.mounts[name] = nil, false parentNode.mounts[name] = nil, false
parentNode.children[name] = nil, false parentNode.children[name] = nil, false
mount.fs.OnUnmount() mount.fs.OnUnmount()
me.EntryNotify(parentNode, name) me.EntryNotify(parentNode, name)
return OK return OK
...@@ -334,7 +343,7 @@ func (me *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) ...@@ -334,7 +343,7 @@ func (me *FileSystemConnector) FileNotify(node *Inode, off int64, length int64)
out := NotifyInvalInodeOut{ out := NotifyInvalInodeOut{
Length: length, Length: length,
Off: off, Off: off,
Ino: n, Ino: n,
} }
return me.fsInit.InodeNotify(&out) return me.fsInit.InodeNotify(&out)
} }
......
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