Spring cleaning around strategy and disklabels/slices:

Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout.
please see comment in sys/conf.h about the flag argument.

Remove strategy argument from all the diskslice/label/bad144
implementations, it should be found from the dev_t.

Remove bogus and unused strategy1 routines.

Remove open/close arguments from dssize().  Pick them up from dev_t.

Remove unused and unfinished setgeom support from diskslice/label/bad144 code.
This commit is contained in:
Poul-Henning Kamp 1999-08-14 11:40:51 +00:00
parent 5462f43fb0
commit 49ff4debd3
43 changed files with 244 additions and 397 deletions

View File

@ -36,7 +36,7 @@
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* from: i386/isa Id: diskslice_machdep.c,v 1.31 1998/08/10 07:22:14 phk Exp
* $Id: diskslice_machdep.c,v 1.8 1999/05/14 00:41:02 msmith Exp $
* $Id: diskslice_machdep.c,v 1.9 1999/06/26 02:47:12 mckusick Exp $
*/
#include <sys/param.h>
@ -65,11 +65,10 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, d_strategy_t *strat,
struct disklabel *lp, struct diskslices *ssp,
u_long ext_offset, u_long ext_size,
u_long base_ext_offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
static int
check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
@ -152,10 +151,9 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, strat, lp, sspp)
dsinit(dname, dev, lp, sspp)
char *dname;
dev_t dev;
d_strategy_t *strat;
struct disklabel *lp;
struct diskslices **sspp;
{
@ -184,7 +182,7 @@ dsinit(dname, dev, strat, lp, sspp)
bp->b_blkno = mbr_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -336,7 +334,7 @@ dsinit(dname, dev, strat, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, strat, lp, ssp,
extended(dname, bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -349,12 +347,11 @@ dsinit(dname, dev, strat, lp, sspp)
}
void
extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
d_strategy_t *strat;
struct diskslices *ssp;
u_long ext_offset;
u_long ext_size;
@ -382,7 +379,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_blkno = ext_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -450,7 +447,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, strat, lp, ssp,
extended(dname, dev, lp, ssp,
ext_offsets[dospart], ext_sizes[dospart],
base_ext_offset, nsectors, ntracks,
mbr_offset);

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_cd.c,v 1.22 1999/05/30 16:51:00 phk Exp $
* $Id: scsi_cd.c,v 1.23 1999/05/31 11:23:58 phk Exp $
*/
/*
* Portions of this driver taken from the original FreeBSD cd driver.
@ -180,7 +180,6 @@ static d_open_t cdopen;
static d_close_t cdclose;
static d_ioctl_t cdioctl;
static d_strategy_t cdstrategy;
static d_strategy_t cdstrategy1;
static periph_init_t cdinit;
static periph_ctor_t cdregister;
@ -958,8 +957,7 @@ cdopen(dev_t dev, int flags, int fmt, struct proc *p)
/* Initialize slice tables. */
error = dsopen("cd", dev, fmt, DSO_NOLABELS | DSO_ONESLICE,
&softc->cd_slices, &label, cdstrategy1,
(ds_setgeom_t *)NULL, &cd_cdevsw);
&softc->cd_slices, &label);
if (error == 0) {
/*
@ -1430,16 +1428,6 @@ cdstrategy(struct buf *bp)
return;
}
static void
cdstrategy1(struct buf *bp)
{
/*
* XXX - do something to make cdstrategy() but not this block while
* we're doing dsopen() and dsioctl().
*/
cdstrategy(bp);
}
static void
cdstart(struct cam_periph *periph, union ccb *start_ccb)
{
@ -2464,8 +2452,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
* Check to see whether we've got a disk-type ioctl. If we
* don't, dsioctl will pass back an error code of ENOIOCTL.
*/
error = dsioctl("cd", dev, cmd, addr, flag, &softc->cd_slices,
cdstrategy1, (ds_setgeom_t *)NULL);
error = dsioctl("cd", dev, cmd, addr, flag, &softc->cd_slices);
if (error != ENOIOCTL)
break;

View File

@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: scsi_da.c,v 1.30 1999/07/07 18:14:01 mjacob Exp $
* $Id: scsi_da.c,v 1.31 1999/08/09 10:34:30 phk Exp $
*/
#include "opt_hw_wdog.h"
@ -379,9 +379,7 @@ daopen(dev_t dev, int flags, int fmt, struct proc *p)
}
/* Initialize slice tables. */
error = dsopen("da", dev, fmt, 0, &softc->dk_slices, &label,
dastrategy, (ds_setgeom_t *)NULL,
&da_cdevsw);
error = dsopen("da", dev, fmt, 0, &softc->dk_slices, &label);
/*
* Check to see whether or not the blocksize is set yet.
@ -600,8 +598,7 @@ daioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
return (error); /* error code from tsleep */
}
error = dsioctl("da", dev, cmd, addr, flag, &softc->dk_slices,
dastrategy, (ds_setgeom_t *)NULL);
error = dsioctl("da", dev, cmd, addr, flag, &softc->dk_slices);
if (error == ENOIOCTL)
error = cam_periph_ioctl(periph, cmd, addr, daerror);
@ -775,7 +772,7 @@ dasize(dev_t dev)
softc = (struct da_softc *)periph->softc;
return (dssize(dev, &softc->dk_slices, daopen, daclose));
return (dssize(dev, &softc->dk_slices));
}
static void

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: fla.c,v 1.1 1999/08/06 15:59:07 phk Exp $
* $Id: fla.c,v 1.2 1999/08/07 13:11:12 bde Exp $
*
*/
@ -168,9 +168,10 @@ flaopen(dev_t dev, int flag, int fmt, struct proc *p)
dk_dd.d_secsize = DEV_BSIZE;
dk_dd.d_secpercyl = dk_dd.d_ntracks * dk_dd.d_nsectors;
error = dsopen("fla", dev, fmt, 0, &sc->dk_slices, &dk_dd,
flastrategy, NULL, &fla_cdevsw);
return (error);
error = dsopen("fla", dev, fmt, 0, &sc->dk_slices, &dk_dd);
if (error)
return (error);
return (0);
}
static int
@ -199,8 +200,7 @@ flaioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
dev2ul(dev), cmd, addr, flags, p);
unit = dkunit(dev);
sc = &softc[unit];
error = dsioctl("fla", dev, cmd, addr, flags, &sc->dk_slices,
flastrategy, NULL);
error = dsioctl("fla", dev, cmd, addr, flags, &sc->dk_slices);
if (error == ENOIOCTL)
error = ENOTTY;
return (error);
@ -215,7 +215,7 @@ flastrategy(struct buf *bp)
static int busy;
enum doc2k_work what;
if (fla_debug)
if (fla_debug > 1)
printf("flastrategy(%p) %lx %lx, %d, %ld, %p)\n",
bp, dev2ul(bp->b_dev), bp->b_flags, bp->b_blkno,
bp->b_bcount / DEV_BSIZE, bp->b_data);
@ -261,7 +261,7 @@ flastrategy(struct buf *bp)
error = doc2k_rwe( unit, what, bp->b_pblkno,
bp->b_bcount / DEV_BSIZE, bp->b_data);
if (fla_debug || error) {
if (fla_debug > 1 || error) {
printf("fla%d: %d = rwe(%p, %d, %d, %d, %ld, %p)\n",
unit, error, bp, unit, what, bp->b_pblkno,
bp->b_bcount / DEV_BSIZE, bp->b_data);
@ -294,7 +294,7 @@ flapsize(dev_t dev)
if (!sc->nsect)
return 0;
return (dssize(dev, &sc->dk_slices, flaopen, flaclose));
return (dssize(dev, &sc->dk_slices));
}
static int

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: ata-disk.c,v 1.15 1999/07/17 17:55:53 phk Exp $
* $Id: ata-disk.c,v 1.16 1999/08/10 21:59:57 sos Exp $
*/
#include "ata.h"
@ -97,7 +97,6 @@ static struct cdevsw fakewd_cdevsw;
/* prototypes */
static void ad_attach(void *);
static int32_t ad_getparam(struct ad_softc *);
static void ad_strategy(struct buf *);
static void ad_start(struct ad_softc *);
static void ad_sleep(struct ad_softc *, int8_t *);
static int8_t ad_version(u_int16_t);
@ -316,8 +315,7 @@ printf("adopen: lun=%d adnlun=%d\n", lun, adnlun);
label.d_secpercyl = adp->sectors * adp->heads;
label.d_secperunit = adp->total_secs;
error = dsopen("ad", dev, fmt, 0, &adp->slices, &label, ad_strategy,
(ds_setgeom_t *)NULL, &ad_cdevsw);
error = dsopen("ad", dev, fmt, 0, &adp->slices, &label);
adp->flags &= ~AD_F_LABELLING;
ad_sleep(adp, "adop2");
@ -351,8 +349,7 @@ adioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p)
return ENXIO;
ad_sleep(adp, "adioct");
error = dsioctl("sd", dev, cmd, addr, flags, &adp->slices,
ad_strategy, (ds_setgeom_t *)NULL);
error = dsioctl("sd", dev, cmd, addr, flags, &adp->slices);
if (error != ENOIOCTL)
return error;
@ -403,7 +400,7 @@ adpsize(dev_t dev)
if (lun >= adnlun || !(adp = adtab[lun]))
return -1;
return dssize(dev, &adp->slices, adopen, adclose);
return dssize(dev, &adp->slices);
}
int
@ -477,12 +474,6 @@ addump(dev_t dev)
return 0;
}
static void
ad_strategy(struct buf *bp)
{
adstrategy(bp);
}
static void
ad_start(struct ad_softc *adp)
{

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: atapi-fd.c,v 1.10 1999/05/31 11:24:29 phk Exp $
* $Id: atapi-fd.c,v 1.11 1999/06/25 09:03:05 sos Exp $
*/
#include "ata.h"
@ -95,7 +95,6 @@ static int32_t afdnlun = 0; /* number of config'd drives */
int32_t afdattach(struct atapi_softc *);
static int32_t afd_sense(struct afd_softc *);
static void afd_describe(struct afd_softc *);
static void afd_strategy(struct buf *);
static void afd_start(struct afd_softc *);
static void afd_partial_done(struct atapi_request *);
static void afd_done(struct atapi_request *);
@ -244,8 +243,7 @@ afdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
label.d_secperunit = fdp->cap.heads * fdp->cap.sectors * fdp->cap.cylinders;
/* initialize slice tables. */
return dsopen("afd", dev, fmt, 0, &fdp->slices, &label, afd_strategy,
(ds_setgeom_t *)NULL, &afd_cdevsw);
return dsopen("afd", dev, fmt, 0, &fdp->slices, &label);
}
static int
@ -273,8 +271,7 @@ afdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
if (lun >= afdnlun || !(fdp = afdtab[lun]))
return ENXIO;
error = dsioctl("sd", dev, cmd, addr, flag, &fdp->slices,
afd_strategy, (ds_setgeom_t *)NULL);
error = dsioctl("sd", dev, cmd, addr, flag, &fdp->slices);
if (error != ENOIOCTL)
return error;
@ -317,12 +314,6 @@ afdstrategy(struct buf *bp)
splx(x);
}
static void
afd_strategy(struct buf *bp)
{
afdstrategy(bp);
}
static void
afd_start(struct afd_softc *fdp)
{

View File

@ -1,4 +1,4 @@
/* $Id: ccd.c,v 1.50 1999/07/17 19:58:37 phk Exp $ */
/* $Id: ccd.c,v 1.51 1999/07/18 14:30:57 phk Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@ -1265,7 +1265,7 @@ ccdioctl(dev, cmd, data, flag, p)
if (error == 0) {
if (cmd == DIOCWDINFO)
error = writedisklabel(CCDLABELDEV(dev),
ccdstrategy, &cs->sc_label);
&cs->sc_label);
}
cs->sc_flags &= ~CCDF_LABELLING;
@ -1435,8 +1435,8 @@ ccdgetdisklabel(dev)
/*
* Call the generic disklabel extraction routine.
*/
if ((errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy,
&cs->sc_label)) != NULL)
errstring = readdisklabel(CCDLABELDEV(dev), &cs->sc_label);
if (errstring != NULL)
ccdmakedisklabel(cs);
#ifdef DEBUG

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.150 1999/07/29 01:02:55 mdodd Exp $
* $Id: fd.c,v 1.151 1999/07/29 11:27:33 joerg Exp $
*
*/
@ -2217,7 +2217,7 @@ fdformat(dev, finfo, p)
/* now do the format */
bp->b_dev = dev;
fdstrategy(bp);
BUF_STRATEGY(bp, 0);
/* ...and wait for it to complete */
s = splbio();
@ -2277,7 +2277,7 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
if (readdisklabel(dkmodpart(dev, RAW_PART), dl)
== NULL)
error = 0;
else
@ -2308,8 +2308,7 @@ fdioctl(dev, cmd, addr, flag, p)
(u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
(struct disklabel *)buffer);
error = writedisklabel(dev, (struct disklabel *)buffer);
break;
case FD_FORM:
if ((flag & FWRITE) == 0)

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ida_disk.c,v 1.1 1999/06/24 03:31:57 jlemon Exp $
* $Id: ida_disk.c,v 1.2 1999/07/04 14:58:16 phk Exp $
*/
/*
@ -144,8 +144,7 @@ idopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_secperunit = drv->secperunit;
/* Initialize slice tables. */
error = dsopen("id", dev, fmt, 0, &drv->slices, &label,
idstrategy, (ds_setgeom_t *)NULL, &id_cdevsw);
error = dsopen("id", dev, fmt, 0, &drv->slices, &label);
return (error);
}
@ -172,8 +171,7 @@ idioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
if (drv == NULL)
return (ENXIO);
error = dsioctl("id", dev, cmd, addr, flag, &drv->slices,
idstrategy, (ds_setgeom_t *)NULL);
error = dsioctl("id", dev, cmd, addr, flag, &drv->slices);
if (error == ENOIOCTL)
return (ENOTTY);
@ -189,7 +187,7 @@ idsize(dev_t dev)
drv = idgetsoftc(dev);
if (drv == NULL)
return (ENXIO);
return (dssize(dev, &drv->slices, idopen, idclose));
return (dssize(dev, &drv->slices));
}
/*

View File

@ -34,7 +34,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
* $Id: vinumdaemon.c,v 1.5 1999/06/23 03:22:01 grog Exp grog $
* $Id: vinumdaemon.c,v 1.11 1999/08/07 08:06:05 grog Exp $
*/
#include <dev/vinum/vinumhdr.h>
@ -183,7 +183,7 @@ vinum_daemon(void)
void
recover_io(struct request *rq)
{
vinumstrategy(rq->bp); /* reissue the command */
BUF_STRATEGY(rq->bp, 0); /* reissue the command */
}
/* Functions called to interface with the daemon */

