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
Show 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 {
...
@@ -178,10 +178,10 @@ func (me *MountState) readRequest(req *request) os.Error {
}
}
func
(
me
*
MountState
)
discardRequest
(
req
*
request
)
{
func
(
me
*
MountState
)
discardRequest
(
req
*
request
)
{
if
me
.
RecordStatistics
{
endNs
:=
time
.
Nanoseconds
()
endNs
:=
time
.
Nanoseconds
()
dt
:=
endNs
-
req
.
startNs
dt
:=
endNs
-
req
.
startNs
if
me
.
RecordStatistics
{
me
.
statisticsMutex
.
Lock
()
me
.
statisticsMutex
.
Lock
()
defer
me
.
statisticsMutex
.
Unlock
()
defer
me
.
statisticsMutex
.
Unlock
()
...
...
fuse/misc.go
View file @
6ed7e494
...
@@ -14,6 +14,14 @@ import (
...
@@ -14,6 +14,14 @@ import (
"io/ioutil"
"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.
// Make a temporary directory securely.
func
MakeTempDir
()
string
{
func
MakeTempDir
()
string
{
nm
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse"
)
nm
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse"
)
...
...
fuse/opcode.go
View file @
6ed7e494
...
@@ -3,24 +3,14 @@ package fuse
...
@@ -3,24 +3,14 @@ package fuse
import
(
import
(
"bytes"
"bytes"
"fmt"
"fmt"
"os"
"unsafe"
"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
{
func
replyString
(
opcode
Opcode
,
ptr
unsafe
.
Pointer
)
string
{
h
:=
getHandler
(
opcode
)
var
val
interface
{}
var
val
interface
{}
switch
opcode
{
if
h
.
DecodeOut
!=
nil
{
case
FUSE_LOOKUP
:
val
=
h
.
DecodeOut
(
ptr
)
val
=
(
*
EntryOut
)(
ptr
)
case
FUSE_OPEN
:
val
=
(
*
OpenOut
)(
ptr
)
}
}
if
val
!=
nil
{
if
val
!=
nil
{
return
fmt
.
Sprintf
(
"%v"
,
val
)
return
fmt
.
Sprintf
(
"%v"
,
val
)
...
@@ -45,7 +35,6 @@ func doOpen(state *MountState, req *request) {
...
@@ -45,7 +35,6 @@ func doOpen(state *MountState, req *request) {
req
.
outData
=
unsafe
.
Pointer
(
out
)
req
.
outData
=
unsafe
.
Pointer
(
out
)
}
}
func
doCreate
(
state
*
MountState
,
req
*
request
)
{
func
doCreate
(
state
*
MountState
,
req
*
request
)
{
flags
,
handle
,
entry
,
status
:=
state
.
fileSystem
.
Create
(
req
.
inHeader
,
(
*
CreateIn
)(
req
.
inData
),
req
.
filename
())
flags
,
handle
,
entry
,
status
:=
state
.
fileSystem
.
Create
(
req
.
inHeader
,
(
*
CreateIn
)(
req
.
inData
),
req
.
filename
())
req
.
status
=
status
req
.
status
=
status
...
@@ -238,6 +227,8 @@ type operationHandler struct {
...
@@ -238,6 +227,8 @@ type operationHandler struct {
Func
operationFunc
Func
operationFunc
InputSize
int
InputSize
int
OutputSize
int
OutputSize
int
DecodeIn
func
(
unsafe
.
Pointer
)
interface
{}
DecodeOut
func
(
unsafe
.
Pointer
)
interface
{}
}
}
var
operationHandlers
[]
*
operationHandler
var
operationHandlers
[]
*
operationHandler
...
@@ -394,4 +385,12 @@ func init() {
...
@@ -394,4 +385,12 @@ func init() {
}
{
}
{
operationHandlers
[
op
]
.
Func
=
v
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