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
54b42724
Commit
54b42724
authored
Jun 21, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle error conditions in ReadResultFd.
parent
f165c912
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
11 deletions
+18
-11
fuse/api.go
fuse/api.go
+1
-1
fuse/copy.go
fuse/copy.go
+4
-1
fuse/mountstate.go
fuse/mountstate.go
+3
-3
fuse/opcode.go
fuse/opcode.go
+1
-1
fuse/read.go
fuse/read.go
+9
-5
No files found.
fuse/api.go
View file @
54b42724
...
...
@@ -191,7 +191,7 @@ type ReadResult interface {
// Returns the raw bytes for the read, possibly using the
// passed buffer. The buffer should be larger than the return
// value from Size.
Bytes
(
buf
[]
byte
)
[]
byte
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
// Size returns how many bytes this return value takes at most.
Size
()
int
...
...
fuse/copy.go
View file @
54b42724
...
...
@@ -31,7 +31,10 @@ func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Conte
if
!
code
.
Ok
()
{
return
code
}
data
:=
res
.
Bytes
(
buf
)
data
,
code
:=
res
.
Bytes
(
buf
)
if
!
code
.
Ok
()
{
return
code
}
if
len
(
data
)
==
0
{
break
...
...
fuse/mountstate.go
View file @
54b42724
...
...
@@ -363,7 +363,7 @@ func (ms *MountState) write(req *request) Status {
log
.
Println
(
"TrySplice:"
,
err
)
sz
:=
req
.
flatDataSize
()
buf
:=
ms
.
AllocOut
(
req
,
uint32
(
sz
))
req
.
flatData
=
req
.
fdData
.
Bytes
(
buf
)
req
.
flatData
,
req
.
status
=
req
.
fdData
.
Bytes
(
buf
)
header
=
req
.
serializeHeader
(
len
(
req
.
flatData
))
}
}
...
...
@@ -449,7 +449,7 @@ func (ms *MountState) writeDeleteNotify(parent uint64, child uint64, name string
if
ms
.
kernelSettings
.
Minor
<
18
{
return
ms
.
writeEntryNotify
(
parent
,
name
)
}
req
:=
request
{
inHeader
:
&
raw
.
InHeader
{
Opcode
:
_OP_NOTIFY_DELETE
,
...
...
@@ -459,7 +459,7 @@ func (ms *MountState) writeDeleteNotify(parent uint64, child uint64, name string
}
entry
:=
&
raw
.
NotifyInvalDeleteOut
{
Parent
:
parent
,
Child
:
child
,
Child
:
child
,
NameLen
:
uint32
(
len
(
name
)),
}
...
...
fuse/opcode.go
View file @
54b42724
...
...
@@ -279,7 +279,7 @@ func doRead(state *MountState, req *request) {
req
.
fdData
=
fd
req
.
flatData
=
nil
}
else
if
r
!=
nil
{
req
.
flatData
=
r
.
Bytes
(
buf
)
req
.
flatData
,
req
.
status
=
r
.
Bytes
(
buf
)
}
}
...
...
fuse/read.go
View file @
54b42724
...
...
@@ -15,8 +15,8 @@ func (r *ReadResultData) Size() int {
return
len
(
r
.
Data
)
}
func
(
r
*
ReadResultData
)
Bytes
(
buf
[]
byte
)
[]
byte
{
return
r
.
Data
func
(
r
*
ReadResultData
)
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
{
return
r
.
Data
,
OK
}
// ReadResultFd is the read return for zero-copy file data.
...
...
@@ -34,7 +34,7 @@ type ReadResultFd struct {
// Reads raw bytes from file descriptor if necessary, using the passed
// buffer as storage.
func
(
r
*
ReadResultFd
)
Bytes
(
buf
[]
byte
)
[]
byte
{
func
(
r
*
ReadResultFd
)
Bytes
(
buf
[]
byte
)
([]
byte
,
Status
)
{
sz
:=
r
.
Sz
if
len
(
buf
)
<
sz
{
sz
=
len
(
buf
)
...
...
@@ -44,8 +44,12 @@ func (r *ReadResultFd) Bytes(buf []byte) []byte {
if
err
==
io
.
EOF
{
err
=
nil
}
// TODO - error handling?
return
buf
[
:
n
]
if
n
<
0
{
n
=
0
}
return
buf
[
:
n
],
ToStatus
(
err
)
}
func
(
r
*
ReadResultFd
)
Size
()
int
{
...
...
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