diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-09-27 18:03:19 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-09-27 18:03:19 +0000 |
commit | 23c00b6d56d78390f5700afb959c1a92cf2038bb (patch) | |
tree | e4509d73447dce326d51ff01b44daa7921377dec /sys/arch | |
parent | 9dad5ee38132c5856f41fa1a398712c22a22c6fc (diff) |
Use readdisksector() instead of manual buf initialization.
ok deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/disksubr.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index 8a97a45b562..c8b0cf7efd0 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.75 2015/09/10 14:28:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.76 2015/09/27 18:03:18 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -138,15 +138,11 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) goto done; /* Read it in, slap the new label in, and write it back out */ - bp->b_blkno = DL_BLKTOSEC(lp, partoff + DOS_LABELSECTOR) * - DL_BLKSPERSEC(lp); - offset = DL_BLKOFFSET(lp, partoff + DOS_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); - (*strat)(bp); - if ((error = biowait(bp)) != 0) + error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, partoff + + DOS_LABELSECTOR)); + if (error) goto done; + offset = DL_BLKOFFSET(lp, partoff + DOS_LABELSECTOR); dlp = (struct disklabel *)(bp->b_data + offset); *dlp = *lp; |