## Automatically generated incremental diff
## From:   linux-2.2.18-pre19
## To:     linux-2.2.18-pre20
## Robot:  $Id: make-incremental-diff,v 1.5 2001/12/01 08:32:36 hpa Exp hpa $

diff -urN linux-2.2.18-pre19/CREDITS linux/CREDITS
--- linux-2.2.18-pre19/CREDITS	Mon Dec  3 20:39:34 2001
+++ linux/CREDITS	Mon Dec  3 20:40:09 2001
@@ -2177,17 +2177,14 @@
 S: USA
 
 N: Stephen Tweedie
-E: sct@dcs.ed.ac.uk
+E: sct@redhat.com
 P: 1024/E7A417AD E2 FE A4 20 34 EC ED FC 7D 7E 67 8D E0 31 D1 69
+P: 1024D/43BE7544 D2A4 8556 08E6 90E7 076C  BA3F 243F 20A4 43BE 7544
 D: Second extended file system developer
 D: General filesystem hacker
 D: kswap vm management code
-S: Dept. of Computer Science
-S: University of Edinburgh
-S: JCMB, The King's Buildings
-S: Mayfield Road
-S: Edinburgh 
-S: EH9 3JZ
+S: 44 Campbell Park Crescent
+S: Edinburgh EH13 0HT
 S: United Kingdom
 
 N: Thomas Uhl
diff -urN linux-2.2.18-pre19/Makefile linux/Makefile
--- linux-2.2.18-pre19/Makefile	Mon Dec  3 20:39:34 2001
+++ linux/Makefile	Mon Dec  3 20:40:16 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 2
 SUBLEVEL = 18
-EXTRAVERSION = pre19
+EXTRAVERSION = pre20
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 
@@ -335,6 +335,7 @@
 	MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \
 	mkdir -p $$MODLIB; \
 	rm -f $$MODLIB/build; \
+	[ `/sbin/insmod -V 2>&1 | head -1 | awk '/^insmod version /{split("$3", a, /\./); printf "%d%03d%03d\n", a[1], a[2], a[3];}'`0 -ge 20030140 ] && \
 	ln -s `pwd` $$MODLIB/build; \
 	cd modules; \
 	MODULES=""; \
