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
8d6ddcb2
Commit
8d6ddcb2
authored
Apr 08, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: more renaming
parent
0f2f00b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
nodefs/bridge.go
nodefs/bridge.go
+8
-8
nodefs/inode.go
nodefs/inode.go
+17
-17
No files found.
nodefs/bridge.go
View file @
8d6ddcb2
...
@@ -126,9 +126,9 @@ func (b *rawBridge) addNewChild(parent *Inode, name string, child *Inode, file F
...
@@ -126,9 +126,9 @@ func (b *rawBridge) addNewChild(parent *Inode, name string, child *Inode, file F
fh
=
b
.
registerFile
(
child
,
file
,
fileFlags
)
fh
=
b
.
registerFile
(
child
,
file
,
fileFlags
)
}
}
out
.
NodeId
=
child
.
nod
eAttr
.
Ino
out
.
NodeId
=
child
.
stabl
eAttr
.
Ino
out
.
Generation
=
child
.
nod
eAttr
.
Gen
out
.
Generation
=
child
.
stabl
eAttr
.
Gen
out
.
Attr
.
Ino
=
child
.
nod
eAttr
.
Ino
out
.
Attr
.
Ino
=
child
.
stabl
eAttr
.
Ino
b
.
mu
.
Unlock
()
b
.
mu
.
Unlock
()
unlockNodes
(
parent
,
child
)
unlockNodes
(
parent
,
child
)
...
@@ -406,8 +406,8 @@ func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fu
...
@@ -406,8 +406,8 @@ func (b *rawBridge) getattr(ctx context.Context, n *Inode, f FileHandle, out *fu
}
}
if
errno
==
0
{
if
errno
==
0
{
out
.
Ino
=
n
.
nod
eAttr
.
Ino
out
.
Ino
=
n
.
stabl
eAttr
.
Ino
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
nod
eAttr
.
Mode
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
stabl
eAttr
.
Mode
b
.
setAttr
(
&
out
.
Attr
)
b
.
setAttr
(
&
out
.
Attr
)
b
.
setAttrTimeout
(
out
)
b
.
setAttrTimeout
(
out
)
}
}
...
@@ -872,12 +872,12 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
...
@@ -872,12 +872,12 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
b
.
addNewChild
(
n
,
e
.
Name
,
child
,
nil
,
0
,
entryOut
)
b
.
addNewChild
(
n
,
e
.
Name
,
child
,
nil
,
0
,
entryOut
)
child
.
setEntryOut
(
entryOut
)
child
.
setEntryOut
(
entryOut
)
b
.
setEntryOutTimeout
(
entryOut
)
b
.
setEntryOutTimeout
(
entryOut
)
if
(
e
.
Mode
&^
07777
)
!=
(
child
.
nod
eAttr
.
Mode
&^
07777
)
{
if
(
e
.
Mode
&^
07777
)
!=
(
child
.
stabl
eAttr
.
Mode
&^
07777
)
{
// should go back and change the
// should go back and change the
// already serialized entry
// already serialized entry
log
.
Panicf
(
"mode mismatch between readdir %o and lookup %o"
,
e
.
Mode
,
child
.
nod
eAttr
.
Mode
)
log
.
Panicf
(
"mode mismatch between readdir %o and lookup %o"
,
e
.
Mode
,
child
.
stabl
eAttr
.
Mode
)
}
}
entryOut
.
Mode
=
child
.
nod
eAttr
.
Mode
|
(
entryOut
.
Mode
&
07777
)
entryOut
.
Mode
=
child
.
stabl
eAttr
.
Mode
|
(
entryOut
.
Mode
&
07777
)
}
}
}
}
...
...
nodefs/inode.go
View file @
8d6ddcb2
...
@@ -57,7 +57,7 @@ func (i *StableAttr) Reserved() bool {
...
@@ -57,7 +57,7 @@ func (i *StableAttr) Reserved() bool {
// copied. Inodes should be obtained by calling Inode.NewInode() or
// copied. Inodes should be obtained by calling Inode.NewInode() or
// Inode.NewPersistentInode().
// Inode.NewPersistentInode().
type
Inode
struct
{
type
Inode
struct
{
nod
eAttr
StableAttr
stabl
eAttr
StableAttr
ops
InodeEmbedder
ops
InodeEmbedder
bridge
*
rawBridge
bridge
*
rawBridge
...
@@ -97,7 +97,7 @@ type Inode struct {
...
@@ -97,7 +97,7 @@ type Inode struct {
}
}
func
(
n
*
Inode
)
IsDir
()
bool
{
func
(
n
*
Inode
)
IsDir
()
bool
{
return
n
.
nod
eAttr
.
Mode
&
syscall
.
S_IFDIR
!=
0
return
n
.
stabl
eAttr
.
Mode
&
syscall
.
S_IFDIR
!=
0
}
}
func
(
n
*
Inode
)
embed
()
*
Inode
{
func
(
n
*
Inode
)
embed
()
*
Inode
{
...
@@ -110,7 +110,7 @@ func (n *Inode) EmbeddedInode() *Inode {
...
@@ -110,7 +110,7 @@ func (n *Inode) EmbeddedInode() *Inode {
func
initInode
(
n
*
Inode
,
ops
InodeEmbedder
,
attr
StableAttr
,
bridge
*
rawBridge
,
persistent
bool
)
{
func
initInode
(
n
*
Inode
,
ops
InodeEmbedder
,
attr
StableAttr
,
bridge
*
rawBridge
,
persistent
bool
)
{
n
.
ops
=
ops
n
.
ops
=
ops
n
.
nod
eAttr
=
attr
n
.
stabl
eAttr
=
attr
n
.
bridge
=
bridge
n
.
bridge
=
bridge
n
.
persistent
=
persistent
n
.
persistent
=
persistent
n
.
parents
=
make
(
map
[
parentData
]
struct
{})
n
.
parents
=
make
(
map
[
parentData
]
struct
{})
...
@@ -121,19 +121,19 @@ func initInode(n *Inode, ops InodeEmbedder, attr StableAttr, bridge *rawBridge,
...
@@ -121,19 +121,19 @@ func initInode(n *Inode, ops InodeEmbedder, attr StableAttr, bridge *rawBridge,
// Set node ID and mode in EntryOut
// Set node ID and mode in EntryOut
func
(
n
*
Inode
)
setEntryOut
(
out
*
fuse
.
EntryOut
)
{
func
(
n
*
Inode
)
setEntryOut
(
out
*
fuse
.
EntryOut
)
{
out
.
NodeId
=
n
.
nod
eAttr
.
Ino
out
.
NodeId
=
n
.
stabl
eAttr
.
Ino
out
.
Ino
=
n
.
nod
eAttr
.
Ino
out
.
Ino
=
n
.
stabl
eAttr
.
Ino
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
nod
eAttr
.
Mode
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
stabl
eAttr
.
Mode
}
}
// StableAttr returns the (Ino, Gen) tuple for this node.
// StableAttr returns the (Ino, Gen) tuple for this node.
func
(
n
*
Inode
)
StableAttr
()
Nod
eAttr
{
func
(
n
*
Inode
)
StableAttr
()
Stabl
eAttr
{
return
n
.
nod
eAttr
return
n
.
stabl
eAttr
}
}
// Mode returns the filetype
// Mode returns the filetype
func
(
n
*
Inode
)
Mode
()
uint32
{
func
(
n
*
Inode
)
Mode
()
uint32
{
return
n
.
nod
eAttr
.
Mode
return
n
.
stabl
eAttr
.
Mode
}
}
// Returns the root of the tree
// Returns the root of the tree
...
@@ -159,10 +159,10 @@ func (n *Inode) String() string {
...
@@ -159,10 +159,10 @@ func (n *Inode) String() string {
defer
n
.
mu
.
Unlock
()
defer
n
.
mu
.
Unlock
()
var
ss
[]
string
var
ss
[]
string
for
nm
,
ch
:=
range
n
.
children
{
for
nm
,
ch
:=
range
n
.
children
{
ss
=
append
(
ss
,
fmt
.
Sprintf
(
"%q=%d[%s]"
,
nm
,
ch
.
nodeAttr
.
Ino
,
modeStr
(
ch
.
nod
eAttr
.
Mode
)))
ss
=
append
(
ss
,
fmt
.
Sprintf
(
"%q=%d[%s]"
,
nm
,
ch
.
stableAttr
.
Ino
,
modeStr
(
ch
.
stabl
eAttr
.
Mode
)))
}
}
return
fmt
.
Sprintf
(
"%d[%s]: %s"
,
n
.
nodeAttr
.
Ino
,
modeStr
(
n
.
nod
eAttr
.
Mode
),
strings
.
Join
(
ss
,
","
))
return
fmt
.
Sprintf
(
"%d[%s]: %s"
,
n
.
stableAttr
.
Ino
,
modeStr
(
n
.
stabl
eAttr
.
Mode
),
strings
.
Join
(
ss
,
","
))
}
}
// sortNodes rearranges inode group in consistent order.
// sortNodes rearranges inode group in consistent order.
...
@@ -391,7 +391,7 @@ retry:
...
@@ -391,7 +391,7 @@ retry:
}
}
n
.
bridge
.
mu
.
Lock
()
n
.
bridge
.
mu
.
Lock
()
delete
(
n
.
bridge
.
nodes
,
n
.
nod
eAttr
.
Ino
)
delete
(
n
.
bridge
.
nodes
,
n
.
stabl
eAttr
.
Ino
)
n
.
bridge
.
mu
.
Unlock
()
n
.
bridge
.
mu
.
Unlock
()
unlockNodes
(
lockme
...
)
unlockNodes
(
lockme
...
)
...
@@ -686,7 +686,7 @@ retry:
...
@@ -686,7 +686,7 @@ retry:
// tuple should be invalidated. On next access, a LOOKUP operation
// tuple should be invalidated. On next access, a LOOKUP operation
// will be started.
// will be started.
func
(
n
*
Inode
)
NotifyEntry
(
name
string
)
syscall
.
Errno
{
func
(
n
*
Inode
)
NotifyEntry
(
name
string
)
syscall
.
Errno
{
status
:=
n
.
bridge
.
server
.
EntryNotify
(
n
.
nod
eAttr
.
Ino
,
name
)
status
:=
n
.
bridge
.
server
.
EntryNotify
(
n
.
stabl
eAttr
.
Ino
,
name
)
return
syscall
.
Errno
(
status
)
return
syscall
.
Errno
(
status
)
}
}
...
@@ -695,7 +695,7 @@ func (n *Inode) NotifyEntry(name string) syscall.Errno {
...
@@ -695,7 +695,7 @@ func (n *Inode) NotifyEntry(name string) syscall.Errno {
// to NotifyEntry, but also sends an event to inotify watchers.
// to NotifyEntry, but also sends an event to inotify watchers.
func
(
n
*
Inode
)
NotifyDelete
(
name
string
,
child
*
Inode
)
syscall
.
Errno
{
func
(
n
*
Inode
)
NotifyDelete
(
name
string
,
child
*
Inode
)
syscall
.
Errno
{
// XXX arg ordering?
// XXX arg ordering?
return
syscall
.
Errno
(
n
.
bridge
.
server
.
DeleteNotify
(
n
.
nodeAttr
.
Ino
,
child
.
nod
eAttr
.
Ino
,
name
))
return
syscall
.
Errno
(
n
.
bridge
.
server
.
DeleteNotify
(
n
.
stableAttr
.
Ino
,
child
.
stabl
eAttr
.
Ino
,
name
))
}
}
...
@@ -703,16 +703,16 @@ func (n *Inode) NotifyDelete(name string, child *Inode) syscall.Errno {
...
@@ -703,16 +703,16 @@ func (n *Inode) NotifyDelete(name string, child *Inode) syscall.Errno {
// inode should be flushed from buffers.
// inode should be flushed from buffers.
func
(
n
*
Inode
)
NotifyContent
(
off
,
sz
int64
)
syscall
.
Errno
{
func
(
n
*
Inode
)
NotifyContent
(
off
,
sz
int64
)
syscall
.
Errno
{
// XXX how does this work for directories?
// XXX how does this work for directories?
return
syscall
.
Errno
(
n
.
bridge
.
server
.
InodeNotify
(
n
.
nod
eAttr
.
Ino
,
off
,
sz
))
return
syscall
.
Errno
(
n
.
bridge
.
server
.
InodeNotify
(
n
.
stabl
eAttr
.
Ino
,
off
,
sz
))
}
}
// WriteCache stores data in the kernel cache.
// WriteCache stores data in the kernel cache.
func
(
n
*
Inode
)
WriteCache
(
offset
int64
,
data
[]
byte
)
syscall
.
Errno
{
func
(
n
*
Inode
)
WriteCache
(
offset
int64
,
data
[]
byte
)
syscall
.
Errno
{
return
syscall
.
Errno
(
n
.
bridge
.
server
.
InodeNotifyStoreCache
(
n
.
nod
eAttr
.
Ino
,
offset
,
data
))
return
syscall
.
Errno
(
n
.
bridge
.
server
.
InodeNotifyStoreCache
(
n
.
stabl
eAttr
.
Ino
,
offset
,
data
))
}
}
// ReadCache reads data from the kernel cache.
// ReadCache reads data from the kernel cache.
func
(
n
*
Inode
)
ReadCache
(
offset
int64
,
dest
[]
byte
)
(
count
int
,
errno
syscall
.
Errno
)
{
func
(
n
*
Inode
)
ReadCache
(
offset
int64
,
dest
[]
byte
)
(
count
int
,
errno
syscall
.
Errno
)
{
c
,
s
:=
n
.
bridge
.
server
.
InodeRetrieveCache
(
n
.
nod
eAttr
.
Ino
,
offset
,
dest
)
c
,
s
:=
n
.
bridge
.
server
.
InodeRetrieveCache
(
n
.
stabl
eAttr
.
Ino
,
offset
,
dest
)
return
c
,
syscall
.
Errno
(
s
)
return
c
,
syscall
.
Errno
(
s
)
}
}
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