patch-2.3.35 linux/drivers/scsi/st.c

Next file: linux/drivers/scsi/sym53c8xx.c
Previous file: linux/drivers/scsi/sg.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.34/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
@@ -11,7 +11,7 @@
    Copyright 1992 - 1999 Kai Makisara
    email Kai.Makisara@metla.fi
 
-   Last modified: Tue Oct 19 21:39:15 1999 by makisara@kai.makisara.local
+   Last modified: Thu Dec 16 23:08:29 1999 by makisara@kai.makisara.local
    Some small formal changes - aeb, 950809
  */
 
@@ -147,10 +147,16 @@
 static void st_detach(Scsi_Device *);
 
 struct Scsi_Device_Template st_template =
-{NULL, "tape", "st", NULL, TYPE_TAPE,
- SCSI_TAPE_MAJOR, 0, 0, 0, 0,
- st_detect, st_init,
- NULL, st_attach, st_detach};
+{
+	name:"tape", 
+	tag:"st", 
+	scsi_type:TYPE_TAPE,
+	major:SCSI_TAPE_MAJOR, 
+	detect:st_detect, 
+	init:st_init,
+	attach:st_attach, 
+	detach:st_detach
+};
 
 static int st_compression(Scsi_Tape *, int);
 
@@ -289,10 +295,14 @@
 	unsigned char *bp;
 
 	if (SCpnt == NULL)
-		SCpnt = scsi_allocate_device(STp->device, 1, FALSE);
+		SCpnt = scsi_allocate_device(STp->device, 1, TRUE);
 		if (SCpnt == NULL) {
-			printk(KERN_ERR "st%d: Can't get SCSI request.\n",
-                               TAPE_NR(STp->devt));
+			DEBC( printk(KERN_ERR "st%d: Can't get SCSI request.\n",
+				     TAPE_NR(STp->devt)); );
+			if (signal_pending(current))
+				(STp->buffer)->last_result_fatal = (-EINTR);
+			else
+				(STp->buffer)->last_result_fatal = (-EBUSY);
 			return NULL;
 		}
 
@@ -386,7 +396,7 @@
 
 	SCpnt = st_do_scsi(NULL, STp, cmd, 0, STp->timeout, MAX_RETRIES, TRUE);
 	if (!SCpnt)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
 
 	scsi_release_command(SCpnt);
 	SCpnt = NULL;
@@ -444,7 +454,7 @@
 		SCpnt = st_do_scsi(NULL, STp, cmd, transfer, STp->timeout,
                                    MAX_WRITE_RETRIES, TRUE);
 		if (!SCpnt)
-			return (-EBUSY);
+			return (STp->buffer)->last_result_fatal;
 
 		STps = &(STp->ps[STp->partition]);
 		if ((STp->buffer)->last_result_fatal != 0) {
@@ -656,7 +666,7 @@
 			__MOD_DEC_USE_COUNT(scsi_tapes[dev].device->host->hostt->module);
 		if (st_template.module)
 			__MOD_DEC_USE_COUNT(st_template.module);
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
 	}
 
 	if ((SCpnt->sense_buffer[0] & 0x70) == 0x70 &&
@@ -905,8 +915,10 @@
 
 			SCpnt = st_do_scsi(NULL, STp, cmd, 0, STp->timeout,
                                            MAX_WRITE_RETRIES, TRUE);
-			if (!SCpnt)
+			if (!SCpnt) {
+				result = (STp->buffer)->last_result_fatal;
 				goto out;
+			}
 
 			if ((STp->buffer)->last_result_fatal != 0 &&
 			    ((SCpnt->sense_buffer[0] & 0x70) != 0x70 ||
@@ -1184,7 +1196,7 @@
 		SCpnt = st_do_scsi(SCpnt, STp, cmd, transfer, STp->timeout,
 				   MAX_WRITE_RETRIES, TRUE);
 		if (!SCpnt)
-			return (-EBUSY);
+			return (STp->buffer)->last_result_fatal;
 
 		if ((STp->buffer)->last_result_fatal != 0) {
                         DEBC(printk(ST_DEB_MSG "st%d: Error on write:\n", dev));
@@ -1300,7 +1312,8 @@
 		SCpnt = st_do_scsi(SCpnt, STp, cmd, (STp->buffer)->writing, STp->timeout,
 				   MAX_WRITE_RETRIES, FALSE);
 		if (SCpnt == NULL)
-			return (-EIO);
+			return (STp->buffer)->last_result_fatal;
+
 	} else if (SCpnt != NULL) {
 		scsi_release_command(SCpnt);
 		SCpnt = NULL;
@@ -1360,7 +1373,7 @@
 	SCpnt = st_do_scsi(SCpnt, STp, cmd, bytes, STp->timeout, MAX_RETRIES, TRUE);
 	*aSCpnt = SCpnt;
 	if (!SCpnt)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
 
 	(STp->buffer)->read_pointer = 0;
 	STps->at_sm = 0;
@@ -1838,7 +1851,8 @@
 
 	SCpnt = st_do_scsi(SCpnt, STp, cmd, cmd[4], STp->timeout, 0, TRUE);
 	if (SCpnt == NULL)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
+
 	dev = TAPE_NR(SCpnt->request.rq_dev);
 
 	if ((STp->buffer)->last_result_fatal != 0) {
@@ -2210,7 +2224,7 @@
 
 	SCpnt = st_do_scsi(NULL, STp, cmd, datalen, timeout, MAX_RETRIES, TRUE);
 	if (!SCpnt)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
 
 	ioctl_result = (STp->buffer)->last_result_fatal;
 
@@ -2372,7 +2386,7 @@
 	}
 	SCpnt = st_do_scsi(NULL, STp, scmd, 20, STp->timeout, MAX_READY_RETRIES, TRUE);
 	if (!SCpnt)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
 
 	if ((STp->buffer)->last_result_fatal != 0 ||
 	    (STp->device->scsi_level >= SCSI_2 &&
@@ -2478,7 +2492,7 @@
 
 	SCpnt = st_do_scsi(NULL, STp, scmd, 20, timeout, MAX_READY_RETRIES, TRUE);
 	if (!SCpnt)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
 
 	STps->drv_block = STps->drv_file = (-1);
 	STps->eof = ST_NOEOF;
@@ -2569,7 +2583,8 @@
 
 	SCpnt = st_do_scsi(SCpnt, STp, cmd, 200, STp->timeout, MAX_READY_RETRIES, TRUE);
 	if (SCpnt == NULL)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
+
 	scsi_release_command(SCpnt);
 	SCpnt = NULL;
 
@@ -2633,7 +2648,8 @@
 	SCpnt = st_do_scsi(SCpnt, STp, cmd, cmd[4], STp->long_timeout,
 			   MAX_READY_RETRIES, TRUE);
 	if (SCpnt == NULL)
-		return (-EBUSY);
+		return (STp->buffer)->last_result_fatal;
+
 	scsi_release_command(SCpnt);
 	SCpnt = NULL;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)