Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
01d1fc58
Commit
01d1fc58
authored
Jul 11, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop mounts map from Inode.
parent
7a452b92
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
38 deletions
+15
-38
fuse/fsconnector.go
fuse/fsconnector.go
+0
-15
fuse/fsmount.go
fuse/fsmount.go
+2
-2
fuse/fsops.go
fuse/fsops.go
+6
-5
fuse/inode.go
fuse/inode.go
+7
-16
No files found.
fuse/fsconnector.go
View file @
01d1fc58
...
@@ -106,16 +106,6 @@ func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) {
...
@@ -106,16 +106,6 @@ func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) {
}
}
}
}
func
(
c
*
FileSystemConnector
)
findMount
(
parent
*
Inode
,
name
string
)
(
mount
*
fileSystemMount
)
{
parent
.
treeLock
.
RLock
()
if
parent
.
mounts
!=
nil
{
mount
=
parent
.
mounts
[
name
]
}
parent
.
treeLock
.
RUnlock
()
return
}
func
(
c
*
FileSystemConnector
)
toInode
(
nodeid
uint64
)
*
Inode
{
func
(
c
*
FileSystemConnector
)
toInode
(
nodeid
uint64
)
*
Inode
{
if
nodeid
==
raw
.
FUSE_ROOT_ID
{
if
nodeid
==
raw
.
FUSE_ROOT_ID
{
return
c
.
rootNode
return
c
.
rootNode
...
@@ -287,10 +277,6 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileS
...
@@ -287,10 +277,6 @@ func (c *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileS
node
.
mount
.
connector
=
c
node
.
mount
.
connector
=
c
parent
.
addChild
(
name
,
node
)
parent
.
addChild
(
name
,
node
)
if
parent
.
mounts
==
nil
{
parent
.
mounts
=
make
(
map
[
string
]
*
fileSystemMount
)
}
parent
.
mounts
[
name
]
=
node
.
mountPoint
node
.
mountPoint
.
parentInode
=
parent
node
.
mountPoint
.
parentInode
=
parent
if
c
.
Debug
{
if
c
.
Debug
{
log
.
Println
(
"Mount: "
,
nodeFs
,
"on subdir"
,
name
,
log
.
Println
(
"Mount: "
,
nodeFs
,
"on subdir"
,
name
,
...
@@ -335,7 +321,6 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
...
@@ -335,7 +321,6 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
mount
.
mountInode
=
nil
mount
.
mountInode
=
nil
mountInode
.
mountPoint
=
nil
mountInode
.
mountPoint
=
nil
delete
(
parentNode
.
mounts
,
name
)
delete
(
parentNode
.
children
,
name
)
delete
(
parentNode
.
children
,
name
)
mount
.
fs
.
OnUnmount
()
mount
.
fs
.
OnUnmount
()
...
...
fuse/fsmount.go
View file @
01d1fc58
...
@@ -46,8 +46,8 @@ type fileSystemMount struct {
...
@@ -46,8 +46,8 @@ type fileSystemMount struct {
// Must called with lock for parent held.
// Must called with lock for parent held.
func
(
m
*
fileSystemMount
)
mountName
()
string
{
func
(
m
*
fileSystemMount
)
mountName
()
string
{
for
k
,
v
:=
range
m
.
parentInode
.
mounts
{
for
k
,
v
:=
range
m
.
parentInode
.
children
{
if
m
==
v
{
if
m
.
mountInode
==
v
{
return
k
return
k
}
}
}
}
...
...
fuse/fsops.go
View file @
01d1fc58
...
@@ -45,11 +45,11 @@ func (c *FileSystemConnector) lookupMountUpdate(out *Attr, mount *fileSystemMoun
...
@@ -45,11 +45,11 @@ func (c *FileSystemConnector) lookupMountUpdate(out *Attr, mount *fileSystemMoun
}
}
func
(
c
*
FileSystemConnector
)
internalLookup
(
out
*
Attr
,
parent
*
Inode
,
name
string
,
context
*
Context
)
(
node
*
Inode
,
code
Status
)
{
func
(
c
*
FileSystemConnector
)
internalLookup
(
out
*
Attr
,
parent
*
Inode
,
name
string
,
context
*
Context
)
(
node
*
Inode
,
code
Status
)
{
if
subMount
:=
c
.
findMount
(
parent
,
name
);
subMount
!=
nil
{
child
:=
parent
.
GetChild
(
name
)
return
c
.
lookupMountUpdate
(
out
,
subMount
)
if
child
!=
nil
&&
child
.
mountPoint
!=
nil
{
return
c
.
lookupMountUpdate
(
out
,
child
.
mountPoint
)
}
}
child
:=
parent
.
GetChild
(
name
)
if
child
!=
nil
{
if
child
!=
nil
{
parent
=
nil
parent
=
nil
}
}
...
@@ -259,8 +259,9 @@ func (c *FileSystemConnector) Symlink(out *raw.EntryOut, header *raw.InHeader, p
...
@@ -259,8 +259,9 @@ func (c *FileSystemConnector) Symlink(out *raw.EntryOut, header *raw.InHeader, p
func
(
c
*
FileSystemConnector
)
Rename
(
header
*
raw
.
InHeader
,
input
*
raw
.
RenameIn
,
oldName
string
,
newName
string
)
(
code
Status
)
{
func
(
c
*
FileSystemConnector
)
Rename
(
header
*
raw
.
InHeader
,
input
*
raw
.
RenameIn
,
oldName
string
,
newName
string
)
(
code
Status
)
{
oldParent
:=
c
.
toInode
(
header
.
NodeId
)
oldParent
:=
c
.
toInode
(
header
.
NodeId
)
isMountPoint
:=
c
.
findMount
(
oldParent
,
oldName
)
!=
nil
if
isMountPoint
{
child
:=
oldParent
.
GetChild
(
oldName
)
if
child
.
mountPoint
!=
nil
{
return
EBUSY
return
EBUSY
}
}
...
...
fuse/inode.go
View file @
01d1fc58
...
@@ -39,10 +39,6 @@ type Inode struct {
...
@@ -39,10 +39,6 @@ type Inode struct {
// All data below is protected by treeLock.
// All data below is protected by treeLock.
children
map
[
string
]
*
Inode
children
map
[
string
]
*
Inode
// Contains directories that function as mounts. The entries
// are duplicated in children.
mounts
map
[
string
]
*
fileSystemMount
// The nodeId is only used to communicate to the kernel. If
// The nodeId is only used to communicate to the kernel. If
// it is zero, it means the kernel does not know about this
// it is zero, it means the kernel does not know about this
// Inode. You should probably never read nodeId, but always
// Inode. You should probably never read nodeId, but always
...
@@ -224,12 +220,14 @@ func (n *Inode) canUnmount() bool {
...
@@ -224,12 +220,14 @@ func (n *Inode) canUnmount() bool {
func
(
n
*
Inode
)
getMountDirEntries
()
(
out
[]
DirEntry
)
{
func
(
n
*
Inode
)
getMountDirEntries
()
(
out
[]
DirEntry
)
{
n
.
treeLock
.
RLock
()
n
.
treeLock
.
RLock
()
for
k
:=
range
n
.
mounts
{
for
k
,
v
:=
range
n
.
children
{
if
v
.
mountPoint
!=
nil
{
out
=
append
(
out
,
DirEntry
{
out
=
append
(
out
,
DirEntry
{
Name
:
k
,
Name
:
k
,
Mode
:
S_IFDIR
,
Mode
:
S_IFDIR
,
})
})
}
}
}
n
.
treeLock
.
RUnlock
()
n
.
treeLock
.
RUnlock
()
return
out
return
out
...
@@ -257,13 +255,6 @@ func (n *Inode) verify(cur *fileSystemMount) {
...
@@ -257,13 +255,6 @@ func (n *Inode) verify(cur *fileSystemMount) {
log
.
Panicf
(
"n.mount not set correctly %v %v"
,
n
.
mount
,
cur
)
log
.
Panicf
(
"n.mount not set correctly %v %v"
,
n
.
mount
,
cur
)
}
}
for
name
,
m
:=
range
n
.
mounts
{
if
m
.
mountInode
!=
n
.
children
[
name
]
{
log
.
Panicf
(
"mountpoint parent mismatch: node:%v name:%v ch:%v"
,
n
.
mountPoint
,
name
,
n
.
children
)
}
}
for
nm
,
ch
:=
range
n
.
children
{
for
nm
,
ch
:=
range
n
.
children
{
if
ch
==
nil
{
if
ch
==
nil
{
log
.
Panicf
(
"Found nil child: %q"
,
nm
)
log
.
Panicf
(
"Found nil child: %q"
,
nm
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment