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