Commit 66a1eff3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/nodefs: add Inode.String

Otherwise, printing inodes generates panics, because of concurrent writes.
parent 3287bcc4
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
package nodefs package nodefs
import ( import (
"fmt"
"log" "log"
"sync" "sync"
...@@ -58,6 +59,13 @@ func newInode(isDir bool, fsNode Node) *Inode { ...@@ -58,6 +59,13 @@ func newInode(isDir bool, fsNode Node) *Inode {
// public methods. // public methods.
// Print the inode. The default print method may not be used for
// debugging, as dumping the map requires synchronization.
func (n *Inode) String() string {
return fmt.Sprintf("node{%d}", n.handled.handle)
}
// Returns any open file, preferably a r/w one. // Returns any open file, preferably a r/w one.
func (n *Inode) AnyFile() (file File) { func (n *Inode) AnyFile() (file File) {
n.openFilesMutex.Lock() n.openFilesMutex.Lock()
......
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