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

Rename variable.

parent 4673f8b4
...@@ -115,7 +115,7 @@ func NewPathNodeFs(fs FileSystem) *PathNodeFs { ...@@ -115,7 +115,7 @@ func NewPathNodeFs(fs FileSystem) *PathNodeFs {
root: root, root: root,
clientInodeMap: map[uint64][]*clientInodePath{}, clientInodeMap: map[uint64][]*clientInodePath{},
} }
root.ifs = me root.pathFs = me
return me return me
} }
...@@ -127,7 +127,7 @@ func (me *PathNodeFs) Root() FsNode { ...@@ -127,7 +127,7 @@ func (me *PathNodeFs) Root() FsNode {
// the inode). This structure is used to implement glue for FSes where // the inode). This structure is used to implement glue for FSes where
// there is a one-to-one mapping of paths and inodes. // there is a one-to-one mapping of paths and inodes.
type pathInode struct { type pathInode struct {
ifs *PathNodeFs pathFs *PathNodeFs
fs FileSystem fs FileSystem
Name string Name string
...@@ -161,11 +161,11 @@ func (me *pathInode) GetPath() (path string) { ...@@ -161,11 +161,11 @@ func (me *pathInode) GetPath() (path string) {
for ; n.Parent != nil; n = n.Parent { for ; n.Parent != nil; n = n.Parent {
rev_components = append(rev_components, n.Name) rev_components = append(rev_components, n.Name)
} }
if n != me.ifs.root { if n != me.pathFs.root {
return ".deleted" return ".deleted"
} }
p := ReverseJoin(rev_components, "/") p := ReverseJoin(rev_components, "/")
if me.ifs.Debug { if me.pathFs.Debug {
log.Printf("Inode %d = %q", me.Inode().nodeId, p) log.Printf("Inode %d = %q", me.Inode().nodeId, p)
} }
...@@ -178,14 +178,14 @@ func (me *pathInode) AddChild(name string, child FsNode) { ...@@ -178,14 +178,14 @@ func (me *pathInode) AddChild(name string, child FsNode) {
ch.Name = name ch.Name = name
if ch.clientInode > 0 { if ch.clientInode > 0 {
me.ifs.clientInodeMapMutex.Lock() me.pathFs.clientInodeMapMutex.Lock()
defer me.ifs.clientInodeMapMutex.Unlock() defer me.pathFs.clientInodeMapMutex.Unlock()
m := me.ifs.clientInodeMap[ch.clientInode] m := me.pathFs.clientInodeMap[ch.clientInode]
e := &clientInodePath{ e := &clientInodePath{
me, name, child.(*pathInode), me, name, child.(*pathInode),
} }
m = append(m, e) m = append(m, e)
me.ifs.clientInodeMap[ch.clientInode] = m me.pathFs.clientInodeMap[ch.clientInode] = m
} }
} }
...@@ -193,9 +193,9 @@ func (me *pathInode) RmChild(name string, child FsNode) { ...@@ -193,9 +193,9 @@ func (me *pathInode) RmChild(name string, child FsNode) {
ch := child.(*pathInode) ch := child.(*pathInode)
if ch.clientInode > 0 { if ch.clientInode > 0 {
me.ifs.clientInodeMapMutex.Lock() me.pathFs.clientInodeMapMutex.Lock()
defer me.ifs.clientInodeMapMutex.Unlock() defer me.pathFs.clientInodeMapMutex.Unlock()
m := me.ifs.clientInodeMap[ch.clientInode] m := me.pathFs.clientInodeMap[ch.clientInode]
idx := -1 idx := -1
for i, v := range m { for i, v := range m {
...@@ -213,7 +213,7 @@ func (me *pathInode) RmChild(name string, child FsNode) { ...@@ -213,7 +213,7 @@ func (me *pathInode) RmChild(name string, child FsNode) {
ch.Name = m[0].name ch.Name = m[0].name
return return
} else { } else {
me.ifs.clientInodeMap[ch.clientInode] = nil, false me.pathFs.clientInodeMap[ch.clientInode] = nil, false
} }
} }
...@@ -226,10 +226,10 @@ func (me *pathInode) setClientInode(ino uint64) { ...@@ -226,10 +226,10 @@ func (me *pathInode) setClientInode(ino uint64) {
return return
} }
defer me.Inode().LockTree()() defer me.Inode().LockTree()()
me.ifs.clientInodeMapMutex.Lock() me.pathFs.clientInodeMapMutex.Lock()
defer me.ifs.clientInodeMapMutex.Unlock() defer me.pathFs.clientInodeMapMutex.Unlock()
if me.clientInode != 0 { if me.clientInode != 0 {
me.ifs.clientInodeMap[me.clientInode] = nil, false me.pathFs.clientInodeMap[me.clientInode] = nil, false
} }
me.clientInode = ino me.clientInode = ino
...@@ -237,7 +237,7 @@ func (me *pathInode) setClientInode(ino uint64) { ...@@ -237,7 +237,7 @@ func (me *pathInode) setClientInode(ino uint64) {
e := &clientInodePath{ e := &clientInodePath{
me.Parent, me.Name, me, me.Parent, me.Name, me,
} }
me.ifs.clientInodeMap[ino] = append(me.ifs.clientInodeMap[ino], e) me.pathFs.clientInodeMap[ino] = append(me.pathFs.clientInodeMap[ino], e)
} }
} }
...@@ -245,9 +245,9 @@ func (me *pathInode) OnForget() { ...@@ -245,9 +245,9 @@ func (me *pathInode) OnForget() {
if me.clientInode == 0 { if me.clientInode == 0 {
return return
} }
me.ifs.clientInodeMapMutex.Lock() me.pathFs.clientInodeMapMutex.Lock()
defer me.ifs.clientInodeMapMutex.Unlock() defer me.pathFs.clientInodeMapMutex.Unlock()
me.ifs.clientInodeMap[me.clientInode] = nil, false me.pathFs.clientInodeMap[me.clientInode] = nil, false
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
...@@ -379,13 +379,13 @@ func (me *pathInode) createChild(name string) *pathInode { ...@@ -379,13 +379,13 @@ func (me *pathInode) createChild(name string) *pathInode {
i.Parent = me i.Parent = me
i.Name = name i.Name = name
i.fs = me.fs i.fs = me.fs
i.ifs = me.ifs i.pathFs = me.pathFs
return i return i
} }
func (me *pathInode) Open(flags uint32, context *Context) (file File, code Status) { func (me *pathInode) Open(flags uint32, context *Context) (file File, code Status) {
file, code = me.fs.Open(me.GetPath(), flags, context) file, code = me.fs.Open(me.GetPath(), flags, context)
if me.ifs.Debug { if me.pathFs.Debug {
file = &WithFlags{ file = &WithFlags{
File: file, File: file,
Description: me.GetPath(), Description: me.GetPath(),
...@@ -406,9 +406,9 @@ func (me *pathInode) Lookup(name string, context *Context) (fi *os.FileInfo, nod ...@@ -406,9 +406,9 @@ func (me *pathInode) Lookup(name string, context *Context) (fi *os.FileInfo, nod
func (me *pathInode) findChild(ino uint64, name string) (out *pathInode) { func (me *pathInode) findChild(ino uint64, name string) (out *pathInode) {
if ino > 0 { if ino > 0 {
me.ifs.clientInodeMapMutex.Lock() me.pathFs.clientInodeMapMutex.Lock()
defer me.ifs.clientInodeMapMutex.Unlock() defer me.pathFs.clientInodeMapMutex.Unlock()
v := me.ifs.clientInodeMap[ino] v := me.pathFs.clientInodeMap[ino]
if len(v) > 0 { if len(v) > 0 {
out = v[0].node out = v[0].node
} }
......
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