mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 12:05:05 +08:00
mount: removed unnecessary byte slice allocation for reads
Signed-off-by: Anagh Kumar Baranwal <6824881+darthShadow@users.noreply.github.com>
This commit is contained in:
parent
ae6874170f
commit
d0eb884262
|
@ -25,15 +25,13 @@ var _ fusefs.HandleReader = (*FileHandle)(nil)
|
|||
func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error) {
|
||||
var n int
|
||||
defer log.Trace(fh, "len=%d, offset=%d", req.Size, req.Offset)("read=%d, err=%v", &n, &err)
|
||||
data := make([]byte, req.Size)
|
||||
data := resp.Data[:req.Size]
|
||||
n, err = fh.Handle.ReadAt(data, req.Offset)
|
||||
resp.Data = data[:n]
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
} else if err != nil {
|
||||
return translateError(err)
|
||||
}
|
||||
resp.Data = data[:n]
|
||||
return nil
|
||||
return translateError(err)
|
||||
}
|
||||
|
||||
// Check interface satisfied
|
||||
|
|
Loading…
Reference in New Issue
Block a user