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
d1c9d5a4
Commit
d1c9d5a4
authored
Mar 22, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: provide Operations.Inode() as fluent interface
parent
bece857c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
7 deletions
+17
-7
nodefs/api.go
nodefs/api.go
+7
-2
nodefs/default.go
nodefs/default.go
+5
-0
nodefs/loopback_linux.go
nodefs/loopback_linux.go
+2
-2
nodefs/simple_test.go
nodefs/simple_test.go
+1
-1
nodefs/zip_test.go
nodefs/zip_test.go
+2
-2
No files found.
nodefs/api.go
View file @
d1c9d5a4
...
...
@@ -35,8 +35,8 @@
// infrastructure needs to lookup children of nodes to process client
// requests. For every new Operations, the filesystem infrastructure
// automatically builds new index node and links it in the filesystem
// tree.
InodeOf can be used to get particular Inode associated with
// a Operations.
// tree.
Operations.Inode() can be used to get particular Inode
// a
ssociated with a
Operations.
//
// The kernel can evict inode data to free up memory. It does so by
// issuing FORGET calls. When a node has no children, and no kernel
...
...
@@ -83,6 +83,11 @@ type Operations interface {
inode
()
*
Inode
setInode
(
*
Inode
)
bool
// Inode() is a convenience method, and is equivalent to
// InodeOf(ops) It is provided by DefaultOperations, and
// should not be reimplemented.
Inode
()
*
Inode
// StatFs implements statistics for the filesystem that holds
// this Inode. DefaultNode implements this, because OSX
// filesystem must have a valid StatFs implementation.
...
...
nodefs/default.go
View file @
d1c9d5a4
...
...
@@ -55,6 +55,11 @@ func (n *DefaultOperations) inode() *Inode {
(
*
unsafe
.
Pointer
)(
unsafe
.
Pointer
(
&
n
.
inode_
))))
}
// Inode is syntactic sugar for InodeOf(ops).
func
(
n
*
DefaultOperations
)
Inode
()
*
Inode
{
return
n
.
inode
()
}
// StatFs zeroes the out argument and returns OK. This is because OSX
// filesystems must define this, or the mount will not work.
func
(
n
*
DefaultOperations
)
StatFs
(
ctx
context
.
Context
,
out
*
fuse
.
StatfsOut
)
fuse
.
Status
{
...
...
nodefs/loopback_linux.go
View file @
d1c9d5a4
...
...
@@ -48,13 +48,13 @@ func (n *loopbackNode) renameExchange(name string, newparent *loopbackNode, newN
if
err
:=
syscall
.
Fstat
(
fd1
,
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
InodeOf
(
n
)
.
IsRoot
()
&&
InodeOf
(
n
)
.
NodeAttr
()
.
Ino
!=
n
.
rootNode
.
idFromStat
(
&
st
)
.
Ino
{
if
!
n
.
Inode
(
)
.
IsRoot
()
&&
InodeOf
(
n
)
.
NodeAttr
()
.
Ino
!=
n
.
rootNode
.
idFromStat
(
&
st
)
.
Ino
{
return
fuse
.
EBUSY
}
if
err
:=
syscall
.
Fstat
(
fd2
,
&
st
);
err
!=
nil
{
return
fuse
.
ToStatus
(
err
)
}
if
!
InodeOf
(
newparent
)
.
IsRoot
()
&&
InodeOf
(
newparent
)
.
NodeAttr
()
.
Ino
!=
n
.
rootNode
.
idFromStat
(
&
st
)
.
Ino
{
if
!
newparent
.
Inode
(
)
.
IsRoot
()
&&
InodeOf
(
newparent
)
.
NodeAttr
()
.
Ino
!=
n
.
rootNode
.
idFromStat
(
&
st
)
.
Ino
{
return
fuse
.
EBUSY
}
...
...
nodefs/simple_test.go
View file @
d1c9d5a4
...
...
@@ -529,7 +529,7 @@ func TestNotifyEntry(t *testing.T) {
t
.
Fatalf
(
"got after %#v, want %#v"
,
after
,
st
)
}
if
code
:=
InodeOf
(
tc
.
loopback
)
.
NotifyEntry
(
"file"
);
!
code
.
Ok
()
{
if
code
:=
tc
.
loopback
.
Inode
(
)
.
NotifyEntry
(
"file"
);
!
code
.
Ok
()
{
t
.
Errorf
(
"notify failed: %v"
,
code
)
}
...
...
nodefs/zip_test.go
View file @
d1c9d5a4
...
...
@@ -182,14 +182,14 @@ func (zr *zipRoot) OnAdd(ctx context.Context) {
}
ch
:=
p
.
GetChild
(
component
)
if
ch
==
nil
{
ch
=
InodeOf
(
zr
)
.
NewPersistentInode
(
ctx
,
&
DefaultOperations
{},
ch
=
p
.
NewPersistentInode
(
ctx
,
&
DefaultOperations
{},
NodeAttr
{
Mode
:
fuse
.
S_IFDIR
})
p
.
AddChild
(
component
,
ch
,
true
)
}
p
=
ch
}
ch
:=
InodeOf
(
zr
)
.
NewPersistentInode
(
ctx
,
&
zipFile
{
file
:
f
},
NodeAttr
{})
ch
:=
p
.
NewPersistentInode
(
ctx
,
&
zipFile
{
file
:
f
},
NodeAttr
{})
p
.
AddChild
(
base
,
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