From b4beef39345d1dbe85f71c6935ff2742c4b8a5b8 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Fri, 15 Apr 2011 14:57:30 +0000 Subject: In days of yore one could arbitrarily whack buffer flags. Those days are past. Use CLR() and SET() to modify necessary flags while leaving the flags used by the buffer cache in peace. Should make bufcache code much less confused about the state of the bufs used in reading/writing disklabels. Other such flag abuses no doubt await a visit. Errors in original diff found by miod@. ok beck@ deraadt@ --- sys/arch/landisk/landisk/disksubr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/arch/landisk') diff --git a/sys/arch/landisk/landisk/disksubr.c b/sys/arch/landisk/landisk/disksubr.c index 72d2d077e85..49b110fcc15 100644 --- a/sys/arch/landisk/landisk/disksubr.c +++ b/sys/arch/landisk/landisk/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.42 2011/04/06 13:46:50 miod Exp $ */ +/* $OpenBSD: disksubr.c,v 1.43 2011/04/15 14:57:28 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -110,14 +110,16 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + CLR(bp->b_flags, B_WRITE | B_DONE); + SET(bp->b_flags, B_BUSY | B_READ | B_RAW); (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + CLR(bp->b_flags, B_READ | B_DONE); + SET(bp->b_flags, B_BUSY | B_WRITE | B_RAW); (*strat)(bp); error = biowait(bp); -- cgit v1.2.3