View File

@ -39,7 +39,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
* $Id: vinuminterrupt.c,v 1.6 1999/06/18 00:50:53 grog Exp grog $
* $Id: vinuminterrupt.c,v 1.15 1999/08/14 06:25:52 grog Exp $
*/
#include <dev/vinum/vinumhdr.h>
@ -351,7 +351,7 @@ complete_raid5_write(struct rqelement *rqe)
if (debug & DEBUG_LASTREQS)
logrq(loginfo_raid5_data, (union rqinfou) rqe, bp);
#endif
(*devsw(rqe->b.b_dev)->d_strategy) (&rqe->b);
BUF_STRATEGY(&rqe->b, 0);
}
}
}
@ -387,5 +387,5 @@ complete_raid5_write(struct rqelement *rqe)
if (debug & DEBUG_LASTREQS)
logrq(loginfo_raid5_parity, (union rqinfou) rqe, bp);
#endif
(*devsw(rqe->b.b_dev)->d_strategy) (&rqe->b);
BUF_STRATEGY(&rqe->b, 0);
}

View File

@ -33,7 +33,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
* $Id: vinumio.c,v 1.25 1999/06/28 02:37:48 grog Exp grog $
* $Id: vinumio.c,v 1.37 1999/08/14 06:26:32 grog Exp $
*/
#include <dev/vinum/vinumhdr.h>
@ -836,7 +836,7 @@ write_volume_label(int volno)
*dlp = *lp;
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_WRITE;
vinumstrategy(bp); /* write it out */
BUF_STRATEGY(bp, 0); /* write it out */
error = biowait(bp);
bp->b_flags |= B_INVAL | B_AGE;
brelse(bp);

View File

