From 045b17cf00de7ddf9b7ce771dbbfe3fd35b09eaa Mon Sep 17 00:00:00 2001 From: gibbs Date: Sun, 21 Sep 1997 22:03:22 +0000 Subject: Convert to use the new bufq* functions for dealing with buffer queues. --- sys/scsi/cd.c | 10 +++++----- sys/scsi/od.c | 10 +++++----- sys/scsi/pt.c | 10 +++++----- sys/scsi/scsi_base.c | 3 ++- sys/scsi/scsiconf.h | 8 +++++++- sys/scsi/sctarg.c | 8 ++++---- sys/scsi/sd.c | 12 ++++++------ sys/scsi/st.c | 10 +++++----- sys/scsi/worm.c | 10 +++++----- 9 files changed, 44 insertions(+), 37 deletions(-) (limited to 'sys/scsi') diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 368dcfa..bf21e9c 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.84 1997/09/02 20:06:30 bde Exp $ + * $Id: cd.c,v 1.85 1997/09/07 15:06:06 joerg Exp $ */ #include "opt_bounce.h" @@ -179,7 +179,7 @@ cdattach(struct scsi_link *sc_link) unit = sc_link->dev_unit; dp = &(cd->params); - TAILQ_INIT(&cd->buf_queue); + bufq_init(&cd->buf_queue); if (sc_link->opennings > CDOUTSTANDING) sc_link->opennings = CDOUTSTANDING; /* @@ -432,7 +432,7 @@ cd_strategy(struct buf *bp, struct scsi_link *sc_link) /* * Place it in the queue of disk activities for this disk */ - TAILQ_INSERT_TAIL(&cd->buf_queue, bp, b_act); + bufq_insert_tail(&cd->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -494,11 +494,11 @@ cdstart(unit, flags) return; /* give the special that's waiting a chance to run */ } - bp = cd->buf_queue.tqh_first; + bp = bufq_first(&cd->buf_queue); if (bp == NULL) { /* yes, an assign */ return; } - TAILQ_REMOVE( &cd->buf_queue, bp, b_act); + bufq_remove(&cd->buf_queue, bp); /* * Should reject all queued entries if SDEV_MEDIA_LOADED is not true. diff --git a/sys/scsi/od.c b/sys/scsi/od.c index 7c983eb..2fa229c 100644 --- a/sys/scsi/od.c +++ b/sys/scsi/od.c @@ -28,7 +28,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $Id: od.c,v 1.30 1997/03/24 11:25:01 bde Exp $ + * $Id: od.c,v 1.31 1997/09/02 20:06:32 bde Exp $ */ /* @@ -209,7 +209,7 @@ odattach(struct scsi_link *sc_link) if (sc_link->opennings > ODOUTSTANDING) sc_link->opennings = ODOUTSTANDING; - TAILQ_INIT(&od->buf_queue); + bufq_init(&od->buf_queue); /* * Use the subdriver to request information regarding * the drive. We cannot use interrupts yet, so the @@ -520,7 +520,7 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link) /* * Place it in the queue of disk activities for this disk */ - TAILQ_INSERT_TAIL(&od->buf_queue, bp, b_act); + bufq_insert_tail(&od->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -595,11 +595,11 @@ odstart(u_int32_t unit, u_int32_t flags) /* * See if there is a buf with work for us to do.. */ - bp = od->buf_queue.tqh_first; + bp = bufq_first(&od->buf_queue); if (bp == NULL) { /* yes, an assign */ return; } - TAILQ_REMOVE( &od->buf_queue, bp, b_act); + bufq_remove(&od->buf_queue, bp); /* * If the device has become invalid, abort all the diff --git a/sys/scsi/pt.c b/sys/scsi/pt.c index 9aa1692..ccb6f1d 100644 --- a/sys/scsi/pt.c +++ b/sys/scsi/pt.c @@ -37,7 +37,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pt.c,v 1.22 1997/05/21 19:35:10 joerg Exp $ + * $Id: pt.c,v 1.23 1997/09/02 20:06:32 bde Exp $ */ #include "opt_bounce.h" @@ -104,7 +104,7 @@ ptattach(struct scsi_link *sc_link) { struct scsi_data *pt = sc_link->sd; - TAILQ_INIT(&pt->buf_queue); + bufq_init(&pt->buf_queue); return 0; } @@ -155,11 +155,11 @@ ptstart(unit, flags) return; } - bp = pt->buf_queue.tqh_first; + bp = bufq_first(&pt->buf_queue); if (bp == NULL) { /* yes, an assign */ return; } - TAILQ_REMOVE( &pt->buf_queue, bp, b_act); + bufq_remove(&pt->buf_queue, bp); /* * Fill out the scsi command @@ -220,7 +220,7 @@ pt_strategy(struct buf *bp, struct scsi_link *sc_link) * at the end (a bit silly because we only have one user.. * (but it could fork() )) */ - TAILQ_INSERT_TAIL( &pt->buf_queue, bp, b_act); + bufq_insert_tail(&pt->buf_queue, bp); /* * Tell the device to get going on the transfer if it's diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 4d18568..20a8ba9 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -8,7 +8,7 @@ * file. * * Written by Julian Elischer (julian@dialix.oz.au) - * $Id: scsi_base.c,v 1.49 1997/07/25 23:25:20 jdp Exp $ + * $Id: scsi_base.c,v 1.50 1997/09/02 20:06:33 bde Exp $ */ #include "opt_bounce.h" @@ -90,6 +90,7 @@ get_xs(sc_link, flags) printf("cannot allocate scsi xs\n"); return (NULL); } + callout_handle_init(&xs->timeout_ch); } SC_DEBUG(sc_link, SDEV_DB3, ("returning\n")); xs->sc_link = sc_link; diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 489e13f..736955e 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsiconf.h,v 1.55 1997/06/25 19:07:43 tegge Exp $ + * $Id: scsiconf.h,v 1.56 1997/09/07 15:06:08 joerg Exp $ */ #ifndef SCSI_SCSICONF_H #define SCSI_SCSICONF_H 1 @@ -22,6 +22,7 @@ typedef int boolean; typedef int errval; #include +#include /* XXX For ioconf.c */ /* * The following documentation tries to describe the relationship between the @@ -385,6 +386,11 @@ struct scsi_xfer /*84*/ int32_t req_sense_length; /* Explicit request sense length */ /*88*/ int32_t status; /* SCSI status */ /*100*/ struct scsi_generic cmdstore; /* stash the command in here */ + /* + * Handle for scheduling + * command timeouts. + */ + struct callout_handle timeout_ch; }; /* diff --git a/sys/scsi/sctarg.c b/sys/scsi/sctarg.c index 99549be..1900b63 100644 --- a/sys/scsi/sctarg.c +++ b/sys/scsi/sctarg.c @@ -37,7 +37,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sctarg.c,v 1.20 1997/03/23 06:33:51 bde Exp $ + * $Id: sctarg.c,v 1.21 1997/09/02 20:06:36 bde Exp $ */ #include "opt_bounce.h" @@ -187,10 +187,10 @@ sctargstart(unit, unused_flags) return; } - bp = sctarg->buf_queue.tqh_first; + bp = bufq_first(&sctarg->buf_queue); if (bp == NULL) return; - TAILQ_REMOVE(&sctarg->buf_queue, bp, b_act); + bufq_remove(&sctarg->buf_queue, bp); /* * Fill out the scsi command @@ -250,7 +250,7 @@ sctarg_strategy(struct buf *bp, struct scsi_link *sc_link) /* * Place it at the end of the queue of activities for this device. */ - TAILQ_INSERT_TAIL( &sctarg->buf_queue, bp, b_act); + bufq_insert_tail(&sctarg->buf_queue, bp); /* * Tell the device to get going on the transfer if it's diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 13b60cc..1793201 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -15,7 +15,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.109 1997/09/10 12:31:40 joerg Exp $ + * $Id: sd.c,v 1.110 1997/09/13 16:12:15 joerg Exp $ */ #include "opt_bounce.h" @@ -185,7 +185,7 @@ sdattach(struct scsi_link *sc_link) if (sc_link->opennings > SDOUTSTANDING) sc_link->opennings = SDOUTSTANDING; - TAILQ_INIT(&sd->buf_queue); + bufq_init(&sd->buf_queue); /* * Use the subdriver to request information regarding * the drive. We cannot use interrupts yet, so the @@ -490,9 +490,9 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link) * Place it in the queue of disk activities for this disk */ #ifdef SDDISKSORT - tqdisksort(&sd->buf_queue, bp); + bufq_disksort(&sd->buf_queue, bp); #else - TAILQ_INSERT_TAIL(&sd->buf_queue, bp, b_act); + bufq_insert_tail(&sd->buf_queue, bp); #endif /* @@ -567,11 +567,11 @@ sdstart(u_int32_t unit, u_int32_t flags) /* * See if there is a buf with work for us to do.. */ - bp = sd->buf_queue.tqh_first; + bp = bufq_first(&sd->buf_queue); if (bp == NULL) { /* yes, an assign */ return; } - TAILQ_REMOVE(&sd->buf_queue, bp, b_act); + bufq_remove(&sd->buf_queue, bp); /* * If the device has become invalid, abort all the diff --git a/sys/scsi/st.c b/sys/scsi/st.c index c731753..af96017 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: st.c,v 1.80 1997/09/02 20:06:38 bde Exp $ + * $Id: st.c,v 1.81 1997/09/07 10:08:23 joerg Exp $ */ /* @@ -228,7 +228,7 @@ stattach(struct scsi_link *sc_link) unit = sc_link->dev_unit; - TAILQ_INIT(&st->buf_queue); + bufq_init(&st->buf_queue); /* * Check if the drive is a known criminal and take * Any steps needed to bring it into line @@ -816,7 +816,7 @@ st_strategy(struct buf *bp, struct scsi_link *sc_link) * at the end (a bit silly because we only have on user.. * (but it could fork() )) */ - TAILQ_INSERT_TAIL(&st->buf_queue, bp, b_act); + bufq_insert_tail(&st->buf_queue, bp); /* * Tell the device to get going on the transfer if it's @@ -875,11 +875,11 @@ ststart(unit, flags) return; } - bp = st->buf_queue.tqh_first; + bp = bufq_first(&st->buf_queue); if (bp == NULL) { /* yes, an assign */ return; } - TAILQ_REMOVE( &st->buf_queue, bp, b_act); + bufq_remove(&st->buf_queue, bp); /* * if the device has been unmounted by the user diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c index 11d22fc..6bbeddf 100644 --- a/sys/scsi/worm.c +++ b/sys/scsi/worm.c @@ -43,7 +43,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: worm.c,v 1.44 1997/08/01 12:48:35 jmz Exp $ + * $Id: worm.c,v 1.45 1997/09/02 20:06:41 bde Exp $ */ #include "opt_bounce.h" @@ -263,7 +263,7 @@ wormattach(struct scsi_link *sc_link) #endif struct scsi_data *worm = sc_link->sd; - TAILQ_INIT(&worm->buf_queue); + bufq_init(&worm->buf_queue); #ifdef DEVFS mynor = wormunit(sc_link->dev); @@ -337,11 +337,11 @@ wormstart(unit, flags) return; } - bp = worm->buf_queue.tqh_first; + bp = bufq_first(&worm->buf_queue); if (bp == NULL) { /* yes, an assign */ return; } - TAILQ_REMOVE( &worm->buf_queue, bp, b_act); + bufq_remove(&worm->buf_queue, bp); if (((bp->b_flags & B_READ) == B_WRITE) && ((worm->worm_flags & WORMFL_TRACK_PREPED) == 0)) { @@ -468,7 +468,7 @@ worm_strategy(struct buf *bp, struct scsi_link *sc_link) * Place it in the queue of activities for this device * at the end. */ - TAILQ_INSERT_TAIL(&worm->buf_queue, bp, b_act); + bufq_insert_tail(&worm->buf_queue, bp); wormstart(unit, 0); -- cgit v1.1