void fwormream(Device *d) { Iobuf *p; Device *fdev; Off a, b; if(chatty) print("fworm ream\n"); devinit(d); fdev = FDEV(d); a = fwormsize(d); b = devsize(fdev); if(chatty){ print("\tfwsize = %lld\n", (Wideoff)a); print("\tbwsize = %lld\n", (Wideoff)b-a); } for(; a < b; a++) { p = getbuf(fdev, a, Bmod|Bres); if(!p) panic("fworm: init"); memset(p->iobuf, 0, RBUFSIZE); settag(p, Tvirgo, a); putbuf(p); } }
Devsize devsize(Device *d) { for (;;) switch(d->type) { case Devcw: case Devro: return cwsize(d); case Devjuke: d = d->j.m; break; case Devwren: return wrensize(d); case Devworm: case Devlworm: return wormsize(d); case Devfworm: return fwormsize(d); case Devmcat: return mcatsize(d); case Devmlev: return mlevsize(d); case Devmirr: return mirrsize(d); case Devpart: return partsize(d); case Devswab: d = d->swab.d; break; default: panic("illegal device in devsize: %Z", d); return 0; } }