diff -u --recursive --new-file v2.1.38/linux/CREDITS linux/CREDITS
--- v2.1.38/linux/CREDITS	Thu May 15 16:48:00 1997
+++ linux/CREDITS	Fri May 16 15:17:26 1997
@@ -733,8 +733,8 @@
 N: Alain L. Knaff
 E: Alain.Knaff@poboxes.com
 D: floppy driver
-S: 2a, rue de l'Acier
-S: L-4505 Differdange
+S: 19, rue Jean l'Aveugle
+S: L-1148 Luxembourg-City
 S: Luxembourg
 
 N: Gerd Knorr
diff -u --recursive --new-file v2.1.38/linux/Makefile linux/Makefile
--- v2.1.38/linux/Makefile	Thu May 15 16:48:01 1997
+++ linux/Makefile	Fri May 16 13:18:18 1997
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 1
-SUBLEVEL = 38
+SUBLEVEL = 39
 
 ARCH := $(shell uname -m | sed s/i.86/i386/)
 
diff -u --recursive --new-file v2.1.38/linux/arch/i386/kernel/irq.h linux/arch/i386/kernel/irq.h
--- v2.1.38/linux/arch/i386/kernel/irq.h	Tue May 13 22:41:01 1997
+++ linux/arch/i386/kernel/irq.h	Fri May 16 13:12:30 1997
@@ -62,32 +62,8 @@
 	"mov %dx,%ds\n\t" \
 	"mov %dx,%es\n\t"
 
-/*
- * These are used just for the "bad" interrupt handlers, 
- * which just clear the mask and return..
- */
-#define SAVE_MOST \
-	"cld\n\t" \
-	"push %es\n\t" \
-	"push %ds\n\t" \
-	"pushl %eax\n\t" \
-	"pushl %edx\n\t" \
-	"pushl %ecx\n\t" \
-	"movl $" STR(KERNEL_DS) ",%edx\n\t" \
-	"mov %dx,%ds\n\t" \
-	"mov %dx,%es\n\t"
-
-#define RESTORE_MOST \
-	"popl %ecx\n\t" \
-	"popl %edx\n\t" \
-	"popl %eax\n\t" \
-	"pop %ds\n\t" \
-	"pop %es\n\t" \
-	"iret"
-
 #define IRQ_NAME2(nr) nr##_interrupt(void)
 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
-#define BAD_IRQ_NAME(nr) IRQ_NAME2(bad_IRQ##nr)
 
 #define GET_CURRENT \
 	"movl %esp, %ebx\n\t" \
@@ -150,15 +126,14 @@
 		extern int _stext;
 		eip -= (unsigned long) &_stext;
 		eip >>= prof_shift;
-		if (eip < prof_len)
-			atomic_inc((atomic_t *)&prof_buffer[eip]);
-		else
 		/*
 		 * Dont ignore out-of-bounds EIP values silently,
 		 * put them into the last histogram slot, so if
 		 * present, they will show up as a sharp peak.
 		 */
-			atomic_inc((atomic_t *)&prof_buffer[prof_len-1]);
+		if (eip > prof_len-1)
+			eip = prof_len-1;
+		atomic_inc((atomic_t *)&prof_buffer[eip]);
 	}
 }
 
