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
Kirill Smelkov
go-fuse
Commits
bf68b2a6
Commit
bf68b2a6
authored
Feb 16, 2016
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse/nodefs: protect directory seek read/writes against data races.
parent
ba787fea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
fuse/nodefs/dir.go
fuse/nodefs/dir.go
+18
-3
No files found.
fuse/nodefs/dir.go
View file @
bf68b2a6
...
...
@@ -2,18 +2,30 @@ package nodefs
import
(
"log"
"sync"
"github.com/hanwen/go-fuse/fuse"
)
type
connectorDir
struct
{
node
Node
stream
[]
fuse
.
DirEntry
node
Node
rawFS
fuse
.
RawFileSystem
// Protect stream and lastOffset. These are written in case
// there is a seek on the directory.
mu
sync
.
Mutex
stream
[]
fuse
.
DirEntry
// lastOffset stores the last offset for a readdir. This lets
// readdir pick up changes to the directory made after opening
// it.
lastOffset
uint64
rawFS
fuse
.
RawFileSystem
}
func
(
d
*
connectorDir
)
ReadDir
(
input
*
fuse
.
ReadIn
,
out
*
fuse
.
DirEntryList
)
(
code
fuse
.
Status
)
{
d
.
mu
.
Lock
()
defer
d
.
mu
.
Unlock
()
if
d
.
stream
==
nil
{
return
fuse
.
OK
}
...
...
@@ -47,6 +59,9 @@ func (d *connectorDir) ReadDir(input *fuse.ReadIn, out *fuse.DirEntryList) (code
}
func
(
d
*
connectorDir
)
ReadDirPlus
(
input
*
fuse
.
ReadIn
,
out
*
fuse
.
DirEntryList
)
(
code
fuse
.
Status
)
{
d
.
mu
.
Lock
()
defer
d
.
mu
.
Unlock
()
if
d
.
stream
==
nil
{
return
fuse
.
OK
}
...
...
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