From d92a22088820bed9b2ad499b3fb0bf27bc9f8223 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 12 Jun 2007 20:57:44 +0000 Subject: all disksubr.c did their b_flags manipulation differently (and wrong). correct and unify; ok thib miod --- sys/arch/sparc/sparc/disksubr.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'sys/arch/sparc') 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); } -- cgit v1.2.3