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
Kirill Smelkov
go-fuse
Commits
1ab130b4
Commit
1ab130b4
authored
Mar 27, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: test Mknod
parent
41672d15
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
+44
-3
nodefs/README.md
nodefs/README.md
+4
-2
nodefs/bridge.go
nodefs/bridge.go
+6
-0
nodefs/simple_test.go
nodefs/simple_test.go
+34
-1
No files found.
nodefs/README.md
View file @
1ab130b4
...
@@ -50,7 +50,9 @@ Decisions
...
@@ -50,7 +50,9 @@ Decisions
reading) are handled automatically. No support for directory
reading) are handled automatically. No support for directory
seeks.
seeks.
To decide
To d
o/To d
ecide
=========
=========
*
implement remaining file types (exercise Mknod)
*
decide on a final package name
*
handle less open/create.
nodefs/bridge.go
View file @
1ab130b4
...
@@ -100,7 +100,13 @@ func (b *rawBridge) newInode(ctx context.Context, ops Operations, id NodeAttr, p
...
@@ -100,7 +100,13 @@ func (b *rawBridge) newInode(ctx context.Context, ops Operations, id NodeAttr, p
_
=
ops
.
(
SymlinkOperations
)
_
=
ops
.
(
SymlinkOperations
)
case
fuse
.
S_IFREG
:
case
fuse
.
S_IFREG
:
_
=
ops
.
(
FileOperations
)
_
=
ops
.
(
FileOperations
)
case
fuse
.
S_IFIFO
,
syscall
.
S_IFSOCK
:
// no type check necessary: FIFO and SOCK don't go
// through FUSE for open/read etc.
break
default
:
default
:
// Remaining types are char and block devices. Not
// sure how those would work in FUSE
log
.
Panicf
(
"filetype %o unimplemented"
,
id
.
Mode
)
log
.
Panicf
(
"filetype %o unimplemented"
,
id
.
Mode
)
}
}
...
...
nodefs/simple_test.go
View file @
1ab130b4
...
@@ -555,4 +555,37 @@ func TestGetAttrParallel(t *testing.T) {
...
@@ -555,4 +555,37 @@ func TestGetAttrParallel(t *testing.T) {
wg
.
Wait
()
wg
.
Wait
()
}
}
// XXX test mknod.
func
TestMknod
(
t
*
testing
.
T
)
{
tc
:=
newTestCase
(
t
,
false
,
false
)
defer
tc
.
Clean
()
modes
:=
map
[
string
]
uint32
{
"regular"
:
syscall
.
S_IFREG
,
"socket"
:
syscall
.
S_IFSOCK
,
"fifo"
:
syscall
.
S_IFIFO
,
}
for
nm
,
mode
:=
range
modes
{
t
.
Run
(
nm
,
func
(
t
*
testing
.
T
)
{
p
:=
filepath
.
Join
(
tc
.
mntDir
,
nm
)
err
:=
syscall
.
Mknod
(
p
,
mode
|
0755
,
(
8
<<
8
)
|
0
)
if
err
!=
nil
{
t
.
Fatalf
(
"mknod(%s): %v"
,
nm
,
err
)
}
var
st
syscall
.
Stat_t
if
err
:=
syscall
.
Stat
(
p
,
&
st
);
err
!=
nil
{
got
:=
st
.
Mode
&^
07777
if
want
:=
mode
;
got
!=
want
{
t
.
Fatalf
(
"stat(%s): got %o want %o"
,
nm
,
got
,
want
)
}
}
// We could test if the files can be
// read/written but: The kernel handles FIFOs
// without talking to FUSE at all. Presumably,
// this also holds for sockets. Regular files
// are tested extensively elsewhere.
})
}
}
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