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

Rename PathFileSystem to FileSystem.

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