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
1fe08a46
Commit
1fe08a46
authored
Jun 23, 2011
by
James D. Nurmi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search for fusermount on init rather than hard-coding. (keep defaults if one isn't found on path)
parent
a75cd967
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
fuse/mount.go
fuse/mount.go
+19
-4
No files found.
fuse/mount.go
View file @
1fe08a46
...
@@ -4,11 +4,15 @@ package fuse
...
@@ -4,11 +4,15 @@ package fuse
import
(
import
(
"fmt"
"fmt"
"os"
"os"
"path"
"path/filepath"
"path/filepath"
"strings"
"syscall"
"syscall"
"unsafe"
"unsafe"
)
)
var
mount_bin
string
=
"/bin/fusermount"
func
Socketpair
(
network
string
)
(
l
,
r
*
os
.
File
,
err
os
.
Error
)
{
func
Socketpair
(
network
string
)
(
l
,
r
*
os
.
File
,
err
os
.
Error
)
{
var
domain
int
var
domain
int
var
typ
int
var
typ
int
...
@@ -51,13 +55,13 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
...
@@ -51,13 +55,13 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
mountPoint
=
filepath
.
Clean
(
filepath
.
Join
(
cwd
,
mountPoint
))
mountPoint
=
filepath
.
Clean
(
filepath
.
Join
(
cwd
,
mountPoint
))
}
}
cmd
:=
[]
string
{
"/bin/fusermount"
,
mountPoint
}
cmd
:=
[]
string
{
mount_bin
,
mountPoint
}
if
options
!=
""
{
if
options
!=
""
{
cmd
=
append
(
cmd
,
"-o"
)
cmd
=
append
(
cmd
,
"-o"
)
cmd
=
append
(
cmd
,
options
)
cmd
=
append
(
cmd
,
options
)
}
}
proc
,
err
:=
os
.
StartProcess
(
"/bin/fusermount"
,
proc
,
err
:=
os
.
StartProcess
(
mount_bin
,
cmd
,
cmd
,
&
os
.
ProcAttr
{
&
os
.
ProcAttr
{
Env
:
[]
string
{
"_FUSE_COMMFD=3"
},
Env
:
[]
string
{
"_FUSE_COMMFD=3"
},
...
@@ -82,8 +86,8 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
...
@@ -82,8 +86,8 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
func
unmount
(
mountPoint
string
)
(
err
os
.
Error
)
{
func
unmount
(
mountPoint
string
)
(
err
os
.
Error
)
{
dir
,
_
:=
filepath
.
Split
(
mountPoint
)
dir
,
_
:=
filepath
.
Split
(
mountPoint
)
proc
,
err
:=
os
.
StartProcess
(
"/bin/fusermount"
,
proc
,
err
:=
os
.
StartProcess
(
mount_bin
,
[]
string
{
"/bin/fusermount"
,
"-u"
,
mountPoint
},
[]
string
{
mount_bin
,
"-u"
,
mountPoint
},
&
os
.
ProcAttr
{
Dir
:
dir
,
Files
:
[]
*
os
.
File
{
nil
,
nil
,
os
.
Stderr
}})
&
os
.
ProcAttr
{
Dir
:
dir
,
Files
:
[]
*
os
.
File
{
nil
,
nil
,
os
.
Stderr
}})
if
err
!=
nil
{
if
err
!=
nil
{
return
return
...
@@ -128,3 +132,14 @@ func getConnection(local *os.File) (f *os.File, err os.Error) {
...
@@ -128,3 +132,14 @@ func getConnection(local *os.File) (f *os.File, err os.Error) {
f
=
os
.
NewFile
(
int
(
fd
),
"<fuseConnection>"
)
f
=
os
.
NewFile
(
int
(
fd
),
"<fuseConnection>"
)
return
return
}
}
func
init
()
{
for
_
,
v
:=
range
strings
.
Split
(
os
.
Getenv
(
"PATH"
),
":"
,
-
1
)
{
tpath
:=
path
.
Join
(
v
,
"fusermount"
)
fi
,
err
:=
os
.
Stat
(
tpath
)
if
err
==
nil
&&
(
fi
.
Mode
&
0111
)
!=
0
{
mount_bin
=
tpath
break
}
}
}
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