Commit f7694a22 authored by Aaron Jacobs's avatar Aaron Jacobs

flushFS.ReadFile

parent 8e46de74
......@@ -149,6 +149,27 @@ func (fs *flushFS) OpenFile(
return
}
func (fs *flushFS) ReadFile(
ctx context.Context,
req *fuse.ReadFileRequest) (
resp *fuse.ReadFileResponse, err error) {
resp = &fuse.ReadFileResponse{}
fs.mu.Lock()
defer fs.mu.Unlock()
// Ensure the offset is in range.
if req.Offset > int64(len(fs.fooContents)) {
return
}
// Read what we can.
resp.Data = make([]byte, req.Size)
copy(resp.Data, fs.fooContents[req.Offset:])
return
}
func (fs *flushFS) WriteFile(
ctx context.Context,
req *fuse.WriteFileRequest) (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment