diff -u --recursive --new-file v2.1.0/linux/Makefile linux/Makefile
--- v2.1.0/linux/Makefile	Mon Sep 23 17:53:37 1996
+++ linux/Makefile	Mon Sep 30 17:39:47 1996
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 1
-SUBLEVEL = 0
+SUBLEVEL = 1
 
 ARCH = i386
 
diff -u --recursive --new-file v2.1.0/linux/README linux/README
--- v2.1.0/linux/README	Tue Sep 24 07:54:40 1996
+++ linux/README	Tue Oct  1 10:29:13 1996
@@ -63,11 +63,8 @@
    to get it all put in place. Replace "XX" with the version number of the
    latest kernel.
 
- - You can also upgrade between 2.1.xx releases by patching.  Each
-   patch that is released for 2.1.xx contains only bugfixes.  No
-   new features will be added to the Linux kernel until the 2.1.xx
-   development effort begins.  To install by patching, get all the
-   newer patch files and do
+ - You can also upgrade between 2.1.xx releases by patching.  To install
+   by patching, get all the newer patch files and do
 
 		cd /usr/src
 		gzip -cd patchXX.gz | patch -p0
@@ -144,10 +141,13 @@
 
  - Make sure you have gcc-2.7.0 or newer available.  It seems older gcc
    versions can have problems compiling newer versions of linux.  This
-   is mainly because they only compile programs in the a.out binary
-   format.  As of Linux 2.1.0, the kernel must be compiled as ELF.  If
-   you upgrade your compiler, remember to get the new binutils package too
-   (for as/ld/nm and company).
+   is mainly because the older compilers can only generate "a.out"-format
+   executables.  As of Linux 2.1.0, the kernel must be compiled as an
+   "ELF" binary.  If you upgrade your compiler, remember to get the new
+   binutils package too (for as/ld/nm and company).
+
+   Please note that you can still run a.out user programs with this
+   kernel.
 
  - Do a "make zImage" to create a compressed kernel image.  If you want
    to make a bootdisk (without root filesystem or lilo), insert a floppy
@@ -173,10 +173,10 @@
 
    For some, this is on a floppy disk, in which case you can "cp
    /usr/src/linux/arch/i386/boot/zImage /dev/fd0" to make a bootable
-   floppy.  Note that a change in the 1.3.x series prevented a kernel
-   copied to a 720k double-density 3.5" floppy from booting.  In this
+   floppy.  Please note that you can not boot a kernel by
+   directly dumping it to a 720k double-density 3.5" floppy.  In this
    case, it is highly recommended that you install LILO on your
-   double-density bootfloppy or switch to high-density floppies.
+   double-density boot floppy or switch to high-density floppies.
 
    If you boot Linux from the hard drive, chances are you use LILO which
    uses the kernel image as specified in the file /etc/lilo.conf.  The
diff -u --recursive --new-file v2.1.0/linux/arch/alpha/kernel/signal.c linux/arch/alpha/kernel/signal.c
--- v2.1.0/linux/arch/alpha/kernel/signal.c	Tue Aug 20 13:41:32 1996
+++ linux/arch/alpha/kernel/signal.c	Mon Sep 30 17:43:49 1996
@@ -86,7 +86,7 @@
 /*
  * Do a signal return; undo the signal stack.
  */
-asmlinkage void do_sigreturn(struct sigcontext_struct * sc, 
+asmlinkage void do_sigreturn(struct sigcontext * sc, 
 	struct pt_regs * regs, struct switch_stack * sw)
 {
 	unsigned long mask;
@@ -155,10 +155,10 @@
 {
 	int i;
 	unsigned long oldsp;
-	struct sigcontext_struct * sc;
+	struct sigcontext * sc;
 
 	oldsp = rdusp();
-	sc = ((struct sigcontext_struct *) oldsp) - 1;
+	sc = ((struct sigcontext *) oldsp) - 1;
 
 	/* check here if we would need to switch stacks.. */
 	if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
diff -u --recursive --new-file v2.1.0/linux/arch/i386/kernel/ksyms.c linux/arch/i386/kernel/ksyms.c
--- v2.1.0/linux/arch/i386/kernel/ksyms.c	Wed Sep 25 12:50:39 1996
+++ linux/arch/i386/kernel/ksyms.c	Tue Oct  1 15:35:54 1996
@@ -15,8 +15,8 @@
 	X(dump_thread),
 	X(dump_fpu),
 	X(ioremap),
-	XNOVERS(down_failed),
-	XNOVERS(up_wakeup),
+	XNOVERS(__down_failed),
+	XNOVERS(__up_wakeup),
 #ifdef __SMP__
 	X(apic_reg),		/* Needed internally for the I386 inlines */
 	X(cpu_data),
diff -u --recursive --new-file v2.1.0/linux/arch/i386/kernel/signal.c linux/arch/i386/kernel/signal.c
--- v2.1.0/linux/arch/i386/kernel/signal.c	Mon Sep 23 16:15:02 1996
+++ linux/arch/i386/kernel/signal.c	Mon Sep 30 17:44:04 1996
@@ -84,7 +84,7 @@
 if ((context.x & 0xfffc) && (context.x & 3) != 3) goto badframe; COPY(x);
 #define COPY_SEG_STRICT(x) \
 if (!(context.x & 0xfffc) || (context.x & 3) != 3) goto badframe; COPY(x);
-	struct sigcontext_struct context;
+	struct sigcontext context;
 	struct pt_regs * regs;
 
 	regs = (struct pt_regs *) &__unused;
diff -u --recursive --new-file v2.1.0/linux/arch/i386/kernel/vm86.c linux/arch/i386/kernel/vm86.c
--- v2.1.0/linux/arch/i386/kernel/vm86.c	Tue Sep 24 12:07:38 1996
+++ linux/arch/i386/kernel/vm86.c	Wed Oct  2 13:23:10 1996
@@ -220,10 +220,7 @@
 {
 	if (verify_area(VERIFY_READ, bitmap, 256/8) < 0)
 		return 1;
-	__asm__ __volatile__("btl %2,%%fs:%1\n\tsbbl %0,%0"
-		:"=r" (nr)
-		:"m" (*bitmap),"r" (nr));
-	return nr;
+	return test_bit(nr, bitmap);
 }
 
 /*
@@ -234,16 +231,16 @@
 #define pushb(base, ptr, val) \
 __asm__ __volatile__( \
 	"decw %w0\n\t" \
-	"movb %2,%%fs:0(%1,%0)" \
+	"movb %2,0(%1,%0)" \
 	: "=r" (ptr) \
 	: "r" (base), "q" (val), "0" (ptr))
 
 #define pushw(base, ptr, val) \
 __asm__ __volatile__( \
 	"decw %w0\n\t" \
-	"movb %h2,%%fs:0(%1,%0)\n\t" \
+	"movb %h2,0(%1,%0)\n\t" \
 	"decw %w0\n\t" \
-	"movb %b2,%%fs:0(%1,%0)" \
+	"movb %b2,0(%1,%0)" \
 	: "=r" (ptr) \
 	: "r" (base), "q" (val), "0" (ptr))
 
@@ -251,21 +248,21 @@
 __asm__ __volatile__( \
 	"decw %w0\n\t" \
 	"rorl $16,%2\n\t" \
-	"movb %h2,%%fs:0(%1,%0)\n\t" \
+	"movb %h2,0(%1,%0)\n\t" \
 	"decw %w0\n\t" \
-	"movb %b2,%%fs:0(%1,%0)\n\t" \
+	"movb %b2,0(%1,%0)\n\t" \
 	"decw %w0\n\t" \
 	"rorl $16,%2\n\t" \
-	"movb %h2,%%fs:0(%1,%0)\n\t" \
+	"movb %h2,0(%1,%0)\n\t" \
 	"decw %w0\n\t" \
-	"movb %b2,%%fs:0(%1,%0)" \
+	"movb %b2,0(%1,%0)" \
 	: "=r" (ptr) \
 	: "r" (base), "q" (val), "0" (ptr))
 
 #define popb(base, ptr) \
 ({ unsigned long __res; \
 __asm__ __volatile__( \
-	"movb %%fs:0(%1,%0),%b2\n\t" \
+	"movb 0(%1,%0),%b2\n\t" \
 	"incw %w0" \
 	: "=r" (ptr), "=r" (base), "=q" (__res) \
 	: "0" (ptr), "1" (base), "2" (0)); \
@@ -274,9 +271,9 @@
 #define popw(base, ptr) \
 ({ unsigned long __res; \
 __asm__ __volatile__( \
-	"movb %%fs:0(%1,%0),%b2\n\t" \
+	"movb 0(%1,%0),%b2\n\t" \
 	"incw %w0\n\t" \
-	"movb %%fs:0(%1,%0),%h2\n\t" \
+	"movb 0(%1,%0),%h2\n\t" \
 	"incw %w0" \
 	: "=r" (ptr), "=r" (base), "=q" (__res) \
 	: "0" (ptr), "1" (base), "2" (0)); \
@@ -285,14 +282,14 @@
 #define popl(base, ptr) \
 ({ unsigned long __res; \
 __asm__ __volatile__( \
-	"movb %%fs:0(%1,%0),%b2\n\t" \
+	"movb 0(%1,%0),%b2\n\t" \
 	"incw %w0\n\t" \
-	"movb %%fs:0(%1,%0),%h2\n\t" \
+	"movb 0(%1,%0),%h2\n\t" \
 	"incw %w0\n\t" \
 	"rorl $16,%2\n\t" \
-	"movb %%fs:0(%1,%0),%b2\n\t" \
+	"movb 0(%1,%0),%b2\n\t" \
 	"incw %w0\n\t" \
-	"movb %%fs:0(%1,%0),%h2\n\t" \
+	"movb 0(%1,%0),%h2\n\t" \
 	"incw %w0\n\t" \
 	"rorl $16,%2" \
 	: "=r" (ptr), "=r" (base), "=q" (__res) \
diff -u --recursive --new-file v2.1.0/linux/arch/i386/lib/semaphore.S linux/arch/i386/lib/semaphore.S
--- v2.1.0/linux/arch/i386/lib/semaphore.S	Wed Sep 11 22:34:27 1996
+++ linux/arch/i386/lib/semaphore.S	Tue Oct  1 15:43:09 1996
@@ -9,19 +9,27 @@
 /*
  * "down_failed" is called with the eventual return address
  * in %eax, and the address of the semaphore in %ecx. We need
- * to increment the number of waiters on the semaphore,
- * call "__down()", and then eventually return to try again.
+ * to call "__down()", and then re-try until we succeed..
  */
-ENTRY(down_failed)
-	pushl %eax
-	pushl %ecx
+ENTRY(__down_failed)
+	pushl %eax	/* return address */
+	pushl %edx	/* save %edx */
+1:	pushl %ecx	/* save %ecx (and argument) */
 	call SYMBOL_NAME(__down)
-	popl %ecx
+	popl %ecx	/* restore %ecx (count on __down not changing it) */
+#ifdef __SMP__
+	lock
+#endif
+	decl (%ecx)
+	js 1b
+	popl %edx	/* restore %edx */
 	ret
 
-ENTRY(up_wakeup)
-	pushl %eax
-	pushl %ecx
+ENTRY(__up_wakeup)
+	pushl %eax	/* return address */
+	pushl %edx	/* save %edx */
+	pushl %ecx	/* save %ecx (and argument) */
 	call SYMBOL_NAME(__up)
-	popl %ecx
+	popl %ecx	/* restore %ecx (count on __up not changing it) */
+	popl %edx	/* restore %edx */
 	ret
diff -u --recursive --new-file v2.1.0/linux/drivers/block/rd.c linux/drivers/block/rd.c
--- v2.1.0/linux/drivers/block/rd.c	Tue Jul  2 19:08:41 1996
+++ linux/drivers/block/rd.c	Tue Oct  1 07:51:36 1996
@@ -180,14 +180,14 @@
 
 #ifdef CONFIG_BLK_DEV_INITRD
 
-static int initrd_read(struct inode *inode,struct file *file,char *buf,
-    int count)
+static long initrd_read(struct inode *inode,struct file *file,
+	char *buf, unsigned long count)
 {
 	int left;
 
 	left = initrd_end-initrd_start-file->f_pos;
 	if (count > left) count = left;
-	if (count <= 0) return 0;
+	if (count == 0) return 0;
 	memcpy_tofs(buf,(char *) initrd_start+file->f_pos,count);
 	file->f_pos += count;
 	return count;
@@ -350,8 +350,8 @@
 	/*
 	 * Read block 0 to test for gzipped kernel
 	 */
-	if (fp->f_op->lseek)
-		fp->f_op->lseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
+	if (fp->f_op->llseek)
+		fp->f_op->llseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
 	fp->f_pos = start_block * BLOCK_SIZE;
 	
 	fp->f_op->read(fp->f_inode, fp, buf, size);
@@ -370,8 +370,8 @@
 	/*
 	 * Read block 1 to test for minix and ext2 superblock
 	 */
-	if (fp->f_op->lseek)
-		fp->f_op->lseek(fp->f_inode, fp,
+	if (fp->f_op->llseek)
+		fp->f_op->llseek(fp->f_inode, fp,
 				(start_block+1) * BLOCK_SIZE, 0);
 	fp->f_pos = (start_block+1) * BLOCK_SIZE;
 
@@ -400,8 +400,8 @@
 	       start_block);
 	
 done:
-	if (fp->f_op->lseek)
-		fp->f_op->lseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
+	if (fp->f_op->llseek)
+		fp->f_op->llseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
 	fp->f_pos = start_block * BLOCK_SIZE;	
 
 	if ((nblocks > 0) && blk_size[MAJOR(device)]) {
diff -u --recursive --new-file v2.1.0/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
--- v2.1.0/linux/drivers/pci/pci.c	Wed Sep 11 11:45:10 1996
+++ linux/drivers/pci/pci.c	Thu Oct  3 10:36:55 1996
@@ -209,7 +209,8 @@
 	DEVICE( 3DLABS,		3DLABS_300SX,	"GLINT 300SX"),
 	DEVICE( AVANCE,		AVANCE_2302,	"ALG-2302"),
 	DEVICE( S3,		S3_ViRGE,	"ViRGE"),
-	DEVICE( S3,		S3_811,		"Trio32/Trio64"),
+	DEVICE( S3,		S3_TRIO,	"Trio32/Trio64"),
+	DEVICE( S3,		S3_ViRGE_VX,	"ViRGE/VX"),
 	DEVICE( S3,		S3_868,	"Vision 868"),
 	DEVICE( S3,		S3_928,		"Vision 928-P"),
 	DEVICE( S3,		S3_864_1,	"Vision 864-P"),
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/53c7,8xx.c linux/drivers/scsi/53c7,8xx.c
--- v2.1.0/linux/drivers/scsi/53c7,8xx.c	Fri Sep 27 00:15:41 1996
+++ linux/drivers/scsi/53c7,8xx.c	Tue Oct  1 17:49:47 1996
@@ -248,14 +248,11 @@
 #include <linux/proc_fs.h>
 #include <linux/string.h>
 #include <linux/malloc.h>
+#include <linuxv/malloc.h>
 #include <linux/mm.h>
 #include <linux/ioport.h>
 #include <linux/time.h>
-#ifdef LINUX_1_2
-#include "../block/blk.h"
-#else
 #include <linux/blk.h>
-#endif
 #undef current
 
 #include "scsi.h"
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/AM53C974.c linux/drivers/scsi/AM53C974.c
--- v2.1.0/linux/drivers/scsi/AM53C974.c	Sat Sep 28 11:22:47 1996
+++ linux/drivers/scsi/AM53C974.c	Tue Oct  1 10:34:00 1996
@@ -2252,6 +2252,21 @@
 return SCSI_ABORT_SUCCESS;
 }
 
+
+/*
+ * AM53C974_release()
+ *
+ * Release resources allocated for a single AM53C974 adapter.
+ */
+int
+AM53C974_release(struct Scsi_Host *shp)
+{
+	free_irq(shp->irq, NULL);
+	scsi_unregister(shp);
+	return 0;
+}
+
+
 #ifdef MODULE
 static Scsi_Host_Template driver_template = AM53C974;
 
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/AM53C974.h linux/drivers/scsi/AM53C974.h
--- v2.1.0/linux/drivers/scsi/AM53C974.h	Fri Sep 27 00:20:18 1996
+++ linux/drivers/scsi/AM53C974.h	Tue Oct  1 10:29:13 1996
@@ -273,7 +273,7 @@
     NULL,                       /* int (*proc_info)(char *, char **, off_t, int, int, int); */ \
     "AM53C974",        		/* name                                         */  \
     AM53C974_detect,   		/* int (* detect)(struct SHT *)                 */  \
-    NULL,              		/* int (*release)(struct Scsi_Host *)           */  \
+    AM53C974_release,		/* int (*release)(struct Scsi_Host *)           */  \
     AM53C974_info,     		/* const char *(* info)(struct Scsi_Host *)     */  \
     AM53C974_command,  		/* int (* command)(Scsi_Cmnd *)                 */  \
     AM53C974_queue_command,	/* int (* queuecommand)(Scsi_Cmnd *,                \
@@ -293,6 +293,7 @@
 
 void AM53C974_setup(char *str, int *ints);
 int AM53C974_detect(Scsi_Host_Template *tpnt);
+int AM53C974_release(struct Scsi_Host *shp);
 int AM53C974_biosparm(Disk *disk, int dev, int *info_array);
 const char *AM53C974_info(struct Scsi_Host *);
 int AM53C974_command(Scsi_Cmnd *SCpnt);
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/Config.in linux/drivers/scsi/Config.in
--- v2.1.0/linux/drivers/scsi/Config.in	Sun Jul  7 11:18:51 1996
+++ linux/drivers/scsi/Config.in	Tue Oct  1 10:29:13 1996
@@ -21,7 +21,7 @@
 dep_tristate 'Adaptec AHA274X/284X/294X support' CONFIG_SCSI_AIC7XXX $CONFIG_SCSI
 dep_tristate 'AdvanSys SCSI support' CONFIG_SCSI_ADVANSYS $CONFIG_SCSI
 dep_tristate 'Always IN2000 SCSI support' CONFIG_SCSI_IN2000 $CONFIG_SCSI
-bool 'AM53/79C974 PCI SCSI support' CONFIG_SCSI_AM53C974
+dep_tristate 'AM53/79C974 PCI SCSI support' CONFIG_SCSI_AM53C974 $CONFIG_SCSI
 dep_tristate 'BusLogic SCSI support' CONFIG_SCSI_BUSLOGIC $CONFIG_SCSI
 dep_tristate 'DTC3180/3280 SCSI support' CONFIG_SCSI_DTC3280 $CONFIG_SCSI
 dep_tristate 'EATA ISA/EISA (DPT PM2011/021/012/022/122/322) support' CONFIG_SCSI_EATA $CONFIG_SCSI
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/Makefile linux/drivers/scsi/Makefile
--- v2.1.0/linux/drivers/scsi/Makefile	Fri Sep 20 18:42:32 1996
+++ linux/drivers/scsi/Makefile	Tue Oct  1 10:29:13 1996
@@ -174,6 +174,10 @@
 
 ifeq ($(CONFIG_SCSI_AM53C974),y)
 L_OBJS += AM53C974.o
+else
+  ifeq ($(CONFIG_SCSI_AM53C974),m)
+  M_OBJS += AM53C974.o
+  endif
 endif
 
 ifeq ($(CONFIG_SCSI_BUSLOGIC),y)
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/aha1542.c linux/drivers/scsi/aha1542.c
--- v2.1.0/linux/drivers/scsi/aha1542.c	Thu Sep 26 09:30:57 1996
+++ linux/drivers/scsi/aha1542.c	Tue Oct  1 16:14:10 1996
@@ -636,7 +636,7 @@
 	  panic("Foooooooood fight!");
 	};
 	any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].address));
-	if(SCSI_PA(sgpnt[i].address+sgpnt[i].length) > ISA_DMA_THRESHOLD)
+	if(SCSI_PA(sgpnt[i].address+sgpnt[i].length-1) > ISA_DMA_THRESHOLD)
 	  BAD_DMA("sgpnt", sgpnt[i].address, sgpnt[i].length);
 	any2scsi(cptr[i].datalen, sgpnt[i].length);
       };
@@ -651,7 +651,7 @@
       ccb[mbo].op = 0;	      /* SCSI Initiator Command */
       SCpnt->host_scribble = NULL;
       any2scsi(ccb[mbo].datalen, bufflen);
-      if(buff && SCSI_PA(buff+bufflen) > ISA_DMA_THRESHOLD)
+      if(buff && SCSI_PA(buff+bufflen-1) > ISA_DMA_THRESHOLD)
         BAD_DMA("buff", buff, bufflen);
       any2scsi(ccb[mbo].dataptr, SCSI_PA(buff));
     };
@@ -950,7 +950,7 @@
 
 		    /* For now we do this - until kmalloc is more intelligent
 		       we are resigned to stupid hacks like this */
-		    if (SCSI_PA(shpnt+1) > ISA_DMA_THRESHOLD) {
+		    if (SCSI_PA(shpnt) >= ISA_DMA_THRESHOLD) {
 		      printk("Invalid address for shpnt with 1542.\n");
 		      goto unregister;
 		    }
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/eata.c linux/drivers/scsi/eata.c
--- v2.1.0/linux/drivers/scsi/eata.c	Wed Jul 10 08:05:27 1996
+++ linux/drivers/scsi/eata.c	Wed Oct  2 13:15:41 1996
@@ -1,6 +1,10 @@
 /*
  *      eata.c - Low-level driver for EATA/DMA SCSI host adapters.
  *
+ *      27 Sep 1996 rev. 2.12 for linux 2.1.0
+ *          Portability cleanups (virtual/bus addressing, little/big endian
+ *          support).
+ *
  *      09 Jul 1996 rev. 2.11 for linux 2.0.4
  *          Number of internal retries is now limited.
  *
@@ -127,6 +131,7 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 #include <asm/system.h>
+#include <asm/byteorder.h>
 #include <linux/proc_fs.h>
 #include <linux/blk.h>
 #include "scsi.h"
@@ -331,6 +336,11 @@
 #define HD(board) ((struct hostdata *) &sh[board]->hostdata)
 #define BN(board) (HD(board)->board_name)
 
+#define H2DEV(x) htonl(x)
+#define DEV2H(x) H2DEV(x)
+#define V2DEV(addr) ((addr) ? H2DEV(virt_to_bus((void *)addr)) : 0)
+#define DEV2V(addr) ((addr) ? DEV2H(bus_to_virt((unsigned long)addr)) : 0)
+
 static void eata2x_interrupt_handler(int, void *, struct pt_regs *);
 static int do_trace = FALSE;
 
@@ -347,11 +357,11 @@
 
    if (wait_on_busy(iobase)) return TRUE;
 
-   if (addr) {
-      outb((char)  addr,        iobase + REG_LOW);
-      outb((char) (addr >> 8),  iobase + REG_LM);
-      outb((char) (addr >> 16), iobase + REG_MID);
-      outb((char) (addr >> 24), iobase + REG_MSB);
+   if ((addr = V2DEV(addr))) {
+      outb((char) (addr >> 24), iobase + REG_LOW);
+      outb((char) (addr >> 16), iobase + REG_LM);
+      outb((char) (addr >> 8),  iobase + REG_MID);
+      outb((char)  addr,        iobase + REG_MSB);
       }
 
    outb(cmd, iobase + REG_CMD);
@@ -403,14 +413,14 @@
    /* Check the controller "EATA" signature */
    if (info.sign != EATA_SIGNATURE) return FALSE;
 
-   if (ntohl(info.data_len) < EATA_2_0A_SIZE) {
+   if (DEV2H(info.data_len) < EATA_2_0A_SIZE) {
       printk("%s: config structure size (%ld bytes) too short, detaching.\n", 
-	     name, ntohl(info.data_len));
+	     name, DEV2H(info.data_len));
       return FALSE;
       }
-   else if (ntohl(info.data_len) == EATA_2_0A_SIZE)
+   else if (DEV2H(info.data_len) == EATA_2_0A_SIZE)
       protocol_rev = 'A';
-   else if (ntohl(info.data_len) == EATA_2_0B_SIZE)
+   else if (DEV2H(info.data_len) == EATA_2_0B_SIZE)
       protocol_rev = 'B';
    else
       protocol_rev = 'C';
@@ -552,8 +562,8 @@
 	     info.forcaddr, info.max_id, info.max_chan);
 
    printk("%s: Version 0x%x, SYNC 0x%x, infol %ld, cpl %ld spl %ld.\n", 
-	  name, info.version, info.sync, ntohl(info.data_len), 
-	  ntohl(info.cp_len), ntohl(info.sp_len));
+	  name, info.version, info.sync, DEV2H(info.data_len), 
+	  DEV2H(info.cp_len), DEV2H(info.sp_len));
 #endif
 
    return TRUE;
@@ -603,12 +613,12 @@
    sgpnt = (struct scatterlist *) SCpnt->request_buffer;
 
    for (k = 0; k < SCpnt->use_sg; k++) {
-      cpp->sglist[k].address = htonl((unsigned int) sgpnt[k].address);
-      cpp->sglist[k].num_bytes = htonl((unsigned int) sgpnt[k].length);
+      cpp->sglist[k].address = V2DEV(sgpnt[k].address);
+      cpp->sglist[k].num_bytes = H2DEV(sgpnt[k].length);
       }
 
-   cpp->data_address = htonl((unsigned int) cpp->sglist);
-   cpp->data_len = htonl((SCpnt->use_sg * sizeof(struct sg_list)));
+   cpp->data_address = V2DEV(cpp->sglist);
+   cpp->data_len = H2DEV((SCpnt->use_sg * sizeof(struct sg_list)));
 }
 
 int eata2x_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
@@ -670,8 +680,8 @@
 
    memset(spp, 0, sizeof(struct mssp));
 
-   /* The EATA protocol uses Big Endian format, while Intel is Little Endian */
-   cpp->sp_addr = htonl((unsigned int) spp);
+   /* The EATA protocol uses Big Endian format */
+   cpp->sp_addr = V2DEV(spp);
 
    SCpnt->scsi_done = done;
    cpp->index = i;
@@ -693,7 +703,7 @@
    cpp->target = SCpnt->target;
    cpp->lun = SCpnt->lun;  
    cpp->SCpnt = SCpnt;
-   cpp->sense_addr = htonl((unsigned int) SCpnt->sense_buffer); 
+   cpp->sense_addr = V2DEV(SCpnt->sense_buffer); 
    cpp->sense_len = sizeof SCpnt->sense_buffer;
 
    if (SCpnt->use_sg) {
@@ -701,8 +711,8 @@
       build_sg_list(cpp, SCpnt);
       }
    else {
-      cpp->data_address = htonl((unsigned int) SCpnt->request_buffer);
-      cpp->data_len = htonl(SCpnt->request_bufflen);
+      cpp->data_address = V2DEV(SCpnt->request_buffer);
+      cpp->data_len = H2DEV(SCpnt->request_bufflen);
       }
 
    memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len);
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/eata.h linux/drivers/scsi/eata.h
--- v2.1.0/linux/drivers/scsi/eata.h	Wed Jul 10 08:05:27 1996
+++ linux/drivers/scsi/eata.h	Wed Oct  2 13:15:41 1996
@@ -11,7 +11,7 @@
 int eata2x_abort(Scsi_Cmnd *);
 int eata2x_reset(Scsi_Cmnd *, unsigned int);
 