@ -37,7 +37,7 @@
* otherwise) arising in any way out of the use of this software, even if
* advised of the possibility of such damage.
*
* $Id: vinumrequest.c,v 1.24 1999/07/05 01:53:14 grog Exp grog $
* $Id: vinumrequest.c,v 1.32 1999/08/14 06:30:15 grog Exp $
*/
#include <dev/vinum/vinumhdr.h>
@ -395,7 +395,7 @@ launch_requests(struct request *rq, int reviveok)
logrq(loginfo_rqe, (union rqinfou) rqe, rq->bp);
#endif
/* fire off the request */
(*devsw(rqe->b.b_dev)->d_strategy) (&rqe->b);
BUF_STRATEGY(&rqe->b, 0);
}
}
if (rqg->active) /* we have at least one active request, */
@ -922,7 +922,7 @@ sdio(struct buf *bp)
sbp->b.b_vp->v_numoutput);
#endif
s = splbio();
(*devsw(sbp->b.b_dev)->d_strategy) (&sbp->b);
BUF_STRATEGY(&sbp->b, 0);
splx(s);
}

View File

@ -38,7 +38,7 @@
* from: Utah Hdr: vn.c 1.13 94/04/02
*
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
* $Id: vn.c,v 1.82 1999/08/08 18:42:42 phk Exp $
* $Id: vn.c,v 1.83 1999/08/08 22:01:50 phk Exp $
*/
/*
@ -210,8 +210,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
label.d_partitions[RAW_PART].p_size = vn->sc_size;
return (dsopen("vn", dev, mode, 0, &vn->sc_slices,
&label, vnstrategy, (ds_setgeom_t *)NULL,
&vn_cdevsw));
&label));
}
if (dkslice(dev) != WHOLE_DISK_SLICE ||
dkpart(dev) != RAW_PART ||
@ -362,8 +361,7 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
IFOPT(vn,VN_LABELS) {
if (vn->sc_slices != NULL) {
error = dsioctl("vn", dev, cmd, data, flag,
&vn->sc_slices, vnstrategy,
(ds_setgeom_t *)NULL);
&vn->sc_slices);
if (error != ENOIOCTL)
return (error);
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
* $Id: spec_vnops.c,v 1.94 1999/08/13 10:53:58 phk Exp $
* $Id: spec_vnops.c,v 1.95 1999/08/13 16:29:21 phk Exp $
*/
#include <sys/param.h>
@ -546,7 +546,7 @@ spec_strategy(ap)
if (((bp->b_flags & B_READ) == 0) &&
(LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
(*bioops.io_start)(bp);
(*devsw(bp->b_dev)->d_strategy)(bp);
BUF_STRATEGY(bp, 0);
return (0);
}
@ -570,7 +570,7 @@ spec_freeblks(ap)
bp->b_blkno = ap->a_addr;
bp->b_offset = dbtob(ap->a_addr);
bp->b_bcount = ap->a_length;
(*bsw->d_strategy)(bp);
BUF_STRATEGY(bp, 0);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $Id: ccd.c,v 1.50 1999/07/17 19:58:37 phk Exp $ */
/* $Id: ccd.c,v 1.51 1999/07/18 14:30:57 phk Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@ -1265,7 +1265,7 @@ ccdioctl(dev, cmd, data, flag, p)
if (error == 0) {
if (cmd == DIOCWDINFO)
error = writedisklabel(CCDLABELDEV(dev),
ccdstrategy, &cs->sc_label);
&cs->sc_label);
}
cs->sc_flags &= ~CCDF_LABELLING;
@ -1435,8 +1435,8 @@ ccdgetdisklabel(dev)
/*
* Call the generic disklabel extraction routine.
*/
if ((errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy,
&cs->sc_label)) != NULL)
errstring = readdisklabel(CCDLABELDEV(dev), &cs->sc_label);
if (errstring != NULL)
ccdmakedisklabel(cs);
#ifdef DEBUG

View File

