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