-#define EATA_VERSION "2.11.00"
+#define EATA_VERSION "2.12.00"
 
 
 #define EATA {                                                 \
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/fdomain.c linux/drivers/scsi/fdomain.c
--- v2.1.0/linux/drivers/scsi/fdomain.c	Fri Aug  9 10:43:24 1996
+++ linux/drivers/scsi/fdomain.c	Thu Oct  3 07:51:28 1996
@@ -1,10 +1,10 @@
 /* fdomain.c -- Future Domain TMC-16x0 SCSI driver
  * Created: Sun May  3 18:53:19 1992 by faith@cs.unc.edu
- * Revised: Thu Aug  8 14:58:51 1996 by r.faith@ieee.org
+ * Revised: Wed Oct  2 11:10:55 1996 by r.faith@ieee.org
  * Author: Rickard E. Faith, faith@cs.unc.edu
  * Copyright 1992, 1993, 1994, 1995, 1996 Rickard E. Faith
  *
- * $Id: fdomain.c,v 5.44 1996/08/08 18:58:53 root Exp $
+ * $Id: fdomain.c,v 5.45 1996/10/02 15:13:06 root Exp $
 
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -105,6 +105,7 @@
  1.3.72      5.39         8 Feb 1996  Adaptec AHA-2920 board
  1.3.85      5.41         4 Apr 1996
  2.0.12      5.44         8 Aug 1996  Use ID 7 for all PCI cards
+ 2.1.1       5.45         2 Oct 1996  Update ROM accesses for 2.1.x
 
  
 
@@ -276,7 +277,7 @@
     S_IFDIR | S_IRUGO | S_IXUGO, 2
 };
   
-#define VERSION          "$Revision: 5.44 $"
+#define VERSION          "$Revision: 5.45 $"
 
 /* START OF USER DEFINABLE OPTIONS */
 
@@ -363,7 +364,7 @@
 };
 
 static int               port_base         = 0;
-static void              *bios_base        = NULL;
+static unsigned long     bios_base         = 0;
 static int               bios_major        = 0;
 static int               bios_minor        = 0;
 static int               PCI_bus           = 0;
@@ -397,16 +398,17 @@
 static int               FIFO_Size = 0x2000; /* 8k FIFO for
 						pre-tmc18c30 chips */
 
-extern void              fdomain_16x0_intr( int irq, void *dev_id, struct pt_regs * regs );
+extern void              fdomain_16x0_intr( int irq, void *dev_id,
+					    struct pt_regs * regs );
 
