Commit 4cf05ec3 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Remove MountPathFileSystem.

parent 5d8ba04f
...@@ -72,7 +72,8 @@ func NewStatFs() *StatFs { ...@@ -72,7 +72,8 @@ func NewStatFs() *StatFs {
func setupFs(fs fuse.FileSystem, opts *fuse.FileSystemOptions) (string, func()) { func setupFs(fs fuse.FileSystem, opts *fuse.FileSystemOptions) (string, func()) {
mountPoint, _ := ioutil.TempDir("", "stat_test") mountPoint, _ := ioutil.TempDir("", "stat_test")
state, _, err := fuse.MountPathFileSystem(mountPoint, fs, opts) nfs := fuse.NewPathNodeFs(fs, nil)
state, _, err := fuse.MountNodeFileSystem(mountPoint, nfs, opts)
if err != nil { if err != nil {
panic(fmt.Sprintf("cannot mount %v", err)) // ugh - benchmark has no error methods. panic(fmt.Sprintf("cannot mount %v", err)) // ugh - benchmark has no error methods.
} }
......
...@@ -52,7 +52,8 @@ func main() { ...@@ -52,7 +52,8 @@ func main() {
if len(flag.Args()) < 1 { if len(flag.Args()) < 1 {
log.Fatal("Usage:\n hello MOUNTPOINT") log.Fatal("Usage:\n hello MOUNTPOINT")
} }
state, _, err := fuse.MountPathFileSystem(flag.Arg(0), &HelloFs{}, nil) nfs := fuse.NewPathNodeFs(&HelloFs{}, nil)
state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), nfs, nil)
if err != nil { if err != nil {
log.Fatal("Mount fail: %v\n", err) log.Fatal("Mount fail: %v\n", err)
} }
......
...@@ -22,7 +22,8 @@ func main() { ...@@ -22,7 +22,8 @@ func main() {
} }
fs := zipfs.NewMultiZipFs() fs := zipfs.NewMultiZipFs()
state, _, err := fuse.MountPathFileSystem(flag.Arg(0), fs, nil) nfs := fuse.NewPathNodeFs(fs, nil)
state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), nfs, nil)
if err != nil { if err != nil {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
......
...@@ -136,6 +136,12 @@ type FileSystem interface { ...@@ -136,6 +136,12 @@ type FileSystem interface {
StatFs(name string) *StatfsOut StatFs(name string) *StatfsOut
} }
type PathNodeFsOptions struct {
// If ClientInodes is set, use Inode returned from GetAttr to
// find hard-linked files.
ClientInodes bool
}
// A File object should be returned from FileSystem.Open and // A File object should be returned from FileSystem.Open and
// FileSystem.Create. Include DefaultFile into the struct to inherit // FileSystem.Create. Include DefaultFile into the struct to inherit
// a default null implementation. // a default null implementation.
......
...@@ -122,7 +122,8 @@ func TestNonseekable(t *testing.T) { ...@@ -122,7 +122,8 @@ func TestNonseekable(t *testing.T) {
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse")
CheckSuccess(err) CheckSuccess(err)
defer os.RemoveAll(dir) defer os.RemoveAll(dir)
state, _, err := MountPathFileSystem(dir, fs, nil) nfs := NewPathNodeFs(fs, nil)
state, _, err := MountNodeFileSystem(dir, nfs, nil)
CheckSuccess(err) CheckSuccess(err)
state.Debug = VerboseTest() state.Debug = VerboseTest()
defer state.Unmount() defer state.Unmount()
......
...@@ -122,7 +122,8 @@ func NewFile() *MutableDataFile { ...@@ -122,7 +122,8 @@ func NewFile() *MutableDataFile {
func setupFAttrTest(t *testing.T, fs FileSystem) (dir string, clean func()) { func setupFAttrTest(t *testing.T, fs FileSystem) (dir string, clean func()) {
dir, err := ioutil.TempDir("", "go-fuse") dir, err := ioutil.TempDir("", "go-fuse")
CheckSuccess(err) CheckSuccess(err)
state, _, err := MountPathFileSystem(dir, fs, nil) nfs := NewPathNodeFs(fs, nil)
state, _, err := MountNodeFileSystem(dir, nfs, nil)
CheckSuccess(err) CheckSuccess(err)
state.Debug = VerboseTest() state.Debug = VerboseTest()
......
...@@ -13,8 +13,3 @@ func MountNodeFileSystem(mountpoint string, nodeFs NodeFileSystem, opts *FileSys ...@@ -13,8 +13,3 @@ func MountNodeFileSystem(mountpoint string, nodeFs NodeFileSystem, opts *FileSys
} }
return mountState, conn, nil return mountState, conn, nil
} }
func MountPathFileSystem(mountpoint string, pathFs FileSystem, opts *FileSystemOptions) (*MountState, *FileSystemConnector, error) {
nfs := NewPathNodeFs(pathFs, nil)
return MountNodeFileSystem(mountpoint, nfs, opts)
}
...@@ -757,7 +757,8 @@ func TestOriginalIsSymlink(t *testing.T) { ...@@ -757,7 +757,8 @@ func TestOriginalIsSymlink(t *testing.T) {
CheckSuccess(err) CheckSuccess(err)
fs := NewLoopbackFileSystem(link) fs := NewLoopbackFileSystem(link)
state, _, err := MountPathFileSystem(mnt, fs, nil) nfs := NewPathNodeFs(fs, nil)
state, _, err := MountNodeFileSystem(mnt, nfs, nil)
CheckSuccess(err) CheckSuccess(err)
defer state.Unmount() defer state.Unmount()
......
...@@ -29,7 +29,8 @@ func setupOwnerTest(opts *FileSystemOptions) (workdir string, cleanup func()) { ...@@ -29,7 +29,8 @@ func setupOwnerTest(opts *FileSystemOptions) (workdir string, cleanup func()) {
wd, err := ioutil.TempDir("", "go-fuse") wd, err := ioutil.TempDir("", "go-fuse")
fs := &ownerFs{} fs := &ownerFs{}
state, _, err := MountPathFileSystem(wd, fs, opts) nfs := NewPathNodeFs(fs, nil)
state, _, err := MountNodeFileSystem(wd, nfs, opts)
CheckSuccess(err) CheckSuccess(err)
go state.Loop() go state.Loop()
return wd, func() { return wd, func() {
......
...@@ -41,11 +41,6 @@ type PathNodeFs struct { ...@@ -41,11 +41,6 @@ type PathNodeFs struct {
options *PathNodeFsOptions options *PathNodeFsOptions
} }
type PathNodeFsOptions struct {
// If ClientInodes is set, use Inode returned from GetAttr to
// find hard-linked files.
ClientInodes bool
}
func (me *PathNodeFs) Mount(path string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status { func (me *PathNodeFs) Mount(path string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status {
dir, name := filepath.Split(path) dir, name := filepath.Split(path)
......
...@@ -98,7 +98,8 @@ func TestXAttrRead(t *testing.T) { ...@@ -98,7 +98,8 @@ func TestXAttrRead(t *testing.T) {
CheckSuccess(err) CheckSuccess(err)
defer os.RemoveAll(mountPoint) defer os.RemoveAll(mountPoint)
state, _, err := MountPathFileSystem(mountPoint, xfs, nil) nfs := NewPathNodeFs(xfs, nil)
state, _, err := MountNodeFileSystem(mountPoint, nfs, nil)
CheckSuccess(err) CheckSuccess(err)
state.Debug = VerboseTest() state.Debug = VerboseTest()
defer state.Unmount() defer state.Unmount()
......
...@@ -42,7 +42,9 @@ func setup(t *testing.T) (workdir string, cleanup func()) { ...@@ -42,7 +42,9 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile(wd+"/ro/file2", "file2") WriteFile(wd+"/ro/file2", "file2")
fs := NewAutoUnionFs(wd+"/store", testAOpts) fs := NewAutoUnionFs(wd+"/store", testAOpts)
state, conn, err := fuse.MountPathFileSystem(wd+"/mnt", fs, &testAOpts.FileSystemOptions)
nfs := fuse.NewPathNodeFs(fs, nil)
state, conn, err := fuse.MountNodeFileSystem(wd+"/mnt", nfs, &testAOpts.FileSystemOptions)
CheckSuccess(err) CheckSuccess(err)
state.Debug = fuse.VerboseTest() state.Debug = fuse.VerboseTest()
conn.Debug = fuse.VerboseTest() conn.Debug = fuse.VerboseTest()
......
...@@ -876,7 +876,8 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -876,7 +876,8 @@ func TestUnionFsDisappearing(t *testing.T) {
NegativeTimeout: entryTtl, NegativeTimeout: entryTtl,
} }
state, _, err := fuse.MountPathFileSystem(wd+"/mnt", ufs, opts) nfs := fuse.NewPathNodeFs(ufs, nil)
state, _, err := fuse.MountNodeFileSystem(wd+"/mnt", nfs, opts)
CheckSuccess(err) CheckSuccess(err)
defer state.Unmount() defer state.Unmount()
state.Debug = fuse.VerboseTest() state.Debug = fuse.VerboseTest()
......
...@@ -16,7 +16,8 @@ const testTtl = 0.1 ...@@ -16,7 +16,8 @@ const testTtl = 0.1
func setupMzfs() (mountPoint string, cleanup func()) { func setupMzfs() (mountPoint string, cleanup func()) {
fs := NewMultiZipFs() fs := NewMultiZipFs()
mountPoint, _ = ioutil.TempDir("", "") mountPoint, _ = ioutil.TempDir("", "")
state, _, err := fuse.MountPathFileSystem(mountPoint, fs, &fuse.FileSystemOptions{ nfs := fuse.NewPathNodeFs(fs)
state, _, err := fuse.MountNodeFileSystem(mountPoint, nfs, &fuse.FileSystemOptions{
EntryTimeout: testTtl, EntryTimeout: testTtl,
AttrTimeout: testTtl, AttrTimeout: testTtl,
NegativeTimeout: 0.0, NegativeTimeout: 0.0,
......
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