summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2011-04-15 14:57:30 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2011-04-15 14:57:30 +0000
commitb4beef39345d1dbe85f71c6935ff2742c4b8a5b8 (patch)
tree9e953ccf05e5ba2fbe93b2d58c5fdb2fa680cafb /sys/arch/amd64
parent333e7f4bad1ad8fde2bfadcf79001104562ccc74 (diff)
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/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/disksubr.c8
-rw-r--r--sys/arch/amd64/amd64/dkcsum.c5
2 files changed, 8 insertions, 5 deletions
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c
index 4d59842864c..253d11b069d 100644
--- a/sys/arch/amd64/amd64/disksubr.c
+++ b/sys/arch/amd64/amd64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.59 2011/04/06 13:46:50 miod Exp $ */
+/* $OpenBSD: disksubr.c,v 1.60 2011/04/15 14:57:28 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -135,14 +135,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);
diff --git a/sys/arch/amd64/amd64/dkcsum.c b/sys/arch/amd64/amd64/dkcsum.c
index 0475b483abb..e95fb12119f 100644
--- a/sys/arch/amd64/amd64/dkcsum.c
+++ b/sys/arch/amd64/amd64/dkcsum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dkcsum.c,v 1.16 2010/12/07 00:30:40 dlg Exp $ */
+/* $OpenBSD: dkcsum.c,v 1.17 2011/04/15 14:57:28 krw Exp $ */
/*-
* Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
@@ -113,7 +113,8 @@ dkcsumattach(void)
/* Read blocks to cksum. XXX maybe a d_read should be used. */
bp->b_blkno = 0;
bp->b_bcount = bios_cksumlen * DEV_BSIZE;
- 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);
bp->b_cylinder = 0;
(*bdsw->d_strategy)(bp);
if ((error = biowait(bp))) {