-static void *addresses[] = {
-   (void *)0xc8000,
-   (void *)0xca000,
-   (void *)0xce000,
-   (void *)0xde000,
-   (void *)0xcc000,		/* Extra addresses for PCI boards */
-   (void *)0xd0000,
-   (void *)0xe0000,
+static unsigned long addresses[] = {
+   0xc8000,
+   0xca000,
+   0xce000,
+   0xde000,
+   0xcc000,		/* Extra addresses for PCI boards */
+   0xd0000,
+   0xe0000,
 };
 #define ADDRESS_COUNT (sizeof( addresses ) / sizeof( unsigned ))
 		       
@@ -425,7 +427,7 @@
 
   This driver works *ONLY* for Future Domain cards using the TMC-1800,
   TMC-18C50, or TMC-18C30 chip.  This includes models TMC-1650, 1660, 1670,
-  and 1680.
+  and 1680.  These are all 16-bit cards.
 
   The following BIOS signature signatures are for boards which do *NOT*
   work with this driver (these TMC-8xx and TMC-9xx boards may work with the
@@ -439,6 +441,12 @@
   FUTURE DOMAIN CORP. (C) 1986-1990 V7.009/18/90
   FUTURE DOMAIN CORP. (C) 1992 V8.00.004/02/92
 
+  (The cards which do *NOT* work are all 8-bit cards -- although some of
+  them have a 16-bit form-factor, the upper 8-bits are used only for IRQs
+  and are *NOT* used for data.  You can tell the difference by following
+  the tracings on the circuit board -- if only the IRQ lines are involved,
+  you have a "8-bit" card, and should *NOT* use this driver.)
+
 */
 
 struct signature {
@@ -501,8 +509,8 @@
       if (bios_minor >= 0) printk( "%d", bios_minor );
       else                 printk( "?." );
    
-      printk( " at 0x%x using scsi id %d\n",
-	      (unsigned)bios_base, shpnt->this_id );
+      printk( " at 0x%lx using scsi id %d\n",
+	      bios_base, shpnt->this_id );
    }
 
 				/* If this driver works for later FD PCI
@@ -577,7 +585,7 @@
       if (inb( port + MSB_ID_Code ) != 0x60) return 0;
       chip = tmc18c50;
 
-#if 0
+#if 1
 
 				/* Try to toggle 32-bit mode.  This only
 				   works on an 18c30 chip.  (User reports
@@ -675,16 +683,13 @@
       switch (Quantum) {
       case 2:			/* ISA_200S */
       case 3:			/* ISA_250MG */
-	 base = *((char *)bios_base + 0x1fa2)
-	       + (*((char *)bios_base + 0x1fa3) << 8);
+	 base = readb(bios_base + 0x1fa2) + (readb(bios_base + 0x1fa3) << 8);
 	 break;
       case 4:			/* ISA_200S (another one) */
-	 base = *((char *)bios_base + 0x1fa3)
-	       + (*((char *)bios_base + 0x1fa4) << 8);
+	 base = readb(bios_base + 0x1fa3) + (readb(bios_base + 0x1fa4) << 8);
 	 break;
       default:
-	 base = *((char *)bios_base + 0x1fcc)
-	       + (*((char *)bios_base + 0x1fcd) << 8);
+	 base = readb(bios_base + 0x1fcc) + (readb(bios_base + 0x1fcd) << 8);
 	 break;
       }
    
@@ -944,11 +949,12 @@
       
       for (i = 0; !bios_base && i < ADDRESS_COUNT; i++) {
 #if DEBUG_DETECT
-	 printk( " %x(%x),", (unsigned)addresses[i], (unsigned)bios_base );
+	 printk( " %lx(%lx),", addresses[i], bios_base );
 #endif
 	 for (j = 0; !bios_base && j < SIGNATURE_COUNT; j++) {
-	    if (!memcmp( ((char *)addresses[i] + signatures[j].sig_offset),
-			 signatures[j].signature, signatures[j].sig_length )) {
+	    if (check_signature(addresses[i] + signatures[j].sig_offset,
+				signatures[j].signature,
+				signatures[j].sig_length )) {
 	       bios_major = signatures[j].major_bios_version;
 	       bios_minor = signatures[j].minor_bios_version;
 	       PCI_bus    = (signatures[j].flag == 1);
@@ -1927,11 +1933,12 @@
    unsigned char    *data     = (unsigned char *)(sizes + 2);
    unsigned char    do_read[] = { READ_6, 0, 0, 0, 1, 0 };
    int              retcode;
+   unsigned long    offset;
    struct drive_info {
       unsigned short cylinders;
       unsigned char  heads;
       unsigned char  sectors;
-   } *i;
+   } i;
    
    /* NOTES:
       The RAM area starts at 0x1f00 from the bios_base address.
@@ -1983,28 +1990,30 @@
       case 2:			/* ISA_200S */
 				/* The value of 25 has never been verified.
 				   It should probably be 15. */
-	 i = (struct drive_info *)( (char *)bios_base + 0x1f33 + drive * 25 );
+	 offset = bios_base + 0x1f33 + drive * 25;
 	 break;
       case 3:			/* ISA_250MG */
-	 i = (struct drive_info *)( (char *)bios_base + 0x1f36 + drive * 15 );
+	 offset = bios_base + 0x1f36 + drive * 15;
 	 break;
       case 4:			/* ISA_200S (another one) */
-	 i = (struct drive_info *)( (char *)bios_base + 0x1f34 + drive * 15 );
+	 offset = bios_base + 0x1f34 + drive * 15;
 	 break;
       default:
-	 i = (struct drive_info *)( (char *)bios_base + 0x1f31 + drive * 25 );
+	 offset = bios_base + 0x1f31 + drive * 25;
 	 break;
       }
-      info_array[0] = i->heads;
-      info_array[1] = i->sectors;
-      info_array[2] = i->cylinders;
+      memcpy_fromio( &i, offset, sizeof( struct drive_info ) );
+      info_array[0] = i.heads;
+      info_array[1] = i.sectors;
+      info_array[2] = i.cylinders;
    } else if (bios_major == 3
 	      && bios_minor >= 0
 	      && bios_minor < 4) { /* 3.0 and 3.2 BIOS */
-      i = (struct drive_info *)( (char *)bios_base + 0x1f71 + drive * 10 );
-      info_array[0] = i->heads + 1;
-      info_array[1] = i->sectors;
-      info_array[2] = i->cylinders;
+      memcpy_fromio( &i, bios_base + 0x1f71 + drive * 10,
+		     sizeof( struct drive_info ) );
+      info_array[0] = i.heads + 1;
+      info_array[1] = i.sectors;
+      info_array[2] = i.cylinders;
    } else {			/* 3.4 BIOS (and up?) */
       /* This algorithm was provided by Future Domain (much thanks!). */
 
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
--- v2.1.0/linux/drivers/scsi/st.c	Fri Aug 16 08:02:48 1996
+++ linux/drivers/scsi/st.c	Wed Oct  2 14:03:42 1996
@@ -11,7 +11,7 @@
   Copyright 1992 - 1996 Kai Makisara
 		 email Kai.Makisara@metla.fi
 
-  Last modified: Sun Jul  7 10:08:46 1996 by root@kai.makisara.fi
+  Last modified: Tue Oct  1 22:53:51 1996 by makisara@kai.makisara.fi
   Some small formal changes - aeb, 950809
 */
 
@@ -2192,7 +2192,8 @@
       return (-EBUSY);
 
     if ((STp->buffer)->last_result_fatal != 0 ||
-	((STp->buffer)->b_data[0] & 4)) {
+	(STp->device->scsi_level >= SCSI_2 &&
+	 ((STp->buffer)->b_data[0] & 4) != 0)) {
       *block = *partition = 0;
 #if DEBUG
       if (debugging)
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/u14-34f.c linux/drivers/scsi/u14-34f.c
--- v2.1.0/linux/drivers/scsi/u14-34f.c	Mon Sep 30 09:44:17 1996
+++ linux/drivers/scsi/u14-34f.c	Wed Oct  2 13:15:41 1996
@@ -1,6 +1,10 @@
 /*
  *      u14-34f.c - Low-level driver for UltraStor 14F/34F SCSI host adapters.
  *
+ *      27 Sep 1996 rev. 2.12 for linux 2.1.0
+ *          Portability cleanups (virtual/bus addressing, little/big endian
+ *          support).
+ *
  *      09 Jul 1996 rev. 2.11 for linux 2.0.4
  *          "Data over/under-run" no longer implies a redo on all targets.
  *          Number of internal retries is now limited.
@@ -157,6 +161,7 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 #include <asm/system.h>
+#include <asm/byteorder.h>
 #include <linux/proc_fs.h>
 #include <linux/blk.h>
 #include "scsi.h"
@@ -266,8 +271,8 @@
    Scsi_Cmnd *SCpnt;
 
    struct sg_list {
-      unsigned int address;     /* Segment Address */
-      unsigned int num_bytes;   /* Segment Length */
+      unsigned int address;             /* Segment Address */
+      unsigned int num_bytes;           /* Segment Length */
       } sglist[MAX_SGLIST];
 
    unsigned int index;   /* cp index */
@@ -302,6 +307,20 @@
 #define HD(board) ((struct hostdata *) &sh[board]->hostdata)
 #define BN(board) (HD(board)->board_name)
 
+#if defined(__BIG_ENDIAN)
+#define H2DEV(x) ((unsigned long)( \
+	(((unsigned long)(x) & 0x000000ffU) << 24) | \
+	(((unsigned long)(x) & 0x0000ff00U) <<  8) | \
+	(((unsigned long)(x) & 0x00ff0000U) >>  8) | \
+	(((unsigned long)(x) & 0xff000000U) >> 24)))
+#else
+#define H2DEV(x) (x)
+#endif
+
+#define DEV2H(x) H2DEV(x)
+#define V2DEV(addr) ((addr) ? H2DEV(virt_to_bus((void *)addr)) : 0)
+#define DEV2V(addr) ((addr) ? DEV2H(bus_to_virt((unsigned long)addr)) : 0)
+
 static void u14_34f_interrupt_handler(int, void *, struct pt_regs *);
 static int do_trace = FALSE;
 
@@ -322,8 +341,8 @@
    memset(cpp, 0, sizeof(struct mscp));
    cpp->opcode = OP_HOST_ADAPTER;
    cpp->xdir = DTD_IN;
-   cpp->data_address = virt_to_bus(HD(j)->board_id);
-   cpp->data_len = sizeof(HD(j)->board_id);
+   cpp->data_address = V2DEV(HD(j)->board_id);
+   cpp->data_len = H2DEV(sizeof(HD(j)->board_id));
    cpp->scsi_cdbs_len = 6;
    cpp->scsi_cdbs[0] = HA_CMD_INQUIRY;
 
@@ -338,7 +357,7 @@
    outb(CMD_CLR_INTR, sh[j]->io_port + REG_SYS_INTR);
 
    /* Store pointer in OGM address bytes */
-   outl(virt_to_bus(cpp), sh[j]->io_port + REG_OGM);
+   outl(V2DEV(cpp), sh[j]->io_port + REG_OGM);
 
    /* Issue OGM interrupt */
    outb(CMD_OGM_INTR, sh[j]->io_port + REG_LCL_INTR);
@@ -568,14 +587,14 @@
    sgpnt = (struct scatterlist *) SCpnt->request_buffer;
 
    for (k = 0; k < SCpnt->use_sg; k++) {
-      cpp->sglist[k].address = virt_to_bus(sgpnt[k].address);
-      cpp->sglist[k].num_bytes = sgpnt[k].length;
+      cpp->sglist[k].address = V2DEV(sgpnt[k].address);
+      cpp->sglist[k].num_bytes = H2DEV(sgpnt[k].length);
       data_len += sgpnt[k].length;
       }
 
    cpp->use_sg = SCpnt->use_sg;
-   cpp->data_address = virt_to_bus(cpp->sglist);
-   cpp->data_len = data_len;
+   cpp->data_address = V2DEV(cpp->sglist);
+   cpp->data_len = H2DEV(data_len);
 }
 
 int u14_34f_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
@@ -649,7 +668,7 @@
    cpp->target = SCpnt->target;
    cpp->lun = SCpnt->lun;
    cpp->SCpnt = SCpnt;
-   cpp->sense_addr = virt_to_bus(SCpnt->sense_buffer);
+   cpp->sense_addr = V2DEV(SCpnt->sense_buffer);
    cpp->sense_len = sizeof SCpnt->sense_buffer;
 
    if (SCpnt->use_sg) {
@@ -657,8 +676,8 @@
       build_sg_list(cpp, SCpnt);
       }
    else {
-      cpp->data_address = virt_to_bus(SCpnt->request_buffer);
-      cpp->data_len = SCpnt->request_bufflen;
+      cpp->data_address = V2DEV(SCpnt->request_buffer);
+      cpp->data_len = H2DEV(SCpnt->request_bufflen);
       }
 
    cpp->scsi_cdbs_len = SCpnt->cmd_len;
@@ -675,7 +694,7 @@
       }
 
    /* Store pointer in OGM address bytes */
-   outl(virt_to_bus(cpp), sh[j]->io_port + REG_OGM);
+   outl(V2DEV(cpp), sh[j]->io_port + REG_OGM);
 
    /* Issue OGM interrupt */
    outb(CMD_OGM_INTR, sh[j]->io_port + REG_LCL_INTR);
@@ -901,7 +920,7 @@
 	 if (do_trace) printk("%s: ihdlr, start service, count %d.\n",
 			      BN(j), HD(j)->iocount);
 
-	 spp = (struct mscp *)bus_to_virt(inl(sh[j]->io_port + REG_ICM));
+	 spp = (struct mscp *)DEV2V(inl(sh[j]->io_port + REG_ICM));
 
 	 /* Clear interrupt pending flag */
 	 outb(CMD_CLR_INTR, sh[j]->io_port + REG_SYS_INTR);
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/u14-34f.h linux/drivers/scsi/u14-34f.h
--- v2.1.0/linux/drivers/scsi/u14-34f.h	Wed Jul 10 08:05:27 1996
+++ linux/drivers/scsi/u14-34f.h	Wed Oct  2 13:15:41 1996
@@ -10,7 +10,7 @@
 int u14_34f_reset(Scsi_Cmnd *, unsigned int);
 int u14_34f_biosparam(Disk *, kdev_t, int *);
 
-#define U14_34F_VERSION "2.11.00"
+#define U14_34F_VERSION "2.12.00"
 
 #define ULTRASTOR_14_34F {                                            \
 		NULL, /* Ptr for modules */                           \
diff -u --recursive --new-file v2.1.0/linux/drivers/scsi/ultrastor.c linux/drivers/scsi/ultrastor.c
--- v2.1.0/linux/drivers/scsi/ultrastor.c	Mon May 13 09:01:23 1996
+++ linux/drivers/scsi/ultrastor.c	Wed Oct  2 14:20:55 1996
@@ -662,12 +662,12 @@
 	sl = (struct scatterlist *) SCpnt->request_buffer;
 	max = SCpnt->use_sg;
 	for (i = 0; i < max; i++) {
-		mscp->sglist[i].address = (unsigned int)sl[i].address;
+		mscp->sglist[i].address = virt_to_bus(sl[i].address);
 		mscp->sglist[i].num_bytes = sl[i].length;
 		transfer_length += sl[i].length;
 	}
 	mscp->number_of_sg_list = max;
-	mscp->transfer_data = (unsigned int)mscp->sglist;
+	mscp->transfer_data = virt_to_bus(mscp->sglist);
 	/* ??? May not be necessary.  Docs are unclear as to whether transfer
 	   length field is ignored or whether it should be set to the total
 	   number of bytes of the transfer.  */
@@ -723,7 +723,7 @@
     } else {
 	/* Unset scatter/gather flag in SCSI command packet */
 	my_mscp->sg = FALSE;
-	my_mscp->transfer_data = (unsigned int)SCpnt->request_buffer;
+	my_mscp->transfer_data = virt_to_bus(SCpnt->request_buffer);
 	my_mscp->transfer_data_length = SCpnt->request_bufflen;
     }
     my_mscp->command_link = 0;		/*???*/
@@ -733,7 +733,7 @@
     memcpy(my_mscp->scsi_cdbs, SCpnt->cmnd, my_mscp->length_of_scsi_cdbs);
     my_mscp->adapter_status = 0;
     my_mscp->target_status = 0;
-    my_mscp->sense_data = (unsigned int)&SCpnt->sense_buffer;
+    my_mscp->sense_data = virt_to_bus(&SCpnt->sense_buffer);
     my_mscp->done = done;
     my_mscp->SCint = SCpnt;
     SCpnt->host_scribble = (unsigned char *)my_mscp;
@@ -791,7 +791,7 @@
     }
 
     /* Store pointer in OGM address bytes */
-    outl((unsigned int)my_mscp, config.ogm_address);
+    outl(virt_to_bus(my_mscp), config.ogm_address);
 
     /* Issue OGM interrupt */
     if (config.slot) {
@@ -867,9 +867,9 @@
 	out[28 + i * 3] = '\n';
 	out[29 + i * 3] = 0;
 	ogm_status = inb(port0 + 22);
-	ogm_addr = inl(port0 + 23);
+	ogm_addr = (unsigned int)bus_to_virt(inl(port0 + 23));
 	icm_status = inb(port0 + 27);
-	icm_addr = inl(port0 + 28);
+	icm_addr = (unsigned int)bus_to_virt(inl(port0 + 28));
 	restore_flags(flags);
       }
 
@@ -905,7 +905,7 @@
 
 	save_flags(flags);
 	cli();
-	outl((int)&config.mscp[mscp_index], config.ogm_address);
+	outl(virt_to_bus(&config.mscp[mscp_index]), config.ogm_address);
 	inb(0xc80);	/* delay */
 	outb(0x80, config.ogm_address - 1);
 	outb(0x2, LCL_DOORBELL_INTR(config.doorbell_address));
@@ -1038,7 +1038,7 @@
 #if ULTRASTOR_MAX_CMDS == 1
     mscp = &config.mscp[0];
 #else
-    mscp = (struct mscp *)inl(config.icm_address);
+    mscp = (struct mscp *)bus_to_virt(inl(config.icm_address));
     mscp_index = mscp - config.mscp;
     if (mscp_index >= ULTRASTOR_MAX_CMDS) {
 	printk("Ux4F interrupt: bad MSCP address %x\n", (unsigned int) mscp);
diff -u --recursive --new-file v2.1.0/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c
--- v2.1.0/linux/drivers/sound/soundcard.c	Wed Sep 25 14:33:57 1996
+++ linux/drivers/sound/soundcard.c	Tue Oct  1 17:47:55 1996
@@ -52,8 +52,8 @@
   return 0;
 }
 
-static int
-sound_read (inode_handle * inode, file_handle * file, char *buf, int count)
+static long
+sound_read (inode_handle * inode, file_handle * file, char *buf, unsigned long count)
 {
   int             dev;
 
@@ -64,8 +64,8 @@
   return sound_read_sw (dev, &files[dev], buf, count);
 }
 
-static int
-sound_write (inode_handle * inode, file_handle * file, const char *buf, int count)
+static long
+sound_write (inode_handle * inode, file_handle * file, const char *buf, unsigned long count)
 {
   int             dev;
 
@@ -76,8 +76,8 @@
   return sound_write_sw (dev, &files[dev], buf, count);
 }
 
-static int
-sound_lseek (inode_handle * inode, file_handle * file, off_t offset, int orig)
+static long long
+sound_lseek (inode_handle * inode, file_handle * file, long long offset, int orig)
 {
   return -(EPERM);
 }
diff -u --recursive --new-file v2.1.0/linux/fs/locks.c linux/fs/locks.c
--- v2.1.0/linux/fs/locks.c	Fri Sep 27 07:09:58 1996
+++ linux/fs/locks.c	Thu Oct  3 11:28:37 1996
@@ -127,7 +127,6 @@
 			   unsigned int wait);
 static int posix_locks_deadlock(struct task_struct *my_task,
 				struct task_struct *blocked_task);
-static int locks_overlap(struct file_lock *fl1, struct file_lock *fl2);
 static void posix_remove_locks(struct file_lock **before, struct task_struct *task);
 static void flock_remove_locks(struct file_lock **before, struct file *filp);
 
@@ -136,6 +135,10 @@
 static void locks_delete_lock(struct file_lock **thisfl_p, unsigned int wait);
 static char *lock_get_status(struct file_lock *fl, char *p, int id, char *pfx);
 
+static void locks_insert_block(struct file_lock *blocker, struct file_lock *waiter);
+static void locks_delete_block(struct file_lock *blocker, struct file_lock *waiter);
+static void locks_wake_up_blocks(struct file_lock *blocker, unsigned int wait);
+
 static struct file_lock *file_lock_table = NULL;
 
 /* Free lock not inserted in any queue.
@@ -152,13 +155,21 @@
 	return;
 }
 
+/* Check if two locks overlap each other.
+ */
+static inline int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
+{
+	return ((fl1->fl_end >= fl2->fl_start) &&
+		(fl2->fl_end >= fl1->fl_start));
+}
+
 /* Insert waiter into blocker's block list.
  * We use a circular list so that processes can be easily woken up in
  * the order they blocked. The documentation doesn't require this but
  * it seems seems like the reasonable thing to do.
  */
