Commit 90b2a0f3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use reflection to provide sensible default name.

parent c057d5f1
...@@ -5,6 +5,7 @@ package fuse ...@@ -5,6 +5,7 @@ package fuse
import ( import (
"bytes" "bytes"
"log" "log"
"reflect"
"time" "time"
"github.com/hanwen/go-fuse/raw" "github.com/hanwen/go-fuse/raw"
...@@ -16,7 +17,13 @@ func (c *FileSystemConnector) String() string { ...@@ -16,7 +17,13 @@ func (c *FileSystemConnector) String() string {
if c.rootNode == nil || c.rootNode.mount == nil { if c.rootNode == nil || c.rootNode.mount == nil {
return "go-fuse:unmounted" return "go-fuse:unmounted"
} }
return c.rootNode.mount.fs.String()
fs := c.rootNode.mount.fs
name := fs.String()
if name == "DefaultNodeFileSystem" {
name = reflect.TypeOf(fs).Name()
}
return name
} }
func (c *FileSystemConnector) Init(fsInit *RawFsInit) { func (c *FileSystemConnector) Init(fsInit *RawFsInit) {
......
package fuse package fuse
import ( import (
"fmt"
"log" "log"
"path/filepath" "path/filepath"
"reflect"
"sync" "sync"
) )
...@@ -88,7 +88,11 @@ func (fs *PathNodeFs) OnUnmount() { ...@@ -88,7 +88,11 @@ func (fs *PathNodeFs) OnUnmount() {
} }
func (fs *PathNodeFs) String() string { func (fs *PathNodeFs) String() string {
return fmt.Sprintf("PathNodeFs(%v)", fs.fs) name := fs.fs.String()
if name == "DefaultFileSystem" {
name = reflect.TypeOf(fs.fs).Name()
}
return name
} }
func (fs *PathNodeFs) OnMount(conn *FileSystemConnector) { func (fs *PathNodeFs) OnMount(conn *FileSystemConnector) {
......
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