summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2008-06-25 15:26:43 +0000
committerreyk <reyk@openbsd.org>2008-06-25 15:26:43 +0000
commitd173b22155d7cd2cb69fd36efaeb8d3d1a086ecc (patch)
treed7bd372e839e0391286d873d258dfea636556be4 /sys/kern/subr_disk.c
parenthandle sparc64 seperately; ok miod (diff)
downloadwireguard-openbsd-d173b22155d7cd2cb69fd36efaeb8d3d1a086ecc.tar.xz
wireguard-openbsd-d173b22155d7cd2cb69fd36efaeb8d3d1a086ecc.zip
allow to install and boot the OpenBSD A6 partition and disklabel in an
extended DOS partition. the concept of extended partitions is very simple, it is just another mbr at the partition offset (well, the standard "EBR" is a linked list with a few limitations, but this diff works with both variants). this diff has been in the snapshots for a while. with input from weingart@ and krw@ ok deraadt@
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index e3d80ae69ff..186ff615e10 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.78 2008/06/12 06:58:39 deraadt Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.79 2008/06/25 15:26:43 reyk Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -409,7 +409,7 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *),
bcopy(bp->b_data + DOSPARTOFF, dp, sizeof(dp));
- if (ourpart == -1 && part_blkno == DOSBBSECTOR) {
+ if (ourpart == -1) {
/* Search for our MBR partition */
for (dp2=dp, i=0; i < NDOSPART && ourpart == -1;
i++, dp2++)
@@ -454,11 +454,6 @@ donot:
continue;
if (letoh32(dp2->dp_size) == 0)
continue;
- if (letoh32(dp2->dp_start))
- DL_SETPOFFSET(pp,
- letoh32(dp2->dp_start) + part_blkno);
-
- DL_SETPSIZE(pp, letoh32(dp2->dp_size));
switch (dp2->dp_typ) {
case DOSPTYP_UNUSED:
@@ -499,6 +494,19 @@ donot:
n++;
break;
}
+
+ /*
+ * There is no need to set the offset/size when
+ * wandering; it would also invalidate the
+ * disklabel checksum.
+ */
+ if (wander)
+ continue;
+
+ if (letoh32(dp2->dp_start))
+ DL_SETPOFFSET(pp,
+ letoh32(dp2->dp_start) + part_blkno);
+ DL_SETPSIZE(pp, letoh32(dp2->dp_size));
}
}
lp->d_npartitions = MAXPARTITIONS;