Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys rationalize the use of b_flags for geteblk() buffers.
details: https://anonhg.NetBSD.org/src/rev/218897e1533b
branches: trunk
changeset: 499446:218897e1533b
user: chs <chs%NetBSD.org@localhost>
date: Mon Nov 20 08:24:08 2000 +0000
description:
rationalize the use of b_flags for geteblk() buffers.
rather than assigning to the whole field, set or clear individual flags,
which implies that the B_BUSY and B_INVAL flags will remain set.
this allows us to make the assertion in brelse() that B_BUSY is set,
which is the purpose of all this.
diffstat:
sys/arch/alpha/alpha/disksubr.c | 15 ++++++++-------
sys/arch/amiga/amiga/disksubr.c | 11 ++++++-----
sys/arch/amiga/dev/fd.c | 11 ++++++-----
sys/arch/arc/arc/disksubr.c | 20 +++++++++++---------
sys/arch/arm26/arm26/disksubr.c | 15 ++++++++-------
sys/arch/arm26/arm26/disksubr_acorn.c | 11 +++++------
sys/arch/arm26/arm26/disksubr_mbr.c | 8 +++-----
sys/arch/arm32/arm32/disksubr.c | 14 +++++++-------
sys/arch/arm32/arm32/disksubr_acorn.c | 11 +++++------
sys/arch/arm32/arm32/disksubr_mbr.c | 8 +++-----
sys/arch/arm32/mainbus/fd.c | 4 ++--
sys/arch/atari/atari/disksubr.c | 15 ++++++---------
sys/arch/bebox/bebox/disksubr.c | 20 +++++++++++---------
sys/arch/cobalt/cobalt/disksubr.c | 20 +++++++++++---------
sys/arch/hp300/hp300/disksubr.c | 10 +++++-----
sys/arch/hpcmips/hpcmips/disksubr.c | 19 ++++++++++---------
sys/arch/i386/i386/disksubr.c | 20 +++++++++++---------
sys/arch/luna68k/luna68k/disksubr.c | 7 +++----
sys/arch/mac68k/mac68k/disksubr.c | 10 +++++-----
sys/arch/macppc/macppc/disksubr.c | 23 +++++++++--------------
sys/arch/mipsco/mipsco/disksubr.c | 14 +++++++-------
sys/arch/mvme68k/mvme68k/disksubr.c | 11 ++++-------
sys/arch/news68k/news68k/disksubr.c | 10 +++++-----
sys/arch/newsmips/newsmips/disksubr.c | 10 +++++-----
sys/arch/next68k/next68k/disksubr.c | 10 +++++-----
sys/arch/ofppc/ofppc/disksubr.c | 11 ++++-------
sys/arch/pc532/pc532/disksubr.c | 10 +++++-----
sys/arch/pmax/pmax/disksubr.c | 13 ++++++-------
sys/arch/prep/prep/disksubr.c | 20 +++++++++++---------
sys/arch/sgimips/sgimips/disksubr.c | 5 ++---
sys/arch/sh3/sh3/disksubr.c | 20 +++++++++++---------
sys/arch/sparc/sparc/disksubr.c | 7 +++----
sys/arch/sparc64/sparc64/disksubr.c | 7 +++----
sys/arch/sun3/sun3/disksubr.c | 7 +++----
sys/arch/vax/vax/cfl.c | 10 ++++++++--
sys/arch/vax/vax/crl.c | 10 ++++++++--
sys/arch/vax/vax/disksubr.c | 10 +++++-----
sys/arch/x68k/x68k/disksubr.c | 28 ++++++++++++++++------------
sys/dev/raidframe/rf_netbsdkintf.c | 10 ++++------
39 files changed, 250 insertions(+), 245 deletions(-)
diffs (truncated from 2185 to 300 lines):
diff -r ffae08317e16 -r 218897e1533b sys/arch/alpha/alpha/disksubr.c
--- a/sys/arch/alpha/alpha/disksubr.c Mon Nov 20 06:42:05 2000 +0000
+++ b/sys/arch/alpha/alpha/disksubr.c Mon Nov 20 08:24:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.20 2000/05/19 18:54:24 thorpej Exp $ */
+/* $NetBSD: disksubr.c,v 1.21 2000/11/20 08:24:08 chs Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.20 2000/05/19 18:54:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.21 2000/11/20 08:24:08 chs Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -87,7 +87,7 @@
bp->b_blkno = LABELSECTOR;
bp->b_cylinder = 0;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags |= B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
@@ -114,7 +114,8 @@
i = 0;
do {
/* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
if (lp->d_secsize > DEV_BSIZE)
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
@@ -143,7 +144,6 @@
}
done:
- bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
return (msg);
}
@@ -225,7 +225,7 @@
bp->b_blkno = LABELSECTOR;
bp->b_cylinder = 0;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_READ; /* get current label */
+ bp->b_flags |= B_READ; /* get current label */
(*strat)(bp);
if ((error = biowait(bp)) != 0)
goto done;
@@ -248,7 +248,8 @@
dp[63] = sum;
}
- bp->b_flags = B_WRITE;
+ bp->b_flags &= ~(B_READ|B_DONE);
+ bp->b_flags |= B_WRITE;
(*strat)(bp);
error = biowait(bp);
diff -r ffae08317e16 -r 218897e1533b sys/arch/amiga/amiga/disksubr.c
--- a/sys/arch/amiga/amiga/disksubr.c Mon Nov 20 06:42:05 2000 +0000
+++ b/sys/arch/amiga/amiga/disksubr.c Mon Nov 20 08:24:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.35 2000/05/19 18:54:24 thorpej Exp $ */
+/* $NetBSD: disksubr.c,v 1.36 2000/11/20 08:24:09 chs Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -134,7 +134,7 @@
lp->d_partitions[RAW_PART].p_offset = 0;
/* obtain buffer to probe drive with */
- bp = (void *)geteblk((int)lp->d_secsize);
+ bp = geteblk((int)lp->d_secsize);
/*
* request no partition relocation by driver on I/O operations
@@ -154,7 +154,8 @@
bp->b_blkno = nextb;
bp->b_cylinder = bp->b_blkno / lp->d_secpercyl;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
#ifdef SD_C_ADJUSTS_NR
bp->b_blkno *= (lp->d_secsize / DEV_BSIZE);
#endif
@@ -248,7 +249,8 @@
bp->b_blkno = nextb;
bp->b_cylinder = bp->b_blkno / lp->d_secpercyl;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
#ifdef SD_C_ADJUSTS_NR
bp->b_blkno *= (lp->d_secsize / DEV_BSIZE);
#endif
@@ -429,7 +431,6 @@
done:
if (clp->valid == 0)
clp->rdblock = RDBNULL;
- bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
return(msg);
}
diff -r ffae08317e16 -r 218897e1533b sys/arch/amiga/dev/fd.c
--- a/sys/arch/amiga/dev/fd.c Mon Nov 20 06:42:05 2000 +0000
+++ b/sys/arch/amiga/dev/fd.c Mon Nov 20 08:24:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.45 2000/03/23 06:33:10 thorpej Exp $ */
+/* $NetBSD: fd.c,v 1.46 2000/11/20 08:24:09 chs Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -825,7 +825,7 @@
bp->b_blkno = 0;
bp->b_cylinder = 0;
bp->b_bcount = FDSECSIZE;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags |= B_READ;
fdstrategy(bp);
if ((error = biowait(bp)) != 0)
goto nolabel;
@@ -930,12 +930,12 @@
* get buf and read in sector 0
*/
lp = sc->dkdev.dk_label;
- bp = (void *)geteblk((int)lp->d_secsize);
+ bp = geteblk((int)lp->d_secsize);
bp->b_dev = FDMAKEDEV(major(dev), FDUNIT(dev), RAW_PART);
bp->b_blkno = 0;
bp->b_cylinder = 0;
bp->b_bcount = FDSECSIZE;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags |= B_READ;
fdstrategy(bp);
if ((error = biowait(bp)) != 0)
goto done;
@@ -946,7 +946,8 @@
bcopy(lp, dlp, sizeof(struct disklabel));
bp->b_blkno = 0;
bp->b_cylinder = 0;
- bp->b_flags = B_WRITE;
+ bp->b_flags &= ~(B_READ|B_DONE)
+ bp->b_flags |= B_WRITE;
fdstrategy(bp);
error = biowait(bp);
done:
diff -r ffae08317e16 -r 218897e1533b sys/arch/arc/arc/disksubr.c
--- a/sys/arch/arc/arc/disksubr.c Mon Nov 20 06:42:05 2000 +0000
+++ b/sys/arch/arc/arc/disksubr.c Mon Nov 20 08:24:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.10 2000/05/16 05:45:44 thorpej Exp $ */
+/* $NetBSD: disksubr.c,v 1.11 2000/11/20 08:24:10 chs Exp $ */
/* $OpenBSD: disksubr.c,v 1.14 1997/05/08 00:14:29 deraadt Exp $ */
/* NetBSD: disksubr.c,v 1.40 1999/05/06 15:45:51 christos Exp */
@@ -199,7 +199,7 @@
/* read master boot record */
bp->b_blkno = MBR_BBSECTOR;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags |= B_READ;
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
(*strat)(bp);
@@ -272,7 +272,8 @@
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
@@ -321,7 +322,8 @@
i = 0;
do {
/* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
if (lp->d_secsize > DEV_BSIZE)
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
@@ -350,7 +352,6 @@
}
done:
- bp->b_flags |= B_INVAL;
brelse(bp);
return (msg);
}
@@ -441,7 +442,7 @@
/* read master boot record */
bp->b_blkno = MBR_BBSECTOR;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags |= B_READ;
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
(*strat)(bp);
@@ -480,7 +481,8 @@
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
@@ -492,7 +494,8 @@
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {
*dlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
+ bp->b_flags &= ~(B_READ|B_DONE);
+ bp->b_flags |= B_WRITE;
(*strat)(bp);
error = biowait(bp);
goto done;
@@ -501,7 +504,6 @@
error = ESRCH;
done:
- bp->b_flags |= B_INVAL;
brelse(bp);
return (error);
}
diff -r ffae08317e16 -r 218897e1533b sys/arch/arm26/arm26/disksubr.c
--- a/sys/arch/arm26/arm26/disksubr.c Mon Nov 20 06:42:05 2000 +0000
+++ b/sys/arch/arm26/arm26/disksubr.c Mon Nov 20 08:24:08 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.2 2000/05/16 05:45:45 thorpej Exp $ */
+/* $NetBSD: disksubr.c,v 1.3 2000/11/20 08:24:11 chs Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
@@ -164,7 +164,7 @@
bp->b_blkno = netbsdpartoff + LABELSECTOR;
bp->b_cylinder = bp->b_blkno / lp->d_secpercyl;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags |= B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
@@ -200,7 +200,8 @@
i = 0;
do {
/* read a bad sector table */
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
if (lp->d_secsize > DEV_BSIZE)
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
@@ -229,7 +230,6 @@
}
done:
- bp->b_flags = B_INVAL | B_AGE | B_READ;
brelse(bp);
return (msg);
}
@@ -352,7 +352,8 @@
bp->b_blkno = netbsdpartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
- bp->b_flags = B_BUSY | B_READ;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
@@ -365,7 +366,8 @@
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {
*dlp = *lp;
- bp->b_flags = B_BUSY | B_WRITE;
+ bp->b_flags &= ~(B_READ|B_DONE);
+ bp->b_flags |= B_WRITE;
(*strat)(bp);
error = biowait(bp);
goto done;
@@ -375,7 +377,6 @@
error = ESRCH;
done:
- bp->b_flags |= B_INVAL;
brelse(bp);
return (error);
}
Home |
Main Index |
Thread Index |
Old Index