diff -urN linux-2.2.18-pre19/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c
--- linux-2.2.18-pre19/arch/i386/kernel/process.c	Wed May  3 17:16:31 2000
+++ linux/arch/i386/kernel/process.c	Mon Dec  3 20:40:17 2001
@@ -31,6 +31,7 @@
 #include <linux/smp.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/mc146818rtc.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -253,8 +254,10 @@
  */
 void machine_real_restart(unsigned char *code, int length)
 {
+	unsigned long flags;
+	
 	cli();
-
+	
 	/* Write zero to CMOS register number 0x0f, which the BIOS POST
 	   routine will recognize as telling it to do a proper reboot.  (Well
 	   that's what this book in front of me says -- it may only apply to
@@ -264,8 +267,9 @@
 	   `outb_p' is needed instead of just `outb'.  Use it to be on the
 	   safe side. */
 
-	outb_p (0x8f, 0x70);
-	outb_p (0x00, 0x71);
+	spin_lock_irqsave(&rtc_lock, flags);
+	CMOS_WRITE(0x00, 0x8f);
+	spin_unlock_irqrestore(&rtc_lock, flags);
 
 	/* Remap the kernel at virtual address zero, as well as offset zero
 	   from the kernel segment.  This assumes the kernel segment starts at
diff -urN linux-2.2.18-pre19/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
--- linux-2.2.18-pre19/arch/i386/kernel/setup.c	Mon Dec  3 20:39:34 2001
+++ linux/arch/i386/kernel/setup.c	Mon Dec  3 20:40:17 2001
@@ -35,6 +35,10 @@
  *
  *	Added Cyrix III initial detection code
  *	Alan Cox <alan@redhat.com>, Septembr 2000
+ *
+ *      Improve cache size calculation
+ *      Asit Mallick <asit.k.mallick@intel.com>, October 2000
+ *      Andrew Ip <aip@turbolinux.com>, October 2000
  */
 
 /*
@@ -914,7 +918,7 @@
 	int i;
 	char *p = NULL;
 	extern void mcheck_init(void);
-
+	
 	c->loops_per_jiffy = loops_per_jiffy;
 	c->x86_cache_size = -1;
 
@@ -961,55 +965,97 @@
 
 	if (c->cpuid_level > 1) {
 		/* supports eax=2  call */
-		int edx, dummy;
-			
-		cpuid(2, &dummy, &dummy, &dummy, &edx);
+		int regs[4];
+		int l1c=0, l1d=0, l2=0, l3=0;	/* Cache sizes */
 
-		/* We need only the LSB */
-		edx &= 0xff;
+		cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
+		/* Least significant byte of eax says how many times
+		 * to call cpuid with value 2 to get cache and TLB
+		 * info.
+		 */
+		if ((regs[0] & 0xFF) != 1 )
+			printk(KERN_WARNING "Multiple cache reports are not supported yet\n");
 
-		switch (edx) {
-			case 0x40:
-				c->x86_cache_size = 0;
-				break;
+		c->x86_cache_size = 0;
 
-			case 0x41: /* 4-way 128 */
-				c->x86_cache_size = 128;
-				break;
+		for ( i = 0 ; i < 4 ; i++ ) 
+		{
+			int j;
 
-			case 0x42: /* 4-way 256 */
-			case 0x82: /* 8-way 256 */
-				c->x86_cache_size = 256;
-				break;
+	                 if ( regs[i] < 0 )
+	                         continue; /* no useful data */
 
-			case 0x43: /* 4-way 512 */
-				c->x86_cache_size = 512;
-				break;
-
-			case 0x44: /* 4-way 1024 */
-			case 0x84: /* 8-way 1024 */
-				c->x86_cache_size = 1024;
-				break;
+	                 /* look at all the bytes returned */
 
-			case 0x45: /* 4-way 2048 */
-			case 0x85: /* 8-way 2048 */
-				c->x86_cache_size = 2048;
-				break;
-
-			default:
-				c->x86_cache_size = 0;
-				break;
+	                 for ( j = ( i == 0 ? 8:0 ) ; j < 25 ; j+=8 )
+	                 {
+				unsigned char rh = regs[i]>>j;
+				unsigned char rl;
+				
+				rl = rh & 0x0F;
+				rh >>=4;
+				
+				switch(rh)
+				{
+					case 2:
+						if(rl)
+						{
+							printk("%dK L3 cache\n", (rl-1)*512);
+							l3 += (rl-1)*512;
+						}
+						break;
+					case 4:
+					case 8:
+						if(rl)
+						{
+							printk("%dK L2 cache (%d way)\n",128<<(rl-1), rh);
+							l2 += 128<<(rl-1);
+						}
+						break;
+					
+					/*
+					 *	L1 caches do not count for SMP switching weights,
+					 *	they are shadowed by L2.
+					 */
+					 
+					case 6:
+		                 		if(rh==6 && rl > 5)
+		                 		{
+							printk("%dK L1 data cache\n", 8<<(rl - 6));
+							l1d+=8<<(rl-6);
+						}
+						break;
+					case 7:
+		                 		printk("%dK L1 instruction cache\n",
+		                 			rl?(16<<(rl-1)):12);
+		                 		l1c+=rl?(16<<(rl-1)):12;
+		                 		break;
+				}	              
+			}   			
 		}
+		if(l1c && l1d)
+			printk("CPU: L1 I Cache: %dK  L1 D Cache: %dK\n",
+				l1c, l1d);
+		if(l2)
+			printk("CPU: L2 Cache: %dK\n", l2);
+		if(l3)
+			printk("CPU: L3 Cache: %dK\n", l3);
+			
+		/*
+		 *	Assuming L3 is shared. The L1 cache is shadowed by L2
+		 *	so doesn't need to be included.
+		 */
+		 
+		c->x86_cache_size += l2;
 	}
 	
 	/*
 	 *	Intel finally adopted the AMD/Cyrix extended id naming
-	 *	stuff
+	 *	stuff for the 'Pentium IV'
 	 */
 	 
 	if(c->x86_vendor ==X86_VENDOR_INTEL && c->x86 == 15)
 	{
-		c->x86 = 6;
 		intel_model(c);
 		return;
 	}
@@ -1158,12 +1204,12 @@
 #endif
 		p += sprintf(p,"processor\t: %d\n"
 			       "vendor_id\t: %s\n"
-			       "cpu family\t: %c\n"
+			       "cpu family\t: %d\n"
 			       "model\t\t: %d\n"
 			       "model name\t: %s\n",
 			       n,
 			       c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
-			       c->x86 + '0',
+			       c->x86,
 			       c->x86_model,
 			       c->x86_model_id[0] ? c->x86_model_id : "unknown");
 
diff -urN linux-2.2.18-pre19/arch/sparc/config.in linux/arch/sparc/config.in
--- linux-2.2.18-pre19/arch/sparc/config.in	Wed Jun  7 14:26:42 2000
+++ linux/arch/sparc/config.in	Mon Dec  3 20:40:17 2001
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.68.2.1 1999/09/22 11:37:34 jj Exp $
+# $Id: config.in,v 1.68.2.7 2000/10/24 21:00:53 davem Exp $
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/config-language.txt.
 #
@@ -23,6 +23,9 @@
 
 define_bool CONFIG_VT y
 define_bool CONFIG_VT_CONSOLE y
+
+# Identify this as a Sparc32 build
+define_bool CONFIG_SPARC32 y
 
 bool 'Support for AP1000 multicomputer' CONFIG_AP1000
 bool 'Symmetric multi-processing support (does not work on sun4/sun4c)' CONFIG_SMP
diff -urN linux-2.2.18-pre19/arch/sparc64/config.in linux/arch/sparc64/config.in
--- linux-2.2.18-pre19/arch/sparc64/config.in	Mon Dec  3 20:39:36 2001
+++ linux/arch/sparc64/config.in	Mon Dec  3 20:40:17 2001
@@ -1,4 +1,4 @@
-# $Id: config.in,v 1.67.2.11 2000/07/27 01:50:59 davem Exp $
+# $Id: config.in,v 1.67.2.13 2000/10/24 21:00:53 davem Exp $
 # For a description of the syntax of this configuration file,
 # see Documentation/kbuild/config-language.txt.
 #
@@ -26,12 +26,8 @@
 
 bool 'Symmetric multi-processing support' CONFIG_SMP
 
-mainmenu_option next_comment
-comment 'Console drivers'
-bool 'PROM console' CONFIG_PROM_CONSOLE
-bool 'Support Frame buffer devices' CONFIG_FB
-source drivers/video/Config.in
-endmenu
+# Identify this as a Sparc64 build
+define_bool CONFIG_SPARC64 y
 
 # Global things across all Sun machines.
 define_bool CONFIG_SBUS y
@@ -45,6 +41,14 @@
 define_bool CONFIG_SUN_AUXIO y
 define_bool CONFIG_SUN_IO y
 bool 'PCI support' CONFIG_PCI
+
+mainmenu_option next_comment
+comment 'Console drivers'
+bool 'PROM console' CONFIG_PROM_CONSOLE
+bool 'Support Frame buffer devices' CONFIG_FB
+source drivers/video/Config.in
+endmenu
+
 source drivers/sbus/char/Config.in
 source drivers/sbus/audio/Config.in
 
diff -urN linux-2.2.18-pre19/arch/sparc64/defconfig linux/arch/sparc64/defconfig
--- linux-2.2.18-pre19/arch/sparc64/defconfig	Mon Dec  3 20:39:36 2001
+++ linux/arch/sparc64/defconfig	Mon Dec  3 20:40:17 2001
@@ -20,6 +20,18 @@
 CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
 # CONFIG_SMP is not set
+CONFIG_SPARC64=y
+CONFIG_SBUS=y
+CONFIG_SBUSCHAR=y
+CONFIG_SUN_MOUSE=y
+CONFIG_SERIAL=y
+CONFIG_SUN_SERIAL=y
+CONFIG_SERIAL_CONSOLE=y
+CONFIG_SUN_KEYBOARD=y
+CONFIG_SUN_CONSOLE=y
+CONFIG_SUN_AUXIO=y
+CONFIG_SUN_IO=y
+CONFIG_PCI=y
 
 #
 # Console drivers
@@ -48,17 +60,6 @@
 CONFIG_FBCON_FONTWIDTH8_ONLY=y
 CONFIG_FONT_SUN8x16=y
 # CONFIG_FBCON_FONTS is not set
-CONFIG_SBUS=y
-CONFIG_SBUSCHAR=y
-CONFIG_SUN_MOUSE=y
-CONFIG_SERIAL=y
-CONFIG_SUN_SERIAL=y
-CONFIG_SERIAL_CONSOLE=y
-CONFIG_SUN_KEYBOARD=y
-CONFIG_SUN_CONSOLE=y
-CONFIG_SUN_AUXIO=y
-CONFIG_SUN_IO=y
-CONFIG_PCI=y
 
 #
 # Misc Linux/SPARC drivers
@@ -75,9 +76,7 @@
 # Linux/SPARC audio subsystem (EXPERIMENTAL)
 #
 CONFIG_SPARCAUDIO=y
-# CONFIG_SPARCAUDIO_AMD7930 is not set
 CONFIG_SPARCAUDIO_CS4231=y
-# CONFIG_SPARCAUDIO_DBRI is not set
 # CONFIG_SPARCAUDIO_DUMMY is not set
 CONFIG_SUN_OPENPROMFS=m
 CONFIG_PCI_OLD_PROC=y
@@ -164,6 +163,7 @@
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DIVERT is not set
 # CONFIG_LLC is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
@@ -316,11 +316,11 @@
 #
 CONFIG_CODA_FS=m
 CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
 CONFIG_NFSD=m
-# CONFIG_NFSD_SUN is not set
+CONFIG_NFSD_V3=y
 CONFIG_SUNRPC=y
 CONFIG_LOCKD=y
-CONFIG_NFS_V3=y
 CONFIG_SMB_FS=m
 # CONFIG_SMB_NLS_DEFAULT is not set
 CONFIG_NCP_FS=m
diff -urN linux-2.2.18-pre19/arch/sparc64/kernel/psycho.c linux/arch/sparc64/kernel/psycho.c
--- linux-2.2.18-pre19/arch/sparc64/kernel/psycho.c	Mon Sep  4 10:39:16 2000
+++ linux/arch/sparc64/kernel/psycho.c	Mon Dec  3 20:40:17 2001
@@ -1,4 +1,4 @@
-/* $Id: psycho.c,v 1.85.2.10 2000/06/14 07:41:19 davem Exp $
+/* $Id: psycho.c,v 1.85.2.11 2000/10/24 21:00:53 davem Exp $
  * psycho.c: Ultra/AX U2P PCI controller support.
  *
  * Copyright (C) 1997 David S. Miller (davem@caipfs.rutgers.edu)
@@ -30,13 +30,6 @@
 #define dprintf printk
 #endif
 
-unsigned long pci_dvma_offset = 0x00000000UL;
-unsigned long pci_dvma_mask = 0xffffffffUL;
-
-#define PCI_DVMA_HASH_NONE	0xffffffffffffffffUL
-unsigned long pci_dvma_v2p_hash[PCI_DVMA_HASHSZ];
-unsigned long pci_dvma_p2v_hash[PCI_DVMA_HASHSZ];
-
 /* If this is non-NULL it points to Sabre's DMA write-sync register
  * which is used by drivers of devices behind bridges other than APB
  * to synchronize DMA write streams with interrupt delivery.
@@ -69,6 +62,13 @@
 }
 
 #else
+
+unsigned long pci_dvma_offset = 0x00000000UL;
+unsigned long pci_dvma_mask = 0xffffffffUL;
+
+#define PCI_DVMA_HASH_NONE	0xffffffffffffffffUL
+unsigned long pci_dvma_v2p_hash[PCI_DVMA_HASHSZ];
+unsigned long pci_dvma_p2v_hash[PCI_DVMA_HASHSZ];
 
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
diff -urN linux-2.2.18-pre19/arch/sparc64/kernel/sparc64_ksyms.c linux/arch/sparc64/kernel/sparc64_ksyms.c
--- linux-2.2.18-pre19/arch/sparc64/kernel/sparc64_ksyms.c	Mon Dec  3 20:39:36 2001
+++ linux/arch/sparc64/kernel/sparc64_ksyms.c	Mon Dec  3 20:40:17 2001
@@ -1,4 +1,4 @@
-/* $Id: sparc64_ksyms.c,v 1.58.2.9 2000/09/05 00:10:54 davem Exp $
+/* $Id: sparc64_ksyms.c,v 1.58.2.11 2000/10/25 21:17:44 davem Exp $
  * arch/sparc64/kernel/sparc64_ksyms.c: Sparc64 specific ksyms support.
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -47,6 +47,7 @@
 #endif
 #include <asm/a.out.h>
 #include <asm/svr4.h>
+#include <asm/elf.h>
 
 struct poll {
 	int fd;
@@ -89,6 +90,7 @@
 extern int __ashrdi3(int, int);
 
 extern void dump_thread(struct pt_regs *, struct user *);
+extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs);
 
 #ifdef __SMP__
 extern spinlock_t kernel_flag;
@@ -206,6 +208,7 @@
 
 /* Should really be in linux/kernel/ksyms.c */
 EXPORT_SYMBOL(dump_thread);
+EXPORT_SYMBOL(dump_fpu);
 
 /* math-emu wants this */
 EXPORT_SYMBOL(die_if_kernel);
@@ -244,6 +247,7 @@
 #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91)
 EXPORT_SYMBOL(strlen);
 #endif
+EXPORT_SYMBOL(__strlen_user);
 EXPORT_SYMBOL(strnlen);
 EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strncpy);
