summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-12 20:57:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-12 20:57:44 +0000
commitd92a22088820bed9b2ad499b3fb0bf27bc9f8223 (patch)
tree23eefe8eebbc59fe8751ac9fee2b2e2dcfc20830 /sys/arch/sparc
parentbb9f20de9237688ceb64944e9fdca9bd454679c0 (diff)
all disksubr.c did their b_flags manipulation differently (and wrong).
correct and unify; ok thib miod
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/sparc/disksubr.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index 4c35a05adfd..c2684037e3f 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.58 2007/06/09 23:06:46 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.59 2007/06/12 20:57:43 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -175,7 +175,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
done:
if (bp) {
- bp->b_flags = B_INVAL | B_AGE | B_READ;
+ bp->b_flags |= B_INVAL;
brelse(bp);
}
disklabeltokernlabel(lp);
@@ -191,20 +191,12 @@ int
writedisklabel(dev_t dev, void (*strat)(struct buf *),
struct disklabel *lp, struct cpu_disklabel *clp)
{
- struct buf *bp;
+ struct buf *bp = NULL;
int error;
error = disklabel_bsd_to_sun(lp, clp->cd_block);
if (error)
- return (error);
-
-#if 0 /* XXX - Allow writing native disk labels? */
- {
- struct disklabel *dlp;
- dlp = (struct disklabel *)(clp->cd_block + LABELOFFSET);
- *dlp = *lp; /* struct assignment */
- }
-#endif
+ goto done;
/* Get a buffer and copy the new label into it. */
bp = geteblk((int)lp->d_secsize);
@@ -215,11 +207,15 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *),
bp->b_blkno = LABELSECTOR;
bp->b_cylinder = 0;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_WRITE;
+ bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
- brelse(bp);
+done:
+ if (bp) {
+ bp->b_flags |= B_INVAL;
+ brelse(bp);
+ }
return (error);
}