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
f3e1921c
Commit
f3e1921c
authored
Sep 05, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mount NodeFileSystem rather than (Path)FileSystem.
parent
66f65406
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
39 additions
and
34 deletions
+39
-34
fuse/cache_test.go
fuse/cache_test.go
+2
-2
fuse/fsconnector.go
fuse/fsconnector.go
+9
-11
fuse/fsetattr_test.go
fuse/fsetattr_test.go
+1
-1
fuse/fuse.go
fuse/fuse.go
+7
-2
fuse/loopback_test.go
fuse/loopback_test.go
+3
-2
fuse/mount_test.go
fuse/mount_test.go
+7
-7
fuse/notify_test.go
fuse/notify_test.go
+1
-1
fuse/owner_test.go
fuse/owner_test.go
+1
-1
fuse/pathdebug_test.go
fuse/pathdebug_test.go
+1
-1
fuse/xattr_test.go
fuse/xattr_test.go
+1
-1
unionfs/autounion.go
unionfs/autounion.go
+2
-1
unionfs/autounion_test.go
unionfs/autounion_test.go
+1
-1
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+2
-2
zipfs/multizip.go
zipfs/multizip.go
+1
-1
No files found.
fuse/cache_test.go
View file @
f3e1921c
...
...
@@ -33,7 +33,7 @@ func setupCacheTest() (string, *FileSystemConnector, func()) {
fs
:=
&
cacheFs
{
LoopbackFileSystem
:
NewLoopbackFileSystem
(
dir
+
"/orig"
),
}
state
,
conn
,
err
:=
MountFileSystem
(
dir
+
"/mnt"
,
fs
,
nil
)
state
,
conn
,
err
:=
Mount
Path
FileSystem
(
dir
+
"/mnt"
,
fs
,
nil
)
CheckSuccess
(
err
)
state
.
Debug
=
true
conn
.
Debug
=
true
...
...
@@ -116,7 +116,7 @@ func TestNonseekable(t *testing.T) {
dir
:=
MakeTempDir
()
defer
os
.
RemoveAll
(
dir
)
state
,
_
,
err
:=
MountFileSystem
(
dir
,
fs
,
nil
)
state
,
_
,
err
:=
Mount
Path
FileSystem
(
dir
,
fs
,
nil
)
CheckSuccess
(
err
)
state
.
Debug
=
true
defer
state
.
Unmount
()
...
...
fuse/fsconnector.go
View file @
f3e1921c
...
...
@@ -35,7 +35,7 @@ type FileSystemConnector struct {
rootNode
*
Inode
}
func
NewFileSystemConnector
(
fs
FileSystem
,
opts
*
FileSystemOptions
)
(
me
*
FileSystemConnector
)
{
func
NewFileSystemConnector
(
nodeFs
Node
FileSystem
,
opts
*
FileSystemOptions
)
(
me
*
FileSystemConnector
)
{
me
=
new
(
FileSystemConnector
)
if
opts
==
nil
{
opts
=
NewFileSystemOptions
()
...
...
@@ -44,7 +44,7 @@ func NewFileSystemConnector(fs FileSystem, opts *FileSystemOptions) (me *FileSys
me
.
rootNode
=
me
.
newInode
(
true
)
me
.
rootNode
.
nodeId
=
FUSE_ROOT_ID
me
.
verify
()
me
.
mountRoot
(
f
s
,
opts
)
me
.
mountRoot
(
nodeF
s
,
opts
)
return
me
}
...
...
@@ -229,9 +229,9 @@ func (me *FileSystemConnector) findInode(fullPath string) *Inode {
// mount management in FileSystemConnector, so AutoUnionFs and
// MultiZipFs don't have to do it separately, with the risk of
// inconsistencies.
func
(
me
*
FileSystemConnector
)
Mount
(
mountPoint
string
,
fs
FileSystem
,
opts
*
FileSystemOptions
)
Status
{
func
(
me
*
FileSystemConnector
)
Mount
(
mountPoint
string
,
nodeFs
Node
FileSystem
,
opts
*
FileSystemOptions
)
Status
{
if
mountPoint
==
"/"
||
mountPoint
==
""
{
me
.
mountRoot
(
f
s
,
opts
)
me
.
mountRoot
(
nodeF
s
,
opts
)
return
OK
}
...
...
@@ -257,7 +257,6 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Fil
opts
=
me
.
rootNode
.
mountPoint
.
options
}
nodeFs
:=
NewPathNodeFs
(
fs
)
node
.
mountFs
(
nodeFs
,
opts
)
parent
.
addChild
(
base
,
node
)
...
...
@@ -266,18 +265,17 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Fil
}
parent
.
mounts
[
base
]
=
node
.
mountPoint
if
me
.
Debug
{
log
.
Println
(
"Mount: "
,
f
s
,
"on dir"
,
mountPoint
,
log
.
Println
(
"Mount: "
,
nodeF
s
,
"on dir"
,
mountPoint
,
"parent"
,
parent
)
}
f
s
.
Mount
(
me
)
nodeF
s
.
Mount
(
me
)
me
.
verify
()
return
OK
}
func
(
me
*
FileSystemConnector
)
mountRoot
(
fs
FileSystem
,
opts
*
FileSystemOptions
)
{
ifs
:=
NewPathNodeFs
(
fs
)
me
.
rootNode
.
mountFs
(
ifs
,
opts
)
ifs
.
Mount
(
me
)
func
(
me
*
FileSystemConnector
)
mountRoot
(
nodeFs
NodeFileSystem
,
opts
*
FileSystemOptions
)
{
me
.
rootNode
.
mountFs
(
nodeFs
,
opts
)
nodeFs
.
Mount
(
me
)
me
.
verify
()
}
...
...
fuse/fsetattr_test.go
View file @
f3e1921c
...
...
@@ -122,7 +122,7 @@ func NewFile() *MutableDataFile {
func
setupFAttrTest
(
fs
FileSystem
)
(
dir
string
,
clean
func
())
{
dir
=
MakeTempDir
()
state
,
_
,
err
:=
MountFileSystem
(
dir
,
fs
,
nil
)
state
,
_
,
err
:=
Mount
Path
FileSystem
(
dir
,
fs
,
nil
)
CheckSuccess
(
err
)
state
.
Debug
=
true
...
...
fuse/fuse.go
View file @
f3e1921c
...
...
@@ -8,8 +8,8 @@ import (
var
_
=
log
.
Println
func
Mount
FileSystem
(
mountpoint
string
,
fs
FileSystem
,
opts
*
FileSystemOptions
)
(
*
MountState
,
*
FileSystemConnector
,
os
.
Error
)
{
conn
:=
NewFileSystemConnector
(
f
s
,
opts
)
func
Mount
NodeFileSystem
(
mountpoint
string
,
nodeFs
Node
FileSystem
,
opts
*
FileSystemOptions
)
(
*
MountState
,
*
FileSystemConnector
,
os
.
Error
)
{
conn
:=
NewFileSystemConnector
(
nodeF
s
,
opts
)
mountState
:=
NewMountState
(
conn
)
fmt
.
Printf
(
"Go-FUSE Version %v.
\n
Mounting...
\n
"
,
Version
())
err
:=
mountState
.
Mount
(
mountpoint
,
nil
)
...
...
@@ -19,3 +19,8 @@ func MountFileSystem(mountpoint string, fs FileSystem, opts *FileSystemOptions)
fmt
.
Println
(
"Mounted!"
)
return
mountState
,
conn
,
nil
}
func
MountPathFileSystem
(
mountpoint
string
,
pathFs
FileSystem
,
opts
*
FileSystemOptions
)
(
*
MountState
,
*
FileSystemConnector
,
os
.
Error
)
{
nfs
:=
NewPathNodeFs
(
pathFs
)
return
MountNodeFileSystem
(
mountpoint
,
nfs
,
opts
)
}
fuse/loopback_test.go
View file @
f3e1921c
...
...
@@ -68,7 +68,8 @@ func NewTestCase(t *testing.T) *testCase {
pfs
=
NewLockingFileSystem
(
pfs
)
var
rfs
RawFileSystem
me
.
connector
=
NewFileSystemConnector
(
pfs
,
nfs
:=
NewPathNodeFs
(
pfs
)
me
.
connector
=
NewFileSystemConnector
(
nfs
,
&
FileSystemOptions
{
EntryTimeout
:
testTtl
,
AttrTimeout
:
testTtl
,
...
...
@@ -670,7 +671,7 @@ func TestOriginalIsSymlink(t *testing.T) {
CheckSuccess
(
err
)
fs
:=
NewLoopbackFileSystem
(
link
)
state
,
_
,
err
:=
MountFileSystem
(
mnt
,
fs
,
nil
)
state
,
_
,
err
:=
Mount
Path
FileSystem
(
mnt
,
fs
,
nil
)
CheckSuccess
(
err
)
defer
state
.
Unmount
()
...
...
fuse/mount_test.go
View file @
f3e1921c
...
...
@@ -15,15 +15,15 @@ func TestMountOnExisting(t *testing.T) {
err
:=
os
.
Mkdir
(
ts
.
mnt
+
"/mnt"
,
0777
)
CheckSuccess
(
err
)
fs
:=
&
Default
FileSystem
{}
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
nfs
:=
&
DefaultNode
FileSystem
{}
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
n
fs
,
nil
)
if
code
!=
EBUSY
{
t
.
Fatal
(
"expect EBUSY:"
,
code
)
}
err
=
os
.
Remove
(
ts
.
mnt
+
"/mnt"
)
CheckSuccess
(
err
)
code
=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
code
=
ts
.
connector
.
Mount
(
"/mnt"
,
n
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"expect OK:"
,
code
)
}
...
...
@@ -43,7 +43,7 @@ func TestMountRename(t *testing.T) {
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
fs
:=
New
LoopbackFileSystem
(
ts
.
orig
)
fs
:=
New
PathNodeFs
(
NewLoopbackFileSystem
(
ts
.
orig
)
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"mount should succeed"
)
...
...
@@ -58,7 +58,7 @@ func TestMountReaddir(t *testing.T) {
ts
:=
NewTestCase
(
t
)
defer
ts
.
Cleanup
()
fs
:=
New
LoopbackFileSystem
(
ts
.
orig
)
fs
:=
New
PathNodeFs
(
NewLoopbackFileSystem
(
ts
.
orig
)
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"mount should succeed"
)
...
...
@@ -78,7 +78,7 @@ func TestRecursiveMount(t *testing.T) {
err
:=
ioutil
.
WriteFile
(
ts
.
orig
+
"/hello.txt"
,
[]
byte
(
"blabla"
),
0644
)
CheckSuccess
(
err
)
fs
:=
New
LoopbackFileSystem
(
ts
.
orig
)
fs
:=
New
PathNodeFs
(
NewLoopbackFileSystem
(
ts
.
orig
)
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
fs
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"mount should succeed"
)
...
...
@@ -115,7 +115,7 @@ func TestDeletedUnmount(t *testing.T) {
defer
ts
.
Cleanup
()
submnt
:=
filepath
.
Join
(
ts
.
mnt
,
"mnt"
)
pfs2
:=
New
LoopbackFileSystem
(
ts
.
orig
)
pfs2
:=
New
PathNodeFs
(
NewLoopbackFileSystem
(
ts
.
orig
)
)
code
:=
ts
.
connector
.
Mount
(
"/mnt"
,
pfs2
,
nil
)
if
!
code
.
Ok
()
{
t
.
Fatal
(
"Mount error"
,
code
)
...
...
fuse/notify_test.go
View file @
f3e1921c
...
...
@@ -50,7 +50,7 @@ func NewNotifyTest() *NotifyTest {
}
var
err
os
.
Error
me
.
state
,
me
.
connector
,
err
=
MountFileSystem
(
me
.
dir
,
me
.
fs
,
opts
)
me
.
state
,
me
.
connector
,
err
=
Mount
Path
FileSystem
(
me
.
dir
,
me
.
fs
,
opts
)
CheckSuccess
(
err
)
me
.
state
.
Debug
=
true
go
me
.
state
.
Loop
(
false
)
...
...
fuse/owner_test.go
View file @
f3e1921c
...
...
@@ -28,7 +28,7 @@ func setupOwnerTest(opts *FileSystemOptions) (workdir string, cleanup func()) {
wd
:=
MakeTempDir
()
fs
:=
&
ownerFs
{}
state
,
_
,
err
:=
MountFileSystem
(
wd
,
fs
,
opts
)
state
,
_
,
err
:=
Mount
Path
FileSystem
(
wd
,
fs
,
opts
)
CheckSuccess
(
err
)
go
state
.
Loop
(
false
)
return
wd
,
func
()
{
...
...
fuse/pathdebug_test.go
View file @
f3e1921c
...
...
@@ -12,7 +12,7 @@ func TestPathDebug(t *testing.T) {
debugFs
.
FileSystem
=
&
DefaultFileSystem
{}
debugFs
.
Add
(
"test-entry"
,
func
()
[]
byte
{
return
[]
byte
(
"test-content"
)
})
connector
:=
NewFileSystemConnector
(
debugFs
,
nil
)
connector
:=
NewFileSystemConnector
(
NewPathNodeFs
(
debugFs
)
,
nil
)
mountPoint
:=
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
...
...
fuse/xattr_test.go
View file @
f3e1921c
...
...
@@ -94,7 +94,7 @@ func TestXAttrRead(t *testing.T) {
mountPoint
:=
MakeTempDir
()
defer
os
.
RemoveAll
(
mountPoint
)
state
,
_
,
err
:=
MountFileSystem
(
mountPoint
,
xfs
,
nil
)
state
,
_
,
err
:=
Mount
Path
FileSystem
(
mountPoint
,
xfs
,
nil
)
CheckSuccess
(
err
)
state
.
Debug
=
true
defer
state
.
Unmount
()
...
...
unionfs/autounion.go
View file @
f3e1921c
...
...
@@ -106,7 +106,8 @@ func (me *AutoUnionFs) createFs(name string, roots []string) fuse.Status {
}
log
.
Printf
(
"Adding workspace %v for roots %v"
,
name
,
ufs
.
Name
())
code
:=
me
.
connector
.
Mount
(
"/"
+
name
,
ufs
,
&
me
.
options
.
FileSystemOptions
)
nfs
:=
fuse
.
NewPathNodeFs
(
ufs
)
code
:=
me
.
connector
.
Mount
(
"/"
+
name
,
nfs
,
&
me
.
options
.
FileSystemOptions
)
if
code
.
Ok
()
{
me
.
knownFileSystems
[
name
]
=
ufs
me
.
nameRootMap
[
name
]
=
roots
[
0
]
...
...
unionfs/autounion_test.go
View file @
f3e1921c
...
...
@@ -42,7 +42,7 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile
(
wd
+
"/ro/file2"
,
"file2"
)
fs
:=
NewAutoUnionFs
(
wd
+
"/store"
,
testAOpts
)
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystemOptions
)
state
,
conn
,
err
:=
fuse
.
Mount
Path
FileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystemOptions
)
CheckSuccess
(
err
)
state
.
Debug
=
true
conn
.
Debug
=
true
...
...
unionfs/unionfs_test.go
View file @
f3e1921c
...
...
@@ -54,7 +54,7 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
NegativeTimeout
:
.5
*
entryTtl
,
}
state
,
conn
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
conn
,
err
:=
fuse
.
Mount
Path
FileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
conn
.
Debug
=
true
state
.
Debug
=
true
...
...
@@ -821,7 +821,7 @@ func TestDisappearing(t *testing.T) {
NegativeTimeout
:
entryTtl
,
}
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
state
,
_
,
err
:=
fuse
.
Mount
Path
FileSystem
(
wd
+
"/mount"
,
ufs
,
opts
)
CheckSuccess
(
err
)
defer
state
.
Unmount
()
state
.
Debug
=
true
...
...
zipfs/multizip.go
View file @
f3e1921c
...
...
@@ -171,7 +171,7 @@ func (me *MultiZipFs) Symlink(value string, linkName string, context *fuse.Conte
return
fuse
.
EINVAL
}
code
=
me
.
Connector
.
Mount
(
"/"
+
base
,
f
s
,
nil
)
code
=
me
.
Connector
.
Mount
(
"/"
+
base
,
f
use
.
NewPathNodeFs
(
fs
)
,
nil
)
if
!
code
.
Ok
()
{
return
code
}
...
...
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