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