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
Show 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 {
...
@@ -20,7 +20,7 @@ type StatFS struct {
files
map
[
string
]
fuse
.
Attr
files
map
[
string
]
fuse
.
Attr
}
}
var
_
=
(
nodefs
.
OnAdder
)((
*
StatFS
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
StatFS
)(
nil
))
func
(
r
*
StatFS
)
OnAdd
(
ctx
context
.
Context
)
{
func
(
r
*
StatFS
)
OnAdd
(
ctx
context
.
Context
)
{
for
nm
,
a
:=
range
r
.
files
{
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
...
@@ -36,8 +36,8 @@ func (r *HelloRoot) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fuse
return
0
return
0
}
}
var
_
=
(
nodefs
.
Getattrer
)((
*
HelloRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
Getattrer
)((
*
HelloRoot
)(
nil
))
var
_
=
(
nodefs
.
OnAdder
)((
*
HelloRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
HelloRoot
)(
nil
))
func
main
()
{
func
main
()
{
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"print debug data"
)
debug
:=
flag
.
Bool
(
"debug"
,
false
,
"print debug data"
)
...
...
newunionfs/unionfs.go
View file @
6dae0ec7
...
@@ -102,7 +102,7 @@ func (n *unionFSNode) root() *unionFSRoot {
...
@@ -102,7 +102,7 @@ func (n *unionFSNode) root() *unionFSRoot {
return
n
.
Root
()
.
Operations
()
.
(
*
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
{
func
(
n
*
unionFSNode
)
Setattr
(
ctx
context
.
Context
,
fh
nodefs
.
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
if
errno
:=
n
.
promote
();
errno
!=
0
{
if
errno
:=
n
.
promote
();
errno
!=
0
{
...
@@ -183,7 +183,7 @@ func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fus
...
@@ -183,7 +183,7 @@ func (n *unionFSNode) Setattr(ctx context.Context, fh nodefs.FileHandle, in *fus
return
0
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
)
{
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
{
if
n
.
IsRoot
()
&&
name
==
delDir
{
...
@@ -223,7 +223,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod
...
@@ -223,7 +223,7 @@ func (n *unionFSNode) Create(ctx context.Context, name string, flags uint32, mod
return
ch
,
nodefs
.
NewLoopbackFile
(
fd
),
0
,
0
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
)
{
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
)
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
...
@@ -245,7 +245,7 @@ func (n *unionFSNode) Open(ctx context.Context, flags uint32) (nodefs.FileHandle
return
nodefs
.
NewLoopbackFile
(
fd
),
0
,
0
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
{
func
(
n
*
unionFSNode
)
Getattr
(
ctx
context
.
Context
,
fh
nodefs
.
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
var
st
syscall
.
Stat_t
var
st
syscall
.
Stat_t
...
@@ -258,7 +258,7 @@ func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fu
...
@@ -258,7 +258,7 @@ func (n *unionFSNode) Getattr(ctx context.Context, fh nodefs.FileHandle, out *fu
return
0
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
)
{
func
(
n
*
unionFSNode
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
nodefs
.
Inode
,
syscall
.
Errno
)
{
if
n
.
IsRoot
()
&&
name
==
delDir
{
if
n
.
IsRoot
()
&&
name
==
delDir
{
...
@@ -279,19 +279,19 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu
...
@@ -279,19 +279,19 @@ func (n *unionFSNode) Lookup(ctx context.Context, name string, out *fuse.EntryOu
return
nil
,
syscall
.
ENOENT
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
{
func
(
n
*
unionFSNode
)
Unlink
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
return
n
.
root
()
.
delPath
(
filepath
.
Join
(
n
.
Path
(
nil
),
name
))
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
{
func
(
n
*
unionFSNode
)
Rmdir
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
return
n
.
root
()
.
delPath
(
filepath
.
Join
(
n
.
Path
(
nil
),
name
))
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
)
{
func
(
n
*
unionFSNode
)
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
nodefs
.
Inode
,
syscall
.
Errno
)
{
n
.
promote
()
n
.
promote
()
...
@@ -316,7 +316,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus
...
@@ -316,7 +316,7 @@ func (n *unionFSNode) Symlink(ctx context.Context, target, name string, out *fus
return
ch
,
0
return
ch
,
0
}
}
var
_
=
(
nodefs
.
Readlinker
)((
*
unionFSNode
)(
nil
))
var
_
=
(
nodefs
.
Node
Readlinker
)((
*
unionFSNode
)(
nil
))
func
(
n
*
unionFSNode
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
func
(
n
*
unionFSNode
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
nm
,
idx
:=
n
.
getBranch
(
nil
)
nm
,
idx
:=
n
.
getBranch
(
nil
)
...
@@ -330,7 +330,7 @@ func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
...
@@ -330,7 +330,7 @@ func (n *unionFSNode) Readlink(ctx context.Context) ([]byte, syscall.Errno) {
return
buf
[
:
count
],
0
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
)
{
func
(
n
*
unionFSNode
)
Readdir
(
ctx
context
.
Context
)
(
nodefs
.
DirStream
,
syscall
.
Errno
)
{
root
:=
n
.
root
()
root
:=
n
.
root
()
...
...
nodefs/api.go
View file @
6dae0ec7
...
@@ -68,7 +68,9 @@
...
@@ -68,7 +68,9 @@
// inspired on the system call names, so we have Listxattr rather than
// inspired on the system call names, so we have Listxattr rather than
// ListXAttr.
// ListXAttr.
//
//
// Locks for networked filesystems are supported through the suite of
// Getlk, Setlk and Setlkw methods. They alllow locks on regions of
// regular files.
package
nodefs
package
nodefs
import
(
import
(
...
@@ -100,7 +102,7 @@ type InodeEmbedder interface {
...
@@ -100,7 +102,7 @@ type InodeEmbedder interface {
// Inode. If not defined, the `out` argument will zeroed with an OK
// Inode. If not defined, the `out` argument will zeroed with an OK
// result. This is because OSX filesystems must Statfs, or the mount
// result. This is because OSX filesystems must Statfs, or the mount
// will not work.
// will not work.
type
Statfser
interface
{
type
Node
Statfser
interface
{
Statfs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
Statfs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
}
}
...
@@ -116,24 +118,24 @@ type Statfser interface {
...
@@ -116,24 +118,24 @@ type Statfser interface {
// is necessary to either return permissions from GetAttr/Lookup or
// is necessary to either return permissions from GetAttr/Lookup or
// set Options.DefaultPermissions in order to allow chdir into the
// set Options.DefaultPermissions in order to allow chdir into the
// FUSE mount.
// FUSE mount.
type
Accesser
interface
{
type
Node
Accesser
interface
{
Access
(
ctx
context
.
Context
,
mask
uint32
)
syscall
.
Errno
Access
(
ctx
context
.
Context
,
mask
uint32
)
syscall
.
Errno
}
}
// GetAttr reads attributes for an Inode. The library will
// GetAttr reads attributes for an Inode. The library will
// ensure that Mode and Ino are set correctly. For regular
// ensure that Mode and Ino are set correctly. For regular
// files, Size should be set so it can be read correctly.
// files, Size should be set so it can be read correctly.
type
Getattrer
interface
{
type
Node
Getattrer
interface
{
Getattr
(
ctx
context
.
Context
,
f
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
Getattr
(
ctx
context
.
Context
,
f
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
}
}
// SetAttr sets attributes for an Inode.
// SetAttr sets attributes for an Inode.
type
Setattrer
interface
{
type
Node
Setattrer
interface
{
Setattr
(
ctx
context
.
Context
,
f
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
Setattr
(
ctx
context
.
Context
,
f
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
}
}
// OnAdd is called when this InodeEmbedder is initialized.
// OnAdd is called when this InodeEmbedder is initialized.
type
OnAdder
interface
{
type
Node
OnAdder
interface
{
OnAdd
(
ctx
context
.
Context
)
OnAdd
(
ctx
context
.
Context
)
}
}
...
@@ -141,20 +143,20 @@ type OnAdder interface {
...
@@ -141,20 +143,20 @@ type OnAdder interface {
// `dest` and return the number of bytes. If `dest` is too
// `dest` and return the number of bytes. If `dest` is too
// small, it should return ERANGE and the size of the attribute.
// small, it should return ERANGE and the size of the attribute.
// If not defined, Getxattr will return ENOATTR.
// If not defined, Getxattr will return ENOATTR.
type
Getxattrer
interface
{
type
Node
Getxattrer
interface
{
Getxattr
(
ctx
context
.
Context
,
attr
string
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
Getxattr
(
ctx
context
.
Context
,
attr
string
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
}
}
// Setxattr should store data for the given attribute. See
// Setxattr should store data for the given attribute. See
// setxattr(2) for information about flags.
// setxattr(2) for information about flags.
// If not defined, Setxattr will return ENOATTR.
// If not defined, Setxattr will return ENOATTR.
type
Setxattrer
interface
{
type
Node
Setxattrer
interface
{
Setxattr
(
ctx
context
.
Context
,
attr
string
,
data
[]
byte
,
flags
uint32
)
syscall
.
Errno
Setxattr
(
ctx
context
.
Context
,
attr
string
,
data
[]
byte
,
flags
uint32
)
syscall
.
Errno
}
}
// Removexattr should delete the given attribute.
// Removexattr should delete the given attribute.
// If not defined, Removexattr will return ENOATTR.
// If not defined, Removexattr will return ENOATTR.
type
Removexattrer
interface
{
type
Node
Removexattrer
interface
{
Removexattr
(
ctx
context
.
Context
,
attr
string
)
syscall
.
Errno
Removexattr
(
ctx
context
.
Context
,
attr
string
)
syscall
.
Errno
}
}
...
@@ -162,18 +164,18 @@ type Removexattrer interface {
...
@@ -162,18 +164,18 @@ type Removexattrer interface {
// `dest`. If the `dest` buffer is too small, it should return ERANGE
// `dest`. If the `dest` buffer is too small, it should return ERANGE
// and the correct size. If not defined, return an empty list and
// and the correct size. If not defined, return an empty list and
// success.
// success.
type
Listxattrer
interface
{
type
Node
Listxattrer
interface
{
Listxattr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
Listxattr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
}
}
// Readlink reads the content of a symlink.
// Readlink reads the content of a symlink.
type
Readlinker
interface
{
type
Node
Readlinker
interface
{
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
}
}
// Open opens an Inode (of regular file type) for reading. It
// Open opens an Inode (of regular file type) for reading. It
// is optional but recommended to return a FileHandle.
// is optional but recommended to return a FileHandle.
type
Opener
interface
{
type
Node
Opener
interface
{
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
}
}
...
@@ -182,20 +184,20 @@ type Opener interface {
...
@@ -182,20 +184,20 @@ type Opener interface {
// `dest` buffer. If the file was opened without FileHandle,
// `dest` buffer. If the file was opened without FileHandle,
// the FileHandle argument here is nil. The default
// the FileHandle argument here is nil. The default
// implementation forwards to the FileHandle.
// implementation forwards to the FileHandle.
type
Reader
interface
{
type
Node
Reader
interface
{
Read
(
ctx
context
.
Context
,
f
FileHandle
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
Read
(
ctx
context
.
Context
,
f
FileHandle
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
}
}
// Writes the data into the file handle at given offset. After
// Writes the data into the file handle at given offset. After
// returning, the data will be reused and may not referenced.
// returning, the data will be reused and may not referenced.
// The default implementation forwards to the FileHandle.
// The default implementation forwards to the FileHandle.
type
Writer
interface
{
type
Node
Writer
interface
{
Write
(
ctx
context
.
Context
,
f
FileHandle
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
Write
(
ctx
context
.
Context
,
f
FileHandle
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
}
}
// Fsync is a signal to ensure writes to the Inode are flushed
// Fsync is a signal to ensure writes to the Inode are flushed
// to stable storage.
// to stable storage.
type
Fsyncer
interface
{
type
Node
Fsyncer
interface
{
Fsync
(
ctx
context
.
Context
,
f
FileHandle
,
flags
uint32
)
syscall
.
Errno
Fsync
(
ctx
context
.
Context
,
f
FileHandle
,
flags
uint32
)
syscall
.
Errno
}
}
...
@@ -203,28 +205,28 @@ type Fsyncer interface {
...
@@ -203,28 +205,28 @@ type Fsyncer interface {
// case of duplicated descriptor, it may be called more than
// case of duplicated descriptor, it may be called more than
// once for a file. The default implementation forwards to the
// once for a file. The default implementation forwards to the
// FileHandle.
// FileHandle.
type
Flusher
interface
{
type
Node
Flusher
interface
{
Flush
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
Flush
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
}
}
// This is called to before
the file h
andle is forgotten. The
// This is called to before
a FileH
andle is forgotten. The
// kernel ignores the return value of this method,
// kernel ignores the return value of this method,
// so any cleanup that requires specific synchronization or
// so any cleanup that requires specific synchronization or
// could fail with I/O errors should happen in Flush instead.
// could fail with I/O errors should happen in Flush instead.
// The default implementation forwards to the FileHandle.
// The default implementation forwards to the FileHandle.
type
Releaser
interface
{
type
Node
Releaser
interface
{
Release
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
Release
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
}
}
// Allocate preallocates space for future writes, so they will
// Allocate preallocates space for future writes, so they will
// never encounter ESPACE.
// never encounter ESPACE.
type
Allocater
interface
{
type
Node
Allocater
interface
{
Allocate
(
ctx
context
.
Context
,
f
FileHandle
,
off
uint64
,
size
uint64
,
mode
uint32
)
syscall
.
Errno
Allocate
(
ctx
context
.
Context
,
f
FileHandle
,
off
uint64
,
size
uint64
,
mode
uint32
)
syscall
.
Errno
}
}
// CopyFileRange copies data between sections of two files,
// CopyFileRange copies data between sections of two files,
// without the data having to pass through the calling process.
// without the data having to pass through the calling process.
type
CopyFileRanger
interface
{
type
Node
CopyFileRanger
interface
{
CopyFileRange
(
ctx
context
.
Context
,
fhIn
FileHandle
,
CopyFileRange
(
ctx
context
.
Context
,
fhIn
FileHandle
,
offIn
uint64
,
out
*
Inode
,
fhOut
FileHandle
,
offOut
uint64
,
offIn
uint64
,
out
*
Inode
,
fhOut
FileHandle
,
offOut
uint64
,
len
uint64
,
flags
uint64
)
(
uint32
,
syscall
.
Errno
)
len
uint64
,
flags
uint64
)
(
uint32
,
syscall
.
Errno
)
...
@@ -233,29 +235,28 @@ type CopyFileRanger interface {
...
@@ -233,29 +235,28 @@ type CopyFileRanger interface {
// Lseek is used to implement holes: it should return the
// Lseek is used to implement holes: it should return the
// first offset beyond `off` where there is data (SEEK_DATA)
// first offset beyond `off` where there is data (SEEK_DATA)
// or where there is a hole (SEEK_HOLE).
// or where there is a hole (SEEK_HOLE).
type
Lseeker
interface
{
type
Node
Lseeker
interface
{
Lseek
(
ctx
context
.
Context
,
f
FileHandle
,
Off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
Lseek
(
ctx
context
.
Context
,
f
FileHandle
,
Off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
}
}
// LockOperations are operations for locking regions of regular files.
// Getlk returns locks that would conflict with the given input
// Getlk returns locks that would conflict with the given input
// lock. If no locks conflict, the output has type L_UNLCK. See
// lock. If no locks conflict, the output has type L_UNLCK. See
// fcntl(2) for more information.
// fcntl(2) for more information.
// If not defined, returns ENOTSUP
// If not defined, returns ENOTSUP
type
Getlker
interface
{
type
Node
Getlker
interface
{
Getlk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
syscall
.
Errno
Getlk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
syscall
.
Errno
}
}
// Setlk obtains a lock on a file, or fail if the lock could not
// Setlk obtains a lock on a file, or fail if the lock could not
// obtained. See fcntl(2) for more information. If not defined,
// obtained. See fcntl(2) for more information. If not defined,
// returns ENOTSUP
// returns ENOTSUP
type
Setlker
interface
{
type
Node
Setlker
interface
{
Setlk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
Setlk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
}
}
// Setlkw obtains a lock on a file, waiting if necessary. See fcntl(2)
// Setlkw obtains a lock on a file, waiting if necessary. See fcntl(2)
// for more information. If not defined, returns ENOTSUP
// for more information. If not defined, returns ENOTSUP
type
Setlkwer
interface
{
type
Node
Setlkwer
interface
{
Setlkw
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
Setlkw
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
}
}
...
@@ -285,7 +286,7 @@ type DirStream interface {
...
@@ -285,7 +286,7 @@ type DirStream interface {
//
//
// If not defined, we look for an existing child with the given name,
// If not defined, we look for an existing child with the given name,
// or returns ENOENT.
// or returns ENOENT.
type
Lookuper
interface
{
type
Node
Lookuper
interface
{
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
}
}
...
@@ -293,7 +294,7 @@ type Lookuper interface {
...
@@ -293,7 +294,7 @@ type Lookuper interface {
// contents. The actual reading is driven from ReadDir, so
// contents. The actual reading is driven from ReadDir, so
// this method is just for performing sanity/permission
// this method is just for performing sanity/permission
// checks. The default is to return success.
// checks. The default is to return success.
type
Opendirer
interface
{
type
Node
Opendirer
interface
{
Opendir
(
ctx
context
.
Context
)
syscall
.
Errno
Opendir
(
ctx
context
.
Context
)
syscall
.
Errno
}
}
...
@@ -301,31 +302,31 @@ type Opendirer interface {
...
@@ -301,31 +302,31 @@ type Opendirer interface {
//
//
// The default ReadDir returns the list of currently known children
// The default ReadDir returns the list of currently known children
// from the tree
// from the tree
type
Readdirer
interface
{
type
Node
Readdirer
interface
{
Readdir
(
ctx
context
.
Context
)
(
DirStream
,
syscall
.
Errno
)
Readdir
(
ctx
context
.
Context
)
(
DirStream
,
syscall
.
Errno
)
}
}
// Mkdir is similar to Lookup, but must create a directory entry and Inode.
// Mkdir is similar to Lookup, but must create a directory entry and Inode.
// Default is to return EROFS.
// Default is to return EROFS.
type
Mkdirer
interface
{
type
Node
Mkdirer
interface
{
Mkdir
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
Mkdir
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
}
}
// Mknod is similar to Lookup, but must create a device entry and Inode.
// Mknod is similar to Lookup, but must create a device entry and Inode.
// Default is to return EROFS.
// Default is to return EROFS.
type
Mknoder
interface
{
type
Node
Mknoder
interface
{
Mknod
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
dev
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
Mknod
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
dev
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
}
}
// Link is similar to Lookup, but must create a new link to an existing Inode.
// Link is similar to Lookup, but must create a new link to an existing Inode.
// Default is to return EROFS.
// Default is to return EROFS.
type
Linker
interface
{
type
Node
Linker
interface
{
Link
(
ctx
context
.
Context
,
target
InodeEmbedder
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
Link
(
ctx
context
.
Context
,
target
InodeEmbedder
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
}
}
// Symlink is similar to Lookup, but must create a new symbolic link.
// Symlink is similar to Lookup, but must create a new symbolic link.
// Default is to return EROFS.
// Default is to return EROFS.
type
Symlinker
interface
{
type
Node
Symlinker
interface
{
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
}
}
...
@@ -333,28 +334,27 @@ type Symlinker interface {
...
@@ -333,28 +334,27 @@ type Symlinker interface {
// child. It typically also returns a FileHandle as a
// child. It typically also returns a FileHandle as a
// reference for future reads/writes.
// reference for future reads/writes.
// Default is to return EROFS.
// Default is to return EROFS.
type
Creater
interface
{
type
Node
Creater
interface
{
Create
(
ctx
context
.
Context
,
name
string
,
flags
uint32
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
Create
(
ctx
context
.
Context
,
name
string
,
flags
uint32
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
}
}
// Unlink should remove a child from this directory. If the
// Unlink should remove a child from this directory. If the
// return status is OK, the Inode is removed as child in the
// return status is OK, the Inode is removed as child in the
// FS tree automatically. Default is to return EROFS.
// FS tree automatically. Default is to return EROFS.
type
Unlinker
interface
{
type
Node
Unlinker
interface
{
Unlink
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
Unlink
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
}
}
// Rmdir is like Unlink but for directories.
// Rmdir is like Unlink but for directories.
// Default is to return EROFS.
// Default is to return EROFS.
type
Rmdirer
interface
{
type
Node
Rmdirer
interface
{
Rmdir
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
Rmdir
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
}
}
// Rename should move a child from one directory to a different
// Rename should move a child from one directory to a different
// one. The change is effected in the FS tree if the return status is
// one. The change is effected in the FS tree if the return status is
// OK.
// OK. Default is to return EROFS.
// Default is to return EROFS.
type
NodeRenamer
interface
{
type
Renamer
interface
{
Rename
(
ctx
context
.
Context
,
name
string
,
newParent
InodeEmbedder
,
newName
string
,
flags
uint32
)
syscall
.
Errno
Rename
(
ctx
context
.
Context
,
name
string
,
newParent
InodeEmbedder
,
newName
string
,
flags
uint32
)
syscall
.
Errno
}
}
...
@@ -372,63 +372,62 @@ type Renamer interface {
...
@@ -372,63 +372,62 @@ type Renamer interface {
type
FileHandle
interface
{
type
FileHandle
interface
{
}
}
// Release is called when forgetting the file handle. Default is to
// See NodeReleaser.
// call Release on the Inode.
type
FileReleaser
interface
{
type
FileReleaser
interface
{
Release
(
ctx
context
.
Context
)
syscall
.
Errno
Release
(
ctx
context
.
Context
)
syscall
.
Errno
}
}
// See
Getattrer. Default is to call Getattr on the Inode
// See
NodeGetattrer.
type
FileGetattrer
interface
{
type
FileGetattrer
interface
{
Getattr
(
ctx
context
.
Context
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
Getattr
(
ctx
context
.
Context
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
}
}
// See
Reader. Default is to call Read on the Inode
// See
NodeReader.
type
FileReader
interface
{
type
FileReader
interface
{
Read
(
ctx
context
.
Context
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
Read
(
ctx
context
.
Context
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
}
}
// See
Writer. Default is to call Write on the Inode
// See
NodeWriter.
type
FileWriter
interface
{
type
FileWriter
interface
{
Write
(
ctx
context
.
Context
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
Write
(
ctx
context
.
Context
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
}
}
// See
Getlker. Default is to call Getlk on the Inode
// See
NodeGetlker.
type
FileGetlker
interface
{
type
FileGetlker
interface
{
Getlk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
syscall
.
Errno
Getlk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
syscall
.
Errno
}
}
// See
Setlker. Default is to call Setlk on the Inode
// See
NodeSetlker.
type
FileSetlker
interface
{
type
FileSetlker
interface
{
Setlk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
Setlk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
}
}
// See
Setlkwer. Default is to call Setlkw on the Inode
// See
NodeSetlkwer.
type
FileSetlkwer
interface
{
type
FileSetlkwer
interface
{
Setlkw
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
Setlkw
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
syscall
.
Errno
}
}
// See
Lseek. Default is to call Lseek on the Inode
// See
NodeLseeker.
type
FileLseeker
interface
{
type
FileLseeker
interface
{
Lseek
(
ctx
context
.
Context
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
Lseek
(
ctx
context
.
Context
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
}
}
// See
Flusher. Default is to call Flush on the Inode
// See
NodeFlusher.
type
FileFlusher
interface
{
type
FileFlusher
interface
{
Flush
(
ctx
context
.
Context
)
syscall
.
Errno
Flush
(
ctx
context
.
Context
)
syscall
.
Errno
}
}
// See
Fsync. Default is to call Fsync on the Inode
// See
NodeFsync.
type
FileFsyncer
interface
{
type
FileFsyncer
interface
{
Fsync
(
ctx
context
.
Context
,
flags
uint32
)
syscall
.
Errno
Fsync
(
ctx
context
.
Context
,
flags
uint32
)
syscall
.
Errno
}
}
// See
Fsync. Default is to call Setattr on the Inode
// See
NodeFsync.
type
FileSetattrer
interface
{
type
FileSetattrer
interface
{
Setattr
(
ctx
context
.
Context
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
Setattr
(
ctx
context
.
Context
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
}
}
// See
Allocater. Default is to call Allocate on the Inode
// See
NodeAllocater.
type
FileAllocater
interface
{
type
FileAllocater
interface
{
Allocate
(
ctx
context
.
Context
,
off
uint64
,
size
uint64
,
mode
uint32
)
syscall
.
Errno
Allocate
(
ctx
context
.
Context
,
off
uint64
,
size
uint64
,
mode
uint32
)
syscall
.
Errno
}
}
...
...
nodefs/bridge.go
View file @
6dae0ec7
...
@@ -107,7 +107,7 @@ func (b *rawBridge) newInode(ctx context.Context, ops InodeEmbedder, id StableAt
...
@@ -107,7 +107,7 @@ func (b *rawBridge) newInode(ctx context.Context, ops InodeEmbedder, id StableAt
return
ch
return
ch
}
}
if
oa
,
ok
:=
ops
.
(
OnAdder
);
ok
{
if
oa
,
ok
:=
ops
.
(
Node
OnAdder
);
ok
{
oa
.
OnAdd
(
ctx
)
oa
.
OnAdd
(
ctx
)
}
}
return
ch
return
ch
...
@@ -160,8 +160,8 @@ func (b *rawBridge) setAttrTimeout(out *fuse.AttrOut) {
...
@@ -160,8 +160,8 @@ func (b *rawBridge) setAttrTimeout(out *fuse.AttrOut) {
}
}
}
}
// NewNodeFS creates a node based filesystem based on
an Operations
// NewNodeFS creates a node based filesystem based on
the
//
instance for the root
.
//
InodeEmbedder instance for the root of the tree
.
func
NewNodeFS
(
root
InodeEmbedder
,
opts
*
Options
)
fuse
.
RawFileSystem
{
func
NewNodeFS
(
root
InodeEmbedder
,
opts
*
Options
)
fuse
.
RawFileSystem
{
bridge
:=
&
rawBridge
{
bridge
:=
&
rawBridge
{
automaticIno
:
opts
.
FirstAutomaticIno
,
automaticIno
:
opts
.
FirstAutomaticIno
,
...
@@ -201,7 +201,7 @@ func NewNodeFS(root InodeEmbedder, opts *Options) fuse.RawFileSystem {
...
@@ -201,7 +201,7 @@ func NewNodeFS(root InodeEmbedder, opts *Options) fuse.RawFileSystem {
if
opts
.
OnAdd
!=
nil
{
if
opts
.
OnAdd
!=
nil
{
opts
.
OnAdd
(
context
.
Background
())
opts
.
OnAdd
(
context
.
Background
())
}
else
if
oa
,
ok
:=
root
.
(
OnAdder
);
ok
{
}
else
if
oa
,
ok
:=
root
.
(
Node
OnAdder
);
ok
{
oa
.
OnAdd
(
context
.
Background
())
oa
.
OnAdd
(
context
.
Background
())
}
}
...
@@ -242,7 +242,7 @@ func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name s
...
@@ -242,7 +242,7 @@ func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name s
}
}
func
(
b
*
rawBridge
)
lookup
(
ctx
*
fuse
.
Context
,
parent
*
Inode
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
func
(
b
*
rawBridge
)
lookup
(
ctx
*
fuse
.
Context
,
parent
*
Inode
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
if
lu
,
ok
:=
parent
.
ops
.
(
Lookuper
);
ok
{
if
lu
,
ok
:=
parent
.
ops
.
(
Node
Lookuper
);
ok
{
return
lu
.
Lookup
(
ctx
,
name
,
out
)
return
lu
.
Lookup
(
ctx
,
name
,
out
)
}
}
...
@@ -251,7 +251,7 @@ func (b *rawBridge) lookup(ctx *fuse.Context, parent *Inode, name string, out *f
...
@@ -251,7 +251,7 @@ func (b *rawBridge) lookup(ctx *fuse.Context, parent *Inode, name string, out *f
return
nil
,
syscall
.
ENOENT
return
nil
,
syscall
.
ENOENT
}
}
if
ga
,
ok
:=
child
.
ops
.
(
Getattrer
);
ok
{
if
ga
,
ok
:=
child
.
ops
.
(
Node
Getattrer
);
ok
{
var
a
fuse
.
AttrOut
var
a
fuse
.
AttrOut
errno
:=
ga
.
Getattr
(
ctx
,
nil
,
&
a
)
errno
:=
ga
.
Getattr
(
ctx
,
nil
,
&
a
)
if
errno
==
0
{
if
errno
==
0
{
...
@@ -265,7 +265,7 @@ func (b *rawBridge) lookup(ctx *fuse.Context, parent *Inode, name string, out *f
...
@@ -265,7 +265,7 @@ func (b *rawBridge) lookup(ctx *fuse.Context, parent *Inode, name string, out *f
func
(
b
*
rawBridge
)
Rmdir
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
name
string
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Rmdir
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
name
string
)
fuse
.
Status
{
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
var
errno
syscall
.
Errno
var
errno
syscall
.
Errno
if
mops
,
ok
:=
parent
.
ops
.
(
Rmdirer
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Rmdirer
);
ok
{
errno
=
mops
.
Rmdir
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
name
)
errno
=
mops
.
Rmdir
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
name
)
}
}
...
@@ -278,7 +278,7 @@ func (b *rawBridge) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name st
...
@@ -278,7 +278,7 @@ func (b *rawBridge) Rmdir(cancel <-chan struct{}, header *fuse.InHeader, name st
func
(
b
*
rawBridge
)
Unlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
name
string
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Unlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
name
string
)
fuse
.
Status
{
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
var
errno
syscall
.
Errno
var
errno
syscall
.
Errno
if
mops
,
ok
:=
parent
.
ops
.
(
Unlinker
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Unlinker
);
ok
{
errno
=
mops
.
Unlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
name
)
errno
=
mops
.
Unlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
name
)
}
}
...
@@ -293,7 +293,7 @@ func (b *rawBridge) Mkdir(cancel <-chan struct{}, input *fuse.MkdirIn, name stri
...
@@ -293,7 +293,7 @@ func (b *rawBridge) Mkdir(cancel <-chan struct{}, input *fuse.MkdirIn, name stri
var
child
*
Inode
var
child
*
Inode
var
errno
syscall
.
Errno
var
errno
syscall
.
Errno
if
mops
,
ok
:=
parent
.
ops
.
(
Mkdirer
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Mkdirer
);
ok
{
child
,
errno
=
mops
.
Mkdir
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
name
,
input
.
Mode
,
out
)
child
,
errno
=
mops
.
Mkdir
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
name
,
input
.
Mode
,
out
)
}
else
{
}
else
{
return
fuse
.
ENOTSUP
return
fuse
.
ENOTSUP
...
@@ -318,7 +318,7 @@ func (b *rawBridge) Mknod(cancel <-chan struct{}, input *fuse.MknodIn, name stri
...
@@ -318,7 +318,7 @@ func (b *rawBridge) Mknod(cancel <-chan struct{}, input *fuse.MknodIn, name stri
var
child
*
Inode
var
child
*
Inode
var
errno
syscall
.
Errno
var
errno
syscall
.
Errno
if
mops
,
ok
:=
parent
.
ops
.
(
Mknoder
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Mknoder
);
ok
{
child
,
errno
=
mops
.
Mknod
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
name
,
input
.
Mode
,
input
.
Rdev
,
out
)
child
,
errno
=
mops
.
Mknod
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
name
,
input
.
Mode
,
input
.
Rdev
,
out
)
}
}
...
@@ -340,7 +340,7 @@ func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
...
@@ -340,7 +340,7 @@ func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
var
errno
syscall
.
Errno
var
errno
syscall
.
Errno
var
f
FileHandle
var
f
FileHandle
var
flags
uint32
var
flags
uint32
if
mops
,
ok
:=
parent
.
ops
.
(
Creater
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Creater
);
ok
{
child
,
f
,
flags
,
errno
=
mops
.
Create
(
ctx
,
name
,
input
.
Flags
,
input
.
Mode
,
&
out
.
EntryOut
)
child
,
f
,
flags
,
errno
=
mops
.
Create
(
ctx
,
name
,
input
.
Flags
,
input
.
Mode
,
&
out
.
EntryOut
)
}
else
{
}
else
{
return
fuse
.
EROFS
return
fuse
.
EROFS
...
@@ -397,7 +397,7 @@ func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fu
...
@@ -397,7 +397,7 @@ func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fu
fg
,
_
=
f
.
(
FileGetattrer
)
fg
,
_
=
f
.
(
FileGetattrer
)
}
}
if
fops
,
ok
:=
n
.
ops
.
(
Getattrer
);
ok
{
if
fops
,
ok
:=
n
.
ops
.
(
Node
Getattrer
);
ok
{
errno
=
fops
.
Getattr
(
ctx
,
f
,
out
)
errno
=
fops
.
Getattr
(
ctx
,
f
,
out
)
}
else
if
fg
!=
nil
{
}
else
if
fg
!=
nil
{
errno
=
fg
.
Getattr
(
ctx
,
out
)
errno
=
fg
.
Getattr
(
ctx
,
out
)
...
@@ -423,7 +423,7 @@ func (b *rawBridge) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fus
...
@@ -423,7 +423,7 @@ func (b *rawBridge) SetAttr(cancel <-chan struct{}, in *fuse.SetAttrIn, out *fus
f
=
nil
f
=
nil
}
}
if
fops
,
ok
:=
n
.
ops
.
(
Setattrer
);
ok
{
if
fops
,
ok
:=
n
.
ops
.
(
Node
Setattrer
);
ok
{
return
errnoToStatus
(
fops
.
Setattr
(
ctx
,
f
,
in
,
out
))
return
errnoToStatus
(
fops
.
Setattr
(
ctx
,
f
,
in
,
out
))
}
}
if
fops
,
ok
:=
f
.
(
FileSetattrer
);
ok
{
if
fops
,
ok
:=
f
.
(
FileSetattrer
);
ok
{
...
@@ -437,7 +437,7 @@ func (b *rawBridge) Rename(cancel <-chan struct{}, input *fuse.RenameIn, oldName
...
@@ -437,7 +437,7 @@ func (b *rawBridge) Rename(cancel <-chan struct{}, input *fuse.RenameIn, oldName
p1
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
p1
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
p2
,
_
:=
b
.
inode
(
input
.
Newdir
,
0
)
p2
,
_
:=
b
.
inode
(
input
.
Newdir
,
0
)
if
mops
,
ok
:=
p1
.
ops
.
(
Renamer
);
ok
{
if
mops
,
ok
:=
p1
.
ops
.
(
Node
Renamer
);
ok
{
errno
:=
mops
.
Rename
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
oldName
,
p2
.
ops
,
newName
,
input
.
Flags
)
errno
:=
mops
.
Rename
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
oldName
,
p2
.
ops
,
newName
,
input
.
Flags
)
if
errno
==
0
{
if
errno
==
0
{
if
input
.
Flags
&
RENAME_EXCHANGE
!=
0
{
if
input
.
Flags
&
RENAME_EXCHANGE
!=
0
{
...
@@ -456,7 +456,7 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
...
@@ -456,7 +456,7 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
target
,
_
:=
b
.
inode
(
input
.
Oldnodeid
,
0
)
target
,
_
:=
b
.
inode
(
input
.
Oldnodeid
,
0
)
if
mops
,
ok
:=
parent
.
ops
.
(
Linker
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Linker
);
ok
{
child
,
errno
:=
mops
.
Link
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
target
.
ops
,
name
,
out
)
child
,
errno
:=
mops
.
Link
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
target
.
ops
,
name
,
out
)
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
...
@@ -473,7 +473,7 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
...
@@ -473,7 +473,7 @@ func (b *rawBridge) Link(cancel <-chan struct{}, input *fuse.LinkIn, name string
func
(
b
*
rawBridge
)
Symlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
target
string
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Symlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
target
string
,
name
string
,
out
*
fuse
.
EntryOut
)
fuse
.
Status
{
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
parent
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
mops
,
ok
:=
parent
.
ops
.
(
Symlinker
);
ok
{
if
mops
,
ok
:=
parent
.
ops
.
(
Node
Symlinker
);
ok
{
child
,
status
:=
mops
.
Symlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
target
,
name
,
out
)
child
,
status
:=
mops
.
Symlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
target
,
name
,
out
)
if
status
!=
0
{
if
status
!=
0
{
return
errnoToStatus
(
status
)
return
errnoToStatus
(
status
)
...
@@ -490,7 +490,7 @@ func (b *rawBridge) Symlink(cancel <-chan struct{}, header *fuse.InHeader, targe
...
@@ -490,7 +490,7 @@ func (b *rawBridge) Symlink(cancel <-chan struct{}, header *fuse.InHeader, targe
func
(
b
*
rawBridge
)
Readlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
)
(
out
[]
byte
,
status
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
Readlink
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
)
(
out
[]
byte
,
status
fuse
.
Status
)
{
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
linker
,
ok
:=
n
.
ops
.
(
Readlinker
);
ok
{
if
linker
,
ok
:=
n
.
ops
.
(
Node
Readlinker
);
ok
{
result
,
errno
:=
linker
.
Readlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
})
result
,
errno
:=
linker
.
Readlink
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
})
if
errno
!=
0
{
if
errno
!=
0
{
return
nil
,
errnoToStatus
(
errno
)
return
nil
,
errnoToStatus
(
errno
)
...
@@ -507,7 +507,7 @@ func (b *rawBridge) Access(cancel <-chan struct{}, input *fuse.AccessIn) fuse.St
...
@@ -507,7 +507,7 @@ func (b *rawBridge) Access(cancel <-chan struct{}, input *fuse.AccessIn) fuse.St
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
ctx
:=
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
}
if
a
,
ok
:=
n
.
ops
.
(
Accesser
);
ok
{
if
a
,
ok
:=
n
.
ops
.
(
Node
Accesser
);
ok
{
return
errnoToStatus
(
a
.
Access
(
ctx
,
input
.
Mask
))
return
errnoToStatus
(
a
.
Access
(
ctx
,
input
.
Mask
))
}
}
...
@@ -530,7 +530,7 @@ func (b *rawBridge) Access(cancel <-chan struct{}, input *fuse.AccessIn) fuse.St
...
@@ -530,7 +530,7 @@ func (b *rawBridge) Access(cancel <-chan struct{}, input *fuse.AccessIn) fuse.St
func
(
b
*
rawBridge
)
GetXAttr
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
attr
string
,
data
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
GetXAttr
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
attr
string
,
data
[]
byte
)
(
uint32
,
fuse
.
Status
)
{
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
xops
,
ok
:=
n
.
ops
.
(
Getxattrer
);
ok
{
if
xops
,
ok
:=
n
.
ops
.
(
Node
Getxattrer
);
ok
{
nb
,
errno
:=
xops
.
Getxattr
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
attr
,
data
)
nb
,
errno
:=
xops
.
Getxattr
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
attr
,
data
)
return
nb
,
errnoToStatus
(
errno
)
return
nb
,
errnoToStatus
(
errno
)
}
}
...
@@ -540,7 +540,7 @@ func (b *rawBridge) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr
...
@@ -540,7 +540,7 @@ func (b *rawBridge) GetXAttr(cancel <-chan struct{}, header *fuse.InHeader, attr
func
(
b
*
rawBridge
)
ListXAttr
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
dest
[]
byte
)
(
sz
uint32
,
status
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
ListXAttr
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
dest
[]
byte
)
(
sz
uint32
,
status
fuse
.
Status
)
{
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
xops
,
ok
:=
n
.
ops
.
(
Listxattrer
);
ok
{
if
xops
,
ok
:=
n
.
ops
.
(
Node
Listxattrer
);
ok
{
sz
,
errno
:=
xops
.
Listxattr
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
dest
)
sz
,
errno
:=
xops
.
Listxattr
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
dest
)
return
sz
,
errnoToStatus
(
errno
)
return
sz
,
errnoToStatus
(
errno
)
}
}
...
@@ -549,7 +549,7 @@ func (b *rawBridge) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, des
...
@@ -549,7 +549,7 @@ func (b *rawBridge) ListXAttr(cancel <-chan struct{}, header *fuse.InHeader, des
func
(
b
*
rawBridge
)
SetXAttr
(
cancel
<-
chan
struct
{},
input
*
fuse
.
SetXAttrIn
,
attr
string
,
data
[]
byte
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
SetXAttr
(
cancel
<-
chan
struct
{},
input
*
fuse
.
SetXAttrIn
,
attr
string
,
data
[]
byte
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
if
xops
,
ok
:=
n
.
ops
.
(
Setxattrer
);
ok
{
if
xops
,
ok
:=
n
.
ops
.
(
Node
Setxattrer
);
ok
{
return
errnoToStatus
(
xops
.
Setxattr
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
attr
,
data
,
input
.
Flags
))
return
errnoToStatus
(
xops
.
Setxattr
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
attr
,
data
,
input
.
Flags
))
}
}
return
fuse
.
ENOATTR
return
fuse
.
ENOATTR
...
@@ -557,7 +557,7 @@ func (b *rawBridge) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, att
...
@@ -557,7 +557,7 @@ func (b *rawBridge) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, att
func
(
b
*
rawBridge
)
RemoveXAttr
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
attr
string
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
RemoveXAttr
(
cancel
<-
chan
struct
{},
header
*
fuse
.
InHeader
,
attr
string
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
header
.
NodeId
,
0
)
if
xops
,
ok
:=
n
.
ops
.
(
Removexattrer
);
ok
{
if
xops
,
ok
:=
n
.
ops
.
(
Node
Removexattrer
);
ok
{
return
errnoToStatus
(
xops
.
Removexattr
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
attr
))
return
errnoToStatus
(
xops
.
Removexattr
(
&
fuse
.
Context
{
Caller
:
header
.
Caller
,
Cancel
:
cancel
},
attr
))
}
}
return
fuse
.
ENOATTR
return
fuse
.
ENOATTR
...
@@ -566,7 +566,7 @@ func (b *rawBridge) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, a
...
@@ -566,7 +566,7 @@ func (b *rawBridge) RemoveXAttr(cancel <-chan struct{}, header *fuse.InHeader, a
func
(
b
*
rawBridge
)
Open
(
cancel
<-
chan
struct
{},
input
*
fuse
.
OpenIn
,
out
*
fuse
.
OpenOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Open
(
cancel
<-
chan
struct
{},
input
*
fuse
.
OpenIn
,
out
*
fuse
.
OpenOut
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
if
op
,
ok
:=
n
.
ops
.
(
Opener
);
ok
{
if
op
,
ok
:=
n
.
ops
.
(
Node
Opener
);
ok
{
f
,
flags
,
errno
:=
op
.
Open
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
input
.
Flags
)
f
,
flags
,
errno
:=
op
.
Open
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
input
.
Flags
)
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
...
@@ -607,7 +607,7 @@ func (b *rawBridge) registerFile(n *Inode, f FileHandle, flags uint32) uint32 {
...
@@ -607,7 +607,7 @@ func (b *rawBridge) registerFile(n *Inode, f FileHandle, flags uint32) uint32 {
func
(
b
*
rawBridge
)
Read
(
cancel
<-
chan
struct
{},
input
*
fuse
.
ReadIn
,
buf
[]
byte
)
(
fuse
.
ReadResult
,
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
Read
(
cancel
<-
chan
struct
{},
input
*
fuse
.
ReadIn
,
buf
[]
byte
)
(
fuse
.
ReadResult
,
fuse
.
Status
)
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
fops
,
ok
:=
n
.
ops
.
(
Reader
);
ok
{
if
fops
,
ok
:=
n
.
ops
.
(
Node
Reader
);
ok
{
res
,
errno
:=
fops
.
Read
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
buf
,
int64
(
input
.
Offset
))
res
,
errno
:=
fops
.
Read
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
buf
,
int64
(
input
.
Offset
))
return
res
,
errnoToStatus
(
errno
)
return
res
,
errnoToStatus
(
errno
)
}
}
...
@@ -622,7 +622,7 @@ func (b *rawBridge) Read(cancel <-chan struct{}, input *fuse.ReadIn, buf []byte)
...
@@ -622,7 +622,7 @@ func (b *rawBridge) Read(cancel <-chan struct{}, input *fuse.ReadIn, buf []byte)
func
(
b
*
rawBridge
)
GetLk
(
cancel
<-
chan
struct
{},
input
*
fuse
.
LkIn
,
out
*
fuse
.
LkOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
GetLk
(
cancel
<-
chan
struct
{},
input
*
fuse
.
LkIn
,
out
*
fuse
.
LkOut
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
lops
,
ok
:=
n
.
ops
.
(
Getlker
);
ok
{
if
lops
,
ok
:=
n
.
ops
.
(
Node
Getlker
);
ok
{
return
errnoToStatus
(
lops
.
Getlk
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Owner
,
&
input
.
Lk
,
input
.
LkFlags
,
&
out
.
Lk
))
return
errnoToStatus
(
lops
.
Getlk
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Owner
,
&
input
.
Lk
,
input
.
LkFlags
,
&
out
.
Lk
))
}
}
if
gl
,
ok
:=
f
.
file
.
(
FileGetlker
);
ok
{
if
gl
,
ok
:=
f
.
file
.
(
FileGetlker
);
ok
{
...
@@ -633,7 +633,7 @@ func (b *rawBridge) GetLk(cancel <-chan struct{}, input *fuse.LkIn, out *fuse.Lk
...
@@ -633,7 +633,7 @@ func (b *rawBridge) GetLk(cancel <-chan struct{}, input *fuse.LkIn, out *fuse.Lk
func
(
b
*
rawBridge
)
SetLk
(
cancel
<-
chan
struct
{},
input
*
fuse
.
LkIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
SetLk
(
cancel
<-
chan
struct
{},
input
*
fuse
.
LkIn
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
lops
,
ok
:=
n
.
ops
.
(
Setlker
);
ok
{
if
lops
,
ok
:=
n
.
ops
.
(
Node
Setlker
);
ok
{
return
errnoToStatus
(
lops
.
Setlk
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Owner
,
&
input
.
Lk
,
input
.
LkFlags
))
return
errnoToStatus
(
lops
.
Setlk
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Owner
,
&
input
.
Lk
,
input
.
LkFlags
))
}
}
if
sl
,
ok
:=
n
.
ops
.
(
FileSetlker
);
ok
{
if
sl
,
ok
:=
n
.
ops
.
(
FileSetlker
);
ok
{
...
@@ -643,7 +643,7 @@ func (b *rawBridge) SetLk(cancel <-chan struct{}, input *fuse.LkIn) fuse.Status
...
@@ -643,7 +643,7 @@ func (b *rawBridge) SetLk(cancel <-chan struct{}, input *fuse.LkIn) fuse.Status
}
}
func
(
b
*
rawBridge
)
SetLkw
(
cancel
<-
chan
struct
{},
input
*
fuse
.
LkIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
SetLkw
(
cancel
<-
chan
struct
{},
input
*
fuse
.
LkIn
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
lops
,
ok
:=
n
.
ops
.
(
Setlkwer
);
ok
{
if
lops
,
ok
:=
n
.
ops
.
(
Node
Setlkwer
);
ok
{
return
errnoToStatus
(
lops
.
Setlkw
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Owner
,
&
input
.
Lk
,
input
.
LkFlags
))
return
errnoToStatus
(
lops
.
Setlkw
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Owner
,
&
input
.
Lk
,
input
.
LkFlags
))
}
}
if
sl
,
ok
:=
n
.
ops
.
(
FileSetlkwer
);
ok
{
if
sl
,
ok
:=
n
.
ops
.
(
FileSetlkwer
);
ok
{
...
@@ -660,7 +660,7 @@ func (b *rawBridge) Release(cancel <-chan struct{}, input *fuse.ReleaseIn) {
...
@@ -660,7 +660,7 @@ func (b *rawBridge) Release(cancel <-chan struct{}, input *fuse.ReleaseIn) {
f
.
wg
.
Wait
()
f
.
wg
.
Wait
()
if
r
,
ok
:=
n
.
ops
.
(
Releaser
);
ok
{
if
r
,
ok
:=
n
.
ops
.
(
Node
Releaser
);
ok
{
r
.
Release
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
)
r
.
Release
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
)
}
else
if
r
,
ok
:=
f
.
file
.
(
FileReleaser
);
ok
{
}
else
if
r
,
ok
:=
f
.
file
.
(
FileReleaser
);
ok
{
r
.
Release
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
})
r
.
Release
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
})
...
@@ -705,7 +705,7 @@ func (b *rawBridge) releaseFileEntry(nid uint64, fh uint64) (*Inode, *fileEntry)
...
@@ -705,7 +705,7 @@ func (b *rawBridge) releaseFileEntry(nid uint64, fh uint64) (*Inode, *fileEntry)
func
(
b
*
rawBridge
)
Write
(
cancel
<-
chan
struct
{},
input
*
fuse
.
WriteIn
,
data
[]
byte
)
(
written
uint32
,
status
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
Write
(
cancel
<-
chan
struct
{},
input
*
fuse
.
WriteIn
,
data
[]
byte
)
(
written
uint32
,
status
fuse
.
Status
)
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
wr
,
ok
:=
n
.
ops
.
(
Writer
);
ok
{
if
wr
,
ok
:=
n
.
ops
.
(
Node
Writer
);
ok
{
w
,
errno
:=
wr
.
Write
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
data
,
int64
(
input
.
Offset
))
w
,
errno
:=
wr
.
Write
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
data
,
int64
(
input
.
Offset
))
return
w
,
errnoToStatus
(
errno
)
return
w
,
errnoToStatus
(
errno
)
}
}
...
@@ -719,7 +719,7 @@ func (b *rawBridge) Write(cancel <-chan struct{}, input *fuse.WriteIn, data []by
...
@@ -719,7 +719,7 @@ func (b *rawBridge) Write(cancel <-chan struct{}, input *fuse.WriteIn, data []by
func
(
b
*
rawBridge
)
Flush
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FlushIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Flush
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FlushIn
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
fl
,
ok
:=
n
.
ops
.
(
Flusher
);
ok
{
if
fl
,
ok
:=
n
.
ops
.
(
Node
Flusher
);
ok
{
return
errnoToStatus
(
fl
.
Flush
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
))
return
errnoToStatus
(
fl
.
Flush
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
))
}
}
if
fl
,
ok
:=
f
.
file
.
(
FileFlusher
);
ok
{
if
fl
,
ok
:=
f
.
file
.
(
FileFlusher
);
ok
{
...
@@ -731,7 +731,7 @@ func (b *rawBridge) Flush(cancel <-chan struct{}, input *fuse.FlushIn) fuse.Stat
...
@@ -731,7 +731,7 @@ func (b *rawBridge) Flush(cancel <-chan struct{}, input *fuse.FlushIn) fuse.Stat
func
(
b
*
rawBridge
)
Fsync
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FsyncIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Fsync
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FsyncIn
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
fs
,
ok
:=
n
.
ops
.
(
Fsyncer
);
ok
{
if
fs
,
ok
:=
n
.
ops
.
(
Node
Fsyncer
);
ok
{
return
errnoToStatus
(
fs
.
Fsync
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
FsyncFlags
))
return
errnoToStatus
(
fs
.
Fsync
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
FsyncFlags
))
}
}
if
fs
,
ok
:=
f
.
file
.
(
FileFsyncer
);
ok
{
if
fs
,
ok
:=
f
.
file
.
(
FileFsyncer
);
ok
{
...
@@ -742,7 +742,7 @@ func (b *rawBridge) Fsync(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.Stat
...
@@ -742,7 +742,7 @@ func (b *rawBridge) Fsync(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.Stat
func
(
b
*
rawBridge
)
Fallocate
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FallocateIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Fallocate
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FallocateIn
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
f
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
a
,
ok
:=
n
.
ops
.
(
Allocater
);
ok
{
if
a
,
ok
:=
n
.
ops
.
(
Node
Allocater
);
ok
{
return
errnoToStatus
(
a
.
Allocate
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Offset
,
input
.
Length
,
input
.
Mode
))
return
errnoToStatus
(
a
.
Allocate
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
input
.
Offset
,
input
.
Length
,
input
.
Mode
))
}
}
if
a
,
ok
:=
n
.
ops
.
(
FileAllocater
);
ok
{
if
a
,
ok
:=
n
.
ops
.
(
FileAllocater
);
ok
{
...
@@ -754,7 +754,7 @@ func (b *rawBridge) Fallocate(cancel <-chan struct{}, input *fuse.FallocateIn) f
...
@@ -754,7 +754,7 @@ func (b *rawBridge) Fallocate(cancel <-chan struct{}, input *fuse.FallocateIn) f
func
(
b
*
rawBridge
)
OpenDir
(
cancel
<-
chan
struct
{},
input
*
fuse
.
OpenIn
,
out
*
fuse
.
OpenOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
OpenDir
(
cancel
<-
chan
struct
{},
input
*
fuse
.
OpenIn
,
out
*
fuse
.
OpenOut
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
if
od
,
ok
:=
n
.
ops
.
(
Opendirer
);
ok
{
if
od
,
ok
:=
n
.
ops
.
(
Node
Opendirer
);
ok
{
errno
:=
od
.
Opendir
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
})
errno
:=
od
.
Opendir
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
})
if
errno
!=
0
{
if
errno
!=
0
{
return
errnoToStatus
(
errno
)
return
errnoToStatus
(
errno
)
...
@@ -786,7 +786,7 @@ func (b *rawBridge) setStream(cancel <-chan struct{}, input *fuse.ReadIn, inode
...
@@ -786,7 +786,7 @@ func (b *rawBridge) setStream(cancel <-chan struct{}, input *fuse.ReadIn, inode
}
}
func
(
b
*
rawBridge
)
getStream
(
ctx
context
.
Context
,
inode
*
Inode
)
(
DirStream
,
syscall
.
Errno
)
{
func
(
b
*
rawBridge
)
getStream
(
ctx
context
.
Context
,
inode
*
Inode
)
(
DirStream
,
syscall
.
Errno
)
{
if
rd
,
ok
:=
inode
.
ops
.
(
Readdirer
);
ok
{
if
rd
,
ok
:=
inode
.
ops
.
(
Node
Readdirer
);
ok
{
return
rd
.
Readdir
(
ctx
)
return
rd
.
Readdir
(
ctx
)
}
}
...
@@ -885,7 +885,7 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
...
@@ -885,7 +885,7 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
func
(
b
*
rawBridge
)
FsyncDir
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FsyncIn
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
FsyncDir
(
cancel
<-
chan
struct
{},
input
*
fuse
.
FsyncIn
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
input
.
Fh
)
if
fs
,
ok
:=
n
.
ops
.
(
Fsyncer
);
ok
{
if
fs
,
ok
:=
n
.
ops
.
(
Node
Fsyncer
);
ok
{
return
errnoToStatus
(
fs
.
Fsync
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
nil
,
input
.
FsyncFlags
))
return
errnoToStatus
(
fs
.
Fsync
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
nil
,
input
.
FsyncFlags
))
}
}
...
@@ -894,7 +894,7 @@ func (b *rawBridge) FsyncDir(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.S
...
@@ -894,7 +894,7 @@ func (b *rawBridge) FsyncDir(cancel <-chan struct{}, input *fuse.FsyncIn) fuse.S
func
(
b
*
rawBridge
)
StatFs
(
cancel
<-
chan
struct
{},
input
*
fuse
.
InHeader
,
out
*
fuse
.
StatfsOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
StatFs
(
cancel
<-
chan
struct
{},
input
*
fuse
.
InHeader
,
out
*
fuse
.
StatfsOut
)
fuse
.
Status
{
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
n
,
_
:=
b
.
inode
(
input
.
NodeId
,
0
)
if
sf
,
ok
:=
n
.
ops
.
(
Statfser
);
ok
{
if
sf
,
ok
:=
n
.
ops
.
(
Node
Statfser
);
ok
{
return
errnoToStatus
(
sf
.
Statfs
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
out
))
return
errnoToStatus
(
sf
.
Statfs
(
&
fuse
.
Context
{
Caller
:
input
.
Caller
,
Cancel
:
cancel
},
out
))
}
}
...
@@ -908,7 +908,7 @@ func (b *rawBridge) Init(s *fuse.Server) {
...
@@ -908,7 +908,7 @@ func (b *rawBridge) Init(s *fuse.Server) {
func
(
b
*
rawBridge
)
CopyFileRange
(
cancel
<-
chan
struct
{},
in
*
fuse
.
CopyFileRangeIn
)
(
size
uint32
,
status
fuse
.
Status
)
{
func
(
b
*
rawBridge
)
CopyFileRange
(
cancel
<-
chan
struct
{},
in
*
fuse
.
CopyFileRangeIn
)
(
size
uint32
,
status
fuse
.
Status
)
{
n1
,
f1
:=
b
.
inode
(
in
.
NodeId
,
in
.
FhIn
)
n1
,
f1
:=
b
.
inode
(
in
.
NodeId
,
in
.
FhIn
)
cfr
,
ok
:=
n1
.
ops
.
(
CopyFileRanger
)
cfr
,
ok
:=
n1
.
ops
.
(
Node
CopyFileRanger
)
if
!
ok
{
if
!
ok
{
return
0
,
fuse
.
ENOTSUP
return
0
,
fuse
.
ENOTSUP
}
}
...
@@ -923,7 +923,7 @@ func (b *rawBridge) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRange
...
@@ -923,7 +923,7 @@ func (b *rawBridge) CopyFileRange(cancel <-chan struct{}, in *fuse.CopyFileRange
func
(
b
*
rawBridge
)
Lseek
(
cancel
<-
chan
struct
{},
in
*
fuse
.
LseekIn
,
out
*
fuse
.
LseekOut
)
fuse
.
Status
{
func
(
b
*
rawBridge
)
Lseek
(
cancel
<-
chan
struct
{},
in
*
fuse
.
LseekIn
,
out
*
fuse
.
LseekOut
)
fuse
.
Status
{
n
,
f
:=
b
.
inode
(
in
.
NodeId
,
in
.
Fh
)
n
,
f
:=
b
.
inode
(
in
.
NodeId
,
in
.
Fh
)
ls
,
ok
:=
n
.
ops
.
(
Lseeker
)
ls
,
ok
:=
n
.
ops
.
(
Node
Lseeker
)
if
ok
{
if
ok
{
off
,
errno
:=
ls
.
Lseek
(
&
fuse
.
Context
{
Caller
:
in
.
Caller
,
Cancel
:
cancel
},
off
,
errno
:=
ls
.
Lseek
(
&
fuse
.
Context
{
Caller
:
in
.
Caller
,
Cancel
:
cancel
},
f
.
file
,
in
.
Offset
,
in
.
Whence
)
f
.
file
,
in
.
Offset
,
in
.
Whence
)
...
...
nodefs/cache_test.go
View file @
6dae0ec7
...
@@ -25,9 +25,9 @@ type keepCacheFile struct {
...
@@ -25,9 +25,9 @@ type keepCacheFile struct {
count
int
count
int
}
}
var
_
=
(
Reader
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Node
Reader
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Opener
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Getattrer
)((
*
keepCacheFile
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
keepCacheFile
)(
nil
))
func
(
f
*
keepCacheFile
)
setContent
(
delta
int
)
{
func
(
f
*
keepCacheFile
)
setContent
(
delta
int
)
{
f
.
mu
.
Lock
()
f
.
mu
.
Lock
()
...
@@ -69,7 +69,7 @@ type keepCacheRoot struct {
...
@@ -69,7 +69,7 @@ type keepCacheRoot struct {
keep
,
nokeep
*
keepCacheFile
keep
,
nokeep
*
keepCacheFile
}
}
var
_
=
(
OnAdder
)((
*
keepCacheRoot
)(
nil
))
var
_
=
(
Node
OnAdder
)((
*
keepCacheRoot
)(
nil
))
func
(
r
*
keepCacheRoot
)
OnAdd
(
ctx
context
.
Context
)
{
func
(
r
*
keepCacheRoot
)
OnAdd
(
ctx
context
.
Context
)
{
i
:=
&
r
.
Inode
i
:=
&
r
.
Inode
...
...
nodefs/directio_test.go
View file @
6dae0ec7
...
@@ -46,7 +46,7 @@ type dioFile struct {
...
@@ -46,7 +46,7 @@ type dioFile struct {
Inode
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
)
{
func
(
f
*
dioFile
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
return
&
dioFH
{},
fuse
.
FOPEN_DIRECT_IO
,
OK
return
&
dioFH
{},
fuse
.
FOPEN_DIRECT_IO
,
OK
...
...
nodefs/interrupt_test.go
View file @
6dae0ec7
...
@@ -19,7 +19,7 @@ type interruptRoot struct {
...
@@ -19,7 +19,7 @@ type interruptRoot struct {
child
interruptOps
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
)
{
func
(
r
*
interruptRoot
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
if
name
!=
"file"
{
if
name
!=
"file"
{
...
@@ -37,7 +37,7 @@ type interruptOps struct {
...
@@ -37,7 +37,7 @@ type interruptOps struct {
interrupted
bool
interrupted
bool
}
}
var
_
=
(
Opener
)((
*
interruptOps
)(
nil
))
var
_
=
(
Node
Opener
)((
*
interruptOps
)(
nil
))
func
(
o
*
interruptOps
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
FileHandle
,
uint32
,
syscall
.
Errno
)
{
func
(
o
*
interruptOps
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
FileHandle
,
uint32
,
syscall
.
Errno
)
{
select
{
select
{
...
...
nodefs/loopback.go
View file @
6dae0ec7
...
@@ -24,26 +24,26 @@ type loopbackNode struct {
...
@@ -24,26 +24,26 @@ type loopbackNode struct {
Inode
Inode
}
}
var
_
=
(
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Statfser
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Getattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Getxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Getxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Setxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Setxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Removexattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Removexattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Listxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Listxattrer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Readlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Readlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Opener
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Opener
)((
*
loopbackNode
)(
nil
))
var
_
=
(
CopyFileRanger
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
CopyFileRanger
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Lookuper
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Lookuper
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Opendirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Opendirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Readdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Readdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Mkdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Mkdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Mknoder
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Mknoder
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Linker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Linker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Symlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Symlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Unlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Unlinker
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Rmdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Rmdirer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Renamer
)((
*
loopbackNode
)(
nil
))
var
_
=
(
Node
Renamer
)((
*
loopbackNode
)(
nil
))
func
(
n
*
loopbackNode
)
Statfs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
{
func
(
n
*
loopbackNode
)
Statfs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
{
s
:=
syscall
.
Statfs_t
{}
s
:=
syscall
.
Statfs_t
{}
...
@@ -181,7 +181,7 @@ func (r *loopbackRoot) idFromStat(st *syscall.Stat_t) StableAttr {
...
@@ -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
)
{
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
)
p
:=
filepath
.
Join
(
n
.
path
(),
name
)
...
@@ -298,7 +298,7 @@ func (n *loopbackNode) Getattr(ctx context.Context, f FileHandle, out *fuse.Attr
...
@@ -298,7 +298,7 @@ func (n *loopbackNode) Getattr(ctx context.Context, f FileHandle, out *fuse.Attr
return
OK
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
{
func
(
n
*
loopbackNode
)
Setattr
(
ctx
context
.
Context
,
f
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
p
:=
n
.
path
()
p
:=
n
.
path
()
...
...
nodefs/mem.go
View file @
6dae0ec7
...
@@ -20,9 +20,9 @@ type MemRegularFile struct {
...
@@ -20,9 +20,9 @@ type MemRegularFile struct {
Attr
fuse
.
Attr
Attr
fuse
.
Attr
}
}
var
_
=
(
Opener
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Reader
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Reader
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Flusher
)((
*
MemRegularFile
)(
nil
))
var
_
=
(
Node
Flusher
)((
*
MemRegularFile
)(
nil
))
func
(
f
*
MemRegularFile
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
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
{
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,
...
@@ -32,7 +32,7 @@ func (f *MemRegularFile) Open(ctx context.Context, flags uint32) (fh FileHandle,
return
nil
,
fuse
.
FOPEN_KEEP_CACHE
,
OK
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
{
func
(
f
*
MemRegularFile
)
Getattr
(
ctx
context
.
Context
,
fh
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
out
.
Attr
=
f
.
Attr
out
.
Attr
=
f
.
Attr
...
@@ -59,13 +59,13 @@ type MemSymlink struct {
...
@@ -59,13 +59,13 @@ type MemSymlink struct {
Data
[]
byte
Data
[]
byte
}
}
var
_
=
(
Readlinker
)((
*
MemSymlink
)(
nil
))
var
_
=
(
Node
Readlinker
)((
*
MemSymlink
)(
nil
))
func
(
l
*
MemSymlink
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
func
(
l
*
MemSymlink
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
return
l
.
Data
,
OK
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
{
func
(
l
*
MemSymlink
)
Getattr
(
ctx
context
.
Context
,
fh
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
out
.
Attr
=
l
.
Attr
out
.
Attr
=
l
.
Attr
...
...
nodefs/zip_test.go
View file @
6dae0ec7
...
@@ -129,8 +129,8 @@ type zipFile struct {
...
@@ -129,8 +129,8 @@ type zipFile struct {
data
[]
byte
data
[]
byte
}
}
var
_
=
(
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
Node
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
Getattrer
)((
*
zipFile
)(
nil
))
var
_
=
(
Node
Getattrer
)((
*
zipFile
)(
nil
))
// Getattr sets the minimum, which is the size. A more full-featured
// Getattr sets the minimum, which is the size. A more full-featured
// FS would also set timestamps and permissions.
// FS would also set timestamps and permissions.
...
@@ -179,7 +179,7 @@ type zipRoot struct {
...
@@ -179,7 +179,7 @@ type zipRoot struct {
zr
*
zip
.
Reader
zr
*
zip
.
Reader
}
}
var
_
=
(
OnAdder
)((
*
zipRoot
)(
nil
))
var
_
=
(
Node
OnAdder
)((
*
zipRoot
)(
nil
))
func
(
zr
*
zipRoot
)
OnAdd
(
ctx
context
.
Context
)
{
func
(
zr
*
zipRoot
)
OnAdd
(
ctx
context
.
Context
)
{
// OnAdd is called once we are attached to an Inode. We can
// 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 {
...
@@ -38,8 +38,8 @@ type configRoot struct {
nodefs
.
Inode
nodefs
.
Inode
}
}
var
_
=
(
nodefs
.
Unlinker
)((
*
configRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
Unlinker
)((
*
configRoot
)(
nil
))
var
_
=
(
nodefs
.
Symlinker
)((
*
configRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
Symlinker
)((
*
configRoot
)(
nil
))
func
(
r
*
configRoot
)
Unlink
(
ctx
context
.
Context
,
basename
string
)
syscall
.
Errno
{
func
(
r
*
configRoot
)
Unlink
(
ctx
context
.
Context
,
basename
string
)
syscall
.
Errno
{
if
r
.
GetChild
(
basename
)
==
nil
{
if
r
.
GetChild
(
basename
)
==
nil
{
...
...
zipfs/zipfs.go
View file @
6dae0ec7
...
@@ -25,7 +25,7 @@ type zipRoot struct {
...
@@ -25,7 +25,7 @@ type zipRoot struct {
zr
*
zip
.
ReadCloser
zr
*
zip
.
ReadCloser
}
}
var
_
=
(
nodefs
.
OnAdder
)((
*
zipRoot
)(
nil
))
var
_
=
(
nodefs
.
Node
OnAdder
)((
*
zipRoot
)(
nil
))
func
(
zr
*
zipRoot
)
OnAdd
(
ctx
context
.
Context
)
{
func
(
zr
*
zipRoot
)
OnAdd
(
ctx
context
.
Context
)
{
for
_
,
f
:=
range
zr
.
zr
.
File
{
for
_
,
f
:=
range
zr
.
zr
.
File
{
...
@@ -72,8 +72,8 @@ type zipFile struct {
...
@@ -72,8 +72,8 @@ type zipFile struct {
data
[]
byte
data
[]
byte
}
}
var
_
=
(
nodefs
.
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
nodefs
.
Node
Opener
)((
*
zipFile
)(
nil
))
var
_
=
(
nodefs
.
Getattrer
)((
*
zipFile
)(
nil
))
var
_
=
(
nodefs
.
Node
Getattrer
)((
*
zipFile
)(
nil
))
// Getattr sets the minimum, which is the size. A more full-featured
// Getattr sets the minimum, which is the size. A more full-featured
// FS would also set timestamps and permissions.
// FS would also set timestamps and permissions.
...
@@ -120,7 +120,7 @@ func (zf *zipFile) Read(ctx context.Context, f nodefs.FileHandle, dest []byte, o
...
@@ -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
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
)
{
func
NewArchiveFileSystem
(
name
string
)
(
root
nodefs
.
InodeEmbedder
,
err
error
)
{
switch
{
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