Move from the old buf.b_actf to the new TAILQ(buf.b_act).

This commit is contained in:
Poul-Henning Kamp 1996-05-03 14:57:27 +00:00
parent 03b225a354
commit 17542807e5
10 changed files with 72 additions and 89 deletions

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.86 1996/04/07 17:32:12 bde Exp $
* $Id: fd.c,v 1.87 1996/04/08 19:40:56 smpatel Exp $
*
*/
@ -581,6 +581,7 @@ fdattach(struct isa_device *dev)
fdc->state = DEVIDLE;
/* reset controller, turn motor off, clear fdout mirror reg */
outb(fdc->baseport + FDOUT, ((fdc->fdout = 0)));
TAILQ_INIT(&fdc->head);
/* check for each floppy drive */
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
@ -1126,7 +1127,6 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
void
fdstrategy(struct buf *bp)
{
register struct buf *dp;
long nblocks, blknum;
int s;
fdcu_t fdcu;
@ -1187,9 +1187,8 @@ fdstrategy(struct buf *bp)
}
bp->b_cylin = blknum / (fd->ft->sectrac * fd->ft->heads);
bp->b_pblkno = bp->b_blkno;
dp = &(fdc->head);
s = splbio();
disksort(dp, bp);
tqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */
fdstart(fdcu);
splx(s);
@ -1227,11 +1226,10 @@ fd_timeout(void *arg1)
fdcu_t fdcu = (fdcu_t)arg1;
fdu_t fdu = fdc_data[fdcu].fdu;
int baseport = fdc_data[fdcu].baseport;
struct buf *dp, *bp;
struct buf *bp;
int s;
dp = &fdc_data[fdcu].head;
bp = dp->b_actf;
bp = TAILQ_FIRST(&fdc_data[fdcu].head);
/*
* Due to IBM's brain-dead design, the FDC has a faked ready
@ -1314,14 +1312,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
unsigned long blknum;
fdu_t fdu = fdc->fdu;
fd_p fd;
register struct buf *dp, *bp;
register struct buf *bp;
struct fd_formb *finfo = NULL;
size_t fdblk;
dp = &(fdc->head);
bp = dp->b_actf;
if(!bp)
{
bp = TAILQ_EMPTY(&fdc->head);
if(!bp) {
/***********************************************\
* nothing left for this controller to do *
* Force into the IDLE state, *
@ -1619,7 +1615,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
/* ALL DONE */
fd->skip = 0;
bp->b_resid = 0;
dp->b_actf = bp->b_actf;
TAILQ_REMOVE(&fdc->head, bp, b_act);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@ -1727,10 +1723,9 @@ retrier(fdcu)
fdcu_t fdcu;
{
fdc_p fdc = fdc_data + fdcu;
register struct buf *dp, *bp;
register struct buf *bp;
dp = &(fdc->head);
bp = dp->b_actf;
bp = TAILQ_FIRST(&fdc->head);
if(fd_data[FDUNIT(minor(bp->b_dev))].options & FDOPT_NORETRY)
goto fail;
@ -1774,7 +1769,7 @@ retrier(fdcu)
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount - fdc->fd->skip;
dp->b_actf = bp->b_actf;
TAILQ_REMOVE(&fdc->head, bp, b_act);
fdc->fd->skip = 0;
biodone(bp);
fdc->state = FINDWORK;

View File

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.75 1996/03/28 14:28:45 scrappy Exp $
* $Id: mcd.c,v 1.76 1996/04/07 17:32:14 bde Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -66,6 +66,7 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <sys/devfsext.h>
#endif /*DEVFS*/
#include <machine/spl.h>
#include <machine/clock.h>
#include <i386/i386/cons.h>
@ -157,7 +158,7 @@ static struct mcd_data {
short curr_mode;
struct mcd_read2 lastpb;
short debug;
struct buf head; /* head of buf queue */
struct buf_queue_head head; /* head of buf queue */
struct mcd_mbx mbx;
#ifdef DEVFS
void *ra_devfs_token; /* store the devfs handle here */
@ -427,7 +428,6 @@ void
mcdstrategy(struct buf *bp)
{
struct mcd_data *cd;
struct buf *qp;
int s;
int unit = mcd_unit(bp->b_dev);
@ -479,9 +479,8 @@ MCD_TRACE("strategy: drive not valid\n");
}
/* queue it */
qp = &cd->head;
s = splbio();
disksort(qp,bp);
tqdisksort(&cd->head, bp);
splx(s);
/* now check whether we can perform processing */
@ -499,8 +498,8 @@ done:
static void mcd_start(int unit)
{
struct mcd_data *cd = mcd_data + unit;
struct buf *bp, *qp = &cd->head;
struct partition *p;
struct buf *bp;
register s = splbio();
if (cd->flags & MCDMBXBSY) {
@ -508,10 +507,11 @@ static void mcd_start(int unit)
return;
}
if ((bp = qp->b_actf) != 0) {
bp = TAILQ_FIRST(&cd->head);
if (bp != 0) {
/* block found to process, dequeue */
/*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/
qp->b_actf = bp->b_actf; /* changed from: bp->av_forw <se> */
TAILQ_REMOVE(&cd->head, bp, b_act);
splx(s);
} else {
/* nothing to do */

View File

@ -41,7 +41,7 @@
*/
/* $Id: scd.c,v 1.17 1996/01/15 10:28:32 phk Exp $ */
/* $Id: scd.c,v 1.18 1996/03/28 14:28:50 scrappy Exp $ */
/* Please send any comments to micke@dynas.se */
@ -142,7 +142,7 @@ static struct scd_data {
struct ioc_play_msf last_play;
short audio_status;
struct buf head; /* head of buf queue */
struct buf_queue_head head; /* head of buf queue */
struct scd_mbx mbx;
#ifdef DEVFS
void *ra_devfs_token;
@ -351,7 +351,6 @@ static void
scdstrategy(struct buf *bp)
{
struct scd_data *cd;
struct buf *qp;
int s;
int unit = scd_unit(bp->b_dev);
@ -396,9 +395,8 @@ scdstrategy(struct buf *bp)
bp->b_resid = 0;
/* queue it */
qp = &cd->head;
s = splbio();
disksort(qp,bp);
tqdisksort(&cd->head, bp);
splx(s);
/* now check whether we can perform processing */
@ -417,7 +415,7 @@ static void
scd_start(int unit)
{
struct scd_data *cd = scd_data + unit;
struct buf *bp, *qp = &cd->head;
struct buf *bp;
struct partition *p;
register s = splbio();
@ -426,9 +424,10 @@ scd_start(int unit)
return;
}
if ((bp = qp->b_actf) != 0) {
bp = TAILQ_FIRST(&cd->head);
if (bp != 0) {
/* block found to process, dequeue */
qp->b_actf = bp->b_actf;
TAILQ_REMOVE(&cd->head, bp, b_act);
cd->flags |= SCDMBXBSY;
splx(s);
} else {

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.86 1996/04/07 17:32:12 bde Exp $
* $Id: fd.c,v 1.87 1996/04/08 19:40:56 smpatel Exp $
*
*/
@ -581,6 +581,7 @@ fdattach(struct isa_device *dev)
fdc->state = DEVIDLE;
/* reset controller, turn motor off, clear fdout mirror reg */
outb(fdc->baseport + FDOUT, ((fdc->fdout = 0)));
TAILQ_INIT(&fdc->head);
/* check for each floppy drive */
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
@ -1126,7 +1127,6 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
void
fdstrategy(struct buf *bp)
{
register struct buf *dp;
long nblocks, blknum;
int s;
fdcu_t fdcu;
@ -1187,9 +1187,8 @@ fdstrategy(struct buf *bp)
}
bp->b_cylin = blknum / (fd->ft->sectrac * fd->ft->heads);
bp->b_pblkno = bp->b_blkno;
dp = &(fdc->head);
s = splbio();
disksort(dp, bp);
tqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */
fdstart(fdcu);
splx(s);
@ -1227,11 +1226,10 @@ fd_timeout(void *arg1)
fdcu_t fdcu = (fdcu_t)arg1;
fdu_t fdu = fdc_data[fdcu].fdu;
int baseport = fdc_data[fdcu].baseport;
struct buf *dp, *bp;
struct buf *bp;
int s;
dp = &fdc_data[fdcu].head;
bp = dp->b_actf;
bp = TAILQ_FIRST(&fdc_data[fdcu].head);
/*
* Due to IBM's brain-dead design, the FDC has a faked ready
@ -1314,14 +1312,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
unsigned long blknum;
fdu_t fdu = fdc->fdu;
fd_p fd;
register struct buf *dp, *bp;
register struct buf *bp;
struct fd_formb *finfo = NULL;
size_t fdblk;
dp = &(fdc->head);
bp = dp->b_actf;
if(!bp)
{
bp = TAILQ_EMPTY(&fdc->head);
if(!bp) {
/***********************************************\
* nothing left for this controller to do *
* Force into the IDLE state, *
@ -1619,7 +1615,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
/* ALL DONE */
fd->skip = 0;
bp->b_resid = 0;
dp->b_actf = bp->b_actf;
TAILQ_REMOVE(&fdc->head, bp, b_act);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@ -1727,10 +1723,9 @@ retrier(fdcu)
fdcu_t fdcu;
{
fdc_p fdc = fdc_data + fdcu;
register struct buf *dp, *bp;
register struct buf *bp;
dp = &(fdc->head);
bp = dp->b_actf;
bp = TAILQ_FIRST(&fdc->head);
if(fd_data[FDUNIT(minor(bp->b_dev))].options & FDOPT_NORETRY)
goto fail;
@ -1774,7 +1769,7 @@ retrier(fdcu)
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount - fdc->fd->skip;
dp->b_actf = bp->b_actf;
TAILQ_REMOVE(&fdc->head, bp, b_act);
fdc->fd->skip = 0;
biodone(bp);
fdc->state = FINDWORK;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fdc.h,v 1.4 1994/10/10 01:12:26 phk Exp $
* $Id: fdc.h,v 1.5 1995/01/06 15:19:41 joerg Exp $
*
*/
@ -62,7 +62,7 @@ struct fdc_data
u_long status[7]; /* copy of the registers */
enum fdc_type fdct; /* chip version of FDC */
int fdc_errs; /* number of logged errors */
struct buf head; /* Head of buf chain */
struct buf_queue_head head; /* Head of buf chain */
};
/***********************************************************************\

View File

@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: mcd.c,v 1.75 1996/03/28 14:28:45 scrappy Exp $
* $Id: mcd.c,v 1.76 1996/04/07 17:32:14 bde Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@ -66,6 +66,7 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <sys/devfsext.h>
#endif /*DEVFS*/
#include <machine/spl.h>
#include <machine/clock.h>
#include <i386/i386/cons.h>
@ -157,7 +158,7 @@ static struct mcd_data {
short curr_mode;
struct mcd_read2 lastpb;
short debug;
struct buf head; /* head of buf queue */
struct buf_queue_head head; /* head of buf queue */
struct mcd_mbx mbx;
#ifdef DEVFS
void *ra_devfs_token; /* store the devfs handle here */
@ -427,7 +428,6 @@ void
mcdstrategy(struct buf *bp)
{
struct mcd_data *cd;
struct buf *qp;
int s;
int unit = mcd_unit(bp->b_dev);
@ -479,9 +479,8 @@ MCD_TRACE("strategy: drive not valid\n");
}
/* queue it */
qp = &cd->head;
s = splbio();
disksort(qp,bp);
tqdisksort(&cd->head, bp);
splx(s);
/* now check whether we can perform processing */
@ -499,8 +498,8 @@ done:
static void mcd_start(int unit)
{
struct mcd_data *cd = mcd_data + unit;
struct buf *bp, *qp = &cd->head;
struct partition *p;
struct buf *bp;
register s = splbio();
if (cd->flags & MCDMBXBSY) {
@ -508,10 +507,11 @@ static void mcd_start(int unit)
return;
}
if ((bp = qp->b_actf) != 0) {
bp = TAILQ_FIRST(&cd->head);
if (bp != 0) {
/* block found to process, dequeue */
/*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/
qp->b_actf = bp->b_actf; /* changed from: bp->av_forw <se> */
TAILQ_REMOVE(&cd->head, bp, b_act);
splx(s);
} else {
/* nothing to do */

View File

@ -41,7 +41,7 @@
*/
/* $Id: scd.c,v 1.17 1996/01/15 10:28:32 phk Exp $ */
/* $Id: scd.c,v 1.18 1996/03/28 14:28:50 scrappy Exp $ */
/* Please send any comments to micke@dynas.se */
@ -142,7 +142,7 @@ static struct scd_data {
struct ioc_play_msf last_play;
short audio_status;
struct buf head; /* head of buf queue */
struct buf_queue_head head; /* head of buf queue */
struct scd_mbx mbx;
#ifdef DEVFS
void *ra_devfs_token;
@ -351,7 +351,6 @@ static void
scdstrategy(struct buf *bp)
{
struct scd_data *cd;
struct buf *qp;
int s;
int unit = scd_unit(bp->b_dev);
@ -396,9 +395,8 @@ scdstrategy(struct buf *bp)
bp->b_resid = 0;
/* queue it */
qp = &cd->head;
s = splbio();
disksort(qp,bp);
tqdisksort(&cd->head, bp);
splx(s);
/* now check whether we can perform processing */
@ -417,7 +415,7 @@ static void
scd_start(int unit)
{
struct scd_data *cd = scd_data + unit;
struct buf *bp, *qp = &cd->head;
struct buf *bp;
struct partition *p;
register s = splbio();
@ -426,9 +424,10 @@ scd_start(int unit)
return;
}
if ((bp = qp->b_actf) != 0) {
bp = TAILQ_FIRST(&cd->head);
if (bp != 0) {
/* block found to process, dequeue */
qp->b_actf = bp->b_actf;
TAILQ_REMOVE(&cd->head, bp, b_act);
cd->flags |= SCDMBXBSY;
splx(s);
} else {

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.106 1996/04/18 21:37:43 phk Exp $
* $Id: wd.c,v 1.107 1996/05/02 10:43:10 phk Exp $
*/
/* TODO:
@ -1196,7 +1196,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
if ((du->dk_flags & DKFL_BSDLABEL) == 0) {
/*
* wdtab[ctrlr].b_active != 0 implies XXX applicable now ??
* drive_queue[lunit].b_actf == NULL (?) XXX applicable now ??
* drive_queue[lunit].b_act == NULL (?) XXX applicable now ??
* so the following guards most things (until the next i/o).
* It doesn't guard against a new i/o starting and being
* affected by the label being changed. Sigh.

View File

@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.86 1996/04/07 17:32:12 bde Exp $
* $Id: fd.c,v 1.87 1996/04/08 19:40:56 smpatel Exp $
*
*/
@ -581,6 +581,7 @@ fdattach(struct isa_device *dev)
fdc->state = DEVIDLE;
/* reset controller, turn motor off, clear fdout mirror reg */
outb(fdc->baseport + FDOUT, ((fdc->fdout = 0)));
TAILQ_INIT(&fdc->head);
/* check for each floppy drive */
for (fdup = isa_biotab_fdc; fdup->id_driver != 0; fdup++) {
@ -1126,7 +1127,6 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
void
fdstrategy(struct buf *bp)
{
register struct buf *dp;
long nblocks, blknum;
int s;
fdcu_t fdcu;
@ -1187,9 +1187,8 @@ fdstrategy(struct buf *bp)
}
bp->b_cylin = blknum / (fd->ft->sectrac * fd->ft->heads);
bp->b_pblkno = bp->b_blkno;
dp = &(fdc->head);
s = splbio();
disksort(dp, bp);
tqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, (caddr_t)fdu); /* a good idea */
fdstart(fdcu);
splx(s);
@ -1227,11 +1226,10 @@ fd_timeout(void *arg1)
fdcu_t fdcu = (fdcu_t)arg1;
fdu_t fdu = fdc_data[fdcu].fdu;
int baseport = fdc_data[fdcu].baseport;
struct buf *dp, *bp;
struct buf *bp;
int s;
dp = &fdc_data[fdcu].head;
bp = dp->b_actf;
bp = TAILQ_FIRST(&fdc_data[fdcu].head);
/*
* Due to IBM's brain-dead design, the FDC has a faked ready
@ -1314,14 +1312,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
unsigned long blknum;
fdu_t fdu = fdc->fdu;
fd_p fd;
register struct buf *dp, *bp;
register struct buf *bp;
struct fd_formb *finfo = NULL;
size_t fdblk;
dp = &(fdc->head);
bp = dp->b_actf;
if(!bp)
{
bp = TAILQ_EMPTY(&fdc->head);
if(!bp) {
/***********************************************\
* nothing left for this controller to do *
* Force into the IDLE state, *
@ -1619,7 +1615,7 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
/* ALL DONE */
fd->skip = 0;
bp->b_resid = 0;
dp->b_actf = bp->b_actf;
TAILQ_REMOVE(&fdc->head, bp, b_act);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@ -1727,10 +1723,9 @@ retrier(fdcu)
fdcu_t fdcu;
{
fdc_p fdc = fdc_data + fdcu;
register struct buf *dp, *bp;
register struct buf *bp;
dp = &(fdc->head);
bp = dp->b_actf;
bp = TAILQ_FIRST(&fdc->head);
if(fd_data[FDUNIT(minor(bp->b_dev))].options & FDOPT_NORETRY)
goto fail;
@ -1774,7 +1769,7 @@ retrier(fdcu)
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
bp->b_resid = bp->b_bcount - fdc->fd->skip;
dp->b_actf = bp->b_actf;
TAILQ_REMOVE(&fdc->head, bp, b_act);
fdc->fd->skip = 0;
biodone(bp);
fdc->state = FINDWORK;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fdc.h,v 1.4 1994/10/10 01:12:26 phk Exp $
* $Id: fdc.h,v 1.5 1995/01/06 15:19:41 joerg Exp $
*
*/
@ -62,7 +62,7 @@ struct fdc_data
u_long status[7]; /* copy of the registers */
enum fdc_type fdct; /* chip version of FDC */
int fdc_errs; /* number of logged errors */
struct buf head; /* Head of buf chain */
struct buf_queue_head head; /* Head of buf chain */
};
/***********************************************************************\