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
dc255238
Commit
dc255238
authored
May 16, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename MountOptions to FileSystemOptions.
Introduce new MountOptions struct with AllowOther option.
parent
094ee880
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
40 additions
and
23 deletions
+40
-23
example/autounionfs/main.go
example/autounionfs/main.go
+1
-1
example/loopback/loopback.go
example/loopback/loopback.go
+2
-2
fuse/api.go
fuse/api.go
+5
-1
fuse/fuse.go
fuse/fuse.go
+2
-2
fuse/loopback_test.go
fuse/loopback_test.go
+1
-1
fuse/mount.go
fuse/mount.go
+9
-2
fuse/mountstate.go
fuse/mountstate.go
+8
-2
fuse/pathdebug_test.go
fuse/pathdebug_test.go
+1
-1
fuse/pathfilesystem.go
fuse/pathfilesystem.go
+5
-5
fuse/pathops.go
fuse/pathops.go
+1
-1
unionfs/autounion.go
unionfs/autounion.go
+2
-2
unionfs/autounion_test.go
unionfs/autounion_test.go
+2
-2
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+1
-1
No files found.
example/autounionfs/main.go
View file @
dc255238
...
...
@@ -28,7 +28,7 @@ func main() {
}
options
:=
unionfs
.
AutoUnionFsOptions
{
UnionFsOptions
:
ufsOptions
,
MountOptions
:
fuse
.
Mount
Options
{
FileSystemOptions
:
fuse
.
FileSystem
Options
{
EntryTimeout
:
1.0
,
AttrTimeout
:
1.0
,
NegativeTimeout
:
1.0
,
...
...
example/loopback/loopback.go
View file @
dc255238
...
...
@@ -39,7 +39,7 @@ func main() {
finalFs
=
timing
}
opts
:=
&
fuse
.
Mount
Options
{
opts
:=
&
fuse
.
FileSystem
Options
{
// These options are to be compatible with libfuse defaults,
// making benchmarking easier.
NegativeTimeout
:
1.0
,
...
...
@@ -71,7 +71,7 @@ func main() {
mountPoint
:=
flag
.
Arg
(
0
)
fmt
.
Println
(
"Mounting"
)
err
:=
state
.
Mount
(
mountPoint
)
err
:=
state
.
Mount
(
mountPoint
,
nil
)
if
err
!=
nil
{
fmt
.
Printf
(
"Mount fail: %v
\n
"
,
err
)
os
.
Exit
(
1
)
...
...
fuse/api.go
View file @
dc255238
...
...
@@ -86,12 +86,16 @@ type File interface {
// MountOptions contains time out options for a FileSystem. The
// default copied from libfuse and set in NewMountOptions() is
// (1s,1s,0s).
type
Mount
Options
struct
{
type
FileSystem
Options
struct
{
EntryTimeout
float64
AttrTimeout
float64
NegativeTimeout
float64
}
type
MountOptions
struct
{
AllowOther
bool
}
// DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.
type
DefaultFileSystem
struct
{}
...
...
fuse/fuse.go
View file @
dc255238
...
...
@@ -4,11 +4,11 @@ import (
"fmt"
)
func
MountFileSystem
(
mountpoint
string
,
fs
FileSystem
,
opts
*
Mount
Options
)
(
*
MountState
,
*
FileSystemConnector
,
os
.
Error
)
{
func
MountFileSystem
(
mountpoint
string
,
fs
FileSystem
,
opts
*
FileSystem
Options
)
(
*
MountState
,
*
FileSystemConnector
,
os
.
Error
)
{
conn
:=
NewFileSystemConnector
(
fs
,
opts
)
mountState
:=
NewMountState
(
conn
)
fmt
.
Printf
(
"Go-FUSE Version %v.
\n
Mounting...
\n
"
,
Version
())
err
:=
mountState
.
Mount
(
mountpoint
)
err
:=
mountState
.
Mount
(
mountpoint
,
nil
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
...
...
fuse/loopback_test.go
View file @
dc255238
...
...
@@ -68,7 +68,7 @@ func (me *testCase) Setup(t *testing.T) {
me
.
connector
.
Debug
=
true
me
.
state
=
NewMountState
(
rfs
)
me
.
state
.
Mount
(
me
.
mountPoint
)
me
.
state
.
Mount
(
me
.
mountPoint
,
nil
)
//me.state.Debug = false
me
.
state
.
Debug
=
true
...
...
fuse/mount.go
View file @
dc255238
...
...
@@ -33,7 +33,7 @@ func Socketpair(network string) (l, r *os.File, err os.Error) {
// Create a FUSE FS on the specified mount point. The returned
// mount point is always absolute.
func
mount
(
mountPoint
string
)
(
f
*
os
.
File
,
finalMountPoint
string
,
err
os
.
Error
)
{
func
mount
(
mountPoint
string
,
options
string
)
(
f
*
os
.
File
,
finalMountPoint
string
,
err
os
.
Error
)
{
local
,
remote
,
err
:=
Socketpair
(
"unixgram"
)
if
err
!=
nil
{
return
...
...
@@ -50,8 +50,15 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error)
}
mountPoint
=
filepath
.
Clean
(
filepath
.
Join
(
cwd
,
mountPoint
))
}
cmd
:=
[]
string
{
"/bin/fusermount"
,
mountPoint
}
if
options
!=
""
{
cmd
=
append
(
cmd
,
"-o"
)
cmd
=
append
(
cmd
,
options
)
}
proc
,
err
:=
os
.
StartProcess
(
"/bin/fusermount"
,
[]
string
{
"/bin/fusermount"
,
mountPoint
}
,
cmd
,
&
os
.
ProcAttr
{
Env
:
[]
string
{
"_FUSE_COMMFD=3"
},
Files
:
[]
*
os
.
File
{
os
.
Stdin
,
os
.
Stdout
,
os
.
Stderr
,
remote
}})
...
...
fuse/mountstate.go
View file @
dc255238
...
...
@@ -45,8 +45,14 @@ func (me *MountState) MountPoint() string {
}
// Mount filesystem on mountPoint.
func
(
me
*
MountState
)
Mount
(
mountPoint
string
)
os
.
Error
{
file
,
mp
,
err
:=
mount
(
mountPoint
)
func
(
me
*
MountState
)
Mount
(
mountPoint
string
,
opts
*
MountOptions
)
os
.
Error
{
optStr
:=
""
if
opts
!=
nil
&&
opts
.
AllowOther
{
optStr
=
"allow_other"
}
file
,
mp
,
err
:=
mount
(
mountPoint
,
optStr
)
if
err
!=
nil
{
return
err
}
...
...
fuse/pathdebug_test.go
View file @
dc255238
...
...
@@ -17,7 +17,7 @@ func TestPathDebug(t *testing.T) {
defer
os
.
RemoveAll
(
mountPoint
)
state
:=
NewMountState
(
connector
)
state
.
Mount
(
mountPoint
)
state
.
Mount
(
mountPoint
,
nil
)
state
.
Debug
=
true
defer
state
.
Unmount
()
...
...
fuse/pathfilesystem.go
View file @
dc255238
...
...
@@ -46,7 +46,7 @@ type mountData struct {
// consider if we can measure significant contention for
// multi-mount filesystems.
options
*
Mount
Options
options
*
FileSystem
Options
}
func
newMount
(
fs
FileSystem
)
*
mountData
{
...
...
@@ -165,8 +165,8 @@ func (me *inode) setParent(newParent *inode) {
}
}
func
New
MountOptions
()
*
Mount
Options
{
return
&
Mount
Options
{
func
New
FileSystemOptions
()
*
FileSystem
Options
{
return
&
FileSystem
Options
{
NegativeTimeout
:
0.0
,
AttrTimeout
:
1.0
,
EntryTimeout
:
1.0
,
...
...
@@ -422,7 +422,7 @@ func EmptyFileSystemConnector() (out *FileSystemConnector) {
return
out
}
func
(
me
*
FileSystemConnector
)
Mount
(
mountPoint
string
,
fs
FileSystem
,
opts
*
Mount
Options
)
Status
{
func
(
me
*
FileSystemConnector
)
Mount
(
mountPoint
string
,
fs
FileSystem
,
opts
*
FileSystem
Options
)
Status
{
var
node
*
inode
if
mountPoint
!=
"/"
{
...
...
@@ -465,7 +465,7 @@ func (me *FileSystemConnector) Mount(mountPoint string, fs FileSystem, opts *Mou
node
.
mount
=
newMount
(
fs
)
if
opts
==
nil
{
opts
=
New
Mount
Options
()
opts
=
New
FileSystem
Options
()
}
node
.
mount
.
options
=
opts
return
OK
...
...
fuse/pathops.go
View file @
dc255238
...
...
@@ -12,7 +12,7 @@ import (
var
_
=
fmt
.
Println
func
NewFileSystemConnector
(
fs
FileSystem
,
opts
*
Mount
Options
)
(
out
*
FileSystemConnector
)
{
func
NewFileSystemConnector
(
fs
FileSystem
,
opts
*
FileSystem
Options
)
(
out
*
FileSystemConnector
)
{
out
=
EmptyFileSystemConnector
()
if
code
:=
out
.
Mount
(
"/"
,
fs
,
opts
);
code
!=
OK
{
panic
(
"root mount failed."
)
...
...
unionfs/autounion.go
View file @
dc255238
...
...
@@ -32,7 +32,7 @@ type AutoUnionFs struct {
type
AutoUnionFsOptions
struct
{
UnionFsOptions
fuse
.
Mount
Options
fuse
.
FileSystem
Options
// If set, run updateKnownFses() after mounting.
UpdateOnMount
bool
...
...
@@ -134,7 +134,7 @@ func (me *AutoUnionFs) addFs(name string, roots []string) (code fuse.Status) {
}
gofs
,
code
:=
me
.
createFs
(
name
,
roots
)
if
gofs
!=
nil
{
me
.
connector
.
Mount
(
"/"
+
name
,
gofs
,
&
me
.
options
.
Mount
Options
)
me
.
connector
.
Mount
(
"/"
+
name
,
gofs
,
&
me
.
options
.
FileSystem
Options
)
}
return
code
}
...
...
unionfs/autounion_test.go
View file @
dc255238
...
...
@@ -17,7 +17,7 @@ const entryTtl = 0.1
var
testAOpts
=
AutoUnionFsOptions
{
UnionFsOptions
:
testOpts
,
MountOptions
:
fuse
.
Mount
Options
{
FileSystemOptions
:
fuse
.
FileSystem
Options
{
EntryTimeout
:
entryTtl
,
AttrTimeout
:
entryTtl
,
NegativeTimeout
:
0
,
...
...
@@ -44,7 +44,7 @@ func setup(t *testing.T) (workdir string, cleanup func()) {
WriteFile
(
wd
+
"/ro/file2"
,
"file2"
)
fs
:=
NewAutoUnionFs
(
wd
+
"/store"
,
testAOpts
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
Mount
Options
)
state
,
_
,
err
:=
fuse
.
MountFileSystem
(
wd
+
"/mount"
,
fs
,
&
testAOpts
.
FileSystem
Options
)
CheckSuccess
(
err
)
state
.
Debug
=
true
go
state
.
Loop
(
false
)
...
...
unionfs/unionfs_test.go
View file @
dc255238
...
...
@@ -42,7 +42,7 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
fses
=
append
(
fses
,
fuse
.
NewLoopbackFileSystem
(
wd
+
"/ro"
))
ufs
:=
NewUnionFs
(
"testFs"
,
fses
,
testOpts
)
opts
:=
&
fuse
.
Mount
Options
{
opts
:=
&
fuse
.
FileSystem
Options
{
EntryTimeout
:
entryTtl
,
AttrTimeout
:
entryTtl
,
NegativeTimeout
:
entryTtl
,
...
...
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