summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-07-08 23:26:41 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-07-08 23:26:41 +0000
commitd78aa83f99cb4a72d1f79a7c0514b7dba17f1d39 (patch)
tree6a61775abc968e6eee4448f91fb8f272e3259b1c /sys/arch/macppc
parent6dd4f658475dda5ec2902fa6e5164f118faa939c (diff)
Cleanup calculation of OpenBSD disklabel location on DPME partitions. The labels
should go in the first block of the OpenBSD partition. Don't try to fake this out by tweaking the partition offset, which just confused other disklabel consumers. Problem noted on ppc@ by Mathieu Olivier some time ago. ok drahn@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/macppc/disksubr.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index e720ea76437..8f1301654f1 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.74 2011/07/08 00:08:00 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.75 2011/07/08 23:26:40 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -106,7 +106,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
struct part_map_entry *part;
/* First check for a DPME (HFS) disklabel */
- bp->b_blkno = 1;
+ bp->b_blkno = LABELSECTOR;
bp->b_bcount = lp->d_secsize;
CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
@@ -125,7 +125,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
struct partition *pp;
char *s;
- bp->b_blkno = 1+i;
+ bp->b_blkno = LABELSECTOR + i;
bp->b_bcount = lp->d_secsize;
CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
@@ -140,7 +140,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
*s = (*s - 'a' + 'A');
if (strcmp(part->pmPartType, PART_TYPE_OPENBSD) == 0) {
- hfspartoff = part->pmPyPartStart - LABELSECTOR;
+ hfspartoff = part->pmPyPartStart;
hfspartend = hfspartoff + part->pmPartBlkCnt;
if (partoffp) {
*partoffp = hfspartoff;
@@ -175,7 +175,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *),
return (0);
/* next, dig out disk label */
- bp->b_blkno = hfspartoff + LABELSECTOR;
+ bp->b_blkno = hfspartoff;
bp->b_bcount = lp->d_secsize;
CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
@@ -203,8 +203,8 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
bp->b_dev = dev;
if (readdpmelabel(bp, strat, lp, &partoff, 1) == 0) {
- bp->b_blkno = partoff + LABELSECTOR;
- offset = LABELOFFSET;
+ bp->b_blkno = partoff;
+ offset = 0;
} else if (readdoslabel(bp, strat, lp, &partoff, 1) == 0) {
bp->b_blkno = DL_BLKTOSEC(lp, partoff + DOS_LABELSECTOR) *
DL_BLKSPERSEC(lp);