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
Kirill Smelkov
go-fuse
Commits
aab171a3
Commit
aab171a3
authored
Jun 30, 2013
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse: hide ReadResultData and ReadResultFd types.
parent
fb412460
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
23 deletions
+26
-23
fuse/defaultraw.go
fuse/defaultraw.go
+1
-1
fuse/nodefs/files.go
fuse/nodefs/files.go
+4
-9
fuse/opcode.go
fuse/opcode.go
+1
-1
fuse/read.go
fuse/read.go
+16
-8
fuse/request.go
fuse/request.go
+1
-1
fuse/splice_linux.go
fuse/splice_linux.go
+2
-2
fuse/test/fsetattr_test.go
fuse/test/fsetattr_test.go
+1
-1
No files found.
fuse/defaultraw.go
View file @
aab171a3
...
...
@@ -112,7 +112,7 @@ func (fs *defaultRawFileSystem) OpenDir(out *raw.OpenOut, context *Context, inpu
}
func
(
fs
*
defaultRawFileSystem
)
Read
(
context
*
Context
,
input
*
raw
.
ReadIn
,
buf
[]
byte
)
(
ReadResult
,
Status
)
{
return
&
ReadResultData
{}
,
ENOSYS
return
nil
,
ENOSYS
}
func
(
fs
*
defaultRawFileSystem
)
Release
(
context
*
Context
,
input
*
raw
.
ReleaseIn
)
{
...
...
fuse/nodefs/files.go
View file @
aab171a3
...
...
@@ -49,11 +49,9 @@ func (f *dataFile) Read(buf []byte, off int64) (res fuse.ReadResult, code fuse.S
end
=
len
(
f
.
data
)
}
return
&
fuse
.
ReadResultData
{
f
.
data
[
off
:
end
]}
,
fuse
.
OK
return
fuse
.
ReadResultData
(
f
.
data
[
off
:
end
])
,
fuse
.
OK
}
////////////////
type
devNullFile
struct
{
File
}
...
...
@@ -75,7 +73,7 @@ func (f *devNullFile) String() string {
}
func
(
f
*
devNullFile
)
Read
(
buf
[]
byte
,
off
int64
)
(
fuse
.
ReadResult
,
fuse
.
Status
)
{
return
&
fuse
.
ReadResultData
{}
,
fuse
.
OK
return
fuse
.
ReadResultData
(
nil
)
,
fuse
.
OK
}
func
(
f
*
devNullFile
)
Write
(
content
[]
byte
,
off
int64
)
(
uint32
,
fuse
.
Status
)
{
...
...
@@ -126,12 +124,9 @@ func (f *loopbackFile) String() string {
}
func
(
f
*
loopbackFile
)
Read
(
buf
[]
byte
,
off
int64
)
(
res
fuse
.
ReadResult
,
code
fuse
.
Status
)
{
// TODO - this is racy. The lock should be taken when the Fd is spliced.
f
.
lock
.
Lock
()
r
:=
&
fuse
.
ReadResultFd
{
Fd
:
f
.
File
.
Fd
(),
Off
:
off
,
Sz
:
len
(
buf
),
}
r
:=
fuse
.
ReadResultFd
(
f
.
File
.
Fd
(),
off
,
len
(
buf
))
f
.
lock
.
Unlock
()
return
r
,
fuse
.
OK
}
...
...
fuse/opcode.go
View file @
aab171a3
...
...
@@ -288,7 +288,7 @@ func doRead(state *Server, req *request) {
buf
:=
state
.
allocOut
(
req
,
in
.
Size
)
req
.
readResult
,
req
.
status
=
state
.
fileSystem
.
Read
(
&
req
.
context
,
in
,
buf
)
if
fd
,
ok
:=
req
.
readResult
.
(
*
R
eadResultFd
);
ok
{
if
fd
,
ok
:=
req
.
readResult
.
(
*
r
eadResultFd
);
ok
{
req
.
fdData
=
fd
req
.
flatData
=
nil
}
else
if
req
.
readResult
!=
nil
&&
req
.
status
.
Ok
()
{
...
...
fuse/read.go
View file @
aab171a3
...
...
@@ -6,24 +6,32 @@ import (
)
// ReadResultData is the read return for returning bytes directly.
type
R
eadResultData
struct
{
type
r
eadResultData
struct
{
// Raw bytes for the read.
Data
[]
byte
}
func
(
r
*
R
eadResultData
)
Size
()
int
{
func
(
r
*
r
eadResultData
)
Size
()
int
{
return
len
(
r
.
Data
)
}
func
(
r
*
R
eadResultData
)
Done
()
{
func
(
r
*
r
eadResultData
)
Done
()
{
}
func
(
r
*
R
eadResultData
)
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
{
func
(
r
*
r
eadResultData
)
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
{
return
r
.
Data
,
OK
}
func
ReadResultData
(
b
[]
byte
)
ReadResult
{
return
&
readResultData
{
b
}
}
func
ReadResultFd
(
fd
uintptr
,
off
int64
,
sz
int
)
ReadResult
{
return
&
readResultFd
{
fd
,
off
,
sz
}
}
// ReadResultFd is the read return for zero-copy file data.
type
R
eadResultFd
struct
{
type
r
eadResultFd
struct
{
// Splice from the following file.
Fd
uintptr
...
...
@@ -37,7 +45,7 @@ type ReadResultFd struct {
// Reads raw bytes from file descriptor if necessary, using the passed
// buffer as storage.
func
(
r
*
R
eadResultFd
)
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
{
func
(
r
*
r
eadResultFd
)
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
{
sz
:=
r
.
Sz
if
len
(
buf
)
<
sz
{
sz
=
len
(
buf
)
...
...
@@ -55,9 +63,9 @@ func (r *ReadResultFd) Bytes(buf []byte) ([]byte, Status) {
return
buf
[
:
n
],
ToStatus
(
err
)
}
func
(
r
*
R
eadResultFd
)
Size
()
int
{
func
(
r
*
r
eadResultFd
)
Size
()
int
{
return
r
.
Sz
}
func
(
r
*
R
eadResultFd
)
Done
()
{
func
(
r
*
r
eadResultFd
)
Done
()
{
}
fuse/request.go
View file @
aab171a3
...
...
@@ -28,7 +28,7 @@ type request struct {
outData
unsafe
.
Pointer
status
Status
flatData
[]
byte
fdData
*
R
eadResultFd
fdData
*
r
eadResultFd
// In case of read, keep read result here so we can call
// Done() on it.
...
...
fuse/splice_linux.go
View file @
aab171a3
...
...
@@ -11,7 +11,7 @@ func (s *Server) setSplice() {
s
.
canSplice
=
splice
.
Resizable
()
}
func
(
ms
*
Server
)
trySplice
(
header
[]
byte
,
req
*
request
,
fdData
*
R
eadResultFd
)
error
{
func
(
ms
*
Server
)
trySplice
(
header
[]
byte
,
req
*
request
,
fdData
*
r
eadResultFd
)
error
{
pair
,
err
:=
splice
.
Get
()
if
err
!=
nil
{
return
err
...
...
@@ -43,7 +43,7 @@ func (ms *Server) trySplice(header []byte, req *request, fdData *ReadResultFd) e
header
=
req
.
serializeHeader
(
n
)
newFd
:=
R
eadResultFd
{
newFd
:=
r
eadResultFd
{
Fd
:
pair
.
ReadFd
(),
Off
:
-
1
,
Sz
:
n
,
...
...
fuse/test/fsetattr_test.go
View file @
aab171a3
...
...
@@ -31,7 +31,7 @@ func (f *MutableDataFile) Read(buf []byte, off int64) (fuse.ReadResult, fuse.Sta
end
=
len
(
f
.
data
)
}
return
&
fuse
.
ReadResultData
{
Data
:
f
.
data
[
off
:
end
]}
,
fuse
.
OK
return
fuse
.
ReadResultData
(
f
.
data
[
off
:
end
])
,
fuse
.
OK
}
func
(
f
*
MutableDataFile
)
Write
(
d
[]
byte
,
off
int64
)
(
uint32
,
fuse
.
Status
)
{
...
...
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