diff -urN linux-2.2.18-pre19/drivers/block/ide-probe.c linux/drivers/block/ide-probe.c
--- linux-2.2.18-pre19/drivers/block/ide-probe.c	Mon Dec  3 20:39:42 2001
+++ linux/drivers/block/ide-probe.c	Mon Dec  3 20:40:17 2001
@@ -37,6 +37,7 @@
 #include <linux/genhd.h>
 #include <linux/malloc.h>
 #include <linux/delay.h>
+#include <linux/mc146818rtc.h> /* CMOS defines */
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
diff -urN linux-2.2.18-pre19/drivers/char/rio/riotty.c linux/drivers/char/rio/riotty.c
--- linux-2.2.18-pre19/drivers/char/rio/riotty.c	Mon Dec  3 20:39:43 2001
+++ linux/drivers/char/rio/riotty.c	Mon Dec  3 20:40:17 2001
@@ -452,7 +452,7 @@
 				*/
 				PortP->State |= RIO_WOPEN;
 				rio_spin_unlock_irqrestore(&PortP->portSem, flags);
-				if (RIODelay (&PortP, HUNDRED_MS) == RIO_FAIL)
+				if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL)
 #if 0
 				if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH))
 #endif
diff -urN linux-2.2.18-pre19/drivers/net/bonding.c linux/drivers/net/bonding.c
--- linux-2.2.18-pre19/drivers/net/bonding.c	Mon Sep  4 10:39:19 2000
+++ linux/drivers/net/bonding.c	Mon Dec  3 20:40:18 2001
@@ -176,6 +176,9 @@
 {
 	struct device *slave = dev_get(ifr->ifr_slave);
 
+	if (!capable(CAP_NET_ADMIN))
+		return -EPERM;
+
 #ifdef BONDING_DEBUG
 	printk("master=%s, slave=%s\n", master->name, slave->name);
 #endif
diff -urN linux-2.2.18-pre19/drivers/net/xpds/xpds-encap-fr.c linux/drivers/net/xpds/xpds-encap-fr.c
--- linux-2.2.18-pre19/drivers/net/xpds/xpds-encap-fr.c	Mon Dec  3 20:39:43 2001
+++ linux/drivers/net/xpds/xpds-encap-fr.c	Mon Dec  3 20:40:18 2001
@@ -740,7 +740,7 @@
 	kfree (buffer);
 
 	if (rc) {
-		xpds_data[card_num].stats.tx_errors++;
+		if (rc != -EBUSY) xpds_data[card_num].stats.tx_errors++;
 	} else {
 		xpds_data[card_num].stats.tx_packets++;
 		dev_kfree_skb(skb);
diff -urN linux-2.2.18-pre19/drivers/net/xpds/xpds.c linux/drivers/net/xpds/xpds.c
--- linux-2.2.18-pre19/drivers/net/xpds/xpds.c	Mon Dec  3 20:39:43 2001
+++ linux/drivers/net/xpds/xpds.c	Mon Dec  3 20:40:18 2001
@@ -4,7 +4,7 @@
  * License to copy and distribute is GNU General Public License, version 2.
  */
 #ifndef VERSION_STRING
-#define VERSION_STRING	"$Revision: 1.33 $"
+#define VERSION_STRING	"release-20001009k"
 #endif
 
 #define LT_IND_AI	0xc
diff -urN linux-2.2.18-pre19/drivers/sbus/audio/Config.in linux/drivers/sbus/audio/Config.in
--- linux-2.2.18-pre19/drivers/sbus/audio/Config.in	Wed Nov 18 09:06:05 1998
+++ linux/drivers/sbus/audio/Config.in	Mon Dec  3 20:40:18 2001
@@ -7,8 +7,10 @@
   comment 'Linux/SPARC audio subsystem (EXPERIMENTAL)'
 
   tristate 'Audio support (EXPERIMENTAL)' CONFIG_SPARCAUDIO
-  dep_tristate '  AMD7930 Lowlevel Driver' CONFIG_SPARCAUDIO_AMD7930 $CONFIG_SPARCAUDIO
+  if [ "$CONFIG_SPARC64" != "y" ]; then
+    dep_tristate '  AMD7930 Lowlevel Driver' CONFIG_SPARCAUDIO_AMD7930 $CONFIG_SPARCAUDIO
+    dep_tristate '  DBRI Lowlevel Driver' CONFIG_SPARCAUDIO_DBRI $CONFIG_SPARCAUDIO
+  fi
   dep_tristate '  CS4231 Lowlevel Driver' CONFIG_SPARCAUDIO_CS4231 $CONFIG_SPARCAUDIO
-  dep_tristate '  DBRI Lowlevel Driver' CONFIG_SPARCAUDIO_DBRI $CONFIG_SPARCAUDIO
   dep_tristate '  Dummy Lowlevel Driver' CONFIG_SPARCAUDIO_DUMMY $CONFIG_SPARCAUDIO
 fi
diff -urN linux-2.2.18-pre19/drivers/scsi/esp.c linux/drivers/scsi/esp.c
--- linux-2.2.18-pre19/drivers/scsi/esp.c	Wed Jun  7 14:26:43 2000
+++ linux/drivers/scsi/esp.c	Mon Dec  3 20:40:18 2001
@@ -396,7 +396,7 @@
  *
  * struct scsi_cmnd:
  *
- *   We keep track of the syncronous capabilities of a target
+ *   We keep track of the synchronous capabilities of a target
  *   in the device member, using sync_min_period and
  *   sync_max_offset.  These are the values we directly write
  *   into the ESP registers while running a command.  If offset
@@ -2521,7 +2521,7 @@
 	 * on HME broken adapters because we skip the HME fifo
 	 * workaround code in esp_handle() if we are doing data
 	 * phase things.  We don't want to fuck directly with
-	 * the fifo like that, especially if doing syncronous
+	 * the fifo like that, especially if doing synchronous
 	 * transfers!  Also, will need to double the count on
 	 * HME if we are doing wide transfers, as the HME fifo
 	 * will move and count 16-bit quantities during wide data.
diff -urN linux-2.2.18-pre19/drivers/scsi/ppa.c linux/drivers/scsi/ppa.c
--- linux-2.2.18-pre19/drivers/scsi/ppa.c	Mon Sep  4 10:39:21 2000
+++ linux/drivers/scsi/ppa.c	Mon Dec  3 20:40:18 2001
@@ -299,12 +299,11 @@
     unsigned char r;
 
     k = PPA_SPIN_TMO;
-    do {
-	r = r_str(ppb);
-	k--;
-	udelay(1);
+    /* Wait for bit 6 and 7 - PJC */
+    for (r = r_str (ppb); ((r & 0xc0)!=0xc0) && (k); k--) {
+	    udelay (1);
+	    r = r_str (ppb);
     }
-    while (!(r & 0x80) && (k));
 
     /*
      * return some status information.
@@ -653,11 +652,7 @@
 	    (v == WRITE_6) ||
 	    (v == WRITE_10));
 
-    /*
-     * We only get here if the drive is ready to comunicate,
-     * hence no need for a full ppa_wait.
-     */
-    r = (r_str(ppb) & 0xf0);
+    r = ppa_wait(host_no); /* Need a ppa_wait() - PJC */
 
     while (r != (unsigned char) 0xf0) {
 	/*
@@ -695,7 +690,7 @@
 	    }
 	}
 	/* Now check to see if the drive is ready to comunicate */
-	r = (r_str(ppb) & 0xf0);
+	r = ppa_wait(host_no); /* need ppa_wait() - PJC */
 	/* If not, drop back down to the scheduler and wait a timer tick */
 	if (!(r & 0x80))
 	    return 0;
diff -urN linux-2.2.18-pre19/drivers/scsi/ppa.h linux/drivers/scsi/ppa.h
--- linux-2.2.18-pre19/drivers/scsi/ppa.h	Mon Sep  4 10:39:21 2000
+++ linux/drivers/scsi/ppa.h	Mon Dec  3 20:40:18 2001
@@ -10,7 +10,7 @@
 #ifndef _PPA_H
 #define _PPA_H
 
-#define   PPA_VERSION   "2.03 (for Linux 2.2.x)"
+#define   PPA_VERSION   "2.05 (for Linux 2.2.x)"
 
 /* 
  * this driver has been hacked by Matteo Frigo (athena@theory.lcs.mit.edu)
@@ -51,6 +51,13 @@
  *    CONFIG_SCSI_PPA_HAVE_PEDANTIC => CONFIG_SCSI_IZIP_EPP16
  *    added CONFIG_SCSI_IZIP_SLOW_CTR option
  *                                                      [2.03]
+ *
+ * Use ppa_wait() to check for ready AND connected status bits
+ * Add ppa_wait() calls to ppa_completion()
+ *  by Peter Cherriman <pjc@ecs.soton.ac.uk> and
+ *     Tim Waugh <twaugh@redhat.com>
+ *                                                      [2.04]
+ * Fix kernel panic on scsi timeout, 2000-08-18		[2.05]
  */
 /* ------ END OF USER CONFIGURABLE PARAMETERS ----- */
 
@@ -166,6 +173,7 @@
 		eh_device_reset_handler:	NULL,			\
 		eh_bus_reset_handler:		ppa_reset,		\
 		eh_host_reset_handler:		ppa_reset,		\
+		use_new_eh_code:		1,			\
 		bios_param:			ppa_biosparam,		\
 		this_id:			-1,			\
 		sg_tablesize:			SG_ALL,			\
diff -urN linux-2.2.18-pre19/drivers/scsi/scsi_obsolete.c linux/drivers/scsi/scsi_obsolete.c
--- linux-2.2.18-pre19/drivers/scsi/scsi_obsolete.c	Sun Jan 17 18:29:54 1999
+++ linux/drivers/scsi/scsi_obsolete.c	Mon Dec  3 20:40:18 2001
@@ -366,7 +366,7 @@
         * crashing, all scsi_done() calls during sync resets are ignored.
         */
         printk("scsi%d: device driver called scsi_done() "
-	       "for a syncronous reset.\n", SCpnt->host->host_no);
+	       "for a synchronous reset.\n", SCpnt->host->host_no);
         return;
     }
     if(SCpnt->flags & WAS_SENSE)
diff -urN linux-2.2.18-pre19/drivers/sound/ac97.c linux/drivers/sound/ac97.c
--- linux-2.2.18-pre19/drivers/sound/ac97.c	Tue Jan  4 10:12:21 2000
+++ linux/drivers/sound/ac97.c	Mon Dec  3 20:40:18 2001
@@ -404,19 +404,19 @@
 	/* Read or write request. */
 	ret = -EINVAL;
 	if (_IOC_TYPE (cmd) == 'M') {
-	    int dir = _IOC_DIR (cmd);
+	    int dir = _SIOC_DIR (cmd);
 	    int channel = _IOC_NR (cmd);
 
 	    if (channel >= 0 && channel < SOUND_MIXER_NRDEVICES) {
 		ret = 0;
-		if (dir & _IOC_WRITE) {
+		if (dir & _SIOC_WRITE) {
 		    int val;
 		    if (get_user (val, (int *) arg) == 0)
 			ret = ac97_set_mixer (dev, channel, val);
 		    else
 			ret = -EFAULT;
 		}
-		if (ret >= 0 && (dir & _IOC_READ)) {
+		if (ret >= 0 && (dir & _SIOC_READ)) {
 		    if (dev->last_written_OSS_values[channel]
 			== AC97_REGVAL_UNKNOWN)
 			dev->last_written_OSS_values[channel]
diff -urN linux-2.2.18-pre19/drivers/sound/ac97_codec.c linux/drivers/sound/ac97_codec.c
--- linux-2.2.18-pre19/drivers/sound/ac97_codec.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/ac97_codec.c	Mon Dec  3 20:40:18 2001
@@ -402,13 +402,13 @@
 		return 0;
 	}
 
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
 		return -EINVAL;
 
 	if (cmd == OSS_GETVERSION)
 		return put_user(SOUND_VERSION, (int *)arg);
 
-	if (_IOC_DIR(cmd) == _IOC_READ) {
+	if (_SIOC_DIR(cmd) == _SIOC_READ) {
 		switch (_IOC_NR(cmd)) {
 		case SOUND_MIXER_RECSRC: /* give them the current record source */
 			if (!codec->recmask_io) {
@@ -448,7 +448,7 @@
 		return put_user(val, (int *)arg);
 	}
 
-	if (_IOC_DIR(cmd) == (_IOC_WRITE|_IOC_READ)) {
+	if (_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) {
 		codec->modcnt++;
 		if (get_user(val, (int *)arg))
 			return -EFAULT;
diff -urN linux-2.2.18-pre19/drivers/sound/ad1816.c linux/drivers/sound/ad1816.c
--- linux-2.2.18-pre19/drivers/sound/ad1816.c	Mon May 10 13:01:21 1999
+++ linux/drivers/sound/ad1816.c	Mon Dec  3 20:40:18 2001
@@ -1010,7 +1010,7 @@
 	if (((cmd >> 8) & 0xff) == 'M') { 
 		
 		/* set ioctl */
-		if (_IOC_DIR (cmd) & _IOC_WRITE) { 
+		if (_SIOC_DIR (cmd) & _SIOC_WRITE) { 
 			switch (cmd & 0xff){
 			case SOUND_MIXER_RECSRC:
 				
diff -urN linux-2.2.18-pre19/drivers/sound/cmpci.c linux/drivers/sound/cmpci.c
--- linux-2.2.18-pre19/drivers/sound/cmpci.c	Wed Jun  7 14:26:43 2000
+++ linux/drivers/sound/cmpci.c	Mon Dec  3 20:40:18 2001
@@ -1044,9 +1044,9 @@
 	}
 	if (cmd == OSS_GETVERSION)
 		return put_user(SOUND_VERSION, (int *)arg);
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
 			return put_user(mixer_recmask(s), (int *)arg);
@@ -1094,7 +1094,7 @@
 #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 		}
 	}
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
 		return -EINVAL;
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
diff -urN linux-2.2.18-pre19/drivers/sound/cs4281.c linux/drivers/sound/cs4281.c
--- linux-2.2.18-pre19/drivers/sound/cs4281.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/cs4281.c	Mon Dec  3 20:40:18 2001
@@ -1064,12 +1064,12 @@
         if (cmd == OSS_GETVERSION)
                 return put_user(SOUND_VERSION, (int *)arg);
         
-        if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+        if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
         
              // If ioctl has only the IOC_READ bit(bit 31)
              // on, process the only-read commands. 
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source 
                     cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, &temp1);
@@ -1103,7 +1103,7 @@
         
              // If ioctl doesn't have both the IOC_READ and 
              // the IOC_WRITE bit set, return invalid.
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE))
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE))
                 return -EINVAL;
         
              // Increment the count of volume writes.
diff -urN linux-2.2.18-pre19/drivers/sound/es1370.c linux/drivers/sound/es1370.c
--- linux-2.2.18-pre19/drivers/sound/es1370.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/es1370.c	Mon Dec  3 20:40:24 2001
@@ -912,9 +912,9 @@
 	}
 	if (cmd == OSS_GETVERSION)
 		return put_user(SOUND_VERSION, (int *)arg);
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
 			return put_user(s->mix.recsrc, (int *)arg);
@@ -951,7 +951,7 @@
 			return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg);
 		}
 	}
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
 		return -EINVAL;
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
diff -urN linux-2.2.18-pre19/drivers/sound/es1371.c linux/drivers/sound/es1371.c
--- linux-2.2.18-pre19/drivers/sound/es1371.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/es1371.c	Mon Dec  3 20:40:24 2001
@@ -1528,9 +1528,9 @@
 	}
 	if (cmd == OSS_GETVERSION)
 		return put_user(SOUND_VERSION, (int *)arg);
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
 			return put_user(recsrc[rdcodec(s, AC97_RECORD_SELECT) & 7], (int *)arg);
@@ -1570,7 +1570,7 @@
 #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 		}
 	}
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
 		return -EINVAL;
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
diff -urN linux-2.2.18-pre19/drivers/sound/esssolo1.c linux/drivers/sound/esssolo1.c
--- linux-2.2.18-pre19/drivers/sound/esssolo1.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/esssolo1.c	Mon Dec  3 20:40:24 2001
@@ -730,9 +730,9 @@
 	}
 	if (cmd == OSS_GETVERSION)
 		return put_user(SOUND_VERSION, (int *)arg);
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
 			return put_user(mixer_src[read_mixer(s, 0x1c) & 7], (int *)arg);
@@ -761,7 +761,7 @@
 			return put_user(s->mix.vol[vidx-1], (int *)arg);
 		}
 	}
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
 		return -EINVAL;
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
diff -urN linux-2.2.18-pre19/drivers/sound/maestro.c linux/drivers/sound/maestro.c
--- linux-2.2.18-pre19/drivers/sound/maestro.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/maestro.c	Mon Dec  3 20:40:24 2001
@@ -1984,10 +1984,10 @@
 	if (cmd == OSS_GETVERSION)
 		return put_user(SOUND_VERSION, (int *)arg);
 
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
 
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* give them the current record source */
 
