Convert to new device buffer queue interface.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
This commit is contained in:
hannken 2002-07-26 13:19:52 +00:00
parent 5c5e3f7e79
commit c32ed76dba
8 changed files with 57 additions and 57 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ct.c,v 1.28 2002/03/15 05:55:35 gmcgarry Exp $ */
/* $NetBSD: ct.c,v 1.29 2002/07/26 13:19:52 hannken Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.28 2002/03/15 05:55:35 gmcgarry Exp $");
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.29 2002/07/26 13:19:52 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -118,7 +118,7 @@ struct ct_softc {
struct ct_ulcmd sc_ul;
struct ct_wfmcmd sc_wfm;
struct ct_clearcmd sc_clear;
struct buf_queue sc_tab;
struct bufq_state sc_tab;
int sc_active;
struct buf *sc_bp;
struct buf sc_bufstore; /* XXX */
@ -227,7 +227,7 @@ ctattach(parent, self, aux)
sc->sc_slave = ha->ha_slave;
sc->sc_punit = ha->ha_punit;
BUFQ_INIT(&sc->sc_tab);
bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
/* Initialize hpib job queue entry. */
sc->sc_hq.hq_softc = sc;
@ -506,7 +506,7 @@ ctstrategy(bp)
sc = ct_cd.cd_devs[unit];
s = splbio();
BUFQ_INSERT_TAIL(&sc->sc_tab, bp);
BUFQ_PUT(&sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
ctustart(sc);
@ -520,7 +520,7 @@ ctustart(sc)
{
struct buf *bp;
bp = BUFQ_FIRST(&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))
@ -538,7 +538,7 @@ ctstart(arg)
ctlr = sc->sc_dev.dv_parent->dv_unit;
slave = sc->sc_slave;
bp = BUFQ_FIRST(&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:
@ -649,7 +649,7 @@ ctgo(arg)
struct buf *bp;
int rw;
bp = BUFQ_FIRST(&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);
@ -745,7 +745,7 @@ ctintr(arg)
slave = sc->sc_slave;
unit = sc->sc_dev.dv_unit;
bp = BUFQ_FIRST(&sc->sc_tab);
bp = BUFQ_PEEK(&sc->sc_tab);
if (bp == NULL) {
printf("%s: bp == NULL\n", sc->sc_dev.dv_xname);
return;
@ -882,10 +882,10 @@ ctdone(sc, bp)
struct buf *bp;
{
BUFQ_REMOVE(&sc->sc_tab, bp);
(void)BUFQ_GET(&sc->sc_tab);
biodone(bp);
hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
if (BUFQ_FIRST(&sc->sc_tab) == NULL) {
if (BUFQ_PEEK(&sc->sc_tab) == NULL) {
sc->sc_active = 0;
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mt.c,v 1.16 2002/03/15 05:55:36 gmcgarry Exp $ */
/* $NetBSD: mt.c,v 1.17 2002/07/26 13:19:53 hannken 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.16 2002/03/15 05:55:36 gmcgarry Exp $");
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.17 2002/07/26 13:19:53 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -116,7 +116,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 buf_queue sc_tab;/* buf queue */
struct bufq_state sc_tab;/* buf queue */
int sc_active;
struct buf sc_bufstore; /* XXX buffer storage */
};
@ -185,7 +185,7 @@ mtattach(parent, self, aux)
hpibno = parent->dv_unit;
slave = ha->ha_slave;
BUFQ_INIT(&sc->sc_tab);
bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
callout_init(&sc->sc_start_ch);
callout_init(&sc->sc_intr_ch);
@ -513,7 +513,7 @@ mtstrategy(bp)
}
}
s = splbio();
BUFQ_INSERT_TAIL(&sc->sc_tab, bp);
BUFQ_PUT(&sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
mtustart(sc);
@ -564,7 +564,7 @@ mtstart(arg)
dlog(LOG_DEBUG, "%s start", sc->sc_dev.dv_xname);
sc->sc_flags &= ~MTF_WRT;
bp = BUFQ_FIRST(&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;
@ -745,10 +745,10 @@ errdone:
bp->b_flags |= B_ERROR;
done:
sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
BUFQ_REMOVE(&sc->sc_tab, bp);
(void)BUFQ_GET(&sc->sc_tab);
biodone(bp);
hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
if ((bp = BUFQ_FIRST(&sc->sc_tab)) == NULL)
if ((bp = BUFQ_PEEK(&sc->sc_tab)) == NULL)
sc->sc_active = 0;
else
mtustart(sc);
@ -768,7 +768,7 @@ mtgo(arg)
int rw;
dlog(LOG_DEBUG, "%s go", sc->sc_dev.dv_xname);
bp = BUFQ_FIRST(&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);
@ -783,7 +783,7 @@ mtintr(arg)
int i;
u_char cmdbuf[4];
bp = BUFQ_FIRST(&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;
@ -930,10 +930,10 @@ mtintr(arg)
cmdbuf[0] = MTE_COMPLETE | MTE_IDLE;
(void) hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_ECMD, cmdbuf, 1);
bp->b_flags &= ~B_CMD;
BUFQ_REMOVE(&sc->sc_tab, bp);
(void)BUFQ_GET(&sc->sc_tab);
biodone(bp);
hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
if (BUFQ_FIRST(&sc->sc_tab) == NULL)
if (BUFQ_PEEK(&sc->sc_tab) == NULL)
sc->sc_active = 0;
else
mtustart(sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rd.c,v 1.49 2002/04/08 21:41:44 gmcgarry Exp $ */
/* $NetBSD: rd.c,v 1.50 2002/07/26 13:19:53 hannken Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.49 2002/04/08 21:41:44 gmcgarry Exp $");
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.50 2002/07/26 13:19:53 hannken Exp $");
#include "opt_useleds.h"
#include "rnd.h"
@ -326,7 +326,7 @@ rdattach(parent, self, aux)
struct rd_softc *sc = (struct rd_softc *)self;
struct hpibbus_attach_args *ha = aux;
BUFQ_INIT(&sc->sc_tab);
bufq_alloc(&sc->sc_tab, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
if (rdident(parent, sc, ha) == 0) {
printf("\n%s: didn't respond to describe command!\n",
@ -714,7 +714,7 @@ rdstrategy(bp)
}
bp->b_rawblkno = bn + offset;
s = splbio();
disksort_blkno(&rs->sc_tab, bp);
BUFQ_PUT(&rs->sc_tab, bp);
if (rs->sc_active == 0) {
rs->sc_active = 1;
rdustart(rs);
@ -745,7 +745,7 @@ rdustart(rs)
{
struct buf *bp;
bp = BUFQ_FIRST(&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))
@ -759,11 +759,11 @@ rdfinish(rs, bp)
{
rs->sc_errcnt = 0;
BUFQ_REMOVE(&rs->sc_tab, bp);
(void)BUFQ_GET(&rs->sc_tab);
bp->b_resid = 0;
biodone(bp);
hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
if ((bp = BUFQ_FIRST(&rs->sc_tab)) != NULL)
if ((bp = BUFQ_PEEK(&rs->sc_tab)) != NULL)
return (bp);
rs->sc_active = 0;
if (rs->sc_flags & RDF_WANTED) {
@ -778,7 +778,7 @@ rdstart(arg)
void *arg;
{
struct rd_softc *rs = arg;
struct buf *bp = BUFQ_FIRST(&rs->sc_tab);
struct buf *bp = BUFQ_PEEK(&rs->sc_tab);
int part, ctlr, slave;
ctlr = rs->sc_dev.dv_parent->dv_unit;
@ -857,7 +857,7 @@ rdgo(arg)
void *arg;
{
struct rd_softc *rs = arg;
struct buf *bp = BUFQ_FIRST(&rs->sc_tab);
struct buf *bp = BUFQ_PEEK(&rs->sc_tab);
int rw, ctlr, slave;
ctlr = rs->sc_dev.dv_parent->dv_unit;
@ -881,7 +881,7 @@ rdintr(arg)
{
struct rd_softc *rs = arg;
int unit = rs->sc_dev.dv_unit;
struct buf *bp = BUFQ_FIRST(&rs->sc_tab);
struct buf *bp = BUFQ_PEEK(&rs->sc_tab);
u_char stat = 13; /* in case hpibrecv fails */
int rv, restart, ctlr, slave;
@ -1053,7 +1053,7 @@ rderror(unit)
* Note that not all errors report a block number, in that case
* we just use b_blkno.
*/
bp = BUFQ_FIRST(&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)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: rdvar.h,v 1.10 2000/10/10 19:58:43 he Exp $ */
/* $NetBSD: rdvar.h,v 1.11 2002/07/26 13:19:53 hannken Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -80,7 +80,7 @@ struct rd_softc {
struct rd_ssmcmd sc_ssmc;
struct rd_srcmd sc_src;
struct rd_clearcmd sc_clear;
struct buf_queue sc_tab;
struct bufq_state sc_tab;
int sc_active;
int sc_errcnt;
struct rdstats sc_stats;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.50 2002/03/15 05:52:54 gmcgarry Exp $ */
/* $NetBSD: sd.c,v 1.51 2002/07/26 13:19:53 hannken Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.50 2002/03/15 05:52:54 gmcgarry Exp $");
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.51 2002/07/26 13:19:53 hannken Exp $");
#include "rnd.h"
#include "opt_useleds.h"
@ -240,7 +240,7 @@ sdattach(parent, self, aux)
struct sd_softc *sc = (struct sd_softc *)self;
struct oscsi_attach_args *osa = aux;
BUFQ_INIT(&sc->sc_tab);
bufq_alloc(&sc->sc_tab, BUFQ_DISKSORT|BUFQ_SORT_RAWBLOCK);
/*
* XXX formerly 0 meant unused but now pid 0 can legitimately
@ -793,7 +793,7 @@ sdstrategy(bp)
bp->b_rawblkno = (bn + offset) >> sc->sc_bshift;
}
s = splbio();
disksort_blkno(&sc->sc_tab, bp);
BUFQ_PUT(&sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
sdustart(unit);
@ -883,11 +883,11 @@ sdfinish(sc, bp)
{
sc->sc_errcnt = 0;
BUFQ_REMOVE(&sc->sc_tab, bp);
(void)BUFQ_GET(&sc->sc_tab);
bp->b_resid = 0;
biodone(bp);
scsifree(sc->sc_dev.dv_parent, &sc->sc_sq);
if (BUFQ_FIRST(&sc->sc_tab) != NULL)
if (BUFQ_PEEK(&sc->sc_tab) != NULL)
sdustart(sc->sc_dev.dv_unit);
else {
sc->sc_active = 0;
@ -909,7 +909,7 @@ sdstart(arg)
* so check now.
*/
if (sc->sc_format_pid >= 0 && legal_cmds[sc->sc_cmdstore.cdb[0]] > 0) {
struct buf *bp = BUFQ_FIRST(&sc->sc_tab);
struct buf *bp = BUFQ_PEEK(&sc->sc_tab);
int sts;
sc->sc_errcnt = 0;
@ -939,7 +939,7 @@ sdgo(arg)
void *arg;
{
struct sd_softc *sc = arg;
struct buf *bp = BUFQ_FIRST(&sc->sc_tab);
struct buf *bp = BUFQ_PEEK(&sc->sc_tab);
int pad;
struct scsi_fmt_cdb *cmd;
@ -997,7 +997,7 @@ sdintr(arg, stat)
int stat;
{
struct sd_softc *sc = arg;
struct buf *bp = BUFQ_FIRST(&sc->sc_tab);
struct buf *bp = BUFQ_PEEK(&sc->sc_tab);
int cond;
if (bp == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: sdvar.h,v 1.9 2000/10/10 19:58:43 he Exp $ */
/* $NetBSD: sdvar.h,v 1.10 2002/07/26 13:19:53 hannken Exp $ */
/*
* Copyright (c) 1990, 1993
@ -58,7 +58,7 @@ struct sd_softc {
int sc_blksize; /* device block size in bytes */
u_int sc_heads; /* number of heads (tracks) */
u_int sc_cyls; /* number of cylinders */
struct buf_queue sc_tab;/* buffer queue */
struct bufq_state sc_tab;/* buffer queue */
int sc_active; /* number of active requests */
int sc_errcnt; /* error count for current transfer */
struct sdstats sc_stats; /* debugging stats */

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.31 2002/03/15 05:55:37 gmcgarry Exp $ */
/* $NetBSD: st.c,v 1.32 2002/07/26 13:19:53 hannken Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.31 2002/03/15 05:55:37 gmcgarry Exp $");
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.32 2002/07/26 13:19:53 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -268,7 +268,7 @@ stattach(parent, self, aux)
printf("\n");
BUFQ_INIT(&sc->sc_tab);
bufq_alloc(&sc->sc_tab, BUFQ_FCFS);
memset(vendor, 0, sizeof(vendor));
memset(product, 0, sizeof(product));
@ -704,7 +704,7 @@ ststrategy(bp)
sc = st_cd.cd_devs[unit];
s = splbio();
BUFQ_INSERT_TAIL(&sc->sc_tab, bp);
BUFQ_PUT(&sc->sc_tab, bp);
if (sc->sc_active == 0) {
sc->sc_active = 1;
stustart(unit);
@ -738,7 +738,7 @@ stgo(arg)
{
struct st_softc *sc = arg;
struct scsi_fmt_cdb *cmd;
struct buf *bp = BUFQ_FIRST(&sc->sc_tab);
struct buf *bp = BUFQ_PEEK(&sc->sc_tab);
int pad, stat;
long nblks;
@ -821,10 +821,10 @@ stfinish(sc, bp)
{
sc->sc_errcnt = 0;
BUFQ_REMOVE(&sc->sc_tab, bp);
(void)BUFQ_GET(&sc->sc_tab);
biodone(bp);
scsifree(sc->sc_dev.dv_parent, &sc->sc_sq);
if (BUFQ_FIRST(&sc->sc_tab) != NULL)
if (BUFQ_PEEK(&sc->sc_tab) != NULL)
stustart(sc->sc_dev.dv_unit);
else
sc->sc_active = 0;
@ -955,7 +955,7 @@ stintr(arg, stat)
{
struct st_softc *sc = arg;
struct st_xsense *xp = &sc->sc_sense;
struct buf *bp = BUFQ_FIRST(&sc->sc_tab);
struct buf *bp = BUFQ_PEEK(&sc->sc_tab);
#ifdef DEBUG
if (bp == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: stvar.h,v 1.7 2000/01/21 23:29:04 thorpej Exp $ */
/* $NetBSD: stvar.h,v 1.8 2002/07/26 13:19:53 hannken Exp $ */
/*
* Copyright (c) 1990 University of Utah.
@ -197,7 +197,7 @@ struct st_softc {
u_char sc_cmd;
struct st_xsense sc_sense;
struct scsi_fmt_cdb sc_cmdstore;
struct buf_queue sc_tab;/* buffer queue */
struct bufq_state sc_tab;/* buffer queue */
int sc_active; /* transfer is active */
int sc_errcnt; /* error count for this transfer */
struct buf sc_bufstore; /* XXX buffer storage */