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
875784b3
Commit
875784b3
authored
Jul 18, 2017
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: implement LOOKUP for pollhack.
Some versions of FUSE need this; fixes pathfs owner tests.
parent
c5c77f10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
26 deletions
+34
-26
fuse/opcode.go
fuse/opcode.go
+0
-19
fuse/pathfs/owner_test.go
fuse/pathfs/owner_test.go
+2
-1
fuse/poll.go
fuse/poll.go
+25
-0
fuse/server.go
fuse/server.go
+7
-6
No files found.
fuse/opcode.go
View file @
875784b3
...
...
@@ -129,22 +129,6 @@ func doOpen(server *Server, req *request) {
func
doCreate
(
server
*
Server
,
req
*
request
)
{
out
:=
(
*
CreateOut
)(
req
.
outData
)
if
req
.
filenames
[
0
]
==
pollHackName
&&
req
.
inHeader
.
NodeId
==
FUSE_ROOT_ID
{
out
.
EntryOut
=
EntryOut
{
NodeId
:
pollHackInode
,
Attr
:
Attr
{
Ino
:
pollHackInode
,
Mode
:
S_IFREG
|
0644
,
Nlink
:
1
,
},
}
out
.
OpenOut
=
OpenOut
{
Fh
:
pollHackInode
,
}
req
.
status
=
OK
return
}
status
:=
server
.
fileSystem
.
Create
((
*
CreateIn
)(
req
.
inData
),
req
.
filenames
[
0
],
out
)
req
.
status
=
status
}
...
...
@@ -262,9 +246,6 @@ func doGetAttr(server *Server, req *request) {
// doForget - forget one NodeId
func
doForget
(
server
*
Server
,
req
*
request
)
{
if
req
.
inHeader
.
NodeId
==
pollHackInode
{
return
}
if
!
server
.
opts
.
RememberInodes
{
server
.
fileSystem
.
Forget
(
req
.
inHeader
.
NodeId
,
(
*
ForgetIn
)(
req
.
inData
)
.
Nlookup
)
}
...
...
fuse/pathfs/owner_test.go
View file @
875784b3
...
...
@@ -37,6 +37,7 @@ func (fs *ownerFs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse
func
setupOwnerTest
(
t
*
testing
.
T
,
opts
*
nodefs
.
Options
)
(
workdir
string
,
cleanup
func
())
{
wd
:=
testutil
.
TempDir
()
opts
.
Debug
=
testutil
.
VerboseTest
()
fs
:=
&
ownerFs
{
NewDefaultFileSystem
()}
nfs
:=
NewPathNodeFs
(
fs
,
nil
)
state
,
_
,
err
:=
nodefs
.
MountRoot
(
wd
,
nfs
.
Root
(),
opts
)
...
...
@@ -45,7 +46,7 @@ func setupOwnerTest(t *testing.T, opts *nodefs.Options) (workdir string, cleanup
}
go
state
.
Serve
()
if
err
:=
state
.
WaitMount
();
err
!=
nil
{
t
.
Fatal
(
"WaitMount
"
,
err
)
t
.
Fatal
f
(
"WaitMount: %v
"
,
err
)
}
return
wd
,
func
()
{
state
.
Unmount
()
...
...
fuse/poll.go
View file @
875784b3
...
...
@@ -7,3 +7,28 @@ package fuse
// can say ENOSYS and prevent further _OP_POLL requests.
const
pollHackName
=
".go-fuse-epoll-hack"
const
pollHackInode
=
^
uint64
(
0
)
func
doPollHackLookup
(
ms
*
Server
,
req
*
request
)
{
switch
req
.
inHeader
.
Opcode
{
case
_OP_CREATE
:
out
:=
(
*
CreateOut
)(
req
.
outData
)
out
.
EntryOut
=
EntryOut
{
NodeId
:
pollHackInode
,
Attr
:
Attr
{
Ino
:
pollHackInode
,
Mode
:
S_IFREG
|
0644
,
Nlink
:
1
,
},
}
out
.
OpenOut
=
OpenOut
{
Fh
:
pollHackInode
,
}
req
.
status
=
OK
case
_OP_LOOKUP
:
out
:=
(
*
EntryOut
)(
req
.
outData
)
*
out
=
EntryOut
{}
req
.
status
=
ENOENT
default
:
req
.
status
=
EIO
}
}
fuse/server.go
View file @
875784b3
...
...
@@ -389,18 +389,19 @@ func (ms *Server) handleRequest(req *request) Status {
log
.
Println
(
req
.
InputDebug
())
}
if
req
.
inHeader
.
Opcode
==
_OP_POLL
{
req
.
status
=
ENOSYS
}
else
if
req
.
inHeader
.
NodeId
==
pollHackInode
{
if
req
.
inHeader
.
NodeId
==
pollHackInode
{
// We want to avoid switching off features through our
// poll hack, so don't use ENOSYS
req
.
status
=
EIO
if
req
.
inHeader
.
Opcode
==
_OP_POLL
{
req
.
status
=
ENOSYS
}
}
else
if
req
.
inHeader
.
NodeId
==
FUSE_ROOT_ID
&&
len
(
req
.
filenames
)
>
0
&&
req
.
filenames
[
0
]
==
pollHackName
{
doPollHackLookup
(
ms
,
req
)
}
else
if
req
.
status
.
Ok
()
&&
req
.
handler
.
Func
==
nil
{
log
.
Printf
(
"Unimplemented opcode %v"
,
operationName
(
req
.
inHeader
.
Opcode
))
req
.
status
=
ENOSYS
}
if
req
.
status
.
Ok
()
{
}
else
if
req
.
status
.
Ok
()
{
req
.
handler
.
Func
(
ms
,
req
)
}
...
...
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