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
884812f5
Commit
884812f5
authored
Jul 06, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gofmt.
parent
e0de488a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
94 deletions
+93
-94
fuse/api.go
fuse/api.go
+2
-2
fuse/delete_test.go
fuse/delete_test.go
+5
-5
fuse/mountstate.go
fuse/mountstate.go
+1
-1
fuse/opcode.go
fuse/opcode.go
+75
-75
raw/types.go
raw/types.go
+10
-11
No files found.
fuse/api.go
View file @
884812f5
...
...
@@ -347,7 +347,7 @@ type DefaultRawFileSystem struct{}
// will give the correct result for Lstat (ENOENT), but the kernel
// will still issue file Open() on the inode.
type
RawFsInit
struct
{
InodeNotify
func
(
*
raw
.
NotifyInvalInodeOut
)
Status
EntryNotify
func
(
parent
uint64
,
name
string
)
Status
InodeNotify
func
(
*
raw
.
NotifyInvalInodeOut
)
Status
EntryNotify
func
(
parent
uint64
,
name
string
)
Status
DeleteNotify
func
(
parent
uint64
,
child
uint64
,
name
string
)
Status
}
fuse/delete_test.go
View file @
884812f5
...
...
@@ -26,7 +26,7 @@ func (f *flipNode) GetAttr(out *Attr, file File, c *Context) Status {
}
func
TestDeleteNotify
(
t
*
testing
.
T
)
{
dir
,
err
:=
ioutil
.
TempDir
(
""
,
""
)
dir
,
err
:=
ioutil
.
TempDir
(
""
,
""
)
if
err
!=
nil
{
t
.
Fatalf
(
"TempDir failed %v"
,
err
)
}
...
...
@@ -57,12 +57,12 @@ func TestDeleteNotify(t *testing.T) {
ch
.
FsNode
()
.
(
*
memNode
)
.
SetInode
(
nil
)
flip
:=
flipNode
{
memNode
:
ch
.
FsNode
()
.
(
*
memNode
),
ok
:
make
(
chan
int
),
ok
:
make
(
chan
int
),
}
newCh
:=
fs
.
Root
()
.
Inode
()
.
New
(
true
,
&
flip
)
fs
.
Root
()
.
Inode
()
.
AddChild
(
"testdir"
,
newCh
)
err
=
ioutil
.
WriteFile
(
mnt
+
"/testdir/testfile"
,
[]
byte
{
42
},
0644
)
err
=
ioutil
.
WriteFile
(
mnt
+
"/testdir/testfile"
,
[]
byte
{
42
},
0644
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
@@ -85,11 +85,11 @@ func TestDeleteNotify(t *testing.T) {
defer
func
()
{
cmd
.
Process
.
Kill
()
time
.
Sleep
(
100
*
time
.
Millisecond
)
time
.
Sleep
(
100
*
time
.
Millisecond
)
}()
// Wait until tail opened the file.
time
.
Sleep
(
100
*
time
.
Millisecond
)
time
.
Sleep
(
100
*
time
.
Millisecond
)
err
=
os
.
Remove
(
mnt
+
"/testdir/testfile"
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
fuse/mountstate.go
View file @
884812f5
...
...
@@ -459,7 +459,7 @@ func (ms *MountState) writeDeleteNotify(parent uint64, child uint64, name string
}
entry
:=
&
raw
.
NotifyInvalDeleteOut
{
Parent
:
parent
,
Child
:
child
,
Child
:
child
,
NameLen
:
uint32
(
len
(
name
)),
}
...
...
fuse/opcode.go
View file @
884812f5
...
...
@@ -57,8 +57,8 @@ const (
_OP_BATCH_FORGET
=
int32
(
42
)
// Ugh - what will happen if FUSE introduces a new opcode here?
_OP_NOTIFY_ENTRY
=
int32
(
51
)
_OP_NOTIFY_INODE
=
int32
(
52
)
_OP_NOTIFY_ENTRY
=
int32
(
51
)
_OP_NOTIFY_INODE
=
int32
(
52
)
_OP_NOTIFY_DELETE
=
int32
(
53
)
_OPCODE_COUNT
=
int32
(
54
)
...
...
@@ -412,73 +412,73 @@ func init() {
}
for
op
,
sz
:=
range
map
[
int32
]
uintptr
{
_OP_LOOKUP
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_GETATTR
:
unsafe
.
Sizeof
(
raw
.
AttrOut
{}),
_OP_SETATTR
:
unsafe
.
Sizeof
(
raw
.
AttrOut
{}),
_OP_SYMLINK
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_MKNOD
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_MKDIR
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_LINK
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_OPEN
:
unsafe
.
Sizeof
(
raw
.
OpenOut
{}),
_OP_WRITE
:
unsafe
.
Sizeof
(
raw
.
WriteOut
{}),
_OP_STATFS
:
unsafe
.
Sizeof
(
StatfsOut
{}),
_OP_GETXATTR
:
unsafe
.
Sizeof
(
raw
.
GetXAttrOut
{}),
_OP_LISTXATTR
:
unsafe
.
Sizeof
(
raw
.
GetXAttrOut
{}),
_OP_INIT
:
unsafe
.
Sizeof
(
raw
.
InitOut
{}),
_OP_OPENDIR
:
unsafe
.
Sizeof
(
raw
.
OpenOut
{}),
_OP_CREATE
:
unsafe
.
Sizeof
(
raw
.
CreateOut
{}),
_OP_BMAP
:
unsafe
.
Sizeof
(
raw
.
BmapOut
{}),
_OP_IOCTL
:
unsafe
.
Sizeof
(
raw
.
IoctlOut
{}),
_OP_POLL
:
unsafe
.
Sizeof
(
raw
.
PollOut
{}),
_OP_NOTIFY_ENTRY
:
unsafe
.
Sizeof
(
raw
.
NotifyInvalEntryOut
{}),
_OP_NOTIFY_INODE
:
unsafe
.
Sizeof
(
raw
.
NotifyInvalInodeOut
{}),
_OP_LOOKUP
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_GETATTR
:
unsafe
.
Sizeof
(
raw
.
AttrOut
{}),
_OP_SETATTR
:
unsafe
.
Sizeof
(
raw
.
AttrOut
{}),
_OP_SYMLINK
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_MKNOD
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_MKDIR
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_LINK
:
unsafe
.
Sizeof
(
raw
.
EntryOut
{}),
_OP_OPEN
:
unsafe
.
Sizeof
(
raw
.
OpenOut
{}),
_OP_WRITE
:
unsafe
.
Sizeof
(
raw
.
WriteOut
{}),
_OP_STATFS
:
unsafe
.
Sizeof
(
StatfsOut
{}),
_OP_GETXATTR
:
unsafe
.
Sizeof
(
raw
.
GetXAttrOut
{}),
_OP_LISTXATTR
:
unsafe
.
Sizeof
(
raw
.
GetXAttrOut
{}),
_OP_INIT
:
unsafe
.
Sizeof
(
raw
.
InitOut
{}),
_OP_OPENDIR
:
unsafe
.
Sizeof
(
raw
.
OpenOut
{}),
_OP_CREATE
:
unsafe
.
Sizeof
(
raw
.
CreateOut
{}),
_OP_BMAP
:
unsafe
.
Sizeof
(
raw
.
BmapOut
{}),
_OP_IOCTL
:
unsafe
.
Sizeof
(
raw
.
IoctlOut
{}),
_OP_POLL
:
unsafe
.
Sizeof
(
raw
.
PollOut
{}),
_OP_NOTIFY_ENTRY
:
unsafe
.
Sizeof
(
raw
.
NotifyInvalEntryOut
{}),
_OP_NOTIFY_INODE
:
unsafe
.
Sizeof
(
raw
.
NotifyInvalInodeOut
{}),
_OP_NOTIFY_DELETE
:
unsafe
.
Sizeof
(
raw
.
NotifyInvalDeleteOut
{}),
}
{
operationHandlers
[
op
]
.
OutputSize
=
sz
}
for
op
,
v
:=
range
map
[
int32
]
string
{
_OP_LOOKUP
:
"LOOKUP"
,
_OP_FORGET
:
"FORGET"
,
_OP_BATCH_FORGET
:
"BATCH_FORGET"
,
_OP_GETATTR
:
"GETATTR"
,
_OP_SETATTR
:
"SETATTR"
,
_OP_READLINK
:
"READLINK"
,
_OP_SYMLINK
:
"SYMLINK"
,
_OP_MKNOD
:
"MKNOD"
,
_OP_MKDIR
:
"MKDIR"
,
_OP_UNLINK
:
"UNLINK"
,
_OP_RMDIR
:
"RMDIR"
,
_OP_RENAME
:
"RENAME"
,
_OP_LINK
:
"LINK"
,
_OP_OPEN
:
"OPEN"
,
_OP_READ
:
"READ"
,
_OP_WRITE
:
"WRITE"
,
_OP_STATFS
:
"STATFS"
,
_OP_RELEASE
:
"RELEASE"
,
_OP_FSYNC
:
"FSYNC"
,
_OP_SETXATTR
:
"SETXATTR"
,
_OP_GETXATTR
:
"GETXATTR"
,
_OP_LISTXATTR
:
"LISTXATTR"
,
_OP_REMOVEXATTR
:
"REMOVEXATTR"
,
_OP_FLUSH
:
"FLUSH"
,
_OP_INIT
:
"INIT"
,
_OP_OPENDIR
:
"OPENDIR"
,
_OP_READDIR
:
"READDIR"
,
_OP_RELEASEDIR
:
"RELEASEDIR"
,
_OP_FSYNCDIR
:
"FSYNCDIR"
,
_OP_GETLK
:
"GETLK"
,
_OP_SETLK
:
"SETLK"
,
_OP_SETLKW
:
"SETLKW"
,
_OP_ACCESS
:
"ACCESS"
,
_OP_CREATE
:
"CREATE"
,
_OP_INTERRUPT
:
"INTERRUPT"
,
_OP_BMAP
:
"BMAP"
,
_OP_DESTROY
:
"DESTROY"
,
_OP_IOCTL
:
"IOCTL"
,
_OP_POLL
:
"POLL"
,
_OP_NOTIFY_ENTRY
:
"NOTIFY_ENTRY"
,
_OP_NOTIFY_INODE
:
"NOTIFY_INODE"
,
_OP_LOOKUP
:
"LOOKUP"
,
_OP_FORGET
:
"FORGET"
,
_OP_BATCH_FORGET
:
"BATCH_FORGET"
,
_OP_GETATTR
:
"GETATTR"
,
_OP_SETATTR
:
"SETATTR"
,
_OP_READLINK
:
"READLINK"
,
_OP_SYMLINK
:
"SYMLINK"
,
_OP_MKNOD
:
"MKNOD"
,
_OP_MKDIR
:
"MKDIR"
,
_OP_UNLINK
:
"UNLINK"
,
_OP_RMDIR
:
"RMDIR"
,
_OP_RENAME
:
"RENAME"
,
_OP_LINK
:
"LINK"
,
_OP_OPEN
:
"OPEN"
,
_OP_READ
:
"READ"
,
_OP_WRITE
:
"WRITE"
,
_OP_STATFS
:
"STATFS"
,
_OP_RELEASE
:
"RELEASE"
,
_OP_FSYNC
:
"FSYNC"
,
_OP_SETXATTR
:
"SETXATTR"
,
_OP_GETXATTR
:
"GETXATTR"
,
_OP_LISTXATTR
:
"LISTXATTR"
,
_OP_REMOVEXATTR
:
"REMOVEXATTR"
,
_OP_FLUSH
:
"FLUSH"
,
_OP_INIT
:
"INIT"
,
_OP_OPENDIR
:
"OPENDIR"
,
_OP_READDIR
:
"READDIR"
,
_OP_RELEASEDIR
:
"RELEASEDIR"
,
_OP_FSYNCDIR
:
"FSYNCDIR"
,
_OP_GETLK
:
"GETLK"
,
_OP_SETLK
:
"SETLK"
,
_OP_SETLKW
:
"SETLKW"
,
_OP_ACCESS
:
"ACCESS"
,
_OP_CREATE
:
"CREATE"
,
_OP_INTERRUPT
:
"INTERRUPT"
,
_OP_BMAP
:
"BMAP"
,
_OP_DESTROY
:
"DESTROY"
,
_OP_IOCTL
:
"IOCTL"
,
_OP_POLL
:
"POLL"
,
_OP_NOTIFY_ENTRY
:
"NOTIFY_ENTRY"
,
_OP_NOTIFY_INODE
:
"NOTIFY_INODE"
,
_OP_NOTIFY_DELETE
:
"NOTIFY_DELETE"
,
}
{
operationHandlers
[
op
]
.
Name
=
v
...
...
@@ -523,19 +523,19 @@ func init() {
// Outputs.
for
op
,
f
:=
range
map
[
int32
]
castPointerFunc
{
_OP_LOOKUP
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
EntryOut
)(
ptr
)
},
_OP_OPEN
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
OpenOut
)(
ptr
)
},
_OP_OPENDIR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
OpenOut
)(
ptr
)
},
_OP_GETATTR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
AttrOut
)(
ptr
)
},
_OP_CREATE
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
CreateOut
)(
ptr
)
},
_OP_LINK
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
EntryOut
)(
ptr
)
},
_OP_SETATTR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
AttrOut
)(
ptr
)
},
_OP_INIT
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
InitOut
)(
ptr
)
},
_OP_MKDIR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
EntryOut
)(
ptr
)
},
_OP_NOTIFY_ENTRY
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
NotifyInvalEntryOut
)(
ptr
)
},
_OP_NOTIFY_INODE
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
NotifyInvalInodeOut
)(
ptr
)
},
_OP_LOOKUP
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
EntryOut
)(
ptr
)
},
_OP_OPEN
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
OpenOut
)(
ptr
)
},
_OP_OPENDIR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
OpenOut
)(
ptr
)
},
_OP_GETATTR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
AttrOut
)(
ptr
)
},
_OP_CREATE
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
CreateOut
)(
ptr
)
},
_OP_LINK
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
EntryOut
)(
ptr
)
},
_OP_SETATTR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
AttrOut
)(
ptr
)
},
_OP_INIT
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
InitOut
)(
ptr
)
},
_OP_MKDIR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
EntryOut
)(
ptr
)
},
_OP_NOTIFY_ENTRY
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
NotifyInvalEntryOut
)(
ptr
)
},
_OP_NOTIFY_INODE
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
NotifyInvalInodeOut
)(
ptr
)
},
_OP_NOTIFY_DELETE
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
raw
.
NotifyInvalDeleteOut
)(
ptr
)
},
_OP_STATFS
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
StatfsOut
)(
ptr
)
},
_OP_STATFS
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
StatfsOut
)(
ptr
)
},
}
{
operationHandlers
[
op
]
.
DecodeOut
=
f
}
...
...
raw/types.go
View file @
884812f5
...
...
@@ -298,22 +298,21 @@ type NotifyInvalEntryOut struct {
Padding
uint32
}
type
NotifyInvalDeleteOut
struct
{
Parent
uint64
;
Child
uint64
;
NameLen
uint32
;
Padding
uint32
;
Parent
uint64
Child
uint64
NameLen
uint32
Padding
uint32
}
const
(
NOTIFY_POLL
=
-
1
NOTIFY_INVAL_INODE
=
-
2
NOTIFY_INVAL_ENTRY
=
-
3
NOTIFY_STORE
=
-
4
NOTIFY_RETRIEVE
=
-
5
NOTIFY_POLL
=
-
1
NOTIFY_INVAL_INODE
=
-
2
NOTIFY_INVAL_ENTRY
=
-
3
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