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
f8379610
Commit
f8379610
authored
Mar 01, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nodefs: store open flags in openFiles map
parent
6267f14d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
nodefs/loopback.go
nodefs/loopback.go
+8
-6
No files found.
nodefs/loopback.go
View file @
f8379610
...
@@ -23,7 +23,7 @@ type loopbackRoot struct {
...
@@ -23,7 +23,7 @@ type loopbackRoot struct {
func
(
n
*
loopbackRoot
)
newLoopbackNode
()
*
loopbackNode
{
func
(
n
*
loopbackRoot
)
newLoopbackNode
()
*
loopbackNode
{
return
&
loopbackNode
{
return
&
loopbackNode
{
rootNode
:
n
,
rootNode
:
n
,
openFiles
:
map
[
*
loopbackFile
]
struct
{}
{},
openFiles
:
map
[
*
loopbackFile
]
uint32
{},
}
}
}
}
...
@@ -44,7 +44,9 @@ type loopbackNode struct {
...
@@ -44,7 +44,9 @@ type loopbackNode struct {
rootNode
*
loopbackRoot
rootNode
*
loopbackRoot
mu
sync
.
Mutex
mu
sync
.
Mutex
openFiles
map
[
*
loopbackFile
]
struct
{}
// file => openflags
openFiles
map
[
*
loopbackFile
]
uint32
}
}
func
(
n
*
loopbackNode
)
Release
(
ctx
context
.
Context
,
f
FileHandle
)
{
func
(
n
*
loopbackNode
)
Release
(
ctx
context
.
Context
,
f
FileHandle
)
{
...
@@ -177,7 +179,7 @@ func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mo
...
@@ -177,7 +179,7 @@ func (n *loopbackNode) Create(ctx context.Context, name string, flags uint32, mo
lf
:=
newLoopbackFile
(
f
)
lf
:=
newLoopbackFile
(
f
)
n
.
mu
.
Lock
()
n
.
mu
.
Lock
()
defer
n
.
mu
.
Unlock
()
defer
n
.
mu
.
Unlock
()
n
.
openFiles
[
lf
]
=
struct
{}{}
n
.
openFiles
[
lf
]
=
flags
|
syscall
.
O_CREAT
return
ch
,
lf
,
0
,
fuse
.
OK
return
ch
,
lf
,
0
,
fuse
.
OK
}
}
...
@@ -190,7 +192,7 @@ func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh FileHandle, f
...
@@ -190,7 +192,7 @@ func (n *loopbackNode) Open(ctx context.Context, flags uint32) (fh FileHandle, f
n
.
mu
.
Lock
()
n
.
mu
.
Lock
()
defer
n
.
mu
.
Unlock
()
defer
n
.
mu
.
Unlock
()
lf
:=
newLoopbackFile
(
f
)
lf
:=
newLoopbackFile
(
f
)
n
.
openFiles
[
lf
]
=
struct
{}{}
n
.
openFiles
[
lf
]
=
flags
return
lf
,
0
,
fuse
.
OK
return
lf
,
0
,
fuse
.
OK
}
}
...
@@ -232,6 +234,6 @@ func NewLoopback(root string) Operations {
...
@@ -232,6 +234,6 @@ func NewLoopback(root string) Operations {
root
:
root
,
root
:
root
,
}
}
n
.
rootNode
=
n
n
.
rootNode
=
n
n
.
openFiles
=
map
[
*
loopbackFile
]
struct
{}
{}
n
.
openFiles
=
map
[
*
loopbackFile
]
uint32
{}
return
n
return
n
}
}
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