@ -35,7 +35,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.34 1999/05/11 19:54:10 phk Exp $
* $Id: diskslice_machdep.c,v 1.35 1999/06/26 02:47:09 mckusick Exp $
*/
#include <sys/param.h>
@ -64,11 +64,10 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, d_strategy_t *strat,
struct disklabel *lp, struct diskslices *ssp,
u_long ext_offset, u_long ext_size,
u_long base_ext_offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
static int
check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
@ -151,10 +150,9 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, strat, lp, sspp)
dsinit(dname, dev, lp, sspp)
char *dname;
dev_t dev;
d_strategy_t *strat;
struct disklabel *lp;
struct diskslices **sspp;
{
@ -182,7 +180,7 @@ dsinit(dname, dev, strat, lp, sspp)
bp->b_blkno = mbr_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -328,7 +326,7 @@ dsinit(dname, dev, strat, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, strat, lp, ssp,
extended(dname, bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -341,12 +339,11 @@ dsinit(dname, dev, strat, lp, sspp)
}
void
extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
d_strategy_t *strat;
struct diskslices *ssp;
u_long ext_offset;
u_long ext_size;
@ -372,7 +369,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_blkno = ext_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -434,10 +431,9 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, strat, lp, ssp,
ext_offsets[dospart], ext_sizes[dospart],
base_ext_offset, nsectors, ntracks,
mbr_offset);
extended(dname, dev, lp, ssp, ext_offsets[dospart],
ext_sizes[dospart], base_ext_offset,
nsectors, ntracks, mbr_offset);
done:
bp->b_flags |= B_INVAL | B_AGE;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.199 1999/05/31 11:26:36 phk Exp $
* $Id: wd.c,v 1.200 1999/08/09 10:34:52 phk Exp $
*/
/* TODO:
@ -223,7 +223,6 @@ static void wderror(struct buf *bp, struct disk *du, char *mesg);
static void wdflushirq(struct disk *du, int old_ipl);
static int wdreset(struct disk *du);
static void wdsleep(int ctrlr, char *wmesg);
static void wdstrategy1(struct buf *bp);
static timeout_t wdtimeout;
static int wdunwedge(struct disk *du);
static int wdwait(struct disk *du, u_char bits_wanted, int timeout);
@ -659,16 +658,6 @@ wdstrategy(register struct buf *bp)
biodone(bp);
}
static void
wdstrategy1(struct buf *bp)
{
/*
* XXX - do something to make wdstrategy() but not this block while
* we're doing dsinit() and dsioctl().
*/
wdstrategy(bp);
}
/*
* Routine to queue a command to the controller. The unit's
* request is linked into the active list for the controller.
@ -1263,8 +1252,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_ncylinders = du->dk_dd.d_ncylinders;
label.d_secpercyl = du->dk_dd.d_secpercyl;
label.d_secperunit = du->dk_dd.d_secperunit;
error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label, wdstrategy1,
(ds_setgeom_t *)NULL, &wd_cdevsw);
error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");
@ -1283,7 +1271,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
du->dk_flags |= DKFL_LABELLING;
du->dk_state = WANTOPEN;
error = dsinit(dkmodpart(dev, RAW_PART), wdstrategy,
error = dsinit(dkmodpart(dev, RAW_PART),
&du->dk_dd, &du->dk_slices);
if (error != 0) {
du->dk_flags &= ~DKFL_LABELLING;
@ -1312,13 +1300,13 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
* XXX can now handle changes directly since dsinit() doesn't
* do too much.
*/
msg = correct_readdisklabel(dkmodpart(dev, RAW_PART), wdstrategy,
&du->dk_dd);
msg = correct_readdisklabel(dkmodpart(dev, RAW_PART),
&du->dk_dd);
/* XXX check value returned by wdwsetctlr(). */
wdwsetctlr(du);
if (msg == NULL && du->dk_dd.d_flags & D_BADSECT)
msg = readbad144(dkmodpart(dev, RAW_PART), wdstrategy,
&du->dk_dd, &du->dk_bad);
msg = readbad144(dkmodpart(dev, RAW_PART),
&du->dk_dd, &du->dk_bad);
du->dk_flags &= ~DKFL_LABELLING;
if (msg != NULL) {
log(LOG_WARNING, "wd%d: cannot find label (%s)\n",
@ -1909,8 +1897,7 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
du = wddrives[lunit];
wdsleep(du->dk_ctrlr, "wdioct");
error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices,
wdstrategy1, (ds_setgeom_t *)NULL);
error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices);
if (error != ENOIOCTL)
return (error);
switch (cmd) {
@ -1952,7 +1939,7 @@ wdformat(struct buf *bp)
{
bp->b_flags |= B_FORMAT;
wdstrategy(bp);
BUF_STRATEGY(bp, 0);
/*
* phk put this here, better that return(wdstrategy(bp));
* XXX
@ -1973,7 +1960,7 @@ wdsize(dev_t dev)
du = wddrives[lunit];
if (du == NULL)
return (-1);
return (dssize(dev, &du->dk_slices, wdopen, wdclose));
return (dssize(dev, &du->dk_slices));
}
int

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wfd.c,v 1.25 1999/05/31 11:26:38 phk Exp $
* $Id: wfd.c,v 1.26 1999/06/24 03:09:11 msmith Exp $
*/
/*
@ -167,7 +167,6 @@ static int wfd_request_wait (struct wfd *t, u_char cmd, u_char a1, u_char a2,
u_char a9, char *addr, int count);
static void wfd_describe (struct wfd *t);
static int wfd_eject (struct wfd *t, int closeit);
static void wfdstrategy1(struct buf *bp);
/*
* Dump the array in hexadecimal format for debugging purposes.
@ -392,8 +391,7 @@ int wfdopen (dev_t dev, int flags, int fmt, struct proc *p)
label.d_secperunit = label.d_secpercyl * t->cap.cyls;
/* Initialize slice tables. */
errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label,
wfdstrategy1, (ds_setgeom_t *)NULL, &wfd_cdevsw);
errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label);
if (errcode != 0)
return errcode;
@ -421,16 +419,6 @@ int wfdclose (dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
static void
wfdstrategy1(struct buf *bp)
{
/*
* XXX - do something to make wdstrategy() but not this block while
* we're doing dsinit() and dsioctl().
*/
wfdstrategy(bp);
}
/*
* Actually translate the requested transfer into one the physical driver can
* understand. The transfer is described by a buf and will include only one
@ -656,8 +644,7 @@ int wfdioctl (dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
struct wfd *t = wfdtab[lun];
int error = 0;
error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices,
wfdstrategy1, (ds_setgeom_t *)NULL);
error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices);
if (error != ENOIOCTL)
return (error);

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.150 1999/07/29 01:02:55 mdodd Exp $
* $Id: fd.c,v 1.151 1999/07/29 11:27:33 joerg Exp $
*
*/
@ -2217,7 +2217,7 @@ fdformat(dev, finfo, p)
/* now do the format */
bp->b_dev = dev;
fdstrategy(bp);
BUF_STRATEGY(bp, 0);
/* ...and wait for it to complete */
s = splbio();
@ -2277,7 +2277,7 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
if (readdisklabel(dkmodpart(dev, RAW_PART), dl)
== NULL)
error = 0;
else
@ -2308,8 +2308,7 @@ fdioctl(dev, cmd, addr, flag, p)
(u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
(struct disklabel *)buffer);
error = writedisklabel(dev, (struct disklabel *)buffer);
break;
case FD_FORM:
if ((flag & FWRITE) == 0)

View File

@ -16,7 +16,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
* $Id: kern_physio.c,v 1.34 1999/05/08 06:39:37 phk Exp $
* $Id: kern_physio.c,v 1.35 1999/06/26 02:46:02 mckusick Exp $
*/
#include <sys/param.h>
@ -35,18 +35,17 @@ static struct buf * phygetvpbuf(dev_t dev, int resid);
int
physread(dev_t dev, struct uio *uio, int ioflag)
{
return(physio(devsw(dev)->d_strategy, NULL, dev, 1, minphys, uio));
return(physio(NULL, dev, 1, minphys, uio));
}
int
physwrite(dev_t dev, struct uio *uio, int ioflag)
{
return(physio(devsw(dev)->d_strategy, NULL, dev, 0, minphys, uio));
return(physio(NULL, dev, 0, minphys, uio));
}
int
physio(strategy, bp, dev, rw, minp, uio)
d_strategy_t *strategy;
physio(bp, dev, rw, minp, uio)
struct buf *bp;
dev_t dev;
int rw;
@ -114,7 +113,7 @@ physio(strategy, bp, dev, rw, minp, uio)
}
/* perform transfer */
(*strategy)(bp);
BUF_STRATEGY(bp, 0);
spl = splbio();
while ((bp->b_flags & B_DONE) == 0)

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
* $Id: ufs_disksubr.c,v 1.39 1998/12/14 05:37:37 dillon Exp $
* $Id: ufs_disksubr.c,v 1.40 1999/06/26 02:46:44 mckusick Exp $
*/
#include <sys/param.h>
@ -168,9 +168,8 @@ bufqdisksort(bufq, bp)
* Returns NULL on success and an error string on failure.
*/
char *
readdisklabel(dev, strat, lp)
readdisklabel(dev, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
{
register struct buf *bp;
@ -183,7 +182,7 @@ readdisklabel(dev, strat, lp)
bp->b_bcount = lp->d_secsize;
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp))
msg = "I/O error";
else for (dlp = (struct disklabel *)bp->b_data;
@ -262,9 +261,8 @@ setdisklabel(olp, nlp, openmask)
* Write disk label back to device after modification.
*/
int
writedisklabel(dev, strat, lp)
writedisklabel(dev, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
{
struct buf *bp;
@ -287,7 +285,7 @@ writedisklabel(dev, strat, lp)
*/
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
error = biowait(bp);
if (error)
goto done;
@ -303,7 +301,7 @@ writedisklabel(dev, strat, lp)
#ifdef __alpha__
alpha_fix_srm_checksum(bp);
#endif
(*strat)(bp);
BUF_STRATEGY(bp, 1);
error = biowait(bp);
goto done;
}
@ -316,7 +314,7 @@ writedisklabel(dev, strat, lp)
*dlp = *lp;
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_WRITE;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
error = biowait(bp);
#endif
bp->b_flags |= B_INVAL | B_AGE;

View File

@ -35,7 +35,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.34 1999/05/11 19:54:10 phk Exp $
* $Id: diskslice_machdep.c,v 1.35 1999/06/26 02:47:09 mckusick Exp $
*/
#include <sys/param.h>
@ -64,11 +64,10 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, d_strategy_t *strat,
struct disklabel *lp, struct diskslices *ssp,
u_long ext_offset, u_long ext_size,
u_long base_ext_offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
static int
check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
@ -151,10 +150,9 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, strat, lp, sspp)
dsinit(dname, dev, lp, sspp)
char *dname;
dev_t dev;
d_strategy_t *strat;
struct disklabel *lp;
struct diskslices **sspp;
{
@ -182,7 +180,7 @@ dsinit(dname, dev, strat, lp, sspp)
bp->b_blkno = mbr_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -328,7 +326,7 @@ dsinit(dname, dev, strat, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, strat, lp, ssp,
extended(dname, bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -341,12 +339,11 @@ dsinit(dname, dev, strat, lp, sspp)
}
void
extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
d_strategy_t *strat;
struct diskslices *ssp;
u_long ext_offset;
u_long ext_size;
@ -372,7 +369,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_blkno = ext_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -434,10 +431,9 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, strat, lp, ssp,
ext_offsets[dospart], ext_sizes[dospart],
base_ext_offset, nsectors, ntracks,
mbr_offset);
extended(dname, dev, lp, ssp, ext_offsets[dospart],
ext_sizes[dospart], base_ext_offset,
nsectors, ntracks, mbr_offset);
done:
bp->b_flags |= B_INVAL | B_AGE;

View File

@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_diskslice.c,v 1.64 1999/05/11 19:54:30 phk Exp $
* $Id: subr_diskslice.c,v 1.65 1999/06/21 03:48:16 grog Exp $
*/
#include "opt_devfs.h"
@ -375,15 +375,13 @@ dsgone(sspp)
* is subject to the same restriction as dsopen().
*/
int
dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
dsioctl(dname, dev, cmd, data, flags, sspp)
char *dname;
dev_t dev;
u_long cmd;
caddr_t data;
int flags;
struct diskslices **sspp;
d_strategy_t *strat;
ds_setgeom_t *setgeom;
{
int error;
struct disklabel *lp;
@ -472,10 +470,6 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
if (lp->d_partitions[part].p_size > sp->ds_size)
error = ENOSPC;
}
#if 0 /* XXX */
if (error != 0 && setgeom != NULL)
error = setgeom(lp);
#endif
if (error != 0) {
free(lp, M_DEVBUF);
return (error);
@ -511,8 +505,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
error = dsopen(dname, dev,
ssp->dss_slices[WHOLE_DISK_SLICE].ds_copenmask
& (1 << RAW_PART) ? S_IFCHR : S_IFBLK,
ssp->dss_oflags, sspp, lp, strat, setgeom,
ssp->dss_cdevsw);
ssp->dss_oflags, sspp, lp);
if (error != 0) {
free(lp, M_DEVBUF);
*sspp = ssp;
@ -533,8 +526,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
dkmodslice(dkmodpart(dev, part),
slice),
S_IFBLK, ssp->dss_oflags, sspp,
lp, strat, setgeom,
ssp->dss_cdevsw);
lp);
if (error != 0) {
/* XXX should free devfs toks. */
free(lp, M_DEVBUF);
@ -551,8 +543,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
dkmodslice(dkmodpart(dev, part),
slice),
S_IFCHR, ssp->dss_oflags, sspp,
lp, strat, setgeom,
ssp->dss_cdevsw);
lp);
if (error != 0) {
/* XXX should free devfs toks. */
free(lp, M_DEVBUF);
@ -569,8 +560,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
return (0);
case DIOCWDINFO:
error = dsioctl(dname, dev, DIOCSDINFO, data, flags, &ssp,
strat, setgeom);
error = dsioctl(dname, dev, DIOCSDINFO, data, flags, &ssp);
if (error != 0)
return (error);
/*
@ -579,7 +569,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
*/
old_wlabel = sp->ds_wlabel;
set_ds_wlabel(ssp, slice, TRUE);
error = writedisklabel(dev, strat, sp->ds_label);
error = writedisklabel(dev, sp->ds_label);
/* XXX should invalidate in-core label if write failed. */
set_ds_wlabel(ssp, slice, old_wlabel);
return (error);
@ -654,7 +644,6 @@ dsmakeslicestruct(nslices, lp)
ssp = malloc(offsetof(struct diskslices, dss_slices) +
nslices * sizeof *sp, M_DEVBUF, M_WAITOK);
ssp->dss_cdevsw = NULL;
ssp->dss_first_bsd_slice = COMPATIBILITY_SLICE;
ssp->dss_nslices = nslices;
ssp->dss_oflags = 0;
@ -700,16 +689,13 @@ dsname(dname, unit, slice, part, partname)
* strategy routine must be special to allow activity.
*/
int
dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
dsopen(dname, dev, mode, flags, sspp, lp)
char *dname;
dev_t dev;
int mode;
u_int flags;
struct diskslices **sspp;
struct disklabel *lp;
d_strategy_t *strat;
ds_setgeom_t *setgeom;
struct cdevsw *cdevsw;
{
struct dkbad *btp;
dev_t dev1;
@ -754,7 +740,7 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
if (!(flags & DSO_ONESLICE)) {
TRACE(("dsinit\n"));
error = dsinit(dname, dev, strat, lp, sspp);
error = dsinit(dname, dev, lp, sspp);
if (error != 0) {
dsgone(sspp);
return (error);
@ -762,9 +748,6 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
}
ssp = *sspp;
ssp->dss_oflags = flags;
#ifdef DEVFS
ssp->dss_cdevsw = cdevsw;
#endif
/*
* If there are no real slices, then make the compatiblity
@ -791,13 +774,6 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
ssp->dss_slices[WHOLE_DISK_SLICE].ds_label = clone_label(lp);
ssp->dss_slices[WHOLE_DISK_SLICE].ds_wlabel = TRUE;
if (setgeom != NULL) {
error = setgeom(lp);
if (error != 0) {
dsgone(sspp);
return (error);
}
}
}
/*
@ -819,11 +795,11 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
&& sp->ds_size != 0) {
mynor = minor(dev1);
sp->ds_bdev =
devfs_add_devswf(cdevsw, mynor, DV_BLK,
devfs_add_devswf(devsw(dev1), mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"%s", sname);
sp->ds_cdev =
devfs_add_devswf(cdevsw, mynor, DV_CHR,
devfs_add_devswf(devsw(dev1), mynor, DV_CHR,
UID_ROOT, GID_OPERATOR, 0640,
"r%s", sname);
}
@ -838,11 +814,7 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
if (flags & DSO_NOLABELS)
msg = NULL;
else
msg = readdisklabel(dev1, strat, lp1);
#if 0 /* XXX */
if (msg == NULL && setgeom != NULL && setgeom(lp1) != 0)
msg = "setgeom failed";
#endif
msg = readdisklabel(dev1, lp1);
if (msg == NULL)
msg = fixlabel(sname, sp, lp1, FALSE);
if (msg == NULL && lp1->d_secsize != ssp->dss_secsize)
@ -857,7 +829,7 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
if (lp1->d_flags & D_BADSECT) {
btp = malloc(sizeof *btp, M_DEVBUF, M_WAITOK);
TRACE(("readbad144\n"));
msg = readbad144(dev1, strat, lp1, btp);
msg = readbad144(dev1, lp1, btp);
if (msg != NULL) {
log(LOG_WARNING,
"%s: cannot find bad sector table (%s)\n",
@ -902,11 +874,9 @@ dsopen(dname, dev, mode, flags, sspp, lp, strat, setgeom, cdevsw)
}
int
dssize(dev, sspp, dopen, dclose)
dssize(dev, sspp)
dev_t dev;
struct diskslices **sspp;
d_open_t dopen;
d_close_t dclose;
{
struct disklabel *lp;
int part;
@ -918,9 +888,9 @@ dssize(dev, sspp, dopen, dclose)
ssp = *sspp;
if (ssp == NULL || slice >= ssp->dss_nslices
|| !(ssp->dss_slices[slice].ds_bopenmask & (1 << part))) {
if (dopen(dev, FREAD, S_IFBLK, (struct proc *)NULL) != 0)
if (devsw(dev)->d_open(dev, FREAD, S_IFBLK, (struct proc *)NULL) != 0)
return (-1);
dclose(dev, FREAD, S_IFBLK, (struct proc *)NULL);
devsw(dev)->d_close(dev, FREAD, S_IFBLK, (struct proc *)NULL);
ssp = *sspp;
}
lp = ssp->dss_slices[slice].ds_label;
@ -1174,11 +1144,11 @@ set_ds_labeldevs_unaliased(dname, dev, ssp)
} else {
mynor = minor(dkmodpart(dev, part));
sp->ds_bdevs[part] =
devfs_add_devswf(ssp->dss_cdevsw, mynor, DV_BLK,
devfs_add_devswf(devsw(dev), mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"%s%s", sname, partname);
sp->ds_cdevs[part] =
devfs_add_devswf(ssp->dss_cdevsw, mynor, DV_CHR,
devfs_add_devswf(devsw(dev), mynor, DV_CHR,
UID_ROOT, GID_OPERATOR, 0640,
"r%s%s", sname, partname);
}

View File

@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_dkbad.c,v 1.9 1999/05/11 19:54:31 phk Exp $
* $Id: subr_dkbad.c,v 1.10 1999/06/26 02:46:03 mckusick Exp $
*/
#include <sys/param.h>
@ -96,9 +96,8 @@ internbad144(btp, lp)
}
char *
readbad144(dev, strat, lp, bdp)
readbad144(dev, lp, bdp)
dev_t dev;
d_strategy_t *strat;
struct disklabel *lp;
struct dkbad *bdp;
{
@ -120,7 +119,7 @@ readbad144(dev, strat, lp, bdp)
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
bp->b_flags &= ~B_ERROR;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
/* If successful, validate, otherwise try another. */
if (biowait(bp) == 0) {

View File

@ -13,7 +13,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
* $Id: vfs_aio.c,v 1.55 1999/08/08 18:42:48 phk Exp $
* $Id: vfs_aio.c,v 1.56 1999/08/13 10:10:01 phk Exp $
*/
/*
@ -927,11 +927,8 @@ aio_qphysio(p, aiocbe)
int fd;
int s;
int cnt;
dev_t dev;
int rw;
d_strategy_t *fstrategy;
struct cdevsw *cdev;
struct cdevsw *bdev;
cb = &aiocbe->uaiocb;
fdp = p->p_fd;
@ -967,7 +964,6 @@ aio_qphysio(p, aiocbe)
if (cdev->d_bmaj == -1) {
return -1;
}
bdev = cdev;
ki = p->p_aioinfo;
if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) {
@ -979,8 +975,6 @@ aio_qphysio(p, aiocbe)
return -1;
}
dev = makebdev(bdev->d_bmaj, minor(vp->v_rdev));
/*
* Physical I/O is charged directly to the process, so we don't have
* to fake it.
@ -1002,7 +996,7 @@ aio_qphysio(p, aiocbe)
* get a copy of the kva from the physical buffer
*/
bp->b_caller1 = p;
bp->b_dev = dev;
bp->b_dev = vp->v_rdev;
error = bp->b_error = 0;
if (cb->aio_lio_opcode == LIO_WRITE) {
@ -1041,12 +1035,11 @@ aio_qphysio(p, aiocbe)
aiocbe->jobstate = JOBST_JOBQBUF;
cb->_aiocb_private.status = cb->aio_nbytes;
num_buf_aio++;
fstrategy = bdev->d_strategy;
bp->b_error = 0;
splx(s);
/* perform transfer */
(*fstrategy)(bp);
BUF_STRATEGY(bp, 0);
s = splbio();
/*

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
* $Id: spec_vnops.c,v 1.94 1999/08/13 10:53:58 phk Exp $
* $Id: spec_vnops.c,v 1.95 1999/08/13 16:29:21 phk Exp $
*/
#include <sys/param.h>
@ -546,7 +546,7 @@ spec_strategy(ap)
if (((bp->b_flags & B_READ) == 0) &&
(LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
(*bioops.io_start)(bp);
(*devsw(bp->b_dev)->d_strategy)(bp);
BUF_STRATEGY(bp, 0);
return (0);
}
@ -570,7 +570,7 @@ spec_freeblks(ap)
bp->b_blkno = ap->a_addr;
bp->b_offset = dbtob(ap->a_addr);
bp->b_bcount = ap->a_length;
(*bsw->d_strategy)(bp);
BUF_STRATEGY(bp, 0);
return (0);
}

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.66 1999/07/04 14:58:44 phk Exp $
* $Id: fd.c,v 1.67 1999/07/29 01:02:59 mdodd Exp $
*
*/
@ -2624,7 +2624,7 @@ fdformat(dev, finfo, p)
/* now do the format */
bp->b_dev = dev;
fdstrategy(bp);
BUF_STRATEGY(bp, 0);
/* ...and wait for it to complete */
s = splbio();
@ -2687,7 +2687,7 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
if (readdisklabel(dkmodpart(dev, RAW_PART), dl)
== NULL)
error = 0;
else
@ -2718,8 +2718,7 @@ fdioctl(dev, cmd, addr, flag, p)
(u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
(struct disklabel *)buffer);
error = writedisklabel(dev, (struct disklabel *)buffer);
break;
case FD_FORM:
if ((flag & FWRITE) == 0)

View File

@ -35,7 +35,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: atcompat_diskslice.c,v 1.15 1999/05/12 08:33:18 kato Exp $
* $Id: atcompat_diskslice.c,v 1.16 1999/06/26 02:47:14 mckusick Exp $
*/
/*
@ -75,7 +75,6 @@ static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void atcompat_extended __P((char *dname, dev_t dev,
d_strategy_t *strat,
struct disklabel *lp, struct diskslices *ssp,
u_long ext_offset, u_long ext_size,
u_long base_ext_offset, int nsectors, int ntracks,
@ -161,13 +160,11 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
return (error);
}
int atcompat_dsinit __P((char *dname, dev_t dev, d_strategy_t *strat,
struct disklabel *lp, struct diskslices **sspp));
int atcompat_dsinit __P((char *dname, dev_t dev, struct disklabel *lp, struct diskslices **sspp));
int
atcompat_dsinit(dname, dev, strat, lp, sspp)
atcompat_dsinit(dname, dev, lp, sspp)
char *dname;
dev_t dev;
d_strategy_t *strat;
struct disklabel *lp;
struct diskslices **sspp;
{
@ -195,7 +192,7 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
bp->b_blkno = mbr_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -346,7 +343,7 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
atcompat_extended(dname, bp->b_dev, strat, lp, ssp,
atcompat_extended(dname, bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
@ -359,12 +356,11 @@ atcompat_dsinit(dname, dev, strat, lp, sspp)
}
static void
atcompat_extended(dname, dev, strat, lp, ssp, ext_offset, ext_size,
base_ext_offset, nsectors, ntracks, mbr_offset)
atcompat_extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
d_strategy_t *strat;
struct diskslices *ssp;
u_long ext_offset;
u_long ext_size;
@ -390,7 +386,7 @@ atcompat_extended(dname, dev, strat, lp, ssp, ext_offset, ext_size,
bp->b_blkno = ext_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -457,7 +453,7 @@ atcompat_extended(dname, dev, strat, lp, ssp, ext_offset, ext_size,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
atcompat_extended(dname, dev, strat, lp, ssp,
atcompat_extended(dname, dev, lp, ssp,
ext_offsets[dospart], ext_sizes[dospart],
base_ext_offset, nsectors, ntracks,
mbr_offset);

View File

@ -35,7 +35,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.20 1999/06/26 02:47:15 mckusick Exp $
* $Id: diskslice_machdep.c,v 1.21 1999/08/08 10:06:27 kato Exp $
*/
/*
@ -74,17 +74,16 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = {
static int check_part __P((char *sname, struct dos_partition *dp,
u_long offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, d_strategy_t *strat,
struct disklabel *lp, struct diskslices *ssp,
u_long ext_offset, u_long ext_size,
u_long base_ext_offset, int nsectors, int ntracks,
u_long mbr_offset));
static void extended __P((char *dname, dev_t dev, struct disklabel *lp,
struct diskslices *ssp, u_long ext_offset,
u_long ext_size, u_long base_ext_offset,
int nsectors, int ntracks, u_long mbr_offset));
#ifdef PC98
#define DPBLKNO(cyl,hd,sect) ((cyl)*(lp->d_secpercyl))
#ifdef COMPAT_ATDISK
int atcompat_dsinit __P((char *dname, dev_t dev, d_strategy_t *strat,
struct disklabel *lp, struct diskslices **sspp));
int atcompat_dsinit __P((char *dname, dev_t dev,
struct disklabel *lp, struct diskslices **sspp));
#endif
#endif
@ -201,10 +200,9 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
}
int
dsinit(dname, dev, strat, lp, sspp)
dsinit(dname, dev, lp, sspp)
char *dname;
dev_t dev;
d_strategy_t *strat;
struct disklabel *lp;
struct diskslices **sspp;
{
@ -248,7 +246,7 @@ dsinit(dname, dev, strat, lp, sspp)
if (bp->b_bcount < 1024)
bp->b_bcount = 1024;
#endif
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading primary partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -325,7 +323,7 @@ dsinit(dname, dev, strat, lp, sspp)
/* IBM-PC HDD */
bp->b_flags = B_INVAL | B_AGE;
brelse(bp);
return atcompat_dsinit(dname, dev, strat, lp, sspp);
return atcompat_dsinit(dname, dev, lp, sspp);
}
#endif
dp0 = (struct dos_partition *)(cp + 512);
@ -488,7 +486,7 @@ dsinit(dname, dev, strat, lp, sspp)
for (dospart = 0; dospart < NDOSPART; dospart++, sp++)
if (sp->ds_type == DOSPTYP_EXTENDED ||
sp->ds_type == DOSPTYP_EXTENDEDX)
extended(dname, bp->b_dev, strat, lp, ssp,
extended(dname, bp->b_dev, lp, ssp,
sp->ds_offset, sp->ds_size, sp->ds_offset,
max_nsectors, max_ntracks, mbr_offset);
#endif
@ -503,12 +501,11 @@ dsinit(dname, dev, strat, lp, sspp)
/* PC98 does not use this function */
void
extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset,
nsectors, ntracks, mbr_offset)
char *dname;
dev_t dev;
struct disklabel *lp;
d_strategy_t *strat;
struct diskslices *ssp;
u_long ext_offset;
u_long ext_size;
@ -538,7 +535,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
bp->b_blkno = ext_offset;
bp->b_bcount = lp->d_secsize;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
diskerr(bp, dname, "error reading extended partition table",
LOG_PRINTF, 0, (struct disklabel *)NULL);
@ -625,7 +622,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
/* If we found any more slices, recursively find all the subslices. */
for (dospart = 0; dospart < NDOSPART; dospart++)
if (ext_sizes[dospart] != 0)
extended(dname, dev, strat, lp, ssp,
extended(dname, dev, lp, ssp,
ext_offsets[dospart], ext_sizes[dospart],
base_ext_offset, nsectors, ntracks,
mbr_offset);

View File

@ -47,7 +47,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
* $Id: fd.c,v 1.66 1999/07/04 14:58:44 phk Exp $
* $Id: fd.c,v 1.67 1999/07/29 01:02:59 mdodd Exp $
*
*/
@ -2624,7 +2624,7 @@ fdformat(dev, finfo, p)
/* now do the format */
bp->b_dev = dev;
fdstrategy(bp);
BUF_STRATEGY(bp, 0);
/* ...and wait for it to complete */
s = splbio();
@ -2687,7 +2687,7 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
if (readdisklabel(dkmodpart(dev, RAW_PART), dl)
== NULL)
error = 0;
else
@ -2718,8 +2718,7 @@ fdioctl(dev, cmd, addr, flag, p)
(u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
(struct disklabel *)buffer);
error = writedisklabel(dev, (struct disklabel *)buffer);
break;
case FD_FORM:
if ((flag & FWRITE) == 0)

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.84 1999/05/31 11:28:44 phk Exp $
* $Id: wd.c,v 1.85 1999/08/09 10:35:04 phk Exp $
*/
/* TODO:
@ -246,7 +246,6 @@ static void wderror(struct buf *bp, struct disk *du, char *mesg);
static void wdflushirq(struct disk *du, int old_ipl);
static int wdreset(struct disk *du);
static void wdsleep(int ctrlr, char *wmesg);
static void wdstrategy1(struct buf *bp);
static timeout_t wdtimeout;
static int wdunwedge(struct disk *du);
static int wdwait(struct disk *du, u_char bits_wanted, int timeout);
@ -756,16 +755,6 @@ wdstrategy(register struct buf *bp)
biodone(bp);
}
static void
wdstrategy1(struct buf *bp)
{
/*
* XXX - do something to make wdstrategy() but not this block while
* we're doing dsinit() and dsioctl().
*/
wdstrategy(bp);
}
/*
* Routine to queue a command to the controller. The unit's
* request is linked into the active list for the controller.
@ -1389,8 +1378,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_ncylinders = du->dk_dd.d_ncylinders;
label.d_secpercyl = du->dk_dd.d_secpercyl;
label.d_secperunit = du->dk_dd.d_secperunit;
error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label, wdstrategy1,
(ds_setgeom_t *)NULL, &wd_cdevsw);
error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");
@ -1409,7 +1397,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
du->dk_flags |= DKFL_LABELLING;
du->dk_state = WANTOPEN;
error = dsinit(dkmodpart(dev, RAW_PART), wdstrategy,
error = dsinit(dkmodpart(dev, RAW_PART),
&du->dk_dd, &du->dk_slices);
if (error != 0) {
du->dk_flags &= ~DKFL_LABELLING;
@ -1438,13 +1426,13 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
* XXX can now handle changes directly since dsinit() doesn't
* do too much.
*/
msg = correct_readdisklabel(dkmodpart(dev, RAW_PART), wdstrategy,
&du->dk_dd);
msg = correct_readdisklabel(dkmodpart(dev, RAW_PART),
&du->dk_dd);
/* XXX check value returned by wdwsetctlr(). */
wdwsetctlr(du);
if (msg == NULL && du->dk_dd.d_flags & D_BADSECT)
msg = readbad144(dkmodpart(dev, RAW_PART), wdstrategy,
&du->dk_dd, &du->dk_bad);
msg = readbad144(dkmodpart(dev, RAW_PART),
&du->dk_dd, &du->dk_bad);
du->dk_flags &= ~DKFL_LABELLING;
if (msg != NULL) {
log(LOG_WARNING, "wd%d: cannot find label (%s)\n",
@ -2130,8 +2118,7 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
du = wddrives[lunit];
wdsleep(du->dk_ctrlr, "wdioct");
error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices,
wdstrategy1, (ds_setgeom_t *)NULL);
error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices);
if (error != ENOIOCTL)
return (error);
#ifdef PC98
@ -2176,7 +2163,7 @@ wdformat(struct buf *bp)
{
bp->b_flags |= B_FORMAT;
wdstrategy(bp);
BUF_STRATEGY(bp, 0);
/*
* phk put this here, better that return(wdstrategy(bp));
* XXX
@ -2200,7 +2187,7 @@ wdsize(dev_t dev)
#ifdef PC98
outb(0x432,(du->dk_unit)%2);
#endif
return (dssize(dev, &du->dk_slices, wdopen, wdclose));
return (dssize(dev, &du->dk_slices));
}
int

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wfd.c,v 1.25 1999/05/31 11:26:38 phk Exp $
* $Id: wfd.c,v 1.26 1999/06/24 03:09:11 msmith Exp $
*/
/*
@ -167,7 +167,6 @@ static int wfd_request_wait (struct wfd *t, u_char cmd, u_char a1, u_char a2,
u_char a9, char *addr, int count);
static void wfd_describe (struct wfd *t);
static int wfd_eject (struct wfd *t, int closeit);
static void wfdstrategy1(struct buf *bp);
/*
* Dump the array in hexadecimal format for debugging purposes.
@ -392,8 +391,7 @@ int wfdopen (dev_t dev, int flags, int fmt, struct proc *p)
label.d_secperunit = label.d_secpercyl * t->cap.cyls;
/* Initialize slice tables. */
errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label,
wfdstrategy1, (ds_setgeom_t *)NULL, &wfd_cdevsw);
errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label);
if (errcode != 0)
return errcode;
@ -421,16 +419,6 @@ int wfdclose (dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
static void
wfdstrategy1(struct buf *bp)
{
/*
* XXX - do something to make wdstrategy() but not this block while
* we're doing dsinit() and dsioctl().
*/
wfdstrategy(bp);
}
/*
* Actually translate the requested transfer into one the physical driver can
* understand. The transfer is described by a buf and will include only one
@ -656,8 +644,7 @@ int wfdioctl (dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
struct wfd *t = wfdtab[lun];
int error = 0;
error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices,
wfdstrategy1, (ds_setgeom_t *)NULL);
error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices);
if (error != ENOIOCTL)
return (error);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)buf.h 8.9 (Berkeley) 3/30/95
* $Id: buf.h,v 1.76 1999/07/08 06:05:58 mckusick Exp $
* $Id: buf.h,v 1.77 1999/07/09 16:41:18 peter Exp $
*/
#ifndef _SYS_BUF_H_
@ -477,8 +477,8 @@ int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long,
struct ucred *, long, int, struct buf **));
int cluster_wbuild __P((struct vnode *, long, daddr_t, int));
void cluster_write __P((struct buf *, u_quad_t));
int physio __P((void (*)(struct buf *), struct buf *, dev_t,
int, u_int (*)(struct buf *), struct uio *));
int physio __P((struct buf *, dev_t, int, u_int (*)(struct buf *),
struct uio *));
int physread __P((dev_t dev, struct uio *uio, int ioflag));
int physwrite __P((dev_t dev, struct uio *uio, int ioflag));
u_int minphys __P((struct buf *));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)buf.h 8.9 (Berkeley) 3/30/95
* $Id: buf.h,v 1.76 1999/07/08 06:05:58 mckusick Exp $
* $Id: buf.h,v 1.77 1999/07/09 16:41:18 peter Exp $
*/
#ifndef _SYS_BUF_H_
@ -477,8 +477,8 @@ int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long,
struct ucred *, long, int, struct buf **));
int cluster_wbuild __P((struct vnode *, long, daddr_t, int));
void cluster_write __P((struct buf *, u_quad_t));
int physio __P((void (*)(struct buf *), struct buf *, dev_t,
int, u_int (*)(struct buf *), struct uio *));
int physio __P((struct buf *, dev_t, int, u_int (*)(struct buf *),
struct uio *));
int physread __P((dev_t dev, struct uio *uio, int ioflag));
int physwrite __P((dev_t dev, struct uio *uio, int ioflag));
u_int minphys __P((struct buf *));

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
* $Id: conf.h,v 1.71 1999/08/13 10:29:31 phk Exp $
* $Id: conf.h,v 1.72 1999/08/13 16:29:27 phk Exp $
*/
#ifndef _SYS_CONF_H_
@ -117,6 +117,15 @@ typedef int l_rint_t __P((int c, struct tty *tp));
typedef int l_start_t __P((struct tty *tp));
typedef int l_modem_t __P((struct tty *tp, int flag));
/*
* XXX: The dummy argument can be used to do what strategy1() never
* did anywhere: Create a per device flag to lock the device during
* label/slice surgery, all calls with a dummy == 0 gets stalled on
* a queue somewhere, whereas dummy == 1 are let through. Once out
* of surgery, reset the flag and restart all the stuff on the stall
* queue.
*/
#define BUF_STRATEGY(bp, dummy) (*devsw((bp)->b_dev)->d_strategy)(bp)
/*
* Types for d_type.
*/

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94
* $Id: disklabel.h,v 1.40 1999/07/01 20:34:28 peter Exp $
* $Id: disklabel.h,v 1.41 1999/08/11 03:02:05 imp Exp $
*/
#ifndef _SYS_DISKLABEL_H_
@ -454,13 +454,11 @@ void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
u_int dkcksum __P((struct disklabel *lp));
char *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp));
char *readdisklabel __P((dev_t dev, struct disklabel *lp));
void bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp));
int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
u_long openmask));
int writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp));
int writedisklabel __P((dev_t dev, struct disklabel *lp));
#ifdef __alpha__
void alpha_fix_srm_checksum __P((struct buf *bp));
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94
* $Id: disklabel.h,v 1.40 1999/07/01 20:34:28 peter Exp $
* $Id: disklabel.h,v 1.41 1999/08/11 03:02:05 imp Exp $
*/
#ifndef _SYS_DISKLABEL_H_
@ -454,13 +454,11 @@ void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
u_int dkcksum __P((struct disklabel *lp));
char *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp));
char *readdisklabel __P((dev_t dev, struct disklabel *lp));
void bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp));
int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
u_long openmask));
int writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp));
int writedisklabel __P((dev_t dev, struct disklabel *lp));
#ifdef __alpha__
void alpha_fix_srm_checksum __P((struct buf *bp));
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.2 (Berkeley) 7/10/94
* $Id: disklabel.h,v 1.40 1999/07/01 20:34:28 peter Exp $
* $Id: disklabel.h,v 1.41 1999/08/11 03:02:05 imp Exp $
*/
#ifndef _SYS_DISKLABEL_H_
@ -454,13 +454,11 @@ void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
u_int dkcksum __P((struct disklabel *lp));
char *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp));
char *readdisklabel __P((dev_t dev, struct disklabel *lp));
void bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp));
int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
u_long openmask));
int writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp));
int writedisklabel __P((dev_t dev, struct disklabel *lp));
#ifdef __alpha__
void alpha_fix_srm_checksum __P((struct buf *bp));
#endif

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: diskslice.h,v 1.28 1998/08/16 01:47:19 bde Exp $
* $Id: diskslice.h,v 1.29 1998/08/23 20:16:35 phk Exp $
*/
#ifndef _SYS_DISKSLICE_H_
@ -92,29 +92,20 @@ struct diskslices {
struct buf;
struct disklabel;
typedef int ds_setgeom_t __P((struct disklabel *lp));
int dscheck __P((struct buf *bp, struct diskslices *ssp));
void dsclose __P((dev_t dev, int mode, struct diskslices *ssp));
void dsgone __P((struct diskslices **sspp));
int dsinit __P((char *dname, dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp, struct diskslices **sspp));
int dsinit __P((char *dname, dev_t dev, struct disklabel *lp,
struct diskslices **sspp));
int dsioctl __P((char *dname, dev_t dev, u_long cmd, caddr_t data,
int flags, struct diskslices **sspp,
void (*strat)(struct buf *bp), ds_setgeom_t *setgeom));
int flags, struct diskslices **sspp));
int dsisopen __P((struct diskslices *ssp));
struct diskslices *dsmakeslicestruct __P((int nslices, struct disklabel *lp));
char *dsname __P((char *dname, int unit, int slice, int part,
char *partname));
int dsopen __P((char *dname, dev_t dev, int mode, u_int flags,
struct diskslices **sspp, struct disklabel *lp,
void (*strat)(struct buf *bp), ds_setgeom_t *setgeom,
struct cdevsw *cdevsw));
int dssize __P((dev_t dev, struct diskslices **sspp,
int (*dopen)(dev_t dev, int oflags, int devtype,
struct proc *p),
int (*dclose)(dev_t dev, int fflag, int devtype,
struct proc *p)));
struct diskslices **sspp, struct disklabel *lp));
int dssize __P((dev_t dev, struct diskslices **sspp));
#endif /* KERNEL */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)dkbad.h 8.2 (Berkeley) 7/10/94
* $Id: dkbad.h,v 1.9 1997/02/22 09:45:07 peter Exp $
* $Id: dkbad.h,v 1.10 1998/02/01 20:08:36 bde Exp $
*/
#ifndef _SYS_DKBAD_H_
@ -89,10 +89,9 @@ struct dkbad_intern {
struct buf;
struct disklabel;
struct dkbad_intern *internbad144 __P((struct dkbad *btp,
struct disklabel *lp));
char *readbad144 __P((dev_t dev, void (*strat)(struct buf *bp),
struct disklabel *lp, struct dkbad *btp));
struct dkbad_intern *internbad144 __P((struct dkbad *btp,
struct disklabel *lp));
char *readbad144 __P((dev_t dev, struct disklabel *lp, struct dkbad *btp));
daddr_t transbad144 __P((struct dkbad_intern *bip, daddr_t blkno));
#endif

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
* $Id: conf.h,v 1.71 1999/08/13 10:29:31 phk Exp $
* $Id: conf.h,v 1.72 1999/08/13 16:29:27 phk Exp $
*/
#ifndef _SYS_CONF_H_
@ -117,6 +117,15 @@ typedef int l_rint_t __P((int c, struct tty *tp));
typedef int l_start_t __P((struct tty *tp));
typedef int l_modem_t __P((struct tty *tp, int flag));
/*
* XXX: The dummy argument can be used to do what strategy1() never
* did anywhere: Create a per device flag to lock the device during
* label/slice surgery, all calls with a dummy == 0 gets stalled on
* a queue somewhere, whereas dummy == 1 are let through. Once out
* of surgery, reset the flag and restart all the stuff on the stall
* queue.
*/
#define BUF_STRATEGY(bp, dummy) (*devsw((bp)->b_dev)->d_strategy)(bp)
/*
* Types for d_type.
*/

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
* $Id: ufs_disksubr.c,v 1.39 1998/12/14 05:37:37 dillon Exp $
* $Id: ufs_disksubr.c,v 1.40 1999/06/26 02:46:44 mckusick Exp $
*/
#include <sys/param.h>
@ -168,9 +168,8 @@ bufqdisksort(bufq, bp)
* Returns NULL on success and an error string on failure.
*/
char *
readdisklabel(dev, strat, lp)
readdisklabel(dev, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
{
register struct buf *bp;
@ -183,7 +182,7 @@ readdisklabel(dev, strat, lp)
bp->b_bcount = lp->d_secsize;
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
if (biowait(bp))
msg = "I/O error";
else for (dlp = (struct disklabel *)bp->b_data;
@ -262,9 +261,8 @@ setdisklabel(olp, nlp, openmask)
* Write disk label back to device after modification.
*/
int
writedisklabel(dev, strat, lp)
writedisklabel(dev, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
{
struct buf *bp;
@ -287,7 +285,7 @@ writedisklabel(dev, strat, lp)
*/
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_READ;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
error = biowait(bp);
if (error)
goto done;
@ -303,7 +301,7 @@ writedisklabel(dev, strat, lp)
#ifdef __alpha__
alpha_fix_srm_checksum(bp);
#endif
(*strat)(bp);
BUF_STRATEGY(bp, 1);
error = biowait(bp);
goto done;
}
@ -316,7 +314,7 @@ writedisklabel(dev, strat, lp)
*dlp = *lp;
bp->b_flags &= ~B_INVAL;
bp->b_flags |= B_WRITE;
(*strat)(bp);
BUF_STRATEGY(bp, 1);
error = biowait(bp);
#endif
bp->b_flags |= B_INVAL | B_AGE;