diff -u --recursive --new-file v2.1.38/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
--- v2.1.38/linux/drivers/char/tty_io.c	Tue May 13 22:41:07 1997
+++ linux/drivers/char/tty_io.c	Fri May 16 14:03:12 1997
@@ -838,7 +838,7 @@
 {
 	struct tty_struct *tty, *o_tty;
 	struct termios *tp, *o_tp, *ltp, *o_ltp;
-	struct task_struct **p;
+	struct task_struct *p;
 	int	idx;
 	
 	tty = (struct tty_struct *)filp->private_data;
@@ -972,14 +972,14 @@
 	 * Make sure there aren't any processes that still think this
 	 * tty is their controlling tty.
 	 */
-	for (p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
-		if (*p == 0)
-			continue;
-		if ((*p)->tty == tty)
-			(*p)->tty = NULL;
-		if (o_tty && (*p)->tty == o_tty)
-			(*p)->tty = NULL;
+	read_lock(&tasklist_lock);
+	for_each_task(p) {
+		if (p->tty == tty)
+			p->tty = NULL;
+		if (o_tty && p->tty == o_tty)
+			p->tty = NULL;
 	}
+	read_unlock(&tasklist_lock);
 
 	/*
 	 * Shutdown the current line discipline, and reset it to
@@ -1216,40 +1216,6 @@
 	return 0;
 }
 
-#if 0
-/*
- * XXX does anyone use this anymore?!?
- */
-static int do_get_ps_info(unsigned long arg)
-{
-	struct tstruct {
-		int flag;
-		int present[NR_TASKS];
-		struct task_struct tasks[NR_TASKS];
-	};
-	struct tstruct *ts = (struct tstruct *)arg;
-	struct task_struct **p;
-	char *c, *d;
-	int i, n = 0;
-	
-	i = verify_area(VERIFY_WRITE, (void *)arg, sizeof(struct tstruct));
-	if (i)
-		return i;
-	for (p = &FIRST_TASK ; p <= &LAST_TASK ; p++, n++)
-		if (*p)
-		{
-			c = (char *)(*p);
-			d = (char *)(ts->tasks+n);
-			for (i=0 ; i<sizeof(struct task_struct) ; i++)
-				put_user(*c++, d++);
-			put_user(1, ts->present+n);
-		}
-		else	
-			put_user(0, ts->present+n);
-	return(0);			
-}
-#endif
-
 static int tiocsti(struct tty_struct *tty, char * arg)
 {
 	char ch, mbz = 0;
@@ -1495,7 +1461,7 @@
 #ifdef TTY_SOFT_SAK
 	tty_hangup(tty);
 #else
-	struct task_struct **p;
+	struct task_struct *p;
 	int session;
 	int		i;
 	struct file	*filp;
@@ -1507,23 +1473,23 @@
 		tty->ldisc.flush_buffer(tty);
 	if (tty->driver.flush_buffer)
 		tty->driver.flush_buffer(tty);
- 	for (p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
-		if (!(*p))
-			continue;
-		if (((*p)->tty == tty) ||
-		    ((session > 0) && ((*p)->session == session)))
-			send_sig(SIGKILL, *p, 1);
-		else if ((*p)->files) {
+	read_lock(&tasklist_lock);
+	for_each_task(p) {
+		if ((p->tty == tty) ||
+		    ((session > 0) && (p->session == session)))
+			send_sig(SIGKILL, p, 1);
+		else if (p->files) {
 			for (i=0; i < NR_OPEN; i++) {
-				filp = (*p)->files->fd[i];
+				filp = p->files->fd[i];
 				if (filp && (filp->f_op == &tty_fops) &&
 				    (filp->private_data == tty)) {
-					send_sig(SIGKILL, *p, 1);
+					send_sig(SIGKILL, p, 1);
 					break;
 				}
 			}
 		}
 	}
+	read_unlock(&tasklist_lock);
 #endif
 }
 
diff -u --recursive --new-file v2.1.38/linux/drivers/scsi/eata.c linux/drivers/scsi/eata.c
--- v2.1.38/linux/drivers/scsi/eata.c	Thu Feb 27 10:57:31 1997
+++ linux/drivers/scsi/eata.c	Sat May 17 12:14:23 1997
@@ -1,6 +1,13 @@
 /*
  *      eata.c - Low-level driver for EATA/DMA SCSI host adapters.
  *
+ *      17 May 1997 rev. 3.10 for linux 2.0.30 and 2.1.38
+ *          Use of serial_number_at_timeout in abort and reset processing.
+ *          Use of the __initfunc and __initdata macro in setup code.
+ *          Minor cleanups in the list_statistics code.
+ *          Increased controller busy timeout in order to better support 
+ *          slow SCSI devices.
+ *
  *      24 Feb 1997 rev. 3.00 for linux 2.0.29 and 2.1.26
  *          When loading as a module, parameter passing is now supported
  *          both in 2.0 and in 2.1 style.
@@ -202,8 +209,7 @@
  *  lc:n  disables linked commands;
  *  tc:y  enables tagged commands;
  *  tc:n  disables tagged commands;
- *  tm:0  use head/simple/ordered queue tag sequences for reads and ordered
- *        queue tags for writes;
+ *  tm:0  use head/simple/ordered queue tag sequences;
  *  tm:1  use only simple queue tags;
  *  tm:2  use only head of queue tags;
  *  tm:3  use only ordered queue tags;
@@ -232,10 +238,12 @@
  *  between increasing or decreasing by minimizing the seek distance between
  *  the sector of the commands just completed and the sector of the first 
  *  command in the list to be sorted. 
- *  Trivial math assures that if there are (Q-1) outstanding request for
- *  random seeks over S sectors, the unsorted average seek distance is S/2,
- *  while the sorted average seek distance is S/(Q-1). The seek distance is
- *  hence divided by a factor (Q-1)/2.
+ *  Trivial math assures that the unsorted average seek distance when doing
+ *  random seeks over S sectors is S/3.
+ *  When (Q-1) requests are uniformly distributed over S sectors, the average
+ *  distance between two adjacent requests is S/((Q-1) + 1), so the sorted
+ *  average seek distance for (Q-1) random requests over S sectors is S/Q.
+ *  The elevator sorting hence divides the seek distance by a factor Q/3.
  *  The above pure geometric remarks are valid in all cases and the 
  *  driver effectively reduces the seek distance by the predicted factor
  *  when there are Q concurrent read i/o operations on the device, but this
@@ -286,10 +294,18 @@
 #include <asm/dma.h>
 #include <asm/irq.h>
 #include "eata.h"
-#include<linux/stat.h>
-#include<linux/config.h>
-#include<linux/bios32.h>
-#include<linux/pci.h>
+#include <linux/stat.h>
+#include <linux/config.h>
+#include <linux/bios32.h>
+#include <linux/pci.h>
+
+#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,36)
+#include <linux/init.h>
+#else
+#define __initfunc(A) A
+#define __initdata
+#define __init
+#endif
 
 struct proc_dir_entry proc_scsi_eata2x = {
     PROC_SCSI_EATA2X, 6, "eata2x",
@@ -517,7 +533,7 @@
 static const char *driver_name = "EATA";
 static unsigned int irqlist[MAX_IRQ], calls[MAX_IRQ];
 
-static unsigned int io_port[] = { 
+static unsigned int io_port[] __initdata = { 
 
    /* Space for MAX_INT_PARAM ports usable while loading as a module */
    SKIP,    SKIP,   SKIP,   SKIP,   SKIP,   SKIP,   SKIP,   SKIP,
@@ -638,8 +654,7 @@
    return;
 }
 
-static inline int wait_on_busy(unsigned int iobase) {
-   unsigned int loop = MAXLOOP;
+static inline int wait_on_busy(unsigned int iobase, unsigned int loop) {
 
    while (inb(iobase + REG_AUX_STATUS) & ABSY_ASSERTED)
       if (--loop == 0) return TRUE;
@@ -649,7 +664,7 @@
 
 static inline int do_dma(unsigned int iobase, unsigned int addr, unchar cmd) {
 
-   if (wait_on_busy(iobase)) return TRUE;
+   if (wait_on_busy(iobase, (addr ? MAXLOOP * 100 : MAXLOOP))) return TRUE;
 
    if ((addr = V2DEV(addr))) {
       outb((char) (addr >> 24), iobase + REG_LOW);
@@ -678,8 +693,8 @@
    return FALSE;
 }
 
-static inline int port_detect(unsigned int port_base, unsigned int j, 
-			      Scsi_Host_Template *tpnt) {
+__initfunc (static inline int port_detect \
+      (unsigned int port_base, unsigned int j, Scsi_Host_Template *tpnt)) {
    unsigned char irq, dma_channel, subversion, i;
    unsigned char protocol_rev;
    struct eata_info info;
@@ -882,7 +897,7 @@
          sh[j]->max_lun = info.max_lun + 1;
       }
 
-   if (dma_channel == NO_DMA) sprintf(dma_name, "%s", "NO DMA");
+   if (dma_channel == NO_DMA) sprintf(dma_name, "%s", "BMST");
    else                       sprintf(dma_name, "DMA %u", dma_channel);
 
    for (i = 0; i < sh[j]->can_queue; i++)
@@ -941,7 +956,7 @@
    return TRUE;
 }
 
-void eata2x_setup(char *str, int *ints) {
+__initfunc (void eata2x_setup(char *str, int *ints)) {
    int i, argc = ints[0];
    char *cur = str, *pc;
 
@@ -974,7 +989,7 @@
    return;
 }
 
-static void add_pci_ports(void) {
+__initfunc (static void add_pci_ports(void)) {
 
 #if defined(CONFIG_PCI)
 
@@ -1009,7 +1024,7 @@
    return;
 }
 
-int eata2x_detect(Scsi_Host_Template *tpnt) {
+__initfunc (int eata2x_detect(Scsi_Host_Template *tpnt)) {
    unsigned long flags;
    unsigned int j = 0, k;
 
@@ -1166,6 +1181,9 @@
 
    cpp->reqsen = TRUE;
    cpp->dispri = TRUE;
+#if 0
+   if (SCpnt->device->type == TYPE_TAPE) cpp->hbaci = TRUE;
+#endif
    cpp->one = TRUE;
    cpp->channel = SCpnt->channel;
    cpp->target = SCpnt->target;
@@ -1182,14 +1200,12 @@
       else if (tag_mode == TAG_SIMPLE)  cpp->mess[0] = SIMPLE_QUEUE_TAG;
       else if (tag_mode == TAG_HEAD)    cpp->mess[0] = HEAD_OF_QUEUE_TAG;
       else if (tag_mode == TAG_ORDERED) cpp->mess[0] = ORDERED_QUEUE_TAG;
-      else if ((SCpnt->device->current_tag % SCpnt->device->queue_depth) == 0)
+      else if (SCpnt->device->current_tag == 0)
          cpp->mess[0] = ORDERED_QUEUE_TAG;
-      else if ((SCpnt->device->current_tag % SCpnt->device->queue_depth) == 1)
+      else if (SCpnt->device->current_tag == 1)
          cpp->mess[0] = HEAD_OF_QUEUE_TAG;
-      else if (cpp->din)
-         cpp->mess[0] = SIMPLE_QUEUE_TAG;
       else
-         cpp->mess[0] = ORDERED_QUEUE_TAG;
+         cpp->mess[0] = SIMPLE_QUEUE_TAG;
 
       cpp->mess[1] = SCpnt->device->current_tag++;
       }
@@ -1208,7 +1224,7 @@
    if (linked_comm && SCpnt->device->queue_depth > 2
                                      && TLDEV(SCpnt->device->type)) {
       HD(j)->cp_stat[i] = READY;
-      flush_dev(SCpnt->device, 0, j, FALSE);
+      flush_dev(SCpnt->device, SCpnt->request.sector, j, FALSE);
       restore_flags(flags);
       return 0;
       }
@@ -1238,7 +1254,8 @@
    cli();
    j = ((struct hostdata *) SCarg->host->hostdata)->board_number;
 
-   if (SCarg->host_scribble == NULL) {
+   if (SCarg->host_scribble == NULL
+       || SCarg->serial_number != SCarg->serial_number_at_timeout) {
       printk("%s: abort, target %d.%d:%d, pid %ld inactive.\n",
 	     BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
       restore_flags(flags);
@@ -1252,7 +1269,7 @@
    if (i >= sh[j]->can_queue)
       panic("%s: abort, invalid SCarg->host_scribble.\n", BN(j));
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       printk("%s: abort, timeout error.\n", BN(j));
       restore_flags(flags);
       return SCSI_ABORT_ERROR;
@@ -1321,13 +1338,19 @@
    if (SCarg->host_scribble == NULL)
       printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid);
 
+   if (SCarg->serial_number != SCarg->serial_number_at_timeout) {
+      printk("%s: reset, pid %ld, reset not running.\n", BN(j), SCarg->pid);
+      restore_flags(flags);
+      return SCSI_RESET_NOT_RUNNING;
+      }
+
    if (HD(j)->in_reset) {
       printk("%s: reset, exit, already in reset.\n", BN(j));
       restore_flags(flags);
       return SCSI_RESET_ERROR;
       }
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       printk("%s: reset, exit, timeout error.\n", BN(j));
       restore_flags(flags);
       return SCSI_RESET_ERROR;
@@ -1480,7 +1503,7 @@
    unsigned int rev = FALSE, s = TRUE, r = TRUE;
    unsigned int input_only = TRUE, overlap = FALSE;
    unsigned long sl[n_ready], pl[n_ready], ll[n_ready];
-   unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0;
+   unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0, iseek = 0;
 
    static unsigned int flushcount = 0, batchcount = 0, sortcount = 0;
    static unsigned int readycount = 0, ovlcount = 0, inputcount = 0;
@@ -1491,8 +1514,8 @@
       printk("fc %d bc %d ic %d oc %d rc %d rs %d sc %d re %d"\
              " av %ldK as %ldK.\n", flushcount, batchcount, inputcount,
              ovlcount, readycount, readysorted, sortcount, revcount,
-             seeknosort / (readycount - batchcount + 1), 
-             seeksorted / (readycount - batchcount + 1));
+             seeknosort / (readycount + 1), 
+             seeksorted / (readycount + 1));
 
    if (n_ready <= 1) return;
 
@@ -1520,6 +1543,10 @@
 
       }
 
+   if (link_statistics) {
+      if (cursec > sl[0]) seek += cursec - sl[0]; else seek += sl[0] - cursec;
+      }
+
    if (cursec > ((maxsec + minsec) / 2)) rev = TRUE;
 
    if (!((rev && r) || (!rev && s))) sort(sl, il, n_ready, rev);
@@ -1537,10 +1564,11 @@
    if (overlap) sort(pl, il, n_ready, FALSE);
 
    if (link_statistics) {
+      if (cursec > sl[0]) iseek = cursec - sl[0]; else iseek = sl[0] - cursec;
       batchcount++; readycount += n_ready, seeknosort += seek / 1024; 
       if (input_only) inputcount++;
       if (overlap) { ovlcount++; seeksorted += seek / 1024; }
-      else seeksorted += (maxsec - minsec) / 1024;
+      else seeksorted += (iseek + maxsec - minsec) / 1024;
       if (rev && !r)     {  revcount++; readysorted += n_ready; }
       if (!rev && !s)    { sortcount++; readysorted += n_ready; }
       }
diff -u --recursive --new-file v2.1.38/linux/drivers/scsi/eata.h linux/drivers/scsi/eata.h
--- v2.1.38/linux/drivers/scsi/eata.h	Thu Feb 27 10:57:31 1997
+++ linux/drivers/scsi/eata.h	Sat May 17 12:14:23 1997
@@ -12,7 +12,7 @@
 int eata2x_abort(Scsi_Cmnd *);
 int eata2x_reset(Scsi_Cmnd *, unsigned int);
 
-#define EATA_VERSION "3.00.09"
+#define EATA_VERSION "3.10.00"
 
 
 #define EATA {                                                 \
diff -u --recursive --new-file v2.1.38/linux/drivers/scsi/u14-34f.c linux/drivers/scsi/u14-34f.c
--- v2.1.38/linux/drivers/scsi/u14-34f.c	Thu Feb 27 10:57:31 1997
+++ linux/drivers/scsi/u14-34f.c	Sat May 17 12:14:23 1997
@@ -1,6 +1,11 @@
 /*
  *      u14-34f.c - Low-level driver for UltraStor 14F/34F SCSI host adapters.
  *
+ *      17 May 1997 rev. 3.10 for linux 2.0.30 and 2.1.38
+ *          Use of serial_number_at_timeout in abort and reset processing.
+ *          Use of the __initfunc and __initdata macro in setup code.
+ *          Minor cleanups in the list_statistics code.
+ *
  *      24 Feb 1997 rev. 3.00 for linux 2.0.29 and 2.1.26
  *          When loading as a module, parameter passing is now supported
  *          both in 2.0 and in 2.1 style.
@@ -220,10 +225,12 @@
  *  between increasing or decreasing by minimizing the seek distance between
  *  the sector of the commands just completed and the sector of the first 
  *  command in the list to be sorted. 
- *  Trivial math assures that if there are (Q-1) outstanding request for
- *  random seeks over S sectors, the unsorted average seek distance is S/2,
- *  while the sorted average seek distance is S/(Q-1). The seek distance is
- *  hence divided by a factor (Q-1)/2.
+ *  Trivial math assures that the unsorted average seek distance when doing
+ *  random seeks over S sectors is S/3.
+ *  When (Q-1) requests are uniformly distributed over S sectors, the average
+ *  distance between two adjacent requests is S/((Q-1) + 1), so the sorted
+ *  average seek distance for (Q-1) random requests over S sectors is S/Q.
+ *  The elevator sorting hence divides the seek distance by a factor Q/3.
  *  The above pure geometric remarks are valid in all cases and the 
  *  driver effectively reduces the seek distance by the predicted factor
  *  when there are Q concurrent read i/o operations on the device, but this
@@ -273,8 +280,16 @@
 #include <asm/dma.h>
 #include <asm/irq.h>
 #include "u14-34f.h"
-#include<linux/stat.h>
-#include<linux/config.h>
+#include <linux/stat.h>
+#include <linux/config.h>
+
+#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,36)
+#include <linux/init.h>
+#else
+#define __initfunc(A) A
+#define __initdata
+#define __init
+#endif
 
 struct proc_dir_entry proc_scsi_u14_34f = {
     PROC_SCSI_U14_34F, 6, "u14_34f",
@@ -419,7 +434,7 @@
 static const char *driver_name = "Ux4F";
 static unsigned int irqlist[MAX_IRQ], calls[MAX_IRQ];
 
-static unsigned int io_port[] = { 
+static unsigned int io_port[] __initdata = { 
 
    /* Space for MAX_INT_PARAM ports usable while loading as a module */
    SKIP,    SKIP,   SKIP,   SKIP,   SKIP,   SKIP,   SKIP,   SKIP,
@@ -534,8 +549,7 @@
    return;
 }
 
-static inline int wait_on_busy(unsigned int iobase) {
-   unsigned int loop = MAXLOOP;
+static inline int wait_on_busy(unsigned int iobase, unsigned int loop) {
 
    while (inb(iobase + REG_LCL_INTR) & BSY_ASSERTED)
       if (--loop == 0) return TRUE;
@@ -556,7 +570,7 @@
    cpp->scsi_cdbs_len = 6;
    cpp->scsi_cdbs[0] = HA_CMD_INQUIRY;
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       printk("%s: board_inquiry, adapter busy.\n", BN(j));
       return TRUE;
       }
@@ -586,8 +600,8 @@
    return FALSE;
 }
 
-static inline int port_detect(unsigned int port_base, unsigned int j, 
-                              Scsi_Host_Template *tpnt) {
+__initfunc (static inline int port_detect \
+      (unsigned int port_base, unsigned int j, Scsi_Host_Template *tpnt)) {
    unsigned char irq, dma_channel, subversion, i;
    unsigned char in_byte;
    char *bus_type, dma_name[16];
@@ -748,7 +762,7 @@
 	 }
       }
 
-   if (dma_channel == NO_DMA) sprintf(dma_name, "%s", "NO DMA");
+   if (dma_channel == NO_DMA) sprintf(dma_name, "%s", "BMST");
    else                       sprintf(dma_name, "DMA %u", dma_channel);
 
    for (i = 0; i < sh[j]->can_queue; i++)
@@ -781,7 +795,7 @@
    return TRUE;
 }
 
-void u14_34f_setup(char *str, int *ints) {
+__initfunc (void u14_34f_setup(char *str, int *ints)) {
    int i, argc = ints[0];
    char *cur = str, *pc;
 
@@ -813,7 +827,7 @@
    return;
 }
 
-int u14_34f_detect(Scsi_Host_Template *tpnt) {
+__initfunc (int u14_34f_detect(Scsi_Host_Template *tpnt)) {
    unsigned long flags;
    unsigned int j = 0, k;
 
@@ -983,12 +997,12 @@
    if (linked_comm && SCpnt->device->queue_depth > 2
                                      && TLDEV(SCpnt->device->type)) {
       HD(j)->cp_stat[i] = READY;
-      flush_dev(SCpnt->device, 0, j, FALSE);
+      flush_dev(SCpnt->device, SCpnt->request.sector, j, FALSE);
       restore_flags(flags);
       return 0;
       }
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       SCpnt->result = DID_ERROR << 16;
       SCpnt->host_scribble = NULL;
       printk("%s: qcomm, target %d.%d:%d, pid %ld, adapter busy, DID_ERROR,"\
@@ -1018,7 +1032,8 @@
    cli();
    j = ((struct hostdata *) SCarg->host->hostdata)->board_number;
 
-   if (SCarg->host_scribble == NULL) {
+   if (SCarg->host_scribble == NULL
+       || SCarg->serial_number != SCarg->serial_number_at_timeout) {
       printk("%s: abort, target %d.%d:%d, pid %ld inactive.\n",
 	     BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
       restore_flags(flags);
@@ -1032,7 +1047,7 @@
    if (i >= sh[j]->can_queue)
       panic("%s: abort, invalid SCarg->host_scribble.\n", BN(j));
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       printk("%s: abort, timeout error.\n", BN(j));
       restore_flags(flags);
       return SCSI_ABORT_ERROR;
@@ -1101,13 +1116,19 @@
    if (SCarg->host_scribble == NULL)
       printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid);
 
+   if (SCarg->serial_number != SCarg->serial_number_at_timeout) {
+      printk("%s: reset, pid %ld, reset not running.\n", BN(j), SCarg->pid);
+      restore_flags(flags);
+      return SCSI_RESET_NOT_RUNNING;
+      }
+
    if (HD(j)->in_reset) {
       printk("%s: reset, exit, already in reset.\n", BN(j));
       restore_flags(flags);
       return SCSI_RESET_ERROR;
       }
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       printk("%s: reset, exit, timeout error.\n", BN(j));
       restore_flags(flags);
       return SCSI_RESET_ERROR;
@@ -1158,7 +1179,7 @@
       if (SCpnt == SCarg) arg_done = TRUE;
       }
 
-   if (wait_on_busy(sh[j]->io_port)) {
+   if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
       printk("%s: reset, cannot reset, timeout error.\n", BN(j));
       restore_flags(flags);
       return SCSI_RESET_ERROR;
@@ -1271,7 +1292,7 @@
    unsigned int rev = FALSE, s = TRUE, r = TRUE;
    unsigned int input_only = TRUE, overlap = FALSE;
    unsigned long sl[n_ready], pl[n_ready], ll[n_ready];
-   unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0;
+   unsigned long maxsec = 0, minsec = ULONG_MAX, seek = 0, iseek = 0;
 
    static unsigned int flushcount = 0, batchcount = 0, sortcount = 0;
    static unsigned int readycount = 0, ovlcount = 0, inputcount = 0;
@@ -1282,8 +1303,8 @@
       printk("fc %d bc %d ic %d oc %d rc %d rs %d sc %d re %d"\
              " av %ldK as %ldK.\n", flushcount, batchcount, inputcount,
              ovlcount, readycount, readysorted, sortcount, revcount,
-             seeknosort / (readycount - batchcount + 1), 
-             seeksorted / (readycount - batchcount + 1));
+             seeknosort / (readycount + 1), 
+             seeksorted / (readycount + 1));
 
    if (n_ready <= 1) return;
 
@@ -1311,6 +1332,10 @@
 
       }
 
+   if (link_statistics) {
+      if (cursec > sl[0]) seek += cursec - sl[0]; else seek += sl[0] - cursec;
+      }
+
    if (cursec > ((maxsec + minsec) / 2)) rev = TRUE;
 
    if (!((rev && r) || (!rev && s))) sort(sl, il, n_ready, rev);
@@ -1328,10 +1353,11 @@
    if (overlap) sort(pl, il, n_ready, FALSE);
 
    if (link_statistics) {
+      if (cursec > sl[0]) iseek = cursec - sl[0]; else iseek = sl[0] - cursec;
       batchcount++; readycount += n_ready, seeknosort += seek / 1024; 
       if (input_only) inputcount++;
       if (overlap) { ovlcount++; seeksorted += seek / 1024; }
-      else seeksorted += (maxsec - minsec) / 1024;
+      else seeksorted += (iseek + maxsec - minsec) / 1024;
       if (rev && !r)     {  revcount++; readysorted += n_ready; }
       if (!rev && !s)    { sortcount++; readysorted += n_ready; }
       }
@@ -1375,7 +1401,7 @@
    for (n = 0; n < n_ready; n++) {
       k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
 
-      if (wait_on_busy(sh[j]->io_port)) {
+      if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
          printk("%s: %s, target %d.%d:%d, pid %ld, Mbox %d, adapter"\
                 " busy, will abort.\n", BN(j), (ihdlr ? "ihdlr" : "qcomm"),
                 SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid, k);
diff -u --recursive --new-file v2.1.38/linux/drivers/scsi/u14-34f.h linux/drivers/scsi/u14-34f.h
--- v2.1.38/linux/drivers/scsi/u14-34f.h	Thu Feb 27 10:57:31 1997
+++ linux/drivers/scsi/u14-34f.h	Sat May 17 12:14:23 1997
@@ -11,7 +11,7 @@
 int u14_34f_reset(Scsi_Cmnd *, unsigned int);
 int u14_34f_biosparam(Disk *, kdev_t, int *);
 
-#define U14_34F_VERSION "3.00.09"
+#define U14_34F_VERSION "3.10.00"
 
 #define ULTRASTOR_14_34F {                                            \
 		NULL, /* Ptr for modules */                           \
diff -u --recursive --new-file v2.1.38/linux/fs/binfmt_elf.c linux/fs/binfmt_elf.c
--- v2.1.38/linux/fs/binfmt_elf.c	Thu May 15 16:48:03 1997
+++ linux/fs/binfmt_elf.c	Sat May 17 12:13:09 1997
@@ -280,7 +280,6 @@
 	      /* Real error */
 	      sys_close(elf_exec_fileno);
 	      kfree(elf_phdata);
-printk("%d", error);
 	      return ~0UL;
 	    }
 
diff -u --recursive --new-file v2.1.38/linux/fs/buffer.c linux/fs/buffer.c
--- v2.1.38/linux/fs/buffer.c	Thu May 15 16:48:03 1997
+++ linux/fs/buffer.c	Sun May 18 10:48:29 1997
@@ -591,8 +591,9 @@
 				 continue;
 			if (bh->b_size == size)
 				 continue;
-			
+			bhnext->b_count++;
 			wait_on_buffer(bh);
+			bhnext->b_count--;
 			if (bh->b_dev == dev && bh->b_size != size) {
 				clear_bit(BH_Dirty, &bh->b_state);
 				clear_bit(BH_Uptodate, &bh->b_state);
@@ -1606,6 +1607,7 @@
 				 ndirty++;
 				 if(bh->b_flushtime > jiffies) continue;
 				 nwritten++;
+				 next->b_count++;
 				 bh->b_count++;
 				 bh->b_flushtime = 0;
 #ifdef DEBUG
@@ -1613,6 +1615,7 @@
 #endif
 				 ll_rw_block(WRITE, 1, &bh);
 				 bh->b_count--;
+				 next->b_count--;
 			 }
 	}
 #ifdef DEBUG
@@ -1751,6 +1754,7 @@
 					     currently dirty buffers are not shared, so it does not matter */
 					  if (refilled && major == LOOP_MAJOR)
 						   continue;
+					  next->b_count++;
 					  bh->b_count++;
 					  ndirty++;
 					  bh->b_flushtime = 0;
@@ -1766,6 +1770,7 @@
 					  if(nlist != BUF_DIRTY) ncount++;
 #endif
 					  bh->b_count--;
+					  next->b_count--;
 				  }
 		 }
 #ifdef DEBUG
diff -u --recursive --new-file v2.1.38/linux/fs/isofs/dir.c linux/fs/isofs/dir.c
--- v2.1.38/linux/fs/isofs/dir.c	Wed Apr 23 19:01:25 1997
+++ linux/fs/isofs/dir.c	Sat May 17 12:02:00 1997
@@ -121,6 +121,11 @@
 	char *name;
 	struct iso_directory_record *de;
 
+ 	if( filp->f_pos >= inode->i_size ) {
+ 	  return 0;
+ 
+ 	}
+ 
 	offset = filp->f_pos & (bufsize - 1);
 	block = isofs_bmap(inode, filp->f_pos >> bufbits);
 
diff -u --recursive --new-file v2.1.38/linux/fs/isofs/namei.c linux/fs/isofs/namei.c
--- v2.1.38/linux/fs/isofs/namei.c	Wed Apr 23 19:01:25 1997
+++ linux/fs/isofs/namei.c	Sat May 17 12:02:05 1997
@@ -65,7 +65,6 @@
 	unsigned char bufbits = ISOFS_BUFFER_BITS(dir);
 	unsigned int block, i, f_pos, offset, inode_number;
 	struct buffer_head * bh;
-	void * cpnt = NULL;
 	unsigned int old_offset;
 	unsigned int backlink;
 	int dlen, rrflag, match;
@@ -117,21 +116,8 @@
 		/* Handle case where the directory entry spans two blocks.
 		   Usually 1024 byte boundaries */
 		if (offset >= bufsize) {
-		        unsigned int frag1;
-			frag1 = bufsize - old_offset;
-			cpnt = kmalloc(*((unsigned char *) de),GFP_KERNEL);
-			if (!cpnt) return 0;
-			memcpy(cpnt, bh->b_data + old_offset, frag1);
-
-			de = (struct iso_directory_record *) cpnt;
-			brelse(bh);
-			offset = f_pos & (bufsize - 1);
-			block = isofs_bmap(dir,f_pos>>bufbits);
-			if (!block || !(bh = bread(dir->i_dev,block,bufsize))) {
-			        kfree(cpnt);
-				return 0;
-			};
-			memcpy((char *)cpnt+frag1, bh->b_data, offset);
+			printk("Directory entry extends past end of iso9660 block\n");
+	 		return 0;
 		}
 		
 		/* Handle the '.' case */
@@ -190,12 +176,6 @@
 			match = isofs_match(namelen,name,dpnt,dlen);
 		}
 
-		if (cpnt)
-		{
-			kfree(cpnt);
-			cpnt = NULL;
-		}
-
 		if(rrflag) kfree(dpnt);
 		if (match) {
 			if(inode_number == -1) {
@@ -217,8 +197,6 @@
 		}
 	}
  out:
-	if (cpnt)
-		kfree(cpnt);
 	brelse(bh);
 	return NULL;
 }
diff -u --recursive --new-file v2.1.38/linux/fs/isofs/rock.c linux/fs/isofs/rock.c
--- v2.1.38/linux/fs/isofs/rock.c	Mon Apr  7 11:35:30 1997
+++ linux/fs/isofs/rock.c	Sat May 17 12:02:10 1997
@@ -60,21 +60,6 @@
     block = cont_extent; \
     offset = cont_offset; \
     offset1 = 0; \
-    if(ISOFS_BUFFER_SIZE(DEV) == 1024) {     \
-      block <<= 1;    \
-      if (offset >= 1024) block++; \
-      offset &= 1023; \
-      if(offset + cont_size >= 1024) { \
-	  bh = bread(DEV->i_dev, block++, ISOFS_BUFFER_SIZE(DEV)); \
-	  if(!bh) {printk("Unable to read continuation Rock Ridge record\n"); \
-		     kfree(buffer); \
-		     buffer = NULL; } else { \
-	    memcpy(buffer, bh->b_data + offset, 1024 - offset); \
-            brelse(bh); \
-	    offset1 = 1024 - offset; \
-	    offset = 0;} \
-      }  \
-    };     \
     if(buffer) { \
       bh = bread(DEV->i_dev, block, ISOFS_BUFFER_SIZE(DEV)); \
       if(bh){       \
@@ -429,7 +414,6 @@
   unsigned char bufbits = ISOFS_BUFFER_BITS(inode);
   struct buffer_head * bh;
   unsigned char * pnt;
-  void * cpnt = NULL;
   char * rpnt;
   struct iso_directory_record * raw_inode;
   CONTINUE_DECLS;
@@ -455,24 +439,12 @@
   
   raw_inode = ((struct iso_directory_record *) pnt);
   
+  /*
+   * If we go past the end of the buffer, there is some sort of error.
+   */
   if ((inode->i_ino & (bufsize - 1)) + *pnt > bufsize){
-    int frag1, offset;
-    
-    offset = (inode->i_ino & (bufsize - 1));
-    frag1 = bufsize - offset;
-    cpnt = kmalloc(*pnt,GFP_KERNEL);
-    if(!cpnt) return NULL;
-    memcpy(cpnt, bh->b_data + offset, frag1);
-    brelse(bh);
-    if (!(bh = bread(inode->i_dev,++block, bufsize))) {
-      kfree(cpnt);
-      printk("unable to read i-node block");
-      return NULL;
-    };
-    offset += *pnt - bufsize;
-    memcpy((char *)cpnt+frag1, bh->b_data, offset);
-    pnt = ((unsigned char *) cpnt);
-    raw_inode = ((struct iso_directory_record *) pnt);
+	printk("symlink spans iso9660 blocks\n");
+	return NULL;
   };
   
   /* Now test for possible Rock Ridge extensions which will override some of
@@ -558,11 +530,6 @@
   MAYBE_CONTINUE(repeat,inode);
   brelse(bh);
   
-  if (cpnt) {
-    kfree(cpnt);
-    cpnt = NULL;
-  };
-
   return rpnt;
  out:
   if(buffer) kfree(buffer);
diff -u --recursive --new-file v2.1.38/linux/include/linux/sched.h linux/include/linux/sched.h
--- v2.1.38/linux/include/linux/sched.h	Thu May 15 16:48:05 1997
+++ linux/include/linux/sched.h	Fri May 16 16:53:43 1997
@@ -58,9 +58,6 @@
 extern int nr_running, nr_tasks;
 extern int last_pid;
 
-#define FIRST_TASK task[0]
-#define LAST_TASK task[NR_TASKS-1]
-
 #include <linux/head.h>
 #include <linux/fs.h>
 #include <linux/signal.h>
diff -u --recursive --new-file v2.1.38/linux/include/linux/sunrpc/clnt.h linux/include/linux/sunrpc/clnt.h
--- v2.1.38/linux/include/linux/sunrpc/clnt.h	Wed Apr 16 14:15:00 1997
+++ linux/include/linux/sunrpc/clnt.h	Fri May 16 16:55:33 1997
@@ -23,7 +23,7 @@
 	__u32			pm_prog;
 	__u32			pm_vers;
 	__u32			pm_prot;
-	__u32			pm_port;
+	__u16			pm_port;
 };
 
 /*
diff -u --recursive --new-file v2.1.38/linux/mm/memory.c linux/mm/memory.c
--- v2.1.38/linux/mm/memory.c	Thu May 15 16:48:05 1997
+++ linux/mm/memory.c	Fri May 16 09:58:31 1997
@@ -725,7 +725,7 @@
 		flush_cache_range(mm, start, end);
 		zap_page_range(mm, start, len);
 		flush_tlb_range(mm, start, end);
-	} while ((mpnt = mpnt->vm_next_share) != inode->i_mmap);
+	} while ((mpnt = mpnt->vm_next_share) != NULL);
 }
 
 
