summaryrefslogtreecommitdiff
path: root/sbin/disklabel/disklabel.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-24 11:36:56 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-24 11:36:56 +0000
commit3e6f196fd04a87ec158c09faee1507afd890ad49 (patch)
treeefaa15591c23d7de8d0e655ac42287e035e05665 /sbin/disklabel/disklabel.c
parent5a452a4c056f898105b8a215cae439f49ee5f623 (diff)
use DOSPTYP_386BSD only if no DOSPTYP_OPENBSD part on disk
Diffstat (limited to 'sbin/disklabel/disklabel.c')
-rw-r--r--sbin/disklabel/disklabel.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 341211845bf..23f1b0b5c1e 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.19 1996/09/24 04:35:18 deraadt Exp $ */
+/* $OpenBSD: disklabel.c,v 1.20 1996/09/24 11:36:55 deraadt Exp $ */
/* $NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "$OpenBSD: disklabel.c,v 1.19 1996/09/24 04:35:18 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: disklabel.c,v 1.20 1996/09/24 11:36:55 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -381,7 +381,9 @@ writelabel(f, boot, lp)
* In this case, partition 'a' had better start at 0,
* otherwise we reject the request as meaningless. -wfj
*/
- if (dosdp && dosdp->dp_typ == DOSPTYP_386BSD && pp->p_size) {
+ if (dosdp && pp->p_size &&
+ (dosdp->dp_typ == DOSPTYP_386BSD ||
+ dosdp->dp_typ == DOSPTYP_386BSD)) {
sectoffset = dosdp->dp_start * lp->d_secsize;
} else {
if (dosdp) {
@@ -571,14 +573,28 @@ readmbr(f)
}
/* Find OpenBSD partition. */
for (part = 0; part < NDOSPART; part++) {
+ if (dp[part].dp_size && dp[part].dp_typ == DOSPTYP_OPENBSD) {
+ fprintf(stderr, "using MBR partition %d: "
+ "type %d (0x%02x) "
+ "offset %d (0x%x) size %d (0x%x)\n", part,
+ dp[part].dp_typ, dp[part].dp_typ,
+ dp[part].dp_start, dp[part].dp_start,
+ dp[part].dp_size, dp[part].dp_size);
+ return (&dp[part]);
+ }
+ }
+ for (part = 0; part < NDOSPART; part++) {
if (dp[part].dp_size && dp[part].dp_typ == DOSPTYP_386BSD) {
- warnx("using dos partition %d: offset %d (0x%x) "
- "size %d (0x%x)", part,
+ fprintf(stderr, "using MBR partition %d: "
+ "type %d (0x%02x) "
+ "offset %d (0x%x) size %d (0x%x)\n", part,
+ dp[part].dp_typ, dp[part].dp_typ,
dp[part].dp_start, dp[part].dp_start,
dp[part].dp_size, dp[part].dp_size);
return (&dp[part]);
}
}
+
/* If no OpenBSD partition, find first used partition. */
for (part = 0; part < NDOSPART; part++) {
if (dp[part].dp_size) {
@@ -606,7 +622,9 @@ readlabel(f)
off_t sectoffset = 0;
#ifdef DOSLABEL
- if (dosdp && dosdp->dp_size && dosdp->dp_typ == DOSPTYP_386BSD)
+ if (dosdp && dosdp->dp_size &&
+ (dosdp->dp_typ == DOSPTYP_386BSD ||
+ dosdp->dp_typ == DOSPTYP_OPENBSD))
sectoffset = dosdp->dp_start * DEV_BSIZE;
#endif
if (verbose)
@@ -1328,7 +1346,8 @@ checklabel(lp)
if (lp->d_secperunit == 0)
lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders;
#ifdef i386__notyet
- if (dosdp && dosdp->dp_size && dosdp->dp_typ == DOSPTYP_386BSD
+ if (dosdp && dosdp->dp_size && (dosdp->dp_typ == DOSPTYP_386BSD ||
+ dosdp->dp_typ == DOSPTYP_OPENBSD)) {
&& lp->d_secperunit > dosdp->dp_start + dosdp->dp_size) {
warnx("exceeds DOS partition size");
errors++;