@@ -2035,7 +2035,7 @@
 		return put_user(val,(int *)arg);
 	}
 	
-        if (_IOC_DIR(cmd) != (_IOC_WRITE|_IOC_READ))
+        if (_SIOC_DIR(cmd) != (_SIOC_WRITE|_SIOC_READ))
 		return -EINVAL;
 	
 	card->mix.modcnt++;
diff -urN linux-2.2.18-pre19/drivers/sound/sonicvibes.c linux/drivers/sound/sonicvibes.c
--- linux-2.2.18-pre19/drivers/sound/sonicvibes.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/sound/sonicvibes.c	Mon Dec  3 20:40:24 2001
@@ -1071,9 +1071,9 @@
 			return put_user(0, (int *)arg);
 		return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, (int *)arg);
 	}
-	if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int))
+	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
                 return -EINVAL;
-        if (_IOC_DIR(cmd) == _IOC_READ) {
+        if (_SIOC_DIR(cmd) == _SIOC_READ) {
                 switch (_IOC_NR(cmd)) {
                 case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
 			return put_user(mixer_recmask(s), (int *)arg);
@@ -1112,7 +1112,7 @@
 #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 		}
 	}
-        if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
+        if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) 
 		return -EINVAL;
 	s->mix.modcnt++;
 	switch (_IOC_NR(cmd)) {
diff -urN linux-2.2.18-pre19/drivers/video/atyfb.c linux/drivers/video/atyfb.c
--- linux-2.2.18-pre19/drivers/video/atyfb.c	Mon Dec  3 20:39:44 2001
+++ linux/drivers/video/atyfb.c	Mon Dec  3 20:40:25 2001
@@ -1,4 +1,4 @@
-/*  $Id: atyfb.c,v 1.106.2.9 2000/06/23 12:06:38 davem Exp $
+/*  $Id: atyfb.c,v 1.106.2.12 2000/09/05 00:10:55 davem Exp $
  *  linux/drivers/video/atyfb.c -- Frame buffer device for ATI Mach64
  *
  *	Copyright (C) 1997-1998  Geert Uytterhoeven
diff -urN linux-2.2.18-pre19/fs/ntfs/super.c linux/fs/ntfs/super.c
--- linux-2.2.18-pre19/fs/ntfs/super.c	Mon Sep  4 10:39:27 2000
+++ linux/fs/ntfs/super.c	Mon Dec  3 20:40:25 2001
@@ -125,7 +125,7 @@
 	io.param=(char*)upcase->vol->upcase;
 	io.size=2*UPCASE_LENGTH;
 	ntfs_read_attr(upcase,upcase->vol->at_data,0,0,&io);
-	upcase->vol->upcase_length = io.size;
+	upcase->vol->upcase_length = io.size / 2;
 }
 
 static int
diff -urN linux-2.2.18-pre19/fs/smbfs/ChangeLog linux/fs/smbfs/ChangeLog
--- linux-2.2.18-pre19/fs/smbfs/ChangeLog	Mon Dec  3 20:39:45 2001
+++ linux/fs/smbfs/ChangeLog	Mon Dec  3 20:40:25 2001
@@ -1,5 +1,11 @@
 ChangeLog for smbfs.
 
+2000-11-04 Urban Widmark <urban@svenskatest.se>
+
+	* proc.c, sock.c: adjust max parameters & max data to follow max_xmit
+	  lots of servers were having find_next trouble with this.
+	* proc.c: use documented write method of truncating (NetApp fix)
+
 2000-09-01 Urban Widmark <urban@svenskatest.se>
 
 	* proc.c: add back lanman2 support (OS/2 and others)
diff -urN linux-2.2.18-pre19/fs/smbfs/proc.c linux/fs/smbfs/proc.c
--- linux-2.2.18-pre19/fs/smbfs/proc.c	Mon Dec  3 20:39:45 2001
+++ linux/fs/smbfs/proc.c	Mon Dec  3 20:40:25 2001
@@ -385,22 +385,16 @@
 }
 
 /*
- * Returns the maximum read or write size for the current packet size
- * and max_xmit value.
+ * Returns the maximum read or write size for the "payload". Making all of the
+ * packet fit within the negotiated max_xmit size.
+ *
  * N.B. Since this value is usually computed before locking the server,
  * the server's packet size must never be decreased!
  */
-static int
+static inline int
 smb_get_xmitsize(struct smb_sb_info *server, int overhead)
 {
-	int size = server->packet_size;
-
-	/*
-	 * Start with the smaller of packet size and max_xmit ...
-	 */
-	if (size > server->opt.max_xmit)
-		size = server->opt.max_xmit;
-	return size - overhead;
+	return server->opt.max_xmit - overhead;
 }
 
 /*
@@ -751,6 +745,23 @@
 		server->opt.protocol, server->opt.max_xmit, server->conn_pid,
 		server->opt.capabilities);
 
+	/* Make sure we can fit a message of the negotiated size in our
+	   packet buffer. */
+	if (server->opt.max_xmit > server->packet_size) {
+		int len = smb_round_length(server->opt.max_xmit);
+		char *buf = smb_vmalloc(len);
+		if (buf) {
+			server->packet = buf;
+			server->packet_size = len;
+		} else {
+			/* else continue with the too small buffer? */
+			PARANOIA("Failed to allocate new packet buffer: "
+				 "max_xmit=%d, packet_size=%d\n",
+				 server->opt.max_xmit, server->packet_size);
+			server->opt.max_xmit = server->packet_size;
+		}
+	}
+
 out:
 #ifdef SMB_RETRY_INTR
 	wake_up_interruptible(&server->wait);
@@ -1348,17 +1359,16 @@
 	smb_lock_server(server);
 
       retry:
-	p = smb_setup_header(server, SMBwrite, 5, 0);
+	p = smb_setup_header(server, SMBwrite, 5, 3);
 	WSET(server->packet, smb_vwv0, fid);
 	WSET(server->packet, smb_vwv1, 0);
 	DSET(server->packet, smb_vwv2, length);
 	WSET(server->packet, smb_vwv4, 0);
-	*p++ = 4;
-	*p++ = 0;
-	smb_setup_bcc(server, p);
 
-	if ((result = smb_request_ok(server, SMBwrite, 1, 0)) < 0)
-	{
+	*p++ = 1;
+	WSET(p, 0, 0);
+
+	if ((result = smb_request_ok(server, SMBwrite, 1, 0)) < 0) {
 		if (smb_retry(server))
 			goto retry;
 		goto out;
@@ -1487,8 +1497,8 @@
 smb_proc_readdir_long(struct smb_sb_info *server, struct dentry *dir, int fpos,
 		      void *cachep)
 {
-	unsigned char *p;
-	char *mask, *lastname, *param = server->temp_buf;
+	unsigned char *p, *lastname;
+	char *mask, *param = server->temp_buf;
 	__u16 command;
 	int first, entries, entries_seen;
 
@@ -1521,7 +1531,7 @@
 	 * Encode the initial path
 	 */
 	mask = param + 12;
-	mask_len = smb_encode_path(server, mask, dir, &star);
+	mask_len = smb_encode_path(server, mask, dir, &star) - 1;
 	if (mask_len < 0) {
 		entries = mask_len;
 		goto unlock_return;
@@ -1613,31 +1623,41 @@
 		if (ff_searchcount == 0)
 			break;
 
-		/* we might need the lastname for continuations */
+		/*
+		 * We might need the lastname for continuations.
+		 *
+		 * Note that some servers (win95) point to the filename and
+		 * others (NT4, Samba using NT1) to the dir entry. We assume
+		 * here that those who do not point to a filename do not need
+		 * this info to continue the listing.
+		 */
 		mask_len = 0;
-		if (ff_lastname > 0) {
+		if (ff_lastname > 0 && ff_lastname < resp_data_len) {
 			lastname = resp_data + ff_lastname;
 			switch (info_level) {
 			case 260:
-				if (ff_lastname < resp_data_len)
-					mask_len = resp_data_len - ff_lastname;
+				mask_len = resp_data_len - ff_lastname;
 				break;
 			case 1:
-				/* Win NT 4.0 doesn't set the length byte */
-				lastname++;
-				if (ff_lastname + 2 < resp_data_len)
-					mask_len = strlen(lastname);
+				/* lastname points to a length byte */
+				mask_len = *lastname++;
+				if (ff_lastname + 1 + mask_len > resp_data_len)
+					mask_len = resp_data_len - ff_lastname - 1;
 				break;
 			}
 			/*
 			 * Update the mask string for the next message.
 			 */
+			if (mask_len < 0)
+				mask_len = 0;
 			if (mask_len > 255)
 				mask_len = 255;
 			if (mask_len)
 				strncpy(mask, lastname, mask_len);
 		}
 		mask[mask_len] = 0;
+		mask_len = strlen(mask);	/* find the actual string len */
+
 
 		/* Now we are ready to parse smb directory entries. */
 
diff -urN linux-2.2.18-pre19/fs/smbfs/sock.c linux/fs/smbfs/sock.c
--- linux-2.2.18-pre19/fs/smbfs/sock.c	Mon Dec  3 20:39:45 2001
+++ linux/fs/smbfs/sock.c	Mon Dec  3 20:40:25 2001
@@ -473,14 +473,12 @@
 	unsigned int total_p = 0, total_d = 0, buf_len = 0;
 	int result;
 
-	while (1)
-	{
+	while (1) {
 		result = smb_receive(server);
 		if (result < 0)
 			goto out;
 		inbuf = server->packet;
-		if (server->rcls != 0)
-		{
+		if (server->rcls != 0) {
 			*parm = *data = inbuf;
 			*ldata = *lparm = 0;
 			goto out;
@@ -504,13 +502,11 @@
 		parm_len += parm_count;
 		data_len += data_count;
 
-		if (!rcv_buf)
-		{
+		if (!rcv_buf) {
 			/*
 			 * Check for fast track processing ... just this packet.
 			 */
-			if (parm_count == parm_tot && data_count == data_tot)
-			{
+			if (parm_count == parm_tot && data_count == data_tot) {
 				VERBOSE("fast track, parm=%u %u %u, data=%u %u %u\n",
 					parm_disp, parm_offset, parm_count, 
 					data_disp, data_offset, data_count);
@@ -520,12 +516,10 @@
 				goto success;
 			}
 
-			if (parm_tot > TRANS2_MAX_TRANSFER ||
-	  		    data_tot > TRANS2_MAX_TRANSFER)
-				goto out_too_long;
-
 			/*
-			 * Save the total parameter and data length.
+			 * Allocate a new buffer for receiving multiple packets
+			 * into. If we stick to the negotiated max_xmit this
+			 * shouldn't have to happen.
 			 */
 			total_d = data_tot;
 			total_p = parm_tot;
@@ -534,14 +528,15 @@
 			if (server->packet_size > buf_len)
 				buf_len = server->packet_size;
 			buf_len = smb_round_length(buf_len);
+			if (buf_len > SMB_MAX_PACKET_SIZE)
+				goto out_no_mem;
 
 			rcv_buf = smb_vmalloc(buf_len);
 			if (!rcv_buf)
 				goto out_no_mem;
 			*parm = rcv_buf;
 			*data = rcv_buf + total_p;
-		}
-		else if (data_tot > total_d || parm_tot > total_p)
+		} else if (data_tot > total_d || parm_tot > total_p)
 			goto out_data_grew;
 
 		if (parm_disp + parm_count > total_p)
@@ -568,8 +563,7 @@
 	 * old one, in which case we just copy the data.
 	 */
 	inbuf = server->packet;
-	if (buf_len >= server->packet_size)
-	{
+	if (buf_len >= server->packet_size) {
 		server->packet_size = buf_len;
 		server->packet = rcv_buf;
 		rcv_buf = inbuf;
@@ -713,6 +707,7 @@
 	struct socket *sock = server_sock(server);
 	struct scm_cookie scm;
 	int err;
+	int mparam, mdata;
 
 	/* I know the following is very ugly, but I want to build the
 	   smb packet as efficiently as possible. */
@@ -733,19 +728,30 @@
 	struct iovec iov[4];
 	struct msghdr msg;
 
-	/* N.B. This test isn't valid! packet_size may be < max_xmit */
+	/* FIXME! this test needs to include SMB overhead too, I think ... */
 	if ((bcc + oparam) > server->opt.max_xmit)
-	{
 		return -ENOMEM;
-	}
 	p = smb_setup_header(server, SMBtrans2, smb_parameters, bcc);
 
+	/*
+	 * max parameters + max data + max setup == max_xmit to make NT4 happy
+	 * and not abort the transfer or split into multiple packets.
+	 *
+	 * -100 is to make room for headers, which OS/2 seems to include in the
+	 * size calculation NT4 does not?
+	 */
+	mparam = SMB_TRANS2_MAX_PARAM;
+	mdata = server->opt.max_xmit - mparam - 100;
+	if (mdata < 1024) {
+		mdata = 1024;
+		mparam = 20;
+	}
+
 	WSET(server->packet, smb_tpscnt, lparam);
 	WSET(server->packet, smb_tdscnt, ldata);
-	/* N.B. these values should reflect out current packet size */
-	WSET(server->packet, smb_mprcnt, TRANS2_MAX_TRANSFER);
-	WSET(server->packet, smb_mdrcnt, TRANS2_MAX_TRANSFER);
-	WSET(server->packet, smb_msrcnt, 0);
+	WSET(server->packet, smb_mprcnt, mparam);
+	WSET(server->packet, smb_mdrcnt, mdata);
+	WSET(server->packet, smb_msrcnt, 0);	/* max setup always 0 ? */
 	WSET(server->packet, smb_flags, 0);
 	DSET(server->packet, smb_timeout, 0);
 	WSET(server->packet, smb_pscnt, lparam);
@@ -777,8 +783,7 @@
 	iov[3].iov_len = ldata;
 
 	err = scm_send(sock, &msg, &scm);
-        if (err >= 0)
-	{
+        if (err >= 0) {
 		err = sock->ops->sendmsg(sock, &msg, packet_length, &scm);
 		scm_destroy(&scm);
 	}
diff -urN linux-2.2.18-pre19/include/asm-i386/bugs.h linux/include/asm-i386/bugs.h
--- linux-2.2.18-pre19/include/asm-i386/bugs.h	Mon Dec  3 20:39:45 2001
+++ linux/include/asm-i386/bugs.h	Mon Dec  3 20:40:25 2001
@@ -419,5 +419,13 @@
 	check_amd_k6();
 	check_pentium_f00f();
 	check_cyrix_coma();
-	system_utsname.machine[1] = '0' + boot_cpu_data.x86;
+	/*
+	 *	Catch people using stupid model number data
+	 *	(Pentium IV) and report 686 still. The /proc data
+	 *	however does not lie and reports 15 as will cpuid.
+	 */
+	if(boot_cpu_data.x86 > 9)
+		system_utsname.machine[1] = '6';
+	else
+		system_utsname.machine[1] = '0' + boot_cpu_data.x86;
 }
diff -urN linux-2.2.18-pre19/include/asm-i386/spinlock.h linux/include/asm-i386/spinlock.h
--- linux-2.2.18-pre19/include/asm-i386/spinlock.h	Mon Dec  3 20:39:45 2001
+++ linux/include/asm-i386/spinlock.h	Mon Dec  3 20:40:25 2001
@@ -142,6 +142,11 @@
 typedef struct { unsigned long a[100]; } __dummy_lock_t;
 #define __dummy_lock(lock) (*(__dummy_lock_t *)(lock))
 
+/*
+ *	Intel PIV would benefit from using 'rep nop' here but on older
+ *	processors and non intel it is listed as 'undefined' so cannot be
+ *	blindly used. On 2.4 we should add a PIV CPU type for this one.
+ */
 #define spin_lock_string \
 	"\n1:\t" \
 	"lock ; btsl $0,%0\n\t" \
diff -urN linux-2.2.18-pre19/include/asm-sparc/asm_offsets.h linux/include/asm-sparc/asm_offsets.h
--- linux-2.2.18-pre19/include/asm-sparc/asm_offsets.h	Wed May  3 17:16:51 2000
+++ linux/include/asm-sparc/asm_offsets.h	Mon Dec  3 20:40:25 2001
@@ -142,21 +142,21 @@
 #define ASIZ_task_cap_inheritable	0x00000004
 #define AOFF_task_cap_permitted	0x00000160
 #define ASIZ_task_cap_permitted	0x00000004
-#define AOFF_task_user	0x00000164
+#define AOFF_task_user	0x00000168
 #define ASIZ_task_user	0x00000004
-#define AOFF_task_rlim	0x00000168
+#define AOFF_task_rlim	0x0000016c
 #define ASIZ_task_rlim	0x00000050
-#define AOFF_task_used_math	0x000001b8
+#define AOFF_task_used_math	0x000001bc
 #define ASIZ_task_used_math	0x00000002
-#define AOFF_task_comm	0x000001ba
+#define AOFF_task_comm	0x000001be
 #define ASIZ_task_comm	0x00000010
-#define AOFF_task_link_count	0x000001cc
+#define AOFF_task_link_count	0x000001d0
 #define ASIZ_task_link_count	0x00000004
-#define AOFF_task_tty	0x000001d0
+#define AOFF_task_tty	0x000001d4
 #define ASIZ_task_tty	0x00000004
-#define AOFF_task_semundo	0x000001d4
+#define AOFF_task_semundo	0x000001d8
 #define ASIZ_task_semundo	0x00000004
-#define AOFF_task_semsleeping	0x000001d8
+#define AOFF_task_semsleeping	0x000001dc
 #define ASIZ_task_semsleeping	0x00000004
 #define AOFF_task_tss	0x000001e0
 #define ASIZ_task_tss	0x00000388
@@ -423,21 +423,21 @@
 #define ASIZ_task_cap_inheritable	0x00000004
 #define AOFF_task_cap_permitted	0x00000258
 #define ASIZ_task_cap_permitted	0x00000004
-#define AOFF_task_user	0x0000025c
+#define AOFF_task_user	0x00000260
 #define ASIZ_task_user	0x00000004
-#define AOFF_task_rlim	0x00000260
+#define AOFF_task_rlim	0x00000264
 #define ASIZ_task_rlim	0x00000050
-#define AOFF_task_used_math	0x000002b0
+#define AOFF_task_used_math	0x000002b4
 #define ASIZ_task_used_math	0x00000002
-#define AOFF_task_comm	0x000002b2
+#define AOFF_task_comm	0x000002b6
 #define ASIZ_task_comm	0x00000010
-#define AOFF_task_link_count	0x000002c4
+#define AOFF_task_link_count	0x000002c8
 #define ASIZ_task_link_count	0x00000004
-#define AOFF_task_tty	0x000002c8
+#define AOFF_task_tty	0x000002cc
 #define ASIZ_task_tty	0x00000004
-#define AOFF_task_semundo	0x000002cc
+#define AOFF_task_semundo	0x000002d0
 #define ASIZ_task_semundo	0x00000004
-#define AOFF_task_semsleeping	0x000002d0
+#define AOFF_task_semsleeping	0x000002d4
 #define ASIZ_task_semsleeping	0x00000004
 #define AOFF_task_tss	0x000002d8
 #define ASIZ_task_tss	0x00000388
diff -urN linux-2.2.18-pre19/include/asm-sparc64/io.h linux/include/asm-sparc64/io.h
--- linux-2.2.18-pre19/include/asm-sparc64/io.h	Mon Dec  3 20:39:45 2001
+++ linux/include/asm-sparc64/io.h	Mon Dec  3 20:40:25 2001
@@ -1,4 +1,4 @@
-/* $Id: io.h,v 1.19.2.2 2000/09/17 05:11:47 davem Exp $ */
+/* $Id: io.h,v 1.19.2.5 2000/10/25 18:14:47 davem Exp $ */
 #ifndef __SPARC64_IO_H
 #define __SPARC64_IO_H
 
@@ -14,6 +14,20 @@
 #define SLOW_DOWN_IO	do { } while (0)
 
 
+#ifndef CONFIG_PCI
+
+/* In builds without PCI these should not be called.
+ *
+ * XXX Unfortunately they are, this is how the scsi
+ * XXX disk driver determines whether kernel buffers
+ * XXX are physically contiguous :-(
+ */
+#define virt_to_phys(addr)	__pa(addr)
+#define phys_to_virt(addr)	__va(addr)
+#define bus_dvma_to_mem(vaddr)	(__builtin_trap(), 0)
+
+#else
+
 #define PCI_DVMA_HASHSZ	256
 
 extern unsigned long pci_dvma_offset;
@@ -46,14 +60,15 @@
 	return (void *)(paddr + off);
 }
 
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 extern __inline__ unsigned long bus_dvma_to_mem(unsigned long vaddr)
 {
 	return vaddr & pci_dvma_mask;
 }
 
+#endif /* CONFIG_PCI */
+
+#define virt_to_bus virt_to_phys
+#define bus_to_virt phys_to_virt
 
 extern __inline__ unsigned int inb(unsigned long addr)
 {
diff -urN linux-2.2.18-pre19/include/linux/smb.h linux/include/linux/smb.h
--- linux-2.2.18-pre19/include/linux/smb.h	Mon Dec  3 20:39:45 2001
+++ linux/include/linux/smb.h	Mon Dec  3 20:40:26 2001
@@ -119,11 +119,13 @@
 
 #define SMB_HEADER_LEN   37     /* includes everything up to, but not
                                  * including smb_bcc */
-#define SMB_DEF_MAX_XMIT 32768
-#define SMB_INITIAL_PACKET_SIZE 4000
 
-/* Allocate max. 1 page */
-#define TRANS2_MAX_TRANSFER (4096-17)
+#define SMB_INITIAL_PACKET_SIZE	4000
+#define SMB_MAX_PACKET_SIZE	32768
+
+/* reserve this much space for trans2 parameters. Shouldn't have to be more
+   than 10 or so, but OS/2 seems happier like this. */
+#define SMB_TRANS2_MAX_PARAM 64
 
 #endif
 #endif
diff -urN linux-2.2.18-pre19/kernel/ksyms.c linux/kernel/ksyms.c
--- linux-2.2.18-pre19/kernel/ksyms.c	Mon Dec  3 20:39:45 2001
+++ linux/kernel/ksyms.c	Mon Dec  3 20:40:26 2001
@@ -284,6 +284,7 @@
 EXPORT_SYMBOL(register_sysctl_table);
 EXPORT_SYMBOL(unregister_sysctl_table);
 EXPORT_SYMBOL(sysctl_string);
+EXPORT_SYMBOL(sysctl_jiffies);
 EXPORT_SYMBOL(sysctl_intvec);
 EXPORT_SYMBOL(proc_dostring);
 EXPORT_SYMBOL(proc_dointvec);
diff -urN linux-2.2.18-pre19/mm/vmalloc.c linux/mm/vmalloc.c
--- linux-2.2.18-pre19/mm/vmalloc.c	Wed Apr 21 23:12:32 1999
+++ linux/mm/vmalloc.c	Mon Dec  3 20:40:26 2001
@@ -157,8 +157,13 @@
 	area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
 	if (!area)
 		return NULL;
+	size += PAGE_SIZE;
 	addr = VMALLOC_START;
 	for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
+		if ((size + addr) < addr) {
+			kfree(area);
+			return NULL;
+		}
 		if (size + addr < (unsigned long) tmp->addr)
 			break;
 		addr = tmp->size + (unsigned long) tmp->addr;
@@ -168,7 +173,7 @@
 		}
 	}
 	area->addr = (void *)addr;
-	area->size = size + PAGE_SIZE;
+	area->size = size;
 	area->next = *p;
 	*p = area;
 	return area;
diff -urN linux-2.2.18-pre19/net/appletalk/ddp.c linux/net/appletalk/ddp.c
--- linux-2.2.18-pre19/net/appletalk/ddp.c	Mon Sep  4 10:39:28 2000
+++ linux/net/appletalk/ddp.c	Mon Dec  3 20:40:26 2001
@@ -2083,22 +2083,6 @@
 		case SIOCDARP:	/* proxy AARP */
 			return (atif_ioctl(cmd,(void *)arg));
 
-		/*
-		 * Physical layer ioctl calls
-		 */
-		case SIOCSIFLINK:
-		case SIOCGIFHWADDR:
-		case SIOCSIFHWADDR:
-		case SIOCGIFFLAGS:
-		case SIOCSIFFLAGS:
-		case SIOCGIFMTU:
-		case SIOCGIFCONF:
-		case SIOCADDMULTI:
-		case SIOCDELMULTI:
-		case SIOCGIFCOUNT:
-		case SIOCGIFINDEX:
-		case SIOCGIFNAME:
-			return ((dev_ioctl(cmd,(void *) arg)));
 
 		case SIOCSIFMETRIC:
 		case SIOCSIFBRDADDR:
@@ -2111,7 +2095,7 @@
 			return (-EINVAL);
 
 		default:
-			return (-EINVAL);
+			return dev_ioctl(cmd, (void *) arg); 
 	}
 
 	return (put_user(amount, (int *)arg));
diff -urN linux-2.2.18-pre19/net/core/scm.c linux/net/core/scm.c
--- linux-2.2.18-pre19/net/core/scm.c	Thu Apr 22 19:45:19 1999
+++ linux/net/core/scm.c	Mon Dec  3 20:40:26 2001
@@ -210,12 +210,16 @@
 {
 	struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control;
 
-	int fdmax = (msg->msg_controllen - sizeof(struct cmsghdr))/sizeof(int);
+	int fdmax = 0;
 	int fdnum = scm->fp->count;
 	struct file **fp = scm->fp->fp;
 	int *cmfptr;
 	int err = 0, i;
 
+	if (msg->msg_controllen > sizeof(struct cmsghdr))
+		fdmax = ((msg->msg_controllen - sizeof(struct cmsghdr))
+			 / sizeof(int));
+
 	if (fdnum < fdmax)
 		fdmax = fdnum;
 
@@ -251,7 +255,7 @@
 			msg->msg_controllen -= cmlen;
 		}
 	}
-	if (i < fdnum)
+	if (i < fdnum || (fdnum && fdmax <= 0))
 		msg->msg_flags |= MSG_CTRUNC;
 
 	/*
diff -urN linux-2.2.18-pre19/net/ipv4/proc.c linux/net/ipv4/proc.c
--- linux-2.2.18-pre19/net/ipv4/proc.c	Mon Dec  3 20:39:45 2001
+++ linux/net/ipv4/proc.c	Mon Dec  3 20:40:26 2001
@@ -7,7 +7,7 @@
  *		PROC file system.  It is mainly used for debugging and
  *		statistics.
  *
- * Version:	$Id: proc.c,v 1.34.2.4 2000/10/18 17:50:41 davem Exp $
+ * Version:	$Id: proc.c,v 1.34.2.5 2000/10/29 12:06:28 davem Exp $
  *
  * Authors:	Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  *		Gerald J. Heim, <heim@peanuts.informatik.uni-tuebingen.de>
diff -urN linux-2.2.18-pre19/net/ipv6/route.c linux/net/ipv6/route.c
--- linux-2.2.18-pre19/net/ipv6/route.c	Sun Mar 21 07:22:00 1999
+++ linux/net/ipv6/route.c	Mon Dec  3 20:40:26 2001
@@ -5,7 +5,7 @@
  *	Authors:
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *
- *	$Id: route.c,v 1.35 1999/03/21 05:22:57 davem Exp $
+ *	$Id: route.c,v 1.35.2.1 2000/11/03 01:14:28 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -1926,19 +1926,19 @@
          &proc_dointvec},
 	{NET_IPV6_ROUTE_GC_MIN_INTERVAL, "gc_min_interval",
          &ip6_rt_gc_min_interval, sizeof(int), 0644, NULL,
-         &proc_dointvec_jiffies},
+         &proc_dointvec_jiffies, &sysctl_jiffies},
 	{NET_IPV6_ROUTE_GC_TIMEOUT, "gc_timeout",
          &ip6_rt_gc_timeout, sizeof(int), 0644, NULL,
-         &proc_dointvec_jiffies},
+         &proc_dointvec_jiffies, &sysctl_jiffies},
 	{NET_IPV6_ROUTE_GC_INTERVAL, "gc_interval",
          &ip6_rt_gc_interval, sizeof(int), 0644, NULL,
-         &proc_dointvec_jiffies},
+         &proc_dointvec_jiffies, &sysctl_jiffies},
 	{NET_IPV6_ROUTE_GC_ELASTICITY, "gc_elasticity",
          &ip6_rt_gc_elasticity, sizeof(int), 0644, NULL,
-         &proc_dointvec_jiffies},
+         &proc_dointvec_jiffies, &sysctl_jiffies},
 	{NET_IPV6_ROUTE_MTU_EXPIRES, "mtu_expires",
          &ip6_rt_mtu_expires, sizeof(int), 0644, NULL,
-         &proc_dointvec_jiffies},
+         &proc_dointvec_jiffies, &sysctl_jiffies},
 	 {0}
 };
 
