diff options
Diffstat (limited to 'sys')
40 files changed, 116 insertions, 107 deletions
diff --git a/sys/arch/amiga/amiga/disksubr.c b/sys/arch/amiga/amiga/disksubr.c index 80739dc94bf..261b41ee638 100644 --- a/sys/arch/amiga/amiga/disksubr.c +++ b/sys/arch/amiga/amiga/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.13 1997/05/29 01:18:18 niklas Exp $ */ +/* $OpenBSD: disksubr.c,v 1.14 1997/08/08 21:46:34 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.27 1996/10/13 03:06:34 christos Exp $ */ /* @@ -502,9 +502,10 @@ writedisklabel(dev, strat, lp, clp) } int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c index 46f0d15589f..5f8088057ec 100644 --- a/sys/arch/amiga/dev/fd.c +++ b/sys/arch/amiga/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.11 1997/01/16 09:24:03 niklas Exp $ */ +/* $OpenBSD: fd.c,v 1.12 1997/08/08 21:46:35 niklas Exp $ */ /* $NetBSD: fd.c,v 1.36 1996/12/23 09:09:59 veego Exp $ */ /* @@ -705,7 +705,8 @@ fdstrategy(bp) bp->b_error = EIO; goto bad; } - if (bounds_check_with_label(bp, lp, sc->wlabel) <= 0) + if (bounds_check_with_label(bp, lp, sc->dkdev.dk_cpulabel, sc->wlabel) + <= 0) goto done; /* diff --git a/sys/arch/arc/arc/disksubr.c b/sys/arch/arc/arc/disksubr.c index d63fba7ae2c..b85a15e73a1 100644 --- a/sys/arch/arc/arc/disksubr.c +++ b/sys/arch/arc/arc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.14 1997/05/08 00:14:29 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.15 1997/08/08 21:46:36 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -84,7 +84,7 @@ readdisklabel(dev, strat, lp, osdep) struct cpu_disklabel *osdep; { struct dos_partition *dp = osdep->dosparts, *dp2; - struct dkbad *bdp = &osdep->bad; + struct dkbad *bdp = &DKBAD(osdep); struct buf *bp; struct disklabel *dlp; char *msg = NULL, *cp; @@ -462,9 +462,10 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/arc/include/disklabel.h b/sys/arch/arc/include/disklabel.h index 4e8c7c14161..5e46f7005b9 100644 --- a/sys/arch/arc/include/disklabel.h +++ b/sys/arch/arc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.6 1997/04/10 13:06:25 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.7 1997/08/08 21:46:37 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */ /* @@ -76,13 +76,10 @@ struct cpu_disklabel { struct dkbad bad; }; +#define DKBAD(x) ((x)->bad) + /* Isolate the relevant bits to get sector and cylinder. */ #define DPSECT(s) ((s) & 0x3f) #define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) -#ifdef _KERNEL -struct disklabel; -int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); -#endif - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/arm32/arm32/disksubr.c b/sys/arch/arm32/arm32/disksubr.c index d35dd1d69c5..ff8c676993e 100644 --- a/sys/arch/arm32/arm32/disksubr.c +++ b/sys/arch/arm32/arm32/disksubr.c @@ -512,9 +512,10 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); diff --git a/sys/arch/arm32/include/disklabel.h b/sys/arch/arm32/include/disklabel.h index 51789255abc..cdf8e09bb3f 100644 --- a/sys/arch/arm32/include/disklabel.h +++ b/sys/arch/arm32/include/disklabel.h @@ -97,6 +97,8 @@ struct cpu_disklabel { struct dkbad bad; }; +#define DKBAD(x) ((x)->bad) + struct filecore_bootblock { u_char padding0[0x1c0]; u_char log2secsize; @@ -124,11 +126,6 @@ struct filecore_bootblock { u_char checksum; }; -#ifdef _KERNEL -struct disklabel; -int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); -#endif /* _KERNEL */ - #endif /* _ARM32_DISKLABEL_H_ */ /* End of disklabel.h */ diff --git a/sys/arch/arm32/mainbus/wd.c b/sys/arch/arm32/mainbus/wd.c index d41c35f0c85..00613810f1f 100644 --- a/sys/arch/arm32/mainbus/wd.c +++ b/sys/arch/arm32/mainbus/wd.c @@ -394,6 +394,7 @@ wdstrategy(bp) */ if (WDPART(bp->b_dev) != RAW_PART && bounds_check_with_label(bp, wd->sc_dk.dk_label, + wd->sc_dk.dk_cpulabel, (wd->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0) goto done; @@ -1606,7 +1607,7 @@ void bad144intern(wd) struct wd_softc *wd; { - struct dkbad *bt = &wd->sc_dk.dk_cpulabel->bad; + struct dkbad *bt = &DKBAD(wd->sc_dk.dk_cpulabel); struct disklabel *lp = wd->sc_dk.dk_label; int i = 0; diff --git a/sys/arch/atari/atari/disksubr.c b/sys/arch/atari/atari/disksubr.c index f7f3cc9c4f9..7afad017ede 100644 --- a/sys/arch/atari/atari/disksubr.c +++ b/sys/arch/atari/atari/disksubr.c @@ -74,10 +74,11 @@ dk_establish() * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) -struct buf *bp; -struct disklabel *lp; -int wlabel; +bounds_check_with_label(bp, lp, osdep, wlabel) + struct buf *bp; + struct disklabel *lp; + struct cpu_disklabel *osdep; + int wlabel; { struct partition *pp; u_int32_t maxsz, sz; diff --git a/sys/arch/atari/dev/fd.c b/sys/arch/atari/dev/fd.c index 6a9c56b68cb..04b303239c2 100644 --- a/sys/arch/atari/dev/fd.c +++ b/sys/arch/atari/dev/fd.c @@ -508,7 +508,7 @@ struct buf *bp; bp->b_error = EIO; goto bad; } - if (bounds_check_with_label(bp, lp, 0) <= 0) + if (bounds_check_with_label(bp, lp, sc->dkdev.dk_cpulabel, 0) <= 0) goto done; if (bp->b_bcount == 0) diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index 928f908c500..b133efa4368 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.5 1997/04/16 11:56:22 downsj Exp $ */ +/* $OpenBSD: disksubr.c,v 1.6 1997/08/08 21:46:42 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -211,9 +211,10 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/hp300/include/disklabel.h b/sys/arch/hp300/include/disklabel.h index 98c0a7ce943..da4e2edfbdc 100644 --- a/sys/arch/hp300/include/disklabel.h +++ b/sys/arch/hp300/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 1997/02/10 01:33:58 downsj Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 1997/08/08 21:46:42 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1994/10/14 18:26:39 cgd Exp $ */ /* @@ -44,9 +44,4 @@ struct cpu_disklabel { int cd_dummy; /* must have one element. */ }; -#ifdef _KERNEL -struct disklabel; -int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); -#endif - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 04195fc0ffc..436f7b05fbe 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.24 1997/05/08 00:05:51 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.25 1997/08/08 21:46:43 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -84,7 +84,7 @@ readdisklabel(dev, strat, lp, osdep) struct cpu_disklabel *osdep; { struct dos_partition *dp = osdep->dosparts, *dp2; - struct dkbad *bdp = &osdep->bad; + struct dkbad *bdp = &DKBAD(osdep); struct buf *bp; struct disklabel *dlp; char *msg = NULL, *cp; @@ -462,9 +462,10 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/i386/include/disklabel.h b/sys/arch/i386/include/disklabel.h index 4868e912f53..146e81c7d8e 100644 --- a/sys/arch/i386/include/disklabel.h +++ b/sys/arch/i386/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.9 1997/04/10 13:06:24 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.10 1997/08/08 21:46:44 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */ /* @@ -76,13 +76,10 @@ struct cpu_disklabel { struct dkbad bad; }; +#define DKBAD(x) ((x)->bad) + /* Isolate the relevant bits to get sector and cylinder. */ #define DPSECT(s) ((s) & 0x3f) #define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) -#ifdef _KERNEL -struct disklabel; -int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); -#endif - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index c65e595ce5a..0949d0f5e2e 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.4 1996/05/26 18:36:16 briggs Exp $ */ +/* $OpenBSD: disksubr.c,v 1.5 1997/08/08 21:46:45 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.14 1996/05/05 06:18:22 briggs Exp $ */ /* @@ -620,9 +620,10 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index 9b8e937a0ba..06bc439958b 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.13 1997/04/07 11:21:25 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.14 1997/08/08 21:46:46 niklas Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -296,9 +296,10 @@ writedisklabel(dev, strat, lp, clp) int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index 2aebdc8bd46..2f25fbf3e16 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -255,9 +255,10 @@ writedisklabel(dev, strat, lp, clp) int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/pc532/pc532/disksubr.c b/sys/arch/pc532/pc532/disksubr.c index 397a7fc9dd3..b133d15a577 100644 --- a/sys/arch/pc532/pc532/disksubr.c +++ b/sys/arch/pc532/pc532/disksubr.c @@ -198,7 +198,11 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) + struct buf *bp; + struct disklabel *lp; + struct cpu_disklabel *osdep; + int wlabel; { struct partition *p = lp->d_partitions + dkpart(bp->b_dev); int maxsz = p->p_size, diff --git a/sys/arch/pmax/pmax/disksubr.c b/sys/arch/pmax/pmax/disksubr.c index 92ab45160a1..c9c4026425d 100644 --- a/sys/arch/pmax/pmax/disksubr.c +++ b/sys/arch/pmax/pmax/disksubr.c @@ -306,9 +306,10 @@ dk_establish(dk, dev) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/powerpc/include/disklabel.h b/sys/arch/powerpc/include/disklabel.h index c2eeefc746d..14c41f8766f 100644 --- a/sys/arch/powerpc/include/disklabel.h +++ b/sys/arch/powerpc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 1997/05/05 16:43:58 rahnds Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 1997/08/08 21:46:49 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.1 1996/09/30 16:34:22 ws Exp $ */ /*- @@ -94,9 +94,4 @@ struct cpu_disklabel { #define DPSECT(s) ((s) & 0x3f) #define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) -#ifdef _KERNEL -struct disklabel; -int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, int wlabel)); -#endif /* _KERNEL */ - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/powerpc/powerpc/disksubr.c b/sys/arch/powerpc/powerpc/disksubr.c index 31443bc7579..cb061328c26 100644 --- a/sys/arch/powerpc/powerpc/disksubr.c +++ b/sys/arch/powerpc/powerpc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.3 1997/04/07 12:00:17 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.4 1997/08/08 21:46:50 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.1 1996/09/30 16:34:43 ws Exp $ */ /* @@ -329,9 +329,10 @@ writedisklabel(dev, strat, lp, osdep) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c index 5bf36fe6db2..10ac25a1764 100644 --- a/sys/arch/sparc/dev/xd.c +++ b/sys/arch/sparc/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.10 1997/08/08 08:25:35 downsj Exp $ */ +/* $OpenBSD: xd.c,v 1.11 1997/08/08 21:46:50 niklas Exp $ */ /* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */ /* @@ -1071,7 +1071,7 @@ xdstrategy(bp) * completion. */ if (bounds_check_with_label(bp, xd->sc_dk.dk_label, - (xd->flags & XD_WLABEL) != 0) <= 0) + xd->sc_dk.dk_cpulabel, (xd->flags & XD_WLABEL) != 0) <= 0) goto done; /* diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c index 2dc3413f2fe..50d250b5c32 100644 --- a/sys/arch/sparc/dev/xy.c +++ b/sys/arch/sparc/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.9 1997/08/08 08:25:39 downsj Exp $ */ +/* $OpenBSD: xy.c,v 1.10 1997/08/08 21:46:51 niklas Exp $ */ /* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */ /* @@ -1033,7 +1033,7 @@ xystrategy(bp) * completion. */ if (bounds_check_with_label(bp, xy->sc_dk.dk_label, - (xy->flags & XY_WLABEL) != 0) <= 0) + xy->sc_dk.dk_cpulabel, (xy->flags & XY_WLABEL) != 0) <= 0) goto done; /* diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index 5558fda3914..0933777b285 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.16 1997/06/25 14:43:27 downsj Exp $ */ +/* $OpenBSD: disksubr.c,v 1.17 1997/08/08 21:46:52 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -293,9 +293,10 @@ writedisklabel(dev, strat, lp, clp) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index a581866f049..48c6160d22b 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xd.c,v 1.10 1997/01/16 04:03:55 kstailey Exp $ */ +/* $OpenBSD: xd.c,v 1.11 1997/08/08 21:46:53 niklas Exp $ */ /* $NetBSD: xd.c,v 1.10 1996/10/13 03:47:39 christos Exp $ */ /* @@ -1036,7 +1036,7 @@ xdstrategy(bp) * completion. */ if (bounds_check_with_label(bp, xd->sc_dk.dk_label, - (xd->flags & XD_WLABEL) != 0) <= 0) + xd->sc_dk.dk_cpulabel, (xd->flags & XD_WLABEL) != 0) <= 0) goto done; /* diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index a7df9924e20..c09c3deb1c6 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xy.c,v 1.9 1997/01/16 04:03:58 kstailey Exp $ */ +/* $OpenBSD: xy.c,v 1.10 1997/08/08 21:46:54 niklas Exp $ */ /* $NetBSD: xy.c,v 1.11 1996/10/13 03:47:40 christos Exp $ */ /* @@ -999,7 +999,7 @@ xystrategy(bp) * completion. */ if (bounds_check_with_label(bp, xy->sc_dk.dk_label, - (xy->flags & XY_WLABEL) != 0) <= 0) + xy->sc_dk.dk_cpulabel, (xy->flags & XY_WLABEL) != 0) <= 0) goto done; /* diff --git a/sys/arch/sun3/sun3/disksubr.c b/sys/arch/sun3/sun3/disksubr.c index 40dd1a150f8..275339eb447 100644 --- a/sys/arch/sun3/sun3/disksubr.c +++ b/sys/arch/sun3/sun3/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.10 1997/04/07 12:01:19 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.11 1997/08/08 21:46:55 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.14 1996/09/26 18:10:21 gwr Exp $ */ /* @@ -239,7 +239,11 @@ writedisklabel(dev, strat, lp, clp) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) + struct buf *bp; + struct disklabel *lp; + struct cpu_disklabel *osdep; + int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + dkpart(bp->b_dev); diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c index 15dfe30a331..3195f48f71c 100644 --- a/sys/arch/vax/mba/hp.c +++ b/sys/arch/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hp.c,v 1.5 1997/05/29 00:04:58 niklas Exp $ */ +/* $OpenBSD: hp.c,v 1.6 1997/08/08 21:46:56 niklas Exp $ */ /* $NetBSD: hp.c,v 1.12 1996/10/13 03:34:58 christos Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -178,8 +178,8 @@ hpstrategy(bp) unit = DISKUNIT(bp->b_dev); sc = hp_cd.cd_devs[unit]; - if (bounds_check_with_label(bp, sc->sc_disk.dk_label, sc->sc_wlabel) - <= 0) + if (bounds_check_with_label(bp, sc->sc_disk.dk_label, + sc->sc_disk.dk_cpulabel, sc->sc_wlabel) <= 0) goto done; s = splbio(); diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index f49d8a412f3..54c3f01484b 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.2 1997/05/29 00:05:02 niklas Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.3 1997/08/08 21:46:56 niklas Exp $ */ /* $NetBSD: mscp_disk.c,v 1.7 1997/01/11 11:20:32 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -382,7 +382,7 @@ rastrategy(bp) } } else if (bounds_check_with_label(bp, ra->ra_disk.dk_label, - ra->ra_wlabel) <= 0) { + ra->ra_disk.dk_cpulabel, ra->ra_wlabel) <= 0) { bp->b_error = ENXIO; goto bad; } diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index bb24cef3c4a..6861cbf435d 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.7 1997/05/29 00:05:16 niklas Exp $ */ +/* $OpenBSD: disksubr.c,v 1.8 1997/08/08 21:46:57 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.11 1997/01/11 11:24:51 ragge Exp $ */ /* @@ -66,9 +66,10 @@ int cpu_writedisklabel __P((dev_t, void (*)(struct buf *), * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/arch/wgrisc/include/disklabel.h b/sys/arch/wgrisc/include/disklabel.h index 9b7f44b9f9c..6512f34c0f8 100644 --- a/sys/arch/wgrisc/include/disklabel.h +++ b/sys/arch/wgrisc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 1997/08/01 21:58:37 pefo Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 1997/08/08 21:46:58 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.3 1996/03/09 20:52:54 ghudson Exp $ */ /* @@ -76,13 +76,10 @@ struct cpu_disklabel { struct dkbad bad; }; +#define DKBAD(x) ((x)->bad) + /* Isolate the relevant bits to get sector and cylinder. */ #define DPSECT(s) ((s) & 0x3f) #define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) -#ifdef _KERNEL -struct disklabel; -int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); -#endif - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/wgrisc/wgrisc/disksubr.c b/sys/arch/wgrisc/wgrisc/disksubr.c index 9205c18ca32..40cf5dc6a5a 100644 --- a/sys/arch/wgrisc/wgrisc/disksubr.c +++ b/sys/arch/wgrisc/wgrisc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.4 1997/08/01 21:58:38 pefo Exp $ */ +/* $OpenBSD: disksubr.c,v 1.5 1997/08/08 21:46:59 niklas Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -84,7 +84,7 @@ readdisklabel(dev, strat, lp, osdep) struct cpu_disklabel *osdep; { struct dos_partition *dp = osdep->dosparts, *dp2; - struct dkbad *bdp = &osdep->bad; + struct dkbad *bdp = &DKBAD(osdep); struct buf *bp; struct disklabel *dlp; char *msg = NULL, *cp; @@ -462,9 +462,10 @@ done: * if needed, and signal errors or early completion. */ int -bounds_check_with_label(bp, lp, wlabel) +bounds_check_with_label(bp, lp, osdep, wlabel) struct buf *bp; struct disklabel *lp; + struct cpu_disklabel *osdep; int wlabel; { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) diff --git a/sys/dev/atapi/acd.c b/sys/dev/atapi/acd.c index 5d4c74aca34..39a696e1522 100644 --- a/sys/dev/atapi/acd.c +++ b/sys/dev/atapi/acd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acd.c,v 1.26 1997/07/07 19:48:46 niklas Exp $ */ +/* $OpenBSD: acd.c,v 1.27 1997/08/08 21:47:00 niklas Exp $ */ /* * Copyright (c) 1996 Manuel Bouyer. All rights reserved. @@ -490,6 +490,7 @@ acdstrategy(bp) */ if (CDPART(bp->b_dev) != RAW_PART && bounds_check_with_label(bp, acd->sc_dk.dk_label, + acd->sc_dk.dk_cpulabel, (acd->flags & (CDF_WLABEL|CDF_LABELLING)) != 0) <= 0) goto done; diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index 6973b33eb31..1049486f517 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccd.c,v 1.16 1997/02/13 23:33:26 niklas Exp $ */ +/* $OpenBSD: ccd.c,v 1.17 1997/08/08 21:47:01 niklas Exp $ */ /* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */ /*- @@ -660,8 +660,9 @@ ccdstrategy(bp) * error, the bounds check will flag that for us. */ wlabel = cs->sc_flags & (CCDF_WLABEL|CCDF_LABELLING); - if (DISKPART(bp->b_dev) != RAW_PART) - if (bounds_check_with_label(bp, lp, wlabel) <= 0) + if (DISKPART(bp->b_dev) != RAW_PART && + bounds_check_with_label(bp, lp, cs->sc_dkdev.dk_cpulabel, + wlabel) <= 0) goto done; bp->b_resid = bp->b_bcount; diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index 3436a03642e..dae77a73474 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcd.c,v 1.19 1997/01/04 08:50:25 deraadt Exp $ */ +/* $OpenBSD: mcd.c,v 1.20 1997/08/08 21:47:02 niklas Exp $ */ /* $NetBSD: mcd.c,v 1.49 1996/05/12 23:53:11 mycroft Exp $ */ /* @@ -466,6 +466,7 @@ mcdstrategy(bp) */ if (MCDPART(bp->b_dev) != RAW_PART && bounds_check_with_label(bp, sc->sc_dk.dk_label, + sc->sc_dk.dk_cpulabel, (sc->flags & (MCDF_WLABEL|MCDF_LABELLING)) != 0) <= 0) goto done; diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c index 931c7b003fb..ab275e72ce0 100644 --- a/sys/dev/isa/wd.c +++ b/sys/dev/isa/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.26 1997/07/06 18:10:17 niklas Exp $ */ +/* $OpenBSD: wd.c,v 1.27 1997/08/08 21:47:03 niklas Exp $ */ /* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */ /* @@ -104,7 +104,7 @@ bdev_decl(wd); void wdfinish __P((struct wd_softc *, struct buf *)); int wdsetctlr __P((struct wd_link *)); -#if !defined(amiga) +#ifdef DKBAD static void bad144intern __P((struct wd_softc *)); #endif int wdlock __P((struct wd_link *)); @@ -252,6 +252,7 @@ wdstrategy(bp) */ if (WDPART(bp->b_dev) != RAW_PART && bounds_check_with_label(bp, wd->sc_dk.dk_label, + wdd->sc_dk.dk_cpulabel, (d_link->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0) goto done; @@ -572,7 +573,7 @@ wdgetdisklabel(dev, wd) if (d_link->sc_state > GEOMETRY) d_link->sc_state = GEOMETRY; -#if !defined(amiga) +#ifdef DKBAD if ((lp->d_flags & D_BADSECT) != 0) bad144intern(wd); #endif @@ -613,7 +614,7 @@ wdioctl(dev, xfer, addr, flag, p) { struct wd_softc *wd = wd_cd.cd_devs[WDUNIT(dev)]; struct wd_link *d_link = wd->d_link; -#ifndef amiga +#ifdef DKBAD int error; #endif @@ -623,11 +624,11 @@ wdioctl(dev, xfer, addr, flag, p) return EIO; switch (xfer) { -#if !defined(amiga) +#ifdef DKBAD case DIOCSBAD: if ((flag & FWRITE) == 0) return EBADF; - wd->sc_dk.dk_cpulabel->bad = *(struct dkbad *)addr; + DKBAD(wd->sc_dk.dk_cpulabel) = *(struct dkbad *)addr; wd->sc_dk.dk_label->d_flags |= D_BADSECT; bad144intern(wd); return 0; @@ -643,7 +644,6 @@ wdioctl(dev, xfer, addr, flag, p) &wd->sc_dk.dk_label->d_partitions[WDPART(dev)]; return 0; -#ifndef amiga case DIOCWDINFO: case DIOCSDINFO: if ((flag & FWRITE) == 0) @@ -705,7 +705,6 @@ wdioctl(dev, xfer, addr, flag, p) return error; } #endif -#endif default: return ENOTTY; @@ -908,7 +907,7 @@ wddump(dev, blkno, va, size) } #endif /* __BDEVSW_DUMP_NEW_TYPE */ -#if !defined(amiga) +#ifdef DKBAD /* * Internalize the bad sector table. */ @@ -916,7 +915,7 @@ void bad144intern(wd) struct wd_softc *wd; { - struct dkbad *bt = &wd->sc_dk.dk_cpulabel->bad; + struct dkbad *bt = &DKBAD(wd->sc_dk.dk_cpulabel); struct disklabel *lp = wd->sc_dk.dk_label; struct wd_link *d_link = wd->d_link; int i = 0; diff --git a/sys/dev/ofw/ofdisk.c b/sys/dev/ofw/ofdisk.c index addefb26dc3..819b2280bf9 100644 --- a/sys/dev/ofw/ofdisk.c +++ b/sys/dev/ofw/ofdisk.c @@ -243,7 +243,8 @@ ofdstrategy(bp) OF_io = bp->b_flags & B_READ ? OF_read : OF_write; if (DISKPART(bp->b_dev) != RAW_PART) { - if (bounds_check_with_label(bp, of->sc_dk.dk_label, 0) <= 0) { + if (bounds_check_with_label(bp, of->sc_dk.dk_label, + of->sc_dk.dk_cpulabel, 0) <= 0) { bp->b_resid = bp->b_bcount; goto done; } diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index b7b67cd5b64..f87a7e8b182 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.15 1997/06/09 09:41:08 deraadt Exp $ */ +/* $OpenBSD: vnd.c,v 1.16 1997/08/08 21:47:01 niklas Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -391,7 +391,8 @@ vndstrategy(bp) return; } if (DISKPART(bp->b_dev) != RAW_PART && - bounds_check_with_label(bp, vnd->sc_dk.dk_label, 1) == 0) { + bounds_check_with_label(bp, vnd->sc_dk.dk_label, + vnd->sc_dk.dk_cpulabel, 1) == 0) { biodone(bp); return; } diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 963b0c6c7be..6e9e730e6be 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.23 1997/04/14 04:09:03 downsj Exp $ */ +/* $OpenBSD: cd.c,v 1.24 1997/08/08 21:47:05 niklas Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -486,6 +486,7 @@ cdstrategy(bp) */ if (CDPART(bp->b_dev) != RAW_PART && bounds_check_with_label(bp, cd->sc_dk.dk_label, + cd->sc_dk.dk_cpulabel, (cd->flags & (CDF_WLABEL|CDF_LABELLING)) != 0) <= 0) goto done; diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index b76267252d1..56b01e9cacb 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.24 1997/07/26 21:07:36 millert Exp $ */ +/* $OpenBSD: sd.c,v 1.25 1997/08/08 21:47:06 niklas Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /* @@ -473,6 +473,7 @@ sdstrategy(bp) */ if (SDPART(bp->b_dev) != RAW_PART && bounds_check_with_label(bp, sd->sc_dk.dk_label, + sd->sc_dk.dk_cpulabel, (sd->flags & (SDF_WLABEL|SDF_LABELLING)) != 0) <= 0) goto done; diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index a14cd2d5cac..e42ab0359cb 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.12 1997/05/31 06:17:10 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.13 1997/08/08 21:47:06 niklas Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -349,7 +349,8 @@ char *readdisklabel __P((dev_t, void (*)(struct buf *), struct disklabel *, struct cpu_disklabel *)); int writedisklabel __P((dev_t, void (*)(struct buf *), struct disklabel *, struct cpu_disklabel *)); -int bounds_check_with_label __P((struct buf *, struct disklabel *, int)); +int bounds_check_with_label __P((struct buf *, struct disklabel *, + struct cpu_disklabel *, int)); #ifdef CD9660 int iso_disklabelspoof __P((dev_t dev, void (*strat) __P((struct buf *)), struct disklabel *lp)); |