-static inline void locks_insert_block(struct file_lock *blocker, 
-				      struct file_lock *waiter)
+static void locks_insert_block(struct file_lock *blocker, 
+			       struct file_lock *waiter)
 {
 	struct file_lock *prevblock;
 
@@ -180,8 +191,8 @@
 /* Remove waiter from blocker's block list.
  * When blocker ends up pointing to itself then the list is empty.
  */
-static inline void locks_delete_block(struct file_lock *blocker,
-				      struct file_lock *waiter)
+static void locks_delete_block(struct file_lock *blocker,
+			       struct file_lock *waiter)
 {
 	struct file_lock *nextblock;
 	struct file_lock *prevblock;
@@ -206,8 +217,7 @@
  * If told to wait then schedule the processes until the block list
  * is empty, otherwise empty the block list ourselves.
  */
-static inline void locks_wake_up_blocks(struct file_lock *blocker,
-					unsigned int wait)
+static void locks_wake_up_blocks(struct file_lock *blocker, unsigned int wait)
 {
 	struct file_lock *waiter;
 
@@ -305,8 +315,7 @@
 	struct flock flock;
 	struct inode *inode;
 
-	/*
-	 * Get arguments and validate them ...
+	/* Get arguments and validate them ...
 	 */
 
 	if ((fd >= NR_OPEN) || !(filp = current->files->fd[fd]))
@@ -493,21 +502,14 @@
 	if ((fl = inode->i_flock) == NULL || (fl->fl_flags & FL_FLOCK))
 		return (0);
 	
-	/*
-	 * Search the lock list for this inode for locks that conflict with
+	/* Search the lock list for this inode for locks that conflict with
 	 * the proposed read/write.
 	 */
 	while (fl != NULL) {
-		if (fl->fl_owner == current ||
-		    fl->fl_end < offset || fl->fl_start >= offset + count)
-			goto next_lock;
-
-		/*
-		 * Block for writes against a "read" lock,
+		/* Block for writes against a "read" lock,
 		 * and both reads and writes against a "write" lock.
 		 */
-		if ((read_write == FLOCK_VERIFY_WRITE) ||
-		    (fl->fl_type == F_WRLCK)) {
+		if (posix_locks_conflict(fl, &tfl)) {
 			if (filp && (filp->f_flags & O_NONBLOCK))
 				return (-EAGAIN);
 			if (current->signal & ~current->blocked)
@@ -521,15 +523,13 @@
 
 			if (current->signal & ~current->blocked)
 				return (-ERESTARTSYS);
-			/*
-			 * If we've been sleeping someone might have
+			/* If we've been sleeping someone might have
 			 * changed the permissions behind our back.
 			 */
 			if ((inode->i_mode & (S_ISGID | S_IXGRP)) != S_ISGID)
 				break;
 			goto repeat;
 		}
-	next_lock:
 		fl = fl->fl_next;
 	}
 #endif
@@ -675,14 +675,6 @@
 	return (0);	/* This should never happen */
 }
 
-/* Check if two locks overlap each other.
- */
-static int locks_overlap(struct file_lock *fl1, struct file_lock *fl2)
-{
-	return ((fl1->fl_end >= fl2->fl_start) &&
-		(fl2->fl_end >= fl1->fl_start));
-}
-
 /* This function tests for deadlock condition before putting a process to
  * sleep. The detection scheme is no longer recursive. Recursive was neat,
  * but dangerous - we risked stack corruption if the lock data was bad, or
@@ -777,11 +769,8 @@
 			interruptible_sleep_on(&new_fl->fl_wait);
 			locks_delete_block(fl, new_fl);
 			if (current->signal & ~current->blocked) {
-				/* If we are here, than we were awakened
-				 * by a signal, so new_fl is still in the
-				 * block queue of fl. We need to remove 
-				 * new_fl and then free it.
-				 * 	Dmitry Gorodchanin 09/02/96.
+				/* Awakened by a signal. Free the new
+				 * lock and return an error.
 				 */
 				locks_free_lock(new_fl);
 				return (-ERESTARTSYS);
@@ -795,8 +784,8 @@
 }
 
 /* Add a POSIX style lock to a file.
- * We merge adjacent locks whenever possible. POSIX locks come after FLOCK
- * locks in the list and are sorted by owner task, then by starting address
+ * We merge adjacent locks whenever possible. POSIX locks are sorted by owner
+ * task, then by starting address
  *
  * Kai Petzke writes:
  * To make freeing a lock much faster, we keep a pointer to the lock before the
@@ -839,18 +828,17 @@
 			fl = fl->fl_next;
   		}
   	}
-	/*
-	 * Find the first old lock with the same owner as the new lock.
+
+	/* Find the first old lock with the same owner as the new lock.
 	 */
 	
 	before = &filp->f_inode->i_flock;
 
-	/* First skip FLOCK locks and locks owned by other processes.
+	/* First skip locks owned by other processes.
 	 */
 	while ((fl = *before) && (caller->fl_owner != fl->fl_owner)) {
 		before = &fl->fl_next;
 	}
-	
 
 	/* Process locks with this owner.
 	 */
diff -u --recursive --new-file v2.1.0/linux/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c
--- v2.1.0/linux/fs/ncpfs/dir.c	Thu Sep 26 15:28:30 1996
+++ linux/fs/ncpfs/dir.c	Tue Oct  1 17:44:22 1996
@@ -24,8 +24,8 @@
 	unsigned long f_pos;
 };
 
-static int 
-ncp_dir_read(struct inode *inode, struct file *filp, char *buf, int count);
+static long
+ncp_dir_read(struct inode *inode, struct file *filp, char *buf, unsigned long count);
 
 static int 
 ncp_readdir(struct inode *inode, struct file *filp,
@@ -192,8 +192,8 @@
 	return NULL;
 }
 	
-static int 
-ncp_dir_read(struct inode *inode, struct file *filp, char *buf, int count)
+static long
+ncp_dir_read(struct inode *inode, struct file *filp, char *buf, unsigned long count)
 {
 	return -EISDIR;
 }
diff -u --recursive --new-file v2.1.0/linux/fs/ncpfs/file.c linux/fs/ncpfs/file.c
--- v2.1.0/linux/fs/ncpfs/file.c	Sun Jun  2 11:21:10 1996
+++ linux/fs/ncpfs/file.c	Tue Oct  1 17:46:35 1996
@@ -80,8 +80,8 @@
         return -EACCES;
 }
 
-static int 
-ncp_file_read(struct inode *inode, struct file *file, char *buf, int count)
+static long
+ncp_file_read(struct inode *inode, struct file *file, char *buf, unsigned long count)
 {
 	int bufsize, already_read;
 	off_t pos;
@@ -164,9 +164,9 @@
         return already_read;
 }
 
