diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-08-08 21:47:07 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-08-08 21:47:07 +0000 |
commit | e83b776d913d8ba599aa39549c620fb533c8de53 (patch) | |
tree | 91402695de0f0016c37fac593b91f9316fa38b34 /sys/dev/isa | |
parent | fa3ac60890d403b6994891797ae40ea98456004a (diff) |
Change the bounds_check_with_label API to also take a cpu_disklabel
reference for making transferral of meta-information possible from
readdisklabel to bounds_check_with_label. The first (and maybe only)
thing that will use this is the multi-disklabel-format code on the
alpha where the labelsector is passed via cpu_disklabel so the label
write-protection can work correctly no matter what label was found.
Also use a new macro DKBAD to get at the dkbad field of the cpu_disklabel
implementations that contain it. This too is for multi-disklabel
architectures where the "bad" field can be inside a union. Use this
macro as a means for a driver to check if an architecture supports
dkbad constructs.
Remove proto of bounds_check_with_label from all MD disklabel.h as it
is in sys/disklabel.h.
I have not been able to test the changes everywhere, if I break anything
I apologize, and promise to fix it as soon as I become aware of it.
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/mcd.c | 3 | ||||
-rw-r--r-- | sys/dev/isa/wd.c | 19 |
2 files changed, 11 insertions, 11 deletions
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; |