Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi If scsipi_command() fails, always print out t...
details: https://anonhg.NetBSD.org/src/rev/9bb8ad33225b
branches: trunk
changeset: 471607:9bb8ad33225b
user: mycroft <mycroft%NetBSD.org@localhost>
date: Mon Apr 05 19:19:34 1999 +0000
description:
If scsipi_command() fails, always print out the error code.
diffstat:
sys/dev/scsipi/cd.c | 15 +++++++++------
sys/dev/scsipi/ss_mustek.c | 17 ++++++++++++-----
sys/dev/scsipi/ss_scanjet.c | 39 ++++++++++++++++++++++-----------------
sys/dev/scsipi/st.c | 13 ++++++++-----
4 files changed, 51 insertions(+), 33 deletions(-)
diffs (246 lines):
diff -r e4798a73d9d3 -r 9bb8ad33225b sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c Mon Apr 05 18:52:28 1999 +0000
+++ b/sys/dev/scsipi/cd.c Mon Apr 05 19:19:34 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.124 1999/02/28 17:14:57 explorer Exp $ */
+/* $NetBSD: cd.c,v 1.125 1999/04/05 19:19:34 mycroft Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -508,7 +508,7 @@
struct scsi_rw cmd_small;
#endif
struct scsipi_generic *cmdp;
- int blkno, nblks, cmdlen;
+ int blkno, nblks, cmdlen, error;
struct partition *p;
SC_DEBUG(sc_link, SDEV_DB2, ("cdstart "));
@@ -600,11 +600,14 @@
* Call the routine that chats with the adapter.
* Note: we cannot sleep as we may be an interrupt
*/
- if (scsipi_command(sc_link, cmdp, cmdlen, (u_char *)bp->b_data,
- bp->b_bcount, CDRETRIES, 30000, bp, SCSI_NOSLEEP |
- ((bp->b_flags & B_READ) ? SCSI_DATA_IN : SCSI_DATA_OUT))) {
+ error = scsipi_command(sc_link, cmdp, cmdlen,
+ (u_char *)bp->b_data, bp->b_bcount,
+ CDRETRIES, 30000, bp, SCSI_NOSLEEP |
+ ((bp->b_flags & B_READ) ? SCSI_DATA_IN : SCSI_DATA_OUT));
+ if (error) {
disk_unbusy(&cd->sc_dk, 0);
- printf("%s: not queued", cd->sc_dev.dv_xname);
+ printf("%s: not queued, error %d\n",
+ cd->sc_dev.dv_xname, error);
}
}
}
diff -r e4798a73d9d3 -r 9bb8ad33225b sys/dev/scsipi/ss_mustek.c
--- a/sys/dev/scsipi/ss_mustek.c Mon Apr 05 18:52:28 1999 +0000
+++ b/sys/dev/scsipi/ss_mustek.c Mon Apr 05 19:19:34 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ss_mustek.c,v 1.9 1997/10/18 19:51:10 thorpej Exp $ */
+/* $NetBSD: ss_mustek.c,v 1.10 1999/04/05 19:19:34 mycroft Exp $ */
/*
* Copyright (c) 1995 Joachim Koenig-Baltes. All rights reserved.
@@ -471,6 +471,7 @@
struct mustek_read_cmd cmd;
struct scsipi_link *sc_link = ss->sc_link;
u_long lines_to_read;
+ int error;
SC_DEBUG(sc_link, SDEV_DB1, ("mustek_read: start\n"));
@@ -487,14 +488,20 @@
/*
* go ask the adapter to do all this for us
*/
- if (scsipi_command(sc_link,
+ error = scsipi_command(sc_link,
(struct scsipi_generic *) &cmd, sizeof(cmd),
(u_char *) bp->b_data, bp->b_bcount, MUSTEK_RETRIES, 10000, bp,
- SCSI_NOSLEEP | SCSI_DATA_IN) != SUCCESSFULLY_QUEUED)
- printf("%s: not queued\n", ss->sc_dev.dv_xname);
- else {
+ SCSI_NOSLEEP | SCSI_DATA_IN);
+ if (error) {
+ printf("%s: not queued, error %d\n", ss->sc_dev.dv_xname,
+ error);
+ } else {
ss->sio.scan_lines -= lines_to_read;
+ if (ss->sio.scan_lines < 0)
+ ss->sio.scan_lines = 0;
ss->sio.scan_window_size -= bp->b_bcount;
+ if (ss->sio.scan_window_size < 0)
+ ss->sio.scan_window_size = 0;
}
return (0);
diff -r e4798a73d9d3 -r 9bb8ad33225b sys/dev/scsipi/ss_scanjet.c
--- a/sys/dev/scsipi/ss_scanjet.c Mon Apr 05 18:52:28 1999 +0000
+++ b/sys/dev/scsipi/ss_scanjet.c Mon Apr 05 19:19:34 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ss_scanjet.c,v 1.16 1998/04/22 19:44:19 pk Exp $ */
+/* $NetBSD: ss_scanjet.c,v 1.17 1999/04/05 19:19:34 mycroft Exp $ */
/*
* Copyright (c) 1995 Kenneth Stailey. All rights reserved.
@@ -61,8 +61,8 @@
int scanjet_read __P((struct ss_softc *, struct buf *));
/* only used internally */
-int scanjet_ctl_write __P((struct ss_softc *, char *, u_int, int));
-int scanjet_ctl_read __P((struct ss_softc *, char *, u_int, int));
+int scanjet_ctl_write __P((struct ss_softc *, char *, u_int));
+int scanjet_ctl_read __P((struct ss_softc *, char *, u_int));
int scanjet_set_window __P((struct ss_softc *));
int scanjet_compute_sizes __P((struct ss_softc *));
/* Maybe move to libkern? */
@@ -252,7 +252,7 @@
/* send "trigger" operation */
strcpy(escape_codes, "\033*f0S");
- error = scanjet_ctl_write(ss, escape_codes, strlen(escape_codes), 0);
+ error = scanjet_ctl_write(ss, escape_codes, strlen(escape_codes));
if (error) {
uprintf("%s: trigger_scanner failed\n", ss->sc_dev.dv_xname);
return (error);
@@ -268,6 +268,7 @@
{
struct scsi_rw_scanner cmd;
struct scsipi_link *sc_link = ss->sc_link;
+ int error;
/*
* Fill out the scsi command
@@ -284,12 +285,14 @@
/*
* go ask the adapter to do all this for us
*/
- if (scsipi_command(sc_link,
+ error = scsipi_command(sc_link,
(struct scsipi_generic *) &cmd, sizeof(cmd),
(u_char *) bp->b_data, bp->b_bcount, SCANJET_RETRIES, 100000, bp,
- SCSI_NOSLEEP | SCSI_DATA_IN) != SUCCESSFULLY_QUEUED)
- printf("%s: not queued\n", ss->sc_dev.dv_xname);
- else {
+ SCSI_NOSLEEP | SCSI_DATA_IN);
+ if (error) {
+ printf("%s: not queued, error %d\n", ss->sc_dev.dv_xname,
+ error);
+ } else {
ss->sio.scan_window_size -= bp->b_bcount;
if (ss->sio.scan_window_size < 0)
ss->sio.scan_window_size = 0;
@@ -303,14 +306,15 @@
* Do a synchronous write. Used to send control messages.
*/
int
-scanjet_ctl_write(ss, buf, size, flags)
+scanjet_ctl_write(ss, buf, size)
struct ss_softc *ss;
char *buf;
u_int size;
- int flags;
{
struct scsi_rw_scanner cmd;
+ int flags;
+ flags = 0;
if ((ss->flags & SSF_AUTOCONF) != 0)
flags |= SCSI_AUTOCONF;
@@ -328,14 +332,15 @@
* Do a synchronous read. Used to read responses to control messages.
*/
int
-scanjet_ctl_read(ss, buf, size, flags)
+scanjet_ctl_read(ss, buf, size)
struct ss_softc *ss;
char *buf;
u_int size;
- int flags;
{
struct scsi_rw_scanner cmd;
+ int flags;
+ flags = 0;
if ((ss->flags & SSF_AUTOCONF) != 0)
flags |= SCSI_AUTOCONF;
@@ -428,7 +433,7 @@
p += sprintf(p, "\033*a%dL", (int)(ss->sio.scan_brightness) - 128);
p += sprintf(p, "\033*a%dK", (int)(ss->sio.scan_contrast) - 128);
- return (scanjet_ctl_write(ss, escape_codes, p - escape_codes, 0));
+ return (scanjet_ctl_write(ss, escape_codes, p - escape_codes));
}
/* atoi() is from /sys/arch/amiga/dev/ite.c
@@ -476,12 +481,12 @@
strcpy(escape_codes, "\033*s1024E"); /* pixels wide */
break;
}
- error = scanjet_ctl_write(ss, escape_codes, strlen(escape_codes), 0);
+ error = scanjet_ctl_write(ss, escape_codes, strlen(escape_codes));
if (error) {
uprintf(wfail, ss->sc_dev.dv_xname);
return (error);
}
- error = scanjet_ctl_read(ss, response, 20, 0);
+ error = scanjet_ctl_read(ss, response, 20);
if (error) {
uprintf(rfail, ss->sc_dev.dv_xname);
return (error);
@@ -496,12 +501,12 @@
ss->sio.scan_pixels_per_line *= 8;
strcpy(escape_codes, "\033*s1026E"); /* pixels high */
- error = scanjet_ctl_write(ss, escape_codes, strlen(escape_codes), 0);
+ error = scanjet_ctl_write(ss, escape_codes, strlen(escape_codes));
if (error) {
uprintf(wfail, ss->sc_dev.dv_xname);
return (error);
}
- error = scanjet_ctl_read(ss, response, 20, 0);
+ error = scanjet_ctl_read(ss, response, 20);
if (error) {
uprintf(rfail, ss->sc_dev.dv_xname);
return (error);
diff -r e4798a73d9d3 -r 9bb8ad33225b sys/dev/scsipi/st.c
--- a/sys/dev/scsipi/st.c Mon Apr 05 18:52:28 1999 +0000
+++ b/sys/dev/scsipi/st.c Mon Apr 05 19:19:34 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: st.c,v 1.110 1999/02/28 17:14:57 explorer Exp $ */
+/* $NetBSD: st.c,v 1.111 1999/04/05 19:19:34 mycroft Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1069,7 +1069,7 @@
struct scsipi_link *sc_link = st->sc_link;
register struct buf *bp, *dp;
struct scsi_rw_tape cmd;
- int flags;
+ int flags, error;
SC_DEBUG(sc_link, SDEV_DB2, ("ststart "));
/*
@@ -1180,11 +1180,14 @@
/*
* go ask the adapter to do all this for us
*/
- if (scsipi_command(sc_link,
+ error = scsipi_command(sc_link,
(struct scsipi_generic *)&cmd, sizeof(cmd),
(u_char *)bp->b_data, bp->b_bcount,
- 0, ST_IO_TIME, bp, flags | SCSI_NOSLEEP))
- printf("%s: not queued\n", st->sc_dev.dv_xname);
+ 0, ST_IO_TIME, bp, flags | SCSI_NOSLEEP);
+ if (error) {
+ printf("%s: not queued, error %d\n",
+ st->sc_dev.dv_xname, error);
+ }
} /* go back and see if we can cram more work in.. */
}
Home |
Main Index |
Thread Index |
Old Index