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
ccdeeb8c
Commit
ccdeeb8c
authored
Aug 13, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse.go formatted
parent
340517c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
85 deletions
+92
-85
fuse/fuse.go
fuse/fuse.go
+92
-85
No files found.
fuse/fuse.go
View file @
ccdeeb8c
...
...
@@ -53,7 +53,7 @@ func loop(f *os.File, fs FileSystem, errors chan os.Error) {
}
}
func
dispatch
(
fs
FileSystem
,
in_data
[]
byte
,
toW
chan
[][]
byte
,
errors
chan
os
.
Error
)
{
func
dispatch
(
fs
FileSystem
,
in_data
[]
byte
,
toW
chan
[][]
byte
,
errors
chan
os
.
Error
)
{
fmt
.
Printf
(
"in_data: %v
\n
"
,
in_data
)
r
:=
bytes
.
NewBuffer
(
in_data
)
h
:=
new
(
InHeader
)
...
...
@@ -68,14 +68,22 @@ func dispatch(fs FileSystem, in_data []byte, toW chan[][]byte, errors chan os.Er
var
out
[][]
byte
fmt
.
Printf
(
"Opcode: %v, NodeId: %v, h: %v
\n
"
,
h
.
Opcode
,
h
.
NodeId
,
h
)
switch
h
.
Opcode
{
case
FUSE_INIT
:
out
,
err
=
initFuse
(
fs
,
h
,
r
)
case
FUSE_FORGET
:
return
case
FUSE_GETATTR
:
out
,
err
=
getAttr
(
fs
,
h
,
r
)
case
FUSE_GETXATTR
:
out
,
err
=
getXAttr
(
h
,
r
)
case
FUSE_OPENDIR
:
out
,
err
=
openDir
(
h
,
r
)
case
FUSE_READDIR
:
out
,
err
=
readDir
(
h
,
r
)
case
FUSE_LOOKUP
:
out
,
err
=
lookup
(
h
,
r
)
case
FUSE_RELEASEDIR
:
out
,
err
=
releaseDir
(
h
,
r
)
case
FUSE_INIT
:
out
,
err
=
initFuse
(
fs
,
h
,
r
)
case
FUSE_FORGET
:
return
case
FUSE_GETATTR
:
out
,
err
=
getAttr
(
fs
,
h
,
r
)
case
FUSE_GETXATTR
:
out
,
err
=
getXAttr
(
h
,
r
)
case
FUSE_OPENDIR
:
out
,
err
=
openDir
(
h
,
r
)
case
FUSE_READDIR
:
out
,
err
=
readDir
(
h
,
r
)
case
FUSE_LOOKUP
:
out
,
err
=
lookup
(
h
,
r
)
case
FUSE_RELEASEDIR
:
out
,
err
=
releaseDir
(
h
,
r
)
default
:
errors
<-
os
.
NewError
(
fmt
.
Sprintf
(
"Unsupported OpCode: %d"
,
h
.
Opcode
))
out
,
err
=
serialize
(
h
,
EIO
,
nil
)
...
...
@@ -118,7 +126,7 @@ func serialize(h *InHeader, res Error, out interface{}) (data [][]byte, err os.E
return
}
_
,
_
=
b
.
Write
(
out_data
)
data
=
[][]
byte
{
b
.
Bytes
()
}
data
=
[][]
byte
{
b
.
Bytes
()
}
return
}
...
...
@@ -191,7 +199,7 @@ func readDir(h *InHeader, r io.Reader) (data [][]byte, err os.Error) {
dirent
.
Off
=
1
dirent
.
Ino
=
h
.
NodeId
dirent
.
NameLen
=
7
dirent
.
Typ
=
(
S_IFDIR
&
0170000
)
>>
12
;
dirent
.
Typ
=
(
S_IFDIR
&
0170000
)
>>
12
buf
:=
new
(
bytes
.
Buffer
)
err
=
binary
.
Write
(
buf
,
binary
.
LittleEndian
,
dirent
)
if
err
!=
nil
{
...
...
@@ -234,4 +242,3 @@ func writer(f *os.File, in chan [][]byte, errors chan os.Error) {
fmt
.
Printf
(
"writer: OK
\n
"
)
}
}
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