static void rread(Fcall* f) { ulong n, rn, nn, delta; Dir d; Fid* fp; if (!isfdir(f, &fp)) return; if (f->count == 0) goto done; cleannames(); for (n = nn = 0; n < f->count; n += rn){ rn = convM2D((uchar*)f->data + n, f->count - n, &d, statbuf); if (rn <= BIT16SZ) break; d.name = importname(d.name); //dprint("⇒ %D\n", &d); nn += convD2M(&d, (uchar*)dirbuf + nn, sizeof(dirbuf) - nn); } delta = nn - n; setaux(fp, getaux(fp) + delta); f->count = nn; f->data = dirbuf; done: closefid(fp); }
// Dir read is tricky. // We have to change the user supplied offset to match the sizes // seen by the server. Sizes seen by client are greater than those // seen by server since the change from ' ' to '␣' adds 2 bytes. static void tread(Fcall* f) { Fid* fp; fp = nil; if (!isfdir(f, &fp)) return; f->count /= 3; // sizes will grow upon return. if (fp == nil) sysfatal("can't find fid\n"); if (f->offset == 0) setaux(fp, 0); f->offset -= getaux(fp); // cumulative size delta closefid(fp); }
static void ficlIsfDir(ficlVm *vm) { isfdir(); }