summaryrefslogtreecommitdiff
path: root/sys/arch/vax
diff options
context:
space:
mode:
authorMatthew Dempsky <matthew@cvs.openbsd.org>2011-07-06 04:49:37 +0000
committerMatthew Dempsky <matthew@cvs.openbsd.org>2011-07-06 04:49:37 +0000
commit51c6c9b181971ccd9a6d6f7f9dd1fa5dc8df1c23 (patch)
tree9e6859366146d5377f6e62a5adfeca45f358d3ad /sys/arch/vax
parent9f81aca0122f901a2f924a0d3d759a2d37d682de (diff)
Eliminate redundant buf validation checks in xxstrategy() methods now
that they're implemented consistently in bounds_check_with_label(). Also, per krw's request, change bounds_check_with_label() to return 0 if the checks succeed, and change the drivers to test == -1 instead of <= 0. (Man page update to follow; intentionally omitting arch/vax/mba/hp.c from this commit because it doesn't even build currently and miod@ promises to kill it soon.) ok krw@
Diffstat (limited to 'sys/arch/vax')
-rw-r--r--sys/arch/vax/mscp/mscp_disk.c20
-rw-r--r--sys/arch/vax/vsa/hdc9224.c11
2 files changed, 13 insertions, 18 deletions
diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c
index b4cb3da23f3..c9bc08d52fa 100644
--- a/sys/arch/vax/mscp/mscp_disk.c
+++ b/sys/arch/vax/mscp/mscp_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mscp_disk.c,v 1.36 2011/07/05 21:39:08 krw Exp $ */
+/* $OpenBSD: mscp_disk.c,v 1.37 2011/07/06 04:49:36 matthew Exp $ */
/* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -286,8 +286,7 @@ rastrategy(bp)
unit = DISKUNIT(bp->b_dev);
if (unit >= ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) {
bp->b_error = ENXIO;
- bp->b_flags |= B_ERROR;
- goto done;
+ goto bad;
}
/*
* If drive is open `raw' or reading label, let it at it.
@@ -303,16 +302,12 @@ rastrategy(bp)
/* If disk is not online, try to put it online */
if (ra->ra_state == DK_CLOSED)
if (ra_putonline(ra) == MSCP_FAILED) {
- bp->b_flags |= B_ERROR;
bp->b_error = EIO;
- goto done;
+ goto bad;
}
- /*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition.
- */
- if (bounds_check_with_label(bp, ra->ra_disk.dk_label) <= 0)
+ /* Validate the request. */
+ if (bounds_check_with_label(bp, ra->ra_disk.dk_label) == -1)
goto done;
/* Make some statistics... /bqt */
@@ -322,7 +317,10 @@ rastrategy(bp)
mscp_strategy(bp, ra->ra_dev.dv_parent);
return;
-done:
+ bad:
+ bp->b_flags |= B_ERROR;
+ bp->b_resid = bp->b_bcount;
+ done:
s = splbio();
biodone(bp);
splx(s);
diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c
index bf95d76b523..6f8921f4666 100644
--- a/sys/arch/vax/vsa/hdc9224.c
+++ b/sys/arch/vax/vsa/hdc9224.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdc9224.c,v 1.36 2011/06/05 18:40:33 matthew Exp $ */
+/* $OpenBSD: hdc9224.c,v 1.37 2011/07/06 04:49:36 matthew Exp $ */
/* $NetBSD: hdc9224.c,v 1.16 2001/07/26 15:05:09 wiz Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -440,22 +440,19 @@ hdstrategy(struct buf *bp)
{
struct hdsoftc *hd;
struct hdcsoftc *sc;
- struct disklabel *lp;
int unit, s;
unit = DISKUNIT(bp->b_dev);
if (unit > hd_cd.cd_ndevs || (hd = hd_cd.cd_devs[unit]) == NULL) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
+ bp->b_resid = bp->b_bcount;
goto done;
}
sc = (void *)hd->sc_dev.dv_parent;
- lp = hd->sc_disk.dk_label;
- if ((bounds_check_with_label(bp, hd->sc_disk.dk_label)) <= 0)
- goto done;
-
- if (bp->b_bcount == 0)
+ /* Validate the request. */
+ if (bounds_check_with_label(bp, hd->sc_disk.dk_label) == -1)
goto done;
s = splbio();