/usr/share/gocode/src/github.com/jacobsa/bazilfuse/fuseutil/fuseutil.go is in golang-github-jacobsa-bazilfuse-dev 0.0~git20150622-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | package fuseutil // import "github.com/jacobsa/bazilfuse/fuseutil"
import (
"github.com/jacobsa/bazilfuse"
)
// HandleRead handles a read request assuming that data is the entire file content.
// It adjusts the amount returned in resp according to req.Offset and req.Size.
func HandleRead(req *bazilfuse.ReadRequest, resp *bazilfuse.ReadResponse, data []byte) {
if req.Offset >= int64(len(data)) {
data = nil
} else {
data = data[req.Offset:]
}
if len(data) > req.Size {
data = data[:req.Size]
}
n := copy(resp.Data[:req.Size], data)
resp.Data = resp.Data[:n]
}
|