diff options
author | 2007-06-20 18:15:43 +0000 | |
---|---|---|
committer | 2007-06-20 18:15:43 +0000 | |
commit | c326f117376551b79ce73d7cceafef3cc69e5a5b (patch) | |
tree | b433a35b9c6c80c0945dfe897df03127f92fa806 | |
parent | Better recovery when osiop goes nuts and spits (diff) | |
download | wireguard-openbsd-c326f117376551b79ce73d7cceafef3cc69e5a5b.tar.xz wireguard-openbsd-c326f117376551b79ce73d7cceafef3cc69e5a5b.zip |
b_cylinder does not need to be set on the callpath down into drivers.
cpu_disklabel can go away, since nothing anymore needs to use it; ok miod
61 files changed, 275 insertions, 543 deletions
diff --git a/share/man/man9/disk.9 b/share/man/man9/disk.9 index 0d352d7ce4a..3dbf7632921 100644 --- a/share/man/man9/disk.9 +++ b/share/man/man9/disk.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: disk.9,v 1.24 2007/05/31 19:20:00 jmc Exp $ +.\" $OpenBSD: disk.9,v 1.25 2007/06/20 18:15:47 deraadt Exp $ .\" $NetBSD: disk.9,v 1.2 1996/04/08 20:41:25 jtc Exp $ .\" .\" Copyright (c) 1995, 1996 Jason R. Thorpe. @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: June 20 2007 $ .Dt DISK 9 .Os .Sh NAME @@ -91,7 +91,6 @@ struct disk { */ daddr_t dk_labelsector; /* sector containing label */ struct disklabel *dk_label; /* label */ - struct cpu_disklabel *dk_cpulabel; }; .Ed .Pp diff --git a/share/man/man9/disklabel.9 b/share/man/man9/disklabel.9 index e12c29be990..eb8fe9fbe0d 100644 --- a/share/man/man9/disklabel.9 +++ b/share/man/man9/disklabel.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: disklabel.9,v 1.11 2007/06/06 16:42:22 deraadt Exp $ +.\" $OpenBSD: disklabel.9,v 1.12 2007/06/20 18:15:47 deraadt Exp $ .\" $NetBSD: disklabel.9,v 1.7 1999/03/06 22:09:29 mycroft Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: June 6 2007 $ +.Dd $Mdocdate: June 20 2007 $ .Dt DISKLABEL 9 .Os .Sh NAME @@ -49,13 +49,13 @@ .Fd #include <sys/param.h> .Fd #include <sys/disklabel.h> .Ft char * -.Fn readdisklabel "dev_t dev" "void (*strat)(struct buf *)" "struct disklabel *lp" "struct cpu_disklabel *osdep" "int spoofonly" +.Fn readdisklabel "dev_t dev" "void (*strat)(struct buf *)" "struct disklabel *lp" "int spoofonly" .Ft int -.Fn writedisklabel "dev_t dev" "void (*strat)(struct buf *)" "struct disklabel *lp" "struct cpu_disklabel *osdep" +.Fn writedisklabel "dev_t dev" "void (*strat)(struct buf *)" "struct disklabel *lp" .Ft int -.Fn setdisklabel "struct disklabel *olp" "struct disklabel *nlp" "u_int openmask" "struct cpu_disklabel *osdep" +.Fn setdisklabel "struct disklabel *olp" "struct disklabel *nlp" "u_int openmask" .Ft int -.Fn bounds_check_with_label "struct buf *bp" "struct disklabel *lp" "struct cpu_disklabel *osdep" "int wlabel" +.Fn bounds_check_with_label "struct buf *bp" "struct disklabel *lp" "int wlabel" .Sh DESCRIPTION This collection of routines provides a disklabel management interface to kernel device drivers. @@ -89,11 +89,6 @@ If the medium does not contain a native disklabel that can be read in directly or .Fa spoofonly argument is a true value, -.Fn readdisklabel -may resort to constructing a label from other machine-dependent information -using the provided buffer passed in the -.Fa osdep -argument. If a disk label can not be found or constructed, a string containing an approximated description of the failure mode is returned. Otherwise the @@ -110,15 +105,6 @@ Like it acquires and sets up an I/O buffer to pass to the strategy routine .Fa strat . .Fn writedisklabel -may elect to do a machine-dependent conversion of the native disk label -structure -.Po -using the buffer pointed at by -.Fa osdep -.Pc , -to store the disk label onto the medium in a format complying with -architectural constraints. -.Fn writedisklabel returns 0 on success and .Dv EINVAL if the disk label specifies invalid or unconvertible values. diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 0f0648ca81e..a3b146cd2db 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.88 2007/06/17 00:27:28 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.89 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -50,7 +50,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -66,7 +66,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto doslabel; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -80,7 +79,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; doslabel: - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -109,8 +108,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { u_int64_t csum = 0, *p; struct disklabel *dlp; @@ -122,7 +120,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_dev = dev; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/alpha/include/disklabel.h b/sys/arch/alpha/include/disklabel.h index f81332f04e3..628956a84dc 100644 --- a/sys/arch/alpha/include/disklabel.h +++ b/sys/arch/alpha/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.22 2007/06/17 15:05:08 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.23 2007/06/20 18:15:43 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 64 #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index bd5ee824c59..d10cb9be217 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.52 2007/06/18 07:09:25 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.53 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -63,7 +63,7 @@ bios_diskinfo_t *bios_getdiskinfo(dev_t dev); char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { bios_diskinfo_t *pdi; struct buf *bp = NULL; @@ -96,7 +96,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -125,10 +125,9 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct disklabel *dlp; struct buf *bp = NULL; @@ -136,12 +135,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/amd64/include/disklabel.h b/sys/arch/amd64/include/disklabel.h index 12c78faa294..7b3727b6db7 100644 --- a/sys/arch/amd64/include/disklabel.h +++ b/sys/arch/amd64/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.9 2007/06/17 00:27:26 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.10 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c index 8b98f732e10..d95277a2bf6 100644 --- a/sys/arch/arm/arm/disksubr.c +++ b/sys/arch/arm/arm/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.47 2007/06/18 07:11:01 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.48 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -57,7 +57,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -69,7 +69,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -98,10 +98,9 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct disklabel *dlp; struct buf *bp = NULL; @@ -109,12 +108,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/arm/include/disklabel.h b/sys/arch/arm/include/disklabel.h index 621c3ae8de1..f4d66b2165e 100644 --- a/sys/arch/arm/include/disklabel.h +++ b/sys/arch/arm/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.12 2007/06/17 00:27:26 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.13 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Mark Brinicombe. @@ -42,7 +42,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _ARM_DISKLABEL_H_ */ diff --git a/sys/arch/aviion/aviion/disksubr.c b/sys/arch/aviion/aviion/disksubr.c index e2df4d501f2..9cfddd9b8c1 100644 --- a/sys/arch/aviion/aviion/disksubr.c +++ b/sys/arch/aviion/aviion/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.38 2007/06/18 07:09:25 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.39 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -57,7 +57,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -69,7 +69,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -98,8 +98,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { int error = EIO, partoff = -1, cyl = 0; struct disklabel *dlp; @@ -109,12 +108,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/aviion/include/disklabel.h b/sys/arch/aviion/include/disklabel.h index e97b301aea7..69990cf768e 100644 --- a/sys/arch/aviion/include/disklabel.h +++ b/sys/arch/aviion/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.8 2007/06/17 00:27:26 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.9 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Mark Brinicombe. @@ -42,7 +42,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _AVIION_DISKLABEL_H_ */ diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c index 13abead54f5..63b8e1bdf0c 100644 --- a/sys/arch/hp300/dev/hd.c +++ b/sys/arch/hp300/dev/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hd.c,v 1.50 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: hd.c,v 1.51 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */ /* @@ -237,8 +237,7 @@ int hdident(struct device *, struct hd_softc *, struct hpibbus_attach_args *); void hdreset(int, int, int); void hdustart(struct hd_softc *); -void hdgetdisklabel(dev_t, struct hd_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void hdgetdisklabel(dev_t, struct hd_softc *, struct disklabel *, int); void hdrestart(void *); struct buf *hdfinish(struct hd_softc *, struct buf *); @@ -478,17 +477,15 @@ hdreset(ctlr, slave, punit) * Read or construct a disklabel */ void -hdgetdisklabel(dev, rs, lp, clp, spoofonly) +hdgetdisklabel(dev, rs, lp, spoofonly) dev_t dev; struct hd_softc *rs; struct disklabel *lp; - struct cpu_disklabel *clp; int spoofonly; { char *errstring; bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); /* * Create a default disk label based on geometry. @@ -526,7 +523,7 @@ hdgetdisklabel(dev, rs, lp, clp, spoofonly) /* * Now try to read the disklabel */ - errstring = readdisklabel(DISKLABELDEV(dev), hdstrategy, lp, clp, + errstring = readdisklabel(DISKLABELDEV(dev), hdstrategy, lp, spoofonly); if (errstring) { /* printf("%s: %s\n", rs->sc_dev.dv_xname, errstring); */ @@ -561,8 +558,7 @@ hdopen(dev, flags, mode, p) */ if (rs->sc_dkdev.dk_openmask == 0) { rs->sc_flags |= HDF_OPENING; - hdgetdisklabel(dev, rs, rs->sc_dkdev.dk_label, - rs->sc_dkdev.dk_cpulabel, 0); + hdgetdisklabel(dev, rs, rs->sc_dkdev.dk_label, 0); rs->sc_flags &= ~HDF_OPENING; } @@ -700,7 +696,6 @@ hdstrategy(bp) bp->b_cylinder = bp->b_blkno; } else { if (bounds_check_with_label(bp, rs->sc_dkdev.dk_label, - rs->sc_dkdev.dk_cpulabel, (rs->sc_flags & HDF_WLABEL) != 0) <= 0) goto done; @@ -1150,13 +1145,9 @@ hdioctl(dev, cmd, data, flag, p) if (sc == NULL) return (ENXIO); - switch (cmd) { + switch (cmd) case DIOCGPDINFO: - { - struct cpu_disklabel osdep; - - hdgetdisklabel(dev, sc, (struct disklabel *)data, &osdep, 1); - } + hdgetdisklabel(dev, sc, (struct disklabel *)data, 1); goto exit; case DIOCGDINFO: @@ -1192,13 +1183,11 @@ hdioctl(dev, cmd, data, flag, p) sc->sc_flags |= HDF_WLABEL; error = setdisklabel(sc->sc_dkdev.dk_label, - (struct disklabel *)data, /* sc->sc_dkdev.dk_openmask */ 0, - sc->sc_dkdev.dk_cpulabel); + (struct disklabel *)data, /* sc->sc_dkdev.dk_openmask */ 0); if (error == 0) { if (cmd == DIOCWDINFO) error = writedisklabel(DISKLABELDEV(dev), - hdstrategy, sc->sc_dkdev.dk_label, - sc->sc_dkdev.dk_cpulabel); + hdstrategy, sc->sc_dkdev.dk_label); } sc->sc_flags &= ~HDF_WLABEL; diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index a83996d1459..4c05c27c341 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.40 2007/06/17 00:27:28 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.41 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -51,7 +51,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -69,7 +69,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -105,8 +104,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; struct disklabel *dlp; diff --git a/sys/arch/hp300/include/disklabel.h b/sys/arch/hp300/include/disklabel.h index 4554198550c..29c598bccf1 100644 --- a/sys/arch/hp300/include/disklabel.h +++ b/sys/arch/hp300/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.7 2007/06/18 17:11:52 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.8 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index 6767c74ca78..6af912c175a 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.68 2007/06/18 21:38:42 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.69 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -39,7 +39,7 @@ #include <sys/disk.h> char *readliflabel(struct buf *, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *, int); + struct disklabel *, int *, int); /* * Attempt to read a disk label from a device @@ -53,7 +53,7 @@ char *readliflabel(struct buf *, void (*)(struct buf *), */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -65,11 +65,11 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readliflabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readliflabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -96,8 +96,7 @@ done: char * readliflabel(struct buf *bp, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, - int *partoffp, int *cylp, int spoofonly) + struct disklabel *lp, int *partoffp, int spoofonly) { struct buf *dbp = NULL; struct lifdir *p; @@ -109,7 +108,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = btodb(LIF_VOLSTART); bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = btodb(LIF_VOLSTART) / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) return "LIF volume header I/O error"; @@ -125,7 +123,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), dbp->b_blkno = lifstodb(lvp->vol_addr); dbp->b_bcount = lp->d_secsize; dbp->b_flags = B_BUSY | B_READ; - dbp->b_cylinder = dbp->b_blkno / lp->d_secpercyl; (*strat)(dbp); if (biowait(dbp)) { @@ -158,7 +155,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), dbp->b_blkno = lifstodb(p->dir_addr); dbp->b_bcount = lp->d_secsize; dbp->b_flags = B_BUSY | B_READ; - dbp->b_cylinder = dbp->b_blkno / lp->d_secpercyl; (*strat)(dbp); if (biowait(dbp)) { @@ -221,7 +217,6 @@ finished: goto done; bp->b_blkno = fsoff + LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -246,10 +241,9 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct disklabel *dlp; struct buf *bp = NULL; @@ -257,13 +251,12 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readliflabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL && - readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readliflabel(bp, strat, lp, &partoff, 1) != NULL && + readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/hppa/include/disklabel.h b/sys/arch/hppa/include/disklabel.h index cecaaa7c40d..701535bf4c2 100644 --- a/sys/arch/hppa/include/disklabel.h +++ b/sys/arch/hppa/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.20 2007/06/18 21:38:42 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.21 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -126,7 +126,4 @@ struct hpux_label { #define lifstob(s) ((s) * LIF_SECTSIZE) #define lifstodb(s) ((s) * LIF_SECTSIZE / DEV_BSIZE) -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c index 93489f7e7d5..74aeed3e008 100644 --- a/sys/arch/hppa64/hppa64/disksubr.c +++ b/sys/arch/hppa64/hppa64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.51 2007/06/18 21:45:21 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.52 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -39,7 +39,7 @@ #include <sys/disk.h> char *readliflabel(struct buf *, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *, int); + struct disklabel *, int *, int); /* * Attempt to read a disk label from a device @@ -53,7 +53,7 @@ char *readliflabel(struct buf *, void (*)(struct buf *), */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -65,11 +65,11 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readliflabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readliflabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -96,8 +96,7 @@ done: char * readliflabel(struct buf *bp, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, - int *partoffp, int *cylp, int spoofonly) + struct disklabel *lp, int *partoffp, int spoofonly) { struct buf *dbp = NULL; struct lifdir *p; @@ -109,7 +108,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = btodb(LIF_VOLSTART); bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = btodb(LIF_VOLSTART) / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) return "LIF volume header I/O error"; @@ -125,7 +123,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), dbp->b_blkno = lifstodb(lvp->vol_addr); dbp->b_bcount = lp->d_secsize; dbp->b_flags = B_BUSY | B_READ; - dbp->b_cylinder = dbp->b_blkno / lp->d_secpercyl; (*strat)(dbp); if (biowait(dbp)) { @@ -158,7 +155,6 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), dbp->b_blkno = lifstodb(p->dir_addr); dbp->b_bcount = lp->d_secsize; dbp->b_flags = B_BUSY | B_READ; - dbp->b_cylinder = dbp->b_blkno / lp->d_secpercyl; (*strat)(dbp); if (biowait(dbp)) { @@ -221,7 +217,6 @@ finished: goto done; bp->b_blkno = fsoff + LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -246,8 +241,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { int error = EIO, partoff = -1, cyl = 0; struct disklabel *dlp; @@ -257,13 +251,12 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readliflabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL && - readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readliflabel(bp, strat, lp, &partoff, 1) != NULL && + readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/hppa64/include/disklabel.h b/sys/arch/hppa64/include/disklabel.h index cce08f14a6d..bad291819a3 100644 --- a/sys/arch/hppa64/include/disklabel.h +++ b/sys/arch/hppa64/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.14 2007/06/18 21:45:21 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.15 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -126,7 +126,4 @@ struct hpux_label { #define lifstob(s) ((s) * LIF_SECTSIZE) #define lifstodb(s) ((s) * LIF_SECTSIZE / DEV_BSIZE) -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 28895d0329e..2c53e4e0914 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.93 2007/06/18 07:09:24 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.94 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -63,7 +63,7 @@ bios_diskinfo_t *bios_getdiskinfo(dev_t dev); char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { bios_diskinfo_t *pdi; struct buf *bp = NULL; @@ -96,7 +96,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -125,10 +125,9 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct disklabel *dlp; struct buf *bp = NULL; @@ -136,12 +135,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/i386/include/disklabel.h b/sys/arch/i386/include/disklabel.h index 009a100a3a0..d22293f9865 100644 --- a/sys/arch/i386/include/disklabel.h +++ b/sys/arch/i386/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.33 2007/06/17 00:27:27 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.34 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/landisk/landisk/disksubr.c b/sys/arch/landisk/landisk/disksubr.c index e99738d3ead..7aa5b895c5a 100644 --- a/sys/arch/landisk/landisk/disksubr.c +++ b/sys/arch/landisk/landisk/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.35 2007/06/18 07:09:25 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.36 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -57,7 +57,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -69,7 +69,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -98,10 +98,9 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct disklabel *dlp; struct buf *bp = NULL; @@ -109,12 +108,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/luna88k/include/disklabel.h b/sys/arch/luna88k/include/disklabel.h index 4b35ec2c743..9626b3c393b 100644 --- a/sys/arch/luna88k/include/disklabel.h +++ b/sys/arch/luna88k/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.4 2007/06/19 12:33:59 krw Exp $ */ +/* $OpenBSD: disklabel.h,v 1.5 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,13 +37,4 @@ #define LABELOFFSET 64 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -/* - * This holds a copy of the whole label block, saved in here by - * readdisklabel() so that writedisklabel() can preserve the - * parts of the label block outside of the actual label. - * (i.e. Sun label info, etc.) - */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c index 897ec13283c..aa8a2365880 100644 --- a/sys/arch/luna88k/luna88k/disksubr.c +++ b/sys/arch/luna88k/luna88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.32 2007/06/19 12:33:59 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.33 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */ /* @@ -105,7 +105,7 @@ int disklabel_bsd_to_om(struct disklabel *, struct sun_disklabel *); */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct sun_disklabel *slp; struct buf *bp = NULL; @@ -166,8 +166,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; int error; diff --git a/sys/arch/mac68k/include/disklabel.h b/sys/arch/mac68k/include/disklabel.h index 1f07b724393..6142b2af4d2 100644 --- a/sys/arch/mac68k/include/disklabel.h +++ b/sys/arch/mac68k/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.7 2007/06/17 00:27:27 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.8 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 64 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MAC68K_DISKLABEL_H_ */ diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index 9da35be7d00..bff47bf9d38 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.49 2007/06/17 15:30:03 martin Exp $ */ +/* $OpenBSD: disksubr.c,v 1.50 2007/06/20 18:15:45 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */ /* @@ -97,7 +97,7 @@ int whichType(struct partmapentry *); int fixPartTable(struct partmapentry *, long, char *); void setPart(struct partmapentry *, struct disklabel *, int, int); int getNamedType(struct partmapentry *, int, struct disklabel *, int, int, int *); -char *read_mac_label(char *, struct disklabel *, struct cpu_disklabel *); +char *read_mac_label(char *, struct disklabel *); /* * Find an entry in the disk label that is unused and return it @@ -262,7 +262,7 @@ skip: * disk. This whole algorithm should probably be changed in the future. */ char * -read_mac_label(char *dlbuf, struct disklabel *lp, struct cpu_disklabel *osdep) +read_mac_label(char *dlbuf, struct disklabel *lp) { int i, num_parts, maxslot = RAW_PART; struct partmapentry *pmap; @@ -330,7 +330,7 @@ read_mac_label(char *dlbuf, struct disklabel *lp, struct cpu_disklabel *osdep) */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; u_int16_t *sbSigp; @@ -347,7 +347,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = size; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -356,12 +355,12 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), sbSigp = (u_int16_t *)bp->b_data; if (*sbSigp == 0x4552) { - msg = read_mac_label(bp->b_data, lp, osdep); + msg = read_mac_label(bp->b_data, lp); if (msg == NULL) goto done; } - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -369,7 +368,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -408,8 +406,7 @@ done: * refuse to write a disklabel if the media has a MacOS signature. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; struct disklabel *dlp; @@ -423,7 +420,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; diff --git a/sys/arch/macppc/include/disklabel.h b/sys/arch/macppc/include/disklabel.h index e47e025c6f7..83c3e06b191 100644 --- a/sys/arch/macppc/include/disklabel.h +++ b/sys/arch/macppc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.13 2007/06/18 08:41:06 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.14 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -87,7 +87,4 @@ struct part_map_entry { #define PART_TYPE_MAC "APPLE_HFS" #define PART_TYPE_OPENBSD "OPENBSD" -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index eea96967fb8..7430bb4e338 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.56 2007/06/18 08:41:04 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.57 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -38,7 +38,7 @@ #include <sys/disk.h> char *readdpmelabel(struct buf *, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *, int); + struct disklabel *, int *, int); /* * Attempt to read a disk label from a device @@ -60,7 +60,7 @@ char *readdpmelabel(struct buf *, void (*)(struct buf *), */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -72,11 +72,11 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdpmelabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdpmelabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -103,8 +103,7 @@ done: char * readdpmelabel(struct buf *bp, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, - int *partoffp, int *cylp, int spoofonly) + struct disklabel *lp, int *partoffp, int spoofonly) { int i, part_cnt, n, hfspartoff = -1; struct part_map_entry *part; @@ -113,7 +112,6 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = 1; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = 1 / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) return ("DPME partition I/O error"); @@ -132,7 +130,6 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = 1+i; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = (1+i) / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) return ("DPME partition I/O error"); @@ -161,15 +158,12 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), if (partoffp) *partoffp = hfspartoff; - if (cylp) - *cylp = hfspartoff / lp->d_secpercyl; if (spoofonly) return (NULL); /* next, dig out disk label */ bp->b_blkno = hfspartoff + LABELSECTOR; - bp->b_cylinder = hfspartoff / lp->d_secpercyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -183,10 +177,9 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct disklabel *dlp; struct buf *bp = NULL; @@ -194,13 +187,12 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdpmelabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL && - readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdpmelabel(bp, strat, lp, &partoff, 1) != NULL && + readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/mvme68k/include/disklabel.h b/sys/arch/mvme68k/include/disklabel.h index d0223e818ae..2815e417369 100644 --- a/sys/arch/mvme68k/include/disklabel.h +++ b/sys/arch/mvme68k/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.10 2007/06/18 17:11:06 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.11 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1996 Nivas Madhur @@ -35,9 +35,6 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - /* * a mvmedisklabel is a disklabel that the bug (prom) can understand * and live with. the bug works in terms of 256 byte blocks. in our diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index a23f10c1840..6aa121b9e31 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.59 2007/06/18 04:31:16 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.60 2007/06/20 18:15:46 deraadt Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -47,7 +47,7 @@ void cputobsdlabel(struct disklabel *, struct mvmedisklabel *); char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; struct mvmedisklabel *mlp; @@ -66,7 +66,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; /* contained in block 0 */ bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -112,8 +111,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; int error; @@ -123,7 +121,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_dev = dev; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; /* contained in block 0 */ bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/mvme88k/include/disklabel.h b/sys/arch/mvme88k/include/disklabel.h index 4e898cae43c..38daff81ada 100644 --- a/sys/arch/mvme88k/include/disklabel.h +++ b/sys/arch/mvme88k/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.13 2007/06/18 17:11:06 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.14 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1996 Nivas Madhur @@ -35,9 +35,6 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - /* * Note: this structure is exactly 512 bytes in size. If you move fields * around, make sure the various members are properly aligned and the diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index 41b3d1df773..1e4d85b4040 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.55 2007/06/18 04:31:16 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.56 2007/06/20 18:15:46 deraadt Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -47,7 +47,7 @@ void cputobsdlabel(struct disklabel *, struct mvmedisklabel *); char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; struct mvmedisklabel *mlp; @@ -66,7 +66,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; /* contained in block 0 */ bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -112,8 +111,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; int error; @@ -124,7 +122,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/mvmeppc/include/disklabel.h b/sys/arch/mvmeppc/include/disklabel.h index 8639d243d34..d51cfeae38b 100644 --- a/sys/arch/mvmeppc/include/disklabel.h +++ b/sys/arch/mvmeppc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.11 2007/06/17 00:27:27 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.12 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c index dee5db1c376..d2a0f48bb11 100644 --- a/sys/arch/mvmeppc/mvmeppc/disksubr.c +++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.53 2007/06/18 07:09:25 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.54 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -57,7 +57,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -69,7 +69,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -98,8 +98,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { int error = EIO, partoff = -1, cyl = 0; struct disklabel *dlp; @@ -109,12 +108,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/sgi/include/disklabel.h b/sys/arch/sgi/include/disklabel.h index b2af00c8710..603263a2965 100644 --- a/sys/arch/sgi/include/disklabel.h +++ b/sys/arch/sgi/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.4 2007/06/18 21:50:26 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.5 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -97,8 +97,4 @@ struct sgilabel { #define SGI_PTYPE_XLV 12 #define SGI_PTYPE_XVM 13 - -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/sgi/sgi/disksubr.c b/sys/arch/sgi/sgi/disksubr.c index 5ab510fecf1..d84cf398974 100644 --- a/sys/arch/sgi/sgi/disksubr.c +++ b/sys/arch/sgi/sgi/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.1 2007/06/18 21:46:41 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.2 2007/06/20 18:15:46 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -43,7 +43,7 @@ char *readbsdlabel(struct buf *, void (*)(struct buf *), int, int, int, struct disklabel *, int); char *readsgilabel(struct buf *, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *, int); + struct disklabel *, int *, int); /* * Try to read a standard BSD disklabel at a certain sector. @@ -58,7 +58,6 @@ readbsdlabel(struct buf *bp, void (*strat)(struct buf *), return (NULL); bp->b_blkno = sec; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -82,7 +81,7 @@ readbsdlabel(struct buf *bp, void (*strat)(struct buf *), */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -94,11 +93,11 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - msg = readsgilabel(bp, strat, lp, osdep, 0, 0, spoofonly); + msg = readsgilabel(bp, strat, lp, 0, spoofonly); if (msg == NULL) goto done; - msg = readdoslabel(bp, strat, lp, osdep, 0, 0, spoofonly); + msg = readdoslabel(bp, strat, lp, 0, spoofonly); if (msg == NULL) goto done; @@ -137,8 +136,7 @@ static struct { char * readsgilabel(struct buf *bp, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, - int *partoffp, int *cylp, int spoofonly) + struct disklabel *lp, int *partoffp, int spoofonly) { struct sgilabel *dlp; char *msg = NULL; @@ -146,7 +144,6 @@ readsgilabel(struct buf *bp, void (*strat)(struct buf *), int fsoffs = 0; bp->b_blkno = 0; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -217,7 +214,6 @@ finished: goto done; bp->b_blkno = fsoffs + LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -240,10 +236,9 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { - int error = EIO, partoff = -1, cyl = 0; + int error = EIO, partoff = -1; struct buf *bp = NULL; struct disklabel *dlp; @@ -251,13 +246,12 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readsgilabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL && - readdoslabel(bp, strat, lp, osdep, &partoff, &cyl, 1) != NULL) + if (readsgilabel(bp, strat, lp, &partoff, 1) != NULL && + readdoslabel(bp, strat, lp, &partoff, 1) != NULL) goto done; /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/sh/include/disklabel.h b/sys/arch/sh/include/disklabel.h index 5c38c2bd8c5..f61077e0266 100644 --- a/sys/arch/sh/include/disklabel.h +++ b/sys/arch/sh/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.6 2007/06/17 00:27:28 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.7 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Mark Brinicombe. @@ -42,7 +42,4 @@ #define LABELOFFSET 0 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _ARM_DISKLABEL_H_ */ diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c index c36b5b439fc..a25708f3bfb 100644 --- a/sys/arch/sparc/dev/fd.c +++ b/sys/arch/sparc/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.53 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: fd.c,v 1.54 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */ /*- @@ -1786,14 +1786,12 @@ fdioctl(dev, cmd, addr, flag, p) return (EBADF); error = setdisklabel(fd->sc_dk.dk_label, - (struct disklabel *)addr, 0, - fd->sc_dk.dk_cpulabel); + (struct disklabel *)addr, 0); if (error) return (error); error = writedisklabel(DISKLABELDEV(dev), fdstrategy, - fd->sc_dk.dk_label, - fd->sc_dk.dk_cpulabel); + fd->sc_dk.dk_label); return (error); case DIOCLOCK: @@ -1952,11 +1950,9 @@ fdgetdisklabel(dev) int unit = FDUNIT(dev); struct fd_softc *fd = fd_cd.cd_devs[unit]; struct disklabel *lp = fd->sc_dk.dk_label; - struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; char *errstring; bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); lp->d_type = DTYPE_FLOPPY; lp->d_secsize = FD_BSIZE(fd); @@ -1979,7 +1975,7 @@ fdgetdisklabel(dev) /* * Call the generic disklabel extraction routine. */ - errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, clp, 0); + errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, 0); if (errstring) { /*printf("%s: %s\n", fd->sc_dv.dv_xname, errstring);*/ } diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c index 65eb065472e..2311511d627 100644 --- a/sys/arch/sparc/dev/presto.c +++ b/sys/arch/sparc/dev/presto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: presto.c,v 1.12 2007/06/15 02:28:49 todd Exp $ */ +/* $OpenBSD: presto.c,v 1.13 2007/06/20 18:15:47 deraadt Exp $ */ /* * Copyright (c) 2003, Miodrag Vallat. * All rights reserved. @@ -294,8 +294,7 @@ prestostrategy(struct buf *bp) /* Do not write on "no trespassing" areas... */ part = DISKPART(bp->b_dev); if (part != RAW_PART && - bounds_check_with_label(bp, sc->sc_dk.dk_label, - sc->sc_dk.dk_cpulabel, 1) <= 0) + bounds_check_with_label(bp, sc->sc_dk.dk_label, 1) <= 0) goto bad; /* Bound the request size, then move data between buf and nvram */ @@ -341,8 +340,7 @@ prestoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *proc) return (EBADF); error = setdisklabel(sc->sc_dk.dk_label, - (struct disklabel *)data, /*sd->sc_dk.dk_openmask : */0, - sc->sc_dk.dk_cpulabel); + (struct disklabel *)data, /*sd->sc_dk.dk_openmask : */0); return (error); case DIOCWDINFO: @@ -350,12 +348,10 @@ prestoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *proc) return (EBADF); error = setdisklabel(sc->sc_dk.dk_label, - (struct disklabel *)data, /*sd->sc_dk.dk_openmask : */0, - sc->sc_dk.dk_cpulabel); + (struct disklabel *)data, /*sd->sc_dk.dk_openmask : */0); if (error == 0) { error = writedisklabel(DISKLABELDEV(dev), - prestostrategy, sc->sc_dk.dk_label, - sc->sc_dk.dk_cpulabel); + prestostrategy, sc->sc_dk.dk_label); } return (error); @@ -372,7 +368,6 @@ presto_getdisklabel(dev_t dev, struct presto_softc *sc) { struct disklabel *lp = sc->sc_dk.dk_label; - bzero(sc->sc_dk.dk_cpulabel, sizeof(struct cpu_disklabel)); bzero(sc->sc_dk.dk_label, sizeof(struct disklabel)); lp->d_secsize = DEV_BSIZE; @@ -393,6 +388,5 @@ presto_getdisklabel(dev_t dev, struct presto_softc *sc) lp->d_magic2 = DISKMAGIC; lp->d_checksum = dkcksum(lp); - readdisklabel(DISKLABELDEV(dev), prestostrategy, sc->sc_dk.dk_label, - sc->sc_dk.dk_cpulabel, 0); + readdisklabel(DISKLABELDEV(dev), prestostrategy, sc->sc_dk.dk_label, 0); } diff --git a/sys/arch/sparc/include/disklabel.h b/sys/arch/sparc/include/disklabel.h index d7021e04b65..9811c473579 100644 --- a/sys/arch/sparc/include/disklabel.h +++ b/sys/arch/sparc/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 2007/06/17 00:27:28 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,8 +37,4 @@ #define LABELOFFSET 64 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { - char cd_block[512]; -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index d458a9c1c76..f94ea05b9c5 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.67 2007/06/18 05:30:54 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.68 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -68,7 +68,7 @@ extern void cdstrategy(struct buf *); */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct sun_disklabel *slp; struct buf *bp = NULL; @@ -104,7 +104,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto doslabel; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -113,8 +112,10 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; } +#if NOTANYMORE /* XXX because xd(4) & xy(4) still need it */ bcopy(bp->b_data, osdep->cd_block, sizeof(osdep->cd_block)); +#endif slp = (struct sun_disklabel *)bp->b_data; if (slp->sl_magic == SUN_DKMAGIC) { @@ -127,7 +128,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; doslabel: - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -157,8 +158,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; int error; @@ -173,7 +173,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), /* Write out the updated label. */ bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c index 0e91fb14347..c8a3d71faa9 100644 --- a/sys/arch/sparc64/dev/fd.c +++ b/sys/arch/sparc64/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.17 2007/06/14 19:39:35 deraadt Exp $ */ +/* $OpenBSD: fd.c,v 1.18 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */ /*- @@ -1855,14 +1855,12 @@ fdioctl(dev, cmd, addr, flag, p) return (EBADF); error = setdisklabel(fd->sc_dk.dk_label, - (struct disklabel *)addr, 0, - fd->sc_dk.dk_cpulabel); + (struct disklabel *)addr, 0); if (error) return (error); error = writedisklabel(DISKLABELDEV(dev), fdstrategy, - fd->sc_dk.dk_label, - fd->sc_dk.dk_cpulabel); + fd->sc_dk.dk_label); return (error); case DIOCLOCK: @@ -2006,11 +2004,9 @@ fdgetdisklabel(dev) int unit = FDUNIT(dev); struct fd_softc *fd = fd_cd.cd_devs[unit]; struct disklabel *lp = fd->sc_dk.dk_label; - struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel; char *errstring; bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); lp->d_type = DTYPE_FLOPPY; lp->d_secsize = FD_BSIZE(fd); @@ -2034,7 +2030,7 @@ fdgetdisklabel(dev) * Call the generic disklabel extraction routine. If there's * not a label there, fake it. */ - errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, clp, 0); + errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, 0); if (errstring) { /*printf("%s: %s\n", fd->sc_dv.dv_xname, errstring);*/ } diff --git a/sys/arch/sparc64/include/disklabel.h b/sys/arch/sparc64/include/disklabel.h index 90be19c3a23..a5b1f4c6b6a 100644 --- a/sys/arch/sparc64/include/disklabel.h +++ b/sys/arch/sparc64/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.3 2007/06/17 00:27:28 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.4 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,7 +37,4 @@ #define LABELOFFSET 128 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -struct cpu_disklabel { -}; - #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 20112d9edc8..fbae3ef8a45 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.45 2007/06/18 05:28:54 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.46 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -61,7 +61,7 @@ extern void cdstrategy(struct buf *); */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct sun_disklabel *slp; struct buf *bp = NULL; @@ -97,7 +97,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto doslabel; bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -117,7 +116,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), goto done; doslabel: - msg = readdoslabel(bp, strat, lp, osdep, NULL, NULL, spoofonly); + msg = readdoslabel(bp, strat, lp, NULL, spoofonly); if (msg == NULL) goto done; @@ -147,8 +146,7 @@ done: * Write disk label back to device after modification. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; int error; @@ -163,7 +161,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), /* Write out the updated label. */ bp->b_blkno = LABELSECTOR; - bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); diff --git a/sys/arch/vax/include/disklabel.h b/sys/arch/vax/include/disklabel.h index cae29811e77..7bc0c1d5fff 100644 --- a/sys/arch/vax/include/disklabel.h +++ b/sys/arch/vax/include/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.8 2007/06/17 00:27:28 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.9 2007/06/20 18:15:45 deraadt Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -37,9 +37,4 @@ #define LABELOFFSET 64 /* offset of label in sector */ #define MAXPARTITIONS 16 /* number of partitions */ -#ifndef _LOCORE -struct cpu_disklabel { -}; - -#endif #endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index a68d996fce6..5f6fe99ea55 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.23 2007/06/08 05:35:31 deraadt Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.24 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -163,7 +163,7 @@ ra_putonline(ra) ra->ra_state = DK_RDLABEL; printf("%s", ra->ra_dev.dv_xname); if ((msg = readdisklabel(MAKEDISKDEV(RAMAJOR, ra->ra_dev.dv_unit, - RAW_PART), rastrategy, dl, NULL, 0)) != NULL) { + RAW_PART), rastrategy, dl, 0)) != NULL) { /*printf(": %s", msg);*/ } else { ra->ra_havelabel = 1; @@ -320,7 +320,7 @@ rastrategy(bp) * within the boundaries of the partition. */ if (bounds_check_with_label(bp, ra->ra_disk.dk_label, - ra->ra_disk.dk_cpulabel, ra->ra_wlabel) <= 0) + ra->ra_wlabel) <= 0) goto done; /* Make some statistics... /bqt */ @@ -391,10 +391,10 @@ raioctl(dev, cmd, data, flag, p) if ((flag & FWRITE) == 0) error = EBADF; else { - error = setdisklabel(lp, tp, 0, 0); + error = setdisklabel(lp, tp, 0); if (error == 0 && cmd == DIOCWDINFO) { ra->ra_wlabel = 1; - error = writedisklabel(dev, rastrategy, lp,0); + error = writedisklabel(dev, rastrategy, lp); ra->ra_wlabel = 0; } } diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index b7a5e1af284..61d61929b12 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.52 2007/06/17 00:27:29 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.53 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -58,7 +58,7 @@ */ char * readdisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, int spoofonly) + struct disklabel *lp, int spoofonly) { struct buf *bp = NULL; char *msg; @@ -75,7 +75,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = LABELSECTOR / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) { msg = "I/O error"; @@ -112,8 +111,7 @@ done: * Always allow writing of disk label; even if the disk is unlabeled. */ int -writedisklabel(dev_t dev, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep) +writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) { struct buf *bp = NULL; struct disklabel *dlp; @@ -124,7 +122,6 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = LABELSECTOR; - bp->b_cylinder = bp->b_blkno / lp->d_secpercyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c index 1ac725d3994..5c4cdbb30b6 100644 --- a/sys/arch/vax/vsa/hdc9224.c +++ b/sys/arch/vax/vsa/hdc9224.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hdc9224.c,v 1.19 2007/06/09 01:02:28 deraadt Exp $ */ +/* $OpenBSD: hdc9224.c,v 1.20 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: hdc9224.c,v 1.16 2001/07/26 15:05:09 wiz Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -364,7 +364,7 @@ hdattach(struct device *parent, struct device *self, void *aux) dl = hd->sc_disk.dk_label; hdmakelabel(dl, &hd->sc_xbn); msg = readdisklabel(MAKEDISKDEV(HDMAJOR, hd->sc_dev.dv_unit, RAW_PART), - hdstrategy, dl, NULL, 0); + hdstrategy, dl, 0); printf("%s: %luMB, %lu sectors\n", hd->sc_dev.dv_xname, DL_GETDSIZE(dl) / (1048576 / DEV_BSIZE), DL_GETDSIZE(dl)); @@ -449,8 +449,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, - hd->sc_disk.dk_cpulabel, 1)) <= 0) + if ((bounds_check_with_label(bp, hd->sc_disk.dk_label, 1)) <= 0) goto done; if (bp->b_bcount == 0) @@ -729,8 +728,8 @@ hdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) return EBADF; else err = (cmd == DIOCSDINFO ? - setdisklabel(lp, (struct disklabel *)addr, 0, 0) : - writedisklabel(dev, hdstrategy, lp, 0)); + setdisklabel(lp, (struct disklabel *)addr, 0) : + writedisklabel(dev, hdstrategy, lp)); break; case DIOCWLABEL: diff --git a/sys/arch/zaurus/dev/zaurus_flash.c b/sys/arch/zaurus/dev/zaurus_flash.c index c373a891c03..5f2af195799 100644 --- a/sys/arch/zaurus/dev/zaurus_flash.c +++ b/sys/arch/zaurus/dev/zaurus_flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_flash.c,v 1.3 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: zaurus_flash.c,v 1.4 2007/06/20 18:15:46 deraadt Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> @@ -115,8 +115,7 @@ u_int8_t zflash_reg8_read(void *, int); int zflash_regx_read_page(void *, caddr_t, caddr_t); void zflash_reg8_write(void *, int, u_int8_t); int zflash_regx_write_page(void *, caddr_t, caddr_t); -void zflash_default_disklabel(void *, dev_t, struct disklabel *, - struct cpu_disklabel *); +void zflash_default_disklabel(void *, dev_t, struct disklabel *); int zflash_safe_strategy(void *, struct buf *); int zflash_safe_start(struct zflash_softc *, dev_t); @@ -343,8 +342,7 @@ zflash_regx_write_page(void *arg, caddr_t data, caddr_t oob) * device is passed to us. We add the partitions besides RAW_PART. */ void -zflash_default_disklabel(void *arg, dev_t dev, struct disklabel *lp, - struct cpu_disklabel *clp) +zflash_default_disklabel(void *arg, dev_t dev, struct disklabel *lp) { struct zflash_softc *sc = arg; long bsize = sc->sc_flash.sc_flashdev->pagesize; diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 4448744a1fb..45fb5a85aad 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.65 2007/06/18 20:55:52 deraadt Exp $ */ +/* $OpenBSD: wd.c,v 1.66 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -176,9 +176,7 @@ struct cfdriver wd_cd = { }; void wdgetdefaultlabel(struct wd_softc *, struct disklabel *); -void wdgetdisklabel(dev_t dev, struct wd_softc *, - struct disklabel *, - struct cpu_disklabel *, int); +void wdgetdisklabel(dev_t dev, struct wd_softc *, struct disklabel *, int); void wdstrategy(struct buf *); void wdstart(void *); void __wdstart(struct wd_softc*, struct buf *); @@ -452,7 +450,7 @@ wdstrategy(struct buf *bp) * If end of partition, just return. */ if (DISKPART(bp->b_dev) != RAW_PART && - bounds_check_with_label(bp, wd->sc_dk.dk_label, wd->sc_dk.dk_cpulabel, + bounds_check_with_label(bp, wd->sc_dk.dk_label, (wd->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0) goto done; /* Queue transfer on drive, activate drive and controller if idle. */ @@ -685,8 +683,7 @@ wdopen(dev_t dev, int flag, int fmt, struct proc *p) wd_get_params(wd, AT_WAIT, &wd->sc_params); /* Load the partition info if not already loaded. */ - wdgetdisklabel(dev, wd, wd->sc_dk.dk_label, - wd->sc_dk.dk_cpulabel, 0); + wdgetdisklabel(dev, wd, wd->sc_dk.dk_label, 0); } } @@ -801,19 +798,17 @@ wdgetdefaultlabel(struct wd_softc *wd, struct disklabel *lp) */ void wdgetdisklabel(dev_t dev, struct wd_softc *wd, struct disklabel *lp, - struct cpu_disklabel *clp, int spoofonly) + int spoofonly) { char *errstring; WDCDEBUG_PRINT(("wdgetdisklabel\n"), DEBUG_FUNCS); - bzero(clp, sizeof(struct cpu_disklabel)); - wdgetdefaultlabel(wd, lp); if (wd->drvp->state > RECAL) wd->drvp->drive_flags |= DRIVE_RESET; - errstring = readdisklabel(DISKLABELDEV(dev), wdstrategy, lp, clp, + errstring = readdisklabel(DISKLABELDEV(dev), wdstrategy, lp, spoofonly); if (wd->drvp->state > RECAL) wd->drvp->drive_flags |= DRIVE_RESET; @@ -843,18 +838,14 @@ wdioctl(dev_t dev, u_long xfer, caddr_t addr, int flag, struct proc *p) switch (xfer) { case DIOCRLDINFO: lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK); - wdgetdisklabel(dev, wd, lp, wd->sc_dk.dk_cpulabel, 0); + wdgetdisklabel(dev, wd, lp, 0); bcopy(lp, wd->sc_dk.dk_label, sizeof(*lp)); free(lp, M_TEMP); goto exit; - case DIOCGPDINFO: { - struct cpu_disklabel osdep; - - wdgetdisklabel(dev, wd, (struct disklabel *)addr, - &osdep, 1); - goto exit; - } + case DIOCGPDINFO: + wdgetdisklabel(dev, wd, (struct disklabel *)addr, 1); + goto exit; case DIOCGDINFO: *(struct disklabel *)addr = *(wd->sc_dk.dk_label); @@ -878,15 +869,13 @@ wdioctl(dev_t dev, u_long xfer, caddr_t addr, int flag, struct proc *p) wd->sc_flags |= WDF_LABELLING; error = setdisklabel(wd->sc_dk.dk_label, - (struct disklabel *)addr, /*wd->sc_dk.dk_openmask : */0, - wd->sc_dk.dk_cpulabel); + (struct disklabel *)addr, /*wd->sc_dk.dk_openmask : */0); if (error == 0) { if (wd->drvp->state > RECAL) wd->drvp->drive_flags |= DRIVE_RESET; if (xfer == DIOCWDINFO) error = writedisklabel(DISKLABELDEV(dev), - wdstrategy, wd->sc_dk.dk_label, - wd->sc_dk.dk_cpulabel); + wdstrategy, wd->sc_dk.dk_label); } wd->sc_flags &= ~WDF_LABELLING; diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index e0474a69293..89c0f9d1b20 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccd.c,v 1.77 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: ccd.c,v 1.78 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */ /*- @@ -182,8 +182,7 @@ int ccdinit(struct ccddevice *, char **, struct proc *); int ccdlookup(char *, struct proc *p, struct vnode **); long ccdbuffer(struct ccd_softc *, struct buf *, daddr64_t, caddr_t, long, struct ccdbuf **); -void ccdgetdisklabel(dev_t, struct ccd_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void ccdgetdisklabel(dev_t, struct ccd_softc *, struct disklabel *, int); INLINE struct ccdbuf *getccdbuf(void); INLINE void putccdbuf(struct ccdbuf *); @@ -589,7 +588,7 @@ ccdopen(dev_t dev, int flags, int fmt, struct proc *p) * the in-core disklabel. */ if ((cs->sc_flags & CCDF_INITED) && (cs->sc_dkdev.dk_openmask == 0)) - ccdgetdisklabel(dev, cs, lp, cs->sc_dkdev.dk_cpulabel, 0); + ccdgetdisklabel(dev, cs, lp, 0); /* Check that the partition exists. */ if (part != RAW_PART) { @@ -685,8 +684,7 @@ ccdstrategy(struct buf *bp) */ wlabel = cs->sc_flags & (CCDF_WLABEL|CCDF_LABELLING); if (DISKPART(bp->b_dev) != RAW_PART && - bounds_check_with_label(bp, lp, cs->sc_dkdev.dk_cpulabel, - wlabel) <= 0) + bounds_check_with_label(bp, lp, wlabel) <= 0) goto done; bp->b_resid = bp->b_bcount; @@ -1135,8 +1133,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) disk_attach(&cs->sc_dkdev); /* Try and read the disklabel. */ - ccdgetdisklabel(dev, cs, cs->sc_dkdev.dk_label, - cs->sc_dkdev.dk_cpulabel, 0); + ccdgetdisklabel(dev, cs, cs->sc_dkdev.dk_label, 0); ccdunlock(cs); break; @@ -1206,18 +1203,14 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) splx(s); break; - case DIOCGPDINFO: { - struct cpu_disklabel osdep; - + case DIOCGPDINFO: if ((error = ccdlock(cs)) != 0) return (error); - ccdgetdisklabel(dev, cs, (struct disklabel *)data, - &osdep, 1); + ccdgetdisklabel(dev, cs, (struct disklabel *)data, 1); ccdunlock(cs); break; - } case DIOCGDINFO: *(struct disklabel *)data = *(cs->sc_dkdev.dk_label); @@ -1237,12 +1230,11 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) cs->sc_flags |= CCDF_LABELLING; error = setdisklabel(cs->sc_dkdev.dk_label, - (struct disklabel *)data, 0, cs->sc_dkdev.dk_cpulabel); + (struct disklabel *)data, 0); if (error == 0) { if (cmd == DIOCWDINFO) error = writedisklabel(DISKLABELDEV(dev), - ccdstrategy, cs->sc_dkdev.dk_label, - cs->sc_dkdev.dk_cpulabel); + ccdstrategy, cs->sc_dkdev.dk_label); } cs->sc_flags &= ~CCDF_LABELLING; @@ -1362,13 +1354,12 @@ ccdlookup(char *path, struct proc *p, struct vnode **vpp) */ void ccdgetdisklabel(dev_t dev, struct ccd_softc *cs, struct disklabel *lp, - struct cpu_disklabel *clp, int spoofonly) + int spoofonly) { struct ccdgeom *ccg = &cs->sc_geom; char *errstring; bzero(lp, sizeof(*lp)); - bzero(clp, sizeof(*clp)); DL_SETDSIZE(lp, cs->sc_size); lp->d_secsize = ccg->ccg_secsize; @@ -1393,7 +1384,7 @@ ccdgetdisklabel(dev_t dev, struct ccd_softc *cs, struct disklabel *lp, * Call the generic disklabel extraction routine. */ errstring = readdisklabel(DISKLABELDEV(dev), ccdstrategy, - cs->sc_dkdev.dk_label, cs->sc_dkdev.dk_cpulabel, spoofonly); + cs->sc_dkdev.dk_label, spoofonly); /* It's actually extremely common to have unlabeled ccds. */ if (errstring != NULL) CCD_DPRINTF(CCDB_LABEL, ("%s: %s\n", cs->sc_xname, errstring)); diff --git a/sys/dev/flash.c b/sys/dev/flash.c index 9824c2a03fd..abce68b529f 100644 --- a/sys/dev/flash.c +++ b/sys/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.7 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: flash.c,v 1.8 2007/06/20 18:15:46 deraadt Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> @@ -67,8 +67,7 @@ void flashdone(void *); int flashsafestrategy(struct flash_softc *, struct buf *); void flashgetdefaultlabel(dev_t, struct flash_softc *, struct disklabel *); -void flashgetdisklabel(dev_t, struct flash_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void flashgetdisklabel(dev_t, struct flash_softc *, struct disklabel *, int); /* * Driver attachment glue @@ -700,8 +699,7 @@ flashopen(dev_t dev, int oflags, int devtype, struct proc *p) sc->sc_flags |= FDK_LOADED; if (flashsafe(dev)) sc->sc_flags |= FDK_SAFE; - flashgetdisklabel(dev, sc, sc->sc_dk.dk_label, - sc->sc_dk.dk_cpulabel, 0); + flashgetdisklabel(dev, sc, sc->sc_dk.dk_label, 0); } } else if (((sc->sc_flags & FDK_SAFE) == 0) != (flashsafe(dev) == 0)) { @@ -812,8 +810,7 @@ flashstrategy(struct buf *bp) /* Do bounds checking on partitions. */ if (flashpart(bp->b_dev) != RAW_PART && - bounds_check_with_label(bp, sc->sc_dk.dk_label, - sc->sc_dk.dk_cpulabel, 0) <= 0) + bounds_check_with_label(bp, sc->sc_dk.dk_label, 0) <= 0) goto done; /* Queue the transfer. */ @@ -1006,21 +1003,19 @@ flashgetdefaultlabel(dev_t dev, struct flash_softc *sc, void flashgetdisklabel(dev_t dev, struct flash_softc *sc, - struct disklabel *lp, struct cpu_disklabel *clp, int spoofonly) + struct disklabel *lp, int spoofonly) { char *errstring; dev_t labeldev; flashgetdefaultlabel(dev, sc, lp); - bzero(clp, sizeof(struct cpu_disklabel)); if (sc->sc_tag->default_disklabel != NULL) - sc->sc_tag->default_disklabel(sc->sc_cookie, dev, lp, clp); + sc->sc_tag->default_disklabel(sc->sc_cookie, dev, lp); /* Call the generic disklabel extraction routine. */ labeldev = flashlabeldev(dev); - errstring = readdisklabel(labeldev, flashstrategy, lp, clp, - spoofonly); + errstring = readdisklabel(labeldev, flashstrategy, lp, spoofonly); if (errstring != NULL) { /*printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);*/ } diff --git a/sys/dev/flashvar.h b/sys/dev/flashvar.h index dccf80d566d..940b3bce320 100644 --- a/sys/dev/flashvar.h +++ b/sys/dev/flashvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: flashvar.h,v 1.1 2006/11/25 14:32:00 uwe Exp $ */ +/* $OpenBSD: flashvar.h,v 1.2 2007/06/20 18:15:46 deraadt Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> @@ -27,8 +27,7 @@ struct flash_ctl_tag { int (*regx_read_page)(void *, caddr_t, caddr_t); void (*reg8_write)(void *, int, u_int8_t); int (*regx_write_page)(void *, caddr_t, caddr_t); - void (*default_disklabel)(void *, dev_t, struct disklabel *, - struct cpu_disklabel *); + void (*default_disklabel)(void *, dev_t, struct disklabel *); int (*safe_strategy)(void *, struct buf *); }; diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 2e8853e6132..081819dbdca 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.66 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: fd.c,v 1.67 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -960,7 +960,6 @@ fdioctl(dev, cmd, addr, flag, p) { struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)]; struct disklabel dl, *lp = &dl; - struct cpu_disklabel cdl; char *errstring; int error; @@ -971,7 +970,6 @@ fdioctl(dev, cmd, addr, flag, p) return (0); case DIOCGDINFO: bzero(lp, sizeof(*lp)); - bzero(&cdl, sizeof(struct cpu_disklabel)); lp->d_secsize = FD_BSIZE(fd); lp->d_secpercyl = fd->sc_type->seccyl; @@ -991,8 +989,7 @@ fdioctl(dev, cmd, addr, flag, p) lp->d_magic2 = DISKMAGIC; lp->d_checksum = dkcksum(lp); - errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, - &cdl, 0); + errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, 0); if (errstring) { /*printf("%s: %s\n", fd->sc_dev.dv_xname, errstring);*/ } @@ -1010,11 +1007,11 @@ fdioctl(dev, cmd, addr, flag, p) if ((flag & FWRITE) == 0) return EBADF; - error = setdisklabel(lp, (struct disklabel *)addr, 0, NULL); + error = setdisklabel(lp, (struct disklabel *)addr, 0); if (error) return error; - error = writedisklabel(DISKLABELDEV(dev), fdstrategy, lp, NULL); + error = writedisklabel(DISKLABELDEV(dev), fdstrategy, lp); return error; case FD_FORM: diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index c9c31be7bf9..7e741776f77 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mcd.c,v 1.48 2007/06/18 20:55:52 deraadt Exp $ */ +/* $OpenBSD: mcd.c,v 1.49 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: mcd.c,v 1.60 1998/01/14 12:14:41 drochner Exp $ */ /* @@ -217,8 +217,7 @@ struct cfdriver mcd_cd = { NULL, "mcd", DV_DISK }; -void mcdgetdisklabel(dev_t, struct mcd_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void mcdgetdisklabel(dev_t, struct mcd_softc *, struct disklabel *, int); int mcd_get_parms(struct mcd_softc *); void mcdstrategy(struct buf *); void mcdstart(struct mcd_softc *); @@ -387,8 +386,7 @@ mcdopen(dev, flag, fmt, p) goto bad2; /* Fabricate a disk label. */ - mcdgetdisklabel(dev, sc, sc->sc_dk.dk_label, - sc->sc_dk.dk_cpulabel, 0); + mcdgetdisklabel(dev, sc, sc->sc_dk.dk_label, 0); } } @@ -511,7 +509,6 @@ mcdstrategy(bp) */ if (DISKPART(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; @@ -632,7 +629,7 @@ mcdioctl(dev, cmd, addr, flag, p) switch (cmd) { case DIOCRLDINFO: lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK); - mcdgetdisklabel(dev, sc, lp, sc->sc_dk.dk_cpulabel, 0); + mcdgetdisklabel(dev, sc, lp, 0); bcopy(lp, sc->sc_dk.dk_label, sizeof(*lp)); free(lp, M_TEMP); return 0; @@ -658,8 +655,7 @@ mcdioctl(dev, cmd, addr, flag, p) sc->flags |= MCDF_LABELLING; error = setdisklabel(sc->sc_dk.dk_label, - (struct disklabel *)addr, /*sc->sc_dk.dk_openmask : */0, - sc->sc_dk.dk_cpulabel); + (struct disklabel *)addr, /*sc->sc_dk.dk_openmask : */0); if (error == 0) { } @@ -733,17 +729,15 @@ mcdioctl(dev, cmd, addr, flag, p) } void -mcdgetdisklabel(dev, sc, lp, clp, spoofonly) +mcdgetdisklabel(dev, sc, lp, spoofonly) dev_t dev; struct mcd_softc *sc; struct disklabel *lp; - struct cpu_disklabel *clp; int spoofonly; { char *errstring; bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); lp->d_secsize = sc->blksize; lp->d_ntracks = 1; @@ -770,8 +764,7 @@ mcdgetdisklabel(dev, sc, lp, clp, spoofonly) /* * Call the generic disklabel extraction routine */ - errstring = readdisklabel(DISKLABELDEV(dev), mcdstrategy, lp, clp, - spoofonly); + errstring = readdisklabel(DISKLABELDEV(dev), mcdstrategy, lp, spoofonly); if (errstring) { /*printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);*/ return; diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c index c254ea812f2..0df3988cd00 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.40 2007/06/12 02:02:17 krw Exp $ */ +/* $OpenBSD: rf_openbsdkintf.c,v 1.41 2007/06/20 18:18:47 deraadt Exp $ */ /* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */ /*- @@ -270,7 +270,7 @@ struct raid_softc **raid_scPtrs; void rf_shutdown_hook(RF_ThreadArg_t); void raidgetdefaultlabel(RF_Raid_t *, struct raid_softc *, struct disklabel *); -void raidgetdisklabel(dev_t, struct disklabel *, struct cpu_disklabel *, int); +void raidgetdisklabel(dev_t, struct disklabel *, int); void raidmakedisklabel(struct raid_softc *); int raidlock(struct raid_softc *); @@ -641,8 +641,7 @@ raidopen(dev_t dev, int flags, int fmt, struct proc *p) if ((rs->sc_flags & RAIDF_INITED) && (rs->sc_dkdev.dk_openmask == 0)) - raidgetdisklabel(dev, rs->sc_dkdev.dk_label, - rs->sc_dkdev.dk_cpulabel, 0); + raidgetdisklabel(dev, rs->sc_dkdev.dk_label, 0); /* Make sure that this partition exists. */ @@ -791,8 +790,7 @@ raidstrategy(struct buf *bp) */ wlabel = rs->sc_flags & (RAIDF_WLABEL | RAIDF_LABELLING); if (DISKPART(bp->b_dev) != RAW_PART) - if (bounds_check_with_label(bp, lp, rs->sc_dkdev.dk_cpulabel, - wlabel) <= 0) { + if (bounds_check_with_label(bp, lp, wlabel) <= 0) { db1_printf(("Bounds check failed!!:%d %d\n", (int)bp->b_blkno, (int)wlabel)); biodone(bp); @@ -1576,13 +1574,11 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) rs->sc_flags |= RAIDF_LABELLING; - error = setdisklabel(rs->sc_dkdev.dk_label, - lp, 0, rs->sc_dkdev.dk_cpulabel); + error = setdisklabel(rs->sc_dkdev.dk_label, lp, 0); if (error == 0) { if (cmd == DIOCWDINFO) error = writedisklabel(DISKLABELDEV(dev), - raidstrategy, rs->sc_dkdev.dk_label, - rs->sc_dkdev.dk_cpulabel); + raidstrategy, rs->sc_dkdev.dk_label); } rs->sc_flags &= ~RAIDF_LABELLING; @@ -1601,11 +1597,9 @@ raidioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) rs->sc_flags &= ~RAIDF_WLABEL; break; - case DIOCGPDINFO: { - struct cpu_disklabel osdep; - raidgetdisklabel(dev, (struct disklabel *)data, &osdep, 1); + case DIOCGPDINFO: + raidgetdisklabel(dev, (struct disklabel *)data, 1); break; - } default: retcode = ENOTTY; @@ -2129,8 +2123,7 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs, * If one is not present, fake one up. */ void -raidgetdisklabel(dev_t dev, struct disklabel *lp, struct cpu_disklabel *clp, - int spoofonly) +raidgetdisklabel(dev_t dev, struct disklabel *lp, int spoofonly) { int unit = DISKUNIT(dev); struct raid_softc *rs = &raid_softc[unit]; @@ -2142,7 +2135,6 @@ raidgetdisklabel(dev_t dev, struct disklabel *lp, struct cpu_disklabel *clp, db1_printf(("Getting the disklabel...\n")); bzero(lp, sizeof(*lp)); - bzero(clp, sizeof(*clp)); raidPtr = raidPtrs[unit]; @@ -2152,7 +2144,7 @@ raidgetdisklabel(dev_t dev, struct disklabel *lp, struct cpu_disklabel *clp, * Call the generic disklabel extraction routine. */ errstring = readdisklabel(DISKLABELDEV(dev), raidstrategy, lp, - clp, spoofonly); + spoofonly); if (errstring) { /*printf("%s: %s\n", rs->sc_xname, errstring);*/ return; diff --git a/sys/dev/ramdisk.c b/sys/dev/ramdisk.c index 3dde36fee18..dc1bf70499c 100644 --- a/sys/dev/ramdisk.c +++ b/sys/dev/ramdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ramdisk.c,v 1.36 2007/06/18 20:55:52 deraadt Exp $ */ +/* $OpenBSD: ramdisk.c,v 1.37 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: ramdisk.c,v 1.8 1996/04/12 08:30:09 leo Exp $ */ /* @@ -99,8 +99,7 @@ struct rd_softc { void rdattach(int); void rd_attach(struct device *, struct device *, void *); -void rdgetdisklabel(dev_t, struct rd_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void rdgetdisklabel(dev_t, struct rd_softc *, struct disklabel *, int); /* * Some ports (like i386) use a swapgeneric that wants to @@ -236,8 +235,7 @@ rdsize(dev_t dev) if (sc->sc_type == RD_UNCONFIGURED) return 0; - rdgetdisklabel(dev, sc, sc->sc_dkdev.dk_label, sc->sc_dkdev.dk_cpulabel, - 0); + rdgetdisklabel(dev, sc, sc->sc_dkdev.dk_label, 0); part = DISKPART(dev); if (part >= sc->sc_dkdev.dk_label->d_npartitions) return 0; @@ -339,8 +337,7 @@ rdstrategy(bp) /* Do not write on "no trespassing" areas... */ part = DISKPART(bp->b_dev); if (part != RAW_PART && - bounds_check_with_label(bp, sc->sc_dkdev.dk_label, - sc->sc_dkdev.dk_cpulabel, 1) <= 0) + bounds_check_with_label(bp, sc->sc_dkdev.dk_label, 1) <= 0) goto bad; switch (sc->sc_type) { @@ -410,21 +407,16 @@ rdioctl(dev, cmd, data, flag, proc) if (sc->sc_type == RD_UNCONFIGURED) break; lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK); - rdgetdisklabel(dev, sc, lp, sc->sc_dkdev.dk_cpulabel, 0); + rdgetdisklabel(dev, sc, lp, 0); bcopy(lp, sc->sc_dkdev.dk_label, sizeof(*lp)); free(lp, M_TEMP); return 0; - case DIOCGPDINFO: { - struct cpu_disklabel osdep; - - if (sc->sc_type == RD_UNCONFIGURED) { - break; - } - rdgetdisklabel(dev, sc, (struct disklabel *)data, - &osdep, 1); - return 0; - } + case DIOCGPDINFO: + if (sc->sc_type == RD_UNCONFIGURED) + break; + rdgetdisklabel(dev, sc, (struct disklabel *)data, 1); + return 0; case DIOCGDINFO: if (sc->sc_type == RD_UNCONFIGURED) { @@ -448,13 +440,11 @@ rdioctl(dev, cmd, data, flag, proc) return EBADF; error = setdisklabel(sc->sc_dkdev.dk_label, - (struct disklabel *)data, /*sd->sc_dk.dk_openmask : */0, - sc->sc_dkdev.dk_cpulabel); + (struct disklabel *)data, /*sd->sc_dk.dk_openmask : */0); if (error == 0) { if (cmd == DIOCWDINFO) error = writedisklabel(DISKLABELDEV(dev), - rdstrategy, sc->sc_dkdev.dk_label, - sc->sc_dkdev.dk_cpulabel); + rdstrategy, sc->sc_dkdev.dk_label); } return error; @@ -501,10 +491,9 @@ rdioctl(dev, cmd, data, flag, proc) void rdgetdisklabel(dev_t dev, struct rd_softc *sc, struct disklabel *lp, - struct cpu_disklabel *clp, int spoofonly) + int spoofonly) { bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); lp->d_secsize = DEV_BSIZE; lp->d_ntracks = 1; @@ -531,7 +520,7 @@ rdgetdisklabel(dev_t dev, struct rd_softc *sc, struct disklabel *lp, /* * Call the generic disklabel extraction routine */ - readdisklabel(DISKLABELDEV(dev), rdstrategy, lp, clp, spoofonly); + readdisklabel(DISKLABELDEV(dev), rdstrategy, lp, spoofonly); } /* diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 92e452ef173..426c5739393 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.78 2007/06/08 05:27:58 deraadt Exp $ */ +/* $OpenBSD: vnd.c,v 1.79 2007/06/20 18:15:46 deraadt Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -298,7 +298,6 @@ vndgetdisklabel(dev_t dev, struct vnd_softc *sc) char *errstring = NULL; bzero(lp, sizeof(struct disklabel)); - bzero(sc->sc_dk.dk_cpulabel, sizeof(struct cpu_disklabel)); lp->d_secsize = 512; lp->d_ntracks = 1; @@ -320,8 +319,7 @@ vndgetdisklabel(dev_t dev, struct vnd_softc *sc) lp->d_checksum = dkcksum(lp); /* Call the generic disklabel extraction routine */ - errstring = readdisklabel(VNDLABELDEV(dev), vndstrategy, lp, - sc->sc_dk.dk_cpulabel, 0); + errstring = readdisklabel(VNDLABELDEV(dev), vndstrategy, lp, 0); if (errstring) { DNPRINTF(VDB_IO, "%s: %s\n", sc->sc_dev.dv_xname, errstring); @@ -417,8 +415,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, - vnd->sc_dk.dk_cpulabel, 1) <= 0) { + if (bounds_check_with_label(bp, vnd->sc_dk.dk_label, 1) <= 0) { s = splbio(); biodone(bp); splx(s); @@ -906,13 +903,11 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) vnd->sc_flags |= VNF_LABELLING; error = setdisklabel(vnd->sc_dk.dk_label, - (struct disklabel *)addr, /*vnd->sc_dk.dk_openmask : */0, - vnd->sc_dk.dk_cpulabel); + (struct disklabel *)addr, /*vnd->sc_dk.dk_openmask : */0); if (error == 0) { if (cmd == DIOCWDINFO) error = writedisklabel(VNDLABELDEV(dev), - vndstrategy, vnd->sc_dk.dk_label, - vnd->sc_dk.dk_cpulabel); + vndstrategy, vnd->sc_dk.dk_label); } vnd->sc_flags &= ~VNF_LABELLING; diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 40c548d4a76..b37fe065ff2 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.60 2007/06/17 00:27:30 deraadt Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.61 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -368,13 +368,12 @@ checkdisklabel(void *rlp, struct disklabel *lp) */ char * readdoslabel(struct buf *bp, void (*strat)(struct buf *), - struct disklabel *lp, struct cpu_disklabel *osdep, - int *partoffp, int *cylp, int spoofonly) + struct disklabel *lp, int *partoffp, int spoofonly) { struct dos_partition dp[NDOSPART], *dp2; u_int32_t extoff = 0; daddr64_t part_blkno = DOSBBSECTOR; - int dospartoff = 0, cyl, i, ourpart = -1; + int dospartoff = 0, i, ourpart = -1; int wander = 1, n = 0, loop = 0; if (lp->d_secpercyl == 0) @@ -383,7 +382,6 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), return ("invalid label, d_secsize == 0"); /* do DOS partitions in the process of getting disklabel? */ - cyl = DOS_LABELSECTOR / lp->d_secpercyl; /* * Read dos partition table, follow extended partitions. @@ -399,7 +397,6 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = part_blkno; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; - bp->b_cylinder = part_blkno / lp->d_secpercyl; (*strat)(bp); if (biowait(bp)) { /*wrong*/ if (partoffp) @@ -425,7 +422,6 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), */ dp2 = &dp[ourpart]; dospartoff = letoh32(dp2->dp_start) + part_blkno; - cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect); /* found our OpenBSD partition, finish up */ if (partoffp) @@ -531,15 +527,12 @@ notfat: /* record the OpenBSD partition's placement for the caller */ if (partoffp) *partoffp = dospartoff; - if (cylp) - *cylp = cyl; /* don't read the on-disk label if we are in spoofed-only mode */ if (spoofonly) return (NULL); bp->b_blkno = dospartoff + DOS_LABELSECTOR; - bp->b_cylinder = cyl; bp->b_bcount = lp->d_secsize; bp->b_flags = B_BUSY | B_READ; (*strat)(bp); @@ -555,8 +548,7 @@ notfat: * before setting it. */ int -setdisklabel(struct disklabel *olp, struct disklabel *nlp, - u_int openmask, struct cpu_disklabel *osdep) +setdisklabel(struct disklabel *olp, struct disklabel *nlp, u_int openmask) { int i; struct partition *opp, *npp; @@ -610,8 +602,7 @@ setdisklabel(struct disklabel *olp, struct disklabel *nlp, * early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, - struct cpu_disklabel *osdep, int wlabel) +bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) { #define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE)) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); @@ -737,13 +728,10 @@ disk_attach(struct disk *diskp) * called during autoconfiguration. */ diskp->dk_label = malloc(sizeof(struct disklabel), M_DEVBUF, M_NOWAIT); - diskp->dk_cpulabel = malloc(sizeof(struct cpu_disklabel), M_DEVBUF, - M_NOWAIT); - if ((diskp->dk_label == NULL) || (diskp->dk_cpulabel == NULL)) + if (diskp->dk_label == NULL) panic("disk_attach: can't allocate storage for disklabel"); bzero(diskp->dk_label, sizeof(struct disklabel)); - bzero(diskp->dk_cpulabel, sizeof(struct cpu_disklabel)); /* * Set the attached timestamp. @@ -769,7 +757,6 @@ disk_detach(struct disk *diskp) * Free the space used by the disklabel structures. */ free(diskp->dk_label, M_DEVBUF); - free(diskp->dk_cpulabel, M_DEVBUF); /* * Remove from the disklist. diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index a1fa2efc42e..0be05231d4e 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd.c,v 1.131 2007/06/18 20:55:52 deraadt Exp $ */ +/* $OpenBSD: cd.c,v 1.132 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */ /* @@ -97,8 +97,7 @@ int cddetach(struct device *, int); void cdstart(void *); void cdrestart(void *); void cdminphys(struct buf *); -void cdgetdisklabel(dev_t, struct cd_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void cdgetdisklabel(dev_t, struct cd_softc *, struct disklabel *, int); void cddone(struct scsi_xfer *); u_long cd_size(struct cd_softc *, int); void cd_kill_buffers(struct cd_softc *); @@ -355,8 +354,7 @@ cdopen(dev_t dev, int flag, int fmt, struct proc *p) SC_DEBUG(sc_link, SDEV_DB3, ("Params loaded\n")); /* Fabricate a disk label. */ - cdgetdisklabel(dev, cd, cd->sc_dk.dk_label, - cd->sc_dk.dk_cpulabel, 0); + cdgetdisklabel(dev, cd, cd->sc_dk.dk_label, 0); SC_DEBUG(sc_link, SDEV_DB3, ("Disklabel fabricated\n")); } @@ -490,7 +488,6 @@ cdstrategy(struct buf *bp) */ if (DISKPART(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; @@ -826,7 +823,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) switch (cmd) { case DIOCRLDINFO: lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK); - cdgetdisklabel(dev, cd, lp, cd->sc_dk.dk_cpulabel, 0); + cdgetdisklabel(dev, cd, lp, 0); bcopy(lp, cd->sc_dk.dk_label, sizeof(*lp)); free(lp, M_TEMP); break; @@ -854,8 +851,7 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) cd->flags |= CDF_LABELLING; error = setdisklabel(cd->sc_dk.dk_label, - (struct disklabel *)addr, /*cd->sc_dk.dk_openmask : */0, - cd->sc_dk.dk_cpulabel); + (struct disklabel *)addr, /*cd->sc_dk.dk_openmask : */0); if (error == 0) { } @@ -1153,14 +1149,13 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) */ void cdgetdisklabel(dev_t dev, struct cd_softc *cd, struct disklabel *lp, - struct cpu_disklabel *clp, int spoofonly) + int spoofonly) { struct cd_toc *toc; char *errstring; int tocidx, n, audioonly = 1; bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); MALLOC(toc, struct cd_toc *, sizeof(struct cd_toc), M_TEMP, M_WAITOK); bzero(toc, sizeof(*toc)); @@ -1210,7 +1205,7 @@ done: if (!audioonly) { errstring = readdisklabel(DISKLABELDEV(dev), cdstrategy, lp, - clp, spoofonly); + spoofonly); /*if (errstring) printf("%s: %s\n", cd->sc_dev.dv_xname, errstring);*/ } diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 6eb2fc404e3..f7ac4666ce4 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.134 2007/06/18 20:55:52 deraadt Exp $ */ +/* $OpenBSD: sd.c,v 1.135 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -88,8 +88,7 @@ int sdactivate(struct device *, enum devact); int sddetach(struct device *, int); void sdminphys(struct buf *); -void sdgetdisklabel(dev_t, struct sd_softc *, struct disklabel *, - struct cpu_disklabel *, int); +void sdgetdisklabel(dev_t, struct sd_softc *, struct disklabel *, int); void sdstart(void *); void sdrestart(void *); void sddone(struct scsi_xfer *); @@ -392,8 +391,7 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p) SC_DEBUG(sc_link, SDEV_DB3, ("Params loaded\n")); /* Load the partition info if not already loaded. */ - sdgetdisklabel(dev, sd, sd->sc_dk.dk_label, - sd->sc_dk.dk_cpulabel, 0); + sdgetdisklabel(dev, sd, sd->sc_dk.dk_label, 0); SC_DEBUG(sc_link, SDEV_DB3, ("Disklabel loaded\n")); } @@ -533,7 +531,6 @@ sdstrategy(struct buf *bp) */ if (DISKPART(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; @@ -862,17 +859,13 @@ sdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) switch (cmd) { case DIOCRLDINFO: lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK); - sdgetdisklabel(dev, sd, lp, sd->sc_dk.dk_cpulabel, 0); + sdgetdisklabel(dev, sd, lp, 0); bcopy(lp, sd->sc_dk.dk_label, sizeof(*lp)); free(lp, M_TEMP); goto exit; - case DIOCGPDINFO: { - struct cpu_disklabel osdep; - - sdgetdisklabel(dev, sd, (struct disklabel *)addr, - &osdep, 1); - goto exit; - } + case DIOCGPDINFO: + sdgetdisklabel(dev, sd, (struct disklabel *)addr, 1); + goto exit; case DIOCGDINFO: *(struct disklabel *)addr = *(sd->sc_dk.dk_label); @@ -896,13 +889,11 @@ sdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) sd->flags |= SDF_LABELLING; error = setdisklabel(sd->sc_dk.dk_label, - (struct disklabel *)addr, /*sd->sc_dk.dk_openmask : */0, - sd->sc_dk.dk_cpulabel); + (struct disklabel *)addr, /*sd->sc_dk.dk_openmask : */0); if (error == 0) { if (cmd == DIOCWDINFO) error = writedisklabel(DISKLABELDEV(dev), - sdstrategy, sd->sc_dk.dk_label, - sd->sc_dk.dk_cpulabel); + sdstrategy, sd->sc_dk.dk_label); } sd->flags &= ~SDF_LABELLING; @@ -985,14 +976,13 @@ sd_ioctl_inquiry(struct sd_softc *sd, struct dk_inquiry *di) */ void sdgetdisklabel(dev_t dev, struct sd_softc *sd, struct disklabel *lp, - struct cpu_disklabel *clp, int spoofonly) + int spoofonly) { size_t len; char *errstring, packname[sizeof(lp->d_packname) + 1]; char product[17], vendor[9]; bzero(lp, sizeof(struct disklabel)); - bzero(clp, sizeof(struct cpu_disklabel)); lp->d_secsize = sd->params.blksize; lp->d_ntracks = sd->params.heads; @@ -1049,8 +1039,7 @@ sdgetdisklabel(dev_t dev, struct sd_softc *sd, struct disklabel *lp, /* * Call the generic disklabel extraction routine */ - errstring = readdisklabel(DISKLABELDEV(dev), sdstrategy, lp, clp, - spoofonly); + errstring = readdisklabel(DISKLABELDEV(dev), sdstrategy, lp, spoofonly); if (errstring) { /*printf("%s: %s\n", sd->sc_dev.dv_xname, errstring);*/ } diff --git a/sys/sys/disk.h b/sys/sys/disk.h index a1418d70bdb..ccab35d1010 100644 --- a/sys/sys/disk.h +++ b/sys/sys/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.16 2007/06/01 18:26:29 deraadt Exp $ */ +/* $OpenBSD: disk.h,v 1.17 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: disk.h,v 1.11 1996/04/28 20:22:50 thorpej Exp $ */ /* @@ -54,7 +54,6 @@ struct buf; struct disklabel; -struct cpu_disklabel; #define DS_DISKNAMELEN 16 @@ -108,7 +107,6 @@ struct disk { */ daddr64_t dk_labelsector; /* sector containing label */ struct disklabel *dk_label; /* label */ - struct cpu_disklabel *dk_cpulabel; }; struct dkdriver { diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 26c3bbdf008..a450b88bc82 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.37 2007/06/17 00:27:29 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.38 2007/06/20 18:15:47 deraadt Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -453,16 +453,12 @@ void disksort(struct buf *, struct buf *); u_int dkcksum(struct disklabel *); char *initdisklabel(struct disklabel *); char *checkdisklabel(void *, struct disklabel *); -int setdisklabel(struct disklabel *, struct disklabel *, u_int, - struct cpu_disklabel *); -char *readdisklabel(dev_t, void (*)(struct buf *), struct disklabel *, - struct cpu_disklabel *, int); -int writedisklabel(dev_t, void (*)(struct buf *), struct disklabel *, - struct cpu_disklabel *); -int bounds_check_with_label(struct buf *, struct disklabel *, - struct cpu_disklabel *, int); +int setdisklabel(struct disklabel *, struct disklabel *, u_int); +char *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); char *readdoslabel(struct buf *, void (*)(struct buf *), - struct disklabel *, struct cpu_disklabel *, int *, int *, int); + struct disklabel *, int *, int); #ifdef CD9660 int iso_disklabelspoof(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp); |