summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2005-10-15 17:29:10 +0000
committeryamt <yamt@NetBSD.org>2005-10-15 17:29:10 +0000
commitaec75b1cc6f7fcd41709ce0aa7e7ade322def5a3 (patch)
tree3d8326f9f2afd0eaa46aa8ff839b0971179ffb68 /sys
parent9a9aac907941a0004579a71d85ffbe3d7c4c4b1c (diff)
- change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc, have a pointer to the former. - move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c. - rename method to strategy for consistency. - move some definitions which don't need to be exposed to the rest of kernel from sys/bufq.h to sys/bufq_impl.h. (is it better to move it to kern/ or somewhere?) - fix some obvious breakage in dev/qbus/ts.c. (not tested)
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/acorn32/mainbus/fd.c20
-rw-r--r--sys/arch/amiga/dev/fd.c28
-rw-r--r--sys/arch/arc/jazz/fd.c20
-rw-r--r--sys/arch/atari/dev/fd.c18
-rw-r--r--sys/arch/atari/dev/hdfd.c20
-rw-r--r--sys/arch/dreamcast/dev/maple/mmemcard.c16
-rw-r--r--sys/arch/hp300/dev/ct.c22
-rw-r--r--sys/arch/hp300/dev/mt.c24
-rw-r--r--sys/arch/hp300/dev/rd.c22
-rw-r--r--sys/arch/hp300/dev/rdvar.h4
-rw-r--r--sys/arch/mac68k/obio/iwm_fd.c14
-rw-r--r--sys/arch/mac68k/obio/iwm_fdvar.h4
-rw-r--r--sys/arch/pdp10/dev/hp.c16
-rw-r--r--sys/arch/pdp10/dev/rh.c10
-rw-r--r--sys/arch/pdp10/dev/rhvar.h4
-rw-r--r--sys/arch/sparc/dev/fd.c20
-rw-r--r--sys/arch/sun3/dev/fd.c20
-rw-r--r--sys/arch/sun3/dev/xd.c18
-rw-r--r--sys/arch/sun3/dev/xdvar.h4
-rw-r--r--sys/arch/sun3/dev/xy.c16
-rw-r--r--sys/arch/sun3/dev/xyvar.h4
-rw-r--r--sys/arch/vax/mba/hp.c18
-rw-r--r--sys/arch/vax/mba/mba.c12
-rw-r--r--sys/arch/vax/mba/mbavar.h4
-rw-r--r--sys/arch/vax/vax/ctu.c20
-rw-r--r--sys/arch/vax/vsa/hdc9224.c14
-rw-r--r--sys/arch/x68k/dev/fd.c20
-rw-r--r--sys/arch/xen/xen/xbd.c14
-rw-r--r--sys/conf/files3
-rw-r--r--sys/ddb/db_xxx.c10
-rw-r--r--sys/dev/ata/wd.c14
-rw-r--r--sys/dev/ata/wdvar.h4
-rw-r--r--sys/dev/ccd.c16
-rw-r--r--sys/dev/ccdvar.h4
-rw-r--r--sys/dev/cgd.c10
-rw-r--r--sys/dev/dksubr.c10
-rw-r--r--sys/dev/dkvar.h4
-rw-r--r--sys/dev/dkwedge/dk.c24
-rw-r--r--sys/dev/fss.c12
-rw-r--r--sys/dev/fssvar.h4
-rw-r--r--sys/dev/gpib/ct.c20
-rw-r--r--sys/dev/gpib/mt.c22
-rw-r--r--sys/dev/gpib/rd.c22
-rw-r--r--sys/dev/ic/rrunner.c12
-rw-r--r--sys/dev/ic/rrunnervar.h4
-rw-r--r--sys/dev/isa/fd.c18
-rw-r--r--sys/dev/isa/fdvar.h4
-rw-r--r--sys/dev/isa/mcd.c12
-rw-r--r--sys/dev/ld.c18
-rw-r--r--sys/dev/ldvar.h4
-rw-r--r--sys/dev/mca/ed_mca.c8
-rw-r--r--sys/dev/mca/edc_mca.c6
-rw-r--r--sys/dev/mca/edvar.h4
-rw-r--r--sys/dev/md.c12
-rw-r--r--sys/dev/mscp/mscp_disk.c6
-rw-r--r--sys/dev/mscp/mscp_subr.c14
-rw-r--r--sys/dev/mscp/mscpvar.h4
-rw-r--r--sys/dev/qbus/rf.c16
-rw-r--r--sys/dev/qbus/rl.c12
-rw-r--r--sys/dev/qbus/rlvar.h6
-rw-r--r--sys/dev/qbus/ts.c24
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c14
-rw-r--r--sys/dev/scsipi/cd.c22
-rw-r--r--sys/dev/scsipi/cdvar.h4
-rw-r--r--sys/dev/scsipi/sd.c21
-rw-r--r--sys/dev/scsipi/sdvar.h4
-rw-r--r--sys/dev/scsipi/ss.c14
-rw-r--r--sys/dev/scsipi/ss_mustek.c8
-rw-r--r--sys/dev/scsipi/ss_scanjet.c8
-rw-r--r--sys/dev/scsipi/ssvar.h4
-rw-r--r--sys/dev/scsipi/st.c26
-rw-r--r--sys/dev/scsipi/stvar.h4
-rw-r--r--sys/dev/vme/xd.c18
-rw-r--r--sys/dev/vme/xdvar.h4
-rw-r--r--sys/dev/vme/xy.c16
-rw-r--r--sys/dev/vme/xyvar.h4
-rw-r--r--sys/dev/vnd.c14
-rw-r--r--sys/dev/vndvar.h4
-rw-r--r--sys/kern/bufq_disksort.c9
-rw-r--r--sys/kern/bufq_fcfs.c7
-rw-r--r--sys/kern/bufq_priocscan.c7
-rw-r--r--sys/kern/bufq_readprio.c6
-rw-r--r--sys/kern/subr_bufq.c213
-rw-r--r--sys/kern/subr_disk.c96
-rw-r--r--sys/sys/bufq.h78
-rw-r--r--sys/sys/bufq_impl.h136
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c16
-rw-r--r--sys/ufs/mfs/mfs_vnops.c14
-rw-r--r--sys/ufs/mfs/mfsnode.h4
-rw-r--r--sys/uvm/uvm_swap.c18
90 files changed, 899 insertions, 683 deletions
diff --git a/sys/arch/acorn32/mainbus/fd.c b/sys/arch/acorn32/mainbus/fd.c
index c045bc1a5b6..5d35694a97f 100644
--- a/sys/arch/acorn32/mainbus/fd.c
+++ b/sys/arch/acorn32/mainbus/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.20 2005/06/09 09:26:06 he Exp $ */
+/* $NetBSD: fd.c,v 1.21 2005/10/15 17:29:10 yamt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -89,7 +89,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.20 2005/06/09 09:26:06 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.21 2005/10/15 17:29:10 yamt Exp $");
#include "opt_ddb.h"
@@ -251,7 +251,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *sc_q;/* pending I/O requests */
int sc_active; /* number of active I/O operations */
};
@@ -510,7 +510,7 @@ fdattach(parent, self, aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -614,7 +614,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -667,11 +667,11 @@ fdfinish(fd, bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
else
fd->sc_active = 0;
@@ -922,7 +922,7 @@ fdctimeout(arg)
#endif
fdcstatus(&fd->sc_dev, 0, "timeout");
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -967,7 +967,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1270,7 +1270,7 @@ fdcretry(fdc)
struct buf *bp;
fd = fdc->sc_drives.tqh_first;
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (fd->sc_opts & FDOPT_NORETRY)
goto fail;
diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c
index ad73615baa7..f58407fa3d9 100644
--- a/sys/arch/amiga/dev/fd.c
+++ b/sys/arch/amiga/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.64 2005/06/13 21:34:16 jmc Exp $ */
+/* $NetBSD: fd.c,v 1.65 2005/10/15 17:29:10 yamt Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.64 2005/06/13 21:34:16 jmc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.65 2005/10/15 17:29:10 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -148,7 +148,7 @@ struct fdtype {
struct fd_softc {
struct device sc_dv; /* generic device info; must come first */
struct disk dkdev; /* generic disk info */
- struct bufq_state bufq; /* queue pending I/O operations */
+ struct bufq_state *bufq;/* queue pending I/O operations */
struct buf curbuf; /* state of current I/O operation */
struct callout calibrate_ch;
struct callout motor_ch;
@@ -398,7 +398,7 @@ fdattach(struct device *pdp, struct device *dp, void *auxp)
ap = auxp;
sc = (struct fd_softc *)dp;
- bufq_alloc(&sc->bufq, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&sc->bufq, "disksort", BUFQ_SORT_CYLINDER);
callout_init(&sc->calibrate_ch);
callout_init(&sc->motor_ch);
@@ -681,7 +681,7 @@ fdstrategy(struct buf *bp)
* queue the buf and kick the low level code
*/
s = splbio();
- BUFQ_PUT(&sc->bufq, bp);
+ BUFQ_PUT(sc->bufq, bp);
fdstart(sc);
splx(s);
return;
@@ -1182,7 +1182,7 @@ fdstart(struct fd_softc *sc)
* get next buf if there.
*/
dp = &sc->curbuf;
- if ((bp = BUFQ_PEEK(&sc->bufq)) == NULL) {
+ if ((bp = BUFQ_PEEK(sc->bufq)) == NULL) {
#ifdef FDDEBUG
printf(" nothing to do\n");
#endif
@@ -1213,17 +1213,17 @@ printf("fdstart: disk changed\n");
#endif
sc->flags &= ~FDF_HAVELABEL;
for (;;) {
- bp = BUFQ_GET(&sc->bufq);
+ bp = BUFQ_GET(sc->bufq);
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
- if (BUFQ_PEEK(&sc->bufq) == NULL)
+ if (BUFQ_PEEK(sc->bufq) == NULL)
break;
biodone(bp);
}
/*
* do fddone() on last buf to allow other units to start.
*/
- BUFQ_PUT(&sc->bufq, bp);
+ BUFQ_PUT(sc->bufq, bp);
fddone(sc);
return;
}
@@ -1299,7 +1299,7 @@ fdcont(struct fd_softc *sc)
int trk, write;
dp = &sc->curbuf;
- bp = BUFQ_PEEK(&sc->bufq);
+ bp = BUFQ_PEEK(sc->bufq);
dp->b_data += (dp->b_bcount - bp->b_resid);
dp->b_blkno += (dp->b_bcount - bp->b_resid) / FDSECSIZE;
dp->b_bcount = bp->b_resid;
@@ -1539,7 +1539,7 @@ fddone(struct fd_softc *sc)
goto nobuf;
dp = &sc->curbuf;
- if ((bp = BUFQ_PEEK(&sc->bufq)) == NULL)
+ if ((bp = BUFQ_PEEK(sc->bufq)) == NULL)
panic ("fddone");
/*
* check for an error that may have occurred
@@ -1579,7 +1579,7 @@ fddone(struct fd_softc *sc)
/*
* remove from queue.
*/
- (void)BUFQ_GET(&sc->bufq);
+ (void)BUFQ_GET(sc->bufq);
disk_unbusy(&sc->dkdev, (bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ));
@@ -1625,7 +1625,7 @@ fdfindwork(int unit)
* and it has no buf's queued do it now
*/
if (sc->flags & FDF_MOTOROFF) {
- if (BUFQ_PEEK(&sc->bufq) == NULL)
+ if (BUFQ_PEEK(sc->bufq) == NULL)
fdmotoroff(sc);
else {
/*
@@ -1645,7 +1645,7 @@ fdfindwork(int unit)
* if we have no start unit and the current unit has
* io waiting choose this unit to start.
*/
- if (ssc == NULL && BUFQ_PEEK(&sc->bufq) != NULL)
+ if (ssc == NULL && BUFQ_PEEK(sc->bufq) != NULL)
ssc = sc;
}
if (ssc)
diff --git a/sys/arch/arc/jazz/fd.c b/sys/arch/arc/jazz/fd.c
index 4b67115c0af..534de759760 100644
--- a/sys/arch/arc/jazz/fd.c
+++ b/sys/arch/arc/jazz/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.21 2005/06/03 12:31:38 tsutsui Exp $ */
+/* $NetBSD: fd.c,v 1.22 2005/10/15 17:29:10 yamt Exp $ */
/* $OpenBSD: fd.c,v 1.6 1998/10/03 21:18:57 millert Exp $ */
/* NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp */
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.21 2005/06/03 12:31:38 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.22 2005/10/15 17:29:10 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -177,7 +177,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *sc_q;/* pending I/O requests */
int sc_active; /* number of active I/O operations */
};
@@ -347,7 +347,7 @@ fdattach(struct device *parent, struct device *self, void *aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -461,7 +461,7 @@ fdstrategy(struct buf *bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -511,11 +511,11 @@ fdfinish(struct fd_softc *fd, struct buf *bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
else
fd->sc_active = 0;
@@ -735,7 +735,7 @@ fdctimeout(void *arg)
#endif
fdcstatus(&fd->sc_dev, 0, "timeout");
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -777,7 +777,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1026,7 +1026,7 @@ fdcretry(struct fdc_softc *fdc)
char bits[64];
fd = TAILQ_FIRST(&fdc->sc_drives);
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
switch (fdc->sc_errors) {
case 0:
diff --git a/sys/arch/atari/dev/fd.c b/sys/arch/atari/dev/fd.c
index 582d80ca38b..91f937be135 100644
--- a/sys/arch/atari/dev/fd.c
+++ b/sys/arch/atari/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.50 2005/06/04 14:42:36 he Exp $ */
+/* $NetBSD: fd.c,v 1.51 2005/10/15 17:29:10 yamt Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.50 2005/06/04 14:42:36 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.51 2005/10/15 17:29:10 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -136,7 +136,7 @@ static const char *fd_error= NULL; /* error from fd_xfer_ok() */
struct fd_softc {
struct device sc_dv; /* generic device info */
struct disk dkdev; /* generic disk info */
- struct bufq_state bufq; /* queue of buf's */
+ struct bufq_state *bufq; /* queue of buf's */
struct callout sc_motor_ch;
int unit; /* unit for atari controlling hw*/
int nheads; /* number of heads in use */
@@ -512,7 +512,7 @@ struct proc *proc;
type = FLP_TYPE(dev);
- bufq_alloc(&sc->bufq, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sc->bufq, "disksort", BUFQ_SORT_RAWBLOCK);
sc->unit = DISKUNIT(dev);
sc->part = RAW_PART;
sc->nheads = fdtypes[type].nheads;
@@ -635,7 +635,7 @@ struct buf *bp;
* queue the buf and kick the low level code
*/
sps = splbio();
- BUFQ_PUT(&sc->bufq, bp); /* XXX disksort_cylinder */
+ BUFQ_PUT(sc->bufq, bp); /* XXX disksort_cylinder */
if (!lock_stat) {
if (fd_state & FLP_MON)
callout_stop(&sc->sc_motor_ch);
@@ -698,7 +698,7 @@ struct fd_softc *sc;
{
struct buf *bp;
- bp = BUFQ_PEEK(&sc->bufq);
+ bp = BUFQ_PEEK(sc->bufq);
sc->sector = bp->b_blkno; /* Start sector for I/O */
sc->io_data = bp->b_data; /* KVA base for I/O */
sc->io_bytes = bp->b_bcount; /* Transfer size in bytes */
@@ -736,7 +736,7 @@ register struct fd_softc *sc;
* Finish current transaction.
*/
sps = splbio();
- bp = BUFQ_GET(&sc->bufq);
+ bp = BUFQ_GET(sc->bufq);
if (bp == NULL)
panic("fddone");
splx(sps);
@@ -765,7 +765,7 @@ register struct fd_softc *sc;
i = 0;
if((sc1 = fd_cd.cd_devs[i]) == NULL)
continue;
- if (BUFQ_PEEK(&sc1->bufq) != NULL)
+ if (BUFQ_PEEK(sc1->bufq) != NULL)
break;
if(i == sc->unit) {
callout_reset(&sc->sc_motor_ch, FLP_MONDELAY,
@@ -1006,7 +1006,7 @@ struct fd_softc *sc;
return;
}
- bp = BUFQ_PEEK(&sc->bufq);
+ bp = BUFQ_PEEK(sc->bufq);
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
diff --git a/sys/arch/atari/dev/hdfd.c b/sys/arch/atari/dev/hdfd.c
index 108ad69ddc8..c24a6e07b1d 100644
--- a/sys/arch/atari/dev/hdfd.c
+++ b/sys/arch/atari/dev/hdfd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hdfd.c,v 1.45 2005/06/04 14:42:36 he Exp $ */
+/* $NetBSD: hdfd.c,v 1.46 2005/10/15 17:29:10 yamt Exp $ */
/*-
* Copyright (c) 1996 Leo Weppelman
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.45 2005/06/04 14:42:36 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.46 2005/10/15 17:29:10 yamt Exp $");
#include "opt_ddb.h"
@@ -274,7 +274,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *sc_q; /* pending I/O requests */
int sc_active; /* number of active I/O operations */
};
@@ -537,7 +537,7 @@ fdattach(parent, self, aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -650,7 +650,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -703,11 +703,11 @@ fdfinish(fd, bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
else
fd->sc_active = 0;
@@ -945,7 +945,7 @@ fdctimeout(arg)
s = splbio();
fdcstatus(&fd->sc_dev, 0, "timeout");
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -990,7 +990,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1280,7 +1280,7 @@ fdcretry(fdc)
struct buf *bp;
fd = fdc->sc_drives.tqh_first;
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (fd->sc_opts & FDOPT_NORETRY)
goto fail;
diff --git a/sys/arch/dreamcast/dev/maple/mmemcard.c b/sys/arch/dreamcast/dev/maple/mmemcard.c
index 468ce6ccff9..c4f241bb004 100644
--- a/sys/arch/dreamcast/dev/maple/mmemcard.c
+++ b/sys/arch/dreamcast/dev/maple/mmemcard.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mmemcard.c,v 1.5 2005/02/19 15:40:16 tsutsui Exp $ */
+/* $NetBSD: mmemcard.c,v 1.6 2005/10/15 17:29:10 yamt Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.5 2005/02/19 15:40:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mmemcard.c,v 1.6 2005/10/15 17:29:10 yamt Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -152,7 +152,7 @@ struct mmem_softc {
#define sc_reqm sc_req.req_minfo
/* pending buffers */
- struct bufq_state sc_q;
+ struct bufq_state *sc_q;
/* current I/O access */
struct buf *sc_bp;
@@ -252,7 +252,7 @@ mmemattach(struct device *parent, struct device *self, void *aux)
* start init sequence
*/
sc->sc_stat = MMEM_INIT;
- bufq_alloc(&sc->sc_q, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sc->sc_q, "disksort", BUFQ_SORT_RAWBLOCK);
/* check consistency */
if (sc->sc_wacc != 0) {
@@ -324,13 +324,13 @@ mmemdetach(struct device *self, int flags)
bp->b_resid = bp->b_bcount;
biodone(bp);
}
- while ((bp = BUFQ_GET(&sc->sc_q)) != NULL) {
+ while ((bp = BUFQ_GET(sc->sc_q)) != NULL) {
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
biodone(bp);
}
- bufq_free(&sc->sc_q);
+ bufq_free(sc->sc_q);
/*
* revoke vnodes
@@ -738,7 +738,7 @@ mmemstrategy(struct buf *bp)
bp->b_rawblkno = off;
/* queue this transfer */
- BUFQ_PUT(&sc->sc_q, bp);
+ BUFQ_PUT(sc->sc_q, bp);
if (sc->sc_stat == MMEM_IDLE)
mmemstart(sc);
@@ -761,7 +761,7 @@ mmemstart(struct mmem_softc *sc)
struct mmem_pt *pt;
int s;
- if ((bp = BUFQ_GET(&sc->sc_q)) == NULL) {
+ if ((bp = BUFQ_GET(sc->sc_q)) == NULL) {
sc->sc_stat = MMEM_IDLE;
maple_enable_unit_ping(sc->sc_parent, sc->sc_unit,
MAPLE_FN_MEMCARD, 1);
diff --git a/sys/arch/hp300/dev/ct.c b/sys/arch/hp300/dev/ct.c
index ffe52dedbe4..22287d58ce5 100644
--- a/sys/arch/hp300/dev/ct.c
+++ b/sys/arch/hp300/dev/ct.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ct.c,v 1.42 2005/06/02 16:25:02 tsutsui Exp $ */
+/* $NetBSD: ct.c,v 1.43 2005/10/15 17:29:10 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.42 2005/06/02 16:25:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.43 2005/10/15 17:29:10 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -117,7 +117,7 @@ struct ct_softc {
struct ct_ulcmd sc_ul;
struct ct_wfmcmd sc_wfm;
struct ct_clearcmd sc_clear;
- struct bufq_state sc_tab;
+ struct bufq_state *sc_tab;
int sc_active;
struct buf *sc_bp;
struct buf sc_bufstore; /* XXX */
@@ -231,7 +231,7 @@ ctattach(struct device *parent, struct device *self, void *aux)
sc->sc_slave = ha->ha_slave;
sc->sc_punit = ha->ha_punit;
- bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_tab, "fcfs", 0);
/* Initialize hpib job queue entry. */
sc->sc_hq.hq_softc = sc;
@@ -497,7 +497,7 @@ ctstrategy(struct buf *bp)
sc = ct_cd.cd_devs[unit];
s = splbio();
- BUFQ_PUT(&sc->sc_tab, bp);
+ BUFQ_PUT(sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
ctustart(sc);
@@ -510,7 +510,7 @@ ctustart(struct ct_softc *sc)
{
struct buf *bp;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
sc->sc_addr = bp->b_data;
sc->sc_resid = bp->b_bcount;
if (hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq))
@@ -527,7 +527,7 @@ ctstart(void *arg)
ctlr = sc->sc_dev.dv_parent->dv_unit;
slave = sc->sc_slave;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if ((sc->sc_flags & CTF_CMD) && sc->sc_bp == bp) {
switch(sc->sc_cmd) {
case MTFSF:
@@ -637,7 +637,7 @@ ctgo(void *arg)
struct buf *bp;
int rw;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
rw = bp->b_flags & B_READ;
hpibgo(sc->sc_dev.dv_parent->dv_unit, sc->sc_slave, C_EXEC,
sc->sc_addr, sc->sc_resid, rw, rw != 0);
@@ -730,7 +730,7 @@ ctintr(void *arg)
slave = sc->sc_slave;
unit = sc->sc_dev.dv_unit;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if (bp == NULL) {
printf("%s: bp == NULL\n", sc->sc_dev.dv_xname);
return;
@@ -865,10 +865,10 @@ static void
ctdone(struct ct_softc *sc, struct buf *bp)
{
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
biodone(bp);
hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if (BUFQ_PEEK(&sc->sc_tab) == NULL) {
+ if (BUFQ_PEEK(sc->sc_tab) == NULL) {
sc->sc_active = 0;
return;
}
diff --git a/sys/arch/hp300/dev/mt.c b/sys/arch/hp300/dev/mt.c
index 3c9783a94c3..2d3229e14da 100644
--- a/sys/arch/hp300/dev/mt.c
+++ b/sys/arch/hp300/dev/mt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.29 2005/06/02 16:25:02 tsutsui Exp $ */
+/* $NetBSD: mt.c,v 1.30 2005/10/15 17:29:10 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.29 2005/06/02 16:25:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.30 2005/10/15 17:29:10 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -119,7 +119,7 @@ struct mt_softc {
short sc_type; /* tape drive model (hardware IDs) */
struct hpibqueue sc_hq; /* HPIB device queue member */
tpr_t sc_ttyp;
- struct bufq_state sc_tab;/* buf queue */
+ struct bufq_state *sc_tab;/* buf queue */
int sc_active;
struct buf sc_bufstore; /* XXX buffer storage */
};
@@ -193,7 +193,7 @@ mtattach(struct device *parent, struct device *self, void *aux)
hpibno = parent->dv_unit;
slave = ha->ha_slave;
- bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_tab, "fcfs", 0);
callout_init(&sc->sc_start_ch);
callout_init(&sc->sc_intr_ch);
@@ -507,7 +507,7 @@ mtstrategy(struct buf *bp)
}
}
s = splbio();
- BUFQ_PUT(&sc->sc_tab, bp);
+ BUFQ_PUT(sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
mtustart(sc);
@@ -554,7 +554,7 @@ mtstart(void *arg)
dlog(LOG_DEBUG, "%s start", sc->sc_dev.dv_xname);
sc->sc_flags &= ~MTF_WRT;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if ((sc->sc_flags & MTF_ALIVE) == 0 &&
((bp->b_flags & B_CMD) == 0 || bp->b_cmd != MTRESET))
goto fatalerror;
@@ -735,10 +735,10 @@ errdone:
bp->b_flags |= B_ERROR;
done:
sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
biodone(bp);
hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if ((bp = BUFQ_PEEK(&sc->sc_tab)) == NULL)
+ if ((bp = BUFQ_PEEK(sc->sc_tab)) == NULL)
sc->sc_active = 0;
else
mtustart(sc);
@@ -757,7 +757,7 @@ mtgo(void *arg)
int rw;
dlog(LOG_DEBUG, "%s go", sc->sc_dev.dv_xname);
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
rw = bp->b_flags & B_READ;
hpibgo(sc->sc_hpibno, sc->sc_slave, rw ? MTT_READ : MTL_WRITE,
bp->b_data, bp->b_bcount, rw, rw != 0);
@@ -771,7 +771,7 @@ mtintr(void *arg)
int i;
u_char cmdbuf[4];
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if (bp == NULL) {
log(LOG_ERR, "%s intr: bp == NULL", sc->sc_dev.dv_xname);
return;
@@ -918,10 +918,10 @@ mtintr(void *arg)
cmdbuf[0] = MTE_COMPLETE | MTE_IDLE;
(void) hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_ECMD, cmdbuf, 1);
bp->b_flags &= ~B_CMD;
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
biodone(bp);
hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if (BUFQ_PEEK(&sc->sc_tab) == NULL)
+ if (BUFQ_PEEK(sc->sc_tab) == NULL)
sc->sc_active = 0;
else
mtustart(sc);
diff --git a/sys/arch/hp300/dev/rd.c b/sys/arch/hp300/dev/rd.c
index 1bf99ecedfd..4ef71b3f746 100644
--- a/sys/arch/hp300/dev/rd.c
+++ b/sys/arch/hp300/dev/rd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rd.c,v 1.67 2005/02/19 16:31:49 tsutsui Exp $ */
+/* $NetBSD: rd.c,v 1.68 2005/10/15 17:29:10 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.67 2005/02/19 16:31:49 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.68 2005/10/15 17:29:10 yamt Exp $");
#include "opt_useleds.h"
#include "rnd.h"
@@ -370,7 +370,7 @@ rdattach(struct device *parent, struct device *self, void *aux)
struct rd_softc *sc = (struct rd_softc *)self;
struct hpibbus_attach_args *ha = aux;
- bufq_alloc(&sc->sc_tab, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sc->sc_tab, "disksort", BUFQ_SORT_RAWBLOCK);
if (rdident(parent, sc, ha) == 0) {
printf("\n%s: didn't respond to describe command!\n",
@@ -743,7 +743,7 @@ rdstrategy(struct buf *bp)
}
bp->b_rawblkno = bn + offset;
s = splbio();
- BUFQ_PUT(&rs->sc_tab, bp);
+ BUFQ_PUT(rs->sc_tab, bp);
if (rs->sc_active == 0) {
rs->sc_active = 1;
rdustart(rs);
@@ -772,7 +772,7 @@ rdustart(struct rd_softc *rs)
{
struct buf *bp;
- bp = BUFQ_PEEK(&rs->sc_tab);
+ bp = BUFQ_PEEK(rs->sc_tab);
rs->sc_addr = bp->b_data;
rs->sc_resid = bp->b_bcount;
if (hpibreq(rs->sc_dev.dv_parent, &rs->sc_hq))
@@ -784,11 +784,11 @@ rdfinish(struct rd_softc *rs, struct buf *bp)
{
rs->sc_errcnt = 0;
- (void)BUFQ_GET(&rs->sc_tab);
+ (void)BUFQ_GET(rs->sc_tab);
bp->b_resid = 0;
biodone(bp);
hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
- if ((bp = BUFQ_PEEK(&rs->sc_tab)) != NULL)
+ if ((bp = BUFQ_PEEK(rs->sc_tab)) != NULL)
return (bp);
rs->sc_active = 0;
if (rs->sc_flags & RDF_WANTED) {
@@ -802,7 +802,7 @@ static void
rdstart(void *arg)
{
struct rd_softc *rs = arg;
- struct buf *bp = BUFQ_PEEK(&rs->sc_tab);
+ struct buf *bp = BUFQ_PEEK(rs->sc_tab);
int part, ctlr, slave;
ctlr = rs->sc_dev.dv_parent->dv_unit;
@@ -880,7 +880,7 @@ static void
rdgo(void *arg)
{
struct rd_softc *rs = arg;
- struct buf *bp = BUFQ_PEEK(&rs->sc_tab);
+ struct buf *bp = BUFQ_PEEK(rs->sc_tab);
int rw, ctlr, slave;
ctlr = rs->sc_dev.dv_parent->dv_unit;
@@ -903,7 +903,7 @@ rdintr(void *arg)
{
struct rd_softc *rs = arg;
int unit = rs->sc_dev.dv_unit;
- struct buf *bp = BUFQ_PEEK(&rs->sc_tab);
+ struct buf *bp = BUFQ_PEEK(rs->sc_tab);
u_char stat = 13; /* in case hpibrecv fails */
int rv, restart, ctlr, slave;
@@ -1074,7 +1074,7 @@ rderror(int unit)
* Note that not all errors report a block number, in that case
* we just use b_blkno.
*/
- bp = BUFQ_PEEK(&rs->sc_tab);
+ bp = BUFQ_PEEK(rs->sc_tab);
pbn = rs->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)].p_offset;
if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) ||
(sp->c_ief & IEF_RRMASK)) {
diff --git a/sys/arch/hp300/dev/rdvar.h b/sys/arch/hp300/dev/rdvar.h
index b6aec3967b5..8b9c0bf15fc 100644
--- a/sys/arch/hp300/dev/rdvar.h
+++ b/sys/arch/hp300/dev/rdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rdvar.h,v 1.15 2005/06/02 16:25:02 tsutsui Exp $ */
+/* $NetBSD: rdvar.h,v 1.16 2005/10/15 17:29:10 yamt Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -114,7 +114,7 @@ struct rd_softc {
struct rd_ssmcmd sc_ssmc;
struct rd_srcmd sc_src;
struct rd_clearcmd sc_clear;
- struct bufq_state sc_tab;
+ struct bufq_state *sc_tab;
int sc_active;
int sc_errcnt;
struct rdstats sc_stats;
diff --git a/sys/arch/mac68k/obio/iwm_fd.c b/sys/arch/mac68k/obio/iwm_fd.c
index df1096a693c..ca576203da9 100644
--- a/sys/arch/mac68k/obio/iwm_fd.c
+++ b/sys/arch/mac68k/obio/iwm_fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iwm_fd.c,v 1.33 2005/06/16 22:45:46 jmc Exp $ */
+/* $NetBSD: iwm_fd.c,v 1.34 2005/10/15 17:29:10 yamt Exp $ */
/*
* Copyright (c) 1997, 1998 Hauke Fath. All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.33 2005/06/16 22:45:46 jmc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.34 2005/10/15 17:29:10 yamt Exp $");
#ifdef _LKM
#define IWMCF_DRIVE 0
@@ -460,7 +460,7 @@ fd_attach(struct device *parent, struct device *self, void *auxp)
iwm->fd[ia->unit] = fd; /* iwm has ptr to this drive */
iwm->drives++;
- bufq_alloc(&fd->bufQueue, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->bufQueue, "disksort", BUFQ_SORT_CYLINDER);
callout_init(&fd->motor_ch);
printf(" drive %d: ", fd->unit);
@@ -1080,7 +1080,7 @@ fdstrategy(struct buf *bp)
}
spl = splbio();
callout_stop(&fd->motor_ch);
- BUFQ_PUT(&fd->bufQueue, bp);
+ BUFQ_PUT(fd->bufQueue, bp);
if (fd->sc_active == 0)
fdstart(fd);
splx(spl);
@@ -1193,7 +1193,7 @@ fdstart_Init(fd_softc_t *fd)
* Get the first entry from the queue. This is the buf we gave to
* fdstrategy(); disksort() put it into our softc.
*/
- bp = BUFQ_PEEK(&fd->bufQueue);
+ bp = BUFQ_PEEK(fd->bufQueue);
if (NULL == bp) {
if (TRACE_STRAT)
printf("Queue empty: Nothing to do");
@@ -1588,7 +1588,7 @@ fdstart_Exit(fd_softc_t *fd)
fd->pos.track, fd->pos.side, fd->pos.sector);
#endif
- bp = BUFQ_GET(&fd->bufQueue);
+ bp = BUFQ_GET(fd->bufQueue);
bp->b_resid = fd->bytesLeft;
bp->b_error = (0 == fd->iwmErr) ? 0 : EIO;
@@ -1603,7 +1603,7 @@ fdstart_Exit(fd_softc_t *fd)
}
if (DISABLED && TRACE_STRAT)
printf(" Next buf (bufQueue first) at %p\n",
- BUFQ_PEEK(&fd->bufQueue));
+ BUFQ_PEEK(fd->bufQueue));
disk_unbusy(&fd->diskInfo, bp->b_bcount - bp->b_resid,
(bp->b_flags & B_READ));
biodone(bp);
diff --git a/sys/arch/mac68k/obio/iwm_fdvar.h b/sys/arch/mac68k/obio/iwm_fdvar.h
index 28744a5f7f3..d99fc909d65 100644
--- a/sys/arch/mac68k/obio/iwm_fdvar.h
+++ b/sys/arch/mac68k/obio/iwm_fdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: iwm_fdvar.h,v 1.9 2005/06/16 22:45:46 jmc Exp $ */
+/* $NetBSD: iwm_fdvar.h,v 1.10 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1997, 1998 Hauke Fath. All rights reserved.
@@ -132,7 +132,7 @@ typedef struct iwmAttachArgs iwmAttachArgs_t;
struct fd_softc {
struct device devInfo; /* generic device info */
struct disk diskInfo; /* generic disk info */
- struct bufq_state bufQueue; /* queue of buf's */
+ struct bufq_state *bufQueue; /* queue of buf's */
int sc_active; /* number of active requests */
struct callout motor_ch; /* motor callout */
diff --git a/sys/arch/pdp10/dev/hp.c b/sys/arch/pdp10/dev/hp.c
index 4aa61b04c77..a89743f8b70 100644
--- a/sys/arch/pdp10/dev/hp.c
+++ b/sys/arch/pdp10/dev/hp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hp.c,v 1.2 2004/10/28 07:07:38 yamt Exp $ */
+/* $NetBSD: hp.c,v 1.3 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -184,7 +184,7 @@ hpattach(struct device *parent, struct device *self, void *aux)
/*
* Init the common struct for both the adapter and its slaves.
*/
- bufq_alloc(&sc->sc_md.md_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&sc->sc_md.md_q, "disksort", BUFQ_SORT_CYLINDER);
sc->sc_md.md_softc = (void *)sc; /* Pointer to this softc */
sc->sc_md.md_rh = (void *)parent; /* Pointer to parent softc */
sc->sc_md.md_start = hpstart; /* Disk start routine */
@@ -237,8 +237,8 @@ hpstrategy(struct buf *bp)
s = splbio();
- gp = BUFQ_PEEK(&sc->sc_md.md_q);
- BUFQ_PUT(&sc->sc_md.md_q, bp);
+ gp = BUFQ_PEEK(sc->sc_md.md_q);
+ BUFQ_PUT(sc->sc_md.md_q, bp);
if (gp == 0)
rhqueue(&sc->sc_md);
@@ -258,7 +258,7 @@ hpstart(struct rh_device *md)
{
struct hp_softc *sc = md->md_softc;
struct disklabel *lp = sc->sc_disk.dk_label;
- struct buf *bp = BUFQ_PEEK(&md->md_q);
+ struct buf *bp = BUFQ_PEEK(md->md_q);
unsigned bn, cn, sn, tn;
/*
@@ -402,7 +402,7 @@ int
hpfinish(struct rh_device *md, int mbasr, int *attn)
{
struct hp_softc *sc = md->md_softc;
- struct buf *bp = BUFQ_PEEK(&md->md_q);
+ struct buf *bp = BUFQ_PEEK(md->md_q);
int er1, er2;
HP_RCSR(HP_ER1, er1);
@@ -447,8 +447,8 @@ hper2:
printf("massbuss error :%s %x\n",
sc->sc_dev.dv_xname, mbasr);
- BUFQ_PEEK(&md->md_q)->b_resid = 0;
- disk_unbusy(&sc->sc_disk, BUFQ_PEEK(&md->md_q)->b_bcount,
+ BUFQ_PEEK(md->md_q)->b_resid = 0;
+ disk_unbusy(&sc->sc_disk, BUFQ_PEEK(md->md_q)->b_bcount,
(bp->b_flags & B_READ));
return XFER_FINISH;
}
diff --git a/sys/arch/pdp10/dev/rh.c b/sys/arch/pdp10/dev/rh.c
index 67d5c79a9ba..1e2e05d361e 100644
--- a/sys/arch/pdp10/dev/rh.c
+++ b/sys/arch/pdp10/dev/rh.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rh.c,v 1.1 2003/08/19 10:51:57 ragge Exp $ */
+/* $NetBSD: rh.c,v 1.2 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -188,7 +188,7 @@ rhintr(void *rh)
return; /* During autoconfig */
md = sc->sc_first;
- bp = BUFQ_PEEK(&md->md_q);
+ bp = BUFQ_PEEK(md->md_q);
/*
* A data-transfer interrupt. Current operation is finished,
* call that device's finish routine to see what to do next.
@@ -205,13 +205,13 @@ rhintr(void *rh)
* If more to transfer, start the adapter again
* by calling rhstart().
*/
- (void)BUFQ_GET(&md->md_q);
+ (void)BUFQ_GET(md->md_q);
sc->sc_first = md->md_back;
md->md_back = 0;
if (sc->sc_first == 0)
sc->sc_last = (void *)&sc->sc_first;
- if (BUFQ_PEEK(&md->md_q) != NULL) {
+ if (BUFQ_PEEK(md->md_q) != NULL) {
sc->sc_last->md_back = md;
sc->sc_last = md;
}
@@ -281,7 +281,7 @@ void
rhstart(struct rh_softc *sc)
{
struct rh_device *md = sc->sc_first;
- struct buf *bp = BUFQ_PEEK(&md->md_q);
+ struct buf *bp = BUFQ_PEEK(md->md_q);
int ncnt = bp->b_bcount/4;
int blkcnt = ncnt/128;
paddr_t pap;
diff --git a/sys/arch/pdp10/dev/rhvar.h b/sys/arch/pdp10/dev/rhvar.h
index 98de6096c59..c2871b6098f 100644
--- a/sys/arch/pdp10/dev/rhvar.h
+++ b/sys/arch/pdp10/dev/rhvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rhvar.h,v 1.1 2003/08/19 10:51:58 ragge Exp $ */
+/* $NetBSD: rhvar.h,v 1.2 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
* All rights reserved.
@@ -91,7 +91,7 @@ struct rh_device {
int (*md_finish)(struct rh_device *, int, int *);
void *md_softc; /* Backpointer to this units softc. */
struct rh_softc *md_rh;
- struct bufq_state md_q; /* queue of I/O requests */
+ struct bufq_state *md_q; /* queue of I/O requests */
int md_csr; /* Drive command given to RH20 */
int md_da; /* Disk address given to RH20 */
};
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index f8b8e870e8b..86c29669fb0 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.117 2005/06/04 04:34:12 tsutsui Exp $ */
+/* $NetBSD: fd.c,v 1.118 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -108,7 +108,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.117 2005/06/04 04:34:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.118 2005/10/15 17:29:11 yamt Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
@@ -293,7 +293,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *sc_q;/* pending I/O requests */
int sc_active; /* number of active I/O requests */
};
@@ -794,7 +794,7 @@ fdattach(parent, self, aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -890,7 +890,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -942,11 +942,11 @@ fdfinish(fd, bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL) {
+ if (BUFQ_PEEK(fd->sc_q) != NULL) {
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
} else
fd->sc_active = 0;
@@ -1304,7 +1304,7 @@ fdctimeout(arg)
goto out;
}
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -1477,7 +1477,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1895,7 +1895,7 @@ fdcretry(fdc)
int error = EIO;
fd = fdc->sc_drives.tqh_first;
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
fdc->sc_overruns = 0;
if (fd->sc_opts & FDOPT_NORETRY)
diff --git a/sys/arch/sun3/dev/fd.c b/sys/arch/sun3/dev/fd.c
index 9d929b21ba5..80ad713e4de 100644
--- a/sys/arch/sun3/dev/fd.c
+++ b/sys/arch/sun3/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.43 2005/06/03 15:04:21 tsutsui Exp $ */
+/* $NetBSD: fd.c,v 1.44 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.43 2005/06/03 15:04:21 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.44 2005/10/15 17:29:11 yamt Exp $");
#include "opt_ddb.h"
@@ -254,7 +254,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *sc_q;/* pending I/O requests */
int sc_active; /* number of active I/O operations */
};
@@ -553,7 +553,7 @@ fdattach(struct device *parent, struct device *self, void *aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -665,7 +665,7 @@ fdstrategy(struct buf *bp /* IO operation to perform */)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -714,11 +714,11 @@ fdfinish(struct fd_softc *fd, struct buf *bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL) {
+ if (BUFQ_PEEK(fd->sc_q) != NULL) {
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
} else
fd->sc_active = 0;
@@ -991,7 +991,7 @@ fdctimeout(void *arg)
s = splbio();
fdcstatus(&fd->sc_dv, 0, "timeout");
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -1139,7 +1139,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1488,7 +1488,7 @@ fdcretry(struct fdc_softc *fdc)
struct buf *bp;
fd = fdc->sc_drives.tqh_first;
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(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 1364f414312..8b7fff39d7d 100644
--- a/sys/arch/sun3/dev/xd.c
+++ b/sys/arch/sun3/dev/xd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.49 2005/06/03 15:07:12 tsutsui Exp $ */
+/* $NetBSD: xd.c,v 1.50 2005/10/15 17:29:11 yamt Exp $ */
/*
*
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.49 2005/06/03 15:07:12 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.50 2005/10/15 17:29:11 yamt Exp $");
#undef XDC_DEBUG /* full debug */
#define XDC_DIAG /* extra sanity checks */
@@ -446,7 +446,7 @@ xdcattach(struct device *parent, struct device *self, void *aux)
/* init queue of waiting bufs */
- bufq_alloc(&xdc->sc_wq, BUFQ_FCFS);
+ bufq_alloc(&xdc->sc_wq, "fcfs", 0);
callout_init(&xdc->sc_tick_ch);
/*
@@ -1047,7 +1047,7 @@ xdstrategy(struct buf *bp)
/* first, give jobs in front of us a chance */
parent = xd->parent;
- while (parent->nfree > 0 && BUFQ_PEEK(&parent->sc_wq) != NULL)
+ while (parent->nfree > 0 && BUFQ_PEEK(parent->sc_wq) != NULL)
if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1056,7 +1056,7 @@ xdstrategy(struct buf *bp)
* buffs will get picked up later by xdcintr().
*/
if (parent->nfree == 0) {
- BUFQ_PUT(&parent->sc_wq, bp);
+ BUFQ_PUT(parent->sc_wq, bp);
splx(s);
return;
}
@@ -1102,7 +1102,7 @@ xdcintr(void *v)
xdc_start(xdcsc, XDC_MAXIOPB);
/* fill up any remaining iorq's with queue'd buffers */
- while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(xdcsc->sc_wq) != NULL)
if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1326,7 +1326,7 @@ xdc_startbuf(struct xdc_softc *xdcsc, struct xd_softc *xdsc, struct buf *bp)
/* get buf */
if (bp == NULL) {
- bp = BUFQ_GET(&xdcsc->sc_wq);
+ bp = BUFQ_GET(xdcsc->sc_wq);
if (bp == NULL)
panic("xdc_startbuf bp");
xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)];
@@ -1369,7 +1369,7 @@ xdc_startbuf(struct xdc_softc *xdcsc, struct xd_softc *xdsc, struct buf *bp)
printf("%s: warning: out of DVMA space\n",
xdcsc->sc_dev.dv_xname);
XDC_FREE(xdcsc, rqno);
- BUFQ_PUT(&xdcsc->sc_wq, bp);
+ BUFQ_PUT(xdcsc->sc_wq, bp);
return (XD_ERR_FAIL); /* XXX: need some sort of
* call-back scheme here? */
}
@@ -1561,7 +1561,7 @@ xdc_piodriver(struct xdc_softc *xdcsc, int iorqno, int freeone)
/* now that we've drained everything, start up any bufs that have
* queued */
- while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(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 fa6da14e23f..6cc150b3f2b 100644
--- a/sys/arch/sun3/dev/xdvar.h
+++ b/sys/arch/sun3/dev/xdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: xdvar.h,v 1.8 2002/07/23 20:49:54 hannken Exp $ */
+/* $NetBSD: xdvar.h,v 1.9 2005/10/15 17:29:11 yamt Exp $ */
/*
*
@@ -153,7 +153,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 bufq_state sc_wq; /* queue'd IOPBs for this controller */
+ struct bufq_state *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 c0a1300a76e..f224d0278bb 100644
--- a/sys/arch/sun3/dev/xy.c
+++ b/sys/arch/sun3/dev/xy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xy.c,v 1.51 2005/06/03 15:04:21 tsutsui Exp $ */
+/* $NetBSD: xy.c,v 1.52 2005/10/15 17:29:11 yamt Exp $ */
/*
*
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.51 2005/06/03 15:04:21 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.52 2005/10/15 17:29:11 yamt Exp $");
#undef XYC_DEBUG /* full debug */
#undef XYC_DIAG /* extra sanity checks */
@@ -504,7 +504,7 @@ xyattach(struct device *parent, struct device *self, void *aux)
xy->parent = xyc;
/* init queue of waiting bufs */
- bufq_alloc(&xy->xyq, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&xy->xyq, "disksort", BUFQ_SORT_RAWBLOCK);
xy->xyrq = &xyc->reqs[xa->driveno];
xy->xy_drive = xa->driveno;
@@ -1008,7 +1008,7 @@ xystrategy(struct buf *bp)
s = splbio(); /* protect the queues */
- BUFQ_PUT(&xy->xyq, bp); /* XXX disksort_cylinder */
+ BUFQ_PUT(xy->xyq, bp); /* XXX disksort_cylinder */
/* start 'em up */
@@ -1578,7 +1578,7 @@ xyc_reset(struct xyc_softc *xycsc, int quiet, struct xy_iorq *blastmode,
/* Sun3: map/unmap regardless of B_PHYS */
dvma_mapout(iorq->dbufbase,
iorq->buf->b_bcount);
- (void)BUFQ_GET(&iorq->xy->xyq);
+ (void)BUFQ_GET(iorq->xy->xyq);
disk_unbusy(&iorq->xy->sc_dk,
(iorq->buf->b_bcount - iorq->buf->b_resid),
(iorq->buf->b_flags & B_READ));
@@ -1621,9 +1621,9 @@ xyc_start(struct xyc_softc *xycsc, struct xy_iorq *iorq)
if (iorq == NULL) {
for (lcv = 0; lcv < XYC_MAXDEV ; lcv++) {
if ((xy = xycsc->sc_drives[lcv]) == NULL) continue;
- if (BUFQ_PEEK(&xy->xyq) == NULL) continue;
+ if (BUFQ_PEEK(xy->xyq) == NULL) continue;
if (xy->xyrq->mode != XY_SUB_FREE) continue;
- xyc_startbuf(xycsc, xy, BUFQ_PEEK(&xy->xyq));
+ xyc_startbuf(xycsc, xy, BUFQ_PEEK(xy->xyq));
}
}
xyc_submit_iorq(xycsc, iorq, XY_SUB_NOQ);
@@ -1751,7 +1751,7 @@ xyc_remove_iorq(struct xyc_softc *xycsc)
/* Sun3: map/unmap regardless of B_PHYS */
dvma_mapout(iorq->dbufbase,
iorq->buf->b_bcount);
- (void)BUFQ_GET(&iorq->xy->xyq);
+ (void)BUFQ_GET(iorq->xy->xyq);
disk_unbusy(&iorq->xy->sc_dk,
(bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ));
diff --git a/sys/arch/sun3/dev/xyvar.h b/sys/arch/sun3/dev/xyvar.h
index e99a52f3b96..77dc65410d7 100644
--- a/sys/arch/sun3/dev/xyvar.h
+++ b/sys/arch/sun3/dev/xyvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: xyvar.h,v 1.7 2002/07/23 20:49:55 hannken Exp $ */
+/* $NetBSD: xyvar.h,v 1.8 2005/10/15 17:29:11 yamt Exp $ */
/*
*
@@ -116,7 +116,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 bufq_state xyq; /* queue'd I/O requests */
+ struct bufq_state *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 4e091c96279..70645e63e86 100644
--- a/sys/arch/vax/mba/hp.c
+++ b/sys/arch/vax/mba/hp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hp.c,v 1.37 2004/10/28 07:07:38 yamt Exp $ */
+/* $NetBSD: hp.c,v 1.38 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hp.c,v 1.37 2004/10/28 07:07:38 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hp.c,v 1.38 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -150,7 +150,7 @@ hpattach(struct device *parent, struct device *self, void *aux)
/*
* Init the common struct for both the adapter and its slaves.
*/
- bufq_alloc(&sc->sc_md.md_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&sc->sc_md.md_q, "disksort", BUFQ_SORT_CYLINDER);
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 */
@@ -207,8 +207,8 @@ hpstrategy(struct buf *bp)
s = splbio();
- gp = BUFQ_PEEK(&sc->sc_md.md_q);
- BUFQ_PUT(&sc->sc_md.md_q, bp);
+ gp = BUFQ_PEEK(sc->sc_md.md_q);
+ BUFQ_PUT(sc->sc_md.md_q, bp);
if (gp == 0)
mbaqueue(&sc->sc_md);
@@ -228,7 +228,7 @@ hpstart(struct mba_device *md)
{
struct hp_softc *sc = md->md_softc;
struct disklabel *lp = sc->sc_disk.dk_label;
- struct buf *bp = BUFQ_PEEK(&md->md_q);
+ struct buf *bp = BUFQ_PEEK(md->md_q);
unsigned bn, cn, sn, tn;
/*
@@ -366,7 +366,7 @@ enum xfer_action
hpfinish(struct mba_device *md, int mbasr, int *attn)
{
struct hp_softc *sc = md->md_softc;
- struct buf *bp = BUFQ_PEEK(&md->md_q);
+ struct buf *bp = BUFQ_PEEK(md->md_q);
int er1, er2, bc;
unsigned byte;
@@ -405,8 +405,8 @@ hper2:
printf("massbuss error :%s %x\n",
sc->sc_dev.dv_xname, mbasr);
- BUFQ_PEEK(&md->md_q)->b_resid = 0;
- disk_unbusy(&sc->sc_disk, BUFQ_PEEK(&md->md_q)->b_bcount,
+ BUFQ_PEEK(md->md_q)->b_resid = 0;
+ disk_unbusy(&sc->sc_disk, BUFQ_PEEK(md->md_q)->b_bcount,
(bp->b_flags & B_READ));
return XFER_FINISH;
}
diff --git a/sys/arch/vax/mba/mba.c b/sys/arch/vax/mba/mba.c
index a0241cc9f6a..ac8ac6c9490 100644
--- a/sys/arch/vax/mba/mba.c
+++ b/sys/arch/vax/mba/mba.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mba.c,v 1.33 2004/10/31 12:52:55 he Exp $ */
+/* $NetBSD: mba.c,v 1.34 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mba.c,v 1.33 2004/10/31 12:52:55 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mba.c,v 1.34 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -188,7 +188,7 @@ mbaintr(void *mba)
return; /* During autoconfig */
md = sc->sc_first;
- bp = BUFQ_PEEK(&md->md_q);
+ bp = BUFQ_PEEK(md->md_q);
/*
* A data-transfer interrupt. Current operation is finished,
* call that device's finish routine to see what to do next.
@@ -205,13 +205,13 @@ mbaintr(void *mba)
* If more to transfer, start the adapter again
* by calling mbastart().
*/
- (void)BUFQ_GET(&md->md_q);
+ (void)BUFQ_GET(md->md_q);
sc->sc_first = md->md_back;
md->md_back = 0;
if (sc->sc_first == 0)
sc->sc_last = (void *)&sc->sc_first;
- if (BUFQ_PEEK(&md->md_q) != NULL) {
+ if (BUFQ_PEEK(md->md_q) != NULL) {
sc->sc_last->md_back = md;
sc->sc_last = md;
}
@@ -281,7 +281,7 @@ void
mbastart(struct mba_softc *sc)
{
struct mba_device *md = sc->sc_first;
- struct buf *bp = BUFQ_PEEK(&md->md_q);
+ struct buf *bp = BUFQ_PEEK(md->md_q);
disk_reallymapin(bp, (void *)(sc->sc_ioh + MAPREG(0)), 0, PG_V);
diff --git a/sys/arch/vax/mba/mbavar.h b/sys/arch/vax/mba/mbavar.h
index 44e07168c0f..6797f670f33 100644
--- a/sys/arch/vax/mba/mbavar.h
+++ b/sys/arch/vax/mba/mbavar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mbavar.h,v 1.9 2005/06/03 12:55:44 ragge Exp $ */
+/* $NetBSD: mbavar.h,v 1.10 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
* All rights reserved.
@@ -100,7 +100,7 @@ struct mba_device {
enum xfer_action (*md_finish)(struct mba_device *, int, int *);
void *md_softc; /* Backpointer to this units softc. */
struct mba_softc *md_mba;
- struct bufq_state md_q; /* queue of I/O requests */
+ struct bufq_state *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 c7ef161ddda..e9e196ba3d5 100644
--- a/sys/arch/vax/vax/ctu.c
+++ b/sys/arch/vax/vax/ctu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ctu.c,v 1.21 2004/10/28 07:07:39 yamt Exp $ */
+/* $NetBSD: ctu.c,v 1.22 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ctu.c,v 1.21 2004/10/28 07:07:39 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ctu.c,v 1.22 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -79,7 +79,7 @@ struct tu_softc {
int sc_wto; /* Timeout counter */
int sc_xbytes; /* Number of xfer'd bytes */
int sc_op; /* Read/write */
- struct bufq_state sc_bufq; /* pending I/O requests */
+ struct bufq_state *sc_bufq; /* pending I/O requests */
} tu_sc;
struct ivec_dsp tu_recv, tu_xmit;
@@ -115,7 +115,7 @@ static struct callout ctu_watch_ch = CALLOUT_INITIALIZER;
void
ctuattach()
{
- bufq_alloc(&tu_sc.sc_bufq, BUFQ_FCFS);
+ bufq_alloc(&tu_sc.sc_bufq, "fcfs", 0);
tu_recv = idsptch;
tu_recv.hoppaddr = cturintr;
@@ -178,7 +178,7 @@ ctuclose(dev_t dev, int oflags, int devtype, struct proc *p)
{
struct buf *bp;
int s = spl7();
- while ((bp = BUFQ_GET(&tu_sc.sc_bufq)))
+ while ((bp = BUFQ_GET(tu_sc.sc_bufq)))
;
splx(s);
@@ -206,8 +206,8 @@ ctustrategy(struct buf *bp)
return;
}
- empty = (BUFQ_PEEK(&tu_sc.sc_bufq) == NULL);
- BUFQ_PUT(&tu_sc.sc_bufq, bp);
+ empty = (BUFQ_PEEK(tu_sc.sc_bufq) == NULL);
+ BUFQ_PUT(tu_sc.sc_bufq, bp);
if (empty)
ctustart();
splx(s);
@@ -219,7 +219,7 @@ ctustart()
struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp;
struct buf *bp;
- bp = BUFQ_PEEK(&tu_sc.sc_bufq);
+ bp = BUFQ_PEEK(tu_sc.sc_bufq);
if (bp == NULL)
return;
#ifdef TUDEBUG
@@ -270,7 +270,7 @@ cturintr(void *arg)
int i, c, tck;
unsigned short ck = 0;
- bp = BUFQ_PEEK(&tu_sc.sc_bufq);
+ bp = BUFQ_PEEK(tu_sc.sc_bufq);
switch (tu_sc.sc_state) {
case TU_RESET:
if (status != RSP_TYP_CONTINUE)
@@ -389,7 +389,7 @@ cturintr(void *arg)
return;
}
if ((bp->b_flags & B_ERROR) == 0) {
- (void)BUFQ_GET(&tu_sc.sc_bufq);
+ (void)BUFQ_GET(tu_sc.sc_bufq);
biodone(bp);
#ifdef TUDEBUG
printf("biodone %p\n", bp);
diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c
index 01251920cc2..075fa105c9c 100644
--- a/sys/arch/vax/vsa/hdc9224.c
+++ b/sys/arch/vax/vsa/hdc9224.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hdc9224.c,v 1.31 2004/10/28 07:07:39 yamt Exp $ */
+/* $NetBSD: hdc9224.c,v 1.32 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -51,7 +51,7 @@
#undef RDDEBUG
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdc9224.c,v 1.31 2004/10/28 07:07:39 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdc9224.c,v 1.32 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -143,7 +143,7 @@ struct hdcsoftc {
struct evcnt sc_intrcnt;
struct vsbus_dma sc_vd;
vaddr_t sc_regs; /* register addresses */
- struct bufq_state sc_q;
+ struct bufq_state *sc_q;
struct buf *sc_active;
struct hdc9224_UDCreg sc_creg; /* (command) registers to be written */
struct hdc9224_UDCreg sc_sreg; /* (status) registers being read */
@@ -302,7 +302,7 @@ hdcattach(struct device *parent, struct device *self, void *aux)
sc->sc_dev.dv_xname, status);
return;
}
- bufq_alloc(&sc->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&sc->sc_q, "disksort", BUFQ_SORT_CYLINDER);
/*
* now probe for all possible hard drives
@@ -459,7 +459,7 @@ rdstrategy(struct buf *bp)
bp->b_cylinder = bp->b_rawblkno / lp->d_secpercyl;
s = splbio();
- BUFQ_PUT(&sc->sc_q, bp);
+ BUFQ_PUT(sc->sc_q, bp);
if (inq == 0) {
inq = 1;
vsbus_dma_start(&sc->sc_vd);
@@ -478,7 +478,7 @@ hdc_qstart(void *arg)
inq = 0;
hdcstart(sc, 0);
- if (BUFQ_PEEK(&sc->sc_q)) {
+ if (BUFQ_PEEK(sc->sc_q)) {
vsbus_dma_start(&sc->sc_vd); /* More to go */
inq = 1;
}
@@ -499,7 +499,7 @@ hdcstart(struct hdcsoftc *sc, struct buf *ob)
if (ob == 0) {
- bp = BUFQ_GET(&sc->sc_q);
+ bp = BUFQ_GET(sc->sc_q);
if (bp == NULL)
return; /* Nothing to do */
sc->sc_bufaddr = bp->b_data;
diff --git a/sys/arch/x68k/dev/fd.c b/sys/arch/x68k/dev/fd.c
index af45a555dbe..17f01fa9016 100644
--- a/sys/arch/x68k/dev/fd.c
+++ b/sys/arch/x68k/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.64 2005/06/12 23:43:49 he Exp $ */
+/* $NetBSD: fd.c,v 1.65 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.64 2005/06/12 23:43:49 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.65 2005/10/15 17:29:11 yamt Exp $");
#include "rnd.h"
#include "opt_ddb.h"
@@ -241,7 +241,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *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 */
@@ -583,7 +583,7 @@ fdattach(struct device *parent, struct device *self, void *aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -675,7 +675,7 @@ fdstrategy(struct buf *bp)
bp->b_blkno, bp->b_bcount, bp->b_cylinder));
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -724,11 +724,11 @@ fdfinish(struct fd_softc *fd, struct buf *bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (fd->sc_drivechain.tqe_next && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL) {
+ if (BUFQ_PEEK(fd->sc_q) != NULL) {
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
} else
fd->sc_active = 0;
@@ -992,7 +992,7 @@ fdctimeout(void *arg)
s = splbio();
fdcstatus(&fd->sc_dev, 0, "timeout");
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -1048,7 +1048,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1463,7 +1463,7 @@ fdcretry(struct fdc_softc *fdc)
DPRINTF(("fdcretry:\n"));
fd = fdc->sc_drives.tqh_first;
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
switch (fdc->sc_errors) {
case 0:
diff --git a/sys/arch/xen/xen/xbd.c b/sys/arch/xen/xen/xbd.c
index b077a1f77d7..10c80d6ef07 100644
--- a/sys/arch/xen/xen/xbd.c
+++ b/sys/arch/xen/xen/xbd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xbd.c,v 1.22 2005/08/21 22:20:28 bouyer Exp $ */
+/* $NetBSD: xbd.c,v 1.23 2005/10/15 17:29:11 yamt Exp $ */
/*
*
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.22 2005/08/21 22:20:28 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.23 2005/10/15 17:29:11 yamt Exp $");
#include "xbd.h"
#include "rnd.h"
@@ -312,7 +312,7 @@ static SIMPLEQ_HEAD(, xbdreq) xbdr_suspended =
SLIST_INSERT_HEAD(&xbdreqs, _xr, xr_unused); \
} while (/*CONSTCOND*/0)
-static struct bufq_state bufq;
+static struct bufq_state *bufq;
static int bufq_users = 0;
#define XEN_MAJOR(_dev) ((_dev) >> 8)
@@ -1387,7 +1387,7 @@ xbdstart(struct dk_softc *dksc, struct buf *bp)
xr_suspended);
DPRINTF(XBDB_IO, ("xbdstart: suspended xbdreq %p "
"for bp %p\n", pxr, bp));
- } else if (CANGET_XBDREQ() && BUFQ_PEEK(&bufq) != NULL) {
+ } else if (CANGET_XBDREQ() && BUFQ_PEEK(bufq) != NULL) {
/*
* We have enough resources to start another bp and
* there are additional bps on the queue, dk_start
@@ -1606,16 +1606,14 @@ xbdinit(struct xbd_softc *xs, vdisk_t *xd, struct dk_intf *dkintf)
* available in xbdstart and this device had no requests
* in-flight which would trigger a dk_start from the interrupt
* handler.
- * XXX this assumes that we can just memcpy struct bufq_state
- * to share it between devices.
* XXX we reference count the usage in case so we can de-alloc
* the bufq if all devices are deconfigured.
*/
if (bufq_users == 0) {
- bufq_alloc(&bufq, BUFQ_FCFS);
+ bufq_alloc(&bufq, "fcfs", 0);
bufq_users = 1;
}
- memcpy(&xs->sc_dksc.sc_bufq, &bufq, sizeof(struct bufq_state));
+ xs->sc_dksc.sc_bufq = bufq;
xs->sc_dksc.sc_flags |= DKF_INITED;
diff --git a/sys/conf/files b/sys/conf/files
index 5f5b170e502..e1bfd05192f 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.735 2005/10/05 14:16:46 cube Exp $
+# $NetBSD: files,v 1.736 2005/10/15 17:29:11 yamt Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -1253,6 +1253,7 @@ file kern/kern_xxx.c
file kern/kgdb_stub.c kgdb
file kern/subr_autoconf.c
file kern/subr_blist.c vmswap
+file kern/subr_bufq.c
file kern/subr_devsw.c
file kern/subr_disk.c
file kern/subr_evcnt.c
diff --git a/sys/ddb/db_xxx.c b/sys/ddb/db_xxx.c
index 4e707be2fc4..1839233ca49 100644
--- a/sys/ddb/db_xxx.c
+++ b/sys/ddb/db_xxx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_xxx.c,v 1.31 2005/06/01 12:25:27 drochner Exp $ */
+/* $NetBSD: db_xxx.c,v 1.32 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -39,7 +39,7 @@
#include "opt_kgdb.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.31 2005/06/01 12:25:27 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.32 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -298,8 +298,10 @@ db_show_sched_qs(db_expr_t addr, int haddr, db_expr_t count, const char *modif)
? ' ' : '!', i);
first = 0;
}
- db_printf("\t%d.%d (%s)\n", l->l_proc->p_pid,
- l->l_lid, l->l_proc->p_comm);
+ db_printf("\t%d.%d (%s) pri=%d usrpri=%d\n",
+ l->l_proc->p_pid,
+ l->l_lid, l->l_proc->p_comm,
+ (int)l->l_priority, (int)l->l_usrpri);
}
}
}
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index cae5552c6ed..4c088dccb55 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wd.c,v 1.311 2005/09/05 22:55:31 riz Exp $ */
+/* $NetBSD: wd.c,v 1.312 2005/10/15 17:29:12 yamt Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.311 2005/09/05 22:55:31 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.312 2005/10/15 17:29:12 yamt Exp $");
#ifndef ATADEBUG
#define ATADEBUG
@@ -294,7 +294,7 @@ wdattach(struct device *parent, struct device *self, void *aux)
ATADEBUG_PRINT(("wdattach\n"), DEBUG_FUNCS | DEBUG_PROBE);
callout_init(&wd->sc_restart_ch);
- bufq_alloc(&wd->sc_q, BUFQ_DISK_DEFAULT_STRAT()|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&wd->sc_q, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);
#ifdef WD_SOFTBADSECT
SLIST_INIT(&wd->sc_bslist);
#endif
@@ -452,9 +452,9 @@ wddetach(struct device *self, int flags)
s = splbio();
/* Kill off any queued buffers. */
- bufq_drain(&sc->sc_q);
+ bufq_drain(sc->sc_q);
- bufq_free(&sc->sc_q);
+ bufq_free(sc->sc_q);
sc->atabus->ata_killpending(sc->drvp);
splx(s);
@@ -571,7 +571,7 @@ wdstrategy(struct buf *bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&wd->sc_q, bp);
+ BUFQ_PUT(wd->sc_q, bp);
wdstart(wd);
splx(s);
return;
@@ -597,7 +597,7 @@ wdstart(void *arg)
while (wd->openings > 0) {
/* Is there a buf for us ? */
- if ((bp = BUFQ_GET(&wd->sc_q)) == NULL)
+ if ((bp = BUFQ_GET(wd->sc_q)) == NULL)
return;
/*
diff --git a/sys/dev/ata/wdvar.h b/sys/dev/ata/wdvar.h
index b3e530e3bcf..5d4a4b9e5ee 100644
--- a/sys/dev/ata/wdvar.h
+++ b/sys/dev/ata/wdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: wdvar.h,v 1.30 2005/07/25 12:52:44 drochner Exp $ */
+/* $NetBSD: wdvar.h,v 1.31 2005/10/15 17:29:12 yamt Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -40,7 +40,7 @@ struct wd_softc {
/* General disk infos */
struct device sc_dev;
struct disk sc_dk;
- struct bufq_state sc_q;
+ struct bufq_state *sc_q;
struct callout sc_restart_ch;
int sc_quirks; /* any quirks drive might have */
/* IDE disk soft states */
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index b131a9f4e16..a1eb7c98918 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.105 2005/08/20 12:01:04 yamt Exp $ */
+/* $NetBSD: ccd.c,v 1.106 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.105 2005/08/20 12:01:04 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.106 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -692,7 +692,7 @@ ccdstrategy(struct buf *bp)
/* Place it in the queue and start I/O on the unit. */
s = splbio();
- BUFQ_PUT(&cs->sc_bufq, bp);
+ BUFQ_PUT(cs->sc_bufq, bp);
ccdstart(cs);
splx(s);
return;
@@ -718,7 +718,7 @@ ccdstart(struct ccd_softc *cs)
#endif
/* See if there is work for us to do. */
- while ((bp = BUFQ_PEEK(&cs->sc_bufq)) != NULL) {
+ while ((bp = BUFQ_PEEK(cs->sc_bufq)) != NULL) {
/* Instrumentation. */
disk_busy(&cs->sc_dkdev);
@@ -754,7 +754,7 @@ ccdstart(struct ccd_softc *cs)
}
/* Transfer all set up, remove job from the queue. */
- (void) BUFQ_GET(&cs->sc_bufq);
+ (void) BUFQ_GET(cs->sc_bufq);
/* Now fire off the requests. */
while ((cbp = SIMPLEQ_FIRST(&cbufq)) != NULL) {
@@ -1129,7 +1129,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
ccio->ccio_unit = unit;
ccio->ccio_size = cs->sc_size;
- bufq_alloc(&cs->sc_bufq, BUFQ_FCFS);
+ bufq_alloc(&cs->sc_bufq, "fcfs", 0);
/* Attach the disk. */
pseudo_disk_attach(&cs->sc_dkdev);
@@ -1155,10 +1155,10 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
/* Kill off any queued buffers. */
s = splbio();
- bufq_drain(&cs->sc_bufq);
+ bufq_drain(cs->sc_bufq);
splx(s);
- bufq_free(&cs->sc_bufq);
+ bufq_free(cs->sc_bufq);
/*
* Free ccd_softc information and clear entry.
diff --git a/sys/dev/ccdvar.h b/sys/dev/ccdvar.h
index bf31060761e..f83dd3790c3 100644
--- a/sys/dev/ccdvar.h
+++ b/sys/dev/ccdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ccdvar.h,v 1.26 2004/10/28 06:59:18 yamt Exp $ */
+/* $NetBSD: ccdvar.h,v 1.27 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -214,7 +214,7 @@ struct ccd_softc {
struct disk sc_dkdev; /* generic disk device info */
struct lock sc_lock; /* lock on this structure */
#if defined(_KERNEL) /* XXX ccdconfig(8) refers softc directly using kvm */
- struct bufq_state sc_bufq; /* buffer queue */
+ struct bufq_state *sc_bufq; /* buffer queue */
#endif
};
diff --git a/sys/dev/cgd.c b/sys/dev/cgd.c
index f9fc25461d1..8b6a269c67f 100644
--- a/sys/dev/cgd.c
+++ b/sys/dev/cgd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.29 2005/08/20 12:03:52 yamt Exp $ */
+/* $NetBSD: cgd.c,v 1.30 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.29 2005/08/20 12:03:52 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.30 2005/10/15 17:29:11 yamt Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -568,7 +568,7 @@ cgd_ioctl_set(struct cgd_softc *cs, void *data, struct proc *p)
goto bail;
}
- bufq_alloc(&cs->sc_dksc.sc_bufq, BUFQ_FCFS);
+ bufq_alloc(&cs->sc_dksc.sc_bufq, "fcfs", 0);
cs->sc_data = malloc(MAXPHYS, M_DEVBUF, M_WAITOK);
cs->sc_data_used = 0;
@@ -602,9 +602,9 @@ cgd_ioctl_clr(struct cgd_softc *cs, void *data, struct proc *p)
/* Kill off any queued buffers. */
s = splbio();
- bufq_drain(&cs->sc_dksc.sc_bufq);
+ bufq_drain(cs->sc_dksc.sc_bufq);
splx(s);
- bufq_free(&cs->sc_dksc.sc_bufq);
+ bufq_free(cs->sc_dksc.sc_bufq);
(void)vn_close(cs->sc_tvn, FREAD|FWRITE, p->p_ucred, p);
cs->sc_cfuncs->cf_destroy(cs->sc_cdata.cf_priv);
diff --git a/sys/dev/dksubr.c b/sys/dev/dksubr.c
index 73216912403..923d33a0c27 100644
--- a/sys/dev/dksubr.c
+++ b/sys/dev/dksubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.16 2005/08/20 12:03:52 yamt Exp $ */
+/* $NetBSD: dksubr.c,v 1.17 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.16 2005/08/20 12:03:52 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.17 2005/10/15 17:29:11 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -222,7 +222,7 @@ dk_strategy(struct dk_intf *di, struct dk_softc *dksc, struct buf *bp)
* provided by the individual driver.
*/
s = splbio();
- BUFQ_PUT(&dksc->sc_bufq, bp);
+ BUFQ_PUT(dksc->sc_bufq, bp);
dk_start(di, dksc);
splx(s);
return;
@@ -236,9 +236,9 @@ dk_start(struct dk_intf *di, struct dk_softc *dksc)
DPRINTF_FOLLOW(("dk_start(%s, %p)\n", di->di_dkname, dksc));
/* Process the work queue */
- while ((bp = BUFQ_GET(&dksc->sc_bufq)) != NULL) {
+ while ((bp = BUFQ_GET(dksc->sc_bufq)) != NULL) {
if (di->di_diskstart(dksc, bp) != 0) {
- BUFQ_PUT(&dksc->sc_bufq, bp);
+ BUFQ_PUT(dksc->sc_bufq, bp);
break;
}
}
diff --git a/sys/dev/dkvar.h b/sys/dev/dkvar.h
index bc24764bcec..9950eb840d1 100644
--- a/sys/dev/dkvar.h
+++ b/sys/dev/dkvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: dkvar.h,v 1.7 2005/08/20 12:03:52 yamt Exp $ */
+/* $NetBSD: dkvar.h,v 1.8 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@ struct dk_softc {
#define DK_XNAME_SIZE 8
char sc_xname[DK_XNAME_SIZE]; /* external name */
struct disk sc_dkdev; /* generic disk info */
- struct bufq_state sc_bufq; /* buffer queue */
+ struct bufq_state *sc_bufq; /* buffer queue */
};
/* sc_flags:
diff --git a/sys/dev/dkwedge/dk.c b/sys/dev/dkwedge/dk.c
index c7208c12ab1..d29674ad988 100644
--- a/sys/dev/dkwedge/dk.c
+++ b/sys/dev/dkwedge/dk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.8 2005/09/28 18:25:19 nathanw Exp $ */
+/* $NetBSD: dk.c,v 1.9 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.8 2005/09/28 18:25:19 nathanw Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.9 2005/10/15 17:29:12 yamt Exp $");
#include "opt_dkwedge.h"
@@ -88,7 +88,7 @@ struct dkwedge_softc {
LIST_ENTRY(dkwedge_softc) sc_plink;
struct disk sc_dk; /* our own disk structure */
- struct bufq_state sc_bufq; /* buffer queue */
+ struct bufq_state *sc_bufq; /* buffer queue */
struct callout sc_restart_ch; /* callout to restart I/O */
u_int sc_iopend; /* I/Os pending */
@@ -301,7 +301,7 @@ dkwedge_add(struct dkwedge_info *dkw)
memcpy(sc->sc_ptype, dkw->dkw_ptype, sizeof(sc->sc_ptype));
sc->sc_ptype[sizeof(sc->sc_ptype) - 1] = '\0';
- bufq_alloc(&sc->sc_bufq, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_bufq, "fcfs", 0);
callout_init(&sc->sc_restart_ch);
callout_setfunc(&sc->sc_restart_ch, dkrestart, sc);
@@ -339,7 +339,7 @@ dkwedge_add(struct dkwedge_info *dkw)
}
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
if (error) {
- bufq_free(&sc->sc_bufq);
+ bufq_free(sc->sc_bufq);
free(sc, M_DKWEDGE);
return (error);
}
@@ -392,7 +392,7 @@ dkwedge_add(struct dkwedge_info *dkw)
LIST_REMOVE(sc, sc_plink);
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
- bufq_free(&sc->sc_bufq);
+ bufq_free(sc->sc_bufq);
free(sc, M_DKWEDGE);
return (error);
}
@@ -419,7 +419,7 @@ dkwedge_add(struct dkwedge_info *dkw)
LIST_REMOVE(sc, sc_plink);
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
- bufq_free(&sc->sc_bufq);
+ bufq_free(sc->sc_bufq);
free(sc, M_DKWEDGE);
return (ENOMEM);
}
@@ -532,7 +532,7 @@ dkwedge_del(struct dkwedge_info *dkw)
(void) lockmgr(&sc->sc_parent->dk_openlock, LK_RELEASE, NULL);
/* Delete our buffer queue. */
- bufq_free(&sc->sc_bufq);
+ bufq_free(sc->sc_bufq);
/* Detach from the disk list. */
disk_detach(&sc->sc_dk);
@@ -997,7 +997,7 @@ dkstrategy(struct buf *bp)
/* Place it in the queue and start I/O on the unit. */
s = splbio();
sc->sc_iopend++;
- BUFQ_PUT(&sc->sc_bufq, bp);
+ BUFQ_PUT(sc->sc_bufq, bp);
dkstart(sc);
splx(s);
return;
@@ -1019,9 +1019,9 @@ dkstart(struct dkwedge_softc *sc)
struct buf *bp, *nbp;
/* Do as much work as has been enqueued. */
- while ((bp = BUFQ_PEEK(&sc->sc_bufq)) != NULL) {
+ while ((bp = BUFQ_PEEK(sc->sc_bufq)) != NULL) {
if (sc->sc_state != DKW_STATE_RUNNING) {
- (void) BUFQ_GET(&sc->sc_bufq);
+ (void) BUFQ_GET(sc->sc_bufq);
if (sc->sc_iopend-- == 1 &&
(sc->sc_flags & DK_F_WAIT_DRAIN) != 0) {
sc->sc_flags &= ~DK_F_WAIT_DRAIN;
@@ -1048,7 +1048,7 @@ dkstart(struct dkwedge_softc *sc)
return;
}
- (void) BUFQ_GET(&sc->sc_bufq);
+ (void) BUFQ_GET(sc->sc_bufq);
BUF_INIT(nbp);
nbp->b_data = bp->b_data;
diff --git a/sys/dev/fss.c b/sys/dev/fss.c
index 1ec9a93c4ce..10978534e2a 100644
--- a/sys/dev/fss.c
+++ b/sys/dev/fss.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fss.c,v 1.15 2005/04/17 16:28:26 hannken Exp $ */
+/* $NetBSD: fss.c,v 1.16 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.15 2005/04/17 16:28:26 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.16 2005/10/15 17:29:11 yamt Exp $");
#include "fss.h"
@@ -165,7 +165,7 @@ fssattach(int num)
sc->sc_unit = i;
sc->sc_bdev = NODEV;
simple_lock_init(&sc->sc_slock);
- bufq_alloc(&sc->sc_bufq, BUFQ_FCFS|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sc->sc_bufq, "fcfs", 0);
}
}
@@ -244,7 +244,7 @@ fss_strategy(struct buf *bp)
}
bp->b_rawblkno = bp->b_blkno;
- BUFQ_PUT(&sc->sc_bufq, bp);
+ BUFQ_PUT(sc->sc_bufq, bp);
wakeup(&sc->sc_bs_proc);
FSS_UNLOCK(sc, s);
@@ -1283,7 +1283,7 @@ fss_bs_thread(void *arg)
if (sc->sc_flags & FSS_PERSISTENT) {
nfreed = nio = 0;
- if ((bp = BUFQ_GET(&sc->sc_bufq)) == NULL)
+ if ((bp = BUFQ_GET(sc->sc_bufq)) == NULL)
continue;
nio++;
@@ -1346,7 +1346,7 @@ fss_bs_thread(void *arg)
*/
nio = 0;
- if ((bp = BUFQ_GET(&sc->sc_bufq)) == NULL)
+ if ((bp = BUFQ_GET(sc->sc_bufq)) == NULL)
continue;
nio++;
diff --git a/sys/dev/fssvar.h b/sys/dev/fssvar.h
index 162c3760f72..fc156b343d8 100644
--- a/sys/dev/fssvar.h
+++ b/sys/dev/fssvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fssvar.h,v 1.9 2005/04/17 16:28:26 hannken Exp $ */
+/* $NetBSD: fssvar.h,v 1.10 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@ struct fss_softc {
long sc_clresid; /* Bytes in last cluster */
int sc_cache_size; /* Number of entries in sc_cache */
struct fss_cache *sc_cache; /* Cluster cache */
- struct bufq_state sc_bufq; /* Transfer queue */
+ struct bufq_state *sc_bufq; /* Transfer queue */
u_int32_t sc_clnext; /* Next free cluster on backing store */
int sc_indir_size; /* # clusters for indirect mapping */
u_int8_t *sc_indir_valid; /* Map of valid indirect clusters */
diff --git a/sys/dev/gpib/ct.c b/sys/dev/gpib/ct.c
index 4f9d94318c5..5d9b44fda06 100644
--- a/sys/dev/gpib/ct.c
+++ b/sys/dev/gpib/ct.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ct.c,v 1.4 2005/02/27 00:26:59 perry Exp $ */
+/* $NetBSD: ct.c,v 1.5 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -128,7 +128,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.4 2005/02/27 00:26:59 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.5 2005/10/15 17:29:12 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -172,7 +172,7 @@ struct ct_softc {
struct ct_iocmd sc_ioc;
struct ct_rscmd sc_rsc;
struct cs80_stat sc_stat;
- struct bufq_state sc_tab;
+ struct bufq_state *sc_tab;
int sc_active;
struct buf *sc_bp;
struct buf sc_bufstore; /* XXX */
@@ -365,7 +365,7 @@ ctattach(parent, self, aux)
printf(": %s %stape\n", ctinfo[type].desc,
canstream ? "streaming " : "");
- bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_tab, "fcfs", 0);
if (gpibregister(sc->sc_ic, sc->sc_slave, ctcallback, sc,
&sc->sc_hdl)) {
@@ -513,7 +513,7 @@ ctstrategy(bp)
sc = device_lookup(&ct_cd, CTUNIT(bp->b_dev));
s = splbio();
- BUFQ_PUT(&sc->sc_tab, bp);
+ BUFQ_PUT(sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
ctustart(sc);
@@ -527,7 +527,7 @@ ctustart(sc)
{
struct buf *bp;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
sc->sc_addr = bp->b_data;
sc->sc_resid = bp->b_bcount;
if (gpibrequest(sc->sc_ic, sc->sc_hdl))
@@ -546,7 +546,7 @@ ctstart(sc)
slave = sc->sc_slave;
punit = sc->sc_punit;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if ((sc->sc_flags & CTF_CMD) && sc->sc_bp == bp) {
switch(sc->sc_cmd) {
case MTFSF:
@@ -748,7 +748,7 @@ ctintr(sc)
slave = sc->sc_slave;
punit = sc->sc_punit;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if (bp == NULL) {
printf("%s: bp == NULL\n", sc->sc_dev.dv_xname);
return;
@@ -878,10 +878,10 @@ ctdone(sc, bp)
struct buf *bp;
{
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
biodone(bp);
gpibrelease(sc->sc_ic, sc->sc_hdl);
- if (BUFQ_PEEK(&sc->sc_tab) == NULL) {
+ if (BUFQ_PEEK(sc->sc_tab) == NULL) {
sc->sc_active = 0;
return;
}
diff --git a/sys/dev/gpib/mt.c b/sys/dev/gpib/mt.c
index e7d9c54056c..4802f3b13ff 100644
--- a/sys/dev/gpib/mt.c
+++ b/sys/dev/gpib/mt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.3 2004/10/28 07:07:40 yamt Exp $ */
+/* $NetBSD: mt.c,v 1.4 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -121,7 +121,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.3 2004/10/28 07:07:40 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.4 2005/10/15 17:29:12 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -168,7 +168,7 @@ struct mt_softc {
short sc_density; /* current density of tape (mtio.h format) */
short sc_type; /* tape drive model (hardware IDs) */
tpr_t sc_ttyp;
- struct bufq_state sc_tab;/* buf queue */
+ struct bufq_state *sc_tab;/* buf queue */
int sc_active;
struct buf sc_bufstore; /* XXX buffer storage */
@@ -278,7 +278,7 @@ mtattach(parent, self, aux)
sc->sc_type = type;
sc->sc_flags = MTF_EXISTS;
- bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_tab, "fcfs", 0);
callout_init(&sc->sc_start_ch);
callout_init(&sc->sc_intr_ch);
@@ -588,7 +588,7 @@ mtstrategy(bp)
}
}
s = splbio();
- BUFQ_PUT(&sc->sc_tab, bp);
+ BUFQ_PUT(sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
mtustart(sc);
@@ -662,7 +662,7 @@ mtstart(sc)
DPRINTF(MDB_ANY, ("%s start", sc->sc_dev.dv_xname));
sc->sc_flags &= ~MTF_WRT;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if ((sc->sc_flags & MTF_ALIVE) == 0 &&
((bp->b_flags & B_CMD) == 0 || bp->b_cmd != MTRESET))
goto fatalerror;
@@ -843,10 +843,10 @@ errdone:
bp->b_flags |= B_ERROR;
done:
sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
biodone(bp);
gpibrelease(sc->sc_ic, sc->sc_hdl);
- if ((bp = BUFQ_PEEK(&sc->sc_tab)) == NULL)
+ if ((bp = BUFQ_PEEK(sc->sc_tab)) == NULL)
sc->sc_active = 0;
else
mtustart(sc);
@@ -862,7 +862,7 @@ mtintr(sc)
slave = sc->sc_slave;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
if (bp == NULL) {
printf("%s intr: bp == NULL", sc->sc_dev.dv_xname);
return;
@@ -1010,10 +1010,10 @@ error:
cmdbuf[0] = MTE_COMPLETE | MTE_IDLE;
(void) gpibsend(sc->sc_ic, slave, MTL_ECMD, cmdbuf, 1);
bp->b_flags &= ~B_CMD;
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
biodone(bp);
gpibrelease(sc->sc_ic, sc->sc_hdl);
- if (BUFQ_PEEK(&sc->sc_tab) == NULL)
+ if (BUFQ_PEEK(sc->sc_tab) == NULL)
sc->sc_active = 0;
else
mtustart(sc);
diff --git a/sys/dev/gpib/rd.c b/sys/dev/gpib/rd.c
index e75187b5bf3..e1d40fec98e 100644
--- a/sys/dev/gpib/rd.c
+++ b/sys/dev/gpib/rd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rd.c,v 1.5 2005/02/27 00:26:59 perry Exp $ */
+/* $NetBSD: rd.c,v 1.6 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.5 2005/02/27 00:26:59 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.6 2005/10/15 17:29:12 yamt Exp $");
#include "rnd.h"
@@ -182,7 +182,7 @@ struct rd_softc {
u_int8_t *sc_addr;
int sc_resid;
struct rd_iocmd sc_ioc;
- struct bufq_state sc_tab;
+ struct bufq_state *sc_tab;
int sc_active;
int sc_errcnt;
@@ -442,7 +442,7 @@ rdattach(parent, self, aux)
rdidentinfo[type].ri_ntpc, rdidentinfo[type].ri_nblocks,
DEV_BSIZE);
- bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_tab, "fcfs", 0);
/*
* Initialize and attach the disk structure.
@@ -662,7 +662,7 @@ rdstrategy(bp)
}
bp->b_rawblkno = bn + offset;
s = splbio();
- BUFQ_PUT(&sc->sc_tab, bp);
+ BUFQ_PUT(sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
rdustart(sc);
@@ -698,7 +698,7 @@ rdustart(sc)
{
struct buf *bp;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
sc->sc_addr = bp->b_data;
sc->sc_resid = bp->b_bcount;
if (gpibrequest(sc->sc_ic, sc->sc_hdl))
@@ -712,11 +712,11 @@ rdfinish(sc, bp)
{
sc->sc_errcnt = 0;
- (void)BUFQ_GET(&sc->sc_tab);
+ (void)BUFQ_GET(sc->sc_tab);
bp->b_resid = 0;
biodone(bp);
gpibrelease(sc->sc_ic, sc->sc_hdl);
- if ((bp = BUFQ_PEEK(&sc->sc_tab)) != NULL)
+ if ((bp = BUFQ_PEEK(sc->sc_tab)) != NULL)
return (bp);
sc->sc_active = 0;
if (sc->sc_flags & RDF_WANTED) {
@@ -758,7 +758,7 @@ void
rdstart(sc)
struct rd_softc *sc;
{
- struct buf *bp = BUFQ_PEEK(&sc->sc_tab);
+ struct buf *bp = BUFQ_PEEK(sc->sc_tab);
int part, slave, punit;
slave = sc->sc_slave;
@@ -828,7 +828,7 @@ rdintr(sc)
int rv, dir, restart, slave;
slave = sc->sc_slave;
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
DPRINTF(RDB_FOLLOW, ("rdintr(%s): bp %p, %c, flags %x\n",
sc->sc_dev.dv_xname, bp, (bp->b_flags & B_READ) ? 'R' : 'W',
@@ -944,7 +944,7 @@ rderror(sc)
/*
* First conjure up the block number at which the error occurred.
*/
- bp = BUFQ_PEEK(&sc->sc_tab);
+ bp = BUFQ_PEEK(sc->sc_tab);
pbn = sc->sc_dk.dk_label->d_partitions[RDPART(bp->b_dev)].p_offset;
if ((css.c_fef & FEF_CU) || (css.c_fef & FEF_DR) ||
(css.c_ief & IEF_RRMASK)) {
diff --git a/sys/dev/ic/rrunner.c b/sys/dev/ic/rrunner.c
index 8e1e9d21b50..ab16a8787ef 100644
--- a/sys/dev/ic/rrunner.c
+++ b/sys/dev/ic/rrunner.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rrunner.c,v 1.49 2005/05/30 04:43:47 christos Exp $ */
+/* $NetBSD: rrunner.c,v 1.50 2005/10/15 17:29:12 yamt Exp $ */
/*
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.49 2005/05/30 04:43:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.50 2005/10/15 17:29:12 yamt Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@@ -310,7 +310,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_alloc(&sc->sc_send.ec_buf_queue, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_send.ec_buf_queue, "fcfs", 0);
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,
@@ -1404,7 +1404,7 @@ esh_fpstrategy(bp)
*/
struct esh_send_ring_ctl *ring = &sc->sc_send;
- BUFQ_PUT(&ring->ec_buf_queue, bp);
+ BUFQ_PUT(ring->ec_buf_queue, bp);
#ifdef ESH_PRINTF
printf("esh_fpstrategy: ready to call eshstart to write!\n");
#endif
@@ -2018,7 +2018,7 @@ 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 &&
- BUFQ_PEEK(&send->ec_buf_queue) != NULL) {
+ BUFQ_PEEK(send->ec_buf_queue) != NULL) {
struct buf *bp;
#ifdef ESH_PRINTF
@@ -2026,7 +2026,7 @@ eshstart(ifp)
send->ec_queue);
#endif
- bp = send->ec_cur_buf = BUFQ_GET(&send->ec_buf_queue);
+ bp = send->ec_cur_buf = BUFQ_GET(send->ec_buf_queue);
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 4fc5d1dfe52..391ab80cc04 100644
--- a/sys/dev/ic/rrunnervar.h
+++ b/sys/dev/ic/rrunnervar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rrunnervar.h,v 1.9 2005/02/27 00:27:02 perry Exp $ */
+/* $NetBSD: rrunnervar.h,v 1.10 2005/10/15 17:29:12 yamt Exp $ */
/* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -114,7 +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 bufq_state ec_buf_queue; /* queue of bufs to send */
+ struct bufq_state *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/fd.c b/sys/dev/isa/fd.c
index f0d61237307..683b32dde55 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.59 2005/07/30 14:49:35 christos Exp $ */
+/* $NetBSD: fd.c,v 1.60 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.59 2005/07/30 14:49:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.60 2005/10/15 17:29:12 yamt Exp $");
#include "rnd.h"
#include "opt_ddb.h"
@@ -487,7 +487,7 @@ fdattach(parent, self, aux)
else
printf(": density unknown\n");
- bufq_alloc(&fd->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&fd->sc_q, "disksort", BUFQ_SORT_CYLINDER);
fd->sc_cylin = -1;
fd->sc_drive = drive;
fd->sc_deftype = type;
@@ -620,7 +620,7 @@ fdstrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
s = splbio();
- BUFQ_PUT(&fd->sc_q, bp);
+ BUFQ_PUT(fd->sc_q, bp);
callout_stop(&fd->sc_motoroff_ch); /* a good idea */
if (fd->sc_active == 0)
fdstart(fd);
@@ -673,11 +673,11 @@ fdfinish(fd, bp)
* another drive is waiting to be serviced, since there is a long motor
* startup delay whenever we switch.
*/
- (void)BUFQ_GET(&fd->sc_q);
+ (void)BUFQ_GET(fd->sc_q);
if (TAILQ_NEXT(fd, sc_drivechain) && ++fd->sc_ops >= 8) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
else
fd->sc_active = 0;
@@ -932,7 +932,7 @@ fdctimeout(arg)
#endif
fdcstatus(&fd->sc_dev, 0, "timeout");
- if (BUFQ_PEEK(&fd->sc_q) != NULL)
+ if (BUFQ_PEEK(fd->sc_q) != NULL)
fdc->sc_state++;
else
fdc->sc_state = DEVIDLE;
@@ -985,7 +985,7 @@ loop:
}
/* Is there a transfer to this drive? If not, deactivate drive. */
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (bp == NULL) {
fd->sc_ops = 0;
TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
@@ -1255,7 +1255,7 @@ fdcretry(fdc)
struct buf *bp;
fd = TAILQ_FIRST(&fdc->sc_drives);
- bp = BUFQ_PEEK(&fd->sc_q);
+ bp = BUFQ_PEEK(fd->sc_q);
if (fd->sc_opts & FDOPT_NORETRY)
goto fail;
diff --git a/sys/dev/isa/fdvar.h b/sys/dev/isa/fdvar.h
index 701fff9623c..8ee6ce438dd 100644
--- a/sys/dev/isa/fdvar.h
+++ b/sys/dev/isa/fdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fdvar.h,v 1.1 2003/01/08 23:51:11 jmcneill Exp $ */
+/* $NetBSD: fdvar.h,v 1.2 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@ struct fd_softc {
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
- struct bufq_state sc_q; /* pending I/O requests */
+ struct bufq_state *sc_q;/* pending I/O requests */
int sc_active; /* number of active I/O operations */
#if NRND > 0
diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c
index 0cefda54f0c..4e73e6912b1 100644
--- a/sys/dev/isa/mcd.c
+++ b/sys/dev/isa/mcd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mcd.c,v 1.90 2005/03/12 22:54:48 christos Exp $ */
+/* $NetBSD: mcd.c,v 1.91 2005/10/15 17:29:12 yamt Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -56,7 +56,7 @@
/*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.90 2005/03/12 22:54:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.91 2005/10/15 17:29:12 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -149,7 +149,7 @@ struct mcd_softc {
#define MCD_MD_UNKNOWN -1
int lastupc;
#define MCD_UPC_UNKNOWN -1
- struct bufq_state buf_queue;
+ struct bufq_state *buf_queue;
int active;
u_char readcmd;
u_char debug;
@@ -262,7 +262,7 @@ mcdattach(parent, self, aux)
return;
}
- bufq_alloc(&sc->buf_queue, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sc->buf_queue, "disksort", BUFQ_SORT_RAWBLOCK);
callout_init(&sc->sc_pintr_ch);
/*
@@ -481,7 +481,7 @@ mcdstrategy(bp)
/* Queue it. */
s = splbio();
- BUFQ_PUT(&sc->buf_queue, bp);
+ BUFQ_PUT(sc->buf_queue, bp);
splx(s);
if (!sc->active)
mcdstart(sc);
@@ -504,7 +504,7 @@ mcdstart(sc)
loop:
s = splbio();
- if ((bp = BUFQ_GET(&sc->buf_queue)) == NULL) {
+ if ((bp = BUFQ_GET(sc->buf_queue)) == NULL) {
/* Nothing to do. */
sc->active = 0;
splx(s);
diff --git a/sys/dev/ld.c b/sys/dev/ld.c
index f111c00076b..19f89120259 100644
--- a/sys/dev/ld.c
+++ b/sys/dev/ld.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.37 2005/05/30 04:44:52 christos Exp $ */
+/* $NetBSD: ld.c,v 1.38 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.37 2005/05/30 04:44:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.38 2005/10/15 17:29:11 yamt Exp $");
#include "rnd.h"
@@ -155,7 +155,7 @@ ldattach(struct ld_softc *sc)
/* Set the `shutdownhook'. */
if (ld_sdh == NULL)
ld_sdh = shutdownhook_establish(ldshutdown, NULL);
- bufq_alloc(&sc->sc_bufq, BUFQ_DISK_DEFAULT_STRAT()|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sc->sc_bufq, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);
/* Discover wedges on this disk. */
dkwedge_discover(&sc->sc_dk);
@@ -217,10 +217,10 @@ ldenddetach(struct ld_softc *sc)
/* Kill off any queued buffers. */
s = splbio();
- bufq_drain(&sc->sc_bufq);
+ bufq_drain(sc->sc_bufq);
splx(s);
- bufq_free(&sc->sc_bufq);
+ bufq_free(sc->sc_bufq);
/* Nuke the vnodes for any open instances. */
for (i = 0; i < MAXPARTITIONS; i++) {
@@ -589,7 +589,7 @@ ldstrategy(struct buf *bp)
bp->b_rawblkno = blkno;
s = splbio();
- BUFQ_PUT(&sc->sc_bufq, bp);
+ BUFQ_PUT(sc->sc_bufq, bp);
ldstart(sc);
splx(s);
return;
@@ -609,7 +609,7 @@ ldstart(struct ld_softc *sc)
while (sc->sc_queuecnt < sc->sc_maxqueuecnt) {
/* See if there is work to do. */
- if ((bp = BUFQ_PEEK(&sc->sc_bufq)) == NULL)
+ if ((bp = BUFQ_PEEK(sc->sc_bufq)) == NULL)
break;
disk_busy(&sc->sc_dk);
@@ -620,7 +620,7 @@ ldstart(struct ld_softc *sc)
* The back-end is running the job; remove it from
* the queue.
*/
- (void) BUFQ_GET(&sc->sc_bufq);
+ (void) BUFQ_GET(sc->sc_bufq);
} else {
disk_unbusy(&sc->sc_dk, 0, (bp->b_flags & B_READ));
sc->sc_queuecnt--;
@@ -635,7 +635,7 @@ ldstart(struct ld_softc *sc)
*/
break;
} else {
- (void) BUFQ_GET(&sc->sc_bufq);
+ (void) BUFQ_GET(sc->sc_bufq);
bp->b_error = error;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
diff --git a/sys/dev/ldvar.h b/sys/dev/ldvar.h
index 0d11627eb02..0397634cfce 100644
--- a/sys/dev/ldvar.h
+++ b/sys/dev/ldvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ldvar.h,v 1.9 2004/09/25 04:28:08 thorpej Exp $ */
+/* $NetBSD: ldvar.h,v 1.10 2005/10/15 17:29:11 yamt Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
struct ld_softc {
struct device sc_dv;
struct disk sc_dk;
- struct bufq_state sc_bufq;
+ struct bufq_state *sc_bufq;
#if NRND > 0
rndsource_element_t sc_rnd_source;
#endif
diff --git a/sys/dev/mca/ed_mca.c b/sys/dev/mca/ed_mca.c
index fa19dc3407c..63eca7b411f 100644
--- a/sys/dev/mca/ed_mca.c
+++ b/sys/dev/mca/ed_mca.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ed_mca.c,v 1.29 2005/02/27 00:27:21 perry Exp $ */
+/* $NetBSD: ed_mca.c,v 1.30 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.29 2005/02/27 00:27:21 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.30 2005/10/15 17:29:25 yamt Exp $");
#include "rnd.h"
@@ -155,7 +155,7 @@ ed_mca_attach(parent, self, aux)
ed->sc_devno = eda->edc_drive;
edc_add_disk(sc, ed);
- bufq_alloc(&ed->sc_q, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&ed->sc_q, "disksort", BUFQ_SORT_RAWBLOCK);
simple_lock_init(&ed->sc_q_lock);
if (ed_get_params(ed, &drv_flags)) {
@@ -257,7 +257,7 @@ edmcastrategy(bp)
/* Queue transfer on drive, activate drive and controller if idle. */
simple_lock(&ed->sc_q_lock);
- BUFQ_PUT(&ed->sc_q, bp);
+ BUFQ_PUT(ed->sc_q, bp);
simple_unlock(&ed->sc_q_lock);
/* Ring the worker thread */
diff --git a/sys/dev/mca/edc_mca.c b/sys/dev/mca/edc_mca.c
index 666f8bb5a43..2971b4dff7c 100644
--- a/sys/dev/mca/edc_mca.c
+++ b/sys/dev/mca/edc_mca.c
@@ -1,4 +1,4 @@
-/* $NetBSD: edc_mca.c,v 1.30 2005/08/26 11:20:33 drochner Exp $ */
+/* $NetBSD: edc_mca.c,v 1.31 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.30 2005/08/26 11:20:33 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.31 2005/10/15 17:29:25 yamt Exp $");
#include "rnd.h"
@@ -862,7 +862,7 @@ edcworker(arg)
/* Is there a buf for us ? */
simple_lock(&ed->sc_q_lock);
- if ((bp = BUFQ_GET(&ed->sc_q)) == NULL) {
+ if ((bp = BUFQ_GET(ed->sc_q)) == NULL) {
simple_unlock(&ed->sc_q_lock);
i++;
continue;
diff --git a/sys/dev/mca/edvar.h b/sys/dev/mca/edvar.h
index 96712034f5c..03c28d7896f 100644
--- a/sys/dev/mca/edvar.h
+++ b/sys/dev/mca/edvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: edvar.h,v 1.9 2005/02/27 00:27:21 perry Exp $ */
+/* $NetBSD: edvar.h,v 1.10 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@ struct ed_softc {
/* General disk infos */
struct disk sc_dk;
- struct bufq_state sc_q;
+ struct bufq_state *sc_q;
struct simplelock sc_q_lock;
struct edc_mca_softc *edc_softc; /* pointer to our controller */
diff --git a/sys/dev/md.c b/sys/dev/md.c
index 27da56484af..062767e2e70 100644
--- a/sys/dev/md.c
+++ b/sys/dev/md.c
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.41 2005/04/01 11:59:37 yamt Exp $ */
+/* $NetBSD: md.c,v 1.42 2005/10/15 17:29:11 yamt Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross, Leo Weppelman.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.41 2005/04/01 11:59:37 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md.c,v 1.42 2005/10/15 17:29:11 yamt Exp $");
#include "opt_md.h"
@@ -86,7 +86,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 bufq_state sc_buflist;
+ struct bufq_state *sc_buflist;
};
/* shorthand for fields in sc_md: */
#define sc_addr sc_md.md_addr
@@ -163,7 +163,7 @@ md_attach(struct device *parent, struct device *self, void *aux)
{
struct md_softc *sc = (struct md_softc *)self;
- bufq_alloc(&sc->sc_buflist, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_buflist, "fcfs", 0);
/* XXX - Could accept aux info here to set the config. */
#ifdef MEMORY_DISK_HOOKS
@@ -326,7 +326,7 @@ mdstrategy(struct buf *bp)
#if MEMORY_DISK_SERVER
case MD_UMEM_SERVER:
/* Just add this job to the server's queue. */
- BUFQ_PUT(&sc->sc_buflist, bp);
+ BUFQ_PUT(sc->sc_buflist, bp);
wakeup((caddr_t)sc);
/* see md_server_loop() */
/* no biodone in this case */
@@ -475,7 +475,7 @@ md_server_loop(struct md_softc *sc)
for (;;) {
/* Wait for some work to arrive. */
- while ((bp = BUFQ_GET(&sc->sc_buflist)) == NULL) {
+ while ((bp = BUFQ_GET(sc->sc_buflist)) == NULL) {
error = tsleep((caddr_t)sc, md_sleep_pri, "md_idle", 0);
if (error)
return error;
diff --git a/sys/dev/mscp/mscp_disk.c b/sys/dev/mscp/mscp_disk.c
index 4989357d688..022910c33ae 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.47 2005/02/27 00:27:32 perry Exp $ */
+/* $NetBSD: mscp_disk.c,v 1.48 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.47 2005/02/27 00:27:32 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.48 2005/10/15 17:29:25 yamt Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -342,7 +342,7 @@ raclose(dev, flags, fmt, p)
#if notyet
if (ra->ra_openpart == 0) {
s = spluba();
- while (BUFQ_PEEK(&udautab[unit]) != NULL)
+ while (BUFQ_PEEK(udautab[unit]) != NULL)
(void) tsleep(&udautab[unit], PZERO - 1,
"raclose", 0);
splx(s);
diff --git a/sys/dev/mscp/mscp_subr.c b/sys/dev/mscp/mscp_subr.c
index d96539272fd..f6863710057 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.28 2005/06/27 11:05:24 ragge Exp $ */
+/* $NetBSD: mscp_subr.c,v 1.29 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mscp_subr.c,v 1.28 2005/06/27 11:05:24 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mscp_subr.c,v 1.29 2005/10/15 17:29:25 yamt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -196,7 +196,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;
- bufq_alloc(&mi->mi_resq, BUFQ_FCFS);
+ bufq_alloc(&mi->mi_resq, "fcfs", 0);
if (mscp_init(mi)) {
printf("%s: can't init, controller hung\n",
@@ -487,7 +487,7 @@ mscp_intr(mi)
/*
* If there are any not-yet-handled request, try them now.
*/
- if (BUFQ_PEEK(&mi->mi_resq))
+ if (BUFQ_PEEK(mi->mi_resq))
mscp_kickaway(mi);
}
@@ -522,7 +522,7 @@ mscp_strategy(bp, usc)
struct mscp_softc *mi = (void *)usc;
int s = spluba();
- BUFQ_PUT(&mi->mi_resq, bp);
+ BUFQ_PUT(mi->mi_resq, bp);
mscp_kickaway(mi);
splx(s);
}
@@ -536,7 +536,7 @@ mscp_kickaway(mi)
struct mscp *mp;
int next;
- while ((bp = BUFQ_PEEK(&mi->mi_resq)) != NULL) {
+ while ((bp = BUFQ_PEEK(mi->mi_resq)) != NULL) {
/*
* Ok; we are ready to try to start a xfer. Get a MSCP packet
* and try to start...
@@ -569,7 +569,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]);
- (void)BUFQ_GET(&mi->mi_resq);
+ (void)BUFQ_GET(mi->mi_resq);
}
}
diff --git a/sys/dev/mscp/mscpvar.h b/sys/dev/mscp/mscpvar.h
index dece320abda..ccc790a11b7 100644
--- a/sys/dev/mscp/mscpvar.h
+++ b/sys/dev/mscp/mscpvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mscpvar.h,v 1.12 2005/06/27 11:05:24 ragge Exp $ */
+/* $NetBSD: mscpvar.h,v 1.13 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -223,7 +223,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) */
- struct bufq_state mi_resq; /* While waiting for packets */
+ struct bufq_state *mi_resq; /* While waiting for packets */
};
/* mi_flags */
diff --git a/sys/dev/qbus/rf.c b/sys/dev/qbus/rf.c
index a80a4402c5c..ce6c9074910 100644
--- a/sys/dev/qbus/rf.c
+++ b/sys/dev/qbus/rf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf.c,v 1.8 2005/02/26 12:45:06 simonb Exp $ */
+/* $NetBSD: rf.c,v 1.9 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 2002 Jochen Kunz.
* All rights reserved.
@@ -36,7 +36,7 @@ TODO:
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.8 2005/02/26 12:45:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.9 2005/10/15 17:29:25 yamt Exp $");
/* autoconfig stuff */
#include <sys/param.h>
@@ -173,7 +173,7 @@ CFATTACH_DECL(
struct rf_softc {
struct device sc_dev; /* common device data */
struct disk sc_disk; /* common disk device data */
- struct bufq_state sc_bufq; /* queue of pending transfers */
+ struct bufq_state *sc_bufq; /* queue of pending transfers */
int sc_state; /* state of drive */
u_int8_t sc_dnum; /* drive number, 0 or 1 */
};
@@ -496,7 +496,7 @@ rf_attach(struct device *parent, struct device *self, void *aux)
dl->d_partitions[2].p_fsize = 0; /* fs basic fragment size */
dl->d_partitions[2].p_fstype = 0; /* fs type */
dl->d_partitions[2].p_frag = 0; /* fs fragments per block */
- bufq_alloc(&rf_sc->sc_bufq, BUFQ_DISKSORT | BUFQ_SORT_CYLINDER);
+ bufq_alloc(&rf_sc->sc_bufq, "disksort", BUFQ_SORT_CYLINDER);
printf("\n");
return;
}
@@ -601,7 +601,7 @@ rfstrategy(struct buf *buf)
rfc_intr(rfc_sc);
} else {
buf->b_resid = buf->b_blkno / RX2_SECTORS;
- BUFQ_PUT(&rf_sc->sc_bufq, buf);
+ BUFQ_PUT(rf_sc->sc_bufq, buf);
buf->b_resid = 0;
}
splx(i);
@@ -626,7 +626,7 @@ get_new_buf( struct rfc_softc *rfc_sc)
struct rf_softc *other_drive;
rf_sc = (struct rf_softc *)rfc_sc->sc_childs[rfc_sc->sc_curchild];
- rfc_sc->sc_curbuf = BUFQ_GET(&rf_sc->sc_bufq);
+ rfc_sc->sc_curbuf = BUFQ_GET(rf_sc->sc_bufq);
if (rfc_sc->sc_curbuf != NULL) {
rfc_sc->sc_bufidx = rfc_sc->sc_curbuf->b_un.b_addr;
rfc_sc->sc_bytesleft = rfc_sc->sc_curbuf->b_bcount;
@@ -635,10 +635,10 @@ get_new_buf( struct rfc_softc *rfc_sc)
other_drive = (struct rf_softc *)
rfc_sc->sc_childs[ rfc_sc->sc_curchild == 0 ? 1 : 0];
if (other_drive != NULL
- && BUFQ_PEEK(&other_drive->sc_bufq) != NULL) {
+ && BUFQ_PEEK(other_drive->sc_bufq) != NULL) {
rfc_sc->sc_curchild = rfc_sc->sc_curchild == 0 ? 1 : 0;
rf_sc = other_drive;
- rfc_sc->sc_curbuf = BUFQ_GET(&rf_sc->sc_bufq);
+ rfc_sc->sc_curbuf = BUFQ_GET(rf_sc->sc_bufq);
rfc_sc->sc_bufidx = rfc_sc->sc_curbuf->b_un.b_addr;
rfc_sc->sc_bytesleft = rfc_sc->sc_curbuf->b_bcount;
} else
diff --git a/sys/dev/qbus/rl.c b/sys/dev/qbus/rl.c
index b486c46e869..f70b3a886c4 100644
--- a/sys/dev/qbus/rl.c
+++ b/sys/dev/qbus/rl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rl.c,v 1.25 2005/06/27 11:05:24 ragge Exp $ */
+/* $NetBSD: rl.c,v 1.26 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.25 2005/06/27 11:05:24 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.26 2005/10/15 17:29:25 yamt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -221,7 +221,7 @@ rlcattach(struct device *parent, struct device *self, void *aux)
printf(": Failed to allocate DMA map, error %d\n", error);
return;
}
- bufq_alloc(&sc->sc_q, BUFQ_DISKSORT|BUFQ_SORT_CYLINDER);
+ bufq_alloc(&sc->sc_q, "disksort", BUFQ_SORT_CYLINDER);
for (i = 0; i < RL_MAXDPC; i++) {
waitcrdy(sc);
RL_WREG(RL_DA, RLDA_GS|RLDA_RST);
@@ -431,7 +431,7 @@ rlstrategy(struct buf *bp)
sc = (struct rlc_softc *)rc->rc_dev.dv_parent;
s = splbio();
- BUFQ_PUT(&sc->sc_q, bp);
+ BUFQ_PUT(sc->sc_q, bp);
rlcstart(sc, 0);
splx(s);
return;
@@ -647,7 +647,7 @@ rlcstart(struct rlc_softc *sc, struct buf *ob)
return; /* Already doing something */
if (ob == 0) {
- bp = BUFQ_GET(&sc->sc_q);
+ bp = BUFQ_GET(sc->sc_q);
if (bp == NULL)
return; /* Nothing to do */
sc->sc_bufaddr = bp->b_data;
@@ -740,7 +740,7 @@ rlcreset(struct device *dev)
if (sc->sc_active == 0)
return;
- BUFQ_PUT(&sc->sc_q, sc->sc_active);
+ BUFQ_PUT(sc->sc_q, sc->sc_active);
sc->sc_active = 0;
rlcstart(sc, 0);
}
diff --git a/sys/dev/qbus/rlvar.h b/sys/dev/qbus/rlvar.h
index 46efcb01f13..b9ced812e9e 100644
--- a/sys/dev/qbus/rlvar.h
+++ b/sys/dev/qbus/rlvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rlvar.h,v 1.4 2005/02/26 12:45:06 simonb Exp $ */
+/* $NetBSD: rlvar.h,v 1.5 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rlvar.h,v 1.4 2005/02/26 12:45:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rlvar.h,v 1.5 2005/10/15 17:29:25 yamt Exp $");
struct rlc_softc {
struct device sc_dev;
@@ -45,7 +45,7 @@ struct rlc_softc {
bus_space_handle_t sc_ioh;
bus_dma_tag_t sc_dmat;
bus_dmamap_t sc_dmam;
- struct bufq_state sc_q; /* Queue of waiting bufs */
+ struct bufq_state *sc_q; /* Queue of waiting bufs */
struct buf *sc_active; /* Currently active buf */
caddr_t sc_bufaddr; /* Current in-core address */
int sc_diskblk; /* Current block on disk */
diff --git a/sys/dev/qbus/ts.c b/sys/dev/qbus/ts.c
index ba8dc8c9952..4439672f605 100644
--- a/sys/dev/qbus/ts.c
+++ b/sys/dev/qbus/ts.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ts.c,v 1.13 2005/02/26 12:45:06 simonb Exp $ */
+/* $NetBSD: ts.c,v 1.14 2005/10/15 17:29:25 yamt Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.13 2005/02/26 12:45:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ts.c,v 1.14 2005/10/15 17:29:25 yamt Exp $");
#undef TSDEBUG
@@ -126,7 +126,7 @@ struct ts_softc {
struct ts *sc_bts; /* Unibus address of ts struct */
int sc_type; /* TS11 or TS05? */
short sc_waddr; /* Value to write to TSDB */
- struct bufq_state sc_bufq; /* pending I/O requests */
+ struct bufq_state *sc_bufq; /* pending I/O requests */
short sc_mapped; /* Unibus map allocated ? */
short sc_state; /* see below: ST_xxx */
@@ -250,7 +250,7 @@ tsattach(struct device *parent, struct device *self, void *aux)
0, BUS_DMA_NOWAIT, &sc->sc_dmam)))
return printf(": failed create DMA map %d\n", error);
- bufq_alloc(&sc->sc_bufq, BUFQ_FCFS);
+ bufq_alloc(&sc->sc_bufq, "fcfs", 0);
/*
* write the characteristics (again)
@@ -376,10 +376,10 @@ tsstart(struct ts_softc *sc, int isloaded)
struct buf *bp;
int cmd;
- if (TAILQ_EMPTY(&sc->sc_bufq.bq_head))
+ bp = BUFQ_PEEK(sc->sc_bufq);
+ if (bp == NULL) {
return 0;
-
- bp = BUFQ_PEEK(&sc->sc_bufq);
+ }
#ifdef TSDEBUG
printf("buf: %p bcount %ld blkno %d\n", bp, bp->b_bcount, bp->b_blkno);
#endif
@@ -467,7 +467,7 @@ int
tsready(struct uba_unit *uu)
{
struct ts_softc *sc = uu->uu_softc;
- struct buf *bp = BUFQ_PEEK(&sc->sc_bufq);
+ struct buf *bp = BUFQ_PEEK(sc->sc_bufq);
if (bus_dmamap_load(sc->sc_dmat, sc->sc_dmam, bp->b_data,
bp->b_bcount, bp->b_proc, BUS_DMA_NOWAIT))
@@ -785,9 +785,9 @@ tsintr(void *arg)
sc->sc_dev.dv_xname, sr & TS_TC);
tsreset(sc);
}
- if ((bp = BUFQ_GET(&sc->sc_bufq)) != NULL) {
+ if ((bp = BUFQ_GET(sc->sc_bufq)) != NULL) {
#ifdef TSDEBUG
- printf("tsintr2: que %p\n", TAILQ_FIRST(&sc->sc_bufq.bq_head));
+ printf("tsintr2: que %p\n", BUFQ_PEEK(sc->sc_bufq));
#endif
if (bp != &sc->ts_cbuf) { /* no ioctl */
bus_dmamap_unload(sc->sc_dmat, sc->sc_dmam);
@@ -909,8 +909,8 @@ tsstrategy(struct buf *bp)
printf("buf: %p bcount %ld blkno %d\n", bp, bp->b_bcount, bp->b_blkno);
#endif
s = splbio ();
- empty = (BUFQ_PEEK(&sc->sc_bufq) == NULL);
- BUFQ_PUT(&sc->sc_bufq, bp);
+ empty = (BUFQ_PEEK(sc->sc_bufq) == NULL);
+ BUFQ_PUT(sc->sc_bufq, bp);
if (empty)
tsstart(sc, 0);
splx(s);
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index b16d3b1032c..0c6057302d5 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.190 2005/09/25 19:47:17 oster Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.191 2005/10/15 17:29:25 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -146,7 +146,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.190 2005/09/25 19:47:17 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.191 2005/10/15 17:29:25 yamt Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@@ -253,7 +253,7 @@ struct raid_softc {
size_t sc_size; /* size of the raid device */
char sc_xname[20]; /* XXX external name */
struct disk sc_dkdev; /* generic disk device info */
- struct bufq_state buf_queue; /* used for the device queue */
+ struct bufq_state *buf_queue; /* used for the device queue */
};
/* sc_flags */
#define RAIDF_INITED 0x01 /* unit has been initialized */
@@ -395,7 +395,7 @@ raidattach(int num)
}
for (raidID = 0; raidID < num; raidID++) {
- bufq_alloc(&raid_softc[raidID].buf_queue, BUFQ_FCFS);
+ bufq_alloc(&raid_softc[raidID].buf_queue, "fcfs", 0);
pseudo_disk_init(&raid_softc[raidID].sc_dkdev);
raidrootdev[raidID].dv_class = DV_DISK;
@@ -733,7 +733,7 @@ raidstrategy(struct buf *bp)
bp->b_resid = 0;
/* stuff it onto our queue */
- BUFQ_PUT(&rs->buf_queue, bp);
+ BUFQ_PUT(rs->buf_queue, bp);
/* scheduled the IO to happen at the next convenient time */
wakeup(&(raidPtrs[raidID]->iodone));
@@ -1701,7 +1701,7 @@ raidstart(RF_Raid_t *raidPtr)
RF_UNLOCK_MUTEX(raidPtr->mutex);
/* get the next item, if any, from the queue */
- if ((bp = BUFQ_GET(&rs->buf_queue)) == NULL) {
+ if ((bp = BUFQ_GET(rs->buf_queue)) == NULL) {
/* nothing more to do */
return;
}
@@ -3343,7 +3343,7 @@ rf_pool_init(struct pool *p, size_t size, const char *w_chan,
int
rf_buf_queue_check(int raidid)
{
- if ((BUFQ_PEEK(&(raid_softc[raidid].buf_queue)) != NULL) &&
+ if ((BUFQ_PEEK(raid_softc[raidid].buf_queue) != NULL) &&
raidPtrs[raidid]->openings > 0) {
/* there is work to do */
return 0;
diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c
index d11ec5a01b3..8fa256fff29 100644
--- a/sys/dev/scsipi/cd.c
+++ b/sys/dev/scsipi/cd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.227 2005/09/06 22:19:14 reinoud Exp $ */
+/* $NetBSD: cd.c,v 1.228 2005/10/15 17:29:25 yamt Exp $ */
/*-
* Copyright (c) 1998, 2001, 2003, 2004 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.227 2005/09/06 22:19:14 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.228 2005/10/15 17:29:25 yamt Exp $");
#include "rnd.h"
@@ -231,7 +231,7 @@ cdattach(struct device *parent, struct device *self, void *aux)
periph->periph_version == 0)
cd->flags |= CDF_ANCIENT;
- bufq_alloc(&cd->buf_queue, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&cd->buf_queue, "disksort", BUFQ_SORT_RAWBLOCK);
callout_init(&cd->sc_callout);
@@ -309,9 +309,9 @@ cddetach(struct device *self, int flags)
s = splbio();
/* Kill off any queued buffers. */
- bufq_drain(&cd->buf_queue);
+ bufq_drain(cd->buf_queue);
- bufq_free(&cd->buf_queue);
+ bufq_free(cd->buf_queue);
/* Kill off any pending commands. */
scsipi_kill_pending(cd->sc_periph);
@@ -697,7 +697,7 @@ cdstrategy(struct buf *bp)
* XXX Only do disksort() if the current operating mode does not
* XXX include tagged queueing.
*/
- BUFQ_PUT(&cd->buf_queue, bp);
+ BUFQ_PUT(cd->buf_queue, bp);
/*
* Tell the device to get going on the transfer if it's
@@ -768,7 +768,7 @@ cdstart(struct scsipi_periph *periph)
*/
if (__predict_false(
(periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) {
- if ((bp = BUFQ_GET(&cd->buf_queue)) != NULL) {
+ if ((bp = BUFQ_GET(cd->buf_queue)) != NULL) {
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
@@ -782,7 +782,7 @@ cdstart(struct scsipi_periph *periph)
/*
* See if there is a buf with work for us to do..
*/
- if ((bp = BUFQ_PEEK(&cd->buf_queue)) == NULL)
+ if ((bp = BUFQ_PEEK(cd->buf_queue)) == NULL)
return;
/*
@@ -855,10 +855,10 @@ cdstart(struct scsipi_periph *periph)
* HBA driver
*/
#ifdef DIAGNOSTIC
- if (BUFQ_GET(&cd->buf_queue) != bp)
+ if (BUFQ_GET(cd->buf_queue) != bp)
panic("cdstart(): dequeued wrong buf");
#else
- BUFQ_GET(&cd->buf_queue);
+ BUFQ_GET(cd->buf_queue);
#endif
error = scsipi_execute_xs(xs);
/* with a scsipi_xfer preallocated, scsipi_command can't fail */
@@ -961,7 +961,7 @@ cdbounce(struct buf *bp)
* XXX Only do disksort() if the current operating mode
* XXX does not include tagged queueing.
*/
- BUFQ_PUT(&cd->buf_queue, nbp);
+ BUFQ_PUT(cd->buf_queue, nbp);
/*
* Tell the device to get going on the transfer if it's
diff --git a/sys/dev/scsipi/cdvar.h b/sys/dev/scsipi/cdvar.h
index 81e1e3929f7..b389277b1b4 100644
--- a/sys/dev/scsipi/cdvar.h
+++ b/sys/dev/scsipi/cdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cdvar.h,v 1.24 2005/02/01 00:19:34 reinoud Exp $ */
+/* $NetBSD: cdvar.h,v 1.25 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@@ -49,7 +49,7 @@ struct cd_softc {
u_long disksize512; /* total number sectors */
} params;
- struct bufq_state buf_queue;
+ struct bufq_state *buf_queue;
struct callout sc_callout;
#if NRND > 0
diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c
index 069c7a8b9b1..f046f20027d 100644
--- a/sys/dev/scsipi/sd.c
+++ b/sys/dev/scsipi/sd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.240 2005/05/29 22:00:50 christos Exp $ */
+/* $NetBSD: sd.c,v 1.241 2005/10/15 17:29:25 yamt Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.240 2005/05/29 22:00:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.241 2005/10/15 17:29:25 yamt Exp $");
#include "opt_scsi.h"
#include "rnd.h"
@@ -229,8 +229,7 @@ sdattach(struct device *parent, struct device *self, void *aux)
periph->periph_version == 0)
sd->flags |= SDF_ANCIENT;
- bufq_alloc(&sd->buf_queue,
- BUFQ_DISK_DEFAULT_STRAT()|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sd->buf_queue, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);
callout_init(&sd->sc_callout);
@@ -369,9 +368,9 @@ sddetach(struct device *self, int flags)
s = splbio();
/* Kill off any queued buffers. */
- bufq_drain(&sd->buf_queue);
+ bufq_drain(sd->buf_queue);
- bufq_free(&sd->buf_queue);
+ bufq_free(sd->buf_queue);
/* Kill off any pending commands. */
scsipi_kill_pending(sd->sc_periph);
@@ -725,7 +724,7 @@ sdstrategy(struct buf *bp)
* XXX Only do disksort() if the current operating mode does not
* XXX include tagged queueing.
*/
- BUFQ_PUT(&sd->buf_queue, bp);
+ BUFQ_PUT(sd->buf_queue, bp);
/*
* Tell the device to get going on the transfer if it's
@@ -798,7 +797,7 @@ sdstart(struct scsipi_periph *periph)
*/
if (__predict_false(
(periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) {
- if ((bp = BUFQ_GET(&sd->buf_queue)) != NULL) {
+ if ((bp = BUFQ_GET(sd->buf_queue)) != NULL) {
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount;
@@ -812,7 +811,7 @@ sdstart(struct scsipi_periph *periph)
/*
* See if there is a buf with work for us to do..
*/
- if ((bp = BUFQ_PEEK(&sd->buf_queue)) == NULL)
+ if ((bp = BUFQ_PEEK(sd->buf_queue)) == NULL)
return;
/*
@@ -900,10 +899,10 @@ sdstart(struct scsipi_periph *periph)
* HBA driver
*/
#ifdef DIAGNOSTIC
- if (BUFQ_GET(&sd->buf_queue) != bp)
+ if (BUFQ_GET(sd->buf_queue) != bp)
panic("sdstart(): dequeued wrong buf");
#else
- BUFQ_GET(&sd->buf_queue);
+ BUFQ_GET(sd->buf_queue);
#endif
error = scsipi_execute_xs(xs);
/* with a scsipi_xfer preallocated, scsipi_command can't fail */
diff --git a/sys/dev/scsipi/sdvar.h b/sys/dev/scsipi/sdvar.h
index fab47764c7c..887a7215c65 100644
--- a/sys/dev/scsipi/sdvar.h
+++ b/sys/dev/scsipi/sdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sdvar.h,v 1.26 2005/02/01 00:19:34 reinoud Exp $ */
+/* $NetBSD: sdvar.h,v 1.27 2005/10/15 17:29:25 yamt Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@ struct sd_softc {
u_int64_t disksize512; /* total number sectors */
} params;
- struct bufq_state buf_queue;
+ struct bufq_state *buf_queue;
struct callout sc_callout;
u_int8_t type;
char name[16]; /* product name, for default disklabel */
diff --git a/sys/dev/scsipi/ss.c b/sys/dev/scsipi/ss.c
index 07dc15e573a..e0e0e3f19dc 100644
--- a/sys/dev/scsipi/ss.c
+++ b/sys/dev/scsipi/ss.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ss.c,v 1.61 2005/05/30 04:25:32 christos Exp $ */
+/* $NetBSD: ss.c,v 1.62 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 1995 Kenneth Stailey. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.61 2005/05/30 04:25:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.62 2005/10/15 17:29:25 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -163,7 +163,7 @@ ssattach(struct device *parent, struct device *self, void *aux)
/*
* Set up the buf queue for this device
*/
- bufq_alloc(&ss->buf_queue, BUFQ_FCFS);
+ bufq_alloc(&ss->buf_queue, "fcfs", 0);
callout_init(&ss->sc_callout);
@@ -199,9 +199,9 @@ ssdetach(struct device *self, int flags)
s = splbio();
/* Kill off any queued buffers. */
- bufq_drain(&ss->buf_queue);
+ bufq_drain(ss->buf_queue);
- bufq_free(&ss->buf_queue);
+ bufq_free(ss->buf_queue);
/* Kill off any pending commands. */
scsipi_kill_pending(ss->sc_periph);
@@ -441,7 +441,7 @@ ssstrategy(struct buf *bp)
* at the end (a bit silly because we only have on user..
* (but it could fork()))
*/
- BUFQ_PUT(&ss->buf_queue, bp);
+ BUFQ_PUT(ss->buf_queue, bp);
/*
* Tell the device to get going on the transfer if it's
@@ -496,7 +496,7 @@ ssstart(struct scsipi_periph *periph)
/*
* See if there is a buf with work for us to do..
*/
- if ((bp = BUFQ_PEEK(&ss->buf_queue)) == NULL)
+ if ((bp = BUFQ_PEEK(ss->buf_queue)) == NULL)
return;
if (ss->special && ss->special->read) {
diff --git a/sys/dev/scsipi/ss_mustek.c b/sys/dev/scsipi/ss_mustek.c
index 1bdf1f82b11..09119c1cae2 100644
--- a/sys/dev/scsipi/ss_mustek.c
+++ b/sys/dev/scsipi/ss_mustek.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ss_mustek.c,v 1.30 2005/02/01 00:19:34 reinoud Exp $ */
+/* $NetBSD: ss_mustek.c,v 1.31 2005/10/15 17:29:25 yamt Exp $ */
/*
* Copyright (c) 1995 Joachim Koenig-Baltes. All rights reserved.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ss_mustek.c,v 1.30 2005/02/01 00:19:34 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ss_mustek.c,v 1.31 2005/10/15 17:29:25 yamt Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -496,10 +496,10 @@ mustek_read(struct ss_softc *ss, struct buf *bp)
return(0);
}
#ifdef DIAGNOSTIC
- if (BUFQ_GET(&ss->buf_queue) != bp)
+ if (BUFQ_GET(ss->buf_queue) != bp)
panic("ssstart(): dequeued wrong buf");
#else
- BUFQ_GET(&ss->buf_queue);
+ BUFQ_GET(ss->buf_queue);
#endif
error = scsipi_execute_xs(xs);
/* with a scsipi_xfer preallocated, scsipi_command can't fail */
diff --git a/sys/dev/scsipi/ss_scanjet.c b/sys/dev/scsipi/ss_scanjet.c
index 2e02e159571..063f5e3aa41 100644
--- a/sys/dev/scsipi/ss_scanjet.c
+++ b/sys/dev/scsipi/ss_scanjet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ss_scanjet.c,v 1.42 2005/05/30 04:25:32 christos Exp $ */
+/* $NetBSD: ss_scanjet.c,v 1.43 2005/10/15 17:29:26 yamt Exp $ */
/*
* Copyright (c) 1995 Kenneth Stailey. All rights reserved.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ss_scanjet.c,v 1.42 2005/05/30 04:25:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ss_scanjet.c,v 1.43 2005/10/15 17:29:26 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -296,10 +296,10 @@ scanjet_read(struct ss_softc *ss, struct buf *bp)
return(0);
}
#ifdef DIAGNOSTIC
- if (BUFQ_GET(&ss->buf_queue) != bp)
+ if (BUFQ_GET(ss->buf_queue) != bp)
panic("ssstart(): dequeued wrong buf");
#else
- BUFQ_GET(&ss->buf_queue);
+ BUFQ_GET(ss->buf_queue);
#endif
error = scsipi_execute_xs(xs);
/* with a scsipi_xfer preallocated, scsipi_command can't fail */
diff --git a/sys/dev/scsipi/ssvar.h b/sys/dev/scsipi/ssvar.h
index 5ea574c0fbb..748fc5a1237 100644
--- a/sys/dev/scsipi/ssvar.h
+++ b/sys/dev/scsipi/ssvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ssvar.h,v 1.15 2005/02/27 00:27:48 perry Exp $ */
+/* $NetBSD: ssvar.h,v 1.16 2005/10/15 17:29:26 yamt 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_periph *sc_periph; /* contains our targ, lun, etc. */
struct scan_io sio;
- struct bufq_state buf_queue; /* the queue of pending IO operations */
+ struct bufq_state *buf_queue; /* the queue of pending IO operations */
struct callout sc_callout; /* to restart the buf queue */
u_int quirks; /* scanner is only mildly twisted */
#define SS_Q_GET_BUFFER_SIZE 0x0001 /* poll for available data in ssread() */
diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c
index 21615b68dfc..7d5d9db61de 100644
--- a/sys/dev/scsipi/st.c
+++ b/sys/dev/scsipi/st.c
@@ -1,4 +1,4 @@
-/* $NetBSD: st.c,v 1.184 2005/08/13 10:50:50 blymn Exp $ */
+/* $NetBSD: st.c,v 1.185 2005/10/15 17:29:26 yamt Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.184 2005/08/13 10:50:50 blymn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.185 2005/10/15 17:29:26 yamt Exp $");
#include "opt_scsi.h"
@@ -394,7 +394,7 @@ stattach(struct device *parent, struct st_softc *st, void *aux)
/*
* Set up the buf queue for this device
*/
- bufq_alloc(&st->buf_queue, BUFQ_FCFS);
+ bufq_alloc(&st->buf_queue, "fcfs", 0);
callout_init(&st->sc_callout);
@@ -466,9 +466,9 @@ stdetach(struct device *self, int flags)
s = splbio();
/* Kill off any queued buffers. */
- bufq_drain(&st->buf_queue);
+ bufq_drain(st->buf_queue);
- bufq_free(&st->buf_queue);
+ bufq_free(st->buf_queue);
/* Kill off any pending commands. */
scsipi_kill_pending(st->sc_periph);
@@ -1144,7 +1144,7 @@ ststrategy(struct buf *bp)
* at the end (a bit silly because we only have on user..
* (but it could fork()))
*/
- BUFQ_PUT(&st->buf_queue, bp);
+ BUFQ_PUT(st->buf_queue, bp);
/*
* Tell the device to get going on the transfer if it's
@@ -1208,7 +1208,7 @@ ststart(struct scsipi_periph *periph)
*/
if (__predict_false((st->flags & ST_MOUNTED) == 0 ||
(periph->periph_flags & PERIPH_MEDIA_LOADED) == 0)) {
- if ((bp = BUFQ_GET(&st->buf_queue)) != NULL) {
+ if ((bp = BUFQ_GET(st->buf_queue)) != NULL) {
/* make sure that one implies the other.. */
periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
bp->b_flags |= B_ERROR;
@@ -1221,7 +1221,7 @@ ststart(struct scsipi_periph *periph)
}
}
- if ((bp = BUFQ_PEEK(&st->buf_queue)) == NULL)
+ if ((bp = BUFQ_PEEK(st->buf_queue)) == NULL)
return;
if (st->stats->busy++ == 0) {
@@ -1247,14 +1247,14 @@ ststart(struct scsipi_periph *periph)
* Back up over filemark
*/
if (st_space(st, 0, SP_FILEMARKS, 0)) {
- BUFQ_GET(&st->buf_queue);
+ BUFQ_GET(st->buf_queue);
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
biodone(bp);
continue;
}
} else {
- BUFQ_GET(&st->buf_queue);
+ BUFQ_GET(st->buf_queue);
bp->b_resid = bp->b_bcount;
bp->b_error = 0;
bp->b_flags &= ~B_ERROR;
@@ -1269,7 +1269,7 @@ ststart(struct scsipi_periph *periph)
* yet then we should report it now.
*/
if (st->flags & (ST_EOM_PENDING|ST_EIO_PENDING)) {
- BUFQ_GET(&st->buf_queue);
+ BUFQ_GET(st->buf_queue);
bp->b_resid = bp->b_bcount;
if (st->flags & ST_EIO_PENDING) {
bp->b_error = EIO;
@@ -1331,10 +1331,10 @@ ststart(struct scsipi_periph *periph)
* HBA driver
*/
#ifdef DIAGNOSTIC
- if (BUFQ_GET(&st->buf_queue) != bp)
+ if (BUFQ_GET(st->buf_queue) != bp)
panic("ststart(): dequeued wrong buf");
#else
- BUFQ_GET(&st->buf_queue);
+ BUFQ_GET(st->buf_queue);
#endif
error = scsipi_execute_xs(xs);
/* with a scsipi_xfer preallocated, scsipi_command can't fail */
diff --git a/sys/dev/scsipi/stvar.h b/sys/dev/scsipi/stvar.h
index 39504b8f738..75ade8a23a5 100644
--- a/sys/dev/scsipi/stvar.h
+++ b/sys/dev/scsipi/stvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: stvar.h,v 1.14 2005/08/07 12:25:08 blymn Exp $ */
+/* $NetBSD: stvar.h,v 1.15 2005/10/15 17:29:26 yamt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -146,7 +146,7 @@ struct st_softc {
* additional sense data needed
* for mode sense/select.
*/
- struct bufq_state buf_queue; /* the queue of pending IO */
+ struct bufq_state *buf_queue; /* the queue of pending IO */
/* operations */
struct callout sc_callout; /* restarting the queue after */
/* transient error */
diff --git a/sys/dev/vme/xd.c b/sys/dev/vme/xd.c
index 4abf38d668a..58689c2922f 100644
--- a/sys/dev/vme/xd.c
+++ b/sys/dev/vme/xd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.57 2005/06/03 22:01:01 tsutsui Exp $ */
+/* $NetBSD: xd.c,v 1.58 2005/10/15 17:29:26 yamt Exp $ */
/*
*
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.57 2005/06/03 22:01:01 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.58 2005/10/15 17:29:26 yamt Exp $");
#undef XDC_DEBUG /* full debug */
#define XDC_DIAG /* extra sanity checks */
@@ -634,7 +634,7 @@ xdcattach(parent, self, aux)
/* init queue of waiting bufs */
- bufq_alloc(&xdc->sc_wq, BUFQ_FCFS);
+ bufq_alloc(&xdc->sc_wq, "fcfs", 0);
callout_init(&xdc->sc_tick_ch);
/*
@@ -1303,7 +1303,7 @@ xdstrategy(bp)
/* first, give jobs in front of us a chance */
parent = xd->parent;
- while (parent->nfree > 0 && BUFQ_PEEK(&parent->sc_wq) != NULL)
+ while (parent->nfree > 0 && BUFQ_PEEK(parent->sc_wq) != NULL)
if (xdc_startbuf(parent, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1312,7 +1312,7 @@ xdstrategy(bp)
*/
if (parent->nfree == 0) {
- BUFQ_PUT(&parent->sc_wq, bp);
+ BUFQ_PUT(parent->sc_wq, bp);
splx(s);
return;
}
@@ -1364,7 +1364,7 @@ xdcintr(v)
/* fill up any remaining iorq's with queue'd buffers */
- while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(xdcsc->sc_wq) != NULL)
if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
break;
@@ -1604,7 +1604,7 @@ xdc_startbuf(xdcsc, xdsc, bp)
/* get buf */
if (bp == NULL) {
- bp = BUFQ_GET(&xdcsc->sc_wq);
+ bp = BUFQ_GET(xdcsc->sc_wq);
if (bp == NULL)
panic("xdc_startbuf bp");
xdsc = xdcsc->sc_drives[DISKUNIT(bp->b_dev)];
@@ -1634,7 +1634,7 @@ xdc_startbuf(xdcsc, xdsc, bp)
printf("%s: warning: cannot load DMA map\n",
xdcsc->sc_dev.dv_xname);
XDC_FREE(xdcsc, rqno);
- BUFQ_PUT(&xdcsc->sc_wq, bp);
+ BUFQ_PUT(xdcsc->sc_wq, bp);
return (XD_ERR_FAIL); /* XXX: need some sort of
* call-back scheme here? */
}
@@ -1840,7 +1840,7 @@ xdc_piodriver(xdcsc, iorqno, freeone)
/* now that we've drained everything, start up any bufs that have
* queued */
- while (xdcsc->nfree > 0 && BUFQ_PEEK(&xdcsc->sc_wq) != NULL)
+ while (xdcsc->nfree > 0 && BUFQ_PEEK(xdcsc->sc_wq) != NULL)
if (xdc_startbuf(xdcsc, NULL, NULL) != XD_ERR_AOK)
break;
diff --git a/sys/dev/vme/xdvar.h b/sys/dev/vme/xdvar.h
index 337d44ecae6..dda4c88f6a4 100644
--- a/sys/dev/vme/xdvar.h
+++ b/sys/dev/vme/xdvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: xdvar.h,v 1.8 2005/02/04 02:10:49 perry Exp $ */
+/* $NetBSD: xdvar.h,v 1.9 2005/10/15 17:29:26 yamt Exp $ */
/*
*
@@ -154,7 +154,7 @@ struct xdc_softc {
struct xd_iopb *dvmaiopb; /* iopb base in DVMA space, not kvm */
bus_dmamap_t iopmap; /* IOPB DMA handle */
bus_dmamap_t auxmap; /* auxiliary DMA handle */
- struct bufq_state sc_wq; /* queued IOPBs for this controller */
+ struct bufq_state *sc_wq; /* queued 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/dev/vme/xy.c b/sys/dev/vme/xy.c
index b4cc81b3d3c..5b21c4fa059 100644
--- a/sys/dev/vme/xy.c
+++ b/sys/dev/vme/xy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xy.c,v 1.59 2005/06/03 22:00:34 tsutsui Exp $ */
+/* $NetBSD: xy.c,v 1.60 2005/10/15 17:29:26 yamt Exp $ */
/*
*
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.59 2005/06/03 22:00:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.60 2005/10/15 17:29:26 yamt Exp $");
#undef XYC_DEBUG /* full debug */
#undef XYC_DIAG /* extra sanity checks */
@@ -651,7 +651,7 @@ xyattach(parent, self, aux)
/* init queue of waiting bufs */
- bufq_alloc(&xy->xyq, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&xy->xyq, "disksort", BUFQ_SORT_RAWBLOCK);
xy->xyrq = &xyc->reqs[xa->driveno];
@@ -1224,7 +1224,7 @@ xystrategy(bp)
*/
s = splbio(); /* protect the queues */
- BUFQ_PUT(&xy->xyq, bp);
+ BUFQ_PUT(xy->xyq, bp);
/* start 'em up */
@@ -1843,7 +1843,7 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc)
bus_dmamap_unload(xycsc->dmatag, iorq->dmamap);
- (void)BUFQ_GET(&iorq->xy->xyq);
+ (void)BUFQ_GET(iorq->xy->xyq);
disk_unbusy(&xycsc->reqs[lcv].xy->sc_dk,
(xycsc->reqs[lcv].buf->b_bcount -
xycsc->reqs[lcv].buf->b_resid),
@@ -1890,9 +1890,9 @@ xyc_start(xycsc, iorq)
if (iorq == NULL) {
for (lcv = 0; lcv < XYC_MAXDEV ; lcv++) {
if ((xy = xycsc->sc_drives[lcv]) == NULL) continue;
- if (BUFQ_PEEK(&xy->xyq) == NULL) continue;
+ if (BUFQ_PEEK(xy->xyq) == NULL) continue;
if (xy->xyrq->mode != XY_SUB_FREE) continue;
- xyc_startbuf(xycsc, xy, BUFQ_PEEK(&xy->xyq));
+ xyc_startbuf(xycsc, xy, BUFQ_PEEK(xy->xyq));
}
}
xyc_submit_iorq(xycsc, iorq, XY_SUB_NOQ);
@@ -2027,7 +2027,7 @@ xyc_remove_iorq(xycsc)
bus_dmamap_unload(xycsc->dmatag, iorq->dmamap);
- (void)BUFQ_GET(&iorq->xy->xyq);
+ (void)BUFQ_GET(iorq->xy->xyq);
disk_unbusy(&iorq->xy->sc_dk,
(bp->b_bcount - bp->b_resid),
(bp->b_flags & B_READ));
diff --git a/sys/dev/vme/xyvar.h b/sys/dev/vme/xyvar.h
index bec11632ed7..7fc814bdcaf 100644
--- a/sys/dev/vme/xyvar.h
+++ b/sys/dev/vme/xyvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: xyvar.h,v 1.9 2005/02/04 02:10:49 perry Exp $ */
+/* $NetBSD: xyvar.h,v 1.10 2005/10/15 17:29:26 yamt Exp $ */
/*
*
@@ -113,7 +113,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 bufq_state xyq; /* queued I/O requests */
+ struct bufq_state *xyq; /* queued I/O requests */
struct dkbad dkb; /* bad144 sectors */
};
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 77475e3dcf7..f66b96c32be 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.122 2005/08/28 08:56:14 christos Exp $ */
+/* $NetBSD: vnd.c,v 1.123 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.122 2005/08/28 08:56:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.123 2005/10/15 17:29:12 yamt Exp $");
#if defined(_KERNEL_OPT)
#include "fs_nfs.h"
@@ -276,7 +276,7 @@ vndattach(int num)
vnd_softc[i].sc_comp_buff = NULL;
vnd_softc[i].sc_comp_decombuf = NULL;
bufq_alloc(&vnd_softc[i].sc_tab,
- BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ "disksort", BUFQ_SORT_RAWBLOCK);
pseudo_disk_init(&vnd_softc[i].sc_dkdev);
}
}
@@ -292,7 +292,7 @@ vnddetach(void)
return (EBUSY);
for (i = 0; i < numvnd; i++)
- bufq_free(&vnd_softc[i].sc_tab);
+ bufq_free(vnd_softc[i].sc_tab);
free(vnd_softc, M_DEVBUF);
vndattached = 0;
@@ -454,7 +454,7 @@ vndstrategy(struct buf *bp)
if (vnddebug & VDB_FOLLOW)
printf("vndstrategy(%p): unit %d\n", bp, unit);
#endif
- BUFQ_PUT(&vnd->sc_tab, bp);
+ BUFQ_PUT(vnd->sc_tab, bp);
wakeup(&vnd->sc_tab);
splx(s);
return;
@@ -486,7 +486,7 @@ vndthread(void *arg)
* VOP_BMAP/VOP_STRATEGY.
*/
while ((vnd->sc_flags & VNF_VUNCONF) == 0) {
- bp = BUFQ_GET(&vnd->sc_tab);
+ bp = BUFQ_GET(vnd->sc_tab);
if (bp == NULL) {
tsleep(&vnd->sc_tab, PRIBIO, "vndbp", 0);
continue;
@@ -1428,7 +1428,7 @@ vndclear(struct vnd_softc *vnd, int myminor)
fflags |= FWRITE;
s = splbio();
- bufq_drain(&vnd->sc_tab);
+ bufq_drain(vnd->sc_tab);
splx(s);
vnd->sc_flags |= VNF_VUNCONF;
diff --git a/sys/dev/vndvar.h b/sys/dev/vndvar.h
index 1a0d35ecd77..a12d66e5e52 100644
--- a/sys/dev/vndvar.h
+++ b/sys/dev/vndvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vndvar.h,v 1.16 2005/08/19 02:04:03 christos Exp $ */
+/* $NetBSD: vndvar.h,v 1.17 2005/10/15 17:29:12 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@ struct vnd_softc {
struct vnode *sc_vp; /* vnode */
struct ucred *sc_cred; /* credentials */
int sc_maxactive; /* max # of active requests */
- struct bufq_state sc_tab; /* transfer queue */
+ struct bufq_state *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 */
diff --git a/sys/kern/bufq_disksort.c b/sys/kern/bufq_disksort.c
index e8361ffb585..acbdec2a604 100644
--- a/sys/kern/bufq_disksort.c
+++ b/sys/kern/bufq_disksort.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bufq_disksort.c,v 1.3 2004/11/25 04:52:24 yamt Exp $ */
+/* $NetBSD: bufq_disksort.c,v 1.4 2005/10/15 17:29:26 yamt Exp $ */
/* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */
/*-
@@ -75,12 +75,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bufq_disksort.c,v 1.3 2004/11/25 04:52:24 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bufq_disksort.c,v 1.4 2005/10/15 17:29:26 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/bufq.h>
+#include <sys/bufq_impl.h>
#include <sys/malloc.h>
/*
@@ -105,12 +106,12 @@ static void bufq_disksort_init(struct bufq_state *);
static void bufq_disksort_put(struct bufq_state *, struct buf *);
static struct buf *bufq_disksort_get(struct bufq_state *, int);
-BUFQ_DEFINE(disksort, BUFQ_DISKSORT, bufq_disksort_init);
+BUFQ_DEFINE(disksort, 20, bufq_disksort_init);
static void
bufq_disksort_put(struct bufq_state *bufq, struct buf *bp)
{
- struct bufq_disksort *disksort = bufq->bq_private;
+ struct bufq_disksort *disksort = bufq_private(bufq);
struct buf *bq, *nbq;
int sortby;
diff --git a/sys/kern/bufq_fcfs.c b/sys/kern/bufq_fcfs.c
index 4ffbbb35e95..d93c08c2367 100644
--- a/sys/kern/bufq_fcfs.c
+++ b/sys/kern/bufq_fcfs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bufq_fcfs.c,v 1.3 2004/11/25 04:52:24 yamt Exp $ */
+/* $NetBSD: bufq_fcfs.c,v 1.4 2005/10/15 17:29:26 yamt Exp $ */
/* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */
/*-
@@ -75,12 +75,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bufq_fcfs.c,v 1.3 2004/11/25 04:52:24 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bufq_fcfs.c,v 1.4 2005/10/15 17:29:26 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/bufq.h>
+#include <sys/bufq_impl.h>
#include <sys/malloc.h>
/*
@@ -97,7 +98,7 @@ static void bufq_fcfs_init(struct bufq_state *);
static void bufq_fcfs_put(struct bufq_state *, struct buf *);
static struct buf *bufq_fcfs_get(struct bufq_state *, int);
-BUFQ_DEFINE(fcfs, BUFQ_FCFS, bufq_fcfs_init);
+BUFQ_DEFINE(fcfs, 10, bufq_fcfs_init);
static void
bufq_fcfs_put(struct bufq_state *bufq, struct buf *bp)
diff --git a/sys/kern/bufq_priocscan.c b/sys/kern/bufq_priocscan.c
index 6acb73bd0da..32558d8585a 100644
--- a/sys/kern/bufq_priocscan.c
+++ b/sys/kern/bufq_priocscan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bufq_priocscan.c,v 1.4 2005/03/03 05:00:22 yamt Exp $ */
+/* $NetBSD: bufq_priocscan.c,v 1.5 2005/10/15 17:29:26 yamt Exp $ */
/*-
* Copyright (c)2004 YAMAMOTO Takashi,
@@ -27,12 +27,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bufq_priocscan.c,v 1.4 2005/03/03 05:00:22 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bufq_priocscan.c,v 1.5 2005/10/15 17:29:26 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/bufq.h>
+#include <sys/bufq_impl.h>
#include <sys/malloc.h>
/*
@@ -167,7 +168,7 @@ static void bufq_priocscan_init(struct bufq_state *);
static void bufq_priocscan_put(struct bufq_state *, struct buf *);
static struct buf *bufq_priocscan_get(struct bufq_state *, int);
-BUFQ_DEFINE(priocscan, BUFQ_PRIOCSCAN, bufq_priocscan_init);
+BUFQ_DEFINE(priocscan, 40, bufq_priocscan_init);
static __inline struct cscan_queue *bufq_priocscan_selectqueue(
struct bufq_priocscan *, const struct buf *);
diff --git a/sys/kern/bufq_readprio.c b/sys/kern/bufq_readprio.c
index 5cf73948b66..f4826fccc0b 100644
--- a/sys/kern/bufq_readprio.c
+++ b/sys/kern/bufq_readprio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bufq_readprio.c,v 1.3 2004/11/25 04:52:24 yamt Exp $ */
+/* $NetBSD: bufq_readprio.c,v 1.4 2005/10/15 17:29:26 yamt Exp $ */
/* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */
/*-
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bufq_readprio.c,v 1.3 2004/11/25 04:52:24 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bufq_readprio.c,v 1.4 2005/10/15 17:29:26 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -108,7 +108,7 @@ static void bufq_readprio_init(struct bufq_state *);
static void bufq_prio_put(struct bufq_state *, struct buf *);
static struct buf *bufq_prio_get(struct bufq_state *, int);
-BUFQ_DEFINE(readprio, BUFQ_READ_PRIO, bufq_readprio_init);
+BUFQ_DEFINE(readprio, 30, bufq_readprio_init);
static void
bufq_prio_put(struct bufq_state *bufq, struct buf *bp)
diff --git a/sys/kern/subr_bufq.c b/sys/kern/subr_bufq.c
new file mode 100644
index 00000000000..f7aa9acf30b
--- /dev/null
+++ b/sys/kern/subr_bufq.c
@@ -0,0 +1,213 @@
+/* $NetBSD: subr_bufq.c,v 1.1 2005/10/15 17:29:26 yamt Exp $ */
+/* $NetBSD: subr_bufq.c,v 1.1 2005/10/15 17:29:26 yamt Exp $ */
+
+/*-
+ * Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: subr_bufq.c,v 1.1 2005/10/15 17:29:26 yamt Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/bufq.h>
+#include <sys/bufq_impl.h>
+#include <sys/malloc.h>
+
+BUFQ_DEFINE(dummy, 0, NULL); /* so that bufq_strats won't be empty */
+
+#define STRAT_MATCH(id, bs) \
+ ((id) == BUFQ_STRAT_ANY || strcmp((id), (bs)->bs_name) == 0)
+
+/*
+ * Create a device buffer queue.
+ */
+int
+bufq_alloc(struct bufq_state **bufqp, const char *strategy, int flags)
+{
+ __link_set_decl(bufq_strats, const struct bufq_strat);
+ const struct bufq_strat *bsp;
+ const struct bufq_strat * const *it;
+ struct bufq_state *bufq;
+ int error = 0;
+
+ KASSERT((flags & BUFQ_EXACT) == 0 || strategy != BUFQ_STRAT_ANY);
+
+ switch (flags & BUFQ_SORT_MASK) {
+ case BUFQ_SORT_RAWBLOCK:
+ case BUFQ_SORT_CYLINDER:
+ break;
+ case 0:
+ /*
+ * for strategies which don't care about block numbers.
+ * eg. fcfs
+ */
+ flags |= BUFQ_SORT_RAWBLOCK;
+ break;
+ default:
+ panic("bufq_alloc: sort out of range");
+ }
+
+ /*
+ * select strategy.
+ * if a strategy specified by flags is found, use it.
+ * otherwise, select one with the largest bs_prio.
+ */
+ bsp = NULL;
+ __link_set_foreach(it, bufq_strats) {
+ if ((*it) == &bufq_strat_dummy)
+ continue;
+ if (STRAT_MATCH(strategy, (*it))) {
+ bsp = *it;
+ break;
+ }
+ if (bsp == NULL || (*it)->bs_prio > bsp->bs_prio)
+ bsp = *it;
+ }
+
+ if (bsp == NULL) {
+ panic("bufq_alloc: no strategy");
+ }
+ if (!STRAT_MATCH(strategy, bsp)) {
+ if ((flags & BUFQ_EXACT)) {
+ error = ENOENT;
+ goto out;
+ }
+#if defined(DEBUG)
+ printf("bufq_alloc: '%s' is not available. using '%s'.\n",
+ strategy, bsp->bs_name);
+#endif
+ }
+#if defined(BUFQ_DEBUG)
+ /* XXX aprint? */
+ printf("bufq_alloc: using '%s'\n", bsp->bs_name);
+#endif
+
+ *bufqp = bufq = malloc(sizeof(*bufq), M_DEVBUF, M_WAITOK | M_ZERO);
+ bufq->bq_flags = flags;
+ (*bsp->bs_initfn)(bufq);
+
+out:
+ return 0;
+}
+
+void
+bufq_put(struct bufq_state *bufq, struct buf *bp)
+{
+
+ (*bufq->bq_put)(bufq, bp);
+}
+
+struct buf *
+bufq_get(struct bufq_state *bufq)
+{
+
+ return (*bufq->bq_get)(bufq, 1);
+}
+
+struct buf *
+bufq_peek(struct bufq_state *bufq)
+{
+
+ return (*bufq->bq_get)(bufq, 0);
+}
+
+/*
+ * Drain a device buffer queue.
+ */
+void
+bufq_drain(struct bufq_state *bufq)
+{
+ struct buf *bp;
+
+ while ((bp = BUFQ_GET(bufq)) != NULL) {
+ bp->b_error = EIO;
+ bp->b_flags |= B_ERROR;
+ bp->b_resid = bp->b_bcount;
+ biodone(bp);
+ }
+}
+
+/*
+ * Destroy a device buffer queue.
+ */
+void
+bufq_free(struct bufq_state *bufq)
+{
+
+ KASSERT(bufq->bq_private != NULL);
+ KASSERT(BUFQ_PEEK(bufq) == NULL);
+
+ free(bufq->bq_private, M_DEVBUF);
+ free(bufq, M_DEVBUF);
+}
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index ce0c4267ecb..e4aec807d81 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $ */
+/* $NetBSD: subr_disk.c,v 1.71 2005/10/15 17:29:26 yamt Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.71 2005/10/15 17:29:26 yamt Exp $");
#include "opt_compat_netbsd.h"
@@ -82,7 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.70 2005/08/20 12:00:01 yamt Exp $");
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/buf.h>
-#include <sys/bufq.h>
#include <sys/syslog.h>
#include <sys/disklabel.h>
#include <sys/disk.h>
@@ -97,10 +96,6 @@ struct disklist_head disklist = TAILQ_HEAD_INITIALIZER(disklist);
int disk_count; /* number of drives in global disklist */
struct simplelock disklist_slock = SIMPLELOCK_INITIALIZER;
-int bufq_disk_default_strat = _BUFQ_DEFAULT;
-
-BUFQ_DEFINE(dummy, 0, NULL); /* so that bufq_strats won't be empty */
-
/*
* Compute checksum for disk label.
*/
@@ -523,93 +518,6 @@ sysctl_hw_diskstats(SYSCTLFN_ARGS)
}
/*
- * Create a device buffer queue.
- */
-void
-bufq_alloc(struct bufq_state *bufq, int flags)
-{
- __link_set_decl(bufq_strats, const struct bufq_strat);
- int methodid;
- const struct bufq_strat *bsp;
- const struct bufq_strat * const *it;
-
- bufq->bq_flags = flags;
- methodid = flags & BUFQ_METHOD_MASK;
-
- switch (flags & BUFQ_SORT_MASK) {
- case BUFQ_SORT_RAWBLOCK:
- case BUFQ_SORT_CYLINDER:
- break;
- case 0:
- if (methodid == BUFQ_FCFS)
- break;
- /* FALLTHROUGH */
- default:
- panic("bufq_alloc: sort out of range");
- }
-
- /*
- * select strategy.
- * if a strategy specified by flags is found, use it.
- * otherwise, select one with the largest id number. XXX
- */
- bsp = NULL;
- __link_set_foreach(it, bufq_strats) {
- if ((*it) == &bufq_strat_dummy)
- continue;
- if (methodid == (*it)->bs_id) {
- bsp = *it;
- break;
- }
- if (bsp == NULL || (*it)->bs_id > bsp->bs_id)
- bsp = *it;
- }
-
- KASSERT(bsp != NULL);
-#ifdef DEBUG
- if (bsp->bs_id != methodid && methodid != _BUFQ_DEFAULT)
- printf("bufq_alloc: method 0x%04x is not available.\n",
- methodid);
-#endif
-#ifdef BUFQ_DEBUG
- /* XXX aprint? */
- printf("bufq_alloc: using %s\n", bsp->bs_name);
-#endif
- (*bsp->bs_initfn)(bufq);
-}
-
-/*
- * Drain a device buffer queue.
- */
-void
-bufq_drain(struct bufq_state *bufq)
-{
- struct buf *bp;
-
- while ((bp = BUFQ_GET(bufq)) != NULL) {
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- biodone(bp);
- }
-}
-
-/*
- * Destroy a device buffer queue.
- */
-void
-bufq_free(struct bufq_state *bufq)
-{
-
- KASSERT(bufq->bq_private != NULL);
- KASSERT(BUFQ_PEEK(bufq) == NULL);
-
- FREE(bufq->bq_private, M_DEVBUF);
- bufq->bq_get = NULL;
- bufq->bq_put = NULL;
-}
-
-/*
* Bounds checking against the media size, used for the raw partition.
* The sector size passed in should currently always be DEV_BSIZE,
* and the media size the size of the device in DEV_BSIZE sectors.
diff --git a/sys/sys/bufq.h b/sys/sys/bufq.h
index 2605dad745a..6131d2d9e48 100644
--- a/sys/sys/bufq.h
+++ b/sys/sys/bufq.h
@@ -1,4 +1,4 @@
-/* $NetBSD: bufq.h,v 1.3 2005/03/31 11:28:53 yamt Exp $ */
+/* $NetBSD: bufq.h,v 1.4 2005/10/15 17:29:26 yamt Exp $ */
/* NetBSD: buf.h,v 1.75 2004/09/18 16:40:11 yamt Exp */
/*-
@@ -79,16 +79,13 @@
#endif
struct buf;
+struct bufq_state;
/*
- * Device driver buffer queue.
+ * Special strategies for bufq_alloc.
*/
-struct bufq_state {
- void (*bq_put)(struct bufq_state *, struct buf *);
- struct buf *(*bq_get)(struct bufq_state *, int);
- void *bq_private;
- int bq_flags; /* Flags from bufq_alloc() */
-};
+#define BUFQ_STRAT_ANY NULL /* let bufq_alloc select one. */
+#define BUFQ_DISK_DEFAULT_STRAT BUFQ_STRAT_ANY /* default for disks. */
/*
* Flags for bufq_alloc.
@@ -96,63 +93,22 @@ struct bufq_state {
#define BUFQ_SORT_RAWBLOCK 0x0001 /* Sort by b_rawblkno */
#define BUFQ_SORT_CYLINDER 0x0002 /* Sort by b_cylinder, b_rawblkno */
-#define _BUFQ_DEFAULT 0x00f0 /* Let bufq_alloc() choose strategy */
-#define BUFQ_FCFS 0x0010 /* First-come first-serve */
-#define BUFQ_DISKSORT 0x0020 /* Min seek sort */
-#define BUFQ_READ_PRIO 0x0030 /* Min seek and read priority */
-#define BUFQ_PRIOCSCAN 0x0040 /* Per-priority CSCAN */
-
#define BUFQ_SORT_MASK 0x000f
-#define BUFQ_METHOD_MASK 0x00f0
-extern int bufq_disk_default_strat;
-#define BUFQ_DISK_DEFAULT_STRAT() bufq_disk_default_strat
-void bufq_alloc(struct bufq_state *, int);
+#define BUFQ_EXACT 0x0010 /* Don't fall back to other strategy */
+
+int bufq_alloc(struct bufq_state **, const char *, int);
void bufq_drain(struct bufq_state *);
void bufq_free(struct bufq_state *);
+void bufq_put(struct bufq_state *, struct buf *);
+struct buf *bufq_get(struct bufq_state *);
+struct buf *bufq_peek(struct bufq_state *);
-#define BUFQ_PUT(bufq, bp) \
- (*(bufq)->bq_put)((bufq), (bp)) /* Put buffer in queue */
-#define BUFQ_GET(bufq) \
- (*(bufq)->bq_get)((bufq), 1) /* Get and remove buffer from queue */
-#define BUFQ_PEEK(bufq) \
- (*(bufq)->bq_get)((bufq), 0) /* Get buffer from queue */
-
-static __inline int buf_inorder(const struct buf *, const struct buf *, int)
- __unused;
-
-#include <sys/null.h> /* for NULL */
-
-/*
- * Check if two buf's are in ascending order.
- */
-static __inline int
-buf_inorder(const struct buf *bp, const struct buf *bq, int sortby)
-{
-
- if (bp == NULL || bq == NULL)
- return (bq == NULL);
-
- if (sortby == BUFQ_SORT_CYLINDER) {
- if (bp->b_cylinder != bq->b_cylinder)
- return bp->b_cylinder < bq->b_cylinder;
- else
- return bp->b_rawblkno < bq->b_rawblkno;
- } else
- return bp->b_rawblkno < bq->b_rawblkno;
-}
-
-struct bufq_strat {
- const char *bs_name;
- void (*bs_initfn)(struct bufq_state *);
- int bs_id;
-};
+/* Put buffer in queue */
+#define BUFQ_PUT(bufq, bp) bufq_put(bufq, bp)
-#define BUFQ_DEFINE(name, id, initfn) \
-static const struct bufq_strat bufq_strat_##name = { \
- .bs_name = #name, \
- .bs_id = id, \
- .bs_initfn = initfn \
-}; \
-__link_set_add_rodata(bufq_strats, bufq_strat_##name)
+/* Get and remove buffer from queue */
+#define BUFQ_GET(bufq) bufq_get(bufq)
+/* Get buffer from queue */
+#define BUFQ_PEEK(bufq) bufq_get(bufq)
diff --git a/sys/sys/bufq_impl.h b/sys/sys/bufq_impl.h
new file mode 100644
index 00000000000..e28ab4b373b
--- /dev/null
+++ b/sys/sys/bufq_impl.h
@@ -0,0 +1,136 @@
+/* $NetBSD: bufq_impl.h,v 1.1 2005/10/15 17:29:26 yamt Exp $ */
+/* NetBSD: bufq.h,v 1.3 2005/03/31 11:28:53 yamt Exp */
+/* NetBSD: buf.h,v 1.75 2004/09/18 16:40:11 yamt Exp */
+
+/*-
+ * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)buf.h 8.9 (Berkeley) 3/30/95
+ */
+
+#if !defined(_KERNEL)
+#error not supposed to be exposed to userland.
+#endif
+
+/*
+ * Device driver buffer queue.
+ */
+struct bufq_state {
+ void (*bq_put)(struct bufq_state *, struct buf *);
+ struct buf *(*bq_get)(struct bufq_state *, int);
+ void *bq_private;
+ int bq_flags; /* Flags from bufq_alloc() */
+};
+
+static __inline void *bufq_private(const struct bufq_state *) __unused;
+static __inline int buf_inorder(const struct buf *, const struct buf *, int)
+ __unused;
+
+#include <sys/null.h> /* for NULL */
+
+static __inline void *
+bufq_private(const struct bufq_state *bufq)
+{
+
+ return bufq->bq_private;
+}
+
+/*
+ * Check if two buf's are in ascending order.
+ */
+static __inline int
+buf_inorder(const struct buf *bp, const struct buf *bq, int sortby)
+{
+
+ if (bp == NULL || bq == NULL)
+ return (bq == NULL);
+
+ if (sortby == BUFQ_SORT_CYLINDER) {
+ if (bp->b_cylinder != bq->b_cylinder)
+ return bp->b_cylinder < bq->b_cylinder;
+ else
+ return bp->b_rawblkno < bq->b_rawblkno;
+ } else
+ return bp->b_rawblkno < bq->b_rawblkno;
+}
+
+struct bufq_strat {
+ const char *bs_name;
+ void (*bs_initfn)(struct bufq_state *);
+ int bs_prio;
+};
+
+#define BUFQ_DEFINE(name, prio, initfn) \
+static const struct bufq_strat bufq_strat_##name = { \
+ .bs_name = #name, \
+ .bs_prio = prio, \
+ .bs_initfn = initfn \
+}; \
+__link_set_add_rodata(bufq_strats, bufq_strat_##name)
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index 011cf0f2728..acaf7f77ba6 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mfs_vfsops.c,v 1.69 2005/09/23 12:10:34 jmmv Exp $ */
+/* $NetBSD: mfs_vfsops.c,v 1.70 2005/10/15 17:29:32 yamt Exp $ */
/*
* Copyright (c) 1989, 1990, 1993, 1994
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.69 2005/09/23 12:10:34 jmmv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.70 2005/10/15 17:29:32 yamt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -191,11 +191,11 @@ mfs_mountroot(void)
mfsp->mfs_vnode = rootvp;
mfsp->mfs_proc = NULL; /* indicate kernel space */
mfsp->mfs_shutdown = 0;
- bufq_alloc(&mfsp->mfs_buflist, BUFQ_FCFS);
+ bufq_alloc(&mfsp->mfs_buflist, "fcfs", 0);
if ((error = ffs_mountfs(rootvp, mp, p)) != 0) {
mp->mnt_op->vfs_refcount--;
vfs_unbusy(mp);
- bufq_free(&mfsp->mfs_buflist);
+ bufq_free(mfsp->mfs_buflist);
free(mp, M_MOUNT);
free(mfsp, M_MFSNODE);
return (error);
@@ -320,7 +320,7 @@ mfs_mount(struct mount *mp, const char *path, void *data,
mfsp->mfs_vnode = devvp;
mfsp->mfs_proc = p;
mfsp->mfs_shutdown = 0;
- bufq_alloc(&mfsp->mfs_buflist, BUFQ_FCFS);
+ bufq_alloc(&mfsp->mfs_buflist, "fcfs", 0);
if ((error = ffs_mountfs(devvp, mp, p)) != 0) {
mfsp->mfs_shutdown = 1;
vrele(devvp);
@@ -367,7 +367,7 @@ mfs_start(struct mount *mp, int flags, struct proc *p)
l = curlwp;
base = mfsp->mfs_baseoff;
while (mfsp->mfs_shutdown != 1) {
- while ((bp = BUFQ_GET(&mfsp->mfs_buflist)) != NULL) {
+ while ((bp = BUFQ_GET(mfsp->mfs_buflist)) != NULL) {
mfs_doio(bp, base);
wakeup((caddr_t)bp);
}
@@ -394,8 +394,8 @@ mfs_start(struct mount *mp, int flags, struct proc *p)
sleepreturn = tsleep(vp, mfs_pri, "mfsidl", 0);
}
- KASSERT(BUFQ_PEEK(&mfsp->mfs_buflist) == NULL);
- bufq_free(&mfsp->mfs_buflist);
+ KASSERT(BUFQ_PEEK(mfsp->mfs_buflist) == NULL);
+ bufq_free(mfsp->mfs_buflist);
return (sleepreturn);
}
diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c
index 5aa6f52e90d..3c49061570d 100644
--- a/sys/ufs/mfs/mfs_vnops.c
+++ b/sys/ufs/mfs/mfs_vnops.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mfs_vnops.c,v 1.39 2005/08/30 22:01:12 xtraeme Exp $ */
+/* $NetBSD: mfs_vnops.c,v 1.40 2005/10/15 17:29:32 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.39 2005/08/30 22:01:12 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfs_vnops.c,v 1.40 2005/10/15 17:29:32 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -171,7 +171,7 @@ mfs_strategy(void *v)
bp->b_resid = 0;
biodone(bp);
} else {
- BUFQ_PUT(&mfsp->mfs_buflist, bp);
+ BUFQ_PUT(mfsp->mfs_buflist, bp);
wakeup((caddr_t)vp);
}
return (0);
@@ -241,7 +241,7 @@ mfs_close(void *v)
/*
* Finish any pending I/O requests.
*/
- while ((bp = BUFQ_GET(&mfsp->mfs_buflist)) != NULL) {
+ while ((bp = BUFQ_GET(mfsp->mfs_buflist)) != NULL) {
mfs_doio(bp, mfsp->mfs_baseoff);
wakeup((caddr_t)bp);
}
@@ -258,7 +258,7 @@ mfs_close(void *v)
*/
if (vp->v_usecount > 1)
printf("mfs_close: ref count %d > 1\n", vp->v_usecount);
- if (vp->v_usecount > 1 || BUFQ_PEEK(&mfsp->mfs_buflist) != NULL)
+ if (vp->v_usecount > 1 || BUFQ_PEEK(mfsp->mfs_buflist) != NULL)
panic("mfs_close");
/*
* Send a request to the filesystem server to exit.
@@ -282,9 +282,9 @@ mfs_inactive(void *v)
struct vnode *vp = ap->a_vp;
struct mfsnode *mfsp = VTOMFS(vp);
- if (BUFQ_PEEK(&mfsp->mfs_buflist) != NULL)
+ if (BUFQ_PEEK(mfsp->mfs_buflist) != NULL)
panic("mfs_inactive: not inactive (mfs_buflist %p)",
- BUFQ_PEEK(&mfsp->mfs_buflist));
+ BUFQ_PEEK(mfsp->mfs_buflist));
VOP_UNLOCK(vp, 0);
return (0);
}
diff --git a/sys/ufs/mfs/mfsnode.h b/sys/ufs/mfs/mfsnode.h
index 368a019c9e4..982db3fc8ec 100644
--- a/sys/ufs/mfs/mfsnode.h
+++ b/sys/ufs/mfs/mfsnode.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mfsnode.h,v 1.15 2004/11/09 08:46:08 yamt Exp $ */
+/* $NetBSD: mfsnode.h,v 1.16 2005/10/15 17:29:32 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -45,7 +45,7 @@ struct mfsnode {
struct proc *mfs_proc; /* supporting process */
int mfs_shutdown; /* shutdown this mfsnode */
#if defined(_KERNEL)
- struct bufq_state mfs_buflist; /* list of I/O requests */
+ struct bufq_state *mfs_buflist;/* list of I/O requests */
#endif /* defined(_KERNEL) */
};
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index fc6d16fbacf..08949a72378 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.95 2005/09/17 14:51:50 yamt Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.96 2005/10/15 17:29:32 yamt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Matthew R. Green
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.95 2005/09/17 14:51:50 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.96 2005/10/15 17:29:32 yamt Exp $");
#include "fs_nfs.h"
#include "opt_uvmhist.h"
@@ -142,7 +142,7 @@ struct swapdev {
int swd_bsize; /* blocksize (bytes) */
int swd_maxactive; /* max active i/o reqs */
- struct bufq_state swd_tab; /* buffer list */
+ struct bufq_state *swd_tab; /* buffer list */
int swd_active; /* number of active buffers */
};
@@ -595,12 +595,12 @@ sys_swapctl(struct lwp *l, void *v, register_t *retval)
sdp->swd_flags = SWF_FAKE;
sdp->swd_vp = vp;
sdp->swd_dev = (vp->v_type == VBLK) ? vp->v_rdev : NODEV;
- bufq_alloc(&sdp->swd_tab, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
+ bufq_alloc(&sdp->swd_tab, "disksort", BUFQ_SORT_RAWBLOCK);
simple_lock(&uvm.swap_data_lock);
if (swaplist_find(vp, 0) != NULL) {
error = EBUSY;
simple_unlock(&uvm.swap_data_lock);
- bufq_free(&sdp->swd_tab);
+ bufq_free(sdp->swd_tab);
free(sdp, M_VMSWAP);
free(spp, M_VMSWAP);
break;
@@ -625,7 +625,7 @@ sys_swapctl(struct lwp *l, void *v, register_t *retval)
(void) swaplist_find(vp, 1); /* kill fake entry */
swaplist_trim();
simple_unlock(&uvm.swap_data_lock);
- bufq_free(&sdp->swd_tab);
+ bufq_free(sdp->swd_tab);
free(sdp->swd_path, M_VMSWAP);
free(sdp, M_VMSWAP);
break;
@@ -1023,7 +1023,7 @@ swap_off(struct proc *p, struct swapdev *sdp)
extent_free(swapmap, sdp->swd_drumoffset, sdp->swd_drumsize,
EX_WAITOK);
blist_destroy(sdp->swd_blist);
- bufq_free(&sdp->swd_tab);
+ bufq_free(sdp->swd_tab);
free(sdp, M_VMSWAP);
return (0);
}
@@ -1278,7 +1278,7 @@ sw_reg_strategy(struct swapdev *sdp, struct buf *bp, int bn)
vnx->vx_pending++;
/* sort it in and start I/O if we are not over our limit */
- BUFQ_PUT(&sdp->swd_tab, &nbp->vb_buf);
+ BUFQ_PUT(sdp->swd_tab, &nbp->vb_buf);
sw_reg_start(sdp);
splx(s);
@@ -1322,7 +1322,7 @@ sw_reg_start(struct swapdev *sdp)
sdp->swd_flags |= SWF_BUSY;
while (sdp->swd_active < sdp->swd_maxactive) {
- bp = BUFQ_GET(&sdp->swd_tab);
+ bp = BUFQ_GET(sdp->swd_tab);
if (bp == NULL)
break;
sdp->swd_active++;