Commit ddde0e88 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt.

parent eb2b2511
...@@ -39,7 +39,7 @@ func main() { ...@@ -39,7 +39,7 @@ func main() {
state.Loop(*threaded) state.Loop(*threaded)
fmt.Println("Finished", state.Stats()) fmt.Println("Finished", state.Stats())
for v := range(expvar.Iter()) { for v := range expvar.Iter() {
if strings.HasPrefix(v.Key, "mount") { if strings.HasPrefix(v.Key, "mount") {
fmt.Printf("%v: %v\n", v.Key, v.Value) fmt.Printf("%v: %v\n", v.Key, v.Value)
} }
......
...@@ -201,7 +201,7 @@ func (self *DummyPathFuse) OpenDir(name string) (stream chan fuse.DirEntry, stat ...@@ -201,7 +201,7 @@ func (self *DummyPathFuse) OpenDir(name string) (stream chan fuse.DirEntry, stat
return nil, fuse.ENOSYS return nil, fuse.ENOSYS
} }
func (self *DummyPathFuse) Mount(conn *fuse.PathFileSystemConnector) (fuse.Status) { func (self *DummyPathFuse) Mount(conn *fuse.PathFileSystemConnector) fuse.Status {
return fuse.OK return fuse.OK
} }
...@@ -219,4 +219,3 @@ func (self *DummyPathFuse) Create(name string, flags uint32, mode uint32) (file ...@@ -219,4 +219,3 @@ func (self *DummyPathFuse) Create(name string, flags uint32, mode uint32) (file
func (self *DummyPathFuse) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code fuse.Status) { func (self *DummyPathFuse) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code fuse.Status) {
return fuse.ENOSYS return fuse.ENOSYS
} }
...@@ -25,7 +25,7 @@ func NewPassThroughFuse(root string) (out *PassThroughFuse) { ...@@ -25,7 +25,7 @@ func NewPassThroughFuse(root string) (out *PassThroughFuse) {
return out return out
} }
func (self *PassThroughFuse) Mount(conn *fuse.PathFileSystemConnector) (fuse.Status) { func (self *PassThroughFuse) Mount(conn *fuse.PathFileSystemConnector) fuse.Status {
return fuse.OK return fuse.OK
} }
...@@ -77,8 +77,8 @@ func (self *PassThroughFuse) OpenDir(name string) (stream chan fuse.DirEntry, st ...@@ -77,8 +77,8 @@ func (self *PassThroughFuse) OpenDir(name string) (stream chan fuse.DirEntry, st
} }
close(output) close(output)
f.Close() f.Close()
}() }()
return output, fuse.OK return output, fuse.OK
} }
......
...@@ -53,7 +53,7 @@ func (self *testCase) Setup(t *testing.T) { ...@@ -53,7 +53,7 @@ func (self *testCase) Setup(t *testing.T) {
self.origFile = path.Join(self.origDir, name) self.origFile = path.Join(self.origDir, name)
self.origSubdir = path.Join(self.origDir, subdir) self.origSubdir = path.Join(self.origDir, subdir)
self.origSubfile = path.Join(self.origSubdir, "subfile") self.origSubfile = path.Join(self.origSubdir, "subfile")
pfs := NewPassThroughFuse(self.origDir) pfs := NewPassThroughFuse(self.origDir)
self.connector = fuse.NewPathFileSystemConnector(pfs) self.connector = fuse.NewPathFileSystemConnector(pfs)
self.connector.Debug = true self.connector.Debug = true
...@@ -603,13 +603,13 @@ func TestRecursiveMount(t *testing.T) { ...@@ -603,13 +603,13 @@ func TestRecursiveMount(t *testing.T) {
f, err := os.Open(path.Join(ts.mountPoint, "hello.txt"), f, err := os.Open(path.Join(ts.mountPoint, "hello.txt"),
os.O_WRONLY|os.O_CREATE, 0777) os.O_WRONLY|os.O_CREATE, 0777)
if err != nil { if err != nil {
t.Errorf("open write err %v", err) t.Errorf("open write err %v", err)
} }
f.WriteString("bla") f.WriteString("bla")
f.Close() f.Close()
pfs2 := NewPassThroughFuse(ts.origDir) pfs2 := NewPassThroughFuse(ts.origDir)
code := ts.connector.Mount("/hello.txt", pfs2) code := ts.connector.Mount("/hello.txt", pfs2)
if code != fuse.EINVAL { if code != fuse.EINVAL {
...@@ -621,12 +621,12 @@ func TestRecursiveMount(t *testing.T) { ...@@ -621,12 +621,12 @@ func TestRecursiveMount(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("mkdir") t.Errorf("mkdir")
} }
code = ts.connector.Mount("/mnt", pfs2) code = ts.connector.Mount("/mnt", pfs2)
if code != fuse.OK { if code != fuse.OK {
t.Errorf("mkdir") t.Errorf("mkdir")
} }
_, err = os.Lstat(submnt) _, err = os.Lstat(submnt)
if err != nil { if err != nil {
t.Error("lstat submount", err) t.Error("lstat submount", err)
...@@ -635,7 +635,7 @@ func TestRecursiveMount(t *testing.T) { ...@@ -635,7 +635,7 @@ func TestRecursiveMount(t *testing.T) {
if err != nil { if err != nil {
t.Error("lstat submount/file", err) t.Error("lstat submount/file", err)
} }
f, err = os.Open(path.Join(submnt, "hello.txt"), os.O_RDONLY, 0) f, err = os.Open(path.Join(submnt, "hello.txt"), os.O_RDONLY, 0)
if err != nil { if err != nil {
t.Error("open submount/file", err) t.Error("open submount/file", err)
...@@ -649,7 +649,7 @@ func TestRecursiveMount(t *testing.T) { ...@@ -649,7 +649,7 @@ func TestRecursiveMount(t *testing.T) {
// The close takes some time to propagate through FUSE. // The close takes some time to propagate through FUSE.
time.Sleep(1e9) time.Sleep(1e9)
code = ts.connector.Unmount("/mnt") code = ts.connector.Unmount("/mnt")
if code != fuse.OK { if code != fuse.OK {
t.Error("umount failed.", code) t.Error("umount failed.", code)
......
...@@ -601,7 +601,6 @@ func (self *SubmountFileSystem) ReleaseDir(header *fuse.InHeader, f fuse.RawFuse ...@@ -601,7 +601,6 @@ func (self *SubmountFileSystem) ReleaseDir(header *fuse.InHeader, f fuse.RawFuse
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
type SubmountFileSystemTopDir struct { type SubmountFileSystemTopDir struct {
...@@ -638,4 +637,3 @@ func (self *SubmountFileSystemTopDir) ReleaseDir() { ...@@ -638,4 +637,3 @@ func (self *SubmountFileSystemTopDir) ReleaseDir() {
func (self *SubmountFileSystemTopDir) FsyncDir(input *fuse.FsyncIn) (code fuse.Status) { func (self *SubmountFileSystemTopDir) FsyncDir(input *fuse.FsyncIn) (code fuse.Status) {
return fuse.ENOENT return fuse.ENOENT
} }
...@@ -43,7 +43,7 @@ func (self *stackFsTestCase) Setup(t *testing.T) { ...@@ -43,7 +43,7 @@ func (self *stackFsTestCase) Setup(t *testing.T) {
fs1 := fuse.NewPathFileSystemConnector(NewPassThroughFuse(self.origDir1)) fs1 := fuse.NewPathFileSystemConnector(NewPassThroughFuse(self.origDir1))
fs2 := fuse.NewPathFileSystemConnector(NewPassThroughFuse(self.origDir2)) fs2 := fuse.NewPathFileSystemConnector(NewPassThroughFuse(self.origDir2))
self.fs = NewSubmountFileSystem() self.fs = NewSubmountFileSystem()
attr := fuse.Attr{ attr := fuse.Attr{
......
...@@ -25,7 +25,7 @@ func IntToExponent(z int) uint { ...@@ -25,7 +25,7 @@ func IntToExponent(z int) uint {
} }
if z > (1 << exp) { if z > (1 << exp) {
exp ++ exp++
} }
return exp return exp
} }
...@@ -38,7 +38,7 @@ func NewBufferPool() *BufferPool { ...@@ -38,7 +38,7 @@ func NewBufferPool() *BufferPool {
func (self *BufferPool) String() string { func (self *BufferPool) String() string {
s := "" s := ""
for exp, bufs := range(self.buffersByExponent) { for exp, bufs := range self.buffersByExponent {
s = s + fmt.Sprintf("%d = %d\n", exp, len(bufs)) s = s + fmt.Sprintf("%d = %d\n", exp, len(bufs))
} }
return s return s
...@@ -50,11 +50,11 @@ func (self *BufferPool) getBuffer(sz int) []byte { ...@@ -50,11 +50,11 @@ func (self *BufferPool) getBuffer(sz int) []byte {
self.lock.Lock() self.lock.Lock()
defer self.lock.Unlock() defer self.lock.Unlock()
if (len(self.buffersByExponent) <= int(exponent)) { if len(self.buffersByExponent) <= int(exponent) {
return nil return nil
} }
bufferList := self.buffersByExponent[exponent] bufferList := self.buffersByExponent[exponent]
if (len(bufferList) == 0) { if len(bufferList) == 0 {
return nil return nil
} }
...@@ -69,7 +69,7 @@ func (self *BufferPool) getBuffer(sz int) []byte { ...@@ -69,7 +69,7 @@ func (self *BufferPool) getBuffer(sz int) []byte {
} }
func (self *BufferPool) addBuffer(slice []byte) { func (self *BufferPool) addBuffer(slice []byte) {
if cap(slice) & (PAGESIZE -1) != 0 { if cap(slice)&(PAGESIZE-1) != 0 {
return return
} }
...@@ -106,4 +106,3 @@ func (self *BufferPool) GetBuffer(size uint32) []byte { ...@@ -106,4 +106,3 @@ func (self *BufferPool) GetBuffer(size uint32) []byte {
return make([]byte, size, rounded) return make([]byte, size, rounded)
} }
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"fmt" "fmt"
) )
func TestIntToExponent(t *testing.T) { func TestIntToExponent(t *testing.T) {
e := IntToExponent(1) e := IntToExponent(1)
if e != 0 { if e != 0 {
t.Error("1", e) t.Error("1", e)
...@@ -24,10 +24,10 @@ func TestIntToExponent(t *testing.T) { ...@@ -24,10 +24,10 @@ func TestIntToExponent(t *testing.T) {
} }
} }
func TestBufferPool(t *testing.T) { func TestBufferPool(t *testing.T) {
bp := NewBufferPool() bp := NewBufferPool()
b := bp.getBuffer(PAGESIZE-1) b := bp.getBuffer(PAGESIZE - 1)
if b != nil { if b != nil {
t.Error("bp 0") t.Error("bp 0")
} }
...@@ -36,10 +36,10 @@ func TestBufferPool(t *testing.T) { ...@@ -36,10 +36,10 @@ func TestBufferPool(t *testing.T) {
t.Error("bp 1") t.Error("bp 1")
} }
s := make([]byte, PAGESIZE - 1) s := make([]byte, PAGESIZE-1)
bp.addBuffer(s) bp.addBuffer(s)
b = bp.getBuffer(PAGESIZE -1) b = bp.getBuffer(PAGESIZE - 1)
if b != nil { if b != nil {
t.Error("bp 3") t.Error("bp 3")
} }
...@@ -57,21 +57,21 @@ func TestBufferPool(t *testing.T) { ...@@ -57,21 +57,21 @@ func TestBufferPool(t *testing.T) {
} }
bp.addBuffer(make([]byte, 3*PAGESIZE)) bp.addBuffer(make([]byte, 3*PAGESIZE))
b = bp.getBuffer(2*PAGESIZE) b = bp.getBuffer(2 * PAGESIZE)
if b != nil { if b != nil {
t.Error("should fail.") t.Error("should fail.")
} }
b = bp.getBuffer(4*PAGESIZE) b = bp.getBuffer(4 * PAGESIZE)
if b != nil { if b != nil {
t.Error("should fail.") t.Error("should fail.")
} }
bp.addBuffer(make([]byte, 4*PAGESIZE)) bp.addBuffer(make([]byte, 4*PAGESIZE))
fmt.Println(bp) fmt.Println(bp)
b = bp.getBuffer(2*PAGESIZE) b = bp.getBuffer(2 * PAGESIZE)
if b != nil { if b != nil {
t.Error("should fail.") t.Error("should fail.")
} }
b = bp.getBuffer(4*PAGESIZE) b = bp.getBuffer(4 * PAGESIZE)
if b == nil { if b == nil {
t.Error("4*ps should succeed.") t.Error("4*ps should succeed.")
} }
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"bytes" "bytes"
) )
var _ = fmt.Print var _ = fmt.Print
// For PathFileSystemConnector. The connector determines inodes. // For PathFileSystemConnector. The connector determines inodes.
type DirEntry struct { type DirEntry struct {
...@@ -64,8 +65,8 @@ func (de *DirEntryList) Bytes() []byte { ...@@ -64,8 +65,8 @@ func (de *DirEntryList) Bytes() []byte {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
type FuseDir struct { type FuseDir struct {
stream chan DirEntry stream chan DirEntry
leftOver DirEntry leftOver DirEntry
connector *PathFileSystemConnector connector *PathFileSystemConnector
parentIno uint64 parentIno uint64
} }
......
...@@ -196,10 +196,10 @@ func (self *MountState) Stats() string { ...@@ -196,10 +196,10 @@ func (self *MountState) Stats() string {
var lines []string var lines []string
// TODO - bufferpool should use expvar. // TODO - bufferpool should use expvar.
lines = append(lines, lines = append(lines,
fmt.Sprintf("buffers: %v", self.buffers.String())) fmt.Sprintf("buffers: %v", self.buffers.String()))
for v := range(expvar.Iter()) { for v := range expvar.Iter() {
if strings.HasPrefix(v.Key, "mount") { if strings.HasPrefix(v.Key, "mount") {
lines = append(lines, fmt.Sprintf("%v: %v\n", v.Key, v.Value)) lines = append(lines, fmt.Sprintf("%v: %v\n", v.Key, v.Value))
} }
...@@ -221,7 +221,7 @@ func (self *MountState) syncWrite(packet [][]byte) { ...@@ -221,7 +221,7 @@ func (self *MountState) syncWrite(packet [][]byte) {
if err != nil { if err != nil {
self.Error(os.NewError(fmt.Sprintf("writer: Writev %v failed, err: %v", packet, err))) self.Error(os.NewError(fmt.Sprintf("writer: Writev %v failed, err: %v", packet, err)))
} }
for _, v := range(packet) { for _, v := range packet {
self.buffers.addBuffer(v) self.buffers.addBuffer(v)
} }
} }
......
...@@ -11,20 +11,20 @@ import ( ...@@ -11,20 +11,20 @@ import (
type mountData struct { type mountData struct {
// If non-nil the file system mounted here. // If non-nil the file system mounted here.
fs PathFilesystem fs PathFilesystem
// If yes, we are looking to unmount the mounted fs. // If yes, we are looking to unmount the mounted fs.
unmountPending bool unmountPending bool
openFiles int openFiles int
openDirs int openDirs int
subMounts int subMounts int
} }
func newMount(fs PathFilesystem) *mountData { func newMount(fs PathFilesystem) *mountData {
return &mountData{fs: fs} return &mountData{fs: fs}
} }
// TODO should rename to dentry? // TODO should rename to dentry?
type inodeData struct { type inodeData struct {
Parent *inodeData Parent *inodeData
...@@ -32,7 +32,7 @@ type inodeData struct { ...@@ -32,7 +32,7 @@ type inodeData struct {
Name string Name string
LookupCount int LookupCount int
Type uint32 Type uint32
// Number of inodeData that have this as parent. // Number of inodeData that have this as parent.
RefCount int RefCount int
...@@ -65,7 +65,7 @@ func (self *inodeData) GetPath() (path string, mount *mountData) { ...@@ -65,7 +65,7 @@ func (self *inodeData) GetPath() (path string, mount *mountData) {
if inode == nil { if inode == nil {
panic("did not find parent with mount") panic("did not find parent with mount")
} }
fullPath := strings.Join(components[j:], "/") fullPath := strings.Join(components[j:], "/")
mount = inode.mount mount = inode.mount
if mount.unmountPending { if mount.unmountPending {
...@@ -109,9 +109,9 @@ type PathFileSystemConnector struct { ...@@ -109,9 +109,9 @@ type PathFileSystemConnector struct {
inodePathMap map[string]*inodeData inodePathMap map[string]*inodeData
inodePathMapByInode map[uint64]*inodeData inodePathMapByInode map[uint64]*inodeData
nextFreeInode uint64 nextFreeInode uint64
options PathFileSystemConnectorOptions options PathFileSystemConnectorOptions
Debug bool Debug bool
} }
// Must be called with lock held. // Must be called with lock held.
...@@ -148,7 +148,7 @@ func (self *PathFileSystemConnector) lookup(key string) *inodeData { ...@@ -148,7 +148,7 @@ func (self *PathFileSystemConnector) lookup(key string) *inodeData {
defer self.lock.RUnlock() defer self.lock.RUnlock()
return self.inodePathMap[key] return self.inodePathMap[key]
} }
func (self *PathFileSystemConnector) lookupUpdate(nodeId uint64, name string) *inodeData { func (self *PathFileSystemConnector) lookupUpdate(nodeId uint64, name string) *inodeData {
key := inodeDataKey(nodeId, name) key := inodeDataKey(nodeId, name)
data := self.lookup(key) data := self.lookup(key)
...@@ -259,16 +259,16 @@ func (self *PathFileSystemConnector) unlinkUpdate(nodeid uint64, name string) { ...@@ -259,16 +259,16 @@ func (self *PathFileSystemConnector) unlinkUpdate(nodeid uint64, name string) {
func (self *PathFileSystemConnector) findInode(fullPath string) *inodeData { func (self *PathFileSystemConnector) findInode(fullPath string) *inodeData {
fullPath = strings.TrimLeft(path.Clean(fullPath), "/") fullPath = strings.TrimLeft(path.Clean(fullPath), "/")
comps := strings.Split(fullPath, "/", -1) comps := strings.Split(fullPath, "/", -1)
self.lock.RLock() self.lock.RLock()
defer self.lock.RUnlock() defer self.lock.RUnlock()
node := self.inodePathMapByInode[FUSE_ROOT_ID] node := self.inodePathMapByInode[FUSE_ROOT_ID]
for i, component := range(comps) { for i, component := range comps {
if len(component) == 0 { if len(component) == 0 {
continue continue
} }
key := inodeDataKey(node.NodeId, component) key := inodeDataKey(node.NodeId, component)
node = self.inodePathMap[key] node = self.inodePathMap[key]
if node == nil { if node == nil {
...@@ -290,7 +290,7 @@ func NewPathFileSystemConnector(fs PathFilesystem) (out *PathFileSystemConnector ...@@ -290,7 +290,7 @@ func NewPathFileSystemConnector(fs PathFilesystem) (out *PathFileSystemConnector
rootData := new(inodeData) rootData := new(inodeData)
rootData.NodeId = FUSE_ROOT_ID rootData.NodeId = FUSE_ROOT_ID
rootData.Type = ModeToType(S_IFDIR) rootData.Type = ModeToType(S_IFDIR)
out.inodePathMap[rootData.Key()] = rootData out.inodePathMap[rootData.Key()] = rootData
out.inodePathMapByInode[FUSE_ROOT_ID] = rootData out.inodePathMapByInode[FUSE_ROOT_ID] = rootData
out.nextFreeInode = FUSE_ROOT_ID + 1 out.nextFreeInode = FUSE_ROOT_ID + 1
...@@ -318,10 +318,10 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu ...@@ -318,10 +318,10 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu
return EBUSY return EBUSY
} }
if node.Type & ModeToType(S_IFDIR) == 0 { if node.Type&ModeToType(S_IFDIR) == 0 {
return EINVAL return EINVAL
} }
code := fs.Mount(self) code := fs.Mount(self)
if code != OK { if code != OK {
if self.Debug { if self.Debug {
...@@ -329,7 +329,7 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu ...@@ -329,7 +329,7 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu
} }
return code return code
} }
if self.Debug { if self.Debug {
log.Println("Mount: ", fs, "on", path, node) log.Println("Mount: ", fs, "on", path, node)
} }
...@@ -340,7 +340,7 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu ...@@ -340,7 +340,7 @@ func (self *PathFileSystemConnector) Mount(path string, fs PathFilesystem) Statu
_, parentMount := node.Parent.GetPath() _, parentMount := node.Parent.GetPath()
parentMount.subMounts++ parentMount.subMounts++
} }
return OK return OK
} }
...@@ -355,7 +355,7 @@ func (self *PathFileSystemConnector) Unmount(path string) Status { ...@@ -355,7 +355,7 @@ func (self *PathFileSystemConnector) Unmount(path string) Status {
panic(path) panic(path)
} }
if mount.openFiles + mount.openDirs + mount.subMounts > 0 { if mount.openFiles+mount.openDirs+mount.subMounts > 0 {
log.Println("busy: ", mount) log.Println("busy: ", mount)
return EBUSY return EBUSY
} }
...@@ -404,7 +404,7 @@ func (self *PathFileSystemConnector) Lookup(header *InHeader, name string) (out ...@@ -404,7 +404,7 @@ func (self *PathFileSystemConnector) Lookup(header *InHeader, name string) (out
fullPath = path.Join(fullPath, name) fullPath = path.Join(fullPath, name)
attr, err := mount.fs.GetAttr(fullPath) attr, err := mount.fs.GetAttr(fullPath)
if err == ENOENT && self.options.NegativeTimeout > 0.0 { if err == ENOENT && self.options.NegativeTimeout > 0.0 {
return NegativeEntry(self.options.NegativeTimeout), OK return NegativeEntry(self.options.NegativeTimeout), OK
} }
...@@ -416,7 +416,7 @@ func (self *PathFileSystemConnector) Lookup(header *InHeader, name string) (out ...@@ -416,7 +416,7 @@ func (self *PathFileSystemConnector) Lookup(header *InHeader, name string) (out
data := self.lookupUpdate(header.NodeId, name) data := self.lookupUpdate(header.NodeId, name)
data.LookupCount++ data.LookupCount++
data.Type = ModeToType(attr.Mode) data.Type = ModeToType(attr.Mode)
out = new(EntryOut) out = new(EntryOut)
out.NodeId = data.NodeId out.NodeId = data.NodeId
out.Generation = 1 // where to get the generation? out.Generation = 1 // where to get the generation?
...@@ -537,7 +537,7 @@ func (self *PathFileSystemConnector) Mknod(header *InHeader, input *MknodIn, nam ...@@ -537,7 +537,7 @@ func (self *PathFileSystemConnector) Mknod(header *InHeader, input *MknodIn, nam
fullPath, mount := self.GetPath(header.NodeId) fullPath, mount := self.GetPath(header.NodeId)
if mount == nil { if mount == nil {
return nil, ENOENT return nil, ENOENT
} }
fullPath = path.Join(fullPath, name) fullPath = path.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 {
...@@ -550,7 +550,7 @@ func (self *PathFileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, nam ...@@ -550,7 +550,7 @@ func (self *PathFileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, nam
fullPath, mount := self.GetPath(header.NodeId) fullPath, mount := self.GetPath(header.NodeId)
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(path.Join(fullPath, name), input.Mode)
if err != OK { if err != OK {
return nil, err return nil, err
...@@ -563,7 +563,7 @@ func (self *PathFileSystemConnector) Unlink(header *InHeader, name string) (code ...@@ -563,7 +563,7 @@ func (self *PathFileSystemConnector) Unlink(header *InHeader, name string) (code
fullPath, mount := self.GetPath(header.NodeId) fullPath, mount := self.GetPath(header.NodeId)
if mount == nil { if mount == nil {
return ENOENT return ENOENT
} }
code = mount.fs.Unlink(path.Join(fullPath, name)) code = mount.fs.Unlink(path.Join(fullPath, name))
// Like fuse.c, we update our internal tables. // Like fuse.c, we update our internal tables.
...@@ -586,7 +586,7 @@ func (self *PathFileSystemConnector) Symlink(header *InHeader, pointedTo string, ...@@ -586,7 +586,7 @@ func (self *PathFileSystemConnector) Symlink(header *InHeader, pointedTo string,
fullPath, mount := self.GetPath(header.NodeId) fullPath, mount := self.GetPath(header.NodeId)
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, path.Join(fullPath, linkName))
if err != OK { if err != OK {
return nil, err return nil, err
...@@ -605,7 +605,7 @@ func (self *PathFileSystemConnector) Rename(header *InHeader, input *RenameIn, o ...@@ -605,7 +605,7 @@ func (self *PathFileSystemConnector) Rename(header *InHeader, input *RenameIn, o
if mount != oldMount { if mount != oldMount {
return EXDEV return EXDEV
} }
oldPath = path.Join(oldPath, oldName) oldPath = path.Join(oldPath, oldName)
newPath = path.Join(newPath, newName) newPath = path.Join(newPath, newName)
code = mount.fs.Rename(oldPath, newPath) code = mount.fs.Rename(oldPath, newPath)
...@@ -648,7 +648,7 @@ func (self *PathFileSystemConnector) Access(header *InHeader, input *AccessIn) ( ...@@ -648,7 +648,7 @@ func (self *PathFileSystemConnector) Access(header *InHeader, input *AccessIn) (
p, mount := self.GetPath(header.NodeId) p, mount := self.GetPath(header.NodeId)
if mount == nil { if mount == nil {
return ENOENT return ENOENT
} }
return mount.fs.Access(p, input.Mask) return mount.fs.Access(p, input.Mask)
} }
......
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