-physio(strat, bp, dev, rw, mincnt)
-int (*strat)();
-register struct buf *bp;
-unsigned (*mincnt)();
-{
- register int c;
- char *a;
-
- if (useracc(u.u_base,u.u_count,rw==B_READ?B_WRITE:B_READ) == NULL) {
- u.u_error = EFAULT;
- return;
- }
- (void) spl6();
- while (bp->b_flags&B_BUSY) {
- bp->b_flags |= B_WANTED;
- sleep((caddr_t)bp, PRIBIO+1);
- }
- bp->b_error = 0;
- bp->b_proc = u.u_procp;
- bp->b_un.b_addr = u.u_base;
- while (u.u_count != 0 && bp->b_error==0) {
- bp->b_flags = B_BUSY | B_PHYS | rw;
- bp->b_dev = dev;
- bp->b_blkno = u.u_offset >> PGSHIFT;
- bp->b_bcount = u.u_count;
- (*mincnt)(bp);
- c = bp->b_bcount;
- u.u_procp->p_flag |= SPHYSIO;
- vslock(a = bp->b_un.b_addr, c);
- (*strat)(bp);
- (void) spl6();
- while ((bp->b_flags&B_DONE) == 0)
- sleep((caddr_t)bp, PRIBIO);
- vsunlock(a, c, rw);
- u.u_procp->p_flag &= ~SPHYSIO;
- if (bp->b_flags&B_WANTED)
- wakeup((caddr_t)bp);
- (void) spl0();
- bp->b_un.b_addr += c;
- u.u_count -= c;
- u.u_offset += c;
- }
- bp->b_flags &= ~(B_BUSY|B_WANTED|B_PHYS);
- u.u_count = bp->b_resid;
- geterror(bp);
-}
-
-/*ARGSUSED*/
-unsigned
-minphys(bp)
-struct buf *bp;