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
f47438ec
Commit
f47438ec
authored
May 26, 2012
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comment read.go.
parent
ebb11341
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
fuse/read.go
fuse/read.go
+15
-0
No files found.
fuse/read.go
View file @
f47438ec
...
...
@@ -5,8 +5,18 @@ import (
"syscall"
)
// The result of Read is an array of bytes, but for performance
// reasons, we can also return data as a file-descriptor/offset/size
// tuple. If the backing store for the file system is another
// filesystem, this reduces the amount of copying and memory in use.
//
// If at any point, the raw data is needed, ReadResult.Read() will
// load the raw data.
type
ReadResult
struct
{
// Errno code for the read.
Status
// Raw bytes for the read.
Data
[]
byte
// If Data is nil and Status OK, splice from the following
...
...
@@ -15,6 +25,9 @@ type ReadResult struct {
// Offset within Fd, or -1 to use current offset.
FdOff
int64
// Size of data to be loaded. Actual data available may be
// less at the EOF.
FdSize
int
}
...
...
@@ -29,6 +42,8 @@ func (r *ReadResult) Size() int {
return
r
.
FdSize
}
// Reads raw bytes from file descriptor if necessary, using the passed
// buffer as storage.
func
(
r
*
ReadResult
)
Read
(
buf
[]
byte
)
Status
{
if
r
.
Data
!=
nil
||
!
r
.
Ok
()
{
return
r
.
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