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
e3e59d9d
Commit
e3e59d9d
authored
Mar 22, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: rename hidden struct variable
parent
9b950aa9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
nodefs/bridge.go
nodefs/bridge.go
+14
-14
nodefs/inode.go
nodefs/inode.go
+13
-13
No files found.
nodefs/bridge.go
View file @
e3e59d9d
...
@@ -90,7 +90,7 @@ func (b *rawBridge) newInode(ops Operations, id NodeAttr, persistent bool) *Inod
...
@@ -90,7 +90,7 @@ func (b *rawBridge) newInode(ops Operations, id NodeAttr, persistent bool) *Inod
inode
:=
&
Inode
{
inode
:=
&
Inode
{
ops
:
ops
,
ops
:
ops
,
node
ID
:
id
,
node
Attr
:
id
,
bridge
:
b
,
bridge
:
b
,
persistent
:
persistent
,
persistent
:
persistent
,
parents
:
make
(
map
[
parentData
]
struct
{}),
parents
:
make
(
map
[
parentData
]
struct
{}),
...
@@ -123,9 +123,9 @@ func (b *rawBridge) addNewChild(parent *Inode, name string, child *Inode, file F
...
@@ -123,9 +123,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
.
node
ID
.
Ino
out
.
NodeId
=
child
.
node
Attr
.
Ino
out
.
Generation
=
child
.
node
ID
.
Gen
out
.
Generation
=
child
.
node
Attr
.
Gen
out
.
Attr
.
Ino
=
child
.
node
ID
.
Ino
out
.
Attr
.
Ino
=
child
.
node
Attr
.
Ino
b
.
mu
.
Unlock
()
b
.
mu
.
Unlock
()
unlockNodes
(
parent
,
child
)
unlockNodes
(
parent
,
child
)
...
@@ -175,7 +175,7 @@ func NewNodeFS(root DirOperations, opts *Options) fuse.RawFileSystem {
...
@@ -175,7 +175,7 @@ func NewNodeFS(root DirOperations, opts *Options) fuse.RawFileSystem {
parents
:
nil
,
parents
:
nil
,
ops
:
root
,
ops
:
root
,
bridge
:
bridge
,
bridge
:
bridge
,
node
ID
:
NodeAttr
{
node
Attr
:
NodeAttr
{
Ino
:
1
,
Ino
:
1
,
Mode
:
fuse
.
S_IFDIR
,
Mode
:
fuse
.
S_IFDIR
,
},
},
...
@@ -221,7 +221,7 @@ func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name s
...
@@ -221,7 +221,7 @@ func (b *rawBridge) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name s
b
.
addNewChild
(
parent
,
name
,
child
,
nil
,
0
,
out
)
b
.
addNewChild
(
parent
,
name
,
child
,
nil
,
0
,
out
)
b
.
setEntryOutTimeout
(
out
)
b
.
setEntryOutTimeout
(
out
)
out
.
Mode
=
child
.
node
ID
.
Mode
|
(
out
.
Mode
&
07777
)
out
.
Mode
=
child
.
node
Attr
.
Mode
|
(
out
.
Mode
&
07777
)
return
fuse
.
OK
return
fuse
.
OK
}
}
...
@@ -321,12 +321,12 @@ func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
...
@@ -321,12 +321,12 @@ func (b *rawBridge) Create(cancel <-chan struct{}, input *fuse.CreateIn, name st
out
.
Attr
=
temp
.
Attr
out
.
Attr
=
temp
.
Attr
out
.
AttrValid
=
temp
.
AttrValid
out
.
AttrValid
=
temp
.
AttrValid
out
.
AttrValidNsec
=
temp
.
AttrValidNsec
out
.
AttrValidNsec
=
temp
.
AttrValidNsec
out
.
Attr
.
Ino
=
child
.
node
ID
.
Ino
out
.
Attr
.
Ino
=
child
.
node
Attr
.
Ino
out
.
Generation
=
child
.
node
ID
.
Gen
out
.
Generation
=
child
.
node
Attr
.
Gen
out
.
NodeId
=
child
.
node
ID
.
Ino
out
.
NodeId
=
child
.
node
Attr
.
Ino
b
.
setEntryOutTimeout
(
&
out
.
EntryOut
)
b
.
setEntryOutTimeout
(
&
out
.
EntryOut
)
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
child
.
node
ID
.
Mode
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
child
.
node
Attr
.
Mode
return
fuse
.
OK
return
fuse
.
OK
}
}
...
@@ -360,7 +360,7 @@ func (b *rawBridge) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *
...
@@ -360,7 +360,7 @@ func (b *rawBridge) GetAttr(cancel <-chan struct{}, input *fuse.GetAttrIn, out *
status
:=
fops
.
FGetAttr
(
ctx
,
f
,
out
)
status
:=
fops
.
FGetAttr
(
ctx
,
f
,
out
)
b
.
setAttrTimeout
(
out
)
b
.
setAttrTimeout
(
out
)
out
.
Ino
=
input
.
NodeId
out
.
Ino
=
input
.
NodeId
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
node
ID
.
Mode
out
.
Mode
=
(
out
.
Attr
.
Mode
&
07777
)
|
n
.
node
Attr
.
Mode
return
status
return
status
}
}
return
n
.
ops
.
GetAttr
(
ctx
,
out
)
return
n
.
ops
.
GetAttr
(
ctx
,
out
)
...
@@ -712,12 +712,12 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
...
@@ -712,12 +712,12 @@ func (b *rawBridge) ReadDirPlus(cancel <-chan struct{}, input *fuse.ReadIn, out
}
else
{
}
else
{
b
.
addNewChild
(
n
,
e
.
Name
,
child
,
nil
,
0
,
entryOut
)
b
.
addNewChild
(
n
,
e
.
Name
,
child
,
nil
,
0
,
entryOut
)
b
.
setEntryOutTimeout
(
entryOut
)
b
.
setEntryOutTimeout
(
entryOut
)
if
(
e
.
Mode
&^
07777
)
!=
(
child
.
node
ID
.
Mode
&^
07777
)
{
if
(
e
.
Mode
&^
07777
)
!=
(
child
.
node
Attr
.
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
.
node
ID
.
Mode
)
log
.
Panicf
(
"mode mismatch between readdir %o and lookup %o"
,
e
.
Mode
,
child
.
node
Attr
.
Mode
)
}
}
entryOut
.
Mode
=
child
.
node
ID
.
Mode
|
(
entryOut
.
Mode
&
07777
)
entryOut
.
Mode
=
child
.
node
Attr
.
Mode
|
(
entryOut
.
Mode
&
07777
)
}
}
}
}
...
...
nodefs/inode.go
View file @
e3e59d9d
...
@@ -51,7 +51,7 @@ func (i *NodeAttr) Reserved() bool {
...
@@ -51,7 +51,7 @@ func (i *NodeAttr) Reserved() bool {
// systems. One can create fully-formed trees of Inodes ahead of time
// systems. One can create fully-formed trees of Inodes ahead of time
// by creating "persistent" Inodes.
// by creating "persistent" Inodes.
type
Inode
struct
{
type
Inode
struct
{
node
ID
NodeAttr
node
Attr
NodeAttr
ops
Operations
ops
Operations
bridge
*
rawBridge
bridge
*
rawBridge
...
@@ -75,7 +75,7 @@ type Inode struct {
...
@@ -75,7 +75,7 @@ type Inode struct {
persistent
bool
persistent
bool
// changeCounter increments every time the below mutable state
// changeCounter increments every time the below mutable state
// (lookupCount, node
ID
, children, parents) is modified.
// (lookupCount, node
Attr
, children, parents) is modified.
//
//
// This is used in places where we have to relock inode into inode
// This is used in places where we have to relock inode into inode
// group lock, and after locking the group we have to check if inode
// group lock, and after locking the group we have to check if inode
...
@@ -103,27 +103,27 @@ func (n *Inode) linkOps() SymlinkOperations {
...
@@ -103,27 +103,27 @@ func (n *Inode) linkOps() SymlinkOperations {
// NodeAttr returns the (Ino, Gen) tuple for this node.
// NodeAttr returns the (Ino, Gen) tuple for this node.
func
(
n
*
Inode
)
NodeAttr
()
NodeAttr
{
func
(
n
*
Inode
)
NodeAttr
()
NodeAttr
{
return
n
.
node
ID
return
n
.
node
Attr
}
}
// Mode returns the filetype
// Mode returns the filetype
func
(
n
*
Inode
)
Mode
()
uint32
{
func
(
n
*
Inode
)
Mode
()
uint32
{
return
n
.
node
ID
.
Mode
return
n
.
node
Attr
.
Mode
}
}
// IsRoot returns true if this is the root of the FUSE mount.
// IsRoot returns true if this is the root of the FUSE mount.
func
(
n
*
Inode
)
IsRoot
()
bool
{
func
(
n
*
Inode
)
IsRoot
()
bool
{
return
n
.
node
ID
.
Ino
==
fuse
.
FUSE_ROOT_ID
return
n
.
node
Attr
.
Ino
==
fuse
.
FUSE_ROOT_ID
}
}
// debugString is used for debugging. Racy.
// debugString is used for debugging. Racy.
func
(
n
*
Inode
)
debugString
()
string
{
func
(
n
*
Inode
)
debugString
()
string
{
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"
,
nm
,
ch
.
node
ID
.
Ino
))
ss
=
append
(
ss
,
fmt
.
Sprintf
(
"%q=%d"
,
nm
,
ch
.
node
Attr
.
Ino
))
}
}
return
fmt
.
Sprintf
(
"%d: %s"
,
n
.
node
ID
,
strings
.
Join
(
ss
,
","
))
return
fmt
.
Sprintf
(
"%d: %s"
,
n
.
node
Attr
,
strings
.
Join
(
ss
,
","
))
}
}
// sortNodes rearranges inode group in consistent order.
// sortNodes rearranges inode group in consistent order.
...
@@ -352,7 +352,7 @@ retry:
...
@@ -352,7 +352,7 @@ retry:
}
}
n
.
bridge
.
mu
.
Lock
()
n
.
bridge
.
mu
.
Lock
()
delete
(
n
.
bridge
.
nodes
,
n
.
node
ID
.
Ino
)
delete
(
n
.
bridge
.
nodes
,
n
.
node
Attr
.
Ino
)
n
.
bridge
.
mu
.
Unlock
()
n
.
bridge
.
mu
.
Unlock
()
unlockNodes
(
lockme
...
)
unlockNodes
(
lockme
...
)
...
@@ -608,7 +608,7 @@ retry:
...
@@ -608,7 +608,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
)
fuse
.
Status
{
func
(
n
*
Inode
)
NotifyEntry
(
name
string
)
fuse
.
Status
{
return
n
.
bridge
.
server
.
EntryNotify
(
n
.
node
ID
.
Ino
,
name
)
return
n
.
bridge
.
server
.
EntryNotify
(
n
.
node
Attr
.
Ino
,
name
)
}
}
// NotifyDelete notifies the kernel that the given inode was removed
// NotifyDelete notifies the kernel that the given inode was removed
...
@@ -616,7 +616,7 @@ func (n *Inode) NotifyEntry(name string) fuse.Status {
...
@@ -616,7 +616,7 @@ func (n *Inode) NotifyEntry(name string) fuse.Status {
// 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
)
fuse
.
Status
{
func
(
n
*
Inode
)
NotifyDelete
(
name
string
,
child
*
Inode
)
fuse
.
Status
{
// XXX arg ordering?
// XXX arg ordering?
return
n
.
bridge
.
server
.
DeleteNotify
(
n
.
node
ID
.
Ino
,
child
.
nodeID
.
Ino
,
name
)
return
n
.
bridge
.
server
.
DeleteNotify
(
n
.
node
Attr
.
Ino
,
child
.
nodeAttr
.
Ino
,
name
)
}
}
...
@@ -624,16 +624,16 @@ func (n *Inode) NotifyDelete(name string, child *Inode) fuse.Status {
...
@@ -624,16 +624,16 @@ func (n *Inode) NotifyDelete(name string, child *Inode) fuse.Status {
// inode should be flushed from buffers.
// inode should be flushed from buffers.
func
(
n
*
Inode
)
NotifyContent
(
off
,
sz
int64
)
fuse
.
Status
{
func
(
n
*
Inode
)
NotifyContent
(
off
,
sz
int64
)
fuse
.
Status
{
// XXX how does this work for directories?
// XXX how does this work for directories?
return
n
.
bridge
.
server
.
InodeNotify
(
n
.
node
ID
.
Ino
,
off
,
sz
)
return
n
.
bridge
.
server
.
InodeNotify
(
n
.
node
Attr
.
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
)
fuse
.
Status
{
func
(
n
*
Inode
)
WriteCache
(
offset
int64
,
data
[]
byte
)
fuse
.
Status
{
return
n
.
bridge
.
server
.
InodeNotifyStoreCache
(
n
.
node
ID
.
Ino
,
offset
,
data
)
return
n
.
bridge
.
server
.
InodeNotifyStoreCache
(
n
.
node
Attr
.
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
,
status
fuse
.
Status
)
{
func
(
n
*
Inode
)
ReadCache
(
offset
int64
,
dest
[]
byte
)
(
count
int
,
status
fuse
.
Status
)
{
return
n
.
bridge
.
server
.
InodeRetrieveCache
(
n
.
node
ID
.
Ino
,
offset
,
dest
)
return
n
.
bridge
.
server
.
InodeRetrieveCache
(
n
.
node
Attr
.
Ino
,
offset
,
dest
)
}
}
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