func (tag *Tag) Read(fid *Fid, offset uint64, count uint32) error { req := tag.reqAlloc() req.fid = fid err := p.PackTread(req.Tc, fid.Fid, offset, count) if err != nil { return err } return tag.clnt.Rpcnb(req) }
// Reads count bytes starting from offset from the file associated with the fid. // Returns a slice with the data read, if the operation was successful, or an // Error. func (clnt *Clnt) Read(fid *Fid, offset uint64, count uint32) ([]byte, error) { if count > fid.Iounit { count = fid.Iounit } tc := clnt.NewFcall() err := p.PackTread(tc, fid.Fid, offset, count) if err != nil { return nil, err } rc, err := clnt.Rpc(tc) if err != nil { return nil, err } return rc.Data, nil }