summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-06-11 12:02:45 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-06-11 12:02:45 +0000
commit35c47ac69946b4f4f8b51f9723733f8f8a19518a (patch)
tree9792554c9b6d5168dc8cf5a245f4e72cf59cd4b7 /sys/scsi
parentbd69be7a587df5862cb59d681c1e6f082868569d (diff)
Restore an unusual XS_SENSE semantic that inadvertantly got lost
in the great re-write. If the scsi device *_interpret_sense() function returns 0 that means there was no error. Fixes restore(8) problems seen on certain tape drives. Found and fix tested by Percey Piper. Suggestions from Matthew Dempsky. Thanks! ok dlg@
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c12
-rw-r--r--sys/scsi/sd.c12
-rw-r--r--sys/scsi/ss.c12
-rw-r--r--sys/scsi/ss_mustek.c16
-rw-r--r--sys/scsi/ss_scanjet.c16
-rw-r--r--sys/scsi/st.c12
6 files changed, 62 insertions, 18 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 839f8964e48..649c6c12936 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.169 2010/06/03 11:58:20 dlg Exp $ */
+/* $OpenBSD: cd.c,v 1.170 2010/06/11 12:02:44 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -659,7 +659,7 @@ cd_buf_done(struct scsi_xfer *xs)
{
struct cd_softc *sc = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
- int s;
+ int error, s;
switch (xs->error) {
case XS_NOERROR:
@@ -679,7 +679,13 @@ cd_buf_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
- if (scsi_interpret_sense(xs) != ERESTART)
+ error = scsi_interpret_sense(xs);
+ if (error == 0) {
+ bp->b_error = 0;
+ bp->b_resid = xs->resid;
+ break;
+ }
+ if (error != ERESTART)
xs->retries = 0;
goto retry;
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 0c72b47ccbf..4bb4df1d0a7 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.192 2010/06/02 13:32:13 dlg Exp $ */
+/* $OpenBSD: sd.c,v 1.193 2010/06/11 12:02:44 krw Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -729,7 +729,7 @@ sd_buf_done(struct scsi_xfer *xs)
{
struct sd_softc *sc = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
- int s;
+ int error, s;
switch (xs->error) {
case XS_NOERROR:
@@ -749,7 +749,13 @@ sd_buf_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
- if (scsi_interpret_sense(xs) != ERESTART)
+ error = scsi_interpret_sense(xs);
+ if (error == 0) {
+ bp->b_error = 0;
+ bp->b_resid = xs->resid;
+ break;
+ }
+ if (error != ERESTART)
xs->retries = 0;
goto retry;
diff --git a/sys/scsi/ss.c b/sys/scsi/ss.c
index 5c58eebf4ef..2b3fcaa9752 100644
--- a/sys/scsi/ss.c
+++ b/sys/scsi/ss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss.c,v 1.72 2010/06/01 15:27:16 thib Exp $ */
+/* $OpenBSD: ss.c,v 1.73 2010/06/11 12:02:44 krw Exp $ */
/* $NetBSD: ss.c,v 1.10 1996/05/05 19:52:55 christos Exp $ */
/*
@@ -676,7 +676,7 @@ ssdone(struct scsi_xfer *xs)
{
struct ss_softc *ss = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
- int s;
+ int error, s;
switch (xs->error) {
case XS_NOERROR:
@@ -694,7 +694,13 @@ ssdone(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
- if (scsi_interpret_sense(xs) != ERESTART)
+ error = scsi_interpret_sense(xs);
+ if (error == 0) {
+ bp->b_error = 0;
+ bp->b_resid = xs->resid;
+ break;
+ }
+ if (error != ERESTART)
xs->retries = 0;
goto retry;
diff --git a/sys/scsi/ss_mustek.c b/sys/scsi/ss_mustek.c
index 4d0d199ad50..a8979d5e267 100644
--- a/sys/scsi/ss_mustek.c
+++ b/sys/scsi/ss_mustek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss_mustek.c,v 1.22 2010/06/01 15:27:16 thib Exp $ */
+/* $OpenBSD: ss_mustek.c,v 1.23 2010/06/11 12:02:44 krw Exp $ */
/* $NetBSD: ss_mustek.c,v 1.4 1996/05/05 19:52:57 christos Exp $ */
/*
@@ -472,7 +472,7 @@ mustek_read_done(struct scsi_xfer *xs)
{
struct ss_softc *ss = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
- int s;
+ int error, s;
switch (xs->error) {
case XS_NOERROR:
@@ -494,7 +494,17 @@ mustek_read_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
- if (scsi_interpret_sense(xs) != ERESTART)
+ error = scsi_interpret_sense(xs);
+ if (error == 0) {
+ ss->sio.scan_lines -= bp->b_bcount /
+ ((ss->sio.scan_pixels_per_line *
+ ss->sio.scan_bits_per_pixel) / 8);
+ ss->sio.scan_window_size -= bp->b_bcount;
+ bp->b_error = 0;
+ bp->b_resid = xs->resid;
+ break;
+ }
+ if (error != ERESTART)
xs->retries = 0;
goto retry;
diff --git a/sys/scsi/ss_scanjet.c b/sys/scsi/ss_scanjet.c
index 7d0cc5dcfaf..9c66d7d0b15 100644
--- a/sys/scsi/ss_scanjet.c
+++ b/sys/scsi/ss_scanjet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ss_scanjet.c,v 1.39 2010/06/01 15:27:16 thib Exp $ */
+/* $OpenBSD: ss_scanjet.c,v 1.40 2010/06/11 12:02:44 krw Exp $ */
/* $NetBSD: ss_scanjet.c,v 1.6 1996/05/18 22:58:01 christos Exp $ */
/*
@@ -309,7 +309,7 @@ scanjet_read_done(struct scsi_xfer *xs)
{
struct ss_softc *ss = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
- int s;
+ int error, s;
switch (xs->error) {
case XS_NOERROR:
@@ -332,7 +332,17 @@ scanjet_read_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
- if (scsi_interpret_sense(xs) != ERESTART)
+ error = scsi_interpret_sense(xs);
+ if (error == 0) {
+ if (bp->b_bcount >= ss->sio.scan_window_size)
+ ss->sio.scan_window_size = 0;
+ else
+ ss->sio.scan_window_size -= bp->b_bcount;
+ bp->b_error = 0;
+ bp->b_resid = xs->resid;
+ break;
+ }
+ if (error != ERESTART)
xs->retries = 0;
goto retry;
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 3522b64d4b5..203b5e24631 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: st.c,v 1.95 2010/06/01 15:27:16 thib Exp $ */
+/* $OpenBSD: st.c,v 1.96 2010/06/11 12:02:44 krw Exp $ */
/* $NetBSD: st.c,v 1.71 1997/02/21 23:03:49 thorpej Exp $ */
/*
@@ -1083,7 +1083,7 @@ st_buf_done(struct scsi_xfer *xs)
{
struct st_softc *st = xs->sc_link->device_softc;
struct buf *bp = xs->cookie;
- int s;
+ int error, s;
switch (xs->error) {
case XS_NOERROR:
@@ -1101,7 +1101,13 @@ st_buf_done(struct scsi_xfer *xs)
case XS_SENSE:
case XS_SHORTSENSE:
- if (scsi_interpret_sense(xs) != ERESTART)
+ error = scsi_interpret_sense(xs);
+ if (error == 0) {
+ bp->b_error = 0;
+ bp->b_resid = xs->resid;
+ break;
+ }
+ if (error != ERESTART)
xs->retries = 0;
goto retry;