Commit 86b0092e authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use filepath throughout.

parent d2454936
...@@ -14,7 +14,7 @@ import ( ...@@ -14,7 +14,7 @@ import (
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
"log" "log"
"os" "os"
"path" "path/filepath"
"sync" "sync"
"strings" "strings"
) )
...@@ -51,7 +51,7 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f ...@@ -51,7 +51,7 @@ func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, f
return 0, fuse.ENOSYS return 0, fuse.ENOSYS
} }
code := me.zfs.Connector.Mount("/"+path.Base(me.Basename), fs) code := me.zfs.Connector.Mount("/"+filepath.Base(me.Basename), fs)
if code != fuse.OK { if code != fuse.OK {
return 0, code return 0, code
...@@ -142,7 +142,7 @@ func (me *MultiZipFs) GetAttr(name string) (*fuse.Attr, fuse.Status) { ...@@ -142,7 +142,7 @@ func (me *MultiZipFs) GetAttr(name string) (*fuse.Attr, fuse.Status) {
return a, fuse.OK return a, fuse.OK
} }
dir, base := path.Split(name) dir, base := filepath.Split(name)
if dir != "" && dir != CONFIG_PREFIX { if dir != "" && dir != CONFIG_PREFIX {
return nil, fuse.ENOENT return nil, fuse.ENOENT
} }
...@@ -169,7 +169,7 @@ func (me *MultiZipFs) GetAttr(name string) (*fuse.Attr, fuse.Status) { ...@@ -169,7 +169,7 @@ func (me *MultiZipFs) GetAttr(name string) (*fuse.Attr, fuse.Status) {
} }
func (me *MultiZipFs) Unlink(name string) (code fuse.Status) { func (me *MultiZipFs) Unlink(name string) (code fuse.Status) {
dir, basename := path.Split(name) dir, basename := filepath.Split(name)
if dir == CONFIG_PREFIX { if dir == CONFIG_PREFIX {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
...@@ -190,7 +190,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, co ...@@ -190,7 +190,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, co
return nil, fuse.EPERM return nil, fuse.EPERM
} }
dir, basename := path.Split(name) dir, basename := filepath.Split(name)
if dir == CONFIG_PREFIX { if dir == CONFIG_PREFIX {
me.lock.RLock() me.lock.RLock()
defer me.lock.RUnlock() defer me.lock.RUnlock()
...@@ -207,7 +207,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, co ...@@ -207,7 +207,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, co
} }
func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.RawFuseFile, code fuse.Status) { func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.RawFuseFile, code fuse.Status) {
dir, base := path.Split(name) dir, base := filepath.Split(name)
if dir != CONFIG_PREFIX { if dir != CONFIG_PREFIX {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"path" "path/filepath"
"strings" "strings"
"testing" "testing"
) )
...@@ -33,9 +33,9 @@ func (me *stackFsTestCase) Setup(t *testing.T) { ...@@ -33,9 +33,9 @@ func (me *stackFsTestCase) Setup(t *testing.T) {
me.tester = t me.tester = t
me.testDir = fuse.MakeTempDir() me.testDir = fuse.MakeTempDir()
me.origDir1 = path.Join(me.testDir, "orig1") me.origDir1 = filepath.Join(me.testDir, "orig1")
me.origDir2 = path.Join(me.testDir, "orig2") me.origDir2 = filepath.Join(me.testDir, "orig2")
me.mountDir = path.Join(me.testDir, "mount") me.mountDir = filepath.Join(me.testDir, "mount")
os.Mkdir(me.origDir1, 0700) os.Mkdir(me.origDir1, 0700)
os.Mkdir(me.origDir2, 0700) os.Mkdir(me.origDir2, 0700)
...@@ -107,12 +107,12 @@ func (me *stackFsTestCase) testReaddir() { ...@@ -107,12 +107,12 @@ func (me *stackFsTestCase) testReaddir() {
func (me *stackFsTestCase) testSubFs() { func (me *stackFsTestCase) testSubFs() {
fmt.Println("testSubFs... ") fmt.Println("testSubFs... ")
for i := 1; i <= 2; i++ { for i := 1; i <= 2; i++ {
// orig := path.Join(me.testDir, fmt.Sprintf("orig%d", i)) // orig := filepath.Join(me.testDir, fmt.Sprintf("orig%d", i))
mount := path.Join(me.mountDir, fmt.Sprintf("sub%d", i)) mount := filepath.Join(me.mountDir, fmt.Sprintf("sub%d", i))
name := "testFile" name := "testFile"
mountFile := path.Join(mount, name) mountFile := filepath.Join(mount, name)
f, err := os.Open(mountFile, os.O_WRONLY, 0) f, err := os.Open(mountFile, os.O_WRONLY, 0)
if err == nil { if err == nil {
...@@ -130,7 +130,7 @@ func (me *stackFsTestCase) testSubFs() { ...@@ -130,7 +130,7 @@ func (me *stackFsTestCase) testSubFs() {
CheckSuccess(err) CheckSuccess(err)
fi, err := os.Lstat(mountFile) fi, err := os.Lstat(mountFile)
CheckSuccess(err) CheckSuccess(err)
if fi.Mode&0777 != magicMode { if fi.Mode&0777 != magicMode {
me.tester.Errorf("Mode %o", fi.Mode) me.tester.Errorf("Mode %o", fi.Mode)
} }
...@@ -166,7 +166,7 @@ func (me *stackFsTestCase) testAddRemove() { ...@@ -166,7 +166,7 @@ func (me *stackFsTestCase) testAddRemove() {
} }
conn.Init(new(fuse.InHeader), new(fuse.InitIn)) conn.Init(new(fuse.InHeader), new(fuse.InitIn))
fi, err := os.Lstat(path.Join(me.mountDir, "third")) fi, err := os.Lstat(filepath.Join(me.mountDir, "third"))
CheckSuccess(err) CheckSuccess(err)
if !fi.IsDirectory() { if !fi.IsDirectory() {
...@@ -186,7 +186,7 @@ func (me *stackFsTestCase) testAddRemove() { ...@@ -186,7 +186,7 @@ func (me *stackFsTestCase) testAddRemove() {
} }
dir.Close() dir.Close()
_, err = os.Open(path.Join(me.mountDir, "third"), os.O_RDONLY, 0) _, err = os.Open(filepath.Join(me.mountDir, "third"), os.O_RDONLY, 0)
if err == nil { if err == nil {
me.tester.Errorf("expect enoent %v", err) me.tester.Errorf("expect enoent %v", err)
} }
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"os" "os"
"strings" "strings"
"path" "path/filepath"
"log" "log"
) )
...@@ -44,7 +44,7 @@ func (me *ZipDirTree) Lookup(name string) (*ZipDirTree, *zip.File) { ...@@ -44,7 +44,7 @@ func (me *ZipDirTree) Lookup(name string) (*ZipDirTree, *zip.File) {
return me, nil return me, nil
} }
parent := me parent := me
comps := strings.Split(path.Clean(name), "/", -1) comps := strings.Split(filepath.Clean(name), "/", -1)
for _, c := range comps[:len(comps)-1] { for _, c := range comps[:len(comps)-1] {
parent = parent.subdirs[c] parent = parent.subdirs[c]
if parent == nil { if parent == nil {
...@@ -82,7 +82,7 @@ func zipFilesToTree(files []*zip.File) *ZipDirTree { ...@@ -82,7 +82,7 @@ func zipFilesToTree(files []*zip.File) *ZipDirTree {
t := NewZipDirTree() t := NewZipDirTree()
for _, f := range files { for _, f := range files {
parent := t parent := t
comps := strings.Split(path.Clean(f.Name), "/", -1) comps := strings.Split(filepath.Clean(f.Name), "/", -1)
base := "" base := ""
// Ugh - zip files have directories separate. // Ugh - zip files have directories separate.
......
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
const ( const (
// bufSize should be a power of two to minimize lossage in // bufSize should be a power of two to minimize lossage in
// BufferPool. // BufferPool.
bufSize = (1 << 16) bufSize = (1 << 18)
maxRead = bufSize - PAGESIZE maxRead = bufSize - PAGESIZE
) )
......
...@@ -7,7 +7,7 @@ package fuse ...@@ -7,7 +7,7 @@ package fuse
import ( import (
"fmt" "fmt"
"os" "os"
"path" "path/filepath"
"syscall" "syscall"
) )
...@@ -27,7 +27,7 @@ func NewLoopbackFileSystem(root string) (out *LoopbackFileSystem) { ...@@ -27,7 +27,7 @@ func NewLoopbackFileSystem(root string) (out *LoopbackFileSystem) {
} }
func (me *LoopbackFileSystem) GetPath(relPath string) string { func (me *LoopbackFileSystem) GetPath(relPath string) string {
return path.Join(me.root, relPath) return filepath.Join(me.root, relPath)
} }
func (me *LoopbackFileSystem) GetAttr(name string) (*Attr, Status) { func (me *LoopbackFileSystem) GetAttr(name string) (*Attr, Status) {
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"path" "path/filepath"
"strings" "strings"
"testing" "testing"
"syscall" "syscall"
...@@ -46,12 +46,12 @@ func (me *testCase) Setup(t *testing.T) { ...@@ -46,12 +46,12 @@ func (me *testCase) Setup(t *testing.T) {
me.origDir = MakeTempDir() me.origDir = MakeTempDir()
me.mountPoint = MakeTempDir() me.mountPoint = MakeTempDir()
me.mountFile = path.Join(me.mountPoint, name) me.mountFile = filepath.Join(me.mountPoint, name)
me.mountSubdir = path.Join(me.mountPoint, subdir) me.mountSubdir = filepath.Join(me.mountPoint, subdir)
me.mountSubfile = path.Join(me.mountSubdir, "subfile") me.mountSubfile = filepath.Join(me.mountSubdir, "subfile")
me.origFile = path.Join(me.origDir, name) me.origFile = filepath.Join(me.origDir, name)
me.origSubdir = path.Join(me.origDir, subdir) me.origSubdir = filepath.Join(me.origDir, subdir)
me.origSubfile = path.Join(me.origSubdir, "subfile") me.origSubfile = filepath.Join(me.origSubdir, "subfile")
pfs := NewLoopbackFileSystem(me.origDir) pfs := NewLoopbackFileSystem(me.origDir)
me.connector = NewPathFileSystemConnector(pfs) me.connector = NewPathFileSystemConnector(pfs)
...@@ -108,7 +108,7 @@ func (me *testCase) writeOrigFile() { ...@@ -108,7 +108,7 @@ func (me *testCase) writeOrigFile() {
// Tests. // Tests.
func (me *testCase) testOpenUnreadable() { func (me *testCase) testOpenUnreadable() {
_, err := os.Open(path.Join(me.mountPoint, "doesnotexist"), os.O_RDONLY, 0) _, err := os.Open(filepath.Join(me.mountPoint, "doesnotexist"), os.O_RDONLY, 0)
if err == nil { if err == nil {
me.tester.Errorf("open non-existent should raise error") me.tester.Errorf("open non-existent should raise error")
} }
...@@ -241,13 +241,13 @@ func (me *testCase) testSymlink() { ...@@ -241,13 +241,13 @@ func (me *testCase) testSymlink() {
linkFile := "symlink-file" linkFile := "symlink-file"
orig := "hello.txt" orig := "hello.txt"
err := os.Symlink(orig, path.Join(me.mountPoint, linkFile)) err := os.Symlink(orig, filepath.Join(me.mountPoint, linkFile))
defer os.Remove(path.Join(me.mountPoint, linkFile)) defer os.Remove(filepath.Join(me.mountPoint, linkFile))
defer me.removeMountFile() defer me.removeMountFile()
CheckSuccess(err) CheckSuccess(err)
origLink := path.Join(me.origDir, linkFile) origLink := filepath.Join(me.origDir, linkFile)
fi, err := os.Lstat(origLink) fi, err := os.Lstat(origLink)
CheckSuccess(err) CheckSuccess(err)
...@@ -256,7 +256,7 @@ func (me *testCase) testSymlink() { ...@@ -256,7 +256,7 @@ func (me *testCase) testSymlink() {
return return
} }
read, err := os.Readlink(path.Join(me.mountPoint, linkFile)) read, err := os.Readlink(filepath.Join(me.mountPoint, linkFile))
CheckSuccess(err) CheckSuccess(err)
if read != orig { if read != orig {
...@@ -368,7 +368,7 @@ func (me *testCase) testFSync() { ...@@ -368,7 +368,7 @@ func (me *testCase) testFSync() {
func (me *testCase) testLargeRead() { func (me *testCase) testLargeRead() {
me.tester.Log("Testing large read.") me.tester.Log("Testing large read.")
name := path.Join(me.origDir, "large") name := filepath.Join(me.origDir, "large")
f, err := os.Open(name, os.O_WRONLY|os.O_CREATE, 0777) f, err := os.Open(name, os.O_WRONLY|os.O_CREATE, 0777)
CheckSuccess(err) CheckSuccess(err)
...@@ -387,7 +387,7 @@ func (me *testCase) testLargeRead() { ...@@ -387,7 +387,7 @@ func (me *testCase) testLargeRead() {
CheckSuccess(err) CheckSuccess(err)
// Read in one go. // Read in one go.
g, err := os.Open(path.Join(me.mountPoint, "large"), os.O_RDONLY, 0) g, err := os.Open(filepath.Join(me.mountPoint, "large"), os.O_RDONLY, 0)
CheckSuccess(err) CheckSuccess(err)
readSlice := make([]byte, len(slice)) readSlice := make([]byte, len(slice))
m, err := g.Read(readSlice) m, err := g.Read(readSlice)
...@@ -405,7 +405,7 @@ func (me *testCase) testLargeRead() { ...@@ -405,7 +405,7 @@ func (me *testCase) testLargeRead() {
g.Close() g.Close()
// Read in chunks // Read in chunks
g, err = os.Open(path.Join(me.mountPoint, "large"), os.O_RDONLY, 0) g, err = os.Open(filepath.Join(me.mountPoint, "large"), os.O_RDONLY, 0)
CheckSuccess(err) CheckSuccess(err)
readSlice = make([]byte, 4096) readSlice = make([]byte, 4096)
total := 0 total := 0
...@@ -444,7 +444,7 @@ func (me *testCase) testLargeDirRead() { ...@@ -444,7 +444,7 @@ func (me *testCase) testLargeDirRead() {
names := make([]string, created) names := make([]string, created)
subdir := path.Join(me.origDir, "readdirSubdir") subdir := filepath.Join(me.origDir, "readdirSubdir")
os.Mkdir(subdir, 0700) os.Mkdir(subdir, 0700)
longname := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" longname := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
...@@ -453,7 +453,7 @@ func (me *testCase) testLargeDirRead() { ...@@ -453,7 +453,7 @@ func (me *testCase) testLargeDirRead() {
// Should vary file name length. // Should vary file name length.
base := fmt.Sprintf("file%d%s", i, base := fmt.Sprintf("file%d%s", i,
randomLengthString(len(longname))) randomLengthString(len(longname)))
name := path.Join(subdir, base) name := filepath.Join(subdir, base)
nameSet[base] = true nameSet[base] = true
...@@ -465,7 +465,7 @@ func (me *testCase) testLargeDirRead() { ...@@ -465,7 +465,7 @@ func (me *testCase) testLargeDirRead() {
names[i] = name names[i] = name
} }
dir, err := os.Open(path.Join(me.mountPoint, "readdirSubdir"), os.O_RDONLY, 0) dir, err := os.Open(filepath.Join(me.mountPoint, "readdirSubdir"), os.O_RDONLY, 0)
CheckSuccess(err) CheckSuccess(err)
// Chunked read. // Chunked read.
total := 0 total := 0
...@@ -524,7 +524,7 @@ func TestRecursiveMount(t *testing.T) { ...@@ -524,7 +524,7 @@ func TestRecursiveMount(t *testing.T) {
ts := new(testCase) ts := new(testCase)
ts.Setup(t) ts.Setup(t)
f, err := os.Open(path.Join(ts.mountPoint, "hello.txt"), f, err := os.Open(filepath.Join(ts.mountPoint, "hello.txt"),
os.O_WRONLY|os.O_CREATE, 0777) os.O_WRONLY|os.O_CREATE, 0777)
CheckSuccess(err) CheckSuccess(err)
...@@ -537,7 +537,7 @@ func TestRecursiveMount(t *testing.T) { ...@@ -537,7 +537,7 @@ func TestRecursiveMount(t *testing.T) {
t.Error("expect EINVAL", code) t.Error("expect EINVAL", code)
} }
submnt := path.Join(ts.mountPoint, "mnt") submnt := filepath.Join(ts.mountPoint, "mnt")
err = os.Mkdir(submnt, 0777) err = os.Mkdir(submnt, 0777)
CheckSuccess(err) CheckSuccess(err)
code = ts.connector.Mount("/mnt", pfs2) code = ts.connector.Mount("/mnt", pfs2)
...@@ -547,10 +547,10 @@ func TestRecursiveMount(t *testing.T) { ...@@ -547,10 +547,10 @@ func TestRecursiveMount(t *testing.T) {
_, err = os.Lstat(submnt) _, err = os.Lstat(submnt)
CheckSuccess(err) CheckSuccess(err)
_, err = os.Lstat(path.Join(submnt, "hello.txt")) _, err = os.Lstat(filepath.Join(submnt, "hello.txt"))
CheckSuccess(err) CheckSuccess(err)
f, err = os.Open(path.Join(submnt, "hello.txt"), os.O_RDONLY, 0) f, err = os.Open(filepath.Join(submnt, "hello.txt"), os.O_RDONLY, 0)
CheckSuccess(err) CheckSuccess(err)
code = ts.connector.Unmount("/mnt") code = ts.connector.Unmount("/mnt")
if code != EBUSY { if code != EBUSY {
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"os" "os"
"time" "time"
"fmt" "fmt"
"path" "path/filepath"
"math" "math"
"regexp" "regexp"
"syscall" "syscall"
...@@ -24,7 +24,7 @@ func MakeTempDir() string { ...@@ -24,7 +24,7 @@ func MakeTempDir() string {
number := source.Int63() & 0xffff number := source.Int63() & 0xffff
name := fmt.Sprintf("tmp%d", number) name := fmt.Sprintf("tmp%d", number)
fullName := path.Join(os.TempDir(), name) fullName := filepath.Join(os.TempDir(), name)
err := os.Mkdir(fullName, 0700) err := os.Mkdir(fullName, 0700)
if err != nil { if err != nil {
panic("Mkdir() should always succeed: " + fullName) panic("Mkdir() should always succeed: " + fullName)
...@@ -49,7 +49,7 @@ func OsErrorToFuseError(err os.Error) Status { ...@@ -49,7 +49,7 @@ func OsErrorToFuseError(err os.Error) Status {
if ok { if ok {
return OsErrorToFuseError(asPathErr.Error) return OsErrorToFuseError(asPathErr.Error)
} }
// Should not happen. Should we log an error somewhere? // Should not happen. Should we log an error somewhere?
return ENOSYS return ENOSYS
} }
...@@ -270,7 +270,6 @@ func Writev(fd int, packet [][]byte) (n int, err os.Error) { ...@@ -270,7 +270,6 @@ func Writev(fd int, packet [][]byte) (n int, err os.Error) {
if errno != 0 { if errno != 0 {
err = os.NewSyscallError("writev", errno) err = os.NewSyscallError("writev", errno)
return
} }
return return
} }
......
...@@ -4,7 +4,7 @@ package fuse ...@@ -4,7 +4,7 @@ package fuse
import ( import (
"fmt" "fmt"
"os" "os"
"path" "path/filepath"
"syscall" "syscall"
"unsafe" "unsafe"
) )
...@@ -42,13 +42,13 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error) ...@@ -42,13 +42,13 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error)
defer local.Close() defer local.Close()
defer remote.Close() defer remote.Close()
mountPoint = path.Clean(mountPoint) mountPoint = filepath.Clean(mountPoint)
if !path.IsAbs(mountPoint) { if !filepath.IsAbs(mountPoint) {
cwd, err := os.Getwd() cwd, err := os.Getwd()
if err != nil { if err != nil {
return return
} }
mountPoint = path.Clean(path.Join(cwd, mountPoint)) mountPoint = filepath.Clean(filepath.Join(cwd, mountPoint))
} }
proc, err := os.StartProcess("/bin/fusermount", proc, err := os.StartProcess("/bin/fusermount",
[]string{"/bin/fusermount", mountPoint}, []string{"/bin/fusermount", mountPoint},
...@@ -73,7 +73,7 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error) ...@@ -73,7 +73,7 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error)
} }
func unmount(mountPoint string) (err os.Error) { func unmount(mountPoint string) (err os.Error) {
dir, _ := path.Split(mountPoint) dir, _ := filepath.Split(mountPoint)
proc, err := os.StartProcess("/bin/fusermount", proc, err := os.StartProcess("/bin/fusermount",
[]string{"/bin/fusermount", "-u", mountPoint}, []string{"/bin/fusermount", "-u", mountPoint},
nil, nil,
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"log" "log"
"path" "path/filepath"
"strings" "strings"
"sync" "sync"
) )
...@@ -15,7 +15,7 @@ type mountData struct { ...@@ -15,7 +15,7 @@ type mountData struct {
// Protects the variables below. // Protects the variables below.
mutex sync.RWMutex mutex sync.RWMutex
// If yes, we are looking to unmount the mounted fs. // If yes, we are looking to unmount the mounted fs.
unmountPending bool unmountPending bool
...@@ -277,7 +277,7 @@ func (me *PathFileSystemConnector) unlinkUpdate(nodeid uint64, name string) { ...@@ -277,7 +277,7 @@ func (me *PathFileSystemConnector) unlinkUpdate(nodeid uint64, name string) {
// Walk the file system starting from the root. // Walk the file system starting from the root.
func (me *PathFileSystemConnector) findInode(fullPath string) *inodeData { func (me *PathFileSystemConnector) findInode(fullPath string) *inodeData {
fullPath = strings.TrimLeft(path.Clean(fullPath), "/") fullPath = strings.TrimLeft(filepath.Clean(fullPath), "/")
comps := strings.Split(fullPath, "/", -1) comps := strings.Split(fullPath, "/", -1)
me.lock.RLock() me.lock.RLock()
...@@ -334,7 +334,7 @@ func (me *PathFileSystemConnector) Mount(mountPoint string, fs PathFilesystem) S ...@@ -334,7 +334,7 @@ func (me *PathFileSystemConnector) Mount(mountPoint string, fs PathFilesystem) S
var node *inodeData var node *inodeData
if mountPoint != "/" { if mountPoint != "/" {
dirParent, base := path.Split(mountPoint) dirParent, base := filepath.Split(mountPoint)
dirParentNode := me.findInode(dirParent) dirParentNode := me.findInode(dirParent)
// Make sure we know the mount point. // Make sure we know the mount point.
...@@ -393,7 +393,7 @@ func (me *PathFileSystemConnector) Unmount(path string) Status { ...@@ -393,7 +393,7 @@ func (me *PathFileSystemConnector) Unmount(path string) Status {
if me.Debug { if me.Debug {
log.Println("Unmount: ", mount) log.Println("Unmount: ", mount)
} }
if node.RefCount > 0 { if node.RefCount > 0 {
mount.fs.Unmount() mount.fs.Unmount()
mount.unmountPending = true mount.unmountPending = true
...@@ -435,7 +435,7 @@ func (me *PathFileSystemConnector) internalLookup(nodeid uint64, name string, lo ...@@ -435,7 +435,7 @@ func (me *PathFileSystemConnector) internalLookup(nodeid uint64, name string, lo
if mount == nil { if mount == nil {
return NegativeEntry(me.options.NegativeTimeout), OK return NegativeEntry(me.options.NegativeTimeout), OK
} }
fullPath = path.Join(fullPath, name) fullPath = filepath.Join(fullPath, name)
attr, err := mount.fs.GetAttr(fullPath) attr, err := mount.fs.GetAttr(fullPath)
...@@ -570,7 +570,7 @@ func (me *PathFileSystemConnector) Mknod(header *InHeader, input *MknodIn, name ...@@ -570,7 +570,7 @@ func (me *PathFileSystemConnector) Mknod(header *InHeader, input *MknodIn, name
if mount == nil { if mount == nil {
return nil, ENOENT return nil, ENOENT
} }
fullPath = path.Join(fullPath, name) fullPath = filepath.Join(fullPath, name)
err := mount.fs.Mknod(fullPath, input.Mode, uint32(input.Rdev)) err := mount.fs.Mknod(fullPath, input.Mode, uint32(input.Rdev))
if err != OK { if err != OK {
return nil, err return nil, err
...@@ -583,7 +583,7 @@ func (me *PathFileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, name ...@@ -583,7 +583,7 @@ func (me *PathFileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, name
if mount == nil { if mount == nil {
return nil, ENOENT return nil, ENOENT
} }
err := mount.fs.Mkdir(path.Join(fullPath, name), input.Mode) err := mount.fs.Mkdir(filepath.Join(fullPath, name), input.Mode)
if err != OK { if err != OK {
return nil, err return nil, err
} }
...@@ -596,7 +596,7 @@ func (me *PathFileSystemConnector) Unlink(header *InHeader, name string) (code S ...@@ -596,7 +596,7 @@ func (me *PathFileSystemConnector) Unlink(header *InHeader, name string) (code S
if mount == nil { if mount == nil {
return ENOENT return ENOENT
} }
code = mount.fs.Unlink(path.Join(fullPath, name)) code = mount.fs.Unlink(filepath.Join(fullPath, name))
// Like fuse.c, we update our internal tables. // Like fuse.c, we update our internal tables.
me.unlinkUpdate(header.NodeId, name) me.unlinkUpdate(header.NodeId, name)
...@@ -609,7 +609,7 @@ func (me *PathFileSystemConnector) Rmdir(header *InHeader, name string) (code St ...@@ -609,7 +609,7 @@ func (me *PathFileSystemConnector) Rmdir(header *InHeader, name string) (code St
if mount == nil { if mount == nil {
return ENOENT return ENOENT
} }
code = mount.fs.Rmdir(path.Join(fullPath, name)) code = mount.fs.Rmdir(filepath.Join(fullPath, name))
me.unlinkUpdate(header.NodeId, name) me.unlinkUpdate(header.NodeId, name)
return code return code
} }
...@@ -619,7 +619,7 @@ func (me *PathFileSystemConnector) Symlink(header *InHeader, pointedTo string, l ...@@ -619,7 +619,7 @@ func (me *PathFileSystemConnector) Symlink(header *InHeader, pointedTo string, l
if mount == nil { if mount == nil {
return nil, ENOENT return nil, ENOENT
} }
err := mount.fs.Symlink(pointedTo, path.Join(fullPath, linkName)) err := mount.fs.Symlink(pointedTo, filepath.Join(fullPath, linkName))
if err != OK { if err != OK {
return nil, err return nil, err
} }
...@@ -638,8 +638,8 @@ func (me *PathFileSystemConnector) Rename(header *InHeader, input *RenameIn, old ...@@ -638,8 +638,8 @@ func (me *PathFileSystemConnector) Rename(header *InHeader, input *RenameIn, old
return EXDEV return EXDEV
} }
oldPath = path.Join(oldPath, oldName) oldPath = filepath.Join(oldPath, oldName)
newPath = path.Join(newPath, newName) newPath = filepath.Join(newPath, newName)
code = mount.fs.Rename(oldPath, newPath) code = mount.fs.Rename(oldPath, newPath)
if code != OK { if code != OK {
return return
...@@ -666,7 +666,7 @@ func (me *PathFileSystemConnector) Link(header *InHeader, input *LinkIn, filenam ...@@ -666,7 +666,7 @@ func (me *PathFileSystemConnector) Link(header *InHeader, input *LinkIn, filenam
if mount != newMount { if mount != newMount {
return nil, EXDEV return nil, EXDEV
} }
newName = path.Join(newName, filename) newName = filepath.Join(newName, filename)
err := mount.fs.Link(orig, newName) err := mount.fs.Link(orig, newName)
if err != OK { if err != OK {
...@@ -689,7 +689,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam ...@@ -689,7 +689,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam
if mount == nil { if mount == nil {
return 0, nil, nil, ENOENT return 0, nil, nil, ENOENT
} }
fullPath := path.Join(directory, name) fullPath := filepath.Join(directory, name)
f, err := mount.fs.Create(fullPath, uint32(input.Flags), input.Mode) f, err := mount.fs.Create(fullPath, uint32(input.Flags), input.Mode)
if err != OK { if err != OK {
......
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