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
d7fec860
Commit
d7fec860
authored
Mar 20, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flushFS.LookUpInode
parent
604281b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
samples/flushfs/flush_fs.go
samples/flushfs/flush_fs.go
+43
-1
No files found.
samples/flushfs/flush_fs.go
View file @
d7fec860
...
...
@@ -16,6 +16,7 @@ package flushfs
import
(
"os"
"sync"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseutil"
...
...
@@ -34,13 +35,31 @@ func NewFileSystem(
return
}
const
fooID
=
fuse
.
RootInodeID
+
1
type
flushFS
struct
{
fuseutil
.
NotImplementedFileSystem
mu
sync
.
Mu
mu
sync
.
Mu
tex
foo
*
os
.
File
// GUARDED_BY(mu)
}
////////////////////////////////////////////////////////////////////////
// Helpers
////////////////////////////////////////////////////////////////////////
// LOCKS_REQUIRED(fs.mu)
func
(
fs
*
flushFS
)
fooAttributes
()
fuse
.
InodeAttributes
{
return
fuse
.
InodeAttributes
{
Nlink
:
1
,
Mode
:
0777
,
}
}
////////////////////////////////////////////////////////////////////////
// File system methods
////////////////////////////////////////////////////////////////////////
func
(
fs
*
flushFS
)
Init
(
ctx
context
.
Context
,
req
*
fuse
.
InitRequest
)
(
...
...
@@ -48,3 +67,26 @@ func (fs *flushFS) Init(
resp
=
&
fuse
.
InitResponse
{}
return
}
func
(
fs
*
flushFS
)
LookUpInode
(
ctx
context
.
Context
,
req
*
fuse
.
LookUpInodeRequest
)
(
resp
*
fuse
.
LookUpInodeResponse
,
err
error
)
{
resp
=
&
fuse
.
LookUpInodeResponse
{}
fs
.
mu
.
Lock
()
defer
fs
.
mu
.
Unlock
()
// Sanity check.
if
req
.
Parent
!=
fuse
.
RootInodeID
||
req
.
Name
!=
"foo"
{
err
=
fuse
.
ENOENT
return
}
resp
.
Entry
=
fuse
.
ChildInodeEntry
{
Child
:
fooID
,
Attributes
:
fs
.
fooAttributes
(),
}
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