From dc59bc1db30221dc062e86bb7873bad0b45ca133 Mon Sep 17 00:00:00 2001 From: thorpej Date: Fri, 21 Jan 2000 23:39:55 +0000 Subject: [PATCH] Update for sys/buf.h/disksort_*() changes. --- sys/arch/sun3/dev/fd.c | 43 +++++++++++++------------- sys/arch/sun3/dev/xd.c | 37 +++++++---------------- sys/arch/sun3/dev/xdvar.h | 4 +-- sys/arch/sun3/dev/xy.c | 17 +++++------ sys/arch/sun3/dev/xyvar.h | 4 +-- sys/arch/vax/mba/hp.c | 15 +++++----- sys/arch/vax/mba/mba.c | 13 ++++---- sys/arch/vax/mba/mbavar.h | 4 +-- sys/arch/vax/vax/ctu.c | 25 ++++++++-------- sys/arch/x68k/dev/fd.c | 48 +++++++++++++++--------------- sys/dev/ata/wd.c | 21 ++++++------- sys/dev/ic/rrunner.c | 23 +++++--------- sys/dev/ic/rrunnervar.h | 5 ++-- sys/dev/isa/mcd.c | 22 +++++++------- sys/dev/md.c | 17 +++++------ sys/dev/mscp/mscp_disk.c | 4 +-- sys/dev/mscp/mscp_subr.c | 19 ++++-------- sys/dev/mscp/mscpvar.h | 4 +-- sys/dev/pci/if_esh_pci.c | 3 +- sys/dev/qbus/uda.c | 20 ++----------- sys/dev/raidframe/rf_netbsdkintf.c | 31 ++++--------------- sys/dev/scsipi/cd.c | 16 +++++----- sys/dev/scsipi/cdvar.h | 4 +-- sys/dev/scsipi/sd.c | 16 +++++----- sys/dev/scsipi/sdvar.h | 4 +-- sys/dev/scsipi/ss.c | 24 ++++----------- sys/dev/scsipi/ssvar.h | 4 +-- sys/dev/scsipi/st.c | 26 +++++----------- sys/dev/vnd.c | 28 ++++++++--------- sys/dev/vndvar.h | 5 ++-- 30 files changed, 210 insertions(+), 296 deletions(-) diff --git a/sys/arch/sun3/dev/fd.c b/sys/arch/sun3/dev/fd.c index 89b2d1a3559f..6b98b8c2c0c4 100644 --- a/sys/arch/sun3/dev/fd.c +++ b/sys/arch/sun3/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.11 1999/02/08 16:33:17 bouyer Exp $ */ +/* $NetBSD: fd.c,v 1.12 2000/01/21 23:39:55 thorpej Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. @@ -86,7 +86,6 @@ /* XXX misuse a flag to identify format operation */ #define B_FORMAT B_XXX -#define b_cylin b_resid #ifdef FD_DEBUG int fdc_debug = 0; @@ -211,7 +210,8 @@ struct fd_softc { TAILQ_ENTRY(fd_softc) sc_drivechain; int sc_ops; /* I/O ops since last switch */ - struct buf sc_q; /* head of buf chain */ + struct buf_queue sc_q; /* pending I/O requests */ + int sc_active; /* number of active I/O operations */ }; bdev_decl(fd); @@ -504,6 +504,7 @@ fdattach(parent, self, aux) else printf(": density unknown\n"); + BUFQ_FIRST(&fd->sc_q); fd->sc_cylin = -1; fd->sc_drive = drive; fd->sc_deftype = type; @@ -610,19 +611,19 @@ fdstrategy(bp) bp->b_bcount = sz << DEV_BSHIFT; } - bp->b_cylin = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl; + bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / fd->sc_type->seccyl; #ifdef FD_DEBUG if (fdc_debug > 1) printf("fdstrategy: b_blkno %d b_bcount %ld blkno %d cylin %ld\n", - bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylin); + bp->b_blkno, bp->b_bcount, fd->sc_blkno, bp->b_cylinder); #endif /* Queue transfer on drive, activate drive and controller if idle. */ s = splbio(); - disksort(&fd->sc_q, bp); + disksort_cylinder(&fd->sc_q, bp); untimeout(fd_motor_off, fd); /* a good idea */ - if (!fd->sc_q.b_active) + if (fd->sc_active == 0) fdstart(fd); #ifdef DIAGNOSTIC else { @@ -651,7 +652,7 @@ fdstart(fd) int active = fdc->sc_drives.tqh_first != 0; /* Link into controller queue. */ - fd->sc_q.b_active = 1; + fd->sc_active = 1; TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain); /* If controller not already active, start it. */ @@ -675,14 +676,14 @@ fdfinish(fd, bp) if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) { fd->sc_ops = 0; TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain); - if (bp->b_actf) { + if (BUFQ_NEXT(bp) != NULL) { TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain); } else - fd->sc_q.b_active = 0; + fd->sc_active = 0; } bp->b_resid = fd->sc_bcount; fd->sc_skip = 0; - fd->sc_q.b_actf = bp->b_actf; + BUFQ_REMOVE(&fd->sc_q); biodone(bp); /* turn off motor 5s from now */ @@ -973,7 +974,7 @@ fdctimeout(arg) s = splbio(); fdcstatus(&fd->sc_dv, 0, "timeout"); - if (fd->sc_q.b_actf) + if (BUFQ_FIRST(&fd->sc_q) != NULL) fdc->sc_state++; else fdc->sc_state = DEVIDLE; @@ -1125,11 +1126,11 @@ loop: } /* Is there a transfer to this drive? If not, deactivate drive. */ - bp = fd->sc_q.b_actf; + bp = BUFQ_FIRST(&fd->sc_q); if (bp == NULL) { fd->sc_ops = 0; TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain); - fd->sc_q.b_active = 0; + fd->sc_active = 0; goto loop; } @@ -1174,12 +1175,12 @@ loop: doseek: if ((fdc->sc_flags & FDC_EIS) && (bp->b_flags & B_FORMAT) == 0) { - fd->sc_cylin = bp->b_cylin; + fd->sc_cylin = bp->b_cylinder; /* We use implied seek */ goto doio; } - if (fd->sc_cylin == bp->b_cylin) + if (fd->sc_cylin == bp->b_cylinder) goto doio; /* specify command */ @@ -1191,7 +1192,7 @@ loop: /* seek function */ OUT_FDC(fdc, NE7CMD_SEEK, SEEKTIMEDOUT); OUT_FDC(fdc, fd->sc_drive, SEEKTIMEDOUT); /* drive number */ - OUT_FDC(fdc, bp->b_cylin * fd->sc_type->step, SEEKTIMEDOUT); + OUT_FDC(fdc, bp->b_cylinder * fd->sc_type->step, SEEKTIMEDOUT); fd->sc_cylin = -1; fdc->sc_state = SEEKWAIT; @@ -1297,7 +1298,7 @@ loop: /* Make sure seek really happened. */ if (fdc->sc_nstat != 2 || (st0 & 0xf8) != 0x20 || - cyl != bp->b_cylin * fd->sc_type->step) { + cyl != bp->b_cylinder * fd->sc_type->step) { #ifdef FD_DEBUG if (fdc_debug) fdcstatus(&fd->sc_dv, 2, "seek failed"); @@ -1305,7 +1306,7 @@ loop: fdcretry(fdc); goto loop; } - fd->sc_cylin = bp->b_cylin; + fd->sc_cylin = bp->b_cylinder; goto doio; case IOTIMEDOUT: @@ -1389,7 +1390,7 @@ loop: fd->sc_skip += fd->sc_nbytes; fd->sc_bcount -= fd->sc_nbytes; if (!finfo && fd->sc_bcount > 0) { - bp->b_cylin = fd->sc_blkno / fd->sc_type->seccyl; + bp->b_cylinder = fd->sc_blkno / fd->sc_type->seccyl; goto doseek; } fdfinish(fd, bp); @@ -1469,7 +1470,7 @@ fdcretry(fdc) struct buf *bp; fd = fdc->sc_drives.tqh_first; - bp = fd->sc_q.b_actf; + bp = BUFQ_FIRST(&fd->sc_q); fdc->sc_overruns = 0; if (fd->sc_opts & FDOPT_NORETRY) diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index 322a673ff6c5..fa2a0e414b58 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.24 1999/09/17 20:07:18 thorpej Exp $ */ +/* $NetBSD: xd.c,v 1.25 2000/01/21 23:39:55 thorpej Exp $ */ /* * @@ -439,9 +439,7 @@ xdcattach(parent, self, aux) /* init queue of waiting bufs */ - xdc->sc_wq.b_active = 0; - xdc->sc_wq.b_actf = 0; - xdc->sc_wq.b_actb = &xdc->sc_wq.b_actf; + BUFQ_INIT(&xdc->sc_wq); /* * section 7 of the manual tells us how to init the controller: @@ -1026,7 +1024,6 @@ xdstrategy(bp) { struct xd_softc *xd; struct xdc_softc *parent; - struct buf *wq; int s, unit; unit = DISKUNIT(bp->b_dev); @@ -1077,7 +1074,7 @@ xdstrategy(bp) /* first, give jobs in front of us a chance */ parent = xd->parent; - while (parent->nfree > 0 && parent->sc_wq.b_actf) + while (parent->nfree > 0 && BUFQ_FIRST(&parent->sc_wq) != NULL) if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK) break; @@ -1086,11 +1083,7 @@ xdstrategy(bp) * buffs will get picked up later by xdcintr(). */ if (parent->nfree == 0) { - wq = &xd->parent->sc_wq; - bp->b_actf = 0; - bp->b_actb = wq->b_actb; - *wq->b_actb = bp; - wq->b_actb = &bp->b_actf; + BUFQ_INSERT_TAIL(&parent->sc_wq, bp); splx(s); return; } @@ -1138,7 +1131,7 @@ xdcintr(v) xdc_start(xdcsc, XDC_MAXIOPB); /* fill up any remaining iorq's with queue'd buffers */ - while (xdcsc->nfree > 0 && xdcsc->sc_wq.b_actf) + while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL) if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK) break; @@ -1369,7 +1362,6 @@ xdc_startbuf(xdcsc, xdsc, bp) int rqno, partno; struct xd_iorq *iorq; struct xd_iopb *iopb; - struct buf *wq; u_long block; caddr_t dbuf; @@ -1382,15 +1374,10 @@ xdc_startbuf(xdcsc, xdsc, bp) /* get buf */ if (bp == NULL) { - bp = xdcsc->sc_wq.b_actf; - if (!bp) + bp = BUFQ_FIRST(&xdcsc->sc_wq); + if (bp == NULL) panic("xdc_startbuf bp"); - wq = bp->b_actf; - if (wq) - wq->b_actb = bp->b_actb; - else - xdcsc->sc_wq.b_actb = bp->b_actb; - *bp->b_actb = wq; + BUFQ_REMOVE(&xdcsc->sc_wq, bp); xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)]; } partno = DISKPART(bp->b_dev); @@ -1431,11 +1418,7 @@ xdc_startbuf(xdcsc, xdsc, bp) printf("%s: warning: out of DVMA space\n", xdcsc->sc_dev.dv_xname); XDC_FREE(xdcsc, rqno); - wq = &xdcsc->sc_wq; /* put at end of queue */ - bp->b_actf = 0; - bp->b_actb = wq->b_actb; - *wq->b_actb = bp; - wq->b_actb = &bp->b_actf; + BUFQ_INSERT_TAIL(&xdcsc->sc_wq, bp); return (XD_ERR_FAIL); /* XXX: need some sort of * call-back scheme here? */ } @@ -1636,7 +1619,7 @@ xdc_piodriver(xdcsc, iorqno, freeone) /* now that we've drained everything, start up any bufs that have * queued */ - while (xdcsc->nfree > 0 && xdcsc->sc_wq.b_actf) + while (xdcsc->nfree > 0 && BUFQ_FIRST(&xdcsc->sc_wq) != NULL) if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK) break; diff --git a/sys/arch/sun3/dev/xdvar.h b/sys/arch/sun3/dev/xdvar.h index ccec71ed9d54..ff2c42584bb8 100644 --- a/sys/arch/sun3/dev/xdvar.h +++ b/sys/arch/sun3/dev/xdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xdvar.h,v 1.5 1998/01/26 21:03:43 gwr Exp $ */ +/* $NetBSD: xdvar.h,v 1.6 2000/01/21 23:39:55 thorpej Exp $ */ /* * @@ -149,7 +149,7 @@ struct xdc_softc { struct xd_iorq *reqs; /* i/o requests */ struct xd_iopb *iopbase; /* iopb base addr (maps iopb->iorq) */ struct xd_iopb *dvmaiopb; /* iopb base in DVMA space, not kvm */ - struct buf sc_wq; /* queue'd IOPBs for this controller */ + struct buf_queue sc_wq; /* queue'd IOPBs for this controller */ char freereq[XDC_MAXIOPB]; /* free list (stack) */ char waitq[XDC_MAXIOPB]; /* wait queue */ u_char nfree; /* number of iopbs free */ diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index 8fc77ee859cb..217ad31e3d0d 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.23 1999/09/17 20:07:18 thorpej Exp $ */ +/* $NetBSD: xy.c,v 1.24 2000/01/21 23:39:55 thorpej Exp $ */ /* * @@ -503,9 +503,7 @@ xyattach(parent, self, aux) xy->parent = xyc; /* init queue of waiting bufs */ - xy->xyq.b_active = 0; - xy->xyq.b_actf = 0; - xy->xyq.b_actb = &xy->xyq.b_actf; /* XXX b_actb: not used? */ + BUFQ_INIT(&xy->xyq); xy->xyrq = &xyc->reqs[xa->driveno]; xy->xy_drive = xa->driveno; @@ -1023,7 +1021,7 @@ xystrategy(bp) s = splbio(); /* protect the queues */ - disksort(&xy->xyq, bp); + disksort_blkno(&xy->xyq, bp); /* XXX disksort_cylinder */ /* start 'em up */ @@ -1634,8 +1632,7 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) /* Sun3: map/unmap regardless of B_PHYS */ dvma_mapout(iorq->dbufbase, iorq->buf->b_bcount); - iorq->xy->xyq.b_actf = - iorq->buf->b_actf; + BUFQ_REMOVE(&iorq->xy->xyq, iorq->buf); disk_unbusy(&iorq->xy->sc_dk, (iorq->buf->b_bcount - iorq->buf->b_resid)); @@ -1681,9 +1678,9 @@ xyc_start(xycsc, iorq) if (iorq == NULL) { for (lcv = 0; lcv < XYC_MAXDEV ; lcv++) { if ((xy = xycsc->sc_drives[lcv]) == NULL) continue; - if (xy->xyq.b_actf == NULL) continue; + if (BUFQ_FIRST(&xy->xyq) == NULL) continue; if (xy->xyrq->mode != XY_SUB_FREE) continue; - xyc_startbuf(xycsc, xy, xy->xyq.b_actf); + xyc_startbuf(xycsc, xy, BUFQ_FIRST(&xy->xyq)); } } xyc_submit_iorq(xycsc, iorq, XY_SUB_NOQ); @@ -1813,7 +1810,7 @@ xyc_remove_iorq(xycsc) /* Sun3: map/unmap regardless of B_PHYS */ dvma_mapout(iorq->dbufbase, iorq->buf->b_bcount); - iorq->xy->xyq.b_actf = bp->b_actf; + BUFQ_REMOVE(&iorq->xy->xyq, bp); disk_unbusy(&iorq->xy->sc_dk, (bp->b_bcount - bp->b_resid)); iorq->mode = XY_SUB_FREE; diff --git a/sys/arch/sun3/dev/xyvar.h b/sys/arch/sun3/dev/xyvar.h index 3ea2ed395b25..4a541d018904 100644 --- a/sys/arch/sun3/dev/xyvar.h +++ b/sys/arch/sun3/dev/xyvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xyvar.h,v 1.4 1998/01/26 21:03:45 gwr Exp $ */ +/* $NetBSD: xyvar.h,v 1.5 2000/01/21 23:39:55 thorpej Exp $ */ /* * @@ -114,7 +114,7 @@ struct xy_softc { u_char nsect; /* number of sectors per track */ u_char hw_spt; /* as above, but includes spare sectors */ struct xy_iorq *xyrq; /* this disk's ioreq structure */ - struct buf xyq; /* queue'd I/O requests */ + struct buf_queue xyq; /* queue'd I/O requests */ struct dkbad dkb; /* bad144 sectors */ }; diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c index 4e2503cbeb34..3f8e56249df7 100644 --- a/sys/arch/vax/mba/hp.c +++ b/sys/arch/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* $NetBSD: hp.c,v 1.19 1999/08/14 11:33:09 ragge Exp $ */ +/* $NetBSD: hp.c,v 1.20 2000/01/21 23:39:56 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -134,6 +134,7 @@ hpattach(parent, self, aux) /* * Init the common struct for both the adapter and its slaves. */ + BUFQ_INIT(&sc->sc_md.md_q); sc->sc_md.md_softc = (void *)sc; /* Pointer to this softc */ sc->sc_md.md_mba = (void *)parent; /* Pointer to parent softc */ sc->sc_md.md_start = hpstart; /* Disk start routine */ @@ -191,8 +192,8 @@ hpstrategy(bp) goto done; s = splbio(); - gp = sc->sc_md.md_q.b_actf; - disksort(&sc->sc_md.md_q, bp); + gp = BUFQ_FIRST(&sc->sc_md.md_q); + disksort_blkno(&sc->sc_md.md_q, bp); /* XXX disksort_cylinder */ if (gp == 0) mbaqueue(&sc->sc_md); @@ -215,7 +216,7 @@ hpstart(md) struct mba_regs *mr = md->md_mba->sc_mbareg; volatile struct hp_regs *hr; struct disklabel *lp = sc->sc_disk.dk_label; - struct buf *bp = md->md_q.b_actf; + struct buf *bp = BUFQ_FIRST(&md->md_q); unsigned bn, cn, sn, tn; int part = DISKPART(bp->b_dev); @@ -368,7 +369,7 @@ hpfinish(md, mbasr, attn) int mbasr, *attn; { struct hp_softc *sc = md->md_softc; - struct buf *bp = md->md_q.b_actf; + struct buf *bp = BUFQ_FIRST(&md->md_q); volatile struct mba_regs *mr = md->md_mba->sc_mbareg; volatile struct hp_regs *hr = (void *)&mr->mba_md[DISKUNIT(bp->b_dev)]; int er1, er2; @@ -407,8 +408,8 @@ hper2: printf("massbuss error :%s %x\n", sc->sc_dev.dv_xname, mbasr); - md->md_q.b_actf->b_resid = 0; - disk_unbusy(&sc->sc_disk, md->md_q.b_actf->b_bcount); + BUFQ_FIRST(&md->md_q)->b_resid = 0; + disk_unbusy(&sc->sc_disk, BUFQ_FIRST(&md->md_q)->b_bcount); return XFER_FINISH; } diff --git a/sys/arch/vax/mba/mba.c b/sys/arch/vax/mba/mba.c index b9bb44bee9f0..d1d062ddfad1 100644 --- a/sys/arch/vax/mba/mba.c +++ b/sys/arch/vax/mba/mba.c @@ -1,4 +1,4 @@ -/* $NetBSD: mba.c,v 1.16 2000/01/17 04:57:31 matt Exp $ */ +/* $NetBSD: mba.c,v 1.17 2000/01/21 23:39:56 thorpej Exp $ */ /* * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -189,7 +189,7 @@ mbaintr(mba) return; /* During autoconfig */ md = sc->sc_first; - bp = md->md_q.b_actf; + bp = BUFQ_FIRST(&md->md_q); /* * A data-transfer interrupt. Current operation is finished, * call that device's finish routine to see what to do next. @@ -206,13 +206,13 @@ mbaintr(mba) * If more to transfer, start the adapter again * by calling mbastart(). */ - md->md_q.b_actf = bp->b_actf; + BUFQ_REMOVE(&md->md_q, bp); sc->sc_first = md->md_back; md->md_back = 0; if (sc->sc_first == 0) sc->sc_last = (void *)&sc->sc_first; - if (md->md_q.b_actf) { + if (BUFQ_FIRST(&md->md_q) != NULL) { sc->sc_last->md_back = md; sc->sc_last = md; } @@ -287,9 +287,10 @@ mbastart(sc) { struct mba_device *md = sc->sc_first; volatile struct mba_regs *mr = sc->sc_mbareg; - struct buf *bp = md->md_q.b_actf; + struct buf *bp = BUFQ_FIRST(&md->md_q); - disk_reallymapin(md->md_q.b_actf, sc->sc_mbareg->mba_map, 0, PG_V); + disk_reallymapin(BUFQ_FIRST(&md->md_q), sc->sc_mbareg->mba_map, + 0, PG_V); sc->sc_state = SC_ACTIVE; mr->mba_var = ((u_int)bp->b_un.b_addr & VAX_PGOFSET); diff --git a/sys/arch/vax/mba/mbavar.h b/sys/arch/vax/mba/mbavar.h index 212e489a77f8..2cde5e278646 100644 --- a/sys/arch/vax/mba/mbavar.h +++ b/sys/arch/vax/mba/mbavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: mbavar.h,v 1.4 1996/04/08 18:39:01 ragge Exp $ */ +/* $NetBSD: mbavar.h,v 1.5 2000/01/21 23:39:56 thorpej Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden * All rights reserved. @@ -97,7 +97,7 @@ struct mba_device { enum xfer_action (*md_finish) __P((struct mba_device *, int, int *)); void *md_softc; /* Backpointer to this units softc. */ struct mba_softc *md_mba; - struct buf md_q; /* Buffer head for transfers */ + struct buf_queue md_q; /* queue of I/O requests */ }; struct mba_softc { diff --git a/sys/arch/vax/vax/ctu.c b/sys/arch/vax/vax/ctu.c index 1d5727a482fb..407bb2d311d6 100644 --- a/sys/arch/vax/vax/ctu.c +++ b/sys/arch/vax/vax/ctu.c @@ -1,4 +1,4 @@ -/* $NetBSD: ctu.c,v 1.5 1996/10/13 03:35:36 christos Exp $ */ +/* $NetBSD: ctu.c,v 1.6 2000/01/21 23:39:57 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -80,7 +80,7 @@ volatile struct tu_softc { int sc_bbytes; /* Number of xfer'd bytes this block */ int sc_op; /* Read/write */ int sc_xmtok; /* set if OK to xmit */ - struct buf sc_q; /* Current buffer */ + struct buf_queue sc_q; /* pending I/O requests */ } tu_sc; struct ivec_dsp tu_recv, tu_xmit; @@ -104,6 +104,8 @@ ctuattach() { extern struct ivec_dsp idsptch; + BUFQ_INIT(&tu_sc.sc_q); + bcopy(&idsptch, &tu_recv, sizeof(struct ivec_dsp)); bcopy(&idsptch, &tu_xmit, sizeof(struct ivec_dsp)); scb->scb_csrint = (void *)&tu_recv; @@ -177,12 +179,11 @@ ctustrategy(bp) #endif if (bp->b_blkno >= 512) { - iodone(bp); + biodone(bp); return; } - bp->b_cylinder = bp->b_blkno; s = splimp(); - disksort((struct buf *)&tu_sc.sc_q, bp); /* Why not use disksort? */ + disksort_blkno(&tu_sc.sc_q, bp); /* Why not use disksort? */ if (tu_sc.sc_state == SC_READY) ctustart(bp); splx(s); @@ -248,7 +249,7 @@ cturintr(arg) int status = mfpr(PR_CSRD); struct buf *bp; - bp = tu_sc.sc_q.b_actf; + bp = BUFQ_FIRST(&tu_sc.sc_q); switch (tu_sc.sc_state) { case SC_UNUSED: @@ -268,12 +269,12 @@ cturintr(arg) #ifdef TUDEBUG printf("Xfer ok\n"); #endif - tu_sc.sc_q.b_actf = bp->b_actf; - iodone(bp); + BUFQ_REMOVE(&tu_sc.sc_q, bp); + biodone(bp); tu_sc.sc_xmtok = 1; tu_sc.sc_state = SC_READY; - if (tu_sc.sc_q.b_actf) - ctustart(tu_sc.sc_q.b_actf); + if (BUFQ_FIRST(&tu_sc.sc_q) != NULL) + ctustart(BUFQ_FIRST(&tu_sc.sc_q)); } break; } @@ -298,7 +299,7 @@ cturintr(arg) break; case SC_RESTART: - ctustart(tu_sc.sc_q.b_actf); + ctustart(BUFQ_FIRST(&tu_sc.sc_q)); break; default: @@ -402,7 +403,7 @@ ctuwatch(arg) if (tu_sc.sc_state == SC_GET_RESP && tu_sc.sc_tpblk != 0 && tu_sc.sc_tpblk == oldtp && (tu_sc.sc_tpblk % 128 != 0)) { printf("tu0: lost recv interrupt\n"); - ctustart(tu_sc.sc_q.b_actf); + ctustart(BUFQ_FIRST(&tu_sc.sc_q)); return; } if (tu_sc.sc_state == SC_RESTART) diff --git a/sys/arch/x68k/dev/fd.c b/sys/arch/x68k/dev/fd.c index ab3df0ea1898..416894517fc5 100644 --- a/sys/arch/x68k/dev/fd.c +++ b/sys/arch/x68k/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.28 1999/03/24 14:07:38 minoura Exp $ */ +/* $NetBSD: fd.c,v 1.29 2000/01/21 23:39:57 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -122,8 +122,6 @@ int fddebug = 0; #define FDUNIT(dev) (minor(dev) / 8) #define FDTYPE(dev) (minor(dev) % 8) -#define b_cylin b_resid - enum fdc_state { DEVIDLE = 0, MOTORWAIT, @@ -241,7 +239,8 @@ struct fd_softc { TAILQ_ENTRY(fd_softc) sc_drivechain; int sc_ops; /* I/O ops since last switch */ - struct buf sc_q; /* head of buf chain */ + struct buf_queue sc_q; /* pending I/O requests */ + int sc_active; /* number of active I/O operations */ u_char *sc_copybuf; /* for secsize >=3 */ u_char sc_part; /* for secsize >=3 */ #define SEC_P10 0x02 /* first part */ @@ -588,6 +587,7 @@ fdattach(parent, self, aux) else printf(": density unknown\n"); + BUFQ_INIT(&fd->sc_q); fd->sc_cylin = -1; fd->sc_drive = drive; fd->sc_deftype = type; @@ -670,17 +670,17 @@ fdstrategy(bp) bp->b_bcount = sz << DEV_BSHIFT; } - bp->b_cylin = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) + bp->b_cylinder = bp->b_blkno / (FDC_BSIZE / DEV_BSIZE) / (fd->sc_type->seccyl * (1 << (fd->sc_type->secsize - 2))); DPRINTF(("fdstrategy: %s b_blkno %d b_bcount %ld cylin %ld\n", bp->b_flags & B_READ ? "read" : "write", - bp->b_blkno, bp->b_bcount, bp->b_cylin)); + bp->b_blkno, bp->b_bcount, bp->b_cylinder)); /* Queue transfer on drive, activate drive and controller if idle. */ s = splbio(); - disksort(&fd->sc_q, bp); + disksort_cylinder(&fd->sc_q, bp); untimeout(fd_motor_off, fd); /* a good idea */ - if (!fd->sc_q.b_active) + if (fd->sc_active == 0) fdstart(fd); #ifdef DIAGNOSTIC else { @@ -709,7 +709,7 @@ fdstart(fd) int active = fdc->sc_drives.tqh_first != 0; /* Link into controller queue. */ - fd->sc_q.b_active = 1; + fd->sc_active = 1; TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain); /* If controller not already active, start it. */ @@ -733,14 +733,14 @@ fdfinish(fd, bp) if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) { fd->sc_ops = 0; TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain); - if (bp->b_actf) { + if (BUFQ_NEXT(bp) != NULL) { TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain); } else - fd->sc_q.b_active = 0; + fd->sc_active = 0; } bp->b_resid = fd->sc_bcount; fd->sc_skip = 0; - fd->sc_q.b_actf = bp->b_actf; + BUFQ_REMOVE(&fd->sc_q, bp); #if NRND > 0 rnd_add_uint32(&fd->rnd_source, bp->b_blkno); @@ -1023,7 +1023,7 @@ fdctimeout(arg) s = splbio(); fdcstatus(&fd->sc_dev, 0, "timeout"); - if (fd->sc_q.b_actf) + if (BUFQ_FIRST(&fd->sc_q) != NULL) fdc->sc_state++; else fdc->sc_state = DEVIDLE; @@ -1081,11 +1081,11 @@ loop: } /* Is there a transfer to this drive? If not, deactivate drive. */ - bp = fd->sc_q.b_actf; + bp = BUFQ_FIRST(&fd->sc_q); if (bp == NULL) { fd->sc_ops = 0; TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain); - fd->sc_q.b_active = 0; + fd->sc_active = 0; goto loop; } @@ -1126,7 +1126,7 @@ loop: case DOSEEK: doseek: DPRINTF(("fdcintr: in DOSEEK\n")); - if (fd->sc_cylin == bp->b_cylin) + if (fd->sc_cylin == bp->b_cylinder) goto doio; out_fdc(iot, ioh, NE7CMD_SPECIFY);/* specify command */ @@ -1135,7 +1135,7 @@ loop: out_fdc(iot, ioh, NE7CMD_SEEK); /* seek function */ out_fdc(iot, ioh, fd->sc_drive); /* drive number */ - out_fdc(iot, ioh, bp->b_cylin * fd->sc_type->step); + out_fdc(iot, ioh, bp->b_cylinder * fd->sc_type->step); fd->sc_cylin = -1; fdc->sc_state = SEEKWAIT; @@ -1221,7 +1221,7 @@ loop: else out_fdc(iot, ioh, NE7CMD_WRITE); /* WRITE */ out_fdc(iot, ioh, (head << 2) | fd->sc_drive); - out_fdc(iot, ioh, bp->b_cylin); /* cylinder */ + out_fdc(iot, ioh, bp->b_cylinder); /* cylinder */ out_fdc(iot, ioh, head); out_fdc(iot, ioh, sec + 1); /* sector +1 */ out_fdc(iot, ioh, type->secsize); /* sector size */ @@ -1242,7 +1242,7 @@ loop: fdc_dmastart(fdc, B_READ, fd->sc_copybuf, 1024); out_fdc(iot, ioh, NE7CMD_READ); /* READ */ out_fdc(iot, ioh, (head << 2) | fd->sc_drive); - out_fdc(iot, ioh, bp->b_cylin); /* cylinder */ + out_fdc(iot, ioh, bp->b_cylinder); /* cylinder */ out_fdc(iot, ioh, head); out_fdc(iot, ioh, sec + 1); /* sector +1 */ out_fdc(iot, ioh, type->secsize); /* sector size */ @@ -1293,7 +1293,7 @@ loop: } out_fdc(iot, ioh, NE7CMD_WRITE); /* WRITE */ out_fdc(iot, ioh, (head << 2) | fd->sc_drive); - out_fdc(iot, ioh, bp->b_cylin); /* cylinder */ + out_fdc(iot, ioh, bp->b_cylinder); /* cylinder */ out_fdc(iot, ioh, head); out_fdc(iot, ioh, sec + 1); /* sector +1 */ out_fdc(iot, ioh, fd->sc_type->secsize); /* sector size */ @@ -1326,14 +1326,14 @@ loop: goto loop; } else if (tmp != 2 || (st0 & 0xf8) != 0x20 || - cyl != bp->b_cylin) { + cyl != bp->b_cylinder) { #ifdef FDDEBUG fdcstatus(&fd->sc_dev, 2, "seek failed"); #endif fdcretry(fdc); goto loop; } - fd->sc_cylin = bp->b_cylin; + fd->sc_cylin = bp->b_cylinder; goto doio; case IOTIMEDOUT: @@ -1377,7 +1377,7 @@ loop: fd->sc_bcount -= fd->sc_nbytes; DPRINTF(("fd->sc_bcount = %d\n", fd->sc_bcount)); if (fd->sc_bcount > 0) { - bp->b_cylin = fd->sc_blkno + bp->b_cylinder = fd->sc_blkno / (fd->sc_type->seccyl * (1 << (fd->sc_type->secsize - 2))); goto doseek; @@ -1484,7 +1484,7 @@ fdcretry(fdc) DPRINTF(("fdcretry:\n")); fd = fdc->sc_drives.tqh_first; - bp = fd->sc_q.b_actf; + bp = BUFQ_FIRST(&fd->sc_q); switch (fdc->sc_errors) { case 0: diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index f8860bafc37c..d2054812e3ce 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.199 1999/12/23 21:23:19 leo Exp $ */ +/* $NetBSD: wd.c,v 1.200 2000/01/21 23:39:57 thorpej Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. All rights reserved. @@ -133,7 +133,7 @@ struct wd_softc { /* General disk infos */ struct device sc_dev; struct disk sc_dk; - struct buf sc_q; + struct buf_queue sc_q; /* IDE disk soft states */ struct ata_bio sc_wdc_bio; /* current transfer */ struct buf *sc_bp; /* buf being transfered */ @@ -261,6 +261,8 @@ wdattach(parent, self, aux) char buf[41], c, *p, *q; WDCDEBUG_PRINT(("wdattach\n"), DEBUG_FUNCS | DEBUG_PROBE); + BUFQ_INIT(&wd->sc_q); + wd->openings = aa_link->aa_openings; wd->drvp = aa_link->aa_drv_data;; wd->wdc_softc = parent; @@ -400,8 +402,8 @@ wddetach(self, flags) s = splbio(); /* Kill off any queued buffers. */ - while ((bp = sc->sc_q.b_actf) != NULL) { - sc->sc_q.b_actf = bp->b_actf; + while ((bp = BUFQ_FIRST(&sc->sc_q)) != NULL) { + BUFQ_REMOVE(&sc->sc_q, bp); bp->b_error = EIO; bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; @@ -471,7 +473,7 @@ wdstrategy(bp) goto done; /* Queue transfer on drive, activate drive and controller if idle. */ s = splbio(); - disksort(&wd->sc_q, bp); + disksort_blkno(&wd->sc_q, bp); wdstart(wd); splx(s); return; @@ -491,17 +493,16 @@ wdstart(arg) void *arg; { struct wd_softc *wd = arg; - struct buf *dp, *bp=0; + struct buf *bp = NULL; WDCDEBUG_PRINT(("wdstart %s\n", wd->sc_dev.dv_xname), DEBUG_XFERS); while (wd->openings > 0) { /* Is there a buf for us ? */ - dp = &wd->sc_q; - if ((bp = dp->b_actf) == NULL) /* yes, an assign */ - return; - dp->b_actf = bp->b_actf; + if ((bp = BUFQ_FIRST(&wd->sc_q)) == NULL) + return; + BUFQ_REMOVE(&wd->sc_q, bp); /* * Make the command. First lock the device diff --git a/sys/dev/ic/rrunner.c b/sys/dev/ic/rrunner.c index 8b8f7238c0b0..176e0efc9d9b 100644 --- a/sys/dev/ic/rrunner.c +++ b/sys/dev/ic/rrunner.c @@ -1,4 +1,4 @@ -/* $NetBSD: rrunner.c,v 1.13 1999/06/20 16:44:49 thorpej Exp $ */ +/* $NetBSD: rrunner.c,v 1.14 2000/01/21 23:39:58 thorpej Exp $ */ /* * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -300,6 +300,7 @@ eshconfig(sc) sc->sc_send.ec_offset = 0; sc->sc_send.ec_descr = sc->sc_send_ring; TAILQ_INIT(&sc->sc_send.ec_di_queue); + BUFQ_INIT(&sc->sc_send.ec_buf_queue); for (i = 0; i < RR_MAX_SNAP_RECV_RING_SIZE; i++) if (bus_dmamap_create(sc->sc_dmat, RR_DMA_MAX, 1, RR_DMA_MAX, @@ -1428,16 +1429,7 @@ esh_fpstrategy(bp) */ struct esh_send_ring_ctl *ring = &sc->sc_send; - - if (ring->ec_queue != NULL) { - assert(ring->ec_lastqueue); - - ring->ec_lastqueue->b_actf = bp; - } else { - ring->ec_queue = bp; - } - ring->ec_lastqueue = bp; - bp->b_actf = NULL; + BUFQ_INSERT_TAIL(&ring->ec_buf_queue, bp); #ifdef ESH_PRINTF printf("esh_fpstrategy: ready to call eshstart to write!\n"); #endif @@ -2080,7 +2072,8 @@ eshstart(ifp) if ((sc->sc_flags & ESH_FL_FP_RING_UP) != 0 && send->ec_cur_mbuf == NULL && send->ec_cur_buf == NULL && - send->ec_cur_dmainfo == NULL && send->ec_queue != NULL) { + send->ec_cur_dmainfo == NULL && + BUFQ_FIRST(&send->ec_buf_queue) != NULL) { struct buf *bp; #ifdef ESH_PRINTF @@ -2088,10 +2081,8 @@ eshstart(ifp) send->ec_queue); #endif - bp = send->ec_cur_buf = send->ec_queue; - send->ec_queue = send->ec_queue->b_actf; - if (send->ec_queue == NULL) - send->ec_lastqueue = NULL; + bp = send->ec_cur_buf = BUFQ_FIRST(&send->ec_buf_queue); + BUFQ_REMOVE(&send->ec_buf_queue, bp); send->ec_offset = 0; send->ec_len = bp->b_bcount; diff --git a/sys/dev/ic/rrunnervar.h b/sys/dev/ic/rrunnervar.h index 7bbf0e4226d8..27232ab04d13 100644 --- a/sys/dev/ic/rrunnervar.h +++ b/sys/dev/ic/rrunnervar.h @@ -1,4 +1,4 @@ -/* $NetBSD: rrunnervar.h,v 1.5 1998/11/20 04:12:58 kml Exp $ */ +/* $NetBSD: rrunnervar.h,v 1.6 2000/01/21 23:39:58 thorpej Exp $ */ /* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -114,8 +114,7 @@ struct esh_send_ring_ctl { struct buf *ec_cur_buf; /* current buf being processed */ struct esh_dmainfo *ec_cur_dmainfo; /* current dmainfo being processed */ - struct buf *ec_queue; /* queue of bufs to send */ - struct buf *ec_lastqueue; /* last entry in the queue */ + struct buf_queue ec_buf_queue; /* queue of bufs to send */ int ec_error; /* encountered error? */ u_int16_t ec_producer; /* latest buffer driver produced */ u_int16_t ec_consumer; /* latest buffer runcode consumed */ diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index e946cbfbb0ad..448156ab8b97 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcd.c,v 1.63 1999/02/08 16:33:17 bouyer Exp $ */ +/* $NetBSD: mcd.c,v 1.64 2000/01/21 23:39:58 thorpej Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -144,7 +144,8 @@ struct mcd_softc { #define MCD_MD_UNKNOWN -1 int lastupc; #define MCD_UPC_UNKNOWN -1 - struct buf buf_queue; + struct buf_queue buf_queue; + int active; u_char readcmd; u_char debug; u_char probe; @@ -245,6 +246,8 @@ mcdattach(parent, self, aux) return; } + BUFQ_INIT(&sc->buf_queue); + /* * Initialize and attach the disk structure. */ @@ -489,9 +492,9 @@ mcdstrategy(bp) /* Queue it. */ s = splbio(); - disksort(&sc->buf_queue, bp); + disksort_blkno(&sc->buf_queue, bp); splx(s); - if (!sc->buf_queue.b_active) + if (!sc->active) mcdstart(sc); return; @@ -506,23 +509,22 @@ void mcdstart(sc) struct mcd_softc *sc; { - struct buf *bp, *dp = &sc->buf_queue; + struct buf *bp; int s; loop: s = splbio(); - bp = dp->b_actf; - if (bp == NULL) { + if ((bp = BUFQ_FIRST(&sc->buf_queue)) == NULL) { /* Nothing to do. */ - dp->b_active = 0; + sc->active = 0; splx(s); return; } /* Block found to process; dequeue. */ MCD_TRACE("start: found block bp=0x%x\n", bp, 0, 0, 0); - dp->b_actf = bp->b_actf; + BUFQ_REMOVE(&sc->buf_queue, bp); splx(s); /* Changed media? */ @@ -534,7 +536,7 @@ loop: goto loop; } - dp->b_active = 1; + sc->active = 1; /* Instrumentation. */ s = splbio(); diff --git a/sys/dev/md.c b/sys/dev/md.c index f5f0a05a2e33..b928d8049f3b 100644 --- a/sys/dev/md.c +++ b/sys/dev/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.21 2000/01/21 12:14:53 tsutsui Exp $ */ +/* $NetBSD: md.c,v 1.22 2000/01/21 23:39:57 thorpej Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman. @@ -84,7 +84,7 @@ struct md_softc { struct device sc_dev; /* REQUIRED first entry */ struct disk sc_dkdev; /* hook for generic disk handling */ struct md_conf sc_md; - struct buf *sc_buflist; + struct buf_queue sc_buflist; }; /* shorthand for fields in sc_md: */ #define sc_addr sc_md.md_addr @@ -147,6 +147,8 @@ md_attach(parent, self, aux) { struct md_softc *sc = (struct md_softc *)self; + BUFQ_INIT(&sc->sc_buflist); + /* XXX - Could accept aux info here to set the config. */ #ifdef MEMORY_DISK_HOOKS /* @@ -339,9 +341,8 @@ mdstrategy(bp) #if MEMORY_DISK_SERVER case MD_UMEM_SERVER: /* Just add this job to the server's queue. */ - bp->b_actf = sc->sc_buflist; - sc->sc_buflist = bp; - if (bp->b_actf == NULL) { + BUFQ_INSERT_TAIL(&sc->sc_buflist, bp); + if (BUFQ_FIRST(&sc->sc_buflist) == bp) { /* server queue was empty. */ wakeup((caddr_t)sc); /* see md_server_loop() */ @@ -504,16 +505,14 @@ md_server_loop(sc) for (;;) { /* Wait for some work to arrive. */ - while (sc->sc_buflist == NULL) { + while ((bp = BUFQ_FIRST(&sc->sc_buflist)) == NULL) { error = tsleep((caddr_t)sc, md_sleep_pri, "md_idle", 0); if (error) return error; } /* Unlink buf from head of list. */ - bp = sc->sc_buflist; - sc->sc_buflist = bp->b_actf; - bp->b_actf = NULL; + BUFQ_REMOVE(&sc->sc_buflist, bp); /* Do the transfer to/from user space. */ error = 0; diff --git a/sys/dev/mscp/mscp_disk.c b/sys/dev/mscp/mscp_disk.c index 875633a34892..d063c57fa6cf 100644 --- a/sys/dev/mscp/mscp_disk.c +++ b/sys/dev/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $NetBSD: mscp_disk.c,v 1.21 1999/06/06 19:16:18 ragge Exp $ */ +/* $NetBSD: mscp_disk.c,v 1.22 2000/01/21 23:39:59 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -288,7 +288,7 @@ raclose(dev, flags, fmt, p) #if notyet if (ra->ra_openpart == 0) { s = splimp(); - while (udautab[unit].b_actf) + while (BUFQ_FIRST(&udautab[unit]) != NULL) sleep((caddr_t)&udautab[unit], PZERO - 1); splx(s); ra->ra_state = CLOSED; diff --git a/sys/dev/mscp/mscp_subr.c b/sys/dev/mscp/mscp_subr.c index b17348970853..7cd8e1d46156 100644 --- a/sys/dev/mscp/mscp_subr.c +++ b/sys/dev/mscp/mscp_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mscp_subr.c,v 1.12 1999/06/06 19:16:18 ragge Exp $ */ +/* $NetBSD: mscp_subr.c,v 1.13 2000/01/21 23:39:59 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -160,7 +160,7 @@ mscp_attach(parent, self, aux) mi->mi_rsp.mri_size = NRSP; mi->mi_rsp.mri_desc = mi->mi_uda->mp_ca.ca_rspdsc; mi->mi_rsp.mri_ring = mi->mi_uda->mp_rsp; - SIMPLEQ_INIT(&mi->mi_resq); + BUFQ_INIT(&mi->mi_resq); if (mscp_init(mi)) { printf("%s: can't init, controller hung\n", @@ -451,7 +451,7 @@ mscp_intr(mi) /* * If there are any not-yet-handled request, try them now. */ - if (SIMPLEQ_FIRST(&mi->mi_resq)) + if (BUFQ_FIRST(&mi->mi_resq)) mscp_kickaway(mi); } @@ -485,10 +485,7 @@ mscp_strategy(bp, usc) struct mscp_softc *mi = (void *)usc; int s = splimp(); -/* SIMPLEQ_INSERT_TAIL(&mi->mi_resq, bp, xxx) */ - bp->b_actf = NULL; - *mi->mi_resq.sqh_last = bp; - mi->mi_resq.sqh_last = &bp->b_actf; + BUFQ_INSERT_TAIL(&mi->mi_resq, bp); mscp_kickaway(mi); splx(s); } @@ -502,7 +499,7 @@ mscp_kickaway(mi) struct mscp *mp; int next; - while ((bp = SIMPLEQ_FIRST(&mi->mi_resq))) { + while ((bp = BUFQ_FIRST(&mi->mi_resq)) != NULL) { /* * Ok; we are ready to try to start a xfer. Get a MSCP packet * and try to start... @@ -535,11 +532,7 @@ mscp_kickaway(mi) bp->b_resid = next; (*mi->mi_me->me_fillin)(bp, mp); (*mi->mi_mc->mc_go)(mi->mi_dev.dv_parent, &mi->mi_xi[next]); - if ((mi->mi_resq.sqh_first = bp->b_actf) == NULL) - mi->mi_resq.sqh_last = &mi->mi_resq.sqh_first; -#if 0 - mi->mi_w = bp->b_actf; -#endif + BUFQ_REMOVE(&mi->mi_resq, bp); } } diff --git a/sys/dev/mscp/mscpvar.h b/sys/dev/mscp/mscpvar.h index 1ec0de046c08..e3c1e08ee762 100644 --- a/sys/dev/mscp/mscpvar.h +++ b/sys/dev/mscp/mscpvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: mscpvar.h,v 1.7 1999/06/06 19:16:18 ragge Exp $ */ +/* $NetBSD: mscpvar.h,v 1.8 2000/01/21 23:39:59 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -191,7 +191,7 @@ struct mscp_softc { bus_space_handle_t mi_iph; /* initialisation and polling */ bus_space_handle_t mi_sah; /* status & address (read part) */ bus_space_handle_t mi_swh; /* status & address (write part) */ - SIMPLEQ_HEAD(, buf) mi_resq; /* While waiting for packets */ + struct buf_queue mi_resq; /* While waiting for packets */ }; /* mi_flags */ diff --git a/sys/dev/pci/if_esh_pci.c b/sys/dev/pci/if_esh_pci.c index 94f3284f889c..befd4f4b867b 100644 --- a/sys/dev/pci/if_esh_pci.c +++ b/sys/dev/pci/if_esh_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_esh_pci.c,v 1.5 1998/07/05 06:49:15 jonathan Exp $ */ +/* $NetBSD: if_esh_pci.c,v 1.6 2000/01/21 23:39:59 thorpej Exp $ */ /* * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -54,6 +54,7 @@ #include #include #include +#include #include #include diff --git a/sys/dev/qbus/uda.c b/sys/dev/qbus/uda.c index a20613870d32..fc9124c8c115 100644 --- a/sys/dev/qbus/uda.c +++ b/sys/dev/qbus/uda.c @@ -1,4 +1,4 @@ -/* $NetBSD: uda.c,v 1.30 1999/06/06 19:14:49 ragge Exp $ */ +/* $NetBSD: uda.c,v 1.31 2000/01/21 23:39:59 thorpej Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -60,27 +60,13 @@ #include "ioconf.h" -/* - * Variants of SIMPLEQ macros for use with buf structs. - */ -#define BUFQ_INSERT_TAIL(head, elm) { \ - (elm)->b_actf = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->b_actf; \ -} - -#define BUFQ_REMOVE_HEAD(head, elm) { \ - if (((head)->sqh_first = (elm)->b_actf) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} - /* * Software status, per controller. */ struct uda_softc { struct device sc_dev; /* Autoconfig info */ struct uba_unit sc_unit; /* Struct common for UBA to communicate */ - SIMPLEQ_HEAD(, buf) sc_bufq; /* bufs awaiting for resources */ + struct buf_queue sc_bufq; /* bufs awaiting for resources */ struct mscp_pack *sc_uuda; /* Unibus address of uda struct */ struct mscp_pack sc_uda; /* Struct for uda communication */ bus_dma_tag_t sc_dmat; @@ -224,7 +210,7 @@ udaattach(parent, self, aux) sc->sc_sah = ua->ua_ioh + 2; sc->sc_dmat = ua->ua_dmat; ctlr = sc->sc_dev.dv_unit; - SIMPLEQ_INIT(&sc->sc_bufq); + BUFQ_INIT(&sc->sc_bufq); /* * Fill in the uba_unit struct, so we can communicate with the uba. diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 01b856e3634c..66fd8f5ea2d2 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.46 2000/01/09 03:39:13 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.47 2000/01/21 23:39:59 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -214,7 +214,7 @@ struct raid_softc { char sc_xname[20]; /* XXX external name */ struct disk sc_dkdev; /* generic disk device info */ struct pool sc_cbufpool; /* component buffer pool */ - struct buf buf_queue; /* used for the device queue */ + struct buf_queue buf_queue; /* used for the device queue */ }; /* sc_flags */ #define RAIDF_INITED 0x01 /* unit has been initialized */ @@ -325,9 +325,7 @@ raidattach(num) bzero(raid_softc, num * sizeof(struct raid_softc)); for (raidID = 0; raidID < num; raidID++) { - raid_softc[raidID].buf_queue.b_actf = NULL; - raid_softc[raidID].buf_queue.b_actb = - &raid_softc[raidID].buf_queue.b_actf; + BUFQ_INIT(&raid_softc[raidID].buf_queue); RF_Calloc(raidPtrs[raidID], 1, sizeof(RF_Raid_t), (RF_Raid_t *)); if (raidPtrs[raidID] == NULL) { @@ -522,7 +520,6 @@ raidstrategy(bp) RF_Raid_t *raidPtr; struct raid_softc *rs = &raid_softc[raidID]; struct disklabel *lp; - struct buf *dp; int wlabel; if ((rs->sc_flags & RAIDF_INITED) ==0) { @@ -572,13 +569,8 @@ raidstrategy(bp) bp->b_resid = 0; /* stuff it onto our queue */ + BUFQ_INSERT_TAIL(&rs->buf_queue, bp); - dp = &rs->buf_queue; - bp->b_actf = NULL; - bp->b_actb = dp->b_actb; - *dp->b_actb = bp; - dp->b_actb = &bp->b_actf; - raidstart(raidPtrs[raidID]); splx(s); @@ -1361,7 +1353,6 @@ raidstart(raidPtr) struct raid_softc *rs; int do_async; struct buf *bp; - struct buf *dp; unit = raidPtr->raidid; rs = &raid_softc[unit]; @@ -1372,21 +1363,11 @@ raidstart(raidPtr) RF_UNLOCK_MUTEX(raidPtr->mutex); /* get the next item, if any, from the queue */ - dp = &rs->buf_queue; - bp = dp->b_actf; - if (bp == NULL) { + if ((bp = BUFQ_FIRST(&rs->buf_queue)) == NULL) { /* nothing more to do */ return; } - - /* update structures */ - dp = bp->b_actf; - if (dp != NULL) { - dp->b_actb = bp->b_actb; - } else { - rs->buf_queue.b_actb = bp->b_actb; - } - *bp->b_actb = dp; + BUFQ_REMOVE(&rs->buf_queue, bp); /* Ok, for the bp we have here, bp->b_blkno is relative to the * partition.. Need to make it absolute to the underlying diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index 395971d7a379..3cc30e247942 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.134 1999/11/03 20:50:18 matt Exp $ */ +/* $NetBSD: cd.c,v 1.135 2000/01/21 23:40:00 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -159,6 +159,8 @@ cdattach(parent, cd, sc_link, ops) { SC_DEBUG(sc_link, SDEV_DB2, ("cdattach: ")); + BUFQ_INIT(&cd->buf_queue); + /* * Store information needed to contact our base driver */ @@ -229,8 +231,8 @@ cddetach(self, flags) s = splbio(); /* Kill off any queued buffers. */ - while ((bp = cd->buf_queue.b_actf) != NULL) { - cd->buf_queue.b_actf = bp->b_actf; + while ((bp = BUFQ_FIRST(&cd->buf_queue)) != NULL) { + BUFQ_REMOVE(&cd->buf_queue, bp); bp->b_error = EIO; bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; @@ -544,7 +546,7 @@ cdstrategy(bp) /* * Place it in the queue of disk activities for this disk */ - disksort(&cd->buf_queue, bp); + disksort_blkno(&cd->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -589,7 +591,6 @@ cdstart(v) register struct scsipi_link *sc_link = cd->sc_link; struct disklabel *lp = cd->sc_dk.dk_label; struct buf *bp = 0; - struct buf *dp; struct scsipi_rw_big cmd_big; #if NCD_SCSIBUS > 0 struct scsi_rw cmd_small; @@ -617,10 +618,9 @@ cdstart(v) /* * See if there is a buf with work for us to do.. */ - dp = &cd->buf_queue; - if ((bp = dp->b_actf) == NULL) /* yes, an assign */ + if ((bp = BUFQ_FIRST(&cd->buf_queue)) == NULL) return; - dp->b_actf = bp->b_actf; + BUFQ_REMOVE(&cd->buf_queue, bp); /* * If the device has become invalid, abort all the diff --git a/sys/dev/scsipi/cdvar.h b/sys/dev/scsipi/cdvar.h index d0c134304320..f8ce0cfdc7d2 100644 --- a/sys/dev/scsipi/cdvar.h +++ b/sys/dev/scsipi/cdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cdvar.h,v 1.11 1999/09/23 11:04:34 enami Exp $ */ +/* $NetBSD: cdvar.h,v 1.12 2000/01/21 23:40:00 thorpej Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -48,7 +48,7 @@ struct cd_softc { int blksize; u_long disksize; /* total number sectors */ } params; - struct buf buf_queue; + struct buf_queue buf_queue; char name[16]; /* product name, for default disklabel */ const struct cd_ops *sc_ops; /* our bus-dependent ops vector */ diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index 13712faf18a6..ad4d78af701d 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.154 1999/12/23 21:23:30 leo Exp $ */ +/* $NetBSD: sd.c,v 1.155 2000/01/21 23:40:00 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -137,6 +137,8 @@ sdattach(parent, sd, sc_link, ops) SC_DEBUG(sc_link, SDEV_DB2, ("sdattach: ")); + BUFQ_INIT(&sd->buf_queue); + /* * Store information needed to contact our base driver */ @@ -264,8 +266,8 @@ sddetach(self, flags) s = splbio(); /* Kill off any queued buffers. */ - while ((bp = sd->buf_queue.b_actf) != NULL) { - sd->buf_queue.b_actf = bp->b_actf; + while ((bp = BUFQ_FIRST(&sd->buf_queue)) != NULL) { + BUFQ_REMOVE(&sd->buf_queue, bp); bp->b_error = EIO; bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount; @@ -597,7 +599,7 @@ sdstrategy(bp) /* * Place it in the queue of disk activities for this disk */ - disksort(&sd->buf_queue, bp); + disksort_blkno(&sd->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -642,7 +644,6 @@ sdstart(v) register struct scsipi_link *sc_link = sd->sc_link; struct disklabel *lp = sd->sc_dk.dk_label; struct buf *bp = 0; - struct buf *dp; struct scsipi_rw_big cmd_big; #if NSD_SCSIBUS > 0 struct scsi_rw cmd_small; @@ -670,10 +671,9 @@ sdstart(v) /* * See if there is a buf with work for us to do.. */ - dp = &sd->buf_queue; - if ((bp = dp->b_actf) == NULL) /* yes, an assign */ + if ((bp = BUFQ_FIRST(&sd->buf_queue)) == NULL) return; - dp->b_actf = bp->b_actf; + BUFQ_REMOVE(&sd->buf_queue, bp); /* * If the device has become invalid, abort all the diff --git a/sys/dev/scsipi/sdvar.h b/sys/dev/scsipi/sdvar.h index 731bc0d0f57a..efe56acd35d4 100644 --- a/sys/dev/scsipi/sdvar.h +++ b/sys/dev/scsipi/sdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sdvar.h,v 1.9 1999/09/11 21:42:58 thorpej Exp $ */ +/* $NetBSD: sdvar.h,v 1.10 2000/01/21 23:40:00 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ struct sd_softc { u_long disksize; /* total number sectors */ u_long rot_rate; /* rotational rate, in RPM */ } params; - struct buf buf_queue; + struct buf_queue buf_queue; u_int8_t type; char name[16]; /* product name, for default disklabel */ const struct sd_ops *sc_ops; /* our bus-dependent ops vector */ diff --git a/sys/dev/scsipi/ss.c b/sys/dev/scsipi/ss.c index 59328d9c8f40..8f497b6579e1 100644 --- a/sys/dev/scsipi/ss.c +++ b/sys/dev/scsipi/ss.c @@ -1,4 +1,4 @@ -/* $NetBSD: ss.c,v 1.28 2000/01/19 01:00:07 abs Exp $ */ +/* $NetBSD: ss.c,v 1.29 2000/01/21 23:40:00 thorpej Exp $ */ /* * Copyright (c) 1995 Kenneth Stailey. All rights reserved. @@ -159,9 +159,7 @@ ssattach(parent, self, aux) /* * Set up the buf queue for this device */ - ss->buf_queue.b_active = 0; - ss->buf_queue.b_actf = 0; - ss->buf_queue.b_actb = &ss->buf_queue.b_actf; + BUFQ_INIT(&ss->buf_queue); ss->flags &= ~SSF_AUTOCONF; } @@ -332,7 +330,6 @@ ssstrategy(bp) struct buf *bp; { struct ss_softc *ss = ss_cd.cd_devs[SSUNIT(bp->b_dev)]; - struct buf *dp; int s; SC_DEBUG(ss->sc_link, SDEV_DB1, @@ -361,11 +358,7 @@ ssstrategy(bp) * at the end (a bit silly because we only have on user.. * (but it could fork())) */ - dp = &ss->buf_queue; - bp->b_actf = NULL; - bp->b_actb = dp->b_actb; - *dp->b_actb = bp; - dp->b_actb = &bp->b_actf; + BUFQ_INSERT_TAIL(&ss->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -405,7 +398,7 @@ ssstart(v) { struct ss_softc *ss = v; struct scsipi_link *sc_link = ss->sc_link; - register struct buf *bp, *dp; + register struct buf *bp; SC_DEBUG(sc_link, SDEV_DB2, ("ssstart ")); /* @@ -423,14 +416,9 @@ ssstart(v) /* * See if there is a buf with work for us to do.. */ - dp = &ss->buf_queue; - if ((bp = dp->b_actf) == NULL) + if ((bp = BUFQ_FIRST(&ss->buf_queue)) == NULL) return; - if ((dp = bp->b_actf) != NULL) - dp->b_actb = bp->b_actb; - else - ss->buf_queue.b_actb = bp->b_actb; - *bp->b_actb = dp; + BUFQ_REMOVE(&ss->buf_queue, bp); if (ss->special && ss->special->read) { (ss->special->read)(ss, bp); diff --git a/sys/dev/scsipi/ssvar.h b/sys/dev/scsipi/ssvar.h index f4f4783dd581..6e0ad0d0a8ce 100644 --- a/sys/dev/scsipi/ssvar.h +++ b/sys/dev/scsipi/ssvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ssvar.h,v 1.6 1998/04/22 19:44:19 pk Exp $ */ +/* $NetBSD: ssvar.h,v 1.7 2000/01/21 23:40:00 thorpej Exp $ */ /* * Copyright (c) 1995 Kenneth Stailey. All rights reserved. @@ -67,7 +67,7 @@ struct ss_softc { #define SSF_AUTOCONF 0x04 /* set during auto-configuration */ struct scsipi_link *sc_link; /* contains our targ, lun, etc. */ struct scan_io sio; - struct buf buf_queue; /* the queue of pending IO operations */ + struct buf_queue buf_queue; /* the queue of pending IO operations */ u_int quirks; /* scanner is only mildly twisted */ #define SS_Q_GET_BUFFER_SIZE 0x0001 /* poll for available data in ssread() */ /* truncate to byte boundry is assumed by default unless one of these is set */ diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c index 2c730f704c04..6850044ca5b5 100644 --- a/sys/dev/scsipi/st.c +++ b/sys/dev/scsipi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.116 2000/01/13 00:18:27 nisimura Exp $ */ +/* $NetBSD: st.c,v 1.117 2000/01/21 23:40:00 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -335,7 +335,7 @@ struct st_softc { * additional sense data needed * for mode sense/select. */ - struct buf buf_queue; /* the queue of pending IO */ + struct buf_queue buf_queue; /* the queue of pending IO */ /* operations */ #if NRND > 0 rndsource_element_t rnd_source; @@ -493,9 +493,7 @@ stattach(parent, self, aux) /* * Set up the buf queue for this device */ - st->buf_queue.b_active = 0; - st->buf_queue.b_actf = 0; - st->buf_queue.b_actb = &st->buf_queue.b_actf; + BUFQ_INIT(&st->buf_queue); #if NRND > 0 rnd_attach_source(&st->rnd_source, st->sc_dev.dv_xname, @@ -1076,7 +1074,6 @@ ststrategy(bp) struct buf *bp; { struct st_softc *st = st_cd.cd_devs[STUNIT(bp->b_dev)]; - struct buf *dp; int s; SC_DEBUG(st->sc_link, SDEV_DB1, @@ -1121,11 +1118,7 @@ ststrategy(bp) * at the end (a bit silly because we only have on user.. * (but it could fork())) */ - dp = &st->buf_queue; - bp->b_actf = NULL; - bp->b_actb = dp->b_actb; - *dp->b_actb = bp; - dp->b_actb = &bp->b_actf; + BUFQ_INSERT_TAIL(&st->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -1167,7 +1160,7 @@ ststart(v) { struct st_softc *st = v; struct scsipi_link *sc_link = st->sc_link; - register struct buf *bp, *dp; + register struct buf *bp; struct scsi_rw_tape cmd; int flags, error; @@ -1184,14 +1177,9 @@ ststart(v) return; } - dp = &st->buf_queue; - if ((bp = dp->b_actf) == NULL) + if ((bp = BUFQ_FIRST(&st->buf_queue)) == NULL) return; - if ((dp = bp->b_actf) != NULL) - dp->b_actb = bp->b_actb; - else - st->buf_queue.b_actb = bp->b_actb; - *bp->b_actb = dp; + BUFQ_REMOVE(&st->buf_queue, bp); /* * if the device has been unmounted bye the user diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index cc705e3fe752..d36bb199e778 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.62 1999/11/17 09:34:03 fvdl Exp $ */ +/* $NetBSD: vnd.c,v 1.63 2000/01/21 23:39:57 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -134,8 +134,6 @@ int dovndcluster = 1; int vnddebug = 0x00; #endif -#define b_cylin b_resid - #define vndunit(x) DISKUNIT(x) struct vndxfer { @@ -183,20 +181,23 @@ void vndattach(num) int num; { + int i; char *mem; - register u_long size; if (num <= 0) return; - size = num * sizeof(struct vnd_softc); - mem = malloc(size, M_DEVBUF, M_NOWAIT); + i = num * sizeof(struct vnd_softc); + mem = malloc(i, M_DEVBUF, M_NOWAIT); if (mem == NULL) { printf("WARNING: no memory for vnode disks\n"); return; } - bzero(mem, size); + bzero(mem, i); vnd_softc = (struct vnd_softc *)mem; numvnd = num; + + for (i = 0; i < numvnd; i++) + BUFQ_INIT(&vnd_softc[i].sc_tab); } int @@ -472,7 +473,6 @@ vndstrategy(bp) /* * Just sort by block number */ - nbp->vb_buf.b_cylin = nbp->vb_buf.b_blkno; s = splbio(); if (vnx->vx_error != 0) { VND_PUTBUF(vnd, nbp); @@ -480,7 +480,7 @@ vndstrategy(bp) } vnx->vx_pending++; bgetvp(vp, &nbp->vb_buf); - disksort(&vnd->sc_tab, &nbp->vb_buf); + disksort_blkno(&vnd->sc_tab, &nbp->vb_buf); vndstart(vnd); splx(s); bn += sz; @@ -528,12 +528,12 @@ vndstart(vnd) vnd->sc_flags |= VNF_BUSY; - while (vnd->sc_tab.b_active < vnd->sc_maxactive) { - bp = vnd->sc_tab.b_actf; + while (vnd->sc_active < vnd->sc_maxactive) { + bp = BUFQ_FIRST(&vnd->sc_tab); if (bp == NULL) break; - vnd->sc_tab.b_actf = bp->b_actf; - vnd->sc_tab.b_active++; + BUFQ_REMOVE(&vnd->sc_tab, bp); + vnd->sc_active++; #ifdef DEBUG if (vnddebug & VDB_IO) printf("vndstart(%ld): bp %p vp %p blkno 0x%x addr %p cnt 0x%lx\n", @@ -623,7 +623,7 @@ vndiodone(bp) } } - vnd->sc_tab.b_active--; + vnd->sc_active--; vndstart(vnd); splx(s); } diff --git a/sys/dev/vndvar.h b/sys/dev/vndvar.h index dca02475f0fe..cf7c024b46fa 100644 --- a/sys/dev/vndvar.h +++ b/sys/dev/vndvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: vndvar.h,v 1.4 1998/07/31 02:24:26 thorpej Exp $ */ +/* $NetBSD: vndvar.h,v 1.5 2000/01/21 23:39:57 thorpej Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -116,7 +116,8 @@ struct vnd_softc { struct vnode *sc_vp; /* vnode */ struct ucred *sc_cred; /* credentials */ int sc_maxactive; /* max # of active requests */ - struct buf sc_tab; /* transfer queue */ + struct buf_queue sc_tab; /* transfer queue */ + int sc_active; /* number of active transfers */ char sc_xname[8]; /* XXX external name */ struct disk sc_dkdev; /* generic disk device info */ struct vndgeom sc_geom; /* virtual geometry */