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
77de056f
Commit
77de056f
authored
Apr 29, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide the opcode type.
parent
38077f24
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
23 deletions
+23
-23
fuse/fuse.go
fuse/fuse.go
+11
-11
fuse/opcode.go
fuse/opcode.go
+10
-10
fuse/types.go
fuse/types.go
+2
-2
No files found.
fuse/fuse.go
View file @
77de056f
...
...
@@ -118,8 +118,8 @@ func (me *MountState) Write(req *request) {
}
if
err
!=
nil
{
log
.
Printf
(
"writer: Write/Writev %v failed, err: %v.
O
pcode: %v"
,
req
.
outHeaderBytes
,
err
,
operationName
(
req
.
inHeader
.
O
pcode
))
log
.
Printf
(
"writer: Write/Writev %v failed, err: %v.
o
pcode: %v"
,
req
.
outHeaderBytes
,
err
,
operationName
(
req
.
inHeader
.
o
pcode
))
}
}
...
...
@@ -179,7 +179,7 @@ func (me *MountState) discardRequest(req *request) {
endNs
:=
time
.
Nanoseconds
()
dt
:=
endNs
-
req
.
startNs
opname
:=
operationName
(
req
.
inHeader
.
O
pcode
)
opname
:=
operationName
(
req
.
inHeader
.
o
pcode
)
me
.
LatencyMap
.
AddMany
(
[]
LatencyArg
{
{
opname
,
""
,
dt
},
...
...
@@ -249,19 +249,19 @@ func (me *MountState) chopMessage(req *request) *operationHandler {
req
.
inHeader
=
(
*
InHeader
)(
unsafe
.
Pointer
(
&
req
.
inputBuf
[
0
]))
req
.
arg
=
req
.
inputBuf
[
inHSize
:
]
handler
:=
getHandler
(
req
.
inHeader
.
O
pcode
)
handler
:=
getHandler
(
req
.
inHeader
.
o
pcode
)
if
handler
==
nil
||
handler
.
Func
==
nil
{
msg
:=
"Unimplemented"
if
handler
==
nil
{
msg
=
"Unknown"
}
log
.
Printf
(
"%s opcode %v"
,
msg
,
req
.
inHeader
.
O
pcode
)
log
.
Printf
(
"%s opcode %v"
,
msg
,
req
.
inHeader
.
o
pcode
)
req
.
status
=
ENOSYS
return
handler
}
if
len
(
req
.
arg
)
<
handler
.
InputSize
{
log
.
Printf
(
"Short read for %v: %v"
,
req
.
inHeader
.
O
pcode
,
req
.
arg
)
log
.
Printf
(
"Short read for %v: %v"
,
req
.
inHeader
.
o
pcode
,
req
.
arg
)
req
.
status
=
EIO
return
handler
}
...
...
@@ -288,7 +288,7 @@ func (me *MountState) handle(req *request) {
// If we try to write OK, nil, we will get
// error: writer: Writev [[16 0 0 0 0 0 0 0 17 0 0 0 0 0 0 0]]
// failed, err: writev: no such file or directory
if
req
.
inHeader
.
O
pcode
!=
FUSE_FORGET
{
if
req
.
inHeader
.
o
pcode
!=
FUSE_FORGET
{
serialize
(
req
,
handler
,
me
.
Debug
)
me
.
Write
(
req
)
}
...
...
@@ -296,7 +296,7 @@ func (me *MountState) handle(req *request) {
func
(
me
*
MountState
)
dispatch
(
req
*
request
,
handler
*
operationHandler
)
{
if
me
.
Debug
{
handler
:=
getHandler
(
req
.
inHeader
.
O
pcode
)
handler
:=
getHandler
(
req
.
inHeader
.
o
pcode
)
var
names
interface
{}
if
handler
.
FileNames
>
0
{
names
=
req
.
filenames
(
handler
.
FileNames
)
...
...
@@ -304,7 +304,7 @@ func (me *MountState) dispatch(req *request, handler *operationHandler) {
names
=
""
}
log
.
Printf
(
"Dispatch: %v, NodeId: %v %v
\n
"
,
operationName
(
req
.
inHeader
.
O
pcode
),
req
.
inHeader
.
NodeId
,
names
)
operationName
(
req
.
inHeader
.
o
pcode
),
req
.
inHeader
.
NodeId
,
names
)
}
handler
.
Func
(
me
,
req
)
}
...
...
@@ -331,7 +331,7 @@ func serialize(req *request, handler *operationHandler, debug bool) {
copy
(
req
.
outHeaderBytes
[
sizeOfOutHeader
:
],
asSlice
(
req
.
outData
,
dataLength
))
if
debug
{
val
:=
fmt
.
Sprintf
(
"%v"
,
replyString
(
req
.
inHeader
.
O
pcode
,
req
.
outData
))
val
:=
fmt
.
Sprintf
(
"%v"
,
replyString
(
req
.
inHeader
.
o
pcode
,
req
.
outData
))
max
:=
1024
if
len
(
val
)
>
max
{
val
=
val
[
:
max
]
+
fmt
.
Sprintf
(
" ...trimmed (response size %d)"
,
outHeader
.
Length
)
...
...
@@ -342,6 +342,6 @@ func serialize(req *request, handler *operationHandler, debug bool) {
msg
=
fmt
.
Sprintf
(
" flat: %d
\n
"
,
len
(
req
.
flatData
))
}
log
.
Printf
(
"Serialize: %v code: %v value: %v%v"
,
operationName
(
req
.
inHeader
.
O
pcode
),
req
.
status
,
val
,
msg
)
operationName
(
req
.
inHeader
.
o
pcode
),
req
.
status
,
val
,
msg
)
}
}
fuse/opcode.go
View file @
77de056f
...
...
@@ -9,8 +9,8 @@ import (
var
_
=
log
.
Printf
func
replyString
(
op
code
O
pcode
,
ptr
unsafe
.
Pointer
)
string
{
h
:=
getHandler
(
op
code
)
func
replyString
(
op
o
pcode
,
ptr
unsafe
.
Pointer
)
string
{
h
:=
getHandler
(
op
)
var
val
interface
{}
if
h
.
DecodeOut
!=
nil
{
val
=
h
.
DecodeOut
(
ptr
)
...
...
@@ -120,7 +120,7 @@ func doWrite(state *MountState, req *request) {
func
doGetXAttr
(
state
*
MountState
,
req
*
request
)
{
input
:=
(
*
GetXAttrIn
)(
req
.
inData
)
var
data
[]
byte
if
req
.
inHeader
.
O
pcode
==
FUSE_GETXATTR
{
if
req
.
inHeader
.
o
pcode
==
FUSE_GETXATTR
{
data
,
req
.
status
=
state
.
fileSystem
.
GetXAttr
(
req
.
inHeader
,
req
.
filename
())
}
else
{
data
,
req
.
status
=
state
.
fileSystem
.
ListXAttr
(
req
.
inHeader
)
...
...
@@ -265,19 +265,19 @@ type operationHandler struct {
var
operationHandlers
[]
*
operationHandler
func
operationName
(
op
code
O
pcode
)
string
{
h
:=
getHandler
(
op
code
)
func
operationName
(
op
o
pcode
)
string
{
h
:=
getHandler
(
op
)
if
h
==
nil
{
return
"unknown"
}
return
h
.
Name
}
func
(
op
O
pcode
)
String
()
string
{
func
(
op
o
pcode
)
String
()
string
{
return
operationName
(
op
)
}
func
getHandler
(
o
O
pcode
)
*
operationHandler
{
func
getHandler
(
o
o
pcode
)
*
operationHandler
{
if
o
>=
OPCODE_COUNT
{
return
nil
}
...
...
@@ -387,7 +387,7 @@ func init() {
operationHandlers
[
op
]
.
Name
=
v
}
for
op
,
v
:=
range
map
[
O
pcode
]
operationFunc
{
for
op
,
v
:=
range
map
[
o
pcode
]
operationFunc
{
FUSE_OPEN
:
doOpen
,
FUSE_READDIR
:
doReadDir
,
FUSE_WRITE
:
doWrite
,
...
...
@@ -422,7 +422,7 @@ func init() {
operationHandlers
[
op
]
.
Func
=
v
}
for
op
,
f
:=
range
map
[
O
pcode
]
castPointerFunc
{
for
op
,
f
:=
range
map
[
o
pcode
]
castPointerFunc
{
FUSE_LOOKUP
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
EntryOut
)(
ptr
)
},
FUSE_OPEN
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
EntryOut
)(
ptr
)
},
FUSE_GETATTR
:
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
AttrOut
)(
ptr
)
},
...
...
@@ -430,7 +430,7 @@ func init() {
operationHandlers
[
op
]
.
DecodeOut
=
f
}
for
op
,
count
:=
range
map
[
O
pcode
]
int
{
for
op
,
count
:=
range
map
[
o
pcode
]
int
{
FUSE_LOOKUP
:
1
,
FUSE_RENAME
:
2
,
FUSE_SYMLINK
:
2
,
...
...
fuse/types.go
View file @
77de056f
...
...
@@ -98,7 +98,7 @@ const (
EXDEV
=
Status
(
syscall
.
EXDEV
)
)
type
O
pcode
int
type
o
pcode
int
const
(
FUSE_LOOKUP
=
1
...
...
@@ -455,7 +455,7 @@ type NotifyPollWakeupOut struct {
type
InHeader
struct
{
Length
uint32
O
pcode
o
pcode
Unique
uint64
NodeId
uint64
Identity
...
...
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