diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-12 20:57:44 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-12 20:57:44 +0000 |
commit | d92a22088820bed9b2ad499b3fb0bf27bc9f8223 (patch) | |
tree | 23eefe8eebbc59fe8751ac9fee2b2e2dcfc20830 /sys/arch/sparc64 | |
parent | bb9f20de9237688ceb64944e9fdca9bd454679c0 (diff) |
all disksubr.c did their b_flags manipulation differently (and wrong).
correct and unify; ok thib miod
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/disksubr.c | 24 |
1 files changed, 10 insertions, 14 deletions
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); } |