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/sparc64/sparc64/disksubr.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'sys/arch/sparc64') diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 9597405a53b..7ab32acc3e0 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.37 2007/06/09 23:06:46 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.38 2007/06/12 20:57:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -174,7 +174,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); @@ -190,20 +190,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); @@ -214,11 +206,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