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
7059718c
Commit
7059718c
authored
Mar 22, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: Inode.Parent and Inode.Parents method
parent
e3e59d9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
nodefs/inode.go
nodefs/inode.go
+23
-0
No files found.
nodefs/inode.go
View file @
7059718c
...
...
@@ -430,6 +430,29 @@ func (n *Inode) Children() map[string]*Inode {
return
r
}
// Parents returns the parents of this Inode, along with the name
// with which they're are a child
func
(
n
*
Inode
)
Parents
()
map
[
string
]
*
Inode
{
n
.
mu
.
Lock
()
defer
n
.
mu
.
Unlock
()
r
:=
make
(
map
[
string
]
*
Inode
,
len
(
n
.
parents
))
for
k
:=
range
n
.
parents
{
r
[
k
.
name
]
=
k
.
parent
}
return
r
}
// Parents returns a parent of this Inode, or nil if this Inode is
// deleted or is the root
func
(
n
*
Inode
)
Parent
()
(
string
,
*
Inode
)
{
n
.
mu
.
Lock
()
defer
n
.
mu
.
Unlock
()
for
k
:=
range
n
.
parents
{
return
k
.
name
,
k
.
parent
}
return
""
,
nil
}
// RmChild removes multiple children. Returns whether the removal
// succeeded and whether the node is still live afterward. The removal
// is transactional: it only succeeds if all names are children, and
...
...
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