Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
jacobsa-fuse
Commits
5532e21b
Commit
5532e21b
authored
Jun 25, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed build errors.
parent
1d764bcd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
13 deletions
+17
-13
samples/memfs/inode.go
samples/memfs/inode.go
+5
-1
samples/memfs/memfs.go
samples/memfs/memfs.go
+12
-12
No files found.
samples/memfs/inode.go
View file @
5532e21b
...
...
@@ -202,10 +202,14 @@ func (in *inode) Len() (n int) {
// Find an entry for the given child name and return its inode ID.
//
// REQUIRES: in.isDir()
func
(
in
*
inode
)
LookUpChild
(
name
string
)
(
id
fuseops
.
InodeID
,
ok
bool
)
{
func
(
in
*
inode
)
LookUpChild
(
name
string
)
(
id
fuseops
.
InodeID
,
typ
fuseutil
.
DirentType
,
ok
bool
)
{
index
,
ok
:=
in
.
findChild
(
name
)
if
ok
{
id
=
in
.
entries
[
index
]
.
Inode
typ
=
in
.
entries
[
index
]
.
Type
}
return
...
...
samples/memfs/memfs.go
View file @
5532e21b
...
...
@@ -192,7 +192,7 @@ func (fs *memFS) LookUpInode(
inode
:=
fs
.
getInodeOrDie
(
op
.
Parent
)
// Does the directory have an entry with the given name?
childID
,
ok
:=
inode
.
LookUpChild
(
op
.
Name
)
childID
,
_
,
ok
:=
inode
.
LookUpChild
(
op
.
Name
)
if
!
ok
{
err
=
fuse
.
ENOENT
return
...
...
@@ -262,7 +262,7 @@ func (fs *memFS) MkDir(
// Ensure that the name doesn't already exist, so we don't wind up with a
// duplicate.
_
,
exists
:=
parent
.
LookUpChild
(
op
.
Name
)
_
,
_
,
exists
:=
parent
.
LookUpChild
(
op
.
Name
)
if
exists
{
err
=
fuse
.
EEXIST
return
...
...
@@ -305,7 +305,7 @@ func (fs *memFS) CreateFile(
// Ensure that the name doesn't already exist, so we don't wind up with a
// duplicate.
_
,
exists
:=
parent
.
LookUpChild
(
op
.
Name
)
_
,
_
,
exists
:=
parent
.
LookUpChild
(
op
.
Name
)
if
exists
{
err
=
fuse
.
EEXIST
return
...
...
@@ -355,7 +355,7 @@ func (fs *memFS) CreateSymlink(
// Ensure that the name doesn't already exist, so we don't wind up with a
// duplicate.
_
,
exists
:=
parent
.
LookUpChild
(
op
.
Name
)
_
,
_
,
exists
:=
parent
.
LookUpChild
(
op
.
Name
)
if
exists
{
err
=
fuse
.
EEXIST
return
...
...
@@ -406,7 +406,7 @@ func (fs *memFS) Rename(
// the name changing, because the kernel needs to hold a lock on each of the
// parents.
oldParent
:=
fs
.
getInodeOrDie
(
op
.
OldParent
)
childID
,
ok
:=
oldParent
.
LookUpChild
(
op
.
OldName
)
childID
,
childType
,
ok
:=
oldParent
.
LookUpChild
(
op
.
OldName
)
oldParent
.
mu
.
Unlock
()
if
!
ok
{
...
...
@@ -417,7 +417,7 @@ func (fs *memFS) Rename(
// If the new name exists in the new parent, delete it first. Then link in
// the child.
newParent
:=
fs
.
getInodeOrDie
(
op
.
NewParent
)
_
,
ok
=
newParent
.
LookUpChild
(
op
.
NewName
)
_
,
_
,
ok
=
newParent
.
LookUpChild
(
op
.
NewName
)
if
ok
{
newParent
.
RemoveChild
(
op
.
NewName
)
}
...
...
@@ -425,14 +425,14 @@ func (fs *memFS) Rename(
newParent
.
AddChild
(
childID
,
op
.
NewName
,
TODO_
Type
)
child
Type
)
newParent
.
Unlock
()
newParent
.
mu
.
Unlock
()
// Finally, remove the old name from the old parent.
oldParent
.
Lock
()
oldParent
.
mu
.
Lock
()
oldParent
.
RemoveChild
(
op
.
OldName
)
oldParent
.
Unlock
()
oldParent
.
mu
.
Unlock
()
return
}
...
...
@@ -446,7 +446,7 @@ func (fs *memFS) RmDir(
parent
:=
fs
.
getInodeOrDie
(
op
.
Parent
)
// Find the child within the parent.
childID
,
ok
:=
parent
.
LookUpChild
(
op
.
Name
)
childID
,
_
,
ok
:=
parent
.
LookUpChild
(
op
.
Name
)
if
!
ok
{
err
=
fuse
.
ENOENT
return
...
...
@@ -479,7 +479,7 @@ func (fs *memFS) Unlink(
parent
:=
fs
.
getInodeOrDie
(
op
.
Parent
)
// Find the child within the parent.
childID
,
ok
:=
parent
.
LookUpChild
(
op
.
Name
)
childID
,
_
,
ok
:=
parent
.
LookUpChild
(
op
.
Name
)
if
!
ok
{
err
=
fuse
.
ENOENT
return
...
...
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