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
1f16ee66
Commit
1f16ee66
authored
Jun 22, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: Hide the RawFileSystem implementation of FileSystemConnector behind
the RawFS() method.
parent
e50569a4
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
50 deletions
+67
-50
example/loopback/main.go
example/loopback/main.go
+1
-1
fuse/fsconnector.go
fuse/fsconnector.go
+6
-12
fuse/fsops.go
fuse/fsops.go
+57
-34
fuse/fuse.go
fuse/fuse.go
+1
-1
fuse/memnode_test.go
fuse/memnode_test.go
+1
-1
fuse/test/loopback_test.go
fuse/test/loopback_test.go
+1
-1
No files found.
example/loopback/main.go
View file @
1f16ee66
...
...
@@ -43,7 +43,7 @@ func main() {
}
pathFs
:=
pathfs
.
NewPathNodeFs
(
finalFs
,
nil
)
conn
:=
fuse
.
NewFileSystemConnector
(
pathFs
,
opts
)
state
:=
fuse
.
NewMountState
(
conn
)
state
:=
fuse
.
NewMountState
(
conn
.
RawFS
()
)
state
.
SetDebug
(
*
debug
)
mountPoint
:=
flag
.
Arg
(
0
)
...
...
fuse/fsconnector.go
View file @
1f16ee66
...
...
@@ -21,22 +21,17 @@ var paranoia = false
// FilesystemConnector is a raw FUSE filesystem that manages
// in-process mounts and inodes. Its job is twofold:
//
//
*
It translates between the raw kernel interface (padded structs of
// It translates between the raw kernel interface (padded structs of
// int32 and int64) and the more abstract Go-ish NodeFileSystem
// interface.
//
// * It manages mounting and unmounting of NodeFileSystems into the
// directory hierarchy
//
// To achieve this, the connector only needs a pointer to the root
// node.
// It manages mounting and unmounting of NodeFileSystems into the
// directory hierarchy.
type
FileSystemConnector
struct
{
// Used as the generation inodes. This must be 64-bit aligned,
// for sync/atomic on i386 to work properly.
generation
uint64
DefaultRawFileSystem
debug
bool
// Callbacks for talking back to the kernel.
...
...
@@ -100,12 +95,11 @@ func (c *FileSystemConnector) verify() {
root
.
verify
(
c
.
rootNode
.
mountPoint
)
}
// Generate EntryOut and increase the lookup count for an inode.
func
(
c
*
FileSystemConnector
)
childLookup
(
out
*
raw
.
EntryOut
,
fsi
FsNode
)
{
func
(
c
*
rawBridge
)
childLookup
(
out
*
raw
.
EntryOut
,
fsi
FsNode
)
{
n
:=
fsi
.
Inode
()
fsi
.
GetAttr
((
*
Attr
)(
&
out
.
Attr
),
nil
,
nil
)
n
.
mount
.
fillEntry
(
out
)
out
.
Ino
=
c
.
lookupUpdate
(
n
)
out
.
Ino
=
c
.
fsConn
()
.
lookupUpdate
(
n
)
out
.
NodeId
=
out
.
Ino
if
out
.
Nlink
==
0
{
// With Nlink == 0, newer kernels will refuse link
...
...
@@ -114,7 +108,7 @@ func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) {
}
}
func
(
c
*
FileSystemConnector
)
toInode
(
nodeid
uint64
)
*
Inode
{
func
(
c
*
rawBridge
)
toInode
(
nodeid
uint64
)
*
Inode
{
if
nodeid
==
raw
.
FUSE_ROOT_ID
{
return
c
.
rootNode
}
...
...
fuse/fsops.go
View file @
1f16ee66
This diff is collapsed.
Click to expand it.
fuse/fuse.go
View file @
1f16ee66
...
...
@@ -6,7 +6,7 @@ var _ = log.Println
func
MountNodeFileSystem
(
mountpoint
string
,
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
(
*
MountState
,
*
FileSystemConnector
,
error
)
{
conn
:=
NewFileSystemConnector
(
nodeFs
,
opts
)
mountState
:=
NewMountState
(
conn
)
mountState
:=
NewMountState
(
conn
.
RawFS
()
)
err
:=
mountState
.
Mount
(
mountpoint
,
nil
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
fuse/memnode_test.go
View file @
1f16ee66
...
...
@@ -30,7 +30,7 @@ func setupMemNodeTest(t *testing.T) (wd string, fs *MemNodeFs, clean func()) {
NegativeTimeout
:
0.0
,
})
connector
.
SetDebug
(
VerboseTest
())
state
:=
NewMountState
(
connector
)
state
:=
NewMountState
(
connector
.
RawFS
()
)
state
.
Mount
(
mnt
,
nil
)
//me.state.SetDebug(false)
...
...
fuse/test/loopback_test.go
View file @
1f16ee66
...
...
@@ -84,7 +84,7 @@ func NewTestCase(t *testing.T) *testCase {
AttrTimeout
:
testTtl
,
NegativeTimeout
:
0.0
,
})
rfs
=
fuse
.
NewLockingRawFileSystem
(
me
.
connector
)
rfs
=
fuse
.
NewLockingRawFileSystem
(
me
.
connector
.
RawFS
()
)
me
.
connector
.
SetDebug
(
fuse
.
VerboseTest
())
me
.
state
=
fuse
.
NewMountState
(
rfs
)
...
...
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