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
6ed7e494
Commit
6ed7e494
authored
Apr 22, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate en/decode for printing into array approach.
parent
c44a5101
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
20 deletions
+27
-20
fuse/fuse.go
fuse/fuse.go
+3
-3
fuse/misc.go
fuse/misc.go
+8
-0
fuse/opcode.go
fuse/opcode.go
+16
-17
No files found.
fuse/fuse.go
View file @
6ed7e494
...
...
@@ -178,10 +178,10 @@ func (me *MountState) readRequest(req *request) os.Error {
}
func
(
me
*
MountState
)
discardRequest
(
req
*
request
)
{
endNs
:=
time
.
Nanoseconds
()
dt
:=
endNs
-
req
.
startNs
if
me
.
RecordStatistics
{
endNs
:=
time
.
Nanoseconds
()
dt
:=
endNs
-
req
.
startNs
me
.
statisticsMutex
.
Lock
()
defer
me
.
statisticsMutex
.
Unlock
()
...
...
fuse/misc.go
View file @
6ed7e494
...
...
@@ -14,6 +14,14 @@ import (
"io/ioutil"
)
func
(
code
Status
)
String
()
string
{
if
code
==
OK
{
return
"OK"
}
return
fmt
.
Sprintf
(
"%d=%v"
,
int
(
code
),
os
.
Errno
(
code
))
}
// Make a temporary directory securely.
func
MakeTempDir
()
string
{
nm
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse"
)
...
...
fuse/opcode.go
View file @
6ed7e494
...
...
@@ -3,24 +3,14 @@ package fuse
import
(
"bytes"
"fmt"
"os"
"unsafe"
)
func
(
code
Status
)
String
()
string
{
if
code
==
OK
{
return
"OK"
}
return
fmt
.
Sprintf
(
"%d=%v"
,
int
(
code
),
os
.
Errno
(
code
))
}
func
replyString
(
opcode
Opcode
,
ptr
unsafe
.
Pointer
)
string
{
h
:=
getHandler
(
opcode
)
var
val
interface
{}
switch
opcode
{
case
FUSE_LOOKUP
:
val
=
(
*
EntryOut
)(
ptr
)
case
FUSE_OPEN
:
val
=
(
*
OpenOut
)(
ptr
)
if
h
.
DecodeOut
!=
nil
{
val
=
h
.
DecodeOut
(
ptr
)
}
if
val
!=
nil
{
return
fmt
.
Sprintf
(
"%v"
,
val
)
...
...
@@ -45,7 +35,6 @@ func doOpen(state *MountState, req *request) {
req
.
outData
=
unsafe
.
Pointer
(
out
)
}
func
doCreate
(
state
*
MountState
,
req
*
request
)
{
flags
,
handle
,
entry
,
status
:=
state
.
fileSystem
.
Create
(
req
.
inHeader
,
(
*
CreateIn
)(
req
.
inData
),
req
.
filename
())
req
.
status
=
status
...
...
@@ -234,10 +223,12 @@ func doRename(state *MountState, req *request) {
type
operationFunc
func
(
*
MountState
,
*
request
)
type
operationHandler
struct
{
Name
string
Func
operationFunc
InputSize
int
Name
string
Func
operationFunc
InputSize
int
OutputSize
int
DecodeIn
func
(
unsafe
.
Pointer
)
interface
{}
DecodeOut
func
(
unsafe
.
Pointer
)
interface
{}
}
var
operationHandlers
[]
*
operationHandler
...
...
@@ -394,4 +385,12 @@ func init() {
}
{
operationHandlers
[
op
]
.
Func
=
v
}
operationHandlers
[
FUSE_LOOKUP
]
.
DecodeOut
=
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
EntryOut
)(
ptr
)
}
operationHandlers
[
FUSE_OPEN
]
.
DecodeOut
=
func
(
ptr
unsafe
.
Pointer
)
interface
{}
{
return
(
*
EntryOut
)(
ptr
)
}
}
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