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
2e7ac1c4
Commit
2e7ac1c4
authored
May 19, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No reader locks.
parent
5184f42e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
samples/memfs/fs.go
samples/memfs/fs.go
+24
-24
No files found.
samples/memfs/fs.go
View file @
2e7ac1c4
...
...
@@ -160,7 +160,7 @@ func (fs *memFS) getInodeForReadingOrDie(id fuseops.InodeID) (inode *inode) {
panic
(
fmt
.
Sprintf
(
"Unknown inode: %v"
,
id
))
}
inode
.
mu
.
R
Lock
()
inode
.
mu
.
Lock
()
return
}
...
...
@@ -212,12 +212,12 @@ func (fs *memFS) LookUpInode(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Grab the parent directory.
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Parent
)
defer
inode
.
mu
.
R
Unlock
()
defer
inode
.
mu
.
Unlock
()
// Does the directory have an entry with the given name?
childID
,
ok
:=
inode
.
LookUpChild
(
op
.
Name
)
...
...
@@ -228,7 +228,7 @@ func (fs *memFS) LookUpInode(
// Grab the child.
child
:=
fs
.
getInodeForReadingOrDie
(
childID
)
defer
child
.
mu
.
R
Unlock
()
defer
child
.
mu
.
Unlock
()
// Fill in the response.
op
.
Entry
.
Child
=
childID
...
...
@@ -247,12 +247,12 @@ func (fs *memFS) GetInodeAttributes(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Grab the inode.
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Inode
)
defer
inode
.
mu
.
R
Unlock
()
defer
inode
.
mu
.
Unlock
()
// Fill in the response.
op
.
Attributes
=
inode
.
attributes
...
...
@@ -269,8 +269,8 @@ func (fs *memFS) SetInodeAttributes(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Grab the inode.
inode
:=
fs
.
getInodeForModifyingOrDie
(
op
.
Inode
)
...
...
@@ -451,14 +451,14 @@ func (fs *memFS) OpenDir(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// We don't mutate spontaneosuly, so if the VFS layer has asked for an
// inode that doesn't exist, something screwed up earlier (a lookup, a
// cache invalidation, etc.).
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Inode
)
defer
inode
.
mu
.
R
Unlock
()
defer
inode
.
mu
.
Unlock
()
if
!
inode
.
dir
{
panic
(
"Found non-dir."
)
...
...
@@ -472,12 +472,12 @@ func (fs *memFS) ReadDir(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Grab the directory.
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Inode
)
defer
inode
.
mu
.
R
Unlock
()
defer
inode
.
mu
.
Unlock
()
// Serve the request.
op
.
Data
,
err
=
inode
.
ReadDir
(
int
(
op
.
Offset
),
op
.
Size
)
...
...
@@ -494,14 +494,14 @@ func (fs *memFS) OpenFile(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// We don't mutate spontaneosuly, so if the VFS layer has asked for an
// inode that doesn't exist, something screwed up earlier (a lookup, a
// cache invalidation, etc.).
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Inode
)
defer
inode
.
mu
.
R
Unlock
()
defer
inode
.
mu
.
Unlock
()
if
inode
.
dir
{
panic
(
"Found directory."
)
...
...
@@ -515,12 +515,12 @@ func (fs *memFS) ReadFile(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Find the inode in question.
inode
:=
fs
.
getInodeForReadingOrDie
(
op
.
Inode
)
defer
inode
.
mu
.
R
Unlock
()
defer
inode
.
mu
.
Unlock
()
// Serve the request.
op
.
Data
=
make
([]
byte
,
op
.
Size
)
...
...
@@ -540,8 +540,8 @@ func (fs *memFS) WriteFile(
var
err
error
defer
fuseutil
.
RespondToOp
(
op
,
&
err
)
fs
.
mu
.
R
Lock
()
defer
fs
.
mu
.
R
Unlock
()
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Find the inode in question.
inode
:=
fs
.
getInodeForModifyingOrDie
(
op
.
Inode
)
...
...
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