diff options
author | 2011-04-15 14:57:28 +0000 | |
---|---|---|
committer | 2011-04-15 14:57:28 +0000 | |
commit | e08c5f56a57ffa919fd5ff6daf236891e760ef6f (patch) | |
tree | 220ef1cb3038df4c9e59ebb2ae7a3d58a2419539 /sys/kern/subr_disk.c | |
parent | remove unused function ikev2_flows_delete() (diff) | |
download | wireguard-openbsd-e08c5f56a57ffa919fd5ff6daf236891e760ef6f.tar.xz wireguard-openbsd-e08c5f56a57ffa919fd5ff6daf236891e760ef6f.zip |
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@
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r-- | sys/kern/subr_disk.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 9692ad43993..d9ccb8a229d 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.117 2011/03/19 01:21:57 krw Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.118 2011/04/15 14:57:29 krw Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -410,7 +410,8 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = DL_BLKTOSEC(lp, part_blkno) * DL_BLKSPERSEC(lp); offset = DL_BLKOFFSET(lp, part_blkno) + DOSPARTOFF; 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); error = biowait(bp); if (error) { @@ -595,7 +596,8 @@ notfat: DL_BLKSPERSEC(lp); offset = DL_BLKOFFSET(lp, dospartoff + DOS_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 (biowait(bp)) return (bp->b_error); |