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
adb311bb
Commit
adb311bb
authored
Aug 14, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminated FileSystem.Lookup. Simplifyed FileSystem.GetAttr
parent
3a403f14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
fuse/fuse.go
fuse/fuse.go
+10
-7
fuse/fuse_test.go
fuse/fuse_test.go
+1
-10
No files found.
fuse/fuse.go
View file @
adb311bb
...
@@ -15,8 +15,7 @@ const (
...
@@ -15,8 +15,7 @@ const (
type
FileSystem
interface
{
type
FileSystem
interface
{
List
(
parent
string
)
(
names
[]
string
,
code
Status
)
List
(
parent
string
)
(
names
[]
string
,
code
Status
)
Lookup
(
parent
,
filename
string
)
(
out
*
Attr
,
code
Status
)
GetAttr
(
path
string
)
(
out
*
Attr
,
code
Status
)
GetAttr
(
path
string
,
id
*
Identity
)
(
out
*
AttrOut
,
code
Status
)
}
}
type
Mounted
interface
{
type
Mounted
interface
{
...
@@ -165,7 +164,7 @@ func getAttr(fs FileSystem, h *InHeader, r io.Reader, c *managerClient) (data []
...
@@ -165,7 +164,7 @@ func getAttr(fs FileSystem, h *InHeader, r io.Reader, c *managerClient) (data []
return
return
}
}
fmt
.
Printf
(
"FUSE_GETATTR: %v, Fh: %d
\n
"
,
in
,
in
.
Fh
)
fmt
.
Printf
(
"FUSE_GETATTR: %v, Fh: %d
\n
"
,
in
,
in
.
Fh
)
var
out
*
AttrOut
out
:=
new
(
AttrOut
)
resp
:=
c
.
getPath
(
in
.
Fh
)
resp
:=
c
.
getPath
(
in
.
Fh
)
if
resp
.
err
!=
nil
{
if
resp
.
err
!=
nil
{
err
=
resp
.
err
err
=
resp
.
err
...
@@ -174,13 +173,17 @@ func getAttr(fs FileSystem, h *InHeader, r io.Reader, c *managerClient) (data []
...
@@ -174,13 +173,17 @@ 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
:=
fs
.
GetAttr
(
resp
.
path
,
&
h
.
Identity
)
attr
,
res
:=
fs
.
GetAttr
(
resp
.
path
)
if
res
!=
OK
{
if
res
!=
OK
{
return
serialize
(
h
,
res
,
nil
)
return
serialize
(
h
,
res
,
nil
)
}
}
if
out
!=
nil
{
if
attr
!=
nil
{
out
.
Ino
=
h
.
NodeId
out
.
Attr
=
*
attr
}
else
{
err
=
os
.
NewError
(
"fs.GetAttr returned nil as an Attr"
)
return
}
}
out
.
Ino
=
h
.
NodeId
data
,
err
=
serialize
(
h
,
res
,
out
)
data
,
err
=
serialize
(
h
,
res
,
out
)
return
return
}
}
...
@@ -503,7 +506,7 @@ func (m *manager) lookup(req *managerRequest) (resp *managerResponse) {
...
@@ -503,7 +506,7 @@ 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
:=
m
.
fs
.
Lookup
(
parent
,
req
.
filename
)
attr
,
code
:=
m
.
fs
.
GetAttr
(
path
.
Join
(
parent
,
req
.
filename
)
)
if
code
!=
OK
{
if
code
!=
OK
{
resp
.
code
=
code
resp
.
code
=
code
}
}
...
...
fuse/fuse_test.go
View file @
adb311bb
package
fuse
package
fuse
import
(
import
(
"fmt"
"log"
"log"
"os"
"os"
"path"
"strings"
"strings"
"testing"
"testing"
"time"
"time"
...
@@ -20,14 +18,7 @@ var (
...
@@ -20,14 +18,7 @@ var (
type
testFuse
struct
{}
type
testFuse
struct
{}
func
(
fs
*
testFuse
)
GetAttr
(
path
string
,
id
*
Identity
)
(
out
*
AttrOut
,
code
Status
)
{
func
(
fs
*
testFuse
)
GetAttr
(
path
string
)
(
out
*
Attr
,
code
Status
)
{
out
=
new
(
AttrOut
)
out
.
Mode
=
S_IFDIR
return
}
func
(
fs
*
testFuse
)
Lookup
(
parent
,
filename
string
)
(
out
*
Attr
,
code
Status
)
{
fmt
.
Printf
(
"testFuse.Lookup: %s
\n
"
,
path
.
Join
(
parent
,
filename
))
out
=
new
(
Attr
)
out
=
new
(
Attr
)
out
.
Mode
=
S_IFDIR
out
.
Mode
=
S_IFDIR
out
.
Mtime
=
uint64
(
time
.
Seconds
())
out
.
Mtime
=
uint64
(
time
.
Seconds
())
...
...
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