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

Add pointer from fileSystemMount to FileSystemConnector, and use for Debug.

parent ad6f59c6
......@@ -250,6 +250,7 @@ func (me *FileSystemConnector) findInode(fullPath string) *Inode {
func (me *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystemOptions) {
me.rootNode.mountFs(nodeFs, opts)
me.rootNode.mount.connector = me
nodeFs.OnMount(me)
me.verify()
}
......@@ -284,6 +285,7 @@ func (me *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFile
}
node.mountFs(nodeFs, opts)
node.mount.connector = me
parent.addChild(name, node)
if parent.mounts == nil {
......
......@@ -39,6 +39,8 @@ type fileSystemMount struct {
openFiles HandleMap
Debug bool
connector *FileSystemConnector
}
// Must called with lock for parent held.
......@@ -81,8 +83,8 @@ func (me *fileSystemMount) fileInfoToAttr(fi *os.FileInfo, nodeId uint64) (out *
func (me *fileSystemMount) getOpenedFile(h uint64) *openedFile {
b := (*openedFile)(unsafe.Pointer(me.openFiles.Decode(h)))
if me.Debug {
log.Printf("File %d = %s", h, b.WithFlags.Description)
if me.connector.Debug && b.WithFlags.Description != "" {
log.Printf("File %d = %q", h, b.WithFlags.Description)
}
return b
}
......
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