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
53596189
Commit
53596189
authored
Aug 14, 2010
by
Ivan Krasin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dispatch is splitted to handle and dispatch
parent
6f46ced3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
23 deletions
+22
-23
fuse/fuse.go
fuse/fuse.go
+22
-23
No files found.
fuse/fuse.go
View file @
53596189
...
...
@@ -52,11 +52,11 @@ func loop(f *os.File, fs FileSystem, errors chan os.Error) {
break
}
go
dispatch
(
fs
,
buf
[
0
:
n
],
c
,
toW
,
errors
)
go
handle
(
fs
,
buf
[
0
:
n
],
c
,
toW
,
errors
)
}
}
func
dispatch
(
fs
FileSystem
,
in_data
[]
byte
,
c
*
managerClient
,
toW
chan
[][]
byte
,
errors
chan
os
.
Error
)
{
func
handle
(
fs
FileSystem
,
in_data
[]
byte
,
c
*
managerClient
,
toW
chan
[][]
byte
,
errors
chan
os
.
Error
)
{
fmt
.
Printf
(
"in_data: %v
\n
"
,
in_data
)
r
:=
bytes
.
NewBuffer
(
in_data
)
h
:=
new
(
InHeader
)
...
...
@@ -68,40 +68,39 @@ func dispatch(fs FileSystem, in_data []byte, c *managerClient, toW chan [][]byte
errors
<-
err
return
}
var
out
[][]
byte
out
:=
dispatch
(
fs
,
h
,
r
,
c
,
errors
)
if
out
==
nil
{
fmt
.
Printf
(
"out is nil"
)
return
}
fmt
.
Printf
(
"Sending to writer: %v
\n
"
,
out
)
toW
<-
out
}
func
dispatch
(
fs
FileSystem
,
h
*
InHeader
,
r
*
bytes
.
Buffer
,
c
*
managerClient
,
errors
chan
os
.
Error
)
(
out
[][]
byte
)
{
fmt
.
Printf
(
"Opcode: %v, NodeId: %v, h: %v
\n
"
,
h
.
Opcode
,
h
.
NodeId
,
h
)
switch
h
.
Opcode
{
case
FUSE_INIT
:
out
=
initFuse
(
fs
,
h
,
r
,
c
)
return
initFuse
(
fs
,
h
,
r
,
c
)
case
FUSE_FORGET
:
return
return
nil
case
FUSE_GETATTR
:
out
=
getAttr
(
fs
,
h
,
r
,
c
)
return
getAttr
(
fs
,
h
,
r
,
c
)
case
FUSE_GETXATTR
:
out
=
getXAttr
(
h
,
r
,
c
)
return
getXAttr
(
h
,
r
,
c
)
case
FUSE_OPENDIR
:
out
=
openDir
(
h
,
r
,
c
)
return
openDir
(
h
,
r
,
c
)
case
FUSE_READDIR
:
out
=
readDir
(
h
,
r
,
c
)
return
readDir
(
h
,
r
,
c
)
case
FUSE_LOOKUP
:
out
=
lookup
(
h
,
r
,
c
)
return
lookup
(
h
,
r
,
c
)
case
FUSE_RELEASEDIR
:
out
=
releaseDir
(
h
,
r
,
c
)
return
releaseDir
(
h
,
r
,
c
)
default
:
errors
<-
os
.
NewError
(
fmt
.
Sprintf
(
"Unsupported OpCode: %d"
,
h
.
Opcode
))
out
=
serialize
(
h
,
ENOSYS
,
nil
)
}
if
err
!=
nil
{
errors
<-
err
out
=
serialize
(
h
,
EIO
,
nil
)
}
if
out
==
nil
||
len
(
out
)
==
0
{
fmt
.
Printf
(
"out is empty
\n
"
)
return
return
serialize
(
h
,
ENOSYS
,
nil
)
}
fmt
.
Printf
(
"Sending to writer: %v
\n
"
,
out
)
toW
<-
out
return
}
func
serialize
(
h
*
InHeader
,
res
Status
,
out
interface
{})
(
data
[][]
byte
)
{
...
...
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