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
b72bba42
Commit
b72bba42
authored
Aug 14, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FileSystem members do not return os.Error, just fuse.Error (like OK/EIO/ENOSYS)
parent
5610b3e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
+13
-20
fuse/fuse.go
fuse/fuse.go
+9
-16
fuse/fuse_test.go
fuse/fuse_test.go
+4
-4
No files found.
fuse/fuse.go
View file @
b72bba42
...
@@ -14,9 +14,9 @@ const (
...
@@ -14,9 +14,9 @@ const (
)
)
type
FileSystem
interface
{
type
FileSystem
interface
{
List
(
parent
string
)
(
names
[]
string
,
code
Error
,
err
os
.
Error
)
List
(
parent
string
)
(
names
[]
string
,
code
Error
)
Lookup
(
parent
,
filename
string
)
(
out
*
Attr
,
code
Error
,
err
os
.
Error
)
Lookup
(
parent
,
filename
string
)
(
out
*
Attr
,
code
Error
)
GetAttr
(
path
string
,
id
*
Identity
,
flags
uint32
)
(
out
*
AttrOut
,
code
Error
,
err
os
.
Error
)
GetAttr
(
path
string
,
id
*
Identity
,
flags
uint32
)
(
out
*
AttrOut
,
code
Error
)
}
}
type
Mounted
interface
{
type
Mounted
interface
{
...
@@ -174,9 +174,9 @@ func getAttr(fs FileSystem, h *InHeader, r io.Reader, c *managerClient) (data []
...
@@ -174,9 +174,9 @@ func getAttr(fs FileSystem, h *InHeader, r io.Reader, c *managerClient) (data []
if
resp
.
code
!=
OK
{
if
resp
.
code
!=
OK
{
return
serialize
(
h
,
resp
.
code
,
nil
)
return
serialize
(
h
,
resp
.
code
,
nil
)
}
}
out
,
res
,
err
:=
fs
.
GetAttr
(
resp
.
path
,
&
h
.
Identity
,
in
.
GetAttrFlags
)
out
,
res
:=
fs
.
GetAttr
(
resp
.
path
,
&
h
.
Identity
,
in
.
GetAttrFlags
)
if
err
!=
nil
{
if
res
!=
OK
{
return
return
serialize
(
h
,
res
,
nil
)
}
}
if
out
!=
nil
{
if
out
!=
nil
{
out
.
Ino
=
h
.
NodeId
out
.
Ino
=
h
.
NodeId
...
@@ -503,14 +503,11 @@ func (m *manager) lookup(req *managerRequest) (resp *managerResponse) {
...
@@ -503,14 +503,11 @@ func (m *manager) lookup(req *managerRequest) (resp *managerResponse) {
resp
.
err
=
os
.
NewError
(
fmt
.
Sprintf
(
"lookup: can't lookup parent node with id: %d"
,
req
.
nodeId
))
resp
.
err
=
os
.
NewError
(
fmt
.
Sprintf
(
"lookup: can't lookup parent node with id: %d"
,
req
.
nodeId
))
return
return
}
}
attr
,
code
,
err
:=
m
.
fs
.
Lookup
(
parent
,
req
.
filename
)
attr
,
code
:=
m
.
fs
.
Lookup
(
parent
,
req
.
filename
)
if
err
!=
nil
{
resp
.
err
=
err
return
}
if
code
!=
OK
{
if
code
!=
OK
{
resp
.
code
=
code
resp
.
code
=
code
}
}
// TODO: sanitize return values, like checking attr != nil
resp
.
attr
=
attr
resp
.
attr
=
attr
fullPath
:=
path
.
Clean
(
path
.
Join
(
parent
,
req
.
filename
))
fullPath
:=
path
.
Clean
(
path
.
Join
(
parent
,
req
.
filename
))
nodeId
,
ok
:=
m
.
nodesByPath
[
fullPath
]
nodeId
,
ok
:=
m
.
nodesByPath
[
fullPath
]
...
@@ -544,13 +541,9 @@ func (m *manager) getPath(req *managerRequest) (resp *managerResponse) {
...
@@ -544,13 +541,9 @@ func (m *manager) getPath(req *managerRequest) (resp *managerResponse) {
func
readDirRoutine
(
dir
string
,
fs
FileSystem
,
c
*
managerClient
,
requests
chan
*
dirRequest
)
{
func
readDirRoutine
(
dir
string
,
fs
FileSystem
,
c
*
managerClient
,
requests
chan
*
dirRequest
)
{
defer
close
(
requests
)
defer
close
(
requests
)
dir
=
path
.
Clean
(
dir
)
dir
=
path
.
Clean
(
dir
)
names
,
code
,
err
:=
fs
.
List
(
dir
)
names
,
code
:=
fs
.
List
(
dir
)
i
:=
uint64
(
0
)
i
:=
uint64
(
0
)
for
req
:=
range
requests
{
for
req
:=
range
requests
{
if
err
!=
nil
{
req
.
resp
<-
&
dirResponse
{
nil
,
err
}
return
}
if
code
!=
OK
{
if
code
!=
OK
{
req
.
resp
<-
&
dirResponse
{
nil
,
os
.
NewError
(
fmt
.
Sprintf
(
"fs.List returned code: %d"
,
code
))}
req
.
resp
<-
&
dirResponse
{
nil
,
os
.
NewError
(
fmt
.
Sprintf
(
"fs.List returned code: %d"
,
code
))}
return
return
...
...
fuse/fuse_test.go
View file @
b72bba42
...
@@ -11,7 +11,7 @@ import (
...
@@ -11,7 +11,7 @@ import (
)
)
const
(
const
(
tempMountDir
=
"
./.
testMountDir"
tempMountDir
=
"testMountDir"
)
)
var
(
var
(
...
@@ -20,13 +20,13 @@ var (
...
@@ -20,13 +20,13 @@ var (
type
testFuse
struct
{}
type
testFuse
struct
{}
func
(
fs
*
testFuse
)
GetAttr
(
path
string
,
id
*
Identity
,
flags
uint32
)
(
out
*
AttrOut
,
code
Error
,
err
os
.
Error
)
{
func
(
fs
*
testFuse
)
GetAttr
(
path
string
,
id
*
Identity
,
flags
uint32
)
(
out
*
AttrOut
,
code
Error
)
{
out
=
new
(
AttrOut
)
out
=
new
(
AttrOut
)
out
.
Mode
=
S_IFDIR
out
.
Mode
=
S_IFDIR
return
return
}
}
func
(
fs
*
testFuse
)
Lookup
(
parent
,
filename
string
)
(
out
*
Attr
,
code
Error
,
err
os
.
Error
)
{
func
(
fs
*
testFuse
)
Lookup
(
parent
,
filename
string
)
(
out
*
Attr
,
code
Error
)
{
fmt
.
Printf
(
"testFuse.Lookup: %s
\n
"
,
path
.
Join
(
parent
,
filename
))
fmt
.
Printf
(
"testFuse.Lookup: %s
\n
"
,
path
.
Join
(
parent
,
filename
))
out
=
new
(
Attr
)
out
=
new
(
Attr
)
out
.
Mode
=
S_IFDIR
out
.
Mode
=
S_IFDIR
...
@@ -34,7 +34,7 @@ func (fs *testFuse) Lookup(parent, filename string) (out *Attr, code Error, err
...
@@ -34,7 +34,7 @@ func (fs *testFuse) Lookup(parent, filename string) (out *Attr, code Error, err
return
return
}
}
func
(
fs
*
testFuse
)
List
(
dir
string
)
(
names
[]
string
,
code
Error
,
err
os
.
Error
)
{
func
(
fs
*
testFuse
)
List
(
dir
string
)
(
names
[]
string
,
code
Error
)
{
names
=
testFileNames
names
=
testFileNames
return
return
}
}
...
...
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