summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2015-09-28 01:17:58 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2015-09-28 01:17:58 +0000
commit7e1de9a1ebe35ce98b3c10eef87b23aa1084d5a1 (patch)
tree01210b923c2058bb717c054515280e35c495b55c
parent54567a2546ef812f1e73b2500f546e22f2a55034 (diff)
Use readdisksector() instead of manual buf initialization. hppa compiles
and boots, so the identical hppa64 should too! ok deraadt@
-rw-r--r--sys/arch/hppa/hppa/disksubr.c47
-rw-r--r--sys/arch/hppa64/hppa64/disksubr.c47
2 files changed, 28 insertions, 66 deletions
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c
index fd935de60fd..8d71713f352 100644
--- a/sys/arch/hppa/hppa/disksubr.c
+++ b/sys/arch/hppa/hppa/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.85 2015/09/27 12:29:21 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.86 2015/09/28 01:17:57 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -102,13 +102,10 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
int i;
/* read LIF volume header */
- bp->b_blkno = btodb(LIF_VOLSTART);
- 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 (biowait(bp))
- return (bp->b_error);
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ btodb(LIF_VOLSTART)));
+ if (error)
+ return (error);
lvp = (struct lifvol *)bp->b_data;
if (lvp->vol_id != LIF_VOL_ID) {
@@ -117,15 +114,10 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
}
/* read LIF directory */
- bp->b_blkno = lifstodb(lvp->vol_addr);
- 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 (biowait(bp)) {
- error = bp->b_error;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ lifstodb(lvp->vol_addr)));
+ if (error)
goto done;
- }
/* scan for LIF_DIR_FS dir entry */
for (i=0, p=(struct lifdir *)bp->b_data; i < LIF_NUMDIR; p++, i++) {
@@ -150,16 +142,10 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
int i;
/* read LIF directory */
- bp->b_blkno = lifstodb(p->dir_addr);
- 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 (biowait(bp)) {
- error = bp->b_error;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ lifstodb(p->dir_addr)));
+ if (error)
goto done;
- }
hl = (struct hpux_label *)bp->b_data;
if (hl->hl_magic1 != hl->hl_magic2 ||
@@ -221,15 +207,10 @@ finished:
if (spoofonly)
goto done;
- bp->b_blkno = fsoff + 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 (biowait(bp)) {
- error = bp->b_error;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, fsoff +
+ LABELSECTOR));
+ if (error)
goto done;
- }
/*
* Do OpenBSD disklabel validation/adjustment.
diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c
index 8885fb9d405..8fc190ff529 100644
--- a/sys/arch/hppa64/hppa64/disksubr.c
+++ b/sys/arch/hppa64/hppa64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.71 2015/09/27 15:23:09 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.72 2015/09/28 01:17:57 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -102,13 +102,10 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
int i;
/* read LIF volume header */
- bp->b_blkno = btodb(LIF_VOLSTART);
- 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 (biowait(bp))
- return (bp->b_error);
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ btodb(LIF_VOLSTART)));
+ if (error)
+ return (error);
lvp = (struct lifvol *)bp->b_data;
if (lvp->vol_id != LIF_VOL_ID) {
@@ -117,15 +114,10 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
}
/* read LIF directory */
- bp->b_blkno = lifstodb(lvp->vol_addr);
- 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 (biowait(bp)) {
- error = bp->b_error;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ lifstodb(lvp->vol_addr)));
+ if (error)
goto done;
- }
/* scan for LIF_DIR_FS dir entry */
for (i=0, p=(struct lifdir *)bp->b_data; i < LIF_NUMDIR; p++, i++) {
@@ -150,16 +142,10 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *),
int i;
/* read LIF directory */
- bp->b_blkno = lifstodb(p->dir_addr);
- 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 (biowait(bp)) {
- error = bp->b_error;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp,
+ lifstodb(p->dir_addr)));
+ if (error)
goto done;
- }
hl = (struct hpux_label *)bp->b_data;
if (hl->hl_magic1 != hl->hl_magic2 ||
@@ -221,15 +207,10 @@ finished:
if (spoofonly)
goto done;
- bp->b_blkno = fsoff + 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 (biowait(bp)) {
- error = bp->b_error;
+ error = readdisksector(bp, strat, lp, DL_BLKTOSEC(lp, fsoff +
+ LABELSECTOR));
+ if (error)
goto done;
- }
/*
* Do OpenBSD disklabel validation/adjustment.