Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
1ee3533f
Commit
1ee3533f
authored
Mar 27, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: rename DefaultOperations to OperationStubs
parent
0c3074f5
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
71 additions
and
78 deletions
+71
-78
nodefs/README.md
nodefs/README.md
+0
-6
nodefs/api.go
nodefs/api.go
+3
-4
nodefs/cache_test.go
nodefs/cache_test.go
+2
-2
nodefs/default.go
nodefs/default.go
+57
-57
nodefs/directio_test.go
nodefs/directio_test.go
+3
-3
nodefs/interrupt_test.go
nodefs/interrupt_test.go
+2
-2
nodefs/loopback.go
nodefs/loopback.go
+1
-1
nodefs/zip_test.go
nodefs/zip_test.go
+3
-3
No files found.
nodefs/README.md
View file @
1ee3533f
...
@@ -53,10 +53,4 @@ Decisions
...
@@ -53,10 +53,4 @@ Decisions
To decide
To decide
=========
=========
*
A better name for DefaultOperations.
*
InodeLink
*
ReadonlyOperations
*
BaseOperations
*
implement remaining file types (exercise Mknod)
*
implement remaining file types (exercise Mknod)
nodefs/api.go
View file @
1ee3533f
...
@@ -65,7 +65,7 @@ import (
...
@@ -65,7 +65,7 @@ import (
)
)
// Operations is the interface that implements the filesystem inode.
// Operations is the interface that implements the filesystem inode.
// Each Operations instance must embed
DefaultNode
. All error
// Each Operations instance must embed
OperationStubs
. All error
// reporting must use the syscall.Errno type. The value 0 (`OK`)
// reporting must use the syscall.Errno type. The value 0 (`OK`)
// should be used to indicate success.
// should be used to indicate success.
type
Operations
interface
{
type
Operations
interface
{
...
@@ -79,12 +79,11 @@ type Operations interface {
...
@@ -79,12 +79,11 @@ type Operations interface {
// Inode returns the *Inode associated with this Operations
// Inode returns the *Inode associated with this Operations
// instance. The identity of the Inode does not change over
// instance. The identity of the Inode does not change over
// the lifetime of the node object. Inode() is provided by
// the lifetime of the node object. Inode() is provided by
//
DefaultOperation
s, and should not be reimplemented.
//
OperationStub
s, and should not be reimplemented.
Inode
()
*
Inode
Inode
()
*
Inode
// StatFs implements statistics for the filesystem that holds
// StatFs implements statistics for the filesystem that holds
// this Inode. DefaultNode implements this, because OSX
// this Inode.
// filesystem must have a valid StatFs implementation.
StatFs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
StatFs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
// Access should return if the caller can access the file with
// Access should return if the caller can access the file with
...
...
nodefs/cache_test.go
View file @
1ee3533f
...
@@ -19,7 +19,7 @@ import (
...
@@ -19,7 +19,7 @@ import (
)
)
type
keepCacheFile
struct
{
type
keepCacheFile
struct
{
DefaultOperation
s
OperationStub
s
keepCache
bool
keepCache
bool
mu
sync
.
Mutex
mu
sync
.
Mutex
...
@@ -62,7 +62,7 @@ func (f *keepCacheFile) Read(ctx context.Context, fh FileHandle, dest []byte, of
...
@@ -62,7 +62,7 @@ func (f *keepCacheFile) Read(ctx context.Context, fh FileHandle, dest []byte, of
}
}
type
keepCacheRoot
struct
{
type
keepCacheRoot
struct
{
DefaultOperation
s
OperationStub
s
keep
,
nokeep
*
keepCacheFile
keep
,
nokeep
*
keepCacheFile
}
}
...
...
nodefs/default.go
View file @
1ee3533f
...
@@ -12,25 +12,25 @@ import (
...
@@ -12,25 +12,25 @@ import (
"github.com/hanwen/go-fuse/internal"
"github.com/hanwen/go-fuse/internal"
)
)
//
DefaultOperation
s provides no-operation default implementations for
//
OperationStub
s provides no-operation default implementations for
// all the XxxOperations interfaces. The stubs provide useful defaults
// all the XxxOperations interfaces. The stubs provide useful defaults
// for implementing a read-only filesystem whose tree is constructed
// for implementing a read-only filesystem whose tree is constructed
// beforehand in the OnAdd method of the root. A example is in
// beforehand in the OnAdd method of the root. A example is in
// zip_test.go
// zip_test.go
//
//
// It must be embedded in any Operations implementation.
// It must be embedded in any Operations implementation.
type
DefaultOperation
s
struct
{
type
OperationStub
s
struct
{
inode_
Inode
inode_
Inode
}
}
// check that we have implemented all interface methods
// check that we have implemented all interface methods
var
_
Operations
=
&
DefaultOperation
s
{}
var
_
Operations
=
&
OperationStub
s
{}
func
(
n
*
DefaultOperation
s
)
inode
()
*
Inode
{
func
(
n
*
OperationStub
s
)
inode
()
*
Inode
{
return
&
n
.
inode_
return
&
n
.
inode_
}
}
func
(
n
*
DefaultOperation
s
)
init
(
ops
Operations
,
attr
NodeAttr
,
bridge
*
rawBridge
,
persistent
bool
)
{
func
(
n
*
OperationStub
s
)
init
(
ops
Operations
,
attr
NodeAttr
,
bridge
*
rawBridge
,
persistent
bool
)
{
n
.
inode_
=
Inode
{
n
.
inode_
=
Inode
{
ops
:
ops
,
ops
:
ops
,
nodeAttr
:
attr
,
nodeAttr
:
attr
,
...
@@ -44,35 +44,35 @@ func (n *DefaultOperations) init(ops Operations, attr NodeAttr, bridge *rawBridg
...
@@ -44,35 +44,35 @@ func (n *DefaultOperations) init(ops Operations, attr NodeAttr, bridge *rawBridg
}
}
// Inode returns the Inode for this Operations
// Inode returns the Inode for this Operations
func
(
n
*
DefaultOperation
s
)
Inode
()
*
Inode
{
func
(
n
*
OperationStub
s
)
Inode
()
*
Inode
{
return
&
n
.
inode_
return
&
n
.
inode_
}
}
// StatFs zeroes the out argument and returns OK. This is because OSX
// StatFs zeroes the out argument and returns OK. This is because OSX
// filesystems must define this, or the mount will not work.
// filesystems must define this, or the mount will not work.
func
(
n
*
DefaultOperation
s
)
StatFs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
StatFs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
syscall
.
Errno
{
// this should be defined on OSX, or the FS won't mount
// this should be defined on OSX, or the FS won't mount
*
out
=
fuse
.
StatfsOut
{}
*
out
=
fuse
.
StatfsOut
{}
return
OK
return
OK
}
}
// The default OnAdd does nothing.
// The default OnAdd does nothing.
func
(
n
*
DefaultOperation
s
)
OnAdd
(
ctx
context
.
Context
)
{
func
(
n
*
OperationStub
s
)
OnAdd
(
ctx
context
.
Context
)
{
}
}
// GetAttr zeroes out argument and returns OK.
// GetAttr zeroes out argument and returns OK.
func
(
n
*
DefaultOperation
s
)
GetAttr
(
ctx
context
.
Context
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
GetAttr
(
ctx
context
.
Context
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
*
out
=
fuse
.
AttrOut
{}
*
out
=
fuse
.
AttrOut
{}
return
OK
return
OK
}
}
func
(
n
*
DefaultOperation
s
)
SetAttr
(
ctx
context
.
Context
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
SetAttr
(
ctx
context
.
Context
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
return
syscall
.
EROFS
return
syscall
.
EROFS
}
}
// The Access default implementation checks traditional unix
// The Access default implementation checks traditional unix
// permissions of the GetAttr result agains the caller.
// permissions of the GetAttr result agains the caller.
func
(
n
*
DefaultOperation
s
)
Access
(
ctx
context
.
Context
,
mask
uint32
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Access
(
ctx
context
.
Context
,
mask
uint32
)
syscall
.
Errno
{
caller
,
ok
:=
fuse
.
FromContext
(
ctx
)
caller
,
ok
:=
fuse
.
FromContext
(
ctx
)
if
!
ok
{
if
!
ok
{
return
syscall
.
EINVAL
return
syscall
.
EINVAL
...
@@ -91,7 +91,7 @@ func (n *DefaultOperations) Access(ctx context.Context, mask uint32) syscall.Err
...
@@ -91,7 +91,7 @@ func (n *DefaultOperations) Access(ctx context.Context, mask uint32) syscall.Err
// FSetAttr delegates to the FileHandle's if f is not nil, or else to the
// FSetAttr delegates to the FileHandle's if f is not nil, or else to the
// Inode's SetAttr method.
// Inode's SetAttr method.
func
(
n
*
DefaultOperation
s
)
FSetAttr
(
ctx
context
.
Context
,
f
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
FSetAttr
(
ctx
context
.
Context
,
f
FileHandle
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
SetAttr
(
ctx
,
in
,
out
)
return
f
.
SetAttr
(
ctx
,
in
,
out
)
}
}
...
@@ -99,9 +99,9 @@ func (n *DefaultOperations) FSetAttr(ctx context.Context, f FileHandle, in *fuse
...
@@ -99,9 +99,9 @@ func (n *DefaultOperations) FSetAttr(ctx context.Context, f FileHandle, in *fuse
return
n
.
inode_
.
Operations
()
.
SetAttr
(
ctx
,
in
,
out
)
return
n
.
inode_
.
Operations
()
.
SetAttr
(
ctx
,
in
,
out
)
}
}
// The Lookup method on the
DefaultOperation
s type looks for an
// The Lookup method on the
OperationStub
s type looks for an
// existing child with the given name, or returns ENOENT.
// existing child with the given name, or returns ENOENT.
func
(
n
*
DefaultOperation
s
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Lookup
(
ctx
context
.
Context
,
name
string
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
ch
:=
n
.
inode
()
.
GetChild
(
name
)
ch
:=
n
.
inode
()
.
GetChild
(
name
)
if
ch
==
nil
{
if
ch
==
nil
{
return
nil
,
syscall
.
ENOENT
return
nil
,
syscall
.
ENOENT
...
@@ -114,32 +114,32 @@ func (n *DefaultOperations) Lookup(ctx context.Context, name string, out *fuse.E
...
@@ -114,32 +114,32 @@ func (n *DefaultOperations) Lookup(ctx context.Context, name string, out *fuse.E
}
}
// Mkdir returns EROFS
// Mkdir returns EROFS
func
(
n
*
DefaultOperation
s
)
Mkdir
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Mkdir
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
return
nil
,
syscall
.
EROFS
return
nil
,
syscall
.
EROFS
}
}
// Mknod returns EROFS
// Mknod returns EROFS
func
(
n
*
DefaultOperation
s
)
Mknod
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
dev
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Mknod
(
ctx
context
.
Context
,
name
string
,
mode
uint32
,
dev
uint32
,
out
*
fuse
.
EntryOut
)
(
*
Inode
,
syscall
.
Errno
)
{
return
nil
,
syscall
.
EROFS
return
nil
,
syscall
.
EROFS
}
}
// Rmdir returns EROFS
// Rmdir returns EROFS
func
(
n
*
DefaultOperation
s
)
Rmdir
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Rmdir
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
return
syscall
.
EROFS
return
syscall
.
EROFS
}
}
// Unlink returns EROFS
// Unlink returns EROFS
func
(
n
*
DefaultOperation
s
)
Unlink
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Unlink
(
ctx
context
.
Context
,
name
string
)
syscall
.
Errno
{
return
syscall
.
EROFS
return
syscall
.
EROFS
}
}
// The default OpenDir always succeeds
// The default OpenDir always succeeds
func
(
n
*
DefaultOperation
s
)
OpenDir
(
ctx
context
.
Context
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
OpenDir
(
ctx
context
.
Context
)
syscall
.
Errno
{
return
OK
return
OK
}
}
// The default ReadDir returns the list of children from the tree
// The default ReadDir returns the list of children from the tree
func
(
n
*
DefaultOperation
s
)
ReadDir
(
ctx
context
.
Context
)
(
DirStream
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
ReadDir
(
ctx
context
.
Context
)
(
DirStream
,
syscall
.
Errno
)
{
r
:=
[]
fuse
.
DirEntry
{}
r
:=
[]
fuse
.
DirEntry
{}
for
k
,
ch
:=
range
n
.
inode
()
.
Children
()
{
for
k
,
ch
:=
range
n
.
inode
()
.
Children
()
{
r
=
append
(
r
,
fuse
.
DirEntry
{
Mode
:
ch
.
Mode
(),
r
=
append
(
r
,
fuse
.
DirEntry
{
Mode
:
ch
.
Mode
(),
...
@@ -150,12 +150,12 @@ func (n *DefaultOperations) ReadDir(ctx context.Context) (DirStream, syscall.Err
...
@@ -150,12 +150,12 @@ func (n *DefaultOperations) ReadDir(ctx context.Context) (DirStream, syscall.Err
}
}
// Rename returns EROFS
// Rename returns EROFS
func
(
n
*
DefaultOperation
s
)
Rename
(
ctx
context
.
Context
,
name
string
,
newParent
Operations
,
newName
string
,
flags
uint32
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Rename
(
ctx
context
.
Context
,
name
string
,
newParent
Operations
,
newName
string
,
flags
uint32
)
syscall
.
Errno
{
return
syscall
.
EROFS
return
syscall
.
EROFS
}
}
// Read delegates to the FileHandle argument.
// Read delegates to the FileHandle argument.
func
(
n
*
DefaultOperation
s
)
Read
(
ctx
context
.
Context
,
f
FileHandle
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Read
(
ctx
context
.
Context
,
f
FileHandle
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Read
(
ctx
,
dest
,
off
)
return
f
.
Read
(
ctx
,
dest
,
off
)
}
}
...
@@ -163,17 +163,17 @@ func (n *DefaultOperations) Read(ctx context.Context, f FileHandle, dest []byte,
...
@@ -163,17 +163,17 @@ func (n *DefaultOperations) Read(ctx context.Context, f FileHandle, dest []byte,
}
}
// Symlink returns EROFS
// Symlink returns EROFS
func
(
n
*
DefaultOperation
s
)
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Symlink
(
ctx
context
.
Context
,
target
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
{
return
nil
,
syscall
.
EROFS
return
nil
,
syscall
.
EROFS
}
}
// Readlink return ENOTSUP
// Readlink return ENOTSUP
func
(
n
*
DefaultOperation
s
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Readlink
(
ctx
context
.
Context
)
([]
byte
,
syscall
.
Errno
)
{
return
nil
,
syscall
.
ENOTSUP
return
nil
,
syscall
.
ENOTSUP
}
}
// Fsync delegates to the FileHandle
// Fsync delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
Fsync
(
ctx
context
.
Context
,
f
FileHandle
,
flags
uint32
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Fsync
(
ctx
context
.
Context
,
f
FileHandle
,
flags
uint32
)
syscall
.
Errno
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Fsync
(
ctx
,
flags
)
return
f
.
Fsync
(
ctx
,
flags
)
}
}
...
@@ -181,7 +181,7 @@ func (n *DefaultOperations) Fsync(ctx context.Context, f FileHandle, flags uint3
...
@@ -181,7 +181,7 @@ func (n *DefaultOperations) Fsync(ctx context.Context, f FileHandle, flags uint3
}
}
// Write delegates to the FileHandle
// Write delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
Write
(
ctx
context
.
Context
,
f
FileHandle
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Write
(
ctx
context
.
Context
,
f
FileHandle
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Write
(
ctx
,
data
,
off
)
return
f
.
Write
(
ctx
,
data
,
off
)
}
}
...
@@ -189,13 +189,13 @@ func (n *DefaultOperations) Write(ctx context.Context, f FileHandle, data []byte
...
@@ -189,13 +189,13 @@ func (n *DefaultOperations) Write(ctx context.Context, f FileHandle, data []byte
return
0
,
syscall
.
EROFS
return
0
,
syscall
.
EROFS
}
}
func
(
n
*
DefaultOperation
s
)
CopyFileRange
(
ctx
context
.
Context
,
fhIn
FileHandle
,
func
(
n
*
OperationStub
s
)
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
)
{
return
0
,
syscall
.
EROFS
return
0
,
syscall
.
EROFS
}
}
func
(
n
*
DefaultOperation
s
)
Lseek
(
ctx
context
.
Context
,
f
FileHandle
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Lseek
(
ctx
context
.
Context
,
f
FileHandle
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Lseek
(
ctx
,
off
,
whence
)
return
f
.
Lseek
(
ctx
,
off
,
whence
)
}
}
...
@@ -203,7 +203,7 @@ func (n *DefaultOperations) Lseek(ctx context.Context, f FileHandle, off uint64,
...
@@ -203,7 +203,7 @@ func (n *DefaultOperations) Lseek(ctx context.Context, f FileHandle, off uint64,
}
}
// GetLk delegates to the FileHandlef
// GetLk delegates to the FileHandlef
func
(
n
*
DefaultOperation
s
)
GetLk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
(
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
GetLk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
(
errno
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
GetLk
(
ctx
,
owner
,
lk
,
flags
,
out
)
return
f
.
GetLk
(
ctx
,
owner
,
lk
,
flags
,
out
)
}
}
...
@@ -212,7 +212,7 @@ func (n *DefaultOperations) GetLk(ctx context.Context, f FileHandle, owner uint6
...
@@ -212,7 +212,7 @@ func (n *DefaultOperations) GetLk(ctx context.Context, f FileHandle, owner uint6
}
}
// SetLk delegates to the FileHandle
// SetLk delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
SetLk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
SetLk
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
SetLk
(
ctx
,
owner
,
lk
,
flags
)
return
f
.
SetLk
(
ctx
,
owner
,
lk
,
flags
)
}
}
...
@@ -221,7 +221,7 @@ func (n *DefaultOperations) SetLk(ctx context.Context, f FileHandle, owner uint6
...
@@ -221,7 +221,7 @@ func (n *DefaultOperations) SetLk(ctx context.Context, f FileHandle, owner uint6
}
}
// SetLkw delegates to the FileHandle
// SetLkw delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
SetLkw
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
SetLkw
(
ctx
context
.
Context
,
f
FileHandle
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
SetLkw
(
ctx
,
owner
,
lk
,
flags
)
return
f
.
SetLkw
(
ctx
,
owner
,
lk
,
flags
)
}
}
...
@@ -230,7 +230,7 @@ func (n *DefaultOperations) SetLkw(ctx context.Context, f FileHandle, owner uint
...
@@ -230,7 +230,7 @@ func (n *DefaultOperations) SetLkw(ctx context.Context, f FileHandle, owner uint
}
}
// Flush delegates to the FileHandle
// Flush delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
Flush
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Flush
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Flush
(
ctx
)
return
f
.
Flush
(
ctx
)
}
}
...
@@ -239,7 +239,7 @@ func (n *DefaultOperations) Flush(ctx context.Context, f FileHandle) syscall.Err
...
@@ -239,7 +239,7 @@ func (n *DefaultOperations) Flush(ctx context.Context, f FileHandle) syscall.Err
}
}
// Release delegates to the FileHandle
// Release delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
Release
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
Release
(
ctx
context
.
Context
,
f
FileHandle
)
syscall
.
Errno
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Release
(
ctx
)
return
f
.
Release
(
ctx
)
}
}
...
@@ -247,7 +247,7 @@ func (n *DefaultOperations) Release(ctx context.Context, f FileHandle) syscall.E
...
@@ -247,7 +247,7 @@ func (n *DefaultOperations) Release(ctx context.Context, f FileHandle) syscall.E
}
}
// Allocate delegates to the FileHandle
// Allocate delegates to the FileHandle
func
(
n
*
DefaultOperation
s
)
Allocate
(
ctx
context
.
Context
,
f
FileHandle
,
off
uint64
,
size
uint64
,
mode
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Allocate
(
ctx
context
.
Context
,
f
FileHandle
,
off
uint64
,
size
uint64
,
mode
uint32
)
(
errno
syscall
.
Errno
)
{
if
f
!=
nil
{
if
f
!=
nil
{
return
f
.
Allocate
(
ctx
,
off
,
size
,
mode
)
return
f
.
Allocate
(
ctx
,
off
,
size
,
mode
)
}
}
...
@@ -257,7 +257,7 @@ func (n *DefaultOperations) Allocate(ctx context.Context, f FileHandle, off uint
...
@@ -257,7 +257,7 @@ func (n *DefaultOperations) Allocate(ctx context.Context, f FileHandle, off uint
// FGetAttr delegates to the FileHandle's if f is not nil, or else to the
// FGetAttr delegates to the FileHandle's if f is not nil, or else to the
// Inode's GetAttr method.
// Inode's GetAttr method.
func
(
n
*
DefaultOperation
s
)
FGetAttr
(
ctx
context
.
Context
,
f
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
FGetAttr
(
ctx
context
.
Context
,
f
FileHandle
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
if
f
!=
nil
{
if
f
!=
nil
{
f
.
GetAttr
(
ctx
,
out
)
f
.
GetAttr
(
ctx
,
out
)
}
}
...
@@ -265,91 +265,91 @@ func (n *DefaultOperations) FGetAttr(ctx context.Context, f FileHandle, out *fus
...
@@ -265,91 +265,91 @@ func (n *DefaultOperations) FGetAttr(ctx context.Context, f FileHandle, out *fus
}
}
// Open returns ENOTSUP
// Open returns ENOTSUP
func
(
n
*
DefaultOperation
s
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Open
(
ctx
context
.
Context
,
flags
uint32
)
(
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
return
nil
,
0
,
syscall
.
ENOTSUP
return
nil
,
0
,
syscall
.
ENOTSUP
}
}
// Create returns ENOTSUP
// Create returns ENOTSUP
func
(
n
*
DefaultOperation
s
)
Create
(
ctx
context
.
Context
,
name
string
,
flags
uint32
,
mode
uint32
)
(
node
*
Inode
,
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Create
(
ctx
context
.
Context
,
name
string
,
flags
uint32
,
mode
uint32
)
(
node
*
Inode
,
fh
FileHandle
,
fuseFlags
uint32
,
errno
syscall
.
Errno
)
{
return
nil
,
nil
,
0
,
syscall
.
EROFS
return
nil
,
nil
,
0
,
syscall
.
EROFS
}
}
// Link returns ENOTSUP
// Link returns ENOTSUP
func
(
n
*
DefaultOperation
s
)
Link
(
ctx
context
.
Context
,
target
Operations
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
Link
(
ctx
context
.
Context
,
target
Operations
,
name
string
,
out
*
fuse
.
EntryOut
)
(
node
*
Inode
,
errno
syscall
.
Errno
)
{
return
nil
,
syscall
.
EROFS
return
nil
,
syscall
.
EROFS
}
}
// The default GetXAttr returns ENOATTR
// The default GetXAttr returns ENOATTR
func
(
n
*
DefaultOperation
s
)
GetXAttr
(
ctx
context
.
Context
,
attr
string
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
GetXAttr
(
ctx
context
.
Context
,
attr
string
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
{
return
0
,
ENOATTR
return
0
,
ENOATTR
}
}
// The default SetXAttr returns ENOATTR
// The default SetXAttr returns ENOATTR
func
(
n
*
DefaultOperation
s
)
SetXAttr
(
ctx
context
.
Context
,
attr
string
,
data
[]
byte
,
flags
uint32
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
SetXAttr
(
ctx
context
.
Context
,
attr
string
,
data
[]
byte
,
flags
uint32
)
syscall
.
Errno
{
return
syscall
.
EROFS
return
syscall
.
EROFS
}
}
// The default RemoveXAttr returns ENOATTR
// The default RemoveXAttr returns ENOATTR
func
(
n
*
DefaultOperation
s
)
RemoveXAttr
(
ctx
context
.
Context
,
attr
string
)
syscall
.
Errno
{
func
(
n
*
OperationStub
s
)
RemoveXAttr
(
ctx
context
.
Context
,
attr
string
)
syscall
.
Errno
{
return
ENOATTR
return
ENOATTR
}
}
// The default RemoveXAttr returns an empty list
// The default RemoveXAttr returns an empty list
func
(
n
*
DefaultOperation
s
)
ListXAttr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
{
func
(
n
*
OperationStub
s
)
ListXAttr
(
ctx
context
.
Context
,
dest
[]
byte
)
(
uint32
,
syscall
.
Errno
)
{
return
0
,
OK
return
0
,
OK
}
}
//
DefaultFileHandle
satisfies the FileHandle interface, and provides
//
FileHandleStubs
satisfies the FileHandle interface, and provides
// stub methods that return ENOTSUP for all operations.
// stub methods that return ENOTSUP for all operations.
type
DefaultFileHandle
struct
{
type
FileHandleStubs
struct
{
}
}
var
_
=
FileHandle
((
*
DefaultFileHandle
)(
nil
))
var
_
=
FileHandle
((
*
FileHandleStubs
)(
nil
))
func
(
f
*
DefaultFileHandle
)
Read
(
ctx
context
.
Context
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
Read
(
ctx
context
.
Context
,
dest
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
syscall
.
Errno
)
{
return
nil
,
syscall
.
ENOTSUP
return
nil
,
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
Write
(
ctx
context
.
Context
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
Write
(
ctx
context
.
Context
,
data
[]
byte
,
off
int64
)
(
written
uint32
,
errno
syscall
.
Errno
)
{
return
0
,
syscall
.
ENOTSUP
return
0
,
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
GetLk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
(
errno
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
GetLk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
,
out
*
fuse
.
FileLock
)
(
errno
syscall
.
Errno
)
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
SetLk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
SetLk
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
SetLkw
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
SetLkw
(
ctx
context
.
Context
,
owner
uint64
,
lk
*
fuse
.
FileLock
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
Flush
(
ctx
context
.
Context
)
syscall
.
Errno
{
func
(
f
*
FileHandleStubs
)
Flush
(
ctx
context
.
Context
)
syscall
.
Errno
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
Release
(
ctx
context
.
Context
)
syscall
.
Errno
{
func
(
f
*
FileHandleStubs
)
Release
(
ctx
context
.
Context
)
syscall
.
Errno
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
GetAttr
(
ctx
context
.
Context
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
func
(
f
*
FileHandleStubs
)
GetAttr
(
ctx
context
.
Context
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
SetAttr
(
ctx
context
.
Context
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
func
(
f
*
FileHandleStubs
)
SetAttr
(
ctx
context
.
Context
,
in
*
fuse
.
SetAttrIn
,
out
*
fuse
.
AttrOut
)
syscall
.
Errno
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
Allocate
(
ctx
context
.
Context
,
off
uint64
,
size
uint64
,
mode
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
Allocate
(
ctx
context
.
Context
,
off
uint64
,
size
uint64
,
mode
uint32
)
(
errno
syscall
.
Errno
)
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
Fsync
(
ctx
context
.
Context
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
Fsync
(
ctx
context
.
Context
,
flags
uint32
)
(
errno
syscall
.
Errno
)
{
return
syscall
.
ENOTSUP
return
syscall
.
ENOTSUP
}
}
func
(
f
*
DefaultFileHandle
)
Lseek
(
ctx
context
.
Context
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
{
func
(
f
*
FileHandleStubs
)
Lseek
(
ctx
context
.
Context
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
{
return
0
,
syscall
.
ENOTSUP
return
0
,
syscall
.
ENOTSUP
}
}
nodefs/directio_test.go
View file @
1ee3533f
...
@@ -17,7 +17,7 @@ import (
...
@@ -17,7 +17,7 @@ import (
)
)
type
dioRoot
struct
{
type
dioRoot
struct
{
DefaultOperation
s
OperationStub
s
}
}
func
(
r
*
dioRoot
)
OnAdd
(
ctx
context
.
Context
)
{
func
(
r
*
dioRoot
)
OnAdd
(
ctx
context
.
Context
)
{
...
@@ -27,7 +27,7 @@ func (r *dioRoot) OnAdd(ctx context.Context) {
...
@@ -27,7 +27,7 @@ func (r *dioRoot) OnAdd(ctx context.Context) {
// A file handle that pretends that every hole/data starts at
// A file handle that pretends that every hole/data starts at
// multiples of 1024
// multiples of 1024
type
dioFH
struct
{
type
dioFH
struct
{
DefaultFileHandle
FileHandleStubs
}
}
func
(
f
*
dioFH
)
Lseek
(
ctx
context
.
Context
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
{
func
(
f
*
dioFH
)
Lseek
(
ctx
context
.
Context
,
off
uint64
,
whence
uint32
)
(
uint64
,
syscall
.
Errno
)
{
...
@@ -42,7 +42,7 @@ func (fh *dioFH) Read(ctx context.Context, data []byte, off int64) (fuse.ReadRes
...
@@ -42,7 +42,7 @@ func (fh *dioFH) Read(ctx context.Context, data []byte, off int64) (fuse.ReadRes
// overrides Open so it can return a dioFH file handle
// overrides Open so it can return a dioFH file handle
type
dioFile
struct
{
type
dioFile
struct
{
DefaultOperation
s
OperationStub
s
}
}
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
)
{
...
...
nodefs/interrupt_test.go
View file @
1ee3533f
...
@@ -17,12 +17,12 @@ import (
...
@@ -17,12 +17,12 @@ import (
)
)
type
interruptRoot
struct
{
type
interruptRoot
struct
{
DefaultOperation
s
OperationStub
s
child
interruptOps
child
interruptOps
}
}
type
interruptOps
struct
{
type
interruptOps
struct
{
DefaultOperation
s
OperationStub
s
interrupted
bool
interrupted
bool
}
}
...
...
nodefs/loopback.go
View file @
1ee3533f
...
@@ -41,7 +41,7 @@ func (n *loopbackRoot) GetAttr(ctx context.Context, out *fuse.AttrOut) syscall.E
...
@@ -41,7 +41,7 @@ func (n *loopbackRoot) GetAttr(ctx context.Context, out *fuse.AttrOut) syscall.E
}
}
type
loopbackNode
struct
{
type
loopbackNode
struct
{
DefaultOperation
s
OperationStub
s
}
}
func
(
n
*
loopbackNode
)
root
()
*
loopbackRoot
{
func
(
n
*
loopbackNode
)
root
()
*
loopbackRoot
{
...
...
nodefs/zip_test.go
View file @
1ee3533f
...
@@ -106,7 +106,7 @@ func TestZipFS(t *testing.T) {
...
@@ -106,7 +106,7 @@ func TestZipFS(t *testing.T) {
// zipFile is a file read from a zip archive.
// zipFile is a file read from a zip archive.
type
zipFile
struct
{
type
zipFile
struct
{
DefaultOperation
s
OperationStub
s
file
*
zip
.
File
file
*
zip
.
File
mu
sync
.
Mutex
mu
sync
.
Mutex
...
@@ -157,7 +157,7 @@ func (zf *zipFile) Read(ctx context.Context, f FileHandle, dest []byte, off int6
...
@@ -157,7 +157,7 @@ func (zf *zipFile) Read(ctx context.Context, f FileHandle, dest []byte, off int6
// zipRoot is the root of the Zip filesystem. Its only functionality
// zipRoot is the root of the Zip filesystem. Its only functionality
// is populating the filesystem.
// is populating the filesystem.
type
zipRoot
struct
{
type
zipRoot
struct
{
DefaultOperation
s
OperationStub
s
r
*
zip
.
Reader
r
*
zip
.
Reader
}
}
...
@@ -177,7 +177,7 @@ func (zr *zipRoot) OnAdd(ctx context.Context) {
...
@@ -177,7 +177,7 @@ func (zr *zipRoot) OnAdd(ctx context.Context) {
}
}
ch
:=
p
.
GetChild
(
component
)
ch
:=
p
.
GetChild
(
component
)
if
ch
==
nil
{
if
ch
==
nil
{
ch
=
p
.
NewPersistentInode
(
ctx
,
&
DefaultOperation
s
{},
ch
=
p
.
NewPersistentInode
(
ctx
,
&
OperationStub
s
{},
NodeAttr
{
Mode
:
fuse
.
S_IFDIR
})
NodeAttr
{
Mode
:
fuse
.
S_IFDIR
})
p
.
AddChild
(
component
,
ch
,
true
)
p
.
AddChild
(
component
,
ch
,
true
)
}
}
...
...
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