-static int 
+static long
 ncp_file_write(struct inode *inode, struct file *file, const char *buf,
-	       int count)
+	       unsigned long count)
 {
 	int bufsize, already_written;
         off_t pos;
diff -u --recursive --new-file v2.1.0/linux/fs/read_write.c linux/fs/read_write.c
--- v2.1.0/linux/fs/read_write.c	Sat Sep 28 23:48:01 1996
+++ linux/fs/read_write.c	Tue Oct  1 13:10:27 1996
@@ -16,84 +16,95 @@
 
 #include <asm/segment.h>
 
-asmlinkage long sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
+static long long default_llseek(struct inode *inode,
+	struct file *file,
+	long long offset,
+	int origin)
 {
-	struct file * file;
-	long tmp = -1;
-
-	if (fd >= NR_OPEN || !(file=current->files->fd[fd]) || !(file->f_inode))
-		return -EBADF;
-	if (origin > 2)
-		return -EINVAL;
-	if (file->f_op && file->f_op->llseek)
-		return file->f_op->llseek(file->f_inode,file,offset,origin);
+	long long retval;
 
-/* this is the default handler if no lseek handler is present */
 	switch (origin) {
-		case 0:
-			tmp = offset;
-			break;
-		case 1:
-			tmp = file->f_pos + offset;
-			break;
 		case 2:
-			if (!file->f_inode)
-				return -EINVAL;
-			tmp = file->f_inode->i_size + offset;
+			offset += inode->i_size;
 			break;
+		case 1:
+			offset += file->f_pos;
 	}
-	if (tmp < 0)
-		return -EINVAL;
-	if (tmp != file->f_pos) {
-		file->f_pos = tmp;
-		file->f_reada = 0;
-		file->f_version = ++event;
+	retval = -EINVAL;
+	if (offset >= 0) {
+		if (offset != file->f_pos) {
+			file->f_pos = offset;
+			file->f_reada = 0;
+			file->f_version = ++event;
+		}
+		retval = offset;
 	}
-	return file->f_pos;
+	return retval;
+}
+
+static inline long long llseek(struct inode * inode, struct file *file,
+	long long offset, unsigned int origin)
+{
+	long long (*fn)(struct inode *, struct file *, long long, int);
+
+	fn = default_llseek;
+	if (file->f_op && file->f_op->llseek)
+		fn = file->f_op->llseek;
+	return fn(inode, file, offset, origin);
+}
+
+asmlinkage long sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
+{
+	long retval;
+	struct file * file;
+	struct inode * inode;
+
+	retval = -EBADF;
+	if (fd >= NR_OPEN ||
+	    !(file = current->files->fd[fd]) ||
+	    !(inode = file->f_inode))
+		goto bad;
+	retval = -EINVAL;
+	if (origin > 2)
+		goto bad;
+	retval = llseek(inode, file, offset, origin);
+bad:
+	return retval;
 }
 
 asmlinkage int sys_llseek(unsigned int fd, unsigned long offset_high,
 			  unsigned long offset_low, loff_t * result,
 			  unsigned int origin)
 {
+	long retval;
 	struct file * file;
-	loff_t tmp = -1;
-	loff_t offset;
-	int err;
+	struct inode * inode;
+	long long offset;
 
-	if (fd >= NR_OPEN || !(file=current->files->fd[fd]) || !(file->f_inode))
-		return -EBADF;
+	retval = -EBADF;
+	if (fd >= NR_OPEN ||
+	    !(file = current->files->fd[fd]) ||
+	    !(inode = file->f_inode))
+		goto bad;
+	retval = -EINVAL;
 	if (origin > 2)
-		return -EINVAL;
-	if ((err = verify_area(VERIFY_WRITE, result, sizeof(loff_t))))
-		return err;
-	offset = (loff_t) (((unsigned long long) offset_high << 32) | offset_low);
-
-	if (file->f_op && file->f_op->llseek)
-		return file->f_op->llseek(file->f_inode,file,offset,origin);
+		goto bad;
 
-	switch (origin) {
-		case 0:
-			tmp = offset;
-			break;
-		case 1:
-			tmp = file->f_pos + offset;
-			break;
-		case 2:
-			if (!file->f_inode)
-				return -EINVAL;
-			tmp = file->f_inode->i_size + offset;
-			break;
-	}
-	if (tmp < 0)
-		return -EINVAL;
-	if (tmp != file->f_pos) {
-		file->f_pos = tmp;
-		file->f_reada = 0;
-		file->f_version = ++event;
+	retval = verify_area(VERIFY_WRITE, result, sizeof(offset));
+	if (retval)
+		goto bad;
+
+	offset = llseek(inode, file,
+		(((unsigned long long) offset_high << 32) | offset_low),
+		origin);
+
+	retval = offset;
+	if (offset >= 0) {
+		put_user(offset, result);
+		retval = 0;
 	}
-	memcpy_tofs(result, &file->f_pos, sizeof(loff_t));
-	return 0;
+bad:
+	return retval;
 }
 
 asmlinkage long sys_read(unsigned int fd, char * buf, unsigned long count)
diff -u --recursive --new-file v2.1.0/linux/fs/stat.c linux/fs/stat.c
--- v2.1.0/linux/fs/stat.c	Sat Feb 17 09:19:41 1996
+++ linux/fs/stat.c	Mon Sep 30 17:52:51 1996
@@ -20,9 +20,9 @@
  * For backward compatibility?  Maybe this should be moved
  * into arch/i386 instead?
  */
-static void cp_old_stat(struct inode * inode, struct old_stat * statbuf)
+static void cp_old_stat(struct inode * inode, struct __old_kernel_stat * statbuf)
 {
-	struct old_stat tmp;
+	struct __old_kernel_stat tmp;
 
 	printk("VFS: Warning: %s using old stat() call. Recompile your binary.\n",
 		current->comm);
@@ -44,9 +44,9 @@
 
 #endif
 
-static void cp_new_stat(struct inode * inode, struct new_stat * statbuf)
+static void cp_new_stat(struct inode * inode, struct stat * statbuf)
 {
-	struct new_stat tmp;
+	struct stat tmp;
 	unsigned int blocks, indirect;
 
 	memset(&tmp, 0, sizeof(tmp));
@@ -107,7 +107,7 @@
  * For backward compatibility?  Maybe this should be moved
  * into arch/i386 instead?
  */
-asmlinkage int sys_stat(char * filename, struct old_stat * statbuf)
+asmlinkage int sys_stat(char * filename, struct __old_kernel_stat * statbuf)
 {
 	struct inode * inode;
 	int error;
@@ -124,7 +124,7 @@
 }
 #endif
 
-asmlinkage int sys_newstat(char * filename, struct new_stat * statbuf)
+asmlinkage int sys_newstat(char * filename, struct stat * statbuf)
 {
 	struct inode * inode;
 	int error;
@@ -146,7 +146,7 @@
  * For backward compatibility?  Maybe this should be moved
  * into arch/i386 instead?
  */
-asmlinkage int sys_lstat(char * filename, struct old_stat * statbuf)
+asmlinkage int sys_lstat(char * filename, struct __old_kernel_stat * statbuf)
 {
 	struct inode * inode;
 	int error;
@@ -164,7 +164,7 @@
 
 #endif
 
-asmlinkage int sys_newlstat(char * filename, struct new_stat * statbuf)
+asmlinkage int sys_newlstat(char * filename, struct stat * statbuf)
 {
 	struct inode * inode;
 	int error;
@@ -186,7 +186,7 @@
  * For backward compatibility?  Maybe this should be moved
  * into arch/i386 instead?
  */
-asmlinkage int sys_fstat(unsigned int fd, struct old_stat * statbuf)
+asmlinkage int sys_fstat(unsigned int fd, struct __old_kernel_stat * statbuf)
 {
 	struct file * f;
 	struct inode * inode;
@@ -203,7 +203,7 @@
 
 #endif
 
-asmlinkage int sys_newfstat(unsigned int fd, struct new_stat * statbuf)
+asmlinkage int sys_newfstat(unsigned int fd, struct stat * statbuf)
 {
 	struct file * f;
 	struct inode * inode;
diff -u --recursive --new-file v2.1.0/linux/fs/ufs/ufs_dir.c linux/fs/ufs/ufs_dir.c
--- v2.1.0/linux/fs/ufs/ufs_dir.c	Tue May 21 07:06:19 1996
+++ linux/fs/ufs/ufs_dir.c	Thu Oct  3 10:35:00 1996
@@ -6,16 +6,12 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_dir.c,v 1.3 1996/04/25 09:12:00 davem Exp $
+ * $Id: ufs_dir.c,v 1.7 1996/05/21 19:01:45 davem Exp $
  *
  */
 
 #include <linux/fs.h>
-
-/* XXX */
-extern int ufs_lookup (struct inode *, const char *, int, struct inode **);
-extern int ufs_bmap (struct inode *, int);
-extern void ufs_print_inode (struct inode *);
+#include <linux/ufs_fs.h>
 
 /*
  * This is blatantly stolen from ext2fs
@@ -47,7 +43,6 @@
 
 	while (!error && !stored && filp->f_pos < inode->i_size) {
 		lblk = (filp->f_pos) >> sb->s_blocksize_bits;
-	        blk = ufs_bmap(inode, lblk);
 	        /* XXX - ufs_bmap() call needs error checking */
 	        blk = ufs_bmap(inode, lblk);
 		bh = bread (sb->s_dev, blk, sb->s_blocksize);
@@ -74,9 +69,9 @@
 				 * least that it is non-zero.  A
 				 * failure will be detected in the
 				 * dirent test below. */
-				if (de->d_reclen < 1)
+				if (ufs_swab16(de->d_reclen) < 1)
 					break;
-				i += de->d_reclen;
+				i += ufs_swab16(de->d_reclen);
 			}
 			offset = i;
 			filp->f_pos = (filp->f_pos & ~(sb->s_blocksize - 1))
@@ -88,7 +83,8 @@
 		       && offset < sb->s_blocksize) {
 			de = (struct ufs_direct *) (bh->b_data + offset);
 	                /* XXX - put in a real ufs_check_dir_entry() */
-	                if ((de->d_reclen == 0) || (de->d_namlen == 0)) {
+	                if ((ufs_swab16(de->d_reclen) == 0)
+                             || (ufs_swab16(de->d_namlen) == 0)) {
 	                        filp->f_pos = (filp->f_pos & (sb->s_blocksize - 1)) + sb->s_blocksize;
 	                        brelse(bh);
 	                        return stored;
@@ -104,8 +100,8 @@
 				return stored;
 			}
 #endif /* XXX */
-			offset += de->d_reclen;
-			if (de->d_ino) {
+			offset += ufs_swab16(de->d_reclen);
+			if (ufs_swab32(de->d_ino)) {
 				/* We might block in the next section
 				 * if the data destination is
 				 * currently swapped out.  So, use a
@@ -113,21 +109,22 @@
 				 * not the directory has been modified
 				 * during the copy operation. */
 				unsigned long version;
-				dcache_add(inode, de->d_name, de->d_namlen,
-	                                   de->d_ino);
+				dcache_add(inode, de->d_name,
+					   ufs_swab16(de->d_namlen),
+	                                   ufs_swab32(de->d_ino));
 				version = inode->i_version;
 	                        if (inode->i_sb->u.ufs_sb.s_flags & UFS_DEBUG) {
 	                                printk("ufs_readdir: filldir(%s,%u)\n",
-	                                       de->d_name, de->d_ino);
+	                                       de->d_name, ufs_swab32(de->d_ino));
 	                        }
-				error = filldir(dirent, de->d_name, de->d_namlen, filp->f_pos, de->d_ino);
+				error = filldir(dirent, de->d_name, ufs_swab16(de->d_namlen), filp->f_pos, ufs_swab32(de->d_ino));
 				if (error)
 					break;
 				if (version != inode->i_version)
 					goto revalidate;
 				stored ++;
 			}
-			filp->f_pos += de->d_reclen;
+			filp->f_pos += ufs_swab16(de->d_reclen);
 		}
 		offset = 0;
 		brelse (bh);
diff -u --recursive --new-file v2.1.0/linux/fs/ufs/ufs_file.c linux/fs/ufs/ufs_file.c
--- v2.1.0/linux/fs/ufs/ufs_file.c	Thu Apr 25 13:37:31 1996
+++ linux/fs/ufs/ufs_file.c	Thu Oct  3 10:35:01 1996
@@ -6,93 +6,12 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_file.c,v 1.3 1996/04/25 09:12:02 davem Exp $
+ * $Id: ufs_file.c,v 1.6 1996/05/19 03:55:48 krioles Exp $
  *
  */
 
 #include <linux/fs.h>
-
-/*
- * Return values:
- *   0:  bmap failed
- *  nonzero: absolute "block" number
- */
-int ufs_bmap (struct inode * inode, int block)
-{
-	unsigned long int fsblkno, phys_block, lfsblkno;
-	struct buffer_head * bh;
-
-	/*
-	 * Note that contrary to what the BSD source calls these things,
-	 * blkno and lblkno are *frags* (1024), not UFS blocks (8192).
-	 * XXX - maybe I'm wrong, and ui_blocks is really 512-blocks...
-	 */
-
-	/*
-	 * Ok, I think I figured out what is going on.  ui_blocks is the
-	 * number of 512-byte blocks that are allocated to the file.  The
-	 * elements in ui_db[UFS_NDADDR] are pointers to 1024-byte aligned
-	 * 8192 byte objects.  The entire 8192 bytes (16 512-blocks) may
-	 * not be allocated to the file in question - use ui_blocks to see
-	 * how many of the blocks are allocated.  Also, use ui_size to see
-	 * what fraction of the last block is allocated to the file, and
-	 * what fraction is unused.  I have not yet seen a file with a
-	 * hole in it, but I'd guess that a hole must be at least 8192
-	 * bytes of zeros, and it's represented by a zero in ui_db[X].
-	 *
-	 * Yes, this means that there is more than one way to name a given
-	 * 512-byte block on the disk. Because of the 1024-byte alignment
-	 * of 8192-byte filesystem blocks, a given 512-byte disk block
-	 * could be referred to in eight different ways.
-	 */
-
-	/*
-	 * block is the logical 1024-block in the file
-	 * lfsblkno is the logical 8192-block in the file
-	 * fsblkno is the physical 8192-block
-	 * phys_block is the 1024-block
-	 */
-	lfsblkno = block>>3;
-
-	if (block < UFS_NDADDR) {
-	        /* It's a direct block */
-	        fsblkno = inode->u.ufs_i.ui_db[lfsblkno]; /* XXX */
-#if 0
-	        phys_block = ufs_cgdmin(inode->i_sb, ufs_ino2cg(inode)) +
-	                blkno%(inode->i_sb->u.ufs_sb.s_fpg);
-#endif
-	        phys_block = fsblkno + ((block & 0x7)<<10); /* XXX */
-	        if (inode->i_sb->u.ufs_sb.s_flags & UFS_DEBUG) {
-	                printk("ufs_bmap: mapped ino %lu  logical %u to %lu (phys %lu)\n",
-	                       inode->i_ino, block, fsblkno, phys_block);
-	        }
-	        return(phys_block);
-	} else {
-	        /* Need to use indirect blocks */
-	        /* XXX - bmap through indirect blocks not implemented */
-	        block -= UFS_NDADDR;
-	        if (block < (inode->i_sb->s_blocksize/sizeof(__u32))) {
-	                bh = bread(inode->i_dev, inode->u.ufs_i.ui_ib[0],
-	                           BLOCK_SIZE);
-	                if (bh == NULL) {
-	                        printk("ufs_bmap: can't map block %u, ino %lu\n",
-	                               block + UFS_NDADDR, inode->i_ino);
-	                        return(0);
-	                }
-	                phys_block = ((__u32 *)bh->b_data)[block];
-	                brelse(bh);
-	                printk("ufs_bmap: imap ino %lu block %u phys %lu\n",
-	                       inode->i_ino, block + UFS_NDADDR, phys_block);
-	                return(phys_block);
-	        } else {
-	                printk("ufs_bmap: ino %lu: indirect blocks not implemented\n",
-	                       inode->i_ino);
-	                return(0);
-	        }
-	}
-
-	return(0);
-}
+#include <linux/ufs_fs.h>
 
 static struct file_operations ufs_file_operations = {
 	NULL,			/* lseek */
@@ -131,13 +50,3 @@
 	NULL,			/* smap */
 };
 
-
-/*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
- */
diff -u --recursive --new-file v2.1.0/linux/fs/ufs/ufs_inode.c linux/fs/ufs/ufs_inode.c
--- v2.1.0/linux/fs/ufs/ufs_inode.c	Mon May 13 07:36:19 1996
+++ linux/fs/ufs/ufs_inode.c	Thu Oct  3 10:35:01 1996
@@ -6,7 +6,7 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_inode.c,v 1.3 1996/04/25 09:12:05 davem Exp $
+ * $Id: ufs_inode.c,v 1.7 1996/06/01 14:56:46 ecd Exp $
  *
  */
 
@@ -14,27 +14,97 @@
 #include <linux/ufs_fs.h>
 #include <linux/sched.h>
 
-extern struct inode_operations ufs_file_inode_operations;
-extern struct inode_operations ufs_dir_inode_operations;
-extern struct inode_operations ufs_symlink_inode_operations;
-extern struct file_operations ufs_file_operations;
-extern struct file_operations ufs_dir_operations;
-extern struct file_operations ufs_symlink_operations;
-
 void ufs_print_inode(struct inode * inode)
 {
-	printk("ino %lu  mode 0%6.6o  lk %d  uid %d  gid %d  sz %lu  blks %lu  cnt %u\n",
-	       inode->i_ino, inode->i_mode, inode->i_nlink, inode->i_uid, inode->i_gid, inode->i_size, inode->i_blocks, inode->i_count);
-	printk("  db <0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x>\n",
-	       inode->u.ufs_i.ui_db[0], inode->u.ufs_i.ui_db[1],
-	       inode->u.ufs_i.ui_db[2], inode->u.ufs_i.ui_db[3],
-	       inode->u.ufs_i.ui_db[4], inode->u.ufs_i.ui_db[5],
-	       inode->u.ufs_i.ui_db[6], inode->u.ufs_i.ui_db[7],
-	       inode->u.ufs_i.ui_db[8], inode->u.ufs_i.ui_db[9],
-	       inode->u.ufs_i.ui_db[10], inode->u.ufs_i.ui_db[11]);
+	printk("ino %lu  mode 0%6.6o  lk %d  uid %d  gid %d"
+	       "  sz %lu  blks %lu  cnt %u\n",
+		inode->i_ino, inode->i_mode, inode->i_nlink, inode->i_uid,
+		inode->i_gid, inode->i_size, inode->i_blocks, inode->i_count);
+	printk("  db <0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x"
+	       " 0x%x 0x%x 0x%x 0x%x>\n",
+		inode->u.ufs_i.i_data[0], inode->u.ufs_i.i_data[1],
+		inode->u.ufs_i.i_data[2], inode->u.ufs_i.i_data[3],
+		inode->u.ufs_i.i_data[4], inode->u.ufs_i.i_data[5],
+		inode->u.ufs_i.i_data[6], inode->u.ufs_i.i_data[7],
+		inode->u.ufs_i.i_data[8], inode->u.ufs_i.i_data[9],
+		inode->u.ufs_i.i_data[10], inode->u.ufs_i.i_data[11]);
 	printk("  gen 0x%8.8x ib <0x%x 0x%x 0x%x>\n",
-	       inode->u.ufs_i.ui_gen, inode->u.ufs_i.ui_ib[0],
-	       inode->u.ufs_i.ui_ib[1], inode->u.ufs_i.ui_ib[2]);
+		inode->u.ufs_i.i_gen,
+		inode->u.ufs_i.i_data[UFS_IND_BLOCK],
+		inode->u.ufs_i.i_data[UFS_DIND_BLOCK],
+		inode->u.ufs_i.i_data[UFS_TIND_BLOCK]);
+}
+
+#define inode_bmap(inode, nr) ((inode)->u.ufs_i.i_data[(nr)])
+
+static inline int block_bmap (struct inode *inode, int block, int nr)
+{
+	struct buffer_head *bh;
+	int tmp;
+
+	/* XXX Split in fsize big blocks (Can't bread 8Kb). */ 
+	tmp = nr >> (inode->i_sb->u.ufs_sb.s_fshift - 2);
+	bh = bread (inode->i_dev, block + tmp, inode->i_sb->u.ufs_sb.s_fsize);
+	if (!bh)
+		return 0;
+	nr &= ~(inode->i_sb->u.ufs_sb.s_fmask) >> 2;
+	tmp = ufs_swab32(((__u32 *)bh->b_data)[nr]);
+	brelse (bh);
+	return tmp;
+}
+
+int ufs_bmap (struct inode * inode, int block)
+{
+	int i;
+	int addr_per_block = UFS_ADDR_PER_BLOCK(inode->i_sb);
+	int addr_per_block_bits = UFS_ADDR_PER_BLOCK_BITS(inode->i_sb);
+	int lbn = ufs_lbn (inode->i_sb, block);
+	int boff = ufs_boff (inode->i_sb, block);
+
+	if (lbn < 0) {
+		ufs_warning (inode->i_sb, "ufs_bmap", "block < 0");
+		return 0;
+	}
+	if (lbn >= UFS_NDADDR + addr_per_block +
+		(1 << (addr_per_block_bits * 2)) +
+		((1 << (addr_per_block_bits * 2)) << addr_per_block_bits)) {
+		ufs_warning (inode->i_sb, "ufs_bmap", "block > big");
+		return 0;
+	}
+	if (lbn < UFS_NDADDR)
+		return ufs_dbn (inode->i_sb, inode_bmap (inode, lbn), boff);
+	lbn -= UFS_NDADDR;
+	if (lbn < addr_per_block) {
+		i = inode_bmap (inode, UFS_IND_BLOCK);
+		if (!i)
+			return 0;
+		return ufs_dbn (inode->i_sb, block_bmap (inode, i, lbn), boff);
+	}
+	lbn -= addr_per_block;
+	if (lbn < (1 << (addr_per_block_bits * 2))) {
+		i = inode_bmap (inode, UFS_DIND_BLOCK);
+		if (!i)
+			return 0;
+		i = block_bmap (inode, i, lbn >> addr_per_block_bits);
+		if (!i)
+			return 0;
+		return ufs_dbn (inode->i_sb,
+				block_bmap (inode, i, lbn & (addr_per_block-1)),
+				boff);
+	}
+	lbn -= (1 << (addr_per_block_bits * 2));
+	i = inode_bmap (inode, UFS_TIND_BLOCK);
+	if (!i)
+		return 0;
+	i = block_bmap (inode, i, lbn >> (addr_per_block_bits * 2));
+	if (!i)
+		return 0;
+	i = block_bmap (inode, i,
+			(lbn >> addr_per_block_bits) & (addr_per_block - 1));
+	if (!i)
+		return 0;
+	return ufs_dbn (inode->i_sb,
+			block_bmap (inode, i, lbn & (addr_per_block-1)), boff);
 }
 
 /* XXX - ufs_read_inode is a mess */
@@ -74,8 +144,8 @@
 	/*
 	 * Copy data to the in-core inode.
 	 */
-	inode->i_mode = ufsip->ui_mode;
-	inode->i_nlink = ufsip->ui_nlink;
+	inode->i_mode = ufs_swab16(ufsip->ui_mode);
+	inode->i_nlink = ufs_swab16(ufsip->ui_nlink);
 	if (inode->i_nlink == 0) {
 	        /* XXX */
 	        printk("ufs_read_inode: zero nlink ino %lu  dev %u/%u\n",
@@ -88,7 +158,7 @@
 	               MAJOR(inode->i_dev), MINOR(inode->i_dev));
 	}
 	/* XXX - debugging */
-	if (ufsip->ui_gen == 0) {
+	if (ufs_swab32(ufsip->ui_gen) == 0) {
 	        printk("ufs_read_inode: zero gen ino %lu pblk %lu dev %u/%u\n",
 	               inode->i_ino,
 	               ufs_cgimin(inode->i_sb, ufs_ino2cg(inode)) +
@@ -102,23 +172,23 @@
 	 * random users can't get at these files, since they get dynamically
 	 * "chown()ed" to root.
 	 */
-	if (ufsip->ui_suid == UFS_USEEFT) {
+	if (ufs_swab16(ufsip->ui_suid) == UFS_USEEFT) {
 	        /* EFT */
 	        inode->i_uid = 0;
 	        printk("ufs_read_inode: EFT uid %u ino %lu dev %u/%u, using %u\n",
-	               ufsip->ui_uid, inode->i_ino, MAJOR(inode->i_dev), MINOR(inode->i_dev),
+	               ufs_swab32(ufsip->ui_uid), inode->i_ino, MAJOR(inode->i_dev), MINOR(inode->i_dev),
 	               inode->i_uid);
 	} else {
-	        inode->i_uid = ufsip->ui_suid;
+	        inode->i_uid = ufs_swab16(ufsip->ui_suid);
 	}
-	if (ufsip->ui_suid == UFS_USEEFT) {
+	if (ufs_swab16(ufsip->ui_sgid) == UFS_USEEFT) {
 	        /* EFT */
-	        inode->i_uid = 0;
+	        inode->i_gid = 0;
 	        printk("ufs_read_inode: EFT gid %u ino %lu dev %u/%u, using %u\n",
-	               ufsip->ui_gid, inode->i_ino, MAJOR(inode->i_dev), MINOR(inode->i_dev),
+	               ufs_swab32(ufsip->ui_gid), inode->i_ino, MAJOR(inode->i_dev), MINOR(inode->i_dev),
 	               inode->i_gid);
 	} else {
-	        inode->i_gid = ufsip->ui_sgid;
+	        inode->i_gid = ufs_swab16(ufsip->ui_sgid);
 	}
 
 	/*
@@ -127,13 +197,13 @@
 	 * for the rw code, we may want to mark these inodes as read-only.
 	 * XXX - bug Linus to make i_size a __u64 instead of a __u32.
 	 */
-	inode->u.ufs_i.ui_size = ((__u64)(ufsip->ui_size.val[0])<<32) | (__u64)(ufsip->ui_size.val[1]);
-	inode->i_size = ufsip->ui_size.val[1]; /* XXX - endianity */
-	if (ufsip->ui_size.val[0] != 0) {
-	        inode->i_size = 0xffffffff;
-	        printk("ufs_read_inode: file too big ino %lu dev %u/%u, faking size\n",
-	               inode->i_ino, MAJOR(inode->i_dev), MINOR(inode->i_dev));
-	}
+	inode->u.ufs_i.i_size = ((__u64)(ufs_swab32(ufsip->ui_size.val[0]))<<32) |
+				 (__u64)(ufs_swab32(ufsip->ui_size.val[1]));
+	/* KRR - Just type cast inode->u.ufs_i.i_size into off_t and
+	 * worry about overflow later
+         */
+	inode->i_size = (off_t)inode->u.ufs_i.i_size;
+
 	/*
 	 * Linux doesn't keep tv_usec around in the kernel, so we discard it.
 	 * XXX - I'm not sure what I should do about writing things.  I may
@@ -144,7 +214,7 @@
 	inode->i_mtime = ufsip->ui_mtime.tv_sec;
 	inode->i_ctime = ufsip->ui_ctime.tv_sec;
 	inode->i_blksize = sb->u.ufs_sb.s_fsize;
-	inode->i_blocks = ufsip->ui_blocks;
+	inode->i_blocks = ufs_swab32(ufsip->ui_blocks);
 	inode->i_version = ++event; /* see linux/kernel/sched.c */
 
 	if (S_ISREG(inode->i_mode)) {
@@ -176,26 +246,33 @@
 	        int i;
 
 	        for (i = 0; i < UFS_NDADDR; i++) {
-	                inode->u.ufs_i.ui_db[i] = ufsip->ui_db[i];
+	                inode->u.ufs_i.i_data[i] = ufs_swab32(ufsip->ui_db[i]);
 	        }
 	        for (i = 0; i < UFS_NINDIR; i++) {
-	                inode->u.ufs_i.ui_ib[i] = ufsip->ui_ib[i];
+	                inode->u.ufs_i.i_data[UFS_IND_BLOCK + i] =
+							ufs_swab32(ufsip->ui_ib[i]);
 	        }
 	}
 
+	/* KRR - I need to check the SunOS header files, but for the time
+	 * being, I'm going to tread ui_db[0] and [1] as a __u64 and swab
+	 * them appropriately.  This should clean up any real endian problems,
+	 * but we'll still need to add size checks in the write portion of
+	 * the code.
+	 */
 	if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
-	        /* XXX - should be ui_db[1] on little endian ufs filesystems */
-	        inode->i_rdev = to_kdev_t(ufsip->ui_db[0]);
+		inode->i_rdev = (kdev_t)((__u64)(ufs_swab32(ufsip->ui_db[0]))<<32) |
+				 (__u64)(ufs_swab32(ufsip->ui_db[1]));
 	}
 
 	/* XXX - implement fast and slow symlinks */
 
-	inode->u.ufs_i.ui_flags = ufsip->ui_flags;
-	inode->u.ufs_i.ui_gen = ufsip->ui_gen; /* XXX - is this i_version? */
-	inode->u.ufs_i.ui_shadow = ufsip->ui_shadow; /* XXX */
-	inode->u.ufs_i.ui_uid = ufsip->ui_uid;
-	inode->u.ufs_i.ui_gid = ufsip->ui_gid;
-	inode->u.ufs_i.ui_oeftflag = ufsip->ui_oeftflag;
+	inode->u.ufs_i.i_flags = ufs_swab32(ufsip->ui_flags);
+	inode->u.ufs_i.i_gen = ufs_swab32(ufsip->ui_gen); /* XXX - is this i_version? */
+	inode->u.ufs_i.i_shadow = ufs_swab32(ufsip->ui_shadow); /* XXX */
+	inode->u.ufs_i.i_uid = ufs_swab32(ufsip->ui_uid);
+	inode->u.ufs_i.i_gid = ufs_swab32(ufsip->ui_gid);
+	inode->u.ufs_i.i_oeftflag = ufs_swab32(ufsip->ui_oeftflag);
 
 	brelse(bh);
 
@@ -208,6 +285,11 @@
 
 void ufs_put_inode (struct inode * inode)
 {
+	if (inode->i_sb->u.ufs_sb.s_flags & (UFS_DEBUG|UFS_DEBUG_INODE)) {
+		printk("ufs_put_inode:\n");
+	        ufs_print_inode(inode);
+	}
+
 	if (inode->i_nlink)
 	        return;
 
@@ -226,12 +308,3 @@
 	return;
 }
 
-/*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
- */
diff -u --recursive --new-file v2.1.0/linux/fs/ufs/ufs_namei.c linux/fs/ufs/ufs_namei.c
--- v2.1.0/linux/fs/ufs/ufs_namei.c	Tue May 21 07:07:02 1996
+++ linux/fs/ufs/ufs_namei.c	Thu Oct  3 10:35:01 1996
@@ -6,13 +6,14 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_namei.c,v 1.3 1996/04/25 09:12:07 davem Exp $
+ * $Id: ufs_namei.c,v 1.7 1996/06/01 14:56:49 ecd Exp $
  *
  */
 
 #include <linux/fs.h>
+#include <linux/ufs_fs.h>
 
-extern unsigned int ufs_bmap(struct inode * inode, int block); /* XXX */
+#include <linux/string.h>
 
 /*
  * NOTE! unlike strncmp, ext2_match returns 1 for success, 0 for failure.
@@ -20,15 +21,15 @@
  */
 static int ufs_match (int len, const char * const name, struct ufs_direct * d)
 {
-	if (!d || len > UFS_MAXNAMLEN)
+	if (!d || len > UFS_MAXNAMLEN) /* XXX - name space */
 		return 0;
 	/*
 	 * "" means "." ---> so paths like "/usr/lib//libc.a" work
 	 */
-	if (!len && (d->d_namlen == 1) && (d->d_name[0] == '.') &&
+	if (!len && (ufs_swab16(d->d_namlen) == 1) && (d->d_name[0] == '.') &&
 	   (d->d_name[1] == '\0'))
 		return 1;
-	if (len != d->d_namlen)
+	if (len != ufs_swab16(d->d_namlen))
 		return 0;
 	return !memcmp(name, d->d_name, len);
 }
@@ -41,6 +42,9 @@
 	struct buffer_head * bh;
 	struct ufs_direct * d;
 
+	if (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG)
+		printk("Passed name: %s\nPassed length: %d\n", name, len);
+
 	/*
 	 * Touching /xyzzy in a filesystem toggles debugging messages.
 	 */
@@ -50,6 +54,7 @@
 	        printk("UFS debugging %s\n",
 	               (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG) ?
 	               "on": "off");
+		iput(dir);
 	        return(-ENOENT);
 	}
 
@@ -62,6 +67,7 @@
 	        printk("UFS inode debugging %s\n",
 	               (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG_INODE) ?
 	               "on": "off");
+		iput(dir);
 	        return(-ENOENT);
 	}
 
@@ -71,6 +77,7 @@
 	        printk("UFS namei debugging %s\n",
 	               (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG_NAMEI) ?
 	               "on": "off");
+		iput(dir);
 	        return(-ENOENT);
 	}
 
@@ -80,6 +87,7 @@
 	        printk("UFS symlink debugging %s\n",
 	               (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG_LINKS) ?
 	               "on": "off");
+		iput(dir);
 	        return(-ENOENT);
 	}
 
@@ -99,19 +107,21 @@
 	        }
 	        if (fragno == 0) {
 	                /* XXX - bug bug bug */
+			iput(dir);
 	                return(-ENOENT);
 	        }
 	        bh = bread(dir->i_dev, fragno, dir->i_sb->s_blocksize);
 	        if (bh == NULL) {
 	                printk("ufs_lookup: bread failed: ino %lu, lfragno %lu",
 	                       dir->i_ino, lfragno);
+			iput(dir);
 	                return(-EIO);
 	        }
 	        d = (struct ufs_direct *)(bh->b_data);
-	        while (((char *)d - bh->b_data + d->d_reclen) <=
+	        while (((char *)d - bh->b_data + ufs_swab16(d->d_reclen)) <=
 	               dir->i_sb->s_blocksize) {
 	                /* XXX - skip block if d_reclen or d_namlen is 0 */
-	                if ((d->d_reclen == 0) || (d->d_namlen == 0)) {
+	                if ((ufs_swab16(d->d_reclen) == 0) || (ufs_swab16(d->d_namlen) == 0)) {
 	                        if (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG) {
 	                                printk("ufs_lookup: skipped space in directory, ino %lu\n",
 	                                       dir->i_ino);
@@ -120,35 +130,28 @@
 	                }
 	                if (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG) {
 	                        printk("lfragno 0x%lx  direct d 0x%x  d_ino %u  d_reclen %u  d_namlen %u  d_name `%s'\n",
-	                               lfragno, (unsigned int)d, d->d_ino, d->d_reclen, d->d_namlen, d->d_name);
+	                               lfragno, (unsigned int)d, ufs_swab32(d->d_ino), ufs_swab16(d->d_reclen), ufs_swab16(d->d_namlen), d->d_name);
 	                }
-	                if ((d->d_namlen == len) &&
+	                if ((ufs_swab16(d->d_namlen) == len) &&
 	                    /* XXX - don't use strncmp() - see ext2fs */
 	                    (ufs_match(len, name, d))) {
 	                        /* We have a match */
-	                        *result = iget(dir->i_sb, d->d_ino);
+	                        *result = iget(dir->i_sb, ufs_swab32(d->d_ino));
 	                        brelse(bh);
+				iput(dir);
 	                        return(0);
 	                } else {
 	                        /* XXX - bounds checking */
 	                        if (dir->i_sb->u.ufs_sb.s_flags & UFS_DEBUG) {
 	                                printk("ufs_lookup: wanted (%s,%d) got (%s,%d)\n",
-	                                       name, len, d->d_name, d->d_namlen);
+	                                       name, len, d->d_name, ufs_swab16(d->d_namlen));
 	                        }
 	                }
-	                d = (struct ufs_direct *)((char *)d + d->d_reclen);
+	                d = (struct ufs_direct *)((char *)d + ufs_swab16(d->d_reclen));
 	        }
 	        brelse(bh);
 	}
+	iput(dir);
 	return(-ENOENT);
 }
 
-/*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
- */
diff -u --recursive --new-file v2.1.0/linux/fs/ufs/ufs_super.c linux/fs/ufs/ufs_super.c
--- v2.1.0/linux/fs/ufs/ufs_super.c	Mon Jul  8 10:21:46 1996
+++ linux/fs/ufs/ufs_super.c	Thu Oct  3 10:35:01 1996
@@ -6,7 +6,7 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_super.c,v 1.3 1996/04/25 09:12:09 davem Exp $
+ * $Id: ufs_super.c,v 1.17 1996/09/03 07:15:53 ecd Exp $
  *
  */
 
@@ -23,18 +23,16 @@
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/ufs_fs.h>
-#include <linux/module.h>
 #include <linux/locks.h>
 
 #include <asm/segment.h>
 
+int ufs_need_swab = 0;
+
 struct super_block * ufs_read_super(struct super_block * sb, void * data, int silent);
 void ufs_put_super (struct super_block * sb);
 void ufs_statfs(struct super_block * sb, struct statfs * buf, int bufsize);
 
-extern void ufs_read_inode(struct inode * inode);
-extern void ufs_put_inode(struct inode * inode);
-
 static struct super_operations ufs_super_ops = {
 	ufs_read_inode,
 	NULL,			/* notify_change() */
@@ -72,6 +70,20 @@
 }
 #endif
 
+static char error_buf[1024];
+
+void ufs_warning (struct super_block * sb, const char * function,
+		  const char * fmt, ...)
+{
+	va_list args;
+
+	va_start (args, fmt);
+	vsprintf (error_buf, fmt, args);
+	va_end (args);
+	printk (KERN_WARNING "UFS warning (device %s): %s: %s\n",
+		kdevname(sb->s_dev), function, error_buf);
+}
+
 #if 0 /* unused */
 static void
 ufs_print_super_stuff(struct super_block * sb, struct ufs_superblock * usb)
@@ -116,26 +128,21 @@
 	if (!(bh1 = bread(sb->s_dev, UFS_SBLOCK/BLOCK_SIZE, BLOCK_SIZE)) ||
 	    !(bh2 = bread(sb->s_dev, (UFS_SBLOCK + BLOCK_SIZE)/BLOCK_SIZE,
 	                  BLOCK_SIZE))) {
-	        sb->s_dev = 0;
-	        unlock_super (sb);
 	        if (bh1) {
 	                brelse(bh1);
 	        }
 	        printk ("ufs_read_super: unable to read superblock\n");
 
-		MOD_DEC_USE_COUNT;
-	        return(NULL);
+		goto ufs_read_super_lose;
 	}
 	/* XXX - redo this so we can free it later... */
 	usb = (struct ufs_superblock *)__get_free_page(GFP_KERNEL); 
 	if (usb == NULL) {
-		sb->s_dev=0;
-		unlock_super(sb);
 		brelse(bh1);
 		brelse(bh2);
 	        printk ("ufs_read_super: get_free_page() failed\n");
-		MOD_DEC_USE_COUNT;
-		return (NULL);
+
+		goto ufs_read_super_lose;
 	}
 
 	memcpy((char *)usb, bh1->b_data, BLOCK_SIZE);
@@ -145,54 +152,51 @@
 	brelse(bh1);
 	brelse(bh2);
 
-	if (usb->fs_magic != UFS_MAGIC) {
-	        /* XXX - replace hard-coded constant with a byte-swap macro */
-	        if (usb->fs_magic == 0x54190100) {
-	                printk ("ufs_read_super: can't grok byteswapped fs on dev %d/%d\n",
-	                        MAJOR(sb->s_dev), MINOR(sb->s_dev));
-	                silent = 1;
-	        }
-	        sb->s_dev = 0;
-	        unlock_super (sb);
-	        if (!silent)
-	                printk ("ufs_read_super: bad magic number 0x%8.8x on dev %d/%d\n",
-	                        usb->fs_magic, MAJOR(sb->s_dev),
-	                        MINOR(sb->s_dev));
-		MOD_DEC_USE_COUNT;
-	        return(NULL);
+	ufs_need_swab = 0;
+	sb->s_magic = ufs_swab32(usb->fs_magic);
+	if (sb->s_magic != UFS_MAGIC) {
+		ufs_need_swab = 1;
+		sb->s_magic = ufs_swab32(usb->fs_magic);
+		if (sb->s_magic != UFS_MAGIC) {
+	                printk ("ufs_read_super: bad magic number 0x%8.8x "
+				"on dev %d/%d\n", sb->s_magic,
+				MAJOR(sb->s_dev), MINOR(sb->s_dev));
+
+			goto ufs_read_super_lose;
+		}
 	}
 
 	/* We found a UFS filesystem on this device. */
 
 	/* XXX - parse args */
 
-	if (usb->fs_bsize != UFS_BSIZE) {
-	        printk("ufs_read_super: fs_bsize %d != %d\n", usb->fs_bsize,
+	if (ufs_swab32(usb->fs_bsize) != UFS_BSIZE) {
+	        printk("ufs_read_super: fs_bsize %d != %d\n", ufs_swab32(usb->fs_bsize),
 	               UFS_BSIZE);
 	        goto ufs_read_super_lose;
 	}
 
-	if (usb->fs_fsize != UFS_FSIZE) {
-	        printk("ufs_read_super: fs_fsize %d != %d\n", usb->fs_fsize,
+	if (ufs_swab32(usb->fs_fsize) != UFS_FSIZE) {
+	        printk("ufs_read_super: fs_fsize %d != %d\n", ufs_swab32(usb->fs_fsize),
 	               UFS_FSIZE);
 	        goto ufs_read_super_lose;
 	}
 
-	if (usb->fs_nindir != UFS_NINDIR) {
-	        printk("ufs_read_super: fs_nindir %d != %d\n", usb->fs_nindir,
-	               UFS_NINDIR);
-	        printk("ufs_read_super: fucking Sun blows me\n");
-	}
-
+#ifdef DEBUG_UFS_SUPER
 	printk("ufs_read_super: fs last mounted on \"%s\"\n", usb->fs_fsmnt);
+#endif
 
-	if (usb->fs_state == UFS_FSOK - usb->fs_time) {
+	if (ufs_swab32(usb->fs_state) == UFS_FSOK - ufs_swab32(usb->fs_time)) {
 	        switch(usb->fs_clean) {
 	                case UFS_FSCLEAN:
+#ifdef DEBUG_UFS_SUPER
 	                  printk("ufs_read_super: fs is clean\n");
+#endif
 	                  break;
 	                case UFS_FSSTABLE:
+#ifdef DEBUG_UFS_SUPER
 	                  printk("ufs_read_super: fs is stable\n");
+#endif
 	                  break;
 	                case UFS_FSACTIVE:
 	                  printk("ufs_read_super: fs is active\n");
@@ -216,31 +220,41 @@
 
 	/* XXX - sanity check sb fields */
 
-	sb->s_blocksize = usb->fs_fsize;
-	sb->s_blocksize_bits = 10;  /* XXX */
+	/* KRR - Why are we not using fs_bsize for blocksize? */
+	sb->s_blocksize = ufs_swab32(usb->fs_fsize);
+	sb->s_blocksize_bits = ufs_swab32(usb->fs_fshift);
 	/* XXX - sb->s_lock */
 	sb->s_op = &ufs_super_ops;
 	sb->dq_op = 0; /* XXX */
-	sb->s_magic = usb->fs_magic;
+	/* KRR - defined above - sb->s_magic = usb->fs_magic; */
 	/* sb->s_time */
 	/* sb->s_wait */
 	/* XXX - sb->u.ufs_sb */
 	sb->u.ufs_sb.s_raw_sb = usb; /* XXX - maybe move this to the top */
 	sb->u.ufs_sb.s_flags = 0;
-	sb->u.ufs_sb.s_ncg = usb->fs_ncg;
-	sb->u.ufs_sb.s_ipg = usb->fs_ipg;
-	sb->u.ufs_sb.s_fpg = usb->fs_fpg;
-	sb->u.ufs_sb.s_fsize = usb->fs_fsize;
-	sb->u.ufs_sb.s_bsize = usb->fs_bsize;
-	sb->u.ufs_sb.s_iblkno = usb->fs_iblkno;
-	sb->u.ufs_sb.s_dblkno = usb->fs_dblkno;
-	sb->u.ufs_sb.s_cgoffset = usb->fs_cgoffset;
-	sb->u.ufs_sb.s_cgmask = usb->fs_cgmask;
-	sb->u.ufs_sb.s_inopb = usb->fs_inopb;
-	sb->u.ufs_sb.s_fsfrag = usb->fs_frag; /* XXX - rename this later */
+	sb->u.ufs_sb.s_ncg = ufs_swab32(usb->fs_ncg);
+	sb->u.ufs_sb.s_ipg = ufs_swab32(usb->fs_ipg);
+	sb->u.ufs_sb.s_fpg = ufs_swab32(usb->fs_fpg);
+	sb->u.ufs_sb.s_fsize = ufs_swab32(usb->fs_fsize);
+	sb->u.ufs_sb.s_fmask = ufs_swab32(usb->fs_fmask);
+	sb->u.ufs_sb.s_fshift = ufs_swab32(usb->fs_fshift);
+	sb->u.ufs_sb.s_bsize = ufs_swab32(usb->fs_bsize);
+	sb->u.ufs_sb.s_bmask = ufs_swab32(usb->fs_bmask);
+	sb->u.ufs_sb.s_bshift = ufs_swab32(usb->fs_bshift);
+	sb->u.ufs_sb.s_iblkno = ufs_swab32(usb->fs_iblkno);
+	sb->u.ufs_sb.s_dblkno = ufs_swab32(usb->fs_dblkno);
+	sb->u.ufs_sb.s_cgoffset = ufs_swab32(usb->fs_cgoffset);
+	sb->u.ufs_sb.s_cgmask = ufs_swab32(usb->fs_cgmask);
+	sb->u.ufs_sb.s_inopb = ufs_swab32(usb->fs_inopb);
+	sb->u.ufs_sb.s_lshift = ufs_swab32(usb->fs_bshift) - ufs_swab32(usb->fs_fshift);
+	sb->u.ufs_sb.s_lmask = ~((ufs_swab32(usb->fs_fmask) - ufs_swab32(usb->fs_bmask))
+					>> ufs_swab32(usb->fs_fshift));
+	sb->u.ufs_sb.s_fsfrag = ufs_swab32(usb->fs_frag); /* XXX - rename this later */
 	sb->s_mounted = iget(sb, UFS_ROOTINO);
 
+#ifdef DEBUG_UFS_SUPER
 	printk("ufs_read_super: inopb %u\n", sb->u.ufs_sb.s_inopb);
+#endif
 	/*
 	 * XXX - read cg structs?
 	 */
@@ -248,16 +262,19 @@
 	unlock_super(sb);
 	return(sb);
 
-       ufs_read_super_lose:
+ufs_read_super_lose:
 	/* XXX - clean up */
+	sb->s_dev = 0;
+	unlock_super (sb);
 	MOD_DEC_USE_COUNT;
 	return(NULL);
 }
 
 void ufs_put_super (struct super_block * sb)
 {
-
-	printk("ufs_put_super\n"); /* XXX */
+        if (sb->u.ufs_sb.s_flags & UFS_DEBUG) {
+		printk("ufs_put_super\n"); /* XXX */
+        }
 
 	lock_super (sb);
 	/* XXX - sync fs data, set state to ok, and flush buffers */
@@ -275,31 +292,22 @@
 {
 	struct statfs tmp;
 
-	printk("ufs_statfs\n"); /* XXX */
+        if (sb->u.ufs_sb.s_flags & UFS_DEBUG) {
+		printk("ufs_statfs\n"); /* XXX */
+        }
+
 	tmp.f_type = sb->s_magic;
-	tmp.f_bsize = PAGE_SIZE;
-	tmp.f_blocks = sb->u.ufs_sb.s_raw_sb->fs_dsize;
-	tmp.f_bfree = sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nbfree;
-	tmp.f_bavail =  sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nbfree; /* XXX */
+	tmp.f_bsize = sb->s_blocksize;
+	tmp.f_blocks = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_dsize);
+	tmp.f_bfree = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nbfree);
+	tmp.f_bavail =  ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nbfree);
 	tmp.f_files = sb->u.ufs_sb.s_ncg * sb->u.ufs_sb.s_ipg;
-	tmp.f_ffree = sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nifree;
-	tmp.f_fsid.val[0] = sb->u.ufs_sb.s_raw_sb->fs_id[0];
-	tmp.f_fsid.val[1] = sb->u.ufs_sb.s_raw_sb->fs_id[1];
+	tmp.f_ffree = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_cstotal.cs_nifree);
+	tmp.f_fsid.val[0] = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_id[0]);
+	tmp.f_fsid.val[1] = ufs_swab32(sb->u.ufs_sb.s_raw_sb->fs_id[1]);
 	tmp.f_namelen = UFS_MAXNAMLEN;
-/*        tmp.f_spare[6] */
 
 	memcpy_tofs(buf, &tmp, bufsiz);
-
 	return;
 }
 
-
-/*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
- */
diff -u --recursive --new-file v2.1.0/linux/fs/ufs/ufs_symlink.c linux/fs/ufs/ufs_symlink.c
--- v2.1.0/linux/fs/ufs/ufs_symlink.c	Thu Apr 25 13:37:31 1996
+++ linux/fs/ufs/ufs_symlink.c	Thu Oct  3 10:35:01 1996
@@ -6,17 +6,16 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_symlink.c,v 1.3 1996/04/25 09:12:11 davem Exp $
+ * $Id: ufs_symlink.c,v 1.5 1996/05/19 03:55:56 krioles Exp $
  *
  */
 
 #include <linux/fs.h>
+#include <linux/ufs_fs.h>
 #include <linux/sched.h>
 
 #include <asm/segment.h>
 
-extern int ufs_bmap (struct inode *, int);
-
 static int
 ufs_readlink(struct inode * inode, char * buffer, int buflen)
 {
@@ -55,7 +54,7 @@
 		link = bh->b_data;
 	}
 	else {
-	        link = (char *)&(inode->u.ufs_i.ui_db[0]);
+	        link = (char *)&(inode->u.ufs_i.i_data[0]);
 	}
 	i = 0;
 	while (i < buflen && (c = link[i])) {
@@ -122,7 +121,7 @@
 	        link = bh->b_data;
 	} else {
 	        /* fast symlink */
-	        link = (char *)&(inode->u.ufs_i.ui_db[0]);
+	        link = (char *)&(inode->u.ufs_i.i_data[0]);
 	}
 	current->link_count++;
 	error = open_namei (link, flag, mode, res_inode, dir);
@@ -172,12 +171,3 @@
 	NULL,			/* smap */
 };
 
-/*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
- */
diff -u --recursive --new-file v2.1.0/linux/fs/umsdos/emd.c linux/fs/umsdos/emd.c
--- v2.1.0/linux/fs/umsdos/emd.c	Wed Feb  7 09:39:29 1996
+++ linux/fs/umsdos/emd.c	Tue Oct  1 10:29:13 1996
@@ -23,11 +23,10 @@
 /*
 	Read a file into kernel space memory
 */
-int umsdos_file_read_kmem(
-	struct inode *inode,
+long umsdos_file_read_kmem (struct inode *inode,
 	struct file *filp,
 	char *buf,
-	int count)
+	unsigned long count)
 {
 	int ret;
 	int old_fs = get_fs();	
@@ -39,11 +38,10 @@
 /*
 	Write to a file from kernel space
 */
-int umsdos_file_write_kmem(
-	struct inode *inode,
+long umsdos_file_write_kmem (struct inode *inode,
 	struct file *filp,
 	const char *buf,
-	int count)
+	unsigned long count)
 {
 	int ret;
 	int old_fs = get_fs();
@@ -60,11 +58,10 @@
 
 	Return 0 if ok, a negative error code if not.
 */
-int umsdos_emd_dir_write (
-	struct inode *emd_dir,
+long umsdos_emd_dir_write (struct inode *emd_dir,
 	struct file *filp,
 	char *buf,	/* buffer in kernel memory, not in user space */
-	int count)
+	unsigned long count)
 {
 	int written;
 	filp->f_flags = 0;
@@ -76,18 +73,17 @@
 	The block of data is NOT in user space.
 	Return 0 if ok, -EIO if any error.
 */
-int umsdos_emd_dir_read (
-	struct inode *emd_dir,
+long umsdos_emd_dir_read (struct inode *emd_dir,
 	struct file *filp,
 	char *buf,	/* buffer in kernel memory, not in user space */
-	int count)
+	unsigned long count)
 {
-	int ret = 0;
+	long int ret = 0;
 	int sizeread;
 	filp->f_flags = 0;
 	sizeread = umsdos_file_read_kmem (emd_dir,filp,buf,count);
 	if (sizeread != count){
-		printk ("UMSDOS: problem with EMD file. Can't read pos = %Ld (%d != %d)\n"
+		printk ("UMSDOS: problem with EMD file. Can't read pos = %Ld (%d != %ld)\n"
 			,filp->f_pos,sizeread,count);
 		ret = -EIO;
 	}
diff -u --recursive --new-file v2.1.0/linux/include/asm-alpha/sigcontext.h linux/include/asm-alpha/sigcontext.h
--- v2.1.0/linux/include/asm-alpha/sigcontext.h	Thu Jul 20 09:14:32 1995
+++ linux/include/asm-alpha/sigcontext.h	Mon Sep 30 17:43:29 1996
@@ -1,7 +1,7 @@
 #ifndef _ASMAXP_SIGCONTEXT_H
 #define _ASMAXP_SIGCONTEXT_H
 
-struct sigcontext_struct {
+struct sigcontext {
 	/*
 	 * what should we have here? I'd probably better use the same
 	 * stack layout as OSF/1, just in case we ever want to try
diff -u --recursive --new-file v2.1.0/linux/include/asm-alpha/stat.h linux/include/asm-alpha/stat.h
--- v2.1.0/linux/include/asm-alpha/stat.h	Fri Apr 12 09:49:44 1996
+++ linux/include/asm-alpha/stat.h	Mon Sep 30 17:42:43 1996
@@ -1,7 +1,7 @@
 #ifndef _ALPHA_STAT_H
 #define _ALPHA_STAT_H
 
-struct old_stat {
+struct __old_kernel_stat {
 	unsigned int	st_dev;
 	unsigned int	st_ino;
 	unsigned int	st_mode;
@@ -19,7 +19,7 @@
 	unsigned int	st_gen;
 };
 
-struct new_stat {
+struct stat {
 	unsigned int	st_dev;
 	unsigned int	st_ino;
 	unsigned int	st_mode;
diff -u --recursive --new-file v2.1.0/linux/include/asm-i386/segment.h linux/include/asm-i386/segment.h
--- v2.1.0/linux/include/asm-i386/segment.h	Tue Sep 24 10:43:03 1996
+++ linux/include/asm-i386/segment.h	Tue Oct  1 13:08:43 1996
@@ -33,15 +33,8 @@
 #define put_fs_word(x,addr) put_user((x),(unsigned short *)(addr))
 #define put_fs_long(x,addr) put_user((x),(unsigned int *)(addr))
 
-static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
-{
-	memcpy(to, from, n);
-}
-
-static inline void memcpy_tofs(void * to, const void * from, unsigned long n)
-{
-	memcpy(to, from, n);
-}
+#define memcpy_fromfs(to,from,n) memcpy((to),(from),(n))
+#define memcpy_tofs(to,from,n)   memcpy((to),(from),(n))
 
 /*
  * The fs value determines whether argument validity checking should be
@@ -53,11 +46,7 @@
       
 #define get_fs()	(current->tss.segment)
 #define set_fs(x)	(current->tss.segment = (x))
-
-static inline unsigned long get_ds(void)
-{
-	return KERNEL_DS;
-}
+#define get_ds()	(KERNEL_DS)
 
 #endif /* __ASSEMBLY__ */
 
diff -u --recursive --new-file v2.1.0/linux/include/asm-i386/semaphore.h linux/include/asm-i386/semaphore.h
--- v2.1.0/linux/include/asm-i386/semaphore.h	Sat Sep 14 11:18:46 1996
+++ linux/include/asm-i386/semaphore.h	Tue Oct  1 15:54:49 1996
@@ -18,8 +18,8 @@
 #define MUTEX ((struct semaphore) { 1, 0, NULL })
 #define MUTEX_LOCKED ((struct semaphore) { 0, 0, NULL })
 
-asmlinkage void down_failed(void /* special register calling convention */);
-asmlinkage void up_wakeup(void /* special register calling convention */);
+asmlinkage void __down_failed(void /* special register calling convention */);
+asmlinkage void __up_wakeup(void /* special register calling convention */);
 
 extern void __down(struct semaphore * sem);
 extern void __up(struct semaphore * sem);
@@ -32,17 +32,17 @@
 extern inline void down(struct semaphore * sem)
 {
 	__asm__ __volatile__(
-		"# atomic down operation\n"
-		"1:\n\t"
-		"movl $1b,%%eax\n\t"
+		"# atomic down operation\n\t"
 #ifdef __SMP__
 		"lock ; "
 #endif
 		"decl %0\n\t"
-		"js " SYMBOL_NAME_STR(down_failed)
+		"movl $1f,%%eax\n\t"
+		"js " SYMBOL_NAME_STR(__down_failed)
+		"\n1:"
 		:/* no outputs */
 		:"m" (sem->count), "c" (sem)
-		:"ax","dx","memory");
+		:"ax", "memory");
 }
 
 /*
@@ -55,16 +55,16 @@
 {
 	__asm__ __volatile__(
 		"# atomic up operation\n\t"
-		"movl $1f,%%eax\n\t"
 #ifdef __SMP__
 		"lock ; "
 #endif
 		"incl %0\n\t"
-		"jle " SYMBOL_NAME_STR(up_wakeup)
+		"movl $1f,%%eax\n\t"
+		"jle " SYMBOL_NAME_STR(__up_wakeup)
 		"\n1:"
 		:/* no outputs */
 		:"m" (sem->count), "c" (sem)
-		:"ax", "dx", "memory");
+		:"ax", "memory");
 }
 
 #endif
diff -u --recursive --new-file v2.1.0/linux/include/asm-i386/sigcontext.h linux/include/asm-i386/sigcontext.h
--- v2.1.0/linux/include/asm-i386/sigcontext.h	Wed Apr 17 12:23:31 1996
+++ linux/include/asm-i386/sigcontext.h	Mon Sep 30 17:43:21 1996
@@ -26,7 +26,7 @@
 	unsigned long	status;
 };
 
-struct sigcontext_struct {
+struct sigcontext {
 	unsigned short gs, __gsh;
 	unsigned short fs, __fsh;
 	unsigned short es, __esh;
diff -u --recursive --new-file v2.1.0/linux/include/asm-i386/stat.h linux/include/asm-i386/stat.h
--- v2.1.0/linux/include/asm-i386/stat.h	Sat Jun 10 18:35:54 1995
+++ linux/include/asm-i386/stat.h	Mon Sep 30 17:42:31 1996
@@ -1,7 +1,7 @@
 #ifndef _I386_STAT_H
 #define _I386_STAT_H
 
-struct old_stat {
+struct __old_kernel_stat {
 	unsigned short st_dev;
 	unsigned short st_ino;
 	unsigned short st_mode;
@@ -15,7 +15,7 @@
 	unsigned long  st_ctime;
 };
 
-struct new_stat {
+struct stat {
 	unsigned short st_dev;
 	unsigned short __pad1;
 	unsigned long st_ino;
diff -u --recursive --new-file v2.1.0/linux/include/asm-i386/unistd.h linux/include/asm-i386/unistd.h
--- v2.1.0/linux/include/asm-i386/unistd.h	Fri Mar 22 08:34:02 1996
+++ linux/include/asm-i386/unistd.h	Thu Oct  3 11:23:15 1996
@@ -170,6 +170,17 @@
 #define __NR_nanosleep		162
 #define __NR_mremap		163
 
+/* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
+
+#define __syscall_return(type, res) \
+do { \
+	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+		errno = -(res); \
+		res = -1; \
+	} \
+	return (type) (res); \
+} while (0)
+
 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 #define _syscall0(type,name) \
 type name(void) \
@@ -178,10 +189,7 @@
 __asm__ volatile ("int $0x80" \
 	: "=a" (__res) \
 	: "0" (__NR_##name)); \
-if (__res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+__syscall_return(type,__res); \
 }
 
 #define _syscall1(type,name,type1,arg1) \
@@ -191,10 +199,7 @@
 __asm__ volatile ("int $0x80" \
 	: "=a" (__res) \
 	: "0" (__NR_##name),"b" ((long)(arg1))); \
-if (__res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+__syscall_return(type,__res); \
 }
 
 #define _syscall2(type,name,type1,arg1,type2,arg2) \
@@ -204,10 +209,7 @@
 __asm__ volatile ("int $0x80" \
 	: "=a" (__res) \
 	: "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
-if (__res >= 0) \
-	return (type) __res; \
-errno = -__res; \
-return -1; \
+__syscall_return(type,__res); \
 }
 
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
@@ -218,10 +220,7 @@
 	: "=a" (__res) \
 	: "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
 		  "d" ((long)(arg3))); \
-if (__res>=0) \
-	return (type) __res; \
-errno=-__res; \
-return -1; \
+__syscall_return(type,__res); \
 }
 
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
@@ -232,10 +231,7 @@
 	: "=a" (__res) \
 	: "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
 	  "d" ((long)(arg3)),"S" ((long)(arg4))); \
-if (__res>=0) \
-	return (type) __res; \
-errno=-__res; \
-return -1; \
+__syscall_return(type,__res); \
 } 
 
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
@@ -247,10 +243,7 @@
 	: "=a" (__res) \
 	: "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
 	  "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
-if (__res>=0) \
-	return (type) __res; \
-errno=-__res; \
-return -1; \
+__syscall_return(type,__res); \
 }
 
 #ifdef __KERNEL_SYSCALLS__
diff -u --recursive --new-file v2.1.0/linux/include/linux/icmp.h linux/include/linux/icmp.h
--- v2.1.0/linux/include/linux/icmp.h	Wed Jul 12 06:41:59 1995
+++ linux/include/linux/icmp.h	Wed Oct  2 13:16:09 1996
@@ -46,6 +46,10 @@
 #define ICMP_HOST_ANO		10
 #define ICMP_NET_UNR_TOS	11
 #define ICMP_HOST_UNR_TOS	12
+#define ICMP_PKT_FILTERED	13	/* Packet filtered */
+#define ICMP_PREC_VIOLATION	14	/* Precedence violation */
+#define ICMP_PREC_CUTOFF	15	/* Precedence cut off */
+#define NR_ICMP_UNREACH	15	  /* instead of hardcoding immediate value */
 
 /* Codes for REDIRECT. */
 #define ICMP_REDIR_NET		0	/* Redirect Net			*/
diff -u --recursive --new-file v2.1.0/linux/include/linux/pci.h linux/include/linux/pci.h
--- v2.1.0/linux/include/linux/pci.h	Wed Sep 11 11:45:10 1996
+++ linux/include/linux/pci.h	Thu Oct  3 10:36:55 1996
@@ -530,7 +530,8 @@
 
 #define PCI_VENDOR_ID_S3		0x5333
 #define PCI_DEVICE_ID_S3_ViRGE		0x5631
-#define PCI_DEVICE_ID_S3_811		0x8811
+#define PCI_DEVICE_ID_S3_TRIO		0x8811
+#define PCI_DEVICE_ID_S3_ViRGE_VX	0x883d
 #define PCI_DEVICE_ID_S3_868		0x8880
 #define PCI_DEVICE_ID_S3_928		0x88b0
 #define PCI_DEVICE_ID_S3_864_1		0x88c0
diff -u --recursive --new-file v2.1.0/linux/include/linux/ufs_fs.h linux/include/linux/ufs_fs.h
--- v2.1.0/linux/include/linux/ufs_fs.h	Sun Aug  4 14:38:04 1996
+++ linux/include/linux/ufs_fs.h	Thu Oct  3 10:35:01 1996
@@ -6,7 +6,7 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_fs.h,v 1.1 1996/04/21 14:45:11 davem Exp $
+ * $Id: ufs_fs.h,v 1.7 1996/08/13 19:27:59 ecd Exp $
  *
  */
 
@@ -31,6 +31,10 @@
 #define UFS_NDADDR 12
 #define UFS_NINDIR 3
 
+#define UFS_IND_BLOCK	(UFS_NDADDR + 0)
+#define UFS_DIND_BLOCK	(UFS_NDADDR + 1)
+#define UFS_TIND_BLOCK	(UFS_NDADDR + 2)
+
 #define UFS_ROOTINO 2
 
 #define UFS_USEEFT  ((__u16)65535)
@@ -47,6 +51,8 @@
 #define UFS_DEBUG_NAMEI 0x00000004
 #define UFS_DEBUG_LINKS 0x00000008
 
+#define UFS_ADDR_PER_BLOCK(sb)		((sb)->u.ufs_sb.s_bsize >> 2)
+#define UFS_ADDR_PER_BLOCK_BITS(sb)	((sb)->u.ufs_sb.s_bshift - 2)
 
 /* Test if the inode number is valid. */
 #define ufs_ino_ok(inode)  ((inode->i_ino < 2) &&  \
@@ -66,6 +72,10 @@
 
 #define	UFS_MAXNAMLEN 255
 
+#define ufs_lbn(sb, block)		((block) >> (sb)->u.ufs_sb.s_lshift)
+#define ufs_boff(sb, block)		((block) & ~((sb)->u.ufs_sb.s_lmask))
+#define ufs_dbn(sb, block, boff)	((block) + ufs_boff((sb), (boff)))
+
 struct ufs_direct {
 	__u32  d_ino;			/* inode number of this entry */
 	__u16  d_reclen;		/* length of this entry */
@@ -93,61 +103,78 @@
 struct ufs_superblock {
 	__u32	fs_link;	/* UNUSED */
 	__u32	fs_rlink;	/* UNUSED */
-	__u32	fs_sblkno;
-	__u32	fs_cblkno;
-	__u32	fs_iblkno;
-	__u32	fs_dblkno;
-	__u32	fs_cgoffset;
-	__u32	fs_cgmask;
-	time_t	fs_time;	/* XXX - check type */
-	__u32	fs_size;
-	__u32	fs_dsize;
-	__u32	fs_ncg;
-	__u32	fs_bsize;
-	__u32	fs_fsize;
-	__u32	fs_frag;
-	__u32	fs_minfree;
-	__u32	fs_rotdelay;
-	__u32	fs_rps;
-	__u32	fs_bmask;
-	__u32	fs_fmask;
-	__u32	fs_bshift;
-	__u32	fs_fshift;
-	__u32	fs_maxcontig;
-	__u32	fs_maxbpg;
-	__u32	fs_fragshift;
-	__u32	fs_fsbtodb;
-	__u32	fs_sbsize;
-	__u32	fs_csmask;
-	__u32	fs_csshift;
-	__u32	fs_nindir;
-	__u32	fs_inopb;
-	__u32	fs_nspf;
-	__u32	fs_optim;
-	__u32	fs_XXX1;
-	__u32	fs_interleave;
-	__u32	fs_trackskew;
-	__u32	fs_id[2];
-	__u32	fs_csaddr;
-	__u32	fs_cssize;
-	__u32	fs_cgsize;
-	__u32	fs_ntrak;
-	__u32	fs_nsect;
-	__u32	fs_spc;
-	__u32	fs_ncyl;
-	__u32	fs_cpg;
-	__u32	fs_ipg;
-	__u32	fs_fpg;
-	struct ufs_csum fs_cstotal;
-	__u8	fs_fmod;
-	__u8	fs_clean;
-	__u8	fs_ronly;
-	__u8	fs_flags;
-	__u8	fs_fsmnt[MAXMNTLEN];
-	__u32	fs_cgrotor;
-	struct ufs_csum * fs_csp[MAXCSBUFS];
-	__u32	fs_cpc;
-	__u16	fs_opostbl[16][8];	/* old rotation block list head */
+	__u32	fs_sblkno;	/* addr of super-block in filesys */
+	__u32	fs_cblkno;	/* offset of cyl-block in filesys */
+	__u32	fs_iblkno;	/* offset of inode-blocks in filesys */
+	__u32	fs_dblkno;	/* offset of first data after cg */
+	__u32	fs_cgoffset;	/* cylinder group offset in cylinder */
+	__u32	fs_cgmask;	/* used to calc mod fs_ntrak */
+	time_t	fs_time;	/* last time written */
+	__u32	fs_size;	/* number of blocks in fs */
+	__u32	fs_dsize;	/* number of data blocks in fs */
+	__u32	fs_ncg;		/* number of cylinder groups */
+	__u32	fs_bsize;	/* size of basic blocks in fs */
+	__u32	fs_fsize;	/* size of frag blocks in fs */
+	__u32	fs_frag;	/* number of frags in a block in fs */
+/* these are configuration parameters */
+	__u32	fs_minfree;	/* minimum percentage of free blocks */
+	__u32	fs_rotdelay;	/* num of ms for optimal next block */
+	__u32	fs_rps;		/* disk revolutions per second */
+/* these fields can be computed from the others */
+	__u32	fs_bmask;	/* ``blkoff'' calc of blk offsets */
+	__u32	fs_fmask;	/* ``fragoff'' calc of frag offsets */
+	__u32	fs_bshift;	/* ``lblkno'' calc of logical blkno */
+	__u32	fs_fshift;	/* ``numfrags'' calc number of frags */
+/* these are configuration parameters */
+	__u32	fs_maxcontig;	/* max number of contiguous blks */
+	__u32	fs_maxbpg;	/* max number of blks per cyl group */
+/* these fields can be computed from the others */
+	__u32	fs_fragshift;	/* block to frag shift */
+	__u32	fs_fsbtodb;	/* fsbtodb and dbtofsb shift constant */
+	__u32	fs_sbsize;	/* actual size of super block */
+	__u32	fs_csmask;	/* csum block offset */
+	__u32	fs_csshift;	/* csum block number */
+	__u32	fs_nindir;	/* value of NINDIR */
+	__u32	fs_inopb;	/* value of INOPB */
+	__u32	fs_nspf;	/* value of NSPF */
+/* yet another configuration parameter */
+	__u32	fs_optim;	/* optimization preference, see below */
+/* these fields are derived from the hardware */
+	__u32	fs_npsect;	/* # sectors/track including spares */
+	__u32	fs_interleave;	/* hardware sector interleave */
+	__u32	fs_trackskew;	/* sector 0 skew, per track */
+/* a unique id for this filesystem (currently unused and unmaintained) */
+/* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
+/* Neither of those fields is used in the Tahoe code right now but */
+/* there could be problems if they are.                            */
+	__u32	fs_id[2];	/* file system id */
+/* sizes determined by number of cylinder groups and their sizes */
+	__u32	fs_csaddr;	/* blk addr of cyl grp summary area */
+	__u32	fs_cssize;	/* size of cyl grp summary area */
+	__u32	fs_cgsize;	/* cylinder group size */
+/* these fields are derived from the hardware */
+	__u32	fs_ntrak;	/* tracks per cylinder */
+	__u32	fs_nsect;	/* sectors per track */
+	__u32	fs_spc;		/* sectors per cylinder */
+/* this comes from the disk driver partitioning */
+	__u32	fs_ncyl;	/* cylinders in file system */
+/* these fields can be computed from the others */
+	__u32	fs_cpg;		/* cylinders per group */
+	__u32	fs_ipg;		/* inodes per group */
+	__u32	fs_fpg;		/* blocks per group * fs_frag */
+/* this data must be re-computed after crashes */
+	struct ufs_csum fs_cstotal;	/* cylinder summary information */
+/* these fields are cleared at mount time */
+	__u8	fs_fmod;	/* super block modified flag */
+	__u8	fs_clean;	/* file system is clean flag */
+	__u8	fs_ronly;	/* mounted read-only flag */
+	__u8	fs_flags;	/* currently unused flag */
+	__u8	fs_fsmnt[MAXMNTLEN];	/* name mounted on */
+/* these fields retain the current block allocation info */
+	__u32	fs_cgrotor;	/* last cg searched */
+	struct ufs_csum * fs_csp[MAXCSBUFS];	/* list of fs_cs info buffers */
+	__u32	fs_cpc;		/* cyl per cycle in postbl */
+	__u16	fs_opostbl[16][8];	/* old rotation block list head */	
 	__s32	fs_sparecon[55];	/* reserved for future constants */
 	__s32	fs_state;		/* file system state time stamp */
 	ufsquad	fs_qbmask;		/* ~usb_bmask - for use with __s64 size */
@@ -184,15 +211,60 @@
 	__u32	ui_oeftflag;		/* 0x7c reserved */
 };
 
+
+#ifdef __KERNEL__
+/*
+ * Function prototypes
+ */
+
+/* ufs_inode.c */
+extern int ufs_bmap (struct inode *, int);
+extern void ufs_read_inode(struct inode * inode);
+extern void ufs_put_inode(struct inode * inode);
+
+extern void ufs_print_inode (struct inode *);
+
+/* ufs_namei.c */
+extern int ufs_lookup (struct inode *, const char *, int, struct inode **);
+
+/* ufs_super.c */
+extern void ufs_warning (struct super_block *, const char *, const char *, ...)
+        __attribute__ ((format (printf, 3, 4)));
 extern int init_ufs_fs(void);
 
-#endif /* __LINUX_UFS_FS_H */
 /*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
+ * Inodes and files operations
  */
+
+/* ufs_dir.c */
+extern struct inode_operations ufs_dir_inode_operations;
+extern struct file_operations ufs_dir_operations;
+
+/* ufs_file.c */
+extern struct inode_operations ufs_file_inode_operations;
+extern struct file_operations ufs_file_operations;
+
+/* ufs_symlink.c */
+extern struct inode_operations ufs_symlink_inode_operations;
+extern struct file_operations ufs_symlink_operations;
+
+/* Byte swapping 32/16-bit quantities into little endian format. */
+extern int ufs_need_swab;
+
+extern __inline__ __u32 ufs_swab32(__u32 value)
+{
+	return (ufs_need_swab ? ((value >> 24) |
+				((value >> 8) & 0xff00) |
+				((value << 8) & 0xff0000) |
+				 (value << 24)) : value);
+}
+
+extern __inline__ __u16 ufs_swab16(__u16 value)
+{
+	return (ufs_need_swab ? ((value >> 8) |
+				 (value << 8)) : value);
+}
+
+#endif	/* __KERNEL__ */
+
+#endif /* __LINUX_UFS_FS_H */
diff -u --recursive --new-file v2.1.0/linux/include/linux/ufs_fs_i.h linux/include/linux/ufs_fs_i.h
--- v2.1.0/linux/include/linux/ufs_fs_i.h	Sun Aug  4 14:38:04 1996
+++ linux/include/linux/ufs_fs_i.h	Thu Oct  3 10:35:01 1996
@@ -6,25 +6,22 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_fs_i.h,v 1.1 1996/04/21 14:45:13 davem Exp $
+ * $Id: ufs_fs_i.h,v 1.2 1996/05/03 04:02:25 davem Exp $
  *
  */
 
 #ifndef _LINUX_UFS_FS_I_H
 #define _LINUX_UFS_FS_I_H
 
-#include <linux/ufs_fs.h>
-
 struct ufs_inode_info {
-	__u64	ui_size;
-	__u32	ui_flags;
-	__u32	ui_gen;
-	__u32	ui_shadow;
-	__u32	ui_uid;
-	__u32	ui_gid;
-	__u32	ui_oeftflag;
-	__u32	ui_db[UFS_NDADDR];
-	__u32	ui_ib[UFS_NINDIR];
+	__u32	i_data[15];
+	__u64	i_size;
+	__u32	i_flags;
+	__u32	i_gen;
+	__u32	i_shadow;
+	__u32	i_uid;
+	__u32	i_gid;
+	__u32	i_oeftflag;
 };
 
 #endif /* _LINUX_UFS_FS_I_H */
diff -u --recursive --new-file v2.1.0/linux/include/linux/ufs_fs_sb.h linux/include/linux/ufs_fs_sb.h
--- v2.1.0/linux/include/linux/ufs_fs_sb.h	Mon Apr 22 10:59:40 1996
+++ linux/include/linux/ufs_fs_sb.h	Thu Oct  3 10:35:01 1996
@@ -6,13 +6,14 @@
  * Laboratory for Computer Science Research Computing Facility
  * Rutgers, The State University of New Jersey
  *
- * $Id: ufs_fs_sb.h,v 1.1 1996/04/21 14:45:15 davem Exp $
+ * $Id: ufs_fs_sb.h,v 1.6 1996/06/01 15:31:08 ecd Exp $
  *
  */
 
 #ifndef __LINUX_UFS_FS_SB_H
 #define __LINUX_UFS_FS_SB_H
 
+#include <linux/ufs_fs.h>
 
 struct ufs_sb_info {
 	struct ufs_superblock * s_raw_sb;
@@ -21,23 +22,19 @@
 	__u32	s_ipg;	 /* used in ufs_read_inode */
 	__u32	s_fpg;
 	__u32	s_fsize;
+	__u32	s_fshift;
+	__u32	s_fmask;
 	__u32	s_bsize;
+	__u32	s_bmask;
+	__u32	s_bshift;
 	__u32	s_iblkno;
 	__u32	s_dblkno;
 	__u32	s_cgoffset;
 	__u32	s_cgmask;
 	__u32	s_inopb;
+	__u32	s_lshift;
+	__u32	s_lmask;
 	__u32	s_fsfrag;
 };
 
 #endif /* __LINUX_UFS_FS_SB_H */
-
-/*
- * Local Variables: ***
- * c-indent-level: 8 ***
- * c-continued-statement-offset: 8 ***
- * c-brace-offset: -8 ***
- * c-argdecl-indent: 0 ***
- * c-label-offset: -8 ***
- * End: ***
- */
diff -u --recursive --new-file v2.1.0/linux/net/ipv4/arp.c linux/net/ipv4/arp.c
--- v2.1.0/linux/net/ipv4/arp.c	Thu Aug  1 15:43:04 1996
+++ linux/net/ipv4/arp.c	Wed Oct  2 14:43:06 1996
@@ -1984,13 +1984,14 @@
 	{
 		if (!mask && ip)
 			return -EINVAL;
-		if (!dev)
+		if (!dev) {
 			dev = dev_getbytype(r->arp_ha.sa_family);
+			if (!dev)
+				return -ENODEV;
+		}
 	}
 	else
 	{
-		if (ip_chk_addr(ip) && dev->type != ARPHRD_METRICOM)
-			return -EINVAL;
 		if (!dev)
 		{
 			struct rtable * rt;
@@ -1999,9 +2000,13 @@
 				return -ENETUNREACH;
 			dev = rt->rt_dev;
 			ip_rt_put(rt);
+			if (!dev)
+				return -ENODEV;
 		}
+		if (dev->type != ARPHRD_METRICOM && ip_chk_addr(ip))
+			return -EINVAL;
 	}
-	if (!dev || (dev->flags&(IFF_LOOPBACK|IFF_NOARP)))
+	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP))
 		return -ENODEV;
 
 	if (r->arp_ha.sa_family != dev->type)	
diff -u --recursive --new-file v2.1.0/linux/net/ipv4/icmp.c linux/net/ipv4/icmp.c
--- v2.1.0/linux/net/ipv4/icmp.c	Wed Sep 25 11:10:02 1996
+++ linux/net/ipv4/icmp.c	Wed Oct  2 13:16:56 1996
@@ -283,7 +283,10 @@
   { ENETUNREACH,	1 },	/*	ICMP_NET_ANO		*/
   { EHOSTUNREACH,	1 },	/*	ICMP_HOST_ANO		*/
   { EOPNOTSUPP,		0 },	/*	ICMP_NET_UNR_TOS	*/
-  { EOPNOTSUPP,		0 }	/*	ICMP_HOST_UNR_TOS	*/
+  { EOPNOTSUPP,		0 },	/*	ICMP_HOST_UNR_TOS	*/
+  { EOPNOTSUPP,		1 },	/*	ICMP_PKT_FILTERED	*/
+  { EOPNOTSUPP,		1 },	/*	ICMP_PREC_VIOLATION	*/
+  { EOPNOTSUPP,		1 }	/*	ICMP_PREC_CUTOFF	*/
 };
 
 /*
@@ -734,7 +737,7 @@
 			default:
 				break;
 		}
-		if(icmph->code>15)	/* Invalid type */
+		if(icmph->code>NR_ICMP_UNREACH)	/* Invalid type */
 			return;
 	}
 	
diff -u --recursive --new-file v2.1.0/linux/net/ipv4/raw.c linux/net/ipv4/raw.c
--- v2.1.0/linux/net/ipv4/raw.c	Thu Sep  5 08:29:26 1996
+++ linux/net/ipv4/raw.c	Wed Oct  2 13:16:09 1996
@@ -100,7 +100,7 @@
 		sk->error_report(sk);
 	}
 
-	if(code<13)
+	if(code<=NR_ICMP_UNREACH)
 	{
 		sk->err = icmp_err_convert[code & 0xff].errno;
 		sk->error_report(sk);
diff -u --recursive --new-file v2.1.0/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
--- v2.1.0/linux/net/ipv4/tcp.c	Thu Sep  5 08:29:26 1996
+++ linux/net/ipv4/tcp.c	Wed Oct  2 13:16:09 1996
@@ -573,7 +573,7 @@
 	 * until we time out, or the user gives up.
 	 */
 
-	if (code < 13)
+	if(code<=NR_ICMP_UNREACH)
 	{
 		if(icmp_err_convert[code].fatal || sk->state == TCP_SYN_SENT || sk->state == TCP_SYN_RECV)
 		{
diff -u --recursive --new-file v2.1.0/linux/net/ipv4/udp.c linux/net/ipv4/udp.c
--- v2.1.0/linux/net/ipv4/udp.c	Tue Jun  4 15:34:43 1996
+++ linux/net/ipv4/udp.c	Wed Oct  2 13:16:09 1996
@@ -193,7 +193,7 @@
 	/* 4.1.3.3. */
 	/* After the comment above, that should be no surprise. */
 
-	if (code < 13 && icmp_err_convert[code].fatal)
+	if(code<=NR_ICMP_UNREACH && icmp_err_convert[code].fatal)
 	{
 		/*
 		 *	4.x BSD compatibility item. Break RFC1122 to
