Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-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
jacobsa-fuse
Commits
fe2f8723
Commit
fe2f8723
authored
Feb 27, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented HelloFS.ReadFile.
parent
4ef670f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
samples/hello_fs.go
samples/hello_fs.go
+22
-0
No files found.
samples/hello_fs.go
View file @
fe2f8723
...
...
@@ -4,7 +4,9 @@
package
samples
import
(
"io"
"os"
"strings"
"github.com/jacobsa/fuse"
"github.com/jacobsa/fuse/fuseutil"
...
...
@@ -243,3 +245,23 @@ func (fs *HelloFS) OpenFile(
resp
=
&
fuse
.
OpenFileResponse
{}
return
}
func
(
fs
*
HelloFS
)
ReadFile
(
ctx
context
.
Context
,
req
*
fuse
.
ReadFileRequest
)
(
resp
*
fuse
.
ReadFileResponse
,
err
error
)
{
resp
=
&
fuse
.
ReadFileResponse
{}
// Let io.ReaderAt deal with the semantics.
reader
:=
strings
.
NewReader
(
"Hello, world!"
)
resp
.
Data
=
make
([]
byte
,
req
.
Size
)
n
,
err
:=
reader
.
ReadAt
(
resp
.
Data
,
req
.
Offset
)
resp
.
Data
=
resp
.
Data
[
:
n
]
// Special case: FUSE doesn't expect us to return io.EOF.
if
err
==
io
.
EOF
{
err
=
nil
}
return
}
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