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
Kirill Smelkov
go-fuse
Commits
c9919744
Commit
c9919744
authored
Feb 23, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for weekly-2012.02.22
parent
cb10e93d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
14 deletions
+23
-14
fuse/misc.go
fuse/misc.go
+11
-1
fuse/misc_test.go
fuse/misc_test.go
+1
-1
fuse/mount.go
fuse/mount.go
+10
-11
fuse/mountstate.go
fuse/mountstate.go
+1
-1
No files found.
fuse/misc.go
View file @
c9919744
...
...
@@ -32,9 +32,19 @@ func (code Status) Ok() bool {
// Convert error back to Errno based errors.
func
ToStatus
(
err
error
)
Status
{
if
err
==
nil
{
switch
err
{
case
nil
:
return
OK
case
os
.
ErrPermission
:
return
EPERM
case
os
.
ErrExist
:
return
Status
(
syscall
.
EEXIST
)
case
os
.
ErrNotExist
:
return
ENOENT
case
os
.
ErrInvalid
:
return
EINVAL
}
switch
t
:=
err
.
(
type
)
{
case
syscall
.
Errno
:
return
Status
(
t
)
...
...
fuse/misc_test.go
View file @
c9919744
...
...
@@ -8,7 +8,7 @@ import (
)
func
TestToStatus
(
t
*
testing
.
T
)
{
errNo
:=
ToStatus
(
os
.
E
PERM
)
errNo
:=
ToStatus
(
os
.
E
rrPermission
)
if
errNo
!=
EPERM
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
EPERM
)
}
...
...
fuse/mount.go
View file @
c9919744
...
...
@@ -47,11 +47,9 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
cmd
:=
[]
string
{
fusermountBinary
,
mountPoint
}
if
options
!=
""
{
log
.
Printf
(
"o %q"
,
options
)
cmd
=
append
(
cmd
,
"-o"
)
cmd
=
append
(
cmd
,
options
)
}
proc
,
err
:=
os
.
StartProcess
(
fusermountBinary
,
cmd
,
&
os
.
ProcAttr
{
...
...
@@ -61,12 +59,13 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
if
err
!=
nil
{
return
}
w
,
err
:=
os
.
Wait
(
proc
.
Pid
,
0
)
w
,
err
:=
proc
.
Wait
()
if
err
!=
nil
{
return
}
if
w
.
ExitStatus
()
!=
0
{
err
=
fmt
.
Errorf
(
"fusermount exited with code %
d
\n
"
,
w
.
ExitStatu
s
())
if
!
w
.
Success
()
{
err
=
fmt
.
Errorf
(
"fusermount exited with code %
v
\n
"
,
w
.
Sy
s
())
return
}
...
...
@@ -83,9 +82,9 @@ func privilegedUnmount(mountPoint string) error {
if
err
!=
nil
{
return
err
}
w
,
err
:=
os
.
Wait
(
proc
.
Pid
,
0
)
if
w
.
ExitStatus
()
!=
0
{
return
fmt
.
Errorf
(
"umount exited with code %
d
\n
"
,
w
.
ExitStatu
s
())
w
,
err
:=
proc
.
Wait
(
)
if
!
w
.
Success
()
{
return
fmt
.
Errorf
(
"umount exited with code %
v
\n
"
,
w
.
Sy
s
())
}
return
err
}
...
...
@@ -101,12 +100,12 @@ func unmount(mountPoint string) (err error) {
if
err
!=
nil
{
return
}
w
,
err
:=
os
.
Wait
(
proc
.
Pid
,
0
)
w
,
err
:=
proc
.
Wait
(
)
if
err
!=
nil
{
return
}
if
w
.
ExitStatus
()
!=
0
{
return
fmt
.
Errorf
(
"fusermount -u exited with code %
d
\n
"
,
w
.
ExitStatu
s
())
if
!
w
.
Success
()
{
return
fmt
.
Errorf
(
"fusermount -u exited with code %
v
\n
"
,
w
.
Sy
s
())
}
return
}
...
...
fuse/mountstate.go
View file @
c9919744
...
...
@@ -111,6 +111,7 @@ func (me *MountState) Unmount() (err error) {
delay
=
2
*
delay
+
5
*
time
.
Millisecond
time
.
Sleep
(
delay
)
}
me
.
mountPoint
=
""
return
err
}
...
...
@@ -180,7 +181,6 @@ func (me *MountState) Loop() {
me
.
loop
()
me
.
mountFile
.
Close
()
me
.
mountFile
=
nil
me
.
mountPoint
=
""
}
func
(
me
*
MountState
)
loop
()
{
...
...
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