You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dirread9p is very useful for Read calls on directories. an example in go is
below, as i have used in my fileserver. it could just be called srv.Dirread.
type Dirgen func(uint64, interface{}) *p.Dir
func Dirread9p(req *srv.Req, gen Dirgen, i interface{}) {
var start uint64
var count uint32
p.InitRread(req.Rc, req.Tc.Count)
if req.Tc.Offset == 0 {
start = 0
} else {
start = req.Fid.Diroffset
}
b := req.Rc.Data
for len(b) > 0 {
d := gen(start, i)
if d == nil {
break
}
sz := p.PackDir(d, b, req.Conn.Dotu)
if sz == 0 {
break
}
b = b[sz:]
count += uint32(sz)
start++
}
req.Fid.Diroffset = start
p.SetRreadCount(req.Rc, uint32(count))
req.Respond()
}
Original issue reported on code.google.com by [email protected] on 10 Mar 2014 at 12:34
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 10 Mar 2014 at 12:34The text was updated successfully, but these errors were encountered: