Blob
1 #include <u.h>2 #include <libc.h>3 #include <fcall.h>4 #include <thread.h>5 #include <9p.h>7 void8 dirread9p(Req *r, Dirgen *gen, void *aux)9 {10 int start;11 uchar *p, *ep;12 uint rv;13 Dir d;15 if(r->ifcall.offset == 0)16 start = 0;17 else18 start = r->fid->dirindex;20 p = (uchar*)r->ofcall.data;21 ep = p+r->ifcall.count;23 while(p < ep){24 memset(&d, 0, sizeof d);25 if((*gen)(start, &d, aux) < 0)26 break;27 rv = convD2Mu(&d, p, ep-p, r->srv->dotu);28 free(d.name);29 free(d.muid);30 free(d.uid);31 free(d.gid);32 if(rv <= BIT16SZ)33 break;34 p += rv;35 start++;36 }37 r->fid->dirindex = start;38 r->ofcall.count = p - (uchar*)r->ofcall.data;39 }