summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-09-28 21:52:29 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-09-28 21:52:29 +0000
commit19d7760d05b4ac89efc6806e3499cf215685d56d (patch)
tree08e94cb1f9499f300662e4baa62d63fd1d7f3c2c /sys/arch/macppc
parent81fb44468ff2309e6099251d8d26d030a859340a (diff)
More mechanical switching to readdisksector(), although this is a
slightly different pattern. hppa/macppc compile and boot so hppa64/aviion surely do too! ok deraadt@
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/macppc/disksubr.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index c5df89f67d5..3ea7f60156e 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.79 2015/09/28 00:31:50 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.80 2015/09/28 21:52:28 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -199,22 +199,18 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
+ /* Read it in, slap the new label in, and write it back out */
if (readdpmelabel(bp, strat, lp, &partoff, 1) == 0) {
- bp->b_blkno = partoff;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, partoff));
offset = 0;
} else if (readdoslabel(bp, strat, lp, &partoff, 1) == 0) {
- bp->b_blkno = DL_BLKTOSEC(lp, partoff + DOS_LABELSECTOR) *
- DL_BLKSPERSEC(lp);
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ partoff + DOS_LABELSECTOR));
offset = DL_BLKOFFSET(lp, partoff + DOS_LABELSECTOR);
} else
goto done;
- /* Read it in, slap the new label in, and write it back out */
- 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);
- (*strat)(bp);
- if ((error = biowait(bp)) != 0)
+ if (error)
goto done;
dlp = (struct disklabel *)(bp->b_data + offset);