diff options
author | 2011-06-03 21:14:11 +0000 | |
---|---|---|
committer | 2011-06-03 21:14:11 +0000 | |
commit | 58d155a8bd341acd2e73b81dea97af3abb749a0c (patch) | |
tree | bb8e802bc72a7bc8af785edf9d9be535536ee1f7 /sys | |
parent | one midicat server can export multiple midithru ports (diff) | |
download | wireguard-openbsd-58d155a8bd341acd2e73b81dea97af3abb749a0c.tar.xz wireguard-openbsd-58d155a8bd341acd2e73b81dea97af3abb749a0c.zip |
Get rid of the wlabel argument to bounds_check_with_label(). It's
never done anything in OpenBSD and just clutters disk drivers with
silly flag handling.
More cleanup to follow.
ok deraadt@, millert@; no objections krw@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hp300/dev/hd.c | 7 | ||||
-rw-r--r-- | sys/arch/octeon/dev/octcf.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/presto.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xd.c | 5 | ||||
-rw-r--r-- | sys/arch/sparc/dev/xy.c | 5 | ||||
-rw-r--r-- | sys/arch/vax/mba/hp.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/mscp/mscp_disk.c | 5 | ||||
-rw-r--r-- | sys/arch/vax/vsa/hdc9224.c | 4 | ||||
-rw-r--r-- | sys/dev/ata/wd.c | 5 | ||||
-rw-r--r-- | sys/dev/ccd.c | 6 | ||||
-rw-r--r-- | sys/dev/flash.c | 4 | ||||
-rw-r--r-- | sys/dev/isa/mcd.c | 5 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_openbsdkintf.c | 10 | ||||
-rw-r--r-- | sys/dev/ramdisk.c | 4 | ||||
-rw-r--r-- | sys/dev/vnd.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_disk.c | 4 | ||||
-rw-r--r-- | sys/scsi/cd.c | 5 | ||||
-rw-r--r-- | sys/scsi/sd.c | 5 | ||||
-rw-r--r-- | sys/sys/disklabel.h | 4 |
19 files changed, 41 insertions, 54 deletions
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c index 6d2bd489153..e97e28700e9 100644 --- a/sys/arch/hp300/dev/hd.c +++ b/sys/arch/hp300/dev/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.63 2010/09/22 01:18:57 matthew Exp $ */ +/* $OpenBSD: hd.c,v 1.64 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */ /* @@ -692,9 +692,8 @@ hdstrategy(bp) * Do bounds checking, adjust transfer. if error, process; * If end of partition, just return. */ - if (bounds_check_with_label(bp, lp, - (rs->sc_flags & HDF_WLABEL) != 0) <= 0) - goto done; + if (bounds_check_with_label(bp, lp) <= 0) + goto done; s = splbio(); dp = &rs->sc_tab; diff --git a/sys/arch/octeon/dev/octcf.c b/sys/arch/octeon/dev/octcf.c index c895aa15763..f0fb5c2572d 100644 --- a/sys/arch/octeon/dev/octcf.c +++ b/sys/arch/octeon/dev/octcf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: octcf.c,v 1.2 2011/05/08 13:24:55 syuu Exp $ */ +/* $OpenBSD: octcf.c,v 1.3 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -326,8 +326,7 @@ octcfstrategy(struct buf *bp) * Do bounds checking, adjust transfer. if error, process. * If end of partition, just return. */ - if (bounds_check_with_label(bp, wd->sc_dk.dk_label, - (wd->sc_flags & (OCTCFF_WLABEL|OCTCFF_LABELLING)) != 0) <= 0) + if (bounds_check_with_label(bp, wd->sc_dk.dk_label) <= 0) goto done; /* Queue transfer on drive, activate drive and controller if idle. */ s = splbio(); diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c index c9e7e01deb3..f9d05429d4c 100644 --- a/sys/arch/sparc/dev/presto.c +++ b/sys/arch/sparc/dev/presto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: presto.c,v 1.20 2010/09/22 06:40:25 krw Exp $ */ +/* $OpenBSD: presto.c,v 1.21 2011/06/03 21:14:11 matthew Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -287,7 +287,7 @@ prestostrategy(struct buf *bp) } /* Do not write on "no trespassing" areas... */ - if (bounds_check_with_label(bp, sc->sc_dk.dk_label, 1) <= 0) + if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0) goto bad; /* Bound the request size, then move data between buf and nvram */ diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index c284d4e8390..ad9402c735a 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.53 2010/11/11 17:46:58 miod Exp $ */ +/* $OpenBSD: xd.c,v 1.54 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -1055,8 +1055,7 @@ xdstrategy(bp) * partition. Adjust transfer if needed, and signal errors or early * completion. */ - if (bounds_check_with_label(bp, xd->sc_dk.dk_label, - (xd->flags & XD_WLABEL) != 0) <= 0) + if (bounds_check_with_label(bp, xd->sc_dk.dk_label) <= 0) goto done; /* diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c index 8857c2e4e84..27192e24f46 100644 --- a/sys/arch/sparc/dev/xy.c +++ b/sys/arch/sparc/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.50 2010/09/22 06:40:25 krw Exp $ */ +/* $OpenBSD: xy.c,v 1.51 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */ /* @@ -1018,8 +1018,7 @@ xystrategy(bp) * partition. Adjust transfer if needed, and signal errors or early * completion. */ - if (bounds_check_with_label(bp, xy->sc_dk.dk_label, - (xy->flags & XY_WLABEL) != 0) <= 0) + if (bounds_check_with_label(bp, xy->sc_dk.dk_label) <= 0) goto done; /* diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c index 9320519dd69..aab9ce99558 100644 --- a/sys/arch/vax/mba/hp.c +++ b/sys/arch/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hp.c,v 1.24 2011/04/06 18:12:47 miod Exp $ */ +/* $OpenBSD: hp.c,v 1.25 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: hp.c,v 1.22 2000/02/12 16:09:33 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -185,7 +185,7 @@ hpstrategy(bp) sc = hp_cd.cd_devs[unit]; lp = sc->sc_disk.dk_label; - if (bounds_check_with_label(bp, lp, sc->sc_wlabel) <= 0) + if (bounds_check_with_label(bp, lp) <= 0) goto done; bp->b_rawblkno = diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index b1271d0bf3e..07ec65c14bb 100644 --- a/sys/arch/vax/mscp/mscp_disk.c +++ b/sys/arch/vax/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_disk.c,v 1.33 2011/04/06 18:12:47 miod Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.34 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -318,8 +318,7 @@ rastrategy(bp) * Determine the size of the transfer, and make sure it is * within the boundaries of the partition. */ - if (bounds_check_with_label(bp, ra->ra_disk.dk_label, - ra->ra_wlabel) <= 0) + if (bounds_check_with_label(bp, ra->ra_disk.dk_label) <= 0) goto done; /* Make some statistics... /bqt */ diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c index b39038d61df..c73b2db7cd8 100644 --- a/sys/arch/vax/vsa/hdc9224.c +++ b/sys/arch/vax/vsa/hdc9224.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hdc9224.c,v 1.34 2010/09/28 13:20:50 miod Exp $ */ +/* $OpenBSD: hdc9224.c,v 1.35 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: hdc9224.c,v 1.16 2001/07/26 15:05:09 wiz Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -452,7 +452,7 @@ hdstrategy(struct buf *bp) sc = (void *)hd->sc_dev.dv_parent; lp = hd->sc_disk.dk_label; - if ((bounds_check_with_label(bp, hd->sc_disk.dk_label, 1)) <= 0) + if ((bounds_check_with_label(bp, hd->sc_disk.dk_label)) <= 0) goto done; if (bp->b_bcount == 0) diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index aafa13128a1..9a01ca49436 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.101 2011/05/31 17:35:35 matthew Exp $ */ +/* $OpenBSD: wd.c,v 1.102 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -448,8 +448,7 @@ wdstrategy(struct buf *bp) * Do bounds checking, adjust transfer. if error, process. * If end of partition, just return. */ - if (bounds_check_with_label(bp, wd->sc_dk.dk_label, - (wd->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0) + if (bounds_check_with_label(bp, wd->sc_dk.dk_label) <= 0) goto done; /* Queue transfer on drive, activate drive and controller if idle. */ bufq_queue(&wd->sc_bufq, bp); diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index 0fcc9747874..a282d9db13f 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccd.c,v 1.93 2011/04/12 20:18:13 miod Exp $ */ +/* $OpenBSD: ccd.c,v 1.94 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */ /*- @@ -649,7 +649,6 @@ ccdstrategy(struct buf *bp) int unit = DISKUNIT(bp->b_dev); struct ccd_softc *cs = &ccd_softc[unit]; int s; - int wlabel; struct disklabel *lp; CCD_DPRINTF(CCDB_FOLLOW, ("ccdstrategy(%p): unit %d\n", bp, unit)); @@ -671,8 +670,7 @@ ccdstrategy(struct buf *bp) * Do bounds checking and adjust transfer. If there's an * error, the bounds check will flag that for us. */ - wlabel = cs->sc_flags & (CCDF_WLABEL|CCDF_LABELLING); - if (bounds_check_with_label(bp, lp, wlabel) <= 0) + if (bounds_check_with_label(bp, lp) <= 0) goto done; bp->b_resid = bp->b_bcount; diff --git a/sys/dev/flash.c b/sys/dev/flash.c index 0ccfdad15f6..965052e5bfa 100644 --- a/sys/dev/flash.c +++ b/sys/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.20 2010/09/24 18:27:43 jasper Exp $ */ +/* $OpenBSD: flash.c,v 1.21 2011/06/03 21:14:11 matthew Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> @@ -811,7 +811,7 @@ flashstrategy(struct buf *bp) goto done; /* Do bounds checking on partitions. */ - if (bounds_check_with_label(bp, sc->sc_dk.dk_label, 0) <= 0) + if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0) goto done; /* Queue the transfer. */ diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index b4012fe2a58..d250f670ae7 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcd.c,v 1.57 2011/06/03 18:22:25 matthew Exp $ */ +/* $OpenBSD: mcd.c,v 1.58 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: mcd.c,v 1.60 1998/01/14 12:14:41 drochner Exp $ */ /* @@ -506,8 +506,7 @@ mcdstrategy(bp) * Do bounds checking, adjust transfer. if error, process. * If end of partition, just return. */ - if (bounds_check_with_label(bp, sc->sc_dk.dk_label, - (sc->flags & (MCDF_WLABEL|MCDF_LABELLING)) != 0) <= 0) + if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0) goto done; /* Queue it. */ diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c index 87918b57b2f..6122fed877a 100644 --- a/sys/dev/raidframe/rf_openbsdkintf.c +++ b/sys/dev/raidframe/rf_openbsdkintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_openbsdkintf.c,v 1.61 2011/04/14 20:59:35 pea Exp $ */ +/* $OpenBSD: rf_openbsdkintf.c,v 1.62 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */ /*- @@ -724,7 +724,6 @@ raidstrategy(struct buf *bp) RF_Raid_t *raidPtr; struct raid_softc *rs = &raid_softc[raidID]; struct disklabel *lp; - int wlabel; s = splbio(); @@ -761,10 +760,9 @@ raidstrategy(struct buf *bp) * Do bounds checking and adjust transfer. If there's an * error, the bounds check will flag that for us. */ - wlabel = rs->sc_flags & (RAIDF_WLABEL | RAIDF_LABELLING); - if (bounds_check_with_label(bp, lp, wlabel) <= 0) { - db1_printf(("Bounds check failed!!:%d %d\n", - (int)bp->b_blkno, (int)wlabel)); + if (bounds_check_with_label(bp, lp) <= 0) { + db1_printf(("Bounds check failed!!: %d\n", + (int)bp->b_blkno)); biodone(bp); goto raidstrategy_end; } diff --git a/sys/dev/ramdisk.c b/sys/dev/ramdisk.c index ec9de3da28d..2703f5b9c97 100644 --- a/sys/dev/ramdisk.c +++ b/sys/dev/ramdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ramdisk.c,v 1.51 2011/05/31 17:35:35 matthew Exp $ */ +/* $OpenBSD: ramdisk.c,v 1.52 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: ramdisk.c,v 1.8 1996/04/12 08:30:09 leo Exp $ */ /* @@ -340,7 +340,7 @@ rdstrategy(struct buf *bp) } /* Do not write on "no trespassing" areas... */ - if (bounds_check_with_label(bp, sc->sc_dk.dk_label, 1) <= 0) + if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0) goto bad; switch (sc->sc_type) { diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index f2526063d99..a54e2a4b6ea 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.123 2011/06/02 19:18:21 deraadt Exp $ */ +/* $OpenBSD: vnd.c,v 1.124 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -352,7 +352,7 @@ vndstrategy(struct buf *bp) /* If we have a label, do a boundary check. */ if (vnd->sc_flags & VNF_HAVELABEL) { - if (bounds_check_with_label(bp, vnd->sc_dk.dk_label, 1) <= 0) { + if (bounds_check_with_label(bp, vnd->sc_dk.dk_label) <= 0) { s = splbio(); biodone(bp); splx(s); diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 1e063759210..088ec406203 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.122 2011/06/01 17:57:51 matthew Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.123 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -684,7 +684,7 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_int openmask) * early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(struct buf *bp, struct disklabel *lp) { struct partition *p = &lp->d_partitions[DISKPART(bp->b_dev)]; daddr64_t sz = howmany(bp->b_bcount, DEV_BSIZE); diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 0325b93c54e..dd8c8cd7717 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.199 2011/05/31 17:35:35 matthew Exp $ */ +/* $OpenBSD: cd.c,v 1.200 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -525,8 +525,7 @@ cdstrategy(struct buf *bp) * Do bounds checking, adjust transfer. if error, process. * If end of partition, just return. */ - if (bounds_check_with_label(bp, sc->sc_dk.dk_label, - (sc->sc_flags & (CDF_WLABEL|CDF_LABELLING)) != 0) <= 0) + if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0) goto done; /* Place it in the queue of disk activities for this disk. */ diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 03fd0487e2c..cfe4650b4e7 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.226 2011/05/31 17:35:35 matthew Exp $ */ +/* $OpenBSD: sd.c,v 1.227 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -573,8 +573,7 @@ sdstrategy(struct buf *bp) * Do bounds checking, adjust transfer. if error, process. * If end of partition, just return. */ - if (bounds_check_with_label(bp, sc->sc_dk.dk_label, - (sc->flags & (SDF_WLABEL|SDF_LABELLING)) != 0) <= 0) + if (bounds_check_with_label(bp, sc->sc_dk.dk_label) <= 0) goto done; /* Place it in the queue of disk activities for this disk. */ diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 113d90a48cc..6c17bf50383 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.50 2011/03/22 19:26:55 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.51 2011/06/03 21:14:11 matthew Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -455,7 +455,7 @@ int checkdisklabel(void *, struct disklabel *, u_int64_t, u_int64_t); int setdisklabel(struct disklabel *, struct disklabel *, u_int); int readdisklabel(dev_t, void (*)(struct buf *), struct disklabel *, int); int writedisklabel(dev_t, void (*)(struct buf *), struct disklabel *); -int bounds_check_with_label(struct buf *, struct disklabel *, int); +int bounds_check_with_label(struct buf *, struct disklabel *); int readdoslabel(struct buf *, void (*)(struct buf *), struct disklabel *, int *, int); #ifdef CD9660 |