From fd32202948267d0405b8d37d86718db9143173f8 Mon Sep 17 00:00:00 2001 From: mycroft Date: Mon, 21 Nov 1994 10:39:09 +0000 Subject: [PATCH] Replace dev_unit with device_softc in scsi_link. Change argument to foostart() to void*. --- sys/dev/scsipi/cd.c | 18 +++++++----------- sys/dev/scsipi/ch.c | 4 ++-- sys/dev/scsipi/scsi_base.c | 8 ++++---- sys/dev/scsipi/scsiconf.h | 18 +++++++++--------- sys/dev/scsipi/scsipi_debug.h | 10 ++-------- sys/dev/scsipi/sd.c | 18 +++++++----------- sys/dev/scsipi/st.c | 22 ++++++++-------------- sys/dev/scsipi/uk.c | 4 ++-- sys/scsi/cd.c | 18 +++++++----------- sys/scsi/ch.c | 4 ++-- sys/scsi/scsi_base.c | 8 ++++---- sys/scsi/scsi_debug.h | 10 ++-------- sys/scsi/scsiconf.h | 18 +++++++++--------- sys/scsi/sd.c | 18 +++++++----------- sys/scsi/st.c | 22 ++++++++-------------- sys/scsi/uk.c | 4 ++-- 16 files changed, 82 insertions(+), 122 deletions(-) diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index 17e2470114da..ee9fc01b8245 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.41 1994/11/20 22:36:43 mycroft Exp $ */ +/* $NetBSD: cd.c,v 1.42 1994/11/21 10:39:09 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -110,7 +110,7 @@ struct cfdriver cdcd = { void cdgetdisklabel __P((struct cd_data *)); int cd_get_parms __P((struct cd_data *, int)); void cdstrategy __P((struct buf *)); -void cdstart __P((int)); +void cdstart __P((struct cd_data *)); struct dkdriver cddkdriver = { cdstrategy }; @@ -147,7 +147,7 @@ cdattach(parent, self, aux) */ cd->sc_link = sc_link; sc_link->device = &cd_switch; - sc_link->dev_unit = cd->sc_dev.dv_unit; + sc_link->device_softc = cd; cd->sc_dk.dk_driver = &cddkdriver; #if !defined(i386) || defined(NEWCONFIG) @@ -386,12 +386,9 @@ void cdstrategy(bp) struct buf *bp; { + struct cd_data *cd = cdcd.cd_devs[CDUNIT(bp->b_dev)]; int opri; - struct cd_data *cd; - int unit; - unit = CDUNIT(bp->b_dev); - cd = cdcd.cd_devs[unit]; SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdstrategy ")); SC_DEBUG(cd->sc_link, SDEV_DB1, ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); @@ -444,7 +441,7 @@ cdstrategy(bp) * Tell the device to get going on the transfer if it's * not doing anything, otherwise just wait for completion */ - cdstart(unit); + cdstart(cd); splx(opri); return; @@ -476,10 +473,9 @@ done: * cdstart() is called at splbio from cdstrategy and scsi_done */ void -cdstart(unit) - int unit; +cdstart(cd) + register struct cd_data *cd; { - register struct cd_data *cd = cdcd.cd_devs[unit]; register struct scsi_link *sc_link = cd->sc_link; struct buf *bp = 0; struct buf *dp; diff --git a/sys/dev/scsipi/ch.c b/sys/dev/scsipi/ch.c index 9807e792d1f7..d2c12256c497 100644 --- a/sys/dev/scsipi/ch.c +++ b/sys/dev/scsipi/ch.c @@ -1,4 +1,4 @@ -/* $NetBSD: ch.c,v 1.10 1994/10/30 21:49:18 cgd Exp $ */ +/* $NetBSD: ch.c,v 1.11 1994/11/21 10:39:14 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -112,7 +112,7 @@ chattach(parent, self, aux) */ ch->sc_link = sc_link; sc_link->device = &ch_switch; - sc_link->dev_unit = ch->sc_dev.dv_unit; + sc_link->device_softc = ch; /* * Use the subdriver to request information regarding diff --git a/sys/dev/scsipi/scsi_base.c b/sys/dev/scsipi/scsi_base.c index 4a71bc8a8906..d9e4dae96c6a 100644 --- a/sys/dev/scsipi/scsi_base.c +++ b/sys/dev/scsipi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.16 1994/08/30 17:01:57 deraadt Exp $ */ +/* $NetBSD: scsi_base.c,v 1.17 1994/11/21 10:39:17 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -125,7 +125,7 @@ free_xs(xs, sc_link, flags) } else { if (sc_link->device->start) { SC_DEBUG(sc_link, SDEV_DB2, ("calling private start()\n")); - (*(sc_link->device->start)) (sc_link->dev_unit); + (*(sc_link->device->start)) (sc_link->device_softc); } } } @@ -732,8 +732,8 @@ sc_print_addr(sc_link) struct scsi_link *sc_link; { - printf("%s%d(%s:%d:%d): ", - sc_link->device->name, sc_link->dev_unit, + printf("%s(%s:%d:%d): ", + ((struct device *)sc_link->device_softc)->dv_xname, ((struct device *)sc_link->adapter_softc)->dv_xname, sc_link->target, sc_link->lun); } diff --git a/sys/dev/scsipi/scsiconf.h b/sys/dev/scsipi/scsiconf.h index 196286e74822..75542a34b941 100644 --- a/sys/dev/scsipi/scsiconf.h +++ b/sys/dev/scsipi/scsiconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.h,v 1.15 1994/11/03 22:05:10 mycroft Exp $ */ +/* $NetBSD: scsiconf.h,v 1.16 1994/11/21 10:39:21 mycroft Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. All rights reserved. @@ -147,15 +147,15 @@ struct scsi_link { /* 2*/ u_int8 target; /* targ of this dev */ /* 3*/ u_int8 lun; /* lun of this dev */ /* 4*/ u_int8 adapter_targ; /* what are we on the scsi bus */ -/* 5*/ u_int8 dev_unit; /* e.g. the 0 in sd0 */ -/* 6*/ u_int8 opennings; /* available operations */ -/* 7*/ u_int8 active; /* operations in progress */ -/* 8*/ u_int8 sparea[1]; +/* 5*/ u_int8 opennings; /* available operations */ +/* 6*/ u_int8 active; /* operations in progress */ +/* 8*/ u_int8 sparea[2]; /* 12*/ int flags; /* flags that all devices have */ -/* 16*/ struct scsi_adapter *adapter; /* adapter entry points etc. */ -/* 20*/ struct scsi_device *device; /* device entry points etc. */ -/* 24*/ void *adapter_softc; /* needed for call to foo_scsi_cmd */ -/* 28*/ void *fordriver; /* for private use by the driver */ +/* 16*/ struct scsi_device *device; /* device entry points etc. */ +/* 20*/ void *device_softc; /* needed for call to foo_start */ +/* 24*/ struct scsi_adapter *adapter; /* adapter entry points etc. */ +/* 28*/ void *adapter_softc; /* needed for call to foo_scsi_cmd */ +/* 32*/ void *fordriver; /* for private use by the driver */ }; #define SDEV_MEDIA_LOADED 0x01 /* device figures are still valid */ #define SDEV_WAITING 0x02 /* a process is waiting for this */ diff --git a/sys/dev/scsipi/scsipi_debug.h b/sys/dev/scsipi/scsipi_debug.h index 06a959f15fea..cc487836f5dd 100644 --- a/sys/dev/scsipi/scsipi_debug.h +++ b/sys/dev/scsipi/scsipi_debug.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_debug.h,v 1.3 1994/06/29 06:43:03 cgd Exp $ */ +/* $NetBSD: scsipi_debug.h,v 1.4 1994/11/21 10:39:19 mycroft Exp $ */ /*#define SCSIDEBUG 1*/ /* @@ -29,13 +29,7 @@ #define SC_DEBUG(sc_link,Level,Printstuff) \ if((sc_link)->flags & (Level)) \ { \ - printf("%s%d(%s%d:%d:%d): ", \ - sc_link->device->name, \ - sc_link->dev_unit, \ - sc_link->adapter->name, \ - sc_link->scsibus, \ - sc_link->target, \ - sc_link->lun); \ + sc_print_addr(sc_link); \ printf Printstuff; \ } #define SC_DEBUGN(sc_link,Level,Printstuff) \ diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index 063313e8c8a1..a633a11689eb 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.45 1994/11/20 22:36:48 mycroft Exp $ */ +/* $NetBSD: sd.c,v 1.46 1994/11/21 10:39:25 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -113,7 +113,7 @@ struct cfdriver sdcd = { void sdgetdisklabel __P((struct sd_data *)); int sd_get_parms __P((struct sd_data *, int)); void sdstrategy __P((struct buf *)); -void sdstart __P((int)); +void sdstart __P((struct sd_data *)); struct dkdriver sddkdriver = { sdstrategy }; @@ -146,7 +146,7 @@ sdattach(parent, self, aux) */ sd->sc_link = sc_link; sc_link->device = &sd_switch; - sc_link->dev_unit = self->dv_unit; + sc_link->device_softc = sd; sd->sc_dk.dk_driver = &sddkdriver; #if !defined(i386) || defined(NEWCONFIG) @@ -383,12 +383,9 @@ void sdstrategy(bp) struct buf *bp; { + struct sd_data *sd = sdcd.cd_devs[SDUNIT(bp->b_dev)]; int opri; - struct sd_data *sd; - int unit; - unit = SDUNIT(bp->b_dev); - sd = sdcd.cd_devs[unit]; SC_DEBUG(sd->sc_link, SDEV_DB2, ("sdstrategy ")); SC_DEBUG(sd->sc_link, SDEV_DB1, ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); @@ -444,7 +441,7 @@ sdstrategy(bp) * Tell the device to get going on the transfer if it's * not doing anything, otherwise just wait for completion */ - sdstart(unit); + sdstart(sd); splx(opri); return; @@ -476,10 +473,9 @@ done: * sdstart() is called at splbio from sdstrategy and scsi_done */ void -sdstart(unit) - int unit; +sdstart(sd) + register struct sd_data *sd; { - register struct sd_data *sd = sdcd.cd_devs[unit]; register struct scsi_link *sc_link = sd->sc_link; struct buf *bp = 0; struct buf *dp; diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c index 430394ef2dcd..850f2015f7e2 100644 --- a/sys/dev/scsipi/st.c +++ b/sys/dev/scsipi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.39 1994/10/30 21:49:34 cgd Exp $ */ +/* $NetBSD: st.c,v 1.40 1994/11/21 10:39:30 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -309,7 +309,7 @@ stattach(parent, self, aux) SC_DEBUG(sc_link, SDEV_DB2, ("stattach: ")); sc_link->device = &st_switch; - sc_link->dev_unit = st->sc_dev.dv_unit; + sc_link->device_softc = st; /* * Store information needed to contact our base driver @@ -876,21 +876,17 @@ void ststrategy(bp) struct buf *bp; { + struct st_data *st = stcd.cd_devs[STUNIT(bp->b_dev)]; struct buf *dp; - int unit; int opri; - struct st_data *st; - unit = STUNIT(bp->b_dev); - st = stcd.cd_devs[unit]; SC_DEBUG(st->sc_link, SDEV_DB1, ("ststrategy %d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); /* * If it's a null transfer, return immediatly */ - if (bp->b_bcount == 0) { + if (bp->b_bcount == 0) goto done; - } /* * Odd sized request on fixed drives are verboten */ @@ -931,7 +927,7 @@ ststrategy(bp) * not doing anything, otherwise just wait for completion * (All a bit silly if we're only allowing 1 open but..) */ - ststart(unit); + ststart(st); splx(opri); return; @@ -960,10 +956,9 @@ done: * ststart() is called at splbio */ void -ststart(unit) - int unit; +ststart(st) + struct st_data *st; { - struct st_data *st = stcd.cd_devs[unit]; struct scsi_link *sc_link = st->sc_link; register struct buf *bp, *dp; struct scsi_rw_tape cmd; @@ -1675,8 +1670,7 @@ st_interpret_sense(xs) struct scsi_sense_data *sense = &xs->sense; boolean silent = xs->flags & SCSI_SILENT; struct buf *bp = xs->bp; - int unit = sc_link->dev_unit; - struct st_data *st = stcd.cd_devs[unit]; + struct st_data *st = sc_link->device_softc; u_int key; int info; diff --git a/sys/dev/scsipi/uk.c b/sys/dev/scsipi/uk.c index 199956fcd5d6..710f94feb1d7 100644 --- a/sys/dev/scsipi/uk.c +++ b/sys/dev/scsipi/uk.c @@ -1,4 +1,4 @@ -/* $NetBSD: uk.c,v 1.9 1994/10/30 21:49:39 cgd Exp $ */ +/* $NetBSD: uk.c,v 1.10 1994/11/21 10:39:34 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -88,7 +88,7 @@ ukattach(parent, self, aux) */ uk->sc_link = sc_link; sc_link->device = &uk_switch; - sc_link->dev_unit = uk->sc_dev.dv_unit; + sc_link->device_softc = uk; printf(": unknown device\n"); } diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 17e2470114da..ee9fc01b8245 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.41 1994/11/20 22:36:43 mycroft Exp $ */ +/* $NetBSD: cd.c,v 1.42 1994/11/21 10:39:09 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -110,7 +110,7 @@ struct cfdriver cdcd = { void cdgetdisklabel __P((struct cd_data *)); int cd_get_parms __P((struct cd_data *, int)); void cdstrategy __P((struct buf *)); -void cdstart __P((int)); +void cdstart __P((struct cd_data *)); struct dkdriver cddkdriver = { cdstrategy }; @@ -147,7 +147,7 @@ cdattach(parent, self, aux) */ cd->sc_link = sc_link; sc_link->device = &cd_switch; - sc_link->dev_unit = cd->sc_dev.dv_unit; + sc_link->device_softc = cd; cd->sc_dk.dk_driver = &cddkdriver; #if !defined(i386) || defined(NEWCONFIG) @@ -386,12 +386,9 @@ void cdstrategy(bp) struct buf *bp; { + struct cd_data *cd = cdcd.cd_devs[CDUNIT(bp->b_dev)]; int opri; - struct cd_data *cd; - int unit; - unit = CDUNIT(bp->b_dev); - cd = cdcd.cd_devs[unit]; SC_DEBUG(cd->sc_link, SDEV_DB2, ("cdstrategy ")); SC_DEBUG(cd->sc_link, SDEV_DB1, ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); @@ -444,7 +441,7 @@ cdstrategy(bp) * Tell the device to get going on the transfer if it's * not doing anything, otherwise just wait for completion */ - cdstart(unit); + cdstart(cd); splx(opri); return; @@ -476,10 +473,9 @@ done: * cdstart() is called at splbio from cdstrategy and scsi_done */ void -cdstart(unit) - int unit; +cdstart(cd) + register struct cd_data *cd; { - register struct cd_data *cd = cdcd.cd_devs[unit]; register struct scsi_link *sc_link = cd->sc_link; struct buf *bp = 0; struct buf *dp; diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index 9807e792d1f7..d2c12256c497 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -1,4 +1,4 @@ -/* $NetBSD: ch.c,v 1.10 1994/10/30 21:49:18 cgd Exp $ */ +/* $NetBSD: ch.c,v 1.11 1994/11/21 10:39:14 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -112,7 +112,7 @@ chattach(parent, self, aux) */ ch->sc_link = sc_link; sc_link->device = &ch_switch; - sc_link->dev_unit = ch->sc_dev.dv_unit; + sc_link->device_softc = ch; /* * Use the subdriver to request information regarding diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 4a71bc8a8906..d9e4dae96c6a 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.16 1994/08/30 17:01:57 deraadt Exp $ */ +/* $NetBSD: scsi_base.c,v 1.17 1994/11/21 10:39:17 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -125,7 +125,7 @@ free_xs(xs, sc_link, flags) } else { if (sc_link->device->start) { SC_DEBUG(sc_link, SDEV_DB2, ("calling private start()\n")); - (*(sc_link->device->start)) (sc_link->dev_unit); + (*(sc_link->device->start)) (sc_link->device_softc); } } } @@ -732,8 +732,8 @@ sc_print_addr(sc_link) struct scsi_link *sc_link; { - printf("%s%d(%s:%d:%d): ", - sc_link->device->name, sc_link->dev_unit, + printf("%s(%s:%d:%d): ", + ((struct device *)sc_link->device_softc)->dv_xname, ((struct device *)sc_link->adapter_softc)->dv_xname, sc_link->target, sc_link->lun); } diff --git a/sys/scsi/scsi_debug.h b/sys/scsi/scsi_debug.h index 6505d76ec1ca..04d71fd57c68 100644 --- a/sys/scsi/scsi_debug.h +++ b/sys/scsi/scsi_debug.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_debug.h,v 1.3 1994/06/29 06:43:03 cgd Exp $ */ +/* $NetBSD: scsi_debug.h,v 1.4 1994/11/21 10:39:19 mycroft Exp $ */ /*#define SCSIDEBUG 1*/ /* @@ -29,13 +29,7 @@ #define SC_DEBUG(sc_link,Level,Printstuff) \ if((sc_link)->flags & (Level)) \ { \ - printf("%s%d(%s%d:%d:%d): ", \ - sc_link->device->name, \ - sc_link->dev_unit, \ - sc_link->adapter->name, \ - sc_link->scsibus, \ - sc_link->target, \ - sc_link->lun); \ + sc_print_addr(sc_link); \ printf Printstuff; \ } #define SC_DEBUGN(sc_link,Level,Printstuff) \ diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index 196286e74822..75542a34b941 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.h,v 1.15 1994/11/03 22:05:10 mycroft Exp $ */ +/* $NetBSD: scsiconf.h,v 1.16 1994/11/21 10:39:21 mycroft Exp $ */ /* * Copyright (c) 1993, 1994 Charles Hannum. All rights reserved. @@ -147,15 +147,15 @@ struct scsi_link { /* 2*/ u_int8 target; /* targ of this dev */ /* 3*/ u_int8 lun; /* lun of this dev */ /* 4*/ u_int8 adapter_targ; /* what are we on the scsi bus */ -/* 5*/ u_int8 dev_unit; /* e.g. the 0 in sd0 */ -/* 6*/ u_int8 opennings; /* available operations */ -/* 7*/ u_int8 active; /* operations in progress */ -/* 8*/ u_int8 sparea[1]; +/* 5*/ u_int8 opennings; /* available operations */ +/* 6*/ u_int8 active; /* operations in progress */ +/* 8*/ u_int8 sparea[2]; /* 12*/ int flags; /* flags that all devices have */ -/* 16*/ struct scsi_adapter *adapter; /* adapter entry points etc. */ -/* 20*/ struct scsi_device *device; /* device entry points etc. */ -/* 24*/ void *adapter_softc; /* needed for call to foo_scsi_cmd */ -/* 28*/ void *fordriver; /* for private use by the driver */ +/* 16*/ struct scsi_device *device; /* device entry points etc. */ +/* 20*/ void *device_softc; /* needed for call to foo_start */ +/* 24*/ struct scsi_adapter *adapter; /* adapter entry points etc. */ +/* 28*/ void *adapter_softc; /* needed for call to foo_scsi_cmd */ +/* 32*/ void *fordriver; /* for private use by the driver */ }; #define SDEV_MEDIA_LOADED 0x01 /* device figures are still valid */ #define SDEV_WAITING 0x02 /* a process is waiting for this */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 063313e8c8a1..a633a11689eb 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.45 1994/11/20 22:36:48 mycroft Exp $ */ +/* $NetBSD: sd.c,v 1.46 1994/11/21 10:39:25 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -113,7 +113,7 @@ struct cfdriver sdcd = { void sdgetdisklabel __P((struct sd_data *)); int sd_get_parms __P((struct sd_data *, int)); void sdstrategy __P((struct buf *)); -void sdstart __P((int)); +void sdstart __P((struct sd_data *)); struct dkdriver sddkdriver = { sdstrategy }; @@ -146,7 +146,7 @@ sdattach(parent, self, aux) */ sd->sc_link = sc_link; sc_link->device = &sd_switch; - sc_link->dev_unit = self->dv_unit; + sc_link->device_softc = sd; sd->sc_dk.dk_driver = &sddkdriver; #if !defined(i386) || defined(NEWCONFIG) @@ -383,12 +383,9 @@ void sdstrategy(bp) struct buf *bp; { + struct sd_data *sd = sdcd.cd_devs[SDUNIT(bp->b_dev)]; int opri; - struct sd_data *sd; - int unit; - unit = SDUNIT(bp->b_dev); - sd = sdcd.cd_devs[unit]; SC_DEBUG(sd->sc_link, SDEV_DB2, ("sdstrategy ")); SC_DEBUG(sd->sc_link, SDEV_DB1, ("%d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); @@ -444,7 +441,7 @@ sdstrategy(bp) * Tell the device to get going on the transfer if it's * not doing anything, otherwise just wait for completion */ - sdstart(unit); + sdstart(sd); splx(opri); return; @@ -476,10 +473,9 @@ done: * sdstart() is called at splbio from sdstrategy and scsi_done */ void -sdstart(unit) - int unit; +sdstart(sd) + register struct sd_data *sd; { - register struct sd_data *sd = sdcd.cd_devs[unit]; register struct scsi_link *sc_link = sd->sc_link; struct buf *bp = 0; struct buf *dp; diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 430394ef2dcd..850f2015f7e2 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.39 1994/10/30 21:49:34 cgd Exp $ */ +/* $NetBSD: st.c,v 1.40 1994/11/21 10:39:30 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -309,7 +309,7 @@ stattach(parent, self, aux) SC_DEBUG(sc_link, SDEV_DB2, ("stattach: ")); sc_link->device = &st_switch; - sc_link->dev_unit = st->sc_dev.dv_unit; + sc_link->device_softc = st; /* * Store information needed to contact our base driver @@ -876,21 +876,17 @@ void ststrategy(bp) struct buf *bp; { + struct st_data *st = stcd.cd_devs[STUNIT(bp->b_dev)]; struct buf *dp; - int unit; int opri; - struct st_data *st; - unit = STUNIT(bp->b_dev); - st = stcd.cd_devs[unit]; SC_DEBUG(st->sc_link, SDEV_DB1, ("ststrategy %d bytes @ blk %d\n", bp->b_bcount, bp->b_blkno)); /* * If it's a null transfer, return immediatly */ - if (bp->b_bcount == 0) { + if (bp->b_bcount == 0) goto done; - } /* * Odd sized request on fixed drives are verboten */ @@ -931,7 +927,7 @@ ststrategy(bp) * not doing anything, otherwise just wait for completion * (All a bit silly if we're only allowing 1 open but..) */ - ststart(unit); + ststart(st); splx(opri); return; @@ -960,10 +956,9 @@ done: * ststart() is called at splbio */ void -ststart(unit) - int unit; +ststart(st) + struct st_data *st; { - struct st_data *st = stcd.cd_devs[unit]; struct scsi_link *sc_link = st->sc_link; register struct buf *bp, *dp; struct scsi_rw_tape cmd; @@ -1675,8 +1670,7 @@ st_interpret_sense(xs) struct scsi_sense_data *sense = &xs->sense; boolean silent = xs->flags & SCSI_SILENT; struct buf *bp = xs->bp; - int unit = sc_link->dev_unit; - struct st_data *st = stcd.cd_devs[unit]; + struct st_data *st = sc_link->device_softc; u_int key; int info; diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c index 199956fcd5d6..710f94feb1d7 100644 --- a/sys/scsi/uk.c +++ b/sys/scsi/uk.c @@ -1,4 +1,4 @@ -/* $NetBSD: uk.c,v 1.9 1994/10/30 21:49:39 cgd Exp $ */ +/* $NetBSD: uk.c,v 1.10 1994/11/21 10:39:34 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -88,7 +88,7 @@ ukattach(parent, self, aux) */ uk->sc_link = sc_link; sc_link->device = &uk_switch; - sc_link->dev_unit = uk->sc_dev.dv_unit; + sc_link->device_softc = uk; printf(": unknown device\n"); }