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
ba19bafd
Commit
ba19bafd
authored
Nov 18, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for weekly.2011-11-18.
parent
2fe2c417
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
50 additions
and
49 deletions
+50
-49
fuse/files.go
fuse/files.go
+2
-2
fuse/fsetattr_test.go
fuse/fsetattr_test.go
+1
-1
fuse/loopback.go
fuse/loopback.go
+6
-7
fuse/loopback_test.go
fuse/loopback_test.go
+9
-7
fuse/misc.go
fuse/misc.go
+4
-4
fuse/misc_test.go
fuse/misc_test.go
+3
-3
fuse/mount.go
fuse/mount.go
+7
-5
fuse/mountstate.go
fuse/mountstate.go
+7
-10
fuse/switchfs.go
fuse/switchfs.go
+2
-3
fuse/types.go
fuse/types.go
+2
-0
unionfs/autounion.go
unionfs/autounion.go
+1
-1
unionfs/unionfs.go
unionfs/unionfs.go
+6
-6
No files found.
fuse/files.go
View file @
ba19bafd
...
...
@@ -114,11 +114,11 @@ func (me *LoopbackFile) Release() {
}
func
(
me
*
LoopbackFile
)
Fsync
(
*
FsyncIn
)
(
code
Status
)
{
return
Status
(
syscall
.
Fsync
(
me
.
File
.
Fd
()))
return
OsErrorToErrno
(
syscall
.
Fsync
(
me
.
File
.
Fd
()))
}
func
(
me
*
LoopbackFile
)
Truncate
(
size
uint64
)
Status
{
return
Status
(
syscall
.
Ftruncate
(
me
.
File
.
Fd
(),
int64
(
size
)))
return
OsErrorToErrno
(
syscall
.
Ftruncate
(
me
.
File
.
Fd
(),
int64
(
size
)))
}
// futimens missing from 6g runtime.
...
...
fuse/fsetattr_test.go
View file @
ba19bafd
...
...
@@ -158,7 +158,7 @@ func TestFSetAttr(t *testing.T) {
CheckSuccess
(
err
)
code
:=
syscall
.
Ftruncate
(
f
.
Fd
(),
3
)
if
code
!=
0
{
if
code
!=
nil
{
t
.
Error
(
"truncate retval"
,
os
.
NewSyscallError
(
"Ftruncate"
,
code
))
}
if
len
(
fs
.
file
.
data
)
!=
3
{
...
...
fuse/loopback.go
View file @
ba19bafd
...
...
@@ -113,7 +113,7 @@ func (me *LoopbackFileSystem) Readlink(name string, context *Context) (out strin
}
func
(
me
*
LoopbackFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
,
context
*
Context
)
(
code
Status
)
{
return
Status
(
syscall
.
Mknod
(
me
.
GetPath
(
name
),
mode
,
int
(
dev
)))
return
OsErrorToErrno
(
syscall
.
Mknod
(
me
.
GetPath
(
name
),
mode
,
int
(
dev
)))
}
func
(
me
*
LoopbackFileSystem
)
Mkdir
(
path
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
...
...
@@ -122,11 +122,11 @@ func (me *LoopbackFileSystem) Mkdir(path string, mode uint32, context *Context)
// Don't use os.Remove, it removes twice (unlink followed by rmdir).
func
(
me
*
LoopbackFileSystem
)
Unlink
(
name
string
,
context
*
Context
)
(
code
Status
)
{
return
Status
(
syscall
.
Unlink
(
me
.
GetPath
(
name
)))
return
OsErrorToErrno
(
syscall
.
Unlink
(
me
.
GetPath
(
name
)))
}
func
(
me
*
LoopbackFileSystem
)
Rmdir
(
name
string
,
context
*
Context
)
(
code
Status
)
{
return
Status
(
syscall
.
Rmdir
(
me
.
GetPath
(
name
)))
return
OsErrorToErrno
(
syscall
.
Rmdir
(
me
.
GetPath
(
name
)))
}
func
(
me
*
LoopbackFileSystem
)
Symlink
(
pointedTo
string
,
linkName
string
,
context
*
Context
)
(
code
Status
)
{
...
...
@@ -143,7 +143,7 @@ func (me *LoopbackFileSystem) Link(orig string, newName string, context *Context
}
func
(
me
*
LoopbackFileSystem
)
Access
(
name
string
,
mode
uint32
,
context
*
Context
)
(
code
Status
)
{
return
Status
(
syscall
.
Access
(
me
.
GetPath
(
name
),
mode
))
return
OsErrorToErrno
(
syscall
.
Access
(
me
.
GetPath
(
name
),
mode
))
}
func
(
me
*
LoopbackFileSystem
)
Create
(
path
string
,
flags
uint32
,
mode
uint32
,
context
*
Context
)
(
fuseFile
File
,
code
Status
)
{
...
...
@@ -173,9 +173,8 @@ func (me *LoopbackFileSystem) String() string {
func
(
me
*
LoopbackFileSystem
)
StatFs
(
name
string
)
*
StatfsOut
{
s
:=
syscall
.
Statfs_t
{}
errNo
:=
syscall
.
Statfs
(
me
.
GetPath
(
name
),
&
s
)
if
errNo
==
0
{
err
:=
syscall
.
Statfs
(
me
.
GetPath
(
name
),
&
s
)
if
err
==
nil
{
return
&
StatfsOut
{
Kstatfs
{
Blocks
:
s
.
Blocks
,
...
...
fuse/loopback_test.go
View file @
ba19bafd
...
...
@@ -446,7 +446,7 @@ func TestAccess(t *testing.T) {
err
=
os
.
Chmod
(
me
.
origFile
,
0222
)
CheckSuccess
(
err
)
errCode
=
syscall
.
Access
(
me
.
mountFile
,
W_OK
)
if
errCode
!=
0
{
if
errCode
!=
nil
{
t
.
Errorf
(
"Expected no error code for writable. %v"
,
errCode
)
}
}
...
...
@@ -457,7 +457,7 @@ func TestMknod(t *testing.T) {
t
.
Log
(
"Testing mknod."
)
errNo
:=
syscall
.
Mknod
(
me
.
mountFile
,
syscall
.
S_IFIFO
|
0777
,
0
)
if
errNo
!=
0
{
if
errNo
!=
nil
{
t
.
Errorf
(
"Mknod %v"
,
errNo
)
}
fi
,
_
:=
os
.
Lstat
(
me
.
origFile
)
...
...
@@ -513,7 +513,7 @@ func TestFSync(t *testing.T) {
// How to really test fsync ?
errNo
:=
syscall
.
Fsync
(
f
.
Fd
())
if
errNo
!=
0
{
if
errNo
!=
nil
{
t
.
Errorf
(
"fsync returned %v"
,
errNo
)
}
f
.
Close
()
...
...
@@ -679,6 +679,8 @@ func clearStatfs(s *syscall.Statfs_t) {
s
.
Type
=
0
s
.
Fsid
=
empty
.
Fsid
s
.
Spare
=
empty
.
Spare
// TODO - figure out what this is for.
s
.
Flags
=
0
}
// This test is racy. If an external process consumes space while this
...
...
@@ -690,14 +692,14 @@ func TestStatFs(t *testing.T) {
empty
:=
syscall
.
Statfs_t
{}
s1
:=
empty
err
:=
syscall
.
Statfs
(
ts
.
orig
,
&
s1
)
if
err
!=
0
{
if
err
!=
nil
{
t
.
Fatal
(
"statfs orig"
,
err
)
}
s2
:=
syscall
.
Statfs_t
{}
err
=
syscall
.
Statfs
(
ts
.
mnt
,
&
s2
)
if
err
!=
0
{
if
err
!=
nil
{
t
.
Fatal
(
"statfs mnt"
,
err
)
}
...
...
@@ -719,7 +721,7 @@ func TestFStatFs(t *testing.T) {
empty
:=
syscall
.
Statfs_t
{}
s1
:=
empty
errno
:=
syscall
.
Fstatfs
(
fOrig
.
Fd
(),
&
s1
)
if
errno
!=
0
{
if
errno
!=
nil
{
t
.
Fatal
(
"statfs orig"
,
err
)
}
...
...
@@ -729,7 +731,7 @@ func TestFStatFs(t *testing.T) {
s2
:=
empty
errno
=
syscall
.
Fstatfs
(
fMnt
.
Fd
(),
&
s2
)
if
errno
!=
0
{
if
errno
!=
nil
{
t
.
Fatal
(
"statfs mnt"
,
err
)
}
...
...
fuse/misc.go
View file @
ba19bafd
...
...
@@ -23,7 +23,7 @@ func (code Status) String() string {
"NOTIFY_INVAL_ENTRY"
,
}[
-
code
]
}
return
fmt
.
Sprintf
(
"%d=%v"
,
int
(
code
),
os
.
Errno
(
code
))
return
fmt
.
Sprintf
(
"%d=%v"
,
int
(
code
),
syscall
.
Errno
(
code
))
}
func
(
code
Status
)
Ok
()
bool
{
...
...
@@ -34,10 +34,10 @@ func (code Status) Ok() bool {
func
OsErrorToErrno
(
err
error
)
Status
{
if
err
!=
nil
{
switch
t
:=
err
.
(
type
)
{
case
os
.
Errno
:
case
syscall
.
Errno
:
return
Status
(
t
)
case
*
os
.
SyscallError
:
return
Status
(
t
.
Errno
)
return
Status
(
t
.
Errno
.
(
syscall
.
Errno
)
)
case
*
os
.
PathError
:
return
OsErrorToErrno
(
t
.
Err
)
case
*
os
.
LinkError
:
...
...
@@ -104,7 +104,7 @@ func Writev(fd int, packet [][]byte) (n int, err error) {
n
,
errno
:=
writev
(
fd
,
&
iovecs
[
0
],
len
(
iovecs
))
if
errno
!=
0
{
err
=
os
.
NewSyscallError
(
"writev"
,
errno
)
err
=
os
.
NewSyscallError
(
"writev"
,
syscall
.
Errno
(
errno
)
)
}
return
n
,
err
}
...
...
fuse/misc_test.go
View file @
ba19bafd
...
...
@@ -9,19 +9,19 @@ import (
func
TestOsErrorToErrno
(
t
*
testing
.
T
)
{
errNo
:=
OsErrorToErrno
(
os
.
EPERM
)
if
errNo
!=
syscall
.
EPERM
{
if
errNo
!=
EPERM
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
EPERM
)
}
e
:=
os
.
NewSyscallError
(
"syscall"
,
syscall
.
EPERM
)
errNo
=
OsErrorToErrno
(
e
)
if
errNo
!=
syscall
.
EPERM
{
if
errNo
!=
EPERM
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
EPERM
)
}
e
=
os
.
Remove
(
"this-file-surely-does-not-exist"
)
errNo
=
OsErrorToErrno
(
e
)
if
errNo
!=
syscall
.
ENOENT
{
if
errNo
!=
ENOENT
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
ENOENT
)
}
}
...
...
fuse/mount.go
View file @
ba19bafd
...
...
@@ -27,9 +27,10 @@ func Socketpair(network string) (l, r *os.File, err error) {
default
:
log
.
Panicf
(
"unknown network %q"
,
network
)
}
fd
,
errno
:=
syscall
.
Socketpair
(
domain
,
typ
,
0
)
if
errno
!=
0
{
return
nil
,
nil
,
os
.
NewSyscallError
(
"socketpair"
,
errno
)
fd
,
err
:=
syscall
.
Socketpair
(
domain
,
typ
,
0
)
if
err
!=
nil
{
return
nil
,
nil
,
os
.
NewSyscallError
(
"socketpair"
,
err
.
(
syscall
.
Errno
))
}
l
=
os
.
NewFile
(
fd
[
0
],
"socketpair-half1"
)
r
=
os
.
NewFile
(
fd
[
1
],
"socketpair-half2"
)
...
...
@@ -59,6 +60,7 @@ 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
)
}
...
...
@@ -128,9 +130,9 @@ func getConnection(local *os.File) (f *os.File, err error) {
// n, oobn, recvflags, from, errno - todo: error checking.
_
,
oobn
,
_
,
_
,
err
no
:=
syscall
.
Recvmsg
(
err
:=
syscall
.
Recvmsg
(
local
.
Fd
(),
data
[
:
],
control
[
:
],
0
)
if
err
no
!=
0
{
if
err
!=
nil
{
return
}
...
...
fuse/mountstate.go
View file @
ba19bafd
...
...
@@ -4,7 +4,6 @@ import (
"log"
"os"
"strings"
"syscall"
"time"
"unsafe"
)
...
...
@@ -125,7 +124,7 @@ func (me *MountState) newRequest() *request {
}
}
func
(
me
*
MountState
)
readRequest
(
req
*
request
)
error
{
func
(
me
*
MountState
)
readRequest
(
req
*
request
)
Status
{
n
,
err
:=
me
.
mountFile
.
Read
(
req
.
inputBuf
)
// If we start timing before the read, we may take into
// account waiting for input into the timing.
...
...
@@ -133,7 +132,7 @@ func (me *MountState) readRequest(req *request) error {
req
.
startNs
=
time
.
Nanoseconds
()
}
req
.
inputBuf
=
req
.
inputBuf
[
0
:
n
]
return
err
return
OsErrorToErrno
(
err
)
}
func
(
me
*
MountState
)
recordStats
(
req
*
request
)
{
...
...
@@ -162,21 +161,19 @@ func (me *MountState) Loop() {
func
(
me
*
MountState
)
loop
()
{
for
{
req
:=
me
.
newRequest
()
err
:=
me
.
readRequest
(
req
)
if
err
!=
nil
{
errNo
:=
OsErrorToErrno
(
err
)
errNo
:=
me
.
readRequest
(
req
)
if
!
errNo
.
Ok
()
{
// Retry.
if
errNo
==
syscall
.
ENOENT
{
if
errNo
==
ENOENT
{
continue
}
if
errNo
==
syscall
.
ENODEV
{
if
errNo
==
ENODEV
{
// Unmount.
break
}
log
.
Printf
(
"Failed to read from fuse conn: %v"
,
err
)
log
.
Printf
(
"Failed to read from fuse conn: %v"
,
err
No
)
break
}
...
...
fuse/switchfs.go
View file @
ba19bafd
...
...
@@ -5,7 +5,6 @@ import (
"path/filepath"
"sort"
"strings"
"syscall"
)
// SwitchFileSystem construct the union of a set of filesystems, and
...
...
@@ -136,7 +135,7 @@ func (me *SwitchFileSystem) Rename(oldName string, newName string, context *Cont
oldName
,
fs1
:=
me
.
findFileSystem
(
oldName
)
newName
,
fs2
:=
me
.
findFileSystem
(
newName
)
if
fs1
!=
fs2
{
return
syscall
.
EXDEV
return
EXDEV
}
if
fs1
==
nil
{
return
ENOENT
...
...
@@ -148,7 +147,7 @@ func (me *SwitchFileSystem) Link(oldName string, newName string, context *Contex
oldName
,
fs1
:=
me
.
findFileSystem
(
oldName
)
newName
,
fs2
:=
me
.
findFileSystem
(
newName
)
if
fs1
!=
fs2
{
return
syscall
.
EXDEV
return
EXDEV
}
if
fs1
==
nil
{
return
ENOENT
...
...
fuse/types.go
View file @
ba19bafd
...
...
@@ -53,6 +53,8 @@ const (
ERANGE
=
Status
(
syscall
.
ERANGE
)
EXDEV
=
Status
(
syscall
.
EXDEV
)
EBADF
=
Status
(
syscall
.
EBADF
)
ENODEV
=
Status
(
syscall
.
ENODEV
)
EROFS
=
Status
(
syscall
.
EROFS
)
)
type
NotifyCode
int
...
...
unionfs/autounion.go
View file @
ba19bafd
...
...
@@ -229,7 +229,7 @@ func (me *AutoUnionFs) Symlink(pointedTo string, linkName string, context *fuse.
if
comps
[
0
]
==
_CONFIG
{
roots
:=
me
.
getRoots
(
pointedTo
)
if
roots
==
nil
{
return
syscall
.
ENOTDIR
return
fuse
.
Status
(
syscall
.
ENOTDIR
)
}
name
:=
comps
[
1
]
...
...
unionfs/unionfs.go
View file @
ba19bafd
...
...
@@ -129,7 +129,7 @@ func (me *UnionFs) isDeleted(name string) (deleted bool, code fuse.Status) {
}
log
.
Println
(
"error accessing deletion marker:"
,
marker
)
return
false
,
syscall
.
EROFS
return
false
,
fuse
.
Status
(
syscall
.
EROFS
)
}
func
(
me
*
UnionFs
)
createDeletionStore
()
(
code
fuse
.
Status
)
{
...
...
@@ -143,7 +143,7 @@ func (me *UnionFs) createDeletionStore() (code fuse.Status) {
}
if
!
code
.
Ok
()
||
!
fi
.
IsDirectory
()
{
code
=
syscall
.
EROFS
code
=
fuse
.
Status
(
syscall
.
EROFS
)
}
return
code
...
...
@@ -379,7 +379,7 @@ func (me *UnionFs) Rmdir(path string, context *fuse.Context) (code fuse.Status)
return
r
.
code
}
if
!
r
.
attr
.
IsDirectory
()
{
return
syscall
.
ENOTDIR
return
fuse
.
Status
(
syscall
.
ENOTDIR
)
}
stream
,
code
:=
me
.
OpenDir
(
path
,
context
)
...
...
@@ -388,7 +388,7 @@ func (me *UnionFs) Rmdir(path string, context *fuse.Context) (code fuse.Status)
found
=
true
}
if
found
{
return
syscall
.
ENOTEMPTY
return
fuse
.
Status
(
syscall
.
ENOTEMPTY
)
}
if
r
.
branch
>
0
{
...
...
@@ -416,7 +416,7 @@ func (me *UnionFs) Mkdir(path string, mode uint32, context *fuse.Context) (code
if
!
deleted
{
r
:=
me
.
getBranch
(
path
)
if
r
.
code
!=
fuse
.
ENOENT
{
return
syscall
.
EEXIST
return
fuse
.
Status
(
syscall
.
EEXIST
)
}
}
...
...
@@ -761,7 +761,7 @@ func (me *UnionFs) OpenDir(directory string, context *fuse.Context) (stream chan
if
code
==
fuse
.
ENOENT
{
deletions
=
map
[
string
]
bool
{}
}
else
{
return
nil
,
syscall
.
EROFS
return
nil
,
fuse
.
Status
(
syscall
.
EROFS
)
}
}
...
...
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