summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-04 21:13:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-04 21:13:04 +0000
commit493210897221d7a7520ed88494339623a8d0cbb9 (patch)
tree437b23c9f66b7621e795b1a7278f3e5786b0ff8a /sys/arch/macppc
parentfeadbccc8166eb1acafe6168fece9b1756dfb533 (diff)
Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out this area and pass it up to userland. Then, delete all the same disk parsing code from disklabel(8) since the kernel passes it up. Lots and lots of - signs in the disklabel(8) code. Tested on as many platforms as possible, the fallout will be repaired as time goes on. To test, use disklabel -d <drive> and validate that the bounds do not overlap any boot blocks. This same information is used by disklabel -A... OK for the concept from krw, miod, and drahn
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/macppc/disksubr.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index c0b3769fa33..494ea445e79 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.61 2008/08/24 12:56:17 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.62 2009/06/04 21:13:02 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -106,11 +106,9 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
struct disklabel *lp, int *partoffp, int spoofonly)
{
int i, part_cnt, n, hfspartoff = -1;
+ u_int hfspartlen;
struct part_map_entry *part;
- if (partoffp)
- *partoffp = hfspartoff;
-
/* First check for a DPME (HFS) disklabel */
bp->b_blkno = 1;
bp->b_bcount = lp->d_secsize;
@@ -145,6 +143,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
if (strcmp(part->pmPartType, PART_TYPE_OPENBSD) == 0) {
hfspartoff = part->pmPyPartStart - LABELSECTOR;
+ hfspartlen = part->pmPartBlkCnt;
if (partoffp) {
*partoffp = hfspartoff;
return (NULL);
@@ -163,12 +162,14 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
pp->p_fstype = FS_HFS;
n++;
}
+
+ DL_SETBSTART(lp, hfspartoff);
+ DL_SETBEND(lp, hfspartoff + hfspartlen);
}
+
if (hfspartoff == -1)
return ("no OpenBSD partition inside DPME label");
- lp->d_npartitions = MAXPARTITIONS;
-
if (spoofonly)
return (NULL);
@@ -180,7 +181,8 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
if (biowait(bp))
return("disk label I/O error");
- return checkdisklabel(bp->b_data + LABELOFFSET, lp);
+ return checkdisklabel(bp->b_data + LABELOFFSET, lp, hfspartoff,
+ hfspartoff + hfspartlen);
}
/*