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
86baacc6
Commit
86baacc6
authored
Jan 03, 2014
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: Return mount nodes only once for DefaultNode.
parent
447764e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
fuse/nodefs/defaultnode.go
fuse/nodefs/defaultnode.go
+3
-0
fuse/test/mount_test.go
fuse/test/mount_test.go
+44
-0
No files found.
fuse/nodefs/defaultnode.go
View file @
86baacc6
...
...
@@ -114,6 +114,9 @@ func (n *defaultNode) OpenDir(context *fuse.Context) ([]fuse.DirEntry, fuse.Stat
ch
:=
n
.
Inode
()
.
Children
()
s
:=
make
([]
fuse
.
DirEntry
,
0
,
len
(
ch
))
for
name
,
child
:=
range
ch
{
if
child
.
mountPoint
!=
nil
{
continue
}
var
a
fuse
.
Attr
code
:=
child
.
Node
()
.
GetAttr
(
&
a
,
nil
,
context
)
if
code
.
Ok
()
{
...
...
fuse/test/mount_test.go
View file @
86baacc6
...
...
@@ -162,3 +162,47 @@ func TestDeletedUnmount(t *testing.T) {
t
.
Error
(
"should succeed"
,
code
)
}
}
type
defaultFS
struct
{
nodefs
.
FileSystem
root
nodefs
.
Node
}
func
(
fs
*
defaultFS
)
Root
()
nodefs
.
Node
{
return
fs
.
root
}
func
TestDefaultNodeMount
(
t
*
testing
.
T
)
{
fs
:=
&
defaultFS
{
nodefs
.
NewDefaultFileSystem
(),
nodefs
.
NewDefaultNode
(),
}
dir
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse"
)
if
err
!=
nil
{
t
.
Fatalf
(
"TempDir: %v"
,
err
)
}
defer
os
.
RemoveAll
(
dir
)
s
,
conn
,
err
:=
nodefs
.
MountFileSystem
(
dir
,
fs
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"MountFileSystem: %v"
,
err
)
}
go
s
.
Serve
()
defer
s
.
Unmount
()
sub
:=
&
defaultFS
{
nodefs
.
NewDefaultFileSystem
(),
nodefs
.
NewDefaultNode
(),
}
if
err
:=
conn
.
Mount
(
fs
.
Root
()
.
Inode
(),
"sub"
,
sub
,
nil
);
!
err
.
Ok
()
{
t
.
Fatalf
(
"Mount: %v"
,
err
)
}
if
entries
,
err
:=
ioutil
.
ReadDir
(
dir
);
err
!=
nil
{
t
.
Fatalf
(
"ReadDir: %v"
,
err
)
}
else
if
len
(
entries
)
!=
1
{
t
.
Fatalf
(
"got %d entries"
,
len
(
entries
))
}
else
if
entries
[
0
]
.
Name
()
!=
"sub"
{
t
.
Fatalf
(
"got %q, want %q"
,
entries
[
0
]
.
Name
(),
"sub"
)
}
}
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