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
57cb4ccd
Commit
57cb4ccd
authored
Mar 03, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Outlined memFS.RmDir.
parent
63408f6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
samples/memfs/fs.go
samples/memfs/fs.go
+23
-0
samples/memfs/inode.go
samples/memfs/inode.go
+7
-0
No files found.
samples/memfs/fs.go
View file @
57cb4ccd
...
...
@@ -294,6 +294,29 @@ func (fs *memFS) MkDir(
return
}
func
(
fs
*
memFS
)
RmDir
(
ctx
context
.
Context
,
req
*
fuse
.
RmDirRequest
)
(
resp
*
fuse
.
RmDirResponse
,
err
error
)
{
resp
=
&
fuse
.
RmDirResponse
{}
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Grab the parent, which we will update shortly.
parent
:=
fs
.
getInodeForModifyingOrDie
(
req
.
Parent
)
defer
parent
.
mu
.
Unlock
()
// TODO(jacobsa): Check for empty. (Make sure we have a failing test first.)
// Remove the entry within the parent.
parent
.
RemoveChild
(
req
.
Name
)
// TODO(jacobsa): Remove the child when it's forgotten. (Can we get a failing
// test by looking at inode ID allocation?)
return
}
func
(
fs
*
memFS
)
OpenDir
(
ctx
context
.
Context
,
req
*
fuse
.
OpenDirRequest
)
(
resp
*
fuse
.
OpenDirResponse
,
err
error
)
{
...
...
samples/memfs/inode.go
View file @
57cb4ccd
...
...
@@ -158,6 +158,13 @@ func (inode *inode) AddChild(
inode
.
entries
=
append
(
inode
.
entries
,
e
)
}
// Remove an entry for a child.
//
// REQUIRES: inode.dir
// REQUIRES: An entry for the given name exists.
// EXCLUSIVE_LOCKS_REQUIRED(inode.mu)
func
(
inode
*
inode
)
RemoveChild
(
name
string
)
// Serve a ReadDir request.
//
// REQUIRED: inode.dir
...
...
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