summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/conf/files.i3863
-rw-r--r--sys/dev/fdc/fdc.c9
-rw-r--r--sys/i386/conf/files.i3863
-rw-r--r--sys/i386/isa/fd.c9
-rw-r--r--sys/isa/fd.c9
-rw-r--r--sys/kern/subr_disklabel.c303
-rw-r--r--sys/kern/subr_diskslice.c6
-rw-r--r--sys/sys/disklabel.h49
-rw-r--r--sys/sys/diskmbr.h49
-rw-r--r--sys/sys/diskpc98.h49
-rw-r--r--sys/ufs/ufs/ufs_disksubr.c303
11 files changed, 58 insertions, 734 deletions
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index 0896633..1b669cc 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $Id: files.i386,v 1.107 1995/09/07 08:17:19 swallace Exp $
+# $Id: files.i386,v 1.108 1995/09/08 03:20:10 julian Exp $
#
aic7xxx_asm optional ahc device-driver \
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
@@ -111,7 +111,6 @@ i386/isa/pcvt/pcvt_sup.c optional vt device-driver
i386/isa/pcvt/pcvt_vtf.c optional vt device-driver
i386/isa/psm.c optional psm device-driver
i386/isa/rc.c optional rc device-driver
-i386/isa/readMBR.c standard
i386/isa/scd.c optional scd device-driver
i386/isa/seagate.c optional sea device-driver
i386/isa/si.c optional si device-driver
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 17bef91..d0748b1 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.62 1995/06/11 19:31:19 rgrimes Exp $
+ * $Id: fd.c,v 1.63 1995/09/03 05:43:28 julian Exp $
*
*/
@@ -1834,7 +1834,8 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
- if (readdisklabel(dev, fdstrategy, dl, NULL, 0) == NULL)
+ if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
+ == NULL)
error = 0;
else
error = EINVAL;
@@ -1861,8 +1862,8 @@ fdioctl(dev, cmd, addr, flag, p)
dl = (struct disklabel *)addr;
- if ((error =
- setdisklabel ((struct disklabel *)buffer, dl, 0)))
+ if ((error = setdisklabel((struct disklabel *)buffer, dl,
+ (u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
diff --git a/sys/i386/conf/files.i386 b/sys/i386/conf/files.i386
index 0896633..1b669cc 100644
--- a/sys/i386/conf/files.i386
+++ b/sys/i386/conf/files.i386
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $Id: files.i386,v 1.107 1995/09/07 08:17:19 swallace Exp $
+# $Id: files.i386,v 1.108 1995/09/08 03:20:10 julian Exp $
#
aic7xxx_asm optional ahc device-driver \
dependency "$S/dev/aic7xxx/aic7xxx_asm.c" \
@@ -111,7 +111,6 @@ i386/isa/pcvt/pcvt_sup.c optional vt device-driver
i386/isa/pcvt/pcvt_vtf.c optional vt device-driver
i386/isa/psm.c optional psm device-driver
i386/isa/rc.c optional rc device-driver
-i386/isa/readMBR.c standard
i386/isa/scd.c optional scd device-driver
i386/isa/seagate.c optional sea device-driver
i386/isa/si.c optional si device-driver
diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c
index 17bef91..d0748b1 100644
--- a/sys/i386/isa/fd.c
+++ b/sys/i386/isa/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.62 1995/06/11 19:31:19 rgrimes Exp $
+ * $Id: fd.c,v 1.63 1995/09/03 05:43:28 julian Exp $
*
*/
@@ -1834,7 +1834,8 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
- if (readdisklabel(dev, fdstrategy, dl, NULL, 0) == NULL)
+ if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
+ == NULL)
error = 0;
else
error = EINVAL;
@@ -1861,8 +1862,8 @@ fdioctl(dev, cmd, addr, flag, p)
dl = (struct disklabel *)addr;
- if ((error =
- setdisklabel ((struct disklabel *)buffer, dl, 0)))
+ if ((error = setdisklabel((struct disklabel *)buffer, dl,
+ (u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 17bef91..d0748b1 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.62 1995/06/11 19:31:19 rgrimes Exp $
+ * $Id: fd.c,v 1.63 1995/09/03 05:43:28 julian Exp $
*
*/
@@ -1834,7 +1834,8 @@ fdioctl(dev, cmd, addr, flag, p)
dl->d_secpercyl = fdt->size / fdt->tracks;
dl->d_type = DTYPE_FLOPPY;
- if (readdisklabel(dev, fdstrategy, dl, NULL, 0) == NULL)
+ if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl)
+ == NULL)
error = 0;
else
error = EINVAL;
@@ -1861,8 +1862,8 @@ fdioctl(dev, cmd, addr, flag, p)
dl = (struct disklabel *)addr;
- if ((error =
- setdisklabel ((struct disklabel *)buffer, dl, 0)))
+ if ((error = setdisklabel((struct disklabel *)buffer, dl,
+ (u_long)0)) != 0)
break;
error = writedisklabel(dev, fdstrategy,
diff --git a/sys/kern/subr_disklabel.c b/sys/kern/subr_disklabel.c
index 442a0ad..be8e81a 100644
--- a/sys/kern/subr_disklabel.c
+++ b/sys/kern/subr_disklabel.c
@@ -1,9 +1,3 @@
-#define PRE_DISKSLICE_COMPAT
-#ifndef PRE_DISKSLICE_COMPAT
-#define correct_readdisklabel readdisklabel
-#define correct_writedisklabel writedisklabel
-#endif
-
/*
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
- * $Id: ufs_disksubr.c,v 1.17 1995/08/07 14:20:27 davidg Exp $
+ * $Id: ufs_disksubr.c,v 1.18 1995/08/28 16:09:11 bde Exp $
*/
#include <sys/param.h>
@@ -50,7 +44,6 @@
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
-#include <sys/dkbad.h>
#include <sys/syslog.h>
/*
@@ -149,13 +142,13 @@ insert:
/*
* Attempt to read a disk label from a device using the indicated strategy
- * routine. The label must be partly set up before this: secpercyl and
- * anything required in the strategy routine (e.g., sector size) must be
- * filled in before calling us. Returns NULL on success and an error
- * string on failure.
+ * routine. The label must be partly set up before this: secpercyl, secsize
+ * and anything required in the strategy routine (e.g., dummy bounds for the
+ * partition containing the label) must be * filled in before calling us.
+ * Returns NULL on success and an error string on failure.
*/
char *
-correct_readdisklabel(dev, strat, lp)
+readdisklabel(dev, strat, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
@@ -164,22 +157,6 @@ correct_readdisklabel(dev, strat, lp)
struct disklabel *dlp;
char *msg = NULL;
-#if 0
- /*
- * This clobbers valid labels built by drivers. It should fail,
- * except on ancient systems, because it sets lp->d_npartitions
- * to 1 but the label is supposed to be read from the raw partition,
- * which is 0 only on ancient systems. Apparently most drivers
- * don't check lp->d_npartitions.
- */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = 1;
- if (lp->d_partitions[0].p_size == 0)
- lp->d_partitions[0].p_size = 0x1fffffff;
- lp->d_partitions[0].p_offset = 0;
-#endif
-
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
bp->b_blkno = LABELSECTOR;
@@ -210,139 +187,6 @@ correct_readdisklabel(dev, strat, lp)
return (msg);
}
-#ifdef PRE_DISKSLICE_COMPAT
-/*
- * Attempt to read a disk label from a device using the indicated strategy
- * routine. The label must be partly set up before this: secpercyl and
- * anything required in the strategy routine (e.g., sector size) must be
- * filled in before calling us. Returns NULL on success and an error
- * string on failure.
- * If Machine Specific Partitions (MSP) are not found, then it will proceed
- * as if the BSD partition starts at 0
- * The MBR on an IBM PC is an example of an MSP.
- */
-char *
-readdisklabel(dev, strat, lp, dp, bdp)
- dev_t dev;
- d_strategy_t *strat;
- register struct disklabel *lp;
- struct dos_partition *dp;
- struct dkbad *bdp;
-{
- register struct buf *bp;
- struct disklabel *dlp;
- char *msgMSP = NULL;
- char *msg = NULL;
- int i;
- int cyl = 0;
-
- /*
- * Set up the disklabel as in case there is no MSP.
- * We set the BSD part, but don't need to set the
- * RAW part, because readMSPtolabel() will reset that
- * itself. On return however, if there was no MSP,
- * then we will be looking into OUR part to find the label
- * and we will want that to start at 0, and have at least SOME length.
- */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = OURPART + 1;
- if (lp->d_partitions[OURPART].p_size == 0)
- lp->d_partitions[OURPART].p_size = 0x100; /*enough for a label*/
- lp->d_partitions[OURPART].p_offset = 0;
-
- /*
- * Dig out the Dos MSP.. If we get it, all remaining transfers
- * will be relative to the base of the BSD part.
- */
- msgMSP = readMSPtolabel(dev, strat, lp, dp, &cyl );
-
- /*
- * next, dig out disk label, relative to either the base of the
- * BSD part, or block 0, depending on if an MSP was found.
- */
- bp = geteblk((int)lp->d_secsize);
- bp->b_blkno = LABELSECTOR;
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), OURPART));
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylinder = cyl;
- (*strat)(bp);
- if (biowait(bp))
- msg = "I/O error";
- else for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)((char *)bp->b_data +
- DEV_BSIZE - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
- if (msg == NULL)
- msg = "no disk label";
- } else if (dlp->d_npartitions > MAXPARTITIONS ||
- dkcksum(dlp) != 0)
- msg = "disk label corrupted";
- else {
- *lp = *dlp;
- msg = NULL;
- break;
- }
- }
-
- if (msg && msgMSP) {
- msg = msgMSP;
- goto done;
- }
-
- /*
- * Since we had one of the two labels, either one made up from the
- * MSP, one found in the FreeBSD-MSP-partitions sector 2, or even
- * one in sector 2 absolute on the disk, there is not really an error.
- */
-
- msg = NULL;
-
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- printf("d_secsize: %ld\n", lp->d_secsize);
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_un.b_addr);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
-done:
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return (msg);
-}
-#endif /* PRE_DISKSLICE_COMPAT */
-
/*
* Check new disk label for sensibility before setting it.
*/
@@ -398,7 +242,7 @@ setdisklabel(olp, nlp, openmask)
* Write disk label back to device after modification.
*/
int
-correct_writedisklabel(dev, strat, lp)
+writedisklabel(dev, strat, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
@@ -418,119 +262,7 @@ correct_writedisklabel(dev, strat, lp)
bp->b_dev = dkmodpart(dev, labelpart);
bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
- error = biowait(bp);
- if (error)
- goto done;
- for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)
- ((char *)bp->b_data + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
- dkcksum(dlp) == 0) {
- *dlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
- }
- }
- error = ESRCH;
-done:
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return (error);
-}
-
-#ifdef PRE_DISKSLICE_COMPAT
-/*
- * Write disk label back to device after modification.
- * For FreeBSD 2.0(x86) this routine will refuse to install a label if
- * there is no DOS MSP. (this can be changed)
- *
- * Assumptions for THIS VERSION:
- * The given disklabel pointer is actually that which is controlling this
- * Device, so that by fiddling it, readMSPtolabel() can ensure that
- * it can read from the MSP if it exists,
- * This assumption will cease as soon as ther is a better way of ensuring
- * that a read is done to the whole raw device.
- * MSP defines a BSD part, label is in block 1 (2nd block) of this
- */
-int
-writedisklabel(dev, strat, lp)
- dev_t dev;
- d_strategy_t *strat;
- register struct disklabel *lp;
-{
- struct buf *bp = NULL;
- struct disklabel *dlp;
- int error = 0;
- struct disklabel label;
- char *msg;
- int BSDstart,BSDlen;
- int cyl; /* dummy arg for readMSPtolabel() */
-
- /*
- * Save the label (better be the real one)
- * because we are going to play funny games with the disklabel
- * controlling this device..
- */
- bcopy(lp,&label,sizeof(label));
- /*
- * Unlike the read, we will trust the parameters given to us
- * about the disk, in the new disklabel but will simply
- * force OURPART to start at block 0 as a default in case there is NO
- * MSP.
- * readMSPtolabel() will reset it to start at the start of the BSD
- * part if it exists
- * At this time this is an error contition but I've left support for it
- */
- lp->d_npartitions = OURPART + 1;
- if (lp->d_partitions[OURPART].p_size == 0)
- lp->d_partitions[OURPART].p_size = 0x1fffffff;
- lp->d_partitions[OURPART].p_offset = 0;
-
- msg = readMSPtolabel(dev, strat, lp, 0, &cyl );
- /*
- * If we want to be able to install without an Machine Specific
- * Partitioning , then
- * the failure of readMSPtolabel() should be made non fatal.
- */
- if(msg) {
- printf("writedisklabel:%s\n",msg);
- error = ENXIO;
- goto done;
- }
- /*
- * If we had MSP (no message) but there
- * was no BSD part in it
- * then balk.. they should use fdisk to make one first or smash it..
- * This may just be me being paranoid, but it's my choice for now..
- * note we test for !msg, because the test above might be changed
- * as a valid option..
- */
- if((!msg) && (!(lp->d_subtype & DSTYPE_INDOSPART))) {
- printf("writedisklabel: MSP with no BSD part\n");
- }
-
- /*
- * get all the other bits back from the good new disklabel
- * (the user wouldn't try confuse us would he?)
- * With the exception of the OURPART which now points to the
- * BSD partition.
- */
- BSDstart = lp->d_partitions[OURPART].p_offset;
- BSDlen = lp->d_partitions[OURPART].p_size;
- bcopy(&label,lp,sizeof(label));
- lp->d_partitions[OURPART].p_offset = BSDstart;
- lp->d_partitions[OURPART].p_size = BSDlen;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), OURPART));
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
-#ifdef STUPID
+#if 1
/*
* We read the label first to see if it's there,
* in which case we will put ours at the same offset into the block..
@@ -549,7 +281,7 @@ writedisklabel(dev, strat, lp)
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {
- bcopy(&label,dlp,sizeof(label));
+ *dlp = *lp;
bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
@@ -557,22 +289,19 @@ writedisklabel(dev, strat, lp)
}
}
error = ESRCH;
-#else /* Stupid */
+done:
+#else
+ bzero(bp->b_data, lp->d_secsize);
dlp = (struct disklabel *)bp->b_data;
- bcopy(&label,dlp,sizeof(label));
+ *dlp = *lp;
bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
-#endif /* Stupid */
-done:
- bcopy(&label,lp,sizeof(label)); /* start using the new label again */
- if (bp) {
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- }
+#endif
+ bp->b_flags = B_INVAL | B_AGE;
+ brelse(bp);
return (error);
}
-#endif /* PRE_DISKSLICE_COMPAT */
/*
* Compute checksum for disk label.
diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c
index 618f4f4..5555a81 100644
--- a/sys/kern/subr_diskslice.c
+++ b/sys/kern/subr_diskslice.c
@@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
- * $Id: subr_diskslice.c,v 1.13 1995/05/24 23:33:42 davidg Exp $
+ * $Id: subr_diskslice.c,v 1.14 1995/05/30 08:05:51 rgrimes Exp $
*/
#include <sys/param.h>
@@ -454,7 +454,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
*/
old_wlabel = sp->ds_wlabel;
set_ds_wlabel(ssp, slice, TRUE);
- error = correct_writedisklabel(dev, strat, sp->ds_label);
+ error = writedisklabel(dev, strat, sp->ds_label);
/* XXX should invalidate in-core label if write failed. */
set_ds_wlabel(ssp, slice, old_wlabel);
return (error);
@@ -628,7 +628,7 @@ dsopen(dname, dev, mode, sspp, lp, strat, setgeom)
*lp1 = *lp;
lp = lp1;
TRACE(("readdisklabel\n"));
- msg = correct_readdisklabel(dkmodpart(dev, RAW_PART), strat, lp);
+ msg = readdisklabel(dkmodpart(dev, RAW_PART), strat, lp);
#if 0 /* XXX */
if (msg == NULL && setgeom != NULL && setgeom(lp) != 0)
msg = "setgeom failed";
diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h
index f9e77f9..3df5344 100644
--- a/sys/sys/disklabel.h
+++ b/sys/sys/disklabel.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.1 (Berkeley) 6/2/93
- * $Id: disklabel.h,v 1.15 1995/05/16 07:52:17 davidg Exp $
+ * $Id: disklabel.h,v 1.16 1995/05/30 08:14:17 rgrimes Exp $
*/
#ifndef _SYS_DISKLABEL_H_
@@ -50,35 +50,10 @@
* to leave room for a bootstrap, etc.
*/
-/*
- * XXX the following will go away when conversion to the slice version is
- * complete: OURPART, RAWPART, readMSPtolabel, readMBRtolabel, dkminor,
- * the DOSified readdisklabel, DOS stuff in this file.
- */
-
/* XXX these should be defined per controller (or drive) elsewhere, not here! */
#ifdef __i386__
#define LABELSECTOR 1 /* sector containing label */
#define LABELOFFSET 0 /* offset of label in sector */
-#define OURPART 2 /* partition is 'all BSD' */
-#define RAWPART 3 /* partition is 'all device' */
-#define readMSPtolabel readMBRtolabel
-#endif
-
-#ifndef readMSPtolabel
-#define readMSPtolabel(a,b,c,d,e) /* zap calls if irrelevant */
-#endif
-
-#ifdef tahoe
-#define RAWPART 0
-#endif
-
-#ifndef RAWPART
-#define RAWPART 2
-#endif
-
-#ifndef OURPART
-#define OURPART RAWPART /* by default it's all ours */
#endif
#ifndef LABELSECTOR
@@ -220,11 +195,6 @@ struct disklabel {
#define DTYPE_HPFL 8 /* HP Fiber-link */
#define DTYPE_FLOPPY 10 /* floppy */
-/* d_subtype values: */
-#define DSTYPE_INDOSPART 0x8 /* is inside dos partition */
-#define DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */
-#define DSTYPE_GEOMETRY 0x10 /* drive params in label */
-
#ifdef DKTYPENAMES
static char *dktypenames[] = {
"unknown",
@@ -343,7 +313,6 @@ struct partinfo {
#define DOSPARTOFF 446
#define NDOSPART 4
#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
-#define MBR_PTYPE_FreeBSD 0xa5 /* FreeBSD partition type */
struct dos_partition {
unsigned char dp_flag; /* bootstrap flags */
@@ -358,8 +327,6 @@ struct dos_partition {
unsigned long dp_size; /* partition size in sectors */
};
-extern struct dos_partition dos_partitions[NDOSPART];
-
#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */
#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */
@@ -409,7 +376,6 @@ extern struct dos_partition dos_partitions[NDOSPART];
*/
#define dkmakeminor(unit, slice, part) \
(((slice) << 16) | ((unit) << 3) | (part))
-#define dkminor(unit, part) dkmakeminor((unit), 0, (part))
#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part))
#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16))
#define dkpart(dev) (minor(dev) & 7)
@@ -425,23 +391,12 @@ extern struct dos_partition dos_partitions[NDOSPART];
int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp,
int wlabel));
-char *correct_readdisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp));
-int correct_writedisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp));
void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
u_int dkcksum __P((struct disklabel *lp));
-struct dkbad;
char *readdisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp,
- struct dos_partition *dp, struct dkbad *bdp));
-#ifdef __i386__
-char *readMBRtolabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp, struct dos_partition *dp,
- int *cyl));
-#endif
+ struct disklabel *lp));
int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
u_long openmask));
int writedisklabel __P((dev_t dev, d_strategy_t *strat,
diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h
index f9e77f9..3df5344 100644
--- a/sys/sys/diskmbr.h
+++ b/sys/sys/diskmbr.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.1 (Berkeley) 6/2/93
- * $Id: disklabel.h,v 1.15 1995/05/16 07:52:17 davidg Exp $
+ * $Id: disklabel.h,v 1.16 1995/05/30 08:14:17 rgrimes Exp $
*/
#ifndef _SYS_DISKLABEL_H_
@@ -50,35 +50,10 @@
* to leave room for a bootstrap, etc.
*/
-/*
- * XXX the following will go away when conversion to the slice version is
- * complete: OURPART, RAWPART, readMSPtolabel, readMBRtolabel, dkminor,
- * the DOSified readdisklabel, DOS stuff in this file.
- */
-
/* XXX these should be defined per controller (or drive) elsewhere, not here! */
#ifdef __i386__
#define LABELSECTOR 1 /* sector containing label */
#define LABELOFFSET 0 /* offset of label in sector */
-#define OURPART 2 /* partition is 'all BSD' */
-#define RAWPART 3 /* partition is 'all device' */
-#define readMSPtolabel readMBRtolabel
-#endif
-
-#ifndef readMSPtolabel
-#define readMSPtolabel(a,b,c,d,e) /* zap calls if irrelevant */
-#endif
-
-#ifdef tahoe
-#define RAWPART 0
-#endif
-
-#ifndef RAWPART
-#define RAWPART 2
-#endif
-
-#ifndef OURPART
-#define OURPART RAWPART /* by default it's all ours */
#endif
#ifndef LABELSECTOR
@@ -220,11 +195,6 @@ struct disklabel {
#define DTYPE_HPFL 8 /* HP Fiber-link */
#define DTYPE_FLOPPY 10 /* floppy */
-/* d_subtype values: */
-#define DSTYPE_INDOSPART 0x8 /* is inside dos partition */
-#define DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */
-#define DSTYPE_GEOMETRY 0x10 /* drive params in label */
-
#ifdef DKTYPENAMES
static char *dktypenames[] = {
"unknown",
@@ -343,7 +313,6 @@ struct partinfo {
#define DOSPARTOFF 446
#define NDOSPART 4
#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
-#define MBR_PTYPE_FreeBSD 0xa5 /* FreeBSD partition type */
struct dos_partition {
unsigned char dp_flag; /* bootstrap flags */
@@ -358,8 +327,6 @@ struct dos_partition {
unsigned long dp_size; /* partition size in sectors */
};
-extern struct dos_partition dos_partitions[NDOSPART];
-
#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */
#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */
@@ -409,7 +376,6 @@ extern struct dos_partition dos_partitions[NDOSPART];
*/
#define dkmakeminor(unit, slice, part) \
(((slice) << 16) | ((unit) << 3) | (part))
-#define dkminor(unit, part) dkmakeminor((unit), 0, (part))
#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part))
#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16))
#define dkpart(dev) (minor(dev) & 7)
@@ -425,23 +391,12 @@ extern struct dos_partition dos_partitions[NDOSPART];
int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp,
int wlabel));
-char *correct_readdisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp));
-int correct_writedisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp));
void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
u_int dkcksum __P((struct disklabel *lp));
-struct dkbad;
char *readdisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp,
- struct dos_partition *dp, struct dkbad *bdp));
-#ifdef __i386__
-char *readMBRtolabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp, struct dos_partition *dp,
- int *cyl));
-#endif
+ struct disklabel *lp));
int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
u_long openmask));
int writedisklabel __P((dev_t dev, d_strategy_t *strat,
diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h
index f9e77f9..3df5344 100644
--- a/sys/sys/diskpc98.h
+++ b/sys/sys/diskpc98.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)disklabel.h 8.1 (Berkeley) 6/2/93
- * $Id: disklabel.h,v 1.15 1995/05/16 07:52:17 davidg Exp $
+ * $Id: disklabel.h,v 1.16 1995/05/30 08:14:17 rgrimes Exp $
*/
#ifndef _SYS_DISKLABEL_H_
@@ -50,35 +50,10 @@
* to leave room for a bootstrap, etc.
*/
-/*
- * XXX the following will go away when conversion to the slice version is
- * complete: OURPART, RAWPART, readMSPtolabel, readMBRtolabel, dkminor,
- * the DOSified readdisklabel, DOS stuff in this file.
- */
-
/* XXX these should be defined per controller (or drive) elsewhere, not here! */
#ifdef __i386__
#define LABELSECTOR 1 /* sector containing label */
#define LABELOFFSET 0 /* offset of label in sector */
-#define OURPART 2 /* partition is 'all BSD' */
-#define RAWPART 3 /* partition is 'all device' */
-#define readMSPtolabel readMBRtolabel
-#endif
-
-#ifndef readMSPtolabel
-#define readMSPtolabel(a,b,c,d,e) /* zap calls if irrelevant */
-#endif
-
-#ifdef tahoe
-#define RAWPART 0
-#endif
-
-#ifndef RAWPART
-#define RAWPART 2
-#endif
-
-#ifndef OURPART
-#define OURPART RAWPART /* by default it's all ours */
#endif
#ifndef LABELSECTOR
@@ -220,11 +195,6 @@ struct disklabel {
#define DTYPE_HPFL 8 /* HP Fiber-link */
#define DTYPE_FLOPPY 10 /* floppy */
-/* d_subtype values: */
-#define DSTYPE_INDOSPART 0x8 /* is inside dos partition */
-#define DSTYPE_DOSPART(s) ((s) & 3) /* dos partition number */
-#define DSTYPE_GEOMETRY 0x10 /* drive params in label */
-
#ifdef DKTYPENAMES
static char *dktypenames[] = {
"unknown",
@@ -343,7 +313,6 @@ struct partinfo {
#define DOSPARTOFF 446
#define NDOSPART 4
#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
-#define MBR_PTYPE_FreeBSD 0xa5 /* FreeBSD partition type */
struct dos_partition {
unsigned char dp_flag; /* bootstrap flags */
@@ -358,8 +327,6 @@ struct dos_partition {
unsigned long dp_size; /* partition size in sectors */
};
-extern struct dos_partition dos_partitions[NDOSPART];
-
#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */
#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */
@@ -409,7 +376,6 @@ extern struct dos_partition dos_partitions[NDOSPART];
*/
#define dkmakeminor(unit, slice, part) \
(((slice) << 16) | ((unit) << 3) | (part))
-#define dkminor(unit, part) dkmakeminor((unit), 0, (part))
#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part))
#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16))
#define dkpart(dev) (minor(dev) & 7)
@@ -425,23 +391,12 @@ extern struct dos_partition dos_partitions[NDOSPART];
int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp,
int wlabel));
-char *correct_readdisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp));
-int correct_writedisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp));
void diskerr __P((struct buf *bp, char *dname, char *what, int pri,
int blkdone, struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
u_int dkcksum __P((struct disklabel *lp));
-struct dkbad;
char *readdisklabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp,
- struct dos_partition *dp, struct dkbad *bdp));
-#ifdef __i386__
-char *readMBRtolabel __P((dev_t dev, d_strategy_t *strat,
- struct disklabel *lp, struct dos_partition *dp,
- int *cyl));
-#endif
+ struct disklabel *lp));
int setdisklabel __P((struct disklabel *olp, struct disklabel *nlp,
u_long openmask));
int writedisklabel __P((dev_t dev, d_strategy_t *strat,
diff --git a/sys/ufs/ufs/ufs_disksubr.c b/sys/ufs/ufs/ufs_disksubr.c
index 442a0ad..be8e81a 100644
--- a/sys/ufs/ufs/ufs_disksubr.c
+++ b/sys/ufs/ufs/ufs_disksubr.c
@@ -1,9 +1,3 @@
-#define PRE_DISKSLICE_COMPAT
-#ifndef PRE_DISKSLICE_COMPAT
-#define correct_readdisklabel readdisklabel
-#define correct_writedisklabel writedisklabel
-#endif
-
/*
* Copyright (c) 1982, 1986, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
- * $Id: ufs_disksubr.c,v 1.17 1995/08/07 14:20:27 davidg Exp $
+ * $Id: ufs_disksubr.c,v 1.18 1995/08/28 16:09:11 bde Exp $
*/
#include <sys/param.h>
@@ -50,7 +44,6 @@
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
-#include <sys/dkbad.h>
#include <sys/syslog.h>
/*
@@ -149,13 +142,13 @@ insert:
/*
* Attempt to read a disk label from a device using the indicated strategy
- * routine. The label must be partly set up before this: secpercyl and
- * anything required in the strategy routine (e.g., sector size) must be
- * filled in before calling us. Returns NULL on success and an error
- * string on failure.
+ * routine. The label must be partly set up before this: secpercyl, secsize
+ * and anything required in the strategy routine (e.g., dummy bounds for the
+ * partition containing the label) must be * filled in before calling us.
+ * Returns NULL on success and an error string on failure.
*/
char *
-correct_readdisklabel(dev, strat, lp)
+readdisklabel(dev, strat, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
@@ -164,22 +157,6 @@ correct_readdisklabel(dev, strat, lp)
struct disklabel *dlp;
char *msg = NULL;
-#if 0
- /*
- * This clobbers valid labels built by drivers. It should fail,
- * except on ancient systems, because it sets lp->d_npartitions
- * to 1 but the label is supposed to be read from the raw partition,
- * which is 0 only on ancient systems. Apparently most drivers
- * don't check lp->d_npartitions.
- */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = 1;
- if (lp->d_partitions[0].p_size == 0)
- lp->d_partitions[0].p_size = 0x1fffffff;
- lp->d_partitions[0].p_offset = 0;
-#endif
-
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
bp->b_blkno = LABELSECTOR;
@@ -210,139 +187,6 @@ correct_readdisklabel(dev, strat, lp)
return (msg);
}
-#ifdef PRE_DISKSLICE_COMPAT
-/*
- * Attempt to read a disk label from a device using the indicated strategy
- * routine. The label must be partly set up before this: secpercyl and
- * anything required in the strategy routine (e.g., sector size) must be
- * filled in before calling us. Returns NULL on success and an error
- * string on failure.
- * If Machine Specific Partitions (MSP) are not found, then it will proceed
- * as if the BSD partition starts at 0
- * The MBR on an IBM PC is an example of an MSP.
- */
-char *
-readdisklabel(dev, strat, lp, dp, bdp)
- dev_t dev;
- d_strategy_t *strat;
- register struct disklabel *lp;
- struct dos_partition *dp;
- struct dkbad *bdp;
-{
- register struct buf *bp;
- struct disklabel *dlp;
- char *msgMSP = NULL;
- char *msg = NULL;
- int i;
- int cyl = 0;
-
- /*
- * Set up the disklabel as in case there is no MSP.
- * We set the BSD part, but don't need to set the
- * RAW part, because readMSPtolabel() will reset that
- * itself. On return however, if there was no MSP,
- * then we will be looking into OUR part to find the label
- * and we will want that to start at 0, and have at least SOME length.
- */
- if (lp->d_secperunit == 0)
- lp->d_secperunit = 0x1fffffff;
- lp->d_npartitions = OURPART + 1;
- if (lp->d_partitions[OURPART].p_size == 0)
- lp->d_partitions[OURPART].p_size = 0x100; /*enough for a label*/
- lp->d_partitions[OURPART].p_offset = 0;
-
- /*
- * Dig out the Dos MSP.. If we get it, all remaining transfers
- * will be relative to the base of the BSD part.
- */
- msgMSP = readMSPtolabel(dev, strat, lp, dp, &cyl );
-
- /*
- * next, dig out disk label, relative to either the base of the
- * BSD part, or block 0, depending on if an MSP was found.
- */
- bp = geteblk((int)lp->d_secsize);
- bp->b_blkno = LABELSECTOR;
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), OURPART));
- bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- bp->b_cylinder = cyl;
- (*strat)(bp);
- if (biowait(bp))
- msg = "I/O error";
- else for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)((char *)bp->b_data +
- DEV_BSIZE - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
- if (msg == NULL)
- msg = "no disk label";
- } else if (dlp->d_npartitions > MAXPARTITIONS ||
- dkcksum(dlp) != 0)
- msg = "disk label corrupted";
- else {
- *lp = *dlp;
- msg = NULL;
- break;
- }
- }
-
- if (msg && msgMSP) {
- msg = msgMSP;
- goto done;
- }
-
- /*
- * Since we had one of the two labels, either one made up from the
- * MSP, one found in the FreeBSD-MSP-partitions sector 2, or even
- * one in sector 2 absolute on the disk, there is not really an error.
- */
-
- msg = NULL;
-
- /* obtain bad sector table if requested and present */
- if (bdp && (lp->d_flags & D_BADSECT)) {
- struct dkbad *db;
-
- printf("d_secsize: %ld\n", lp->d_secsize);
- i = 0;
- do {
- /* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
- bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
- if (lp->d_secsize > DEV_BSIZE)
- bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
- else
- bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
- bp->b_bcount = lp->d_secsize;
- bp->b_cylinder = lp->d_ncylinders - 1;
- (*strat)(bp);
-
- /* if successful, validate, otherwise try another */
- if (biowait(bp)) {
- msg = "bad sector table I/O error";
- } else {
- db = (struct dkbad *)(bp->b_un.b_addr);
-#define DKBAD_MAGIC 0x4321
- if (db->bt_mbz == 0
- && db->bt_flag == DKBAD_MAGIC) {
- msg = NULL;
- *bdp = *db;
- break;
- } else
- msg = "bad sector table corrupted";
- }
- } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
- i < lp->d_nsectors);
- }
-
-done:
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return (msg);
-}
-#endif /* PRE_DISKSLICE_COMPAT */
-
/*
* Check new disk label for sensibility before setting it.
*/
@@ -398,7 +242,7 @@ setdisklabel(olp, nlp, openmask)
* Write disk label back to device after modification.
*/
int
-correct_writedisklabel(dev, strat, lp)
+writedisklabel(dev, strat, lp)
dev_t dev;
d_strategy_t *strat;
register struct disklabel *lp;
@@ -418,119 +262,7 @@ correct_writedisklabel(dev, strat, lp)
bp->b_dev = dkmodpart(dev, labelpart);
bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
- (*strat)(bp);
- error = biowait(bp);
- if (error)
- goto done;
- for (dlp = (struct disklabel *)bp->b_data;
- dlp <= (struct disklabel *)
- ((char *)bp->b_data + lp->d_secsize - sizeof(*dlp));
- dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
- if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
- dkcksum(dlp) == 0) {
- *dlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
- (*strat)(bp);
- error = biowait(bp);
- goto done;
- }
- }
- error = ESRCH;
-done:
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- return (error);
-}
-
-#ifdef PRE_DISKSLICE_COMPAT
-/*
- * Write disk label back to device after modification.
- * For FreeBSD 2.0(x86) this routine will refuse to install a label if
- * there is no DOS MSP. (this can be changed)
- *
- * Assumptions for THIS VERSION:
- * The given disklabel pointer is actually that which is controlling this
- * Device, so that by fiddling it, readMSPtolabel() can ensure that
- * it can read from the MSP if it exists,
- * This assumption will cease as soon as ther is a better way of ensuring
- * that a read is done to the whole raw device.
- * MSP defines a BSD part, label is in block 1 (2nd block) of this
- */
-int
-writedisklabel(dev, strat, lp)
- dev_t dev;
- d_strategy_t *strat;
- register struct disklabel *lp;
-{
- struct buf *bp = NULL;
- struct disklabel *dlp;
- int error = 0;
- struct disklabel label;
- char *msg;
- int BSDstart,BSDlen;
- int cyl; /* dummy arg for readMSPtolabel() */
-
- /*
- * Save the label (better be the real one)
- * because we are going to play funny games with the disklabel
- * controlling this device..
- */
- bcopy(lp,&label,sizeof(label));
- /*
- * Unlike the read, we will trust the parameters given to us
- * about the disk, in the new disklabel but will simply
- * force OURPART to start at block 0 as a default in case there is NO
- * MSP.
- * readMSPtolabel() will reset it to start at the start of the BSD
- * part if it exists
- * At this time this is an error contition but I've left support for it
- */
- lp->d_npartitions = OURPART + 1;
- if (lp->d_partitions[OURPART].p_size == 0)
- lp->d_partitions[OURPART].p_size = 0x1fffffff;
- lp->d_partitions[OURPART].p_offset = 0;
-
- msg = readMSPtolabel(dev, strat, lp, 0, &cyl );
- /*
- * If we want to be able to install without an Machine Specific
- * Partitioning , then
- * the failure of readMSPtolabel() should be made non fatal.
- */
- if(msg) {
- printf("writedisklabel:%s\n",msg);
- error = ENXIO;
- goto done;
- }
- /*
- * If we had MSP (no message) but there
- * was no BSD part in it
- * then balk.. they should use fdisk to make one first or smash it..
- * This may just be me being paranoid, but it's my choice for now..
- * note we test for !msg, because the test above might be changed
- * as a valid option..
- */
- if((!msg) && (!(lp->d_subtype & DSTYPE_INDOSPART))) {
- printf("writedisklabel: MSP with no BSD part\n");
- }
-
- /*
- * get all the other bits back from the good new disklabel
- * (the user wouldn't try confuse us would he?)
- * With the exception of the OURPART which now points to the
- * BSD partition.
- */
- BSDstart = lp->d_partitions[OURPART].p_offset;
- BSDlen = lp->d_partitions[OURPART].p_size;
- bcopy(&label,lp,sizeof(label));
- lp->d_partitions[OURPART].p_offset = BSDstart;
- lp->d_partitions[OURPART].p_size = BSDlen;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), OURPART));
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
-#ifdef STUPID
+#if 1
/*
* We read the label first to see if it's there,
* in which case we will put ours at the same offset into the block..
@@ -549,7 +281,7 @@ writedisklabel(dev, strat, lp)
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {
- bcopy(&label,dlp,sizeof(label));
+ *dlp = *lp;
bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
@@ -557,22 +289,19 @@ writedisklabel(dev, strat, lp)
}
}
error = ESRCH;
-#else /* Stupid */
+done:
+#else
+ bzero(bp->b_data, lp->d_secsize);
dlp = (struct disklabel *)bp->b_data;
- bcopy(&label,dlp,sizeof(label));
+ *dlp = *lp;
bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
-#endif /* Stupid */
-done:
- bcopy(&label,lp,sizeof(label)); /* start using the new label again */
- if (bp) {
- bp->b_flags = B_INVAL | B_AGE;
- brelse(bp);
- }
+#endif
+ bp->b_flags = B_INVAL | B_AGE;
+ brelse(bp);
return (error);
}
-#endif /* PRE_DISKSLICE_COMPAT */
/*
* Compute checksum for disk label.
OpenPOWER on IntegriCloud