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
fbe06b9f
Commit
fbe06b9f
authored
Apr 21, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename OsErrorToFuseError to OsErrorToErrno.
parent
b836442d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
fuse/fuse.go
fuse/fuse.go
+1
-1
fuse/loopback.go
fuse/loopback.go
+14
-14
fuse/misc.go
fuse/misc.go
+3
-3
fuse/misc_test.go
fuse/misc_test.go
+4
-4
No files found.
fuse/fuse.go
View file @
fbe06b9f
...
...
@@ -240,7 +240,7 @@ func (me *MountState) loop() {
err
:=
me
.
readRequest
(
req
)
if
err
!=
nil
{
errNo
:=
OsErrorTo
FuseError
(
err
)
errNo
:=
OsErrorTo
Errno
(
err
)
// Retry.
if
errNo
==
syscall
.
ENOENT
{
...
...
fuse/loopback.go
View file @
fbe06b9f
...
...
@@ -49,7 +49,7 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status
// directories?
f
,
err
:=
os
.
Open
(
me
.
GetPath
(
name
))
if
err
!=
nil
{
return
nil
,
OsErrorTo
FuseError
(
err
)
return
nil
,
OsErrorTo
Errno
(
err
)
}
output
:=
make
(
chan
DirEntry
,
500
)
go
func
()
{
...
...
@@ -80,31 +80,31 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status
func
(
me
*
LoopbackFileSystem
)
Open
(
name
string
,
flags
uint32
)
(
fuseFile
FuseFile
,
status
Status
)
{
f
,
err
:=
os
.
OpenFile
(
me
.
GetPath
(
name
),
int
(
flags
),
0
)
if
err
!=
nil
{
return
nil
,
OsErrorTo
FuseError
(
err
)
return
nil
,
OsErrorTo
Errno
(
err
)
}
return
&
LoopbackFile
{
file
:
f
},
OK
}
func
(
me
*
LoopbackFileSystem
)
Chmod
(
path
string
,
mode
uint32
)
(
code
Status
)
{
err
:=
os
.
Chmod
(
me
.
GetPath
(
path
),
mode
)
return
OsErrorTo
FuseError
(
err
)
return
OsErrorTo
Errno
(
err
)
}
func
(
me
*
LoopbackFileSystem
)
Chown
(
path
string
,
uid
uint32
,
gid
uint32
)
(
code
Status
)
{
return
OsErrorTo
FuseError
(
os
.
Chown
(
me
.
GetPath
(
path
),
int
(
uid
),
int
(
gid
)))
return
OsErrorTo
Errno
(
os
.
Chown
(
me
.
GetPath
(
path
),
int
(
uid
),
int
(
gid
)))
}
func
(
me
*
LoopbackFileSystem
)
Truncate
(
path
string
,
offset
uint64
)
(
code
Status
)
{
return
OsErrorTo
FuseError
(
os
.
Truncate
(
me
.
GetPath
(
path
),
int64
(
offset
)))
return
OsErrorTo
Errno
(
os
.
Truncate
(
me
.
GetPath
(
path
),
int64
(
offset
)))
}
func
(
me
*
LoopbackFileSystem
)
Utimens
(
path
string
,
AtimeNs
uint64
,
MtimeNs
uint64
)
(
code
Status
)
{
return
OsErrorTo
FuseError
(
os
.
Chtimes
(
me
.
GetPath
(
path
),
int64
(
AtimeNs
),
int64
(
MtimeNs
)))
return
OsErrorTo
Errno
(
os
.
Chtimes
(
me
.
GetPath
(
path
),
int64
(
AtimeNs
),
int64
(
MtimeNs
)))
}
func
(
me
*
LoopbackFileSystem
)
Readlink
(
name
string
)
(
out
string
,
code
Status
)
{
f
,
err
:=
os
.
Readlink
(
me
.
GetPath
(
name
))
return
f
,
OsErrorTo
FuseError
(
err
)
return
f
,
OsErrorTo
Errno
(
err
)
}
func
(
me
*
LoopbackFileSystem
)
Mknod
(
name
string
,
mode
uint32
,
dev
uint32
)
(
code
Status
)
{
...
...
@@ -112,7 +112,7 @@ func (me *LoopbackFileSystem) Mknod(name string, mode uint32, dev uint32) (code
}
func
(
me
*
LoopbackFileSystem
)
Mkdir
(
path
string
,
mode
uint32
)
(
code
Status
)
{
return
OsErrorTo
FuseError
(
os
.
Mkdir
(
me
.
GetPath
(
path
),
mode
))
return
OsErrorTo
Errno
(
os
.
Mkdir
(
me
.
GetPath
(
path
),
mode
))
}
// Don't use os.Remove, it removes twice (unlink followed by rmdir).
...
...
@@ -125,16 +125,16 @@ func (me *LoopbackFileSystem) Rmdir(name string) (code Status) {
}
func
(
me
*
LoopbackFileSystem
)
Symlink
(
pointedTo
string
,
linkName
string
)
(
code
Status
)
{
return
OsErrorTo
FuseError
(
os
.
Symlink
(
pointedTo
,
me
.
GetPath
(
linkName
)))
return
OsErrorTo
Errno
(
os
.
Symlink
(
pointedTo
,
me
.
GetPath
(
linkName
)))
}
func
(
me
*
LoopbackFileSystem
)
Rename
(
oldPath
string
,
newPath
string
)
(
code
Status
)
{
err
:=
os
.
Rename
(
me
.
GetPath
(
oldPath
),
me
.
GetPath
(
newPath
))
return
OsErrorTo
FuseError
(
err
)
return
OsErrorTo
Errno
(
err
)
}
func
(
me
*
LoopbackFileSystem
)
Link
(
orig
string
,
newName
string
)
(
code
Status
)
{
return
OsErrorTo
FuseError
(
os
.
Link
(
me
.
GetPath
(
orig
),
me
.
GetPath
(
newName
)))
return
OsErrorTo
Errno
(
os
.
Link
(
me
.
GetPath
(
orig
),
me
.
GetPath
(
newName
)))
}
func
(
me
*
LoopbackFileSystem
)
Access
(
name
string
,
mode
uint32
)
(
code
Status
)
{
...
...
@@ -143,7 +143,7 @@ func (me *LoopbackFileSystem) Access(name string, mode uint32) (code Status) {
func
(
me
*
LoopbackFileSystem
)
Create
(
path
string
,
flags
uint32
,
mode
uint32
)
(
fuseFile
FuseFile
,
code
Status
)
{
f
,
err
:=
os
.
OpenFile
(
me
.
GetPath
(
path
),
int
(
flags
)
|
os
.
O_CREATE
,
mode
)
return
&
LoopbackFile
{
file
:
f
},
OsErrorTo
FuseError
(
err
)
return
&
LoopbackFile
{
file
:
f
},
OsErrorTo
Errno
(
err
)
}
func
(
me
*
LoopbackFileSystem
)
GetXAttr
(
name
string
,
attr
string
)
([]
byte
,
Status
)
{
...
...
@@ -185,12 +185,12 @@ func (me *LoopbackFile) Read(input *ReadIn, buffers *BufferPool) ([]byte, Status
if
err
==
os
.
EOF
{
return
slice
[
:
n
],
OK
}
return
slice
[
:
n
],
OsErrorTo
FuseError
(
err
)
return
slice
[
:
n
],
OsErrorTo
Errno
(
err
)
}
func
(
me
*
LoopbackFile
)
Write
(
input
*
WriteIn
,
data
[]
byte
)
(
uint32
,
Status
)
{
n
,
err
:=
me
.
file
.
WriteAt
(
data
,
int64
(
input
.
Offset
))
return
uint32
(
n
),
OsErrorTo
FuseError
(
err
)
return
uint32
(
n
),
OsErrorTo
Errno
(
err
)
}
func
(
me
*
LoopbackFile
)
Release
()
{
...
...
fuse/misc.go
View file @
fbe06b9f
...
...
@@ -24,7 +24,7 @@ func MakeTempDir() string {
}
// Convert os.Error back to Errno based errors.
func
OsErrorTo
FuseError
(
err
os
.
Error
)
Status
{
func
OsErrorTo
Errno
(
err
os
.
Error
)
Status
{
if
err
!=
nil
{
switch
t
:=
err
.
(
type
)
{
case
os
.
Errno
:
...
...
@@ -32,9 +32,9 @@ func OsErrorToFuseError(err os.Error) Status {
case
*
os
.
SyscallError
:
return
Status
(
t
.
Errno
)
case
*
os
.
PathError
:
return
OsErrorTo
FuseError
(
t
.
Error
)
return
OsErrorTo
Errno
(
t
.
Error
)
case
*
os
.
LinkError
:
return
OsErrorTo
FuseError
(
t
.
Error
)
return
OsErrorTo
Errno
(
t
.
Error
)
default
:
log
.
Println
(
"can't convert error type:"
,
err
)
return
ENOSYS
...
...
fuse/misc_test.go
View file @
fbe06b9f
...
...
@@ -7,20 +7,20 @@ import (
)
func
TestOsErrorTo
FuseError
(
t
*
testing
.
T
)
{
errNo
:=
OsErrorTo
FuseError
(
os
.
EPERM
)
func
TestOsErrorTo
Errno
(
t
*
testing
.
T
)
{
errNo
:=
OsErrorTo
Errno
(
os
.
EPERM
)
if
errNo
!=
syscall
.
EPERM
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
EPERM
)
}
e
:=
os
.
NewSyscallError
(
"syscall"
,
syscall
.
EPERM
)
errNo
=
OsErrorTo
FuseError
(
e
)
errNo
=
OsErrorTo
Errno
(
e
)
if
errNo
!=
syscall
.
EPERM
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
EPERM
)
}
e
=
os
.
Remove
(
"this-file-surely-does-not-exist"
)
errNo
=
OsErrorTo
FuseError
(
e
)
errNo
=
OsErrorTo
Errno
(
e
)
if
errNo
!=
syscall
.
ENOENT
{
t
.
Errorf
(
"Wrong conversion %v != %v"
,
errNo
,
syscall
.
ENOENT
)
}
...
...
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