diff options
| author | ad <ad@NetBSD.org> | 2007-07-29 12:15:35 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-07-29 12:15:35 +0000 |
| commit | 66fefd117bcf82d547bfa88ca68a5b43f17a7103 (patch) | |
| tree | 6344a9f4cbb126386fe0895fb71a9fab75c81aa6 /sys/arch/atari/dev | |
| parent | 480f8d26c5a97f0c8620ae2e36349bfc462ca19c (diff) | |
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
Diffstat (limited to 'sys/arch/atari/dev')
| -rw-r--r-- | sys/arch/atari/dev/fd.c | 13 | ||||
| -rw-r--r-- | sys/arch/atari/dev/hdfd.c | 14 | ||||
| -rw-r--r-- | sys/arch/atari/dev/md_root.c | 10 |
3 files changed, 15 insertions, 22 deletions
diff --git a/sys/arch/atari/dev/fd.c b/sys/arch/atari/dev/fd.c index 62a93fdd633..f3b1a88191c 100644 --- a/sys/arch/atari/dev/fd.c +++ b/sys/arch/atari/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.57 2007/07/09 20:52:07 ad Exp $ */ +/* $NetBSD: fd.c,v 1.58 2007/07/29 12:15:36 ad Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -49,7 +49,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.57 2007/07/09 20:52:07 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.58 2007/07/29 12:15:36 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -603,11 +603,11 @@ struct buf *bp; lp = sc->dkdev.dk_label; if ((sc->flags & FLPF_HAVELAB) == 0) { bp->b_error = EIO; - goto bad; + goto done; } if (bp->b_blkno < 0 || (bp->b_bcount % SECTOR_SIZE)) { bp->b_error = EINVAL; - goto bad; + goto done; } if (bp->b_bcount == 0) goto done; @@ -620,7 +620,7 @@ struct buf *bp; goto done; if (sz < 0) { /* Past EndOfDisk */ bp->b_error = EINVAL; - goto bad; + goto done; } /* Trucate it */ if (bp->b_flags & B_RAW) @@ -646,8 +646,6 @@ struct buf *bp; splx(sps); return; -bad: - bp->b_flags |= B_ERROR; done: bp->b_resid = bp->b_bcount; biodone(bp); @@ -1009,7 +1007,6 @@ struct fd_softc *sc; bp = BUFQ_PEEK(sc->bufq); bp->b_error = EIO; - bp->b_flags |= B_ERROR; fd_state = FLP_MON; break; diff --git a/sys/arch/atari/dev/hdfd.c b/sys/arch/atari/dev/hdfd.c index c62b6f4cdce..72063587a83 100644 --- a/sys/arch/atari/dev/hdfd.c +++ b/sys/arch/atari/dev/hdfd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hdfd.c,v 1.56 2007/07/09 20:52:07 ad Exp $ */ +/* $NetBSD: hdfd.c,v 1.57 2007/07/29 12:15:36 ad Exp $ */ /*- * Copyright (c) 1996 Leo Weppelman @@ -91,7 +91,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.56 2007/07/09 20:52:07 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.57 2007/07/29 12:15:36 ad Exp $"); #include "opt_ddb.h" @@ -614,7 +614,7 @@ fdstrategy(bp) ((bp->b_bcount % FDC_BSIZE) != 0 && (bp->b_flags & B_FORMAT) == 0)) { bp->b_error = EINVAL; - goto bad; + goto done; } /* If it's a null transfer, return immediately. */ @@ -632,7 +632,7 @@ fdstrategy(bp) if (sz < 0) { /* If past end of disk, return EINVAL. */ bp->b_error = EINVAL; - goto bad; + goto done; } /* Otherwise, truncate request. */ bp->b_bcount = sz << DEV_BSHIFT; @@ -665,8 +665,6 @@ fdstrategy(bp) splx(s); return; -bad: - bp->b_flags |= B_ERROR; done: /* Toss transfer; we're done early. */ bp->b_resid = bp->b_bcount; @@ -1324,7 +1322,6 @@ fdcretry(fdc) fdc->sc_status[4], fdc->sc_status[5]); } - bp->b_flags |= B_ERROR; bp->b_error = EIO; fdfinish(fd, bp); } @@ -1573,8 +1570,7 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; biodone(bp); - } - if(bp->b_flags & B_ERROR) { + } else if (bp->b_error != 0) { rv = bp->b_error; } free(bp, M_TEMP); diff --git a/sys/arch/atari/dev/md_root.c b/sys/arch/atari/dev/md_root.c index ae57ae9dfaf..b0a57b07936 100644 --- a/sys/arch/atari/dev/md_root.c +++ b/sys/arch/atari/dev/md_root.c @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.22 2007/03/06 14:15:13 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.23 2007/07/29 12:15:36 ad Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -232,6 +232,7 @@ struct read_info *rsp; bp->b_blkno = btodb(rsp->offset); bp->b_bcount = rsp->chunk; bp->b_data = rsp->bufp; + bp->b_error = 0; /* Initiate read */ (*rsp->strat)(bp); @@ -240,9 +241,8 @@ struct read_info *rsp; s = splbio(); while ((bp->b_flags & B_DONE) == 0) tsleep((void *) bp, PRIBIO + 1, "ramd_norm_read", 0); - if (bp->b_flags & B_ERROR) - error = (bp->b_error ? bp->b_error : EIO); splx(s); + error = bp->b_error; /* Dot counter */ printf("."); @@ -315,6 +315,7 @@ int nbyte; bp->b_blkno = btodb(rsp->offset); bp->b_bcount = min(rsp->chunk, nbyte); bp->b_data = buf; + bp->b_error = 0; /* Initiate read */ (*rsp->strat)(bp); @@ -323,8 +324,7 @@ int nbyte; s = splbio(); while ((bp->b_flags & B_DONE) == 0) tsleep((void *) bp, PRIBIO + 1, "ramd_norm_read", 0); - if (bp->b_flags & B_ERROR) - error = (bp->b_error ? bp->b_error : EIO); + error = bp->b_error; splx(s); /* Dot counter */ |
