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
6dae0ec7
Commit
6dae0ec7
authored
Apr 17, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: prefix Node interface names with Node
parent
2851c510
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
145 additions
and
146 deletions
+145
-146
benchmark/statfs.go
benchmark/statfs.go
+1
-1
example/hello/main.go
example/hello/main.go
+2
-2
newunionfs/unionfs.go
newunionfs/unionfs.go
+10
-10
nodefs/api.go
nodefs/api.go
+50
-51
nodefs/bridge.go
nodefs/bridge.go
+38
-38
nodefs/cache_test.go
nodefs/cache_test.go
+4
-4
nodefs/directio_test.go
nodefs/directio_test.go
+1
-1
nodefs/interrupt_test.go
nodefs/interrupt_test.go
+2
-2
nodefs/loopback.go
nodefs/loopback.go
+22
-22
nodefs/mem.go
nodefs/mem.go
+6
-6
nodefs/zip_test.go
nodefs/zip_test.go
+3
-3
zipfs/multizip.go
zipfs/multizip.go
+2
-2
zipfs/zipfs.go
zipfs/zipfs.go
+4
-4
No files found.
benchmark/statfs.go
View file @
6dae0ec7
...
...
@@ -20,7 +20,7 @@ type StatFS struct {
files
map
[
string
]
fuse
.
Attr
}
var
_
=
(
nodefs
.
OnAdder
)((
*
StatFS
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
StatFS
)(
nil
))
func
(
r
*
StatFS
)
OnAdd
(
ctx
context
.
Context
)
{
for
nm
,
a
:=
range
r
.
files
{
...
...
example/hello/main.go
View file @
6dae0ec7
...
...
@@ -36,8 +36,8 @@ func (r *HelloRoot) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fuse
return
0
}
var
_
=
(
nodefs
.
Getattrer
)((
*
HelloRoot
)(
nil
))
var
_
=
(
nodefs
.
OnAdder
)((
*
HelloRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
Getattrer
)((
*
HelloRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
HelloRoot
)(
nil
))
func
main
()
{
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"print debug data"
)
...
...
newunionfs/unionfs.go
View file @
6dae0ec7
...
...
@@ -102,7 +102,7 @@ func (n *unionFSNode) root() *unionFSRoot {
return
n
.
Root
()
.
Operations
()
.
(
*
unionFSRoot
)
}
var
_
=
(
nodefs
.
Setattrer
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Setattrer
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Setattr
(
ctx
context
.
Context
,
fh
nodefs
.
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
if
errno
:=
n
.
promote
();
errno
!=
0
{
...
...
@@ -183,7 +183,7 @@ func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fus
return
0
}
var
_
=
(
nodefs
.
Creater
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Creater
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Create
(
ctx
context
.
Context
,
name
string
,
flags
uint32
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
*
nodefs
.
Inode
,
nodefs
.
FileHandle
,
uint32
,
syscall
.
Errno
)
{
if
n
.
IsRoot
()
&&
name
==
delDir
{
...
...
@@ -223,7 +223,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod
return
ch
,
nodefs
.
NewLoopbackFile
(
fd
),
0
,
0
}
var
_
=
(
nodefs
.
Opener
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Opener
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
nodefs
.
FileHandle
,
uint32
,
syscall
.
Errno
)
{
isWR
:=
(
flags
&
syscall
.
O_RDWR
!=
0
)
||
(
flags
&
syscall
.
O_WRONLY
!=
0
)
...
...
@@ -245,7 +245,7 @@ func (n *unionFSNode) Open(ctx context.Context, flags uint32) (nodefs.FileHandle
return
nodefs
.
NewLoopbackFile
(
fd
),
0
,
0
}
var
_
=
(
nodefs
.
Getattrer
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Getattrer
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Getattr
(
ctx
context
.
Context
,
fh
nodefs
.
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
var
st
syscall
.
Stat_t
...
...
@@ -258,7 +258,7 @@ func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fu
return
0
}
var
_
=
(
nodefs
.
Lookuper
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Lookuper
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
nodefs
.
Inode
,
syscall
.
Errno
)
{
if
n
.
IsRoot
()
&&
name
==
delDir
{
...
...
@@ -279,19 +279,19 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu
return
nil
,
syscall
.
ENOENT
}
var
_
=
(
nodefs
.
Unlinker
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Unlinker
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Unlink
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
return
n
.
root
()
.
delPath
(
filepath
.
Join
(
n
.
Path
(
nil
),
name
))
}
var
_
=
(
nodefs
.
Rmdirer
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Rmdirer
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Rmdir
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
return
n
.
root
()
.
delPath
(
filepath
.
Join
(
n
.
Path
(
nil
),
name
))
}
var
_
=
(
nodefs
.
Symlinker
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Symlinker
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
nodefs
.
Inode
,
syscall
.
Errno
)
{
n
.
promote
()
...
...
@@ -316,7 +316,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus
return
ch
,
0
}
var
_
=
(
nodefs
.
Readlinker
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Readlinker
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
nm
,
idx
:=
n
.
getBranch
(
nil
)
...
...
@@ -330,7 +330,7 @@ func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
return
buf
[
:
count
],
0
}
var
_
=
(
nodefs
.
Readdirer
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Readdirer
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Readdir
(
ctx
context
.
Context
)
(
nodefs
.
DirStream
,
syscall
.
Errno
)
{
root
:=
n
.
root
()
...
...
nodefs/api.go
View file @
6dae0ec7
This diff is collapsed.
Click to expand it.
nodefs/bridge.go
View file @
6dae0ec7
This diff is collapsed.
Click to expand it.
nodefs/cache_test.go
View file @
6dae0ec7
...
...
@@ -25,9 +25,9 @@ type keepCacheFile struct {
count
int
}
var
_
=
(
Reader
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Opener
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Getattrer
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Node
Reader
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
keepCacheFile
)(
nil
))
func
(
f
*
keepCacheFile
)
setContent
(
delta
int
)
{
f
.
mu
.
Lock
()
...
...
@@ -69,7 +69,7 @@ type keepCacheRoot struct {
keep
,
nokeep
*
keepCacheFile
}
var
_
=
(
OnAdder
)((
*
keepCacheRoot
)(
nil
))
var
_
=
(
Node
OnAdder
)((
*
keepCacheRoot
)(
nil
))
func
(
r
*
keepCacheRoot
)
OnAdd
(
ctx
context
.
Context
)
{
i
:=
&
r
.
Inode
...
...
nodefs/directio_test.go
View file @
6dae0ec7
...
...
@@ -46,7 +46,7 @@ type dioFile struct {
Inode
}
var
_
=
(
Opener
)((
*
dioFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
dioFile
)(
nil
))
func
(
f
*
dioFile
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
return
&
dioFH
{},
fuse
.
FOPEN_DIRECT_IO
,
OK
...
...
nodefs/interrupt_test.go
View file @
6dae0ec7
...
...
@@ -19,7 +19,7 @@ type interruptRoot struct {
child
interruptOps
}
var
_
=
(
Lookuper
)((
*
interruptRoot
)(
nil
))
var
_
=
(
Node
Lookuper
)((
*
interruptRoot
)(
nil
))
func
(
r
*
interruptRoot
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
if
name
!=
"file"
{
...
...
@@ -37,7 +37,7 @@ type interruptOps struct {
interrupted
bool
}
var
_
=
(
Opener
)((
*
interruptOps
)(
nil
))
var
_
=
(
Node
Opener
)((
*
interruptOps
)(
nil
))
func
(
o
*
interruptOps
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
FileHandle
,
uint32
,
syscall
.
Errno
)
{
select
{
...
...
nodefs/loopback.go
View file @
6dae0ec7
...
...
@@ -24,26 +24,26 @@ type loopbackNode struct {
Inode
}
var
_
=
(
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Getattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Getxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Setxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Removexattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Listxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Readlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Opener
)((
*
loopbackNode
)(
nil
))
var
_
=
(
CopyFileRanger
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Lookuper
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Opendirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Readdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Mkdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Mknoder
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Linker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Symlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Unlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Rmdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Renamer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Getxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Setxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Removexattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Listxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Readlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Opener
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
CopyFileRanger
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Lookuper
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Opendirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Readdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Mkdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Mknoder
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Linker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Symlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Unlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Rmdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Renamer
)((
*
loopbackNode
)(
nil
))
func
(
n
*
loopbackNode
)
Statfs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
{
s
:=
syscall
.
Statfs_t
{}
...
...
@@ -181,7 +181,7 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) StableAttr {
}
}
var
_
=
(
Creater
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Creater
)((
*
loopbackNode
)(
nil
))
func
(
n
*
loopbackNode
)
Create
(
ctx
context
.
Context
,
name
string
,
flags
uint32
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
inode
*
Inode
,
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
p
:=
filepath
.
Join
(
n
.
path
(),
name
)
...
...
@@ -298,7 +298,7 @@ func (n *loopbackNode) Getattr(ctx context.Context, f FileHandle, out *fuse.Attr
return
OK
}
var
_
=
(
Setattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Setattrer
)((
*
loopbackNode
)(
nil
))
func
(
n
*
loopbackNode
)
Setattr
(
ctx
context
.
Context
,
f
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
p
:=
n
.
path
()
...
...
nodefs/mem.go
View file @
6dae0ec7
...
...
@@ -20,9 +20,9 @@ type MemRegularFile struct {
Attr
fuse
.
Attr
}
var
_
=
(
Opener
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Reader
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Flusher
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Reader
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Flusher
)((
*
MemRegularFile
)(
nil
))
func
(
f
*
MemRegularFile
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
if
flags
&
(
syscall
.
O_RDWR
)
!=
0
||
flags
&
syscall
.
O_WRONLY
!=
0
{
...
...
@@ -32,7 +32,7 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle,
return
nil
,
fuse
.
FOPEN_KEEP_CACHE
,
OK
}
var
_
=
(
Getattrer
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
MemRegularFile
)(
nil
))
func
(
f
*
MemRegularFile
)
Getattr
(
ctx
context
.
Context
,
fh
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
out
.
Attr
=
f
.
Attr
...
...
@@ -59,13 +59,13 @@ type MemSymlink struct {
Data
[]
byte
}
var
_
=
(
Readlinker
)((
*
MemSymlink
)(
nil
))
var
_
=
(
Node
Readlinker
)((
*
MemSymlink
)(
nil
))
func
(
l
*
MemSymlink
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
return
l
.
Data
,
OK
}
var
_
=
(
Getattrer
)((
*
MemSymlink
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
MemSymlink
)(
nil
))
func
(
l
*
MemSymlink
)
Getattr
(
ctx
context
.
Context
,
fh
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
out
.
Attr
=
l
.
Attr
...
...
nodefs/zip_test.go
View file @
6dae0ec7
...
...
@@ -129,8 +129,8 @@ type zipFile struct {
data
[]
byte
}
var
_
=
(
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
Getattrer
)((
*
zipFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
zipFile
)(
nil
))
// Getattr sets the minimum, which is the size. A more full-featured
// FS would also set timestamps and permissions.
...
...
@@ -179,7 +179,7 @@ type zipRoot struct {
zr
*
zip
.
Reader
}
var
_
=
(
OnAdder
)((
*
zipRoot
)(
nil
))
var
_
=
(
Node
OnAdder
)((
*
zipRoot
)(
nil
))
func
(
zr
*
zipRoot
)
OnAdd
(
ctx
context
.
Context
)
{
// OnAdd is called once we are attached to an Inode. We can
...
...
zipfs/multizip.go
View file @
6dae0ec7
...
...
@@ -38,8 +38,8 @@ type configRoot struct {
nodefs
.
Inode
}
var
_
=
(
nodefs
.
Unlinker
)((
*
configRoot
)(
nil
))
var
_
=
(
nodefs
.
Symlinker
)((
*
configRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
Unlinker
)((
*
configRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
Symlinker
)((
*
configRoot
)(
nil
))
func
(
r
*
configRoot
)
Unlink
(
ctx
context
.
Context
,
basename
string
)
syscall
.
Errno
{
if
r
.
GetChild
(
basename
)
==
nil
{
...
...
zipfs/zipfs.go
View file @
6dae0ec7
...
...
@@ -25,7 +25,7 @@ type zipRoot struct {
zr
*
zip
.
ReadCloser
}
var
_
=
(
nodefs
.
OnAdder
)((
*
zipRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
zipRoot
)(
nil
))
func
(
zr
*
zipRoot
)
OnAdd
(
ctx
context
.
Context
)
{
for
_
,
f
:=
range
zr
.
zr
.
File
{
...
...
@@ -72,8 +72,8 @@ type zipFile struct {
data
[]
byte
}
var
_
=
(
nodefs
.
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
nodefs
.
Getattrer
)((
*
zipFile
)(
nil
))
var
_
=
(
nodefs
.
Node
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
nodefs
.
Node
Getattrer
)((
*
zipFile
)(
nil
))
// Getattr sets the minimum, which is the size. A more full-featured
// FS would also set timestamps and permissions.
...
...
@@ -120,7 +120,7 @@ func (zf *zipFile) Read(ctx context.Context, f nodefs.FileHandle, dest []byte, o
return
fuse
.
ReadResultData
(
zf
.
data
[
off
:
end
]),
0
}
var
_
=
(
nodefs
.
OnAdder
)((
*
zipRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
zipRoot
)(
nil
))
func
NewArchiveFileSystem
(
name
string
)
(
root
nodefs
.
InodeEmbedder
,
err
error
)
{
switch
{
...
...
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