summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-10-18 10:35:05 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-10-18 10:35:05 +0000
commit035e821a9286f8b53fc595a4155f108852b2968a (patch)
tree8f40cb89b21ea1649f455e209a5231b007d46192 /sys/arch/powerpc
parent558f6abeb7d6f078b099609c8d6170f793f35b11 (diff)
do not create spoofed partition for DOSTYP_OPENBSD
Diffstat (limited to 'sys/arch/powerpc')
-rw-r--r--sys/arch/powerpc/powerpc/disksubr.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sys/arch/powerpc/powerpc/disksubr.c b/sys/arch/powerpc/powerpc/disksubr.c
index b405e2518f0..45398858d1d 100644
--- a/sys/arch/powerpc/powerpc/disksubr.c
+++ b/sys/arch/powerpc/powerpc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.6 1997/10/14 17:11:12 pefo Exp $ */
+/* $OpenBSD: disksubr.c,v 1.7 1997/10/18 10:35:04 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -139,7 +139,7 @@ readdisklabel(dev, strat, lp, osdep)
bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp));
if (ourpart == -1) {
- /* Search for our DOS partition */
+ /* Search for our MBR partition */
for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
i++, dp2++)
if (get_le(&dp2->dp_size) &&
@@ -153,7 +153,7 @@ readdisklabel(dev, strat, lp, osdep)
if (ourpart == -1)
goto donot;
/*
- * This is our DOS partition. need sector address
+ * This is our MBR partition. need sector address
* for SCSI/IDE, cylinder for ESDI/ST506/RLL
*/
dp2 = &dp[ourpart];
@@ -180,6 +180,10 @@ donot:
for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) {
struct partition *pp = &lp->d_partitions[8+n];
+ if (dp2->dp_typ == DOSPTYP_OPENBSD)
+ continue;
+ if (get_le(&dp2->dp_size) > lp->d_secperunit)
+ continue;
if (get_le(&dp2->dp_size))
pp->p_size = get_le(&dp2->dp_size);
if (get_le(&dp2->dp_start))
@@ -448,7 +452,13 @@ writedisklabel(dev, strat, lp, osdep)
goto done;
}
}
- error = ESRCH;
+
+ /* Write it in the regular place. */
+ *(struct disklabel *)bp->b_data = *lp;
+ bp->b_flags = B_BUSY | B_WRITE;
+ (*strat)(bp);
+ error = biowait(bp);
+ goto done;
done:
bp->b_flags |= B_INVAL;