Commit 5c47ca23 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Rename PathFileSystem to FileSystem.

parent 9c3ac0b4
...@@ -33,7 +33,7 @@ func main() { ...@@ -33,7 +33,7 @@ func main() {
} }
gofs := unionfs.NewAutoUnionFs(flag.Arg(1), options) gofs := unionfs.NewAutoUnionFs(flag.Arg(1), options)
conn := fuse.NewPathFileSystemConnector(gofs) conn := fuse.NewFileSystemConnector(gofs)
mountState := fuse.NewMountState(conn) mountState := fuse.NewMountState(conn)
mountState.Debug = *debug mountState.Debug = *debug
fmt.Printf("Mounting...\n") fmt.Printf("Mounting...\n")
......
...@@ -16,7 +16,7 @@ var _ = runtime.GOMAXPROCS ...@@ -16,7 +16,7 @@ var _ = runtime.GOMAXPROCS
var _ = log.Print var _ = log.Print
type PathPrintingFs struct { type PathPrintingFs struct {
fuse.WrappingPathFileSystem fuse.WrappingFileSystem
} }
func (me *PathPrintingFs) GetAttr(name string) (*fuse.Attr, fuse.Status) { func (me *PathPrintingFs) GetAttr(name string) (*fuse.Attr, fuse.Status) {
...@@ -35,22 +35,22 @@ func main() { ...@@ -35,22 +35,22 @@ func main() {
os.Exit(2) os.Exit(2)
} }
var fs fuse.PathFileSystem var fs fuse.FileSystem
orig := flag.Arg(1) orig := flag.Arg(1)
loopbackfs := fuse.NewLoopbackFileSystem(orig) loopbackfs := fuse.NewLoopbackFileSystem(orig)
fs = loopbackfs fs = loopbackfs
debugFs := new(fuse.PathFileSystemDebug) debugFs := new(fuse.FileSystemDebug)
debugFs.Original = fs debugFs.Original = fs
fs = debugFs fs = debugFs
timing := fuse.NewTimingPathFileSystem(fs) timing := fuse.NewTimingFileSystem(fs)
fs = timing fs = timing
var opts fuse.PathFileSystemConnectorOptions var opts fuse.FileSystemConnectorOptions
loopbackfs.FillOptions(&opts) loopbackfs.FillOptions(&opts)
conn := fuse.NewPathFileSystemConnector(fs) conn := fuse.NewFileSystemConnector(fs)
debugFs.Connector = conn debugFs.Connector = conn
rawTiming := fuse.NewTimingRawFileSystem(conn) rawTiming := fuse.NewTimingRawFileSystem(conn)
......
...@@ -30,7 +30,7 @@ func main() { ...@@ -30,7 +30,7 @@ func main() {
} }
ufs := unionfs.NewUnionFs(flag.Args()[1:], ufsOptions) ufs := unionfs.NewUnionFs(flag.Args()[1:], ufsOptions)
conn := fuse.NewPathFileSystemConnector(ufs) conn := fuse.NewFileSystemConnector(ufs)
mountState := fuse.NewMountState(conn) mountState := fuse.NewMountState(conn)
mountState.Debug = *debug mountState.Debug = *debug
fmt.Printf("Mounting...\n") fmt.Printf("Mounting...\n")
......
...@@ -22,7 +22,7 @@ func main() { ...@@ -22,7 +22,7 @@ func main() {
} }
fs := zipfs.NewZipArchiveFileSystem(flag.Arg(1)) fs := zipfs.NewZipArchiveFileSystem(flag.Arg(1))
conn := fuse.NewPathFileSystemConnector(fs) conn := fuse.NewFileSystemConnector(fs)
state := fuse.NewMountState(conn) state := fuse.NewMountState(conn)
mountPoint := flag.Arg(0) mountPoint := flag.Arg(0)
......
...@@ -159,95 +159,95 @@ func (me *DefaultFile) Fsync(*FsyncIn) (code Status) { ...@@ -159,95 +159,95 @@ func (me *DefaultFile) Fsync(*FsyncIn) (code Status) {
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// DefaultPathFileSystem // DefaultFileSystem
func (me *DefaultPathFileSystem) GetAttr(name string) (*Attr, Status) { func (me *DefaultFileSystem) GetAttr(name string) (*Attr, Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultPathFileSystem) GetXAttr(name string, attr string) ([]byte, Status) { func (me *DefaultFileSystem) GetXAttr(name string, attr string) ([]byte, Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultPathFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status { func (me *DefaultFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) ListXAttr(name string) ([]string, Status) { func (me *DefaultFileSystem) ListXAttr(name string) ([]string, Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultPathFileSystem) RemoveXAttr(name string, attr string) Status { func (me *DefaultFileSystem) RemoveXAttr(name string, attr string) Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Readlink(name string) (string, Status) { func (me *DefaultFileSystem) Readlink(name string) (string, Status) {
return "", ENOSYS return "", ENOSYS
} }
func (me *DefaultPathFileSystem) Mknod(name string, mode uint32, dev uint32) Status { func (me *DefaultFileSystem) Mknod(name string, mode uint32, dev uint32) Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Mkdir(name string, mode uint32) Status { func (me *DefaultFileSystem) Mkdir(name string, mode uint32) Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Unlink(name string) (code Status) { func (me *DefaultFileSystem) Unlink(name string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Rmdir(name string) (code Status) { func (me *DefaultFileSystem) Rmdir(name string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Symlink(value string, linkName string) (code Status) { func (me *DefaultFileSystem) Symlink(value string, linkName string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Rename(oldName string, newName string) (code Status) { func (me *DefaultFileSystem) Rename(oldName string, newName string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Link(oldName string, newName string) (code Status) { func (me *DefaultFileSystem) Link(oldName string, newName string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Chmod(name string, mode uint32) (code Status) { func (me *DefaultFileSystem) Chmod(name string, mode uint32) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) { func (me *DefaultFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Truncate(name string, offset uint64) (code Status) { func (me *DefaultFileSystem) Truncate(name string, offset uint64) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Open(name string, flags uint32) (file File, code Status) { func (me *DefaultFileSystem) Open(name string, flags uint32) (file File, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultPathFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) { func (me *DefaultFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultPathFileSystem) Mount(conn *PathFileSystemConnector) Status { func (me *DefaultFileSystem) Mount(conn *FileSystemConnector) Status {
return OK return OK
} }
func (me *DefaultPathFileSystem) Unmount() { func (me *DefaultFileSystem) Unmount() {
} }
func (me *DefaultPathFileSystem) Access(name string, mode uint32) (code Status) { func (me *DefaultFileSystem) Access(name string, mode uint32) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) { func (me *DefaultFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultPathFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) { func (me *DefaultFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) {
return ENOSYS return ENOSYS
} }
...@@ -18,10 +18,10 @@ func TestRawFs(t *testing.T) { ...@@ -18,10 +18,10 @@ func TestRawFs(t *testing.T) {
} }
func TestPathFs(t *testing.T) { func TestPathFs(t *testing.T) {
var iface PathFileSystem var iface FileSystem
iface = new(DefaultPathFileSystem) iface = new(DefaultFileSystem)
iface = new(WrappingPathFileSystem) iface = new(WrappingFileSystem)
iface = new(TimingPathFileSystem) iface = new(TimingFileSystem)
_ = iface _ = iface
} }
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
) )
var _ = fmt.Print var _ = fmt.Print
// For PathFileSystemConnector. The connector determines inodes. // For FileSystemConnector. The connector determines inodes.
type DirEntry struct { type DirEntry struct {
Mode uint32 Mode uint32
Name string Name string
......
...@@ -4,153 +4,153 @@ import ( ...@@ -4,153 +4,153 @@ import (
"sync" "sync"
) )
// This is a wrapper that makes a PathFileSystem threadsafe by // This is a wrapper that makes a FileSystem threadsafe by
// trivially locking all operations. For improved performance, you // trivially locking all operations. For improved performance, you
// should probably invent do your own locking inside the file system. // should probably invent do your own locking inside the file system.
type LockingPathFileSystem struct { type LockingFileSystem struct {
// Should be public so people reusing can access the wrapped // Should be public so people reusing can access the wrapped
// FS. // FS.
WrappingPathFileSystem WrappingFileSystem
lock sync.Mutex lock sync.Mutex
} }
func NewLockingPathFileSystem(pfs PathFileSystem) *LockingPathFileSystem { func NewLockingFileSystem(pfs FileSystem) *LockingFileSystem {
l := new(LockingPathFileSystem) l := new(LockingFileSystem)
l.Original = pfs l.Original = pfs
return l return l
} }
func (me *LockingPathFileSystem) GetAttr(name string) (*Attr, Status) { func (me *LockingFileSystem) GetAttr(name string) (*Attr, Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.GetAttr(name) return me.Original.GetAttr(name)
} }
func (me *LockingPathFileSystem) Readlink(name string) (string, Status) { func (me *LockingFileSystem) Readlink(name string) (string, Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Readlink(name) return me.Original.Readlink(name)
} }
func (me *LockingPathFileSystem) Mknod(name string, mode uint32, dev uint32) Status { func (me *LockingFileSystem) Mknod(name string, mode uint32, dev uint32) Status {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Mknod(name, mode, dev) return me.Original.Mknod(name, mode, dev)
} }
func (me *LockingPathFileSystem) Mkdir(name string, mode uint32) Status { func (me *LockingFileSystem) Mkdir(name string, mode uint32) Status {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Mkdir(name, mode) return me.Original.Mkdir(name, mode)
} }
func (me *LockingPathFileSystem) Unlink(name string) (code Status) { func (me *LockingFileSystem) Unlink(name string) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Unlink(name) return me.Original.Unlink(name)
} }
func (me *LockingPathFileSystem) Rmdir(name string) (code Status) { func (me *LockingFileSystem) Rmdir(name string) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Rmdir(name) return me.Original.Rmdir(name)
} }
func (me *LockingPathFileSystem) Symlink(value string, linkName string) (code Status) { func (me *LockingFileSystem) Symlink(value string, linkName string) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Symlink(value, linkName) return me.Original.Symlink(value, linkName)
} }
func (me *LockingPathFileSystem) Rename(oldName string, newName string) (code Status) { func (me *LockingFileSystem) Rename(oldName string, newName string) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Rename(oldName, newName) return me.Original.Rename(oldName, newName)
} }
func (me *LockingPathFileSystem) Link(oldName string, newName string) (code Status) { func (me *LockingFileSystem) Link(oldName string, newName string) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Link(oldName, newName) return me.Original.Link(oldName, newName)
} }
func (me *LockingPathFileSystem) Chmod(name string, mode uint32) (code Status) { func (me *LockingFileSystem) Chmod(name string, mode uint32) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Chmod(name, mode) return me.Original.Chmod(name, mode)
} }
func (me *LockingPathFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) { func (me *LockingFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Chown(name, uid, gid) return me.Original.Chown(name, uid, gid)
} }
func (me *LockingPathFileSystem) Truncate(name string, offset uint64) (code Status) { func (me *LockingFileSystem) Truncate(name string, offset uint64) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Truncate(name, offset) return me.Original.Truncate(name, offset)
} }
func (me *LockingPathFileSystem) Open(name string, flags uint32) (file File, code Status) { func (me *LockingFileSystem) Open(name string, flags uint32) (file File, code Status) {
return me.Original.Open(name, flags) return me.Original.Open(name, flags)
} }
func (me *LockingPathFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) { func (me *LockingFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.OpenDir(name) return me.Original.OpenDir(name)
} }
func (me *LockingPathFileSystem) Mount(conn *PathFileSystemConnector) Status { func (me *LockingFileSystem) Mount(conn *FileSystemConnector) Status {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Mount(conn) return me.Original.Mount(conn)
} }
func (me *LockingPathFileSystem) Unmount() { func (me *LockingFileSystem) Unmount() {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
me.Original.Unmount() me.Original.Unmount()
} }
func (me *LockingPathFileSystem) Access(name string, mode uint32) (code Status) { func (me *LockingFileSystem) Access(name string, mode uint32) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Access(name, mode) return me.Original.Access(name, mode)
} }
func (me *LockingPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) { func (me *LockingFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Create(name, flags, mode) return me.Original.Create(name, flags, mode)
} }
func (me *LockingPathFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) { func (me *LockingFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Utimens(name, AtimeNs, CtimeNs) return me.Original.Utimens(name, AtimeNs, CtimeNs)
} }
func (me *LockingPathFileSystem) GetXAttr(name string, attr string) ([]byte, Status) { func (me *LockingFileSystem) GetXAttr(name string, attr string) ([]byte, Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.GetXAttr(name, attr) return me.Original.GetXAttr(name, attr)
} }
func (me *LockingPathFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status { func (me *LockingFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.SetXAttr(name, attr, data, flags) return me.Original.SetXAttr(name, attr, data, flags)
} }
func (me *LockingPathFileSystem) ListXAttr(name string) ([]string, Status) { func (me *LockingFileSystem) ListXAttr(name string) ([]string, Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.ListXAttr(name) return me.Original.ListXAttr(name)
} }
func (me *LockingPathFileSystem) RemoveXAttr(name string, attr string) Status { func (me *LockingFileSystem) RemoveXAttr(name string, attr string) Status {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.RemoveXAttr(name, attr) return me.Original.RemoveXAttr(name, attr)
......
...@@ -18,7 +18,7 @@ var _ = log.Println ...@@ -18,7 +18,7 @@ var _ = log.Println
type LoopbackFileSystem struct { type LoopbackFileSystem struct {
root string root string
DefaultPathFileSystem DefaultFileSystem
} }
func NewLoopbackFileSystem(root string) (out *LoopbackFileSystem) { func NewLoopbackFileSystem(root string) (out *LoopbackFileSystem) {
...@@ -162,7 +162,7 @@ func (me *LoopbackFileSystem) RemoveXAttr(name string, attr string) Status { ...@@ -162,7 +162,7 @@ func (me *LoopbackFileSystem) RemoveXAttr(name string, attr string) Status {
return Status(Removexattr(me.GetPath(name), attr)) return Status(Removexattr(me.GetPath(name), attr))
} }
func (me *LoopbackFileSystem) FillOptions(options *PathFileSystemConnectorOptions) { func (me *LoopbackFileSystem) FillOptions(options *FileSystemConnectorOptions) {
// These options are to be compatible with libfuse defaults, // These options are to be compatible with libfuse defaults,
// making benchmarking easier. // making benchmarking easier.
options.NegativeTimeout = 1.0 options.NegativeTimeout = 1.0
......
...@@ -34,7 +34,7 @@ type testCase struct { ...@@ -34,7 +34,7 @@ type testCase struct {
origSubfile string origSubfile string
tester *testing.T tester *testing.T
state *MountState state *MountState
connector *PathFileSystemConnector connector *FileSystemConnector
} }
// Create and mount filesystem. // Create and mount filesystem.
...@@ -55,13 +55,13 @@ func (me *testCase) Setup(t *testing.T) { ...@@ -55,13 +55,13 @@ func (me *testCase) Setup(t *testing.T) {
me.origSubdir = filepath.Join(me.origDir, subdir) me.origSubdir = filepath.Join(me.origDir, subdir)
me.origSubfile = filepath.Join(me.origSubdir, "subfile") me.origSubfile = filepath.Join(me.origSubdir, "subfile")
var pfs PathFileSystem var pfs FileSystem
pfs = NewLoopbackFileSystem(me.origDir) pfs = NewLoopbackFileSystem(me.origDir)
pfs = NewTimingPathFileSystem(pfs) pfs = NewTimingFileSystem(pfs)
pfs = NewLockingPathFileSystem(pfs) pfs = NewLockingFileSystem(pfs)
var rfs RawFileSystem var rfs RawFileSystem
me.connector = NewPathFileSystemConnector(pfs) me.connector = NewFileSystemConnector(pfs)
rfs = me.connector rfs = me.connector
rfs = NewTimingRawFileSystem(rfs) rfs = NewTimingRawFileSystem(rfs)
rfs = NewLockingRawFileSystem(rfs) rfs = NewLockingRawFileSystem(rfs)
......
...@@ -5,21 +5,21 @@ import ( ...@@ -5,21 +5,21 @@ import (
var _ = fmt.Println var _ = fmt.Println
type PathFileSystemDebug struct { type FileSystemDebug struct {
// TODO - use a generic callback system instead. // TODO - use a generic callback system instead.
Connector *PathFileSystemConnector Connector *FileSystemConnector
WrappingPathFileSystem WrappingFileSystem
} }
func (me *PathFileSystemDebug) Open(path string, flags uint32) (fuseFile File, status Status) { func (me *FileSystemDebug) Open(path string, flags uint32) (fuseFile File, status Status) {
if path == ".debug" && me.Connector != nil { if path == ".debug" && me.Connector != nil {
return NewReadOnlyFile([]byte(me.Connector.DebugString())), OK return NewReadOnlyFile([]byte(me.Connector.DebugString())), OK
} }
return me.Original.Open(path, flags) return me.Original.Open(path, flags)
} }
func (me *PathFileSystemDebug) GetAttr(path string) (*Attr, Status) { func (me *FileSystemDebug) GetAttr(path string) (*Attr, Status) {
if path == ".debug" && me.Connector != nil { if path == ".debug" && me.Connector != nil {
return &Attr{ return &Attr{
Mode: S_IFREG, Mode: S_IFREG,
......
This diff is collapsed.
...@@ -11,9 +11,9 @@ import ( ...@@ -11,9 +11,9 @@ import (
var _ = log.Print var _ = log.Print
var _ = fmt.Print var _ = fmt.Print
// TimingPathFileSystem is a wrapper to collect timings for a PathFileSystem // TimingFileSystem is a wrapper to collect timings for a FileSystem
type TimingPathFileSystem struct { type TimingFileSystem struct {
WrappingPathFileSystem WrappingFileSystem
statisticsLock sync.Mutex statisticsLock sync.Mutex
latencies map[string]int64 latencies map[string]int64
...@@ -21,8 +21,8 @@ type TimingPathFileSystem struct { ...@@ -21,8 +21,8 @@ type TimingPathFileSystem struct {
pathCounts map[string]map[string]int64 pathCounts map[string]map[string]int64
} }
func NewTimingPathFileSystem(fs PathFileSystem) *TimingPathFileSystem { func NewTimingFileSystem(fs FileSystem) *TimingFileSystem {
t := new(TimingPathFileSystem) t := new(TimingFileSystem)
t.Original = fs t.Original = fs
t.latencies = make(map[string]int64) t.latencies = make(map[string]int64)
t.counts = make(map[string]int64) t.counts = make(map[string]int64)
...@@ -30,7 +30,7 @@ func NewTimingPathFileSystem(fs PathFileSystem) *TimingPathFileSystem { ...@@ -30,7 +30,7 @@ func NewTimingPathFileSystem(fs PathFileSystem) *TimingPathFileSystem {
return t return t
} }
func (me *TimingPathFileSystem) startTimer(name string, arg string) (closure func()) { func (me *TimingFileSystem) startTimer(name string, arg string) (closure func()) {
start := time.Nanoseconds() start := time.Nanoseconds()
return func() { return func() {
...@@ -50,7 +50,7 @@ func (me *TimingPathFileSystem) startTimer(name string, arg string) (closure fun ...@@ -50,7 +50,7 @@ func (me *TimingPathFileSystem) startTimer(name string, arg string) (closure fun
} }
} }
func (me *TimingPathFileSystem) OperationCounts() map[string]int64 { func (me *TimingFileSystem) OperationCounts() map[string]int64 {
me.statisticsLock.Lock() me.statisticsLock.Lock()
defer me.statisticsLock.Unlock() defer me.statisticsLock.Unlock()
...@@ -61,7 +61,7 @@ func (me *TimingPathFileSystem) OperationCounts() map[string]int64 { ...@@ -61,7 +61,7 @@ func (me *TimingPathFileSystem) OperationCounts() map[string]int64 {
return r return r
} }
func (me *TimingPathFileSystem) Latencies() map[string]float64 { func (me *TimingFileSystem) Latencies() map[string]float64 {
me.statisticsLock.Lock() me.statisticsLock.Lock()
defer me.statisticsLock.Unlock() defer me.statisticsLock.Unlock()
...@@ -72,7 +72,7 @@ func (me *TimingPathFileSystem) Latencies() map[string]float64 { ...@@ -72,7 +72,7 @@ func (me *TimingPathFileSystem) Latencies() map[string]float64 {
return r return r
} }
func (me *TimingPathFileSystem) HotPaths(operation string) (paths []string, uniquePaths int) { func (me *TimingFileSystem) HotPaths(operation string) (paths []string, uniquePaths int) {
me.statisticsLock.Lock() me.statisticsLock.Lock()
defer me.statisticsLock.Unlock() defer me.statisticsLock.Unlock()
...@@ -86,117 +86,117 @@ func (me *TimingPathFileSystem) HotPaths(operation string) (paths []string, uniq ...@@ -86,117 +86,117 @@ func (me *TimingPathFileSystem) HotPaths(operation string) (paths []string, uniq
return results, len(counts) return results, len(counts)
} }
func (me *TimingPathFileSystem) GetAttr(name string) (*Attr, Status) { func (me *TimingFileSystem) GetAttr(name string) (*Attr, Status) {
defer me.startTimer("GetAttr", name)() defer me.startTimer("GetAttr", name)()
return me.Original.GetAttr(name) return me.Original.GetAttr(name)
} }
func (me *TimingPathFileSystem) GetXAttr(name string, attr string) ([]byte, Status) { func (me *TimingFileSystem) GetXAttr(name string, attr string) ([]byte, Status) {
defer me.startTimer("GetXAttr", name)() defer me.startTimer("GetXAttr", name)()
return me.Original.GetXAttr(name, attr) return me.Original.GetXAttr(name, attr)
} }
func (me *TimingPathFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status { func (me *TimingFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status {
defer me.startTimer("SetXAttr", name)() defer me.startTimer("SetXAttr", name)()
return me.Original.SetXAttr(name, attr, data, flags) return me.Original.SetXAttr(name, attr, data, flags)
} }
func (me *TimingPathFileSystem) ListXAttr(name string) ([]string, Status) { func (me *TimingFileSystem) ListXAttr(name string) ([]string, Status) {
defer me.startTimer("ListXAttr", name)() defer me.startTimer("ListXAttr", name)()
return me.Original.ListXAttr(name) return me.Original.ListXAttr(name)
} }
func (me *TimingPathFileSystem) RemoveXAttr(name string, attr string) Status { func (me *TimingFileSystem) RemoveXAttr(name string, attr string) Status {
defer me.startTimer("RemoveXAttr", name)() defer me.startTimer("RemoveXAttr", name)()
return me.Original.RemoveXAttr(name, attr) return me.Original.RemoveXAttr(name, attr)
} }
func (me *TimingPathFileSystem) Readlink(name string) (string, Status) { func (me *TimingFileSystem) Readlink(name string) (string, Status) {
defer me.startTimer("Readlink", name)() defer me.startTimer("Readlink", name)()
return me.Original.Readlink(name) return me.Original.Readlink(name)
} }
func (me *TimingPathFileSystem) Mknod(name string, mode uint32, dev uint32) Status { func (me *TimingFileSystem) Mknod(name string, mode uint32, dev uint32) Status {
defer me.startTimer("Mknod", name)() defer me.startTimer("Mknod", name)()
return me.Original.Mknod(name, mode, dev) return me.Original.Mknod(name, mode, dev)
} }
func (me *TimingPathFileSystem) Mkdir(name string, mode uint32) Status { func (me *TimingFileSystem) Mkdir(name string, mode uint32) Status {
defer me.startTimer("Mkdir", name)() defer me.startTimer("Mkdir", name)()
return me.Original.Mkdir(name, mode) return me.Original.Mkdir(name, mode)
} }
func (me *TimingPathFileSystem) Unlink(name string) (code Status) { func (me *TimingFileSystem) Unlink(name string) (code Status) {
defer me.startTimer("Unlink", name)() defer me.startTimer("Unlink", name)()
return me.Original.Unlink(name) return me.Original.Unlink(name)
} }
func (me *TimingPathFileSystem) Rmdir(name string) (code Status) { func (me *TimingFileSystem) Rmdir(name string) (code Status) {
defer me.startTimer("Rmdir", name)() defer me.startTimer("Rmdir", name)()
return me.Original.Rmdir(name) return me.Original.Rmdir(name)
} }
func (me *TimingPathFileSystem) Symlink(value string, linkName string) (code Status) { func (me *TimingFileSystem) Symlink(value string, linkName string) (code Status) {
defer me.startTimer("Symlink", linkName)() defer me.startTimer("Symlink", linkName)()
return me.Original.Symlink(value, linkName) return me.Original.Symlink(value, linkName)
} }
func (me *TimingPathFileSystem) Rename(oldName string, newName string) (code Status) { func (me *TimingFileSystem) Rename(oldName string, newName string) (code Status) {
defer me.startTimer("Rename", oldName)() defer me.startTimer("Rename", oldName)()
return me.Original.Rename(oldName, newName) return me.Original.Rename(oldName, newName)
} }
func (me *TimingPathFileSystem) Link(oldName string, newName string) (code Status) { func (me *TimingFileSystem) Link(oldName string, newName string) (code Status) {
defer me.startTimer("Link", newName)() defer me.startTimer("Link", newName)()
return me.Original.Link(oldName, newName) return me.Original.Link(oldName, newName)
} }
func (me *TimingPathFileSystem) Chmod(name string, mode uint32) (code Status) { func (me *TimingFileSystem) Chmod(name string, mode uint32) (code Status) {
defer me.startTimer("Chmod", name)() defer me.startTimer("Chmod", name)()
return me.Original.Chmod(name, mode) return me.Original.Chmod(name, mode)
} }
func (me *TimingPathFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) { func (me *TimingFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) {
defer me.startTimer("Chown", name)() defer me.startTimer("Chown", name)()
return me.Original.Chown(name, uid, gid) return me.Original.Chown(name, uid, gid)
} }
func (me *TimingPathFileSystem) Truncate(name string, offset uint64) (code Status) { func (me *TimingFileSystem) Truncate(name string, offset uint64) (code Status) {
defer me.startTimer("Truncate", name)() defer me.startTimer("Truncate", name)()
return me.Original.Truncate(name, offset) return me.Original.Truncate(name, offset)
} }
func (me *TimingPathFileSystem) Open(name string, flags uint32) (file File, code Status) { func (me *TimingFileSystem) Open(name string, flags uint32) (file File, code Status) {
defer me.startTimer("Open", name)() defer me.startTimer("Open", name)()
return me.Original.Open(name, flags) return me.Original.Open(name, flags)
} }
func (me *TimingPathFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) { func (me *TimingFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) {
defer me.startTimer("OpenDir", name)() defer me.startTimer("OpenDir", name)()
return me.Original.OpenDir(name) return me.Original.OpenDir(name)
} }
func (me *TimingPathFileSystem) Mount(conn *PathFileSystemConnector) Status { func (me *TimingFileSystem) Mount(conn *FileSystemConnector) Status {
defer me.startTimer("Mount", "")() defer me.startTimer("Mount", "")()
return me.Original.Mount(conn) return me.Original.Mount(conn)
} }
func (me *TimingPathFileSystem) Unmount() { func (me *TimingFileSystem) Unmount() {
defer me.startTimer("Unmount", "")() defer me.startTimer("Unmount", "")()
me.Original.Unmount() me.Original.Unmount()
} }
func (me *TimingPathFileSystem) Access(name string, mode uint32) (code Status) { func (me *TimingFileSystem) Access(name string, mode uint32) (code Status) {
defer me.startTimer("Access", name)() defer me.startTimer("Access", name)()
return me.Original.Access(name, mode) return me.Original.Access(name, mode)
} }
func (me *TimingPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) { func (me *TimingFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
defer me.startTimer("Create", name)() defer me.startTimer("Create", name)()
return me.Original.Create(name, flags, mode) return me.Original.Create(name, flags, mode)
} }
func (me *TimingPathFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) { func (me *TimingFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) {
defer me.startTimer("Utimens", name)() defer me.startTimer("Utimens", name)()
return me.Original.Utimens(name, AtimeNs, CtimeNs) return me.Original.Utimens(name, AtimeNs, CtimeNs)
} }
...@@ -498,7 +498,7 @@ type NotifyInvalEntryOut struct { ...@@ -498,7 +498,7 @@ type NotifyInvalEntryOut struct {
// //
// Typically, each call happens in its own goroutine, so any global // Typically, each call happens in its own goroutine, so any global
// data should be made thread-safe. Unless you really know what you // data should be made thread-safe. Unless you really know what you
// are doing, you should not implement this, but PathFileSystem below; // are doing, you should not implement this, but FileSystem below;
// the details of getting interactions with open files, renames, and // the details of getting interactions with open files, renames, and
// threading right etc. are somewhat tricky and not very interesting. // threading right etc. are somewhat tricky and not very interesting.
type RawFileSystem interface { type RawFileSystem interface {
...@@ -561,7 +561,7 @@ type RawDir interface { ...@@ -561,7 +561,7 @@ type RawDir interface {
Release() Release()
} }
type PathFileSystem interface { type FileSystem interface {
GetAttr(name string) (*Attr, Status) GetAttr(name string) (*Attr, Status)
Readlink(name string) (string, Status) Readlink(name string) (string, Status)
Mknod(name string, mode uint32, dev uint32) Status Mknod(name string, mode uint32, dev uint32) Status
...@@ -586,7 +586,7 @@ type PathFileSystem interface { ...@@ -586,7 +586,7 @@ type PathFileSystem interface {
OpenDir(name string) (stream chan DirEntry, code Status) OpenDir(name string) (stream chan DirEntry, code Status)
// TODO - what is a good interface? // TODO - what is a good interface?
Mount(connector *PathFileSystemConnector) Status Mount(connector *FileSystemConnector) Status
Unmount() Unmount()
Access(name string, mode uint32) (code Status) Access(name string, mode uint32) (code Status)
...@@ -599,6 +599,6 @@ type PathFileSystem interface { ...@@ -599,6 +599,6 @@ type PathFileSystem interface {
// Include this struct in your implementation to inherit default nop // Include this struct in your implementation to inherit default nop
// implementations. // implementations.
type DefaultPathFileSystem struct{} type DefaultFileSystem struct{}
type DefaultFile struct{} type DefaultFile struct{}
type DefaultRawFileSystem struct{} type DefaultRawFileSystem struct{}
package fuse package fuse
type WrappingPathFileSystem struct { type WrappingFileSystem struct {
// Should be public so people reusing can access the wrapped // Should be public so people reusing can access the wrapped
// FS. // FS.
Original PathFileSystem Original FileSystem
} }
func (me *WrappingPathFileSystem) GetAttr(name string) (*Attr, Status) { func (me *WrappingFileSystem) GetAttr(name string) (*Attr, Status) {
return me.Original.GetAttr(name) return me.Original.GetAttr(name)
} }
func (me *WrappingPathFileSystem) Readlink(name string) (string, Status) { func (me *WrappingFileSystem) Readlink(name string) (string, Status) {
return me.Original.Readlink(name) return me.Original.Readlink(name)
} }
func (me *WrappingPathFileSystem) Mknod(name string, mode uint32, dev uint32) Status { func (me *WrappingFileSystem) Mknod(name string, mode uint32, dev uint32) Status {
return me.Original.Mknod(name, mode, dev) return me.Original.Mknod(name, mode, dev)
} }
func (me *WrappingPathFileSystem) Mkdir(name string, mode uint32) Status { func (me *WrappingFileSystem) Mkdir(name string, mode uint32) Status {
return me.Original.Mkdir(name, mode) return me.Original.Mkdir(name, mode)
} }
func (me *WrappingPathFileSystem) Unlink(name string) (code Status) { func (me *WrappingFileSystem) Unlink(name string) (code Status) {
return me.Original.Unlink(name) return me.Original.Unlink(name)
} }
func (me *WrappingPathFileSystem) Rmdir(name string) (code Status) { func (me *WrappingFileSystem) Rmdir(name string) (code Status) {
return me.Original.Rmdir(name) return me.Original.Rmdir(name)
} }
func (me *WrappingPathFileSystem) Symlink(value string, linkName string) (code Status) { func (me *WrappingFileSystem) Symlink(value string, linkName string) (code Status) {
return me.Original.Symlink(value, linkName) return me.Original.Symlink(value, linkName)
} }
func (me *WrappingPathFileSystem) Rename(oldName string, newName string) (code Status) { func (me *WrappingFileSystem) Rename(oldName string, newName string) (code Status) {
return me.Original.Rename(oldName, newName) return me.Original.Rename(oldName, newName)
} }
func (me *WrappingPathFileSystem) Link(oldName string, newName string) (code Status) { func (me *WrappingFileSystem) Link(oldName string, newName string) (code Status) {
return me.Original.Link(oldName, newName) return me.Original.Link(oldName, newName)
} }
func (me *WrappingPathFileSystem) Chmod(name string, mode uint32) (code Status) { func (me *WrappingFileSystem) Chmod(name string, mode uint32) (code Status) {
return me.Original.Chmod(name, mode) return me.Original.Chmod(name, mode)
} }
func (me *WrappingPathFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) { func (me *WrappingFileSystem) Chown(name string, uid uint32, gid uint32) (code Status) {
return me.Original.Chown(name, uid, gid) return me.Original.Chown(name, uid, gid)
} }
func (me *WrappingPathFileSystem) Truncate(name string, offset uint64) (code Status) { func (me *WrappingFileSystem) Truncate(name string, offset uint64) (code Status) {
return me.Original.Truncate(name, offset) return me.Original.Truncate(name, offset)
} }
func (me *WrappingPathFileSystem) Open(name string, flags uint32) (file File, code Status) { func (me *WrappingFileSystem) Open(name string, flags uint32) (file File, code Status) {
return me.Original.Open(name, flags) return me.Original.Open(name, flags)
} }
func (me *WrappingPathFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) { func (me *WrappingFileSystem) OpenDir(name string) (stream chan DirEntry, status Status) {
return me.Original.OpenDir(name) return me.Original.OpenDir(name)
} }
func (me *WrappingPathFileSystem) Mount(conn *PathFileSystemConnector) Status { func (me *WrappingFileSystem) Mount(conn *FileSystemConnector) Status {
return me.Original.Mount(conn) return me.Original.Mount(conn)
} }
func (me *WrappingPathFileSystem) Unmount() { func (me *WrappingFileSystem) Unmount() {
me.Original.Unmount() me.Original.Unmount()
} }
func (me *WrappingPathFileSystem) Access(name string, mode uint32) (code Status) { func (me *WrappingFileSystem) Access(name string, mode uint32) (code Status) {
return me.Original.Access(name, mode) return me.Original.Access(name, mode)
} }
func (me *WrappingPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) { func (me *WrappingFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
return me.Original.Create(name, flags, mode) return me.Original.Create(name, flags, mode)
} }
func (me *WrappingPathFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) { func (me *WrappingFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) {
return me.Original.Utimens(name, AtimeNs, CtimeNs) return me.Original.Utimens(name, AtimeNs, CtimeNs)
} }
func (me *WrappingPathFileSystem) GetXAttr(name string, attr string) ([]byte, Status) { func (me *WrappingFileSystem) GetXAttr(name string, attr string) ([]byte, Status) {
return me.Original.GetXAttr(name, attr) return me.Original.GetXAttr(name, attr)
} }
func (me *WrappingPathFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status { func (me *WrappingFileSystem) SetXAttr(name string, attr string, data []byte, flags int) Status {
return me.Original.SetXAttr(name, attr, data, flags) return me.Original.SetXAttr(name, attr, data, flags)
} }
func (me *WrappingPathFileSystem) ListXAttr(name string) ([]string, Status) { func (me *WrappingFileSystem) ListXAttr(name string) ([]string, Status) {
return me.Original.ListXAttr(name) return me.Original.ListXAttr(name)
} }
func (me *WrappingPathFileSystem) RemoveXAttr(name string, attr string) Status { func (me *WrappingFileSystem) RemoveXAttr(name string, attr string) Status {
return me.Original.RemoveXAttr(name, attr) return me.Original.RemoveXAttr(name, attr)
} }
......
...@@ -15,7 +15,7 @@ type XAttrTestFs struct { ...@@ -15,7 +15,7 @@ type XAttrTestFs struct {
filename string filename string
attrs map[string][]byte attrs map[string][]byte
DefaultPathFileSystem DefaultFileSystem
} }
func NewXAttrFs(nm string, m map[string][]byte) *XAttrTestFs { func NewXAttrFs(nm string, m map[string][]byte) *XAttrTestFs {
...@@ -93,7 +93,7 @@ func TestXAttrRead(t *testing.T) { ...@@ -93,7 +93,7 @@ func TestXAttrRead(t *testing.T) {
"user.attr2": []byte("val2")} "user.attr2": []byte("val2")}
xfs := NewXAttrFs(nm, golden) xfs := NewXAttrFs(nm, golden)
connector := NewPathFileSystemConnector(NewLockingPathFileSystem(xfs)) connector := NewFileSystemConnector(NewLockingFileSystem(xfs))
mountPoint := MakeTempDir() mountPoint := MakeTempDir()
state := NewMountState(connector) state := NewMountState(connector)
......
...@@ -18,13 +18,13 @@ import ( ...@@ -18,13 +18,13 @@ import (
// //
// A union for A/B/C will placed under directory A-B-C. // A union for A/B/C will placed under directory A-B-C.
type AutoUnionFs struct { type AutoUnionFs struct {
fuse.DefaultPathFileSystem fuse.DefaultFileSystem
lock sync.RWMutex lock sync.RWMutex
knownFileSystems map[string]*UnionFs knownFileSystems map[string]*UnionFs
root string root string
connector *fuse.PathFileSystemConnector connector *fuse.FileSystemConnector
options *AutoUnionFsOptions options *AutoUnionFsOptions
} }
...@@ -41,7 +41,7 @@ func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs { ...@@ -41,7 +41,7 @@ func NewAutoUnionFs(directory string, options AutoUnionFsOptions) *AutoUnionFs {
return a return a
} }
func (me *AutoUnionFs) Mount(connector *fuse.PathFileSystemConnector) fuse.Status { func (me *AutoUnionFs) Mount(connector *fuse.FileSystemConnector) fuse.Status {
me.connector = connector me.connector = connector
time.AfterFunc(0.1e9, func() { me.updateKnownFses() }) time.AfterFunc(0.1e9, func() { me.updateKnownFses() })
return fuse.OK return fuse.OK
......
...@@ -22,7 +22,7 @@ type linkResponse struct { ...@@ -22,7 +22,7 @@ type linkResponse struct {
// Caches readdir and getattr() // Caches readdir and getattr()
type CachingFileSystem struct { type CachingFileSystem struct {
fuse.WrappingPathFileSystem fuse.WrappingFileSystem
attributesLock sync.RWMutex attributesLock sync.RWMutex
attributes map[string]attrResponse attributes map[string]attrResponse
...@@ -34,7 +34,7 @@ type CachingFileSystem struct { ...@@ -34,7 +34,7 @@ type CachingFileSystem struct {
links map[string]linkResponse links map[string]linkResponse
} }
func NewCachingFileSystem(pfs fuse.PathFileSystem) *CachingFileSystem { func NewCachingFileSystem(pfs fuse.FileSystem) *CachingFileSystem {
c := new(CachingFileSystem) c := new(CachingFileSystem)
c.Original = pfs c.Original = pfs
c.attributes = make(map[string]attrResponse) c.attributes = make(map[string]attrResponse)
......
...@@ -58,12 +58,12 @@ func filePathHash(path string) string { ...@@ -58,12 +58,12 @@ func filePathHash(path string) string {
*/ */
type UnionFs struct { type UnionFs struct {
fuse.DefaultPathFileSystem fuse.DefaultFileSystem
branches []*fuse.LoopbackFileSystem branches []*fuse.LoopbackFileSystem
// The same, but as interfaces. // The same, but as interfaces.
fileSystems []fuse.PathFileSystem fileSystems []fuse.FileSystem
// A file-existence cache. // A file-existence cache.
deletionCache *DirCache deletionCache *DirCache
...@@ -89,7 +89,7 @@ func NewUnionFs(roots []string, options UnionFsOptions) *UnionFs { ...@@ -89,7 +89,7 @@ func NewUnionFs(roots []string, options UnionFsOptions) *UnionFs {
g.branches = append(g.branches, pt) g.branches = append(g.branches, pt)
// We could use some sort of caching file system here. // We could use some sort of caching file system here.
g.fileSystems = append(g.fileSystems, fuse.PathFileSystem(pt)) g.fileSystems = append(g.fileSystems, fuse.FileSystem(pt))
} }
deletionDir := g.deletionDir() deletionDir := g.deletionDir()
...@@ -232,7 +232,7 @@ src *fuse.LoopbackFileSystem) os.Error { ...@@ -232,7 +232,7 @@ src *fuse.LoopbackFileSystem) os.Error {
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// Below: implement interface for a PathFileSystem. // Below: implement interface for a FileSystem.
func (me *UnionFs) Mkdir(path string, mode uint32) (code fuse.Status) { func (me *UnionFs) Mkdir(path string, mode uint32) (code fuse.Status) {
code = me.fileSystems[0].Mkdir(path, mode) code = me.fileSystems[0].Mkdir(path, mode)
...@@ -344,7 +344,7 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status ...@@ -344,7 +344,7 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status
for i, l := range me.fileSystems { for i, l := range me.fileSystems {
if i >= dirBranch { if i >= dirBranch {
wg.Add(1) wg.Add(1)
go func(j int, pfs fuse.PathFileSystem) { go func(j int, pfs fuse.FileSystem) {
ch, s := pfs.OpenDir(directory) ch, s := pfs.OpenDir(directory)
statuses[j] = s statuses[j] = s
for s == fuse.OK { for s == fuse.OK {
......
...@@ -40,7 +40,7 @@ func setup(t *testing.T) (workdir string, state *fuse.MountState) { ...@@ -40,7 +40,7 @@ func setup(t *testing.T) (workdir string, state *fuse.MountState) {
roots = append(roots, wd+"/ro") roots = append(roots, wd+"/ro")
ufs := NewUnionFs(roots, testOpts) ufs := NewUnionFs(roots, testOpts)
connector := fuse.NewPathFileSystemConnector(ufs) connector := fuse.NewFileSystemConnector(ufs)
state = fuse.NewMountState(connector) state = fuse.NewMountState(connector)
state.Mount(wd + "/mount") state.Mount(wd + "/mount")
......
...@@ -68,16 +68,16 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f ...@@ -68,16 +68,16 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// MultiZipFs is a path filesystem that mounts zipfiles. It needs a // MultiZipFs is a path filesystem that mounts zipfiles. It needs a
// reference to the PathFileSystemConnector to be able to execute // reference to the FileSystemConnector to be able to execute
// mounts. // mounts.
type MultiZipFs struct { type MultiZipFs struct {
Connector *fuse.PathFileSystemConnector Connector *fuse.FileSystemConnector
lock sync.RWMutex lock sync.RWMutex
zips map[string]*ZipArchiveFileSystem zips map[string]*ZipArchiveFileSystem
pendingZips map[string]bool pendingZips map[string]bool
zipFileNames map[string]string zipFileNames map[string]string
fuse.DefaultPathFileSystem fuse.DefaultFileSystem
} }
func NewMultiZipFs() *MultiZipFs { func NewMultiZipFs() *MultiZipFs {
...@@ -85,7 +85,7 @@ func NewMultiZipFs() *MultiZipFs { ...@@ -85,7 +85,7 @@ func NewMultiZipFs() *MultiZipFs {
m.zips = make(map[string]*ZipArchiveFileSystem) m.zips = make(map[string]*ZipArchiveFileSystem)
m.pendingZips = make(map[string]bool) m.pendingZips = make(map[string]bool)
m.zipFileNames = make(map[string]string) m.zipFileNames = make(map[string]string)
m.Connector = fuse.NewPathFileSystemConnector(m) m.Connector = fuse.NewFileSystemConnector(m)
return m return m
} }
......
...@@ -75,7 +75,7 @@ type ZipArchiveFileSystem struct { ...@@ -75,7 +75,7 @@ type ZipArchiveFileSystem struct {
tree *ZipDirTree tree *ZipDirTree
ZipFileName string ZipFileName string
fuse.DefaultPathFileSystem fuse.DefaultFileSystem
} }
func zipFilesToTree(files []*zip.File) *ZipDirTree { func zipFilesToTree(files []*zip.File) *ZipDirTree {
......
...@@ -11,7 +11,7 @@ func TestZipFs(t *testing.T) { ...@@ -11,7 +11,7 @@ func TestZipFs(t *testing.T) {
CheckSuccess(err) CheckSuccess(err)
zfs := NewZipArchiveFileSystem(wd + "/test.zip") zfs := NewZipArchiveFileSystem(wd + "/test.zip")
connector := fuse.NewPathFileSystemConnector(zfs) connector := fuse.NewFileSystemConnector(zfs)
mountPoint := fuse.MakeTempDir() mountPoint := fuse.MakeTempDir()
state := fuse.NewMountState(connector) state := fuse.NewMountState(connector)
......
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