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
3cf08068
Commit
3cf08068
authored
Aug 09, 2016
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide InitIn.SupportsVersion and InitIn.SupportsNotify.
parent
0534f2ff
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
6 deletions
+34
-6
fuse/server.go
fuse/server.go
+27
-0
fuse/types.go
fuse/types.go
+7
-6
No files found.
fuse/server.go
View file @
3cf08068
...
...
@@ -441,6 +441,10 @@ func (ms *Server) write(req *request) Status {
// InodeNotify invalidates the information associated with the inode
// (ie. data cache, attributes, etc.)
func
(
ms
*
Server
)
InodeNotify
(
node
uint64
,
off
int64
,
length
int64
)
Status
{
if
!
ms
.
kernelSettings
.
SupportsNotify
(
NOTIFY_INVAL_INODE
)
{
return
ENOSYS
}
entry
:=
&
NotifyInvalInodeOut
{
Ino
:
node
,
Off
:
off
,
...
...
@@ -512,6 +516,9 @@ func (ms *Server) DeleteNotify(parent uint64, child uint64, name string) Status
// within a directory changes. You should not hold any FUSE filesystem
// locks, as that can lead to deadlock.
func
(
ms
*
Server
)
EntryNotify
(
parent
uint64
,
name
string
)
Status
{
if
!
ms
.
kernelSettings
.
SupportsNotify
(
NOTIFY_INVAL_ENTRY
)
{
return
ENOSYS
}
req
:=
request
{
inHeader
:
&
InHeader
{
Opcode
:
_OP_NOTIFY_ENTRY
,
...
...
@@ -543,6 +550,26 @@ func (ms *Server) EntryNotify(parent uint64, name string) Status {
return
result
}
// SupportsVersion returns true if the kernel supports the given
// protocol version or newer.
func
(
in
*
InitIn
)
SupportsVersion
(
maj
,
min
uint32
)
bool
{
return
in
.
Major
>=
maj
&&
in
.
Minor
>=
min
}
// SupportsNotify returns whether a certain notification type is
// supported. Pass any of the NOTIFY_INVAL_* types as argument.
func
(
in
*
InitIn
)
SupportsNotify
(
notifyType
int
)
bool
{
switch
notifyType
{
case
NOTIFY_INVAL_ENTRY
:
return
in
.
SupportsVersion
(
7
,
12
)
case
NOTIFY_INVAL_INODE
:
return
in
.
SupportsVersion
(
7
,
12
)
case
NOTIFY_INVAL_DELETE
:
return
in
.
SupportsVersion
(
7
,
18
)
}
return
false
}
var
defaultBufferPool
BufferPool
func
init
()
{
...
...
fuse/types.go
View file @
3cf08068
...
...
@@ -341,13 +341,14 @@ type NotifyInvalDeleteOut struct {
}
const
(
NOTIFY_POLL
=
-
1
//
NOTIFY_POLL = -1
NOTIFY_INVAL_INODE
=
-
2
NOTIFY_INVAL_ENTRY
=
-
3
NOTIFY_STORE
=
-
4
NOTIFY_RETRIEVE
=
-
5
//
NOTIFY_STORE = -4
//
NOTIFY_RETRIEVE = -5
NOTIFY_INVAL_DELETE
=
-
6
NOTIFY_CODE_MAX
=
-
6
// NOTIFY_CODE_MAX = -6
)
type
FlushIn
struct
{
...
...
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