diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-09-27 20:20:24 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-09-27 20:20:24 +0000 |
commit | c1af4cb2dc617e67b67b7019b3441edaf5957de8 (patch) | |
tree | f2cd6d915eb1a8c98984719f6e4d927720c94732 /sys | |
parent | f38491d18468a7cb9197274b3920aaf4d9a9886c (diff) |
Use readdisksector() instead of manual buf initialization. These are
identical to the amd64 change already committed.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm/arm/disksubr.c | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 14 | ||||
-rw-r--r-- | sys/arch/landisk/landisk/disksubr.c | 14 | ||||
-rw-r--r-- | sys/arch/loongson/loongson/disksubr.c | 14 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/disksubr.c | 14 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/disksubr.c | 14 |
6 files changed, 30 insertions, 54 deletions
diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c index a97b04ce183..3e294013e6f 100644 --- a/sys/arch/arm/arm/disksubr.c +++ b/sys/arch/arm/arm/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.59 2013/10/19 09:32:12 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.60 2015/09/27 20:20:23 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -110,15 +110,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; diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 37da39f79db..b961039d285 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.113 2015/09/10 14:28:17 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.114 2015/09/27 20:20:23 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -137,15 +137,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; diff --git a/sys/arch/landisk/landisk/disksubr.c b/sys/arch/landisk/landisk/disksubr.c index e1581e208f8..563f526bbdf 100644 --- a/sys/arch/landisk/landisk/disksubr.c +++ b/sys/arch/landisk/landisk/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.47 2013/10/19 09:32:14 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.48 2015/09/27 20:20:23 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -110,15 +110,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; diff --git a/sys/arch/loongson/loongson/disksubr.c b/sys/arch/loongson/loongson/disksubr.c index 7a02006ac31..89574f48946 100644 --- a/sys/arch/loongson/loongson/disksubr.c +++ b/sys/arch/loongson/loongson/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.8 2013/10/19 09:32:14 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.9 2015/09/27 20:20:23 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -110,15 +110,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; diff --git a/sys/arch/octeon/octeon/disksubr.c b/sys/arch/octeon/octeon/disksubr.c index 7a02006ac31..89574f48946 100644 --- a/sys/arch/octeon/octeon/disksubr.c +++ b/sys/arch/octeon/octeon/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.8 2013/10/19 09:32:14 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.9 2015/09/27 20:20:23 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -110,15 +110,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; diff --git a/sys/arch/socppc/socppc/disksubr.c b/sys/arch/socppc/socppc/disksubr.c index 76474cb5411..44e4ce954f5 100644 --- a/sys/arch/socppc/socppc/disksubr.c +++ b/sys/arch/socppc/socppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.19 2013/10/19 09:32:15 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.20 2015/09/27 20:20:23 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -110,15 +110,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; |