patch-2.1.64 linux/drivers/scsi/st.c
Next file: linux/drivers/scsi/st.h
Previous file: linux/drivers/scsi/seagate.c
Back to the patch index
Back to the overall index
- Lines: 144
- Date:
Thu Nov 13 07:23:32 1997
- Orig file:
v2.1.63/linux/drivers/scsi/st.c
- Orig date:
Sat Oct 25 02:44:17 1997
diff -u --recursive --new-file v2.1.63/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
@@ -11,7 +11,7 @@
Copyright 1992 - 1997 Kai Makisara
email Kai.Makisara@metla.fi
- Last modified: Tue May 27 22:29:00 1997 by makisara@home
+ Last modified: Wed Nov 5 23:39:52 1997 by makisara@home
Some small formal changes - aeb, 950809
*/
@@ -230,18 +230,9 @@
}
else
(STp->buffer)->last_result = SCpnt->result;
-#if 0
- if ((STp->buffer)->writing) {
- /* Process errors before releasing request */
- (STp->buffer)->last_result_fatal = st_chk_result(SCpnt);
- SCpnt->request.rq_status = RQ_INACTIVE;
- }
- else
- SCpnt->request.rq_status = RQ_SCSI_DONE;
-#else
+
SCpnt->request.rq_status = RQ_SCSI_DONE;
(STp->buffer)->last_SCpnt = SCpnt;
-#endif
#if DEBUG
STp->write_pending = 0;
@@ -645,8 +636,10 @@
}
if ((STp->buffer)->last_result_fatal != 0) {
- if ((SCpnt->sense_buffer[0] & 0x70) == 0x70 &&
- (SCpnt->sense_buffer[2] & 0x0f) == NO_TAPE) {
+ if ((STp->device)->scsi_level >= SCSI_2 &&
+ (SCpnt->sense_buffer[0] & 0x70) == 0x70 &&
+ (SCpnt->sense_buffer[2] & 0x0f) == NOT_READY &&
+ SCpnt->sense_buffer[12] == 0x3a) { /* Check ASC */
STp->ready = ST_NO_TAPE;
} else
STp->ready = ST_NOT_READY;
@@ -872,8 +865,6 @@
if (!SCpnt)
goto out;
- SCpnt->request.rq_status = RQ_INACTIVE; /* Mark as not busy */
-
if ((STp->buffer)->last_result_fatal != 0 &&
((SCpnt->sense_buffer[0] & 0x70) != 0x70 ||
(SCpnt->sense_buffer[2] & 0x4f) != 0x40 ||
@@ -882,11 +873,13 @@
SCpnt->sense_buffer[5] |
SCpnt->sense_buffer[6]) == 0))) {
/* Filter out successful write at EOM */
+ SCpnt->request.rq_status = RQ_INACTIVE; /* Mark as not busy */
printk(KERN_ERR "st%d: Error on write filemark.\n", dev);
if (result == 0)
result = (-EIO);
}
else {
+ SCpnt->request.rq_status = RQ_INACTIVE; /* Mark as not busy */
if (STps->drv_file >= 0)
STps->drv_file++ ;
STps->drv_block = 0;
@@ -977,8 +970,12 @@
}
STp = &(scsi_tapes[dev]);
- if (STp->ready != ST_READY)
- return (-EIO);
+ if (STp->ready != ST_READY) {
+ if (STp->ready == ST_NO_TAPE)
+ return (-ENOMEDIUM);
+ else
+ return (-EIO);
+ }
STm = &(STp->modes[STp->current_mode]);
if (!STm->defined)
return (-ENXIO);
@@ -1349,7 +1346,7 @@
}
else {
SCpnt->request.rq_status = RQ_INACTIVE; /* Mark as not busy */
- SCpnt = NULL;
+ SCpnt = *aSCpnt = NULL;
if (transfer == blks) { /* We did not get anything, error */
printk(KERN_NOTICE "st%d: Incorrect block size.\n", dev);
if (STps->drv_block >= 0)
@@ -1465,8 +1462,12 @@
}
STp = &(scsi_tapes[dev]);
- if (STp->ready != ST_READY)
- return (-EIO);
+ if (STp->ready != ST_READY) {
+ if (STp->ready == ST_NO_TAPE)
+ return (-ENOMEDIUM);
+ else
+ return (-EIO);
+ }
STm = &(STp->modes[STp->current_mode]);
if (!STm->defined)
return (-ENXIO);
@@ -1544,7 +1545,7 @@
if ((STp->buffer)->buffer_bytes > 0) {
#if DEBUG
if (debugging && STps->eof != ST_NOEOF)
- printk(ST_DEB_MSG "st%d: EOF up (%d). Left %d, needed %ld.\n", dev,
+ printk(ST_DEB_MSG "st%d: EOF up (%d). Left %d, needed %d.\n", dev,
STps->eof, (STp->buffer)->buffer_bytes, count - total);
#endif
transfer = (STp->buffer)->buffer_bytes < count - total ?
@@ -1886,8 +1887,12 @@
int dev = TAPE_NR(inode->i_rdev);
STp = &(scsi_tapes[dev]);
- if (STp->ready != ST_READY && cmd_in != MTLOAD)
- return (-EIO);
+ if (STp->ready != ST_READY && cmd_in != MTLOAD) {
+ if (STp->ready == ST_NO_TAPE)
+ return (-ENOMEDIUM);
+ else
+ return (-EIO);
+ }
timeout = STp->long_timeout;
STps = &(STp->ps[STp->partition]);
fileno = STps->drv_file;
@@ -2523,6 +2528,7 @@
if (!SCpnt)
return (-EBUSY);
+ SCpnt->request.rq_status = RQ_INACTIVE; /* Mark as not busy */
STps->drv_block = STps->drv_file = (-1);
STps->eof = ST_NOEOF;
if ((STp->buffer)->last_result_fatal != 0) {
@@ -2548,7 +2554,6 @@
STps->drv_block = STps->drv_file = 0;
result = 0;
}
- SCpnt->request.rq_status = RQ_INACTIVE; /* Mark as not busy */
return result;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov