Index: patches/aboot-0.9b-kernel26_gcc4_fixes-2.patch
===================================================================
--- patches/aboot-0.9b-kernel26_gcc4_fixes-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/aboot-0.9b-kernel26_gcc4_fixes-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1579 @@
+Submitted By: Joe Ciccone <joeciccone@crazyeyesoft.com
+Date: 2005-09-16
+Initial Package Version: 0.9b
+Upstream Status: NONE
+Origin: Joe Ciccone
+Description: This patch fixes compilation issues with aboot-0.9b.
+	This patch creates kernel headers that the makefile would
+	normaly take out of the kernel source, which is not desired.
+
+diff -Naur aboot-0.9b.orig/cons.c aboot-0.9b/cons.c
+--- aboot-0.9b.orig/cons.c	2006-01-16 14:00:09.000000000 +0000
++++ aboot-0.9b/cons.c	2006-01-16 14:04:02.000000000 +0000
+@@ -12,7 +12,7 @@
+ #include <utils.h>
+ 
+ long cons_dev;			/* console device */
+-extern long int dispatch();	/* Need the full 64 bit return here...*/
++long dispatch(long proc, ...);	/* Need the full 64 bit return here...*/
+ 
+ long
+ cons_puts(const char *str, long len)
+diff -Naur aboot-0.9b.orig/disk.c aboot-0.9b/disk.c
+--- aboot-0.9b.orig/disk.c	2006-01-16 14:00:09.000000000 +0000
++++ aboot-0.9b/disk.c	2006-01-16 14:04:26.000000000 +0000
+@@ -480,9 +480,7 @@
+ 				} else {
+ 					*d++ = *p;
+ 				}
+-				break;
+-
+-			      default:
++				break;			
+ 			}
+ 			p++;
+ 		}
+diff -Naur aboot-0.9b.orig/include/asm/auxvec.h aboot-0.9b/include/asm/auxvec.h
+--- aboot-0.9b.orig/include/asm/auxvec.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/asm/auxvec.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,24 @@
++#ifndef __ASM_ALPHA_AUXVEC_H
++#define __ASM_ALPHA_AUXVEC_H
++
++/* Reserve these numbers for any future use of a VDSO.  */
++#if 0
++#define AT_SYSINFO		32
++#define AT_SYSINFO_EHDR		33
++#endif
++
++/* More complete cache descriptions than AT_[DIU]CACHEBSIZE.  If the
++   value is -1, then the cache doesn't exist.  Otherwise:
++
++      bit 0-3:	  Cache set-associativity; 0 means fully associative.
++      bit 4-7:	  Log2 of cacheline size.
++      bit 8-31:	  Size of the entire cache >> 8.
++      bit 32-63:  Reserved.
++*/
++
++#define AT_L1I_CACHESHAPE	34
++#define AT_L1D_CACHESHAPE	35
++#define AT_L2_CACHESHAPE	36
++#define AT_L3_CACHESHAPE	37
++
++#endif /* __ASM_ALPHA_AUXVEC_H */
+diff -Naur aboot-0.9b.orig/include/asm/barrier.h aboot-0.9b/include/asm/barrier.h
+--- aboot-0.9b.orig/include/asm/barrier.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/asm/barrier.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,34 @@
++#ifndef __BARRIER_H
++#define __BARRIER_H
++
++#define mb() \
++__asm__ __volatile__("mb": : :"memory")
++
++#define rmb() \
++__asm__ __volatile__("mb": : :"memory")
++
++#define wmb() \
++__asm__ __volatile__("wmb": : :"memory")
++
++#define read_barrier_depends() \
++__asm__ __volatile__("mb": : :"memory")
++
++#ifdef CONFIG_SMP
++#define smp_mb()	mb()
++#define smp_rmb()	rmb()
++#define smp_wmb()	wmb()
++#define smp_read_barrier_depends()	read_barrier_depends()
++#else
++#define smp_mb()	barrier()
++#define smp_rmb()	barrier()
++#define smp_wmb()	barrier()
++#define smp_read_barrier_depends()	barrier()
++#endif
++
++#define set_mb(var, value) \
++do { var = value; mb(); } while (0)
++
++#define set_wmb(var, value) \
++do { var = value; wmb(); } while (0)
++
++#endif		/* __BARRIER_H */
+diff -Naur aboot-0.9b.orig/include/asm/page.h aboot-0.9b/include/asm/page.h
+--- aboot-0.9b.orig/include/asm/page.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/asm/page.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,103 @@
++#ifndef _ALPHA_PAGE_H
++#define _ALPHA_PAGE_H
++
++#include <linux/config.h>
++#include <asm/pal.h>
++
++/* PAGE_SHIFT determines the page size */
++#define PAGE_SHIFT	13
++#define PAGE_SIZE	(1UL << PAGE_SHIFT)
++#define PAGE_MASK	(~(PAGE_SIZE-1))
++
++#ifdef __KERNEL__
++
++#ifndef __ASSEMBLY__
++
++#define STRICT_MM_TYPECHECKS
++
++extern void clear_page(void *page);
++#define clear_user_page(page, vaddr, pg)	clear_page(page)
++
++#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr)
++#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
++
++extern void copy_page(void * _to, void * _from);
++#define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)
++
++#ifdef STRICT_MM_TYPECHECKS
++/*
++ * These are used to make use of C type-checking..
++ */
++typedef struct { unsigned long pte; } pte_t;
++typedef struct { unsigned long pmd; } pmd_t;
++typedef struct { unsigned long pgd; } pgd_t;
++typedef struct { unsigned long pgprot; } pgprot_t;
++
++#define pte_val(x)	((x).pte)
++#define pmd_val(x)	((x).pmd)
++#define pgd_val(x)	((x).pgd)
++#define pgprot_val(x)	((x).pgprot)
++
++#define __pte(x)	((pte_t) { (x) } )
++#define __pmd(x)	((pmd_t) { (x) } )
++#define __pgd(x)	((pgd_t) { (x) } )
++#define __pgprot(x)	((pgprot_t) { (x) } )
++
++#else
++/*
++ * .. while these make it easier on the compiler
++ */
++typedef unsigned long pte_t;
++typedef unsigned long pmd_t;
++typedef unsigned long pgd_t;
++typedef unsigned long pgprot_t;
++
++#define pte_val(x)	(x)
++#define pmd_val(x)	(x)
++#define pgd_val(x)	(x)
++#define pgprot_val(x)	(x)
++
++#define __pte(x)	(x)
++#define __pgd(x)	(x)
++#define __pgprot(x)	(x)
++
++#endif /* STRICT_MM_TYPECHECKS */
++
++#ifdef USE_48_BIT_KSEG
++#define PAGE_OFFSET		0xffff800000000000UL
++#else
++#define PAGE_OFFSET		0xfffffc0000000000UL
++#endif
++
++#else
++
++#ifdef USE_48_BIT_KSEG
++#define PAGE_OFFSET		0xffff800000000000
++#else
++#define PAGE_OFFSET		0xfffffc0000000000
++#endif
++
++#endif /* !__ASSEMBLY__ */
++
++/* to align the pointer to the (next) page boundary */
++#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
++
++#define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
++#define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
++#ifndef CONFIG_DISCONTIGMEM
++#define pfn_to_page(pfn)	(mem_map + (pfn))
++#define page_to_pfn(page)	((unsigned long)((page) - mem_map))
++#define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
++
++#define pfn_valid(pfn)		((pfn) < max_mapnr)
++#define virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
++#endif /* CONFIG_DISCONTIGMEM */
++
++#define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE | VM_EXEC | \
++					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
++
++#endif /* __KERNEL__ */
++
++#include <asm-generic/page.h>
++
++#endif /* _ALPHA_PAGE_H */
+diff -Naur aboot-0.9b.orig/include/asm/string.h aboot-0.9b/include/asm/string.h
+--- aboot-0.9b.orig/include/asm/string.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/asm/string.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,68 @@
++#ifndef __ALPHA_STRING_H__
++#define __ALPHA_STRING_H__
++
++#ifdef __KERNEL__
++
++/*
++ * GCC of any recent vintage doesn't do stupid things with bcopy.
++ * EGCS 1.1 knows all about expanding memcpy inline, others don't.
++ *
++ * Similarly for a memset with data = 0.
++ */
++
++#define __HAVE_ARCH_MEMCPY
++extern void * memcpy(void *, const void *, size_t);
++#define __HAVE_ARCH_MEMMOVE
++extern void * memmove(void *, const void *, size_t);
++
++/* For backward compatibility with modules.  Unused otherwise.  */
++extern void * __memcpy(void *, const void *, size_t);
++
++#define memcpy __builtin_memcpy
++
++#define __HAVE_ARCH_MEMSET
++extern void * __constant_c_memset(void *, unsigned long, size_t);
++extern void * __memset(void *, int, size_t);
++extern void * memset(void *, int, size_t);
++
++#define memset(s, c, n)							    \
++(__builtin_constant_p(c)						    \
++ ? (__builtin_constant_p(n) && (c) == 0					    \
++    ? __builtin_memset((s),0,(n)) 					    \
++    : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
++ : __memset((s),(c),(n)))
++
++#define __HAVE_ARCH_STRCPY
++extern char * strcpy(char *,const char *);
++#define __HAVE_ARCH_STRNCPY
++extern char * strncpy(char *, const char *, size_t);
++#define __HAVE_ARCH_STRCAT
++extern char * strcat(char *, const char *);
++#define __HAVE_ARCH_STRNCAT
++extern char * strncat(char *, const char *, size_t);
++#define __HAVE_ARCH_STRCHR
++extern char * strchr(const char *,int);
++#define __HAVE_ARCH_STRRCHR
++extern char * strrchr(const char *,int);
++#define __HAVE_ARCH_STRLEN
++extern size_t strlen(const char *);
++#define __HAVE_ARCH_MEMCHR
++extern void * memchr(const void *, int, size_t);
++
++/* The following routine is like memset except that it writes 16-bit
++   aligned values.  The DEST and COUNT parameters must be even for 
++   correct operation.  */
++
++#define __HAVE_ARCH_MEMSETW
++extern void * __memsetw(void *dest, unsigned short, size_t count);
++
++#define memsetw(s, c, n)						 \
++(__builtin_constant_p(c)						 \
++ ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
++ : __memsetw((s),(c),(n)))
++
++extern int strcasecmp(const char *, const char *);
++
++#endif /* __KERNEL__ */
++
++#endif /* __ALPHA_STRING_H__ */
+diff -Naur aboot-0.9b.orig/include/asm/system.h aboot-0.9b/include/asm/system.h
+--- aboot-0.9b.orig/include/asm/system.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/asm/system.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,594 @@
++#ifndef __ALPHA_SYSTEM_H
++#define __ALPHA_SYSTEM_H
++
++#include <linux/config.h>
++#include <asm/pal.h>
++#include <asm/page.h>
++#include <asm/barrier.h>
++
++/*
++ * System defines.. Note that this is included both from .c and .S
++ * files, so it does only defines, not any C code.
++ */
++
++/*
++ * We leave one page for the initial stack page, and one page for
++ * the initial process structure. Also, the console eats 3 MB for
++ * the initial bootloader (one of which we can reclaim later).
++ */
++#define BOOT_PCB	0x20000000
++#define BOOT_ADDR	0x20000000
++/* Remove when official MILO sources have ELF support: */
++#define BOOT_SIZE	(16*1024)
++
++#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
++#define KERNEL_START_PHYS	0x300000 /* Old bootloaders hardcoded this.  */
++#else
++#define KERNEL_START_PHYS	0x1000000 /* required: Wildfire/Titan/Marvel */
++#endif
++
++#define KERNEL_START	(PAGE_OFFSET+KERNEL_START_PHYS)
++#define SWAPPER_PGD	KERNEL_START
++#define INIT_STACK	(PAGE_OFFSET+KERNEL_START_PHYS+0x02000)
++#define EMPTY_PGT	(PAGE_OFFSET+KERNEL_START_PHYS+0x04000)
++#define EMPTY_PGE	(PAGE_OFFSET+KERNEL_START_PHYS+0x08000)
++#define ZERO_PGE	(PAGE_OFFSET+KERNEL_START_PHYS+0x0A000)
++
++#define START_ADDR	(PAGE_OFFSET+KERNEL_START_PHYS+0x10000)
++
++/*
++ * This is setup by the secondary bootstrap loader.  Because
++ * the zero page is zeroed out as soon as the vm system is
++ * initialized, we need to copy things out into a more permanent
++ * place.
++ */
++#define PARAM			ZERO_PGE
++#define COMMAND_LINE		((char*)(PARAM + 0x0000))
++#define INITRD_START		(*(unsigned long *) (PARAM+0x100))
++#define INITRD_SIZE		(*(unsigned long *) (PARAM+0x108))
++
++#ifndef __ASSEMBLY__
++#include <linux/kernel.h>
++
++/*
++ * This is the logout header that should be common to all platforms
++ * (assuming they are running OSF/1 PALcode, I guess).
++ */
++struct el_common {
++	unsigned int	size;		/* size in bytes of logout area */
++	unsigned int	sbz1	: 30;	/* should be zero */
++	unsigned int	err2	:  1;	/* second error */
++	unsigned int	retry	:  1;	/* retry flag */
++	unsigned int	proc_offset;	/* processor-specific offset */
++	unsigned int	sys_offset;	/* system-specific offset */
++	unsigned int	code;		/* machine check code */
++	unsigned int	frame_rev;	/* frame revision */
++};
++
++/* Machine Check Frame for uncorrectable errors (Large format)
++ *      --- This is used to log uncorrectable errors such as
++ *          double bit ECC errors.
++ *      --- These errors are detected by both processor and systems.
++ */
++struct el_common_EV5_uncorrectable_mcheck {
++        unsigned long   shadow[8];        /* Shadow reg. 8-14, 25           */
++        unsigned long   paltemp[24];      /* PAL TEMP REGS.                 */
++        unsigned long   exc_addr;         /* Address of excepting instruction*/
++        unsigned long   exc_sum;          /* Summary of arithmetic traps.   */
++        unsigned long   exc_mask;         /* Exception mask (from exc_sum). */
++        unsigned long   pal_base;         /* Base address for PALcode.      */
++        unsigned long   isr;              /* Interrupt Status Reg.          */
++        unsigned long   icsr;             /* CURRENT SETUP OF EV5 IBOX      */
++        unsigned long   ic_perr_stat;     /* I-CACHE Reg. <11> set Data parity
++                                                         <12> set TAG parity*/
++        unsigned long   dc_perr_stat;     /* D-CACHE error Reg. Bits set to 1:
++                                                     <2> Data error in bank 0
++                                                     <3> Data error in bank 1
++                                                     <4> Tag error in bank 0
++                                                     <5> Tag error in bank 1 */
++        unsigned long   va;               /* Effective VA of fault or miss. */
++        unsigned long   mm_stat;          /* Holds the reason for D-stream 
++                                             fault or D-cache parity errors */
++        unsigned long   sc_addr;          /* Address that was being accessed
++                                             when EV5 detected Secondary cache
++                                             failure.                 */
++        unsigned long   sc_stat;          /* Helps determine if the error was
++                                             TAG/Data parity(Secondary Cache)*/
++        unsigned long   bc_tag_addr;      /* Contents of EV5 BC_TAG_ADDR    */
++        unsigned long   ei_addr;          /* Physical address of any transfer
++                                             that is logged in EV5 EI_STAT */
++        unsigned long   fill_syndrome;    /* For correcting ECC errors.     */
++        unsigned long   ei_stat;          /* Helps identify reason of any 
++                                             processor uncorrectable error
++                                             at its external interface.     */
++        unsigned long   ld_lock;          /* Contents of EV5 LD_LOCK register*/
++};
++
++struct el_common_EV6_mcheck {
++	unsigned int FrameSize;		/* Bytes, including this field */
++	unsigned int FrameFlags;	/* <31> = Retry, <30> = Second Error */
++	unsigned int CpuOffset;		/* Offset to CPU-specific info */
++	unsigned int SystemOffset;	/* Offset to system-specific info */
++	unsigned int MCHK_Code;
++	unsigned int MCHK_Frame_Rev;
++	unsigned long I_STAT;		/* EV6 Internal Processor Registers */
++	unsigned long DC_STAT;		/* (See the 21264 Spec) */
++	unsigned long C_ADDR;
++	unsigned long DC1_SYNDROME;
++	unsigned long DC0_SYNDROME;
++	unsigned long C_STAT;
++	unsigned long C_STS;
++	unsigned long MM_STAT;
++	unsigned long EXC_ADDR;
++	unsigned long IER_CM;
++	unsigned long ISUM;
++	unsigned long RESERVED0;
++	unsigned long PAL_BASE;
++	unsigned long I_CTL;
++	unsigned long PCTX;
++};
++
++extern void halt(void) __attribute__((noreturn));
++#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
++
++#define switch_to(P,N,L)						\
++  do {									\
++    (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P));	\
++    check_mmu_context();						\
++  } while (0)
++
++struct task_struct;
++extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
++
++#define imb() \
++__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
++
++#define draina() \
++__asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory")
++
++enum implver_enum {
++	IMPLVER_EV4,
++	IMPLVER_EV5,
++	IMPLVER_EV6
++};
++
++#ifdef CONFIG_ALPHA_GENERIC
++#define implver()				\
++({ unsigned long __implver;			\
++   __asm__ ("implver %0" : "=r"(__implver));	\
++   (enum implver_enum) __implver; })
++#else
++/* Try to eliminate some dead code.  */
++#ifdef CONFIG_ALPHA_EV4
++#define implver() IMPLVER_EV4
++#endif
++#ifdef CONFIG_ALPHA_EV5
++#define implver() IMPLVER_EV5
++#endif
++#if defined(CONFIG_ALPHA_EV6)
++#define implver() IMPLVER_EV6
++#endif
++#endif
++
++enum amask_enum {
++	AMASK_BWX = (1UL << 0),
++	AMASK_FIX = (1UL << 1),
++	AMASK_CIX = (1UL << 2),
++	AMASK_MAX = (1UL << 8),
++	AMASK_PRECISE_TRAP = (1UL << 9),
++};
++
++#define amask(mask)						\
++({ unsigned long __amask, __input = (mask);			\
++   __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input));	\
++   __amask; })
++
++#define __CALL_PAL_R0(NAME, TYPE)				\
++static inline TYPE NAME(void)					\
++{								\
++	register TYPE __r0 __asm__("$0");			\
++	__asm__ __volatile__(					\
++		"call_pal %1 # " #NAME				\
++		:"=r" (__r0)					\
++		:"i" (PAL_ ## NAME)				\
++		:"$1", "$16", "$22", "$23", "$24", "$25");	\
++	return __r0;						\
++}
++
++#define __CALL_PAL_W1(NAME, TYPE0)				\
++static inline void NAME(TYPE0 arg0)				\
++{								\
++	register TYPE0 __r16 __asm__("$16") = arg0;		\
++	__asm__ __volatile__(					\
++		"call_pal %1 # "#NAME				\
++		: "=r"(__r16)					\
++		: "i"(PAL_ ## NAME), "0"(__r16)			\
++		: "$1", "$22", "$23", "$24", "$25");		\
++}
++
++#define __CALL_PAL_W2(NAME, TYPE0, TYPE1)			\
++static inline void NAME(TYPE0 arg0, TYPE1 arg1)			\
++{								\
++	register TYPE0 __r16 __asm__("$16") = arg0;		\
++	register TYPE1 __r17 __asm__("$17") = arg1;		\
++	__asm__ __volatile__(					\
++		"call_pal %2 # "#NAME				\
++		: "=r"(__r16), "=r"(__r17)			\
++		: "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17)	\
++		: "$1", "$22", "$23", "$24", "$25");		\
++}
++
++#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0)			\
++static inline RTYPE NAME(TYPE0 arg0)				\
++{								\
++	register RTYPE __r0 __asm__("$0");			\
++	register TYPE0 __r16 __asm__("$16") = arg0;		\
++	__asm__ __volatile__(					\
++		"call_pal %2 # "#NAME				\
++		: "=r"(__r16), "=r"(__r0)			\
++		: "i"(PAL_ ## NAME), "0"(__r16)			\
++		: "$1", "$22", "$23", "$24", "$25");		\
++	return __r0;						\
++}
++
++#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1)		\
++static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1)		\
++{								\
++	register RTYPE __r0 __asm__("$0");			\
++	register TYPE0 __r16 __asm__("$16") = arg0;		\
++	register TYPE1 __r17 __asm__("$17") = arg1;		\
++	__asm__ __volatile__(					\
++		"call_pal %3 # "#NAME				\
++		: "=r"(__r16), "=r"(__r17), "=r"(__r0)		\
++		: "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17)	\
++		: "$1", "$22", "$23", "$24", "$25");		\
++	return __r0;						\
++}
++
++__CALL_PAL_W1(cflush, unsigned long);
++__CALL_PAL_R0(rdmces, unsigned long);
++__CALL_PAL_R0(rdps, unsigned long);
++__CALL_PAL_R0(rdusp, unsigned long);
++__CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
++__CALL_PAL_R0(whami, unsigned long);
++__CALL_PAL_W2(wrent, void*, unsigned long);
++__CALL_PAL_W1(wripir, unsigned long);
++__CALL_PAL_W1(wrkgp, unsigned long);
++__CALL_PAL_W1(wrmces, unsigned long);
++__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
++__CALL_PAL_W1(wrusp, unsigned long);
++__CALL_PAL_W1(wrvptptr, unsigned long);
++
++#define IPL_MIN		0
++#define IPL_SW0		1
++#define IPL_SW1		2
++#define IPL_DEV0	3
++#define IPL_DEV1	4
++#define IPL_TIMER	5
++#define IPL_PERF	6
++#define IPL_POWERFAIL	6
++#define IPL_MCHECK	7
++#define IPL_MAX		7
++
++#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
++#undef IPL_MIN
++#define IPL_MIN		__min_ipl
++extern int __min_ipl;
++#endif
++
++#define getipl()		(rdps() & 7)
++#define setipl(ipl)		((void) swpipl(ipl))
++
++#define local_irq_disable()			do { setipl(IPL_MAX); barrier(); } while(0)
++#define local_irq_enable()			do { barrier(); setipl(IPL_MIN); } while(0)
++#define local_save_flags(flags)	((flags) = rdps())
++#define local_irq_save(flags)	do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
++#define local_irq_restore(flags)	do { barrier(); setipl(flags); barrier(); } while(0)
++
++#define irqs_disabled()	(getipl() == IPL_MAX)
++
++/*
++ * TB routines..
++ */
++#define __tbi(nr,arg,arg1...)					\
++({								\
++	register unsigned long __r16 __asm__("$16") = (nr);	\
++	register unsigned long __r17 __asm__("$17"); arg;	\
++	__asm__ __volatile__(					\
++		"call_pal %3 #__tbi"				\
++		:"=r" (__r16),"=r" (__r17)			\
++		:"0" (__r16),"i" (PAL_tbi) ,##arg1		\
++		:"$0", "$1", "$22", "$23", "$24", "$25");	\
++})
++
++#define tbi(x,y)	__tbi(x,__r17=(y),"1" (__r17))
++#define tbisi(x)	__tbi(1,__r17=(x),"1" (__r17))
++#define tbisd(x)	__tbi(2,__r17=(x),"1" (__r17))
++#define tbis(x)		__tbi(3,__r17=(x),"1" (__r17))
++#define tbiap()		__tbi(-1, /* no second argument */)
++#define tbia()		__tbi(-2, /* no second argument */)
++
++/*
++ * Atomic exchange.
++ * Since it can be used to implement critical sections
++ * it must clobber "memory" (also for interrupts in UP).
++ */
++
++static inline unsigned long
++__xchg_u8(volatile char *m, unsigned long val)
++{
++	unsigned long ret, tmp, addr64;
++
++	__asm__ __volatile__(
++	"	andnot	%4,7,%3\n"
++	"	insbl	%1,%4,%1\n"
++	"1:	ldq_l	%2,0(%3)\n"
++	"	extbl	%2,%4,%0\n"
++	"	mskbl	%2,%4,%2\n"
++	"	or	%1,%2,%2\n"
++	"	stq_c	%2,0(%3)\n"
++	"	beq	%2,2f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	".subsection 2\n"
++	"2:	br	1b\n"
++	".previous"
++	: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
++	: "r" ((long)m), "1" (val) : "memory");
++
++	return ret;
++}
++
++static inline unsigned long
++__xchg_u16(volatile short *m, unsigned long val)
++{
++	unsigned long ret, tmp, addr64;
++
++	__asm__ __volatile__(
++	"	andnot	%4,7,%3\n"
++	"	inswl	%1,%4,%1\n"
++	"1:	ldq_l	%2,0(%3)\n"
++	"	extwl	%2,%4,%0\n"
++	"	mskwl	%2,%4,%2\n"
++	"	or	%1,%2,%2\n"
++	"	stq_c	%2,0(%3)\n"
++	"	beq	%2,2f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	".subsection 2\n"
++	"2:	br	1b\n"
++	".previous"
++	: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
++	: "r" ((long)m), "1" (val) : "memory");
++
++	return ret;
++}
++
++static inline unsigned long
++__xchg_u32(volatile int *m, unsigned long val)
++{
++	unsigned long dummy;
++
++	__asm__ __volatile__(
++	"1:	ldl_l %0,%4\n"
++	"	bis $31,%3,%1\n"
++	"	stl_c %1,%2\n"
++	"	beq %1,2f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	".subsection 2\n"
++	"2:	br 1b\n"
++	".previous"
++	: "=&r" (val), "=&r" (dummy), "=m" (*m)
++	: "rI" (val), "m" (*m) : "memory");
++
++	return val;
++}
++
++static inline unsigned long
++__xchg_u64(volatile long *m, unsigned long val)
++{
++	unsigned long dummy;
++
++	__asm__ __volatile__(
++	"1:	ldq_l %0,%4\n"
++	"	bis $31,%3,%1\n"
++	"	stq_c %1,%2\n"
++	"	beq %1,2f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	".subsection 2\n"
++	"2:	br 1b\n"
++	".previous"
++	: "=&r" (val), "=&r" (dummy), "=m" (*m)
++	: "rI" (val), "m" (*m) : "memory");
++
++	return val;
++}
++
++/* This function doesn't exist, so you'll get a linker error
++   if something tries to do an invalid xchg().  */
++extern void __xchg_called_with_bad_pointer(void);
++
++#define __xchg(ptr, x, size) \
++({ \
++	unsigned long __xchg__res; \
++	volatile void *__xchg__ptr = (ptr); \
++	switch (size) { \
++		case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
++		case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
++		case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
++		case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
++		default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
++	} \
++	__xchg__res; \
++})
++
++#define xchg(ptr,x)							     \
++  ({									     \
++     __typeof__(*(ptr)) _x_ = (x);					     \
++     (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
++  })
++
++#define tas(ptr) (xchg((ptr),1))
++
++
++/* 
++ * Atomic compare and exchange.  Compare OLD with MEM, if identical,
++ * store NEW in MEM.  Return the initial value in MEM.  Success is
++ * indicated by comparing RETURN with OLD.
++ *
++ * The memory barrier should be placed in SMP only when we actually
++ * make the change. If we don't change anything (so if the returned
++ * prev is equal to old) then we aren't acquiring anything new and
++ * we don't need any memory barrier as far I can tell.
++ */
++
++#define __HAVE_ARCH_CMPXCHG 1
++
++static inline unsigned long
++__cmpxchg_u8(volatile char *m, long old, long new)
++{
++	unsigned long prev, tmp, cmp, addr64;
++
++	__asm__ __volatile__(
++	"	andnot	%5,7,%4\n"
++	"	insbl	%1,%5,%1\n"
++	"1:	ldq_l	%2,0(%4)\n"
++	"	extbl	%2,%5,%0\n"
++	"	cmpeq	%0,%6,%3\n"
++	"	beq	%3,2f\n"
++	"	mskbl	%2,%5,%2\n"
++	"	or	%1,%2,%2\n"
++	"	stq_c	%2,0(%4)\n"
++	"	beq	%2,3f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	"2:\n"
++	".subsection 2\n"
++	"3:	br	1b\n"
++	".previous"
++	: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
++	: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
++
++	return prev;
++}
++
++static inline unsigned long
++__cmpxchg_u16(volatile short *m, long old, long new)
++{
++	unsigned long prev, tmp, cmp, addr64;
++
++	__asm__ __volatile__(
++	"	andnot	%5,7,%4\n"
++	"	inswl	%1,%5,%1\n"
++	"1:	ldq_l	%2,0(%4)\n"
++	"	extwl	%2,%5,%0\n"
++	"	cmpeq	%0,%6,%3\n"
++	"	beq	%3,2f\n"
++	"	mskwl	%2,%5,%2\n"
++	"	or	%1,%2,%2\n"
++	"	stq_c	%2,0(%4)\n"
++	"	beq	%2,3f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	"2:\n"
++	".subsection 2\n"
++	"3:	br	1b\n"
++	".previous"
++	: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
++	: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
++
++	return prev;
++}
++
++static inline unsigned long
++__cmpxchg_u32(volatile int *m, int old, int new)
++{
++	unsigned long prev, cmp;
++
++	__asm__ __volatile__(
++	"1:	ldl_l %0,%5\n"
++	"	cmpeq %0,%3,%1\n"
++	"	beq %1,2f\n"
++	"	mov %4,%1\n"
++	"	stl_c %1,%2\n"
++	"	beq %1,3f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	"2:\n"
++	".subsection 2\n"
++	"3:	br 1b\n"
++	".previous"
++	: "=&r"(prev), "=&r"(cmp), "=m"(*m)
++	: "r"((long) old), "r"(new), "m"(*m) : "memory");
++
++	return prev;
++}
++
++static inline unsigned long
++__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
++{
++	unsigned long prev, cmp;
++
++	__asm__ __volatile__(
++	"1:	ldq_l %0,%5\n"
++	"	cmpeq %0,%3,%1\n"
++	"	beq %1,2f\n"
++	"	mov %4,%1\n"
++	"	stq_c %1,%2\n"
++	"	beq %1,3f\n"
++#ifdef CONFIG_SMP
++	"	mb\n"
++#endif
++	"2:\n"
++	".subsection 2\n"
++	"3:	br 1b\n"
++	".previous"
++	: "=&r"(prev), "=&r"(cmp), "=m"(*m)
++	: "r"((long) old), "r"(new), "m"(*m) : "memory");
++
++	return prev;
++}
++
++/* This function doesn't exist, so you'll get a linker error
++   if something tries to do an invalid cmpxchg().  */
++extern void __cmpxchg_called_with_bad_pointer(void);
++
++static inline unsigned long
++__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
++{
++	switch (size) {
++		case 1:
++			return __cmpxchg_u8(ptr, old, new);
++		case 2:
++			return __cmpxchg_u16(ptr, old, new);
++		case 4:
++			return __cmpxchg_u32(ptr, old, new);
++		case 8:
++			return __cmpxchg_u64(ptr, old, new);
++	}
++	__cmpxchg_called_with_bad_pointer();
++	return old;
++}
++
++#define cmpxchg(ptr,o,n)						 \
++  ({									 \
++     __typeof__(*(ptr)) _o_ = (o);					 \
++     __typeof__(*(ptr)) _n_ = (n);					 \
++     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \
++				    (unsigned long)_n_, sizeof(*(ptr))); \
++  })
++
++#endif /* __ASSEMBLY__ */
++
++#define arch_align_stack(x) (x)
++
++#endif
+diff -Naur aboot-0.9b.orig/include/asm-generic/page.h aboot-0.9b/include/asm-generic/page.h
+--- aboot-0.9b.orig/include/asm-generic/page.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/asm-generic/page.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,27 @@
++#ifndef _ASM_GENERIC_PAGE_H
++#define _ASM_GENERIC_PAGE_H
++
++#ifdef __KERNEL__
++#ifndef __ASSEMBLY__
++
++#include <linux/compiler.h>
++
++/* Pure 2^n version of get_order */
++/*
++static int get_order(unsigned long size)
++{
++	int order;
++
++	size = (size - 1) >> (PAGE_SHIFT - 1);
++	order = -1;
++	do {
++		size >>= 1;
++		order++;
++	} while (size);
++	return order;
++}*/
++
++#endif	/* __ASSEMBLY__ */
++#endif	/* __KERNEL__ */
++
++#endif	/* _ASM_GENERIC_PAGE_H */
+diff -Naur aboot-0.9b.orig/include/linux/auxvec.h aboot-0.9b/include/linux/auxvec.h
+--- aboot-0.9b.orig/include/linux/auxvec.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/linux/auxvec.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,31 @@
++#ifndef _LINUX_AUXVEC_H
++#define _LINUX_AUXVEC_H
++
++#include <asm/auxvec.h>
++
++/* Symbolic values for the entries in the auxiliary table
++   put on the initial stack */
++#define AT_NULL   0	/* end of vector */
++#define AT_IGNORE 1	/* entry should be ignored */
++#define AT_EXECFD 2	/* file descriptor of program */
++#define AT_PHDR   3	/* program headers for program */
++#define AT_PHENT  4	/* size of program header entry */
++#define AT_PHNUM  5	/* number of program headers */
++#define AT_PAGESZ 6	/* system page size */
++#define AT_BASE   7	/* base address of interpreter */
++#define AT_FLAGS  8	/* flags */
++#define AT_ENTRY  9	/* entry point of program */
++#define AT_NOTELF 10	/* program is not ELF */
++#define AT_UID    11	/* real uid */
++#define AT_EUID   12	/* effective uid */
++#define AT_GID    13	/* real gid */
++#define AT_EGID   14	/* effective gid */
++#define AT_PLATFORM 15  /* string identifying CPU for optimizations */
++#define AT_HWCAP  16    /* arch dependent hints at CPU capabilities */
++#define AT_CLKTCK 17	/* frequency at which times() increments */
++
++#define AT_SECURE 23   /* secure mode boolean */
++
++#define AT_VECTOR_SIZE  42 /* Size of auxiliary table.  */
++
++#endif /* _LINUX_AUXVEC_H */
+diff -Naur aboot-0.9b.orig/include/linux/elf.h aboot-0.9b/include/linux/elf.h
+--- aboot-0.9b.orig/include/linux/elf.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/linux/elf.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,427 @@
++#ifndef _LINUX_ELF_H
++#define _LINUX_ELF_H
++
++#include <linux/types.h>
++#include <linux/auxvec.h>
++#include <asm/elf.h>
++
++#ifndef elf_read_implies_exec
++  /* Executables for which elf_read_implies_exec() returns TRUE will
++     have the READ_IMPLIES_EXEC personality flag set automatically.
++     Override in asm/elf.h as needed.  */
++# define elf_read_implies_exec(ex, have_pt_gnu_stack)	0
++#endif
++
++/* 32-bit ELF base types. */
++typedef __u32	Elf32_Addr;
++typedef __u16	Elf32_Half;
++typedef __u32	Elf32_Off;
++typedef __s32	Elf32_Sword;
++typedef __u32	Elf32_Word;
++
++/* 64-bit ELF base types. */
++typedef __u64	Elf64_Addr;
++typedef __u16	Elf64_Half;
++typedef __s16	Elf64_SHalf;
++typedef __u64	Elf64_Off;
++typedef __s32	Elf64_Sword;
++typedef __u32	Elf64_Word;
++typedef __u64	Elf64_Xword;
++typedef __s64	Elf64_Sxword;
++
++/* These constants are for the segment types stored in the image headers */
++#define PT_NULL    0
++#define PT_LOAD    1
++#define PT_DYNAMIC 2
++#define PT_INTERP  3
++#define PT_NOTE    4
++#define PT_SHLIB   5
++#define PT_PHDR    6
++#define PT_TLS     7               /* Thread local storage segment */
++#define PT_LOOS    0x60000000      /* OS-specific */
++#define PT_HIOS    0x6fffffff      /* OS-specific */
++#define PT_LOPROC  0x70000000
++#define PT_HIPROC  0x7fffffff
++#define PT_GNU_EH_FRAME		0x6474e550
++
++#define PT_GNU_STACK	(PT_LOOS + 0x474e551)
++
++/* These constants define the different elf file types */
++#define ET_NONE   0
++#define ET_REL    1
++#define ET_EXEC   2
++#define ET_DYN    3
++#define ET_CORE   4
++#define ET_LOPROC 0xff00
++#define ET_HIPROC 0xffff
++
++/* These constants define the various ELF target machines */
++#define EM_NONE  0
++#define EM_M32   1
++#define EM_SPARC 2
++#define EM_386   3
++#define EM_68K   4
++#define EM_88K   5
++#define EM_486   6   /* Perhaps disused */
++#define EM_860   7
++
++#define EM_MIPS		8	/* MIPS R3000 (officially, big-endian only) */
++
++#define EM_MIPS_RS4_BE 10	/* MIPS R4000 big-endian */
++
++#define EM_PARISC      15	/* HPPA */
++
++#define EM_SPARC32PLUS 18	/* Sun's "v8plus" */
++
++#define EM_PPC	       20	/* PowerPC */
++#define EM_PPC64       21       /* PowerPC64 */
++
++#define EM_SH	       42	/* SuperH */
++
++#define EM_SPARCV9     43	/* SPARC v9 64-bit */
++
++#define EM_IA_64	50	/* HP/Intel IA-64 */
++
++#define EM_X86_64	62	/* AMD x86-64 */
++
++#define EM_S390		22	/* IBM S/390 */
++
++#define EM_CRIS         76      /* Axis Communications 32-bit embedded processor */
++
++#define EM_V850		87	/* NEC v850 */
++
++#define EM_M32R		88	/* Renesas M32R */
++
++#define EM_H8_300       46      /* Renesas H8/300,300H,H8S */
++
++/*
++ * This is an interim value that we will use until the committee comes
++ * up with a final number.
++ */
++#define EM_ALPHA	0x9026
++
++/* Bogus old v850 magic number, used by old tools.  */
++#define EM_CYGNUS_V850	0x9080
++
++/* Bogus old m32r magic number, used by old tools.  */
++#define EM_CYGNUS_M32R	0x9041
++
++/*
++ * This is the old interim value for S/390 architecture
++ */
++#define EM_S390_OLD     0xA390
++
++#define EM_FRV		0x5441		/* Fujitsu FR-V */
++
++/* This is the info that is needed to parse the dynamic section of the file */
++#define DT_NULL		0
++#define DT_NEEDED	1
++#define DT_PLTRELSZ	2
++#define DT_PLTGOT	3
++#define DT_HASH		4
++#define DT_STRTAB	5
++#define DT_SYMTAB	6
++#define DT_RELA		7
++#define DT_RELASZ	8
++#define DT_RELAENT	9
++#define DT_STRSZ	10
++#define DT_SYMENT	11
++#define DT_INIT		12
++#define DT_FINI		13
++#define DT_SONAME	14
++#define DT_RPATH 	15
++#define DT_SYMBOLIC	16
++#define DT_REL	        17
++#define DT_RELSZ	18
++#define DT_RELENT	19
++#define DT_PLTREL	20
++#define DT_DEBUG	21
++#define DT_TEXTREL	22
++#define DT_JMPREL	23
++#define DT_LOPROC	0x70000000
++#define DT_HIPROC	0x7fffffff
++
++/* This info is needed when parsing the symbol table */
++#define STB_LOCAL  0
++#define STB_GLOBAL 1
++#define STB_WEAK   2
++
++#define STT_NOTYPE  0
++#define STT_OBJECT  1
++#define STT_FUNC    2
++#define STT_SECTION 3
++#define STT_FILE    4
++
++#define ELF_ST_BIND(x)		((x) >> 4)
++#define ELF_ST_TYPE(x)		(((unsigned int) x) & 0xf)
++#define ELF32_ST_BIND(x)	ELF_ST_BIND(x)
++#define ELF32_ST_TYPE(x)	ELF_ST_TYPE(x)
++#define ELF64_ST_BIND(x)	ELF_ST_BIND(x)
++#define ELF64_ST_TYPE(x)	ELF_ST_TYPE(x)
++
++typedef struct dynamic{
++  Elf32_Sword d_tag;
++  union{
++    Elf32_Sword	d_val;
++    Elf32_Addr	d_ptr;
++  } d_un;
++} Elf32_Dyn;
++
++typedef struct {
++  Elf64_Sxword d_tag;		/* entry tag value */
++  union {
++    Elf64_Xword d_val;
++    Elf64_Addr d_ptr;
++  } d_un;
++} Elf64_Dyn;
++
++/* The following are used with relocations */
++#define ELF32_R_SYM(x) ((x) >> 8)
++#define ELF32_R_TYPE(x) ((x) & 0xff)
++
++#define ELF64_R_SYM(i)			((i) >> 32)
++#define ELF64_R_TYPE(i)			((i) & 0xffffffff)
++
++typedef struct elf32_rel {
++  Elf32_Addr	r_offset;
++  Elf32_Word	r_info;
++} Elf32_Rel;
++
++typedef struct elf64_rel {
++  Elf64_Addr r_offset;	/* Location at which to apply the action */
++  Elf64_Xword r_info;	/* index and type of relocation */
++} Elf64_Rel;
++
++typedef struct elf32_rela{
++  Elf32_Addr	r_offset;
++  Elf32_Word	r_info;
++  Elf32_Sword	r_addend;
++} Elf32_Rela;
++
++typedef struct elf64_rela {
++  Elf64_Addr r_offset;	/* Location at which to apply the action */
++  Elf64_Xword r_info;	/* index and type of relocation */
++  Elf64_Sxword r_addend;	/* Constant addend used to compute value */
++} Elf64_Rela;
++
++typedef struct elf32_sym{
++  Elf32_Word	st_name;
++  Elf32_Addr	st_value;
++  Elf32_Word	st_size;
++  unsigned char	st_info;
++  unsigned char	st_other;
++  Elf32_Half	st_shndx;
++} Elf32_Sym;
++
++typedef struct elf64_sym {
++  Elf64_Word st_name;		/* Symbol name, index in string tbl */
++  unsigned char	st_info;	/* Type and binding attributes */
++  unsigned char	st_other;	/* No defined meaning, 0 */
++  Elf64_Half st_shndx;		/* Associated section index */
++  Elf64_Addr st_value;		/* Value of the symbol */
++  Elf64_Xword st_size;		/* Associated symbol size */
++} Elf64_Sym;
++
++
++#define EI_NIDENT	16
++
++typedef struct elf32_hdr{
++  unsigned char	e_ident[EI_NIDENT];
++  Elf32_Half	e_type;
++  Elf32_Half	e_machine;
++  Elf32_Word	e_version;
++  Elf32_Addr	e_entry;  /* Entry point */
++  Elf32_Off	e_phoff;
++  Elf32_Off	e_shoff;
++  Elf32_Word	e_flags;
++  Elf32_Half	e_ehsize;
++  Elf32_Half	e_phentsize;
++  Elf32_Half	e_phnum;
++  Elf32_Half	e_shentsize;
++  Elf32_Half	e_shnum;
++  Elf32_Half	e_shstrndx;
++} Elf32_Ehdr;
++
++typedef struct elf64_hdr {
++  unsigned char	e_ident[16];		/* ELF "magic number" */
++  Elf64_Half e_type;
++  Elf64_Half e_machine;
++  Elf64_Word e_version;
++  Elf64_Addr e_entry;		/* Entry point virtual address */
++  Elf64_Off e_phoff;		/* Program header table file offset */
++  Elf64_Off e_shoff;		/* Section header table file offset */
++  Elf64_Word e_flags;
++  Elf64_Half e_ehsize;
++  Elf64_Half e_phentsize;
++  Elf64_Half e_phnum;
++  Elf64_Half e_shentsize;
++  Elf64_Half e_shnum;
++  Elf64_Half e_shstrndx;
++} Elf64_Ehdr;
++
++/* These constants define the permissions on sections in the program
++   header, p_flags. */
++#define PF_R		0x4
++#define PF_W		0x2
++#define PF_X		0x1
++
++typedef struct elf32_phdr{
++  Elf32_Word	p_type;
++  Elf32_Off	p_offset;
++  Elf32_Addr	p_vaddr;
++  Elf32_Addr	p_paddr;
++  Elf32_Word	p_filesz;
++  Elf32_Word	p_memsz;
++  Elf32_Word	p_flags;
++  Elf32_Word	p_align;
++} Elf32_Phdr;
++
++typedef struct elf64_phdr {
++  Elf64_Word p_type;
++  Elf64_Word p_flags;
++  Elf64_Off p_offset;		/* Segment file offset */
++  Elf64_Addr p_vaddr;		/* Segment virtual address */
++  Elf64_Addr p_paddr;		/* Segment physical address */
++  Elf64_Xword p_filesz;		/* Segment size in file */
++  Elf64_Xword p_memsz;		/* Segment size in memory */
++  Elf64_Xword p_align;		/* Segment alignment, file & memory */
++} Elf64_Phdr;
++
++/* sh_type */
++#define SHT_NULL	0
++#define SHT_PROGBITS	1
++#define SHT_SYMTAB	2
++#define SHT_STRTAB	3
++#define SHT_RELA	4
++#define SHT_HASH	5
++#define SHT_DYNAMIC	6
++#define SHT_NOTE	7
++#define SHT_NOBITS	8
++#define SHT_REL		9
++#define SHT_SHLIB	10
++#define SHT_DYNSYM	11
++#define SHT_NUM		12
++#define SHT_LOPROC	0x70000000
++#define SHT_HIPROC	0x7fffffff
++#define SHT_LOUSER	0x80000000
++#define SHT_HIUSER	0xffffffff
++
++/* sh_flags */
++#define SHF_WRITE	0x1
++#define SHF_ALLOC	0x2
++#define SHF_EXECINSTR	0x4
++#define SHF_MASKPROC	0xf0000000
++
++/* special section indexes */
++#define SHN_UNDEF	0
++#define SHN_LORESERVE	0xff00
++#define SHN_LOPROC	0xff00
++#define SHN_HIPROC	0xff1f
++#define SHN_ABS		0xfff1
++#define SHN_COMMON	0xfff2
++#define SHN_HIRESERVE	0xffff
++ 
++typedef struct {
++  Elf32_Word	sh_name;
++  Elf32_Word	sh_type;
++  Elf32_Word	sh_flags;
++  Elf32_Addr	sh_addr;
++  Elf32_Off	sh_offset;
++  Elf32_Word	sh_size;
++  Elf32_Word	sh_link;
++  Elf32_Word	sh_info;
++  Elf32_Word	sh_addralign;
++  Elf32_Word	sh_entsize;
++} Elf32_Shdr;
++
++typedef struct elf64_shdr {
++  Elf64_Word sh_name;		/* Section name, index in string tbl */
++  Elf64_Word sh_type;		/* Type of section */
++  Elf64_Xword sh_flags;		/* Miscellaneous section attributes */
++  Elf64_Addr sh_addr;		/* Section virtual addr at execution */
++  Elf64_Off sh_offset;		/* Section file offset */
++  Elf64_Xword sh_size;		/* Size of section in bytes */
++  Elf64_Word sh_link;		/* Index of another section */
++  Elf64_Word sh_info;		/* Additional section information */
++  Elf64_Xword sh_addralign;	/* Section alignment */
++  Elf64_Xword sh_entsize;	/* Entry size if section holds table */
++} Elf64_Shdr;
++
++#define	EI_MAG0		0		/* e_ident[] indexes */
++#define	EI_MAG1		1
++#define	EI_MAG2		2
++#define	EI_MAG3		3
++#define	EI_CLASS	4
++#define	EI_DATA		5
++#define	EI_VERSION	6
++#define	EI_OSABI	7
++#define	EI_PAD		8
++
++#define	ELFMAG0		0x7f		/* EI_MAG */
++#define	ELFMAG1		'E'
++#define	ELFMAG2		'L'
++#define	ELFMAG3		'F'
++#define	ELFMAG		"\177ELF"
++#define	SELFMAG		4
++
++#define	ELFCLASSNONE	0		/* EI_CLASS */
++#define	ELFCLASS32	1
++#define	ELFCLASS64	2
++#define	ELFCLASSNUM	3
++
++#define ELFDATANONE	0		/* e_ident[EI_DATA] */
++#define ELFDATA2LSB	1
++#define ELFDATA2MSB	2
++
++#define EV_NONE		0		/* e_version, EI_VERSION */
++#define EV_CURRENT	1
++#define EV_NUM		2
++
++#define ELFOSABI_NONE	0
++#define ELFOSABI_LINUX	3
++
++#ifndef ELF_OSABI
++#define ELF_OSABI ELFOSABI_NONE
++#endif
++
++/* Notes used in ET_CORE */
++#define NT_PRSTATUS	1
++#define NT_PRFPREG	2
++#define NT_PRPSINFO	3
++#define NT_TASKSTRUCT	4
++#define NT_AUXV		6
++#define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
++
++
++/* Note header in a PT_NOTE section */
++typedef struct elf32_note {
++  Elf32_Word	n_namesz;	/* Name size */
++  Elf32_Word	n_descsz;	/* Content size */
++  Elf32_Word	n_type;		/* Content type */
++} Elf32_Nhdr;
++
++/* Note header in a PT_NOTE section */
++typedef struct elf64_note {
++  Elf64_Word n_namesz;	/* Name size */
++  Elf64_Word n_descsz;	/* Content size */
++  Elf64_Word n_type;	/* Content type */
++} Elf64_Nhdr;
++
++#if ELF_CLASS == ELFCLASS32
++
++extern Elf32_Dyn _DYNAMIC [];
++#define elfhdr		elf32_hdr
++#define elf_phdr	elf32_phdr
++#define elf_note	elf32_note
++
++#else
++
++extern Elf64_Dyn _DYNAMIC [];
++#define elfhdr		elf64_hdr
++#define elf_phdr	elf64_phdr
++#define elf_note	elf64_note
++
++#endif
++
++
++#endif /* _LINUX_ELF_H */
+diff -Naur aboot-0.9b.orig/include/linux/stat.h aboot-0.9b/include/linux/stat.h
+--- aboot-0.9b.orig/include/linux/stat.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/linux/stat.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,77 @@
++#ifndef _LINUX_STAT_H
++#define _LINUX_STAT_H
++
++#ifdef __KERNEL__
++
++#include <asm/stat.h>
++
++#endif
++
++#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
++
++#define S_IFMT  00170000
++#define S_IFSOCK 0140000
++#define S_IFLNK	 0120000
++#define S_IFREG  0100000
++#define S_IFBLK  0060000
++#define S_IFDIR  0040000
++#define S_IFCHR  0020000
++#define S_IFIFO  0010000
++#define S_ISUID  0004000
++#define S_ISGID  0002000
++#define S_ISVTX  0001000
++
++#define S_ISLNK(m)	(((m) & S_IFMT) == S_IFLNK)
++#define S_ISREG(m)	(((m) & S_IFMT) == S_IFREG)
++#define S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
++#define S_ISCHR(m)	(((m) & S_IFMT) == S_IFCHR)
++#define S_ISBLK(m)	(((m) & S_IFMT) == S_IFBLK)
++#define S_ISFIFO(m)	(((m) & S_IFMT) == S_IFIFO)
++#define S_ISSOCK(m)	(((m) & S_IFMT) == S_IFSOCK)
++
++#define S_IRWXU 00700
++#define S_IRUSR 00400
++#define S_IWUSR 00200
++#define S_IXUSR 00100
++
++#define S_IRWXG 00070
++#define S_IRGRP 00040
++#define S_IWGRP 00020
++#define S_IXGRP 00010
++
++#define S_IRWXO 00007
++#define S_IROTH 00004
++#define S_IWOTH 00002
++#define S_IXOTH 00001
++
++#endif
++
++#ifdef __KERNEL__
++#define S_IRWXUGO	(S_IRWXU|S_IRWXG|S_IRWXO)
++#define S_IALLUGO	(S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
++#define S_IRUGO		(S_IRUSR|S_IRGRP|S_IROTH)
++#define S_IWUGO		(S_IWUSR|S_IWGRP|S_IWOTH)
++#define S_IXUGO		(S_IXUSR|S_IXGRP|S_IXOTH)
++
++#include <linux/types.h>
++#include <sys/time.h>
++
++struct kstat {
++	unsigned long	ino;
++	dev_t		dev;
++	umode_t		mode;
++	unsigned int	nlink;
++	uid_t		uid;
++	gid_t		gid;
++	dev_t		rdev;
++	loff_t		size;
++	struct timespec  atime;
++	struct timespec	mtime;
++	struct timespec	ctime;
++	unsigned long	blksize;
++	unsigned long	blocks;
++};
++
++#endif
++
++#endif
+diff -Naur aboot-0.9b.orig/include/linux/string.h aboot-0.9b/include/linux/string.h
+--- aboot-0.9b.orig/include/linux/string.h	1970-01-01 00:00:00.000000000 +0000
++++ aboot-0.9b/include/linux/string.h	2006-01-16 14:00:50.000000000 +0000
+@@ -0,0 +1,100 @@
++#ifndef _LINUX_STRING_H_
++#define _LINUX_STRING_H_
++
++/* We don't want strings.h stuff being user by user stuff by accident */
++
++#ifdef __KERNEL__
++
++typedef unsigned gfp_t;
++
++#include <linux/compiler.h>	/* for inline */
++#include <linux/types.h>	/* for size_t */
++#include <linux/stddef.h>	/* for NULL */
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++extern char * strpbrk(const char *,const char *);
++extern char * strsep(char **,const char *);
++extern __kernel_size_t strspn(const char *,const char *);
++extern __kernel_size_t strcspn(const char *,const char *);
++
++/*
++ * Include machine specific inline routines
++ */
++#include <asm/string.h>
++
++#ifndef __HAVE_ARCH_STRCPY
++extern char * strcpy(char *,const char *);
++#endif
++#ifndef __HAVE_ARCH_STRNCPY
++extern char * strncpy(char *,const char *, __kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_STRLCPY
++size_t strlcpy(char *, const char *, size_t);
++#endif
++#ifndef __HAVE_ARCH_STRCAT
++extern char * strcat(char *, const char *);
++#endif
++#ifndef __HAVE_ARCH_STRNCAT
++extern char * strncat(char *, const char *, __kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_STRLCAT
++extern size_t strlcat(char *, const char *, __kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_STRCMP
++extern int strcmp(const char *,const char *);
++#endif
++#ifndef __HAVE_ARCH_STRNCMP
++extern int strncmp(const char *,const char *,__kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_STRNICMP
++extern int strnicmp(const char *, const char *, __kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_STRCHR
++extern char * strchr(const char *,int);
++#endif
++#ifndef __HAVE_ARCH_STRNCHR
++extern char * strnchr(const char *, size_t, int);
++#endif
++#ifndef __HAVE_ARCH_STRRCHR
++extern char * strrchr(const char *,int);
++#endif
++#ifndef __HAVE_ARCH_STRSTR
++extern char * strstr(const char *,const char *);
++#endif
++#ifndef __HAVE_ARCH_STRLEN
++extern __kernel_size_t strlen(const char *);
++#endif
++#ifndef __HAVE_ARCH_STRNLEN
++extern __kernel_size_t strnlen(const char *,__kernel_size_t);
++#endif
++
++#ifndef __HAVE_ARCH_MEMSET
++extern void * memset(void *,int,__kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_MEMCPY
++extern void * memcpy(void *,const void *,__kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_MEMMOVE
++extern void * memmove(void *,const void *,__kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_MEMSCAN
++extern void * memscan(void *,int,__kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_MEMCMP
++extern int memcmp(const void *,const void *,__kernel_size_t);
++#endif
++#ifndef __HAVE_ARCH_MEMCHR
++extern void * memchr(const void *,int,__kernel_size_t);
++#endif
++
++extern char *kstrdup(const char *s, gfp_t gfp);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
++#endif /* _LINUX_STRING_H_ */
+diff -Naur aboot-0.9b.orig/lib/isolib.c aboot-0.9b/lib/isolib.c
+--- aboot-0.9b.orig/lib/isolib.c	2006-01-16 14:00:10.000000000 +0000
++++ aboot-0.9b/lib/isolib.c	2006-01-16 14:05:20.000000000 +0000
+@@ -6,6 +6,7 @@
+  * functionality to the Linux bootstrapper.  All we can do is
+  * open and read files... but that's all we need 8-)
+  */
++#define __KERNEL__
+ #ifndef TESTING
+ #  include <linux/string.h>
+ #endif
+@@ -1520,6 +1521,7 @@
+ #ifdef DEBUG_ROCK
+ 	   printf("Symlink component flag not implemented (%d)\n",slen);
+ #endif
++	   break;
+ 	 };
+ 	 slen -= slp->len + 2;
+ 	 oldslp = slp;
Index: patches/bash-3.1-fixes-6.patch
===================================================================
--- patches/bash-3.1-fixes-6.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/bash-3.1-fixes-6.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,568 @@
+Submitted By: Matthew Burgess (matthew at linuxfromscratch dot org)
+Date: 2006-03-18
+Initial Package Version: 3.1
+Origin: http://ftp.gnu.org/gnu/bash/bash-3.1-patches/
+Upstream Status: From Upstream 
+Description: Contains patches 001-014 from upstream
+
+diff -Naur bash-3.1.orig/doc/bash.1 bash-3.1/doc/bash.1
+--- bash-3.1.orig/doc/bash.1	2005-10-12 15:40:52.000000000 +0000
++++ bash-3.1/doc/bash.1	2006-03-18 09:23:33.000000000 +0000
+@@ -6,12 +6,12 @@
+ .\"	Case Western Reserve University
+ .\"	chet@po.cwru.edu
+ .\"
+-.\"	Last Change: Sat Aug 27 13:28:44 EDT 2005
++.\"	Last Change: Wed Dec 28 19:58:45 EST 2005
+ .\"
+ .\" bash_builtins, strip all but Built-Ins section
+ .if \n(zZ=1 .ig zZ
+ .if \n(zY=1 .ig zY
+-.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1"
++.TH BASH 1 "2005 Dec 28" "GNU Bash-3.1"
+ .\"
+ .\" There's some problem with having a `@'
+ .\" in a tagged paragraph with the BSD man macros.
+@@ -677,8 +677,8 @@
+ .B nocasematch
+ is enabled, the match is performed without regard to the case
+ of alphabetic characters.
+-The return value is 0 if the string matches or does not match
+-the pattern, respectively, and 1 otherwise.
++The return value is 0 if the string matches (\fB==\fP) or does not match
++(\fB!=\fP) the pattern, and 1 otherwise.
+ Any part of the pattern may be quoted to force it to be matched as a
+ string.
+ .if t .sp 0.5
+@@ -807,6 +807,12 @@
+ as for pathname expansion (see
+ .B Pathname Expansion
+ below).
++The \fIword\fP is expanded using tilde
++expansion, parameter and variable expansion, arithmetic substituion,
++command substitution, process substitution and quote removal.
++Each \fIpattern\fP examined is expanded using tilde
++expansion, parameter and variable expansion, arithmetic substituion,
++command substitution, and process substitution.
+ If the shell option
+ .B nocasematch
+ is enabled, the match is performed without regard to the case
+@@ -8484,7 +8490,7 @@
+ returns true if any of the arguments are found, false if
+ none are found.
+ .TP
+-\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
++\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]]
+ Provides control over the resources available to the shell and to
+ processes started by it, on systems that allow such control.
+ The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
+@@ -8523,6 +8529,9 @@
+ .B \-f
+ The maximum size of files created by the shell
+ .TP
++.B \-i
++The maximum number of pending signals
++.TP
+ .B \-l
+ The maximum size that may be locked into memory
+ .TP
+@@ -8536,6 +8545,9 @@
+ .B \-p
+ The pipe size in 512-byte blocks (this may not be set)
+ .TP
++.B \-q
++The maximum number of bytes in POSIX message queues
++.TP
+ .B \-s
+ The maximum stack size
+ .TP
+@@ -8547,6 +8559,9 @@
+ .TP
+ .B \-v
+ The maximum amount of virtual memory available to the shell
++.TP
++.B \-x
++The maximum number of file locks
+ .PD
+ .PP
+ If
+diff -Naur bash-3.1.orig/doc/bashref.texi bash-3.1/doc/bashref.texi
+--- bash-3.1.orig/doc/bashref.texi	2005-10-03 19:07:21.000000000 +0000
++++ bash-3.1/doc/bashref.texi	2006-03-18 09:23:33.000000000 +0000
+@@ -961,8 +961,8 @@
+ (see the description of @code{shopt} in @ref{Bash Builtins})
+ is enabled, the match is performed without regard to the case
+ of alphabetic characters.
+-The return value is 0 if the string matches or does not match
+-the pattern, respectively, and 1 otherwise.
++The return value is 0 if the string matches (@samp{==}) or does not
++match (@samp{!=})the pattern, and 1 otherwise.
+ Any part of the pattern may be quoted to force it to be matched as a
+ string.
+ 
+@@ -2598,7 +2598,7 @@
+ Builtin commands are necessary to implement functionality impossible
+ or inconvenient to obtain with separate utilities.
+ 
+-This section briefly the builtins which Bash inherits from
++This section briefly describes the builtins which Bash inherits from
+ the Bourne Shell, as well as the builtin commands which are unique
+ to or have been extended in Bash.
+ 
+@@ -3833,7 +3833,7 @@
+ @item ulimit
+ @btindex ulimit
+ @example
+-ulimit [-acdflmnpstuvSH] [@var{limit}]
++ulimit [-acdfilmnpqstuvxSH] [@var{limit}]
+ @end example
+ @code{ulimit} provides control over the resources available to processes
+ started by the shell, on systems that allow such control.  If an
+@@ -3857,6 +3857,9 @@
+ @item -f
+ The maximum size of files created by the shell.
+ 
++@item -i
++The maximum number of pending signals.
++
+ @item -l
+ The maximum size that may be locked into memory.
+ 
+@@ -3869,6 +3872,9 @@
+ @item -p
+ The pipe buffer size.
+ 
++@item -q
++The maximum number of bytes in POSIX message queues.
++
+ @item -s
+ The maximum stack size.
+ 
+@@ -3881,6 +3887,9 @@
+ @item -v
+ The maximum amount of virtual memory available to the process.
+ 
++@item -x
++The maximum number of file locks.
++
+ @end table
+ 
+ If @var{limit} is given, it is the new value of the specified resource;
+@@ -4089,8 +4098,8 @@
+ Print shell input lines as they are read.
+ 
+ @item -x
+-Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
+-commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
++Print a trace of simple commands, @code{for} commands, @code{case}
++commands, @code{select} commands, and arithmetic @code{for} commands
+ and their arguments or associated word lists after they are
+ expanded and before they are executed.  The value of the @env{PS4}
+ variable is expanded and the resultant value is printed before
+diff -Naur bash-3.1.orig/doc/version.texi bash-3.1/doc/version.texi
+--- bash-3.1.orig/doc/version.texi	2005-09-20 18:52:56.000000000 +0000
++++ bash-3.1/doc/version.texi	2006-03-18 09:23:33.000000000 +0000
+@@ -2,9 +2,9 @@
+ Copyright (C) 1988-2005 Free Software Foundation, Inc.
+ @end ignore
+ 
+-@set LASTCHANGE Mon Sep  5 11:47:04 EDT 2005
++@set LASTCHANGE Fri Dec 30 10:50:51 EST 2005
+ 
+-@set EDITION 3.1-beta1
+-@set VERSION 3.1-beta1
+-@set UPDATED 5 September 2005
+-@set UPDATED-MONTH September 2005
++@set EDITION 3.1
++@set VERSION 3.1
++@set UPDATED 30 December 2005
++@set UPDATED-MONTH December 2005
+diff -Naur bash-3.1.orig/jobs.c bash-3.1/jobs.c
+--- bash-3.1.orig/jobs.c	2005-11-12 04:13:27.000000000 +0000
++++ bash-3.1/jobs.c	2006-03-18 09:23:33.000000000 +0000
+@@ -619,8 +619,11 @@
+ 	   * once in the parent and once in each child.  This is where
+ 	   * the parent gives it away.
+ 	   *
++	   * Don't give the terminal away if this shell is an asynchronous
++	   * subshell.
++	   *
+ 	   */
+-	  if (job_control && newjob->pgrp)
++	  if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
+ 	    give_terminal_to (newjob->pgrp, 0);
+ 	}
+     }
+@@ -844,9 +847,10 @@
+ realloc_jobs_list ()
+ {
+   sigset_t set, oset;
+-  int nsize, i, j;
++  int nsize, i, j, ncur, nprev;
+   JOB **nlist;
+ 
++  ncur = nprev = NO_JOB;
+   nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
+   nsize *= JOB_SLOTS;
+   i = js.j_njobs % JOB_SLOTS;
+@@ -854,17 +858,51 @@
+     nsize += JOB_SLOTS;
+ 
+   BLOCK_CHILD (set, oset);
+-  nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
++  nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
++
+   for (i = j = 0; i < js.j_jobslots; i++)
+     if (jobs[i])
+-      nlist[j++] = jobs[i];
++      {
++	if (i == js.j_current)
++	  ncur = j;
++	if (i == js.j_previous)
++	  nprev = j;
++	nlist[j++] = jobs[i];
++      }
++
++#if defined (DEBUG)
++  itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
++  itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
++  itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
++#endif
+ 
+   js.j_firstj = 0;
+-  js.j_lastj = (j > 0) ? j - 1: 0;
++  js.j_lastj = (j > 0) ? j - 1 : 0;
++  js.j_njobs = j;
+   js.j_jobslots = nsize;
+ 
+-  free (jobs);
+-  jobs = nlist;
++  /* Zero out remaining slots in new jobs list */
++  for ( ; j < nsize; j++)
++    nlist[j] = (JOB *)NULL;
++
++  if (jobs != nlist)
++    {
++      free (jobs);
++      jobs = nlist;
++    }
++
++  if (ncur != NO_JOB)
++    js.j_current = ncur;
++  if (nprev != NO_JOB)
++    js.j_previous = nprev;
++
++  /* Need to reset these */
++  if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
++    reset_current ();
++
++#ifdef DEBUG
++  itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
++#endif
+ 
+   UNBLOCK_CHILD (oset);
+ }
+@@ -1655,7 +1693,7 @@
+ 	     In this case, we don't want to give the terminal to the
+ 	     shell's process group (we could be in the middle of a
+ 	     pipeline, for example). */
+-	  if (async_p == 0 && pipeline_pgrp != shell_pgrp)
++	  if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
+ 	    give_terminal_to (pipeline_pgrp, 0);
+ 
+ #if defined (PGRP_PIPE)
+@@ -2198,7 +2236,11 @@
+   /* This is possibly a race condition -- should it go in stop_pipeline? */
+   wait_sigint_received = 0;
+   if (job_control == 0)
+-    old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
++    {
++      old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
++      if (old_sigint_handler == SIG_IGN)
++	set_signal_handler (SIGINT, old_sigint_handler);
++    }
+ 
+   termination_state = last_command_exit_value;
+ 
+diff -Naur bash-3.1.orig/lib/readline/display.c bash-3.1/lib/readline/display.c
+--- bash-3.1.orig/lib/readline/display.c	2005-11-30 19:05:02.000000000 +0000
++++ bash-3.1/lib/readline/display.c	2006-03-18 09:23:33.000000000 +0000
+@@ -1983,11 +1983,15 @@
+      int pchar;
+ {
+   int len;
+-  char *pmt;
++  char *pmt, *p;
+ 
+   rl_save_prompt ();
+ 
+-  if (saved_local_prompt == 0)
++  /* We've saved the prompt, and can do anything with the various prompt
++     strings we need before they're restored.  We want the unexpanded
++     portion of the prompt string after any final newline. */
++  p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
++  if (p == 0)
+     {
+       len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
+       pmt = (char *)xmalloc (len + 2);
+@@ -1998,19 +2002,17 @@
+     }
+   else
+     {
+-      len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
++      p++;
++      len = strlen (p);
+       pmt = (char *)xmalloc (len + 2);
+       if (len)
+-	strcpy (pmt, saved_local_prompt);
++	strcpy (pmt, p);
+       pmt[len] = pchar;
+       pmt[len+1] = '\0';
+-      local_prompt = savestring (pmt);
+-      prompt_last_invisible = saved_last_invisible;
+-      prompt_visible_length = saved_visible_length + 1;
+-    }
++    }  
+ 
++  /* will be overwritten by expand_prompt, called from rl_message */
+   prompt_physical_chars = saved_physical_chars + 1;
+-
+   return pmt;
+ }
+ 
+diff -Naur bash-3.1.orig/lib/readline/readline.c bash-3.1/lib/readline/readline.c
+--- bash-3.1.orig/lib/readline/readline.c	2005-07-05 02:29:35.000000000 +0000
++++ bash-3.1/lib/readline/readline.c	2006-03-18 09:23:33.000000000 +0000
+@@ -282,6 +282,7 @@
+ {
+   FREE (rl_prompt);
+   rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
++  rl_display_prompt = rl_prompt ? rl_prompt : "";
+ 
+   rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
+   return 0;
+diff -Naur bash-3.1.orig/lib/readline/terminal.c bash-3.1/lib/readline/terminal.c
+--- bash-3.1.orig/lib/readline/terminal.c	2005-11-13 01:46:54.000000000 +0000
++++ bash-3.1/lib/readline/terminal.c	2006-03-18 09:23:33.000000000 +0000
+@@ -122,7 +122,7 @@
+ static char *_rl_visible_bell;
+ 
+ /* Non-zero means the terminal can auto-wrap lines. */
+-int _rl_term_autowrap;
++int _rl_term_autowrap = -1;
+ 
+ /* Non-zero means that this terminal has a meta key. */
+ static int term_has_meta;
+@@ -274,6 +274,9 @@
+ _rl_set_screen_size (rows, cols)
+      int rows, cols;
+ {
++  if (_rl_term_autowrap == -1)
++    _rl_init_terminal_io (rl_terminal_name);
++
+   if (rows > 0)
+     _rl_screenheight = rows;
+   if (cols > 0)
+diff -Naur bash-3.1.orig/parse.y bash-3.1/parse.y
+--- bash-3.1.orig/parse.y	2005-11-12 04:14:18.000000000 +0000
++++ bash-3.1/parse.y	2006-03-18 09:23:33.000000000 +0000
+@@ -2716,6 +2716,7 @@
+ #define P_ALLOWESC	0x02
+ #define P_DQUOTE	0x04
+ #define P_COMMAND	0x08	/* parsing a command, so look for comments */
++#define P_BACKQUOTE	0x10	/* parsing a backquoted command substitution */
+ 
+ static char matched_pair_error;
+ static char *
+@@ -2725,12 +2726,12 @@
+      int *lenp, flags;
+ {
+   int count, ch, was_dollar, in_comment, check_comment;
+-  int pass_next_character, nestlen, ttranslen, start_lineno;
++  int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
+   char *ret, *nestret, *ttrans;
+   int retind, retsize, rflags;
+ 
+   count = 1;
+-  pass_next_character = was_dollar = in_comment = 0;
++  pass_next_character = backq_backslash = was_dollar = in_comment = 0;
+   check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
+ 
+   /* RFLAGS is the set of flags we want to pass to recursive calls. */
+@@ -2742,11 +2743,8 @@
+   start_lineno = line_number;
+   while (count)
+     {
+-#if 0
+-      ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
+-#else
+-      ch = shell_getc (qc != '\'' && pass_next_character == 0);
+-#endif
++      ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
++
+       if (ch == EOF)
+ 	{
+ 	  free (ret);
+@@ -2771,9 +2769,16 @@
+ 	  continue;
+ 	}
+       /* Not exactly right yet */
+-      else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
++      else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
+ 	in_comment = 1;
+ 
++      /* last char was backslash inside backquoted command substitution */
++      if (backq_backslash)
++	{
++	  backq_backslash = 0;
++	  /* Placeholder for adding special characters */
++	}
++
+       if (pass_next_character)		/* last char was backslash */
+ 	{
+ 	  pass_next_character = 0;
+@@ -2814,6 +2819,8 @@
+ 	{
+ 	  if MBTEST((flags & P_ALLOWESC) && ch == '\\')
+ 	    pass_next_character++;
++	  else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
++	    backq_backslash++;
+ 	  continue;
+ 	}
+ 
+@@ -2898,7 +2905,11 @@
+ 	}
+       else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
+ 	{
+-	  nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
++	  /* Add P_BACKQUOTE so backslash quotes the next character and
++	     shell_getc does the right thing with \<newline>.  We do this for
++	     a measure  of backwards compatibility -- it's not strictly the
++	     right POSIX thing. */
++	  nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
+ 	  goto add_nestret;
+ 	}
+       else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '['))	/* ) } ] */
+@@ -2907,7 +2918,7 @@
+ 	  if (open == ch)	/* undo previous increment */
+ 	    count--;
+ 	  if (ch == '(')		/* ) */
+-	    nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags);
++	    nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE);
+ 	  else if (ch == '{')		/* } */
+ 	    nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags);
+ 	  else if (ch == '[')		/* ] */
+@@ -3578,7 +3589,7 @@
+ 	      FREE (ttok);
+ 	      all_digit_token = 0;
+ 	      compound_assignment = 1;
+-#if 0
++#if 1
+ 	      goto next_character;
+ #else
+ 	      goto got_token;		/* ksh93 seems to do this */
+@@ -3695,7 +3706,9 @@
+       struct builtin *b;
+       b = builtin_address_internal (token, 0);
+       if (b && (b->flags & ASSIGNMENT_BUILTIN))
+-        parser_state |= PST_ASSIGNOK;
++	parser_state |= PST_ASSIGNOK;
++      else if (STREQ (token, "eval") || STREQ (token, "let"))
++	parser_state |= PST_ASSIGNOK;
+     }
+ 
+   yylval.word = the_word;
+@@ -4686,18 +4699,21 @@
+      int *retlenp;
+ {
+   WORD_LIST *wl, *rl;
+-  int tok, orig_line_number, orig_token_size;
++  int tok, orig_line_number, orig_token_size, orig_last_token, assignok;
+   char *saved_token, *ret;
+ 
+   saved_token = token;
+   orig_token_size = token_buffer_size;
+   orig_line_number = line_number;
++  orig_last_token = last_read_token;
+ 
+   last_read_token = WORD;	/* WORD to allow reserved words here */
+ 
+   token = (char *)NULL;
+   token_buffer_size = 0;
+ 
++  assignok = parser_state&PST_ASSIGNOK;		/* XXX */
++
+   wl = (WORD_LIST *)NULL;	/* ( */
+   parser_state |= PST_COMPASSIGN;
+ 
+@@ -4740,7 +4756,7 @@
+ 	jump_to_top_level (DISCARD);
+     }
+ 
+-  last_read_token = WORD;
++  last_read_token = orig_last_token;		/* XXX - was WORD? */
+   if (wl)
+     {
+       rl = REVERSE_LIST (wl, WORD_LIST *);
+@@ -4752,6 +4768,10 @@
+ 
+   if (retlenp)
+     *retlenp = (ret && *ret) ? strlen (ret) : 0;
++
++  if (assignok)
++    parser_state |= PST_ASSIGNOK;
++
+   return ret;
+ }
+ 
+diff -Naur bash-3.1.orig/patchlevel.h bash-3.1/patchlevel.h
+--- bash-3.1.orig/patchlevel.h	2005-07-20 17:58:20.000000000 +0000
++++ bash-3.1/patchlevel.h	2006-03-18 09:23:33.000000000 +0000
+@@ -25,6 +25,6 @@
+    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
+    looks for to find the patch level (for the sccs version string). */
+ 
+-#define PATCHLEVEL 0
++#define PATCHLEVEL 14
+ 
+ #endif /* _PATCHLEVEL_H_ */
+diff -Naur bash-3.1.orig/subst.c bash-3.1/subst.c
+--- bash-3.1.orig/subst.c	2005-10-24 13:51:13.000000000 +0000
++++ bash-3.1/subst.c	2006-03-18 09:23:33.000000000 +0000
+@@ -2187,7 +2187,7 @@
+   if (mklocal && variable_context)
+     {
+       v = find_variable (name);
+-      if (v == 0 || array_p (v) == 0)
++      if (v == 0 || array_p (v) == 0 || v->context != variable_context)
+         v = make_local_array_variable (name);
+       v = assign_array_var_from_string (v, value, flags);
+     }
+@@ -6795,6 +6795,12 @@
+ 	  if (temp && *temp && t_index > 0)
+ 	    {
+ 	      temp1 = bash_tilde_expand (temp, tflag);
++	      if  (temp1 && *temp1 == '~' && STREQ (temp, temp1))
++		{
++		  FREE (temp);
++		  FREE (temp1);
++		  goto add_character;		/* tilde expansion failed */
++		}
+ 	      free (temp);
+ 	      temp = temp1;
+ 	      sindex += t_index;
+diff -Naur bash-3.1.orig/variables.c bash-3.1/variables.c
+--- bash-3.1.orig/variables.c	2005-11-13 02:22:37.000000000 +0000
++++ bash-3.1/variables.c	2006-03-18 09:23:33.000000000 +0000
+@@ -860,9 +860,11 @@
+ {
+   char val[INT_STRLEN_BOUND(int) + 1], *v;
+ 
++#if defined (READLINE)
+   /* If we are currently assigning to LINES or COLUMNS, don't do anything. */
+   if (winsize_assignment)
+     return;
++#endif
+ 
+   v = inttostr (lines, val, sizeof (val));
+   bind_variable ("LINES", v, 0);
Index: patches/bin86-0.16.17-x86_64-1.patch
===================================================================
--- patches/bin86-0.16.17-x86_64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/bin86-0.16.17-x86_64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,44 @@
+Submitted By: Ken Moffat <ken@kenmoffat.uklinux.net>
+Date: 2005-06-28
+Initial Package Version: 0.16.14
+Upstream Status: Submitted Upstream
+Origin: from ROCK Linux
+Description: Allows bin86 to compile on x86_64, which permits lilo to
+ be used in a 64-bit system.  I'm dubious about ROCK's attempts to
+ automatically add dual-licensing to all their patches, but bin86 is
+ already GPL'd.  I've heard from the maintainer that this will be
+ included in the next upload.
+
+
+# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
+# 
+# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
+# Please add additional copyright information _after_ the line containing
+# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
+# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
+# 
+# ROCK Linux: rock-src/package/x86/bin86/x86_64.patch
+# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
+# 
+# This patch file is dual-licensed. It is available under the license the
+# patched project is licensed under, as long as it is an OpenSource license
+# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
+# of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+# 
+# --- ROCK-COPYRIGHT-NOTE-END ---
+
+diff -urN bin86-0.16.14-orig/ld/x86_aout.h bin86-0.16.14/ld/x86_aout.h
+--- bin86-0.16.14-orig/ld/x86_aout.h	2004-11-07 20:07:31.506442000 +0100
++++ bin86-0.16.14/ld/x86_aout.h	2004-11-07 20:07:41.106982496 +0100
+@@ -12,6 +12,9 @@
+ #if defined(i386) || defined(__BCC__) || defined(MSDOS)
+ typedef long Long;
+ #define __OUT_OK 1
++#elif defined(__x86_64__)
++typedef int Long;
++#define __OUT_OK 1
+ #else
+ typedef char Long[4];
+ #endif
Index: patches/binutils-2.16.1-genscripts_multilib-1.patch
===================================================================
--- patches/binutils-2.16.1-genscripts_multilib-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/binutils-2.16.1-genscripts_multilib-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,65 @@
+Submitted By: Ryan Oliver (ryan dot oliver at pha dot com dot au)
+Origin: Ryan Oliver
+Date: 2005-04-03
+Initial package version: 2.15 (problem also exists in 2.14 series)
+Description:
+        Updated patch, use this for all binutils 2.15 series instead of the
+        binutils-2.15.90.0.1-genscripts-multilib.patch
+
+        If --with-libpath= was specified during configure (or LIB_PATH was
+        supplied during make) we want to have these libraries added to the
+        linker scripts search paths, and in the case of multi-lib have them
+        processed to provide both lib and lib64 search paths.
+        This patch produces this behaviour when building a cross-binutils.
+
+        Also to fix an annoyance we remove whatever was specified (if anything)
+        by --libdir= from the linker script search path. This is so when cross-
+        compiling a 64bit target-native biarch toolchain we can specify the
+        installation directory for binutils produced libraries to be */lib64
+        without having this directory added to the 32bit emulation search path.
+
+        By rights we should really check if ${libdir} matches a search path in
+        any of the supported emulations for this target (as opposed to only the
+        one genscripts.sh is currently processing) and if so ignore ${libpath}.
+
+	This patch differs from the preceding genscripts-multilib patch as now
+	USE_LIBPATH will always be set if LIB_PATH is non empty
+
+diff -uNr binutils-2.15.91.0.1-orig/ld/genscripts.sh binutils-2.15.91.0.1/ld/genscripts.sh
+--- binutils-2.15.91.0.1-orig/ld/genscripts.sh	2004-05-28 04:26:04.000000000 +1000
++++ binutils-2.15.91.0.1/ld/genscripts.sh	2005-04-03 16:14:51.000000000 +1000
+@@ -110,7 +110,8 @@
+ esac
+ 
+ # If the emulparams file sets NATIVE, make sure USE_LIBPATH is set also.
+-if test "x$NATIVE" = "xyes" ; then
++# Also set USE_LIBPATH if LIB_PATH has been set
++if [ "x$NATIVE" = "xyes" -o "x${LIB_PATH}" != "x" ] ; then
+   USE_LIBPATH=yes
+ fi
+ 
+@@ -125,17 +126,17 @@
+ #
+ # If the emulparams file set LIBPATH_SUFFIX, prepend an extra copy of
+ # the library path with the suffix applied.
+-
+-if [ "x${LIB_PATH}" = "x" ] && [ "x${USE_LIBPATH}" = xyes ] ; then
++if [ "x${USE_LIBPATH}" = xyes ] ; then
+   LIB_PATH2=
++  if [ "x${LIB_PATH}" = "x" ] ; then 
++    libs="${NATIVE_LIB_DIRS}"
++  else
++    libs=`echo ${LIB_PATH} | sed 's/:/ /g'`
++    LIB_PATH=
++  fi
+ 
+-  libs=${NATIVE_LIB_DIRS}
+   if [ "x${use_sysroot}" != "xyes" ] ; then
+     case " ${libs} " in
+-      *" ${libdir} "*) ;;
+-      *) libs="${libdir} ${libs}" ;;
+-    esac
+-    case " ${libs} " in
+       *" ${tool_lib} "*) ;;
+       *) libs="${tool_lib} ${libs}" ;;
+     esac
Index: patches/binutils-2.16.1-posix-1.patch
===================================================================
--- patches/binutils-2.16.1-posix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/binutils-2.16.1-posix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,98 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-05-06
+Initial Package Version: 2.16
+Origin: http://ttervo.vectorstar.net/nptl/posix-patches/binutils-2.14.90.0.7-posix-head-tail.patch
+Upstream Status: Accepted/but Suspended
+Description: Makes Posix Compliant
+	     Rediffed against 2.16 by Jeremy Huntwork
+
+diff -Naur binutils-2.16-ORIG/gas/Makefile.am binutils-2.16/gas/Makefile.am
+--- binutils-2.16-ORIG/gas/Makefile.am	2005-03-22 10:31:44.000000000 -0500
++++ binutils-2.16/gas/Makefile.am	2005-05-06 17:08:11.859876859 -0400
+@@ -762,13 +762,13 @@
+ against=stage2
+ 
+ # This rule is derived from corresponding code in the Makefile.in for gcc.
+-# The "tail +16c" is to bypass headers which may include timestamps or
++# The "tail -c +16" is to bypass headers which may include timestamps or
+ # temporary assembly file names.
+ comparison:
+ 	x=0 ; \
+ 	for file in *.o ; do \
+-	  tail +16c ./$$file > tmp-foo1; \
+-	  if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
++	  tail -c +16 ./$$file > tmp-foo1; \
++	  if tail -c +16 ${against}/$$file > tmp-foo2 2>/dev/null ; then \
+ 	    if cmp tmp-foo1 tmp-foo2 ; then \
+ 	      true ; \
+ 	    else \
+diff -Naur binutils-2.16-ORIG/gas/Makefile.in binutils-2.16/gas/Makefile.in
+--- binutils-2.16-ORIG/gas/Makefile.in	2005-04-29 09:57:16.000000000 -0400
++++ binutils-2.16/gas/Makefile.in	2005-05-06 17:08:11.868875659 -0400
+@@ -3164,13 +3164,13 @@
+ 	if [ -f stage3/as-new$(EXEEXT) -a ! -f stage3/as$(EXEEXT) ] ; then (cd stage3 ; ln -s as-new as$(EXEEXT)) ; fi
+ 
+ # This rule is derived from corresponding code in the Makefile.in for gcc.
+-# The "tail +16c" is to bypass headers which may include timestamps or
++# The "tail -c +16" is to bypass headers which may include timestamps or
+ # temporary assembly file names.
+ comparison:
+ 	x=0 ; \
+ 	for file in *.o ; do \
+-	  tail +16c ./$$file > tmp-foo1; \
+-	  if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
++	  tail -c +16 ./$$file > tmp-foo1; \
++	  if tail -c +16 ${against}/$$file > tmp-foo2 2>/dev/null ; then \
+ 	    if cmp tmp-foo1 tmp-foo2 ; then \
+ 	      true ; \
+ 	    else \
+diff -Naur binutils-2.16-ORIG/ld/testsuite/ld-bootstrap/bootstrap.exp binutils-2.16/ld/testsuite/ld-bootstrap/bootstrap.exp
+--- binutils-2.16-ORIG/ld/testsuite/ld-bootstrap/bootstrap.exp	2005-03-03 06:52:06.000000000 -0500
++++ binutils-2.16/ld/testsuite/ld-bootstrap/bootstrap.exp	2005-05-06 17:08:11.870875393 -0400
+@@ -149,8 +149,8 @@
+         # Although this works, a way to set the date would be better.
+         # Removing or zeroing the date stamp in the binary produced by
+         # the linker is not possible as it is required by the target OS.
+-        exec tail +140 tmpdir/ld2 >tmpdir/ld2tail
+-        exec tail +140 tmpdir/ld3 >tmpdir/ld3tail
++        exec tail -n +140 tmpdir/ld2 >tmpdir/ld2tail
++        exec tail -n +140 tmpdir/ld3 >tmpdir/ld3tail
+         catch "exec cmp tmpdir/ld2tail tmpdir/ld3tail" exec_output
+         exec rm tmpdir/ld2tail tmpdir/ld3tail
+     } else {
+diff -Naur binutils-2.16-ORIG/ltcf-c.sh binutils-2.16/ltcf-c.sh
+--- binutils-2.16-ORIG/ltcf-c.sh	2004-10-05 09:34:42.000000000 -0400
++++ binutils-2.16/ltcf-c.sh	2005-05-06 17:08:11.873874993 -0400
+@@ -153,7 +153,7 @@
+     # If the export-symbols file already is a .def file (1st line
+     # is EXPORTS), use it as is.
+     # If DATA tags from a recent dlltool are present, honour them!
+-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
++    archive_expsym_cmds='if test "x`head -n 1 $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname-def;
+       else
+         echo EXPORTS > $output_objdir/$soname-def;
+diff -Naur binutils-2.16-ORIG/ltcf-gcj.sh binutils-2.16/ltcf-gcj.sh
+--- binutils-2.16-ORIG/ltcf-gcj.sh	2004-07-21 15:21:41.000000000 -0400
++++ binutils-2.16/ltcf-gcj.sh	2005-05-06 17:08:11.876874593 -0400
+@@ -156,7 +156,7 @@
+     # If the export-symbols file already is a .def file (1st line
+     # is EXPORTS), use it as is.
+     # If DATA tags from a recent dlltool are present, honour them!
+-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
++    archive_expsym_cmds='if test "x`head -n 1 $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname-def;
+       else
+         echo EXPORTS > $output_objdir/$soname-def;
+diff -Naur binutils-2.16-ORIG/src-release binutils-2.16/src-release
+--- binutils-2.16-ORIG/src-release	2004-12-03 05:30:06.000000000 -0500
++++ binutils-2.16/src-release	2005-05-06 17:08:11.878874327 -0400
+@@ -69,7 +69,7 @@
+ 	elif grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
+ 	  sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
+ 	elif test -f $(TOOL)/version.in; then \
+-	  head -1 $(TOOL)/version.in; \
++	  head -n 1 $(TOOL)/version.in; \
+ 	elif grep VERSION $(TOOL)/Makefile.in > /dev/null 2>&1; then \
+ 	  sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
+ 	else \
Index: patches/binutils-2.16.1-sparc_aout-1.patch
===================================================================
--- patches/binutils-2.16.1-sparc_aout-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/binutils-2.16.1-sparc_aout-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,24 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-11-08
+Initial Package Version: 2.16.1
+Origin: HJL - Binutils CVS
+Upstream Status: Applied
+Description: Allows Sparc aout to handle different sparc versions
+ 
+diff -Naur binutils-2.16.1.orig/bfd/aoutx.h binutils-2.16.1/bfd/aoutx.h
+--- binutils-2.16.1.orig/bfd/aoutx.h	2005-03-03 11:40:55.000000000 +0000
++++ binutils-2.16.1/bfd/aoutx.h	2005-11-08 17:28:48.000000000 +0000
+@@ -733,7 +733,12 @@
+ 	  || machine == bfd_mach_sparc
+ 	  || machine == bfd_mach_sparc_sparclite
+ 	  || machine == bfd_mach_sparc_sparclite_le
+-	  || machine == bfd_mach_sparc_v9)
++	  || machine == bfd_mach_sparc_v8plus
++	  || machine == bfd_mach_sparc_v8plusa
++	  || machine == bfd_mach_sparc_v8plusb
++	  || machine == bfd_mach_sparc_v9
++	  || machine == bfd_mach_sparc_v9a
++	  || machine == bfd_mach_sparc_v9b)
+ 	arch_flags = M_SPARC;
+       else if (machine == bfd_mach_sparc_sparclet)
+ 	arch_flags = M_SPARCLET;
Index: patches/binutils-2.16.1-sparc_tls-1.patch
===================================================================
--- patches/binutils-2.16.1-sparc_tls-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/binutils-2.16.1-sparc_tls-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,4790 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-09-14
+Initial Package Version: 2.16
+Origin: Dave Miller
+Upstream Status: Applied
+Description: Adds TLS support for Sparc64
+ 
+diff -Naur binutils-2.16.1.orig/bfd/elf64-sparc.c binutils-2.16.1/bfd/elf64-sparc.c
+--- binutils-2.16.1.orig/bfd/elf64-sparc.c	2005-03-03 11:41:00.000000000 +0000
++++ binutils-2.16.1/bfd/elf64-sparc.c	2005-09-14 23:03:28.000000000 +0000
+@@ -22,7 +22,6 @@
+ #include "sysdep.h"
+ #include "libbfd.h"
+ #include "elf-bfd.h"
+-#include "opcode/sparc.h"
+ 
+ /* This is defined if one wants to build upward compatible binaries
+    with the original sparc64-elf toolchain.  The support is kept in for
+@@ -30,40 +29,78 @@
+ /*#define SPARC64_OLD_RELOCS*/
+ 
+ #include "elf/sparc.h"
++#include "opcode/sparc.h"
+ 
+ /* In case we're on a 32-bit machine, construct a 64-bit "-1" value.  */
+ #define MINUS_ONE (~ (bfd_vma) 0)
+ 
+-static struct bfd_link_hash_table * sparc64_elf_bfd_link_hash_table_create
+-  PARAMS ((bfd *));
+-static bfd_boolean create_got_section
+-  PARAMS ((bfd *, struct bfd_link_info *));
+-static bfd_boolean sparc64_elf_create_dynamic_sections
+-  PARAMS ((bfd *, struct bfd_link_info *));
+-static bfd_reloc_status_type init_insn_reloc
+-  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *,
+-	   bfd *, bfd_vma *, bfd_vma *));
+ static reloc_howto_type *sparc64_elf_reloc_type_lookup
+   PARAMS ((bfd *, bfd_reloc_code_real_type));
+ static void sparc64_elf_info_to_howto
+   PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+-
+-static void sparc64_elf_build_plt
+-  PARAMS ((bfd *, unsigned char *, int));
+-static bfd_vma sparc64_elf_plt_entry_offset
+-  PARAMS ((bfd_vma));
+-static bfd_vma sparc64_elf_plt_ptr_offset
+-  PARAMS ((bfd_vma, bfd_vma));
+-
+ static bfd_boolean sparc64_elf_check_relocs
+-  PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
++  PARAMS ((bfd *, struct bfd_link_info *, asection *,
+ 	   const Elf_Internal_Rela *));
+ static bfd_boolean sparc64_elf_adjust_dynamic_symbol
+   PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
++static bfd_boolean allocate_dynrelocs
++  PARAMS ((struct elf_link_hash_entry *, PTR));
++static bfd_boolean readonly_dynrelocs
++  PARAMS ((struct elf_link_hash_entry *, PTR));
+ static bfd_boolean sparc64_elf_omit_section_dynsym
+   PARAMS ((bfd *, struct bfd_link_info *, asection *));
+ static bfd_boolean sparc64_elf_size_dynamic_sections
+   PARAMS ((bfd *, struct bfd_link_info *));
++static bfd_boolean sparc64_elf_new_section_hook
++  PARAMS ((bfd *, asection *));
++static bfd_boolean sparc64_elf_relax_section
++  PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
++static bfd_vma dtpoff_base
++  PARAMS ((struct bfd_link_info *));
++static bfd_vma tpoff
++  PARAMS ((struct bfd_link_info *, bfd_vma));
++static bfd_boolean sparc64_elf_relocate_section
++  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
++	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
++static bfd_boolean sparc64_elf_finish_dynamic_symbol
++  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
++	   Elf_Internal_Sym *));
++static bfd_boolean sparc64_elf_finish_dynamic_sections
++  PARAMS ((bfd *, struct bfd_link_info *));
++static bfd_boolean sparc64_elf_merge_private_bfd_data
++  PARAMS ((bfd *, bfd *));
++static struct bfd_hash_entry *link_hash_newfunc
++  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
++static struct bfd_link_hash_table *sparc64_elf_link_hash_table_create
++  PARAMS ((bfd *));
++static bfd_boolean create_got_section
++  PARAMS ((bfd *, struct bfd_link_info *));
++static bfd_boolean sparc64_elf_create_dynamic_sections
++  PARAMS ((bfd *, struct bfd_link_info *));
++static void sparc64_elf_copy_indirect_symbol
++  PARAMS ((const struct elf_backend_data *, struct elf_link_hash_entry *,
++	  struct elf_link_hash_entry *));
++static int sparc64_elf_tls_transition
++  PARAMS ((struct bfd_link_info *, int, int));
++
++static bfd_boolean sparc64_elf_mkobject
++  PARAMS ((bfd *));
++static bfd_boolean sparc64_elf_object_p
++  PARAMS ((bfd *));
++static enum elf_reloc_type_class sparc64_elf_reloc_type_class
++  PARAMS ((const Elf_Internal_Rela *));
++static asection *sparc64_elf_gc_mark_hook
++  PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
++	   struct elf_link_hash_entry *, Elf_Internal_Sym *));
++static bfd_boolean sparc64_elf_gc_sweep_hook
++  PARAMS ((bfd *, struct bfd_link_info *, asection *,
++	   const Elf_Internal_Rela *));
++
++static bfd_reloc_status_type init_insn_reloc
++  PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *,
++	   bfd *, bfd_vma *, bfd_vma *));
++static int sparc64_plt_entry_build
++  PARAMS ((bfd *, asection *, bfd_vma, bfd_vma, bfd_vma *));
+ static int sparc64_elf_get_symbol_type
+   PARAMS (( Elf_Internal_Sym *, int));
+ static bfd_boolean sparc64_elf_add_symbol_hook
+@@ -75,30 +112,14 @@
+ 			    asection *, struct elf_link_hash_entry *)));
+ static void sparc64_elf_symbol_processing
+   PARAMS ((bfd *, asymbol *));
+-
+-static bfd_boolean sparc64_elf_merge_private_bfd_data
+-  PARAMS ((bfd *, bfd *));
+-
+ static bfd_boolean sparc64_elf_fake_sections
+   PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
+-
+ static const char *sparc64_elf_print_symbol_all
+   PARAMS ((bfd *, PTR, asymbol *));
+-static bfd_boolean sparc64_elf_new_section_hook
++static long sparc64_elf_get_reloc_upper_bound
+   PARAMS ((bfd *, asection *));
+-static bfd_boolean sparc64_elf_relax_section
+-  PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+-static bfd_boolean sparc64_elf_relocate_section
+-  PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
+-	   Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
+-static bfd_boolean sparc64_elf_finish_dynamic_symbol
+-  PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
+-	   Elf_Internal_Sym *));
+-static bfd_boolean sparc64_elf_finish_dynamic_sections
+-  PARAMS ((bfd *, struct bfd_link_info *));
+-static bfd_boolean sparc64_elf_object_p PARAMS ((bfd *));
+-static long sparc64_elf_get_reloc_upper_bound PARAMS ((bfd *, asection *));
+-static long sparc64_elf_get_dynamic_reloc_upper_bound PARAMS ((bfd *));
++static long sparc64_elf_get_dynamic_reloc_upper_bound
++  PARAMS ((bfd *));
+ static bfd_boolean sparc64_elf_slurp_one_reloc_table
+   PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, asymbol **, bfd_boolean));
+ static bfd_boolean sparc64_elf_slurp_reloc_table
+@@ -107,9 +128,8 @@
+   PARAMS ((bfd *, asection *, arelent **, asymbol **));
+ static long sparc64_elf_canonicalize_dynamic_reloc
+   PARAMS ((bfd *, arelent **, asymbol **));
+-static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR));
+-static enum elf_reloc_type_class sparc64_elf_reloc_type_class
+-  PARAMS ((const Elf_Internal_Rela *));
++static void sparc64_elf_write_relocs
++  PARAMS ((bfd *, asection *, PTR));
+ 
+
+ /* The relocation "howto" table.  */
+ 
+@@ -728,6 +748,72 @@
+     }
+ }
+ 
+
++/* The SPARC linker needs to keep track of the number of relocs that it
++   decides to copy as dynamic relocs in check_relocs for each symbol.
++   This is so that it can later discard them if they are found to be
++   unnecessary.  We store the information in a field extending the
++   regular ELF linker hash table.  */
++
++struct sparc64_elf_dyn_relocs
++{
++  struct sparc64_elf_dyn_relocs *next;
++
++  /* The input section of the reloc.  */
++  asection *sec;
++
++  /* Total number of relocs copied for the input section.  */
++  bfd_size_type count;
++
++  /* Number of pc-relative relocs copied for the input section.  */
++  bfd_size_type pc_count;
++};
++
++/* SPARC ELF linker hash entry.  */
++
++struct sparc64_elf_link_hash_entry
++{
++  struct elf_link_hash_entry elf;
++
++  /* Track dynamic relocs copied for this symbol.  */
++  struct sparc64_elf_dyn_relocs *dyn_relocs;
++
++#define GOT_UNKNOWN     0
++#define GOT_NORMAL      1
++#define GOT_TLS_GD      2
++#define GOT_TLS_IE      3
++  unsigned char tls_type;
++};
++
++#define sparc64_elf_hash_entry(ent) ((struct sparc64_elf_link_hash_entry *)(ent))
++
++struct sparc64_elf_obj_tdata
++{
++  struct elf_obj_tdata root;
++
++  /* tls_type for each local got entry.  */
++  char *local_got_tls_type;
++
++  /* TRUE if TLS GD relocs has been seen for this object.  */
++  bfd_boolean has_tlsgd;
++};
++
++#define sparc64_elf_tdata(abfd) \
++  ((struct sparc64_elf_obj_tdata *) (abfd)->tdata.any)
++
++#define sparc64_elf_local_got_tls_type(abfd) \
++  (sparc64_elf_tdata (abfd)->local_got_tls_type)
++
++static bfd_boolean
++sparc64_elf_mkobject (abfd)
++     bfd *abfd;
++{
++  bfd_size_type amt = sizeof (struct sparc64_elf_obj_tdata);
++  abfd->tdata.any = bfd_zalloc (abfd, amt);
++  if (abfd->tdata.any == NULL)
++    return FALSE;
++  return TRUE;
++}
++
+ /* Sparc64 ELF linker hash table.  */
+ 
+ struct sparc64_elf_app_reg
+@@ -740,11 +826,23 @@
+ 
+ struct sparc64_elf_link_hash_table
+ {
+-  struct elf_link_hash_table root;
++  struct elf_link_hash_table elf;
+ 
+   /* Short-cuts to get to dynamic linker sections.  */
+   asection *sgot;
+   asection *srelgot;
++  asection *splt;
++  asection *srelplt;
++  asection *sdynbss;
++  asection *srelbss;
++
++  union {
++    bfd_signed_vma refcount;
++    bfd_vma offset;
++  } tls_ldm_got;
++
++  /* Small local sym to section mapping cache.  */
++  struct sym_sec_cache sym_sec;
+ 
+   struct sparc64_elf_app_reg app_regs [4];
+ };
+@@ -754,30 +852,61 @@
+ #define sparc64_elf_hash_table(p) \
+   ((struct sparc64_elf_link_hash_table *) ((p)->hash))
+ 
+-/* Create a Sparc64 ELF linker hash table.  */
++/* Create an entry in an SPARC ELF linker hash table.  */
++
++static struct bfd_hash_entry *
++link_hash_newfunc (entry, table, string)
++     struct bfd_hash_entry *entry;
++     struct bfd_hash_table *table;
++     const char *string;
++{
++  /* Allocate the structure if it has not already been allocated by a
++     subclass.  */
++  if (entry == NULL)
++    {
++      entry = bfd_hash_allocate (table,
++				 sizeof (struct sparc64_elf_link_hash_entry));
++      if (entry == NULL)
++	return entry;
++    }
++
++  /* Call the allocation method of the superclass.  */
++  entry = _bfd_elf_link_hash_newfunc (entry, table, string);
++  if (entry != NULL)
++    {
++      struct sparc64_elf_link_hash_entry *eh;
++
++      eh = (struct sparc64_elf_link_hash_entry *) entry;
++      eh->dyn_relocs = NULL;
++      eh->tls_type = GOT_UNKNOWN;
++    }
++
++  return entry;
++}
++
++/* Create a SPARC64 ELF linker hash table.  */
+ 
+ static struct bfd_link_hash_table *
+-sparc64_elf_bfd_link_hash_table_create (abfd)
++sparc64_elf_link_hash_table_create (abfd)
+      bfd *abfd;
+ {
+   struct sparc64_elf_link_hash_table *ret;
+   bfd_size_type amt = sizeof (struct sparc64_elf_link_hash_table);
+ 
+   ret = (struct sparc64_elf_link_hash_table *) bfd_zmalloc (amt);
+-  if (ret == (struct sparc64_elf_link_hash_table *) NULL)
++  if (ret == NULL)
+     return NULL;
+ 
+-  if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
+-				       _bfd_elf_link_hash_newfunc))
++  if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
+     {
+       free (ret);
+       return NULL;
+     }
+ 
+-  return &ret->root.root;
++  return &ret->elf.root;
+ }
+ 
+-/* Create .got and .rela.got sections in DYNOBJ and set up
++/* Create .got and .rela.got sections in DYNOBJ, and set up
+    shortcuts to them in our hash table.  */
+ 
+ static bfd_boolean
+@@ -825,8 +954,110 @@
+   if (!_bfd_elf_create_dynamic_sections (dynobj, info))
+     return FALSE;
+ 
++  htab->splt = bfd_get_section_by_name (dynobj, ".plt");
++  htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
++  htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
++  if (!info->shared)
++    htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
++
++  if (!htab->splt || !htab->srelplt || !htab->sdynbss
++      || (!info->shared && !htab->srelbss))
++    abort ();
++
+   return TRUE;
+ }
++
++/* Copy the extra info we tack onto an elf_link_hash_entry.  */
++
++static void
++sparc64_elf_copy_indirect_symbol (bed, dir, ind)
++     const struct elf_backend_data *bed;
++     struct elf_link_hash_entry *dir, *ind;
++{
++  struct sparc64_elf_link_hash_entry *edir, *eind;
++
++  edir = (struct sparc64_elf_link_hash_entry *) dir;
++  eind = (struct sparc64_elf_link_hash_entry *) ind;
++
++  if (eind->dyn_relocs != NULL)
++    {
++      if (edir->dyn_relocs != NULL)
++	{
++	  struct sparc64_elf_dyn_relocs **pp;
++	  struct sparc64_elf_dyn_relocs *p;
++
++	  if (ind->root.type == bfd_link_hash_indirect)
++	    abort ();
++
++	  /* Add reloc counts against the weak sym to the strong sym
++	     list.  Merge any entries against the same section.  */
++	  for (pp = &eind->dyn_relocs; (p = *pp) != NULL; )
++	    {
++	      struct sparc64_elf_dyn_relocs *q;
++
++	      for (q = edir->dyn_relocs; q != NULL; q = q->next)
++		if (q->sec == p->sec)
++		  {
++		    q->pc_count += p->pc_count;
++		    q->count += p->count;
++		    *pp = p->next;
++		    break;
++		  }
++	      if (q == NULL)
++		pp = &p->next;
++	    }
++	  *pp = edir->dyn_relocs;
++	}
++
++      edir->dyn_relocs = eind->dyn_relocs;
++      eind->dyn_relocs = NULL;
++    }
++
++  if (ind->root.type == bfd_link_hash_indirect
++      && dir->got.refcount <= 0)
++    {
++      edir->tls_type = eind->tls_type;
++      eind->tls_type = GOT_UNKNOWN;
++    }
++  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
++}
++
++static int
++sparc64_elf_tls_transition (info, r_type, is_local)
++     struct bfd_link_info *info;
++     int r_type;
++     int is_local;
++{
++  if (info->shared)
++    return r_type;
++
++  switch (r_type)
++    {
++    case R_SPARC_TLS_GD_HI22:
++      if (is_local)
++	return R_SPARC_TLS_LE_HIX22;
++      return R_SPARC_TLS_IE_HI22;
++    case R_SPARC_TLS_GD_LO10:
++      if (is_local)
++	return R_SPARC_TLS_LE_LOX10;
++      return R_SPARC_TLS_IE_LO10;
++    case R_SPARC_TLS_IE_HI22:
++      if (is_local)
++	return R_SPARC_TLS_LE_HIX22;
++      return r_type;
++    case R_SPARC_TLS_IE_LO10:
++      if (is_local)
++	return R_SPARC_TLS_LE_LOX10;
++      return r_type;
++    case R_SPARC_TLS_LDM_HI22:
++      return R_SPARC_TLS_LE_HIX22;
++    case R_SPARC_TLS_LDM_LO10:
++      return R_SPARC_TLS_LE_LOX10;
++    }
++
++  return r_type;
++}
++
+ 
+
+ /* Utility for performing the standard initial work of an instruction
+    relocation.
+@@ -1023,36 +1254,31 @@
+ 
+ #define ELF_DYNAMIC_INTERPRETER "/usr/lib/sparcv9/ld.so.1"
+ 
+-/* Fill in the .plt section.  */
++#define SPARC_NOP 0x01000000
+ 
+-static void
+-sparc64_elf_build_plt (output_bfd, contents, nentries)
++static int
++sparc64_plt_entry_build (output_bfd, splt, offset, max, r_offset)
+      bfd *output_bfd;
+-     unsigned char *contents;
+-     int nentries;
++     asection *splt;
++     bfd_vma offset;
++     bfd_vma max;
++     bfd_vma *r_offset;
+ {
+-  const unsigned int nop = 0x01000000;
+-  int i, j;
+-
+-  /* The first four entries are reserved, and are initially undefined.
+-     We fill them with `illtrap 0' to force ld.so to do something.  */
+-
+-  for (i = 0; i < PLT_HEADER_SIZE/4; ++i)
+-    bfd_put_32 (output_bfd, (bfd_vma) 0, contents+i*4);
+-
+-  /* The first 32768 entries are close enough to plt1 to get there via
+-     a straight branch.  */
++  unsigned char *entry = splt->contents + offset;
++  const unsigned int nop = SPARC_NOP;
++  int index;
+ 
+-  for (i = 4; i < LARGE_PLT_THRESHOLD && i < nentries; ++i)
++  if (offset < (LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE))
+     {
+-      unsigned char *entry = contents + i * PLT_ENTRY_SIZE;
+       unsigned int sethi, ba;
+ 
+-      /* sethi (. - plt0), %g1 */
+-      sethi = 0x03000000 | (i * PLT_ENTRY_SIZE);
++      *r_offset = offset;
+ 
+-      /* ba,a,pt %xcc, plt1 */
+-      ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
++      index = (offset / PLT_ENTRY_SIZE);
++
++      sethi = 0x03000000 | (index * PLT_ENTRY_SIZE);
++      ba = 0x30680000
++	| (((splt->contents + PLT_ENTRY_SIZE) - (entry + 4)) / 4 & 0x7ffff);
+ 
+       bfd_put_32 (output_bfd, (bfd_vma) sethi, entry);
+       bfd_put_32 (output_bfd, (bfd_vma) ba,    entry + 4);
+@@ -1063,83 +1289,71 @@
+       bfd_put_32 (output_bfd, (bfd_vma) nop,   entry + 24);
+       bfd_put_32 (output_bfd, (bfd_vma) nop,   entry + 28);
+     }
+-
+-  /* Now the tricky bit.  Entries 32768 and higher are grouped in blocks of
+-     160: 160 entries and 160 pointers.  This is to separate code from data,
+-     which is much friendlier on the cache.  */
+-
+-  for (; i < nentries; i += 160)
++  else
+     {
+-      int block = (i + 160 <= nentries ? 160 : nentries - i);
+-      for (j = 0; j < block; ++j)
++      unsigned char *ptr;
++      unsigned int ldx;
++      int block, last_block, ofs, last_ofs, chunks_this_block;
++      const int insn_chunk_size = (6 * 4);
++      const int ptr_chunk_size = (1 * 8);
++      const int entries_per_block = 160;
++      const int block_size = entries_per_block * (insn_chunk_size
++						  + ptr_chunk_size);
++
++      /* Entries 32768 and higher are grouped into blocks of 160.
++	 The blocks are further subdivided into 160 sequences of
++	 6 instructions and 160 pointers.  If a block does not require
++	 the full 160 entries, let's say it requires N, then there
++	 will be N sequences of 6 instructions and N pointers.  */
++
++      offset -= (LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE);
++      max -= (LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE);
++
++      block = offset / block_size;
++      last_block = max / block_size;
++      if (block != last_block)
+ 	{
+-	  unsigned char *entry, *ptr;
+-	  unsigned int ldx;
+-
+-	  entry = contents + i*PLT_ENTRY_SIZE + j*4*6;
+-	  ptr = contents + i*PLT_ENTRY_SIZE + block*4*6 + j*8;
+-
+-	  /* ldx [%o7 + ptr - (entry+4)], %g1 */
+-	  ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff);
+-
+-	  /* mov %o7,%g5
+-	     call .+8
+-	     nop
+-	     ldx [%o7+P],%g1
+-	     jmpl %o7+%g1,%g1
+-	     mov %g5,%o7  */
+-	  bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry);
+-	  bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4);
+-	  bfd_put_32 (output_bfd, (bfd_vma) nop,        entry + 8);
+-	  bfd_put_32 (output_bfd, (bfd_vma) ldx,        entry + 12);
+-	  bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16);
+-	  bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20);
+-
+-	  bfd_put_64 (output_bfd, (bfd_vma) (contents - (entry + 4)), ptr);
++	  chunks_this_block = 160;
++	}
++      else
++	{
++	  last_ofs = max % block_size;
++	  chunks_this_block = last_ofs / (insn_chunk_size + ptr_chunk_size);
+ 	}
+-    }
+-}
+-
+-/* Return the offset of a particular plt entry within the .plt section.  */
+-
+-static bfd_vma
+-sparc64_elf_plt_entry_offset (index)
+-     bfd_vma index;
+-{
+-  bfd_vma block, ofs;
+-
+-  if (index < LARGE_PLT_THRESHOLD)
+-    return index * PLT_ENTRY_SIZE;
+-
+-  /* See above for details.  */
+-
+-  block = (index - LARGE_PLT_THRESHOLD) / 160;
+-  ofs = (index - LARGE_PLT_THRESHOLD) % 160;
+-
+-  return (LARGE_PLT_THRESHOLD + block * 160) * PLT_ENTRY_SIZE + ofs * 6 * 4;
+-}
+-
+-static bfd_vma
+-sparc64_elf_plt_ptr_offset (index, max)
+-     bfd_vma index;
+-     bfd_vma max;
+-{
+-  bfd_vma block, ofs, last;
+ 
+-  BFD_ASSERT(index >= LARGE_PLT_THRESHOLD);
++      ofs = offset % block_size;
+ 
+-  /* See above for details.  */
++      index = (LARGE_PLT_THRESHOLD +
++	       (block * 160) +
++	       (ofs / insn_chunk_size));
++
++      ptr = splt->contents
++	+ (LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE)
++	+ (block * block_size)
++	+ (chunks_this_block * insn_chunk_size)
++	+ (ofs / insn_chunk_size) * ptr_chunk_size;
++
++      *r_offset = (bfd_vma) (ptr - splt->contents);
++
++      ldx = 0xc25be000 | ((ptr - (entry+4)) & 0x1fff);
++
++      /* mov %o7,%g5
++	 call .+8
++	 nop
++	 ldx [%o7+P],%g1
++	 jmpl %o7+%g1,%g1
++	 mov %g5,%o7  */
++      bfd_put_32 (output_bfd, (bfd_vma) 0x8a10000f, entry);
++      bfd_put_32 (output_bfd, (bfd_vma) 0x40000002, entry + 4);
++      bfd_put_32 (output_bfd, (bfd_vma) SPARC_NOP,  entry + 8);
++      bfd_put_32 (output_bfd, (bfd_vma) ldx,        entry + 12);
++      bfd_put_32 (output_bfd, (bfd_vma) 0x83c3c001, entry + 16);
++      bfd_put_32 (output_bfd, (bfd_vma) 0x9e100005, entry + 20);
+ 
+-  block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160) + LARGE_PLT_THRESHOLD;
+-  ofs = index - block;
+-  if (block + 160 > max)
+-    last = (max - LARGE_PLT_THRESHOLD) % 160;
+-  else
+-    last = 160;
++      bfd_put_64 (output_bfd, (bfd_vma) (splt->contents - (entry + 4)), ptr);
++    }
+ 
+-  return (block * PLT_ENTRY_SIZE
+-	  + last * 6*4
+-	  + ofs * 8);
++  return index - 4;
+ }
+ 
+
+ /* Look through the relocs for a section during the first phase, and
+@@ -1153,139 +1367,178 @@
+      asection *sec;
+      const Elf_Internal_Rela *relocs;
+ {
+-  bfd *dynobj;
++  struct sparc64_elf_link_hash_table *htab;
+   Elf_Internal_Shdr *symtab_hdr;
+   struct elf_link_hash_entry **sym_hashes;
+   bfd_vma *local_got_offsets;
+   const Elf_Internal_Rela *rel;
+   const Elf_Internal_Rela *rel_end;
+-  asection *sgot;
+-  asection *srelgot;
+   asection *sreloc;
+ 
+   if (info->relocatable || !(sec->flags & SEC_ALLOC))
+     return TRUE;
+ 
+-  dynobj = elf_hash_table (info)->dynobj;
++  htab = sparc64_elf_hash_table (info);
+   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+   sym_hashes = elf_sym_hashes (abfd);
+   local_got_offsets = elf_local_got_offsets (abfd);
+ 
+-  sgot = NULL;
+-  srelgot = NULL;
+   sreloc = NULL;
+ 
+   rel_end = relocs + NUM_SHDR_ENTRIES (& elf_section_data (sec)->rel_hdr);
+   for (rel = relocs; rel < rel_end; rel++)
+     {
++      unsigned int r_type;
+       unsigned long r_symndx;
+       struct elf_link_hash_entry *h;
+ 
+       r_symndx = ELF64_R_SYM (rel->r_info);
++      r_type = ELF64_R_TYPE_ID (rel->r_info);
++
++      if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
++	{
++	  (*_bfd_error_handler) (_("%B: bad symbol index: %d"),
++				 abfd, r_symndx);
++	  return FALSE;
++	}
++
+       if (r_symndx < symtab_hdr->sh_info)
+ 	h = NULL;
+       else
+ 	h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+ 
+-      switch (ELF64_R_TYPE_ID (rel->r_info))
++      r_type = sparc64_elf_tls_transition (info, r_type, h == NULL);
++      switch (r_type)
+ 	{
++	case R_SPARC_TLS_LDM_HI22:
++	case R_SPARC_TLS_LDM_LO10:
++	  htab->tls_ldm_got.refcount += 1;
++	  break;
++
++	case R_SPARC_TLS_LE_HIX22:
++	case R_SPARC_TLS_LE_LOX10:
++	  if (info->shared)
++	    goto r_sparc_plt32;
++	  break;
++
++	case R_SPARC_TLS_IE_HI22:
++	case R_SPARC_TLS_IE_LO10:
++	  if (info->shared)
++	    info->flags |= DF_STATIC_TLS;
++	  /* Fall through */
++
+ 	case R_SPARC_GOT10:
+ 	case R_SPARC_GOT13:
+ 	case R_SPARC_GOT22:
++	case R_SPARC_TLS_GD_HI22:
++	case R_SPARC_TLS_GD_LO10:
+ 	  /* This symbol requires a global offset table entry.  */
++	  {
++	    int tls_type, old_tls_type;
+ 
+-	  if (dynobj == NULL)
+-	    {
+-	      /* Create the .got and .rela.got sections.  */
+-	      elf_hash_table (info)->dynobj = dynobj = abfd;
+-	      if (! create_got_section (dynobj, info))
+-		return FALSE;
+-	    }
++	    switch (r_type)
++	      {
++	      default:
++	      case R_SPARC_GOT10:
++	      case R_SPARC_GOT13:
++	      case R_SPARC_GOT22:
++		tls_type = GOT_NORMAL;
++		break;
++	      case R_SPARC_TLS_GD_HI22:
++	      case R_SPARC_TLS_GD_LO10:
++		tls_type = GOT_TLS_GD;
++		break;
++	      case R_SPARC_TLS_IE_HI22:
++	      case R_SPARC_TLS_IE_LO10:
++		tls_type = GOT_TLS_IE;
++		break;
++	      }
+ 
+-	  if (sgot == NULL)
+-	    {
+-	      sgot = sparc64_elf_hash_table (info)->sgot;
+-	      BFD_ASSERT (sgot != NULL);
+-	    }
++	    if (h != NULL)
++	      {
++		h->got.refcount += 1;
++		old_tls_type = sparc64_elf_hash_entry(h)->tls_type;
++	      }
++	    else
++	      {
++		bfd_signed_vma *local_got_refcounts;
+ 
+-	  if (srelgot == NULL && (h != NULL || info->shared))
+-	    {
+-	      srelgot = sparc64_elf_hash_table (info)->srelgot;
+-	      BFD_ASSERT (srelgot != NULL);
+-	    }
++		/* This is a global offset table entry for a local symbol.  */
++		local_got_refcounts = elf_local_got_refcounts (abfd);
++		if (local_got_refcounts == NULL)
++		  {
++		    bfd_size_type size;
+ 
+-	  if (h != NULL)
+-	    {
+-	      if (h->got.offset != (bfd_vma) -1)
+-		{
+-		  /* We have already allocated space in the .got.  */
+-		  break;
+-		}
+-	      h->got.offset = sgot->size;
++		    size = symtab_hdr->sh_info;
++		    size *= (sizeof (bfd_signed_vma) + sizeof(char));
++		    local_got_refcounts = ((bfd_signed_vma *)
++					   bfd_zalloc (abfd, size));
++		    if (local_got_refcounts == NULL)
++		      return FALSE;
++		    elf_local_got_refcounts (abfd) = local_got_refcounts;
++		    sparc64_elf_local_got_tls_type (abfd)
++		      = (char *) (local_got_refcounts + symtab_hdr->sh_info);
++		  }
++		local_got_refcounts[r_symndx] += 1;
++		old_tls_type = sparc64_elf_local_got_tls_type (abfd) [r_symndx];
++	      }
+ 
+-	      /* Make sure this symbol is output as a dynamic symbol.  */
+-	      if (h->dynindx == -1)
+-		{
+-		  if (! bfd_elf_link_record_dynamic_symbol (info, h))
++	    /* If a TLS symbol is accessed using IE at least once,
++	       there is no point to use dynamic model for it.  */
++	    if (old_tls_type != tls_type && old_tls_type != GOT_UNKNOWN
++		&& (old_tls_type != GOT_TLS_GD
++		    || tls_type != GOT_TLS_IE))
++	      {
++		if (old_tls_type == GOT_TLS_IE && tls_type == GOT_TLS_GD)
++		  tls_type = old_tls_type;
++		else
++		  {
++		    (*_bfd_error_handler)
++		      (_("%B: `%s' accessed both as normal and thread local symbol"),
++		       abfd, h ? h->root.root.string : "<local>");
+ 		    return FALSE;
+-		}
+-
+-	      srelgot->size += sizeof (Elf64_External_Rela);
+-	    }
+-	  else
+-	    {
+-	      /* This is a global offset table entry for a local
+-                 symbol.  */
+-	      if (local_got_offsets == NULL)
+-		{
+-		  bfd_size_type size;
+-		  register unsigned int i;
++		  }
++	      }
+ 
+-		  size = symtab_hdr->sh_info;
+-		  size *= sizeof (bfd_vma);
+-		  local_got_offsets = (bfd_vma *) bfd_alloc (abfd, size);
+-		  if (local_got_offsets == NULL)
+-		    return FALSE;
+-		  elf_local_got_offsets (abfd) = local_got_offsets;
+-		  for (i = 0; i < symtab_hdr->sh_info; i++)
+-		    local_got_offsets[i] = (bfd_vma) -1;
+-		}
+-	      if (local_got_offsets[r_symndx] != (bfd_vma) -1)
+-		{
+-		  /* We have already allocated space in the .got.  */
+-		  break;
+-		}
+-	      local_got_offsets[r_symndx] = sgot->size;
++	    if (old_tls_type != tls_type)
++	      {
++		if (h != NULL)
++		  sparc64_elf_hash_entry (h)->tls_type = tls_type;
++		else
++		  sparc64_elf_local_got_tls_type (abfd) [r_symndx] = tls_type;
++	      }
++	  }
+ 
+-	      if (info->shared)
+-		{
+-		  /* If we are generating a shared object, we need to
+-                     output a R_SPARC_RELATIVE reloc so that the
+-                     dynamic linker can adjust this GOT entry.  */
+-		  srelgot->size += sizeof (Elf64_External_Rela);
+-		}
++	  if (htab->sgot == NULL)
++	    {
++	      if (htab->elf.dynobj == NULL)
++		htab->elf.dynobj = abfd;
++	      if (!create_got_section (htab->elf.dynobj, info))
++		return FALSE;
+ 	    }
+-
+-	  sgot->size += 8;
+-
+-	  /* Doesn't work for 64-bit -fPIC, since sethi/or builds
+-	     unsigned numbers.  If we permit ourselves to modify
+-	     code so we get sethi/xor, this could work.
+-	     Question: do we consider conditionally re-enabling
+-             this for -fpic, once we know about object code models?  */
+-	  /* If the .got section is more than 0x1000 bytes, we add
+-	     0x1000 to the value of _GLOBAL_OFFSET_TABLE_, so that 13
+-	     bit relocations have a greater chance of working.  */
+-	  /*
+-	  if (sgot->size >= 0x1000
+-	      && elf_hash_table (info)->hgot->root.u.def.value == 0)
+-	    elf_hash_table (info)->hgot->root.u.def.value = 0x1000;
+-	  */
+-
+ 	  break;
+ 
+-	case R_SPARC_WPLT30:
++	case R_SPARC_TLS_GD_CALL:
++	case R_SPARC_TLS_LDM_CALL:
++	  if (info->shared)
++	    {
++	      /* These are basically R_SPARC_TLS_WPLT30 relocs against
++		 __tls_get_addr.  */
++	      struct bfd_link_hash_entry *bh = NULL;
++	      if (! _bfd_generic_link_add_one_symbol (info, abfd,
++						      "__tls_get_addr", 0,
++						      bfd_und_section_ptr, 0,
++						      NULL, FALSE, FALSE,
++						      &bh))
++		return FALSE;
++	      h = (struct elf_link_hash_entry *) bh;
++	    }
++	  else
++	    break;
++	  /* Fall through */
++
+ 	case R_SPARC_PLT32:
++	case R_SPARC_WPLT30:
+ 	case R_SPARC_HIPLT22:
+ 	case R_SPARC_LOPLT10:
+ 	case R_SPARC_PCPLT32:
+@@ -1293,10 +1546,10 @@
+ 	case R_SPARC_PCPLT10:
+ 	case R_SPARC_PLT64:
+ 	  /* This symbol requires a procedure linkage table entry.  We
+-             actually build the entry in adjust_dynamic_symbol,
+-             because this might be a case of linking PIC code without
+-             linking in any dynamic objects, in which case we don't
+-             need to generate a procedure linkage table after all.  */
++	     actually build the entry in adjust_dynamic_symbol,
++	     because this might be a case of linking PIC code without
++	     linking in any dynamic objects, in which case we don't
++	     need to generate a procedure linkage table after all.  */
+ 
+ 	  if (h == NULL)
+ 	    {
+@@ -1306,27 +1559,27 @@
+ 	      return FALSE;
+ 	    }
+ 
+-	  /* Make sure this symbol is output as a dynamic symbol.  */
+-	  if (h->dynindx == -1)
+-	    {
+-	      if (! bfd_elf_link_record_dynamic_symbol (info, h))
+-		return FALSE;
+-	    }
+-
+ 	  h->needs_plt = 1;
+-	  if (ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT32
+-	      && ELF64_R_TYPE_ID (rel->r_info) != R_SPARC_PLT64)
+-	    break;
+-	  /* Fall through.  */
++
++	  if (ELF64_R_TYPE_ID (rel->r_info) == R_SPARC_PLT32
++	      || ELF64_R_TYPE_ID (rel->r_info) == R_SPARC_PLT64)
++	    goto r_sparc_plt32;
++	  h->plt.refcount += 1;
++	  break;
++
+ 	case R_SPARC_PC10:
+ 	case R_SPARC_PC22:
+ 	case R_SPARC_PC_HH22:
+ 	case R_SPARC_PC_HM10:
+ 	case R_SPARC_PC_LM22:
++	  if (h != NULL)
++	    h->non_got_ref = 1;
++
+ 	  if (h != NULL
+ 	      && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ 	    break;
+ 	  /* Fall through.  */
++
+ 	case R_SPARC_DISP8:
+ 	case R_SPARC_DISP16:
+ 	case R_SPARC_DISP32:
+@@ -1335,9 +1588,6 @@
+ 	case R_SPARC_WDISP22:
+ 	case R_SPARC_WDISP19:
+ 	case R_SPARC_WDISP16:
+-	  if (h == NULL)
+-	    break;
+-	  /* Fall through.  */
+ 	case R_SPARC_8:
+ 	case R_SPARC_16:
+ 	case R_SPARC_32:
+@@ -1345,6 +1595,7 @@
+ 	case R_SPARC_22:
+ 	case R_SPARC_13:
+ 	case R_SPARC_LO10:
++	case R_SPARC_UA16:
+ 	case R_SPARC_UA32:
+ 	case R_SPARC_10:
+ 	case R_SPARC_11:
+@@ -1362,20 +1613,61 @@
+ 	case R_SPARC_M44:
+ 	case R_SPARC_L44:
+ 	case R_SPARC_UA64:
+-	case R_SPARC_UA16:
+-	  /* When creating a shared object, we must copy these relocs
+-	     into the output file.  We create a reloc section in
+-	     dynobj and make room for the reloc.
+-
+-	     But don't do this for debugging sections -- this shows up
+-	     with DWARF2 -- first because they are not loaded, and
+-	     second because DWARF sez the debug info is not to be
+-	     biased by the load address.  */
+-	  if (info->shared && (sec->flags & SEC_ALLOC))
++	  if (h != NULL)
++	    h->non_got_ref = 1;
++
++	r_sparc_plt32:
++	  if (h != NULL && !info->shared)
+ 	    {
++	      /* We may need a .plt entry if the function this reloc
++		 refers to is in a shared lib.  */
++	      h->plt.refcount += 1;
++	    }
++
++	  /* If we are creating a shared library, and this is a reloc
++	     against a global symbol, or a non PC relative reloc
++	     against a local symbol, then we need to copy the reloc
++	     into the shared library.  However, if we are linking with
++	     -Bsymbolic, we do not need to copy a reloc against a
++	     global symbol which is defined in an object we are
++	     including in the link (i.e., DEF_REGULAR is set).  At
++	     this point we have not seen all the input files, so it is
++	     possible that DEF_REGULAR is not set now but will be set
++	     later (it is never cleared).  In case of a weak definition,
++	     DEF_REGULAR may be cleared later by a strong definition in
++	     a shared library.  We account for that possibility below by
++	     storing information in the relocs_copied field of the hash
++	     table entry.  A similar situation occurs when creating
++	     shared libraries and symbol visibility changes render the
++	     symbol local.
++
++	     If on the other hand, we are creating an executable, we
++	     may need to keep relocations for symbols satisfied by a
++	     dynamic library if we manage to avoid copy relocs for the
++	     symbol.  */
++	  if ((info->shared
++	       && (sec->flags & SEC_ALLOC) != 0
++	       && (! sparc64_elf_howto_table[r_type].pc_relative
++		   || (h != NULL
++		       && (! info->symbolic
++			   || h->root.type == bfd_link_hash_defweak
++			   || !h->def_regular))))
++	      || (!info->shared
++		  && (sec->flags & SEC_ALLOC) != 0
++		  && h != NULL
++		  && (h->root.type == bfd_link_hash_defweak
++		      || !h->def_regular)))
++	    {
++	      struct sparc64_elf_dyn_relocs *p;
++	      struct sparc64_elf_dyn_relocs **head;
++
++	      /* When creating a shared object, we must copy these
++		 relocs into the output file.  We create a reloc
++		 section in dynobj and make room for the reloc.  */
+ 	      if (sreloc == NULL)
+ 		{
+ 		  const char *name;
++		  bfd *dynobj;
+ 
+ 		  name = (bfd_elf_string_from_elf_section
+ 			  (abfd,
+@@ -1388,6 +1680,10 @@
+ 			      && strcmp (bfd_get_section_name (abfd, sec),
+ 					 name + 5) == 0);
+ 
++		  if (htab->elf.dynobj == NULL)
++		    htab->elf.dynobj = abfd;
++		  dynobj = htab->elf.dynobj;
++
+ 		  sreloc = bfd_get_section_by_name (dynobj, name);
+ 		  if (sreloc == NULL)
+ 		    {
+@@ -1403,12 +1699,49 @@
+ 			  || ! bfd_set_section_alignment (dynobj, sreloc, 3))
+ 			return FALSE;
+ 		    }
+-		  if (sec->flags & SEC_READONLY)
+-		    info->flags |= DF_TEXTREL;
++		  elf_section_data (sec)->sreloc = sreloc;
++		}
++
++	      /* If this is a global symbol, we count the number of
++		 relocations we need for this symbol.  */
++	      if (h != NULL)
++		head = &((struct sparc64_elf_link_hash_entry *) h)->dyn_relocs;
++	      else
++		{
++		  /* Track dynamic relocs needed for local syms too.
++		     We really need local syms available to do this
++		     easily.  Oh well.  */
++
++		  asection *s;
++		  s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
++						 sec, r_symndx);
++		  if (s == NULL)
++		    return FALSE;
++
++		  head = ((struct sparc64_elf_dyn_relocs **)
++			  &elf_section_data (s)->local_dynrel);
++		}
++
++	      p = *head;
++	      if (p == NULL || p->sec != sec)
++		{
++		  bfd_size_type amt = sizeof *p;
++		  p = ((struct sparc64_elf_dyn_relocs *)
++		       bfd_alloc (htab->elf.dynobj, amt));
++		  if (p == NULL)
++		    return FALSE;
++		  p->next = *head;
++		  *head = p;
++		  p->sec = sec;
++		  p->count = 0;
++		  p->pc_count = 0;
+ 		}
+ 
+-	      sreloc->size += sizeof (Elf64_External_Rela);
++	      p->count += 1;
++	      if (sparc64_elf_howto_table[r_type].pc_relative)
++		p->pc_count += 1;
+ 	    }
++
+ 	  break;
+ 
+ 	case R_SPARC_REGISTER:
+@@ -1416,9 +1749,7 @@
+ 	  break;
+ 
+ 	default:
+-	  (*_bfd_error_handler) (_("%B: check_relocs: unhandled reloc type %d"),
+-				abfd, ELF64_R_TYPE_ID (rel->r_info));
+-	  return FALSE;
++	  break;
+ 	}
+     }
+ 
+@@ -1641,6 +1972,175 @@
+     }
+ }
+ 
++static asection *
++sparc64_elf_gc_mark_hook (sec, info, rel, h, sym)
++       asection *sec;
++       struct bfd_link_info *info ATTRIBUTE_UNUSED;
++       Elf_Internal_Rela *rel ATTRIBUTE_UNUSED;
++       struct elf_link_hash_entry *h;
++       Elf_Internal_Sym *sym;
++{
++  if (h != NULL)
++    {
++      switch (h->root.type)
++	{
++	case bfd_link_hash_defined:
++	case bfd_link_hash_defweak:
++	  return h->root.u.def.section;
++
++	case bfd_link_hash_common:
++	  return h->root.u.c.p->section;
++
++	default:
++	  break;
++	}
++    }
++  else
++    return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
++
++  return NULL;
++}
++
++/* Update the got entry reference counts for the section being removed.  */
++static bfd_boolean
++sparc64_elf_gc_sweep_hook (abfd, info, sec, relocs)
++     bfd *abfd;
++     struct bfd_link_info *info ATTRIBUTE_UNUSED;
++     asection *sec;
++     const Elf_Internal_Rela *relocs;
++{
++  Elf_Internal_Shdr *symtab_hdr;
++  struct elf_link_hash_entry **sym_hashes;
++  bfd_signed_vma *local_got_refcounts;
++  const Elf_Internal_Rela *rel, *relend;
++
++  elf_section_data (sec)->local_dynrel = NULL;
++
++  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
++  sym_hashes = elf_sym_hashes (abfd);
++  local_got_refcounts = elf_local_got_refcounts (abfd);
++
++  relend = relocs + sec->reloc_count;
++  for (rel = relocs; rel < relend; rel++)
++    {
++      unsigned long r_symndx;
++      unsigned int r_type;
++      struct elf_link_hash_entry *h = NULL;
++
++      r_symndx = ELF64_R_SYM (rel->r_info);
++      if (r_symndx >= symtab_hdr->sh_info)
++	{
++	  struct sparc64_elf_link_hash_entry *eh;
++	  struct sparc64_elf_dyn_relocs **pp;
++	  struct sparc64_elf_dyn_relocs *p;
++
++	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
++	  while (h->root.type == bfd_link_hash_indirect
++		 || h->root.type == bfd_link_hash_warning)
++	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
++	  eh = (struct sparc64_elf_link_hash_entry *) h;
++	  for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
++	    if (p->sec == sec)
++	      {
++		/* Everything must go for SEC.  */
++		*pp = p->next;
++		break;
++	      }
++	}
++
++      r_type = ELF64_R_TYPE_ID (rel->r_info);
++      r_type = sparc64_elf_tls_transition (info, r_type, h != NULL);
++      switch (r_type)
++	{
++	case R_SPARC_TLS_LDM_HI22:
++	case R_SPARC_TLS_LDM_LO10:
++	  if (sparc64_elf_hash_table (info)->tls_ldm_got.refcount > 0)
++	    sparc64_elf_hash_table (info)->tls_ldm_got.refcount -= 1;
++	  break;
++
++	case R_SPARC_TLS_GD_HI22:
++	case R_SPARC_TLS_GD_LO10:
++	case R_SPARC_TLS_IE_HI22:
++	case R_SPARC_TLS_IE_LO10:
++	case R_SPARC_GOT10:
++	case R_SPARC_GOT13:
++	case R_SPARC_GOT22:
++	  if (h != NULL)
++	    {
++	      if (h->got.refcount > 0)
++		h->got.refcount--;
++	    }
++	  else
++	    {
++	      if (local_got_refcounts[r_symndx] > 0)
++		local_got_refcounts[r_symndx]--;
++	    }
++	  break;
++
++	case R_SPARC_PC10:
++	case R_SPARC_PC22:
++	case R_SPARC_PC_HH22:
++	case R_SPARC_PC_HM10:
++	case R_SPARC_PC_LM22:
++	  if (h != NULL
++	      && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
++	    break;
++	  /* Fall through.  */
++
++	case R_SPARC_DISP8:
++	case R_SPARC_DISP16:
++	case R_SPARC_DISP32:
++	case R_SPARC_DISP64:
++	case R_SPARC_WDISP30:
++	case R_SPARC_WDISP22:
++	case R_SPARC_WDISP19:
++	case R_SPARC_WDISP16:
++	case R_SPARC_8:
++	case R_SPARC_16:
++	case R_SPARC_32:
++	case R_SPARC_HI22:
++	case R_SPARC_22:
++	case R_SPARC_13:
++	case R_SPARC_LO10:
++	case R_SPARC_UA16:
++	case R_SPARC_UA32:
++	case R_SPARC_PLT32:
++	case R_SPARC_10:
++	case R_SPARC_11:
++	case R_SPARC_64:
++	case R_SPARC_OLO10:
++	case R_SPARC_HH22:
++	case R_SPARC_HM10:
++	case R_SPARC_LM22:
++	case R_SPARC_7:
++	case R_SPARC_5:
++	case R_SPARC_6:
++	case R_SPARC_HIX22:
++	case R_SPARC_LOX10:
++	case R_SPARC_H44:
++	case R_SPARC_M44:
++	case R_SPARC_L44:
++	case R_SPARC_UA64:
++	  if (info->shared)
++	    break;
++	  /* Fall through.  */
++
++	case R_SPARC_WPLT30:
++	  if (h != NULL)
++	    {
++	      if (h->plt.refcount > 0)
++		h->plt.refcount--;
++	    }
++	  break;
++
++	default:
++	  break;
++	}
++    }
++
++  return TRUE;
++}
++
+ /* Adjust a symbol defined by a dynamic object and referenced by a
+    regular object.  The current definition is in some section of the
+    dynamic object, but we're not including those sections.  We have to
+@@ -1652,14 +2152,16 @@
+      struct bfd_link_info *info;
+      struct elf_link_hash_entry *h;
+ {
+-  bfd *dynobj;
++  struct sparc64_elf_link_hash_table *htab;
++  struct sparc64_elf_link_hash_entry * eh;
++  struct sparc64_elf_dyn_relocs *p;
+   asection *s;
+   unsigned int power_of_two;
+ 
+-  dynobj = elf_hash_table (info)->dynobj;
++  htab = sparc64_elf_hash_table (info);
+ 
+   /* Make sure we know what is going on here.  */
+-  BFD_ASSERT (dynobj != NULL
++  BFD_ASSERT (htab->elf.dynobj != NULL
+ 	      && (h->needs_plt
+ 		  || h->u.weakdef != NULL
+ 		  || (h->def_dynamic
+@@ -1680,63 +2182,26 @@
+ 	      || h->root.type == bfd_link_hash_defweak)
+ 	  && (h->root.u.def.section->flags & SEC_CODE) != 0))
+     {
+-      if (! info->shared
+-	  && !h->def_dynamic
+-	  && !h->ref_dynamic
+-	  && h->root.type != bfd_link_hash_undefweak
+-	  && h->root.type != bfd_link_hash_undefined)
++      if (h->plt.refcount <= 0
++	  || (! info->shared
++	      && !h->def_dynamic
++	      && !h->ref_dynamic
++	      && h->root.type != bfd_link_hash_undefweak
++	      && h->root.type != bfd_link_hash_undefined))
+ 	{
+ 	  /* This case can occur if we saw a WPLT30 reloc in an input
+-             file, but none of the input files were dynamic objects.
+-             In such a case, we don't actually need to build a
+-             procedure linkage table, and we can just do a WDISP30
+-             reloc instead.  */
+-	  BFD_ASSERT (h->needs_plt);
+-	  return TRUE;
+-	}
+-
+-      s = bfd_get_section_by_name (dynobj, ".plt");
+-      BFD_ASSERT (s != NULL);
+-
+-      /* The first four bit in .plt is reserved.  */
+-      if (s->size == 0)
+-	s->size = PLT_HEADER_SIZE;
+-
+-      /* To simplify matters later, just store the plt index here.  */
+-      h->plt.offset = s->size / PLT_ENTRY_SIZE;
+-
+-      /* If this symbol is not defined in a regular file, and we are
+-	 not generating a shared library, then set the symbol to this
+-	 location in the .plt.  This is required to make function
+-	 pointers compare as equal between the normal executable and
+-	 the shared library.  */
+-      if (! info->shared
+-	  && !h->def_regular)
+-	{
+-	  h->root.u.def.section = s;
+-	  h->root.u.def.value = sparc64_elf_plt_entry_offset (h->plt.offset);
+-	}
+-
+-      /* Make room for this entry.  */
+-      s->size += PLT_ENTRY_SIZE;
+-
+-      /* We also need to make an entry in the .rela.plt section.  */
+-
+-      s = bfd_get_section_by_name (dynobj, ".rela.plt");
+-      BFD_ASSERT (s != NULL);
+-
+-      s->size += sizeof (Elf64_External_Rela);
+-
+-      /* The procedure linkage table size is bounded by the magnitude
+-	 of the offset we can describe in the entry.  */
+-      if (s->size >= (bfd_vma)1 << 32)
+-	{
+-	  bfd_set_error (bfd_error_bad_value);
+-	  return FALSE;
++	     file, but the symbol was never referred to by a dynamic
++	     object, or if all references were garbage collected.  In
++	     such a case, we don't actually need to build a procedure
++	     linkage table, and we can just do a WDISP30 reloc instead.  */
++	  h->plt.offset = (bfd_vma) -1;
++	  h->needs_plt = 0;
+ 	}
+ 
+       return TRUE;
+     }
++  else
++    h->plt.offset = (bfd_vma) -1;
+ 
+   /* If this is a weak symbol, and there is a real definition, the
+      processor independent code will have arranged for us to see the
+@@ -1760,6 +2225,27 @@
+   if (info->shared)
+     return TRUE;
+ 
++  /* If there are no references to this symbol that do not use the
++     GOT, we don't need to generate a copy reloc.  */
++  if (!h->non_got_ref)
++    return TRUE;
++
++  eh = (struct sparc64_elf_link_hash_entry *) h;
++  for (p = eh->dyn_relocs; p != NULL; p = p->next)
++    {
++      s = p->sec->output_section;
++      if (s != NULL && (s->flags & SEC_READONLY) != 0)
++	break;
++    }
++
++  /* If we didn't find any dynamic relocs in read-only sections, then
++     we'll be keeping the dynamic relocs and avoiding the copy reloc.  */
++  if (p == NULL)
++    {
++      h->non_got_ref = 0;
++      return TRUE;
++    }
++
+   /* We must allocate the symbol in our .dynbss section, which will
+      become part of the .bss section of the executable.  There will be
+      an entry for this symbol in the .dynsym section.  The dynamic
+@@ -1770,20 +2256,13 @@
+      both the dynamic object and the regular object will refer to the
+      same memory location for the variable.  */
+ 
+-  s = bfd_get_section_by_name (dynobj, ".dynbss");
+-  BFD_ASSERT (s != NULL);
+-
+   /* We must generate a R_SPARC_COPY reloc to tell the dynamic linker
+      to copy the initial value out of the dynamic object and into the
+      runtime process image.  We need to remember the offset into the
+      .rel.bss section we are going to use.  */
+   if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+     {
+-      asection *srel;
+-
+-      srel = bfd_get_section_by_name (dynobj, ".rela.bss");
+-      BFD_ASSERT (srel != NULL);
+-      srel->size += sizeof (Elf64_External_Rela);
++      htab->srelbss->size += sizeof (Elf64_External_Rela);
+       h->needs_copy = 1;
+     }
+ 
+@@ -1795,6 +2274,7 @@
+     power_of_two = 4;
+ 
+   /* Apply the required alignment.  */
++  s = htab->sdynbss;
+   s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
+   if (power_of_two > bfd_get_section_alignment (dynobj, s))
+     {
+@@ -1812,105 +2292,426 @@
+   return TRUE;
+ }
+ 
+-/* Return true if the dynamic symbol for a given section should be
+-   omitted when creating a shared library.  */
++/* Allocate space in .plt, .got and associated reloc sections for
++   dynamic relocs.  */
+ 
+ static bfd_boolean
+-sparc64_elf_omit_section_dynsym (bfd *output_bfd,
+-				 struct bfd_link_info *info,
+-				 asection *p)
++allocate_dynrelocs (h, inf)
++     struct elf_link_hash_entry *h;
++     PTR inf;
+ {
+-  /* We keep the .got section symbol so that explicit relocations
+-     against the _GLOBAL_OFFSET_TABLE_ symbol emitted in PIC mode
+-     can be turned into relocations against the .got symbol.  */
+-  if (strcmp (p->name, ".got") == 0)
+-    return FALSE;
+-
+-  return _bfd_elf_link_omit_section_dynsym (output_bfd, info, p);
+-}
++  struct bfd_link_info *info;
++  struct sparc64_elf_link_hash_table *htab;
++  struct sparc64_elf_link_hash_entry *eh;
++  struct sparc64_elf_dyn_relocs *p;
+ 
+-/* Set the sizes of the dynamic sections.  */
++  if (h->root.type == bfd_link_hash_indirect)
++    return TRUE;
+ 
+-static bfd_boolean
+-sparc64_elf_size_dynamic_sections (output_bfd, info)
+-     bfd *output_bfd;
+-     struct bfd_link_info *info;
+-{
+-  bfd *dynobj;
+-  asection *s;
+-  bfd_boolean relplt;
++  if (h->root.type == bfd_link_hash_warning)
++    /* When warning symbols are created, they **replace** the "real"
++       entry in the hash table, thus we never get to see the real
++       symbol in a hash traversal.  So look at it now.  */
++    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ 
+-  dynobj = elf_hash_table (info)->dynobj;
+-  BFD_ASSERT (dynobj != NULL);
++  info = (struct bfd_link_info *) inf;
++  htab = sparc64_elf_hash_table (info);
+ 
+-  if (elf_hash_table (info)->dynamic_sections_created)
++  if (htab->elf.dynamic_sections_created
++      && h->plt.refcount > 0)
+     {
+-      /* Set the contents of the .interp section to the interpreter.  */
+-      if (info->executable)
++      /* Make sure this symbol is output as a dynamic symbol.
++	 Undefined weak syms won't yet be marked as dynamic.  */
++      if (h->dynindx == -1
++	  && !h->forced_local)
+ 	{
+-	  s = bfd_get_section_by_name (dynobj, ".interp");
+-	  BFD_ASSERT (s != NULL);
+-	  s->size = sizeof ELF_DYNAMIC_INTERPRETER;
+-	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
++	  if (! bfd_elf_link_record_dynamic_symbol (info, h))
++	    return FALSE;
+ 	}
+-    }
+-  else
+-    {
+-      /* We may have created entries in the .rela.got section.
+-         However, if we are not creating the dynamic sections, we will
+-         not actually use these entries.  Reset the size of .rela.got,
+-         which will cause it to get stripped from the output file
+-         below.  */
+-      s = sparc64_elf_hash_table (info)->srelgot;
+-      if (s != NULL)
+-	s->size = 0;
+-    }
+-
+-  /* The check_relocs and adjust_dynamic_symbol entry points have
+-     determined the sizes of the various dynamic sections.  Allocate
+-     memory for them.  */
+-  relplt = FALSE;
+-  for (s = dynobj->sections; s != NULL; s = s->next)
+-    {
+-      const char *name;
+-      bfd_boolean strip;
+ 
+-      if ((s->flags & SEC_LINKER_CREATED) == 0)
+-	continue;
++      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
++	{
++	  asection *s = htab->splt;
+ 
+-      /* It's OK to base decisions on the section name, because none
+-	 of the dynobj section names depend upon the input files.  */
+-      name = bfd_get_section_name (dynobj, s);
++	  /* The first four bit in .plt is reserved.  */
++	  if (s->size == 0)
++	    s->size = PLT_HEADER_SIZE;
+ 
+-      strip = FALSE;
++	  /* The procedure linkage table size is bounded by the magnitude
++	     of the offset we can describe in the entry.  */
++	  if (s->size >= (bfd_vma)1 << 32)
++	    {
++	      bfd_set_error (bfd_error_bad_value);
++	      return FALSE;
++	    }
+ 
+-      if (strncmp (name, ".rela", 5) == 0)
+-	{
+-	  if (s->size == 0)
++	  if (s->size >= LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE)
+ 	    {
+-	      /* If we don't need this section, strip it from the
+-		 output file.  This is to handle .rela.bss and
+-		 .rel.plt.  We must create it in
+-		 create_dynamic_sections, because it must be created
+-		 before the linker maps input sections to output
+-		 sections.  The linker does that before
+-		 adjust_dynamic_symbol is called, and it is that
+-		 function which decides whether anything needs to go
+-		 into these sections.  */
+-	      strip = TRUE;
++	      bfd_vma off = s->size - LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE;
++
++
++	      off = (off % (160 * PLT_ENTRY_SIZE)) / PLT_ENTRY_SIZE;
++
++	      h->plt.offset = (s->size - (off * 8));
+ 	    }
+ 	  else
+-	    {
+-	      if (strcmp (name, ".rela.plt") == 0)
+-		relplt = TRUE;
++	    h->plt.offset = s->size;
+ 
++	  /* If this symbol is not defined in a regular file, and we are
++	     not generating a shared library, then set the symbol to this
++	     location in the .plt.  This is required to make function
++	     pointers compare as equal between the normal executable and
++	     the shared library.  */
++	  if (! info->shared
++	      && !h->def_regular)
++	    {
++	      h->root.u.def.section = s;
++	      h->root.u.def.value = h->plt.offset;
++	    }
++
++	  /* Make room for this entry.  */
++	  s->size += PLT_ENTRY_SIZE;
++
++	  /* We also need to make an entry in the .rela.plt section.  */
++	  htab->srelplt->size += sizeof (Elf64_External_Rela);
++	}
++      else
++	{
++	  h->plt.offset = (bfd_vma) -1;
++	  h->needs_plt = 0;
++	}
++    }
++  else
++    {
++      h->plt.offset = (bfd_vma) -1;
++      h->needs_plt = 0;
++    }
++
++  /* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
++     make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry.  */
++  if (h->got.refcount > 0
++      && !info->shared
++      && h->dynindx == -1
++      && sparc64_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
++    h->got.offset = (bfd_vma) -1;
++  else if (h->got.refcount > 0)
++    {
++      asection *s;
++      bfd_boolean dyn;
++      int tls_type = sparc64_elf_hash_entry(h)->tls_type;
++
++      /* Make sure this symbol is output as a dynamic symbol.
++	 Undefined weak syms won't yet be marked as dynamic.  */
++      if (h->dynindx == -1
++	  && !h->forced_local)
++	{
++	  if (! bfd_elf_link_record_dynamic_symbol (info, h))
++	    return FALSE;
++	}
++
++      s = htab->sgot;
++      h->got.offset = s->size;
++      s->size += 8;
++      /* R_SPARC_TLS_GD_HI{22,LO10} needs 2 consecutive GOT slots.  */
++      if (tls_type == GOT_TLS_GD)
++	s->size += 8;
++      dyn = htab->elf.dynamic_sections_created;
++      /* R_SPARC_TLS_IE_{HI22,LO10} needs one dynamic relocation,
++	 R_SPARC_TLS_GD_{HI22,LO10} needs one if local symbol and two if
++	 global.  */
++      if ((tls_type == GOT_TLS_GD && h->dynindx == -1)
++	  || tls_type == GOT_TLS_IE)
++	htab->srelgot->size += sizeof (Elf64_External_Rela);
++      else if (tls_type == GOT_TLS_GD)
++	htab->srelgot->size += 2 * sizeof (Elf64_External_Rela);
++      else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
++	htab->srelgot->size += sizeof (Elf64_External_Rela);
++    }
++  else
++    h->got.offset = (bfd_vma) -1;
++
++  eh = (struct sparc64_elf_link_hash_entry *) h;
++  if (eh->dyn_relocs == NULL)
++    return TRUE;
++
++  /* In the shared -Bsymbolic case, discard space allocated for
++     dynamic pc-relative relocs against symbols which turn out to be
++     defined in regular objects.  For the normal shared case, discard
++     space for pc-relative relocs that have become local due to symbol
++     visibility changes.  */
++
++  if (info->shared)
++    {
++      if (h->def_regular
++	  && (h->forced_local
++	      || info->symbolic))
++	{
++	  struct sparc64_elf_dyn_relocs **pp;
++
++	  for (pp = &eh->dyn_relocs; (p = *pp) != NULL; )
++	    {
++	      p->count -= p->pc_count;
++	      p->pc_count = 0;
++	      if (p->count == 0)
++		*pp = p->next;
++	      else
++		pp = &p->next;
++	    }
++	}
++    }
++  else
++    {
++      /* For the non-shared case, discard space for relocs against
++	 symbols which turn out to need copy relocs or are not
++	 dynamic.  */
++
++      if (!h->non_got_ref
++	  && ((h->def_dynamic
++	       && !h->def_regular)
++	      || (htab->elf.dynamic_sections_created
++		  && (h->root.type == bfd_link_hash_undefweak
++		      || h->root.type == bfd_link_hash_undefined))))
++	{
++	  /* Make sure this symbol is output as a dynamic symbol.
++	     Undefined weak syms won't yet be marked as dynamic.  */
++	  if (h->dynindx == -1
++	      && !h->forced_local)
++	    {
++	      if (! bfd_elf_link_record_dynamic_symbol (info, h))
++		return FALSE;
++	    }
++
++	  /* If that succeeded, we know we'll be keeping all the
++	     relocs.  */
++	  if (h->dynindx != -1)
++	    goto keep;
++	}
++
++      eh->dyn_relocs = NULL;
++
++    keep: ;
++    }
++
++  /* Finally, allocate space.  */
++  for (p = eh->dyn_relocs; p != NULL; p = p->next)
++    {
++      asection *sreloc = elf_section_data (p->sec)->sreloc;
++      sreloc->size += p->count * sizeof (Elf64_External_Rela);
++    }
++
++  return TRUE;
++}
++
++/* Find any dynamic relocs that apply to read-only sections.  */
++
++static bfd_boolean
++readonly_dynrelocs (h, inf)
++     struct elf_link_hash_entry *h;
++     PTR inf;
++{
++  struct sparc64_elf_link_hash_entry *eh;
++  struct sparc64_elf_dyn_relocs *p;
++
++  if (h->root.type == bfd_link_hash_warning)
++    h = (struct elf_link_hash_entry *) h->root.u.i.link;
++
++  eh = (struct sparc64_elf_link_hash_entry *) h;
++  for (p = eh->dyn_relocs; p != NULL; p = p->next)
++    {
++      asection *s = p->sec->output_section;
++
++      if (s != NULL && (s->flags & SEC_READONLY) != 0)
++	{
++	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
++
++	  info->flags |= DF_TEXTREL;
++
++	  /* Not an error, just cut short the traversal.  */
++	  return FALSE;
++	}
++    }
++  return TRUE;
++}
++
++/* Return true if the dynamic symbol for a given section should be
++   omitted when creating a shared library.  */
++
++static bfd_boolean
++sparc64_elf_omit_section_dynsym (bfd *output_bfd,
++				 struct bfd_link_info *info,
++				 asection *p)
++{
++  /* We keep the .got section symbol so that explicit relocations
++     against the _GLOBAL_OFFSET_TABLE_ symbol emitted in PIC mode
++     can be turned into relocations against the .got symbol.  */
++  if (strcmp (p->name, ".got") == 0)
++    return FALSE;
++
++  return _bfd_elf_link_omit_section_dynsym (output_bfd, info, p);
++}
++
++/* Set the sizes of the dynamic sections.  */
++
++static bfd_boolean
++sparc64_elf_size_dynamic_sections (output_bfd, info)
++     bfd *output_bfd;
++     struct bfd_link_info *info;
++{
++  struct sparc64_elf_link_hash_table *htab;
++  bfd *dynobj;
++  asection *s;
++  bfd *ibfd;
++
++  htab = sparc64_elf_hash_table (info);
++  dynobj = htab->elf.dynobj;
++  BFD_ASSERT (dynobj != NULL);
++
++  if (elf_hash_table (info)->dynamic_sections_created)
++    {
++      /* Set the contents of the .interp section to the interpreter.  */
++      if (info->executable)
++	{
++	  s = bfd_get_section_by_name (dynobj, ".interp");
++	  BFD_ASSERT (s != NULL);
++	  s->size = sizeof ELF_DYNAMIC_INTERPRETER;
++	  s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
++	}
++    }
++
++  /* Set up .got offsets for local syms, and space for local dynamic
++     relocs.  */
++  for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
++    {
++      bfd_signed_vma *local_got;
++      bfd_signed_vma *end_local_got;
++      char *local_tls_type;
++      bfd_size_type locsymcount;
++      Elf_Internal_Shdr *symtab_hdr;
++      asection *srel;
++
++      if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
++	continue;
++
++      for (s = ibfd->sections; s != NULL; s = s->next)
++	{
++	  struct sparc64_elf_dyn_relocs *p;
++
++	  for (p = *((struct sparc64_elf_dyn_relocs **)
++		     &elf_section_data (s)->local_dynrel);
++	       p != NULL;
++	       p = p->next)
++	    {
++	      if (!bfd_is_abs_section (p->sec)
++		  && bfd_is_abs_section (p->sec->output_section))
++		{
++		  /* Input section has been discarded, either because
++		     it is a copy of a linkonce section or due to
++		     linker script /DISCARD/, so we'll be discarding
++		     the relocs too.  */
++		}
++	      else if (p->count != 0)
++		{
++		  srel = elf_section_data (p->sec)->sreloc;
++		  srel->size += p->count * sizeof (Elf64_External_Rela);
++		  if ((p->sec->output_section->flags & SEC_READONLY) != 0)
++		    info->flags |= DF_TEXTREL;
++		}
++	    }
++	}
++
++      local_got = elf_local_got_refcounts (ibfd);
++      if (!local_got)
++	continue;
++
++      symtab_hdr = &elf_tdata (ibfd)->symtab_hdr;
++      locsymcount = symtab_hdr->sh_info;
++      end_local_got = local_got + locsymcount;
++      local_tls_type = sparc64_elf_local_got_tls_type (ibfd);
++      s = htab->sgot;
++      srel = htab->srelgot;
++      for (; local_got < end_local_got; ++local_got, ++local_tls_type)
++	{
++	  if (*local_got > 0)
++	    {
++	      *local_got = s->size;
++	      s->size += 8;
++	      if (*local_tls_type == GOT_TLS_GD)
++		s->size += 8;
++	      if (info->shared
++		  || *local_tls_type == GOT_TLS_GD
++		  || *local_tls_type == GOT_TLS_IE)
++		srel->size += sizeof (Elf64_External_Rela);
++	    }
++	  else
++	    *local_got = (bfd_vma) -1;
++	}
++    }
++
++  if (htab->tls_ldm_got.refcount > 0)
++    {
++      /* Allocate 2 got entries and 1 dynamic reloc for
++	 R_SPARC_TLS_LDM_{HI22,LO10} relocs.  */
++      htab->tls_ldm_got.offset = htab->sgot->size;
++      htab->sgot->size += (2 * 8);
++      htab->srelgot->size += sizeof (Elf64_External_Rela);
++    }
++  else
++    htab->tls_ldm_got.offset = -1;
++
++  /* Allocate global sym .plt and .got entries, and space for global
++     sym dynamic relocs.  */
++  elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
++
++  /* The 32-bit sparc BFD backend has a hack that, iff the .got
++     section is larger than 0x1000 bytes, it increments the
++     .got base by 0x1000 so that 13 bit relocations are more
++     likely to work.
++
++     On 64-bit we have to be more careful, since sethi+or will
++     not create a proper 64-bit sign extended negative value
++     for relocations to the first 0x1000 bytes of the .got area.
++     We could do this using sethi+xor tricks just like the
++     sparc backend of GCC does, in order to make this work at
++     some point.  Just... not today.  */
++
++  /* The check_relocs and adjust_dynamic_symbol entry points have
++     determined the sizes of the various dynamic sections.  Allocate
++     memory for them.  */
++  for (s = dynobj->sections; s != NULL; s = s->next)
++    {
++      const char *name;
++      bfd_boolean strip = FALSE;
++
++      if ((s->flags & SEC_LINKER_CREATED) == 0)
++	continue;
++
++      /* It's OK to base decisions on the section name, because none
++	 of the dynobj section names depend upon the input files.  */
++      name = bfd_get_section_name (dynobj, s);
++
++      if (strncmp (name, ".rela", 5) == 0)
++	{
++	  if (s->size == 0)
++	    {
++	      /* If we don't need this section, strip it from the
++		 output file.  This is to handle .rela.bss and
++		 .rel.plt.  We must create it in
++		 create_dynamic_sections, because it must be created
++		 before the linker maps input sections to output
++		 sections.  The linker does that before
++		 adjust_dynamic_symbol is called, and it is that
++		 function which decides whether anything needs to go
++		 into these sections.  */
++	      strip = TRUE;
++	    }
++	  else
++	    {
+ 	      /* We use the reloc_count field as a counter if we need
+ 		 to copy relocs into the output file.  */
+ 	      s->reloc_count = 0;
+ 	    }
+ 	}
+-      else if (strcmp (name, ".plt") != 0
+-	       && strncmp (name, ".got", 4) != 0)
++      else if (s != htab->splt && s != htab->sgot)
+ 	{
+ 	  /* It's not one of our sections, so don't allocate space.  */
+ 	  continue;
+@@ -1951,7 +2752,7 @@
+ 	    return FALSE;
+ 	}
+ 
+-      if (relplt)
++      if (htab->srelplt->size != 0)
+ 	{
+ 	  if (!add_dynamic_entry (DT_PLTGOT, 0)
+ 	      || !add_dynamic_entry (DT_PLTRELSZ, 0)
+@@ -1965,6 +2766,12 @@
+ 	  || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
+ 	return FALSE;
+ 
++      /* If any dynamic relocs apply to a read-only section,
++	 then we need a DT_TEXTREL entry.  */
++      if ((info->flags & DF_TEXTREL) == 0)
++	elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
++				(PTR) info);
++
+       if (info->flags & DF_TEXTREL)
+ 	{
+ 	  if (!add_dynamic_entry (DT_TEXTREL, 0))
+@@ -2051,6 +2858,36 @@
+   return TRUE;
+ }
+ 
+
++/* Return the base VMA address which should be subtracted from real addresses
++   when resolving @dtpoff relocation.
++   This is PT_TLS segment p_vaddr.  */
++
++static bfd_vma
++dtpoff_base (info)
++     struct bfd_link_info *info;
++{
++  /* If tls_sec is NULL, we should have signalled an error already.  */
++  if (elf_hash_table (info)->tls_sec == NULL)
++    return 0;
++  return elf_hash_table (info)->tls_sec->vma;
++}
++
++/* Return the relocation value for @tpoff relocation
++   if STT_TLS virtual address is ADDRESS.  */
++
++static bfd_vma
++tpoff (info, address)
++     struct bfd_link_info *info;
++     bfd_vma address;
++{
++  struct elf_link_hash_table *htab = elf_hash_table (info);
++
++  /* If tls_sec is NULL, we should have signalled an error already.  */
++  if (htab->tls_sec == NULL)
++    return 0;
++  return address - htab->tls_size - htab->tls_sec->vma;
++}
++
+ /* Relocate a SPARC64 ELF section.  */
+ 
+ static bfd_boolean
+@@ -2065,13 +2902,11 @@
+      Elf_Internal_Sym *local_syms;
+      asection **local_sections;
+ {
+-  bfd *dynobj;
++  struct sparc64_elf_link_hash_table *htab;
+   Elf_Internal_Shdr *symtab_hdr;
+   struct elf_link_hash_entry **sym_hashes;
+   bfd_vma *local_got_offsets;
+   bfd_vma got_base;
+-  asection *sgot;
+-  asection *splt;
+   asection *sreloc;
+   Elf_Internal_Rela *rel;
+   Elf_Internal_Rela *relend;
+@@ -2079,25 +2914,23 @@
+   if (info->relocatable)
+     return TRUE;
+ 
+-  dynobj = elf_hash_table (info)->dynobj;
++  htab = sparc64_elf_hash_table (info);
+   symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
+   sym_hashes = elf_sym_hashes (input_bfd);
+   local_got_offsets = elf_local_got_offsets (input_bfd);
+ 
+-  if (elf_hash_table(info)->hgot == NULL)
++  if (elf_hash_table (info)->hgot == NULL)
+     got_base = 0;
+   else
+     got_base = elf_hash_table (info)->hgot->root.u.def.value;
+ 
+-  sgot = splt = sreloc = NULL;
+-  if (dynobj != NULL)
+-    splt = bfd_get_section_by_name (dynobj, ".plt");
++  sreloc = elf_section_data (input_section)->sreloc;
+ 
+   rel = relocs;
+   relend = relocs + NUM_SHDR_ENTRIES (& elf_section_data (input_section)->rel_hdr);
+   for (; rel < relend; rel++)
+     {
+-      int r_type;
++      int r_type, tls_type;
+       reloc_howto_type *howto;
+       unsigned long r_symndx;
+       struct elf_link_hash_entry *h;
+@@ -2148,223 +2981,6 @@
+ 	    }
+ 	}
+ 
+- do_dynreloc:
+-      /* When generating a shared object, these relocations are copied
+-	 into the output file to be resolved at run time.  */
+-      if (info->shared && r_symndx != 0 && (input_section->flags & SEC_ALLOC))
+-	{
+-	  switch (r_type)
+-	    {
+-	    case R_SPARC_PC10:
+-	    case R_SPARC_PC22:
+-	    case R_SPARC_PC_HH22:
+-	    case R_SPARC_PC_HM10:
+-	    case R_SPARC_PC_LM22:
+-	      if (h != NULL
+-		  && !strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_"))
+-		break;
+-	      /* Fall through.  */
+-	    case R_SPARC_DISP8:
+-	    case R_SPARC_DISP16:
+-	    case R_SPARC_DISP32:
+-	    case R_SPARC_DISP64:
+-	    case R_SPARC_WDISP30:
+-	    case R_SPARC_WDISP22:
+-	    case R_SPARC_WDISP19:
+-	    case R_SPARC_WDISP16:
+-	      if (h == NULL)
+-		break;
+-	      /* Fall through.  */
+-	    case R_SPARC_8:
+-	    case R_SPARC_16:
+-	    case R_SPARC_32:
+-	    case R_SPARC_HI22:
+-	    case R_SPARC_22:
+-	    case R_SPARC_13:
+-	    case R_SPARC_LO10:
+-	    case R_SPARC_UA32:
+-	    case R_SPARC_10:
+-	    case R_SPARC_11:
+-	    case R_SPARC_64:
+-	    case R_SPARC_OLO10:
+-	    case R_SPARC_HH22:
+-	    case R_SPARC_HM10:
+-	    case R_SPARC_LM22:
+-	    case R_SPARC_7:
+-	    case R_SPARC_5:
+-	    case R_SPARC_6:
+-	    case R_SPARC_HIX22:
+-	    case R_SPARC_LOX10:
+-	    case R_SPARC_H44:
+-	    case R_SPARC_M44:
+-	    case R_SPARC_L44:
+-	    case R_SPARC_UA64:
+-	    case R_SPARC_UA16:
+-	      {
+-		Elf_Internal_Rela outrel;
+-		bfd_byte *loc;
+-		bfd_boolean skip, relocate;
+-
+-		if (sreloc == NULL)
+-		  {
+-		    const char *name =
+-		      (bfd_elf_string_from_elf_section
+-		       (input_bfd,
+-			elf_elfheader (input_bfd)->e_shstrndx,
+-			elf_section_data (input_section)->rel_hdr.sh_name));
+-
+-		    if (name == NULL)
+-		      return FALSE;
+-
+-		    BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+-				&& strcmp (bfd_get_section_name(input_bfd,
+-								input_section),
+-					   name + 5) == 0);
+-
+-		    sreloc = bfd_get_section_by_name (dynobj, name);
+-		    BFD_ASSERT (sreloc != NULL);
+-		  }
+-
+-		skip = FALSE;
+-		relocate = FALSE;
+-
+-		outrel.r_offset =
+-		  _bfd_elf_section_offset (output_bfd, info, input_section,
+-					   rel->r_offset);
+-		if (outrel.r_offset == (bfd_vma) -1)
+-		  skip = TRUE;
+-		else if (outrel.r_offset == (bfd_vma) -2)
+-		  skip = TRUE, relocate = TRUE;
+-
+-		outrel.r_offset += (input_section->output_section->vma
+-				    + input_section->output_offset);
+-
+-		/* Optimize unaligned reloc usage now that we know where
+-		   it finally resides.  */
+-		switch (r_type)
+-		  {
+-		  case R_SPARC_16:
+-		    if (outrel.r_offset & 1) r_type = R_SPARC_UA16;
+-		    break;
+-		  case R_SPARC_UA16:
+-		    if (!(outrel.r_offset & 1)) r_type = R_SPARC_16;
+-		    break;
+-		  case R_SPARC_32:
+-		    if (outrel.r_offset & 3) r_type = R_SPARC_UA32;
+-		    break;
+-		  case R_SPARC_UA32:
+-		    if (!(outrel.r_offset & 3)) r_type = R_SPARC_32;
+-		    break;
+-		  case R_SPARC_64:
+-		    if (outrel.r_offset & 7) r_type = R_SPARC_UA64;
+-		    break;
+-		  case R_SPARC_UA64:
+-		    if (!(outrel.r_offset & 7)) r_type = R_SPARC_64;
+-		    break;
+-		  case R_SPARC_DISP8:
+-		  case R_SPARC_DISP16:
+-		  case R_SPARC_DISP32:
+-		  case R_SPARC_DISP64:
+-		    /* If the symbol is not dynamic, we should not keep
+-		       a dynamic relocation.  But an .rela.* slot has been
+-		       allocated for it, output R_SPARC_NONE.
+-		       FIXME: Add code tracking needed dynamic relocs as
+-		       e.g. i386 has.  */
+-		    if (h->dynindx == -1)
+-		      skip = TRUE, relocate = TRUE;
+-		    break;
+-		  }
+-
+-		/* FIXME: Dynamic reloc handling really needs to be rewritten.  */
+-		if (!skip
+-		    && h != NULL
+-		    && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+-		    && h->root.type == bfd_link_hash_undefweak)
+-		  skip = TRUE, relocate = TRUE;
+-
+-		if (skip)
+-		  memset (&outrel, 0, sizeof outrel);
+-		/* h->dynindx may be -1 if the symbol was marked to
+-		   become local.  */
+-		else if (h != NULL && ! is_plt
+-			 && ((! info->symbolic && h->dynindx != -1)
+-			     || !h->def_regular))
+-		  {
+-		    BFD_ASSERT (h->dynindx != -1);
+-		    outrel.r_info
+-		      = ELF64_R_INFO (h->dynindx,
+-				      ELF64_R_TYPE_INFO (
+-					ELF64_R_TYPE_DATA (rel->r_info),
+-							   r_type));
+-		    outrel.r_addend = rel->r_addend;
+-		  }
+-		else
+-		  {
+-		    outrel.r_addend = relocation + rel->r_addend;
+-		    if (r_type == R_SPARC_64)
+-		      outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
+-		    else
+-		      {
+-			long indx;
+-
+-			if (is_plt)
+-			  sec = splt;
+-
+-			if (bfd_is_abs_section (sec))
+-			  indx = 0;
+-			else if (sec == NULL || sec->owner == NULL)
+-			  {
+-			    bfd_set_error (bfd_error_bad_value);
+-			    return FALSE;
+-			  }
+-			else
+-			  {
+-			    asection *osec;
+-
+-			    osec = sec->output_section;
+-			    indx = elf_section_data (osec)->dynindx;
+-
+-			    /* We are turning this relocation into one
+-			       against a section symbol, so subtract out
+-			       the output section's address but not the
+-			       offset of the input section in the output
+-			       section.  */
+-			    outrel.r_addend -= osec->vma;
+-
+-			    /* FIXME: we really should be able to link non-pic
+-			       shared libraries.  */
+-			    if (indx == 0)
+-			      {
+-				BFD_FAIL ();
+-				(*_bfd_error_handler)
+-				  (_("%B: probably compiled without -fPIC?"),
+-				   input_bfd);
+-				bfd_set_error (bfd_error_bad_value);
+-				return FALSE;
+-			      }
+-			  }
+-
+-			outrel.r_info
+-			  = ELF64_R_INFO (indx,
+-					  ELF64_R_TYPE_INFO (
+-					    ELF64_R_TYPE_DATA (rel->r_info),
+-							       r_type));
+-		      }
+-		  }
+-
+-		loc = sreloc->contents;
+-		loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+-		bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+-
+-		/* This reloc will be computed at runtime, so there's no
+-		   need to do anything now.  */
+-		if (! relocate)
+-		  continue;
+-	      }
+-	    break;
+-	    }
+-	}
+-
+       switch (r_type)
+ 	{
+ 	case R_SPARC_GOT10:
+@@ -2372,11 +2988,8 @@
+ 	case R_SPARC_GOT22:
+ 	  /* Relocation is to the entry for this symbol in the global
+ 	     offset table.  */
+-	  if (sgot == NULL)
+-	    {
+-	      sgot = sparc64_elf_hash_table (info)->sgot;
+-	      BFD_ASSERT (sgot != NULL);
+-	    }
++	  if (htab->sgot == NULL)
++	    abort ();
+ 
+ 	  if (h != NULL)
+ 	    {
+@@ -2393,193 +3006,761 @@
+ 			  || h->forced_local)
+ 		      && h->def_regular))
+ 		{
+-		  /* This is actually a static link, or it is a -Bsymbolic
+-		     link and the symbol is defined locally, or the symbol
+-		     was forced to be local because of a version file.  We
+-		     must initialize this entry in the global offset table.
+-		     Since the offset must always be a multiple of 8, we
+-		     use the least significant bit to record whether we
+-		     have initialized it already.
++		  /* This is actually a static link, or it is a
++		     -Bsymbolic link and the symbol is defined
++		     locally, or the symbol was forced to be local
++		     because of a version file.  We must initialize
++		     this entry in the global offset table.  Since the
++		     offset must always be a multiple of 8, we use the
++		     least significant bit to record whether we have
++		     initialized it already.
++
++		     When doing a dynamic link, we create a .rela.got
++		     relocation entry to initialize the value.  This
++		     is done in the finish_dynamic_symbol routine.  */
++		  if ((off & 1) != 0)
++		    off &= ~1;
++		  else
++		    {
++		      bfd_put_64 (output_bfd, relocation,
++				  htab->sgot->contents + off);
++		      h->got.offset |= 1;
++		    }
++		}
++	      else
++		unresolved_reloc = FALSE;
++	    }
++	  else
++	    {
++	      BFD_ASSERT (local_got_offsets != NULL
++			  && local_got_offsets[r_symndx] != (bfd_vma) -1);
++
++	      off = local_got_offsets[r_symndx];
++
++	      /* The offset must always be a multiple of 8.  We use
++		 the least significant bit to record whether we have
++		 already processed this entry.  */
++	      if ((off & 1) != 0)
++		off &= ~1;
++	      else
++		{
++
++		  if (info->shared)
++		    {
++		      asection *s;
++		      Elf_Internal_Rela outrel;
++		      bfd_byte *loc;
++
++		      /* We need to generate a R_SPARC_RELATIVE reloc
++			 for the dynamic linker.  */
++		      s = htab->srelgot;
++		      BFD_ASSERT (s != NULL);
++
++		      outrel.r_offset = (htab->sgot->output_section->vma
++					 + htab->sgot->output_offset
++					 + off);
++		      outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
++		      outrel.r_addend = relocation;
++		      relocation = 0;
++		      loc = s->contents;
++		      loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
++		      bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
++		    }
++
++		  bfd_put_64 (output_bfd, relocation,
++			      htab->sgot->contents + off);
++		  local_got_offsets[r_symndx] |= 1;
++		}
++	    }
++	  relocation = htab->sgot->output_offset + off - got_base;
++	  break;
++
++	case R_SPARC_PLT32:
++	case R_SPARC_PLT64:
++	  if (h == NULL || h->plt.offset == (bfd_vma) -1)
++	    {
++	      r_type = (r_type == R_SPARC_PLT32) ? R_SPARC_32 : R_SPARC_64;
++	      goto r_sparc_plt32;
++	    }
++	  /* Fall through.  */
++
++	case R_SPARC_WPLT30:
++	case R_SPARC_HIPLT22:
++	case R_SPARC_LOPLT10:
++	case R_SPARC_PCPLT32:
++	case R_SPARC_PCPLT22:
++	case R_SPARC_PCPLT10:
++	r_sparc_wplt30:
++	  /* Relocation is to the entry for this symbol in the
++	     procedure linkage table.  */
++
++	  /* Relocation is to the entry for this symbol in the
++             procedure linkage table.  */
++	  BFD_ASSERT (h != NULL);
++
++	  if (h->plt.offset == (bfd_vma) -1 || htab->splt == NULL)
++	    {
++	      /* We didn't make a PLT entry for this symbol.  This
++		 happens when statically linking PIC code, or when
++		 using -Bsymbolic.  */
++	      break;
++	    }
++
++	  relocation = (htab->splt->output_section->vma
++			+ htab->splt->output_offset
++			+ h->plt.offset);
++	  unresolved_reloc = FALSE;
++	  if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64)
++	    {
++	      r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64;
++	      is_plt = TRUE;
++	      goto r_sparc_plt32;
++	    }
++	  break;
++
++	case R_SPARC_PC10:
++	case R_SPARC_PC22:
++	case R_SPARC_PC_HH22:
++	case R_SPARC_PC_HM10:
++	case R_SPARC_PC_LM22:
++	  if (h != NULL
++	      && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
++	    break;
++	  /* Fall through.  */
++	case R_SPARC_DISP8:
++	case R_SPARC_DISP16:
++	case R_SPARC_DISP32:
++	case R_SPARC_DISP64:
++	case R_SPARC_WDISP30:
++	case R_SPARC_WDISP22:
++	case R_SPARC_WDISP19:
++	case R_SPARC_WDISP16:
++	case R_SPARC_8:
++	case R_SPARC_16:
++	case R_SPARC_32:
++	case R_SPARC_HI22:
++	case R_SPARC_22:
++	case R_SPARC_13:
++	case R_SPARC_LO10:
++	case R_SPARC_UA16:
++	case R_SPARC_UA32:
++	case R_SPARC_10:
++	case R_SPARC_11:
++	case R_SPARC_64:
++	case R_SPARC_OLO10:
++	case R_SPARC_HH22:
++	case R_SPARC_HM10:
++	case R_SPARC_LM22:
++	case R_SPARC_7:
++	case R_SPARC_5:
++	case R_SPARC_6:
++	case R_SPARC_HIX22:
++	case R_SPARC_LOX10:
++	case R_SPARC_H44:
++	case R_SPARC_M44:
++	case R_SPARC_L44:
++	case R_SPARC_UA64:
++	r_sparc_plt32:
++	  /* r_symndx will be zero only for relocs against symbols
++	     from removed linkonce sections, or sections discarded by
++	     a linker script.  */
++	  if (r_symndx == 0
++	      || (input_section->flags & SEC_ALLOC) == 0)
++	    break;
++
++	  if ((info->shared
++	       && (h == NULL
++		   || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
++		   || h->root.type != bfd_link_hash_undefweak)
++	       && (! howto->pc_relative
++		   || (h != NULL
++		       && h->dynindx != -1
++		       && (! info->symbolic
++			   || !h->def_regular))))
++	      || (!info->shared
++		  && h != NULL
++		  && h->dynindx != -1
++		  && !h->non_got_ref
++		  && ((h->def_dynamic
++		       && !h->def_regular)
++		      || h->root.type == bfd_link_hash_undefweak
++		      || h->root.type == bfd_link_hash_undefined)))
++	    {
++	      Elf_Internal_Rela outrel;
++	      bfd_byte *loc;
++	      bfd_boolean skip, relocate = FALSE;
++
++	      /* When generating a shared object, these relocations
++		 are copied into the output file to be resolved at run
++		 time.  */
++
++	      BFD_ASSERT (sreloc != NULL);
++
++	      skip = FALSE;
++
++	      outrel.r_offset =
++		_bfd_elf_section_offset (output_bfd, info, input_section,
++					 rel->r_offset);
++	      if (outrel.r_offset == (bfd_vma) -1)
++		skip = TRUE;
++	      else if (outrel.r_offset == (bfd_vma) -2)
++		skip = TRUE, relocate = TRUE;
++	      outrel.r_offset += (input_section->output_section->vma
++				  + input_section->output_offset);
++
++	      /* Optimize unaligned reloc usage now that we know where
++		 it finally resides.  */
++	      switch (r_type)
++		{
++		case R_SPARC_16:
++		  if (outrel.r_offset & 1)
++		    r_type = R_SPARC_UA16;
++		  break;
++		case R_SPARC_UA16:
++		  if (!(outrel.r_offset & 1))
++		    r_type = R_SPARC_16;
++		  break;
++		case R_SPARC_32:
++		  if (outrel.r_offset & 3)
++		    r_type = R_SPARC_UA32;
++		  break;
++		case R_SPARC_UA32:
++		  if (!(outrel.r_offset & 3))
++		    r_type = R_SPARC_32;
++		  break;
++		case R_SPARC_64:
++		  if (outrel.r_offset & 7)
++		    r_type = R_SPARC_UA64;
++		  break;
++		case R_SPARC_UA64:
++		  if (!(outrel.r_offset & 7))
++		    r_type = R_SPARC_64;
++		  break;
++	  	case R_SPARC_DISP8:
++		case R_SPARC_DISP16:
++	  	case R_SPARC_DISP32:
++	  	case R_SPARC_DISP64:
++		  /* If the symbol is not dynamic, we should not keep
++		     a dynamic relocation.  But an .rela.* slot has been
++		     allocated for it, output R_SPARC_NONE.
++		     FIXME: Add code tracking needed dynamic relocs as
++		     e.g. i386 has.  */
++		  if (h->dynindx == -1)
++		    skip = TRUE, relocate = TRUE;
++		  break;
++		}
++
++	      if (skip)
++		memset (&outrel, 0, sizeof outrel);
++	      /* h->dynindx may be -1 if the symbol was marked to
++		 become local.  */
++	      else if (h != NULL && ! is_plt
++		       && ((! info->symbolic && h->dynindx != -1)
++			   || !h->def_regular))
++		{
++		  BFD_ASSERT (h->dynindx != -1);
++		  outrel.r_info
++		    = ELF64_R_INFO (h->dynindx,
++				    ELF64_R_TYPE_INFO (
++				      ELF64_R_TYPE_DATA (rel->r_info),
++				      r_type));
++		  outrel.r_addend = rel->r_addend;
++		}
++	      else
++		{
++		  if (r_type == R_SPARC_64)
++		    {
++		      outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
++		      outrel.r_addend = relocation + rel->r_addend;
++		    }
++		  else
++		    {
++		      long indx;
++
++		      if (is_plt)
++			sec = htab->splt;
++
++		      if (bfd_is_abs_section (sec))
++			indx = 0;
++		      else if (sec == NULL || sec->owner == NULL)
++			{
++			  bfd_set_error (bfd_error_bad_value);
++			  return FALSE;
++			}
++		      else
++			{
++			  asection *osec;
++
++			  osec = sec->output_section;
++			  indx = elf_section_data (osec)->dynindx;
++
++			  /* FIXME: we really should be able to link non-pic
++			     shared libraries.  */
++			  if (indx == 0)
++			    {
++			      BFD_FAIL ();
++			      (*_bfd_error_handler)
++				(_("%B: probably compiled without -fPIC?"),
++				 input_bfd);
++			      bfd_set_error (bfd_error_bad_value);
++			      return FALSE;
++			    }
++			}
++
++		      outrel.r_info
++			= ELF64_R_INFO (indx,
++					ELF64_R_TYPE_INFO (
++					  ELF64_R_TYPE_DATA (rel->r_info),
++					  r_type));
++		      outrel.r_addend = relocation + rel->r_addend;
++		    }
++		}
++
++	      loc = sreloc->contents;
++	      loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
++	      bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
++
++	      /* This reloc will be computed at runtime, so there's no
++		 need to do anything now.  */
++	      if (! relocate)
++		continue;
++	    }
++	  break;
++
++	case R_SPARC_TLS_GD_HI22:
++	case R_SPARC_TLS_GD_LO10:
++	case R_SPARC_TLS_IE_HI22:
++	case R_SPARC_TLS_IE_LO10:
++	  r_type = sparc64_elf_tls_transition (info, r_type, h == NULL);
++	  tls_type = GOT_UNKNOWN;
++	  if (h == NULL && local_got_offsets)
++	    tls_type = sparc64_elf_local_got_tls_type (input_bfd) [r_symndx];
++	  else if (h != NULL)
++	    {
++	      tls_type = sparc64_elf_hash_entry(h)->tls_type;
++	      if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
++		switch (ELF64_R_TYPE_ID (rel->r_info))
++		  {
++		  case R_SPARC_TLS_GD_HI22:
++		  case R_SPARC_TLS_IE_HI22:
++		    r_type = R_SPARC_TLS_LE_HIX22;
++		    break;
++		  default:
++		    r_type = R_SPARC_TLS_LE_LOX10;
++		    break;
++		  }
++	    }
++	  if (tls_type == GOT_TLS_IE)
++	    switch (r_type)
++	      {
++	      case R_SPARC_TLS_GD_HI22:
++		r_type = R_SPARC_TLS_IE_HI22;
++		break;
++	      case R_SPARC_TLS_GD_LO10:
++		r_type = R_SPARC_TLS_IE_LO10;
++		break;
++	      }
++
++	  if (r_type == R_SPARC_TLS_LE_HIX22)
++	    {
++	      relocation = tpoff (info, relocation);
++	      break;
++	    }
++	  if (r_type == R_SPARC_TLS_LE_LOX10)
++	    {
++	      /* Change add into xor.  */
++	      relocation = tpoff (info, relocation);
++	      bfd_put_32 (output_bfd, (bfd_get_32 (input_bfd,
++						   contents + rel->r_offset)
++				       | 0x80182000), contents + rel->r_offset);
++	      break;
++	    }
++
++	  if (h != NULL)
++	    {
++	      off = h->got.offset;
++	      h->got.offset |= 1;
++	    }
++	  else
++	    {
++	      BFD_ASSERT (local_got_offsets != NULL);
++	      off = local_got_offsets[r_symndx];
++	      local_got_offsets[r_symndx] |= 1;
++	    }
+ 
+-		     When doing a dynamic link, we create a .rela.got
+-		     relocation entry to initialize the value.  This is
+-		     done in the finish_dynamic_symbol routine.  */
++	r_sparc_tlsldm:
++	  if (htab->sgot == NULL)
++	    abort ();
+ 
+-		  if ((off & 1) != 0)
+-		    off &= ~1;
++	  if ((off & 1) != 0)
++	    off &= ~1;
++	  else
++	    {
++	      Elf_Internal_Rela outrel;
++	      Elf64_External_Rela *loc;
++	      int dr_type, indx;
++
++	      if (htab->srelgot == NULL)
++		abort ();
++
++	      bfd_put_64 (output_bfd, 0, htab->sgot->contents + off);
++	      outrel.r_offset = (htab->sgot->output_section->vma
++				 + htab->sgot->output_offset + off);
++	      indx = h && h->dynindx != -1 ? h->dynindx : 0;
++	      if (r_type == R_SPARC_TLS_IE_HI22
++		  || r_type == R_SPARC_TLS_IE_LO10)
++		dr_type = R_SPARC_TLS_TPOFF64;
++	      else
++		dr_type = R_SPARC_TLS_DTPMOD64;
++	      if (dr_type == R_SPARC_TLS_TPOFF64 && indx == 0)
++		outrel.r_addend = relocation - dtpoff_base (info);
++	      else
++		outrel.r_addend = 0;
++	      outrel.r_info = ELF64_R_INFO (indx, dr_type);
++	      loc = (Elf64_External_Rela *) htab->srelgot->contents;
++	      loc += htab->srelgot->reloc_count++;
++	      bfd_elf64_swap_reloca_out (output_bfd, &outrel,
++					 (bfd_byte *) loc);
++
++	      if (r_type == R_SPARC_TLS_GD_HI22
++		  || r_type == R_SPARC_TLS_GD_LO10)
++		{
++		  if (indx == 0)
++		    {
++	    	      BFD_ASSERT (! unresolved_reloc);
++		      bfd_put_64 (output_bfd,
++				  relocation - dtpoff_base (info),
++				  htab->sgot->contents + off + 8);
++		    }
+ 		  else
+ 		    {
+-		      bfd_put_64 (output_bfd, relocation,
+-				  sgot->contents + off);
+-		      h->got.offset |= 1;
++		      bfd_put_64 (output_bfd, 0,
++				  htab->sgot->contents + off + 8);
++		      outrel.r_info = ELF64_R_INFO (indx,
++						    R_SPARC_TLS_DTPOFF64);
++		      outrel.r_offset += 8;
++		      htab->srelgot->reloc_count++;
++		      loc++;
++		      bfd_elf64_swap_reloca_out (output_bfd, &outrel,
++						 (bfd_byte *) loc);
+ 		    }
+ 		}
+-	      else
+-		unresolved_reloc = FALSE;
++	      else if (dr_type == R_SPARC_TLS_DTPMOD64)
++		{
++		  bfd_put_64 (output_bfd, 0,
++			      htab->sgot->contents + off + 8);
++		}
+ 	    }
+-	  else
++
++	  if (off >= (bfd_vma) -2)
++	    abort ();
++
++	  relocation = htab->sgot->output_offset + off - got_base;
++	  unresolved_reloc = FALSE;
++	  howto = sparc64_elf_howto_table + r_type;
++	  break;
++
++	case R_SPARC_TLS_LDM_HI22:
++	case R_SPARC_TLS_LDM_LO10:
++	  if (! info->shared)
+ 	    {
+-	      BFD_ASSERT (local_got_offsets != NULL);
+-	      off = local_got_offsets[r_symndx];
+-	      BFD_ASSERT (off != (bfd_vma) -1);
++	      bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
++	      continue;
++	    }
++	  off = htab->tls_ldm_got.offset;
++	  htab->tls_ldm_got.offset |= 1;
++	  goto r_sparc_tlsldm;
++
++	case R_SPARC_TLS_LDO_HIX22:
++	case R_SPARC_TLS_LDO_LOX10:
++	  if (info->shared)
++	    {
++	      relocation -= dtpoff_base (info);
++	      break;
++	    }
+ 
+-	      /* The offset must always be a multiple of 8.  We use
+-		 the least significant bit to record whether we have
+-		 already processed this entry.  */
+-	      if ((off & 1) != 0)
+-		off &= ~1;
++	  r_type = (r_type == R_SPARC_TLS_LDO_HIX22
++		    ? R_SPARC_TLS_LE_HIX22 : R_SPARC_TLS_LE_LOX10);
++	  /* Fall through.  */
++
++	case R_SPARC_TLS_LE_HIX22:
++	case R_SPARC_TLS_LE_LOX10:
++	  if (info->shared)
++	    {
++	      Elf_Internal_Rela outrel;
++	      bfd_boolean skip, relocate = FALSE;
++
++	      BFD_ASSERT (sreloc != NULL);
++	      skip = FALSE;
++	      outrel.r_offset =
++		_bfd_elf_section_offset (output_bfd, info, input_section,
++					 rel->r_offset);
++	      if (outrel.r_offset == (bfd_vma) -1)
++		skip = TRUE;
++	      else if (outrel.r_offset == (bfd_vma) -2)
++		skip = TRUE, relocate = TRUE;
++	      outrel.r_offset += (input_section->output_section->vma
++				  + input_section->output_offset);
++	      if (skip)
++		memset (&outrel, 0, sizeof outrel);
+ 	      else
+ 		{
+-		  local_got_offsets[r_symndx] |= 1;
++		  outrel.r_info = ELF64_R_INFO (0, r_type);
++		  outrel.r_addend = relocation - dtpoff_base (info)
++				    + rel->r_addend;
++		}
+ 
+-		  if (info->shared)
+-		    {
+-		      asection *s;
+-		      Elf_Internal_Rela outrel;
+-		      bfd_byte *loc;
++	      bfd_elf64_swap_reloca_out (output_bfd, &outrel,
++					 (bfd_byte *) (((Elf64_External_Rela *)
++							sreloc->contents)
++						       + sreloc->reloc_count));
++	      ++sreloc->reloc_count;
++	      continue;
++	    }
++	  relocation = tpoff (info, relocation);
++	  break;
+ 
+-		      /* The Solaris 2.7 64-bit linker adds the contents
+-			 of the location to the value of the reloc.
+-			 Note this is different behaviour to the
+-			 32-bit linker, which both adds the contents
+-			 and ignores the addend.  So clear the location.  */
+-		      bfd_put_64 (output_bfd, (bfd_vma) 0,
+-				  sgot->contents + off);
++	case R_SPARC_TLS_LDM_CALL:
++	  if (! info->shared)
++	    {
++	      /* mov %g0, %o0 */
++	      bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset);
++	      continue;
++	    }
++	  /* Fall through */
+ 
+-		      /* We need to generate a R_SPARC_RELATIVE reloc
+-			 for the dynamic linker.  */
+-		      s = sparc64_elf_hash_table (info)->srelgot;
+-		      BFD_ASSERT (s != NULL);
++	case R_SPARC_TLS_GD_CALL:
++	  tls_type = GOT_UNKNOWN;
++	  if (h == NULL && local_got_offsets)
++	    tls_type = sparc64_elf_local_got_tls_type (input_bfd) [r_symndx];
++	  else if (h != NULL)
++	    tls_type = sparc64_elf_hash_entry(h)->tls_type;
++	  if (! info->shared
++	      || (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
++	    {
++	      bfd_vma insn;
+ 
+-		      outrel.r_offset = (sgot->output_section->vma
+-					 + sgot->output_offset
+-					 + off);
+-		      outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
+-		      outrel.r_addend = relocation;
+-		      loc = s->contents;
+-		      loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
+-		      bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+-		    }
+-		  else
+-		    bfd_put_64 (output_bfd, relocation, sgot->contents + off);
++	      if (!info->shared && (h == NULL || h->dynindx == -1))
++		{
++		  /* GD -> LE */
++		  bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
++		  continue;
++		}
++
++	      /* GD -> IE */
++	      if (rel + 1 < relend
++		  && ELF64_R_TYPE_ID (rel[1].r_info) == R_SPARC_TLS_GD_ADD
++		  && rel[1].r_offset == rel->r_offset + 4
++		  && ELF64_R_SYM (rel[1].r_info) == r_symndx
++		  && (((insn = bfd_get_32 (input_bfd,
++					   contents + rel[1].r_offset))
++		       >> 25) & 0x1f) == 8)
++		{
++		  /* We have
++		     call __tls_get_addr, %tgd_call(foo)
++		      add %reg1, %reg2, %o0, %tgd_add(foo)
++		     and change it into IE:
++		     ldx [%reg1 + %reg2], %o0, %tie_ldx(foo)
++		     add %g7, %o0, %o0, %tie_add(foo).
++		     add is 0x80000000 | (rd << 25) | (rs1 << 14) | rs2,
++		     ldx is 0xc0580000 | (rd << 25) | (rs1 << 14) | rs2.  */
++		  bfd_put_32 (output_bfd, insn | 0xc0580000,
++			      contents + rel->r_offset);
++		  bfd_put_32 (output_bfd, 0x9001c008,
++			      contents + rel->r_offset + 4);
++		  rel++;
++		  continue;
+ 		}
++
++	      bfd_put_32 (output_bfd, 0x9001c008, contents + rel->r_offset);
++	      continue;
+ 	    }
+-	  relocation = sgot->output_offset + off - got_base;
+-	  goto do_default;
+ 
+-	case R_SPARC_WPLT30:
+-	case R_SPARC_PLT32:
+-	case R_SPARC_HIPLT22:
+-	case R_SPARC_LOPLT10:
+-	case R_SPARC_PCPLT32:
+-	case R_SPARC_PCPLT22:
+-	case R_SPARC_PCPLT10:
+-	case R_SPARC_PLT64:
+-	  /* Relocation is to the entry for this symbol in the
+-             procedure linkage table.  */
++	  h = (struct elf_link_hash_entry *)
++	      bfd_link_hash_lookup (info->hash, "__tls_get_addr", FALSE,
++				    FALSE, TRUE);
+ 	  BFD_ASSERT (h != NULL);
+-
+-	  if (h->plt.offset == (bfd_vma) -1 || splt == NULL)
++	  r_type = R_SPARC_WPLT30;
++	  howto = sparc64_elf_howto_table + r_type;
++	  goto r_sparc_wplt30;
++
++	case R_SPARC_TLS_GD_ADD:
++	  tls_type = GOT_UNKNOWN;
++	  if (h == NULL && local_got_offsets)
++	    tls_type = sparc64_elf_local_got_tls_type (input_bfd) [r_symndx];
++	  else if (h != NULL)
++	    tls_type = sparc64_elf_hash_entry(h)->tls_type;
++	  if (! info->shared || tls_type == GOT_TLS_IE)
+ 	    {
+-	      /* We didn't make a PLT entry for this symbol.  This
+-		 happens when statically linking PIC code, or when
+-		 using -Bsymbolic.  */
+-	      goto do_default;
++	      /* add %reg1, %reg2, %reg3, %tgd_add(foo)
++		 changed into IE:
++		 ldx [%reg1 + %reg2], %reg3, %tie_ldx(foo)
++		 or LE:
++		 add %g7, %reg2, %reg3.  */
++	      bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	      if ((h != NULL && h->dynindx != -1) || info->shared)
++		relocation = insn | 0xc0580000;
++	      else
++		relocation = (insn & ~0x7c000) | 0x1c000;
++	      bfd_put_32 (output_bfd, relocation, contents + rel->r_offset);
+ 	    }
++	  continue;
+ 
+-	  relocation = (splt->output_section->vma
+-			+ splt->output_offset
+-			+ sparc64_elf_plt_entry_offset (h->plt.offset));
+-	  unresolved_reloc = FALSE;
+-	  if (r_type == R_SPARC_WPLT30)
+-	    goto do_wplt30;
+-	  if (r_type == R_SPARC_PLT32 || r_type == R_SPARC_PLT64)
++	case R_SPARC_TLS_LDM_ADD:
++	  if (! info->shared)
++	    bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
++	  continue;
++
++	case R_SPARC_TLS_LDO_ADD:
++	  if (! info->shared)
+ 	    {
+-	      r_type = r_type == R_SPARC_PLT32 ? R_SPARC_32 : R_SPARC_64;
+-	      is_plt = TRUE;
+-	      goto do_dynreloc;
++	      /* Change rs1 into %g7.  */
++	      bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	      insn = (insn & ~0x7c000) | 0x1c000;
++	      bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
+ 	    }
+-	  goto do_default;
++	  continue;
+ 
+-	case R_SPARC_OLO10:
+-	  {
+-	    bfd_vma x;
++	case R_SPARC_TLS_IE_LD:
++	case R_SPARC_TLS_IE_LDX:
++	  if (! info->shared && (h == NULL || h->dynindx == -1))
++	    {
++	      bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	      int rs2 = insn & 0x1f;
++	      int rd = (insn >> 25) & 0x1f;
+ 
+-	    relocation += rel->r_addend;
+-	    relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info);
++	      if (rs2 == rd)
++		relocation = SPARC_NOP;
++	      else
++		relocation = 0x80100000 | (insn & 0x3e00001f);
++	      bfd_put_32 (output_bfd, relocation, contents + rel->r_offset);
++	    }
++	  continue;
+ 
+-	    x = bfd_get_32 (input_bfd, contents + rel->r_offset);
+-	    x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff);
+-	    bfd_put_32 (input_bfd, x, contents + rel->r_offset);
++	case R_SPARC_TLS_IE_ADD:
++	  /* Totally useless relocation.  */
++	  continue;
+ 
+-	    r = bfd_check_overflow (howto->complain_on_overflow,
+-				    howto->bitsize, howto->rightshift,
+-				    bfd_arch_bits_per_address (input_bfd),
+-				    relocation);
+-	  }
++	case R_SPARC_TLS_DTPOFF64:
++	  relocation -= dtpoff_base (info);
+ 	  break;
+ 
+-	case R_SPARC_WDISP16:
+-	  {
++	default:
++	  break;
++	}
++
++      /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
++	 because such sections are not SEC_ALLOC and thus ld.so will
++	 not process them.  */
++      if (unresolved_reloc
++	  && !((input_section->flags & SEC_DEBUGGING) != 0
++	       && h->def_dynamic))
++	(*_bfd_error_handler)
++	  (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
++	   input_bfd,
++	   input_section,
++	   (long) rel->r_offset,
++	   h->root.root.string);
++
++      r = bfd_reloc_continue;
++      if (r_type == R_SPARC_OLO10)
++	{
+ 	    bfd_vma x;
+ 
+ 	    relocation += rel->r_addend;
+-	    /* Adjust for pc-relative-ness.  */
+-	    relocation -= (input_section->output_section->vma
+-			   + input_section->output_offset);
+-	    relocation -= rel->r_offset;
++	    relocation = (relocation & 0x3ff) + ELF64_R_TYPE_DATA (rel->r_info);
+ 
+ 	    x = bfd_get_32 (input_bfd, contents + rel->r_offset);
+-	    x &= ~(bfd_vma) 0x303fff;
+-	    x |= ((((relocation >> 2) & 0xc000) << 6)
+-		  | ((relocation >> 2) & 0x3fff));
++	    x = (x & ~(bfd_vma) 0x1fff) | (relocation & 0x1fff);
+ 	    bfd_put_32 (input_bfd, x, contents + rel->r_offset);
+ 
+ 	    r = bfd_check_overflow (howto->complain_on_overflow,
+ 				    howto->bitsize, howto->rightshift,
+ 				    bfd_arch_bits_per_address (input_bfd),
+ 				    relocation);
+-	  }
+-	  break;
++	}
++      else if (r_type == R_SPARC_WDISP16)
++	{
++	  bfd_vma x;
+ 
+-	case R_SPARC_HIX22:
+-	  {
+-	    bfd_vma x;
++	  relocation += rel->r_addend;
++	  relocation -= (input_section->output_section->vma
++			 + input_section->output_offset);
++	  relocation -= rel->r_offset;
++
++	  x = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	  x |= ((((relocation >> 2) & 0xc000) << 6)
++		| ((relocation >> 2) & 0x3fff));
++	  bfd_put_32 (input_bfd, x, contents + rel->r_offset);
++
++	  r = bfd_check_overflow (howto->complain_on_overflow,
++				  howto->bitsize, howto->rightshift,
++				  bfd_arch_bits_per_address (input_bfd),
++				  relocation);
++	}
++      else if (r_type == R_SPARC_TLS_LDO_HIX22
++	       || r_type == R_SPARC_TLS_LE_HIX22)
++	{
++	  bfd_vma x;
+ 
+-	    relocation += rel->r_addend;
+-	    relocation = relocation ^ MINUS_ONE;
++	  relocation += rel->r_addend;
++	  if (r_type == R_SPARC_TLS_LE_HIX22)
++	    relocation ^= MINUS_ONE;
++
++	  x = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	  x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
++	  bfd_put_32 (input_bfd, x, contents + rel->r_offset);
++	  r = bfd_reloc_ok;
++	}
++      if (r_type == R_SPARC_TLS_LDO_LOX10
++	  || r_type == R_SPARC_TLS_LE_LOX10)
++	{
++	  bfd_vma x;
+ 
+-	    x = bfd_get_32 (input_bfd, contents + rel->r_offset);
+-	    x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
+-	    bfd_put_32 (input_bfd, x, contents + rel->r_offset);
++	  relocation += rel->r_addend;
++	  relocation &= 0x3ff;
++	  if (r_type == R_SPARC_TLS_LE_LOX10)
++	    relocation |= 0x1c00;
++
++	  x = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	  x = (x & ~(bfd_vma) 0x1fff) | relocation;
++	  bfd_put_32 (input_bfd, x, contents + rel->r_offset);
+ 
+-	    r = bfd_check_overflow (howto->complain_on_overflow,
+-				    howto->bitsize, howto->rightshift,
+-				    bfd_arch_bits_per_address (input_bfd),
+-				    relocation);
+-	  }
+-	  break;
++	  r = bfd_reloc_ok;
++	}
++      else if (r_type == R_SPARC_HIX22)
++	{
++	  bfd_vma x;
+ 
+-	case R_SPARC_LOX10:
+-	  {
+-	    bfd_vma x;
++	  relocation += rel->r_addend;
++	  relocation = relocation ^ MINUS_ONE;
+ 
+-	    relocation += rel->r_addend;
+-	    relocation = (relocation & 0x3ff) | 0x1c00;
++	  x = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	  x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
++	  bfd_put_32 (input_bfd, x, contents + rel->r_offset);
++
++	  r = bfd_check_overflow (howto->complain_on_overflow,
++				  howto->bitsize, howto->rightshift,
++				  bfd_arch_bits_per_address (input_bfd),
++				  relocation);
++	}
++      else if (r_type == R_SPARC_LOX10)
++	{
++	  bfd_vma x;
+ 
+-	    x = bfd_get_32 (input_bfd, contents + rel->r_offset);
+-	    x = (x & ~(bfd_vma) 0x1fff) | relocation;
+-	    bfd_put_32 (input_bfd, x, contents + rel->r_offset);
++	  relocation += rel->r_addend;
++	  relocation = (relocation & 0x3ff) | 0x1c00;
+ 
+-	    r = bfd_reloc_ok;
+-	  }
+-	  break;
++	  x = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	  x = (x & ~(bfd_vma) 0x1fff) | relocation;
++	  bfd_put_32 (input_bfd, x, contents + rel->r_offset);
+ 
+-	case R_SPARC_WDISP30:
+-	do_wplt30:
+-	  if (sec_do_relax (input_section)
+-	      && rel->r_offset + 4 < input_section->size)
+-	    {
++	  r = bfd_reloc_ok;
++	}
++      else if ((r_type == R_SPARC_WDISP30 || r_type == R_SPARC_WPLT30)
++	       && sec_do_relax (input_section)
++	       && rel->r_offset + 4 < input_section->size)
++	{
+ #define G0		0
+ #define O7		15
+ #define XCC		(2 << 20)
+@@ -2590,37 +3771,36 @@
+ #define INSN_OR		F3(2, 0x2, 0)
+ #define INSN_NOP	F2(0,4)
+ 
+-	      bfd_vma x, y;
++	  bfd_vma x, y;
+ 
+-	      /* If the instruction is a call with either:
+-		 restore
+-		 arithmetic instruction with rd == %o7
+-		 where rs1 != %o7 and rs2 if it is register != %o7
+-		 then we can optimize if the call destination is near
+-		 by changing the call into a branch always.  */
+-	      x = bfd_get_32 (input_bfd, contents + rel->r_offset);
+-	      y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
+-	      if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2))
++	  /* If the instruction is a call with either:
++	     restore
++	     arithmetic instruction with rd == %o7
++	     where rs1 != %o7 and rs2 if it is register != %o7
++	     then we can optimize if the call destination is near
++	     by changing the call into a branch always.  */
++	  x = bfd_get_32 (input_bfd, contents + rel->r_offset);
++	  y = bfd_get_32 (input_bfd, contents + rel->r_offset + 4);
++	  if ((x & OP(~0)) == OP(1) && (y & OP(~0)) == OP(2))
++	    {
++	      if (((y & OP3(~0)) == OP3(0x3d) /* restore */
++		   || ((y & OP3(0x28)) == 0 /* arithmetic */
++		       && (y & RD(~0)) == RD(O7)))
++		  && (y & RS1(~0)) != RS1(O7)
++		  && ((y & F3I(~0))
++		      || (y & RS2(~0)) != RS2(O7)))
+ 		{
+-		  if (((y & OP3(~0)) == OP3(0x3d) /* restore */
+-		       || ((y & OP3(0x28)) == 0 /* arithmetic */
+-			   && (y & RD(~0)) == RD(O7)))
+-		      && (y & RS1(~0)) != RS1(O7)
+-		      && ((y & F3I(~0))
+-			  || (y & RS2(~0)) != RS2(O7)))
+-		    {
+-		      bfd_vma reloc;
++		  bfd_vma reloc;
+ 
+-		      reloc = relocation + rel->r_addend - rel->r_offset;
+-		      reloc -= (input_section->output_section->vma
+-				+ input_section->output_offset);
+-		      if (reloc & 3)
+-			goto do_default;
+-
+-		      /* Ensure the branch fits into simm22.  */
+-		      if ((reloc & ~(bfd_vma)0x7fffff)
+-			   && ((reloc | 0x7fffff) != MINUS_ONE))
+-			goto do_default;
++		  reloc = relocation + rel->r_addend - rel->r_offset;
++		  reloc -= (input_section->output_section->vma
++			    + input_section->output_offset);
++
++		  /* Ensure the branch fits into simm22.  */
++		  if ((reloc & 3) == 0
++		      && ((reloc & ~(bfd_vma)0x7fffff) == 0
++			  || ((reloc | 0x7fffff) == ~(bfd_vma)0)))
++		    {
+ 		      reloc >>= 2;
+ 
+ 		      /* Check whether it fits into simm19.  */
+@@ -2660,91 +3840,48 @@
+ 			  bfd_put_32 (input_bfd, (bfd_vma) INSN_NOP,
+ 				      contents + rel->r_offset + 4);
+ 			}
+-		      break;
++
+ 		    }
+ 		}
+ 	    }
+-	  /* Fall through.  */
+-
+-	default:
+-	do_default:
+-	  r = _bfd_final_link_relocate (howto, input_bfd, input_section,
+-					contents, rel->r_offset,
+-					relocation, rel->r_addend);
+-	  break;
+ 	}
+ 
+-      /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
+-	 because such sections are not SEC_ALLOC and thus ld.so will
+-	 not process them.  */
+-      if (unresolved_reloc
+-	  && !((input_section->flags & SEC_DEBUGGING) != 0
+-	       && h->def_dynamic))
+-	(*_bfd_error_handler)
+-	  (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"),
+-	   input_bfd, input_section,
+-	   (long) rel->r_offset,
+-	   h->root.root.string);
++      if (r == bfd_reloc_continue)
++	r = _bfd_final_link_relocate (howto, input_bfd, input_section,
++				      contents, rel->r_offset,
++				      relocation, rel->r_addend);
+ 
+-      switch (r)
++      if (r != bfd_reloc_ok)
+ 	{
+-	case bfd_reloc_ok:
+-	  break;
+-
+-	default:
+-	case bfd_reloc_outofrange:
+-	  abort ();
+-
+-	case bfd_reloc_overflow:
+-	  {
+-	    const char *name;
+-
+-	    /* The Solaris native linker silently disregards
+-	       overflows.  We don't, but this breaks stabs debugging
+-	       info, whose relocations are only 32-bits wide.  Ignore
+-	       overflows in this case and also for discarded entries.  */
+-	    if ((r_type == R_SPARC_32 || r_type == R_SPARC_DISP32)
+-		&& (((input_section->flags & SEC_DEBUGGING) != 0
+-		     && strcmp (bfd_section_name (input_bfd, input_section),
+-			       ".stab") == 0)
+-		    || _bfd_elf_section_offset (output_bfd, info,
+-						input_section,
+-						rel->r_offset) == (bfd_vma)-1))
+-	      break;
+-
+-	    if (h != NULL)
++	  switch (r)
++	    {
++	    default:
++	    case bfd_reloc_outofrange:
++	      abort ();
++	    case bfd_reloc_overflow:
+ 	      {
+-		if (h->root.type == bfd_link_hash_undefweak
+-		    && howto->pc_relative)
++		const char *name;
++
++		if (h != NULL)
++		  name = NULL;
++		else
+ 		  {
+-		    /* Assume this is a call protected by other code that
+-		       detect the symbol is undefined.  If this is the case,
+-		       we can safely ignore the overflow.  If not, the
+-		       program is hosed anyway, and a little warning isn't
+-		       going to help.  */
+-		    break;
++		    name = bfd_elf_string_from_elf_section (input_bfd,
++							    symtab_hdr->sh_link,
++							    sym->st_name);
++		    if (name == NULL)
++		      return FALSE;
++		    if (*name == '\0')
++		      name = bfd_section_name (input_bfd, sec);
+ 		  }
+-
+-	        name = NULL;
+-	      }
+-	    else
+-	      {
+-		name = (bfd_elf_string_from_elf_section
+-			(input_bfd,
+-			 symtab_hdr->sh_link,
+-			 sym->st_name));
+-		if (name == NULL)
++		if (! ((*info->callbacks->reloc_overflow)
++		       (info, (h ? &h->root : NULL), name, howto->name,
++			(bfd_vma) 0, input_bfd, input_section,
++			rel->r_offset)))
+ 		  return FALSE;
+-		if (*name == '\0')
+-		  name = bfd_section_name (input_bfd, sec);
+ 	      }
+-	    if (! ((*info->callbacks->reloc_overflow)
+-		   (info, (h ? &h->root : NULL), name, howto->name,
+-		    (bfd_vma) 0, input_bfd, input_section,
+-		    rel->r_offset)))
+-	      return FALSE;
+-	  }
+-	break;
++	      break;
++	    }
+ 	}
+     }
+ 
+@@ -2762,8 +3899,10 @@
+      Elf_Internal_Sym *sym;
+ {
+   bfd *dynobj;
++  struct sparc64_elf_link_hash_table *htab;
+ 
+-  dynobj = elf_hash_table (info)->dynobj;
++  htab = sparc64_elf_hash_table (info);
++  dynobj = htab->elf.dynobj;
+ 
+   if (h->plt.offset != (bfd_vma) -1)
+     {
+@@ -2771,30 +3910,33 @@
+       asection *srela;
+       Elf_Internal_Rela rela;
+       bfd_byte *loc;
++      bfd_vma r_offset;
++      int rela_index;
+ 
+       /* This symbol has an entry in the PLT.  Set it up.  */
+ 
+       BFD_ASSERT (h->dynindx != -1);
+ 
+-      splt = bfd_get_section_by_name (dynobj, ".plt");
+-      srela = bfd_get_section_by_name (dynobj, ".rela.plt");
++      splt = htab->splt;
++      srela = htab->srelplt;
+       BFD_ASSERT (splt != NULL && srela != NULL);
+ 
+-      /* Fill in the entry in the .rela.plt section.  */
++      /* Fill in the entry in the procedure linkage table.  */
++      rela_index = sparc64_plt_entry_build (output_bfd, splt, h->plt.offset,
++					    splt->size, &r_offset);
+ 
+-      if (h->plt.offset < LARGE_PLT_THRESHOLD)
++      /* Fill in the entry in the .rela.plt section.  */
++      rela.r_offset = r_offset
++	+ (splt->output_section->vma + splt->output_offset);
++      if (h->plt.offset < (LARGE_PLT_THRESHOLD * PLT_ENTRY_SIZE))
+ 	{
+-	  rela.r_offset = sparc64_elf_plt_entry_offset (h->plt.offset);
+ 	  rela.r_addend = 0;
+ 	}
+       else
+ 	{
+-	  bfd_vma max = splt->size / PLT_ENTRY_SIZE;
+-	  rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max);
+-	  rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4)
++	  rela.r_addend = -(h->plt.offset + 4)
+ 			  -(splt->output_section->vma + splt->output_offset);
+ 	}
+-      rela.r_offset += (splt->output_section->vma + splt->output_offset);
+       rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
+ 
+       /* Adjust for the first 4 reserved elements in the .plt section
+@@ -2803,7 +3945,7 @@
+ 	 thus .plt[4] has corresponding .rela.plt[0] and so on.  */
+ 
+       loc = srela->contents;
+-      loc += (h->plt.offset - 4) * sizeof (Elf64_External_Rela);
++      loc += rela_index * sizeof (Elf64_External_Rela);
+       bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
+ 
+       if (!h->def_regular)
+@@ -2820,7 +3962,9 @@
+ 	}
+     }
+ 
+-  if (h->got.offset != (bfd_vma) -1)
++  if (h->got.offset != (bfd_vma) -1
++      && sparc64_elf_hash_entry(h)->tls_type != GOT_TLS_GD
++      && sparc64_elf_hash_entry(h)->tls_type != GOT_TLS_IE)
+     {
+       asection *sgot;
+       asection *srela;
+@@ -2829,8 +3973,8 @@
+ 
+       /* This symbol has an entry in the GOT.  Set it up.  */
+ 
+-      sgot = sparc64_elf_hash_table (info)->sgot;
+-      srela = sparc64_elf_hash_table (info)->srelgot;
++      sgot = htab->sgot;
++      srela = htab->srelgot;
+       BFD_ASSERT (sgot != NULL && srela != NULL);
+ 
+       rela.r_offset = (sgot->output_section->vma
+@@ -2906,9 +4050,10 @@
+   bfd *dynobj;
+   int stt_regidx = -1;
+   asection *sdyn;
+-  asection *sgot;
++  struct sparc64_elf_link_hash_table *htab;
+ 
+-  dynobj = elf_hash_table (info)->dynobj;
++  htab = sparc64_elf_hash_table (info);
++  dynobj = htab->elf.dynobj;
+ 
+   sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ 
+@@ -2946,7 +4091,7 @@
+ 	      dyn.d_un.d_val = stt_regidx++;
+ 	      bfd_elf64_swap_dyn_out (output_bfd, &dyn, dyncon);
+ 	      /* fallthrough */
+-	    default:	      name = NULL; size = FALSE; break;
++	    default:	  name = NULL; size = FALSE; break;
+ 	    }
+ 
+ 	  if (name != NULL)
+@@ -2969,8 +4114,7 @@
+ 
+       /* Initialize the contents of the .plt section.  */
+       if (splt->size > 0)
+-	sparc64_elf_build_plt (output_bfd, splt->contents,
+-			       (int) (splt->size / PLT_ENTRY_SIZE));
++	memset (splt->contents, 0, 4 * PLT_ENTRY_SIZE);
+ 
+       elf_section_data (splt->output_section)->this_hdr.sh_entsize =
+ 	PLT_ENTRY_SIZE;
+@@ -2978,39 +4122,22 @@
+ 
+   /* Set the first entry in the global offset table to the address of
+      the dynamic section.  */
+-  sgot = sparc64_elf_hash_table (info)->sgot;
+-  BFD_ASSERT (sgot != NULL);
+-  if (sgot->size > 0)
++  if (htab->sgot && htab->sgot->size > 0)
+     {
+       if (sdyn == NULL)
+-	bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents);
++	bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgot->contents);
+       else
+ 	bfd_put_64 (output_bfd,
+ 		    sdyn->output_section->vma + sdyn->output_offset,
+-		    sgot->contents);
++		    htab->sgot->contents);
+     }
+ 
+-  elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 8;
++  if (htab->sgot)
++    elf_section_data (htab->sgot->output_section)->this_hdr.sh_entsize = 8;
+ 
+   return TRUE;
+ }
+ 
+-static enum elf_reloc_type_class
+-sparc64_elf_reloc_type_class (rela)
+-     const Elf_Internal_Rela *rela;
+-{
+-  switch ((int) ELF64_R_TYPE (rela->r_info))
+-    {
+-    case R_SPARC_RELATIVE:
+-      return reloc_class_relative;
+-    case R_SPARC_JMP_SLOT:
+-      return reloc_class_plt;
+-    case R_SPARC_COPY:
+-      return reloc_class_copy;
+-    default:
+-      return reloc_class_normal;
+-    }
+-}
+ 
+
+ /* Functions for dealing with the e_flags field.  */
+ 
+@@ -3166,6 +4293,23 @@
+   return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, mach);
+ }
+ 
++static enum elf_reloc_type_class
++sparc64_elf_reloc_type_class (rela)
++     const Elf_Internal_Rela *rela;
++{
++  switch ((int) ELF64_R_TYPE (rela->r_info))
++    {
++    case R_SPARC_RELATIVE:
++      return reloc_class_relative;
++    case R_SPARC_JMP_SLOT:
++      return reloc_class_plt;
++    case R_SPARC_COPY:
++      return reloc_class_copy;
++    default:
++      return reloc_class_normal;
++    }
++}
++
+ /* Return address for Ith PLT stub in section PLT, for relocation REL
+    or (bfd_vma) -1 if it should not be included.  */
+ 
+@@ -3236,10 +4380,12 @@
+ #define ELF_MACHINE_ALT1 EM_OLD_SPARCV9
+ 
+ #define bfd_elf64_bfd_link_hash_table_create \
+-  sparc64_elf_bfd_link_hash_table_create
++  sparc64_elf_link_hash_table_create
+ 
+ #define elf_info_to_howto \
+   sparc64_elf_info_to_howto
++#define elf_backend_copy_indirect_symbol \
++  sparc64_elf_copy_indirect_symbol
+ #define bfd_elf64_get_reloc_upper_bound \
+   sparc64_elf_get_reloc_upper_bound
+ #define bfd_elf64_get_dynamic_reloc_upper_bound \
+@@ -3290,19 +4436,26 @@
+ 
+ #define elf_backend_size_info \
+   sparc64_elf_size_info
++#define bfd_elf64_mkobject \
++  sparc64_elf_mkobject
+ #define elf_backend_object_p \
+   sparc64_elf_object_p
++#define elf_backend_gc_mark_hook \
++  sparc64_elf_gc_mark_hook
++#define elf_backend_gc_sweep_hook \
++  sparc64_elf_gc_sweep_hook
+ #define elf_backend_reloc_type_class \
+   sparc64_elf_reloc_type_class
+ 
++#define elf_backend_can_gc_sections 1
++#define elf_backend_can_refcount 1
+ #define elf_backend_want_got_plt 0
+ #define elf_backend_plt_readonly 0
+ #define elf_backend_want_plt_sym 1
++#define elf_backend_got_header_size 8
+ #define elf_backend_rela_normal 1
+ 
+ /* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table.  */
+ #define elf_backend_plt_alignment 8
+ 
+-#define elf_backend_got_header_size 8
+-
+ #include "elf64-target.h"
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-selective/sel-dump.exp binutils-2.16.1/ld/testsuite/ld-selective/sel-dump.exp
+--- binutils-2.16.1.orig/ld/testsuite/ld-selective/sel-dump.exp	2005-03-03 11:52:10.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-selective/sel-dump.exp	2005-09-14 22:52:05.000000000 +0000
+@@ -26,6 +26,6 @@
+     # We need to strip the ".d", but can leave the dirname.
+     verbose [file rootname [lindex $test_list $i]]
+     setup_xfail "alpha*-*" "arc*-*" "d30v*-*" "dlx*-*" "i370*-*" "i860*-*"
+-    setup_xfail "i960*-*" "ia64*-*" "mn10200-*" "or32-*" "pj-*" "sparc64*-*"
++    setup_xfail "i960*-*" "ia64*-*" "mn10200-*" "or32-*" "pj-*"
+     run_dump_test [file rootname [lindex $test_list $i]]
+ }
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-selective/selective.exp binutils-2.16.1/ld/testsuite/ld-selective/selective.exp
+--- binutils-2.16.1.orig/ld/testsuite/ld-selective/selective.exp	2005-05-28 21:52:55.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-selective/selective.exp	2005-09-14 23:04:30.000000000 +0000
+@@ -85,7 +85,7 @@
+ 	setup_xfail $xfail_target
+     }
+     setup_xfail "arc*-*" "d30v*-*" "dlx*-*" "i370*-*" "i860*-*"
+-    setup_xfail "i960*-*" "mn10200-*" "or32-*" "pj-*" "sparc64*-*"
++    setup_xfail "i960*-*" "mn10200-*" "or32-*" "pj-*"
+ 
+     # It's either C or C++ at the moment.
+     if { $testtype == "C++" } {
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-selective/selective.exp.rej binutils-2.16.1/ld/testsuite/ld-selective/selective.exp.rej
+--- binutils-2.16.1.orig/ld/testsuite/ld-selective/selective.exp.rej	1970-01-01 00:00:00.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-selective/selective.exp.rej	2005-09-14 22:52:05.000000000 +0000
+@@ -0,0 +1,17 @@
++***************
++*** 85,91 ****
++  	setup_xfail $xfail_target
++      }
++      setup_xfail "alpha*-*" "arc*-*" "d30v*-*" "dlx*-*" "i370*-*" "i860*-*"
++-     setup_xfail "i960*-*" "mn10200-*" "or32-*" "pj-*" "sparc64*-*"
++  
++      # It's either C or C++ at the moment.
++      if { $testtype == "C++" } {
++--- 85,91 ----
++  	setup_xfail $xfail_target
++      }
++      setup_xfail "alpha*-*" "arc*-*" "d30v*-*" "dlx*-*" "i370*-*" "i860*-*"
+++     setup_xfail "i960*-*" "mn10200-*" "or32-*" "pj-*"
++  
++      # It's either C or C++ at the moment.
++      if { $testtype == "C++" } {
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/sparc.exp binutils-2.16.1/ld/testsuite/ld-sparc/sparc.exp
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/sparc.exp	2005-03-03 11:52:12.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/sparc.exp	2005-09-14 22:52:05.000000000 +0000
+@@ -37,50 +37,50 @@
+ # readelf: Apply readelf options on result.  Compare with regex (last arg).
+ 
+ set sparctests {
+-    {"TLS -fpic -shared transitions" "-shared -melf32_sparc"
++    {"32-bit: TLS -fpic -shared transitions" "-shared -melf32_sparc"
+      "--32 -K PIC" {tlssunpic32.s tlspic.s}
+      {{readelf -WSsrl tlssunpic32.rd} {objdump -drj.text tlssunpic32.dd}
+       {objdump -sj.got tlssunpic32.sd} {objdump -sj.tdata tlssunpic32.td}}
+       "libtlssunpic32.so"}
+-    {"Helper shared library" "-shared -melf32_sparc"
++    {"32-bit: Helper shared library" "-shared -melf32_sparc"
+      "--32 -K PIC" {tlslib.s} {} "libtlslib32.so"}
+-    {"Another helper shared library" "-shared -melf32_sparc"
++    {"32-bit: Another helper shared library" "-shared -melf32_sparc"
+      "--32 -K PIC" {tlssunbinpic32.s} {} "libtlssunbinpic32.so"}
+-    {"TLS -fpic and -fno-pic exec transitions"
++    {"32-bit: TLS -fpic and -fno-pic exec transitions"
+      "-melf32_sparc tmpdir/libtlslib32.so tmpdir/tlssunbinpic32.o"
+      "--32" {tlssunbin32.s}
+      {{readelf -WSsrl tlssunbin32.rd} {objdump -drj.text tlssunbin32.dd}
+       {objdump -sj.got tlssunbin32.sd} {objdump -sj.tdata tlssunbin32.td}}
+       "tlssunbin32"}
+-    {"TLS -fno-pic -shared" "-shared -melf32_sparc"
++    {"32-bit: TLS -fno-pic -shared" "-shared -melf32_sparc"
+      "--32" {tlssunnopic32.s tlsnopic.s}
+      {{readelf -WSsrl tlssunnopic32.rd} {objdump -drj.text tlssunnopic32.dd}
+       {objdump -sj.got tlssunnopic32.sd}} "libtlssunnopic32.so"}
+-    {"TLS in debug sections" "-melf32_sparc"
++    {"32-bit: TLS in debug sections" "-melf32_sparc"
+      "--32" {tlsg32.s}
+      {{objdump -sj.debug_foobar tlsg32.sd}} "tlsg32"}
+ }
+ set sparc64tests {
+-    {"TLS -fpic -shared transitions" "-shared -melf64_sparc"
++    {"64-bit: TLS -fpic -shared transitions" "-shared -melf64_sparc"
+      "--64 -Av9 -K PIC" {tlssunpic64.s tlspic.s}
+      {{readelf -WSsrl tlssunpic64.rd} {objdump -drj.text tlssunpic64.dd}
+       {objdump -sj.got tlssunpic64.sd} {objdump -sj.tdata tlssunpic64.td}}
+       "libtlssunpic64.so"}
+-    {"Helper shared library" "-shared -melf64_sparc"
++    {"64-bit: Helper shared library" "-shared -melf64_sparc"
+      "--64 -Av9 -K PIC" {tlslib.s} {} "libtlslib64.so"}
+-    {"Another helper shared library" "-shared -melf64_sparc"
++    {"64-bit: Another helper shared library" "-shared -melf64_sparc"
+      "--64 -Av9 -K PIC" {tlssunbinpic64.s} {} "libtlssunbinpic64.so"}
+-    {"TLS -fpic and -fno-pic exec transitions"
++    {"64-bit: TLS -fpic and -fno-pic exec transitions"
+      "-melf64_sparc tmpdir/libtlslib64.so tmpdir/tlssunbinpic64.o"
+      "--64 -Av9" {tlssunbin64.s}
+      {{readelf -WSsrl tlssunbin64.rd} {objdump -drj.text tlssunbin64.dd}
+       {objdump -sj.got tlssunbin64.sd} {objdump -sj.tdata tlssunbin64.td}}
+       "tlssunbin64"}
+-    {"TLS -fno-pic -shared" "-shared -melf64_sparc"
++    {"64-bit: TLS -fno-pic -shared" "-shared -melf64_sparc"
+      "--64 -Av9" {tlssunnopic64.s tlsnopic.s}
+      {{readelf -WSsrl tlssunnopic64.rd} {objdump -drj.text tlssunnopic64.dd}
+       {objdump -sj.got tlssunnopic64.sd}} "libtlssunnopic64.so"}
+-    {"TLS in debug sections" "-melf64_sparc"
++    {"64-bit: TLS in debug sections" "-melf64_sparc"
+      "--64 -Av9" {tlsg64.s}
+      {{objdump -sj.debug_foobar tlsg64.sd}} "tlsg64"}
+ }
+@@ -88,4 +88,6 @@
+ if { ![istarget "sparc64-*-elf*"] } {
+     run_ld_link_tests $sparctests
+ }
+-# run_ld_link_tests $sparc64tests
++if { ![istarget "sparc-*-elf*"] } {
++    run_ld_link_tests $sparc64tests
++}
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlsg64.sd binutils-2.16.1/ld/testsuite/ld-sparc/tlsg64.sd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlsg64.sd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlsg64.sd	2005-09-14 22:52:05.000000000 +0000
+@@ -7,5 +7,4 @@
+ .*: +file format elf64-sparc
+ 
+ Contents of section .debug_foobar:
+-# FIXME
+-#pass
++ 0+ 0+ 0+18  .*
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.dd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.dd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.dd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.dd	2005-09-14 22:52:05.000000000 +0000
+@@ -7,5 +7,271 @@
+ .*: +file format elf64-sparc
+ 
+ Disassembly of section .text:
+-# FIXME
+-#pass
++
++0+101000 <fn2-0x8>:
++ +101000:	81 c3 e0 08 	retl *
++ +101004:	ae 03 c0 17 	add  %o7, %l7, %l7
++
++0+101008 <fn2>:
++ +101008:	9d e3 bf 60 	save  %sp, -160, %sp
++ +10100c:	2f 00 04 04 	sethi  %hi\(0x101000\), %l7
++ +101010:	7f ff ff fc 	call  101000 <.*>
++ +101014:	ae 05 e2 f8 	add  %l7, 0x2f8, %l7	! 1012f8 <.*>
++ +101018:	01 00 00 00 	nop *
++ +10101c:	01 00 00 00 	nop *
++ +101020:	01 00 00 00 	nop *
++ +101024:	01 00 00 00 	nop *
++ +101028:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +10102c:	01 00 00 00 	nop *
++ +101030:	a4 04 60 20 	add  %l1, 0x20, %l2
++ +101034:	01 00 00 00 	nop *
++ +101038:	d0 5d c0 12 	ldx  \[ %l7 \+ %l2 \], %o0
++ +10103c:	01 00 00 00 	nop *
++ +101040:	90 01 c0 08 	add  %g7, %o0, %o0
++ +101044:	01 00 00 00 	nop *
++ +101048:	01 00 00 00 	nop *
++ +10104c:	01 00 00 00 	nop *
++ +101050:	01 00 00 00 	nop *
++ +101054:	01 00 00 00 	nop *
++ +101058:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +10105c:	92 02 20 10 	add  %o0, 0x10, %o1	! 10 <.*>
++ +101060:	d0 5d c0 09 	ldx  \[ %l7 \+ %o1 \], %o0
++ +101064:	90 01 c0 08 	add  %g7, %o0, %o0
++ +101068:	01 00 00 00 	nop *
++ +10106c:	01 00 00 00 	nop *
++ +101070:	01 00 00 00 	nop *
++ +101074:	01 00 00 00 	nop *
++ +101078:	01 00 00 00 	nop *
++ +10107c:	21 00 00 00 	sethi  %hi\(0\), %l0
++ +101080:	aa 1c 3f 60 	xor  %l0, -160, %l5
++ +101084:	90 01 c0 15 	add  %g7, %l5, %o0
++ +101088:	01 00 00 00 	nop *
++ +10108c:	01 00 00 00 	nop *
++ +101090:	01 00 00 00 	nop *
++ +101094:	01 00 00 00 	nop *
++ +101098:	01 00 00 00 	nop *
++ +10109c:	01 00 00 00 	nop *
++ +1010a0:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +1010a4:	92 1a 3f 80 	xor  %o0, -128, %o1
++ +1010a8:	90 01 c0 09 	add  %g7, %o1, %o0
++ +1010ac:	01 00 00 00 	nop *
++ +1010b0:	01 00 00 00 	nop *
++ +1010b4:	01 00 00 00 	nop *
++ +1010b8:	01 00 00 00 	nop *
++ +1010bc:	01 00 00 00 	nop *
++ +1010c0:	01 00 00 00 	nop *
++ +1010c4:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +1010c8:	92 1a 3f a0 	xor  %o0, -96, %o1
++ +1010cc:	90 01 c0 09 	add  %g7, %o1, %o0
++ +1010d0:	01 00 00 00 	nop *
++ +1010d4:	01 00 00 00 	nop *
++ +1010d8:	01 00 00 00 	nop *
++ +1010dc:	01 00 00 00 	nop *
++ +1010e0:	01 00 00 00 	nop *
++ +1010e4:	01 00 00 00 	nop *
++ +1010e8:	01 00 00 00 	nop *
++ +1010ec:	01 00 00 00 	nop *
++ +1010f0:	01 00 00 00 	nop *
++ +1010f4:	01 00 00 00 	nop *
++ +1010f8:	01 00 00 00 	nop *
++ +1010fc:	01 00 00 00 	nop *
++ +101100:	90 10 00 00 	mov  %g0, %o0
++ +101104:	01 00 00 00 	nop *
++ +101108:	27 00 00 00 	sethi  %hi\(0\), %l3
++ +10110c:	01 00 00 00 	nop *
++ +101110:	a8 1c ff 80 	xor  %l3, -128, %l4
++ +101114:	01 00 00 00 	nop *
++ +101118:	aa 01 c0 14 	add  %g7, %l4, %l5
++ +10111c:	01 00 00 00 	nop *
++ +101120:	25 00 00 00 	sethi  %hi\(0\), %l2
++ +101124:	01 00 00 00 	nop *
++ +101128:	a6 1c bf 86 	xor  %l2, -122, %l3
++ +10112c:	01 00 00 00 	nop *
++ +101130:	ec 11 c0 13 	lduh  \[ %g7 \+ %l3 \], %l6
++ +101134:	01 00 00 00 	nop *
++ +101138:	01 00 00 00 	nop *
++ +10113c:	01 00 00 00 	nop *
++ +101140:	01 00 00 00 	nop *
++ +101144:	01 00 00 00 	nop *
++ +101148:	27 00 00 00 	sethi  %hi\(0\), %l3
++ +10114c:	01 00 00 00 	nop *
++ +101150:	25 00 00 00 	sethi  %hi\(0\), %l2
++ +101154:	01 00 00 00 	nop *
++ +101158:	a8 1c ff a0 	xor  %l3, -96, %l4
++ +10115c:	90 10 00 00 	mov  %g0, %o0
++ +101160:	a6 1c bf a5 	xor  %l2, -91, %l3
++ +101164:	aa 01 c0 14 	add  %g7, %l4, %l5
++ +101168:	ec 09 c0 13 	ldub  \[ %g7 \+ %l3 \], %l6
++ +10116c:	01 00 00 00 	nop *
++ +101170:	01 00 00 00 	nop *
++ +101174:	01 00 00 00 	nop *
++ +101178:	01 00 00 00 	nop *
++ +10117c:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +101180:	01 00 00 00 	nop *
++ +101184:	a4 04 60 10 	add  %l1, 0x10, %l2
++ +101188:	01 00 00 00 	nop *
++ +10118c:	e4 5d c0 12 	ldx  \[ %l7 \+ %l2 \], %l2
++ +101190:	01 00 00 00 	nop *
++ +101194:	a4 01 c0 12 	add  %g7, %l2, %l2
++ +101198:	01 00 00 00 	nop *
++ +10119c:	01 00 00 00 	nop *
++ +1011a0:	01 00 00 00 	nop *
++ +1011a4:	01 00 00 00 	nop *
++ +1011a8:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +1011ac:	96 1a ff 60 	xor  %o3, -160, %o3
++ +1011b0:	94 10 00 0b 	mov  %o3, %o2
++ +1011b4:	98 01 c0 0a 	add  %g7, %o2, %o4
++ +1011b8:	01 00 00 00 	nop *
++ +1011bc:	01 00 00 00 	nop *
++ +1011c0:	01 00 00 00 	nop *
++ +1011c4:	01 00 00 00 	nop *
++ +1011c8:	29 00 00 00 	sethi  %hi\(0\), %l4
++ +1011cc:	a2 1d 3f 80 	xor  %l4, -128, %l1
++ +1011d0:	a6 10 00 11 	mov  %l1, %l3
++ +1011d4:	a6 01 c0 13 	add  %g7, %l3, %l3
++ +1011d8:	01 00 00 00 	nop *
++ +1011dc:	01 00 00 00 	nop *
++ +1011e0:	01 00 00 00 	nop *
++ +1011e4:	01 00 00 00 	nop *
++ +1011e8:	13 00 00 00 	sethi  %hi\(0\), %o1
++ +1011ec:	96 1a 7f a0 	xor  %o1, -96, %o3
++ +1011f0:	90 10 00 0b 	mov  %o3, %o0
++ +1011f4:	96 01 c0 08 	add  %g7, %o0, %o3
++ +1011f8:	01 00 00 00 	nop *
++ +1011fc:	01 00 00 00 	nop *
++ +101200:	01 00 00 00 	nop *
++ +101204:	01 00 00 00 	nop *
++ +101208:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +10120c:	96 02 e0 08 	add  %o3, 8, %o3	! 8 <.*>
++ +101210:	d4 5d c0 0b 	ldx  \[ %l7 \+ %o3 \], %o2
++ +101214:	d8 59 c0 0a 	ldx  \[ %g7 \+ %o2 \], %o4
++ +101218:	01 00 00 00 	nop *
++ +10121c:	01 00 00 00 	nop *
++ +101220:	01 00 00 00 	nop *
++ +101224:	01 00 00 00 	nop *
++ +101228:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +10122c:	96 1a ff 90 	xor  %o3, -112, %o3
++ +101230:	94 10 00 0b 	mov  %o3, %o2
++ +101234:	d8 29 c0 0a 	stb  %o4, \[ %g7 \+ %o2 \]
++ +101238:	01 00 00 00 	nop *
++ +10123c:	01 00 00 00 	nop *
++ +101240:	01 00 00 00 	nop *
++ +101244:	01 00 00 00 	nop *
++ +101248:	1b 00 00 00 	sethi  %hi\(0\), %o5
++ +10124c:	96 1b 7f b0 	xor  %o5, -80, %o3
++ +101250:	94 10 00 0b 	mov  %o3, %o2
++ +101254:	d8 49 c0 0a 	ldsb  \[ %g7 \+ %o2 \], %o4
++ +101258:	01 00 00 00 	nop *
++ +10125c:	01 00 00 00 	nop *
++ +101260:	01 00 00 00 	nop *
++ +101264:	01 00 00 00 	nop *
++ +101268:	81 cf e0 08 	rett  %i7 \+ 8
++ +10126c:	01 00 00 00 	nop *
++#...
++
++0+102000 <_start>:
++ +102000:	9d e3 bf 60 	save  %sp, -160, %sp
++ +102004:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +102008:	25 00 08 08 	sethi  %hi\(0x202000\), %l2
++ +10200c:	a2 14 60 00 	mov  %l1, %l1
++ +102010:	a4 14 a3 08 	or  %l2, 0x308, %l2
++ +102014:	a3 2c 70 20 	sllx  %l1, 0x20, %l1
++ +102018:	a8 04 40 12 	add  %l1, %l2, %l4
++ +10201c:	01 00 00 00 	nop *
++ +102020:	01 00 00 00 	nop *
++ +102024:	01 00 00 00 	nop *
++ +102028:	01 00 00 00 	nop *
++ +10202c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +102030:	96 02 e0 18 	add  %o3, 0x18, %o3	! 18 <.*>
++ +102034:	d4 5d 00 0b 	ldx  \[ %l4 \+ %o3 \], %o2
++ +102038:	98 01 c0 0a 	add  %g7, %o2, %o4
++ +10203c:	01 00 00 00 	nop *
++ +102040:	01 00 00 00 	nop *
++ +102044:	01 00 00 00 	nop *
++ +102048:	01 00 00 00 	nop *
++ +10204c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +102050:	9a 1a ff d4 	xor  %o3, -44, %o5
++ +102054:	94 10 00 0d 	mov  %o5, %o2
++ +102058:	98 01 c0 0a 	add  %g7, %o2, %o4
++ +10205c:	01 00 00 00 	nop *
++ +102060:	01 00 00 00 	nop *
++ +102064:	01 00 00 00 	nop *
++ +102068:	01 00 00 00 	nop *
++ +10206c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +102070:	9a 1a ff f4 	xor  %o3, -12, %o5
++ +102074:	a4 10 00 0d 	mov  %o5, %l2
++ +102078:	a4 01 c0 12 	add  %g7, %l2, %l2
++ +10207c:	01 00 00 00 	nop *
++ +102080:	01 00 00 00 	nop *
++ +102084:	01 00 00 00 	nop *
++ +102088:	01 00 00 00 	nop *
++ +10208c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +102090:	9a 1a ff fc 	xor  %o3, -4, %o5
++ +102094:	a4 10 00 0d 	mov  %o5, %l2
++ +102098:	e4 41 c0 12 	ldsw  \[ %g7 \+ %l2 \], %l2
++ +10209c:	01 00 00 00 	nop *
++ +1020a0:	01 00 00 00 	nop *
++ +1020a4:	01 00 00 00 	nop *
++ +1020a8:	01 00 00 00 	nop *
++ +1020ac:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +1020b0:	9a 1a ff b4 	xor  %o3, -76, %o5
++ +1020b4:	a4 10 00 0d 	mov  %o5, %l2
++ +1020b8:	a4 01 c0 12 	add  %g7, %l2, %l2
++ +1020bc:	01 00 00 00 	nop *
++ +1020c0:	01 00 00 00 	nop *
++ +1020c4:	01 00 00 00 	nop *
++ +1020c8:	01 00 00 00 	nop *
++ +1020cc:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +1020d0:	9a 1a ff fc 	xor  %o3, -4, %o5
++ +1020d4:	a4 10 00 0d 	mov  %o5, %l2
++ +1020d8:	e2 29 c0 12 	stb  %l1, \[ %g7 \+ %l2 \]
++ +1020dc:	01 00 00 00 	nop *
++ +1020e0:	01 00 00 00 	nop *
++ +1020e4:	01 00 00 00 	nop *
++ +1020e8:	01 00 00 00 	nop *
++ +1020ec:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +1020f0:	01 00 00 00 	nop *
++ +1020f4:	a4 1c 7f 64 	xor  %l1, -156, %l2
++ +1020f8:	01 00 00 00 	nop *
++ +1020fc:	a6 01 c0 12 	add  %g7, %l2, %l3
++ +102100:	01 00 00 00 	nop *
++ +102104:	01 00 00 00 	nop *
++ +102108:	01 00 00 00 	nop *
++ +10210c:	01 00 00 00 	nop *
++ +102110:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +102114:	90 1a 3f e6 	xor  %o0, -26, %o0
++ +102118:	90 01 c0 08 	add  %g7, %o0, %o0
++ +10211c:	01 00 00 00 	nop *
++ +102120:	01 00 00 00 	nop *
++ +102124:	01 00 00 00 	nop *
++ +102128:	01 00 00 00 	nop *
++ +10212c:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +102130:	9a 1c 7f a5 	xor  %l1, -91, %o5
++ +102134:	92 01 c0 0d 	add  %g7, %o5, %o1
++ +102138:	01 00 00 00 	nop *
++ +10213c:	01 00 00 00 	nop *
++ +102140:	01 00 00 00 	nop *
++ +102144:	01 00 00 00 	nop *
++ +102148:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +10214c:	9a 1c 7f 68 	xor  %l1, -152, %o5
++ +102150:	d2 59 c0 0d 	ldx  \[ %g7 \+ %o5 \], %o1
++ +102154:	01 00 00 00 	nop *
++ +102158:	01 00 00 00 	nop *
++ +10215c:	01 00 00 00 	nop *
++ +102160:	01 00 00 00 	nop *
++ +102164:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +102168:	90 1a 3f eb 	xor  %o0, -21, %o0
++ +10216c:	d2 29 c0 08 	stb  %o1, \[ %g7 \+ %o0 \]
++ +102170:	01 00 00 00 	nop *
++ +102174:	01 00 00 00 	nop *
++ +102178:	01 00 00 00 	nop *
++ +10217c:	01 00 00 00 	nop *
++ +102180:	15 00 00 00 	sethi  %hi\(0\), %o2
++ +102184:	98 1a bf ab 	xor  %o2, -85, %o4
++ +102188:	da 69 c0 0c 	ldstub  \[ %g7 \+ %o4 \], %o5
++ +10218c:	01 00 00 00 	nop *
++ +102190:	01 00 00 00 	nop *
++ +102194:	01 00 00 00 	nop *
++ +102198:	01 00 00 00 	nop *
++ +10219c:	81 c7 e0 08 	ret 
++ +1021a0:	81 e8 00 00 	restore 
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.rd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.rd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.rd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.rd	2005-09-14 22:52:05.000000000 +0000
+@@ -4,5 +4,130 @@
+ #readelf: -WSsrl
+ #target: sparc*-*-*
+ 
+-# FIXME
+-#pass
++There are 15 section headers, starting at offset 0x[0-9a-f]+:
++
++Section Headers:
++ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
++ +\[ 0\] +NULL +0+ 0+ 0+ 00 +0 +0 +0
++ +\[ 1\] .interp +.*
++ +\[ 2\] .hash +.*
++ +\[ 3\] .dynsym +.*
++ +\[ 4\] .dynstr +.*
++ +\[ 5\] .rela.dyn +.*
++ +\[ 6\] .text +PROGBITS +0+101000 0+1000 0+11a4 00 +AX +0 +0 4096
++ +\[ 7\] .tdata +PROGBITS +0+2021a4 0+21a4 0+0060 00 WAT +0 +0 +4
++ +\[ 8\] .tbss +NOBITS +0+202204 0+2204 0+40 00 WAT +0 +0 +4
++ +\[ 9\] .dynamic +DYNAMIC +0+202208 0+2208 0+100 10 +WA +4 +0 +8
++ +\[10\] .got +PROGBITS +0+202308 0+2308 0+28 08 +WA +0 +0 +8
++ +\[11\] .plt +.*
++ +\[12\] .shstrtab +.*
++ +\[13\] .symtab +.*
++ +\[14\] .strtab +.*
++#...
++
++Elf file type is EXEC \(Executable file\)
++Entry point 0x102000
++There are 6 program headers, starting at offset [0-9]+
++
++Program Headers:
++ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
++ +PHDR +0x0+40 0x0+100040 0x0+100040 0x0+150 0x0+150 R E 0x8
++ +INTERP +0x0+190 0x0+100190 0x0+100190 0x0+19 0x0+19 R +0x1
++.*Requesting program interpreter.*
++ +LOAD +0x0+ 0x0+100000 0x0+100000 0x0+21a4 0x0+21a4 R E 0x100000
++ +LOAD +0x0+21a4 0x0+2021a4 0x0+2021a4 0x0+25c 0x0+25c RWE 0x100000
++ +DYNAMIC +0x0+2208 0x0+202208 0x0+202208 0x0+100 0x0+100 RW +0x8
++ +TLS +0x0+21a4 0x0+2021a4 0x0+2021a4 0x0+60 0x0+a0 R +0x4
++#...
++
++Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 4 entries:
++ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
++0+202310 +0+10000004f R_SPARC_TLS_TPOFF64 +0+ +sG5 \+ 0
++0+202318 +0+30000004f R_SPARC_TLS_TPOFF64 +0+ +sG2 \+ 0
++0+202320 +0+70000004f R_SPARC_TLS_TPOFF64 +0+ +sG6 \+ 0
++0+202328 +0+80000004f R_SPARC_TLS_TPOFF64 +0+ +sG1 \+ 0
++
++Symbol table '.dynsym' contains 11 entries:
++ +Num: +Value +Size Type +Bind +Vis +Ndx Name
++ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +1: 0+ +0 TLS +GLOBAL DEFAULT +UND sG5
++ +2: 0+202208 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
++ +3: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
++ +4: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
++ +5: 0+ +0 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
++ +6: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
++ +7: 0+ +0 TLS +GLOBAL DEFAULT +UND sG6
++ +8: 0+ +0 TLS +GLOBAL DEFAULT +UND sG1
++ +9: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
++ +10: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
++
++Symbol table '.symtab' contains 68 entries:
++ +Num: +Value +Size Type +Bind +Vis +Ndx Name
++ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +1: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +1 *
++ +2: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +2 *
++ +3: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +3 *
++ +4: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +4 *
++ +5: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5 *
++ +6: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6 *
++ +7: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +7 *
++ +8: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +8 *
++ +9: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +9 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +10 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +11 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +12 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +13 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +14 *
++ +[0-9]+: 0+20 +0 TLS +LOCAL +DEFAULT +7 sl1
++ +[0-9]+: 0+24 +0 TLS +LOCAL +DEFAULT +7 sl2
++ +[0-9]+: 0+28 +0 TLS +LOCAL +DEFAULT +7 sl3
++ +[0-9]+: 0+2c +0 TLS +LOCAL +DEFAULT +7 sl4
++ +[0-9]+: 0+30 +0 TLS +LOCAL +DEFAULT +7 sl5
++ +[0-9]+: 0+34 +0 TLS +LOCAL +DEFAULT +7 sl6
++ +[0-9]+: 0+38 +0 TLS +LOCAL +DEFAULT +7 sl7
++ +[0-9]+: 0+3c +0 TLS +LOCAL +DEFAULT +7 sl8
++ +[0-9]+: 0+80 +0 TLS +LOCAL +DEFAULT +8 bl1
++ +[0-9]+: 0+84 +0 TLS +LOCAL +DEFAULT +8 bl2
++ +[0-9]+: 0+88 +0 TLS +LOCAL +DEFAULT +8 bl3
++ +[0-9]+: 0+8c +0 TLS +LOCAL +DEFAULT +8 bl4
++ +[0-9]+: 0+90 +0 TLS +LOCAL +DEFAULT +8 bl5
++ +[0-9]+: 0+94 +0 TLS +LOCAL +DEFAULT +8 bl6
++ +[0-9]+: 0+98 +0 TLS +LOCAL +DEFAULT +8 bl7
++ +[0-9]+: 0+9c +0 TLS +LOCAL +DEFAULT +8 bl8
++ +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +7 sg8
++ +[0-9]+: 0+7c +0 TLS +GLOBAL DEFAULT +8 bg8
++ +[0-9]+: 0+74 +0 TLS +GLOBAL DEFAULT +8 bg6
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sG5
++ +[0-9]+: 0+68 +0 TLS +GLOBAL DEFAULT +8 bg3
++ +[0-9]+: 0+202208 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
++ +[0-9]+: 0+08 +0 TLS +GLOBAL DEFAULT +7 sg3
++ +[0-9]+: 0+48 +0 TLS +GLOBAL HIDDEN +7 sh3
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2
++ +[0-9]+: 0+0c +0 TLS +GLOBAL DEFAULT +7 sg4
++ +[0-9]+: 0+10 +0 TLS +GLOBAL DEFAULT +7 sg5
++ +[0-9]+: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
++ +[0-9]+: 0+70 +0 TLS +GLOBAL DEFAULT +8 bg5
++ +[0-9]+: 0+ +0 FUNC +GLOBAL DEFAULT +UND __tls_get_addr
++ +[0-9]+: 0+58 +0 TLS +GLOBAL HIDDEN +7 sh7
++ +[0-9]+: 0+5c +0 TLS +GLOBAL HIDDEN +7 sh8
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +7 sg1
++ +[0-9]+: 0+102000 +0 FUNC +GLOBAL DEFAULT +6 _start
++ +[0-9]+: 0+4c +0 TLS +GLOBAL HIDDEN +7 sh4
++ +[0-9]+: 0+78 +0 TLS +GLOBAL DEFAULT +8 bg7
++ +[0-9]+: 0+50 +0 TLS +GLOBAL HIDDEN +7 sh5
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sG6
++ +[0-9]+: 0+101008 +0 FUNC +GLOBAL DEFAULT +6 fn2
++ +[0-9]+: 0+04 +0 TLS +GLOBAL DEFAULT +7 sg2
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sG1
++ +[0-9]+: 0+40 +0 TLS +GLOBAL HIDDEN +7 sh1
++ +[0-9]+: 0+14 +0 TLS +GLOBAL DEFAULT +7 sg6
++ +[0-9]+: 0+18 +0 TLS +GLOBAL DEFAULT +7 sg7
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
++ +[0-9]+: 0+202308 +0 OBJECT +GLOBAL +HIDDEN +10 _GLOBAL_OFFSET_TABLE_
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
++ +[0-9]+: 0+44 +0 TLS +GLOBAL HIDDEN +7 sh2
++ +[0-9]+: 0+54 +0 TLS +GLOBAL HIDDEN +7 sh6
++ +[0-9]+: 0+64 +0 TLS +GLOBAL DEFAULT +8 bg2
++ +[0-9]+: 0+60 +0 TLS +GLOBAL DEFAULT +8 bg1
++ +[0-9]+: 0+6c +0 TLS +GLOBAL DEFAULT +8 bg4
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.sd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.sd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.sd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.sd	2005-09-14 22:52:05.000000000 +0000
+@@ -7,5 +7,6 @@
+ .*: +file format elf64-sparc
+ 
+ Contents of section .got:
+-# FIXME
+-#pass
++ 202308 0+ 0+202208 0+ 0+  .*
++ 202318 0+ 0+ 0+ 0+  .*
++ 202328 0+ 0+ +.*
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.td binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.td
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunbin64.td	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunbin64.td	2005-09-14 22:52:05.000000000 +0000
+@@ -7,5 +7,9 @@
+ .*: +file format elf64-sparc
+ 
+ Contents of section .tdata:
+-# FIXME
+-#pass
++ 2021a4 00000011 00000012 00000013 00000014  .*
++ 2021b4 00000015 00000016 00000017 00000018  .*
++ 2021c4 00000041 00000042 00000043 00000044  .*
++ 2021d4 00000045 00000046 00000047 00000048  .*
++ 2021e4 00000101 00000102 00000103 00000104  .*
++ 2021f4 00000105 00000106 00000107 00000108  .*
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunnopic64.dd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunnopic64.dd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunnopic64.dd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunnopic64.dd	2005-09-14 22:52:05.000000000 +0000
+@@ -8,5 +8,81 @@
+ .*: +file format elf64-sparc
+ 
+ Disassembly of section .text:
+-# FIXME
++
++0+1000 <fn3>:
++ +1000:	9d e3 bf 60 	save  %sp, -160, %sp
++ +1004:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +1008:	25 00 00 00 	sethi  %hi\(0\), %l2
++ +100c:	a2 14 60 00 	mov  %l1, %l1
++ +1010:	a4 14 a0 00 	mov  %l2, %l2
++ +1014:	a3 2c 70 20 	sllx  %l1, 0x20, %l1
++ +1018:	a2 04 40 12 	add  %l1, %l2, %l1
++ +101c:	01 00 00 00 	nop *
++ +1020:	01 00 00 00 	nop *
++ +1024:	01 00 00 00 	nop *
++ +1028:	01 00 00 00 	nop *
++ +102c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +1030:	96 02 e0 18 	add  %o3, 0x18, %o3	! 18 <.*>
++ +1034:	d4 5c 40 0b 	ldx  \[ %l1 \+ %o3 \], %o2
++ +1038:	98 01 c0 0a 	add  %g7, %o2, %o4
++ +103c:	01 00 00 00 	nop *
++ +1040:	01 00 00 00 	nop *
++ +1044:	01 00 00 00 	nop *
++ +1048:	01 00 00 00 	nop *
++ +104c:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +1050:	90 02 20 20 	add  %o0, 0x20, %o0	! 20 <.*>
++ +1054:	d0 5c 40 08 	ldx  \[ %l1 \+ %o0 \], %o0
++ +1058:	d0 01 c0 08 	ld  \[ %g7 \+ %o0 \], %o0
++ +105c:	01 00 00 00 	nop *
++ +1060:	01 00 00 00 	nop *
++ +1064:	01 00 00 00 	nop *
++ +1068:	01 00 00 00 	nop *
++ +106c:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +1070:	90 02 20 28 	add  %o0, 0x28, %o0	! 28 <.*>
++ +1074:	d0 5c 40 08 	ldx  \[ %l1 \+ %o0 \], %o0
++ +1078:	90 01 c0 08 	add  %g7, %o0, %o0
++ +107c:	01 00 00 00 	nop *
++ +1080:	01 00 00 00 	nop *
++ +1084:	01 00 00 00 	nop *
++ +1088:	01 00 00 00 	nop *
++ +108c:	1b 00 00 00 	sethi  %hi\(0\), %o5
++ +1090:	92 03 60 30 	add  %o5, 0x30, %o1	! 30 <.*>
++ +1094:	d4 5c 40 09 	ldx  \[ %l1 \+ %o1 \], %o2
++ +1098:	d6 29 c0 0a 	stb  %o3, \[ %g7 \+ %o2 \]
++ +109c:	01 00 00 00 	nop *
++ +10a0:	01 00 00 00 	nop *
++ +10a4:	01 00 00 00 	nop *
++ +10a8:	01 00 00 00 	nop *
++ +10ac:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +10b0:	90 02 20 08 	add  %o0, 8, %o0	! 8 <.*>
++ +10b4:	d0 5c 40 08 	ldx  \[ %l1 \+ %o0 \], %o0
++ +10b8:	90 01 c0 08 	add  %g7, %o0, %o0
++ +10bc:	01 00 00 00 	nop *
++ +10c0:	01 00 00 00 	nop *
++ +10c4:	01 00 00 00 	nop *
++ +10c8:	01 00 00 00 	nop *
++ +10cc:	1b 00 00 00 	sethi  %hi\(0\), %o5
++ +10d0:	92 03 60 10 	add  %o5, 0x10, %o1	! 10 <.*>
++ +10d4:	d4 5c 40 09 	ldx  \[ %l1 \+ %o1 \], %o2
++ +10d8:	d6 29 c0 0a 	stb  %o3, \[ %g7 \+ %o2 \]
++ +10dc:	01 00 00 00 	nop *
++ +10e0:	01 00 00 00 	nop *
++ +10e4:	01 00 00 00 	nop *
++ +10e8:	01 00 00 00 	nop *
++ +10ec:	15 00 00 00 	sethi  %hi\(0\), %o2
++ +10f0:	98 1a a0 00 	xor  %o2, 0, %o4
++ +10f4:	90 01 c0 0c 	add  %g7, %o4, %o0
++ +10f8:	01 00 00 00 	nop *
++ +10fc:	01 00 00 00 	nop *
++ +1100:	01 00 00 00 	nop *
++ +1104:	01 00 00 00 	nop *
++ +1108:	15 00 00 00 	sethi  %hi\(0\), %o2
++ +110c:	94 1a a0 00 	xor  %o2, 0, %o2
++ +1110:	d4 01 c0 0a 	ld  \[ %g7 \+ %o2 \], %o2
++ +1114:	01 00 00 00 	nop *
++ +1118:	01 00 00 00 	nop *
++ +111c:	01 00 00 00 	nop *
++ +1120:	01 00 00 00 	nop *
++ +1124:	81 cf e0 08 	rett  %i7 \+ 8
++ +1128:	01 00 00 00 	nop *
+ #pass
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunnopic64.rd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunnopic64.rd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunnopic64.rd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunnopic64.rd	2005-09-14 22:52:05.000000000 +0000
+@@ -5,5 +5,100 @@
+ #readelf: -WSsrl
+ #target: sparc-*-*
+ 
+-# FIXME
+-#pass
++There are 13 section headers, starting at offset 0x[0-9a-f]+:
++
++Section Headers:
++ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
++ +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
++ +\[ 1\] .hash +.*
++ +\[ 2\] .dynsym +.*
++ +\[ 3\] .dynstr +.*
++ +\[ 4\] .rela.dyn +.*
++ +\[ 5\] .text +PROGBITS +0+1000 0+1000 0+1000 0+ +AX +0 +0 4096
++ +\[ 6\] .tbss +NOBITS +0+102000 0+2000 0+24 0+ WAT +0 +0 +4
++ +\[ 7\] .dynamic +DYNAMIC +0+102000 0+2000 0+100 10 +WA +3 +0 +8
++ +\[ 8\] .got +PROGBITS +0+102100 0+2100 0+38 08 +WA +0 +0 +8
++ +\[ 9\] .plt +.*
++ +\[10\] .shstrtab +.*
++ +\[11\] .symtab +.*
++ +\[12\] .strtab +.*
++#...
++Elf file type is DYN \(Shared object file\)
++Entry point 0x1000
++There are 4 program headers, starting at offset [0-9a-f]+
++
++Program Headers:
++ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
++ +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x100000
++ +LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+200 0x0+200 RWE 0x100000
++ +DYNAMIC +0x0+2000 0x0+102000 0x0+102000 0x0+100 0x0+100 RW +0x8
++ +TLS +0x0+2000 0x0+102000 0x0+102000 0x0+ 0x0+24 R +0x4
++#...
++
++Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
++ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
++0+1004 +0+300000022 R_SPARC_HH22 +0+102100 +\.got \+ 102100
++0+1008 +0+300000024 R_SPARC_LM22 +0+102100 +\.got \+ 102100
++0+100c +0+300000023 R_SPARC_HM10 +0+102100 +\.got \+ 102100
++0+1010 +0+30000000c R_SPARC_LO10 +0+102100 +\.got \+ 102100
++0+10ec +0+48 R_SPARC_TLS_LE_HIX22 +0+9
++0+10f0 +0+49 R_SPARC_TLS_LE_LOX10 +0+9
++0+1108 +0+48 R_SPARC_TLS_LE_HIX22 +0+1c
++0+110c +0+49 R_SPARC_TLS_LE_LOX10 +0+1c
++0+102108 +0+4f R_SPARC_TLS_TPOFF64 +0+
++0+102110 +0+4f R_SPARC_TLS_TPOFF64 +0+4
++0+102128 +0+4f R_SPARC_TLS_TPOFF64 +0+14
++0+102130 +0+4f R_SPARC_TLS_TPOFF64 +0+18
++0+102118 +0+90000004f R_SPARC_TLS_TPOFF64 +0+ +sg1 \+ 0
++0+102120 +0+b0000004f R_SPARC_TLS_TPOFF64 +0+ +sg2 \+ 0
++
++Symbol table '.dynsym' contains 14 entries:
++ +Num: +Value +Size Type +Bind +Vis +Ndx Name
++ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +1: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5 *
++ +2: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6 *
++ +3: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +8 *
++ +4: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +5: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +6: 0+102000 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
++ +7: 0+1000 +0 FUNC +GLOBAL DEFAULT +5 fn3
++ +8: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
++ +9: 0+ +0 TLS +GLOBAL DEFAULT +UND sg1
++ +10: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
++ +11: 0+ +0 TLS +GLOBAL DEFAULT +UND sg2
++ +12: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
++ +13: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
++
++Symbol table '.symtab' contains 31 entries:
++ +Num: +Value +Size Type +Bind +Vis +Ndx Name
++ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +1: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +1 *
++ +2: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +2 *
++ +3: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +3 *
++ +4: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +4 *
++ +5: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5 *
++ +6: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6 *
++ +7: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +7 *
++ +8: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +8 *
++ +9: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +9 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +10 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +11 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +12 *
++ +[0-9]+: 0+ +0 TLS +LOCAL +DEFAULT +6 bl1
++ +[0-9]+: 0+4 +0 TLS +LOCAL +DEFAULT +6 bl2
++ +[0-9]+: 0+8 +0 TLS +LOCAL +DEFAULT +6 bl3
++ +[0-9]+: 0+c +0 TLS +LOCAL +DEFAULT +6 bl4
++ +[0-9]+: 0+10 +0 TLS +LOCAL +DEFAULT +6 bl5
++ +[0-9]+: 0+1c +0 TLS +LOCAL +HIDDEN +6 sh3
++ +[0-9]+: 0+20 +0 TLS +LOCAL +HIDDEN +6 sh4
++ +[0-9]+: 0+14 +0 TLS +LOCAL +HIDDEN +6 sh1
++ +[0-9]+: 0+102100 +0 OBJECT +LOCAL +HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
++ +[0-9]+: 0+18 +0 TLS +LOCAL +HIDDEN +6 sh2
++ +[0-9]+: 0+102000 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
++ +[0-9]+: 0+1000 +0 FUNC +GLOBAL DEFAULT +5 fn3
++ +[0-9]+: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sg1
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +UND sg2
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunnopic64.sd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunnopic64.sd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunnopic64.sd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunnopic64.sd	2005-09-14 22:52:05.000000000 +0000
+@@ -8,5 +8,7 @@
+ .*:     file format elf64-sparc
+ 
+ Contents of section \.got:
+-# FIXME
+-#pass
++ 102100 0+ 0+102000 0+ 0+  .*
++ 102110 0+ 0+ 0+ 0+  .*
++ 102120 0+ 0+ 0+ 0+  .*
++ 102130 0+ 0+  .*
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.dd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.dd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.dd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.dd	2005-09-14 22:52:05.000000000 +0000
+@@ -8,5 +8,213 @@
+ .*: +file format elf64-sparc
+ 
+ Disassembly of section .text:
+-# FIXME
++
++0+1000 <fn1-0x8>:
++ +1000:	81 c3 e0 08 	retl *
++ +1004:	ae 03 c0 17 	add  %o7, %l7, %l7
++
++0+1008 <fn1>:
++ +1008:	9d e3 bf 60 	save  %sp, -160, %sp
++ +100c:	2f 00 04 04 	sethi  %hi\(0x101000\), %l7
++ +1010:	7f ff ff fc 	call  1000 <.*>
++ +1014:	ae 05 e1 80 	add  %l7, 0x180, %l7	! 101180 <.*>
++ +1018:	01 00 00 00 	nop *
++ +101c:	01 00 00 00 	nop *
++ +1020:	01 00 00 00 	nop *
++ +1024:	01 00 00 00 	nop *
++ +1028:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +102c:	01 00 00 00 	nop *
++ +1030:	a4 04 60 58 	add  %l1, 0x58, %l2
++ +1034:	01 00 00 00 	nop *
++ +1038:	90 05 c0 12 	add  %l7, %l2, %o0
++ +103c:	01 00 00 00 	nop *
++ +1040:	40 04 04 d0 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +1044:	01 00 00 00 	nop *
++ +1048:	01 00 00 00 	nop *
++ +104c:	01 00 00 00 	nop *
++ +1050:	01 00 00 00 	nop *
++ +1054:	01 00 00 00 	nop *
++ +1058:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +105c:	92 02 20 78 	add  %o0, 0x78, %o1	! 78 <.*>
++ +1060:	d0 5d c0 09 	ldx  \[ %l7 \+ %o1 \], %o0
++ +1064:	90 01 c0 08 	add  %g7, %o0, %o0
++ +1068:	01 00 00 00 	nop *
++ +106c:	01 00 00 00 	nop *
++ +1070:	01 00 00 00 	nop *
++ +1074:	01 00 00 00 	nop *
++ +1078:	01 00 00 00 	nop *
++ +107c:	19 00 00 00 	sethi  %hi\(0\), %o4
++ +1080:	98 03 20 08 	add  %o4, 8, %o4	! 8 <.*>
++ +1084:	90 05 c0 0c 	add  %l7, %o4, %o0
++ +1088:	40 04 04 be 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +108c:	01 00 00 00 	nop *
++ +1090:	01 00 00 00 	nop *
++ +1094:	01 00 00 00 	nop *
++ +1098:	01 00 00 00 	nop *
++ +109c:	01 00 00 00 	nop *
++ +10a0:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +10a4:	90 02 20 18 	add  %o0, 0x18, %o0	! 18 <.*>
++ +10a8:	d0 5d c0 08 	ldx  \[ %l7 \+ %o0 \], %o0
++ +10ac:	90 01 c0 08 	add  %g7, %o0, %o0
++ +10b0:	01 00 00 00 	nop *
++ +10b4:	01 00 00 00 	nop *
++ +10b8:	01 00 00 00 	nop *
++ +10bc:	01 00 00 00 	nop *
++ +10c0:	01 00 00 00 	nop *
++ +10c4:	19 00 00 00 	sethi  %hi\(0\), %o4
++ +10c8:	98 03 20 80 	add  %o4, 0x80, %o4	! 80 <.*>
++ +10cc:	90 05 c0 0c 	add  %l7, %o4, %o0
++ +10d0:	40 04 04 ac 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +10d4:	01 00 00 00 	nop *
++ +10d8:	01 00 00 00 	nop *
++ +10dc:	01 00 00 00 	nop *
++ +10e0:	01 00 00 00 	nop *
++ +10e4:	01 00 00 00 	nop *
++ +10e8:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +10ec:	90 02 20 90 	add  %o0, 0x90, %o0	! 90 <.*>
++ +10f0:	d0 5d c0 08 	ldx  \[ %l7 \+ %o0 \], %o0
++ +10f4:	90 01 c0 08 	add  %g7, %o0, %o0
++ +10f8:	01 00 00 00 	nop *
++ +10fc:	01 00 00 00 	nop *
++ +1100:	01 00 00 00 	nop *
++ +1104:	01 00 00 00 	nop *
++ +1108:	01 00 00 00 	nop *
++ +110c:	19 00 00 00 	sethi  %hi\(0\), %o4
++ +1110:	98 03 20 38 	add  %o4, 0x38, %o4	! 38 <.*>
++ +1114:	90 05 c0 0c 	add  %l7, %o4, %o0
++ +1118:	40 04 04 9a 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +111c:	01 00 00 00 	nop *
++ +1120:	01 00 00 00 	nop *
++ +1124:	01 00 00 00 	nop *
++ +1128:	01 00 00 00 	nop *
++ +112c:	01 00 00 00 	nop *
++ +1130:	11 00 00 00 	sethi  %hi\(0\), %o0
++ +1134:	90 02 20 48 	add  %o0, 0x48, %o0	! 48 <.*>
++ +1138:	d0 5d c0 08 	ldx  \[ %l7 \+ %o0 \], %o0
++ +113c:	90 01 c0 08 	add  %g7, %o0, %o0
++ +1140:	01 00 00 00 	nop *
++ +1144:	01 00 00 00 	nop *
++ +1148:	01 00 00 00 	nop *
++ +114c:	01 00 00 00 	nop *
++ +1150:	01 00 00 00 	nop *
++ +1154:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +1158:	01 00 00 00 	nop *
++ +115c:	a4 04 60 28 	add  %l1, 0x28, %l2
++ +1160:	01 00 00 00 	nop *
++ +1164:	90 05 c0 12 	add  %l7, %l2, %o0
++ +1168:	01 00 00 00 	nop *
++ +116c:	40 04 04 85 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +1170:	01 00 00 00 	nop *
++ +1174:	27 00 00 00 	sethi  %hi\(0\), %l3
++ +1178:	01 00 00 00 	nop *
++ +117c:	a8 1c e0 20 	xor  %l3, 0x20, %l4
++ +1180:	01 00 00 00 	nop *
++ +1184:	aa 02 00 14 	add  %o0, %l4, %l5
++ +1188:	01 00 00 00 	nop *
++ +118c:	25 00 00 00 	sethi  %hi\(0\), %l2
++ +1190:	01 00 00 00 	nop *
++ +1194:	a6 1c a0 26 	xor  %l2, 0x26, %l3
++ +1198:	01 00 00 00 	nop *
++ +119c:	ec 12 00 13 	lduh  \[ %o0 \+ %l3 \], %l6
++ +11a0:	01 00 00 00 	nop *
++ +11a4:	01 00 00 00 	nop *
++ +11a8:	01 00 00 00 	nop *
++ +11ac:	01 00 00 00 	nop *
++ +11b0:	13 00 00 00 	sethi  %hi\(0\), %o1
++ +11b4:	27 00 00 00 	sethi  %hi\(0\), %l3
++ +11b8:	94 02 60 28 	add  %o1, 0x28, %o2
++ +11bc:	25 00 00 00 	sethi  %hi\(0\), %l2
++ +11c0:	90 05 c0 0a 	add  %l7, %o2, %o0
++ +11c4:	a8 1c e0 40 	xor  %l3, 0x40, %l4
++ +11c8:	40 04 04 6e 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +11cc:	a6 1c a0 45 	xor  %l2, 0x45, %l3
++ +11d0:	ea 5a 00 14 	ldx  \[ %o0 \+ %l4 \], %l5
++ +11d4:	ac 02 00 13 	add  %o0, %l3, %l6
++ +11d8:	01 00 00 00 	nop *
++ +11dc:	01 00 00 00 	nop *
++ +11e0:	01 00 00 00 	nop *
++ +11e4:	01 00 00 00 	nop *
++ +11e8:	13 00 00 00 	sethi  %hi\(0\), %o1
++ +11ec:	27 00 00 00 	sethi  %hi\(0\), %l3
++ +11f0:	94 02 60 28 	add  %o1, 0x28, %o2
++ +11f4:	25 00 00 00 	sethi  %hi\(0\), %l2
++ +11f8:	90 05 c0 0a 	add  %l7, %o2, %o0
++ +11fc:	a8 1c e0 63 	xor  %l3, 0x63, %l4
++ +1200:	40 04 04 60 	call  [0-9a-f]+ <__tls_get_addr@plt>
++ +1204:	a6 1c a0 64 	xor  %l2, 0x64, %l3
++ +1208:	aa 02 00 14 	add  %o0, %l4, %l5
++ +120c:	ec 02 00 13 	ld  \[ %o0 \+ %l3 \], %l6
++ +1210:	01 00 00 00 	nop *
++ +1214:	01 00 00 00 	nop *
++ +1218:	01 00 00 00 	nop *
++ +121c:	01 00 00 00 	nop *
++ +1220:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +1224:	01 00 00 00 	nop *
++ +1228:	a4 04 60 78 	add  %l1, 0x78, %l2
++ +122c:	01 00 00 00 	nop *
++ +1230:	e4 5d c0 12 	ldx  \[ %l7 \+ %l2 \], %l2
++ +1234:	01 00 00 00 	nop *
++ +1238:	a4 01 c0 12 	add  %g7, %l2, %l2
++ +123c:	01 00 00 00 	nop *
++ +1240:	01 00 00 00 	nop *
++ +1244:	01 00 00 00 	nop *
++ +1248:	01 00 00 00 	nop *
++ +124c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +1250:	96 02 e0 18 	add  %o3, 0x18, %o3	! 18 <.*>
++ +1254:	d4 5d c0 0b 	ldx  \[ %l7 \+ %o3 \], %o2
++ +1258:	98 01 c0 0a 	add  %g7, %o2, %o4
++ +125c:	01 00 00 00 	nop *
++ +1260:	01 00 00 00 	nop *
++ +1264:	01 00 00 00 	nop *
++ +1268:	01 00 00 00 	nop *
++ +126c:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +1270:	a4 04 60 90 	add  %l1, 0x90, %l2	! 90 <.*>
++ +1274:	e4 5d c0 12 	ldx  \[ %l7 \+ %l2 \], %l2
++ +1278:	a4 01 c0 12 	add  %g7, %l2, %l2
++ +127c:	01 00 00 00 	nop *
++ +1280:	01 00 00 00 	nop *
++ +1284:	01 00 00 00 	nop *
++ +1288:	01 00 00 00 	nop *
++ +128c:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +1290:	a4 04 60 48 	add  %l1, 0x48, %l2	! 48 <.*>
++ +1294:	e4 5d c0 12 	ldx  \[ %l7 \+ %l2 \], %l2
++ +1298:	a4 01 c0 12 	add  %g7, %l2, %l2
++ +129c:	01 00 00 00 	nop *
++ +12a0:	01 00 00 00 	nop *
++ +12a4:	01 00 00 00 	nop *
++ +12a8:	01 00 00 00 	nop *
++ +12ac:	23 00 00 00 	sethi  %hi\(0\), %l1
++ +12b0:	a4 04 60 50 	add  %l1, 0x50, %l2	! 50 <.*>
++ +12b4:	e4 5d c0 12 	ldx  \[ %l7 \+ %l2 \], %l2
++ +12b8:	e4 59 c0 12 	ldx  \[ %g7 \+ %l2 \], %l2
++ +12bc:	01 00 00 00 	nop *
++ +12c0:	01 00 00 00 	nop *
++ +12c4:	01 00 00 00 	nop *
++ +12c8:	01 00 00 00 	nop *
++ +12cc:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +12d0:	98 02 e0 20 	add  %o3, 0x20, %o4	! 20 <.*>
++ +12d4:	da 5d c0 0c 	ldx  \[ %l7 \+ %o4 \], %o5
++ +12d8:	e4 29 c0 0d 	stb  %l2, \[ %g7 \+ %o5 \]
++ +12dc:	01 00 00 00 	nop *
++ +12e0:	01 00 00 00 	nop *
++ +12e4:	01 00 00 00 	nop *
++ +12e8:	01 00 00 00 	nop *
++ +12ec:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +12f0:	98 02 e0 68 	add  %o3, 0x68, %o4	! 68 <.*>
++ +12f4:	da 5d c0 0c 	ldx  \[ %l7 \+ %o4 \], %o5
++ +12f8:	e4 71 c0 0d 	stx  %l2, \[ %g7 \+ %o5 \]
++ +12fc:	01 00 00 00 	nop *
++ +1300:	01 00 00 00 	nop *
++ +1304:	01 00 00 00 	nop *
++ +1308:	01 00 00 00 	nop *
++ +130c:	17 00 00 00 	sethi  %hi\(0\), %o3
++ +1310:	98 02 e0 70 	add  %o3, 0x70, %o4	! 70 <.*>
++ +1314:	da 5d c0 0c 	ldx  \[ %l7 \+ %o4 \], %o5
++ +1318:	e4 21 c0 0d 	st  %l2, \[ %g7 \+ %o5 \]
++ +131c:	01 00 00 00 	nop *
++ +1320:	01 00 00 00 	nop *
++ +1324:	01 00 00 00 	nop *
++ +1328:	01 00 00 00 	nop *
++ +132c:	81 cf e0 08 	rett  %i7 \+ 8
++ +1330:	01 00 00 00 	nop *
+ #pass
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.rd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.rd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.rd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.rd	2005-09-14 22:52:05.000000000 +0000
+@@ -5,5 +5,139 @@
+ #readelf: -WSsrl
+ #target: sparc*-*-*
+ 
+-# FIXME
+-#pass
++There are 15 section headers, starting at offset 0x[0-9a-f]+:
++
++Section Headers:
++ +\[Nr\] Name +Type +Address +Off +Size +ES Flg Lk Inf Al
++ +\[ 0\] +NULL +0+ 0+ 0+ 0+ +0 +0 +0
++ +\[ 1\] .hash +.*
++ +\[ 2\] .dynsym +.*
++ +\[ 3\] .dynstr +.*
++ +\[ 4\] .rela.dyn +.*
++ +\[ 5\] .rela.plt +.*
++ +\[ 6\] .text +PROGBITS +0+1000 0+1000 0+1000 0+ +AX +0 +0 4096
++ +\[ 7\] .tdata +PROGBITS +0+102000 0+2000 0+60 0+ WAT +0 +0 +4
++ +\[ 8\] .tbss +NOBITS +0+102060 0+2060 0+20 0+ WAT +0 +0 +4
++ +\[ 9\] .dynamic +DYNAMIC +0+102060 0+2060 0+130 10 +WA +3 +0 +8
++ +\[10\] .got +PROGBITS +0+102190 0+2190 0+98 08 +WA +0 +0 +8
++ +\[11\] .plt +.*
++ +\[12\] .shstrtab +.*
++ +\[13\] .symtab +.*
++ +\[14\] .strtab +.*
++#...
++
++Elf file type is DYN \(Shared object file\)
++Entry point 0x1000
++There are 4 program headers, starting at offset [0-9]+
++
++Program Headers:
++ +Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align
++ +LOAD +0x0+ 0x0+ 0x0+ 0x0+2000 0x0+2000 R E 0x100000
++ +LOAD +0x0+2000 0x0+102000 0x0+102000 0x0+3a0 0x0+3a0 RWE 0x100000
++ +DYNAMIC +0x0+2060 0x0+102060 0x0+102060 0x0+130 0x0+130 RW +0x8
++ +TLS +0x0+2000 0x0+102000 0x0+102000 0x0+60 0x0+80 R +0x4
++#...
++
++Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 14 entries:
++ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
++0+102198 +0+4b R_SPARC_TLS_DTPMOD64 +0+
++0+1021a8 +0+4f R_SPARC_TLS_TPOFF64 +0+24
++0+1021b0 +0+4f R_SPARC_TLS_TPOFF64 +0+30
++0+1021b8 +0+4b R_SPARC_TLS_DTPMOD64 +0+
++0+1021c8 +0+4b R_SPARC_TLS_DTPMOD64 +0+
++0+1021d8 +0+4f R_SPARC_TLS_TPOFF64 +0+64
++0+1021f8 +0+4f R_SPARC_TLS_TPOFF64 +0+50
++0+102200 +0+4f R_SPARC_TLS_TPOFF64 +0+70
++0+102210 +0+4b R_SPARC_TLS_DTPMOD64 +0+
++0+102220 +0+4f R_SPARC_TLS_TPOFF64 +0+44
++0+1021e0 +0+b0000004f R_SPARC_TLS_TPOFF64 +0+10 +sg5 \+ 0
++0+1021e8 +0+e0000004b R_SPARC_TLS_DTPMOD64 +0+ +sg1 \+ 0
++0+1021f0 +0+e0000004d R_SPARC_TLS_DTPOFF64 +0+ +sg1 \+ 0
++0+102208 +0+110000004f R_SPARC_TLS_TPOFF64 +0+4 +sg2 \+ 0
++
++Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entries:
++ +Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
++0+102380 +0+d00000015 R_SPARC_JMP_SLOT +0+ +__tls_get_addr \+ 0
++
++Symbol table '.dynsym' contains 22 entries:
++ +Num: +Value +Size Type +Bind +Vis +Ndx Name
++ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +7 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +8 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +10 *
++ +[0-9]+: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +[0-9]+: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +7 sg8
++ +[0-9]+: 0+102060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
++ +[0-9]+: 0+8 +0 TLS +GLOBAL DEFAULT +7 sg3
++ +[0-9]+: 0+c +0 TLS +GLOBAL DEFAULT +7 sg4
++ +[0-9]+: 0+10 +0 TLS +GLOBAL DEFAULT +7 sg5
++ +[0-9]+: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
++ +[0-9]+: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +7 sg1
++ +[0-9]+: 0+1008 +0 FUNC +GLOBAL DEFAULT +6 fn1
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
++ +[0-9]+: 0+4 +0 TLS +GLOBAL DEFAULT +7 sg2
++ +[0-9]+: 0+14 +0 TLS +GLOBAL DEFAULT +7 sg6
++ +[0-9]+: 0+18 +0 TLS +GLOBAL DEFAULT +7 sg7
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
++
++Symbol table '.symtab' contains 55 entries:
++ +Num: +Value +Size Type +Bind +Vis +Ndx Name
++ +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +1 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +2 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +3 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +4 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +5 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +6 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +7 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +8 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +9 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +10 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +11 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +12 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +13 *
++ +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +14 *
++ +[0-9]+: 0+20 +0 TLS +LOCAL +DEFAULT +7 sl1
++ +[0-9]+: 0+24 +0 TLS +LOCAL +DEFAULT +7 sl2
++ +[0-9]+: 0+28 +0 TLS +LOCAL +DEFAULT +7 sl3
++ +[0-9]+: 0+2c +0 TLS +LOCAL +DEFAULT +7 sl4
++ +[0-9]+: 0+30 +0 TLS +LOCAL +DEFAULT +7 sl5
++ +[0-9]+: 0+34 +0 TLS +LOCAL +DEFAULT +7 sl6
++ +[0-9]+: 0+38 +0 TLS +LOCAL +DEFAULT +7 sl7
++ +[0-9]+: 0+3c +0 TLS +LOCAL +DEFAULT +7 sl8
++ +[0-9]+: 0+60 +0 TLS +LOCAL +HIDDEN +8 sH1
++ +[0-9]+: 0+48 +0 TLS +LOCAL +HIDDEN +7 sh3
++ +[0-9]+: 0+64 +0 TLS +LOCAL +HIDDEN +8 sH2
++ +[0-9]+: 0+78 +0 TLS +LOCAL +HIDDEN +8 sH7
++ +[0-9]+: 0+58 +0 TLS +LOCAL +HIDDEN +7 sh7
++ +[0-9]+: 0+5c +0 TLS +LOCAL +HIDDEN +7 sh8
++ +[0-9]+: 0+6c +0 TLS +LOCAL +HIDDEN +8 sH4
++ +[0-9]+: 0+4c +0 TLS +LOCAL +HIDDEN +7 sh4
++ +[0-9]+: 0+68 +0 TLS +LOCAL +HIDDEN +8 sH3
++ +[0-9]+: 0+50 +0 TLS +LOCAL +HIDDEN +7 sh5
++ +[0-9]+: 0+70 +0 TLS +LOCAL +HIDDEN +8 sH5
++ +[0-9]+: 0+74 +0 TLS +LOCAL +HIDDEN +8 sH6
++ +[0-9]+: 0+7c +0 TLS +LOCAL +HIDDEN +8 sH8
++ +[0-9]+: 0+40 +0 TLS +LOCAL +HIDDEN +7 sh1
++ +[0-9]+: 0+102190 +0 OBJECT +LOCAL  HIDDEN +ABS _GLOBAL_OFFSET_TABLE_
++ +[0-9]+: 0+44 +0 TLS +LOCAL +HIDDEN +7 sh2
++ +[0-9]+: 0+54 +0 TLS +LOCAL +HIDDEN +7 sh6
++ +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +7 sg8
++ +[0-9]+: 0+102060 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC
++ +[0-9]+: 0+8 +0 TLS +GLOBAL DEFAULT +7 sg3
++ +[0-9]+: 0+c +0 TLS +GLOBAL DEFAULT +7 sg4
++ +[0-9]+: 0+10 +0 TLS +GLOBAL DEFAULT +7 sg5
++ +[0-9]+: [0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _PROCEDURE_LINKAGE_TABLE_
++ +[0-9]+: 0+ +0 NOTYPE +GLOBAL DEFAULT +UND __tls_get_addr
++ +[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT +7 sg1
++ +[0-9]+: 0+1008 +0 FUNC +GLOBAL DEFAULT +6 fn1
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start
++ +[0-9]+: 0+4 +0 TLS +GLOBAL DEFAULT +7 sg2
++ +[0-9]+: 0+14 +0 TLS +GLOBAL DEFAULT +7 sg6
++ +[0-9]+: 0+18 +0 TLS +GLOBAL DEFAULT +7 sg7
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _edata
++ +[0-9]+: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS _end
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.sd binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.sd
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.sd	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.sd	2005-09-14 22:52:05.000000000 +0000
+@@ -8,5 +8,13 @@
+ .*: +file format elf64-sparc
+ 
+ Contents of section .got:
+-# FIXME
+-#pass
++ 102190 00000000 00102060 00000000 00000000  .*
++ 1021a0 00000000 00000020 00000000 00000000  .*
++ 1021b0 00000000 00000000 00000000 00000000  .*
++ 1021c0 00000000 00000000 00000000 00000000  .*
++ 1021d0 00000000 00000060 00000000 00000000  .*
++ 1021e0 00000000 00000000 00000000 00000000  .*
++ 1021f0 00000000 00000000 00000000 00000000  .*
++ 102200 00000000 00000000 00000000 00000000  .*
++ 102210 00000000 00000000 00000000 00000040  .*
++ 102220 00000000 00000000  .*
+diff -Naur binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.td binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.td
+--- binutils-2.16.1.orig/ld/testsuite/ld-sparc/tlssunpic64.td	2003-01-24 23:44:45.000000000 +0000
++++ binutils-2.16.1/ld/testsuite/ld-sparc/tlssunpic64.td	2005-09-14 22:52:05.000000000 +0000
+@@ -8,5 +8,9 @@
+ .*: +file format elf64-sparc
+ 
+ Contents of section .tdata:
+-# FIXME
+-#pass
++ 102000 00000011 00000012 00000013 00000014  .*
++ 102010 00000015 00000016 00000017 00000018  .*
++ 102020 00000041 00000042 00000043 00000044  .*
++ 102030 00000045 00000046 00000047 00000048  .*
++ 102040 00000101 00000102 00000103 00000104  .*
++ 102050 00000105 00000106 00000107 00000108  .*
Index: patches/bzip2-1.0.3-bzgrep_security-1.patch
===================================================================
--- patches/bzip2-1.0.3-bzgrep_security-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/bzip2-1.0.3-bzgrep_security-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,35 @@
+Submitted By: Ken Moffat <ken@kenmoffat.uklinux.net>
+Date: 2005-08-09
+Initial Package Version: 1.0.3
+Upstream Status: Unknown.
+Origin: Jyri Ryska (RedHat) for fedora3
+Description: Fixes filename sanitisation in bzgrep.
+ This fixes CAN-2005-0758 (if a user can be tricked into running
+bzgrep in an untrusted directory containing files with carefully
+crafted filenames, arbitrary commands could be executed as the user
+running bzgrep).  Risk is reported as low.  I've modified it to force
+the interpreter to be bash, some of the other shells in use won't
+like the bash syntax.
+
+diff -Naur bzip2-1.0.3/bzgrep bzip2-1.0.3-new/bzgrep
+--- bzip2-1.0.3/bzgrep	2004-10-09 12:29:32.000000000 +0100
++++ bzip2-1.0.3-new/bzgrep	2005-08-09 21:36:37.000000000 +0100
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/bin/bash
+ 
+ # Bzgrep wrapped for bzip2, 
+ # adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
+@@ -63,7 +63,11 @@
+     bzip2 -cdfq "$i" | $grep $opt "$pat"
+     r=$?
+   else
+-    bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${i}:|"
++    j=${i//\\/\\\\}
++    j=${j//|/\\|}
++    j=${j//&/\\&}
++    j=`printf "%s" "$j" | tr '\n' ' '`
++    bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
+     r=$?
+   fi
+   test "$r" -ne 0 && res="$r"
Index: patches/bzip2-1.0.3-install_docs-1.patch
===================================================================
--- patches/bzip2-1.0.3-install_docs-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/bzip2-1.0.3-install_docs-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,41 @@
+Submitted By:            Matthew Burgess <matthew@linuxfromscratch.org>
+Date:                    2005-08-03
+Initial Package Version: 1.0.3
+Upstream Status:         Not submitted
+Origin:                  Randy McMurchy & Steve Crosby
+Description:             Installs pre-formatted documentation
+
+diff -Naur bzip2-1.0.3.orig/Makefile bzip2-1.0.3/Makefile
+--- bzip2-1.0.3.orig/Makefile	2005-02-17 11:28:24.000000000 +0000
++++ bzip2-1.0.3/Makefile	2005-08-14 13:08:25.626703640 +0000
+@@ -12,6 +12,7 @@
+ 
+ # Where you want it installed when you do 'make install'
+ PREFIX=/usr
++DOCDIR=share/doc/$(DISTNAME)
+ 
+ 
+ OBJS= blocksort.o  \
+@@ -61,6 +62,7 @@
+ 	if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
+ 	if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
+ 	if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
++	if ( test ! -d $(PREFIX)/$(DOCDIR) ) ; then mkdir -p $(PREFIX)/$(DOCDIR); fi
+ 	if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
+ 	cp -f bzip2 $(PREFIX)/bin/bzip2
+ 	cp -f bzip2 $(PREFIX)/bin/bunzip2
+@@ -94,6 +96,14 @@
+ 	echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
+ 	echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
+ 	echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
++	cp -f manual.html $(PREFIX)/$(DOCDIR)
++	cp -f manual.pdf $(PREFIX)/$(DOCDIR)
++	cp -f manual.ps $(PREFIX)/$(DOCDIR)
++	cp -f bzip2.txt $(PREFIX)/$(DOCDIR)
++	chmod a+r $(PREFIX)/$(DOCDIR)/manual.html
++	chmod a+r $(PREFIX)/$(DOCDIR)/manual.pdf
++	chmod a+r $(PREFIX)/$(DOCDIR)/manual.ps
++	chmod a+r $(PREFIX)/$(DOCDIR)/bzip2.txt
+ 
+ clean: 
+ 	rm -f *.o libbz2.a bzip2 bzip2recover \
Index: patches/bzip2-1.0.3-remove_tempfile-1.patch
===================================================================
--- patches/bzip2-1.0.3-remove_tempfile-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/bzip2-1.0.3-remove_tempfile-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,46 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2006-02-19
+Initial Package Version: 1.0.3
+Origin: Jim Gifford
+Upstream Status: Sent
+Description: Removes Dependency of tempfile
+ 
+--- bzip2-1.0.3/bzdiff.orig	2004-10-09 11:29:42.000000000 +0000
++++ bzip2-1.0.3/bzdiff	2006-02-20 07:43:08.000000000 +0000
+@@ -37,10 +37,6 @@
+ 	echo "Usage: $prog [${comp}_options] file [file]"
+ 	exit 1
+ fi
+-tmp=`tempfile -d /tmp -p bz` || {
+-      echo 'cannot create a temporary file' >&2
+-      exit 1
+-}
+ set $FILES
+ if test $# -eq 1; then
+ 	FILE=`echo "$1" | sed 's/.bz2$//'`
+@@ -53,19 +49,20 @@
+                 case "$2" in
+ 	        *.bz2)
+ 			F=`echo "$2" | sed 's|.*/||;s|.bz2$||'`
+-                        bzip2 -cdfq "$2" > $tmp
+-                        bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
++                        bzip2 -cdfq "$2"  > /tmp/"$F".$$
++                        bzip2 -cdfq "$1" | $comp $OPTIONS - /tmp/"$F".$$ | sed -e "s|Files - and /tmp/"$F".$$|Files $1 and $2|g"
+                         STAT="$?"
+-			/bin/rm -f $tmp;;
++			/bin/rm -f /tmp/"$F".$$;;
+ 
+-                *)      bzip2 -cdfq "$1" | $comp $OPTIONS - "$2"
++                *)      bzip2 -cdfq "$1" | $comp $OPTIONS - "$2" | sed -e "s|Files - and /tmp/"$F".$$|Files $1 and $2|g"
+                         STAT="$?";;
+                 esac;;
+         *)      case "$2" in
+ 	        *.bz2)
+                         bzip2 -cdfq "$2" | $comp $OPTIONS "$1" -
+                         STAT="$?";;
+-                *)      $comp $OPTIONS "$1" "$2"
++                *)      $comp $OPTIONS "$1" "$2" | sed -e "s|Files - and /tmp/"$F".$$|Files $1 and $2|g"
++
+                         STAT="$?";;
+                 esac;;
+ 	esac
Index: patches/colo-1.21-make_fix-1.patch
===================================================================
--- patches/colo-1.21-make_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/colo-1.21-make_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,57 @@
+Submitted By: Joe Ciccone <joeciccone@crazyeyesoft.com>
+Date: 2005-11-23
+Initial Package Version: 1.19
+Upstream Status: Sent
+Origin: Joe Ciccone <joeciccone@crazyeyesoft.com
+Description: Adds flags to the stage1, stage2, and chain Makefiles
+             forcing them to build as 32bit.
+
+	     2-2-06 Updated for Colo 1.21 
+diff -Naur colo-1.21.orig/chain/Makefile colo-1.21/chain/Makefile
+--- colo-1.21.orig/chain/Makefile	2006-01-17 23:03:58.000000000 +0000
++++ colo-1.21/chain/Makefile	2006-02-02 15:43:32.000000000 +0000
+@@ -18,9 +18,9 @@
+ 
+ DEPS=$(OBJS:.o=.d)
+ 
+-LDFLAGS= -nostdlib -Wl,-T,$(TARG).lnk,-Map,$(TARG).map
+-CFLAGS= -Werror -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strict-aliasing $(CFLAGS_CPU) $(CFLAGS_COLO)
+-CPPFLAGS= -MD -nostdinc -Iinclude -I../include -D_DEBUG $(CPPFLAGS_GCC)
++LDFLAGS= -mabi=32 -nostdlib -Wl,-T,$(TARG).lnk,-Map,$(TARG).map
++CFLAGS= -mabi=32 -Werror -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strict-aliasing $(CFLAGS_CPU) $(CFLAGS_COLO)
++CPPFLAGS= -mabi=32 -MD -nostdinc -Iinclude -I../include -D_DEBUG $(CPPFLAGS_GCC)
+ 
+ all:
+ 	$(MAKE) -C .. binary
+diff -Naur colo-1.21.orig/stage1/Makefile colo-1.21/stage1/Makefile
+--- colo-1.21.orig/stage1/Makefile	2006-01-17 23:03:58.000000000 +0000
++++ colo-1.21/stage1/Makefile	2006-02-02 15:44:18.000000000 +0000
+@@ -21,9 +21,9 @@
+ 
+ DEPS=$(OBJS:.o=.d)
+ 
+-LDFLAGS= -nostdlib -Wl,-T,$(TARG).lnk,-Map,$(TARG).map
+-CFLAGS= -Werror -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strict-aliasing $(CFLAGS_CPU) $(CFLAGS_COLO)
+-CPPFLAGS= -MD -nostdinc -Iinclude -I../include -D_DEBUG $(CPPFLAGS_GCC)
++LDFLAGS= -mabi=32 -nostdlib -Wl,-T,$(TARG).lnk,-Map,$(TARG).map
++CFLAGS= -mabi=32 -Werror -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strict-aliasing $(CFLAGS_CPU) $(CFLAGS_COLO)
++CPPFLAGS= -mabi=32 -MD -nostdinc -Iinclude -I../include -D_DEBUG $(CPPFLAGS_GCC)
+ 
+ all:
+ 	$(MAKE) -C .. binary
+diff -Naur colo-1.21.orig/stage2/Makefile colo-1.21/stage2/Makefile
+--- colo-1.21.orig/stage2/Makefile	2006-01-17 23:03:58.000000000 +0000
++++ colo-1.21/stage2/Makefile	2006-02-02 15:44:02.000000000 +0000
+@@ -54,9 +54,9 @@
+ 
+ DEPS=$(OBJS:.o=.d)
+ 
+-LDFLAGS= -nostdlib -Wl,-T,$(TARG).lnk,-Map,$(TARG).map,--emit-relocs
+-CFLAGS= -Werror -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strict-aliasing $(CFLAGS_CPU) $(CFLAGS_COLO)
+-CPPFLAGS= -MD -nostdinc -Iinclude -I../include -D_DEBUG $(CPPFLAGS_GCC)
++LDFLAGS= -mabi=32 -nostdlib -Wl,-T,$(TARG).lnk,-Map,$(TARG).map,--emit-relocs
++CFLAGS= -mabi=32 -Werror -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strict-aliasing $(CFLAGS_CPU) $(CFLAGS_COLO)
++CPPFLAGS= -mabi=32 -MD -nostdinc -Iinclude -I../include -D_DEBUG $(CPPFLAGS_GCC)
+ 
+ LOADADDR= $(shell $(CROSS_COMPILE)readelf -l $(TARG) | awk '$$1 ~ /^LOAD$$/ { print $$3 }')
+ 
Index: patches/coreutils-5.94-suppress_uptime_kill_su-2.patch
===================================================================
--- patches/coreutils-5.94-suppress_uptime_kill_su-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/coreutils-5.94-suppress_uptime_kill_su-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,272 @@
+Submitted By: Matthew Burgess <matthew at linuxfromscratch dot org>
+Date: 2006-03-15
+Initial Package Version: 5.94
+Origin: original suppress_hotname_uptame_kill_su patch (Robert Connolly)
+Upstream Status: N/A
+Description: This patch supresses the building of uptime, and kill.  The su
+command is built so the testsuite can run, use './src/su', but it will not
+be installed. Also see:
+           http://www.linuxfromscratch.org/patches/downloads/coreutils/
+           coreutils-5.0-dupes-2.patch
+
+diff -Naur coreutils-5.94.orig/AUTHORS coreutils-5.94/AUTHORS
+--- coreutils-5.94.orig/AUTHORS	2004-11-03 23:10:50.000000000 +0000
++++ coreutils-5.94/AUTHORS	2006-03-15 22:20:49.000000000 +0000
+@@ -34,7 +34,6 @@
+ hostname: Jim Meyering
+ id: Arnold Robbins, David MacKenzie
+ join: Mike Haertel
+-kill: Paul Eggert
+ link: Michael Stone
+ ln: Mike Parker, David MacKenzie
+ logname: FIXME: unknown
+@@ -83,7 +82,6 @@
+ unexpand: David MacKenzie
+ uniq: Richard Stallman, David MacKenzie
+ unlink: Michael Stone
+-uptime: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi
+ users: Joseph Arceneaux, David MacKenzie
+ vdir: Richard Stallman, David MacKenzie
+ wc: Paul Rubin, David MacKenzie
+diff -Naur coreutils-5.94.orig/Makefile.in coreutils-5.94/Makefile.in
+--- coreutils-5.94.orig/Makefile.in	2006-02-13 12:52:03.000000000 +0000
++++ coreutils-5.94/Makefile.in	2006-03-15 22:20:49.000000000 +0000
+@@ -148,7 +148,7 @@
+ 	$(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \
+ 	$(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
+ 	$(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \
+-	$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \
++	$(top_srcdir)/m4/unlocked-io.m4 \
+ 	$(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \
+ 	$(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \
+ 	$(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \
+diff -Naur coreutils-5.94.orig/README coreutils-5.94/README
+--- coreutils-5.94.orig/README	2005-09-28 18:34:26.000000000 +0000
++++ coreutils-5.94/README	2006-03-15 22:20:49.000000000 +0000
+@@ -9,11 +9,11 @@
+ 
+   [ basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd
+   df dir dircolors dirname du echo env expand expr factor false fmt fold
+-  ginstall groups head hostid hostname id join kill link ln logname ls
++  ginstall groups head hostid hostname id join link ln logname ls
+   md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr
+   printenv printf ptx pwd readlink rm rmdir seq sha1sum shred sleep sort
+   split stat stty su sum sync tac tail tee test touch tr true tsort tty
+-  uname unexpand uniq unlink uptime users vdir wc who whoami yes
++  uname unexpand uniq unlink users vdir wc who whoami yes
+ 
+ See the file NEWS for a list of major changes in the current release.
+ 
+diff -Naur coreutils-5.94.orig/configure coreutils-5.94/configure
+--- coreutils-5.94.orig/configure	2006-02-13 12:52:04.000000000 +0000
++++ coreutils-5.94/configure	2006-03-15 22:20:49.000000000 +0000
+@@ -50418,8 +50418,7 @@
+ { echo "$as_me:$LINENO: result: $gnulib_cv_have_boot_time" >&5
+ echo "${ECHO_T}$gnulib_cv_have_boot_time" >&6; }
+   if test $gnulib_cv_have_boot_time = yes; then
+-  OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)"
+-  MAN="$MAN uptime.1"
++echo "uptime is suppressed"
+ fi
+ 
+ 
+diff -Naur coreutils-5.94.orig/man/Makefile.in coreutils-5.94/man/Makefile.in
+--- coreutils-5.94.orig/man/Makefile.in	2006-02-13 12:51:58.000000000 +0000
++++ coreutils-5.94/man/Makefile.in	2006-03-15 22:20:50.000000000 +0000
+@@ -142,7 +142,7 @@
+ 	$(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \
+ 	$(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
+ 	$(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \
+-	$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \
++	$(top_srcdir)/m4/unlocked-io.m4 \
+ 	$(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \
+ 	$(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \
+ 	$(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \
+@@ -303,13 +303,13 @@
+   basename.1 cat.1 chgrp.1 chmod.1 chown.1 chroot.1 cksum.1 comm.1 \
+   cp.1 csplit.1 cut.1 date.1 dd.1 df.1 dir.1 dircolors.1 dirname.1 du.1 \
+   echo.1 env.1 expand.1 expr.1 factor.1 false.1 fmt.1 fold.1 groups.1 \
+-  head.1 hostid.1 hostname.1 id.1 install.1 join.1 kill.1 \
++  head.1 hostid.1 hostname.1 id.1 install.1 join.1 \
+   link.1 ln.1 logname.1 \
+   ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \
+   paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \
+   rm.1 rmdir.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \
+-  su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
+-  tty.1 uname.1 unexpand.1 uniq.1 unlink.1 uptime.1 users.1 vdir.1 wc.1 \
++  sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \
++  tty.1 uname.1 unexpand.1 uniq.1 unlink.1 users.1 vdir.1 wc.1 \
+   who.1 whoami.1 yes.1
+ 
+ man_aux = $(dist_man_MANS:.1=.x)
+@@ -575,7 +575,6 @@
+ id.1:		$(common_dep)	$(srcdir)/id.x		../src/id.c
+ install.1:	$(common_dep)	$(srcdir)/install.x	../src/install.c
+ join.1:		$(common_dep)	$(srcdir)/join.x	../src/join.c
+-kill.1:		$(common_dep)	$(srcdir)/kill.x	../src/kill.c
+ link.1:		$(common_dep)	$(srcdir)/link.x	../src/link.c
+ ln.1:		$(common_dep)	$(srcdir)/ln.x		../src/ln.c
+ logname.1:	$(common_dep)	$(srcdir)/logname.x	../src/logname.c
+@@ -608,7 +607,6 @@
+ split.1:	$(common_dep)	$(srcdir)/split.x	../src/split.c
+ stat.1:		$(common_dep)	$(srcdir)/stat.x	../src/stat.c
+ stty.1:		$(common_dep)	$(srcdir)/stty.x	../src/stty.c
+-su.1:		$(common_dep)	$(srcdir)/su.x		../src/su.c
+ sum.1:		$(common_dep)	$(srcdir)/sum.x		../src/sum.c
+ sync.1:		$(common_dep)	$(srcdir)/sync.x	../src/sync.c
+ tac.1:		$(common_dep)	$(srcdir)/tac.x		../src/tac.c
+@@ -624,7 +622,6 @@
+ unexpand.1:	$(common_dep)	$(srcdir)/unexpand.x	../src/unexpand.c
+ uniq.1:		$(common_dep)	$(srcdir)/uniq.x	../src/uniq.c
+ unlink.1:	$(common_dep)	$(srcdir)/unlink.x	../src/unlink.c
+-uptime.1:	$(common_dep)	$(srcdir)/uptime.x	../src/uptime.c
+ users.1:	$(common_dep)	$(srcdir)/users.x	../src/users.c
+ vdir.1:		$(common_dep)	$(srcdir)/vdir.x	../src/ls.c
+ wc.1:		$(common_dep)	$(srcdir)/wc.x		../src/wc.c
+@@ -656,7 +653,7 @@
+ check-x-vs-1:
+ 	PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH;		\
+ 	t=ls-files.$$$$;						\
+-	(cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\
++	(cd $(srcdir) && ls -1 *.x) | grep -v -e 'kill.x' -e 'su.x' -e 'uptime.x' | sed 's/\.x$$//' | $(ASSORT) > $$t;\
+ 	echo $(dist_man_MANS) | tr -s ' ' '\n' | sed 's/\.1$$//'	\
+ 	  | $(ASSORT) | diff - $$t || { rm $$t; exit 1; };		\
+ 	rm $$t
+diff -Naur coreutils-5.94.orig/src/Makefile.in coreutils-5.94/src/Makefile.in
+--- coreutils-5.94.orig/src/Makefile.in	2006-02-13 13:08:11.000000000 +0000
++++ coreutils-5.94/src/Makefile.in	2006-03-15 22:20:50.000000000 +0000
+@@ -39,7 +39,7 @@
+ host_triplet = @host@
+ EXTRA_PROGRAMS = chroot$(EXEEXT) df$(EXEEXT) hostid$(EXEEXT) \
+ 	nice$(EXEEXT) pinky$(EXEEXT) stty$(EXEEXT) su$(EXEEXT) \
+-	uname$(EXEEXT) uptime$(EXEEXT) users$(EXEEXT) who$(EXEEXT)
++	uname$(EXEEXT) users$(EXEEXT) who$(EXEEXT)
+ bin_PROGRAMS = [$(EXEEXT) chgrp$(EXEEXT) chown$(EXEEXT) chmod$(EXEEXT) \
+ 	cp$(EXEEXT) dd$(EXEEXT) dircolors$(EXEEXT) du$(EXEEXT) \
+ 	ginstall$(EXEEXT) link$(EXEEXT) ln$(EXEEXT) dir$(EXEEXT) \
+@@ -56,7 +56,7 @@
+ 	uniq$(EXEEXT) wc$(EXEEXT) basename$(EXEEXT) date$(EXEEXT) \
+ 	dirname$(EXEEXT) echo$(EXEEXT) env$(EXEEXT) expr$(EXEEXT) \
+ 	factor$(EXEEXT) false$(EXEEXT) hostname$(EXEEXT) id$(EXEEXT) \
+-	kill$(EXEEXT) logname$(EXEEXT) pathchk$(EXEEXT) \
++	logname$(EXEEXT) pathchk$(EXEEXT) \
+ 	printenv$(EXEEXT) printf$(EXEEXT) pwd$(EXEEXT) seq$(EXEEXT) \
+ 	sleep$(EXEEXT) tee$(EXEEXT) test$(EXEEXT) true$(EXEEXT) \
+ 	tty$(EXEEXT) whoami$(EXEEXT) yes$(EXEEXT) $(am__EXEEXT_1) \
+@@ -169,7 +169,7 @@
+ 	$(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \
+ 	$(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
+ 	$(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \
+-	$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \
++	$(top_srcdir)/m4/unlocked-io.m4 \
+ 	$(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \
+ 	$(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \
+ 	$(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \
+@@ -350,11 +350,6 @@
+ join_LDADD = $(LDADD)
+ join_DEPENDENCIES = ../lib/libcoreutils.a $(am__DEPENDENCIES_1) \
+ 	../lib/libcoreutils.a
+-kill_SOURCES = kill.c
+-kill_OBJECTS = kill.$(OBJEXT)
+-kill_LDADD = $(LDADD)
+-kill_DEPENDENCIES = ../lib/libcoreutils.a $(am__DEPENDENCIES_1) \
+-	../lib/libcoreutils.a
+ link_SOURCES = link.c
+ link_OBJECTS = link.$(OBJEXT)
+ link_LDADD = $(LDADD)
+@@ -577,9 +572,6 @@
+ unlink_LDADD = $(LDADD)
+ unlink_DEPENDENCIES = ../lib/libcoreutils.a $(am__DEPENDENCIES_1) \
+ 	../lib/libcoreutils.a
+-uptime_SOURCES = uptime.c
+-uptime_OBJECTS = uptime.$(OBJEXT)
+-uptime_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1)
+ users_SOURCES = users.c
+ users_OBJECTS = users.$(OBJEXT)
+ users_LDADD = $(LDADD)
+@@ -622,28 +614,28 @@
+ 	csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c \
+ 	dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c \
+ 	fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c \
+-	id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) \
++	id.c join.c link.c ln.c logname.c $(ls_SOURCES) \
+ 	$(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) \
+ 	nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c \
+ 	printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) \
+ 	rmdir.c seq.c setuidgid.c $(sha1sum_SOURCES) shred.c sleep.c \
+ 	sort.c split.c stat.c stty.c su.c sum.c sync.c tac.c tail.c \
+ 	tee.c test.c touch.c tr.c true.c tsort.c tty.c uname.c \
+-	unexpand.c uniq.c unlink.c uptime.c users.c $(vdir_SOURCES) \
++	unexpand.c uniq.c unlink.c users.c $(vdir_SOURCES) \
+ 	wc.c who.c whoami.c yes.c
+ DIST_SOURCES = $(__SOURCES) basename.c cat.c $(chgrp_SOURCES) chmod.c \
+ 	$(chown_SOURCES) chroot.c cksum.c comm.c $(cp_SOURCES) \
+ 	csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c \
+ 	dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c \
+ 	fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c \
+-	id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) \
++	id.c join.c link.c ln.c logname.c $(ls_SOURCES) \
+ 	$(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) \
+ 	nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c \
+ 	printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) \
+ 	rmdir.c seq.c setuidgid.c $(sha1sum_SOURCES) shred.c sleep.c \
+ 	sort.c split.c stat.c stty.c su.c sum.c sync.c tac.c tail.c \
+ 	tee.c test.c touch.c tr.c true.c tsort.c tty.c uname.c \
+-	unexpand.c uniq.c unlink.c uptime.c users.c $(vdir_SOURCES) \
++	unexpand.c uniq.c unlink.c users.c $(vdir_SOURCES) \
+ 	wc.c who.c whoami.c yes.c
+ HEADERS = $(noinst_HEADERS)
+ ETAGS = etags
+@@ -840,7 +832,6 @@
+ nanosec_libs = $(LDADD) $(POW_LIB) $(LIB_NANOSLEEP)
+ sleep_LDADD = $(nanosec_libs)
+ tail_LDADD = $(nanosec_libs)
+-uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS)
+ su_LDADD = $(LDADD) $(LIB_CRYPT)
+ SUFFIXES = .sh
+ installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'`
+@@ -1076,9 +1067,6 @@
+ join$(EXEEXT): $(join_OBJECTS) $(join_DEPENDENCIES) 
+ 	@rm -f join$(EXEEXT)
+ 	$(LINK) $(join_LDFLAGS) $(join_OBJECTS) $(join_LDADD) $(LIBS)
+-kill$(EXEEXT): $(kill_OBJECTS) $(kill_DEPENDENCIES) 
+-	@rm -f kill$(EXEEXT)
+-	$(LINK) $(kill_LDFLAGS) $(kill_OBJECTS) $(kill_LDADD) $(LIBS)
+ link$(EXEEXT): $(link_OBJECTS) $(link_DEPENDENCIES) 
+ 	@rm -f link$(EXEEXT)
+ 	$(LINK) $(link_LDFLAGS) $(link_OBJECTS) $(link_LDADD) $(LIBS)
+@@ -1226,9 +1214,6 @@
+ unlink$(EXEEXT): $(unlink_OBJECTS) $(unlink_DEPENDENCIES) 
+ 	@rm -f unlink$(EXEEXT)
+ 	$(LINK) $(unlink_LDFLAGS) $(unlink_OBJECTS) $(unlink_LDADD) $(LIBS)
+-uptime$(EXEEXT): $(uptime_OBJECTS) $(uptime_DEPENDENCIES) 
+-	@rm -f uptime$(EXEEXT)
+-	$(LINK) $(uptime_LDFLAGS) $(uptime_OBJECTS) $(uptime_LDADD) $(LIBS)
+ users$(EXEEXT): $(users_OBJECTS) $(users_DEPENDENCIES) 
+ 	@rm -f users$(EXEEXT)
+ 	$(LINK) $(users_LDFLAGS) $(users_OBJECTS) $(users_LDADD) $(LIBS)
+@@ -1322,7 +1307,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/install.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/join.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kill.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbracket.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ln.Po@am__quote@
+@@ -1378,7 +1362,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unexpand.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniq.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uptime.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/users.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wc.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/who.Po@am__quote@
+@@ -1606,7 +1589,7 @@
+ 	  && can_create_suid_root_executable=yes; \
+ 	rm -f $$TMPFILE; \
+ 	if test $$can_create_suid_root_executable = yes; then \
+-	  $(INSTALL_SU); \
++	  echo "Installation of su is suppressed"; \
+ 	else \
+ 	  echo "WARNING: insufficient access; not installing su"; \
+ 	  echo "NOTE: to install su, run 'make install-root' as root"; \
Index: patches/coreutils-5.94-uname-1.patch
===================================================================
--- patches/coreutils-5.94-uname-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/coreutils-5.94-uname-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,182 @@
+Submitted By: Matthew Burgess <matthew at linuxfromscratch dot org>
+Date: 2005-10-23
+Initial Package Version: 5.92
+Upstream Status: pending
+Origin: Scot McPherson
+Description: Fix the output of uname once and for all.
+
+	$ uname -m	# This always worked.
+	i686
+	$ uname -i	# Used to report 'unknown'.
+	i386
+	$ uname -p	# Likewise.
+	athlon-4
+
+diff -Naur coreutils-5.92.orig/src/uname.c coreutils-5.92/src/uname.c
+--- coreutils-5.92.orig/src/uname.c	2005-09-15 20:34:42.000000000 +0000
++++ coreutils-5.92/src/uname.c	2005-10-23 10:14:06.000000000 +0000
+@@ -29,6 +29,12 @@
+ # include <sys/systeminfo.h>
+ #endif
+ 
++#ifdef linux
++#define cpuid(in,a,b,c,d)\
++  asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
++int has_sse( void );
++#endif
++
+ #if HAVE_SYS_SYSCTL_H
+ # if HAVE_SYS_PARAM_H
+ #  include <sys/param.h> /* needed for OpenBSD 3.0 */
+@@ -256,6 +262,96 @@
+ 	if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
+ 	  element = processor;
+       }
++#else
++      {
++	struct utsname u;
++	uname (&u);
++	element = u.machine;
++#ifdef linux
++/******************************************************************************
++ *
++ * Hello, major hack.  I shouldn't have to do this.  struct utsname should
++ * have another element with this info in it.  There's probably a struct
++ * somewhere that has this info, I just don't know where it is.
++ *
++ *****************************************************************************/
++
++	if( !strcmp( element, "i586" ) || !strcmp( element, "i686" ) ) {
++	  int eax, ebx, ecx, edx, unused;
++	  int model, family, sse;
++     
++	  cpuid(0,unused,ebx,ecx,edx);
++	  cpuid(1,eax,unused,unused,unused);
++	  model = (eax >> 4) & 0xf;
++	  family = (eax >> 8) & 0xf;
++
++	  switch(ebx) {
++	  case 0x756e6547: // Intel
++	    switch( family ) {
++	    case 5: // Pentium
++	      if( model <= 3 )
++		element="pentium";
++	      if( model > 3 )
++		element="pentium-mmx";
++	      break;
++	    case 6: // PentiumPro - Pentium III
++	      if( model == 1 ) // Pentium Pro
++		element="pentiumpro";
++	      if( ( model == 3 ) || ( model == 5 ) ||
++		  ( model == 6 ) ) // Pentium II
++		element="pentium2";
++	      if( ( model == 7 ) || ( model == 8 ) ||
++		  ( model == 10 ) || ( model == 11 ) ) // These are all Pentium III
++		element="pentium3";
++	      break;
++	    case 15: // Pentium4
++	      element="pentium4";
++	      break;
++	    default:
++	      break;
++	    } // end switch( family )
++	    break;
++	  case 0x68747541: // AMD
++	    switch(family) {
++	    case 5:
++	      if( ( model == 0 ) || ( model == 1 ) || 
++		  ( model == 2 ) || ( model == 3 ) ) // K5
++		element="i586";
++	      if( ( model == 6 ) || ( model == 7 ) ) // K6
++		element="k6";
++	      if( model == 8 ) // K6-2
++		element="k6-2";
++	      if( model == 9 ) // K6-3
++		element="k6-3";
++	      break;
++	    case 6:
++	      if( model <= 4 )
++		element="athlon";
++	      if( model > 4 ) {
++		sse = has_sse();
++		if( sse == 0 )
++		  element="athlon";
++		if( sse == 1 )
++		  element="athlon-4";
++	      }
++	      break;
++	    case 15:
++	      element="athlon-4";
++	      break;
++	    default:
++	      break;
++	    } // end switch( family )
++	    break;
++	  case 0x69727943: // Cyrix
++	    element="i386"; // who knows what cyrix supports, lets be safe
++	    break;
++	  default:
++	    break;
++	  } // end switch(ebx)
++	}
++
++#endif
++      }
+ #endif
+ #ifdef UNAME_PROCESSOR
+       if (element == unknown)
+@@ -293,7 +389,7 @@
+ 
+   if (toprint & PRINT_HARDWARE_PLATFORM)
+     {
+-      char const *element = unknown;
++      char *element = unknown;
+ #if HAVE_SYSINFO && defined SI_PLATFORM
+       {
+ 	static char hardware_platform[257];
+@@ -301,6 +397,15 @@
+ 			  hardware_platform, sizeof hardware_platform))
+ 	  element = hardware_platform;
+       }
++#else
++      {
++	struct utsname u;
++	uname (&u);
++	element = u.machine;
++	if (strlen (element) == 4 && element[0] == 'i' && element[2] == '8'
++	    && element[3] == '6')
++	  element[1] = '3';
++      }
+ #endif
+ #ifdef UNAME_HARDWARE_PLATFORM
+       if (element == unknown)
+@@ -323,3 +428,29 @@
+ 
+   exit (EXIT_SUCCESS);
+ }
++
++#ifdef linux
++
++/******************************************************************************
++ *
++ * int has_sse( void )
++ * Checks Athlon CPU's to see if they support SSE.
++ *
++ *****************************************************************************/
++
++int has_sse( void )
++{
++  unsigned long edx, unused;
++  int sse;
++  cpuid(1,unused,unused,unused,edx);
++  // I think, I need this tested on a Duron with SSE
++  // and one without it.
++  sse = edx & 0x2000000;
++  if( sse == 0 ) {
++    return 0;
++  } else {
++    return 1;
++  }
++
++}
++#endif
Index: patches/dvhtool-1.0.1-fixes-1.patch
===================================================================
--- patches/dvhtool-1.0.1-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/dvhtool-1.0.1-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,169 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-11-20
+Initial Package Version: 1.0.1
+Origin: Gentoo and Debian
+Upstream Status: Applied
+Description: Fixes Build issues with Dvhtool
+             Adds support for LVM and Linux Partitions
+ 
+diff -Naur dvhtool-1.0.1.orig/Makefile.in dvhtool-1.0.1/Makefile.in
+--- dvhtool-1.0.1.orig/Makefile.in	2001-04-17 18:07:24.000000000 +0000
++++ dvhtool-1.0.1/Makefile.in	2005-11-21 03:17:54.000000000 +0000
+@@ -1,4 +1,4 @@
+-# Makefile.in generated automatically by automake 1.4a from Makefile.am
++# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
+ 
+ # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+ # This Makefile.in is free software; the Free Software Foundation
+@@ -46,10 +46,9 @@
+ AUTOHEADER = @AUTOHEADER@
+ 
+ INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@
++INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+ INSTALL_DATA = @INSTALL_DATA@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+-INSTALL_STRIP_FLAG =
+ transform = @program_transform_name@
+ 
+ NORMAL_INSTALL = :
+@@ -104,7 +103,7 @@
+ 
+ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+ 
+-TAR = gtar
++TAR = tar
+ GZIP_ENV = --best
+ DEP_FILES =  .deps/dvhlib.P .deps/dvhtool.P .deps/getopt.P \
+ .deps/getopt1.P .deps/pread.P
+@@ -124,7 +123,7 @@
+ $(ACLOCAL_M4):  configure.in  acinclude.m4
+ 	cd $(srcdir) && $(ACLOCAL)
+ 
+-config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
++config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES)
+ 	$(SHELL) ./config.status --recheck
+ $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ 	cd $(srcdir) && $(AUTOCONF)
+@@ -173,8 +172,8 @@
+ 	$(mkinstalldirs) $(DESTDIR)$(sbindir)
+ 	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ 	  if test -f $$p; then \
+-	    echo "  $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+-	     $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
++	    echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
++	     $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ 	  else :; fi; \
+ 	done
+ 
+@@ -382,7 +381,7 @@
+ all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) config.h
+ all-redirect: all-am
+ install-strip:
+-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
++	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+ installdirs:
+ 	$(mkinstalldirs)  $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
+ 
+diff -Naur dvhtool-1.0.1.orig/aclocal.m4 dvhtool-1.0.1/aclocal.m4
+--- dvhtool-1.0.1.orig/aclocal.m4	2000-11-07 00:05:27.000000000 +0000
++++ dvhtool-1.0.1/aclocal.m4	2005-11-21 03:17:54.000000000 +0000
+@@ -1,4 +1,4 @@
+-dnl aclocal.m4 generated automatically by aclocal 1.4a
++dnl aclocal.m4 generated automatically by aclocal 1.4-p4
+ 
+ dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+ dnl This file is free software; the Free Software Foundation
+@@ -51,8 +51,6 @@
+ 
+ AC_DEFUN(AM_INIT_AUTOMAKE,
+ [AC_REQUIRE([AC_PROG_INSTALL])
+-dnl We require 2.13 because we rely on SHELL being computed by configure.
+-AC_PREREQ([2.13])
+ PACKAGE=[$1]
+ AC_SUBST(PACKAGE)
+ VERSION=[$2]
+diff -Naur dvhtool-1.0.1.orig/dvh.h dvhtool-1.0.1/dvh.h
+--- dvhtool-1.0.1.orig/dvh.h	2001-02-22 02:29:45.000000000 +0000
++++ dvhtool-1.0.1/dvh.h	2005-11-21 03:18:42.000000000 +0000
+@@ -127,6 +127,10 @@
+ #define	PTYPE_XFSLOG	11		/* partition is sgi XFS log */
+ #define	PTYPE_XLV	12		/* partition is part of an XLV vol */
+ #define	PTYPE_XVM	13		/* partition is sgi XVM */
++#define	PTYPE_LSWAP	0x82		/* partition is Linux swap */
++#define	PTYPE_LINUX	0x83		/* partition is Linux native */
++#define PTYPE_LLVM	0x8e		/* partition is Linux LVM */
++#define PTYPE_LRAID	0xfd		/* partition is Linux RAID */
+ #define NPTYPES		16
+ 
+ #define	VHMAGIC		0xbe5a941	/* randomly chosen value */
+diff -Naur dvhtool-1.0.1.orig/dvhlib.c dvhtool-1.0.1/dvhlib.c
+--- dvhtool-1.0.1.orig/dvhlib.c	2001-02-24 10:37:37.000000000 +0000
++++ dvhtool-1.0.1/dvhlib.c	2005-11-21 03:18:42.000000000 +0000
+@@ -50,6 +50,10 @@
+ 	case PTYPE_XFSLOG:	return "XFS Log";
+ 	case PTYPE_XLV:		return "XLV Volume";
+ 	case PTYPE_XVM:		return "XVM Volume";
++	case PTYPE_LSWAP:	return "Linux Swap";
++	case PTYPE_LINUX:	return "Linux Native";
++	case PTYPE_LLVM:	return "Linux LVM";
++	case PTYPE_LRAID:	return "Linux RAID";
+ 	}
+ 	return "Unknown Partition Type";
+ }
+@@ -325,8 +329,10 @@
+ 	if (res == -1)
+ 		die("Couldn't stat source file");
+ 
+-	/* XXX pad to blocksize? */
+-	size = vh->vh_pt[8].pt_nblks * blksize - istat.st_size;
++	/* calculate free blocks in vh */
++	size = vh->vh_pt[8].pt_nblks				/* total vh size */
++		- ( vh->vh_pt[8].pt_firstlbn + 4 )		/* reserved area */
++		- (( istat.st_size + blksize - 1 ) / blksize );	/* pad to blocksize */
+ 	/*
+ 	 * Are we replacing an existing file, check for enough space and free
+ 	 * entry in volume header
+@@ -336,16 +342,15 @@
+ 			/* It's an existing file, delete it.  */
+ 			memset(vd->vd_name, 0, VDNAMESIZE);
+ 			vd->vd_nbytes = 0;
+-			break;
+ 		}
+ 		if ( vd->vd_nbytes ) {
+-			size -= vd->vd_nbytes;
++			size -= (vd->vd_nbytes + blksize - 1 ) / blksize; /* pad to blocksize */
+ 			num++;
+ 		}
+ 		vd++;
+ 	}
+ 
+-	if ( num == NVDIR ) 
++	if ( num == NVDIR )
+ 		die("No more free entries in volume header");
+ 	if ( size <= 0 )
+ 		die("Not enough space left in volume header");
+@@ -403,7 +408,7 @@
+ 				die("Short write");
+ 			}
+ 		}
+-		dest += (vd->vd_nbytes + 511) / 512;	/* XXX Blocksize  */
++		dest += (vd->vd_nbytes + blksize - 1) / blksize;
+ 		vd++;
+ 	}
+ 
+diff -Naur dvhtool-1.0.1.orig/dvhtool.8 dvhtool-1.0.1/dvhtool.8
+--- dvhtool-1.0.1.orig/dvhtool.8	2001-02-24 10:37:37.000000000 +0000
++++ dvhtool-1.0.1/dvhtool.8	2005-11-21 03:17:54.000000000 +0000
+@@ -1,4 +1,4 @@
+-.TH DVHTOOL 1 "July 2000"
++.TH DVHTOOL 8 "July 2000"
+ .UC 4
+ .SH NAME
+ dvhtool \- Disk volume header manipulation tool
+@@ -85,4 +85,4 @@
+ .PP
+ .I dvhtool
+ was written by Ralf Baechle <ralf@oss.sgi.com>, Keith M. Wesolowski <wesolows@foobazco.org>,
+-Tor Arntsen <tor@spacetec.no>, Guido Guenther <guido.guenther@gmx.net>. 
++Tor Arntsen <tor@spacetec.no>, Guido Guenther <agx@debian.org>. 
Index: patches/elftoaout-2.3-64bit_fixes-1.patch
===================================================================
--- patches/elftoaout-2.3-64bit_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/elftoaout-2.3-64bit_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,261 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2006-01-03
+Initial Package Version: 2.3
+Origin: Dave Miller
+Upstream Status: Unknown
+Description: Fixes 64 Bit Issues with Elftoaout
+
+	http://marc.theaimsgroup.com/?l=linux-sparc&m=113617505627794&w=2
+ 
+diff -Naur elftoaout-2.3.orig/elftoaout.c elftoaout-2.3/elftoaout.c
+--- elftoaout-2.3.orig/elftoaout.c	2000-06-03 20:20:12.000000000 +0000
++++ elftoaout-2.3/elftoaout.c	2006-01-03 22:33:28.000000000 +0000
+@@ -20,16 +20,36 @@
+  */
+ #include <stdio.h>
+ #include <stdlib.h>
+-#ifdef linux
+ #include <linux/elf.h>
+-#define ELFDATA2MSB   2
+-#else
+-#include <sys/elf.h>
+-#endif
+-
+-#define swab16(x)  (((x)<<8&0xFF00)|((x)>>8&0x00FF))
+-#define swab32(x)  (((x)<<24&0xFF000000)|((x)<<8&0x00FF0000)|((x)>>24&0x000000FF)|((x)>>8&0x0000FF00))
+-#define swab64(x)  ((((unsigned long long)(swab32((unsigned int)x))) << 32) | (swab32(((unsigned long long)x)>>32)))
++#include <sys/types.h>
++
++static inline u_int16_t swab16(u_int16_t x)
++{
++	return (((x << 8)  & 0xFF00) |
++		((x >> 8) & 0x00FF));
++}
++
++static inline u_int32_t swab32(u_int32_t x)
++{
++	return (((x << 24) & 0xFF000000) |
++		((x <<  8) & 0x00FF0000) |
++		((x >> 24) & 0x000000FF) |
++		((x >>  8) & 0x0000FF00));
++}
++
++static inline u_int64_t swab64(u_int64_t x)
++{
++	return ((u_int64_t)
++	((u_int64_t)(((u_int64_t)x & (u_int64_t)0x00000000000000ffULL) << 56) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0x000000000000ff00ULL) << 40) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0x0000000000ff0000ULL) << 24) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0x00000000ff000000ULL) <<  8) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0x000000ff00000000ULL) >>  8) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0x0000ff0000000000ULL) >> 24) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0x00ff000000000000ULL) >> 40) |
++	 (u_int64_t)(((u_int64_t)x & (u_int64_t)0xff00000000000000ULL) >> 56)));
++}
++
+ 
+ /* We carry a.out header here in order to compile the thing on Solaris */
+ 
+@@ -37,14 +57,14 @@
+ #define	CMAGIC	    0x01030108
+ 
+ typedef struct {
+-	unsigned long	a_magic;	/* magic number */
+-	unsigned long	a_text;		/* size of text segment */
+-	unsigned long	a_data;		/* size of initialized data */
+-	unsigned long	a_bss;		/* size of uninitialized data */
+-	unsigned long	a_syms;		/* size of symbol table || checksum */
+-	unsigned long	a_entry;	/* entry point */
+-	unsigned long	a_trsize;	/* size of text relocation */
+-	unsigned long	a_drsize;	/* size of data relocation */
++	u_int32_t	a_magic;	/* magic number */
++	u_int32_t	a_text;		/* size of text segment */
++	u_int32_t	a_data;		/* size of initialized data */
++	u_int32_t	a_bss;		/* size of uninitialized data */
++	u_int32_t	a_syms;		/* size of symbol table || checksum */
++	u_int32_t	a_entry;	/* entry point */
++	u_int32_t	a_trsize;	/* size of text relocation */
++	u_int32_t	a_drsize;	/* size of data relocation */
+ } Exec;
+ 
+ 
+@@ -56,17 +76,16 @@
+ 	int swab;
+ 	int sparc64;
+ 	int csum;
+-	/* friend void Usage(void); */
+ } Application;
+ 
+ typedef struct {
+ 	Elf32_Phdr *tab;
+-	unsigned len;
++	unsigned int len;
+ } ProgTable;
+ 
+ typedef struct {
+ 	Elf64_Phdr *tab;
+-	unsigned len;
++	unsigned int len;
+ } ProgTable64;
+ 
+ void get_ptab(ProgTable *t, FILE *inp, const Elf32_Ehdr *h);
+@@ -75,9 +94,9 @@
+ void print_ptab64(ProgTable64 *t);
+ 
+ typedef struct {
+-	char *buf;                /* Image data */
+-	unsigned len;             /* Length of buffer */
+-	unsigned bss;             /* Length of extra data */
++	unsigned char *buf;       /* Image data */
++	unsigned int len;         /* Length of buffer */
++	unsigned int bss;         /* Length of extra data */
+ } Segment;
+ 
+ void load_image(Segment *t, const ProgTable *h, FILE *inp);
+@@ -105,7 +124,8 @@
+ 
+ 	parse_args(&prog, argc, argv);
+ 
+-	if (prog.version) Version();
++	if (prog.version)
++		Version();
+ 
+ 	if (freopen(prog.iname, "r", stdin) == NULL) {
+ 		fprintf(stderr, "Cannot open \"%s\"\n", prog.iname);
+@@ -141,7 +161,8 @@
+ 	exit(0);
+ }
+ 
+-void parse_args( Application *t, unsigned argc, const char **argv ){
++void parse_args( Application *t, unsigned argc, const char **argv )
++{
+ 	const char *arg;
+ 	union {
+ 		char c[4];
+@@ -185,8 +206,8 @@
+ 	if (t->csum && t->sun4_mode) Usage ();	/* Checksum lives in header. */
+ }
+ 
+-void get_header(Elf32_Ehdr *t, FILE *inp) {
+-
++void get_header(Elf32_Ehdr *t, FILE *inp)
++{
+         if (fread((void*) t, sizeof(Elf64_Ehdr), 1, inp) != 1) {
+ 		fprintf(stderr, "Read error on header\n");
+ 		exit(1);
+@@ -249,8 +270,9 @@
+ 	}
+ }
+ 
+-void get_ptab(ProgTable *t, FILE *inp, const Elf32_Ehdr *h) {
+-	unsigned x;
++void get_ptab(ProgTable *t, FILE *inp, const Elf32_Ehdr *h)
++{
++	unsigned int x;
+ 
+ 	/** fprintf(stderr, "Program header table off = 0x%x\n",
+ 		(unsigned) h->e_phoff); **/
+@@ -294,8 +316,9 @@
+ 	}
+ }
+ 
+-void get_ptab64(ProgTable64 *t, FILE *inp, const Elf64_Ehdr *h) {
+-	unsigned x;
++void get_ptab64(ProgTable64 *t, FILE *inp, const Elf64_Ehdr *h)
++{
++	unsigned int x;
+ 
+ 	if (h->e_phoff == 0) {
+ 		fprintf(stderr, "No Program Header Table\n");
+@@ -332,8 +355,9 @@
+ 	}
+ }
+ 
+-void print_ptab(ProgTable *t) {
+-	unsigned x;
++void print_ptab(ProgTable *t)
++{
++	unsigned int x;
+ 	const Elf32_Phdr *p;
+ 
+ 	for (x = 0; x < t->len; x++) {
+@@ -374,8 +398,9 @@
+ 	}
+ }
+ 
+-void print_ptab64(ProgTable64 *t) {
+-	unsigned x;
++void print_ptab64(ProgTable64 *t)
++{
++	unsigned int x;
+ 	const Elf64_Phdr *p;
+ 
+ 	for (x = 0; x < t->len; x++) {
+@@ -387,8 +412,11 @@
+ 			break;
+ 		case PT_LOAD:
+ 			printf("Loadable to 0x%Lx[0x%Lx] from 0x%Lx[0x%Lx] align 0x%Lx",
+-				p->p_vaddr, p->p_memsz, p->p_offset, p->p_filesz,
+-				p->p_align);
++			       (unsigned long long) p->p_vaddr,
++			       (unsigned long long) p->p_memsz,
++			       (unsigned long long) p->p_offset,
++			       (unsigned long long) p->p_filesz,
++			       (unsigned long long) p->p_align);
+ 			break;
+ 		case PT_DYNAMIC:
+ 			printf("Dynamic");
+@@ -416,9 +444,10 @@
+ 	}
+ }
+ 
+-void load_image(Segment *t, const ProgTable *tp, FILE *inp) {
++void load_image(Segment *t, const ProgTable *tp, FILE *inp)
++{
+ 	Elf32_Phdr *p, *q;
+-	unsigned x;
++	unsigned int x;
+ 	unsigned long off, len;
+ 
+ 	p = 0;
+@@ -484,9 +513,10 @@
+ 	}
+ }
+ 
+-void load_image64(Segment *t, const ProgTable64 *tp, FILE *inp) {
++void load_image64(Segment *t, const ProgTable64 *tp, FILE *inp)
++{
+ 	Elf64_Phdr *p, *q;
+-	unsigned x;
++	unsigned int x;
+ 	unsigned long long off, len;
+ 
+ 	p = 0;
+@@ -547,7 +577,8 @@
+ 	}
+ }
+ 
+-void store_image(Segment *t, FILE *out) {
++void store_image(Segment *t, FILE *out)
++{
+ 	Exec ohdb;
+ 
+ 	if (prog.swab) {
+@@ -585,13 +616,15 @@
+ 	return;
+ }
+ 
+-void Usage(){
++void Usage()
++{
+ 	if (prog.version) Version();
+ 	fprintf(stderr, "Usage: elftoaout [-o output] [-c|-b] [-V] input\n");
+ 	exit(1);
+ }
+ 
+-void Version(){
++void Version()
++{
+ 	printf("elftoaout 2.3: ELF to a.out convertor for SPARC and SPARC64 bootstraps\n");
+ }
+ 
Index: patches/expect-5.43.0-mips_config_update-1.patch
===================================================================
--- patches/expect-5.43.0-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/expect-5.43.0-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,2049 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-12-26
+Initial Package Version: 5.4.3
+Origin: Jim Gifford
+Upstream Status: Unknown
+Description: Updates config.sub and config.guess
+ 
+diff -Naur expect-5.43.orig/config.guess expect-5.43/config.guess
+--- expect-5.43.orig/config.guess	2002-03-23 04:46:44.000000000 +0000
++++ expect-5.43/config.guess	2005-12-27 04:16:22.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-#   2000, 2001, 2002 Free Software Foundation, Inc.
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2002-03-04'
++timestamp='2004-11-12'
+ 
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+@@ -53,7 +53,7 @@
+ GNU config.guess ($timestamp)
+ 
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -88,30 +88,42 @@
+   exit 1
+ fi
+ 
++trap 'exit 1' 1 2 15
+ 
+-dummy=dummy-$$
+-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
++# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
++# compiler to aid in system detection is discouraged as it requires
++# temporary files to be created and, as you can see below, it is a
++# headache to deal with in a portable fashion.
+ 
+-# CC_FOR_BUILD -- compiler used by this script.
+ # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+ # use `HOST_CC' if defined, but it is deprecated.
+ 
+-set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+- ,,)    echo "int dummy(){}" > $dummy.c ;
+-	for c in cc gcc c89 ; do
+-	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+-	  if test $? = 0 ; then
++# Portable tmp directory creation inspired by the Autoconf team.
++
++set_cc_for_build='
++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
++: ${TMPDIR=/tmp} ;
++ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
++dummy=$tmp/dummy ;
++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
++case $CC_FOR_BUILD,$HOST_CC,$CC in
++ ,,)    echo "int x;" > $dummy.c ;
++	for c in cc gcc c89 c99 ; do
++	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ 	     CC_FOR_BUILD="$c"; break ;
+ 	  fi ;
+ 	done ;
+-	rm -f $dummy.c $dummy.o $dummy.rel ;
+ 	if test x"$CC_FOR_BUILD" = x ; then
+ 	  CC_FOR_BUILD=no_compiler_found ;
+ 	fi
+ 	;;
+  ,,*)   CC_FOR_BUILD=$CC ;;
+  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+-esac'
++esac ;'
+ 
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+ # (ghazi@noc.rutgers.edu 1994-08-24)
+@@ -142,6 +154,7 @@
+ 	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ 	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ 	case "${UNAME_MACHINE_ARCH}" in
++	    armeb) machine=armeb-unknown ;;
+ 	    arm*) machine=arm-unknown ;;
+ 	    sh3el) machine=shl-unknown ;;
+ 	    sh3eb) machine=sh-unknown ;;
+@@ -167,21 +180,38 @@
+ 		;;
+ 	esac
+ 	# The OS release
+-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++	# Debian GNU/NetBSD machines have a different userland, and
++	# thus, need a distinct triplet. However, they do not need
++	# kernel version information, so it can be replaced with a
++	# suitable tag, in the style of linux-gnu.
++	case "${UNAME_VERSION}" in
++	    Debian*)
++		release='-gnu'
++		;;
++	    *)
++		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++		;;
++	esac
+ 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ 	# contains redundant information, the shorter form:
+ 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ 	echo "${machine}-${os}${release}"
+ 	exit 0 ;;
++    amd64:OpenBSD:*:*)
++	echo x86_64-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
+     amiga:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    arc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++    cats:OpenBSD:*:*)
++	echo arm-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+     hp300:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
++    luna88k:OpenBSD:*:*)
++    	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
+     mac68k:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -197,83 +227,76 @@
+     mvmeppc:OpenBSD:*:*)
+ 	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    pmax:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     sgi:OpenBSD:*:*)
+-	echo mipseb-unknown-openbsd${UNAME_RELEASE}
++	echo mips64-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+     sun3:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    wgrisc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     *:OpenBSD:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
++    *:ekkoBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:MirBSD:*:*)
++	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:MirBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
+     alpha:OSF1:*:*)
+-	if test $UNAME_RELEASE = "V4.0"; then
++	case $UNAME_RELEASE in
++	*4.0)
+ 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+-	fi
++		;;
++	*5.*)
++	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++		;;
++	esac
++	# According to Compaq, /usr/sbin/psrinfo has been available on
++	# OSF/1 and Tru64 systems produced since 1995.  I hope that
++	# covers most systems running today.  This code pipes the CPU
++	# types through head -n 1, so we only detect the type of CPU 0.
++	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
++	case "$ALPHA_CPU_TYPE" in
++	    "EV4 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV4.5 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "LCA4 (21066/21068)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV5 (21164)")
++		UNAME_MACHINE="alphaev5" ;;
++	    "EV5.6 (21164A)")
++		UNAME_MACHINE="alphaev56" ;;
++	    "EV5.6 (21164PC)")
++		UNAME_MACHINE="alphapca56" ;;
++	    "EV5.7 (21164PC)")
++		UNAME_MACHINE="alphapca57" ;;
++	    "EV6 (21264)")
++		UNAME_MACHINE="alphaev6" ;;
++	    "EV6.7 (21264A)")
++		UNAME_MACHINE="alphaev67" ;;
++	    "EV6.8CB (21264C)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8AL (21264B)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8CX (21264D)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.9A (21264/EV69A)")
++		UNAME_MACHINE="alphaev69" ;;
++	    "EV7 (21364)")
++		UNAME_MACHINE="alphaev7" ;;
++	    "EV7.9 (21364A)")
++		UNAME_MACHINE="alphaev79" ;;
++	esac
++	# A Pn.n version is a patched version.
+ 	# A Vn.n version is a released version.
+ 	# A Tn.n version is a released field test version.
+ 	# A Xn.n version is an unreleased experimental baselevel.
+ 	# 1.2 uses "1.2" for uname -r.
+-	cat <<EOF >$dummy.s
+-	.data
+-\$Lformat:
+-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+-
+-	.text
+-	.globl main
+-	.align 4
+-	.ent main
+-main:
+-	.frame \$30,16,\$26,0
+-	ldgp \$29,0(\$27)
+-	.prologue 1
+-	.long 0x47e03d80 # implver \$0
+-	lda \$2,-1
+-	.long 0x47e20c21 # amask \$2,\$1
+-	lda \$16,\$Lformat
+-	mov \$0,\$17
+-	not \$1,\$18
+-	jsr \$26,printf
+-	ldgp \$29,0(\$26)
+-	mov 0,\$16
+-	jsr \$26,exit
+-	.end main
+-EOF
+-	eval $set_cc_for_build
+-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		case `./$dummy` in
+-			0-0)
+-				UNAME_MACHINE="alpha"
+-				;;
+-			1-0)
+-				UNAME_MACHINE="alphaev5"
+-				;;
+-			1-1)
+-				UNAME_MACHINE="alphaev56"
+-				;;
+-			1-101)
+-				UNAME_MACHINE="alphapca56"
+-				;;
+-			2-303)
+-				UNAME_MACHINE="alphaev6"
+-				;;
+-			2-307)
+-				UNAME_MACHINE="alphaev67"
+-				;;
+-			2-1307)
+-				UNAME_MACHINE="alphaev68"
+-				;;
+-		esac
+-	fi
+-	rm -f $dummy.s $dummy
+-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ 	exit 0 ;;
+     Alpha\ *:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+@@ -296,6 +319,12 @@
+     *:OS/390:*:*)
+ 	echo i370-ibm-openedition
+ 	exit 0 ;;
++    *:z/VM:*:*)
++	echo s390-ibm-zvmoe
++	exit 0 ;;
++    *:OS400:*:*)
++        echo powerpc-ibm-os400
++	exit 0 ;;
+     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ 	echo arm-acorn-riscix${UNAME_RELEASE}
+ 	exit 0;;
+@@ -313,6 +342,13 @@
+     NILE*:*:*:dcosx)
+ 	echo pyramid-pyramid-svr4
+ 	exit 0 ;;
++    DRS?6000:unix:4.0:6*)
++	echo sparc-icl-nx6
++	exit 0 ;;
++    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
++	case `/usr/bin/uname -p` in
++	    sparc) echo sparc-icl-nx7 && exit 0 ;;
++	esac ;;
+     sun4H:SunOS:5.*:*)
+ 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+@@ -381,6 +417,9 @@
+     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+         echo m68k-unknown-mint${UNAME_RELEASE}
+         exit 0 ;;
++    m68k:machten:*:*)
++	echo m68k-apple-machten${UNAME_RELEASE}
++	exit 0 ;;
+     powerpc:machten:*:*)
+ 	echo powerpc-apple-machten${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -419,15 +458,20 @@
+ 	  exit (-1);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy \
+-	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+-	  && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	$CC_FOR_BUILD -o $dummy $dummy.c \
++	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
++	  && exit 0
+ 	echo mips-mips-riscos${UNAME_RELEASE}
+ 	exit 0 ;;
+     Motorola:PowerMAX_OS:*:*)
+ 	echo powerpc-motorola-powermax
+ 	exit 0 ;;
++    Motorola:*:4.3:PL8-*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
++    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
+     Night_Hawk:Power_UNIX:*:*)
+ 	echo powerpc-harris-powerunix
+ 	exit 0 ;;
+@@ -500,8 +544,7 @@
+ 			exit(0);
+ 			}
+ EOF
+-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-		rm -f $dummy.c $dummy
++		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 		echo rs6000-ibm-aix3.2.5
+ 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ 		echo rs6000-ibm-aix3.2.4
+@@ -599,11 +642,21 @@
+                   exit (0);
+               }
+ EOF
+-		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
+-		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+-		    rm -f $dummy.c $dummy
++		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
++		    test -z "$HP_ARCH" && HP_ARCH=hppa
+ 		fi ;;
+ 	esac
++	if [ ${HP_ARCH} = "hppa2.0w" ]
++	then
++	    # avoid double evaluation of $set_cc_for_build
++	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
++	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++	    then
++		HP_ARCH="hppa2.0w"
++	    else
++		HP_ARCH="hppa64"
++	    fi
++	fi
+ 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     ia64:HP-UX:*:*)
+@@ -637,8 +690,7 @@
+ 	  exit (0);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 	echo unknown-hitachi-hiuxwe2
+ 	exit 0 ;;
+     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+@@ -696,21 +748,26 @@
+     CRAY*TS:*:*:*)
+ 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY*T3D:*:*:*)
+-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+-	exit 0 ;;
+     CRAY*T3E:*:*:*)
+ 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*SV1:*:*:*)
+ 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
++    *:UNICOS/mp:*:*)
++	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++	exit 0 ;;
+     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+         exit 0 ;;
++    5000:UNIX_System_V:4.*:*)
++        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++	exit 0 ;;
+     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -732,14 +789,17 @@
+     i*:PW*:*)
+ 	echo ${UNAME_MACHINE}-pc-pw32
+ 	exit 0 ;;
+-    x86:Interix*:3*)
+-	echo i386-pc-interix3
++    x86:Interix*:[34]*)
++	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
++	exit 0 ;;
++    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
++	echo i${UNAME_MACHINE}-pc-mks
+ 	exit 0 ;;
+     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+ 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ 	# UNAME_MACHINE based on the output of uname instead of i386?
+-	echo i386-pc-interix
++	echo i586-pc-interix
+ 	exit 0 ;;
+     i*:UWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-uwin
+@@ -751,16 +811,33 @@
+ 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+     *:GNU:*:*)
++	# the GNU system
+ 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ 	exit 0 ;;
++    *:GNU/*:*:*)
++	# other systems with GNU libc and userland
++	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++	exit 0 ;;
+     i*86:Minix:*:*)
+ 	echo ${UNAME_MACHINE}-pc-minix
+ 	exit 0 ;;
+     arm*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    cris:Linux:*:*)
++	echo cris-axis-linux-gnu
++	exit 0 ;;
++    crisv32:Linux:*:*)
++	echo crisv32-axis-linux-gnu
++	exit 0 ;;
++    frv:Linux:*:*)
++    	echo frv-unknown-linux-gnu
++	exit 0 ;;
+     ia64:Linux:*:*)
+-	echo ${UNAME_MACHINE}-unknown-linux
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
++    m32r*:Linux:*:*)
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+     m68*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+@@ -771,19 +848,37 @@
+ 	#undef CPU
+ 	#undef mips
+ 	#undef mipsel
+-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) 
+-	CPU=mipsel 
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mipsel
+ 	#else
+-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) 
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ 	CPU=mips
+ 	#else
+ 	CPU=
+ 	#endif
+-	#endif 
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++	;;
++    mips64:Linux:*:*)
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips64
++	#undef mips64el
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mips64el
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips64
++	#else
++	CPU=
++	#endif
++	#endif
+ EOF
+ 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+-	rm -f $dummy.c
+-	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ 	;;
+     ppc:Linux:*:*)
+ 	echo powerpc-unknown-linux-gnu
+@@ -819,6 +914,9 @@
+     s390:Linux:*:* | s390x:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-ibm-linux
+ 	exit 0 ;;
++    sh64*:Linux:*:*)
++    	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     sh*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -845,7 +943,7 @@
+ 		;;
+ 	  a.out-i386-linux)
+ 		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+-		exit 0 ;;		
++		exit 0 ;;
+ 	  coff-i386)
+ 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ 		exit 0 ;;
+@@ -876,9 +974,11 @@
+ 	LIBC=gnuaout
+ 	#endif
+ 	#endif
++	#ifdef __dietlibc__
++	LIBC=dietlibc
++	#endif
+ EOF
+ 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+-	rm -f $dummy.c
+ 	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ 	;;
+@@ -896,6 +996,26 @@
+         # Use sysv4.2uw... so that sysv4* matches it.
+ 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ 	exit 0 ;;
++    i*86:OS/2:*:*)
++	# If we were able to find `uname', then EMX Unix compatibility
++	# is probably installed.
++	echo ${UNAME_MACHINE}-pc-os2-emx
++	exit 0 ;;
++    i*86:XTS-300:*:STOP)
++	echo ${UNAME_MACHINE}-unknown-stop
++	exit 0 ;;
++    i*86:atheos:*:*)
++	echo ${UNAME_MACHINE}-unknown-atheos
++	exit 0 ;;
++	i*86:syllable:*:*)
++	echo ${UNAME_MACHINE}-pc-syllable
++	exit 0 ;;
++    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
++	echo i386-unknown-lynxos${UNAME_RELEASE}
++	exit 0 ;;
++    i*86:*DOS:*:*)
++	echo ${UNAME_MACHINE}-pc-msdosdjgpp
++	exit 0 ;;
+     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+@@ -917,22 +1037,19 @@
+ 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
++		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
++		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
++		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ 			&& UNAME_MACHINE=i586
+-		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
++		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ 			&& UNAME_MACHINE=i686
+-		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
++		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ 			&& UNAME_MACHINE=i686
+ 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ 	else
+ 		echo ${UNAME_MACHINE}-pc-sysv32
+ 	fi
+ 	exit 0 ;;
+-    i*86:*DOS:*:*)
+-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+-	exit 0 ;;
+     pc:*:*:*)
+ 	# Left here for compatibility:
+         # uname -m prints for DJGPP always 'pc', but it prints nothing about
+@@ -956,9 +1073,15 @@
+ 	# "miniframe"
+ 	echo m68010-convergent-sysv
+ 	exit 0 ;;
+-    M68*:*:R3V[567]*:*)
++    mc68k:UNIX:SYSTEM5:3.51m)
++	echo m68k-convergent-sysv
++	exit 0 ;;
++    M680?0:D-NIX:5.3:*)
++	echo m68k-diab-dnix
++	exit 0 ;;
++    M68*:*:R3V[5678]*:*)
+ 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
++    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ 	OS_REL=''
+ 	test -r /etc/.relid \
+ 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+@@ -975,9 +1098,6 @@
+     mc68030:UNIX_System_V:4.*:*)
+ 	echo m68k-atari-sysv4
+ 	exit 0 ;;
+-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+-	echo i386-unknown-lynxos${UNAME_RELEASE}
+-	exit 0 ;;
+     TSUNAMI:LynxOS:2.*:*)
+ 	echo sparc-unknown-lynxos${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1049,6 +1169,9 @@
+     SX-5:SUPER-UX:*:*)
+ 	echo sx5-nec-superux${UNAME_RELEASE}
+ 	exit 0 ;;
++    SX-6:SUPER-UX:*:*)
++	echo sx6-nec-superux${UNAME_RELEASE}
++	exit 0 ;;
+     Power*:Rhapsody:*:*)
+ 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1056,20 +1179,25 @@
+ 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:Darwin:*:*)
+-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
++	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
++	case $UNAME_PROCESSOR in
++	    *86) UNAME_PROCESSOR=i686 ;;
++	    unknown) UNAME_PROCESSOR=powerpc ;;
++	esac
++	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:procnto*:*:* | *:QNX:[0123456789]*:*)
+-	if test "${UNAME_MACHINE}" = "x86pc"; then
++	UNAME_PROCESSOR=`uname -p`
++	if test "$UNAME_PROCESSOR" = "x86"; then
++		UNAME_PROCESSOR=i386
+ 		UNAME_MACHINE=pc
+-		echo i386-${UNAME_MACHINE}-nto-qnx
+-	else
+-		echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ 	fi
++	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:QNX:*:4*)
+ 	echo i386-pc-qnx
+ 	exit 0 ;;
+-    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
++    NSR-?:NONSTOP_KERNEL:*:*)
+ 	echo nsr-tandem-nsk${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:NonStop-UX:*:*)
+@@ -1092,11 +1220,6 @@
+ 	fi
+ 	echo ${UNAME_MACHINE}-unknown-plan9
+ 	exit 0 ;;
+-    i*86:OS/2:*:*)
+-	# If we were able to find `uname', then EMX Unix compatibility
+-	# is probably installed.
+-	echo ${UNAME_MACHINE}-pc-os2-emx
+-	exit 0 ;;
+     *:TOPS-10:*:*)
+ 	echo pdp10-unknown-tops10
+ 	exit 0 ;;
+@@ -1115,11 +1238,21 @@
+     *:ITS:*:*)
+ 	echo pdp10-unknown-its
+ 	exit 0 ;;
+-    i*86:XTS-300:*:STOP)
+-	echo ${UNAME_MACHINE}-unknown-stop
++    SEI:*:*:SEIUX)
++        echo mips-sei-seiux${UNAME_RELEASE}
+ 	exit 0 ;;
+-    i*86:atheos:*:*)
+-	echo ${UNAME_MACHINE}-unknown-atheos
++    *:DragonFly:*:*)
++	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++	exit 0 ;;
++    *:*VMS:*:*)
++    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
++	case "${UNAME_MACHINE}" in
++	    A*) echo alpha-dec-vms && exit 0 ;;
++	    I*) echo ia64-dec-vms && exit 0 ;;
++	    V*) echo vax-dec-vms && exit 0 ;;
++	esac ;;
++    *:XENIX:*:SysV)
++	echo i386-pc-xenix
+ 	exit 0 ;;
+ esac
+ 
+@@ -1241,8 +1374,7 @@
+ }
+ EOF
+ 
+-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-rm -f $dummy.c $dummy
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+ 
+ # Apollos put the system type in the environment.
+ 
+diff -Naur expect-5.43.orig/config.sub expect-5.43/config.sub
+--- expect-5.43.orig/config.sub	2002-02-12 02:00:55.000000000 +0000
++++ expect-5.43/config.sub	2005-12-27 04:16:26.000000000 +0000
+@@ -1,6 +1,10 @@
+ #! /bin/sh
+-# Configuration validation subroutine script, version 1.1.
+-#   Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
++# Configuration validation subroutine script.
++#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
++
++timestamp='2004-11-30'
++
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+ # can handle that machine.  It does not imply ALL GNU software can.
+@@ -25,6 +29,9 @@
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+ 
++# Please send patches to <config-patches@gnu.org>.  Submit a context
++# diff and a properly formatted ChangeLog entry.
++#
+ # Configuration subroutine to validate and canonicalize a configuration type.
+ # Supply the specified configuration type as an argument.
+ # If it is invalid, we print an error message on stderr and exit with code 1.
+@@ -45,30 +52,74 @@
+ #	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+ # It is wrong to echo any other type of specification.
+ 
+-if [ x$1 = x ]
+-then
+-	echo Configuration name missing. 1>&2
+-	echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+-	echo "or     $0 ALIAS" 1>&2
+-	echo where ALIAS is a recognized configuration type. 1>&2
+-	exit 1
+-fi
++me=`echo "$0" | sed -e 's,.*/,,'`
+ 
+-# First pass through any local machine types.
+-case $1 in
+-	*local*)
+-		echo $1
+-		exit 0
+-		;;
+-	*)
+-	;;
++usage="\
++Usage: $0 [OPTION] CPU-MFR-OPSYS
++       $0 [OPTION] ALIAS
++
++Canonicalize a configuration name.
++
++Operation modes:
++  -h, --help         print this help, then exit
++  -t, --time-stamp   print date of last modification, then exit
++  -v, --version      print version number, then exit
++
++Report bugs and patches to <config-patches@gnu.org>."
++
++version="\
++GNU config.sub ($timestamp)
++
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
++Free Software Foundation, Inc.
++
++This is free software; see the source for copying conditions.  There is NO
++warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
++
++help="
++Try \`$me --help' for more information."
++
++# Parse command line
++while test $# -gt 0 ; do
++  case $1 in
++    --time-stamp | --time* | -t )
++       echo "$timestamp" ; exit 0 ;;
++    --version | -v )
++       echo "$version" ; exit 0 ;;
++    --help | --h* | -h )
++       echo "$usage"; exit 0 ;;
++    -- )     # Stop option processing
++       shift; break ;;
++    - )	# Use stdin as input.
++       break ;;
++    -* )
++       echo "$me: invalid option $1$help"
++       exit 1 ;;
++
++    *local*)
++       # First pass through any local machine types.
++       echo $1
++       exit 0;;
++
++    * )
++       break ;;
++  esac
++done
++
++case $# in
++ 0) echo "$me: missing argument$help" >&2
++    exit 1;;
++ 1) ;;
++ *) echo "$me: too many arguments$help" >&2
++    exit 1;;
+ esac
+ 
+ # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+-  linux-gnu*)
++  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
++  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -94,15 +145,33 @@
+ 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+-	-apple)
++	-apple | -axis | -knuth | -cray)
++		os=
++		basic_machine=$1
++		;;
++	-sim | -cisco | -oki | -wec | -winbond)
+ 		os=
+ 		basic_machine=$1
+ 		;;
++	-scout)
++		;;
++	-wrs)
++		os=-vxworks
++		basic_machine=$1
++		;;
++	-chorusos*)
++		os=-chorusos
++		basic_machine=$1
++		;;
++ 	-chorusrdb)
++ 		os=-chorusrdb
++		basic_machine=$1
++ 		;;
+ 	-hiux*)
+ 		os=-hiuxwe2
+ 		;;
+ 	-sco5)
+-		os=sco3.2v5
++		os=-sco3.2v5
+ 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ 		;;
+ 	-sco4)
+@@ -121,6 +190,9 @@
+ 		os=-sco3.2v2
+ 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ 		;;
++	-udk*)
++		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++		;;
+ 	-isc)
+ 		os=-isc2.2
+ 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -143,25 +215,74 @@
+ 	-psos*)
+ 		os=-psos
+ 		;;
++	-mint | -mint[0-9]*)
++		basic_machine=m68k-atari
++		os=-mint
++		;;
+ esac
+ 
+ # Decode aliases for certain CPU-COMPANY combinations.
+ case $basic_machine in
+ 	# Recognize the basic CPU types without company name.
+ 	# Some are omitted here because they have special meanings below.
+-	tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
+-		| arme[lb] | pyramid \
+-		| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
+-		| alpha | we32k | ns16k | clipper | i370 | sh \
+-		| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
+-		| pdp11 | mips64el | mips64orion | mips64orionel \
+-		| sparc | sparclet | sparclite | sparc64)
++	1750a | 580 \
++	| a29k \
++	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
++	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
++	| am33_2.0 \
++	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++	| c4x | clipper \
++	| d10v | d30v | dlx | dsp16xx \
++	| fr30 | frv \
++	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
++	| i370 | i860 | i960 | ia64 \
++	| ip2k | iq2000 \
++	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
++	| mips | mipsbe | mipseb | mipsel | mipsle \
++	| mips16 \
++	| mips64 | mips64el \
++	| mips64vr | mips64vrel \
++	| mips64orion | mips64orionel \
++	| mips64vr4100 | mips64vr4100el \
++	| mips64vr4300 | mips64vr4300el \
++	| mips64vr5000 | mips64vr5000el \
++	| mipsisa32 | mipsisa32el \
++	| mipsisa32r2 | mipsisa32r2el \
++	| mipsisa64 | mipsisa64el \
++	| mipsisa64r2 | mipsisa64r2el \
++	| mipsisa64sb1 | mipsisa64sb1el \
++	| mipsisa64sr71k | mipsisa64sr71kel \
++	| mipstx39 | mipstx39el \
++	| mn10200 | mn10300 \
++	| msp430 \
++	| ns16k | ns32k \
++	| openrisc | or32 \
++	| pdp10 | pdp11 | pj | pjl \
++	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
++	| pyramid \
++	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++	| sh64 | sh64le \
++	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
++	| strongarm \
++	| tahoe | thumb | tic4x | tic80 | tron \
++	| v850 | v850e \
++	| we32k \
++	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
++	| z8k)
+ 		basic_machine=$basic_machine-unknown
+ 		;;
++	m6811 | m68hc11 | m6812 | m68hc12)
++		# Motorola 68HC11/12.
++		basic_machine=$basic_machine-unknown
++		os=-none
++		;;
++	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
++		;;
++
+ 	# We use `pc' rather than `unknown'
+ 	# because (1) that's what they normally are, and
+ 	# (2) the word "unknown" tends to confuse beginning users.
+-	i[3456]86)
++	i*86 | x86_64)
+ 	  basic_machine=$basic_machine-pc
+ 	  ;;
+ 	# Object if more than one company name word.
+@@ -170,23 +291,86 @@
+ 		exit 1
+ 		;;
+ 	# Recognize the basic CPU types with company name.
+-	vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
+-	      | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
+-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
+-	      | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
+-	      | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
+-	      | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
+-	      | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
+-	      | mips64el-* | mips64orion-* | mips64orionel-*)
++	580-* \
++	| a29k-* \
++	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
++	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
++	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
++	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
++	| avr-* \
++	| bs2000-* \
++	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
++	| clipper-* | craynv-* | cydra-* \
++	| d10v-* | d30v-* | dlx-* \
++	| elxsi-* \
++	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
++	| h8300-* | h8500-* \
++	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
++	| i*86-* | i860-* | i960-* | ia64-* \
++	| ip2k-* | iq2000-* \
++	| m32r-* | m32rle-* \
++	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
++	| m88110-* | m88k-* | maxq-* | mcore-* \
++	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
++	| mips16-* \
++	| mips64-* | mips64el-* \
++	| mips64vr-* | mips64vrel-* \
++	| mips64orion-* | mips64orionel-* \
++	| mips64vr4100-* | mips64vr4100el-* \
++	| mips64vr4300-* | mips64vr4300el-* \
++	| mips64vr5000-* | mips64vr5000el-* \
++	| mipsisa32-* | mipsisa32el-* \
++	| mipsisa32r2-* | mipsisa32r2el-* \
++	| mipsisa64-* | mipsisa64el-* \
++	| mipsisa64r2-* | mipsisa64r2el-* \
++	| mipsisa64sb1-* | mipsisa64sb1el-* \
++	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
++	| mipstx39-* | mipstx39el-* \
++	| mmix-* \
++	| msp430-* \
++	| none-* | np1-* | ns16k-* | ns32k-* \
++	| orion-* \
++	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
++	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
++	| pyramid-* \
++	| romp-* | rs6000-* \
++	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
++	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
++	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++	| tahoe-* | thumb-* \
++	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++	| tron-* \
++	| v850-* | v850e-* | vax-* \
++	| we32k-* \
++	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
++	| xstormy16-* | xtensa-* \
++	| ymp-* \
++	| z8k-*)
+ 		;;
+ 	# Recognize the various machine names and aliases which stand
+ 	# for a CPU type and a company and sometimes even an OS.
++	386bsd)
++		basic_machine=i386-unknown
++		os=-bsd
++		;;
+ 	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ 		basic_machine=m68000-att
+ 		;;
+ 	3b*)
+ 		basic_machine=we32k-att
+ 		;;
++	a29khif)
++		basic_machine=a29k-amd
++		os=-udi
++		;;
++    	abacus)
++		basic_machine=abacus-unknown
++		;;
++	adobe68k)
++		basic_machine=m68010-adobe
++		os=-scout
++		;;
+ 	alliant | fx80)
+ 		basic_machine=fx80-alliant
+ 		;;
+@@ -197,25 +381,35 @@
+ 		basic_machine=a29k-none
+ 		os=-bsd
+ 		;;
++	amd64)
++		basic_machine=x86_64-pc
++		;;
++	amd64-*)
++		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	amdahl)
+ 		basic_machine=580-amdahl
+ 		os=-sysv
+ 		;;
+ 	amiga | amiga-*)
+-		basic_machine=m68k-cbm
++		basic_machine=m68k-unknown
+ 		;;
+-	amigados)
+-		basic_machine=m68k-cbm
+-		os=-amigados
++	amigaos | amigados)
++		basic_machine=m68k-unknown
++		os=-amigaos
+ 		;;
+ 	amigaunix | amix)
+-		basic_machine=m68k-cbm
++		basic_machine=m68k-unknown
+ 		os=-sysv4
+ 		;;
+ 	apollo68)
+ 		basic_machine=m68k-apollo
+ 		os=-sysv
+ 		;;
++	apollo68bsd)
++		basic_machine=m68k-apollo
++		os=-bsd
++		;;
+ 	aux)
+ 		basic_machine=m68k-apple
+ 		os=-aux
+@@ -224,6 +418,10 @@
+ 		basic_machine=ns32k-sequent
+ 		os=-dynix
+ 		;;
++	c90)
++		basic_machine=c90-cray
++		os=-unicos
++		;;
+ 	convex-c1)
+ 		basic_machine=c1-convex
+ 		os=-bsd
+@@ -244,27 +442,45 @@
+ 		basic_machine=c38-convex
+ 		os=-bsd
+ 		;;
+-	cray | ymp)
+-		basic_machine=ymp-cray
+-		os=-unicos
+-		;;
+-	cray2)
+-		basic_machine=cray2-cray
++	cray | j90)
++		basic_machine=j90-cray
+ 		os=-unicos
+ 		;;
+-	[ctj]90-cray)
+-		basic_machine=c90-cray
+-		os=-unicos
++	craynv)
++		basic_machine=craynv-cray
++		os=-unicosmp
++		;;
++	cr16c)
++		basic_machine=cr16c-unknown
++		os=-elf
+ 		;;
+ 	crds | unos)
+ 		basic_machine=m68k-crds
+ 		;;
++	crisv32 | crisv32-* | etraxfs*)
++		basic_machine=crisv32-axis
++		;;
++	cris | cris-* | etrax*)
++		basic_machine=cris-axis
++		;;
++	crx)
++		basic_machine=crx-unknown
++		os=-elf
++		;;
+ 	da30 | da30-*)
+ 		basic_machine=m68k-da30
+ 		;;
+ 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ 		basic_machine=mips-dec
+ 		;;
++	decsystem10* | dec10*)
++		basic_machine=pdp10-dec
++		os=-tops10
++		;;
++	decsystem20* | dec20*)
++		basic_machine=pdp10-dec
++		os=-tops20
++		;;
+ 	delta | 3300 | motorola-3300 | motorola-delta \
+ 	      | 3300-motorola | delta-motorola)
+ 		basic_machine=m68k-motorola
+@@ -273,6 +489,10 @@
+ 		basic_machine=m88k-motorola
+ 		os=-sysv3
+ 		;;
++	djgpp)
++		basic_machine=i586-pc
++		os=-msdosdjgpp
++		;;
+ 	dpx20 | dpx20-*)
+ 		basic_machine=rs6000-bull
+ 		os=-bosx
+@@ -292,6 +512,10 @@
+ 	encore | umax | mmax)
+ 		basic_machine=ns32k-encore
+ 		;;
++	es1800 | OSE68k | ose68k | ose | OSE)
++		basic_machine=m68k-ericsson
++		os=-ose
++		;;
+ 	fx2800)
+ 		basic_machine=i860-alliant
+ 		;;
+@@ -302,6 +526,10 @@
+ 		basic_machine=tron-gmicro
+ 		os=-sysv
+ 		;;
++	go32)
++		basic_machine=i386-pc
++		os=-go32
++		;;
+ 	h3050r* | hiux*)
+ 		basic_machine=hppa1.1-hitachi
+ 		os=-hiuxwe2
+@@ -310,6 +538,14 @@
+ 		basic_machine=h8300-hitachi
+ 		os=-hms
+ 		;;
++	h8300xray)
++		basic_machine=h8300-hitachi
++		os=-xray
++		;;
++	h8500hms)
++		basic_machine=h8500-hitachi
++		os=-hms
++		;;
+ 	harris)
+ 		basic_machine=m88k-harris
+ 		os=-sysv3
+@@ -325,13 +561,30 @@
+ 		basic_machine=m68k-hp
+ 		os=-hpux
+ 		;;
++	hp3k9[0-9][0-9] | hp9[0-9][0-9])
++		basic_machine=hppa1.0-hp
++		;;
+ 	hp9k2[0-9][0-9] | hp9k31[0-9])
+ 		basic_machine=m68000-hp
+ 		;;
+ 	hp9k3[2-9][0-9])
+ 		basic_machine=m68k-hp
+ 		;;
+-	hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
++	hp9k6[0-9][0-9] | hp6[0-9][0-9])
++		basic_machine=hppa1.0-hp
++		;;
++	hp9k7[0-79][0-9] | hp7[0-79][0-9])
++		basic_machine=hppa1.1-hp
++		;;
++	hp9k78[0-9] | hp78[0-9])
++		# FIXME: really hppa2.0-hp
++		basic_machine=hppa1.1-hp
++		;;
++	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
++		# FIXME: really hppa2.0-hp
++		basic_machine=hppa1.1-hp
++		;;
++	hp9k8[0-9][13679] | hp8[0-9][13679])
+ 		basic_machine=hppa1.1-hp
+ 		;;
+ 	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+@@ -340,27 +593,42 @@
+ 	hppa-next)
+ 		os=-nextstep3
+ 		;;
++	hppaosf)
++		basic_machine=hppa1.1-hp
++		os=-osf
++		;;
++	hppro)
++		basic_machine=hppa1.1-hp
++		os=-proelf
++		;;
+ 	i370-ibm* | ibm*)
+ 		basic_machine=i370-ibm
+-		os=-mvs
+ 		;;
+ # I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+-	i[3456]86v32)
++	i*86v32)
+ 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ 		os=-sysv32
+ 		;;
+-	i[3456]86v4*)
++	i*86v4*)
+ 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ 		os=-sysv4
+ 		;;
+-	i[3456]86v)
++	i*86v)
+ 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ 		os=-sysv
+ 		;;
+-	i[3456]86sol2)
++	i*86sol2)
+ 		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ 		os=-solaris2
+ 		;;
++	i386mach)
++		basic_machine=i386-mach
++		os=-mach
++		;;
++	i386-vsta | vsta)
++		basic_machine=i386-unknown
++		os=-vsta
++		;;
+ 	iris | iris4d)
+ 		basic_machine=mips-sgi
+ 		case $os in
+@@ -386,19 +654,51 @@
+ 		basic_machine=ns32k-utek
+ 		os=-sysv
+ 		;;
++	mingw32)
++		basic_machine=i386-pc
++		os=-mingw32
++		;;
+ 	miniframe)
+ 		basic_machine=m68000-convergent
+ 		;;
++	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
++		basic_machine=m68k-atari
++		os=-mint
++		;;
+ 	mips3*-*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ 		;;
+ 	mips3*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ 		;;
++	monitor)
++		basic_machine=m68k-rom68k
++		os=-coff
++		;;
++	morphos)
++		basic_machine=powerpc-unknown
++		os=-morphos
++		;;
++	msdos)
++		basic_machine=i386-pc
++		os=-msdos
++		;;
++	mvs)
++		basic_machine=i370-ibm
++		os=-mvs
++		;;
+ 	ncr3000)
+ 		basic_machine=i486-ncr
+ 		os=-sysv4
+ 		;;
++	netbsd386)
++		basic_machine=i386-unknown
++		os=-netbsd
++		;;
++	netwinder)
++		basic_machine=armv4l-rebel
++		os=-linux
++		;;
+ 	news | news700 | news800 | news900)
+ 		basic_machine=m68k-sony
+ 		os=-newsos
+@@ -411,6 +711,10 @@
+ 		basic_machine=mips-sony
+ 		os=-newsos
+ 		;;
++	necv70)
++		basic_machine=v70-nec
++		os=-sysv
++		;;
+ 	next | m*-next )
+ 		basic_machine=m68k-next
+ 		case $os in
+@@ -436,9 +740,40 @@
+ 		basic_machine=i960-intel
+ 		os=-nindy
+ 		;;
++	mon960)
++		basic_machine=i960-intel
++		os=-mon960
++		;;
++	nonstopux)
++		basic_machine=mips-compaq
++		os=-nonstopux
++		;;
+ 	np1)
+ 		basic_machine=np1-gould
+ 		;;
++	nsr-tandem)
++		basic_machine=nsr-tandem
++		;;
++	op50n-* | op60c-*)
++		basic_machine=hppa1.1-oki
++		os=-proelf
++		;;
++	or32 | or32-*)
++		basic_machine=or32-unknown
++		os=-coff
++		;;
++	os400)
++		basic_machine=powerpc-ibm
++		os=-os400
++		;;
++	OSE68000 | ose68000)
++		basic_machine=m68000-ericsson
++		os=-ose
++		;;
++	os68k)
++		basic_machine=m68k-none
++		os=-os68k
++		;;
+ 	pa-hitachi)
+ 		basic_machine=hppa1.1-hitachi
+ 		os=-hiuxwe2
+@@ -453,53 +788,95 @@
+ 	pbb)
+ 		basic_machine=m68k-tti
+ 		;;
+-        pc532 | pc532-*)
++	pc532 | pc532-*)
+ 		basic_machine=ns32k-pc532
+ 		;;
+-	pentium | p5)
+-		basic_machine=i586-intel
++	pentium | p5 | k5 | k6 | nexgen | viac3)
++		basic_machine=i586-pc
++		;;
++	pentiumpro | p6 | 6x86 | athlon | athlon_*)
++		basic_machine=i686-pc
++		;;
++	pentiumii | pentium2 | pentiumiii | pentium3)
++		basic_machine=i686-pc
+ 		;;
+-	pentiumpro | p6)
+-		basic_machine=i686-intel
++	pentium4)
++		basic_machine=i786-pc
+ 		;;
+-	pentium-* | p5-*)
++	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+-	pentiumpro-* | p6-*)
++	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+-	k5)
+-		# We don't have specific support for AMD's K5 yet, so just call it a Pentium
+-		basic_machine=i586-amd
+-		;;
+-	nexen)
+-		# We don't have specific support for Nexgen yet, so just call it a Pentium
+-		basic_machine=i586-nexgen
++	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
++		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
++	pentium4-*)
++		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	pn)
+ 		basic_machine=pn-gould
+ 		;;
+-	power)	basic_machine=rs6000-ibm
++	power)	basic_machine=power-ibm
+ 		;;
+ 	ppc)	basic_machine=powerpc-unknown
+-	        ;;
++		;;
+ 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppcle | powerpclittle | ppc-le | powerpc-little)
+ 		basic_machine=powerpcle-unknown
+-	        ;;
++		;;
+ 	ppcle-* | powerpclittle-*)
+ 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
++	ppc64)	basic_machine=powerpc64-unknown
++		;;
++	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
++	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
++		basic_machine=powerpc64le-unknown
++		;;
++	ppc64le-* | powerpc64little-*)
++		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	ps2)
+ 		basic_machine=i386-ibm
+ 		;;
++	pw32)
++		basic_machine=i586-unknown
++		os=-pw32
++		;;
++	rom68k)
++		basic_machine=m68k-rom68k
++		os=-coff
++		;;
+ 	rm[46]00)
+ 		basic_machine=mips-siemens
+ 		;;
+ 	rtpc | rtpc-*)
+ 		basic_machine=romp-ibm
+ 		;;
++	s390 | s390-*)
++		basic_machine=s390-ibm
++		;;
++	s390x | s390x-*)
++		basic_machine=s390x-ibm
++		;;
++	sa29200)
++		basic_machine=a29k-amd
++		os=-udi
++		;;
++	sb1)
++		basic_machine=mipsisa64sb1-unknown
++		;;
++	sb1el)
++		basic_machine=mipsisa64sb1el-unknown
++		;;
++	sei)
++		basic_machine=mips-sei
++		os=-seiux
++		;;
+ 	sequent)
+ 		basic_machine=i386-sequent
+ 		;;
+@@ -507,6 +884,13 @@
+ 		basic_machine=sh-hitachi
+ 		os=-hms
+ 		;;
++	sh64)
++		basic_machine=sh64-unknown
++		;;
++	sparclite-wrs | simso-wrs)
++		basic_machine=sparclite-wrs
++		os=-vxworks
++		;;
+ 	sps7)
+ 		basic_machine=m68k-bull
+ 		os=-sysv2
+@@ -514,6 +898,13 @@
+ 	spur)
+ 		basic_machine=spur-unknown
+ 		;;
++	st2000)
++		basic_machine=m68k-tandem
++		;;
++	stratus)
++		basic_machine=i860-stratus
++		os=-sysv4
++		;;
+ 	sun2)
+ 		basic_machine=m68000-sun
+ 		;;
+@@ -554,13 +945,51 @@
+ 	sun386 | sun386i | roadrunner)
+ 		basic_machine=i386-sun
+ 		;;
++	sv1)
++		basic_machine=sv1-cray
++		os=-unicos
++		;;
+ 	symmetry)
+ 		basic_machine=i386-sequent
+ 		os=-dynix
+ 		;;
++	t3e)
++		basic_machine=alphaev5-cray
++		os=-unicos
++		;;
++	t90)
++		basic_machine=t90-cray
++		os=-unicos
++		;;
++	tic54x | c54x*)
++		basic_machine=tic54x-unknown
++		os=-coff
++		;;
++	tic55x | c55x*)
++		basic_machine=tic55x-unknown
++		os=-coff
++		;;
++	tic6x | c6x*)
++		basic_machine=tic6x-unknown
++		os=-coff
++		;;
++	tx39)
++		basic_machine=mipstx39-unknown
++		;;
++	tx39el)
++		basic_machine=mipstx39el-unknown
++		;;
++	toad1)
++		basic_machine=pdp10-xkl
++		os=-tops20
++		;;
+ 	tower | tower-32)
+ 		basic_machine=m68k-ncr
+ 		;;
++	tpf)
++		basic_machine=s390x-ibm
++		os=-tpf
++		;;
+ 	udi29k)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+@@ -569,6 +998,10 @@
+ 		basic_machine=a29k-nyu
+ 		os=-sym1
+ 		;;
++	v810 | necv810)
++		basic_machine=v810-nec
++		os=-none
++		;;
+ 	vaxv)
+ 		basic_machine=vax-dec
+ 		os=-sysv
+@@ -577,6 +1010,9 @@
+ 		basic_machine=vax-dec
+ 		os=-vms
+ 		;;
++	vpp*|vx|vx-*)
++		basic_machine=f301-fujitsu
++		;;
+ 	vxworks960)
+ 		basic_machine=i960-wrs
+ 		os=-vxworks
+@@ -589,13 +1025,29 @@
+ 		basic_machine=a29k-wrs
+ 		os=-vxworks
+ 		;;
+-	xmp)
+-		basic_machine=xmp-cray
+-		os=-unicos
++	w65*)
++		basic_machine=w65-wdc
++		os=-none
++		;;
++	w89k-*)
++		basic_machine=hppa1.1-winbond
++		os=-proelf
++		;;
++	xbox)
++		basic_machine=i686-pc
++		os=-mingw32
+ 		;;
+-        xps | xps100)
++	xps | xps100)
+ 		basic_machine=xps100-honeywell
+ 		;;
++	ymp)
++		basic_machine=ymp-cray
++		os=-unicos
++		;;
++	z8k-*-coff)
++		basic_machine=z8k-unknown
++		os=-sim
++		;;
+ 	none)
+ 		basic_machine=none-none
+ 		os=-none
+@@ -603,28 +1055,47 @@
+ 
+ # Here we handle the default manufacturer of certain CPU types.  It is in
+ # some cases the only manufacturer, in others, it is the most popular.
+-	mips)
+-		basic_machine=mips-mips
++	w89k)
++		basic_machine=hppa1.1-winbond
++		;;
++	op50n)
++		basic_machine=hppa1.1-oki
++		;;
++	op60c)
++		basic_machine=hppa1.1-oki
+ 		;;
+ 	romp)
+ 		basic_machine=romp-ibm
+ 		;;
++	mmix)
++		basic_machine=mmix-knuth
++		;;
+ 	rs6000)
+ 		basic_machine=rs6000-ibm
+ 		;;
+ 	vax)
+ 		basic_machine=vax-dec
+ 		;;
++	pdp10)
++		# there are many clones, so DEC is not a safe bet
++		basic_machine=pdp10-unknown
++		;;
+ 	pdp11)
+ 		basic_machine=pdp11-dec
+ 		;;
+ 	we32k)
+ 		basic_machine=we32k-att
+ 		;;
+-	sparc)
++	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
++		basic_machine=sh-unknown
++		;;
++	sh64)
++		basic_machine=sh64-unknown
++		;;
++	sparc | sparcv8 | sparcv9 | sparcv9b)
+ 		basic_machine=sparc-sun
+ 		;;
+-        cydra)
++	cydra)
+ 		basic_machine=cydra-cydrome
+ 		;;
+ 	orion)
+@@ -633,6 +1104,15 @@
+ 	orion105)
+ 		basic_machine=clipper-highlevel
+ 		;;
++	mac | mpw | mac-mpw)
++		basic_machine=m68k-apple
++		;;
++	pmac | pmac-mpw)
++		basic_machine=powerpc-apple
++		;;
++	*-unknown)
++		# Make sure to match an already-canonicalized machine name.
++		;;
+ 	*)
+ 		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ 		exit 1
+@@ -665,9 +1145,12 @@
+ 	-solaris)
+ 		os=-solaris2
+ 		;;
+-	-unixware* | svr4*)
++	-svr4*)
+ 		os=-sysv4
+ 		;;
++	-unixware*)
++		os=-sysv4.2uw
++		;;
+ 	-gnu/linux*)
+ 		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ 		;;
+@@ -678,17 +1161,50 @@
+ 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ 	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+-	      | -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
++	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
++	      | -aos* \
+ 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
++	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
++	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+-	      | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+-	      | -linux-gnu*)
++	      | -chorusos* | -chorusrdb* \
++	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
++	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
++	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
++	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
++	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
++	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
++	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
++	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ 	# Remember, each alternative MUST END IN *, to match a version number.
+ 		;;
++	-qnx*)
++		case $basic_machine in
++		    x86-* | i*86-*)
++			;;
++		    *)
++			os=-nto$os
++			;;
++		esac
++		;;
++	-nto-qnx*)
++		;;
++	-nto*)
++		os=`echo $os | sed -e 's|nto|nto-qnx|'`
++		;;
++	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
++	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
++	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
++		;;
++	-mac*)
++		os=`echo $os | sed -e 's|mac|macos|'`
++		;;
++	-linux-dietlibc)
++		os=-linux-dietlibc
++		;;
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
+@@ -698,6 +1214,15 @@
+ 	-sunos6*)
+ 		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ 		;;
++	-opened*)
++		os=-openedition
++		;;
++        -os400*)
++		os=-os400
++		;;
++	-wince*)
++		os=-wince
++		;;
+ 	-osfrose*)
+ 		os=-osfrose
+ 		;;
+@@ -713,11 +1238,26 @@
+ 	-acis*)
+ 		os=-aos
+ 		;;
++	-atheos*)
++		os=-atheos
++		;;
++	-syllable*)
++		os=-syllable
++		;;
++	-386bsd)
++		os=-bsd
++		;;
+ 	-ctix* | -uts*)
+ 		os=-sysv
+ 		;;
++	-nova*)
++		os=-rtmk-nova
++		;;
+ 	-ns2 )
+-	        os=-nextstep2
++		os=-nextstep2
++		;;
++	-nsk*)
++		os=-nsk
+ 		;;
+ 	# Preserve the version number of sinix5.
+ 	-sinix5.*)
+@@ -726,6 +1266,9 @@
+ 	-sinix*)
+ 		os=-sysv4
+ 		;;
++        -tpf*)
++		os=-tpf
++		;;
+ 	-triton*)
+ 		os=-sysv3
+ 		;;
+@@ -744,9 +1287,27 @@
+ 	# This must come after -sysvr4.
+ 	-sysv*)
+ 		;;
++	-ose*)
++		os=-ose
++		;;
++	-es1800*)
++		os=-ose
++		;;
+ 	-xenix)
+ 		os=-xenix
+ 		;;
++	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
++		os=-mint
++		;;
++	-aros*)
++		os=-aros
++		;;
++	-kaos*)
++		os=-kaos
++		;;
++	-zvmoe)
++		os=-zvmoe
++		;;
+ 	-none)
+ 		;;
+ 	*)
+@@ -772,10 +1333,20 @@
+ 	*-acorn)
+ 		os=-riscix1.2
+ 		;;
++	arm*-rebel)
++		os=-linux
++		;;
+ 	arm*-semi)
+ 		os=-aout
+ 		;;
+-        pdp11-*)
++    c4x-* | tic4x-*)
++        os=-coff
++        ;;
++	# This must come before the *-dec entry.
++	pdp10-*)
++		os=-tops20
++		;;
++	pdp11-*)
+ 		os=-none
+ 		;;
+ 	*-dec | vax-*)
+@@ -793,15 +1364,42 @@
+ 		# default.
+ 		# os=-sunos4
+ 		;;
++	m68*-cisco)
++		os=-aout
++		;;
++	mips*-cisco)
++		os=-elf
++		;;
++	mips*-*)
++		os=-elf
++		;;
++	or32-*)
++		os=-coff
++		;;
+ 	*-tti)	# must be before sparc entry or we get the wrong os.
+ 		os=-sysv3
+ 		;;
+ 	sparc-* | *-sun)
+ 		os=-sunos4.1.1
+ 		;;
++	*-be)
++		os=-beos
++		;;
+ 	*-ibm)
+ 		os=-aix
+ 		;;
++    	*-knuth)
++		os=-mmixware
++		;;
++	*-wec)
++		os=-proelf
++		;;
++	*-winbond)
++		os=-proelf
++		;;
++	*-oki)
++		os=-proelf
++		;;
+ 	*-hp)
+ 		os=-hpux
+ 		;;
+@@ -812,7 +1410,7 @@
+ 		os=-sysv
+ 		;;
+ 	*-cbm)
+-		os=-amigados
++		os=-amigaos
+ 		;;
+ 	*-dg)
+ 		os=-dgux
+@@ -844,24 +1442,39 @@
+ 	*-next)
+ 		os=-nextstep3
+ 		;;
+-        *-gould)
++	*-gould)
+ 		os=-sysv
+ 		;;
+-        *-highlevel)
++	*-highlevel)
+ 		os=-bsd
+ 		;;
+ 	*-encore)
+ 		os=-bsd
+ 		;;
+-        *-sgi)
++	*-sgi)
+ 		os=-irix
+ 		;;
+-        *-siemens)
++	*-siemens)
+ 		os=-sysv4
+ 		;;
+ 	*-masscomp)
+ 		os=-rtu
+ 		;;
++	f30[01]-fujitsu | f700-fujitsu)
++		os=-uxpv
++		;;
++	*-rom68k)
++		os=-coff
++		;;
++	*-*bug)
++		os=-coff
++		;;
++	*-apple)
++		os=-macos
++		;;
++	*-atari*)
++		os=-mint
++		;;
+ 	*)
+ 		os=-none
+ 		;;
+@@ -883,9 +1496,15 @@
+ 			-aix*)
+ 				vendor=ibm
+ 				;;
++			-beos*)
++				vendor=be
++				;;
+ 			-hpux*)
+ 				vendor=hp
+ 				;;
++			-mpeix*)
++				vendor=hp
++				;;
+ 			-hiux*)
+ 				vendor=hitachi
+ 				;;
+@@ -901,21 +1520,47 @@
+ 			-genix*)
+ 				vendor=ns
+ 				;;
+-			-mvs*)
++			-mvs* | -opened*)
++				vendor=ibm
++				;;
++			-os400*)
+ 				vendor=ibm
+ 				;;
+ 			-ptx*)
+ 				vendor=sequent
+ 				;;
+-			-vxsim* | -vxworks*)
++			-tpf*)
++				vendor=ibm
++				;;
++			-vxsim* | -vxworks* | -windiss*)
+ 				vendor=wrs
+ 				;;
+ 			-aux*)
+ 				vendor=apple
+ 				;;
++			-hms*)
++				vendor=hitachi
++				;;
++			-mpw* | -macos*)
++				vendor=apple
++				;;
++			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
++				vendor=atari
++				;;
++			-vos*)
++				vendor=stratus
++				;;
+ 		esac
+ 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ 		;;
+ esac
+ 
+ echo $basic_machine$os
++exit 0
++
++# Local variables:
++# eval: (add-hook 'write-file-hooks 'time-stamp)
++# time-stamp-start: "timestamp='"
++# time-stamp-format: "%:y-%02m-%02d"
++# time-stamp-end: "'"
++# End:
Index: patches/expect-5.43.0-spawn-2.patch
===================================================================
--- patches/expect-5.43.0-spawn-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/expect-5.43.0-spawn-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,221 @@
+Submitted By:            LFS Book <lfs-book@linuxfromscratch.org>
+Date:                    2005-02-27 (originally submitted 2003-10-05)
+Initial Package Version: 5.38
+Origin:                  Redhat RPM (Patch by HJ Lu); rediffed by Randy McMurchy
+Description:             NA
+
+$LastChangedBy: randy $
+$Date: 2005-03-24 21:05:48 -0700 (Thu, 24 Mar 2005) $
+
+diff -Naur expect-5.43-orig/exp_chan.c expect-5.43/exp_chan.c
+--- expect-5.43-orig/exp_chan.c	2005-02-08 02:01:20.000000000 +0000
++++ expect-5.43/exp_chan.c	2005-02-27 15:09:29.270201960 +0000
+@@ -622,6 +622,7 @@
+     esPtr->buffer = Tcl_NewStringObj("",0);
+     Tcl_IncrRefCount(esPtr->buffer);
+     esPtr->umsize = exp_default_match_max;
++    esPtr->umsize_changed = exp_default_match_max_changed;
+     /* this will reallocate object with an appropriate sized buffer */
+     expAdjust(esPtr);
+ 
+diff -Naur expect-5.43-orig/exp_command.h expect-5.43/exp_command.h
+--- expect-5.43-orig/exp_command.h	2004-07-30 15:35:28.000000000 +0000
++++ expect-5.43/exp_command.h	2005-02-27 15:09:29.272201656 +0000
+@@ -30,6 +30,7 @@
+ EXTERN char *		exp_get_var _ANSI_ARGS_((Tcl_Interp *,char *));
+ 
+ EXTERN int exp_default_match_max;
++EXTERN int exp_default_match_max_changed;
+ EXTERN int exp_default_parity;
+ EXTERN int exp_default_rm_nulls;
+ EXTERN int exp_default_close_on_eof;
+@@ -103,6 +104,7 @@
+     int msize;	        /* # of bytes that buffer can hold (max) */
+     int umsize;	        /* # of bytes (min) that is guaranteed to match */
+ 			/* this comes from match_max command */
++    int umsize_changed;	/* is umsize changed by user?  */
+     int printed;	/* # of bytes written to stdout (if logging on) */
+                         /* but not actually returned via a match yet */
+     int echoed;	        /* additional # of bytes (beyond "printed" above) */
+diff -Naur expect-5.43-orig/expect.c expect-5.43/expect.c
+--- expect-5.43-orig/expect.c	2004-07-06 23:26:02.000000000 +0000
++++ expect-5.43/expect.c	2005-02-27 15:09:29.279200592 +0000
+@@ -41,8 +41,17 @@
+ #include "tcldbg.h"
+ #endif
+ 
++/* The initial length is 2000. We increment it by 2000. The maximum
++   is 8MB (0x800000).  */
++#define EXP_MATCH_MAX		2000
++#define EXP_MATCH_INC		2000
++#define EXP_MATCH_STEP_LIMIT	0x700000
++#define EXP_MATCH_LIMIT		0x800000
++#define EXP_MATCH_LIMIT_QUOTE	"0x800000"
++
+ /* initial length of strings that we can guarantee patterns can match */
+-int exp_default_match_max =	2000;
++int exp_default_match_max =	EXP_MATCH_MAX;
++int exp_default_match_max_changed = 0;
+ #define INIT_EXPECT_TIMEOUT_LIT	"10"	/* seconds */
+ #define INIT_EXPECT_TIMEOUT	10	/* seconds */
+ int exp_default_parity =	TRUE;
+@@ -1619,6 +1628,76 @@
+     return newsize;
+ }
+ 
++/* returns # of bytes until we see a newline at the end or EOF.  */
++/*ARGSUSED*/
++static int
++expReadNewLine(interp,esPtr,save_flags) /* INTL */
++Tcl_Interp *interp;
++ExpState *esPtr;
++int save_flags;
++{
++    int size;
++    int exp_size;
++    int full_size;
++    int count;
++    char *str;
++
++    count = 0;
++    for (;;) {
++	exp_size = expSizeGet(esPtr);
++
++	/* When we reach the limit, we will only read one char at a
++	   time.  */
++	if (esPtr->umsize >= EXP_MATCH_STEP_LIMIT)
++	    size = TCL_UTF_MAX;
++	else
++	    size = exp_size;
++
++	if (exp_size + TCL_UTF_MAX >= esPtr->msize) {
++	    if (esPtr->umsize >= EXP_MATCH_LIMIT) {
++		expDiagLogU("WARNING: interact buffer is full. probably your program\r\n");
++		expDiagLogU("is not interactive or has a very long output line. The\r\n");
++		expDiagLogU("current limit is " EXP_MATCH_LIMIT_QUOTE ".\r\n");
++		expDiagLogU("Dumping first half of buffer in order to continue\r\n");
++		expDiagLogU("Recommend you enlarge the buffer.\r\n");
++		exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect");
++		return count;
++	    }
++	    else {
++		esPtr->umsize += EXP_MATCH_INC;
++		expAdjust(esPtr);
++	    }
++	}
++
++	full_size = esPtr->msize - (size / TCL_UTF_MAX);
++	size = Tcl_ReadChars(esPtr->channel,
++			esPtr->buffer,
++			full_size,
++			1 /* append */);
++	if (size > 0) {
++	    count += size;
++	    /* We try again if there are more to read and we haven't
++	       seen a newline at the end. */
++	    if (size == full_size) {
++		str = Tcl_GetStringFromObj(esPtr->buffer, &size);
++		if (str[size - 1] != '\n')
++		    continue;
++	    }
++	}
++	else {
++	    /* It is even trickier. We got an error from read. We have
++	       to recover from it. Let's make sure the size of
++	       buffer is correct. It can be corrupted. */
++	    str = Tcl_GetString(esPtr->buffer);
++	    Tcl_SetObjLength(esPtr->buffer, strlen(str));
++	}
++
++	break;
++    }
++
++    return count;
++}
++
+ /* returns # of bytes read or (non-positive) error of form EXP_XXX */
+ /* returns 0 for end of file */
+ /* If timeout is non-zero, set an alarm before doing the read, else assume */
+@@ -1633,6 +1712,8 @@
+ {
+     int cc = EXP_TIMEOUT;
+     int size = expSizeGet(esPtr);
++    int full_size;
++    int count;
+ 
+     if (size + TCL_UTF_MAX >= esPtr->msize) 
+ 	exp_buffer_shuffle(interp,esPtr,save_flags,EXPECT_OUT,"expect");
+@@ -1649,11 +1730,43 @@
+     }
+ #endif
+ 
+-    
++    /* FIXME: If we ask less than what is available in the tcl buffer
++       when tcl has seen EOF, we will throw away the remaining data
++       since the next read will get EOF. Since expect is line-oriented,
++       we exand our buffer to get EOF or the next newline at the end of
++       the input buffer. I don't know if it is the right fix.  H.J. */
++    count = 0;
++    full_size = esPtr->msize - (size / TCL_UTF_MAX);
+     cc = Tcl_ReadChars(esPtr->channel,
+-	    esPtr->buffer,
+-	    esPtr->msize - (size / TCL_UTF_MAX),
+-	    1 /* append */);
++		esPtr->buffer,
++		full_size,
++		1 /* append */);
++    if (cc > 0) {
++	count += cc;
++	/* It gets very tricky. There are more to read. We will expand
++	   our buffer and get EOF or a newline at the end unless the
++	   buffer length has been changed.  */
++	if (cc == full_size) {
++	    char *str;
++	    str = Tcl_GetStringFromObj(esPtr->buffer, &size);
++	    if (str[size - 1] != '\n') {
++		if (esPtr->umsize_changed) {
++		    char buf[20];	/* big enough for 64bit int in hex.  */
++		    snprintf(buf,sizeof(buf),"0x%x", esPtr->umsize);
++		    expDiagLogU("WARNING: interact buffer is not large enough to hold\r\n");
++		    expDiagLogU("all output. probably your program is not interactive or\r\n");
++		    expDiagLogU("has a very long output line. The current limit is ");
++		    expDiagLogU(buf);
++		    expDiagLogU(".\r\n");
++		}
++		else {
++		    cc = expReadNewLine(interp,esPtr,save_flags);
++		    if (cc > 0)
++			count += cc;
++		}
++	    }
++	}
++    }
+     i_read_errno = errno;
+ 
+ #ifdef SIMPLE_EVENT
+@@ -1674,7 +1787,7 @@
+ 	}
+     }
+ #endif
+-    return cc;	
++    return count > 0 ? count : cc;
+ }
+ 
+ /*
+@@ -2751,8 +2864,14 @@
+ 	return(TCL_ERROR);
+     }
+ 
+-    if (Default) exp_default_match_max = size;
+-    else esPtr->umsize = size;
++    if (Default) {
++	exp_default_match_max = size;
++	exp_default_match_max_changed = 1;
++    }
++    else {
++	esPtr->umsize = size;
++	esPtr->umsize_changed = 1;
++    }
+ 
+     return(TCL_OK);
+ }
Index: patches/file-4.17-mips_config_update-1.patch
===================================================================
--- patches/file-4.17-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/file-4.17-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1289 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-10-01
+Initial Package Version: 4.15
+Origin: Jim Gifford
+Upstream Status: Unknown
+Description: Updates config.sub and config.guess
+ 
+diff -Naur file-4.15.orig/config.guess file-4.15/config.guess
+--- file-4.15.orig/config.guess	2004-11-25 03:03:04.000000000 +0000
++++ file-4.15/config.guess	2005-10-01 17:10:08.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-#   2000, 2001, 2002 Free Software Foundation, Inc.
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2002-07-23'
++timestamp='2004-11-12'
+ 
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+@@ -53,7 +53,7 @@
+ GNU config.guess ($timestamp)
+ 
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -98,30 +98,32 @@
+ # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+ # use `HOST_CC' if defined, but it is deprecated.
+ 
+-# This shell variable is my proudest work .. or something. --bje
++# Portable tmp directory creation inspired by the Autoconf team.
+ 
+-set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+-(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+-   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+-dummy=$tmpdir/dummy ;
+-files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+-trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
++set_cc_for_build='
++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
++: ${TMPDIR=/tmp} ;
++ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
++dummy=$tmp/dummy ;
++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+ case $CC_FOR_BUILD,$HOST_CC,$CC in
+  ,,)    echo "int x;" > $dummy.c ;
+ 	for c in cc gcc c89 c99 ; do
+-	  if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
++	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ 	     CC_FOR_BUILD="$c"; break ;
+ 	  fi ;
+ 	done ;
+-	rm -f $files ;
+ 	if test x"$CC_FOR_BUILD" = x ; then
+ 	  CC_FOR_BUILD=no_compiler_found ;
+ 	fi
+ 	;;
+  ,,*)   CC_FOR_BUILD=$CC ;;
+  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+-esac ;
+-unset files'
++esac ;'
+ 
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+ # (ghazi@noc.rutgers.edu 1994-08-24)
+@@ -178,21 +180,38 @@
+ 		;;
+ 	esac
+ 	# The OS release
+-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++	# Debian GNU/NetBSD machines have a different userland, and
++	# thus, need a distinct triplet. However, they do not need
++	# kernel version information, so it can be replaced with a
++	# suitable tag, in the style of linux-gnu.
++	case "${UNAME_VERSION}" in
++	    Debian*)
++		release='-gnu'
++		;;
++	    *)
++		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++		;;
++	esac
+ 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ 	# contains redundant information, the shorter form:
+ 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ 	echo "${machine}-${os}${release}"
+ 	exit 0 ;;
++    amd64:OpenBSD:*:*)
++	echo x86_64-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
+     amiga:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    arc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++    cats:OpenBSD:*:*)
++	echo arm-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+     hp300:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
++    luna88k:OpenBSD:*:*)
++    	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
+     mac68k:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -208,86 +227,76 @@
+     mvmeppc:OpenBSD:*:*)
+ 	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    pmax:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     sgi:OpenBSD:*:*)
+-	echo mipseb-unknown-openbsd${UNAME_RELEASE}
++	echo mips64-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+     sun3:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    wgrisc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     *:OpenBSD:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
++    *:ekkoBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:MirBSD:*:*)
++	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:MirBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
+     alpha:OSF1:*:*)
+-	if test $UNAME_RELEASE = "V4.0"; then
++	case $UNAME_RELEASE in
++	*4.0)
+ 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+-	fi
++		;;
++	*5.*)
++	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++		;;
++	esac
++	# According to Compaq, /usr/sbin/psrinfo has been available on
++	# OSF/1 and Tru64 systems produced since 1995.  I hope that
++	# covers most systems running today.  This code pipes the CPU
++	# types through head -n 1, so we only detect the type of CPU 0.
++	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
++	case "$ALPHA_CPU_TYPE" in
++	    "EV4 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV4.5 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "LCA4 (21066/21068)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV5 (21164)")
++		UNAME_MACHINE="alphaev5" ;;
++	    "EV5.6 (21164A)")
++		UNAME_MACHINE="alphaev56" ;;
++	    "EV5.6 (21164PC)")
++		UNAME_MACHINE="alphapca56" ;;
++	    "EV5.7 (21164PC)")
++		UNAME_MACHINE="alphapca57" ;;
++	    "EV6 (21264)")
++		UNAME_MACHINE="alphaev6" ;;
++	    "EV6.7 (21264A)")
++		UNAME_MACHINE="alphaev67" ;;
++	    "EV6.8CB (21264C)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8AL (21264B)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8CX (21264D)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.9A (21264/EV69A)")
++		UNAME_MACHINE="alphaev69" ;;
++	    "EV7 (21364)")
++		UNAME_MACHINE="alphaev7" ;;
++	    "EV7.9 (21364A)")
++		UNAME_MACHINE="alphaev79" ;;
++	esac
++	# A Pn.n version is a patched version.
+ 	# A Vn.n version is a released version.
+ 	# A Tn.n version is a released field test version.
+ 	# A Xn.n version is an unreleased experimental baselevel.
+ 	# 1.2 uses "1.2" for uname -r.
+-	eval $set_cc_for_build
+-	cat <<EOF >$dummy.s
+-	.data
+-\$Lformat:
+-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+-
+-	.text
+-	.globl main
+-	.align 4
+-	.ent main
+-main:
+-	.frame \$30,16,\$26,0
+-	ldgp \$29,0(\$27)
+-	.prologue 1
+-	.long 0x47e03d80 # implver \$0
+-	lda \$2,-1
+-	.long 0x47e20c21 # amask \$2,\$1
+-	lda \$16,\$Lformat
+-	mov \$0,\$17
+-	not \$1,\$18
+-	jsr \$26,printf
+-	ldgp \$29,0(\$26)
+-	mov 0,\$16
+-	jsr \$26,exit
+-	.end main
+-EOF
+-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		case `$dummy` in
+-			0-0)
+-				UNAME_MACHINE="alpha"
+-				;;
+-			1-0)
+-				UNAME_MACHINE="alphaev5"
+-				;;
+-			1-1)
+-				UNAME_MACHINE="alphaev56"
+-				;;
+-			1-101)
+-				UNAME_MACHINE="alphapca56"
+-				;;
+-			2-303)
+-				UNAME_MACHINE="alphaev6"
+-				;;
+-			2-307)
+-				UNAME_MACHINE="alphaev67"
+-				;;
+-			2-1307)
+-				UNAME_MACHINE="alphaev68"
+-				;;
+-			3-1307)
+-				UNAME_MACHINE="alphaev7"
+-				;;
+-		esac
+-	fi
+-	rm -f $dummy.s $dummy && rmdir $tmpdir
+-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ 	exit 0 ;;
+     Alpha\ *:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+@@ -310,6 +319,12 @@
+     *:OS/390:*:*)
+ 	echo i370-ibm-openedition
+ 	exit 0 ;;
++    *:z/VM:*:*)
++	echo s390-ibm-zvmoe
++	exit 0 ;;
++    *:OS400:*:*)
++        echo powerpc-ibm-os400
++	exit 0 ;;
+     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ 	echo arm-acorn-riscix${UNAME_RELEASE}
+ 	exit 0;;
+@@ -327,7 +342,10 @@
+     NILE*:*:*:dcosx)
+ 	echo pyramid-pyramid-svr4
+ 	exit 0 ;;
+-    DRS?6000:UNIX_SV:4.2*:7*)
++    DRS?6000:unix:4.0:6*)
++	echo sparc-icl-nx6
++	exit 0 ;;
++    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ 	case `/usr/bin/uname -p` in
+ 	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+ 	esac ;;
+@@ -399,6 +417,9 @@
+     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+         echo m68k-unknown-mint${UNAME_RELEASE}
+         exit 0 ;;
++    m68k:machten:*:*)
++	echo m68k-apple-machten${UNAME_RELEASE}
++	exit 0 ;;
+     powerpc:machten:*:*)
+ 	echo powerpc-apple-machten${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -437,16 +458,18 @@
+ 	  exit (-1);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy \
++	$CC_FOR_BUILD -o $dummy $dummy.c \
+ 	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+-	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-	rm -f $dummy.c $dummy && rmdir $tmpdir
++	  && exit 0
+ 	echo mips-mips-riscos${UNAME_RELEASE}
+ 	exit 0 ;;
+     Motorola:PowerMAX_OS:*:*)
+ 	echo powerpc-motorola-powermax
+ 	exit 0 ;;
+-    Night_Hawk:*:*:PowerMAX_OS)
++    Motorola:*:4.3:PL8-*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
++    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ 	echo powerpc-harris-powermax
+ 	exit 0 ;;
+     Night_Hawk:Power_UNIX:*:*)
+@@ -521,8 +544,7 @@
+ 			exit(0);
+ 			}
+ EOF
+-		$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-		rm -f $dummy.c $dummy && rmdir $tmpdir
++		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 		echo rs6000-ibm-aix3.2.5
+ 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ 		echo rs6000-ibm-aix3.2.4
+@@ -620,11 +642,21 @@
+                   exit (0);
+               }
+ EOF
+-		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
+-		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+-		    rm -f $dummy.c $dummy && rmdir $tmpdir
++		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
++		    test -z "$HP_ARCH" && HP_ARCH=hppa
+ 		fi ;;
+ 	esac
++	if [ ${HP_ARCH} = "hppa2.0w" ]
++	then
++	    # avoid double evaluation of $set_cc_for_build
++	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
++	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++	    then
++		HP_ARCH="hppa2.0w"
++	    else
++		HP_ARCH="hppa64"
++	    fi
++	fi
+ 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     ia64:HP-UX:*:*)
+@@ -658,8 +690,7 @@
+ 	  exit (0);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-	rm -f $dummy.c $dummy && rmdir $tmpdir
++	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 	echo unknown-hitachi-hiuxwe2
+ 	exit 0 ;;
+     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+@@ -717,21 +748,26 @@
+     CRAY*TS:*:*:*)
+ 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY*T3D:*:*:*)
+-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+-	exit 0 ;;
+     CRAY*T3E:*:*:*)
+ 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*SV1:*:*:*)
+ 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
++    *:UNICOS/mp:*:*)
++	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++	exit 0 ;;
+     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+         exit 0 ;;
++    5000:UNIX_System_V:4.*:*)
++        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++	exit 0 ;;
+     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -742,19 +778,7 @@
+ 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:FreeBSD:*:*)
+-	# Determine whether the default compiler uses glibc.
+-	eval $set_cc_for_build
+-	sed 's/^	//' << EOF >$dummy.c
+-	#include <features.h>
+-	#if __GLIBC__ >= 2
+-	LIBC=gnu
+-	#else
+-	LIBC=
+-	#endif
+-EOF
+-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+-	rm -f $dummy.c && rmdir $tmpdir
+-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
++	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ 	exit 0 ;;
+     i*:CYGWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-cygwin
+@@ -765,14 +789,17 @@
+     i*:PW*:*)
+ 	echo ${UNAME_MACHINE}-pc-pw32
+ 	exit 0 ;;
+-    x86:Interix*:3*)
+-	echo i386-pc-interix3
++    x86:Interix*:[34]*)
++	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
++	exit 0 ;;
++    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
++	echo i${UNAME_MACHINE}-pc-mks
+ 	exit 0 ;;
+     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+ 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ 	# UNAME_MACHINE based on the output of uname instead of i386?
+-	echo i386-pc-interix
++	echo i586-pc-interix
+ 	exit 0 ;;
+     i*:UWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-uwin
+@@ -784,17 +811,34 @@
+ 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+     *:GNU:*:*)
++	# the GNU system
+ 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ 	exit 0 ;;
++    *:GNU/*:*:*)
++	# other systems with GNU libc and userland
++	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++	exit 0 ;;
+     i*86:Minix:*:*)
+ 	echo ${UNAME_MACHINE}-pc-minix
+ 	exit 0 ;;
+     arm*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    cris:Linux:*:*)
++	echo cris-axis-linux-gnu
++	exit 0 ;;
++    crisv32:Linux:*:*)
++	echo crisv32-axis-linux-gnu
++	exit 0 ;;
++    frv:Linux:*:*)
++    	echo frv-unknown-linux-gnu
++	exit 0 ;;
+     ia64:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    m32r*:Linux:*:*)
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     m68*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -815,8 +859,26 @@
+ 	#endif
+ EOF
+ 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+-	rm -f $dummy.c && rmdir $tmpdir
+-	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++	;;
++    mips64:Linux:*:*)
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips64
++	#undef mips64el
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mips64el
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips64
++	#else
++	CPU=
++	#endif
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ 	;;
+     ppc:Linux:*:*)
+ 	echo powerpc-unknown-linux-gnu
+@@ -852,6 +914,9 @@
+     s390:Linux:*:* | s390x:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-ibm-linux
+ 	exit 0 ;;
++    sh64*:Linux:*:*)
++    	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     sh*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -909,9 +974,11 @@
+ 	LIBC=gnuaout
+ 	#endif
+ 	#endif
++	#ifdef __dietlibc__
++	LIBC=dietlibc
++	#endif
+ EOF
+ 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+-	rm -f $dummy.c && rmdir $tmpdir
+ 	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ 	;;
+@@ -929,6 +996,26 @@
+         # Use sysv4.2uw... so that sysv4* matches it.
+ 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ 	exit 0 ;;
++    i*86:OS/2:*:*)
++	# If we were able to find `uname', then EMX Unix compatibility
++	# is probably installed.
++	echo ${UNAME_MACHINE}-pc-os2-emx
++	exit 0 ;;
++    i*86:XTS-300:*:STOP)
++	echo ${UNAME_MACHINE}-unknown-stop
++	exit 0 ;;
++    i*86:atheos:*:*)
++	echo ${UNAME_MACHINE}-unknown-atheos
++	exit 0 ;;
++	i*86:syllable:*:*)
++	echo ${UNAME_MACHINE}-pc-syllable
++	exit 0 ;;
++    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
++	echo i386-unknown-lynxos${UNAME_RELEASE}
++	exit 0 ;;
++    i*86:*DOS:*:*)
++	echo ${UNAME_MACHINE}-pc-msdosdjgpp
++	exit 0 ;;
+     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+@@ -963,9 +1050,6 @@
+ 		echo ${UNAME_MACHINE}-pc-sysv32
+ 	fi
+ 	exit 0 ;;
+-    i*86:*DOS:*:*)
+-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+-	exit 0 ;;
+     pc:*:*:*)
+ 	# Left here for compatibility:
+         # uname -m prints for DJGPP always 'pc', but it prints nothing about
+@@ -989,9 +1073,15 @@
+ 	# "miniframe"
+ 	echo m68010-convergent-sysv
+ 	exit 0 ;;
+-    M68*:*:R3V[567]*:*)
++    mc68k:UNIX:SYSTEM5:3.51m)
++	echo m68k-convergent-sysv
++	exit 0 ;;
++    M680?0:D-NIX:5.3:*)
++	echo m68k-diab-dnix
++	exit 0 ;;
++    M68*:*:R3V[5678]*:*)
+ 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
++    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ 	OS_REL=''
+ 	test -r /etc/.relid \
+ 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+@@ -1008,9 +1098,6 @@
+     mc68030:UNIX_System_V:4.*:*)
+ 	echo m68k-atari-sysv4
+ 	exit 0 ;;
+-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+-	echo i386-unknown-lynxos${UNAME_RELEASE}
+-	exit 0 ;;
+     TSUNAMI:LynxOS:2.*:*)
+ 	echo sparc-unknown-lynxos${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1082,6 +1169,9 @@
+     SX-5:SUPER-UX:*:*)
+ 	echo sx5-nec-superux${UNAME_RELEASE}
+ 	exit 0 ;;
++    SX-6:SUPER-UX:*:*)
++	echo sx6-nec-superux${UNAME_RELEASE}
++	exit 0 ;;
+     Power*:Rhapsody:*:*)
+ 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1089,7 +1179,12 @@
+ 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:Darwin:*:*)
+-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
++	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
++	case $UNAME_PROCESSOR in
++	    *86) UNAME_PROCESSOR=i686 ;;
++	    unknown) UNAME_PROCESSOR=powerpc ;;
++	esac
++	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ 	UNAME_PROCESSOR=`uname -p`
+@@ -1102,7 +1197,7 @@
+     *:QNX:*:4*)
+ 	echo i386-pc-qnx
+ 	exit 0 ;;
+-    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
++    NSR-?:NONSTOP_KERNEL:*:*)
+ 	echo nsr-tandem-nsk${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:NonStop-UX:*:*)
+@@ -1125,11 +1220,6 @@
+ 	fi
+ 	echo ${UNAME_MACHINE}-unknown-plan9
+ 	exit 0 ;;
+-    i*86:OS/2:*:*)
+-	# If we were able to find `uname', then EMX Unix compatibility
+-	# is probably installed.
+-	echo ${UNAME_MACHINE}-pc-os2-emx
+-	exit 0 ;;
+     *:TOPS-10:*:*)
+ 	echo pdp10-unknown-tops10
+ 	exit 0 ;;
+@@ -1148,11 +1238,21 @@
+     *:ITS:*:*)
+ 	echo pdp10-unknown-its
+ 	exit 0 ;;
+-    i*86:XTS-300:*:STOP)
+-	echo ${UNAME_MACHINE}-unknown-stop
++    SEI:*:*:SEIUX)
++        echo mips-sei-seiux${UNAME_RELEASE}
+ 	exit 0 ;;
+-    i*86:atheos:*:*)
+-	echo ${UNAME_MACHINE}-unknown-atheos
++    *:DragonFly:*:*)
++	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++	exit 0 ;;
++    *:*VMS:*:*)
++    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
++	case "${UNAME_MACHINE}" in
++	    A*) echo alpha-dec-vms && exit 0 ;;
++	    I*) echo ia64-dec-vms && exit 0 ;;
++	    V*) echo vax-dec-vms && exit 0 ;;
++	esac ;;
++    *:XENIX:*:SysV)
++	echo i386-pc-xenix
+ 	exit 0 ;;
+ esac
+ 
+@@ -1274,8 +1374,7 @@
+ }
+ EOF
+ 
+-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-rm -f $dummy.c $dummy && rmdir $tmpdir
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+ 
+ # Apollos put the system type in the environment.
+ 
+diff -Naur file-4.15.orig/config.sub file-4.15/config.sub
+--- file-4.15.orig/config.sub	2003-03-25 13:01:09.000000000 +0000
++++ file-4.15/config.sub	2005-10-01 17:10:12.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-#   2000, 2001, 2002 Free Software Foundation, Inc.
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2002-07-03'
++timestamp='2004-11-30'
+ 
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -70,7 +70,7 @@
+ version="\
+ GNU config.sub ($timestamp)
+ 
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -118,7 +118,8 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+-  nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
++  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
++  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -144,7 +145,7 @@
+ 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+-	-apple | -axis)
++	-apple | -axis | -knuth | -cray)
+ 		os=
+ 		basic_machine=$1
+ 		;;
+@@ -228,39 +229,45 @@
+ 	| a29k \
+ 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
++	| am33_2.0 \
+ 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ 	| c4x | clipper \
+ 	| d10v | d30v | dlx | dsp16xx \
+ 	| fr30 | frv \
+ 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ 	| i370 | i860 | i960 | ia64 \
+-	| ip2k \
+-	| m32r | m68000 | m68k | m88k | mcore \
++	| ip2k | iq2000 \
++	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ 	| mips | mipsbe | mipseb | mipsel | mipsle \
+ 	| mips16 \
+ 	| mips64 | mips64el \
++	| mips64vr | mips64vrel \
+ 	| mips64orion | mips64orionel \
+ 	| mips64vr4100 | mips64vr4100el \
+ 	| mips64vr4300 | mips64vr4300el \
+ 	| mips64vr5000 | mips64vr5000el \
+ 	| mipsisa32 | mipsisa32el \
++	| mipsisa32r2 | mipsisa32r2el \
+ 	| mipsisa64 | mipsisa64el \
++	| mipsisa64r2 | mipsisa64r2el \
+ 	| mipsisa64sb1 | mipsisa64sb1el \
++	| mipsisa64sr71k | mipsisa64sr71kel \
+ 	| mipstx39 | mipstx39el \
+ 	| mn10200 | mn10300 \
++	| msp430 \
+ 	| ns16k | ns32k \
+ 	| openrisc | or32 \
+ 	| pdp10 | pdp11 | pj | pjl \
+ 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ 	| pyramid \
+-	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ 	| sh64 | sh64le \
+-	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
++	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ 	| strongarm \
+-	| tahoe | thumb | tic80 | tron \
++	| tahoe | thumb | tic4x | tic80 | tron \
+ 	| v850 | v850e \
+ 	| we32k \
+-	| x86 | xscale | xstormy16 | xtensa \
++	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ 	| z8k)
+ 		basic_machine=$basic_machine-unknown
+ 		;;
+@@ -292,44 +299,52 @@
+ 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+ 	| avr-* \
+ 	| bs2000-* \
+-	| c[123]* | c30-* | [cjt]90-* | c54x-* \
+-	| clipper-* | cydra-* \
++	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
++	| clipper-* | craynv-* | cydra-* \
+ 	| d10v-* | d30v-* | dlx-* \
+ 	| elxsi-* \
+ 	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ 	| h8300-* | h8500-* \
+ 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ 	| i*86-* | i860-* | i960-* | ia64-* \
+-	| ip2k-* \
+-	| m32r-* \
++	| ip2k-* | iq2000-* \
++	| m32r-* | m32rle-* \
+ 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+-	| m88110-* | m88k-* | mcore-* \
++	| m88110-* | m88k-* | maxq-* | mcore-* \
+ 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ 	| mips16-* \
+ 	| mips64-* | mips64el-* \
++	| mips64vr-* | mips64vrel-* \
+ 	| mips64orion-* | mips64orionel-* \
+ 	| mips64vr4100-* | mips64vr4100el-* \
+ 	| mips64vr4300-* | mips64vr4300el-* \
+ 	| mips64vr5000-* | mips64vr5000el-* \
+ 	| mipsisa32-* | mipsisa32el-* \
++	| mipsisa32r2-* | mipsisa32r2el-* \
+ 	| mipsisa64-* | mipsisa64el-* \
++	| mipsisa64r2-* | mipsisa64r2el-* \
+ 	| mipsisa64sb1-* | mipsisa64sb1el-* \
+-	| mipstx39 | mipstx39el \
++	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
++	| mipstx39-* | mipstx39el-* \
++	| mmix-* \
++	| msp430-* \
+ 	| none-* | np1-* | ns16k-* | ns32k-* \
+ 	| orion-* \
+ 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ 	| pyramid-* \
+ 	| romp-* | rs6000-* \
+-	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
++	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ 	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+-	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+-	| tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
++	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++	| tahoe-* | thumb-* \
++	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++	| tron-* \
+ 	| v850-* | v850e-* | vax-* \
+ 	| we32k-* \
+-	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+-	| xtensa-* \
++	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
++	| xstormy16-* | xtensa-* \
+ 	| ymp-* \
+ 	| z8k-*)
+ 		;;
+@@ -349,6 +364,9 @@
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++    	abacus)
++		basic_machine=abacus-unknown
++		;;
+ 	adobe68k)
+ 		basic_machine=m68010-adobe
+ 		os=-scout
+@@ -363,6 +381,12 @@
+ 		basic_machine=a29k-none
+ 		os=-bsd
+ 		;;
++	amd64)
++		basic_machine=x86_64-pc
++		;;
++	amd64-*)
++		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	amdahl)
+ 		basic_machine=580-amdahl
+ 		os=-sysv
+@@ -422,12 +446,27 @@
+ 		basic_machine=j90-cray
+ 		os=-unicos
+ 		;;
++	craynv)
++		basic_machine=craynv-cray
++		os=-unicosmp
++		;;
++	cr16c)
++		basic_machine=cr16c-unknown
++		os=-elf
++		;;
+ 	crds | unos)
+ 		basic_machine=m68k-crds
+ 		;;
++	crisv32 | crisv32-* | etraxfs*)
++		basic_machine=crisv32-axis
++		;;
+ 	cris | cris-* | etrax*)
+ 		basic_machine=cris-axis
+ 		;;
++	crx)
++		basic_machine=crx-unknown
++		os=-elf
++		;;
+ 	da30 | da30-*)
+ 		basic_machine=m68k-da30
+ 		;;
+@@ -450,6 +489,10 @@
+ 		basic_machine=m88k-motorola
+ 		os=-sysv3
+ 		;;
++	djgpp)
++		basic_machine=i586-pc
++		os=-msdosdjgpp
++		;;
+ 	dpx20 | dpx20-*)
+ 		basic_machine=rs6000-bull
+ 		os=-bosx
+@@ -628,10 +671,6 @@
+ 	mips3*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ 		;;
+-	mmix*)
+-		basic_machine=mmix-knuth
+-		os=-mmixware
+-		;;
+ 	monitor)
+ 		basic_machine=m68k-rom68k
+ 		os=-coff
+@@ -723,6 +762,10 @@
+ 		basic_machine=or32-unknown
+ 		os=-coff
+ 		;;
++	os400)
++		basic_machine=powerpc-ibm
++		os=-os400
++		;;
+ 	OSE68000 | ose68000)
+ 		basic_machine=m68000-ericsson
+ 		os=-ose
+@@ -745,49 +788,55 @@
+ 	pbb)
+ 		basic_machine=m68k-tti
+ 		;;
+-        pc532 | pc532-*)
++	pc532 | pc532-*)
+ 		basic_machine=ns32k-pc532
+ 		;;
+ 	pentium | p5 | k5 | k6 | nexgen | viac3)
+ 		basic_machine=i586-pc
+ 		;;
+-	pentiumpro | p6 | 6x86 | athlon)
++	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ 		basic_machine=i686-pc
+ 		;;
+-	pentiumii | pentium2)
++	pentiumii | pentium2 | pentiumiii | pentium3)
+ 		basic_machine=i686-pc
+ 		;;
++	pentium4)
++		basic_machine=i786-pc
++		;;
+ 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+-	pentiumii-* | pentium2-*)
++	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
++	pentium4-*)
++		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	pn)
+ 		basic_machine=pn-gould
+ 		;;
+ 	power)	basic_machine=power-ibm
+ 		;;
+ 	ppc)	basic_machine=powerpc-unknown
+-	        ;;
++		;;
+ 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppcle | powerpclittle | ppc-le | powerpc-little)
+ 		basic_machine=powerpcle-unknown
+-	        ;;
++		;;
+ 	ppcle-* | powerpclittle-*)
+ 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppc64)	basic_machine=powerpc64-unknown
+-	        ;;
++		;;
+ 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ 		basic_machine=powerpc64le-unknown
+-	        ;;
++		;;
+ 	ppc64le-* | powerpc64little-*)
+ 		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+@@ -818,6 +867,16 @@
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++	sb1)
++		basic_machine=mipsisa64sb1-unknown
++		;;
++	sb1el)
++		basic_machine=mipsisa64sb1el-unknown
++		;;
++	sei)
++		basic_machine=mips-sei
++		os=-seiux
++		;;
+ 	sequent)
+ 		basic_machine=i386-sequent
+ 		;;
+@@ -825,6 +884,9 @@
+ 		basic_machine=sh-hitachi
+ 		os=-hms
+ 		;;
++	sh64)
++		basic_machine=sh64-unknown
++		;;
+ 	sparclite-wrs | simso-wrs)
+ 		basic_machine=sparclite-wrs
+ 		os=-vxworks
+@@ -883,7 +945,7 @@
+ 	sun386 | sun386i | roadrunner)
+ 		basic_machine=i386-sun
+ 		;;
+-        sv1)
++	sv1)
+ 		basic_machine=sv1-cray
+ 		os=-unicos
+ 		;;
+@@ -891,10 +953,6 @@
+ 		basic_machine=i386-sequent
+ 		os=-dynix
+ 		;;
+-	t3d)
+-		basic_machine=alpha-cray
+-		os=-unicos
+-		;;
+ 	t3e)
+ 		basic_machine=alphaev5-cray
+ 		os=-unicos
+@@ -907,6 +965,14 @@
+ 		basic_machine=tic54x-unknown
+ 		os=-coff
+ 		;;
++	tic55x | c55x*)
++		basic_machine=tic55x-unknown
++		os=-coff
++		;;
++	tic6x | c6x*)
++		basic_machine=tic6x-unknown
++		os=-coff
++		;;
+ 	tx39)
+ 		basic_machine=mipstx39-unknown
+ 		;;
+@@ -920,6 +986,10 @@
+ 	tower | tower-32)
+ 		basic_machine=m68k-ncr
+ 		;;
++	tpf)
++		basic_machine=s390x-ibm
++		os=-tpf
++		;;
+ 	udi29k)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+@@ -941,8 +1011,8 @@
+ 		os=-vms
+ 		;;
+ 	vpp*|vx|vx-*)
+-               basic_machine=f301-fujitsu
+-               ;;
++		basic_machine=f301-fujitsu
++		;;
+ 	vxworks960)
+ 		basic_machine=i960-wrs
+ 		os=-vxworks
+@@ -963,11 +1033,11 @@
+ 		basic_machine=hppa1.1-winbond
+ 		os=-proelf
+ 		;;
+-	windows32)
+-		basic_machine=i386-pc
+-		os=-windows32-msvcrt
++	xbox)
++		basic_machine=i686-pc
++		os=-mingw32
+ 		;;
+-        xps | xps100)
++	xps | xps100)
+ 		basic_machine=xps100-honeywell
+ 		;;
+ 	ymp)
+@@ -997,6 +1067,9 @@
+ 	romp)
+ 		basic_machine=romp-ibm
+ 		;;
++	mmix)
++		basic_machine=mmix-knuth
++		;;
+ 	rs6000)
+ 		basic_machine=rs6000-ibm
+ 		;;
+@@ -1013,16 +1086,16 @@
+ 	we32k)
+ 		basic_machine=we32k-att
+ 		;;
+-	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
++	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ 		basic_machine=sh-unknown
+ 		;;
+ 	sh64)
+ 		basic_machine=sh64-unknown
+ 		;;
+-	sparc | sparcv9 | sparcv9b)
++	sparc | sparcv8 | sparcv9 | sparcv9b)
+ 		basic_machine=sparc-sun
+ 		;;
+-        cydra)
++	cydra)
+ 		basic_machine=cydra-cydrome
+ 		;;
+ 	orion)
+@@ -1037,10 +1110,6 @@
+ 	pmac | pmac-mpw)
+ 		basic_machine=powerpc-apple
+ 		;;
+-	c4x*)
+-		basic_machine=c4x-none
+-		os=-coff
+-		;;
+ 	*-unknown)
+ 		# Make sure to match an already-canonicalized machine name.
+ 		;;
+@@ -1096,18 +1165,20 @@
+ 	      | -aos* \
+ 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
++	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
++	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ 	      | -chorusos* | -chorusrdb* \
+ 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
++	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
++	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
++	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
++	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ 	# Remember, each alternative MUST END IN *, to match a version number.
+ 		;;
+ 	-qnx*)
+@@ -1119,8 +1190,10 @@
+ 			;;
+ 		esac
+ 		;;
++	-nto-qnx*)
++		;;
+ 	-nto*)
+-		os=-nto-qnx
++		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ 		;;
+ 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ 	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+@@ -1129,6 +1202,9 @@
+ 	-mac*)
+ 		os=`echo $os | sed -e 's|mac|macos|'`
+ 		;;
++	-linux-dietlibc)
++		os=-linux-dietlibc
++		;;
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
+@@ -1141,6 +1217,9 @@
+ 	-opened*)
+ 		os=-openedition
+ 		;;
++        -os400*)
++		os=-os400
++		;;
+ 	-wince*)
+ 		os=-wince
+ 		;;
+@@ -1162,6 +1241,9 @@
+ 	-atheos*)
+ 		os=-atheos
+ 		;;
++	-syllable*)
++		os=-syllable
++		;;
+ 	-386bsd)
+ 		os=-bsd
+ 		;;
+@@ -1172,7 +1254,7 @@
+ 		os=-rtmk-nova
+ 		;;
+ 	-ns2 )
+-	        os=-nextstep2
++		os=-nextstep2
+ 		;;
+ 	-nsk*)
+ 		os=-nsk
+@@ -1184,6 +1266,9 @@
+ 	-sinix*)
+ 		os=-sysv4
+ 		;;
++        -tpf*)
++		os=-tpf
++		;;
+ 	-triton*)
+ 		os=-sysv3
+ 		;;
+@@ -1211,8 +1296,17 @@
+ 	-xenix)
+ 		os=-xenix
+ 		;;
+-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+-	        os=-mint
++	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
++		os=-mint
++		;;
++	-aros*)
++		os=-aros
++		;;
++	-kaos*)
++		os=-kaos
++		;;
++	-zvmoe)
++		os=-zvmoe
+ 		;;
+ 	-none)
+ 		;;
+@@ -1245,11 +1339,14 @@
+ 	arm*-semi)
+ 		os=-aout
+ 		;;
++    c4x-* | tic4x-*)
++        os=-coff
++        ;;
+ 	# This must come before the *-dec entry.
+ 	pdp10-*)
+ 		os=-tops20
+ 		;;
+-        pdp11-*)
++	pdp11-*)
+ 		os=-none
+ 		;;
+ 	*-dec | vax-*)
+@@ -1291,6 +1388,9 @@
+ 	*-ibm)
+ 		os=-aix
+ 		;;
++    	*-knuth)
++		os=-mmixware
++		;;
+ 	*-wec)
+ 		os=-proelf
+ 		;;
+@@ -1342,19 +1442,19 @@
+ 	*-next)
+ 		os=-nextstep3
+ 		;;
+-        *-gould)
++	*-gould)
+ 		os=-sysv
+ 		;;
+-        *-highlevel)
++	*-highlevel)
+ 		os=-bsd
+ 		;;
+ 	*-encore)
+ 		os=-bsd
+ 		;;
+-        *-sgi)
++	*-sgi)
+ 		os=-irix
+ 		;;
+-        *-siemens)
++	*-siemens)
+ 		os=-sysv4
+ 		;;
+ 	*-masscomp)
+@@ -1423,9 +1523,15 @@
+ 			-mvs* | -opened*)
+ 				vendor=ibm
+ 				;;
++			-os400*)
++				vendor=ibm
++				;;
+ 			-ptx*)
+ 				vendor=sequent
+ 				;;
++			-tpf*)
++				vendor=ibm
++				;;
+ 			-vxsim* | -vxworks* | -windiss*)
+ 				vendor=wrs
+ 				;;
Index: patches/gawk-3.1.5-segfault_fix-1.patch
===================================================================
--- patches/gawk-3.1.5-segfault_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gawk-3.1.5-segfault_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,43 @@
+Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
+Date: 2005-09-24
+Initial Package Version: 3.1.5
+Upstream Status: From Upstream
+Origin: http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
+Description: Fixes a bug which causes gawk to segfault when operating on a non-existent file.
+
+diff -Naur gawk-3.1.5.orig/io.c gawk-3.1.5/io.c
+--- gawk-3.1.5.orig/io.c	2005-07-26 18:07:43.000000000 +0000
++++ gawk-3.1.5/io.c	2005-09-24 14:43:13.771380264 +0000
+@@ -2480,9 +2480,12 @@
+ {
+ 	struct stat sbuf;
+ 	struct open_hook *oh;
++	int iop_malloced = FALSE;
+ 
+-	if (iop == NULL)
++	if (iop == NULL) {
+ 		emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
++		iop_malloced = TRUE;
++	}
+ 	memset(iop, '\0', sizeof(IOBUF));
+ 	iop->flag = 0;
+ 	iop->fd = fd;
+@@ -2495,7 +2498,8 @@
+ 	}
+ 
+ 	if (iop->fd == INVALID_HANDLE) {
+-		free(iop);
++		if (iop_malloced)
++			free(iop);
+ 		return NULL;
+ 	}
+ 	if (isatty(iop->fd))
+@@ -2503,7 +2507,7 @@
+ 	iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
+ 	iop->sbuf = sbuf;
+ 	if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
+-			lintwarn(_("data file `%s' is empty"), name);
++		lintwarn(_("data file `%s' is empty"), name);
+ 	errno = 0;
+ 	iop->count = iop->scanoff = 0;
+ 	emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");
Index: patches/gcc-4.0.3-cross_search_paths-1.patch
===================================================================
--- patches/gcc-4.0.3-cross_search_paths-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gcc-4.0.3-cross_search_paths-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,48 @@
+Submitted by: Ryan Oliver <ryan.oliver@pha.com.au>
+Date: 2005-05-02
+Initial Package Version: 4.0.1
+Origin: Ryan Oliver (issue reported by Erik-Jan Post)
+Upstream Status: N/A
+Description:
+  Removes standard_exec_prefix_2 from library search path when cross-compiling.
+  Removes both standard_exec_prefix_1 and standard_exec_prefix_2 from the gcc
+  executable search path when cross-compiling.
+
+  ie: if cross_compile = 1 in the specs file, do not
+      - do not add /usr/lib/gcc/${TARGET}/${GCC_VER} to the library search path
+      - do not add /usr/lib/gcc/${TARGET}/${GCC_VER} or
+                   /usr/libexec/gcc/${TARGET}/${GCC_VER}
+        to the executable search path
+
+  This avoids the possibility of linking in libraries from the host if they
+  exist under those directories.
+ 
+diff -Naur gcc-4.0.1.orig/gcc/gcc.c gcc-4.0.1/gcc/gcc.c
+--- gcc-4.0.1.orig/gcc/gcc.c	2005-06-06 19:20:29.000000000 +0000
++++ gcc-4.0.1/gcc/gcc.c	2005-08-27 21:16:02.000000000 +0000
+@@ -3797,16 +3797,22 @@
+ 	      PREFIX_PRIORITY_LAST, 2, 0);
+   add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
+ 	      PREFIX_PRIORITY_LAST, 2, 0);
+-  add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
++  if (*cross_compile == '0')
++    {
++      add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
+ 	      PREFIX_PRIORITY_LAST, 2, 0);
+-  add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
++      add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
+ 	      PREFIX_PRIORITY_LAST, 2, 0);
++    }
+ #endif
+ 
+   add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
+ 	      PREFIX_PRIORITY_LAST, 1, 0);
+-  add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
++  if (*cross_compile == '0')
++    {
++      add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
+ 	      PREFIX_PRIORITY_LAST, 1, 0);
++    }
+ 
+   tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
+ 			   dir_separator_str, NULL);
Index: patches/gcc-4.0.3-mips_tls-1.patch
===================================================================
--- patches/gcc-4.0.3-mips_tls-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gcc-4.0.3-mips_tls-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,533 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-09-12
+Initial Package Version: 4.0.1
+Origin: Daniel Jacobowitz
+Upstream Status: GCC Dev Mailling lists
+Description: Adds support for TLS on MIPS
+ 
+diff -Naur gcc-4.0.1.orig/gcc/config/mips/mips-protos.h gcc-4.0.1/gcc/config/mips/mips-protos.h
+--- gcc-4.0.1.orig/gcc/config/mips/mips-protos.h	2004-12-30 03:07:56.000000000 +0000
++++ gcc-4.0.1/gcc/config/mips/mips-protos.h	2005-09-12 23:27:07.000000000 +0000
+@@ -61,6 +61,17 @@
+        An UNSPEC wrapper around a function's address.  It represents the
+        offset of _gp from the start of the function.
+ 
++   SYMBOL_TLS
++       A thread-local symbol.
++
++   SYMBOL_TLSGD
++   SYMBOL_TLSLDM
++   SYMBOL_DTPREL
++   SYMBOL_GOTTPREL
++   SYMBOL_TPREL
++       UNSPEC wrappers around SYMBOL_TLS, corresponding to the
++       thread-local storage relocation operators.
++
+    SYMBOL_64_HIGH
+        For a 64-bit symbolic address X, this is the value of
+        (%highest(X) << 16) + %higher(X).
+@@ -82,6 +93,12 @@
+   SYMBOL_GOTOFF_GLOBAL,
+   SYMBOL_GOTOFF_CALL,
+   SYMBOL_GOTOFF_LOADGP,
++  SYMBOL_TLS,
++  SYMBOL_TLSGD,
++  SYMBOL_TLSLDM,
++  SYMBOL_DTPREL,
++  SYMBOL_GOTTPREL,
++  SYMBOL_TPREL,
+   SYMBOL_64_HIGH,
+   SYMBOL_64_MID,
+   SYMBOL_64_LOW
+diff -Naur gcc-4.0.1.orig/gcc/config/mips/mips.c gcc-4.0.1/gcc/config/mips/mips.c
+--- gcc-4.0.1.orig/gcc/config/mips/mips.c	2005-05-08 11:56:53.000000000 +0000
++++ gcc-4.0.1/gcc/config/mips/mips.c	2005-09-12 23:27:07.000000000 +0000
+@@ -236,6 +236,7 @@
+ static bool mips_symbolic_address_p (enum mips_symbol_type, enum machine_mode);
+ static bool mips_classify_address (struct mips_address_info *, rtx,
+ 				   enum machine_mode, int);
++static bool mips_cannot_force_const_mem (rtx);
+ static int mips_symbol_insns (enum mips_symbol_type);
+ static bool mips16_unextended_reference_p (enum machine_mode mode, rtx, rtx);
+ static rtx mips_force_temporary (rtx, rtx);
+@@ -601,7 +602,7 @@
+ /* Map hard register number to register class */
+ const enum reg_class mips_regno_to_class[] =
+ {
+-  LEA_REGS,	LEA_REGS,	M16_NA_REGS,	M16_NA_REGS,
++  LEA_REGS,	LEA_REGS,	M16_NA_REGS,	V1_REG,
+   M16_REGS,	M16_REGS,	M16_REGS,	M16_REGS,
+   LEA_REGS,	LEA_REGS,	LEA_REGS,	LEA_REGS,
+   LEA_REGS,	LEA_REGS,	LEA_REGS,	LEA_REGS,
+@@ -817,6 +818,12 @@
+ #undef TARGET_EXPAND_BUILTIN
+ #define TARGET_EXPAND_BUILTIN mips_expand_builtin
+ 
++#undef TARGET_HAVE_TLS
++#define TARGET_HAVE_TLS HAVE_AS_TLS
++
++#undef TARGET_CANNOT_FORCE_CONST_MEM
++#define TARGET_CANNOT_FORCE_CONST_MEM mips_cannot_force_const_mem
++
+ struct gcc_target targetm = TARGET_INITIALIZER;
+ 
+
+ /* Classify symbol X, which must be a SYMBOL_REF or a LABEL_REF.  */
+@@ -835,6 +842,9 @@
+ 
+   gcc_assert (GET_CODE (x) == SYMBOL_REF);
+ 
++  if (SYMBOL_REF_TLS_MODEL (x))
++    return SYMBOL_TLS;
++
+   if (CONSTANT_POOL_ADDRESS_P (x))
+     {
+       if (TARGET_MIPS16)
+@@ -943,7 +953,11 @@
+   if (UNSPEC_ADDRESS_P (x))
+     *symbol_type = UNSPEC_ADDRESS_TYPE (x);
+   else if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+-    *symbol_type = mips_classify_symbol (x);
++    {
++      *symbol_type = mips_classify_symbol (x);
++      if (*symbol_type == SYMBOL_TLS)
++	return false;
++    }
+   else
+     return false;
+ 
+@@ -993,6 +1007,12 @@
+     case SYMBOL_GOTOFF_GLOBAL:
+     case SYMBOL_GOTOFF_CALL:
+     case SYMBOL_GOTOFF_LOADGP:
++    case SYMBOL_TLSGD:
++    case SYMBOL_TLSLDM:
++    case SYMBOL_DTPREL:
++    case SYMBOL_TPREL:
++    case SYMBOL_GOTTPREL:
++    case SYMBOL_TLS:
+       return false;
+     }
+   gcc_unreachable ();
+@@ -1090,6 +1110,14 @@
+       /* The address will have to be loaded from the GOT first.  */
+       return false;
+ 
++    case SYMBOL_TLSGD:
++    case SYMBOL_TLSLDM:
++    case SYMBOL_DTPREL:
++    case SYMBOL_TPREL:
++    case SYMBOL_GOTTPREL:
++    case SYMBOL_TLS:
++      return false;
++
+     case SYMBOL_GOTOFF_PAGE:
+     case SYMBOL_GOTOFF_GLOBAL:
+     case SYMBOL_GOTOFF_CALL:
+@@ -1102,6 +1130,33 @@
+   gcc_unreachable ();
+ }
+ 
++/* Return true if X is a thread-local symbol.  */
++
++static bool
++mips_tls_operand_p (rtx x)
++{
++  return GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x) != 0;
++}
++
++/* Return true if X can not be forced into a constant pool.  */
++
++static int
++mips_tls_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED)
++{
++  return mips_tls_operand_p (*x);
++}
++
++/* Return true if X can not be forced into a constant pool.  */
++
++static bool
++mips_cannot_force_const_mem (rtx x)
++{
++  if (! TARGET_HAVE_TLS)
++    return false;
++
++  return for_each_rtx (&x, &mips_tls_symbol_ref_1, 0);
++}
++
+ 
+ /* Return true if X is a valid address for machine mode MODE.  If it is,
+    fill in INFO appropriately.  STRICT is true if we should only accept
+@@ -1223,8 +1278,19 @@
+     case SYMBOL_64_HIGH:
+     case SYMBOL_64_MID:
+     case SYMBOL_64_LOW:
++    case SYMBOL_TLSGD:
++    case SYMBOL_TLSLDM:
++    case SYMBOL_DTPREL:
++    case SYMBOL_GOTTPREL:
++    case SYMBOL_TPREL:
+       /* Check whether the offset is a 16- or 32-bit value.  */
+       return mips_split_p[type] ? 2 : 1;
++
++    case SYMBOL_TLS:
++      /* We don't treat a bare TLS symbol as a constant.  */
++      return 0;
++
++      return 1;
+     }
+   gcc_unreachable ();
+ }
+@@ -1521,6 +1587,114 @@
+   return plus_constant (reg, offset);
+ }
+ 
++/* Emit a call to __tls_get_addr.  SYM is the TLS symbol we are
++   referencing, and TYPE is the symbol type to use (either global
++   dynamic or local dynamic).  V0 is an RTX for the return value
++   location.  The entire insn sequence is returned.  */
++
++static GTY(()) rtx mips_tls_symbol;
++
++static rtx
++mips_call_tls_get_addr (rtx sym, enum mips_symbol_type type, rtx v0)
++{
++  rtx insn, loc, tga, a0;
++
++  a0 = gen_rtx_REG (Pmode, GP_ARG_FIRST);
++
++  if (!mips_tls_symbol)
++    mips_tls_symbol = init_one_libfunc ("__tls_get_addr");
++
++  loc = mips_unspec_address (sym, type);
++
++  start_sequence ();
++
++  emit_insn (gen_rtx_SET (Pmode, a0,
++			  gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, loc)));
++  tga = gen_rtx_MEM (Pmode, mips_tls_symbol);
++  insn = emit_call_insn (gen_call_value (v0, tga, const0_rtx, const0_rtx));
++  CONST_OR_PURE_CALL_P (insn) = 1;
++  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), v0);
++  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), a0);
++  insn = get_insns ();
++
++  end_sequence ();
++
++  return insn;
++}
++
++/* Generate the code to access LOC, a thread local SYMBOL_REF.  The
++   return value will be a valid address and move_operand (either a REG
++   or a LO_SUM).  */
++
++static rtx
++mips_legitimize_tls_address (rtx loc)
++{
++  rtx dest, insn, v0, v1, tmp1, tmp2, eqv;
++  enum tls_model model;
++
++  v0 = gen_rtx_REG (Pmode, GP_RETURN);
++  v1 = gen_rtx_REG (Pmode, GP_RETURN + 1);
++
++  model = SYMBOL_REF_TLS_MODEL (loc);
++
++  switch (model)
++    {
++    case TLS_MODEL_GLOBAL_DYNAMIC:
++      insn = mips_call_tls_get_addr (loc, SYMBOL_TLSGD, v0);
++      dest = gen_reg_rtx (Pmode);
++      emit_libcall_block (insn, dest, v0, loc);
++      break;
++
++    case TLS_MODEL_LOCAL_DYNAMIC:
++      insn = mips_call_tls_get_addr (loc, SYMBOL_TLSLDM, v0);
++      tmp1 = gen_reg_rtx (Pmode);
++
++      /* Attach a unique REG_EQUIV, to allow the RTL optimizers to
++	 share the LDM result with other LD model accesses.  */
++      eqv = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx),
++			    UNSPEC_TLS_LDM);
++      emit_libcall_block (insn, tmp1, v0, eqv);
++
++      tmp2 = mips_unspec_offset_high (NULL, tmp1, loc, SYMBOL_DTPREL);
++      dest = gen_rtx_LO_SUM (Pmode, tmp2,
++			     mips_unspec_address (loc, SYMBOL_DTPREL));
++      break;
++
++    case TLS_MODEL_INITIAL_EXEC:
++      tmp1 = gen_reg_rtx (Pmode);
++      tmp2 = mips_unspec_address (loc, SYMBOL_GOTTPREL);
++      if (Pmode == DImode)
++	{
++	  emit_insn (gen_tls_get_tp_di (v1));
++	  emit_insn (gen_load_gotdi (tmp1, pic_offset_table_rtx, tmp2));
++	}
++      else
++	{
++	  emit_insn (gen_tls_get_tp_si (v1));
++	  emit_insn (gen_load_gotsi (tmp1, pic_offset_table_rtx, tmp2));
++	}
++      dest = gen_reg_rtx (Pmode);
++      emit_insn (gen_add3_insn (dest, tmp1, v1));
++      break;
++
++    case TLS_MODEL_LOCAL_EXEC:
++
++      if (Pmode == DImode)
++	emit_insn (gen_tls_get_tp_di (v1));
++      else
++	emit_insn (gen_tls_get_tp_si (v1));
++
++      tmp1 = mips_unspec_offset_high (NULL, v1, loc, SYMBOL_TPREL);
++      dest = gen_rtx_LO_SUM (Pmode, tmp1,
++			     mips_unspec_address (loc, SYMBOL_TPREL));
++      break;
++
++    default:
++      abort ();
++    }
++
++  return dest;
++}
+ 
+ /* This function is used to implement LEGITIMIZE_ADDRESS.  If *XLOC can
+    be legitimized in a way that the generic machinery might not expect,
+@@ -1532,6 +1706,12 @@
+ {
+   enum mips_symbol_type symbol_type;
+ 
++  if (mips_tls_operand_p (*xloc))
++    {
++      *xloc = mips_legitimize_tls_address (*xloc);
++      return true;
++    }
++
+   /* See if the address can split into a high part and a LO_SUM.  */
+   if (mips_symbolic_constant_p (*xloc, &symbol_type)
+       && mips_symbolic_address_p (symbol_type, mode)
+@@ -1707,6 +1887,12 @@
+       return;
+     }
+ 
++  if (mips_tls_operand_p (src))
++    {
++      emit_move_insn (dest, mips_legitimize_tls_address (src));
++      return;
++    }
++
+   /* See if the symbol can be split.  For mips16, this is often worse than
+      forcing it in the constant pool since it needs the single-register form
+      of addiu or daddiu.  */
+@@ -4321,6 +4507,7 @@
+ 			     GR_REGS);
+   mips_char_to_class['e'] = LEA_REGS;
+   mips_char_to_class['j'] = PIC_FN_ADDR_REG;
++  mips_char_to_class['v'] = V1_REG;
+   mips_char_to_class['y'] = GR_REGS;
+   mips_char_to_class['z'] = ST_REGS;
+   mips_char_to_class['B'] = COP0_REGS;
+@@ -4509,6 +4696,22 @@
+       mips_lo_relocs[SYMBOL_GOTOFF_LOADGP] = "%lo(%neg(%gp_rel(";
+     }
+ 
++  /* Thread-local relocation operators.  */
++  mips_lo_relocs[SYMBOL_TLSGD] = "%tlsgd(";
++  mips_lo_relocs[SYMBOL_TLSLDM] = "%tlsldm(";
++  mips_split_p[SYMBOL_DTPREL] = 1;
++  mips_hi_relocs[SYMBOL_DTPREL] = "%dtprel_hi(";
++  mips_lo_relocs[SYMBOL_DTPREL] = "%dtprel_lo(";
++  mips_lo_relocs[SYMBOL_GOTTPREL] = "%gottprel(";
++  mips_split_p[SYMBOL_TPREL] = 1;
++  mips_hi_relocs[SYMBOL_TPREL] = "%tprel_hi(";
++  mips_lo_relocs[SYMBOL_TPREL] = "%tprel_lo(";
++
++  /* We don't have a thread pointer access instruction on MIPS16, or
++     appropriate TLS relocations.  */
++  if (TARGET_MIPS16)
++    targetm.have_tls = false;
++
+   /* Default to working around R4000 errata only if the processor
+      was selected explicitly.  */
+   if ((target_flags_explicit & MASK_FIX_R4000) == 0
+diff -Naur gcc-4.0.1.orig/gcc/config/mips/mips.h gcc-4.0.1/gcc/config/mips/mips.h
+--- gcc-4.0.1.orig/gcc/config/mips/mips.h	2005-04-15 07:00:18.000000000 +0000
++++ gcc-4.0.1/gcc/config/mips/mips.h	2005-09-12 23:27:07.000000000 +0000
+@@ -1714,6 +1714,7 @@
+   T_REG,			/* mips16 T register ($24) */
+   M16_T_REGS,			/* mips16 registers plus T register */
+   PIC_FN_ADDR_REG,		/* SVR4 PIC function address register */
++  V1_REG,			/* Register $v1 ($3) used for TLS access.  */
+   LEA_REGS,			/* Every GPR except $25 */
+   GR_REGS,			/* integer registers */
+   FP_REGS,			/* floating point registers */
+@@ -1752,6 +1753,7 @@
+   "T_REG",								\
+   "M16_T_REGS",								\
+   "PIC_FN_ADDR_REG",							\
++  "V1_REG",								\
+   "LEA_REGS",								\
+   "GR_REGS",								\
+   "FP_REGS",								\
+@@ -1793,7 +1795,8 @@
+   { 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* mips16 T register */	\
+   { 0x010300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* mips16 and T regs */ \
+   { 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* SVR4 PIC function address register */ \
+-  { 0xfdffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* Every other GPR */   \
++  { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* only $v1 */ \
++  { 0xfdffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* Every other GPR except $25 */   \
+   { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* integer registers */	\
+   { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },	/* floating registers*/	\
+   { 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 },	/* hi register */	\
+@@ -1849,6 +1852,7 @@
+ #define GR_REG_CLASS_P(CLASS)						\
+   ((CLASS) == GR_REGS || (CLASS) == M16_REGS || (CLASS) == T_REG	\
+    || (CLASS) == M16_T_REGS || (CLASS) == M16_NA_REGS			\
++   || (CLASS) == V1_REG							\
+    || (CLASS) == PIC_FN_ADDR_REG || (CLASS) == LEA_REGS)
+ 
+ /* This macro is also used later on in the file.  */
+@@ -1896,6 +1900,7 @@
+    'f'	Floating point registers
+    'h'	Hi register
+    'l'	Lo register
++   'v'	$v1 only
+    'x'	Multiply/divide registers
+    'z'	FP Status register
+    'B'  Cop0 register
+@@ -3017,3 +3022,7 @@
+ 	" TEXT_SECTION_ASM_OP);
+ #endif
+ #endif
++
++#ifndef HAVE_AS_TLS
++#define HAVE_AS_TLS 0
++#endif
+diff -Naur gcc-4.0.1.orig/gcc/config/mips/mips.md gcc-4.0.1/gcc/config/mips/mips.md
+--- gcc-4.0.1.orig/gcc/config/mips/mips.md	2005-05-08 11:56:58.000000000 +0000
++++ gcc-4.0.1/gcc/config/mips/mips.md	2005-09-12 23:29:17.000000000 +0000
+@@ -45,6 +45,8 @@
+    (UNSPEC_LOAD_GOT		24)
+    (UNSPEC_GP			25)
+    (UNSPEC_MFHILO		26)
++   (UNSPEC_TLS_LDM		27)
++   (UNSPEC_TLS_GET_TP		28)
+ 
+    (UNSPEC_ADDRESS_FIRST	100)
+ 
+@@ -3027,12 +3029,12 @@
+ ;; We could use MEMs, but an unspec gives more optimization
+ ;; opportunities.
+ 
+-(define_insn "*load_got<mode>"
++(define_insn "load_got<mode>"
+   [(set (match_operand:P 0 "register_operand" "=d")
+ 	(unspec:P [(match_operand:P 1 "register_operand" "d")
+ 		   (match_operand:P 2 "immediate_operand" "")]
+ 		  UNSPEC_LOAD_GOT))]
+-  "TARGET_ABICALLS"
++  ""
+   "<load>\t%0,%R2(%1)"
+   [(set_attr "type" "load")
+    (set_attr "mode" "<MODE>")
+@@ -5296,6 +5298,25 @@
+   [(match_dup 0)]
+   { operands[0] = mips_rewrite_small_data (operands[0]); })
+ 
+
++; Thread-Local Storage
++
++; The TLS base pointer is acessed via "rdhwr $v1, $29".  No current
++; MIPS architecture defines this register, and no current
++; implementation provides it; instead, any OS which supports TLS is
++; expected to trap and emulate this instruction.  rdhwr is part of the
++; MIPS 32r2 specification, but we use it on any architecture because
++; we expect it to be emulated.  Use .set to force the assembler to
++; accept it.
++
++(define_insn "tls_get_tp_<mode>"
++  [(set (match_operand:P 0 "register_operand" "=v")
++	(unspec:P [(const_int 0)]
++		  UNSPEC_TLS_GET_TP))]
++  "HAVE_AS_TLS && !TARGET_MIPS16"
++  ".set\tpush\;.set\tmips32r2\t\;rdhwr\t%0,$29\;.set\tpop"
++  [(set_attr "type" "unknown")
++   (set_attr "mode" "<MODE>")])
++
+
+ ; The MIPS Paired-Single Floating Point and MIPS-3D Instructions.
+ 
+ (include "mips-ps-3d.md")
+diff -Naur gcc-4.0.1.orig/gcc/configure gcc-4.0.1/gcc/configure
+--- gcc-4.0.1.orig/gcc/configure	2005-07-07 20:44:40.000000000 +0000
++++ gcc-4.0.1/gcc/configure	2005-09-12 23:27:07.000000000 +0000
+@@ -13779,6 +13779,23 @@
+ 	tls_first_minor=13
+ 	tls_as_opt=--fatal-warnings
+ 	;;
++  mips*-*-*)
++    conftest_s='
++	.section .tdata,"awT",@progbits
++x:
++	.word 2
++	.text
++	addiu $4, $28, %tlsgd(x)
++	addiu $4, $28, %tlsldm(x)
++	lui $4, %dtprel_hi(x)
++	addiu $4, $4, %dtprel_lo(x)
++	lw $4, %gottprel(x)($28)
++	lui $4, %tprel_hi(x)
++	addiu $4, $4, %tprel_lo(x)'
++	tls_first_major=2
++	tls_first_minor=16
++	tls_as_opt='-32 --fatal-warnings'
++	;;
+   powerpc-*-*)
+     conftest_s='
+ 	.section ".tdata","awT",@progbits
+diff -Naur gcc-4.0.1.orig/gcc/configure.ac gcc-4.0.1/gcc/configure.ac
+--- gcc-4.0.1.orig/gcc/configure.ac	2005-06-01 08:14:33.000000000 +0000
++++ gcc-4.0.1/gcc/configure.ac	2005-09-12 23:27:07.000000000 +0000
+@@ -2349,6 +2349,23 @@
+ 	tls_first_minor=13
+ 	tls_as_opt=--fatal-warnings
+ 	;;
++  mips*-*-*)
++    conftest_s='
++	.section .tdata,"awT",@progbits
++x:
++	.word 2
++	.text
++	addiu $4, $28, %tlsgd(x)
++	addiu $4, $28, %tlsldm(x)
++	lui $4, %dtprel_hi(x)
++	addiu $4, $4, %dtprel_lo(x)
++	lw $4, %gottprel(x)($28)
++	lui $4, %tprel_hi(x)
++	addiu $4, $4, %tprel_lo(x)'
++	tls_first_major=2
++	tls_first_minor=16
++	tls_as_opt='-32 --fatal-warnings'
++	;;
+   powerpc-*-*)
+     conftest_s='
+ 	.section ".tdata","awT",@progbits
+diff -Naur gcc-4.0.1.orig/gcc/testsuite/gcc.dg/tls/offset-1.c gcc-4.0.1/gcc/testsuite/gcc.dg/tls/offset-1.c
+--- gcc-4.0.1.orig/gcc/testsuite/gcc.dg/tls/offset-1.c	1970-01-01 00:00:00.000000000 +0000
++++ gcc-4.0.1/gcc/testsuite/gcc.dg/tls/offset-1.c	2005-09-12 23:27:07.000000000 +0000
+@@ -0,0 +1,15 @@
++/* { dg-do link } */
++/* Test that we do not emit a TLS reference into a constant pool.  */
++
++__thread int x[2];
++
++int * __attribute__((noinline))
++foo (void)
++{
++  return &x[1];
++}
++
++int main (void)
++{
++  return *foo ();
++}
Index: patches/gcc-4.0.3-posix-1.patch
===================================================================
--- patches/gcc-4.0.3-posix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gcc-4.0.3-posix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,191 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-08-27
+Initial Package Version: 4.0.1
+Origin: Jim Gifford
+Upstream Status: On Hold
+Description: Makes GCC Posix Compliant
+ 
+diff -Naur gcc-4.0.1.orig/contrib/test_summary gcc-4.0.1/contrib/test_summary
+--- gcc-4.0.1.orig/contrib/test_summary	2004-08-26 05:51:22.000000000 +0000
++++ gcc-4.0.1/contrib/test_summary	2005-08-27 21:06:51.000000000 +0000
+@@ -106,7 +106,7 @@
+     srcdir = configflags;
+     sub(/\/configure .*/, "", srcdir);
+     printf "LAST_UPDATED: ";
+-    system("tail -1 " srcdir "/LAST_UPDATED");
++    system("tail -n 1 " srcdir "/LAST_UPDATED");
+     print "";
+ 
+     sub(/^[^ ]*\/configure */, " ", configflags);
+diff -Naur gcc-4.0.1.orig/gcc/configure gcc-4.0.1/gcc/configure
+--- gcc-4.0.1.orig/gcc/configure	2005-07-07 20:44:40.000000000 +0000
++++ gcc-4.0.1/gcc/configure	2005-08-27 21:06:51.000000000 +0000
+@@ -13511,7 +13511,7 @@
+   # and we got the correct data, then succeed.
+   if test x$gcc_cv_objdump != x \
+   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
+-     | tail -3 > conftest.got \
++     | tail -n 3 > conftest.got \
+   && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
+     || cmp conftest.big conftest.got > /dev/null 2>&1; }
+   then
+diff -Naur gcc-4.0.1.orig/gcc/configure.ac gcc-4.0.1/gcc/configure.ac
+--- gcc-4.0.1.orig/gcc/configure.ac	2005-06-01 08:14:33.000000000 +0000
++++ gcc-4.0.1/gcc/configure.ac	2005-08-27 21:06:51.000000000 +0000
+@@ -2214,7 +2214,7 @@
+   # and we got the correct data, then succeed.
+   if test x$gcc_cv_objdump != x \
+   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
+-     | tail -3 > conftest.got \
++     | tail -n 3 > conftest.got \
+   && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
+     || cmp conftest.big conftest.got > /dev/null 2>&1; }
+   then
+diff -Naur gcc-4.0.1.orig/libjava/acinclude.m4 gcc-4.0.1/libjava/acinclude.m4
+--- gcc-4.0.1.orig/libjava/acinclude.m4	2004-09-23 01:14:00.000000000 +0000
++++ gcc-4.0.1/libjava/acinclude.m4	2005-08-27 21:06:51.000000000 +0000
+@@ -17,8 +17,8 @@
+ AC_MSG_CHECKING(whether 'ld' is at least 2.13)
+ LD_PROG=`$CC --print-prog-name=ld`
+ LD_VERSION=`$LD_PROG --version`
+-LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+-LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
++LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
++LD_VERSION_MINOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 2`
+ if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+   LD_OK="ok"
+ else
+diff -Naur gcc-4.0.1.orig/libjava/configure gcc-4.0.1/libjava/configure
+--- gcc-4.0.1.orig/libjava/configure	2005-07-07 20:44:40.000000000 +0000
++++ gcc-4.0.1/libjava/configure	2005-08-27 21:06:51.000000000 +0000
+@@ -5933,8 +5933,8 @@
+ echo $ECHO_N "checking whether 'ld' is at least 2.13... $ECHO_C" >&6
+ LD_PROG=`$CC --print-prog-name=ld`
+ LD_VERSION=`$LD_PROG --version`
+-LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+-LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
++LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
++LD_VERSION_MINOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 2`
+ if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+   LD_OK="ok"
+ else
+diff -Naur gcc-4.0.1.orig/libstdc++-v3/acinclude.m4 gcc-4.0.1/libstdc++-v3/acinclude.m4
+--- gcc-4.0.1.orig/libstdc++-v3/acinclude.m4	2005-06-23 09:23:59.000000000 +0000
++++ gcc-4.0.1/libstdc++-v3/acinclude.m4	2005-08-27 21:06:51.000000000 +0000
+@@ -241,7 +241,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+   changequote(,)
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+   changequote([,])
+   glibcxx_gnu_ld_version=`echo $ldver | \
+diff -Naur gcc-4.0.1.orig/libstdc++-v3/configure gcc-4.0.1/libstdc++-v3/configure
+--- gcc-4.0.1.orig/libstdc++-v3/configure	2005-06-23 09:24:00.000000000 +0000
++++ gcc-4.0.1/libstdc++-v3/configure	2005-08-27 21:06:52.000000000 +0000
+@@ -9880,7 +9880,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -55252,7 +55252,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -76923,7 +76923,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -79292,7 +79292,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -81537,7 +81537,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -84550,7 +84550,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -86748,7 +86748,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -88995,7 +88995,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -91603,7 +91603,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+diff -Naur gcc-4.0.1.orig/ltcf-c.sh gcc-4.0.1/ltcf-c.sh
+--- gcc-4.0.1.orig/ltcf-c.sh	2005-05-14 00:42:34.000000000 +0000
++++ gcc-4.0.1/ltcf-c.sh	2005-08-27 21:07:08.000000000 +0000
+@@ -153,7 +153,7 @@
+     # If the export-symbols file already is a .def file (1st line
+     # is EXPORTS), use it as is.
+     # If DATA tags from a recent dlltool are present, honour them!
+-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
++    archive_expsym_cmds='if test "x`head -n 1 $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname-def;
+       else
+         echo EXPORTS > $output_objdir/$soname-def;
+diff -Naur gcc-4.0.1.orig/ltcf-gcj.sh gcc-4.0.1/ltcf-gcj.sh
+--- gcc-4.0.1.orig/ltcf-gcj.sh	2005-05-14 00:42:34.000000000 +0000
++++ gcc-4.0.1/ltcf-gcj.sh	2005-08-27 21:07:08.000000000 +0000
+@@ -156,7 +156,7 @@
+     # If the export-symbols file already is a .def file (1st line
+     # is EXPORTS), use it as is.
+     # If DATA tags from a recent dlltool are present, honour them!
+-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
++    archive_expsym_cmds='if test "x`head -n 1 $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname-def;
+       else
+         echo EXPORTS > $output_objdir/$soname-def;
Index: patches/gcc-4.0.3-pure64-1.patch
===================================================================
--- patches/gcc-4.0.3-pure64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gcc-4.0.3-pure64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,150 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-08-27
+Initial Package Version: 4.x
+Origin: Ken Moffat and Jim Gifford
+Upstream Status: LFS Specific
+Description: Make LIB64 builds in /lib instead of /lib64 
+
+diff -Naur gcc-4.0.1.orig/gcc/config/i386/linux64.h gcc-4.0.1/gcc/config/i386/linux64.h
+--- gcc-4.0.1.orig/gcc/config/i386/linux64.h	2004-11-27 22:29:34.000000000 +0000
++++ gcc-4.0.1/gcc/config/i386/linux64.h	2005-08-28 05:07:59.000000000 +0000
+@@ -60,8 +60,8 @@
+   %{!shared: \
+     %{!static: \
+       %{rdynamic:-export-dynamic} \
+-      %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+-      %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
++      %{m32:%{!dynamic-linker:-dynamic-linker /lib32/ld-linux.so.2}} \
++      %{!m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux-x86-64.so.2}}} \
+     %{static:-static}}"
+ 
+ #define MULTILIB_DEFAULTS { "m64" }
+diff -Naur gcc-4.0.1.orig/gcc/config/i386/t-linux64 gcc-4.0.1/gcc/config/i386/t-linux64
+--- gcc-4.0.1.orig/gcc/config/i386/t-linux64	2002-11-28 14:47:02.000000000 +0000
++++ gcc-4.0.1/gcc/config/i386/t-linux64	2005-08-28 05:08:37.000000000 +0000
+@@ -6,7 +6,7 @@
+ 
+ MULTILIB_OPTIONS = m64/m32
+ MULTILIB_DIRNAMES = 64 32 
+-MULTILIB_OSDIRNAMES = ../lib64 ../lib
++MULTILIB_OSDIRNAMES = ../lib ../lib32
+ 
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
+diff -Naur gcc-4.0.1.orig/gcc/config/mips/linux64.h gcc-4.0.1/gcc/config/mips/linux64.h
+--- gcc-4.0.1.orig/gcc/config/mips/linux64.h	2005-01-26 02:04:46.000000000 +0000
++++ gcc-4.0.1/gcc/config/mips/linux64.h	2005-08-28 05:09:17.000000000 +0000
+@@ -47,9 +47,9 @@
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+         %{!dynamic-linker: \
+-	  %{mabi=n32: -dynamic-linker /lib32/ld.so.1} \
+-	  %{mabi=64: -dynamic-linker /lib64/ld.so.1} \
+-	  %{mabi=32: -dynamic-linker /lib/ld.so.1}}} \
++	  %{mabi=n32: -dynamic-linker /lib64/ld.so.1} \
++	  %{mabi=64: -dynamic-linker /lib/ld.so.1} \
++	  %{mabi=32: -dynamic-linker /lib32/ld.so.1}}} \
+       %{static:-static}}} \
+ %{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
+ %{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
+diff -Naur gcc-4.0.1.orig/gcc/config/mips/t-linux64 gcc-4.0.1/gcc/config/mips/t-linux64
+--- gcc-4.0.1.orig/gcc/config/mips/t-linux64	2005-01-17 21:09:14.000000000 +0000
++++ gcc-4.0.1/gcc/config/mips/t-linux64	2005-08-28 05:09:29.000000000 +0000
+@@ -1,6 +1,6 @@
+ MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
+ MULTILIB_DIRNAMES = n32 32 64
+-MULTILIB_OSDIRNAMES = ../lib32 ../lib ../lib64
++MULTILIB_OSDIRNAMES = ../lib64 ../lib32 ../lib
+ 
+ EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o
+ 
+diff -Naur gcc-4.0.1.orig/gcc/config/rs6000/linux64.h gcc-4.0.1/gcc/config/rs6000/linux64.h
+--- gcc-4.0.1.orig/gcc/config/rs6000/linux64.h	2005-04-29 00:19:47.000000000 +0000
++++ gcc-4.0.1/gcc/config/rs6000/linux64.h	2005-08-28 05:10:24.000000000 +0000
+@@ -351,11 +351,11 @@
+ 
+ #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+-  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
++  %{!dynamic-linker:-dynamic-linker /lib32/ld.so.1}}}"
+ 
+ #define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+-  %{!dynamic-linker:-dynamic-linker /lib64/ld64.so.1}}}"
++  %{!dynamic-linker:-dynamic-linker /lib/ld64.so.1}}}"
+ 
+ #undef  TOC_SECTION_ASM_OP
+ #define TOC_SECTION_ASM_OP \
+diff -Naur gcc-4.0.1.orig/gcc/config/rs6000/t-linux64 gcc-4.0.1/gcc/config/rs6000/t-linux64
+--- gcc-4.0.1.orig/gcc/config/rs6000/t-linux64	2004-03-17 15:15:32.000000000 +0000
++++ gcc-4.0.1/gcc/config/rs6000/t-linux64	2005-08-28 05:10:04.000000000 +0000
+@@ -13,7 +13,7 @@
+ MULTILIB_EXTRA_OPTS     = fPIC mstrict-align
+ MULTILIB_EXCEPTIONS     = m64/msoft-float
+ MULTILIB_EXCLUSIONS     = m64/!m32/msoft-float
+-MULTILIB_OSDIRNAMES	= ../lib64 ../lib nof
++MULTILIB_OSDIRNAMES	= ../lib ../lib32 nof
+ MULTILIB_MATCHES        = $(MULTILIB_MATCHES_FLOAT)
+ 
+ # We want fine grained libraries, so use the new code to build the
+diff -Naur gcc-4.0.1.orig/gcc/config/sparc/linux64.h gcc-4.0.1/gcc/config/sparc/linux64.h
+--- gcc-4.0.1.orig/gcc/config/sparc/linux64.h	2005-04-04 15:32:00.000000000 +0000
++++ gcc-4.0.1/gcc/config/sparc/linux64.h	2005-08-28 05:11:35.000000000 +0000
+@@ -167,21 +167,21 @@
+   { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },	  \
+   { "link_arch",	 LINK_ARCH_SPEC },
+     
+-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
++#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib32 %{shared:-shared} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /lib32/ld-linux.so.2}} \
+         %{static:-static}}} \
+ "
+ 
+-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
++#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib %{shared:-shared} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+         %{static:-static}}} \
+ "
+ 
+@@ -257,12 +257,12 @@
+ #else /* !SPARC_BI_ARCH */
+ 
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
++#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib %{shared:-shared} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+         %{static:-static}}} \
+ %{mlittle-endian:-EL} \
+ %{!mno-relax:%{!r:-relax}} \
+diff -Naur gcc-4.0.1.orig/gcc/config/sparc/t-linux64 gcc-4.0.1/gcc/config/sparc/t-linux64
+--- gcc-4.0.1.orig/gcc/config/sparc/t-linux64	2004-04-01 16:05:20.000000000 +0000
++++ gcc-4.0.1/gcc/config/sparc/t-linux64	2005-08-28 05:12:02.000000000 +0000
+@@ -1,6 +1,6 @@
+ MULTILIB_OPTIONS = m64/m32
+ MULTILIB_DIRNAMES = 64 32
+-MULTILIB_OSDIRNAMES = ../lib64 ../lib
++MULTILIB_OSDIRNAMES = ../lib ../lib32
+ 
+ LIBGCC = stmp-multilib
+ INSTALL_LIBGCC = install-multilib
+@@ -16,4 +16,4 @@
+ 
+ CRTSTUFF_T_CFLAGS = `if test x$$($(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) \
+ 				 -print-multi-os-directory) \
+-			= x../lib64; then echo -mcmodel=medany; fi`
++			= x../lib; then echo -mcmodel=medany; fi`
Index: patches/gcc-4.0.3-specs-1.patch
===================================================================
--- patches/gcc-4.0.3-specs-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gcc-4.0.3-specs-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,336 @@
+Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
+Date: 2006-01-16
+Initial Package Version: 4.0.0
+Upstream Status: Not Sent - LFS Specfic
+Origin: Idea originally developed by Ryan Oliver and Greg Schafer for
+	the Pure LFS project.
+	More architectures added by Zack Winkles.
+	Further fine tunings by Greg Schafer.
+	Modified for gcc 3.3.2 by Oliver Brakmann.
+Rediffed against gcc 3.4.0 by Zack Winkles.
+	Rediffed against gcc 3.4.3 by Jim Gifford.
+	Rediffed against gcc 4.0.0 by Robert Connolly.
+Description: This patch modifies the location of the dynamic linker for
+	the GCC Pass 2 build in LFS Chapter 5.
+
+diff -Naur gcc-20050116.orig/gcc/config/alpha/linux-elf.h gcc-20050116/gcc/config/alpha/linux-elf.h
+--- gcc-20050116.orig/gcc/config/alpha/linux-elf.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/alpha/linux-elf.h	2005-01-17 00:46:14.560651027 +0000
+@@ -27,7 +27,7 @@
+ #define SUBTARGET_EXTRA_SPECS \
+ { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
+ 
+-#define ELF_DYNAMIC_LINKER	"/lib/ld-linux.so.2"
++#define ELF_DYNAMIC_LINKER	"/tools/lib/ld-linux.so.2"
+ 
+ #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax}		\
+   %{O*:-O3} %{!O*:-O1}						\
+diff -Naur gcc-20050116.orig/gcc/config/arm/linux-elf.h gcc-20050116/gcc/config/arm/linux-elf.h
+--- gcc-20050116.orig/gcc/config/arm/linux-elf.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/arm/linux-elf.h	2005-01-17 00:46:50.538578614 +0000
+@@ -87,7 +87,7 @@
+    %{shared:-shared} \
+    %{symbolic:-Bsymbolic} \
+    %{rdynamic:-export-dynamic} \
+-   %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2} \
++   %{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2} \
+    -X \
+    %{mbig-endian:-EB}" \
+    SUBTARGET_EXTRA_LINK_SPEC
+diff -Naur gcc-20050116.orig/gcc/config/frv/linux.h gcc-20050116/gcc/config/frv/linux.h
+--- gcc-20050116.orig/gcc/config/frv/linux.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/frv/linux.h	2005-01-17 01:33:50.600805260 +0000
+@@ -41,7 +41,7 @@
+   %{mfdpic: -m elf32frvfd -z text} %{shared} %{pie} \
+   %{!shared: %{!static: \
+    %{rdynamic:-export-dynamic} \
+-   %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++   %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}} \
+    %{static}}"
+ 
+ /* Support for compile-time default CPU.  */
+diff -Naur gcc-20050116.orig/gcc/config/i386/gnu.h gcc-20050116/gcc/config/i386/gnu.h
+--- gcc-20050116.orig/gcc/config/i386/gnu.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/i386/gnu.h	2005-01-17 01:34:11.142021939 +0000
+@@ -27,7 +27,7 @@
+   %{!shared: \
+     %{!static: \
+       %{rdynamic:-export-dynamic} \
+-      %{!dynamic-linker:-dynamic-linker /lib/ld.so}} \
++      %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so}} \
+     %{static:-static}}"
+ 
+ #undef	STARTFILE_SPEC
+diff -Naur gcc-20050116.orig/gcc/config/i386/linux.h gcc-20050116/gcc/config/i386/linux.h
+--- gcc-20050116.orig/gcc/config/i386/linux.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/i386/linux.h	2005-01-17 00:49:27.412667132 +0000
+@@ -105,7 +105,7 @@
+ /* If ELF is the default format, we should not use /lib/elf.  */
+ 
+ #define LINK_EMULATION "elf_i386"
+-#define DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define DYNAMIC_LINKER "/tools/lib/ld-linux.so.2"
+ 
+ #undef  SUBTARGET_EXTRA_SPECS
+ #define SUBTARGET_EXTRA_SPECS \
+diff -Naur gcc-20050116.orig/gcc/config/i386/linux64.h gcc-20050116/gcc/config/i386/linux64.h
+--- gcc-20050116.orig/gcc/config/i386/linux64.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/i386/linux64.h	2005-01-17 00:50:23.055094690 +0000
+@@ -60,8 +60,8 @@
+   %{!shared: \
+     %{!static: \
+       %{rdynamic:-export-dynamic} \
+-      %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
+-      %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
++      %{m32:%{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2}} \
++      %{!m32:%{!dynamic-linker:-dynamic-linker /tools/lib64/ld-linux-x86-64.so.2}}} \
+     %{static:-static}}"
+ 
+ #define MULTILIB_DEFAULTS { "m64" }
+diff -Naur gcc-20050116.orig/gcc/config/ia64/linux.h gcc-20050116/gcc/config/ia64/linux.h
+--- gcc-20050116.orig/gcc/config/ia64/linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/ia64/linux.h	2005-01-17 00:50:43.146472133 +0000
+@@ -43,7 +43,7 @@
+   %{!shared: \
+     %{!static: \
+       %{rdynamic:-export-dynamic} \
+-      %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
++      %{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux-ia64.so.2}} \
+       %{static:-static}}"
+ 
+ 
+diff -Naur gcc-20050116.orig/gcc/config/linux.h gcc-20050116/gcc/config/linux.h
+--- gcc-20050116.orig/gcc/config/linux.h	2005-01-17 00:45:16.000000000 +0000
++++ gcc-20050116/gcc/config/linux.h	2005-01-17 00:51:14.101809663 +0000
+@@ -104,3 +104,7 @@
+ #define TARGET_C99_FUNCTIONS 1
+ 
+ #define TARGET_HAS_F_SETLKW
++
++/* Remove /usr/include from the end of the include search path.  */
++#undef STANDARD_INCLUDE_DIR
++#define STANDARD_INCLUDE_DIR 0
+diff -Naur gcc-20050116.orig/gcc/config/m32r/linux.h gcc-20050116/gcc/config/m32r/linux.h
+--- gcc-20050116.orig/gcc/config/m32r/linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/m32r/linux.h	2005-01-17 00:51:39.720640870 +0000
+@@ -66,7 +66,7 @@
+     %{!ibcs: \
+       %{!static: \
+ 	%{rdynamic:-export-dynamic} \
+-	%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++	%{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2}} \
+ 	%{static:-static}}}"
+ #else
+ #define LINK_SPEC "%(link_cpu) -m m32relf_linux %{shared:-shared} \
+@@ -74,7 +74,7 @@
+     %{!ibcs: \
+       %{!static: \
+ 	%{rdynamic:-export-dynamic} \
+-	%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++	%{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2}} \
+ 	%{static:-static}}}"
+ #endif
+ 
+diff -Naur gcc-20050116.orig/gcc/config/m68k/linux.h gcc-20050116/gcc/config/m68k/linux.h
+--- gcc-20050116.orig/gcc/config/m68k/linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/m68k/linux.h	2005-01-17 00:52:07.633830392 +0000
+@@ -132,7 +132,7 @@
+   %{!shared: \
+     %{!static: \
+       %{rdynamic:-export-dynamic} \
+-      %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
++      %{!dynamic-linker*:-dynamic-linker /tools/lib/ld.so.1}} \
+     %{static}}"
+ 
+ /* For compatibility with linux/a.out */
+diff -Naur gcc-20050116.orig/gcc/config/mips/linux.h gcc-20050116/gcc/config/mips/linux.h
+--- gcc-20050116.orig/gcc/config/mips/linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/mips/linux.h	2005-01-17 00:52:28.348034505 +0000
+@@ -115,7 +115,7 @@
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++        %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}} \
+         %{static:-static}}}"
+ 
+ #undef SUBTARGET_ASM_SPEC
+diff -Naur gcc-20050116.orig/gcc/config/mips/linux64.h gcc-20050116/gcc/config/mips/linux64.h
+--- gcc-20050116.orig/gcc/config/mips/linux64.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/mips/linux64.h	2005-01-17 00:53:04.645878728 +0000
+@@ -60,9 +60,9 @@
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+         %{!dynamic-linker: \
+-	  %{mabi=n32: -dynamic-linker /lib32/ld.so.1} \
+-	  %{mabi=64: -dynamic-linker /lib64/ld.so.1} \
+-	  %{mabi=32: -dynamic-linker /lib/ld.so.1}}} \
++	  %{mabi=n32: -dynamic-linker /tools/lib32/ld.so.1} \
++	  %{mabi=64: -dynamic-linker /tools/lib64/ld.so.1} \
++	  %{mabi=32: -dynamic-linker /tools/lib/ld.so.1}}} \
+       %{static:-static}}} \
+ %{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32} \
+ %{mabi=64:-melf64%{EB:b}%{EL:l}tsmip} \
+diff -Naur gcc-20050116.orig/gcc/config/mn10300/linux.h gcc-20050116/gcc/config/mn10300/linux.h
+--- gcc-20050116.orig/gcc/config/mn10300/linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/mn10300/linux.h	2005-01-17 00:53:23.477610026 +0000
+@@ -37,7 +37,7 @@
+ #define LINK_SPEC "%{mrelax:--relax} %{shared:-shared} \
+    %{!static: \
+      %{rdynamic:-export-dynamic} \
+-     %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++     %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}} \
+    %{static:-static}"
+ 
+ #undef  LIB_SPEC
+diff -Naur gcc-20050116.orig/gcc/config/pa/pa-linux.h gcc-20050116/gcc/config/pa/pa-linux.h
+--- gcc-20050116.orig/gcc/config/pa/pa-linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/pa/pa-linux.h	2005-01-17 00:53:45.334495141 +0000
+@@ -88,7 +88,7 @@
+   %{!shared: \
+     %{!static: \
+       %{rdynamic:-export-dynamic} \
+-      %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++      %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}} \
+       %{static:-static}}"
+ 
+ /* glibc's profiling functions don't need gcc to allocate counters.  */
+diff -Naur gcc-20050116.orig/gcc/config/rs6000/linux64.h gcc-20050116/gcc/config/rs6000/linux64.h
+--- gcc-20050116.orig/gcc/config/rs6000/linux64.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/rs6000/linux64.h	2005-01-17 00:54:28.524412534 +0000
+@@ -351,11 +351,11 @@
+ 
+ #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+-  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
++  %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}}}"
+ 
+ #define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+-  %{!dynamic-linker:-dynamic-linker /lib64/ld64.so.1}}}"
++  %{!dynamic-linker:-dynamic-linker /tools/lib64/ld64.so.1}}}"
+ 
+ #undef  TOC_SECTION_ASM_OP
+ #define TOC_SECTION_ASM_OP \
+diff -Naur gcc-20050116.orig/gcc/config/rs6000/sysv4.h gcc-20050116/gcc/config/rs6000/sysv4.h
+--- gcc-20050116.orig/gcc/config/rs6000/sysv4.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/rs6000/sysv4.h	2005-01-17 01:26:39.126999460 +0000
+@@ -1131,7 +1131,7 @@
+ 
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+-  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
++  %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}}}"
+ 
+ #if defined(HAVE_LD_EH_FRAME_HDR)
+ # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+@@ -1162,7 +1162,7 @@
+ 
+ #define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+-  %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
++  %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}}}"
+ 
+ #define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__	\
+ %{!undef:					                \
+diff -Naur gcc-20050116.orig/gcc/config/s390/linux.h gcc-20050116/gcc/config/s390/linux.h
+--- gcc-20050116.orig/gcc/config/s390/linux.h	2005-01-17 00:45:17.000000000 +0000
++++ gcc-20050116/gcc/config/s390/linux.h	2005-01-17 01:26:58.672523211 +0000
+@@ -86,8 +86,8 @@
+       %{!static: \
+ 	%{rdynamic:-export-dynamic} \
+ 	%{!dynamic-linker: \
+-          %{m31:-dynamic-linker /lib/ld.so.1} \
+-          %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
++          %{m31:-dynamic-linker /tools/lib/ld.so.1} \
++          %{m64:-dynamic-linker /tools/lib/ld64.so.1}}}}"
+ 
+ 
+ #define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+diff -Naur gcc-20050116.orig/gcc/config/sh/linux.h gcc-20050116/gcc/config/sh/linux.h
+--- gcc-20050116.orig/gcc/config/sh/linux.h	2005-01-17 00:45:18.000000000 +0000
++++ gcc-20050116/gcc/config/sh/linux.h	2005-01-17 01:27:19.588663163 +0000
+@@ -70,7 +70,7 @@
+   "%{shared:-shared} \
+    %{!static: \
+      %{rdynamic:-export-dynamic} \
+-     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++     %{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2}} \
+    %{static:-static}"
+ 
+ #undef LIB_SPEC
+diff -Naur gcc-20050116.orig/gcc/config/sparc/linux.h gcc-20050116/gcc/config/sparc/linux.h
+--- gcc-20050116.orig/gcc/config/sparc/linux.h	2005-01-17 00:45:18.000000000 +0000
++++ gcc-20050116/gcc/config/sparc/linux.h	2005-01-17 01:30:07.282688639 +0000
+@@ -131,13 +131,13 @@
+ /* If ELF is the default format, we should not use /lib/elf.  */
+ 
+ #undef  LINK_SPEC
+-#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
++#define LINK_SPEC "-m elf32_sparc -Y P,/tools/lib %{shared:-shared} \
+   %{!mno-relax:%{!r:-relax}} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2}} \
+         %{static:-static}}}"
+ 
+ /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
+diff -Naur gcc-20050116.orig/gcc/config/sparc/linux64.h gcc-20050116/gcc/config/sparc/linux64.h
+--- gcc-20050116.orig/gcc/config/sparc/linux64.h	2005-01-17 00:45:18.000000000 +0000
++++ gcc-20050116/gcc/config/sparc/linux64.h	2005-01-17 01:31:18.242712476 +0000
+@@ -167,21 +167,21 @@
+   { "link_arch_default", LINK_ARCH_DEFAULT_SPEC },	  \
+   { "link_arch",	 LINK_ARCH_SPEC },
+     
+-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
++#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/tools/lib %{shared:-shared} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /tools/lib/ld-linux.so.2}} \
+         %{static:-static}}} \
+ "
+ 
+-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
++#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/tools/lib64 %{shared:-shared} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /tools/lib64/ld-linux.so.2}} \
+         %{static:-static}}} \
+ "
+ 
+@@ -257,12 +257,12 @@
+ #else /* !SPARC_BI_ARCH */
+ 
+ #undef LINK_SPEC
+-#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
++#define LINK_SPEC "-m elf64_sparc -Y P,/tools/lib64 %{shared:-shared} \
+   %{!shared: \
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
++        %{!dynamic-linker:-dynamic-linker /tools/lib64/ld-linux.so.2}} \
+         %{static:-static}}} \
+ %{mlittle-endian:-EL} \
+ %{!mno-relax:%{!r:-relax}} \
+diff -Naur gcc-20050116.orig/gcc/config/xtensa/linux.h gcc-20050116/gcc/config/xtensa/linux.h
+--- gcc-20050116.orig/gcc/config/xtensa/linux.h	2005-01-17 00:45:18.000000000 +0000
++++ gcc-20050116/gcc/config/xtensa/linux.h	2005-01-17 01:32:08.951429623 +0000
+@@ -50,7 +50,7 @@
+     %{!ibcs: \
+       %{!static: \
+         %{rdynamic:-export-dynamic} \
+-        %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
++        %{!dynamic-linker:-dynamic-linker /tools/lib/ld.so.1}} \
+       %{static:-static}}}"
+ 
+ #undef LOCAL_LABEL_PREFIX
Index: patches/glibc-20051107-libgcc_eh-1.patch
===================================================================
--- patches/glibc-20051107-libgcc_eh-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/glibc-20051107-libgcc_eh-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,24 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-07-20
+Initial Package Version: 2.3.5
+Origin: Rene Rebe <rene@exactcode.de>
+Upstream Status: Unknown
+Description: Removes dependency for libgcc_eh
+ 
+--- glibc-2.3.5/Makeconfig.orig	2005-07-21 04:53:30.000000000 +0000
++++ glibc-2.3.5/Makeconfig	2005-07-21 04:53:49.000000000 +0000
+@@ -503,12 +503,12 @@
+   libunwind = -lunwind
+ endif
+ ifneq ($(have-as-needed),yes)
+- libgcc_eh := -lgcc_eh $(libunwind)
++ libgcc_eh := $(libunwind)
+ else
+  libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
+ endif
+ gnulib := -lgcc $(libgcc_eh)
+-static-gnulib := -lgcc -lgcc_eh $(libunwind)
++static-gnulib := -lgcc $(libunwind)
+ libc.so-gnulib := -lgcc
+ endif
+ ifeq ($(elf),yes)
Index: patches/glibc-20051107-localedef_segfault-1.patch
===================================================================
--- patches/glibc-20051107-localedef_segfault-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/glibc-20051107-localedef_segfault-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,56 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-09-29
+Initial Package Version: 2.3.2
+Origin: Debian
+Upstream Status: Unknown
+Description: Fixes Segfault when using localdef.
+             This problem is only noticed when using PaX
+             and some architectures besides x86.
+	     See debian bug # 231438
+
+ 
+--- glibc-20050926/locale/programs/3level.h.orig	2005-09-30 06:00:37.000000000 +0000
++++ glibc-20050926/locale/programs/3level.h	2005-09-30 06:01:02.000000000 +0000
+@@ -204,6 +204,42 @@
+ 	}
+     }
+ }
++
++/* GCC ATM seems to do a poor job with pointers to nested functions passed
++   to inlined functions.  Help it a little bit with this hack.  */
++#define wchead_table_iterate(tp, fn) \
++do									      \
++  {									      \
++    struct wchead_table *t = (tp);					      \
++    uint32_t index1;							      \
++    for (index1 = 0; index1 < t->level1_size; index1++)			      \
++      {									      \
++	uint32_t lookup1 = t->level1[index1];				      \
++	if (lookup1 != ((uint32_t) ~0))					      \
++	  {								      \
++	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
++	    uint32_t index2;						      \
++	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
++	      {								      \
++		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
++		if (lookup2 != ((uint32_t) ~0))				      \
++		  {							      \
++		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
++		    uint32_t index3;					      \
++		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
++		      {							      \
++			struct element_t *lookup3			      \
++			  = t->level3[index3 + lookup2_shifted];	      \
++			if (lookup3 != NULL)				      \
++			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
++			      lookup3);					      \
++		      }							      \
++		  }							      \
++	      }								      \
++	  }								      \
++      }									      \
++  } while (0)
++
+ #endif
+ 
+ #ifndef NO_FINALIZE
Index: patches/glibc-20051107-mips_nptl-1.patch
===================================================================
--- patches/glibc-20051107-mips_nptl-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/glibc-20051107-mips_nptl-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1059 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-09-27
+Initial Package Version: 20050919 Snapshot
+Origin: Daniel Jacobwitz
+Upstream Status: Submitted by Origin
+Description: Adds NPTL support for MIPS
+ 
+diff -Naur glibc-20050919.orig/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h glibc-20050919/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
+--- glibc-20050919.orig/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h	2005-03-28 09:21:52.000000000 +0000
++++ glibc-20050919/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h	2005-09-27 16:15:20.000000000 +0000
+@@ -30,6 +30,8 @@
+ #define FUTEX_WAKE		1
+ #define FUTEX_REQUEUE		3
+ #define FUTEX_CMP_REQUEUE	4
++#define FUTEX_WAKE_OP		5
++#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE	((4 << 24) | 1)
+ 
+ /* Initializer for compatibility lock.	*/
+ #define LLL_MUTEX_LOCK_INITIALIZER (0)
+@@ -39,7 +41,7 @@
+     INTERNAL_SYSCALL_DECL (__err);					      \
+     long int __ret;							      \
+     __ret = INTERNAL_SYSCALL (futex, __err, 4,				      \
+-			      (futexp), FUTEX_WAIT, (val), 0);		      \
++			      (long) (futexp), FUTEX_WAIT, (val), 0);	      \
+     INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret;		      \
+   })
+ 
+@@ -48,7 +50,7 @@
+     INTERNAL_SYSCALL_DECL (__err);					      \
+     long int __ret;							      \
+     __ret = INTERNAL_SYSCALL (futex, __err, 4,				      \
+-			      (futexp), FUTEX_WAIT, (val), (timespec));	      \
++			      (long) (futexp), FUTEX_WAIT, (val), (timespec));\
+     INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret;		      \
+   })
+ 
+@@ -57,7 +59,7 @@
+     INTERNAL_SYSCALL_DECL (__err);					      \
+     long int __ret;							      \
+     __ret = INTERNAL_SYSCALL (futex, __err, 4,				      \
+-			      (futexp), FUTEX_WAKE, (nr), 0);		      \
++			      (long) (futexp), FUTEX_WAKE, (nr), 0);	      \
+     INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret;		      \
+   })
+ 
+@@ -67,11 +69,23 @@
+     INTERNAL_SYSCALL_DECL (__err);					      \
+     long int __ret;							      \
+     __ret = INTERNAL_SYSCALL (futex, __err, 6,				      \
+-			      (futexp), FUTEX_CMP_REQUEUE, (nr_wake),	      \
++			      (long) (futexp), FUTEX_CMP_REQUEUE, (nr_wake),  \
+ 			      (nr_move), (mutex), (val));		      \
+     INTERNAL_SYSCALL_ERROR_P (__ret, __err);				      \
+   })
+ 
++/* Returns non-zero if error happened, zero if success.  */
++#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2) \
++  ({									      \
++    INTERNAL_SYSCALL_DECL (__err);					      \
++    long int __ret;							      \
++									      \
++    __ret = INTERNAL_SYSCALL (futex, __err, 6,				      \
++			      (futexp), FUTEX_WAKE_OP, (nr_wake),	      \
++			      (nr_wake2), (futexp2),			      \
++			      FUTEX_OP_CLEAR_WAKE_IF_GT_ONE);		      \
++    INTERNAL_SYSCALL_ERROR_P (__ret, __err);				      \
++  })
+ 
+ static inline int __attribute__((always_inline))
+ __lll_mutex_trylock(int *futex)
+diff -Naur glibc-20050919.orig/nptl/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h glibc-20050919/nptl/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h
+--- glibc-20050919.orig/nptl/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h	1970-01-01 00:00:00.000000000 +0000
++++ glibc-20050919/nptl/sysdeps/unix/sysv/linux/mips/mips64/sysdep-cancel.h	2005-09-27 16:15:20.000000000 +0000
+@@ -0,0 +1,183 @@
++/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, write to the Free
++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++   02111-1307 USA.  */
++
++#include <sysdep.h>
++#include <sysdeps/generic/sysdep.h>
++#include <tls.h>
++#ifndef __ASSEMBLER__
++# include <nptl/pthreadP.h>
++#endif
++#include <sys/asm.h>
++
++/* Gas will put the initial save of $gp into the CIE, because it appears to
++   happen before any instructions.  So we use cfi_same_value instead of
++   cfi_restore.  */
++
++#ifdef HAVE_ASM_CFI_DIRECTIVES
++# define cfi_same_value .cfi_same_value
++#else
++# define cfi_same_value
++#endif
++
++#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
++
++#ifdef __PIC__
++# undef PSEUDO
++# define PSEUDO(name, syscall_name, args)				      \
++      .align 2;								      \
++  L(pseudo_start):							      \
++      cfi_startproc;							      \
++      cfi_adjust_cfa_offset (STKSPACE);					      \
++      cfi_rel_offset (gp, STKOFF_GP);					      \
++  99: PTR_LA t9,__syscall_error;					      \
++      /* manual cpreturn */						      \
++      REG_L gp, STKOFF_GP(sp);						      \
++      cfi_same_value (gp);						      \
++      RESTORESTK;							      \
++      jr t9;								      \
++  .type __##syscall_name##_nocancel, @function;				      \
++  .globl __##syscall_name##_nocancel;					      \
++  __##syscall_name##_nocancel:						      \
++    SAVESTK;								      \
++    .cpsetup t9, STKOFF_GP, name;					      \
++    cfi_rel_offset (gp, STKOFF_GP);					      \
++    li v0, SYS_ify(syscall_name);					      \
++    syscall;								      \
++    bne a3, zero, SYSCALL_ERROR_LABEL;			       		      \
++    /* manual cpreturn */						      \
++    REG_L gp, STKOFF_GP(sp);						      \
++    cfi_same_value (gp);						      \
++    RESTORESTK;								      \
++    ret;								      \
++  .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
++  ENTRY (name)								      \
++    SAVESTK;								      \
++    .cpsetup t9, STKOFF_GP, name;					      \
++    cfi_rel_offset (gp, STKOFF_GP);					      \
++    SINGLE_THREAD_P(v1);						      \
++    bne zero, v1, L(pseudo_cancel);					      \
++    .set noreorder;							      \
++    li v0, SYS_ify(syscall_name);					      \
++    syscall;								      \
++    .set reorder;							      \
++    bne a3, zero, SYSCALL_ERROR_LABEL;			       		      \
++    /* manual cpreturn */						      \
++    REG_L gp, STKOFF_GP(sp);						      \
++    cfi_same_value (gp);						      \
++    RESTORESTK;								      \
++    ret;								      \
++  L(pseudo_cancel):							      \
++    cfi_adjust_cfa_offset (STKSPACE);					      \
++    cfi_rel_offset (gp, STKOFF_GP);					      \
++    REG_S ra, STKOFF_RA(sp);						      \
++    cfi_rel_offset (ra, STKOFF_RA);					      \
++    PUSHARGS_##args;			/* save syscall args */	      	      \
++    CENABLE;								      \
++    REG_S v0, STKOFF_SVMSK(sp);		/* save mask */			      \
++    POPARGS_##args;			/* restore syscall args */	      \
++    .set noreorder;							      \
++    li v0, SYS_ify (syscall_name);				      	      \
++    syscall;								      \
++    .set reorder;							      \
++    REG_S v0, STKOFF_SC_V0(sp);		/* save syscall result */             \
++    REG_S a3, STKOFF_SC_ERR(sp);	/* save syscall error flag */	      \
++    REG_L a0, STKOFF_SVMSK(sp);		/* pass mask as arg1 */		      \
++    CDISABLE;								      \
++    REG_L a3, STKOFF_SC_ERR(sp);	/* restore syscall error flag */      \
++    REG_L ra, STKOFF_RA(sp);		/* restore return address */	      \
++    REG_L v0, STKOFF_SC_V0(sp);		/* restore syscall result */          \
++    bne a3, zero, SYSCALL_ERROR_LABEL;					      \
++    /* manual cpreturn */						      \
++    REG_L gp, STKOFF_GP(sp);						      \
++    cfi_same_value (gp);						      \
++    RESTORESTK;								      \
++  L(pseudo_end):
++
++
++# undef PSEUDO_END
++# define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
++
++#endif
++
++# define PUSHARGS_0	/* nothing to do */
++# define PUSHARGS_1	PUSHARGS_0 REG_S a0, STKOFF_A0(sp); cfi_rel_offset (a0, STKOFF_A0);
++# define PUSHARGS_2	PUSHARGS_1 REG_S a1, STKOFF_A1(sp); cfi_rel_offset (a1, STKOFF_A1);
++# define PUSHARGS_3	PUSHARGS_2 REG_S a2, STKOFF_A2(sp); cfi_rel_offset (a2, STKOFF_A2);
++# define PUSHARGS_4	PUSHARGS_3 REG_S a3, STKOFF_A3(sp); cfi_rel_offset (a3, STKOFF_A3);
++# define PUSHARGS_5	PUSHARGS_4 REG_S a4, STKOFF_A4(sp); cfi_rel_offset (a3, STKOFF_A4);
++# define PUSHARGS_6	PUSHARGS_5 REG_S a5, STKOFF_A5(sp); cfi_rel_offset (a3, STKOFF_A5);
++
++# define POPARGS_0	/* nothing to do */
++# define POPARGS_1	POPARGS_0 REG_L a0, STKOFF_A0(sp);
++# define POPARGS_2	POPARGS_1 REG_L a1, STKOFF_A1(sp);
++# define POPARGS_3	POPARGS_2 REG_L a2, STKOFF_A2(sp);
++# define POPARGS_4	POPARGS_3 REG_L a3, STKOFF_A3(sp);
++# define POPARGS_5	POPARGS_4 REG_L a4, STKOFF_A4(sp);
++# define POPARGS_6	POPARGS_5 REG_L a5, STKOFF_A5(sp);
++
++/* Save an even number of slots.  Should be 0 if an even number of slots
++   are used below, or SZREG if an odd number are used.  */
++# define STK_PAD	SZREG
++
++/* Place values that we are more likely to use later in this sequence, i.e.
++   closer to the SP at function entry.  If you do that, the are more
++   likely to already be in your d-cache.  */
++# define STKOFF_A5	(STK_PAD)
++# define STKOFF_A4	(STKOFF_A5 + SZREG)
++# define STKOFF_A3	(STKOFF_A4 + SZREG)
++# define STKOFF_A2	(STKOFF_A3 + SZREG)	/* MT and more args.  */
++# define STKOFF_A1	(STKOFF_A2 + SZREG)	/* MT and 2 args.  */
++# define STKOFF_A0	(STKOFF_A1 + SZREG)	/* MT and 1 arg.  */
++# define STKOFF_RA	(STKOFF_A0 + SZREG)	/* Used if MT.  */
++# define STKOFF_SC_V0	(STKOFF_RA + SZREG)	/* Used if MT.  */
++# define STKOFF_SC_ERR	(STKOFF_SC_V0 + SZREG)	/* Used if MT.  */
++# define STKOFF_SVMSK	(STKOFF_SC_ERR + SZREG)	/* Used if MT.  */
++# define STKOFF_GP	(STKOFF_SVMSK + SZREG)	/* Always used.  */
++
++# define STKSPACE	(STKOFF_GP + SZREG)
++# define SAVESTK 	PTR_SUBU sp, STKSPACE; cfi_adjust_cfa_offset(STKSPACE)
++# define RESTORESTK 	PTR_ADDU sp, STKSPACE; cfi_adjust_cfa_offset(-STKSPACE)
++
++# ifdef IS_IN_libpthread
++#  define CENABLE	PTR_LA t9, __pthread_enable_asynccancel; jalr t9
++#  define CDISABLE	PTR_LA t9, __pthread_disable_asynccancel; jalr t9
++# elif defined IS_IN_librt
++#  define CENABLE	PTR_LA t9, __librt_enable_asynccancel; jalr t9
++#  define CDISABLE	PTR_LA t9, __librt_disable_asynccancel; jalr t9
++# else
++#  define CENABLE	PTR_LA t9, __libc_enable_asynccancel; jalr t9
++#  define CDISABLE	PTR_LA t9, __libc_disable_asynccancel; jalr t9
++# endif
++
++# ifndef __ASSEMBLER__
++#  define SINGLE_THREAD_P						\
++	__builtin_expect (THREAD_GETMEM (THREAD_SELF,			\
++					 header.multiple_threads)	\
++			  == 0, 1)
++# else
++#  define SINGLE_THREAD_P(reg)						\
++	READ_THREAD_POINTER(reg);					\
++	lw reg, MULTIPLE_THREADS_OFFSET(reg)
++#endif
++
++#elif !defined __ASSEMBLER__
++
++# define SINGLE_THREAD_P 1
++# define NO_CANCELLATION 1
++
++#endif
+diff -Naur glibc-20050919.orig/sysdeps/mips/dl-machine.h glibc-20050919/sysdeps/mips/dl-machine.h
+--- glibc-20050919.orig/sysdeps/mips/dl-machine.h	2005-03-28 09:32:04.000000000 +0000
++++ glibc-20050919/sysdeps/mips/dl-machine.h	2005-09-27 16:15:20.000000000 +0000
+@@ -266,13 +266,13 @@
+ 	" STRINGXP(PTR_ADDU) " $7, $7, " STRINGXP (PTRSIZE) " \n\
+ 	# Make sure the stack pointer is aligned for _dl_init_internal.\n\
+ 	and $2, $29, -2 * " STRINGXP(SZREG) "\n\
+-	" STRINGXP(PTR_S) " $29, -4($2)\n\
++	" STRINGXP(PTR_S) " $29, -" STRINGXP(SZREG) "($2)\n\
+ 	" STRINGXP(PTR_SUBIU) " $29, $2, 32\n\
+ 	" STRINGXP(SAVE_GP(16)) "\n\
+ 	# Call the function to run the initializers.\n\
+ 	jal _dl_init_internal\n\
+ 	# Restore the stack pointer for _start.\n\
+-	" STRINGXP(PTR_L)  " $29, 28($29)\n\
++	" STRINGXP(PTR_L)  " $29, 32-" STRINGXP(SZREG) "($29)\n\
+ 	# Pass our finalizer function to the user in $2 as per ELF ABI.\n\
+ 	" STRINGXP(PTR_LA) " $2, _dl_fini\n\
+ 	# Jump to the user entry point.\n\
+@@ -336,28 +336,24 @@
+ # endif
+       {
+ 	struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
+-	Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
+-
+-	if (sym)
+-	  value += sym->st_value;
+ 
+ 	switch (r_type)
+ 	  {
+ 	  case R_MIPS_TLS_DTPMOD64:
+ 	  case R_MIPS_TLS_DTPMOD32:
+ 	    if (sym_map)
+-	      *(ElfW(Word) *)reloc_addr = sym_map->l_tls_modid;
++	      *(ElfW(Addr) *)reloc_addr = sym_map->l_tls_modid;
+ 	    break;
+ 
+ 	  case R_MIPS_TLS_DTPREL64:
+ 	  case R_MIPS_TLS_DTPREL32:
+-	    *(ElfW(Word) *)reloc_addr += TLS_DTPREL_VALUE (sym);
++	    *(ElfW(Addr) *)reloc_addr += TLS_DTPREL_VALUE (sym);
+ 	    break;
+ 
+ 	  case R_MIPS_TLS_TPREL32:
+ 	  case R_MIPS_TLS_TPREL64:
+ 	    CHECK_STATIC_TLS (map, sym_map);
+-	    *(ElfW(Word) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym);
++	    *(ElfW(Addr) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym);
+ 	    break;
+ 	  }
+ 
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/bits/socket.h glibc-20050919/sysdeps/unix/sysv/linux/mips/bits/socket.h
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/bits/socket.h	2004-12-15 01:00:55.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/bits/socket.h	2005-09-27 16:15:20.000000000 +0000
+@@ -219,10 +219,10 @@
+     socklen_t msg_namelen;	/* Length of address data.  */
+ 
+     struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
+-    int msg_iovlen;		/* Number of elements in the vector.  */
++    size_t msg_iovlen;		/* Number of elements in the vector.  */
+ 
+     void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
+-    socklen_t msg_controllen;	/* Ancillary data buffer length.  */
++    size_t msg_controllen;	/* Ancillary data buffer length.  */
+ 
+     int msg_flags;		/* Flags on received message.  */
+   };
+@@ -270,8 +270,8 @@
+ 
+   __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ 			       + CMSG_ALIGN (__cmsg->cmsg_len));
+-  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+-					 + __mhdr->msg_controllen)
++  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
++					+ __mhdr->msg_controllen)
+       || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+ 	  > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+     /* No more entries.  */
+@@ -284,13 +284,12 @@
+    <linux/socket.h>.  */
+ enum
+   {
+-    SCM_RIGHTS = 0x01,		/* Transfer file descriptors.  */
++    SCM_RIGHTS = 0x01		/* Transfer file descriptors.  */
+ #define SCM_RIGHTS SCM_RIGHTS
+ #ifdef __USE_BSD
+-    SCM_CREDENTIALS = 0x02,     /* Credentials passing.  */
++    , SCM_CREDENTIALS = 0x02	/* Credentials passing.  */
+ # define SCM_CREDENTIALS SCM_CREDENTIALS
+ #endif
+-    __SCM_CONNECT = 0x03	/* Data array is `struct scm_connect'.  */
+   };
+ 
+ /* User visible structure for SCM_CREDENTIALS message */
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/Makefile glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/Makefile
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/Makefile	1970-01-01 00:00:00.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/Makefile	2005-09-27 16:15:20.000000000 +0000
+@@ -0,0 +1,9 @@
++ifeq ($(subdir),socket)
++CFLAGS-recv.c += -fexceptions
++CFLAGS-send.c += -fexceptions
++endif
++
++ifeq ($(subdir),nptl)
++CFLAGS-recv.c += -fexceptions
++CFLAGS-send.c += -fexceptions
++endif
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h	2005-02-25 15:18:12.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h	2005-09-27 16:15:20.000000000 +0000
+@@ -66,22 +66,28 @@
+ #define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
+ 
+ #undef INTERNAL_SYSCALL
+-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
++#define INTERNAL_SYSCALL(name, err, nr, args...) \
++	internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t",	\
++			      "i" (SYS_ify (name)), err, args)
+ 
+-#define internal_syscall0(name, err, dummy...) 				\
++#undef INTERNAL_SYSCALL_NCS
++#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
++	internal_syscall##nr (= number, , "r" (__v0), err, args)
++
++#define internal_syscall0(ncs_init, cs_init, input, err, dummy...)	\
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
+-	register long __a3 asm("$7"); 					\
++	register long long __v0 asm("$2") ncs_init;			\
++	register long long __a3 asm("$7");				\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set reorder" 							\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "i" (SYS_ify(name))						\
++	: input								\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -89,21 +95,21 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall1(name, err, arg1) 				\
++#define internal_syscall1(ncs_init, cs_init, input, err, arg1)		\
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long long __v0 asm("$2"); 				\
++	register long long __v0 asm("$2") ncs_init;			\
+ 	register long long __a0 asm("$4") = (long long) arg1; 		\
+ 	register long long __a3 asm("$7"); 				\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set reorder" 							\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "r" (__a0), "i" (SYS_ify(name)) 				\
++	: input, "r" (__a0)		 				\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -111,22 +117,22 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall2(name, err, arg1, arg2) 			\
++#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2)	\
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long long __v0 asm("$2"); 				\
++	register long long __v0 asm("$2") ncs_init;			\
+ 	register long long __a0 asm("$4") = (long long) arg1; 		\
+ 	register long long __a1 asm("$5") = (long long) arg2; 		\
+ 	register long long __a3 asm("$7"); 				\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
++	: input, "r" (__a0), "r" (__a1)					\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -134,23 +140,23 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
++#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long long __v0 asm("$2"); 				\
++	register long long __v0 asm("$2") ncs_init;			\
+ 	register long long __a0 asm("$4") = (long long) arg1; 		\
+ 	register long long __a1 asm("$5") = (long long) arg2; 		\
+ 	register long long __a2 asm("$6") = (long long) arg3; 		\
+ 	register long long __a3 asm("$7"); 				\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -158,23 +164,23 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
++#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long long __v0 asm("$2"); 				\
++	register long long __v0 asm("$2") ncs_init;			\
+ 	register long long __a0 asm("$4") = (long long) arg1; 		\
+ 	register long long __a1 asm("$5") = (long long) arg2; 		\
+ 	register long long __a2 asm("$6") = (long long) arg3; 		\
+ 	register long long __a3 asm("$7") = (long long) arg4; 		\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "+r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2)		 	\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -182,12 +188,12 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
++#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long long __v0 asm("$2"); 				\
++	register long long __v0 asm("$2") ncs_init;			\
+ 	register long long __a0 asm("$4") = (long long) arg1; 		\
+ 	register long long __a1 asm("$5") = (long long) arg2; 		\
+ 	register long long __a2 asm("$6") = (long long) arg3; 		\
+@@ -195,12 +201,11 @@
+ 	register long long __a4 asm("$8") = (long long) arg5; 		\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "+r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
+-	  "r" (__a4) 							\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4)		\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -208,12 +213,12 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
++#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long long __v0 asm("$2"); 				\
++	register long long __v0 asm("$2") ncs_init;			\
+ 	register long long __a0 asm("$4") = (long long) arg1; 		\
+ 	register long long __a1 asm("$5") = (long long) arg2; 		\
+ 	register long long __a2 asm("$6") = (long long) arg3; 		\
+@@ -222,12 +227,12 @@
+ 	register long long __a5 asm("$9") = (long long) arg6; 		\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "+r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
+-	  "r" (__a4), "r" (__a5)					\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4),	\
++	  "r" (__a5)							\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h	2005-02-25 15:18:13.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h	2005-09-27 16:15:20.000000000 +0000
+@@ -66,22 +66,28 @@
+ #define INTERNAL_SYSCALL_ERRNO(val, err)     (val)
+ 
+ #undef INTERNAL_SYSCALL
+-#define INTERNAL_SYSCALL(name, err, nr, args...) internal_syscall##nr(name, err, args)
++#define INTERNAL_SYSCALL(name, err, nr, args...) \
++	internal_syscall##nr (, "li\t$2, %2\t\t\t# " #name "\n\t",	\
++			      "i" (SYS_ify (name)), err, args)
+ 
+-#define internal_syscall0(name, err, dummy...) 				\
++#undef INTERNAL_SYSCALL_NCS
++#define INTERNAL_SYSCALL_NCS(number, err, nr, args...) \
++	internal_syscall##nr (= number, , "r" (__v0), err, args)
++
++#define internal_syscall0(ncs_init, cs_init, input, err, dummy...)	\
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
+-	register long __a3 asm("$7"); 					\
++	register long __v0 asm("$2") ncs_init;				\
++	register long __a3 asm("$7");					\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %2\t\t\t# " #name "\n\t"				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set reorder" 							\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "i" (SYS_ify(name))						\
++	: input								\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -89,21 +95,21 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall1(name, err, arg1) 				\
++#define internal_syscall1(ncs_init, cs_init, input, err, arg1)		\
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
++	register long __v0 asm("$2") ncs_init;				\
+ 	register long __a0 asm("$4") = (long) arg1; 			\
+ 	register long __a3 asm("$7"); 					\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %3\t\t\t# " #name "\n\t"				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set reorder" 							\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "r" (__a0), "i" (SYS_ify(name)) 				\
++	: input, "r" (__a0)		 				\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -111,22 +117,22 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall2(name, err, arg1, arg2) 			\
++#define internal_syscall2(ncs_init, cs_init, input, err, arg1, arg2)	\
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
++	register long __v0 asm("$2") ncs_init;				\
+ 	register long __a0 asm("$4") = (long) arg1; 			\
+ 	register long __a1 asm("$5") = (long) arg2; 			\
+ 	register long __a3 asm("$7"); 					\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %4\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "i" (SYS_ify(name))			\
++	: input, "r" (__a0), "r" (__a1)					\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -134,23 +140,23 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall3(name, err, arg1, arg2, arg3) 			\
++#define internal_syscall3(ncs_init, cs_init, input, err, arg1, arg2, arg3) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
++	register long __v0 asm("$2") ncs_init;				\
+ 	register long __a0 asm("$4") = (long) arg1; 			\
+ 	register long __a1 asm("$5") = (long) arg2; 			\
+ 	register long __a2 asm("$6") = (long) arg3; 			\
+ 	register long __a3 asm("$7"); 					\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "=r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2)			\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -158,23 +164,23 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall4(name, err, arg1, arg2, arg3, arg4) 		\
++#define internal_syscall4(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
++	register long __v0 asm("$2") ncs_init;				\
+ 	register long __a0 asm("$4") = (long) arg1; 			\
+ 	register long __a1 asm("$5") = (long) arg2; 			\
+ 	register long __a2 asm("$6") = (long) arg3; 			\
+ 	register long __a3 asm("$7") = (long) arg4; 			\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "+r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)) 	\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2)		 	\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -182,12 +188,12 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall5(name, err, arg1, arg2, arg3, arg4, arg5) 	\
++#define internal_syscall5(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
++	register long __v0 asm("$2") ncs_init;				\
+ 	register long __a0 asm("$4") = (long) arg1; 			\
+ 	register long __a1 asm("$5") = (long) arg2; 			\
+ 	register long __a2 asm("$6") = (long) arg3; 			\
+@@ -195,12 +201,11 @@
+ 	register long __a4 asm("$8") = (long) arg5; 			\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "+r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
+-	  "r" (__a4) 							\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4)		\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+@@ -208,12 +213,12 @@
+ 	_sys_result;							\
+ })
+ 
+-#define internal_syscall6(name, err, arg1, arg2, arg3, arg4, arg5, arg6)\
++#define internal_syscall6(ncs_init, cs_init, input, err, arg1, arg2, arg3, arg4, arg5, arg6) \
+ ({ 									\
+ 	long _sys_result;						\
+ 									\
+ 	{								\
+-	register long __v0 asm("$2"); 					\
++	register long __v0 asm("$2") ncs_init;				\
+ 	register long __a0 asm("$4") = (long) arg1; 			\
+ 	register long __a1 asm("$5") = (long) arg2; 			\
+ 	register long __a2 asm("$6") = (long) arg3; 			\
+@@ -222,12 +227,12 @@
+ 	register long __a5 asm("$9") = (long) arg6; 			\
+ 	__asm__ volatile ( 						\
+ 	".set\tnoreorder\n\t" 						\
+-	"li\t$2, %5\t\t\t# " #name "\n\t" 				\
++	cs_init								\
+ 	"syscall\n\t" 							\
+ 	".set\treorder" 						\
+ 	: "=r" (__v0), "+r" (__a3) 					\
+-	: "r" (__a0), "r" (__a1), "r" (__a2), "i" (SYS_ify(name)), 	\
+-	  "r" (__a4), "r" (__a5)					\
++	: input, "r" (__a0), "r" (__a1), "r" (__a2), "r" (__a4),	\
++	  "r" (__a5)							\
+ 	: __SYSCALL_CLOBBERS); 						\
+ 	err = __a3;							\
+ 	_sys_result = __v0;						\
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list	2004-07-21 06:13:15.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/mips64/syscalls.list	2005-09-27 16:15:20.000000000 +0000
+@@ -1,16 +1,12 @@
+ # File name	Caller	Syscall name	Args	Strong name	Weak names
+ 
+-lseek		-	lseek		i:iii	__libc_lseek	__lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
+-
+-# proper socket implementations:
+-recvfrom	-	recvfrom	i:ibniBN __libc_recvfrom __recvfrom recvfrom
+-sendto		-	sendto		i:ibnibn __libc_sendto	__sendto sendto
++lseek		-	lseek		Ci:iii	__libc_lseek	__lseek lseek __llseek llseek __libc_lseek64 __lseek64 lseek64
+ 
+ # semaphore and shm system calls
+ msgctl		-	msgctl		i:iip	__msgctl	msgctl
+ msgget		-	msgget		i:ii	__msgget	msgget
+-msgrcv		-	msgrcv		i:ibnii	__msgrcv	msgrcv
+-msgsnd		-	msgsnd		i:ibni	__msgsnd	msgsnd
++msgrcv		-	msgrcv		Ci:ibnii __msgrcv	msgrcv
++msgsnd		-	msgsnd		Ci:ibni	__msgsnd	msgsnd
+ shmat		-	shmat		i:ipi	__shmat		shmat
+ shmctl		-	shmctl		i:iip	__shmctl	shmctl
+ shmdt		-	shmdt		i:s	__shmdt		shmdt
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/ptrace.c glibc-20050919/sysdeps/unix/sysv/linux/mips/ptrace.c
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/ptrace.c	2004-11-24 04:36:11.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/ptrace.c	1970-01-01 00:00:00.000000000 +0000
+@@ -1,111 +0,0 @@
+-/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004
+-	Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Lesser General Public
+-   License as published by the Free Software Foundation; either
+-   version 2.1 of the License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Lesser General Public License for more details.
+-
+-   You should have received a copy of the GNU Lesser General Public
+-   License along with the GNU C Library; if not, write to the Free
+-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-   02111-1307 USA.  */
+-
+-#include <errno.h>
+-#include <sgidefs.h>
+-#include <sys/types.h>
+-#include <sys/ptrace.h>
+-#include <sys/user.h>
+-#include <stdarg.h>
+-
+-#include <sysdep.h>
+-#include <sys/syscall.h>
+-#include <bp-checks.h>
+-#include <sgidefs.h>
+-
+-#if _MIPS_SIM == _ABIN32
+-__extension__ typedef long long int reg_type;
+-#else
+-typedef long int reg_type;
+-#endif
+-
+-reg_type
+-ptrace (enum __ptrace_request request, ...)
+-{
+-  reg_type res, ret;
+-  va_list ap;
+-  pid_t pid;
+-  void *addr;
+-  reg_type data;
+-
+-  va_start (ap, request);
+-  pid = va_arg (ap, pid_t);
+-  addr = va_arg (ap, void *);
+-  data = va_arg (ap, reg_type);
+-  va_end (ap);
+-
+-  if (request > 0 && request < 4)
+-    data = &ret;
+-
+-#if __BOUNDED_POINTERS__
+-  switch (request)
+-    {
+-    case PTRACE_PEEKTEXT:
+-    case PTRACE_PEEKDATA:
+-    case PTRACE_PEEKUSER:
+-    case PTRACE_POKETEXT:
+-    case PTRACE_POKEDATA:
+-    case PTRACE_POKEUSER:
+-      (void) CHECK_1 ((int *) addr);
+-      (void) CHECK_1 ((int *) data);
+-      break;
+-
+-    case PTRACE_GETREGS:
+-    case PTRACE_SETREGS:
+-      /* We don't know the size of data, so the best we can do is ensure
+-	 that `data' is valid for at least one word.  */
+-      (void) CHECK_1 ((int *) data);
+-      break;
+-
+-    case PTRACE_GETFPREGS:
+-    case PTRACE_SETFPREGS:
+-      /* We don't know the size of data, so the best we can do is ensure
+-	 that `data' is valid for at least one word.  */
+-      (void) CHECK_1 ((int *) data);
+-      break;
+-
+-    case PTRACE_GETFPXREGS:
+-    case PTRACE_SETFPXREGS:
+-      /* We don't know the size of data, so the best we can do is ensure
+-	 that `data' is valid for at least one word.  */
+-      (void) CHECK_1 ((int *) data);
+-      break;
+-
+-    case PTRACE_TRACEME:
+-    case PTRACE_CONT:
+-    case PTRACE_KILL:
+-    case PTRACE_SINGLESTEP:
+-    case PTRACE_ATTACH:
+-    case PTRACE_DETACH:
+-    case PTRACE_SYSCALL:
+-      /* Neither `data' nor `addr' needs any checks.  */
+-      break;
+-    };
+-#endif
+-
+-  res = INLINE_SYSCALL (ptrace, 4, request, pid,
+-			__ptrvalue (addr), __ptrvalue (data));
+-  if (res >= 0 && request > 0 && request < 4)
+-    {
+-      __set_errno (0);
+-      return ret;
+-    }
+-
+-  return res;
+-}
+diff -Naur glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/sys/ptrace.h glibc-20050919/sysdeps/unix/sysv/linux/mips/sys/ptrace.h
+--- glibc-20050919.orig/sysdeps/unix/sysv/linux/mips/sys/ptrace.h	2004-11-24 04:37:35.000000000 +0000
++++ glibc-20050919/sysdeps/unix/sysv/linux/mips/sys/ptrace.h	1970-01-01 00:00:00.000000000 +0000
+@@ -1,136 +0,0 @@
+-/* `ptrace' debugger support interface.  Linux version.
+-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004
+-	Free Software Foundation, Inc.
+-   This file is part of the GNU C Library.
+-
+-   The GNU C Library is free software; you can redistribute it and/or
+-   modify it under the terms of the GNU Lesser General Public
+-   License as published by the Free Software Foundation; either
+-   version 2.1 of the License, or (at your option) any later version.
+-
+-   The GNU C Library is distributed in the hope that it will be useful,
+-   but WITHOUT ANY WARRANTY; without even the implied warranty of
+-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+-   Lesser General Public License for more details.
+-
+-   You should have received a copy of the GNU Lesser General Public
+-   License along with the GNU C Library; if not, write to the Free
+-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+-   02111-1307 USA.  */
+-
+-#ifndef _SYS_PTRACE_H
+-#define _SYS_PTRACE_H	1
+-
+-#include <features.h>
+-#include <sgidefs.h>
+-
+-__BEGIN_DECLS
+-
+-/* Type of the REQUEST argument to `ptrace.'  */
+-enum __ptrace_request
+-{
+-  /* Indicate that the process making this request should be traced.
+-     All signals received by this process can be intercepted by its
+-     parent, and its parent can use the other `ptrace' requests.  */
+-  PTRACE_TRACEME = 0,
+-#define PT_TRACE_ME PTRACE_TRACEME
+-
+-  /* Return the word in the process's text space at address ADDR.  */
+-  PTRACE_PEEKTEXT = 1,
+-#define PT_READ_I PTRACE_PEEKTEXT
+-
+-  /* Return the word in the process's data space at address ADDR.  */
+-  PTRACE_PEEKDATA = 2,
+-#define PT_READ_D PTRACE_PEEKDATA
+-
+-  /* Return the word in the process's user area at offset ADDR.  */
+-  PTRACE_PEEKUSER = 3,
+-#define PT_READ_U PTRACE_PEEKUSER
+-
+-  /* Write the word DATA into the process's text space at address ADDR.  */
+-  PTRACE_POKETEXT = 4,
+-#define PT_WRITE_I PTRACE_POKETEXT
+-
+-  /* Write the word DATA into the process's data space at address ADDR.  */
+-  PTRACE_POKEDATA = 5,
+-#define PT_WRITE_D PTRACE_POKEDATA
+-
+-  /* Write the word DATA into the process's user area at offset ADDR.  */
+-  PTRACE_POKEUSER = 6,
+-#define PT_WRITE_U PTRACE_POKEUSER
+-
+-  /* Continue the process.  */
+-  PTRACE_CONT = 7,
+-#define PT_CONTINUE PTRACE_CONT
+-
+-  /* Kill the process.  */
+-  PTRACE_KILL = 8,
+-#define PT_KILL PTRACE_KILL
+-
+-  /* Single step the process.
+-     This is not supported on all machines.  */
+-  PTRACE_SINGLESTEP = 9,
+-#define PT_STEP PTRACE_SINGLESTEP
+-
+-  /* Get all general purpose registers used by a processes.
+-     This is not supported on all machines.  */
+-   PTRACE_GETREGS = 12,
+-#define PT_GETREGS PTRACE_GETREGS
+-
+-  /* Set all general purpose registers used by a processes.
+-     This is not supported on all machines.  */
+-   PTRACE_SETREGS = 13,
+-#define PT_SETREGS PTRACE_SETREGS
+-
+-  /* Get all floating point registers used by a processes.
+-     This is not supported on all machines.  */
+-   PTRACE_GETFPREGS = 14,
+-#define PT_GETFPREGS PTRACE_GETFPREGS
+-
+-  /* Set all floating point registers used by a processes.
+-     This is not supported on all machines.  */
+-   PTRACE_SETFPREGS = 15,
+-#define PT_SETFPREGS PTRACE_SETFPREGS
+-
+-  /* Attach to a process that is already running. */
+-  PTRACE_ATTACH = 16,
+-#define PT_ATTACH PTRACE_ATTACH
+-
+-  /* Detach from a process attached to with PTRACE_ATTACH.  */
+-  PTRACE_DETACH = 17,
+-#define PT_DETACH PTRACE_DETACH
+-
+-  /* Get all extended floating point registers used by a processes.
+-     This is not supported on all machines.  */
+-   PTRACE_GETFPXREGS = 18,
+-#define PT_GETFPXREGS PTRACE_GETFPXREGS
+-
+-  /* Set all extended floating point registers used by a processes.
+-     This is not supported on all machines.  */
+-   PTRACE_SETFPXREGS = 19,
+-#define PT_SETFPXREGS PTRACE_SETFPXREGS
+-
+-  /* Continue and stop at the next (return from) syscall.  */
+-  PTRACE_SYSCALL = 24
+-#define PT_SYSCALL PTRACE_SYSCALL
+-};
+-
+-/* Perform process tracing functions.  REQUEST is one of the values
+-   above, and determines the action to be taken.
+-   For all requests except PTRACE_TRACEME, PID specifies the process to be
+-   traced.
+-
+-   PID and the other arguments described above for the various requests should
+-   appear (those that are used for the particular request) as:
+-     pid_t PID, void *ADDR, int DATA, void *ADDR2
+-   after REQUEST.  */
+-#if _MIPS_SIM == _ABIN32
+-__extension__ extern long long int ptrace
+-  (enum __ptrace_request __request, ...) __THROW;
+-#else
+-extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
+-#endif
+-
+-__END_DECLS
+-
+-#endif /* _SYS_PTRACE_H */
Index: patches/glibc-20051107-remap_update-1.patch
===================================================================
--- patches/glibc-20051107-remap_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/glibc-20051107-remap_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,26 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-10-18
+Initial Package Version: 20051017 Snapshot
+Origin: Jim Gifford based on BZ 1458
+Upstream Status: Sent
+Description: Fixes MREMAP_FIXED error that can occur on the MIPS
+	     and ALPHA architectures using the current glibc snapshot.
+ 
+--- glibc-20051017/sysdeps/unix/sysv/linux/alpha/bits/mman.h.orig	2005-10-18 07:07:00.000000000 +0000
++++ glibc-20051017/sysdeps/unix/sysv/linux/alpha/bits/mman.h	2005-10-18 07:07:11.000000000 +0000
+@@ -86,6 +86,7 @@
+ /* Flags for `mremap'.  */
+ #ifdef __USE_GNU
+ # define MREMAP_MAYMOVE	1
++# define MREMAP_FIXED   2
+ #endif
+ 
+ /* Advice to `madvise'.  */
+--- glibc-20051017/sysdeps/unix/sysv/linux/mips/bits/mman.h.orig	2005-10-18 06:59:19.000000000 +0000
++++ glibc-20051017/sysdeps/unix/sysv/linux/mips/bits/mman.h	2005-10-18 06:59:51.000000000 +0000
+@@ -89,4 +89,5 @@
+ /* Flags for `mremap'.  */
+ #ifdef __USE_GNU
+ # define MREMAP_MAYMOVE	1
++# define MREMAP_FIXED   2
+ #endif
Index: patches/grep-2.5.1a-mips_config_update-1.patch
===================================================================
--- patches/grep-2.5.1a-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/grep-2.5.1a-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1700 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2004-11-24
+Initial Package Version: 2.5.1
+Origin: Gentoo
+Upstream Status: Already Fixed
+Description: Updates config.sub and config.guess
+ 
+diff -Naur grep-2.5.1.orig/config.guess grep-2.5.1/config.guess
+--- grep-2.5.1.orig/config.guess	2002-02-28 09:12:58.000000000 +0000
++++ grep-2.5.1/config.guess	2004-11-25 07:13:56.431208464 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-#   Free Software Foundation, Inc.
++#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
++#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 
+-timestamp='2001-08-21'
++timestamp='2004-06-11'
+ 
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+@@ -24,8 +24,9 @@
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+ 
+-# Written by Per Bothner <bothner@cygnus.com>.
+-# Please send patches to <config-patches@gnu.org>.
++# Originally written by Per Bothner <per@bothner.com>.
++# Please send patches to <config-patches@gnu.org>.  Submit a context
++# diff and a properly formatted ChangeLog entry.
+ #
+ # This script attempts to guess a canonical system name similar to
+ # config.sub.  If it succeeds, it prints the system name on stdout, and
+@@ -87,30 +88,42 @@
+   exit 1
+ fi
+ 
++trap 'exit 1' 1 2 15
+ 
+-dummy=dummy-$$
+-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
++# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
++# compiler to aid in system detection is discouraged as it requires
++# temporary files to be created and, as you can see below, it is a
++# headache to deal with in a portable fashion.
+ 
+-# CC_FOR_BUILD -- compiler used by this script.
+ # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+ # use `HOST_CC' if defined, but it is deprecated.
+ 
+-set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+- ,,)    echo "int dummy(){}" > $dummy.c ;
+-	for c in cc gcc c89 ; do
+-	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+-	  if test $? = 0 ; then
++# Portable tmp directory creation inspired by the Autoconf team.
++
++set_cc_for_build='
++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
++: ${TMPDIR=/tmp} ;
++ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
++dummy=$tmp/dummy ;
++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
++case $CC_FOR_BUILD,$HOST_CC,$CC in
++ ,,)    echo "int x;" > $dummy.c ;
++	for c in cc gcc c89 c99 ; do
++	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ 	     CC_FOR_BUILD="$c"; break ;
+ 	  fi ;
+ 	done ;
+-	rm -f $dummy.c $dummy.o $dummy.rel ;
+ 	if test x"$CC_FOR_BUILD" = x ; then
+ 	  CC_FOR_BUILD=no_compiler_found ;
+ 	fi
+ 	;;
+  ,,*)   CC_FOR_BUILD=$CC ;;
+  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+-esac'
++esac ;'
+ 
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+ # (ghazi@noc.rutgers.edu 1994-08-24)
+@@ -127,29 +140,30 @@
+ 
+ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+     *:NetBSD:*:*)
+-	# Netbsd (nbsd) targets should (where applicable) match one or
++	# NetBSD (nbsd) targets should (where applicable) match one or
+ 	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+ 	# switched to ELF, *-*-netbsd* would select the old
+ 	# object file format.  This provides both forward
+ 	# compatibility and a consistent mechanism for selecting the
+ 	# object file format.
+-	# Determine the machine/vendor (is the vendor relevant).
+-	case "${UNAME_MACHINE}" in
+-	    amiga) machine=m68k-unknown ;;
+-	    arm32) machine=arm-unknown ;;
+-	    atari*) machine=m68k-atari ;;
+-	    sun3*) machine=m68k-sun ;;
+-	    mac68k) machine=m68k-apple ;;
+-	    macppc) machine=powerpc-apple ;;
+-	    hp3[0-9][05]) machine=m68k-hp ;;
+-	    ibmrt|romp-ibm) machine=romp-ibm ;;
+-	    *) machine=${UNAME_MACHINE}-unknown ;;
++	#
++	# Note: NetBSD doesn't particularly care about the vendor
++	# portion of the name.  We always set it to "unknown".
++	sysctl="sysctl -n hw.machine_arch"
++	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
++	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
++	case "${UNAME_MACHINE_ARCH}" in
++	    armeb) machine=armeb-unknown ;;
++	    arm*) machine=arm-unknown ;;
++	    sh3el) machine=shl-unknown ;;
++	    sh3eb) machine=sh-unknown ;;
++	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ 	esac
+ 	# The Operating System including object format, if it has switched
+ 	# to ELF recently, or will in the future.
+-	case "${UNAME_MACHINE}" in
+-	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
++	case "${UNAME_MACHINE_ARCH}" in
++	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ 		eval $set_cc_for_build
+ 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ 			| grep __ELF__ >/dev/null
+@@ -166,74 +180,135 @@
+ 		;;
+ 	esac
+ 	# The OS release
+-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++	# Debian GNU/NetBSD machines have a different userland, and
++	# thus, need a distinct triplet. However, they do not need
++	# kernel version information, so it can be replaced with a
++	# suitable tag, in the style of linux-gnu.
++	case "${UNAME_VERSION}" in
++	    Debian*)
++		release='-gnu'
++		;;
++	    *)
++		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++		;;
++	esac
+ 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ 	# contains redundant information, the shorter form:
+ 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ 	echo "${machine}-${os}${release}"
+ 	exit 0 ;;
++    amd64:OpenBSD:*:*)
++	echo x86_64-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    amiga:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    arc:OpenBSD:*:*)
++	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    cats:OpenBSD:*:*)
++	echo arm-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    hp300:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    luna88k:OpenBSD:*:*)
++    	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mac68k:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:OpenBSD:*:*)
++	echo powerpc-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mvme68k:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mvme88k:OpenBSD:*:*)
++	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mvmeppc:OpenBSD:*:*)
++	echo powerpc-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    pmax:OpenBSD:*:*)
++	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    sgi:OpenBSD:*:*)
++	echo mipseb-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    sun3:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    wgrisc:OpenBSD:*:*)
++	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:OpenBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:ekkoBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:MirBSD:*:*)
++	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:MirBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
+     alpha:OSF1:*:*)
+-	if test $UNAME_RELEASE = "V4.0"; then
++	case $UNAME_RELEASE in
++	*4.0)
+ 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+-	fi
++		;;
++	*5.*)
++	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++		;;
++	esac
++	# According to Compaq, /usr/sbin/psrinfo has been available on
++	# OSF/1 and Tru64 systems produced since 1995.  I hope that
++	# covers most systems running today.  This code pipes the CPU
++	# types through head -n 1, so we only detect the type of CPU 0.
++	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
++	case "$ALPHA_CPU_TYPE" in
++	    "EV4 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV4.5 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "LCA4 (21066/21068)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV5 (21164)")
++		UNAME_MACHINE="alphaev5" ;;
++	    "EV5.6 (21164A)")
++		UNAME_MACHINE="alphaev56" ;;
++	    "EV5.6 (21164PC)")
++		UNAME_MACHINE="alphapca56" ;;
++	    "EV5.7 (21164PC)")
++		UNAME_MACHINE="alphapca57" ;;
++	    "EV6 (21264)")
++		UNAME_MACHINE="alphaev6" ;;
++	    "EV6.7 (21264A)")
++		UNAME_MACHINE="alphaev67" ;;
++	    "EV6.8CB (21264C)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8AL (21264B)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8CX (21264D)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.9A (21264/EV69A)")
++		UNAME_MACHINE="alphaev69" ;;
++	    "EV7 (21364)")
++		UNAME_MACHINE="alphaev7" ;;
++	    "EV7.9 (21364A)")
++		UNAME_MACHINE="alphaev79" ;;
++	esac
++	# A Pn.n version is a patched version.
+ 	# A Vn.n version is a released version.
+ 	# A Tn.n version is a released field test version.
+ 	# A Xn.n version is an unreleased experimental baselevel.
+ 	# 1.2 uses "1.2" for uname -r.
+-	cat <<EOF >$dummy.s
+-	.data
+-\$Lformat:
+-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+-
+-	.text
+-	.globl main
+-	.align 4
+-	.ent main
+-main:
+-	.frame \$30,16,\$26,0
+-	ldgp \$29,0(\$27)
+-	.prologue 1
+-	.long 0x47e03d80 # implver \$0
+-	lda \$2,-1
+-	.long 0x47e20c21 # amask \$2,\$1
+-	lda \$16,\$Lformat
+-	mov \$0,\$17
+-	not \$1,\$18
+-	jsr \$26,printf
+-	ldgp \$29,0(\$26)
+-	mov 0,\$16
+-	jsr \$26,exit
+-	.end main
+-EOF
+-	eval $set_cc_for_build
+-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		case `./$dummy` in
+-			0-0)
+-				UNAME_MACHINE="alpha"
+-				;;
+-			1-0)
+-				UNAME_MACHINE="alphaev5"
+-				;;
+-			1-1)
+-				UNAME_MACHINE="alphaev56"
+-				;;
+-			1-101)
+-				UNAME_MACHINE="alphapca56"
+-				;;
+-			2-303)
+-				UNAME_MACHINE="alphaev6"
+-				;;
+-			2-307)
+-				UNAME_MACHINE="alphaev67"
+-				;;
+-			2-1307)
+-				UNAME_MACHINE="alphaev68"
+-				;;
+-		esac
+-	fi
+-	rm -f $dummy.s $dummy
+-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++	exit 0 ;;
++    Alpha*:OpenVMS:*:*)
++	echo alpha-hp-vms
+ 	exit 0 ;;
+     Alpha\ *:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+@@ -247,33 +322,18 @@
+     Amiga*:UNIX_System_V:4.0:*)
+ 	echo m68k-unknown-sysv4
+ 	exit 0;;
+-    amiga:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     *:[Aa]miga[Oo][Ss]:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-amigaos
+ 	exit 0 ;;
+-    arc64:OpenBSD:*:*)
+-	echo mips64el-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    arc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    hkmips:OpenBSD:*:*)
+-	echo mips-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    pmax:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    sgi:OpenBSD:*:*)
+-	echo mips-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    wgrisc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++    *:[Mm]orph[Oo][Ss]:*:*)
++	echo ${UNAME_MACHINE}-unknown-morphos
+ 	exit 0 ;;
+     *:OS/390:*:*)
+ 	echo i370-ibm-openedition
+ 	exit 0 ;;
++    *:OS400:*:*)
++        echo powerpc-ibm-os400
++	exit 0 ;;
+     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ 	echo arm-acorn-riscix${UNAME_RELEASE}
+ 	exit 0;;
+@@ -291,6 +351,13 @@
+     NILE*:*:*:dcosx)
+ 	echo pyramid-pyramid-svr4
+ 	exit 0 ;;
++    DRS?6000:unix:4.0:6*)
++	echo sparc-icl-nx6
++	exit 0 ;;
++    DRS?6000:UNIX_SV:4.2*:7*)
++	case `/usr/bin/uname -p` in
++	    sparc) echo sparc-icl-nx7 && exit 0 ;;
++	esac ;;
+     sun4H:SunOS:5.*:*)
+ 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+@@ -319,7 +386,7 @@
+ 	echo m68k-sun-sunos${UNAME_RELEASE}
+ 	exit 0 ;;
+     sun*:*:4.2BSD:*)
+-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
++	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ 	case "`/bin/arch`" in
+ 	    sun3)
+@@ -333,12 +400,6 @@
+     aushp:SunOS:*:*)
+ 	echo sparc-auspex-sunos${UNAME_RELEASE}
+ 	exit 0 ;;
+-    sparc*:NetBSD:*)
+-	echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    atari*:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     # The situation for MiNT is a little confusing.  The machine name
+     # can be virtually everything (everything which is not
+     # "atarist" or "atariste" at least should have a processor
+@@ -365,17 +426,8 @@
+     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+         echo m68k-unknown-mint${UNAME_RELEASE}
+         exit 0 ;;
+-    sun3*:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    mac68k:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    mvme68k:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    mvme88k:OpenBSD:*:*)
+-	echo m88k-unknown-openbsd${UNAME_RELEASE}
++    m68k:machten:*:*)
++	echo m68k-apple-machten${UNAME_RELEASE}
+ 	exit 0 ;;
+     powerpc:machten:*:*)
+ 	echo powerpc-apple-machten${UNAME_RELEASE}
+@@ -393,6 +445,7 @@
+ 	echo clipper-intergraph-clix${UNAME_RELEASE}
+ 	exit 0 ;;
+     mips:*:*:UMIPS | mips:*:*:RISCos)
++	eval $set_cc_for_build
+ 	sed 's/^	//' << EOF >$dummy.c
+ #ifdef __cplusplus
+ #include <stdio.h>  /* for printf() prototype */
+@@ -414,16 +467,20 @@
+ 	  exit (-1);
+ 	}
+ EOF
+-	eval $set_cc_for_build
+-	$CC_FOR_BUILD $dummy.c -o $dummy \
+-	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+-	  && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	$CC_FOR_BUILD -o $dummy $dummy.c \
++	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
++	  && exit 0
+ 	echo mips-mips-riscos${UNAME_RELEASE}
+ 	exit 0 ;;
+     Motorola:PowerMAX_OS:*:*)
+ 	echo powerpc-motorola-powermax
+ 	exit 0 ;;
++    Motorola:*:4.3:PL8-*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
++    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
+     Night_Hawk:Power_UNIX:*:*)
+ 	echo powerpc-harris-powerunix
+ 	exit 0 ;;
+@@ -484,6 +541,7 @@
+ 	exit 0 ;;
+     *:AIX:2:3)
+ 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
++		eval $set_cc_for_build
+ 		sed 's/^		//' << EOF >$dummy.c
+ 		#include <sys/systemcfg.h>
+ 
+@@ -495,9 +553,7 @@
+ 			exit(0);
+ 			}
+ EOF
+-		eval $set_cc_for_build
+-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-		rm -f $dummy.c $dummy
++		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 		echo rs6000-ibm-aix3.2.5
+ 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ 		echo rs6000-ibm-aix3.2.4
+@@ -506,7 +562,7 @@
+ 	fi
+ 	exit 0 ;;
+     *:AIX:*:[45])
+-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
++	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ 		IBM_ARCH=rs6000
+ 	else
+@@ -546,10 +602,8 @@
+ 	    9000/31? )            HP_ARCH=m68000 ;;
+ 	    9000/[34]?? )         HP_ARCH=m68k ;;
+ 	    9000/[678][0-9][0-9])
+-              case "${HPUX_REV}" in
+-                11.[0-9][0-9])
+-                  if [ -x /usr/bin/getconf ]; then
+-                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
++		if [ -x /usr/bin/getconf ]; then
++		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                     case "${sc_cpu_version}" in
+                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+@@ -558,12 +612,13 @@
+                         case "${sc_kernel_bits}" in
+                           32) HP_ARCH="hppa2.0n" ;;
+                           64) HP_ARCH="hppa2.0w" ;;
++			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                         esac ;;
+                     esac
+-                  fi ;;
+-              esac
+-              if [ "${HP_ARCH}" = "" ]; then
+-              sed 's/^              //' << EOF >$dummy.c
++		fi
++		if [ "${HP_ARCH}" = "" ]; then
++		    eval $set_cc_for_build
++		    sed 's/^              //' << EOF >$dummy.c
+ 
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+@@ -596,12 +651,21 @@
+                   exit (0);
+               }
+ EOF
+-	eval $set_cc_for_build
+-	(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+-	if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+-	rm -f $dummy.c $dummy
+-	fi ;;
++		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
++		    test -z "$HP_ARCH" && HP_ARCH=hppa
++		fi ;;
+ 	esac
++	if [ ${HP_ARCH} = "hppa2.0w" ]
++	then
++	    # avoid double evaluation of $set_cc_for_build
++	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
++	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++	    then
++		HP_ARCH="hppa2.0w"
++	    else
++		HP_ARCH="hppa64"
++	    fi
++	fi
+ 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     ia64:HP-UX:*:*)
+@@ -609,6 +673,7 @@
+ 	echo ia64-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     3050*:HI-UX:*:*)
++	eval $set_cc_for_build
+ 	sed 's/^	//' << EOF >$dummy.c
+ 	#include <unistd.h>
+ 	int
+@@ -634,9 +699,7 @@
+ 	  exit (0);
+ 	}
+ EOF
+-	eval $set_cc_for_build
+-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 	echo unknown-hitachi-hiuxwe2
+ 	exit 0 ;;
+     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+@@ -664,9 +727,6 @@
+     parisc*:Lites*:*:*)
+ 	echo hppa1.1-hp-lites
+ 	exit 0 ;;
+-    hppa*:OpenBSD:*:*)
+-	echo hppa-unknown-openbsd
+-	exit 0 ;;
+     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ 	echo c1-convex-bsd
+         exit 0 ;;
+@@ -685,9 +745,6 @@
+     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ 	echo c4-convex-bsd
+         exit 0 ;;
+-    CRAY*X-MP:*:*:*)
+-	echo xmp-cray-unicos
+-        exit 0 ;;
+     CRAY*Y-MP:*:*:*)
+ 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+@@ -700,26 +757,25 @@
+     CRAY*TS:*:*:*)
+ 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY*T3D:*:*:*)
+-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+-	exit 0 ;;
+     CRAY*T3E:*:*:*)
+ 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*SV1:*:*:*)
+ 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY-2:*:*:*)
+-	echo cray2-cray-unicos
+-        exit 0 ;;
++    *:UNICOS/mp:*:*)
++	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++	exit 0 ;;
+     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+         exit 0 ;;
+-    hp300:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
++    5000:UNIX_System_V:4.*:*)
++        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ 	exit 0 ;;
+     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+@@ -731,10 +787,21 @@
+ 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:FreeBSD:*:*)
+-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+-	exit 0 ;;
+-    *:OpenBSD:*:*)
+-	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++	# Determine whether the default compiler uses glibc.
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#include <features.h>
++	#if __GLIBC__ >= 2
++	LIBC=gnu
++	#else
++	LIBC=
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
++	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
++	# FreeBSD's kernel, but not the complete OS.
++	case ${LIBC} in gnu) kernel_only='k' ;; esac
++	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+ 	exit 0 ;;
+     i*:CYGWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-cygwin
+@@ -745,11 +812,17 @@
+     i*:PW*:*)
+ 	echo ${UNAME_MACHINE}-pc-pw32
+ 	exit 0 ;;
++    x86:Interix*:[34]*)
++	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
++	exit 0 ;;
++    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
++	echo i${UNAME_MACHINE}-pc-mks
++	exit 0 ;;
+     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+ 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ 	# UNAME_MACHINE based on the output of uname instead of i386?
+-	echo i386-pc-interix
++	echo i586-pc-interix
+ 	exit 0 ;;
+     i*:UWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-uwin
+@@ -761,25 +834,68 @@
+ 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+     *:GNU:*:*)
++	# the GNU system
+ 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ 	exit 0 ;;
++    *:GNU/*:*:*)
++	# other systems with GNU libc and userland
++	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++	exit 0 ;;
+     i*86:Minix:*:*)
+ 	echo ${UNAME_MACHINE}-pc-minix
+ 	exit 0 ;;
+     arm*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    cris:Linux:*:*)
++	echo cris-axis-linux-gnu
++	exit 0 ;;
+     ia64:Linux:*:*)
+-	echo ${UNAME_MACHINE}-unknown-linux
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
++    m32r*:Linux:*:*)
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+     m68*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+     mips:Linux:*:*)
+-	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
+-	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
+-	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
+-	esac
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips
++	#undef mipsel
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mipsel
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips
++	#else
++	CPU=
++	#endif
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++	;;
++    mips64:Linux:*:*)
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips64
++	#undef mips64el
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mips64el
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips64
++	#else
++	CPU=
++	#endif
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ 	;;
+     ppc:Linux:*:*)
+ 	echo powerpc-unknown-linux-gnu
+@@ -815,6 +931,9 @@
+     s390:Linux:*:* | s390x:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-ibm-linux
+ 	exit 0 ;;
++    sh64*:Linux:*:*)
++    	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     sh*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -828,7 +947,8 @@
+ 	# The BFD linker knows what the default object file format is, so
+ 	# first see if it will tell us. cd to the root directory to prevent
+ 	# problems with other programs or directories called `ld' in the path.
+-	ld_supported_targets=`cd /; ld --help 2>&1 \
++	# Set LC_ALL=C to ensure ld outputs messages in English.
++	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ 			 | sed -ne '/supported targets:/!d
+ 				    s/[ 	][ 	]*/ /g
+ 				    s/.*supported targets: *//
+@@ -840,7 +960,7 @@
+ 		;;
+ 	  a.out-i386-linux)
+ 		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+-		exit 0 ;;		
++		exit 0 ;;
+ 	  coff-i386)
+ 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ 		exit 0 ;;
+@@ -851,33 +971,32 @@
+ 		exit 0 ;;
+ 	esac
+ 	# Determine whether the default compiler is a.out or elf
+-	cat >$dummy.c <<EOF
+-#include <features.h>
+-#ifdef __cplusplus
+-#include <stdio.h>  /* for printf() prototype */
+-	int main (int argc, char *argv[]) {
+-#else
+-	int main (argc, argv) int argc; char *argv[]; {
+-#endif
+-#ifdef __ELF__
+-# ifdef __GLIBC__
+-#  if __GLIBC__ >= 2
+-    printf ("%s-pc-linux-gnu\n", argv[1]);
+-#  else
+-    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
+-#  endif
+-# else
+-   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
+-# endif
+-#else
+-  printf ("%s-pc-linux-gnuaout\n", argv[1]);
+-#endif
+-  return 0;
+-}
+-EOF
+ 	eval $set_cc_for_build
+-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	sed 's/^	//' << EOF >$dummy.c
++	#include <features.h>
++	#ifdef __ELF__
++	# ifdef __GLIBC__
++	#  if __GLIBC__ >= 2
++	LIBC=gnu
++	#  else
++	LIBC=gnulibc1
++	#  endif
++	# else
++	LIBC=gnulibc1
++	# endif
++	#else
++	#ifdef __INTEL_COMPILER
++	LIBC=gnu
++	#else
++	LIBC=gnuaout
++	#endif
++	#endif
++	#ifdef __dietlibc__
++	LIBC=dietlibc
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
++	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ 	;;
+     i*86:DYNIX/ptx:4*:*)
+@@ -894,6 +1013,26 @@
+         # Use sysv4.2uw... so that sysv4* matches it.
+ 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ 	exit 0 ;;
++    i*86:OS/2:*:*)
++	# If we were able to find `uname', then EMX Unix compatibility
++	# is probably installed.
++	echo ${UNAME_MACHINE}-pc-os2-emx
++	exit 0 ;;
++    i*86:XTS-300:*:STOP)
++	echo ${UNAME_MACHINE}-unknown-stop
++	exit 0 ;;
++    i*86:atheos:*:*)
++	echo ${UNAME_MACHINE}-unknown-atheos
++	exit 0 ;;
++	i*86:syllable:*:*)
++	echo ${UNAME_MACHINE}-pc-syllable
++	exit 0 ;;
++    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
++	echo i386-unknown-lynxos${UNAME_RELEASE}
++	exit 0 ;;
++    i*86:*DOS:*:*)
++	echo ${UNAME_MACHINE}-pc-msdosdjgpp
++	exit 0 ;;
+     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+@@ -915,22 +1054,19 @@
+ 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
++		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
++		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
++		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ 			&& UNAME_MACHINE=i586
+-		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
++		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ 			&& UNAME_MACHINE=i686
+-		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
++		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ 			&& UNAME_MACHINE=i686
+ 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ 	else
+ 		echo ${UNAME_MACHINE}-pc-sysv32
+ 	fi
+ 	exit 0 ;;
+-    i*86:*DOS:*:*)
+-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+-	exit 0 ;;
+     pc:*:*:*)
+ 	# Left here for compatibility:
+         # uname -m prints for DJGPP always 'pc', but it prints nothing about
+@@ -954,9 +1090,15 @@
+ 	# "miniframe"
+ 	echo m68010-convergent-sysv
+ 	exit 0 ;;
+-    M68*:*:R3V[567]*:*)
++    mc68k:UNIX:SYSTEM5:3.51m)
++	echo m68k-convergent-sysv
++	exit 0 ;;
++    M680?0:D-NIX:5.3:*)
++	echo m68k-diab-dnix
++	exit 0 ;;
++    M68*:*:R3V[5678]*:*)
+ 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
++    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+ 	OS_REL=''
+ 	test -r /etc/.relid \
+ 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+@@ -973,9 +1115,6 @@
+     mc68030:UNIX_System_V:4.*:*)
+ 	echo m68k-atari-sysv4
+ 	exit 0 ;;
+-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+-	echo i386-unknown-lynxos${UNAME_RELEASE}
+-	exit 0 ;;
+     TSUNAMI:LynxOS:2.*:*)
+ 	echo sparc-unknown-lynxos${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1047,6 +1186,9 @@
+     SX-5:SUPER-UX:*:*)
+ 	echo sx5-nec-superux${UNAME_RELEASE}
+ 	exit 0 ;;
++    SX-6:SUPER-UX:*:*)
++	echo sx6-nec-superux${UNAME_RELEASE}
++	exit 0 ;;
+     Power*:Rhapsody:*:*)
+ 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1054,18 +1196,24 @@
+ 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:Darwin:*:*)
+-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
++	case `uname -p` in
++	    *86) UNAME_PROCESSOR=i686 ;;
++	    powerpc) UNAME_PROCESSOR=powerpc ;;
++	esac
++	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:procnto*:*:* | *:QNX:[0123456789]*:*)
+-	if test "${UNAME_MACHINE}" = "x86pc"; then
++	UNAME_PROCESSOR=`uname -p`
++	if test "$UNAME_PROCESSOR" = "x86"; then
++		UNAME_PROCESSOR=i386
+ 		UNAME_MACHINE=pc
+ 	fi
+-	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
++	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:QNX:*:4*)
+ 	echo i386-pc-qnx
+ 	exit 0 ;;
+-    NSR-[KW]:NONSTOP_KERNEL:*:*)
++    NSR-?:NONSTOP_KERNEL:*:*)
+ 	echo nsr-tandem-nsk${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:NonStop-UX:*:*)
+@@ -1088,11 +1236,6 @@
+ 	fi
+ 	echo ${UNAME_MACHINE}-unknown-plan9
+ 	exit 0 ;;
+-    i*86:OS/2:*:*)
+-	# If we were able to find `uname', then EMX Unix compatibility
+-	# is probably installed.
+-	echo ${UNAME_MACHINE}-pc-os2-emx
+-	exit 0 ;;
+     *:TOPS-10:*:*)
+ 	echo pdp10-unknown-tops10
+ 	exit 0 ;;
+@@ -1111,14 +1254,18 @@
+     *:ITS:*:*)
+ 	echo pdp10-unknown-its
+ 	exit 0 ;;
+-    i*86:XTS-300:*:STOP)
+-	echo ${UNAME_MACHINE}-unknown-stop
++    SEI:*:*:SEIUX)
++        echo mips-sei-seiux${UNAME_RELEASE}
++	exit 0 ;;
++    *:DragonFly:*:*)
++	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ 	exit 0 ;;
+ esac
+ 
+ #echo '(No uname command or uname output not recognized.)' 1>&2
+ #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+ 
++eval $set_cc_for_build
+ cat >$dummy.c <<EOF
+ #ifdef _SEQUENT_
+ # include <sys/types.h>
+@@ -1233,9 +1380,7 @@
+ }
+ EOF
+ 
+-eval $set_cc_for_build
+-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-rm -f $dummy.c $dummy
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+ 
+ # Apollos put the system type in the environment.
+ 
+diff -Naur grep-2.5.1.orig/config.sub grep-2.5.1/config.sub
+--- grep-2.5.1.orig/config.sub	2002-02-28 09:12:58.000000000 +0000
++++ grep-2.5.1/config.sub	2004-11-25 07:13:56.435207856 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-#   Free Software Foundation, Inc.
++#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
++#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 
+-timestamp='2001-08-13'
++timestamp='2004-03-12'
+ 
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -29,7 +29,8 @@
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+ 
+-# Please send patches to <config-patches@gnu.org>.
++# Please send patches to <config-patches@gnu.org>.  Submit a context
++# diff and a properly formatted ChangeLog entry.
+ #
+ # Configuration subroutine to validate and canonicalize a configuration type.
+ # Supply the specified configuration type as an argument.
+@@ -117,7 +118,8 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
++  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
++  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -226,31 +228,46 @@
+ 	1750a | 580 \
+ 	| a29k \
+ 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
++	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
++	| am33_2.0 \
+ 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ 	| c4x | clipper \
+-	| d10v | d30v | dsp16xx \
+-	| fr30 \
++	| d10v | d30v | dlx | dsp16xx \
++	| fr30 | frv \
+ 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ 	| i370 | i860 | i960 | ia64 \
+-	| m32r | m68000 | m68k | m88k | mcore \
+-	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+-	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
+-	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
+-	| mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \
++	| ip2k | iq2000 \
++	| m32r | m32rle | m68000 | m68k | m88k | mcore \
++	| mips | mipsbe | mipseb | mipsel | mipsle \
++	| mips16 \
++	| mips64 | mips64el \
++	| mips64vr | mips64vrel \
++	| mips64orion | mips64orionel \
++	| mips64vr4100 | mips64vr4100el \
++	| mips64vr4300 | mips64vr4300el \
++	| mips64vr5000 | mips64vr5000el \
++	| mipsisa32 | mipsisa32el \
++	| mipsisa32r2 | mipsisa32r2el \
++	| mipsisa64 | mipsisa64el \
++	| mipsisa64r2 | mipsisa64r2el \
++	| mipsisa64sb1 | mipsisa64sb1el \
++	| mipsisa64sr71k | mipsisa64sr71kel \
++	| mipstx39 | mipstx39el \
+ 	| mn10200 | mn10300 \
++	| msp430 \
+ 	| ns16k | ns32k \
+-	| openrisc \
++	| openrisc | or32 \
+ 	| pdp10 | pdp11 | pj | pjl \
+ 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ 	| pyramid \
+-	| s390 | s390x \
+-	| sh | sh[34] | sh[34]eb | shbe | shle \
+-	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
++	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++	| sh64 | sh64le \
++	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ 	| strongarm \
+-	| tahoe | thumb | tic80 | tron \
+-	| v850 \
++	| tahoe | thumb | tic4x | tic80 | tron \
++	| v850 | v850e \
+ 	| we32k \
+-	| x86 | xscale \
++	| x86 | xscale | xstormy16 | xtensa \
+ 	| z8k)
+ 		basic_machine=$basic_machine-unknown
+ 		;;
+@@ -277,38 +294,56 @@
+ 	580-* \
+ 	| a29k-* \
+ 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+-	| alphapca5[67]-* | arc-* \
+-	| arm-*  | armbe-* | armle-* | armv*-* \
++	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
++	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
++	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
++	| avr-* \
+ 	| bs2000-* \
+-	| c[123]* | c30-* | [cjt]90-* | c54x-* \
+-	| clipper-* | cray2-* | cydra-* \
+-	| d10v-* | d30v-* \
++	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
++	| clipper-* | cydra-* \
++	| d10v-* | d30v-* | dlx-* \
+ 	| elxsi-* \
+-	| f30[01]-* | f700-* | fr30-* | fx80-* \
++	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ 	| h8300-* | h8500-* \
+ 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ 	| i*86-* | i860-* | i960-* | ia64-* \
+-	| m32r-* \
+-	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
++	| ip2k-* | iq2000-* \
++	| m32r-* | m32rle-* \
++	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ 	| m88110-* | m88k-* | mcore-* \
+-	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
+-	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
+-	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \
+-	| mipsle-* | mipstx39-* | mipstx39el-* \
+-	| none-* | np1-* | ns16k-* | ns32k-* \
++	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
++	| mips16-* \
++	| mips64-* | mips64el-* \
++	| mips64vr-* | mips64vrel-* \
++	| mips64orion-* | mips64orionel-* \
++	| mips64vr4100-* | mips64vr4100el-* \
++	| mips64vr4300-* | mips64vr4300el-* \
++	| mips64vr5000-* | mips64vr5000el-* \
++	| mipsisa32-* | mipsisa32el-* \
++	| mipsisa32r2-* | mipsisa32r2el-* \
++	| mipsisa64-* | mipsisa64el-* \
++	| mipsisa64r2-* | mipsisa64r2el-* \
++	| mipsisa64sb1-* | mipsisa64sb1el-* \
++	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
++	| mipstx39-* | mipstx39el-* \
++	| msp430-* \
++	| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
+ 	| orion-* \
+ 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ 	| pyramid-* \
+ 	| romp-* | rs6000-* \
+-	| s390-* | s390x-* \
+-	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
+-	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
+-	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \
+-	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+-	| v850-* | vax-* \
++	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
++	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
++	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++	| tahoe-* | thumb-* \
++	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++	| tron-* \
++	| v850-* | v850e-* | vax-* \
+ 	| we32k-* \
+-	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
++	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
++	| xtensa-* \
+ 	| ymp-* \
+ 	| z8k-*)
+ 		;;
+@@ -328,6 +363,9 @@
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++    	abacus)
++		basic_machine=abacus-unknown
++		;;
+ 	adobe68k)
+ 		basic_machine=m68010-adobe
+ 		os=-scout
+@@ -342,6 +380,12 @@
+ 		basic_machine=a29k-none
+ 		os=-bsd
+ 		;;
++	amd64)
++		basic_machine=x86_64-pc
++		;;
++	amd64-*)
++		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	amdahl)
+ 		basic_machine=580-amdahl
+ 		os=-sysv
+@@ -373,6 +417,10 @@
+ 		basic_machine=ns32k-sequent
+ 		os=-dynix
+ 		;;
++	c90)
++		basic_machine=c90-cray
++		os=-unicos
++		;;
+ 	convex-c1)
+ 		basic_machine=c1-convex
+ 		os=-bsd
+@@ -393,17 +441,13 @@
+ 		basic_machine=c38-convex
+ 		os=-bsd
+ 		;;
+-	cray | ymp)
+-		basic_machine=ymp-cray
+-		os=-unicos
+-		;;
+-	cray2)
+-		basic_machine=cray2-cray
++	cray | j90)
++		basic_machine=j90-cray
+ 		os=-unicos
+ 		;;
+-	[cjt]90)
+-		basic_machine=${basic_machine}-cray
+-		os=-unicos
++	cr16c)
++		basic_machine=cr16c-unknown
++		os=-elf
+ 		;;
+ 	crds | unos)
+ 		basic_machine=m68k-crds
+@@ -411,12 +455,24 @@
+ 	cris | cris-* | etrax*)
+ 		basic_machine=cris-axis
+ 		;;
++	crx)
++		basic_machine=crx-unknown
++		os=-elf
++		;;
+ 	da30 | da30-*)
+ 		basic_machine=m68k-da30
+ 		;;
+ 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ 		basic_machine=mips-dec
+ 		;;
++	decsystem10* | dec10*)
++		basic_machine=pdp10-dec
++		os=-tops10
++		;;
++	decsystem20* | dec20*)
++		basic_machine=pdp10-dec
++		os=-tops20
++		;;
+ 	delta | 3300 | motorola-3300 | motorola-delta \
+ 	      | 3300-motorola | delta-motorola)
+ 		basic_machine=m68k-motorola
+@@ -597,14 +653,6 @@
+ 		basic_machine=m68k-atari
+ 		os=-mint
+ 		;;
+-	mipsel*-linux*)
+-		basic_machine=mipsel-unknown
+-		os=-linux-gnu
+-		;;
+-	mips*-linux*)
+-		basic_machine=mips-unknown
+-		os=-linux-gnu
+-		;;
+ 	mips3*-*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ 		;;
+@@ -619,6 +667,10 @@
+ 		basic_machine=m68k-rom68k
+ 		os=-coff
+ 		;;
++	morphos)
++		basic_machine=powerpc-unknown
++		os=-morphos
++		;;
+ 	msdos)
+ 		basic_machine=i386-pc
+ 		os=-msdos
+@@ -691,6 +743,10 @@
+ 	np1)
+ 		basic_machine=np1-gould
+ 		;;
++	nv1)
++		basic_machine=nv1-cray
++		os=-unicosmp
++		;;
+ 	nsr-tandem)
+ 		basic_machine=nsr-tandem
+ 		;;
+@@ -698,6 +754,14 @@
+ 		basic_machine=hppa1.1-oki
+ 		os=-proelf
+ 		;;
++	or32 | or32-*)
++		basic_machine=or32-unknown
++		os=-coff
++		;;
++	os400)
++		basic_machine=powerpc-ibm
++		os=-os400
++		;;
+ 	OSE68000 | ose68000)
+ 		basic_machine=m68000-ericsson
+ 		os=-ose
+@@ -720,49 +784,55 @@
+ 	pbb)
+ 		basic_machine=m68k-tti
+ 		;;
+-        pc532 | pc532-*)
++	pc532 | pc532-*)
+ 		basic_machine=ns32k-pc532
+ 		;;
+-	pentium | p5 | k5 | k6 | nexgen)
++	pentium | p5 | k5 | k6 | nexgen | viac3)
+ 		basic_machine=i586-pc
+ 		;;
+-	pentiumpro | p6 | 6x86 | athlon)
++	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ 		basic_machine=i686-pc
+ 		;;
+-	pentiumii | pentium2)
++	pentiumii | pentium2 | pentiumiii | pentium3)
+ 		basic_machine=i686-pc
+ 		;;
+-	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
++	pentium4)
++		basic_machine=i786-pc
++		;;
++	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+-	pentiumii-* | pentium2-*)
++	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
++	pentium4-*)
++		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	pn)
+ 		basic_machine=pn-gould
+ 		;;
+ 	power)	basic_machine=power-ibm
+ 		;;
+ 	ppc)	basic_machine=powerpc-unknown
+-	        ;;
++		;;
+ 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppcle | powerpclittle | ppc-le | powerpc-little)
+ 		basic_machine=powerpcle-unknown
+-	        ;;
++		;;
+ 	ppcle-* | powerpclittle-*)
+ 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppc64)	basic_machine=powerpc64-unknown
+-	        ;;
++		;;
+ 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ 		basic_machine=powerpc64le-unknown
+-	        ;;
++		;;
+ 	ppc64le-* | powerpc64little-*)
+ 		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+@@ -783,10 +853,26 @@
+ 	rtpc | rtpc-*)
+ 		basic_machine=romp-ibm
+ 		;;
++	s390 | s390-*)
++		basic_machine=s390-ibm
++		;;
++	s390x | s390x-*)
++		basic_machine=s390x-ibm
++		;;
+ 	sa29200)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++	sb1)
++		basic_machine=mipsisa64sb1-unknown
++		;;
++	sb1el)
++		basic_machine=mipsisa64sb1el-unknown
++		;;
++	sei)
++		basic_machine=mips-sei
++		os=-seiux
++		;;
+ 	sequent)
+ 		basic_machine=i386-sequent
+ 		;;
+@@ -794,7 +880,10 @@
+ 		basic_machine=sh-hitachi
+ 		os=-hms
+ 		;;
+-	sparclite-wrs)
++	sh64)
++		basic_machine=sh64-unknown
++		;;
++	sparclite-wrs | simso-wrs)
+ 		basic_machine=sparclite-wrs
+ 		os=-vxworks
+ 		;;
+@@ -861,22 +950,42 @@
+ 		os=-dynix
+ 		;;
+ 	t3e)
+-		basic_machine=t3e-cray
++		basic_machine=alphaev5-cray
++		os=-unicos
++		;;
++	t90)
++		basic_machine=t90-cray
+ 		os=-unicos
+ 		;;
+ 	tic54x | c54x*)
+ 		basic_machine=tic54x-unknown
+ 		os=-coff
+ 		;;
++	tic55x | c55x*)
++		basic_machine=tic55x-unknown
++		os=-coff
++		;;
++	tic6x | c6x*)
++		basic_machine=tic6x-unknown
++		os=-coff
++		;;
+ 	tx39)
+ 		basic_machine=mipstx39-unknown
+ 		;;
+ 	tx39el)
+ 		basic_machine=mipstx39el-unknown
+ 		;;
++	toad1)
++		basic_machine=pdp10-xkl
++		os=-tops20
++		;;
+ 	tower | tower-32)
+ 		basic_machine=m68k-ncr
+ 		;;
++	tpf)
++		basic_machine=s390x-ibm
++		os=-tpf
++		;;
+ 	udi29k)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+@@ -898,8 +1007,8 @@
+ 		os=-vms
+ 		;;
+ 	vpp*|vx|vx-*)
+-               basic_machine=f301-fujitsu
+-               ;;
++		basic_machine=f301-fujitsu
++		;;
+ 	vxworks960)
+ 		basic_machine=i960-wrs
+ 		os=-vxworks
+@@ -920,17 +1029,13 @@
+ 		basic_machine=hppa1.1-winbond
+ 		os=-proelf
+ 		;;
+-	windows32)
+-		basic_machine=i386-pc
+-		os=-windows32-msvcrt
++	xps | xps100)
++		basic_machine=xps100-honeywell
+ 		;;
+-	xmp)
+-		basic_machine=xmp-cray
++	ymp)
++		basic_machine=ymp-cray
+ 		os=-unicos
+ 		;;
+-        xps | xps100)
+-		basic_machine=xps100-honeywell
+-		;;
+ 	z8k-*-coff)
+ 		basic_machine=z8k-unknown
+ 		os=-sim
+@@ -951,13 +1056,6 @@
+ 	op60c)
+ 		basic_machine=hppa1.1-oki
+ 		;;
+-	mips)
+-		if [ x$os = x-linux-gnu ]; then
+-			basic_machine=mips-unknown
+-		else
+-			basic_machine=mips-mips
+-		fi
+-		;;
+ 	romp)
+ 		basic_machine=romp-ibm
+ 		;;
+@@ -977,13 +1075,16 @@
+ 	we32k)
+ 		basic_machine=we32k-att
+ 		;;
+-	sh3 | sh4 | sh3eb | sh4eb)
++	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ 		basic_machine=sh-unknown
+ 		;;
+-	sparc | sparcv9 | sparcv9b)
++	sh64)
++		basic_machine=sh64-unknown
++		;;
++	sparc | sparcv8 | sparcv9 | sparcv9b)
+ 		basic_machine=sparc-sun
+ 		;;
+-        cydra)
++	cydra)
+ 		basic_machine=cydra-cydrome
+ 		;;
+ 	orion)
+@@ -998,10 +1099,6 @@
+ 	pmac | pmac-mpw)
+ 		basic_machine=powerpc-apple
+ 		;;
+-	c4x*)
+-		basic_machine=c4x-none
+-		os=-coff
+-		;;
+ 	*-unknown)
+ 		# Make sure to match an already-canonicalized machine name.
+ 		;;
+@@ -1057,17 +1154,20 @@
+ 	      | -aos* \
+ 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
++	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
++	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ 	      | -chorusos* | -chorusrdb* \
+ 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
++	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
++	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+-	      | -os2* | -vos*)
++	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
++	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
++	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ 	# Remember, each alternative MUST END IN *, to match a version number.
+ 		;;
+ 	-qnx*)
+@@ -1079,8 +1179,10 @@
+ 			;;
+ 		esac
+ 		;;
++	-nto-qnx*)
++		;;
+ 	-nto*)
+-		os=-nto-qnx
++		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ 		;;
+ 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ 	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+@@ -1089,6 +1191,9 @@
+ 	-mac*)
+ 		os=`echo $os | sed -e 's|mac|macos|'`
+ 		;;
++	-linux-dietlibc)
++		os=-linux-dietlibc
++		;;
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
+@@ -1101,6 +1206,9 @@
+ 	-opened*)
+ 		os=-openedition
+ 		;;
++        -os400*)
++		os=-os400
++		;;
+ 	-wince*)
+ 		os=-wince
+ 		;;
+@@ -1119,14 +1227,23 @@
+ 	-acis*)
+ 		os=-aos
+ 		;;
++	-atheos*)
++		os=-atheos
++		;;
++	-syllable*)
++		os=-syllable
++		;;
+ 	-386bsd)
+ 		os=-bsd
+ 		;;
+ 	-ctix* | -uts*)
+ 		os=-sysv
+ 		;;
++	-nova*)
++		os=-rtmk-nova
++		;;
+ 	-ns2 )
+-	        os=-nextstep2
++		os=-nextstep2
+ 		;;
+ 	-nsk*)
+ 		os=-nsk
+@@ -1138,6 +1255,9 @@
+ 	-sinix*)
+ 		os=-sysv4
+ 		;;
++        -tpf*)
++		os=-tpf
++		;;
+ 	-triton*)
+ 		os=-sysv3
+ 		;;
+@@ -1165,8 +1285,14 @@
+ 	-xenix)
+ 		os=-xenix
+ 		;;
+-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+-	        os=-mint
++	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
++		os=-mint
++		;;
++	-aros*)
++		os=-aros
++		;;
++	-kaos*)
++		os=-kaos
+ 		;;
+ 	-none)
+ 		;;
+@@ -1199,10 +1325,14 @@
+ 	arm*-semi)
+ 		os=-aout
+ 		;;
++    c4x-* | tic4x-*)
++        os=-coff
++        ;;
++	# This must come before the *-dec entry.
+ 	pdp10-*)
+ 		os=-tops20
+ 		;;
+-        pdp11-*)
++	pdp11-*)
+ 		os=-none
+ 		;;
+ 	*-dec | vax-*)
+@@ -1229,6 +1359,9 @@
+ 	mips*-*)
+ 		os=-elf
+ 		;;
++	or32-*)
++		os=-coff
++		;;
+ 	*-tti)	# must be before sparc entry or we get the wrong os.
+ 		os=-sysv3
+ 		;;
+@@ -1292,19 +1425,19 @@
+ 	*-next)
+ 		os=-nextstep3
+ 		;;
+-        *-gould)
++	*-gould)
+ 		os=-sysv
+ 		;;
+-        *-highlevel)
++	*-highlevel)
+ 		os=-bsd
+ 		;;
+ 	*-encore)
+ 		os=-bsd
+ 		;;
+-        *-sgi)
++	*-sgi)
+ 		os=-irix
+ 		;;
+-        *-siemens)
++	*-siemens)
+ 		os=-sysv4
+ 		;;
+ 	*-masscomp)
+@@ -1373,10 +1506,16 @@
+ 			-mvs* | -opened*)
+ 				vendor=ibm
+ 				;;
++			-os400*)
++				vendor=ibm
++				;;
+ 			-ptx*)
+ 				vendor=sequent
+ 				;;
+-			-vxsim* | -vxworks*)
++			-tpf*)
++				vendor=ibm
++				;;
++			-vxsim* | -vxworks* | -windiss*)
+ 				vendor=wrs
+ 				;;
+ 			-aux*)
Index: patches/gzip-1.3.5-security_fixes-1.patch
===================================================================
--- patches/gzip-1.3.5-security_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/gzip-1.3.5-security_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,63 @@
+Submitted By: Matthew Burgess (matthew at linuxfromscratch dot org)
+Origin: http://security.ubuntu.com/ubuntu/pool/main/g/gzip/gzip_1.3.5-9ubuntu3.1.diff.gz
+Date: 2005-05-12
+Initial package version: 1.3.5
+Description: Fix two security vulnerabilities in gzip: A path traversal
+bug when using the -N option (CAN-2005-1228) and a race condition in the
+file permission restore code (CAN-2005-0998).
+
+diff -Naur gzip-1.3.5.orig/gzip.c gzip-1.3.5/gzip.c
+--- gzip-1.3.5.orig/gzip.c	2002-09-28 07:38:43.000000000 +0000
++++ gzip-1.3.5/gzip.c	2005-05-12 19:15:14.796031360 +0000
+@@ -875,8 +875,11 @@
+     }
+ 
+     close(ifd);
+-    if (!to_stdout && close(ofd)) {
+-	write_error();
++    if (!to_stdout) {
++         /* Copy modes, times, ownership, and remove the input file */
++         copy_stat(&istat);
++         if (close(ofd))
++            write_error();
+     }
+     if (method == -1) {
+ 	if (!to_stdout) xunlink (ofname);
+@@ -896,10 +899,6 @@
+ 	}
+ 	fprintf(stderr, "\n");
+     }
+-    /* Copy modes, times, ownership, and remove the input file */
+-    if (!to_stdout) {
+-	copy_stat(&istat);
+-    }
+ }
+ 
+ /* ========================================================================
+@@ -1324,6 +1323,8 @@
+ 			error("corrupted input -- file name too large");
+ 		    }
+ 		}
++		char *base2 = base_name (base);
++		strcpy(base, base2);
+                 /* If necessary, adapt the name to local OS conventions: */
+                 if (!list) {
+                    MAKE_LEGAL_NAME(base);
+@@ -1725,7 +1726,7 @@
+     reset_times(ofname, ifstat);
+ #endif
+     /* Copy the protection modes */
+-    if (chmod(ofname, ifstat->st_mode & 07777)) {
++    if (fchmod(ofd, ifstat->st_mode & 07777)) {
+ 	int e = errno;
+ 	WARN((stderr, "%s: ", progname));
+ 	if (!quiet) {
+@@ -1734,7 +1735,7 @@
+ 	}
+     }
+ #ifndef NO_CHOWN
+-    chown(ofname, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
++    fchown(ofd, ifstat->st_uid, ifstat->st_gid);  /* Copy ownership */
+ #endif
+     remove_ofname = 0;
+     /* It's now safe to remove the input file: */
Index: patches/inetutils-1.4.2-gcc4_fixes-3.patch
===================================================================
--- patches/inetutils-1.4.2-gcc4_fixes-3.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/inetutils-1.4.2-gcc4_fixes-3.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,37 @@
+Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
+Date: 2005-08-30
+Initial Package Version: 1.4.2
+Upstream Status: From upstream
+Origin: Greg Schafer <gschafer@zip.com.au> (http://www.diy-linux.org/downloads/patches/GCC4/inetutils-1.4.2-gcc4-fixes-1.patch)
+Description: Fix compilation issues with gcc4
+
+diff -Naur inetutils-1.4.2.orig/ftp/ftp_var.h inetutils-1.4.2/ftp/ftp_var.h
+--- inetutils-1.4.2.orig/ftp/ftp_var.h	2000-07-08 01:00:53.000000000 +0000
++++ inetutils-1.4.2/ftp/ftp_var.h	2005-08-30 20:25:27.205932304 +0000
+@@ -36,8 +36,6 @@
+ #include <sys/param.h>
+ #include <setjmp.h>
+ 
+-#include "extern.h"
+-
+ #ifndef FTP_EXTERN
+ #define FTP_EXTERN extern
+ #endif
+@@ -129,3 +127,5 @@
+ FTP_EXTERN int macnum;			/* number of defined macros */
+ FTP_EXTERN struct macel macros[16];
+ FTP_EXTERN char macbuf[4096];
++
++#include "extern.h"
+diff -Naur inetutils-1.4.2.orig/libinetutils/ttymsg.c inetutils-1.4.2/libinetutils/ttymsg.c
+--- inetutils-1.4.2.orig/libinetutils/ttymsg.c	2001-11-01 15:52:19.000000000 +0000
++++ inetutils-1.4.2/libinetutils/ttymsg.c	2005-08-30 20:24:27.168059448 +0000
+@@ -132,7 +132,7 @@
+ 	    }
+ 	  if (wret)
+ 	    {
+-	      (char *)iov->iov_base += wret;
++	      iov->iov_base = (char *)iov->iov_base + wret;
+ 	      iov->iov_len -= wret;
+ 	    }
+ 	  continue;
Index: patches/inetutils-1.4.2-no_server_man_pages-1.patch
===================================================================
--- patches/inetutils-1.4.2-no_server_man_pages-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/inetutils-1.4.2-no_server_man_pages-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,116 @@
+Submitted By: Greg Schafer <gschafer at zip dot com dot au>
+Date: 2003-12-11
+Initial Package Version: 1.4.2
+Origin: Greg Schafer
+Description: Prevent installation of unwanted server man pages.
+
+diff -Naur inetutils-1.4.2.orig/ftpd/Makefile.in inetutils-1.4.2/ftpd/Makefile.in
+--- inetutils-1.4.2.orig/ftpd/Makefile.in	2002-12-23 04:30:12.000000000 +0000
++++ inetutils-1.4.2/ftpd/Makefile.in	2003-12-11 02:21:24.222010104 +0000
+@@ -177,7 +177,6 @@
+ 
+ noinst_HEADERS = extern.h
+ 
+-man_MANS = ftpd.8
+ 
+ INCLUDES = $(PATHDEF_FTPWELCOME) $(PATHDEF_FTPUSERS) \
+            $(PATHDEF_FTPLOGINMESG) $(PATHDEF_FTPCHROOT) $(PATHDEF_FTPDPID) \
+diff -Naur inetutils-1.4.2.orig/inetd/Makefile.in inetutils-1.4.2/inetd/Makefile.in
+--- inetutils-1.4.2.orig/inetd/Makefile.in	2002-12-23 04:30:13.000000000 +0000
++++ inetutils-1.4.2/inetd/Makefile.in	2003-12-11 02:21:24.223009952 +0000
+@@ -172,7 +172,6 @@
+ 
+ inetd_SOURCES = inetd.c
+ 
+-man_MANS = inetd.8
+ 
+ INCLUDES = $(PATHDEF_INETDCONF) $(PATHDEF_INETDDIR) -I$(top_builddir)/include
+ 
+diff -Naur inetutils-1.4.2.orig/logger/Makefile.in inetutils-1.4.2/logger/Makefile.in
+--- inetutils-1.4.2.orig/logger/Makefile.in	2002-12-23 04:30:16.000000000 +0000
++++ inetutils-1.4.2/logger/Makefile.in	2003-12-11 02:21:24.224009800 +0000
+@@ -175,7 +175,6 @@
+ 
+ logger_SOURCES = logger.c
+ 
+-man_MANS = logger.1
+ 
+ EXTRA_DIST = $(man_MANS)
+ subdir = logger
+diff -Naur inetutils-1.4.2.orig/rexecd/Makefile.in inetutils-1.4.2/rexecd/Makefile.in
+--- inetutils-1.4.2.orig/rexecd/Makefile.in	2002-12-23 04:30:17.000000000 +0000
++++ inetutils-1.4.2/rexecd/Makefile.in	2003-12-11 02:21:24.225009648 +0000
+@@ -173,7 +173,6 @@
+ 
+ rexecd_SOURCES = rexecd.c
+ 
+-man_MANS = rexecd.8
+ 
+ INCLUDES = $(PATHDEF_DEFPATH) $(PATHDEF_BSHELL) -I$(top_builddir)/include
+ 
+diff -Naur inetutils-1.4.2.orig/rlogind/Makefile.in inetutils-1.4.2/rlogind/Makefile.in
+--- inetutils-1.4.2.orig/rlogind/Makefile.in	2002-12-23 04:30:18.000000000 +0000
++++ inetutils-1.4.2/rlogind/Makefile.in	2003-12-11 02:21:24.225009648 +0000
+@@ -173,7 +173,6 @@
+ 
+ rlogind_SOURCES = rlogind.c
+ 
+-man_MANS = rlogind.8
+ 
+ INCLUDES = $(PATHDEF_DEV) $(PATHDEF_LOGIN) -I$(top_builddir)/include
+ 
+diff -Naur inetutils-1.4.2.orig/rshd/Makefile.in inetutils-1.4.2/rshd/Makefile.in
+--- inetutils-1.4.2.orig/rshd/Makefile.in	2002-12-23 04:30:19.000000000 +0000
++++ inetutils-1.4.2/rshd/Makefile.in	2003-12-11 02:21:24.226009496 +0000
+@@ -172,7 +172,6 @@
+ 
+ rshd_SOURCES = rshd.c
+ 
+-man_MANS = rshd.8
+ 
+ INCLUDES = $(PATHDEF_BSHELL) $(PATHDEF_NOLOGIN) $(PATHDEF_DEFPATH) -I$(top_builddir)/include
+ 
+diff -Naur inetutils-1.4.2.orig/syslogd/Makefile.in inetutils-1.4.2/syslogd/Makefile.in
+--- inetutils-1.4.2.orig/syslogd/Makefile.in	2002-12-23 04:30:19.000000000 +0000
++++ inetutils-1.4.2/syslogd/Makefile.in	2003-12-11 02:21:24.226009496 +0000
+@@ -172,7 +172,6 @@
+ 
+ syslogd_SOURCES = syslogd.c
+ 
+-man_MANS = syslog.conf.5 syslogd.8
+ 
+ INCLUDES = $(PATHDEF_LOG) $(PATHDEF_LOGCONF) $(PATHDEF_LOGPID) \
+ 	$(PATHDEF_CONSOLE) -I$(top_builddir)/include
+diff -Naur inetutils-1.4.2.orig/talkd/Makefile.in inetutils-1.4.2/talkd/Makefile.in
+--- inetutils-1.4.2.orig/talkd/Makefile.in	2002-12-23 04:30:20.000000000 +0000
++++ inetutils-1.4.2/talkd/Makefile.in	2003-12-11 02:21:24.227009344 +0000
+@@ -180,7 +180,6 @@
+  intalkd.h
+ 
+ 
+-man_MANS = talkd.8
+ 
+ INCLUDES = $(PATHDEF_DEV) -I${top_srcdir}/libinetutils -I$(top_builddir)/include
+ 
+diff -Naur inetutils-1.4.2.orig/telnetd/Makefile.in inetutils-1.4.2/telnetd/Makefile.in
+--- inetutils-1.4.2.orig/telnetd/Makefile.in	2002-12-23 04:30:21.000000000 +0000
++++ inetutils-1.4.2/telnetd/Makefile.in	2003-12-11 02:21:24.228009192 +0000
+@@ -176,7 +176,6 @@
+ 
+ noinst_HEADERS = telnetd.h
+ 
+-man_MANS = telnetd.8
+ 
+ INCLUDES = $(PATHDEF_DEV) $(PATHDEF_TTY) $(PATHDEF_LOGIN) -I$(top_builddir)/include \
+  -I$(top_srcdir) @INCAUTH@
+diff -Naur inetutils-1.4.2.orig/tftpd/Makefile.in inetutils-1.4.2/tftpd/Makefile.in
+--- inetutils-1.4.2.orig/tftpd/Makefile.in	2002-12-23 04:30:22.000000000 +0000
++++ inetutils-1.4.2/tftpd/Makefile.in	2003-12-11 02:21:24.229009040 +0000
+@@ -174,7 +174,6 @@
+ 
+ tftpd_SOURCES = tftpd.c
+ 
+-man_MANS = tftpd.8
+ 
+ LDADD = -L../libinetutils -linetutils
+ 
Index: patches/kbd-1.12-gcc4_fixes-1.patch
===================================================================
--- patches/kbd-1.12-gcc4_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/kbd-1.12-gcc4_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,54 @@
+Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
+Date: 2005-07-28
+Initial Package Version: 1.12
+Upstream Status: Unknown
+Origin: http://cvs.fedora.redhat.com/viewcvs/devel/kbd/kbd-1.12-alias.patch?rev=1.2&view=markup
+Description: Fix violations of C aliasing rules, triggered by gcc4.
+
+diff -Naur kbd-1.12.orig/src/psffontop.c kbd-1.12/src/psffontop.c
+--- kbd-1.12.orig/src/psffontop.c	2004-01-16 19:45:31.000000000 +0000
++++ kbd-1.12/src/psffontop.c	2005-07-28 20:33:57.946088984 +0000
+@@ -59,7 +59,6 @@
+ 
+ static unsigned int
+ assemble_ucs2(char **inptr, int cnt) {
+-	unsigned char **in = (unsigned char **) inptr;
+ 	unsigned int u1, u2;
+ 
+ 	if (cnt < 2) {
+@@ -68,8 +67,8 @@
+ 		exit(EX_DATAERR);
+ 	}
+ 
+-	u1 = *(*in)++;
+-	u2 = *(*in)++;
++	u1 = (unsigned char)*(*inptr)++;
++	u2 = (unsigned char)*(*inptr)++;
+ 	return (u1 | (u2 << 8));
+ }
+ 
+@@ -110,7 +109,6 @@
+  */
+ static void
+ get_uni_entry(char **inptr, char **endptr, struct unicode_list *up, int utf8) {
+-	unsigned char **in = (unsigned char **) inptr;
+ 	unsigned char uc;
+ 	unicode unichar;
+ 	int inseq = 0;
+@@ -126,14 +124,14 @@
+ 			exit(EX_DATAERR);
+ 		}
+ 		if (utf8) {
+-			uc = *(*in)++;
++			uc = *(*inptr)++;
+ 			if (uc == PSF2_SEPARATOR)
+ 				break;
+ 			if (uc == PSF2_STARTSEQ) {
+ 				inseq = 1;
+ 				continue;
+ 			}
+-			--(*in);
++			--(*inptr);
+ 			unichar = assemble_utf8(inptr, *endptr - *inptr);
+ 		} else {
+ 			unichar = assemble_ucs2(inptr, *endptr - *inptr);
Index: patches/kbd-1.12-sparc_kbdrate-1.patch
===================================================================
--- patches/kbd-1.12-sparc_kbdrate-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/kbd-1.12-sparc_kbdrate-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,33 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-07-01
+Initial Package Version: 1.12
+Origin: Gentoo CVS
+Upstream Status: Unknown
+Description: Sparc have not yet fixed struct kbd_rate to use 'period' and not 'rate'
+ 
+diff -Naur kbd-1.12.orig/src/kbdrate.c kbd-1.12/src/kbdrate.c
+--- kbd-1.12.orig/src/kbdrate.c	2004-01-16 19:45:31.000000000 +0000
++++ kbd-1.12/src/kbdrate.c	2005-07-02 06:52:54.000000000 +0000
+@@ -164,10 +164,10 @@
+ 		exit( 1 );
+ 	}
+ 
+-	kbdrate_s.period = (int) (rate + 0.5);  /* round up */
++	kbdrate_s.rate = (int) (rate + 0.5);  /* round up */
+ 	kbdrate_s.delay = delay * HZ / 1000;  /* convert ms to Hz */
+-	if (kbdrate_s.period > 50)
+-		kbdrate_s.period = 50;
++	if (kbdrate_s.rate > 50)
++		kbdrate_s.rate = 50;
+ 
+ 	if (ioctl( fd, KIOCSRATE, &kbdrate_s )) {
+ 		perror( "ioctl(KIOCSRATE)" );
+@@ -177,7 +177,7 @@
+ 
+ 	if (!silent)
+ 		printf( "Typematic Rate set to %d cps (delay = %d ms)\n",
+-			kbdrate_s.period, kbdrate_s.delay * 1000 / HZ );
++			kbdrate_s.rate, kbdrate_s.delay * 1000 / HZ );
+ 
+ 	return 1;
+ #else /* no KIOCSRATE */
Index: patches/lilo-22.7.1-cross_compile_x86_64-1.patch
===================================================================
--- patches/lilo-22.7.1-cross_compile_x86_64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/lilo-22.7.1-cross_compile_x86_64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,38 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2006-03-11
+Initial Package Version: 22.7.1
+Upstream Status: Not submitted, purely for cross-compiling for x86_64(-64)
+Origin: Self
+Description: Allows lilo-static to be built with a cross-compiler (plus
+ cross as86, ld86).   
+
+diff -Naur lilo-22.7.1-vanilla/Makefile lilo-22.7.1/Makefile
+--- lilo-22.7.1-vanilla/Makefile	2005-09-17 22:36:25.000000000 +0100
++++ lilo-22.7.1/Makefile	2006-03-11 18:35:13.000000000 +0000
+@@ -94,10 +94,10 @@
+ 
+ 
+ SHELL=/bin/sh
+-CC=gcc
++#CC=gcc
+ CPP=$(CC) -E
+-AS86=as86 -0 -a
+-LD86=ld86 -0
++AS86=x86_64-unknown-linux-gnu-as86 -0 -a
++LD86=x86_64-unknown-linux-gnu-ld86 -0
+ NASM=nasm
+ 
+ CFLAGS=$(OPT) -Wall -g $(PCONFIG)
+@@ -424,10 +424,10 @@
+ 		mv tmp_make Makefile
+ 
+ version:	common.c lilo.h common.h
+-		$(CC) $(CFLAGS) -DSHS_MAIN -o version common.c
++		gcc $(CFLAGS) -DSHS_MAIN -o version common.c
+ 
+ mkloader:	temp.c
+-		$(CC) $(CFLAGS) -DLILO_BINARY -o mkloader temp.c
++		gcc $(CFLAGS) -DLILO_BINARY -o mkloader temp.c
+ 
+ tidy:
+ 		rm -f core $(LIS) *.shs *.crc $(TMP)*
Index: patches/linux-2.6.16.1-mips-1.patch
===================================================================
--- patches/linux-2.6.16.1-mips-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-2.6.16.1-mips-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,31572 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2006-03-20
+Initial Package Version: 2.6.16
+Origin: Linux-MIPS GIT and Mailling Lists
+Upstream Status: N/A
+Description: Merges Linux-MIPS and Kernel.org Tree's
+ 
+diff -Naur linux-2.6.16.orig/Makefile linux-2.6.16/Makefile
+--- linux-2.6.16.orig/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/Makefile	2006-03-21 01:05:48.000000000 +0000
+@@ -151,7 +151,7 @@
+ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+ 				  -e s/arm.*/arm/ -e s/sa110/arm/ \
+ 				  -e s/s390x/s390/ -e s/parisc64/parisc/ \
+-				  -e s/ppc.*/powerpc/ )
++ 				  -e s/mips64/mips/ -e s/ppc.*/powerpc/ )
+ 
+ # Cross compiling and selecting different set of gcc/bin-utils
+ # ---------------------------------------------------------------------------
+diff -Naur linux-2.6.16.orig/arch/mips/Kconfig linux-2.6.16/arch/mips/Kconfig
+--- linux-2.6.16.orig/arch/mips/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/Kconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -503,10 +503,7 @@
+ 	  ether port USB, AC97, PCI, etc.
+ 
+ config MACH_VR41XX
+-	bool "Support for NEC VR4100 series based machines"
+-	select SYS_HAS_CPU_VR41XX
+-	select SYS_SUPPORTS_32BIT_KERNEL
+-	select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
++	bool "Support for NEC VR41XX-based machines"
+ 
+ config PMC_YOSEMITE
+ 	bool "Support for PMC-Sierra Yosemite eval board"
+@@ -602,7 +599,7 @@
+ 	  If you want this kernel to run on SGI O2 workstation, say Y here.
+ 
+ config SIBYTE_BIGSUR
+-	bool "Support for Sibyte BigSur"
++	bool "Support for Sibyte BCM91480B-BigSur"
+ 	select BOOT_ELF32
+ 	select DMA_COHERENT
+ 	select PCI_DOMAINS
+@@ -790,6 +787,7 @@
+ source "arch/mips/tx4938/Kconfig"
+ source "arch/mips/vr41xx/Kconfig"
+ source "arch/mips/philips/pnx8550/common/Kconfig"
++source "arch/mips/cobalt/Kconfig"
+ 
+ endmenu
+ 
+@@ -1019,6 +1017,9 @@
+ config HAVE_STD_PC_SERIAL_PORT
+ 	bool
+ 
++config VR4181
++	bool
++
+ config ARC_CONSOLE
+ 	bool "ARC console support"
+ 	depends on SGI_IP22 || SNI_RM200_PCI
+@@ -1134,7 +1135,7 @@
+ 	select CPU_SUPPORTS_32BIT_KERNEL
+ 	select CPU_SUPPORTS_64BIT_KERNEL
+ 	help
+-	  The options selects support for the NEC VR4100 series of processors.
++	  The options selects support for the NEC VR41xx series of processors.
+ 	  Only choose this option if you have one of these processors as a
+ 	  kernel built with this option will not run on any other type of
+ 	  processor or vice versa.
+@@ -1159,6 +1160,7 @@
+ config CPU_TX49XX
+ 	bool "R49XX"
+ 	depends on SYS_HAS_CPU_TX49XX
++	select CPU_HAS_PREFETCH
+ 	select CPU_SUPPORTS_32BIT_KERNEL
+ 	select CPU_SUPPORTS_64BIT_KERNEL
+ 
+@@ -1581,7 +1583,7 @@
+ 
+ config SMP
+ 	bool "Multi-Processing support"
+-	depends on CPU_RM9000 || ((SIBYTE_BCM1x80 || SIBYTE_BCM1x55 || SIBYTE_SB1250) && !SIBYTE_STANDALONE) || SGI_IP27 || MIPS_MT_SMP
++	depends on CPU_RM9000 || ((SIBYTE_BCM1x80 || SIBYTE_BCM1x55 || SIBYTE_SB1250 || QEMU) && !SIBYTE_STANDALONE) || SGI_IP27 || MIPS_MT_SMP
+ 	---help---
+ 	  This enables support for systems with more than one CPU. If you have
+ 	  a system with only one CPU, like most personal computers, say N. If
+diff -Naur linux-2.6.16.orig/arch/mips/Makefile linux-2.6.16/arch/mips/Makefile
+--- linux-2.6.16.orig/arch/mips/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/Makefile	2006-03-21 01:05:47.000000000 +0000
+@@ -12,10 +12,6 @@
+ # for "archclean" cleaning up for this architecture.
+ #
+ 
+-as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
+-	     -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
+-	     else echo "$(2)"; fi ;)
+-
+ cflags-y :=
+ 
+ #
+@@ -38,12 +34,10 @@
+ endif
+ 
+ ifdef CONFIG_32BIT
+-gcc-abi			= 32
+ tool-prefix		= $(32bit-tool-prefix)
+ UTS_MACHINE		:= mips
+ endif
+ ifdef CONFIG_64BIT
+-gcc-abi			= 64
+ tool-prefix		= $(64bit-tool-prefix)
+ UTS_MACHINE		:= mips64
+ endif
+@@ -52,38 +46,28 @@
+ CROSS_COMPILE		:= $(tool-prefix)
+ endif
+ 
+-CHECKFLAGS-y				+= -D__linux__ -D__mips__ \
+-					   -D_MIPS_SZINT=32 \
+-					   -D_ABIO32=1 \
+-					   -D_ABIN32=2 \
+-					   -D_ABI64=3
+-CHECKFLAGS-$(CONFIG_32BIT)		+= -D_MIPS_SIM=_ABIO32 \
+-					   -D_MIPS_SZLONG=32 \
+-					   -D_MIPS_SZPTR=32 \
+-					   -D__PTRDIFF_TYPE__=int
+-CHECKFLAGS-$(CONFIG_64BIT)		+= -m64 -D_MIPS_SIM=_ABI64 \
+-					   -D_MIPS_SZLONG=64 \
+-					   -D_MIPS_SZPTR=64 \
+-					   -D__PTRDIFF_TYPE__="long int"
+-CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN)	+= -D__MIPSEB__
+-CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -D__MIPSEL__
++ifdef CONFIG_32BIT
++ld-emul			= $(32bit-emul)
++vmlinux-32		= vmlinux
++vmlinux-64		= vmlinux.64
+ 
+-CHECKFLAGS				= $(CHECKFLAGS-y)
++cflags-y		+= -mabi=32
++endif
+ 
+-ifdef CONFIG_BUILD_ELF64
+-gas-abi			= 64
++ifdef CONFIG_64BIT
+ ld-emul			= $(64bit-emul)
+ vmlinux-32		= vmlinux.32
+ vmlinux-64		= vmlinux
+-else
+-gas-abi			= 32
+-ld-emul			= $(32bit-emul)
+-vmlinux-32		= vmlinux
+-vmlinux-64		= vmlinux.64
+ 
+-cflags-$(CONFIG_64BIT)	+= $(call cc-option,-mno-explicit-relocs)
++cflags-y		+= -mabi=64
++ifdef CONFIG_BUILD_ELF64
++cflags-y		+= $(call cc-option,-mno-explicit-relocs)
++else
++cflags-y		+= $(call cc-option,-msym32)
++endif
+ endif
+ 
++
+ #
+ # GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
+ # code since it only slows down the whole thing.  At some point we might make
+@@ -105,162 +89,44 @@
+ # carefully avoid to add it redundantly because gcc 3.3/3.4 complains
+ # when fed the toolchain default!
+ #
+-cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB)
+-cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL)
++cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB -D__MIPSEB__)
++cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL -D__MIPSEL__)
+ 
+ cflags-$(CONFIG_SB1XXX_CORELIS)	+= $(call cc-option,-mno-sched-prolog) \
+ 				   -fno-omit-frame-pointer
+ 
+ #
+-# Use: $(call set_gccflags,<cpu0>,<isa0>,<cpu1>,<isa1>,<isa2>)
+-#
+-# <cpu0>,<isa0> -- preferred CPU and ISA designations (may require
+-#                  recent tools)
+-# <cpu1>,<isa1> -- fallback CPU and ISA designations (have to work
+-#                  with up to the oldest supported tools)
+-# <isa2>        -- an ISA designation used as an ABI selector for
+-#                  gcc versions that do not support "-mabi=32"
+-#                  (depending on the CPU type, either "mips1" or
+-#                  "mips2")
+-#
+-set_gccflags = $(shell \
+-while :; do \
+-	cpu=$(1); isa=-$(2); \
+-	for gcc_opt in -march= -mcpu=; do \
+-		$(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
+-			-xc /dev/null > /dev/null 2>&1 && \
+-			break 2; \
+-	done; \
+-	cpu=$(3); isa=-$(4); \
+-	for gcc_opt in -march= -mcpu=; do \
+-		$(CC) $$gcc_opt$$cpu $$isa -S -o /dev/null \
+-			-xc /dev/null > /dev/null 2>&1 && \
+-			break 2; \
+-	done; \
+-	break; \
+-done; \
+-gcc_abi=-mabi=$(gcc-abi); gcc_cpu=$$cpu; \
+-if $(CC) $$gcc_abi -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then \
+-	gcc_isa=$$isa; \
+-else \
+-	gcc_abi=; gcc_isa=-$(5); \
+-fi; \
+-gas_abi=-Wa,-$(gcc-abi); gas_cpu=$$cpu; gas_isa=-Wa,$$isa; \
+-while :; do \
+-	for gas_opt in -Wa,-march= -Wa,-mcpu=; do \
+-		$(CC) $$gas_abi $$gas_opt$$cpu $$gas_isa -Wa,-Z -c \
+-			-o /dev/null -xassembler /dev/null > /dev/null 2>&1 && \
+-			break 2; \
+-	done; \
+-	gas_abi=; gas_opt=; gas_cpu=; gas_isa=; \
+-	break; \
+-done; \
+-if test "$(gcc-abi)" != "$(gas-abi)"; then \
+-	gas_abi="-Wa,-$(gas-abi) -Wa,-mgp$(gcc-abi)"; \
+-fi; \
+-if test "$$gcc_opt" = -march= && test -n "$$gcc_abi"; then \
+-	$(CC) $$gcc_abi $$gcc_opt$$gcc_cpu -S -o /dev/null \
+-		-xc /dev/null > /dev/null 2>&1 && \
+-		gcc_isa=; \
+-fi; \
+-echo $$gcc_abi $$gcc_opt$$gcc_cpu $$gcc_isa $$gas_abi $$gas_opt$$gas_cpu $$gas_isa)
+-
+-#
+ # CPU-dependent compiler/assembler options for optimization.
+ #
+-cflags-$(CONFIG_CPU_R3000)	+= \
+-			$(call set_gccflags,r3000,mips1,r3000,mips1,mips1)
+-CHECKFLAGS-$(CONFIG_CPU_R3000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS1
+-
+-cflags-$(CONFIG_CPU_TX39XX)	+= \
+-			$(call set_gccflags,r3900,mips1,r3000,mips1,mips1)
+-CHECKFLAGS-$(CONFIG_CPU_TX39XX)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS1
+-
+-cflags-$(CONFIG_CPU_R6000)	+= \
+-			$(call set_gccflags,r6000,mips2,r6000,mips2,mips2) \
++cflags-$(CONFIG_CPU_R3000)	+= -march=r3000
++cflags-$(CONFIG_CPU_TX39XX)	+= -march=r3900
++cflags-$(CONFIG_CPU_R6000)	+= -march=r6000 -Wa,--trap
++cflags-$(CONFIG_CPU_R4300)	+= -march=r4300 -Wa,--trap
++cflags-$(CONFIG_CPU_VR41XX)	+= -march=r4100 -Wa,--trap
++cflags-$(CONFIG_CPU_R4X00)	+= -march=r4600 -Wa,--trap
++cflags-$(CONFIG_CPU_TX49XX)	+= -march=r4600 -Wa,--trap
++cflags-$(CONFIG_CPU_MIPS32_R1)	+= $(call cc-option,-march=mips32,-mips2 -mtune=r4600) \
++			-Wa,-mips32 -Wa,--trap
++cflags-$(CONFIG_CPU_MIPS32_R2)	+= $(call cc-option,-march=mips32r2,-mips2 -mtune=r4600) \
++			-Wa,-mips32r2 -Wa,--trap
++cflags-$(CONFIG_CPU_MIPS64_R1)	+= $(call cc-option,-march=mips64,-mips2 -mtune=r4600) \
++			-Wa,-mips64 -Wa,--trap
++cflags-$(CONFIG_CPU_MIPS64_R2)	+= $(call cc-option,-march=mips64r2,-mips2 -mtune=r4600 ) \
++			-Wa,-mips64r2 -Wa,--trap
++cflags-$(CONFIG_CPU_R5000)	+= -march=r5000 -Wa,--trap
++cflags-$(CONFIG_CPU_R5432)	+= $(call cc-options,-march=r5400,-march=r5000) \
++			-Wa,--trap
++cflags-$(CONFIG_CPU_NEVADA)	+= $(call cc-options,-march=rm5200,-march=r5000) \
+ 			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R6000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS2
+-
+-cflags-$(CONFIG_CPU_R4300)	+= \
+-			$(call set_gccflags,r4300,mips3,r4300,mips3,mips2) \
++cflags-$(CONFIG_CPU_RM7000)	+= $(call cc-option,-march=rm7000,-march=r5000) \
+ 			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R4300)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS3
+-
+-cflags-$(CONFIG_CPU_VR41XX)	+= \
+-			$(call set_gccflags,r4100,mips3,r4600,mips3,mips2) \
++cflags-$(CONFIG_CPU_RM9000)	+= $(call cc-option,-march=rm9000,-march=r5000) \
+ 			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_VR41XX)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS3
+-
+-cflags-$(CONFIG_CPU_R4X00)	+= \
+-			$(call set_gccflags,r4600,mips3,r4600,mips3,mips2) \
++cflags-$(CONFIG_CPU_SB1)	+= $(call cc-option,-march=sb1,-march=r5000) \
+ 			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R4X00)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS3
+-
+-cflags-$(CONFIG_CPU_TX49XX)	+= \
+-			$(call set_gccflags,r4600,mips3,r4600,mips3,mips2)  \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_TX49XX)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS3
+-
+-cflags-$(CONFIG_CPU_MIPS32_R1)	+= \
+-			$(call set_gccflags,mips32,mips32,r4600,mips3,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_MIPS32_R1)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS32
+-
+-cflags-$(CONFIG_CPU_MIPS32_R2)	+= \
+-			$(call set_gccflags,mips32r2,mips32r2,r4600,mips3,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_MIPS32_R2)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS32
+-
+-cflags-$(CONFIG_CPU_MIPS64_R1)	+= \
+-			$(call set_gccflags,mips64,mips64,r4600,mips3,mips2) \
++cflags-$(CONFIG_CPU_R8000)	+= -march=r8000 -Wa,--trap
++cflags-$(CONFIG_CPU_R10000)	+= $(call cc-option,-march=r10000,-march=r8000) \
+ 			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_MIPS64_R1)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS64
+-
+-cflags-$(CONFIG_CPU_MIPS64_R2)	+= \
+-			$(call set_gccflags,mips64r2,mips64r2,r4600,mips3,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_MIPS64_R2)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS64
+-
+-cflags-$(CONFIG_CPU_R5000)	+= \
+-			$(call set_gccflags,r5000,mips4,r5000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R5000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+-
+-cflags-$(CONFIG_CPU_R5432)	+= \
+-			$(call set_gccflags,r5400,mips4,r5000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R5432)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+-
+-cflags-$(CONFIG_CPU_NEVADA)	+= \
+-			$(call set_gccflags,rm5200,mips4,r5000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_NEVADA)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+-
+-cflags-$(CONFIG_CPU_RM7000)	+= \
+-			$(call set_gccflags,rm7000,mips4,r5000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_RM7000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+-
+-cflags-$(CONFIG_CPU_RM9000)	+= \
+-			$(call set_gccflags,rm9000,mips4,r5000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_RM9000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+-
+-
+-cflags-$(CONFIG_CPU_SB1)	+= \
+-			$(call set_gccflags,sb1,mips64,r5000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_SB1)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS64
+-
+-cflags-$(CONFIG_CPU_R8000)	+= \
+-			$(call set_gccflags,r8000,mips4,r8000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R8000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+-
+-cflags-$(CONFIG_CPU_R10000)	+= \
+-			$(call set_gccflags,r10000,mips4,r8000,mips4,mips2) \
+-			-Wa,--trap
+-CHECKFLAGS-$(CONFIG_CPU_R10000)	+= -D_MIPS_ISA=_MIPS_ISA_MIPS4
+ 
+ ifdef CONFIG_CPU_SB1
+ ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
+@@ -499,6 +365,7 @@
+ cflags-$(CONFIG_PMC_YOSEMITE)	+= -Iinclude/asm-mips/mach-yosemite
+ load-$(CONFIG_PMC_YOSEMITE)	+= 0xffffffff80100000
+ 
++#
+ # Qemu simulating MIPS32 4Kc
+ #
+ core-$(CONFIG_QEMU)		+= arch/mips/qemu/
+@@ -585,7 +452,7 @@
+ load-$(CONFIG_CASIO_E55)	+= 0xffffffff80004000
+ 
+ #
+-# TANBAC VR4131 multichip module(TB0225) and TANBAC VR4131DIMM(TB0229) (VR4131)
++# TANBAC TB0225 VR4131 Multi-chip module/TB0229 VR4131DIMM (VR4131)
+ #
+ load-$(CONFIG_TANBAC_TB022X)	+= 0xffffffff80000000
+ 
+@@ -630,7 +497,6 @@
+ ifdef CONFIG_SGI_IP27
+ core-$(CONFIG_SGI_IP27)		+= arch/mips/sgi-ip27/
+ cflags-$(CONFIG_SGI_IP27)	+= -Iinclude/asm-mips/mach-ip27
+-ifdef CONFIG_BUILD_ELF64
+ ifdef CONFIG_MAPPED_KERNEL
+ load-$(CONFIG_SGI_IP27)		+= 0xc00000004001c000
+ OBJCOPYFLAGS			:= --change-addresses=0x3fffffff80000000
+@@ -639,16 +505,6 @@
+ load-$(CONFIG_SGI_IP27)		+= 0xa80000000001c000
+ OBJCOPYFLAGS			:= --change-addresses=0x57ffffff80000000
+ endif
+-else
+-ifdef CONFIG_MAPPED_KERNEL
+-load-$(CONFIG_SGI_IP27)		+= 0xffffffffc001c000
+-OBJCOPYFLAGS			:= --change-addresses=0xc000000080000000
+-dataoffset-$(CONFIG_SGI_IP27)	+= 0x01000000
+-else
+-load-$(CONFIG_SGI_IP27)		+= 0xffffffff8001c000
+-OBJCOPYFLAGS			:= --change-addresses=0xa800000080000000
+-endif
+-endif
+ endif
+ 
+ #
+@@ -757,6 +613,12 @@
+ 
+ LDFLAGS			+= -m $(ld-emul)
+ 
++ifdef CONFIG_MIPS
++CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \
++	egrep -vw '__GNUC_(MAJOR|MINOR|PATCHLEVEL)__' | \
++	sed -e 's/^\#define /-D/' -e 's/ /="/' -e 's/$$/"/')
++endif
++
+ OBJCOPYFLAGS		+= --remove-section=.reginfo
+ 
+ #
+diff -Naur linux-2.6.16.orig/arch/mips/au1000/common/setup.c linux-2.6.16/arch/mips/au1000/common/setup.c
+--- linux-2.6.16.orig/arch/mips/au1000/common/setup.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/au1000/common/setup.c	2006-03-21 01:05:46.000000000 +0000
+@@ -90,11 +90,11 @@
+ 	else {
+ 		/* Clear to obtain best system bus performance */
+ 		clear_c0_config(1<<19); /* Clear Config[OD] */
+- 	}
++	}
+ 
+ 	argptr = prom_getcmdline();
+ 
+-#if defined(CONFIG_SERIAL_AU1X00_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE)
++#ifdef CONFIG_SERIAL_8250_CONSOLE
+ 	if ((argptr = strstr(argptr, "console=")) == NULL) {
+ 		argptr = prom_getcmdline();
+ 		strcat(argptr, " console=ttyS0,115200");
+diff -Naur linux-2.6.16.orig/arch/mips/cobalt/Kconfig linux-2.6.16/arch/mips/cobalt/Kconfig
+--- linux-2.6.16.orig/arch/mips/cobalt/Kconfig	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/arch/mips/cobalt/Kconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -0,0 +1,7 @@
++config EARLY_PRINTK
++	bool "Early console support"
++	depends on MIPS_COBALT
++	help
++	  Provide early console support by direct access to the
++	  on board UART. The UART must have been previously
++	  initialised by the boot loader.
+diff -Naur linux-2.6.16.orig/arch/mips/cobalt/Makefile linux-2.6.16/arch/mips/cobalt/Makefile
+--- linux-2.6.16.orig/arch/mips/cobalt/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/cobalt/Makefile	2006-03-21 01:05:46.000000000 +0000
+@@ -4,4 +4,6 @@
+ 
+ obj-y	 := irq.o int-handler.o reset.o setup.o
+ 
++obj-$(CONFIG_EARLY_PRINTK)	+= console.o
++
+ EXTRA_AFLAGS := $(CFLAGS)
+diff -Naur linux-2.6.16.orig/arch/mips/cobalt/console.c linux-2.6.16/arch/mips/cobalt/console.c
+--- linux-2.6.16.orig/arch/mips/cobalt/console.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/arch/mips/cobalt/console.c	2006-03-21 01:05:46.000000000 +0000
+@@ -0,0 +1,43 @@
++/*
++ * (C) P. Horton 2006
++ */
++
++#include <linux/config.h>
++#include <linux/init.h>
++#include <linux/kernel.h>
++#include <linux/console.h>
++#include <linux/serial_reg.h>
++#include <asm/addrspace.h>
++#include <asm/mach-cobalt/cobalt.h>
++
++static void putchar(int c)
++{
++	if(c == '\n')
++		putchar('\r');
++
++	while(!(COBALT_UART[UART_LSR] & UART_LSR_THRE))
++		;
++
++	COBALT_UART[UART_TX] = c;
++}
++
++static void cons_write(struct console *c, const char *s, unsigned n)
++{
++	while(n-- && *s)
++		putchar(*s++);
++}
++
++static struct console cons_info =
++{
++	.name	= "uart",
++	.write	= cons_write,
++	.flags	= CON_PRINTBUFFER | CON_BOOT,
++	.index	= -1,
++};
++
++void __init cobalt_early_console(void)
++{
++	register_console(&cons_info);
++
++	printk("Cobalt: early console registered\n");
++}
+diff -Naur linux-2.6.16.orig/arch/mips/cobalt/setup.c linux-2.6.16/arch/mips/cobalt/setup.c
+--- linux-2.6.16.orig/arch/mips/cobalt/setup.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/cobalt/setup.c	2006-03-21 01:05:46.000000000 +0000
+@@ -31,6 +31,7 @@
+ extern void cobalt_machine_restart(char *command);
+ extern void cobalt_machine_halt(void);
+ extern void cobalt_machine_power_off(void);
++extern void cobalt_early_console(void);
+ 
+ int cobalt_board_id;
+ 
+@@ -109,14 +110,6 @@
+ 	/* I/O port resource must include UART and LCD/buttons */
+ 	ioport_resource.end = 0x0fffffff;
+ 
+-	/*
+-	 * This is a prom style console. We just poke at the
+-	 *  UART to make it talk.
+-	 * Only use this console if you really screw up and can't
+-	 *  get to the stage of setting up a real serial console.
+-	 */
+-	/*ns16550_setup_console();*/
+-
+ 	/* request I/O space for devices used on all i[345]86 PCs */
+ 	for (i = 0; i < COBALT_IO_RESOURCES; i++)
+ 		request_resource(&ioport_resource, cobalt_io_resources + i);
+@@ -136,6 +129,10 @@
+ #ifdef CONFIG_SERIAL_8250
+ 	if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
+ 
++#ifdef CONFIG_EARLY_PRINTK
++		cobalt_early_console();
++#endif
++
+ 		uart.line	= 0;
+ 		uart.type	= PORT_UNKNOWN;
+ 		uart.uartclk	= 18432000;
+diff -Naur linux-2.6.16.orig/arch/mips/configs/atlas_defconfig linux-2.6.16/arch/mips/configs/atlas_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/atlas_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/atlas_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:05:52 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:52 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -164,26 +164,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -335,6 +337,29 @@
+ CONFIG_NETFILTER_NETLINK=m
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_HELPER=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STATE=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -353,47 +378,30 @@
+ CONFIG_IP_NF_PPTP=m
+ CONFIG_IP_NF_QUEUE=m
+ CONFIG_IP_NF_IPTABLES=m
+-CONFIG_IP_NF_MATCH_LIMIT=m
+ CONFIG_IP_NF_MATCH_IPRANGE=m
+-CONFIG_IP_NF_MATCH_MAC=m
+-CONFIG_IP_NF_MATCH_PKTTYPE=m
+-CONFIG_IP_NF_MATCH_MARK=m
+ CONFIG_IP_NF_MATCH_MULTIPORT=m
+ CONFIG_IP_NF_MATCH_TOS=m
+ CONFIG_IP_NF_MATCH_RECENT=m
+ CONFIG_IP_NF_MATCH_ECN=m
+ CONFIG_IP_NF_MATCH_DSCP=m
+ CONFIG_IP_NF_MATCH_AH_ESP=m
+-CONFIG_IP_NF_MATCH_LENGTH=m
+ CONFIG_IP_NF_MATCH_TTL=m
+-CONFIG_IP_NF_MATCH_TCPMSS=m
+-CONFIG_IP_NF_MATCH_HELPER=m
+-CONFIG_IP_NF_MATCH_STATE=m
+-CONFIG_IP_NF_MATCH_CONNTRACK=m
+ CONFIG_IP_NF_MATCH_OWNER=m
+-CONFIG_IP_NF_MATCH_PHYSDEV=m
+ CONFIG_IP_NF_MATCH_ADDRTYPE=m
+-CONFIG_IP_NF_MATCH_REALM=m
+-CONFIG_IP_NF_MATCH_SCTP=m
+-CONFIG_IP_NF_MATCH_DCCP=m
+-CONFIG_IP_NF_MATCH_COMMENT=m
+-CONFIG_IP_NF_MATCH_CONNMARK=m
+-CONFIG_IP_NF_MATCH_CONNBYTES=m
+ CONFIG_IP_NF_MATCH_HASHLIMIT=m
+-CONFIG_IP_NF_MATCH_STRING=m
++CONFIG_IP_NF_MATCH_POLICY=m
+ CONFIG_IP_NF_FILTER=m
+ CONFIG_IP_NF_TARGET_REJECT=m
+ CONFIG_IP_NF_TARGET_LOG=m
+ CONFIG_IP_NF_TARGET_ULOG=m
+ CONFIG_IP_NF_TARGET_TCPMSS=m
+-CONFIG_IP_NF_TARGET_NFQUEUE=m
+ CONFIG_IP_NF_NAT=m
+ CONFIG_IP_NF_NAT_NEEDED=y
+ CONFIG_IP_NF_TARGET_MASQUERADE=m
+ CONFIG_IP_NF_TARGET_REDIRECT=m
+ CONFIG_IP_NF_TARGET_NETMAP=m
+ CONFIG_IP_NF_TARGET_SAME=m
+-CONFIG_IP_NF_NAT_SNMP_BASIC=m
++# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
+ CONFIG_IP_NF_NAT_IRC=m
+ CONFIG_IP_NF_NAT_FTP=m
+ CONFIG_IP_NF_NAT_TFTP=m
+@@ -403,13 +411,9 @@
+ CONFIG_IP_NF_TARGET_TOS=m
+ CONFIG_IP_NF_TARGET_ECN=m
+ CONFIG_IP_NF_TARGET_DSCP=m
+-CONFIG_IP_NF_TARGET_MARK=m
+-CONFIG_IP_NF_TARGET_CLASSIFY=m
+ CONFIG_IP_NF_TARGET_TTL=m
+-CONFIG_IP_NF_TARGET_CONNMARK=m
+-CONFIG_IP_NF_TARGET_CLUSTERIP=m
++# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
+ CONFIG_IP_NF_RAW=m
+-CONFIG_IP_NF_TARGET_NOTRACK=m
+ CONFIG_IP_NF_ARPTABLES=m
+ CONFIG_IP_NF_ARPFILTER=m
+ CONFIG_IP_NF_ARP_MANGLE=m
+@@ -419,26 +423,20 @@
+ #
+ CONFIG_IP6_NF_QUEUE=m
+ CONFIG_IP6_NF_IPTABLES=m
+-CONFIG_IP6_NF_MATCH_LIMIT=m
+-CONFIG_IP6_NF_MATCH_MAC=m
+ CONFIG_IP6_NF_MATCH_RT=m
+ CONFIG_IP6_NF_MATCH_OPTS=m
+ CONFIG_IP6_NF_MATCH_FRAG=m
+ CONFIG_IP6_NF_MATCH_HL=m
+ CONFIG_IP6_NF_MATCH_MULTIPORT=m
+ CONFIG_IP6_NF_MATCH_OWNER=m
+-CONFIG_IP6_NF_MATCH_MARK=m
+ CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+ CONFIG_IP6_NF_MATCH_AHESP=m
+-CONFIG_IP6_NF_MATCH_LENGTH=m
+ CONFIG_IP6_NF_MATCH_EUI64=m
+-CONFIG_IP6_NF_MATCH_PHYSDEV=m
++CONFIG_IP6_NF_MATCH_POLICY=m
+ CONFIG_IP6_NF_FILTER=m
+ CONFIG_IP6_NF_TARGET_LOG=m
+ CONFIG_IP6_NF_TARGET_REJECT=m
+-CONFIG_IP6_NF_TARGET_NFQUEUE=m
+ CONFIG_IP6_NF_MANGLE=m
+-CONFIG_IP6_NF_TARGET_MARK=m
+ CONFIG_IP6_NF_TARGET_HL=m
+ CONFIG_IP6_NF_RAW=m
+ 
+@@ -494,6 +492,11 @@
+ CONFIG_IPDDP_DECAP=y
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ CONFIG_NET_DIVERT=y
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -553,7 +556,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -663,7 +665,7 @@
+ # SCSI Transport Attributes
+ #
+ CONFIG_SCSI_SPI_ATTRS=y
+-CONFIG_SCSI_FC_ATTRS=m
++CONFIG_SCSI_FC_ATTRS=y
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ CONFIG_SCSI_SAS_ATTRS=m
+ 
+@@ -696,13 +698,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -785,6 +781,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -824,6 +821,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -845,8 +843,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -926,6 +922,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -933,7 +930,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -971,6 +967,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -1076,6 +1078,7 @@
+ CONFIG_XFS_SECURITY=y
+ CONFIG_XFS_POSIX_ACL=y
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ CONFIG_MINIX_FS=m
+ CONFIG_ROMFS_FS=m
+ CONFIG_INOTIFY=y
+@@ -1118,6 +1121,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1225,6 +1229,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/bigsur_defconfig linux-2.6.16/arch/mips/configs/bigsur_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/bigsur_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/bigsur_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:05:54 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:53 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -169,29 +169,31 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ # CONFIG_CPUSETS is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_ALL is not set
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -247,7 +249,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_BUILD_ELF64=y
+ CONFIG_MIPS32_COMPAT=y
+ CONFIG_COMPAT=y
+ CONFIG_MIPS32_O32=y
+@@ -309,6 +310,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -457,6 +463,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -478,6 +485,7 @@
+ CONFIG_NET_SB1250_MAC=y
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -543,12 +551,15 @@
+ #
+ # CONFIG_VT is not set
+ CONFIG_SERIAL_NONSTANDARD=y
++# CONFIG_COMPUTONE is not set
+ # CONFIG_ROCKETPORT is not set
+ # CONFIG_CYCLADES is not set
+ # CONFIG_DIGIEPCA is not set
++# CONFIG_MOXA_INTELLIO is not set
+ # CONFIG_MOXA_SMARTIO is not set
+ # CONFIG_ISI is not set
+ # CONFIG_SYNCLINKMP is not set
++# CONFIG_SYNCLINK_GT is not set
+ # CONFIG_N_HDLC is not set
+ # CONFIG_SPECIALIX is not set
+ # CONFIG_SX is not set
+@@ -564,7 +575,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -655,6 +665,12 @@
+ CONFIG_I2C_DEBUG_CHIP=y
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -732,12 +748,12 @@
+ CONFIG_EXT2_FS_SECURITY=y
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ CONFIG_FS_MBCACHE=y
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -770,6 +786,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ # CONFIG_RELAYFS_FS is not set
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -831,18 +848,20 @@
+ # Kernel hacking
+ #
+ CONFIG_PRINTK_TIME=y
+-CONFIG_DEBUG_KERNEL=y
+ CONFIG_MAGIC_SYSRQ=y
++CONFIG_DEBUG_KERNEL=y
+ CONFIG_LOG_BUF_SHIFT=16
+ CONFIG_DETECT_SOFTLOCKUP=y
+ # CONFIG_SCHEDSTATS is not set
+ # CONFIG_DEBUG_SLAB is not set
++CONFIG_DEBUG_MUTEXES=y
+ # CONFIG_DEBUG_SPINLOCK is not set
+ # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+ # CONFIG_DEBUG_KOBJECT is not set
+ # CONFIG_DEBUG_INFO is not set
+ # CONFIG_DEBUG_FS is not set
+ # CONFIG_DEBUG_VM is not set
++CONFIG_FORCED_INLINING=y
+ # CONFIG_RCU_TORTURE_TEST is not set
+ CONFIG_CROSSCOMPILE=y
+ CONFIG_CMDLINE=""
+diff -Naur linux-2.6.16.orig/arch/mips/configs/capcella_defconfig linux-2.6.16/arch/mips/configs/capcella_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/capcella_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/capcella_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:05:55 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:54 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -63,9 +63,9 @@
+ # CONFIG_TOSHIBA_JMR3927 is not set
+ # CONFIG_TOSHIBA_RBTX4927 is not set
+ # CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_CASIO_E55 is not set
+ # CONFIG_IBM_WORKPAD is not set
++# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_TANBAC_TB022X is not set
+ # CONFIG_VICTOR_MPC30X is not set
+ CONFIG_ZAO_CAPCELLA=y
+@@ -90,7 +90,7 @@
+ # CONFIG_CPU_MIPS64_R2 is not set
+ # CONFIG_CPU_R3000 is not set
+ # CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
++# CONFIG_CPU_VR41XX is not set
+ # CONFIG_CPU_R4300 is not set
+ # CONFIG_CPU_R4X00 is not set
+ # CONFIG_CPU_TX49XX is not set
+@@ -103,23 +103,18 @@
+ # CONFIG_CPU_RM7000 is not set
+ # CONFIG_CPU_RM9000 is not set
+ # CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_HAS_CPU_VR41XX=y
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+ 
+ #
+ # Kernel type
+ #
+-CONFIG_32BIT=y
++# CONFIG_32BIT is not set
+ # CONFIG_64BIT is not set
+ CONFIG_PAGE_SIZE_4KB=y
+ # CONFIG_PAGE_SIZE_8KB is not set
+ # CONFIG_PAGE_SIZE_16KB is not set
+ # CONFIG_PAGE_SIZE_64KB is not set
+ # CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
++CONFIG_CPU_HAS_LLSC=y
+ CONFIG_CPU_HAS_SYNC=y
+ CONFIG_GENERIC_HARDIRQS=y
+ CONFIG_GENERIC_IRQ_PROBE=y
+@@ -155,26 +150,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -190,7 +187,6 @@
+ #
+ # Block layer
+ #
+-# CONFIG_LBD is not set
+ 
+ #
+ # IO Schedulers
+@@ -228,7 +224,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+ 
+ #
+ # Networking
+@@ -286,6 +281,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -306,7 +306,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -444,6 +443,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -487,6 +487,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -508,8 +509,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -579,11 +578,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -599,7 +593,6 @@
+ # CONFIG_WATCHDOG is not set
+ # CONFIG_RTC is not set
+ # CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+ # CONFIG_DTLK is not set
+ # CONFIG_R3964 is not set
+ # CONFIG_APPLICOM is not set
+@@ -608,7 +601,6 @@
+ # Ftape, the floppy tape device driver
+ #
+ # CONFIG_DRM is not set
+-CONFIG_GPIO_VR41XX=y
+ # CONFIG_RAW_DRIVER is not set
+ 
+ #
+@@ -623,6 +615,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -704,11 +702,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -741,6 +739,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -803,6 +802,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/cobalt_defconfig linux-2.6.16/arch/mips/configs/cobalt_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/cobalt_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/cobalt_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:05:57 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:55 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -150,26 +150,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -271,6 +273,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -291,7 +298,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -364,9 +370,38 @@
+ # IDE chipset support/bugfixes
+ #
+ CONFIG_IDE_GENERIC=y
+-# CONFIG_BLK_DEV_IDEPCI is not set
++CONFIG_BLK_DEV_IDEPCI=y
++# CONFIG_IDEPCI_SHARE_IRQ is not set
++# CONFIG_BLK_DEV_OFFBOARD is not set
++# CONFIG_BLK_DEV_GENERIC is not set
++# CONFIG_BLK_DEV_OPTI621 is not set
++CONFIG_BLK_DEV_IDEDMA_PCI=y
++# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
++# CONFIG_IDEDMA_PCI_AUTO is not set
++# CONFIG_BLK_DEV_AEC62XX is not set
++# CONFIG_BLK_DEV_ALI15X3 is not set
++# CONFIG_BLK_DEV_AMD74XX is not set
++# CONFIG_BLK_DEV_CMD64X is not set
++# CONFIG_BLK_DEV_TRIFLEX is not set
++# CONFIG_BLK_DEV_CY82C693 is not set
++# CONFIG_BLK_DEV_CS5520 is not set
++# CONFIG_BLK_DEV_CS5530 is not set
++# CONFIG_BLK_DEV_HPT34X is not set
++# CONFIG_BLK_DEV_HPT366 is not set
++# CONFIG_BLK_DEV_SC1200 is not set
++# CONFIG_BLK_DEV_PIIX is not set
++# CONFIG_BLK_DEV_IT821X is not set
++# CONFIG_BLK_DEV_NS87415 is not set
++# CONFIG_BLK_DEV_PDC202XX_OLD is not set
++# CONFIG_BLK_DEV_PDC202XX_NEW is not set
++# CONFIG_BLK_DEV_SVWKS is not set
++# CONFIG_BLK_DEV_SIIMAGE is not set
++# CONFIG_BLK_DEV_SLC90E66 is not set
++# CONFIG_BLK_DEV_TRM290 is not set
++CONFIG_BLK_DEV_VIA82CXXX=y
+ # CONFIG_IDE_ARM is not set
+-# CONFIG_BLK_DEV_IDEDMA is not set
++CONFIG_BLK_DEV_IDEDMA=y
++# CONFIG_IDEDMA_IVB is not set
+ # CONFIG_IDEDMA_AUTO is not set
+ # CONFIG_BLK_DEV_HD is not set
+ 
+@@ -433,11 +468,21 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+ #
+-# CONFIG_NET_TULIP is not set
++CONFIG_NET_TULIP=y
++CONFIG_DE2104X=y
++CONFIG_TULIP=y
++# CONFIG_TULIP_MWI is not set
++# CONFIG_TULIP_MMIO is not set
++# CONFIG_TULIP_NAPI is not set
++# CONFIG_DE4X5 is not set
++# CONFIG_WINBOND_840 is not set
++# CONFIG_DM9102 is not set
++# CONFIG_ULI526X is not set
+ # CONFIG_HP100 is not set
+ # CONFIG_NET_PCI is not set
+ 
+@@ -453,6 +498,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -473,8 +519,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -550,6 +594,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -557,7 +602,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -595,6 +639,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -678,12 +728,12 @@
+ CONFIG_EXT2_FS_SECURITY=y
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ CONFIG_FS_MBCACHE=y
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -716,6 +766,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -774,6 +825,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/db1000_defconfig linux-2.6.16/arch/mips/configs/db1000_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/db1000_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/db1000_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:05:59 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:56 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -151,26 +151,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -285,6 +288,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -312,6 +330,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -320,6 +343,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -332,7 +356,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -395,6 +418,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -512,6 +536,7 @@
+ CONFIG_MII=m
+ CONFIG_MIPS_AU1X00_ENET=y
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -625,13 +650,13 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_CS=m
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+ CONFIG_UNIX98_PTYS=y
+@@ -676,6 +701,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -773,6 +804,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -805,6 +837,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -909,6 +942,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -963,3 +997,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/db1100_defconfig linux-2.6.16/arch/mips/configs/db1100_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/db1100_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/db1100_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:00 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:57 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -151,26 +151,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -274,6 +277,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -301,6 +319,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -309,6 +332,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -321,7 +345,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -384,6 +407,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -501,6 +525,7 @@
+ CONFIG_MII=m
+ CONFIG_MIPS_AU1X00_ENET=y
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -600,13 +625,13 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+ CONFIG_UNIX98_PTYS=y
+@@ -644,6 +669,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -772,6 +803,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -804,6 +836,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -908,6 +941,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -962,3 +996,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/db1200_defconfig linux-2.6.16/arch/mips/configs/db1200_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/db1200_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/db1200_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:03 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:58 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -151,27 +151,30 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -279,6 +282,21 @@
+ #
+ # CONFIG_NETFILTER_NETLINK is not set
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -306,6 +324,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -314,6 +337,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -385,6 +409,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -568,6 +593,7 @@
+ CONFIG_MII=m
+ # CONFIG_MIPS_AU1X00_ENET is not set
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -665,13 +691,13 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ # CONFIG_SERIAL_8250_CS is not set
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+ CONFIG_UNIX98_PTYS=y
+@@ -716,6 +742,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -842,6 +874,7 @@
+ # CONFIG_JFS_STATISTICS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -881,6 +914,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ # CONFIG_RELAYFS_FS is not set
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -990,6 +1024,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1020,3 +1055,7 @@
+ CONFIG_LIBCRC32C=y
+ CONFIG_ZLIB_INFLATE=y
+ CONFIG_ZLIB_DEFLATE=y
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/db1500_defconfig linux-2.6.16/arch/mips/configs/db1500_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/db1500_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/db1500_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:05 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:59 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -153,26 +153,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -293,6 +296,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -320,6 +338,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -328,6 +351,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -340,7 +364,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -403,6 +426,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -561,6 +585,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -581,6 +606,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -601,8 +627,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # PCMCIA network device support
+@@ -692,16 +716,15 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ # CONFIG_SERIAL_8250_CS is not set
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -746,6 +769,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -788,8 +817,6 @@
+ # Advanced Linux Sound Architecture
+ #
+ CONFIG_SND=m
+-CONFIG_SND_AC97_CODEC=m
+-CONFIG_SND_AC97_BUS=m
+ CONFIG_SND_TIMER=m
+ CONFIG_SND_PCM=m
+ CONFIG_SND_RAWMIDI=m
+@@ -799,13 +826,16 @@
+ CONFIG_SND_MIXER_OSS=m
+ CONFIG_SND_PCM_OSS=m
+ CONFIG_SND_SEQUENCER_OSS=y
++# CONFIG_SND_DYNAMIC_MINORS is not set
++CONFIG_SND_SUPPORT_OLD_API=y
+ # CONFIG_SND_VERBOSE_PRINTK is not set
+ # CONFIG_SND_DEBUG is not set
+-CONFIG_SND_GENERIC_DRIVER=y
+ 
+ #
+ # Generic devices
+ #
++CONFIG_SND_AC97_CODEC=m
++CONFIG_SND_AC97_BUS=m
+ # CONFIG_SND_DUMMY is not set
+ CONFIG_SND_VIRMIDI=m
+ CONFIG_SND_MTPAV=m
+@@ -815,6 +845,7 @@
+ #
+ # PCI devices
+ #
++# CONFIG_SND_AD1889 is not set
+ # CONFIG_SND_ALI5451 is not set
+ # CONFIG_SND_ATIIXP is not set
+ # CONFIG_SND_ATIIXP_MODEM is not set
+@@ -823,38 +854,38 @@
+ # CONFIG_SND_AU8830 is not set
+ # CONFIG_SND_AZT3328 is not set
+ # CONFIG_SND_BT87X is not set
+-# CONFIG_SND_CS46XX is not set
++# CONFIG_SND_CA0106 is not set
++# CONFIG_SND_CMIPCI is not set
+ # CONFIG_SND_CS4281 is not set
++# CONFIG_SND_CS46XX is not set
+ # CONFIG_SND_EMU10K1 is not set
+ # CONFIG_SND_EMU10K1X is not set
+-# CONFIG_SND_CA0106 is not set
+-# CONFIG_SND_KORG1212 is not set
+-# CONFIG_SND_MIXART is not set
+-# CONFIG_SND_NM256 is not set
+-# CONFIG_SND_RME32 is not set
+-# CONFIG_SND_RME96 is not set
+-# CONFIG_SND_RME9652 is not set
+-# CONFIG_SND_HDSP is not set
+-# CONFIG_SND_HDSPM is not set
+-# CONFIG_SND_TRIDENT is not set
+-# CONFIG_SND_YMFPCI is not set
+-# CONFIG_SND_AD1889 is not set
+-# CONFIG_SND_CMIPCI is not set
+ # CONFIG_SND_ENS1370 is not set
+ # CONFIG_SND_ENS1371 is not set
+ # CONFIG_SND_ES1938 is not set
+ # CONFIG_SND_ES1968 is not set
+-# CONFIG_SND_MAESTRO3 is not set
+ # CONFIG_SND_FM801 is not set
++# CONFIG_SND_HDA_INTEL is not set
++# CONFIG_SND_HDSP is not set
++# CONFIG_SND_HDSPM is not set
+ # CONFIG_SND_ICE1712 is not set
+ # CONFIG_SND_ICE1724 is not set
+ # CONFIG_SND_INTEL8X0 is not set
+ # CONFIG_SND_INTEL8X0M is not set
++# CONFIG_SND_KORG1212 is not set
++# CONFIG_SND_MAESTRO3 is not set
++# CONFIG_SND_MIXART is not set
++# CONFIG_SND_NM256 is not set
++# CONFIG_SND_PCXHR is not set
++# CONFIG_SND_RME32 is not set
++# CONFIG_SND_RME96 is not set
++# CONFIG_SND_RME9652 is not set
+ # CONFIG_SND_SONICVIBES is not set
++# CONFIG_SND_TRIDENT is not set
+ # CONFIG_SND_VIA82XX is not set
+ # CONFIG_SND_VIA82XX_MODEM is not set
+ # CONFIG_SND_VX222 is not set
+-# CONFIG_SND_HDA_INTEL is not set
++# CONFIG_SND_YMFPCI is not set
+ 
+ #
+ # ALSA MIPS devices
+@@ -939,12 +970,14 @@
+ # may also be needed; see USB_STORAGE Help for more information
+ #
+ # CONFIG_USB_STORAGE is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+ #
+ CONFIG_USB_HID=y
+ CONFIG_USB_HIDINPUT=y
++# CONFIG_USB_HIDINPUT_POWERBOOK is not set
+ # CONFIG_HID_FF is not set
+ # CONFIG_USB_HIDDEV is not set
+ # CONFIG_USB_AIPTEK is not set
+@@ -958,6 +991,7 @@
+ CONFIG_USB_YEALINK=m
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -1057,6 +1091,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -1089,6 +1124,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1193,6 +1229,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1247,3 +1284,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/db1550_defconfig linux-2.6.16/arch/mips/configs/db1550_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/db1550_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/db1550_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:07 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:00 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -152,26 +152,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -292,6 +295,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -319,6 +337,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -327,6 +350,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -339,7 +363,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -402,6 +425,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -593,6 +617,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -613,6 +638,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -633,8 +659,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # PCMCIA network device support
+@@ -732,16 +756,15 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ # CONFIG_SERIAL_8250_CS is not set
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -786,6 +809,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -878,6 +907,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -910,6 +940,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1014,6 +1045,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1068,3 +1100,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ddb5476_defconfig linux-2.6.16/arch/mips/configs/ddb5476_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ddb5476_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ddb5476_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:09 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:02 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -151,26 +151,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -276,6 +278,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -296,7 +303,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -445,6 +451,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_NET_VENDOR_SMC is not set
++# CONFIG_DM9000 is not set
+ # CONFIG_NET_VENDOR_RACAL is not set
+ 
+ #
+@@ -469,6 +476,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -489,8 +497,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -566,6 +572,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -573,7 +580,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -611,6 +617,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -669,7 +681,6 @@
+ # CONFIG_FB_3DFX is not set
+ # CONFIG_FB_VOODOO1 is not set
+ # CONFIG_FB_SMIVGX is not set
+-# CONFIG_FB_CYBLA is not set
+ # CONFIG_FB_TRIDENT is not set
+ # CONFIG_FB_VIRTUAL is not set
+ 
+@@ -729,11 +740,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -766,6 +777,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -825,6 +837,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ddb5477_defconfig linux-2.6.16/arch/mips/configs/ddb5477_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ddb5477_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ddb5477_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:11 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:02 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -151,26 +151,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -275,6 +277,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -295,7 +302,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -414,6 +420,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -453,6 +460,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -474,8 +482,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -551,6 +557,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -558,7 +565,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -596,6 +602,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -677,11 +689,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -714,6 +726,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -776,6 +789,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/decstation_defconfig linux-2.6.16/arch/mips/configs/decstation_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/decstation_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/decstation_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:13 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:03 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -150,27 +150,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_ALL is not set
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -278,6 +280,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -298,7 +305,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -436,6 +442,7 @@
+ #
+ CONFIG_NET_ETHERNET=y
+ # CONFIG_MII is not set
++# CONFIG_DM9000 is not set
+ CONFIG_DECLANCE=y
+ 
+ #
+@@ -539,6 +546,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -636,12 +649,12 @@
+ CONFIG_EXT2_FS_SECURITY=y
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ CONFIG_FS_MBCACHE=y
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -674,6 +687,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -734,6 +748,7 @@
+ # CONFIG_SGI_PARTITION is not set
+ CONFIG_ULTRIX_PARTITION=y
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -750,18 +765,20 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
+-CONFIG_DEBUG_KERNEL=y
+ CONFIG_MAGIC_SYSRQ=y
++CONFIG_DEBUG_KERNEL=y
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_DETECT_SOFTLOCKUP=y
+ # CONFIG_SCHEDSTATS is not set
+ # CONFIG_DEBUG_SLAB is not set
++CONFIG_DEBUG_MUTEXES=y
+ # CONFIG_DEBUG_SPINLOCK is not set
+ # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+ # CONFIG_DEBUG_KOBJECT is not set
+ # CONFIG_DEBUG_INFO is not set
+ # CONFIG_DEBUG_FS is not set
+ # CONFIG_DEBUG_VM is not set
++CONFIG_FORCED_INLINING=y
+ # CONFIG_RCU_TORTURE_TEST is not set
+ CONFIG_CROSSCOMPILE=y
+ CONFIG_CMDLINE=""
+diff -Naur linux-2.6.16.orig/arch/mips/configs/e55_defconfig linux-2.6.16/arch/mips/configs/e55_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/e55_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/e55_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:14 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:04 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -63,9 +63,9 @@
+ # CONFIG_TOSHIBA_JMR3927 is not set
+ # CONFIG_TOSHIBA_RBTX4927 is not set
+ # CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+ CONFIG_CASIO_E55=y
+ # CONFIG_IBM_WORKPAD is not set
++# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_TANBAC_TB022X is not set
+ # CONFIG_VICTOR_MPC30X is not set
+ # CONFIG_ZAO_CAPCELLA is not set
+@@ -88,7 +88,7 @@
+ # CONFIG_CPU_MIPS64_R2 is not set
+ # CONFIG_CPU_R3000 is not set
+ # CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
++# CONFIG_CPU_VR41XX is not set
+ # CONFIG_CPU_R4300 is not set
+ # CONFIG_CPU_R4X00 is not set
+ # CONFIG_CPU_TX49XX is not set
+@@ -101,23 +101,18 @@
+ # CONFIG_CPU_RM7000 is not set
+ # CONFIG_CPU_RM9000 is not set
+ # CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_HAS_CPU_VR41XX=y
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+ 
+ #
+ # Kernel type
+ #
+-CONFIG_32BIT=y
++# CONFIG_32BIT is not set
+ # CONFIG_64BIT is not set
+ CONFIG_PAGE_SIZE_4KB=y
+ # CONFIG_PAGE_SIZE_8KB is not set
+ # CONFIG_PAGE_SIZE_16KB is not set
+ # CONFIG_PAGE_SIZE_64KB is not set
+ # CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
++CONFIG_CPU_HAS_LLSC=y
+ CONFIG_CPU_HAS_SYNC=y
+ CONFIG_GENERIC_HARDIRQS=y
+ CONFIG_GENERIC_IRQ_PROBE=y
+@@ -153,26 +148,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -188,7 +185,6 @@
+ #
+ # Block layer
+ #
+-# CONFIG_LBD is not set
+ 
+ #
+ # IO Schedulers
+@@ -223,7 +219,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+ 
+ #
+ # Networking
+@@ -278,6 +273,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -298,7 +298,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -433,6 +432,7 @@
+ # CONFIG_MII is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_NET_VENDOR_SMC is not set
++# CONFIG_DM9000 is not set
+ # CONFIG_NET_VENDOR_RACAL is not set
+ # CONFIG_AT1700 is not set
+ # CONFIG_DEPCA is not set
+@@ -531,10 +531,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -563,14 +559,12 @@
+ # CONFIG_WDT is not set
+ # CONFIG_RTC is not set
+ # CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+ # CONFIG_DTLK is not set
+ # CONFIG_R3964 is not set
+ 
+ #
+ # Ftape, the floppy tape device driver
+ #
+-CONFIG_GPIO_VR41XX=y
+ # CONFIG_RAW_DRIVER is not set
+ 
+ #
+@@ -585,6 +579,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -665,11 +665,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -702,6 +702,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -763,6 +764,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ev64120_defconfig linux-2.6.16/arch/mips/configs/ev64120_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ev64120_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ev64120_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:16 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:05 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -153,26 +153,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -282,6 +284,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -302,7 +309,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -420,6 +426,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -440,6 +447,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -460,8 +468,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -545,6 +551,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -552,7 +559,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -590,6 +596,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -671,11 +683,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -708,6 +720,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -767,6 +780,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ev96100_defconfig linux-2.6.16/arch/mips/configs/ev96100_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ev96100_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ev96100_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:18 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:06 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -157,26 +157,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -284,6 +286,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -304,7 +311,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -407,6 +413,7 @@
+ CONFIG_NET_ETHERNET=y
+ # CONFIG_MII is not set
+ CONFIG_MIPS_GT96100ETH=y
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -496,6 +503,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -538,6 +546,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -617,11 +631,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -654,6 +668,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -713,6 +728,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ip22_defconfig linux-2.6.16/arch/mips/configs/ip22_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ip22_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ip22_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:20 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:51 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -158,27 +158,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -317,6 +319,28 @@
+ CONFIG_NETFILTER_NETLINK=m
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_HELPER=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STATE=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -335,39 +359,23 @@
+ CONFIG_IP_NF_PPTP=m
+ CONFIG_IP_NF_QUEUE=m
+ CONFIG_IP_NF_IPTABLES=m
+-CONFIG_IP_NF_MATCH_LIMIT=m
+ CONFIG_IP_NF_MATCH_IPRANGE=m
+-CONFIG_IP_NF_MATCH_MAC=m
+-CONFIG_IP_NF_MATCH_PKTTYPE=m
+-CONFIG_IP_NF_MATCH_MARK=m
+ CONFIG_IP_NF_MATCH_MULTIPORT=m
+ CONFIG_IP_NF_MATCH_TOS=m
+ CONFIG_IP_NF_MATCH_RECENT=m
+ CONFIG_IP_NF_MATCH_ECN=m
+ CONFIG_IP_NF_MATCH_DSCP=m
+ CONFIG_IP_NF_MATCH_AH_ESP=m
+-CONFIG_IP_NF_MATCH_LENGTH=m
+ CONFIG_IP_NF_MATCH_TTL=m
+-CONFIG_IP_NF_MATCH_TCPMSS=m
+-CONFIG_IP_NF_MATCH_HELPER=m
+-CONFIG_IP_NF_MATCH_STATE=m
+-CONFIG_IP_NF_MATCH_CONNTRACK=m
+ CONFIG_IP_NF_MATCH_OWNER=m
+ CONFIG_IP_NF_MATCH_ADDRTYPE=m
+-CONFIG_IP_NF_MATCH_REALM=m
+-CONFIG_IP_NF_MATCH_SCTP=m
+-CONFIG_IP_NF_MATCH_DCCP=m
+-CONFIG_IP_NF_MATCH_COMMENT=m
+-CONFIG_IP_NF_MATCH_CONNMARK=m
+-CONFIG_IP_NF_MATCH_CONNBYTES=m
+ CONFIG_IP_NF_MATCH_HASHLIMIT=m
+-CONFIG_IP_NF_MATCH_STRING=m
++CONFIG_IP_NF_MATCH_POLICY=m
+ CONFIG_IP_NF_FILTER=m
+ CONFIG_IP_NF_TARGET_REJECT=m
+ CONFIG_IP_NF_TARGET_LOG=m
+ CONFIG_IP_NF_TARGET_ULOG=m
+ CONFIG_IP_NF_TARGET_TCPMSS=m
+-CONFIG_IP_NF_TARGET_NFQUEUE=m
+ CONFIG_IP_NF_NAT=m
+ CONFIG_IP_NF_NAT_NEEDED=y
+ CONFIG_IP_NF_TARGET_MASQUERADE=m
+@@ -384,13 +392,9 @@
+ CONFIG_IP_NF_TARGET_TOS=m
+ CONFIG_IP_NF_TARGET_ECN=m
+ CONFIG_IP_NF_TARGET_DSCP=m
+-CONFIG_IP_NF_TARGET_MARK=m
+-CONFIG_IP_NF_TARGET_CLASSIFY=m
+ CONFIG_IP_NF_TARGET_TTL=m
+-CONFIG_IP_NF_TARGET_CONNMARK=m
+ CONFIG_IP_NF_TARGET_CLUSTERIP=m
+ CONFIG_IP_NF_RAW=m
+-CONFIG_IP_NF_TARGET_NOTRACK=m
+ CONFIG_IP_NF_ARPTABLES=m
+ CONFIG_IP_NF_ARPFILTER=m
+ CONFIG_IP_NF_ARP_MANGLE=m
+@@ -400,25 +404,20 @@
+ #
+ CONFIG_IP6_NF_QUEUE=m
+ CONFIG_IP6_NF_IPTABLES=m
+-CONFIG_IP6_NF_MATCH_LIMIT=m
+-CONFIG_IP6_NF_MATCH_MAC=m
+ CONFIG_IP6_NF_MATCH_RT=m
+ CONFIG_IP6_NF_MATCH_OPTS=m
+ CONFIG_IP6_NF_MATCH_FRAG=m
+ CONFIG_IP6_NF_MATCH_HL=m
+ CONFIG_IP6_NF_MATCH_MULTIPORT=m
+ CONFIG_IP6_NF_MATCH_OWNER=m
+-CONFIG_IP6_NF_MATCH_MARK=m
+ CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+ CONFIG_IP6_NF_MATCH_AHESP=m
+-CONFIG_IP6_NF_MATCH_LENGTH=m
+ CONFIG_IP6_NF_MATCH_EUI64=m
++CONFIG_IP6_NF_MATCH_POLICY=m
+ CONFIG_IP6_NF_FILTER=m
+ CONFIG_IP6_NF_TARGET_LOG=m
+ CONFIG_IP6_NF_TARGET_REJECT=m
+-CONFIG_IP6_NF_TARGET_NFQUEUE=m
+ CONFIG_IP6_NF_MANGLE=m
+-CONFIG_IP6_NF_TARGET_MARK=m
+ CONFIG_IP6_NF_TARGET_HL=m
+ CONFIG_IP6_NF_RAW=m
+ 
+@@ -445,6 +444,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ CONFIG_NET_DIVERT=y
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -504,7 +508,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -641,6 +644,7 @@
+ #
+ CONFIG_NET_ETHERNET=y
+ # CONFIG_MII is not set
++# CONFIG_DM9000 is not set
+ CONFIG_SGISEEQ=y
+ 
+ #
+@@ -787,6 +791,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -892,6 +902,7 @@
+ CONFIG_XFS_SECURITY=y
+ # CONFIG_XFS_POSIX_ACL is not set
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ CONFIG_MINIX_FS=m
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -934,6 +945,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1007,6 +1019,7 @@
+ CONFIG_SGI_PARTITION=y
+ # CONFIG_ULTRIX_PARTITION is not set
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -1062,6 +1075,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ip27_defconfig linux-2.6.16/arch/mips/configs/ip27_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ip27_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ip27_defconfig	2006-03-21 01:05:46.000000000 +0000
+@@ -132,6 +132,7 @@
+ CONFIG_NEED_MULTIPLE_NODES=y
+ # CONFIG_SPARSEMEM_STATIC is not set
+ CONFIG_SPLIT_PTLOCK_CPUS=4
++CONFIG_MIGRATION=y
+ CONFIG_SMP=y
+ CONFIG_NR_CPUS=64
+ CONFIG_PREEMPT_NONE=y
+@@ -158,28 +159,30 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_CPUSETS=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -234,7 +237,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_BUILD_ELF64=y
+ CONFIG_MIPS32_COMPAT=y
+ CONFIG_COMPAT=y
+ CONFIG_MIPS32_O32=y
+@@ -290,6 +292,10 @@
+ #
+ # CONFIG_IP_SCTP is not set
+ 
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_ATM is not set
+ # CONFIG_BRIDGE is not set
+ # CONFIG_VLAN_8021Q is not set
+@@ -357,7 +363,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -368,7 +373,7 @@
+ #
+ CONFIG_STANDALONE=y
+ CONFIG_PREVENT_FIRMWARE_BUILD=y
+-CONFIG_FW_LOADER=m
++CONFIG_FW_LOADER=y
+ 
+ #
+ # Connector - unified userspace <-> kernelspace linker
+@@ -442,7 +447,7 @@
+ # SCSI Transport Attributes
+ #
+ CONFIG_SCSI_SPI_ATTRS=y
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=y
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ CONFIG_SCSI_SAS_ATTRS=m
+ 
+@@ -470,13 +475,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ CONFIG_SCSI_QLOGIC_1280=y
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -561,6 +560,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -581,6 +581,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -601,8 +602,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -656,6 +655,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ CONFIG_SERIAL_8250_EXTENDED=y
+ CONFIG_SERIAL_8250_MANY_PORTS=y
+ CONFIG_SERIAL_8250_SHARE_IRQ=y
+@@ -706,6 +706,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -801,6 +807,7 @@
+ CONFIG_XFS_SECURITY=y
+ CONFIG_XFS_POSIX_ACL=y
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -834,6 +841,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -894,6 +902,7 @@
+ CONFIG_SGI_PARTITION=y
+ # CONFIG_ULTRIX_PARTITION is not set
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -910,6 +919,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=15
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ip32_defconfig linux-2.6.16/arch/mips/configs/ip32_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ip32_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ip32_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:24 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:09 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -158,26 +158,28 @@
+ # CONFIG_BSD_PROCESS_ACCT_V3 is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -224,7 +226,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ CONFIG_BINFMT_MISC=y
+-# CONFIG_BUILD_ELF64 is not set
+ CONFIG_MIPS32_COMPAT=y
+ CONFIG_COMPAT=y
+ CONFIG_MIPS32_O32=y
+@@ -286,6 +287,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -306,7 +312,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -392,7 +397,7 @@
+ # SCSI Transport Attributes
+ #
+ CONFIG_SCSI_SPI_ATTRS=y
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=y
+ # CONFIG_SCSI_ISCSI_ATTRS is not set
+ CONFIG_SCSI_SAS_ATTRS=y
+ 
+@@ -425,13 +430,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -498,6 +497,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -518,6 +518,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -538,8 +539,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -617,6 +616,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -624,7 +624,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -662,6 +661,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -743,11 +748,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -780,6 +785,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -835,6 +841,7 @@
+ CONFIG_SGI_PARTITION=y
+ # CONFIG_ULTRIX_PARTITION is not set
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -851,6 +858,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/it8172_defconfig linux-2.6.16/arch/mips/configs/it8172_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/it8172_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/it8172_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:26 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:10 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -153,26 +153,29 @@
+ # CONFIG_BSD_PROCESS_ACCT_V3 is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -281,6 +284,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -301,7 +309,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -362,6 +369,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -500,6 +508,7 @@
+ #
+ CONFIG_NET_ETHERNET=y
+ # CONFIG_MII is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -593,6 +602,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -635,6 +645,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -728,11 +744,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -765,6 +781,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -826,6 +843,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ivr_defconfig linux-2.6.16/arch/mips/configs/ivr_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ivr_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ivr_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:27 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:11 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -150,26 +150,28 @@
+ # CONFIG_BSD_PROCESS_ACCT_V3 is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -280,6 +282,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -300,7 +307,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -440,6 +446,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -460,6 +467,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -480,8 +488,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -560,6 +566,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -567,7 +574,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -604,6 +610,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -685,11 +697,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -722,6 +734,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -781,6 +794,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/jaguar-atx_defconfig linux-2.6.16/arch/mips/configs/jaguar-atx_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/jaguar-atx_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/jaguar-atx_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:29 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:12 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -158,27 +158,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -186,6 +187,7 @@
+ CONFIG_MODULES=y
+ CONFIG_MODULE_UNLOAD=y
+ CONFIG_OBSOLETE_MODPARM=y
++# CONFIG_MODVERSIONS is not set
+ CONFIG_MODULE_SRCVERSION_ALL=y
+ CONFIG_KMOD=y
+ 
+@@ -294,7 +296,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -411,6 +412,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -469,8 +471,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -515,6 +515,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -522,7 +523,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -558,6 +558,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -631,7 +637,6 @@
+ #
+ # CONFIG_EXT2_FS is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+@@ -710,6 +715,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/jmr3927_defconfig linux-2.6.16/arch/mips/configs/jmr3927_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/jmr3927_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/jmr3927_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:31 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:13 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -148,26 +148,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -272,6 +274,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -292,7 +299,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -411,6 +417,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -431,6 +438,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -451,8 +459,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -529,6 +535,7 @@
+ # CONFIG_MOXA_SMARTIO is not set
+ # CONFIG_ISI is not set
+ # CONFIG_SYNCLINKMP is not set
++# CONFIG_SYNCLINK_GT is not set
+ # CONFIG_N_HDLC is not set
+ # CONFIG_RISCOM8 is not set
+ # CONFIG_SPECIALIX is not set
+@@ -545,7 +552,6 @@
+ # Non-8250 serial port support
+ #
+ CONFIG_HAS_TXX9_SERIAL=y
+-# CONFIG_SERIAL_JSM is not set
+ # CONFIG_UNIX98_PTYS is not set
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -583,6 +589,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -641,7 +653,6 @@
+ # CONFIG_FB_3DFX is not set
+ # CONFIG_FB_VOODOO1 is not set
+ # CONFIG_FB_SMIVGX is not set
+-# CONFIG_FB_CYBLA is not set
+ # CONFIG_FB_TRIDENT is not set
+ # CONFIG_FB_VIRTUAL is not set
+ 
+@@ -698,11 +709,11 @@
+ #
+ # CONFIG_EXT2_FS is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -735,6 +746,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -794,6 +806,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/lasat200_defconfig linux-2.6.16/arch/mips/configs/lasat200_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/lasat200_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/lasat200_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:33 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:14 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -156,26 +156,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -282,6 +285,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -302,7 +310,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -365,6 +372,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -548,6 +556,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -568,6 +577,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -588,8 +598,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -665,6 +673,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -672,7 +681,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -710,6 +718,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -801,6 +815,7 @@
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -833,6 +848,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -895,6 +911,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/malta_defconfig linux-2.6.16/arch/mips/configs/malta_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/malta_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/malta_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc5
+-# Fri Dec 23 02:21:03 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:15 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -170,26 +170,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -341,6 +343,29 @@
+ CONFIG_NETFILTER_NETLINK=m
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_HELPER=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STATE=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -359,40 +384,23 @@
+ CONFIG_IP_NF_PPTP=m
+ CONFIG_IP_NF_QUEUE=m
+ CONFIG_IP_NF_IPTABLES=m
+-CONFIG_IP_NF_MATCH_LIMIT=m
+ CONFIG_IP_NF_MATCH_IPRANGE=m
+-CONFIG_IP_NF_MATCH_MAC=m
+-CONFIG_IP_NF_MATCH_PKTTYPE=m
+-CONFIG_IP_NF_MATCH_MARK=m
+ CONFIG_IP_NF_MATCH_MULTIPORT=m
+ CONFIG_IP_NF_MATCH_TOS=m
+ CONFIG_IP_NF_MATCH_RECENT=m
+ CONFIG_IP_NF_MATCH_ECN=m
+ CONFIG_IP_NF_MATCH_DSCP=m
+ CONFIG_IP_NF_MATCH_AH_ESP=m
+-CONFIG_IP_NF_MATCH_LENGTH=m
+ CONFIG_IP_NF_MATCH_TTL=m
+-CONFIG_IP_NF_MATCH_TCPMSS=m
+-CONFIG_IP_NF_MATCH_HELPER=m
+-CONFIG_IP_NF_MATCH_STATE=m
+-CONFIG_IP_NF_MATCH_CONNTRACK=m
+ CONFIG_IP_NF_MATCH_OWNER=m
+-CONFIG_IP_NF_MATCH_PHYSDEV=m
+ CONFIG_IP_NF_MATCH_ADDRTYPE=m
+-CONFIG_IP_NF_MATCH_REALM=m
+-CONFIG_IP_NF_MATCH_SCTP=m
+-CONFIG_IP_NF_MATCH_DCCP=m
+-CONFIG_IP_NF_MATCH_COMMENT=m
+-CONFIG_IP_NF_MATCH_CONNMARK=m
+-CONFIG_IP_NF_MATCH_CONNBYTES=m
+ CONFIG_IP_NF_MATCH_HASHLIMIT=m
+-CONFIG_IP_NF_MATCH_STRING=m
++CONFIG_IP_NF_MATCH_POLICY=m
+ CONFIG_IP_NF_FILTER=m
+ CONFIG_IP_NF_TARGET_REJECT=m
+ CONFIG_IP_NF_TARGET_LOG=m
+ CONFIG_IP_NF_TARGET_ULOG=m
+ CONFIG_IP_NF_TARGET_TCPMSS=m
+-CONFIG_IP_NF_TARGET_NFQUEUE=m
+ CONFIG_IP_NF_NAT=m
+ CONFIG_IP_NF_NAT_NEEDED=y
+ CONFIG_IP_NF_TARGET_MASQUERADE=m
+@@ -409,13 +417,9 @@
+ CONFIG_IP_NF_TARGET_TOS=m
+ CONFIG_IP_NF_TARGET_ECN=m
+ CONFIG_IP_NF_TARGET_DSCP=m
+-CONFIG_IP_NF_TARGET_MARK=m
+-CONFIG_IP_NF_TARGET_CLASSIFY=m
+ CONFIG_IP_NF_TARGET_TTL=m
+-CONFIG_IP_NF_TARGET_CONNMARK=m
+ CONFIG_IP_NF_TARGET_CLUSTERIP=m
+ CONFIG_IP_NF_RAW=m
+-CONFIG_IP_NF_TARGET_NOTRACK=m
+ CONFIG_IP_NF_ARPTABLES=m
+ CONFIG_IP_NF_ARPFILTER=m
+ CONFIG_IP_NF_ARP_MANGLE=m
+@@ -425,26 +429,20 @@
+ #
+ CONFIG_IP6_NF_QUEUE=m
+ CONFIG_IP6_NF_IPTABLES=m
+-CONFIG_IP6_NF_MATCH_LIMIT=m
+-CONFIG_IP6_NF_MATCH_MAC=m
+ CONFIG_IP6_NF_MATCH_RT=m
+ CONFIG_IP6_NF_MATCH_OPTS=m
+ CONFIG_IP6_NF_MATCH_FRAG=m
+ CONFIG_IP6_NF_MATCH_HL=m
+ CONFIG_IP6_NF_MATCH_MULTIPORT=m
+ CONFIG_IP6_NF_MATCH_OWNER=m
+-CONFIG_IP6_NF_MATCH_MARK=m
+ CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+ CONFIG_IP6_NF_MATCH_AHESP=m
+-CONFIG_IP6_NF_MATCH_LENGTH=m
+ CONFIG_IP6_NF_MATCH_EUI64=m
+-CONFIG_IP6_NF_MATCH_PHYSDEV=m
++CONFIG_IP6_NF_MATCH_POLICY=m
+ CONFIG_IP6_NF_FILTER=m
+ CONFIG_IP6_NF_TARGET_LOG=m
+ CONFIG_IP6_NF_TARGET_REJECT=m
+-CONFIG_IP6_NF_TARGET_NFQUEUE=m
+ CONFIG_IP6_NF_MANGLE=m
+-CONFIG_IP6_NF_TARGET_MARK=m
+ CONFIG_IP6_NF_TARGET_HL=m
+ CONFIG_IP6_NF_RAW=m
+ 
+@@ -500,6 +498,11 @@
+ CONFIG_IPDDP_DECAP=y
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ CONFIG_NET_DIVERT=y
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -559,7 +562,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -734,13 +736,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=m
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -823,6 +819,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -862,6 +859,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -883,8 +881,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -961,6 +957,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -968,7 +965,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -1005,6 +1001,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -1110,6 +1112,7 @@
+ CONFIG_XFS_SECURITY=y
+ CONFIG_XFS_POSIX_ACL=y
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ CONFIG_MINIX_FS=m
+ CONFIG_ROMFS_FS=m
+ CONFIG_INOTIFY=y
+@@ -1152,6 +1155,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1259,6 +1263,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/mipssim_defconfig linux-2.6.16/arch/mips/configs/mipssim_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/mipssim_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/mipssim_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:37 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:16 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -156,27 +156,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_ALL is not set
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -297,6 +299,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ CONFIG_NET_DIVERT=y
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -525,6 +532,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=1
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -567,6 +575,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -640,11 +654,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ CONFIG_ROMFS_FS=y
+ # CONFIG_INOTIFY is not set
+@@ -677,6 +691,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ # CONFIG_RELAYFS_FS is not set
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -738,17 +753,19 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
+-CONFIG_DEBUG_KERNEL=y
+ # CONFIG_MAGIC_SYSRQ is not set
++CONFIG_DEBUG_KERNEL=y
+ CONFIG_LOG_BUF_SHIFT=14
+ # CONFIG_DETECT_SOFTLOCKUP is not set
+ # CONFIG_SCHEDSTATS is not set
+ # CONFIG_DEBUG_SLAB is not set
++CONFIG_DEBUG_MUTEXES=y
+ # CONFIG_DEBUG_SPINLOCK is not set
+ # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+ # CONFIG_DEBUG_KOBJECT is not set
+ CONFIG_DEBUG_INFO=y
+ # CONFIG_DEBUG_VM is not set
++CONFIG_FORCED_INLINING=y
+ # CONFIG_RCU_TORTURE_TEST is not set
+ CONFIG_CROSSCOMPILE=y
+ CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp"
+diff -Naur linux-2.6.16.orig/arch/mips/configs/mpc30x_defconfig linux-2.6.16/arch/mips/configs/mpc30x_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/mpc30x_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/mpc30x_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:39 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:17 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -63,9 +63,9 @@
+ # CONFIG_TOSHIBA_JMR3927 is not set
+ # CONFIG_TOSHIBA_RBTX4927 is not set
+ # CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_CASIO_E55 is not set
+ # CONFIG_IBM_WORKPAD is not set
++# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_TANBAC_TB022X is not set
+ CONFIG_VICTOR_MPC30X=y
+ # CONFIG_ZAO_CAPCELLA is not set
+@@ -90,7 +90,7 @@
+ # CONFIG_CPU_MIPS64_R2 is not set
+ # CONFIG_CPU_R3000 is not set
+ # CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
++# CONFIG_CPU_VR41XX is not set
+ # CONFIG_CPU_R4300 is not set
+ # CONFIG_CPU_R4X00 is not set
+ # CONFIG_CPU_TX49XX is not set
+@@ -103,23 +103,18 @@
+ # CONFIG_CPU_RM7000 is not set
+ # CONFIG_CPU_RM9000 is not set
+ # CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_HAS_CPU_VR41XX=y
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+ 
+ #
+ # Kernel type
+ #
+-CONFIG_32BIT=y
++# CONFIG_32BIT is not set
+ # CONFIG_64BIT is not set
+ CONFIG_PAGE_SIZE_4KB=y
+ # CONFIG_PAGE_SIZE_8KB is not set
+ # CONFIG_PAGE_SIZE_16KB is not set
+ # CONFIG_PAGE_SIZE_64KB is not set
+ # CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
++CONFIG_CPU_HAS_LLSC=y
+ CONFIG_CPU_HAS_SYNC=y
+ CONFIG_GENERIC_HARDIRQS=y
+ CONFIG_GENERIC_IRQ_PROBE=y
+@@ -155,26 +150,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -190,7 +187,6 @@
+ #
+ # Block layer
+ #
+-# CONFIG_LBD is not set
+ 
+ #
+ # IO Schedulers
+@@ -229,7 +225,6 @@
+ # CONFIG_YENTA is not set
+ # CONFIG_PD6729 is not set
+ # CONFIG_I82092 is not set
+-CONFIG_PCMCIA_VRC4173=y
+ 
+ #
+ # PCI Hotplug Support
+@@ -241,7 +236,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+ 
+ #
+ # Networking
+@@ -296,6 +290,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -455,6 +454,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -604,11 +604,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -624,7 +619,6 @@
+ # CONFIG_WATCHDOG is not set
+ # CONFIG_RTC is not set
+ # CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+ # CONFIG_DTLK is not set
+ # CONFIG_R3964 is not set
+ # CONFIG_APPLICOM is not set
+@@ -640,7 +634,6 @@
+ # CONFIG_SYNCLINK_CS is not set
+ # CONFIG_CARDMAN_4000 is not set
+ # CONFIG_CARDMAN_4040 is not set
+-CONFIG_GPIO_VR41XX=y
+ # CONFIG_RAW_DRIVER is not set
+ 
+ #
+@@ -655,6 +648,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -740,6 +739,7 @@
+ # may also be needed; see USB_STORAGE Help for more information
+ #
+ # CONFIG_USB_STORAGE is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+@@ -762,6 +762,7 @@
+ # CONFIG_USB_YEALINK is not set
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -846,11 +847,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -883,6 +884,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -941,6 +943,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ocelot_3_defconfig linux-2.6.16/arch/mips/configs/ocelot_3_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ocelot_3_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ocelot_3_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:41 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:18 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -159,27 +159,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -291,6 +293,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -324,6 +341,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -332,6 +354,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -344,7 +367,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -426,7 +448,7 @@
+ # SCSI Transport Attributes
+ #
+ # CONFIG_SCSI_SPI_ATTRS is not set
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=m
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ CONFIG_SCSI_SAS_ATTRS=m
+ 
+@@ -455,13 +477,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=m
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -528,6 +544,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -567,6 +584,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -592,8 +610,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -675,6 +691,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -682,7 +699,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -719,6 +735,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -777,7 +799,6 @@
+ # CONFIG_FB_3DFX is not set
+ # CONFIG_FB_VOODOO1 is not set
+ # CONFIG_FB_SMIVGX is not set
+-# CONFIG_FB_CYBLA is not set
+ # CONFIG_FB_TRIDENT is not set
+ # CONFIG_FB_VIRTUAL is not set
+ 
+@@ -861,6 +882,7 @@
+ # CONFIG_XFS_SECURITY is not set
+ # CONFIG_XFS_POSIX_ACL is not set
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -893,6 +915,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -999,6 +1022,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1052,3 +1076,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=y
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ocelot_c_defconfig linux-2.6.16/arch/mips/configs/ocelot_c_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ocelot_c_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ocelot_c_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:43 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:19 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -154,26 +154,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -220,7 +222,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-# CONFIG_BUILD_ELF64 is not set
+ CONFIG_MIPS32_COMPAT=y
+ CONFIG_COMPAT=y
+ CONFIG_MIPS32_O32=y
+@@ -281,6 +282,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -301,7 +307,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -420,6 +425,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -440,6 +446,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -461,8 +468,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -538,6 +543,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -545,7 +551,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -583,6 +588,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -664,11 +675,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -701,6 +712,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -763,6 +775,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ocelot_defconfig linux-2.6.16/arch/mips/configs/ocelot_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ocelot_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ocelot_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:44 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:20 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -159,26 +159,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -280,6 +282,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -300,7 +307,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -403,6 +409,7 @@
+ #
+ CONFIG_NET_ETHERNET=y
+ # CONFIG_MII is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -492,6 +499,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -534,6 +542,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -613,11 +627,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -650,6 +664,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -712,6 +727,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/ocelot_g_defconfig linux-2.6.16/arch/mips/configs/ocelot_g_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/ocelot_g_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/ocelot_g_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:46 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:21 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -157,26 +157,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -223,7 +225,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-# CONFIG_BUILD_ELF64 is not set
+ CONFIG_MIPS32_COMPAT=y
+ CONFIG_COMPAT=y
+ CONFIG_MIPS32_O32=y
+@@ -284,6 +285,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -304,7 +310,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=y
+ CONFIG_IEEE80211_CRYPT_CCMP=y
+-CONFIG_IEEE80211_CRYPT_TKIP=y
+ 
+ #
+ # Device Drivers
+@@ -424,6 +429,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -444,6 +450,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -464,8 +471,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=y
+ 
+ #
+ # Wan interfaces
+@@ -541,6 +546,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -548,7 +554,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -586,6 +591,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -667,11 +678,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -704,6 +715,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -766,6 +778,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/pb1100_defconfig linux-2.6.16/arch/mips/configs/pb1100_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/pb1100_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/pb1100_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:48 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:22 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -153,26 +153,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -287,6 +290,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -314,6 +332,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -322,6 +345,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -334,7 +358,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -397,6 +420,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -514,6 +538,7 @@
+ # CONFIG_MII is not set
+ # CONFIG_MIPS_AU1X00_ENET is not set
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Ethernet (1000 Mbit)
+@@ -619,13 +644,13 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ # CONFIG_SERIAL_8250_CS is not set
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+ CONFIG_UNIX98_PTYS=y
+@@ -670,6 +695,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -767,6 +798,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -799,6 +831,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -903,6 +936,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -957,3 +991,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/pb1500_defconfig linux-2.6.16/arch/mips/configs/pb1500_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/pb1500_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/pb1500_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:50 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:24 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -152,26 +152,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -293,6 +296,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -320,6 +338,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -328,6 +351,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -340,7 +364,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -403,6 +426,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -589,6 +613,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -609,6 +634,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -629,8 +655,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # PCMCIA network device support
+@@ -728,16 +752,15 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ # CONFIG_SERIAL_8250_CS is not set
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -782,6 +805,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -874,6 +903,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -906,6 +936,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1010,6 +1041,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1064,3 +1096,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/pb1550_defconfig linux-2.6.16/arch/mips/configs/pb1550_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/pb1550_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/pb1550_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:52 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:25 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -152,26 +152,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -293,6 +296,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -320,6 +338,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -328,6 +351,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -340,7 +364,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -403,6 +426,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -589,6 +613,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_SMC91X is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -609,6 +634,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -629,8 +655,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # PCMCIA network device support
+@@ -720,16 +744,15 @@
+ CONFIG_SERIAL_8250_CONSOLE=y
+ # CONFIG_SERIAL_8250_CS is not set
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ CONFIG_SERIAL_8250_AU1X00=y
+ 
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_AU1X00 is not set
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -774,6 +797,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -866,6 +895,7 @@
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -898,6 +928,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1002,6 +1033,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1056,3 +1088,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=m
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/pnx8550-jbs_defconfig linux-2.6.16/arch/mips/configs/pnx8550-jbs_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/pnx8550-jbs_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/pnx8550-jbs_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:54 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:26 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -151,28 +151,30 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_ALL is not set
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -281,6 +283,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -308,7 +315,7 @@
+ #
+ CONFIG_STANDALONE=y
+ CONFIG_PREVENT_FIRMWARE_BUILD=y
+-# CONFIG_FW_LOADER is not set
++CONFIG_FW_LOADER=y
+ # CONFIG_DEBUG_DRIVER is not set
+ 
+ #
+@@ -435,7 +442,7 @@
+ # SCSI Transport Attributes
+ #
+ # CONFIG_SCSI_SPI_ATTRS is not set
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=y
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ # CONFIG_SCSI_SAS_ATTRS is not set
+ 
+@@ -464,13 +471,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -528,6 +529,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -571,6 +573,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -668,7 +671,6 @@
+ # Non-8250 serial port support
+ #
+ # CONFIG_SERIAL_IP3106 is not set
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -706,6 +708,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -801,6 +809,8 @@
+ CONFIG_USB_STORAGE_SDDR09=y
+ CONFIG_USB_STORAGE_SDDR55=y
+ CONFIG_USB_STORAGE_JUMPSHOT=y
++# CONFIG_USB_STORAGE_ALAUDA is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+@@ -823,6 +833,7 @@
+ # CONFIG_USB_YEALINK is not set
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -906,11 +917,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -946,6 +957,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ # CONFIG_RELAYFS_FS is not set
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1049,18 +1061,20 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
+-CONFIG_DEBUG_KERNEL=y
+ CONFIG_MAGIC_SYSRQ=y
++CONFIG_DEBUG_KERNEL=y
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_DETECT_SOFTLOCKUP=y
+ # CONFIG_SCHEDSTATS is not set
+ CONFIG_DEBUG_SLAB=y
++CONFIG_DEBUG_MUTEXES=y
+ # CONFIG_DEBUG_SPINLOCK is not set
+ # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+ # CONFIG_DEBUG_KOBJECT is not set
+ # CONFIG_DEBUG_INFO is not set
+ # CONFIG_DEBUG_FS is not set
+ # CONFIG_DEBUG_VM is not set
++CONFIG_FORCED_INLINING=y
+ # CONFIG_RCU_TORTURE_TEST is not set
+ CONFIG_CROSSCOMPILE=y
+ CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp"
+diff -Naur linux-2.6.16.orig/arch/mips/configs/pnx8550-v2pci_defconfig linux-2.6.16/arch/mips/configs/pnx8550-v2pci_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/pnx8550-v2pci_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/pnx8550-v2pci_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:06:58 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:28 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -152,27 +152,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -279,6 +281,21 @@
+ #
+ # CONFIG_NETFILTER_NETLINK is not set
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -312,6 +329,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -320,6 +342,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -339,7 +362,7 @@
+ #
+ CONFIG_STANDALONE=y
+ CONFIG_PREVENT_FIRMWARE_BUILD=y
+-# CONFIG_FW_LOADER is not set
++CONFIG_FW_LOADER=y
+ 
+ #
+ # Connector - unified userspace <-> kernelspace linker
+@@ -466,7 +489,7 @@
+ # SCSI Transport Attributes
+ #
+ CONFIG_SCSI_SPI_ATTRS=m
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=y
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ # CONFIG_SCSI_SAS_ATTRS is not set
+ 
+@@ -500,13 +523,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -564,6 +581,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -607,6 +625,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -721,6 +740,7 @@
+ # CONFIG_MOXA_SMARTIO is not set
+ # CONFIG_ISI is not set
+ # CONFIG_SYNCLINKMP is not set
++# CONFIG_SYNCLINK_GT is not set
+ # CONFIG_N_HDLC is not set
+ # CONFIG_RISCOM8 is not set
+ # CONFIG_SPECIALIX is not set
+@@ -737,7 +757,6 @@
+ # Non-8250 serial port support
+ #
+ # CONFIG_SERIAL_IP3106 is not set
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -825,6 +844,12 @@
+ # CONFIG_I2C_DEBUG_CHIP is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -863,6 +888,7 @@
+ # CONFIG_SENSORS_SMSC47M1 is not set
+ # CONFIG_SENSORS_SMSC47B397 is not set
+ # CONFIG_SENSORS_VIA686A is not set
++# CONFIG_SENSORS_VT8231 is not set
+ # CONFIG_SENSORS_W83781D is not set
+ # CONFIG_SENSORS_W83792D is not set
+ # CONFIG_SENSORS_W83L785TS is not set
+@@ -918,7 +944,6 @@
+ # CONFIG_FB_3DFX is not set
+ # CONFIG_FB_VOODOO1 is not set
+ # CONFIG_FB_SMIVGX is not set
+-# CONFIG_FB_CYBLA is not set
+ # CONFIG_FB_TRIDENT is not set
+ # CONFIG_FB_VIRTUAL is not set
+ 
+@@ -988,13 +1013,16 @@
+ # CONFIG_USB_STORAGE_SDDR09 is not set
+ # CONFIG_USB_STORAGE_SDDR55 is not set
+ # CONFIG_USB_STORAGE_JUMPSHOT is not set
++# CONFIG_USB_STORAGE_ALAUDA is not set
+ # CONFIG_USB_STORAGE_ONETOUCH is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+ #
+ CONFIG_USB_HID=y
+ CONFIG_USB_HIDINPUT=y
++# CONFIG_USB_HIDINPUT_POWERBOOK is not set
+ # CONFIG_HID_FF is not set
+ CONFIG_USB_HIDDEV=y
+ # CONFIG_USB_AIPTEK is not set
+@@ -1008,6 +1036,7 @@
+ # CONFIG_USB_YEALINK is not set
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -1107,6 +1136,7 @@
+ # CONFIG_XFS_SECURITY is not set
+ # CONFIG_XFS_POSIX_ACL is not set
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -1142,6 +1172,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ # CONFIG_RELAYFS_FS is not set
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1246,6 +1277,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1299,3 +1331,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=y
+ CONFIG_ZLIB_DEFLATE=m
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/qemu_defconfig linux-2.6.16/arch/mips/configs/qemu_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/qemu_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/qemu_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+ # Linux kernel version: 2.6.16-rc2
+-# Fri Feb  3 17:14:27 2006
++# Sun Feb 12 19:18:55 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -133,7 +133,6 @@
+ # Code maturity level options
+ #
+ # CONFIG_EXPERIMENTAL is not set
+-CONFIG_CLEAN_COMPILE=y
+ CONFIG_BROKEN_ON_SMP=y
+ CONFIG_INIT_ENV_ARG_LIMIT=32
+ 
+@@ -145,7 +144,7 @@
+ # CONFIG_SWAP is not set
+ # CONFIG_SYSVIPC is not set
+ # CONFIG_BSD_PROCESS_ACCT is not set
+-# CONFIG_SYSCTL is not set
++CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
+@@ -222,6 +221,7 @@
+ #
+ # Networking options
+ #
++# CONFIG_NETDEBUG is not set
+ CONFIG_PACKET=y
+ CONFIG_PACKET_MMAP=y
+ CONFIG_UNIX=y
+@@ -476,8 +476,9 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_UNIX98_PTYS is not set
+-# CONFIG_LEGACY_PTYS is not set
++CONFIG_UNIX98_PTYS=y
++CONFIG_LEGACY_PTYS=y
++CONFIG_LEGACY_PTY_COUNT=256
+ 
+ #
+ # IPMI
+@@ -627,7 +628,7 @@
+ #
+ CONFIG_PROC_FS=y
+ CONFIG_PROC_KCORE=y
+-# CONFIG_SYSFS is not set
++CONFIG_SYSFS=y
+ # CONFIG_TMPFS is not set
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+@@ -680,12 +681,13 @@
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+-CONFIG_CMDLINE="console=ttyS0 debug ip=172.20.0.2:172.20.0.1::255.255.0.0"
++CONFIG_CMDLINE=""
+ 
+ #
+ # Security options
+ #
+ # CONFIG_KEYS is not set
++# CONFIG_SECURITY is not set
+ 
+ #
+ # Cryptographic options
+diff -Naur linux-2.6.16.orig/arch/mips/configs/rbhma4500_defconfig linux-2.6.16/arch/mips/configs/rbhma4500_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/rbhma4500_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/rbhma4500_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:03 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:30 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -160,27 +160,30 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-# CONFIG_KOBJECT_UEVENT is not set
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ # CONFIG_FUTEX is not set
+ # CONFIG_EPOLL is not set
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
++CONFIG_OBSOLETE_INTERMODULE=y
+ 
+ #
+ # Loadable module support
+@@ -291,6 +294,21 @@
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
+ # CONFIG_NF_CONNTRACK is not set
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -324,6 +342,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -332,6 +355,7 @@
+ # QoS and/or fair queueing
+ #
+ # CONFIG_NET_SCHED is not set
++CONFIG_NET_CLS_ROUTE=y
+ 
+ #
+ # Network testing
+@@ -407,6 +431,7 @@
+ # CONFIG_MTD_RAM is not set
+ # CONFIG_MTD_ROM is not set
+ # CONFIG_MTD_ABSENT is not set
++# CONFIG_MTD_OBSOLETE_CHIPS is not set
+ 
+ #
+ # Mapping drivers for chip access
+@@ -598,6 +623,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_NET_VENDOR_SMC is not set
++# CONFIG_DM9000 is not set
+ # CONFIG_NET_VENDOR_RACAL is not set
+ 
+ #
+@@ -654,6 +680,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -687,8 +714,8 @@
+ # Wireless 802.11b ISA/PCI cards support
+ #
+ # CONFIG_IPW2100 is not set
+-# CONFIG_IPW_DEBUG is not set
+ CONFIG_IPW2200=m
++# CONFIG_IPW2200_DEBUG is not set
+ # CONFIG_HERMES is not set
+ # CONFIG_ATMEL is not set
+ 
+@@ -795,7 +822,6 @@
+ # Non-8250 serial port support
+ #
+ CONFIG_HAS_TXX9_SERIAL=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -833,6 +859,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -887,7 +919,6 @@
+ CONFIG_FB_ATY=y
+ CONFIG_FB_ATY_CT=y
+ # CONFIG_FB_ATY_GENERIC_LCD is not set
+-# CONFIG_FB_ATY_XL_INIT is not set
+ # CONFIG_FB_ATY_GX is not set
+ # CONFIG_FB_SAVAGE is not set
+ # CONFIG_FB_SIS is not set
+@@ -896,7 +927,6 @@
+ # CONFIG_FB_3DFX is not set
+ # CONFIG_FB_VOODOO1 is not set
+ # CONFIG_FB_SMIVGX is not set
+-# CONFIG_FB_CYBLA is not set
+ # CONFIG_FB_TRIDENT is not set
+ # CONFIG_FB_VIRTUAL is not set
+ 
+@@ -958,12 +988,14 @@
+ # may also be needed; see USB_STORAGE Help for more information
+ #
+ # CONFIG_USB_STORAGE is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+ #
+ CONFIG_USB_HID=y
+ CONFIG_USB_HIDINPUT=y
++# CONFIG_USB_HIDINPUT_POWERBOOK is not set
+ # CONFIG_HID_FF is not set
+ CONFIG_USB_HIDDEV=y
+ # CONFIG_USB_AIPTEK is not set
+@@ -977,6 +1009,7 @@
+ CONFIG_USB_YEALINK=m
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -1078,6 +1111,7 @@
+ # CONFIG_XFS_SECURITY is not set
+ # CONFIG_XFS_POSIX_ACL is not set
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -1115,6 +1149,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1228,6 +1263,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+@@ -1281,3 +1317,7 @@
+ CONFIG_LIBCRC32C=m
+ CONFIG_ZLIB_INFLATE=y
+ CONFIG_ZLIB_DEFLATE=y
++CONFIG_TEXTSEARCH=y
++CONFIG_TEXTSEARCH_KMP=m
++CONFIG_TEXTSEARCH_BM=m
++CONFIG_TEXTSEARCH_FSM=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/rm200_defconfig linux-2.6.16/arch/mips/configs/rm200_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/rm200_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/rm200_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:06 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:31 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -161,27 +161,29 @@
+ # CONFIG_BSD_PROCESS_ACCT_V3 is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -297,6 +299,28 @@
+ CONFIG_NETFILTER_NETLINK=m
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_HELPER=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STATE=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -315,39 +339,23 @@
+ CONFIG_IP_NF_PPTP=m
+ CONFIG_IP_NF_QUEUE=m
+ CONFIG_IP_NF_IPTABLES=m
+-CONFIG_IP_NF_MATCH_LIMIT=m
+ CONFIG_IP_NF_MATCH_IPRANGE=m
+-CONFIG_IP_NF_MATCH_MAC=m
+-CONFIG_IP_NF_MATCH_PKTTYPE=m
+-CONFIG_IP_NF_MATCH_MARK=m
+ CONFIG_IP_NF_MATCH_MULTIPORT=m
+ CONFIG_IP_NF_MATCH_TOS=m
+ CONFIG_IP_NF_MATCH_RECENT=m
+ CONFIG_IP_NF_MATCH_ECN=m
+ CONFIG_IP_NF_MATCH_DSCP=m
+ CONFIG_IP_NF_MATCH_AH_ESP=m
+-CONFIG_IP_NF_MATCH_LENGTH=m
+ CONFIG_IP_NF_MATCH_TTL=m
+-CONFIG_IP_NF_MATCH_TCPMSS=m
+-CONFIG_IP_NF_MATCH_HELPER=m
+-CONFIG_IP_NF_MATCH_STATE=m
+-CONFIG_IP_NF_MATCH_CONNTRACK=m
+ CONFIG_IP_NF_MATCH_OWNER=m
+-CONFIG_IP_NF_MATCH_PHYSDEV=m
+ CONFIG_IP_NF_MATCH_ADDRTYPE=m
+-CONFIG_IP_NF_MATCH_REALM=m
+-CONFIG_IP_NF_MATCH_SCTP=m
+-CONFIG_IP_NF_MATCH_DCCP=m
+-CONFIG_IP_NF_MATCH_COMMENT=m
+-CONFIG_IP_NF_MATCH_CONNMARK=m
+ CONFIG_IP_NF_MATCH_HASHLIMIT=m
+-CONFIG_IP_NF_MATCH_STRING=m
++CONFIG_IP_NF_MATCH_POLICY=m
+ CONFIG_IP_NF_FILTER=m
+ CONFIG_IP_NF_TARGET_REJECT=m
+ CONFIG_IP_NF_TARGET_LOG=m
+ CONFIG_IP_NF_TARGET_ULOG=m
+ CONFIG_IP_NF_TARGET_TCPMSS=m
+-CONFIG_IP_NF_TARGET_NFQUEUE=m
+ CONFIG_IP_NF_NAT=m
+ CONFIG_IP_NF_NAT_NEEDED=y
+ CONFIG_IP_NF_TARGET_MASQUERADE=m
+@@ -364,13 +372,9 @@
+ CONFIG_IP_NF_TARGET_TOS=m
+ CONFIG_IP_NF_TARGET_ECN=m
+ CONFIG_IP_NF_TARGET_DSCP=m
+-CONFIG_IP_NF_TARGET_MARK=m
+-CONFIG_IP_NF_TARGET_CLASSIFY=m
+ CONFIG_IP_NF_TARGET_TTL=m
+-CONFIG_IP_NF_TARGET_CONNMARK=m
+ CONFIG_IP_NF_TARGET_CLUSTERIP=m
+ CONFIG_IP_NF_RAW=m
+-CONFIG_IP_NF_TARGET_NOTRACK=m
+ CONFIG_IP_NF_ARPTABLES=m
+ CONFIG_IP_NF_ARPFILTER=m
+ CONFIG_IP_NF_ARP_MANGLE=m
+@@ -380,26 +384,20 @@
+ #
+ CONFIG_IP6_NF_QUEUE=m
+ CONFIG_IP6_NF_IPTABLES=m
+-CONFIG_IP6_NF_MATCH_LIMIT=m
+-CONFIG_IP6_NF_MATCH_MAC=m
+ CONFIG_IP6_NF_MATCH_RT=m
+ CONFIG_IP6_NF_MATCH_OPTS=m
+ CONFIG_IP6_NF_MATCH_FRAG=m
+ CONFIG_IP6_NF_MATCH_HL=m
+ CONFIG_IP6_NF_MATCH_MULTIPORT=m
+ CONFIG_IP6_NF_MATCH_OWNER=m
+-CONFIG_IP6_NF_MATCH_MARK=m
+ CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+ CONFIG_IP6_NF_MATCH_AHESP=m
+-CONFIG_IP6_NF_MATCH_LENGTH=m
+ CONFIG_IP6_NF_MATCH_EUI64=m
+-CONFIG_IP6_NF_MATCH_PHYSDEV=m
++CONFIG_IP6_NF_MATCH_POLICY=m
+ CONFIG_IP6_NF_FILTER=m
+ CONFIG_IP6_NF_TARGET_LOG=m
+ CONFIG_IP6_NF_TARGET_REJECT=m
+-CONFIG_IP6_NF_TARGET_NFQUEUE=m
+ CONFIG_IP6_NF_MANGLE=m
+-CONFIG_IP6_NF_TARGET_MARK=m
+ CONFIG_IP6_NF_TARGET_HL=m
+ CONFIG_IP6_NF_RAW=m
+ 
+@@ -451,6 +449,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -530,7 +533,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -541,7 +543,7 @@
+ #
+ CONFIG_STANDALONE=y
+ CONFIG_PREVENT_FIRMWARE_BUILD=y
+-CONFIG_FW_LOADER=m
++CONFIG_FW_LOADER=y
+ 
+ #
+ # Connector - unified userspace <-> kernelspace linker
+@@ -657,7 +659,7 @@
+ # SCSI Transport Attributes
+ #
+ CONFIG_SCSI_SPI_ATTRS=y
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=y
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ CONFIG_SCSI_SAS_ATTRS=m
+ 
+@@ -678,6 +680,7 @@
+ CONFIG_MEGARAID_NEWGEN=y
+ CONFIG_MEGARAID_MM=m
+ CONFIG_MEGARAID_MAILBOX=m
++# CONFIG_MEGARAID_LEGACY is not set
+ # CONFIG_MEGARAID_SAS is not set
+ # CONFIG_SCSI_SATA is not set
+ # CONFIG_SCSI_DMX3191D is not set
+@@ -704,13 +707,7 @@
+ # CONFIG_SCSI_QLOGIC_FAS is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_SYM53C416 is not set
+ # CONFIG_SCSI_DC395x is not set
+@@ -801,6 +798,7 @@
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_NET_VENDOR_SMC is not set
++# CONFIG_DM9000 is not set
+ # CONFIG_NET_VENDOR_RACAL is not set
+ 
+ #
+@@ -858,6 +856,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ CONFIG_VIA_VELOCITY=m
+ # CONFIG_TIGON3 is not set
+@@ -879,8 +878,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -969,6 +966,7 @@
+ #
+ CONFIG_SERIAL_8250=m
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ CONFIG_SERIAL_8250_EXTENDED=y
+ # CONFIG_SERIAL_8250_MANY_PORTS is not set
+ CONFIG_SERIAL_8250_SHARE_IRQ=y
+@@ -979,7 +977,6 @@
+ # Non-8250 serial port support
+ #
+ CONFIG_SERIAL_CORE=m
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -1021,6 +1018,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ CONFIG_W1=m
+@@ -1123,12 +1126,15 @@
+ CONFIG_USB_STORAGE_SDDR09=y
+ CONFIG_USB_STORAGE_SDDR55=y
+ CONFIG_USB_STORAGE_JUMPSHOT=y
++# CONFIG_USB_STORAGE_ALAUDA is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+ #
+ CONFIG_USB_HID=m
+ CONFIG_USB_HIDINPUT=y
++# CONFIG_USB_HIDINPUT_POWERBOOK is not set
+ CONFIG_HID_FF=y
+ CONFIG_HID_PID=y
+ CONFIG_LOGITECH_FF=y
+@@ -1151,6 +1157,7 @@
+ CONFIG_USB_YEALINK=m
+ CONFIG_USB_XPAD=m
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -1309,6 +1316,7 @@
+ CONFIG_XFS_SECURITY=y
+ # CONFIG_XFS_POSIX_ACL is not set
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ CONFIG_MINIX_FS=m
+ CONFIG_ROMFS_FS=m
+ CONFIG_INOTIFY=y
+@@ -1351,6 +1359,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1432,6 +1441,7 @@
+ # CONFIG_SGI_PARTITION is not set
+ # CONFIG_ULTRIX_PARTITION is not set
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -1487,6 +1497,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/sb1250-swarm_defconfig linux-2.6.16/arch/mips/configs/sb1250-swarm_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/sb1250-swarm_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/sb1250-swarm_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:09 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:32 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -173,27 +173,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_CPUSETS=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -247,7 +249,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-# CONFIG_BUILD_ELF64 is not set
+ CONFIG_MIPS32_COMPAT=y
+ CONFIG_COMPAT=y
+ CONFIG_MIPS32_O32=y
+@@ -309,6 +310,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -329,7 +335,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -472,6 +477,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -493,6 +499,7 @@
+ CONFIG_NET_SB1250_MAC=y
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_TIGON3 is not set
+ # CONFIG_BNX2 is not set
+@@ -513,8 +520,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -560,12 +565,15 @@
+ #
+ # CONFIG_VT is not set
+ CONFIG_SERIAL_NONSTANDARD=y
++# CONFIG_COMPUTONE is not set
+ # CONFIG_ROCKETPORT is not set
+ # CONFIG_CYCLADES is not set
+ # CONFIG_DIGIEPCA is not set
++# CONFIG_MOXA_INTELLIO is not set
+ # CONFIG_MOXA_SMARTIO is not set
+ # CONFIG_ISI is not set
+ # CONFIG_SYNCLINKMP is not set
++# CONFIG_SYNCLINK_GT is not set
+ # CONFIG_N_HDLC is not set
+ # CONFIG_SPECIALIX is not set
+ # CONFIG_SX is not set
+@@ -581,7 +589,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -619,6 +626,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -696,12 +709,12 @@
+ CONFIG_EXT2_FS_SECURITY=y
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ CONFIG_FS_MBCACHE=y
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -734,6 +747,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -795,6 +809,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=15
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/sead_defconfig linux-2.6.16/arch/mips/configs/sead_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/sead_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/sead_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:10 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:33 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -153,25 +153,28 @@
+ CONFIG_SYSVIPC=y
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+-# CONFIG_HOTPLUG is not set
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -330,6 +333,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -372,6 +376,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -444,7 +454,6 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+@@ -481,6 +490,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=y
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -513,6 +523,7 @@
+ # CONFIG_SGI_PARTITION is not set
+ # CONFIG_ULTRIX_PARTITION is not set
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -529,6 +540,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/tb0226_defconfig linux-2.6.16/arch/mips/configs/tb0226_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/tb0226_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/tb0226_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:12 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:34 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -63,11 +63,12 @@
+ # CONFIG_TOSHIBA_JMR3927 is not set
+ # CONFIG_TOSHIBA_RBTX4927 is not set
+ # CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_CASIO_E55 is not set
+ # CONFIG_IBM_WORKPAD is not set
++# CONFIG_NEC_CMBVR4133 is not set
+ CONFIG_TANBAC_TB022X=y
+ CONFIG_TANBAC_TB0226=y
++CONFIG_TANBAC_TB0287=y
+ # CONFIG_VICTOR_MPC30X is not set
+ # CONFIG_ZAO_CAPCELLA is not set
+ CONFIG_PCI_VR41XX=y
+@@ -91,7 +92,7 @@
+ # CONFIG_CPU_MIPS64_R2 is not set
+ # CONFIG_CPU_R3000 is not set
+ # CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
++# CONFIG_CPU_VR41XX is not set
+ # CONFIG_CPU_R4300 is not set
+ # CONFIG_CPU_R4X00 is not set
+ # CONFIG_CPU_TX49XX is not set
+@@ -104,23 +105,18 @@
+ # CONFIG_CPU_RM7000 is not set
+ # CONFIG_CPU_RM9000 is not set
+ # CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_HAS_CPU_VR41XX=y
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+ 
+ #
+ # Kernel type
+ #
+-CONFIG_32BIT=y
++# CONFIG_32BIT is not set
+ # CONFIG_64BIT is not set
+ CONFIG_PAGE_SIZE_4KB=y
+ # CONFIG_PAGE_SIZE_8KB is not set
+ # CONFIG_PAGE_SIZE_16KB is not set
+ # CONFIG_PAGE_SIZE_64KB is not set
+ # CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
++CONFIG_CPU_HAS_LLSC=y
+ CONFIG_CPU_HAS_SYNC=y
+ CONFIG_GENERIC_HARDIRQS=y
+ CONFIG_GENERIC_IRQ_PROBE=y
+@@ -156,26 +152,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -191,7 +189,6 @@
+ #
+ # Block layer
+ #
+-# CONFIG_LBD is not set
+ 
+ #
+ # IO Schedulers
+@@ -229,7 +226,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+ 
+ #
+ # Networking
+@@ -293,6 +289,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -313,7 +314,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -324,7 +324,7 @@
+ #
+ CONFIG_STANDALONE=y
+ CONFIG_PREVENT_FIRMWARE_BUILD=y
+-# CONFIG_FW_LOADER is not set
++CONFIG_FW_LOADER=y
+ 
+ #
+ # Connector - unified userspace <-> kernelspace linker
+@@ -397,7 +397,7 @@
+ # SCSI Transport Attributes
+ #
+ # CONFIG_SCSI_SPI_ATTRS is not set
+-# CONFIG_SCSI_FC_ATTRS is not set
++CONFIG_SCSI_FC_ATTRS=y
+ CONFIG_SCSI_ISCSI_ATTRS=m
+ # CONFIG_SCSI_SAS_ATTRS is not set
+ 
+@@ -426,13 +426,7 @@
+ # CONFIG_SCSI_IPR is not set
+ # CONFIG_SCSI_QLOGIC_FC is not set
+ # CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
++# CONFIG_SCSI_QLA_FC is not set
+ # CONFIG_SCSI_LPFC is not set
+ # CONFIG_SCSI_DC395x is not set
+ # CONFIG_SCSI_DC390T is not set
+@@ -499,6 +493,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -538,6 +533,7 @@
+ # CONFIG_R8169 is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -559,7 +555,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW2200 is not set
+ 
+ #
+ # Wan interfaces
+@@ -630,11 +625,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -650,7 +640,6 @@
+ # CONFIG_WATCHDOG is not set
+ # CONFIG_RTC is not set
+ # CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+ # CONFIG_DTLK is not set
+ # CONFIG_R3964 is not set
+ # CONFIG_APPLICOM is not set
+@@ -675,6 +664,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -770,6 +765,8 @@
+ # CONFIG_USB_STORAGE_SDDR09 is not set
+ # CONFIG_USB_STORAGE_SDDR55 is not set
+ # CONFIG_USB_STORAGE_JUMPSHOT is not set
++# CONFIG_USB_STORAGE_ALAUDA is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+@@ -792,6 +789,7 @@
+ # CONFIG_USB_YEALINK is not set
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -877,11 +875,11 @@
+ # CONFIG_EXT2_FS_XATTR is not set
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ CONFIG_ROMFS_FS=m
+ CONFIG_INOTIFY=y
+@@ -914,6 +912,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1021,6 +1020,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/tb0229_defconfig linux-2.6.16/arch/mips/configs/tb0229_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/tb0229_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/tb0229_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:15 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:35 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -63,11 +63,12 @@
+ # CONFIG_TOSHIBA_JMR3927 is not set
+ # CONFIG_TOSHIBA_RBTX4927 is not set
+ # CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_CASIO_E55 is not set
+ # CONFIG_IBM_WORKPAD is not set
++# CONFIG_NEC_CMBVR4133 is not set
+ CONFIG_TANBAC_TB022X=y
+ # CONFIG_TANBAC_TB0226 is not set
++CONFIG_TANBAC_TB0287=y
+ # CONFIG_VICTOR_MPC30X is not set
+ # CONFIG_ZAO_CAPCELLA is not set
+ CONFIG_PCI_VR41XX=y
+@@ -91,7 +92,7 @@
+ # CONFIG_CPU_MIPS64_R2 is not set
+ # CONFIG_CPU_R3000 is not set
+ # CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
++# CONFIG_CPU_VR41XX is not set
+ # CONFIG_CPU_R4300 is not set
+ # CONFIG_CPU_R4X00 is not set
+ # CONFIG_CPU_TX49XX is not set
+@@ -104,23 +105,18 @@
+ # CONFIG_CPU_RM7000 is not set
+ # CONFIG_CPU_RM9000 is not set
+ # CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_HAS_CPU_VR41XX=y
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+ 
+ #
+ # Kernel type
+ #
+-CONFIG_32BIT=y
++# CONFIG_32BIT is not set
+ # CONFIG_64BIT is not set
+ CONFIG_PAGE_SIZE_4KB=y
+ # CONFIG_PAGE_SIZE_8KB is not set
+ # CONFIG_PAGE_SIZE_16KB is not set
+ # CONFIG_PAGE_SIZE_64KB is not set
+ # CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
++CONFIG_CPU_HAS_LLSC=y
+ CONFIG_CPU_HAS_SYNC=y
+ CONFIG_GENERIC_HARDIRQS=y
+ CONFIG_GENERIC_IRQ_PROBE=y
+@@ -156,26 +152,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -191,7 +189,6 @@
+ #
+ # Block layer
+ #
+-# CONFIG_LBD is not set
+ 
+ #
+ # IO Schedulers
+@@ -229,7 +226,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+ 
+ #
+ # Networking
+@@ -294,6 +290,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -314,7 +315,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -436,6 +436,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -480,6 +481,7 @@
+ # CONFIG_R8169_NAPI is not set
+ # CONFIG_SIS190 is not set
+ # CONFIG_SKGE is not set
++# CONFIG_SKY2 is not set
+ # CONFIG_SK98LIN is not set
+ # CONFIG_VIA_VELOCITY is not set
+ # CONFIG_TIGON3 is not set
+@@ -501,8 +503,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -583,11 +583,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -603,7 +598,6 @@
+ # CONFIG_WATCHDOG is not set
+ # CONFIG_RTC is not set
+ # CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+ # CONFIG_DTLK is not set
+ # CONFIG_R3964 is not set
+ # CONFIG_APPLICOM is not set
+@@ -613,7 +607,6 @@
+ # Ftape, the floppy tape device driver
+ #
+ # CONFIG_DRM is not set
+-CONFIG_GPIO_VR41XX=y
+ # CONFIG_RAW_DRIVER is not set
+ 
+ #
+@@ -628,6 +621,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -715,6 +714,7 @@
+ # may also be needed; see USB_STORAGE Help for more information
+ #
+ # CONFIG_USB_STORAGE is not set
++# CONFIG_USB_LIBUSUAL is not set
+ 
+ #
+ # USB Input Devices
+@@ -737,6 +737,7 @@
+ # CONFIG_USB_YEALINK is not set
+ # CONFIG_USB_XPAD is not set
+ # CONFIG_USB_ATI_REMOTE is not set
++# CONFIG_USB_ATI_REMOTE2 is not set
+ # CONFIG_USB_KEYSPAN_REMOTE is not set
+ # CONFIG_USB_APPLETOUCH is not set
+ 
+@@ -840,6 +841,7 @@
+ # CONFIG_XFS_SECURITY is not set
+ CONFIG_XFS_POSIX_ACL=y
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ CONFIG_ROMFS_FS=m
+ CONFIG_INOTIFY=y
+@@ -879,6 +881,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -986,6 +989,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/tb0287_defconfig linux-2.6.16/arch/mips/configs/tb0287_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/tb0287_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/tb0287_defconfig	1970-01-01 00:00:00.000000000 +0000
+@@ -1,1105 +0,0 @@
+-#
+-# Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.14-rc5-mm1
+-# Tue Oct 25 00:20:22 2005
+-#
+-CONFIG_MIPS=y
+-
+-#
+-# Code maturity level options
+-#
+-CONFIG_EXPERIMENTAL=y
+-CONFIG_CLEAN_COMPILE=y
+-CONFIG_BROKEN_ON_SMP=y
+-CONFIG_INIT_ENV_ARG_LIMIT=32
+-
+-#
+-# General setup
+-#
+-CONFIG_LOCALVERSION=""
+-CONFIG_LOCALVERSION_AUTO=y
+-CONFIG_SWAP=y
+-CONFIG_SWAP_PREFETCH=y
+-CONFIG_SYSVIPC=y
+-# CONFIG_POSIX_MQUEUE is not set
+-# CONFIG_BSD_PROCESS_ACCT is not set
+-CONFIG_SYSCTL=y
+-# CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+-# CONFIG_IKCONFIG is not set
+-CONFIG_INITRAMFS_SOURCE=""
+-CONFIG_EMBEDDED=y
+-CONFIG_KALLSYMS=y
+-# CONFIG_KALLSYMS_EXTRA_PASS is not set
+-CONFIG_PRINTK=y
+-CONFIG_BUG=y
+-CONFIG_BASE_FULL=y
+-CONFIG_FUTEX=y
+-CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+-CONFIG_SHMEM=y
+-CONFIG_CC_ALIGN_FUNCTIONS=0
+-CONFIG_CC_ALIGN_LABELS=0
+-CONFIG_CC_ALIGN_LOOPS=0
+-CONFIG_CC_ALIGN_JUMPS=0
+-# CONFIG_TINY_SHMEM is not set
+-CONFIG_BASE_SMALL=0
+-
+-#
+-# Loadable module support
+-#
+-CONFIG_MODULES=y
+-CONFIG_MODULE_UNLOAD=y
+-# CONFIG_MODULE_FORCE_UNLOAD is not set
+-CONFIG_OBSOLETE_MODPARM=y
+-CONFIG_MODVERSIONS=y
+-CONFIG_MODULE_SRCVERSION_ALL=y
+-CONFIG_KMOD=y
+-
+-#
+-# Machine selection
+-#
+-# CONFIG_MIPS_MTX1 is not set
+-# CONFIG_MIPS_BOSPORUS is not set
+-# CONFIG_MIPS_PB1000 is not set
+-# CONFIG_MIPS_PB1100 is not set
+-# CONFIG_MIPS_PB1500 is not set
+-# CONFIG_MIPS_PB1550 is not set
+-# CONFIG_MIPS_PB1200 is not set
+-# CONFIG_MIPS_DB1000 is not set
+-# CONFIG_MIPS_DB1100 is not set
+-# CONFIG_MIPS_DB1500 is not set
+-# CONFIG_MIPS_DB1550 is not set
+-# CONFIG_MIPS_DB1200 is not set
+-# CONFIG_MIPS_MIRAGE is not set
+-# CONFIG_MIPS_COBALT is not set
+-# CONFIG_MACH_DECSTATION is not set
+-# CONFIG_MIPS_EV64120 is not set
+-# CONFIG_MIPS_EV96100 is not set
+-# CONFIG_MIPS_IVR is not set
+-# CONFIG_MIPS_ITE8172 is not set
+-# CONFIG_MACH_JAZZ is not set
+-# CONFIG_LASAT is not set
+-# CONFIG_MIPS_ATLAS is not set
+-# CONFIG_MIPS_MALTA is not set
+-# CONFIG_MIPS_SEAD is not set
+-# CONFIG_MIPS_SIM is not set
+-# CONFIG_MOMENCO_JAGUAR_ATX is not set
+-# CONFIG_MOMENCO_OCELOT is not set
+-# CONFIG_MOMENCO_OCELOT_3 is not set
+-# CONFIG_MOMENCO_OCELOT_C is not set
+-# CONFIG_MOMENCO_OCELOT_G is not set
+-# CONFIG_MIPS_XXS1500 is not set
+-# CONFIG_PNX8550_V2PCI is not set
+-# CONFIG_PNX8550_JBS is not set
+-# CONFIG_DDB5074 is not set
+-# CONFIG_DDB5476 is not set
+-# CONFIG_DDB5477 is not set
+-CONFIG_MACH_VR41XX=y
+-# CONFIG_PMC_YOSEMITE is not set
+-# CONFIG_QEMU is not set
+-# CONFIG_SGI_IP22 is not set
+-# CONFIG_SGI_IP27 is not set
+-# CONFIG_SGI_IP32 is not set
+-# CONFIG_SIBYTE_SWARM is not set
+-# CONFIG_SIBYTE_SENTOSA is not set
+-# CONFIG_SIBYTE_RHONE is not set
+-# CONFIG_SIBYTE_CARMEL is not set
+-# CONFIG_SIBYTE_PTSWARM is not set
+-# CONFIG_SIBYTE_LITTLESUR is not set
+-# CONFIG_SIBYTE_CRHINE is not set
+-# CONFIG_SIBYTE_CRHONE is not set
+-# CONFIG_SNI_RM200_PCI is not set
+-# CONFIG_TOSHIBA_JMR3927 is not set
+-# CONFIG_TOSHIBA_RBTX4927 is not set
+-# CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_CASIO_E55 is not set
+-# CONFIG_IBM_WORKPAD is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+-CONFIG_TANBAC_TB022X=y
+-# CONFIG_TANBAC_TB0226 is not set
+-CONFIG_TANBAC_TB0287=y
+-# CONFIG_VICTOR_MPC30X is not set
+-# CONFIG_ZAO_CAPCELLA is not set
+-CONFIG_PCI_VR41XX=y
+-# CONFIG_VRC4173 is not set
+-CONFIG_RWSEM_GENERIC_SPINLOCK=y
+-CONFIG_GENERIC_CALIBRATE_DELAY=y
+-CONFIG_DMA_NONCOHERENT=y
+-CONFIG_DMA_NEED_PCI_MAP_STATE=y
+-# CONFIG_CPU_BIG_ENDIAN is not set
+-CONFIG_CPU_LITTLE_ENDIAN=y
+-CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
+-CONFIG_IRQ_CPU=y
+-CONFIG_MIPS_L1_CACHE_SHIFT=5
+-
+-#
+-# CPU selection
+-#
+-# CONFIG_CPU_MIPS32_R1 is not set
+-# CONFIG_CPU_MIPS32_R2 is not set
+-# CONFIG_CPU_MIPS64_R1 is not set
+-# CONFIG_CPU_MIPS64_R2 is not set
+-# CONFIG_CPU_R3000 is not set
+-# CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
+-# CONFIG_CPU_R4300 is not set
+-# CONFIG_CPU_R4X00 is not set
+-# CONFIG_CPU_TX49XX is not set
+-# CONFIG_CPU_R5000 is not set
+-# CONFIG_CPU_R5432 is not set
+-# CONFIG_CPU_R6000 is not set
+-# CONFIG_CPU_NEVADA is not set
+-# CONFIG_CPU_R8000 is not set
+-# CONFIG_CPU_R10000 is not set
+-# CONFIG_CPU_RM7000 is not set
+-# CONFIG_CPU_RM9000 is not set
+-# CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+-
+-#
+-# Kernel type
+-#
+-CONFIG_32BIT=y
+-# CONFIG_64BIT is not set
+-CONFIG_PAGE_SIZE_4KB=y
+-# CONFIG_PAGE_SIZE_8KB is not set
+-# CONFIG_PAGE_SIZE_16KB is not set
+-# CONFIG_PAGE_SIZE_64KB is not set
+-# CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
+-CONFIG_CPU_HAS_SYNC=y
+-CONFIG_GENERIC_HARDIRQS=y
+-CONFIG_GENERIC_IRQ_PROBE=y
+-CONFIG_ARCH_FLATMEM_ENABLE=y
+-CONFIG_SELECT_MEMORY_MODEL=y
+-CONFIG_FLATMEM_MANUAL=y
+-# CONFIG_DISCONTIGMEM_MANUAL is not set
+-# CONFIG_SPARSEMEM_MANUAL is not set
+-CONFIG_FLATMEM=y
+-CONFIG_FLAT_NODE_MEM_MAP=y
+-# CONFIG_SPARSEMEM_STATIC is not set
+-CONFIG_SPLIT_PTLOCK_CPUS=4
+-CONFIG_PREEMPT_NONE=y
+-# CONFIG_PREEMPT_VOLUNTARY is not set
+-# CONFIG_PREEMPT is not set
+-
+-#
+-# Bus options (PCI, PCMCIA, EISA, ISA, TC)
+-#
+-CONFIG_HW_HAS_PCI=y
+-CONFIG_PCI=y
+-# CONFIG_PCI_LEGACY_PROC is not set
+-CONFIG_MMU=y
+-
+-#
+-# PCCARD (PCMCIA/CardBus) support
+-#
+-# CONFIG_PCCARD is not set
+-
+-#
+-# PCI Hotplug Support
+-#
+-# CONFIG_HOTPLUG_PCI is not set
+-
+-#
+-# Executable file formats
+-#
+-CONFIG_BINFMT_ELF=y
+-# CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+-
+-#
+-# Networking
+-#
+-CONFIG_NET=y
+-
+-#
+-# Networking options
+-#
+-CONFIG_PACKET=y
+-# CONFIG_PACKET_MMAP is not set
+-CONFIG_UNIX=y
+-CONFIG_XFRM=y
+-CONFIG_XFRM_USER=m
+-# CONFIG_NET_KEY is not set
+-CONFIG_INET=y
+-CONFIG_IP_MULTICAST=y
+-CONFIG_IP_ADVANCED_ROUTER=y
+-CONFIG_ASK_IP_FIB_HASH=y
+-# CONFIG_IP_FIB_TRIE is not set
+-CONFIG_IP_FIB_HASH=y
+-CONFIG_IP_MULTIPLE_TABLES=y
+-CONFIG_IP_ROUTE_MULTIPATH=y
+-# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
+-CONFIG_IP_ROUTE_VERBOSE=y
+-CONFIG_IP_PNP=y
+-# CONFIG_IP_PNP_DHCP is not set
+-CONFIG_IP_PNP_BOOTP=y
+-# CONFIG_IP_PNP_RARP is not set
+-CONFIG_NET_IPIP=m
+-CONFIG_NET_IPGRE=m
+-# CONFIG_NET_IPGRE_BROADCAST is not set
+-# CONFIG_IP_MROUTE is not set
+-# CONFIG_ARPD is not set
+-CONFIG_SYN_COOKIES=y
+-# CONFIG_INET_AH is not set
+-# CONFIG_INET_ESP is not set
+-# CONFIG_INET_IPCOMP is not set
+-CONFIG_INET_TUNNEL=m
+-CONFIG_INET_DIAG=y
+-CONFIG_INET_TCP_DIAG=y
+-CONFIG_TCP_CONG_ADVANCED=y
+-
+-#
+-# TCP congestion control
+-#
+-CONFIG_TCP_CONG_BIC=y
+-CONFIG_TCP_CONG_WESTWOOD=m
+-CONFIG_TCP_CONG_HTCP=m
+-# CONFIG_TCP_CONG_HSTCP is not set
+-# CONFIG_TCP_CONG_HYBLA is not set
+-# CONFIG_TCP_CONG_VEGAS is not set
+-# CONFIG_TCP_CONG_SCALABLE is not set
+-# CONFIG_IPV6 is not set
+-# CONFIG_NETFILTER is not set
+-
+-#
+-# DCCP Configuration (EXPERIMENTAL)
+-#
+-# CONFIG_IP_DCCP is not set
+-
+-#
+-# SCTP Configuration (EXPERIMENTAL)
+-#
+-# CONFIG_IP_SCTP is not set
+-# CONFIG_ATM is not set
+-# CONFIG_BRIDGE is not set
+-# CONFIG_VLAN_8021Q is not set
+-# CONFIG_DECNET is not set
+-# CONFIG_LLC2 is not set
+-# CONFIG_IPX is not set
+-# CONFIG_ATALK is not set
+-# CONFIG_X25 is not set
+-# CONFIG_LAPB is not set
+-# CONFIG_NET_DIVERT is not set
+-# CONFIG_ECONET is not set
+-# CONFIG_WAN_ROUTER is not set
+-# CONFIG_NET_SCHED is not set
+-# CONFIG_NET_CLS_ROUTE is not set
+-
+-#
+-# Network testing
+-#
+-# CONFIG_NET_PKTGEN is not set
+-# CONFIG_HAMRADIO is not set
+-# CONFIG_IRDA is not set
+-# CONFIG_BT is not set
+-# CONFIG_IEEE80211 is not set
+-
+-#
+-# Device Drivers
+-#
+-
+-#
+-# Generic Driver Options
+-#
+-CONFIG_STANDALONE=y
+-CONFIG_PREVENT_FIRMWARE_BUILD=y
+-# CONFIG_FW_LOADER is not set
+-
+-#
+-# Connector - unified userspace <-> kernelspace linker
+-#
+-# CONFIG_CONNECTOR is not set
+-
+-#
+-# Memory Technology Devices (MTD)
+-#
+-# CONFIG_MTD is not set
+-
+-#
+-# Parallel port support
+-#
+-# CONFIG_PARPORT is not set
+-
+-#
+-# Plug and Play support
+-#
+-
+-#
+-# Block devices
+-#
+-# CONFIG_BLK_CPQ_DA is not set
+-# CONFIG_BLK_CPQ_CISS_DA is not set
+-# CONFIG_BLK_DEV_DAC960 is not set
+-# CONFIG_BLK_DEV_UMEM is not set
+-# CONFIG_BLK_DEV_COW_COMMON is not set
+-CONFIG_BLK_DEV_LOOP=m
+-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+-CONFIG_BLK_DEV_NBD=m
+-# CONFIG_BLK_DEV_SX8 is not set
+-# CONFIG_BLK_DEV_UB is not set
+-CONFIG_BLK_DEV_RAM=y
+-CONFIG_BLK_DEV_RAM_COUNT=16
+-CONFIG_BLK_DEV_RAM_SIZE=4096
+-# CONFIG_BLK_DEV_INITRD is not set
+-# CONFIG_LBD is not set
+-# CONFIG_BLK_DEV_IO_TRACE is not set
+-# CONFIG_CDROM_PKTCDVD is not set
+-
+-#
+-# IO Schedulers
+-#
+-CONFIG_IOSCHED_NOOP=y
+-CONFIG_IOSCHED_AS=y
+-CONFIG_IOSCHED_DEADLINE=y
+-CONFIG_IOSCHED_CFQ=y
+-CONFIG_DEFAULT_AS=y
+-# CONFIG_DEFAULT_DEADLINE is not set
+-# CONFIG_DEFAULT_CFQ is not set
+-# CONFIG_DEFAULT_NOOP is not set
+-CONFIG_DEFAULT_IOSCHED="anticipatory"
+-# CONFIG_ATA_OVER_ETH is not set
+-
+-#
+-# ATA/ATAPI/MFM/RLL support
+-#
+-CONFIG_IDE=y
+-CONFIG_BLK_DEV_IDE=y
+-
+-#
+-# Please see Documentation/ide.txt for help/info on IDE drives
+-#
+-# CONFIG_BLK_DEV_IDE_SATA is not set
+-CONFIG_BLK_DEV_IDEDISK=y
+-# CONFIG_IDEDISK_MULTI_MODE is not set
+-# CONFIG_BLK_DEV_IDECD is not set
+-# CONFIG_BLK_DEV_IDETAPE is not set
+-# CONFIG_BLK_DEV_IDEFLOPPY is not set
+-# CONFIG_BLK_DEV_IDESCSI is not set
+-# CONFIG_IDE_TASK_IOCTL is not set
+-
+-#
+-# IDE chipset support/bugfixes
+-#
+-CONFIG_IDE_GENERIC=y
+-CONFIG_BLK_DEV_IDEPCI=y
+-# CONFIG_IDEPCI_SHARE_IRQ is not set
+-# CONFIG_BLK_DEV_OFFBOARD is not set
+-# CONFIG_BLK_DEV_GENERIC is not set
+-# CONFIG_BLK_DEV_OPTI621 is not set
+-CONFIG_BLK_DEV_IDEDMA_PCI=y
+-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
+-# CONFIG_IDEDMA_PCI_AUTO is not set
+-# CONFIG_BLK_DEV_AEC62XX is not set
+-# CONFIG_BLK_DEV_ALI15X3 is not set
+-# CONFIG_BLK_DEV_AMD74XX is not set
+-# CONFIG_BLK_DEV_CMD64X is not set
+-# CONFIG_BLK_DEV_TRIFLEX is not set
+-# CONFIG_BLK_DEV_CY82C693 is not set
+-# CONFIG_BLK_DEV_CS5520 is not set
+-# CONFIG_BLK_DEV_CS5530 is not set
+-# CONFIG_BLK_DEV_HPT34X is not set
+-# CONFIG_BLK_DEV_HPT366 is not set
+-# CONFIG_BLK_DEV_SC1200 is not set
+-# CONFIG_BLK_DEV_PIIX is not set
+-# CONFIG_BLK_DEV_IT821X is not set
+-# CONFIG_BLK_DEV_NS87415 is not set
+-# CONFIG_BLK_DEV_PDC202XX_OLD is not set
+-# CONFIG_BLK_DEV_PDC202XX_NEW is not set
+-# CONFIG_BLK_DEV_SVWKS is not set
+-CONFIG_BLK_DEV_SIIMAGE=y
+-# CONFIG_BLK_DEV_SLC90E66 is not set
+-# CONFIG_BLK_DEV_TRM290 is not set
+-# CONFIG_BLK_DEV_VIA82CXXX is not set
+-# CONFIG_IDE_ARM is not set
+-CONFIG_BLK_DEV_IDEDMA=y
+-# CONFIG_IDEDMA_IVB is not set
+-# CONFIG_IDEDMA_AUTO is not set
+-# CONFIG_BLK_DEV_HD is not set
+-
+-#
+-# SCSI device support
+-#
+-# CONFIG_RAID_ATTRS is not set
+-CONFIG_SCSI=y
+-CONFIG_SCSI_PROC_FS=y
+-
+-#
+-# SCSI support type (disk, tape, CD-ROM)
+-#
+-CONFIG_BLK_DEV_SD=y
+-# CONFIG_CHR_DEV_ST is not set
+-# CONFIG_CHR_DEV_OSST is not set
+-# CONFIG_BLK_DEV_SR is not set
+-# CONFIG_CHR_DEV_SG is not set
+-# CONFIG_CHR_DEV_SCH is not set
+-
+-#
+-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+-#
+-# CONFIG_SCSI_MULTI_LUN is not set
+-# CONFIG_SCSI_CONSTANTS is not set
+-# CONFIG_SCSI_LOGGING is not set
+-
+-#
+-# SCSI Transport Attributes
+-#
+-# CONFIG_SCSI_SPI_ATTRS is not set
+-# CONFIG_SCSI_FC_ATTRS is not set
+-# CONFIG_SCSI_ISCSI_ATTRS is not set
+-# CONFIG_SCSI_SAS_ATTRS is not set
+-
+-#
+-# SCSI Transport Layers
+-#
+-# CONFIG_SAS_CLASS is not set
+-
+-#
+-# SCSI low-level drivers
+-#
+-# CONFIG_ISCSI_TCP is not set
+-# CONFIG_SCSI_ARCMSR is not set
+-# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+-# CONFIG_SCSI_3W_9XXX is not set
+-# CONFIG_SCSI_ACARD is not set
+-# CONFIG_SCSI_AACRAID is not set
+-# CONFIG_SCSI_AIC7XXX is not set
+-# CONFIG_SCSI_AIC7XXX_OLD is not set
+-# CONFIG_SCSI_AIC79XX is not set
+-# CONFIG_SCSI_DPT_I2O is not set
+-# CONFIG_MEGARAID_NEWGEN is not set
+-# CONFIG_MEGARAID_LEGACY is not set
+-# CONFIG_MEGARAID_SAS is not set
+-# CONFIG_SCSI_SATA is not set
+-# CONFIG_SCSI_DMX3191D is not set
+-# CONFIG_SCSI_FUTURE_DOMAIN is not set
+-# CONFIG_SCSI_IPS is not set
+-# CONFIG_SCSI_INITIO is not set
+-# CONFIG_SCSI_INIA100 is not set
+-# CONFIG_SCSI_SYM53C8XX_2 is not set
+-# CONFIG_SCSI_IPR is not set
+-# CONFIG_SCSI_QLOGIC_FC is not set
+-# CONFIG_SCSI_QLOGIC_1280 is not set
+-CONFIG_SCSI_QLA2XXX=y
+-# CONFIG_SCSI_QLA21XX is not set
+-# CONFIG_SCSI_QLA22XX is not set
+-# CONFIG_SCSI_QLA2300 is not set
+-# CONFIG_SCSI_QLA2322 is not set
+-# CONFIG_SCSI_QLA6312 is not set
+-# CONFIG_SCSI_QLA24XX is not set
+-# CONFIG_SCSI_LPFC is not set
+-# CONFIG_SCSI_DC395x is not set
+-# CONFIG_SCSI_DC390T is not set
+-# CONFIG_SCSI_NSP32 is not set
+-# CONFIG_SCSI_DEBUG is not set
+-
+-#
+-# Multi-device support (RAID and LVM)
+-#
+-# CONFIG_MD is not set
+-
+-#
+-# Fusion MPT device support
+-#
+-# CONFIG_FUSION is not set
+-# CONFIG_FUSION_SPI is not set
+-# CONFIG_FUSION_FC is not set
+-# CONFIG_FUSION_SAS is not set
+-
+-#
+-# IEEE 1394 (FireWire) support
+-#
+-CONFIG_IEEE1394=m
+-
+-#
+-# Subsystem Options
+-#
+-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
+-# CONFIG_IEEE1394_OUI_DB is not set
+-CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
+-CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
+-# CONFIG_IEEE1394_EXPORT_FULL_API is not set
+-
+-#
+-# Device Drivers
+-#
+-
+-#
+-# Texas Instruments PCILynx requires I2C
+-#
+-CONFIG_IEEE1394_OHCI1394=m
+-
+-#
+-# Protocol Drivers
+-#
+-CONFIG_IEEE1394_VIDEO1394=m
+-CONFIG_IEEE1394_SBP2=m
+-# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
+-CONFIG_IEEE1394_ETH1394=m
+-CONFIG_IEEE1394_DV1394=m
+-CONFIG_IEEE1394_RAWIO=m
+-CONFIG_IEEE1394_CMP=m
+-CONFIG_IEEE1394_AMDTP=m
+-
+-#
+-# I2O device support
+-#
+-# CONFIG_I2O is not set
+-
+-#
+-# Network device support
+-#
+-CONFIG_NETDEVICES=y
+-CONFIG_DUMMY=m
+-# CONFIG_BONDING is not set
+-# CONFIG_EQUALIZER is not set
+-# CONFIG_TUN is not set
+-
+-#
+-# ARCnet devices
+-#
+-# CONFIG_ARCNET is not set
+-
+-#
+-# PHY device support
+-#
+-# CONFIG_PHYLIB is not set
+-
+-#
+-# Ethernet (10 or 100Mbit)
+-#
+-CONFIG_NET_ETHERNET=y
+-CONFIG_MII=y
+-# CONFIG_HAPPYMEAL is not set
+-# CONFIG_SUNGEM is not set
+-# CONFIG_CASSINI is not set
+-# CONFIG_NET_VENDOR_3COM is not set
+-
+-#
+-# Tulip family network device support
+-#
+-# CONFIG_NET_TULIP is not set
+-# CONFIG_HP100 is not set
+-# CONFIG_NET_PCI is not set
+-
+-#
+-# Ethernet (1000 Mbit)
+-#
+-# CONFIG_ACENIC is not set
+-# CONFIG_DL2K is not set
+-# CONFIG_E1000 is not set
+-# CONFIG_NS83820 is not set
+-# CONFIG_HAMACHI is not set
+-# CONFIG_YELLOWFIN is not set
+-CONFIG_R8169=y
+-# CONFIG_R8169_NAPI is not set
+-# CONFIG_SIS190 is not set
+-# CONFIG_SKGE is not set
+-# CONFIG_SKY2 is not set
+-# CONFIG_SK98LIN is not set
+-# CONFIG_TIGON3 is not set
+-# CONFIG_BNX2 is not set
+-
+-#
+-# Ethernet (10000 Mbit)
+-#
+-# CONFIG_CHELSIO_T1 is not set
+-# CONFIG_IXGB is not set
+-# CONFIG_S2IO is not set
+-
+-#
+-# Token Ring devices
+-#
+-# CONFIG_TR is not set
+-
+-#
+-# Wireless LAN (non-hamradio)
+-#
+-# CONFIG_NET_RADIO is not set
+-# CONFIG_HOSTAP is not set
+-
+-#
+-# Wan interfaces
+-#
+-# CONFIG_WAN is not set
+-# CONFIG_FDDI is not set
+-# CONFIG_HIPPI is not set
+-# CONFIG_PPP is not set
+-# CONFIG_SLIP is not set
+-# CONFIG_NET_FC is not set
+-# CONFIG_SHAPER is not set
+-# CONFIG_NETCONSOLE is not set
+-# CONFIG_KGDBOE is not set
+-# CONFIG_NETPOLL is not set
+-# CONFIG_NETPOLL_RX is not set
+-# CONFIG_NETPOLL_TRAP is not set
+-# CONFIG_NET_POLL_CONTROLLER is not set
+-
+-#
+-# ISDN subsystem
+-#
+-# CONFIG_ISDN is not set
+-
+-#
+-# Telephony Support
+-#
+-# CONFIG_PHONE is not set
+-
+-#
+-# Input device support
+-#
+-CONFIG_INPUT=y
+-
+-#
+-# Userland interfaces
+-#
+-# CONFIG_INPUT_MOUSEDEV is not set
+-# CONFIG_INPUT_JOYDEV is not set
+-# CONFIG_INPUT_TSDEV is not set
+-# CONFIG_INPUT_EVDEV is not set
+-# CONFIG_INPUT_EVBUG is not set
+-
+-#
+-# Input Device Drivers
+-#
+-# CONFIG_INPUT_KEYBOARD is not set
+-# CONFIG_INPUT_MOUSE is not set
+-# CONFIG_INPUT_JOYSTICK is not set
+-# CONFIG_INPUT_TOUCHSCREEN is not set
+-# CONFIG_INPUT_MISC is not set
+-
+-#
+-# Hardware I/O ports
+-#
+-# CONFIG_SERIO is not set
+-# CONFIG_GAMEPORT is not set
+-
+-#
+-# Character devices
+-#
+-CONFIG_VT=y
+-CONFIG_VT_CONSOLE=y
+-CONFIG_HW_CONSOLE=y
+-# CONFIG_SERIAL_NONSTANDARD is not set
+-
+-#
+-# Serial drivers
+-#
+-# CONFIG_SERIAL_8250 is not set
+-
+-#
+-# Non-8250 serial port support
+-#
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+-CONFIG_UNIX98_PTYS=y
+-CONFIG_LEGACY_PTYS=y
+-CONFIG_LEGACY_PTY_COUNT=256
+-
+-#
+-# IPMI
+-#
+-# CONFIG_IPMI_HANDLER is not set
+-
+-#
+-# Watchdog Cards
+-#
+-# CONFIG_WATCHDOG is not set
+-# CONFIG_RTC is not set
+-# CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+-# CONFIG_DTLK is not set
+-# CONFIG_R3964 is not set
+-# CONFIG_APPLICOM is not set
+-# CONFIG_TANBAC_TB0219 is not set
+-
+-#
+-# Ftape, the floppy tape device driver
+-#
+-# CONFIG_DRM is not set
+-CONFIG_GPIO_VR41XX=y
+-# CONFIG_RAW_DRIVER is not set
+-
+-#
+-# TPM devices
+-#
+-# CONFIG_TCG_TPM is not set
+-# CONFIG_TELCLOCK is not set
+-
+-#
+-# I2C support
+-#
+-# CONFIG_I2C is not set
+-
+-#
+-# Dallas's 1-wire bus
+-#
+-# CONFIG_W1 is not set
+-
+-#
+-# Hardware Monitoring support
+-#
+-# CONFIG_HWMON is not set
+-# CONFIG_HWMON_VID is not set
+-
+-#
+-# Misc devices
+-#
+-
+-#
+-# Multimedia Capabilities Port drivers
+-#
+-
+-#
+-# Multimedia devices
+-#
+-# CONFIG_VIDEO_DEV is not set
+-
+-#
+-# Digital Video Broadcasting Devices
+-#
+-# CONFIG_DVB is not set
+-
+-#
+-# Graphics support
+-#
+-# CONFIG_FB is not set
+-
+-#
+-# Console display driver support
+-#
+-# CONFIG_VGA_CONSOLE is not set
+-CONFIG_DUMMY_CONSOLE=y
+-
+-#
+-# Speakup console speech
+-#
+-# CONFIG_SPEAKUP is not set
+-
+-#
+-# Sound
+-#
+-# CONFIG_SOUND is not set
+-
+-#
+-# USB support
+-#
+-CONFIG_USB_ARCH_HAS_HCD=y
+-CONFIG_USB_ARCH_HAS_OHCI=y
+-CONFIG_USB=m
+-# CONFIG_USB_DEBUG is not set
+-
+-#
+-# Miscellaneous USB options
+-#
+-# CONFIG_USB_DEVICEFS is not set
+-# CONFIG_USB_BANDWIDTH is not set
+-# CONFIG_USB_DYNAMIC_MINORS is not set
+-# CONFIG_USB_OTG is not set
+-
+-#
+-# USB Host Controller Drivers
+-#
+-CONFIG_USB_EHCI_HCD=m
+-# CONFIG_USB_EHCI_SPLIT_ISO is not set
+-# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
+-# CONFIG_USB_ISP116X_HCD is not set
+-CONFIG_USB_OHCI_HCD=m
+-# CONFIG_USB_OHCI_BIG_ENDIAN is not set
+-CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+-# CONFIG_USB_UHCI_HCD is not set
+-# CONFIG_USB_SL811_HCD is not set
+-
+-#
+-# USB Device Class drivers
+-#
+-# CONFIG_USB_ACM is not set
+-# CONFIG_USB_PRINTER is not set
+-
+-#
+-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+-#
+-
+-#
+-# may also be needed; see USB_STORAGE Help for more information
+-#
+-CONFIG_USB_STORAGE=m
+-# CONFIG_USB_STORAGE_DEBUG is not set
+-# CONFIG_USB_STORAGE_DATAFAB is not set
+-# CONFIG_USB_STORAGE_FREECOM is not set
+-# CONFIG_USB_STORAGE_ISD200 is not set
+-# CONFIG_USB_STORAGE_DPCM is not set
+-# CONFIG_USB_STORAGE_USBAT is not set
+-# CONFIG_USB_STORAGE_SDDR09 is not set
+-# CONFIG_USB_STORAGE_SDDR55 is not set
+-# CONFIG_USB_STORAGE_JUMPSHOT is not set
+-
+-#
+-# USB Input Devices
+-#
+-CONFIG_USB_HID=m
+-CONFIG_USB_HIDINPUT=y
+-# CONFIG_HID_FF is not set
+-# CONFIG_USB_HIDDEV is not set
+-
+-#
+-# USB HID Boot Protocol drivers
+-#
+-# CONFIG_USB_KBD is not set
+-# CONFIG_USB_MOUSE is not set
+-# CONFIG_USB_AIPTEK is not set
+-# CONFIG_USB_WACOM is not set
+-# CONFIG_USB_ACECAD is not set
+-# CONFIG_USB_KBTAB is not set
+-# CONFIG_USB_POWERMATE is not set
+-# CONFIG_USB_MTOUCH is not set
+-# CONFIG_USB_ITMTOUCH is not set
+-# CONFIG_USB_EGALAX is not set
+-# CONFIG_USB_YEALINK is not set
+-# CONFIG_USB_XPAD is not set
+-# CONFIG_USB_ATI_REMOTE is not set
+-# CONFIG_USB_KEYSPAN_REMOTE is not set
+-# CONFIG_USB_APPLETOUCH is not set
+-
+-#
+-# USB Imaging devices
+-#
+-# CONFIG_USB_MDC800 is not set
+-# CONFIG_USB_MICROTEK is not set
+-
+-#
+-# USB Multimedia devices
+-#
+-# CONFIG_USB_DABUSB is not set
+-
+-#
+-# Video4Linux support is needed for USB Multimedia device support
+-#
+-
+-#
+-# USB Network Adapters
+-#
+-# CONFIG_USB_CATC is not set
+-# CONFIG_USB_KAWETH is not set
+-# CONFIG_USB_PEGASUS is not set
+-# CONFIG_USB_RTL8150 is not set
+-# CONFIG_USB_USBNET is not set
+-CONFIG_USB_MON=y
+-
+-#
+-# USB port drivers
+-#
+-
+-#
+-# USB Serial Converter support
+-#
+-# CONFIG_USB_SERIAL is not set
+-
+-#
+-# USB Miscellaneous drivers
+-#
+-# CONFIG_USB_EMI62 is not set
+-# CONFIG_USB_EMI26 is not set
+-# CONFIG_USB_AUERSWALD is not set
+-# CONFIG_USB_RIO500 is not set
+-# CONFIG_USB_LEGOTOWER is not set
+-# CONFIG_USB_LCD is not set
+-# CONFIG_USB_LED is not set
+-# CONFIG_USB_CYTHERM is not set
+-# CONFIG_USB_GOTEMP is not set
+-# CONFIG_USB_PHIDGETKIT is not set
+-# CONFIG_USB_PHIDGETSERVO is not set
+-# CONFIG_USB_IDMOUSE is not set
+-# CONFIG_USB_SISUSBVGA is not set
+-# CONFIG_USB_LD is not set
+-
+-#
+-# USB DSL modem support
+-#
+-
+-#
+-# USB Gadget Support
+-#
+-# CONFIG_USB_GADGET is not set
+-
+-#
+-# MMC/SD Card support
+-#
+-# CONFIG_MMC is not set
+-
+-#
+-# InfiniBand support
+-#
+-# CONFIG_INFINIBAND is not set
+-
+-#
+-# SN Devices
+-#
+-
+-#
+-# EDAC - error detection and reporting (RAS)
+-#
+-# CONFIG_EDAC is not set
+-
+-#
+-# Distributed Lock Manager
+-#
+-# CONFIG_DLM is not set
+-
+-#
+-# File systems
+-#
+-CONFIG_EXT2_FS=y
+-# CONFIG_EXT2_FS_XATTR is not set
+-# CONFIG_EXT2_FS_XIP is not set
+-CONFIG_EXT3_FS=y
+-CONFIG_EXT3_FS_XATTR=y
+-# CONFIG_EXT3_FS_POSIX_ACL is not set
+-# CONFIG_EXT3_FS_SECURITY is not set
+-CONFIG_JBD=y
+-# CONFIG_JBD_DEBUG is not set
+-CONFIG_FS_MBCACHE=y
+-# CONFIG_REISER4_FS is not set
+-# CONFIG_REISERFS_FS is not set
+-# CONFIG_JFS_FS is not set
+-# CONFIG_FS_POSIX_ACL is not set
+-CONFIG_XFS_FS=y
+-CONFIG_XFS_QUOTA=y
+-# CONFIG_XFS_SECURITY is not set
+-CONFIG_XFS_POSIX_ACL=y
+-# CONFIG_XFS_RT is not set
+-# CONFIG_OCFS2_FS is not set
+-# CONFIG_MINIX_FS is not set
+-CONFIG_ROMFS_FS=m
+-CONFIG_INOTIFY=y
+-# CONFIG_QUOTA is not set
+-CONFIG_QUOTACTL=y
+-# CONFIG_DNOTIFY is not set
+-# CONFIG_AUTOFS_FS is not set
+-CONFIG_AUTOFS4_FS=y
+-# CONFIG_FUSE_FS is not set
+-
+-#
+-# CD-ROM/DVD Filesystems
+-#
+-# CONFIG_ISO9660_FS is not set
+-# CONFIG_UDF_FS is not set
+-
+-#
+-# DOS/FAT/NT Filesystems
+-#
+-# CONFIG_MSDOS_FS is not set
+-# CONFIG_VFAT_FS is not set
+-# CONFIG_NTFS_FS is not set
+-
+-#
+-# Pseudo filesystems
+-#
+-CONFIG_PROC_FS=y
+-CONFIG_PROC_KCORE=y
+-CONFIG_SYSFS=y
+-CONFIG_TMPFS=y
+-# CONFIG_HUGETLB_PAGE is not set
+-CONFIG_RAMFS=y
+-# CONFIG_RELAYFS_FS is not set
+-# CONFIG_CONFIGFS_FS is not set
+-
+-#
+-# Miscellaneous filesystems
+-#
+-# CONFIG_ADFS_FS is not set
+-# CONFIG_AFFS_FS is not set
+-# CONFIG_ASFS_FS is not set
+-# CONFIG_HFS_FS is not set
+-# CONFIG_HFSPLUS_FS is not set
+-# CONFIG_BEFS_FS is not set
+-# CONFIG_BFS_FS is not set
+-# CONFIG_EFS_FS is not set
+-CONFIG_CRAMFS=m
+-# CONFIG_VXFS_FS is not set
+-# CONFIG_HPFS_FS is not set
+-# CONFIG_QNX4FS_FS is not set
+-# CONFIG_SYSV_FS is not set
+-# CONFIG_UFS_FS is not set
+-
+-#
+-# Network File Systems
+-#
+-CONFIG_NFS_FS=y
+-CONFIG_NFS_V3=y
+-# CONFIG_NFS_V3_ACL is not set
+-# CONFIG_NFS_V4 is not set
+-# CONFIG_NFS_DIRECTIO is not set
+-# CONFIG_NFSD is not set
+-CONFIG_ROOT_NFS=y
+-CONFIG_LOCKD=y
+-CONFIG_LOCKD_V4=y
+-CONFIG_NFS_COMMON=y
+-CONFIG_SUNRPC=y
+-# CONFIG_RPCSEC_GSS_KRB5 is not set
+-# CONFIG_RPCSEC_GSS_SPKM3 is not set
+-# CONFIG_SMB_FS is not set
+-# CONFIG_CIFS is not set
+-# CONFIG_NCP_FS is not set
+-# CONFIG_CODA_FS is not set
+-# CONFIG_AFS_FS is not set
+-# CONFIG_9P_FS is not set
+-
+-#
+-# Partition Types
+-#
+-# CONFIG_PARTITION_ADVANCED is not set
+-CONFIG_MSDOS_PARTITION=y
+-
+-#
+-# Native Language Support
+-#
+-# CONFIG_NLS is not set
+-
+-#
+-# Profiling support
+-#
+-# CONFIG_PROFILING is not set
+-
+-#
+-# Kernel hacking
+-#
+-# CONFIG_PRINTK_TIME is not set
+-# CONFIG_DEBUG_KERNEL is not set
+-CONFIG_LOG_BUF_SHIFT=14
+-CONFIG_CROSSCOMPILE=y
+-CONFIG_CMDLINE="mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
+-
+-#
+-# Security options
+-#
+-CONFIG_KEYS=y
+-CONFIG_KEYS_DEBUG_PROC_KEYS=y
+-# CONFIG_SECURITY is not set
+-
+-#
+-# Cryptographic options
+-#
+-# CONFIG_CRYPTO is not set
+-
+-#
+-# Hardware crypto devices
+-#
+-
+-#
+-# Library routines
+-#
+-# CONFIG_CRC_CCITT is not set
+-# CONFIG_CRC16 is not set
+-CONFIG_CRC32=y
+-# CONFIG_LIBCRC32C is not set
+-CONFIG_ZLIB_INFLATE=m
+diff -Naur linux-2.6.16.orig/arch/mips/configs/workpad_defconfig linux-2.6.16/arch/mips/configs/workpad_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/workpad_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/workpad_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:17 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:36 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -63,9 +63,9 @@
+ # CONFIG_TOSHIBA_JMR3927 is not set
+ # CONFIG_TOSHIBA_RBTX4927 is not set
+ # CONFIG_TOSHIBA_RBTX4938 is not set
+-# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_CASIO_E55 is not set
+ CONFIG_IBM_WORKPAD=y
++# CONFIG_NEC_CMBVR4133 is not set
+ # CONFIG_TANBAC_TB022X is not set
+ # CONFIG_VICTOR_MPC30X is not set
+ # CONFIG_ZAO_CAPCELLA is not set
+@@ -88,7 +88,7 @@
+ # CONFIG_CPU_MIPS64_R2 is not set
+ # CONFIG_CPU_R3000 is not set
+ # CONFIG_CPU_TX39XX is not set
+-CONFIG_CPU_VR41XX=y
++# CONFIG_CPU_VR41XX is not set
+ # CONFIG_CPU_R4300 is not set
+ # CONFIG_CPU_R4X00 is not set
+ # CONFIG_CPU_TX49XX is not set
+@@ -101,23 +101,18 @@
+ # CONFIG_CPU_RM7000 is not set
+ # CONFIG_CPU_RM9000 is not set
+ # CONFIG_CPU_SB1 is not set
+-CONFIG_SYS_HAS_CPU_VR41XX=y
+-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
+ 
+ #
+ # Kernel type
+ #
+-CONFIG_32BIT=y
++# CONFIG_32BIT is not set
+ # CONFIG_64BIT is not set
+ CONFIG_PAGE_SIZE_4KB=y
+ # CONFIG_PAGE_SIZE_8KB is not set
+ # CONFIG_PAGE_SIZE_16KB is not set
+ # CONFIG_PAGE_SIZE_64KB is not set
+ # CONFIG_MIPS_MT is not set
+-# CONFIG_CPU_ADVANCED is not set
++CONFIG_CPU_HAS_LLSC=y
+ CONFIG_CPU_HAS_SYNC=y
+ CONFIG_GENERIC_HARDIRQS=y
+ CONFIG_GENERIC_IRQ_PROBE=y
+@@ -153,26 +148,28 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ # CONFIG_IKCONFIG is not set
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -188,7 +185,6 @@
+ #
+ # Block layer
+ #
+-# CONFIG_LBD is not set
+ 
+ #
+ # IO Schedulers
+@@ -234,7 +230,6 @@
+ #
+ CONFIG_BINFMT_ELF=y
+ # CONFIG_BINFMT_MISC is not set
+-CONFIG_TRAD_SIGNALS=y
+ 
+ #
+ # Networking
+@@ -289,6 +284,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ # CONFIG_NET_DIVERT is not set
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -309,7 +309,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -445,6 +444,7 @@
+ CONFIG_MII=m
+ # CONFIG_NET_VENDOR_3COM is not set
+ # CONFIG_NET_VENDOR_SMC is not set
++# CONFIG_DM9000 is not set
+ # CONFIG_NET_VENDOR_RACAL is not set
+ # CONFIG_AT1700 is not set
+ # CONFIG_DEPCA is not set
+@@ -556,10 +556,6 @@
+ #
+ # Non-8250 serial port support
+ #
+-CONFIG_SERIAL_CORE=y
+-CONFIG_SERIAL_CORE_CONSOLE=y
+-CONFIG_SERIAL_VR41XX=y
+-CONFIG_SERIAL_VR41XX_CONSOLE=y
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -588,7 +584,6 @@
+ # CONFIG_WDT is not set
+ # CONFIG_RTC is not set
+ # CONFIG_GEN_RTC is not set
+-# CONFIG_RTC_VR41XX is not set
+ # CONFIG_DTLK is not set
+ # CONFIG_R3964 is not set
+ 
+@@ -602,7 +597,6 @@
+ # CONFIG_SYNCLINK_CS is not set
+ # CONFIG_CARDMAN_4000 is not set
+ # CONFIG_CARDMAN_4040 is not set
+-# CONFIG_GPIO_VR41XX is not set
+ # CONFIG_RAW_DRIVER is not set
+ 
+ #
+@@ -617,6 +611,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -699,12 +699,12 @@
+ CONFIG_EXT2_FS_SECURITY=y
+ # CONFIG_EXT2_FS_XIP is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ CONFIG_FS_MBCACHE=y
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ CONFIG_FS_POSIX_ACL=y
+ # CONFIG_XFS_FS is not set
++# CONFIG_OCFS2_FS is not set
+ # CONFIG_MINIX_FS is not set
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -737,6 +737,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -798,6 +799,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/configs/yosemite_defconfig linux-2.6.16/arch/mips/configs/yosemite_defconfig
+--- linux-2.6.16.orig/arch/mips/configs/yosemite_defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/configs/yosemite_defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:07:19 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:40:37 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -154,8 +154,6 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-CONFIG_HOTPLUG=y
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ # CONFIG_CPUSETS is not set
+@@ -164,19 +162,22 @@
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_ALL is not set
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++CONFIG_HOTPLUG=y
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -184,6 +185,7 @@
+ CONFIG_MODULES=y
+ CONFIG_MODULE_UNLOAD=y
+ CONFIG_OBSOLETE_MODPARM=y
++# CONFIG_MODVERSIONS is not set
+ # CONFIG_MODULE_SRCVERSION_ALL is not set
+ CONFIG_KMOD=y
+ CONFIG_STOP_MACHINE=y
+@@ -295,7 +297,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -413,6 +414,7 @@
+ # CONFIG_SUNGEM is not set
+ # CONFIG_CASSINI is not set
+ # CONFIG_NET_VENDOR_3COM is not set
++# CONFIG_DM9000 is not set
+ 
+ #
+ # Tulip family network device support
+@@ -452,8 +454,6 @@
+ # Wireless LAN (non-hamradio)
+ #
+ # CONFIG_NET_RADIO is not set
+-# CONFIG_IPW_DEBUG is not set
+-CONFIG_IPW2200=m
+ 
+ #
+ # Wan interfaces
+@@ -498,6 +498,7 @@
+ CONFIG_SERIAL_8250=y
+ CONFIG_SERIAL_8250_CONSOLE=y
+ CONFIG_SERIAL_8250_NR_UARTS=4
++CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+ # CONFIG_SERIAL_8250_EXTENDED is not set
+ 
+ #
+@@ -505,7 +506,6 @@
+ #
+ CONFIG_SERIAL_CORE=y
+ CONFIG_SERIAL_CORE_CONSOLE=y
+-# CONFIG_SERIAL_JSM is not set
+ CONFIG_UNIX98_PTYS=y
+ CONFIG_LEGACY_PTYS=y
+ CONFIG_LEGACY_PTY_COUNT=256
+@@ -542,6 +542,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -615,7 +621,6 @@
+ #
+ # CONFIG_EXT2_FS is not set
+ # CONFIG_EXT3_FS is not set
+-# CONFIG_JBD is not set
+ # CONFIG_REISERFS_FS is not set
+ # CONFIG_JFS_FS is not set
+ # CONFIG_FS_POSIX_ACL is not set
+@@ -694,12 +699,13 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
+-CONFIG_DEBUG_KERNEL=y
+ # CONFIG_MAGIC_SYSRQ is not set
++CONFIG_DEBUG_KERNEL=y
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_DETECT_SOFTLOCKUP=y
+ # CONFIG_SCHEDSTATS is not set
+ # CONFIG_DEBUG_SLAB is not set
++CONFIG_DEBUG_MUTEXES=y
+ # CONFIG_DEBUG_SPINLOCK is not set
+ # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+ # CONFIG_DEBUG_KOBJECT is not set
+@@ -707,6 +713,7 @@
+ # CONFIG_DEBUG_INFO is not set
+ # CONFIG_DEBUG_FS is not set
+ # CONFIG_DEBUG_VM is not set
++CONFIG_FORCED_INLINING=y
+ # CONFIG_RCU_TORTURE_TEST is not set
+ CONFIG_CROSSCOMPILE=y
+ CONFIG_CMDLINE=""
+diff -Naur linux-2.6.16.orig/arch/mips/defconfig linux-2.6.16/arch/mips/defconfig
+--- linux-2.6.16.orig/arch/mips/defconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/defconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -1,7 +1,7 @@
+ #
+ # Automatically generated make config: don't edit
+-# Linux kernel version: 2.6.15-rc2
+-# Thu Nov 24 01:05:49 2005
++# Linux kernel version: 2.6.16-rc1
++# Fri Jan 27 15:39:51 2006
+ #
+ CONFIG_MIPS=y
+ 
+@@ -158,27 +158,29 @@
+ # CONFIG_BSD_PROCESS_ACCT is not set
+ CONFIG_SYSCTL=y
+ # CONFIG_AUDIT is not set
+-# CONFIG_HOTPLUG is not set
+-CONFIG_KOBJECT_UEVENT=y
+ CONFIG_IKCONFIG=y
+ CONFIG_IKCONFIG_PROC=y
+ CONFIG_INITRAMFS_SOURCE=""
++# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_EMBEDDED=y
+ CONFIG_KALLSYMS=y
+ # CONFIG_KALLSYMS_EXTRA_PASS is not set
++# CONFIG_HOTPLUG is not set
+ CONFIG_PRINTK=y
+ CONFIG_BUG=y
++CONFIG_ELF_CORE=y
+ CONFIG_BASE_FULL=y
+ CONFIG_FUTEX=y
+ CONFIG_EPOLL=y
+-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+ CONFIG_SHMEM=y
+ CONFIG_CC_ALIGN_FUNCTIONS=0
+ CONFIG_CC_ALIGN_LABELS=0
+ CONFIG_CC_ALIGN_LOOPS=0
+ CONFIG_CC_ALIGN_JUMPS=0
++CONFIG_SLAB=y
+ # CONFIG_TINY_SHMEM is not set
+ CONFIG_BASE_SMALL=0
++# CONFIG_SLOB is not set
+ 
+ #
+ # Loadable module support
+@@ -317,6 +319,28 @@
+ CONFIG_NETFILTER_NETLINK=m
+ CONFIG_NETFILTER_NETLINK_QUEUE=m
+ CONFIG_NETFILTER_NETLINK_LOG=m
++CONFIG_NETFILTER_XTABLES=m
++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
++CONFIG_NETFILTER_XT_TARGET_MARK=m
++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
++CONFIG_NETFILTER_XT_MATCH_COMMENT=m
++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
++CONFIG_NETFILTER_XT_MATCH_DCCP=m
++CONFIG_NETFILTER_XT_MATCH_HELPER=m
++CONFIG_NETFILTER_XT_MATCH_LENGTH=m
++CONFIG_NETFILTER_XT_MATCH_LIMIT=m
++CONFIG_NETFILTER_XT_MATCH_MAC=m
++CONFIG_NETFILTER_XT_MATCH_MARK=m
++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
++CONFIG_NETFILTER_XT_MATCH_REALM=m
++CONFIG_NETFILTER_XT_MATCH_SCTP=m
++CONFIG_NETFILTER_XT_MATCH_STATE=m
++CONFIG_NETFILTER_XT_MATCH_STRING=m
++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
+ 
+ #
+ # IP: Netfilter Configuration
+@@ -335,39 +359,23 @@
+ CONFIG_IP_NF_PPTP=m
+ CONFIG_IP_NF_QUEUE=m
+ CONFIG_IP_NF_IPTABLES=m
+-CONFIG_IP_NF_MATCH_LIMIT=m
+ CONFIG_IP_NF_MATCH_IPRANGE=m
+-CONFIG_IP_NF_MATCH_MAC=m
+-CONFIG_IP_NF_MATCH_PKTTYPE=m
+-CONFIG_IP_NF_MATCH_MARK=m
+ CONFIG_IP_NF_MATCH_MULTIPORT=m
+ CONFIG_IP_NF_MATCH_TOS=m
+ CONFIG_IP_NF_MATCH_RECENT=m
+ CONFIG_IP_NF_MATCH_ECN=m
+ CONFIG_IP_NF_MATCH_DSCP=m
+ CONFIG_IP_NF_MATCH_AH_ESP=m
+-CONFIG_IP_NF_MATCH_LENGTH=m
+ CONFIG_IP_NF_MATCH_TTL=m
+-CONFIG_IP_NF_MATCH_TCPMSS=m
+-CONFIG_IP_NF_MATCH_HELPER=m
+-CONFIG_IP_NF_MATCH_STATE=m
+-CONFIG_IP_NF_MATCH_CONNTRACK=m
+ CONFIG_IP_NF_MATCH_OWNER=m
+ CONFIG_IP_NF_MATCH_ADDRTYPE=m
+-CONFIG_IP_NF_MATCH_REALM=m
+-CONFIG_IP_NF_MATCH_SCTP=m
+-CONFIG_IP_NF_MATCH_DCCP=m
+-CONFIG_IP_NF_MATCH_COMMENT=m
+-CONFIG_IP_NF_MATCH_CONNMARK=m
+-CONFIG_IP_NF_MATCH_CONNBYTES=m
+ CONFIG_IP_NF_MATCH_HASHLIMIT=m
+-CONFIG_IP_NF_MATCH_STRING=m
++CONFIG_IP_NF_MATCH_POLICY=m
+ CONFIG_IP_NF_FILTER=m
+ CONFIG_IP_NF_TARGET_REJECT=m
+ CONFIG_IP_NF_TARGET_LOG=m
+ CONFIG_IP_NF_TARGET_ULOG=m
+ CONFIG_IP_NF_TARGET_TCPMSS=m
+-CONFIG_IP_NF_TARGET_NFQUEUE=m
+ CONFIG_IP_NF_NAT=m
+ CONFIG_IP_NF_NAT_NEEDED=y
+ CONFIG_IP_NF_TARGET_MASQUERADE=m
+@@ -384,13 +392,9 @@
+ CONFIG_IP_NF_TARGET_TOS=m
+ CONFIG_IP_NF_TARGET_ECN=m
+ CONFIG_IP_NF_TARGET_DSCP=m
+-CONFIG_IP_NF_TARGET_MARK=m
+-CONFIG_IP_NF_TARGET_CLASSIFY=m
+ CONFIG_IP_NF_TARGET_TTL=m
+-CONFIG_IP_NF_TARGET_CONNMARK=m
+ CONFIG_IP_NF_TARGET_CLUSTERIP=m
+ CONFIG_IP_NF_RAW=m
+-CONFIG_IP_NF_TARGET_NOTRACK=m
+ CONFIG_IP_NF_ARPTABLES=m
+ CONFIG_IP_NF_ARPFILTER=m
+ CONFIG_IP_NF_ARP_MANGLE=m
+@@ -400,25 +404,20 @@
+ #
+ CONFIG_IP6_NF_QUEUE=m
+ CONFIG_IP6_NF_IPTABLES=m
+-CONFIG_IP6_NF_MATCH_LIMIT=m
+-CONFIG_IP6_NF_MATCH_MAC=m
+ CONFIG_IP6_NF_MATCH_RT=m
+ CONFIG_IP6_NF_MATCH_OPTS=m
+ CONFIG_IP6_NF_MATCH_FRAG=m
+ CONFIG_IP6_NF_MATCH_HL=m
+ CONFIG_IP6_NF_MATCH_MULTIPORT=m
+ CONFIG_IP6_NF_MATCH_OWNER=m
+-CONFIG_IP6_NF_MATCH_MARK=m
+ CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+ CONFIG_IP6_NF_MATCH_AHESP=m
+-CONFIG_IP6_NF_MATCH_LENGTH=m
+ CONFIG_IP6_NF_MATCH_EUI64=m
++CONFIG_IP6_NF_MATCH_POLICY=m
+ CONFIG_IP6_NF_FILTER=m
+ CONFIG_IP6_NF_TARGET_LOG=m
+ CONFIG_IP6_NF_TARGET_REJECT=m
+-CONFIG_IP6_NF_TARGET_NFQUEUE=m
+ CONFIG_IP6_NF_MANGLE=m
+-CONFIG_IP6_NF_TARGET_MARK=m
+ CONFIG_IP6_NF_TARGET_HL=m
+ CONFIG_IP6_NF_RAW=m
+ 
+@@ -445,6 +444,11 @@
+ # CONFIG_ATALK is not set
+ # CONFIG_X25 is not set
+ # CONFIG_LAPB is not set
++
++#
++# TIPC Configuration (EXPERIMENTAL)
++#
++# CONFIG_TIPC is not set
+ CONFIG_NET_DIVERT=y
+ # CONFIG_ECONET is not set
+ # CONFIG_WAN_ROUTER is not set
+@@ -504,7 +508,6 @@
+ # CONFIG_IEEE80211_DEBUG is not set
+ CONFIG_IEEE80211_CRYPT_WEP=m
+ CONFIG_IEEE80211_CRYPT_CCMP=m
+-CONFIG_IEEE80211_CRYPT_TKIP=m
+ 
+ #
+ # Device Drivers
+@@ -641,6 +644,7 @@
+ #
+ CONFIG_NET_ETHERNET=y
+ # CONFIG_MII is not set
++# CONFIG_DM9000 is not set
+ CONFIG_SGISEEQ=y
+ 
+ #
+@@ -787,6 +791,12 @@
+ # CONFIG_I2C is not set
+ 
+ #
++# SPI support
++#
++# CONFIG_SPI is not set
++# CONFIG_SPI_MASTER is not set
++
++#
+ # Dallas's 1-wire bus
+ #
+ # CONFIG_W1 is not set
+@@ -892,6 +902,7 @@
+ CONFIG_XFS_SECURITY=y
+ # CONFIG_XFS_POSIX_ACL is not set
+ # CONFIG_XFS_RT is not set
++# CONFIG_OCFS2_FS is not set
+ CONFIG_MINIX_FS=m
+ # CONFIG_ROMFS_FS is not set
+ CONFIG_INOTIFY=y
+@@ -934,6 +945,7 @@
+ # CONFIG_HUGETLB_PAGE is not set
+ CONFIG_RAMFS=y
+ CONFIG_RELAYFS_FS=m
++# CONFIG_CONFIGFS_FS is not set
+ 
+ #
+ # Miscellaneous filesystems
+@@ -1007,6 +1019,7 @@
+ CONFIG_SGI_PARTITION=y
+ # CONFIG_ULTRIX_PARTITION is not set
+ # CONFIG_SUN_PARTITION is not set
++# CONFIG_KARMA_PARTITION is not set
+ # CONFIG_EFI_PARTITION is not set
+ 
+ #
+@@ -1062,6 +1075,7 @@
+ # Kernel hacking
+ #
+ # CONFIG_PRINTK_TIME is not set
++# CONFIG_MAGIC_SYSRQ is not set
+ # CONFIG_DEBUG_KERNEL is not set
+ CONFIG_LOG_BUF_SHIFT=14
+ CONFIG_CROSSCOMPILE=y
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/cpu-probe.c linux-2.6.16/arch/mips/kernel/cpu-probe.c
+--- linux-2.6.16.orig/arch/mips/kernel/cpu-probe.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/cpu-probe.c	2006-03-21 01:05:47.000000000 +0000
+@@ -242,9 +242,15 @@
+ 		break;
+ 	case PRID_IMP_VR41XX:
+ 		switch (c->processor_id & 0xf0) {
++#ifndef CONFIG_VR4181
+ 		case PRID_REV_VR4111:
+ 			c->cputype = CPU_VR4111;
+ 			break;
++#else
++		case PRID_REV_VR4181:
++			c->cputype = CPU_VR4181;
++			break;
++#endif
+ 		case PRID_REV_VR4121:
+ 			c->cputype = CPU_VR4121;
+ 			break;
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/linux32.c linux-2.6.16/arch/mips/kernel/linux32.c
+--- linux-2.6.16.orig/arch/mips/kernel/linux32.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/linux32.c	2006-03-21 01:05:47.000000000 +0000
+@@ -69,7 +69,7 @@
+  * Revalidate the inode. This is required for proper NFS attribute caching.
+  */
+ 
+-int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
++int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
+ {
+ 	struct compat_stat tmp;
+ 
+@@ -106,6 +106,10 @@
+ 	unsigned long error;
+ 
+ 	error = -EINVAL;
++	if (pgoff & (~PAGE_MASK >> 12))
++		goto out;
++	pgoff >>= PAGE_SHIFT-12;
++
+ 	if (!(flags & MAP_ANONYMOUS)) {
+ 		error = -EBADF;
+ 		file = fget(fd);
+@@ -125,7 +129,7 @@
+ }
+ 
+ 
+-asmlinkage int sys_truncate64(const char *path, unsigned int high,
++asmlinkage int sys_truncate64(const char __user *path, unsigned int high,
+ 			      unsigned int low)
+ {
+ 	if ((int)high < 0)
+@@ -161,12 +165,6 @@
+ 	return error;
+ }
+ 
+-asmlinkage int
+-sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options)
+-{
+-	return compat_sys_wait4(pid, stat_addr, options, NULL);
+-}
+-
+ asmlinkage long
+ sysn32_waitid(int which, compat_pid_t pid,
+ 	      siginfo_t __user *uinfo, int options,
+@@ -175,6 +173,7 @@
+ 	struct rusage ru;
+ 	long ret;
+ 	mm_segment_t old_fs = get_fs();
++	int si_signo;
+ 
+ 	if (!access_ok(VERIFY_WRITE, uinfo, sizeof(*uinfo)))
+ 		return -EFAULT;
+@@ -184,7 +183,9 @@
+ 			 uru ? (struct rusage __user *) &ru : NULL);
+ 	set_fs (old_fs);
+ 
+-	if (ret < 0 || uinfo->si_signo == 0)
++	if (__get_user(si_signo, &uinfo->si_signo))
++		return -EFAULT;
++	if (ret < 0 || si_signo == 0)
+ 		return ret;
+ 
+ 	if (uru)
+@@ -208,14 +209,14 @@
+ 	char _f[8];
+ };
+ 
+-asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
++asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
+ {
+ 	struct sysinfo s;
+ 	int ret, err;
+ 	mm_segment_t old_fs = get_fs ();
+ 
+ 	set_fs (KERNEL_DS);
+-	ret = sys_sysinfo(&s);
++	ret = sys_sysinfo((struct sysinfo __user *)&s);
+ 	set_fs (old_fs);
+ 	err = put_user (s.uptime, &info->uptime);
+ 	err |= __put_user (s.loads[0], &info->loads[0]);
+@@ -245,11 +246,11 @@
+ };
+ 
+ #ifdef __MIPSEB__
+-asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy,
++asmlinkage long sys32_truncate64(const char __user * path, unsigned long __dummy,
+ 	int length_hi, int length_lo)
+ #endif
+ #ifdef __MIPSEL__
+-asmlinkage long sys32_truncate64(const char * path, unsigned long __dummy,
++asmlinkage long sys32_truncate64(const char __user * path, unsigned long __dummy,
+ 	int length_lo, int length_hi)
+ #endif
+ {
+@@ -277,7 +278,7 @@
+ }
+ 
+ static inline long
+-get_tv32(struct timeval *o, struct compat_timeval *i)
++get_tv32(struct timeval *o, struct compat_timeval __user *i)
+ {
+ 	return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
+ 		(__get_user(o->tv_sec, &i->tv_sec) |
+@@ -285,7 +286,7 @@
+ }
+ 
+ static inline long
+-put_tv32(struct compat_timeval *o, struct timeval *i)
++put_tv32(struct compat_timeval __user *o, struct timeval *i)
+ {
+ 	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
+ 		(__put_user(i->tv_sec, &o->tv_sec) |
+@@ -295,7 +296,7 @@
+ extern struct timezone sys_tz;
+ 
+ asmlinkage int
+-sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
++sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
+ {
+ 	if (tv) {
+ 		struct timeval ktv;
+@@ -310,7 +311,7 @@
+ 	return 0;
+ }
+ 
+-static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
++static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
+ {
+ 	long usec;
+ 
+@@ -325,7 +326,7 @@
+ }
+ 
+ asmlinkage int
+-sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
++sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
+ {
+ 	struct timespec kts;
+ 	struct timezone ktz;
+@@ -343,7 +344,7 @@
+ }
+ 
+ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
+-			    unsigned int offset_low, loff_t * result,
++			    unsigned int offset_low, loff_t __user * result,
+ 			    unsigned int origin)
+ {
+ 	return sys_llseek(fd, offset_high, offset_low, result, origin);
+@@ -353,12 +354,12 @@
+    lseek back to original location.  They fail just like lseek does on
+    non-seekable files.  */
+ 
+-asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
++asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf,
+ 			       size_t count, u32 unused, u64 a4, u64 a5)
+ {
+ 	ssize_t ret;
+ 	struct file * file;
+-	ssize_t (*read)(struct file *, char *, size_t, loff_t *);
++	ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
+ 	loff_t pos;
+ 
+ 	ret = -EBADF;
+@@ -388,12 +389,12 @@
+ 	return ret;
+ }
+ 
+-asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
++asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf,
+ 			        size_t count, u32 unused, u64 a4, u64 a5)
+ {
+ 	ssize_t ret;
+ 	struct file * file;
+-	ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
++	ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
+ 	loff_t pos;
+ 
+ 	ret = -EBADF;
+@@ -426,14 +427,14 @@
+ }
+ 
+ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
+-	struct compat_timespec *interval)
++	struct compat_timespec __user *interval)
+ {
+ 	struct timespec t;
+ 	int ret;
+ 	mm_segment_t old_fs = get_fs ();
+ 
+ 	set_fs (KERNEL_DS);
+-	ret = sys_sched_rr_get_interval(pid, &t);
++	ret = sys_sched_rr_get_interval(pid, (struct timespec __user *)&t);
+ 	set_fs (old_fs);
+ 	if (put_user (t.tv_sec, &interval->tv_sec) ||
+ 	    __put_user (t.tv_nsec, &interval->tv_nsec))
+@@ -551,7 +552,7 @@
+ };
+ 
+ static int
+-do_sys32_semctl(int first, int second, int third, void *uptr)
++do_sys32_semctl(int first, int second, int third, void __user *uptr)
+ {
+ 	union semun fourth;
+ 	u32 pad;
+@@ -562,12 +563,12 @@
+ 	if (!uptr)
+ 		return -EINVAL;
+ 	err = -EFAULT;
+-	if (get_user (pad, (u32 *)uptr))
++	if (get_user (pad, (u32 __user *)uptr))
+ 		return err;
+ 	if ((third & ~IPC_64) == SETVAL)
+ 		fourth.val = (int)pad;
+ 	else
+-		fourth.__pad = (void *)A(pad);
++		fourth.__pad = (void __user *)A(pad);
+ 	switch (third & ~IPC_64) {
+ 	case IPC_INFO:
+ 	case IPC_RMID:
+@@ -585,14 +586,14 @@
+ 
+ 	case IPC_STAT:
+ 	case SEM_STAT:
+-		fourth.__pad = &s;
++		fourth.__pad = (struct semid64_ds __user *)&s;
+ 		old_fs = get_fs();
+ 		set_fs(KERNEL_DS);
+ 		err = sys_semctl(first, second, third | IPC_64, fourth);
+ 		set_fs(old_fs);
+ 
+ 		if (third & IPC_64) {
+-			struct semid64_ds32 *usp64 = (struct semid64_ds32 *) A(pad);
++			struct semid64_ds32 __user *usp64 = (struct semid64_ds32 __user *) A(pad);
+ 
+ 			if (!access_ok(VERIFY_WRITE, usp64, sizeof(*usp64))) {
+ 				err = -EFAULT;
+@@ -609,7 +610,7 @@
+ 			err2 |= __put_user(s.sem_ctime, &usp64->sem_ctime);
+ 			err2 |= __put_user(s.sem_nsems, &usp64->sem_nsems);
+ 		} else {
+-			struct semid_ds32 *usp32 = (struct semid_ds32 *) A(pad);
++			struct semid_ds32 __user *usp32 = (struct semid_ds32 __user *) A(pad);
+ 
+ 			if (!access_ok(VERIFY_WRITE, usp32, sizeof(*usp32))) {
+ 				err = -EFAULT;
+@@ -639,9 +640,9 @@
+ }
+ 
+ static int
+-do_sys32_msgsnd (int first, int second, int third, void *uptr)
++do_sys32_msgsnd (int first, int second, int third, void __user *uptr)
+ {
+-	struct msgbuf32 *up = (struct msgbuf32 *)uptr;
++	struct msgbuf32 __user *up = (struct msgbuf32 __user *)uptr;
+ 	struct msgbuf *p;
+ 	mm_segment_t old_fs;
+ 	int err;
+@@ -660,7 +661,7 @@
+ 		goto out;
+ 	old_fs = get_fs ();
+ 	set_fs (KERNEL_DS);
+-	err = sys_msgsnd (first, p, second, third);
++	err = sys_msgsnd (first, (struct msgbuf __user *)p, second, third);
+ 	set_fs (old_fs);
+ out:
+ 	kfree (p);
+@@ -670,15 +671,15 @@
+ 
+ static int
+ do_sys32_msgrcv (int first, int second, int msgtyp, int third,
+-		 int version, void *uptr)
++		 int version, void __user *uptr)
+ {
+-	struct msgbuf32 *up;
++	struct msgbuf32 __user *up;
+ 	struct msgbuf *p;
+ 	mm_segment_t old_fs;
+ 	int err;
+ 
+ 	if (!version) {
+-		struct ipc_kludge32 *uipck = (struct ipc_kludge32 *)uptr;
++		struct ipc_kludge32 __user *uipck = (struct ipc_kludge32 __user *)uptr;
+ 		struct ipc_kludge32 ipck;
+ 
+ 		err = -EINVAL;
+@@ -687,7 +688,7 @@
+ 		err = -EFAULT;
+ 		if (copy_from_user (&ipck, uipck, sizeof (struct ipc_kludge32)))
+ 			goto out;
+-		uptr = (void *)AA(ipck.msgp);
++		uptr = (void __user *)AA(ipck.msgp);
+ 		msgtyp = ipck.msgtyp;
+ 	}
+ 
+@@ -699,11 +700,11 @@
+ 		goto out;
+ 	old_fs = get_fs ();
+ 	set_fs (KERNEL_DS);
+-	err = sys_msgrcv (first, p, second + 4, msgtyp, third);
++	err = sys_msgrcv (first, (struct msgbuf __user *)p, second + 4, msgtyp, third);
+ 	set_fs (old_fs);
+ 	if (err < 0)
+ 		goto free_then_out;
+-	up = (struct msgbuf32 *)uptr;
++	up = (struct msgbuf32 __user *)uptr;
+ 	if (put_user (p->mtype, &up->mtype) ||
+ 	    __copy_to_user (&up->mtext, p->mtext, err))
+ 		err = -EFAULT;
+@@ -714,19 +715,19 @@
+ }
+ 
+ static int
+-do_sys32_msgctl (int first, int second, void *uptr)
++do_sys32_msgctl (int first, int second, void __user *uptr)
+ {
+ 	int err = -EINVAL, err2;
+ 	struct msqid64_ds m;
+-	struct msqid_ds32 *up32 = (struct msqid_ds32 *)uptr;
+-	struct msqid64_ds32 *up64 = (struct msqid64_ds32 *)uptr;
++	struct msqid_ds32 __user *up32 = (struct msqid_ds32 __user *)uptr;
++	struct msqid64_ds32 __user *up64 = (struct msqid64_ds32 __user *)uptr;
+ 	mm_segment_t old_fs;
+ 
+ 	switch (second & ~IPC_64) {
+ 	case IPC_INFO:
+ 	case IPC_RMID:
+ 	case MSG_INFO:
+-		err = sys_msgctl (first, second, (struct msqid_ds *)uptr);
++		err = sys_msgctl (first, second, (struct msqid_ds __user *)uptr);
+ 		break;
+ 
+ 	case IPC_SET:
+@@ -753,7 +754,7 @@
+ 			break;
+ 		old_fs = get_fs();
+ 		set_fs(KERNEL_DS);
+-		err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m);
++		err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m);
+ 		set_fs(old_fs);
+ 		break;
+ 
+@@ -761,7 +762,7 @@
+ 	case MSG_STAT:
+ 		old_fs = get_fs();
+ 		set_fs(KERNEL_DS);
+-		err = sys_msgctl(first, second | IPC_64, (struct msqid_ds *)&m);
++		err = sys_msgctl(first, second | IPC_64, (struct msqid_ds __user *)&m);
+ 		set_fs(old_fs);
+ 		if (second & IPC_64) {
+ 			if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
+@@ -815,10 +816,10 @@
+ }
+ 
+ static int
+-do_sys32_shmat (int first, int second, int third, int version, void *uptr)
++do_sys32_shmat (int first, int second, int third, int version, void __user *uptr)
+ {
+ 	unsigned long raddr;
+-	u32 *uaddr = (u32 *)A((u32)third);
++	u32 __user *uaddr = (u32 __user *)A((u32)third);
+ 	int err = -EINVAL;
+ 
+ 	if (version == 1)
+@@ -837,11 +838,11 @@
+ };
+ 
+ static int
+-do_sys32_shmctl (int first, int second, void *uptr)
++do_sys32_shmctl (int first, int second, void __user *uptr)
+ {
+-	struct shmid64_ds32 *up64 = (struct shmid64_ds32 *)uptr;
+-	struct shmid_ds32 *up32 = (struct shmid_ds32 *)uptr;
+-	struct shm_info32 *uip = (struct shm_info32 *)uptr;
++	struct shmid64_ds32 __user *up64 = (struct shmid64_ds32 __user *)uptr;
++	struct shmid_ds32 __user *up32 = (struct shmid_ds32 __user *)uptr;
++	struct shm_info32 __user *uip = (struct shm_info32 __user *)uptr;
+ 	int err = -EFAULT, err2;
+ 	struct shmid64_ds s64;
+ 	mm_segment_t old_fs;
+@@ -854,7 +855,7 @@
+ 	case IPC_RMID:
+ 	case SHM_LOCK:
+ 	case SHM_UNLOCK:
+-		err = sys_shmctl(first, second, (struct shmid_ds *)uptr);
++		err = sys_shmctl(first, second, (struct shmid_ds __user *)uptr);
+ 		break;
+ 	case IPC_SET:
+ 		if (second & IPC_64) {
+@@ -870,7 +871,7 @@
+ 			break;
+ 		old_fs = get_fs();
+ 		set_fs(KERNEL_DS);
+-		err = sys_shmctl(first, second & ~IPC_64, &s);
++		err = sys_shmctl(first, second & ~IPC_64, (struct shmid_ds __user *)&s);
+ 		set_fs(old_fs);
+ 		break;
+ 
+@@ -878,7 +879,7 @@
+ 	case SHM_STAT:
+ 		old_fs = get_fs();
+ 		set_fs(KERNEL_DS);
+-		err = sys_shmctl(first, second | IPC_64, (void *) &s64);
++		err = sys_shmctl(first, second | IPC_64, (void __user *) &s64);
+ 		set_fs(old_fs);
+ 		if (err < 0)
+ 			break;
+@@ -928,7 +929,7 @@
+ 	case SHM_INFO:
+ 		old_fs = get_fs();
+ 		set_fs(KERNEL_DS);
+-		err = sys_shmctl(first, second, (void *)&si);
++		err = sys_shmctl(first, second, (void __user *)&si);
+ 		set_fs(old_fs);
+ 		if (err < 0)
+ 			break;
+@@ -950,11 +951,11 @@
+ 	return err;
+ }
+ 
+-static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
+-                            const struct compat_timespec *timeout32)
++static int sys32_semtimedop(int semid, struct sembuf __user *tsems, int nsems,
++                            const struct compat_timespec __user *timeout32)
+ {
+ 	struct compat_timespec t32;
+-	struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
++	struct timespec __user *t64 = compat_alloc_user_space(sizeof(*t64));
+ 
+ 	if (copy_from_user(&t32, timeout32, sizeof(t32)))
+ 		return -EFAULT;
+@@ -977,11 +978,11 @@
+ 	switch (call) {
+ 	case SEMOP:
+ 		/* struct sembuf is the same on 32 and 64bit :)) */
+-		err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second,
++		err = sys_semtimedop (first, (struct sembuf __user *)AA(ptr), second,
+ 		                      NULL);
+ 		break;
+ 	case SEMTIMEDOP:
+-		err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second,
++		err = sys32_semtimedop (first, (struct sembuf __user *)AA(ptr), second,
+ 		                      (const struct compat_timespec __user *)AA(fifth));
+ 		break;
+ 	case SEMGET:
+@@ -989,36 +990,36 @@
+ 		break;
+ 	case SEMCTL:
+ 		err = do_sys32_semctl (first, second, third,
+-				       (void *)AA(ptr));
++				       (void __user *)AA(ptr));
+ 		break;
+ 
+ 	case MSGSND:
+ 		err = do_sys32_msgsnd (first, second, third,
+-				       (void *)AA(ptr));
++				       (void __user *)AA(ptr));
+ 		break;
+ 	case MSGRCV:
+ 		err = do_sys32_msgrcv (first, second, fifth, third,
+-				       version, (void *)AA(ptr));
++				       version, (void __user *)AA(ptr));
+ 		break;
+ 	case MSGGET:
+ 		err = sys_msgget ((key_t) first, second);
+ 		break;
+ 	case MSGCTL:
+-		err = do_sys32_msgctl (first, second, (void *)AA(ptr));
++		err = do_sys32_msgctl (first, second, (void __user *)AA(ptr));
+ 		break;
+ 
+ 	case SHMAT:
+ 		err = do_sys32_shmat (first, second, third,
+-				      version, (void *)AA(ptr));
++				      version, (void __user *)AA(ptr));
+ 		break;
+ 	case SHMDT:
+-		err = sys_shmdt ((char *)A(ptr));
++		err = sys_shmdt ((char __user *)A(ptr));
+ 		break;
+ 	case SHMGET:
+ 		err = sys_shmget (first, (unsigned)second, third);
+ 		break;
+ 	case SHMCTL:
+-		err = do_sys32_shmctl (first, second, (void *)AA(ptr));
++		err = do_sys32_shmctl (first, second, (void __user *)AA(ptr));
+ 		break;
+ 	default:
+ 		err = -EINVAL;
+@@ -1029,7 +1030,7 @@
+ }
+ 
+ asmlinkage long sys32_shmat(int shmid, char __user *shmaddr,
+-			  int shmflg, int32_t *addr)
++			  int shmflg, int32_t __user *addr)
+ {
+ 	unsigned long raddr;
+ 	int err;
+@@ -1054,12 +1055,13 @@
+ 
+ #ifdef CONFIG_SYSCTL
+ 
+-asmlinkage long sys32_sysctl(struct sysctl_args32 *args)
++asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
+ {
+ 	struct sysctl_args32 tmp;
+ 	int error;
+-	size_t oldlen, *oldlenp = NULL;
+-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
++	size_t oldlen;
++	size_t __user *oldlenp = NULL;
++	unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7;
+ 
+ 	if (copy_from_user(&tmp, args, sizeof(tmp)))
+ 		return -EFAULT;
+@@ -1071,20 +1073,20 @@
+ 		   basically copy the whole sysctl.c here, and
+ 		   glibc's __sysctl uses rw memory for the structure
+ 		   anyway.  */
+-		if (get_user(oldlen, (u32 *)A(tmp.oldlenp)) ||
+-		    put_user(oldlen, (size_t *)addr))
++		if (get_user(oldlen, (u32 __user *)A(tmp.oldlenp)) ||
++		    put_user(oldlen, (size_t __user *)addr))
+ 			return -EFAULT;
+-		oldlenp = (size_t *)addr;
++		oldlenp = (size_t __user *)addr;
+ 	}
+ 
+ 	lock_kernel();
+-	error = do_sysctl((int *)A(tmp.name), tmp.nlen, (void *)A(tmp.oldval),
+-			  oldlenp, (void *)A(tmp.newval), tmp.newlen);
++	error = do_sysctl((int __user *)A(tmp.name), tmp.nlen, (void __user *)A(tmp.oldval),
++			  oldlenp, (void __user *)A(tmp.newval), tmp.newlen);
+ 	unlock_kernel();
+ 	if (oldlenp) {
+ 		if (!error) {
+-			if (get_user(oldlen, (size_t *)addr) ||
+-			    put_user(oldlen, (u32 *)A(tmp.oldlenp)))
++			if (get_user(oldlen, (size_t __user *)addr) ||
++			    put_user(oldlen, (u32 __user *)A(tmp.oldlenp)))
+ 				error = -EFAULT;
+ 		}
+ 		copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
+@@ -1094,7 +1096,7 @@
+ 
+ #endif /* CONFIG_SYSCTL */
+ 
+-asmlinkage long sys32_newuname(struct new_utsname * name)
++asmlinkage long sys32_newuname(struct new_utsname __user * name)
+ {
+ 	int ret = 0;
+ 
+@@ -1129,9 +1131,9 @@
+ 	char		f_fpack[6];
+ };
+ 
+-extern asmlinkage long sys_ustat(dev_t dev, struct ustat * ubuf);
++extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf);
+ 
+-asmlinkage int sys32_ustat(dev_t dev, struct ustat32 * ubuf32)
++asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32)
+ {
+ 	int err;
+         struct ustat tmp;
+@@ -1139,7 +1141,7 @@
+ 	mm_segment_t old_fs = get_fs();
+ 
+ 	set_fs(KERNEL_DS);
+-	err = sys_ustat(dev, &tmp);
++	err = sys_ustat(dev, (struct ustat __user *)&tmp);
+ 	set_fs (old_fs);
+ 
+ 	if (err)
+@@ -1172,7 +1174,7 @@
+ 
+ extern int do_adjtimex(struct timex *);
+ 
+-asmlinkage int sys32_adjtimex(struct timex32 *utp)
++asmlinkage int sys32_adjtimex(struct timex32 __user *utp)
+ {
+ 	struct timex txc;
+ 	int ret;
+@@ -1228,7 +1230,7 @@
+ 	return ret;
+ }
+ 
+-asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset,
++asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
+ 	s32 count)
+ {
+ 	mm_segment_t old_fs = get_fs();
+@@ -1239,7 +1241,7 @@
+ 		return -EFAULT;
+ 
+ 	set_fs(KERNEL_DS);
+-	ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
++	ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
+ 	set_fs(old_fs);
+ 
+ 	if (offset && put_user(of, offset))
+@@ -1269,7 +1271,7 @@
+  *  it is set by the callees.
+  */
+ 
+-asmlinkage long sys32_socketcall(int call, unsigned int *args32)
++asmlinkage long sys32_socketcall(int call, unsigned int __user *args32)
+ {
+ 	unsigned int a[6];
+ 	unsigned int a0,a1;
+@@ -1291,7 +1293,7 @@
+ 					    struct sockaddr __user *addr, int __user *addr_len);
+ 	extern asmlinkage long sys_shutdown(int fd, int how);
+ 	extern asmlinkage long sys_setsockopt(int fd, int level, int optname, char __user *optval, int optlen);
+-	extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int *optlen);
++	extern asmlinkage long sys_getsockopt(int fd, int level, int optname, char __user *optval, int __user *optlen);
+ 	extern asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags);
+ 	extern asmlinkage long sys_recvmsg(int fd, struct msghdr __user *msg, unsigned int flags);
+ 
+@@ -1411,7 +1413,7 @@
+ 	newsp = regs.regs[5];
+ 	if (!newsp)
+ 		newsp = regs.regs[29];
+-	parent_tidptr = (int *) regs.regs[6];
++	parent_tidptr = (int __user *) regs.regs[6];
+ 
+ 	/* Use __dummy4 instead of getting it off the stack, so that
+ 	   syscall() works.  */
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/proc.c linux-2.6.16/arch/mips/kernel/proc.c
+--- linux-2.6.16.orig/arch/mips/kernel/proc.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/proc.c	2006-03-21 01:05:47.000000000 +0000
+@@ -135,6 +135,7 @@
+ 	        cpu_has_vce ? "%u" : "not available");
+ 	seq_printf(m, fmt, 'D', vced_count);
+ 	seq_printf(m, fmt, 'I', vcei_count);
++	seq_printf(m, "\n");
+ 
+ 	return 0;
+ }
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/process.c linux-2.6.16/arch/mips/kernel/process.c
+--- linux-2.6.16.orig/arch/mips/kernel/process.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/process.c	2006-03-21 01:05:47.000000000 +0000
+@@ -60,17 +60,9 @@
+ 	}
+ }
+ 
+-extern void do_signal(struct pt_regs *regs);
+-extern void do_signal32(struct pt_regs *regs);
+-
+ /*
+  * Native o32 and N64 ABI without DSP ASE
+  */
+-extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
+-        int signr, sigset_t *set);
+-extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
+-        int signr, sigset_t *set, siginfo_t *info);
+-
+ struct mips_abi mips_abi = {
+ 	.do_signal	= do_signal,
+ #ifdef CONFIG_TRAD_SIGNALS
+@@ -83,11 +75,6 @@
+ /*
+  * o32 compatibility on 64-bit kernels, without DSP ASE
+  */
+-extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
+-        int signr, sigset_t *set);
+-extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
+-        int signr, sigset_t *set, siginfo_t *info);
+-
+ struct mips_abi mips_abi_32 = {
+ 	.do_signal	= do_signal32,
+ 	.setup_frame	= setup_frame_32,
+@@ -99,9 +86,6 @@
+ /*
+  * N32 on 64-bit kernels, without DSP ASE
+  */
+-extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
+-        int signr, sigset_t *set, siginfo_t *info);
+-
+ struct mips_abi mips_abi_n32 = {
+ 	.do_signal	= do_signal,
+ 	.setup_rt_frame	= setup_rt_frame_n32
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/ptrace.c linux-2.6.16/arch/mips/kernel/ptrace.c
+--- linux-2.6.16.orig/arch/mips/kernel/ptrace.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/ptrace.c	2006-03-21 01:05:47.000000000 +0000
+@@ -21,12 +21,12 @@
+ #include <linux/mm.h>
+ #include <linux/errno.h>
+ #include <linux/ptrace.h>
+-#include <linux/audit.h>
+ #include <linux/smp.h>
+ #include <linux/smp_lock.h>
+ #include <linux/user.h>
+ #include <linux/security.h>
+-#include <linux/signal.h>
++#include <linux/audit.h>
++#include <linux/seccomp.h>
+ 
+ #include <asm/byteorder.h>
+ #include <asm/cpu.h>
+@@ -468,12 +468,16 @@
+  */
+ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
+ {
++	/* do the secure computing check first */
++	secure_computing(regs->orig_eax);
++
+ 	if (unlikely(current->audit_context) && entryexit)
+ 		audit_syscall_exit(current, AUDITSC_RESULT(regs->regs[2]),
+ 		                   regs->regs[2]);
+ 
+ 	if (!(current->ptrace & PT_PTRACED))
+ 		goto out;
++
+ 	if (!test_thread_flag(TIF_SYSCALL_TRACE))
+ 		goto out;
+ 
+@@ -491,9 +495,14 @@
+ 		send_sig(current->exit_code, current, 1);
+ 		current->exit_code = 0;
+ 	}
+- out:
++
++out:
++	/* There is no ->orig_eax and that's quite intensional for now making
++	   this work will require some work in various other place before it's
++	   more than a placebo.  */
++
+ 	if (unlikely(current->audit_context) && !entryexit)
+-		audit_syscall_entry(current, audit_arch(), regs->regs[2],
+-				    regs->regs[4], regs->regs[5],
+-				    regs->regs[6], regs->regs[7]);
++		audit_syscall_entry(current, audit_arch(), regs->orig_eax,
++		                    regs->regs[4], regs->regs[5],
++		                    regs->regs[6], regs->regs[7]);
+ }
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/setup.c linux-2.6.16/arch/mips/kernel/setup.c
+--- linux-2.6.16.orig/arch/mips/kernel/setup.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/setup.c	2006-03-21 01:05:47.000000000 +0000
+@@ -447,21 +447,10 @@
+ {
+ 	int i;
+ 
+-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+-	/*
+-	 * The 64bit code in 32bit object format trick can't represent
+-	 * 64bit wide relocations for linker script symbols.
+-	 */
+-	code_resource.start = CPHYSADDR(&_text);
+-	code_resource.end = CPHYSADDR(&_etext) - 1;
+-	data_resource.start = CPHYSADDR(&_etext);
+-	data_resource.end = CPHYSADDR(&_edata) - 1;
+-#else
+ 	code_resource.start = virt_to_phys(&_text);
+ 	code_resource.end = virt_to_phys(&_etext) - 1;
+ 	data_resource.start = virt_to_phys(&_etext);
+ 	data_resource.end = virt_to_phys(&_edata) - 1;
+-#endif
+ 
+ 	/*
+ 	 * Request address space for all standard RAM.
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/signal.c linux-2.6.16/arch/mips/kernel/signal.c
+--- linux-2.6.16.orig/arch/mips/kernel/signal.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/signal.c	2006-03-21 01:05:47.000000000 +0000
+@@ -100,8 +100,8 @@
+ }
+ 
+ #ifdef CONFIG_TRAD_SIGNALS
+-asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
+-	struct sigaction *oact)
++asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act,
++	struct sigaction __user *oact)
+ {
+ 	struct k_sigaction new_ka, old_ka;
+ 	int ret;
+@@ -331,7 +331,7 @@
+ 	/* Create the ucontext.  */
+ 	err |= __put_user(0, &frame->rs_uc.uc_flags);
+ 	err |= __put_user(NULL, &frame->rs_uc.uc_link);
+-	err |= __put_user((void *)current->sas_ss_sp,
++	err |= __put_user((void __user *)current->sas_ss_sp,
+ 	                  &frame->rs_uc.uc_stack.ss_sp);
+ 	err |= __put_user(sas_ss_flags(regs->regs[29]),
+ 	                  &frame->rs_uc.uc_stack.ss_flags);
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/signal32.c linux-2.6.16/arch/mips/kernel/signal32.c
+--- linux-2.6.16.orig/arch/mips/kernel/signal32.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/signal32.c	2006-03-21 01:05:47.000000000 +0000
+@@ -163,7 +163,7 @@
+ 	return err;
+ }
+ 
+-static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t *ubuf)
++static inline int get_sigset(sigset_t *kbuf, const compat_sigset_t __user *ubuf)
+ {
+ 	int err = 0;
+ 	unsigned long sig[4];
+@@ -195,10 +195,10 @@
+ __attribute_used__ noinline static int
+ _sys32_sigsuspend(nabi_no_regargs struct pt_regs regs)
+ {
+-	compat_sigset_t *uset;
++	compat_sigset_t __user *uset;
+ 	sigset_t newset;
+ 
+-	uset = (compat_sigset_t *) regs.regs[4];
++	uset = (compat_sigset_t __user *) regs.regs[4];
+ 	if (get_sigset(&newset, uset))
+ 		return -EFAULT;
+ 	sigdelsetmask(&newset, ~_BLOCKABLE);
+@@ -219,7 +219,7 @@
+ __attribute_used__ noinline static int
+ _sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
+ {
+-	compat_sigset_t *uset;
++	compat_sigset_t __user *uset;
+ 	sigset_t newset;
+ 	size_t sigsetsize;
+ 
+@@ -228,7 +228,7 @@
+ 	if (sigsetsize != sizeof(compat_sigset_t))
+ 		return -EINVAL;
+ 
+-	uset = (compat_sigset_t *) regs.regs[4];
++	uset = (compat_sigset_t __user *) regs.regs[4];
+ 	if (get_sigset(&newset, uset))
+ 		return -EFAULT;
+ 	sigdelsetmask(&newset, ~_BLOCKABLE);
+@@ -236,7 +236,7 @@
+ 	spin_lock_irq(&current->sighand->siglock);
+ 	current->saved_sigmask = current->blocked;
+ 	current->blocked = newset;
+-        recalc_sigpending();
++	recalc_sigpending();
+ 	spin_unlock_irq(&current->sighand->siglock);
+ 
+ 	current->state = TASK_INTERRUPTIBLE;
+@@ -245,8 +245,8 @@
+ 	return -ERESTARTNOHAND;
+ }
+ 
+-asmlinkage int sys32_sigaction(int sig, const struct sigaction32 *act,
+-                               struct sigaction32 *oact)
++asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act,
++                               struct sigaction32 __user *oact)
+ {
+ 	struct k_sigaction new_ka, old_ka;
+ 	int ret;
+@@ -272,15 +272,15 @@
+ 
+ 	if (!ret && oact) {
+ 		if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
+-                        return -EFAULT;
++			return -EFAULT;
+ 		err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
+ 		err |= __put_user((u32)(u64)old_ka.sa.sa_handler,
+ 		                  &oact->sa_handler);
+ 		err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
+-                err |= __put_user(0, &oact->sa_mask.sig[1]);
+-                err |= __put_user(0, &oact->sa_mask.sig[2]);
+-                err |= __put_user(0, &oact->sa_mask.sig[3]);
+-                if (err)
++		err |= __put_user(0, &oact->sa_mask.sig[1]);
++		err |= __put_user(0, &oact->sa_mask.sig[2]);
++		err |= __put_user(0, &oact->sa_mask.sig[3]);
++		if (err)
+ 			return -EFAULT;
+ 	}
+ 
+@@ -301,7 +301,7 @@
+ 		if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
+ 			return -EFAULT;
+ 		err |= __get_user(sp, &uss->ss_sp);
+-		kss.ss_sp = (void *) (long) sp;
++		kss.ss_sp = (void __user *) (long) sp;
+ 		err |= __get_user(kss.ss_size, &uss->ss_size);
+ 		err |= __get_user(kss.ss_flags, &uss->ss_flags);
+ 		if (err)
+@@ -316,7 +316,7 @@
+ 	if (!ret && uoss) {
+ 		if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
+ 			return -EFAULT;
+-		sp = (int) (long) koss.ss_sp;
++		sp = (int) (unsigned long) koss.ss_sp;
+ 		err |= __put_user(sp, &uoss->ss_sp);
+ 		err |= __put_user(koss.ss_size, &uoss->ss_size);
+ 		err |= __put_user(koss.ss_flags, &uoss->ss_flags);
+@@ -527,7 +527,7 @@
+ 	/* The ucontext contains a stack32_t, so we must convert!  */
+ 	if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
+ 		goto badframe;
+-	st.ss_sp = (void *)(long) sp;
++	st.ss_sp = (void __user *)(long) sp;
+ 	if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
+ 		goto badframe;
+ 	if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
+@@ -624,11 +624,11 @@
+ 	sp = regs->regs[29];
+ 
+ 	/*
+- 	 * FPU emulator may have it's own trampoline active just
+- 	 * above the user stack, 16-bytes before the next lowest
+- 	 * 16 byte boundary.  Try to avoid trashing it.
+- 	 */
+- 	sp -= 32;
++	 * FPU emulator may have it's own trampoline active just
++	 * above the user stack, 16-bytes before the next lowest
++	 * 16 byte boundary.  Try to avoid trashing it.
++	 */
++	sp -= 32;
+ 
+ 	/* This is the X/Open sanctioned signal stack switching.  */
+ 	if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
+@@ -868,7 +868,7 @@
+ 	}
+ }
+ 
+-asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 *act,
++asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
+ 				  struct sigaction32 __user *oact,
+ 				  unsigned int sigsetsize)
+ {
+@@ -912,7 +912,7 @@
+ 	return ret;
+ }
+ 
+-asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set,
++asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
+ 	compat_sigset_t __user *oset, unsigned int sigsetsize)
+ {
+ 	sigset_t old_set, new_set;
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/signal_n32.c linux-2.6.16/arch/mips/kernel/signal_n32.c
+--- linux-2.6.16.orig/arch/mips/kernel/signal_n32.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/signal_n32.c	2006-03-21 01:05:47.000000000 +0000
+@@ -87,7 +87,8 @@
+ __attribute_used__ noinline static int
+ _sysn32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
+ {
+-	compat_sigset_t __user *unewset, uset;
++	compat_sigset_t __user *unewset;
++	compat_sigset_t uset;
+ 	size_t sigsetsize;
+ 	sigset_t newset;
+ 
+@@ -141,7 +142,7 @@
+ 	/* The ucontext contains a stack32_t, so we must convert!  */
+ 	if (__get_user(sp, &frame->rs_uc.uc_stack.ss_sp))
+ 		goto badframe;
+-	st.ss_sp = (void *)(long) sp;
++	st.ss_sp = (void __user *)(long) sp;
+ 	if (__get_user(st.ss_size, &frame->rs_uc.uc_stack.ss_size))
+ 		goto badframe;
+ 	if (__get_user(st.ss_flags, &frame->rs_uc.uc_stack.ss_flags))
+diff -Naur linux-2.6.16.orig/arch/mips/kernel/syscall.c linux-2.6.16/arch/mips/kernel/syscall.c
+--- linux-2.6.16.orig/arch/mips/kernel/syscall.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/kernel/syscall.c	2006-03-21 01:05:47.000000000 +0000
+@@ -162,7 +162,10 @@
+ sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
+           unsigned long flags, unsigned long fd, unsigned long pgoff)
+ {
+-	return do_mmap2(addr, len, prot, flags, fd, pgoff);
++	if (pgoff & (~PAGE_MASK >> 12))
++		return -EINVAL;
++
++	return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12));
+ }
+ 
+ save_static_function(sys_fork);
+@@ -345,7 +348,7 @@
+ 		union semun fourth;
+ 		if (!ptr)
+ 			return -EINVAL;
+-		if (get_user(fourth.__pad, (void *__user *) ptr))
++		if (get_user(fourth.__pad, (void __user *__user *) ptr))
+ 			return -EFAULT;
+ 		return sys_semctl (first, second, third, fourth);
+ 	}
+diff -Naur linux-2.6.16.orig/arch/mips/lib-32/dump_tlb.c linux-2.6.16/arch/mips/lib-32/dump_tlb.c
+--- linux-2.6.16.orig/arch/mips/lib-32/dump_tlb.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/lib-32/dump_tlb.c	2006-03-21 01:05:47.000000000 +0000
+@@ -41,8 +41,6 @@
+ 		return "256Mb";
+ #endif
+ 	}
+-
+-	return "unknown";
+ }
+ 
+ #define BARRIER()					\
+diff -Naur linux-2.6.16.orig/arch/mips/lib-64/dump_tlb.c linux-2.6.16/arch/mips/lib-64/dump_tlb.c
+--- linux-2.6.16.orig/arch/mips/lib-64/dump_tlb.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/lib-64/dump_tlb.c	2006-03-21 01:05:47.000000000 +0000
+@@ -32,8 +32,6 @@
+ 	case PM_256M:	return "256Mb";
+ #endif
+ 	}
+-
+-	return "unknown";
+ }
+ 
+ #define BARRIER()					\
+diff -Naur linux-2.6.16.orig/arch/mips/mm/Makefile linux-2.6.16/arch/mips/mm/Makefile
+--- linux-2.6.16.orig/arch/mips/mm/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/Makefile	2006-03-21 01:05:47.000000000 +0000
+@@ -12,7 +12,7 @@
+ obj-$(CONFIG_CPU_MIPS32)	+= c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
+ obj-$(CONFIG_CPU_MIPS64)	+= c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
+ obj-$(CONFIG_CPU_NEVADA)	+= c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
+-obj-$(CONFIG_CPU_R10000)	+= c-r4k.o cex-gen.o pg-r4k.o tlb-andes.o
++obj-$(CONFIG_CPU_R10000)	+= c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
+ obj-$(CONFIG_CPU_R3000)		+= c-r3k.o tlb-r3k.o pg-r4k.o
+ obj-$(CONFIG_CPU_R4300)		+= c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
+ obj-$(CONFIG_CPU_R4X00)		+= c-r4k.o cex-gen.o pg-r4k.o tlb-r4k.o
+diff -Naur linux-2.6.16.orig/arch/mips/mm/c-r4k.c linux-2.6.16/arch/mips/mm/c-r4k.c
+--- linux-2.6.16.orig/arch/mips/mm/c-r4k.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/c-r4k.c	2006-03-21 01:05:47.000000000 +0000
+@@ -786,6 +786,7 @@
+ 		c->dcache.waybit = 0;
+ 
+ 		c->options |= MIPS_CPU_CACHE_CDEX_P;
++		c->options |= MIPS_CPU_PREFETCH;
+ 		break;
+ 
+ 	case CPU_R4000PC:
+diff -Naur linux-2.6.16.orig/arch/mips/mm/pg-r4k.c linux-2.6.16/arch/mips/mm/pg-r4k.c
+--- linux-2.6.16.orig/arch/mips/mm/pg-r4k.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/pg-r4k.c	2006-03-21 01:05:47.000000000 +0000
+@@ -124,7 +124,7 @@
+ 
+ static inline void build_src_pref(int advance)
+ {
+-	if (!(load_offset & (cpu_dcache_line_size() - 1))) {
++	if (!(load_offset & (cpu_dcache_line_size() - 1)) && advance) {
+ 		union mips_instruction mi;
+ 
+ 		mi.i_format.opcode     = pref_op;
+@@ -166,7 +166,7 @@
+ 
+ static inline void build_dst_pref(int advance)
+ {
+-	if (!(store_offset & (cpu_dcache_line_size() - 1))) {
++	if (!(store_offset & (cpu_dcache_line_size() - 1)) && advance) {
+ 		union mips_instruction mi;
+ 
+ 		mi.i_format.opcode     = pref_op;
+@@ -340,6 +340,12 @@
+ 
+ 	if (cpu_has_prefetch) {
+ 		switch (current_cpu_data.cputype) {
++		case CPU_TX49XX:
++			/* TX49 supports only Pref_Load */
++			pref_offset_clear = 0;
++			pref_offset_copy = 0;
++			break;
++
+ 		case CPU_RM9000:
+ 			/*
+ 			 * As a workaround for erratum G105 which make the
+diff -Naur linux-2.6.16.orig/arch/mips/mm/sc-rm7k.c linux-2.6.16/arch/mips/mm/sc-rm7k.c
+--- linux-2.6.16.orig/arch/mips/mm/sc-rm7k.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/sc-rm7k.c	2006-03-21 01:05:47.000000000 +0000
+@@ -9,6 +9,7 @@
+ #include <linux/init.h>
+ #include <linux/kernel.h>
+ #include <linux/mm.h>
++#include <linux/bitops.h>
+ 
+ #include <asm/addrspace.h>
+ #include <asm/bcache.h>
+@@ -43,14 +44,7 @@
+ 	/* Catch bad driver code */
+ 	BUG_ON(size == 0);
+ 
+-	a = addr & ~(sc_lsize - 1);
+-	end = (addr + size - 1) & ~(sc_lsize - 1);
+-	while (1) {
+-		flush_scache_line(a);	/* Hit_Writeback_Inv_SD */
+-		if (a == end)
+-			break;
+-		a += sc_lsize;
+-	}
++	blast_scache_range(addr, addr + size);
+ 
+ 	if (!rm7k_tcache_enabled)
+ 		return;
+@@ -74,14 +68,7 @@
+ 	/* Catch bad driver code */
+ 	BUG_ON(size == 0);
+ 
+-	a = addr & ~(sc_lsize - 1);
+-	end = (addr + size - 1) & ~(sc_lsize - 1);
+-	while (1) {
+-		invalidate_scache_line(a);	/* Hit_Invalidate_SD */
+-		if (a == end)
+-			break;
+-		a += sc_lsize;
+-	}
++	blast_inv_scache_range(addr, addr + size);
+ 
+ 	if (!rm7k_tcache_enabled)
+ 		return;
+@@ -143,11 +130,17 @@
+ 
+ void __init rm7k_sc_init(void)
+ {
++	struct cpuinfo_mips *c = &current_cpu_data;
+ 	unsigned int config = read_c0_config();
+ 
+ 	if ((config & RM7K_CONF_SC))
+ 		return;
+ 
++	c->scache.linesz = sc_lsize;
++	c->scache.ways = 4;
++	c->scache.waybit= ffs(scache_size / c->scache.ways) - 1;
++	c->scache.waysize = scache_size / c->scache.ways;
++	c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways);
+ 	printk(KERN_INFO "Secondary cache size %dK, linesize %d bytes.\n",
+ 	       (scache_size >> 10), sc_lsize);
+ 
+diff -Naur linux-2.6.16.orig/arch/mips/mm/tlb-andes.c linux-2.6.16/arch/mips/mm/tlb-andes.c
+--- linux-2.6.16.orig/arch/mips/mm/tlb-andes.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/tlb-andes.c	1970-01-01 00:00:00.000000000 +0000
+@@ -1,259 +0,0 @@
+-/*
+- * This file is subject to the terms and conditions of the GNU General Public
+- * License.  See the file "COPYING" in the main directory of this archive
+- * for more details.
+- *
+- * Copyright (C) 1997, 1998, 1999 Ralf Baechle (ralf@gnu.org)
+- * Copyright (C) 1999 Silicon Graphics, Inc.
+- * Copyright (C) 2000 Kanoj Sarcar (kanoj@sgi.com)
+- */
+-#include <linux/init.h>
+-#include <linux/kernel.h>
+-#include <linux/sched.h>
+-#include <linux/mm.h>
+-#include <asm/page.h>
+-#include <asm/pgtable.h>
+-#include <asm/system.h>
+-#include <asm/mmu_context.h>
+-
+-extern void build_tlb_refill_handler(void);
+-
+-#define NTLB_ENTRIES       64
+-#define NTLB_ENTRIES_HALF  32
+-
+-void local_flush_tlb_all(void)
+-{
+-	unsigned long flags;
+-	unsigned long old_ctx;
+-	unsigned long entry;
+-
+-	local_irq_save(flags);
+-	/* Save old context and create impossible VPN2 value */
+-	old_ctx = read_c0_entryhi() & ASID_MASK;
+-	write_c0_entryhi(CKSEG0);
+-	write_c0_entrylo0(0);
+-	write_c0_entrylo1(0);
+-
+-	entry = read_c0_wired();
+-
+-	/* Blast 'em all away. */
+-	while (entry < NTLB_ENTRIES) {
+-		write_c0_index(entry);
+-		tlb_write_indexed();
+-		entry++;
+-	}
+-	write_c0_entryhi(old_ctx);
+-	local_irq_restore(flags);
+-}
+-
+-void local_flush_tlb_mm(struct mm_struct *mm)
+-{
+-	int cpu = smp_processor_id();
+-	if (cpu_context(cpu, mm) != 0) {
+-		drop_mmu_context(mm,cpu);
+-	}
+-}
+-
+-void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
+-                           unsigned long end)
+-{
+-	struct mm_struct *mm = vma->vm_mm;
+-	int cpu = smp_processor_id();
+-
+-	if (cpu_context(cpu, mm) != 0) {
+-		unsigned long flags;
+-		int size;
+-
+-		local_irq_save(flags);
+-		size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+-		size = (size + 1) >> 1;
+-		if (size <= NTLB_ENTRIES_HALF) {
+-			int oldpid = (read_c0_entryhi() & ASID_MASK);
+-			int newpid = (cpu_context(smp_processor_id(), mm)
+-				      & ASID_MASK);
+-
+-			start &= (PAGE_MASK << 1);
+-			end += ((PAGE_SIZE << 1) - 1);
+-			end &= (PAGE_MASK << 1);
+-			while(start < end) {
+-				int idx;
+-
+-				write_c0_entryhi(start | newpid);
+-				start += (PAGE_SIZE << 1);
+-				tlb_probe();
+-				idx = read_c0_index();
+-				write_c0_entrylo0(0);
+-				write_c0_entrylo1(0);
+-				write_c0_entryhi(CKSEG0);
+-				if(idx < 0)
+-					continue;
+-				tlb_write_indexed();
+-			}
+-			write_c0_entryhi(oldpid);
+-		} else {
+-			drop_mmu_context(mm, cpu);
+-		}
+-		local_irq_restore(flags);
+-	}
+-}
+-
+-void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
+-{
+-	unsigned long flags;
+-	int size;
+-
+-	size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+-	size = (size + 1) >> 1;
+-
+-	local_irq_save(flags);
+-	if (size <= NTLB_ENTRIES_HALF) {
+-		int pid = read_c0_entryhi();
+-
+-		start &= (PAGE_MASK << 1);
+-		end += ((PAGE_SIZE << 1) - 1);
+-		end &= (PAGE_MASK << 1);
+-
+-		while (start < end) {
+-			int idx;
+-
+-			write_c0_entryhi(start);
+-			start += (PAGE_SIZE << 1);
+-			tlb_probe();
+-			idx = read_c0_index();
+-			write_c0_entrylo0(0);
+-			write_c0_entrylo1(0);
+-			write_c0_entryhi(CKSEG0 + (idx << (PAGE_SHIFT+1)));
+-			if (idx < 0)
+-				continue;
+-			tlb_write_indexed();
+-		}
+-		write_c0_entryhi(pid);
+-	} else {
+-		local_flush_tlb_all();
+-	}
+-	local_irq_restore(flags);
+-}
+-
+-void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
+-{
+-	if (cpu_context(smp_processor_id(), vma->vm_mm) != 0) {
+-		unsigned long flags;
+-		int oldpid, newpid, idx;
+-
+-		newpid = (cpu_context(smp_processor_id(), vma->vm_mm) &
+-			  ASID_MASK);
+-		page &= (PAGE_MASK << 1);
+-		local_irq_save(flags);
+-		oldpid = (read_c0_entryhi() & ASID_MASK);
+-		write_c0_entryhi(page | newpid);
+-		tlb_probe();
+-		idx = read_c0_index();
+-		write_c0_entrylo0(0);
+-		write_c0_entrylo1(0);
+-		write_c0_entryhi(CKSEG0);
+-		if (idx < 0)
+-			goto finish;
+-		tlb_write_indexed();
+-
+-	finish:
+-		write_c0_entryhi(oldpid);
+-		local_irq_restore(flags);
+-	}
+-}
+-
+-/*
+- * This one is only used for pages with the global bit set so we don't care
+- * much about the ASID.
+- */
+-void local_flush_tlb_one(unsigned long page)
+-{
+-	unsigned long flags;
+-	int oldpid, idx;
+-
+-	local_irq_save(flags);
+-	page &= (PAGE_MASK << 1);
+-	oldpid = read_c0_entryhi() & 0xff;
+-	write_c0_entryhi(page);
+-	tlb_probe();
+-	idx = read_c0_index();
+-	write_c0_entrylo0(0);
+-	write_c0_entrylo1(0);
+-	if (idx >= 0) {
+-		/* Make sure all entries differ. */
+-		write_c0_entryhi(CKSEG0+(idx<<(PAGE_SHIFT+1)));
+-		tlb_write_indexed();
+-	}
+-	write_c0_entryhi(oldpid);
+-
+-	local_irq_restore(flags);
+-}
+-
+-/* XXX Simplify this.  On the R10000 writing a TLB entry for an virtual
+-   address that already exists will overwrite the old entry and not result
+-   in TLB malfunction or TLB shutdown.  */
+-void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
+-{
+-	unsigned long flags;
+-	pgd_t *pgdp;
+-	pud_t *pudp;
+-	pmd_t *pmdp;
+-	pte_t *ptep;
+-	int idx, pid;
+-
+-	/*
+-	 * Handle debugger faulting in for debugee.
+-	 */
+-	if (current->active_mm != vma->vm_mm)
+-		return;
+-
+-	pid = read_c0_entryhi() & ASID_MASK;
+-
+-	if ((pid != (cpu_context(smp_processor_id(), vma->vm_mm) & ASID_MASK))
+-	    || (cpu_context(smp_processor_id(), vma->vm_mm) == 0)) {
+-		printk(KERN_WARNING
+-		       "%s: Wheee, bogus tlbpid mmpid=%d tlbpid=%d\n",
+-		       __FUNCTION__, (int) (cpu_context(smp_processor_id(),
+-		       vma->vm_mm) & ASID_MASK), pid);
+-	}
+-
+-	local_irq_save(flags);
+-	address &= (PAGE_MASK << 1);
+-	write_c0_entryhi(address | (pid));
+-	pgdp = pgd_offset(vma->vm_mm, address);
+-	tlb_probe();
+-	pudp = pud_offset(pgdp, address);
+-	pmdp = pmd_offset(pudp, address);
+-	idx = read_c0_index();
+-	ptep = pte_offset_map(pmdp, address);
+-	write_c0_entrylo0(pte_val(*ptep++) >> 6);
+-	write_c0_entrylo1(pte_val(*ptep) >> 6);
+-	write_c0_entryhi(address | pid);
+-	if (idx < 0) {
+-		tlb_write_random();
+-	} else {
+-		tlb_write_indexed();
+-	}
+-	write_c0_entryhi(pid);
+-	local_irq_restore(flags);
+-}
+-
+-void __init tlb_init(void)
+-{
+-	/*
+-	 * You should never change this register:
+-	 *   - On R4600 1.7 the tlbp never hits for pages smaller than
+-	 *     the value in the c0_pagemask register.
+-	 *   - The entire mm handling assumes the c0_pagemask register to
+-	 *     be set for 4kb pages.
+-	 */
+-	write_c0_pagemask(PM_4K);
+-	write_c0_wired(0);
+-	write_c0_framemask(0);
+-
+-        /* From this point on the ARC firmware is dead.  */
+-	local_flush_tlb_all();
+-
+-	/* Did I tell you that ARC SUCKS?  */
+-
+-	build_tlb_refill_handler();
+-}
+diff -Naur linux-2.6.16.orig/arch/mips/mm/tlb-r4k.c linux-2.6.16/arch/mips/mm/tlb-r4k.c
+--- linux-2.6.16.orig/arch/mips/mm/tlb-r4k.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/tlb-r4k.c	2006-03-21 01:05:47.000000000 +0000
+@@ -424,8 +424,13 @@
+ 	probe_tlb(config);
+ 	write_c0_pagemask(PM_DEFAULT_MASK);
+ 	write_c0_wired(0);
++	write_c0_framemask(0);
+ 	temp_tlb_entry = current_cpu_data.tlbsize - 1;
++
++        /* From this point on the ARC firmware is dead.  */
+ 	local_flush_tlb_all();
+ 
++	/* Did I tell you that ARC SUCKS?  */
++
+ 	build_tlb_refill_handler();
+ }
+diff -Naur linux-2.6.16.orig/arch/mips/mm/tlbex.c linux-2.6.16/arch/mips/mm/tlbex.c
+--- linux-2.6.16.orig/arch/mips/mm/tlbex.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/mm/tlbex.c	2006-03-21 01:05:47.000000000 +0000
+@@ -951,7 +951,6 @@
+ 	/* No i_nop needed here, since the next insn doesn't touch TMP. */
+ 
+ #ifdef CONFIG_SMP
+-# ifdef CONFIG_BUILD_ELF64
+ 	/*
+ 	 * 64 bit SMP running in XKPHYS has smp_processor_id() << 3
+ 	 * stored in CONTEXT.
+@@ -962,18 +961,6 @@
+ 	i_daddu(p, ptr, ptr, tmp);
+ 	i_dmfc0(p, tmp, C0_BADVADDR);
+ 	i_ld(p, ptr, rel_lo(pgdc), ptr);
+-# else
+-	/*
+-	 * 64 bit SMP running in compat space has the lower part of
+-	 * &pgd_current[smp_processor_id()] stored in CONTEXT.
+-	 */
+-	if (!in_compat_space_p(pgdc))
+-		panic("Invalid page directory address!");
+-
+-	i_dmfc0(p, ptr, C0_CONTEXT);
+-	i_dsra(p, ptr, ptr, 23);
+-	i_ld(p, ptr, 0, ptr);
+-# endif
+ #else
+ 	i_LA_mostly(p, ptr, pgdc);
+ 	i_ld(p, ptr, rel_lo(pgdc), ptr);
+diff -Naur linux-2.6.16.orig/arch/mips/qemu/Makefile linux-2.6.16/arch/mips/qemu/Makefile
+--- linux-2.6.16.orig/arch/mips/qemu/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/qemu/Makefile	2006-03-21 01:05:47.000000000 +0000
+@@ -2,4 +2,7 @@
+ # Makefile for Qemu specific kernel interface routines under Linux.
+ #
+ 
+-obj-y		= q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o
++obj-y = q-firmware.o q-int.o q-irq.o q-mem.o q-setup.o
++
++obj-$(CONFIG_VT) += q-vga.o
++obj-$(CONFIG_SMP) += q-smp.o
+diff -Naur linux-2.6.16.orig/arch/mips/qemu/q-setup.c linux-2.6.16/arch/mips/qemu/q-setup.c
+--- linux-2.6.16.orig/arch/mips/qemu/q-setup.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/arch/mips/qemu/q-setup.c	2006-03-21 01:05:47.000000000 +0000
+@@ -2,6 +2,8 @@
+ #include <asm/io.h>
+ #include <asm/time.h>
+ 
++extern void qvga_init(void);
++
+ #define QEMU_PORT_BASE 0xb4000000
+ 
+ const char *get_system_type(void)
+@@ -21,5 +23,8 @@
+ void __init plat_setup(void)
+ {
+ 	set_io_port_base(QEMU_PORT_BASE);
++#ifdef CONFIG_VT
++	qvga_init();
++#endif
+ 	board_timer_setup = qemu_timer_setup;
+ }
+diff -Naur linux-2.6.16.orig/arch/mips/qemu/q-smp.c linux-2.6.16/arch/mips/qemu/q-smp.c
+--- linux-2.6.16.orig/arch/mips/qemu/q-smp.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/arch/mips/qemu/q-smp.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,48 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2006 by Ralf Baechle (ralf@linux-mips.org)
++ *
++ * Symmetric Uniprocessor (TM) Support
++ */
++#include <linux/kernel.h>
++#include <linux/sched.h>
++
++/*
++ * Send inter-processor interrupt
++ */
++void core_send_ipi(int cpu, unsigned int action)
++{
++	panic(KERN_ERR "%s called", __FUNCTION__);
++}
++
++/*
++ *  After we've done initial boot, this function is called to allow the
++ *  board code to clean up state, if needed
++ */
++void prom_init_secondary(void)
++{
++}
++
++void prom_smp_finish(void)
++{
++}
++
++/* Hook for after all CPUs are online */
++void prom_cpus_done(void)
++{
++}
++
++void __init prom_prepare_cpus(unsigned int max_cpus)
++{
++	cpus_clear(phys_cpu_present_map);
++}
++
++/*
++ * Firmware CPU startup hook
++ */
++void prom_boot_secondary(int cpu, struct task_struct *idle)
++{
++}
+diff -Naur linux-2.6.16.orig/arch/mips/qemu/q-vga.c linux-2.6.16/arch/mips/qemu/q-vga.c
+--- linux-2.6.16.orig/arch/mips/qemu/q-vga.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/arch/mips/qemu/q-vga.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,188 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2005 by Ralf Baechle (ralf@linux-mips.org)
++ *
++ * This will eventually go into the qemu firmware.
++ */
++#include <linux/init.h>
++#include <linux/tty.h>
++#include <asm/io.h>
++#include <video/vga.h>
++
++/*
++ * This will eventually be done by the firmware; right now Linux assumes to
++ * run on the uninitialized hardware.
++ */
++#undef LOAD_VGA_FONT
++
++static unsigned char sr[8] __initdata = {	/* Sequencer */
++	0x03, 0x00, 0x03, 0x04, 0x02, 0x00, 0x00, 0x00
++};
++
++static unsigned char gr[16] __initdata= {	/* Graphics Controller */
++	0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00,
++	0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++
++static unsigned char ar[21] __initdata= {	/* Attribute Controller */
++	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
++	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
++	0x0c, 0x01, 0x07, 0x13, 0x00
++};
++
++static unsigned char cr[32] __initdata= {	/* CRT Controller */
++	0x91, 0x4f, 0x4f, 0x95, 0x57, 0x4f, 0xc0, 0x1f,
++	0x00, 0x4f, 0x0d, 0x0e, 0x02, 0x30, 0x09, 0xb0,
++	0x90, 0x83, 0x8f, 0x28, 0x1f, 0x8f, 0xc1, 0xa3,
++	0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++
++static struct rgb {
++	unsigned char r;
++	unsigned char g;
++	unsigned char b;
++} palette[16] __initdata= {
++	[ 0] = {0x00, 0x00, 0x00},
++	[ 1] = {0x00, 0x00, 0x2a},
++	[ 2] = {0x00, 0x2a, 0x00},
++	[ 3] = {0x00, 0x2a, 0x2a},
++	[ 4] = {0x2a, 0x00, 0x00},
++	[ 5] = {0x2a, 0x00, 0x2a},
++	[ 6] = {0x2a, 0x15, 0x00},
++	[ 7] = {0x2a, 0x2a, 0x2a},
++	[ 8] = {0x15, 0x15, 0x15},
++	[ 9] = {0x15, 0x15, 0x3f},
++	[10] = {0x15, 0x3f, 0x15},
++	[11] = {0x15, 0x3f, 0x3f},
++	[12] = {0x3f, 0x15, 0x15},
++	[13] = {0x3f, 0x15, 0x3f},
++	[14] = {0x3f, 0x3f, 0x15},
++	[15] = {0x3f, 0x3f, 0x3f}
++
++};
++
++void __init qvga_init_ibm(void)
++{
++	int i;
++
++	for (i = 0; i < 8; i++) {	/* Sequencer registers */
++		outb(i, 0x3c4);
++		outb(sr[i], 0x3c5);
++	}
++
++	for (i = 0; i < 16; i++) {	/* Graphics Controller registers */
++		outb(i, 0x3ce);
++		outb(gr[i], 0x3cf);
++	}
++
++	for (i = 0; i < 21; i++) {	/* Attribute Controller registers */
++		outb(i, 0x3c0);
++		outb(ar[i], 0x3c1);
++	}
++	outb(0x20, 0x3c0);		/* enable bit in *index* register */
++
++	for (i = 0; i < 32; i++) {	/* CRT Controller registers */
++		outb(i, 0x3d4);
++		outb(cr[i], 0x3d5);
++	}
++
++	for (i = 0; i < 16; i++) {	/* palette */
++		outb(i, 0x3c8);
++		outb(palette[i].r, 0x3c9);
++		outb(palette[i].g, 0x3c9);
++		outb(palette[i].b, 0x3c9);
++	}
++
++#if 1
++	 for (i = 0; i < 0x20000; i += 2)
++		*(volatile unsigned short *) (0xb00a0000 + i) = 0xaaaa;
++#endif
++}
++
++#ifdef LOAD_VGA_FONT
++#include "/home/ralf/src/qemu/qemu-mips/vgafont.h"
++
++static void __init
++qvga_load_font(unsigned char *def, unsigned int c)
++{
++	volatile void *w = (volatile void *) 0xb00a0000;
++
++	vga_wseq(NULL, 0, 1);
++	vga_wseq(NULL, 2, 4);
++	vga_wseq(NULL, 4, 7);
++	vga_wseq(NULL, 0, 3);
++	vga_wgfx(NULL, 4, 2);
++	vga_wgfx(NULL, 5, 0);
++	vga_wgfx(NULL, 6, 0);
++
++	memcpy(w, def, c);
++
++	vga_wseq(NULL, 0, 1);
++	vga_wseq(NULL, 2, 3);
++	vga_wseq(NULL, 4, 3);
++	vga_wseq(NULL, 0, 3);
++	vga_wgfx(NULL, 4, 0);
++	vga_wgfx(NULL, 5, 0x10);
++	vga_wgfx(NULL, 6, 0xe);
++}
++#endif
++
++void __init qvga_init(void)
++{
++	struct screen_info *si = &screen_info;
++	unsigned int h;
++	int i;
++
++#if LOAD_VGA_FONT
++	qvga_load_font(vgafont16, 4096);
++#endif
++
++	vga_wgfx(NULL, 5, 0x10);	/* Set odd/even mode */
++	vga_wgfx(NULL, 6, 0x0c);	/* map to offset 0xb8000, text mode */
++	vga_wseq(NULL, 2, 3);		/* Planes 0 & 1 */
++	vga_wseq(NULL, 3, 4);		/* Font offset */
++	outb(1, VGA_MIS_W);		/* set msr to MSR_COLOR_EMULATION */
++	vga_wcrt(NULL, 1, 79);		/* 80 columns */
++	vga_wcrt(NULL, 9, 15);		/* 16 pixels per character */
++	vga_wcrt(NULL, 0x0c, 0);	/* start address high 8 bit */
++	vga_wcrt(NULL, 0x0d, 0);	/* start address low 8 bit */
++	vga_wcrt(NULL, 0x13, 0x28);	/* line offset */
++	vga_wcrt(NULL, 0x07, 0x1f);	/* line compare bit 8 */
++	vga_wcrt(NULL, 0x09, 0x4f);	/* line compare bit 9 */
++	vga_wcrt(NULL, 0x18, 0xff);	/* line compare low 8 bit */
++
++	h = (25 * 16);
++	vga_wcrt(NULL, 0x12, h);
++
++	outb(7, 0x3d4);
++	outb((inb(0x3d5) & ~0x42) | ((h >> 7) & 2) | ((h >> 3) & 0x40), 0x3d5);
++
++	for (i = 0; i < 21; i++)	/* Attribute Controller */
++		vga_wattr(NULL, i, ar[i]);
++	outb(0x20, 0x3c0);		/* Set bit 5 in Attribute Controller */
++					/* index ...  VGA is so stupid I want */
++					/* to cry all day ... */
++	outb(0, VGA_PEL_IW);
++	for (i = 0; i < 16; i++) {	/* palette */
++		outb(palette[i].r, VGA_PEL_D);
++		outb(palette[i].g, VGA_PEL_D);
++		outb(palette[i].b, VGA_PEL_D);
++	}
++
++	si->orig_x		= 0; 			/* Cursor x position */
++	si->orig_y		= 0;			/* Cursor y position */
++	si->orig_video_cols	= 80;			/* Columns */
++	si->orig_video_lines	= 25;			/* Lines */
++	si->orig_video_isVGA	= VIDEO_TYPE_VGAC;	/* Card type */
++	si->orig_video_points	= 16;
++
++#if 0
++	for (i = 0; i < 80; i += 2)
++		//*(volatile unsigned short *) (0xb00b8000 + i) = 0x0100 | 'A';
++		scr_writew(0x0100 | 'A', (volatile unsigned short *) (0xb00b8000 + i));
++	while (1);
++#endif
++}
+diff -Naur linux-2.6.16.orig/drivers/char/Kconfig linux-2.6.16/drivers/char/Kconfig
+--- linux-2.6.16.orig/drivers/char/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/char/Kconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -339,23 +339,68 @@
+ 	  To compile this driver as a module, choose M here: the
+ 	  module will be called istallion.
+ 
+-config AU1000_UART
+-	bool "Enable Au1000 UART Support"
+-	depends on SERIAL_NONSTANDARD && MIPS
+-	help
+-	  If you have an Alchemy AU1000 processor (MIPS based) and you want
+-	  to use serial ports, say Y.  Otherwise, say N.
+-
+-config AU1000_SERIAL_CONSOLE
+-	bool "Enable Au1000 serial console"
+-	depends on AU1000_UART
++config AU1X00_GPIO
++	tristate "Alchemy Au1000 GPIO device support"
++	depends on MIPS && SOC_AU1X00
++
++config TS_AU1X00_ADS7846
++	tristate "Au1000/ADS7846 touchscreen support"
++	depends on MIPS && SOC_AU1X00
++
++config AU1X00_USB_TTY
++	tristate "Au1000 USB TTY Device support"
++	depends on MIPS && MIPS_AU1000 && AU1000_USB_DEVICE=y && AU1000_USB_DEVICE
++
++config AU1X00_USB_RAW
++	tristate "Au1000 USB Raw Device support"
++	depends on MIPS && MIPS_AU1000 && AU1000_USB_DEVICE=y && AU1000_USB_TTY!=y && AU1X00_USB_DEVICE
++
++config SIBYTE_SB1250_DUART
++	bool "Support for BCM1xxx onchip DUART"
++	depends on MIPS && SIBYTE_SB1xxx_SOC=y
++
++config SIBYTE_SB1250_DUART_CONSOLE
++	bool "Console on BCM1xxx DUART"
++	depends on SIBYTE_SB1250_DUART
++
++config SERIAL_DEC
++	bool "DECstation serial support"
++	depends on MACH_DECSTATION
++	default y
+ 	help
+-	  If you have an Alchemy AU1000 processor (MIPS based) and you want
+-	  to use a console on a serial port, say Y.  Otherwise, say N.
++	  This selects whether you want to be asked about drivers for
++	  DECstation serial ports.
++
++	  Note that the answer to this question won't directly affect the
++	  kernel: saying N will just cause the configurator to skip all
++	  the questions about DECstation serial ports.
++
++	  If unsure, say Y.
++
++config SERIAL_DEC_CONSOLE
++	bool "Support for console on a DECstation serial port"
++	depends on SERIAL_DEC
++	default y
++	help
++	  If you say Y here, it will be possible to use a serial port as the
++	  system console (the system console is the device which receives all
++	  kernel messages and warnings and which allows logins in single user
++	  mode).  Note that the firmware uses ttyS0 as the serial console on
++	  the Maxine and ttyS2 on the others.
++
++	  If unsure, say Y.
++
++config ZS
++	bool "Z85C30 Serial Support"
++	depends on SERIAL_DEC
++	default y
++	help
++	  Documentation on the Zilog 85C350 serial communications controller
++	  is downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf>.
+ 
+ config QTRONIX_KEYBOARD
+ 	bool "Enable Qtronix 990P Keyboard Support"
+-	depends on IT8712
++	depends on MIPS && (MIPS_ITE8172 || MIPS_IVR)
+ 	help
+ 	  Images of Qtronix keyboards are at
+ 	  <http://www.qtronix.com/keyboard.html>.
+@@ -367,7 +412,7 @@
+ 
+ config IT8172_SCR0
+ 	bool "Enable Smart Card Reader 0 Support "
+-	depends on IT8712
++	depends on MIPS && (MIPS_ITE8172 || MIPS_IVR)
+ 	help
+ 	  Say Y here to support smart-card reader 0 (SCR0) on the Integrated
+ 	  Technology Express, Inc. ITE8172 SBC.  Vendor page at
+@@ -376,13 +421,17 @@
+ 
+ config IT8172_SCR1
+ 	bool "Enable Smart Card Reader 1 Support "
+-	depends on IT8712
++	depends on MIPS && (MIPS_ITE8172 || MIPS_IVR)
+ 	help
+ 	  Say Y here to support smart-card reader 1 (SCR1) on the Integrated
+ 	  Technology Express, Inc. ITE8172 SBC.  Vendor page at
+ 	  <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
+ 	  board at <http://www.mvista.com/partners/semiconductor/ite.html>.
+ 
++config ITE_GPIO
++	tristate "ITE GPIO"
++	depends on MIPS && MIPS_ITE8172
++
+ config A2232
+ 	tristate "Commodore A2232 serial support (EXPERIMENTAL)"
+ 	depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
+diff -Naur linux-2.6.16.orig/drivers/char/Makefile linux-2.6.16/drivers/char/Makefile
+--- linux-2.6.16.orig/drivers/char/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/char/Makefile	2006-03-21 01:05:47.000000000 +0000
+@@ -31,6 +31,7 @@
+ obj-$(CONFIG_A2232)		+= ser_a2232.o generic_serial.o
+ obj-$(CONFIG_ATARI_DSP56K)	+= dsp56k.o
+ obj-$(CONFIG_MOXA_SMARTIO)	+= mxser.o
++obj-$(CONFIG_SIBYTE_SB1250_DUART) += sb1250_duart.o
+ obj-$(CONFIG_COMPUTONE)		+= ip2.o ip2main.o
+ obj-$(CONFIG_RISCOM8)		+= riscom8.o
+ obj-$(CONFIG_ISI)		+= isicom.o
+@@ -49,6 +50,7 @@
+ obj-$(CONFIG_VIOTAPE)		+= viotape.o
+ obj-$(CONFIG_HVCS)		+= hvcs.o
+ obj-$(CONFIG_SGI_MBCS)		+= mbcs.o
++obj-$(CONFIG_SERIAL_DEC)	+= decserial.o
+ 
+ obj-$(CONFIG_PRINTER) += lp.o
+ obj-$(CONFIG_TIPAR) += tipar.o
+@@ -77,6 +79,10 @@
+ obj-$(CONFIG_HW_RANDOM) += hw_random.o
+ obj-$(CONFIG_FTAPE) += ftape/
+ obj-$(CONFIG_COBALT_LCD) += lcd.o
++obj-$(CONFIG_ITE_GPIO) += ite_gpio.o
++obj-$(CONFIG_AU1000_GPIO) += au1000_gpio.o
++obj-$(CONFIG_AU1000_USB_TTY) += au1000_usbtty.o
++obj-$(CONFIG_AU1000_USB_RAW) += au1000_usbraw.o
+ obj-$(CONFIG_PPDEV) += ppdev.o
+ obj-$(CONFIG_NWBUTTON) += nwbutton.o
+ obj-$(CONFIG_NWFLASH) += nwflash.o
+@@ -115,7 +121,8 @@
+ 
+ ifdef GENERATE_KEYMAP
+ 
+-$(obj)/defkeymap.c $(obj)/qtronixmap.c: $(obj)/%.c: $(src)/%.map
++$(obj)/defkeymap.c $(obj)/qtronixmap.c $(obj)/ibm_workpad_keymap.c: \
++		$(obj)/%.c: $(src)/%.map
+ 	loadkeys --mktable $< > $@.tmp
+ 	sed -e 's/^static *//' $@.tmp > $@
+ 	rm $@.tmp
+diff -Naur linux-2.6.16.orig/drivers/char/au1000_gpio.c linux-2.6.16/drivers/char/au1000_gpio.c
+--- linux-2.6.16.orig/drivers/char/au1000_gpio.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/char/au1000_gpio.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,266 @@
++/*
++ * FILE NAME au1000_gpio.c
++ *
++ * BRIEF MODULE DESCRIPTION
++ *  Driver for Alchemy Au1000 GPIO.
++ *
++ *  Author: MontaVista Software, Inc.  <source@mvista.com>
++ *          Steve Longerbeam <stevel@mvista.com>
++ *
++ * Copyright 2001 MontaVista Software Inc.
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the  License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
++ *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO  EVENT  SHALL   THE AUTHOR  BE	LIABLE FOR ANY   DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
++ *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#include <linux/module.h>
++#include <linux/config.h>
++#include <linux/types.h>
++#include <linux/kernel.h>
++#include <linux/miscdevice.h>
++#include <linux/init.h>
++#include <asm/uaccess.h>
++#include <asm/io.h>
++#include <asm/au1000.h>
++#include <asm/au1000_gpio.h>
++
++#define VERSION "0.01"
++
++static const struct {
++	u32 active_hi;
++	u32 avail_mask;
++} pinfunc_to_avail[15] = {
++	{1,  0x7<<16},   // 0  = SSI0     / GPIO[18:16]
++	{-1, 0},         // 1  = AC97     / SSI1
++	{1,  1<<19},     // 2  = IRDA     / GPIO19
++	{1,  1<<20},     // 3  = UART0    / GPIO20
++	{1,  0x1f<<24},  // 4  = NIC2     / GPIO[28:24]
++	{1,  0x7<<29},   // 5  = I2S      / GPIO[31:29]
++	{0,  1<<8},      // 6  = I2SDI    / GPIO8
++	{0,  0x3f<<9},   // 7  = UART3    / GPIO[14:9]
++	{0,  1<<15},     // 8  = IRFIRSEL / GPIO15
++	{0,  1<<2},      // 9  = EXTCLK0 or OSC / GPIO2
++	{0,  1<<3},      // 10 = EXTCLK1  / GPIO3
++	{0,  1<<6},      // 11 = SMROMCKE / GPIO6
++	{1,  1<<21},     // 12 = UART1    / GPIO21
++	{1,  1<<22},     // 13 = UART2    / GPIO22
++	{1,  1<<23}      // 14 = UART3    / GPIO23
++};
++
++	
++u32 get_au1000_avail_gpio_mask(void)
++{
++	int i;
++	u32 pinfunc = inl(SYS_PINFUNC);
++	u32 avail_mask = 0; // start with no gpio available
++
++	// first, check for GPIO's reprogrammed as peripheral pins
++	for (i=0; i<15; i++) {
++		if (pinfunc_to_avail[i].active_hi < 0)
++			continue;
++		if (!(pinfunc_to_avail[i].active_hi ^
++		      ((pinfunc & (1<<i)) ? 1:0)))
++			avail_mask |= pinfunc_to_avail[i].avail_mask;
++	}
++
++	// check for GPIO's used as interrupt sources
++	avail_mask &= ~(inl(IC1_MASKRD) &
++			(inl(IC1_CFG0RD) | inl(IC1_CFG1RD)));
++
++#ifdef CONFIG_USB_OHCI
++	avail_mask &= ~((1<<4) | (1<<11));
++#ifndef CONFIG_AU1X00_USB_DEVICE
++	avail_mask &= ~((1<<5) | (1<<13));
++#endif
++#endif
++	
++	return avail_mask;
++}
++
++
++/*
++ * Tristate the requested GPIO pins specified in data.
++ * Only available GPIOs will be tristated.
++ */
++int au1000gpio_tristate(u32 data)
++{
++	data &= get_au1000_avail_gpio_mask();
++
++	if (data)
++		outl(data, SYS_TRIOUTCLR);
++
++	return 0;
++}
++
++
++/*
++ * Return the pin state. Pins configured as outputs will return
++ * the output state, and pins configured as inputs (tri-stated)
++ * will return input pin state.
++ */
++int au1000gpio_in(u32 *data)
++{
++	*data = inl(SYS_PINSTATERD);
++	return 0;
++}
++
++
++/*
++ * Set/clear GPIO pins. Only available GPIOs will be affected.
++ */
++int au1000gpio_set(u32 data)
++{
++	data &= get_au1000_avail_gpio_mask();
++
++	if (data)
++		outl(data, SYS_OUTPUTSET);
++	return 0;
++}
++
++int au1000gpio_clear(u32 data)
++{
++	data &= get_au1000_avail_gpio_mask();
++
++	if (data)
++		outl(data, SYS_OUTPUTCLR);
++	return 0;
++}
++
++/*
++ * Output data to GPIO pins. Only available GPIOs will be affected.
++ */
++int au1000gpio_out(u32 data)
++{
++	au1000gpio_set(data);
++	au1000gpio_clear(~data);
++	return 0;
++}
++
++
++EXPORT_SYMBOL(get_au1000_avail_gpio_mask);
++EXPORT_SYMBOL(au1000gpio_tristate);
++EXPORT_SYMBOL(au1000gpio_in);
++EXPORT_SYMBOL(au1000gpio_set);
++EXPORT_SYMBOL(au1000gpio_clear);
++EXPORT_SYMBOL(au1000gpio_out);
++
++
++static int au1000gpio_open(struct inode *inode, struct file *file)
++{
++	return 0;
++}
++
++
++static int au1000gpio_release(struct inode *inode, struct file *file)
++{
++	return 0;
++}
++
++
++static int au1000gpio_ioctl(struct inode *inode, struct file *file,
++			    unsigned int cmd, unsigned long arg)
++{
++	int status;
++	u32 val;
++	
++	switch(cmd) {
++	case AU1000GPIO_IN:
++		
++		status = au1000gpio_in(&val);
++		if (status != 0)
++			return status;
++
++		return put_user(val, (u32 *)arg);
++
++	case AU1000GPIO_OUT:
++
++		if (get_user(val, (u32 *)arg)) 
++			return -EFAULT;
++
++		return au1000gpio_out(val);
++
++	case AU1000GPIO_SET:
++
++		if (get_user(val, (u32 *)arg)) 
++			return -EFAULT;
++
++		return au1000gpio_set(val);
++		
++	case AU1000GPIO_CLEAR:
++
++		if (get_user(val, (u32 *)arg)) 
++			return -EFAULT;
++
++		return au1000gpio_clear(val);
++
++	case AU1000GPIO_TRISTATE:
++
++		if (get_user(val, (u32 *)arg)) 
++			return -EFAULT;
++
++		return au1000gpio_tristate(val);
++
++	case AU1000GPIO_AVAIL_MASK:
++		
++		return put_user(get_au1000_avail_gpio_mask(),
++				(u32 *)arg);
++		
++	default:
++		return -ENOIOCTLCMD;
++
++	}
++
++	return 0;
++}
++
++
++static struct file_operations au1000gpio_fops =
++{
++	.owner		= THIS_MODULE,
++	.ioctl		= au1000gpio_ioctl,
++	.open		= au1000gpio_open,
++	.release	= au1000gpio_release,
++};
++
++
++static struct miscdevice au1000gpio_miscdev =
++{
++	MISC_DYNAMIC_MINOR,
++	"au1000_gpio",
++	&au1000gpio_fops
++};
++
++
++int __init au1000gpio_init(void)
++{
++	misc_register(&au1000gpio_miscdev);
++	printk("Au1000 gpio driver, version %s\n", VERSION);
++	return 0;
++}	
++
++
++void __exit au1000gpio_exit(void)
++{
++	misc_deregister(&au1000gpio_miscdev);
++}
++
++
++module_init(au1000gpio_init);
++module_exit(au1000gpio_exit);
+diff -Naur linux-2.6.16.orig/drivers/char/au1000_ts.c linux-2.6.16/drivers/char/au1000_ts.c
+--- linux-2.6.16.orig/drivers/char/au1000_ts.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/char/au1000_ts.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,677 @@
++/*
++ *      au1000_ts.c  --  Touch screen driver for the Alchemy Au1000's
++ *                       SSI Port 0 talking to the ADS7846 touch screen
++ *                       controller.
++ *
++ * Copyright 2001 MontaVista Software Inc.
++ * Author: MontaVista Software, Inc.
++ *         	stevel@mvista.com or source@mvista.com
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the  License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
++ *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
++ *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ * Notes:
++ *
++ *  Revision history
++ *    06.27.2001  Initial version
++ */
++
++#include <linux/module.h>
++#include <linux/version.h>
++
++#include <linux/init.h>
++#include <linux/fs.h>
++#include <linux/delay.h>
++#include <linux/poll.h>
++#include <linux/string.h>
++#include <linux/ioport.h>       /* request_region */
++#include <linux/interrupt.h>    /* mark_bh */
++#include <asm/uaccess.h>        /* get_user,copy_to_user */
++#include <asm/io.h>
++#include <asm/au1000.h>
++
++#define TS_NAME "au1000-ts"
++#define TS_MAJOR 11
++
++#define PFX TS_NAME
++#define AU1000_TS_DEBUG 1
++
++#ifdef AU1000_TS_DEBUG
++#define dbg(format, arg...) printk(KERN_DEBUG PFX ": " format "\n" , ## arg)
++#else
++#define dbg(format, arg...) do {} while (0)
++#endif
++#define err(format, arg...) printk(KERN_ERR PFX ": " format "\n" , ## arg)
++#define info(format, arg...) printk(KERN_INFO PFX ": " format "\n" , ## arg)
++#define warn(format, arg...) printk(KERN_WARNING PFX ": " format "\n" , ## arg)
++
++
++// SSI Status register bit defines
++#define SSISTAT_BF    (1<<4)
++#define SSISTAT_OF    (1<<3)
++#define SSISTAT_UF    (1<<2)
++#define SSISTAT_DONE  (1<<1)
++#define SSISTAT_BUSY  (1<<0)
++
++// SSI Interrupt Pending and Enable register bit defines
++#define SSIINT_OI     (1<<3)
++#define SSIINT_UI     (1<<2)
++#define SSIINT_DI     (1<<1)
++
++// SSI Address/Data register bit defines
++#define SSIADAT_D         (1<<24)
++#define SSIADAT_ADDR_BIT  16
++#define SSIADAT_ADDR_MASK (0xff<<SSIADAT_ADDR_BIT)
++#define SSIADAT_DATA_BIT  0
++#define SSIADAT_DATA_MASK (0xfff<<SSIADAT_DATA_BIT)
++
++// SSI Enable register bit defines
++#define SSIEN_CD (1<<1)
++#define SSIEN_E  (1<<0)
++
++// SSI Config register bit defines
++#define SSICFG_AO (1<<24)
++#define SSICFG_DO (1<<23)
++#define SSICFG_ALEN_BIT 20
++#define SSICFG_ALEN_MASK (0x7<<SSICFG_ALEN_BIT)
++#define SSICFG_DLEN_BIT 16
++#define SSICFG_DLEN_MASK (0xf<<SSICFG_DLEN_BIT)
++#define SSICFG_DD (1<<11)
++#define SSICFG_AD (1<<10)
++#define SSICFG_BM_BIT 8
++#define SSICFG_BM_MASK (0x3<<SSICFG_BM_BIT)
++#define SSICFG_CE (1<<7)
++#define SSICFG_DP (1<<6)
++#define SSICFG_DL (1<<5)
++#define SSICFG_EP (1<<4)
++
++// Bus Turnaround Selection
++#define SCLK_HOLD_HIGH 0
++#define SCLK_HOLD_LOW  1
++#define SCLK_CYCLE     2
++
++/*
++ * Default config for SSI0:
++ *
++ *   - transmit MSBit first
++ *   - expect MSBit first on data receive
++ *   - address length 7 bits
++ *   - expect data length 12 bits
++ *   - do not disable Direction bit
++ *   - do not disable Address bits
++ *   - SCLK held low during bus turnaround
++ *   - Address and Data bits clocked out on falling edge of SCLK
++ *   - Direction bit high is a read, low is a write
++ *   - Direction bit precedes Address bits
++ *   - Active low enable signal
++ */
++
++#define DEFAULT_SSI_CONFIG \
++    (SSICFG_AO | SSICFG_DO | (6<<SSICFG_ALEN_BIT) | (11<<SSICFG_DLEN_BIT) |\
++    (SCLK_HOLD_LOW<<SSICFG_BM_BIT) | SSICFG_DP | SSICFG_EP)
++
++
++// ADS7846 Control Byte bit defines
++#define ADS7846_ADDR_BIT  4
++#define ADS7846_ADDR_MASK (0x7<<ADS7846_ADDR_BIT)
++#define   ADS7846_MEASURE_X  (0x5<<ADS7846_ADDR_BIT)
++#define   ADS7846_MEASURE_Y  (0x1<<ADS7846_ADDR_BIT)
++#define   ADS7846_MEASURE_Z1 (0x3<<ADS7846_ADDR_BIT)
++#define   ADS7846_MEASURE_Z2 (0x4<<ADS7846_ADDR_BIT)
++#define ADS7846_8BITS     (1<<3)
++#define ADS7846_12BITS    0
++#define ADS7846_SER       (1<<2)
++#define ADS7846_DFR       0
++#define ADS7846_PWR_BIT   0
++#define   ADS7846_PD      0
++#define   ADS7846_ADC_ON  (0x1<<ADS7846_PWR_BIT)
++#define   ADS7846_REF_ON  (0x2<<ADS7846_PWR_BIT)
++#define   ADS7846_REF_ADC_ON (0x3<<ADS7846_PWR_BIT)
++
++#define MEASURE_12BIT_X \
++    (ADS7846_MEASURE_X | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
++#define MEASURE_12BIT_Y \
++    (ADS7846_MEASURE_Y | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
++#define MEASURE_12BIT_Z1 \
++    (ADS7846_MEASURE_Z1 | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
++#define MEASURE_12BIT_Z2 \
++    (ADS7846_MEASURE_Z2 | ADS7846_12BITS | ADS7846_DFR | ADS7846_PD)
++
++typedef enum {
++	IDLE = 0,
++	ACQ_X,
++	ACQ_Y,
++	ACQ_Z1,
++	ACQ_Z2
++} acq_state_t;
++
++/* +++++++++++++ Lifted from include/linux/h3600_ts.h ++++++++++++++*/
++typedef struct {
++	unsigned short pressure;  // touch pressure
++	unsigned short x;         // calibrated X
++	unsigned short y;         // calibrated Y
++	unsigned short millisecs; // timestamp of this event
++} TS_EVENT;
++
++typedef struct {
++	int xscale;
++	int xtrans;
++	int yscale;
++	int ytrans;
++	int xyswap;
++} TS_CAL;
++
++/* Use 'f' as magic number */
++#define IOC_MAGIC  'f'
++
++#define TS_GET_RATE             _IO(IOC_MAGIC, 8)
++#define TS_SET_RATE             _IO(IOC_MAGIC, 9)
++#define TS_GET_CAL              _IOR(IOC_MAGIC, 10, TS_CAL)
++#define TS_SET_CAL              _IOW(IOC_MAGIC, 11, TS_CAL)
++
++/* +++++++++++++ Done lifted from include/linux/h3600_ts.h +++++++++*/
++
++
++#define EVENT_BUFSIZE 128
++
++/*
++ * Which pressure equation to use from ADS7846 datasheet.
++ * The first equation requires knowing only the X plate
++ * resistance, but needs 4 measurements (X, Y, Z1, Z2).
++ * The second equation requires knowing both X and Y plate
++ * resistance, but only needs 3 measurements (X, Y, Z1).
++ * The second equation is preferred because of the shorter
++ * acquisition time required.
++ */
++enum {
++	PRESSURE_EQN_1 = 0,
++	PRESSURE_EQN_2
++};
++
++
++/*
++ * The touch screen's X and Y plate resistances, used by
++ * pressure equations.
++ */
++#define DEFAULT_X_PLATE_OHMS 580
++#define DEFAULT_Y_PLATE_OHMS 580
++
++/*
++ * Pen up/down pressure resistance thresholds.
++ *
++ * FIXME: these are bogus and will have to be found empirically.
++ *
++ * These are hysteresis points. If pen state is up and pressure
++ * is greater than pen-down threshold, pen transitions to down.
++ * If pen state is down and pressure is less than pen-up threshold,
++ * pen transitions to up. If pressure is in-between, pen status
++ * doesn't change.
++ *
++ * This wouldn't be needed if PENIRQ* from the ADS7846 were
++ * routed to an interrupt line on the Au1000. This would issue
++ * an interrupt when the panel is touched.
++ */
++#define DEFAULT_PENDOWN_THRESH_OHMS 100
++#define DEFAULT_PENUP_THRESH_OHMS    80
++
++typedef struct {
++	int baudrate;
++	u32 clkdiv;
++	acq_state_t acq_state;            // State of acquisition state machine
++	int x_raw, y_raw, z1_raw, z2_raw; // The current raw acquisition values
++	TS_CAL cal;                       // Calibration values
++	// The X and Y plate resistance, needed to calculate pressure
++	int x_plate_ohms, y_plate_ohms;
++	// pressure resistance at which pen is considered down/up
++	int pendown_thresh_ohms;
++	int penup_thresh_ohms;
++	int pressure_eqn;                 // eqn to use for pressure calc
++	int pendown;                      // 1 = pen is down, 0 = pen is up
++	TS_EVENT event_buf[EVENT_BUFSIZE];// The event queue
++	int nextIn, nextOut;
++	int event_count;
++	struct fasync_struct *fasync;     // asynch notification
++	struct timer_list acq_timer;      // Timer for triggering acquisitions
++	wait_queue_head_t wait;           // read wait queue
++	spinlock_t lock;
++	struct tq_struct chug_tq;
++} au1000_ts_t;
++
++static au1000_ts_t au1000_ts;
++
++
++static inline u32
++calc_clkdiv(int baud)
++{
++	u32 sys_busclk =
++		(get_au1000_speed() / (int)(inl(PM_POWERUP_CONTROL)&0x03) + 2);
++	return (sys_busclk / (2 * baud)) - 1;
++}
++
++static inline int
++calc_baudrate(u32 clkdiv)
++{
++	u32 sys_busclk =
++		(get_au1000_speed() / (int)(inl(PM_POWERUP_CONTROL)&0x03) + 2);
++	return sys_busclk / (2 * (clkdiv + 1));
++}
++
++
++/*
++ * This is a bottom-half handler that is scheduled after
++ * raw X,Y,Z1,Z2 coordinates have been acquired, and does
++ * the following:
++ *
++ *   - computes touch screen pressure resistance
++ *   - if pressure is above a threshold considered to be pen-down:
++ *         - compute calibrated X and Y coordinates
++ *         - queue a new TS_EVENT
++ *         - signal asynchronously and wake up any read
++ */
++static void
++chug_raw_data(void* private)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)private;
++	TS_EVENT event;
++	int Rt, Xcal, Ycal;
++	unsigned long flags;
++
++	// timestamp this new event.
++	event.millisecs = jiffies;
++
++	// Calculate touch pressure resistance
++	if (ts->pressure_eqn == PRESSURE_EQN_2) {
++		Rt = (ts->x_plate_ohms * ts->x_raw *
++		      (4096 - ts->z1_raw)) / ts->z1_raw;
++		Rt -= (ts->y_plate_ohms * ts->y_raw);
++		Rt = (Rt + 2048) >> 12; // round up to nearest ohm
++	} else {
++		Rt = (ts->x_plate_ohms * ts->x_raw *
++		      (ts->z2_raw - ts->z1_raw)) / ts->z1_raw;
++		Rt = (Rt + 2048) >> 12; // round up to nearest ohm
++	}
++
++	// hysteresis
++	if (!ts->pendown && Rt > ts->pendown_thresh_ohms)
++		ts->pendown = 1;
++	else if (ts->pendown && Rt < ts->penup_thresh_ohms)
++		ts->pendown = 0;
++
++	if (ts->pendown) {
++		// Pen is down
++		// Calculate calibrated X,Y
++		Xcal = ((ts->cal.xscale * ts->x_raw) >> 8) + ts->cal.xtrans;
++		Ycal = ((ts->cal.yscale * ts->y_raw) >> 8) + ts->cal.ytrans;
++
++		event.x = (unsigned short)Xcal;
++		event.y = (unsigned short)Ycal;
++		event.pressure = (unsigned short)Rt;
++
++		// add this event to the event queue
++		spin_lock_irqsave(&ts->lock, flags);
++		ts->event_buf[ts->nextIn++] = event;
++		if (ts->nextIn == EVENT_BUFSIZE)
++			ts->nextIn = 0;
++		if (ts->event_count < EVENT_BUFSIZE) {
++			ts->event_count++;
++		} else {
++			// throw out the oldest event
++			if (++ts->nextOut == EVENT_BUFSIZE)
++				ts->nextOut = 0;
++		}
++		spin_unlock_irqrestore(&ts->lock, flags);
++
++		// async notify
++		if (ts->fasync)
++			kill_fasync(&ts->fasync, SIGIO, POLL_IN);
++		// wake up any read call
++		if (waitqueue_active(&ts->wait))
++			wake_up_interruptible(&ts->wait);
++	}
++}
++
++
++/*
++ * Raw X,Y,pressure acquisition timer function. This triggers
++ * the start of a new acquisition. Its duration between calls
++ * is the touch screen polling rate.
++ */
++static void
++au1000_acq_timer(unsigned long data)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)data;
++	unsigned long flags;
++
++	spin_lock_irqsave(&ts->lock, flags);
++
++	// start acquisition with X coordinate
++	ts->acq_state = ACQ_X;
++	// start me up
++	outl(SSIADAT_D | (MEASURE_12BIT_X << SSIADAT_ADDR_BIT), SSI0_ADATA);
++
++	// schedule next acquire
++	ts->acq_timer.expires = jiffies + HZ / 100;
++	add_timer(&ts->acq_timer);
++
++	spin_unlock_irqrestore(&ts->lock, flags);
++}
++
++static void
++ssi0_interrupt(int irq, void *dev_id, struct pt_regs *regs)
++{
++	au1000_ts_t *ts = (au1000_ts_t*)dev_id;
++	u32 stat, int_stat, data;
++
++	spin_lock(&ts->lock);
++
++	stat = inl(SSI0_STATUS);
++	// clear sticky status bits
++	outl(stat & (SSISTAT_OF|SSISTAT_UF|SSISTAT_DONE), SSI0_STATUS);
++
++	int_stat = inl(SSI0_INT);
++	// clear sticky intr status bits
++	outl(int_stat & (SSIINT_OI|SSIINT_UI|SSIINT_DI), SSI0_INT);
++
++	if ((int_stat & (SSIINT_OI|SSIINT_UI|SSIINT_DI)) != SSIINT_DI) {
++		if (int_stat & SSIINT_OI)
++			err("overflow");
++		if (int_stat & SSIINT_UI)
++			err("underflow");
++		spin_unlock(&ts->lock);
++		return;
++	}
++
++	data = inl(SSI0_ADATA) & SSIADAT_DATA_MASK;
++
++	switch (ts->acq_state) {
++	case IDLE:
++		break;
++	case ACQ_X:
++		ts->x_raw = data;
++		ts->acq_state = ACQ_Y;
++		// trigger Y acq
++		outl(SSIADAT_D | (MEASURE_12BIT_Y << SSIADAT_ADDR_BIT),
++		     SSI0_ADATA);
++		break;
++	case ACQ_Y:
++		ts->y_raw = data;
++		ts->acq_state = ACQ_Z1;
++		// trigger Z1 acq
++		outl(SSIADAT_D | (MEASURE_12BIT_Z1 << SSIADAT_ADDR_BIT),
++		     SSI0_ADATA);
++		break;
++	case ACQ_Z1:
++		ts->z1_raw = data;
++		if (ts->pressure_eqn == PRESSURE_EQN_2) {
++			// don't acq Z2, using 2nd eqn for touch pressure
++			ts->acq_state = IDLE;
++			// got the raw stuff, now mark BH
++			queue_task(&ts->chug_tq, &tq_immediate);
++			mark_bh(IMMEDIATE_BH);
++		} else {
++			ts->acq_state = ACQ_Z2;
++			// trigger Z2 acq
++			outl(SSIADAT_D | (MEASURE_12BIT_Z2<<SSIADAT_ADDR_BIT),
++			     SSI0_ADATA);
++		}
++		break;
++	case ACQ_Z2:
++		ts->z2_raw = data;
++		ts->acq_state = IDLE;
++		// got the raw stuff, now mark BH
++		queue_task(&ts->chug_tq, &tq_immediate);
++		mark_bh(IMMEDIATE_BH);
++		break;
++	}
++
++	spin_unlock(&ts->lock);
++}
++
++
++/* +++++++++++++ File operations ++++++++++++++*/
++
++static int
++au1000_fasync(int fd, struct file *filp, int mode)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)filp->private_data;
++	return fasync_helper(fd, filp, mode, &ts->fasync);
++}
++
++static int
++au1000_ioctl(struct inode * inode, struct file *filp,
++	     unsigned int cmd, unsigned long arg)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)filp->private_data;
++
++	switch(cmd) {
++	case TS_GET_RATE:       /* TODO: what is this? */
++		break;
++	case TS_SET_RATE:       /* TODO: what is this? */
++		break;
++	case TS_GET_CAL:
++		copy_to_user((char *)arg, (char *)&ts->cal, sizeof(TS_CAL));
++		break;
++	case TS_SET_CAL:
++		copy_from_user((char *)&ts->cal, (char *)arg, sizeof(TS_CAL));
++		break;
++	default:
++		err("unknown cmd %04x", cmd);
++		return -EINVAL;
++	}
++
++	return 0;
++}
++
++static unsigned int
++au1000_poll(struct file * filp, poll_table * wait)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)filp->private_data;
++	poll_wait(filp, &ts->wait, wait);
++	if (ts->event_count)
++		return POLLIN | POLLRDNORM;
++	return 0;
++}
++
++static ssize_t
++au1000_read(struct file * filp, char * buf, size_t count, loff_t * l)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)filp->private_data;
++	unsigned long flags;
++	TS_EVENT event;
++	int i;
++
++	if (ts->event_count == 0) {
++		if (filp->f_flags & O_NONBLOCK)
++			return -EAGAIN;
++		interruptible_sleep_on(&ts->wait);
++		if (signal_pending(current))
++			return -ERESTARTSYS;
++	}
++
++	for (i = count;
++	     i >= sizeof(TS_EVENT);
++	     i -= sizeof(TS_EVENT), buf += sizeof(TS_EVENT)) {
++		if (ts->event_count == 0)
++			break;
++		spin_lock_irqsave(&ts->lock, flags);
++		event = ts->event_buf[ts->nextOut++];
++		if (ts->nextOut == EVENT_BUFSIZE)
++			ts->nextOut = 0;
++		if (ts->event_count)
++			ts->event_count--;
++		spin_unlock_irqrestore(&ts->lock, flags);
++		copy_to_user(buf, &event, sizeof(TS_EVENT));
++	}
++
++	return count - i;
++}
++
++
++static int
++au1000_open(struct inode * inode, struct file * filp)
++{
++	au1000_ts_t* ts;
++	unsigned long flags;
++
++	filp->private_data = ts = &au1000_ts;
++
++	spin_lock_irqsave(&ts->lock, flags);
++
++	// setup SSI0 config
++	outl(DEFAULT_SSI_CONFIG, SSI0_CONFIG);
++
++	// clear out SSI0 status bits
++	outl(SSISTAT_OF|SSISTAT_UF|SSISTAT_DONE, SSI0_STATUS);
++	// clear out SSI0 interrupt pending bits
++	outl(SSIINT_OI|SSIINT_UI|SSIINT_DI, SSI0_INT);
++
++	// enable SSI0 interrupts
++	outl(SSIINT_OI|SSIINT_UI|SSIINT_DI, SSI0_INT_ENABLE);
++
++	/*
++	 * init bh handler that chugs the raw data (calibrates and
++	 * calculates touch pressure).
++	 */
++	ts->chug_tq.routine = chug_raw_data;
++	ts->chug_tq.data = ts;
++	ts->pendown = 0; // pen up
++	
++	// flush event queue
++	ts->nextIn = ts->nextOut = ts->event_count = 0;
++	
++	// Start acquisition timer function
++	init_timer(&ts->acq_timer);
++	ts->acq_timer.function = au1000_acq_timer;
++	ts->acq_timer.data = (unsigned long)ts;
++	ts->acq_timer.expires = jiffies + HZ / 100;
++	add_timer(&ts->acq_timer);
++
++	spin_unlock_irqrestore(&ts->lock, flags);
++
++	return 0;
++}
++
++static int
++au1000_release(struct inode * inode, struct file * filp)
++{
++	au1000_ts_t* ts = (au1000_ts_t*)filp->private_data;
++	unsigned long flags;
++	
++	au1000_fasync(-1, filp, 0);
++	del_timer_sync(&ts->acq_timer);
++
++	spin_lock_irqsave(&ts->lock, flags);
++	// disable SSI0 interrupts
++	outl(0, SSI0_INT_ENABLE);
++	spin_unlock_irqrestore(&ts->lock, flags);
++
++	return 0;
++}
++
++
++static struct file_operations ts_fops = {
++	.read           = au1000_read,
++	.poll           = au1000_poll,
++	.ioctl		= au1000_ioctl,
++	.fasync         = au1000_fasync,
++	.open		= au1000_open,
++	.release	= au1000_release,
++};
++
++/* +++++++++++++ End File operations ++++++++++++++*/
++
++
++int __init
++au1000ts_init_module(void)
++{
++	au1000_ts_t* ts = &au1000_ts;
++	int ret;
++
++	/* register our character device */
++	if ((ret = register_chrdev(TS_MAJOR, TS_NAME, &ts_fops)) < 0) {
++		err("can't get major number");
++		return ret;
++	}
++	info("registered");
++
++	memset(ts, 0, sizeof(au1000_ts_t));
++	init_waitqueue_head(&ts->wait);
++	spin_lock_init(&ts->lock);
++
++	if (!request_region(virt_to_phys((void*)SSI0_STATUS), 0x100, TS_NAME)) {
++		err("SSI0 ports in use");
++		return -ENXIO;
++	}
++
++	if ((ret = request_irq(AU1000_SSI0_INT, ssi0_interrupt,
++			       SA_SHIRQ | SA_INTERRUPT, TS_NAME, ts))) {
++		err("could not get IRQ");
++		return ret;
++	}
++
++	// initial calibration values
++	ts->cal.xscale = -93;
++	ts->cal.xtrans = 346;
++	ts->cal.yscale = -64;
++	ts->cal.ytrans = 251;
++
++	// init pen up/down hysteresis points
++	ts->pendown_thresh_ohms = DEFAULT_PENDOWN_THRESH_OHMS;
++	ts->penup_thresh_ohms = DEFAULT_PENUP_THRESH_OHMS;
++	ts->pressure_eqn = PRESSURE_EQN_2;
++	// init X and Y plate resistances
++	ts->x_plate_ohms = DEFAULT_X_PLATE_OHMS;
++	ts->y_plate_ohms = DEFAULT_Y_PLATE_OHMS;
++
++	// set GPIO to SSI0 function
++	outl(inl(PIN_FUNCTION) & ~1, PIN_FUNCTION);
++	
++	// enable SSI0 clock and bring SSI0 out of reset
++	outl(0, SSI0_CONTROL);
++	udelay(1000);
++	outl(SSIEN_E, SSI0_CONTROL);
++	udelay(100);
++	
++	// FIXME: is this a working baudrate?
++	ts->clkdiv = 0;
++	ts->baudrate = calc_baudrate(ts->clkdiv);
++	outl(ts->clkdiv, SSI0_CLKDIV);
++
++	info("baudrate = %d Hz", ts->baudrate);
++	
++	return 0;
++}
++
++void
++au1000ts_cleanup_module(void)
++{
++	// disable clocks and hold in reset
++	outl(SSIEN_CD, SSI0_CONTROL);
++	free_irq(AU1000_SSI0_INT, &au1000_ts);
++	release_region(virt_to_phys((void*)SSI0_STATUS), 0x100);
++	unregister_chrdev(TS_MAJOR, TS_NAME);
++}
++
++/* Module information */
++MODULE_AUTHOR("Steve Longerbeam, stevel@mvista.com, www.mvista.com");
++MODULE_DESCRIPTION("Au1000/ADS7846 Touch Screen Driver");
++
++module_init(au1000ts_init_module);
++module_exit(au1000ts_cleanup_module);
+diff -Naur linux-2.6.16.orig/drivers/char/au1000_usbraw.c linux-2.6.16/drivers/char/au1000_usbraw.c
+--- linux-2.6.16.orig/drivers/char/au1000_usbraw.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/char/au1000_usbraw.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,573 @@
++/*
++ * BRIEF MODULE DESCRIPTION
++ *	Au1x00 USB Device-Side Raw Block Driver (function layer)
++ *
++ * Copyright 2001-2002 MontaVista Software Inc.
++ * Author: MontaVista Software, Inc.
++ *		stevel@mvista.com or source@mvista.com
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the	License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED	  ``AS	IS'' AND   ANY	EXPRESS OR IMPLIED
++ *  WARRANTIES,	  INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO	EVENT  SHALL   THE AUTHOR  BE	 LIABLE FOR ANY	  DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED	  TO, PROCUREMENT OF  SUBSTITUTE GOODS	OR SERVICES; LOSS OF
++ *  USE, DATA,	OR PROFITS; OR	BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN	 CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#include <linux/config.h>
++#include <linux/kernel.h>
++#include <linux/ioport.h>
++#include <linux/sched.h>
++#include <linux/signal.h>
++#include <linux/errno.h>
++#include <linux/poll.h>
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/fcntl.h>
++#include <linux/module.h>
++#include <linux/spinlock.h>
++#include <linux/list.h>
++#include <linux/smp_lock.h>
++#undef DEBUG
++#include <linux/usb.h>
++
++#include <asm/io.h>
++#include <asm/uaccess.h>
++#include <asm/irq.h>
++#include <asm/au1000.h>
++#include <asm/au1000_usbdev.h>
++
++#define USBRAW_MAJOR 190 // FIXME: need a legal major
++#define USBRAW_NAME "usbraw"
++
++#define MAX_NUM_PORTS 2
++
++#define IN_MAX_PACKET_SIZE  64
++#define OUT_MAX_PACKET_SIZE 64
++
++// FIXME: when Au1x00 endpoints 3 and 5 are fixed, make NUM_PORTS=2
++#define NUM_PORTS 1
++#define NUM_EP 2*NUM_PORTS
++
++#define CONFIG_DESC_LEN \
++ USB_DT_CONFIG_SIZE + USB_DT_INTERFACE_SIZE + NUM_EP*USB_DT_ENDPOINT_SIZE
++
++/* must be power of two */
++#define READ_BUF_SIZE (1<<12)
++
++struct usb_raw_port {
++	unsigned char number;
++	spinlock_t port_lock;
++
++	struct usb_endpoint_descriptor* out_desc;
++	struct usb_endpoint_descriptor* in_desc;
++
++	int out_ep_addr; /* endpoint address of OUT endpoint */
++	int in_ep_addr;  /* endpoint address of IN endpoint */
++	
++	__u8 read_buf[READ_BUF_SIZE]; // FIXME: allocate with get_free_pages
++	int read_nextin, read_nextout;
++	int read_count;
++
++	wait_queue_head_t wait;
++	struct fasync_struct *fasync;     // asynch notification
++
++	int active;	/* someone has this device open */
++	int open_count;	/* number of times this port has been opened */
++};
++
++static struct usb_serial {
++	struct usb_device_descriptor* dev_desc;
++	struct usb_config_descriptor* config_desc;
++	struct usb_interface_descriptor* if_desc;
++	struct usb_string_descriptor * str_desc[6];
++	void* str_desc_buf;
++
++	usbdev_state_t dev_state;
++
++	struct usb_raw_port port[NUM_PORTS];
++} usbraw;
++
++static struct usb_device_descriptor dev_desc = {
++	bLength:USB_DT_DEVICE_SIZE,
++	bDescriptorType:USB_DT_DEVICE,
++	bcdUSB:USBDEV_REV,		//usb rev
++	bDeviceClass:USB_CLASS_PER_INTERFACE,	//class    (none)
++	bDeviceSubClass:0x00,	//subclass (none)
++	bDeviceProtocol:0x00,	//protocol (none)
++	bMaxPacketSize0:USBDEV_EP0_MAX_PACKET_SIZE, //max packet size for ep0
++	idVendor:0x6d04,	//vendor  id
++	idProduct:0x0bc0,	//product id
++	bcdDevice:0x0001,	//BCD rev 0.1
++	iManufacturer:0x01,	//manufactuer string index
++	iProduct:0x02,		//product string index
++	iSerialNumber:0x03,	//serial# string index
++	bNumConfigurations:0x01	//num configurations
++};
++
++static struct usb_endpoint_descriptor ep_desc[] = {
++	{
++		// Bulk IN for Port 0
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_IN,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:IN_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	},
++	{
++		// Bulk OUT for Port 0
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_OUT,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:OUT_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	},
++	{
++		// Bulk IN for Port 1
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_IN,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:IN_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	},
++	{
++		// Bulk OUT for Port 1
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_OUT,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:OUT_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	}
++};
++
++static struct usb_interface_descriptor if_desc = {
++	bLength:USB_DT_INTERFACE_SIZE,
++	bDescriptorType:USB_DT_INTERFACE,
++	bInterfaceNumber:0x00,
++	bAlternateSetting:0x00,
++	bNumEndpoints:NUM_EP,
++	bInterfaceClass:0xff,
++	bInterfaceSubClass:0xab,
++	bInterfaceProtocol:0x00,
++	iInterface:0x05
++};
++
++static struct usb_config_descriptor config_desc = {
++	bLength:USB_DT_CONFIG_SIZE,
++	bDescriptorType:USB_DT_CONFIG,
++	wTotalLength:CONFIG_DESC_LEN,
++	bNumInterfaces:0x01,
++	bConfigurationValue:0x01,
++	iConfiguration:0x04,	// configuration string
++	bmAttributes:0xc0,	// self-powered
++	MaxPower:20		// 40 mA
++};
++
++// String[0] is a list of Language IDs supported by this device
++static struct usb_string_descriptor string_desc0 = {
++	bLength:4,
++	bDescriptorType:USB_DT_STRING,
++	wData:{0x0409} // English, US
++};
++
++// These strings will be converted to Unicode in string_desc[]
++static char *strings[5] = {
++	"Alchemy Semiconductor",  // iManufacturer
++	"USB Raw Block Device",   // iProduct
++	"0.1",                    // iSerialNumber
++	"USB Raw Config",         // iConfiguration
++	"USB Raw Interface"       // iInterface
++};
++
++
++static void
++receive_callback(struct usb_raw_port *port)
++{
++	int i, pkt_size;
++	usbdev_pkt_t* pkt;
++	
++	if ((pkt_size = usbdev_receive_packet(port->out_ep_addr,
++					      &pkt)) <= 0) {
++		dbg(__FUNCTION__ ": usbdev_receive_packet returns %d",
++		    pkt_size);
++		return;
++	}
++
++	dbg(__FUNCTION__ ": ep%d, size=%d", port->out_ep_addr, pkt_size);
++
++	spin_lock(&port->port_lock);
++	for (i=0; i < pkt_size; i++) {
++		port->read_buf[port->read_nextin++] = pkt->payload[i];
++		port->read_nextin &= (READ_BUF_SIZE - 1);
++		if (++port->read_count == READ_BUF_SIZE)
++			break;
++	}
++	spin_unlock(&port->port_lock);
++
++	/* free the packet */
++	kfree(pkt);
++	
++	// async notify
++	if (port->fasync)
++		kill_fasync(&port->fasync, SIGIO, POLL_IN);
++	// wake up any read call
++	if (waitqueue_active(&port->wait))
++		wake_up_interruptible(&port->wait);
++}
++
++static void
++transmit_callback(struct usb_raw_port *port, usbdev_pkt_t* pkt)
++{
++	dbg(__FUNCTION__ ": ep%d", port->in_ep_addr);
++	/* just free the returned packet */
++	kfree(pkt);
++}
++
++
++static void
++usbraw_callback(usbdev_cb_type_t cb_type, unsigned long arg, void* data)
++{
++	usbdev_pkt_t* pkt;
++	int i;
++	
++	switch (cb_type) {
++	case CB_NEW_STATE:
++		usbraw.dev_state = (usbdev_state_t)arg;
++		break;
++	case CB_PKT_COMPLETE:
++		pkt = (usbdev_pkt_t*)arg;
++		for (i=0; i<NUM_PORTS; i++) {
++			struct usb_raw_port *port = &usbraw.port[i];
++			if (pkt->ep_addr == port->in_ep_addr) {
++				transmit_callback(port, pkt);
++				break;
++			} else if (pkt->ep_addr == port->out_ep_addr) {
++				receive_callback(port);
++				break;
++			}
++		}
++		break;
++	}
++}
++
++/*****************************************************************************
++ * Here begins the driver interface functions
++ *****************************************************************************/
++
++static unsigned int usbraw_poll(struct file * filp, poll_table * wait)
++{
++	struct usb_raw_port *port = (struct usb_raw_port *)filp->private_data;
++	unsigned long flags;
++	int count;
++	
++	poll_wait(filp, &port->wait, wait);
++
++	spin_lock_irqsave(&port->port_lock, flags);
++	count = port->read_count;
++	spin_unlock_irqrestore(&port->port_lock, flags);
++
++	if (count > 0) {
++		dbg(__FUNCTION__ ": count=%d", count);
++		return POLLIN | POLLRDNORM;
++	}
++	
++	return 0;
++}
++
++static int usbraw_fasync(int fd, struct file *filp, int mode)
++{
++	struct usb_raw_port *port = (struct usb_raw_port *)filp->private_data;
++	return fasync_helper(fd, filp, mode, &port->fasync);
++}
++
++static int usbraw_open(struct inode * inode, struct file *filp)
++{
++	int portNumber;
++	struct usb_raw_port *port;
++	unsigned long flags;
++
++	/*
++	 * the device-layer must be in the configured state before the
++	 * function layer can operate.
++	 */
++	if (usbraw.dev_state != CONFIGURED)
++		return -ENODEV;
++	
++	/* set up our port structure making the tty driver remember
++	   our port object, and us it */
++	portNumber = MINOR(inode->i_rdev);
++	port = &usbraw.port[portNumber];
++	filp->private_data = port;
++
++	dbg(__FUNCTION__ ": port %d", port->number);
++
++	spin_lock_irqsave(&port->port_lock, flags);
++
++	++port->open_count;
++
++	if (!port->active) {
++		port->active = 1;
++	}
++
++	/* flush read buffer */
++	port->read_nextin = port->read_nextout = port->read_count = 0;
++
++	spin_unlock_irqrestore(&port->port_lock, flags);
++
++	return 0;
++}
++
++static int usbraw_release(struct inode * inode, struct file * filp)
++{
++	struct usb_raw_port *port = (struct usb_raw_port *)filp->private_data;
++	unsigned long flags;
++
++	dbg(__FUNCTION__ ": port %d", port->number);
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not opened");
++		return -ENODEV;
++	}
++
++	usbraw_fasync(-1, filp, 0);
++
++	spin_lock_irqsave(&port->port_lock, flags);
++
++	--port->open_count;
++
++	if (port->open_count <= 0) {
++		port->active = 0;
++		port->open_count = 0;
++	}
++
++	spin_unlock_irqrestore(&port->port_lock, flags);
++
++	return 0;
++}
++
++
++static ssize_t usbraw_read(struct file * filp, char * buf,
++			   size_t count, loff_t * l)
++{
++	struct usb_raw_port *port = (struct usb_raw_port *)filp->private_data;
++	unsigned long flags;
++	int i, cnt;
++
++	/*
++	 * the device-layer must be in the configured state before the
++	 * function layer can operate.
++	 */
++	if (usbraw.dev_state != CONFIGURED)
++		return -ENODEV;
++
++	do { 
++		spin_lock_irqsave(&port->port_lock, flags);
++		cnt = port->read_count;
++		spin_unlock_irqrestore(&port->port_lock, flags);
++		if (cnt == 0) {
++			if (filp->f_flags & O_NONBLOCK)
++				return -EAGAIN;
++			interruptible_sleep_on(&port->wait);
++			if (signal_pending(current))
++				return -ERESTARTSYS;
++		}
++	} while (cnt == 0);
++
++	count = (count > cnt) ? cnt : count;
++
++	for (i=0; i<count; i++) {
++		put_user(port->read_buf[port->read_nextout++], &buf[i]);
++		port->read_nextout &= (READ_BUF_SIZE - 1);
++		spin_lock_irqsave(&port->port_lock, flags);
++		port->read_count--;
++		spin_unlock_irqrestore(&port->port_lock, flags);
++		if (port->read_count == 0)
++			break;
++	}
++
++	return i+1;
++}
++
++static ssize_t usbraw_write(struct file * filp, const char * buf,
++			    size_t count, loff_t *ppos)
++{
++	struct usb_raw_port *port = (struct usb_raw_port *)filp->private_data;
++	usbdev_pkt_t* pkt;
++	int ret, max_pkt_sz;
++	
++	/*
++	 * the device-layer must be in the configured state before the
++	 * function layer can operate.
++	 */
++	if (usbraw.dev_state != CONFIGURED)
++		return -ENODEV;
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not opened");
++		return -EINVAL;
++	}
++
++	if (count == 0) {
++		dbg(__FUNCTION__ ": write request of 0 bytes");
++		return (0);
++	}
++
++	max_pkt_sz = port->in_desc->wMaxPacketSize;
++	count = (count > max_pkt_sz) ? max_pkt_sz : count;
++
++	if ((ret = usbdev_alloc_packet(port->in_ep_addr, count, &pkt)) < 0)
++		return ret;
++
++	copy_from_user(pkt->payload, buf, count);
++	
++	return usbdev_send_packet(port->in_ep_addr, pkt);
++}
++
++static int usbraw_ioctl(struct inode *inode, struct file *filp,
++			unsigned int cmd, unsigned long arg)
++{
++	struct usb_raw_port *port = (struct usb_raw_port *)filp->private_data;
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not open");
++		return -ENODEV;
++	}
++	// FIXME: need any IOCTLs?
++
++	return -ENOIOCTLCMD;
++}
++
++
++static struct file_operations usbraw_fops = {
++        .owner          = THIS_MODULE,
++        .write          = usbraw_write,
++	.read           = usbraw_read,
++	.poll           = usbraw_poll,
++	.ioctl		= usbraw_ioctl,
++	.fasync         = usbraw_fasync,
++	.open		= usbraw_open,
++	.release	= usbraw_release,
++};
++
++void usbfn_raw_exit(void)
++{
++	/* kill the device layer */
++	usbdev_exit();
++
++	unregister_chrdev(USBRAW_MAJOR, USBRAW_NAME);
++
++	if (usbraw.str_desc_buf)
++		kfree(usbraw.str_desc_buf);
++}
++
++
++int usbfn_raw_init(void)
++{
++	int ret = 0, i, str_desc_len;
++
++	/* register our character device */
++	if ((ret = register_chrdev(USBRAW_MAJOR, USBRAW_NAME,
++				   &usbraw_fops)) < 0) {
++		err("can't get major number");
++		return ret;
++	}
++	info("registered");
++
++	/*
++	 * initialize pointers to descriptors
++	 */
++	usbraw.dev_desc = &dev_desc;
++	usbraw.config_desc = &config_desc;
++	usbraw.if_desc = &if_desc;
++
++	/*
++	 * initialize the string descriptors
++	 */
++
++	/* alloc buffer big enough for all string descriptors */
++	str_desc_len = string_desc0.bLength;
++	for (i = 0; i < 5; i++)
++		str_desc_len += 2 + 2 * strlen(strings[i]);
++	usbraw.str_desc_buf = (void *) kmalloc(str_desc_len, GFP_KERNEL);
++	if (!usbraw.str_desc_buf) {
++		err(__FUNCTION__ ": failed to alloc string descriptors");
++		ret = -ENOMEM;
++		goto out;
++	}
++
++	usbraw.str_desc[0] =
++		(struct usb_string_descriptor *)usbraw.str_desc_buf;
++	memcpy(usbraw.str_desc[0], &string_desc0, string_desc0.bLength);
++	usbraw.str_desc[1] = (struct usb_string_descriptor *)
++		(usbraw.str_desc_buf + string_desc0.bLength);
++	for (i = 1; i < 6; i++) {
++		struct usb_string_descriptor *desc = usbraw.str_desc[i];
++		char *str = strings[i - 1];
++		int j, str_len = strlen(str);
++
++		desc->bLength = 2 + 2 * str_len;
++		desc->bDescriptorType = USB_DT_STRING;
++		for (j = 0; j < str_len; j++) {
++			desc->wData[j] = (u16) str[j];
++		}
++		if (i < 5)
++			usbraw.str_desc[i + 1] =
++				(struct usb_string_descriptor *)
++				((u8 *) desc + desc->bLength);
++	}
++
++	/*
++	 * start the device layer. The device layer assigns us
++	 * our endpoint addresses
++	 */
++	if ((ret = usbdev_init(&dev_desc, &config_desc, &if_desc, ep_desc,
++			       usbraw.str_desc, usbraw_callback, NULL))) {
++		err(__FUNCTION__ ": device-layer init failed");
++		goto out;
++	}
++	
++	/* initialize the devfs nodes for this device and let the user
++	   know what ports we are bound to */
++	for (i = 0; i < NUM_PORTS; ++i) {
++		struct usb_raw_port *port = &usbraw.port[i];
++
++		port->number = i;
++		port->in_desc = &ep_desc[NUM_PORTS*i];
++		port->out_desc = &ep_desc[NUM_PORTS*i + 1];
++		port->in_ep_addr = port->in_desc->bEndpointAddress & 0x0f;
++		port->out_ep_addr = port->out_desc->bEndpointAddress & 0x0f;
++		init_waitqueue_head(&port->wait);
++		spin_lock_init(&port->port_lock);
++	}
++
++ out:
++	if (ret)
++		usbfn_raw_exit();
++	return ret;
++}
++
++
++/* Module information */
++MODULE_AUTHOR("Steve Longerbeam, stevel@mvista.com, www.mvista.com");
++MODULE_DESCRIPTION("Au1x00 USB Device-Side Raw Block Driver");
++MODULE_LICENSE("GPL");
++
++module_init(usbfn_raw_init);
++module_exit(usbfn_raw_exit);
+diff -Naur linux-2.6.16.orig/drivers/char/au1000_usbtty.c linux-2.6.16/drivers/char/au1000_usbtty.c
+--- linux-2.6.16.orig/drivers/char/au1000_usbtty.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/char/au1000_usbtty.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,761 @@
++/*
++ * BRIEF MODULE DESCRIPTION
++ *	Au1x00 USB Device-Side Serial TTY Driver (function layer)
++ *
++ * Copyright 2001-2002 MontaVista Software Inc.
++ * Author: MontaVista Software, Inc.
++ *		stevel@mvista.com or source@mvista.com
++ *
++ *  Derived from drivers/usb/serial/usbserial.c:
++ *
++ *  Copyright (C) 1999 - 2001 Greg Kroah-Hartman (greg@kroah.com)
++ *  Copyright (c) 2000 Peter Berger (pberger@brimson.com)
++ *  Copyright (c) 2000 Al Borchers (borchers@steinerpoint.com)
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the	License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED	  ``AS	IS'' AND   ANY	EXPRESS OR IMPLIED
++ *  WARRANTIES,	  INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO	EVENT  SHALL   THE AUTHOR  BE	 LIABLE FOR ANY	  DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED	  TO, PROCUREMENT OF  SUBSTITUTE GOODS	OR SERVICES; LOSS OF
++ *  USE, DATA,	OR PROFITS; OR	BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN	 CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#include <linux/config.h>
++#include <linux/kernel.h>
++#include <linux/ioport.h>
++#include <linux/sched.h>
++#include <linux/signal.h>
++#include <linux/errno.h>
++#include <linux/poll.h>
++#include <linux/init.h>
++#include <linux/slab.h>
++#include <linux/fcntl.h>
++#include <linux/tty.h>
++#include <linux/tty_driver.h>
++#include <linux/tty_flip.h>
++#include <linux/module.h>
++#include <linux/spinlock.h>
++#include <linux/list.h>
++#include <linux/smp_lock.h>
++#undef DEBUG
++#include <linux/usb.h>
++
++#include <asm/io.h>
++#include <asm/uaccess.h>
++#include <asm/irq.h>
++#include <asm/au1000.h>
++#include <asm/au1000_usbdev.h>
++
++
++/* local function prototypes */
++static int serial_open(struct tty_struct *tty, struct file *filp);
++static void serial_close(struct tty_struct *tty, struct file *filp);
++static int serial_write(struct tty_struct *tty, int from_user,
++			const unsigned char *buf, int count);
++static int serial_write_room(struct tty_struct *tty);
++static int serial_chars_in_buffer(struct tty_struct *tty);
++static void serial_throttle(struct tty_struct *tty);
++static void serial_unthrottle(struct tty_struct *tty);
++static int serial_ioctl(struct tty_struct *tty, struct file *file,
++			unsigned int cmd, unsigned long arg);
++static void serial_set_termios (struct tty_struct *tty, struct termios * old);
++
++#define SERIAL_TTY_MAJOR 189 // FIXME: need a legal major
++
++#define MAX_NUM_PORTS 2
++
++#define IN_MAX_PACKET_SIZE  32
++#define OUT_MAX_PACKET_SIZE 32
++
++// FIXME: when Au1x00 endpoints 3 and 5 are fixed, make NUM_PORTS=2
++#define NUM_PORTS 2
++#define NUM_EP 2*NUM_PORTS
++
++#define CONFIG_DESC_LEN \
++ USB_DT_CONFIG_SIZE + USB_DT_INTERFACE_SIZE + NUM_EP*USB_DT_ENDPOINT_SIZE
++
++struct usb_serial_port {
++	struct tty_struct *tty;	   /* the coresponding tty for this port */
++	unsigned char number;
++	spinlock_t port_lock;
++
++	struct usb_endpoint_descriptor* out_desc;
++	struct usb_endpoint_descriptor* in_desc;
++
++	int out_ep_addr; /* endpoint address of OUT endpoint */
++	int in_ep_addr;  /* endpoint address of IN endpoint */
++	
++	/* task queue for line discipline waking up on send packet complete */
++	struct tq_struct send_complete_tq;
++	/* task queue for line discipline wakeup on receive packet complete */
++	struct tq_struct receive_complete_tq;
++
++	int active;	/* someone has this device open */
++	int writing;    /* a packet write is in progress */
++	int open_count;	/* number of times this port has been opened */
++
++};
++
++static struct usb_serial {
++	usbdev_state_t dev_state; // current state of device layer
++	struct usb_device_descriptor* dev_desc;
++	struct usb_config_descriptor* config_desc;
++	struct usb_interface_descriptor* if_desc;
++	struct usb_string_descriptor * str_desc[6];
++	void* str_desc_buf;
++
++	struct usb_serial_port port[NUM_PORTS];
++} usbtty;
++
++static int                 serial_refcount;
++static struct tty_driver   serial_tty_driver;
++static struct tty_struct * serial_tty[NUM_PORTS];
++static struct termios *    serial_termios[NUM_PORTS];
++static struct termios *    serial_termios_locked[NUM_PORTS];
++
++static struct usb_device_descriptor dev_desc = {
++	bLength:USB_DT_DEVICE_SIZE,
++	bDescriptorType:USB_DT_DEVICE,
++	bcdUSB:USBDEV_REV,		//usb rev
++	bDeviceClass:USB_CLASS_PER_INTERFACE,	//class    (none)
++	bDeviceSubClass:0x00,	//subclass (none)
++	bDeviceProtocol:0x00,	//protocol (none)
++	bMaxPacketSize0:USBDEV_EP0_MAX_PACKET_SIZE, //max packet size for ep0
++	idVendor:0x6d04,	//vendor  id
++	idProduct:0x0bc0,	//product id
++	bcdDevice:0x0001,	//BCD rev 0.1
++	iManufacturer:0x01,	//manufactuer string index
++	iProduct:0x02,		//product string index
++	iSerialNumber:0x03,	//serial# string index
++	bNumConfigurations:0x01	//num configurations
++};
++
++static struct usb_endpoint_descriptor ep_desc[] = {
++	{
++		// Bulk IN for Port 0
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_IN,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:IN_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	},
++	{
++		// Bulk OUT for Port 0
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_OUT,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:OUT_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	},
++	{
++		// Bulk IN for Port 1
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_IN,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:IN_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	},
++	{
++		// Bulk OUT for Port 1
++		bLength:USB_DT_ENDPOINT_SIZE,
++		bDescriptorType:USB_DT_ENDPOINT,
++		bEndpointAddress:USB_DIR_OUT,
++		bmAttributes:USB_ENDPOINT_XFER_BULK,
++		wMaxPacketSize:OUT_MAX_PACKET_SIZE,
++		bInterval:0x00	// ignored for bulk
++	}
++};
++
++static struct usb_interface_descriptor if_desc = {
++	bLength:USB_DT_INTERFACE_SIZE,
++	bDescriptorType:USB_DT_INTERFACE,
++	bInterfaceNumber:0x00,
++	bAlternateSetting:0x00,
++	bNumEndpoints:NUM_EP,
++	bInterfaceClass:0xff,
++	bInterfaceSubClass:0xab,
++	bInterfaceProtocol:0x00,
++	iInterface:0x05
++};
++
++static struct usb_config_descriptor config_desc = {
++	bLength:USB_DT_CONFIG_SIZE,
++	bDescriptorType:USB_DT_CONFIG,
++	wTotalLength:CONFIG_DESC_LEN,
++	bNumInterfaces:0x01,
++	bConfigurationValue:0x01,
++	iConfiguration:0x04,	// configuration string
++	bmAttributes:0xc0,	// self-powered
++	MaxPower:20		// 40 mA
++};
++
++// String[0] is a list of Language IDs supported by this device
++static struct usb_string_descriptor string_desc0 = {
++	bLength:4,
++	bDescriptorType:USB_DT_STRING,
++	wData:{0x0409} // English, US
++};
++
++// These strings will be converted to Unicode in string_desc[]
++static char *strings[5] = {
++	"Alchemy Semiconductor",  // iManufacturer
++	"WutzAMattaU",            // iProduct
++	"1.0.doh!",               // iSerialNumber
++	"Au1000 TTY Config",      // iConfiguration
++	"Au1000 TTY Interface"    // iInterface
++};
++
++static inline int
++port_paranoia_check(struct usb_serial_port *port, const char *function)
++{
++	if (!port) {
++		err("%s: port is NULL", function);
++		return -1;
++	}
++	if (!port->tty) {
++		err("%s: port->tty is NULL", function);
++		return -1;
++	}
++
++	return 0;
++}
++
++
++static void
++port_rx_callback(struct usb_serial_port *port)
++{
++	dbg(__FUNCTION__ ": ep%d", port->out_ep_addr);
++	// mark a bh to push this data up to the tty
++	queue_task(&port->receive_complete_tq, &tq_immediate);
++	mark_bh(IMMEDIATE_BH);
++}
++
++static void
++port_tx_callback(struct usb_serial_port *port, usbdev_pkt_t* pkt)
++{
++	dbg(__FUNCTION__ ": ep%d", port->in_ep_addr);
++	// mark a bh to wakeup any tty write system call on the port.
++	queue_task(&port->send_complete_tq, &tq_immediate);
++	mark_bh(IMMEDIATE_BH);
++
++	/* free the returned packet */
++	kfree(pkt);
++}
++
++static void
++usbtty_callback(usbdev_cb_type_t cb_type, unsigned long arg, void* data)
++{
++	usbdev_pkt_t* pkt;
++	int i;
++	
++	switch (cb_type) {
++	case CB_NEW_STATE:
++		dbg(__FUNCTION__ ": new dev_state=%d", (int)arg);
++		usbtty.dev_state = (usbdev_state_t)arg;
++		break;
++	case CB_PKT_COMPLETE:
++		pkt = (usbdev_pkt_t*)arg;
++		for (i=0; i<NUM_PORTS; i++) {
++			struct usb_serial_port *port = &usbtty.port[i];
++			if (pkt->ep_addr == port->in_ep_addr) {
++				port_tx_callback(port, pkt);
++				break;
++			} else if (pkt->ep_addr == port->out_ep_addr) {
++				port_rx_callback(port);
++				break;
++			}
++		}
++		break;
++	}
++}
++
++
++/*****************************************************************************
++ * Here begins the tty driver interface functions
++ *****************************************************************************/
++
++static int serial_open(struct tty_struct *tty, struct file *filp)
++{
++	int portNumber;
++	struct usb_serial_port *port;
++	unsigned long flags;
++
++	/* initialize the pointer incase something fails */
++	tty->driver_data = NULL;
++
++	/* set up our port structure making the tty driver remember
++	   our port object, and us it */
++	portNumber = MINOR(tty->device);
++	port = &usbtty.port[portNumber];
++	tty->driver_data = port;
++	port->tty = tty;
++
++	if (usbtty.dev_state != CONFIGURED ||
++	    port_paranoia_check(port, __FUNCTION__)) {
++		/*
++		 * the device-layer must be in the configured state before
++		 * the function layer can operate.
++		 */
++		return -ENODEV;
++	}
++	
++	dbg(__FUNCTION__ ": port %d", port->number);
++
++	spin_lock_irqsave(&port->port_lock, flags);
++
++	++port->open_count;
++
++	if (!port->active) {
++		port->active = 1;
++
++		/*
++		 * force low_latency on so that our tty_push actually forces
++		 * the data through, otherwise it is scheduled, and with high
++		 * data rates (like with OHCI) data can get lost.
++		 */
++		port->tty->low_latency = 1;
++
++	}
++
++	spin_unlock_irqrestore(&port->port_lock, flags);
++
++	return 0;
++}
++
++
++static void serial_close(struct tty_struct *tty, struct file *filp)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++	unsigned long flags;
++
++	dbg(__FUNCTION__ ": port %d", port->number);
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not opened");
++		return;
++	}
++
++	spin_lock_irqsave(&port->port_lock, flags);
++
++	--port->open_count;
++
++	if (port->open_count <= 0) {
++		port->active = 0;
++		port->open_count = 0;
++	}
++
++	spin_unlock_irqrestore(&port->port_lock, flags);
++	MOD_DEC_USE_COUNT;
++}
++
++
++static int serial_write(struct tty_struct *tty, int from_user,
++			const unsigned char *buf, int count)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++	usbdev_pkt_t* pkt;
++	int max_pkt_sz, ret;
++	unsigned long flags;
++	
++	/*
++	 * the device-layer must be in the configured state before the
++	 * function layer can operate.
++	 */
++	if (usbtty.dev_state != CONFIGURED)
++		return -ENODEV;
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not open");
++		return -EINVAL;
++	}
++
++	if (count == 0) {
++		dbg(__FUNCTION__ ": request of 0 bytes");
++		return (0);
++	}
++
++#if 0
++	if (port->writing) {
++		dbg(__FUNCTION__ ": already writing");
++		return 0;
++	}
++#endif
++	
++	max_pkt_sz = port->in_desc->wMaxPacketSize;
++	count = (count > max_pkt_sz) ? max_pkt_sz : count;
++
++	if ((ret = usbdev_alloc_packet(port->in_ep_addr, count, &pkt)))
++		return ret;
++
++	if (from_user)
++		copy_from_user(pkt->payload, buf, count);
++	else
++		memcpy(pkt->payload, buf, count);
++	
++	ret = usbdev_send_packet(port->in_ep_addr, pkt);
++
++	spin_lock_irqsave(&port->port_lock, flags);
++	port->writing = 1;
++	spin_unlock_irqrestore(&port->port_lock, flags);
++
++	return ret;
++}
++
++
++static int serial_write_room(struct tty_struct *tty)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++	int room = 0;
++	
++	/*
++	 * the device-layer must be in the configured state before the
++	 * function layer can operate.
++	 */
++	if (usbtty.dev_state != CONFIGURED)
++		return -ENODEV;
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not open");
++		return -EINVAL;
++	}
++
++	//room = port->writing ? 0 : port->in_desc->wMaxPacketSize;
++	room = port->in_desc->wMaxPacketSize;
++	
++	dbg(__FUNCTION__ ": %d", room);
++	return room;
++}
++
++
++static int serial_chars_in_buffer(struct tty_struct *tty)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++	int chars = 0;
++	
++	/*
++	 * the device-layer must be in the configured state before the
++	 * function layer can operate.
++	 */
++	if (usbtty.dev_state != CONFIGURED)
++		return -ENODEV;
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not open");
++		return -EINVAL;
++	}
++
++	//chars = port->writing ? usbdev_get_byte_count(port->in_ep_addr) : 0;
++	chars = usbdev_get_byte_count(port->in_ep_addr);
++
++	dbg(__FUNCTION__ ": %d", chars);
++	return chars;
++}
++
++
++static void serial_throttle(struct tty_struct *tty)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++
++	if (!port->active || usbtty.dev_state != CONFIGURED) {
++		err(__FUNCTION__ ": port not open");
++		return;
++	}
++
++	// FIXME: anything to do?
++	dbg(__FUNCTION__);
++}
++
++
++static void serial_unthrottle(struct tty_struct *tty)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++
++	if (!port->active || usbtty.dev_state != CONFIGURED) {
++		err(__FUNCTION__ ": port not open");
++		return;
++	}
++
++	// FIXME: anything to do?
++	dbg(__FUNCTION__);
++}
++
++
++static int serial_ioctl(struct tty_struct *tty, struct file *file,
++			unsigned int cmd, unsigned long arg)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++
++	if (!port->active) {
++		err(__FUNCTION__ ": port not open");
++		return -ENODEV;
++	}
++	// FIXME: need any IOCTLs?
++	dbg(__FUNCTION__);
++
++	return -ENOIOCTLCMD;
++}
++
++
++static void serial_set_termios(struct tty_struct *tty, struct termios *old)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++
++	if (!port->active || usbtty.dev_state != CONFIGURED)  {
++		err(__FUNCTION__ ": port not open");
++		return;
++	}
++
++	dbg(__FUNCTION__);
++	// FIXME: anything to do?
++}
++
++
++static void serial_break(struct tty_struct *tty, int break_state)
++{
++	struct usb_serial_port *port =
++		(struct usb_serial_port *) tty->driver_data;
++
++	if (!port->active || usbtty.dev_state != CONFIGURED)  {
++		err(__FUNCTION__ ": port not open");
++		return;
++	}
++
++	dbg(__FUNCTION__);
++	// FIXME: anything to do?
++}
++
++
++static void port_send_complete(void *private)
++{
++	struct usb_serial_port *port = (struct usb_serial_port *) private;
++	struct tty_struct *tty;
++	unsigned long flags;
++
++	dbg(__FUNCTION__ ": port %d, ep%d", port->number, port->in_ep_addr);
++
++	tty = port->tty;
++	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
++	    tty->ldisc.write_wakeup) {
++		dbg(__FUNCTION__ ": write wakeup call.");
++		(tty->ldisc.write_wakeup) (tty);
++	}
++
++	wake_up_interruptible(&tty->write_wait);
++
++	spin_lock_irqsave(&port->port_lock, flags);
++	port->writing = usbdev_get_byte_count(port->in_ep_addr) <= 0 ? 0 : 1;
++	spin_unlock_irqrestore(&port->port_lock, flags);
++}
++
++
++static void port_receive_complete(void *private)
++{
++	struct usb_serial_port *port = (struct usb_serial_port *) private;
++	struct tty_struct *tty = port->tty;
++	usbdev_pkt_t* pkt = NULL;
++	int i, count;
++
++	/* while there is a packet available */
++	while ((count = usbdev_receive_packet(port->out_ep_addr,
++					      &pkt)) != -ENODATA) {
++		if (count < 0) {
++			if (pkt)
++				kfree(pkt);
++			break; /* exit if error other than ENODATA */
++		}
++		
++		dbg(__FUNCTION__ ": port %d, ep%d, size=%d",
++		    port->number, port->out_ep_addr, count);
++
++		for (i = 0; i < count; i++) {
++			/* if we insert more than TTY_FLIPBUF_SIZE characters,
++			   we drop them. */
++			if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
++				tty_flip_buffer_push(tty);
++			}
++			/* this doesn't actually push the data through
++			   unless tty->low_latency is set */
++			tty_insert_flip_char(tty, pkt->payload[i], 0);
++		}
++		tty_flip_buffer_push(tty);
++
++		kfree(pkt); /* make sure we free the packet */
++	}
++
++}
++
++
++static struct tty_driver serial_tty_driver = {
++	.magic= TTY_DRIVER_MAGIC,
++	.driver_name= "usbfn-tty",
++	.name= "usb/ttsdev/%d",
++	.major= SERIAL_TTY_MAJOR,
++	.minor_start= 0,
++	.num= NUM_PORTS,
++	.type= TTY_DRIVER_TYPE_SERIAL,
++	.subtype= SERIAL_TYPE_NORMAL,
++	.flags= TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
++	.refcount= &serial_refcount,
++	.table= serial_tty,
++	.termios= serial_termios,
++	.termios_locked= serial_termios_locked,
++
++	.open= serial_open,
++	.close= serial_close,
++	.write= serial_write,
++	.write_room= serial_write_room,
++	.ioctl= serial_ioctl,
++	.set_termios= serial_set_termios,
++	.throttle= serial_throttle,
++	.unthrottle= serial_unthrottle,
++	.break_ctl= serial_break,
++	.chars_in_buffer= serial_chars_in_buffer,
++};
++
++
++void usbfn_tty_exit(void)
++{
++	int i;
++	
++	/* kill the device layer */
++	usbdev_exit();
++
++	for (i=0; i < NUM_PORTS; i++) {
++		tty_unregister_devfs(&serial_tty_driver, i);
++		info("usb serial converter now disconnected from ttyUSBdev%d",
++		     i);
++	}
++
++	tty_unregister_driver(&serial_tty_driver);
++
++	if (usbtty.str_desc_buf)
++		kfree(usbtty.str_desc_buf);
++}
++
++
++int usbfn_tty_init(void)
++{
++	int ret = 0, i, str_desc_len;
++
++	/* register the tty driver */
++	serial_tty_driver.init_termios = tty_std_termios;
++	serial_tty_driver.init_termios.c_cflag =
++		B9600 | CS8 | CREAD | HUPCL | CLOCAL;
++	
++	if (tty_register_driver(&serial_tty_driver)) {
++		err(__FUNCTION__ ": failed to register tty driver");
++		ret = -ENXIO;
++		goto out;
++	}
++
++	/*
++	 * initialize pointers to descriptors
++	 */
++	usbtty.dev_desc = &dev_desc;
++	usbtty.config_desc = &config_desc;
++	usbtty.if_desc = &if_desc;
++
++	/*
++	 * initialize the string descriptors
++	 */
++
++	/* alloc buffer big enough for all string descriptors */
++	str_desc_len = string_desc0.bLength;
++	for (i = 0; i < 5; i++)
++		str_desc_len += 2 + 2 * strlen(strings[i]);
++	usbtty.str_desc_buf = (void *) kmalloc(str_desc_len, GFP_KERNEL);
++	if (!usbtty.str_desc_buf) {
++		err(__FUNCTION__ ": failed to alloc string descriptors");
++		ret = -ENOMEM;
++		goto out;
++	}
++
++	usbtty.str_desc[0] =
++		(struct usb_string_descriptor *)usbtty.str_desc_buf;
++	memcpy(usbtty.str_desc[0], &string_desc0, string_desc0.bLength);
++	usbtty.str_desc[1] = (struct usb_string_descriptor *)
++		(usbtty.str_desc_buf + string_desc0.bLength);
++	for (i = 1; i < 6; i++) {
++		struct usb_string_descriptor *desc = usbtty.str_desc[i];
++		char *str = strings[i - 1];
++		int j, str_len = strlen(str);
++
++		desc->bLength = 2 + 2 * str_len;
++		desc->bDescriptorType = USB_DT_STRING;
++		for (j = 0; j < str_len; j++) {
++			desc->wData[j] = (u16) str[j];
++		}
++		if (i < 5)
++			usbtty.str_desc[i + 1] =
++				(struct usb_string_descriptor *)
++				((u8 *) desc + desc->bLength);
++	}
++
++	/*
++	 * start the device layer. The device layer assigns us
++	 * our endpoint addresses
++	 */
++	if ((ret = usbdev_init(&dev_desc, &config_desc, &if_desc, ep_desc,
++			       usbtty.str_desc, usbtty_callback, NULL))) {
++		err(__FUNCTION__ ": device-layer init failed");
++		goto out;
++	}
++	
++	/* initialize the devfs nodes for this device and let the user
++	   know what ports we are bound to */
++	for (i = 0; i < NUM_PORTS; ++i) {
++		struct usb_serial_port *port;
++		tty_register_devfs(&serial_tty_driver, 0, i);
++		info("usbdev serial attached to ttyUSBdev%d "
++		     "(or devfs usb/ttsdev/%d)", i, i);
++		port = &usbtty.port[i];
++		port->number = i;
++		port->in_desc = &ep_desc[NUM_PORTS*i];
++		port->out_desc = &ep_desc[NUM_PORTS*i + 1];
++		port->in_ep_addr = port->in_desc->bEndpointAddress & 0x0f;
++		port->out_ep_addr = port->out_desc->bEndpointAddress & 0x0f;
++		port->send_complete_tq.routine = port_send_complete;
++		port->send_complete_tq.data = port;
++		port->receive_complete_tq.routine = port_receive_complete;
++		port->receive_complete_tq.data = port;
++		spin_lock_init(&port->port_lock);
++	}
++
++ out:
++	if (ret)
++		usbfn_tty_exit();
++	return ret;
++}
++
++
++/* Module information */
++MODULE_AUTHOR("Steve Longerbeam, stevel@mvista.com, www.mvista.com");
++MODULE_DESCRIPTION("Au1x00 USB Device-Side Serial TTY Driver");
++MODULE_LICENSE("GPL");
++
++module_init(usbfn_tty_init);
++module_exit(usbfn_tty_exit);
+diff -Naur linux-2.6.16.orig/drivers/char/decserial.c linux-2.6.16/drivers/char/decserial.c
+--- linux-2.6.16.orig/drivers/char/decserial.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/char/decserial.c	2006-03-21 01:05:47.000000000 +0000
+@@ -14,87 +14,85 @@
+  *      device. Added support for PROM console in drivers/char/tty_io.c
+  *      instead. Although it may work to enable more than one 
+  *      console device I strongly recommend to use only one.
++ *
++ *	Copyright (C) 2004  Maciej W. Rozycki
+  */
+ 
+ #include <linux/config.h>
++#include <linux/errno.h>
+ #include <linux/init.h>
+-#include <asm/dec/machtype.h>
+-
+-#ifdef CONFIG_ZS
+-extern int zs_init(void);
+-#endif
+ 
+-#ifdef CONFIG_DZ
+-extern int dz_init(void);
+-#endif
++#include <asm/dec/machtype.h>
++#include <asm/dec/serial.h>
+ 
+-#ifdef CONFIG_SERIAL_CONSOLE
++extern int register_zs_hook(unsigned int channel,
++			    struct dec_serial_hook *hook);
++extern int unregister_zs_hook(unsigned int channel);
+ 
++int register_dec_serial_hook(unsigned int channel,
++			     struct dec_serial_hook *hook)
++{
+ #ifdef CONFIG_ZS
+-extern void zs_serial_console_init(void);
+-#endif
+-
+-#ifdef CONFIG_DZ
+-extern void dz_serial_console_init(void);
++	if (IOASIC)
++		return register_zs_hook(channel, hook);
+ #endif
++	return 0;
++}
+ 
++int unregister_dec_serial_hook(unsigned int channel)
++{
++#ifdef CONFIG_ZS
++	if (IOASIC)
++		return unregister_zs_hook(channel);
+ #endif
++	return 0;
++}
+ 
+-/* rs_init - starts up the serial interface -
+-   handle normal case of starting up the serial interface */
+ 
+-#ifdef CONFIG_SERIAL
++extern int zs_init(void);
++extern int dz_init(void);
+ 
++/*
++ * rs_init - starts up the serial interface -
++ * handle normal case of starting up the serial interface
++ */
+ int __init rs_init(void)
+ {
+-
+-#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
+-    if (IOASIC)
+-	return zs_init();
+-    else
+-	return dz_init();
+-#else
+-
+ #ifdef CONFIG_ZS
+-    return zs_init();
++	if (IOASIC)
++		return zs_init();
+ #endif
+-
+ #ifdef CONFIG_DZ
+-    return dz_init();
+-#endif
+-
++	if (!IOASIC)
++		return dz_init();
+ #endif
++	return -ENXIO;
+ }
+ 
+ __initcall(rs_init);
+ 
+-#endif
+ 
+-#ifdef CONFIG_SERIAL_CONSOLE
++#ifdef CONFIG_SERIAL_DEC_CONSOLE
++
++extern void zs_serial_console_init(void);
++extern void dz_serial_console_init(void);
+ 
+-/* serial_console_init handles the special case of starting
+- *   up the console on the serial port
++/*
++ * dec_serial_console_init handles the special case of starting
++ * up the console on the serial port
+  */
+-static int __init decserial_console_init(void)
++static int __init dec_serial_console_init(void)
+ {
+-#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
+-    if (IOASIC)
+-	zs_serial_console_init();
+-    else
+-	dz_serial_console_init();
+-#else
+-
+ #ifdef CONFIG_ZS
+-    zs_serial_console_init();
++	if (IOASIC)
++		zs_serial_console_init();
+ #endif
+-
+ #ifdef CONFIG_DZ
+-    dz_serial_console_init();
+-#endif
+-
++	if (!IOASIC)
++		dz_serial_console_init();
+ #endif
+     return 0;
+ }
+-console_initcall(decserial_console_init);
++console_initcall(dec_serial_console_init);
+ 
+ #endif
+diff -Naur linux-2.6.16.orig/drivers/char/ibm_workpad_keymap.map linux-2.6.16/drivers/char/ibm_workpad_keymap.map
+--- linux-2.6.16.orig/drivers/char/ibm_workpad_keymap.map	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/char/ibm_workpad_keymap.map	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,343 @@
++# Keymap for IBM Workpad z50
++# US Mapping
++#
++# by Michael Klar <wyldfier@iname.com>
++#
++# This is a great big mess on account of how the Caps Lock key is handled as
++# LeftShift-RightShift.  Right shift key had to be broken out, so don't use
++# use this map file as a basis for other keyboards that don't do the same
++# thing with Caps Lock.
++#
++# This file is subject to the terms and conditions of the GNU General Public
++# License.  See the file "COPYING" in the main directory of this archive
++# for more details.
++
++keymaps 0-2,4-5,8,12,32-33,36-37
++strings as usual
++
++keycode 0 = F1 F11 Console_13
++	shiftr keycode 0 = F11
++	shift shiftr keycode 0 = F11
++	control keycode 0 = F1
++	alt keycode 0 = Console_1
++	control alt keycode 0 = Console_1
++keycode 1 = F3 F13 Console_15
++	shiftr keycode 1 = F13
++	shift shiftr keycode 1 = F13
++	control keycode 1 = F3
++	alt keycode 1 = Console_3
++	control alt keycode 1 = Console_3
++keycode 2 = F5 F15 Console_17
++	shiftr keycode 2 = F15
++	shift shiftr keycode 2 = F15
++	control keycode 2 = F5
++	alt keycode 2 = Console_5
++	control alt keycode 2 = Console_5
++keycode 3 = F7 F17 Console_19
++	shiftr keycode 3 = F17
++	shift shiftr keycode 3 = F17
++	control keycode 3 = F7
++	alt keycode 3 = Console_7
++	control alt keycode 3 = Console_7
++keycode 4 = F9 F19 Console_21
++	shiftr keycode 4 = F19
++	shift shiftr keycode 4 = F19
++	control keycode 4 = F9
++	alt keycode 4 = Console_9
++	control alt keycode 4 = Console_9
++#keycode 5 is contrast down
++#keycode 6 is contrast up
++keycode 7 = F11 F11 Console_23
++	shiftr keycode 7 = F11
++	shift shiftr keycode 7 = F11
++	control keycode 7 = F11
++	alt keycode 7 = Console_11
++	control alt keycode 7 = Console_11
++keycode 8 = F2 F12 Console_14
++	shiftr keycode 8 = F12
++	shift shiftr keycode 8 = F12
++	control keycode 8 = F2
++	alt keycode 8 = Console_2
++	control alt keycode 8 = Console_2
++keycode 9 = F4 F14 Console_16
++	shiftr keycode 9 = F14
++	shift shiftr keycode 9 = F14
++	control keycode 9 = F4
++	alt keycode 9 = Console_4
++	control alt keycode 9 = Console_4
++keycode 10 = F6 F16 Console_18
++	shiftr keycode 10 = F16
++	shift shiftr keycode 10 = F16
++	control keycode 10 = F6
++	alt keycode 10 = Console_6
++	control alt keycode 10 = Console_6
++keycode 11 = F8 F18 Console_20
++	shiftr keycode 11 = F18
++	shift shiftr keycode 11 = F18
++	control keycode 11 = F8
++	alt keycode 11 = Console_8
++	control alt keycode 11 = Console_8
++keycode 12 = F10 F20 Console_22
++	shiftr keycode 12 = F20
++	shift shiftr keycode 12 = F20
++	control keycode 12 = F10
++	alt keycode 12 = Console_10
++	control alt keycode 12 = Console_10
++#keycode 13 is brightness down
++#keycode 14 is brightness up
++keycode 15 = F12 F12 Console_24
++	shiftr keycode 15 = F12
++	shift shiftr keycode 15 = F12
++	control keycode 15 = F12
++	alt keycode 15 = Console_12
++	control alt keycode 15 = Console_12
++keycode 16 = apostrophe quotedbl
++	shiftr keycode 16 = quotedbl
++	shift shiftr keycode 16 = quotedbl
++	control keycode 16 = Control_g
++	alt keycode 16 = Meta_apostrophe
++keycode 17 = bracketleft braceleft
++	shiftr keycode 17 = braceleft
++	shift shiftr keycode 17 = braceleft
++	control keycode 17 = Escape
++	alt keycode 17 = Meta_bracketleft
++keycode 18 = minus underscore backslash       
++	shiftr keycode 18 = underscore
++	shift shiftr keycode 18 = underscore
++	control keycode 18 = Control_underscore
++	shift control keycode 18 = Control_underscore
++	shiftr control keycode 18 = Control_underscore
++	shift shiftr control keycode 18 = Control_underscore
++	alt keycode 18 = Meta_minus
++keycode 19 = zero parenright braceright
++	shiftr keycode 19 = parenright
++	shift shiftr keycode 19 = parenright
++	alt keycode 19 = Meta_zero
++keycode 20 = p
++	shiftr keycode 20 = +P
++	shift shiftr keycode 20 = +p
++keycode 21 = semicolon colon
++	shiftr keycode 21 = colon
++	shift shiftr keycode 21 = colon
++	alt keycode 21 = Meta_semicolon
++keycode 22 = Up Scroll_Backward
++	shiftr keycode 22 = Scroll_Backward
++	shift shiftr keycode 22 = Scroll_Backward
++	alt keycode 22 = Prior
++keycode 23 = slash question
++	shiftr keycode 23 = question
++	shift shiftr keycode 23 = question
++	control keycode 23 = Delete
++	alt keycode 23 = Meta_slash
++
++keycode 27 = nine parenleft bracketright
++	shiftr keycode 27 = parenleft
++	shift shiftr keycode 27 = parenleft
++	alt keycode 27 = Meta_nine
++keycode 28 = o
++	shiftr keycode 28 = +O
++	shift shiftr keycode 28 = +o
++keycode 29 = l
++	shiftr keycode 29 = +L
++	shift shiftr keycode 29 = +l
++keycode 30 = period greater
++	shiftr keycode 30 = greater
++	shift shiftr keycode 30 = greater
++	control keycode 30 = Compose
++	alt keycode 30 = Meta_period
++
++keycode 32 = Left Decr_Console
++	shiftr keycode 32 = Decr_Console
++	shift shiftr keycode 32 = Decr_Console
++	alt keycode 32 = Home
++keycode 33 = bracketright braceright asciitilde      
++	shiftr keycode 33 = braceright
++	shift shiftr keycode 33 = braceright
++	control keycode 33 = Control_bracketright
++	alt keycode 33 = Meta_bracketright
++keycode 34 = equal plus
++	shiftr keycode 34 = plus
++	shift shiftr keycode 34 = plus
++	alt keycode 34 = Meta_equal
++keycode 35 = eight asterisk bracketleft
++	shiftr keycode 35 = asterisk
++	shift shiftr keycode 35 = asterisk
++	control keycode 35 = Delete
++	alt keycode 35 = Meta_eight
++keycode 36 = i
++	shiftr keycode 36 = +I
++	shift shiftr keycode 36 = +i
++keycode 37 = k
++	shiftr keycode 37 = +K
++	shift shiftr keycode 37 = +k
++keycode 38 = comma less
++	shiftr keycode 38 = less
++	shift shiftr keycode 38 = less
++	alt keycode 38 = Meta_comma
++
++keycode 40 = h
++	shiftr keycode 40 = +H
++	shift shiftr keycode 40 = +h
++keycode 41 = y
++	shiftr keycode 41 = +Y
++	shift shiftr keycode 41 = +y
++keycode 42 = six asciicircum
++	shiftr keycode 42 = asciicircum
++	shift shiftr keycode 42 = asciicircum
++	control keycode 42 = Control_asciicircum
++	alt keycode 42 = Meta_six
++keycode 43 = seven ampersand braceleft
++	shiftr keycode 43 = ampersand
++	shift shiftr keycode 43 = ampersand
++	control keycode 43 = Control_underscore
++	alt keycode 43 = Meta_seven
++keycode 44 = u
++	shiftr keycode 44 = +U
++	shift shiftr keycode 44 = +u
++keycode 45 = j
++	shiftr keycode 45 = +J
++	shift shiftr keycode 45 = +j
++keycode 46 = m
++	shiftr keycode 46 = +M
++	shift shiftr keycode 46 = +m
++keycode 47 = n
++	shiftr keycode 47 = +N
++	shift shiftr keycode 47 = +n
++
++# This is the "Backspace" key:
++keycode 49 = Delete Delete
++	shiftr keycode 49 = Delete
++	shift shiftr keycode 49 = Delete
++	control keycode 49 = BackSpace
++	alt keycode 49 = Meta_Delete
++keycode 50 = Num_Lock
++	shift keycode 50 = Bare_Num_Lock
++	shiftr keycode 50 = Bare_Num_Lock
++	shift shiftr keycode 50 = Bare_Num_Lock
++# This is the "Delete" key:
++keycode 51 = Remove
++	control alt keycode 51 = Boot
++
++keycode 53 = backslash bar
++	shiftr keycode 53 = bar
++	shift shiftr keycode 53 = bar
++	control keycode 53 = Control_backslash
++	alt keycode 53 = Meta_backslash
++keycode 54 = Return
++	alt keycode 54 = Meta_Control_m
++keycode 55 = space space           
++	shiftr keycode 55 = space
++	shift shiftr keycode 55 = space
++	control keycode 55 = nul
++	alt keycode 55 = Meta_space
++keycode 56 = g
++	shiftr keycode 56 = +G
++	shift shiftr keycode 56 = +g
++keycode 57 = t
++	shiftr keycode 57 = +T
++	shift shiftr keycode 57 = +t
++keycode 58 = five percent
++	shiftr keycode 58 = percent
++	shift shiftr keycode 58 = percent
++	control keycode 58 = Control_bracketright
++	alt keycode 58 = Meta_five
++keycode 59 = four dollar dollar
++	shiftr keycode 59 = dollar
++	shift shiftr keycode 59 = dollar
++	control keycode 59 = Control_backslash
++	alt keycode 59 = Meta_four
++keycode 60 = r
++	shiftr keycode 60 = +R
++	shift shiftr keycode 60 = +r
++keycode 61 = f
++	shiftr keycode 61 = +F
++	shift shiftr keycode 61 = +f
++	altgr keycode 61 = Hex_F
++keycode 62 = v
++	shiftr keycode 62 = +V
++	shift shiftr keycode 62 = +v
++keycode 63 = b
++	shiftr keycode 63 = +B
++	shift shiftr keycode 63 = +b
++	altgr keycode 63 = Hex_B
++
++keycode 67 = three numbersign
++	shiftr keycode 67 = numbersign
++	shift shiftr keycode 67 = numbersign
++	control keycode 67 = Escape
++	alt keycode 67 = Meta_three
++keycode 68 = e
++	shiftr keycode 68 = +E
++	shift shiftr keycode 68 = +e
++	altgr keycode 68 = Hex_E
++keycode 69 = d
++	shiftr keycode 69 = +D
++	shift shiftr keycode 69 = +d
++	altgr keycode 69 = Hex_D
++keycode 70 = c
++	shiftr keycode 70 = +C
++	shift shiftr keycode 70 = +c
++	altgr keycode 70 = Hex_C
++keycode 71 = Right Incr_Console
++	shiftr keycode 71 = Incr_Console
++	shift shiftr keycode 71 = Incr_Console
++	alt keycode 71 = End
++
++keycode 75 = two at at
++	shiftr keycode 75 = at
++	shift shiftr keycode 75 = at
++	control keycode 75 = nul
++	shift control keycode 75 = nul
++	shiftr control keycode 75 = nul
++	shift shiftr control keycode 75 = nul
++	alt keycode 75 = Meta_two
++keycode 76 = w
++	shiftr keycode 76 = +W
++	shift shiftr keycode 76 = +w
++keycode 77 = s
++	shiftr keycode 77 = +S
++	shift shiftr keycode 77 = +s
++keycode 78 = x
++	shiftr keycode 78 = +X
++	shift shiftr keycode 78 = +x
++keycode 79 = Down Scroll_Forward
++	shiftr keycode 79 = Scroll_Forward
++	shift shiftr keycode 79 = Scroll_Forward
++	alt keycode 79 = Next
++keycode 80 = Escape Escape
++	shiftr keycode 80 = Escape
++	shift shiftr keycode 80 = Escape
++	alt keycode 80 = Meta_Escape
++keycode 81 = Tab Tab             
++	shiftr keycode 81 = Tab
++	shift shiftr keycode 81 = Tab
++	alt keycode 81 = Meta_Tab
++keycode 82 = grave asciitilde
++	shiftr keycode 82 = asciitilde
++	shift shiftr keycode 82 = asciitilde
++	control keycode 82 = nul
++	alt keycode 82 = Meta_grave
++keycode 83 = one exclam
++	shiftr keycode 83 = exclam
++	shift shiftr keycode 83 = exclam
++	alt keycode 83 = Meta_one
++keycode 84 = q
++	shiftr keycode 84 = +Q
++	shift shiftr keycode 84 = +q
++keycode 85 = a
++	shiftr keycode 85 = +A
++	shift shiftr keycode 85 = +a
++	altgr keycode 85 = Hex_A
++keycode 86 = z
++	shiftr keycode 86 = +Z
++	shift shiftr keycode 86 = +z
++
++# This is the windows key:
++keycode 88 = Decr_Console
++keycode 89 = Shift
++keycode 90 = Control
++keycode 91 = Control
++keycode 92 = Alt
++keycode 93 = AltGr
++keycode 94 = ShiftR
++	shift keycode 94 = Caps_Lock
+diff -Naur linux-2.6.16.orig/drivers/char/qtronix.c linux-2.6.16/drivers/char/qtronix.c
+--- linux-2.6.16.orig/drivers/char/qtronix.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/char/qtronix.c	2006-03-21 01:05:47.000000000 +0000
+@@ -535,8 +535,7 @@
+ 		i--;
+ 	}
+ 	if (count-i) {
+-		struct inode *inode = file->f_dentry->d_inode;
+-		inode->i_atime = current_fs_time(inode->i_sb);
++		file->f_dentry->d_inode->i_atime = get_seconds();
+ 		return count-i;
+ 	}
+ 	if (signal_pending(current))
+diff -Naur linux-2.6.16.orig/drivers/char/rtc.c linux-2.6.16/drivers/char/rtc.c
+--- linux-2.6.16.orig/drivers/char/rtc.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/char/rtc.c	2006-03-21 01:05:47.000000000 +0000
+@@ -35,23 +35,22 @@
+  *	1.09a	Pete Zaitcev: Sun SPARC
+  *	1.09b	Jeff Garzik: Modularize, init cleanup
+  *	1.09c	Jeff Garzik: SMP cleanup
+- *	1.10    Paul Barton-Davis: add support for async I/O
++ *	1.10	Paul Barton-Davis: add support for async I/O
+  *	1.10a	Andrea Arcangeli: Alpha updates
+  *	1.10b	Andrew Morton: SMP lock fix
+  *	1.10c	Cesar Barros: SMP locking fixes and cleanup
+  *	1.10d	Paul Gortmaker: delete paranoia check in rtc_exit
+  *	1.10e	Maciej W. Rozycki: Handle DECstation's year weirdness.
+- *      1.11    Takashi Iwai: Kernel access functions
++ *	1.11	Takashi Iwai: Kernel access functions
+  *			      rtc_register/rtc_unregister/rtc_control
+  *      1.11a   Daniele Bellucci: Audit create_proc_read_entry in rtc_init
+- *	1.12	Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
++ *	1.12    Venkatesh Pallipadi: Hooks for emulating rtc on HPET base-timer
+  *		CONFIG_HPET_EMULATE_RTC
++ *	1.12a	Maciej W. Rozycki: Handle memory-mapped chips properly.
+  *	1.12ac	Alan Cox: Allow read access to the day of week register
+  */
+ 
+-#define RTC_VERSION		"1.12ac"
+-
+-#define RTC_IO_EXTENT	0x8
++#define RTC_VERSION		"1.12a"
+ 
+ /*
+  *	Note that *all* calls to CMOS_READ and CMOS_WRITE are done with
+@@ -338,7 +337,15 @@
+ 	if (rtc_has_irq == 0)
+ 		return -EIO;
+ 
+-	if (count < sizeof(unsigned))
++	/*
++	 * Historically this function used to assume that sizeof(unsigned long)
++	 * is the same in userspace and kernelspace.  This lead to problems
++	 * for configurations with multiple ABIs such a the MIPS o32 and 64
++	 * ABIs supported on the same kernel.  So now we support read of both
++	 * 4 and 8 bytes and assume that's the sizeof(unsigned long) in the
++	 * userspace ABI.
++	 */
++	if (count != sizeof(unsigned int) && count !=  sizeof(unsigned long))
+ 		return -EINVAL;
+ 
+ 	add_wait_queue(&rtc_wait, &wait);
+@@ -369,10 +376,12 @@
+ 		schedule();
+ 	} while (1);
+ 
+-	if (count < sizeof(unsigned long))
+-		retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int); 
++	if (count == sizeof(unsigned int))
++		retval = put_user(data, (unsigned int __user *)buf) ?: sizeof(int);
+ 	else
+ 		retval = put_user(data, (unsigned long __user *)buf) ?: sizeof(long);
++	if (!retval)
++		retval = count;
+  out:
+ 	current->state = TASK_RUNNING;
+ 	remove_wait_queue(&rtc_wait, &wait);
+@@ -924,6 +933,9 @@
+ 	struct sparc_isa_device *isa_dev;
+ #endif
+ #endif
++#ifndef __sparc__
++	void *r;
++#endif
+ 
+ #ifdef __sparc__
+ 	for_each_ebus(ebus) {
+@@ -969,8 +981,13 @@
+ 	}
+ no_irq:
+ #else
+-	if (!request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc")) {
+-		printk(KERN_ERR "rtc: I/O port %d is not free.\n", RTC_PORT (0));
++	if (RTC_IOMAPPED)
++		r = request_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
++	else
++		r = request_mem_region(RTC_PORT(0), RTC_IO_EXTENT, "rtc");
++	if (!r) {
++		printk(KERN_ERR "rtc: I/O resource %lx is not free.\n",
++		       (long)(RTC_PORT(0)));
+ 		return -EIO;
+ 	}
+ 
+@@ -984,7 +1001,10 @@
+ 	if(request_irq(RTC_IRQ, rtc_int_handler_ptr, SA_INTERRUPT, "rtc", NULL)) {
+ 		/* Yeah right, seeing as irq 8 doesn't even hit the bus. */
+ 		printk(KERN_ERR "rtc: IRQ %d is not free.\n", RTC_IRQ);
+-		release_region(RTC_PORT(0), RTC_IO_EXTENT);
++		if (RTC_IOMAPPED)
++			release_region(RTC_PORT(0), RTC_IO_EXTENT);
++		else
++			release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
+ 		return -EIO;
+ 	}
+ 	hpet_rtc_timer_init();
+@@ -1084,7 +1104,10 @@
+ 	if (rtc_has_irq)
+ 		free_irq (rtc_irq, &rtc_port);
+ #else
+-	release_region (RTC_PORT (0), RTC_IO_EXTENT);
++	if (RTC_IOMAPPED)
++		release_region(RTC_PORT(0), RTC_IO_EXTENT);
++	else
++		release_mem_region(RTC_PORT(0), RTC_IO_EXTENT);
+ #ifdef RTC_IRQ
+ 	if (rtc_has_irq)
+ 		free_irq (RTC_IRQ, NULL);
+diff -Naur linux-2.6.16.orig/drivers/char/sb1250_duart.c linux-2.6.16/drivers/char/sb1250_duart.c
+--- linux-2.6.16.orig/drivers/char/sb1250_duart.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/char/sb1250_duart.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,911 @@
++/*
++ * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation
++ *
++ * 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 Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ * 
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
++ */
++
++/* 
++ * Driver support for the on-chip sb1250 dual-channel serial port,
++ * running in asynchronous mode.  Also, support for doing a serial console
++ * on one of those ports 
++ */
++#include <linux/config.h>
++#include <linux/types.h>
++#include <linux/kernel.h>
++#include <linux/serial.h>
++#include <linux/interrupt.h>
++#include <linux/module.h>
++#include <linux/console.h>
++#include <linux/kdev_t.h>
++#include <linux/major.h>
++#include <linux/termios.h>
++#include <linux/spinlock.h>
++#include <linux/irq.h>
++#include <linux/errno.h>
++#include <linux/tty.h>
++#include <linux/sched.h>
++#include <linux/tty_flip.h>
++#include <linux/timer.h>
++#include <linux/init.h>
++#include <linux/mm.h>
++#include <asm/delay.h>
++#include <asm/io.h>
++#include <asm/uaccess.h>
++#include <asm/sibyte/swarm.h>
++#include <asm/sibyte/sb1250.h>
++#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
++#include <asm/sibyte/bcm1480_regs.h>
++#include <asm/sibyte/bcm1480_int.h>
++#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
++#include <asm/sibyte/sb1250_regs.h>
++#include <asm/sibyte/sb1250_int.h>
++#else
++#error invalid SiByte UART configuation
++#endif
++#include <asm/sibyte/sb1250_uart.h>
++#include <asm/war.h>
++
++#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
++#define UNIT_CHANREG(n,reg)	A_BCM1480_DUART_CHANREG((n),(reg))
++#define UNIT_IMRREG(n)		A_BCM1480_DUART_IMRREG(n)
++#define UNIT_INT(n)		(K_BCM1480_INT_UART_0 + (n))
++#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
++#define UNIT_CHANREG(n,reg)	A_DUART_CHANREG((n),(reg))
++#define UNIT_IMRREG(n)		A_DUART_IMRREG(n)
++#define UNIT_INT(n)		(K_INT_UART_0 + (n))
++#else
++#error invalid SiByte UART configuation
++#endif
++
++/* Toggle spewing of debugging output */
++#undef DEBUG
++
++#define DEFAULT_CFLAGS          (CS8 | B115200)
++
++#define TX_INTEN          1
++#define DUART_INITIALIZED 2
++
++#define DUART_MAX_LINE 4
++char sb1250_duart_present[DUART_MAX_LINE];
++EXPORT_SYMBOL(sb1250_duart_present);
++
++/*
++ * Still not sure what the termios structures set up here are for, 
++ *  but we have to supply pointers to them to register the tty driver
++ */
++static struct tty_driver *sb1250_duart_driver; //, sb1250_duart_callout_driver;
++
++/*
++ * This lock protects both the open flags for all the uart states as 
++ * well as the reference count for the module
++ */
++static DEFINE_SPINLOCK(open_lock);
++
++typedef struct { 
++	unsigned char       outp_buf[SERIAL_XMIT_SIZE];
++	unsigned int        outp_head;
++	unsigned int        outp_tail;
++	unsigned int        outp_count;
++	spinlock_t          outp_lock;
++	unsigned int        open;
++	unsigned int        line;
++	unsigned int        last_cflags;
++	unsigned long       flags;
++	struct tty_struct   *tty;
++	/* CSR addresses */
++	volatile u32	    *status;
++	volatile u32	    *imr;
++	volatile u32	    *tx_hold;
++	volatile u32	    *rx_hold;
++	volatile u32	    *mode_1;
++	volatile u32	    *mode_2;
++	volatile u32	    *clk_sel;
++	volatile u32	    *cmd;
++} uart_state_t;
++
++static uart_state_t uart_states[DUART_MAX_LINE];
++
++/*
++ * Inline functions local to this module 
++ */
++
++/*
++ * In bug 1956, we get glitches that can mess up uart registers.  This
++ * "write-mode-1 after any register access" is the accepted
++ * workaround.
++ */
++#if SIBYTE_1956_WAR
++static unsigned int last_mode1[DUART_MAX_LINE];
++#endif
++
++static inline u32 READ_SERCSR(volatile u32 *addr, int line)
++{
++	u32 val = csr_in32(addr);
++#if SIBYTE_1956_WAR
++	csr_out32(last_mode1[line], uart_states[line].mode_1);
++#endif
++	return val;
++}
++
++static inline void WRITE_SERCSR(u32 val, volatile u32 *addr, int line)
++{
++	csr_out32(val, addr);
++#if SIBYTE_1956_WAR
++	csr_out32(last_mode1[line], uart_states[line].mode_1);
++#endif
++}
++
++static void init_duart_port(uart_state_t *port, int line)
++{
++	if (!(port->flags & DUART_INITIALIZED)) {
++		port->line = line;
++		port->status = IOADDR(UNIT_CHANREG(line, R_DUART_STATUS));
++		port->imr = IOADDR(UNIT_IMRREG(line));
++		port->tx_hold = IOADDR(UNIT_CHANREG(line, R_DUART_TX_HOLD));
++		port->rx_hold = IOADDR(UNIT_CHANREG(line, R_DUART_RX_HOLD));
++		port->mode_1 = IOADDR(UNIT_CHANREG(line, R_DUART_MODE_REG_1));
++		port->mode_2 = IOADDR(UNIT_CHANREG(line, R_DUART_MODE_REG_2));
++		port->clk_sel = IOADDR(UNIT_CHANREG(line, R_DUART_CLK_SEL));
++		port->cmd = IOADDR(UNIT_CHANREG(line, R_DUART_CMD));
++		port->flags |= DUART_INITIALIZED;
++	}
++}
++
++/*
++ * Mask out the passed interrupt lines at the duart level.  This should be
++ * called while holding the associated outp_lock.
++ */
++static inline void duart_mask_ints(unsigned int line, unsigned int mask)
++{
++	uart_state_t *port = uart_states + line;
++	u64 tmp = READ_SERCSR(port->imr, line);
++	WRITE_SERCSR(tmp & ~mask, port->imr, line);
++}
++
++	
++/* Unmask the passed interrupt lines at the duart level */
++static inline void duart_unmask_ints(unsigned int line, unsigned int mask)
++{
++	uart_state_t *port = uart_states + line;
++	u64 tmp = READ_SERCSR(port->imr, line);
++	WRITE_SERCSR(tmp | mask, port->imr, line);
++}
++
++static inline void transmit_char_pio(uart_state_t *us)
++{
++	struct tty_struct *tty = us->tty;
++	int blocked = 0;
++
++	if (spin_trylock(&us->outp_lock)) {
++		for (;;) {
++			if (!(READ_SERCSR(us->status, us->line) & M_DUART_TX_RDY))
++				break;
++			if (us->outp_count <= 0 || tty->stopped || tty->hw_stopped) {
++				break;
++			} else {
++				WRITE_SERCSR(us->outp_buf[us->outp_head],
++					     us->tx_hold, us->line);
++				us->outp_head = (us->outp_head + 1) & (SERIAL_XMIT_SIZE-1);
++				if (--us->outp_count <= 0)
++					break;
++			}
++			udelay(10);
++		}
++		spin_unlock(&us->outp_lock);
++	} else {
++		blocked = 1;
++	}
++
++	if (!us->outp_count || tty->stopped ||
++	    tty->hw_stopped || blocked) {
++		us->flags &= ~TX_INTEN;
++		duart_mask_ints(us->line, M_DUART_IMR_TX);
++	}
++
++      	if (us->open &&
++	    (us->outp_count < (SERIAL_XMIT_SIZE/2))) {
++		/*
++		 * We told the discipline at one point that we had no
++		 * space, so it went to sleep.  Wake it up when we hit
++		 * half empty
++		 */
++		if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
++		    tty->ldisc.write_wakeup)
++			tty->ldisc.write_wakeup(tty);
++		wake_up_interruptible(&tty->write_wait);
++	}
++}
++
++/* 
++ * Generic interrupt handler for both channels.  dev_id is a pointer
++ * to the proper uart_states structure, so from that we can derive 
++ * which port interrupted 
++ */
++
++static irqreturn_t duart_int(int irq, void *dev_id, struct pt_regs *regs)
++{
++	uart_state_t *us = (uart_state_t *)dev_id;
++	struct tty_struct *tty = us->tty;
++	unsigned int status = READ_SERCSR(us->status, us->line);
++
++	pr_debug("DUART INT\n");
++
++	if (status & M_DUART_RX_RDY) {
++		int counter = 2048;
++		unsigned int ch;
++
++		if (status & M_DUART_OVRUN_ERR)
++			tty_insert_flip_char(tty, 0, TTY_OVERRUN);
++		if (status & M_DUART_PARITY_ERR) {
++			printk("Parity error!\n");
++		} else if (status & M_DUART_FRM_ERR) {
++			printk("Frame error!\n");
++		}
++
++		while (counter > 0) {
++			if (!(READ_SERCSR(us->status, us->line) & M_DUART_RX_RDY))
++				break;
++			ch = READ_SERCSR(us->rx_hold, us->line);
++			tty_insert_flip_char(tty, ch, 0);
++			udelay(1);
++			counter--;
++		}
++		tty_flip_buffer_push(tty);
++	}
++
++	if (status & M_DUART_TX_RDY) {
++		transmit_char_pio(us);
++	}
++
++	return IRQ_HANDLED;
++}
++
++/*
++ *  Actual driver functions
++ */
++
++/* Return the number of characters we can accomodate in a write at this instant */
++static int duart_write_room(struct tty_struct *tty)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++	int retval;
++
++	retval = SERIAL_XMIT_SIZE - us->outp_count;
++
++	pr_debug("duart_write_room called, returning %i\n", retval);
++
++	return retval;
++}
++
++/* memcpy the data from src to destination, but take extra care if the
++   data is coming from user space */
++static inline int copy_buf(char *dest, const char *src, int size, int from_user) 
++{
++	if (from_user) {
++		(void) copy_from_user(dest, src, size); 
++	} else {
++		memcpy(dest, src, size);
++	}
++	return size;
++}
++
++/*
++ * Buffer up to count characters from buf to be written.  If we don't have
++ * other characters buffered, enable the tx interrupt to start sending
++ */
++static int duart_write(struct tty_struct *tty, const unsigned char *buf,
++		       int count)
++{
++	uart_state_t *us;
++	int c, t, total = 0;
++	unsigned long flags;
++
++	if (!tty) return 0;
++
++	us = tty->driver_data;
++	if (!us) return 0;
++
++	pr_debug("duart_write called for %i chars by %i (%s)\n", count, current->pid, current->comm);
++
++	spin_lock_irqsave(&us->outp_lock, flags);
++
++	for (;;) {
++		c = count;
++
++		t = SERIAL_XMIT_SIZE - us->outp_tail;
++		if (t < c) c = t;
++
++		t = SERIAL_XMIT_SIZE - 1 - us->outp_count;
++		if (t < c) c = t;
++
++		if (c <= 0) break;
++
++		memcpy(us->outp_buf + us->outp_tail, buf, c);
++
++		us->outp_count += c;
++		us->outp_tail = (us->outp_tail + c) & (SERIAL_XMIT_SIZE - 1);
++		buf += c;
++		count -= c;
++		total += c;
++	}
++
++	spin_unlock_irqrestore(&us->outp_lock, flags);
++
++	if (us->outp_count && !tty->stopped && 
++	    !tty->hw_stopped && !(us->flags & TX_INTEN)) {
++		us->flags |= TX_INTEN;
++		duart_unmask_ints(us->line, M_DUART_IMR_TX);
++	}
++
++	return total;
++}
++
++
++/* Buffer one character to be written.  If there's not room for it, just drop
++   it on the floor.  This is used for echo, among other things */
++static void duart_put_char(struct tty_struct *tty, u_char ch)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++	unsigned long flags;
++
++	pr_debug("duart_put_char called.  Char is %x (%c)\n", (int)ch, ch);
++
++	spin_lock_irqsave(&us->outp_lock, flags);
++
++	if (us->outp_count == SERIAL_XMIT_SIZE) {
++		spin_unlock_irqrestore(&us->outp_lock, flags);
++		return;
++	}
++
++	us->outp_buf[us->outp_tail] = ch;
++	us->outp_tail = (us->outp_tail + 1) &(SERIAL_XMIT_SIZE-1);
++	us->outp_count++;
++
++	spin_unlock_irqrestore(&us->outp_lock, flags);
++}
++
++static void duart_flush_chars(struct tty_struct * tty)
++{
++	uart_state_t *port;
++
++	if (!tty) return;
++
++	port = tty->driver_data;
++
++	if (!port) return;
++
++	if (port->outp_count <= 0 || tty->stopped || tty->hw_stopped) {
++		return;
++	}
++
++	port->flags |= TX_INTEN;
++	duart_unmask_ints(port->line, M_DUART_IMR_TX);
++}
++
++/* Return the number of characters in the output buffer that have yet to be 
++   written */
++static int duart_chars_in_buffer(struct tty_struct *tty)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++	int retval;
++
++	retval = us->outp_count;
++
++	pr_debug("duart_chars_in_buffer returning %i\n", retval);
++
++	return retval;
++}
++
++/* Kill everything we haven't yet shoved into the FIFO.  Turn off the
++   transmit interrupt since we've nothing more to transmit */
++static void duart_flush_buffer(struct tty_struct *tty)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++	unsigned long flags;
++
++	pr_debug("duart_flush_buffer called\n");
++	spin_lock_irqsave(&us->outp_lock, flags);
++	us->outp_head = us->outp_tail = us->outp_count = 0;
++	spin_unlock_irqrestore(&us->outp_lock, flags);
++
++	wake_up_interruptible(&us->tty->write_wait);
++	if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
++	    tty->ldisc.write_wakeup)
++		tty->ldisc.write_wakeup(tty);
++}
++
++
++/* See sb1250 user manual for details on these registers */
++static inline void duart_set_cflag(unsigned int line, unsigned int cflag)
++{
++	unsigned int mode_reg1 = 0, mode_reg2 = 0;
++	unsigned int clk_divisor;
++	uart_state_t *port = uart_states + line;
++
++	switch (cflag & CSIZE) {
++	case CS7:
++		mode_reg1 |= V_DUART_BITS_PER_CHAR_7;
++		
++	default:
++		/* We don't handle CS5 or CS6...is there a way we're supposed to flag this? 
++		   right now we just force them to CS8 */
++		mode_reg1 |= 0x0;
++		break;
++	}
++	if (cflag & CSTOPB) {
++	        mode_reg2 |= M_DUART_STOP_BIT_LEN_2;
++	}
++	if (!(cflag & PARENB)) {
++	        mode_reg1 |= V_DUART_PARITY_MODE_NONE;
++	}
++	if (cflag & PARODD) {
++		mode_reg1 |= M_DUART_PARITY_TYPE_ODD;
++	}
++	
++	/* Formula for this is (5000000/baud)-1, but we saturate
++	   at 12 bits, which means we can't actually do anything less
++	   that 1200 baud */
++	switch (cflag & CBAUD) {
++	case B200:	
++	case B300:	
++	case B1200:	clk_divisor = 4095;		break;
++	case B1800:	clk_divisor = 2776;		break;
++	case B2400:	clk_divisor = 2082;		break;
++	case B4800:	clk_divisor = 1040;		break;
++	default:
++	case B9600:	clk_divisor = 519;		break;
++	case B19200:	clk_divisor = 259;		break;
++	case B38400:	clk_divisor = 129;		break;
++	case B57600:	clk_divisor = 85;		break;
++	case B115200:	clk_divisor = 42;		break;
++	}
++	WRITE_SERCSR(mode_reg1, port->mode_1, port->line);
++	WRITE_SERCSR(mode_reg2, port->mode_2, port->line);
++	WRITE_SERCSR(clk_divisor, port->clk_sel, port->line);
++	port->last_cflags = cflag;
++}
++
++
++/* Handle notification of a termios change.  */
++static void duart_set_termios(struct tty_struct *tty, struct termios *old)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++
++	pr_debug("duart_set_termios called by %i (%s)\n", current->pid, current->comm);
++	if (old && tty->termios->c_cflag == old->c_cflag)
++		return;
++	duart_set_cflag(us->line, tty->termios->c_cflag);
++}
++
++static int get_serial_info(uart_state_t *us, struct serial_struct * retinfo) {
++
++	struct serial_struct tmp;
++
++	memset(&tmp, 0, sizeof(tmp));
++
++	tmp.type=PORT_SB1250;
++	tmp.line=us->line;
++	tmp.port=UNIT_CHANREG(tmp.line,0);
++	tmp.irq=UNIT_INT(tmp.line);
++	tmp.xmit_fifo_size=16; /* fixed by hw */
++	tmp.baud_base=5000000;
++	tmp.io_type=SERIAL_IO_MEM;
++
++	if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
++		return -EFAULT;
++
++	return 0;
++}
++
++static int duart_ioctl(struct tty_struct *tty, struct file * file,
++		       unsigned int cmd, unsigned long arg)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++
++/*	if (serial_paranoia_check(info, tty->device, "rs_ioctl"))
++	return -ENODEV;*/
++	switch (cmd) {
++	case TIOCMGET:
++		printk("Ignoring TIOCMGET\n");
++		break;
++	case TIOCMBIS:
++		printk("Ignoring TIOCMBIS\n");
++		break;
++	case TIOCMBIC:
++		printk("Ignoring TIOCMBIC\n");
++		break;
++	case TIOCMSET:
++		printk("Ignoring TIOCMSET\n");
++		break;
++	case TIOCGSERIAL:
++		return get_serial_info(us,(struct serial_struct *) arg);
++	case TIOCSSERIAL:
++		printk("Ignoring TIOCSSERIAL\n");
++		break;
++	case TIOCSERCONFIG:
++		printk("Ignoring TIOCSERCONFIG\n");
++		break;
++	case TIOCSERGETLSR: /* Get line status register */
++		printk("Ignoring TIOCSERGETLSR\n");
++		break;
++	case TIOCSERGSTRUCT:
++		printk("Ignoring TIOCSERGSTRUCT\n");
++		break;
++	case TIOCMIWAIT:
++		printk("Ignoring TIOCMIWAIT\n");
++		break;
++	case TIOCGICOUNT:
++		printk("Ignoring TIOCGICOUNT\n");
++		break;
++	case TIOCSERGWILD:
++		printk("Ignoring TIOCSERGWILD\n");
++		break;
++	case TIOCSERSWILD:
++		printk("Ignoring TIOCSERSWILD\n");
++		break;
++	default:
++		break;
++	}
++//	printk("Ignoring IOCTL %x from pid %i (%s)\n", cmd, current->pid, current->comm);
++	return -ENOIOCTLCMD;
++}
++
++/* XXXKW locking? */
++static void duart_start(struct tty_struct *tty)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++
++	pr_debug("duart_start called\n");
++
++	if (us->outp_count && !(us->flags & TX_INTEN)) {
++		us->flags |= TX_INTEN;
++		duart_unmask_ints(us->line, M_DUART_IMR_TX);
++	}
++}
++
++/* XXXKW locking? */
++static void duart_stop(struct tty_struct *tty)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++
++	pr_debug("duart_stop called\n");
++
++	if (us->outp_count && (us->flags & TX_INTEN)) {
++		us->flags &= ~TX_INTEN;
++		duart_mask_ints(us->line, M_DUART_IMR_TX);
++	}
++}
++
++/* Not sure on the semantics of this; are we supposed to wait until the stuff
++   already in the hardware FIFO drains, or are we supposed to wait until 
++   we've drained the output buffer, too?  I'm assuming the former, 'cause thats
++   what the other drivers seem to assume 
++*/
++
++static void duart_wait_until_sent(struct tty_struct *tty, int timeout)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++	unsigned long orig_jiffies;
++
++	orig_jiffies = jiffies;
++	pr_debug("duart_wait_until_sent(%d)+\n", timeout);
++	while (!(READ_SERCSR(us->status, us->line) & M_DUART_TX_EMT)) {
++		set_current_state(TASK_INTERRUPTIBLE);
++	 	schedule_timeout(1);
++		if (signal_pending(current))
++			break;
++		if (timeout && time_after(jiffies, orig_jiffies + timeout))
++			break;
++	}
++	pr_debug("duart_wait_until_sent()-\n");
++}
++
++/*
++ * duart_hangup() --- called by tty_hangup() when a hangup is signaled.
++ */
++static void duart_hangup(struct tty_struct *tty)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++
++	duart_flush_buffer(tty);
++	us->open = 0;
++	us->tty = 0;
++}
++
++/*
++ * Open a tty line.  Note that this can be called multiple times, so ->open can
++ * be >1.  Only set up the tty struct if this is a "new" open, e.g. ->open was
++ * zero
++ */
++static int duart_open(struct tty_struct *tty, struct file *filp)
++{
++	uart_state_t *us;
++	unsigned int line = tty->index;
++	unsigned long flags;
++
++	if ((line >= tty->driver->num) || !sb1250_duart_present[line])
++		return -ENODEV;
++
++	pr_debug("duart_open called by %i (%s), tty is %p, rw is %p, ww is %p\n",
++	       current->pid, current->comm, tty, tty->read_wait,
++	       tty->write_wait);
++
++	us = uart_states + line;
++	tty->driver_data = us;
++
++	spin_lock_irqsave(&open_lock, flags);
++	if (!us->open) {
++		us->tty = tty;
++		us->tty->termios->c_cflag = us->last_cflags;
++	}
++	us->open++;
++	us->flags &= ~TX_INTEN;
++	duart_unmask_ints(line, M_DUART_IMR_RX);
++	spin_unlock_irqrestore(&open_lock, flags);
++
++	return 0;
++}
++
++
++/*
++ * Close a reference count out.  If reference count hits zero, null the
++ * tty, kill the interrupts.  The tty_io driver is responsible for making
++ * sure we've cleared out our internal buffers before calling close()
++ */
++static void duart_close(struct tty_struct *tty, struct file *filp)
++{
++	uart_state_t *us = (uart_state_t *) tty->driver_data;
++	unsigned long flags;
++
++	pr_debug("duart_close called by %i (%s)\n", current->pid, current->comm);
++
++	if (!us || !us->open)
++		return;
++
++	spin_lock_irqsave(&open_lock, flags);
++	if (tty_hung_up_p(filp)) {
++		spin_unlock_irqrestore(&open_lock, flags);
++		return;
++	}
++
++	if (--us->open < 0) {
++		us->open = 0;
++		printk(KERN_ERR "duart: bad open count: %d\n", us->open);
++	}
++	if (us->open) {
++		spin_unlock_irqrestore(&open_lock, flags);
++		return;
++	}
++
++	spin_unlock_irqrestore(&open_lock, flags);
++
++	tty->closing = 1;
++
++	/* Stop accepting input */
++	duart_mask_ints(us->line, M_DUART_IMR_RX);
++	/* Wait for FIFO to drain */
++	while (!(READ_SERCSR(us->status, us->line) & M_DUART_TX_EMT))
++		;
++
++	if (tty->driver->flush_buffer)
++		tty->driver->flush_buffer(tty);
++	if (tty->ldisc.flush_buffer)
++		tty->ldisc.flush_buffer(tty);
++	tty->closing = 0;
++}
++
++
++static struct tty_operations duart_ops = {
++        .open   = duart_open,
++        .close = duart_close,
++        .write = duart_write,
++        .put_char = duart_put_char,
++        .flush_chars = duart_flush_chars,
++        .write_room = duart_write_room,
++        .chars_in_buffer = duart_chars_in_buffer,
++        .flush_buffer = duart_flush_buffer,
++        .ioctl = duart_ioctl,
++//        .throttle = duart_throttle,
++//        .unthrottle = duart_unthrottle,
++        .set_termios = duart_set_termios,
++        .stop = duart_stop,
++        .start = duart_start,
++        .hangup = duart_hangup,
++	.wait_until_sent = duart_wait_until_sent,
++};
++
++/* Initialize the sb1250_duart_present array based on SOC type.  */
++static void __init sb1250_duart_init_present_lines(void)
++{
++	int i, max_lines;
++
++	/* Set the number of available units based on the SOC type.  */
++	switch (soc_type) {
++	case K_SYS_SOC_TYPE_BCM1x55:
++	case K_SYS_SOC_TYPE_BCM1x80:
++		max_lines = 4;
++		break;
++	default:
++		/* Assume at least two serial ports at the normal address.  */
++		max_lines = 2;
++		break;
++	}
++	if (max_lines > DUART_MAX_LINE)
++		max_lines = DUART_MAX_LINE;
++
++	for (i = 0; i < max_lines; i++)
++		sb1250_duart_present[i] = 1;
++}
++
++/* Set up the driver and register it, register the UART interrupts.  This
++   is called from tty_init, or as a part of the module init */
++static int __init sb1250_duart_init(void) 
++{
++	int i;
++
++	sb1250_duart_init_present_lines();
++
++	sb1250_duart_driver = alloc_tty_driver(DUART_MAX_LINE);
++	if (!sb1250_duart_driver)
++		return -ENOMEM;
++
++	sb1250_duart_driver->owner = THIS_MODULE;
++	sb1250_duart_driver->name = "duart";
++	sb1250_duart_driver->devfs_name = "duart/";
++	sb1250_duart_driver->major = TTY_MAJOR;
++	sb1250_duart_driver->minor_start = SB1250_DUART_MINOR_BASE;
++	sb1250_duart_driver->type            = TTY_DRIVER_TYPE_SERIAL;
++	sb1250_duart_driver->subtype         = SERIAL_TYPE_NORMAL;
++	sb1250_duart_driver->init_termios    = tty_std_termios;
++	sb1250_duart_driver->flags           = TTY_DRIVER_REAL_RAW;
++	tty_set_operations(sb1250_duart_driver, &duart_ops);
++
++	for (i=0; i<DUART_MAX_LINE; i++) {
++		uart_state_t *port = uart_states + i;
++
++		if (!sb1250_duart_present[i])
++			continue;
++
++		init_duart_port(port, i);
++		spin_lock_init(&port->outp_lock);
++		duart_mask_ints(i, M_DUART_IMR_ALL);
++		if (request_irq(UNIT_INT(i), duart_int, 0, "uart", port)) {
++			panic("Couldn't get uart0 interrupt line");
++		}
++		__raw_writeq(M_DUART_RX_EN|M_DUART_TX_EN,
++			     IOADDR(UNIT_CHANREG(i, R_DUART_CMD)));
++		duart_set_cflag(i, DEFAULT_CFLAGS);
++	}
++
++	/* Interrupts are now active, our ISR can be called. */
++
++	if (tty_register_driver(sb1250_duart_driver)) {
++		printk(KERN_ERR "Couldn't register sb1250 duart serial driver\n");
++		put_tty_driver(sb1250_duart_driver);
++		return 1;
++	}
++	return 0;
++}
++
++/* Unload the driver.  Unregister stuff, get ready to go away */
++static void __exit sb1250_duart_fini(void)
++{
++	unsigned long flags;
++	int i;
++
++	local_irq_save(flags);
++	tty_unregister_driver(sb1250_duart_driver);
++	put_tty_driver(sb1250_duart_driver);
++
++	for (i=0; i<DUART_MAX_LINE; i++) {
++		if (!sb1250_duart_present[i])
++			continue;
++		free_irq(UNIT_INT(i), &uart_states[i]);
++		disable_irq(UNIT_INT(i));
++	}
++	local_irq_restore(flags);
++}
++
++module_init(sb1250_duart_init);
++module_exit(sb1250_duart_fini);
++MODULE_DESCRIPTION("SB1250 Duart serial driver");
++MODULE_AUTHOR("Broadcom Corp.");
++
++#ifdef CONFIG_SIBYTE_SB1250_DUART_CONSOLE
++
++/*
++ * Serial console stuff.  Very basic, polling driver for doing serial
++ * console output.  The console_sem is held by the caller, so we
++ * shouldn't be interrupted for more console activity.
++ * XXXKW What about getting interrupted by uart driver activity?
++ */
++
++void serial_outc(unsigned char c, int line)
++{
++	uart_state_t *port = uart_states + line;
++	while (!(READ_SERCSR(port->status, line) & M_DUART_TX_RDY)) ;
++	WRITE_SERCSR(c, port->tx_hold, line);
++	while (!(READ_SERCSR(port->status, port->line) & M_DUART_TX_EMT)) ;
++}
++
++static void ser_console_write(struct console *cons, const char *s,
++	unsigned int count)
++{
++	int line = cons->index;
++	uart_state_t *port = uart_states + line;
++	u32 imr;
++
++	imr = READ_SERCSR(port->imr, line);
++	WRITE_SERCSR(0, port->imr, line);
++	while (count--) {
++		if (*s == '\n')
++			serial_outc('\r', line);
++		serial_outc(*s++, line);
++    	}
++	WRITE_SERCSR(imr, port->imr, line);
++}
++
++static struct tty_driver *ser_console_device(struct console *c, int *index)
++{
++	*index = c->index;
++	return sb1250_duart_driver;
++}
++
++static int ser_console_setup(struct console *cons, char *str)
++{
++	int i;
++
++	sb1250_duart_init_present_lines();
++
++	for (i=0; i<DUART_MAX_LINE; i++) {
++		uart_state_t *port = uart_states + i;
++
++		if (!sb1250_duart_present[i])
++			continue;
++
++		init_duart_port(port, i);
++#if SIBYTE_1956_WAR
++		last_mode1[i] = V_DUART_PARITY_MODE_NONE|V_DUART_BITS_PER_CHAR_8;
++#endif
++		WRITE_SERCSR(V_DUART_PARITY_MODE_NONE|V_DUART_BITS_PER_CHAR_8,
++			     port->mode_1, i);
++		WRITE_SERCSR(M_DUART_STOP_BIT_LEN_1,
++			     port->mode_2, i);
++		WRITE_SERCSR(V_DUART_BAUD_RATE(115200),
++			     port->clk_sel, i);
++		WRITE_SERCSR(M_DUART_RX_EN|M_DUART_TX_EN,
++			     port->cmd, i);
++	}
++	return 0;
++}
++
++static struct console sb1250_ser_cons = {
++	.name		= "duart",
++	.write		= ser_console_write,
++	.device		= ser_console_device,
++	.setup		= ser_console_setup,
++	.flags		= CON_PRINTBUFFER,
++	.index		= -1,
++};
++
++static int __init sb1250_serial_console_init(void)
++{
++	register_console(&sb1250_ser_cons);
++	return 0;
++}
++
++console_initcall(sb1250_serial_console_init);
++
++#endif /* CONFIG_SIBYTE_SB1250_DUART_CONSOLE */
+diff -Naur linux-2.6.16.orig/drivers/ide/mips/Makefile linux-2.6.16/drivers/ide/mips/Makefile
+--- linux-2.6.16.orig/drivers/ide/mips/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/ide/mips/Makefile	2006-03-21 01:05:47.000000000 +0000
+@@ -1,4 +1,4 @@
+ obj-$(CONFIG_BLK_DEV_IDE_SWARM)		+= swarm.o
+ obj-$(CONFIG_BLK_DEV_IDE_AU1XXX)	+= au1xxx-ide.o
+ 
+-EXTRA_CFLAGS    := -Idrivers/ide
++CFLAGS_au1xxx-ide.o := -Idrivers/ide
+diff -Naur linux-2.6.16.orig/drivers/mtd/devices/Kconfig linux-2.6.16/drivers/mtd/devices/Kconfig
+--- linux-2.6.16.orig/drivers/mtd/devices/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/mtd/devices/Kconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -47,6 +47,11 @@
+ 	  accelerator.  Say Y here if you have a DECstation 5000/2x0 or a
+ 	  DECsystem 5900 equipped with such a module.
+ 
++	  If you want to compile this driver as a module ( = code which can be
++	  inserted in and removed from the running kernel whenever you want),
++	  say M here and read <file:Documentation/modules.txt>.  The module will
++	  be called ms02-nv.o.
++
+ config MTD_DATAFLASH
+ 	tristate "Support for AT45xxx DataFlash"
+ 	depends on MTD && SPI_MASTER && EXPERIMENTAL
+diff -Naur linux-2.6.16.orig/drivers/mtd/maps/Kconfig linux-2.6.16/drivers/mtd/maps/Kconfig
+--- linux-2.6.16.orig/drivers/mtd/maps/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/mtd/maps/Kconfig	2006-03-21 01:05:47.000000000 +0000
+@@ -200,8 +200,8 @@
+ 	  Support for the flash chip on Tsunami TIG bus.
+ 
+ config MTD_LASAT
+-	tristate "Flash chips on LASAT board"
+-	depends on LASAT
++	tristate "LASAT flash device"
++	depends on LASAT && MTD_CFI
+ 	help
+ 	  Support for the flash chips on the Lasat 100 and 200 boards.
+ 
+@@ -299,6 +299,18 @@
+ 	  Mapping for the Flaga digital module. If you don't have one, ignore
+ 	  this setting.
+ 
++config MTD_XXS1500
++	tristate "MyCable XXS1500 Flash device"
++	depends on MIPS && MIPS_XXS1500
++	help
++	  Flash memory access on MyCable XXS1500 Board
++
++config MTD_MTX1
++	tristate "4-G Systems MTX-1 Flash device"
++	depends on MIPS && MIPS_MTX1
++	help
++	  Flash memory access on 4-G Systems MTX-1 Board
++
+ config MTD_BEECH
+ 	tristate "CFI Flash device mapped on IBM 405LP Beech"
+ 	depends on MTD_CFI && BEECH
+diff -Naur linux-2.6.16.orig/drivers/mtd/maps/lasat.c linux-2.6.16/drivers/mtd/maps/lasat.c
+--- linux-2.6.16.orig/drivers/mtd/maps/lasat.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/mtd/maps/lasat.c	2006-03-21 01:05:47.000000000 +0000
+@@ -50,7 +50,7 @@
+ 	ENABLE_VPP((&lasat_map));
+ 
+ 	lasat_map.phys = lasat_flash_partition_start(LASAT_MTD_BOOTLOADER);
+-	lasat_map.virt = ioremap_nocache(
++	lasat_map.virt = (unsigned long)ioremap_nocache(
+ 		        lasat_map.phys, lasat_board_info.li_flash_size);
+ 	lasat_map.size = lasat_board_info.li_flash_size;
+ 
+diff -Naur linux-2.6.16.orig/drivers/net/Kconfig linux-2.6.16/drivers/net/Kconfig
+--- linux-2.6.16.orig/drivers/net/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/net/Kconfig	2006-03-21 01:05:48.000000000 +0000
+@@ -438,6 +438,14 @@
+ 	  This is the driver for the onboard card of MIPS Magnum 4000,
+ 	  Acer PICA, Olivetti M700-10 and a few other identical OEM systems.
+ 
++config GALILEO_64240_ETH
++	tristate "Galileo GT64240 Ethernet support"
++	depends on NET_ETHERNET && MOMENCO_OCELOT_G
++	select MII
++	help
++	  This is the driver for the ethernet interfaces integrated into
++	  the Galileo (now Marvell) GT64240 chipset.
++
+ config MIPS_GT96100ETH
+ 	bool "MIPS GT96100 Ethernet support"
+ 	depends on NET_ETHERNET && MIPS_GT96100
+@@ -452,10 +460,6 @@
+ 	  If you have an Alchemy Semi AU1X00 based system
+ 	  say Y.  Otherwise, say N.
+ 
+-config NET_SB1250_MAC
+-	tristate "SB1250 Ethernet support"
+-	depends on NET_ETHERNET && SIBYTE_SB1xxx_SOC
+-
+ config SGI_IOC3_ETH
+ 	bool "SGI IOC3 Ethernet"
+ 	depends on NET_ETHERNET && PCI && SGI_IP27
+@@ -494,6 +498,14 @@
+ 	  emulated by the MIPS Simulator.
+ 	  If you are not using a MIPSsim or are unsure, say N.
+ 
++config MIPS_SIM_NET
++	tristate "MIPS simulator Network device (EXPERIMENTAL)"
++	depends on NETDEVICES && MIPS_SIM && EXPERIMENTAL
++	help
++	  The MIPSNET device is a simple Ethernet network device which is
++	  emulated by the MIPS Simulator.
++	  If you are not using a MIPSsim or are unsure, say N.
++
+ config SGI_O2MACE_ETH
+ 	tristate "SGI O2 MACE Fast Ethernet support"
+ 	depends on NET_ETHERNET && SGI_IP32=y
+@@ -1997,6 +2009,10 @@
+ 
+ 	  If in doubt, say N.
+ 
++config NET_SB1250_MAC
++	tristate "SB1250 Ethernet support"
++	depends on SIBYTE_SB1xxx_SOC
++
+ config R8169_VLAN
+ 	bool "VLAN support"
+ 	depends on R8169 && VLAN_8021Q
+@@ -2197,8 +2213,8 @@
+ 	depends on MOMENCO_OCELOT_C || MOMENCO_JAGUAR_ATX || MV64360 || MOMENCO_OCELOT_3 || PPC_MULTIPLATFORM
+ 	help
+ 	  This driver supports the gigabit Ethernet on the Marvell MV643XX
+-	  chipset which is used in the Momenco Ocelot C and Jaguar ATX and
+-	  Pegasos II, amongst other PPC and MIPS boards.
++	  chipset which is used in the Momenco Ocelot C Ocelot, Jaguar ATX
++	  and Pegasos II, amongst other PPC and MIPS boards.
+ 
+ config MV643XX_ETH_0
+ 	bool "MV-643XX Port 0"
+@@ -2221,6 +2237,20 @@
+ 	  This enables support for Port 2 of the Marvell MV643XX Gigabit
+ 	  Ethernet.
+ 
++config BIG_SUR_FE
++	bool "PMC-Sierra TITAN Fast Ethernet Support"
++	depends on NET_ETHERNET && PMC_BIG_SUR
++	help
++	  This enables support for the the integrated ethernet of
++	  PMC-Sierra's Big Sur SoC.
++
++config TITAN_GE
++	bool "PMC-Sierra TITAN Gigabit Ethernet Support"
++	depends on PMC_YOSEMITE
++	help
++	  This enables support for the the integrated ethernet of
++	  PMC-Sierra's Titan SoC.
++
+ endmenu
+ 
+ #
+diff -Naur linux-2.6.16.orig/drivers/net/Makefile linux-2.6.16/drivers/net/Makefile
+--- linux-2.6.16.orig/drivers/net/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/net/Makefile	2006-03-21 01:05:48.000000000 +0000
+@@ -111,6 +111,11 @@
+ 
+ obj-$(CONFIG_MV643XX_ETH) += mv643xx_eth.o
+ 
++obj-$(CONFIG_GALILEO_64240_ETH) += gt64240eth.o
++obj-$(CONFIG_MV64340_ETH) += mv64340_eth.o
++obj-$(CONFIG_BIG_SUR_FE) += big_sur_ge.o
++obj-$(CONFIG_TITAN_GE) += titan_mdio.o titan_ge.o
++
+ obj-$(CONFIG_PPP) += ppp_generic.o slhc.o
+ obj-$(CONFIG_PPP_ASYNC) += ppp_async.o
+ obj-$(CONFIG_PPP_SYNC_TTY) += ppp_synctty.o
+diff -Naur linux-2.6.16.orig/drivers/net/big_sur_ge.c linux-2.6.16/drivers/net/big_sur_ge.c
+--- linux-2.6.16.orig/drivers/net/big_sur_ge.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/big_sur_ge.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,2005 @@
++/*
++ * drivers/net/big_sur_ge.c - Driver for PMC-Sierra Big Sur ethernet ports
++ *
++ * Copyright (C) 2003 PMC-Sierra Inc.
++ * Author : Manish Lachwani (lachwani@pmc-sierra.com)
++ * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
++ *
++ * 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 Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
++ *
++ */
++
++/*************************************************************************
++ * Description :
++ *
++ * The driver has three modes of operation: FIFO non-DMA, Simple DMA
++ * and SG DMA. There is also a Polled mode and an Interrupt mode of
++ * operation. SG DMA should do zerocopy and check offload. Probably,
++ * zerocopy on the Rx might also work. Simple DMA is the non-zerocpy
++ * case on the Tx and the Rx.
++ *
++ * We turn on Simple DMA and interrupt mode. Although, support has been
++ * added for the SG mode also but not for the polled mode. This is a
++ * Fast Ethernet driver although there will be support for Gigabit soon.
++ *
++ * The driver is divided into two parts: Hardware dependent and a
++ * Hardware independent. There is currently no support for checksum offload
++ * zerocopy and Rx NAPI. There is support for Interrupt Mitigation.
++ ****************************************************************************/
++
++/*************************************************************
++ * Hardware Indepenent Part of the driver
++ *************************************************************/
++
++#include <linux/module.h>
++#include <linux/init.h>
++#include <linux/netdevice.h>
++#include <linux/etherdevice.h>
++#include <linux/skbuff.h>
++#include <linux/mii.h>
++#include <asm/io.h>
++#include <asm/irq.h>
++
++#include "big_sur_ge.h"
++
++#define TX_TIMEOUT (60*HZ)	/* Transmission timeout is 60 seconds. */
++
++static struct net_device *dev_list = NULL;
++static DEFINE_SPINLOCK(dev_lock);
++
++typedef enum DUPLEX { UNKNOWN, HALF_DUPLEX, FULL_DUPLEX } DUPLEX;
++
++/* Big Sur Ethernet MAC structure */
++struct big_sur_ge_enet {
++	struct net_device_stats stats;	/* Statistics for this device */
++	struct net_device *next_dev;	/* The next device in dev_list */
++	struct timer_list phy_timer;	/* PHY monitoring timer */
++	u32 index;		/* Which interface is this */
++	u32 save_base_address;	/* Saved physical base address */
++	struct sk_buff *saved_skb;	/* skb being transmitted */
++	spinlock_t lock;	/* For atomic access to saved_skb */
++	u8 mii_addr;		/* The MII address of the PHY */
++	big_sur_ge emac;	/* GE driver structure */
++};
++
++/* Manish : For testing purposes only */
++static unsigned char big_sur_mac_addr_base[6] = "00:11:22:33:44:55";
++
++/*********************************************************************
++ * Function Prototypes (whole bunch of them)
++ *********************************************************************/
++unsigned long big_sur_ge_dma_control(xdma_channel *);
++void big_sur_ge_dma_reset(xdma_channel *);
++static void handle_fifo_intr(big_sur_ge *);
++void big_sur_ge_check_fifo_recv_error(big_sur_ge *);
++void big_sur_ge_check_fifo_send_error(big_sur_ge *);
++static int big_sur_ge_config_fifo(big_sur_ge *);
++big_sur_ge_config *big_sur_ge_lookup_config(unsigned int);
++static int big_sur_ge_config_dma(big_sur_ge *);
++void big_sur_ge_enet_reset(big_sur_ge *);
++void big_sur_ge_check_mac_error(big_sur_ge *, unsigned long);
++
++/*********************************************************************
++ * DMA Channel Initialization
++ **********************************************************************/
++static int big_sur_ge_dma_init(xdma_channel * dma, unsigned long base_address)
++{
++	dma->reg_base_address = base_address;
++	dma->get_ptr = NULL;
++	dma->put_ptr = NULL;
++	dma->commit_ptr = NULL;
++	dma->last_ptr = NULL;
++	dma->total_desc_count = (unsigned long) NULL;
++	dma->active_desc_count = (unsigned long) NULL;
++	dma->ready = 1;		/* DMA channel is ready */
++
++	big_sur_ge_dma_reset(dma);
++
++	return 0;
++}
++
++/*********************************************************************
++ * Is the DMA channel ready yet ?
++ **********************************************************************/
++static int big_sur_ge_dma_ready(xdma_channel * dma)
++{
++	return dma->ready == 1;
++}
++
++/*********************************************************************
++ * Perform the self test on the DMA channel
++ **********************************************************************/
++#define BIG_SUR_GE_CONTROL_REG_RESET_MASK	0x98000000
++
++static int big_sur_ge_dma_self_test(xdma_channel * dma)
++{
++	unsigned long reg_data;
++
++	big_sur_ge_dma_reset(dma);
++
++	reg_data = big_sur_ge_dma_control(dma);
++	if (reg_data != BIG_SUR_GE_CONTROL_REG_RESET_MASK) {
++		printk(KERN_ERR "DMA Channel Self Test Failed \n");
++		return -1;
++	}
++
++	return 0;
++}
++
++/*********************************************************************
++ * Reset the DMA channel
++ **********************************************************************/
++static void big_sur_ge_dma_reset(xdma_channel * dma)
++{
++	BIG_SUR_GE_WRITE(dma->reg_base_address + BIG_SUR_GE_RST_REG_OFFSET,
++			 BIG_SUR_GE_RESET_MASK);
++}
++
++/*********************************************************************
++ * Get control of the DMA channel
++ **********************************************************************/
++static unsigned long big_sur_ge_dma_control(xdma_channel * dma)
++{
++	return BIG_SUR_GE_READ(dma->reg_base_address +
++			       BIG_SUR_GE_DMAC_REG_OFFSET);
++}
++
++/*********************************************************************
++ * Set control of the DMA channel
++ **********************************************************************/
++static void big_sur_ge_set_dma_control(xdma_channel * dma, unsigned long control)
++{
++	BIG_SUR_GE_WRITE(dma->reg_base_address +
++			 BIG_SUR_GE_DMAC_REG_OFFSET, control);
++}
++
++/*********************************************************************
++ * Get the status of the DMA channel
++ *********************************************************************/
++static unsigned long big_sur_ge_dma_status(xdma_channel * dma)
++{
++	return BIG_SUR_GE_READ(dma->reg_base_address +
++			       BIG_SUR_GE_DMAS_REG_OFFSET);
++}
++
++/*********************************************************************
++ * Set the interrupt status of the DMA channel
++ *********************************************************************/
++static void big_sur_ge_set_intr_status(xdma_channel * dma, unsigned long status)
++{
++	BIG_SUR_GE_WRITE(dma->reg_base_address + BIG_SUR_GE_IS_REG_OFFSET,
++			 status);
++}
++
++/*********************************************************************
++ * Get the interrupt status of the DMA channel
++ *********************************************************************/
++static unsigned long big_sur_ge_get_intr_status(xdma_channel * dma)
++{
++	return BIG_SUR_GE_READ(dma->reg_base_address +
++			       BIG_SUR_GE_IS_REG_OFFSET);
++}
++
++/*********************************************************************
++ * Set the Interrupt Enable
++ *********************************************************************/
++static void big_sur_ge_set_intr_enable(xdma_channel * dma, unsigned long enable)
++{
++	BIG_SUR_GE_WRITE(dma->reg_base_address + BIG_SUR_GE_IE_REG_OFFSET,
++			 enable);
++}
++
++/*********************************************************************
++ * Get the Interrupt Enable field to make a check
++ *********************************************************************/
++static unsigned long big_sur_ge_get_intr_enable(xdma_channel * dma)
++{
++	return BIG_SUR_GE_READ(dma->reg_base_address +
++			       BIG_SUR_GE_IE_REG_OFFSET);
++}
++
++/*********************************************************************
++ * Transfer the data over the DMA channel
++ *********************************************************************/
++static void big_sur_ge_dma_transfer(xdma_channel * dma, unsigned long *source,
++			     unsigned long *dest, unsigned long length)
++{
++	BIG_SUR_GE_WRITE(dma->reg_base_address + BIG_SUR_GE_SA_REG_OFFSET,
++			 (unsigned long) source);
++
++	BIG_SUR_GE_WRITE(dma->reg_base_address + BIG_SUR_GE_DA_REG_OFFSET,
++			 (unsigned long) dest);
++
++	BIG_SUR_GE_WRITE(dma->reg_base_address + BIG_SUR_GE_LEN_REG_OFFSET,
++			 length);
++}
++
++/*********************************************************************
++ * Get the DMA descriptor
++ *********************************************************************/
++static int big_sur_ge_get_descriptor(xdma_channel * dma,
++			      xbuf_descriptor ** buffer_desc)
++{
++	unsigned long reg_data;
++
++	reg_data = xbuf_descriptor_GetControl(dma->get_ptr);
++	xbuf_descriptor_SetControl(dma->get_ptr, reg_data |
++				   BIG_SUR_GE_DMACR_SG_DISABLE_MASK);
++
++	*buffer_desc = dma->get_ptr;
++
++	dma->get_ptr = xbuf_descriptor_GetNextPtr(dma->get_ptr);
++	dma->active_desc_count--;
++
++	return 0;
++}
++
++/*********************************************************************
++ * Get the packet count
++ *********************************************************************/
++static int big_sur_ge_get_packet_count(xdma_channel * dma)
++{
++	return (BIG_SUR_GE_READ
++		(dma->reg_base_address + BIG_SUR_GE_UPC_REG_OFFSET));
++}
++
++/*********************************************************************
++ * Descrement the packet count
++ *********************************************************************/
++static void big_sur_ge_decr_packet_count(xdma_channel * dma)
++{
++	unsigned long reg_data;
++
++	reg_data =
++	    BIG_SUR_GE_READ(dma->base_address + BIG_SUR_GE_UPC_REG_OFFSET);
++	if (reg_data > 0)
++		BIG_SUR_GE_WRITE(dma->base_address +
++				 BIG_SUR_GE_UPC_REG_OFFSET, 1);
++}
++
++/****************************************************************************
++ * Start of the code that deals with the Packet Fifo
++ *****************************************************************************/
++
++/****************************************************************************
++ * Init the packet fifo
++ ****************************************************************************/
++static int packet_fifo_init(packet_fifo * fifo, u32 reg, u32 data)
++{
++	fifo->reg_base_addr = reg;
++	fifo->data_base_address = data;
++	fifo->ready_status = 1;
++
++	BIG_SUR_GE_FIFO_RESET(fifo);
++
++	return 0;
++}
++
++/****************************************************************************
++ * Packet fifo self test
++ ****************************************************************************/
++static int packet_fifo_self_test(packet_fifo * fifo, unsigned long type)
++{
++	unsigned long reg_data;
++
++	BIG_SUR_GE_FIFO_RESET(fifo);
++	reg_data =
++	    BIG_SUR_GE_READ(fifo->reg_base_addr +
++			    BIG_SUR_GE_COUNT_STATUS_REG_OFFSET);
++
++	if (type == BIG_SUR_GE_READ_FIFO_TYPE) {
++		if (reg_data != BIG_SUR_GE_EMPTY_FULL_MASK) {
++			printk(KERN_ERR "Read FIFO not empty \n");
++			return -1;
++		}
++	} else if (!(reg_data & BIG_SUR_GE_EMPTY_FULL_MASK)) {
++		printk(KERN_ERR "Write FIFO is full \n");
++		return -1;
++	}
++
++	return 0;
++}
++
++/****************************************************************************
++ * Packet FIFO read
++ ****************************************************************************/
++static int packet_fifo_read(packet_fifo * fifo, u8 * buffer, unsigned int len)
++{
++	unsigned long fifo_count, word_count, extra_byte;
++	unsigned long *buffer_data = (unsigned long *) buffer;
++
++	fifo_count =
++	    BIG_SUR_GE_READ(fifo->reg_base_addr +
++			    BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT);
++	fifo_count &= BIG_SUR_GE_COUNT_MASK;
++
++	if ((fifo_count * BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT) < len)
++		return -1;
++
++	word_count = len / BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT;
++	extra_byte = len % BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT;
++
++	for (fifo_count = 0; fifo_count < word_count; fifo_count++)
++		buffer_data[fifo_count] =
++		    BIG_SUR_GE_READ(fifo->reg_base_addr);
++
++	if (extra_byte > 0) {
++		unsigned long last_word;
++		int *extra_buffer_data =
++		    (int *) (buffer_data + word_count);
++
++		last_word = BIG_SUR_GE_READ(fifo->data_base_address);
++		if (extra_byte == 1)
++			extra_buffer_data[0] = (int) (last_word << 24);
++		else if (extra_byte == 2) {
++			extra_buffer_data[0] = (int) (last_word << 24);
++			extra_buffer_data[1] = (int) (last_word << 16);
++		} else if (extra_byte == 3) {
++			extra_buffer_data[0] = (int) (last_word << 24);
++			extra_buffer_data[1] = (int) (last_word << 16);
++			extra_buffer_data[2] = (int) (last_word << 8);
++		}
++	}
++
++	return 0;
++}
++
++/*****************************************************************************
++ * Write the data into the packet fifo
++ *****************************************************************************/
++static int packet_fifo_write(packet_fifo * fifo, int *buffer, int len)
++{
++	unsigned long fifo_count, word_count, extra_byte;
++	unsigned long *buffer_data = (unsigned long *) buffer;
++
++	fifo_count =
++	    BIG_SUR_GE_READ(fifo->reg_base_addr +
++			    BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT);
++	fifo_count &= BIG_SUR_GE_COUNT_MASK;
++
++	word_count = len / BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT;
++	extra_byte = len % BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT;
++
++	/* You should see what the ppc driver does here. It just slobbers */
++	if (extra_byte > 0)
++		if (fifo_count > (word_count + 1)) {
++			printk(KERN_ERR
++			       "No room in the packet send fifo \n");
++			return -1;
++		}
++
++	for (fifo_count = 0; fifo_count < word_count; fifo_count++)
++		BIG_SUR_GE_WRITE(fifo->data_base_address,
++				 buffer_data[fifo_count]);
++
++
++	if (extra_byte > 0) {
++		unsigned long last_word = 0;
++		int *extra_buffer_data =
++		    (int *) (buffer_data + word_count);
++
++		if (extra_byte == 1)
++			last_word = extra_buffer_data[0] << 24;
++		else if (extra_byte == 2)
++			last_word = (extra_buffer_data[0] << 24 |
++				     extra_buffer_data[1] << 16);
++
++		else if (extra_byte == 3)
++			last_word = (extra_buffer_data[0] << 24 |
++				     extra_buffer_data[1] << 16 |
++				     extra_buffer_data[2] << 8);
++
++
++		BIG_SUR_GE_WRITE(fifo->data_base_address, last_word);
++	}
++
++	return 0;
++}
++
++
++/*****************************************************************************
++ * Interrupt handlers: We handle any errors associated with the FIFO.
++ * FIFO is for simple dma case and we do want to handle the simple DMA
++ * case. We dont handle the Scatter Gather DMA for now since it is not working.
++ ******************************************************************************/
++
++/*********************************************************************************
++ * FIFO send for Simple DMA with Interrupts
++ **********************************************************************************/
++static int big_sur_ge_enet_fifo_send(big_sur_ge * emac, u8 * buffer,
++			      unsigned long byte_cnt)
++{
++	unsigned long int_status, reg_data;
++
++	/* Silly checks here that we really dont need */
++	if (!emac->started)
++		return -1;
++
++	if (emac->polled)
++		return -1;
++
++	if (emac->dma_sg)
++		return -1;
++
++	int_status =
++	    BIG_SUR_GE_READ(emac->base_address + XIIF_V123B_IISR_OFFSET);
++	if (int_status & BIG_SUR_GE_EIR_XMIT_LFIFO_FULL_MASK) {
++		printk(KERN_ERR "Tx FIFO error: Queue is Full \n");
++		return -1;
++	}
++
++	/*
++	 * Write the data to the FIFO in the hardware
++	 */
++	if ((BIG_SUR_GE_GET_COUNT(&emac->send_fifo) *
++	     sizeof(unsigned long)) < byte_cnt) {
++		printk(KERN_ERR "Send FIFO on chip is full \n");
++		return -1;
++	}
++
++	if (big_sur_ge_dma_status(&emac->send_channel) &
++	    BIG_SUR_GE_DMASR_BUSY_MASK) {
++		printk(KERN_ERR "Send channel FIFO engine busy \n");
++		return -1;
++	}
++
++	big_sur_ge_set_dma_control(&emac->send_channel,
++				   BIG_SUR_GE_DMACR_SOURCE_INCR_MASK |
++				   BIG_SUR_GE_DMACR_DEST_LOCAL_MASK |
++				   BIG_SUR_GE_DMACR_SG_DISABLE_MASK);
++
++	big_sur_ge_dma_transfer(&emac->send_channel,
++				(unsigned long *) buffer,
++				(unsigned long *) (emac->base_address +
++						   BIG_SUR_GE_PFIFO_TXDATA_OFFSET),
++				byte_cnt);
++
++	reg_data = big_sur_ge_dma_status(&emac->send_channel);
++	while (reg_data & BIG_SUR_GE_DMASR_BUSY_MASK) {
++		reg_data = big_sur_ge_dma_status(&emac->recv_channel);
++		if (!(reg_data & BIG_SUR_GE_DMASR_BUSY_MASK))
++			break;
++	}
++
++	if ((reg_data & BIG_SUR_GE_DMASR_BUS_ERROR_MASK) ||
++	    (reg_data & BIG_SUR_GE_DMASR_BUS_TIMEOUT_MASK)) {
++		printk(KERN_ERR "Send side DMA error \n");
++		return -1;
++	}
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_TPLR_OFFSET,
++			 byte_cnt);
++
++	return 0;
++}
++
++/*************************************************************************
++ * FIFO receive for Simple DMA case
++ *************************************************************************/
++static int big_sur_ge_enet_fifo_recv(big_sur_ge * emac, u8 * buffer,
++			      unsigned long *byte_cnt)
++{
++	unsigned long int_status, reg_data;
++
++	/* Silly checks here that we really dont need */
++	if (!emac->started)
++		return -1;
++
++	if (emac->polled)
++		return -1;
++
++	if (emac->dma_sg)
++		return -1;
++
++	if (*byte_cnt < BIG_SUR_GE_MAX_FRAME_SIZE)
++		return -1;
++
++	int_status =
++	    BIG_SUR_GE_READ(emac->base_address + XIIF_V123B_IISR_OFFSET);
++	if (int_status & BIG_SUR_GE_EIR_RECV_LFIFO_EMPTY_MASK) {
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_IISR_OFFSET,
++				 BIG_SUR_GE_EIR_RECV_LFIFO_EMPTY_MASK);
++		return -1;
++	}
++
++	if (big_sur_ge_dma_status(&emac->recv_channel) &
++	    BIG_SUR_GE_DMASR_BUSY_MASK) {
++		printk(KERN_ERR "Rx side DMA Engine busy \n");
++		return -1;
++	}
++
++	if (BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_RPLR_OFFSET) ==
++	    0) {
++		printk(KERN_ERR "MAC has the FIFO packet length 0 \n");
++		return -1;
++	}
++
++	/* For the simple DMA case only */
++	big_sur_ge_set_dma_control(&emac->recv_channel,
++				   BIG_SUR_GE_DMACR_DEST_INCR_MASK |
++				   BIG_SUR_GE_DMACR_SOURCE_LOCAL_MASK |
++				   BIG_SUR_GE_DMACR_SG_DISABLE_MASK);
++
++	if (packet_fifo_read(&emac->recv_fifo, buffer,
++			     BIG_SUR_GE_READ(emac->base_address +
++					     BIG_SUR_GE_RPLR_OFFSET)) ==
++	    -1) {
++		printk(KERN_ERR "Not enough space in the FIFO \n");
++		return -1;
++	}
++
++	big_sur_ge_dma_transfer(&emac->recv_channel,
++				(unsigned long *) (emac->base_address +
++						   BIG_SUR_GE_PFIFO_RXDATA_OFFSET),
++				(unsigned long *)
++				buffer,
++				BIG_SUR_GE_READ(emac->base_address +
++						BIG_SUR_GE_RPLR_OFFSET));
++
++	reg_data = big_sur_ge_dma_status(&emac->recv_channel);
++	while (reg_data & BIG_SUR_GE_DMASR_BUSY_MASK) {
++		reg_data = big_sur_ge_dma_status(&emac->recv_channel);
++		if (!(reg_data & BIG_SUR_GE_DMASR_BUSY_MASK))
++			break;
++	}
++
++	if ((reg_data & BIG_SUR_GE_DMASR_BUS_ERROR_MASK) ||
++	    (reg_data & BIG_SUR_GE_DMASR_BUS_TIMEOUT_MASK)) {
++		printk(KERN_ERR "DMA Bus Error \n");
++		return -1;
++	}
++
++	*byte_cnt =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_RPLR_OFFSET);
++
++	return 0;
++}
++
++static irqreturn_t big_sur_ge_int_handler(int irq, void *dev_id,
++				   struct pt_regs *regs)
++{
++	struct net_device *netdev = dev_id;
++	struct big_sur_ge_enet *lp = netdev->priv;
++	big_sur_ge *emac = (big_sur_ge *)emac_ptr;
++	void *emac_ptr = &lp->emac;
++	unsigned long int_status;
++
++	int_status =
++	    BIG_SUR_GE_READ(emac->base_address + XIIF_V123B_DIPR_OFFSET);
++	if (int_status & BIG_SUR_GE_IPIF_EMAC_MASK)
++		handle_fifo_intr(emac);
++
++	if (int_status & BIG_SUR_GE_IPIF_RECV_FIFO_MASK)
++		big_sur_ge_check_fifo_recv_error(emac);
++
++	if (int_status & BIG_SUR_GE_IPIF_SEND_FIFO_MASK)
++		big_sur_ge_check_fifo_send_error(emac);
++
++	if (int_status & XIIF_V123B_ERROR_MASK)
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_DISR_OFFSET,
++				 XIIF_V123B_ERROR_MASK);
++
++	return IRQ_HANDLED;
++}
++
++/****************************************************************************
++ * Set the FIFO send handler
++ ***************************************************************************/
++static void big_sur_ge_set_fifo_send_handler(big_sur_ge * emac, void *call_back,
++				      big_sur_fifo_handler function)
++{
++	emac->big_sur_ge_fifo_send_handler = function;
++	emac->fifo_send_ref = call_back;
++}
++
++/****************************************************************************
++ * Set the FIFO recv handler
++ ***************************************************************************/
++static void big_sur_ge_set_fifo_recv_handler(big_sur_ge * emac, void *call_back,
++				      big_sur_fifo_handler function)
++{
++	emac->big_sur_ge_fifo_recv_handler = function;
++	emac->fifo_recv_ref = call_back;
++}
++
++/****************************************************************************
++ * Main Fifo intr handler
++ ***************************************************************************/
++static void handle_fifo_intr(big_sur_ge * emac)
++{
++	unsigned long int_status;
++
++	/* Ack the interrupts asap */
++	int_status =
++	    BIG_SUR_GE_READ(emac->base_address + XIIF_V123B_IISR_OFFSET);
++	BIG_SUR_GE_WRITE(emac->base_address + XIIF_V123B_IISR_OFFSET,
++			 int_status);
++
++	/* Process the Rx side */
++	if (int_status & BIG_SUR_GE_EIR_RECV_DONE_MASK) {
++		emac->big_sur_ge_fifo_recv_handler(&emac->fifo_recv_ref);
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_IISR_OFFSET,
++				 BIG_SUR_GE_EIR_RECV_DONE_MASK);
++	}
++
++	if (int_status & BIG_SUR_GE_EIR_XMIT_DONE_MASK) {
++		/* We dont collect stats and hence we dont need to get status */
++
++		emac->big_sur_ge_fifo_send_handler(emac->fifo_recv_ref);
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_IISR_OFFSET,
++				 BIG_SUR_GE_EIR_XMIT_DONE_MASK);
++	}
++
++	big_sur_ge_check_mac_error(emac, int_status);
++}
++
++/******************************************************************
++ * Handle the Receive side DMA interrupts. The PPC driver has
++ * callbacks all over the place. This has been eliminated here by
++ * using the following approach:
++ *
++ * The ISR is set to the main interrrupt handler. This will handle
++ * all the interrupts including the ones for DMA. In this main isr,
++ * we determine if we need to call recv or send side intr functions.
++ * Pretty complex but thats the way it is now.
++ *******************************************************************/
++static void big_sur_ge_handle_recv_intr(big_sur_ge * emac)
++{
++	unsigned long int_status;
++
++	int_status = big_sur_ge_get_intr_status(&emac->recv_channel);
++	if (int_status & (BIG_SUR_GE_IXR_PKT_THRESHOLD_MASK |
++			  BIG_SUR_GE_IXR_PKT_WAIT_BOUND_MASK)) {
++		u32 num_packets;
++		u32 num_processed;
++		u32 num_buffers;
++		u32 num_bytes;
++		xbuf_descriptor *first_desc_ptr = NULL;
++		xbuf_descriptor *buffer_desc;
++		int is_last = 0;
++
++		/* The number of packets we need to process on the Rx */
++		num_packets =
++		    big_sur_ge_get_packet_count(&emac->recv_channel);
++
++		for (num_processed = 0; num_processed < num_packets;
++		     num_processed++) {
++			while (!is_last) {
++				if (big_sur_ge_get_descriptor
++				    (&emac->recv_channel,
++				     &buffer_desc) == -1)
++					break;
++
++				if (first_desc_ptr == NULL)
++					first_desc_ptr = buffer_desc;
++
++				num_bytes +=
++				    xbuf_descriptor_GetLength(buffer_desc);
++
++				if (xbuf_descriptor_IsLastStatus
++				    (buffer_desc)) {
++					is_last = 1;
++				}
++
++				num_buffers++;
++			}
++
++			/* Number of buffers is always 1 since we dont do SG */
++
++			/*
++			 * Only for SG DMA which is currently not supported. In the
++			 * future, as we have SG channel working, we will code this
++			 * receive side routine. For now, do nothing. This is never
++			 * called from FIFO mode - Manish
++			 */
++			big_sur_ge_decr_packet_count(&emac->recv_channel);
++		}
++	}
++
++	/* Ack the interrupts */
++	big_sur_ge_set_intr_status(&emac->recv_channel, int_status);
++
++	if (int_status & BIG_SUR_GE_IXR_DMA_ERROR_MASK) {
++		/* We need a reset here */
++	}
++
++	big_sur_ge_set_intr_status(&emac->recv_channel, int_status);
++}
++
++/****************************************************************
++ * Handle the send side DMA interrupt
++ ****************************************************************/
++static void big_sur_ge_handle_send_intr(big_sur_ge * emac)
++{
++	unsigned long int_status;
++
++	int_status = big_sur_ge_get_intr_status(&emac->send_channel);
++
++	if (int_status & (BIG_SUR_GE_IXR_PKT_THRESHOLD_MASK |
++			  BIG_SUR_GE_IXR_PKT_WAIT_BOUND_MASK)) {
++		unsigned long num_frames = 0;
++		unsigned long num_processed = 0;
++		unsigned long num_buffers = 0;
++		unsigned long num_bytes = 0;
++		unsigned long is_last = 0;
++		xbuf_descriptor *first_desc_ptr = NULL;
++		xbuf_descriptor *buffer_desc;
++
++		num_frames =
++		    big_sur_ge_get_packet_count(&emac->send_channel);
++
++		for (num_processed = 0; num_processed < num_frames;
++		     num_processed++) {
++			while (!is_last) {
++				if (big_sur_ge_get_descriptor
++				    (&emac->send_channel, &buffer_desc)
++				    == -1) {
++					break;
++				}
++
++				if (first_desc_ptr == NULL)
++					first_desc_ptr = buffer_desc;
++
++				num_bytes +=
++				    xbuf_descriptor_GetLength(buffer_desc);
++				if (xbuf_descriptor_IsLastControl
++				    (buffer_desc))
++					is_last = 1;
++
++				num_buffers++;
++			}
++
++			/*
++			 * Only for SG DMA which is currently not supported. In the
++			 * future, as we have SG channel working, we will code this
++			 * receive side routine. For now, do nothing. This is never
++			 * called from FIFO mode - Manish
++			 */
++			big_sur_ge_decr_packet_count(&emac->send_channel);
++		}
++	}
++
++	/* Ack the interrupts and reset DMA channel if necessary */
++	big_sur_ge_set_intr_status(&emac->send_channel, int_status);
++	if (int_status & BIG_SUR_GE_IXR_DMA_ERROR_MASK) {
++		/* Manish : need reset */
++	}
++
++	big_sur_ge_set_intr_status(&emac->send_channel, int_status);
++}
++
++/*****************************************************************
++ * For now, the MAC address errors dont trigger a update of the
++ * stats. There is no stats framework in place. Hence, we just
++ * check for the errors below and do a reset if needed.
++ *****************************************************************/
++static void big_sur_ge_check_mac_error(big_sur_ge * emac,
++				unsigned long int_status)
++{
++	if (int_status & (BIG_SUR_GE_EIR_RECV_DFIFO_OVER_MASK |
++			  BIG_SUR_GE_EIR_RECV_LFIFO_OVER_MASK |
++			  BIG_SUR_GE_EIR_RECV_LFIFO_UNDER_MASK |
++			  BIG_SUR_GE_EIR_RECV_ERROR_MASK |
++			  BIG_SUR_GE_EIR_RECV_MISSED_FRAME_MASK |
++			  BIG_SUR_GE_EIR_RECV_COLLISION_MASK |
++			  BIG_SUR_GE_EIR_RECV_FCS_ERROR_MASK |
++			  BIG_SUR_GE_EIR_RECV_LEN_ERROR_MASK |
++			  BIG_SUR_GE_EIR_RECV_SHORT_ERROR_MASK |
++			  BIG_SUR_GE_EIR_RECV_LONG_ERROR_MASK |
++			  BIG_SUR_GE_EIR_RECV_ALIGN_ERROR_MASK |
++			  BIG_SUR_GE_EIR_XMIT_SFIFO_OVER_MASK |
++			  BIG_SUR_GE_EIR_XMIT_LFIFO_OVER_MASK |
++			  BIG_SUR_GE_EIR_XMIT_SFIFO_UNDER_MASK |
++			  BIG_SUR_GE_EIR_XMIT_LFIFO_UNDER_MASK)) {
++
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_IIER_OFFSET, 0);
++		/*
++		 * Manish Reset the MAC here
++		 */
++	}
++}
++
++/*****************************************************************
++ * Check for FIFO Recv errors
++ *****************************************************************/
++static void big_sur_ge_check_fifo_recv_error(big_sur_ge * emac)
++{
++	if (BIG_SUR_GE_IS_DEADLOCKED(&emac->recv_fifo)) {
++		unsigned long intr_enable;
++
++		intr_enable =
++		    BIG_SUR_GE_READ(emac->base_address +
++				    XIIF_V123B_DIER_OFFSET);
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_DIER_OFFSET,
++				 intr_enable &
++				 ~(BIG_SUR_GE_IPIF_RECV_FIFO_MASK));
++
++	}
++}
++
++/*****************************************************************
++ * Check for FIFO Send errors
++ *****************************************************************/
++static void big_sur_ge_check_fifo_send_error(big_sur_ge * emac)
++{
++	if (BIG_SUR_GE_IS_DEADLOCKED(&emac->send_fifo)) {
++		unsigned long intr_enable;
++
++		intr_enable =
++		    BIG_SUR_GE_READ(emac->base_address +
++				    XIIF_V123B_DIER_OFFSET);
++		BIG_SUR_GE_WRITE(emac->base_address +
++				 XIIF_V123B_DIER_OFFSET,
++				 intr_enable &
++				 ~(BIG_SUR_GE_IPIF_SEND_FIFO_MASK));
++	}
++}
++
++/*****************************************************************
++ * GE unit init
++ ****************************************************************/
++static int big_sur_ge_enet_init(big_sur_ge * emac, unsigned int device_id)
++{
++	unsigned long reg_data;
++	big_sur_ge_config *config;
++	int err;
++
++	/* Assume that the device has been stopped */
++
++	config = big_sur_ge_lookup_config(device_id);
++	if (config == NULL)
++		return -1;
++
++	emac->ready = 0;
++	emac->started = 0;
++	emac->dma_sg = 0;	/* This MAC has no support for Scatter Gather DMA */
++	emac->has_mii = config->has_mii;
++	emac->has_mcast_hash_table = 0;
++	emac->dma_config = config->dma_config;
++
++	/*
++	 * Initialize the FIFO send and recv handlers to the stub handlers.
++	 * We only deal with the FIFO mode of operation since SG is not supported.
++	 * Also, there is no error handler. We try to handle as much of error as
++	 * possible and then return. No error codes also.
++	 */
++
++	emac->base_address = config->base_address;
++
++	if (big_sur_ge_config_dma(emac) == -1)
++		return -1;
++
++	err = big_sur_ge_config_fifo(emac);
++	if (err == -1)
++		return err;
++
++	/* Now, we know that the FIFO initialized successfully. So, set the ready flag */
++	emac->ready = 1;
++
++	/* Do we need a PHY reset here also. It did cause problems on some boards */
++	big_sur_ge_enet_reset(emac);
++
++	/* PHY reset code. Remove if causes a problem on the board */
++	reg_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_ECR_OFFSET);
++	reg_data &= ~(BIG_SUR_GE_ECR_PHY_ENABLE_MASK);
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_ECR_OFFSET,
++			 reg_data);
++	reg_data |= BIG_SUR_GE_ECR_PHY_ENABLE_MASK;
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_ECR_OFFSET,
++			 reg_data);
++
++	return 0;
++}
++
++/*******************************************************************
++ * Start the GE unit for Tx, Rx and Interrupts
++ *******************************************************************/
++static int big_sur_ge_start(big_sur_ge * emac)
++{
++	unsigned long reg_data;
++
++	/*
++	 * Basic mode of operation is polled and interrupt mode. We disable the polled
++	 * mode for good. We may use the polled mode for Rx NAPI but that does not
++	 * require all the interrupts to be disabled
++	 */
++
++	emac->polled = 0;
++
++	/*
++	 * DMA: Three modes of operation - simple, FIFO, SG. SG is surely not working
++	 * and so is kept off using the dma_sg flag. Simple and FIFO work. But, we may
++	 * not use FIFO at all. So, we enable the interrupts below
++	 */
++
++	BIG_SUR_GE_WRITE(emac->base_address + XIIF_V123B_DIER_OFFSET,
++			 BIG_SUR_GE_IPIF_FIFO_DFT_MASK |
++			 XIIF_V123B_ERROR_MASK);
++
++	BIG_SUR_GE_WRITE(emac->base_address + XIIF_V123B_IIER_OFFSET,
++			 BIG_SUR_GE_EIR_DFT_FIFO_MASK);
++
++	/* Toggle the started flag */
++	emac->started = 1;
++
++	/* Start the Tx and Rx units respectively */
++	reg_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_ECR_OFFSET);
++	reg_data &=
++	    ~(BIG_SUR_GE_ECR_XMIT_RESET_MASK |
++	      BIG_SUR_GE_ECR_RECV_RESET_MASK);
++	reg_data |=
++	    (BIG_SUR_GE_ECR_XMIT_ENABLE_MASK |
++	     BIG_SUR_GE_ECR_RECV_ENABLE_MASK);
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_ECR_OFFSET,
++			 reg_data);
++
++	return 0;
++}
++
++/**************************************************************************
++ * Stop the GE unit
++ **************************************************************************/
++static int big_sur_ge_stop(big_sur_ge * emac)
++{
++	unsigned long reg_data;
++
++	/* We assume that the device is not already stopped */
++	if (!emac->started)
++		return 0;
++
++	/* Disable the Tx and Rx unit respectively */
++	reg_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_ECR_OFFSET);
++	reg_data &=
++	    ~(BIG_SUR_GE_ECR_XMIT_ENABLE_MASK |
++	      BIG_SUR_GE_ECR_RECV_ENABLE_MASK);
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_ECR_OFFSET,
++			 reg_data);
++
++	/* Disable the interrupts */
++	BIG_SUR_GE_WRITE(emac->base_address + XIIF_V123B_DGIER_OFFSET, 0);
++
++	/* Toggle the started flag */
++	emac->started = 0;
++
++	return 0;
++}
++
++/************************************************************************
++ * Reset the GE MAC unit
++ *************************************************************************/
++static void big_sur_ge_enet_reset(big_sur_ge * emac)
++{
++	unsigned long reg_data;
++
++	(void) big_sur_ge_stop(emac);
++
++	BIG_SUR_GE_WRITE(emac->base_address + XIIF_V123B_RESETR_OFFSET,
++			 XIIF_V123B_RESET_MASK);
++
++	/*
++	 * For now, configure the receiver to not strip off FCS and padding since
++	 * this is not currently supported. In the future, just take the default
++	 * and provide the option for the user to change this behavior.
++	 */
++	reg_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_ECR_OFFSET);
++	reg_data &=
++	    ~(BIG_SUR_GE_ECR_RECV_PAD_ENABLE_MASK |
++	      BIG_SUR_GE_ECR_RECV_FCS_ENABLE_MASK);
++	reg_data &= ~(BIG_SUR_GE_ECR_RECV_STRIP_ENABLE_MASK);
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_ECR_OFFSET,
++			 reg_data);
++}
++
++/*************************************************************************
++ * Set the MAC address of the GE mac unit
++ *************************************************************************/
++static int big_sur_ge_set_mac_address(big_sur_ge * emac, unsigned char *addr)
++{
++	unsigned long mac_addr = 0;
++
++	/* Device is started and so mac address must be set */
++	if (emac->started == 1)
++		return 0;
++
++	mac_addr = ((addr[0] << 8) | addr[1]);
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_SAH_OFFSET,
++			 mac_addr);
++
++	mac_addr |= ((addr[2] << 24) | (addr[3] << 16) |
++		     (addr[4] << 8) | addr[5]);
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_SAL_OFFSET,
++			 mac_addr);
++
++	return 0;
++}
++
++/****************************************************************************
++ * Get the MAC address of the GE MAC unit
++ ***************************************************************************/
++static void big_sur_ge_get_mac_unit(big_sur_ge * emac, unsigned int *addr)
++{
++	unsigned long mac_addr_hi, mac_addr_lo;
++
++	mac_addr_hi =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_SAH_OFFSET);
++	mac_addr_lo =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_SAL_OFFSET);
++
++	addr[0] = (mac_addr_hi >> 8);
++	addr[1] = mac_addr_hi;
++
++	addr[2] = (mac_addr_lo >> 24);
++	addr[3] = (mac_addr_lo >> 16);
++	addr[4] = (mac_addr_lo >> 8);
++	addr[5] = mac_addr_lo;
++}
++
++/*********************************************************************************
++ * Configure the GE MAC for DMA capabilities. Not for Scatter Gather, only Simple
++ *********************************************************************************/
++static int big_sur_ge_config_dma(big_sur_ge * emac)
++{
++	if (big_sur_ge_dma_init(&emac->recv_channel, emac->base_address +
++				BIG_SUR_GE_DMA_RECV_OFFSET) == -1) {
++		printk(KERN_ERR "Could not initialize the DMA unit  \n");
++		return -1;
++	}
++
++	if (big_sur_ge_dma_init(&emac->send_channel, emac->base_address +
++				BIG_SUR_GE_DMA_SEND_OFFSET) == -1) {
++		printk(KERN_ERR "Could not initialize the DMA unit  \n");
++		return -1;
++	}
++
++	return 0;
++}
++
++/******************************************************************************
++ * Configure the FIFO for simple DMA
++ ******************************************************************************/
++static int big_sur_ge_config_fifo(big_sur_ge * emac)
++{
++	int err = 0;
++
++	err = packet_fifo_init(&emac->recv_fifo, emac->base_address +
++			       BIG_SUR_GE_PFIFO_RXREG_OFFSET,
++			       emac->base_address +
++			       BIG_SUR_GE_PFIFO_RXDATA_OFFSET);
++
++	if (err == -1) {
++		printk(KERN_ERR
++		       "Could not initialize Rx packet FIFO for Simple DMA \n");
++		return err;
++	}
++
++	err = packet_fifo_init(&emac->send_fifo, emac->base_address +
++			       BIG_SUR_GE_PFIFO_TXREG_OFFSET,
++			       emac->base_address +
++			       BIG_SUR_GE_PFIFO_TXDATA_OFFSET);
++
++	if (err == -1) {
++		printk(KERN_ERR
++		       "Could not initialize Tx packet FIFO for Simple DMA \n");
++	}
++
++	return err;
++}
++
++#define BIG_SUR_GE_NUM_INSTANCES	2
++
++
++/**********************************************************************************
++ * Look up the config of the MAC
++ **********************************************************************************/
++static big_sur_ge_config *big_sur_ge_lookup_config(unsigned int device_id)
++{
++	big_sur_ge_config *config = NULL;
++	int i = 0;
++
++	for (i = 0; i < BIG_SUR_GE_NUM_INSTANCES; i++) {
++		/* Manish : Init the config here */
++		break;
++	}
++
++	return config;
++}
++
++typedef struct {
++	unsigned long option;
++	unsigned long mask;
++} option_map;
++
++static option_map option_table[] = {
++	{BIG_SUR_GE_UNICAST_OPTION, BIG_SUR_GE_ECR_UNICAST_ENABLE_MASK},
++	{BIG_SUR_GE_BROADCAST_OPTION, BIG_SUR_GE_ECR_BROAD_ENABLE_MASK},
++	{BIG_SUR_GE_PROMISC_OPTION, BIG_SUR_GE_ECR_PROMISC_ENABLE_MASK},
++	{BIG_SUR_GE_FDUPLEX_OPTION, BIG_SUR_GE_ECR_FULL_DUPLEX_MASK},
++	{BIG_SUR_GE_LOOPBACK_OPTION, BIG_SUR_GE_ECR_LOOPBACK_MASK},
++	{BIG_SUR_GE_MULTICAST_OPTION, BIG_SUR_GE_ECR_MULTI_ENABLE_MASK},
++	{BIG_SUR_GE_FLOW_CONTROL_OPTION, BIG_SUR_GE_ECR_PAUSE_FRAME_MASK},
++	{BIG_SUR_GE_INSERT_PAD_OPTION,
++	 BIG_SUR_GE_ECR_XMIT_PAD_ENABLE_MASK},
++	{BIG_SUR_GE_INSERT_FCS_OPTION,
++	 BIG_SUR_GE_ECR_XMIT_FCS_ENABLE_MASK},
++	{BIG_SUR_GE_INSERT_ADDR_OPTION,
++	 BIG_SUR_GE_ECR_XMIT_ADDR_INSERT_MASK},
++	{BIG_SUR_GE_OVWRT_ADDR_OPTION,
++	 BIG_SUR_GE_ECR_XMIT_ADDR_OVWRT_MASK},
++	{BIG_SUR_GE_STRIP_PAD_OPTION, BIG_SUR_GE_ECR_RECV_PAD_ENABLE_MASK},
++	{BIG_SUR_GE_STRIP_FCS_OPTION, BIG_SUR_GE_ECR_RECV_FCS_ENABLE_MASK},
++	{BIG_SUR_GE_STRIP_PAD_FCS_OPTION,
++	 BIG_SUR_GE_ECR_RECV_STRIP_ENABLE_MASK}
++};
++
++#define BIG_SUR_GE_NUM_OPTIONS		(sizeof(option_table) / sizeof(option_map))
++
++/**********************************************************************
++ * Set the options for the GE
++ **********************************************************************/
++static int big_sur_ge_set_options(big_sur_ge * emac, unsigned long option_flag)
++{
++	unsigned long reg_data;
++	unsigned int index;
++
++	/* Assume that the device is stopped before calling this function */
++
++	reg_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_ECR_OFFSET);
++	for (index = 0; index < BIG_SUR_GE_NUM_OPTIONS; index++) {
++		if (option_flag & option_table[index].option)
++			reg_data |= option_table[index].mask;
++		else
++			reg_data &= ~(option_table[index].mask);
++
++	}
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_ECR_OFFSET,
++			 reg_data);
++
++	/* No polled option */
++	emac->polled = 0;
++
++	return 0;
++}
++
++/*******************************************************
++ * Get the options from the GE
++ *******************************************************/
++static unsigned long big_sur_ge_get_options(big_sur_ge * emac)
++{
++	unsigned long option_flag = 0, reg_data;
++	unsigned int index;
++
++	reg_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_ECR_OFFSET);
++
++	for (index = 0; index < BIG_SUR_GE_NUM_OPTIONS; index++) {
++		if (option_flag & option_table[index].option)
++			reg_data |= option_table[index].mask;
++	}
++
++	/* No polled mode */
++
++	return option_flag;
++}
++
++/********************************************************
++ * Set the Inter frame gap
++ ********************************************************/
++static int big_sur_ge_set_frame_gap(big_sur_ge * emac, int part1, int part2)
++{
++	unsigned long config;
++
++	/* Assume that the device is stopped before calling this */
++
++	config = ((part1 << BIG_SUR_GE_IFGP_PART1_SHIFT) |
++		  (part2 << BIG_SUR_GE_IFGP_PART2_SHIFT));
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_IFGP_OFFSET,
++			 config);
++
++	return 0;
++}
++
++/********************************************************
++ * Get the Inter frame gap
++ ********************************************************/
++static void big_sur_ge_get_frame_gap(big_sur_ge * emac, int *part1, int *part2)
++{
++	unsigned long config;
++
++	config =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_IFGP_OFFSET);
++	*part1 =
++	    ((config & BIG_SUR_GE_IFGP_PART1_SHIFT) >>
++	     BIG_SUR_GE_IFGP_PART1_SHIFT);
++	*part2 =
++	    ((config & BIG_SUR_GE_IFGP_PART2_SHIFT) >>
++	     BIG_SUR_GE_IFGP_PART2_SHIFT);
++}
++
++/*******************************************************************
++ * PHY specific functions for the MAC
++ *******************************************************************/
++#define BIG_SUR_GE_MAX_PHY_ADDR		32
++#define BIG_SUR_GE_MAX_PHY_REG		32
++
++/*******************************************************************
++ * Read the PHY reg
++ *******************************************************************/
++static int big_sur_ge_phy_read(big_sur_ge * emac, unsigned long addr,
++			unsigned long reg_num, unsigned int *data)
++{
++	unsigned long mii_control, mii_data;
++
++	if (!emac->has_mii)
++		return -1;
++
++	mii_control =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_MGTCR_OFFSET);
++	if (mii_control & BIG_SUR_GE_MGTCR_START_MASK) {
++		printk(KERN_ERR "PHY busy \n");
++		return -1;
++	}
++
++	mii_control = (addr << BIG_SUR_GE_MGTCR_PHY_ADDR_SHIFT);
++	mii_control |= (reg_num << BIG_SUR_GE_MGTCR_REG_ADDR_SHIFT);
++	mii_control |=
++	    (BIG_SUR_GE_MGTCR_RW_NOT_MASK | BIG_SUR_GE_MGTCR_START_MASK |
++	     BIG_SUR_GE_MGTCR_MII_ENABLE_MASK);
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_MGTCR_OFFSET,
++			 mii_control);
++
++	while (mii_control & BIG_SUR_GE_MGTCR_START_MASK)
++		if (!(mii_control & BIG_SUR_GE_MGTCR_START_MASK))
++			break;
++
++	mii_data =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_MGTDR_OFFSET);
++	*data = (unsigned int) mii_data;
++
++	return 0;
++}
++
++/**********************************************************************
++ * Write to the PHY register
++ **********************************************************************/
++static int big_sur_ge_phy_write(big_sur_ge * emac, unsigned long addr,
++			 unsigned long reg_num, unsigned int data)
++{
++	unsigned long mii_control;
++
++	if (!emac->has_mii)
++		return -1;
++
++	mii_control =
++	    BIG_SUR_GE_READ(emac->base_address + BIG_SUR_GE_MGTCR_OFFSET);
++	if (mii_control & BIG_SUR_GE_MGTCR_START_MASK) {
++		printk(KERN_ERR "PHY busy \n");
++		return -1;
++	}
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_MGTDR_OFFSET,
++			 (unsigned long) data);
++
++	mii_control = (addr << BIG_SUR_GE_MGTCR_PHY_ADDR_SHIFT);
++	mii_control |= (reg_num << BIG_SUR_GE_MGTCR_REG_ADDR_SHIFT);
++	mii_control |=
++	    (BIG_SUR_GE_MGTCR_START_MASK |
++	     BIG_SUR_GE_MGTCR_MII_ENABLE_MASK);
++
++	BIG_SUR_GE_WRITE(emac->base_address + BIG_SUR_GE_MGTCR_OFFSET,
++			 mii_control);
++
++	while (mii_control & BIG_SUR_GE_MGTCR_START_MASK)
++		if (!(mii_control & BIG_SUR_GE_MGTCR_START_MASK))
++			break;
++
++	return 0;
++}
++
++
++
++
++
++
++/********************************************************************
++ * The hardware dependent part of the driver begins here
++ ********************************************************************/
++
++
++/*******************************************************************
++ * Reset the GE system
++ *******************************************************************/
++static void big_sur_ge_reset(struct net_device *netdev, DUPLEX duplex)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++	struct sk_buff *skb;
++	unsigned long options;
++	int ifcfg1, ifcfg2;
++
++	/* Stop the queue */
++	netif_stop_queue(netdev);
++
++	big_sur_ge_get_frame_gap(&lp->emac, &ifcfg1, &ifcfg2);
++	options = big_sur_ge_get_options(&lp->emac);
++	switch (duplex) {
++	case HALF_DUPLEX:
++		options &= ~(BIG_SUR_GE_FDUPLEX_OPTION);
++		break;
++
++	case FULL_DUPLEX:
++		options |= BIG_SUR_GE_FDUPLEX_OPTION;
++		break;
++
++	case UNKNOWN:
++		break;
++	}
++
++	/* There is no support for SG DMA in a 100 Mpbs NIC */
++
++	big_sur_ge_enet_reset(&lp->emac);
++
++	/* Set the necessary options for the MAC unit */
++	big_sur_ge_set_mac_address(&lp->emac, netdev->dev_addr);
++	big_sur_ge_set_frame_gap(&lp->emac, ifcfg1, ifcfg2);
++	big_sur_ge_set_options(&lp->emac, options);
++
++	(void) big_sur_ge_start(&lp->emac);
++
++	spin_lock_irq(&lp->lock);
++	skb = lp->saved_skb;
++	lp->saved_skb = NULL;
++	spin_unlock_irq(&lp->lock);
++
++	if (skb)
++		dev_kfree_skb(skb);
++
++	/* Wake the queue */
++	netif_wake_queue(netdev);
++}
++
++/********************************************************************
++ * Get the PHY status
++ *******************************************************************/
++static int big_sur_ge_get_phy_status(struct net_device *netdev,
++				     DUPLEX * duplex, int *linkup)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++	unsigned int reg_data;
++	int err = 0;
++
++	err =
++	    big_sur_ge_phy_read(&lp->emac, lp->mii_addr, MII_BMCR,
++				&reg_data);
++	if (err == -1) {
++		printk(KERN_ERR "%s: Could not read PHY control register",
++		       netdev->name);
++		return err;
++	}
++
++	if (!(reg_data & BMCR_ANENABLE)) {
++		if (reg_data & BMCR_FULLDPLX)
++			*duplex = FULL_DUPLEX;
++		else
++			*duplex = HALF_DUPLEX;
++	} else {
++		unsigned int advertise, partner, neg;
++
++		err =
++		    big_sur_ge_phy_read(&lp->emac, lp->mii_addr,
++					MII_ADVERTISE, &advertise);
++		if (err == -1) {
++			printk(KERN_ERR
++			       "%s: Could not read PHY control register",
++			       netdev->name);
++			return err;
++		}
++
++		err =
++		    big_sur_ge_phy_read(&lp->emac, lp->mii_addr, MII_LPA,
++					&partner);
++		if (err == -1) {
++			printk(KERN_ERR
++			       "%s: Could not read PHY control register",
++			       netdev->name);
++			return err;
++		}
++
++		neg = advertise & partner & ADVERTISE_ALL;
++		if (neg & ADVERTISE_100FULL)
++			*duplex = FULL_DUPLEX;
++		else if (neg & ADVERTISE_100HALF)
++			*duplex = HALF_DUPLEX;
++		else if (neg & ADVERTISE_10FULL)
++			*duplex = FULL_DUPLEX;
++		else
++			*duplex = HALF_DUPLEX;
++
++		err =
++		    big_sur_ge_phy_read(&lp->emac, lp->mii_addr, MII_BMSR,
++					&reg_data);
++		if (err == -1) {
++			printk(KERN_ERR
++			       "%s: Could not read PHY control register",
++			       netdev->name);
++			return err;
++		}
++
++		*linkup = (reg_data & BMSR_LSTATUS) != 0;
++
++	}
++	return 0;
++}
++
++/************************************************************
++ * Poll the MII for duplex and link status
++ ***********************************************************/
++static void big_sur_ge_poll_mii(unsigned long data)
++{
++	struct net_device *netdev = (struct net_device *) data;
++	struct big_sur_ge_enet *lp = netdev->priv;
++	unsigned long options;
++	DUPLEX mac_duplex, phy_duplex;
++	int phy_carrier, netif_carrier;
++
++	if (big_sur_ge_get_phy_status(netdev, &phy_duplex, &phy_carrier) ==
++	    -1) {
++		printk(KERN_ERR "%s: Terminating link monitoring.\n",
++		       netdev->name);
++		return;
++	}
++
++	options = big_sur_ge_get_options(&lp->emac);
++	if (options & BIG_SUR_GE_FDUPLEX_OPTION)
++		mac_duplex = FULL_DUPLEX;
++	else
++		mac_duplex = HALF_DUPLEX;
++
++	if (mac_duplex != phy_duplex) {
++		disable_irq(netdev->irq);
++		big_sur_ge_reset(netdev, phy_duplex);
++		enable_irq(netdev->irq);
++	}
++
++	netif_carrier = netif_carrier_ok(netdev) != 0;
++
++	if (phy_carrier != netif_carrier) {
++		if (phy_carrier) {
++			printk(KERN_INFO "%s: Link carrier restored.\n",
++			       netdev->name);
++			netif_carrier_on(netdev);
++		} else {
++			printk(KERN_INFO "%s: Link carrier lost.\n",
++			       netdev->name);
++			netif_carrier_off(netdev);
++		}
++	}
++
++	/* Set up the timer so we'll get called again in 2 seconds. */
++	lp->phy_timer.expires = jiffies + 2 * HZ;
++	add_timer(&lp->phy_timer);
++}
++
++/**************************************************************
++ * Open the network interface
++ *************************************************************/
++static int big_sur_ge_open(struct net_device *netdev)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++	unsigned long options;
++	DUPLEX phy_duplex, mac_duplex;
++	int phy_carrier, retval;
++
++	(void) big_sur_ge_stop(&lp->emac);
++
++	if (big_sur_ge_set_mac_address(&lp->emac, netdev->dev_addr) == -1) {
++		printk(KERN_ERR "%s: Could not set MAC address.\n",
++		       netdev->name);
++		return -EIO;
++	}
++
++	options = big_sur_ge_get_options(&lp->emac);
++
++	retval =
++	    request_irq(netdev->irq, &big_sur_ge_int_handler, 0,
++			netdev->name, netdev);
++	if (retval) {
++		printk(KERN_ERR
++		       "%s: Could not allocate interrupt %d.\n",
++		       netdev->name, netdev->irq);
++
++		return retval;
++	}
++
++	if (!
++	    (big_sur_ge_get_phy_status(netdev, &phy_duplex, &phy_carrier)))
++	{
++		if (options & BIG_SUR_GE_FDUPLEX_OPTION)
++			mac_duplex = FULL_DUPLEX;
++		else
++			mac_duplex = HALF_DUPLEX;
++
++		if (mac_duplex != phy_duplex) {
++			switch (phy_duplex) {
++			case HALF_DUPLEX:
++				options &= ~(BIG_SUR_GE_FDUPLEX_OPTION);
++				break;
++			case FULL_DUPLEX:
++				options |= BIG_SUR_GE_FDUPLEX_OPTION;
++				break;
++			case UNKNOWN:
++				break;
++			}
++
++			big_sur_ge_set_options(&lp->emac, options);
++		}
++	}
++
++	if (big_sur_ge_start(&lp->emac) == -1) {
++		printk(KERN_ERR "%s: Could not start device.\n",
++		       netdev->name);
++		free_irq(netdev->irq, netdev);
++		return -EBUSY;
++	}
++
++	netif_start_queue(netdev);
++
++	lp->phy_timer.expires = jiffies + 2 * HZ;
++	lp->phy_timer.data = (unsigned long) netdev;
++	lp->phy_timer.function = &big_sur_ge_poll_mii;
++	add_timer(&lp->phy_timer);
++
++	return 0;
++}
++
++/*********************************************************************
++ * Close the network device interface
++ *********************************************************************/
++static int big_sur_ge_close(struct net_device *netdev)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++
++	del_timer_sync(&lp->phy_timer);
++	netif_stop_queue(netdev);
++
++	free_irq(netdev->irq, netdev);
++
++	if (big_sur_ge_stop(&lp->emac) == -1) {
++		printk(KERN_ERR "%s: Could not stop device.\n",
++		       netdev->name);
++		return -EBUSY;
++	}
++
++	return 0;
++}
++
++/*********************************************************************
++ * Get the network device stats. For now, do nothing
++ *********************************************************************/
++static struct net_device_stats *big_sur_ge_get_stats(struct net_device
++						     *netdev)
++{
++	/* Do nothing */
++	return (struct net_device_stats *) 0;
++}
++
++/********************************************************************
++ * FIFO send for a packet that needs to be transmitted
++ ********************************************************************/
++static int big_sur_ge_fifo_send(struct sk_buff *orig_skb,
++				struct net_device *netdev)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++	struct sk_buff *new_skb;
++	unsigned int len, align;
++
++	netif_stop_queue(netdev);
++	len = orig_skb->len;
++
++	if (!(new_skb = dev_alloc_skb(len + 4))) {
++		dev_kfree_skb(orig_skb);
++		printk(KERN_ERR
++		       "%s: Could not allocate transmit buffer.\n",
++		       netdev->name);
++		netif_wake_queue(netdev);
++		return -EBUSY;
++	}
++
++	align = 4 - ((unsigned long) new_skb->data & 3);
++	if (align != 4)
++		skb_reserve(new_skb, align);
++
++	skb_put(new_skb, len);
++	memcpy(new_skb->data, orig_skb->data, len);
++
++	dev_kfree_skb(orig_skb);
++
++	lp->saved_skb = new_skb;
++	if (big_sur_ge_enet_fifo_send(&lp->emac, (u8 *) new_skb->data, len)
++	    == -1) {
++		spin_lock_irq(&lp->lock);
++		new_skb = lp->saved_skb;
++		lp->saved_skb = NULL;
++		spin_unlock_irq(&lp->lock);
++
++		dev_kfree_skb(new_skb);
++		printk(KERN_ERR "%s: Could not transmit buffer.\n",
++		       netdev->name);
++		netif_wake_queue(netdev);
++		return -EIO;
++	}
++	return 0;
++}
++
++/**********************************************************************
++ * Call the fifo send handler
++ **********************************************************************/
++static void big_sur_ge_fifo_send_handler(void *callback)
++{
++	struct net_device *netdev = (struct net_device *) callback;
++	struct big_sur_ge_enet *lp = netdev->priv;
++	struct sk_buff *skb;
++
++	spin_lock_irq(&lp->lock);
++	skb = lp->saved_skb;
++	lp->saved_skb = NULL;
++	spin_unlock_irq(&lp->lock);
++
++	if (skb)
++		dev_kfree_skb(skb);
++
++	netif_wake_queue(netdev);
++}
++
++/**********************************************************************
++ * Handle the timeout of the ethernet device
++ **********************************************************************/
++static void big_sur_ge_tx_timeout(struct net_device *netdev)
++{
++	printk
++	    ("%s: Exceeded transmit timeout of %lu ms.	Resetting mac.\n",
++	     netdev->name, TX_TIMEOUT * 1000UL / HZ);
++
++	disable_irq(netdev->irq);
++	big_sur_ge_reset(netdev, UNKNOWN);
++	enable_irq(netdev->irq);
++}
++
++/*********************************************************************
++ * When in FIFO mode, the callback function for packets received
++ *********************************************************************/
++static void big_sur_ge_fifo_recv_handler(void *callback)
++{
++	struct net_device *netdev = (struct net_device *) callback;
++	struct big_sur_ge_enet *lp = netdev->priv;
++	struct sk_buff *skb;
++	unsigned long len = BIG_SUR_GE_MAX_FRAME_SIZE;
++	unsigned int align;
++
++	if (!(skb = dev_alloc_skb(len + 4))) {
++		printk(KERN_ERR "%s: Could not allocate receive buffer.\n",
++		       netdev->name);
++		return;
++	}
++
++	align = 4 - ((unsigned long) skb->data & 3);
++	if (align != 4)
++		skb_reserve(skb, align);
++
++	if (big_sur_ge_enet_fifo_recv(&lp->emac, (u8 *) skb->data, &len) ==
++	    -1) {
++		dev_kfree_skb(skb);
++
++		printk(KERN_ERR "%s: Could not receive buffer \n",
++		       netdev->name);
++		netdev->tx_timeout = NULL;
++		big_sur_ge_reset(netdev, UNKNOWN);
++		netdev->tx_timeout = big_sur_ge_tx_timeout;
++	}
++
++	skb_put(skb, len);	/* Tell the skb how much data we got. */
++	skb->dev = netdev;	/* Fill out required meta-data. */
++	skb->protocol = eth_type_trans(skb, netdev);
++
++	netif_rx(skb);		/* Send the packet upstream. */
++}
++
++/*********************************************************************
++ * Set the Multicast Hash list
++ *********************************************************************/
++static void big_sur_ge_set_multicast_hash_list(struct net_device *netdev)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++	unsigned long options;
++
++	disable_irq(netdev->irq);
++	local_bh_disable();
++
++	(void) big_sur_ge_stop(&lp->emac);
++	options = big_sur_ge_get_options(&lp->emac);
++	options &=
++	    ~(BIG_SUR_GE_PROMISC_OPTION | BIG_SUR_GE_MULTICAST_OPTION);
++
++	/* Do nothing for now */
++
++	(void) big_sur_ge_start(&lp->emac);
++	local_bh_enable();
++	enable_irq(netdev->irq);
++}
++
++/***********************************************************************
++ * IOCTL support
++ ***********************************************************************/
++static int big_sur_ge_ioctl(struct net_device *netdev, struct ifreq *rq,
++			    int cmd)
++{
++	struct big_sur_ge_enet *lp = netdev->priv;
++	struct mii_ioctl_data *data =
++	    (struct mii_ioctl_data *) &rq->ifr_data;
++
++	switch (cmd) {
++	case SIOCGMIIPHY:	/* Get address of MII PHY in use. */
++	case SIOCDEVPRIVATE:	/* for binary compat, remove in 2.5 */
++		data->phy_id = lp->mii_addr;
++
++	case SIOCGMIIREG:	/* Read MII PHY register. */
++	case SIOCDEVPRIVATE + 1:	/* for binary compat, remove in 2.5 */
++		if (data->phy_id > 31 || data->reg_num > 31)
++			return -ENXIO;
++
++		del_timer_sync(&lp->phy_timer);
++
++		if (big_sur_ge_phy_read(&lp->emac, data->phy_id,
++					data->reg_num,
++					&data->val_out) == -1) {
++			printk(KERN_ERR "%s: Could not read from PHY",
++			       netdev->name);
++			return -EBUSY;
++		}
++
++		lp->phy_timer.expires = jiffies + 2 * HZ;
++		add_timer(&lp->phy_timer);
++
++		return 0;
++
++	case SIOCSMIIREG:	/* Write MII PHY register. */
++	case SIOCDEVPRIVATE + 2:	/* for binary compat, remove in 2.5 */
++		if (data->phy_id > 31 || data->reg_num > 31)
++			return -ENXIO;
++
++		del_timer_sync(&lp->phy_timer);
++
++		if (big_sur_ge_phy_write
++		    (&lp->emac, data->phy_id, data->reg_num,
++		     data->val_in) == -1) {
++			printk(KERN_ERR "%s: Could not write to PHY",
++			       netdev->name);
++			return -EBUSY;
++		}
++
++		lp->phy_timer.expires = jiffies + 2 * HZ;
++		add_timer(&lp->phy_timer);
++
++		return 0;
++
++	default:
++		return -EOPNOTSUPP;
++	}
++}
++
++/*****************************************************************
++ * Get the config from the config table
++ *****************************************************************/
++static big_sur_ge_config *big_sur_ge_get_config(int index)
++{
++	/* Manish */
++	return (big_sur_ge_config *) 0;
++}
++
++/*****************************************************************
++ * Release the network device structure
++ *****************************************************************/
++static void big_sur_ge_remove_head(void)
++{
++	struct net_device *netdev;
++	struct big_sur_ge_enet *lp;
++	big_sur_ge_config *config;
++
++	spin_lock(&dev_lock);
++	netdev = dev_list;
++	lp = netdev->priv;
++
++	spin_unlock(&dev_lock);
++
++	config = big_sur_ge_get_config(lp->index);
++	iounmap((void *) config->base_address);
++	config->base_address = lp->save_base_address;
++
++	if (lp->saved_skb)
++		dev_kfree_skb(lp->saved_skb);
++	kfree(lp);
++
++	unregister_netdev(netdev);
++	kfree(netdev);
++}
++
++/*****************************************************************
++ * Initial Function to probe the network interface
++ *****************************************************************/
++static int __init big_sur_ge_probe(int index)
++{
++	static const unsigned long remap_size =
++	    BIG_SUR_GE_EMAC_0_HIGHADDR - BIG_SUR_GE_EMAC_0_BASEADDR + 1;
++	struct net_device *netdev;
++	struct big_sur_ge_enet *lp;
++	big_sur_ge_config *config;
++	unsigned int irq;
++	unsigned long maddr;
++	goto err;
++
++	switch (index) {
++	case 0:
++		irq = (31 - BIG_SUR_GE_INTC_0_EMAC_0_VEC_ID);
++		break;
++	case 1:
++		irq = (31 - BIG_SUR_GE_INTC_1_EMAC_1_VEC_ID);
++		break;
++	case 2:
++		irq = (31 - BIG_SUR_GE_INTC_2_EMAC_2_VEC_ID);
++		break;
++	default:
++		err = -ENODEV;
++		goto out;
++	}
++
++	config = big_sur_ge_get_config(index);
++	if (!config) {
++		err = -ENODEV;
++		goto out;
++	}
++
++	netdev = alloc_etherdev(sizeof(big_sur_ge_config));
++
++	if (!netdev) {
++		err = -ENOMEM;
++		goto out;
++	}
++
++	SET_MODULE_OWNER(netdev);
++
++	netdev->irq = irq;
++
++	lp = (struct big_sur_ge_enet *) netdev->priv;
++	memset(lp, 0, sizeof(struct big_sur_ge_enet));
++	spin_lock_init(&lp->lock);
++	spin_lock(&dev_lock);
++	lp->next_dev = dev_list;
++	dev_list = netdev;
++	spin_unlock(&dev_lock);
++
++	lp->save_base_address = config->base_address;
++	config->base_address =
++	    (unsigned long) ioremap(lp->save_base_address, remap_size);
++	if (!config->base_address) {
++		err = -ENOMEM;
++		goto out_unlock;
++	}
++
++	if (big_sur_ge_enet_init(&lp->emac, config->device_id) == -1) {
++		printk(KERN_ERR "%s: Could not initialize device.\n",
++		       netdev->name);
++		err = -ENODEV;
++		goto out_unmap;
++	}
++
++	/* Manish: dev_addr value */
++	memcpy(netdev->dev_addr, big_sur_mac_addr_base, 6);
++	if (big_sur_ge_set_mac_address(&lp->emac, netdev->dev_addr) == -1) {
++		printk(KERN_ERR "%s: Could not set MAC address.\n",
++		       netdev->name);
++		err = -EIO;
++		goto out_unmap;
++	}
++
++	/*
++	 * There is no Scatter Gather support but there is a Simple DMA support
++	 */
++	big_sur_ge_set_fifo_recv_handler(&lp->emac, netdev,
++					 big_sur_ge_fifo_recv_handler);
++	big_sur_ge_set_fifo_send_handler(&lp->emac, netdev,
++					 big_sur_ge_fifo_send_handler);
++	netdev->hard_start_xmit = big_sur_ge_fifo_send;
++
++	lp->mii_addr = 0xFF;
++
++	for (maddr = 0; maddr < 31; maddr++) {
++		unsigned int reg_data;
++
++		if (big_sur_ge_phy_read
++		    (&lp->emac, maddr, MII_BMCR, &reg_data) == 0) {
++			lp->mii_addr = maddr;
++			break;
++		}
++	}
++
++	if (lp->mii_addr == 0xFF) {
++		lp->mii_addr = 0;
++		printk(KERN_WARNING
++		       "%s: No PHY detected.  Assuming a PHY at address %d.\n",
++		       netdev->name, lp->mii_addr);
++	}
++
++	netdev->open = big_sur_ge_open;
++	netdev->stop = big_sur_ge_close;
++	netdev->get_stats = big_sur_ge_get_stats;	/* Does nothing */
++	netdev->do_ioctl = big_sur_ge_ioctl;
++	netdev->tx_timeout = big_sur_ge_tx_timeout;
++	netdev->watchdog_timeo = TX_TIMEOUT;
++
++	err = register_netdev(netdev))
++	if (!err)
++		goto out_unmap;
++
++	printk(KERN_INFO "%s: PMC-Sierra Big Sur Ethernet Device %d  at 0x%08X "
++	       "mapped to 0x%08X, irq=%d\n", netdev->name, index,
++	       lp->save_base_address, config->base_address, netdev->irq);
++
++	return ret;
++
++out_unmap:
++	iounmap(config->base_address);
++
++out_unlock:
++	big_sur_ge_remove_head();
++
++out:
++	return ret;
++}
++
++static int __init big_sur_ge_init(void)
++{
++	int index = 0;
++
++	while (big_sur_ge_probe(index++) == 0);
++
++	return (index > 1) ? 0 : -ENODEV;
++}
++
++static void __exit big_sur_ge_cleanup(void)
++{
++	while (dev_list)
++		big_sur_ge_remove_head();
++}
++
++module_init(big_sur_ge_init);
++module_exit(big_sur_ge_cleanup);
++
++MODULE_AUTHOR("Manish Lachwani <lachwani@pmc-sierra.com>");
++MODULE_DESCRIPTION("PMC-Sierra Big Sur Ethernet MAC Driver");
++MODULE_LICENSE("GPL");
+diff -Naur linux-2.6.16.orig/drivers/net/big_sur_ge.h linux-2.6.16/drivers/net/big_sur_ge.h
+--- linux-2.6.16.orig/drivers/net/big_sur_ge.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/big_sur_ge.h	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,713 @@
++/*
++ * drivers/net/big_sur_ge.h - Driver for PMC-Sierra Big Sur
++ * ethernet ports
++ *
++ * Copyright (C) 2003 PMC-Sierra Inc.
++ * Author : Manish Lachwani (lachwani@pmc-sierra.com)
++ * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
++ *
++ * 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 Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
++ *
++ */
++
++#ifndef	__BIG_SUR_GE_H__
++#define	__BIG_SUR_GE_H__
++
++#include <linux/version.h>
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/spinlock.h>
++#include <linux/types.h>
++
++#define	BIG_SUR_DEVICE_NAME	"big sur"
++#define	BIG_SUR_DEVICE_DESC	"Big Sur Ethernet 10/100 MAC"
++
++#define BIG_SUR_GE_BASE			0xbb000000
++
++#define	BIG_SUR_GE_WRITE(ofs,data)	*(volatile u32 *)(BIG_SUR_GE_BASE+(ofs)) = data
++
++#define	BIG_SUR_GE_READ(ofs)		*(volatile u32 *)(BIG_SUR_GE_BASE+(ofs))
++
++/* Manish : Need to fix these defines later */
++#define	BIG_SUR_GE_EMAC_0_HIGHADDR
++#define	BIG_SUR_GE_EMAC_0_BASEADDR
++#define	BIG_SUR_GE_INTC_0_EMAC_0_VEC_ID		1
++#define	BIG_SUR_GE_INTC_1_EMAC_1_VEC_ID		2
++#define	BIG_SUR_GE_INTC_2_EMAC_2_VEC_ID		3
++#define	BIG_SUR_GE_EMAC_0_ERR_COUNT_EXIST
++#define	BIG_SUR_GE_EMAC_0_DMA_PRESENT
++#define	BIG_SUR_GE_EMAC_0_MII_EXIST
++#define	BIG_SUR_GE_OPB_ETHERNET_0_BASEADDR
++#define	BIG_SUR_GE_EMAC_0_DEVICE_ID
++#define	BIG_SUR_GE_OPB_ETHERNET_0_ERR_COUNT_EXIST
++#define	BIG_SUR_GE_OPB_ETHERNET_0_DMA_PRESENT
++#define	BIG_SUR_GE_OPB_ETHERNET_0_MII_EXIST
++#define	BIG_SUR_GE_OPB_ETHERNET_0_DEVICE_ID
++
++#define	BIG_SUR_GE_FIFO_WIDTH_BYTE_COUNT	4UL
++/* IPIF specific defines */
++#define XIIF_V123B_DISR_OFFSET     0UL  /* device interrupt status register */
++#define XIIF_V123B_DIPR_OFFSET     4UL  /* device interrupt pending register */
++#define XIIF_V123B_DIER_OFFSET     8UL  /* device interrupt enable register */
++#define XIIF_V123B_DIIR_OFFSET     24UL /* device interrupt ID register */
++#define XIIF_V123B_DGIER_OFFSET    28UL /* device global interrupt enable reg */
++#define XIIF_V123B_IISR_OFFSET     32UL /* IP interrupt status register */
++#define XIIF_V123B_IIER_OFFSET     40UL /* IP interrupt enable register */
++#define XIIF_V123B_RESETR_OFFSET   64UL /* reset register */
++#define XIIF_V123B_RESET_MASK             0xAUL
++#define	XIIF_V123B_ERROR_MASK		0x1UL
++
++/* defines */
++#define BIG_SUR_GE_UNICAST_OPTION        	0x00000001
++#define BIG_SUR_GE_BROADCAST_OPTION      	0x00000002
++#define BIG_SUR_GE_PROMISC_OPTION        	0x00000004
++#define BIG_SUR_GE_FDUPLEX_OPTION        	0x00000008
++#define BIG_SUR_GE_POLLED_OPTION         	0x00000010
++#define BIG_SUR_GE_LOOPBACK_OPTION       	0x00000020
++#define BIG_SUR_GE_FLOW_CONTROL_OPTION   	0x00000080
++#define BIG_SUR_GE_INSERT_PAD_OPTION     	0x00000100
++#define BIG_SUR_GE_INSERT_FCS_OPTION     	0x00000200
++#define BIG_SUR_GE_INSERT_ADDR_OPTION    	0x00000400
++#define BIG_SUR_GE_OVWRT_ADDR_OPTION     	0x00000800
++#define BIG_SUR_GE_STRIP_PAD_FCS_OPTION  	0x00002000
++
++/* Not Supported */
++#define BIG_SUR_GE_MULTICAST_OPTION      	0x00000040
++#define BIG_SUR_GE_FLOW_CONTROL_OPTION   	0x00000080
++#define BIG_SUR_GE_INSERT_PAD_OPTION     	0x00000100
++#define BIG_SUR_GE_INSERT_FCS_OPTION     	0x00000200
++#define BIG_SUR_GE_INSERT_ADDR_OPTION    	0x00000400
++#define BIG_SUR_GE_OVWRT_ADDR_OPTION     	0x00000800
++#define BIG_SUR_GE_STRIP_PAD_OPTION      	0x00001000
++#define BIG_SUR_GE_STRIP_FCS_OPTION     	0x00002000
++
++
++/* Defaults for Interrupt Coalescing in the SG DMA Engine */
++#define BIG_SUR_GE_SGDMA_DFT_THRESHOLD     1   /* Default pkt threshold */
++#define BIG_SUR_GE_SGDMA_MAX_THRESHOLD     255 /* Maximum pkt theshold */
++#define BIG_SUR_GE_SGDMA_DFT_WAITBOUND     5   /* Default pkt wait bound (msec) */
++#define BIG_SUR_GE_SGDMA_MAX_WAITBOUND     1023        /* Maximum pkt wait bound (msec) */
++
++/* Direction */
++#define BIG_SUR_GE_SEND    1
++#define BIG_SUR_GE_RECV    2
++
++/* SG DMA */
++#define BIG_SUR_GE_SGDMA_NODELAY     0 /* start SG DMA immediately */
++#define BIG_SUR_GE_SGDMA_DELAY       1 /* do not start SG DMA */
++
++#define BIG_SUR_GE_CFG_NO_IPIF             0   /* Not supported by the driver */
++#define BIG_SUR_GE_CFG_NO_DMA              1   /* No DMA */
++#define BIG_SUR_GE_CFG_SIMPLE_DMA          2   /* Simple DMA */
++#define BIG_SUR_GE_CFG_DMA_SG              3   /* DMA scatter gather */
++
++#define BIG_SUR_GE_MAC_ADDR_SIZE   6   /* six-byte MAC address */
++#define BIG_SUR_GE_MTU             1500        /* max size of Ethernet frame */
++#define BIG_SUR_GE_HDR_SIZE        14  /* size of Ethernet header */
++#define BIG_SUR_GE_HDR_VLAN_SIZE   18  /* size of Ethernet header with VLAN */
++#define BIG_SUR_GE_TRL_SIZE        4   /* size of Ethernet trailer (FCS) */
++#define BIG_SUR_GE_MAX_FRAME_SIZE  \
++		(BIG_SUR_GE_MTU + BIG_SUR_GE_HDR_SIZE + BIG_SUR_GE_TRL_SIZE)
++
++#define BIG_SUR_GE_MAX_VLAN_FRAME_SIZE  \
++		(BIG_SUR_GE_MTU + BIG_SUR_GE_HDR_VLAN_SIZE + BIG_SUR_GE_TRL_SIZE)
++
++/* Send and Receive buffers */
++#define BIG_SUR_GE_MIN_RECV_BUFS   32  /* minimum # of recv buffers */
++#define BIG_SUR_GE_DFT_RECV_BUFS   64  /* default # of recv buffers */
++
++#define BIG_SUR_GE_MIN_SEND_BUFS   16  /* minimum # of send buffers */
++#define BIG_SUR_GE_DFT_SEND_BUFS   32  /* default # of send buffers */
++
++#define BIG_SUR_GE_MIN_BUFFERS     (BIG_SUR_GE_MIN_RECV_BUFS + BIG_SUR_GE_MIN_SEND_BUFS)
++#define BIG_SUR_GE_DFT_BUFFERS     (BIG_SUR_GE_DFT_RECV_BUFS + BIG_SUR_GE_DFT_SEND_BUFS)
++
++/* Send and Receive Descriptors */
++#define BIG_SUR_GE_MIN_RECV_DESC   16  /* minimum # of recv descriptors */
++#define BIG_SUR_GE_DFT_RECV_DESC   32  /* default # of recv descriptors */
++
++#define BIG_SUR_GE_MIN_SEND_DESC   8   /* minimum # of send descriptors */
++#define BIG_SUR_GE_DFT_SEND_DESC   16  /* default # of send descriptors */
++
++/* FIFO Specific Defines */
++#define BIG_SUR_GE_READ_FIFO_TYPE      0       /* a read FIFO */
++#define BIG_SUR_GE_WRITE_FIFO_TYPE     1       /* a write FIFO */
++#define BIG_SUR_GE_RESET_REG_OFFSET            0UL
++#define BIG_SUR_GE_MODULE_INFO_REG_OFFSET      0UL
++#define BIG_SUR_GE_COUNT_STATUS_REG_OFFSET     4UL
++#define BIG_SUR_GE_RESET_FIFO_MASK             0x0000000A
++#define BIG_SUR_GE_COUNT_MASK                  0x0000FFFF
++#define BIG_SUR_GE_DEADLOCK_MASK               0x20000000
++#define BIG_SUR_GE_ALMOST_EMPTY_FULL_MASK      0x40000000
++#define BIG_SUR_GE_EMPTY_FULL_MASK             0x80000000
++
++#define BIG_SUR_GE_FIFO_RESET(fifo)	\
++	BIG_SUR_GE_WRITE((fifo)->reg_base_addr + BIG_SUR_GE_RESET_REG_OFFSET, BIG_SUR_GE_RESET_FIFO_MASK)
++
++#define	BIG_SUR_GE_GET_COUNT(fifo)	\
++	(BIG_SUR_GE_READ((fifo)->reg_base_addr + BIG_SUR_GE_COUNT_STATUS_REG_OFFSET) & 	\
++							BIG_SUR_GE_COUNT_MASK)
++
++#define	BIG_SUR_GE_IS_ALMOST_EMPTY(fifo)	\
++		(BIG_SUR_GE_READ(fifo->reg_base_addr + BIG_SUR_GE_COUNT_STATUS_REG_OFFSET) &	\
++							BIG_SUR_GE_ALMOST_EMPTY_FULL_MASK)
++
++#define	BIG_SUR_GE_IS_ALMOST_FULL(fifo)  \
++		(BIG_SUR_GE_READ(fifo->reg_base_addr + BIG_SUR_GE_COUNT_STATUS_REG_OFFSET) &   \
++							BIG_SUR_GE_ALMOST_EMPTY_FULL_MASK)
++
++#define BIG_SUR_GE_IS_EMPTY(fifo)  \
++		(BIG_SUR_GE_READ(fifo->reg_base_addr + BIG_SUR_GE_COUNT_STATUS_REG_OFFSET) &   \
++							BIG_SUR_GE_EMPTY_FULL_MASK)
++
++#define BIG_SUR_GE_IS_FULL(fifo)  \
++	(BIG_SUR_GE_READ(fifo->reg_base_addr + BIG_SUR_GE_COUNT_STATUS_REG_OFFSET) &   \
++							BIG_SUR_GE_EMPTY_FULL_MASK)
++
++#define	BIG_SUR_GE_IS_DEADLOCKED(fifo)	\
++	(BIG_SUR_GE_READ((fifo)->reg_base_addr + BIG_SUR_GE_COUNT_STATUS_REG_OFFSET) &   \
++							BIG_SUR_GE_DEADLOCK_MASK)
++
++/* Device Config */
++typedef struct _big_sur_ge_config {
++	u16		device_id;
++	u32		base_address;
++	u32		has_counters;
++	u32		has_sg_dma;
++	u8		dma_config;
++	u32		has_mii;
++} big_sur_ge_config;
++
++#define BIG_SUR_GE_SIZE_IN_WORDS           10
++typedef unsigned long xbuf_descriptor[BIG_SUR_GE_SIZE_IN_WORDS];
++
++/* Callback Functions */
++typedef void (*big_sur_sg_handler) (void *callback, xbuf_descriptor *desc, u32 num_desc);
++typedef	void (*big_sur_fifo_handler) (void *callback);
++typedef void (*big_sur_irq_handler) (void *instance);
++
++typedef struct _xdma_channel_tag {
++	u32			reg_base_address;
++        u32                     base_address;
++        u32                     ready;
++        xbuf_descriptor         *put_ptr;
++        xbuf_descriptor         *get_ptr;
++        xbuf_descriptor         *commit_ptr;
++        xbuf_descriptor         *last_ptr;
++
++        u32                     total_desc_count;
++        u32                     active_desc_count;
++} xdma_channel;
++
++typedef struct _packet_fifo {
++        u32             reg_base_addr;
++        u32             ready_status;
++        u32             data_base_address;
++} packet_fifo;
++
++
++/* Big Sur GE driver structure */
++typedef struct _big_sur_ge {
++	u32		base_address;
++	u32		started;
++	u32		ready;
++	u32		polled;
++	u32		dma_sg;
++
++	u8		dma_config;
++	u32		has_mii;
++	u32		has_mcast_hash_table;
++
++	/* For the FIFO and simple DMA case only */
++	packet_fifo	recv_fifo;
++	packet_fifo	send_fifo;
++
++	big_sur_fifo_handler	big_sur_ge_fifo_recv_handler;
++	big_sur_fifo_handler	big_sur_ge_fifo_send_handler;
++
++	void	*fifo_send_ref;
++	void	*fifo_recv_ref;	
++
++	/* For SG DMA only */
++	xdma_channel	recv_channel;
++	xdma_channel	send_channel;
++} big_sur_ge;
++
++/* Offset of the MAC registers from the IPIF base address */
++#define BIG_SUR_GE_REG_OFFSET     0x1100UL
++
++/*
++ * Register offsets for the Ethernet MAC. Each register is 32 bits.
++ */
++#define BIG_SUR_GE_EMIR_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x0)        /* EMAC Module ID */
++#define BIG_SUR_GE_ECR_OFFSET    (BIG_SUR_GE_REG_OFFSET + 0x4)        /* MAC Control */
++#define BIG_SUR_GE_IFGP_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x8)        /* Interframe Gap */
++#define BIG_SUR_GE_SAH_OFFSET    (BIG_SUR_GE_REG_OFFSET + 0xC)        /* Station addr, high */
++#define BIG_SUR_GE_SAL_OFFSET    (BIG_SUR_GE_REG_OFFSET + 0x10)       /* Station addr, low */
++#define BIG_SUR_GE_MGTCR_OFFSET  (BIG_SUR_GE_REG_OFFSET + 0x14)       /* MII mgmt control */
++#define BIG_SUR_GE_MGTDR_OFFSET  (BIG_SUR_GE_REG_OFFSET + 0x18)       /* MII mgmt data */
++#define BIG_SUR_GE_RPLR_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x1C)       /* Rx packet length */
++#define BIG_SUR_GE_TPLR_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x20)       /* Tx packet length */
++#define BIG_SUR_GE_TSR_OFFSET    (BIG_SUR_GE_REG_OFFSET + 0x24)       /* Tx status */
++#define BIG_SUR_GE_RMFC_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x28)       /* Rx missed frames */
++#define BIG_SUR_GE_RCC_OFFSET    (BIG_SUR_GE_REG_OFFSET + 0x2C)       /* Rx collisions */
++#define BIG_SUR_GE_RFCSEC_OFFSET (BIG_SUR_GE_REG_OFFSET + 0x30)       /* Rx FCS errors */
++#define BIG_SUR_GE_RAEC_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x34)       /* Rx alignment errors */
++#define BIG_SUR_GE_TEDC_OFFSET   (BIG_SUR_GE_REG_OFFSET + 0x38)       /* Transmit excess
++                                                         * deferral cnt */
++/*
++ * Register offsets for the IPIF components
++ */
++#define BIG_SUR_GE_ISR_OFFSET           0x20UL /* Interrupt status */
++
++#define BIG_SUR_GE_DMA_OFFSET           0x2300UL
++#define BIG_SUR_GE_DMA_SEND_OFFSET      (BIG_SUR_GE_DMA_OFFSET + 0x0) /* DMA send channel */
++#define BIG_SUR_GE_DMA_RECV_OFFSET      (BIG_SUR_GE_DMA_OFFSET + 0x40)        /* DMA recv channel */
++
++#define BIG_SUR_GE_PFIFO_OFFSET         0x2000UL
++#define BIG_SUR_GE_PFIFO_TXREG_OFFSET   (BIG_SUR_GE_PFIFO_OFFSET + 0x0)       /* Tx registers */
++#define BIG_SUR_GE_PFIFO_RXREG_OFFSET   (BIG_SUR_GE_PFIFO_OFFSET + 0x10)      /* Rx registers */
++#define BIG_SUR_GE_PFIFO_TXDATA_OFFSET  (BIG_SUR_GE_PFIFO_OFFSET + 0x100)     /* Tx keyhole */
++#define BIG_SUR_GE_PFIFO_RXDATA_OFFSET  (BIG_SUR_GE_PFIFO_OFFSET + 0x200)     /* Rx keyhole */
++
++/*
++ * EMAC Module Identification Register (EMIR)
++ */
++#define BIG_SUR_GE_EMIR_VERSION_MASK    0xFFFF0000UL   /* Device version */
++#define BIG_SUR_GE_EMIR_TYPE_MASK       0x0000FF00UL   /* Device type */
++
++/*
++ * EMAC Control Register (ECR)
++ */
++#define BIG_SUR_GE_ECR_FULL_DUPLEX_MASK         0x80000000   /* Full duplex mode */
++#define BIG_SUR_GE_ECR_XMIT_RESET_MASK          0x40000000   /* Reset transmitter */
++#define BIG_SUR_GE_ECR_XMIT_ENABLE_MASK         0x20000000   /* Enable transmitter */
++#define BIG_SUR_GE_ECR_RECV_RESET_MASK          0x10000000   /* Reset receiver */
++#define BIG_SUR_GE_ECR_RECV_ENABLE_MASK         0x08000000   /* Enable receiver */
++#define BIG_SUR_GE_ECR_PHY_ENABLE_MASK          0x04000000   /* Enable PHY */
++#define BIG_SUR_GE_ECR_XMIT_PAD_ENABLE_MASK     0x02000000   /* Enable xmit pad insert */
++#define BIG_SUR_GE_ECR_XMIT_FCS_ENABLE_MASK     0x01000000   /* Enable xmit FCS insert */
++#define BIG_SUR_GE_ECR_XMIT_ADDR_INSERT_MASK    0x00800000   /* Enable xmit source addr insertion */
++#define BIG_SUR_GE_ECR_XMIT_ERROR_INSERT_MASK   0x00400000   /* Insert xmit error */
++#define BIG_SUR_GE_ECR_XMIT_ADDR_OVWRT_MASK     0x00200000   /* Enable xmit source addr overwrite */
++#define BIG_SUR_GE_ECR_LOOPBACK_MASK            0x00100000   /* Enable internal loopback */
++#define BIG_SUR_GE_ECR_RECV_PAD_ENABLE_MASK     0x00080000   /* Enable recv pad strip */
++#define BIG_SUR_GE_ECR_RECV_FCS_ENABLE_MASK     0x00040000   /* Enable recv FCS strip */
++#define BIG_SUR_GE_ECR_RECV_STRIP_ENABLE_MASK   0x00080000   /* Enable recv pad/fcs strip */
++#define BIG_SUR_GE_ECR_UNICAST_ENABLE_MASK      0x00020000   /* Enable unicast addr */
++#define BIG_SUR_GE_ECR_MULTI_ENABLE_MASK        0x00010000   /* Enable multicast addr */
++#define BIG_SUR_GE_ECR_BROAD_ENABLE_MASK        0x00008000   /* Enable broadcast addr */
++#define BIG_SUR_GE_ECR_PROMISC_ENABLE_MASK      0x00004000   /* Enable promiscuous mode */
++#define BIG_SUR_GE_ECR_RECV_ALL_MASK            0x00002000   /* Receive all frames */
++#define BIG_SUR_GE_ECR_RESERVED2_MASK           0x00001000   /* Reserved */
++#define BIG_SUR_GE_ECR_MULTI_HASH_ENABLE_MASK   0x00000800   /* Enable multicast hash */
++#define BIG_SUR_GE_ECR_PAUSE_FRAME_MASK         0x00000400   /* Interpret pause frames */
++#define BIG_SUR_GE_ECR_CLEAR_HASH_MASK          0x00000200   /* Clear hash table */
++#define BIG_SUR_GE_ECR_ADD_HASH_ADDR_MASK       0x00000100  /* Add hash table address */
++
++/*
++ * Interframe Gap Register (IFGR)
++ */
++#define BIG_SUR_GE_IFGP_PART1_MASK         0xF8000000        /* Interframe Gap Part1 */
++#define BIG_SUR_GE_IFGP_PART1_SHIFT        27
++#define BIG_SUR_GE_IFGP_PART2_MASK         0x07C00000        /* Interframe Gap Part2 */
++#define BIG_SUR_GE_IFGP_PART2_SHIFT        22
++
++/*
++ * Station Address High Register (SAH)
++ */
++#define BIG_SUR_GE_SAH_ADDR_MASK           0x0000FFFF        /* Station address high bytes */
++
++/*
++ * Station Address Low Register (SAL)
++ */
++#define BIG_SUR_GE_SAL_ADDR_MASK           0xFFFFFFFF        /* Station address low bytes */
++
++/*
++ * MII Management Control Register (MGTCR)
++ */
++#define BIG_SUR_GE_MGTCR_START_MASK        0x80000000        /* Start/Busy */
++#define BIG_SUR_GE_MGTCR_RW_NOT_MASK       0x40000000        /* Read/Write Not (direction) */
++#define BIG_SUR_GE_MGTCR_PHY_ADDR_MASK     0x3E000000        /* PHY address */
++#define BIG_SUR_GE_MGTCR_PHY_ADDR_SHIFT    25  /* PHY address shift */
++#define BIG_SUR_GE_MGTCR_REG_ADDR_MASK     0x01F00000        /* Register address */
++#define BIG_SUR_GE_MGTCR_REG_ADDR_SHIFT    20  /* Register addr shift */
++#define BIG_SUR_GE_MGTCR_MII_ENABLE_MASK   0x00080000        /* Enable MII from EMAC */
++#define BIG_SUR_GE_MGTCR_RD_ERROR_MASK     0x00040000        /* MII mgmt read error */
++
++/*
++ * MII Management Data Register (MGTDR)
++ */
++#define BIG_SUR_GE_MGTDR_DATA_MASK         0x0000FFFF        /* MII data */
++
++/*
++ * Receive Packet Length Register (RPLR)
++ */
++#define BIG_SUR_GE_RPLR_LENGTH_MASK        0x0000FFFF        /* Receive packet length */
++
++/*
++ * Transmit Packet Length Register (TPLR)
++ */
++#define BIG_SUR_GE_TPLR_LENGTH_MASK        0x0000FFFF       /* Transmit packet length */
++
++/*
++ * Transmit Status Register (TSR)
++ */
++#define BIG_SUR_GE_TSR_EXCESS_DEFERRAL_MASK 0x80000000       /* Transmit excess deferral */
++#define BIG_SUR_GE_TSR_FIFO_UNDERRUN_MASK   0x40000000       /* Packet FIFO underrun */
++#define BIG_SUR_GE_TSR_ATTEMPTS_MASK        0x3E000000      /* Transmission attempts */
++#define BIG_SUR_GE_TSR_LATE_COLLISION_MASK  0x01000000      /* Transmit late collision */
++
++/*
++ * Receive Missed Frame Count (RMFC)
++ */
++#define BIG_SUR_GE_RMFC_DATA_MASK          0x0000FFFF
++
++/*
++ * Receive Collision Count (RCC)
++ */
++#define BIG_SUR_GE_RCC_DATA_MASK           0x0000FFFF
++/*
++ * Receive FCS Error Count (RFCSEC)
++ */
++#define BIG_SUR_GE_RFCSEC_DATA_MASK        0x0000FFFF
++
++/*
++ * Receive Alignment Error Count (RALN)
++ */
++#define BIG_SUR_GE_RAEC_DATA_MASK          0x0000FFFF
++
++/*
++ * Transmit Excess Deferral Count (TEDC)
++ */
++#define BIG_SUR_GE_TEDC_DATA_MASK          0x0000FFFF
++
++/*
++ * EMAC Interrupt Registers (Status and Enable) masks. These registers are
++ * part of the IPIF IP Interrupt registers
++ */
++#define BIG_SUR_GE_EIR_XMIT_DONE_MASK         0x00000001     /* Xmit complete */
++#define BIG_SUR_GE_EIR_RECV_DONE_MASK         0x00000002     /* Recv complete */
++#define BIG_SUR_GE_EIR_XMIT_ERROR_MASK        0x00000004     /* Xmit error */
++#define BIG_SUR_GE_EIR_RECV_ERROR_MASK        0x00000008     /* Recv error */
++#define BIG_SUR_GE_EIR_XMIT_SFIFO_EMPTY_MASK  0x00000010     /* Xmit status fifo empty */
++#define BIG_SUR_GE_EIR_RECV_LFIFO_EMPTY_MASK  0x00000020     /* Recv length fifo empty */
++#define BIG_SUR_GE_EIR_XMIT_LFIFO_FULL_MASK   0x00000040     /* Xmit length fifo full */
++#define BIG_SUR_GE_EIR_RECV_LFIFO_OVER_MASK   0x00000080     /* Recv length fifo overrun */
++#define BIG_SUR_GE_EIR_RECV_LFIFO_UNDER_MASK  0x00000100     /* Recv length fifo underrun */
++#define BIG_SUR_GE_EIR_XMIT_SFIFO_OVER_MASK   0x00000200     /* Xmit status fifo overrun */
++#define BIG_SUR_GE_EIR_XMIT_SFIFO_UNDER_MASK  0x00000400     /* Transmit status fifo underrun */
++#define BIG_SUR_GE_EIR_XMIT_LFIFO_OVER_MASK   0x00000800     /* Transmit length fifo overrun */
++#define BIG_SUR_GE_EIR_XMIT_LFIFO_UNDER_MASK  0x00001000     /* Transmit length fifo underrun */
++#define BIG_SUR_GE_EIR_XMIT_PAUSE_MASK        0x00002000     /* Transmit pause pkt received */
++#define BIG_SUR_GE_EIR_RECV_DFIFO_OVER_MASK   0x00004000     /* Receive data fifo overrun */
++#define BIG_SUR_GE_EIR_RECV_MISSED_FRAME_MASK 0x00008000     /* Receive missed frame error */
++#define BIG_SUR_GE_EIR_RECV_COLLISION_MASK    0x00010000     /* Receive collision error */
++#define BIG_SUR_GE_EIR_RECV_FCS_ERROR_MASK    0x00020000     /* Receive FCS error */
++#define BIG_SUR_GE_EIR_RECV_LEN_ERROR_MASK    0x00040000     /* Receive length field error */
++#define BIG_SUR_GE_EIR_RECV_SHORT_ERROR_MASK  0x00080000     /* Receive short frame error */
++#define BIG_SUR_GE_EIR_RECV_LONG_ERROR_MASK   0x00100000     /* Receive long frame error */
++#define BIG_SUR_GE_EIR_RECV_ALIGN_ERROR_MASK  0x00200000     /* Receive alignment error */
++
++#define	BIG_SUR_GE_READ_REG(base_addr, reg_offset)	\
++		BIG_SUR_GE_READ(base_addr + reg_offset)
++
++#define	BIG_SUR_GE_WRITE_REG(base_addr, reg_offset, data)	\
++		 BIG_SUR_GE_WRITE(base_addr + reg_offset, data)
++
++#define BIG_SUR_GE_CONTROL_REG(base_addr, mask)		\
++		BIG_SUR_GE_WRITE(base_addr + BIG_SUR_GE_ECR_OFFSET, mask)
++
++/* Set the MAC Address */
++#define	big_sur_ge_set_mac(base_addr, address)					\
++{										\
++	u32	mac_addr;							\
++										\
++	mac_addr = ((address[0] << 8) | (address[1]);				\
++	BIG_SUR_GE_WRITE(base_address + BIG_SUR_GE_SAH_OFFSET, mac_address);		\
++										\
++	mac_addr = ((address[2] << 24) | (address[3] << 16) |			\
++			(address[4] << 8) | address[5]);			\
++										\
++	BIG_SUR_GE_WRITE(base_address + BIG_SUR_GE_SAL_OFFSET, mac_address);		\
++										\
++}										
++
++/* Enable the MAC unit */
++#define	big_sur_ge_mac_enable(base_address)					\
++{										\
++	u32	control;							\
++	control = BIG_SUR_GE_READ(base_address + BIG_SUR_GE_ECR_OFFSET);		\
++	control &= ~(BIG_SUR_GE_ECR_XMIT_RESET_MASK | BIG_SUR_GE_ECR_RECV_RESET_MASK);	\
++	control |= (BIG_SUR_GE_ECR_XMIT_ENABLE_MASK | BIG_SUR_GE_ECR_RECV_ENABLE_MASK);	\
++	BIG_SUR_GE_WRITE(base_address + BIG_SUR_GE_ECR_OFFSET, control);		\
++}
++
++/* Disable the MAC unit */
++#define	big_sur_ge_mac_disable(base_address)					\
++{										\
++	u32	control;							\
++	control = BIG_SUR_GE_READ(base_address + BIG_SUR_GE_ECR_OFFSET);		\
++	control &= ~(BIG_SUR_GE_ECR_XMIT_ENABLE_MASK | BIG_SUR_GE_ECR_RECV_ENABLE_MASK);	\
++	BIG_SUR_GE_WRITE(base_address + BIG_SUR_GE_ECR_OFFSET, control);		\
++}
++
++/* Check if the Tx is done */
++#define	big_sur_ge_tx_done(base_address)						\
++	(BIG_SUR_GE_READ(base_address + BIG_SUR_GE_ISR_OFFSET) & BIG_SUR_GE_EIR_XMIT_DONE_MASK)
++
++
++/* Check if Rx FIFO is empty */
++#define	big_sur_ge_rx_empty(base_address)						\
++	(!(BIG_SUR_GE_READ(base_address + BIG_SUR_GE_ISR_OFFSET) & BIG_SUR_GE_EIR_RECV_DONE_MASK))
++
++/* Reset the MAC PHY */
++#define	big_sur_ge_reset_phy(base_address)						\
++{											\
++	u32	control;								\
++	control = BIG_SUR_GE_READ(base_address + BIG_SUR_GE_ECR_OFFSET);			\
++	control &= ~(BIG_SUR_GE_ECR_PHY_ENABLE_MASK);						\
++	BIG_SUR_GE_WRITE(base_address + BIG_SUR_GE_ECR_OFFSET, control);			\
++	control |= BIG_SUR_GE_ECR_PHY_ENABLE_MASK;						\
++	BIG_SUR_GE_WRITE(base_address + BIG_SUR_GE_ECR_OFFSET, control);			\
++}
++
++/* DMA SG defines */
++#define BIG_SUR_GE_CONTROL_LAST_BD_MASK        0x02000000
++#define BIG_SUR_GE_STATUS_LAST_BD_MASK         0x10000000
++#define BIG_SUR_GE_RST_REG_OFFSET      0       /* reset register */
++#define BIG_SUR_GE_MI_REG_OFFSET       0       /* module information register */
++#define BIG_SUR_GE_DMAC_REG_OFFSET     4       /* DMA control register */
++#define BIG_SUR_GE_SA_REG_OFFSET       8       /* source address register */
++#define BIG_SUR_GE_DA_REG_OFFSET       12      /* destination address register */
++#define BIG_SUR_GE_LEN_REG_OFFSET      16      /* length register */
++#define BIG_SUR_GE_DMAS_REG_OFFSET     20      /* DMA status register */
++#define BIG_SUR_GE_BDA_REG_OFFSET      24      /* buffer descriptor address register */
++#define BIG_SUR_GE_SWCR_REG_OFFSET 28  /* software control register */
++#define BIG_SUR_GE_UPC_REG_OFFSET      32      /* unserviced packet count register */
++#define BIG_SUR_GE_PCT_REG_OFFSET      36      /* packet count threshold register */
++#define BIG_SUR_GE_PWB_REG_OFFSET      40      /* packet wait bound register */
++#define BIG_SUR_GE_IS_REG_OFFSET       44      /* interrupt status register */
++#define BIG_SUR_GE_IE_REG_OFFSET       48      /* interrupt enable register */
++
++#define BIG_SUR_GE_RESET_MASK                          0x0000000A
++
++/* Buffer Descriptor Control */
++
++#define BIG_SUR_GE_DEVICE_STATUS_OFFSET    0
++#define BIG_SUR_GE_CONTROL_OFFSET          1
++#define BIG_SUR_GE_SOURCE_OFFSET           2
++#define BIG_SUR_GE_DESTINATION_OFFSET      3
++#define BIG_SUR_GE_LENGTH_OFFSET           4
++#define BIG_SUR_GE_STATUS_OFFSET           5
++#define BIG_SUR_GE_NEXT_PTR_OFFSET         6
++#define BIG_SUR_GE_ID_OFFSET               7
++#define BIG_SUR_GE_FLAGS_OFFSET            8
++#define BIG_SUR_GE_RQSTED_LENGTH_OFFSET    9
++
++#define BIG_SUR_GE_FLAGS_LOCKED_MASK       1
++
++#define	xbuf_descriptor_init(base)				\
++{								\
++	(*((u32 *)base + BIG_SUR_GE_CONTROL_OFFSET) = 0);		\
++	(*((u32 *)base + BIG_SUR_GE_SOURCE_OFFSET) = 0);        \
++    	(*((u32 *)base + BIG_SUR_GE_DESTINATION_OFFSET) = 0);   \
++    	(*((u32 *)base + BIG_SUR_GE_LENGTH_OFFSET) = 0);        \
++    	(*((u32 *)base + BIG_SUR_GE_STATUS_OFFSET) = 0);        \
++    	(*((u32 *)base + BIG_SUR_GE_DEVICE_STATUS_OFFSET) = 0); \
++    	(*((u32 *)base + BIG_SUR_GE_NEXT_PTR_OFFSET) = 0);      \
++    	(*((u32 *)base + BIG_SUR_GE_ID_OFFSET) = 0);            \
++    	(*((u32 *)base + BIG_SUR_GE_FLAGS_OFFSET) = 0);         \
++    	(*((u32 *)base + BIG_SUR_GE_RQSTED_LENGTH_OFFSET) = 0); \
++}
++
++#define xbuf_descriptor_GetControl(base)   \
++    (u32)(*((u32 *)base + BIG_SUR_GE_CONTROL_OFFSET))
++
++#define xbuf_descriptor_SetControl(base, Control)  \
++    (*((u32 *)base + BIG_SUR_GE_CONTROL_OFFSET) = (u32)Control)
++
++#define xbuf_descriptor_IsLastControl(base) \
++    (u32)(*((u32 *)base + BIG_SUR_GE_CONTROL_OFFSET) & \
++               BIG_SUR_GE_CONTROL_LAST_BD_MASK)
++
++#define xbuf_descriptor_SetLast(base) \
++    (*((u32 *)base + BIG_SUR_GE_CONTROL_OFFSET) |= BIG_SUR_GECONTROL_LAST_BD_MASK)
++
++#define xbuf_descriptor_GetSrcAddress(base) \
++    ((u32 *)(*((u32 *)base + BIG_SUR_GE_SOURCE_OFFSET)))
++
++#define xbuf_descriptor_SetSrcAddress(base, Source) \
++    (*((u32 *)base + BIG_SUR_GE_SOURCE_OFFSET) = (u32)Source)
++
++#define xbuf_descriptor_GetDestAddress(base) \
++    ((u32 *)(*((u32 *)base + BIG_SUR_GE_DESTINATION_OFFSET)))
++
++#define xbuf_descriptor_SetDestAddress(base, Destination) \
++    (*((u32 *)base + BIG_SUR_GE_DESTINATION_OFFSET) = (u32)Destination)
++
++#define xbuf_descriptor_GetLength(base)                           \
++    (u32)(*((u32 *)base + BIG_SUR_GE_RQSTED_LENGTH_OFFSET) -    \
++              *((u32 *)base + BIG_SUR_GE_LENGTH_OFFSET))
++
++#define xbuf_descriptor_SetLength(base, Length)                       \
++{                                                                           \
++    (*((u32 *)base + BIG_SUR_GE_LENGTH_OFFSET) = (u32)(Length));    \
++    (*((u32 *)base + BIG_SUR_GE_RQSTED_LENGTH_OFFSET) = (u32)(Length));\
++}
++
++#define xbuf_descriptor_GetStatus(base)    \
++    (u32)(*((u32 *)base + BIG_SUR_GE_STATUS_OFFSET))
++
++#define xbuf_descriptor_SetStatus(base, Status)    \
++    (*((u32 *)base + BIG_SUR_GE_STATUS_OFFSET) = (u32)Status)
++
++#define xbuf_descriptor_IsLastStatus(base) \
++    (u32)(*((u32 *)base + BIG_SUR_GE_STATUS_OFFSET) & \
++               BIG_SUR_GE_STATUS_LAST_BD_MASK)
++
++#define xbuf_descriptor_GetDeviceStatus(base) \
++    ((u32)(*((u32 *)base + BIG_SUR_GE_DEVICE_STATUS_OFFSET)))
++
++#define xbuf_descriptor_SetDeviceStatus(base, Status) \
++    (*((u32 *)base + BIG_SUR_GE_DEVICE_STATUS_OFFSET) = (u32)Status)
++
++#define xbuf_descriptor_GetNextPtr(base) \
++    (xbuf_descriptor *)(*((u32 *)base + BIG_SUR_GE_NEXT_PTR_OFFSET))
++
++#define xbuf_descriptor_SetNextPtr(base, NextPtr) \
++    (*((u32 *)base + BIG_SUR_GE_NEXT_PTR_OFFSET) = (u32)NextPtr)
++
++#define xbuf_descriptor_GetId(base) \
++    (u32)(*((u32 *)base + BIG_SUR_GE_ID_OFFSET))
++
++#define xbuf_descriptor_SetId(base, Id) \
++    (*((u32 *)base + BIG_SUR_GE_ID_OFFSET) = (u32)Id)
++
++#define xbuf_descriptor_GetFlags(base) \
++    (u32)(*((u32 *)base + BIG_SUR_GE_FLAGS_OFFSET))
++
++#define xbuf_descriptor_SetFlags(base, Flags) \
++    (*((u32 *)base + BIG_SUR_GE_FLAGS_OFFSET) = (u32)Flags)
++
++#define xbuf_descriptor_Lock(base) \
++    (*((u32 *)base + BIG_SUR_GE_FLAGS_OFFSET) |= BIG_SUR_GE_FLAGS_LOCKED_MASK)
++
++#define xbuf_descriptor_Unlock(base) \
++    (*((u32 *)base + BIG_SUR_GE_FLAGS_OFFSET) &= ~BIG_SUR_GE_FLAGS_LOCKED_MASK)
++
++#define xbuf_descriptor_IsLocked(base) \
++	(*((u32 *)base + BIG_SUR_GE_FLAGS_OFFSET) & BIG_SUR_GE_FLAGS_LOCKED_MASK)
++
++#define BIG_SUR_GE_DMACR_SOURCE_INCR_MASK      0x80000000UL    /* increment source address */
++#define BIG_SUR_GE_DMACR_DEST_INCR_MASK        0x40000000UL    /* increment dest address */
++#define BIG_SUR_GE_DMACR_SOURCE_LOCAL_MASK 0x20000000UL        /* local source address */
++#define BIG_SUR_GE_DMACR_DEST_LOCAL_MASK       0x10000000UL    /* local dest address */
++#define BIG_SUR_GE_DMACR_SG_DISABLE_MASK       0x08000000UL    /* scatter gather disable */
++#define BIG_SUR_GE_DMACR_GEN_BD_INTR_MASK      0x04000000UL    /* descriptor interrupt */
++#define BIG_SUR_GE_DMACR_LAST_BD_MASK          BIG_SUR_GE_CONTROL_LAST_BD_MASK        /* last buffer */
++#define BIG_SUR_GE_DMASR_BUSY_MASK                     0x80000000UL    /* channel is busy */
++#define BIG_SUR_GE_DMASR_BUS_ERROR_MASK        0x40000000UL    /* bus error occurred */
++#define BIG_SUR_GE_DMASR_BUS_TIMEOUT_MASK      0x20000000UL    /* bus timeout occurred */
++#define BIG_SUR_GE_DMASR_LAST_BD_MASK          BIG_SUR_GE_STATUS_LAST_BD_MASK /* last buffer */
++#define BIG_SUR_GE_DMASR_SG_BUSY_MASK          0x08000000UL    /* scatter gather is busy */
++#define BIG_SUR_GE_IXR_DMA_DONE_MASK           0x1UL   /* dma operation done */
++#define BIG_SUR_GE_IXR_DMA_ERROR_MASK      0x2UL       /* dma operation error */
++#define BIG_SUR_GE_IXR_PKT_DONE_MASK       0x4UL       /* packet done */
++#define BIG_SUR_GE_IXR_PKT_THRESHOLD_MASK      0x8UL   /* packet count threshold */
++#define BIG_SUR_GE_IXR_PKT_WAIT_BOUND_MASK 0x10UL      /* packet wait bound reached */
++#define BIG_SUR_GE_IXR_SG_DISABLE_ACK_MASK 0x20UL      /* scatter gather disable
++                                                   acknowledge occurred */
++#define BIG_SUR_GEIXR_SG_END_MASK                     0x40UL  /* last buffer descriptor
++                                                           disabled scatter gather */
++#define BIG_SUR_GEIXR_BD_MASK                         0x80UL  /* buffer descriptor done */
++
++/* BD control */
++#define BIG_SUR_GE_DFT_SEND_BD_MASK    (BIG_SUR_GEDMACR_SOURCE_INCR_MASK | \
++                                 BIG_SUR_GEDMACR_DEST_LOCAL_MASK)
++#define BIG_SUR_GE_DFT_RECV_BD_MASK    (BIG_SUR_GEDMACR_DEST_INCR_MASK |  \
++                                 BIG_SUR_GEDMACR_SOURCE_LOCAL_MASK)
++
++/* Interrupts */
++#define BIG_SUR_GE_IPIF_EMAC_MASK      0x00000004UL    /* MAC interrupt */
++#define BIG_SUR_GE_IPIF_SEND_DMA_MASK  0x00000008UL    /* Send DMA interrupt */
++#define BIG_SUR_GE_IPIF_RECV_DMA_MASK  0x00000010UL    /* Receive DMA interrupt */
++#define BIG_SUR_GE_IPIF_RECV_FIFO_MASK 0x00000020UL    /* Receive FIFO interrupt */
++#define BIG_SUR_GE_IPIF_SEND_FIFO_MASK 0x00000040UL    /* Send FIFO interrupt */
++
++#define BIG_SUR_GE_IPIF_DMA_DFT_MASK   (BIG_SUR_GE_IPIF_SEND_DMA_MASK |   \
++                                 BIG_SUR_GE_IPIF_RECV_DMA_MASK |   \
++                                 BIG_SUR_GE_IPIF_EMAC_MASK |       \
++                                 BIG_SUR_GE_IPIF_SEND_FIFO_MASK |  \
++                                 BIG_SUR_GE_IPIF_RECV_FIFO_MASK)
++
++#define BIG_SUR_GE_IPIF_FIFO_DFT_MASK  (BIG_SUR_GE_IPIF_EMAC_MASK |       \
++                                 BIG_SUR_GE_IPIF_SEND_FIFO_MASK |  \
++                                 BIG_SUR_GE_IPIF_RECV_FIFO_MASK)
++
++#define BIG_SUR_GE_IPIF_DMA_DEV_INTR_COUNT   7 /* Number of interrupt sources */
++#define BIG_SUR_GE_IPIF_FIFO_DEV_INTR_COUNT  5 /* Number of interrupt sources */
++#define BIG_SUR_GE_IPIF_DEVICE_INTR_COUNT  7   /* Number of interrupt sources */
++#define BIG_SUR_GE_IPIF_IP_INTR_COUNT      22  /* Number of MAC interrupts */
++
++/* a mask for all transmit interrupts, used in polled mode */
++#define BIG_SUR_GE_EIR_XMIT_ALL_MASK   (BIG_SUR_GE_EIR_XMIT_DONE_MASK |           \
++                                 BIG_SUR_GE_EIR_XMIT_ERROR_MASK |          \
++                                 BIG_SUR_GE_EIR_XMIT_SFIFO_EMPTY_MASK |    \
++                                 BIG_SUR_GE_EIR_XMIT_LFIFO_FULL_MASK)
++
++/* a mask for all receive interrupts, used in polled mode */
++#define BIG_SUR_GE_EIR_RECV_ALL_MASK   (BIG_SUR_GE_EIR_RECV_DONE_MASK |           \
++                                 BIG_SUR_GE_EIR_RECV_ERROR_MASK |          \
++                                 BIG_SUR_GE_EIR_RECV_LFIFO_EMPTY_MASK |    \
++                                 BIG_SUR_GE_EIR_RECV_LFIFO_OVER_MASK |     \
++                                 BIG_SUR_GE_EIR_RECV_LFIFO_UNDER_MASK |    \
++                                 BIG_SUR_GE_EIR_RECV_DFIFO_OVER_MASK |     \
++                                 BIG_SUR_GE_EIR_RECV_MISSED_FRAME_MASK |   \
++                                 BIG_SUR_GE_EIR_RECV_COLLISION_MASK |      \
++                                 BIG_SUR_GE_EIR_RECV_FCS_ERROR_MASK |      \
++                                 BIG_SUR_GE_EIR_RECV_LEN_ERROR_MASK |      \
++                                 BIG_SUR_GE_EIR_RECV_SHORT_ERROR_MASK |    \
++                                 BIG_SUR_GE_EIR_RECV_LONG_ERROR_MASK |     \
++                                 BIG_SUR_GE_EIR_RECV_ALIGN_ERROR_MASK)
++
++/* a default interrupt mask for scatter-gather DMA operation */
++#define BIG_SUR_GE_EIR_DFT_SG_MASK    (BIG_SUR_GE_EIR_RECV_ERROR_MASK |           \
++                                BIG_SUR_GE_EIR_RECV_LFIFO_OVER_MASK |      \
++                                BIG_SUR_GE_EIR_RECV_LFIFO_UNDER_MASK |     \
++                                BIG_SUR_GE_EIR_XMIT_SFIFO_OVER_MASK |      \
++                                BIG_SUR_GE_EIR_XMIT_SFIFO_UNDER_MASK |     \
++                                BIG_SUR_GE_EIR_XMIT_LFIFO_OVER_MASK |      \
++                                BIG_SUR_GE_EIR_XMIT_LFIFO_UNDER_MASK |     \
++                                BIG_SUR_GE_EIR_RECV_DFIFO_OVER_MASK |      \
++                                BIG_SUR_GE_EIR_RECV_MISSED_FRAME_MASK |    \
++                                BIG_SUR_GE_EIR_RECV_COLLISION_MASK |       \
++                                BIG_SUR_GE_EIR_RECV_FCS_ERROR_MASK |       \
++                                BIG_SUR_GE_EIR_RECV_LEN_ERROR_MASK |       \
++                                BIG_SUR_GE_EIR_RECV_SHORT_ERROR_MASK |     \
++                                BIG_SUR_GE_EIR_RECV_LONG_ERROR_MASK |      \
++                                BIG_SUR_GE_EIR_RECV_ALIGN_ERROR_MASK)
++
++/* a default interrupt mask for non-DMA operation (direct FIFOs) */
++#define BIG_SUR_GE_EIR_DFT_FIFO_MASK  (BIG_SUR_GE_EIR_XMIT_DONE_MASK |            \
++                                BIG_SUR_GE_EIR_RECV_DONE_MASK |            \
++                                BIG_SUR_GE_EIR_DFT_SG_MASK)
++
++#define BIG_SUR_GE_DMA_SG_INTR_MASK    (BIG_SUR_GEIXR_DMA_ERROR_MASK  |      \
++                                 BIG_SUR_GEIXR_PKT_THRESHOLD_MASK |   \
++                                 BIG_SUR_GEIXR_PKT_WAIT_BOUND_MASK |  \
++                                 BIG_SUR_GEIXR_SG_END_MASK)
++
++#endif
+diff -Naur linux-2.6.16.orig/drivers/net/declance.c linux-2.6.16/drivers/net/declance.c
+--- linux-2.6.16.orig/drivers/net/declance.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/net/declance.c	2006-03-21 01:05:47.000000000 +0000
+@@ -704,8 +704,8 @@
+ 	return IRQ_HANDLED;
+ }
+ 
+-static irqreturn_t
+-lance_interrupt(const int irq, void *dev_id, struct pt_regs *regs)
++static irqreturn_t lance_interrupt(const int irq, void *dev_id,
++				   struct pt_regs *regs)
+ {
+ 	struct net_device *dev = (struct net_device *) dev_id;
+ 	struct lance_private *lp = netdev_priv(dev);
+@@ -1255,7 +1255,7 @@
+ 	return 0;
+ 
+ err_out_free_dev:
+-	kfree(dev);
++	free_netdev(dev);
+ 
+ err_out:
+ 	return ret;
+@@ -1301,6 +1301,7 @@
+ 	while (root_lance_dev) {
+ 		struct net_device *dev = root_lance_dev;
+ 		struct lance_private *lp = netdev_priv(dev);
++
+ 		unregister_netdev(dev);
+ #ifdef CONFIG_TC
+ 		if (lp->slot >= 0)
+diff -Naur linux-2.6.16.orig/drivers/net/gt64240eth.c linux-2.6.16/drivers/net/gt64240eth.c
+--- linux-2.6.16.orig/drivers/net/gt64240eth.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/gt64240eth.c	2006-03-21 01:05:47.000000000 +0000
+@@ -0,0 +1,1672 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2001 Patton Electronics Company
++ * Copyright (C) 2002 Momentum Computer
++ *
++ * Copyright 2000 MontaVista Software Inc.
++ * Author: MontaVista Software, Inc.
++ *         	stevel@mvista.com or support@mvista.com
++ *
++ *  This program is free software; you can distribute it and/or modify it
++ *  under the terms of the GNU General Public License (Version 2) as
++ *  published by the Free Software Foundation.
++ *
++ *  This program is distributed in the hope it will be useful, but WITHOUT
++ *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
++ *  for more details.
++ *
++ *  You should have received a copy of the GNU General Public License along
++ *  with this program; if not, write to the Free Software Foundation, Inc.,
++ *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
++ *
++ * Ethernet driver for the MIPS GT96100 Advanced Communication Controller.
++ * 
++ * Modified for the Gallileo/Marvell GT-64240 Communication Controller.
++ *
++ * Support for Rx NAPI, Rx checksum offload, IOCTL and ETHTOOL added
++ * Manish Lachwani (lachwani@pmc-sierra.com) - 09/16/2003
++ *
++ * Modified for later version of Linux 2.4 kernel
++ * Manish Lachwani (lachwani@pmc-sierra.com) - 04/29/2004
++ */
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/sched.h>
++#include <linux/string.h>
++#include <linux/timer.h>
++#include <linux/errno.h>
++#include <linux/in.h>
++#include <linux/ioport.h>
++#include <linux/slab.h>
++#include <linux/interrupt.h>
++#include <linux/pci.h>
++#include <linux/init.h>
++#include <linux/netdevice.h>
++#include <linux/etherdevice.h>
++#include <linux/ethtool.h>
++#include <linux/skbuff.h>
++#include <linux/delay.h>
++#include <linux/ctype.h>
++#include <linux/mii.h>
++
++#include <asm/irq.h>
++#include <asm/bitops.h>
++#include <asm/io.h>
++#include <asm/uaccess.h>
++
++#define DESC_DATA_BE 1
++
++#include "gt64240eth.h"
++
++// enable this port (set hash size to 1/2K)
++//- #define PORT_CONFIG pcrHS
++#define PORT_CONFIG (pcrHS | pcrHD)
++//- #define PORT_CONFIG pcrHS |pcrPM |pcrPBF|pcrHDM
++//- GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG, pcrEN | pcrHS);
++//- GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG, pcrEN | pcrHS | pcrPM);
++//- GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG, pcrEN | pcrHS | pcrPM | 1<<pcrLPBKBit);
++
++// clear all the MIB ctr regs
++#define EXT_CONFIG_CLEAR (pcxrFCTL | pcxrFCTLen | pcxrFLP | pcxrDPLXen | pcxrPRIOrxOverride | pcxrRMIIen)
++
++/*
++ * _debug level:
++ * <= 2	none.
++ *  > 2	some warnings such as queue full, .....
++ *  > 3	lots of change-of-state messages.
++ *  > 4	EXTENSIVE data/descriptor dumps.
++ */
++
++#ifdef GT64240_DEBUG
++static int gt64240_debug = GT64240_DEBUG;
++#else
++static int gt64240_debug = 0;
++#endif
++
++static int debug = -1;
++
++#define GT64240_MSG_ENABLE	(NETIF_MSG_DRV          | \
++				NETIF_MSG_PROBE        | \
++				NETIF_MSG_LINK)
++
++
++/********************************************************/
++
++// prototypes
++static void gt64240_delay(int msec);
++static int gt64240_add_hash_entry(struct net_device *dev,
++				  unsigned char *addr);
++static void read_mib_counters(struct gt64240_private *gp);
++static void dump_MII(struct net_device *dev);
++static void dump_tx_desc(struct net_device *dev, int i);
++static void dump_rx_desc(struct net_device *dev, int i);
++static void dump_hw_addr(unsigned char *addr_str);
++static void update_stats(struct gt64240_private *gp);
++static void abort(struct net_device *dev, u32 abort_bits);
++static void hard_stop(struct net_device *dev);
++static void enable_ether_irq(struct net_device *dev);
++static void disable_ether_irq(struct net_device *dev);
++static int __init gt64240_probe1(unsigned long ioaddr, int irq, int port_num);
++static void reset_tx(struct net_device *dev);
++static void reset_rx(struct net_device *dev);
++static int gt64240_init(struct net_device *dev);
++static int gt64240_open(struct net_device *dev);
++static int gt64240_close(struct net_device *dev);
++static int gt64240_tx(struct sk_buff *skb, struct net_device *dev);
++#ifdef GT64240_NAPI
++static int gt64240_poll(struct net_device *dev, int *budget);
++static int gt64240_rx(struct net_device *dev, u32 status, int budget);
++#else
++static int gt64240_rx(struct net_device *dev, u32 status);
++#endif
++static void gt64240_tx_timeout(struct net_device *dev);
++static void gt64240_set_rx_mode(struct net_device *dev);
++static struct net_device_stats *gt64240_get_stats(struct net_device *dev);
++
++extern char *__init prom_getcmdline(void);
++extern int prom_get_mac_addrs(unsigned char
++			      station_addr[NUM_INTERFACES][6]);
++
++static char version[] __devinitdata =
++	"gt64240eth.o: version 0.1, <www.patton.com>\n";
++
++// PHY device addresses
++static u32 gt64240_phy_addr[NUM_INTERFACES] __devinitdata = { 0x8, 0x1, 0xa };
++
++// Need real Ethernet addresses -- in parse_mac_addr_options(),
++// these will be replaced by prom_get_mac_addrs() and/or prom_getcmdline().
++static unsigned char gt64240_station_addr[NUM_INTERFACES][6] = {
++	{0x00, 0x01, 0x02, 0x03, 0x04, 0x05},
++	{0x01, 0x02, 0x03, 0x04, 0x05, 0x06},
++	{0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
++};
++
++static int max_interrupt_work = 32;
++
++/*
++ * Base address and interupt of the GT64240 ethernet controllers
++ */
++static struct {
++	unsigned int port;
++	int irq;
++} gt64240_iflist[NUM_INTERFACES] = {
++	{
++	GT64240_ETH0_BASE, 8}, {
++	GT64240_ETH1_BASE, 8}, {
++	GT64240_ETH2_BASE, 8}
++};
++
++static void gt64240_delay(int ms)
++{
++	if (in_interrupt())
++		return;
++	else {
++		current->state = TASK_INTERRUPTIBLE;
++		schedule_timeout(ms * HZ / 1000);
++	}
++}
++
++unsigned char prom_mac_addr_base[6];
++
++int prom_get_mac_addrs(unsigned char station_addr[NUM_INTERFACES][6])
++{
++	memcpy(station_addr[0], prom_mac_addr_base, 6);
++	memcpy(station_addr[1], prom_mac_addr_base, 6);
++	memcpy(station_addr[2], prom_mac_addr_base, 6);
++
++	station_addr[1][5] += 1;
++	station_addr[2][5] += 2;
++
++	return 0;
++}
++
++void parse_mac_addr_options(void)
++{
++	prom_get_mac_addrs(gt64240_station_addr);
++}
++
++static int read_MII(struct net_device *dev, int phy, int reg)
++{
++	int timedout = 20;
++	u32 smir = smirOpCode | (phy << smirPhyAdBit) |
++	    (reg << smirRegAdBit);
++
++	// wait for last operation to complete
++	while ((GT64240_READ(GT64240_ETH_SMI_REG)) & smirBusy) {
++		// snooze for 1 msec and check again
++		gt64240_delay(1);
++
++		if (--timedout == 0) {
++			printk("%s: read_MII busy timeout!!\n", dev->name);
++			return -1;
++		}
++	}
++
++	GT64240_WRITE(GT64240_ETH_SMI_REG, smir);
++
++	timedout = 20;
++	// wait for read to complete
++	while (!
++	       ((smir =
++		 GT64240_READ(GT64240_ETH_SMI_REG)) & smirReadValid)) {
++		// snooze for 1 msec and check again
++		gt64240_delay(1);
++
++		if (--timedout == 0) {
++			printk("%s: read_MII timeout!!\n", dev->name);
++			return -1;
++		}
++	}
++
++	return (int) (smir & smirDataMask);
++}
++
++static void gp_get_drvinfo (struct net_device *dev, 
++				struct ethtool_drvinfo *info)
++{
++	strcpy(info->driver, "gt64260");
++	strcpy(info->version, version);
++}
++
++static int gp_get_settings(struct net_device *dev, 
++				struct ethtool_cmd *cmd)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int rc;
++
++	spin_lock_irq(&gp->lock);
++	rc = mii_ethtool_gset(&gp->mii_if, cmd);
++	spin_unlock_irq(&gp->lock);
++	return rc;
++}
++
++static int gp_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int rc;
++
++	spin_lock_irq(&gp->lock);
++	rc = mii_ethtool_sset(&gp->mii_if, cmd);
++	spin_unlock_irq(&gp->lock);
++	return rc;
++}
++
++static int gp_nway_reset(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	return mii_nway_restart(&gp->mii_if);
++}
++
++static u32 gp_get_link(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	return mii_link_ok(&gp->mii_if);
++}
++
++static u32 gp_get_msglevel(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	return gp->msg_enable;
++}
++
++static void gp_set_msglevel(struct net_device *dev, u32 value)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	gp->msg_enable = value;
++}
++
++static struct ethtool_ops gp_ethtool_ops = {
++	.get_drvinfo		= gp_get_drvinfo,
++	.get_settings		= gp_get_settings,
++	.set_settings		= gp_set_settings,
++	.nway_reset		= gp_nway_reset,
++	.get_link		= gp_get_link,
++	.get_msglevel		= gp_get_msglevel,
++	.set_msglevel		= gp_set_msglevel,
++};
++
++static int gt64240_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	struct mii_ioctl_data *data =
++	    (struct mii_ioctl_data *) &rq->ifr_data;
++	int retval;
++
++	if (!netif_running(dev))
++		return -EINVAL;
++
++	spin_lock_irq(&gp->lock);
++	retval = generic_mii_ioctl(&gp->mii_if, data, cmd, NULL);
++	spin_unlock_irq(&gp->lock);
++
++	return retval;
++}
++
++static void dump_tx_desc(struct net_device *dev, int i)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	gt64240_td_t *td = &gp->tx_ring[i];
++
++	printk("%s:tx[%d]: self=%p cmd=%08x, cnt=%4d. bufp=%08x, next=%08x\n",
++	       dev->name, i, td, td->cmdstat, td->byte_cnt, td->buff_ptr,
++	       td->next);
++}
++
++static void dump_rx_desc(struct net_device *dev, int i)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	gt64240_rd_t *rd = &gp->rx_ring[i];
++
++	printk("%s:rx_dsc[%d]: self=%p cst=%08x,size=%4d. cnt=%4d. "
++	       "bufp=%08x, next=%08x\n",
++	       dev->name, i, rd, rd->cmdstat, rd->buff_sz, rd->byte_cnt,
++	       rd->buff_ptr, rd->next);
++}
++
++// These routines work, just disabled to avoid compile warnings
++static void write_MII(struct net_device *dev, int phy, int reg, int data)
++{
++	u32 smir = (phy << smirPhyAdBit) | (reg << smirRegAdBit) | data;
++	int timedout = 20;
++
++	// wait for last operation to complete
++	while (GT64240_READ(GT64240_ETH_SMI_REG) & smirBusy) {
++		// snooze for 1 msec and check again
++		gt64240_delay(1);
++
++		if (--timedout == 0) {
++			printk("%s: write_MII busy timeout!!\n",
++			       dev->name);
++			return;
++		}
++	}
++
++	GT64240_WRITE(GT64240_ETH_SMI_REG, smir);
++}
++
++static void dump_MII(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int i, val;
++
++	for (i = 0; i < 7; i++) {
++		if ((val = read_MII(dev, gp->phy_addr, i)) >= 0)
++			printk("%s: MII Reg %d=%x\n", dev->name, i, val);
++	}
++	for (i = 16; i < 21; i++) {
++		if ((val = read_MII(dev, gp->phy_addr, i)) >= 0)
++			printk("%s: MII Reg %d=%x\n", dev->name, i, val);
++	}
++}
++
++
++static void dump_hw_addr(unsigned char *addr_str)
++{
++	int i;
++	for (i = 0; i < 6; i++) {
++		printk("%2.2x", addr_str[i]);
++		printk(i < 5 ? ":" : "\n");
++	}
++}
++
++static int gt64240_add_hash_entry(struct net_device *dev,
++				  unsigned char *addr)
++{
++	static unsigned char swapped[256];
++	struct gt64240_private *gp;
++	u32 value1, value0, *entry;
++	unsigned char hash_ea[6];
++	static int flag = 0;
++	u16 hashResult;
++	int i;
++
++	if (flag == 0) {	/* Create table to swap bits in a byte  */
++		flag = 1;
++		for (i = 0; i < 256; i++) {
++			swapped[i] = (i & 0x01) << 7;
++			swapped[i] |= (i & 0x02) << 5;
++			swapped[i] |= (i & 0x04) << 3;
++			swapped[i] |= (i & 0x08) << 1;
++			swapped[i] |= (i & 0x10) >> 1;
++			swapped[i] |= (i & 0x20) >> 3;
++			swapped[i] |= (i & 0x40) >> 5;
++			swapped[i] |= (i & 0x80) >> 7;
++		}
++	}
++
++	for (i = 0; i < 6; i++) {	/* swap bits from mac to create hash mac */
++		hash_ea[i] = swapped[addr[i]];
++	}
++
++	gp = netdev_priv(dev);
++
++	/* create hash entry address    */
++	hashResult = (((hash_ea[5] >> 2) & 0x3F) << 9) & 0x7E00;
++	hashResult |= ((hash_ea[4] & 0x7F) << 2) | (hash_ea[5] & 0x03);
++	hashResult ^=
++	    ((hash_ea[3] & 0xFF) << 1) | ((hash_ea[4] >> 7) & 0x01);
++	hashResult ^= ((hash_ea[1] & 0x01) << 8) | (hash_ea[2] & 0xFF);
++
++	value0 = hteValid | hteRD;	/* Create hash table entry value */
++	value0 |= (u32) addr[0] << 3;
++	value0 |= (u32) addr[1] << 11;
++	value0 |= (u32) addr[2] << 19;
++	value0 |= ((u32) addr[3] & 0x1f) << 27;
++
++	value1 = ((u32) addr[3] >> 5) & 0x07;
++	value1 |= (u32) addr[4] << 3;
++	value1 |= (u32) addr[5] << 11;
++
++	/* Inset entry value into hash table */
++	for (i = 0; i < HASH_HOP_NUMBER; i++) {
++		entry = (u32 *) ((u32) gp->hash_table +
++				 (((u32) hashResult & 0x07ff) << 3));
++		if ((*entry & hteValid) && !(*entry & hteSkip)) {
++			hashResult += 2;	/* oops, occupied, go to next entry */
++		} else {
++#ifdef __LITTLE_ENDIAN
++			entry[1] = value1;
++			entry[0] = value0;
++#else
++			entry[0] = value1;
++			entry[1] = value0;
++#endif
++			break;
++		}
++	}
++	if (i >= HASH_HOP_NUMBER) {
++		printk("%s: gt64240_add_hash_entry expired!\n", dev->name);
++		return (-1);
++	}
++	return (0);
++}
++
++
++static void read_mib_counters(struct gt64240_private *gp)
++{
++	u32 *mib_regs = (u32 *) & gp->mib;
++	int i;
++
++	for (i = 0; i < sizeof(mib_counters_t) / sizeof(u32); i++)
++		mib_regs[i] =
++		    GT64240ETH_READ(gp,
++				    GT64240_ETH_MIB_COUNT_BASE +
++				    i * sizeof(u32));
++}
++
++
++static void update_stats(struct gt64240_private *gp)
++{
++	mib_counters_t *mib = &gp->mib;
++	struct net_device_stats *stats = &gp->stats;
++
++	read_mib_counters(gp);
++
++	stats->rx_packets = mib->totalFramesReceived;
++	stats->tx_packets = mib->framesSent;
++	stats->rx_bytes = mib->totalByteReceived;
++	stats->tx_bytes = mib->byteSent;
++	stats->rx_errors = mib->totalFramesReceived - mib->framesReceived;
++	//the tx error counters are incremented by the ISR
++	//rx_dropped incremented by gt64240_rx
++	//tx_dropped incremented by gt64240_tx
++	stats->multicast = mib->multicastFramesReceived;
++	// collisions incremented by gt64240_tx_complete
++	stats->rx_length_errors = mib->oversizeFrames + mib->fragments;
++	// The RxError condition means the Rx DMA encountered a
++	// CPU owned descriptor, which, if things are working as
++	// they should, means the Rx ring has overflowed.
++	stats->rx_over_errors = mib->macRxError;
++	stats->rx_crc_errors = mib->cRCError;
++}
++
++static void abort(struct net_device *dev, u32 abort_bits)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int timedout = 100;	// wait up to 100 msec for hard stop to complete
++
++	if (gt64240_debug > 3)
++		printk("%s: abort\n", dev->name);
++
++	// Return if neither Rx or Tx abort bits are set
++	if (!(abort_bits & (sdcmrAR | sdcmrAT)))
++		return;
++
++	// make sure only the Rx/Tx abort bits are set
++	abort_bits &= (sdcmrAR | sdcmrAT);
++
++	spin_lock(&gp->lock);
++
++	// abort any Rx/Tx DMA immediately
++	GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM, abort_bits);
++
++	if (gt64240_debug > 3)
++		printk("%s: abort: SDMA cmd  = %x/%x\n",
++		       dev->name, abort_bits, GT64240ETH_READ(gp,
++							      GT64240_ETH_SDMA_COMM));
++
++	// wait for abort to complete
++	while ((GT64240ETH_READ(gp, GT64240_ETH_SDMA_COMM)) & abort_bits) {
++		// snooze for 20 msec and check again
++		gt64240_delay(1);
++
++		if (--timedout == 0) {
++			printk("%s: abort timeout!!\n", dev->name);
++			break;
++		}
++	}
++
++	spin_unlock(&gp->lock);
++}
++
++
++static void hard_stop(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++
++	if (gt64240_debug > 3)
++		printk("%s: hard stop\n", dev->name);
++
++	disable_ether_irq(dev);
++
++	abort(dev, sdcmrAR | sdcmrAT);
++
++	// disable port
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG, 0);
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_hard_stop: Port Config=%x\n",
++		       dev->name, GT64240ETH_READ(gp,
++						  GT64240_ETH_PORT_CONFIG));
++
++}
++
++static void gt64240_tx_complete(struct net_device *dev, u32 status)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int nextOut, cdp;
++	gt64240_td_t *td;
++	u32 cmdstat;
++
++	cdp = (GT64240ETH_READ(gp, GT64240_ETH_CURR_TX_DESC_PTR0)
++	       - gp->tx_ring_dma) / sizeof(gt64240_td_t);
++
++	if (gt64240_debug > 3) {	/*+prk17aug01 */
++		nextOut = gp->tx_next_out;
++		printk
++		    ("%s: tx_complete: TX_PTR0=0x%08x, cdp=%d. nextOut=%d.\n",
++		     dev->name, GT64240ETH_READ(gp,
++						GT64240_ETH_CURR_TX_DESC_PTR0),
++		     cdp, nextOut);
++		td = &gp->tx_ring[nextOut];
++	}
++
++/*** NEED to check and CLEAR these errors every time thru here: ***/
++	if (gt64240_debug > 2) {
++		if (GT64240_READ(COMM_UNIT_INTERRUPT_CAUSE))
++			printk
++			    ("%s: gt64240_tx_complete: CIU Cause=%08x, Mask=%08x, EAddr=%08x\n",
++			     dev->name,
++			     GT64240_READ(COMM_UNIT_INTERRUPT_CAUSE),
++			     GT64240_READ(COMM_UNIT_INTERRUPT_MASK),
++			     GT64240_READ(COMM_UNIT_ERROR_ADDRESS));
++		GT64240_WRITE(COMM_UNIT_INTERRUPT_CAUSE, 0);
++	}
++	// Continue until we reach the current descriptor pointer
++	for (nextOut = gp->tx_next_out; nextOut != cdp;
++	     nextOut = (nextOut + 1) % TX_RING_SIZE) {
++
++		if (--gp->intr_work_done == 0)
++			break;
++
++		td = &gp->tx_ring[nextOut];
++		cmdstat = td->cmdstat;
++
++		if (cmdstat & (u32) txOwn) {
++			// DMA is not finished writing descriptor???
++			// Leave and come back later to pick-up where we left off.
++			break;
++		}
++		// increment Tx error stats
++		if (cmdstat & (u32) txErrorSummary) {
++			if (gt64240_debug > 2)
++				printk
++				    ("%s: tx_complete: Tx error, cmdstat = %x\n",
++				     dev->name, cmdstat);
++			gp->stats.tx_errors++;
++			if (cmdstat & (u32) txReTxLimit)
++				gp->stats.tx_aborted_errors++;
++			if (cmdstat & (u32) txUnderrun)
++				gp->stats.tx_fifo_errors++;
++			if (cmdstat & (u32) txLateCollision)
++				gp->stats.tx_window_errors++;
++		}
++
++		if (cmdstat & (u32) txCollision)
++			gp->stats.collisions +=
++			    (unsigned long) ((cmdstat & txReTxCntMask) >>
++					     txReTxCntBit);
++
++		// Wake the queue if the ring was full
++		if (gp->tx_full) {
++			gp->tx_full = 0;
++			if (gp->last_psr & psrLink) {
++				netif_wake_queue(dev);
++			}
++		}
++		// decrement tx ring buffer count
++		if (gp->tx_count)
++			gp->tx_count--;
++
++		// free the skb
++		if (gp->tx_skbuff[nextOut]) {
++			if (gt64240_debug > 3)
++				printk
++				    ("%s: tx_complete: good Tx, skb=%p\n",
++				     dev->name, gp->tx_skbuff[nextOut]);
++			dev_kfree_skb_irq(gp->tx_skbuff[nextOut]);
++			gp->tx_skbuff[nextOut] = NULL;
++		} else {
++			printk("%s: tx_complete: no skb!\n", dev->name);
++		}
++	}
++
++	gp->tx_next_out = nextOut;
++
++	if ((status & icrTxEndLow) && gp->tx_count != 0) {
++		// we must restart the DMA
++		GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM,
++				 sdcmrERD | sdcmrTXDL);
++	}
++}
++
++static irqreturn_t gt64240_interrupt(int irq, void *dev_id,
++	struct pt_regs *regs)
++{
++	struct net_device *dev = (struct net_device *) dev_id;
++	struct gt64240_private *gp = netdev_priv(dev);
++	u32 status;
++
++	if (dev == NULL) {
++		printk("%s: isr: null dev ptr\n", dev->name);
++		return IRQ_NONE;
++	}
++
++	spin_lock(&gp->lock);
++
++	if (gt64240_debug > 3)
++		printk("%s: isr: entry\n", dev->name);
++
++	gp->intr_work_done = max_interrupt_work;
++
++	while (gp->intr_work_done > 0) {
++
++		status = GT64240ETH_READ(gp, GT64240_ETH_INT_CAUSE);
++#ifdef GT64240_NAPI
++		/* dont ack Rx interrupts */
++		if (!(status & icrRxBuffer))
++			GT64240ETH_WRITE(gp, GT64240_ETH_INT_CAUSE, 0);
++#else
++		// ACK interrupts
++		GT64240ETH_WRITE(gp, GT64240_ETH_INT_CAUSE, 0);
++#endif
++
++		if (gt64240_debug > 3)
++			printk("%s: isr: work=%d., icr=%x\n", dev->name,
++			       gp->intr_work_done, status);
++
++		if ((status & icrEtherIntSum) == 0) {
++			if (!(status &
++			      (icrTxBufferLow | icrTxBufferHigh |
++			       icrRxBuffer))) {
++				/* exit from the while() loop */
++				break;
++			}
++		}
++
++		if (status & icrMIIPhySTC) {
++			u32 psr =
++			    GT64240ETH_READ(gp, GT64240_ETH_PORT_STATUS);
++			if (gp->last_psr != psr) {
++				printk("%s: port status: 0x%08x\n",
++				       dev->name, psr);
++				printk
++				    ("%s:    %s MBit/s, %s-duplex, flow-control %s, link is %s,\n",
++				     dev->name,
++				     psr & psrSpeed ? "100" : "10",
++				     psr & psrDuplex ? "full" : "half",
++				     psr & psrFctl ? "disabled" :
++				     "enabled",
++				     psr & psrLink ? "up" : "down");
++				printk
++				    ("%s:    TxLowQ is %s, TxHighQ is %s, Transmitter is %s\n",
++				     dev->name,
++				     psr & psrTxLow ? "running" :
++				     "stopped",
++				     psr & psrTxHigh ? "running" :
++				     "stopped",
++				     psr & psrTxInProg ? "on" : "off");
++
++				if ((psr & psrLink) && !gp->tx_full &&
++				    netif_queue_stopped(dev)) {
++					printk
++					    ("%s: isr: Link up, waking queue.\n",
++					     dev->name);
++					netif_wake_queue(dev);
++				} else if (!(psr & psrLink)
++					   && !netif_queue_stopped(dev)) {
++					printk
++					    ("%s: isr: Link down, stopping queue.\n",
++					     dev->name);
++					netif_stop_queue(dev);
++				}
++
++				gp->last_psr = psr;
++			}
++		}
++
++		if (status & (icrTxBufferLow | icrTxEndLow))
++			gt64240_tx_complete(dev, status);
++
++		if (status & icrRxBuffer) {
++#ifdef GT64240_NAPI
++			if (netif_rx_schedule_prep(dev)) {
++				disable_ether_irq(dev);
++				__netif_rx_schedule(dev);
++			}
++#else
++			gt64240_rx(dev, status);
++#endif
++		}
++		// Now check TX errors (RX errors were handled in gt64240_rx)
++		if (status & icrTxErrorLow) {
++			printk("%s: isr: Tx resource error\n", dev->name);
++		}
++
++		if (status & icrTxUdr) {
++			printk("%s: isr: Tx underrun error\n", dev->name);
++		}
++	}
++
++	if (gp->intr_work_done == 0) {
++		// ACK any remaining pending interrupts
++		GT64240ETH_WRITE(gp, GT64240_ETH_INT_CAUSE, 0);
++		if (gt64240_debug > 3)
++			printk("%s: isr: hit max work\n", dev->name);
++	}
++
++	if (gt64240_debug > 3)
++		printk("%s: isr: exit, icr=%x\n",
++		       dev->name, GT64240ETH_READ(gp,
++						  GT64240_ETH_INT_CAUSE));
++
++	spin_unlock(&gp->lock);
++
++	return IRQ_HANDLED;
++}
++
++static void enable_ether_irq(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	u32 intMask;
++
++	intMask =
++	    icrTxBufferLow | icrTxEndLow | icrTxErrorLow |
++	    icrTxBufferHigh | icrTxEndHigh | icrTxErrorHigh | icrTxUdr |
++	    icrRxBuffer | icrRxOVR | icrRxError | icrMIIPhySTC |
++	    icrEtherIntSum;
++
++
++//- GT64240ETH_WRITE(gp, GT64240_ETH_INT_CAUSE, 0); /* CLEAR existing ints */
++	// unmask device interrupts:
++	GT64240ETH_WRITE(gp, GT64240_ETH_INT_MASK, intMask);
++
++	// now route ethernet interrupts to GT PCI1 (eth0 and eth1 will be
++	// sharing it).
++	intMask = MV_READ(PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH);
++	intMask |= 1 << gp->port_num;
++	MV_WRITE(PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH, intMask);
++}
++
++static void disable_ether_irq(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	u32 intMask;
++
++	intMask = MV_READ(PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH);
++	intMask &= ~(1 << gp->port_num);
++	MV_WRITE(PCI_1INTERRUPT_CAUSE_MASK_REGISTER_HIGH, intMask);
++
++	// mask all device interrupts: 
++	GT64240ETH_WRITE(gp, GT64240_ETH_INT_MASK, 0);
++}
++
++/*
++ * Probe for a GT64240 ethernet controller.
++ */
++static int __init gt64240_probe(void)
++{
++	int found = 0;
++	int i;
++
++	parse_mac_addr_options();
++
++	for (i = 0; i < NUM_INTERFACES; i++) {
++		unsigned long base_addr = gt64240_iflist[i].port;
++
++		if (check_region(base_addr, GT64240_ETH_IO_SIZE)) {
++			printk("gt64240_probe: ioaddr 0x%lx taken?\n",
++			       base_addr);
++			continue;
++		}
++
++		if (gt64240_probe1(base_addr, gt64240_iflist[i].irq, i) == 0) {
++			/*
++			 * Does not seem to be the "traditional" way folks do
++			 * this, but I want to init both eth ports if at all
++			 * possible!
++			 *
++			 * So, until I find out the "correct" way to do this:
++			 */
++			if (++found == NUM_INTERFACES)	/* That's all of them */
++				return 0;
++		}
++	}
++
++	if (found)
++		return 0;	/* as long as we found at least one! */
++
++	return -ENODEV;
++}
++
++module_init(gt64240_probe);
++
++static int __init gt64240_probe1(unsigned long ioaddr, int irq, int port_num)
++{
++	struct net_device *dev = NULL;
++	static unsigned version_printed = 0;
++	struct gt64240_private *gp = NULL;
++	int retval;
++	u32 cpuConfig;
++
++	dev = alloc_etherdev(sizeof(struct gt64240_private));
++	if (!dev)
++		return -ENOMEM;
++
++	if (irq < 0) {
++		printk
++		    ("gt64240_probe1: irq unknown - probing not supported\n");
++		return -ENODEV;
++	}
++#if 1				/* KLUDGE Alert: no check on return value: */
++	if (!request_region(ioaddr, GT64240_ETH_IO_SIZE, "gt64240eth"))
++		printk("*** request_region() failed!\n");
++#endif
++
++	cpuConfig = GT64240_READ(CPU_CONFIGURATION);
++	printk("gt64240_probe1: cpu in %s-endian mode\n",
++	       (cpuConfig & (1 << 12)) ? "little" : "big");
++
++	printk("%s: GT64240 found at ioaddr 0x%lx, irq %d.\n",
++	       dev->name, ioaddr, irq);
++
++	if (gt64240_debug && version_printed++ == 0)
++		printk("%s: %s", dev->name, version);
++
++	/* private struct aligned and zeroed by init_etherdev */
++	/* Fill in the 'dev' fields. */
++	dev->base_addr = ioaddr;
++	dev->irq = irq;
++	memcpy(dev->dev_addr, gt64240_station_addr[port_num],
++	       sizeof(dev->dev_addr));
++
++	printk("%s: HW Address ", dev->name);
++	dump_hw_addr(dev->dev_addr);
++
++	gp = dev->priv;
++
++	gp->msg_enable = (debug < 0 ? GT64240_MSG_ENABLE : debug);
++	gp->port_num = port_num;
++	gp->io_size = GT64240_ETH_IO_SIZE;
++	gp->port_offset = port_num * GT64240_ETH_IO_SIZE;
++	gp->phy_addr = gt64240_phy_addr[port_num];
++
++	printk("%s: GT64240 ethernet port %d\n", dev->name, gp->port_num);
++
++#ifdef GT64240_NAPI
++	printk("Rx NAPI supported \n");
++#endif
++
++/* MII Initialization */
++	gp->mii_if.dev = dev;
++	gp->mii_if.phy_id = dev->base_addr;
++	gp->mii_if.mdio_read = read_MII;
++	gp->mii_if.mdio_write = write_MII;
++	gp->mii_if.advertising = read_MII(dev, gp->phy_addr, MII_ADVERTISE);
++
++	// Allocate Rx and Tx descriptor rings
++	if (gp->rx_ring == NULL) {
++		// All descriptors in ring must be 16-byte aligned
++		gp->rx_ring = dma_alloc_noncoherent(NULL,
++					sizeof(gt64240_rd_t) * RX_RING_SIZE +
++					sizeof(gt64240_td_t) * TX_RING_SIZE,
++					&gp->rx_ring_dma, GFP_KERNEL);
++		if (gp->rx_ring == NULL) {
++			retval = -ENOMEM;
++			goto free_region;
++		}
++
++		gp->tx_ring = (gt64240_td_t *) (gp->rx_ring + RX_RING_SIZE);
++		gp->tx_ring_dma =
++			gp->rx_ring_dma + sizeof(gt64240_rd_t) * RX_RING_SIZE;
++	}
++	// Allocate the Rx Data Buffers
++	if (gp->rx_buff == NULL) {
++		gp->rx_buff = dma_alloc_coherent(NULL,
++				PKT_BUF_SZ * RX_RING_SIZE, &gp->rx_buff_dma,
++				GFP_KERNEL);
++		if (gp->rx_buff == NULL) {
++			dma_free_noncoherent(NULL,
++				sizeof(gt64240_rd_t) * RX_RING_SIZE +
++				sizeof(gt64240_td_t) * TX_RING_SIZE,
++				gp->rx_ring, gp->rx_ring_dma);
++			retval = -ENOMEM;
++			goto free_region;
++		}
++	}
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_probe1, rx_ring=%p, tx_ring=%p\n",
++		       dev->name, gp->rx_ring, gp->tx_ring);
++
++	// Allocate Rx Hash Table
++	if (gp->hash_table == NULL) {
++		gp->hash_table = dma_alloc_coherent(NULL,
++				RX_HASH_TABLE_SIZE, &gp->hash_table_dma,
++				GFP_KERNEL);
++		if (gp->hash_table == NULL) {
++			dma_free_noncoherent(NULL,
++				sizeof(gt64240_rd_t) * RX_RING_SIZE +
++				sizeof(gt64240_td_t) * TX_RING_SIZE,
++				gp->rx_ring, gp->rx_ring_dma);
++			dma_free_noncoherent(NULL, PKT_BUF_SZ * RX_RING_SIZE,
++				gp->rx_buff, gp->rx_buff_dma);
++			retval = -ENOMEM;
++			goto free_region;
++		}
++	}
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_probe1, hash=%p\n",
++		       dev->name, gp->hash_table);
++
++	spin_lock_init(&gp->lock);
++
++	dev->open = gt64240_open;
++	dev->hard_start_xmit = gt64240_tx;
++	dev->stop = gt64240_close;
++	dev->get_stats = gt64240_get_stats;
++	dev->do_ioctl = gt64240_ioctl;
++	dev->set_multicast_list = gt64240_set_rx_mode;
++	dev->tx_timeout = gt64240_tx_timeout;
++	dev->watchdog_timeo = GT64240ETH_TX_TIMEOUT;
++
++#ifdef GT64240_NAPI
++	dev->poll = gt64240_poll;
++	dev->weight = 64;
++#endif
++	dev->ethtool_ops = &gp_ethtool_ops;
++
++	/* Fill in the fields of the device structure with ethernet values. */
++	return 0;
++
++free_region:
++	release_region(ioaddr, gp->io_size);
++	unregister_netdev(dev);
++	free_netdev(dev);
++	printk("%s: gt64240_probe1 failed.  Returns %d\n",
++	       dev->name, retval);
++	return retval;
++}
++
++
++static void reset_tx(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int i;
++
++	abort(dev, sdcmrAT);
++
++	for (i = 0; i < TX_RING_SIZE; i++) {
++		if (gp->tx_skbuff[i]) {
++			if (in_interrupt())
++				dev_kfree_skb_irq(gp->tx_skbuff[i]);
++			else
++				dev_kfree_skb(gp->tx_skbuff[i]);
++			gp->tx_skbuff[i] = NULL;
++		}
++//-     gp->tx_ring[i].cmdstat = 0; // CPU owns
++		gp->tx_ring[i].cmdstat =
++		    (u32) (txGenCRC | txEI | txPad | txFirst | txLast);
++		gp->tx_ring[i].byte_cnt = 0;
++		gp->tx_ring[i].buff_ptr = 0;
++		gp->tx_ring[i].next =
++		    gp->tx_ring_dma + sizeof(gt64240_td_t) * (i + 1);
++		if (gt64240_debug > 4)
++			dump_tx_desc(dev, i);
++	}
++	/* Wrap the ring. */
++	gp->tx_ring[i - 1].next = gp->tx_ring_dma;
++	if (gt64240_debug > 4)
++		dump_tx_desc(dev, i - 1);
++
++	// setup only the lowest priority TxCDP reg
++	GT64240ETH_WRITE(gp, GT64240_ETH_CURR_TX_DESC_PTR0,
++			 gp->tx_ring_dma);
++//- GT64240ETH_WRITE(gp, GT64240_ETH_CURR_TX_DESC_PTR0, 0);     /* ROLLINS */
++//- GT64240ETH_WRITE(gp, GT64240_ETH_CURR_TX_DESC_PTR0,virt_to_phys(&gp->tx_ring[0]));  /* ROLLINS */
++
++	GT64240ETH_WRITE(gp, GT64240_ETH_CURR_TX_DESC_PTR1, 0);
++
++	// init Tx indeces and pkt counter
++	gp->tx_next_in = gp->tx_next_out = 0;
++	gp->tx_count = 0;
++}
++
++static void reset_rx(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int i;
++
++	abort(dev, sdcmrAR);
++
++	for (i = 0; i < RX_RING_SIZE; i++) {
++		gp->rx_ring[i].next =
++		    gp->rx_ring_dma + sizeof(gt64240_rd_t) * (i + 1);
++		gp->rx_ring[i].buff_ptr = gp->rx_buff_dma + i * PKT_BUF_SZ;
++		gp->rx_ring[i].buff_sz = PKT_BUF_SZ;
++		gp->rx_ring[i].byte_cnt = 0;	/* just for debug printk's */
++		// Give ownership to device, set first and last, enable interrupt
++		gp->rx_ring[i].cmdstat =
++		    (uint32_t) (rxFirst | rxLast | rxOwn | rxEI);
++		if (gt64240_debug > 4)
++			dump_rx_desc(dev, i);
++	}
++	/* Wrap the ring. */
++	gp->rx_ring[i - 1].next = gp->rx_ring_dma;
++	if (gt64240_debug > 4)
++		dump_rx_desc(dev, i - 1);
++
++	// Setup only the lowest priority RxFDP and RxCDP regs
++	for (i = 0; i < 4; i++) {
++		if (i == 0) {
++			GT64240ETH_WRITE(gp, GT64240_ETH_1ST_RX_DESC_PTR0,
++					 gp->rx_ring_dma);
++			GT64240ETH_WRITE(gp, GT64240_ETH_CURR_RX_DESC_PTR0,
++					 gp->rx_ring_dma);
++		} else {
++			GT64240ETH_WRITE(gp,
++					 GT64240_ETH_1ST_RX_DESC_PTR0 +
++					 i * 4, 0);
++			GT64240ETH_WRITE(gp,
++					 GT64240_ETH_CURR_RX_DESC_PTR0 +
++					 i * 4, 0);
++		}
++	}
++
++	// init Rx NextOut index
++	gp->rx_next_out = 0;
++}
++
++
++static int gt64240_init(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++
++	if (gt64240_debug > 3) {
++		printk("%s: gt64240_init: dev=%p\n", dev->name, dev);
++		printk("%s: gt64240_init: scs0_lo=%04x, scs0_hi=%04x\n",
++		       dev->name, GT64240_READ(0x008),
++		       GT64240_READ(0x010));
++		printk("%s: gt64240_init: scs1_lo=%04x, scs1_hi=%04x\n",
++		       dev->name, GT64240_READ(0x208),
++		       GT64240_READ(0x210));
++		printk("%s: gt64240_init: scs2_lo=%04x, scs2_hi=%04x\n",
++		       dev->name, GT64240_READ(0x018),
++		       GT64240_READ(0x020));
++		printk("%s: gt64240_init: scs3_lo=%04x, scs3_hi=%04x\n",
++		       dev->name, GT64240_READ(0x218),
++		       GT64240_READ(0x220));
++	}
++	// Stop and disable Port
++	hard_stop(dev);
++
++	GT64240_WRITE(COMM_UNIT_INTERRUPT_MASK, 0x07070777);	/*+prk21aug01 */
++	if (gt64240_debug > 2)
++		printk
++		    ("%s: gt64240_init: CIU Cause=%08x, Mask=%08x, EAddr=%08x\n",
++		     dev->name, GT64240_READ(COMM_UNIT_INTERRUPT_CAUSE),
++		     GT64240_READ(COMM_UNIT_INTERRUPT_MASK),
++		     GT64240_READ(COMM_UNIT_ERROR_ADDRESS));
++
++	// Set-up hash table
++	memset(gp->hash_table, 0, RX_HASH_TABLE_SIZE);	// clear it
++	gp->hash_mode = 0;
++	// Add a single entry to hash table - our ethernet address
++	gt64240_add_hash_entry(dev, dev->dev_addr);
++	// Set-up DMA ptr to hash table
++	GT64240ETH_WRITE(gp, GT64240_ETH_HASH_TBL_PTR, gp->hash_table_dma);
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: Hash Tbl Ptr=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_HASH_TBL_PTR));
++
++	// Setup Tx
++	reset_tx(dev);
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: Curr Tx Desc Ptr0=%x\n",
++		       dev->name, GT64240ETH_READ(gp,
++						  GT64240_ETH_CURR_TX_DESC_PTR0));
++
++	// Setup Rx
++	reset_rx(dev);
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: 1st/Curr Rx Desc Ptr0=%x/%x\n",
++		       dev->name, GT64240ETH_READ(gp,
++						  GT64240_ETH_1ST_RX_DESC_PTR0),
++		       GT64240ETH_READ(gp, GT64240_ETH_CURR_RX_DESC_PTR0));
++
++	if (gt64240_debug > 3)
++		dump_MII(dev);
++
++	/* force a PHY reset -- self-clearing! */
++	write_MII(dev, gp->phy_addr, 0, 0x8000);
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: PhyAD=%x\n", dev->name,
++		       GT64240_READ(GT64240_ETH_PHY_ADDR_REG));
++
++	// setup DMA
++	// We want the Rx/Tx DMA to write/read data to/from memory in
++	// Big Endian mode. Also set DMA Burst Size to 8 64Bit words.
++#ifdef DESC_DATA_BE
++	GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_CONFIG,
++			 (0xf << sdcrRCBit) | sdcrRIFB | (3 <<
++							  sdcrBSZBit));
++#else
++	GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_CONFIG, sdcrBLMR | sdcrBLMT |
++//-                  (0xf<<sdcrRCBit) | sdcrRIFB | (3<<sdcrBSZBit));
++			 (0xf << sdcrRCBit) | sdcrRIFB | (2 <<
++							  sdcrBSZBit));
++#endif
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: SDMA Config=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_SDMA_CONFIG));
++
++#if 0
++	// start Rx DMA
++	GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM, sdcmrERD);
++#endif
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: SDMA Cmd =%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_SDMA_COMM));
++
++#if 1
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG, PORT_CONFIG);
++#endif
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: Port Config=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_PORT_CONFIG));
++
++	/*
++	 * Disable all Type-of-Service queueing. All Rx packets will be
++	 * treated normally and will be sent to the lowest priority
++	 * queue.
++	 *
++	 * Disable flow-control for now. FIX! support flow control?
++	 */
++
++#if 1
++	// clear all the MIB ctr regs
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG_EXT,
++			 EXT_CONFIG_CLEAR);
++	read_mib_counters(gp);
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG_EXT,
++			 EXT_CONFIG_CLEAR | pcxrMIBclrMode);
++
++#endif
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: Port Config Ext=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_PORT_CONFIG_EXT));
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: Port Command=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_PORT_COMMAND));
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_COMMAND, 0x0);
++
++	netif_start_queue(dev);
++
++	/* enable the port */
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG,
++			 (PORT_CONFIG | pcrEN));
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_init: Port Config=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_PORT_CONFIG));
++#if 1
++	// start Rx DMA
++	GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM, sdcmrERD);
++#endif
++
++
++	// enable interrupts
++	enable_ether_irq(dev);
++
++//---    gp->last_psr |= psrLink;   /* KLUDGE ALERT */
++
++	// we should now be receiving frames
++	return 0;
++}
++
++
++static int gt64240_open(struct net_device *dev)
++{
++	int retval;
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_open: dev=%p\n", dev->name, dev);
++
++	if ((retval = request_irq(dev->irq, &gt64240_interrupt,
++				  SA_SHIRQ, dev->name, dev))) {
++		printk("%s: unable to get IRQ %d\n", dev->name, dev->irq);
++
++		return retval;
++	}
++	// Initialize and startup the GT-64240 ethernet port
++	if ((retval = gt64240_init(dev))) {
++		printk("%s: error in gt64240_open\n", dev->name);
++		free_irq(dev->irq, dev);
++
++		return retval;
++	}
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_open: Initialization done.\n",
++		       dev->name);
++
++	return 0;
++}
++
++static int gt64240_close(struct net_device *dev)
++{
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_close: dev=%p\n", dev->name, dev);
++
++	// stop the device
++	if (netif_device_present(dev)) {
++		netif_stop_queue(dev);
++		hard_stop(dev);
++	}
++
++	free_irq(dev->irq, dev);
++
++	return 0;
++}
++
++#ifdef GT64240_NAPI
++/*
++ * Function will release Tx skbs which are now complete
++ */
++static void gt64240_tx_fill(struct net_device *dev, u32 status)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	int nextOut, cdp;
++	gt64240_td_t *td;
++	u32 cmdstat;
++
++	cdp = (GT64240ETH_READ(gp, GT64240_ETH_CURR_TX_DESC_PTR0)
++	       - gp->tx_ring_dma) / sizeof(gt64240_td_t);
++
++	for (nextOut = gp->tx_next_out; nextOut != cdp;
++	     nextOut = (nextOut + 1) % TX_RING_SIZE) {
++		if (--gp->intr_work_done == 0)
++			break;
++
++		td = &gp->tx_ring[nextOut];
++		cmdstat = td->cmdstat;
++
++		if (cmdstat & (u32) txOwn)
++			break;
++
++		if (gp->tx_full) {
++			gp->tx_full = 0;
++			if (gp->last_psr & psrLink) {
++				netif_wake_queue(dev);
++			}
++		}
++		// decrement tx ring buffer count
++		if (gp->tx_count)
++			gp->tx_count--;
++
++		// free the skb
++		if (gp->tx_skbuff[nextOut]) {
++			dev_kfree_skb_irq(gp->tx_skbuff[nextOut]);
++			gp->tx_skbuff[nextOut] = NULL;
++		}
++	}
++
++	gp->tx_next_out = nextOut;
++
++	if ((status & icrTxEndLow) && gp->tx_count != 0)
++		// we must restart the DMA
++		GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM,
++				 sdcmrERD | sdcmrTXDL);
++}
++
++/*
++ * Main function for NAPI
++ */
++static int gt64240_poll(struct net_device *dev, int *budget)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	unsigned long flags;
++	int done = 1, orig_budget, work_done;
++	u32 status = GT64240ETH_READ(gp, GT64240_ETH_INT_CAUSE);
++
++	spin_lock_irqsave(&gp->lock, flags);
++	gt64240_tx_fill(dev, status);
++
++	if (GT64240ETH_READ(gp, GT64240_ETH_CURR_RX_DESC_PTR0) !=
++	    gp->rx_next_out) {
++		orig_budget = *budget;
++		if (orig_budget > dev->quota)
++			orig_budget = dev->quota;
++
++		work_done = gt64240_rx(dev, status, orig_budget);
++		*budget -= work_done;
++		dev->quota -= work_done;
++		if (work_done >= orig_budget)
++			done = 0;
++		if (done) {
++			__netif_rx_complete(dev);
++			enable_ether_irq(dev);
++		}
++	}
++
++	spin_unlock_irqrestore(&gp->lock, flags);
++
++	return (done ? 0 : 1);
++}
++#endif
++
++static int gt64240_tx(struct sk_buff *skb, struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	unsigned long flags;
++	int nextIn;
++
++	spin_lock_irqsave(&gp->lock, flags);
++
++	nextIn = gp->tx_next_in;
++
++	if (gt64240_debug > 3) {
++		printk("%s: gt64240_tx: nextIn=%d.\n", dev->name, nextIn);
++	}
++
++	if (gp->tx_count >= TX_RING_SIZE) {
++		printk("%s: Tx Ring full, pkt dropped.\n", dev->name);
++		gp->stats.tx_dropped++;
++		spin_unlock_irqrestore(&gp->lock, flags);
++		return 1;
++	}
++
++	if (!(gp->last_psr & psrLink)) {
++		printk("%s: gt64240_tx: Link down, pkt dropped.\n",
++		       dev->name);
++		gp->stats.tx_dropped++;
++		spin_unlock_irqrestore(&gp->lock, flags);
++//---   dump_MII(dev);          /* KLUDGE ALERT !!! */
++		return 1;
++	}
++
++	if (gp->tx_ring[nextIn].cmdstat & txOwn) {
++		printk
++		    ("%s: gt64240_tx: device owns descriptor, pkt dropped.\n",
++		     dev->name);
++		gp->stats.tx_dropped++;
++		// stop the queue, so Tx timeout can fix it
++		netif_stop_queue(dev);
++		spin_unlock_irqrestore(&gp->lock, flags);
++		return 1;
++	}
++	// Prepare the Descriptor at tx_next_in
++	gp->tx_skbuff[nextIn] = skb;
++	gp->tx_ring[nextIn].byte_cnt = skb->len;
++	gp->tx_ring[nextIn].buff_ptr = virt_to_phys(skb->data);
++
++	// make sure packet gets written back to memory
++	dma_cache_wback_inv((unsigned long) (skb->data), skb->len);
++	mb();
++
++	// Give ownership to device, set first and last desc, enable interrupt
++	// Setting of ownership bit must be *last*!
++	gp->tx_ring[nextIn].cmdstat =
++	    txOwn | txGenCRC | txEI | txPad | txFirst | txLast;
++
++	if (gt64240_debug > 5) {
++		dump_tx_desc(dev, nextIn);
++	}
++	// increment tx_next_in with wrap
++	gp->tx_next_in = (nextIn + 1) % TX_RING_SIZE;
++
++//+prk20aug01:
++	if (0) {		/* ROLLINS */
++		GT64240ETH_WRITE(gp, GT64240_ETH_CURR_TX_DESC_PTR0,
++				 virt_to_phys(&gp->tx_ring[nextIn]));
++	}
++
++	if (gt64240_debug > 3) {	/*+prk17aug01 */
++		printk
++		    ("%s: gt64240_tx: TX_PTR0=0x%08x, EthPortStatus=0x%08x\n",
++		     dev->name, GT64240ETH_READ(gp,
++						GT64240_ETH_CURR_TX_DESC_PTR0),
++		     GT64240ETH_READ(gp, GT64240_ETH_PORT_STATUS));
++	}
++	// If DMA is stopped, restart
++	if (!((GT64240ETH_READ(gp, GT64240_ETH_PORT_STATUS)) & psrTxLow)) {
++		GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM,
++				 sdcmrERD | sdcmrTXDL);
++	}
++
++	if (gt64240_debug > 3) {	/*+prk17aug01 */
++		printk
++		    ("%s: gt64240_tx: TX_PTR0=0x%08x, EthPortStatus=0x%08x\n",
++		     dev->name, GT64240ETH_READ(gp,
++						GT64240_ETH_CURR_TX_DESC_PTR0),
++		     GT64240ETH_READ(gp, GT64240_ETH_PORT_STATUS));
++	}
++	// increment count and stop queue if full
++	if (++gp->tx_count >= TX_RING_SIZE) {
++		gp->tx_full = 1;
++		netif_stop_queue(dev);
++	}
++
++	dev->trans_start = jiffies;
++	spin_unlock_irqrestore(&gp->lock, flags);
++
++	return 0;
++}
++
++
++static int
++#ifdef GT64240_NAPI
++gt64240_rx(struct net_device *dev, u32 status, int budget)
++#else
++gt64240_rx(struct net_device *dev, u32 status)
++#endif
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	struct sk_buff *skb;
++	int pkt_len, nextOut, cdp;
++	gt64240_rd_t *rd;
++	u32 cmdstat;
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_rx: dev=%p, status=%x\n",
++		       dev->name, dev, status);
++
++	cdp = (GT64240ETH_READ(gp, GT64240_ETH_CURR_RX_DESC_PTR0)
++	       - gp->rx_ring_dma) / sizeof(gt64240_rd_t);
++
++	// Continue until we reach the current descriptor pointer
++	for (nextOut = gp->rx_next_out; nextOut != cdp;
++	     nextOut = (nextOut + 1) % RX_RING_SIZE) {
++
++#ifdef GT64240_NAPI
++		if (budget <= 0)
++			break;
++
++		budget--;
++#endif
++
++		if (--gp->intr_work_done == 0)
++			break;
++
++		if (gt64240_debug > 4)
++			dump_rx_desc(dev, nextOut);
++
++		rd = &gp->rx_ring[nextOut];
++		cmdstat = rd->cmdstat;
++
++		if (gt64240_debug > 3)
++			printk("%s: isr: Rx desc cmdstat=%x, nextOut=%d\n",
++			       dev->name, cmdstat, nextOut);
++
++		if (cmdstat & (u32) rxOwn) {
++			if (gt64240_debug > 2)
++				printk
++				    ("%s: gt64240_rx: device owns descriptor!\n",
++				     dev->name);
++			// DMA is not finished updating descriptor???
++			// Leave and come back later to pick-up where we left off.
++			break;
++		}
++		// must be first and last (ie only) buffer of packet
++		if (!(cmdstat & (u32) rxFirst)
++		    || !(cmdstat & (u32) rxLast)) {
++			printk
++			    ("%s: gt64240_rx: desc not first and last!\n",
++			     dev->name);
++			cmdstat |= (u32) rxOwn;
++			rd->cmdstat = cmdstat;
++			continue;
++		}
++		// Drop this received pkt if there were any errors
++		if ((cmdstat & (u32) rxErrorSummary)
++		    || (status & icrRxError)) {
++			// update the detailed rx error counters that are not covered
++			// by the MIB counters.
++			if (cmdstat & (u32) rxOverrun)
++				gp->stats.rx_fifo_errors++;
++			cmdstat |= (u32) rxOwn;
++			rd->cmdstat = cmdstat;
++			continue;
++		}
++
++		pkt_len = rd->byte_cnt;
++
++		/* Create new skb. */
++//      skb = dev_alloc_skb(pkt_len+2);
++		skb = dev_alloc_skb(1538);
++		if (skb == NULL) {
++			printk("%s: Memory squeeze, dropping packet.\n",
++			       dev->name);
++			gp->stats.rx_dropped++;
++			cmdstat |= (u32) rxOwn;
++			rd->cmdstat = cmdstat;
++			continue;
++		}
++		skb->dev = dev;
++		skb_reserve(skb, 2);	/* 16 byte IP header align */
++		memcpy(skb_put(skb, pkt_len),
++		       &gp->rx_buff[nextOut * PKT_BUF_SZ], pkt_len);
++		skb->protocol = eth_type_trans(skb, dev);
++
++		/* NIC performed some checksum computation */
++		skb->ip_summed = CHECKSUM_UNNECESSARY;
++#ifdef GT64240_NAPI
++		netif_receive_skb(skb);
++#else
++		netif_rx(skb);	/* pass the packet to upper layers */
++#endif
++
++		// now we can release ownership of this desc back to device
++		cmdstat |= (u32) rxOwn;
++		rd->cmdstat = cmdstat;
++
++		dev->last_rx = jiffies;
++	}
++
++	if (gt64240_debug > 3 && nextOut == gp->rx_next_out)
++		printk("%s: gt64240_rx: RxCDP did not increment?\n",
++		       dev->name);
++
++	gp->rx_next_out = nextOut;
++	return 0;
++}
++
++
++static void gt64240_tx_timeout(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	unsigned long flags;
++
++	spin_lock_irqsave(&gp->lock, flags);
++
++
++	if (!(gp->last_psr & psrLink)) {
++		spin_unlock_irqrestore(&gp->lock, flags);
++	} else {
++		printk("======------> gt64240_tx_timeout: %d jiffies \n",
++		       GT64240ETH_TX_TIMEOUT);
++
++		disable_ether_irq(dev);
++		spin_unlock_irqrestore(&gp->lock, flags);
++		reset_tx(dev);
++		enable_ether_irq(dev);
++
++		netif_wake_queue(dev);
++	}
++}
++
++
++static void gt64240_set_rx_mode(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	unsigned long flags;
++	struct dev_mc_list *mcptr;
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_set_rx_mode: dev=%p, flags=%x\n",
++		       dev->name, dev, dev->flags);
++
++	// stop the Receiver DMA
++	abort(dev, sdcmrAR);
++
++	spin_lock_irqsave(&gp->lock, flags);
++
++	if (dev->flags & IFF_PROMISC)
++		GT64240ETH_SETBIT(gp, GT64240_ETH_PORT_CONFIG, pcrPM);
++	else
++		GT64240ETH_CLRBIT(gp, GT64240_ETH_PORT_CONFIG, pcrPM);
++/*
++	GT64240ETH_WRITE(gp, GT64240_ETH_PORT_CONFIG,
++		(PORT_CONFIG | pcrPM | pcrEN));
++*/
++
++	memset(gp->hash_table, 0, RX_HASH_TABLE_SIZE);	// clear hash table
++	// Add our ethernet address
++	gt64240_add_hash_entry(dev, dev->dev_addr);
++	if (dev->mc_count) {
++		for (mcptr = dev->mc_list; mcptr; mcptr = mcptr->next) {
++			if (gt64240_debug > 2) {
++				printk("%s: gt64240_set_rx_mode: addr=\n",
++				       dev->name);
++				dump_hw_addr(mcptr->dmi_addr);
++			}
++			gt64240_add_hash_entry(dev, mcptr->dmi_addr);
++		}
++	}
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_set_rx: Port Config=%x\n", dev->name,
++		       GT64240ETH_READ(gp, GT64240_ETH_PORT_CONFIG));
++
++	// restart Rx DMA
++	GT64240ETH_WRITE(gp, GT64240_ETH_SDMA_COMM, sdcmrERD);
++
++	spin_unlock_irqrestore(&gp->lock, flags);
++}
++
++static struct net_device_stats *gt64240_get_stats(struct net_device *dev)
++{
++	struct gt64240_private *gp = netdev_priv(dev);
++	unsigned long flags;
++
++	if (gt64240_debug > 3)
++		printk("%s: gt64240_get_stats: dev=%p\n", dev->name, dev);
++
++	if (netif_device_present(dev)) {
++		spin_lock_irqsave(&gp->lock, flags);
++		update_stats(gp);
++		spin_unlock_irqrestore(&gp->lock, flags);
++	}
++
++	return &gp->stats;
++}
+diff -Naur linux-2.6.16.orig/drivers/net/gt64240eth.h linux-2.6.16/drivers/net/gt64240eth.h
+--- linux-2.6.16.orig/drivers/net/gt64240eth.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/net/gt64240eth.h	2006-03-21 01:05:47.000000000 +0000
+@@ -9,6 +9,7 @@
+  * Copyright 2000 MontaVista Software Inc.
+  * Author: MontaVista Software, Inc.
+  *         	stevel@mvista.com or support@mvista.com
++ * Copyright 2004, 05 Ralf Baechle (ralf@linux-mips.org)
+  *
+  *  This program is free software; you can distribute it and/or modify it
+  *  under the terms of the GNU General Public License (Version 2) as
+@@ -31,6 +32,7 @@
+ #ifndef _GT64240ETH_H
+ #define _GT64240ETH_H
+ 
++#include <linux/config.h>
+ #include <asm/gt64240.h>
+ 
+ #define ETHERNET_PORTS_DIFFERENCE_OFFSETS	0x400
+@@ -108,10 +110,10 @@
+ #define REV_GT64240A 0x10
+ 
+ #define GT64240ETH_READ(gp, offset)					\
+-	GT_READ((gp)->port_offset + (offset))
++	MV_READ((gp)->port_offset + (offset))
+ 
+ #define GT64240ETH_WRITE(gp, offset, data)				\
+-	GT_WRITE((gp)->port_offset + (offset), (data))
++	MV_WRITE((gp)->port_offset + (offset), (data))
+ 
+ #define GT64240ETH_SETBIT(gp, offset, bits)				\
+ 	GT64240ETH_WRITE((gp), (offset),				\
+@@ -121,8 +123,8 @@
+ 	GT64240ETH_WRITE((gp), (offset),				\
+ 	                 GT64240ETH_READ((gp), (offset)) & ~(bits))
+ 
+-#define GT64240_READ(ofs)		GT_READ(ofs)
+-#define GT64240_WRITE(ofs, data)	GT_WRITE((ofs), (data))
++#define GT64240_READ(ofs)		MV_READ(ofs)
++#define GT64240_WRITE(ofs, data)	MV_WRITE((ofs), (data))
+ 
+ /* Bit definitions of the SMI Reg */
+ enum {
+diff -Naur linux-2.6.16.orig/drivers/net/sb1250-mac.c linux-2.6.16/drivers/net/sb1250-mac.c
+--- linux-2.6.16.orig/drivers/net/sb1250-mac.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/net/sb1250-mac.c	2006-03-21 01:05:48.000000000 +0000
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright (C) 2001,2002,2003 Broadcom Corporation
++ * Copyright (C) 2001,2002,2003,2004 Broadcom Corporation
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+@@ -43,6 +43,7 @@
+ #define SBMAC_ETH0_HWADDR "40:00:00:00:01:00"
+ #define SBMAC_ETH1_HWADDR "40:00:00:00:01:01"
+ #define SBMAC_ETH2_HWADDR "40:00:00:00:01:02"
++#define SBMAC_ETH3_HWADDR "40:00:00:00:01:03"
+ #endif
+ 
+ 
+@@ -57,7 +58,7 @@
+ 
+ #define CONFIG_SBMAC_COALESCE
+ 
+-#define MAX_UNITS 3		/* More are supported, limit only on options */
++#define MAX_UNITS 4		/* More are supported, limit only on options */
+ 
+ /* Time in jiffies before concluding the transmitter is hung. */
+ #define TX_TIMEOUT  (2*HZ)
+@@ -85,11 +86,11 @@
+    The media type is usually passed in 'options[]'.
+ */
+ #ifdef MODULE
+-static int options[MAX_UNITS] = {-1, -1, -1};
++static int options[MAX_UNITS] = {-1, -1, -1, -1};
+ module_param_array(options, int, NULL, S_IRUGO);
+ MODULE_PARM_DESC(options, "1-" __MODULE_STRING(MAX_UNITS));
+ 
+-static int full_duplex[MAX_UNITS] = {-1, -1, -1};
++static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1};
+ module_param_array(full_duplex, int, NULL, S_IRUGO);
+ MODULE_PARM_DESC(full_duplex, "1-" __MODULE_STRING(MAX_UNITS));
+ #endif
+@@ -105,13 +106,26 @@
+ #endif
+ 
+ #include <asm/sibyte/sb1250.h>
+-#include <asm/sibyte/sb1250_defs.h>
++#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
++#include <asm/sibyte/bcm1480_regs.h>
++#include <asm/sibyte/bcm1480_int.h>
++#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
+ #include <asm/sibyte/sb1250_regs.h>
+-#include <asm/sibyte/sb1250_mac.h>
+-#include <asm/sibyte/sb1250_dma.h>
+ #include <asm/sibyte/sb1250_int.h>
++#else
++#error invalid SiByte MAC configuation
++#endif
+ #include <asm/sibyte/sb1250_scd.h>
++#include <asm/sibyte/sb1250_mac.h>
++#include <asm/sibyte/sb1250_dma.h>
+ 
++#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
++#define UNIT_INT(n)		(K_BCM1480_INT_MAC_0 + ((n) * 2))
++#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
++#define UNIT_INT(n)		(K_INT_MAC_0 + (n))
++#else
++#error invalid SiByte MAC configuation
++#endif
+ 
+ /**********************************************************************
+  *  Simple types
+@@ -142,6 +156,10 @@
+ 
+ #define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES)
+ 
++#define SBMAC_READCSR(t)	__raw_readq((unsigned long)t)
++#define SBMAC_WRITECSR(t,v)	__raw_writeq(v, (unsigned long)t)
++
++
+ #define SBMAC_MAX_TXDESCR	32
+ #define SBMAC_MAX_RXDESCR	32
+ 
+@@ -1476,10 +1494,10 @@
+ 	 * and make sure that RD_THRSH + WR_THRSH <=128 for pass2 and above
+ 	 * Use a larger RD_THRSH for gigabit
+ 	 */
+-	if (periph_rev >= 2)
+-		th_value = 64;
+-	else
++	if (soc_type == K_SYS_SOC_TYPE_BCM1250 && periph_rev < 2)
+ 		th_value = 28;
++	else
++		th_value = 64;
+ 
+ 	fifo = V_MAC_TX_WR_THRSH(4) |	/* Must be '4' or '8' */
+ 		((s->sbm_speed == sbmac_speed_1000)
+@@ -1589,13 +1607,17 @@
+ 	 * Turn on the rest of the bits in the enable register
+ 	 */
+ 
++#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
++	__raw_writeq(M_MAC_RXDMA_EN0 |
++		       M_MAC_TXDMA_EN0, s->sbm_macenable);
++#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
+ 	__raw_writeq(M_MAC_RXDMA_EN0 |
+ 		       M_MAC_TXDMA_EN0 |
+ 		       M_MAC_RX_ENABLE |
+ 		       M_MAC_TX_ENABLE, s->sbm_macenable);
+-
+-
+-
++#else
++#error invalid SiByte MAC configuation
++#endif
+ 
+ #ifdef CONFIG_SBMAC_COALESCE
+ 	/*
+@@ -1786,11 +1808,12 @@
+ 	reg &= ~M_MAC_IPHDR_OFFSET | V_MAC_IPHDR_OFFSET(15);
+ 	__raw_writeq(reg, sc->sbm_rxfilter);
+ 
+-	/* read system identification to determine revision */
+-	if (periph_rev >= 2) {
+-		sc->rx_hw_checksum = ENABLE;
+-	} else {
++	/* BCM1250 pass1 didn't have hardware checksum.  Everything
++	   later does.  */
++	if (soc_type == K_SYS_SOC_TYPE_BCM1250 && periph_rev < 2) {
+ 		sc->rx_hw_checksum = DISABLE;
++	} else {
++		sc->rx_hw_checksum = ENABLE;
+ 	}
+ }
+ 
+@@ -2220,7 +2243,7 @@
+ 
+ 
+ 
+-#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR)
++#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR)
+ /**********************************************************************
+  *  SBMAC_PARSE_XDIGIT(str)
+  *
+@@ -2397,6 +2420,11 @@
+ 			sc->sbm_dev->name);
+ 	}
+ 
++	if (periph_rev >= 2) {
++		printk(KERN_INFO "%s: enabling TCP rcv checksum\n",
++			sc->sbm_dev->name);
++	}
++
+ 	/*
+ 	 * Display Ethernet address (this is called during the config
+ 	 * process so we need to finish off the config message that
+@@ -2792,7 +2820,7 @@
+ 
+ 
+ 
+-#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR)
++#if defined(SBMAC_ETH0_HWADDR) || defined(SBMAC_ETH1_HWADDR) || defined(SBMAC_ETH2_HWADDR) || defined(SBMAC_ETH3_HWADDR)
+ static void
+ sbmac_setup_hwaddr(int chan,char *addr)
+ {
+@@ -2818,25 +2846,7 @@
+ 	unsigned long port;
+ 	int chip_max_units;
+ 
+-	/*
+-	 * For bringup when not using the firmware, we can pre-fill
+-	 * the MAC addresses using the environment variables
+-	 * specified in this file (or maybe from the config file?)
+-	 */
+-#ifdef SBMAC_ETH0_HWADDR
+-	sbmac_setup_hwaddr(0,SBMAC_ETH0_HWADDR);
+-#endif
+-#ifdef SBMAC_ETH1_HWADDR
+-	sbmac_setup_hwaddr(1,SBMAC_ETH1_HWADDR);
+-#endif
+-#ifdef SBMAC_ETH2_HWADDR
+-	sbmac_setup_hwaddr(2,SBMAC_ETH2_HWADDR);
+-#endif
+-
+-	/*
+-	 * Walk through the Ethernet controllers and find
+-	 * those who have their MAC addresses set.
+-	 */
++	/* Set the number of available units based on the SOC type.  */
+ 	switch (soc_type) {
+ 	case K_SYS_SOC_TYPE_BCM1250:
+ 	case K_SYS_SOC_TYPE_BCM1250_ALT:
+@@ -2848,6 +2858,10 @@
+ 	case K_SYS_SOC_TYPE_BCM1250_ALT2: /* Hybrid */
+ 		chip_max_units = 2;
+ 		break;
++	case K_SYS_SOC_TYPE_BCM1x55:
++	case K_SYS_SOC_TYPE_BCM1x80:
++		chip_max_units = 4;
++		break;
+ 	default:
+ 		chip_max_units = 0;
+ 		break;
+@@ -2855,6 +2869,32 @@
+ 	if (chip_max_units > MAX_UNITS)
+ 		chip_max_units = MAX_UNITS;
+ 
++	/*
++	 * For bringup when not using the firmware, we can pre-fill
++	 * the MAC addresses using the environment variables
++	 * specified in this file (or maybe from the config file?)
++	 */
++#ifdef SBMAC_ETH0_HWADDR
++	if (chip_max_units > 0)
++	  sbmac_setup_hwaddr(0,SBMAC_ETH0_HWADDR);
++#endif
++#ifdef SBMAC_ETH1_HWADDR
++	if (chip_max_units > 1)
++	  sbmac_setup_hwaddr(1,SBMAC_ETH1_HWADDR);
++#endif
++#ifdef SBMAC_ETH2_HWADDR
++	if (chip_max_units > 2)
++	  sbmac_setup_hwaddr(2,SBMAC_ETH2_HWADDR);
++#endif
++#ifdef SBMAC_ETH3_HWADDR
++	if (chip_max_units > 3)
++	  sbmac_setup_hwaddr(3,SBMAC_ETH3_HWADDR);
++#endif
++
++	/*
++	 * Walk through the Ethernet controllers and find
++	 * those who have their MAC addresses set.
++	 */
+ 	for (idx = 0; idx < chip_max_units; idx++) {
+ 
+ 	        /*
+@@ -2886,7 +2926,7 @@
+ 
+ 		printk(KERN_DEBUG "sbmac: configuring MAC at %lx\n", port);
+ 
+-		dev->irq = K_INT_MAC_0 + idx;
++		dev->irq = UNIT_INT(idx);
+ 		dev->base_addr = port;
+ 		dev->mem_end = 0;
+ 		if (sbmac_init(dev, idx)) {
+diff -Naur linux-2.6.16.orig/drivers/net/sgiseeq.c linux-2.6.16/drivers/net/sgiseeq.c
+--- linux-2.6.16.orig/drivers/net/sgiseeq.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/net/sgiseeq.c	2006-03-21 01:05:48.000000000 +0000
+@@ -3,6 +3,9 @@
+  *
+  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+  */
++
++#undef DEBUG
++
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/errno.h>
+@@ -59,8 +62,6 @@
+ 			    sp->tx_old + (SEEQ_TX_BUFFERS - 1) - sp->tx_new : \
+ 			    sp->tx_old - sp->tx_new - 1)
+ 
+-#define DEBUG
+-
+ struct sgiseeq_rx_desc {
+ 	volatile struct hpc_dma_desc rdma;
+ 	volatile signed int buf_vaddr;
+@@ -209,7 +210,7 @@
+ static struct sgiseeq_private *gpriv;
+ static struct net_device *gdev;
+ 
+-void sgiseeq_dump_rings(void)
++static void sgiseeq_dump_rings(void)
+ {
+ 	static int once;
+ 	struct sgiseeq_rx_desc *r = gpriv->rx_desc;
+@@ -311,9 +312,9 @@
+ 			      struct sgiseeq_regs *sregs)
+ {
+ 	struct sgiseeq_rx_desc *rd;
+-	struct sk_buff *skb = 0;
++	struct sk_buff *skb = NULL;
+ 	unsigned char pkt_status;
+-	unsigned char *pkt_pointer = 0;
++	unsigned char *pkt_pointer = NULL;
+ 	int len = 0;
+ 	unsigned int orig_end = PREV_RX(sp->rx_new);
+ 
+@@ -515,12 +516,6 @@
+ 	return 0;
+ }
+ 
+-void sgiseeq_my_reset(void)
+-{
+-	printk("RESET!\n");
+-	sgiseeq_reset(gdev);
+-}
+-
+ static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ {
+ 	struct sgiseeq_private *sp = netdev_priv(dev);
+diff -Naur linux-2.6.16.orig/drivers/net/titan_ge.c linux-2.6.16/drivers/net/titan_ge.c
+--- linux-2.6.16.orig/drivers/net/titan_ge.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/titan_ge.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,2071 @@
++/*
++ * drivers/net/titan_ge.c - Driver for Titan ethernet ports
++ *
++ * Copyright (C) 2003 PMC-Sierra Inc.
++ * Author : Manish Lachwani (lachwani@pmc-sierra.com)
++ *
++ * 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 Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
++ */
++
++/*
++ * The MAC unit of the Titan consists of the following:
++ *
++ * -> XDMA Engine to move data to from the memory to the MAC packet FIFO
++ * -> FIFO is where the incoming and outgoing data is placed
++ * -> TRTG is the unit that pulls the data from the FIFO for Tx and pushes
++ *    the data into the FIFO for Rx
++ * -> TMAC is the outgoing MAC interface and RMAC is the incoming.
++ * -> AFX is the address filtering block
++ * -> GMII block to communicate with the PHY
++ *
++ * Rx will look like the following:
++ * GMII --> RMAC --> AFX --> TRTG --> Rx FIFO --> XDMA --> CPU memory
++ *
++ * Tx will look like the following:
++ * CPU memory --> XDMA --> Tx FIFO --> TRTG --> TMAC --> GMII
++ *
++ * The Titan driver has support for the following performance features:
++ * -> Rx side checksumming
++ * -> Jumbo Frames
++ * -> Interrupt Coalscing
++ * -> Rx NAPI
++ * -> SKB Recycling
++ * -> Transmit/Receive descriptors in SRAM
++ * -> Fast routing for IP forwarding
++ */
++
++#include <linux/config.h>
++#include <linux/dma-mapping.h>
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/sched.h>
++#include <linux/ioport.h>
++#include <linux/interrupt.h>
++#include <linux/slab.h>
++#include <linux/string.h>
++#include <linux/errno.h>
++#include <linux/ip.h>
++#include <linux/init.h>
++#include <linux/in.h>
++#include <linux/platform_device.h>
++#include <linux/netdevice.h>
++#include <linux/etherdevice.h>
++#include <linux/skbuff.h>
++#include <linux/mii.h>
++#include <linux/delay.h>
++#include <linux/skbuff.h>
++#include <linux/prefetch.h>
++
++/* For MII specifc registers, titan_mdio.h should be included */
++#include <net/ip.h>
++
++#include <asm/bitops.h>
++#include <asm/io.h>
++#include <asm/types.h>
++#include <asm/pgtable.h>
++#include <asm/system.h>
++#include <asm/titan_dep.h>
++
++#include "titan_ge.h"
++#include "titan_mdio.h"
++
++/* Static Function Declarations	 */
++static int titan_ge_eth_open(struct net_device *);
++static void titan_ge_eth_stop(struct net_device *);
++static struct net_device_stats *titan_ge_get_stats(struct net_device *);
++static int titan_ge_init_rx_desc_ring(titan_ge_port_info *, int, int,
++				      unsigned long, unsigned long,
++				      unsigned long);
++static int titan_ge_init_tx_desc_ring(titan_ge_port_info *, int,
++				      unsigned long, unsigned long);
++
++static int titan_ge_open(struct net_device *);
++static int titan_ge_start_xmit(struct sk_buff *, struct net_device *);
++static int titan_ge_stop(struct net_device *);
++
++static unsigned long titan_ge_tx_coal(unsigned long, int);
++
++static void titan_ge_port_reset(unsigned int);
++static int titan_ge_free_tx_queue(titan_ge_port_info *);
++static int titan_ge_rx_task(struct net_device *, titan_ge_port_info *);
++static int titan_ge_port_start(struct net_device *, titan_ge_port_info *);
++
++static int titan_ge_return_tx_desc(titan_ge_port_info *, int);
++
++/*
++ * Some configuration for the FIFO and the XDMA channel needs
++ * to be done only once for all the ports. This flag controls
++ * that
++ */
++static unsigned long config_done;
++
++/*
++ * One time out of memory flag
++ */
++static unsigned int oom_flag;
++
++static int titan_ge_poll(struct net_device *netdev, int *budget);
++
++static int titan_ge_receive_queue(struct net_device *, unsigned int);
++
++static struct platform_device *titan_ge_device[3];
++
++/* MAC Address */
++extern unsigned char titan_ge_mac_addr_base[6];
++
++unsigned long titan_ge_base;
++static unsigned long titan_ge_sram;
++
++static char titan_string[] = "titan";
++
++/*
++ * The Titan GE has two alignment requirements:
++ * -> skb->data to be cacheline aligned (32 byte)
++ * -> IP header alignment to 16 bytes
++ *
++ * The latter is not implemented. So, that results in an extra copy on
++ * the Rx. This is a big performance hog. For the former case, the
++ * dev_alloc_skb() has been replaced with titan_ge_alloc_skb(). The size
++ * requested is calculated:
++ *
++ * Ethernet Frame Size : 1518
++ * Ethernet Header     : 14
++ * Future Titan change for IP header alignment : 2
++ *
++ * Hence, we allocate (1518 + 14 + 2+ 64) = 1580 bytes.  For IP header
++ * alignment, we use skb_reserve().
++ */
++
++#define ALIGNED_RX_SKB_ADDR(addr) \
++	((((unsigned long)(addr) + (64UL - 1UL)) \
++	& ~(64UL - 1UL)) - (unsigned long)(addr))
++
++#define titan_ge_alloc_skb(__length, __gfp_flags) \
++({      struct sk_buff *__skb; \
++	__skb = alloc_skb((__length) + 64, (__gfp_flags)); \
++	if(__skb) { \
++		int __offset = (int) ALIGNED_RX_SKB_ADDR(__skb->data); \
++		if(__offset) \
++			skb_reserve(__skb, __offset); \
++	} \
++	__skb; \
++})
++
++/*
++ * Configure the GMII block of the Titan based on what the PHY tells us
++ */
++static void titan_ge_gmii_config(int port_num)
++{
++	unsigned int reg_data = 0, phy_reg;
++	int err;
++
++	err = titan_ge_mdio_read(port_num, TITAN_GE_MDIO_PHY_STATUS, &phy_reg);
++
++	if (err == TITAN_GE_MDIO_ERROR) {
++		printk(KERN_ERR
++		       "Could not read PHY control register 0x11 \n");
++		printk(KERN_ERR
++			"Setting speed to 1000 Mbps and Duplex to Full \n");
++
++		return;
++	}
++
++	err = titan_ge_mdio_write(port_num, TITAN_GE_MDIO_PHY_IE, 0);
++
++	if (phy_reg & 0x8000) {
++		if (phy_reg & 0x2000) {
++			/* Full Duplex and 1000 Mbps */
++			TITAN_GE_WRITE((TITAN_GE_GMII_CONFIG_MODE +
++					(port_num << 12)), 0x201);
++		}  else {
++			/* Half Duplex and 1000 Mbps */
++			TITAN_GE_WRITE((TITAN_GE_GMII_CONFIG_MODE +
++					(port_num << 12)), 0x2201);
++			}
++	}
++	if (phy_reg & 0x4000) {
++		if (phy_reg & 0x2000) {
++			/* Full Duplex and 100 Mbps */
++			TITAN_GE_WRITE((TITAN_GE_GMII_CONFIG_MODE +
++					(port_num << 12)), 0x100);
++		} else {
++			/* Half Duplex and 100 Mbps */
++			TITAN_GE_WRITE((TITAN_GE_GMII_CONFIG_MODE +
++					(port_num << 12)), 0x2100);
++		}
++	}
++	reg_data = TITAN_GE_READ(TITAN_GE_GMII_CONFIG_GENERAL +
++				(port_num << 12));
++	reg_data |= 0x3;
++	TITAN_GE_WRITE((TITAN_GE_GMII_CONFIG_GENERAL +
++			(port_num << 12)), reg_data);
++}
++
++/*
++ * Enable the TMAC if it is not
++ */
++static void titan_ge_enable_tx(unsigned int port_num)
++{
++	unsigned long reg_data;
++
++	reg_data = TITAN_GE_READ(TITAN_GE_TMAC_CONFIG_1 + (port_num << 12));
++	if (!(reg_data & 0x8000)) {
++		printk("TMAC disabled for port %d!! \n", port_num);
++
++		reg_data |= 0x0001;	/* Enable TMAC */
++		reg_data |= 0x4000;	/* CRC Check Enable */
++		reg_data |= 0x2000;	/* Padding enable */
++		reg_data |= 0x0800;	/* CRC Add enable */
++		reg_data |= 0x0080;	/* PAUSE frame */
++
++		TITAN_GE_WRITE((TITAN_GE_TMAC_CONFIG_1 +
++				(port_num << 12)), reg_data);
++	}
++}
++
++/*
++ * Tx Timeout function
++ */
++static void titan_ge_tx_timeout(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++
++	printk(KERN_INFO "%s: TX timeout  ", netdev->name);
++	printk(KERN_INFO "Resetting card \n");
++
++	/* Do the reset outside of interrupt context */
++	schedule_work(&titan_ge_eth->tx_timeout_task);
++}
++
++/*
++ * Update the AFX tables for UC and MC for slice 0 only
++ */
++static void titan_ge_update_afx(titan_ge_port_info * titan_ge_eth)
++{
++	int port = titan_ge_eth->port_num;
++	unsigned int i;
++	volatile unsigned long reg_data = 0;
++	u8 p_addr[6];
++
++	memcpy(p_addr, titan_ge_eth->port_mac_addr, 6);
++
++	/* Set the MAC address here for TMAC and RMAC */
++	TITAN_GE_WRITE((TITAN_GE_TMAC_STATION_HI + (port << 12)),
++		       ((p_addr[5] << 8) | p_addr[4]));
++	TITAN_GE_WRITE((TITAN_GE_TMAC_STATION_MID + (port << 12)),
++		       ((p_addr[3] << 8) | p_addr[2]));
++	TITAN_GE_WRITE((TITAN_GE_TMAC_STATION_LOW + (port << 12)),
++		       ((p_addr[1] << 8) | p_addr[0]));
++
++	TITAN_GE_WRITE((TITAN_GE_RMAC_STATION_HI + (port << 12)),
++		       ((p_addr[5] << 8) | p_addr[4]));
++	TITAN_GE_WRITE((TITAN_GE_RMAC_STATION_MID + (port << 12)),
++		       ((p_addr[3] << 8) | p_addr[2]));
++	TITAN_GE_WRITE((TITAN_GE_RMAC_STATION_LOW + (port << 12)),
++		       ((p_addr[1] << 8) | p_addr[0]));
++
++	TITAN_GE_WRITE((0x112c | (port << 12)), 0x1);
++	/* Configure the eight address filters */
++	for (i = 0; i < 8; i++) {
++		/* Select each of the eight filters */
++		TITAN_GE_WRITE((TITAN_GE_AFX_ADDRS_FILTER_CTRL_2 +
++				(port << 12)), i);
++
++		/* Configure the match */
++		reg_data = 0x9;	/* Forward Enable Bit */
++		TITAN_GE_WRITE((TITAN_GE_AFX_ADDRS_FILTER_CTRL_0 +
++				(port << 12)), reg_data);
++
++		/* Finally, AFX Exact Match Address Registers */
++		TITAN_GE_WRITE((TITAN_GE_AFX_EXACT_MATCH_LOW + (port << 12)),
++			       ((p_addr[1] << 8) | p_addr[0]));
++		TITAN_GE_WRITE((TITAN_GE_AFX_EXACT_MATCH_MID + (port << 12)),
++			       ((p_addr[3] << 8) | p_addr[2]));
++		TITAN_GE_WRITE((TITAN_GE_AFX_EXACT_MATCH_HIGH + (port << 12)),
++			       ((p_addr[5] << 8) | p_addr[4]));
++
++		/* VLAN id set to 0 */
++		TITAN_GE_WRITE((TITAN_GE_AFX_EXACT_MATCH_VID +
++				(port << 12)), 0);
++	}
++}
++
++/*
++ * Actual Routine to reset the adapter when the timeout occurred
++ */
++static void titan_ge_tx_timeout_task(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	int port = titan_ge_eth->port_num;
++
++	printk("Titan GE: Transmit timed out. Resetting ... \n");
++
++	/* Dump debug info */
++	printk(KERN_ERR "TRTG cause : %x \n",
++			TITAN_GE_READ(0x100c + (port << 12)));
++
++	/* Fix this for the other ports */
++	printk(KERN_ERR "FIFO cause : %x \n", TITAN_GE_READ(0x482c));
++	printk(KERN_ERR "IE cause : %x \n", TITAN_GE_READ(0x0040));
++	printk(KERN_ERR "XDMA GDI ERROR : %x \n",
++			TITAN_GE_READ(0x5008 + (port << 8)));
++	printk(KERN_ERR "CHANNEL ERROR: %x \n",
++			TITAN_GE_READ(TITAN_GE_CHANNEL0_INTERRUPT
++						+ (port << 8)));
++
++	netif_device_detach(netdev);
++	titan_ge_port_reset(titan_ge_eth->port_num);
++	titan_ge_port_start(netdev, titan_ge_eth);
++	netif_device_attach(netdev);
++}
++
++/*
++ * Change the MTU of the Ethernet Device
++ */
++static int titan_ge_change_mtu(struct net_device *netdev, int new_mtu)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned long flags;
++
++	if ((new_mtu > 9500) || (new_mtu < 64))
++		return -EINVAL;
++
++	spin_lock_irqsave(&titan_ge_eth->lock, flags);
++
++	netdev->mtu = new_mtu;
++
++	/* Now we have to reopen the interface so that SKBs with the new
++	 * size will be allocated */
++
++	if (netif_running(netdev)) {
++		titan_ge_eth_stop(netdev);
++
++		if (titan_ge_eth_open(netdev) != TITAN_OK) {
++			printk(KERN_ERR
++			       "%s: Fatal error on opening device\n",
++			       netdev->name);
++			spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++			return -1;
++		}
++	}
++
++	spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++	return 0;
++}
++
++/*
++ * Titan Gbe Interrupt Handler. All the three ports send interrupt to one line
++ * only. Once an interrupt is triggered, figure out the port and then check
++ * the channel.
++ */
++static irqreturn_t titan_ge_int_handler(int irq, void *dev_id,
++	struct pt_regs *regs)
++{
++	struct net_device *netdev = (struct net_device *) dev_id;
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	unsigned int reg_data;
++	unsigned int eth_int_cause_error = 0, is;
++	unsigned long eth_int_cause1;
++	int err = 0;
++#ifdef CONFIG_SMP
++	unsigned long eth_int_cause2;
++#endif
++
++	/* Ack the CPU interrupt */
++	switch (port_num) {
++	case 0:
++		is = OCD_READ(RM9000x2_OCD_INTP0STATUS1);
++		OCD_WRITE(RM9000x2_OCD_INTP0CLEAR1, is);
++
++#ifdef CONFIG_SMP
++		is = OCD_READ(RM9000x2_OCD_INTP1STATUS1);
++		OCD_WRITE(RM9000x2_OCD_INTP1CLEAR1, is);
++#endif
++		break;
++
++	case 1:
++		is = OCD_READ(RM9000x2_OCD_INTP0STATUS0);
++		OCD_WRITE(RM9000x2_OCD_INTP0CLEAR0, is);
++
++#ifdef CONFIG_SMP
++		is = OCD_READ(RM9000x2_OCD_INTP1STATUS0);
++		OCD_WRITE(RM9000x2_OCD_INTP1CLEAR0, is);
++#endif
++		break;
++
++	case 2:
++		is = OCD_READ(RM9000x2_OCD_INTP0STATUS4);
++		OCD_WRITE(RM9000x2_OCD_INTP0CLEAR4, is);
++
++#ifdef CONFIG_SMP
++		is = OCD_READ(RM9000x2_OCD_INTP1STATUS4);
++		OCD_WRITE(RM9000x2_OCD_INTP1CLEAR4, is);
++#endif
++	}
++
++	eth_int_cause1 = TITAN_GE_READ(TITAN_GE_INTR_XDMA_CORE_A);
++#ifdef CONFIG_SMP
++	eth_int_cause2 = TITAN_GE_READ(TITAN_GE_INTR_XDMA_CORE_B);
++#endif
++
++	/* Spurious interrupt */
++#ifdef CONFIG_SMP
++	if ( (eth_int_cause1 == 0) && (eth_int_cause2 == 0)) {
++#else
++	if (eth_int_cause1 == 0) {
++#endif
++		eth_int_cause_error = TITAN_GE_READ(TITAN_GE_CHANNEL0_INTERRUPT +
++					(port_num << 8));
++
++		if (eth_int_cause_error == 0)
++			return IRQ_NONE;
++	}
++
++	/* Handle Tx first. No need to ack interrupts */
++#ifdef CONFIG_SMP
++	if ( (eth_int_cause1 & 0x20202) ||
++		(eth_int_cause2 & 0x20202) )
++#else
++	if (eth_int_cause1 & 0x20202)
++#endif
++		titan_ge_free_tx_queue(titan_ge_eth);
++
++	/* Handle the Rx next */
++#ifdef CONFIG_SMP
++	if ( (eth_int_cause1 & 0x10101) ||
++		(eth_int_cause2 & 0x10101)) {
++#else
++	if (eth_int_cause1 & 0x10101) {
++#endif
++		if (netif_rx_schedule_prep(netdev)) {
++			unsigned int ack;
++
++			ack = TITAN_GE_READ(TITAN_GE_INTR_XDMA_IE);
++			/* Disable Tx and Rx both */
++			if (port_num == 0)
++				ack &= ~(0x3);
++			if (port_num == 1)
++				ack &= ~(0x300);
++
++			if (port_num == 2)
++				ack &= ~(0x30000);
++
++			/* Interrupts have been disabled */
++			TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_IE, ack);
++
++			__netif_rx_schedule(netdev);
++		}
++	}
++
++	/* Handle error interrupts */
++	if (eth_int_cause_error && (eth_int_cause_error != 0x2)) {
++		printk(KERN_ERR
++			"XDMA Channel Error : %x  on port %d\n",
++			eth_int_cause_error, port_num);
++
++		printk(KERN_ERR
++			"XDMA GDI Hardware error : %x  on port %d\n",
++			TITAN_GE_READ(0x5008 + (port_num << 8)), port_num);
++
++		printk(KERN_ERR
++			"XDMA currently has %d Rx descriptors \n",
++			TITAN_GE_READ(0x5048 + (port_num << 8)));
++
++		printk(KERN_ERR
++			"XDMA currently has prefetcted %d Rx descriptors \n",
++			TITAN_GE_READ(0x505c + (port_num << 8)));
++
++		TITAN_GE_WRITE((TITAN_GE_CHANNEL0_INTERRUPT +
++			       (port_num << 8)), eth_int_cause_error);
++	}
++
++	/*
++	 * PHY interrupt to inform abt the changes. Reading the
++	 * PHY Status register will clear the interrupt
++	 */
++	if ((!(eth_int_cause1 & 0x30303)) &&
++		(eth_int_cause_error == 0)) {
++		err =
++		    titan_ge_mdio_read(port_num,
++			       TITAN_GE_MDIO_PHY_IS, &reg_data);
++
++		if (reg_data & 0x0400) {
++			/* Link status change */
++			titan_ge_mdio_read(port_num,
++				   TITAN_GE_MDIO_PHY_STATUS, &reg_data);
++			if (!(reg_data & 0x0400)) {
++				/* Link is down */
++				netif_carrier_off(netdev);
++				netif_stop_queue(netdev);
++			} else {
++				/* Link is up */
++				netif_carrier_on(netdev);
++				netif_wake_queue(netdev);
++
++				/* Enable the queue */
++				titan_ge_enable_tx(port_num);
++			}
++		}
++	}
++
++	return IRQ_HANDLED;
++}
++
++/*
++ * Multicast and Promiscuous mode set. The
++ * set_multi entry point is called whenever the
++ * multicast address list or the network interface
++ * flags are updated.
++ */
++static void titan_ge_set_multi(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	unsigned long reg_data;
++
++	reg_data = TITAN_GE_READ(TITAN_GE_AFX_ADDRS_FILTER_CTRL_1 +
++				(port_num << 12));
++
++	if (netdev->flags & IFF_PROMISC) {
++		reg_data |= 0x2;
++	}
++	else if (netdev->flags & IFF_ALLMULTI) {
++		reg_data |= 0x01;
++		reg_data |= 0x400; /* Use the 64-bit Multicast Hash bin */
++	}
++	else {
++		reg_data = 0x2;
++	}
++
++	TITAN_GE_WRITE((TITAN_GE_AFX_ADDRS_FILTER_CTRL_1 +
++			(port_num << 12)), reg_data);
++	if (reg_data & 0x01) {
++		TITAN_GE_WRITE((TITAN_GE_AFX_MULTICAST_HASH_LOW +
++				(port_num << 12)), 0xffff);
++		TITAN_GE_WRITE((TITAN_GE_AFX_MULTICAST_HASH_MIDLOW +
++				(port_num << 12)), 0xffff);
++		TITAN_GE_WRITE((TITAN_GE_AFX_MULTICAST_HASH_MIDHI +
++				(port_num << 12)), 0xffff);
++		TITAN_GE_WRITE((TITAN_GE_AFX_MULTICAST_HASH_HI +
++				(port_num << 12)), 0xffff);
++	}
++}
++
++/*
++ * Open the network device
++ */
++static int titan_ge_open(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	unsigned int irq = TITAN_ETH_PORT_IRQ - port_num;
++	int retval;
++
++	retval = request_irq(irq, titan_ge_int_handler,
++		     SA_INTERRUPT | SA_SAMPLE_RANDOM , netdev->name, netdev);
++
++	if (retval != 0) {
++		printk(KERN_ERR "Cannot assign IRQ number to TITAN GE \n");
++		return -1;
++	}
++
++	netdev->irq = irq;
++	printk(KERN_INFO "Assigned IRQ %d to port %d\n", irq, port_num);
++
++	spin_lock_irq(&(titan_ge_eth->lock));
++
++	if (titan_ge_eth_open(netdev) != TITAN_OK) {
++		spin_unlock_irq(&(titan_ge_eth->lock));
++		printk("%s: Error opening interface \n", netdev->name);
++		free_irq(netdev->irq, netdev);
++		return -EBUSY;
++	}
++
++	spin_unlock_irq(&(titan_ge_eth->lock));
++
++	return 0;
++}
++
++/*
++ * Allocate the SKBs for the Rx ring. Also used
++ * for refilling the queue
++ */
++static int titan_ge_rx_task(struct net_device *netdev,
++				titan_ge_port_info *titan_ge_port)
++{
++	struct device *device = &titan_ge_device[titan_ge_port->port_num]->dev;
++	volatile titan_ge_rx_desc *rx_desc;
++	struct sk_buff *skb;
++	int rx_used_desc;
++	int count = 0;
++
++	while (titan_ge_port->rx_ring_skbs < titan_ge_port->rx_ring_size) {
++
++	/* First try to get the skb from the recycler */
++#ifdef TITAN_GE_JUMBO_FRAMES
++		skb = titan_ge_alloc_skb(TITAN_GE_JUMBO_BUFSIZE, GFP_ATOMIC);
++#else
++		skb = titan_ge_alloc_skb(TITAN_GE_STD_BUFSIZE, GFP_ATOMIC);
++#endif
++		if (unlikely(!skb)) {
++			/* OOM, set the flag */
++			printk("OOM \n");
++			oom_flag = 1;
++			break;
++		}
++		count++;
++		skb->dev = netdev;
++
++		titan_ge_port->rx_ring_skbs++;
++
++		rx_used_desc = titan_ge_port->rx_used_desc_q;
++		rx_desc = &(titan_ge_port->rx_desc_area[rx_used_desc]);
++
++#ifdef TITAN_GE_JUMBO_FRAMES
++		rx_desc->buffer_addr = dma_map_single(device, skb->data,
++				TITAN_GE_JUMBO_BUFSIZE - 2, DMA_FROM_DEVICE);
++#else
++		rx_desc->buffer_addr = dma_map_single(device, skb->data,
++				TITAN_GE_STD_BUFSIZE - 2, DMA_FROM_DEVICE);
++#endif
++
++		titan_ge_port->rx_skb[rx_used_desc] = skb;
++		rx_desc->cmd_sts = TITAN_GE_RX_BUFFER_OWNED;
++
++		titan_ge_port->rx_used_desc_q =
++			(rx_used_desc + 1) % TITAN_GE_RX_QUEUE;
++	}
++
++	return count;
++}
++
++/*
++ * Actual init of the Tital GE port. There is one register for
++ * the channel configuration
++ */
++static void titan_port_init(struct net_device *netdev,
++			    titan_ge_port_info * titan_ge_eth)
++{
++	unsigned long reg_data;
++
++	titan_ge_port_reset(titan_ge_eth->port_num);
++
++	/* First reset the TMAC */
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG);
++	reg_data |= 0x80000000;
++	TITAN_GE_WRITE(TITAN_GE_CHANNEL0_CONFIG, reg_data);
++
++	udelay(30);
++
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG);
++	reg_data &= ~(0xc0000000);
++	TITAN_GE_WRITE(TITAN_GE_CHANNEL0_CONFIG, reg_data);
++
++	/* Now reset the RMAC */
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG);
++	reg_data |= 0x00080000;
++	TITAN_GE_WRITE(TITAN_GE_CHANNEL0_CONFIG, reg_data);
++
++	udelay(30);
++
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG);
++	reg_data &= ~(0x000c0000);
++	TITAN_GE_WRITE(TITAN_GE_CHANNEL0_CONFIG, reg_data);
++}
++
++/*
++ * Start the port. All the hardware specific configuration
++ * for the XDMA, Tx FIFO, Rx FIFO, TMAC, RMAC, TRTG and AFX
++ * go here
++ */
++static int titan_ge_port_start(struct net_device *netdev,
++				titan_ge_port_info * titan_port)
++{
++	volatile unsigned long reg_data, reg_data1;
++	int port_num = titan_port->port_num;
++	int count = 0;
++	unsigned long reg_data_1;
++
++	if (config_done == 0) {
++		reg_data = TITAN_GE_READ(0x0004);
++		reg_data |= 0x100;
++		TITAN_GE_WRITE(0x0004, reg_data);
++
++		reg_data &= ~(0x100);
++		TITAN_GE_WRITE(0x0004, reg_data);
++
++		/* Turn on GMII/MII mode and turn off TBI mode */
++		reg_data = TITAN_GE_READ(TITAN_GE_TSB_CTRL_1);
++		reg_data |= 0x00000700;
++		reg_data &= ~(0x00800000); /* Fencing */
++
++		TITAN_GE_WRITE(0x000c, 0x00001100);
++
++		TITAN_GE_WRITE(TITAN_GE_TSB_CTRL_1, reg_data);
++
++		/* Set the CPU Resource Limit register */
++		TITAN_GE_WRITE(0x00f8, 0x8);
++
++		/* Be conservative when using the BIU buffers */
++		TITAN_GE_WRITE(0x0068, 0x4);
++	}
++
++	titan_port->tx_threshold = 0;
++	titan_port->rx_threshold = 0;
++
++	/* We need to write the descriptors for Tx and Rx */
++	TITAN_GE_WRITE((TITAN_GE_CHANNEL0_TX_DESC + (port_num << 8)),
++		       (unsigned long) titan_port->tx_dma);
++	TITAN_GE_WRITE((TITAN_GE_CHANNEL0_RX_DESC + (port_num << 8)),
++		       (unsigned long) titan_port->rx_dma);
++
++	if (config_done == 0) {
++		/* Step 1:  XDMA config	*/
++		reg_data = TITAN_GE_READ(TITAN_GE_XDMA_CONFIG);
++		reg_data &= ~(0x80000000);      /* clear reset */
++		reg_data |= 0x1 << 29;	/* sparse tx descriptor spacing */
++		reg_data |= 0x1 << 28;	/* sparse rx descriptor spacing */
++		reg_data |= (0x1 << 23) | (0x1 << 24);  /* Descriptor Coherency */
++		reg_data |= (0x1 << 21) | (0x1 << 22);  /* Data Coherency */
++		TITAN_GE_WRITE(TITAN_GE_XDMA_CONFIG, reg_data);
++	}
++
++	/* IR register for the XDMA */
++	reg_data = TITAN_GE_READ(TITAN_GE_GDI_INTERRUPT_ENABLE + (port_num << 8));
++	reg_data |= 0x80068000; /* No Rx_OOD */
++	TITAN_GE_WRITE((TITAN_GE_GDI_INTERRUPT_ENABLE + (port_num << 8)), reg_data);
++
++	/* Start the Tx and Rx XDMA controller */
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG + (port_num << 8));
++	reg_data &= 0x4fffffff;     /* Clear tx reset */
++	reg_data &= 0xfff4ffff;     /* Clear rx reset */
++
++#ifdef TITAN_GE_JUMBO_FRAMES
++	reg_data |= 0xa0 | 0x30030000;
++#else
++	reg_data |= 0x40 | 0x20030000;
++#endif
++
++#ifndef CONFIG_SMP
++	reg_data &= ~(0x10);
++	reg_data |= 0x0f; /* All of the packet */
++#endif
++
++	TITAN_GE_WRITE((TITAN_GE_CHANNEL0_CONFIG + (port_num << 8)), reg_data);
++
++	/* Rx desc count */
++	count = titan_ge_rx_task(netdev, titan_port);
++	TITAN_GE_WRITE((0x5048 + (port_num << 8)), count);
++	count = TITAN_GE_READ(0x5048 + (port_num << 8));
++
++	udelay(30);
++
++	/*
++	 * Step 2:  Configure the SDQPF, i.e. FIFO
++	 */
++	if (config_done == 0) {
++		reg_data = TITAN_GE_READ(TITAN_GE_SDQPF_RXFIFO_CTL);
++		reg_data = 0x1;
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_RXFIFO_CTL, reg_data);
++		reg_data &= ~(0x1);
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_RXFIFO_CTL, reg_data);
++		reg_data = TITAN_GE_READ(TITAN_GE_SDQPF_RXFIFO_CTL);
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_RXFIFO_CTL, reg_data);
++
++		reg_data = TITAN_GE_READ(TITAN_GE_SDQPF_TXFIFO_CTL);
++		reg_data = 0x1;
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_TXFIFO_CTL, reg_data);
++		reg_data &= ~(0x1);
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_TXFIFO_CTL, reg_data);
++		reg_data = TITAN_GE_READ(TITAN_GE_SDQPF_TXFIFO_CTL);
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_TXFIFO_CTL, reg_data);
++	}
++	/*
++	 * Enable RX FIFO 0, 4 and 8
++	 */
++	if (port_num == 0) {
++		reg_data = TITAN_GE_READ(TITAN_GE_SDQPF_RXFIFO_0);
++
++		reg_data |= 0x100000;
++		reg_data |= (0xff << 10);
++
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_RXFIFO_0, reg_data);
++		/*
++		 * BAV2,BAV and DAV settings for the Rx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x4844);
++		reg_data1 |= ( (0x10 << 20) | (0x10 << 10) | 0x1);
++		TITAN_GE_WRITE(0x4844, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_RXFIFO_0, reg_data);
++
++		reg_data = TITAN_GE_READ(TITAN_GE_SDQPF_TXFIFO_0);
++		reg_data |= 0x100000;
++
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_TXFIFO_0, reg_data);
++
++		reg_data |= (0xff << 10);
++
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_TXFIFO_0, reg_data);
++
++		/*
++		 * BAV2, BAV and DAV settings for the Tx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x4944);
++		reg_data1 = ( (0x1 << 20) | (0x1 << 10) | 0x10);
++
++		TITAN_GE_WRITE(0x4944, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(TITAN_GE_SDQPF_TXFIFO_0, reg_data);
++
++	}
++
++	if (port_num == 1) {
++		reg_data = TITAN_GE_READ(0x4870);
++
++		reg_data |= 0x100000;
++		reg_data |= (0xff << 10) | (0xff + 1);
++
++		TITAN_GE_WRITE(0x4870, reg_data);
++		/*
++		 * BAV2,BAV and DAV settings for the Rx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x4874);
++		reg_data1 |= ( (0x10 << 20) | (0x10 << 10) | 0x1);
++		TITAN_GE_WRITE(0x4874, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(0x4870, reg_data);
++
++		reg_data = TITAN_GE_READ(0x494c);
++		reg_data |= 0x100000;
++
++		TITAN_GE_WRITE(0x494c, reg_data);
++		reg_data |= (0xff << 10) | (0xff + 1);
++		TITAN_GE_WRITE(0x494c, reg_data);
++
++		/*
++		 * BAV2, BAV and DAV settings for the Tx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x4950);
++		reg_data1 = ( (0x1 << 20) | (0x1 << 10) | 0x10);
++
++		TITAN_GE_WRITE(0x4950, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(0x494c, reg_data);
++	}
++
++	/*
++	 * Titan 1.2 revision does support port #2
++	 */
++	if (port_num == 2) {
++		/*
++		 * Put the descriptors in the SRAM
++		 */
++		reg_data = TITAN_GE_READ(0x48a0);
++
++		reg_data |= 0x100000;
++		reg_data |= (0xff << 10) | (2*(0xff + 1));
++
++		TITAN_GE_WRITE(0x48a0, reg_data);
++		/*
++		 * BAV2,BAV and DAV settings for the Rx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x48a4);
++		reg_data1 |= ( (0x10 << 20) | (0x10 << 10) | 0x1);
++		TITAN_GE_WRITE(0x48a4, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(0x48a0, reg_data);
++		
++		reg_data = TITAN_GE_READ(0x4958);
++		reg_data |= 0x100000;
++
++		TITAN_GE_WRITE(0x4958, reg_data);
++		reg_data |= (0xff << 10) | (2*(0xff + 1));
++		TITAN_GE_WRITE(0x4958, reg_data);
++
++		/*
++		 * BAV2, BAV and DAV settings for the Tx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x495c);
++		reg_data1 = ( (0x1 << 20) | (0x1 << 10) | 0x10);
++
++		TITAN_GE_WRITE(0x495c, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(0x4958, reg_data);
++	}
++
++	if (port_num == 2) {
++		reg_data = TITAN_GE_READ(0x48a0);
++
++		reg_data |= 0x100000;
++		reg_data |= (0xff << 10) | (2*(0xff + 1));
++
++		TITAN_GE_WRITE(0x48a0, reg_data);
++		/*
++		 * BAV2,BAV and DAV settings for the Rx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x48a4);
++		reg_data1 |= ( (0x10 << 20) | (0x10 << 10) | 0x1);
++		TITAN_GE_WRITE(0x48a4, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(0x48a0, reg_data);
++
++		reg_data = TITAN_GE_READ(0x4958);
++		reg_data |= 0x100000;
++
++		TITAN_GE_WRITE(0x4958, reg_data);
++		reg_data |= (0xff << 10) | (2*(0xff + 1));
++		TITAN_GE_WRITE(0x4958, reg_data);
++
++		/*
++		 * BAV2, BAV and DAV settings for the Tx FIFO
++		 */
++		reg_data1 = TITAN_GE_READ(0x495c);
++		reg_data1 = ( (0x1 << 20) | (0x1 << 10) | 0x10);
++
++		TITAN_GE_WRITE(0x495c, reg_data1);
++
++		reg_data &= ~(0x00100000);
++		reg_data |= 0x200000;
++
++		TITAN_GE_WRITE(0x4958, reg_data);
++	}
++
++	/*
++	 * Step 3:  TRTG block enable
++	 */
++	reg_data = TITAN_GE_READ(TITAN_GE_TRTG_CONFIG + (port_num << 12));
++
++	/*
++	 * This is the 1.2 revision of the chip. It has fix for the
++	 * IP header alignment. Now, the IP header begins at an
++	 * aligned address and this wont need an extra copy in the
++	 * driver. This performance drawback existed in the previous
++	 * versions of the silicon
++	 */
++	reg_data_1 = TITAN_GE_READ(0x103c + (port_num << 12));
++	reg_data_1 |= 0x40000000;
++	TITAN_GE_WRITE((0x103c + (port_num << 12)), reg_data_1);
++
++	reg_data_1 |= 0x04000000;
++	TITAN_GE_WRITE((0x103c + (port_num << 12)), reg_data_1);
++
++	mdelay(5);
++
++	reg_data_1 &= ~(0x04000000);
++	TITAN_GE_WRITE((0x103c + (port_num << 12)), reg_data_1);
++
++	mdelay(5);
++
++	reg_data |= 0x0001;
++	TITAN_GE_WRITE((TITAN_GE_TRTG_CONFIG + (port_num << 12)), reg_data);
++
++	/*
++	 * Step 4:  Start the Tx activity
++	 */
++	TITAN_GE_WRITE((TITAN_GE_TMAC_CONFIG_2 + (port_num << 12)), 0xe197);
++#ifdef TITAN_GE_JUMBO_FRAMES
++	TITAN_GE_WRITE((0x1258 + (port_num << 12)), 0x4000);
++#endif
++	reg_data = TITAN_GE_READ(TITAN_GE_TMAC_CONFIG_1 + (port_num << 12));
++	reg_data |= 0x0001;	/* Enable TMAC */
++	reg_data |= 0x6c70;	/* PAUSE also set */
++
++	TITAN_GE_WRITE((TITAN_GE_TMAC_CONFIG_1 + (port_num << 12)), reg_data);
++
++	udelay(30);
++
++	/* Destination Address drop bit */
++	reg_data = TITAN_GE_READ(TITAN_GE_RMAC_CONFIG_2 + (port_num << 12));
++	reg_data |= 0x218;        /* DA_DROP bit and pause */
++	TITAN_GE_WRITE((TITAN_GE_RMAC_CONFIG_2 + (port_num << 12)), reg_data);
++
++	TITAN_GE_WRITE((0x1218 + (port_num << 12)), 0x3);
++
++#ifdef TITAN_GE_JUMBO_FRAMES
++	TITAN_GE_WRITE((0x1208 + (port_num << 12)), 0x4000);
++#endif
++	/* Start the Rx activity */
++	reg_data = TITAN_GE_READ(TITAN_GE_RMAC_CONFIG_1 + (port_num << 12));
++	reg_data |= 0x0001;	/* RMAC Enable */
++	reg_data |= 0x0010;	/* CRC Check enable */
++	reg_data |= 0x0040;	/* Min Frame check enable */
++	reg_data |= 0x4400;	/* Max Frame check enable */
++
++	TITAN_GE_WRITE((TITAN_GE_RMAC_CONFIG_1 + (port_num << 12)), reg_data);
++
++	udelay(30);
++
++	/*
++	 * Enable the Interrupts for Tx and Rx
++	 */
++	reg_data1 = TITAN_GE_READ(TITAN_GE_INTR_XDMA_IE);
++
++	if (port_num == 0) {
++		reg_data1 |= 0x3;
++#ifdef CONFIG_SMP
++		TITAN_GE_WRITE(0x0038, 0x003);
++#else
++		TITAN_GE_WRITE(0x0038, 0x303);
++#endif
++	}
++
++	if (port_num == 1) {
++		reg_data1 |= 0x300;
++	}
++
++	if (port_num == 2)
++		reg_data1 |= 0x30000;
++
++	TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_IE, reg_data1);
++	TITAN_GE_WRITE(0x003c, 0x300);
++
++	if (config_done == 0) {
++		TITAN_GE_WRITE(0x0024, 0x04000024);	/* IRQ vector */
++		TITAN_GE_WRITE(0x0020, 0x000fb000);	/* INTMSG base */
++	}
++
++	/* Priority */
++	reg_data = TITAN_GE_READ(0x1038 + (port_num << 12));
++	reg_data &= ~(0x00f00000);
++	TITAN_GE_WRITE((0x1038 + (port_num << 12)), reg_data);
++
++	/* Step 5:  GMII config */
++	titan_ge_gmii_config(port_num);
++
++	if (config_done == 0) {
++		TITAN_GE_WRITE(0x1a80, 0);
++		config_done = 1;
++	}
++
++	return TITAN_OK;
++}
++
++/*
++ * Function to queue the packet for the Ethernet device
++ */
++static void titan_ge_tx_queue(titan_ge_port_info * titan_ge_eth,
++				struct sk_buff * skb)
++{
++	struct device *device = &titan_ge_device[titan_ge_eth->port_num]->dev;
++	unsigned int curr_desc = titan_ge_eth->tx_curr_desc_q;
++	volatile titan_ge_tx_desc *tx_curr;
++	int port_num = titan_ge_eth->port_num;
++
++	tx_curr = &(titan_ge_eth->tx_desc_area[curr_desc]);
++	tx_curr->buffer_addr =
++		dma_map_single(device, skb->data, skb_headlen(skb),
++			       DMA_TO_DEVICE);
++
++	titan_ge_eth->tx_skb[curr_desc] = (struct sk_buff *) skb;
++	tx_curr->buffer_len = skb_headlen(skb);
++
++	/* Last descriptor enables interrupt and changes ownership */
++	tx_curr->cmd_sts = 0x1 | (1 << 15) | (1 << 5);
++
++	/* Kick the XDMA to start the transfer from memory to the FIFO */
++	TITAN_GE_WRITE((0x5044 + (port_num << 8)), 0x1);
++
++	/* Current descriptor updated */
++	titan_ge_eth->tx_curr_desc_q = (curr_desc + 1) % TITAN_GE_TX_QUEUE;
++
++	/* Prefetch the next descriptor */
++	prefetch((const void *)
++		 &titan_ge_eth->tx_desc_area[titan_ge_eth->tx_curr_desc_q]);
++}
++
++/*
++ * Actually does the open of the Ethernet device
++ */
++static int titan_ge_eth_open(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	struct device *device = &titan_ge_device[port_num]->dev;
++	unsigned long reg_data;
++	unsigned int phy_reg;
++	int err = 0;
++
++	/* Stop the Rx activity */
++	reg_data = TITAN_GE_READ(TITAN_GE_RMAC_CONFIG_1 + (port_num << 12));
++	reg_data &= ~(0x00000001);
++	TITAN_GE_WRITE((TITAN_GE_RMAC_CONFIG_1 + (port_num << 12)), reg_data);
++
++	/* Clear the port interrupts */
++	TITAN_GE_WRITE((TITAN_GE_CHANNEL0_INTERRUPT + (port_num << 8)), 0x0);
++
++	if (config_done == 0) {
++		TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_CORE_A, 0);
++		TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_CORE_B, 0);
++	}
++
++	/* Set the MAC Address */
++	memcpy(titan_ge_eth->port_mac_addr, netdev->dev_addr, 6);
++
++	if (config_done == 0)
++		titan_port_init(netdev, titan_ge_eth);
++
++	titan_ge_update_afx(titan_ge_eth);
++
++	/* Allocate the Tx ring now */
++	titan_ge_eth->tx_ring_skbs = 0;
++	titan_ge_eth->tx_ring_size = TITAN_GE_TX_QUEUE;
++
++	/* Allocate space in the SRAM for the descriptors */
++	titan_ge_eth->tx_desc_area = (titan_ge_tx_desc *)
++		(titan_ge_sram + TITAN_TX_RING_BYTES * port_num);
++	titan_ge_eth->tx_dma = TITAN_SRAM_BASE + TITAN_TX_RING_BYTES * port_num;
++
++	if (!titan_ge_eth->tx_desc_area) {
++		printk(KERN_ERR
++		       "%s: Cannot allocate Tx Ring (size %d bytes) for port %d\n",
++		       netdev->name, TITAN_TX_RING_BYTES, port_num);
++		return -ENOMEM;
++	}
++
++	memset(titan_ge_eth->tx_desc_area, 0, titan_ge_eth->tx_desc_area_size);
++
++	/* Now initialize the Tx descriptor ring */
++	titan_ge_init_tx_desc_ring(titan_ge_eth,
++				   titan_ge_eth->tx_ring_size,
++				   (unsigned long) titan_ge_eth->tx_desc_area,
++				   (unsigned long) titan_ge_eth->tx_dma);
++
++	/* Allocate the Rx ring now */
++	titan_ge_eth->rx_ring_size = TITAN_GE_RX_QUEUE;
++	titan_ge_eth->rx_ring_skbs = 0;
++
++	titan_ge_eth->rx_desc_area =
++		(titan_ge_rx_desc *)(titan_ge_sram + 0x1000 + TITAN_RX_RING_BYTES * port_num);
++
++	titan_ge_eth->rx_dma = TITAN_SRAM_BASE + 0x1000 + TITAN_RX_RING_BYTES * port_num;
++
++	if (!titan_ge_eth->rx_desc_area) {
++		printk(KERN_ERR "%s: Cannot allocate Rx Ring (size %d bytes)\n",
++		       netdev->name, TITAN_RX_RING_BYTES);
++
++		printk(KERN_ERR "%s: Freeing previously allocated TX queues...",
++		       netdev->name);
++
++		dma_free_coherent(device, titan_ge_eth->tx_desc_area_size,
++				    (void *) titan_ge_eth->tx_desc_area,
++				    titan_ge_eth->tx_dma);
++
++		return -ENOMEM;
++	}
++
++	memset(titan_ge_eth->rx_desc_area, 0, titan_ge_eth->rx_desc_area_size);
++
++	/* Now initialize the Rx ring */
++#ifdef TITAN_GE_JUMBO_FRAMES
++	if ((titan_ge_init_rx_desc_ring
++	    (titan_ge_eth, titan_ge_eth->rx_ring_size, TITAN_GE_JUMBO_BUFSIZE,
++	     (unsigned long) titan_ge_eth->rx_desc_area, 0,
++	      (unsigned long) titan_ge_eth->rx_dma)) == 0)
++#else
++	if ((titan_ge_init_rx_desc_ring
++	     (titan_ge_eth, titan_ge_eth->rx_ring_size, TITAN_GE_STD_BUFSIZE,
++	      (unsigned long) titan_ge_eth->rx_desc_area, 0,
++	      (unsigned long) titan_ge_eth->rx_dma)) == 0)
++#endif
++		panic("%s: Error initializing RX Ring\n", netdev->name);
++
++	/* Fill the Rx ring with the SKBs */
++	titan_ge_port_start(netdev, titan_ge_eth);
++
++	/*
++	 * Check if Interrupt Coalscing needs to be turned on. The
++	 * values specified in the register is multiplied by
++	 * (8 x 64 nanoseconds) to determine when an interrupt should
++	 * be sent to the CPU.
++	 */
++
++	if (TITAN_GE_TX_COAL) {
++		titan_ge_eth->tx_int_coal =
++		    titan_ge_tx_coal(TITAN_GE_TX_COAL, port_num);
++	}
++
++	err = titan_ge_mdio_read(port_num, TITAN_GE_MDIO_PHY_STATUS, &phy_reg);
++	if (err == TITAN_GE_MDIO_ERROR) {
++		printk(KERN_ERR
++		       "Could not read PHY control register 0x11 \n");
++		return TITAN_ERROR;
++	}
++	if (!(phy_reg & 0x0400)) {
++		netif_carrier_off(netdev);
++		netif_stop_queue(netdev);
++		return TITAN_ERROR;
++	} else {
++		netif_carrier_on(netdev);
++		netif_start_queue(netdev);
++	}
++
++	return TITAN_OK;
++}
++
++/*
++ * Queue the packet for Tx. Currently no support for zero copy,
++ * checksum offload and Scatter Gather. The chip does support
++ * Scatter Gather only. But, that wont help here since zero copy
++ * requires support for Tx checksumming also.
++ */
++int titan_ge_start_xmit(struct sk_buff *skb, struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned long flags;
++	struct net_device_stats *stats;
++//printk("titan_ge_start_xmit\n");
++
++	stats = &titan_ge_eth->stats;
++	spin_lock_irqsave(&titan_ge_eth->lock, flags);
++
++	if ((TITAN_GE_TX_QUEUE - titan_ge_eth->tx_ring_skbs) <=
++	    (skb_shinfo(skb)->nr_frags + 1)) {
++		netif_stop_queue(netdev);
++		spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++		printk(KERN_ERR "Tx OOD \n");
++		return 1;
++	}
++
++	titan_ge_tx_queue(titan_ge_eth, skb);
++	titan_ge_eth->tx_ring_skbs++;
++
++	if (TITAN_GE_TX_QUEUE <= (titan_ge_eth->tx_ring_skbs + 4)) {
++		spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++		titan_ge_free_tx_queue(titan_ge_eth);
++		spin_lock_irqsave(&titan_ge_eth->lock, flags);
++	}
++
++	stats->tx_bytes += skb->len;
++	stats->tx_packets++;
++
++	spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++
++	netdev->trans_start = jiffies;
++
++	return 0;
++}
++
++/*
++ * Actually does the Rx. Rx side checksumming supported.
++ */
++static int titan_ge_rx(struct net_device *netdev, int port_num,
++			titan_ge_port_info * titan_ge_port,
++		       titan_ge_packet * packet)
++{
++	int rx_curr_desc, rx_used_desc;
++	volatile titan_ge_rx_desc *rx_desc;
++
++	rx_curr_desc = titan_ge_port->rx_curr_desc_q;
++	rx_used_desc = titan_ge_port->rx_used_desc_q;
++
++	if (((rx_curr_desc + 1) % TITAN_GE_RX_QUEUE) == rx_used_desc)
++		return TITAN_ERROR;
++
++	rx_desc = &(titan_ge_port->rx_desc_area[rx_curr_desc]);
++
++	if (rx_desc->cmd_sts & TITAN_GE_RX_BUFFER_OWNED)
++		return TITAN_ERROR;
++
++	packet->skb = titan_ge_port->rx_skb[rx_curr_desc];
++	packet->len = (rx_desc->cmd_sts & 0x7fff);
++
++	/*
++	 * At this point, we dont know if the checksumming
++	 * actually helps relieve CPU. So, keep it for
++	 * port 0 only
++	 */
++	packet->checksum = ntohs((rx_desc->buffer & 0xffff0000) >> 16);
++	packet->cmd_sts = rx_desc->cmd_sts;
++
++	titan_ge_port->rx_curr_desc_q = (rx_curr_desc + 1) % TITAN_GE_RX_QUEUE;
++
++	/* Prefetch the next descriptor */
++	prefetch((const void *)
++	       &titan_ge_port->rx_desc_area[titan_ge_port->rx_curr_desc_q + 1]);
++
++	return TITAN_OK;
++}
++
++/*
++ * Free the Tx queue of the used SKBs
++ */
++static int titan_ge_free_tx_queue(titan_ge_port_info *titan_ge_eth)
++{
++	unsigned long flags;
++
++	/* Take the lock */
++	spin_lock_irqsave(&(titan_ge_eth->lock), flags);
++
++	while (titan_ge_return_tx_desc(titan_ge_eth, titan_ge_eth->port_num) == 0)
++		if (titan_ge_eth->tx_ring_skbs != 1)
++			titan_ge_eth->tx_ring_skbs--;
++
++	spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++
++	return TITAN_OK;
++}
++
++/*
++ * Threshold beyond which we do the cleaning of
++ * Tx queue and new allocation for the Rx
++ * queue
++ */
++#define	TX_THRESHOLD	4
++#define	RX_THRESHOLD	10
++
++/*
++ * Receive the packets and send it to the kernel.
++ */
++static int titan_ge_receive_queue(struct net_device *netdev, unsigned int max)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	titan_ge_packet packet;
++	struct net_device_stats *stats;
++	struct sk_buff *skb;
++	unsigned long received_packets = 0;
++	unsigned int ack;
++
++	stats = &titan_ge_eth->stats;
++
++	while ((--max)
++	       && (titan_ge_rx(netdev, port_num, titan_ge_eth, &packet) == TITAN_OK)) {
++		skb = (struct sk_buff *) packet.skb;
++
++		titan_ge_eth->rx_ring_skbs--;
++
++		if (--titan_ge_eth->rx_work_limit < 0)
++			break;
++		received_packets++;
++
++		stats->rx_packets++;
++		stats->rx_bytes += packet.len;
++
++		if ((packet.cmd_sts & TITAN_GE_RX_PERR) ||
++			(packet.cmd_sts & TITAN_GE_RX_OVERFLOW_ERROR) ||
++			(packet.cmd_sts & TITAN_GE_RX_TRUNC) ||
++			(packet.cmd_sts & TITAN_GE_RX_CRC_ERROR)) {
++				stats->rx_dropped++;
++				dev_kfree_skb_any(skb);
++
++				continue;
++		}
++		/*
++		 * Either support fast path or slow path. Decision
++		 * making can really slow down the performance. The
++		 * idea is to cut down the number of checks and improve
++		 * the fastpath.
++		 */
++
++		skb_put(skb, packet.len - 2);
++
++		/*
++		 * Increment data pointer by two since thats where
++		 * the MAC starts
++		 */
++		skb_reserve(skb, 2);
++		skb->protocol = eth_type_trans(skb, netdev);
++		netif_receive_skb(skb);
++
++		if (titan_ge_eth->rx_threshold > RX_THRESHOLD) {
++			ack = titan_ge_rx_task(netdev, titan_ge_eth);
++			TITAN_GE_WRITE((0x5048 + (port_num << 8)), ack);
++			titan_ge_eth->rx_threshold = 0;
++		} else
++			titan_ge_eth->rx_threshold++;
++
++		if (titan_ge_eth->tx_threshold > TX_THRESHOLD) {
++			titan_ge_eth->tx_threshold = 0;
++			titan_ge_free_tx_queue(titan_ge_eth);
++		}
++		else
++			titan_ge_eth->tx_threshold++;
++
++	}
++	return received_packets;
++}
++
++
++/*
++ * Enable the Rx side interrupts
++ */
++static void titan_ge_enable_int(unsigned int port_num,
++			titan_ge_port_info *titan_ge_eth,
++			struct net_device *netdev)
++{
++	unsigned long reg_data = TITAN_GE_READ(TITAN_GE_INTR_XDMA_IE);
++
++	if (port_num == 0)
++		reg_data |= 0x3;
++	if (port_num == 1)
++		reg_data |= 0x300;
++	if (port_num == 2)
++		reg_data |= 0x30000;
++
++	/* Re-enable interrupts */
++	TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_IE, reg_data);
++}
++
++/*
++ * Main function to handle the polling for Rx side NAPI.
++ * Receive interrupts have been disabled at this point.
++ * The poll schedules the transmit followed by receive.
++ */
++static int titan_ge_poll(struct net_device *netdev, int *budget)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	int port_num = titan_ge_eth->port_num;
++	int work_done = 0;
++	unsigned long flags, status;
++
++	titan_ge_eth->rx_work_limit = *budget;
++	if (titan_ge_eth->rx_work_limit > netdev->quota)
++		titan_ge_eth->rx_work_limit = netdev->quota;
++
++	do {
++		/* Do the transmit cleaning work here */
++		titan_ge_free_tx_queue(titan_ge_eth);
++
++		/* Ack the Rx interrupts */
++		if (port_num == 0)
++			TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_CORE_A, 0x3);
++		if (port_num == 1)
++			TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_CORE_A, 0x300);
++		if (port_num == 2)
++			TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_CORE_A, 0x30000);
++
++		work_done += titan_ge_receive_queue(netdev, 0);
++
++		/* Out of quota and there is work to be done */
++		if (titan_ge_eth->rx_work_limit < 0)
++			goto not_done;
++
++		/* Receive alloc_skb could lead to OOM */
++		if (oom_flag == 1) {
++			oom_flag = 0;
++			goto oom;
++		}
++
++		status = TITAN_GE_READ(TITAN_GE_INTR_XDMA_CORE_A);
++	} while (status & 0x30300);
++
++	/* If we are here, then no more interrupts to process */
++	goto done;
++
++not_done:
++	*budget -= work_done;
++	netdev->quota -= work_done;
++	return 1;
++
++oom:
++	printk(KERN_ERR "OOM \n");
++	netif_rx_complete(netdev);
++	return 0;
++
++done:
++	/*
++	 * No more packets on the poll list. Turn the interrupts
++	 * back on and we should be able to catch the new
++	 * packets in the interrupt handler
++	 */
++	if (!work_done)
++		work_done = 1;
++
++	*budget -= work_done;
++	netdev->quota -= work_done;
++
++	spin_lock_irqsave(&titan_ge_eth->lock, flags);
++
++	/* Remove us from the poll list */
++	netif_rx_complete(netdev);
++
++	/* Re-enable interrupts */
++	titan_ge_enable_int(port_num, titan_ge_eth, netdev);
++
++	spin_unlock_irqrestore(&titan_ge_eth->lock, flags);
++
++	return 0;
++}
++
++/*
++ * Close the network device
++ */
++int titan_ge_stop(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++
++	spin_lock_irq(&(titan_ge_eth->lock));
++	titan_ge_eth_stop(netdev);
++	free_irq(netdev->irq, netdev);
++	spin_unlock_irq(&titan_ge_eth->lock);
++
++	return TITAN_OK;
++}
++
++/*
++ * Free the Tx ring
++ */
++static void titan_ge_free_tx_rings(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	unsigned int curr;
++	unsigned long reg_data;
++
++	/* Stop the Tx DMA */
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG +
++				(port_num << 8));
++	reg_data |= 0xc0000000;
++	TITAN_GE_WRITE((TITAN_GE_CHANNEL0_CONFIG +
++			(port_num << 8)), reg_data);
++
++	/* Disable the TMAC */
++	reg_data = TITAN_GE_READ(TITAN_GE_TMAC_CONFIG_1 +
++				(port_num << 12));
++	reg_data &= ~(0x00000001);
++	TITAN_GE_WRITE((TITAN_GE_TMAC_CONFIG_1 +
++			(port_num << 12)), reg_data);
++
++	for (curr = 0;
++	     (titan_ge_eth->tx_ring_skbs) && (curr < TITAN_GE_TX_QUEUE);
++	     curr++) {
++		if (titan_ge_eth->tx_skb[curr]) {
++			dev_kfree_skb(titan_ge_eth->tx_skb[curr]);
++			titan_ge_eth->tx_ring_skbs--;
++		}
++	}
++
++	if (titan_ge_eth->tx_ring_skbs != 0)
++		printk
++		    ("%s: Error on Tx descriptor free - could not free %d"
++		     " descriptors\n", netdev->name,
++		     titan_ge_eth->tx_ring_skbs);
++
++#ifndef TITAN_RX_RING_IN_SRAM
++	dma_free_coherent(&titan_ge_device[port_num]->dev,
++			  titan_ge_eth->tx_desc_area_size,
++			  (void *) titan_ge_eth->tx_desc_area,
++			  titan_ge_eth->tx_dma);
++#endif
++}
++
++/*
++ * Free the Rx ring
++ */
++static void titan_ge_free_rx_rings(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	unsigned int curr;
++	unsigned long reg_data;
++
++	/* Stop the Rx DMA */
++	reg_data = TITAN_GE_READ(TITAN_GE_CHANNEL0_CONFIG +
++				(port_num << 8));
++	reg_data |= 0x000c0000;
++	TITAN_GE_WRITE((TITAN_GE_CHANNEL0_CONFIG +
++			(port_num << 8)), reg_data);
++
++	/* Disable the RMAC */
++	reg_data = TITAN_GE_READ(TITAN_GE_RMAC_CONFIG_1 +
++				(port_num << 12));
++	reg_data &= ~(0x00000001);
++	TITAN_GE_WRITE((TITAN_GE_RMAC_CONFIG_1 +
++			(port_num << 12)), reg_data);
++
++	for (curr = 0;
++	     titan_ge_eth->rx_ring_skbs && (curr < TITAN_GE_RX_QUEUE);
++	     curr++) {
++		if (titan_ge_eth->rx_skb[curr]) {
++			dev_kfree_skb(titan_ge_eth->rx_skb[curr]);
++			titan_ge_eth->rx_ring_skbs--;
++		}
++	}
++
++	if (titan_ge_eth->rx_ring_skbs != 0)
++		printk(KERN_ERR
++		       "%s: Error in freeing Rx Ring. %d skb's still"
++		       " stuck in RX Ring - ignoring them\n", netdev->name,
++		       titan_ge_eth->rx_ring_skbs);
++
++#ifndef TITAN_RX_RING_IN_SRAM
++	dma_free_coherent(&titan_ge_device[port_num]->dev,
++			  titan_ge_eth->rx_desc_area_size,
++			  (void *) titan_ge_eth->rx_desc_area,
++			  titan_ge_eth->rx_dma);
++#endif
++}
++
++/*
++ * Actually does the stop of the Ethernet device
++ */
++static void titan_ge_eth_stop(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++
++	netif_stop_queue(netdev);
++
++	titan_ge_port_reset(titan_ge_eth->port_num);
++
++	titan_ge_free_tx_rings(netdev);
++	titan_ge_free_rx_rings(netdev);
++
++	/* Disable the Tx and Rx Interrupts for all channels */
++	TITAN_GE_WRITE(TITAN_GE_INTR_XDMA_IE, 0x0);
++}
++
++/*
++ * Update the MAC address. Note that we have to write the
++ * address in three station registers, 16 bits each. And this
++ * has to be done for TMAC and RMAC
++ */
++static void titan_ge_update_mac_address(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++	unsigned int port_num = titan_ge_eth->port_num;
++	u8 p_addr[6];
++
++	memcpy(titan_ge_eth->port_mac_addr, netdev->dev_addr, 6);
++	memcpy(p_addr, netdev->dev_addr, 6);
++
++	/* Update the Address Filtering Match tables */
++	titan_ge_update_afx(titan_ge_eth);
++
++	printk("Station MAC : %d %d %d %d %d %d  \n",
++		p_addr[5], p_addr[4], p_addr[3],
++		p_addr[2], p_addr[1], p_addr[0]);
++
++	/* Set the MAC address here for TMAC and RMAC */
++	TITAN_GE_WRITE((TITAN_GE_TMAC_STATION_HI + (port_num << 12)),
++		       ((p_addr[5] << 8) | p_addr[4]));
++	TITAN_GE_WRITE((TITAN_GE_TMAC_STATION_MID + (port_num << 12)),
++		       ((p_addr[3] << 8) | p_addr[2]));
++	TITAN_GE_WRITE((TITAN_GE_TMAC_STATION_LOW + (port_num << 12)),
++		       ((p_addr[1] << 8) | p_addr[0]));
++
++	TITAN_GE_WRITE((TITAN_GE_RMAC_STATION_HI + (port_num << 12)),
++		       ((p_addr[5] << 8) | p_addr[4]));
++	TITAN_GE_WRITE((TITAN_GE_RMAC_STATION_MID + (port_num << 12)),
++		       ((p_addr[3] << 8) | p_addr[2]));
++	TITAN_GE_WRITE((TITAN_GE_RMAC_STATION_LOW + (port_num << 12)),
++		       ((p_addr[1] << 8) | p_addr[0]));
++}
++
++/*
++ * Set the MAC address of the Ethernet device
++ */
++static int titan_ge_set_mac_address(struct net_device *dev, void *addr)
++{
++	titan_ge_port_info *tp = netdev_priv(dev);
++	struct sockaddr *sa = addr;
++
++	memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
++
++	spin_lock_irq(&tp->lock);
++	titan_ge_update_mac_address(dev);
++	spin_unlock_irq(&tp->lock);
++
++	return 0;
++}
++
++/*
++ * Get the Ethernet device stats
++ */
++static struct net_device_stats *titan_ge_get_stats(struct net_device *netdev)
++{
++	titan_ge_port_info *titan_ge_eth = netdev_priv(netdev);
++
++	return &titan_ge_eth->stats;
++}
++
++/*
++ * Initialize the Rx descriptor ring for the Titan Ge
++ */
++static int titan_ge_init_rx_desc_ring(titan_ge_port_info * titan_eth_port,
++				      int rx_desc_num,
++				      int rx_buff_size,
++				      unsigned long rx_desc_base_addr,
++				      unsigned long rx_buff_base_addr,
++				      unsigned long rx_dma)
++{
++	volatile titan_ge_rx_desc *rx_desc;
++	unsigned long buffer_addr;
++	int index;
++	unsigned long titan_ge_rx_desc_bus = rx_dma;
++
++	buffer_addr = rx_buff_base_addr;
++	rx_desc = (titan_ge_rx_desc *) rx_desc_base_addr;
++
++	/* Check alignment */
++	if (rx_buff_base_addr & 0xF)
++		return 0;
++
++	/* Check Rx buffer size */
++	if ((rx_buff_size < 8) || (rx_buff_size > TITAN_GE_MAX_RX_BUFFER))
++		return 0;
++
++	/* 64-bit alignment
++	if ((rx_buff_base_addr + rx_buff_size) & 0x7)
++		return 0; */
++
++	/* Initialize the Rx desc ring */
++	for (index = 0; index < rx_desc_num; index++) {
++		titan_ge_rx_desc_bus += sizeof(titan_ge_rx_desc);
++		rx_desc[index].cmd_sts = 0;
++		rx_desc[index].buffer_addr = buffer_addr;
++		titan_eth_port->rx_skb[index] = NULL;
++		buffer_addr += rx_buff_size;
++	}
++
++	titan_eth_port->rx_curr_desc_q = 0;
++	titan_eth_port->rx_used_desc_q = 0;
++
++	titan_eth_port->rx_desc_area = (titan_ge_rx_desc *) rx_desc_base_addr;
++	titan_eth_port->rx_desc_area_size =
++	    rx_desc_num * sizeof(titan_ge_rx_desc);
++
++	titan_eth_port->rx_dma = rx_dma;
++
++	return TITAN_OK;
++}
++
++/*
++ * Initialize the Tx descriptor ring. Descriptors in the SRAM
++ */
++static int titan_ge_init_tx_desc_ring(titan_ge_port_info * titan_ge_port,
++				      int tx_desc_num,
++				      unsigned long tx_desc_base_addr,
++				      unsigned long tx_dma)
++{
++	titan_ge_tx_desc *tx_desc;
++	int index;
++	unsigned long titan_ge_tx_desc_bus = tx_dma;
++
++	if (tx_desc_base_addr & 0xF)
++		return 0;
++
++	tx_desc = (titan_ge_tx_desc *) tx_desc_base_addr;
++
++	for (index = 0; index < tx_desc_num; index++) {
++		titan_ge_port->tx_dma_array[index] =
++		    (dma_addr_t) titan_ge_tx_desc_bus;
++		titan_ge_tx_desc_bus += sizeof(titan_ge_tx_desc);
++		tx_desc[index].cmd_sts = 0x0000;
++		tx_desc[index].buffer_len = 0;
++		tx_desc[index].buffer_addr = 0x00000000;
++		titan_ge_port->tx_skb[index] = NULL;
++	}
++
++	titan_ge_port->tx_curr_desc_q = 0;
++	titan_ge_port->tx_used_desc_q = 0;
++
++	titan_ge_port->tx_desc_area = (titan_ge_tx_desc *) tx_desc_base_addr;
++	titan_ge_port->tx_desc_area_size =
++	    tx_desc_num * sizeof(titan_ge_tx_desc);
++
++	titan_ge_port->tx_dma = tx_dma;
++	return TITAN_OK;
++}
++
++/*
++ * Initialize the device as an Ethernet device
++ */
++static int __init titan_ge_probe(struct device *device)
++{
++	titan_ge_port_info *titan_ge_eth;
++	struct net_device *netdev;
++	int port = to_platform_device(device)->id;
++	int err;
++
++	netdev = alloc_etherdev(sizeof(titan_ge_port_info));
++	if (!netdev) {
++		err = -ENODEV;
++		goto out;
++	}
++
++	netdev->open = titan_ge_open;
++	netdev->stop = titan_ge_stop;
++	netdev->hard_start_xmit = titan_ge_start_xmit;
++	netdev->get_stats = titan_ge_get_stats;
++	netdev->set_multicast_list = titan_ge_set_multi;
++	netdev->set_mac_address = titan_ge_set_mac_address;
++
++	/* Tx timeout */
++	netdev->tx_timeout = titan_ge_tx_timeout;
++	netdev->watchdog_timeo = 2 * HZ;
++
++	/* Set these to very high values */
++	netdev->poll = titan_ge_poll;
++	netdev->weight = 64;
++
++	netdev->tx_queue_len = TITAN_GE_TX_QUEUE;
++	netif_carrier_off(netdev);
++	netdev->base_addr = 0;
++
++	netdev->change_mtu = titan_ge_change_mtu;
++
++	titan_ge_eth = netdev_priv(netdev);
++	/* Allocation of memory for the driver structures */
++
++	titan_ge_eth->port_num = port;
++
++	/* Configure the Tx timeout handler */
++	INIT_WORK(&titan_ge_eth->tx_timeout_task,
++		  (void (*)(void *)) titan_ge_tx_timeout_task, netdev);
++
++	spin_lock_init(&titan_ge_eth->lock);
++
++	/* set MAC addresses */
++	memcpy(netdev->dev_addr, titan_ge_mac_addr_base, 6);
++	netdev->dev_addr[5] += port;
++
++	err = register_netdev(netdev);
++
++	if (err)
++		goto out_free_netdev;
++
++	printk(KERN_NOTICE
++	       "%s: port %d with MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
++	       netdev->name, port, netdev->dev_addr[0],
++	       netdev->dev_addr[1], netdev->dev_addr[2],
++	       netdev->dev_addr[3], netdev->dev_addr[4],
++	       netdev->dev_addr[5]);
++
++	printk(KERN_NOTICE "Rx NAPI supported, Tx Coalescing ON \n");
++
++	return 0;
++
++out_free_netdev:
++	kfree(netdev);
++
++out:
++	return err;
++}
++
++static void __devexit titan_device_remove(struct device *device)
++{
++}
++
++/*
++ * Reset the Ethernet port
++ */
++static void titan_ge_port_reset(unsigned int port_num)
++{
++	unsigned int reg_data;
++
++	/* Stop the Tx port activity */
++	reg_data = TITAN_GE_READ(TITAN_GE_TMAC_CONFIG_1 +
++				(port_num << 12));
++	reg_data &= ~(0x0001);
++	TITAN_GE_WRITE((TITAN_GE_TMAC_CONFIG_1 +
++			(port_num << 12)), reg_data);
++
++	/* Stop the Rx port activity */
++	reg_data = TITAN_GE_READ(TITAN_GE_RMAC_CONFIG_1 +
++				(port_num << 12));
++	reg_data &= ~(0x0001);
++	TITAN_GE_WRITE((TITAN_GE_RMAC_CONFIG_1 +
++			(port_num << 12)), reg_data);
++
++	return;
++}
++
++/*
++ * Return the Tx desc after use by the XDMA
++ */
++static int titan_ge_return_tx_desc(titan_ge_port_info * titan_ge_eth, int port)
++{
++	int tx_desc_used;
++	struct sk_buff *skb;
++
++	tx_desc_used = titan_ge_eth->tx_used_desc_q;
++
++	/* return right away */
++	if (tx_desc_used == titan_ge_eth->tx_curr_desc_q)
++		return TITAN_ERROR;
++
++	/* Now the critical stuff */
++	skb = titan_ge_eth->tx_skb[tx_desc_used];
++
++	dev_kfree_skb_any(skb);
++
++	titan_ge_eth->tx_skb[tx_desc_used] = NULL;
++	titan_ge_eth->tx_used_desc_q =
++	    (tx_desc_used + 1) % TITAN_GE_TX_QUEUE;
++
++	return 0;
++}
++
++/*
++ * Coalescing for the Tx path
++ */
++static unsigned long titan_ge_tx_coal(unsigned long delay, int port)
++{
++	unsigned long rx_delay;
++
++	rx_delay = TITAN_GE_READ(TITAN_GE_INT_COALESCING);
++	delay = (delay << 16) | rx_delay;
++
++	TITAN_GE_WRITE(TITAN_GE_INT_COALESCING, delay);
++	TITAN_GE_WRITE(0x5038, delay);
++
++	return delay;
++}
++
++static struct device_driver titan_soc_driver = {
++	.name   = titan_string,
++	.bus    = &platform_bus_type,
++	.probe  = titan_ge_probe,
++	.remove = __devexit_p(titan_device_remove),
++};
++
++static void titan_platform_release (struct device *device)
++{
++	struct platform_device *pldev;
++
++	/* free device */
++	pldev = to_platform_device (device);
++	kfree (pldev);
++}
++
++/*
++ * Register the Titan GE with the kernel
++ */
++static int __init titan_ge_init_module(void)
++{
++	struct platform_device *pldev;
++	unsigned int version, device;
++	int i;
++
++	printk(KERN_NOTICE
++	       "PMC-Sierra TITAN 10/100/1000 Ethernet Driver \n");
++
++	titan_ge_base = (unsigned long) ioremap(TITAN_GE_BASE, TITAN_GE_SIZE);
++	if (!titan_ge_base) {
++		printk("Mapping Titan GE failed\n");
++		goto out;
++	}
++
++	device = TITAN_GE_READ(TITAN_GE_DEVICE_ID);
++	version = (device & 0x000f0000) >> 16;
++	device &= 0x0000ffff;
++
++	printk(KERN_NOTICE "Device Id : %x,  Version : %x \n", device, version);
++
++#ifdef TITAN_RX_RING_IN_SRAM
++	titan_ge_sram = (unsigned long) ioremap(TITAN_SRAM_BASE,
++						TITAN_SRAM_SIZE);
++	if (!titan_ge_sram) {
++		printk("Mapping Titan SRAM failed\n");
++		goto out_unmap_ge;
++	}
++#endif
++
++	if (driver_register(&titan_soc_driver)) {
++		printk(KERN_ERR "Driver registration failed\n");
++		goto out_unmap_sram;
++	}
++
++	for (i = 0; i < 3; i++) {
++		titan_ge_device[i] = NULL;
++
++	        if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL)))
++	                continue;
++
++                memset (pldev, 0, sizeof (*pldev));
++                pldev->name		= titan_string;
++                pldev->id		= i;
++                pldev->dev.release	= titan_platform_release;
++                titan_ge_device[i]	= pldev;
++
++                if (platform_device_register (pldev)) {
++                        kfree (pldev);
++                        titan_ge_device[i] = NULL;
++                        continue;
++                }
++                                                                                
++                if (!pldev->dev.driver) {
++	                /*
++			 * The driver was not bound to this device, there was
++	                 * no hardware at this address. Unregister it, as the
++	                 * release fuction will take care of freeing the
++	                 * allocated structure
++			 */
++                        titan_ge_device[i] = NULL;
++                        platform_device_unregister (pldev);
++                }
++        }
++
++	return 0;
++
++out_unmap_sram:
++	iounmap((void *)titan_ge_sram);
++
++out_unmap_ge:
++	iounmap((void *)titan_ge_base);
++
++out:
++	return -ENOMEM;
++}
++
++/*
++ * Unregister the Titan GE from the kernel
++ */
++static void __exit titan_ge_cleanup_module(void)
++{
++	int i;
++
++	driver_unregister(&titan_soc_driver);
++
++	for (i = 0; i < 3; i++) {
++		if (titan_ge_device[i]) {
++			platform_device_unregister (titan_ge_device[i]);
++			titan_ge_device[i] = NULL;
++		}
++	}
++
++	iounmap((void *)titan_ge_sram);
++	iounmap((void *)titan_ge_base);
++}
++
++MODULE_AUTHOR("Manish Lachwani <lachwani@pmc-sierra.com>");
++MODULE_DESCRIPTION("Titan GE Ethernet driver");
++MODULE_LICENSE("GPL");
++
++module_init(titan_ge_init_module);
++module_exit(titan_ge_cleanup_module);
+diff -Naur linux-2.6.16.orig/drivers/net/titan_ge.h linux-2.6.16/drivers/net/titan_ge.h
+--- linux-2.6.16.orig/drivers/net/titan_ge.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/titan_ge.h	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,417 @@
++#ifndef _TITAN_GE_H_
++#define _TITAN_GE_H_
++
++#include <linux/config.h>
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/config.h>
++#include <linux/spinlock.h>
++#include <asm/byteorder.h>
++
++/*
++ * These functions should be later moved to a more generic location since there
++ * will be others accessing it also
++ */
++
++/*
++ * This is the way it works: LKB5 Base is at 0x0128. TITAN_BASE is defined in
++ * include/asm/titan_dep.h. TITAN_GE_BASE is the value in the TITAN_GE_LKB5
++ * register.
++ */
++
++#define	TITAN_GE_BASE	0xfe000000UL
++#define	TITAN_GE_SIZE	0x10000UL
++
++extern unsigned long titan_ge_base;
++
++#define	TITAN_GE_WRITE(offset, data) \
++		*(volatile u32 *)(titan_ge_base + (offset)) = (data)
++
++#define TITAN_GE_READ(offset) *(volatile u32 *)(titan_ge_base + (offset))
++
++#ifndef msec_delay
++#define msec_delay(x)   do { if(in_interrupt()) { \
++				/* Don't mdelay in interrupt context! */ \
++				BUG(); \
++			} else { \
++				set_current_state(TASK_UNINTERRUPTIBLE); \
++				schedule_timeout((x * HZ)/1000); \
++			} } while(0)
++#endif
++
++#define TITAN_GE_PORT_0
++
++#define	TITAN_SRAM_BASE		((OCD_READ(RM9000x2_OCD_LKB13) & ~1) << 4)
++#define	TITAN_SRAM_SIZE		0x2000UL
++
++/*
++ * We may need these constants
++ */
++#define TITAN_BIT0    0x00000001
++#define TITAN_BIT1    0x00000002
++#define TITAN_BIT2    0x00000004
++#define TITAN_BIT3    0x00000008
++#define TITAN_BIT4    0x00000010
++#define TITAN_BIT5    0x00000020
++#define TITAN_BIT6    0x00000040
++#define TITAN_BIT7    0x00000080
++#define TITAN_BIT8    0x00000100
++#define TITAN_BIT9    0x00000200
++#define TITAN_BIT10   0x00000400
++#define TITAN_BIT11   0x00000800
++#define TITAN_BIT12   0x00001000
++#define TITAN_BIT13   0x00002000
++#define TITAN_BIT14   0x00004000
++#define TITAN_BIT15   0x00008000
++#define TITAN_BIT16   0x00010000
++#define TITAN_BIT17   0x00020000
++#define TITAN_BIT18   0x00040000
++#define TITAN_BIT19   0x00080000
++#define TITAN_BIT20   0x00100000
++#define TITAN_BIT21   0x00200000
++#define TITAN_BIT22   0x00400000
++#define TITAN_BIT23   0x00800000
++#define TITAN_BIT24   0x01000000
++#define TITAN_BIT25   0x02000000
++#define TITAN_BIT26   0x04000000
++#define TITAN_BIT27   0x08000000
++#define TITAN_BIT28   0x10000000
++#define TITAN_BIT29   0x20000000
++#define TITAN_BIT30   0x40000000
++#define TITAN_BIT31   0x80000000
++
++/* Flow Control */
++#define	TITAN_GE_FC_NONE	0x0
++#define	TITAN_GE_FC_FULL	0x1
++#define	TITAN_GE_FC_TX_PAUSE	0x2
++#define	TITAN_GE_FC_RX_PAUSE	0x3
++
++/* Duplex Settings */
++#define	TITAN_GE_FULL_DUPLEX	0x1
++#define	TITAN_GE_HALF_DUPLEX	0x2
++
++/* Speed settings */
++#define	TITAN_GE_SPEED_1000	0x1
++#define	TITAN_GE_SPEED_100	0x2
++#define	TITAN_GE_SPEED_10	0x3
++
++/* Debugging info only */
++#undef TITAN_DEBUG
++
++/* Keep the rings in the Titan's SSRAM */
++#define TITAN_RX_RING_IN_SRAM
++
++#ifdef CONFIG_64BIT
++#define	TITAN_GE_IE_MASK	0xfffffffffb001b64
++#define	TITAN_GE_IE_STATUS	0xfffffffffb001b60
++#else
++#define	TITAN_GE_IE_MASK	0xfb001b64
++#define	TITAN_GE_IE_STATUS	0xfb001b60
++#endif
++
++/* Support for Jumbo Frames */
++#undef TITAN_GE_JUMBO_FRAMES
++
++/* Rx buffer size */
++#ifdef TITAN_GE_JUMBO_FRAMES
++#define	TITAN_GE_JUMBO_BUFSIZE	9080
++#else
++#define	TITAN_GE_STD_BUFSIZE	1580
++#endif
++
++/*
++ * Tx and Rx Interrupt Coalescing parameter. These values are
++ * for 1 Ghz processor. Rx coalescing can be taken care of
++ * by NAPI. NAPI is adaptive and hence useful. Tx coalescing
++ * is not adaptive. Hence, these values need to be adjusted
++ * based on load, CPU speed etc.
++ */
++#define	TITAN_GE_RX_COAL	150
++#define	TITAN_GE_TX_COAL	300
++
++#if defined(__BIG_ENDIAN)
++
++/* Define the Rx descriptor */
++typedef struct eth_rx_desc {
++	u32     reserved;	/* Unused 		*/
++	u32     buffer_addr;	/* CPU buffer address 	*/
++	u32	cmd_sts;	/* Command and Status	*/
++	u32	buffer;		/* XDMA buffer address	*/
++} titan_ge_rx_desc;
++
++/* Define the Tx descriptor */
++typedef struct eth_tx_desc {
++	u16     cmd_sts;	/* Command, Status and Buffer count */
++	u16	buffer_len;	/* Length of the buffer	*/
++	u32     buffer_addr;	/* Physical address of the buffer */
++} titan_ge_tx_desc;
++
++#elif defined(__LITTLE_ENDIAN)
++
++/* Define the Rx descriptor */
++typedef struct eth_rx_desc {
++	u32	buffer_addr;	/* CPU buffer address   */
++	u32	reserved;	/* Unused               */
++	u32	buffer;		/* XDMA buffer address  */
++	u32	cmd_sts;	/* Command and Status   */
++} titan_ge_rx_desc;
++
++/* Define the Tx descriptor */
++typedef struct eth_tx_desc {
++	u32     buffer_addr;	/* Physical address of the buffer */
++	u16     buffer_len;     /* Length of the buffer */
++	u16     cmd_sts;        /* Command, Status and Buffer count */
++} titan_ge_tx_desc;
++#endif
++
++/* Default Tx Queue Size */
++#define	TITAN_GE_TX_QUEUE	128
++#define TITAN_TX_RING_BYTES	(TITAN_GE_TX_QUEUE * sizeof(struct eth_tx_desc))
++
++/* Default Rx Queue Size */
++#define	TITAN_GE_RX_QUEUE	64
++#define TITAN_RX_RING_BYTES	(TITAN_GE_RX_QUEUE * sizeof(struct eth_rx_desc))
++
++/* Packet Structure */
++typedef struct _pkt_info {
++	unsigned int           len;
++	unsigned int            cmd_sts;
++	unsigned int            buffer;
++	struct sk_buff          *skb;
++	unsigned int		checksum;
++} titan_ge_packet;
++
++
++#define	PHYS_CNT	3
++
++/* Titan Port specific data structure */
++typedef struct _eth_port_ctrl {
++	unsigned int		port_num;
++	u8			port_mac_addr[6];
++
++	/* Rx descriptor pointers */
++	int 			rx_curr_desc_q, rx_used_desc_q;
++
++	/* Tx descriptor pointers */
++	int 			tx_curr_desc_q, tx_used_desc_q;
++
++	/* Rx descriptor area */
++	volatile titan_ge_rx_desc	*rx_desc_area;
++	unsigned int			rx_desc_area_size;
++	struct sk_buff*			rx_skb[TITAN_GE_RX_QUEUE];
++
++	/* Tx Descriptor area */
++	volatile titan_ge_tx_desc	*tx_desc_area;
++	unsigned int                    tx_desc_area_size;
++	struct sk_buff*                 tx_skb[TITAN_GE_TX_QUEUE];
++
++	/* Timeout task */
++	struct work_struct		tx_timeout_task;
++
++	/* DMA structures and handles */
++	dma_addr_t			tx_dma;
++	dma_addr_t			rx_dma;
++	dma_addr_t			tx_dma_array[TITAN_GE_TX_QUEUE];
++
++	/* Device lock */
++	spinlock_t			lock;
++
++	unsigned int			tx_ring_skbs;
++	unsigned int			rx_ring_size;
++	unsigned int			tx_ring_size;
++	unsigned int			rx_ring_skbs;
++
++	struct net_device_stats		stats;
++
++	/* Tx and Rx coalescing */
++	unsigned long			rx_int_coal;
++	unsigned long			tx_int_coal;
++
++	/* Threshold for replenishing the Rx and Tx rings */
++	unsigned int			tx_threshold;
++	unsigned int			rx_threshold;
++
++	/* NAPI work limit */
++	unsigned int			rx_work_limit;
++} titan_ge_port_info;
++
++/* Titan specific constants */
++#define	TITAN_ETH_PORT_IRQ		3
++
++/* Max Rx buffer */
++#define	TITAN_GE_MAX_RX_BUFFER		65536
++
++/* Tx and Rx Error */
++#define	TITAN_GE_ERROR
++
++/* Rx Descriptor Command and Status */
++
++#define	TITAN_GE_RX_CRC_ERROR		TITAN_BIT27	/* crc error */
++#define	TITAN_GE_RX_OVERFLOW_ERROR	TITAN_BIT15	/* overflow */
++#define TITAN_GE_RX_BUFFER_OWNED	TITAN_BIT21	/* buffer ownership */
++#define	TITAN_GE_RX_STP			TITAN_BIT31	/* start of packet */
++#define	TITAN_GE_RX_BAM			TITAN_BIT30	/* broadcast address match */
++#define TITAN_GE_RX_PAM			TITAN_BIT28	/* physical address match */
++#define TITAN_GE_RX_LAFM		TITAN_BIT29	/* logical address filter match */
++#define TITAN_GE_RX_VLAN		TITAN_BIT26	/* virtual lans */
++#define TITAN_GE_RX_PERR		TITAN_BIT19	/* packet error */
++#define TITAN_GE_RX_TRUNC		TITAN_BIT20	/* packet size greater than 32 buffers */
++
++/* Tx Descriptor Command */
++#define	TITAN_GE_TX_BUFFER_OWNED	TITAN_BIT5	/* buffer ownership */
++#define	TITAN_GE_TX_ENABLE_INTERRUPT	TITAN_BIT15	/* Interrupt Enable */
++
++/* Return Status */
++#define	TITAN_OK	0x1	/* Good Status */
++#define	TITAN_ERROR	0x2	/* Error Status */
++
++/* MIB specific register offset */
++#define TITAN_GE_MSTATX_STATS_BASE_LOW       0x0800  /* MSTATX COUNTL[15:0] */
++#define TITAN_GE_MSTATX_STATS_BASE_MID       0x0804  /* MSTATX COUNTM[15:0] */
++#define TITAN_GE_MSTATX_STATS_BASE_HI        0x0808  /* MSTATX COUNTH[7:0] */
++#define TITAN_GE_MSTATX_CONTROL              0x0828  /* MSTATX Control */
++#define TITAN_GE_MSTATX_VARIABLE_SELECT      0x082C  /* MSTATX Variable Select */
++
++/* MIB counter offsets, add to the TITAN_GE_MSTATX_STATS_BASE_XXX */
++#define TITAN_GE_MSTATX_RXFRAMESOK                   0x0040
++#define TITAN_GE_MSTATX_RXOCTETSOK                   0x0050
++#define TITAN_GE_MSTATX_RXFRAMES                     0x0060
++#define TITAN_GE_MSTATX_RXOCTETS                     0x0070
++#define TITAN_GE_MSTATX_RXUNICASTFRAMESOK            0x0080
++#define TITAN_GE_MSTATX_RXBROADCASTFRAMESOK          0x0090
++#define TITAN_GE_MSTATX_RXMULTICASTFRAMESOK          0x00A0
++#define TITAN_GE_MSTATX_RXTAGGEDFRAMESOK             0x00B0
++#define TITAN_GE_MSTATX_RXMACPAUSECONTROLFRAMESOK    0x00C0
++#define TITAN_GE_MSTATX_RXMACCONTROLFRAMESOK         0x00D0
++#define TITAN_GE_MSTATX_RXFCSERROR                   0x00E0
++#define TITAN_GE_MSTATX_RXALIGNMENTERROR             0x00F0
++#define TITAN_GE_MSTATX_RXSYMBOLERROR                0x0100
++#define TITAN_GE_MSTATX_RXLAYER1ERROR                0x0110
++#define TITAN_GE_MSTATX_RXINRANGELENGTHERROR         0x0120
++#define TITAN_GE_MSTATX_RXLONGLENGTHERROR            0x0130
++#define TITAN_GE_MSTATX_RXLONGLENGTHCRCERROR         0x0140
++#define TITAN_GE_MSTATX_RXSHORTLENGTHERROR           0x0150
++#define TITAN_GE_MSTATX_RXSHORTLLENGTHCRCERROR       0x0160
++#define TITAN_GE_MSTATX_RXFRAMES64OCTETS             0x0170
++#define TITAN_GE_MSTATX_RXFRAMES65TO127OCTETS        0x0180
++#define TITAN_GE_MSTATX_RXFRAMES128TO255OCTETS       0x0190
++#define TITAN_GE_MSTATX_RXFRAMES256TO511OCTETS       0x01A0
++#define TITAN_GE_MSTATX_RXFRAMES512TO1023OCTETS      0x01B0
++#define TITAN_GE_MSTATX_RXFRAMES1024TO1518OCTETS     0x01C0
++#define TITAN_GE_MSTATX_RXFRAMES1519TOMAXSIZE        0x01D0
++#define TITAN_GE_MSTATX_RXSTATIONADDRESSFILTERED     0x01E0
++#define TITAN_GE_MSTATX_RXVARIABLE                   0x01F0
++#define TITAN_GE_MSTATX_GENERICADDRESSFILTERED       0x0200
++#define TITAN_GE_MSTATX_UNICASTFILTERED              0x0210
++#define TITAN_GE_MSTATX_MULTICASTFILTERED            0x0220
++#define TITAN_GE_MSTATX_BROADCASTFILTERED            0x0230
++#define TITAN_GE_MSTATX_HASHFILTERED                 0x0240
++#define TITAN_GE_MSTATX_TXFRAMESOK                   0x0250
++#define TITAN_GE_MSTATX_TXOCTETSOK                   0x0260
++#define TITAN_GE_MSTATX_TXOCTETS                     0x0270
++#define TITAN_GE_MSTATX_TXTAGGEDFRAMESOK             0x0280
++#define TITAN_GE_MSTATX_TXMACPAUSECONTROLFRAMESOK    0x0290
++#define TITAN_GE_MSTATX_TXFCSERROR                   0x02A0
++#define TITAN_GE_MSTATX_TXSHORTLENGTHERROR           0x02B0
++#define TITAN_GE_MSTATX_TXLONGLENGTHERROR            0x02C0
++#define TITAN_GE_MSTATX_TXSYSTEMERROR                0x02D0
++#define TITAN_GE_MSTATX_TXMACERROR                   0x02E0
++#define TITAN_GE_MSTATX_TXCARRIERSENSEERROR          0x02F0
++#define TITAN_GE_MSTATX_TXSQETESTERROR               0x0300
++#define TITAN_GE_MSTATX_TXUNICASTFRAMESOK            0x0310
++#define TITAN_GE_MSTATX_TXBROADCASTFRAMESOK          0x0320
++#define TITAN_GE_MSTATX_TXMULTICASTFRAMESOK          0x0330
++#define TITAN_GE_MSTATX_TXUNICASTFRAMESATTEMPTED     0x0340
++#define TITAN_GE_MSTATX_TXBROADCASTFRAMESATTEMPTED   0x0350
++#define TITAN_GE_MSTATX_TXMULTICASTFRAMESATTEMPTED   0x0360
++#define TITAN_GE_MSTATX_TXFRAMES64OCTETS             0x0370
++#define TITAN_GE_MSTATX_TXFRAMES65TO127OCTETS        0x0380
++#define TITAN_GE_MSTATX_TXFRAMES128TO255OCTETS       0x0390
++#define TITAN_GE_MSTATX_TXFRAMES256TO511OCTETS       0x03A0
++#define TITAN_GE_MSTATX_TXFRAMES512TO1023OCTETS      0x03B0
++#define TITAN_GE_MSTATX_TXFRAMES1024TO1518OCTETS     0x03C0
++#define TITAN_GE_MSTATX_TXFRAMES1519TOMAXSIZE        0x03D0
++#define TITAN_GE_MSTATX_TXVARIABLE                   0x03E0
++#define TITAN_GE_MSTATX_RXSYSTEMERROR                0x03F0
++#define TITAN_GE_MSTATX_SINGLECOLLISION              0x0400
++#define TITAN_GE_MSTATX_MULTIPLECOLLISION            0x0410
++#define TITAN_GE_MSTATX_DEFERREDXMISSIONS            0x0420
++#define TITAN_GE_MSTATX_LATECOLLISIONS               0x0430
++#define TITAN_GE_MSTATX_ABORTEDDUETOXSCOLLS          0x0440
++
++/* Interrupt specific defines */
++#define TITAN_GE_DEVICE_ID         0x0000  /* Device ID */
++#define TITAN_GE_RESET             0x0004  /* Reset reg */
++#define TITAN_GE_TSB_CTRL_0        0x000C  /* TSB Control reg 0 */
++#define TITAN_GE_TSB_CTRL_1        0x0010  /* TSB Control reg 1 */
++#define TITAN_GE_INTR_GRP0_STATUS  0x0040  /* General Interrupt Group 0 Status */
++#define TITAN_GE_INTR_XDMA_CORE_A  0x0048  /* XDMA Channel Interrupt Status, Core A*/
++#define TITAN_GE_INTR_XDMA_CORE_B  0x004C  /* XDMA Channel Interrupt Status, Core B*/
++#define	TITAN_GE_INTR_XDMA_IE	   0x0058  /* XDMA Channel Interrupt Enable */
++#define TITAN_GE_SDQPF_ECC_INTR    0x480C  /* SDQPF ECC Interrupt Status */
++#define TITAN_GE_SDQPF_RXFIFO_CTL  0x4828  /* SDQPF RxFifo Control and Interrupt Enb*/
++#define TITAN_GE_SDQPF_RXFIFO_INTR 0x482C  /* SDQPF RxFifo Interrupt Status */
++#define TITAN_GE_SDQPF_TXFIFO_CTL  0x4928  /* SDQPF TxFifo Control and Interrupt Enb*/
++#define TITAN_GE_SDQPF_TXFIFO_INTR 0x492C  /* SDQPF TxFifo Interrupt Status */
++#define	TITAN_GE_SDQPF_RXFIFO_0	   0x4840  /* SDQPF RxFIFO Enable */
++#define	TITAN_GE_SDQPF_TXFIFO_0	   0x4940  /* SDQPF TxFIFO Enable */
++#define TITAN_GE_XDMA_CONFIG       0x5000  /* XDMA Global Configuration */
++#define TITAN_GE_XDMA_INTR_SUMMARY 0x5010  /* XDMA Interrupt Summary */
++#define TITAN_GE_XDMA_BUFADDRPRE   0x5018  /* XDMA Buffer Address Prefix */
++#define TITAN_GE_XDMA_DESCADDRPRE  0x501C  /* XDMA Descriptor Address Prefix */
++#define TITAN_GE_XDMA_PORTWEIGHT   0x502C  /* XDMA Port Weight Configuration */
++
++/* Rx MAC defines */
++#define TITAN_GE_RMAC_CONFIG_1               0x1200  /* RMAC Configuration 1 */
++#define TITAN_GE_RMAC_CONFIG_2               0x1204  /* RMAC Configuration 2 */
++#define TITAN_GE_RMAC_MAX_FRAME_LEN          0x1208  /* RMAC Max Frame Length */
++#define TITAN_GE_RMAC_STATION_HI             0x120C  /* Rx Station Address High */
++#define TITAN_GE_RMAC_STATION_MID            0x1210  /* Rx Station Address Middle */
++#define TITAN_GE_RMAC_STATION_LOW            0x1214  /* Rx Station Address Low */
++#define TITAN_GE_RMAC_LINK_CONFIG            0x1218  /* RMAC Link Configuration */
++
++/* Tx MAC defines */
++#define TITAN_GE_TMAC_CONFIG_1               0x1240  /* TMAC Configuration 1 */
++#define TITAN_GE_TMAC_CONFIG_2               0x1244  /* TMAC Configuration 2 */
++#define TITAN_GE_TMAC_IPG                    0x1248  /* TMAC Inter-Packet Gap */
++#define TITAN_GE_TMAC_STATION_HI             0x124C  /* Tx Station Address High */
++#define TITAN_GE_TMAC_STATION_MID            0x1250  /* Tx Station Address Middle */
++#define TITAN_GE_TMAC_STATION_LOW            0x1254  /* Tx Station Address Low */
++#define TITAN_GE_TMAC_MAX_FRAME_LEN          0x1258  /* TMAC Max Frame Length */
++#define TITAN_GE_TMAC_MIN_FRAME_LEN          0x125C  /* TMAC Min Frame Length */
++#define TITAN_GE_TMAC_PAUSE_FRAME_TIME       0x1260  /* TMAC Pause Frame Time */
++#define TITAN_GE_TMAC_PAUSE_FRAME_INTERVAL   0x1264  /* TMAC Pause Frame Interval */
++
++/* GMII register */
++#define TITAN_GE_GMII_INTERRUPT_STATUS       0x1348  /* GMII Interrupt Status */
++#define TITAN_GE_GMII_CONFIG_GENERAL         0x134C  /* GMII Configuration General */
++#define TITAN_GE_GMII_CONFIG_MODE            0x1350  /* GMII Configuration Mode */
++
++/* Tx and Rx XDMA defines */
++#define	TITAN_GE_INT_COALESCING		     0x5030 /* Interrupt Coalescing */
++#define	TITAN_GE_CHANNEL0_CONFIG	     0x5040 /* Channel 0 XDMA config */
++#define	TITAN_GE_CHANNEL0_INTERRUPT	     0x504c /* Channel 0 Interrupt Status */
++#define	TITAN_GE_GDI_INTERRUPT_ENABLE        0x5050 /* IE for the GDI Errors */
++#define	TITAN_GE_CHANNEL0_PACKET	     0x5060 /* Channel 0 Packet count */
++#define	TITAN_GE_CHANNEL0_BYTE		     0x5064 /* Channel 0 Byte count */
++#define	TITAN_GE_CHANNEL0_TX_DESC	     0x5054 /* Channel 0 Tx first desc */
++#define	TITAN_GE_CHANNEL0_RX_DESC	     0x5058 /* Channel 0 Rx first desc */
++
++/* AFX (Address Filter Exact) register offsets for Slice 0 */
++#define TITAN_GE_AFX_EXACT_MATCH_LOW         0x1100  /* AFX Exact Match Address Low*/
++#define TITAN_GE_AFX_EXACT_MATCH_MID         0x1104  /* AFX Exact Match Address Mid*/
++#define TITAN_GE_AFX_EXACT_MATCH_HIGH        0x1108  /* AFX Exact Match Address Hi */
++#define TITAN_GE_AFX_EXACT_MATCH_VID         0x110C  /* AFX Exact Match VID */
++#define TITAN_GE_AFX_MULTICAST_HASH_LOW      0x1110  /* AFX Multicast HASH Low */
++#define TITAN_GE_AFX_MULTICAST_HASH_MIDLOW   0x1114  /* AFX Multicast HASH MidLow */
++#define TITAN_GE_AFX_MULTICAST_HASH_MIDHI    0x1118  /* AFX Multicast HASH MidHi */
++#define TITAN_GE_AFX_MULTICAST_HASH_HI       0x111C  /* AFX Multicast HASH Hi */
++#define TITAN_GE_AFX_ADDRS_FILTER_CTRL_0     0x1120  /* AFX Address Filter Ctrl 0 */
++#define TITAN_GE_AFX_ADDRS_FILTER_CTRL_1     0x1124  /* AFX Address Filter Ctrl 1 */
++#define TITAN_GE_AFX_ADDRS_FILTER_CTRL_2     0x1128  /* AFX Address Filter Ctrl 2 */
++
++/* Traffic Groomer block */
++#define        TITAN_GE_TRTG_CONFIG	     0x1000  /* TRTG Config */
++
++#endif 				/* _TITAN_GE_H_ */
++
+diff -Naur linux-2.6.16.orig/drivers/net/titan_mdio.c linux-2.6.16/drivers/net/titan_mdio.c
+--- linux-2.6.16.orig/drivers/net/titan_mdio.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/titan_mdio.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,217 @@
++/*
++ * drivers/net/titan_mdio.c - Driver for Titan ethernet ports
++ *
++ * Copyright (C) 2003 PMC-Sierra Inc.
++ * Author : Manish Lachwani (lachwani@pmc-sierra.com)
++ *
++ * 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 Free Software Foundation; either version 2
++ * of the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
++ *
++ * Management Data IO (MDIO) driver for the Titan GMII. Interacts with the Marvel PHY
++ * on the Titan. No support for the TBI as yet.
++ *
++ */
++
++#include	"titan_mdio.h"
++
++#define MDIO_DEBUG
++
++/*
++ * Local constants
++ */
++#define MAX_CLKA            1023
++#define MAX_PHY_DEV         31
++#define MAX_PHY_REG         31
++#define WRITEADDRS_OPCODE   0x0
++#define	READ_OPCODE	    0x2
++#define WRITE_OPCODE        0x1
++#define MAX_MDIO_POLL       100
++
++/*
++ * Titan MDIO and SCMB registers
++ */
++#define TITAN_GE_SCMB_CONTROL                0x01c0  /* SCMB Control */
++#define TITAN_GE_SCMB_CLKA	             0x01c4  /* SCMB Clock A */
++#define TITAN_GE_MDIO_COMMAND                0x01d0  /* MDIO Command */
++#define TITAN_GE_MDIO_DEVICE_PORT_ADDRESS    0x01d4  /* MDIO Device and Port addrs */
++#define TITAN_GE_MDIO_DATA                   0x01d8  /* MDIO Data */
++#define TITAN_GE_MDIO_INTERRUPTS             0x01dC  /* MDIO Interrupts */
++
++/*
++ * Function to poll the MDIO
++ */
++static int titan_ge_mdio_poll(void)
++{
++	int	i, val;
++
++	for (i = 0; i < MAX_MDIO_POLL; i++) {
++		val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_COMMAND);
++
++		if (!(val & 0x8000))
++			return TITAN_GE_MDIO_GOOD;
++	}
++
++	return TITAN_GE_MDIO_ERROR;
++}
++
++
++/*
++ * Initialize and configure the MDIO
++ */
++int titan_ge_mdio_setup(titan_ge_mdio_config *titan_mdio)
++{
++	unsigned long	val;
++
++	/* Reset the SCMB and program into MDIO mode*/
++	TITAN_GE_MDIO_WRITE(TITAN_GE_SCMB_CONTROL, 0x9000);
++	TITAN_GE_MDIO_WRITE(TITAN_GE_SCMB_CONTROL, 0x1000);
++
++	/* CLK A */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_SCMB_CLKA);
++	val = ( (val & ~(0x03ff)) | (titan_mdio->clka & 0x03ff));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_SCMB_CLKA, val);
++
++	/* Preamble Suppresion */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_COMMAND);
++	val = ( (val & ~(0x0001)) | (titan_mdio->mdio_spre & 0x0001));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_COMMAND, val);
++
++	/* MDIO mode */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS);
++	val = ( (val & ~(0x4000)) | (titan_mdio->mdio_mode & 0x4000));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS, val);
++
++	return TITAN_GE_MDIO_GOOD;
++}
++
++/*
++ * Set the PHY address in indirect mode
++ */
++int titan_ge_mdio_inaddrs(int dev_addr, int reg_addr)
++{
++	volatile unsigned long	val;
++
++	/* Setup the PHY device */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS);
++	val = ( (val & ~(0x1f00)) | ( (dev_addr << 8) & 0x1f00));
++	val = ( (val & ~(0x001f)) | ( reg_addr & 0x001f));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS, val);
++
++	/* Write the new address */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_COMMAND);
++	val = ( (val & ~(0x0300)) | ( (WRITEADDRS_OPCODE << 8) & 0x0300));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_COMMAND, val);
++
++	return TITAN_GE_MDIO_GOOD;
++}
++
++/*
++ * Read the MDIO register. This is what the individual parametes mean:
++ *
++ * dev_addr : PHY ID
++ * reg_addr : register offset
++ *
++ * See the spec for the Titan MAC. We operate in the Direct Mode.
++ */
++
++#define MAX_RETRIES	2
++
++int titan_ge_mdio_read(int dev_addr, int reg_addr, unsigned int *pdata)
++{
++	volatile unsigned long	val;
++	int retries = 0;
++
++	/* Setup the PHY device */
++
++again:
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS);
++	val = ( (val & ~(0x1f00)) | ( (dev_addr << 8) & 0x1f00));
++	val = ( (val & ~(0x001f)) | ( reg_addr & 0x001f));
++	val |= 0x4000;
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS, val);
++
++	udelay(30);
++
++	/* Issue the read command */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_COMMAND);
++	val = ( (val & ~(0x0300)) | ( (READ_OPCODE << 8) & 0x0300));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_COMMAND, val);
++
++	udelay(30);
++
++	if (titan_ge_mdio_poll() != TITAN_GE_MDIO_GOOD)
++		return TITAN_GE_MDIO_ERROR;
++
++	*pdata = (unsigned int)TITAN_GE_MDIO_READ(TITAN_GE_MDIO_DATA);
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_INTERRUPTS);
++
++	udelay(30);
++
++	if (val & 0x2) {
++		if (retries == MAX_RETRIES)
++			return TITAN_GE_MDIO_ERROR;
++		else {
++			retries++;
++			goto again;
++		}
++	}
++
++	return TITAN_GE_MDIO_GOOD;
++}
++
++/*
++ * Write to the MDIO register
++ *
++ * dev_addr : PHY ID
++ * reg_addr : register that needs to be written to
++ *
++ */
++int titan_ge_mdio_write(int dev_addr, int reg_addr, unsigned int data)
++{
++	volatile unsigned long	val;
++
++	if (titan_ge_mdio_poll() != TITAN_GE_MDIO_GOOD)
++		return TITAN_GE_MDIO_ERROR;
++
++	/* Setup the PHY device */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS);
++	val = ( (val & ~(0x1f00)) | ( (dev_addr << 8) & 0x1f00));
++	val = ( (val & ~(0x001f)) | ( reg_addr & 0x001f));
++	val |= 0x4000;
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_DEVICE_PORT_ADDRESS, val);
++
++	udelay(30);
++
++	/* Setup the data to write */
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_DATA, data);
++
++	udelay(30);
++
++	/* Issue the write command */
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_COMMAND);
++	val = ( (val & ~(0x0300)) | ( (WRITE_OPCODE << 8) & 0x0300));
++	TITAN_GE_MDIO_WRITE(TITAN_GE_MDIO_COMMAND, val);
++
++	udelay(30);
++
++	if (titan_ge_mdio_poll() != TITAN_GE_MDIO_GOOD)
++		return TITAN_GE_MDIO_ERROR;
++
++	val = TITAN_GE_MDIO_READ(TITAN_GE_MDIO_INTERRUPTS);
++	if (val & 0x2)
++		return TITAN_GE_MDIO_ERROR;
++
++	return TITAN_GE_MDIO_GOOD;
++}
++
+diff -Naur linux-2.6.16.orig/drivers/net/titan_mdio.h linux-2.6.16/drivers/net/titan_mdio.h
+--- linux-2.6.16.orig/drivers/net/titan_mdio.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/net/titan_mdio.h	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,56 @@
++/*
++ * MDIO used to interact with the PHY when using GMII/MII
++ */
++#ifndef _TITAN_MDIO_H
++#define _TITAN_MDIO_H
++
++#include <linux/netdevice.h>
++#include <linux/workqueue.h>
++#include <linux/delay.h>
++#include "titan_ge.h"
++
++
++#define	TITAN_GE_MDIO_ERROR	(-9000)
++#define	TITAN_GE_MDIO_GOOD	0
++
++#define	TITAN_GE_MDIO_BASE		titan_ge_base
++
++#define	TITAN_GE_MDIO_READ(offset)	\
++	*(volatile u32 *)(titan_ge_base + (offset))
++
++#define	TITAN_GE_MDIO_WRITE(offset, data)	\
++	*(volatile u32 *)(titan_ge_base + (offset)) = (data)
++
++
++/* GMII specific registers */
++#define	TITAN_GE_MARVEL_PHY_ID		0x00
++#define	TITAN_PHY_AUTONEG_ADV		0x04
++#define	TITAN_PHY_LP_ABILITY		0x05
++#define	TITAN_GE_MDIO_MII_CTRL		0x09
++#define	TITAN_GE_MDIO_MII_EXTENDED	0x0f
++#define	TITAN_GE_MDIO_PHY_CTRL		0x10
++#define	TITAN_GE_MDIO_PHY_STATUS	0x11
++#define	TITAN_GE_MDIO_PHY_IE		0x12
++#define	TITAN_GE_MDIO_PHY_IS		0x13
++#define	TITAN_GE_MDIO_PHY_LED		0x18
++#define	TITAN_GE_MDIO_PHY_LED_OVER	0x19
++#define	PHY_ANEG_TIME_WAIT		45	/* 45 seconds wait time */
++
++/*
++ * MDIO Config Structure
++ */
++typedef struct {
++	unsigned int		clka;
++	int			mdio_spre;
++	int			mdio_mode;
++} titan_ge_mdio_config;
++
++/*
++ * Function Prototypes
++ */
++int titan_ge_mdio_setup(titan_ge_mdio_config *);
++int titan_ge_mdio_inaddrs(int, int);
++int titan_ge_mdio_read(int, int, unsigned int *);
++int titan_ge_mdio_write(int, int, unsigned int);
++
++#endif /* _TITAN_MDIO_H */
+diff -Naur linux-2.6.16.orig/drivers/scsi/NCR53C9x.h linux-2.6.16/drivers/scsi/NCR53C9x.h
+--- linux-2.6.16.orig/drivers/scsi/NCR53C9x.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/scsi/NCR53C9x.h	2006-03-21 01:05:48.000000000 +0000
+@@ -145,12 +145,7 @@
+ 
+ #ifndef MULTIPLE_PAD_SIZES
+ 
+-#ifdef CONFIG_CPU_HAS_WB
+-#include <asm/wbflush.h>
+-#define esp_write(__reg, __val) do{(__reg) = (__val); wbflush();} while(0)
+-#else
+-#define esp_write(__reg, __val) ((__reg) = (__val))
+-#endif
++#define esp_write(__reg, __val) do{(__reg) = (__val); iob();} while(0)
+ #define esp_read(__reg) (__reg)
+ 
+ struct ESP_regs {
+diff -Naur linux-2.6.16.orig/drivers/scsi/dec_esp.c linux-2.6.16/drivers/scsi/dec_esp.c
+--- linux-2.6.16.orig/drivers/scsi/dec_esp.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/scsi/dec_esp.c	2006-03-21 01:05:48.000000000 +0000
+@@ -55,7 +55,7 @@
+ 
+ static int  dma_bytes_sent(struct NCR_ESP *esp, int fifo_count);
+ static void dma_drain(struct NCR_ESP *esp);
+-static int  dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp);
++static int  dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd * sp);
+ static void dma_dump_state(struct NCR_ESP *esp);
+ static void dma_init_read(struct NCR_ESP *esp, u32 vaddress, int length);
+ static void dma_init_write(struct NCR_ESP *esp, u32 vaddress, int length);
+@@ -230,7 +230,7 @@
+ 			mem_start = get_tc_base_addr(slot);
+ 
+ 			/* Store base addr into esp struct */
+-			esp->slot = CPHYSADDR(mem_start);
++			esp->slot = mem_start;
+ 
+ 			esp->dregs = 0;
+ 			esp->eregs = (void *)CKSEG1ADDR(mem_start +
+diff -Naur linux-2.6.16.orig/drivers/scsi/jazz_esp.c linux-2.6.16/drivers/scsi/jazz_esp.c
+--- linux-2.6.16.orig/drivers/scsi/jazz_esp.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/scsi/jazz_esp.c	2006-03-21 01:05:48.000000000 +0000
+@@ -52,7 +52,6 @@
+ 				 * via PIO.
+ 				 */
+ 
+-int jazz_esp_detect(struct scsi_host_template *tpnt);
+ static int jazz_esp_release(struct Scsi_Host *shost)
+ {
+ 	if (shost->irq)
+@@ -75,7 +74,7 @@
+      * first assumption it is there:-)
+      */
+     if (1) {
+-	esp_dev = 0;
++	esp_dev = NULL;
+ 	esp = esp_allocate(tpnt, (void *) esp_dev);
+ 	
+ 	/* Do command transfer with programmed I/O */
+@@ -94,13 +93,13 @@
+ 	esp->dma_setup = &dma_setup;
+ 
+ 	/* Optional functions */
+-	esp->dma_barrier = 0;
+-	esp->dma_drain = 0;
+-	esp->dma_invalidate = 0;
+-	esp->dma_irq_entry = 0;
+-	esp->dma_irq_exit = 0;
+-	esp->dma_poll = 0;
+-	esp->dma_reset = 0;
++	esp->dma_barrier = NULL;
++	esp->dma_drain = NULL;
++	esp->dma_invalidate = NULL;
++	esp->dma_irq_entry = NULL;
++	esp->dma_irq_exit = NULL;
++	esp->dma_poll = NULL;
++	esp->dma_reset = NULL;
+ 	esp->dma_led_off = &dma_led_off;
+ 	esp->dma_led_on = &dma_led_on;
+ 	
+@@ -120,7 +119,7 @@
+ 	 * of DMA channel, so we can use the jazz DMA functions
+ 	 * 
+ 	 */
+-	esp->dregs = JAZZ_SCSI_DMA;
++	esp->dregs = (void *) JAZZ_SCSI_DMA;
+ 	
+ 	/* ESP register base */
+ 	esp->eregs = (struct ESP_regs *)(JAZZ_SCSI_BASE);
+diff -Naur linux-2.6.16.orig/drivers/scsi/sgiwd93.c linux-2.6.16/drivers/scsi/sgiwd93.c
+--- linux-2.6.16.orig/drivers/scsi/sgiwd93.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/scsi/sgiwd93.c	2006-03-21 01:05:48.000000000 +0000
+@@ -14,6 +14,7 @@
+ #include <linux/interrupt.h>
+ #include <linux/types.h>
+ #include <linux/mm.h>
++#include <linux/module.h>
+ #include <linux/blkdev.h>
+ #include <linux/delay.h>
+ #include <linux/dma-mapping.h>
+@@ -197,6 +198,7 @@
+ 	udelay(50);
+ 	hregs->ctrl = 0;
+ }
++EXPORT_SYMBOL_GPL(sgiwd93_reset);
+ 
+ static inline void init_hpc_chain(struct hpc_data *hd)
+ {
+@@ -265,7 +267,7 @@
+ 	return NULL;
+ }
+ 
+-int __init sgiwd93_detect(struct scsi_host_template *SGIblows)
++static int __init sgiwd93_detect(struct scsi_host_template *SGIblows)
+ {
+ 	int found = 0;
+ 
+@@ -288,7 +290,7 @@
+ 	return found;
+ }
+ 
+-int sgiwd93_release(struct Scsi_Host *instance)
++static int sgiwd93_release(struct Scsi_Host *instance)
+ {
+ 	struct ip22_hostdata *hdata = HDATA(instance);
+ 	int irq = 0;
+diff -Naur linux-2.6.16.orig/drivers/scsi/wd33c93.c linux-2.6.16/drivers/scsi/wd33c93.c
+--- linux-2.6.16.orig/drivers/scsi/wd33c93.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/scsi/wd33c93.c	2006-03-21 01:05:48.000000000 +0000
+@@ -78,8 +78,8 @@
+ #include <linux/string.h>
+ #include <linux/delay.h>
+ #include <linux/init.h>
++#include <linux/interrupt.h>
+ #include <linux/blkdev.h>
+-#include <asm/irq.h>
+ 
+ #include <scsi/scsi.h>
+ #include <scsi/scsi_cmnd.h>
+diff -Naur linux-2.6.16.orig/drivers/serial/Kconfig linux-2.6.16/drivers/serial/Kconfig
+--- linux-2.6.16.orig/drivers/serial/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/serial/Kconfig	2006-03-21 01:05:48.000000000 +0000
+@@ -621,21 +621,24 @@
+ 	depends on SERIAL_SH_SCI=y
+ 	select SERIAL_CORE_CONSOLE
+ 
+-config SERIAL_AU1X00
+-	bool "Enable Au1x00 UART Support"
+-	depends on MIPS && SOC_AU1X00
++config SERIAL_IP3106
++	bool "Enable IP3106 UART Support (Philips PNX 8xx0 SoCs)"
++	depends on MIPS && (SOC_PNX8550 || SOC_PNX8330)
+ 	select SERIAL_CORE
+ 	help
+-	  If you have an Alchemy AU1X00 processor (MIPS based) and you want
+-	  to use serial ports, say Y.  Otherwise, say N.
+-
+-config SERIAL_AU1X00_CONSOLE
+-	bool "Enable Au1x00 serial console"
+-	depends on SERIAL_AU1X00
++	  If you have a Philips SoC with an IP 3106 UART in it, such as
++	  the PNX8550 or PNX8330 (MIPS based) and you want to use
++	  serial ports, say Y.  Otherwise, say N.
++
++config SERIAL_IP3106_CONSOLE
++	bool "Enable PNX8XX0 serial console"
++	depends on SERIAL_IP3106
+ 	select SERIAL_CORE_CONSOLE
+ 	help
+-	  If you have an Alchemy AU1X00 processor (MIPS based) and you want
+-	  to use a console on a serial port, say Y.  Otherwise, say N.
++	  If you have a Philips SoC with an IP 3106 UART in it, such as
++	  the PNX8550 or PNX8330 (MIPS based) and you want to use
++	  a serial console, say Y.
++	  Otherwise, say N.
+ 
+ config SERIAL_CORE
+ 	tristate
+diff -Naur linux-2.6.16.orig/drivers/serial/Makefile linux-2.6.16/drivers/serial/Makefile
+--- linux-2.6.16.orig/drivers/serial/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/serial/Makefile	2006-03-21 01:05:48.000000000 +0000
+@@ -41,7 +41,7 @@
+ obj-$(CONFIG_V850E_UART) += v850e_uart.o
+ obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
+ obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o
+-obj-$(CONFIG_SERIAL_AU1X00) += au1x00_uart.o
++obj-$(CONFIG_SERIAL_IP3106) += ip3106_uart.o
+ obj-$(CONFIG_SERIAL_DZ) += dz.o
+ obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o
+ obj-$(CONFIG_SERIAL_SGI_L1_CONSOLE) += sn_console.o
+diff -Naur linux-2.6.16.orig/drivers/serial/au1x00_uart.c linux-2.6.16/drivers/serial/au1x00_uart.c
+--- linux-2.6.16.orig/drivers/serial/au1x00_uart.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/serial/au1x00_uart.c	1970-01-01 00:00:00.000000000 +0000
+@@ -1,1296 +0,0 @@
+-/*
+- *  Driver for 8250/16550-type serial ports
+- *
+- *  Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
+- *
+- *  Copyright (C) 2001 Russell King.
+- *
+- * 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 Free Software Foundation; either version 2 of the License, or
+- * (at your option) any later version.
+- *
+- * A note about mapbase / membase
+- *
+- *  mapbase is the physical address of the IO port.  Currently, we don't
+- *  support this very well, and it may well be dropped from this driver
+- *  in future.  As such, mapbase should be NULL.
+- *
+- *  membase is an 'ioremapped' cookie.  This is compatible with the old
+- *  serial.c driver, and is currently the preferred form.
+- */
+-#include <linux/config.h>
+-#include <linux/module.h>
+-#include <linux/tty.h>
+-#include <linux/ioport.h>
+-#include <linux/init.h>
+-#include <linux/console.h>
+-#include <linux/sysrq.h>
+-#include <linux/serial.h>
+-#include <linux/serialP.h>
+-#include <linux/delay.h>
+-
+-#include <asm/serial.h>
+-#include <asm/io.h>
+-#include <asm/irq.h>
+-#include <asm/mach-au1x00/au1000.h>
+-
+-#if defined(CONFIG_SERIAL_AU1X00_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+-#define SUPPORT_SYSRQ
+-#endif
+-
+-#include <linux/serial_core.h>
+-#include "8250.h"
+-
+-/*
+- * Debugging.
+- */
+-#if 0
+-#define DEBUG_AUTOCONF(fmt...)	printk(fmt)
+-#else
+-#define DEBUG_AUTOCONF(fmt...)	do { } while (0)
+-#endif
+-
+-#if 0
+-#define DEBUG_INTR(fmt...)	printk(fmt)
+-#else
+-#define DEBUG_INTR(fmt...)	do { } while (0)
+-#endif
+-
+-#define PASS_LIMIT	256
+-
+-/*
+- * We default to IRQ0 for the "no irq" hack.   Some
+- * machine types want others as well - they're free
+- * to redefine this in their header file.
+- */
+-#define is_real_interrupt(irq)	((irq) != 0)
+-
+-static struct old_serial_port old_serial_port[] = {
+-	{	.baud_base = 0,
+-		.iomem_base = (u8 *)UART0_ADDR,
+-		.irq = AU1000_UART0_INT,
+-		.flags = STD_COM_FLAGS,
+-		.iomem_reg_shift = 2,
+-	}, {
+-		.baud_base = 0,
+-		.iomem_base = (u8 *)UART1_ADDR,
+-		.irq = AU1000_UART1_INT,
+-		.flags = STD_COM_FLAGS,
+-		.iomem_reg_shift = 2
+-	}, {
+-		.baud_base = 0,
+-		.iomem_base = (u8 *)UART2_ADDR,
+-		.irq = AU1000_UART2_INT,
+-		.flags = STD_COM_FLAGS,
+-		.iomem_reg_shift = 2
+-	}, {
+-		.baud_base = 0,
+-		.iomem_base = (u8 *)UART3_ADDR,
+-		.irq = AU1000_UART3_INT,
+-		.flags = STD_COM_FLAGS,
+-		.iomem_reg_shift = 2
+-	}
+-};
+-
+-#define UART_NR	ARRAY_SIZE(old_serial_port)
+-
+-struct uart_8250_port {
+-	struct uart_port	port;
+-	struct timer_list	timer;		/* "no irq" timer */
+-	struct list_head	list;		/* ports on this IRQ */
+-	unsigned short		rev;
+-	unsigned char		acr;
+-	unsigned char		ier;
+-	unsigned char		lcr;
+-	unsigned char		mcr_mask;	/* mask of user bits */
+-	unsigned char		mcr_force;	/* mask of forced bits */
+-	unsigned char		lsr_break_flag;
+-
+-	/*
+-	 * We provide a per-port pm hook.
+-	 */
+-	void			(*pm)(struct uart_port *port,
+-				      unsigned int state, unsigned int old);
+-};
+-
+-struct irq_info {
+-	spinlock_t		lock;
+-	struct list_head	*head;
+-};
+-
+-static struct irq_info irq_lists[NR_IRQS];
+-
+-/*
+- * Here we define the default xmit fifo size used for each type of UART.
+- */
+-static const struct serial_uart_config uart_config[PORT_MAX_8250+1] = {
+-	{ "unknown",	1,	0 },
+-	{ "8250",	1,	0 },
+-	{ "16450",	1,	0 },
+-	{ "16550",	1,	0 },
+-	/* PORT_16550A */
+-	{ "AU1X00_UART",16,	UART_CLEAR_FIFO | UART_USE_FIFO },
+-};
+-
+-static _INLINE_ unsigned int serial_in(struct uart_8250_port *up, int offset)
+-{
+-	return au_readl((unsigned long)up->port.membase + offset);
+-}
+-
+-static _INLINE_ void
+-serial_out(struct uart_8250_port *up, int offset, int value)
+-{
+-	au_writel(value, (unsigned long)up->port.membase + offset);
+-}
+-
+-#define serial_inp(up, offset)		serial_in(up, offset)
+-#define serial_outp(up, offset, value)	serial_out(up, offset, value)
+-
+-/*
+- * This routine is called by rs_init() to initialize a specific serial
+- * port.  It determines what type of UART chip this serial port is
+- * using: 8250, 16450, 16550, 16550A.  The important question is
+- * whether or not this UART is a 16550A or not, since this will
+- * determine whether or not we can use its FIFO features or not.
+- */
+-static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
+-{
+-	unsigned char save_lcr, save_mcr;
+-	unsigned long flags;
+-
+-	if (!up->port.iobase && !up->port.mapbase && !up->port.membase)
+-		return;
+-
+-	DEBUG_AUTOCONF("ttyS%d: autoconf (0x%04x, 0x%08lx): ",
+-			up->port.line, up->port.iobase, up->port.membase);
+-
+-	/*
+-	 * We really do need global IRQs disabled here - we're going to
+-	 * be frobbing the chips IRQ enable register to see if it exists.
+-	 */
+-	spin_lock_irqsave(&up->port.lock, flags);
+-//	save_flags(flags); cli();
+-
+-	save_mcr = serial_in(up, UART_MCR);
+-	save_lcr = serial_in(up, UART_LCR);
+-
+-	up->port.type = PORT_16550A;
+-	serial_outp(up, UART_LCR, save_lcr);
+-
+-	up->port.fifosize = uart_config[up->port.type].dfl_xmit_fifo_size;
+-
+-	if (up->port.type == PORT_UNKNOWN)
+-		goto out;
+-
+-	/*
+-	 * Reset the UART.
+-	 */
+-	serial_outp(up, UART_MCR, save_mcr);
+-	serial_outp(up, UART_FCR, (UART_FCR_ENABLE_FIFO |
+-				     UART_FCR_CLEAR_RCVR |
+-				     UART_FCR_CLEAR_XMIT));
+-	serial_outp(up, UART_FCR, 0);
+-	(void)serial_in(up, UART_RX);
+-	serial_outp(up, UART_IER, 0);
+-
+- out:	
+-	spin_unlock_irqrestore(&up->port.lock, flags);
+-//	restore_flags(flags);
+-	DEBUG_AUTOCONF("type=%s\n", uart_config[up->port.type].name);
+-}
+-
+-static void serial8250_stop_tx(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-
+-	if (up->ier & UART_IER_THRI) {
+-		up->ier &= ~UART_IER_THRI;
+-		serial_out(up, UART_IER, up->ier);
+-	}
+-}
+-
+-static void serial8250_start_tx(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-
+-	if (!(up->ier & UART_IER_THRI)) {
+-		up->ier |= UART_IER_THRI;
+-		serial_out(up, UART_IER, up->ier);
+-	}
+-}
+-
+-static void serial8250_stop_rx(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-
+-	up->ier &= ~UART_IER_RLSI;
+-	up->port.read_status_mask &= ~UART_LSR_DR;
+-	serial_out(up, UART_IER, up->ier);
+-}
+-
+-static void serial8250_enable_ms(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-
+-	up->ier |= UART_IER_MSI;
+-	serial_out(up, UART_IER, up->ier);
+-}
+-
+-static _INLINE_ void
+-receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs)
+-{
+-	struct tty_struct *tty = up->port.info->tty;
+-	unsigned char ch, flag;
+-	int max_count = 256;
+-
+-	do {
+-		ch = serial_inp(up, UART_RX);
+-		flag = TTY_NORMAL;
+-		up->port.icount.rx++;
+-
+-		if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE |
+-				       UART_LSR_FE | UART_LSR_OE))) {
+-			/*
+-			 * For statistics only
+-			 */
+-			if (*status & UART_LSR_BI) {
+-				*status &= ~(UART_LSR_FE | UART_LSR_PE);
+-				up->port.icount.brk++;
+-				/*
+-				 * We do the SysRQ and SAK checking
+-				 * here because otherwise the break
+-				 * may get masked by ignore_status_mask
+-				 * or read_status_mask.
+-				 */
+-				if (uart_handle_break(&up->port))
+-					goto ignore_char;
+-			} else if (*status & UART_LSR_PE)
+-				up->port.icount.parity++;
+-			else if (*status & UART_LSR_FE)
+-				up->port.icount.frame++;
+-			if (*status & UART_LSR_OE)
+-				up->port.icount.overrun++;
+-
+-			/*
+-			 * Mask off conditions which should be ingored.
+-			 */
+-			*status &= up->port.read_status_mask;
+-
+-#ifdef CONFIG_SERIAL_AU1X00_CONSOLE
+-			if (up->port.line == up->port.cons->index) {
+-				/* Recover the break flag from console xmit */
+-				*status |= up->lsr_break_flag;
+-				up->lsr_break_flag = 0;
+-			}
+-#endif
+-			if (*status & UART_LSR_BI) {
+-				DEBUG_INTR("handling break....");
+-				flag = TTY_BREAK;
+-			} else if (*status & UART_LSR_PE)
+-				flag = TTY_PARITY;
+-			else if (*status & UART_LSR_FE)
+-				flag = TTY_FRAME;
+-		}
+-		if (uart_handle_sysrq_char(&up->port, ch, regs))
+-			goto ignore_char;
+-		if ((*status & up->port.ignore_status_mask) == 0)
+-			tty_insert_flip_char(tty, ch, flag);
+-		if (*status & UART_LSR_OE)
+-			/*
+-			 * Overrun is special, since it's reported
+-			 * immediately, and doesn't affect the current
+-			 * character.
+-			 */
+-			tty_insert_flip_char(tty, 0, TTY_OVERRUN);
+-		}
+-	ignore_char:
+-		*status = serial_inp(up, UART_LSR);
+-	} while ((*status & UART_LSR_DR) && (max_count-- > 0));
+-	spin_unlock(&up->port.lock);
+-	tty_flip_buffer_push(tty);
+-	spin_lock(&up->port.lock);
+-}
+-
+-static _INLINE_ void transmit_chars(struct uart_8250_port *up)
+-{
+-	struct circ_buf *xmit = &up->port.info->xmit;
+-	int count;
+-
+-	if (up->port.x_char) {
+-		serial_outp(up, UART_TX, up->port.x_char);
+-		up->port.icount.tx++;
+-		up->port.x_char = 0;
+-		return;
+-	}
+-	if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
+-		serial8250_stop_tx(&up->port);
+-		return;
+-	}
+-
+-	count = up->port.fifosize;
+-	do {
+-		serial_out(up, UART_TX, xmit->buf[xmit->tail]);
+-		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
+-		up->port.icount.tx++;
+-		if (uart_circ_empty(xmit))
+-			break;
+-	} while (--count > 0);
+-
+-	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
+-		uart_write_wakeup(&up->port);
+-
+-	DEBUG_INTR("THRE...");
+-
+-	if (uart_circ_empty(xmit))
+-		serial8250_stop_tx(&up->port);
+-}
+-
+-static _INLINE_ void check_modem_status(struct uart_8250_port *up)
+-{
+-	int status;
+-
+-	status = serial_in(up, UART_MSR);
+-
+-	if ((status & UART_MSR_ANY_DELTA) == 0)
+-		return;
+-
+-	if (status & UART_MSR_TERI)
+-		up->port.icount.rng++;
+-	if (status & UART_MSR_DDSR)
+-		up->port.icount.dsr++;
+-	if (status & UART_MSR_DDCD)
+-		uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
+-	if (status & UART_MSR_DCTS)
+-		uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
+-
+-	wake_up_interruptible(&up->port.info->delta_msr_wait);
+-}
+-
+-/*
+- * This handles the interrupt from one port.
+- */
+-static inline void
+-serial8250_handle_port(struct uart_8250_port *up, struct pt_regs *regs)
+-{
+-	unsigned int status = serial_inp(up, UART_LSR);
+-
+-	DEBUG_INTR("status = %x...", status);
+-
+-	if (status & UART_LSR_DR)
+-		receive_chars(up, &status, regs);
+-	check_modem_status(up);
+-	if (status & UART_LSR_THRE)
+-		transmit_chars(up);
+-}
+-
+-/*
+- * This is the serial driver's interrupt routine.
+- *
+- * Arjan thinks the old way was overly complex, so it got simplified.
+- * Alan disagrees, saying that need the complexity to handle the weird
+- * nature of ISA shared interrupts.  (This is a special exception.)
+- *
+- * In order to handle ISA shared interrupts properly, we need to check
+- * that all ports have been serviced, and therefore the ISA interrupt
+- * line has been de-asserted.
+- *
+- * This means we need to loop through all ports. checking that they
+- * don't have an interrupt pending.
+- */
+-static irqreturn_t serial8250_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+-{
+-	struct irq_info *i = dev_id;
+-	struct list_head *l, *end = NULL;
+-	int pass_counter = 0;
+-
+-	DEBUG_INTR("serial8250_interrupt(%d)...", irq);
+-
+-	spin_lock(&i->lock);
+-
+-	l = i->head;
+-	do {
+-		struct uart_8250_port *up;
+-		unsigned int iir;
+-
+-		up = list_entry(l, struct uart_8250_port, list);
+-
+-		iir = serial_in(up, UART_IIR);
+-		if (!(iir & UART_IIR_NO_INT)) {
+-			spin_lock(&up->port.lock);
+-			serial8250_handle_port(up, regs);
+-			spin_unlock(&up->port.lock);
+-
+-			end = NULL;
+-		} else if (end == NULL)
+-			end = l;
+-
+-		l = l->next;
+-
+-		if (l == i->head && pass_counter++ > PASS_LIMIT) {
+-			/* If we hit this, we're dead. */
+-			printk(KERN_ERR "serial8250: too much work for "
+-				"irq%d\n", irq);
+-			break;
+-		}
+-	} while (l != end);
+-
+-	spin_unlock(&i->lock);
+-
+-	DEBUG_INTR("end.\n");
+-	/* FIXME! Was it really ours? */
+-	return IRQ_HANDLED;
+-}
+-
+-/*
+- * To support ISA shared interrupts, we need to have one interrupt
+- * handler that ensures that the IRQ line has been deasserted
+- * before returning.  Failing to do this will result in the IRQ
+- * line being stuck active, and, since ISA irqs are edge triggered,
+- * no more IRQs will be seen.
+- */
+-static void serial_do_unlink(struct irq_info *i, struct uart_8250_port *up)
+-{
+-	spin_lock_irq(&i->lock);
+-
+-	if (!list_empty(i->head)) {
+-		if (i->head == &up->list)
+-			i->head = i->head->next;
+-		list_del(&up->list);
+-	} else {
+-		BUG_ON(i->head != &up->list);
+-		i->head = NULL;
+-	}
+-
+-	spin_unlock_irq(&i->lock);
+-}
+-
+-static int serial_link_irq_chain(struct uart_8250_port *up)
+-{
+-	struct irq_info *i = irq_lists + up->port.irq;
+-	int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? SA_SHIRQ : 0;
+-
+-	spin_lock_irq(&i->lock);
+-
+-	if (i->head) {
+-		list_add(&up->list, i->head);
+-		spin_unlock_irq(&i->lock);
+-
+-		ret = 0;
+-	} else {
+-		INIT_LIST_HEAD(&up->list);
+-		i->head = &up->list;
+-		spin_unlock_irq(&i->lock);
+-
+-		ret = request_irq(up->port.irq, serial8250_interrupt,
+-				  irq_flags, "serial", i);
+-		if (ret < 0)
+-			serial_do_unlink(i, up);
+-	}
+-
+-	return ret;
+-}
+-
+-static void serial_unlink_irq_chain(struct uart_8250_port *up)
+-{
+-	struct irq_info *i = irq_lists + up->port.irq;
+-
+-	BUG_ON(i->head == NULL);
+-
+-	if (list_empty(i->head))
+-		free_irq(up->port.irq, i);
+-
+-	serial_do_unlink(i, up);
+-}
+-
+-/*
+- * This function is used to handle ports that do not have an
+- * interrupt.  This doesn't work very well for 16450's, but gives
+- * barely passable results for a 16550A.  (Although at the expense
+- * of much CPU overhead).
+- */
+-static void serial8250_timeout(unsigned long data)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)data;
+-	unsigned int timeout;
+-	unsigned int iir;
+-
+-	iir = serial_in(up, UART_IIR);
+-	if (!(iir & UART_IIR_NO_INT)) {
+-		spin_lock(&up->port.lock);
+-		serial8250_handle_port(up, NULL);
+-		spin_unlock(&up->port.lock);
+-	}
+-
+-	timeout = up->port.timeout;
+-	timeout = timeout > 6 ? (timeout / 2 - 2) : 1;
+-	mod_timer(&up->timer, jiffies + timeout);
+-}
+-
+-static unsigned int serial8250_tx_empty(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned long flags;
+-	unsigned int ret;
+-
+-	spin_lock_irqsave(&up->port.lock, flags);
+-	ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
+-	spin_unlock_irqrestore(&up->port.lock, flags);
+-
+-	return ret;
+-}
+-
+-static unsigned int serial8250_get_mctrl(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned char status;
+-	unsigned int ret;
+-
+-	status = serial_in(up, UART_MSR);
+-
+-	ret = 0;
+-	if (status & UART_MSR_DCD)
+-		ret |= TIOCM_CAR;
+-	if (status & UART_MSR_RI)
+-		ret |= TIOCM_RNG;
+-	if (status & UART_MSR_DSR)
+-		ret |= TIOCM_DSR;
+-	if (status & UART_MSR_CTS)
+-		ret |= TIOCM_CTS;
+-	return ret;
+-}
+-
+-static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned char mcr = 0;
+-
+-	if (mctrl & TIOCM_RTS)
+-		mcr |= UART_MCR_RTS;
+-	if (mctrl & TIOCM_DTR)
+-		mcr |= UART_MCR_DTR;
+-	if (mctrl & TIOCM_OUT1)
+-		mcr |= UART_MCR_OUT1;
+-	if (mctrl & TIOCM_OUT2)
+-		mcr |= UART_MCR_OUT2;
+-	if (mctrl & TIOCM_LOOP)
+-		mcr |= UART_MCR_LOOP;
+-
+-	mcr = (mcr & up->mcr_mask) | up->mcr_force;
+-
+-	serial_out(up, UART_MCR, mcr);
+-}
+-
+-static void serial8250_break_ctl(struct uart_port *port, int break_state)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned long flags;
+-
+-	spin_lock_irqsave(&up->port.lock, flags);
+-	if (break_state == -1)
+-		up->lcr |= UART_LCR_SBC;
+-	else
+-		up->lcr &= ~UART_LCR_SBC;
+-	serial_out(up, UART_LCR, up->lcr);
+-	spin_unlock_irqrestore(&up->port.lock, flags);
+-}
+-
+-static int serial8250_startup(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned long flags;
+-	int retval;
+-
+-	/*
+-	 * Clear the FIFO buffers and disable them.
+-	 * (they will be reeanbled in set_termios())
+-	 */
+-	if (uart_config[up->port.type].flags & UART_CLEAR_FIFO) {
+-		serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
+-		serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO |
+-				UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
+-		serial_outp(up, UART_FCR, 0);
+-	}
+-
+-	/*
+-	 * Clear the interrupt registers.
+-	 */
+-	(void) serial_inp(up, UART_LSR);
+-	(void) serial_inp(up, UART_RX);
+-	(void) serial_inp(up, UART_IIR);
+-	(void) serial_inp(up, UART_MSR);
+-
+-	/*
+-	 * At this point, there's no way the LSR could still be 0xff;
+-	 * if it is, then bail out, because there's likely no UART
+-	 * here.
+-	 */
+-	if (!(up->port.flags & UPF_BUGGY_UART) &&
+-	    (serial_inp(up, UART_LSR) == 0xff)) {
+-		printk("ttyS%d: LSR safety check engaged!\n", up->port.line);
+-		return -ENODEV;
+-	}
+-
+-	retval = serial_link_irq_chain(up);
+-		if (retval)
+-			return retval;
+-
+-	/*
+-	 * Now, initialize the UART
+-	 */
+-	serial_outp(up, UART_LCR, UART_LCR_WLEN8);
+-
+-	spin_lock_irqsave(&up->port.lock, flags);
+-	if (up->port.flags & UPF_FOURPORT) {
+-		if (!is_real_interrupt(up->port.irq))
+-			up->port.mctrl |= TIOCM_OUT1;
+-	} else
+-		/*
+-		 * Most PC uarts need OUT2 raised to enable interrupts.
+-		 */
+-		if (is_real_interrupt(up->port.irq))
+-			up->port.mctrl |= TIOCM_OUT2;
+-
+-	serial8250_set_mctrl(&up->port, up->port.mctrl);
+-	spin_unlock_irqrestore(&up->port.lock, flags);
+-
+-	/*
+-	 * Finally, enable interrupts.  Note: Modem status interrupts
+-	 * are set via set_termios(), which will be occurring imminently
+-	 * anyway, so we don't enable them here.
+-	 */
+-	up->ier = UART_IER_RLSI | UART_IER_RDI;
+-	serial_outp(up, UART_IER, up->ier);
+-
+-	if (up->port.flags & UPF_FOURPORT) {
+-		unsigned int icp;
+-		/*
+-		 * Enable interrupts on the AST Fourport board
+-		 */
+-		icp = (up->port.iobase & 0xfe0) | 0x01f;
+-		outb_p(0x80, icp);
+-		(void) inb_p(icp);
+-	}
+-
+-	/*
+-	 * And clear the interrupt registers again for luck.
+-	 */
+-	(void) serial_inp(up, UART_LSR);
+-	(void) serial_inp(up, UART_RX);
+-	(void) serial_inp(up, UART_IIR);
+-	(void) serial_inp(up, UART_MSR);
+-
+-	return 0;
+-}
+-
+-static void serial8250_shutdown(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned long flags;
+-
+-	/*
+-	 * Disable interrupts from this port
+-	 */
+-	up->ier = 0;
+-	serial_outp(up, UART_IER, 0);
+-
+-	spin_lock_irqsave(&up->port.lock, flags);
+-	if (up->port.flags & UPF_FOURPORT) {
+-		/* reset interrupts on the AST Fourport board */
+-		inb((up->port.iobase & 0xfe0) | 0x1f);
+-		up->port.mctrl |= TIOCM_OUT1;
+-	} else
+-		up->port.mctrl &= ~TIOCM_OUT2;
+-
+-	serial8250_set_mctrl(&up->port, up->port.mctrl);
+-	spin_unlock_irqrestore(&up->port.lock, flags);
+-
+-	/*
+-	 * Disable break condition and FIFOs
+-	 */
+-	serial_out(up, UART_LCR, serial_inp(up, UART_LCR) & ~UART_LCR_SBC);
+-	serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO |
+-				  UART_FCR_CLEAR_RCVR |
+-				  UART_FCR_CLEAR_XMIT);
+-	serial_outp(up, UART_FCR, 0);
+-
+-	/*
+-	 * Read data port to reset things, and then unlink from
+-	 * the IRQ chain.
+-	 */
+-	(void) serial_in(up, UART_RX);
+-
+-	if (!is_real_interrupt(up->port.irq))
+-		del_timer_sync(&up->timer);
+-	else
+-		serial_unlink_irq_chain(up);
+-}
+-
+-static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud)
+-{
+-	unsigned int quot;
+-
+-	/*
+-	 * Handle magic divisors for baud rates above baud_base on
+-	 * SMSC SuperIO chips.
+-	 */
+-	if ((port->flags & UPF_MAGIC_MULTIPLIER) &&
+-	    baud == (port->uartclk/4))
+-		quot = 0x8001;
+-	else if ((port->flags & UPF_MAGIC_MULTIPLIER) &&
+-		 baud == (port->uartclk/8))
+-		quot = 0x8002;
+-	else
+-		quot = uart_get_divisor(port, baud);
+-
+-	return quot;
+-}
+-
+-static void
+-serial8250_set_termios(struct uart_port *port, struct termios *termios,
+-		       struct termios *old)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned char cval, fcr = 0;
+-	unsigned long flags;
+-	unsigned int baud, quot;
+-
+-	switch (termios->c_cflag & CSIZE) {
+-	case CS5:
+-		cval = UART_LCR_WLEN5;
+-		break;
+-	case CS6:
+-		cval = UART_LCR_WLEN6;
+-		break;
+-	case CS7:
+-		cval = UART_LCR_WLEN7;
+-		break;
+-	default:
+-	case CS8:
+-		cval = UART_LCR_WLEN8;
+-		break;
+-	}
+-
+-	if (termios->c_cflag & CSTOPB)
+-		cval |= UART_LCR_STOP;
+-	if (termios->c_cflag & PARENB)
+-		cval |= UART_LCR_PARITY;
+-	if (!(termios->c_cflag & PARODD))
+-		cval |= UART_LCR_EPAR;
+-#ifdef CMSPAR
+-	if (termios->c_cflag & CMSPAR)
+-		cval |= UART_LCR_SPAR;
+-#endif
+-
+-	/*
+-	 * Ask the core to calculate the divisor for us.
+-	 */
+-	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); 
+-	quot = serial8250_get_divisor(port, baud);
+-	quot = 0x35; /* FIXME */
+-
+-	/*
+-	 * Work around a bug in the Oxford Semiconductor 952 rev B
+-	 * chip which causes it to seriously miscalculate baud rates
+-	 * when DLL is 0.
+-	 */
+-	if ((quot & 0xff) == 0 && up->port.type == PORT_16C950 &&
+-	    up->rev == 0x5201)
+-		quot ++;
+-
+-	if (uart_config[up->port.type].flags & UART_USE_FIFO) {
+-		if (baud < 2400)
+-			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIGGER_1;
+-		else
+-			fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIGGER_8;
+-	}
+-
+-	/*
+-	 * Ok, we're now changing the port state.  Do it with
+-	 * interrupts disabled.
+-	 */
+-	spin_lock_irqsave(&up->port.lock, flags);
+-
+-	/*
+-	 * Update the per-port timeout.
+-	 */
+-	uart_update_timeout(port, termios->c_cflag, baud);
+-
+-	up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
+-	if (termios->c_iflag & INPCK)
+-		up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
+-	if (termios->c_iflag & (BRKINT | PARMRK))
+-		up->port.read_status_mask |= UART_LSR_BI;
+-
+-	/*
+-	 * Characteres to ignore
+-	 */
+-	up->port.ignore_status_mask = 0;
+-	if (termios->c_iflag & IGNPAR)
+-		up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
+-	if (termios->c_iflag & IGNBRK) {
+-		up->port.ignore_status_mask |= UART_LSR_BI;
+-		/*
+-		 * If we're ignoring parity and break indicators,
+-		 * ignore overruns too (for real raw support).
+-		 */
+-		if (termios->c_iflag & IGNPAR)
+-			up->port.ignore_status_mask |= UART_LSR_OE;
+-	}
+-
+-	/*
+-	 * ignore all characters if CREAD is not set
+-	 */
+-	if ((termios->c_cflag & CREAD) == 0)
+-		up->port.ignore_status_mask |= UART_LSR_DR;
+-
+-	/*
+-	 * CTS flow control flag and modem status interrupts
+-	 */
+-	up->ier &= ~UART_IER_MSI;
+-	if (UART_ENABLE_MS(&up->port, termios->c_cflag))
+-		up->ier |= UART_IER_MSI;
+-
+-	serial_out(up, UART_IER, up->ier);
+-	serial_outp(up, 0x28, quot & 0xffff);
+-	up->lcr = cval;					/* Save LCR */
+-	if (up->port.type != PORT_16750) {
+-		if (fcr & UART_FCR_ENABLE_FIFO) {
+-			/* emulated UARTs (Lucent Venus 167x) need two steps */
+-			serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
+-		}
+-		serial_outp(up, UART_FCR, fcr);		/* set fcr */
+-	}
+-	spin_unlock_irqrestore(&up->port.lock, flags);
+-}
+-
+-static void
+-serial8250_pm(struct uart_port *port, unsigned int state,
+-	      unsigned int oldstate)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	if (state) {
+-		/* sleep */
+-		if (up->pm)
+-			up->pm(port, state, oldstate);
+-	} else {
+-		/* wake */
+-		if (up->pm)
+-			up->pm(port, state, oldstate);
+-	}
+-}
+-
+-/*
+- * Resource handling.  This is complicated by the fact that resources
+- * depend on the port type.  Maybe we should be claiming the standard
+- * 8250 ports, and then trying to get other resources as necessary?
+- */
+-static int
+-serial8250_request_std_resource(struct uart_8250_port *up, struct resource **res)
+-{
+-	unsigned int size = 8 << up->port.regshift;
+-	int ret = 0;
+-
+-	switch (up->port.iotype) {
+-	case UPIO_MEM:
+-		if (up->port.mapbase) {
+-			*res = request_mem_region(up->port.mapbase, size, "serial");
+-			if (!*res)
+-				ret = -EBUSY;
+-		}
+-		break;
+-
+-	case UPIO_HUB6:
+-	case UPIO_PORT:
+-		*res = request_region(up->port.iobase, size, "serial");
+-		if (!*res)
+-			ret = -EBUSY;
+-		break;
+-	}
+-	return ret;
+-}
+-
+-
+-static void serial8250_release_port(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	unsigned long start, offset = 0, size = 0;
+-
+-	size <<= up->port.regshift;
+-
+-	switch (up->port.iotype) {
+-	case UPIO_MEM:
+-		if (up->port.mapbase) {
+-			/*
+-			 * Unmap the area.
+-			 */
+-			iounmap(up->port.membase);
+-			up->port.membase = NULL;
+-
+-			start = up->port.mapbase;
+-
+-			if (size)
+-				release_mem_region(start + offset, size);
+-			release_mem_region(start, 8 << up->port.regshift);
+-		}
+-		break;
+-
+-	case UPIO_HUB6:
+-	case UPIO_PORT:
+-		start = up->port.iobase;
+-
+-		if (size)
+-			release_region(start + offset, size);
+-		release_region(start + offset, 8 << up->port.regshift);
+-		break;
+-
+-	default:
+-		break;
+-	}
+-}
+-
+-static int serial8250_request_port(struct uart_port *port)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	struct resource *res = NULL, *res_rsa = NULL;
+-	int ret = 0;
+-
+-	ret = serial8250_request_std_resource(up, &res);
+-
+-	/*
+-	 * If we have a mapbase, then request that as well.
+-	 */
+-	if (ret == 0 && up->port.flags & UPF_IOREMAP) {
+-		int size = res->end - res->start + 1;
+-
+-		up->port.membase = ioremap(up->port.mapbase, size);
+-		if (!up->port.membase)
+-			ret = -ENOMEM;
+-	}
+-
+-	if (ret < 0) {
+-		if (res_rsa)
+-			release_resource(res_rsa);
+-		if (res)
+-			release_resource(res);
+-	}
+-	return ret;
+-}
+-
+-static void serial8250_config_port(struct uart_port *port, int flags)
+-{
+-	struct uart_8250_port *up = (struct uart_8250_port *)port;
+-	struct resource *res_std = NULL, *res_rsa = NULL;
+-	int probeflags = PROBE_ANY;
+-
+-	probeflags &= ~PROBE_RSA;
+-
+-	if (flags & UART_CONFIG_TYPE)
+-		autoconfig(up, probeflags);
+-
+-	/*
+-	 * If the port wasn't an RSA port, release the resource.
+-	 */
+-	if (up->port.type != PORT_RSA && res_rsa)
+-		release_resource(res_rsa);
+-
+-	if (up->port.type == PORT_UNKNOWN && res_std)
+-		release_resource(res_std);
+-}
+-
+-static int
+-serial8250_verify_port(struct uart_port *port, struct serial_struct *ser)
+-{
+-	if (ser->irq >= NR_IRQS || ser->irq < 0 ||
+-	    ser->baud_base < 9600 || ser->type < PORT_UNKNOWN ||
+-	    ser->type > PORT_MAX_8250 || ser->type == PORT_CIRRUS ||
+-	    ser->type == PORT_STARTECH)
+-		return -EINVAL;
+-	return 0;
+-}
+-
+-static const char *
+-serial8250_type(struct uart_port *port)
+-{
+-	int type = port->type;
+-
+-	if (type >= ARRAY_SIZE(uart_config))
+-		type = 0;
+-	return uart_config[type].name;
+-}
+-
+-static struct uart_ops serial8250_pops = {
+-	.tx_empty	= serial8250_tx_empty,
+-	.set_mctrl	= serial8250_set_mctrl,
+-	.get_mctrl	= serial8250_get_mctrl,
+-	.stop_tx	= serial8250_stop_tx,
+-	.start_tx	= serial8250_start_tx,
+-	.stop_rx	= serial8250_stop_rx,
+-	.enable_ms	= serial8250_enable_ms,
+-	.break_ctl	= serial8250_break_ctl,
+-	.startup	= serial8250_startup,
+-	.shutdown	= serial8250_shutdown,
+-	.set_termios	= serial8250_set_termios,
+-	.pm		= serial8250_pm,
+-	.type		= serial8250_type,
+-	.release_port	= serial8250_release_port,
+-	.request_port	= serial8250_request_port,
+-	.config_port	= serial8250_config_port,
+-	.verify_port	= serial8250_verify_port,
+-};
+-
+-static struct uart_8250_port serial8250_ports[UART_NR];
+-
+-static void __init serial8250_isa_init_ports(void)
+-{
+-	struct uart_8250_port *up;
+-	static int first = 1;
+-	int i;
+-
+-	if (!first)
+-		return;
+-	first = 0;
+-
+-	for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
+-	     i++, up++) {
+-		up->port.iobase   = old_serial_port[i].port;
+-		up->port.irq      = old_serial_port[i].irq;
+-		up->port.uartclk  = get_au1x00_uart_baud_base();
+-		up->port.flags    = old_serial_port[i].flags;
+-		up->port.hub6     = old_serial_port[i].hub6;
+-		up->port.membase  = old_serial_port[i].iomem_base;
+-		up->port.iotype   = old_serial_port[i].io_type;
+-		up->port.regshift = old_serial_port[i].iomem_reg_shift;
+-		up->port.ops      = &serial8250_pops;
+-	}
+-}
+-
+-static void __init serial8250_register_ports(struct uart_driver *drv)
+-{
+-	int i;
+-
+-	serial8250_isa_init_ports();
+-
+-	for (i = 0; i < UART_NR; i++) {
+-		struct uart_8250_port *up = &serial8250_ports[i];
+-
+-		up->port.line = i;
+-		up->port.ops = &serial8250_pops;
+-		init_timer(&up->timer);
+-		up->timer.function = serial8250_timeout;
+-
+-		/*
+-		 * ALPHA_KLUDGE_MCR needs to be killed.
+-		 */
+-		up->mcr_mask = ~ALPHA_KLUDGE_MCR;
+-		up->mcr_force = ALPHA_KLUDGE_MCR;
+-
+-		uart_add_one_port(drv, &up->port);
+-	}
+-}
+-
+-#ifdef CONFIG_SERIAL_AU1X00_CONSOLE
+-
+-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+-
+-/*
+- *	Wait for transmitter & holding register to empty
+- */
+-static inline void wait_for_xmitr(struct uart_8250_port *up)
+-{
+-	unsigned int status, tmout = 10000;
+-
+-	/* Wait up to 10ms for the character(s) to be sent. */
+-	do {
+-		status = serial_in(up, UART_LSR);
+-
+-		if (status & UART_LSR_BI)
+-			up->lsr_break_flag = UART_LSR_BI;
+-
+-		if (--tmout == 0)
+-			break;
+-		udelay(1);
+-	} while ((status & BOTH_EMPTY) != BOTH_EMPTY);
+-
+-	/* Wait up to 1s for flow control if necessary */
+-	if (up->port.flags & UPF_CONS_FLOW) {
+-		tmout = 1000000;
+-		while (--tmout &&
+-		       ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0))
+-			udelay(1);
+-	}
+-}
+-
+-/*
+- *	Print a string to the serial port trying not to disturb
+- *	any possible real use of the port...
+- *
+- *	The console_lock must be held when we get here.
+- */
+-static void
+-serial8250_console_write(struct console *co, const char *s, unsigned int count)
+-{
+-	struct uart_8250_port *up = &serial8250_ports[co->index];
+-	unsigned int ier;
+-	int i;
+-
+-	/*
+-	 *	First save the UER then disable the interrupts
+-	 */
+-	ier = serial_in(up, UART_IER);
+-	serial_out(up, UART_IER, 0);
+-
+-	/*
+-	 *	Now, do each character
+-	 */
+-	for (i = 0; i < count; i++, s++) {
+-		wait_for_xmitr(up);
+-
+-		/*
+-		 *	Send the character out.
+-		 *	If a LF, also do CR...
+-		 */
+-		serial_out(up, UART_TX, *s);
+-		if (*s == 10) {
+-			wait_for_xmitr(up);
+-			serial_out(up, UART_TX, 13);
+-		}
+-	}
+-
+-	/*
+-	 *	Finally, wait for transmitter to become empty
+-	 *	and restore the IER
+-	 */
+-	wait_for_xmitr(up);
+-	serial_out(up, UART_IER, ier);
+-}
+-
+-static int __init serial8250_console_setup(struct console *co, char *options)
+-{
+-	struct uart_port *port;
+-	int baud = 9600;
+-	int bits = 8;
+-	int parity = 'n';
+-	int flow = 'n';
+-
+-	/*
+-	 * Check whether an invalid uart number has been specified, and
+-	 * if so, search for the first available port that does have
+-	 * console support.
+-	 */
+-	if (co->index >= UART_NR)
+-		co->index = 0;
+-	port = &serial8250_ports[co->index].port;
+-
+-	/*
+-	 * Temporary fix.
+-	 */
+-	spin_lock_init(&port->lock);
+-
+-	if (options)
+-		uart_parse_options(options, &baud, &parity, &bits, &flow);
+-
+-	return uart_set_options(port, co, baud, parity, bits, flow);
+-}
+-
+-extern struct uart_driver serial8250_reg;
+-static struct console serial8250_console = {
+-	.name		= "ttyS",
+-	.write		= serial8250_console_write,
+-	.device		= uart_console_device,
+-	.setup		= serial8250_console_setup,
+-	.flags		= CON_PRINTBUFFER,
+-	.index		= -1,
+-	.data		= &serial8250_reg,
+-};
+-
+-static int __init serial8250_console_init(void)
+-{
+-	serial8250_isa_init_ports();
+-	register_console(&serial8250_console);
+-	return 0;
+-}
+-console_initcall(serial8250_console_init);
+-
+-#define SERIAL8250_CONSOLE	&serial8250_console
+-#else
+-#define SERIAL8250_CONSOLE	NULL
+-#endif
+-
+-static struct uart_driver serial8250_reg = {
+-	.owner			= THIS_MODULE,
+-	.driver_name		= "serial",
+-	.devfs_name		= "tts/",
+-	.dev_name		= "ttyS",
+-	.major			= TTY_MAJOR,
+-	.minor			= 64,
+-	.nr			= UART_NR,
+-	.cons			= SERIAL8250_CONSOLE,
+-};
+-
+-int __init early_serial_setup(struct uart_port *port)
+-{
+-	serial8250_isa_init_ports();
+-	serial8250_ports[port->line].port	= *port;
+-	serial8250_ports[port->line].port.ops	= &serial8250_pops;
+-	return 0;
+-}
+-
+-/**
+- *	serial8250_suspend_port - suspend one serial port
+- *	@line:  serial line number
+- *      @level: the level of port suspension, as per uart_suspend_port
+- *
+- *	Suspend one serial port.
+- */
+-void serial8250_suspend_port(int line)
+-{
+-	uart_suspend_port(&serial8250_reg, &serial8250_ports[line].port);
+-}
+-
+-/**
+- *	serial8250_resume_port - resume one serial port
+- *	@line:  serial line number
+- *      @level: the level of port resumption, as per uart_resume_port
+- *
+- *	Resume one serial port.
+- */
+-void serial8250_resume_port(int line)
+-{
+-	uart_resume_port(&serial8250_reg, &serial8250_ports[line].port);
+-}
+-
+-static int __init serial8250_init(void)
+-{
+-	int ret, i;
+-
+-	printk(KERN_INFO "Serial: Au1x00 driver\n");
+-
+-	for (i = 0; i < NR_IRQS; i++)
+-		spin_lock_init(&irq_lists[i].lock);
+-
+-	ret = uart_register_driver(&serial8250_reg);
+-	if (ret >= 0)
+-		serial8250_register_ports(&serial8250_reg);
+-
+-	return ret;
+-}
+-
+-static void __exit serial8250_exit(void)
+-{
+-	int i;
+-
+-	for (i = 0; i < UART_NR; i++)
+-		uart_remove_one_port(&serial8250_reg, &serial8250_ports[i].port);
+-
+-	uart_unregister_driver(&serial8250_reg);
+-}
+-
+-module_init(serial8250_init);
+-module_exit(serial8250_exit);
+-
+-EXPORT_SYMBOL(serial8250_suspend_port);
+-EXPORT_SYMBOL(serial8250_resume_port);
+-
+-MODULE_LICENSE("GPL");
+-MODULE_DESCRIPTION("Au1x00 serial driver\n");
+diff -Naur linux-2.6.16.orig/drivers/serial/ip22zilog.c linux-2.6.16/drivers/serial/ip22zilog.c
+--- linux-2.6.16.orig/drivers/serial/ip22zilog.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/serial/ip22zilog.c	2006-03-21 01:05:48.000000000 +0000
+@@ -866,6 +866,7 @@
+ 	up->cflag = termios->c_cflag;
+ 
+ 	ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
++	uart_update_timeout(port, termios->c_cflag, baud);
+ 
+ 	spin_unlock_irqrestore(&up->port.lock, flags);
+ }
+@@ -1032,6 +1033,8 @@
+ 	}
+ 
+ 	con->cflag = cflag | CS8;			/* 8N1 */
++
++	uart_update_timeout(&ip22zilog_port_table[con->index].port, cflag, baud);
+ }
+ 
+ static int __init ip22zilog_console_setup(struct console *con, char *options)
+diff -Naur linux-2.6.16.orig/drivers/serial/ip3106_uart.c linux-2.6.16/drivers/serial/ip3106_uart.c
+--- linux-2.6.16.orig/drivers/serial/ip3106_uart.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/serial/ip3106_uart.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,912 @@
++/*
++ * Initially based on linux-2.4.20_mvl31-pnx8xx0/drivers/char/serial_pnx8550.c
++ *
++ * Complete rewrite to drivers/serial/pnx8550_uart.c by
++ * Embedded Alley Solutions, source@embeddedalley.com as part of the
++ * PNX8550 2.6 port, and then drivers/serial/ip3106_uart.c to work
++ * with other Philips SoCs.
++ *
++ * Existing copyrights from files used to write this driver:
++ * Author: Per Hallsmark per.hallsmark@mvista.com
++ *
++ * and
++ *
++ * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o.
++ * Copyright (C) 2000 Deep Blue Solutions Ltd.
++ *
++ */
++
++#include <linux/config.h>
++
++#if defined(CONFIG_SERIAL_IP3106_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
++#define SUPPORT_SYSRQ
++#endif
++
++#include <linux/module.h>
++#include <linux/ioport.h>
++#include <linux/init.h>
++#include <linux/console.h>
++#include <linux/sysrq.h>
++#include <linux/device.h>
++#include <linux/tty.h>
++#include <linux/tty_flip.h>
++#include <linux/serial_core.h>
++#include <linux/serial.h>
++#include <linux/serial_ip3106.h>
++
++#include <asm/io.h>
++#include <asm/irq.h>
++
++#include <uart.h>
++
++/* We've been assigned a range on the "Low-density serial ports" major */
++#define SERIAL_IP3106_MAJOR	204
++#define MINOR_START		5
++
++#define NR_PORTS		2
++
++#define IP3106_ISR_PASS_LIMIT	256
++
++/*
++ * Convert from ignore_status_mask or read_status_mask to FIFO
++ * and interrupt status bits
++ */
++#define SM_TO_FIFO(x)	((x) >> 10)
++#define SM_TO_ISTAT(x)	((x) & 0x000001ff)
++#define FIFO_TO_SM(x)	((x) << 10)
++#define ISTAT_TO_SM(x)	((x) & 0x000001ff)
++
++/*
++ * This is the size of our serial port register set.
++ */
++#define UART_PORT_SIZE	0x1000
++
++/*
++ * This determines how often we check the modem status signals
++ * for any change.  They generally aren't connected to an IRQ
++ * so we have to poll them.  We also check immediately before
++ * filling the TX fifo incase CTS has been dropped.
++ */
++#define MCTRL_TIMEOUT	(250*HZ/1000)
++
++
++extern struct ip3106_port ip3106_ports[];
++
++static inline int serial_in(struct ip3106_port *sport, int offset)
++{
++	return (__raw_readl(sport->port.membase + offset));
++}
++
++static inline void serial_out(struct ip3106_port *sport, int offset, int value)
++{
++	__raw_writel(value, sport->port.membase + offset);
++}
++
++/*
++ * Handle any change of modem status signal since we were last called.
++ */
++static void ip3106_mctrl_check(struct ip3106_port *sport)
++{
++	unsigned int status, changed;
++
++	status = sport->port.ops->get_mctrl(&sport->port);
++	changed = status ^ sport->old_status;
++
++	if (changed == 0)
++		return;
++
++	sport->old_status = status;
++
++	if (changed & TIOCM_RI)
++		sport->port.icount.rng++;
++	if (changed & TIOCM_DSR)
++		sport->port.icount.dsr++;
++	if (changed & TIOCM_CAR)
++		uart_handle_dcd_change(&sport->port, status & TIOCM_CAR);
++	if (changed & TIOCM_CTS)
++		uart_handle_cts_change(&sport->port, status & TIOCM_CTS);
++
++	wake_up_interruptible(&sport->port.info->delta_msr_wait);
++}
++
++/*
++ * This is our per-port timeout handler, for checking the
++ * modem status signals.
++ */
++static void ip3106_timeout(unsigned long data)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)data;
++	unsigned long flags;
++
++	if (sport->port.info) {
++		spin_lock_irqsave(&sport->port.lock, flags);
++		ip3106_mctrl_check(sport);
++		spin_unlock_irqrestore(&sport->port.lock, flags);
++
++		mod_timer(&sport->timer, jiffies + MCTRL_TIMEOUT);
++	}
++}
++
++/*
++ * interrupts disabled on entry
++ */
++static void ip3106_stop_tx(struct uart_port *port, unsigned int tty_stop)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	u32 ien;
++
++	/* Disable TX intr */
++	ien = serial_in(sport, IP3106_IEN);
++	serial_out(sport, IP3106_IEN, ien & ~IP3106_UART_INT_ALLTX);
++
++	/* Clear all pending TX intr */
++	serial_out(sport, IP3106_ICLR, IP3106_UART_INT_ALLTX);
++}
++
++/*
++ * interrupts may not be disabled on entry
++ */
++static void ip3106_start_tx(struct uart_port *port, unsigned int tty_start)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	unsigned long flags;
++	u32 ien;
++
++	spin_lock_irqsave(&sport->port.lock, flags);
++
++	/* Clear all pending TX intr */
++	serial_out(sport, IP3106_ICLR, IP3106_UART_INT_ALLTX);
++
++	/* Enable TX intr */
++	ien = serial_in(sport, IP3106_IEN);
++	serial_out(sport, IP3106_IEN, ien | IP3106_UART_INT_ALLTX);
++
++	spin_unlock_irqrestore(&sport->port.lock, flags);
++}
++
++/*
++ * Interrupts enabled
++ */
++static void ip3106_stop_rx(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	u32 ien;
++
++	/* Disable RX intr */
++	ien = serial_in(sport, IP3106_IEN);
++	serial_out(sport, IP3106_IEN, ien & ~IP3106_UART_INT_ALLRX);
++
++	/* Clear all pending RX intr */
++	serial_out(sport, IP3106_ICLR, IP3106_UART_INT_ALLRX);
++}
++
++/*
++ * Set the modem control timer to fire immediately.
++ */
++static void ip3106_enable_ms(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	mod_timer(&sport->timer, jiffies);
++}
++
++static void
++ip3106_rx_chars(struct ip3106_port *sport, struct pt_regs *regs)
++{
++	struct tty_struct *tty = sport->port.info->tty;
++	unsigned int status, ch, flg, ignored = 0;
++
++	status = FIFO_TO_SM(serial_in(sport, IP3106_FIFO)) |
++		 ISTAT_TO_SM(serial_in(sport, IP3106_ISTAT));
++	while (status & FIFO_TO_SM(IP3106_UART_FIFO_RXFIFO)) {
++		ch = serial_in(sport, IP3106_FIFO);
++
++		if (tty->flip.count >= TTY_FLIPBUF_SIZE)
++			goto ignore_char;
++		sport->port.icount.rx++;
++
++		flg = TTY_NORMAL;
++
++		/*
++		 * note that the error handling code is
++		 * out of the main execution path
++		 */
++		if (status & FIFO_TO_SM(IP3106_UART_FIFO_RXFE |
++					IP3106_UART_FIFO_RXPAR))
++			goto handle_error;
++
++		if (uart_handle_sysrq_char(&sport->port, ch, regs))
++			goto ignore_char;
++
++	error_return:
++		tty_insert_flip_char(tty, ch, flg);
++	ignore_char:
++		serial_out(sport, IP3106_LCR, serial_in(sport, IP3106_LCR) |
++				IP3106_UART_LCR_RX_NEXT);
++		status = FIFO_TO_SM(serial_in(sport, IP3106_FIFO)) |
++			 ISTAT_TO_SM(serial_in(sport, IP3106_ISTAT));
++	}
++ out:
++	tty_flip_buffer_push(tty);
++	return;
++
++ handle_error:
++	if (status & FIFO_TO_SM(IP3106_UART_FIFO_RXPAR))
++		sport->port.icount.parity++;
++	else if (status & FIFO_TO_SM(IP3106_UART_FIFO_RXFE))
++		sport->port.icount.frame++;
++	if (status & ISTAT_TO_SM(IP3106_UART_INT_RXOVRN))
++		sport->port.icount.overrun++;
++
++	if (status & sport->port.ignore_status_mask) {
++		if (++ignored > 100)
++			goto out;
++		goto ignore_char;
++	}
++
++//	status &= sport->port.read_status_mask;
++
++	if (status & FIFO_TO_SM(IP3106_UART_FIFO_RXPAR))
++		flg = TTY_PARITY;
++	else if (status & FIFO_TO_SM(IP3106_UART_FIFO_RXFE))
++		flg = TTY_FRAME;
++
++	if (status & ISTAT_TO_SM(IP3106_UART_INT_RXOVRN)) {
++		/*
++		 * overrun does *not* affect the character
++		 * we read from the FIFO
++		 */
++		tty_insert_flip_char(tty, ch, flg);
++		ch = 0;
++		flg = TTY_OVERRUN;
++	}
++#ifdef SUPPORT_SYSRQ
++	sport->port.sysrq = 0;
++#endif
++	goto error_return;
++}
++
++static void ip3106_tx_chars(struct ip3106_port *sport)
++{
++	struct circ_buf *xmit = &sport->port.info->xmit;
++
++	if (sport->port.x_char) {
++		serial_out(sport, IP3106_FIFO, sport->port.x_char);
++		sport->port.icount.tx++;
++		sport->port.x_char = 0;
++		return;
++	}
++
++	/*
++	 * Check the modem control lines before
++	 * transmitting anything.
++	 */
++	ip3106_mctrl_check(sport);
++
++	if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) {
++		ip3106_stop_tx(&sport->port, 0);
++		return;
++	}
++
++	/*
++	 * TX while bytes available
++	 */
++	while (((serial_in(sport, IP3106_FIFO) &
++					IP3106_UART_FIFO_TXFIFO) >> 16) < 16) {
++		serial_out(sport, IP3106_FIFO, xmit->buf[xmit->tail]);
++		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
++		sport->port.icount.tx++;
++		if (uart_circ_empty(xmit))
++			break;
++	}
++
++	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
++		uart_write_wakeup(&sport->port);
++
++	if (uart_circ_empty(xmit))
++		ip3106_stop_tx(&sport->port, 0);
++}
++
++static irqreturn_t ip3106_int(int irq, void *dev_id, struct pt_regs *regs)
++{
++	struct ip3106_port *sport = dev_id;
++	unsigned int status;
++
++	spin_lock(&sport->port.lock);
++	/* Get the interrupts */
++	status  = serial_in(sport, IP3106_ISTAT) & serial_in(sport, IP3106_IEN);
++
++	/* RX Receiver Holding Register Overrun */
++	if (status & IP3106_UART_INT_RXOVRN) {
++		sport->port.icount.overrun++;
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_RXOVRN);
++	}
++
++	/* RX Frame Error */
++	if (status & IP3106_UART_INT_FRERR) {
++		sport->port.icount.frame++;
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_FRERR);
++	}
++
++	/* Break signal received */
++	if (status & IP3106_UART_INT_BREAK) {
++		sport->port.icount.brk++;
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_BREAK);
++	}
++
++	/* RX Parity Error */
++	if (status & IP3106_UART_INT_PARITY) {
++		sport->port.icount.parity++;
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_PARITY);
++	}
++
++	/* Byte received */
++	if (status & IP3106_UART_INT_RX) {
++		ip3106_rx_chars(sport, regs);
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_RX);
++	}
++
++	/* TX holding register empty - transmit a byte */
++	if (status & IP3106_UART_INT_TX) {
++		ip3106_tx_chars(sport);
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_TX);
++	}
++
++	/* TX shift register and holding register empty  */
++	if (status & IP3106_UART_INT_EMPTY) {
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_EMPTY);
++	}
++
++	/* Receiver time out */
++	if (status & IP3106_UART_INT_RCVTO) {
++		serial_out(sport, IP3106_ICLR, IP3106_UART_INT_RCVTO);
++	}
++	spin_unlock(&sport->port.lock);
++	return IRQ_HANDLED;
++}
++
++/*
++ * Return TIOCSER_TEMT when transmitter is not busy.
++ */
++static unsigned int ip3106_tx_empty(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	return serial_in(sport, IP3106_FIFO) & IP3106_UART_FIFO_TXFIFO_STA ? 0 : TIOCSER_TEMT;
++}
++
++static unsigned int ip3106_get_mctrl(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	unsigned int mctrl = TIOCM_DSR;
++	unsigned int msr;
++
++	/* REVISIT */
++
++	msr = serial_in(sport, IP3106_MCR);
++
++	mctrl |= msr & IP3106_UART_MCR_CTS ? TIOCM_CTS : 0;
++	mctrl |= msr & IP3106_UART_MCR_DCD ? TIOCM_CAR : 0;
++
++	return mctrl;
++}
++
++static void ip3106_set_mctrl(struct uart_port *port, unsigned int mctrl)
++{
++#if	0	/* FIXME */
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	unsigned int msr;
++#endif
++}
++
++/*
++ * Interrupts always disabled.
++ */
++static void ip3106_break_ctl(struct uart_port *port, int break_state)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	unsigned long flags;
++	unsigned int lcr;
++
++	spin_lock_irqsave(&sport->port.lock, flags);
++	lcr = serial_in(sport, IP3106_LCR);
++	if (break_state == -1)
++		lcr |= IP3106_UART_LCR_TXBREAK;
++	else
++		lcr &= ~IP3106_UART_LCR_TXBREAK;
++	serial_out(sport, IP3106_LCR, lcr);
++	spin_unlock_irqrestore(&sport->port.lock, flags);
++}
++
++static int ip3106_startup(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	int retval;
++
++	/*
++	 * Allocate the IRQ
++	 */
++	retval = request_irq(sport->port.irq, ip3106_int, 0,
++			     "ip3106-uart", sport);
++	if (retval)
++		return retval;
++
++	/*
++	 * Finally, clear and enable interrupts
++	 */
++
++	serial_out(sport, IP3106_ICLR, IP3106_UART_INT_ALLRX |
++			     IP3106_UART_INT_ALLTX);
++
++	serial_out(sport, IP3106_IEN, serial_in(sport, IP3106_IEN) |
++			    IP3106_UART_INT_ALLRX |
++			    IP3106_UART_INT_ALLTX);
++
++	/*
++	 * Enable modem status interrupts
++	 */
++	spin_lock_irq(&sport->port.lock);
++	ip3106_enable_ms(&sport->port);
++	spin_unlock_irq(&sport->port.lock);
++
++	return 0;
++}
++
++static void ip3106_shutdown(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	/*
++	 * Stop our timer.
++	 */
++	del_timer_sync(&sport->timer);
++
++	/*
++	 * Disable all interrupts, port and break condition.
++	 */
++	serial_out(sport, IP3106_IEN, 0);
++
++	/*
++	 * Reset the Tx and Rx FIFOS
++	 */
++	serial_out(sport, IP3106_LCR, serial_in(sport, IP3106_LCR) |
++			    IP3106_UART_LCR_TX_RST |
++			    IP3106_UART_LCR_RX_RST);
++
++	/*
++	 * Clear all interrupts
++	 */
++	serial_out(sport, IP3106_ICLR, IP3106_UART_INT_ALLRX |
++			     IP3106_UART_INT_ALLTX);
++
++	/*
++	 * Free the interrupt
++	 */
++	free_irq(sport->port.irq, sport);
++}
++
++static void
++ip3106_set_termios(struct uart_port *port, struct termios *termios,
++		   struct termios *old)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	unsigned long flags;
++	unsigned int lcr_fcr, old_ien, baud, quot;
++	unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
++
++	/*
++	 * We only support CS7 and CS8.
++	 */
++	while ((termios->c_cflag & CSIZE) != CS7 &&
++	       (termios->c_cflag & CSIZE) != CS8) {
++		termios->c_cflag &= ~CSIZE;
++		termios->c_cflag |= old_csize;
++		old_csize = CS8;
++	}
++
++	if ((termios->c_cflag & CSIZE) == CS8)
++		lcr_fcr = IP3106_UART_LCR_8BIT;
++	else
++		lcr_fcr = 0;
++
++	if (termios->c_cflag & CSTOPB)
++		lcr_fcr |= IP3106_UART_LCR_2STOPB;
++	if (termios->c_cflag & PARENB) {
++		lcr_fcr |= IP3106_UART_LCR_PAREN;
++		if (!(termios->c_cflag & PARODD))
++			lcr_fcr |= IP3106_UART_LCR_PAREVN;
++	}
++
++	/*
++	 * Ask the core to calculate the divisor for us.
++	 */
++	baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
++	quot = uart_get_divisor(port, baud);
++
++	spin_lock_irqsave(&sport->port.lock, flags);
++
++#if	0	/* REVISIT */
++	sport->port.read_status_mask &= UTSR0_TO_SM(UTSR0_TFS);
++	sport->port.read_status_mask |= UTSR1_TO_SM(UTSR1_ROR);
++	if (termios->c_iflag & INPCK)
++		sport->port.read_status_mask |=
++				UTSR1_TO_SM(UTSR1_FRE | UTSR1_PRE);
++	if (termios->c_iflag & (BRKINT | PARMRK))
++		sport->port.read_status_mask |=
++				UTSR0_TO_SM(UTSR0_RBB | UTSR0_REB);
++
++	/*
++	 * Characters to ignore
++	 */
++	sport->port.ignore_status_mask = 0;
++	if (termios->c_iflag & IGNPAR)
++		sport->port.ignore_status_mask |=
++				UTSR1_TO_SM(UTSR1_FRE | UTSR1_PRE);
++	if (termios->c_iflag & IGNBRK) {
++		sport->port.ignore_status_mask |=
++				UTSR0_TO_SM(UTSR0_RBB | UTSR0_REB);
++		/*
++		 * If we're ignoring parity and break indicators,
++		 * ignore overruns too (for real raw support).
++		 */
++		if (termios->c_iflag & IGNPAR)
++			sport->port.ignore_status_mask |=
++				UTSR1_TO_SM(UTSR1_ROR);
++	}
++#endif
++
++	del_timer_sync(&sport->timer);
++
++	/*
++	 * Update the per-port timeout.
++	 */
++	uart_update_timeout(port, termios->c_cflag, baud);
++
++	/*
++	 * disable interrupts and drain transmitter
++	 */
++	old_ien = serial_in(sport, IP3106_IEN);
++	serial_out(sport, IP3106_IEN, old_ien & ~(IP3106_UART_INT_ALLTX |
++					IP3106_UART_INT_ALLRX));
++
++	while (serial_in(sport, IP3106_FIFO) & IP3106_UART_FIFO_TXFIFO_STA)
++		barrier();
++
++	/* then, disable everything */
++	serial_out(sport, IP3106_IEN, 0);
++
++	/* Reset the Rx and Tx FIFOs too */
++	lcr_fcr |= IP3106_UART_LCR_TX_RST;
++	lcr_fcr |= IP3106_UART_LCR_RX_RST;
++
++	/* set the parity, stop bits and data size */
++	serial_out(sport, IP3106_LCR, lcr_fcr);
++
++	/* set the baud rate */
++	quot -= 1;
++	serial_out(sport, IP3106_BAUD, quot);
++
++	serial_out(sport, IP3106_ICLR, -1);
++
++	serial_out(sport, IP3106_IEN, old_ien);
++
++	if (UART_ENABLE_MS(&sport->port, termios->c_cflag))
++		ip3106_enable_ms(&sport->port);
++
++	spin_unlock_irqrestore(&sport->port.lock, flags);
++}
++
++static const char *ip3106_type(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	return sport->port.type == PORT_IP3106 ? "IP3106" : NULL;
++}
++
++/*
++ * Release the memory region(s) being used by 'port'.
++ */
++static void ip3106_release_port(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	release_mem_region(sport->port.mapbase, UART_PORT_SIZE);
++}
++
++/*
++ * Request the memory region(s) being used by 'port'.
++ */
++static int ip3106_request_port(struct uart_port *port)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	return request_mem_region(sport->port.mapbase, UART_PORT_SIZE,
++			"ip3106-uart") != NULL ? 0 : -EBUSY;
++}
++
++/*
++ * Configure/autoconfigure the port.
++ */
++static void ip3106_config_port(struct uart_port *port, int flags)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++
++	if (flags & UART_CONFIG_TYPE &&
++	    ip3106_request_port(&sport->port) == 0)
++		sport->port.type = PORT_IP3106;
++}
++
++/*
++ * Verify the new serial_struct (for TIOCSSERIAL).
++ * The only change we allow are to the flags and type, and
++ * even then only between PORT_IP3106 and PORT_UNKNOWN
++ */
++static int
++ip3106_verify_port(struct uart_port *port, struct serial_struct *ser)
++{
++	struct ip3106_port *sport = (struct ip3106_port *)port;
++	int ret = 0;
++
++	if (ser->type != PORT_UNKNOWN && ser->type != PORT_IP3106)
++		ret = -EINVAL;
++	if (sport->port.irq != ser->irq)
++		ret = -EINVAL;
++	if (ser->io_type != SERIAL_IO_MEM)
++		ret = -EINVAL;
++	if (sport->port.uartclk / 16 != ser->baud_base)
++		ret = -EINVAL;
++	if ((void *)sport->port.mapbase != ser->iomem_base)
++		ret = -EINVAL;
++	if (sport->port.iobase != ser->port)
++		ret = -EINVAL;
++	if (ser->hub6 != 0)
++		ret = -EINVAL;
++	return ret;
++}
++
++struct uart_ops ip3106_pops = {
++	.tx_empty	= ip3106_tx_empty,
++	.set_mctrl	= ip3106_set_mctrl,
++	.get_mctrl	= ip3106_get_mctrl,
++	.stop_tx	= ip3106_stop_tx,
++	.start_tx	= ip3106_start_tx,
++	.stop_rx	= ip3106_stop_rx,
++	.enable_ms	= ip3106_enable_ms,
++	.break_ctl	= ip3106_break_ctl,
++	.startup	= ip3106_startup,
++	.shutdown	= ip3106_shutdown,
++	.set_termios	= ip3106_set_termios,
++	.type		= ip3106_type,
++	.release_port	= ip3106_release_port,
++	.request_port	= ip3106_request_port,
++	.config_port	= ip3106_config_port,
++	.verify_port	= ip3106_verify_port,
++};
++
++
++/*
++ * Setup the IP3106 serial ports.
++ *
++ * Note also that we support "console=ttySx" where "x" is either 0 or 1.
++ */
++static void __init ip3106_init_ports(void)
++{
++	static int first = 1;
++	int i;
++
++	if (!first)
++		return;
++	first = 0;
++
++	for (i = 0; i < NR_PORTS; i++) {
++		init_timer(&ip3106_ports[i].timer);
++		ip3106_ports[i].timer.function = ip3106_timeout;
++		ip3106_ports[i].timer.data     = (unsigned long)&ip3106_ports[i];
++	}
++}
++
++#ifdef CONFIG_SERIAL_IP3106_CONSOLE
++
++/*
++ * Interrupts are disabled on entering
++ */
++static void
++ip3106_console_write(struct console *co, const char *s, unsigned int count)
++{
++	struct ip3106_port *sport = &ip3106_ports[co->index];
++	unsigned int old_ien, status, i;
++
++	/*
++	 *	First, save IEN and then disable interrupts
++	 */
++	old_ien = serial_in(sport, IP3106_IEN);
++	serial_out(sport, IP3106_IEN, old_ien & ~(IP3106_UART_INT_ALLTX |
++					IP3106_UART_INT_ALLRX));
++
++	/*
++	 *	Now, do each character
++	 */
++	for (i = 0; i < count; i++) {
++		do {
++			/* Wait for UART_TX register to empty */
++			status = serial_in(sport, IP3106_FIFO);
++		} while (status & IP3106_UART_FIFO_TXFIFO);
++		serial_out(sport, IP3106_FIFO, s[i]);
++		if (s[i] == '\n') {
++			do {
++				status = serial_in(sport, IP3106_FIFO);
++			} while (status & IP3106_UART_FIFO_TXFIFO);
++			serial_out(sport, IP3106_FIFO, '\r');
++		}
++	}
++
++	/*
++	 *	Finally, wait for transmitter to become empty
++	 *	and restore IEN
++	 */
++	do {
++		/* Wait for UART_TX register to empty */
++		status = serial_in(sport, IP3106_FIFO);
++	} while (status & IP3106_UART_FIFO_TXFIFO);
++
++	/* Clear TX and EMPTY interrupt */
++	serial_out(sport, IP3106_ICLR, IP3106_UART_INT_TX |
++			     IP3106_UART_INT_EMPTY);
++
++	serial_out(sport, IP3106_IEN, old_ien);
++}
++
++static int __init
++ip3106_console_setup(struct console *co, char *options)
++{
++	struct ip3106_port *sport;
++	int baud = 38400;
++	int bits = 8;
++	int parity = 'n';
++	int flow = 'n';
++
++	/*
++	 * Check whether an invalid uart number has been specified, and
++	 * if so, search for the first available port that does have
++	 * console support.
++	 */
++	if (co->index == -1 || co->index >= NR_PORTS)
++		co->index = 0;
++	sport = &ip3106_ports[co->index];
++
++	if (options)
++		uart_parse_options(options, &baud, &parity, &bits, &flow);
++
++	return uart_set_options(&sport->port, co, baud, parity, bits, flow);
++}
++
++extern struct uart_driver ip3106_reg;
++static struct console ip3106_console = {
++	.name		= "ttyS",
++	.write		= ip3106_console_write,
++	.device		= uart_console_device,
++	.setup		= ip3106_console_setup,
++	.flags		= CON_PRINTBUFFER,
++	.index		= -1,
++	.data		= &ip3106_reg,
++};
++
++static int __init ip3106_rs_console_init(void)
++{
++	ip3106_init_ports();
++	register_console(&ip3106_console);
++	return 0;
++}
++console_initcall(ip3106_rs_console_init);
++
++#define IP3106_CONSOLE	&ip3106_console
++#else
++#define IP3106_CONSOLE	NULL
++#endif
++
++static struct uart_driver ip3106_reg = {
++	.owner			= THIS_MODULE,
++	.driver_name		= "ttyS",
++	.dev_name		= "ttyS",
++	.devfs_name		= "tts/",
++	.major			= SERIAL_IP3106_MAJOR,
++	.minor			= MINOR_START,
++	.nr			= NR_PORTS,
++	.cons			= IP3106_CONSOLE,
++};
++
++static int ip3106_serial_suspend(struct device *_dev, u32 state, u32 level)
++{
++	struct ip3106_port *sport = dev_get_drvdata(_dev);
++
++	if (sport && level == SUSPEND_DISABLE)
++		uart_suspend_port(&ip3106_reg, &sport->port);
++
++	return 0;
++}
++
++static int ip3106_serial_resume(struct device *_dev, u32 level)
++{
++	struct ip3106_port *sport = dev_get_drvdata(_dev);
++
++	if (sport && level == RESUME_ENABLE)
++		uart_resume_port(&ip3106_reg, &sport->port);
++
++	return 0;
++}
++
++static int ip3106_serial_probe(struct device *_dev)
++{
++	struct platform_device *dev = to_platform_device(_dev);
++	struct resource *res = dev->resource;
++	int i;
++
++	for (i = 0; i < dev->num_resources; i++, res++) {
++		if (!(res->flags & IORESOURCE_MEM))
++			continue;
++
++		for (i = 0; i < NR_PORTS; i++) {
++			if (ip3106_ports[i].port.mapbase != res->start)
++				continue;
++
++			ip3106_ports[i].port.dev = _dev;
++			uart_add_one_port(&ip3106_reg, &ip3106_ports[i].port);
++			dev_set_drvdata(_dev, &ip3106_ports[i]);
++			break;
++		}
++	}
++
++	return 0;
++}
++
++static int ip3106_serial_remove(struct device *_dev)
++{
++	struct ip3106_port *sport = dev_get_drvdata(_dev);
++
++	dev_set_drvdata(_dev, NULL);
++
++	if (sport)
++		uart_remove_one_port(&ip3106_reg, &sport->port);
++
++	return 0;
++}
++
++static struct device_driver ip3106_serial_driver = {
++	.name		= "ip3106-uart",
++	.bus		= &platform_bus_type,
++	.probe		= ip3106_serial_probe,
++	.remove		= ip3106_serial_remove,
++	.suspend	= ip3106_serial_suspend,
++	.resume		= ip3106_serial_resume,
++};
++
++static int __init ip3106_serial_init(void)
++{
++	int ret;
++
++	printk(KERN_INFO "Serial: IP3106 driver $Revision: 1.2 $\n");
++
++	ip3106_init_ports();
++
++	ret = uart_register_driver(&ip3106_reg);
++	if (ret == 0) {
++		ret = driver_register(&ip3106_serial_driver);
++		if (ret)
++			uart_unregister_driver(&ip3106_reg);
++	}
++	return ret;
++}
++
++static void __exit ip3106_serial_exit(void)
++{
++	driver_unregister(&ip3106_serial_driver);
++	uart_unregister_driver(&ip3106_reg);
++}
++
++module_init(ip3106_serial_init);
++module_exit(ip3106_serial_exit);
++
++MODULE_AUTHOR("Embedded Alley Solutions, Inc.");
++MODULE_DESCRIPTION("IP3106 generic serial port driver");
++MODULE_LICENSE("GPL");
++MODULE_ALIAS_CHARDEV_MAJOR(SERIAL_IP3106_MAJOR);
+diff -Naur linux-2.6.16.orig/drivers/usb/host/ohci-hcd.c linux-2.6.16/drivers/usb/host/ohci-hcd.c
+--- linux-2.6.16.orig/drivers/usb/host/ohci-hcd.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/usb/host/ohci-hcd.c	2006-03-21 01:05:48.000000000 +0000
+@@ -901,6 +901,10 @@
+ #include "ohci-au1xxx.c"
+ #endif
+ 
++#ifdef CONFIG_PNX8550
++#include "ohci-pnx8550.c"
++#endif
++
+ #ifdef CONFIG_USB_OHCI_HCD_PPC_SOC
+ #include "ohci-ppc-soc.c"
+ #endif
+diff -Naur linux-2.6.16.orig/drivers/usb/host/ohci-pnx8550.c linux-2.6.16/drivers/usb/host/ohci-pnx8550.c
+--- linux-2.6.16.orig/drivers/usb/host/ohci-pnx8550.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/usb/host/ohci-pnx8550.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,277 @@
++/*
++ * OHCI HCD (Host Controller Driver) for USB.
++ *
++ * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
++ * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
++ * (C) Copyright 2002 Hewlett-Packard Company
++ * (C) Copyright 2005 Embedded Alley Solutions, Inc.
++ *
++ * Bus Glue for PNX8550
++ *
++ * Written by Christopher Hoover <ch@hpl.hp.com>
++ * Based on fragments of previous driver by Russell King et al.
++ *
++ * Modified for LH7A404 from ohci-sa1111.c
++ *  by Durgesh Pattamatta <pattamattad@sharpsec.com>
++ *
++ * Modified for pxa27x from ohci-lh7a404.c
++ *  by Nick Bane <nick@cecomputing.co.uk> 26-8-2004
++ *
++ * Modified for PNX8550 from ohci-pxa27x.c
++ *  by Embedded Alley Solutions, Inc. 
++ *
++ * This file is licenced under the GPL.
++ */
++
++#include <linux/device.h>
++#include <asm/mach-pnx8550/usb.h>
++#include <asm/mach-pnx8550/int.h>
++#include <asm/mach-pnx8550/pci.h>
++
++#ifndef CONFIG_PNX8550
++#error "This file is PNX8550 bus glue.  CONFIG_PNX8550 must be defined."
++#endif
++
++extern int usb_disabled(void);
++
++/*-------------------------------------------------------------------------*/
++
++static void pnx8550_start_hc(struct platform_device *dev)
++{
++	/*
++	 * Set register CLK48CTL to enable and 48MHz
++	 */
++	outl(0x00000003, PCI_BASE | 0x0004770c);
++
++	/*
++	 * Set register CLK12CTL to enable and 48MHz
++	 */
++	outl(0x00000003, PCI_BASE | 0x00047710);
++
++	udelay(100);
++}
++
++static void pnx8550_stop_hc(struct platform_device *dev)
++{
++	udelay(10);
++}
++
++
++/*-------------------------------------------------------------------------*/
++
++/* configure so an HC device and id are always provided */
++/* always called with process context; sleeping is OK */
++
++
++/**
++ * usb_hcd_pnx8550_probe - initialize pnx8550-based HCDs
++ * Context: !in_interrupt()
++ *
++ * Allocates basic resources for this USB host controller, and
++ * then invokes the start() method for the HCD associated with it
++ * through the hotplug entry's driver_data.
++ *
++ */
++int usb_hcd_pnx8550_probe (const struct hc_driver *driver,
++			  struct platform_device *dev)
++{
++	int retval;
++	struct usb_hcd *hcd;
++
++	if (dev->resource[1].flags != IORESOURCE_IRQ) {
++		pr_debug ("resource[1] is not IORESOURCE_IRQ");
++		return -ENOMEM;
++	}
++
++	hcd = usb_create_hcd (driver, &dev->dev, "pnx8550");
++	if (!hcd)
++		return -ENOMEM;
++	hcd->rsrc_start = dev->resource[0].start;
++	hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
++
++	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
++		pr_debug("request_mem_region failed");
++		retval = -EBUSY;
++		goto err1;
++	}
++
++	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
++	if (!hcd->regs) {
++		pr_debug("ioremap failed");
++		retval = -ENOMEM;
++		goto err2;
++	}
++
++	pnx8550_start_hc(dev);
++
++	ohci_hcd_init(hcd_to_ohci(hcd));
++
++	retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
++	if (retval == 0)
++		return retval;
++
++	pnx8550_stop_hc(dev);
++	iounmap(hcd->regs);
++ err2:
++	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
++ err1:
++	usb_put_hcd(hcd);
++	return retval;
++}
++
++
++/* may be called without controller electrically present */
++/* may be called with controller, bus, and devices active */
++
++/**
++ * usb_hcd_pnx8550_remove - shutdown processing for pnx8550-based HCDs
++ * @dev: USB Host Controller being removed
++ * Context: !in_interrupt()
++ *
++ * Reverses the effect of usb_hcd_pnx8550_probe(), first invoking
++ * the HCD's stop() method.  It is always called from a thread
++ * context, normally "rmmod", "apmd", or something similar.
++ *
++ */
++void usb_hcd_pnx8550_remove (struct usb_hcd *hcd, struct platform_device *dev)
++{
++	usb_remove_hcd(hcd);
++	pnx8550_stop_hc(dev);
++	iounmap(hcd->regs);
++	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
++	usb_put_hcd(hcd);
++}
++
++/*-------------------------------------------------------------------------*/
++
++static int __devinit
++ohci_pnx8550_start (struct usb_hcd *hcd)
++{
++	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
++	int		ret;
++
++	ohci_dbg (ohci, "ohci_pnx8550_start, ohci:%p", ohci);
++
++	if ((ret = ohci_init(ohci)) < 0)
++		return ret;
++
++	if ((ret = ohci_run (ohci)) < 0) {
++		err ("can't start %s", hcd->self.bus_name);
++		ohci_stop (hcd);
++		return ret;
++	}
++
++	return 0;
++}
++
++/*-------------------------------------------------------------------------*/
++
++static const struct hc_driver ohci_pnx8550_hc_driver = {
++	.description =		hcd_name,
++	.product_desc =		"PNX8550 OHCI",
++	.hcd_priv_size =	sizeof(struct ohci_hcd),
++
++	/*
++	 * generic hardware linkage
++	 */
++	.irq =			ohci_irq,
++	.flags =		HCD_USB11 | HCD_MEMORY,
++
++	/*
++	 * basic lifecycle operations
++	 */
++	.start =		ohci_pnx8550_start,
++	.stop =			ohci_stop,
++
++	/*
++	 * managing i/o requests and associated device resources
++	 */
++	.urb_enqueue =		ohci_urb_enqueue,
++	.urb_dequeue =		ohci_urb_dequeue,
++	.endpoint_disable =	ohci_endpoint_disable,
++
++	/*
++	 * scheduling support
++	 */
++	.get_frame_number =	ohci_get_frame,
++
++	/*
++	 * root hub support
++	 */
++	.hub_status_data =	ohci_hub_status_data,
++	.hub_control =		ohci_hub_control,
++#ifdef  CONFIG_USB_SUSPEND
++	.hub_suspend =		ohci_hub_suspend,
++	.hub_resume =		ohci_hub_resume,
++#endif
++};
++
++/*-------------------------------------------------------------------------*/
++
++static int ohci_hcd_pnx8550_drv_probe(struct device *dev)
++{
++	struct platform_device *pdev = to_platform_device(dev);
++	int ret;
++
++	pr_debug ("In ohci_hcd_pnx8550_drv_probe");
++
++	if (usb_disabled())
++		return -ENODEV;
++
++	ret = usb_hcd_pnx8550_probe(&ohci_pnx8550_hc_driver, pdev);
++	return ret;
++}
++
++static int ohci_hcd_pnx8550_drv_remove(struct device *dev)
++{
++	struct platform_device *pdev = to_platform_device(dev);
++	struct usb_hcd *hcd = dev_get_drvdata(dev);
++
++	usb_hcd_pnx8550_remove(hcd, pdev);
++	return 0;
++}
++
++static int ohci_hcd_pnx8550_drv_suspend(struct device *dev, u32 state, u32 level)
++{
++//	struct platform_device *pdev = to_platform_device(dev);
++//	struct usb_hcd *hcd = dev_get_drvdata(dev);
++	printk("%s: not implemented yet\n", __FUNCTION__);
++
++	return 0;
++}
++
++static int ohci_hcd_pnx8550_drv_resume(struct device *dev, u32 state)
++{
++//	struct platform_device *pdev = to_platform_device(dev);
++//	struct usb_hcd *hcd = dev_get_drvdata(dev);
++	printk("%s: not implemented yet\n", __FUNCTION__);
++
++	return 0;
++}
++
++
++static struct device_driver ohci_hcd_pnx8550_driver = {
++	.name		= "pnx8550-ohci",
++	.bus		= &platform_bus_type,
++	.probe		= ohci_hcd_pnx8550_drv_probe,
++	.remove		= ohci_hcd_pnx8550_drv_remove,
++	.suspend	= ohci_hcd_pnx8550_drv_suspend, 
++	.resume		= ohci_hcd_pnx8550_drv_resume, 
++};
++
++static int __init ohci_hcd_pnx8550_init (void)
++{
++	pr_debug (DRIVER_INFO " (pnx8550)");
++	pr_debug ("block sizes: ed %d td %d\n",
++		sizeof (struct ed), sizeof (struct td));
++
++	return driver_register(&ohci_hcd_pnx8550_driver);
++}
++
++static void __exit ohci_hcd_pnx8550_cleanup (void)
++{
++	driver_unregister(&ohci_hcd_pnx8550_driver);
++}
++
++module_init (ohci_hcd_pnx8550_init);
++module_exit (ohci_hcd_pnx8550_cleanup);
+diff -Naur linux-2.6.16.orig/drivers/video/Kconfig linux-2.6.16/drivers/video/Kconfig
+--- linux-2.6.16.orig/drivers/video/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/video/Kconfig	2006-03-21 01:05:48.000000000 +0000
+@@ -1138,6 +1138,17 @@
+ 	  Please read the <file:Documentation/fb/README-sstfb.txt> for supported
+ 	  options and other important info  support.
+ 
++config FB_SMIVGX
++	tristate "Silicon Motion VoyagerGX support"
++	depends on FB && PCI && (MIPS || EXPERIMENTAL)
++	select FB_CFB_FILLRECT
++	select FB_CFB_COPYAREA
++	select FB_CFB_IMAGEBLIT
++	---help---
++	  This drivers supports SMI VoyagerGX 501 based PCI boards
++	  The default settings drive both a CRT and LCD.  The CRT
++	  can be turned off by passing in the no_crt option
++
+ config FB_CYBLA
+ 	tristate "Cyberblade/i1 support"
+ 	depends on FB && PCI && X86_32 && !64BIT
+@@ -1202,7 +1213,25 @@
+ 
+ config FB_AU1100
+ 	bool "Au1100 LCD Driver"
+-	depends on (FB = y) && EXPERIMENTAL && PCI && MIPS && MIPS_PB1100=y
++	depends on FB && MIPS && SOC_AU1100
++	select FB_CFB_FILLRECT
++	select FB_CFB_COPYAREA
++	select FB_CFB_IMAGEBLIT
++	help
++	  This is the framebuffer driver for the AMD Au1100 SOC.  It can drive
++	  various panels and CRTs by passing in kernel cmd line option
++	  au1100fb:panel=<name>.
++
++config FB_AU1200
++	bool "Au1200 LCD Driver"
++	depends on FB && MIPS && SOC_AU1200
++	select FB_CFB_FILLRECT
++	select FB_CFB_COPYAREA
++	select FB_CFB_IMAGEBLIT
++	help
++	  This is the framebuffer driver for the AMD Au1200 SOC.  It can drive
++	  various panels and CRTs by passing in kernel cmd line option
++	  au1200fb:panel=<name>.
+ 
+ source "drivers/video/geode/Kconfig"
+ 
+@@ -1307,8 +1336,8 @@
+  	select FB_CFB_IMAGEBLIT
+ 	help
+ 	  Support for the PMAGB-B TURBOchannel framebuffer card used mainly
+-	  in the MIPS-based DECstation series. The card is currently only
+-	  supported in 1280x1024x8 mode.
++	  in the MIPS-based DECstation series. The card is currently only 
++	  supported in 1280x1024x8 mode.  
+ 
+ config FB_MAXINE
+ 	bool "Maxine (Personal DECstation) onboard framebuffer support"
+diff -Naur linux-2.6.16.orig/drivers/video/Makefile linux-2.6.16/drivers/video/Makefile
+--- linux-2.6.16.orig/drivers/video/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/video/Makefile	2006-03-21 01:05:48.000000000 +0000
+@@ -86,6 +86,7 @@
+ obj-$(CONFIG_FB_PXA)		  += pxafb.o
+ obj-$(CONFIG_FB_W100)		  += w100fb.o
+ obj-$(CONFIG_FB_AU1100)		  += au1100fb.o
++obj-$(CONFIG_FB_AU1200)		  += au1200fb.o
+ obj-$(CONFIG_FB_PMAG_AA)	  += pmag-aa-fb.o
+ obj-$(CONFIG_FB_PMAG_BA)	  += pmag-ba-fb.o
+ obj-$(CONFIG_FB_PMAGB_B)	  += pmagb-b-fb.o
+@@ -93,6 +94,7 @@
+ obj-$(CONFIG_FB_TX3912)		  += tx3912fb.o
+ obj-$(CONFIG_FB_S1D13XXX)	  += s1d13xxxfb.o
+ obj-$(CONFIG_FB_IMX)              += imxfb.o
++obj-$(CONFIG_FB_SMIVGX)		  += smivgxfb.o
+ obj-$(CONFIG_FB_S3C2410)	  += s3c2410fb.o
+ 
+ # Platform or fallback drivers go here
+diff -Naur linux-2.6.16.orig/drivers/video/au1100fb.c linux-2.6.16/drivers/video/au1100fb.c
+--- linux-2.6.16.orig/drivers/video/au1100fb.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/video/au1100fb.c	2006-03-21 01:05:48.000000000 +0000
+@@ -38,6 +38,7 @@
+  *  with this program; if not, write  to the Free Software Foundation, Inc.,
+  *  675 Mass Ave, Cambridge, MA 02139, USA.
+  */
++
+ #include <linux/config.h>
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+diff -Naur linux-2.6.16.orig/drivers/video/au1200fb.c linux-2.6.16/drivers/video/au1200fb.c
+--- linux-2.6.16.orig/drivers/video/au1200fb.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/video/au1200fb.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,1940 @@
++/*
++ * BRIEF MODULE DESCRIPTION
++ *	Au1200 LCD Driver.
++ *
++ * Copyright 2004-2005 AMD
++ * Author: AMD
++ *
++ * Based on:
++ * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device
++ *  Created 28 Dec 1997 by Geert Uytterhoeven
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the	License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED	  ``AS	IS'' AND   ANY	EXPRESS OR IMPLIED
++ *  WARRANTIES,	  INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO	EVENT  SHALL   THE AUTHOR  BE	 LIABLE FOR ANY	  DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED	  TO, PROCUREMENT OF  SUBSTITUTE GOODS	OR SERVICES; LOSS OF
++ *  USE, DATA,	OR PROFITS; OR	BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN	 CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#include <linux/module.h>
++#include <linux/platform_device.h>
++#include <linux/kernel.h>
++#include <linux/errno.h>
++#include <linux/string.h>
++#include <linux/mm.h>
++#include <linux/fb.h>
++#include <linux/init.h>
++#include <linux/interrupt.h>
++#include <linux/ctype.h>
++#include <linux/dma-mapping.h>
++
++#include <asm/mach-au1x00/au1000.h>
++#include "au1200fb.h"
++
++#ifdef CONFIG_PM
++#include <asm/mach-au1x00/au1xxx_pm.h>
++#endif
++
++#ifndef CONFIG_FB_AU1200_DEVS
++#define CONFIG_FB_AU1200_DEVS 4
++#endif
++
++#define DRIVER_NAME "au1200fb"
++#define DRIVER_DESC "LCD controller driver for AU1200 processors"
++
++#define DEBUG 1
++
++#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
++#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg)
++#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg)
++
++#if DEBUG
++#define print_dbg(f, arg...) printk(KERN_DEBUG __FILE__ ": " f "\n", ## arg)
++#else
++#define print_dbg(f, arg...) do {} while (0)
++#endif
++
++
++#define AU1200_LCD_FB_IOCTL 0x46FF
++
++#define AU1200_LCD_SET_SCREEN 1
++#define AU1200_LCD_GET_SCREEN 2
++#define AU1200_LCD_SET_WINDOW 3
++#define AU1200_LCD_GET_WINDOW 4
++#define AU1200_LCD_SET_PANEL  5
++#define AU1200_LCD_GET_PANEL  6
++
++#define SCREEN_SIZE		    (1<< 1)
++#define SCREEN_BACKCOLOR    (1<< 2)
++#define SCREEN_BRIGHTNESS   (1<< 3)
++#define SCREEN_COLORKEY     (1<< 4)
++#define SCREEN_MASK         (1<< 5)
++typedef struct au1200_lcd_global_regs_t
++{
++    unsigned int flags;
++    unsigned int xsize;
++    unsigned int ysize;
++    unsigned int backcolor;
++    unsigned int brightness;
++	unsigned int colorkey;
++	unsigned int mask;
++    unsigned int panel_choice;
++    char panel_desc[80];
++
++} au1200_lcd_global_regs_t;
++
++#define WIN_POSITION            (1<< 0)
++#define WIN_ALPHA_COLOR         (1<< 1)
++#define WIN_ALPHA_MODE          (1<< 2)
++#define WIN_PRIORITY            (1<< 3)
++#define WIN_CHANNEL             (1<< 4)
++#define WIN_BUFFER_FORMAT       (1<< 5)
++#define WIN_COLOR_ORDER         (1<< 6)
++#define WIN_PIXEL_ORDER         (1<< 7)
++#define WIN_SIZE                (1<< 8)
++#define WIN_COLORKEY_MODE       (1<< 9)
++#define WIN_DOUBLE_BUFFER_MODE  (1<< 10)
++#define WIN_RAM_ARRAY_MODE      (1<< 11)
++#define WIN_BUFFER_SCALE        (1<< 12)
++#define WIN_ENABLE	            (1<< 13)
++
++typedef struct au1200_lcd_window_regs_t
++{
++    unsigned int flags;
++    unsigned int xpos;
++    unsigned int ypos;
++    unsigned int alpha_color;
++    unsigned int alpha_mode;
++    unsigned int priority;
++    unsigned int channel;
++    unsigned int buffer_format;
++    unsigned int color_order;
++    unsigned int pixel_order;
++    unsigned int xsize;
++    unsigned int ysize;
++    unsigned int colorkey_mode;
++    unsigned int double_buffer_mode;
++    unsigned int ram_array_mode;
++    unsigned int xscale;
++    unsigned int yscale;
++    unsigned int enable;
++} au1200_lcd_window_regs_t;
++
++
++typedef struct au1200_lcd_iodata_t
++{
++
++    unsigned int subcmd;
++    au1200_lcd_global_regs_t global;
++    au1200_lcd_window_regs_t window;
++
++} au1200_lcd_iodata_t;
++
++#if defined(__BIG_ENDIAN)
++#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11
++#else
++#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00
++#endif
++#define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565
++
++/* Private, per-framebuffer management information (independent of the panel itself) */
++struct au1200fb_device {
++	struct fb_info fb_info;			/* FB driver info record */
++
++	int					plane;
++	unsigned char* 		fb_mem;		/* FrameBuffer memory map */
++	unsigned int		fb_len;
++	dma_addr_t    		fb_phys;
++};
++
++static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];
++/********************************************************************/
++
++/* LCD controller restrictions */
++#define AU1200_LCD_MAX_XRES	1280
++#define AU1200_LCD_MAX_YRES	1024
++#define AU1200_LCD_MAX_BPP	32
++#define AU1200_LCD_MAX_CLK	96000000 /* fixme: this needs to go away ? */
++#define AU1200_LCD_NBR_PALETTE_ENTRIES 256
++
++/* Default number of visible screen buffer to allocate */
++#define AU1200FB_NBR_VIDEO_BUFFERS 1
++
++/********************************************************************/
++
++AU1200_LCD *lcd = (AU1200_LCD *)AU1200_LCD_ADDR;
++static int window_index = 2; /* default is zero */
++static int panel_index = 2; /* default is zero */
++static struct window_settings *win;
++static struct panel_settings *panel;
++static int noblanking = 1;
++static int nohwcursor = 0;
++
++struct window_settings
++{
++	unsigned char name[64];
++	uint32 mode_backcolor;
++	uint32 mode_colorkey;
++	uint32 mode_colorkeymsk;
++	struct
++	{
++		int xres;
++		int yres;
++		int xpos;
++		int ypos;
++		uint32 mode_winctrl1; /* winctrl1[FRM,CCO,PO,PIPE] */
++		uint32 mode_winenable;
++	} w[4];
++};
++
++#if defined(__BIG_ENDIAN)
++#define LCD_WINCTRL1_PO_16BPP LCD_WINCTRL1_PO_00
++#else
++#define LCD_WINCTRL1_PO_16BPP LCD_WINCTRL1_PO_01
++#endif
++
++extern int board_au1200fb_panel_init (void);
++extern int board_au1200fb_panel_shutdown (void);
++
++#ifdef CONFIG_PM
++int au1200fb_pm_callback(au1xxx_power_dev_t *dev,
++		au1xxx_request_t request, void *data);
++au1xxx_power_dev_t *LCD_pm_dev;
++#endif
++
++/*
++ * Default window configurations
++ */
++static struct window_settings windows[] =
++{
++	{ /* Index 0 */
++		"0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",
++		/* mode_backcolor	*/ 0x006600ff,
++		/* mode_colorkey,msk*/ 0, 0,
++		{
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP,
++			/* mode_winenable*/ LCD_WINENABLE_WEN0,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 100, 100, 100, 100,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP |
++				LCD_WINCTRL1_PIPE,
++			/* mode_winenable*/ LCD_WINENABLE_WEN1,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP,
++			/* mode_winenable*/ 0,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP |
++				LCD_WINCTRL1_PIPE,
++			/* mode_winenable*/ 0,
++			},
++		},
++	},
++
++	{ /* Index 1 */
++		"0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",
++		/* mode_backcolor	*/ 0x006600ff,
++		/* mode_colorkey,msk*/ 0, 0,
++		{
++			{
++			/* xres, yres, xpos, ypos */ 320, 240, 5, 5,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_24BPP |
++				LCD_WINCTRL1_PO_00,
++			/* mode_winenable*/ LCD_WINENABLE_WEN0,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565
++				| LCD_WINCTRL1_PO_16BPP,
++			/* mode_winenable*/ 0,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 100, 100, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP |
++				LCD_WINCTRL1_PIPE,
++			/* mode_winenable*/ 0/*LCD_WINENABLE_WEN2*/,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 200, 25, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP |
++				LCD_WINCTRL1_PIPE,
++			/* mode_winenable*/ 0,
++			},
++		},
++	},
++	{ /* Index 2 */
++		"0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",
++		/* mode_backcolor	*/ 0x006600ff,
++		/* mode_colorkey,msk*/ 0, 0,
++		{
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP,
++			/* mode_winenable*/ LCD_WINENABLE_WEN0,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP,
++			/* mode_winenable*/ 0,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_32BPP |
++				LCD_WINCTRL1_PO_00|LCD_WINCTRL1_PIPE,
++			/* mode_winenable*/ 0/*LCD_WINENABLE_WEN2*/,
++			},
++			{
++			/* xres, yres, xpos, ypos */ 0, 0, 0, 0,
++			/* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |
++				LCD_WINCTRL1_PO_16BPP |
++				LCD_WINCTRL1_PIPE,
++			/* mode_winenable*/ 0,
++			},
++		},
++	},
++	/* Need VGA 640 @ 24bpp, @ 32bpp */
++	/* Need VGA 800 @ 24bpp, @ 32bpp */
++	/* Need VGA 1024 @ 24bpp, @ 32bpp */
++} ;
++
++/*
++ * Controller configurations for various panels.
++ */
++
++struct panel_settings
++{
++	const char name[25];		/* Full name <vendor>_<model> */
++
++	struct 	fb_monspecs monspecs; 	/* FB monitor specs */
++
++	/* panel timings */
++	uint32 mode_screen;
++	uint32 mode_horztiming;
++	uint32 mode_verttiming;
++	uint32 mode_clkcontrol;
++	uint32 mode_pwmdiv;
++	uint32 mode_pwmhi;
++	uint32 mode_outmask;
++	uint32 mode_fifoctrl;
++	uint32 mode_toyclksrc;
++	uint32 mode_backlight;
++	uint32 mode_auxpll;
++	int (*device_init)(void);
++	int (*device_shutdown)(void);
++#define Xres min_xres
++#define Yres min_yres
++	u32	min_xres;		/* Minimum horizontal resolution */
++	u32	max_xres;		/* Maximum horizontal resolution */
++	u32 	min_yres;		/* Minimum vertical resolution */
++	u32 	max_yres;		/* Maximum vertical resolution */
++};
++
++/********************************************************************/
++/* fixme: Maybe a modedb for the CRT ? otherwise panels should be as-is */
++
++/* List of panels known to work with the AU1200 LCD controller.
++ * To add a new panel, enter the same specifications as the
++ * Generic_TFT one, and MAKE SURE that it doesn't conflicts
++ * with the controller restrictions. Restrictions are:
++ *
++ * STN color panels: max_bpp <= 12
++ * STN mono panels: max_bpp <= 4
++ * TFT panels: max_bpp <= 16
++ * max_xres <= 800
++ * max_yres <= 600
++ */
++static struct panel_settings known_lcd_panels[] =
++{
++	[0] = { /* QVGA 320x240 H:33.3kHz V:110Hz */
++		.name = "QVGA_320x240",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= LCD_SCREEN_SX_N(320) |
++			LCD_SCREEN_SY_N(240),
++		.mode_horztiming	= 0x00c4623b,
++		.mode_verttiming	= 0x00502814,
++		.mode_clkcontrol	= 0x00020002, /* /4=24Mhz */
++		.mode_pwmdiv		= 0x00000000,
++		.mode_pwmhi		= 0x00000000,
++		.mode_outmask	= 0x00FFFFFF,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= NULL,
++		.device_shutdown	= NULL,
++		320, 320,
++		240, 240,
++	},
++
++	[1] = { /* VGA 640x480 H:30.3kHz V:58Hz */
++		.name = "VGA_640x480",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= 0x13f9df80,
++		.mode_horztiming	= 0x003c5859,
++		.mode_verttiming	= 0x00741201,
++		.mode_clkcontrol	= 0x00020001, /* /4=24Mhz */
++		.mode_pwmdiv		= 0x00000000,
++		.mode_pwmhi		= 0x00000000,
++		.mode_outmask	= 0x00FFFFFF,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= NULL,
++		.device_shutdown	= NULL,
++		640, 480,
++		640, 480,
++	},
++
++	[2] = { /* SVGA 800x600 H:46.1kHz V:69Hz */
++		.name = "SVGA_800x600",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= 0x18fa5780,
++		.mode_horztiming	= 0x00dc7e77,
++		.mode_verttiming	= 0x00584805,
++		.mode_clkcontrol	= 0x00020000, /* /2=48Mhz */
++		.mode_pwmdiv		= 0x00000000,
++		.mode_pwmhi		= 0x00000000,
++		.mode_outmask	= 0x00FFFFFF,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= NULL,
++		.device_shutdown	= NULL,
++		800, 800,
++		600, 600,
++	},
++
++	[3] = { /* XVGA 1024x768 H:56.2kHz V:70Hz */
++		.name = "XVGA_1024x768",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= 0x1ffaff80,
++		.mode_horztiming	= 0x007d0e57,
++		.mode_verttiming	= 0x00740a01,
++		.mode_clkcontrol	= 0x000A0000, /* /1 */
++		.mode_pwmdiv		= 0x00000000,
++		.mode_pwmhi		= 0x00000000,
++		.mode_outmask	= 0x00FFFFFF,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 6, /* 72MHz AUXPLL */
++		.device_init		= NULL,
++		.device_shutdown	= NULL,
++		1024, 1024,
++		768, 768,
++	},
++
++	[4] = { /* XVGA XVGA 1280x1024 H:68.5kHz V:65Hz */
++		.name = "XVGA_1280x1024",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= 0x27fbff80,
++		.mode_horztiming	= 0x00cdb2c7,
++		.mode_verttiming	= 0x00600002,
++		.mode_clkcontrol	= 0x000A0000, /* /1 */
++		.mode_pwmdiv		= 0x00000000,
++		.mode_pwmhi		= 0x00000000,
++		.mode_outmask	= 0x00FFFFFF,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 10, /* 120MHz AUXPLL */
++		.device_init		= NULL,
++		.device_shutdown	= NULL,
++		1280, 1280,
++		1024, 1024,
++	},
++
++	[5] = { /* Samsung 1024x768 TFT */
++		.name = "Samsung_1024x768_TFT",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= 0x1ffaff80,
++		.mode_horztiming	= 0x018cc677,
++		.mode_verttiming	= 0x00241217,
++		.mode_clkcontrol	= 0x00000000, /* SCB 0x1 /4=24Mhz */
++		.mode_pwmdiv		= 0x8000063f, /* SCB 0x0 */
++		.mode_pwmhi		= 0x03400000, /* SCB 0x0 */
++		.mode_outmask	= 0x00FFFFFF,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= board_au1200fb_panel_init,
++		.device_shutdown	= board_au1200fb_panel_shutdown,
++		1024, 1024,
++		768, 768,
++	},
++
++	[6] = { /* Toshiba 640x480 TFT */
++		.name = "Toshiba_640x480_TFT",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= LCD_SCREEN_SX_N(640) |
++			LCD_SCREEN_SY_N(480),
++		.mode_horztiming	= LCD_HORZTIMING_HPW_N(96) |
++			LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(51),
++		.mode_verttiming	= LCD_VERTTIMING_VPW_N(2) |
++			LCD_VERTTIMING_VND1_N(11) | LCD_VERTTIMING_VND2_N(32),
++		.mode_clkcontrol	= 0x00000000, /* /4=24Mhz */
++		.mode_pwmdiv		= 0x8000063f,
++		.mode_pwmhi		= 0x03400000,
++		.mode_outmask	= 0x00fcfcfc,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= board_au1200fb_panel_init,
++		.device_shutdown	= board_au1200fb_panel_shutdown,
++		640, 480,
++		640, 480,
++	},
++
++	[7] = { /* Sharp 320x240 TFT */
++		.name = "Sharp_320x240_TFT",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 12500,
++			.hfmax = 20000,
++			.vfmin = 38,
++			.vfmax = 81,
++			.dclkmin = 4500000,
++			.dclkmax = 6800000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= LCD_SCREEN_SX_N(320) |
++			LCD_SCREEN_SY_N(240),
++		.mode_horztiming	= LCD_HORZTIMING_HPW_N(60) |
++			LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(2),
++		.mode_verttiming	= LCD_VERTTIMING_VPW_N(2) |
++			LCD_VERTTIMING_VND1_N(2) | LCD_VERTTIMING_VND2_N(5),
++		.mode_clkcontrol	= LCD_CLKCONTROL_PCD_N(7), /*16=6Mhz*/
++		.mode_pwmdiv		= 0x8000063f,
++		.mode_pwmhi		= 0x03400000,
++		.mode_outmask	= 0x00fcfcfc,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= board_au1200fb_panel_init,
++		.device_shutdown	= board_au1200fb_panel_shutdown,
++		320, 320,
++		240, 240,
++	},
++
++	[8] = { /* Toppoly TD070WGCB2 7" 856x480 TFT */
++		.name = "Toppoly_TD070WGCB2",
++		.monspecs = {
++			.modedb = NULL,
++			.modedb_len = 0,
++			.hfmin = 30000,
++			.hfmax = 70000,
++			.vfmin = 60,
++			.vfmax = 60,
++			.dclkmin = 6000000,
++			.dclkmax = 28000000,
++			.input = FB_DISP_RGB,
++		},
++		.mode_screen		= LCD_SCREEN_SX_N(856) |
++			LCD_SCREEN_SY_N(480),
++		.mode_horztiming	= LCD_HORZTIMING_HND2_N(43) |
++			LCD_HORZTIMING_HND1_N(43) | LCD_HORZTIMING_HPW_N(114),
++		.mode_verttiming	= LCD_VERTTIMING_VND2_N(20) |
++			LCD_VERTTIMING_VND1_N(21) | LCD_VERTTIMING_VPW_N(4),
++		.mode_clkcontrol	= 0x00020001, /* /4=24Mhz */
++		.mode_pwmdiv		= 0x8000063f,
++		.mode_pwmhi		= 0x03400000,
++		.mode_outmask	= 0x00fcfcfc,
++		.mode_fifoctrl	= 0x2f2f2f2f,
++		.mode_toyclksrc	= 0x00000004, /* AUXPLL directly */
++		.mode_backlight	= 0x00000000,
++		.mode_auxpll		= 8, /* 96MHz AUXPLL */
++		.device_init		= board_au1200fb_panel_init,
++		.device_shutdown	= board_au1200fb_panel_shutdown,
++		856, 856,
++		480, 480,
++	},
++};
++
++#define NUM_PANELS (sizeof(known_lcd_panels) / sizeof(struct panel_settings))
++
++/********************************************************************/
++
++static int set_brightness(unsigned int brightness)
++{
++	unsigned int hi1, divider;
++
++	/* limit brightness pwm duty to >= 30/1600 */
++	if (brightness < 30) {
++		brightness = 30;
++	}
++	divider = (lcd->pwmdiv & 0x3FFFF) + 1;
++	hi1 = (lcd->pwmhi >> 16) + 1;
++	hi1 = (((brightness & 0xFF)+1) * divider >> 8);
++	lcd->pwmhi &= 0xFFFF;
++	lcd->pwmhi |= (hi1 << 16);
++
++	return brightness;
++}
++
++static int
++winbpp (unsigned int winctrl1)
++{
++	/* how many bits are needed for each pixel format */
++	switch (winctrl1 & LCD_WINCTRL1_FRM)
++	{
++		case LCD_WINCTRL1_FRM_1BPP: return 1; break;
++		case LCD_WINCTRL1_FRM_2BPP: return 2; break;
++		case LCD_WINCTRL1_FRM_4BPP: return 4; break;
++		case LCD_WINCTRL1_FRM_8BPP: return 8; break;
++		case LCD_WINCTRL1_FRM_12BPP: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPP655: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPP565: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPP556: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPPI1555: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPPI5551: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPPA1555: return 16; break;
++		case LCD_WINCTRL1_FRM_16BPPA5551: return 16; break;
++		case LCD_WINCTRL1_FRM_24BPP: return 32; break;
++		case LCD_WINCTRL1_FRM_32BPP: return 32; break;
++		default: return 0; break;
++	}
++}
++
++static int
++fbinfo2index (struct fb_info *fb_info)
++{
++	int i;
++	for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i)
++	{
++		if (fb_info == (struct fb_info *)(&_au1200fb_devices[i].fb_info))
++			return i;
++	}
++	printk("au1200fb: ERROR: fbinfo2index failed!\n");
++	return -1;
++}
++
++static int au1200_setlocation (struct au1200fb_device *fbdev, int plane, int xpos, int ypos)
++{
++	uint32 winctrl0, winctrl1, winenable, fb_offset = 0;
++	int xsz, ysz;
++
++	/* FIX!!! NOT CHECKING FOR COMPLETE OFFSCREEN YET */
++
++	winctrl0 = lcd->window[plane].winctrl0;
++	winctrl1 = lcd->window[plane].winctrl1;
++	winctrl0 &= (LCD_WINCTRL0_A | LCD_WINCTRL0_AEN);
++	winctrl1 &= ~(LCD_WINCTRL1_SZX | LCD_WINCTRL1_SZY);
++
++	/* Check for off-screen adjustments */
++	xsz = win->w[plane].xres;
++	ysz = win->w[plane].yres;
++	if ((xpos + win->w[plane].xres) > panel->Xres)
++	{
++		/* Off-screen to the right */
++		xsz = panel->Xres - xpos; /* off by 1 ??? */
++		/*printk("off screen right\n");*/
++	}
++
++	if ((ypos + win->w[plane].yres) > panel->Yres)
++	{
++		/* Off-screen to the bottom */
++		ysz = panel->Yres - ypos; /* off by 1 ??? */
++		/*printk("off screen bottom\n");*/
++	}
++
++	if (xpos < 0)
++	{
++		/* Off-screen to the left */
++		xsz = win->w[plane].xres + xpos;
++		fb_offset += (((0 - xpos) * winbpp(lcd->window[plane].winctrl1))/8);
++		xpos = 0;
++		/*printk("off screen left\n");*/
++	}
++
++	if (ypos < 0)
++	{
++		/* Off-screen to the top */
++		ysz = win->w[plane].yres + ypos;
++		/* fixme: fb_offset += ((0-ypos)*fb_pars[plane].line_length); */
++		ypos = 0;
++		/*printk("off screen top\n");*/
++	}
++
++	/* record settings */
++	win->w[plane].xpos = xpos;
++	win->w[plane].ypos = ypos;
++
++	xsz -= 1;
++	ysz -= 1;
++	winctrl0 |= (xpos << 21);
++	winctrl0 |= (ypos << 10);
++	winctrl1 |= (xsz << 11);
++	winctrl1 |= (ysz << 0);
++
++	/* Disable the window while making changes, then restore WINEN */
++	winenable = lcd->winenable & (1 << plane);
++	au_sync();
++	lcd->winenable &= ~(1 << plane);
++	lcd->window[plane].winctrl0 = winctrl0;
++	lcd->window[plane].winctrl1 = winctrl1;
++	lcd->window[plane].winbuf0 =
++	lcd->window[plane].winbuf1 = fbdev->fb_phys;
++	lcd->window[plane].winbufctrl = 0; /* select winbuf0 */
++	lcd->winenable |= winenable;
++	au_sync();
++
++	return 0;
++}
++
++static void au1200_setpanel (struct panel_settings *newpanel)
++{
++	/*
++	 * Perform global setup/init of LCD controller
++	 */
++	uint32 winenable;
++
++	/* Make sure all windows disabled */
++	winenable = lcd->winenable;
++	lcd->winenable = 0;
++	au_sync();
++	/*
++	 * Ensure everything is disabled before reconfiguring
++	 */
++	if (lcd->screen & LCD_SCREEN_SEN)
++	{
++		/* Wait for vertical sync period */
++		lcd->intstatus = LCD_INT_SS;
++		while ((lcd->intstatus & LCD_INT_SS) == 0) {
++			au_sync();
++		}
++
++		lcd->screen &= ~LCD_SCREEN_SEN;	/*disable the controller*/
++
++		do
++		{
++			lcd->intstatus = lcd->intstatus; /*clear interrupts*/
++			au_sync();
++		}
++		/*wait for controller to shut down*/
++		while ((lcd->intstatus & LCD_INT_SD) == 0);
++
++		/* Call shutdown of current panel (if up) */
++		/* this must occur last, because if an external clock is driving
++		    the controller, the clock cannot be turned off before first
++			shutting down the controller.
++		 */
++		if (panel->device_shutdown != NULL) panel->device_shutdown();
++	}
++
++	/* Newpanel == NULL indicates a shutdown operation only */
++	if (newpanel == NULL)
++		return;
++
++	panel = newpanel;
++
++	printk("Panel(%s), %dx%d\n", panel->name, panel->Xres, panel->Yres);
++
++	/*
++	 * Setup clocking if internal LCD clock source (assumes sys_auxpll valid)
++	 */
++	if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT))
++	{
++		uint32 sys_clksrc;
++		au_writel(panel->mode_auxpll, SYS_AUXPLL);
++		sys_clksrc = au_readl(SYS_CLKSRC) & ~0x0000001f;
++		sys_clksrc |= panel->mode_toyclksrc;
++		au_writel(sys_clksrc, SYS_CLKSRC);
++	}
++
++	/*
++	 * Configure panel timings
++	 */
++	lcd->screen = panel->mode_screen;
++	lcd->horztiming = panel->mode_horztiming;
++	lcd->verttiming = panel->mode_verttiming;
++	lcd->clkcontrol = panel->mode_clkcontrol;
++	lcd->pwmdiv = panel->mode_pwmdiv;
++	lcd->pwmhi = panel->mode_pwmhi;
++	lcd->outmask = panel->mode_outmask;
++	lcd->fifoctrl = panel->mode_fifoctrl;
++	au_sync();
++
++	/* fixme: Check window settings to make sure still valid
++	 * for new geometry */
++#if 0
++	au1200_setlocation(fbdev, 0, win->w[0].xpos, win->w[0].ypos);
++	au1200_setlocation(fbdev, 1, win->w[1].xpos, win->w[1].ypos);
++	au1200_setlocation(fbdev, 2, win->w[2].xpos, win->w[2].ypos);
++	au1200_setlocation(fbdev, 3, win->w[3].xpos, win->w[3].ypos);
++#endif
++	lcd->winenable = winenable;
++
++	/*
++	 * Re-enable screen now that it is configured
++	 */
++	lcd->screen |= LCD_SCREEN_SEN;
++	au_sync();
++
++	/* Call init of panel */
++	if (panel->device_init != NULL) panel->device_init();
++
++	/* FIX!!!! not appropriate on panel change!!! Global setup/init */
++	lcd->intenable = 0;
++	lcd->intstatus = ~0;
++	lcd->backcolor = win->mode_backcolor;
++
++	/* Setup Color Key - FIX!!! */
++	lcd->colorkey = win->mode_colorkey;
++	lcd->colorkeymsk = win->mode_colorkeymsk;
++
++	/* Setup HWCursor - FIX!!! Need to support this eventually */
++	lcd->hwc.cursorctrl = 0;
++	lcd->hwc.cursorpos = 0;
++	lcd->hwc.cursorcolor0 = 0;
++	lcd->hwc.cursorcolor1 = 0;
++	lcd->hwc.cursorcolor2 = 0;
++	lcd->hwc.cursorcolor3 = 0;
++
++
++#if 0
++#define D(X) printk("%25s: %08X\n", #X, X)
++	D(lcd->screen);
++	D(lcd->horztiming);
++	D(lcd->verttiming);
++	D(lcd->clkcontrol);
++	D(lcd->pwmdiv);
++	D(lcd->pwmhi);
++	D(lcd->outmask);
++	D(lcd->fifoctrl);
++	D(lcd->window[0].winctrl0);
++	D(lcd->window[0].winctrl1);
++	D(lcd->window[0].winctrl2);
++	D(lcd->window[0].winbuf0);
++	D(lcd->window[0].winbuf1);
++	D(lcd->window[0].winbufctrl);
++	D(lcd->window[1].winctrl0);
++	D(lcd->window[1].winctrl1);
++	D(lcd->window[1].winctrl2);
++	D(lcd->window[1].winbuf0);
++	D(lcd->window[1].winbuf1);
++	D(lcd->window[1].winbufctrl);
++	D(lcd->window[2].winctrl0);
++	D(lcd->window[2].winctrl1);
++	D(lcd->window[2].winctrl2);
++	D(lcd->window[2].winbuf0);
++	D(lcd->window[2].winbuf1);
++	D(lcd->window[2].winbufctrl);
++	D(lcd->window[3].winctrl0);
++	D(lcd->window[3].winctrl1);
++	D(lcd->window[3].winctrl2);
++	D(lcd->window[3].winbuf0);
++	D(lcd->window[3].winbuf1);
++	D(lcd->window[3].winbufctrl);
++	D(lcd->winenable);
++	D(lcd->intenable);
++	D(lcd->intstatus);
++	D(lcd->backcolor);
++	D(lcd->winenable);
++	D(lcd->colorkey);
++    D(lcd->colorkeymsk);
++	D(lcd->hwc.cursorctrl);
++	D(lcd->hwc.cursorpos);
++	D(lcd->hwc.cursorcolor0);
++	D(lcd->hwc.cursorcolor1);
++	D(lcd->hwc.cursorcolor2);
++	D(lcd->hwc.cursorcolor3);
++#endif
++}
++
++static void au1200_setmode(struct au1200fb_device *fbdev)
++{
++	int plane = fbdev->plane;
++	/* Window/plane setup */
++	lcd->window[plane].winctrl1 = ( 0
++		| LCD_WINCTRL1_PRI_N(plane)
++		| win->w[plane].mode_winctrl1 /* FRM,CCO,PO,PIPE */
++		) ;
++
++	au1200_setlocation(fbdev, plane, win->w[plane].xpos, win->w[plane].ypos);
++
++	lcd->window[plane].winctrl2 = ( 0
++		| LCD_WINCTRL2_CKMODE_00
++		| LCD_WINCTRL2_DBM
++		| LCD_WINCTRL2_BX_N( fbdev->fb_info.fix.line_length)
++		| LCD_WINCTRL2_SCX_1
++		| LCD_WINCTRL2_SCY_1
++		) ;
++	lcd->winenable |= win->w[plane].mode_winenable;
++	au_sync();
++}
++
++
++/* Inline helpers */
++
++/*#define panel_is_dual(panel)  ((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/
++/*#define panel_is_active(panel)((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/
++
++#define panel_is_color(panel) ((panel->mode_screen & LCD_SCREEN_PT) <= LCD_SCREEN_PT_CDSTN)
++
++/* Bitfields format supported by the controller. */
++struct fb_bitfield rgb_bitfields[][4] =
++{
++  	/*     Red, 	   Green, 	 Blue, 	     Transp   */
++	[LCD_WINCTRL1_FRM_16BPP655 >> 25] =
++		{ { 10, 6, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },
++
++	[LCD_WINCTRL1_FRM_16BPP565 >> 25] =
++		{ { 11, 5, 0 }, { 5, 6, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },
++
++	[LCD_WINCTRL1_FRM_16BPP556 >> 25] =
++		{ { 11, 5, 0 }, { 6, 5, 0 }, { 0, 6, 0 }, { 0, 0, 0 } },
++
++	[LCD_WINCTRL1_FRM_16BPPI1555 >> 25] =
++		{ { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },
++
++	[LCD_WINCTRL1_FRM_16BPPI5551 >> 25] =
++		{ { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 0, 0 } },
++
++	[LCD_WINCTRL1_FRM_16BPPA1555 >> 25] =
++		{ { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 15, 1, 0 } },
++
++	[LCD_WINCTRL1_FRM_16BPPA5551 >> 25] =
++		{ { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 1, 0 } },
++
++	[LCD_WINCTRL1_FRM_24BPP >> 25] =
++		{ { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 0, 0, 0 } },
++
++	[LCD_WINCTRL1_FRM_32BPP >> 25] =
++		{ { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 24, 0, 0 } },
++};
++
++/*-------------------------------------------------------------------------*/
++
++/* Helpers */
++
++static void
++au1200fb_update_fbinfo(struct fb_info *fbi)
++{
++	/* FIX!!!! This also needs to take the window pixel format into account!!! */
++
++	/* Update var-dependent FB info */
++	if (panel_is_color(panel)) {
++		if (fbi->var.bits_per_pixel <= 8) {
++			/* palettized */
++			fbi->fix.visual = FB_VISUAL_PSEUDOCOLOR;
++			fbi->fix.line_length = fbi->var.xres_virtual /
++				(8/fbi->var.bits_per_pixel);
++		} else {
++			/* non-palettized */
++			fbi->fix.visual = FB_VISUAL_TRUECOLOR;
++			fbi->fix.line_length = fbi->var.xres_virtual * (fbi->var.bits_per_pixel / 8);
++		}
++	} else {
++		/* mono FIX!!! mono 8 and 4 bits */
++		fbi->fix.visual = FB_VISUAL_MONO10;
++		fbi->fix.line_length = fbi->var.xres_virtual / 8;
++	}
++
++	fbi->screen_size = fbi->fix.line_length * fbi->var.yres_virtual;
++	print_dbg("line length: %d\n", fbi->fix.line_length);
++	print_dbg("bits_per_pixel: %d\n", fbi->var.bits_per_pixel);
++}
++
++/*-------------------------------------------------------------------------*/
++
++/* AU1200 framebuffer driver */
++
++int au1200fb_fb_open(struct fb_info *fbi, int user)
++{
++	return 0;
++}
++
++int au1200fb_fb_release(struct fb_info *fbi, int user)
++{
++	return 0;
++}
++
++/* fb_check_var
++ * Validate var settings with hardware restrictions and modify it if necessary
++ */
++int au1200fb_fb_check_var(struct fb_var_screeninfo *var, struct fb_info *fbi)
++{
++	struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;
++	u32 pixclock;
++	int screen_size, plane;
++
++	plane = fbdev->plane;
++
++	/* Make sure that the mode respect all LCD controller and
++	 * panel restrictions. */
++	var->xres = win->w[plane].xres;
++	var->yres = win->w[plane].yres;
++
++	/* No need for virtual resolution support */
++	var->xres_virtual = var->xres;
++	var->yres_virtual = var->yres;
++
++	var->bits_per_pixel = winbpp(win->w[plane].mode_winctrl1);
++
++	screen_size = var->xres_virtual * var->yres_virtual;
++	if (var->bits_per_pixel > 8) screen_size *= (var->bits_per_pixel / 8);
++	else screen_size /= (8/var->bits_per_pixel);
++
++	if (fbdev->fb_len < screen_size)
++		return -EINVAL; /* Virtual screen is to big, abort */
++
++	/* FIX!!!! what are the implicaitons of ignoring this for windows ??? */
++	/* The max LCD clock is fixed to 48MHz (value of AUX_CLK). The pixel
++	 * clock can only be obtain by dividing this value by an even integer.
++	 * Fallback to a slower pixel clock if necessary. */
++	pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin);
++	pixclock = min(pixclock, min(fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2));
++
++	if (AU1200_LCD_MAX_CLK % pixclock) {
++		int diff = AU1200_LCD_MAX_CLK % pixclock;
++		pixclock -= diff;
++	}
++
++	var->pixclock = KHZ2PICOS(pixclock/1000);
++#if 0
++	if (!panel_is_active(panel)) {
++		int pcd = AU1200_LCD_MAX_CLK / (pixclock * 2) - 1;
++
++		if (!panel_is_color(panel)
++			&& (panel->control_base & LCD_CONTROL_MPI) && (pcd < 3)) {
++			/* STN 8bit mono panel support is up to 6MHz pixclock */
++			var->pixclock = KHZ2PICOS(6000);
++		} else if (!pcd) {
++			/* Other STN panel support is up to 12MHz  */
++			var->pixclock = KHZ2PICOS(12000);
++		}
++	}
++#endif
++	/* Set bitfield accordingly */
++	switch (var->bits_per_pixel) {
++		case 16:
++		{
++			/* 16bpp True color.
++			 * These must be set to MATCH WINCTRL[FORM] */
++			int idx;
++			idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25;
++			var->red    = rgb_bitfields[idx][0];
++			var->green  = rgb_bitfields[idx][1];
++			var->blue   = rgb_bitfields[idx][2];
++			var->transp = rgb_bitfields[idx][3];
++			break;
++		}
++
++		case 32:
++		{
++			/* 32bpp True color.
++			 * These must be set to MATCH WINCTRL[FORM] */
++			int idx;
++			idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25;
++			var->red    = rgb_bitfields[idx][0];
++			var->green  = rgb_bitfields[idx][1];
++			var->blue   = rgb_bitfields[idx][2];
++			var->transp = rgb_bitfields[idx][3];
++			break;
++		}
++		default:
++			print_dbg("Unsupported depth %dbpp", var->bits_per_pixel);
++			return -EINVAL;
++	}
++
++	return 0;
++}
++
++/* fb_set_par
++ * Set hardware with var settings. This will enable the controller with a
++ * specific mode, normally validated with the fb_check_var method
++ */
++int au1200fb_fb_set_par(struct fb_info *fbi)
++{
++	struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;
++
++	au1200fb_update_fbinfo(fbi);
++	au1200_setmode(fbdev);
++
++	return 0;
++}
++
++/* fb_setcolreg
++ * Set color in LCD palette.
++ */
++int au1200fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue, unsigned transp, struct fb_info *fbi)
++{
++	u32 *palette = lcd->palette;
++	u32 value;
++
++	if (regno > (AU1200_LCD_NBR_PALETTE_ENTRIES - 1))
++		return -EINVAL;
++
++	if (fbi->var.grayscale) {
++		/* Convert color to grayscale */
++		red = green = blue =
++			(19595 * red + 38470 * green + 7471 * blue) >> 16;
++	}
++
++	if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) {
++		/* Place color in the pseudopalette */
++		if (regno > 16)
++			return -EINVAL;
++
++		palette = (u32*)fbi->pseudo_palette;
++
++		red   >>= (16 - fbi->var.red.length);
++		green >>= (16 - fbi->var.green.length);
++		blue  >>= (16 - fbi->var.blue.length);
++
++		value = (red   << fbi->var.red.offset) 	|
++			(green << fbi->var.green.offset)|
++			(blue  << fbi->var.blue.offset);
++		value &= 0xFFFF;
++
++	} else if (1 /*FIX!!! panel_is_active(fbdev->panel)*/) {
++		/* COLOR TFT PALLETTIZED (use RGB 565) */
++		value = (red & 0xF800)|((green >> 5) &
++				0x07E0)|((blue >> 11) & 0x001F);
++		value &= 0xFFFF;
++
++	} else if (0 /*panel_is_color(fbdev->panel)*/) {
++		/* COLOR STN MODE */
++		value = 0x1234;
++		value &= 0xFFF;
++	} else {
++		/* MONOCHROME MODE */
++		value = (green >> 12) & 0x000F;
++		value &= 0xF;
++	}
++
++	palette[regno] = value;
++
++	return 0;
++}
++
++/* fb_blank
++ * Blank the screen. Depending on the mode, the screen will be
++ * activated with the backlight color, or desactivated
++ */
++int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi)
++{
++	/* Short-circuit screen blanking */
++	if (noblanking)
++		return 0;
++
++	switch (blank_mode) {
++
++	case VESA_NO_BLANKING:
++		/* printk("turn on panel\n"); */
++		au1200_setpanel(panel);
++		break;
++
++	case VESA_VSYNC_SUSPEND:
++	case VESA_HSYNC_SUSPEND:
++	case VESA_POWERDOWN:
++		/* printk("turn off panel\n"); */
++		au1200_setpanel(NULL);
++		break;
++	default:
++		break;
++
++	}
++	return 0;
++}
++
++/* fb_mmap
++ * Map video memory in user space. We don't use the generic fb_mmap
++ * method mainly to allow the use of the TLB streaming flag (CCA=6)
++ */
++int au1200fb_fb_mmap(struct fb_info *fbi, struct file *file, struct vm_area_struct *vma)
++{
++	unsigned int len;
++	unsigned long start=0, off;
++	struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;
++
++#ifdef CONFIG_PM
++	au1xxx_pm_access(LCD_pm_dev);
++#endif
++
++	if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {
++		return -EINVAL;
++	}
++
++	start = fbdev->fb_phys & PAGE_MASK;
++	len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len);
++
++	off = vma->vm_pgoff << PAGE_SHIFT;
++
++	if ((vma->vm_end - vma->vm_start + off) > len) {
++		return -EINVAL;
++	}
++
++	off += start;
++	vma->vm_pgoff = off >> PAGE_SHIFT;
++
++	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
++	pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */
++
++	vma->vm_flags |= VM_IO;
++
++	return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,
++				  vma->vm_end - vma->vm_start,
++				  vma->vm_page_prot);
++
++	return 0;
++}
++
++void set_global(u_int cmd, au1200_lcd_global_regs_t *pdata) {
++
++	unsigned int hi1, divider;
++
++	/* SCREEN_SIZE: user cannot reset size, must switch panel choice */
++
++	if (pdata->flags & SCREEN_BACKCOLOR)
++		lcd->backcolor = pdata->backcolor;
++
++	if (pdata->flags & SCREEN_BRIGHTNESS) {
++
++		// limit brightness pwm duty to >= 30/1600
++		if (pdata->brightness < 30) {
++			pdata->brightness = 30;
++		}
++		divider = (lcd->pwmdiv & 0x3FFFF) + 1;
++		hi1 = (lcd->pwmhi >> 16) + 1;
++		hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8);
++		lcd->pwmhi &= 0xFFFF;
++		lcd->pwmhi |= (hi1 << 16);
++	}
++
++	if (pdata->flags & SCREEN_COLORKEY)
++		lcd->colorkey = pdata->colorkey;
++
++	if (pdata->flags & SCREEN_MASK)
++		lcd->colorkeymsk = pdata->mask;
++	au_sync();
++}
++
++void get_global(u_int cmd, au1200_lcd_global_regs_t *pdata) {
++	unsigned int hi1, divider;
++
++	pdata->xsize = ((lcd->screen & LCD_SCREEN_SX) >> 19) + 1;
++	pdata->ysize = ((lcd->screen & LCD_SCREEN_SY) >> 8) + 1;
++
++	pdata->backcolor = lcd->backcolor;
++	pdata->colorkey = lcd->colorkey;
++	pdata->mask = lcd->colorkeymsk;
++
++	// brightness
++	hi1 = (lcd->pwmhi >> 16) + 1;
++	divider = (lcd->pwmdiv & 0x3FFFF) + 1;
++	pdata->brightness = ((hi1 << 8) / divider) - 1;
++	au_sync();
++}
++
++void print_global(au1200_lcd_global_regs_t *pdata) {
++
++	printk("pdata->xsize %x\n", pdata->xsize);
++	printk("pdata->ysize %x\n", pdata->ysize);
++	printk("pdata->backcolor %x\n", pdata->backcolor);
++	printk("pdata->brightness %x\n", pdata->brightness);
++	printk("pdata->colorkey %x\n", pdata->colorkey);
++	printk("pdata->mask %x\n", pdata->mask);
++}
++
++void set_window(unsigned int plane, au1200_lcd_window_regs_t *pdata) {
++
++	unsigned int val, bpp;
++
++	/* Window control register 0 */
++	if (pdata->flags & WIN_POSITION) {
++		val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_OX |
++				LCD_WINCTRL0_OY);
++		val |= ((pdata->xpos << 21) & LCD_WINCTRL0_OX);
++		val |= ((pdata->ypos << 10) & LCD_WINCTRL0_OY);
++		lcd->window[plane].winctrl0 = val;
++	}
++	if (pdata->flags & WIN_ALPHA_COLOR) {
++		val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_A);
++		val |= ((pdata->alpha_color << 2) & LCD_WINCTRL0_A);
++		lcd->window[plane].winctrl0 = val;
++	}
++	if (pdata->flags & WIN_ALPHA_MODE) {
++		val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_AEN);
++		val |= ((pdata->alpha_mode << 1) & LCD_WINCTRL0_AEN);
++		lcd->window[plane].winctrl0 = val;
++	}
++
++	/* Window control register 1 */
++	if (pdata->flags & WIN_PRIORITY) {
++		val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PRI);
++		val |= ((pdata->priority << 30) & LCD_WINCTRL1_PRI);
++		lcd->window[plane].winctrl1 = val;
++	}
++	if (pdata->flags & WIN_CHANNEL) {
++		val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PIPE);
++		val |= ((pdata->channel << 29) & LCD_WINCTRL1_PIPE);
++		lcd->window[plane].winctrl1 = val;
++	}
++	if (pdata->flags & WIN_BUFFER_FORMAT) {
++		val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_FRM);
++		val |= ((pdata->buffer_format << 25) & LCD_WINCTRL1_FRM);
++		lcd->window[plane].winctrl1 = val;
++	}
++	if (pdata->flags & WIN_COLOR_ORDER) {
++		val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_CCO);
++		val |= ((pdata->color_order << 24) & LCD_WINCTRL1_CCO);
++		lcd->window[plane].winctrl1 = val;
++	}
++	if (pdata->flags & WIN_PIXEL_ORDER) {
++		val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PO);
++		val |= ((pdata->pixel_order << 22) & LCD_WINCTRL1_PO);
++		lcd->window[plane].winctrl1 = val;
++	}
++	if (pdata->flags & WIN_SIZE) {
++		val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_SZX |
++				LCD_WINCTRL1_SZY);
++		val |= (((pdata->xsize << 11) - 1) & LCD_WINCTRL1_SZX);
++		val |= (((pdata->ysize) - 1) & LCD_WINCTRL1_SZY);
++		lcd->window[plane].winctrl1 = val;
++		/* program buffer line width */
++		bpp = winbpp(val) / 8;
++		val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_BX);
++		val |= (((pdata->xsize * bpp) << 8) & LCD_WINCTRL2_BX);
++		lcd->window[plane].winctrl2 = val;
++	}
++
++	/* Window control register 2 */
++	if (pdata->flags & WIN_COLORKEY_MODE) {
++		val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_CKMODE);
++		val |= ((pdata->colorkey_mode << 24) & LCD_WINCTRL2_CKMODE);
++		lcd->window[plane].winctrl2 = val;
++	}
++	if (pdata->flags & WIN_DOUBLE_BUFFER_MODE) {
++		val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_DBM);
++		val |= ((pdata->double_buffer_mode << 23) & LCD_WINCTRL2_DBM);
++		lcd->window[plane].winctrl2 = val;
++	}
++	if (pdata->flags & WIN_RAM_ARRAY_MODE) {
++		val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_RAM);
++		val |= ((pdata->ram_array_mode << 21) & LCD_WINCTRL2_RAM);
++		lcd->window[plane].winctrl2 = val;
++	}
++
++	/* Buffer line width programmed with WIN_SIZE */
++
++	if (pdata->flags & WIN_BUFFER_SCALE) {
++		val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_SCX |
++				LCD_WINCTRL2_SCY);
++		val |= ((pdata->xsize << 11) & LCD_WINCTRL2_SCX);
++		val |= ((pdata->ysize) & LCD_WINCTRL2_SCY);
++		lcd->window[plane].winctrl2 = val;
++	}
++
++	if (pdata->flags & WIN_ENABLE) {
++		val = lcd->winenable;
++		val &= ~(1<<plane);
++		val |= (pdata->enable & 1) << plane;
++		lcd->winenable = val;
++	}
++	au_sync();
++}
++
++void get_window(unsigned int plane, au1200_lcd_window_regs_t *pdata) {
++
++	/* Window control register 0 */
++	pdata->xpos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OX) >> 21;
++	pdata->ypos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OY) >> 10;
++	pdata->alpha_color = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_A) >> 2;
++	pdata->alpha_mode = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_AEN) >> 1;
++
++	/* Window control register 1 */
++	pdata->priority = (lcd->window[plane].winctrl1& LCD_WINCTRL1_PRI) >> 30;
++	pdata->channel = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PIPE) >> 29;
++	pdata->buffer_format = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_FRM) >> 25;
++	pdata->color_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_CCO) >> 24;
++	pdata->pixel_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PO) >> 22;
++	pdata->xsize = ((lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZX) >> 11) + 1;
++	pdata->ysize = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZY) + 1;
++
++	/* Window control register 2 */
++	pdata->colorkey_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_CKMODE) >> 24;
++	pdata->double_buffer_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_DBM) >> 23;
++	pdata->ram_array_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_RAM) >> 21;
++
++	pdata->enable = (lcd->winenable >> plane) & 1;
++	au_sync();
++}
++
++static int au1200fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
++			  u_long arg, struct fb_info *info)
++{
++	int plane;
++	int val;
++
++#ifdef CONFIG_PM
++	au1xxx_pm_access(LCD_pm_dev);
++#endif
++
++	plane = fbinfo2index(info);
++	print_dbg("au1200fb: ioctl %d on plane %d\n", cmd, plane);
++
++	if (cmd == AU1200_LCD_FB_IOCTL) {
++		au1200_lcd_iodata_t iodata;
++
++		if (copy_from_user(&iodata, (void *) arg, sizeof(au1200_lcd_iodata_t)))
++			return -EFAULT;
++
++		print_dbg("FB IOCTL called\n");
++
++		switch (iodata.subcmd)
++		{
++
++		case AU1200_LCD_SET_SCREEN:
++			print_dbg("AU1200_LCD_SET_SCREEN\n");
++			set_global(cmd, &iodata.global);
++			break;
++
++		case AU1200_LCD_GET_SCREEN:
++			print_dbg("AU1200_LCD_GET_SCREEN\n");
++			get_global(cmd, &iodata.global);
++			break;
++
++		case AU1200_LCD_SET_WINDOW:
++			print_dbg("AU1200_LCD_SET_WINDOW\n");
++			set_window(plane, &iodata.window);
++			break;
++
++		case AU1200_LCD_GET_WINDOW:
++			print_dbg("AU1200_LCD_GET_WINDOW\n");
++			get_window(plane, &iodata.window);
++			break;
++
++		case AU1200_LCD_SET_PANEL:
++			print_dbg("AU1200_LCD_SET_PANEL\n");
++			if ((iodata.global.panel_choice >= 0) &&
++					(iodata.global.panel_choice <
++					 NUM_PANELS))
++			{
++				struct panel_settings *newpanel;
++				panel_index = iodata.global.panel_choice;
++				newpanel = &known_lcd_panels[panel_index];
++				au1200_setpanel(newpanel);
++			}
++			break;
++
++		case AU1200_LCD_GET_PANEL:
++			print_dbg("AU1200_LCD_GET_PANEL\n");
++			iodata.global.panel_choice = panel_index;
++			break;
++
++		default:
++			return -EINVAL;
++		}
++
++		val = copy_to_user((void *) arg, &iodata, sizeof(au1200_lcd_iodata_t));
++		if (val) {
++			print_dbg("error: could not copy %d bytes\n", val);
++			return -EFAULT;
++		}
++	}
++
++return 0;
++}
++
++
++static struct fb_ops au1200fb_fb_ops =
++{
++	.owner			= THIS_MODULE,
++	.fb_open		= au1200fb_fb_open,
++	.fb_release		= au1200fb_fb_release,
++	.fb_check_var	= au1200fb_fb_check_var,
++	.fb_set_par		= au1200fb_fb_set_par,
++	.fb_setcolreg	= au1200fb_fb_setcolreg,
++	.fb_blank		= au1200fb_fb_blank,
++	.fb_fillrect	= cfb_fillrect,
++	.fb_copyarea	= cfb_copyarea,
++	.fb_imageblit	= cfb_imageblit,
++	.fb_sync		= NULL,
++	.fb_ioctl		= au1200fb_ioctl,
++	.fb_mmap		= au1200fb_fb_mmap,
++};
++
++/*-------------------------------------------------------------------------*/
++
++static irqreturn_t au1200fb_handle_irq(int irq, void* dev_id, struct pt_regs *regs)
++{
++	/* Nothing to do for now, just clear any pending interrupt */
++	lcd->intstatus = lcd->intstatus;
++	au_sync();
++	return IRQ_HANDLED;
++}
++
++/*-------------------------------------------------------------------------*/
++
++/* AU1200 LCD device probe helpers */
++
++static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)
++{
++	struct fb_info *fbi = &fbdev->fb_info;
++	int bpp;
++
++	memset(fbi, 0, sizeof(struct fb_info));
++	fbi->fbops = &au1200fb_fb_ops;
++
++	bpp = winbpp(win->w[fbdev->plane].mode_winctrl1);
++
++	/* Copy monitor specs from panel data */
++	/* fixme: we're setting up LCD controller windows, so these dont give a
++	damn as to what the monitor specs are (the panel itself does, but that
++	isnt done here...so maybe need a generic catchall monitor setting??? */
++	memcpy(&fbi->monspecs, &panel->monspecs, sizeof(struct fb_monspecs));
++
++	/* We first try the user mode passed in argument. If that failed,
++	 * or if no one has been specified, we default to the first mode of the
++	 * panel list. Note that after this call, var data will be set */
++	if (!fb_find_mode(&fbi->var,
++			  fbi,
++			  NULL, /* drv_info.opt_mode, */
++			  fbi->monspecs.modedb,
++			  fbi->monspecs.modedb_len,
++			  fbi->monspecs.modedb,
++			  bpp)) {
++
++		print_err("Cannot find valid mode for panel %s", panel->name);
++		return -EFAULT;
++	}
++
++	fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
++	if (!fbi->pseudo_palette) {
++		return -ENOMEM;
++	}
++	memset(fbi->pseudo_palette, 0, sizeof(u32) * 16);
++
++	if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {
++		print_err("Fail to allocate colormap (%d entries)",
++			   AU1200_LCD_NBR_PALETTE_ENTRIES);
++		kfree(fbi->pseudo_palette);
++		return -EFAULT;
++	}
++
++	strncpy(fbi->fix.id, "AU1200", sizeof(fbi->fix.id));
++	fbi->fix.smem_start = fbdev->fb_phys;
++	fbi->fix.smem_len = fbdev->fb_len;
++	fbi->fix.type = FB_TYPE_PACKED_PIXELS;
++	fbi->fix.xpanstep = 1;
++	fbi->fix.ypanstep = 1;
++	fbi->fix.mmio_start = 0;
++	fbi->fix.mmio_len = 0;
++	fbi->fix.accel = FB_ACCEL_NONE;
++
++	fbi->screen_base = fbdev->fb_mem;
++
++	au1200fb_update_fbinfo(fbi);
++
++	return 0;
++}
++
++/*-------------------------------------------------------------------------*/
++
++/* AU1200 LCD controller device driver */
++
++int au1200fb_drv_probe(struct device *dev)
++{
++	struct au1200fb_device *fbdev;
++	unsigned long page;
++	int bpp, plane, ret;
++
++	if (!dev)
++		return -EINVAL;
++
++	for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)
++	{
++		bpp = winbpp(win->w[plane].mode_winctrl1);
++		if (win->w[plane].xres == 0)
++			win->w[plane].xres = panel->Xres;
++		if (win->w[plane].yres == 0)
++			win->w[plane].yres = panel->Yres;
++
++		fbdev = &_au1200fb_devices[plane];
++		memset((void *)fbdev, 0, sizeof(struct au1200fb_device));
++		fbdev->plane = plane;
++
++		/* Allocate the framebuffer to the maximum screen size */
++		fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8;
++
++		fbdev->fb_mem = dma_alloc_noncoherent(dev,
++				PAGE_ALIGN(fbdev->fb_len),
++				&fbdev->fb_phys, GFP_KERNEL);
++		if (!fbdev->fb_mem) {
++			print_err("fail to allocate frambuffer (size: %dK))",
++				  fbdev->fb_len / 1024);
++			return -ENOMEM;
++		}
++
++		/*
++		 * Set page reserved so that mmap will work. This is necessary
++		 * since we'll be remapping normal memory.
++		 */
++		for (page = (unsigned long)fbdev->fb_phys;
++		     page < PAGE_ALIGN((unsigned long)fbdev->fb_phys +
++			     fbdev->fb_len);
++		     page += PAGE_SIZE) {
++			SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */
++		}
++		print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
++		print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);
++
++		/* Init FB data */
++		if ((ret = au1200fb_init_fbinfo(fbdev)) < 0)
++			goto failed;
++
++		/* Register new framebuffer */
++		if ((ret = register_framebuffer(&fbdev->fb_info)) < 0) {
++			print_err("cannot register new framebuffer");
++			goto failed;
++		}
++
++		au1200fb_fb_set_par(&fbdev->fb_info);
++
++#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)
++		if (plane == 0)
++			if (fb_prepare_logo(&fbdev->fb_info, FB_ROTATE_UR)) {
++				/* Start display and show logo on boot */
++				fb_set_cmap(&fbdev->fb_info.cmap,
++						&fbdev->fb_info);
++
++				fb_show_logo(&fbdev->fb_info, FB_ROTATE_UR);
++			}
++#endif
++	}
++
++	/* Now hook interrupt too */
++	if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq,
++		 	  SA_INTERRUPT | SA_SHIRQ, "lcd", (void *)dev)) < 0) {
++		print_err("fail to request interrupt line %d (err: %d)",
++			  AU1200_LCD_INT, ret);
++		goto failed;
++	}
++
++	return 0;
++
++failed:
++	/* NOTE: This only does the current plane/window that failed; others are still active */
++	if (fbdev->fb_mem)
++		dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),
++				fbdev->fb_mem, fbdev->fb_phys);
++	if (fbdev->fb_info.cmap.len != 0)
++		fb_dealloc_cmap(&fbdev->fb_info.cmap);
++	if (fbdev->fb_info.pseudo_palette)
++		kfree(fbdev->fb_info.pseudo_palette);
++	if (plane == 0)
++		free_irq(AU1200_LCD_INT, (void*)dev);
++	return ret;
++}
++
++int au1200fb_drv_remove(struct device *dev)
++{
++	struct au1200fb_device *fbdev;
++	int plane;
++
++	if (!dev)
++		return -ENODEV;
++
++	/* Turn off the panel */
++	au1200_setpanel(NULL);
++
++	for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)
++	{
++		fbdev = &_au1200fb_devices[plane];
++
++		/* Clean up all probe data */
++		unregister_framebuffer(&fbdev->fb_info);
++		if (fbdev->fb_mem)
++			dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),
++					fbdev->fb_mem, fbdev->fb_phys);
++		if (fbdev->fb_info.cmap.len != 0)
++			fb_dealloc_cmap(&fbdev->fb_info.cmap);
++		if (fbdev->fb_info.pseudo_palette)
++			kfree(fbdev->fb_info.pseudo_palette);
++	}
++
++	free_irq(AU1200_LCD_INT, (void *)dev);
++
++	return 0;
++}
++
++int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level)
++{
++	/* TODO */
++	return 0;
++}
++
++int au1200fb_drv_resume(struct device *dev, u32 level)
++{
++	/* TODO */
++	return 0;
++}
++
++static struct device_driver au1200fb_driver = {
++	.name		= "au1200-lcd",
++	.bus		= &platform_bus_type,
++	.probe		= au1200fb_drv_probe,
++	.remove		= au1200fb_drv_remove,
++#ifdef CONFIG_PM
++	.suspend	= au1200fb_drv_suspend,
++	.resume		= au1200fb_drv_resume,
++#endif
++};
++
++/*-------------------------------------------------------------------------*/
++
++/* Kernel driver */
++
++static void au1200fb_setup(void)
++{
++	char* options = NULL;
++	char* this_opt;
++	int num_panels = ARRAY_SIZE(known_lcd_panels);
++	int panel_idx = -1;
++
++	fb_get_options(DRIVER_NAME, &options);
++
++	if (options) {
++		while ((this_opt = strsep(&options,",")) != NULL) {
++			/* Panel option - can be panel name,
++			 * "bs" for board-switch, or number/index */
++			if (!strncmp(this_opt, "panel:", 6)) {
++				int i;
++				long int li;
++				char *endptr;
++				this_opt += 6;
++				/* First check for index, which allows
++				 * to short circuit this mess */
++				li = simple_strtol(this_opt, &endptr, 0);
++				if (*endptr == '\0') {
++					panel_idx = (int)li;
++				}
++				else if (strcmp(this_opt, "bs") == 0) {
++					extern int board_au1200fb_panel(void);
++					panel_idx = board_au1200fb_panel();
++				}
++
++				else
++				for (i = 0; i < num_panels; i++) {
++					if (!strcmp(this_opt, known_lcd_panels[i].name)) {
++						panel_idx = i;
++						break;
++					}
++				}
++
++				if ((panel_idx < 0) || (panel_idx >= num_panels)) {
++						print_warn("Panel %s not supported!", this_opt);
++				}
++				else
++					panel_index = panel_idx;
++			}
++
++			else if (strncmp(this_opt, "nohwcursor", 10) == 0) {
++				nohwcursor = 1;
++			}
++
++			/* Unsupported option */
++			else {
++				print_warn("Unsupported option \"%s\"", this_opt);
++			}
++		}
++	}
++}
++
++#ifdef CONFIG_PM
++int au1200fb_pm_callback(au1xxx_power_dev_t *dev,
++		au1xxx_request_t request, void *data) {
++	int retval = -1;
++	unsigned int d = 0;
++	unsigned int brightness = 0;
++
++	if (request == AU1XXX_PM_SLEEP) {
++		board_au1200fb_panel_shutdown();
++	}
++	else if (request == AU1XXX_PM_WAKEUP) {
++		if(dev->prev_state == SLEEP_STATE)
++		{
++			int plane;
++			au1200_setpanel(panel);
++			for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) 	{
++				struct au1200fb_device *fbdev;
++				fbdev = &_au1200fb_devices[plane];
++				au1200fb_fb_set_par(&fbdev->fb_info);
++			}
++		}
++
++		d = *((unsigned int*)data);
++		if(d <=10) brightness = 26;
++		else if(d<=20) brightness = 51;
++		else if(d<=30) brightness = 77;
++		else if(d<=40) brightness = 102;
++		else if(d<=50) brightness = 128;
++		else if(d<=60) brightness = 153;
++		else if(d<=70) brightness = 179;
++		else if(d<=80) brightness = 204;
++		else if(d<=90) brightness = 230;
++		else brightness = 255;
++		set_brightness(brightness);
++	}
++	else if (request == AU1XXX_PM_GETSTATUS) {
++		return dev->cur_state;
++	}
++	else if (request == AU1XXX_PM_ACCESS) {
++		if (dev->cur_state != SLEEP_STATE)
++			return retval;
++		else {
++			au1200_setpanel(panel);
++		}
++	}
++	else if (request == AU1XXX_PM_IDLE) {
++	}
++	else if (request == AU1XXX_PM_CLEANUP) {
++	}
++
++	return retval;
++}
++#endif
++
++int __init au1200fb_init(void)
++{
++	print_info("" DRIVER_DESC "");
++
++	/* Setup driver with options */
++	au1200fb_setup();
++
++	/* Point to the panel selected */
++	panel = &known_lcd_panels[panel_index];
++	win = &windows[window_index];
++
++	printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name);
++	printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name);
++
++	/* Kickstart the panel, the framebuffers/windows come soon enough */
++	au1200_setpanel(panel);
++
++	#ifdef CONFIG_PM
++	LCD_pm_dev = new_au1xxx_power_device("LCD", &au1200fb_pm_callback, NULL);
++	if ( LCD_pm_dev == NULL)
++		printk(KERN_INFO "Unable to create a power management device entry for the au1200fb.\n");
++	else
++		printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n");
++	#endif
++
++	return driver_register(&au1200fb_driver);
++}
++
++void __exit au1200fb_cleanup(void)
++{
++	driver_unregister(&au1200fb_driver);
++}
++
++module_init(au1200fb_init);
++module_exit(au1200fb_cleanup);
++
++MODULE_DESCRIPTION(DRIVER_DESC);
++MODULE_LICENSE("GPL");
+diff -Naur linux-2.6.16.orig/drivers/video/au1200fb.h linux-2.6.16/drivers/video/au1200fb.h
+--- linux-2.6.16.orig/drivers/video/au1200fb.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/video/au1200fb.h	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,288 @@
++/*
++ * BRIEF MODULE DESCRIPTION
++ *	Hardware definitions for the Au1200 LCD controller
++ *
++ * Copyright 2004 AMD
++ * Author:	AMD
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the	License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED	  ``AS	IS'' AND   ANY	EXPRESS OR IMPLIED
++ *  WARRANTIES,	  INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO	EVENT  SHALL   THE AUTHOR  BE	 LIABLE FOR ANY	  DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED	  TO, PROCUREMENT OF  SUBSTITUTE GOODS	OR SERVICES; LOSS OF
++ *  USE, DATA,	OR PROFITS; OR	BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN	 CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#ifndef _AU1200LCD_H
++#define _AU1200LCD_H
++
++/********************************************************************/
++#define AU1200_LCD_ADDR		0xB5000000
++
++#define uint8 unsigned char
++#define uint32 unsigned int
++
++typedef volatile struct
++{
++	uint32	reserved0;
++	uint32	screen;
++	uint32	backcolor;
++	uint32	horztiming;
++	uint32	verttiming;
++	uint32	clkcontrol;
++	uint32	pwmdiv;
++	uint32	pwmhi;
++	uint32	reserved1;
++	uint32	winenable;
++	uint32	colorkey;
++	uint32	colorkeymsk;
++	struct
++	{
++		uint32	cursorctrl;
++		uint32	cursorpos;
++		uint32	cursorcolor0;
++		uint32	cursorcolor1;
++		uint32	cursorcolor2;
++		uint32	cursorcolor3;
++	} hwc;
++	uint32	intstatus;
++	uint32	intenable;
++	uint32	outmask;
++	uint32	fifoctrl;
++	uint32	reserved2[(0x0100-0x0058)/4];
++	struct
++	{
++		uint32	winctrl0;
++		uint32	winctrl1;
++		uint32	winctrl2;
++		uint32	winbuf0;
++		uint32	winbuf1;
++		uint32	winbufctrl;
++		uint32	winreserved0;
++		uint32	winreserved1;
++	} window[4];
++
++	uint32	reserved3[(0x0400-0x0180)/4];
++
++	uint32	palette[(0x0800-0x0400)/4];
++
++	uint8	cursorpattern[256];
++
++} AU1200_LCD;
++
++/* lcd_screen */
++#define LCD_SCREEN_SEN		(1<<31)
++#define LCD_SCREEN_SX		(0x07FF<<19)
++#define LCD_SCREEN_SY		(0x07FF<< 8)
++#define LCD_SCREEN_SWP		(1<<7)
++#define LCD_SCREEN_SWD		(1<<6)
++#define LCD_SCREEN_PT		(7<<0)
++#define LCD_SCREEN_PT_TFT	(0<<0)
++#define LCD_SCREEN_SX_N(WIDTH)	((WIDTH-1)<<19)
++#define LCD_SCREEN_SY_N(HEIGHT)	((HEIGHT-1)<<8)
++#define LCD_SCREEN_PT_CSTN	(1<<0)
++#define LCD_SCREEN_PT_CDSTN	(2<<0)
++#define LCD_SCREEN_PT_M8STN	(3<<0)
++#define LCD_SCREEN_PT_M4STN	(4<<0)
++
++/* lcd_backcolor */
++#define LCD_BACKCOLOR_SBGR		(0xFF<<16)
++#define LCD_BACKCOLOR_SBGG		(0xFF<<8)
++#define LCD_BACKCOLOR_SBGB		(0xFF<<0)
++#define LCD_BACKCOLOR_SBGR_N(N)	((N)<<16)
++#define LCD_BACKCOLOR_SBGG_N(N)	((N)<<8)
++#define LCD_BACKCOLOR_SBGB_N(N)	((N)<<0)
++
++/* lcd_winenable */
++#define LCD_WINENABLE_WEN3		(1<<3)
++#define LCD_WINENABLE_WEN2		(1<<2)
++#define LCD_WINENABLE_WEN1		(1<<1)
++#define LCD_WINENABLE_WEN0		(1<<0)
++
++/* lcd_colorkey */
++#define LCD_COLORKEY_CKR		(0xFF<<16)
++#define LCD_COLORKEY_CKG		(0xFF<<8)
++#define LCD_COLORKEY_CKB		(0xFF<<0)
++#define LCD_COLORKEY_CKR_N(N)	((N)<<16)
++#define LCD_COLORKEY_CKG_N(N)	((N)<<8)
++#define LCD_COLORKEY_CKB_N(N)	((N)<<0)
++
++/* lcd_colorkeymsk */
++#define LCD_COLORKEYMSK_CKMR		(0xFF<<16)
++#define LCD_COLORKEYMSK_CKMG		(0xFF<<8)
++#define LCD_COLORKEYMSK_CKMB		(0xFF<<0)
++#define LCD_COLORKEYMSK_CKMR_N(N)	((N)<<16)
++#define LCD_COLORKEYMSK_CKMG_N(N)	((N)<<8)
++#define LCD_COLORKEYMSK_CKMB_N(N)	((N)<<0)
++
++/* lcd windows control 0 */
++#define LCD_WINCTRL0_OX		(0x07FF<<21)
++#define LCD_WINCTRL0_OY		(0x07FF<<10)
++#define LCD_WINCTRL0_A		(0x00FF<<2)
++#define LCD_WINCTRL0_AEN	(1<<1)
++#define LCD_WINCTRL0_OX_N(N) ((N)<<21)
++#define LCD_WINCTRL0_OY_N(N) ((N)<<10)
++#define LCD_WINCTRL0_A_N(N) ((N)<<2)
++
++/* lcd windows control 1 */
++#define LCD_WINCTRL1_PRI	(3<<30)
++#define LCD_WINCTRL1_PIPE	(1<<29)
++#define LCD_WINCTRL1_FRM	(0xF<<25)
++#define LCD_WINCTRL1_CCO	(1<<24)
++#define LCD_WINCTRL1_PO		(3<<22)
++#define LCD_WINCTRL1_SZX	(0x07FF<<11)
++#define LCD_WINCTRL1_SZY	(0x07FF<<0)
++#define LCD_WINCTRL1_FRM_1BPP	(0<<25)
++#define LCD_WINCTRL1_FRM_2BPP	(1<<25)
++#define LCD_WINCTRL1_FRM_4BPP	(2<<25)
++#define LCD_WINCTRL1_FRM_8BPP	(3<<25)
++#define LCD_WINCTRL1_FRM_12BPP	(4<<25)
++#define LCD_WINCTRL1_FRM_16BPP655	(5<<25)
++#define LCD_WINCTRL1_FRM_16BPP565	(6<<25)
++#define LCD_WINCTRL1_FRM_16BPP556	(7<<25)
++#define LCD_WINCTRL1_FRM_16BPPI1555	(8<<25)
++#define LCD_WINCTRL1_FRM_16BPPI5551	(9<<25)
++#define LCD_WINCTRL1_FRM_16BPPA1555	(10<<25)
++#define LCD_WINCTRL1_FRM_16BPPA5551	(11<<25)
++#define LCD_WINCTRL1_FRM_24BPP		(12<<25)
++#define LCD_WINCTRL1_FRM_32BPP		(13<<25)
++#define LCD_WINCTRL1_PRI_N(N)	((N)<<30)
++#define LCD_WINCTRL1_PO_00		(0<<22)
++#define LCD_WINCTRL1_PO_01		(1<<22)
++#define LCD_WINCTRL1_PO_10		(2<<22)
++#define LCD_WINCTRL1_PO_11		(3<<22)
++#define LCD_WINCTRL1_SZX_N(N)	((N-1)<<11)
++#define LCD_WINCTRL1_SZY_N(N)	((N-1)<<0)
++
++/* lcd windows control 2 */
++#define LCD_WINCTRL2_CKMODE		(3<<24)
++#define LCD_WINCTRL2_DBM		(1<<23)
++#define LCD_WINCTRL2_RAM		(3<<21)
++#define LCD_WINCTRL2_BX			(0x1FFF<<8)
++#define LCD_WINCTRL2_SCX		(0xF<<4)
++#define LCD_WINCTRL2_SCY		(0xF<<0)
++#define LCD_WINCTRL2_CKMODE_00		(0<<24)
++#define LCD_WINCTRL2_CKMODE_01		(1<<24)
++#define LCD_WINCTRL2_CKMODE_10		(2<<24)
++#define LCD_WINCTRL2_CKMODE_11		(3<<24)
++#define LCD_WINCTRL2_RAM_NONE		(0<<21)
++#define LCD_WINCTRL2_RAM_PALETTE	(1<<21)
++#define LCD_WINCTRL2_RAM_GAMMA		(2<<21)
++#define LCD_WINCTRL2_RAM_BUFFER		(3<<21)
++#define LCD_WINCTRL2_BX_N(N)	((N)<<8)
++#define LCD_WINCTRL2_SCX_1		(0<<4)
++#define LCD_WINCTRL2_SCX_2		(1<<4)
++#define LCD_WINCTRL2_SCX_4		(2<<4)
++#define LCD_WINCTRL2_SCY_1		(0<<0)
++#define LCD_WINCTRL2_SCY_2		(1<<0)
++#define LCD_WINCTRL2_SCY_4		(2<<0)
++
++/* lcd windows buffer control */
++#define LCD_WINBUFCTRL_DB		(1<<1)
++#define LCD_WINBUFCTRL_DBN		(1<<0)
++
++/* lcd_intstatus, lcd_intenable */
++#define LCD_INT_IFO				(0xF<<14)
++#define LCD_INT_IFU				(0xF<<10)
++#define LCD_INT_OFO				(1<<9)
++#define LCD_INT_OFU				(1<<8)
++#define LCD_INT_WAIT			(1<<3)
++#define LCD_INT_SD				(1<<2)
++#define LCD_INT_SA				(1<<1)
++#define LCD_INT_SS				(1<<0)
++
++/* lcd_horztiming */
++#define LCD_HORZTIMING_HND2		(0x1FF<<18)
++#define LCD_HORZTIMING_HND1		(0x1FF<<9)
++#define LCD_HORZTIMING_HPW		(0x1FF<<0)
++#define LCD_HORZTIMING_HND2_N(N)(((N)-1)<<18)
++#define LCD_HORZTIMING_HND1_N(N)(((N)-1)<<9)
++#define LCD_HORZTIMING_HPW_N(N)	(((N)-1)<<0)
++
++/* lcd_verttiming */
++#define LCD_VERTTIMING_VND2		(0x1FF<<18)
++#define LCD_VERTTIMING_VND1		(0x1FF<<9)
++#define LCD_VERTTIMING_VPW		(0x1FF<<0)
++#define LCD_VERTTIMING_VND2_N(N)(((N)-1)<<18)
++#define LCD_VERTTIMING_VND1_N(N)(((N)-1)<<9)
++#define LCD_VERTTIMING_VPW_N(N)	(((N)-1)<<0)
++
++/* lcd_clkcontrol */
++#define LCD_CLKCONTROL_EXT		(1<<22)
++#define LCD_CLKCONTROL_DELAY	(3<<20)
++#define LCD_CLKCONTROL_CDD		(1<<19)
++#define LCD_CLKCONTROL_IB		(1<<18)
++#define LCD_CLKCONTROL_IC		(1<<17)
++#define LCD_CLKCONTROL_IH		(1<<16)
++#define LCD_CLKCONTROL_IV		(1<<15)
++#define LCD_CLKCONTROL_BF		(0x1F<<10)
++#define LCD_CLKCONTROL_PCD		(0x3FF<<0)
++#define LCD_CLKCONTROL_BF_N(N)	(((N)-1)<<10)
++#define LCD_CLKCONTROL_PCD_N(N)	((N)<<0)
++
++/* lcd_pwmdiv */
++#define LCD_PWMDIV_EN			(1<<31)
++#define LCD_PWMDIV_PWMDIV		(0x1FFFF<<0)
++#define LCD_PWMDIV_PWMDIV_N(N)	((N)<<0)
++
++/* lcd_pwmhi */
++#define LCD_PWMHI_PWMHI1		(0xFFFF<<16)
++#define LCD_PWMHI_PWMHI0		(0xFFFF<<0)
++#define LCD_PWMHI_PWMHI1_N(N)	((N)<<16)
++#define LCD_PWMHI_PWMHI0_N(N)	((N)<<0)
++
++/* lcd_hwccon */
++#define LCD_HWCCON_EN			(1<<0)
++
++/* lcd_cursorpos */
++#define LCD_CURSORPOS_HWCXOFF		(0x1F<<27)
++#define LCD_CURSORPOS_HWCXPOS		(0x07FF<<16)
++#define LCD_CURSORPOS_HWCYOFF		(0x1F<<11)
++#define LCD_CURSORPOS_HWCYPOS		(0x07FF<<0)
++#define LCD_CURSORPOS_HWCXOFF_N(N)	((N)<<27)
++#define LCD_CURSORPOS_HWCXPOS_N(N)	((N)<<16)
++#define LCD_CURSORPOS_HWCYOFF_N(N)	((N)<<11)
++#define LCD_CURSORPOS_HWCYPOS_N(N)	((N)<<0)
++
++/* lcd_cursorcolor */
++#define LCD_CURSORCOLOR_HWCA		(0xFF<<24)
++#define LCD_CURSORCOLOR_HWCR		(0xFF<<16)
++#define LCD_CURSORCOLOR_HWCG		(0xFF<<8)
++#define LCD_CURSORCOLOR_HWCB		(0xFF<<0)
++#define LCD_CURSORCOLOR_HWCA_N(N)	((N)<<24)
++#define LCD_CURSORCOLOR_HWCR_N(N)	((N)<<16)
++#define LCD_CURSORCOLOR_HWCG_N(N)	((N)<<8)
++#define LCD_CURSORCOLOR_HWCB_N(N)	((N)<<0)
++
++/* lcd_fifoctrl */
++#define LCD_FIFOCTRL_F3IF		(1<<29)
++#define LCD_FIFOCTRL_F3REQ		(0x1F<<24)
++#define LCD_FIFOCTRL_F2IF		(1<<29)
++#define LCD_FIFOCTRL_F2REQ		(0x1F<<16)
++#define LCD_FIFOCTRL_F1IF		(1<<29)
++#define LCD_FIFOCTRL_F1REQ		(0x1F<<8)
++#define LCD_FIFOCTRL_F0IF		(1<<29)
++#define LCD_FIFOCTRL_F0REQ		(0x1F<<0)
++#define LCD_FIFOCTRL_F3REQ_N(N)	((N-1)<<24)
++#define LCD_FIFOCTRL_F2REQ_N(N)	((N-1)<<16)
++#define LCD_FIFOCTRL_F1REQ_N(N)	((N-1)<<8)
++#define LCD_FIFOCTRL_F0REQ_N(N)	((N-1)<<0)
++
++/* lcd_outmask */
++#define LCD_OUTMASK_MASK		(0x00FFFFFF)
++
++/********************************************************************/
++#endif /* _AU1200LCD_H */
+diff -Naur linux-2.6.16.orig/drivers/video/console/newport_con.c linux-2.6.16/drivers/video/console/newport_con.c
+--- linux-2.6.16.orig/drivers/video/console/newport_con.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/drivers/video/console/newport_con.c	2006-03-21 01:05:48.000000000 +0000
+@@ -149,7 +149,7 @@
+ 	newport_clear_screen(0, ystart, 1280 + 63, yend, ci);
+ }
+ 
+-void newport_reset(void)
++static void newport_reset(void)
+ {
+ 	unsigned short treg;
+ 	int i;
+@@ -193,7 +193,7 @@
+  * calculate the actual screen size by reading
+  * the video timing out of the VC2
+  */
+-void newport_get_screensize(void)
++static void newport_get_screensize(void)
+ {
+ 	int i, cols;
+ 	unsigned short ventry, treg;
+diff -Naur linux-2.6.16.orig/drivers/video/smivgxfb.c linux-2.6.16/drivers/video/smivgxfb.c
+--- linux-2.6.16.orig/drivers/video/smivgxfb.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/drivers/video/smivgxfb.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,387 @@
++/***************************************************************************
++ *  Silicon Motion VoyagerGX framebuffer driver
++ *
++ * 	ported to 2.6 by Embedded Alley Solutions, Inc
++ * 	Copyright (C) 2005 Embedded Alley Solutions, Inc
++ *
++ * 		based on
++    copyright            : (C) 2001 by Szu-Tao Huang
++    email                : johuang@siliconmotion.com
++    Updated to SM501 by Eric.Devolder@amd.com and dan@embeddededge.com
++    for the AMD Mirage Portable Tablet.  20 Oct 2003
++ ***************************************************************************/
++
++/***************************************************************************
++ *                                                                         *
++ *   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 Free Software Foundation; either version 2 of the License, or     *
++ *   (at your option) any later version.                                   *
++ *                                                                         *
++ ***************************************************************************/
++
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/errno.h>
++#include <linux/string.h>
++#include <linux/mm.h>
++#include <linux/tty.h>
++#include <linux/slab.h>
++#include <linux/delay.h>
++#include <linux/fb.h>
++#include <linux/pci.h>
++#include <linux/init.h>
++
++#include <asm/io.h>
++#include <asm/irq.h>
++#include <asm/pgtable.h>
++#include <asm/system.h>
++#include <asm/uaccess.h>
++
++static char __iomem *SMIRegs;	// point to virtual Memory Map IO starting address
++static char __iomem *SMILFB;	// point to virtual video memory starting address
++
++static struct fb_fix_screeninfo smifb_fix __devinitdata = {
++	.id =		"smivgx",
++	.type =		FB_TYPE_PACKED_PIXELS,
++	.visual =	FB_VISUAL_TRUECOLOR,
++	.ywrapstep = 	0,
++	.line_length	= 1024 * 2, /* (bbp * xres)/8 */
++	.accel =	FB_ACCEL_NONE,
++};
++
++static struct fb_var_screeninfo smifb_var __devinitdata = {
++	.xres           = 1024,
++	.yres           = 768,
++	.xres_virtual   = 1024,
++	.yres_virtual   = 768,
++	.bits_per_pixel = 16,
++	.red            = { 11, 5, 0 },
++	.green          = {  5, 6, 0 },
++	.blue           = {  0, 5, 0 },
++	.activate       = FB_ACTIVATE_NOW,
++	.height         = -1,
++	.width          = -1,
++	.vmode          = FB_VMODE_NONINTERLACED,
++};
++
++
++static struct fb_info info;
++
++#define smi_mmiowb(dat,reg)	writeb(dat, (SMIRegs + reg))
++#define smi_mmioww(dat,reg)	writew(dat, (SMIRegs + reg))
++#define smi_mmiowl(dat,reg)	writel(dat, (SMIRegs + reg))
++
++#define smi_mmiorb(reg)	        readb(SMIRegs + reg)
++#define smi_mmiorw(reg)	        readw(SMIRegs + reg)
++#define smi_mmiorl(reg)	        readl(SMIRegs + reg)
++
++/* Address space offsets for various control/status registers.
++*/
++#define MISC_CTRL			0x000004
++#define GPIO_LO_CTRL			0x000008
++#define GPIO_HI_CTRL			0x00000c
++#define DRAM_CTRL			0x000010
++#define CURRENT_POWER_GATE		0x000038
++#define CURRENT_POWER_CLOCK		0x00003C
++#define POWER_MODE1_GATE                0x000048
++#define POWER_MODE1_CLOCK               0x00004C
++#define POWER_MODE_CTRL			0x000054
++
++#define GPIO_DATA_LO			0x010000
++#define GPIO_DATA_HI			0x010004
++#define GPIO_DATA_DIR_LO		0x010008
++#define GPIO_DATA_DIR_HI		0x01000c
++#define I2C_BYTE_COUNT			0x010040
++#define I2C_CONTROL			0x010041
++#define I2C_STATUS_RESET		0x010042
++#define I2C_SLAVE_ADDRESS		0x010043
++#define I2C_DATA			0x010044
++
++#define DE_COLOR_COMPARE		0x100020
++#define DE_COLOR_COMPARE_MASK		0x100024
++#define DE_MASKS			0x100028
++#define DE_WRAP				0x10004C
++
++#define PANEL_DISPLAY_CTRL              0x080000
++#define PANEL_PAN_CTRL                  0x080004
++#define PANEL_COLOR_KEY                 0x080008
++#define PANEL_FB_ADDRESS                0x08000C
++#define PANEL_FB_WIDTH                  0x080010
++#define PANEL_WINDOW_WIDTH              0x080014
++#define PANEL_WINDOW_HEIGHT             0x080018
++#define PANEL_PLANE_TL                  0x08001C
++#define PANEL_PLANE_BR                  0x080020
++#define PANEL_HORIZONTAL_TOTAL          0x080024
++#define PANEL_HORIZONTAL_SYNC           0x080028
++#define PANEL_VERTICAL_TOTAL            0x08002C
++#define PANEL_VERTICAL_SYNC             0x080030
++#define PANEL_CURRENT_LINE              0x080034
++#define VIDEO_DISPLAY_CTRL		0x080040
++#define VIDEO_DISPLAY_FB0		0x080044
++#define VIDEO_DISPLAY_FBWIDTH		0x080048
++#define VIDEO_DISPLAY_FB0LAST		0x08004C
++#define VIDEO_DISPLAY_TL		0x080050
++#define VIDEO_DISPLAY_BR		0x080054
++#define VIDEO_SCALE			0x080058
++#define VIDEO_INITIAL_SCALE		0x08005C
++#define VIDEO_YUV_CONSTANTS		0x080060
++#define VIDEO_DISPLAY_FB1		0x080064
++#define VIDEO_DISPLAY_FB1LAST		0x080068
++#define VIDEO_ALPHA_CTRL		0x080080
++#define PANEL_HWC_ADDRESS		0x0800F0
++#define CRT_DISPLAY_CTRL		0x080200
++#define CRT_FB_ADDRESS			0x080204
++#define CRT_FB_WIDTH			0x080208
++#define CRT_HORIZONTAL_TOTAL		0x08020c
++#define CRT_HORIZONTAL_SYNC		0x080210
++#define CRT_VERTICAL_TOTAL		0x080214
++#define CRT_VERTICAL_SYNC		0x080218
++#define CRT_HWC_ADDRESS			0x080230
++#define CRT_HWC_LOCATION		0x080234
++
++#define ZV_CAPTURE_CTRL			0x090000
++#define ZV_CAPTURE_CLIP			0x090004
++#define ZV_CAPTURE_SIZE			0x090008
++#define ZV_CAPTURE_BUF0			0x09000c
++#define ZV_CAPTURE_BUF1			0x090010
++#define ZV_CAPTURE_OFFSET		0x090014
++#define ZV_FIFO_CTRL			0x090018
++
++#define waitforvsync() udelay(400)
++
++static int initdone = 0;
++static int crt_out = 1;
++
++
++static int
++smi_setcolreg(unsigned regno, unsigned red, unsigned green,
++	unsigned blue, unsigned transp,
++	struct fb_info *info)
++{
++	if (regno > 255)
++		return 1;
++
++	((u32 *)(info->pseudo_palette))[regno] =
++		    ((red & 0xf800) >> 0) |
++		    ((green & 0xfc00) >> 5) |
++		    ((blue & 0xf800) >> 11);
++
++	return 0;
++}
++
++/* This function still needs lots of work to generically support
++ * different output devices (CRT or LCD) and resolutions.
++ * Currently hard-coded for 1024x768 LCD panel.
++ */
++static void smi_setmode(void)
++{
++	if (initdone)
++		return;
++
++	initdone = 1;
++
++	/* Just blast in some control values based upon the chip
++	 * documentation.  We use the internal memory, I don't know
++	 * how to determine the amount available yet.
++	 */
++	smi_mmiowl(0x07F127C2, DRAM_CTRL);
++	smi_mmiowl(0x02000020, PANEL_HWC_ADDRESS);
++	smi_mmiowl(0x007FF800, PANEL_HWC_ADDRESS);
++	smi_mmiowl(0x00021827, POWER_MODE1_GATE);
++	smi_mmiowl(0x011A0A09, POWER_MODE1_CLOCK);
++	smi_mmiowl(0x00000001, POWER_MODE_CTRL);
++	smi_mmiowl(0x80000000, PANEL_FB_ADDRESS);
++	smi_mmiowl(0x08000800, PANEL_FB_WIDTH);
++	smi_mmiowl(0x04000000, PANEL_WINDOW_WIDTH);
++	smi_mmiowl(0x03000000, PANEL_WINDOW_HEIGHT);
++	smi_mmiowl(0x00000000, PANEL_PLANE_TL);
++	smi_mmiowl(0x02FF03FF, PANEL_PLANE_BR);
++	smi_mmiowl(0x05D003FF, PANEL_HORIZONTAL_TOTAL);
++	smi_mmiowl(0x00C80424, PANEL_HORIZONTAL_SYNC);
++	smi_mmiowl(0x032502FF, PANEL_VERTICAL_TOTAL);
++	smi_mmiowl(0x00060302, PANEL_VERTICAL_SYNC);
++	smi_mmiowl(0x00013905, PANEL_DISPLAY_CTRL);
++	smi_mmiowl(0x01013105, PANEL_DISPLAY_CTRL);
++	waitforvsync();
++	smi_mmiowl(0x03013905, PANEL_DISPLAY_CTRL);
++	waitforvsync();
++	smi_mmiowl(0x07013905, PANEL_DISPLAY_CTRL);
++	waitforvsync();
++	smi_mmiowl(0x0F013905, PANEL_DISPLAY_CTRL);
++	smi_mmiowl(0x0002187F, POWER_MODE1_GATE);
++	smi_mmiowl(0x01011801, POWER_MODE1_CLOCK);
++	smi_mmiowl(0x00000001, POWER_MODE_CTRL);
++
++	smi_mmiowl(0x80000000, PANEL_FB_ADDRESS);
++	smi_mmiowl(0x00000000, PANEL_PAN_CTRL);
++	smi_mmiowl(0x00000000, PANEL_COLOR_KEY);
++
++	if (crt_out) {
++		/* Just sent the panel out to the CRT for now.
++		*/
++		smi_mmiowl(0x80000000, CRT_FB_ADDRESS);
++		smi_mmiowl(0x08000800, CRT_FB_WIDTH);
++		smi_mmiowl(0x05D003FF, CRT_HORIZONTAL_TOTAL);
++		smi_mmiowl(0x00C80424, CRT_HORIZONTAL_SYNC);
++		smi_mmiowl(0x032502FF, CRT_VERTICAL_TOTAL);
++		smi_mmiowl(0x00060302, CRT_VERTICAL_SYNC);
++		smi_mmiowl(0x007FF800, CRT_HWC_ADDRESS);
++		smi_mmiowl(0x00010305, CRT_DISPLAY_CTRL);
++		smi_mmiowl(0x00000001, MISC_CTRL);
++	}
++}
++
++/*
++ * Unmap in the memory mapped IO registers
++ *
++ */
++
++static void __devinit smi_unmap_mmio(void)
++{
++	if (SMIRegs) {
++		iounmap(SMIRegs);
++		SMIRegs = NULL;
++	}
++}
++
++
++/*
++ * Unmap in the screen memory
++ *
++ */
++static void __devinit smi_unmap_smem(void)
++{
++	if (SMILFB) {
++		iounmap(SMILFB);
++		SMILFB = NULL;
++	}
++}
++
++static void vgxfb_setup(char *options)
++{
++
++	if (!options || !*options)
++		return;
++
++	/* The only thing I'm looking for right now is to disable a
++	 * CRT output that mirrors the panel display.
++	 */
++	if (strcmp(options, "no_crt") == 0)
++		crt_out = 0;
++
++	return;
++}
++
++static struct fb_ops smifb_ops = {
++	.owner =		THIS_MODULE,
++	.fb_setcolreg =		smi_setcolreg,
++	.fb_fillrect =		cfb_fillrect,
++	.fb_copyarea =		cfb_copyarea,
++	.fb_imageblit =		cfb_imageblit,
++};
++
++static int __devinit vgx_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
++{
++	int err;
++
++	/* Enable the chip.
++	*/
++	err = pci_enable_device(dev);
++	if (err)
++		return err;
++
++
++	/* Set up MMIO space.
++	*/
++	smifb_fix.mmio_start = pci_resource_start(dev,1);
++	smifb_fix.mmio_len = 0x00200000;
++	SMIRegs = ioremap(smifb_fix.mmio_start, smifb_fix.mmio_len);
++
++	/* Set up framebuffer.  It's a 64M space, various amount of
++	 * internal memory.  I don't know how to determine the real
++	 * amount of memory (yet).
++	 */
++	smifb_fix.smem_start = pci_resource_start(dev,0);
++	smifb_fix.smem_len = 0x00800000;
++	SMILFB = ioremap(smifb_fix.smem_start, smifb_fix.smem_len);
++
++	memset_io(SMILFB, 0, smifb_fix.smem_len);
++
++	info.screen_base = SMILFB;
++	info.fbops = &smifb_ops;
++	info.fix = smifb_fix;
++
++	info.flags = FBINFO_FLAG_DEFAULT;
++
++	info.pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
++	if (!info.pseudo_palette) {
++		return -ENOMEM;
++	}
++	memset(info.pseudo_palette, 0, sizeof(u32) *16);
++
++	fb_alloc_cmap(&info.cmap,256,0);
++
++	smi_setmode();
++
++	info.var = smifb_var;
++
++	if (register_framebuffer(&info) < 0)
++		goto failed;
++
++	return 0;
++
++failed:
++	smi_unmap_smem();
++	smi_unmap_mmio();
++
++	return err;
++}
++
++static void __devexit vgx_pci_remove(struct pci_dev *dev)
++{
++	unregister_framebuffer(&info);
++	smi_unmap_smem();
++	smi_unmap_mmio();
++}
++
++static struct pci_device_id vgx_devices[] = {
++	{PCI_VENDOR_ID_SILICON_MOTION, PCI_DEVICE_ID_SM501_VOYAGER_GX_REV_AA,
++	 PCI_ANY_ID, PCI_ANY_ID},
++	{PCI_VENDOR_ID_SILICON_MOTION, PCI_DEVICE_ID_SM501_VOYAGER_GX_REV_B,
++	 PCI_ANY_ID, PCI_ANY_ID},
++	{0}
++};
++
++MODULE_DEVICE_TABLE(pci, vgx_devices);
++
++static struct pci_driver vgxfb_pci_driver = {
++	.name	= "vgxfb",
++	.id_table= vgx_devices,
++	.probe	= vgx_pci_probe,
++	.remove	= __devexit_p(vgx_pci_remove),
++};
++
++static int __init vgxfb_init(void)
++{
++	char *option = NULL;
++
++	if (fb_get_options("vgxfb", &option))
++		return -ENODEV;
++	vgxfb_setup(option);
++
++	printk("Silicon Motion Inc. VOYAGER Init complete.\n");
++	return pci_module_init(&vgxfb_pci_driver);
++}
++
++static void __exit vgxfb_exit(void)
++{
++	pci_unregister_driver(&vgxfb_pci_driver);
++}
++
++module_init(vgxfb_init);
++module_exit(vgxfb_exit);
++
++MODULE_AUTHOR("");
++MODULE_DESCRIPTION("Framebuffer driver for SMI Voyager");
++MODULE_LICENSE("GPL");
+diff -Naur linux-2.6.16.orig/include/asm-mips/byteorder.h linux-2.6.16/include/asm-mips/byteorder.h
+--- linux-2.6.16.orig/include/asm-mips/byteorder.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/byteorder.h	2006-03-21 01:05:48.000000000 +0000
+@@ -39,6 +39,24 @@
+ }
+ #define __arch__swab32(x)	___arch__swab32(x)
+ 
++#ifdef CONFIG_CPU_MIPS64_R2
++
++static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
++{
++	__asm__(
++	"	dsbh	%0, %1			\n"
++	"	dshd	%0, %0			\n"
++	"	drotr	%0, %0, 32		\n"
++	: "=r" (x)
++	: "r" (x));
++
++	return x;
++}
++
++#define __arch__swab64(x)	___arch__swab64(x)
++
++#endif /* CONFIG_CPU_MIPS64_R2 */
++
+ #endif /* CONFIG_CPU_MIPSR2 */
+ 
+ #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+diff -Naur linux-2.6.16.orig/include/asm-mips/compat.h linux-2.6.16/include/asm-mips/compat.h
+--- linux-2.6.16.orig/include/asm-mips/compat.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/compat.h	2006-03-21 01:05:48.000000000 +0000
+@@ -128,17 +128,17 @@
+  */
+ typedef u32		compat_uptr_t;
+ 
+-static inline void *compat_ptr(compat_uptr_t uptr)
++static inline void __user *compat_ptr(compat_uptr_t uptr)
+ {
+-	return (void *)(long)uptr;
++	return (void __user *)(long)uptr;
+ }
+ 
+-static inline void *compat_alloc_user_space(long len)
++static inline void __user *compat_alloc_user_space(long len)
+ {
+ 	struct pt_regs *regs = (struct pt_regs *)
+ 		((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
+ 
+-	return (void *) (regs->regs[29] - len);
++	return (void __user *) (regs->regs[29] - len);
+ }
+ #if defined (__MIPSEL__)
+ #define __COMPAT_ENDIAN_SWAP__ 	1
+diff -Naur linux-2.6.16.orig/include/asm-mips/io.h linux-2.6.16/include/asm-mips/io.h
+--- linux-2.6.16.orig/include/asm-mips/io.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/io.h	2006-03-21 01:05:48.000000000 +0000
+@@ -40,56 +40,13 @@
+  * hardware.  An example use would be for flash memory that's used for
+  * execute in place.
+  */
+-# define __raw_ioswabb(x)	(x)
+-# define __raw_ioswabw(x)	(x)
+-# define __raw_ioswabl(x)	(x)
+-# define __raw_ioswabq(x)	(x)
+-# define ____raw_ioswabq(x)	(x)
+-
+-/*
+- * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
+- * less sane hardware forces software to fiddle with this...
+- *
+- * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
+- * you can't have the numerical value of data and byte addresses within
+- * multibyte quantities both preserved at the same time.  Hence two
+- * variations of functions: non-prefixed ones that preserve the value
+- * and prefixed ones that preserve byte addresses.  The latters are
+- * typically used for moving raw data between a peripheral and memory (cf.
+- * string I/O functions), hence the "__mem_" prefix.
+- */
+-#if defined(CONFIG_SWAP_IO_SPACE)
+-
+-# define ioswabb(x)		(x)
+-# define __mem_ioswabb(x)	(x)
+-# ifdef CONFIG_SGI_IP22
+-/*
+- * IP22 seems braindead enough to swap 16bits values in hardware, but
+- * not 32bits.  Go figure... Can't tell without documentation.
+- */
+-#  define ioswabw(x)		(x)
+-#  define __mem_ioswabw(x)	le16_to_cpu(x)
+-# else
+-#  define ioswabw(x)		le16_to_cpu(x)
+-#  define __mem_ioswabw(x)	(x)
+-# endif
+-# define ioswabl(x)		le32_to_cpu(x)
+-# define __mem_ioswabl(x)	(x)
+-# define ioswabq(x)		le64_to_cpu(x)
+-# define __mem_ioswabq(x)	(x)
++# define __raw_ioswabb(a,x)	(x)
++# define __raw_ioswabw(a,x)	(x)
++# define __raw_ioswabl(a,x)	(x)
++# define __raw_ioswabq(a,x)	(x)
++# define ____raw_ioswabq(a,x)	(x)
+ 
+-#else
+-
+-# define ioswabb(x)		(x)
+-# define __mem_ioswabb(x)	(x)
+-# define ioswabw(x)		(x)
+-# define __mem_ioswabw(x)	cpu_to_le16(x)
+-# define ioswabl(x)		(x)
+-# define __mem_ioswabl(x)	cpu_to_le32(x)
+-# define ioswabq(x)		(x)
+-# define __mem_ioswabq(x)	cpu_to_le32(x)
+-
+-#endif
++/* ioswab[bwlq], __mem_ioswab[bwlq] are defined in mangle-port.h */
+ 
+ #define IO_SPACE_LIMIT 0xffff
+ 
+@@ -346,7 +303,7 @@
+ 									\
+ 	__mem = (void *)__swizzle_addr_##bwlq((unsigned long)(mem));	\
+ 									\
+-	__val = pfx##ioswab##bwlq(val);					\
++	__val = pfx##ioswab##bwlq(__mem, val);				\
+ 									\
+ 	if (sizeof(type) != sizeof(u64) || sizeof(u64) == sizeof(long))	\
+ 		*__mem = __val;						\
+@@ -401,7 +358,7 @@
+ 		BUG();							\
+ 	}								\
+ 									\
+-	return pfx##ioswab##bwlq(__val);				\
++	return pfx##ioswab##bwlq(__mem, __val);				\
+ }
+ 
+ #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, p, slow)			\
+@@ -411,10 +368,9 @@
+ 	volatile type *__addr;						\
+ 	type __val;							\
+ 									\
+-	port = __swizzle_addr_##bwlq(port);				\
+-	__addr = (void *)(mips_io_port_base + port);			\
++	__addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
+ 									\
+-	__val = pfx##ioswab##bwlq(val);					\
++	__val = pfx##ioswab##bwlq(__addr, val);				\
+ 									\
+ 	/* Really, we want this to be atomic */				\
+ 	BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));		\
+@@ -428,15 +384,14 @@
+ 	volatile type *__addr;						\
+ 	type __val;							\
+ 									\
+-	port = __swizzle_addr_##bwlq(port);				\
+-	__addr = (void *)(mips_io_port_base + port);			\
++	__addr = (void *)__swizzle_addr_##bwlq(mips_io_port_base + port); \
+ 									\
+ 	BUILD_BUG_ON(sizeof(type) > sizeof(unsigned long));		\
+ 									\
+ 	__val = *__addr;						\
+ 	slow;								\
+ 									\
+-	return pfx##ioswab##bwlq(__val);				\
++	return pfx##ioswab##bwlq(__addr, __val);			\
+ }
+ 
+ #define __BUILD_MEMORY_PFX(bus, bwlq, type)				\
+diff -Naur linux-2.6.16.orig/include/asm-mips/mach-cobalt/cobalt.h linux-2.6.16/include/asm-mips/mach-cobalt/cobalt.h
+--- linux-2.6.16.orig/include/asm-mips/mach-cobalt/cobalt.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mach-cobalt/cobalt.h	2006-03-21 01:05:48.000000000 +0000
+@@ -113,4 +113,6 @@
+ # define COBALT_KEY_SELECT	(1 << 7)
+ # define COBALT_KEY_MASK	0xfe
+ 
++#define COBALT_UART		((volatile unsigned char *) CKSEG1ADDR(0x1c800000))
++
+ #endif /* __ASM_COBALT_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/mach-cobalt/ide.h linux-2.6.16/include/asm-mips/mach-cobalt/ide.h
+--- linux-2.6.16.orig/include/asm-mips/mach-cobalt/ide.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mach-cobalt/ide.h	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,83 @@
++
++/*
++ * PIO "in" transfers can cause D-cache lines to be allocated
++ * to the data being read. If the target is the page cache then
++ * the kernel can create a user space mapping of the same page
++ * without flushing it from the D-cache. This has large potential
++ * to create cache aliases. The Cobalts seem to trigger this
++ * problem easily.
++ *
++ * MIPs doesn't have a flush_dcache_range() so we roll
++ * our own.
++ *
++ * -- pdh
++ */
++
++#define MAX_HWIFS			2
++
++#include <asm/r4kcache.h>
++
++static inline void __flush_dcache(void)
++{
++	unsigned long dc_size, dc_line, addr, end;
++
++	dc_size = current_cpu_data.dcache.ways << current_cpu_data.dcache.waybit;
++	dc_line = current_cpu_data.dcache.linesz;
++
++	addr = CKSEG0;
++	end = addr + dc_size;
++
++	for (; addr < end; addr += dc_line)
++		flush_dcache_line_indexed(addr);
++}
++
++static inline void __flush_dcache_range(unsigned long start, unsigned long end)
++{
++	unsigned long dc_size, dc_line, addr;
++
++	dc_size = current_cpu_data.dcache.ways << current_cpu_data.dcache.waybit;
++	dc_line = current_cpu_data.dcache.linesz;
++
++	addr = start & ~(dc_line - 1);
++	end += dc_line - 1;
++
++	if (end - addr < dc_size)
++		for (; addr < end; addr += dc_line)
++			flush_dcache_line(addr);
++	else
++		__flush_dcache();
++}
++
++static inline void __ide_insw(unsigned long port, void *addr, unsigned int count)
++{
++	insw(port, addr, count);
++
++	__flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 2);
++}
++
++static inline void __ide_insl(unsigned long port, void *addr, unsigned int count)
++{
++	insl(port, addr, count);
++
++	__flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 4);
++}
++
++static inline void __ide_mm_insw(volatile void __iomem *port, void *addr, unsigned int count)
++{
++	readsw(port, addr, count);
++
++	__flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 2);
++}
++
++static inline void __ide_mm_insl(volatile void __iomem *port, void *addr, unsigned int count)
++{
++	readsl(port, addr, count);
++
++	__flush_dcache_range((unsigned long) addr, (unsigned long) addr + count * 4);
++}
++
++#define insw			__ide_insw
++#define insl			__ide_insl
++
++#define __ide_mm_outsw		writesw
++#define __ide_mm_outsl		writesl
+diff -Naur linux-2.6.16.orig/include/asm-mips/mach-generic/mangle-port.h linux-2.6.16/include/asm-mips/mach-generic/mangle-port.h
+--- linux-2.6.16.orig/include/asm-mips/mach-generic/mangle-port.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mach-generic/mangle-port.h	2006-03-21 01:05:48.000000000 +0000
+@@ -13,4 +13,40 @@
+ #define __swizzle_addr_l(port)	(port)
+ #define __swizzle_addr_q(port)	(port)
+ 
++/*
++ * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
++ * less sane hardware forces software to fiddle with this...
++ *
++ * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
++ * you can't have the numerical value of data and byte addresses within
++ * multibyte quantities both preserved at the same time.  Hence two
++ * variations of functions: non-prefixed ones that preserve the value
++ * and prefixed ones that preserve byte addresses.  The latters are
++ * typically used for moving raw data between a peripheral and memory (cf.
++ * string I/O functions), hence the "__mem_" prefix.
++ */
++#if defined(CONFIG_SWAP_IO_SPACE)
++
++# define ioswabb(a,x)		(x)
++# define __mem_ioswabb(a,x)	(x)
++# define ioswabw(a,x)		le16_to_cpu(x)
++# define __mem_ioswabw(a,x)	(x)
++# define ioswabl(a,x)		le32_to_cpu(x)
++# define __mem_ioswabl(a,x)	(x)
++# define ioswabq(a,x)		le64_to_cpu(x)
++# define __mem_ioswabq(a,x)	(x)
++
++#else
++
++# define ioswabb(a,x)		(x)
++# define __mem_ioswabb(a,x)	(x)
++# define ioswabw(a,x)		(x)
++# define __mem_ioswabw(a,x)	cpu_to_le16(x)
++# define ioswabl(a,x)		(x)
++# define __mem_ioswabl(a,x)	cpu_to_le32(x)
++# define ioswabq(a,x)		(x)
++# define __mem_ioswabq(a,x)	cpu_to_le32(x)
++
++#endif
++
+ #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/mach-ip27/mangle-port.h linux-2.6.16/include/asm-mips/mach-ip27/mangle-port.h
+--- linux-2.6.16.orig/include/asm-mips/mach-ip27/mangle-port.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mach-ip27/mangle-port.h	2006-03-21 01:05:48.000000000 +0000
+@@ -13,4 +13,13 @@
+ #define __swizzle_addr_l(port)	(port)
+ #define __swizzle_addr_q(port)	(port)
+ 
++# define ioswabb(a,x)		(x)
++# define __mem_ioswabb(a,x)	(x)
++# define ioswabw(a,x)		(x)
++# define __mem_ioswabw(a,x)	cpu_to_le16(x)
++# define ioswabl(a,x)		(x)
++# define __mem_ioswabl(a,x)	cpu_to_le32(x)
++# define ioswabq(a,x)		(x)
++# define __mem_ioswabq(a,x)	cpu_to_le32(x)
++
+ #endif /* __ASM_MACH_IP27_MANGLE_PORT_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/mach-ip32/mangle-port.h linux-2.6.16/include/asm-mips/mach-ip32/mangle-port.h
+--- linux-2.6.16.orig/include/asm-mips/mach-ip32/mangle-port.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mach-ip32/mangle-port.h	2006-03-21 01:05:48.000000000 +0000
+@@ -14,4 +14,13 @@
+ #define __swizzle_addr_l(port)	(port)
+ #define __swizzle_addr_q(port)	(port)
+ 
++# define ioswabb(a,x)		(x)
++# define __mem_ioswabb(a,x)	(x)
++# define ioswabw(a,x)		(x)
++# define __mem_ioswabw(a,x)	cpu_to_le16(x)
++# define ioswabl(a,x)		(x)
++# define __mem_ioswabl(a,x)	cpu_to_le32(x)
++# define ioswabq(a,x)		(x)
++# define __mem_ioswabq(a,x)	cpu_to_le32(x)
++
+ #endif /* __ASM_MACH_IP32_MANGLE_PORT_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/mach-vr41xx/timex.h linux-2.6.16/include/asm-mips/mach-vr41xx/timex.h
+--- linux-2.6.16.orig/include/asm-mips/mach-vr41xx/timex.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mach-vr41xx/timex.h	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,18 @@
++/*
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License.  See the file "COPYING" in the main directory of this archive
++ * for more details.
++ *
++ * Copyright (C) 2003 by Ralf Baechle
++ */
++/*
++ * Changes:
++ *  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
++ *  - CLOCK_TICK_RATE is changed into 32768 from 6144000.
++ */
++#ifndef __ASM_MACH_VR41XX_TIMEX_H
++#define __ASM_MACH_VR41XX_TIMEX_H
++
++#define CLOCK_TICK_RATE		32768
++
++#endif /* __ASM_MACH_VR41XX_TIMEX_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/mmu_context.h linux-2.6.16/include/asm-mips/mmu_context.h
+--- linux-2.6.16.orig/include/asm-mips/mmu_context.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/mmu_context.h	2006-03-21 01:05:48.000000000 +0000
+@@ -33,12 +33,7 @@
+ 	write_c0_context((unsigned long) smp_processor_id() << 25);	\
+ 	TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
+ #endif
+-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+-#define TLBMISS_HANDLER_SETUP()						\
+-	write_c0_context((unsigned long) &pgd_current[smp_processor_id()] << 23); \
+-	TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
+-#endif
+-#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
++#ifdef CONFIG_64BIT
+ #define TLBMISS_HANDLER_SETUP()						\
+ 	write_c0_context((unsigned long) smp_processor_id() << 26);	\
+ 	TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
+diff -Naur linux-2.6.16.orig/include/asm-mips/r4kcache.h linux-2.6.16/include/asm-mips/r4kcache.h
+--- linux-2.6.16.orig/include/asm-mips/r4kcache.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/r4kcache.h	2006-03-21 01:05:48.000000000 +0000
+@@ -303,5 +303,6 @@
+ __BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, )
+ /* blast_inv_dcache_range */
+ __BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, )
++__BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, )
+ 
+ #endif /* _ASM_R4KCACHE_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/serial.h linux-2.6.16/include/asm-mips/serial.h
+--- linux-2.6.16.orig/include/asm-mips/serial.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/serial.h	2006-03-21 01:05:48.000000000 +0000
+@@ -103,88 +103,6 @@
+ #define IVR_SERIAL_PORT_DEFNS
+ #endif
+ 
+-#ifdef CONFIG_SERIAL_AU1X00
+-#include <asm/mach-au1x00/au1000.h>
+-#ifdef CONFIG_SOC_AU1000
+-#define AU1000_SERIAL_PORT_DEFNS                       \
+-    { .baud_base = 0, .port = UART0_ADDR,              \
+-      .iomem_base = (unsigned char *)UART0_ADDR,       \
+-      .irq = AU1000_UART0_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART1_ADDR,              \
+-      .iomem_base = (unsigned char *)UART1_ADDR,       \
+-      .irq = AU1000_UART1_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART2_ADDR,              \
+-      .iomem_base = (unsigned char *)UART2_ADDR,       \
+-      .irq = AU1000_UART2_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART3_ADDR,              \
+-      .iomem_base = (unsigned char *)UART3_ADDR,       \
+-      .irq = AU1000_UART3_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },
+-#endif
+-
+-#ifdef CONFIG_SOC_AU1500
+-#define AU1000_SERIAL_PORT_DEFNS                       \
+-    { .baud_base = 0, .port = UART0_ADDR,              \
+-      .iomem_base = (unsigned char *)UART0_ADDR,       \
+-      .irq = AU1500_UART0_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART3_ADDR,              \
+-      .iomem_base = (unsigned char *)UART3_ADDR,       \
+-      .irq = AU1500_UART3_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },
+-#endif
+-
+-#ifdef CONFIG_SOC_AU1100
+-#define AU1000_SERIAL_PORT_DEFNS                       \
+-    { .baud_base = 0, .port = UART0_ADDR,              \
+-      .iomem_base = (unsigned char *)UART0_ADDR,       \
+-      .irq = AU1100_UART0_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART1_ADDR,              \
+-      .iomem_base = (unsigned char *)UART1_ADDR,       \
+-      .irq = AU1100_UART1_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART3_ADDR,              \
+-      .iomem_base = (unsigned char *)UART3_ADDR,       \
+-      .irq = AU1100_UART3_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },
+-#endif
+-
+-#ifdef CONFIG_SOC_AU1550
+-#define AU1000_SERIAL_PORT_DEFNS                       \
+-    { .baud_base = 0, .port = UART0_ADDR,              \
+-      .iomem_base = (unsigned char *)UART0_ADDR,       \
+-      .irq = AU1550_UART0_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART1_ADDR,              \
+-      .iomem_base = (unsigned char *)UART1_ADDR,       \
+-      .irq = AU1550_UART1_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART3_ADDR,              \
+-      .iomem_base = (unsigned char *)UART3_ADDR,       \
+-      .irq = AU1550_UART3_INT,  .flags = STD_COM_FLAGS,\
+-      .iomem_reg_shift = 2 },
+-#endif
+-
+-#ifdef CONFIG_SOC_AU1200
+-#define AU1000_SERIAL_PORT_DEFNS                       \
+-    { .baud_base = 0, .port = UART0_ADDR,              \
+-      .iomem_base = (unsigned char *)UART0_ADDR,       \
+-      .irq = AU1200_UART0_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },                          \
+-    { .baud_base = 0, .port = UART1_ADDR,              \
+-      .iomem_base = (unsigned char *)UART1_ADDR,       \
+-      .irq = AU1200_UART1_INT, .flags = STD_COM_FLAGS, \
+-      .iomem_reg_shift = 2 },
+-#endif
+-
+-#else
+-#define AU1000_SERIAL_PORT_DEFNS
+-#endif
+-
+ #ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
+ #define STD_SERIAL_PORT_DEFNS			\
+ 	/* UART CLK   PORT IRQ     FLAGS        */			\
+@@ -331,7 +249,6 @@
+ 	MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS		\
+ 	MOMENCO_OCELOT_C_SERIAL_PORT_DEFNS		\
+ 	MOMENCO_OCELOT_SERIAL_PORT_DEFNS		\
+-	MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS		\
+-	AU1000_SERIAL_PORT_DEFNS
++	MOMENCO_OCELOT_3_SERIAL_PORT_DEFNS
+ 
+ #endif /* _ASM_SERIAL_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/signal.h linux-2.6.16/include/asm-mips/signal.h
+--- linux-2.6.16.orig/include/asm-mips/signal.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/signal.h	2006-03-21 01:05:48.000000000 +0000
+@@ -147,16 +147,34 @@
+ 
+ /* IRIX compatible stack_t  */
+ typedef struct sigaltstack {
+-	void *ss_sp;
++	void __user *ss_sp;
+ 	size_t ss_size;
+ 	int ss_flags;
+ } stack_t;
+ 
+ #ifdef __KERNEL__
+ #include <asm/sigcontext.h>
++#include <asm/siginfo.h>
+ 
+ #define ptrace_signal_deliver(regs, cookie) do { } while (0)
+ 
++struct pt_regs;
++extern void do_signal(struct pt_regs *regs);
++extern void do_signal32(struct pt_regs *regs);
++
++extern int setup_frame(struct k_sigaction * ka, struct pt_regs *regs,
++        int signr, sigset_t *set);
++extern int setup_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
++        int signr, sigset_t *set, siginfo_t *info);
++
++extern int setup_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
++        int signr, sigset_t *set);
++extern int setup_rt_frame_32(struct k_sigaction * ka, struct pt_regs *regs,
++        int signr, sigset_t *set, siginfo_t *info);
++
++extern int setup_rt_frame_n32(struct k_sigaction * ka, struct pt_regs *regs,
++        int signr, sigset_t *set, siginfo_t *info);
++
+ #endif /* __KERNEL__ */
+ 
+ #endif /* _ASM_SIGNAL_H */
+diff -Naur linux-2.6.16.orig/include/asm-mips/sn/mapped_kernel.h linux-2.6.16/include/asm-mips/sn/mapped_kernel.h
+--- linux-2.6.16.orig/include/asm-mips/sn/mapped_kernel.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/sn/mapped_kernel.h	2006-03-21 01:05:48.000000000 +0000
+@@ -23,11 +23,7 @@
+ #include <linux/config.h>
+ #include <asm/addrspace.h>
+ 
+-#ifdef CONFIG_BUILD_ELF64
+ #define REP_BASE	CAC_BASE
+-#else
+-#define REP_BASE	CKSEG0
+-#endif
+ 
+ #ifdef CONFIG_MAPPED_KERNEL
+ 
+diff -Naur linux-2.6.16.orig/include/asm-mips/stackframe.h linux-2.6.16/include/asm-mips/stackframe.h
+--- linux-2.6.16.orig/include/asm-mips/stackframe.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/asm-mips/stackframe.h	2006-03-21 01:05:48.000000000 +0000
+@@ -63,17 +63,7 @@
+ 		addu	k1, k0
+ 		LONG_L	k1, %lo(kernelsp)(k1)
+ #endif
+-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+-		MFC0	k1, CP0_CONTEXT
+-		dsra	k1, 23
+-		lui	k0, %hi(pgd_current)
+-		addiu	k0, %lo(pgd_current)
+-		dsubu	k1, k0
+-		lui	k0, %hi(kernelsp)
+-		daddu	k1, k0
+-		LONG_L	k1, %lo(kernelsp)(k1)
+-#endif
+-#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
++#ifdef CONFIG_64BIT
+ 		MFC0	k1, CP0_CONTEXT
+ 		lui	k0, %highest(kernelsp)
+ 		dsrl	k1, 23
+@@ -91,11 +81,7 @@
+ 		mfc0	\temp, CP0_CONTEXT
+ 		srl	\temp, 23
+ #endif
+-#if defined(CONFIG_64BIT) && !defined(CONFIG_BUILD_ELF64)
+-		lw	\temp, TI_CPU(gp)
+-		dsll	\temp, 3
+-#endif
+-#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
++#ifdef CONFIG_64BIT
+ 		MFC0	\temp, CP0_CONTEXT
+ 		dsrl	\temp, 23
+ #endif
+@@ -103,7 +89,7 @@
+ 		.endm
+ #else
+ 		.macro	get_saved_sp	/* Uniprocessor variation */
+-#if defined(CONFIG_64BIT) && defined(CONFIG_BUILD_ELF64)
++#ifdef CONFIG_64BIT
+ 		lui	k1, %highest(kernelsp)
+ 		daddiu	k1, %higher(kernelsp)
+ 		dsll	k1, k1, 16
+diff -Naur linux-2.6.16.orig/include/linux/elf.h linux-2.6.16/include/linux/elf.h
+--- linux-2.6.16.orig/include/linux/elf.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/linux/elf.h	2006-03-21 01:05:48.000000000 +0000
+@@ -67,7 +67,7 @@
+ 
+ #define EM_MIPS		8	/* MIPS R3000 (officially, big-endian only) */
+ 
+-#define EM_MIPS_RS4_BE 10	/* MIPS R4000 big-endian */
++#define EM_MIPS_RS3_LE 10	/* MIPS R3000 little-endian */
+ 
+ #define EM_PARISC      15	/* HPPA */
+ 
+diff -Naur linux-2.6.16.orig/include/linux/mc146818rtc.h linux-2.6.16/include/linux/mc146818rtc.h
+--- linux-2.6.16.orig/include/linux/mc146818rtc.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/linux/mc146818rtc.h	2006-03-21 01:05:48.000000000 +0000
+@@ -89,4 +89,12 @@
+ # define RTC_VRT 0x80		/* valid RAM and time */
+ /**********************************************************************/
+ 
++#ifndef RTC_IO_EXTENT
++#define RTC_IO_EXTENT	0x8
++#endif
++
++#ifndef RTC_IOMAPPED
++#define RTC_IOMAPPED	1	/* Default to I/O mapping. */
++#endif
++
+ #endif /* _MC146818RTC_H */
+diff -Naur linux-2.6.16.orig/include/linux/pci_ids.h linux-2.6.16/include/linux/pci_ids.h
+--- linux-2.6.16.orig/include/linux/pci_ids.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/linux/pci_ids.h	2006-03-21 01:05:48.000000000 +0000
+@@ -1556,6 +1556,9 @@
+ #define PCI_VENDOR_ID_SATSAGEM		0x1267
+ #define PCI_DEVICE_ID_SATSAGEM_NICCY	0x1016
+ 
++#define PCI_VENDOR_ID_SILICON_MOTION		0x126f
++#define PCI_DEVICE_ID_SM501_VOYAGER_GX_REV_AA	0x0501
++#define PCI_DEVICE_ID_SM501_VOYAGER_GX_REV_B	0x0510
+ 
+ #define PCI_VENDOR_ID_ENSONIQ		0x1274
+ #define PCI_DEVICE_ID_ENSONIQ_CT5880	0x5880
+diff -Naur linux-2.6.16.orig/include/linux/serial.h linux-2.6.16/include/linux/serial.h
+--- linux-2.6.16.orig/include/linux/serial.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/linux/serial.h	2006-03-21 01:05:48.000000000 +0000
+@@ -76,7 +76,8 @@
+ #define PORT_16654	11
+ #define PORT_16850	12
+ #define PORT_RSA	13	/* RSA-DV II/S card */
+-#define PORT_MAX	13
++#define PORT_SB1250	14
++#define PORT_MAX	14
+ 
+ #define SERIAL_IO_PORT	0
+ #define SERIAL_IO_HUB6	1
+diff -Naur linux-2.6.16.orig/include/linux/serial_ip3106.h linux-2.6.16/include/linux/serial_ip3106.h
+--- linux-2.6.16.orig/include/linux/serial_ip3106.h	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/include/linux/serial_ip3106.h	2006-03-21 01:05:48.000000000 +0000
+@@ -78,4 +78,16 @@
+ #define IP3106_UART_FIFO_RXFIFO		0x00001F00
+ #define IP3106_UART_FIFO_RBRTHR		0x000000FF
+ 
++#define ip3106_lcr(base,port)    *(volatile u32 *)(base+(port*0x1000) + 0x000)
++#define ip3106_mcr(base, port)   *(volatile u32 *)(base+(port*0x1000) + 0x004)
++#define ip3106_baud(base, port)  *(volatile u32 *)(base+(port*0x1000) + 0x008)
++#define ip3106_cfg(base, port)   *(volatile u32 *)(base+(port*0x1000) + 0x00C)
++#define ip3106_fifo(base, port)	 *(volatile u32 *)(base+(port*0x1000) + 0x028)
++#define ip3106_istat(base, port) *(volatile u32 *)(base+(port*0x1000) + 0xFE0)
++#define ip3106_ien(base, port)   *(volatile u32 *)(base+(port*0x1000) + 0xFE4)
++#define ip3106_iclr(base, port)  *(volatile u32 *)(base+(port*0x1000) + 0xFE8)
++#define ip3106_iset(base, port)  *(volatile u32 *)(base+(port*0x1000) + 0xFEC)
++#define ip3106_pd(base, port)    *(volatile u32 *)(base+(port*0x1000) + 0xFF4)
++#define ip3106_mid(base, port)   *(volatile u32 *)(base+(port*0x1000) + 0xFFC)
++
+ #endif
+diff -Naur linux-2.6.16.orig/sound/oss/Kconfig linux-2.6.16/sound/oss/Kconfig
+--- linux-2.6.16.orig/sound/oss/Kconfig	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/sound/oss/Kconfig	2006-03-21 01:05:48.000000000 +0000
+@@ -239,6 +239,10 @@
+ 	tristate "Au1550 AC97 Sound"
+ 	depends on SOUND_PRIME && SOC_AU1550
+ 
++config SOUND_AU1550_I2S
++	tristate "Au1550 I2S Sound"
++	depends on SOUND_PRIME && SOC_AU1550
++
+ config SOUND_TRIDENT
+ 	tristate "Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core"
+ 	depends on SOUND_PRIME && PCI
+diff -Naur linux-2.6.16.orig/sound/oss/Makefile linux-2.6.16/sound/oss/Makefile
+--- linux-2.6.16.orig/sound/oss/Makefile	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/sound/oss/Makefile	2006-03-21 01:05:48.000000000 +0000
+@@ -66,6 +66,7 @@
+ obj-$(CONFIG_SOUND_VRC5477)	+= nec_vrc5477.o ac97_codec.o
+ obj-$(CONFIG_SOUND_AU1000)	+= au1000.o ac97_codec.o
+ obj-$(CONFIG_SOUND_AU1550_AC97)	+= au1550_ac97.o ac97_codec.o
++obj-$(CONFIG_SOUND_AU1550_I2S)	+= au1550_i2s.o
+ obj-$(CONFIG_SOUND_ESSSOLO1)	+= esssolo1.o
+ obj-$(CONFIG_SOUND_FUSION)	+= cs46xx.o ac97_codec.o
+ obj-$(CONFIG_SOUND_MAESTRO)	+= maestro.o
+diff -Naur linux-2.6.16.orig/sound/oss/au1550_ac97.c linux-2.6.16/sound/oss/au1550_ac97.c
+--- linux-2.6.16.orig/sound/oss/au1550_ac97.c	2006-03-20 05:53:29.000000000 +0000
++++ linux-2.6.16/sound/oss/au1550_ac97.c	2006-03-21 01:05:48.000000000 +0000
+@@ -58,6 +58,7 @@
+ #include <asm/mach-au1x00/au1000.h>
+ #include <asm/mach-au1x00/au1xxx_psc.h>
+ #include <asm/mach-au1x00/au1xxx_dbdma.h>
++#include <asm/mach-pb1x00/pb1550.h>
+ 
+ #undef OSS_DOCUMENTED_MIXER_SEMANTICS
+ 
+diff -Naur linux-2.6.16.orig/sound/oss/au1550_i2s.c linux-2.6.16/sound/oss/au1550_i2s.c
+--- linux-2.6.16.orig/sound/oss/au1550_i2s.c	1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.16/sound/oss/au1550_i2s.c	2006-03-21 01:05:48.000000000 +0000
+@@ -0,0 +1,2029 @@
++/*
++ *      au1550_i2s.c  --  Sound driver for Alchemy Au1550 MIPS
++ *			Internet Edge Processor.
++ *
++ * Copyright 2004 Embedded Edge, LLC
++ *	dan@embeddededge.com
++ * Copyright 2005 Matt Porter <mporter@kernel.crashing.org>
++ *
++ * Mostly copied from the au1550_psc.c driver and some from the
++ * PowerMac dbdma driver.
++ * We assume the processor can do memory coherent DMA.
++ *
++ * WM8731 mixer support, codec framework, cleanup, and 2.6 port
++ * Matt Porter <mporter@kernel.crashing.org>
++ *
++ * The SMBus (I2C) is required for the control of the
++ * appears at I2C address 0x36 (I2C binary 0011011).  The Pb1550
++ * uses the Wolfson WM8731 codec, which is controlled over the I2C.
++ * It's connected to a 12MHz clock, so we can only reliably support
++ * 96KHz, 48KHz, 32KHz, and 8KHz data rates.  Variable rate audio is
++ * unsupported, we currently force it to 48KHz.
++ *
++ *  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
++ *  Free Software Foundation;  either version 2 of the  License, or (at your
++ *  option) any later version.
++ *
++ *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
++ *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
++ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
++ *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
++ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
++ *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
++ *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
++ *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
++ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
++ *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ *  You should have received a copy of the  GNU General Public License along
++ *  with this program; if not, write  to the Free Software Foundation, Inc.,
++ *  675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ */
++#include <linux/module.h>
++#include <linux/string.h>
++#include <linux/ioport.h>
++#include <linux/sched.h>
++#include <linux/delay.h>
++#include <linux/fs.h>
++#include <linux/hardirq.h>
++#include <linux/sound.h>
++#include <linux/slab.h>
++#include <linux/soundcard.h>
++#include <linux/init.h>
++#include <linux/poll.h>
++#include <linux/pci.h>
++#include <linux/bitops.h>
++#include <linux/proc_fs.h>
++#include <linux/spinlock.h>
++#include <linux/smp_lock.h>
++
++#include <asm/io.h>
++#include <asm/uaccess.h>
++#include <asm/hardirq.h>
++
++#include <asm/mach-au1x00/au1000.h>
++#include <asm/mach-au1x00/au1xxx_psc.h>
++#include <asm/mach-au1x00/au1xxx_dbdma.h>
++#include <asm/mach-pb1x00/pb1550.h>
++
++#undef OSS_DOCUMENTED_MIXER_SEMANTICS
++
++#define AU1550_MODULE_NAME "Au1550 I2S Audio"
++#define PFX AU1550_MODULE_NAME
++
++/* Define this if you want to try running at the 44.1 KHz rate.
++ * It's just a little off, I think it's actually 44117 or something.
++ * I did this for debugging, since many programs, including this
++ * driver, will try to upsample from 44.1 to 48 KHz.
++ * Seems to work well, we'll just leave it this way.
++ */
++#define TRY_441KHz
++
++#ifdef TRY_441KHz
++#define SAMP_RATE	44100
++#else
++#define SAMP_RATE	48000
++#endif
++
++/* The number of DBDMA ring descriptors to allocate.  No sense making
++ * this too large....if you can't keep up with a few you aren't likely
++ * to be able to with lots of them, either.
++ */
++#define NUM_DBDMA_DESCRIPTORS 4
++
++#define pr_error(format, arg...) printk(KERN_ERR PFX ": " format "\n" , ## arg)
++
++static void
++au1550_delay(int msec)
++{
++	unsigned long   tmo;
++	signed long     tmo2;
++
++	if (in_interrupt())
++		return;
++
++	tmo = jiffies + (msec * HZ) / 1000;
++	for (;;) {
++		tmo2 = tmo - jiffies;
++		if (tmo2 <= 0)
++			break;
++		schedule_timeout(tmo2);
++	}
++}
++
++/*
++ * Codec framework. If somebody supports another codec, they
++ * should hopefully be able to define another struct i2s_codec
++ * definition, and #ifdef the support for it and the WM8731 so
++ * they can be selected via a CONFIG option. For now, we just
++ * hardcode WM8731_CODEC.
++ */
++#define i2s_supported_mixer(CODEC,FOO) ((FOO >= 0) && \
++                                    (FOO < SOUND_MIXER_NRDEVICES) && \
++                                    (CODEC)->supported_mixers & (1<<FOO) )
++
++struct i2s_codec {
++	int			modcnt;
++	int			supported_mixers;
++	int			stereo_mixers;
++	int			record_sources;
++	unsigned int		mixer_state[SOUND_MIXER_NRDEVICES];
++	void			*data;
++	int			(*set_mixer) (struct i2s_codec *codec, unsigned int oss_mixer, unsigned int val);
++	void			(*init_codec) (struct i2s_codec *codec);
++};
++
++#define WM8731_CODEC
++#ifdef WM8731_CODEC
++/*
++ * WM8731 codec support
++ */
++#define WM8731_SUPPORTED_MASK (WM8731_STEREO_MASK|WM8731_RECORD_MASK)
++#define WM8731_STEREO_MASK (SOUND_MASK_VOLUME|SOUND_MASK_LINE)
++#define WM8731_RECORD_MASK (SOUND_MASK_MIC|SOUND_MASK_LINE)
++
++static struct codec_data {
++	u16			audio_path;
++} wm8731_data;
++
++static void
++wm8731_wrcodec(u8 ctlreg, u8 val)
++{
++	int	rcnt;
++	extern int pb1550_wm_codec_write(u8 addr, u8 reg, u8 val);
++
++	/* The codec is a write only device, with a 16-bit control/data
++	 * word.  Although it is written as two bytes on the I2C, the
++	 * format is actually 7 bits of register and 9 bits of data.
++	 * The ls bit of the first byte is the ms bit of the data.
++	 */
++	rcnt = 0;
++	while ((pb1550_wm_codec_write((0x36 >> 1), ctlreg, val) != 1)
++							&& (rcnt < 50)) {
++		rcnt++;
++	}
++}
++
++static int
++wm8731_set_mixer(struct i2s_codec *codec, unsigned int oss_mixer, unsigned int val)
++{
++	unsigned int lvol, rvol;
++	struct codec_data *cdata = (struct codec_data *)codec->data;
++
++	switch (oss_mixer) {
++		case SOUND_MIXER_VOLUME:
++			/* normalize OSS range to fit codec volume control */
++			lvol = ((((val & 0x7f00) >> 8) * 0x60) / 0x64) + 0x1f;
++			rvol = (((val & 0x7f) * 0x60) / 0x64) + 0x1f;
++			lvol |= 0x80;
++			rvol |= 0x80;
++			wm8731_wrcodec(0x04, lvol);
++			au1550_delay(10);
++			wm8731_wrcodec(0x06, rvol);
++			au1550_delay(10);
++			codec->mixer_state[oss_mixer] = val;
++			break;
++		case SOUND_MIXER_LINE:
++			/* normalize OSS range to fit codec line control */
++			lvol = ((((val & 0x7f00) >> 8) * 0x1f) / 0x64);
++			rvol = (((val & 0x7f) * 0x1f) / 0x64);
++			if (!(val & 0x1f00))
++				lvol |= 0x80;
++			else
++				lvol &= ~0x80;
++			if (!(val & 0x001f))
++				rvol |= 0x80;
++			else
++				rvol &= ~0x80;
++			wm8731_wrcodec(0x00, lvol);
++			au1550_delay(10);
++			wm8731_wrcodec(0x02, rvol);
++			au1550_delay(10);
++			codec->mixer_state[oss_mixer] = val;
++			break;
++		case SOUND_MIXER_MIC:
++			if (!val)
++				cdata->audio_path |= 0x02;
++			else {
++				if (val >= 0x32)
++					cdata->audio_path |= 0x01;
++				else
++					cdata->audio_path &= ~0x01;
++				cdata->audio_path &= ~0x02;
++			}
++			wm8731_wrcodec(0x08, cdata->audio_path);
++			au1550_delay(10);
++			codec->mixer_state[oss_mixer] = val;
++			break;
++		case SOUND_MIXER_RECSRC:
++			if (val & SOUND_MASK_LINE)
++				cdata->audio_path &= ~0x04;
++			else
++				cdata->audio_path |= 0x04;
++			wm8731_wrcodec(0x08, cdata->audio_path);
++			au1550_delay(10);
++			codec->mixer_state[oss_mixer] = val;
++			break;
++		default:
++			return -EINVAL;
++	}
++
++	return 0;
++}
++
++void
++wm8731_init_codec(struct i2s_codec *codec)
++{
++	struct codec_data *cdata = (struct codec_data *)codec->data;
++
++	wm8731_wrcodec(0x1e, 0x00);	/* Reset */
++	au1550_delay(200);
++	wm8731_wrcodec(0x0c, 0x00);	/* Power up everything */
++	au1550_delay(10);
++	wm8731_wrcodec(0x12, 0x00);	/* Deactivate codec */
++	au1550_delay(10);
++	cdata->audio_path = 0x10;
++	/* Select DAC outputs to line out */
++	wm8731_wrcodec(0x08, cdata->audio_path);
++	au1550_delay(10);
++	wm8731_wrcodec(0x0a, 0x00);	/* Disable output mute */
++	au1550_delay(10);
++	wm8731_wrcodec(0x0e, 0x02);	/* Set slave, 16-bit, I2S modes */
++	au1550_delay(10);
++	wm8731_wrcodec(0x10, 0x01);	/* 12MHz (USB), 250fs */
++	au1550_delay(10);
++	wm8731_wrcodec(0x12, 0x01);	/* Activate codec */
++	au1550_delay(10);
++
++	codec->set_mixer(codec, SOUND_MIXER_VOLUME, 0x5050);
++	codec->set_mixer(codec, SOUND_MIXER_LINE, 0x0000);
++	codec->set_mixer(codec, SOUND_MIXER_MIC, 0x00);
++	codec->mixer_state[SOUND_MIXER_RECSRC] = SOUND_MIXER_LINE;
++}
++
++static struct i2s_codec au1550_i2s_codec = {
++	.supported_mixers	= WM8731_SUPPORTED_MASK,
++	.stereo_mixers		= WM8731_STEREO_MASK,
++	.record_sources		= WM8731_RECORD_MASK,
++	.init_codec		= &wm8731_init_codec,
++	.set_mixer		= &wm8731_set_mixer,
++	.data			= &wm8731_data,
++};
++#endif /* WM8731_CODEC */
++
++static struct au1550_state {
++	/* soundcore stuff */
++	int             dev_audio;
++	int		dev_mixer;
++
++	spinlock_t		lock;
++	struct semaphore	open_sem;
++	struct semaphore	sem;
++	mode_t			open_mode;
++	wait_queue_head_t	open_wait;
++	volatile psc_i2s_t	*psc_addr;
++	struct i2s_codec	*codec;
++
++	struct dmabuf {
++		u32		dmanr;
++		unsigned        sample_rate;
++		unsigned	src_factor;
++		unsigned        sample_size;
++		int             num_channels;
++		int		dma_bytes_per_sample;
++		int		user_bytes_per_sample;
++		int		cnt_factor;
++
++		void		*rawbuf;
++		unsigned        buforder;
++		unsigned	numfrag;
++		unsigned        fragshift;
++		void		*nextIn;
++		void		*nextOut;
++		int		count;
++		unsigned        total_bytes;
++		unsigned        error;
++		wait_queue_head_t wait;
++
++		/* redundant, but makes calculations easier */
++		unsigned	fragsize;
++		unsigned	dma_fragsize;
++		unsigned	dmasize;
++		unsigned	dma_qcount;
++
++		/* OSS stuff */
++		unsigned        mapped:1;
++		unsigned        ready:1;
++		unsigned        stopped:1;
++		unsigned        ossfragshift;
++		int             ossmaxfrags;
++		unsigned        subdivision;
++
++		/* Mixer stuff */
++		int		dev_mixer;
++	} dma_dac, dma_adc;
++} au1550_state;
++
++static unsigned
++ld2(unsigned int x)
++{
++	unsigned        r = 0;
++
++	if (x >= 0x10000) {
++		x >>= 16;
++		r += 16;
++	}
++	if (x >= 0x100) {
++		x >>= 8;
++		r += 8;
++	}
++	if (x >= 0x10) {
++		x >>= 4;
++		r += 4;
++	}
++	if (x >= 4) {
++		x >>= 2;
++		r += 2;
++	}
++	if (x >= 2)
++		r++;
++	return r;
++}
++
++/* stop the ADC before calling */
++static void
++set_adc_rate(struct au1550_state *s, unsigned rate)
++{
++	struct dmabuf  *adc = &s->dma_adc;
++
++	/* calc SRC factor */
++	adc->src_factor = (((SAMP_RATE*2) / rate) + 1) >> 1;
++	adc->sample_rate = SAMP_RATE / adc->src_factor;
++	return;
++
++	adc->src_factor = 1;
++}
++
++/* stop the DAC before calling */
++static void
++set_dac_rate(struct au1550_state *s, unsigned rate)
++{
++	struct dmabuf  *dac = &s->dma_dac;
++
++	/* calc SRC factor */
++	dac->src_factor = (((SAMP_RATE*2) / rate) + 1) >> 1;
++	dac->sample_rate = SAMP_RATE / dac->src_factor;
++	return;
++
++	dac->src_factor = 1;
++}
++
++static void
++stop_dac(struct au1550_state *s)
++{
++	struct dmabuf  *db = &s->dma_dac;
++	unsigned long   flags;
++	uint	stat;
++	volatile psc_i2s_t *ip;
++
++	if (db->stopped)
++		return;
++
++	ip = s->psc_addr;
++	spin_lock_irqsave(&s->lock, flags);
++
++	ip->psc_i2spcr = PSC_I2SPCR_TP;
++	au_sync();
++
++	/* Wait for Transmit Busy to show disabled.
++	*/
++	do {
++		stat = ip->psc_i2sstat;
++		au_sync();
++	} while ((stat & PSC_I2SSTAT_TB) != 0);
++
++	au1xxx_dbdma_reset(db->dmanr);
++
++	db->stopped = 1;
++
++	spin_unlock_irqrestore(&s->lock, flags);
++}
++
++static void
++stop_adc(struct au1550_state *s)
++{
++	struct dmabuf  *db = &s->dma_adc;
++	unsigned long   flags;
++	uint	stat;
++	volatile psc_i2s_t *ip;
++
++	if (db->stopped)
++		return;
++
++	ip = s->psc_addr;
++	spin_lock_irqsave(&s->lock, flags);
++
++	ip->psc_i2spcr = PSC_I2SPCR_RP;
++	au_sync();
++
++	/* Wait for Receive Busy to show disabled.
++	*/
++	do {
++		stat = ip->psc_i2sstat;
++		au_sync();
++	} while ((stat & PSC_I2SSTAT_RB) != 0);
++
++	au1xxx_dbdma_reset(db->dmanr);
++
++	db->stopped = 1;
++
++	spin_unlock_irqrestore(&s->lock, flags);
++}
++
++static void
++set_xmit_slots(int num_channels)
++{
++	/* This is here just as a place holder.  The WM8731 only
++	 * supports two fixed channels.
++	 */
++}
++
++static void
++set_recv_slots(int num_channels)
++{
++	/* This is here just as a place holder.  The WM8731 only
++	 * supports two fixed channels.
++	 */
++}
++
++static void
++start_dac(struct au1550_state *s)
++{
++	struct dmabuf  *db = &s->dma_dac;
++	unsigned long   flags;
++	volatile psc_i2s_t *ip;
++
++	if (!db->stopped)
++		return;
++
++	spin_lock_irqsave(&s->lock, flags);
++
++	ip = s->psc_addr;
++	set_xmit_slots(db->num_channels);
++	ip->psc_i2spcr = PSC_I2SPCR_TC;
++	au_sync();
++	ip->psc_i2spcr = PSC_I2SPCR_TS;
++	au_sync();
++
++	au1xxx_dbdma_start(db->dmanr);
++
++	db->stopped = 0;
++
++	spin_unlock_irqrestore(&s->lock, flags);
++}
++
++static void
++start_adc(struct au1550_state *s)
++{
++	struct dmabuf  *db = &s->dma_adc;
++	int	i;
++	volatile psc_i2s_t *ip;
++
++	if (!db->stopped)
++		return;
++
++	/* Put two buffers on the ring to get things started.
++	*/
++	for (i=0; i<2; i++) {
++		au1xxx_dbdma_put_dest(db->dmanr, db->nextIn, db->dma_fragsize);
++
++		db->nextIn += db->dma_fragsize;
++		if (db->nextIn >= db->rawbuf + db->dmasize)
++			db->nextIn -= db->dmasize;
++	}
++
++	ip = s->psc_addr;
++	set_recv_slots(db->num_channels);
++	au1xxx_dbdma_start(db->dmanr);
++	ip->psc_i2spcr = PSC_I2SPCR_RC;
++	au_sync();
++	ip->psc_i2spcr = PSC_I2SPCR_RS;
++	au_sync();
++
++	db->stopped = 0;
++}
++
++static int
++prog_dmabuf(struct au1550_state *s, struct dmabuf *db)
++{
++	unsigned user_bytes_per_sec;
++	unsigned        bufs;
++	unsigned        rate = db->sample_rate;
++
++	if (!db->rawbuf) {
++		db->ready = db->mapped = 0;
++		db->buforder = 5;	/* 32 * PAGE_SIZE */
++		db->rawbuf = kmalloc((PAGE_SIZE << db->buforder), GFP_KERNEL);
++		if (!db->rawbuf)
++			return -ENOMEM;
++	}
++
++	db->cnt_factor = 1;
++	if (db->sample_size == 8)
++		db->cnt_factor *= 2;
++	if (db->num_channels == 1)
++		db->cnt_factor *= 2;
++	db->cnt_factor *= db->src_factor;
++
++	db->count = 0;
++	db->dma_qcount = 0;
++	db->nextIn = db->nextOut = db->rawbuf;
++
++	db->user_bytes_per_sample = (db->sample_size>>3) * db->num_channels;
++	db->dma_bytes_per_sample = 2 * ((db->num_channels == 1) ?
++					2 : db->num_channels);
++
++	user_bytes_per_sec = rate * db->user_bytes_per_sample;
++	bufs = PAGE_SIZE << db->buforder;
++	if (db->ossfragshift) {
++		if ((1000 << db->ossfragshift) < user_bytes_per_sec)
++			db->fragshift = ld2(user_bytes_per_sec/1000);
++		else
++			db->fragshift = db->ossfragshift;
++	} else {
++		db->fragshift = ld2(user_bytes_per_sec / 100 /
++				    (db->subdivision ? db->subdivision : 1));
++		if (db->fragshift < 3)
++			db->fragshift = 3;
++	}
++
++	db->fragsize = 1 << db->fragshift;
++	db->dma_fragsize = db->fragsize * db->cnt_factor;
++	db->numfrag = bufs / db->dma_fragsize;
++
++	while (db->numfrag < 4 && db->fragshift > 3) {
++		db->fragshift--;
++		db->fragsize = 1 << db->fragshift;
++		db->dma_fragsize = db->fragsize * db->cnt_factor;
++		db->numfrag = bufs / db->dma_fragsize;
++	}
++
++	if (db->ossmaxfrags >= 4 && db->ossmaxfrags < db->numfrag)
++		db->numfrag = db->ossmaxfrags;
++
++	db->dmasize = db->dma_fragsize * db->numfrag;
++	memset(db->rawbuf, 0, bufs);
++
++#ifdef AU1000_VERBOSE_DEBUG
++	dbg("rate=%d, samplesize=%d, channels=%d",
++	    rate, db->sample_size, db->num_channels);
++	dbg("fragsize=%d, cnt_factor=%d, dma_fragsize=%d",
++	    db->fragsize, db->cnt_factor, db->dma_fragsize);
++	dbg("numfrag=%d, dmasize=%d", db->numfrag, db->dmasize);
++#endif
++
++	db->ready = 1;
++	return 0;
++}
++
++static int
++prog_dmabuf_adc(struct au1550_state *s)
++{
++	stop_adc(s);
++	return prog_dmabuf(s, &s->dma_adc);
++
++}
++
++static int
++prog_dmabuf_dac(struct au1550_state *s)
++{
++	stop_dac(s);
++	return prog_dmabuf(s, &s->dma_dac);
++}
++
++
++/* hold spinlock for the following */
++static void
++dac_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
++{
++	struct au1550_state *s = (struct au1550_state *) dev_id;
++	struct dmabuf  *db = &s->dma_dac;
++	u32	i2s_stat;
++	volatile psc_i2s_t *ip;
++
++	ip = s->psc_addr;
++	i2s_stat = ip->psc_i2sstat;
++#ifdef AU1000_VERBOSE_DEBUG
++	if (i2s_stat & (PSC_I2SSTAT_TF | PSC_I2SSTAT_TR | PSC_I2SSTAT_TF))
++		dbg("I2S status = 0x%08x", i2s_stat);
++#endif
++	db->dma_qcount--;
++
++	if (db->count >= db->fragsize) {
++		if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut,
++							db->fragsize) == 0) {
++			pr_error("qcount < 2 and no ring room!");
++		}
++		db->nextOut += db->fragsize;
++		if (db->nextOut >= db->rawbuf + db->dmasize)
++			db->nextOut -= db->dmasize;
++		db->count -= db->fragsize;
++		db->total_bytes += db->dma_fragsize;
++		db->dma_qcount++;
++	}
++
++	/* wake up anybody listening */
++	if (waitqueue_active(&db->wait))
++		wake_up(&db->wait);
++}
++
++
++static void
++adc_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs)
++{
++	struct	au1550_state *s = (struct au1550_state *)dev_id;
++	struct	dmabuf  *dp = &s->dma_adc;
++	u32	obytes;
++	char	*obuf;
++
++	/* Pull the buffer from the dma queue.
++	*/
++	au1xxx_dbdma_get_dest(dp->dmanr, (void *)(&obuf), &obytes);
++
++	if ((dp->count + obytes) > dp->dmasize) {
++		/* Overrun. Stop ADC and log the error
++		*/
++		stop_adc(s);
++		dp->error++;
++		pr_error("adc overrun");
++		return;
++	}
++
++	/* Put a new empty buffer on the destination DMA.
++	*/
++	au1xxx_dbdma_put_dest(dp->dmanr, dp->nextIn, dp->dma_fragsize);
++
++	dp->nextIn += dp->dma_fragsize;
++	if (dp->nextIn >= dp->rawbuf + dp->dmasize)
++		dp->nextIn -= dp->dmasize;
++
++	dp->count += obytes;
++	dp->total_bytes += obytes;
++
++	/* wake up anybody listening
++	*/
++	if (waitqueue_active(&dp->wait))
++		wake_up(&dp->wait);
++
++}
++
++static loff_t
++au1550_llseek(struct file *file, loff_t offset, int origin)
++{
++	return -ESPIPE;
++}
++
++static int
++au1550_open_mixdev(struct inode *inode, struct file *file)
++{
++	file->private_data = &au1550_state;
++	return 0;
++}
++
++static int
++au1550_release_mixdev(struct inode *inode, struct file *file)
++{
++	return 0;
++}
++
++#define I2S_CODEC	"Wolfson WM8731"
++
++static int
++au1550_ioctl_mixdev(struct inode *inode, struct file *file,
++			       unsigned int cmd, unsigned long arg)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++	struct i2s_codec *codec = s->codec;
++	int i, val = 0;
++
++	if (cmd == SOUND_MIXER_INFO) {
++		mixer_info info;
++		memset(&info, 0, sizeof(info));
++		strlcpy(info.id, I2S_CODEC, sizeof(info.id));
++		strlcpy(info.name, I2S_CODEC, sizeof(info.name));
++		info.modify_counter = codec->modcnt;
++		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
++			return -EFAULT;
++		return 0;
++	}
++	if (cmd == SOUND_OLD_MIXER_INFO) {
++		_old_mixer_info info;
++		memset(&info, 0, sizeof(info));
++		strlcpy(info.id, I2S_CODEC, sizeof(info.id));
++		strlcpy(info.name, I2S_CODEC, sizeof(info.name));
++		if (copy_to_user((void __user *)arg, &info, sizeof(info)))
++			return -EFAULT;
++		return 0;
++	}
++
++	if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int))
++		return -EINVAL;
++
++	if (cmd == OSS_GETVERSION)
++		return put_user(SOUND_VERSION, (int __user *)arg);
++
++	if (_SIOC_DIR(cmd) == _SIOC_READ) {
++		switch (_IOC_NR(cmd)) {
++		case SOUND_MIXER_RECSRC: /* give them the current record source */
++			val = codec->mixer_state[SOUND_MIXER_RECSRC];
++			break;
++
++		case SOUND_MIXER_DEVMASK: /* give them the supported mixers */
++			val = codec->supported_mixers;
++			break;
++
++		case SOUND_MIXER_RECMASK: /* Arg contains a bit for each supported recording source */
++			val = codec->record_sources;
++			break;
++
++		case SOUND_MIXER_STEREODEVS: /* Mixer channels supporting stereo */
++			val = codec->stereo_mixers;
++			break;
++
++		case SOUND_MIXER_CAPS:
++			val = SOUND_CAP_EXCL_INPUT;
++			break;
++
++		default: /* read a specific mixer */
++			i = _IOC_NR(cmd);
++
++			if (!i2s_supported_mixer(codec, i))
++				return -EINVAL;
++
++			val = codec->mixer_state[i];
++ 			break;
++		}
++		return put_user(val, (int __user *)arg);
++	}
++
++	if (_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) {
++		codec->modcnt++;
++		if (get_user(val, (int __user *)arg))
++			return -EFAULT;
++
++		switch (_IOC_NR(cmd)) {
++		case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */
++			if (!val) return 0;
++			if (!(val &= codec->record_sources)) return -EINVAL;
++
++			codec->set_mixer(codec, SOUND_MIXER_RECSRC, val);
++
++			return 0;
++		default: /* write a specific mixer */
++			i = _IOC_NR(cmd);
++
++			if (!i2s_supported_mixer(codec, i))
++				return -EINVAL;
++
++			codec->set_mixer(codec, i, val);
++
++			return 0;
++		}
++	}
++	return -EINVAL;
++}
++
++static struct file_operations au1550_mixer_fops = {
++	owner:THIS_MODULE,
++	llseek:au1550_llseek,
++	ioctl:au1550_ioctl_mixdev,
++	open:au1550_open_mixdev,
++	release:au1550_release_mixdev,
++};
++
++static int
++drain_dac(struct au1550_state *s, int nonblock)
++{
++	unsigned long   flags;
++	int             count, tmo;
++
++	if (s->dma_dac.mapped || !s->dma_dac.ready || s->dma_dac.stopped)
++		return 0;
++
++	for (;;) {
++		spin_lock_irqsave(&s->lock, flags);
++		count = s->dma_dac.count;
++		spin_unlock_irqrestore(&s->lock, flags);
++		if (count <= 0)
++			break;
++		if (signal_pending(current))
++			break;
++		if (nonblock)
++			return -EBUSY;
++		tmo = 1000 * count / SAMP_RATE;
++		tmo /= s->dma_dac.dma_bytes_per_sample;
++		au1550_delay(tmo);
++	}
++	if (signal_pending(current))
++		return -ERESTARTSYS;
++	return 0;
++}
++
++static inline u8 S16_TO_U8(s16 ch)
++{
++	return (u8) (ch >> 8) + 0x80;
++}
++static inline s16 U8_TO_S16(u8 ch)
++{
++	return (s16) (ch - 0x80) << 8;
++}
++
++/*
++ * Translates user samples to dma buffer suitable for audio DAC data:
++ *     If mono, copy left channel to right channel in dma buffer.
++ *     If 8 bit samples, cvt to 16-bit before writing to dma buffer.
++ *     If interpolating (no VRA), duplicate every audio frame src_factor times.
++ */
++static int
++translate_from_user(struct dmabuf *db, char* dmabuf, char* userbuf,
++							       int dmacount)
++{
++	int             sample, i;
++	int             interp_bytes_per_sample;
++	int             num_samples;
++	int             mono = (db->num_channels == 1);
++	char            usersample[12];
++	s16             ch, dmasample[6];
++
++	if (db->sample_size == 16 && !mono && db->src_factor == 1) {
++		/* no translation necessary, just copy
++		*/
++		if (copy_from_user(dmabuf, userbuf, dmacount))
++			return -EFAULT;
++		return dmacount;
++	}
++
++	interp_bytes_per_sample = db->dma_bytes_per_sample * db->src_factor;
++	num_samples = dmacount / interp_bytes_per_sample;
++
++	for (sample = 0; sample < num_samples; sample++) {
++		if (copy_from_user(usersample, userbuf,
++				   db->user_bytes_per_sample)) {
++			return -EFAULT;
++		}
++
++		for (i = 0; i < db->num_channels; i++) {
++			if (db->sample_size == 8)
++				ch = U8_TO_S16(usersample[i]);
++			else
++				ch = *((s16 *) (&usersample[i * 2]));
++			dmasample[i] = ch;
++			if (mono)
++				dmasample[i + 1] = ch;	/* right channel */
++		}
++
++		/* duplicate every audio frame src_factor times
++		*/
++		for (i = 0; i < db->src_factor; i++)
++			memcpy(dmabuf, dmasample, db->dma_bytes_per_sample);
++
++		userbuf += db->user_bytes_per_sample;
++		dmabuf += interp_bytes_per_sample;
++	}
++
++	return num_samples * interp_bytes_per_sample;
++}
++
++/*
++ * Translates audio ADC samples to user buffer:
++ *     If mono, send only left channel to user buffer.
++ *     If 8 bit samples, cvt from 16 to 8 bit before writing to user buffer.
++ *     If decimating (no VRA), skip over src_factor audio frames.
++ */
++static int
++translate_to_user(struct dmabuf *db, char* userbuf, char* dmabuf,
++							     int dmacount)
++{
++	int             sample, i;
++	int             interp_bytes_per_sample;
++	int             num_samples;
++	int             mono = (db->num_channels == 1);
++	char            usersample[12];
++
++	if (db->sample_size == 16 && !mono && db->src_factor == 1) {
++		/* no translation necessary, just copy
++		*/
++		if (copy_to_user(userbuf, dmabuf, dmacount))
++			return -EFAULT;
++		return dmacount;
++	}
++
++	interp_bytes_per_sample = db->dma_bytes_per_sample * db->src_factor;
++	num_samples = dmacount / interp_bytes_per_sample;
++
++	for (sample = 0; sample < num_samples; sample++) {
++		for (i = 0; i < db->num_channels; i++) {
++			if (db->sample_size == 8)
++				usersample[i] =
++					S16_TO_U8(*((s16 *) (&dmabuf[i * 2])));
++			else
++				*((s16 *) (&usersample[i * 2])) =
++					*((s16 *) (&dmabuf[i * 2]));
++		}
++
++		if (copy_to_user(userbuf, usersample,
++				 db->user_bytes_per_sample)) {
++			return -EFAULT;
++		}
++
++		userbuf += db->user_bytes_per_sample;
++		dmabuf += interp_bytes_per_sample;
++	}
++
++	return num_samples * interp_bytes_per_sample;
++}
++
++/*
++ * Copy audio data to/from user buffer from/to dma buffer, taking care
++ * that we wrap when reading/writing the dma buffer. Returns actual byte
++ * count written to or read from the dma buffer.
++ */
++static int
++copy_dmabuf_user(struct dmabuf *db, char* userbuf, int count, int to_user)
++{
++	char           *bufptr = to_user ? db->nextOut : db->nextIn;
++	char           *bufend = db->rawbuf + db->dmasize;
++	int             cnt, ret;
++
++	if (bufptr + count > bufend) {
++		int             partial = (int) (bufend - bufptr);
++		if (to_user) {
++			if ((cnt = translate_to_user(db, userbuf,
++						     bufptr, partial)) < 0)
++				return cnt;
++			ret = cnt;
++			if ((cnt = translate_to_user(db, userbuf + partial,
++						     db->rawbuf,
++						     count - partial)) < 0)
++				return cnt;
++			ret += cnt;
++		} else {
++			if ((cnt = translate_from_user(db, bufptr, userbuf,
++						       partial)) < 0)
++				return cnt;
++			ret = cnt;
++			if ((cnt = translate_from_user(db, db->rawbuf,
++						       userbuf + partial,
++						       count - partial)) < 0)
++				return cnt;
++			ret += cnt;
++		}
++	} else {
++		if (to_user)
++			ret = translate_to_user(db, userbuf, bufptr, count);
++		else
++			ret = translate_from_user(db, bufptr, userbuf, count);
++	}
++
++	return ret;
++}
++
++static ssize_t
++au1550_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++	struct dmabuf  *db = &s->dma_adc;
++	DECLARE_WAITQUEUE(wait, current);
++	ssize_t         ret;
++	unsigned long   flags;
++	int             cnt, usercnt, avail;
++
++	if (db->mapped)
++		return -ENXIO;
++	if (!access_ok(VERIFY_WRITE, buffer, count))
++		return -EFAULT;
++	ret = 0;
++
++	count *= db->cnt_factor;
++
++	down(&s->sem);
++	add_wait_queue(&db->wait, &wait);
++
++	while (count > 0) {
++		/* wait for samples in ADC dma buffer
++		*/
++		do {
++			if (db->stopped)
++				start_adc(s);
++			spin_lock_irqsave(&s->lock, flags);
++			avail = db->count;
++			if (avail <= 0)
++				__set_current_state(TASK_INTERRUPTIBLE);
++			spin_unlock_irqrestore(&s->lock, flags);
++			if (avail <= 0) {
++				if (file->f_flags & O_NONBLOCK) {
++					if (!ret)
++						ret = -EAGAIN;
++					goto out;
++				}
++				up(&s->sem);
++				schedule();
++				if (signal_pending(current)) {
++					if (!ret)
++						ret = -ERESTARTSYS;
++					goto out2;
++				}
++				down(&s->sem);
++			}
++		} while (avail <= 0);
++
++		/* copy from nextOut to user
++		*/
++		if ((cnt = copy_dmabuf_user(db, buffer,
++					    count > avail ?
++					    avail : count, 1)) < 0) {
++			if (!ret)
++				ret = -EFAULT;
++			goto out;
++		}
++
++		spin_lock_irqsave(&s->lock, flags);
++		db->count -= cnt;
++		db->nextOut += cnt;
++		if (db->nextOut >= db->rawbuf + db->dmasize)
++			db->nextOut -= db->dmasize;
++		spin_unlock_irqrestore(&s->lock, flags);
++
++		count -= cnt;
++		usercnt = cnt / db->cnt_factor;
++		buffer += usercnt;
++		ret += usercnt;
++	}			/* while (count > 0) */
++
++out:
++	up(&s->sem);
++out2:
++	remove_wait_queue(&db->wait, &wait);
++	set_current_state(TASK_RUNNING);
++	return ret;
++}
++
++static ssize_t
++au1550_write(struct file *file, const char *buffer, size_t count, loff_t * ppos)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++	struct dmabuf  *db = &s->dma_dac;
++	DECLARE_WAITQUEUE(wait, current);
++	ssize_t         ret = 0;
++	unsigned long   flags;
++	int             cnt, usercnt, avail;
++
++#ifdef AU1000_VERBOSE_DEBUG
++	dbg("write: count=%d", count);
++#endif
++
++	if (db->mapped)
++		return -ENXIO;
++	if (!access_ok(VERIFY_READ, buffer, count))
++		return -EFAULT;
++
++	count *= db->cnt_factor;
++
++	down(&s->sem);
++	add_wait_queue(&db->wait, &wait);
++
++	while (count > 0) {
++		/* wait for space in playback buffer
++		*/
++		do {
++			spin_lock_irqsave(&s->lock, flags);
++			avail = (int) db->dmasize - db->count;
++			if (avail <= 0)
++				__set_current_state(TASK_INTERRUPTIBLE);
++			spin_unlock_irqrestore(&s->lock, flags);
++			if (avail <= 0) {
++				if (file->f_flags & O_NONBLOCK) {
++					if (!ret)
++						ret = -EAGAIN;
++					goto out;
++				}
++				up(&s->sem);
++				schedule();
++				if (signal_pending(current)) {
++					if (!ret)
++						ret = -ERESTARTSYS;
++					goto out2;
++				}
++				down(&s->sem);
++			}
++		} while (avail <= 0);
++
++		/* copy from user to nextIn
++		*/
++		if ((cnt = copy_dmabuf_user(db, (char *) buffer,
++					    count > avail ?
++					    avail : count, 0)) < 0) {
++			if (!ret)
++				ret = -EFAULT;
++			goto out;
++		}
++
++		spin_lock_irqsave(&s->lock, flags);
++		db->count += cnt;
++		db->nextIn += cnt;
++		if (db->nextIn >= db->rawbuf + db->dmasize)
++			db->nextIn -= db->dmasize;
++
++		/* If the data is available, we want to keep two buffers
++		 * on the dma queue.  If the queue count reaches zero,
++		 * we know the dma has stopped.
++		 */
++		while ((db->dma_qcount < 2) && (db->count >= db->fragsize)) {
++			if (au1xxx_dbdma_put_source(db->dmanr, db->nextOut,
++							db->fragsize) == 0) {
++				pr_error("qcount < 2 and no ring room!");
++			}
++			db->nextOut += db->fragsize;
++			if (db->nextOut >= db->rawbuf + db->dmasize)
++				db->nextOut -= db->dmasize;
++			db->count -= db->fragsize;
++			db->total_bytes += db->dma_fragsize;
++			if (db->dma_qcount == 0)
++				start_dac(s);
++			db->dma_qcount++;
++		}
++		spin_unlock_irqrestore(&s->lock, flags);
++
++		count -= cnt;
++		usercnt = cnt / db->cnt_factor;
++		buffer += usercnt;
++		ret += usercnt;
++	}			/* while (count > 0) */
++
++out:
++	up(&s->sem);
++out2:
++	remove_wait_queue(&db->wait, &wait);
++	set_current_state(TASK_RUNNING);
++	return ret;
++}
++
++
++/* No kernel lock - we have our own spinlock */
++static unsigned int
++au1550_poll(struct file *file, struct poll_table_struct *wait)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++	unsigned long   flags;
++	unsigned int    mask = 0;
++
++	if (file->f_mode & FMODE_WRITE) {
++		if (!s->dma_dac.ready)
++			return 0;
++		poll_wait(file, &s->dma_dac.wait, wait);
++	}
++	if (file->f_mode & FMODE_READ) {
++		if (!s->dma_adc.ready)
++			return 0;
++		poll_wait(file, &s->dma_adc.wait, wait);
++	}
++
++	spin_lock_irqsave(&s->lock, flags);
++
++	if (file->f_mode & FMODE_READ) {
++		if (s->dma_adc.count >= (signed)s->dma_adc.dma_fragsize)
++			mask |= POLLIN | POLLRDNORM;
++	}
++	if (file->f_mode & FMODE_WRITE) {
++		if (s->dma_dac.mapped) {
++			if (s->dma_dac.count >=
++			    (signed)s->dma_dac.dma_fragsize)
++				mask |= POLLOUT | POLLWRNORM;
++		} else {
++			if ((signed) s->dma_dac.dmasize >=
++			    s->dma_dac.count + (signed)s->dma_dac.dma_fragsize)
++				mask |= POLLOUT | POLLWRNORM;
++		}
++	}
++	spin_unlock_irqrestore(&s->lock, flags);
++	return mask;
++}
++
++static int
++au1550_mmap(struct file *file, struct vm_area_struct *vma)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++	struct dmabuf  *db;
++	unsigned long   size;
++	int ret = 0;
++
++	lock_kernel();
++	down(&s->sem);
++	if (vma->vm_flags & VM_WRITE)
++		db = &s->dma_dac;
++	else if (vma->vm_flags & VM_READ)
++		db = &s->dma_adc;
++	else {
++		ret = -EINVAL;
++		goto out;
++	}
++	if (vma->vm_pgoff != 0) {
++		ret = -EINVAL;
++		goto out;
++	}
++	size = vma->vm_end - vma->vm_start;
++	if (size > (PAGE_SIZE << db->buforder)) {
++		ret = -EINVAL;
++		goto out;
++	}
++	if (remap_pfn_range(vma, vma->vm_start,
++			     page_to_pfn(virt_to_page(db->rawbuf)),
++			     size, vma->vm_page_prot)) {
++		ret = -EAGAIN;
++		goto out;
++	}
++	vma->vm_flags &= ~VM_IO;
++	db->mapped = 1;
++out:
++	up(&s->sem);
++	unlock_kernel();
++	return ret;
++}
++
++
++#ifdef AU1000_VERBOSE_DEBUG
++static struct ioctl_str_t {
++	unsigned int    cmd;
++	const char     *str;
++} ioctl_str[] = {
++	{SNDCTL_DSP_RESET, "SNDCTL_DSP_RESET"},
++	{SNDCTL_DSP_SYNC, "SNDCTL_DSP_SYNC"},
++	{SNDCTL_DSP_SPEED, "SNDCTL_DSP_SPEED"},
++	{SNDCTL_DSP_STEREO, "SNDCTL_DSP_STEREO"},
++	{SNDCTL_DSP_GETBLKSIZE, "SNDCTL_DSP_GETBLKSIZE"},
++	{SNDCTL_DSP_SAMPLESIZE, "SNDCTL_DSP_SAMPLESIZE"},
++	{SNDCTL_DSP_CHANNELS, "SNDCTL_DSP_CHANNELS"},
++	{SOUND_PCM_WRITE_CHANNELS, "SOUND_PCM_WRITE_CHANNELS"},
++	{SOUND_PCM_WRITE_FILTER, "SOUND_PCM_WRITE_FILTER"},
++	{SNDCTL_DSP_POST, "SNDCTL_DSP_POST"},
++	{SNDCTL_DSP_SUBDIVIDE, "SNDCTL_DSP_SUBDIVIDE"},
++	{SNDCTL_DSP_SETFRAGMENT, "SNDCTL_DSP_SETFRAGMENT"},
++	{SNDCTL_DSP_GETFMTS, "SNDCTL_DSP_GETFMTS"},
++	{SNDCTL_DSP_SETFMT, "SNDCTL_DSP_SETFMT"},
++	{SNDCTL_DSP_GETOSPACE, "SNDCTL_DSP_GETOSPACE"},
++	{SNDCTL_DSP_GETISPACE, "SNDCTL_DSP_GETISPACE"},
++	{SNDCTL_DSP_NONBLOCK, "SNDCTL_DSP_NONBLOCK"},
++	{SNDCTL_DSP_GETCAPS, "SNDCTL_DSP_GETCAPS"},
++	{SNDCTL_DSP_GETTRIGGER, "SNDCTL_DSP_GETTRIGGER"},
++	{SNDCTL_DSP_SETTRIGGER, "SNDCTL_DSP_SETTRIGGER"},
++	{SNDCTL_DSP_GETIPTR, "SNDCTL_DSP_GETIPTR"},
++	{SNDCTL_DSP_GETOPTR, "SNDCTL_DSP_GETOPTR"},
++	{SNDCTL_DSP_MAPINBUF, "SNDCTL_DSP_MAPINBUF"},
++	{SNDCTL_DSP_MAPOUTBUF, "SNDCTL_DSP_MAPOUTBUF"},
++	{SNDCTL_DSP_SETSYNCRO, "SNDCTL_DSP_SETSYNCRO"},
++	{SNDCTL_DSP_SETDUPLEX, "SNDCTL_DSP_SETDUPLEX"},
++	{SNDCTL_DSP_GETODELAY, "SNDCTL_DSP_GETODELAY"},
++	{SNDCTL_DSP_GETCHANNELMASK, "SNDCTL_DSP_GETCHANNELMASK"},
++	{SNDCTL_DSP_BIND_CHANNEL, "SNDCTL_DSP_BIND_CHANNEL"},
++	{OSS_GETVERSION, "OSS_GETVERSION"},
++	{SOUND_PCM_READ_RATE, "SOUND_PCM_READ_RATE"},
++	{SOUND_PCM_READ_CHANNELS, "SOUND_PCM_READ_CHANNELS"},
++	{SOUND_PCM_READ_BITS, "SOUND_PCM_READ_BITS"},
++	{SOUND_PCM_READ_FILTER, "SOUND_PCM_READ_FILTER"}
++};
++#endif
++
++static int
++dma_count_done(struct dmabuf *db)
++{
++	if (db->stopped)
++		return 0;
++
++	return db->dma_fragsize - au1xxx_get_dma_residue(db->dmanr);
++}
++
++
++static int
++au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
++							unsigned long arg)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++	unsigned long   flags;
++	audio_buf_info  abinfo;
++	count_info      cinfo;
++	int             count;
++	int             val, mapped, ret, diff;
++
++	mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) ||
++		((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
++
++#ifdef AU1000_VERBOSE_DEBUG
++	for (count=0; count<sizeof(ioctl_str)/sizeof(ioctl_str[0]); count++) {
++		if (ioctl_str[count].cmd == cmd)
++			break;
++	}
++	if (count < sizeof(ioctl_str) / sizeof(ioctl_str[0]))
++		dbg("ioctl %s, arg=0x%lx", ioctl_str[count].str, arg);
++	else
++		dbg("ioctl 0x%x unknown, arg=0x%lx", cmd, arg);
++#endif
++
++	switch (cmd) {
++	case OSS_GETVERSION:
++		return put_user(SOUND_VERSION, (int *) arg);
++
++	case SNDCTL_DSP_SYNC:
++		if (file->f_mode & FMODE_WRITE)
++			return drain_dac(s, file->f_flags & O_NONBLOCK);
++		return 0;
++
++	case SNDCTL_DSP_SETDUPLEX:
++		return 0;
++
++	case SNDCTL_DSP_GETCAPS:
++		return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME |
++				DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
++
++	case SNDCTL_DSP_RESET:
++		if (file->f_mode & FMODE_WRITE) {
++			stop_dac(s);
++			synchronize_irq();
++			s->dma_dac.count = s->dma_dac.total_bytes = 0;
++			s->dma_dac.nextIn = s->dma_dac.nextOut =
++				s->dma_dac.rawbuf;
++		}
++		if (file->f_mode & FMODE_READ) {
++			stop_adc(s);
++			synchronize_irq();
++			s->dma_adc.count = s->dma_adc.total_bytes = 0;
++			s->dma_adc.nextIn = s->dma_adc.nextOut =
++				s->dma_adc.rawbuf;
++		}
++		return 0;
++
++	case SNDCTL_DSP_SPEED:
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (val >= 0) {
++			if (file->f_mode & FMODE_READ) {
++				stop_adc(s);
++				set_adc_rate(s, val);
++			}
++			if (file->f_mode & FMODE_WRITE) {
++				stop_dac(s);
++				set_dac_rate(s, val);
++			}
++			if (s->open_mode & FMODE_READ)
++				if ((ret = prog_dmabuf_adc(s)))
++					return ret;
++			if (s->open_mode & FMODE_WRITE)
++				if ((ret = prog_dmabuf_dac(s)))
++					return ret;
++		}
++		return put_user((file->f_mode & FMODE_READ) ?
++				s->dma_adc.sample_rate :
++				s->dma_dac.sample_rate,
++				(int *)arg);
++
++	case SNDCTL_DSP_STEREO:
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (file->f_mode & FMODE_READ) {
++			stop_adc(s);
++			s->dma_adc.num_channels = val ? 2 : 1;
++			if ((ret = prog_dmabuf_adc(s)))
++				return ret;
++		}
++		if (file->f_mode & FMODE_WRITE) {
++			stop_dac(s);
++			s->dma_dac.num_channels = val ? 2 : 1;
++			if ((ret = prog_dmabuf_dac(s)))
++				return ret;
++		}
++		return 0;
++
++	case SNDCTL_DSP_CHANNELS:
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (val != 0) {
++			if (file->f_mode & FMODE_READ) {
++				if (val < 0 || val > 2)
++					return -EINVAL;
++				stop_adc(s);
++				s->dma_adc.num_channels = val;
++				if ((ret = prog_dmabuf_adc(s)))
++					return ret;
++			}
++			if (file->f_mode & FMODE_WRITE) {
++				switch (val) {
++				case 1:
++				case 2:
++					break;
++				default:
++					return -EINVAL;
++				}
++
++				stop_dac(s);
++				s->dma_dac.num_channels = val;
++				if ((ret = prog_dmabuf_dac(s)))
++					return ret;
++			}
++		}
++		return put_user(val, (int *) arg);
++
++	case SNDCTL_DSP_GETFMTS:	/* Returns a mask */
++		return put_user(AFMT_S16_LE | AFMT_U8, (int *) arg);
++
++	case SNDCTL_DSP_SETFMT:	/* Selects ONE fmt */
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (val != AFMT_QUERY) {
++			if (file->f_mode & FMODE_READ) {
++				stop_adc(s);
++				if (val == AFMT_S16_LE)
++					s->dma_adc.sample_size = 16;
++				else {
++					val = AFMT_U8;
++					s->dma_adc.sample_size = 8;
++				}
++				if ((ret = prog_dmabuf_adc(s)))
++					return ret;
++			}
++			if (file->f_mode & FMODE_WRITE) {
++				stop_dac(s);
++				if (val == AFMT_S16_LE)
++					s->dma_dac.sample_size = 16;
++				else {
++					val = AFMT_U8;
++					s->dma_dac.sample_size = 8;
++				}
++				if ((ret = prog_dmabuf_dac(s)))
++					return ret;
++			}
++		} else {
++			if (file->f_mode & FMODE_READ)
++				val = (s->dma_adc.sample_size == 16) ?
++					AFMT_S16_LE : AFMT_U8;
++			else
++				val = (s->dma_dac.sample_size == 16) ?
++					AFMT_S16_LE : AFMT_U8;
++		}
++		return put_user(val, (int *) arg);
++
++	case SNDCTL_DSP_POST:
++		return 0;
++
++	case SNDCTL_DSP_GETTRIGGER:
++		val = 0;
++		spin_lock_irqsave(&s->lock, flags);
++		if (file->f_mode & FMODE_READ && !s->dma_adc.stopped)
++			val |= PCM_ENABLE_INPUT;
++		if (file->f_mode & FMODE_WRITE && !s->dma_dac.stopped)
++			val |= PCM_ENABLE_OUTPUT;
++		spin_unlock_irqrestore(&s->lock, flags);
++		return put_user(val, (int *) arg);
++
++	case SNDCTL_DSP_SETTRIGGER:
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (file->f_mode & FMODE_READ) {
++			if (val & PCM_ENABLE_INPUT)
++				start_adc(s);
++			else
++				stop_adc(s);
++		}
++		if (file->f_mode & FMODE_WRITE) {
++			if (val & PCM_ENABLE_OUTPUT)
++				start_dac(s);
++			else
++				stop_dac(s);
++		}
++		return 0;
++
++	case SNDCTL_DSP_GETOSPACE:
++		if (!(file->f_mode & FMODE_WRITE))
++			return -EINVAL;
++		abinfo.fragsize = s->dma_dac.fragsize;
++		spin_lock_irqsave(&s->lock, flags);
++		count = s->dma_dac.count;
++		count -= dma_count_done(&s->dma_dac);
++		spin_unlock_irqrestore(&s->lock, flags);
++		if (count < 0)
++			count = 0;
++		abinfo.bytes = (s->dma_dac.dmasize - count) /
++			s->dma_dac.cnt_factor;
++		abinfo.fragstotal = s->dma_dac.numfrag;
++		abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;
++#ifdef AU1000_VERBOSE_DEBUG
++		dbg("bytes=%d, fragments=%d", abinfo.bytes, abinfo.fragments);
++#endif
++		return copy_to_user((void *) arg, &abinfo,
++				    sizeof(abinfo)) ? -EFAULT : 0;
++
++	case SNDCTL_DSP_GETISPACE:
++		if (!(file->f_mode & FMODE_READ))
++			return -EINVAL;
++		abinfo.fragsize = s->dma_adc.fragsize;
++		spin_lock_irqsave(&s->lock, flags);
++		count = s->dma_adc.count;
++		count += dma_count_done(&s->dma_adc);
++		spin_unlock_irqrestore(&s->lock, flags);
++		if (count < 0)
++			count = 0;
++		abinfo.bytes = count / s->dma_adc.cnt_factor;
++		abinfo.fragstotal = s->dma_adc.numfrag;
++		abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;
++		return copy_to_user((void *) arg, &abinfo,
++				    sizeof(abinfo)) ? -EFAULT : 0;
++
++	case SNDCTL_DSP_NONBLOCK:
++		file->f_flags |= O_NONBLOCK;
++		return 0;
++
++	case SNDCTL_DSP_GETODELAY:
++		if (!(file->f_mode & FMODE_WRITE))
++			return -EINVAL;
++		spin_lock_irqsave(&s->lock, flags);
++		count = s->dma_dac.count;
++		count -= dma_count_done(&s->dma_dac);
++		spin_unlock_irqrestore(&s->lock, flags);
++		if (count < 0)
++			count = 0;
++		count /= s->dma_dac.cnt_factor;
++		return put_user(count, (int *) arg);
++
++	case SNDCTL_DSP_GETIPTR:
++		if (!(file->f_mode & FMODE_READ))
++			return -EINVAL;
++		spin_lock_irqsave(&s->lock, flags);
++		cinfo.bytes = s->dma_adc.total_bytes;
++		count = s->dma_adc.count;
++		if (!s->dma_adc.stopped) {
++			diff = dma_count_done(&s->dma_adc);
++			count += diff;
++			cinfo.bytes += diff;
++			cinfo.ptr =  virt_to_phys(s->dma_adc.nextIn) + diff -
++				virt_to_phys(s->dma_adc.rawbuf);
++		} else
++			cinfo.ptr = virt_to_phys(s->dma_adc.nextIn) -
++				virt_to_phys(s->dma_adc.rawbuf);
++		if (s->dma_adc.mapped)
++			s->dma_adc.count &= (s->dma_adc.dma_fragsize-1);
++		spin_unlock_irqrestore(&s->lock, flags);
++		if (count < 0)
++			count = 0;
++		cinfo.blocks = count >> s->dma_adc.fragshift;
++		return copy_to_user((void *) arg, &cinfo, sizeof(cinfo));
++
++	case SNDCTL_DSP_GETOPTR:
++		if (!(file->f_mode & FMODE_READ))
++			return -EINVAL;
++		spin_lock_irqsave(&s->lock, flags);
++		cinfo.bytes = s->dma_dac.total_bytes;
++		count = s->dma_dac.count;
++		if (!s->dma_dac.stopped) {
++			diff = dma_count_done(&s->dma_dac);
++			count -= diff;
++			cinfo.bytes += diff;
++			cinfo.ptr = virt_to_phys(s->dma_dac.nextOut) + diff -
++				virt_to_phys(s->dma_dac.rawbuf);
++		} else
++			cinfo.ptr = virt_to_phys(s->dma_dac.nextOut) -
++				virt_to_phys(s->dma_dac.rawbuf);
++		if (s->dma_dac.mapped)
++			s->dma_dac.count &= (s->dma_dac.dma_fragsize-1);
++		spin_unlock_irqrestore(&s->lock, flags);
++		if (count < 0)
++			count = 0;
++		cinfo.blocks = count >> s->dma_dac.fragshift;
++		return copy_to_user((void *) arg, &cinfo, sizeof(cinfo));
++
++	case SNDCTL_DSP_GETBLKSIZE:
++		if (file->f_mode & FMODE_WRITE)
++			return put_user(s->dma_dac.fragsize, (int *) arg);
++		else
++			return put_user(s->dma_adc.fragsize, (int *) arg);
++
++	case SNDCTL_DSP_SETFRAGMENT:
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (file->f_mode & FMODE_READ) {
++			stop_adc(s);
++			s->dma_adc.ossfragshift = val & 0xffff;
++			s->dma_adc.ossmaxfrags = (val >> 16) & 0xffff;
++			if (s->dma_adc.ossfragshift < 4)
++				s->dma_adc.ossfragshift = 4;
++			if (s->dma_adc.ossfragshift > 15)
++				s->dma_adc.ossfragshift = 15;
++			if (s->dma_adc.ossmaxfrags < 4)
++				s->dma_adc.ossmaxfrags = 4;
++			if ((ret = prog_dmabuf_adc(s)))
++				return ret;
++		}
++		if (file->f_mode & FMODE_WRITE) {
++			stop_dac(s);
++			s->dma_dac.ossfragshift = val & 0xffff;
++			s->dma_dac.ossmaxfrags = (val >> 16) & 0xffff;
++			if (s->dma_dac.ossfragshift < 4)
++				s->dma_dac.ossfragshift = 4;
++			if (s->dma_dac.ossfragshift > 15)
++				s->dma_dac.ossfragshift = 15;
++			if (s->dma_dac.ossmaxfrags < 4)
++				s->dma_dac.ossmaxfrags = 4;
++			if ((ret = prog_dmabuf_dac(s)))
++				return ret;
++		}
++		return 0;
++
++	case SNDCTL_DSP_SUBDIVIDE:
++		if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
++		    (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
++			return -EINVAL;
++		if (get_user(val, (int *) arg))
++			return -EFAULT;
++		if (val != 1 && val != 2 && val != 4)
++			return -EINVAL;
++		if (file->f_mode & FMODE_READ) {
++			stop_adc(s);
++			s->dma_adc.subdivision = val;
++			if ((ret = prog_dmabuf_adc(s)))
++				return ret;
++		}
++		if (file->f_mode & FMODE_WRITE) {
++			stop_dac(s);
++			s->dma_dac.subdivision = val;
++			if ((ret = prog_dmabuf_dac(s)))
++				return ret;
++		}
++		return 0;
++
++	case SOUND_PCM_READ_RATE:
++		return put_user((file->f_mode & FMODE_READ) ?
++				s->dma_adc.sample_rate :
++				s->dma_dac.sample_rate,
++				(int *)arg);
++
++	case SOUND_PCM_READ_CHANNELS:
++		if (file->f_mode & FMODE_READ)
++			return put_user(s->dma_adc.num_channels, (int *)arg);
++		else
++			return put_user(s->dma_dac.num_channels, (int *)arg);
++
++	case SOUND_PCM_READ_BITS:
++		if (file->f_mode & FMODE_READ)
++			return put_user(s->dma_adc.sample_size, (int *)arg);
++		else
++			return put_user(s->dma_dac.sample_size, (int *)arg);
++
++	case SOUND_PCM_WRITE_FILTER:
++	case SNDCTL_DSP_SETSYNCRO:
++	case SOUND_PCM_READ_FILTER:
++		return -EINVAL;
++	}
++
++	return 0;
++}
++
++
++static int
++au1550_open(struct inode *inode, struct file *file)
++{
++	int             minor = MINOR(inode->i_rdev);
++	DECLARE_WAITQUEUE(wait, current);
++	struct au1550_state *s = &au1550_state;
++	int             ret;
++
++#ifdef AU1000_VERBOSE_DEBUG
++	if (file->f_flags & O_NONBLOCK)
++		dbg(__FUNCTION__ ": non-blocking");
++	else
++		dbg(__FUNCTION__ ": blocking");
++#endif
++
++	file->private_data = s;
++	/* wait for device to become free */
++	down(&s->open_sem);
++	while (s->open_mode & file->f_mode) {
++		if (file->f_flags & O_NONBLOCK) {
++			up(&s->open_sem);
++			return -EBUSY;
++		}
++		add_wait_queue(&s->open_wait, &wait);
++		__set_current_state(TASK_INTERRUPTIBLE);
++		up(&s->open_sem);
++		schedule();
++		remove_wait_queue(&s->open_wait, &wait);
++		set_current_state(TASK_RUNNING);
++		if (signal_pending(current))
++			return -ERESTARTSYS;
++		down(&s->open_sem);
++	}
++
++	stop_dac(s);
++	stop_adc(s);
++
++	if (file->f_mode & FMODE_READ) {
++		s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags =
++			s->dma_adc.subdivision = s->dma_adc.total_bytes = 0;
++		s->dma_adc.num_channels = 1;
++		s->dma_adc.sample_size = 8;
++		set_adc_rate(s, 8000);
++		if ((minor & 0xf) == SND_DEV_DSP16)
++			s->dma_adc.sample_size = 16;
++	}
++
++	if (file->f_mode & FMODE_WRITE) {
++		s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags =
++			s->dma_dac.subdivision = s->dma_dac.total_bytes = 0;
++		s->dma_dac.num_channels = 1;
++		s->dma_dac.sample_size = 8;
++		set_dac_rate(s, 8000);
++		if ((minor & 0xf) == SND_DEV_DSP16)
++			s->dma_dac.sample_size = 16;
++	}
++
++	if (file->f_mode & FMODE_READ) {
++		if ((ret = prog_dmabuf_adc(s)))
++			return ret;
++	}
++	if (file->f_mode & FMODE_WRITE) {
++		if ((ret = prog_dmabuf_dac(s)))
++			return ret;
++	}
++
++	s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
++	up(&s->open_sem);
++	init_MUTEX(&s->sem);
++	return 0;
++}
++
++static int
++au1550_release(struct inode *inode, struct file *file)
++{
++	struct au1550_state *s = (struct au1550_state *)file->private_data;
++
++	lock_kernel();
++
++	if (file->f_mode & FMODE_WRITE) {
++		unlock_kernel();
++		drain_dac(s, file->f_flags & O_NONBLOCK);
++		lock_kernel();
++	}
++
++	down(&s->open_sem);
++	if (file->f_mode & FMODE_WRITE) {
++		stop_dac(s);
++		kfree(s->dma_dac.rawbuf);
++		s->dma_dac.rawbuf = NULL;
++	}
++	if (file->f_mode & FMODE_READ) {
++		stop_adc(s);
++		kfree(s->dma_adc.rawbuf);
++		s->dma_adc.rawbuf = NULL;
++	}
++	s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE));
++	up(&s->open_sem);
++	wake_up(&s->open_wait);
++	unlock_kernel();
++	return 0;
++}
++
++static struct file_operations au1550_audio_fops = {
++	owner:		THIS_MODULE,
++	llseek:		au1550_llseek,
++	read:		au1550_read,
++	write:		au1550_write,
++	poll:		au1550_poll,
++	ioctl:		au1550_ioctl,
++	mmap:		au1550_mmap,
++	open:		au1550_open,
++	release:	au1550_release,
++};
++
++/* Set up an internal clock for the PSC3.  This will then get
++ * driven out of the Au1550 as the master.
++ */
++static void
++intclk_setup(void)
++{
++	uint clk, rate;
++
++	/* Wire up Freq4 as a clock for the PSC3.
++	 * We know SMBus uses Freq3.
++	 * By making changes to this rate, plus the word strobe
++	 * size, we can make fine adjustments to the actual data rate.
++	 */
++	rate = get_au1x00_speed();
++#ifdef TRY_441KHz
++	rate /= (11 * 1000000);
++#else
++	rate /= (12 * 1000000);
++#endif
++
++	/* The FRDIV in the frequency control is (FRDIV + 1) * 2
++	*/
++	rate /=2;
++	rate--;
++	clk = au_readl(SYS_FREQCTRL1);
++	au_sync();
++	clk &= ~(SYS_FC_FRDIV4_MASK | SYS_FC_FS4);;
++	clk |= (rate << SYS_FC_FRDIV4_BIT);
++	clk |= SYS_FC_FE4;
++	au_writel(clk, SYS_FREQCTRL1);
++	au_sync();
++
++	/* Set up the clock source routing to get Freq4 to PSC3_intclk.
++	*/
++	clk = au_readl(SYS_CLKSRC);
++	au_sync();
++	clk &= ~0x01f00000;
++	clk |= (6 << 22);
++	au_writel(clk, SYS_CLKSRC);
++	au_sync();
++}
++
++static int __devinit
++au1550_probe(void)
++{
++	struct au1550_state *s = &au1550_state;
++	int val;
++	volatile psc_i2s_t *ip;
++#ifdef AU1550_DEBUG
++	char proc_str[80];
++#endif
++
++	memset(s, 0, sizeof(struct au1550_state));
++
++	init_waitqueue_head(&s->dma_adc.wait);
++	init_waitqueue_head(&s->dma_dac.wait);
++	init_waitqueue_head(&s->open_wait);
++	init_MUTEX(&s->open_sem);
++	spin_lock_init(&s->lock);
++
++	s->codec = &au1550_i2s_codec;
++	s->psc_addr = (volatile psc_i2s_t *)I2S_PSC_BASE;
++	ip = s->psc_addr;
++
++	if (!request_region(CPHYSADDR(ip),
++			    0x30, AU1550_MODULE_NAME)) {
++		pr_error("I2S Audio ports in use");
++	}
++
++	/* Allocate the DMA Channels
++	*/
++	if ((s->dma_dac.dmanr = au1xxx_dbdma_chan_alloc(DBDMA_MEM_CHAN,
++	    DBDMA_I2S_TX_CHAN, dac_dma_interrupt, (void *)s)) == 0) {
++		pr_error("Can't get DAC DMA");
++		goto err_dma1;
++	}
++	au1xxx_dbdma_set_devwidth(s->dma_dac.dmanr, 16);
++	if (au1xxx_dbdma_ring_alloc(s->dma_dac.dmanr,
++					NUM_DBDMA_DESCRIPTORS) == 0) {
++		pr_error("Can't get DAC DMA descriptors");
++		goto err_dma1;
++	}
++
++	if ((s->dma_adc.dmanr = au1xxx_dbdma_chan_alloc(DBDMA_I2S_RX_CHAN,
++	    DBDMA_MEM_CHAN, adc_dma_interrupt, (void *)s)) == 0) {
++		pr_error("Can't get ADC DMA");
++		goto err_dma2;
++	}
++	au1xxx_dbdma_set_devwidth(s->dma_adc.dmanr, 16);
++	if (au1xxx_dbdma_ring_alloc(s->dma_adc.dmanr,
++					NUM_DBDMA_DESCRIPTORS) == 0) {
++		pr_error("Can't get ADC DMA descriptors");
++		goto err_dma2;
++	}
++
++	pr_info("DAC: DMA%d, ADC: DMA%d", DBDMA_I2S_TX_CHAN, DBDMA_I2S_RX_CHAN);
++
++	/* register devices */
++
++	if ((s->dev_audio = register_sound_dsp(&au1550_audio_fops, -1)) < 0)
++		goto err_dev1;
++
++	if ((s->dev_mixer = register_sound_mixer(&au1550_mixer_fops, -1)) < 0)
++		goto err_dev2;
++
++#ifdef AU1550_DEBUG
++	/* intialize the debug proc device */
++	s->ps = create_proc_read_entry(AU1000_MODULE_NAME, 0, NULL,
++				       proc_au1550_dump, NULL);
++#endif /* AU1550_DEBUG */
++
++	intclk_setup();
++
++	/* The GPIO for the appropriate PSC was configured by the
++	 * board specific start up.
++	 *
++	 * configure PSC for I2S Audio
++	 */
++	ip->psc_ctrl = PSC_CTRL_DISABLE;	/* Disable PSC */
++	au_sync();
++	ip->psc_sel = (PSC_SEL_CLK_INTCLK | PSC_SEL_PS_I2SMODE);
++	au_sync();
++
++	/* Enable PSC
++	*/
++	ip->psc_ctrl = PSC_CTRL_ENABLE;
++	au_sync();
++
++	/* Wait for PSC ready.
++	*/
++	do {
++		val = ip->psc_i2sstat;
++		au_sync();
++	} while ((val & PSC_I2SSTAT_SR) == 0);
++
++	/* Configure I2S controller.
++	 * Deep FIFO, 16-bit sample, DMA, make sure DMA matches fifo size.
++	 * Actual I2S mode (first bit delayed by one clock).
++	 * Master mode (We provide the clock from the PSC).
++	 */
++	val = PSC_I2SCFG_SET_LEN(16);
++#ifdef TRY_441KHz
++	/* This really should be 250, but it appears that all of the
++	 * PLLs, dividers and so on in the chain shift it.  That's the
++	 * problem with sourceing the clock instead of letting the very
++	 * stable codec provide it.  But, the PSC doesn't appear to want
++	 * to work in slave mode, so this is what we get.  It's  not
++	 * studio quality timing, but it's good enough for listening
++	 * to mp3s.
++	 */
++	val |= PSC_I2SCFG_SET_WS(252);
++#else
++	val |= PSC_I2SCFG_SET_WS(250);
++#endif
++	val |= PSC_I2SCFG_RT_FIFO8 | PSC_I2SCFG_TT_FIFO8 | \
++					PSC_I2SCFG_BI | PSC_I2SCFG_XM;
++
++	ip->psc_i2scfg = val;
++	au_sync();
++	val |= PSC_I2SCFG_DE_ENABLE;
++	ip->psc_i2scfg = val;
++	au_sync();
++
++	/* Wait for Device ready.
++	*/
++	do {
++		val = ip->psc_i2sstat;
++		au_sync();
++	} while ((val & PSC_I2SSTAT_DR) == 0);
++
++	val = ip->psc_i2scfg;
++	au_sync();
++
++	s->codec->init_codec(s->codec);
++
++	return 0;
++
++ err_dev2:
++	unregister_sound_dsp(s->dev_audio);
++ err_dev1:
++	au1xxx_dbdma_chan_free(s->dma_adc.dmanr);
++ err_dma2:
++	au1xxx_dbdma_chan_free(s->dma_dac.dmanr);
++ err_dma1:
++	release_region(CPHYSADDR(I2S_PSC_BASE), 0x30);
++
++	return -1;
++}
++
++static void __devinit
++au1550_remove(void)
++{
++	struct au1550_state *s = &au1550_state;
++
++	if (!s)
++		return;
++#ifdef AU1550_DEBUG
++	if (s->ps)
++		remove_proc_entry(AU1000_MODULE_NAME, NULL);
++#endif /* AU1000_DEBUG */
++	synchronize_irq();
++	au1xxx_dbdma_chan_free(s->dma_adc.dmanr);
++	au1xxx_dbdma_chan_free(s->dma_dac.dmanr);
++	release_region(CPHYSADDR(I2S_PSC_BASE), 0x30);
++	unregister_sound_dsp(s->dev_audio);
++	unregister_sound_mixer(s->dev_mixer);
++}
++
++static int __init
++init_au1550(void)
++{
++	return au1550_probe();
++}
++
++static void __exit
++cleanup_au1550(void)
++{
++	au1550_remove();
++}
++
++module_init(init_au1550);
++module_exit(cleanup_au1550);
++
++MODULE_AUTHOR("Advanced Micro Devices (AMD), dan@embeddededge.com");
++MODULE_DESCRIPTION("Au1550 I2S Audio Driver");
Index: patches/linux-libc-headers-2.6.12.0-mips_atomic_fix-1.patch
===================================================================
--- patches/linux-libc-headers-2.6.12.0-mips_atomic_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-libc-headers-2.6.12.0-mips_atomic_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,19 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-10-01
+Initial Package Version: 2.6.12.0
+Origin: Jim Gifford
+Upstream Status: Sent
+Description: Fixes Compile Issue with Sysklogd
+ 
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-mips/atomic.h linux-libc-headers-2.6.12.0/include/asm-mips/atomic.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-mips/atomic.h	2005-07-06 00:17:30.000000000 +0000
++++ linux-libc-headers-2.6.12.0/include/asm-mips/atomic.h	2005-10-01 22:04:26.000000000 +0000
+@@ -18,7 +18,7 @@
+ typedef struct { volatile int counter; } atomic_t;
+ 
+ #ifdef __mips64
+-typedef struct { volatile __s64 counter; } atomic64_t;
++typedef struct { volatile long counter; } atomic64_t;
+ #endif
+ 
+ #endif /* _ASM_ATOMIC_H */
Index: patches/linux-libc-headers-2.6.12.0-mips_tls-1.patch
===================================================================
--- patches/linux-libc-headers-2.6.12.0-mips_tls-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-libc-headers-2.6.12.0-mips_tls-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,97 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-09-12
+Initial Package Version: 2.6.12.0
+Origin: http://www.uclibc.org/cgi-bin/viewcvs.cgi/trunk/buildroot/toolchain/kernel-headers/linux-libc-headers-2.6.12.0-mips-nptl.patch?rev=11104&view=auto
+Upstream Status: Unknown
+Description: Adds TLS Support to Kernel Headers for MIPS
+ 
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-mips/inst.h linux-libc-headers-2.6.12.0/include/asm-mips/inst.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-mips/inst.h	2004-10-31 19:54:20.000000000 +0000
++++ linux-libc-headers-2.6.12.0/include/asm-mips/inst.h	2005-09-12 23:57:11.000000000 +0000
+@@ -28,7 +28,7 @@
+ 	sdl_op, sdr_op, swr_op, cache_op,
+ 	ll_op, lwc1_op, lwc2_op, pref_op,
+ 	lld_op, ldc1_op, ldc2_op, ld_op,
+-	sc_op, swc1_op, swc2_op, major_3b_op, /* Opcode 0x3b is unused */
++	sc_op, swc1_op, swc2_op, rdhwr_op,
+ 	scd_op, sdc1_op, sdc2_op, sd_op
+ };
+ 
+@@ -62,10 +62,10 @@
+ 	spimi_op, unused_rt_op_0x05, unused_rt_op_0x06, unused_rt_op_0x07,
+ 	tgei_op, tgeiu_op, tlti_op, tltiu_op,
+ 	teqi_op, unused_0x0d_rt_op, tnei_op, unused_0x0f_rt_op,
+-	bltzal_op, bgezal_op, bltzall_op, bgezall_op
+-	/*
+-	 * The others (0x14 - 0x1f) are unused.
+- 	 */
++	bltzal_op, bgezal_op, bltzall_op, bgezall_op,
++	rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17,
++	rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b,
++	bposge32_op, rt_op_0x1d, rt_op_0x1e, rt_op_0x1f
+ };
+ 
+ /*
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-mips/unistd.h linux-libc-headers-2.6.12.0/include/asm-mips/unistd.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-mips/unistd.h	2005-07-06 00:17:29.000000000 +0000
++++ linux-libc-headers-2.6.12.0/include/asm-mips/unistd.h	2005-09-12 23:57:11.000000000 +0000
+@@ -303,16 +303,17 @@
+ #define __NR_add_key			(__NR_Linux + 280)
+ #define __NR_request_key		(__NR_Linux + 281)
+ #define __NR_keyctl			(__NR_Linux + 282)
++#define __NR_set_thread_area		(__NR_Linux + 283)
+ 
+ /*
+  * Offset of the last Linux o32 flavoured syscall
+  */
+-#define __NR_Linux_syscalls		282
++#define __NR_Linux_syscalls		283
+ 
+ #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
+ 
+ #define __NR_O32_Linux			4000
+-#define __NR_O32_Linux_syscalls		282
++#define __NR_O32_Linux_syscalls		283
+ 
+ #if _MIPS_SIM == _MIPS_SIM_ABI64
+ 
+@@ -562,16 +563,17 @@
+ #define __NR_add_key			(__NR_Linux + 239)
+ #define __NR_request_key		(__NR_Linux + 240)
+ #define __NR_keyctl			(__NR_Linux + 241)
++#define __NR_set_thread_area		(__NR_Linux + 242)
+ 
+ /*
+  * Offset of the last Linux 64-bit flavoured syscall
+  */
+-#define __NR_Linux_syscalls		241
++#define __NR_Linux_syscalls		242
+ 
+ #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
+ 
+ #define __NR_64_Linux			5000
+-#define __NR_64_Linux_syscalls		241
++#define __NR_64_Linux_syscalls		242
+ 
+ #if _MIPS_SIM == _MIPS_SIM_NABI32
+ 
+@@ -825,16 +827,17 @@
+ #define __NR_add_key			(__NR_Linux + 243)
+ #define __NR_request_key		(__NR_Linux + 244)
+ #define __NR_keyctl			(__NR_Linux + 245)
++#define __NR_set_thread_area		(__NR_Linux + 246)
+ 
+ /*
+  * Offset of the last N32 flavoured syscall
+  */
+-#define __NR_Linux_syscalls		245
++#define __NR_Linux_syscalls		246
+ 
+ #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
+ 
+ #define __NR_N32_Linux			6000
+-#define __NR_N32_Linux_syscalls		245
++#define __NR_N32_Linux_syscalls		246
+ 
+ #ifndef __ASSEMBLY__
+ 
Index: patches/linux-libc-headers-2.6.12.0-ppc_biarch-1.patch
===================================================================
--- patches/linux-libc-headers-2.6.12.0-ppc_biarch-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-libc-headers-2.6.12.0-ppc_biarch-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1802 @@
+Submitted By: Jeremy Huntwork (jhuntwork at linuxfromscratch dot org)
+Date: 2005-10-20
+Initial Package Version: 2.6.12.0
+Origin: Created for Cross-LFS
+Upstream Status: Not submitted - LFS Specific
+Description: Creates kernel header stubs for biarch builds, specific to ppc arch.
+             Based on cross-lfs scripts by Ryan Oliver
+
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/a.out.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/a.out.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/a.out.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/a.out.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__A_OUT_H__
++#define __STUB__A_OUT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/a.out.h>
++#else
++#include <asm-ppc/a.out.h>
++#endif
++
++#endif /* __STUB__A_OUT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/abs_addr.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/abs_addr.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/abs_addr.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/abs_addr.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ABS_ADDR_H__
++#define __STUB__ABS_ADDR_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/abs_addr.h>
++#endif
++
++#endif /* __STUB__ABS_ADDR_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/agp.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/agp.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/agp.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/agp.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__AGP_H__
++#define __STUB__AGP_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/agp.h>
++#else
++#include <asm-ppc/agp.h>
++#endif
++
++#endif /* __STUB__AGP_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/amigayle.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/amigayle.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/amigayle.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/amigayle.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__AMIGAYLE_H__
++#define __STUB__AMIGAYLE_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/amigayle.h>
++#endif
++
++#endif /* __STUB__AMIGAYLE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/amipcmcia.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/amipcmcia.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/amipcmcia.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/amipcmcia.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__AMIPCMCIA_H__
++#define __STUB__AMIPCMCIA_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/amipcmcia.h>
++#endif
++
++#endif /* __STUB__AMIPCMCIA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ans-lcd.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ans-lcd.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ans-lcd.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ans-lcd.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ANS-LCD_H__
++#define __STUB__ANS-LCD_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/ans-lcd.h>
++#endif
++
++#endif /* __STUB__ANS-LCD_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/atomic.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/atomic.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/atomic.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/atomic.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__ATOMIC_H__
++#define __STUB__ATOMIC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/atomic.h>
++#else
++#include <asm-ppc/atomic.h>
++#endif
++
++#endif /* __STUB__ATOMIC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/bitops.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/bitops.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/bitops.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/bitops.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__BITOPS_H__
++#define __STUB__BITOPS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/bitops.h>
++#else
++#include <asm-ppc/bitops.h>
++#endif
++
++#endif /* __STUB__BITOPS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/bootx.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/bootx.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/bootx.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/bootx.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BOOTX_H__
++#define __STUB__BOOTX_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/bootx.h>
++#endif
++
++#endif /* __STUB__BOOTX_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/bseip.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/bseip.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/bseip.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/bseip.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BSEIP_H__
++#define __STUB__BSEIP_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/bseip.h>
++#endif
++
++#endif /* __STUB__BSEIP_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/byteorder.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/byteorder.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/byteorder.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/byteorder.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__BYTEORDER_H__
++#define __STUB__BYTEORDER_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/byteorder.h>
++#else
++#include <asm-ppc/byteorder.h>
++#endif
++
++#endif /* __STUB__BYTEORDER_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/cache.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/cache.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/cache.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/cache.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CACHE_H__
++#define __STUB__CACHE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/cache.h>
++#else
++#include <asm-ppc/cache.h>
++#endif
++
++#endif /* __STUB__CACHE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/cacheflush.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/cacheflush.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/cacheflush.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/cacheflush.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CACHEFLUSH_H__
++#define __STUB__CACHEFLUSH_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/cacheflush.h>
++#else
++#include <asm-ppc/cacheflush.h>
++#endif
++
++#endif /* __STUB__CACHEFLUSH_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/checksum.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/checksum.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/checksum.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/checksum.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CHECKSUM_H__
++#define __STUB__CHECKSUM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/checksum.h>
++#else
++#include <asm-ppc/checksum.h>
++#endif
++
++#endif /* __STUB__CHECKSUM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/commproc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/commproc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/commproc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/commproc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__COMMPROC_H__
++#define __STUB__COMMPROC_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/commproc.h>
++#endif
++
++#endif /* __STUB__COMMPROC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/compat.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/compat.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/compat.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/compat.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__COMPAT_H__
++#define __STUB__COMPAT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/compat.h>
++#endif
++
++#endif /* __STUB__COMPAT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/cputable.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/cputable.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/cputable.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/cputable.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CPUTABLE_H__
++#define __STUB__CPUTABLE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/cputable.h>
++#else
++#include <asm-ppc/cputable.h>
++#endif
++
++#endif /* __STUB__CPUTABLE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/dma.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/dma.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/dma.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/dma.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__DMA_H__
++#define __STUB__DMA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/dma.h>
++#else
++#include <asm-ppc/dma.h>
++#endif
++
++#endif /* __STUB__DMA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/eeh.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/eeh.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/eeh.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/eeh.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__EEH_H__
++#define __STUB__EEH_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/eeh.h>
++#endif
++
++#endif /* __STUB__EEH_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/elf.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/elf.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/elf.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/elf.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__ELF_H__
++#define __STUB__ELF_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/elf.h>
++#else
++#include <asm-ppc/elf.h>
++#endif
++
++#endif /* __STUB__ELF_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/errno.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/errno.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/errno.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/errno.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__ERRNO_H__
++#define __STUB__ERRNO_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/errno.h>
++#else
++#include <asm-ppc/errno.h>
++#endif
++
++#endif /* __STUB__ERRNO_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/fcntl.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/fcntl.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/fcntl.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/fcntl.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__FCNTL_H__
++#define __STUB__FCNTL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/fcntl.h>
++#else
++#include <asm-ppc/fcntl.h>
++#endif
++
++#endif /* __STUB__FCNTL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/floppy.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/floppy.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/floppy.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/floppy.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__FLOPPY_H__
++#define __STUB__FLOPPY_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/floppy.h>
++#else
++#include <asm-ppc/floppy.h>
++#endif
++
++#endif /* __STUB__FLOPPY_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/gg2.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/gg2.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/gg2.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/gg2.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__GG2_H__
++#define __STUB__GG2_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/gg2.h>
++#endif
++
++#endif /* __STUB__GG2_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/gt64260.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/gt64260.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/gt64260.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/gt64260.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__GT64260_H__
++#define __STUB__GT64260_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/gt64260.h>
++#endif
++
++#endif /* __STUB__GT64260_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/gt64260_defs.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/gt64260_defs.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/gt64260_defs.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/gt64260_defs.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__GT64260_DEFS_H__
++#define __STUB__GT64260_DEFS_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/gt64260_defs.h>
++#endif
++
++#endif /* __STUB__GT64260_DEFS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hardirq.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hardirq.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hardirq.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hardirq.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__HARDIRQ_H__
++#define __STUB__HARDIRQ_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/hardirq.h>
++#else
++#include <asm-ppc/hardirq.h>
++#endif
++
++#endif /* __STUB__HARDIRQ_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/harrier.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/harrier.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/harrier.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/harrier.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HARRIER_H__
++#define __STUB__HARRIER_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/harrier.h>
++#endif
++
++#endif /* __STUB__HARRIER_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hdreg.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hdreg.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hdreg.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hdreg.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__HDREG_H__
++#define __STUB__HDREG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/hdreg.h>
++#else
++#include <asm-ppc/hdreg.h>
++#endif
++
++#endif /* __STUB__HDREG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/heathrow.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/heathrow.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/heathrow.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/heathrow.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HEATHROW_H__
++#define __STUB__HEATHROW_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/heathrow.h>
++#endif
++
++#endif /* __STUB__HEATHROW_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hvcall.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hvcall.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hvcall.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hvcall.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALL_H__
++#define __STUB__HVCALL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/hvcall.h>
++#endif
++
++#endif /* __STUB__HVCALL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hw_irq.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hw_irq.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/hw_irq.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/hw_irq.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__HW_IRQ_H__
++#define __STUB__HW_IRQ_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/hw_irq.h>
++#else
++#include <asm-ppc/hw_irq.h>
++#endif
++
++#endif /* __STUB__HW_IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/i8259.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/i8259.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/i8259.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/i8259.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__I8259_H__
++#define __STUB__I8259_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/i8259.h>
++#endif
++
++#endif /* __STUB__I8259_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCall.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCall.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCall.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCall.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALL_H__
++#define __STUB__HVCALL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCall.h>
++#endif
++
++#endif /* __STUB__HVCALL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallCfg.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallCfg.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallCfg.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallCfg.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLCFG_H__
++#define __STUB__HVCALLCFG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallCfg.h>
++#endif
++
++#endif /* __STUB__HVCALLCFG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallEvent.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallEvent.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallEvent.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallEvent.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLEVENT_H__
++#define __STUB__HVCALLEVENT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallEvent.h>
++#endif
++
++#endif /* __STUB__HVCALLEVENT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallHpt.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallHpt.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallHpt.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallHpt.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLHPT_H__
++#define __STUB__HVCALLHPT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallHpt.h>
++#endif
++
++#endif /* __STUB__HVCALLHPT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallPci.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallPci.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallPci.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallPci.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLPCI_H__
++#define __STUB__HVCALLPCI_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallPci.h>
++#endif
++
++#endif /* __STUB__HVCALLPCI_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallSc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallSc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallSc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallSc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLSC_H__
++#define __STUB__HVCALLSC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallSc.h>
++#endif
++
++#endif /* __STUB__HVCALLSC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallSm.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallSm.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallSm.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallSm.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLSM_H__
++#define __STUB__HVCALLSM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallSm.h>
++#endif
++
++#endif /* __STUB__HVCALLSM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallXm.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallXm.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvCallXm.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvCallXm.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVCALLXM_H__
++#define __STUB__HVCALLXM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvCallXm.h>
++#endif
++
++#endif /* __STUB__HVCALLXM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvLpConfig.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvLpConfig.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvLpConfig.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvLpConfig.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVLPCONFIG_H__
++#define __STUB__HVLPCONFIG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvLpConfig.h>
++#endif
++
++#endif /* __STUB__HVLPCONFIG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvLpEvent.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvLpEvent.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvLpEvent.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvLpEvent.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVLPEVENT_H__
++#define __STUB__HVLPEVENT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvLpEvent.h>
++#endif
++
++#endif /* __STUB__HVLPEVENT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvReleaseData.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvReleaseData.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvReleaseData.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvReleaseData.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVRELEASEDATA_H__
++#define __STUB__HVRELEASEDATA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvReleaseData.h>
++#endif
++
++#endif /* __STUB__HVRELEASEDATA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvTypes.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvTypes.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/HvTypes.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/HvTypes.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HVTYPES_H__
++#define __STUB__HVTYPES_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/HvTypes.h>
++#endif
++
++#endif /* __STUB__HVTYPES_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/IoHriMainStore.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/IoHriMainStore.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/IoHriMainStore.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/IoHriMainStore.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IOHRIMAINSTORE_H__
++#define __STUB__IOHRIMAINSTORE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/IoHriMainStore.h>
++#endif
++
++#endif /* __STUB__IOHRIMAINSTORE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/IoHriProcessorVpd.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/IoHriProcessorVpd.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/IoHriProcessorVpd.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/IoHriProcessorVpd.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IOHRIPROCESSORVPD_H__
++#define __STUB__IOHRIPROCESSORVPD_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/IoHriProcessorVpd.h>
++#endif
++
++#endif /* __STUB__IOHRIPROCESSORVPD_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItExtVpdPanel.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItExtVpdPanel.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItExtVpdPanel.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItExtVpdPanel.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITEXTVPDPANEL_H__
++#define __STUB__ITEXTVPDPANEL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItExtVpdPanel.h>
++#endif
++
++#endif /* __STUB__ITEXTVPDPANEL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItIplParmsReal.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItIplParmsReal.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItIplParmsReal.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItIplParmsReal.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITIPLPARMSREAL_H__
++#define __STUB__ITIPLPARMSREAL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItIplParmsReal.h>
++#endif
++
++#endif /* __STUB__ITIPLPARMSREAL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItLpNaca.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItLpNaca.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItLpNaca.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItLpNaca.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITLPNACA_H__
++#define __STUB__ITLPNACA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItLpNaca.h>
++#endif
++
++#endif /* __STUB__ITLPNACA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItLpQueue.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItLpQueue.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItLpQueue.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItLpQueue.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITLPQUEUE_H__
++#define __STUB__ITLPQUEUE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItLpQueue.h>
++#endif
++
++#endif /* __STUB__ITLPQUEUE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItLpRegSave.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItLpRegSave.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItLpRegSave.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItLpRegSave.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITLPREGSAVE_H__
++#define __STUB__ITLPREGSAVE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItLpRegSave.h>
++#endif
++
++#endif /* __STUB__ITLPREGSAVE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItSpCommArea.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItSpCommArea.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItSpCommArea.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItSpCommArea.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITSPCOMMAREA_H__
++#define __STUB__ITSPCOMMAREA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItSpCommArea.h>
++#endif
++
++#endif /* __STUB__ITSPCOMMAREA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItVpdAreas.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItVpdAreas.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/ItVpdAreas.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/ItVpdAreas.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ITVPDAREAS_H__
++#define __STUB__ITVPDAREAS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/ItVpdAreas.h>
++#endif
++
++#endif /* __STUB__ITVPDAREAS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/LparData.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/LparData.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/LparData.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/LparData.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__LPARDATA_H__
++#define __STUB__LPARDATA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/LparData.h>
++#endif
++
++#endif /* __STUB__LPARDATA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/LparMap.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/LparMap.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/LparMap.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/LparMap.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__LPARMAP_H__
++#define __STUB__LPARMAP_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/LparMap.h>
++#endif
++
++#endif /* __STUB__LPARMAP_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/XmPciLpEvent.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/XmPciLpEvent.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/XmPciLpEvent.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/XmPciLpEvent.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__XMPCILPEVENT_H__
++#define __STUB__XMPCILPEVENT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/XmPciLpEvent.h>
++#endif
++
++#endif /* __STUB__XMPCILPEVENT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_io.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_io.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_io.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_io.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ISERIES_IO_H__
++#define __STUB__ISERIES_IO_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/iSeries_io.h>
++#endif
++
++#endif /* __STUB__ISERIES_IO_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_irq.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_irq.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_irq.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_irq.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ISERIES_IRQ_H__
++#define __STUB__ISERIES_IRQ_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/iSeries_irq.h>
++#endif
++
++#endif /* __STUB__ISERIES_IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_pci.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_pci.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_pci.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_pci.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ISERIES_PCI_H__
++#define __STUB__ISERIES_PCI_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/iSeries_pci.h>
++#endif
++
++#endif /* __STUB__ISERIES_PCI_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_proc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_proc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/iSeries_proc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/iSeries_proc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ISERIES_PROC_H__
++#define __STUB__ISERIES_PROC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/iSeries_proc.h>
++#endif
++
++#endif /* __STUB__ISERIES_PROC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/mf.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/mf.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/iSeries/mf.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/iSeries/mf.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MF_H__
++#define __STUB__MF_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/iSeries/mf.h>
++#endif
++
++#endif /* __STUB__MF_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/imalloc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/imalloc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/imalloc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/imalloc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IMALLOC_H__
++#define __STUB__IMALLOC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/imalloc.h>
++#endif
++
++#endif /* __STUB__IMALLOC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/init.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/init.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/init.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/init.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__INIT_H__
++#define __STUB__INIT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/init.h>
++#endif
++
++#endif /* __STUB__INIT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/io.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/io.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/io.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/io.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IO_H__
++#define __STUB__IO_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/io.h>
++#else
++#include <asm-ppc/io.h>
++#endif
++
++#endif /* __STUB__IO_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ioctl.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ioctl.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ioctl.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ioctl.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IOCTL_H__
++#define __STUB__IOCTL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ioctl.h>
++#else
++#include <asm-ppc/ioctl.h>
++#endif
++
++#endif /* __STUB__IOCTL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ioctls.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ioctls.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ioctls.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ioctls.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IOCTLS_H__
++#define __STUB__IOCTLS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ioctls.h>
++#else
++#include <asm-ppc/ioctls.h>
++#endif
++
++#endif /* __STUB__IOCTLS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ipc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ipc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ipc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ipc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IPC_H__
++#define __STUB__IPC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ipc.h>
++#else
++#include <asm-ppc/ipc.h>
++#endif
++
++#endif /* __STUB__IPC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ipcbuf.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ipcbuf.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ipcbuf.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ipcbuf.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IPCBUF_H__
++#define __STUB__IPCBUF_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ipcbuf.h>
++#else
++#include <asm-ppc/ipcbuf.h>
++#endif
++
++#endif /* __STUB__IPCBUF_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/irq.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/irq.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/irq.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/irq.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IRQ_H__
++#define __STUB__IRQ_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/irq.h>
++#else
++#include <asm-ppc/irq.h>
++#endif
++
++#endif /* __STUB__IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/keylargo.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/keylargo.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/keylargo.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/keylargo.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__KEYLARGO_H__
++#define __STUB__KEYLARGO_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/keylargo.h>
++#endif
++
++#endif /* __STUB__KEYLARGO_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/linkage.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/linkage.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/linkage.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/linkage.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__LINKAGE_H__
++#define __STUB__LINKAGE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/linkage.h>
++#else
++#include <asm-ppc/linkage.h>
++#endif
++
++#endif /* __STUB__LINKAGE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/lmb.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/lmb.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/lmb.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/lmb.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__LMB_H__
++#define __STUB__LMB_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/lmb.h>
++#endif
++
++#endif /* __STUB__LMB_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/m48t35.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/m48t35.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/m48t35.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/m48t35.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__M48T35_H__
++#define __STUB__M48T35_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/m48t35.h>
++#endif
++
++#endif /* __STUB__M48T35_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/machdep.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/machdep.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/machdep.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/machdep.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MACHDEP_H__
++#define __STUB__MACHDEP_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/machdep.h>
++#else
++#include <asm-ppc/machdep.h>
++#endif
++
++#endif /* __STUB__MACHDEP_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/macio.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/macio.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/macio.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/macio.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACIO_H__
++#define __STUB__MACIO_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/macio.h>
++#endif
++
++#endif /* __STUB__MACIO_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/memory.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/memory.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/memory.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/memory.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MEMORY_H__
++#define __STUB__MEMORY_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/memory.h>
++#endif
++
++#endif /* __STUB__MEMORY_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mk48t59.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mk48t59.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mk48t59.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mk48t59.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MK48T59_H__
++#define __STUB__MK48T59_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/mk48t59.h>
++#endif
++
++#endif /* __STUB__MK48T59_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mman.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mman.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mman.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mman.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMAN_H__
++#define __STUB__MMAN_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/mman.h>
++#else
++#include <asm-ppc/mman.h>
++#endif
++
++#endif /* __STUB__MMAN_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mmu.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mmu.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mmu.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mmu.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMU_H__
++#define __STUB__MMU_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/mmu.h>
++#else
++#include <asm-ppc/mmu.h>
++#endif
++
++#endif /* __STUB__MMU_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mmu_context.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mmu_context.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/mmu_context.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/mmu_context.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMU_CONTEXT_H__
++#define __STUB__MMU_CONTEXT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/mmu_context.h>
++#else
++#include <asm-ppc/mmu_context.h>
++#endif
++
++#endif /* __STUB__MMU_CONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/module.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/module.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/module.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/module.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MODULE_H__
++#define __STUB__MODULE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/module.h>
++#else
++#include <asm-ppc/module.h>
++#endif
++
++#endif /* __STUB__MODULE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/msgbuf.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/msgbuf.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/msgbuf.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/msgbuf.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MSGBUF_H__
++#define __STUB__MSGBUF_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/msgbuf.h>
++#else
++#include <asm-ppc/msgbuf.h>
++#endif
++
++#endif /* __STUB__MSGBUF_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/naca.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/naca.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/naca.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/naca.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__NACA_H__
++#define __STUB__NACA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/naca.h>
++#endif
++
++#endif /* __STUB__NACA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/namei.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/namei.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/namei.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/namei.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__NAMEI_H__
++#define __STUB__NAMEI_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/namei.h>
++#else
++#include <asm-ppc/namei.h>
++#endif
++
++#endif /* __STUB__NAMEI_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/numnodes.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/numnodes.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/numnodes.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/numnodes.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__NUMNODES_H__
++#define __STUB__NUMNODES_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/numnodes.h>
++#endif
++
++#endif /* __STUB__NUMNODES_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/nvram.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/nvram.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/nvram.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/nvram.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__NVRAM_H__
++#define __STUB__NVRAM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/nvram.h>
++#else
++#include <asm-ppc/nvram.h>
++#endif
++
++#endif /* __STUB__NVRAM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ocp_ids.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ocp_ids.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ocp_ids.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ocp_ids.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OCP_IDS_H__
++#define __STUB__OCP_IDS_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/ocp_ids.h>
++#endif
++
++#endif /* __STUB__OCP_IDS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/of_device.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/of_device.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/of_device.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/of_device.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OF_DEVICE_H__
++#define __STUB__OF_DEVICE_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/of_device.h>
++#endif
++
++#endif /* __STUB__OF_DEVICE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ohare.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ohare.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ohare.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ohare.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OHARE_H__
++#define __STUB__OHARE_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/ohare.h>
++#endif
++
++#endif /* __STUB__OHARE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/open_pic.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/open_pic.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/open_pic.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/open_pic.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OPEN_PIC_H__
++#define __STUB__OPEN_PIC_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/open_pic.h>
++#endif
++
++#endif /* __STUB__OPEN_PIC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/pSeries_reconfig.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/pSeries_reconfig.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/pSeries_reconfig.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/pSeries_reconfig.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PSERIES_RECONFIG_H__
++#define __STUB__PSERIES_RECONFIG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/pSeries_reconfig.h>
++#endif
++
++#endif /* __STUB__PSERIES_RECONFIG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/paca.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/paca.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/paca.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/paca.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PACA_H__
++#define __STUB__PACA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/paca.h>
++#endif
++
++#endif /* __STUB__PACA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/page.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/page.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/page.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/page.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PAGE_H__
++#define __STUB__PAGE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/page.h>
++#else
++#include <asm-ppc/page.h>
++#endif
++
++#endif /* __STUB__PAGE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/param.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/param.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/param.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/param.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PARAM_H__
++#define __STUB__PARAM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/param.h>
++#else
++#include <asm-ppc/param.h>
++#endif
++
++#endif /* __STUB__PARAM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/parport.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/parport.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/parport.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/parport.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PARPORT_H__
++#define __STUB__PARPORT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/parport.h>
++#else
++#include <asm-ppc/parport.h>
++#endif
++
++#endif /* __STUB__PARPORT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/pgalloc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/pgalloc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/pgalloc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/pgalloc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PGALLOC_H__
++#define __STUB__PGALLOC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/pgalloc.h>
++#else
++#include <asm-ppc/pgalloc.h>
++#endif
++
++#endif /* __STUB__PGALLOC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/pmc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/pmc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/pmc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/pmc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PMC_H__
++#define __STUB__PMC_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/pmc.h>
++#endif
++
++#endif /* __STUB__PMC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/poll.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/poll.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/poll.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/poll.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__POLL_H__
++#define __STUB__POLL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/poll.h>
++#else
++#include <asm-ppc/poll.h>
++#endif
++
++#endif /* __STUB__POLL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/posix_types.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/posix_types.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/posix_types.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/posix_types.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__POSIX_TYPES_H__
++#define __STUB__POSIX_TYPES_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/posix_types.h>
++#else
++#include <asm-ppc/posix_types.h>
++#endif
++
++#endif /* __STUB__POSIX_TYPES_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppc32.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppc32.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppc32.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppc32.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PPC32_H__
++#define __STUB__PPC32_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ppc32.h>
++#endif
++
++#endif /* __STUB__PPC32_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppc_asm.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppc_asm.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppc_asm.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppc_asm.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PPC_ASM_H__
++#define __STUB__PPC_ASM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ppc_asm.h>
++#else
++#include <asm-ppc/ppc_asm.h>
++#endif
++
++#endif /* __STUB__PPC_ASM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppcboot.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppcboot.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppcboot.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppcboot.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PPCBOOT_H__
++#define __STUB__PPCBOOT_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/ppcboot.h>
++#endif
++
++#endif /* __STUB__PPCBOOT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppcdebug.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppcdebug.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ppcdebug.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ppcdebug.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PPCDEBUG_H__
++#define __STUB__PPCDEBUG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ppcdebug.h>
++#endif
++
++#endif /* __STUB__PPCDEBUG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/processor.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/processor.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/processor.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/processor.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PROCESSOR_H__
++#define __STUB__PROCESSOR_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/processor.h>
++#else
++#include <asm-ppc/processor.h>
++#endif
++
++#endif /* __STUB__PROCESSOR_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ptrace-common.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ptrace-common.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ptrace-common.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ptrace-common.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PTRACE-COMMON_H__
++#define __STUB__PTRACE-COMMON_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ptrace-common.h>
++#endif
++
++#endif /* __STUB__PTRACE-COMMON_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ptrace.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ptrace.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ptrace.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ptrace.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PTRACE_H__
++#define __STUB__PTRACE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ptrace.h>
++#else
++#include <asm-ppc/ptrace.h>
++#endif
++
++#endif /* __STUB__PTRACE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/reg.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/reg.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/reg.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/reg.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__REG_H__
++#define __STUB__REG_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/reg.h>
++#endif
++
++#endif /* __STUB__REG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/rtas.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/rtas.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/rtas.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/rtas.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__RTAS_H__
++#define __STUB__RTAS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/rtas.h>
++#endif
++
++#endif /* __STUB__RTAS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/segment.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/segment.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/segment.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/segment.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SEGMENT_H__
++#define __STUB__SEGMENT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/segment.h>
++#else
++#include <asm-ppc/segment.h>
++#endif
++
++#endif /* __STUB__SEGMENT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/semaphore.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/semaphore.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/semaphore.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/semaphore.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SEMAPHORE_H__
++#define __STUB__SEMAPHORE_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/semaphore.h>
++#else
++#include <asm-ppc/semaphore.h>
++#endif
++
++#endif /* __STUB__SEMAPHORE_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/sembuf.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/sembuf.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/sembuf.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/sembuf.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SEMBUF_H__
++#define __STUB__SEMBUF_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/sembuf.h>
++#else
++#include <asm-ppc/sembuf.h>
++#endif
++
++#endif /* __STUB__SEMBUF_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/serial.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/serial.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/serial.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/serial.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SERIAL_H__
++#define __STUB__SERIAL_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/serial.h>
++#endif
++
++#endif /* __STUB__SERIAL_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/shmbuf.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/shmbuf.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/shmbuf.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/shmbuf.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SHMBUF_H__
++#define __STUB__SHMBUF_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/shmbuf.h>
++#else
++#include <asm-ppc/shmbuf.h>
++#endif
++
++#endif /* __STUB__SHMBUF_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/shmparam.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/shmparam.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/shmparam.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/shmparam.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SHMPARAM_H__
++#define __STUB__SHMPARAM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/shmparam.h>
++#else
++#include <asm-ppc/shmparam.h>
++#endif
++
++#endif /* __STUB__SHMPARAM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/sigcontext.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/sigcontext.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/sigcontext.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/sigcontext.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SIGCONTEXT_H__
++#define __STUB__SIGCONTEXT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/sigcontext.h>
++#else
++#include <asm-ppc/sigcontext.h>
++#endif
++
++#endif /* __STUB__SIGCONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/siginfo.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/siginfo.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/siginfo.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/siginfo.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SIGINFO_H__
++#define __STUB__SIGINFO_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/siginfo.h>
++#else
++#include <asm-ppc/siginfo.h>
++#endif
++
++#endif /* __STUB__SIGINFO_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/smu.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/smu.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/smu.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/smu.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SMU_H__
++#define __STUB__SMU_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/smu.h>
++#endif
++
++#endif /* __STUB__SMU_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/socket.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/socket.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/socket.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/socket.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SOCKET_H__
++#define __STUB__SOCKET_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/socket.h>
++#else
++#include <asm-ppc/socket.h>
++#endif
++
++#endif /* __STUB__SOCKET_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/sockios.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/sockios.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/sockios.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/sockios.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SOCKIOS_H__
++#define __STUB__SOCKIOS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/sockios.h>
++#else
++#include <asm-ppc/sockios.h>
++#endif
++
++#endif /* __STUB__SOCKIOS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/spinlock.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/spinlock.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/spinlock.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/spinlock.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SPINLOCK_H__
++#define __STUB__SPINLOCK_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/spinlock.h>
++#else
++#include <asm-ppc/spinlock.h>
++#endif
++
++#endif /* __STUB__SPINLOCK_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/stat.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/stat.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/stat.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/stat.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__STAT_H__
++#define __STUB__STAT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/stat.h>
++#else
++#include <asm-ppc/stat.h>
++#endif
++
++#endif /* __STUB__STAT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/suspend.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/suspend.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/suspend.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/suspend.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SUSPEND_H__
++#define __STUB__SUSPEND_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/suspend.h>
++#endif
++
++#endif /* __STUB__SUSPEND_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/system.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/system.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/system.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/system.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SYSTEM_H__
++#define __STUB__SYSTEM_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/system.h>
++#else
++#include <asm-ppc/system.h>
++#endif
++
++#endif /* __STUB__SYSTEM_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/systemcfg.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/systemcfg.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/systemcfg.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/systemcfg.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SYSTEMCFG_H__
++#define __STUB__SYSTEMCFG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/systemcfg.h>
++#endif
++
++#endif /* __STUB__SYSTEMCFG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/termbits.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/termbits.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/termbits.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/termbits.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TERMBITS_H__
++#define __STUB__TERMBITS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/termbits.h>
++#else
++#include <asm-ppc/termbits.h>
++#endif
++
++#endif /* __STUB__TERMBITS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/termios.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/termios.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/termios.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/termios.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TERMIOS_H__
++#define __STUB__TERMIOS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/termios.h>
++#else
++#include <asm-ppc/termios.h>
++#endif
++
++#endif /* __STUB__TERMIOS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/timex.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/timex.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/timex.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/timex.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TIMEX_H__
++#define __STUB__TIMEX_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/timex.h>
++#else
++#include <asm-ppc/timex.h>
++#endif
++
++#endif /* __STUB__TIMEX_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/tlbflush.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/tlbflush.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/tlbflush.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/tlbflush.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TLBFLUSH_H__
++#define __STUB__TLBFLUSH_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/tlbflush.h>
++#else
++#include <asm-ppc/tlbflush.h>
++#endif
++
++#endif /* __STUB__TLBFLUSH_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/todc.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/todc.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/todc.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/todc.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TODC_H__
++#define __STUB__TODC_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/todc.h>
++#endif
++
++#endif /* __STUB__TODC_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/traps.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/traps.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/traps.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/traps.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TRAPS_H__
++#define __STUB__TRAPS_H__
++
++#ifndef __powerpc64__
++#include <asm-ppc/traps.h>
++#endif
++
++#endif /* __STUB__TRAPS_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/types.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/types.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/types.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/types.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TYPES_H__
++#define __STUB__TYPES_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/types.h>
++#else
++#include <asm-ppc/types.h>
++#endif
++
++#endif /* __STUB__TYPES_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ucontext.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ucontext.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/ucontext.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/ucontext.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__UCONTEXT_H__
++#define __STUB__UCONTEXT_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/ucontext.h>
++#else
++#include <asm-ppc/ucontext.h>
++#endif
++
++#endif /* __STUB__UCONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/udbg.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/udbg.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/udbg.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/udbg.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__UDBG_H__
++#define __STUB__UDBG_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/udbg.h>
++#endif
++
++#endif /* __STUB__UDBG_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/unaligned.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/unaligned.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/unaligned.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/unaligned.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__UNALIGNED_H__
++#define __STUB__UNALIGNED_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/unaligned.h>
++#else
++#include <asm-ppc/unaligned.h>
++#endif
++
++#endif /* __STUB__UNALIGNED_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/unistd.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/unistd.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/unistd.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/unistd.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__UNISTD_H__
++#define __STUB__UNISTD_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/unistd.h>
++#else
++#include <asm-ppc/unistd.h>
++#endif
++
++#endif /* __STUB__UNISTD_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/user.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/user.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/user.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/user.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__USER_H__
++#define __STUB__USER_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/user.h>
++#else
++#include <asm-ppc/user.h>
++#endif
++
++#endif /* __STUB__USER_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/vga.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/vga.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/vga.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/vga.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,10 @@
++#ifndef __STUB__VGA_H__
++#define __STUB__VGA_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/vga.h>
++#else
++#include <asm-ppc/vga.h>
++#endif
++
++#endif /* __STUB__VGA_H__ */
+diff -Naur linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/xics.h linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/xics.h
+--- linux-libc-headers-2.6.12.0.orig/include/asm-ppc-biarch/xics.h	Wed Dec 31 19:00:00 1969
++++ linux-libc-headers-2.6.12.0/include/asm-ppc-biarch/xics.h	Thu Oct 20 12:39:51 2005
+@@ -0,0 +1,8 @@
++#ifndef __STUB__XICS_H__
++#define __STUB__XICS_H__
++
++#ifdef __powerpc64__
++#include <asm-ppc64/xics.h>
++#endif
++
++#endif /* __STUB__XICS_H__ */
Index: patches/linux-libc-headers-2.6.12.0-sparc_biarch-1.patch
===================================================================
--- patches/linux-libc-headers-2.6.12.0-sparc_biarch-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-libc-headers-2.6.12.0-sparc_biarch-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1707 @@
+Submitted By: Jeremy Huntwork (jhuntwork at linuxfromscratch dot org)
+Date: 2005-05-08
+Initial Package Version: 2.6.11.2
+Origin: Created for Cross-LFS
+Upstream Status: Not submitted - LFS Specific
+Description: Creates kernel header stubs for biarch builds, specific to sparc arch.
+             Based on cross-lfs scripts by Ryan Oliver
+
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/a.out.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/a.out.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/a.out.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/a.out.h	2005-05-08 23:33:21.279196726 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__A_OUT_H__
++#define __STUB__A_OUT_H__
++#ifdef __arch64__
++#include <asm-sparc64/a.out.h>
++#else
++#include <asm-sparc/a.out.h>
++#endif
++#endif /* __STUB__A_OUT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/agp.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/agp.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/agp.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/agp.h	2005-05-08 23:33:21.297194377 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__AGP_H__
++#define __STUB__AGP_H__
++#ifdef __arch64__
++#include <asm-sparc64/agp.h>
++#endif
++#endif /* __STUB__AGP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/apb.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/apb.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/apb.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/apb.h	2005-05-08 23:33:21.315192029 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__APB_H__
++#define __STUB__APB_H__
++#ifdef __arch64__
++#include <asm-sparc64/apb.h>
++#endif
++#endif /* __STUB__APB_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/apc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/apc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/apc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/apc.h	2005-05-08 23:33:18.984496193 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__APC_H__
++#define __STUB__APC_H__
++#ifndef __arch64__
++#include <asm-sparc/apc.h>
++#endif
++#endif /* __STUB__APC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/asi.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/asi.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/asi.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/asi.h	2005-05-08 23:33:21.334189549 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ASI_H__
++#define __STUB__ASI_H__
++#ifdef __arch64__
++#include <asm-sparc64/asi.h>
++#else
++#include <asm-sparc/asi.h>
++#endif
++#endif /* __STUB__ASI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/asmmacro.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/asmmacro.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/asmmacro.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/asmmacro.h	2005-05-08 23:33:19.021491365 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__ASMMACRO_H__
++#define __STUB__ASMMACRO_H__
++#ifndef __arch64__
++#include <asm-sparc/asmmacro.h>
++#endif
++#endif /* __STUB__ASMMACRO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/atomic.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/atomic.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/atomic.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/atomic.h	2005-05-08 23:33:21.354186940 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ATOMIC_H__
++#define __STUB__ATOMIC_H__
++#ifdef __arch64__
++#include <asm-sparc64/atomic.h>
++#else
++#include <asm-sparc/atomic.h>
++#endif
++#endif /* __STUB__ATOMIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/audioio.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/audioio.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/audioio.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/audioio.h	2005-05-08 23:33:21.373184460 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__AUDIOIO_H__
++#define __STUB__AUDIOIO_H__
++#ifdef __arch64__
++#include <asm-sparc64/audioio.h>
++#else
++#include <asm-sparc/audioio.h>
++#endif
++#endif /* __STUB__AUDIOIO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/auxio.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/auxio.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/auxio.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/auxio.h	2005-05-08 23:33:21.392181981 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__AUXIO_H__
++#define __STUB__AUXIO_H__
++#ifdef __arch64__
++#include <asm-sparc64/auxio.h>
++#else
++#include <asm-sparc/auxio.h>
++#endif
++#endif /* __STUB__AUXIO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bbc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bbc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bbc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bbc.h	2005-05-08 23:33:21.412179371 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__BBC_H__
++#define __STUB__BBC_H__
++#ifdef __arch64__
++#include <asm-sparc64/bbc.h>
++#endif
++#endif /* __STUB__BBC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bitext.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bitext.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bitext.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bitext.h	2005-05-08 23:33:19.096481579 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__BITEXT_H__
++#define __STUB__BITEXT_H__
++#ifndef __arch64__
++#include <asm-sparc/bitext.h>
++#endif
++#endif /* __STUB__BITEXT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bitops.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bitops.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bitops.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bitops.h	2005-05-08 23:33:21.430177023 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BITOPS_H__
++#define __STUB__BITOPS_H__
++#ifdef __arch64__
++#include <asm-sparc64/bitops.h>
++#else
++#include <asm-sparc/bitops.h>
++#endif
++#endif /* __STUB__BITOPS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bpp.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bpp.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bpp.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bpp.h	2005-05-08 23:33:21.448174674 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BPP_H__
++#define __STUB__BPP_H__
++#ifdef __arch64__
++#include <asm-sparc64/bpp.h>
++#else
++#include <asm-sparc/bpp.h>
++#endif
++#endif /* __STUB__BPP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bsderrno.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bsderrno.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/bsderrno.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/bsderrno.h	2005-05-08 23:33:21.468172064 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BSDERRNO_H__
++#define __STUB__BSDERRNO_H__
++#ifdef __arch64__
++#include <asm-sparc64/bsderrno.h>
++#else
++#include <asm-sparc/bsderrno.h>
++#endif
++#endif /* __STUB__BSDERRNO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/btfixup.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/btfixup.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/btfixup.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/btfixup.h	2005-05-08 23:33:19.172471662 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__BTFIXUP_H__
++#define __STUB__BTFIXUP_H__
++#ifndef __arch64__
++#include <asm-sparc/btfixup.h>
++#endif
++#endif /* __STUB__BTFIXUP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/byteorder.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/byteorder.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/byteorder.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/byteorder.h	2005-05-08 23:33:21.487169585 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BYTEORDER_H__
++#define __STUB__BYTEORDER_H__
++#ifdef __arch64__
++#include <asm-sparc64/byteorder.h>
++#else
++#include <asm-sparc/byteorder.h>
++#endif
++#endif /* __STUB__BYTEORDER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cache.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cache.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cache.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cache.h	2005-05-08 23:33:21.509166714 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__CACHE_H__
++#define __STUB__CACHE_H__
++#ifdef __arch64__
++#include <asm-sparc64/cache.h>
++#else
++#include <asm-sparc/cache.h>
++#endif
++#endif /* __STUB__CACHE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cacheflush.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cacheflush.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cacheflush.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cacheflush.h	2005-05-08 23:33:21.544162147 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__CACHEFLUSH_H__
++#define __STUB__CACHEFLUSH_H__
++#ifdef __arch64__
++#include <asm-sparc64/cacheflush.h>
++#else
++#include <asm-sparc/cacheflush.h>
++#endif
++#endif /* __STUB__CACHEFLUSH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/chafsr.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/chafsr.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/chafsr.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/chafsr.h	2005-05-08 23:33:21.564159537 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__CHAFSR_H__
++#define __STUB__CHAFSR_H__
++#ifdef __arch64__
++#include <asm-sparc64/chafsr.h>
++#endif
++#endif /* __STUB__CHAFSR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/checksum.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/checksum.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/checksum.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/checksum.h	2005-05-08 23:33:21.583157058 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__CHECKSUM_H__
++#define __STUB__CHECKSUM_H__
++#ifdef __arch64__
++#include <asm-sparc64/checksum.h>
++#else
++#include <asm-sparc/checksum.h>
++#endif
++#endif /* __STUB__CHECKSUM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/chmctrl.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/chmctrl.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/chmctrl.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/chmctrl.h	2005-05-08 23:33:21.601154709 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__CHMCTRL_H__
++#define __STUB__CHMCTRL_H__
++#ifdef __arch64__
++#include <asm-sparc64/chmctrl.h>
++#endif
++#endif /* __STUB__CHMCTRL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/clock.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/clock.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/clock.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/clock.h	2005-05-08 23:33:19.266459396 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__CLOCK_H__
++#define __STUB__CLOCK_H__
++#ifndef __arch64__
++#include <asm-sparc/clock.h>
++#endif
++#endif /* __STUB__CLOCK_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/compat.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/compat.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/compat.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/compat.h	2005-05-08 23:33:21.620152230 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__COMPAT_H__
++#define __STUB__COMPAT_H__
++#ifdef __arch64__
++#include <asm-sparc64/compat.h>
++#endif
++#endif /* __STUB__COMPAT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/const.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/const.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/const.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/const.h	2005-05-08 23:33:21.640149620 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__CONST_H__
++#define __STUB__CONST_H__
++#ifdef __arch64__
++#include <asm-sparc64/const.h>
++#endif
++#endif /* __STUB__CONST_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/contregs.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/contregs.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/contregs.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/contregs.h	2005-05-08 23:33:19.285456917 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__CONTREGS_H__
++#define __STUB__CONTREGS_H__
++#ifndef __arch64__
++#include <asm-sparc/contregs.h>
++#endif
++#endif /* __STUB__CONTREGS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cpudata.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cpudata.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cpudata.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cpudata.h	2005-05-08 23:33:21.658147272 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__CPUDATA_H__
++#define __STUB__CPUDATA_H__
++#ifdef __arch64__
++#include <asm-sparc64/cpudata.h>
++#else
++#include <asm-sparc/cpudata.h>
++#endif
++#endif /* __STUB__CPUDATA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cypress.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cypress.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/cypress.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/cypress.h	2005-05-08 23:33:19.323451958 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__CYPRESS_H__
++#define __STUB__CYPRESS_H__
++#ifndef __arch64__
++#include <asm-sparc/cypress.h>
++#endif
++#endif /* __STUB__CYPRESS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/dcr.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/dcr.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/dcr.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/dcr.h	2005-05-08 23:33:21.678144662 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__DCR_H__
++#define __STUB__DCR_H__
++#ifdef __arch64__
++#include <asm-sparc64/dcr.h>
++#endif
++#endif /* __STUB__DCR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/dcu.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/dcu.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/dcu.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/dcu.h	2005-05-08 23:33:21.697142183 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__DCU_H__
++#define __STUB__DCU_H__
++#ifdef __arch64__
++#include <asm-sparc64/dcu.h>
++#endif
++#endif /* __STUB__DCU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/display7seg.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/display7seg.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/display7seg.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/display7seg.h	2005-05-08 23:33:21.715139834 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__DISPLAY7SEG_H__
++#define __STUB__DISPLAY7SEG_H__
++#ifdef __arch64__
++#include <asm-sparc64/display7seg.h>
++#endif
++#endif /* __STUB__DISPLAY7SEG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/dma.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/dma.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/dma.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/dma.h	2005-05-08 23:33:21.733137485 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__DMA_H__
++#define __STUB__DMA_H__
++#ifdef __arch64__
++#include <asm-sparc64/dma.h>
++#else
++#include <asm-sparc/dma.h>
++#endif
++#endif /* __STUB__DMA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ebus.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ebus.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ebus.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ebus.h	2005-05-08 23:33:21.751135136 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__EBUS_H__
++#define __STUB__EBUS_H__
++#ifdef __arch64__
++#include <asm-sparc64/ebus.h>
++#else
++#include <asm-sparc/ebus.h>
++#endif
++#endif /* __STUB__EBUS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ecc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ecc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ecc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ecc.h	2005-05-08 23:33:19.381444390 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__ECC_H__
++#define __STUB__ECC_H__
++#ifndef __arch64__
++#include <asm-sparc/ecc.h>
++#endif
++#endif /* __STUB__ECC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/eeprom.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/eeprom.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/eeprom.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/eeprom.h	2005-05-08 23:33:19.399442041 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__EEPROM_H__
++#define __STUB__EEPROM_H__
++#ifndef __arch64__
++#include <asm-sparc/eeprom.h>
++#endif
++#endif /* __STUB__EEPROM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/elf.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/elf.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/elf.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/elf.h	2005-05-08 23:33:21.770132657 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ELF_H__
++#define __STUB__ELF_H__
++#ifdef __arch64__
++#include <asm-sparc64/elf.h>
++#else
++#include <asm-sparc/elf.h>
++#endif
++#endif /* __STUB__ELF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/envctrl.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/envctrl.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/envctrl.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/envctrl.h	2005-05-08 23:33:21.789130178 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__ENVCTRL_H__
++#define __STUB__ENVCTRL_H__
++#ifdef __arch64__
++#include <asm-sparc64/envctrl.h>
++#endif
++#endif /* __STUB__ENVCTRL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/errno.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/errno.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/errno.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/errno.h	2005-05-08 23:33:21.808127699 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ERRNO_H__
++#define __STUB__ERRNO_H__
++#ifdef __arch64__
++#include <asm-sparc64/errno.h>
++#else
++#include <asm-sparc/errno.h>
++#endif
++#endif /* __STUB__ERRNO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/estate.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/estate.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/estate.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/estate.h	2005-05-08 23:33:21.826125350 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__ESTATE_H__
++#define __STUB__ESTATE_H__
++#ifdef __arch64__
++#include <asm-sparc64/estate.h>
++#endif
++#endif /* __STUB__ESTATE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fbio.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fbio.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fbio.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fbio.h	2005-05-08 23:33:21.846122740 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__FBIO_H__
++#define __STUB__FBIO_H__
++#ifdef __arch64__
++#include <asm-sparc64/fbio.h>
++#else
++#include <asm-sparc/fbio.h>
++#endif
++#endif /* __STUB__FBIO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fcntl.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fcntl.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fcntl.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fcntl.h	2005-05-08 23:33:21.864120391 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__FCNTL_H__
++#define __STUB__FCNTL_H__
++#ifdef __arch64__
++#include <asm-sparc64/fcntl.h>
++#else
++#include <asm-sparc/fcntl.h>
++#endif
++#endif /* __STUB__FCNTL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fhc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fhc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fhc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fhc.h	2005-05-08 23:33:21.882118043 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__FHC_H__
++#define __STUB__FHC_H__
++#ifdef __arch64__
++#include <asm-sparc64/fhc.h>
++#endif
++#endif /* __STUB__FHC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/floppy.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/floppy.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/floppy.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/floppy.h	2005-05-08 23:33:21.901115563 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__FLOPPY_H__
++#define __STUB__FLOPPY_H__
++#ifdef __arch64__
++#include <asm-sparc64/floppy.h>
++#else
++#include <asm-sparc/floppy.h>
++#endif
++#endif /* __STUB__FLOPPY_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fpumacro.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fpumacro.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/fpumacro.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/fpumacro.h	2005-05-08 23:33:21.919113215 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__FPUMACRO_H__
++#define __STUB__FPUMACRO_H__
++#ifdef __arch64__
++#include <asm-sparc64/fpumacro.h>
++#endif
++#endif /* __STUB__FPUMACRO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/hardirq.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/hardirq.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/hardirq.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/hardirq.h	2005-05-08 23:33:21.939110605 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HARDIRQ_H__
++#define __STUB__HARDIRQ_H__
++#ifdef __arch64__
++#include <asm-sparc64/hardirq.h>
++#else
++#include <asm-sparc/hardirq.h>
++#endif
++#endif /* __STUB__HARDIRQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/hdreg.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/hdreg.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/hdreg.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/hdreg.h	2005-05-08 23:33:21.958108126 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HDREG_H__
++#define __STUB__HDREG_H__
++#ifdef __arch64__
++#include <asm-sparc64/hdreg.h>
++#else
++#include <asm-sparc/hdreg.h>
++#endif
++#endif /* __STUB__HDREG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/head.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/head.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/head.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/head.h	2005-05-08 23:33:21.976105777 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HEAD_H__
++#define __STUB__HEAD_H__
++#ifdef __arch64__
++#include <asm-sparc64/head.h>
++#else
++#include <asm-sparc/head.h>
++#endif
++#endif /* __STUB__HEAD_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/hw_irq.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/hw_irq.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/hw_irq.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/hw_irq.h	2005-05-08 23:33:21.995103298 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__HW_IRQ_H__
++#define __STUB__HW_IRQ_H__
++#ifdef __arch64__
++#include <asm-sparc64/hw_irq.h>
++#else
++#include <asm-sparc/hw_irq.h>
++#endif
++#endif /* __STUB__HW_IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/idprom.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/idprom.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/idprom.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/idprom.h	2005-05-08 23:33:22.014100818 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IDPROM_H__
++#define __STUB__IDPROM_H__
++#ifdef __arch64__
++#include <asm-sparc64/idprom.h>
++#else
++#include <asm-sparc/idprom.h>
++#endif
++#endif /* __STUB__IDPROM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/init.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/init.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/init.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/init.h	2005-05-08 23:33:22.035098078 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__INIT_H__
++#define __STUB__INIT_H__
++#ifdef __arch64__
++#include <asm-sparc64/init.h>
++#else
++#include <asm-sparc/init.h>
++#endif
++#endif /* __STUB__INIT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/io-unit.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/io-unit.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/io-unit.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/io-unit.h	2005-05-08 23:33:19.625412551 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__IO-UNIT_H__
++#define __STUB__IO-UNIT_H__
++#ifndef __arch64__
++#include <asm-sparc/io-unit.h>
++#endif
++#endif /* __STUB__IO-UNIT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/io.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/io.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/io.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/io.h	2005-05-08 23:33:22.053095729 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IO_H__
++#define __STUB__IO_H__
++#ifdef __arch64__
++#include <asm-sparc64/io.h>
++#else
++#include <asm-sparc/io.h>
++#endif
++#endif /* __STUB__IO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ioctl.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ioctl.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ioctl.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ioctl.h	2005-05-08 23:33:22.074092989 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IOCTL_H__
++#define __STUB__IOCTL_H__
++#ifdef __arch64__
++#include <asm-sparc64/ioctl.h>
++#else
++#include <asm-sparc/ioctl.h>
++#endif
++#endif /* __STUB__IOCTL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ioctls.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ioctls.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ioctls.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ioctls.h	2005-05-08 23:33:22.095090249 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IOCTLS_H__
++#define __STUB__IOCTLS_H__
++#ifdef __arch64__
++#include <asm-sparc64/ioctls.h>
++#else
++#include <asm-sparc/ioctls.h>
++#endif
++#endif /* __STUB__IOCTLS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/iommu.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/iommu.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/iommu.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/iommu.h	2005-05-08 23:33:22.113087900 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IOMMU_H__
++#define __STUB__IOMMU_H__
++#ifdef __arch64__
++#include <asm-sparc64/iommu.h>
++#else
++#include <asm-sparc/iommu.h>
++#endif
++#endif /* __STUB__IOMMU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ipc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ipc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ipc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ipc.h	2005-05-08 23:33:22.132085421 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IPC_H__
++#define __STUB__IPC_H__
++#ifdef __arch64__
++#include <asm-sparc64/ipc.h>
++#else
++#include <asm-sparc/ipc.h>
++#endif
++#endif /* __STUB__IPC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ipcbuf.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ipcbuf.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ipcbuf.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ipcbuf.h	2005-05-08 23:33:22.151082942 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IPCBUF_H__
++#define __STUB__IPCBUF_H__
++#ifdef __arch64__
++#include <asm-sparc64/ipcbuf.h>
++#else
++#include <asm-sparc/ipcbuf.h>
++#endif
++#endif /* __STUB__IPCBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/irq.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/irq.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/irq.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/irq.h	2005-05-08 23:33:22.170080462 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IRQ_H__
++#define __STUB__IRQ_H__
++#ifdef __arch64__
++#include <asm-sparc64/irq.h>
++#else
++#include <asm-sparc/irq.h>
++#endif
++#endif /* __STUB__IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/isa.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/isa.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/isa.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/isa.h	2005-05-08 23:33:22.188078114 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__ISA_H__
++#define __STUB__ISA_H__
++#ifdef __arch64__
++#include <asm-sparc64/isa.h>
++#endif
++#endif /* __STUB__ISA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/jsflash.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/jsflash.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/jsflash.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/jsflash.h	2005-05-08 23:33:19.776392848 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__JSFLASH_H__
++#define __STUB__JSFLASH_H__
++#ifndef __arch64__
++#include <asm-sparc/jsflash.h>
++#endif
++#endif /* __STUB__JSFLASH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/kbio.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/kbio.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/kbio.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/kbio.h	2005-05-08 23:33:22.207075634 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__KBIO_H__
++#define __STUB__KBIO_H__
++#ifdef __arch64__
++#include <asm-sparc64/kbio.h>
++#else
++#include <asm-sparc/kbio.h>
++#endif
++#endif /* __STUB__KBIO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/kdebug.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/kdebug.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/kdebug.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/kdebug.h	2005-05-08 23:33:22.226073155 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__KDEBUG_H__
++#define __STUB__KDEBUG_H__
++#ifdef __arch64__
++#include <asm-sparc64/kdebug.h>
++#else
++#include <asm-sparc/kdebug.h>
++#endif
++#endif /* __STUB__KDEBUG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/kprobes.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/kprobes.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/kprobes.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/kprobes.h	2005-05-08 23:33:22.245070676 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__KPROBES_H__
++#define __STUB__KPROBES_H__
++#ifdef __arch64__
++#include <asm-sparc64/kprobes.h>
++#endif
++#endif /* __STUB__KPROBES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/linkage.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/linkage.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/linkage.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/linkage.h	2005-05-08 23:33:22.264068197 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__LINKAGE_H__
++#define __STUB__LINKAGE_H__
++#ifdef __arch64__
++#include <asm-sparc64/linkage.h>
++#else
++#include <asm-sparc/linkage.h>
++#endif
++#endif /* __STUB__LINKAGE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/lsu.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/lsu.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/lsu.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/lsu.h	2005-05-08 23:33:22.283065717 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__LSU_H__
++#define __STUB__LSU_H__
++#ifdef __arch64__
++#include <asm-sparc64/lsu.h>
++#endif
++#endif /* __STUB__LSU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/machines.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/machines.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/machines.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/machines.h	2005-05-08 23:33:19.853382800 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__MACHINES_H__
++#define __STUB__MACHINES_H__
++#ifndef __arch64__
++#include <asm-sparc/machines.h>
++#endif
++#endif /* __STUB__MACHINES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mbus.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mbus.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mbus.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mbus.h	2005-05-08 23:33:19.873380191 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__MBUS_H__
++#define __STUB__MBUS_H__
++#ifndef __arch64__
++#include <asm-sparc/mbus.h>
++#endif
++#endif /* __STUB__MBUS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/memreg.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/memreg.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/memreg.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/memreg.h	2005-05-08 23:33:19.891377842 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__MEMREG_H__
++#define __STUB__MEMREG_H__
++#ifndef __arch64__
++#include <asm-sparc/memreg.h>
++#endif
++#endif /* __STUB__MEMREG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mman.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mman.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mman.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mman.h	2005-05-08 23:33:22.302063238 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MMAN_H__
++#define __STUB__MMAN_H__
++#ifdef __arch64__
++#include <asm-sparc64/mman.h>
++#else
++#include <asm-sparc/mman.h>
++#endif
++#endif /* __STUB__MMAN_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mmu.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mmu.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mmu.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mmu.h	2005-05-08 23:33:22.321060759 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MMU_H__
++#define __STUB__MMU_H__
++#ifdef __arch64__
++#include <asm-sparc64/mmu.h>
++#else
++#include <asm-sparc/mmu.h>
++#endif
++#endif /* __STUB__MMU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mmu_context.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mmu_context.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mmu_context.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mmu_context.h	2005-05-08 23:33:22.340058280 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MMU_CONTEXT_H__
++#define __STUB__MMU_CONTEXT_H__
++#ifdef __arch64__
++#include <asm-sparc64/mmu_context.h>
++#else
++#include <asm-sparc/mmu_context.h>
++#endif
++#endif /* __STUB__MMU_CONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/module.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/module.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/module.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/module.h	2005-05-08 23:33:22.358055931 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MODULE_H__
++#define __STUB__MODULE_H__
++#ifdef __arch64__
++#include <asm-sparc64/module.h>
++#else
++#include <asm-sparc/module.h>
++#endif
++#endif /* __STUB__MODULE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mostek.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mostek.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mostek.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mostek.h	2005-05-08 23:33:22.376053582 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MOSTEK_H__
++#define __STUB__MOSTEK_H__
++#ifdef __arch64__
++#include <asm-sparc64/mostek.h>
++#else
++#include <asm-sparc/mostek.h>
++#endif
++#endif /* __STUB__MOSTEK_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mpmbox.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mpmbox.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mpmbox.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mpmbox.h	2005-05-08 23:33:20.008362575 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__MPMBOX_H__
++#define __STUB__MPMBOX_H__
++#ifndef __arch64__
++#include <asm-sparc/mpmbox.h>
++#endif
++#endif /* __STUB__MPMBOX_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/msgbuf.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/msgbuf.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/msgbuf.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/msgbuf.h	2005-05-08 23:33:22.395051103 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MSGBUF_H__
++#define __STUB__MSGBUF_H__
++#ifdef __arch64__
++#include <asm-sparc64/msgbuf.h>
++#else
++#include <asm-sparc/msgbuf.h>
++#endif
++#endif /* __STUB__MSGBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/msi.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/msi.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/msi.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/msi.h	2005-05-08 23:33:20.045357747 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__MSI_H__
++#define __STUB__MSI_H__
++#ifndef __arch64__
++#include <asm-sparc/msi.h>
++#endif
++#endif /* __STUB__MSI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mxcc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mxcc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/mxcc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/mxcc.h	2005-05-08 23:33:20.065355137 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__MXCC_H__
++#define __STUB__MXCC_H__
++#ifndef __arch64__
++#include <asm-sparc/mxcc.h>
++#endif
++#endif /* __STUB__MXCC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/namei.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/namei.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/namei.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/namei.h	2005-05-08 23:33:22.415048493 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__NAMEI_H__
++#define __STUB__NAMEI_H__
++#ifdef __arch64__
++#include <asm-sparc64/namei.h>
++#else
++#include <asm-sparc/namei.h>
++#endif
++#endif /* __STUB__NAMEI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ns87303.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ns87303.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ns87303.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ns87303.h	2005-05-08 23:33:22.433046144 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__NS87303_H__
++#define __STUB__NS87303_H__
++#ifdef __arch64__
++#include <asm-sparc64/ns87303.h>
++#endif
++#endif /* __STUB__NS87303_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/obio.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/obio.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/obio.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/obio.h	2005-05-08 23:33:20.102350309 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__OBIO_H__
++#define __STUB__OBIO_H__
++#ifndef __arch64__
++#include <asm-sparc/obio.h>
++#endif
++#endif /* __STUB__OBIO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/openprom.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/openprom.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/openprom.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/openprom.h	2005-05-08 23:33:22.453043535 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OPENPROM_H__
++#define __STUB__OPENPROM_H__
++#ifdef __arch64__
++#include <asm-sparc64/openprom.h>
++#else
++#include <asm-sparc/openprom.h>
++#endif
++#endif /* __STUB__OPENPROM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/openpromio.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/openpromio.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/openpromio.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/openpromio.h	2005-05-08 23:33:22.472041055 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OPENPROMIO_H__
++#define __STUB__OPENPROMIO_H__
++#ifdef __arch64__
++#include <asm-sparc64/openpromio.h>
++#else
++#include <asm-sparc/openpromio.h>
++#endif
++#endif /* __STUB__OPENPROMIO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/oplib.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/oplib.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/oplib.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/oplib.h	2005-05-08 23:33:22.491038576 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__OPLIB_H__
++#define __STUB__OPLIB_H__
++#ifdef __arch64__
++#include <asm-sparc64/oplib.h>
++#else
++#include <asm-sparc/oplib.h>
++#endif
++#endif /* __STUB__OPLIB_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/page.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/page.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/page.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/page.h	2005-05-08 23:33:22.509036227 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PAGE_H__
++#define __STUB__PAGE_H__
++#ifdef __arch64__
++#include <asm-sparc64/page.h>
++#else
++#include <asm-sparc/page.h>
++#endif
++#endif /* __STUB__PAGE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/param.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/param.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/param.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/param.h	2005-05-08 23:33:22.527033879 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PARAM_H__
++#define __STUB__PARAM_H__
++#ifdef __arch64__
++#include <asm-sparc64/param.h>
++#else
++#include <asm-sparc/param.h>
++#endif
++#endif /* __STUB__PARAM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/parport.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/parport.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/parport.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/parport.h	2005-05-08 23:33:22.547031269 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PARPORT_H__
++#define __STUB__PARPORT_H__
++#ifdef __arch64__
++#include <asm-sparc64/parport.h>
++#endif
++#endif /* __STUB__PARPORT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pbm.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pbm.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pbm.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pbm.h	2005-05-08 23:33:22.566028790 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PBM_H__
++#define __STUB__PBM_H__
++#ifdef __arch64__
++#include <asm-sparc64/pbm.h>
++#else
++#include <asm-sparc/pbm.h>
++#endif
++#endif /* __STUB__PBM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pcic.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pcic.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pcic.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pcic.h	2005-05-08 23:33:20.235332954 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PCIC_H__
++#define __STUB__PCIC_H__
++#ifndef __arch64__
++#include <asm-sparc/pcic.h>
++#endif
++#endif /* __STUB__PCIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pconf.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pconf.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pconf.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pconf.h	2005-05-08 23:33:22.586026180 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PCONF_H__
++#define __STUB__PCONF_H__
++#ifdef __arch64__
++#include <asm-sparc64/pconf.h>
++#else
++#include <asm-sparc/pconf.h>
++#endif
++#endif /* __STUB__PCONF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/perfctr.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/perfctr.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/perfctr.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/perfctr.h	2005-05-08 23:33:22.606023570 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PERFCTR_H__
++#define __STUB__PERFCTR_H__
++#ifdef __arch64__
++#include <asm-sparc64/perfctr.h>
++#else
++#include <asm-sparc/perfctr.h>
++#endif
++#endif /* __STUB__PERFCTR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgalloc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgalloc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgalloc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgalloc.h	2005-05-08 23:33:22.625021091 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PGALLOC_H__
++#define __STUB__PGALLOC_H__
++#ifdef __arch64__
++#include <asm-sparc64/pgalloc.h>
++#else
++#include <asm-sparc/pgalloc.h>
++#endif
++#endif /* __STUB__PGALLOC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgtsrmmu.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgtsrmmu.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgtsrmmu.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgtsrmmu.h	2005-05-08 23:33:20.310323168 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PGTSRMMU_H__
++#define __STUB__PGTSRMMU_H__
++#ifndef __arch64__
++#include <asm-sparc/pgtsrmmu.h>
++#endif
++#endif /* __STUB__PGTSRMMU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgtsun4.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgtsun4.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgtsun4.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgtsun4.h	2005-05-08 23:33:20.328320819 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PGTSUN4_H__
++#define __STUB__PGTSUN4_H__
++#ifndef __arch64__
++#include <asm-sparc/pgtsun4.h>
++#endif
++#endif /* __STUB__PGTSUN4_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgtsun4c.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgtsun4c.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pgtsun4c.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pgtsun4c.h	2005-05-08 23:33:20.346318470 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PGTSUN4C_H__
++#define __STUB__PGTSUN4C_H__
++#ifndef __arch64__
++#include <asm-sparc/pgtsun4c.h>
++#endif
++#endif /* __STUB__PGTSUN4C_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pil.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pil.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pil.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pil.h	2005-05-08 23:33:22.644018612 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PIL_H__
++#define __STUB__PIL_H__
++#ifdef __arch64__
++#include <asm-sparc64/pil.h>
++#endif
++#endif /* __STUB__PIL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/poll.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/poll.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/poll.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/poll.h	2005-05-08 23:33:22.663016132 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__POLL_H__
++#define __STUB__POLL_H__
++#ifdef __arch64__
++#include <asm-sparc64/poll.h>
++#else
++#include <asm-sparc/poll.h>
++#endif
++#endif /* __STUB__POLL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/posix_types.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/posix_types.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/posix_types.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/posix_types.h	2005-05-08 23:33:22.682013653 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__POSIX_TYPES_H__
++#define __STUB__POSIX_TYPES_H__
++#ifdef __arch64__
++#include <asm-sparc64/posix_types.h>
++#else
++#include <asm-sparc/posix_types.h>
++#endif
++#endif /* __STUB__POSIX_TYPES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/processor.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/processor.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/processor.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/processor.h	2005-05-08 23:33:22.700011304 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PROCESSOR_H__
++#define __STUB__PROCESSOR_H__
++#ifdef __arch64__
++#include <asm-sparc64/processor.h>
++#else
++#include <asm-sparc/processor.h>
++#endif
++#endif /* __STUB__PROCESSOR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/psr.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/psr.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/psr.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/psr.h	2005-05-08 23:33:20.422308553 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PSR_H__
++#define __STUB__PSR_H__
++#ifndef __arch64__
++#include <asm-sparc/psr.h>
++#endif
++#endif /* __STUB__PSR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/psrcompat.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/psrcompat.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/psrcompat.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/psrcompat.h	2005-05-08 23:33:22.719008825 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PSRCOMPAT_H__
++#define __STUB__PSRCOMPAT_H__
++#ifdef __arch64__
++#include <asm-sparc64/psrcompat.h>
++#endif
++#endif /* __STUB__PSRCOMPAT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pstate.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pstate.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/pstate.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/pstate.h	2005-05-08 23:33:22.737006476 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__PSTATE_H__
++#define __STUB__PSTATE_H__
++#ifdef __arch64__
++#include <asm-sparc64/pstate.h>
++#endif
++#endif /* __STUB__PSTATE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ptrace.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ptrace.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ptrace.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ptrace.h	2005-05-08 23:33:22.757003867 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PTRACE_H__
++#define __STUB__PTRACE_H__
++#ifdef __arch64__
++#include <asm-sparc64/ptrace.h>
++#else
++#include <asm-sparc/ptrace.h>
++#endif
++#endif /* __STUB__PTRACE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/reg.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/reg.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/reg.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/reg.h	2005-05-08 23:33:22.775001518 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__REG_H__
++#define __STUB__REG_H__
++#ifdef __arch64__
++#include <asm-sparc64/reg.h>
++#else
++#include <asm-sparc/reg.h>
++#endif
++#endif /* __STUB__REG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ross.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ross.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ross.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ross.h	2005-05-08 23:33:20.478301246 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__ROSS_H__
++#define __STUB__ROSS_H__
++#ifndef __arch64__
++#include <asm-sparc/ross.h>
++#endif
++#endif /* __STUB__ROSS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sbi.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sbi.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sbi.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sbi.h	2005-05-08 23:33:20.496298897 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SBI_H__
++#define __STUB__SBI_H__
++#ifndef __arch64__
++#include <asm-sparc/sbi.h>
++#endif
++#endif /* __STUB__SBI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sbus.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sbus.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sbus.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sbus.h	2005-05-08 23:33:22.794998908 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SBUS_H__
++#define __STUB__SBUS_H__
++#ifdef __arch64__
++#include <asm-sparc64/sbus.h>
++#else
++#include <asm-sparc/sbus.h>
++#endif
++#endif /* __STUB__SBUS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/segment.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/segment.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/segment.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/segment.h	2005-05-08 23:33:22.812996559 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SEGMENT_H__
++#define __STUB__SEGMENT_H__
++#ifdef __arch64__
++#include <asm-sparc64/segment.h>
++#else
++#include <asm-sparc/segment.h>
++#endif
++#endif /* __STUB__SEGMENT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/semaphore.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/semaphore.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/semaphore.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/semaphore.h	2005-05-08 23:33:22.832993950 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SEMAPHORE_H__
++#define __STUB__SEMAPHORE_H__
++#ifdef __arch64__
++#include <asm-sparc64/semaphore.h>
++#else
++#include <asm-sparc/semaphore.h>
++#endif
++#endif /* __STUB__SEMAPHORE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sembuf.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sembuf.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sembuf.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sembuf.h	2005-05-08 23:33:22.852991340 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SEMBUF_H__
++#define __STUB__SEMBUF_H__
++#ifdef __arch64__
++#include <asm-sparc64/sembuf.h>
++#else
++#include <asm-sparc/sembuf.h>
++#endif
++#endif /* __STUB__SEMBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sfp-machine.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sfp-machine.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sfp-machine.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sfp-machine.h	2005-05-08 23:33:22.871988861 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SFP-MACHINE_H__
++#define __STUB__SFP-MACHINE_H__
++#ifdef __arch64__
++#include <asm-sparc64/sfp-machine.h>
++#else
++#include <asm-sparc/sfp-machine.h>
++#endif
++#endif /* __STUB__SFP-MACHINE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/shmbuf.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/shmbuf.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/shmbuf.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/shmbuf.h	2005-05-08 23:33:22.890986381 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SHMBUF_H__
++#define __STUB__SHMBUF_H__
++#ifdef __arch64__
++#include <asm-sparc64/shmbuf.h>
++#else
++#include <asm-sparc/shmbuf.h>
++#endif
++#endif /* __STUB__SHMBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/shmparam.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/shmparam.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/shmparam.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/shmparam.h	2005-05-08 23:33:22.909983902 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SHMPARAM_H__
++#define __STUB__SHMPARAM_H__
++#ifdef __arch64__
++#include <asm-sparc64/shmparam.h>
++#else
++#include <asm-sparc/shmparam.h>
++#endif
++#endif /* __STUB__SHMPARAM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sigcontext.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sigcontext.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sigcontext.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sigcontext.h	2005-05-08 23:33:22.928981423 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SIGCONTEXT_H__
++#define __STUB__SIGCONTEXT_H__
++#ifdef __arch64__
++#include <asm-sparc64/sigcontext.h>
++#else
++#include <asm-sparc/sigcontext.h>
++#endif
++#endif /* __STUB__SIGCONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/siginfo.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/siginfo.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/siginfo.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/siginfo.h	2005-05-08 23:33:22.946979074 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SIGINFO_H__
++#define __STUB__SIGINFO_H__
++#ifdef __arch64__
++#include <asm-sparc64/siginfo.h>
++#else
++#include <asm-sparc/siginfo.h>
++#endif
++#endif /* __STUB__SIGINFO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/smpprim.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/smpprim.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/smpprim.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/smpprim.h	2005-05-08 23:33:20.689273713 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SMPPRIM_H__
++#define __STUB__SMPPRIM_H__
++#ifndef __arch64__
++#include <asm-sparc/smpprim.h>
++#endif
++#endif /* __STUB__SMPPRIM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/socket.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/socket.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/socket.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/socket.h	2005-05-08 23:33:22.965976595 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SOCKET_H__
++#define __STUB__SOCKET_H__
++#ifdef __arch64__
++#include <asm-sparc64/socket.h>
++#else
++#include <asm-sparc/socket.h>
++#endif
++#endif /* __STUB__SOCKET_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sockios.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sockios.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sockios.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sockios.h	2005-05-08 23:33:22.985973985 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SOCKIOS_H__
++#define __STUB__SOCKIOS_H__
++#ifdef __arch64__
++#include <asm-sparc64/sockios.h>
++#else
++#include <asm-sparc/sockios.h>
++#endif
++#endif /* __STUB__SOCKIOS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/solerrno.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/solerrno.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/solerrno.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/solerrno.h	2005-05-08 23:33:23.003971636 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SOLERRNO_H__
++#define __STUB__SOLERRNO_H__
++#ifdef __arch64__
++#include <asm-sparc64/solerrno.h>
++#else
++#include <asm-sparc/solerrno.h>
++#endif
++#endif /* __STUB__SOLERRNO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/spinlock.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/spinlock.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/spinlock.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/spinlock.h	2005-05-08 23:33:23.022969157 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SPINLOCK_H__
++#define __STUB__SPINLOCK_H__
++#ifdef __arch64__
++#include <asm-sparc64/spinlock.h>
++#else
++#include <asm-sparc/spinlock.h>
++#endif
++#endif /* __STUB__SPINLOCK_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/spitfire.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/spitfire.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/spitfire.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/spitfire.h	2005-05-08 23:33:23.041966678 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SPITFIRE_H__
++#define __STUB__SPITFIRE_H__
++#ifdef __arch64__
++#include <asm-sparc64/spitfire.h>
++#endif
++#endif /* __STUB__SPITFIRE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/starfire.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/starfire.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/starfire.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/starfire.h	2005-05-08 23:33:23.059964329 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__STARFIRE_H__
++#define __STUB__STARFIRE_H__
++#ifdef __arch64__
++#include <asm-sparc64/starfire.h>
++#endif
++#endif /* __STUB__STARFIRE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/stat.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/stat.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/stat.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/stat.h	2005-05-08 23:33:23.078961850 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__STAT_H__
++#define __STUB__STAT_H__
++#ifdef __arch64__
++#include <asm-sparc64/stat.h>
++#else
++#include <asm-sparc/stat.h>
++#endif
++#endif /* __STUB__STAT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sun4paddr.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sun4paddr.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sun4paddr.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sun4paddr.h	2005-05-08 23:33:20.801259099 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SUN4PADDR_H__
++#define __STUB__SUN4PADDR_H__
++#ifndef __arch64__
++#include <asm-sparc/sun4paddr.h>
++#endif
++#endif /* __STUB__SUN4PADDR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sun4prom.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sun4prom.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sun4prom.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sun4prom.h	2005-05-08 23:33:20.819256750 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SUN4PROM_H__
++#define __STUB__SUN4PROM_H__
++#ifndef __arch64__
++#include <asm-sparc/sun4prom.h>
++#endif
++#endif /* __STUB__SUN4PROM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sunbpp.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sunbpp.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sunbpp.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sunbpp.h	2005-05-08 23:33:23.096959501 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SUNBPP_H__
++#define __STUB__SUNBPP_H__
++#ifdef __arch64__
++#include <asm-sparc64/sunbpp.h>
++#else
++#include <asm-sparc/sunbpp.h>
++#endif
++#endif /* __STUB__SUNBPP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/svr4.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/svr4.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/svr4.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/svr4.h	2005-05-08 23:33:23.115957022 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SVR4_H__
++#define __STUB__SVR4_H__
++#ifdef __arch64__
++#include <asm-sparc64/svr4.h>
++#else
++#include <asm-sparc/svr4.h>
++#endif
++#endif /* __STUB__SVR4_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/swift.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/swift.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/swift.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/swift.h	2005-05-08 23:33:20.878249051 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SWIFT_H__
++#define __STUB__SWIFT_H__
++#ifndef __arch64__
++#include <asm-sparc/swift.h>
++#endif
++#endif /* __STUB__SWIFT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sysen.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sysen.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/sysen.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/sysen.h	2005-05-08 23:33:20.897246572 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__SYSEN_H__
++#define __STUB__SYSEN_H__
++#ifndef __arch64__
++#include <asm-sparc/sysen.h>
++#endif
++#endif /* __STUB__SYSEN_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/system.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/system.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/system.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/system.h	2005-05-08 23:33:23.135954412 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SYSTEM_H__
++#define __STUB__SYSTEM_H__
++#ifdef __arch64__
++#include <asm-sparc64/system.h>
++#else
++#include <asm-sparc/system.h>
++#endif
++#endif /* __STUB__SYSTEM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/termbits.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/termbits.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/termbits.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/termbits.h	2005-05-08 23:33:23.155951802 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TERMBITS_H__
++#define __STUB__TERMBITS_H__
++#ifdef __arch64__
++#include <asm-sparc64/termbits.h>
++#else
++#include <asm-sparc/termbits.h>
++#endif
++#endif /* __STUB__TERMBITS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/termios.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/termios.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/termios.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/termios.h	2005-05-08 23:33:23.174949323 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TERMIOS_H__
++#define __STUB__TERMIOS_H__
++#ifdef __arch64__
++#include <asm-sparc64/termios.h>
++#else
++#include <asm-sparc/termios.h>
++#endif
++#endif /* __STUB__TERMIOS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/timer.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/timer.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/timer.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/timer.h	2005-05-08 23:33:23.193946844 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TIMER_H__
++#define __STUB__TIMER_H__
++#ifdef __arch64__
++#include <asm-sparc64/timer.h>
++#else
++#include <asm-sparc/timer.h>
++#endif
++#endif /* __STUB__TIMER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/timex.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/timex.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/timex.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/timex.h	2005-05-08 23:33:23.212944365 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TIMEX_H__
++#define __STUB__TIMEX_H__
++#ifdef __arch64__
++#include <asm-sparc64/timex.h>
++#else
++#include <asm-sparc/timex.h>
++#endif
++#endif /* __STUB__TIMEX_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/tlbflush.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/tlbflush.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/tlbflush.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/tlbflush.h	2005-05-08 23:33:23.231941885 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TLBFLUSH_H__
++#define __STUB__TLBFLUSH_H__
++#ifdef __arch64__
++#include <asm-sparc64/tlbflush.h>
++#else
++#include <asm-sparc/tlbflush.h>
++#endif
++#endif /* __STUB__TLBFLUSH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/traps.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/traps.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/traps.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/traps.h	2005-05-08 23:33:21.033228826 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__TRAPS_H__
++#define __STUB__TRAPS_H__
++#ifndef __arch64__
++#include <asm-sparc/traps.h>
++#endif
++#endif /* __STUB__TRAPS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/tsunami.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/tsunami.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/tsunami.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/tsunami.h	2005-05-08 23:33:21.051226477 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__TSUNAMI_H__
++#define __STUB__TSUNAMI_H__
++#ifndef __arch64__
++#include <asm-sparc/tsunami.h>
++#endif
++#endif /* __STUB__TSUNAMI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ttable.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ttable.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/ttable.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/ttable.h	2005-05-08 23:33:23.253939015 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__TTABLE_H__
++#define __STUB__TTABLE_H__
++#ifdef __arch64__
++#include <asm-sparc64/ttable.h>
++#endif
++#endif /* __STUB__TTABLE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/turbosparc.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/turbosparc.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/turbosparc.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/turbosparc.h	2005-05-08 23:33:21.071223867 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__TURBOSPARC_H__
++#define __STUB__TURBOSPARC_H__
++#ifndef __arch64__
++#include <asm-sparc/turbosparc.h>
++#endif
++#endif /* __STUB__TURBOSPARC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/types.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/types.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/types.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/types.h	2005-05-08 23:33:23.271936666 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TYPES_H__
++#define __STUB__TYPES_H__
++#ifdef __arch64__
++#include <asm-sparc64/types.h>
++#else
++#include <asm-sparc/types.h>
++#endif
++#endif /* __STUB__TYPES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/uctx.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/uctx.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/uctx.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/uctx.h	2005-05-08 23:33:23.291934056 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__UCTX_H__
++#define __STUB__UCTX_H__
++#ifdef __arch64__
++#include <asm-sparc64/uctx.h>
++#endif
++#endif /* __STUB__UCTX_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/unaligned.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/unaligned.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/unaligned.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/unaligned.h	2005-05-08 23:33:23.311931446 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__UNALIGNED_H__
++#define __STUB__UNALIGNED_H__
++#ifdef __arch64__
++#include <asm-sparc64/unaligned.h>
++#else
++#include <asm-sparc/unaligned.h>
++#endif
++#endif /* __STUB__UNALIGNED_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/unistd.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/unistd.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/unistd.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/unistd.h	2005-05-08 23:33:23.332928706 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__UNISTD_H__
++#define __STUB__UNISTD_H__
++#ifdef __arch64__
++#include <asm-sparc64/unistd.h>
++#else
++#include <asm-sparc/unistd.h>
++#endif
++#endif /* __STUB__UNISTD_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/upa.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/upa.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/upa.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/upa.h	2005-05-08 23:33:23.350926357 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__UPA_H__
++#define __STUB__UPA_H__
++#ifdef __arch64__
++#include <asm-sparc64/upa.h>
++#endif
++#endif /* __STUB__UPA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/user.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/user.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/user.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/user.h	2005-05-08 23:33:23.368924009 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__USER_H__
++#define __STUB__USER_H__
++#ifdef __arch64__
++#include <asm-sparc64/user.h>
++#else
++#include <asm-sparc/user.h>
++#endif
++#endif /* __STUB__USER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/utrap.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/utrap.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/utrap.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/utrap.h	2005-05-08 23:33:23.387921529 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__UTRAP_H__
++#define __STUB__UTRAP_H__
++#ifdef __arch64__
++#include <asm-sparc64/utrap.h>
++#endif
++#endif /* __STUB__UTRAP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vac-ops.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vac-ops.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vac-ops.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vac-ops.h	2005-05-08 23:33:21.165211602 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__VAC-OPS_H__
++#define __STUB__VAC-OPS_H__
++#ifndef __arch64__
++#include <asm-sparc/vac-ops.h>
++#endif
++#endif /* __STUB__VAC-OPS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vaddrs.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vaddrs.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vaddrs.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vaddrs.h	2005-05-08 23:33:21.185208992 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__VADDRS_H__
++#define __STUB__VADDRS_H__
++#ifndef __arch64__
++#include <asm-sparc/vaddrs.h>
++#endif
++#endif /* __STUB__VADDRS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vfc_ioctls.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vfc_ioctls.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vfc_ioctls.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vfc_ioctls.h	2005-05-08 23:33:21.204206513 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__VFC_IOCTLS_H__
++#define __STUB__VFC_IOCTLS_H__
++#ifndef __arch64__
++#include <asm-sparc/vfc_ioctls.h>
++#endif
++#endif /* __STUB__VFC_IOCTLS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vga.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vga.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vga.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vga.h	2005-05-08 23:33:23.406919050 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__VGA_H__
++#define __STUB__VGA_H__
++#ifdef __arch64__
++#include <asm-sparc64/vga.h>
++#endif
++#endif /* __STUB__VGA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/viking.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/viking.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/viking.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/viking.h	2005-05-08 23:33:21.223204033 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__VIKING_H__
++#define __STUB__VIKING_H__
++#ifndef __arch64__
++#include <asm-sparc/viking.h>
++#endif
++#endif /* __STUB__VIKING_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/visasm.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/visasm.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/visasm.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/visasm.h	2005-05-08 23:33:23.425916571 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__VISASM_H__
++#define __STUB__VISASM_H__
++#ifdef __arch64__
++#include <asm-sparc64/visasm.h>
++#endif
++#endif /* __STUB__VISASM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vuid_event.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vuid_event.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/vuid_event.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/vuid_event.h	2005-05-08 23:33:23.443914222 -0400
+@@ -0,0 +1,8 @@
++#ifndef __STUB__VUID_EVENT_H__
++#define __STUB__VUID_EVENT_H__
++#ifdef __arch64__
++#include <asm-sparc64/vuid_event.h>
++#else
++#include <asm-sparc/vuid_event.h>
++#endif
++#endif /* __STUB__VUID_EVENT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/watchdog.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/watchdog.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/watchdog.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/watchdog.h	2005-05-08 23:33:23.462911743 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__WATCHDOG_H__
++#define __STUB__WATCHDOG_H__
++#ifdef __arch64__
++#include <asm-sparc64/watchdog.h>
++#endif
++#endif /* __STUB__WATCHDOG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/winmacro.h linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/winmacro.h
+--- linux-libc-headers-2.6.11.2-ORIG/include/asm-sparc-biarch/winmacro.h	1969-12-31 19:00:00.000000000 -0500
++++ linux-libc-headers-2.6.11.2/include/asm-sparc-biarch/winmacro.h	2005-05-08 23:33:21.259199336 -0400
+@@ -0,0 +1,6 @@
++#ifndef __STUB__WINMACRO_H__
++#define __STUB__WINMACRO_H__
++#ifndef __arch64__
++#include <asm-sparc/winmacro.h>
++#endif
++#endif /* __STUB__WINMACRO_H__ */
+
Index: patches/linux-libc-headers-2.6.12.0-sparc_conflicts-1.patch
===================================================================
--- patches/linux-libc-headers-2.6.12.0-sparc_conflicts-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-libc-headers-2.6.12.0-sparc_conflicts-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,29 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-07-09
+Initial Package Version: 2.6.12.0
+Origin: Jbit and MDH
+Upstream Status: Sent
+Description: Remove unistd.h, conflicts with the silo builds
+ 
+--- linux-libc-headers-2.6.12.0/include/asm-sparc/page.h.orig	2005-07-14 09:04:05.000000000 +0000
++++ linux-libc-headers-2.6.12.0/include/asm-sparc/page.h	2005-07-14 09:04:12.000000000 +0000
+@@ -8,8 +8,6 @@
+ #ifndef _SPARC_PAGE_H
+ #define _SPARC_PAGE_H
+ 
+-#include <unistd.h>
+-
+ #define PAGE_SIZE (getpagesize())
+ static __inline__ int getpageshift()
+ {
+--- linux-libc-headers-2.6.12.0/include/asm-sparc64/page.h.orig	2005-07-14 09:04:23.000000000 +0000
++++ linux-libc-headers-2.6.12.0/include/asm-sparc64/page.h	2005-07-14 09:04:29.000000000 +0000
+@@ -1,8 +1,6 @@
+ #ifndef _SPARC64_PAGE_H
+ #define _SPARC64_PAGE_H
+ 
+-#include <unistd.h>
+-
+ #define PAGE_SIZE (getpagesize())
+ static __inline__ int getpageshift()
+ {
Index: patches/linux-libc-headers-2.6.12.0-x86_64_biarch-1.patch
===================================================================
--- patches/linux-libc-headers-2.6.12.0-x86_64_biarch-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/linux-libc-headers-2.6.12.0-x86_64_biarch-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,2318 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-07-04
+Initial Package Version: 2.6.11.2
+Origin: Created for Cross-LFS
+Upstream Status: Not submitted - LFS Specific
+Description: Creates kernel header stubs for biarch builds, specific to x86_64 arch.
+             Based on cross-lfs scripts by Ryan Oliver 
+
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/8253pit.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/8253pit.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/8253pit.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/8253pit.h	2005-06-25 19:56:03.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__8253PIT_H__
++#define __STUB__8253PIT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/8253pit.h>
++#else
++#include <asm-i386/8253pit.h>
++#endif
++
++#endif /* __STUB__8253PIT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/a.out.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/a.out.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/a.out.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/a.out.h	2005-06-25 19:56:04.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__A_OUT_H__
++#define __STUB__A_OUT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/a.out.h>
++#else
++#include <asm-i386/a.out.h>
++#endif
++
++#endif /* __STUB__A_OUT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/agp.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/agp.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/agp.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/agp.h	2005-06-25 19:56:04.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__AGP_H__
++#define __STUB__AGP_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/agp.h>
++#else
++#include <asm-i386/agp.h>
++#endif
++
++#endif /* __STUB__AGP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/apic.h	2005-06-25 19:56:05.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__APIC_H__
++#define __STUB__APIC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/apic.h>
++#else
++#include <asm-i386/apic.h>
++#endif
++
++#endif /* __STUB__APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/apicdef.h	2005-06-25 19:56:06.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__APICDEF_H__
++#define __STUB__APICDEF_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/apicdef.h>
++#else
++#include <asm-i386/apicdef.h>
++#endif
++
++#endif /* __STUB__APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/arch_hooks.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/arch_hooks.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/arch_hooks.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/arch_hooks.h	2005-06-25 19:56:06.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ARCH_HOOKS_H__
++#define __STUB__ARCH_HOOKS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/arch_hooks.h>
++#endif
++
++#endif /* __STUB__ARCH_HOOKS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/atomic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/atomic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/atomic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/atomic.h	2005-06-25 19:56:07.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__ATOMIC_H__
++#define __STUB__ATOMIC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/atomic.h>
++#else
++#include <asm-i386/atomic.h>
++#endif
++
++#endif /* __STUB__ATOMIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/bitops.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/bitops.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/bitops.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/bitops.h	2005-06-25 19:56:08.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__BITOPS_H__
++#define __STUB__BITOPS_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/bitops.h>
++#else
++#include <asm-i386/bitops.h>
++#endif
++
++#endif /* __STUB__BITOPS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/boot.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/boot.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/boot.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/boot.h	2005-06-25 19:56:09.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__BOOT_H__
++#define __STUB__BOOT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/boot.h>
++#else
++#include <asm-i386/boot.h>
++#endif
++
++#endif /* __STUB__BOOT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/bootsetup.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/bootsetup.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/bootsetup.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/bootsetup.h	2005-06-25 19:55:09.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BOOTSETUP_H__
++#define __STUB__BOOTSETUP_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/bootsetup.h>
++#endif
++
++#endif /* __STUB__BOOTSETUP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/byteorder.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/byteorder.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/byteorder.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/byteorder.h	2005-06-25 19:56:09.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__BYTEORDER_H__
++#define __STUB__BYTEORDER_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/byteorder.h>
++#else
++#include <asm-i386/byteorder.h>
++#endif
++
++#endif /* __STUB__BYTEORDER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cache.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cache.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cache.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cache.h	2005-06-25 19:56:10.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CACHE_H__
++#define __STUB__CACHE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/cache.h>
++#else
++#include <asm-i386/cache.h>
++#endif
++
++#endif /* __STUB__CACHE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cacheflush.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cacheflush.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cacheflush.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cacheflush.h	2005-06-25 19:56:11.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CACHEFLUSH_H__
++#define __STUB__CACHEFLUSH_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/cacheflush.h>
++#else
++#include <asm-i386/cacheflush.h>
++#endif
++
++#endif /* __STUB__CACHEFLUSH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/calling.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/calling.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/calling.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/calling.h	2005-06-25 19:55:12.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__CALLING_H__
++#define __STUB__CALLING_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/calling.h>
++#endif
++
++#endif /* __STUB__CALLING_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/checksum.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/checksum.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/checksum.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/checksum.h	2005-06-25 19:56:12.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CHECKSUM_H__
++#define __STUB__CHECKSUM_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/checksum.h>
++#else
++#include <asm-i386/checksum.h>
++#endif
++
++#endif /* __STUB__CHECKSUM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/compat.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/compat.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/compat.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/compat.h	2005-06-25 19:55:13.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__COMPAT_H__
++#define __STUB__COMPAT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/compat.h>
++#endif
++
++#endif /* __STUB__COMPAT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cpu.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cpu.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cpu.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cpu.h	2005-06-25 19:56:12.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__CPU_H__
++#define __STUB__CPU_H__
++
++#ifndef __x86_64__
++#include <asm-i386/cpu.h>
++#endif
++
++#endif /* __STUB__CPU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cpufeature.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cpufeature.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/cpufeature.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/cpufeature.h	2005-06-25 19:56:13.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__CPUFEATURE_H__
++#define __STUB__CPUFEATURE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/cpufeature.h>
++#else
++#include <asm-i386/cpufeature.h>
++#endif
++
++#endif /* __STUB__CPUFEATURE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/debugreg.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/debugreg.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/debugreg.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/debugreg.h	2005-06-25 19:56:13.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__DEBUGREG_H__
++#define __STUB__DEBUGREG_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/debugreg.h>
++#else
++#include <asm-i386/debugreg.h>
++#endif
++
++#endif /* __STUB__DEBUGREG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/desc.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/desc.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/desc.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/desc.h	2005-06-25 19:56:14.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__DESC_H__
++#define __STUB__DESC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/desc.h>
++#else
++#include <asm-i386/desc.h>
++#endif
++
++#endif /* __STUB__DESC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/dma.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/dma.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/dma.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/dma.h	2005-06-25 19:56:14.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__DMA_H__
++#define __STUB__DMA_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/dma.h>
++#else
++#include <asm-i386/dma.h>
++#endif
++
++#endif /* __STUB__DMA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/dwarf2.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/dwarf2.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/dwarf2.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/dwarf2.h	2005-06-25 19:55:17.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__DWARF2_H__
++#define __STUB__DWARF2_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/dwarf2.h>
++#endif
++
++#endif /* __STUB__DWARF2_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/e820.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/e820.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/e820.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/e820.h	2005-06-25 19:56:15.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__E820_H__
++#define __STUB__E820_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/e820.h>
++#else
++#include <asm-i386/e820.h>
++#endif
++
++#endif /* __STUB__E820_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/elf.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/elf.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/elf.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/elf.h	2005-06-25 19:56:16.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__ELF_H__
++#define __STUB__ELF_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/elf.h>
++#else
++#include <asm-i386/elf.h>
++#endif
++
++#endif /* __STUB__ELF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/errno.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/errno.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/errno.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/errno.h	2005-06-25 19:56:16.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__ERRNO_H__
++#define __STUB__ERRNO_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/errno.h>
++#else
++#include <asm-i386/errno.h>
++#endif
++
++#endif /* __STUB__ERRNO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/fcntl.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/fcntl.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/fcntl.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/fcntl.h	2005-06-25 19:56:17.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__FCNTL_H__
++#define __STUB__FCNTL_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/fcntl.h>
++#else
++#include <asm-i386/fcntl.h>
++#endif
++
++#endif /* __STUB__FCNTL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/fixmap.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/fixmap.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/fixmap.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/fixmap.h	2005-06-25 19:56:18.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__FIXMAP_H__
++#define __STUB__FIXMAP_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/fixmap.h>
++#else
++#include <asm-i386/fixmap.h>
++#endif
++
++#endif /* __STUB__FIXMAP_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/floppy.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/floppy.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/floppy.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/floppy.h	2005-06-25 19:56:19.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__FLOPPY_H__
++#define __STUB__FLOPPY_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/floppy.h>
++#else
++#include <asm-i386/floppy.h>
++#endif
++
++#endif /* __STUB__FLOPPY_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/fpu32.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/fpu32.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/fpu32.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/fpu32.h	2005-06-25 19:55:22.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__FPU32_H__
++#define __STUB__FPU32_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/fpu32.h>
++#endif
++
++#endif /* __STUB__FPU32_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/genapic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/genapic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/genapic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/genapic.h	2005-06-25 19:56:19.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__GENAPIC_H__
++#define __STUB__GENAPIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/genapic.h>
++#endif
++
++#endif /* __STUB__GENAPIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/hardirq.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/hardirq.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/hardirq.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/hardirq.h	2005-06-25 19:56:20.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__HARDIRQ_H__
++#define __STUB__HARDIRQ_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/hardirq.h>
++#else
++#include <asm-i386/hardirq.h>
++#endif
++
++#endif /* __STUB__HARDIRQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/hdreg.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/hdreg.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/hdreg.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/hdreg.h	2005-06-25 19:56:21.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__HDREG_H__
++#define __STUB__HDREG_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/hdreg.h>
++#else
++#include <asm-i386/hdreg.h>
++#endif
++
++#endif /* __STUB__HDREG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/hw_irq.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/hw_irq.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/hw_irq.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/hw_irq.h	2005-06-25 19:56:21.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__HW_IRQ_H__
++#define __STUB__HW_IRQ_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/hw_irq.h>
++#else
++#include <asm-i386/hw_irq.h>
++#endif
++
++#endif /* __STUB__HW_IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/i8259.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/i8259.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/i8259.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/i8259.h	2005-06-25 19:56:22.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__I8259_H__
++#define __STUB__I8259_H__
++
++#ifndef __x86_64__
++#include <asm-i386/i8259.h>
++#endif
++
++#endif /* __STUB__I8259_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ia32.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ia32.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ia32.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ia32.h	2005-06-25 19:55:23.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IA32_H__
++#define __STUB__IA32_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ia32.h>
++#endif
++
++#endif /* __STUB__IA32_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ia32_unistd.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ia32_unistd.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ia32_unistd.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ia32_unistd.h	2005-06-25 19:55:24.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IA32_UNISTD_H__
++#define __STUB__IA32_UNISTD_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ia32_unistd.h>
++#endif
++
++#endif /* __STUB__IA32_UNISTD_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/init.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/init.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/init.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/init.h	2005-06-25 19:56:23.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__INIT_H__
++#define __STUB__INIT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/init.h>
++#else
++#include <asm-i386/init.h>
++#endif
++
++#endif /* __STUB__INIT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/io.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/io.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/io.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/io.h	2005-06-25 19:56:23.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IO_H__
++#define __STUB__IO_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/io.h>
++#else
++#include <asm-i386/io.h>
++#endif
++
++#endif /* __STUB__IO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/io_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/io_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/io_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/io_apic.h	2005-06-25 19:56:24.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IO_APIC_H__
++#define __STUB__IO_APIC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/io_apic.h>
++#else
++#include <asm-i386/io_apic.h>
++#endif
++
++#endif /* __STUB__IO_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ioctl.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ioctl.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ioctl.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ioctl.h	2005-06-25 19:56:24.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IOCTL_H__
++#define __STUB__IOCTL_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ioctl.h>
++#else
++#include <asm-i386/ioctl.h>
++#endif
++
++#endif /* __STUB__IOCTL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ioctl32.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ioctl32.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ioctl32.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ioctl32.h	2005-06-25 19:55:25.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IOCTL32_H__
++#define __STUB__IOCTL32_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ioctl32.h>
++#endif
++
++#endif /* __STUB__IOCTL32_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ioctls.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ioctls.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ioctls.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ioctls.h	2005-06-25 19:56:25.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IOCTLS_H__
++#define __STUB__IOCTLS_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ioctls.h>
++#else
++#include <asm-i386/ioctls.h>
++#endif
++
++#endif /* __STUB__IOCTLS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ipc.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ipc.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ipc.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ipc.h	2005-06-25 19:56:25.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IPC_H__
++#define __STUB__IPC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ipc.h>
++#else
++#include <asm-i386/ipc.h>
++#endif
++
++#endif /* __STUB__IPC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ipcbuf.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ipcbuf.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ipcbuf.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ipcbuf.h	2005-06-25 19:56:26.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IPCBUF_H__
++#define __STUB__IPCBUF_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ipcbuf.h>
++#else
++#include <asm-i386/ipcbuf.h>
++#endif
++
++#endif /* __STUB__IPCBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/irq.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/irq.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/irq.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/irq.h	2005-06-25 19:56:26.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__IRQ_H__
++#define __STUB__IRQ_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/irq.h>
++#else
++#include <asm-i386/irq.h>
++#endif
++
++#endif /* __STUB__IRQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/kdebug.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/kdebug.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/kdebug.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/kdebug.h	2005-06-25 19:56:26.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__KDEBUG_H__
++#define __STUB__KDEBUG_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/kdebug.h>
++#else
++#include <asm-i386/kdebug.h>
++#endif
++
++#endif /* __STUB__KDEBUG_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/kprobes.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/kprobes.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/kprobes.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/kprobes.h	2005-06-25 19:56:27.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__KPROBES_H__
++#define __STUB__KPROBES_H__
++
++#ifndef __x86_64__
++#include <asm-i386/kprobes.h>
++#endif
++
++#endif /* __STUB__KPROBES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ldt.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ldt.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ldt.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ldt.h	2005-06-25 19:56:27.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__LDT_H__
++#define __STUB__LDT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ldt.h>
++#else
++#include <asm-i386/ldt.h>
++#endif
++
++#endif /* __STUB__LDT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/linkage.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/linkage.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/linkage.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/linkage.h	2005-06-25 19:56:27.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__LINKAGE_H__
++#define __STUB__LINKAGE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/linkage.h>
++#else
++#include <asm-i386/linkage.h>
++#endif
++
++#endif /* __STUB__LINKAGE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_apic.h	2005-06-25 19:55:40.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-bigsmp/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_apicdef.h	2005-06-25 19:55:40.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-bigsmp/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_ipi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_ipi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_ipi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_ipi.h	2005-06-25 19:55:41.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_IPI_H__
++#define __STUB__MACH_IPI_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-bigsmp/mach_ipi.h>
++#endif
++
++#endif /* __STUB__MACH_IPI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-bigsmp/mach_mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-bigsmp/mach_mpspec.h	2005-06-25 19:55:41.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPSPEC_H__
++#define __STUB__MACH_MPSPEC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-bigsmp/mach_mpspec.h>
++#endif
++
++#endif /* __STUB__MACH_MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/apm.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/apm.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/apm.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/apm.h	2005-06-25 19:55:41.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__APM_H__
++#define __STUB__APM_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/apm.h>
++#endif
++
++#endif /* __STUB__APM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/bios_ebda.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/bios_ebda.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/bios_ebda.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/bios_ebda.h	2005-06-25 19:55:42.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__BIOS_EBDA_H__
++#define __STUB__BIOS_EBDA_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/bios_ebda.h>
++#endif
++
++#endif /* __STUB__BIOS_EBDA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/do_timer.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/do_timer.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/do_timer.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/do_timer.h	2005-06-25 19:55:42.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__DO_TIMER_H__
++#define __STUB__DO_TIMER_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/do_timer.h>
++#endif
++
++#endif /* __STUB__DO_TIMER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/entry_arch.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/entry_arch.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/entry_arch.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/entry_arch.h	2005-06-25 19:55:42.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ENTRY_ARCH_H__
++#define __STUB__ENTRY_ARCH_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/entry_arch.h>
++#endif
++
++#endif /* __STUB__ENTRY_ARCH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/io_ports.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/io_ports.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/io_ports.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/io_ports.h	2005-06-25 19:55:43.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IO_PORTS_H__
++#define __STUB__IO_PORTS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/io_ports.h>
++#endif
++
++#endif /* __STUB__IO_PORTS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/irq_vectors.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/irq_vectors.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/irq_vectors.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/irq_vectors.h	2005-06-25 19:55:43.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IRQ_VECTORS_H__
++#define __STUB__IRQ_VECTORS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/irq_vectors.h>
++#endif
++
++#endif /* __STUB__IRQ_VECTORS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_apic.h	2005-06-25 19:55:44.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_apicdef.h	2005-06-25 19:55:44.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_ipi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_ipi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_ipi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_ipi.h	2005-06-25 19:55:44.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_IPI_H__
++#define __STUB__MACH_IPI_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_ipi.h>
++#endif
++
++#endif /* __STUB__MACH_IPI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_mpparse.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_mpparse.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_mpparse.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_mpparse.h	2005-06-25 19:55:45.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPPARSE_H__
++#define __STUB__MACH_MPPARSE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_mpparse.h>
++#endif
++
++#endif /* __STUB__MACH_MPPARSE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_mpspec.h	2005-06-25 19:55:45.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPSPEC_H__
++#define __STUB__MACH_MPSPEC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_mpspec.h>
++#endif
++
++#endif /* __STUB__MACH_MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_reboot.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_reboot.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_reboot.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_reboot.h	2005-06-25 19:55:45.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_REBOOT_H__
++#define __STUB__MACH_REBOOT_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_reboot.h>
++#endif
++
++#endif /* __STUB__MACH_REBOOT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_time.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_time.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_time.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_time.h	2005-06-25 19:55:46.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_TIME_H__
++#define __STUB__MACH_TIME_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_time.h>
++#endif
++
++#endif /* __STUB__MACH_TIME_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_timer.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_timer.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_timer.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_timer.h	2005-06-25 19:55:46.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_TIMER_H__
++#define __STUB__MACH_TIMER_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_timer.h>
++#endif
++
++#endif /* __STUB__MACH_TIMER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_traps.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_traps.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_traps.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_traps.h	2005-06-25 19:55:47.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_TRAPS_H__
++#define __STUB__MACH_TRAPS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_traps.h>
++#endif
++
++#endif /* __STUB__MACH_TRAPS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_wakecpu.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_wakecpu.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/mach_wakecpu.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/mach_wakecpu.h	2005-06-25 19:55:47.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_WAKECPU_H__
++#define __STUB__MACH_WAKECPU_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/mach_wakecpu.h>
++#endif
++
++#endif /* __STUB__MACH_WAKECPU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/pci-functions.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/pci-functions.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/pci-functions.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/pci-functions.h	2005-06-25 19:55:47.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PCI-FUNCTIONS_H__
++#define __STUB__PCI-FUNCTIONS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/pci-functions.h>
++#endif
++
++#endif /* __STUB__PCI-FUNCTIONS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/setup_arch_post.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/setup_arch_post.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/setup_arch_post.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/setup_arch_post.h	2005-06-25 19:55:48.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SETUP_ARCH_POST_H__
++#define __STUB__SETUP_ARCH_POST_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/setup_arch_post.h>
++#endif
++
++#endif /* __STUB__SETUP_ARCH_POST_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/setup_arch_pre.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/setup_arch_pre.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/setup_arch_pre.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/setup_arch_pre.h	2005-06-25 19:55:48.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SETUP_ARCH_PRE_H__
++#define __STUB__SETUP_ARCH_PRE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/setup_arch_pre.h>
++#endif
++
++#endif /* __STUB__SETUP_ARCH_PRE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/smpboot_hooks.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/smpboot_hooks.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-default/smpboot_hooks.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-default/smpboot_hooks.h	2005-06-25 19:55:48.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SMPBOOT_HOOKS_H__
++#define __STUB__SMPBOOT_HOOKS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-default/smpboot_hooks.h>
++#endif
++
++#endif /* __STUB__SMPBOOT_HOOKS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_apic.h	2005-06-25 19:55:49.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-es7000/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_apicdef.h	2005-06-25 19:55:49.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-es7000/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_ipi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_ipi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_ipi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_ipi.h	2005-06-25 19:55:49.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_IPI_H__
++#define __STUB__MACH_IPI_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-es7000/mach_ipi.h>
++#endif
++
++#endif /* __STUB__MACH_IPI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_mpparse.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_mpparse.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_mpparse.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_mpparse.h	2005-06-25 19:55:50.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPPARSE_H__
++#define __STUB__MACH_MPPARSE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-es7000/mach_mpparse.h>
++#endif
++
++#endif /* __STUB__MACH_MPPARSE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_mpspec.h	2005-06-25 19:55:50.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPSPEC_H__
++#define __STUB__MACH_MPSPEC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-es7000/mach_mpspec.h>
++#endif
++
++#endif /* __STUB__MACH_MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_wakecpu.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_wakecpu.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-es7000/mach_wakecpu.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-es7000/mach_wakecpu.h	2005-06-25 19:55:51.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_WAKECPU_H__
++#define __STUB__MACH_WAKECPU_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-es7000/mach_wakecpu.h>
++#endif
++
++#endif /* __STUB__MACH_WAKECPU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_apic.h	2005-06-25 19:55:51.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-generic/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_apicdef.h	2005-06-25 19:55:51.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-generic/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_ipi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_ipi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_ipi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_ipi.h	2005-06-25 19:55:52.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_IPI_H__
++#define __STUB__MACH_IPI_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-generic/mach_ipi.h>
++#endif
++
++#endif /* __STUB__MACH_IPI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_mpparse.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_mpparse.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_mpparse.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_mpparse.h	2005-06-25 19:55:52.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPPARSE_H__
++#define __STUB__MACH_MPPARSE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-generic/mach_mpparse.h>
++#endif
++
++#endif /* __STUB__MACH_MPPARSE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-generic/mach_mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-generic/mach_mpspec.h	2005-06-25 19:55:52.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPSPEC_H__
++#define __STUB__MACH_MPSPEC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-generic/mach_mpspec.h>
++#endif
++
++#endif /* __STUB__MACH_MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_apic.h	2005-06-25 19:55:53.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-numaq/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_apicdef.h	2005-06-25 19:55:53.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-numaq/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_ipi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_ipi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_ipi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_ipi.h	2005-06-25 19:55:54.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_IPI_H__
++#define __STUB__MACH_IPI_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-numaq/mach_ipi.h>
++#endif
++
++#endif /* __STUB__MACH_IPI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_mpparse.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_mpparse.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_mpparse.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_mpparse.h	2005-06-25 19:55:54.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPPARSE_H__
++#define __STUB__MACH_MPPARSE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-numaq/mach_mpparse.h>
++#endif
++
++#endif /* __STUB__MACH_MPPARSE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_mpspec.h	2005-06-25 19:55:54.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPSPEC_H__
++#define __STUB__MACH_MPSPEC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-numaq/mach_mpspec.h>
++#endif
++
++#endif /* __STUB__MACH_MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_wakecpu.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_wakecpu.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-numaq/mach_wakecpu.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-numaq/mach_wakecpu.h	2005-06-25 19:55:55.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_WAKECPU_H__
++#define __STUB__MACH_WAKECPU_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-numaq/mach_wakecpu.h>
++#endif
++
++#endif /* __STUB__MACH_WAKECPU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_apic.h	2005-06-25 19:55:55.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-summit/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_apicdef.h	2005-06-25 19:55:55.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-summit/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_ipi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_ipi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_ipi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_ipi.h	2005-06-25 19:55:56.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_IPI_H__
++#define __STUB__MACH_IPI_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-summit/mach_ipi.h>
++#endif
++
++#endif /* __STUB__MACH_IPI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_mpparse.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_mpparse.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_mpparse.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_mpparse.h	2005-06-25 19:55:56.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPPARSE_H__
++#define __STUB__MACH_MPPARSE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-summit/mach_mpparse.h>
++#endif
++
++#endif /* __STUB__MACH_MPPARSE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-summit/mach_mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-summit/mach_mpspec.h	2005-06-25 19:55:56.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_MPSPEC_H__
++#define __STUB__MACH_MPSPEC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-summit/mach_mpspec.h>
++#endif
++
++#endif /* __STUB__MACH_MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/cobalt.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/cobalt.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/cobalt.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/cobalt.h	2005-06-25 19:55:57.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__COBALT_H__
++#define __STUB__COBALT_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/cobalt.h>
++#endif
++
++#endif /* __STUB__COBALT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/do_timer.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/do_timer.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/do_timer.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/do_timer.h	2005-06-25 19:55:57.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__DO_TIMER_H__
++#define __STUB__DO_TIMER_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/do_timer.h>
++#endif
++
++#endif /* __STUB__DO_TIMER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/entry_arch.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/entry_arch.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/entry_arch.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/entry_arch.h	2005-06-25 19:55:58.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ENTRY_ARCH_H__
++#define __STUB__ENTRY_ARCH_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/entry_arch.h>
++#endif
++
++#endif /* __STUB__ENTRY_ARCH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/irq_vectors.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/irq_vectors.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/irq_vectors.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/irq_vectors.h	2005-06-25 19:55:58.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IRQ_VECTORS_H__
++#define __STUB__IRQ_VECTORS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/irq_vectors.h>
++#endif
++
++#endif /* __STUB__IRQ_VECTORS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/lithium.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/lithium.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/lithium.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/lithium.h	2005-06-25 19:55:58.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__LITHIUM_H__
++#define __STUB__LITHIUM_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/lithium.h>
++#endif
++
++#endif /* __STUB__LITHIUM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/mach_apic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/mach_apic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/mach_apic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/mach_apic.h	2005-06-25 19:55:59.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APIC_H__
++#define __STUB__MACH_APIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/mach_apic.h>
++#endif
++
++#endif /* __STUB__MACH_APIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/mach_apicdef.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/mach_apicdef.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/mach_apicdef.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/mach_apicdef.h	2005-06-25 19:55:59.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MACH_APICDEF_H__
++#define __STUB__MACH_APICDEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/mach_apicdef.h>
++#endif
++
++#endif /* __STUB__MACH_APICDEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/piix4.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/piix4.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/piix4.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/piix4.h	2005-06-25 19:55:59.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PIIX4_H__
++#define __STUB__PIIX4_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/piix4.h>
++#endif
++
++#endif /* __STUB__PIIX4_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/setup_arch_post.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/setup_arch_post.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/setup_arch_post.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/setup_arch_post.h	2005-06-25 19:56:00.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SETUP_ARCH_POST_H__
++#define __STUB__SETUP_ARCH_POST_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/setup_arch_post.h>
++#endif
++
++#endif /* __STUB__SETUP_ARCH_POST_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/setup_arch_pre.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/setup_arch_pre.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/setup_arch_pre.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/setup_arch_pre.h	2005-06-25 19:56:00.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SETUP_ARCH_PRE_H__
++#define __STUB__SETUP_ARCH_PRE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/setup_arch_pre.h>
++#endif
++
++#endif /* __STUB__SETUP_ARCH_PRE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/smpboot_hooks.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/smpboot_hooks.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-visws/smpboot_hooks.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-visws/smpboot_hooks.h	2005-06-25 19:56:00.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SMPBOOT_HOOKS_H__
++#define __STUB__SMPBOOT_HOOKS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-visws/smpboot_hooks.h>
++#endif
++
++#endif /* __STUB__SMPBOOT_HOOKS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/do_timer.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/do_timer.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/do_timer.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/do_timer.h	2005-06-25 19:56:01.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__DO_TIMER_H__
++#define __STUB__DO_TIMER_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-voyager/do_timer.h>
++#endif
++
++#endif /* __STUB__DO_TIMER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/entry_arch.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/entry_arch.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/entry_arch.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/entry_arch.h	2005-06-25 19:56:01.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__ENTRY_ARCH_H__
++#define __STUB__ENTRY_ARCH_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-voyager/entry_arch.h>
++#endif
++
++#endif /* __STUB__ENTRY_ARCH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/irq_vectors.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/irq_vectors.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/irq_vectors.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/irq_vectors.h	2005-06-25 19:56:02.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__IRQ_VECTORS_H__
++#define __STUB__IRQ_VECTORS_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-voyager/irq_vectors.h>
++#endif
++
++#endif /* __STUB__IRQ_VECTORS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/setup_arch_post.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/setup_arch_post.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/setup_arch_post.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/setup_arch_post.h	2005-06-25 19:56:02.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SETUP_ARCH_POST_H__
++#define __STUB__SETUP_ARCH_POST_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-voyager/setup_arch_post.h>
++#endif
++
++#endif /* __STUB__SETUP_ARCH_POST_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/setup_arch_pre.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/setup_arch_pre.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mach-voyager/setup_arch_pre.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mach-voyager/setup_arch_pre.h	2005-06-25 19:56:02.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SETUP_ARCH_PRE_H__
++#define __STUB__SETUP_ARCH_PRE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mach-voyager/setup_arch_pre.h>
++#endif
++
++#endif /* __STUB__SETUP_ARCH_PRE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/math_emu.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/math_emu.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/math_emu.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/math_emu.h	2005-06-25 19:56:28.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MATH_EMU_H__
++#define __STUB__MATH_EMU_H__
++
++#ifndef __x86_64__
++#include <asm-i386/math_emu.h>
++#endif
++
++#endif /* __STUB__MATH_EMU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mca.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mca.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mca.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mca.h	2005-06-25 19:56:28.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MCA_H__
++#define __STUB__MCA_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mca.h>
++#endif
++
++#endif /* __STUB__MCA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mca_dma.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mca_dma.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mca_dma.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mca_dma.h	2005-06-25 19:56:28.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MCA_DMA_H__
++#define __STUB__MCA_DMA_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mca_dma.h>
++#endif
++
++#endif /* __STUB__MCA_DMA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mman.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mman.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mman.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mman.h	2005-06-25 19:56:29.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMAN_H__
++#define __STUB__MMAN_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mman.h>
++#else
++#include <asm-i386/mman.h>
++#endif
++
++#endif /* __STUB__MMAN_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmsegment.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmsegment.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmsegment.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmsegment.h	2005-06-25 19:55:29.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MMSEGMENT_H__
++#define __STUB__MMSEGMENT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mmsegment.h>
++#endif
++
++#endif /* __STUB__MMSEGMENT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmu.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmu.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmu.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmu.h	2005-06-25 19:56:29.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMU_H__
++#define __STUB__MMU_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mmu.h>
++#else
++#include <asm-i386/mmu.h>
++#endif
++
++#endif /* __STUB__MMU_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmu_context.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmu_context.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmu_context.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmu_context.h	2005-06-25 19:56:30.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMU_CONTEXT_H__
++#define __STUB__MMU_CONTEXT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mmu_context.h>
++#else
++#include <asm-i386/mmu_context.h>
++#endif
++
++#endif /* __STUB__MMU_CONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmx.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmx.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mmx.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mmx.h	2005-06-25 19:56:30.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MMX_H__
++#define __STUB__MMX_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mmx.h>
++#else
++#include <asm-i386/mmx.h>
++#endif
++
++#endif /* __STUB__MMX_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/module.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/module.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/module.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/module.h	2005-06-25 19:56:30.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MODULE_H__
++#define __STUB__MODULE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/module.h>
++#else
++#include <asm-i386/module.h>
++#endif
++
++#endif /* __STUB__MODULE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mpspec.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mpspec.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mpspec.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mpspec.h	2005-06-25 19:56:31.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MPSPEC_H__
++#define __STUB__MPSPEC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mpspec.h>
++#else
++#include <asm-i386/mpspec.h>
++#endif
++
++#endif /* __STUB__MPSPEC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mpspec_def.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mpspec_def.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mpspec_def.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mpspec_def.h	2005-06-25 19:56:31.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__MPSPEC_DEF_H__
++#define __STUB__MPSPEC_DEF_H__
++
++#ifndef __x86_64__
++#include <asm-i386/mpspec_def.h>
++#endif
++
++#endif /* __STUB__MPSPEC_DEF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/msgbuf.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/msgbuf.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/msgbuf.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/msgbuf.h	2005-06-25 19:56:31.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MSGBUF_H__
++#define __STUB__MSGBUF_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/msgbuf.h>
++#else
++#include <asm-i386/msgbuf.h>
++#endif
++
++#endif /* __STUB__MSGBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/msr.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/msr.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/msr.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/msr.h	2005-06-25 19:56:32.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MSR_H__
++#define __STUB__MSR_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/msr.h>
++#else
++#include <asm-i386/msr.h>
++#endif
++
++#endif /* __STUB__MSR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mtrr.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mtrr.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/mtrr.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/mtrr.h	2005-06-25 19:56:32.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__MTRR_H__
++#define __STUB__MTRR_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/mtrr.h>
++#else
++#include <asm-i386/mtrr.h>
++#endif
++
++#endif /* __STUB__MTRR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/namei.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/namei.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/namei.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/namei.h	2005-06-25 19:56:33.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__NAMEI_H__
++#define __STUB__NAMEI_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/namei.h>
++#else
++#include <asm-i386/namei.h>
++#endif
++
++#endif /* __STUB__NAMEI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/nmi.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/nmi.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/nmi.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/nmi.h	2005-06-25 19:56:33.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__NMI_H__
++#define __STUB__NMI_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/nmi.h>
++#else
++#include <asm-i386/nmi.h>
++#endif
++
++#endif /* __STUB__NMI_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/node.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/node.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/node.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/node.h	2005-06-25 19:56:33.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__NODE_H__
++#define __STUB__NODE_H__
++
++#ifndef __x86_64__
++#include <asm-i386/node.h>
++#endif
++
++#endif /* __STUB__NODE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/numa.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/numa.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/numa.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/numa.h	2005-06-25 19:55:33.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__NUMA_H__
++#define __STUB__NUMA_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/numa.h>
++#endif
++
++#endif /* __STUB__NUMA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/numaq.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/numaq.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/numaq.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/numaq.h	2005-06-25 19:56:34.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__NUMAQ_H__
++#define __STUB__NUMAQ_H__
++
++#ifndef __x86_64__
++#include <asm-i386/numaq.h>
++#endif
++
++#endif /* __STUB__NUMAQ_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/numnodes.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/numnodes.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/numnodes.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/numnodes.h	2005-06-25 19:56:34.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__NUMNODES_H__
++#define __STUB__NUMNODES_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/numnodes.h>
++#else
++#include <asm-i386/numnodes.h>
++#endif
++
++#endif /* __STUB__NUMNODES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/page.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/page.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/page.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/page.h	2005-06-25 19:56:34.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PAGE_H__
++#define __STUB__PAGE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/page.h>
++#else
++#include <asm-i386/page.h>
++#endif
++
++#endif /* __STUB__PAGE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/param.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/param.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/param.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/param.h	2005-06-25 19:56:03.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PARAM_H__
++#define __STUB__PARAM_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/param.h>
++#else
++#include <asm-i386/param.h>
++#endif
++
++#endif /* __STUB__PARAM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/parport.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/parport.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/parport.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/parport.h	2005-06-25 19:56:03.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PARPORT_H__
++#define __STUB__PARPORT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/parport.h>
++#else
++#include <asm-i386/parport.h>
++#endif
++
++#endif /* __STUB__PARPORT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pci-direct.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pci-direct.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pci-direct.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pci-direct.h	2005-06-25 19:55:35.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PCI-DIRECT_H__
++#define __STUB__PCI-DIRECT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/pci-direct.h>
++#endif
++
++#endif /* __STUB__PCI-DIRECT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pda.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pda.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pda.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pda.h	2005-06-25 19:55:35.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PDA_H__
++#define __STUB__PDA_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/pda.h>
++#endif
++
++#endif /* __STUB__PDA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pgalloc.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pgalloc.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pgalloc.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pgalloc.h	2005-06-25 19:56:05.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PGALLOC_H__
++#define __STUB__PGALLOC_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/pgalloc.h>
++#else
++#include <asm-i386/pgalloc.h>
++#endif
++
++#endif /* __STUB__PGALLOC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pgtable-2level.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pgtable-2level.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pgtable-2level.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pgtable-2level.h	2005-06-25 19:56:35.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PGTABLE-2LEVEL_H__
++#define __STUB__PGTABLE-2LEVEL_H__
++
++#ifndef __x86_64__
++#include <asm-i386/pgtable-2level.h>
++#endif
++
++#endif /* __STUB__PGTABLE-2LEVEL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pgtable-3level.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pgtable-3level.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/pgtable-3level.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/pgtable-3level.h	2005-06-25 19:56:36.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PGTABLE-3LEVEL_H__
++#define __STUB__PGTABLE-3LEVEL_H__
++
++#ifndef __x86_64__
++#include <asm-i386/pgtable-3level.h>
++#endif
++
++#endif /* __STUB__PGTABLE-3LEVEL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/poll.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/poll.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/poll.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/poll.h	2005-06-25 19:56:36.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__POLL_H__
++#define __STUB__POLL_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/poll.h>
++#else
++#include <asm-i386/poll.h>
++#endif
++
++#endif /* __STUB__POLL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/posix_types.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/posix_types.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/posix_types.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/posix_types.h	2005-06-25 19:56:37.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__POSIX_TYPES_H__
++#define __STUB__POSIX_TYPES_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/posix_types.h>
++#else
++#include <asm-i386/posix_types.h>
++#endif
++
++#endif /* __STUB__POSIX_TYPES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/prctl.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/prctl.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/prctl.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/prctl.h	2005-06-25 19:55:03.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PRCTL_H__
++#define __STUB__PRCTL_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/prctl.h>
++#endif
++
++#endif /* __STUB__PRCTL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/processor.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/processor.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/processor.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/processor.h	2005-06-25 19:56:37.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PROCESSOR_H__
++#define __STUB__PROCESSOR_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/processor.h>
++#else
++#include <asm-i386/processor.h>
++#endif
++
++#endif /* __STUB__PROCESSOR_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/proto.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/proto.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/proto.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/proto.h	2005-06-25 19:55:06.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__PROTO_H__
++#define __STUB__PROTO_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/proto.h>
++#endif
++
++#endif /* __STUB__PROTO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ptrace.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ptrace.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ptrace.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ptrace.h	2005-06-25 19:56:37.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__PTRACE_H__
++#define __STUB__PTRACE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ptrace.h>
++#else
++#include <asm-i386/ptrace.h>
++#endif
++
++#endif /* __STUB__PTRACE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/rwlock.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/rwlock.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/rwlock.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/rwlock.h	2005-06-25 19:56:38.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__RWLOCK_H__
++#define __STUB__RWLOCK_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/rwlock.h>
++#else
++#include <asm-i386/rwlock.h>
++#endif
++
++#endif /* __STUB__RWLOCK_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/segment.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/segment.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/segment.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/segment.h	2005-06-25 19:56:38.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SEGMENT_H__
++#define __STUB__SEGMENT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/segment.h>
++#else
++#include <asm-i386/segment.h>
++#endif
++
++#endif /* __STUB__SEGMENT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/semaphore.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/semaphore.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/semaphore.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/semaphore.h	2005-06-25 19:56:38.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SEMAPHORE_H__
++#define __STUB__SEMAPHORE_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/semaphore.h>
++#else
++#include <asm-i386/semaphore.h>
++#endif
++
++#endif /* __STUB__SEMAPHORE_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sembuf.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sembuf.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sembuf.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sembuf.h	2005-06-25 19:56:39.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SEMBUF_H__
++#define __STUB__SEMBUF_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/sembuf.h>
++#else
++#include <asm-i386/sembuf.h>
++#endif
++
++#endif /* __STUB__SEMBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/serial.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/serial.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/serial.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/serial.h	2005-06-25 19:56:35.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SERIAL_H__
++#define __STUB__SERIAL_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/serial.h>
++#else
++#include <asm-i386/serial.h>
++#endif
++
++#endif /* __STUB__SERIAL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/shmbuf.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/shmbuf.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/shmbuf.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/shmbuf.h	2005-06-25 19:56:35.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SHMBUF_H__
++#define __STUB__SHMBUF_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/shmbuf.h>
++#else
++#include <asm-i386/shmbuf.h>
++#endif
++
++#endif /* __STUB__SHMBUF_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/shmparam.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/shmparam.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/shmparam.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/shmparam.h	2005-06-25 19:56:05.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SHMPARAM_H__
++#define __STUB__SHMPARAM_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/shmparam.h>
++#else
++#include <asm-i386/shmparam.h>
++#endif
++
++#endif /* __STUB__SHMPARAM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sigcontext.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sigcontext.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sigcontext.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sigcontext.h	2005-06-25 19:56:06.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SIGCONTEXT_H__
++#define __STUB__SIGCONTEXT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/sigcontext.h>
++#else
++#include <asm-i386/sigcontext.h>
++#endif
++
++#endif /* __STUB__SIGCONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sigcontext32.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sigcontext32.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sigcontext32.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sigcontext32.h	2005-06-25 19:55:39.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SIGCONTEXT32_H__
++#define __STUB__SIGCONTEXT32_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/sigcontext32.h>
++#endif
++
++#endif /* __STUB__SIGCONTEXT32_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/siginfo.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/siginfo.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/siginfo.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/siginfo.h	2005-06-25 19:56:07.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SIGINFO_H__
++#define __STUB__SIGINFO_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/siginfo.h>
++#else
++#include <asm-i386/siginfo.h>
++#endif
++
++#endif /* __STUB__SIGINFO_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/socket.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/socket.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/socket.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/socket.h	2005-06-25 19:56:07.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SOCKET_H__
++#define __STUB__SOCKET_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/socket.h>
++#else
++#include <asm-i386/socket.h>
++#endif
++
++#endif /* __STUB__SOCKET_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sockios.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sockios.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/sockios.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/sockios.h	2005-06-25 19:56:08.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SOCKIOS_H__
++#define __STUB__SOCKIOS_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/sockios.h>
++#else
++#include <asm-i386/sockios.h>
++#endif
++
++#endif /* __STUB__SOCKIOS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/spinlock.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/spinlock.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/spinlock.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/spinlock.h	2005-06-25 19:56:09.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SPINLOCK_H__
++#define __STUB__SPINLOCK_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/spinlock.h>
++#else
++#include <asm-i386/spinlock.h>
++#endif
++
++#endif /* __STUB__SPINLOCK_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/srat.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/srat.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/srat.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/srat.h	2005-06-25 19:56:10.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__SRAT_H__
++#define __STUB__SRAT_H__
++
++#ifndef __x86_64__
++#include <asm-i386/srat.h>
++#endif
++
++#endif /* __STUB__SRAT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/stat.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/stat.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/stat.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/stat.h	2005-06-25 19:56:10.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__STAT_H__
++#define __STUB__STAT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/stat.h>
++#else
++#include <asm-i386/stat.h>
++#endif
++
++#endif /* __STUB__STAT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/suspend.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/suspend.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/suspend.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/suspend.h	2005-06-25 19:56:11.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SUSPEND_H__
++#define __STUB__SUSPEND_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/suspend.h>
++#else
++#include <asm-i386/suspend.h>
++#endif
++
++#endif /* __STUB__SUSPEND_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/system.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/system.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/system.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/system.h	2005-06-25 19:56:12.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__SYSTEM_H__
++#define __STUB__SYSTEM_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/system.h>
++#else
++#include <asm-i386/system.h>
++#endif
++
++#endif /* __STUB__SYSTEM_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/termbits.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/termbits.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/termbits.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/termbits.h	2005-06-25 19:56:13.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TERMBITS_H__
++#define __STUB__TERMBITS_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/termbits.h>
++#else
++#include <asm-i386/termbits.h>
++#endif
++
++#endif /* __STUB__TERMBITS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/termios.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/termios.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/termios.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/termios.h	2005-06-25 19:56:14.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TERMIOS_H__
++#define __STUB__TERMIOS_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/termios.h>
++#else
++#include <asm-i386/termios.h>
++#endif
++
++#endif /* __STUB__TERMIOS_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/timer.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/timer.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/timer.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/timer.h	2005-06-25 19:56:15.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__TIMER_H__
++#define __STUB__TIMER_H__
++
++#ifndef __x86_64__
++#include <asm-i386/timer.h>
++#endif
++
++#endif /* __STUB__TIMER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/timex.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/timex.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/timex.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/timex.h	2005-06-25 19:56:16.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TIMEX_H__
++#define __STUB__TIMEX_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/timex.h>
++#else
++#include <asm-i386/timex.h>
++#endif
++
++#endif /* __STUB__TIMEX_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/tlbflush.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/tlbflush.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/tlbflush.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/tlbflush.h	2005-06-25 19:56:17.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TLBFLUSH_H__
++#define __STUB__TLBFLUSH_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/tlbflush.h>
++#else
++#include <asm-i386/tlbflush.h>
++#endif
++
++#endif /* __STUB__TLBFLUSH_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/types.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/types.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/types.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/types.h	2005-06-25 19:56:17.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__TYPES_H__
++#define __STUB__TYPES_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/types.h>
++#else
++#include <asm-i386/types.h>
++#endif
++
++#endif /* __STUB__TYPES_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ucontext.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ucontext.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/ucontext.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/ucontext.h	2005-06-25 19:56:18.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__UCONTEXT_H__
++#define __STUB__UCONTEXT_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/ucontext.h>
++#else
++#include <asm-i386/ucontext.h>
++#endif
++
++#endif /* __STUB__UCONTEXT_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/unaligned.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/unaligned.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/unaligned.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/unaligned.h	2005-06-25 19:56:19.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__UNALIGNED_H__
++#define __STUB__UNALIGNED_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/unaligned.h>
++#else
++#include <asm-i386/unaligned.h>
++#endif
++
++#endif /* __STUB__UNALIGNED_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/unistd.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/unistd.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/unistd.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/unistd.h	2005-06-25 19:56:20.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__UNISTD_H__
++#define __STUB__UNISTD_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/unistd.h>
++#else
++#include <asm-i386/unistd.h>
++#endif
++
++#endif /* __STUB__UNISTD_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/user.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/user.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/user.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/user.h	2005-06-25 19:56:20.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__USER_H__
++#define __STUB__USER_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/user.h>
++#else
++#include <asm-i386/user.h>
++#endif
++
++#endif /* __STUB__USER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/user32.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/user32.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/user32.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/user32.h	2005-06-25 19:55:19.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__USER32_H__
++#define __STUB__USER32_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/user32.h>
++#endif
++
++#endif /* __STUB__USER32_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vga.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vga.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vga.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vga.h	2005-06-25 19:56:21.000000000 +0000
+@@ -0,0 +1,10 @@
++#ifndef __STUB__VGA_H__
++#define __STUB__VGA_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/vga.h>
++#else
++#include <asm-i386/vga.h>
++#endif
++
++#endif /* __STUB__VGA_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vic.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vic.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vic.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vic.h	2005-06-25 19:56:22.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__VIC_H__
++#define __STUB__VIC_H__
++
++#ifndef __x86_64__
++#include <asm-i386/vic.h>
++#endif
++
++#endif /* __STUB__VIC_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vm86.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vm86.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vm86.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vm86.h	2005-06-25 19:56:23.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__VM86_H__
++#define __STUB__VM86_H__
++
++#ifndef __x86_64__
++#include <asm-i386/vm86.h>
++#endif
++
++#endif /* __STUB__VM86_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/voyager.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/voyager.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/voyager.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/voyager.h	2005-06-25 19:56:24.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__VOYAGER_H__
++#define __STUB__VOYAGER_H__
++
++#ifndef __x86_64__
++#include <asm-i386/voyager.h>
++#endif
++
++#endif /* __STUB__VOYAGER_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vsyscall.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vsyscall.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vsyscall.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vsyscall.h	2005-06-25 19:55:20.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__VSYSCALL_H__
++#define __STUB__VSYSCALL_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/vsyscall.h>
++#endif
++
++#endif /* __STUB__VSYSCALL_H__ */
+diff -Naur linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vsyscall32.h linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vsyscall32.h
+--- linux-libc-headers-2.6.11.2.orig/include/asm-x86_64-biarch/vsyscall32.h	1970-01-01 00:00:00.000000000 +0000
++++ linux-libc-headers-2.6.11.2/include/asm-x86_64-biarch/vsyscall32.h	2005-06-25 19:55:21.000000000 +0000
+@@ -0,0 +1,8 @@
++#ifndef __STUB__VSYSCALL32_H__
++#define __STUB__VSYSCALL32_H__
++
++#ifdef __x86_64__
++#include <asm-x86_64/vsyscall32.h>
++#endif
++
++#endif /* __STUB__VSYSCALL32_H__ */
Index: patches/mktemp-1.5-add_tempfile-3.patch
===================================================================
--- patches/mktemp-1.5-add_tempfile-3.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/mktemp-1.5-add_tempfile-3.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,111 @@
+Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
+Date: 2005-07-25
+Initial Package Version: 1.5
+Upstream Status: Sent, no response yet.
+Origin: http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-April/033602.html
+        http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2003-June/035234.html
+		http://linuxfromscratch.org/pipermail/lfs-dev/2005-June/051908.html
+Description: Add tempfile wrapper script. Use "make install-tempfile" to install it.
+
+diff -Naur mktemp-1.5.orig/Makefile.in mktemp-1.5/Makefile.in
+--- mktemp-1.5.orig/Makefile.in	2003-03-23 18:09:56.000000000 -0700
++++ mktemp-1.5/Makefile.in	2005-07-25 11:11:11.000000000 -0600
+@@ -113,6 +113,9 @@
+ install-man:
+ 	$(INSTALL) -m 0444 $(srcdir)/$(PROG).$(mantype) $(mandir)/man1/$(PROG).1
+ 
++install-tempfile: $(srcdir)/tempfile
++	$(INSTALL) -m 0555 $(srcdir)/tempfile $(bindir)/tempfile
++
+ check:
+ 	@echo nothing to check
+ 
+diff -Naur mktemp-1.5.orig/tempfile mktemp-1.5/tempfile
+--- mktemp-1.5.orig/tempfile	1969-12-31 17:00:00.000000000 -0700
++++ mktemp-1.5/tempfile	2005-07-25 11:13:41.000000000 -0600
+@@ -0,0 +1,85 @@
++#!/bin/bash
++# A tempfile wrapper for mktemp
++# Note: If you can, avoid using tempfile and use mktemp instead.
++#       This wrapper is provided for compatibility since some scripts use
++#       tempfile. If possible, the best solution is to patch the scripts
++#       to use mktemp.
++#
++# Copyright (c) Tushar Teredesai <tush@yahoo.com>
++#
++# Permission to use, copy, modify, and distribute this software for any
++# purpose with or without fee is hereby granted, provided that the above
++# copyright notice and this permission notice appear in all copies.
++#
++# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++#
++
++# Usage info
++usage()
++{
++	echo "Usage: tempfile [OPTION]"
++	echo
++	echo "Create a temporary file in a safe manner."
++	echo "This version is a wrapper that invokes mktemp."
++	echo "NOTE: Do not use tempfile in your scripts."
++	echo "      Use mktemp instead."
++	echo
++	echo "[-d|--directory] DIR -> place temporary file in DIR"
++	echo "[-p|--prefix] PREFIX -> ignored"
++	echo "[-s|--suffix] SUFFIX -> ignored"
++	echo "[-n|--name] NAME -> ignored"
++	echo "[-m|--mode] MODE -> ignored"
++	echo "--version -> output version information and exit"
++}
++
++# parse all arguments
++while [ $# != 0 ]
++do
++	case "$1" in
++	# -d for tempfile is equivalent to -p for mktemp
++	-d|--directory)
++		dir="$2"
++		shift 2
++	;;
++	--directory=*)
++		dir="${1#--directory=}"
++		shift 1
++	;;
++	-d*)
++		dir="${1#-d}"
++		shift 1
++	;;
++	# The following switches are ignored.
++	-p|--prefix|-s|--suffix|-n|--name|-m|--mode)
++		shift 2
++	;;
++	-p*|--prefix=*|-s*|--suffix=*|-n*|--name=*|-m*|--mode=*)
++		shift 1
++	;;
++	# --version for tempfile is equivalent to -V for mktemp
++	--version)
++		echo "tempfile 1.0 (`mktemp -V 2>/dev/null`)"
++		exit 0
++	;;
++	# Unknown switch
++	*)
++		usage
++		exit 1
++	;;
++	esac
++done
++
++# Use the dir if $TMPDIR is not set.
++if [ -z "$TMPDIR" -a ! -z "$dir" ]
++then
++	export TMPDIR="$dir"
++fi
++# Execute mktemp with proper arguments
++# the -t behaviour of mktemp is the default for tempfile
++exec mktemp -t
Index: patches/mktemp-1.5-mips_config_update-1.patch
===================================================================
--- patches/mktemp-1.5-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/mktemp-1.5-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1999 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-10-01
+Initial Package Version: 1.5
+Origin: Jim Gifford
+Upstream Status: Sent
+Description: Updates config.sub and config.guess
+ 
+diff -Naur mktemp-1.5.orig/config.guess mktemp-1.5/config.guess
+--- mktemp-1.5.orig/config.guess	2001-07-17 02:57:40.000000000 +0000
++++ mktemp-1.5/config.guess	2005-10-01 23:24:40.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-#   Free Software Foundation, Inc.
++#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2001-04-20'
++timestamp='2004-11-12'
+ 
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+@@ -24,8 +24,9 @@
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+ 
+-# Written by Per Bothner <bothner@cygnus.com>.
+-# Please send patches to <config-patches@gnu.org>.
++# Originally written by Per Bothner <per@bothner.com>.
++# Please send patches to <config-patches@gnu.org>.  Submit a context
++# diff and a properly formatted ChangeLog entry.
+ #
+ # This script attempts to guess a canonical system name similar to
+ # config.sub.  If it succeeds, it prints the system name on stdout, and
+@@ -52,7 +53,7 @@
+ GNU config.guess ($timestamp)
+ 
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -87,33 +88,45 @@
+   exit 1
+ fi
+ 
++trap 'exit 1' 1 2 15
+ 
+-dummy=dummy-$$
+-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
++# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
++# compiler to aid in system detection is discouraged as it requires
++# temporary files to be created and, as you can see below, it is a
++# headache to deal with in a portable fashion.
+ 
+-# CC_FOR_BUILD -- compiler used by this script.
+ # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+ # use `HOST_CC' if defined, but it is deprecated.
+ 
++# Portable tmp directory creation inspired by the Autoconf team.
++
++set_cc_for_build='
++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
++: ${TMPDIR=/tmp} ;
++ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
++dummy=$tmp/dummy ;
++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+ case $CC_FOR_BUILD,$HOST_CC,$CC in
+- ,,)    echo "int dummy(){}" > $dummy.c
+-	for c in cc gcc c89 ; do
+-	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
+-	  if test $? = 0 ; then
+-	     CC_FOR_BUILD="$c"; break
+-	  fi
+-	done
+-	rm -f $dummy.c $dummy.o $dummy.rel
++ ,,)    echo "int x;" > $dummy.c ;
++	for c in cc gcc c89 c99 ; do
++	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
++	     CC_FOR_BUILD="$c"; break ;
++	  fi ;
++	done ;
+ 	if test x"$CC_FOR_BUILD" = x ; then
+-	  CC_FOR_BUILD=no_compiler_found
++	  CC_FOR_BUILD=no_compiler_found ;
+ 	fi
+ 	;;
+  ,,*)   CC_FOR_BUILD=$CC ;;
+  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+-esac
++esac ;'
+ 
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+-# (ghazi@noc.rutgers.edu 8/24/94.)
++# (ghazi@noc.rutgers.edu 1994-08-24)
+ if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ 	PATH=$PATH:/.attbin ; export PATH
+ fi
+@@ -127,29 +140,31 @@
+ 
+ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+     *:NetBSD:*:*)
+-	# Netbsd (nbsd) targets should (where applicable) match one or
++	# NetBSD (nbsd) targets should (where applicable) match one or
+ 	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+ 	# switched to ELF, *-*-netbsd* would select the old
+ 	# object file format.  This provides both forward
+ 	# compatibility and a consistent mechanism for selecting the
+ 	# object file format.
+-	# Determine the machine/vendor (is the vendor relevant).
+-	case "${UNAME_MACHINE}" in
+-	    amiga) machine=m68k-unknown ;;
+-	    arm32) machine=arm-unknown ;;
+-	    atari*) machine=m68k-atari ;;
+-	    sun3*) machine=m68k-sun ;;
+-	    mac68k) machine=m68k-apple ;;
+-	    macppc) machine=powerpc-apple ;;
+-	    hp3[0-9][05]) machine=m68k-hp ;;
+-	    ibmrt|romp-ibm) machine=romp-ibm ;;
+-	    *) machine=${UNAME_MACHINE}-unknown ;;
++	#
++	# Note: NetBSD doesn't particularly care about the vendor
++	# portion of the name.  We always set it to "unknown".
++	sysctl="sysctl -n hw.machine_arch"
++	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
++	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
++	case "${UNAME_MACHINE_ARCH}" in
++	    armeb) machine=armeb-unknown ;;
++	    arm*) machine=arm-unknown ;;
++	    sh3el) machine=shl-unknown ;;
++	    sh3eb) machine=sh-unknown ;;
++	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ 	esac
+ 	# The Operating System including object format, if it has switched
+ 	# to ELF recently, or will in the future.
+-	case "${UNAME_MACHINE}" in
+-	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
++	case "${UNAME_MACHINE_ARCH}" in
++	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
++		eval $set_cc_for_build
+ 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ 			| grep __ELF__ >/dev/null
+ 		then
+@@ -165,70 +180,123 @@
+ 		;;
+ 	esac
+ 	# The OS release
+-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++	# Debian GNU/NetBSD machines have a different userland, and
++	# thus, need a distinct triplet. However, they do not need
++	# kernel version information, so it can be replaced with a
++	# suitable tag, in the style of linux-gnu.
++	case "${UNAME_VERSION}" in
++	    Debian*)
++		release='-gnu'
++		;;
++	    *)
++		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++		;;
++	esac
+ 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ 	# contains redundant information, the shorter form:
+ 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ 	echo "${machine}-${os}${release}"
+ 	exit 0 ;;
++    amd64:OpenBSD:*:*)
++	echo x86_64-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    amiga:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    cats:OpenBSD:*:*)
++	echo arm-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    hp300:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    luna88k:OpenBSD:*:*)
++    	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mac68k:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:OpenBSD:*:*)
++	echo powerpc-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mvme68k:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mvme88k:OpenBSD:*:*)
++	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    mvmeppc:OpenBSD:*:*)
++	echo powerpc-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    sgi:OpenBSD:*:*)
++	echo mips64-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    sun3:OpenBSD:*:*)
++	echo m68k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:OpenBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:ekkoBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:MirBSD:*:*)
++	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:MirBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
+     alpha:OSF1:*:*)
+-	if test $UNAME_RELEASE = "V4.0"; then
++	case $UNAME_RELEASE in
++	*4.0)
+ 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+-	fi
++		;;
++	*5.*)
++	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++		;;
++	esac
++	# According to Compaq, /usr/sbin/psrinfo has been available on
++	# OSF/1 and Tru64 systems produced since 1995.  I hope that
++	# covers most systems running today.  This code pipes the CPU
++	# types through head -n 1, so we only detect the type of CPU 0.
++	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
++	case "$ALPHA_CPU_TYPE" in
++	    "EV4 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV4.5 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "LCA4 (21066/21068)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV5 (21164)")
++		UNAME_MACHINE="alphaev5" ;;
++	    "EV5.6 (21164A)")
++		UNAME_MACHINE="alphaev56" ;;
++	    "EV5.6 (21164PC)")
++		UNAME_MACHINE="alphapca56" ;;
++	    "EV5.7 (21164PC)")
++		UNAME_MACHINE="alphapca57" ;;
++	    "EV6 (21264)")
++		UNAME_MACHINE="alphaev6" ;;
++	    "EV6.7 (21264A)")
++		UNAME_MACHINE="alphaev67" ;;
++	    "EV6.8CB (21264C)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8AL (21264B)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8CX (21264D)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.9A (21264/EV69A)")
++		UNAME_MACHINE="alphaev69" ;;
++	    "EV7 (21364)")
++		UNAME_MACHINE="alphaev7" ;;
++	    "EV7.9 (21364A)")
++		UNAME_MACHINE="alphaev79" ;;
++	esac
++	# A Pn.n version is a patched version.
+ 	# A Vn.n version is a released version.
+ 	# A Tn.n version is a released field test version.
+ 	# A Xn.n version is an unreleased experimental baselevel.
+ 	# 1.2 uses "1.2" for uname -r.
+-	cat <<EOF >$dummy.s
+-	.data
+-\$Lformat:
+-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+-
+-	.text
+-	.globl main
+-	.align 4
+-	.ent main
+-main:
+-	.frame \$30,16,\$26,0
+-	ldgp \$29,0(\$27)
+-	.prologue 1
+-	.long 0x47e03d80 # implver \$0
+-	lda \$2,-1
+-	.long 0x47e20c21 # amask \$2,\$1
+-	lda \$16,\$Lformat
+-	mov \$0,\$17
+-	not \$1,\$18
+-	jsr \$26,printf
+-	ldgp \$29,0(\$26)
+-	mov 0,\$16
+-	jsr \$26,exit
+-	.end main
+-EOF
+-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		case `./$dummy` in
+-			0-0)
+-				UNAME_MACHINE="alpha"
+-				;;
+-			1-0)
+-				UNAME_MACHINE="alphaev5"
+-				;;
+-			1-1)
+-				UNAME_MACHINE="alphaev56"
+-				;;
+-			1-101)
+-				UNAME_MACHINE="alphapca56"
+-				;;
+-			2-303)
+-				UNAME_MACHINE="alphaev6"
+-				;;
+-			2-307)
+-				UNAME_MACHINE="alphaev67"
+-				;;
+-		esac
+-	fi
+-	rm -f $dummy.s $dummy
+-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ 	exit 0 ;;
+     Alpha\ *:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+@@ -242,33 +310,21 @@
+     Amiga*:UNIX_System_V:4.0:*)
+ 	echo m68k-unknown-sysv4
+ 	exit 0;;
+-    amiga:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     *:[Aa]miga[Oo][Ss]:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-amigaos
+ 	exit 0 ;;
+-    arc64:OpenBSD:*:*)
+-	echo mips64el-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    arc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    hkmips:OpenBSD:*:*)
+-	echo mips-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    pmax:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    sgi:OpenBSD:*:*)
+-	echo mips-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    wgrisc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++    *:[Mm]orph[Oo][Ss]:*:*)
++	echo ${UNAME_MACHINE}-unknown-morphos
+ 	exit 0 ;;
+     *:OS/390:*:*)
+ 	echo i370-ibm-openedition
+ 	exit 0 ;;
++    *:z/VM:*:*)
++	echo s390-ibm-zvmoe
++	exit 0 ;;
++    *:OS400:*:*)
++        echo powerpc-ibm-os400
++	exit 0 ;;
+     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ 	echo arm-acorn-riscix${UNAME_RELEASE}
+ 	exit 0;;
+@@ -286,6 +342,13 @@
+     NILE*:*:*:dcosx)
+ 	echo pyramid-pyramid-svr4
+ 	exit 0 ;;
++    DRS?6000:unix:4.0:6*)
++	echo sparc-icl-nx6
++	exit 0 ;;
++    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
++	case `/usr/bin/uname -p` in
++	    sparc) echo sparc-icl-nx7 && exit 0 ;;
++	esac ;;
+     sun4H:SunOS:5.*:*)
+ 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+@@ -314,7 +377,7 @@
+ 	echo m68k-sun-sunos${UNAME_RELEASE}
+ 	exit 0 ;;
+     sun*:*:4.2BSD:*)
+-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
++	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ 	case "`/bin/arch`" in
+ 	    sun3)
+@@ -328,9 +391,6 @@
+     aushp:SunOS:*:*)
+ 	echo sparc-auspex-sunos${UNAME_RELEASE}
+ 	exit 0 ;;
+-    atari*:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     # The situation for MiNT is a little confusing.  The machine name
+     # can be virtually everything (everything which is not
+     # "atarist" or "atariste" at least should have a processor
+@@ -357,17 +417,8 @@
+     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+         echo m68k-unknown-mint${UNAME_RELEASE}
+         exit 0 ;;
+-    sun3*:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    mac68k:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    mvme68k:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+-    mvme88k:OpenBSD:*:*)
+-	echo m88k-unknown-openbsd${UNAME_RELEASE}
++    m68k:machten:*:*)
++	echo m68k-apple-machten${UNAME_RELEASE}
+ 	exit 0 ;;
+     powerpc:machten:*:*)
+ 	echo powerpc-apple-machten${UNAME_RELEASE}
+@@ -385,6 +436,7 @@
+ 	echo clipper-intergraph-clix${UNAME_RELEASE}
+ 	exit 0 ;;
+     mips:*:*:UMIPS | mips:*:*:RISCos)
++	eval $set_cc_for_build
+ 	sed 's/^	//' << EOF >$dummy.c
+ #ifdef __cplusplus
+ #include <stdio.h>  /* for printf() prototype */
+@@ -406,15 +458,20 @@
+ 	  exit (-1);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy \
+-	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+-	  && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	$CC_FOR_BUILD -o $dummy $dummy.c \
++	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
++	  && exit 0
+ 	echo mips-mips-riscos${UNAME_RELEASE}
+ 	exit 0 ;;
+     Motorola:PowerMAX_OS:*:*)
+ 	echo powerpc-motorola-powermax
+ 	exit 0 ;;
++    Motorola:*:4.3:PL8-*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
++    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
++	echo powerpc-harris-powermax
++	exit 0 ;;
+     Night_Hawk:Power_UNIX:*:*)
+ 	echo powerpc-harris-powerunix
+ 	exit 0 ;;
+@@ -475,6 +532,7 @@
+ 	exit 0 ;;
+     *:AIX:2:3)
+ 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
++		eval $set_cc_for_build
+ 		sed 's/^		//' << EOF >$dummy.c
+ 		#include <sys/systemcfg.h>
+ 
+@@ -486,8 +544,7 @@
+ 			exit(0);
+ 			}
+ EOF
+-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-		rm -f $dummy.c $dummy
++		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 		echo rs6000-ibm-aix3.2.5
+ 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ 		echo rs6000-ibm-aix3.2.4
+@@ -496,7 +553,7 @@
+ 	fi
+ 	exit 0 ;;
+     *:AIX:*:[45])
+-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
++	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ 		IBM_ARCH=rs6000
+ 	else
+@@ -536,10 +593,8 @@
+ 	    9000/31? )            HP_ARCH=m68000 ;;
+ 	    9000/[34]?? )         HP_ARCH=m68k ;;
+ 	    9000/[678][0-9][0-9])
+-              case "${HPUX_REV}" in
+-                11.[0-9][0-9])
+-                  if [ -x /usr/bin/getconf ]; then
+-                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
++		if [ -x /usr/bin/getconf ]; then
++		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                     case "${sc_cpu_version}" in
+                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+@@ -548,12 +603,13 @@
+                         case "${sc_kernel_bits}" in
+                           32) HP_ARCH="hppa2.0n" ;;
+                           64) HP_ARCH="hppa2.0w" ;;
++			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                         esac ;;
+                     esac
+-                  fi ;;
+-              esac
+-              if [ "${HP_ARCH}" = "" ]; then
+-              sed 's/^              //' << EOF >$dummy.c
++		fi
++		if [ "${HP_ARCH}" = "" ]; then
++		    eval $set_cc_for_build
++		    sed 's/^              //' << EOF >$dummy.c
+ 
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+@@ -586,11 +642,21 @@
+                   exit (0);
+               }
+ EOF
+-	(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+-	if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+-	rm -f $dummy.c $dummy
+-	fi ;;
++		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
++		    test -z "$HP_ARCH" && HP_ARCH=hppa
++		fi ;;
+ 	esac
++	if [ ${HP_ARCH} = "hppa2.0w" ]
++	then
++	    # avoid double evaluation of $set_cc_for_build
++	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
++	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++	    then
++		HP_ARCH="hppa2.0w"
++	    else
++		HP_ARCH="hppa64"
++	    fi
++	fi
+ 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     ia64:HP-UX:*:*)
+@@ -598,6 +664,7 @@
+ 	echo ia64-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     3050*:HI-UX:*:*)
++	eval $set_cc_for_build
+ 	sed 's/^	//' << EOF >$dummy.c
+ 	#include <unistd.h>
+ 	int
+@@ -623,8 +690,7 @@
+ 	  exit (0);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 	echo unknown-hitachi-hiuxwe2
+ 	exit 0 ;;
+     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+@@ -633,7 +699,7 @@
+     9000/8??:4.3bsd:*:*)
+ 	echo hppa1.0-hp-bsd
+ 	exit 0 ;;
+-    *9??*:MPE/iX:*:*)
++    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ 	echo hppa1.0-hp-mpeix
+ 	exit 0 ;;
+     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+@@ -652,9 +718,6 @@
+     parisc*:Lites*:*:*)
+ 	echo hppa1.1-hp-lites
+ 	exit 0 ;;
+-    hppa*:OpenBSD:*:*)
+-	echo hppa-unknown-openbsd
+-	exit 0 ;;
+     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ 	echo c1-convex-bsd
+         exit 0 ;;
+@@ -673,40 +736,37 @@
+     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ 	echo c4-convex-bsd
+         exit 0 ;;
+-    CRAY*X-MP:*:*:*)
+-	echo xmp-cray-unicos
+-        exit 0 ;;
+     CRAY*Y-MP:*:*:*)
+-	echo ymp-cray-unicos${UNAME_RELEASE}
++	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*[A-Z]90:*:*:*)
+ 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
++	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
++	      -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*TS:*:*:*)
+ 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY*T3D:*:*:*)
+-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+-	exit 0 ;;
+     CRAY*T3E:*:*:*)
+ 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*SV1:*:*:*)
+ 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY-2:*:*:*)
+-	echo cray2-cray-unicos
+-        exit 0 ;;
++    *:UNICOS/mp:*:*)
++	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++	exit 0 ;;
+     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+         exit 0 ;;
+-    hp300:OpenBSD:*:*)
+-	echo m68k-unknown-openbsd${UNAME_RELEASE}
++    5000:UNIX_System_V:4.*:*)
++        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ 	exit 0 ;;
+     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+@@ -720,9 +780,6 @@
+     *:FreeBSD:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ 	exit 0 ;;
+-    *:OpenBSD:*:*)
+-	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+-	exit 0 ;;
+     i*:CYGWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-cygwin
+ 	exit 0 ;;
+@@ -732,11 +789,17 @@
+     i*:PW*:*)
+ 	echo ${UNAME_MACHINE}-pc-pw32
+ 	exit 0 ;;
++    x86:Interix*:[34]*)
++	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
++	exit 0 ;;
++    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
++	echo i${UNAME_MACHINE}-pc-mks
++	exit 0 ;;
+     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+ 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ 	# UNAME_MACHINE based on the output of uname instead of i386?
+-	echo i386-pc-interix
++	echo i586-pc-interix
+ 	exit 0 ;;
+     i*:UWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-uwin
+@@ -748,112 +811,93 @@
+ 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+     *:GNU:*:*)
++	# the GNU system
+ 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ 	exit 0 ;;
++    *:GNU/*:*:*)
++	# other systems with GNU libc and userland
++	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++	exit 0 ;;
+     i*86:Minix:*:*)
+ 	echo ${UNAME_MACHINE}-pc-minix
+ 	exit 0 ;;
+     arm*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    cris:Linux:*:*)
++	echo cris-axis-linux-gnu
++	exit 0 ;;
++    crisv32:Linux:*:*)
++	echo crisv32-axis-linux-gnu
++	exit 0 ;;
++    frv:Linux:*:*)
++    	echo frv-unknown-linux-gnu
++	exit 0 ;;
+     ia64:Linux:*:*)
+-	echo ${UNAME_MACHINE}-unknown-linux
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
++    m32r*:Linux:*:*)
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+     m68*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+     mips:Linux:*:*)
+-	cat >$dummy.c <<EOF
+-#ifdef __cplusplus
+-#include <stdio.h>  /* for printf() prototype */
+-int main (int argc, char *argv[]) {
+-#else
+-int main (argc, argv) int argc; char *argv[]; {
+-#endif
+-#ifdef __MIPSEB__
+-  printf ("%s-unknown-linux-gnu\n", argv[1]);
+-#endif
+-#ifdef __MIPSEL__
+-  printf ("%sel-unknown-linux-gnu\n", argv[1]);
+-#endif
+-  return 0;
+-}
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips
++	#undef mipsel
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mipsel
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips
++	#else
++	CPU=
++	#endif
++	#endif
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ 	;;
+-    ppc:Linux:*:*)
+-	# Determine Lib Version
+-	cat >$dummy.c <<EOF
+-#include <features.h>
+-#if defined(__GLIBC__)
+-extern char __libc_version[];
+-extern char __libc_release[];
+-#endif
+-main(argc, argv)
+-     int argc;
+-     char *argv[];
+-{
+-#if defined(__GLIBC__)
+-  printf("%s %s\n", __libc_version, __libc_release);
+-#else
+-  printf("unknown\n");
+-#endif
+-  return 0;
+-}
++    mips64:Linux:*:*)
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips64
++	#undef mips64el
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mips64el
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips64
++	#else
++	CPU=
++	#endif
++	#endif
+ EOF
+-	LIBC=""
+-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		./$dummy | grep 1\.99 > /dev/null
+-		if test "$?" = 0 ; then LIBC="libc1" ; fi
+-	fi
+-	rm -f $dummy.c $dummy
+-	echo powerpc-unknown-linux-gnu${LIBC}
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++	;;
++    ppc:Linux:*:*)
++	echo powerpc-unknown-linux-gnu
++	exit 0 ;;
++    ppc64:Linux:*:*)
++	echo powerpc64-unknown-linux-gnu
+ 	exit 0 ;;
+     alpha:Linux:*:*)
+-	cat <<EOF >$dummy.s
+-	  .data
+-	  \$Lformat:
+-		.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+-	   .text
+-		.globl main
+-		.align 4
+-		.ent main
+-	    main:
+-		.frame \$30,16,\$26,0
+-		ldgp \$29,0(\$27)
+-		.prologue 1
+-		.long 0x47e03d80 # implver \$0
+-		lda \$2,-1
+-		.long 0x47e20c21 # amask \$2,\$1
+-		lda \$16,\$Lformat
+-		mov \$0,\$17
+-		not \$1,\$18
+-		jsr \$26,printf
+-		ldgp \$29,0(\$26)
+-		mov 0,\$16
+-		jsr \$26,exit
+-		.end main
+-EOF
+-	LIBC=""
+-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		case `./$dummy` in
+-		0-0)	UNAME_MACHINE="alpha" ;;
+-		1-0)	UNAME_MACHINE="alphaev5" ;;
+-		1-1)    UNAME_MACHINE="alphaev56" ;;
+-		1-101)	UNAME_MACHINE="alphapca56" ;;
+-		2-303)	UNAME_MACHINE="alphaev6" ;;
+-		2-307)	UNAME_MACHINE="alphaev67" ;;
+-		esac
+-		objdump --private-headers $dummy | \
+-		  grep ld.so.1 > /dev/null
+-		if test "$?" = 0 ; then
+-			LIBC="libc1"
+-		fi
+-	fi
+-	rm -f $dummy.s $dummy
++	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
++	  EV5)   UNAME_MACHINE=alphaev5 ;;
++	  EV56)  UNAME_MACHINE=alphaev56 ;;
++	  PCA56) UNAME_MACHINE=alphapca56 ;;
++	  PCA57) UNAME_MACHINE=alphapca56 ;;
++	  EV6)   UNAME_MACHINE=alphaev6 ;;
++	  EV67)  UNAME_MACHINE=alphaev67 ;;
++	  EV68*) UNAME_MACHINE=alphaev68 ;;
++        esac
++	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
++	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ 	exit 0 ;;
+     parisc:Linux:*:* | hppa:Linux:*:*)
+@@ -870,6 +914,9 @@
+     s390:Linux:*:* | s390x:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-ibm-linux
+ 	exit 0 ;;
++    sh64*:Linux:*:*)
++    	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     sh*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -883,71 +930,62 @@
+ 	# The BFD linker knows what the default object file format is, so
+ 	# first see if it will tell us. cd to the root directory to prevent
+ 	# problems with other programs or directories called `ld' in the path.
+-	ld_supported_emulations=`cd /; ld --help 2>&1 \
+-			 | sed -ne '/supported emulations:/!d
++	# Set LC_ALL=C to ensure ld outputs messages in English.
++	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
++			 | sed -ne '/supported targets:/!d
+ 				    s/[ 	][ 	]*/ /g
+-				    s/.*supported emulations: *//
++				    s/.*supported targets: *//
+ 				    s/ .*//
+ 				    p'`
+-        case "$ld_supported_emulations" in
+-	  i*86linux)
+-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+-		exit 0
+-		;;
+-	  elf_i*86)
++        case "$ld_supported_targets" in
++	  elf32-i386)
+ 		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ 		;;
+-	  i*86coff)
++	  a.out-i386-linux)
++		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
++		exit 0 ;;
++	  coff-i386)
+ 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+-		exit 0
+-		;;
+-	esac
+-	# Either a pre-BFD a.out linker (linux-gnuoldld)
+-	# or one that does not give us useful --help.
+-	# GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+-	# If ld does not provide *any* "supported emulations:"
+-	# that means it is gnuoldld.
+-	test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+-	case "${UNAME_MACHINE}" in
+-	i*86)
+-	  VENDOR=pc;
+-	  ;;
+-	*)
+-	  VENDOR=unknown;
+-	  ;;
++		exit 0 ;;
++	  "")
++		# Either a pre-BFD a.out linker (linux-gnuoldld) or
++		# one that does not give us useful --help.
++		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
++		exit 0 ;;
+ 	esac
+ 	# Determine whether the default compiler is a.out or elf
+-	cat >$dummy.c <<EOF
+-#include <features.h>
+-#ifdef __cplusplus
+-#include <stdio.h>  /* for printf() prototype */
+-	int main (int argc, char *argv[]) {
+-#else
+-	int main (argc, argv) int argc; char *argv[]; {
+-#endif
+-#ifdef __ELF__
+-# ifdef __GLIBC__
+-#  if __GLIBC__ >= 2
+-    printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+-#  else
+-    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+-#  endif
+-# else
+-   printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+-# endif
+-#else
+-  printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+-#endif
+-  return 0;
+-}
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#include <features.h>
++	#ifdef __ELF__
++	# ifdef __GLIBC__
++	#  if __GLIBC__ >= 2
++	LIBC=gnu
++	#  else
++	LIBC=gnulibc1
++	#  endif
++	# else
++	LIBC=gnulibc1
++	# endif
++	#else
++	#ifdef __INTEL_COMPILER
++	LIBC=gnu
++	#else
++	LIBC=gnuaout
++	#endif
++	#endif
++	#ifdef __dietlibc__
++	LIBC=dietlibc
++	#endif
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
+-	rm -f $dummy.c $dummy
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
++	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ 	;;
+-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
+-# are messed up and put the nodename in both sysname and nodename.
+     i*86:DYNIX/ptx:4*:*)
++	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
++	# earlier versions are messed up and put the nodename in both
++	# sysname and nodename.
+ 	echo i386-sequent-sysv4
+ 	exit 0 ;;
+     i*86:UNIX_SV:4.2MP:2.*)
+@@ -958,6 +996,26 @@
+         # Use sysv4.2uw... so that sysv4* matches it.
+ 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ 	exit 0 ;;
++    i*86:OS/2:*:*)
++	# If we were able to find `uname', then EMX Unix compatibility
++	# is probably installed.
++	echo ${UNAME_MACHINE}-pc-os2-emx
++	exit 0 ;;
++    i*86:XTS-300:*:STOP)
++	echo ${UNAME_MACHINE}-unknown-stop
++	exit 0 ;;
++    i*86:atheos:*:*)
++	echo ${UNAME_MACHINE}-unknown-atheos
++	exit 0 ;;
++	i*86:syllable:*:*)
++	echo ${UNAME_MACHINE}-pc-syllable
++	exit 0 ;;
++    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
++	echo i386-unknown-lynxos${UNAME_RELEASE}
++	exit 0 ;;
++    i*86:*DOS:*:*)
++	echo ${UNAME_MACHINE}-pc-msdosdjgpp
++	exit 0 ;;
+     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+@@ -966,36 +1024,32 @@
+ 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ 	fi
+ 	exit 0 ;;
+-    i*86:*:5:7*)
+-        # Fixed at (any) Pentium or better
+-        UNAME_MACHINE=i586
+-        if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
+-	    echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
+-	else
+-	    echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+-	fi
++    i*86:*:5:[78]*)
++	case `/bin/uname -X | grep "^Machine"` in
++	    *486*)	     UNAME_MACHINE=i486 ;;
++	    *Pentium)	     UNAME_MACHINE=i586 ;;
++	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
++	esac
++	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ 	exit 0 ;;
+     i*86:*:3.2:*)
+ 	if test -f /usr/options/cb.name; then
+ 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
++		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
++		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
++		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ 			&& UNAME_MACHINE=i586
+-		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
++		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ 			&& UNAME_MACHINE=i686
+-		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
++		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ 			&& UNAME_MACHINE=i686
+ 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ 	else
+ 		echo ${UNAME_MACHINE}-pc-sysv32
+ 	fi
+ 	exit 0 ;;
+-    i*86:*DOS:*:*)
+-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+-	exit 0 ;;
+     pc:*:*:*)
+ 	# Left here for compatibility:
+         # uname -m prints for DJGPP always 'pc', but it prints nothing about
+@@ -1019,9 +1073,15 @@
+ 	# "miniframe"
+ 	echo m68010-convergent-sysv
+ 	exit 0 ;;
+-    M68*:*:R3V[567]*:*)
++    mc68k:UNIX:SYSTEM5:3.51m)
++	echo m68k-convergent-sysv
++	exit 0 ;;
++    M680?0:D-NIX:5.3:*)
++	echo m68k-diab-dnix
++	exit 0 ;;
++    M68*:*:R3V[5678]*:*)
+ 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
++    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ 	OS_REL=''
+ 	test -r /etc/.relid \
+ 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+@@ -1038,9 +1098,6 @@
+     mc68030:UNIX_System_V:4.*:*)
+ 	echo m68k-atari-sysv4
+ 	exit 0 ;;
+-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+-	echo i386-unknown-lynxos${UNAME_RELEASE}
+-	exit 0 ;;
+     TSUNAMI:LynxOS:2.*:*)
+ 	echo sparc-unknown-lynxos${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1067,8 +1124,8 @@
+ 		echo ns32k-sni-sysv
+ 	fi
+ 	exit 0 ;;
+-    PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+-                           # says <Richard.M.Bartel@ccMail.Census.GOV>
++    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
++                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+         echo i586-unisys-sysv4
+         exit 0 ;;
+     *:UNIX_System_V:4*:FTX*)
+@@ -1080,6 +1137,10 @@
+ 	# From seanf@swdc.stratus.com.
+ 	echo i860-stratus-sysv4
+ 	exit 0 ;;
++    *:VOS:*:*)
++	# From Paul.Green@stratus.com.
++	echo hppa1.1-stratus-vos
++	exit 0 ;;
+     mc68*:A/UX:*:*)
+ 	echo m68k-apple-aux${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1108,6 +1169,9 @@
+     SX-5:SUPER-UX:*:*)
+ 	echo sx5-nec-superux${UNAME_RELEASE}
+ 	exit 0 ;;
++    SX-6:SUPER-UX:*:*)
++	echo sx6-nec-superux${UNAME_RELEASE}
++	exit 0 ;;
+     Power*:Rhapsody:*:*)
+ 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1115,18 +1179,25 @@
+ 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:Darwin:*:*)
+-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
++	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
++	case $UNAME_PROCESSOR in
++	    *86) UNAME_PROCESSOR=i686 ;;
++	    unknown) UNAME_PROCESSOR=powerpc ;;
++	esac
++	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:procnto*:*:* | *:QNX:[0123456789]*:*)
+-	if test "${UNAME_MACHINE}" = "x86pc"; then
++	UNAME_PROCESSOR=`uname -p`
++	if test "$UNAME_PROCESSOR" = "x86"; then
++		UNAME_PROCESSOR=i386
+ 		UNAME_MACHINE=pc
+ 	fi
+-	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
++	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:QNX:*:4*)
+ 	echo i386-pc-qnx
+ 	exit 0 ;;
+-    NSR-[KW]:NONSTOP_KERNEL:*:*)
++    NSR-?:NONSTOP_KERNEL:*:*)
+ 	echo nsr-tandem-nsk${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:NonStop-UX:*:*)
+@@ -1149,11 +1220,6 @@
+ 	fi
+ 	echo ${UNAME_MACHINE}-unknown-plan9
+ 	exit 0 ;;
+-    i*86:OS/2:*:*)
+-	# If we were able to find `uname', then EMX Unix compatibility
+-	# is probably installed.
+-	echo ${UNAME_MACHINE}-pc-os2-emx
+-	exit 0 ;;
+     *:TOPS-10:*:*)
+ 	echo pdp10-unknown-tops10
+ 	exit 0 ;;
+@@ -1172,11 +1238,28 @@
+     *:ITS:*:*)
+ 	echo pdp10-unknown-its
+ 	exit 0 ;;
++    SEI:*:*:SEIUX)
++        echo mips-sei-seiux${UNAME_RELEASE}
++	exit 0 ;;
++    *:DragonFly:*:*)
++	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++	exit 0 ;;
++    *:*VMS:*:*)
++    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
++	case "${UNAME_MACHINE}" in
++	    A*) echo alpha-dec-vms && exit 0 ;;
++	    I*) echo ia64-dec-vms && exit 0 ;;
++	    V*) echo vax-dec-vms && exit 0 ;;
++	esac ;;
++    *:XENIX:*:SysV)
++	echo i386-pc-xenix
++	exit 0 ;;
+ esac
+ 
+ #echo '(No uname command or uname output not recognized.)' 1>&2
+ #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+ 
++eval $set_cc_for_build
+ cat >$dummy.c <<EOF
+ #ifdef _SEQUENT_
+ # include <sys/types.h>
+@@ -1291,8 +1374,7 @@
+ }
+ EOF
+ 
+-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+-rm -f $dummy.c $dummy
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+ 
+ # Apollos put the system type in the environment.
+ 
+diff -Naur mktemp-1.5.orig/config.sub mktemp-1.5/config.sub
+--- mktemp-1.5.orig/config.sub	2001-07-17 02:57:40.000000000 +0000
++++ mktemp-1.5/config.sub	2005-10-01 23:24:44.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-#   Free Software Foundation, Inc.
++#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2001-05-11'
++timestamp='2004-11-30'
+ 
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -29,7 +29,8 @@
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+ 
+-# Please send patches to <config-patches@gnu.org>.
++# Please send patches to <config-patches@gnu.org>.  Submit a context
++# diff and a properly formatted ChangeLog entry.
+ #
+ # Configuration subroutine to validate and canonicalize a configuration type.
+ # Supply the specified configuration type as an argument.
+@@ -69,7 +70,7 @@
+ version="\
+ GNU config.sub ($timestamp)
+ 
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -117,7 +118,8 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
++  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
++  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -143,7 +145,7 @@
+ 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+-	-apple | -axis)
++	-apple | -axis | -knuth | -cray)
+ 		os=
+ 		basic_machine=$1
+ 		;;
+@@ -157,6 +159,14 @@
+ 		os=-vxworks
+ 		basic_machine=$1
+ 		;;
++	-chorusos*)
++		os=-chorusos
++		basic_machine=$1
++		;;
++ 	-chorusrdb)
++ 		os=-chorusrdb
++		basic_machine=$1
++ 		;;
+ 	-hiux*)
+ 		os=-hiuxwe2
+ 		;;
+@@ -215,26 +225,50 @@
+ case $basic_machine in
+ 	# Recognize the basic CPU types without company name.
+ 	# Some are omitted here because they have special meanings below.
+-	tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
+-	        | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
+-		| pyramid | mn10200 | mn10300 | tron | a29k \
+-		| 580 | i960 | h8300 \
+-		| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
+-		| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
+-		| hppa64 \
+-		| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
+-		| alphaev6[78] \
+-		| we32k | ns16k | clipper | i370 | sh | sh[34] \
+-		| powerpc | powerpcle \
+-		| 1750a | dsp16xx | pdp10 | pdp11 \
+-		| mips16 | mips64 | mipsel | mips64el \
+-		| mips64orion | mips64orionel | mipstx39 | mipstx39el \
+-		| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
+-		| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
+-		| sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
+-		| v850 | c4x \
+-		| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
+-		| pj | pjl | h8500 | z8k)
++	1750a | 580 \
++	| a29k \
++	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
++	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
++	| am33_2.0 \
++	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++	| c4x | clipper \
++	| d10v | d30v | dlx | dsp16xx \
++	| fr30 | frv \
++	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
++	| i370 | i860 | i960 | ia64 \
++	| ip2k | iq2000 \
++	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
++	| mips | mipsbe | mipseb | mipsel | mipsle \
++	| mips16 \
++	| mips64 | mips64el \
++	| mips64vr | mips64vrel \
++	| mips64orion | mips64orionel \
++	| mips64vr4100 | mips64vr4100el \
++	| mips64vr4300 | mips64vr4300el \
++	| mips64vr5000 | mips64vr5000el \
++	| mipsisa32 | mipsisa32el \
++	| mipsisa32r2 | mipsisa32r2el \
++	| mipsisa64 | mipsisa64el \
++	| mipsisa64r2 | mipsisa64r2el \
++	| mipsisa64sb1 | mipsisa64sb1el \
++	| mipsisa64sr71k | mipsisa64sr71kel \
++	| mipstx39 | mipstx39el \
++	| mn10200 | mn10300 \
++	| msp430 \
++	| ns16k | ns32k \
++	| openrisc | or32 \
++	| pdp10 | pdp11 | pj | pjl \
++	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
++	| pyramid \
++	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++	| sh64 | sh64le \
++	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
++	| strongarm \
++	| tahoe | thumb | tic4x | tic80 | tron \
++	| v850 | v850e \
++	| we32k \
++	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
++	| z8k)
+ 		basic_machine=$basic_machine-unknown
+ 		;;
+ 	m6811 | m68hc11 | m6812 | m68hc12)
+@@ -242,7 +276,7 @@
+ 		basic_machine=$basic_machine-unknown
+ 		os=-none
+ 		;;
+-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65 | z8k)
++	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ 		;;
+ 
+ 	# We use `pc' rather than `unknown'
+@@ -257,31 +291,62 @@
+ 		exit 1
+ 		;;
+ 	# Recognize the basic CPU types with company name.
+-	# FIXME: clean up the formatting here.
+-	vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+-	      | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
+-	      | arm-*  | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
+-	      | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+-	      | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
+-	      | xmp-* | ymp-* \
+-	      | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
+-	      | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
+-	      | hppa2.0n-* | hppa64-* \
+-	      | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
+-	      | alphaev6[78]-* \
+-	      | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+-	      | clipper-* | orion-* \
+-	      | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \
+-	      | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \
+-	      | mips16-* | mips64-* | mipsel-* \
+-	      | mips64el-* | mips64orion-* | mips64orionel-* \
+-	      | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+-	      | mipstx39-* | mipstx39el-* | mcore-* \
+-	      | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
+-	      | [cjt]90-* \
+-	      | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+-	      | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
+-	      | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
++	580-* \
++	| a29k-* \
++	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
++	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
++	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
++	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
++	| avr-* \
++	| bs2000-* \
++	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
++	| clipper-* | craynv-* | cydra-* \
++	| d10v-* | d30v-* | dlx-* \
++	| elxsi-* \
++	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
++	| h8300-* | h8500-* \
++	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
++	| i*86-* | i860-* | i960-* | ia64-* \
++	| ip2k-* | iq2000-* \
++	| m32r-* | m32rle-* \
++	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
++	| m88110-* | m88k-* | maxq-* | mcore-* \
++	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
++	| mips16-* \
++	| mips64-* | mips64el-* \
++	| mips64vr-* | mips64vrel-* \
++	| mips64orion-* | mips64orionel-* \
++	| mips64vr4100-* | mips64vr4100el-* \
++	| mips64vr4300-* | mips64vr4300el-* \
++	| mips64vr5000-* | mips64vr5000el-* \
++	| mipsisa32-* | mipsisa32el-* \
++	| mipsisa32r2-* | mipsisa32r2el-* \
++	| mipsisa64-* | mipsisa64el-* \
++	| mipsisa64r2-* | mipsisa64r2el-* \
++	| mipsisa64sb1-* | mipsisa64sb1el-* \
++	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
++	| mipstx39-* | mipstx39el-* \
++	| mmix-* \
++	| msp430-* \
++	| none-* | np1-* | ns16k-* | ns32k-* \
++	| orion-* \
++	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
++	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
++	| pyramid-* \
++	| romp-* | rs6000-* \
++	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
++	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
++	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++	| tahoe-* | thumb-* \
++	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++	| tron-* \
++	| v850-* | v850e-* | vax-* \
++	| we32k-* \
++	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
++	| xstormy16-* | xtensa-* \
++	| ymp-* \
++	| z8k-*)
+ 		;;
+ 	# Recognize the various machine names and aliases which stand
+ 	# for a CPU type and a company and sometimes even an OS.
+@@ -299,6 +364,9 @@
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++    	abacus)
++		basic_machine=abacus-unknown
++		;;
+ 	adobe68k)
+ 		basic_machine=m68010-adobe
+ 		os=-scout
+@@ -313,6 +381,12 @@
+ 		basic_machine=a29k-none
+ 		os=-bsd
+ 		;;
++	amd64)
++		basic_machine=x86_64-pc
++		;;
++	amd64-*)
++		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	amdahl)
+ 		basic_machine=580-amdahl
+ 		os=-sysv
+@@ -344,6 +418,10 @@
+ 		basic_machine=ns32k-sequent
+ 		os=-dynix
+ 		;;
++	c90)
++		basic_machine=c90-cray
++		os=-unicos
++		;;
+ 	convex-c1)
+ 		basic_machine=c1-convex
+ 		os=-bsd
+@@ -364,30 +442,45 @@
+ 		basic_machine=c38-convex
+ 		os=-bsd
+ 		;;
+-	cray | ymp)
+-		basic_machine=ymp-cray
++	cray | j90)
++		basic_machine=j90-cray
+ 		os=-unicos
+ 		;;
+-	cray2)
+-		basic_machine=cray2-cray
+-		os=-unicos
++	craynv)
++		basic_machine=craynv-cray
++		os=-unicosmp
+ 		;;
+-	[cjt]90)
+-		basic_machine=${basic_machine}-cray
+-		os=-unicos
++	cr16c)
++		basic_machine=cr16c-unknown
++		os=-elf
+ 		;;
+ 	crds | unos)
+ 		basic_machine=m68k-crds
+ 		;;
++	crisv32 | crisv32-* | etraxfs*)
++		basic_machine=crisv32-axis
++		;;
+ 	cris | cris-* | etrax*)
+ 		basic_machine=cris-axis
+ 		;;
++	crx)
++		basic_machine=crx-unknown
++		os=-elf
++		;;
+ 	da30 | da30-*)
+ 		basic_machine=m68k-da30
+ 		;;
+ 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ 		basic_machine=mips-dec
+ 		;;
++	decsystem10* | dec10*)
++		basic_machine=pdp10-dec
++		os=-tops10
++		;;
++	decsystem20* | dec20*)
++		basic_machine=pdp10-dec
++		os=-tops20
++		;;
+ 	delta | 3300 | motorola-3300 | motorola-delta \
+ 	      | 3300-motorola | delta-motorola)
+ 		basic_machine=m68k-motorola
+@@ -396,6 +489,10 @@
+ 		basic_machine=m88k-motorola
+ 		os=-sysv3
+ 		;;
++	djgpp)
++		basic_machine=i586-pc
++		os=-msdosdjgpp
++		;;
+ 	dpx20 | dpx20-*)
+ 		basic_machine=rs6000-bull
+ 		os=-bosx
+@@ -568,28 +665,20 @@
+ 		basic_machine=m68k-atari
+ 		os=-mint
+ 		;;
+-	mipsel*-linux*)
+-		basic_machine=mipsel-unknown
+-		os=-linux-gnu
+-		;;
+-	mips*-linux*)
+-		basic_machine=mips-unknown
+-		os=-linux-gnu
+-		;;
+ 	mips3*-*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ 		;;
+ 	mips3*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ 		;;
+-	mmix*)
+-		basic_machine=mmix-knuth
+-		os=-mmixware
+-		;;
+ 	monitor)
+ 		basic_machine=m68k-rom68k
+ 		os=-coff
+ 		;;
++	morphos)
++		basic_machine=powerpc-unknown
++		os=-morphos
++		;;
+ 	msdos)
+ 		basic_machine=i386-pc
+ 		os=-msdos
+@@ -669,6 +758,14 @@
+ 		basic_machine=hppa1.1-oki
+ 		os=-proelf
+ 		;;
++	or32 | or32-*)
++		basic_machine=or32-unknown
++		os=-coff
++		;;
++	os400)
++		basic_machine=powerpc-ibm
++		os=-os400
++		;;
+ 	OSE68000 | ose68000)
+ 		basic_machine=m68000-ericsson
+ 		os=-ose
+@@ -691,42 +788,58 @@
+ 	pbb)
+ 		basic_machine=m68k-tti
+ 		;;
+-        pc532 | pc532-*)
++	pc532 | pc532-*)
+ 		basic_machine=ns32k-pc532
+ 		;;
+-	pentium | p5 | k5 | k6 | nexgen)
++	pentium | p5 | k5 | k6 | nexgen | viac3)
+ 		basic_machine=i586-pc
+ 		;;
+-	pentiumpro | p6 | 6x86 | athlon)
++	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ 		basic_machine=i686-pc
+ 		;;
+-	pentiumii | pentium2)
++	pentiumii | pentium2 | pentiumiii | pentium3)
+ 		basic_machine=i686-pc
+ 		;;
+-	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
++	pentium4)
++		basic_machine=i786-pc
++		;;
++	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+-	pentiumii-* | pentium2-*)
++	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
++	pentium4-*)
++		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	pn)
+ 		basic_machine=pn-gould
+ 		;;
+ 	power)	basic_machine=power-ibm
+ 		;;
+ 	ppc)	basic_machine=powerpc-unknown
+-	        ;;
++		;;
+ 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	ppcle | powerpclittle | ppc-le | powerpc-little)
+ 		basic_machine=powerpcle-unknown
+-	        ;;
++		;;
+ 	ppcle-* | powerpclittle-*)
+ 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
++	ppc64)	basic_machine=powerpc64-unknown
++		;;
++	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
++	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
++		basic_machine=powerpc64le-unknown
++		;;
++	ppc64le-* | powerpc64little-*)
++		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	ps2)
+ 		basic_machine=i386-ibm
+ 		;;
+@@ -744,10 +857,26 @@
+ 	rtpc | rtpc-*)
+ 		basic_machine=romp-ibm
+ 		;;
++	s390 | s390-*)
++		basic_machine=s390-ibm
++		;;
++	s390x | s390x-*)
++		basic_machine=s390x-ibm
++		;;
+ 	sa29200)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++	sb1)
++		basic_machine=mipsisa64sb1-unknown
++		;;
++	sb1el)
++		basic_machine=mipsisa64sb1el-unknown
++		;;
++	sei)
++		basic_machine=mips-sei
++		os=-seiux
++		;;
+ 	sequent)
+ 		basic_machine=i386-sequent
+ 		;;
+@@ -755,7 +884,10 @@
+ 		basic_machine=sh-hitachi
+ 		os=-hms
+ 		;;
+-	sparclite-wrs)
++	sh64)
++		basic_machine=sh64-unknown
++		;;
++	sparclite-wrs | simso-wrs)
+ 		basic_machine=sparclite-wrs
+ 		os=-vxworks
+ 		;;
+@@ -822,22 +954,42 @@
+ 		os=-dynix
+ 		;;
+ 	t3e)
+-		basic_machine=t3e-cray
++		basic_machine=alphaev5-cray
++		os=-unicos
++		;;
++	t90)
++		basic_machine=t90-cray
+ 		os=-unicos
+ 		;;
+ 	tic54x | c54x*)
+ 		basic_machine=tic54x-unknown
+ 		os=-coff
+ 		;;
++	tic55x | c55x*)
++		basic_machine=tic55x-unknown
++		os=-coff
++		;;
++	tic6x | c6x*)
++		basic_machine=tic6x-unknown
++		os=-coff
++		;;
+ 	tx39)
+ 		basic_machine=mipstx39-unknown
+ 		;;
+ 	tx39el)
+ 		basic_machine=mipstx39el-unknown
+ 		;;
++	toad1)
++		basic_machine=pdp10-xkl
++		os=-tops20
++		;;
+ 	tower | tower-32)
+ 		basic_machine=m68k-ncr
+ 		;;
++	tpf)
++		basic_machine=s390x-ibm
++		os=-tpf
++		;;
+ 	udi29k)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+@@ -859,8 +1011,8 @@
+ 		os=-vms
+ 		;;
+ 	vpp*|vx|vx-*)
+-               basic_machine=f301-fujitsu
+-               ;;
++		basic_machine=f301-fujitsu
++		;;
+ 	vxworks960)
+ 		basic_machine=i960-wrs
+ 		os=-vxworks
+@@ -881,13 +1033,17 @@
+ 		basic_machine=hppa1.1-winbond
+ 		os=-proelf
+ 		;;
+-	xmp)
+-		basic_machine=xmp-cray
+-		os=-unicos
++	xbox)
++		basic_machine=i686-pc
++		os=-mingw32
+ 		;;
+-        xps | xps100)
++	xps | xps100)
+ 		basic_machine=xps100-honeywell
+ 		;;
++	ymp)
++		basic_machine=ymp-cray
++		os=-unicos
++		;;
+ 	z8k-*-coff)
+ 		basic_machine=z8k-unknown
+ 		os=-sim
+@@ -908,16 +1064,12 @@
+ 	op60c)
+ 		basic_machine=hppa1.1-oki
+ 		;;
+-	mips)
+-		if [ x$os = x-linux-gnu ]; then
+-			basic_machine=mips-unknown
+-		else
+-			basic_machine=mips-mips
+-		fi
+-		;;
+ 	romp)
+ 		basic_machine=romp-ibm
+ 		;;
++	mmix)
++		basic_machine=mmix-knuth
++		;;
+ 	rs6000)
+ 		basic_machine=rs6000-ibm
+ 		;;
+@@ -934,13 +1086,16 @@
+ 	we32k)
+ 		basic_machine=we32k-att
+ 		;;
+-	sh3 | sh4)
++	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ 		basic_machine=sh-unknown
+ 		;;
+-	sparc | sparcv9 | sparcv9b)
++	sh64)
++		basic_machine=sh64-unknown
++		;;
++	sparc | sparcv8 | sparcv9 | sparcv9b)
+ 		basic_machine=sparc-sun
+ 		;;
+-        cydra)
++	cydra)
+ 		basic_machine=cydra-cydrome
+ 		;;
+ 	orion)
+@@ -955,10 +1110,6 @@
+ 	pmac | pmac-mpw)
+ 		basic_machine=powerpc-apple
+ 		;;
+-	c4x*)
+-		basic_machine=c4x-none
+-		os=-coff
+-		;;
+ 	*-unknown)
+ 		# Make sure to match an already-canonicalized machine name.
+ 		;;
+@@ -1014,15 +1165,20 @@
+ 	      | -aos* \
+ 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
++	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
++	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
++	      | -chorusos* | -chorusrdb* \
+ 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
++	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
++	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+-	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
++	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
++	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
++	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
++	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ 	# Remember, each alternative MUST END IN *, to match a version number.
+ 		;;
+ 	-qnx*)
+@@ -1034,8 +1190,10 @@
+ 			;;
+ 		esac
+ 		;;
++	-nto-qnx*)
++		;;
+ 	-nto*)
+-		os=-nto-qnx
++		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ 		;;
+ 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ 	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+@@ -1044,6 +1202,9 @@
+ 	-mac*)
+ 		os=`echo $os | sed -e 's|mac|macos|'`
+ 		;;
++	-linux-dietlibc)
++		os=-linux-dietlibc
++		;;
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
+@@ -1056,6 +1217,9 @@
+ 	-opened*)
+ 		os=-openedition
+ 		;;
++        -os400*)
++		os=-os400
++		;;
+ 	-wince*)
+ 		os=-wince
+ 		;;
+@@ -1074,14 +1238,23 @@
+ 	-acis*)
+ 		os=-aos
+ 		;;
++	-atheos*)
++		os=-atheos
++		;;
++	-syllable*)
++		os=-syllable
++		;;
+ 	-386bsd)
+ 		os=-bsd
+ 		;;
+ 	-ctix* | -uts*)
+ 		os=-sysv
+ 		;;
++	-nova*)
++		os=-rtmk-nova
++		;;
+ 	-ns2 )
+-	        os=-nextstep2
++		os=-nextstep2
+ 		;;
+ 	-nsk*)
+ 		os=-nsk
+@@ -1093,6 +1266,9 @@
+ 	-sinix*)
+ 		os=-sysv4
+ 		;;
++        -tpf*)
++		os=-tpf
++		;;
+ 	-triton*)
+ 		os=-sysv3
+ 		;;
+@@ -1120,8 +1296,17 @@
+ 	-xenix)
+ 		os=-xenix
+ 		;;
+-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+-	        os=-mint
++	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
++		os=-mint
++		;;
++	-aros*)
++		os=-aros
++		;;
++	-kaos*)
++		os=-kaos
++		;;
++	-zvmoe)
++		os=-zvmoe
+ 		;;
+ 	-none)
+ 		;;
+@@ -1154,10 +1339,14 @@
+ 	arm*-semi)
+ 		os=-aout
+ 		;;
++    c4x-* | tic4x-*)
++        os=-coff
++        ;;
++	# This must come before the *-dec entry.
+ 	pdp10-*)
+ 		os=-tops20
+ 		;;
+-        pdp11-*)
++	pdp11-*)
+ 		os=-none
+ 		;;
+ 	*-dec | vax-*)
+@@ -1184,6 +1373,9 @@
+ 	mips*-*)
+ 		os=-elf
+ 		;;
++	or32-*)
++		os=-coff
++		;;
+ 	*-tti)	# must be before sparc entry or we get the wrong os.
+ 		os=-sysv3
+ 		;;
+@@ -1196,6 +1388,9 @@
+ 	*-ibm)
+ 		os=-aix
+ 		;;
++    	*-knuth)
++		os=-mmixware
++		;;
+ 	*-wec)
+ 		os=-proelf
+ 		;;
+@@ -1247,19 +1442,19 @@
+ 	*-next)
+ 		os=-nextstep3
+ 		;;
+-        *-gould)
++	*-gould)
+ 		os=-sysv
+ 		;;
+-        *-highlevel)
++	*-highlevel)
+ 		os=-bsd
+ 		;;
+ 	*-encore)
+ 		os=-bsd
+ 		;;
+-        *-sgi)
++	*-sgi)
+ 		os=-irix
+ 		;;
+-        *-siemens)
++	*-siemens)
+ 		os=-sysv4
+ 		;;
+ 	*-masscomp)
+@@ -1328,10 +1523,16 @@
+ 			-mvs* | -opened*)
+ 				vendor=ibm
+ 				;;
++			-os400*)
++				vendor=ibm
++				;;
+ 			-ptx*)
+ 				vendor=sequent
+ 				;;
+-			-vxsim* | -vxworks*)
++			-tpf*)
++				vendor=ibm
++				;;
++			-vxsim* | -vxworks* | -windiss*)
+ 				vendor=wrs
+ 				;;
+ 			-aux*)
+@@ -1346,6 +1547,9 @@
+ 			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ 				vendor=atari
+ 				;;
++			-vos*)
++				vendor=stratus
++				;;
+ 		esac
+ 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ 		;;
Index: patches/module-init-tools-3.2.2-mips_config_update-1.patch
===================================================================
--- patches/module-init-tools-3.2.2-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/module-init-tools-3.2.2-mips_config_update-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,1156 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-10-01
+Initial Package Version: 3.1
+Origin: Jim Gifford
+Upstream Status: Sent
+Description: Updates config.sub and config.guess
+ 
+diff -Naur module-init-tools-3.1.orig/config.guess module-init-tools-3.1/config.guess
+--- module-init-tools-3.1.orig/config.guess	2002-11-26 01:38:55.000000000 +0000
++++ module-init-tools-3.1/config.guess	2005-10-01 20:35:46.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-#   2000, 2001, 2002 Free Software Foundation, Inc.
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2002-09-03'
++timestamp='2004-11-12'
+ 
+ # This file is free software; you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by
+@@ -53,7 +53,7 @@
+ GNU config.guess ($timestamp)
+ 
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -98,30 +98,32 @@
+ # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+ # use `HOST_CC' if defined, but it is deprecated.
+ 
+-# This shell variable is my proudest work .. or something. --bje
++# Portable tmp directory creation inspired by the Autoconf team.
+ 
+-set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+-(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+-   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+-dummy=$tmpdir/dummy ;
+-files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+-trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
++set_cc_for_build='
++trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
++trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
++: ${TMPDIR=/tmp} ;
++ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
++ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
++dummy=$tmp/dummy ;
++tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+ case $CC_FOR_BUILD,$HOST_CC,$CC in
+  ,,)    echo "int x;" > $dummy.c ;
+ 	for c in cc gcc c89 c99 ; do
+-	  if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
++	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ 	     CC_FOR_BUILD="$c"; break ;
+ 	  fi ;
+ 	done ;
+-	rm -f $files ;
+ 	if test x"$CC_FOR_BUILD" = x ; then
+ 	  CC_FOR_BUILD=no_compiler_found ;
+ 	fi
+ 	;;
+  ,,*)   CC_FOR_BUILD=$CC ;;
+  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+-esac ;
+-unset files'
++esac ;'
+ 
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+ # (ghazi@noc.rutgers.edu 1994-08-24)
+@@ -178,21 +180,38 @@
+ 		;;
+ 	esac
+ 	# The OS release
+-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++	# Debian GNU/NetBSD machines have a different userland, and
++	# thus, need a distinct triplet. However, they do not need
++	# kernel version information, so it can be replaced with a
++	# suitable tag, in the style of linux-gnu.
++	case "${UNAME_VERSION}" in
++	    Debian*)
++		release='-gnu'
++		;;
++	    *)
++		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
++		;;
++	esac
+ 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ 	# contains redundant information, the shorter form:
+ 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ 	echo "${machine}-${os}${release}"
+ 	exit 0 ;;
++    amd64:OpenBSD:*:*)
++	echo x86_64-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
+     amiga:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    arc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
++    cats:OpenBSD:*:*)
++	echo arm-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+     hp300:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
++    luna88k:OpenBSD:*:*)
++    	echo m88k-unknown-openbsd${UNAME_RELEASE}
++	exit 0 ;;
+     mac68k:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -208,86 +227,76 @@
+     mvmeppc:OpenBSD:*:*)
+ 	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    pmax:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     sgi:OpenBSD:*:*)
+-	echo mipseb-unknown-openbsd${UNAME_RELEASE}
++	echo mips64-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+     sun3:OpenBSD:*:*)
+ 	echo m68k-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
+-    wgrisc:OpenBSD:*:*)
+-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+-	exit 0 ;;
+     *:OpenBSD:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ 	exit 0 ;;
++    *:ekkoBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++	exit 0 ;;
++    macppc:MirBSD:*:*)
++	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
++    *:MirBSD:*:*)
++	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++	exit 0 ;;
+     alpha:OSF1:*:*)
+-	if test $UNAME_RELEASE = "V4.0"; then
++	case $UNAME_RELEASE in
++	*4.0)
+ 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+-	fi
++		;;
++	*5.*)
++	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++		;;
++	esac
++	# According to Compaq, /usr/sbin/psrinfo has been available on
++	# OSF/1 and Tru64 systems produced since 1995.  I hope that
++	# covers most systems running today.  This code pipes the CPU
++	# types through head -n 1, so we only detect the type of CPU 0.
++	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
++	case "$ALPHA_CPU_TYPE" in
++	    "EV4 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV4.5 (21064)")
++		UNAME_MACHINE="alpha" ;;
++	    "LCA4 (21066/21068)")
++		UNAME_MACHINE="alpha" ;;
++	    "EV5 (21164)")
++		UNAME_MACHINE="alphaev5" ;;
++	    "EV5.6 (21164A)")
++		UNAME_MACHINE="alphaev56" ;;
++	    "EV5.6 (21164PC)")
++		UNAME_MACHINE="alphapca56" ;;
++	    "EV5.7 (21164PC)")
++		UNAME_MACHINE="alphapca57" ;;
++	    "EV6 (21264)")
++		UNAME_MACHINE="alphaev6" ;;
++	    "EV6.7 (21264A)")
++		UNAME_MACHINE="alphaev67" ;;
++	    "EV6.8CB (21264C)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8AL (21264B)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.8CX (21264D)")
++		UNAME_MACHINE="alphaev68" ;;
++	    "EV6.9A (21264/EV69A)")
++		UNAME_MACHINE="alphaev69" ;;
++	    "EV7 (21364)")
++		UNAME_MACHINE="alphaev7" ;;
++	    "EV7.9 (21364A)")
++		UNAME_MACHINE="alphaev79" ;;
++	esac
++	# A Pn.n version is a patched version.
+ 	# A Vn.n version is a released version.
+ 	# A Tn.n version is a released field test version.
+ 	# A Xn.n version is an unreleased experimental baselevel.
+ 	# 1.2 uses "1.2" for uname -r.
+-	eval $set_cc_for_build
+-	cat <<EOF >$dummy.s
+-	.data
+-\$Lformat:
+-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+-
+-	.text
+-	.globl main
+-	.align 4
+-	.ent main
+-main:
+-	.frame \$30,16,\$26,0
+-	ldgp \$29,0(\$27)
+-	.prologue 1
+-	.long 0x47e03d80 # implver \$0
+-	lda \$2,-1
+-	.long 0x47e20c21 # amask \$2,\$1
+-	lda \$16,\$Lformat
+-	mov \$0,\$17
+-	not \$1,\$18
+-	jsr \$26,printf
+-	ldgp \$29,0(\$26)
+-	mov 0,\$16
+-	jsr \$26,exit
+-	.end main
+-EOF
+-	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+-	if test "$?" = 0 ; then
+-		case `$dummy` in
+-			0-0)
+-				UNAME_MACHINE="alpha"
+-				;;
+-			1-0)
+-				UNAME_MACHINE="alphaev5"
+-				;;
+-			1-1)
+-				UNAME_MACHINE="alphaev56"
+-				;;
+-			1-101)
+-				UNAME_MACHINE="alphapca56"
+-				;;
+-			2-303)
+-				UNAME_MACHINE="alphaev6"
+-				;;
+-			2-307)
+-				UNAME_MACHINE="alphaev67"
+-				;;
+-			2-1307)
+-				UNAME_MACHINE="alphaev68"
+-				;;
+-			3-1307)
+-				UNAME_MACHINE="alphaev7"
+-				;;
+-		esac
+-	fi
+-	rm -f $dummy.s $dummy && rmdir $tmpdir
+-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ 	exit 0 ;;
+     Alpha\ *:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+@@ -310,6 +319,12 @@
+     *:OS/390:*:*)
+ 	echo i370-ibm-openedition
+ 	exit 0 ;;
++    *:z/VM:*:*)
++	echo s390-ibm-zvmoe
++	exit 0 ;;
++    *:OS400:*:*)
++        echo powerpc-ibm-os400
++	exit 0 ;;
+     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ 	echo arm-acorn-riscix${UNAME_RELEASE}
+ 	exit 0;;
+@@ -327,7 +342,10 @@
+     NILE*:*:*:dcosx)
+ 	echo pyramid-pyramid-svr4
+ 	exit 0 ;;
+-    DRS?6000:UNIX_SV:4.2*:7*)
++    DRS?6000:unix:4.0:6*)
++	echo sparc-icl-nx6
++	exit 0 ;;
++    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ 	case `/usr/bin/uname -p` in
+ 	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+ 	esac ;;
+@@ -399,6 +417,9 @@
+     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+         echo m68k-unknown-mint${UNAME_RELEASE}
+         exit 0 ;;
++    m68k:machten:*:*)
++	echo m68k-apple-machten${UNAME_RELEASE}
++	exit 0 ;;
+     powerpc:machten:*:*)
+ 	echo powerpc-apple-machten${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -437,10 +458,9 @@
+ 	  exit (-1);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy \
++	$CC_FOR_BUILD -o $dummy $dummy.c \
+ 	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+-	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-	rm -f $dummy.c $dummy && rmdir $tmpdir
++	  && exit 0
+ 	echo mips-mips-riscos${UNAME_RELEASE}
+ 	exit 0 ;;
+     Motorola:PowerMAX_OS:*:*)
+@@ -449,7 +469,7 @@
+     Motorola:*:4.3:PL8-*)
+ 	echo powerpc-harris-powermax
+ 	exit 0 ;;
+-    Night_Hawk:*:*:PowerMAX_OS)
++    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ 	echo powerpc-harris-powermax
+ 	exit 0 ;;
+     Night_Hawk:Power_UNIX:*:*)
+@@ -524,8 +544,7 @@
+ 			exit(0);
+ 			}
+ EOF
+-		$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-		rm -f $dummy.c $dummy && rmdir $tmpdir
++		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 		echo rs6000-ibm-aix3.2.5
+ 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ 		echo rs6000-ibm-aix3.2.4
+@@ -623,11 +642,21 @@
+                   exit (0);
+               }
+ EOF
+-		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
+-		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+-		    rm -f $dummy.c $dummy && rmdir $tmpdir
++		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
++		    test -z "$HP_ARCH" && HP_ARCH=hppa
+ 		fi ;;
+ 	esac
++	if [ ${HP_ARCH} = "hppa2.0w" ]
++	then
++	    # avoid double evaluation of $set_cc_for_build
++	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
++	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++	    then
++		HP_ARCH="hppa2.0w"
++	    else
++		HP_ARCH="hppa64"
++	    fi
++	fi
+ 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ 	exit 0 ;;
+     ia64:HP-UX:*:*)
+@@ -661,8 +690,7 @@
+ 	  exit (0);
+ 	}
+ EOF
+-	$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-	rm -f $dummy.c $dummy && rmdir $tmpdir
++	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+ 	echo unknown-hitachi-hiuxwe2
+ 	exit 0 ;;
+     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+@@ -720,21 +748,26 @@
+     CRAY*TS:*:*:*)
+ 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+-    CRAY*T3D:*:*:*)
+-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+-	exit 0 ;;
+     CRAY*T3E:*:*:*)
+ 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
+     CRAY*SV1:*:*:*)
+ 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ 	exit 0 ;;
++    *:UNICOS/mp:*:*)
++	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++	exit 0 ;;
+     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+         exit 0 ;;
++    5000:UNIX_System_V:4.*:*)
++        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++	exit 0 ;;
+     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -745,19 +778,7 @@
+ 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:FreeBSD:*:*)
+-	# Determine whether the default compiler uses glibc.
+-	eval $set_cc_for_build
+-	sed 's/^	//' << EOF >$dummy.c
+-	#include <features.h>
+-	#if __GLIBC__ >= 2
+-	LIBC=gnu
+-	#else
+-	LIBC=
+-	#endif
+-EOF
+-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+-	rm -f $dummy.c && rmdir $tmpdir
+-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
++	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ 	exit 0 ;;
+     i*:CYGWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-cygwin
+@@ -768,14 +789,17 @@
+     i*:PW*:*)
+ 	echo ${UNAME_MACHINE}-pc-pw32
+ 	exit 0 ;;
+-    x86:Interix*:3*)
+-	echo i386-pc-interix3
++    x86:Interix*:[34]*)
++	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
++	exit 0 ;;
++    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
++	echo i${UNAME_MACHINE}-pc-mks
+ 	exit 0 ;;
+     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ 	# How do we know it's Interix rather than the generic POSIX subsystem?
+ 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ 	# UNAME_MACHINE based on the output of uname instead of i386?
+-	echo i386-pc-interix
++	echo i586-pc-interix
+ 	exit 0 ;;
+     i*:UWIN*:*)
+ 	echo ${UNAME_MACHINE}-pc-uwin
+@@ -787,17 +811,34 @@
+ 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ 	exit 0 ;;
+     *:GNU:*:*)
++	# the GNU system
+ 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ 	exit 0 ;;
++    *:GNU/*:*:*)
++	# other systems with GNU libc and userland
++	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++	exit 0 ;;
+     i*86:Minix:*:*)
+ 	echo ${UNAME_MACHINE}-pc-minix
+ 	exit 0 ;;
+     arm*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    cris:Linux:*:*)
++	echo cris-axis-linux-gnu
++	exit 0 ;;
++    crisv32:Linux:*:*)
++	echo crisv32-axis-linux-gnu
++	exit 0 ;;
++    frv:Linux:*:*)
++    	echo frv-unknown-linux-gnu
++	exit 0 ;;
+     ia64:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
++    m32r*:Linux:*:*)
++	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     m68*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -818,8 +859,26 @@
+ 	#endif
+ EOF
+ 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+-	rm -f $dummy.c && rmdir $tmpdir
+-	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++	;;
++    mips64:Linux:*:*)
++	eval $set_cc_for_build
++	sed 's/^	//' << EOF >$dummy.c
++	#undef CPU
++	#undef mips64
++	#undef mips64el
++	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
++	CPU=mips64el
++	#else
++	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
++	CPU=mips64
++	#else
++	CPU=
++	#endif
++	#endif
++EOF
++	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+ 	;;
+     ppc:Linux:*:*)
+ 	echo powerpc-unknown-linux-gnu
+@@ -855,6 +914,9 @@
+     s390:Linux:*:* | s390x:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-ibm-linux
+ 	exit 0 ;;
++    sh64*:Linux:*:*)
++    	echo ${UNAME_MACHINE}-unknown-linux-gnu
++	exit 0 ;;
+     sh*:Linux:*:*)
+ 	echo ${UNAME_MACHINE}-unknown-linux-gnu
+ 	exit 0 ;;
+@@ -912,9 +974,11 @@
+ 	LIBC=gnuaout
+ 	#endif
+ 	#endif
++	#ifdef __dietlibc__
++	LIBC=dietlibc
++	#endif
+ EOF
+ 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+-	rm -f $dummy.c && rmdir $tmpdir
+ 	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ 	;;
+@@ -932,6 +996,26 @@
+         # Use sysv4.2uw... so that sysv4* matches it.
+ 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ 	exit 0 ;;
++    i*86:OS/2:*:*)
++	# If we were able to find `uname', then EMX Unix compatibility
++	# is probably installed.
++	echo ${UNAME_MACHINE}-pc-os2-emx
++	exit 0 ;;
++    i*86:XTS-300:*:STOP)
++	echo ${UNAME_MACHINE}-unknown-stop
++	exit 0 ;;
++    i*86:atheos:*:*)
++	echo ${UNAME_MACHINE}-unknown-atheos
++	exit 0 ;;
++	i*86:syllable:*:*)
++	echo ${UNAME_MACHINE}-pc-syllable
++	exit 0 ;;
++    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
++	echo i386-unknown-lynxos${UNAME_RELEASE}
++	exit 0 ;;
++    i*86:*DOS:*:*)
++	echo ${UNAME_MACHINE}-pc-msdosdjgpp
++	exit 0 ;;
+     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+@@ -966,9 +1050,6 @@
+ 		echo ${UNAME_MACHINE}-pc-sysv32
+ 	fi
+ 	exit 0 ;;
+-    i*86:*DOS:*:*)
+-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+-	exit 0 ;;
+     pc:*:*:*)
+ 	# Left here for compatibility:
+         # uname -m prints for DJGPP always 'pc', but it prints nothing about
+@@ -995,9 +1076,12 @@
+     mc68k:UNIX:SYSTEM5:3.51m)
+ 	echo m68k-convergent-sysv
+ 	exit 0 ;;
+-    M68*:*:R3V[567]*:*)
++    M680?0:D-NIX:5.3:*)
++	echo m68k-diab-dnix
++	exit 0 ;;
++    M68*:*:R3V[5678]*:*)
+ 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
++    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ 	OS_REL=''
+ 	test -r /etc/.relid \
+ 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+@@ -1014,9 +1098,6 @@
+     mc68030:UNIX_System_V:4.*:*)
+ 	echo m68k-atari-sysv4
+ 	exit 0 ;;
+-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+-	echo i386-unknown-lynxos${UNAME_RELEASE}
+-	exit 0 ;;
+     TSUNAMI:LynxOS:2.*:*)
+ 	echo sparc-unknown-lynxos${UNAME_RELEASE}
+ 	exit 0 ;;
+@@ -1098,7 +1179,12 @@
+ 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:Darwin:*:*)
+-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
++	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
++	case $UNAME_PROCESSOR in
++	    *86) UNAME_PROCESSOR=i686 ;;
++	    unknown) UNAME_PROCESSOR=powerpc ;;
++	esac
++	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ 	UNAME_PROCESSOR=`uname -p`
+@@ -1111,7 +1197,7 @@
+     *:QNX:*:4*)
+ 	echo i386-pc-qnx
+ 	exit 0 ;;
+-    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
++    NSR-?:NONSTOP_KERNEL:*:*)
+ 	echo nsr-tandem-nsk${UNAME_RELEASE}
+ 	exit 0 ;;
+     *:NonStop-UX:*:*)
+@@ -1134,11 +1220,6 @@
+ 	fi
+ 	echo ${UNAME_MACHINE}-unknown-plan9
+ 	exit 0 ;;
+-    i*86:OS/2:*:*)
+-	# If we were able to find `uname', then EMX Unix compatibility
+-	# is probably installed.
+-	echo ${UNAME_MACHINE}-pc-os2-emx
+-	exit 0 ;;
+     *:TOPS-10:*:*)
+ 	echo pdp10-unknown-tops10
+ 	exit 0 ;;
+@@ -1157,11 +1238,21 @@
+     *:ITS:*:*)
+ 	echo pdp10-unknown-its
+ 	exit 0 ;;
+-    i*86:XTS-300:*:STOP)
+-	echo ${UNAME_MACHINE}-unknown-stop
++    SEI:*:*:SEIUX)
++        echo mips-sei-seiux${UNAME_RELEASE}
+ 	exit 0 ;;
+-    i*86:atheos:*:*)
+-	echo ${UNAME_MACHINE}-unknown-atheos
++    *:DragonFly:*:*)
++	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++	exit 0 ;;
++    *:*VMS:*:*)
++    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
++	case "${UNAME_MACHINE}" in
++	    A*) echo alpha-dec-vms && exit 0 ;;
++	    I*) echo ia64-dec-vms && exit 0 ;;
++	    V*) echo vax-dec-vms && exit 0 ;;
++	esac ;;
++    *:XENIX:*:SysV)
++	echo i386-pc-xenix
+ 	exit 0 ;;
+ esac
+ 
+@@ -1283,8 +1374,7 @@
+ }
+ EOF
+ 
+-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+-rm -f $dummy.c $dummy && rmdir $tmpdir
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+ 
+ # Apollos put the system type in the environment.
+ 
+diff -Naur module-init-tools-3.1.orig/config.sub module-init-tools-3.1/config.sub
+--- module-init-tools-3.1.orig/config.sub	2002-11-26 01:38:55.000000000 +0000
++++ module-init-tools-3.1/config.sub	2005-10-01 20:35:51.000000000 +0000
+@@ -1,9 +1,9 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-#   2000, 2001, 2002 Free Software Foundation, Inc.
++#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 
+-timestamp='2002-09-05'
++timestamp='2004-11-30'
+ 
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -70,7 +70,7 @@
+ version="\
+ GNU config.sub ($timestamp)
+ 
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+ 
+ This is free software; see the source for copying conditions.  There is NO
+@@ -118,7 +118,8 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+-  nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
++  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
++  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+@@ -144,7 +145,7 @@
+ 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+-	-apple | -axis)
++	-apple | -axis | -knuth | -cray)
+ 		os=
+ 		basic_machine=$1
+ 		;;
+@@ -228,14 +229,15 @@
+ 	| a29k \
+ 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
++	| am33_2.0 \
+ 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+-	| clipper \
++	| c4x | clipper \
+ 	| d10v | d30v | dlx | dsp16xx \
+ 	| fr30 | frv \
+ 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ 	| i370 | i860 | i960 | ia64 \
+-	| ip2k \
+-	| m32r | m68000 | m68k | m88k | mcore \
++	| ip2k | iq2000 \
++	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ 	| mips | mipsbe | mipseb | mipsel | mipsle \
+ 	| mips16 \
+ 	| mips64 | mips64el \
+@@ -245,24 +247,27 @@
+ 	| mips64vr4300 | mips64vr4300el \
+ 	| mips64vr5000 | mips64vr5000el \
+ 	| mipsisa32 | mipsisa32el \
++	| mipsisa32r2 | mipsisa32r2el \
+ 	| mipsisa64 | mipsisa64el \
++	| mipsisa64r2 | mipsisa64r2el \
+ 	| mipsisa64sb1 | mipsisa64sb1el \
+ 	| mipsisa64sr71k | mipsisa64sr71kel \
+ 	| mipstx39 | mipstx39el \
+ 	| mn10200 | mn10300 \
++	| msp430 \
+ 	| ns16k | ns32k \
+ 	| openrisc | or32 \
+ 	| pdp10 | pdp11 | pj | pjl \
+ 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ 	| pyramid \
+-	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ 	| sh64 | sh64le \
+-	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
++	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+ 	| strongarm \
+-	| tahoe | thumb | tic80 | tron \
++	| tahoe | thumb | tic4x | tic80 | tron \
+ 	| v850 | v850e \
+ 	| we32k \
+-	| x86 | xscale | xstormy16 | xtensa \
++	| x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ 	| z8k)
+ 		basic_machine=$basic_machine-unknown
+ 		;;
+@@ -294,18 +299,18 @@
+ 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+ 	| avr-* \
+ 	| bs2000-* \
+-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+-	| clipper-* | cydra-* \
++	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
++	| clipper-* | craynv-* | cydra-* \
+ 	| d10v-* | d30v-* | dlx-* \
+ 	| elxsi-* \
+ 	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ 	| h8300-* | h8500-* \
+ 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ 	| i*86-* | i860-* | i960-* | ia64-* \
+-	| ip2k-* \
+-	| m32r-* \
++	| ip2k-* | iq2000-* \
++	| m32r-* | m32rle-* \
+ 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+-	| m88110-* | m88k-* | mcore-* \
++	| m88110-* | m88k-* | maxq-* | mcore-* \
+ 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ 	| mips16-* \
+ 	| mips64-* | mips64el-* \
+@@ -315,25 +320,31 @@
+ 	| mips64vr4300-* | mips64vr4300el-* \
+ 	| mips64vr5000-* | mips64vr5000el-* \
+ 	| mipsisa32-* | mipsisa32el-* \
++	| mipsisa32r2-* | mipsisa32r2el-* \
+ 	| mipsisa64-* | mipsisa64el-* \
++	| mipsisa64r2-* | mipsisa64r2el-* \
+ 	| mipsisa64sb1-* | mipsisa64sb1el-* \
+ 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+-	| mipstx39 | mipstx39el \
++	| mipstx39-* | mipstx39el-* \
++	| mmix-* \
++	| msp430-* \
+ 	| none-* | np1-* | ns16k-* | ns32k-* \
+ 	| orion-* \
+ 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ 	| pyramid-* \
+ 	| romp-* | rs6000-* \
+-	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
++	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ 	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+-	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+-	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
++	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++	| tahoe-* | thumb-* \
++	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++	| tron-* \
+ 	| v850-* | v850e-* | vax-* \
+ 	| we32k-* \
+-	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+-	| xtensa-* \
++	| x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
++	| xstormy16-* | xtensa-* \
+ 	| ymp-* \
+ 	| z8k-*)
+ 		;;
+@@ -353,6 +364,9 @@
+ 		basic_machine=a29k-amd
+ 		os=-udi
+ 		;;
++    	abacus)
++		basic_machine=abacus-unknown
++		;;
+ 	adobe68k)
+ 		basic_machine=m68010-adobe
+ 		os=-scout
+@@ -367,6 +381,12 @@
+ 		basic_machine=a29k-none
+ 		os=-bsd
+ 		;;
++	amd64)
++		basic_machine=x86_64-pc
++		;;
++	amd64-*)
++		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	amdahl)
+ 		basic_machine=580-amdahl
+ 		os=-sysv
+@@ -426,12 +446,27 @@
+ 		basic_machine=j90-cray
+ 		os=-unicos
+ 		;;
++	craynv)
++		basic_machine=craynv-cray
++		os=-unicosmp
++		;;
++	cr16c)
++		basic_machine=cr16c-unknown
++		os=-elf
++		;;
+ 	crds | unos)
+ 		basic_machine=m68k-crds
+ 		;;
++	crisv32 | crisv32-* | etraxfs*)
++		basic_machine=crisv32-axis
++		;;
+ 	cris | cris-* | etrax*)
+ 		basic_machine=cris-axis
+ 		;;
++	crx)
++		basic_machine=crx-unknown
++		os=-elf
++		;;
+ 	da30 | da30-*)
+ 		basic_machine=m68k-da30
+ 		;;
+@@ -454,6 +489,10 @@
+ 		basic_machine=m88k-motorola
+ 		os=-sysv3
+ 		;;
++	djgpp)
++		basic_machine=i586-pc
++		os=-msdosdjgpp
++		;;
+ 	dpx20 | dpx20-*)
+ 		basic_machine=rs6000-bull
+ 		os=-bosx
+@@ -632,10 +671,6 @@
+ 	mips3*)
+ 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ 		;;
+-	mmix*)
+-		basic_machine=mmix-knuth
+-		os=-mmixware
+-		;;
+ 	monitor)
+ 		basic_machine=m68k-rom68k
+ 		os=-coff
+@@ -727,6 +762,10 @@
+ 		basic_machine=or32-unknown
+ 		os=-coff
+ 		;;
++	os400)
++		basic_machine=powerpc-ibm
++		os=-os400
++		;;
+ 	OSE68000 | ose68000)
+ 		basic_machine=m68000-ericsson
+ 		os=-ose
+@@ -758,18 +797,24 @@
+ 	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ 		basic_machine=i686-pc
+ 		;;
+-	pentiumii | pentium2)
++	pentiumii | pentium2 | pentiumiii | pentium3)
+ 		basic_machine=i686-pc
+ 		;;
++	pentium4)
++		basic_machine=i786-pc
++		;;
+ 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+ 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
+-	pentiumii-* | pentium2-*)
++	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ 		;;
++	pentium4-*)
++		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
++		;;
+ 	pn)
+ 		basic_machine=pn-gould
+ 		;;
+@@ -828,6 +873,10 @@
+ 	sb1el)
+ 		basic_machine=mipsisa64sb1el-unknown
+ 		;;
++	sei)
++		basic_machine=mips-sei
++		os=-seiux
++		;;
+ 	sequent)
+ 		basic_machine=i386-sequent
+ 		;;
+@@ -835,6 +884,9 @@
+ 		basic_machine=sh-hitachi
+ 		os=-hms
+ 		;;
++	sh64)
++		basic_machine=sh64-unknown
++		;;
+ 	sparclite-wrs | simso-wrs)
+ 		basic_machine=sparclite-wrs
+ 		os=-vxworks
+@@ -901,10 +953,6 @@
+ 		basic_machine=i386-sequent
+ 		os=-dynix
+ 		;;
+-	t3d)
+-		basic_machine=alpha-cray
+-		os=-unicos
+-		;;
+ 	t3e)
+ 		basic_machine=alphaev5-cray
+ 		os=-unicos
+@@ -913,14 +961,18 @@
+ 		basic_machine=t90-cray
+ 		os=-unicos
+ 		;;
+-        tic4x | c4x*)
+-		basic_machine=tic4x-unknown
+-		os=-coff
+-		;;
+ 	tic54x | c54x*)
+ 		basic_machine=tic54x-unknown
+ 		os=-coff
+ 		;;
++	tic55x | c55x*)
++		basic_machine=tic55x-unknown
++		os=-coff
++		;;
++	tic6x | c6x*)
++		basic_machine=tic6x-unknown
++		os=-coff
++		;;
+ 	tx39)
+ 		basic_machine=mipstx39-unknown
+ 		;;
+@@ -934,6 +986,10 @@
+ 	tower | tower-32)
+ 		basic_machine=m68k-ncr
+ 		;;
++	tpf)
++		basic_machine=s390x-ibm
++		os=-tpf
++		;;
+ 	udi29k)
+ 		basic_machine=a29k-amd
+ 		os=-udi
+@@ -977,9 +1033,9 @@
+ 		basic_machine=hppa1.1-winbond
+ 		os=-proelf
+ 		;;
+-	windows32)
+-		basic_machine=i386-pc
+-		os=-windows32-msvcrt
++	xbox)
++		basic_machine=i686-pc
++		os=-mingw32
+ 		;;
+ 	xps | xps100)
+ 		basic_machine=xps100-honeywell
+@@ -1011,6 +1067,9 @@
+ 	romp)
+ 		basic_machine=romp-ibm
+ 		;;
++	mmix)
++		basic_machine=mmix-knuth
++		;;
+ 	rs6000)
+ 		basic_machine=rs6000-ibm
+ 		;;
+@@ -1027,13 +1086,13 @@
+ 	we32k)
+ 		basic_machine=we32k-att
+ 		;;
+-	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
++	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+ 		basic_machine=sh-unknown
+ 		;;
+ 	sh64)
+ 		basic_machine=sh64-unknown
+ 		;;
+-	sparc | sparcv9 | sparcv9b)
++	sparc | sparcv8 | sparcv9 | sparcv9b)
+ 		basic_machine=sparc-sun
+ 		;;
+ 	cydra)
+@@ -1106,18 +1165,20 @@
+ 	      | -aos* \
+ 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
++	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
++	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ 	      | -chorusos* | -chorusrdb* \
+ 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
++	      | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
++	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
++	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
++	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+ 	# Remember, each alternative MUST END IN *, to match a version number.
+ 		;;
+ 	-qnx*)
+@@ -1129,8 +1190,10 @@
+ 			;;
+ 		esac
+ 		;;
++	-nto-qnx*)
++		;;
+ 	-nto*)
+-		os=-nto-qnx
++		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ 		;;
+ 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ 	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+@@ -1139,6 +1202,9 @@
+ 	-mac*)
+ 		os=`echo $os | sed -e 's|mac|macos|'`
+ 		;;
++	-linux-dietlibc)
++		os=-linux-dietlibc
++		;;
+ 	-linux*)
+ 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ 		;;
+@@ -1151,6 +1217,9 @@
+ 	-opened*)
+ 		os=-openedition
+ 		;;
++        -os400*)
++		os=-os400
++		;;
+ 	-wince*)
+ 		os=-wince
+ 		;;
+@@ -1172,6 +1241,9 @@
+ 	-atheos*)
+ 		os=-atheos
+ 		;;
++	-syllable*)
++		os=-syllable
++		;;
+ 	-386bsd)
+ 		os=-bsd
+ 		;;
+@@ -1194,6 +1266,9 @@
+ 	-sinix*)
+ 		os=-sysv4
+ 		;;
++        -tpf*)
++		os=-tpf
++		;;
+ 	-triton*)
+ 		os=-sysv3
+ 		;;
+@@ -1224,6 +1299,15 @@
+ 	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ 		os=-mint
+ 		;;
++	-aros*)
++		os=-aros
++		;;
++	-kaos*)
++		os=-kaos
++		;;
++	-zvmoe)
++		os=-zvmoe
++		;;
+ 	-none)
+ 		;;
+ 	*)
+@@ -1255,6 +1339,9 @@
+ 	arm*-semi)
+ 		os=-aout
+ 		;;
++    c4x-* | tic4x-*)
++        os=-coff
++        ;;
+ 	# This must come before the *-dec entry.
+ 	pdp10-*)
+ 		os=-tops20
+@@ -1301,6 +1388,9 @@
+ 	*-ibm)
+ 		os=-aix
+ 		;;
++    	*-knuth)
++		os=-mmixware
++		;;
+ 	*-wec)
+ 		os=-proelf
+ 		;;
+@@ -1433,9 +1523,15 @@
+ 			-mvs* | -opened*)
+ 				vendor=ibm
+ 				;;
++			-os400*)
++				vendor=ibm
++				;;
+ 			-ptx*)
+ 				vendor=sequent
+ 				;;
++			-tpf*)
++				vendor=ibm
++				;;
+ 			-vxsim* | -vxworks* | -windiss*)
+ 				vendor=wrs
+ 				;;
Index: patches/perl-5.8.8-Configure_multilib-1.patch
===================================================================
--- patches/perl-5.8.8-Configure_multilib-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/perl-5.8.8-Configure_multilib-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,35 @@
+Submitted By: Ryan Oliver <ryan(dot)oliver(at)pha(dot)com(dot)au>
+Date: 2005-10-20
+Initial Package Version: 5.8.7
+Origin: Ryan Oliver
+Description: this patch allows perl to be installed in /usr/lib32 or /usr/lib64 instead of /usr/lib.
+
+--- perl-5.8.7/Configure-ORIG	2005-10-20 11:49:47.571389008 +1000
++++ perl-5.8.7/Configure	2005-10-20 12:30:35.571236464 +1000
+@@ -5930,6 +5930,8 @@
+ : The default "style" setting is made in installstyle.U
+ case "$installstyle" in
+ *lib/perl5*) set dflt privlib lib/$package/$version ;;
++*lib32/perl5*) set dflt privlib lib32/$package/$version ;;
++*lib64/perl5*) set dflt privlib lib64/$package/$version ;;
+ *)	 set dflt privlib lib/$version ;;
+ esac
+ eval $prefixit
+@@ -6433,6 +6435,8 @@
+ case "$sitelib" in
+ '') case "$installstyle" in
+ 	*lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
++	*lib32/perl5*) dflt=$siteprefix/lib32/$package/site_$prog/$version ;;
++	*lib64/perl5*) dflt=$siteprefix/lib64/$package/site_$prog/$version ;;
+ 	*)	 dflt=$siteprefix/lib/site_$prog/$version ;;
+ 	esac
+ 	;;
+@@ -6560,6 +6564,8 @@
+ 		prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+ 		case "$installstyle" in
+ 		*lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
++		*lib32/perl5*) dflt=$vendorprefix/lib32/$package/vendor_$prog/$version ;;
++		*lib64/perl5*) dflt=$vendorprefix/lib64/$package/vendor_$prog/$version ;;
+ 		*)	     dflt=$vendorprefix/lib/vendor_$prog/$version ;;
+ 		esac
+ 		;;
Index: patches/perl-5.8.8-libc-1.patch
===================================================================
--- patches/perl-5.8.8-libc-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/perl-5.8.8-libc-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,32 @@
+Submitted By: Anderson Lizardo <andersonlizardo(at)yahoo(dot)com(dot)br>
+Date: 2006-02-02
+Initial Package Version: 5.8.8
+Origin: based on current LFS-BOOK patch (perl-5.8.0-libc-2.patch)
+Description: this patch adapts some hard-wired paths to the C library.
+             It uses the $prefix variable to locate the correct libc. 
+
+	     Updated to Perl 5.8.8 by Jim Gifford
+
+diff -Naur perl-5.8.8.orig/hints/linux.sh perl-5.8.8/hints/linux.sh
+--- perl-5.8.8.orig/hints/linux.sh	2005-11-18 01:18:45.000000000 +0000
++++ perl-5.8.8/hints/linux.sh	2006-02-02 17:20:36.000000000 +0000
+@@ -52,9 +52,9 @@
+ # We don't use __GLIBC__ and  __GLIBC_MINOR__ because they
+ # are insufficiently precise to distinguish things like
+ # libc-2.0.6 and libc-2.0.7.
+-if test -L /lib/libc.so.6; then
+-    libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
+-    libc=/lib/$libc
++if test -L ${prefix}/lib/libc.so.6; then
++    libc=`ls -l ${prefix}/lib/libc.so.6 | awk '{print $NF}'`
++    libc=${prefix}/lib/$libc
+ fi
+ 
+ # Configure may fail to find lstat() since it's a static/inline
+@@ -330,3 +330,6 @@
+     libswanted="$*"
+     ;;
+ esac
++locincpth=""
++loclibpth=""
++glibpth="${prefix}/lib"
Index: patches/perl-5.8.8-libc_lib64-1.patch
===================================================================
--- patches/perl-5.8.8-libc_lib64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/perl-5.8.8-libc_lib64-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,22 @@
+Submitted By: Thomas Pegg <thomasp at linuxfromscratch dot org>
+Date: 2005-10-27
+Initial Package Version: 5.8.7
+Origin: based on perl-5.8.7-libc-1.patch 
+Description: this patch adapts some hard-wired paths to the C library and points it to use lib64 instead of lib.
+
+diff -uNr perl-5.8.0.orig/hints/linux.sh perl-5.8.0/hints/linux.sh
+--- perl-5.8.0.orig/hints/linux.sh	2002-06-05 23:46:00.000000000 +1000
++++ perl-5.8.0/hints/linux.sh	2003-02-19 16:32:18.000000000 +1100
+@@ -51,9 +51,9 @@
+ # We don't use __GLIBC__ and  __GLIBC_MINOR__ because they 
+ # are insufficiently precise to distinguish things like
+ # libc-2.0.6 and libc-2.0.7.
+-if test -L /lib/libc.so.6; then
+-    libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
+-    libc=/lib/$libc
++if test -L /lib64/libc.so.6; then
++    libc=`ls -l /lib64/libc.so.6 | awk '{print $NF}'`
++    libc=/lib64/$libc
+ fi
+ 
+ # Configure may fail to find lstat() since it's a static/inline
Index: patches/powerpc-utils_1.1.3-fixes-1.patch
===================================================================
--- patches/powerpc-utils_1.1.3-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/powerpc-utils_1.1.3-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,962 @@
+Submitted By: Ken Moffat <ken@linuxfromscratch.org>
+Date: 2005-11-17
+Initial Package Version: 1.1.3
+Upstream Status: Package is maintained by debian, this cherry-picks
+Origin: From debian 1.1.3-18.diff, edited
+Description: Makes it work on New World, fixes compile error.
+
+ Some of the debian powerpc-utils_1.1.3-18.diff, but only the parts relevant
+to nvsetenv and nvsetvol - the remainder may be useful on an Old World Mac, but
+they are no use on New World.  The Makefile CFLAGS change apparently helps on
+powerpc64.  I've also removed bogus messages advising you to update your
+headers when IOC_NVRAM_SYNC isn't defined : it hasn't existed for a long
+time.  Finally, I ran the nvsetenv.sgml through docbook2txt -man to get a
+proper man page, because most people won't have docbook utils installed. 
+
+diff -Nuar pmac-utils.orig/Makefile pmac-utils/Makefile
+--- pmac-utils.orig/Makefile	1998-07-21 14:22:28.000000000 +0100
++++ pmac-utils/Makefile	2005-11-17 15:16:52.000000000 +0000
+@@ -22,8 +22,8 @@
+ 
+ SGMLMAN	= sgml2txt -man
+ CC	= gcc -Wall -Wstrict-prototypes
+-CFLAGS	= -O2 -fsigned-char 
+-LDFLAGS = -s
++CFLAGS	= -O2 -fsigned-char -D_GNU_SOURCE
++LDFLAGS =
+ INSTALL	= /usr/bin/install -c
+ SOUND_INC = -I.
+ 
+@@ -42,8 +42,12 @@
+ mousemode:
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c
+ 
+-nvsetenv:
++nvsetenv: nvsetenv.c nwnvsetenv.c
++	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c nwnvsetenv.c
++
++nvsetvol:
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c
++ 
+ 
+ nvvideo:
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $@.c
+diff -Nuar pmac-utils.orig/nvsetenv.8 pmac-utils/nvsetenv.8
+--- pmac-utils.orig/nvsetenv.8	1970-01-01 01:00:00.000000000 +0100
++++ pmac-utils/nvsetenv.8	2005-11-17 20:39:47.000000000 +0000
+@@ -0,0 +1,256 @@
++.if n .ds Q \&"
++.if t .ds Q ``
++.if n .ds U \&"
++.if t .ds U ''
++.TH "NVSETENV" 8 
++.tr \&
++.nr bi 0
++.nr ll 0
++.nr el 0
++.de DS
++..
++.de DE
++..
++.de Pp
++.ie \\n(ll>0 \{\
++.ie \\n(bi=1 \{\
++.nr bi 0
++.if \\n(t\\n(ll=0 \{.IP \\(bu\}
++.if \\n(t\\n(ll=1 \{.IP \\n+(e\\n(el.\}
++.\}
++.el .sp 
++.\}
++.el \{\
++.ie \\nh=1 \{\
++.LP
++.nr h 0
++.\}
++.el .PP 
++.\}
++..
++.SH NAME
++
++.Pp
++\fBnvsetenv\fP - change/view Open Firmware environment variables 
++.Pp
++.SH SYNOPSIS
++
++.Pp
++\fBnvsetenv 
++\f(CR[\fP\fIvariable\fP \f(CR[\fP\fIvalue\fP\f(CR\fB]]\fP\fP\fP
++.Pp
++.SH DESCRIPTION
++
++.Pp
++\fBnvsetenv\fP is a program to adjust or view the Open Firmware (OF)
++boot parameters stored in non-volatile (battery-powered) RAM.
++\fBnvsetenv\fP will show the current values of all OF's environment
++variables when no parameters are given.
++.Pp
++.SH OPTIONS
++
++.Pp
++.nr ll +1
++.nr t\n(ll 2
++.if \n(ll>1 .RS
++.IP "\fIvariable\fP"
++.nr bi 1
++.Pp
++nvsetenv will show current value of an OF's
++variable, if no value is given
++.IP "\fIvariable value\fP"
++.nr bi 1
++.Pp
++nvsetenv will set \fIvariable\fP to
++\fIvalue\fP
++.if \n(ll>1 .RE
++.nr ll -1
++.Pp
++.SH EXAMPLES
++
++.Pp
++This example will set the boot device to the first SCSI disk on the
++internal SCSI bus, using /vmlinux as boot image, trying to
++use the third partition as root partition.
++.DS
++.sp 
++.ft RR
++.nf
++        > nvsetenv boot-device  \&"scsi-int/sd@0:0\&"
++        > nvsetenv boot-file    \&" /vmlinux root=/dev/sda3\&"
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++Alternatives boot devices are: 
++.DS
++.sp 
++.ft RR
++.nf
++        scsi/sd@1:0             SCSI disk at ID 1
++        ata/ata-disk@0:0        Internal IDE disk
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++You can also boot from a floppy, you need a XCOFF-format kernel image
++(in this example: vmlinux.coff), copied to a HFS format high-density
++(1.44Mb) floppy.
++.DS
++.sp 
++.ft RR
++.nf
++        > nvsetenv boot-device  \&"fd:vmlinux.coff\&"
++        > nvsetenv boot-file    \&" root=/dev/sda3\&"
++.DE
++.fi 
++.ec
++.ft P
++.sp
++
++To return to MacOS, do:
++.DS
++.sp 
++.ft RR
++.nf
++        > nvsetenv boot-device  \&"/AAPL,ROM\&"
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++Valid values for \&"input-devices\&" are:
++.DS
++.sp 
++.ft RR
++.nf
++        ttya                    Modem serial port
++        ttyb                    Printer serial port
++        kbd                     Keyboard
++        enet                    Ethernet interface
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++Valid values for \&"output-devices\&" are (machine and/or OF dependent):
++.DS
++.sp 
++.ft RR
++.nf
++        screen                  Screen display (newer machines)
++        /chaos/control          Screen display (7500, 7600 and 8500)
++        /bandit/ATY,264GT-B     Screen display (6500)
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++OF is not designed to wait for your hard disk to spin up
++(remember MacOS boots from ROM).
++Use the following setting to have OF retry to boot from your disk 
++until is has spun up:
++.DS
++.sp 
++.ft RR
++.nf
++        > nvsetenv boot-command \&"begin ['] boot catch 1000 ms cr again\&"
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++You only have to append an \&"S\&" to the \&"boot-file\&" variable to boot
++Linux in single user mode.
++.Pp
++You can use install your own nvramrc patch using the following command:
++.DS
++.sp 
++.ft RR
++.nf
++        > nvsetenv nvramrc \&"`cat file.patch`\&"
++.DE
++.fi 
++.ec
++.ft P
++.sp
++
++(please note the backticks!), or: 
++.DS
++.sp 
++.ft RR
++.nf
++        > nvsetenv nvramrc \&"$(cat file.patch)\&"
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
++.SH FILES
++
++.Pp
++.nr ll +1
++.nr t\n(ll 2
++.if \n(ll>1 .RS
++.IP "\fI/dev/nvram\fP"
++.nr bi 1
++.Pp
++character device with major number 10
++and minor number 144
++.IP "\fI/proc/cpuinfo\fP"
++.nr bi 1
++.Pp
++to identify New/Old-World machines
++.if \n(ll>1 .RE
++.nr ll -1
++.Pp
++.SH SEE ALSO
++
++.Pp
++macos(8)
++.Pp
++.SH AUTHORS
++
++.Pp
++.DS
++.sp 
++.ft RR
++.nf
++Paul Mackerras <paulus@cs.anu.edu.au> (program)
++.DE
++.fi 
++.ec
++.ft P
++.sp
++
++.DS
++.sp 
++.ft RR
++.nf
++Richard van Hees <R.M.vanHees@phys.uu.nl> (documentation)
++.DE
++.fi 
++.ec
++.ft P
++.sp
++
++.DS
++.sp 
++.ft RR
++.nf
++Klaus Halfmann  <halfmann@libra.de> (NewWorld code)
++.DE
++.fi 
++.ec
++.ft P
++.sp
++.Pp
+diff -Nuar pmac-utils.orig/nvsetenv.c pmac-utils/nvsetenv.c
+--- pmac-utils.orig/nvsetenv.c	1997-04-28 14:29:05.000000000 +0100
++++ pmac-utils/nvsetenv.c	2005-11-17 14:57:57.000000000 +0000
+@@ -1,15 +1,32 @@
++/*	nvsetnv.c
++
++	used to set the Envenrioment variables in power macs NVram.
++	Decides via /proc/cpuinfo which type of machine is used.
++
++		Copyright (C) 1996-1998 by Paul Mackerras.
++	nwcode: Copyright (C) 2000	by Klaus Halfmann
++
++	see README for details
++*/
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <sys/ioctl.h>
++#include <asm/nvram.h>
++#ifndef IOC_NVRAM_SYNC
++#define IOC_NVRAM_SYNC _IO('p', 0x43)
++#endif
+ 
+-#define NVSTART	0x1800
+-#define NVSIZE	0x800
++#define NVSTART		0x1800 	// Start of the NVRam OF partition
++#define NVSIZE		0x800	// Size of of the NVRam
+ #define MXSTRING        128
+ #define N_NVVARS	(int)(sizeof(nvvars) / sizeof(nvvars[0]))
++#define NVMAGIC		0x1275
+ 
+-static int nvfd, nvstr_used;
++static int  nvstr_used;
+ static char nvstrbuf[NVSIZE];
+ 
+ struct nvram {
+@@ -24,12 +41,13 @@
+     unsigned long  vals[1];
+ };
+ 
+-union {
+-    struct nvram nv;
+-    char c[NVSIZE];
+-    unsigned short s[NVSIZE/2];
+-} nvbuf;
++typedef union {
++    struct nvram 	nv;
++    char 		c[NVSIZE];
++    unsigned short 	s[NVSIZE/2];
++} nvbuftype;
+ 
++nvbuftype nvbuf;
+ 
+ enum nvtype {
+     boolean,
+@@ -70,16 +88,21 @@
+     {"boot-command", string},
+ };
+ 
++	// Calculated number of variables
++#define N_NVVARS	(int)(sizeof(nvvars) / sizeof(nvvars[0]))
++
+ union nvval {
+-    unsigned long word_val;
+-    char *str_val;
++    unsigned long 	word_val;
++    char 		*str_val;
+ } nvvals[32];
+ 
+-int
+-nvcsum( void )
++extern int checkNewWorld(void); 		// from nwnvsetenv
++extern int nvNew(int ac, char** av, int nfd); 	// from nwnvsetenv
++
++int nvcsum( void )
+ {
+-    int i;
+-    unsigned c;
++    int 	i;
++    unsigned	c;
+     
+     c = 0;
+     for (i = 0; i < NVSIZE/2; ++i)
+@@ -89,28 +112,29 @@
+     return c & 0xffff;
+ }
+ 
+-void
+-nvload( void )
++static void nvload( int nvfd )
+ {
+     int s;
+ 
+     if (lseek(nvfd, NVSTART, 0) < 0
+ 	|| read(nvfd, &nvbuf, NVSIZE) != NVSIZE) {
+-	perror("Error reading /dev/nvram");
++	perror("Error reading nvram device");
+ 	exit(EXIT_FAILURE);
+     }
++    if (nvbuf.nv.magic != NVMAGIC)
++	(void) fprintf(stderr, "Warning: Bad magic number %x\n",
++			 nvbuf.nv.magic);
+     s = nvcsum();
+     if (s != 0xffff)
+        (void) fprintf(stderr, "Warning: checksum error (%x) on nvram\n", 
+ 		      s ^ 0xffff);
+ }
+ 
+-void
+-nvstore(void)
++static void nvstore(int nvfd)
+ {
+     if (lseek(nvfd, NVSTART, 0) < 0
+ 	|| write(nvfd, &nvbuf, NVSIZE) != NVSIZE) {
+-	perror("Error writing /dev/nvram");
++	perror("Error writing nvram device");
+ 	exit(EXIT_FAILURE);
+     }
+ }
+@@ -145,8 +169,7 @@
+     }
+ }
+ 
+-void
+-nvpack( void )
++void nvpack( void )
+ {
+     int     i, vi;
+     size_t  off, len;
+@@ -184,7 +207,7 @@
+     nvbuf.nv.cksum = (unsigned short int) (~nvcsum());
+ }
+ 
+-void
++static void
+ print_var(int i, int indent)
+ {
+     char *p;
+@@ -207,8 +230,7 @@
+     (void) printf("\n");
+ }
+ 
+-void
+-parse_val(int i, char *str)
++void parse_val(int i, char *str)
+ {
+     char *endp;
+ 
+@@ -238,12 +260,38 @@
+     }
+ }
+ 
+-int 
+-main(int ac, char **av)
++
++void nvOld(int ac, char** av, int i, int nvfd)
++{
++    nvload(nvfd);
++    nvunpack();
++
++    switch (ac) {
++    case 1:
++	for (i = 0; i < N_NVVARS; ++i) {
++	    (void) printf("%-16s", nvvars[i].name);
++	    print_var(i, 16);
++	}
++	break;
++
++    case 2:
++	print_var(i, 0);
++	break;
++	
++    case 3:
++	parse_val(i, av[2]);
++	nvpack();
++	nvstore(nvfd);
++	break;
++    }
++}
++
++int main(int ac, char **av)
+ {
+-    int i = 0, l, print;
++    int i = 0, l, print, nvfd, newWorld;
+ 
+     l = (int) strlen(av[0]);
++    // print when no value is set OR we are aclled as <xxx>printenv
+     print = (int) (ac <= 2 || 
+ 		   (l > 8 && strcmp(&av[0][l-8], "printenv") == 0));
+     if (print != 0 && ac > 2) {
+@@ -255,7 +303,9 @@
+ 	exit(EXIT_FAILURE);
+     }
+ 
+-    if (ac >= 2) {
++    newWorld = checkNewWorld();
++    
++    if (!newWorld && ac >= 2) {
+ 	for (i = 0; i < N_NVVARS; ++i)
+ 	    if (strcmp(av[1], nvvars[i].name) == 0)
+ 		break;
+@@ -266,33 +316,21 @@
+ 	}
+     }
+ 
+-    nvfd = open("/dev/nvram", ac <= 2 ? O_RDONLY: O_RDWR);
++    nvfd = open("/dev/misc/nvram", ac <= 2 ? O_RDONLY: O_RDWR);
+     if (nvfd < 0) {
+-	perror("Couldn't open /dev/nvram");
++      nvfd = open("/dev/nvram", ac <= 2 ? O_RDONLY: O_RDWR);
++      if (nvfd < 0) {
++	perror("Couldn't open nvram device");
+ 	exit(EXIT_FAILURE);
+-    }
+-    nvload();
+-    nvunpack();
+-
+-    switch (ac) {
+-    case 1:
+-	for (i = 0; i < N_NVVARS; ++i) {
+-	    (void) printf("%-16s", nvvars[i].name);
+-	    print_var(i, 16);
+-	}
+-	break;
+-
+-    case 2:
+-	print_var(i, 0);
+-	break;
+-	
+-    case 3:
+-	parse_val(i, av[2]);
+-	nvpack();
+-	nvstore();
+-	break;
++      }
+     }
+ 
++    if (newWorld)
++    	nvNew(ac, av, nvfd);
++    else
++    	nvOld(ac, av, i, nvfd);
++    
++    (void) ioctl(nvfd, IOC_NVRAM_SYNC);
+     (void) close(nvfd);
+     exit(EXIT_SUCCESS);
+ }
+diff -Nuar pmac-utils.orig/nvsetvol.8 pmac-utils/nvsetvol.8
+--- pmac-utils.orig/nvsetvol.8	1970-01-01 01:00:00.000000000 +0100
++++ pmac-utils/nvsetvol.8	2005-11-17 21:37:20.000000000 +0000
+@@ -0,0 +1,27 @@
++.TH NVSETVOL 8 "16th February 2003"
++
++.SH NAME
++nvsetvol \- tool for changing startup volume of PowerMac machines
++
++.SH SYNOPSIS
++.B nvsetvol
++[
++.B volume
++]
++
++.SH DESCRIPTION
++.B nvsetvol
++queries and sets the base volume of a PowerMac machine.  With no options,
++.B nvsetvol
++displays the current volume; with a numerical argument, it sets the volume.
++The
++.B volume
++argument should be a number from 0 to 255.  0 will turn off the annoying
++startup chime.
++
++.SH AUTHOR
++.B nvsetvol
++was written by Matteo Frigo <athena@fftw.org>.
++
++This manual page was written by Daniel Jacobowitz <dan@debian.org> for the
++Debian GNU/Linux distribution.
+diff -Nuar pmac-utils.orig/nvsetvol.c pmac-utils/nvsetvol.c
+--- pmac-utils.orig/nvsetvol.c	1970-01-01 01:00:00.000000000 +0100
++++ pmac-utils/nvsetvol.c	2005-11-17 21:43:16.000000000 +0000
+@@ -0,0 +1,110 @@
++/* set volume of the startup chime in the PowerMac nvram. 
++
++   Written by Matteo Frigo <athena@fftw.org>.
++   $Id: nvsetvol.c,v 1.1 2003/01/11 11:26:30 athena Exp $
++
++   This program is in the public domain.
++*/
++
++/* The volume is stored as a byte at address 8 in the parameter ram. */
++
++#include <string.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <sys/ioctl.h>
++#include <asm/nvram.h>
++#ifndef IOC_NVRAM_SYNC
++#define IOC_NVRAM_SYNC _IO('p', 0x43)
++#endif
++
++typedef struct {
++     unsigned char sig;
++     unsigned char cksum;
++     unsigned short len;
++     char name[12];
++} header;
++
++void die(const char *s) __attribute__((noreturn));
++void die(const char *s)
++{
++     perror(s);
++     exit(1);
++}
++
++void seek_pram(int fd, int offset)
++{
++     if (lseek(fd, offset, SEEK_SET) < 0)
++	  die("lseek");
++}
++
++// MSch: only works for newworld - oldworld have XPRAM at offset 0x1300 fixed. 
++
++int find_pram(int fd, int *size)
++{
++     header buf;
++     int offset = 0;
++     int rc = 0;
++     while((rc = read(fd, &buf, sizeof(header))) == sizeof(header)) {
++	  int sz = buf.len * 16;
++	  // what's the sig in char?
++	  // if (buf.sig == 0x1275) fprintf(stderr, "sig at offset %d rc %d buf.len %d buf.name %s \n", offset, rc, buf.len, buf.name);
++	  // if (buf.sig == 0x5a) fprintf(stderr, "sig at offset %x rc %d buf.len %x buf.name %s \n", offset, rc, buf.len, buf.name);
++	  // if (sz) fprintf(stderr, "offset %x rc %d sig %x buf.len %x buf.name %s \n", offset, rc, buf.sig, buf.len, buf.name);
++	  if (!strncmp(buf.name, "APL,MacOS75", 11)) {
++	       *size = sz - sizeof(header);
++	       // fprintf(stderr, "XPRAM offset %x size %x\n", offset + sizeof(header), *size); 
++	       return offset + sizeof(header);
++	  }
++	  if (sz)
++	    offset += sz;
++          else
++            offset += sizeof(header);
++	  seek_pram(fd, offset);
++     }
++     // no Core99 style PRAM found - just assume hard coded values as set in kernel:
++     // XPRAM 0x1300
++     // NR    0x1400
++     // OF    0x1800
++     // TODO: use ioctl to get PRAM offset
++     // fprintf(stderr, "no NW PRAM found, assuming OW XPRAM offset 0x1300 size 0x100\n");
++     *size = 0x100;
++     return (0x1300);
++     die("no PRAM found");
++}
++
++#define VOLADDR 8
++
++int main(int argc, char *argv[])
++{
++     int fd, offset, size;
++     char *buf;
++
++     fd = open("/dev/nvram", O_RDWR);
++     if (fd < 0) die("can't open /dev/nvram");
++     
++     offset = find_pram(fd, &size);
++     buf = malloc(size);
++     if (!buf) die("can't malloc()");
++
++     seek_pram(fd, offset);
++     if (read(fd, buf, size) != size)
++	  die("error reading /dev/nvram");
++
++     printf("current volume is %d\n", (unsigned char) buf[VOLADDR]);
++     
++     if (argc > 1) {
++	  buf[VOLADDR] = atoi(argv[1]);
++
++	  seek_pram(fd, offset);
++	  if (write(fd, buf, size) != size)
++	       die("error writing /dev/nvram");
++	  printf("new volume is %d\n", (unsigned char) buf[VOLADDR]);
++     }
++     ioctl(fd, IOC_NVRAM_SYNC);
++     close(fd);
++     return 0;
++}
+diff -Nuar pmac-utils.orig/nwnvsetenv.c pmac-utils/nwnvsetenv.c
+--- pmac-utils.orig/nwnvsetenv.c	1970-01-01 01:00:00.000000000 +0100
++++ pmac-utils/nwnvsetenv.c	2005-11-17 21:37:27.000000000 +0000
+@@ -0,0 +1,261 @@
++/*	nwnvsetnv.c
++
++	used to set the Envenrioment variables in power macs NVram.
++	This is for the NewWorld nvram only
++
++	nwcode: Copyright (C) 2000	by Klaus Halfmann
++
++	see README for details
++*/
++#include <stdio.h>
++#include <stdlib.h>
++
++#define __USE_GNU	// need strnlen
++
++#include <string.h>
++#include <unistd.h>
++#include <fcntl.h>
++
++// #define MXSTRING        128:
++// #define N_NVVARS	(int)(sizeof(nvvars) / sizeof(nvvars[0]))
++// #define NVMAGIC		0x1275
++
++/* CHRP NVRAM header */
++typedef struct {
++  unsigned char		signature;
++  unsigned char		cksum;
++  unsigned short	len;
++  char			name[12];
++  // unsigned char data[0];
++} chrp_header;
++
++/* Check in proc/cpuinfo if this is a new world machine */
++
++int checkNewWorld(void)
++{
++    FILE* cpuf = fopen("/proc/cpuinfo","r");
++    char  buf[256]; // "pmac-generation    : NewWolrd|OldWorld 
++    int	  result = 0, found = 0;
++
++    if (!cpuf) {
++	perror("Couldn't open /proc/cpuinfo");
++	exit(EXIT_FAILURE);
++    }
++
++    while (NULL != fgets(buf, 255, cpuf))
++    {
++	if (!strncmp(buf, "pmac-generation" ,15))
++	{
++	    char* index = strchr(buf, ':') + 2;
++	    if (!index) // ???
++		continue;
++	    result = !strncmp(index,"NewWorld",8);
++	    found = 1;
++	    break;
++	}
++    }
++    fclose(cpuf);
++
++    /* Some kernels don't have pmac-generation ( <= 2.2.15 and earlier 2.3.x ) */
++    /* Look for AAPL in /proc/device-tree/compatible instead. */
++    if (!found) {
++	cpuf = fopen("/proc/device-tree/compatible", "r");
++	if(!cpuf)
++	    return 0;
++	
++	fgets(buf, 255, cpuf);
++	fclose(cpuf);
++	if (strncmp(buf, "AAPL", 4) != 0)
++	    result = 1;
++    }
++
++    return result; // assume OldWorld
++}
++
++/* seek NVRAM until common (OF) part 
++   return the lenght of the part in case of sucess,
++   	  0 otherwise.
++   chrph is set to the value of the "coommon" blocek eventually found
++   *nvstart is set to the seekpoint where common block starts.
++*/
++   
++int nvscan(int nvfd, chrp_header* chrph, int* nvstart)
++{
++    int		start = 0;
++    
++    while (read(nvfd, chrph, sizeof(chrp_header)) == sizeof(chrp_header))
++    {
++	int size = chrph->len * 0x10 - sizeof(chrp_header);    	
++	if (!strncmp(chrph->name, "common", 7))
++	{
++	    *nvstart = start;
++	    return size; // seeked upto start
++	}
++	if (lseek(nvfd, size, SEEK_CUR) < 0)
++	   break;
++	start += size + sizeof(chrp_header);
++    }
++    fprintf(stderr,"No common Block found\n");
++    exit(EXIT_FAILURE);
++}
++
++static char* nvload( int nvfd , int nvsize)
++{
++    char* nvbuf = malloc(nvsize);
++
++    if (!nvbuf) {
++	perror("Error allocating buffer");
++	exit(EXIT_FAILURE);
++    }
++    if (read(nvfd, nvbuf, nvsize) != nvsize) {
++	perror("Error reading /dev/nvram");
++	exit(EXIT_FAILURE);
++    }
++    return nvbuf;
++}
++
++static void
++print_vars(char* nvbuf, int nvsize)
++{
++    int i = 0;
++
++    while (i < nvsize)
++    {
++ 	int size = strnlen(nvbuf, nvsize);
++	if (size == 0)
++	    break;
++	printf("%s\n",nvbuf);
++	nvbuf += (size + 1);	// count 0-byte, too
++    }
++}
++
++/* move memory around to insert the value.
++ *
++ * @param nvbufend 	byte AFTER the end of the buffer
++ * @param varsize 	length of the variable name
++ * @param buf		byte where varaible NAME starts
++ * @param newval	new value to replace old one
++ * @param foundsize 	lenght of varible + '=' + value
++ * @param equalpos 	position relative to buf where '=' was found
++ */
++static void 
++insert_val (char* nvbufend, int varsize,   char* buf, 
++	    char* newval,   int foundsize, int equalpos)
++{
++    int 	oldlen 	= foundsize - equalpos -1; // account for the '='
++    int		newlen 	= strlen(newval);
++    char* 	valpos 	= buf + varsize + 1;
++    int 	delta 	= newlen - oldlen;
++
++    if (delta > 0) // expand mem
++	memmove(valpos + newlen,
++		valpos + oldlen, (nvbufend - valpos - newlen));
++    else if (delta < 0) // shrink mem
++    {
++	memmove(valpos + newlen, 
++		valpos + oldlen, (nvbufend - valpos - oldlen));
++	memset (nvbufend + delta, 0, -delta );
++    }
++    strncpy(valpos, newval, newlen);
++}
++
++/* return position where variable is found,
++ * newval may be null.
++ */
++
++static char* set_var(char* nvbuf, int nvsize, char* varname, char* newval)
++{
++    int i =0;
++    int varsize = strlen(varname);
++    int equalpos;
++    while (i < nvsize)
++    {
++	char* buf = &nvbuf[i];
++ 	int foundsize = strnlen(buf, nvsize -i);
++	if (foundsize == 0)
++	    break;
++	equalpos = (int) (strchr(buf, '=') - buf);
++	if (equalpos == varsize &&
++	    !strncmp(buf, varname, equalpos))
++	{
++	    if (newval)	// set the value 
++		insert_val(nvbuf + nvsize, varsize, buf, 
++			   newval, foundsize, equalpos);
++	    return buf;
++	}
++	i += foundsize + 1;	// count 0-byte, too
++    }
++    return NULL;
++}
++
++static void
++print_var(char* nvbuf, int nvsize, char* varname)
++{
++    char* buf = set_var(nvbuf, nvsize, varname, NULL);
++    if (buf)
++	printf("%s\n",buf);
++}
++
++/* This fucntion is not used here, it is left
++   her for the curious */
++
++unsigned short chrp_checksum(chrp_header* hdr, char* nvbuf, int nvsize)
++{
++    unsigned char* 	ptr = (unsigned char*) &hdr->len;
++    unsigned char* 	end = ptr + sizeof(chrp_header);
++    unsigned short 	sum = hdr->signature;
++	// this in fact skips the checksum
++    for (; ptr < end; ptr++)
++	sum += *ptr;
++    while (sum > 0xFF)
++	sum = (sum & 0xFF) + (sum>>8);
++    return sum;
++}                                                                                                 
++
++static void
++nvstore(int nvfd, chrp_header* chrph, char* nvbuf, int nvstart, int nvsize)
++{
++    // mmh, the checksum is calculated for the header only
++    // since we did not modify the header we can just ignore it.
++    ssize_t written;
++    ssize_t seek =  nvstart + sizeof(chrp_header);
++    written = lseek(nvfd, seek, SEEK_SET);
++    if (written != seek)
++    {
++    	fprintf(stderr,"Error seeking /dev/nvram\n");
++	exit(EXIT_FAILURE);
++    }
++    written = write(nvfd, nvbuf, nvsize);
++    if (written != nvsize)
++    {
++    	fprintf(stderr,"Error writing /dev/nvram %x %x\n", nvsize, seek);
++	exit(EXIT_FAILURE);
++    }
++}
++
++/* print / set the New World NVRAM */
++
++void nvNew(int ac, char** av, int nvfd)
++{
++    int 		nvsize, nvstart;
++    chrp_header		chrph;
++    char*		nvbuf;
++
++    nvsize = nvscan(nvfd, &chrph, &nvstart);
++    nvbuf  = nvload(nvfd, nvsize);
++
++    switch (ac) {
++    case 1:
++	print_vars(nvbuf, nvsize);
++	break;
++
++    case 2:
++	print_var(nvbuf, nvsize, av[1]);
++	break;
++	
++    case 3:
++	set_var(nvbuf, nvsize, av[1], av[2]);
++	nvstore(nvfd, &chrph, nvbuf, nvstart, nvsize);
++	break;
++    }
++}
Index: patches/readline-5.1-fixes-3.patch
===================================================================
--- patches/readline-5.1-fixes-3.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/readline-5.1-fixes-3.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,128 @@
+Submitted By: Matthew Burgess (matthew at linuxfromscratch dot org)
+Date: 2006-03-17
+Initial Package Version: 5.1
+Origin: http://ftp.gnu.org/gnu/readline/readline-5.1-patches/
+Upstream Status: From Upstream 
+Description: Contains Patch 001-004 from Upstream
+
+diff -Naur readline-5.1.orig/display.c readline-5.1/display.c
+--- readline-5.1.orig/display.c	2005-11-30 19:05:02.000000000 +0000
++++ readline-5.1/display.c	2006-03-17 16:03:09.000000000 +0000
+@@ -1983,11 +1983,15 @@
+      int pchar;
+ {
+   int len;
+-  char *pmt;
++  char *pmt, *p;
+ 
+   rl_save_prompt ();
+ 
+-  if (saved_local_prompt == 0)
++  /* We've saved the prompt, and can do anything with the various prompt
++     strings we need before they're restored.  We want the unexpanded
++     portion of the prompt string after any final newline. */
++  p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
++  if (p == 0)
+     {
+       len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
+       pmt = (char *)xmalloc (len + 2);
+@@ -1998,19 +2002,17 @@
+     }
+   else
+     {
+-      len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
++      p++;
++      len = strlen (p);
+       pmt = (char *)xmalloc (len + 2);
+       if (len)
+-	strcpy (pmt, saved_local_prompt);
++	strcpy (pmt, p);
+       pmt[len] = pchar;
+       pmt[len+1] = '\0';
+-      local_prompt = savestring (pmt);
+-      prompt_last_invisible = saved_last_invisible;
+-      prompt_visible_length = saved_visible_length + 1;
+-    }
++    }  
+ 
++  /* will be overwritten by expand_prompt, called from rl_message */
+   prompt_physical_chars = saved_physical_chars + 1;
+-
+   return pmt;
+ }
+ 
+diff -Naur readline-5.1.orig/readline.c readline-5.1/readline.c
+--- readline-5.1.orig/readline.c	2005-07-05 02:29:35.000000000 +0000
++++ readline-5.1/readline.c	2006-03-17 16:03:05.000000000 +0000
+@@ -282,6 +282,7 @@
+ {
+   FREE (rl_prompt);
+   rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
++  rl_display_prompt = rl_prompt ? rl_prompt : "";
+ 
+   rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
+   return 0;
+@@ -714,7 +715,7 @@
+ 
+ 	  rl_dispatching = 1;
+ 	  RL_SETSTATE(RL_STATE_DISPATCHING);
+-	  r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
++	  (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
+ 	  RL_UNSETSTATE(RL_STATE_DISPATCHING);
+ 	  rl_dispatching = 0;
+ 
+diff -Naur readline-5.1.orig/terminal.c readline-5.1/terminal.c
+--- readline-5.1.orig/terminal.c	2005-11-13 01:46:54.000000000 +0000
++++ readline-5.1/terminal.c	2006-03-17 16:03:02.000000000 +0000
+@@ -122,7 +122,7 @@
+ static char *_rl_visible_bell;
+ 
+ /* Non-zero means the terminal can auto-wrap lines. */
+-int _rl_term_autowrap;
++int _rl_term_autowrap = -1;
+ 
+ /* Non-zero means that this terminal has a meta key. */
+ static int term_has_meta;
+@@ -274,6 +274,9 @@
+ _rl_set_screen_size (rows, cols)
+      int rows, cols;
+ {
++  if (_rl_term_autowrap == -1)
++    _rl_init_terminal_io (rl_terminal_name);
++
+   if (rows > 0)
+     _rl_screenheight = rows;
+   if (cols > 0)
+diff -Naur readline-5.1.orig/text.c readline-5.1/text.c
+--- readline-5.1.orig/text.c	2005-09-24 23:06:07.000000000 +0000
++++ readline-5.1/text.c	2006-03-17 16:02:58.000000000 +0000
+@@ -1071,8 +1071,6 @@
+ rl_delete (count, key)
+      int count, key;
+ {
+-  int r;
+-
+   if (count < 0)
+     return (_rl_rubout_char (-count, key));
+ 
+@@ -1090,17 +1088,17 @@
+       else
+ 	rl_forward_byte (count, key);
+ 
+-      r = rl_kill_text (orig_point, rl_point);
++      rl_kill_text (orig_point, rl_point);
+       rl_point = orig_point;
+-      return r;
+     }
+   else
+     {
+       int new_point;
+ 
+       new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
+-      return (rl_delete_text (rl_point, new_point));
++      rl_delete_text (rl_point, new_point);
+     }
++  return 0;
+ }
+ 
+ /* Delete the character under the cursor, unless the insertion
Index: patches/silo-1.4.11-fixes-1.patch
===================================================================
--- patches/silo-1.4.11-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/silo-1.4.11-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,24397 @@
+Submitted By: Joe Ciccone <joeciccone at crazyeyesoft dot com>
+Date: 2006-02-09
+Initial Package Version: 1.4.11
+Upstream Status: Unknown
+Origin: Rocklinux and Jim Gifford and Joe Ciccone
+Description: Fixes cross-compilation issues and silo no longer links to
+	libext2fs.so, it is integrated instead. Also allows silo to build
+        and work properly on pure64 systems.
+
+diff -Naur silo-1.4.11.orig/Makefile silo-1.4.11/Makefile
+--- silo-1.4.11.orig/Makefile	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/Makefile	2006-03-09 21:34:56 +0000
+@@ -3,7 +3,7 @@
+ 
+ # These only get built on Linux
+ ifeq ($(OPSYS),Linux)
+-  SUBDIRS  = common first second first-isofs tilo
++  SUBDIRS  = common first libext2fs second first-isofs tilo
+   MANPAGES = maketilo.1 tilo.1
+ endif
+ 
+diff -Naur silo-1.4.11.orig/Rules.make silo-1.4.11/Rules.make
+--- silo-1.4.11.orig/Rules.make	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/Rules.make	2006-03-09 21:48:42 +0000
+@@ -1,12 +1,14 @@
+ VERSION=1.4.11
+ IMGVERSION=0.99
+ RM=rm -f
+-# We want to force 32-bit builds
+-CC=gcc -m32
+-LD=ld -m elf32_sparc
+-AS=as
+-STRIP=strip
+-NM=nm
++CC=$(CROSS_COMPILE)gcc
++CC-SILO=$(CC) -m32 -Wa,-32 -I../include/emul_32
++BUILD_CC=gcc
++LD=$(CROSS_COMPILE)ld -m elf32_sparc
++AS=$(CROSS_COMPILE)as
++STRIP=$(CROSS_COMPILE)strip
++NM=$(CROSS_COMPILE)nm
++
+ ELFTOAOUT=elftoaout
+ BIN2H=../common/bin2h
+ 
+diff -Naur silo-1.4.11.orig/common/Makefile silo-1.4.11/common/Makefile
+--- silo-1.4.11.orig/common/Makefile	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/common/Makefile	2006-03-09 21:34:56 +0000
+@@ -5,19 +5,22 @@
+ include ../Rules.make
+ 
+ .c.o:
+-	$(CC) $(CFLAGS) -c $*.c
++	$(CC-SILO) $(CFLAGS) -c $*.c
+ 
+ .S.o:
+-	$(CC) $(CFLAGS) -c $*.S
++	$(CC-SILO) $(CFLAGS) -c $*.S
+ 
+ OBJS = sdiv.o rem.o udiv.o urem.o jmp.o printf.o console.o prom.o tree.o stringops2.o\
+ 	stringops1.o ffs.o divdi3.o udivdi3.o
+-PROGRAMS = bin2h
+ 
+-all: $(OBJS) $(PROGRAMS)
++bin2h:
++	$(BUILD_CC) $(CFLAGS) -o bin2h bin2h.c
++
++all: $(OBJS) bin2h
+ 
+ prom.o: prom.c
+-	$(CC) $(CFLAGS) -c -Wa,-Av9 -o prom.o prom.c
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9 -o prom.o prom.c
+ 
+ clean:
+-	$(RM) $(PROGRAMS) *.o
++	$(RM) bin2h *.o
++
+diff -Naur silo-1.4.11.orig/first/Makefile silo-1.4.11/first/Makefile
+--- silo-1.4.11.orig/first/Makefile	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/first/Makefile	2006-03-09 21:34:56 +0000
+@@ -13,7 +13,7 @@
+ LDFLAGS=-N -Ttext 0x4000
+ 
+ .S.o:
+-	$(CC) $(CFLAGS) -c $*.S
++	$(CC-SILO) $(CFLAGS) -c $*.S
+ 
+ all: first.b first.h ultra.b ultra.h generic.b generic.h fd.b ieee32.b
+ 
+@@ -33,7 +33,7 @@
+ 	sed -n 's/^\(000000000000\|0000\)4\([0-9a-f][0-9a-f][0-9a-f]\) .*letter_here.*$$/#define FD_LETTER_OFFSET_TMP 0x\2/p' < fd.map >> fd.h
+ 
+ first.o: first.S
+-	$(CC) $(CFLAGS) -c first.S -o first.o
++	$(CC-SILO) $(CFLAGS) -c first.S -o first.o
+ 
+ first: first.o
+ 	$(LD) $(LDFLAGS) -o first first.o
+@@ -46,7 +46,7 @@
+ 	$(DD) if=/dev/zero of=first.b bs=4 count=1 seek=127
+ 
+ ultra.o: ultra.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9a ultra.S
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9a ultra.S
+ 
+ ultra: ultra.o
+ 	$(LD) $(LDFLAGS) -o ultra ultra.o
+@@ -60,7 +60,7 @@
+ 	$(DD) if=/dev/zero of=ultra.b bs=4 count=1 seek=127
+ 
+ generic.o: generic.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9a generic.S
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9a generic.S
+ 
+ generic: generic.o
+ 	$(LD) $(LDFLAGS) -o generic generic.o
+@@ -74,7 +74,7 @@
+ 	$(DD) if=/dev/zero of=generic.b bs=4 count=1 seek=255
+ 
+ fd.o: fd.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9a fd.S
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9a fd.S
+ 
+ fd: fd.o
+ 	$(LD) $(LDFLAGS) -o fd fd.o
+@@ -88,7 +88,7 @@
+ 	$(DD) if=/dev/zero of=fd.b bs=4 count=1 seek=255
+ 
+ ieee32.o: ieee32.S ieee32.h
+-	$(CC) $(CFLAGS) -DIMGVERSION='"SILO$(IMGVERSION)"' -c ieee32.S
++	$(CC-SILO) $(CFLAGS) -DIMGVERSION='"SILO$(IMGVERSION)"' -c ieee32.S
+ 
+ ieee32.b: ieee32.o
+ 	$(LD) $(LDFLAGS) -o ieee32.b ieee32.o
+diff -Naur silo-1.4.11.orig/first-isofs/Makefile silo-1.4.11/first-isofs/Makefile
+--- silo-1.4.11.orig/first-isofs/Makefile	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/first-isofs/Makefile	2006-03-09 21:34:56 +0000
+@@ -11,10 +11,10 @@
+ all: $(NAME).b
+ 
+ .c.o:
+-	$(CC) $(CFLAGS) -c $*.c
++	$(CC-SILO) $(CFLAGS) -c $*.c
+ 
+ .S.o:
+-	$(CC) $(CFLAGS) -c $*.S
++	$(CC-SILO) $(CFLAGS) -c $*.S
+ 
+ OBJS_COMMON = ../common/prom.o ../common/console.o ../common/tree.o
+ OBJS = crt0.o $(NAME).o $(OBJS_COMMON)
+@@ -28,7 +28,7 @@
+ 	cat $<.aout >> $@
+ 
+ crt0.o:	crt0.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9 -o $@ $<
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9 -o $@ $<
+ 
+ clean:
+ 	$(RM) *.o $(NAME) $(NAME).b $(NAME).aout
+diff -Naur silo-1.4.11.orig/include/emul_32/asm/elf.h silo-1.4.11/include/emul_32/asm/elf.h
+--- silo-1.4.11.orig/include/emul_32/asm/elf.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/include/emul_32/asm/elf.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,162 @@
++#ifndef __ASMSPARC_ELF_H
++#define __ASMSPARC_ELF_H
++
++/*
++ * ELF register definitions..
++ */
++
++
++/*
++ * Sparc section types
++ */
++#define STT_REGISTER		13
++
++/*
++ * Sparc ELF relocation types
++ */
++#define	R_SPARC_NONE		0
++#define	R_SPARC_8		1
++#define	R_SPARC_16		2
++#define	R_SPARC_32		3
++#define	R_SPARC_DISP8		4
++#define	R_SPARC_DISP16		5
++#define	R_SPARC_DISP32		6
++#define	R_SPARC_WDISP30		7
++#define	R_SPARC_WDISP22		8
++#define	R_SPARC_HI22		9
++#define	R_SPARC_22		10
++#define	R_SPARC_13		11
++#define	R_SPARC_LO10		12
++#define	R_SPARC_GOT10		13
++#define	R_SPARC_GOT13		14
++#define	R_SPARC_GOT22		15
++#define	R_SPARC_PC10		16
++#define	R_SPARC_PC22		17
++#define	R_SPARC_WPLT30		18
++#define	R_SPARC_COPY		19
++#define	R_SPARC_GLOB_DAT	20
++#define	R_SPARC_JMP_SLOT	21
++#define	R_SPARC_RELATIVE	22
++#define	R_SPARC_UA32		23
++#define R_SPARC_PLT32		24
++#define R_SPARC_HIPLT22		25
++#define R_SPARC_LOPLT10		26
++#define R_SPARC_PCPLT32		27
++#define R_SPARC_PCPLT22		28
++#define R_SPARC_PCPLT10		29
++#define R_SPARC_10		30
++#define R_SPARC_11		31
++#define R_SPARC_64		32
++#define R_SPARC_OLO10		33
++#define R_SPARC_WDISP16		40
++#define R_SPARC_WDISP19		41
++#define R_SPARC_7		43
++#define R_SPARC_5		44
++#define R_SPARC_6		45
++
++/* Bits present in AT_HWCAP, primarily for Sparc32.  */
++
++#define HWCAP_SPARC_FLUSH       1    /* CPU supports flush instruction. */
++#define HWCAP_SPARC_STBAR       2
++#define HWCAP_SPARC_SWAP        4
++#define HWCAP_SPARC_MULDIV      8
++#define HWCAP_SPARC_V9		16
++#define HWCAP_SPARC_ULTRA3	32
++
++/* For the most part we present code dumps in the format
++ * Solaris does.
++ */
++typedef unsigned long elf_greg_t;
++#define ELF_NGREG 38
++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
++
++/* Format is:
++ * 	G0 --> G7
++ *	O0 --> O7
++ *	L0 --> L7
++ *	I0 --> I7
++ *	PSR, PC, nPC, Y, WIM, TBR
++ */
++#define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs)	\
++do {	unsigned long *dest = &(__elf_regs[0]);		\
++	struct pt_regs *src = (__pt_regs);		\
++	unsigned long *sp;				\
++	memcpy(&dest[0], &src->u_regs[0],		\
++	       sizeof(unsigned long) * 16);		\
++	/* Don't try this at home kids... */		\
++	sp = (unsigned long *) src->u_regs[14];		\
++	copy_from_user(&dest[16], sp,			\
++		       sizeof(unsigned long) * 16);	\
++	dest[32] = src->psr;				\
++	dest[33] = src->pc;				\
++	dest[34] = src->npc;				\
++	dest[35] = src->y;				\
++	dest[36] = dest[37] = 0; /* XXX */		\
++} while(0); /* Janitors: Don't touch this colon. */
++
++typedef struct {
++	union {
++		unsigned long	pr_regs[32];
++		double		pr_dregs[16];
++	} pr_fr;
++	unsigned long __unused;
++	unsigned long	pr_fsr;
++	unsigned char	pr_qcnt;
++	unsigned char	pr_q_entrysize;
++	unsigned char	pr_en;
++	unsigned int	pr_q[64];
++} elf_fpregset_t;
++
++#define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs)	\
++	({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread.kregs); 1; })
++
++/*
++ * This is used to ensure we don't load something for the wrong architecture.
++ */
++#define elf_check_arch(x) ((x)->e_machine == EM_SPARC)
++
++/*
++ * These are used to set parameters in the core dumps.
++ */
++#define ELF_ARCH	EM_SPARC
++#define ELF_CLASS	ELFCLASS32
++#define ELF_DATA	ELFDATA2MSB
++
++#define USE_ELF_CORE_DUMP
++#ifndef CONFIG_SUN4
++#define ELF_EXEC_PAGESIZE	4096
++#else
++#define ELF_EXEC_PAGESIZE	8192
++#endif
++
++
++/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
++   use of this is to invoke "./ld.so someprog" to test out a new version of
++   the loader.  We need to make sure that it is out of the way of the program
++   that it will "exec", and that there is sufficient room for the brk.  */
++
++#define ELF_ET_DYN_BASE         (TASK_UNMAPPED_BASE)
++
++/* This yields a mask that user programs can use to figure out what
++   instruction set this cpu supports.  This can NOT be done in userspace
++   on Sparc.  */
++
++/* Sun4c has none of the capabilities, most sun4m's have them all.
++ * XXX This is gross, set some global variable at boot time. -DaveM
++ */
++#define ELF_HWCAP	((ARCH_SUN4C_SUN4) ? 0 : \
++			 (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
++			  HWCAP_SPARC_SWAP | \
++			  ((srmmu_modtype != Cypress && \
++			    srmmu_modtype != Cypress_vE && \
++			    srmmu_modtype != Cypress_vD) ? \
++			   HWCAP_SPARC_MULDIV : 0)))
++
++/* This yields a string that ld.so will use to load implementation
++   specific libraries for optimization.  This is more specific in
++   intent than poking at uname or /proc/cpuinfo. */
++
++#define ELF_PLATFORM	(NULL)
++
++
++#endif /* !(__ASMSPARC_ELF_H) */
+diff -Naur silo-1.4.11.orig/include/emul_32/asm/posix_types.h silo-1.4.11/include/emul_32/asm/posix_types.h
+--- silo-1.4.11.orig/include/emul_32/asm/posix_types.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/include/emul_32/asm/posix_types.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,122 @@
++#ifndef __ARCH_SPARC_POSIX_TYPES_H
++#define __ARCH_SPARC_POSIX_TYPES_H
++
++/*
++ * This file is generally used by user-level software, so you need to
++ * be a little careful about namespace pollution etc.  Also, we cannot
++ * assume GCC is being used.
++ */
++
++typedef unsigned int           __kernel_size_t;
++typedef int                    __kernel_ssize_t;
++typedef long int               __kernel_ptrdiff_t;
++typedef long                   __kernel_time_t;
++typedef long		       __kernel_suseconds_t;
++typedef long                   __kernel_clock_t;
++typedef int                    __kernel_pid_t;
++typedef unsigned short         __kernel_ipc_pid_t;
++typedef unsigned short         __kernel_uid_t;
++typedef unsigned short         __kernel_gid_t;
++typedef unsigned long          __kernel_ino_t;
++typedef unsigned short         __kernel_mode_t;
++typedef unsigned short         __kernel_umode_t;
++typedef short                  __kernel_nlink_t;
++typedef long                   __kernel_daddr_t;
++typedef long                   __kernel_off_t;
++typedef char *                 __kernel_caddr_t;
++typedef unsigned short	       __kernel_uid16_t;
++typedef unsigned short	       __kernel_gid16_t;
++typedef unsigned int	       __kernel_uid32_t;
++typedef unsigned int	       __kernel_gid32_t;
++typedef unsigned short	       __kernel_old_uid_t;
++typedef unsigned short	       __kernel_old_gid_t;
++typedef unsigned short	       __kernel_old_dev_t;
++typedef int                    __kernel_clockid_t;
++typedef int                    __kernel_timer_t;
++
++#if (defined(__GNUC__) && !defined(__STRICT_ANSI__)) || (__STDC_VERSION__ >= 199901L)
++typedef long long	__kernel_loff_t;
++#endif
++
++typedef struct {
++#if defined(__KERNEL__) || defined(__USE_ALL)
++	int	val[2];
++#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
++	int     __val[2];
++#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
++} __kernel_fsid_t;
++
++#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
++
++#undef __FD_SET
++static __inline__ void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
++{
++	unsigned long _tmp = fd / __NFDBITS;
++	unsigned long _rem = fd % __NFDBITS;
++	fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
++}
++
++#undef __FD_CLR
++static __inline__ void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
++{
++	unsigned long _tmp = fd / __NFDBITS;
++	unsigned long _rem = fd % __NFDBITS;
++	fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
++}
++
++#undef __FD_ISSET
++static __inline__ int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
++{ 
++	unsigned long _tmp = fd / __NFDBITS;
++	unsigned long _rem = fd % __NFDBITS;
++	return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
++}
++
++/*
++ * This will unroll the loop for the normal constant cases (8 or 32 longs,
++ * for 256 and 1024-bit fd_sets respectively)
++ */
++#undef __FD_ZERO
++static __inline__ void __FD_ZERO(__kernel_fd_set *p)
++{
++	unsigned long *tmp = p->fds_bits;
++	int i;
++
++	if (__builtin_constant_p(__FDSET_LONGS)) {
++		switch (__FDSET_LONGS) {
++			case 32:
++			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
++			  tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
++			  tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
++			  tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
++			  tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
++			  tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
++			  tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
++			  tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
++			  return;
++			case 16:
++			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
++			  tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
++			  tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
++			  tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
++			  return;
++			case 8:
++			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
++			  tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
++			  return;
++			case 4:
++			  tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
++			  return;
++		}
++	}
++	i = __FDSET_LONGS;
++	while (i) {
++		i--;
++		*tmp = 0;
++		tmp++;
++	}
++}
++
++#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
++
++#endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */
+diff -Naur silo-1.4.11.orig/include/emul_32/asm/types.h silo-1.4.11/include/emul_32/asm/types.h
+--- silo-1.4.11.orig/include/emul_32/asm/types.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/include/emul_32/asm/types.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,41 @@
++#ifndef _SPARC_TYPES_H
++#define _SPARC_TYPES_H
++
++/*
++ * _xx is ok: it doesn't pollute the POSIX namespace. Use these in the
++ * header files exported to user space.
++ */
++
++/*
++ * This file is never included by application software unless
++ * explicitly requested (e.g., via linux/types.h) in which case the
++ * application is Linux specific so (user-) name space pollution is
++ * not a major issue.  However, for interoperability, libraries still
++ * need to be careful to avoid a name clashes.
++ */
++
++#ifndef __ASSEMBLY__
++
++typedef unsigned short umode_t;
++
++typedef __signed__ char __s8;
++typedef unsigned char __u8;
++
++typedef __signed__ short __s16;
++typedef unsigned short __u16;
++
++typedef __signed__ int __s32;
++typedef unsigned int __u32;
++
++#if (defined(__GNUC__) && !defined(__STRICT_ANSI__)) || (__STDC_VERSION__ >= 199901L)
++typedef __signed__ long long __s64;
++typedef unsigned long long __u64;
++#endif
++
++#if (defined(__STRICT_ANSI__) && !defined(inline))
++#define inline __inline__
++#endif
++
++#endif /* __ASSEMBLY__ */
++
++#endif /* defined(_SPARC_TYPES_H) */
+diff -Naur silo-1.4.11.orig/include/ext2fs/ext2_err.h silo-1.4.11/include/ext2fs/ext2_err.h
+--- silo-1.4.11.orig/include/ext2fs/ext2_err.h	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/include/ext2fs/ext2_err.h	2006-03-09 21:34:56 +0000
+@@ -3,6 +3,8 @@
+  * This file is automatically generated; please do not edit it.
+  */
+ 
++#include <et/com_err.h>
++
+ #define EXT2_ET_BASE                             (2133571328L)
+ #define EXT2_ET_MAGIC_EXT2FS_FILSYS              (2133571329L)
+ #define EXT2_ET_MAGIC_BADBLOCKS_LIST             (2133571330L)
+@@ -19,8 +21,8 @@
+ #define EXT2_ET_MAGIC_ICOUNT                     (2133571341L)
+ #define EXT2_ET_MAGIC_PQ_IO_CHANNEL              (2133571342L)
+ #define EXT2_ET_MAGIC_EXT2_FILE                  (2133571343L)
+-#define EXT2_ET_MAGIC_RESERVED_7                 (2133571344L)
+-#define EXT2_ET_MAGIC_RESERVED_8                 (2133571345L)
++#define EXT2_ET_MAGIC_E2IMAGE                    (2133571344L)
++#define EXT2_ET_MAGIC_INODE_IO_CHANNEL           (2133571345L)
+ #define EXT2_ET_MAGIC_RESERVED_9                 (2133571346L)
+ #define EXT2_ET_BAD_MAGIC                        (2133571347L)
+ #define EXT2_ET_REV_TOO_HIGH                     (2133571348L)
+@@ -86,7 +88,25 @@
+ #define EXT2_ET_UNIMPLEMENTED                    (2133571408L)
+ #define EXT2_ET_CANCEL_REQUESTED                 (2133571409L)
+ #define EXT2_ET_FILE_TOO_BIG                     (2133571410L)
++#define EXT2_ET_JOURNAL_NOT_BLOCK                (2133571411L)
++#define EXT2_ET_NO_JOURNAL_SB                    (2133571412L)
++#define EXT2_ET_JOURNAL_TOO_SMALL                (2133571413L)
++#define EXT2_ET_JOURNAL_UNSUPP_VERSION           (2133571414L)
++#define EXT2_ET_LOAD_EXT_JOURNAL                 (2133571415L)
++#define EXT2_ET_NO_JOURNAL                       (2133571416L)
++#define EXT2_ET_DIRHASH_UNSUPP                   (2133571417L)
++#define EXT2_ET_BAD_EA_BLOCK_NUM                 (2133571418L)
++#define EXT2_ET_TOO_MANY_INODES                  (2133571419L)
++#define EXT2_ET_NOT_IMAGE_FILE                   (2133571420L)
++#define EXT2_ET_RES_GDT_BLOCKS                   (2133571421L)
++#define EXT2_ET_RESIZE_INODE_CORRUPT             (2133571422L)
++#define EXT2_ET_SET_BMAP_NO_IND                  (2133571423L)
++extern const struct error_table et_ext2_error_table;
+ extern void initialize_ext2_error_table(void);
++
++/* For compatibility with Heimdal */
++extern void initialize_ext2_error_table_r(struct et_list **list);
++
+ #define ERROR_TABLE_BASE_ext2 (2133571328L)
+ 
+ /* for compatibility with older versions... */
+diff -Naur silo-1.4.11.orig/include/ext2fs/ext2_io.h silo-1.4.11/include/ext2fs/ext2_io.h
+--- silo-1.4.11.orig/include/ext2fs/ext2_io.h	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/include/ext2fs/ext2_io.h	2006-03-09 21:34:56 +0000
+@@ -27,6 +27,8 @@
+ typedef struct struct_io_manager *io_manager;
+ typedef struct struct_io_channel *io_channel;
+ 
++#define CHANNEL_FLAGS_WRITETHROUGH	0x01
++
+ struct struct_io_channel {
+ 	errcode_t	magic;
+ 	io_manager	manager;
+@@ -47,7 +49,8 @@
+ 				       int actual_bytes_written,
+ 				       errcode_t error);
+ 	int		refcount;
+-	int		reserved[15];
++	int		flags;
++	int		reserved[14];
+ 	void		*private_data;
+ 	void		*app_data;
+ };
+@@ -63,7 +66,11 @@
+ 	errcode_t (*write_blk)(io_channel channel, unsigned long block,
+ 			       int count, const void *data);
+ 	errcode_t (*flush)(io_channel channel);
+-	int		reserved[16];
++	errcode_t (*write_byte)(io_channel channel, unsigned long offset,
++				int count, const void *data);
++	errcode_t (*set_option)(io_channel channel, const char *option, 
++				const char *arg);
++	int		reserved[14];
+ };
+ 
+ #define IO_FLAG_RW	1
+@@ -78,6 +85,13 @@
+ #define io_channel_flush(c) 		((c)->manager->flush((c)))
+ #define io_channel_bumpcount(c)		((c)->refcount++)
+ 	
++/* io_manager.c */
++extern errcode_t io_channel_set_options(io_channel channel, 
++					const char *options);
++extern errcode_t io_channel_write_byte(io_channel channel, 
++				       unsigned long offset,
++				       int count, const void *data);
++
+ /* unix_io.c */
+ extern io_manager unix_io_manager;
+ 
+diff -Naur silo-1.4.11.orig/libext2fs/ChangeLog silo-1.4.11/libext2fs/ChangeLog
+--- silo-1.4.11.orig/libext2fs/ChangeLog	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ChangeLog	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,3311 @@
++2006-06-30  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.38
++
++2005-06-30  Theodore Ts'o  <tytso@mit.edu>
++
++	* bitops.h, bitops.c (ext2fs_set_bit, ext2fs_clear_bit,
++		ext2fs_test_bit): Change these function prototypes to be
++		unsigned int's.  Negative bit numbers were never allowed
++		(and never made any sense), so this should be a safe
++		change.  This is needed to allow safe use of block numbers
++		greater than or equal to 2**31.
++
++2005-06-27  Stephen Tweedie  <sct@redhat.com>
++
++	* ext2fs.h (ext2fs_resize_mem): Fix C99 strict type aliasing
++		problems.  Addresses Red Hat Bugzilla #161183.
++
++2005-06-19  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsectsize.c (BLKSSZGET): Clean up test for when to manually
++		define the BLKSSZGET ioctl.
++
++2005-05-29  Theodore Ts'o  <tytso@mit.edu>
++
++	* ismounted.c (ext2fs_check_mount_point): Add test to see if the
++		device appears to be busy; this only works on Linux 2.6+
++		systems, but provides some additional bullet-proofing in
++		those cases.
++
++2005-05-08  Theodore Ts'o  <tytso@mit.edu>
++
++	* test_io.c (safe_getenv): Fix bug so it would fetch the right
++		environment variable.
++
++2005-04-09  Theodore Ts'o  <tytso@mit.edu>
++
++	* inode.c (ext2fs_write_new_inode), 
++		ind_block.c (ext2fs_read_ind_block): Add missing return
++		value in error return case.  (Otherwise we return garbage
++		instead of the error code.)
++
++2005-03-31  Theodore Ts'o  <tytso@mit.edu>
++
++	* test_io.c (test_open): If called by a setuid/setgid or an
++		otherwise privileged program, be paranoid and ignore the
++		TEST_IO_* environment variables.
++
++2005-03-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.37
++
++2005-03-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_ext_attr.h (EXT2_XATTR_LEN, EXT2_XATTR_SIZE): Add new
++		convenience cpp macros.
++
++2005-03-20  Theodore Ts'o  <tytso@mit.edu>
++
++	* mkdir.c (ext2fs_mkdir): Call ext2fs_write_new_inode() instead of
++		ext2fs_write_inode().
++
++	* inode.c (ext2fs_write_new_inode): New function which should be
++		used when the caller is writing an inode for the first
++		time.  It makes sure that the extra portion of the large
++		inode is initialized properly.
++
++2005-03-18  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Fix clean target to remove tst_getsectsize.
++
++	* getsize.c (ext2fs_get_device_size): Check to see if the number
++		of blocks is greater than 2**32 when we are doing a binary
++		search to determine the device size.  Thanks to Stephen
++		Tweedie for the patch.
++	
++2006-02-05  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.36
++
++2005-02-05  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Remove ext2fs.pc on a "make distclean"
++
++2005-02-04  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in (clean): Remove tst_getsize when doing a make clean
++
++2005-02-03  Theodore Ts'o  <tytso@mit.edu>
++
++	* bitops.c: Make the generic functions more efficient.
++
++	* bitops.h: Drop SPARC assembly code. It's less efficient than GCC
++		3.4 compiled code and also triggers nasty compiler
++		warnings on sparc64.  Thanks to Matthias Andree for his
++		analysis and suggestion.
++	
++2005-01-27  Theodore Ts'o  <tytso@mit.edu>
++
++	* res_gdt.c (ext2fs_create_resize_inode): Create the resize inode
++		even if s_reserved_gdt_blocks is zero.
++
++2005-01-26  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2fs.pc.in: Add pkg-config files.
++
++2005-01-25  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2fs.h: Add definition of struct ext2_inode_large
++
++	* ext2_fs.h: Add new function prototypes
++
++	* ext_attr.c (ext2fs_read_ext_attr, ext2fs_write_ext_attr): The
++		ext2fs_swap_ext_attr() has been moved to swapfs.c, and
++		given a new argument, has_header.
++
++	* swapfs.c (ext2fs_swap_ext_attr): Moved from ext_attr.c, and
++		takes an argument which controls whether or not there is
++		an EA header which needs to be byteswaped.
++		(ext2fs_swap_inode_full): New function which byte-swaps
++		the EA in inode.
++
++	* inode.c (ext2fs_get_next_inode_full, ext2fs_read_inode_full,
++		ext2fs_write_inode_full): New functions, originally from
++		Alex Tomas, but which needed to be substantially fixed so
++		that the tests wouldn't cause major stack overwrite bugs
++		in byte-swapping is enabled.
++	
++2005-01-18  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Fix the kernel compile-time echo commands to be
++		consistent and portable
++
++2005-01-07  Theodore Ts'o  <tytso@mit.edu>
++
++	* unlink.c (ext2fs_unlink): If both the name and the inode number
++		are unspecified, then return an error, so that we don't do
++		something surprising such as unconditionally deleting the
++		first directory entry.
++		(unlink_proc): Delete directory entries by coalescing it
++		with the previous entry, to avoid directory fragmentation.
++
++2005-01-06  Theodore Ts'o  <tytso@mit.edu>
++
++	* version.c (ext2fs_parse_version_string): Change parsing
++		algorithm so that version strings such as 1.36-rc1 returns
++		a non-surprising result (i.e., 136, and not 1361).
++
++2005-01-05  Theodore Ts'o  <tytso@mit.edu>
++
++	* block.c (block_iterate_ind, block_iterate_dind,
++		block_iterate_tind): Move the code which byte swaps and
++		read/writes indirect blocks to ext2fs_{read,write}_ind_block.
++		This saves 400 bytes, and we need them for the
++		resize_inode handling. 
++
++	* ind_block.c (ext2fs_read_ind_block, ext2fs_write_ind_block): New
++		functions.
++
++	* res_gdt.c (ext2fs_create_resize_inode): Use 
++		ext2fs_{read,write}_ind_block so that byte swapping is
++		handled on big-endian systems.
++
++	* dupfs.c (ext2fs_dup_handle): Make sure the new filesystem handle
++		has its own copy of the orig_super data structure.  (This
++		is a better way of fixing a double-free problem in
++		resize2fs which Fedora attempted to fix in 
++		e2fsprogs-1.35-double_free.patch.   Addresses Red Hat
++		Bugzilla #132707.)
++	
++2004-12-23  Theodore Ts'o  <tytso@mit.edu>
++
++	* inode.c (ext2fs_flush_icache): When flushing the icache, clear
++		the last-read block information as well.
++
++	* ext2fs.h (BMAP_SET), bmap.c (ext2fs_bmap): Add support for new
++		flag, BMAP_SET, which allows the caller to set a
++		particular logical->physical block mapping.
++
++	* ext2_err.et.in (EXT2_ET_SET_BMAP_NO_IND): New error code
++
++	* initialize.c (calc_reserved_gdt_blocks): #ifdef out all
++		debugging printf statements.
++	
++	* res_gdt.c (ext2fs_create_resize_inode): Return
++		EXT2_ET_RESIZE_INODE_CORRUPT if the resize inode is not
++		what we expect.  #ifdef out all debugging printf
++		statements.
++
++	* ext2_err.et.in (EXT2_ET_RESIZE_INODE_CORRUPT): Add new error code.
++
++2004-12-22  Theodore Ts'o  <tytso@mit.edu>
++
++	* swapfs.c (ext2fs_swap_super): Byteswap the reserved_gdt_blocks
++		superblocks field.
++
++2004-12-15  Theodore Ts'o  <tytso@mit.edu>
++
++	* sparse.c (ext2fs_list_backups, ext2fs_bg_has_super),
++		res_gdt.c (list_backups), closefs.c (ext2fs_bg_has_super),
++		ext2fs.h: Move ext2fs_list_backups() to res_gdt.c, and
++		ext2fs_bg_has_super() back to closefs.c.  There's no
++		reason for the new file, since list_backups() isn't being
++		used by any other functions, and can be made static, and
++		all users of the ext2fs filesystem will have to call
++		ext2fs_close() anyway.
++
++2004-12-15  Theodore Ts'o  <tytso@mit.edu>
++
++	* Applied resize inode patch from Andreas Dilger
++
++	* res_gdt.c (ext2fs_create_resize_inode): New function that
++		creates the resize inode.
++
++	* initialize.c (ext2fs_initialize): Reserve space for the resize
++		inode.
++
++	* ext2fs.h (EXT2_LIB_FEATURE_COMPAT_SUPP): Add
++		EXT2_FEATURE_COMPAT_RESIZE_INODE to the list of supported
++		capabilities.
++		Add function prototypes for res_gdt.c and sparse.c.
++
++	* closefs.c (ext2fs_super_and_bgd_loc): Take the reserved blocks
++		into account when calculating the number of overhead
++		blocks.
++
++	* closefs.c (ext2fs_bg_has_super, test_root), sparse.c: Move these
++		functions to the new file sparse.c
++
++	* alloc_sb.c (ext2fs_reserve_super_and_bgd): Reserve the blocks
++		saved in the resize inode as being in use.
++
++	* ext2_err.et.in (EXT2_ET_RES_GDT_BLOCKS): Add new error code.
++
++	* Makefile.in (srcdir): Add res_gdt.c and sparse.c to the ext2fs
++		library.
++
++2004-12-14  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Use Linux-kernel-style makefile output for "make
++		install"
++
++	* Makefile.in (installdirs): Use $(MKINSTALLDIRS) macro
++		Update dependencies.
++
++2004-11-30  Theodore Ts'o  <tytso@mit.edu>
++
++	* unix_io.c (unix_set_option): Add support for the offset option.
++
++	* test_io.c (test_set_option): Add support for the set_option method.
++
++	* ext2_io.h: Add new io_channel method, set_option(), and change
++		io_channel_write_byte() from a macro to a library function.
++
++	* ext2fs.h, openfs.c(ext2fs_open2): New version of ext2fs_open
++		which adds a new parameter, io_options.
++		(ext2fs_open): If there is a question mark in the
++		filename, and no io_options are specified, assumed that
++		the text following the question mark are io_options.
++	
++	* io_manager.c, Makefile.in: New source file which contains
++		high-level functions for the io_channel layer.
++
++	* freefs.c (ext2fs_free): Make sure we don't free the io_channel
++		if image_io is NULL.
++
++	* Makefile.in: Use Linux-kernel-style makefile output to make it
++		easier to see errors/warnings.
++
++2004-11-29  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h (EXT2_EXTENTS_FL, EXT3_FEATURE_INCOMPAT_EXTENTS, 
++		EXT2_MAX_BLOCK_LOG_SIZE): Add definition for extent
++		feature and inode flag.  Change maximum allowable block
++		size to be 65536.
++
++2004-10-08  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): Add support for Windows
++		9x/NT under Cygwin.  Thanks to Sam Robb
++		(samrobb@users.sourceforge.net) for pointing this and the
++		suggested code patch.
++
++2004-09-17  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c: Clean up header #include's.
++
++	* llseek.c (ext2fs_llseek): On non-linux systems, use lseek64() if
++		it is present.  (Addresses Debian bug #269044)
++
++2004-07-28  Theodore Ts'o  <tytso@mit.edu>
++
++	* rw_bitmaps.c (read_bitmaps), block.c (block_iterate_ind,
++		block_iterate_dind, block_iterate_tind), inode.c
++		(ext2fs_read_inode): If EXT2_FLAG_IMAGE_FILE is set, so
++		read the metadata from fs->image_io instead of fs->io.
++
++	* initialize.c (ext2fs_initialize), openfs.c (ext2fs_open):
++		Initialize fs->image_io to be the same as fs->io.
++	
++	* ext2_err.et.in (EXT2_ET_NOT_IMAGE_FILE): Add new error code. 
++
++	* openfs.c (ext2fs_get_data_io, ext2fs_set_data_io,
++		ext2fs_rewrite_to_io): New functions that allow
++		applications to manipulate fs->image_io and fs->io safely.
++
++	* freefs.c (ext2fs_free): If fs->image_io is different fs->io,
++		then call io_channel_close on fs->image_io.
++
++	* ext2fs.h: Add image_io element to the ext2_filsys data
++		structure.  Add ext2fs_get_data_io() ext2fs_set_data_io(),
++		and ext2fs_rewrite_to_io() prototypes.
++
++2004-05-26  Theodore Ts'o  <tytso@mit.edu>
++
++	* closefs.c (ext2fs_flush): Make sure the master superblock is
++		written last, and only after other I/O has been flushed to
++		disk.  Thanks to Junfeng Yang from the Stanford
++		Metacompilation group for pointing a potential ordering
++		constraint problem if we don't write things out in the
++		right order.
++
++	* test_io.c: Implement the ability to abort after n reads or
++		writes to a particular block.  The block is specified by
++		TEST_IO_BLOCK environment variable, and the read/write
++		count by the TEST_IO_READ_ABORT and TEST_IO_WRITE_ABORT
++		environment variables.  The block data is now only dumped
++		if the 0x10 bit is set in TEST_IO_FLAGS.
++
++2004-04-03  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_types.h.in: Remove check for _UUID_TYPES since uuid_types.h
++		is no longer used.
++
++2004-03-08  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): Only use the BLKGETSIZE64
++		ioctl on Linux 2.6 since it is unreliable in Linux 2.4.
++		(Addresses Debian Bug #236528).  Fix typo in the ioctl
++		used for Mac OS X.
++
++2004-03-02  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): Update getsize functions to
++		use Apple Darwin and Linux 64-bit ioctl's
++
++2004-02-29  Brian Bergstrand  <brian@bergstrand.org>
++
++	* Makefile.in: Use $(BSDLIB_PIC_FLAG) to determine whether to use
++		-fpic or -fPIC
++
++2004-02-28  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.35
++
++2004-02-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2fs.h (ext2fs_resize_mem): Fix C++ problem.  (Addresses Red
++		Hat Bugzilla #112448; thanks Thomas Woerner from Red Hat.)
++
++2004-02-14  Theodore Ts'o  <tytso@mit.edu>
++
++	* namei.c (follow_link): Correctly deal with symlinks that have
++		extended attribute information.  (Addresses Debian Bug
++		#232328)
++
++2004-01-30  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h: Reserve an extra 4 bytes for the journal backup,
++		which we're using due to a typo in the e2fsck code.  (Oops)
++
++	* swapfs.c (ext2fs_swap_inode): Fix byte swap bug which causes SE
++		Linux created symlinks with mandatory attributes to fail
++		to be properly handled on big endian systems.  (Addresses
++		Debian Bug #228723).
++		(ext2fs_swap_super): Byte swap some new fields in the
++		superblock, including the journal backup fields.
++
++2003-12-02  Theodore Ts'o  <tytso@mit.edu>
++
++	* alloc.c, bb_inode.c, bitops.c, block.c, check_desc.c, closefs.c,
++		dir_iterate.c, dirblock.c, expanddir.c, ext2fs.h,
++		get_pathname.c, icount.c, imager.c, initalize.c, inode.c,
++		lookup.c, openfs.c, read_bb.c, read_bb_file.c,
++		rw_bitmaps.c, unix_io.c, unlink.c, write_bb_file.c: Fix
++		gcc -Wall complaints.  Mainly marking variables as being
++		unsued, and catching signed vs. unsigned comparisons.
++
++2003-09-03  Theodore Ts'o  <tytso@mit.edu>
++
++	* closefs.c (ext2fs_super_and_bgd_loc): New function which
++		centralizes the calculation of the superblock and block
++		group descriptors.
++		(ext2fs_flush): Use ext2fs_super_and_bgd_lock to figure
++		out where to write the superblock and block group
++		descriptors.
++
++	* alloc_sb.c (ext2fs_reserve_super_and_bgd): New function which
++		reserves space in the block bitmap using
++		ext2fs_super_and_bgd_loc.
++
++	* initialize.c (ext2fs_initialize): Use
++		ext2fs_reserve_super_and_bgd to initialize the block bitmap.
++
++2003-08-20  Theodore Ts'o  <tytso@mit.edu>
++
++	* inode_io.c (ext2fs_inode_io_intern2), ext2fs.h: Add new function
++		allows the caller to pass in the inode data structure.
++
++	* fileio.c (ext2fs_file_open2), ext2fs.h: Add new function which
++		allows the caller to pass in the inode to be used in the
++		file I/O.
++
++	* ext2_fs.h: Add a backup of the location of the journal inode
++		blocks to the superblock.
++
++	* mkjournal.c (write_journal_inode): Save the location of the
++		journal inode to the backup location in the superblock.
++
++2003-08-01  Philipp Thomas <pthomas@suse.de>
++
++	* alloc.c, badblocks.c, bb_inode.c, bitmaps.c, block.c, bmap.c,
++		bmove.c, brel_ma.c, closefs.c, dblist.c, dblist_dir.c,
++		dir_iterate.c, dirblock.c, dupfs.c, expanddir.c, ext2fs.h,
++		ext_attr.c, fileio.c, freefs.c, get_pathname.c, icount.c,
++		initialize.c, inode.c, inode_io.c, irel_ma.c, mkdir.c,
++		mkjournal.c, namei.c, newdir.c, openfs.c, rs_bitmap.c,
++		rw_bitmaps.c, test_io.c, unix_io.c: ext2fs_getmem(),
++		ext2fs_free_mem(), and ext2fs_resize_mem() all now take a
++		'void *' instead of a 'void **' in order to avoid pointer
++		aliasing problems with GCC 3.x.
++
++2003-07-25  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.34
++
++2003-07-06  Theodore Ts'o  <tytso@mit.edu>
++
++	* kernel-jbd.h, flushb.c: Fix gcc -Wall nitpicks (indented cpp
++		directives)
++
++	* ext2_types.h.in, initialize.c: Fix gcc -Wall nitpicks 
++		(don't use #elsif)
++
++	* ismounted.c: Fix gcc -Wall nitpicks (Don't use exit as a goto label)
++
++	* llseek.c: Fix gcc -Wall nitpicks (don't use #elsif)
++
++	* lookup.c, read_bb.c: Fix gcc -Wall nitpicks (indent
++		non-traditional #pragma)
++
++	* test_io.c: Fix gcc -Wall nitpicks (const/unsigned type issues)
++
++2003-06-24    <tytso@snap.thunk.org>
++
++	* badblocks.c, ext2fs.h (ext2fs_u32_list_find,
++		ext2fs_u32_list_test, ext2fs_u32_list_del,
++		ext2fs_badblocks_list_del): Add functions to delete a
++		block from the badblocks list.
++	* tst_badblocks.c: Add test cases for ext2fs_badblocks_list_del().
++
++2003-05-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsectsize.c (ext2fs_get_device_sectsize): New function which
++		returns the hardware sector size (if it is available).
++
++2003-05-13  Theodore Ts'o  <tytso@mit.edu>
++
++	* unix_io.c: Add #ifdef NO_IO_CACHE which disables all userspace
++		caching by the unix_io layer.  Not enabled, only for
++		debugging. 
++
++2003-05-05  Theodore Ts'o  <tytso@mit.edu>
++
++	* test_io.c: Pay attention to the environment variables
++		TEST_IO_LOGFILE, TEST_IO_FLAGS, and TEST_IO_BLOCK to
++		determine whether or not we should log io activity, and to
++		where.
++
++2003-05-03  Theodore Ts'o  <tytso@mit.edu>
++
++	* tst_badblocks.c (file_test): Use tmpfile() instead of mktemp().
++
++2003-04-29  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): Allow windows code to get
++		the resize for filesystems that are in regular files.
++
++2003-04-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.33
++
++2003-04-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Use DYLD_LIBRAY_PATH so that "make check" works on
++		Darwin systems when building with shared libraries.
++
++2003-04-18  Theodore Ts'o  <tytso@mit.edu>
++
++	* unix_io.c: Use __CYGWIN__ instead of CYGWIN.
++
++2003-04-17  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c: Add Cygwin/Windows version of ext2fs_get_device_size()
++
++2003-04-12  Theodore Ts'o  <tytso@mit.edu>
++
++	* unix_io.c (raw_read_blk): Add Cygwin support (the Windows block
++		device only accepts sector aligned read requests.
++
++	* ismounted.c (check_mntent_file): Deal with OS's that don't
++		define MNTOPT_RO.
++
++	* imager.c: If the OS doesn't define ssize_t, typedef it to int.
++
++2003-04-11  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h (EXT2_FEATURE_RO_COMPAT_BTREE_DIR): Comment out unused
++		feature flag
++
++2003-03-30  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Use the compile_et --build-tree option.
++
++2003-03-14  Theodore Ts'o  <tytso@mit.edu>
++
++	* getsize.c: Add support for Apple Darwin's ioctl to get the hard
++		disk size.
++
++	* badblocks.c (ext2fs_u32_list_count), ext2fs.h: Add new function
++		which returns the number of entries in the list.
++
++2003-03-10  Theodore Ts'o  <tytso@mit.edu>
++
++	* fileio.c (ext2fs_file_lseek): Fix bug added when adding 64-bit
++		support; avoid null dereference when ret_pos is NULL.
++
++2003-03-06  Theodore Tso  <tytso@mit.edu>
++
++	* ext2_types.h.in: Don't redefine types if other e2fsprogs
++		*_types.h files have been included already.
++
++	* kernel-jbd.h: Use C99 variadic cpp macros if not using GCC.
++		(Older GCC's don't support the C99 variadic macros.)
++
++	* flushb.c (ext2fs_sync_device), 
++	ismounted.c (ext2fs_check_mount_point): Avoid GCC extension: 
++	#warning not supported by Solaris suncc
++
++	* ext2_ext_attr.h: Avoid GCC extension: 0 length arrays in
++		structure definition.  Not needed for now in 
++		ext2_ext_attr_entry.
++
++2003-01-25  Theodore Ts'o  <tytso@mit.edu>
++
++	* dirhash.c: Fix gcc -Wall nits.
++
++2003-01-22  Theodore Ts'o  <tytso@mit.edu>
++
++	* unix_io.c (unix_write_blk): Fix up GCC -Wall nits.
++
++2003-01-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* fileio.c (ext2fs_file_read, ext2_file_lseek,
++		ext2_file_get_size): Add 64-bit support.
++
++	* ext2fs.h (EXT2_I_SIZE): Add macro which caluates a 64bit size
++		from i_size and i_size_high.
++
++2003-01-19  Theodore Ts'o  <tytso@mit.edu>
++
++	* initialize.c (ext2fs_initialize): If the user specifies a really
++		large number of inodes, then reduce the number of blocks
++		per group until we find a workable set of filesystem
++		parameters.
++
++	* ext2_err.et.in (EXT2_ET_TOO_MANY_INODES): Add new error code.
++
++2002-11-09  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.32
++
++2002-11-09  Theodore Ts'o  <tytso@mit.edu>
++
++	* unix_io.c (find_cached_block, reuse_cache, unix_read_blk, 
++		unix_write_blk): Optimize routines so that we don't end up
++		searching the cache twice when a block isn't in the
++		cache.  If reads are larger than READ_DIRECT_SIZE, don't
++		let them go through the cache.
++
++	* unix_io.c (find_cached_block): Fixed bug which caused some clean
++		blocks to be erroneously marked as dirty, so they would
++		get written back to the disk before they are evicted from
++		the cache.  Harmless, but it slows down e2fsck
++		significantly.
++
++2002-11-08  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.31
++
++2002-11-08    <tytso@snap.thunk.org>
++
++	* Makefile.in (check): Skip trying to compile test_byteswap
++		if --disable-byteswaap had been given to configure.
++
++2002-11-07    <tytso@snap.thunk.org>
++
++	* closefs.c (write_bgdesc, ext2fs_flush): Fix bug in meta_bg
++		support when the MASTER_SB_ONLY flag is set.  Some of
++		the descriptor blocks that should have been written out
++		were getting skipped.
++
++2002-10-31  Theodore Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.30
++
++2002-10-31  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h: Add support for a new inode flag, which is to be used
++		for indicating the top of directory hierarchies for the
++		Orlov block allocator.
++	
++	* ismounted.c (check_mntent, check_mntent_file): Add better
++		support for loopback-mounted filesystems.  Check /etc/mtab
++		if /proc/mounts doesn't turn up any mount flags, since
++		/etc/mtab has the loopback image filename, instead of
++		/dev/loop0.  Also, check based on st_dev and st_ino, so
++		that if a relative pathname or a pathnames using symbolic
++		links are used, we can detect the the filesystem correctly
++		in those cases.  (Addresses Sourceforge bug #619119)
++
++	* flushb.c (ext2fs_sync_device): If the BLKFLSBUF ioctl succeeds,
++		don't try the FDFLUSH ioctl that was required for floppies
++		with older kernels.  This avoids needless whining from the
++		MD device driver.  (Addresses Sourceforge bug #545832).
++
++	* openfs.c (ext2fs_open): Fix bug which caused us to pass the
++		wrong group_block to ext2fs_descriptor_block_loc if we're
++		using the backup superblock/block group descriptors.
++		(ext2fs_descriptor_block_loc): If we're using the backup
++		superblock descriptors, use the backup descriptor block in
++		the next block group.
++
++2002-10-30  Theodore Ts'o  <tytso@mit.edu>
++
++	* alloc_tables.c (ext2fs_allocate_group_table): Allocate the inode
++		table so that it buts up against the bitmap blocks, to
++		avoid block fragmentation.
++
++	* closefs.c (write_bgdesc), initalize.c (ext2fs_initialize): Fix
++		bug; only allocate group descriptor blocks up to
++		s_first_meta_bg.
++
++2002-10-25  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h: Add a new superblock field, s_mkfs_time, so that we
++		know when a filesystem was created.  (Sometimes this can
++		be useful...)
++
++	* initialize.c (ext2fs_initialize): Set the s_mkfs_time field.
++
++2002-10-20  Theodore Ts'o  <tytso@valinux.com>
++
++	* ext2_fs.h (EXT3_DEFM_JMODE): Add new default mount options for
++		the journal data mode.
++
++	* closefs.c (ext2fs_flush, write_bgdesc), ext2_fs.h, ext2fs.h,
++	openfs.c (ext2fs_descriptor_block_loc, ext2fs_open), initialize.c
++	(ext2fs_initialize), swapfs.c (ext2fs_swap_super): Add support for
++	the meta_blockgroup filesystem format.
++
++2002-10-15    <tytso@snap.thunk.org>
++
++	* ext2_fs.h: Add new field in superblock for default mount options.
++
++2002-10-13  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2fs.h: Add #include of header files necessary for ext2fs.h to
++		compile cleanly.
++
++2002-10-02  Theodore Y. Ts'o  <tytso@mit.edu>
++
++	* rw_bitmaps.c (ext2fs_write_block_bitmap,
++		ext2fs_read_block_bitmap): Don't set the CHANGED bit just
++		because the bitmap is getting written to disk.  Make
++		ext2fs_swap_bitmap be a static function, since it's not
++		intended to be exported.
++
++	* swapfs.c (ext2fs_swap_super): Byte-swap the hash seed
++
++2001-09-24  Theodore Tso  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.29
++
++2001-08-31  Theodore Tso  <tytso@thunk.org>
++
++	* Release of E2fsprogs 1.28
++
++2002-08-31  Theodore Ts'o  <tytso@valinux.com>
++
++	* dblist.c (ext2fs_dblist_sort): New function which allows the
++		caller to pass in a special sort comparison function.
++
++2002-08-20  Theodore Ts'o  <tytso@mit.edu>
++
++	* valid_blk.c (ext2fs_inode_has_valid_blocks): Fix bug which
++		failed to accurately characterize non-standard slow
++		symlinks.  (Which don't appear in practice on real-life
++		systems, fortunately.)
++
++2002-08-17  Theodore Ts'o  <tytso@mit.edu>
++
++	* Makefile.in: Remove inode_io.o from the standard object files,
++		and only build it if debugfs is enabled (it requires
++		fileio.o, which is only built if --disable-debugfs isn't
++		specified to configure).
++
++	* dirhash.c (ext2fs_dirhash): Change the MD4 hash in a backwards
++		incompatible way so that it is no longer
++		endian-dependent.  Add the TEA hash.  Allow the seed
++		parameter to be optional.
++
++	* ext2_fs.h: Remove the HALF_MD4_SEED and HALF_MD4_64 hashes.
++		These features are all now in the HALF_MD4 hash.  Add
++		definition for EXT2_HASH_TEA.
++
++	* ext2fs.h (ext2fs_dirhash): Change function prototype so it takes
++		a pointer instead of an array.
++
++2002-08-16  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_err.et.in (EXT2_ET_BAD_EA_BLOCK_NUM): New error code
++
++	* ext2fs.h (ext2fs_inode_data_blocks): New function which returns
++		the number of data blocks used by an inode exclusive of
++		the EA block.
++
++	* ext_attr.c (ext2fs_adjust_ea_refcount): New function which
++		adjusts the reference count in an extended attribute block.
++
++	* valid_blk.c (ext2fs_inode_has_valid_blocks): Add code to
++		correctly deal with extended attribute blocks in symbolic
++		links. 
++
++2002-08-13    <tytso@snap.thunk.org>
++
++	* Makefile.in: Move dupfs.o and test_io.o from the
++		needed-by-debugfs object list to the needed-by-resizer
++		object list.  Fixes compile problem if the system is built
++		with only --disable-debugfs.
++
++2002-07-29  Theodore Ts'o  <tytso@mit.edu>
++
++	* link.c (ext2fs_link): When adding a new link to a directory,
++		clear the HTREE bit.
++
++2002-07-23  Theodore Ts'o  <tytso@mit.edu>
++
++	* dirhash.c (ext2fs_dirhash): Fix bug which caused MD4
++		calculations for names > 32 characters to be completely
++		bogus.  Changed MD4 calculation to match what is currently
++		being used in the CVS gkernel tree.
++
++2002-07-19  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h: Add s_hash_seed and s_def_hash_version to the
++		superblock definition.
++
++	* badblocks.c, freefs.c, ext2fs.h: Use the badblocks functions to
++		create a set of u32_list functions.
++
++	* dirhash.c (halfMD4Transform): Shift the hash by one bit,
++		since that's required by the directory indexing code.
++
++2002-07-14  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2fs.h, read_bb_file.c: Change private to priv_data, to avoid
++		using a C++ reserved word.
++
++	* unix_io.c (unix_open): Only attempt the setrlimit workaround if
++		the kernel version is 2.4.10 -- 2.4.17, since otherwise an
++		old version of glibc (built against 2.2 headers) will
++		interact badly with the workaround to actually cause more
++		problems.  I hate it when the glibc folks think they're
++		being smarter than the kernel....
++
++2002-06-28  Andreas Dilger <adilger@clusterfs.com>
++
++	* ext2_fs.h: Add superblock field for reserved group descriptors.
++
++2002-06-28  Theodore Ts'o  <tytso@mit.edu>
++
++	* bitops.h: Add #define's for ext2fs_{l,b}e{32,16}_to_cpu and
++		ext2fs_cpu_to_{l,b}e{32,16}
++
++2002-06-27  Theodore Ts'o  <tytso@mit.edu>
++
++	* ismounted.c (check_mntent): In AIX 4.3, MOUNTED isn't defined.
++		Add appropriate fallbacks in this case.
++
++2002-06-26  Theodore Ts'o  <tytso@mit.edu>
++
++	* dirhash.c (ext2fs_dirhash): Change function signature to support
++		a hash seed, and to return the minor hash (for 64-bit hash
++		support).   Add support for the half MD4, half MD4 with
++		seed, and half MD4 with seed and 64 bits.
++
++2002-06-15  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_fs.h (EXT2_DIRSYNC_FL): Add new file.
++
++2002-06-09  Andreas Dilger <adilger@clusterfs.com>
++
++	* ext2_fs.h: Add macros for maximum block/inode counts:
++		EXT2_INODES_PER_BLOCK, EXT2_MAX_BLOCKS_PER_GROUP,
++		and EXT2_MAX_INODES_PER_GROUP.
++
++	* openfs.c (ext2fs_open): Check that the number of blocks in a group
++		is less than 2^16, otherwise we need an INCOMPAT flag (not
++		in existence yet, if ever) to open such a filesystem.
++
++	* initialize.c (ext2fs_initialize): Limit the number of blocks and
++		inodes in a group to less than 2^16.
++
++2002-06-09  Andreas Dilger <adilger@clusterfs.com>
++
++	* ext2_fs.h: Further minor cleanups of the header.  Consolidate
++		some checks for __KERNEL__ into one place.
++
++2002-05-22  Andreas Dilger <adilger@clusterfs.com>
++
++	* ext2_fs.h: Remove macros accessing u.ext2_sb field and use
++		the EXT2_SB() macro instead.  Remove kernel function
++		prototypes also.  This matches the 2.5 kernel, and
++		is also cleaner for other reasons.  Whitespace cleanup.
++
++2002-05-21  Theodore Ts'o  <tytso@mit.edu>
++
++	* ext2_ext_attr.h: Update to V2 version of the Bestbits format.
++
++2002-05-16  Andreas Dilger <adilger@clusterfs.com>
++
++	* ext2_fs.h: Change limits to support filesystems with 8k blocks.
++
++	* initialize.c (ext2fs_initialize): Remove assumption that
++		blocksizes are always <= 4k.
++
++2002-05-11  Theodore Ts'o  <tytso@mit.edu>
++
++	* bmap.c (ext2fs_bmap): Fix bug which caused ext2fs_bmap to fail
++		silently if inode pointer is NULL (and ext2fs_bmap is
++		expected to read the inode itself).
++
++2002-04-27  Theodore Ts'o  <tytso@mit.edu>
++
++	* ismounted.c (check_mntent_file, is_swap_device): Verify that the
++		file we are checking is a block device file before looking
++		at st_rdev, since it's not valid for normal files.
++		(is_swap_device): Move so that it is outside the
++		HAVE_MNTENT_H, so that it is always built.
++
++2002-03-11  Theodore Tso  <tytso@mit.edu>
++
++	* dirblock.c (ext2fs_read_dir_block2, ext2fs_write_dir_block): New
++		functions which take an extra flags argument.  The flag
++		EXT2_DIRBLOCK_V2_STRUCT will reverse when the name_len
++		field is byte swampped on big-endian machines, since in
++		the V2 structure, name_len is a char field which is
++		doesn't need to be byte swapped --- except if an
++		old-style kernel had byte-swapped the name_len field
++		as part of the V1 structure.
++
++	* ext2_err.et.in (EXT2_ET_DIRHASH_UNSUPP): New error code
++
++	* dirhash.c (ext2fs_dirhash): New function which calculates the
++		hash for a filename in an indexed directory.
++
++2002-03-08  Theodore Tso  <tytso@mit.edu>
++
++	* Release of E2fsprogs 1.27
++
++2002-03-07  Theodore Tso  <tytso@mit.edu>
++
++	* ext2fs.h (ext2fs_inode_io_intern): Add missing function prototype.
++
++	* bmap.c, fileio.c, inode_io.c, tst_badblocks.c, 
++		tst_byteswap.c: Fix gcc -Wall complaints
++
++	* Makefile.in (check): Use LD_LIBRARY_PATH to run test programs.
++		(From Philipp Thomas <pthomas@suse.de>)
++
++2002-02-25  Theodore Tso  <tytso@mit.edu>
++
++	* ext2_fs.h: Add structure definitions for the directory indexing
++		extension.
++
++2002-02-23  Theodore Tso  <tytso@mit.edu>
++
++	* unix_io.c (unix_open): Fix 2.4 resource limit workaround so that
++		it doesn't break things on mis32, sparc32, and alpha
++		platforms.
++
++2002-02-21  Theodore Tso  <tytso@mit.edu>
++
++	* ismounted.c (is_swap_device): Fix file descriptor/memory leak;
++		we were missing an fclose().
++
++2002-02-20  Theodore Tso  <tytso@mit.edu>
++
++	* Makefile.in, inode_io.c, ext2fs.h, ext2_err.et.in: Add new io
++		abstraction interface which exports an ext2 inode.
++
++	* ext2fs.h, fileio.c (ext2fs_file_flush): Export ext2fs_file_flush
++		as a public interface.  Change void * to const void * in
++		ext2fs_file_write's interface.
++
++	* test_io.c (test_close), unix_io.c (unix_close): Remove unneeded
++		conditional; save a few bytes.
++	
++2002-02-12  Theodore Tso  <tytso@mit.edu>
++
++	* Makefile.in (tst_badblocks): Add some extra .o files when
++		linking the debugging program tst_badblocks which are
++		needed if we aren't compiling with inline functions enable.
++
++	* kernel-list.h (__inline__): On non-gcc and non-Watcom compilers,
++		define away __inline__ since it may not be supported.
++
++	* kernel-jbd.h (jbd_debug): For systems that don't do STDC, use a
++		stripped down jbd_debug that doesn't use variadic
++		arguments.  This will cause warnings under AIX, but things
++		should still build.
++
++2002-02-03  Theodore Tso  <tytso@thunk.org>
++
++	* Release of E2fsprogs 1.26
++
++2002-02-03  Theodore Tso  <tytso@mit.edu>
++
++	* mkdir.c (ext2fs_mkdir): Change to use ext2fs_inode_alloc_stats2
++		so that the number of directories in use is adjusted
++		appropriately.
++
++	* alloc_stats.c (ext2fs_inode_alloc_stats2): Add new function
++		which optionally will modify the number of directories
++		count.
++
++2002-01-03  Theodore Tso  <tytso@mit.edu>
++
++	* dir_iterate.c (ext2fs_dir_iterate2, ext2fs_process_dir_block):
++		Add support for a new flag, DIRENT_FLAG_INCLUDE_REMOVED,
++		which will return deleted directory entries.
++		ext2fs_dir_iterate2 takes a new callback function which
++		is identical with the one used by
++		ext2fs_dblist_dir_iterate().  If the directory entry is
++		deleted, the callback function will be called with the
++		entry paraemter set to DIRENT_DELETED_FILE.
++
++	* Makefile.in, alloc_stats.c (ext2fs_inode_alloc_stats,
++		ext2fs_block_alloc_stats): New functions which update
++		block/inode allocation statistics in the bitmaps, block
++		group descriptors, and superblock.
++
++	* mkjournal.c (mkjournal_proc), mkdir.c (ext2fs_mkdir),
++		expanddir.c (expand_dir_proc), bb_inode.c
++		(clear_bad_block_proc, set_bad_block_proc,
++		ext2fs_update_bb_inode), alloc.c (ext2fs_alloc_block):
++		Update to use new block/inode allocation statistics.
++
++2001-12-24  Theodore Tso  <tytso@mit.edu>
++
++	* ismounted.c (is_swap_device): New function used by
++		ext2fs_check_if_mounted and ext2fs_check_mount_point which
++		determines whether or not the specified device is a swap
++		device by using /proc/swaps.  More bulletproofing for
++		idiotic/careless system administrators!
++
++	* ext2fs.h, openfs.c (ext2fs_open), initialize.c
++		(ext2fs_initialize), mkdir.c (ext2fs_mkdir): Add a new
++		field to struct_ext2_filsys, umask.  This field is
++		initialize to 022, and affects ext2fs_mkdir in the obvious
++		way.  (In the future umask should also affect new file
++		creation routines, but the fileio functions don't
++		currently support this yes.)
++
++	* ismounted.c (check_mntent_file): Stat all of the entries in
++		/etc/mtab and/or /proc/mounts in order to catch dim-witted
++		system administrators who might have created alias
++		devices.
++ 
++2001-12-23  Theodore Tso  <tytso@mit.edu>
++
++	* Makefile.in, jfs_user.h: Move linux/jbd.h to
++		ext2fs/kernel-jbd.h, to avoid using the system header
++		file version of hbd.h when using diet glibc (since it
++		forcibly adds /usr/include to the beginning of the
++		include search path.)
++
++	* kernel-jbd.h, kernel-list.h, jfs_compat.h: Move files from
++		include/linux directory.
++
++2001-12-16  Theodore Tso  <tytso@mit.edu>
++
++	* bitops.h (ext2fs_mark_generic_bitmap, ext2fs_unmark_generic_bitmap),
++		ext_attr.c (ext2fs_read_ext_attr, ext2fs_write_ext_attr),
++		fileio.c (ext2fs_file_write): Fix gcc -Wall nits
++
++	* Makefile.in, jfs_user.h: linux/jfs.h has been renamed to
++		linux/jbd.h
++
++2001-12-03  Theodore Tso  <tytso@mit.edu>
++
++	* unix_io.c (unix_open): Make sure the ulimit workaround works
++		regardless of the version of glibc which is used to
++		compild e2fsprogs.
++
++2001-11-26  Theodore Tso  <tytso@mit.edu>
++
++	* unix_io.c (unix_open): Work around a bug in 2.4.10+ kernels by
++		trying to unset the filesize limit if at all possible,
++		if a block device is getting opened.  (The filesize limit
++		shouldn't be applied against writes to a block device, but
++		starting in 2.4.10, the kernel is doing this.)
++	
++2001-11-05  Theodore Tso  <tytso@mit.edu>
++
++	* mkjournal.c (ext2fs_add_journal_inode): When creating a .journal
++		file on adding a journal to an already-mounted filesystem,
++		try to clear the ext2 file attributes on an already
++		existing .journal file so that we don't fail if on a
++		partially added journal to the filesystem.
++
++	* ext2_fs.h: Define a new ext2 file attribute, EXT2_NOTAIL_FL,
++		which signals that a particular inode should not have the
++		last bits of data (the "tail") be merged with another
++		file.  This is necessary to keep LILO happy.
++
++2001-09-20  Theodore Tso  <tytso@thunk.org>
++
++	* Release of E2fsprogs 1.25
++
++2001-09-16  Theodore Tso  <tytso@mit.edu>
++
++	* ext2_ext_attr.h: Remove unneeded #include of <linux/config.h>
++		which was breaking the build on the Hurd.  (Addresses
++		Debian bug #112414).
++
++2001-09-13  Theodore Ts'o  <tytso@mit.edu>
++
++	* ismounted.c (check_mntent_file): We now validate the entry in
++		/etc/mtab to make sure the filesystem is really mounted,
++		since some broken distributions (read: Slackware) have
++		buggy boot scripts that don't initialize /etc/mtab before
++		checking non-root filesystems.  (Slackware also doesn't
++		check the root filesystem separately, and reboot if the
++		root filesystem had changes applied to it, which is
++		dangerous and broken.)   
++
++2001-09-02  Theodore Tso  <tytso@thunk.org>
++
++	* Release of E2fsprogs 1.24a
++
++2001-08-30  Theodore Tso  <tytso@thunk.org>
++
++	* Release of E2fsprogs 1.24
++
++2001-08-30  Theodore Tso  <tytso@valinux.com>
++
++	* getsize.c (ext2fs_get_device_size): Back out BLKGETSIZE64
++		changes, since the ioctl number has been reused by another
++		unofficial patch.
++
++2001-08-15  Theodore Tso  <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.23
++
++2001-08-05  Theodore Tso  <tytso@valinux.com>
++
++	* alloc.c (ext2fs_new_inode, ext2fs_new_block): Use the fast
++		version of the bitmap test routines to speed up these
++		routines.  (At some point I may want to make these
++		routines use the find_first_bit functions, but that will
++		add a lot of complexity since it means that these
++		functions will have to break the bitmap abstraction
++		boundary.  It's not clear it's worth it.)
++
++	* mkjournal.c (mkjournal_proc): Remember the last block allocated
++		to speed up ext2fs_new_block().
++
++2001-07-29  Theodore Tso  <tytso@valinux.com>
++
++	* finddev.c (scan_dir): Fix memory leak; we weren't calling
++		closedir() when exiting the function in all cases.
++
++2001-07-27  Theodore Tso  <tytso@valinux.com>
++
++	* mkjournal.c (ext2fs_create_journal_superblock): Set the first
++		block usable in the journal for external journals to be 2
++		or 3, depending on the blocksize, so that the existing
++		kernel code does the right thing.
++
++	* getsize.c (ext2fs_get_device_size): Add support for the
++		BLKGETSIZE64 ioctl.  (Ioctl defined by unofficial patches
++		from Ben LaHaise, but it's likely this interface won't
++		change.)
++
++	* mkjournal.c (ext2fs_add_journal_device): Use the correct block
++		when writing the journal superblock, too.  (Oops! Needed
++		to make 1k filesystems with external journal to work.)
++
++2001-07-26  Theodore Tso  <tytso@valinux.com>
++
++	* mkjournal.c (ext2fs_add_journal_device): Use the correct block
++		to find the journal superblock if the blocksize is 1024.
++
++2001-07-21  Theodore Tso  <tytso@valinux.com>
++
++	* ext2_err.et.in (EXT2_ET_LOAD_EXT_JOURNAL): Add new error code
++
++2001-07-20  Theodore Tso  <tytso@valinux.com>
++
++	* ext_attr.c (ext2fs_write_ext_attr): When writing the extended
++		attribute block, set the filesystem changed bit.
++
++	* bitops.h (ext2fs_find_first_bit_set, ext2fs_find_next_bit_set):
++		Comment out these functions since we're not using them.
++
++2001-07-10  Theodore Tso  <tytso@valinux.com>
++
++	* closefs.c (write_primary_superblock): After writing changes to
++		the primary superblock, update the original superblock
++		copy so we don't have to re-write those changes in the
++		future.
++		(ext2fs_flush): Clear the superblock dirty flag after
++		we've flushed out changes to disk.
++
++2001-07-07  Theodore Tso  <tytso@valinux.com>
++
++	* bitops.h (ext2fs_find_first_bit_set): Use %esi instead of %ebx
++		to avoid register conflicts when compiling in PIC mode.
++
++2001-07-04  Theodore Tso  <tytso@valinux.com>
++
++	* bitops.h (ext2fs_find_first_bit_set, ext2fs_find_next_bit_set):
++		Add new functions (C and in i386 assembler) which quickly
++		find bits set in a bitmask.
++
++2001-06-23  Theodore Tso  <tytso@valinux.com>
++
++	* Makefile.in, ext_attr.c, ext2_attr.c, ext2fs.h: Add new files
++		ext2_ext_attr.h and ext_attr.c for extended attributes
++		support.
++
++	* Release of E2fsprogs 1.22
++
++2001-06-22  Theodore Tso  <tytso@valinux.com>
++
++	* mkjournal.c (ext2fs_add_journal_inode): Move close of file
++		descriptor so that adding a journal to a mounted
++		filesystem doesn't die.  (Fixes a bug accidentally
++		introduced in e2fsprogs 1.21.)
++
++	* mkjournal.c (ext2fs_add_journal_inode): Only use fchflags if
++		HAVE_CHFLAGS and UF_NODUMP are defined, since the Hurd has
++		fchflags without defining UF_NODUMP.  (Addresses Debian
++		bug #101361)
++
++	* flushb.c: Use platform independent method of defining the
++		BLKFLSBUF and FDFLUSH ioctl's.  Also include sys/mount.h
++		since on newer glibc's BLKFLSBUF is defined there.
++
++	* bitops.h: The C language versions of ext2fs_swab16/32 need to be
++		included if EXT2FS_ENABLE_SWAPFS is defined, since we need
++		to support byte swapping even if we don't support the
++		conversion functions.  (Fixes Debian bug #101686).
++
++	* dirblock.c (ext2fs_read_dir_block): Remove use of dir_entry_2
++		since the byte-swapping code all assumes the
++		ext2_dir_entry structure.  (It's a question of whether or
++		not name_len should be byte-swapped or not, and whether
++		it's a 16 bit or 8 bit field.)
++
++2001-06-15  Theodore Tso  <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.21
++
++2001-06-15  Theodore Tso  <tytso@valinux.com>
++
++	* Makefile.in: Fix bug in installation of ext2_types.h.  It is a
++		file which is generated and is therefore found in the
++		build directory, not source directory.
++
++	* ismounted.c (check_mntent_file): Use a test file in / to check
++		to see if the root filesystem is mounted read-only.  This
++		protects against the case where /etc might not be on /, as
++		well as the case where /etc/mtab doesn't exist.  (Both are
++		should-never happen scenarios, but you never know...)
++
++2001-06-14  Theodore Tso  <tytso@valinux.com>
++
++	* ismounted.c (ext2fs_check_if_mounted): Fix grammer in comment.
++		Remove unneeded #pragma argsused, since the arguments are
++		always used.
++
++2001-06-13  Theodore Tso  <tytso@valinux.com>
++
++	* ext2_types.h.in: If linux/types.h has been defined, then don't
++		try to redefine the typedefs.
++
++	* Makefile.in (HFILES): Add ext2_types.h to the list of files
++		which should be installed.
++
++	* ismounted.c (check_mntent_file): Work around GNU hurd brain
++		damage.  Addresses Debian bug #100304.
++
++	* Makefile.in: Limit some .o files from being included into the
++		library if --disable-debugfs, --disable-swapfs,
++		--disable-imager, or --disable-resizer are used.
++
++2001-06-12  Theodore Tso  <tytso@valinux.com>
++
++	* inode.c, tst_iscan.c: Stop using the compatibility badblocks
++		function, and use the ext2fs_badblocks_* functions
++		instead.
++
++2001-06-11  Theodore Tso  <tytso@valinux.com>
++
++	* Makefile.in, gen_bitmap.c, bitops.h: Move inline functions
++		ext2fs_mark_generic_bitmap and
++		ext2fs_unmark_generic_bitmap to gen_bitmap.c as normal
++		functions.  (This saves space and doesn't significantly
++		change the speed of e2fsck on a P-III.)
++
++	* ext2fs.h, bitops.h, block.c, bmap.c, closefs.c, dirblock.c,
++		inode.c, native.c, openfs.c, rw_bitmaps.c, swapfs.c: Only
++		include the byte-swapping logic if ENABLE_SWAPFS is turned
++		on or if we're on a big-endian machine.
++	
++	* initialize.c (ext2fs_initialize):Use WORDS_BIGENDIAN directly to
++		set EXT2_FLAG_SWAP_BYTES, instead of using
++		ext2fs_native_flag.
++	
++	* native.c (ext2fs_native_flag): Use WORDS_BIGENDIAN provided by
++		autoconf to determine whether or not return
++		EXT2_FLAG_SWAP_BYTES.
++
++2001-06-10  Theodore Tso  <tytso@valinux.com>
++
++	* Makefile.in: Remove the dependence on the libe2p library.
++
++	* mkjournal.c (ext2fs_add_journal_inode): Replace use of fsetflags
++		with direct usage of the ioctl/fchflags so that we don't
++		have to depend on the libe2p library.
++
++2001-06-08  Theodore Tso  <tytso@valinux.com>
++
++	* ext2_types.h.in: Use unsigned ints in favor of unsigned longs
++		when trying to find a 32-bit wide type.
++
++	* icount.c (insert_icount_el): Fix the code used to estimate the
++		size of the new icount array to be more intelligent, to
++		avoid reallocating the array too many times.  Thanks to
++		Enrique Perez-Terron for pointing this out.
++
++2001-06-02  Theodore Tso  <tytso@valinux.com>
++
++	* valid_blk.c (ext2fs_inode_has_valid_blocks): Only check i_blocks
++		for a symlink to determine whether it is a fast symlink.
++
++2001-06-01  Theodore Tso  <tytso@valinux.com>
++
++	* Makefile.in, dosio.c, ext2_fs.h, ext2_types.h.in, ext2fs.h:
++		Move include/asm/types.h.in to lib/ext2fs/ext2_types.h.in.
++
++2001-05-25  Theodore Tso  <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.20
++
++2001-05-25  Theodore Tso  <tytso@valinux.com>
++
++	* ismounted.c: More cleanups for ismounted.c, some from Andreas,
++		some to clean up Andreas's patches.  Use strncpy instead
++		of strcpy to save the root's mountpoint.  Clean up #ifdef
++		structure.  Remove uneeded variable in testing/debug driver.
++
++2001-05-24  Andreas Dilger  <adilger@turbolinux.com>
++
++	* ismounted.c: Add check for root device which doesn't depend on
++		/etc/fstab or /proc/mounts to be correct.  Don't call
++		endmntent() before we are done with mnt struct.
++
++2001-05-23  Theodore Tso  <tytso@valinux.com>
++
++	* ext2_err.et.in (EXT2_ET_JOURNAL_UNSUPP_VERSION): Added new error
++		code.
++
++2001-05-21  Theodore Tso  <tytso@valinux.com>
++
++	* ext2_fs.h: Change assignment of EXT2_FEATURE_COMPAT_DIR_INDEX to
++		make room for pre-existing usage of
++		EXT2_FEATURE_COMPAT_EXT_ATTR.  Add flag EXT2_INDEX_FL with
++		the same codepoint as EXT2_BTREE_FL.
++
++2001-05-20  Theodore Tso  <tytso@valinux.com>
++
++	* ext2fs.h: #include <> instead of "" for ext2fs and et header
++		files, since they will be installed in /usr/include
++
++2001-05-14  Theodore Tso  <tytso@valinux.com>
++
++	* alloc.c, alloc_tables.c, badblocks.c, bb_compat.c, bb_inode.c,
++		bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
++		check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
++		dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c,
++		expanddir.c, ext2_fs.h, fileio.c, finddev.c, flushb.c,
++		freefs.c, get_pathname.c, getsize.c, icount.c, imager.c,
++		initialize.c, inline.c, inode.c, irel_ma.c, ismounted.c,
++		link.c, lookup.c, mkdir.c, mkjournal.c, namei.c, native.c,
++		newdir.c, nt_io.c, openfs.c, read_bb.c, read_bb_file.c,
++		rs_bitmap.c, rw_bitmaps.c, swapfs.c, test_io.c,
++		tst_badblocks.c, tst_byteswap.c, tst_getsize.c,
++		tst_iscan.c, unix_io.c, unlink.c, valid_blk.c, version.c,
++		write_bb_file.c, ext2_fs.h: Moved file from include/linux.
++		Adjust all files in this directroy to include this file.
++
++	* mkjournal.c (ext2fs_create_journal_superblock): Remove redundant
++		code.
++
++2001-05-05  Theodore Tso  <tytso@valinux.com>
++
++	* fileio.c (ext2fs_file_read): Factored out common code and
++		cleaned up function.  Fixed a bug where if there was an
++		error reading from the disk, the number of bytes read
++		wasn't reliably set.  (Fixes Debian bug #79163)
++		(ext2fs_file_write): Factored out common code and made
++		function more efficient; if writing a full block, don't
++		bother to do a read-modify-write cycle.
++
++2001-05-04  Theodore Tso  <tytso@valinux.com>
++
++	* dirblock.c (ext2fs_read_dir_block): Check for an directory
++		record length which isn't a multiple four, and treat that
++		as an invalid.  Scan the directory and return an error
++		(EXT2_ET_DIR_CORRUPTED) if the directory records are
++		corrupted.
++		(ext2fs_write_dir_block): If while byte-swapping the
++		directory block, if there's an error, abort and return
++		EXT2_ET_DIR_CORRUPTED.
++
++2001-05-02  Theodore Tso  <tytso@valinux.com>
++
++	* ext2fs.h (EXT2_FLAG_IMAGE_FILE): Add new flag, and add
++		image_header field in the ext2_filsys structure
++
++	* block.c (block_iterate_ind, block_iterate_dind, block_iterate_tind): 
++	* inode.c (ext2fs_read_inode): 
++	* rw_bitmaps.c (read_bitmaps): 
++	* openfs.c (ext2fs_open): Add support for EXT2_FLAG_IMAGE_FILE
++
++	* imager.c (ext2fs_image_bitmap_read): Fix bug in imager to make
++		sure the full bitmap is saved.
++
++2001-05-01  Theodore Tso  <tytso@valinux.com>
++
++	* e2image.h (struct ext2_image_hdr): Add space for the device name
++		in the image header.
++
++	* dir_iterate.c (ext2fs_process_dir_block): Add a double-check to
++		make sure the rec_len is a multiple of 4, to prevent
++		bus-errors on architectures which care about mis-aligned
++		pointer references.
++
++2001-04-25  Theodore Tso  <tytso@valinux.com>
++
++	* getsize.c (ext2fs_get_device_size): Use an unsigned long to
++		query the device sizes using the BLKGETSIZE ioctl.
++
++2001-04-16  Theodore Tso  <tytso@valinux.com>
++
++	* ismounted.c (check_mntent): Check /proc/mounts on Linux systems
++		before checking /etc/mtab.  The EXT2_MF_READONLY flag is
++		now set from the /etc/mtab options field for all
++		filesystems, not just the root filesystem.  Add debugging
++		code to make it easier to test ext2fs_check_if_mounted().
++
++	* mkjournal.c (ext2fs_create_journal_superblock): Add safety
++		check; return an error if there's an attempt to create a
++		journal less than 1024 filesystem blocks.
++
++	* ext2_err.et.in, mkjournal.c: Change EXT2_JOURNAL_NOT_BLOCK and
++		EXT2_NO_JOURNAL_SB to be EXT2_ET_*.
++
++2001-02-20  Theodore Tso  <tytso@valinux.com>
++
++	* bitops.h (ext2fs_swab16, ext2fs_swab32): Add i386 assembly
++		inline functions.
++
++	* tst_byteswap.c: New function to test the byteswap functions.
++		Add to regression test suite.
++
++2001-02-08  Theodore Tso  <tytso@valinux.com>
++
++	* e2image.h (struct ext2_image_hdr): Fix type for fs_hostname
++
++2001-02-07  Theodore Tso  <tytso@valinux.com>
++
++	* mkjournal.c (ext2fs_create_journal_superblock): Fix the setting
++		of s_first for external devices to always be 1, since
++		jsb->s_first is always relative to the start of the
++		journal superblock.  Use htonl(1) when setting s_nr_users.
++
++2001-01-17  Theodore Ts'o  <tytso@valinux.com>
++
++	* mkjournal.c (ext2fs_add_journal_device): Fix bug where the
++		device number of the filesystem (instead of the journal)
++		was being dropped into s_journal_dev.
++
++2001-01-15  Theodore Ts'o  <tytso@valinux.com>
++
++	* initialize.c (ext2fs_initialize): Add support for initializing
++		the ext2 superblock for external journal devices.  This
++		basically means we don't bother to allocate any block
++		group descriptors.
++
++	* openfs.c (ext2fs_open): Only open external journal devices if
++		the new flag EXT2_FLAG_JOURNAL_DEV_OK is passed to
++		ext2fs_open.  When opening such devices, don't try to read
++		the block group descriptors, since they're not there.
++
++	* ext2_err.et.in (EXT2_NO_JOURNAL_SB): Add new error code 
++	
++	* mkjournal.c: Export a new function,
++		ext2fs_create_journal_superblock(), which allocates and
++		returns a buffer containing a journal superblock.  This is
++		needed by mke2fs to create an external journal.  Rewrote
++		ext2fs_add_journal_device() so that it no longer creates
++		the external journal, but rather adds a filesystem to an
++		existing external journal.  It handles all of the UUID
++		manipulation.
++
++	* ext2fs.h: List the EXT3_FEATURE_JOURNAL_DEV as a flag supported
++		by the library.  Define the EXT2_FLAG_JOURNAL_DEV_OK.
++		Changed function prototype for ext2fs_add_journal_device().
++		
++2001-01-14  Theodore Ts'o  <tytso@valinux.com>
++
++	* closefs.c (ext2fs_flush): Don't write out anything beyond the
++		 primary superblock if EXT2_INCOMPAT_JOURNAL_DEV is
++		 listed.
++
++2001-01-12  Theodore Ts'o  <tytso@valinux.com>
++
++	* imager.c: Fix gcc -Wall complaints and a series of bugs where
++		retval wasn't set correctly.  (Thanks to Andreas Dilger
++		for pointing this out.)
++
++2001-01-11    <tytso@snap.thunk.org>
++
++	* flushb.c (ext2fs_sync_device): New function which centralizes
++		all of the places which might try to use the BLKFLSBUF
++		or FDFLUSH ioctls (and usually failing to define them
++		since the system header files don't usually do this for
++		us, and we're trying to avoid usage of kernel include
++		files now).
++
++2001-01-10    <tytso@snap.thunk.org>
++
++	* alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, 
++		bmove.c, brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, 
++		dir_iterate.c, expanddir.c, ext2fs.h, ext2fsP.h, fileio.c,
++		finddev.c, get_pathname.c, icount.c, inode.c, irel.h, 
++		irel_ma.c, ismounted.c, link.c, lookup.c, mkdir.c, 
++		mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
++		tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to
++		ext2_ino_t, to protect applications that attempt to
++		compile -D_FILE_OFFSET_BITS=64, since this inexplicably
++		changes ino_t(!?).  So we use ext2_ino_t  to avoid an
++		unexpected ABI change.
++
++2001-01-05    <tytso@snap.thunk.org>
++
++	* dirblock.c (ext2fs_read_dir_block): Fix a potential case where
++		we may overrun allocated memory in case of a corrupted
++		filesystem (or an e2fsck test case :-) when byte-swapping
++		the directory block.
++
++	* ext2fs.h: Indent the #warning to fix gcc -Wall complaint.
++
++	* mkjournal.c (ext2fs_add_journal_device): Fix various gcc -Wall
++		complaints including a missing return 0 at the end of
++		ext2fs_add_journal_device.
++
++2001-01-03    <tytso@snap.thunk.org>
++
++	* Makefile.in: Link in libe2p when creating libext2fs as a shared
++		library, since mkjournal.c now references fsetflags().
++
++	* mkjournal.c (ext2fs_add_journal_inode): Folded in Andreas
++		Dilger's changes (with fixups) to allow on-line creation
++		of a journal file.
++
++	* ext2fs.h, closefs.c (ext2fs_flush): Add new flag,
++		EXT2_FLAG_SUPER_ONLY, which the close routines to only
++		update the superblock, and not the group descriptors.
++
++2000-12-30  Andreas Dilger  <adilger@turbolinux.com>
++
++	* ismounted.c: add ext2fs_check_mount_point() function, which will
++		optionally return the mount point of a device if mounted
++
++2000-12-14  Andreas Dilger  <adilger@turbolinux.com>
++
++	* mkjournal.c: rename ext2fs_add_journal_fs() to the more descriptive
++		ext2fs_add_journal_inode()
++
++2001-01-01    <tytso@snap.thunk.org>
++
++	* ext2fs.h: Remove definition of ext2fs_sb.  Note: this may break
++		source (but not binary) compatibility of some users of the
++		ext2 library.  They should just simply do a global search
++		and replace of struct ext2fs_sb with struct
++		ext2_super_block, and use their own private copy of
++		ext2_fs.h if they aren't already.
++
++	* closefs.c, initialize.c, link.c, newdir.c, openfs.c, swapfs.c:
++		Replace use of ext2fs_sb with ext2_super_block.
++
++2000-12-31    <tytso@snap.thunk.org>
++
++	* ext2fs.h: Cleaned up header file by removing definitions of
++		feature flags that might not have been defined in older
++		ext2 header files.  Now that we're using our own
++		include/linux/ext2fs.h header file, this can never happen.
++
++	* jfs_dat.h: Removed old header file which is no longer needed.
++
++2000-12-13  Theodore Ts'o  <tytso@valinux.com>
++
++	* closefs.c (ext2fs_update_dynamic_rev): New function suggested
++		by Andreas Dilger to update the filesystem revision to
++		EXT2_DYNAMIC_REV.
++
++	* swapfs.c (ext2fs_swap_super): Add byte swapping for the journal
++		fields.
++
++2000-12-09    <tytso@snap.thunk.org>
++
++	* ext2fs.h, mkjournal.c (ext2fs_add_journal_inode,
++		ext2fs_add_journal_device): Add a new argument to the APIs
++		of these function, which is a flags word.  This is used to
++		allow the creation of a V1 superblock for those folks who
++		are using ext3 0.3b in production.  Note, the user-land
++		interface for getting at this flag won't be documented, as
++		the V1 superblock is deprecated.
++
++	* mkjournal.c (init_journal_superblock): Sync Stephen's changes
++		which creates a V2 superblock instead of a V1 superblock.
++
++2000-11-21    <tytso@snap.thunk.org>
++
++	* test_io.c (test_write_blk, test_write_byte): Fix typos pointed
++		out by Andreas Dilger.
++
++2000-11-05    <tytso@snap.thunk.org>
++
++	* imager.c (ext2fs_image_{inode,super,bitmap}_{read,write},
++		ext2_fs.h, Makefile.in: New file that has routines that
++		save ext2fs metadata to a file.
++
++	* ext2_err.et.in (EXT2_ET_MAGIC_E2IMAGE): New error code assigned.
++
++	* e2image.h: New file which defines the file format for the ext2
++		image file.  (Saved copy of ext2 metadata to a file as a
++		saving throw against worst-case damage.)
++
++2000-11-01    <tytso@snap.thunk.org>
++
++	* inode.c (ext2fs_flush_icache): Add new function
++		ext2fs_flush_icache() which flushes the internal inode
++		cache.  Applications which modify the inode table blocks
++		directly must call this function.
++
++2000-10-26    <tytso@snap.thunk.org>
++
++	* mkjournal.c: Add #include of netinet/in.h, since Solaris
++		requires it for ntohl().
++
++	* ext2_io.h (io_channel_write_byte): Add new interface to allow
++		callers to write specific byte ranges.  This is an
++		optional interface, which not all IO channels may
++		implement.
++
++	* unix_io.c (unix_write_byte):
++	* test_io.c (test_write_byte): Add implementation of the
++		write_byte function.
++
++	* closefs.c (write_primary_superblock, ext2fs_flush): Add a new
++		function which writes the primary superblock.  If the IO
++		channel supports writing raw bytes directly, only fields
++		which were modified are written to the disk.  This makes
++		it safe(r) to use utilities like tune2fs on a mounted
++		filesystem. 
++
++	* freefs.c (ext2fs_free): Free the original superblock if it is
++		available. 
++
++	* openfs.c (ext2fs_open): Store a copy of the original superblock
++		when opening it.
++
++	* ext2fs.h: Add a field to store the original superblock in the
++		ext2 context structure.
++
++2000-10-24    <tytso@snap.thunk.org>
++
++	* llseek.c: Add #ifdef's for IA64 (it's a 64-bit platform, so we
++		don't need to use llseek).
++
++2000-10-24    <tytso@valinux.com>
++
++	* Makefile.in, ext2fs.h, jfs_dat.h, mkjournal.c: Add functions for
++		creating an ext3 journal on a filesystem.
++
++2000-08-21    <tytso@valinux.com>
++
++	* ext2_err.et.in (EXT2_JOURNAL_NOT_BLOCK): Add new error code.
++
++2000-08-22    <tytso@valinux.com>
++
++	* unix_io.c: Make massive changes to support a multiple block
++		writethrough cacheing.
++
++	* ext2_io.h: Added flags field to the io_channel structure.
++
++2000-08-19    <tytso@valinux.com>
++
++	* finddev.c, ext2fs.h, Makefile.in: Add new file, finddev.c, which
++		provides the function ext2fs_find_block_device().  This
++		function returns the pathname to a block device, given its
++		device number.
++
++2000-07-13    <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.19
++
++2000-07-07  Theodore Ts'o  <tytso@valinux.com>
++
++	* ext2fs.h (EXT2_LIB_FEATURE_INCOMPAT_SUPP): Add
++		EXT3_FEATURE_INCOMPAT_RECOVER (aka needs_recovery) to the
++		list of filesystem flags supported by the library.
++
++2000-07-04  Theodore Ts'o  <tytso@valinux.com>
++
++	* ext2fs.h: Update to include latest journalling additions to the
++		superblock.
++
++	* dll/jump.funcs: Add new jumptable entries for
++		ext2fs_write_bb_FILE, ext2fs_read_bb_FILE2, and
++		ext2fs_badblocks_equal.
++
++	* tst_badblocks.c: Update test program to test
++		ext2fs_read_bb_FILE2 and ext2fs_write_FILE.
++
++	* write_bb_file.c (ext2fs_write_bb_FILE): New function which
++		writes out bad blocks list to a file.
++
++	* read_bb_file.c (ext2fs_read_bb_FILE2): Add new function which
++		changes the callback function to take two additional
++		arguments; a private blind pointer supplied by the caller,
++		and pointer to a char * containing a pointer to the
++		invalid string.
++
++	* badblocks.c (ext2fs_badblocks_equal): Add new function which
++		returns true if two badblocks list are equal.
++
++	* Makefile.in: Remove explicit link of -lc in the shared library.
++		(It shouldn't be necessary, and is harmful in some cases).
++
++2000-06-10  Theodore Ts'o  <tytso@valinux.com>
++
++	* getsize.c (main): Add debugging code under #ifdef DEBUG
++
++2000-05-27  Theodore Ts'o  <tytso@valinux.com>
++
++	* mkdir.c (ext2fs_mkdir): Read the parent directory's inode
++		earlier, so that if there's an error reading it, we can
++		more cleanly back out of the operation.
++
++2000-05-25    <tytso@snap.thunk.org>
++
++	* getsize.c (ext2fs_get_device_size): Use open64() instead of
++		open() if it exists.  Under linux, manually define the
++		ioctl for BLKGETSIZE if it isn't already defined and it's
++		safe to do so.
++
++	* unix_io.c (unix_open): Use open64() instead of open() if it
++		exists. 
++
++	* llseek.c: Simplify header includes of unistd.h.  If lseek64 is
++		available (and prototypes are defined) use it in
++		preference to llseek.
++
++	* Makefile: Add hack dependency rule so that parallel makes work
++		correctly. 
++
++2000-05-18  Theodore Ts'o  <tytso@valinux.com>
++
++	* ext2fs.h: Add appropriate ifdef's to support C++ compilation.
++
++2000-04-03  Theodore Ts'o  <tytso@valinux.com>
++
++	* block.c: Readibility tweak in conditionals involving
++		ctx->fs->flags.
++
++	* ext2fs.h: Use AUTOCONF SIZEOF_* macros if available to determine
++		how to define __s64 and __u64.  Turn off "compression is
++		experimental" warning if the cpp macro
++		I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL is defined.
++
++2000-02-11    <tytso@snap.thunk.org>
++
++	* ext2fs.h: Define EXT2FS_COMPRESSED_BLKADDR and HOLE_BLKADDR.
++		Conditionally include Compression as a supported type if
++		ENABLE_COMPRESSION (via --enable-compression) is turned on.
++
++	* swapfs.c (ext2fs_swap_super): Swap the compression usage bitmap.
++
++2000-02-08    <tytso@snap.thunk.org>
++
++	* bitops.h (ext2fs_mark_generic_bitmap, ext2fs_unmark_generic_bitmap,
++		ext2fs_mark_block_bitmap, ext2fs_unmark_block_bitmap,
++		ext2fs_mark_inode_bitmap, ext2fs_unmark_inode_bitmap):
++		Change to return the previous state of the bit that is
++		being marked or unmarked.  For speed optimization.
++	
++2000-02-02  Theodore Ts'o  <tytso@valinux.com>
++
++	* getsize.c, ismounted.c: Remove unneeded include of linux/fs.h
++
++	* swapfs.c: Remove #ifdef HAVE_EXT2_INODE_VERSION since it's not
++		needed any more; we know it will always be i_generation.
++		Add support for swapping the high bits of the uid and gid.
++
++1999-11-19    <tytso@valinux.com>
++
++	* mkdir.c (ext2fs_mkdir): Only update the parent's inode link
++		counts if the link was successful.  Patch suggested by
++		jeremy@goop.org.
++
++	* Makefile.in (distclean): Remove TAGS and Makefile.in.old from
++		the source directory.
++
++1999-11-10    <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.18
++
++1999-11-08    <tytso@valinux.com>
++
++	* Makefile.in (tst_badblocks): Add freefs.o to the object list,
++		since ext2fs_badblocks_list_free was moved to freefs.c.
++
++	* tst_badblocks.c: Use the newer badblocks API names.  Add
++		duplicate blocks to the test inputs to test dealing with
++		adding blocks which are already in the badblocks list.
++
++	* badblocks.c (ext2fs_badblocks_list_add): If appending to the end
++		of the list, use a shortcut O(1) operations instead of an
++		O(n) operation.  (Idea suggested by David Beattie.)
++
++	* freefs.c (ext2fs_free): Use ext2fs_badblocks_list_free() instead
++		of badblocks_list_free(), to save a procedure call.
++
++1999-10-26    <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.17
++
++1999-10-26    <tytso@valinux.com>
++
++	* ext2fs.h: Add kludge to deal with the fact that egcs cpp doesn't
++		seem to handle ~0UL the same way as they used to.
++
++1999-10-25    <tytso@valinux.com>
++
++	* nt_io.c (_OpenNtName): Open the device using
++		FILE_SYNCHRONOUS_IO_NONALERT instead of
++		FILE_SYNCHRONOUS_IO_ALERT
++		(nt_open): At the end of the device open routine, unlock 
++		the drive but do not dismount it.
++
++	* initialize.c (CREATOR_OS): Use __GNU__ instead of __gnu__ to
++		detect the Hurd OS.
++
++1999-10-22    <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.16
++
++1999-10-22    <tytso@valinux.com>
++
++	* mkdir.c (ext2fs_mkdir): Pass EXT2_FT_DIR flag to ext2fs_link().
++
++	* link.c (ext2fs_link): This call now uses the low three bits of
++		the flags parameter to pass the directory filetype
++		information; it will set the directory entry FILETYPE
++		information if the filesystem supports it.
++
++	* newdir.c (ext2fs_new_dir_block): If the FILETYPE superblock
++		option is set, then create the '.' and '..' entries with
++		the filetype set to EXT2_FT_DIR.
++
++1999-09-24    <tytso@valinux.com>
++
++	* nt_io.c: New file which supports I/O under Windows NT.
++
++1999-09-07    <tytso@valinux.com>
++
++	* ext2fs.h: Add new fields for journalling and define new
++		feature bits used by newer filesystems: IMAGIC_INODES,
++		HAS_JOURNAL, RECOVER.
++
++	* expanddir.c (ext2fs_expand_dir, expand_dir_proc): Change where
++		we update the inode block count and size files so that the
++		block count field is updated correctly when we create an
++		indirect block.
++
++1999-07-18  Theodore Ts'o  <tytso@valinux.com>
++
++	* Release of E2fsprogs 1.15
++
++1999-06-23    <tytso@valinux.com>
++
++	* swapfs.c (ext2fs_swap_inode): Add compatibility for Linux 2.3
++		kernels that use i_generation instead of i_version.  Patch
++		supplied by Jon Bright <sircus@sircus.demon.co.uk>.
++
++1999-06-21    <tytso@valinux.com>
++
++	* dir_iterate.c (ext2fs_process_dir_block): Check for corrupted
++		directory entry before calling the callback function.
++		This should prevent some core dumps of insufficiently
++		paranoid callback functions.
++
++1999-05-29    <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: Add feature definition for AFS IMAGIC inodes.
++
++	* fileio.c (ext2fs_file_open): Remove obsolete comment stating
++		that we don't handle writing yet (we do).  Fixed bug where
++		we weren't allocating a big enough buffer for ext2_bmap.
++
++1999-05-03    <tytso@rsts-11.mit.edu>
++
++	* openfs.c (ext2fs_open): Check to make sure that the number of
++		blocks per group is not zero --- if so, it must be a bad
++		superblock!
++
++1999-01-09  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs 1.14
++
++1999-01-07  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_read_inode, ext2fs_write_inode): Check to see if
++		the inode number is zero; if it's zero, return
++		EXT2_ET_BAD_INODE_NUM.
++
++1998-12-30  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Use EXT2_FIRST_INODE instead
++		of EXT2_FIRST_INO to ensure compatibility with Linux 1.2
++		header files.
++
++Mon Jan  4 02:32:09 1999  Theodore Y. Ts'o  <tytso@mit.edu>
++
++	* llseek.c (ext2fs_llseek): Change ext2fs_llseek() in the
++ 		non-Linux case to use EINVAL by default, unless it isn't
++ 		defined, in which case we use EXT2_ET_INVALID_ARGUMENT
++ 		instead.
++
++1998-12-15  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs 1.13
++
++1998-12-03  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Makefile.in: Updated dependencies.
++
++1998-09-22  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Make sure that we allocate
++		enough inodes so that we can make a valid filesystem.
++
++1998-09-02  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* rw_bitmaps.c: Fixed signed/unsigned warnings.
++
++	* fileio.c (ext2fs_file_set_size): Remove unneeded extern from the
++		function declaration.
++
++	* dblist.c (make_dblist): Add safety check in case the dblist
++		pointer passed in is null (in which case, assign it to
++		fs->dblist).  Fixed some signed/unsigned warnings.
++
++	* bmap.c: Make addr_per_block be of type blk_t to avoid
++		signed/unsigned warnings.
++
++	* namei.c (ext2fs_follow_link): Remove uneeded extern from the
++		function declaration.
++
++	* get_pathname.c (get_pathname_proc): Use return value from
++		ext2fs_get_mem, instead of checking if &gp->name is
++		NULL.
++
++	* dir_iterate.c (ext2fs_process_dir_block): 
++	* dblist_dir.c (ext2fs_dblist_dir_iterate): Remove uneeded extern
++		from the function declaration.
++
++	* block.c (ext2fs_block_iterate2): If the read_inode call fails,
++		return the error directly instead of jumping to the
++		cleanup routine, since we don't need to do any cleanup.
++
++	* alloc_table.c (ext2fs_allocate_group_table): Make this
++		function take a dgrp_t for its group argument.
++
++	* ext2fs.h: Make dgrp_t an __u32 type, and make
++		fs->desc_group_count be of type dgrp_t.
++
++1998-07-27  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* badblocks.c (ext2fs_badblocks_list_add): Use a bigger increment
++		than 10 blocks when we need to expand the size of the
++		badblocks list.
++
++1998-07-09  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs 1.12
++
++1998-06-30  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* closefs.c (ext2fs_flush): Update the s_block_group_nr field as
++		appropriate for all of the block group copies, so that
++		it's clear where the beginning of the filesystem is on the
++		disk.  (For when the partition table gets scrod.)
++
++	* ext2fs.h: Change the name of the feature from
++		EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE to
++		EXT2_FEATURE_INCOMPAT_FILESIZE (to match with the kernel).
++
++1998-06-18  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (get_next_blockgroup): Fix bug where if
++		get_next_blockgroup() is called early because of a missing
++		inode table in a block group, the current_inode counter
++		wasn't incremented correctly.
++
++1998-06-16  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* read_bb.c (ext2fs_read_bb_inode): Make function more robust
++		against a completely trashed bad block inode.
++
++1998-06-10  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* alloc_tables.c (ext2fs_allocate_group_table): Fix bug so that if
++		the stride length hits a bad value, we retry the block
++		allocation starting at the beginning of the block group.
++
++	* ext2fs.h, bb_inode.c, block.c, bmove.c, dir_iterate.c,
++		expanddir.c, ext2fsP.h, read_bb.c: Change blkcnt_t to be
++		e2_blkcnt_t to avoid collision with LFS API.
++
++1998-05-01  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Initialize s_inodes_count in a
++		way that avoids overflows on disk sizes greater than 4GB.
++
++1998-04-28  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: Define EXT2_QSORT_TYPE appropriately for the
++		return type for comparison functions for qsort.
++
++	* dblist.c (dir_block_cmp): Use EXT2_QSORT_TYPE in function
++		declaration.
++
++1998-04-26  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h, bitops.h: Add support for the Watcom C compiler to do
++		inline functions.
++
++	* ext2fs.h, dosio.c: Use asm/types.h instead of linux/types.h to
++		evade a potential problem with glibc's header files trying
++		to spike out linux/types.h.
++
++	* ext2fs.h (ext2fs_resize_mem): Change the function prototype to
++		include the old size of the memory, which is needed for
++		some braindamaged memory allocation systems that don't
++		support realloc().
++
++	* badblocks.c (ext2fs_badblocks_list_add):
++	  bb_inode.c (clear_bad_block_proc):
++	  dblist.c (ext2fs_add_dir_block):
++	  icount.c (insert_icount_el):
++	  irel_ma.c (ima_put):
++	  rs_bitmap.c (ext2fs_resize_generic_bitmap): Update functions to
++		  pass the old size of the memory to be resized to
++		  ext2fs_resize_mem(). 
++
++1998-03-30  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Makefile.in: Change to use new installation directory variables
++		convention.  Fix uninstall rules to take $(DESTDIR) into
++		account.
++
++1998-03-29  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: If __STRICT_ANSI__ is defined and we're on a platform
++		with 32 bit longs, then we need to manually define __s64
++		and __u64, since the current kernel header files don't
++		define these if __STRICT_ANSI__ is defined.  This is a
++		problem if we are compiling with full GCC warnings, since
++		we do need 64 bit support.
++	
++	* Makefile.in (OBJS): Remove bmove.o from files to be built,
++		since we're not using ext2fs_move_blocks() and there
++		is some question as to its usefulness in its current
++		form.
++
++	* bmap.c (block_bmap): Remove unused function.
++
++	* bmove.c (process_block): Fix -Wall warning.
++
++1998-03-23  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* block.c (ext2fs_block_iterate3): Make the ref_offset field
++		contain the offset into the inode.i_blocks array when
++		ref_block is zero.  Since we haven't done a formal
++		release of e2fsprogs since block_iterate2 was first
++		introduced, I removed block_iterate2, and renamed
++		block_iterate3 to be block_iterate2.
++
++	* bb_inode.c, bmove.c, dblist_dir.c, dir_iterate.c,
++		expanddir.c, ext2fs.h, ext2fsP.h, read_bb.c: Change
++		use of block_iterate and block_iterate2 to
++		block_iterate2 with the new prototype for the
++		interator function.  (using blkcnt_t forr blockcount)
++
++1998-03-21  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: Add new superblock fields (s_algorithm_usage_bitmap, 
++		s_prealloc_blocks, s_prealloc_dir_blocks).  Added
++		conditional defines of new features COMPAT_DIR_PREALLOC,
++		RO_COMPAT_LARGE_FILE RO_COMPAT_BTREE_DIR,
++		INCOMPAT_COMPRESSION, INCOMPAT_DIRNAME_SIZE.  Changed
++		the library to declare that we support COMPAT_DIR_PREALLOC, 
++		INCOMPAT_DIRNAME_SIZE, RO_COMPAT_LARGE_FILE.
++
++	* fileio.c: Rename function ext2fs_file_llseek to be
++		ext2fs_file_lseek, which is more accurate.
++
++	* block.c: Add new function ext2fs_block_iterate3 which calls
++		the iterator function with the blockcount argument of
++		type blkcnt_t.  This version of the function is
++		allowed to handle large files; the other fucntions are
++		not.
++
++	* ext2fs.h: Add new type blkcnt_t
++
++	* ext2_err.et.in: Add error code EXT2_ET_FILE_TOO_BIG
++
++	* block.c (ext2fs_block_iterate2): Fix bug where the block count
++		field wasn't getting correctly incremented for sparse
++		files when the indirect or doubly-indirect block
++		specified in the inode was zero.
++
++Sun Mar  8 22:42:47 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* unlink.c (unlink_proc): 
++	* lookup.c (lookup_proc): 
++	* link.c (link_proc): 
++	* get_pathname.c (get_pathname_proc): 
++	* dir_iterate.c (ext2fs_process_dir_block): Mask off high 8 bits
++		from dirent->name_len, so it can be used for other
++		purposes.
++
++	* ext2fs.h: Add definition of EXT2_FEATURE_INCOMPAT_DIRNAME_SIZE,
++		and indicate that we have support for this incompatible
++		option.
++
++Mon Feb 23 08:46:33 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2_err.et.in: Added new error code, EXT2_ET_CANCEL_REQUESTED.
++
++Fri Feb 20 23:58:01 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dblist.c (ext2fs_get_num_dirs): Improve the estimation of the
++ 		number of directories when the block group information is
++ 		unreliable.
++
++1998-02-20  Theodore Y. Ts'o  <tytso@edt.mit.edu>
++
++	* inode.c (ext2fs_get_next_inode): Always do the check to see if the
++		inode table is missing so that we catch the case where the
++		first block group is missing.
++
++	* getsize.c, ismounted.c, unix_io.c: #include errno.h since it's
++		needed.
++
++Mon Feb 16 16:16:00 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2_io.h, ext2fs.h: Protect against being included multiple times.
++
++	* bmove.c: #include ext2fsP.h instead of "ext2fs/ext2fs.h"
++
++	* test_io.c (test_flush): Add a debugging printf when the flush
++		method is called.
++
++	* rw_bitmaps.c (ext2fs_read_bitmaps): If the bitmaps are already
++		read in, return right away.
++
++Sun Feb  1 08:20:24 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* bitops.h: Don't try to do i386 inline asm functions if the
++ 		compiler isn't GCC.
++
++	* ext2fs.h: If EXT2_FLAT_INCLUDES is defined, #include e2_types.h,
++ 		instead of linux/types.h, and e2_bitops.h instead of
++ 		ext2fs/bitops.h.
++
++	* icount.c, version.c: Don't #include <et/com_err.h>, as it isn't
++		necessary. 
++
++Sat Jan 17 13:13:31 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_open_inode_scan): Initialize the group variables
++		so that we don't need to call get_next_blockgroup() the
++		first time around.  Saves a bit of time, and prevents us
++		from needing to assign -1 to current_group (which is an
++		unsigned value).
++
++	* icount.c (insert_icount_el): Cast the estimated number of inodes
++		from a float to an ino_t.
++
++	* alloc.c, alloc_tables.c, badlbocks.c, bb_compat.c, bb_inode.c,
++ 		bitmaps.c, bitops.c, block.c, bmap.c, bmove.c, brel_ma.c,
++ 		check_desc.c, closefs.c, cmp_bitmaps.c, dblist.c,
++ 		dblist_dir.c, dir_iterate.c, dirblock.c, dupfs.c,
++		expanddir.c, ext2fs.h, fileio.c, freefs.c,
++		get_pathname.c, getsize.c, icount.c, initialize.c,
++		inline.c, inode.c, irel_ma.c, ismounted.c, link.c,
++		lookup.c, mkdir.c, namei.c, native.c, newdir.c,
++		openfs.c, read_bb.c, read_bb_file.c, rs_bitmap.c,
++		rw_bitmaps.c, swapfs.c, test_io.c, tst_badblocks.c,
++		tst_getsize.c, tst_iscan.c, unix_io.c, unlink.c,
++		valid_blk.c, version.c: If EXT2_FLAT_INCLUDES is
++		defined, then assume all of the
++ 		ext2-specific header files are in a flat directory.
++
++	* block.c, bmove.c, dirblock.c, fileio.c: Explicitly cast
++		all assignments from void * to be compatible with C++.
++
++Tue Jan  6 11:28:15 1998  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* closefs.c (ext2fs_flush): Add a call to io_channel_flush() to
++		make sure the contents of the disk are flushed to disk.
++
++Mon Dec 29 14:39:13 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dblist.c (ext2fs_add_dir_block): Change new to be new_entry to
++		avoid C++ namespace clash.
++
++	* bitmaps.c (ext2fs_copy_bitmap): Change new to be new_map to
++		avoid C++ namespace clash.
++
++	* ext2fs.h, bb_inode.c, block.c, bmove.c, brel.h, brel_ma.c,
++ 	 	irel.h, irel_ma.c, dblist.c, dblist_dir.c, dir_iterate.c,
++ 	 	ext2fsP.h, expanddir.c, get_pathname.c, inode.c, link.c,
++ 	 	unlink.c: Change private to be priv_data (to avoid C++
++ 	 	namespace clash)
++
++Fri Nov 28 09:26:31 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more
++		paranoid about validating the directory counts from the
++		block group information.
++
++	* all files: Don't include stdlib.h anymore; include it in
++		ext2_fs.h, since that file requires stdlib.h
++
++Thu Nov 20 16:07:38 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* expanddir.c (ext2fs_expand_dir): Check to make sure the block
++		bitmap is loaded, and return an error if it is not.
++		(expand_dir_proc): Only use ext2fs_write_dir_block when
++		writing a directory block, not when writing out a fresh
++		indirect block.
++
++Tue Nov 11 22:46:45 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Makefile.in, tst_getsize.c: Added new file which is used to test
++		the ext2fs_get_device_size function.
++
++	* ext2_err.et.in (EXT2_ET_UNIMPLEMENTED): Added new error code.
++
++Sun Nov  2 20:36:13 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: Make ext2fs_get_mem take an unsigned argument.
++
++	* fileio.c (ext2fs_file_get_size, ext2fs_file_set_size,
++		ext2fs_file_get_fs): New functions added.
++
++
++Fri Oct 31 12:16:52 1997    <tytso@EDT.MIT.EDU>
++
++	* bitops.c (ext2fs_warn_bitmap, ext2fs_warn_bitmap2): Don't call
++	 	com_err if OMIT_COM_ERR is defined.
++
++Thu Oct 30 11:33:57 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Rename new error codes to _ET_ in them for consistency.
++
++Sat Oct 25 00:06:58 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* [all files, basically]: Added definition of ext2fs_get_mem, 
++		ext2fs_free_mem, and ext2fs_resize_mem in ext2fs.h, and
++		changed all library routines to use these wrapper functions.
++
++	* dblist.c, mkdir.c: use EXT2_DIR_EXISTS and EXT2_DB_NOT_FOUND
++		instead of the system error messages.
++	
++	* ext2_err.et.in: Added new error messages EXT2_DIR_EXISTS and
++	 	EXT2_DB_NOT_FOUND
++
++	* ext2fs.h: Added function declarations and constants for bmap.c
++	 	and fileio.c.
++
++	* ext2_err.et.in: Added new error messages EXT2_FILE_RO and
++	 	EXT2_ET_MAGIC_EXT2_FILE
++
++	* Makefile.in: Added files bmap.c and fileio.c, and temporarily
++		commented out brel_ma.c and irel_ma.c
++
++	* bmap.c: New file which maps a file's logical block number to its
++		physical block number.
++
++	* fileio.c: New file which implements simple file reading and
++		writing primitives.
++
++	* alloc.c (ext2fs_alloc_block): New function which allocates a
++ 		block, zeros it, and updates the filesystem accounting
++ 		records appropriately.
++
++Wed Oct 22 16:47:27 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2_err.et.in: Added new error codes: EXT2_NO_MEMORY,
++		EXT2_INVALID_ARGUMENT, EXT2_BLOCK_ALLOC_FAIL,
++		EXT2_INODE_ALLOC_FAIL, EXT2_NOT_DIRECTORY
++
++	* Change various library files to use these functions instead of
++		EINVAL, ENOENT, etc.
++
++Mon Oct 20 19:32:40 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* llseek.c: Check HAVE_LLSEEK_PROTOTYPE to see whether or not we
++		need to declare llseek().
++
++Sun Oct 19 18:56:22 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Rename io.h to be ext2_io.h (avoid namespace collisions)
++
++	* Add #ifdef's for HAVE_SYS_STAT_H and HAVE_SYS_TYPES_H
++
++Fri Oct  3 13:35:59 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* llseek.c (ext2fs_llseek): Fix type error for ext2fs_llseek()
++
++	* icount.c (ext2fs_icount_validate): 
++	* bmove.c (process_block): Fix lint error in type for fprintf().
++
++Mon Sep 15 11:45:09 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_check_directory): Add support for the callback
++		to return the error code EXT2_ET_CALLBACK_NOTHANDLED.
++
++Thu Sep  4 12:28:22 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* bitmaps.c (ext2fs_set_bitmap_padding): New function which sets the
++		padding of the bitmap to be all one's.
++
++Wed Sep  3 14:27:30 1997  Theodore Y. Ts'o  <tytso@edt.mit.edu>
++
++	* llseek.c: Added missing semicolon to glibc fixup declaration of
++ 	llseek().
++
++	* bmove.c: Add #include of errno.h
++
++Sat Aug 23 22:47:46 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Makefile.in (ELF_SO_VERSION): Bump version to be 2.4 since we've
++		added a new field to the io_channel (app_data).
++
++	* io.h: Add a new element to the io_channel structure, app_data.
++
++	* initialize.c, openfs.c: Set io->app_data to point at the
++	 	filesystem handle.
++
++Thu Aug 14 08:14:17 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* io.h: Change the prototype of ext2fs_llseek() to use int's
++		instead of unsigned int's.
++
++	* llseek.c: Change to allow PIC and !HAVE_LLSEEK.  Add a prototype
++		to make life easer for GNU Libc 2.
++
++	* rw_bitmaps.c: On the PowerPC, the big-endian variant of the ext2
++ 		filesystem has its bitmaps stored as 32-bit words with bit
++ 		0 as the LSB of each word.  Thus a bitmap with only bit 0
++ 		set would be, as a string of bytes, 00 00 00 01 00 ...  To
++ 		cope with this, we byte-reverse each word of a bitmap if
++ 		we have a big-endian filesystem, that is, if we are *not*
++ 		byte-swapping other word-sized numbers.
++
++Mon Aug 11 03:30:48 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dosio.c: New file to do DOS/BIOS disk accesses.
++
++	* namei.c (open_namei): Make pathlen be of type size_t.
++
++	* llseek.c: Always #include stdlib.h since it's need to define
++		size_t.  
++
++	* io.h: Use errcode_t for magic numbers.
++
++	* icount.c (get_icount_el): Use size_t where appropriate
++	
++	* dupfs.c (ext2fs_dup_handle): 
++	* dblist.c (dir_block_cmp): Use size_t where appropriate.
++
++	* read_bb.c (ext2fs_read_bb_inode): 
++	* cmp_bitmaps.c (ext2fs_compare_inode_bitmap): Use blk_t, ino_t
++		and size_t where appropriate.
++
++	* closefs.c (ext2fs_flush): Use dgrp_t instead of int where
++		appropriate.
++
++	* openfs.c (ext2fs_open): 
++	* check_desc.c (ext2fs_check_desc): Use blk_t instead of int where
++		appropriate.
++
++	* rw_bitmaps.c (read_bitmaps): 
++	* irel_ma.c: 
++	* inode.c (ext2fs_write_inode): 
++	* initialize.c (ext2fs_initialize):
++	* brel_ma.c: Fix to make be 16-bit safe.
++
++	* link.c (ext2fs_link): 
++	* unlink.c (ext2fs_unlink):
++	* lookup.c (lookup_proc): 
++	* ismounted.c (ext2fs_check_if_mounted): 
++	* block.c (xlate_func): Add #pragma argsused for Turbo C.
++
++Sun Aug 10 10:05:22 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* block.c (ext2fs_block_iterate2): Use retval which is a errcode_t
++		type.
++
++	* bitmaps.c (make_bitmap): Use size_t instead of int where
++		appropriate.
++
++	* bb_inode.c (set_bad_block_proc): Add #pragma argsused for Turbo C.
++
++	* alloc.c (ext2fs_new_inode): Use ino_t instead of int for the
++		group number.
++
++	* get_pathname.c: Use ino_t instead of int where appropriate.
++
++	* ext2fs.h: Make the magic structure element be errcode_t instead
++		of int.
++
++	* alloc.c alloc_tables.c badblocks.c bb_compat.c bb_inode.c
++ 	 	bitmaps.c block.c bmove.c brel_ma.c check_desc.c closefs.c
++ 	 	cmp_bitmaps.c dblist.c dblist_dir.c dir_iterate.c
++ 	 	dirblock.c dupfs.c expanddir.c freefs.c get_pathname.c
++ 	 	icount.c initialize.c inline.c inode.c irel_ma.c link.c
++ 	 	llseek.c lookup.c mkdir.c namei.c newdir.c read_bb.c
++ 	 	read_bb_file.c rs_bitmap.c rw_bitmaps.c swapfs.c 
++ 	 	test_io.c tst_badblocks.c tst_iscan.c unix_io.c unlink.c
++ 	 	valid_blk.c version.c: Add an #ifdef for HAVE_UNISTD_H
++
++Tue Jun 17 01:33:20 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* unix_io.c (unix_read_blk): If ext2fs_llseek() fails, but errno
++		is zero, then return EXT2_IO_LLSEEK_FAILED.
++
++	* ext2_err.et.in: Add a new error code, EXT2_IO_LLSEEK_FAILED.
++
++	* Release of E2fsprogs 1.11
++
++Mon Jun 16 23:53:06 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dblist.c (ext2fs_dblist_count): Added new function which returns
++		the number of directory blocks in dblist.
++
++Sat Jun 14 01:39:13 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* unix_io.c (unix_flush): Make the io_channel flush function do a
++		fsync to flush the kernel buffers to disk.
++
++Wed Jun 11 18:25:31 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_inode_scan_goto_blockgroup): Fix bug; the
++		current inode number wasn't being set by the
++		goto_blockgroup function.
++
++Mon Jun  9 10:45:48 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* bmove.c (ext2fs_move_blocks): New function which takes a bitmap
++		of blocks which need to be moved, and moves those blocks
++		to another location in the filesystem.
++
++	* rs_bitmap.c (ext2fs_resize_generic_bitmap): When expanding a
++		bitmap, make sure all of the new parts of the bitmap are
++		zero. 
++
++Sun Jun  8 16:24:39 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* bitmaps.c (ext2fs_copy_bitmap): Fix bug; the destination bitmap
++		wasn't being returned to the caller.
++
++	* alloc_tables.c (ext2fs_allocate_group_table): Add new function
++		ext2fs_allocate_group_table() which sets the group tables
++		for a particular block group.  The relevant code was
++		factored out of ext2fs_allocate_tables().
++
++	* dblist.c (make_dblist): Adjust the initial size of the directory
++ 		block list to be a bit more realistic (ten plus twice the
++ 		number of directories in the filesystem).
++
++Thu May  8 22:19:09 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* badblocks.c (ext2fs_badblocks_list_test): Fix bug where
++ 		ext2fs_badblocks_list_test would test the list (and exceed
++ 		array boundaries) if there were no bad blocks on the bad
++ 		blocks list.  (Showed up when user tried: mke2fs -c -b 4096).
++
++Thu Apr 24 12:16:42 1997  Theodre Ts'o  <tytso@localhost.mit.edu>
++
++	* Release of E2fsprogs version 1.10
++
++Thu Apr 24 10:13:42 1997  Theodre Ts'o  <tytso@localhost.mit.edu>
++
++	* alloc_tables.c (ext2fs_allocate_tables): Correctly place the
++		inode and block bitmaps based on the RAID 0 stride
++		parameter (which is passed by mke2fs).
++
++	* ext2fs.h: Add "stride" parameter to ext2_filsys, to be used by
++ 		mke2fs to communicate the stride length to
++ 		ext2fs_allocate_tables()
++
++Wed Apr 23 21:50:42 1997  Theodre Ts'o  <tytso@localhost.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Fix to compile under Linux 1.2
++		systems.  (We can't assume that the new filesystem types
++		are supported.)
++
++Wed Apr 23 18:40:53 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* alloc_tables.c (ext2fs_allocate_tables): Make sure that we
++		allocate the inode and block bitmaps inside block group at
++		all times.
++
++Mon Apr 21 00:06:28 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* alloc.c (ext2fs_new_block): Fix bug where if goal==0 and the
++		filesystem has no free blocks, ext2fs_new_block would loop
++		forever.
++
++	* dupfs.c (ext2fs_dup_handle): Duplicate an ext2 filesystem handle
++
++	* freefs.c (ext2fs_free_inode_cache): Decrement refcount and only
++		free if refcount goes to zero.
++
++	* inode.c (create_icache): Initialize refcount to 1.
++
++	* ext2fsP.h: Added refcount to ext2_inode_cache
++
++	* dblist.c (ext2fs_copy_dblist): New function to copy a directory
++		block list.
++
++	* badblocks.c (ext2fs_badblocks_copy): New function to copy a
++		badblocks structure.
++
++Sun Apr 20 23:19:51 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* bitmaps.c (ext2fs_copy_bitmap): New function to copy a bitmap.
++
++	* unix_io.c, test_io.c (unix_open, test_open): Initialize the
++ 	 	refcount to 1.
++		(unix_close, test_close): Decrement the refcount and only
++ 		close the io_channel if the refcount goes to 0.
++
++	* io.h: Add refcount to the io_channel structure.  Add new macro
++		interface io_channel_bumpcount() to bump the refcount.
++
++Thu Apr 17 20:25:03 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_read_inode, ext2fs_write_inode): Use the inode
++		cache in the filesystem handle, instead of the inode cache
++		in a static variable.
++
++	* freefs.c: Added static function to free the inode cache (called by
++		ext2fs_free). 
++
++	* ext2fsP.h: Added definition of the ext2_inode_cache structures.
++
++	* ext2fs.h: Added pointer to the inode_cache structure.
++
++	* block.c (block_iterate_ind, block_iterate_dind, 
++		block_iterate_tind): If there are holes in the indirect,
++		doubly indirect, or triply indirect blocks, increment the
++		block count field automatically.
++
++Thu Apr 17 12:23:38 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.09
++
++Mon Apr 14 20:38:56 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* version.c (ext2fs_parse_version_string): Check the passed in
++		version string (instead of the hard-coded one).
++
++	* alloc_tables.c (ext2fs_allocate_tables): If the last block is
++		greater filesystem size, clamp it to prevent allocating a
++		block or inode bitmap beyond the filesystem.
++
++	* initialize.c (ext2fs_initialize): Fix bug where the metatdata
++	 	overhead calculation was accidentally removed.
++
++Fri Apr 11 18:56:26 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.08
++
++Thu Apr 10 13:15:15 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dblist.c (ext2fs_set_dir_block): New function which sets the
++ 		block of a dblist entry, given the directory inode and
++ 		blockcnt.
++
++Sat Apr  5 12:42:42 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* alloc_tables.c (ext2fs_allocate_tables): Allocate the bitmap and
++		inode bitmaps at staggered locations across the block
++		groups, to avoid concentrating the bitmaps on a small
++		number of disks when using striped RAID arrays.
++
++	* initialize.c (ext2fs_initialize): By default, choose the maximum
++		possible number of blocks per group (based on the size of
++		the bitmaps in the blocksize).
++
++Fri Apr  4 11:28:16 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Add support for
++		EXT2_COMPAT_SPARSE_SUPER feature.
++
++	* closefs.c (ext2fs_bg_has_super): New function to determine
++		whether or a particular block group should have a
++		superblock and block group descriptor.  Used for the
++		EXT2_COMPAT_SPARSE_SUPER feature is turned on.
++		(ext2fs_flush):  Check ext2fs_bg_has_super to see whether
++		or not the superblock should be written out for the block
++		group. 
++
++	* ext2fs.h (EXT2_COMPAT_SPARSE_SUPER): Define compatibility flag
++		for sparse duplicate superblocks.
++
++	* version.c (ext2fs_get_library_version): New function which
++		returns the library version.
++
++	* version.c (ext2fs_parse_version_string): New function which
++		parses a version string and returns a version number,
++		so application programs can compare version numbers as
++		integers.
++
++Wed Mar 26 00:43:52 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* icount.c (ext2fs_create_icount): Change function so that it also
++		takes a new argument which contains a "hint" icount
++		structure.  This "hint" icount allows the create function
++		to set up the sorted list in advance.  This reduces
++		significantly the amount of data moving needed to insert
++		these inodes into the list later.
++	
++	* icount.c (ext2fs_icount_validate): New function which validates
++		that the icount structure's rep invariant.
++
++	* icount.c (get_icount_el): Completely revamped implementation
++		to subsume put_icount_el().  Put_icount_el() used to
++		use an O(N) implementation to insert in the middle
++		of the icount list.  It now uses a O(ln N) to search
++		for where the icount should be inserted, and then uses
++		a memcpy to move the list down (instead of a for loop).
++	
++	* icount.c (ext2fs_icount_fetch, ext2fs_icount_store,
++ 		ext2fs_icount_increment, ext2fs_icount_decrement): Check
++ 		to see if the inode is within bounds; if it isn't, return
++ 		EINVAL.
++
++	* bitops.h (ext2fs_test_generic_bitmap): Fix error message given
++ 		when a bad inode number is passed to test_generic_bitmap
++ 		to be EXT2FS_TEST_ERROR instead of the wrong
++ 		EXT2FS_UNMARK_ERROR.
++
++Wed Mar 12 13:32:05 1997  Theodore Y. Ts'o  <tytso@mit.edu>
++
++	* Release of E2fsprogs version 1.07
++
++Sun Mar  2 16:46:18 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Makefile.in (ELF_VERSION): Change version to be 2.2
++
++Tue Feb 11 14:54:02 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* alloc.c (ext2fs_get_free_blocks): Change routine to use
++	 	ext2fs_fast_test_block_bitmap_range().
++
++	* bitops.h (ext2fs_fast_test_block_bitmap_range,
++ 		ext2fs_test_block_bitmap_range: New inline functions which
++ 		test to see whether a contiguous range of blocks is
++ 		available.
++
++Thu Feb  6 10:00:13 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* badblocks.c (ext2fs_badblocks_list_create): Rename sybmols to use
++ 		use ext2fs_badblocks_* instead of badblocks_*
++
++	* bb_compat.c: New file which translates between old badblocks_*()
++		names to ext2fs_badblocks_*()
++
++	* unlink.c (ext2fs_unlink): New file, moved ext2fs_unlink() from
++	 	link.c (since e2fsck doesn't use ext2fs_unlink()).
++
++	* rs_bitmap.c (ext2fs_resize_generic_bitmap): New file, contains
++ 		bitmap resizing routine moved from bitmaps.c, since e2fsck
++ 		doesn't need to use this function.
++
++	* lookup.c (ext2fs_lookup): Moved ext2fs_lookup to its own file,
++		since e2fsck only needs ext2fs_lookup.
++
++Mon Feb  3 10:11:40 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_open_inode_scan): Set fs->badblocks if it is not
++		already set; this is needed so that programs like dump
++		which use the inode scan functions will deal with
++		filesystems that have bad blocks in the inode table.
++
++Sun Feb  2 00:17:36 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h (struct_badblocks_list, struct_badblocks_iterate): 
++		Moved to ext2fsP.h, since it doesn't need to be part of
++		the public interface.
++
++	* dir_iterate.c: Move ext2_dir_iterate out of namei.c.
++
++Sat Feb  1 10:14:55 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dblist.c (ext2fs_get_num_dirs): New file, which implements a
++ 		directory block list abstraction.  (Code moved from
++ 		e2fsck).
++
++	* ext2fs.h, inode.c: Moved definition of ext2_struct_inode_scan to
++		to inode.c (since no one else should be peeking inside it!)
++
++	* valid_blk.c (ext2_inode_has_valid_blocks): New function.
++
++	* openfs.c (ext2fs_open): Check the feature set in the ext2
++		superblock, and refuse to open filesystems if they contain
++		incompatible features.  (Can be overriden with the
++		EXT2_FLAG_FORCE 
++
++Sun Jan 12 11:31:46 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* block.c (ext2fs_block_iterate2): Added new function
++	 	ext2fs_block_iterate2 which changes the function
++	 	signature of the callback function to include the
++	 	referencing block and offset.
++
++	* inode.c (ext2fs_inode_scan_goto_blockgroup): Added new function
++	 	ext2fs_inode_scan_goto_blockgroup which allows an
++	 	application to jump to a particular block group while
++	 	doing an inode scan.
++
++Wed Jan  1 23:50:12 1997  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* dirblock.c: Include string.h, since we use memcpy().
++
++Tue Dec  3 12:27:29 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): The ioctl BLKGETSIZE returns
++		a long not an int; this doesn't matter on i386 machines,
++		but it does on Alpha's.
++	
++Fri Nov 29 20:57:37 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_write_inode, ext2fs_read_inode): If the inode
++ 		table pointer is NULL, then return an error indicating
++ 		that the inode table is missing.
++		(get_next_blockgroup, get_next_blocks,
++ 		ext2fs_get_next_inode): Don't treat a missing inode table
++ 		as permanent error.  Return MISSING_INODE_TABLE, but as an
++ 		advisory error code, much like BAD_BLOCK_IN_INODE_TABLE.
++
++	* rw_bitmaps.c (ext2fs_write_block_bitmap,
++ 	 	ext2fs_write_inode_bitmap): If the inode or block bitmap
++ 	 	block is zero, then don't write out the inode or block
++ 	 	bitmap.  The idea here is to avoid stomping on the
++ 	 	superblock.
++		(read_bitmaps): If the inode or block bitmap block is
++	 	zero, then fill in that portion of the inode or block
++	 	bitmap with all zeros.
++
++	* inode.c (ext2fs_get_next_inode): Fix bug in handling of bad
++ 		blocks in inode table when the inode table size is
++ 		non-standard (and can therefore span blocks).
++
++Tue Oct 29 20:13:14 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* alloc.c (ext2fs_new_block): Fix fencepost error in
++		ext2fs_new_block; make sure we don't try to allocate the
++		first block beyond the end of the filesystem.
++
++Mon Oct 14 11:00:48 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (check_for_inode_bad_blocks): New function called by
++		get_next_blocks() to avoid reading in bad blocks marked in
++		fs->badblocks.  Inodes located in bad blocks are returned
++		by ext2fs_get_next_inode() returns the error code 
++		EXT2_ET_BAD_BLOCK_IN_INODE_TABLE.
++	
++	* alloc_tables.c (ext2fs_allocate_tables): New function which
++		performs the part of mke2fs's job of allocating the 
++		filesystem tables.
++
++	* test_io.c (test_close): IO manager which is used for testing
++	 	purposes.
++
++Sun Oct 13 04:31:57 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_get_next_inode): Separate out the function of
++ 		setting up for a new block group to get_next_blockgroup().
++		Separate out the function of reading in blocks of the
++		inode table to get_next_blocks().
++
++	* ext2fs.h: Add the badblocks list to the ext2_filsys entry
++
++	* badblocks.c (badblocks_list_add, badblocks_list_test): Add
++ 		blocks to the badblock list in sorted order.  This allows
++ 		badblocks_list_test to be coded using a binary search for
++ 		speed.
++
++Tue Oct  8 02:02:03 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.06
++
++Mon Oct  7 00:44:17 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h, block.c, closefs.c, dirblock.c, inode.c, native.c,
++	 	open.c: Change EXT2_SWAP to EXT2_FLAG_SWAP for
++	 	consistency's sake.
++	
++	* closefs.c (ext2fs_flush): If the flag EXT2_MASTER_SB_ONLY is
++		set, then only write out the master superblock.
++
++Sun Oct  6 21:45:26 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* block.c (ext2fs_block_iterate): Fixed bug which caused
++ 		block_iterate to fail to handle HURD created filesystems;
++ 		it tested the inode translator field before the inode was
++ 		loaded.
++
++Tue Sep 17 14:08:24 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Make sure the description for
++		the inode bitmap is set correctly.
++
++	* bitmaps.c (ext2fs_allocate_generic_bitmap): Fix minor type typo.
++
++Thu Sep 12 15:23:07 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.05
++
++Sat Sep  7 07:36:03 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c: Override the kernel's idea of default
++		checkinterval from 0 (never) to 180 days.
++
++Wed Aug 28 03:20:03 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* namei.c (ext2fs_namei_follow): New function which follows
++		symbolic link (if any) at the target.
++
++Tue Aug 27 01:48:43 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_read_inode, ext2fs_write_inode): Add support
++		for shortcut function fs->read_inode() and fs->write_inode().
++		Added inode_cache to reduce CPU time spent in doing
++		byte swapping.
++
++	* swapfs.c (ext2fs_swap_super): Swap the new fields in a V2
++	 	superblock.
++
++	* namei.c (ext2fs_follow_link): New function.
++		(ext2fs_namei): Extended to have support for chasing
++ 		symbolic links.  ext2fs_namei() still returns an inode
++ 		which is a symbolic link.  Symbolic links are only chased
++ 		while resolving the containing directory.  To chase
++ 		symbolic links of the final result, use
++ 		ext2fs_follow_link().
++
++Mon Aug 26 23:46:07 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2_err.et.in: Added new error code EXT2_ET_SYMLINK_LOOP.
++
++	* bitops.h (ext2fs_set_bit, ext2fs_celar_bit): Use asm inlines
++		provided by Pete A. Zaitcev (zaitcev@lab.sun.mcst.ru).
++
++Thu Aug 22 00:40:18 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): On systems where the byte
++		order is not i386 compatible, set the swap_byte flag.
++
++	* inode.c (inocpy_with_swap): Check to see if inode contains a
++		fast symlink before swapping the inode block fields.  This
++		required adding a new argument to inocpy_with_swap to
++		determine whether the mode field is in host order or not.
++
++Wed Aug 21 00:45:42 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* bitops.h (ext2fs_set_bit, ext2fs_clear_bit, ext2fs_test_bit): On
++		the sparc, if EXT2_STD_BITOPS set, use the standard
++		i386-compatible bitmask operations, instead on the
++		non-standard native bitmask operators.
++
++Fri Aug  9 11:11:35 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* block.c (ext2fs_block_iterate): Cause block iterator to return
++		the HURD translator block (along with everything else).
++		If the flag BLOCK_FLAG_DATA_ONLY is passed to the block
++		iterator, then don't return any meta data blocks
++		(including the HURD translator).
++
++Wed Jul 17 17:13:34 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* gen_uuid.c: New file, which generates DCE-compatible UUIDs.
++
++	* uuid.c: New file, containing UUID utility functions.
++
++Tue Jul 16 10:19:16 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: Add a definition of the "real" ext2 superblock.
++
++Fri May 24 14:54:55 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* ext2fs.h: Fix erroneous ino_t type used in block_bitmap type.
++
++Sun May 19 15:39:03 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* openfs.c (ext2fs_open): If the blocksize in the superblock is
++		zero, return the error EXT2_ET_CORRUPT_SUPERBLOCK, since
++		that's a basic value that must be correct for the rest of
++		the library to work.
++
++	* ext2_err.et.in (EXT2_ET_CORRUPT_SUPERBLOCK): Added new error
++	 	code.
++
++Thu May 16 11:12:30 1996  Theodore Ts'o  <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.04
++
++Wed Mar 27 00:33:40 1996    <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.03
++
++Tue Mar 26 12:06:32 1996    <tytso@rsts-11.mit.edu>
++
++	* bitops.h (ext2fs_set_bit, ext2fs_clear_bit, ext2fs_test_bit):
++		Change the m68k bit numbering for bitmasks to match with
++		the bit numbering used by all other ext2 implementations.
++
++Thu Mar  7 03:37:00 1996    <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_get_next_inode, ext2fs_close_inode_scan, 
++	ext2fs_open_inode_scan): Support dynamically-sized inodes.
++
++Wed Mar  6 12:26:29 1996    <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_read_inode, ext2fs_write_inode): Support
++		dynamically-sized inodes.
++
++	* openfs.c (ext2fs_open): Allow dynamic revision filesystem to be
++	        loaded.
++
++Tue Mar  5 03:49:37 1996    <tytso@rsts-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Catch an error condition where
++		the passed in size is *really* too small.
++
++	* alloc.c (ext2fs_new_inode): 
++	* ext2fs.h (EXT2_FIRST_INODE): Add support for dynamic revision to
++		get first inode.
++
++Wed Feb 21 15:56:17 1996    <tytso@rsts-11.mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): Open the device read-only
++		when trying to determine its size.
++
++Wed Jan 31 11:06:08 1996    <tytso@rsts-11.mit.edu>
++
++	* Release of E2fsprogs version 1.02
++
++Sat Dec  9 09:57:50 1995    <tytso@rsts-11.mit.edu>
++
++	* rw_bitops.c (ext2fs_write_block_bitmap):
++	* bitops.c (ext2fs_test_bit, ext2fs_clear_bit, ext2fs_set_bit):
++	* bitops.h (ext2fs_test_bit, ext2fs_clear_bit, ext2fs_set_bit):
++		Rename {test,set,clear}_bit to ext2fs_{test,set,clear}_bit, 
++		to avoid conflicts with with kernel include files.  Also
++		rename ADDR and CONST_ADDR to EXT2FS_ADDR and
++		EXT2FS_CONST_ADDR. 
++
++Thu Oct 26 12:09:16 1995    <tytso@rsts-11.mit.edu>
++
++	* ext2_err.et: Updated message in EXT2_ET_BASE to say version 0.5c
++
++	* swapfs.c (ext2fs_swap_super): Put an #ifdef check around
++		s_def_resuid and s_def_resgid for backwards compatibility.
++
++Fri Oct 20 23:33:31 1995    <tytso@rsts-11.mit.edu>
++
++	* bitops.h: Added #ifdef's for Sparc.
++
++Wed Sep  6 22:14:46 1995    <tytso@rsts-11.mit.edu>
++
++	* getsize.c: #include <sys/ioctl.h> under Linux to pick up ioctl()
++	        declaration
++
++	* closefs.c: #include <string.h> to pick up memset() declaration
++
++Mon Sep  4 21:45:29 1995  Remy Card  <card@bbj>
++
++	* Makefile.in: Added support for BSD shared libraries.
++
++	* initialize.c (ext2fs_initialize): Correctly set the s_creator_os
++		flag.
++
++Mon Sep  4 09:55:30 1995    <tytso@rsts-11.mit.edu>
++
++	* unix_io.c (unix_open): Add a double check; if the passed in name
++		is NULL, return EXT2_ET_BAD_DEVICE_NAME.
++
++	* ext2_err.et (EXT2_ET_BAD_DEVICE_NAME): Added new error code
++
++Wed Aug 16 15:44:10 1995    <tytso@rsts-11.mit.edu>
++
++	* inode.c (ext2fs_check_directory): Use LINUX_S_ISDIR instead of
++		S_ISDIR.
++
++Tue Aug 15 13:08:36 1995    <tytso@rsts-11.mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): Add support for reading the
++		partition size from a BSD disk label.
++
++Thu Aug 10 09:33:26 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
++
++	* getsize.c (ext2fs_get_device_size): New function that determins
++		the size of a device.  Used by mke2fs and e2fsck.
++
++Sat Aug 12 03:09:54 1995  Remy Card  <card@bbj>
++
++	* Makefile.in (install): Install static libraries in $(ulibdir)
++		(/usr/lib on Linux) instead of $(libdir) (/lib on Linux).
++
++Wed Aug  9 17:04:23 1995  Theodore Y. Ts'o  <tytso@dcl>
++
++	* bitmaps.c (ext2fs_free_inode_bitmap, ext2fs_free_block_bitmap):
++		Move these functions to freefs.c.
++
++	* closefs.c (ext2fs_flush): If swapping blocks, clear the group
++		descriptors shadow memory to keep purify quiet.  (This
++		also has the nice benefit that the unused portion of the
++		shadow descriptors are zeroed out.)
++
++	* dirblock.c (ext2fs_write_dir_block): We need to use
++		dirent->rec_len *before* it's byteswapped to find the
++		location of the next directory structure!
++
++	* alloc.c (ext2fs_new_inode): Fix bug which could potentially
++		cause ext2fs_new_inode to loop infinitely if we're trying
++		to allocate an inode in group #0 and there are no free
++		inodes at all in the system.
++
++	* closefs.c: #include <errno.h> if it exists.
++
++Sun Aug  6 13:27:50 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
++
++	* ext2fs.h (BLOCK_FLAG_HOLE): Added new definition for
++		BLOCK_FLAG_APPEND.  Added documentation for the block
++		interator flags.
++
++Sat Aug  5 11:44:05 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
++
++	* Makefile.in (DLL_INSTALL_DIR, ELF_INSTALL_DIR): Set the
++		installation directories correctly.
++
++Tue Jul 18 09:27:38 1995    <tytso@rsx-11.mit.edu>
++
++	* namei.c (process_dir_block): 
++	* mkdir.c (ext2fs_mkdir): 
++	* expanddir.c (expand_dir_proc): Use ext2fs_{read,write}_dir_block
++		to read/write the directory block.
++
++	* dirblock.c (ext2fs_read_dir_block), ext2fs_write_dir_block): New
++		file containing functions for reading and writing
++		directory blocks (byte swapping if necesssary)
++
++	* block.c (block_iterate_ind, block_iterate_dind, 
++		block_iterate_tind): Byte swap the block addresses if
++		EXT2_SWAP_BYTES is set (and swap them back before writing
++		them out.)
++
++	* inode.c (inocpy_with_swap): New function.
++	(ext2fs_get_next_inode, ext2fs_read_inode, ext2fs_write_inode):
++		Call inocpy_with_swap if EXT2_SWAP_BYTES if set.
++
++	* closefs.c (ext2fs_flush): If EXT2_SWAP_BYTES is set, then swap
++		the superblock and group descriptors before writing it out.
++
++	* openfs.c (ext2fs_open): If the magic number is byte-swapped,
++		then set the EXT2_SWAP_BYTES and byte-swap the superblock
++		and group descriptors.
++
++	* swapfs.c (ext2fs_swap_super, ext2fs_swap_group_desc): New functions
++		to desp ext2 filesystem structures.
++
++	* bitops.c (set_bit, clear_bit, test_bit): Use modifications
++		supplied by Pete A. Zaitcev so that the C language
++		versions of these functions are more portable.  They will
++		now work on both little and big endian systems, and the
++		assumption that 32-bit integers are used is gone.
++
++	* bitops.h (ext2_swab16, ext2_swab32): Added new functions for
++		doing byte swapping.
++
++	* ext2fs.h (EXT2_SWAP_BYTES): Add new flag which indicates that
++		byte swapping should take place.
++
++Sun Jul 16 06:21:43 1995    <tytso@rsx-11.mit.edu>
++
++	* Makefile.in, cmp_bitmaps.c (ext2fs_compare_block_bitmap_end,
++	        ext2fs_compare_inode_bitmap_end): Added new file
++		containing routines to compare bitmaps.
++
++	* ext2_err.et (EXT2_ET_NEQ_BLOCK_BITMAP, EXT2_ET_NEQ_INODE_BITMAP): 
++		Added new error codes.
++
++Sat Jul 15 04:23:37 1995    <tytso@rsx-11.mit.edu>
++
++	* inode.c (ext2fs_get_next_inode): Don't check scan->inode_buffer;
++		if the magic number is correct, it will be allocated.
++
++Fri Jul 14 19:02:59 1995    <tytso@rsx-11.mit.edu>
++
++	* block.c (block_iterate_ind, block_iterate_dind, 
++		block_iterate_tind): Don't recompute block_nr each loop;
++		just increment it!  Factor check of BLOCK_FLAG_APPEND out
++		of the loop.  Factor mask of BLOCK_CHANGED into changed
++		variable out of the loop.  (block_iterate_ind, in
++		particular, gets called a lot, so every little
++		optimization helps.)
++
++Thu Jul 13 08:02:45 1995    <tytso@rsx-11.mit.edu>
++
++	* block.c (block_iterate_ind, block_iterate_dind, 
++		block_iterate_tind): Precompute limit of loop to speed up
++		block_iterate_ind and company.
++
++	* bitops.h (ext2fs_fast_mark_block_bitmap, 
++		ext2fs_fast_unmark_block_bitmap, ext2fs_fast_test_block_bitmap,
++		ext2fs_fast_mark_inode_bitmap, ext2fs_fast_unmark_inode_bitmap,
++		ext2fs_fast_test_inode_bitmap): Add fast version of these
++		functions, which don't do range checking.
++
++	* bitops.h (ext2fs_get_block_bitmap_start, 
++		ext2fs_get_inode_bitmap_start, ext2fs_get_block_bitmap_end,
++		ext2fs_get_inode_bitmap_end): Add new accessor functions
++		which return the start and end points of the bitmaps.
++
++Tue Jul 11 18:59:41 1995    <tytso@rsx-11.mit.edu>
++
++	* llseek.c (ext2_llseek): If the offset is small enough, use lseek
++		instead of llseek.  The errno if the offset is too large
++		and lseek is not supported should be EINVAL, not -EINVAL.
++
++Thu Jun 15 23:43:02 1995  Remy Card  <card@bbj>
++
++	* Makefile.in: Added support for ELF shared libraries.
++		Fixed typos in the compilation rules.
++		(distclean): Added Makefile.
++
++	* llseek.c (llseek): New function, if llseek() does not exist in the
++	C library.
++	(ext2_llseek): Changed to call llseek().
++
++Mon Jun 12 08:29:07 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
++
++	* ext2fs.h: Use __u32 to define blk_t, instead of unsigned long.
++
++Sun Jun 11 15:02:54 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
++
++	* mkdir.c (ext2fs_mkdir): Use LINUX_S_IFDIR instead of S_IFDIR.
++
++	* ext2fs.h (LINUX_S_IFDIR): Define a linux specific versions of
++		the S_*, which are normally defined in <sys/stat.h>.  This
++		allows us to compile e2fsprogs on a non-Linux system,
++		which may have a different value for S_IFDIR.
++
++Sat Jun 10 23:47:05 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
++
++	* bitops.c (clear_bit, set_bit): Remove calls to cli() and sti();
++		this is a user-mode application!
++
++Thu Jun  8 13:13:22 1995  Miles Bader  <miles@churchy.gnu.ai.mit.edu>
++
++	* llseek.c: Put the include of <linux/unistd.h> inside the #ifdef
++	__linux__ so that non-linux systems won't see it.
++
++	* alloc.c: Include <errno.h> if possible.
++	* badblocks.c: Ditto.
++	* bb_inode.c: Ditto.
++	* bitmaps.c: Ditto.
++	* block.c: Ditto.
++	* expanddir.c: Ditto.
++	* get_pathname.c: Ditto.
++	* initialize.c: Ditto.
++	* inode.c: Ditto.
++	* llseek.c: Ditto.
++	* mkdir.c: Ditto.
++	* namei.c: Ditto.
++	* newdir.c: Ditto.
++	* openfs.c: Ditto.
++	* rw_bitmaps.c: Ditto.
++	* unix_io.c: Ditto.
++
++	* Makefile.in: Rewritten to conform to GNU coding standards and
++	support separate compilation directories.
++
++Thu May 11 04:13:12 1995    <tytso@rsx-11.mit.edu>
++
++	* initialize.c (ext2fs_initialize): Don't allow more than one
++		bitmaps's worth of inodes in a group.
++
++Sat Mar 11 14:07:11 1995  Theodore Y. Ts'o  <tytso@localhost>
++
++	* llseek.c (ext2_llseek): Added error checking to the llseek()
++		compat code to protect against overflow.  This only
++		applies to 1.0 and early 1.1 kernels, which don't support
++		the llseek() system call.
++
++Thu Nov 24 16:29:00 1994  Theodore Y. Ts'o  (tytso@rt-11)
++
++	* unix_io.c (unix_open): Initialize the read_error and write_error
++		io_channel pointers to be null.
++
++	* bb_inode.c (clear_bad_block_proc): If an illegal block number is
++		found, clear it but don't try to update the filesystem
++		accounting information, since that's hopeless anyway.
++
++	* block.c (bloblock_iterate_ind, bloblock_iterate_dind,
++	bloblock_iterate_tind): Check to see if the indirect blocks are
++		valid before trying to read them.
++
++	* ext2_err.et (EXT2_ET_BAD_IND_BLOCK, EX2_ET_BAD_DIND_BLOCK,
++	EXT2_ET_BAD_TIND_BLOCK): Add new error codes.
++
++	* bitops.h (ext2fs_mark_block_bitmap, ext2fs_unmark_block_bitmap,
++	ext2fs_test_block_bitmap, ext2fs_mark_inode_bitmap,
++	ext2fs_unmark_inode_bitmap, ext2fs_test_inode_bitmap):  If an
++		illegal block or inode number is passed in, return instead
++		of trying to test, set, or clear the bit.
++
++Mon Nov  7 21:32:33 1994  Remy Card  <card@bbj>
++
++	* Makefile: Added a dummy install target in case shared libraries
++		are not built.
++
++Mon Oct 24 14:11:44 1994    (tytso@rsx-11)
++
++	* bitmaps.c (ext2fs_allocate_block_bitmap): Fix calculation of how
++		the real last block of the bitmap should be calculated.
++
++Wed Sep  7 10:05:36 1994    (tytso@rsx-11)
++
++	* bitmaps.c (ext2fs_fudge_inode_bitmap_end, 
++		ext2fs_fudge_block_bitmap_end, ext2fs_clear_inode_bitmap,
++		ext2fs_clear_block_bitmap, ext2fs_free_inode_bitmap,
++		ext2fs_free_block_bitmap): Add magic number checking for
++		the inode and block bitmaps.
++
++	* bitmaps.c (ext2fs_allocate_block_bitmap): Fix to set the correct
++		magic number for a block bitmap instead of an inode bitmap.
++
++	* inode.c (ext2fs_close_inode_scan, ext2fs_get_next_inode):  Add
++		magic number checking for the inode_scan structure.
++
++	* badblocks.c (badblocks_list_free, badblocks_list_add, 
++		badblocks_list_test, badblocks_list_iterate_begin,
++		badblocks_list_iterate, badblocks_list_iterate_end): Add
++		magic number checking for the badblocks_list and
++		badblocks_iterate structures.
++
++	* ext2_err.et (EXT2_ET_MAGIC_UNIX_IO_CHANNEL): 
++	* unix_io.c (unix_open, unix_close, unix_set_blksize, unix_read_blk,
++		unix_write_blk, unix_flush): Add magic number checking
++		both for io_channel structure and unix_private_data
++		structure.
++
++	* openfs.c (ext2fs_open): Add check for io_manager structure's
++		magic number.
++
++	* rw_bitmaps.c (ext2fs_write_inode_bitmap, ext2fs_write_block_bitmap,
++		ext2fs_read_inode_bitmap, ext2fs_read_block_bitmap,
++		ext2fs_read_bitmaps, ext2fs_write_bitmaps): 
++	* read_bb.c (ext2fs_read_bb_inode): 
++	* read_bb_file.c (ext2fs_read_bb_FILE): 
++	* newdir.c (ext2fs_new_dir_block): 
++	* namei.c (ext2fs_dir_iterate, ext2fs_lookup, ext2fs_namei): 
++	* link.c (ext2fs_link, ext2fs_unlink): 
++	* inode.c (ext2fs_open_inode_scan, ext2fs_read_inode,
++		ext2fs_write_inode, ext2fs_get_blocks, 
++		ext2fs_check_directory): 
++	* get_pathname.c (ext2fs_get_pathname): 
++	* expanddir.c (ext2fs_expand_dir): 
++	* block.c (ext2fs_block_iterate): 
++	* bitmaps.c (ext2fs_allocate_inode_bitmap, 
++		ext2fs_allocate_block_bitmap): 
++	* bb_inode.c (ext2fs_update_bb_inode): 
++	* alloc.c (ext2fs_new_inode,ext2fs_new_block,ext2fs_get_free_blocks): 
++	* check_desc.c (ext2fs_check_desc): 
++	* closefs.c (ext2fs_close, ext2fs_flush): 
++	* freefs.c (ext2fs_free): Add check for ext2_filsys magic number.
++
++	* Makefile:
++	* ext2fs.h:
++	* openfs.c:
++	* check_desc.c (ext2fs_check_desc): Move ext2fs_check_desc from
++	openfs.c into its own file.
++
++	* ext2fs.h (EXT2_CHECK_MAGIC): Added macro for checking for
++	structure magic numbers.
++
++	* closefs.c (ext2fs_flush): Folded in Remy Card's changes to clear
++	the EXT2_VALID_FS flag in the backup superblock blocks, so that if
++	someone uses the -b option to specify the use of the backup
++	superblock --- this usually means that the main superblock is
++	toast.  :-)
++
++	* ext2fs.h: 
++	* ext2_err.et (EXT2_ET_REV_TOO_HIGH): 
++	* openfs.c (ext2fs_open): Folded in Remy Card's changes to add a
++	revision level to the superblock.
++
++Sun Aug 21 00:50:08 1994  Theodore Y. Ts'o  (tytso@rt-11)
++
++	* ext2fs.h:
++	* bitmaps.c:
++	* bitops.c
++	* bitops.h:
++	* openfs.c:
++	* initialize.c: Completely revamped the inode and block bitmap
++	structures, so that they can be better chance of being extensible
++	in a shared library.  They are now their own type, instead of
++	being a char *.  Also, the function signatures of
++	ext2fs_test_block_bitmap, ext2fs_mark_block_bitmap,
++	ext2fs_unmark_block_bitmap, ext2fs_test_inode_bitmap,
++	ext2fs_mark_inode_bitmap, and ext2fs_unmark_inode_bitmap were
++	changed to eliminate the ext2_filsys argument, since it is no
++	longer necessary.
++
++Wed Aug 17 21:46:44 1994  Remy Card  (card@bbj)
++
++	* unix_io.c (unix_read_blk and unix_write_blk): use the llseek
++	system call if available.
++
++	* llseek.c: new file.  This is the stub calling the llseek system
++	call which allows supports for 2GB+ file systems.
++
++	* initialize.c (ext2fs_initialize): Ext2fs_initialize now stores
++	the creator operating system.
++
++Wed Aug 17 10:03:24 1994  Theodore Y. Ts'o  (tytso@rt-11)
++
++	* initialize.c (ext2fs_initialize): Ext2fs_initialize now sets up
++	the group descriptor statistics in addition to everything else.
++	This relieves mke2fs of the responsibility of doing it.
++
++	* bitops.c, bitops.h: Add assembly inline functions for the 68000.
++	Added a new #define, _EXT2_HAVE_ASM_BITOPS_ to control whether or
++	not the generic C function equivalents should be included or not.
++
++	* openfs.c (ext2fs_open): If a superblock is specified, then use
++	the backup group descriptors that go along with this superblock,
++	instead of using the primary group descriptors.  This allows
++	e2fsck to recover filesystems where the primary group descriptors
++	have been trashed.
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/Makefile silo-1.4.11/libext2fs/Makefile
+--- silo-1.4.11.orig/libext2fs/Makefile	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/Makefile	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,21 @@
++
++include ../Rules.make
++
++DEFS = -DLOCALEDIR=\"$(localedir)\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE_HTREE=1 -DENABLE_SWAPFS=1 -DPACKAGE=\"e2fsprogs\" -DVERSION=\"0.14.1\" -DHAVE_LONG_LONG=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_WCHAR_T=1 -DHAVE_WINT_T=1 -DHAVE_INTTYPES_H_WITH_UINTMAX=1 -DHAVE_STDINT_H_WITH_UINTMAX=1 -DHAVE_INTMAX_T=1 -DHAVE_POSIX_PRINTF=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DINTDIV0_RAISES_SIGFPE=1 -DHAVE_UNSIGNED_LONG_LONG=1 -DHAVE_UINTMAX_T=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDINT_H=1 -DHAVE_ARGZ_H=1 -DHAVE_LIMITS_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NL_TYPES_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_ASPRINTF=1 -DHAVE_FWPRINTF=1 -DHAVE_GETCWD=1 -DHAVE_GETEGID=1 -DHAVE_GETEUID=1 -DHAVE_GETGID=1 -DHAVE_GETUID=1 -DHAVE_MEMPCPY=1 -DHAVE_MUNMAP=1 -DHAVE_PUTENV=1 -DHAVE_SETENV=1 -DHAVE_SETLOCALE=1 -DHAVE_SNPRINTF=1 -DHAVE_STPCPY=1 -DHAVE_STRCASECMP=1 -DHAVE_STRDUP=1 -DHAVE_STRTOUL=1 -DHAVE_TSEARCH=1 -DHAVE_WCSLEN=1 -DHAVE___ARGZ_COUNT=1 -DHAVE___ARGZ_STRINGIFY=1 -DHAVE___ARGZ_NEXT=1 -DHAVE___FSETLOCKING=1 -DHAVE_DECL__SNPRINTF=0 -DHAVE_DECL__SNWPRINTF=0 -DHAVE_DECL_FEOF_UNLOCKED=1 -DHAVE_DECL_FGETS_UNLOCKED=0 -DHAVE_DECL_GETC_UNLOCKED=1 -DHAVE_ICONV=1 -DICONV_CONST= -DHAVE_LANGINFO_CODESET=1 -DHAVE_LC_MESSAGES=1 -DENABLE_NLS=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DHAVE_STDINT_H=1 -DHAVE_ERRNO_H=1 -DHAVE_MALLOC_H=1 -DHAVE_MNTENT_H=1 -DHAVE_PATHS_H=1 -DHAVE_DIRENT_H=1 -DHAVE_GETOPT_H=1 -DHAVE_SETJMP_H=1 -DHAVE_SIGNAL_H=1 -DHAVE_TERMIOS_H=1 -DHAVE_LINUX_FD_H=1 -DHAVE_LINUX_MAJOR_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_PRCTL_H=1 -DHAVE_SYS_QUEUE_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_SYSMACROS_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_SYS_MOUNT_H=1 -DHAVE_NET_IF_H=1 -DHAVE_VPRINTF=1 -DHAVE_RECLEN_DIRENT=1 -DHAVE_TYPE_SSIZE_T=1 -DHAVE_LSEEK64_PROTOTYPE=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8 -DHAVE_INTTYPES_H=1 -DHAVE_INTPTR_T=1 -DHAVE_GETRUSAGE=1 -DHAVE_LLSEEK=1 -DHAVE_LSEEK64=1 -DHAVE_OPEN64=1 -DHAVE_STRTOULL=1 -DHAVE_STRCASECMP=1 -DHAVE_SRANDOM=1 -DHAVE_FCHOWN=1 -DHAVE_MALLINFO=1 -DHAVE_FDATASYNC=1 -DHAVE_STRNLEN=1 -DHAVE_STRPTIME=1 -DHAVE_SYSCONF=1 -DHAVE_PATHCONF=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_MEMALIGN=1 -DHAVE_VALLOC=1 -DHAVE___SECURE_GETENV=1 -DHAVE_PRCTL=1 -DHAVE_DLOPEN=1 -DHAVE_EXT2_IOCTLS=1
++
++DEBUGFS_LIB_OBJS = inode_io.o namei.o write_bb_file.o 
++RESIZE_LIB_OBJS = rs_bitmap.o dupfs.o test_io.o 
++E2IMAGE_LIB_OBJS = imager.o
++OBJS= $(DEBUGFS_LIB_OBJS) $(RESIZE_LIB_OBJS) $(E2IMAGE_LIB_OBJS) ext2_err.o alloc.o alloc_sb.o alloc_stats.o alloc_tables.o badblocks.o bb_inode.o bitmaps.o bitops.o block.o bmap.o check_desc.o closefs.o dblist.o dblist_dir.o dirblock.o dirhash.o dir_iterate.o expanddir.o ext_attr.o finddev.o flushb.o freefs.o gen_bitmap.o get_pathname.o getsize.o getsectsize.o icount.o ind_block.o initialize.o inline.o inode.o io_manager.o ismounted.o link.o llseek.o lookup.o mkdir.o mkjournal.o native.o newdir.o openfs.o read_bb.o read_bb_file.o res_gdt.o rw_bitmaps.o swapfs.o unix_io.o unlink.o valid_blk.o version.o
++
++all: libext2fs.a
++
++libext2fs.a: $(OBJS)
++	$(RM) libext2fs.a
++	$(AR) rc libext2fs.a $(OBJS)
++
++clean:
++	$(RM) -f libext2fs.a $(OBJS)
++
++.c.o:
++	$(CC-SILO) $(CFLAGS) $(DEFS) -c $< -o $@
+diff -Naur silo-1.4.11.orig/libext2fs/alloc.c silo-1.4.11/libext2fs/alloc.c
+--- silo-1.4.11.orig/libext2fs/alloc.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/alloc.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,173 @@
++/*
++ * alloc.c --- allocate new inodes, blocks for ext2fs
++ *
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ * 
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <time.h>
++#include <string.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * Right now, just search forward from the parent directory's block
++ * group to find the next free inode.
++ *
++ * Should have a special policy for directories.
++ */
++errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, 
++			   int mode EXT2FS_ATTR((unused)),
++			   ext2fs_inode_bitmap map, ext2_ino_t *ret)
++{
++	ext2_ino_t	dir_group = 0;
++	ext2_ino_t	i;
++	ext2_ino_t	start_inode;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++	
++	if (!map)
++		map = fs->inode_map;
++	if (!map)
++		return EXT2_ET_NO_INODE_BITMAP;
++	
++	if (dir > 0) 
++		dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super);
++
++	start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1;
++	if (start_inode < EXT2_FIRST_INODE(fs->super))
++		start_inode = EXT2_FIRST_INODE(fs->super);
++	i = start_inode;
++
++	do {
++		if (!ext2fs_fast_test_inode_bitmap(map, i))
++			break;
++		i++;
++		if (i > fs->super->s_inodes_count)
++			i = EXT2_FIRST_INODE(fs->super);
++	} while (i != start_inode);
++	
++	if (ext2fs_test_inode_bitmap(map, i))
++		return EXT2_ET_INODE_ALLOC_FAIL;
++	*ret = i;
++	return 0;
++}
++
++/*
++ * Stupid algorithm --- we now just search forward starting from the
++ * goal.  Should put in a smarter one someday....
++ */
++errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
++			   ext2fs_block_bitmap map, blk_t *ret)
++{
++	blk_t	i;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!map)
++		map = fs->block_map;
++	if (!map)
++		return EXT2_ET_NO_BLOCK_BITMAP;
++	if (!goal || (goal >= fs->super->s_blocks_count))
++		goal = fs->super->s_first_data_block;
++	i = goal;
++	do {
++		if (!ext2fs_fast_test_block_bitmap(map, i)) {
++			*ret = i;
++			return 0;
++		}
++		i++;
++		if (i >= fs->super->s_blocks_count)
++			i = fs->super->s_first_data_block;
++	} while (i != goal);
++	return EXT2_ET_BLOCK_ALLOC_FAIL;
++}
++
++/*
++ * This function zeros out the allocated block, and updates all of the
++ * appropriate filesystem records.
++ */
++errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
++			     char *block_buf, blk_t *ret)
++{
++	errcode_t	retval;
++	blk_t		block;
++	char		*buf = 0;
++
++	if (!block_buf) {
++		retval = ext2fs_get_mem(fs->blocksize, &buf);
++		if (retval)
++			return retval;
++		block_buf = buf;
++	}
++	memset(block_buf, 0, fs->blocksize);
++
++	if (!fs->block_map) {
++		retval = ext2fs_read_block_bitmap(fs);
++		if (retval)
++			goto fail;
++	}
++
++	retval = ext2fs_new_block(fs, goal, 0, &block);
++	if (retval)
++		goto fail;
++
++	retval = io_channel_write_blk(fs->io, block, 1, block_buf);
++	if (retval)
++		goto fail;
++	
++	ext2fs_block_alloc_stats(fs, block, +1);
++	*ret = block;
++	return 0;
++
++fail:
++	if (buf)
++		ext2fs_free_mem(&buf);
++	return retval;
++}
++
++errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, blk_t finish,
++				 int num, ext2fs_block_bitmap map, blk_t *ret)
++{
++	blk_t	b = start;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!map)
++		map = fs->block_map;
++	if (!map)
++		return EXT2_ET_NO_BLOCK_BITMAP;
++	if (!b)
++		b = fs->super->s_first_data_block;
++	if (!finish)
++		finish = start;
++	if (!num)
++		num = 1;
++	do {
++		if (b+num-1 > fs->super->s_blocks_count)
++			b = fs->super->s_first_data_block;
++		if (ext2fs_fast_test_block_bitmap_range(map, b, num)) {
++			*ret = b;
++			return 0;
++		}
++		b++;
++	} while (b != finish);
++	return EXT2_ET_BLOCK_ALLOC_FAIL;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/alloc_sb.c silo-1.4.11/libext2fs/alloc_sb.c
+--- silo-1.4.11.orig/libext2fs/alloc_sb.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/alloc_sb.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,57 @@
++/*
++ * alloc_sb.c --- Allocate the superblock and block group descriptors for a 
++ * newly initialized filesystem.  Used by mke2fs when initializing a filesystem
++ *
++ * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++int ext2fs_reserve_super_and_bgd(ext2_filsys fs, 
++				 dgrp_t group,
++				 ext2fs_block_bitmap bmap)
++{
++	blk_t	super_blk, old_desc_blk, new_desc_blk;
++	int	j, old_desc_blocks, num_blocks;
++
++	num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, 
++					      &old_desc_blk, &new_desc_blk, 0);
++
++	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
++		old_desc_blocks = fs->super->s_first_meta_bg;
++	else
++		old_desc_blocks = 
++			fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
++
++	if (super_blk || (group == 0))
++		ext2fs_mark_block_bitmap(bmap, super_blk);
++
++	if (old_desc_blk) {
++		for (j=0; j < old_desc_blocks; j++)
++			ext2fs_mark_block_bitmap(bmap, old_desc_blk + j);
++	}
++	if (new_desc_blk)
++		ext2fs_mark_block_bitmap(bmap, new_desc_blk);
++
++	return num_blocks;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/alloc_stats.c silo-1.4.11/libext2fs/alloc_stats.c
+--- silo-1.4.11.orig/libext2fs/alloc_stats.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/alloc_stats.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,52 @@
++/*
++ * alloc_stats.c --- Update allocation statistics for ext2fs
++ *
++ * Copyright (C) 2001 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ * 
++ */
++
++#include <stdio.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
++			       int inuse, int isdir)
++{
++	int	group = ext2fs_group_of_ino(fs, ino);
++
++	if (inuse > 0)
++		ext2fs_mark_inode_bitmap(fs->inode_map, ino);
++	else
++		ext2fs_unmark_inode_bitmap(fs->inode_map, ino);
++	fs->group_desc[group].bg_free_inodes_count -= inuse;
++	if (isdir)
++		fs->group_desc[group].bg_used_dirs_count += inuse;
++	fs->super->s_free_inodes_count -= inuse;
++	ext2fs_mark_super_dirty(fs);
++	ext2fs_mark_ib_dirty(fs);
++}
++
++void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse)
++{
++	ext2fs_inode_alloc_stats2(fs, ino, inuse, 0);
++}
++
++void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse)
++{
++	int	group = ext2fs_group_of_blk(fs, blk);
++
++	if (inuse > 0)
++		ext2fs_mark_block_bitmap(fs->block_map, blk);
++	else
++		ext2fs_unmark_block_bitmap(fs->block_map, blk);
++	fs->group_desc[group].bg_free_blocks_count -= inuse;
++	fs->super->s_free_blocks_count -= inuse;
++	ext2fs_mark_super_dirty(fs);
++	ext2fs_mark_bb_dirty(fs);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/alloc_tables.c silo-1.4.11/libext2fs/alloc_tables.c
+--- silo-1.4.11.orig/libext2fs/alloc_tables.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/alloc_tables.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,117 @@
++/*
++ * alloc_tables.c --- Allocate tables for a newly initialized
++ * filesystem.  Used by mke2fs when initializing a filesystem
++ *
++ * Copyright (C) 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
++				      ext2fs_block_bitmap bmap)
++{
++	errcode_t	retval;
++	blk_t		group_blk, start_blk, last_blk, new_blk, blk;
++	int		j;
++
++	group_blk = fs->super->s_first_data_block +
++		(group * fs->super->s_blocks_per_group);
++	
++	last_blk = group_blk + fs->super->s_blocks_per_group;
++	if (last_blk >= fs->super->s_blocks_count)
++		last_blk = fs->super->s_blocks_count - 1;
++
++	if (!bmap)
++		bmap = fs->block_map;
++	
++	/*
++	 * Allocate the block and inode bitmaps, if necessary
++	 */
++	if (fs->stride) {
++		start_blk = group_blk + fs->inode_blocks_per_group;
++		start_blk += ((fs->stride * group) %
++			      (last_blk - start_blk));
++		if (start_blk > last_blk)
++			start_blk = group_blk;
++	} else
++		start_blk = group_blk;
++
++	if (!fs->group_desc[group].bg_block_bitmap) {
++		retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
++						1, bmap, &new_blk);
++		if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) 
++			retval = ext2fs_get_free_blocks(fs, group_blk,
++					last_blk, 1, bmap, &new_blk);
++		if (retval)
++			return retval;
++		ext2fs_mark_block_bitmap(bmap, new_blk);
++		fs->group_desc[group].bg_block_bitmap = new_blk;
++	}
++
++	if (!fs->group_desc[group].bg_inode_bitmap) {
++		retval = ext2fs_get_free_blocks(fs, start_blk, last_blk,
++						1, bmap, &new_blk);
++		if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) 
++			retval = ext2fs_get_free_blocks(fs, group_blk,
++					last_blk, 1, bmap, &new_blk);
++		if (retval)
++			return retval;
++		ext2fs_mark_block_bitmap(bmap, new_blk);
++		fs->group_desc[group].bg_inode_bitmap = new_blk;
++	}
++
++	/*
++	 * Allocate the inode table
++	 */
++	if (!fs->group_desc[group].bg_inode_table) {
++		retval = ext2fs_get_free_blocks(fs, group_blk, last_blk,
++						fs->inode_blocks_per_group,
++						bmap, &new_blk);
++		if (retval)
++			return retval;
++		for (j=0, blk = new_blk;
++		     j < fs->inode_blocks_per_group;
++		     j++, blk++)
++			ext2fs_mark_block_bitmap(bmap, blk);
++		fs->group_desc[group].bg_inode_table = new_blk;
++	}
++
++	
++	return 0;
++}
++
++	
++
++errcode_t ext2fs_allocate_tables(ext2_filsys fs)
++{
++	errcode_t	retval;
++	dgrp_t		i;
++
++	for (i = 0; i < fs->group_desc_count; i++) {
++		retval = ext2fs_allocate_group_table(fs, i, fs->block_map);
++		if (retval)
++			return retval;
++	}
++	return 0;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/badblocks.c silo-1.4.11/libext2fs/badblocks.c
+--- silo-1.4.11.orig/libext2fs/badblocks.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/badblocks.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,327 @@
++/*
++ * badblocks.c --- routines to manipulate the bad block structure
++ * 
++ * Copyright (C) 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++/*
++ * Helper function for making a badblocks list
++ */
++static errcode_t make_u32_list(int size, int num, __u32 *list,
++			       ext2_u32_list *ret)
++{
++	ext2_u32_list	bb;
++	errcode_t	retval;
++	
++	retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb);
++	if (retval)
++		return retval;
++	memset(bb, 0, sizeof(struct ext2_struct_u32_list));
++	bb->magic = EXT2_ET_MAGIC_BADBLOCKS_LIST;
++	bb->size = size ? size : 10;
++	bb->num = num;
++	retval = ext2fs_get_mem(bb->size * sizeof(blk_t), &bb->list);
++	if (!bb->list) {
++		ext2fs_free_mem(&bb);
++		return retval;
++	}
++	if (list)
++		memcpy(bb->list, list, bb->size * sizeof(blk_t));
++	else
++		memset(bb->list, 0, bb->size * sizeof(blk_t));
++	*ret = bb;
++	return 0;
++}
++	
++
++/*
++ * This procedure creates an empty u32 list.
++ */
++errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size)
++{
++	return make_u32_list(size, 0, 0, ret);
++}
++
++/*
++ * This procedure creates an empty badblocks list.
++ */
++errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size)
++{
++	return make_u32_list(size, 0, 0, (ext2_badblocks_list *) ret);
++}
++
++
++/*
++ * This procedure copies a badblocks list
++ */
++errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest)
++{
++	errcode_t	retval;
++	
++	retval = make_u32_list(src->size, src->num, src->list, dest);
++	if (retval)
++		return retval;
++	(*dest)->badblocks_flags = src->badblocks_flags;
++	return 0;
++}
++
++errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src,
++				ext2_badblocks_list *dest)
++{
++	return ext2fs_u32_copy((ext2_u32_list) src,
++			       (ext2_u32_list *) dest);
++}
++
++/*
++ * This procedure frees a badblocks list.
++ *
++ * (note: moved to closefs.c)
++ */
++
++
++/*
++ * This procedure adds a block to a badblocks list.
++ */
++errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk)
++{
++	errcode_t	retval;
++	int		i, j;
++	unsigned long	old_size;
++
++	EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST);
++
++	if (bb->num >= bb->size) {
++		old_size = bb->size * sizeof(__u32);
++		bb->size += 100;
++		retval = ext2fs_resize_mem(old_size, bb->size * sizeof(__u32),
++					   &bb->list);
++		if (retval) {
++			bb->size -= 100;
++			return retval;
++		}
++	}
++
++	/*
++	 * Add special case code for appending to the end of the list
++	 */
++	i = bb->num-1;
++	if ((bb->num != 0) && (bb->list[i] == blk))
++		return 0;
++	if ((bb->num == 0) || (bb->list[i] < blk)) {
++		bb->list[bb->num++] = blk;
++		return 0;
++	}
++
++	j = bb->num;
++	for (i=0; i < bb->num; i++) {
++		if (bb->list[i] == blk)
++			return 0;
++		if (bb->list[i] > blk) {
++			j = i;
++			break;
++		}
++	}
++	for (i=bb->num; i > j; i--)
++		bb->list[i] = bb->list[i-1];
++	bb->list[j] = blk;
++	bb->num++;
++	return 0;
++}
++
++errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, blk_t blk)
++{
++	return ext2fs_u32_list_add((ext2_u32_list) bb, (__u32) blk);
++}
++
++/*
++ * This procedure finds a particular block is on a badblocks
++ * list.
++ */
++int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk)
++{
++	int	low, high, mid;
++
++	if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST)
++		return -1;
++
++	if (bb->num == 0)
++		return -1;
++
++	low = 0;
++	high = bb->num-1;
++	if (blk == bb->list[low])
++		return low;
++	if (blk == bb->list[high])
++		return high;
++
++	while (low < high) {
++		mid = (low+high)/2;
++		if (mid == low || mid == high)
++			break;
++		if (blk == bb->list[mid])
++			return mid;
++		if (blk < bb->list[mid])
++			high = mid;
++		else
++			low = mid;
++	}
++	return -1;
++}
++
++/*
++ * This procedure tests to see if a particular block is on a badblocks
++ * list.
++ */
++int ext2fs_u32_list_test(ext2_u32_list bb, __u32 blk)
++{
++	if (ext2fs_u32_list_find(bb, blk) < 0)
++		return 0;
++	else
++		return 1;
++}
++
++int ext2fs_badblocks_list_test(ext2_badblocks_list bb, blk_t blk)
++{
++	return ext2fs_u32_list_test((ext2_u32_list) bb, (__u32) blk);
++}
++
++
++/*
++ * Remove a block from the badblock list
++ */
++int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk)
++{
++	int	remloc, i;
++
++	if (bb->num == 0)
++		return -1;
++
++	remloc = ext2fs_u32_list_find(bb, blk);
++	if (remloc < 0)
++		return -1;
++
++	for (i = remloc ; i < bb->num-1; i++)
++		bb->list[i] = bb->list[i+1];
++	bb->num--;
++	return 0;
++}
++
++void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk)
++{
++	ext2fs_u32_list_del(bb, blk);
++}
++
++errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
++					ext2_u32_iterate *ret)
++{
++	ext2_u32_iterate iter;
++	errcode_t		retval;
++
++	EXT2_CHECK_MAGIC(bb, EXT2_ET_MAGIC_BADBLOCKS_LIST);
++
++	retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_iterate), &iter);
++	if (retval)
++		return retval;
++
++	iter->magic = EXT2_ET_MAGIC_BADBLOCKS_ITERATE;
++	iter->bb = bb;
++	iter->ptr = 0;
++	*ret = iter;
++	return 0;
++}
++
++errcode_t ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb,
++					      ext2_badblocks_iterate *ret)
++{
++	return ext2fs_u32_list_iterate_begin((ext2_u32_list) bb,
++					      (ext2_u32_iterate *) ret);
++}
++
++
++int ext2fs_u32_list_iterate(ext2_u32_iterate iter, __u32 *blk)
++{
++	ext2_u32_list	bb;
++
++	if (iter->magic != EXT2_ET_MAGIC_BADBLOCKS_ITERATE)
++		return 0;
++
++	bb = iter->bb;
++
++	if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST)
++		return 0;
++	
++	if (iter->ptr < bb->num) {
++		*blk = bb->list[iter->ptr++];
++		return 1;
++	} 
++	*blk = 0;
++	return 0;
++}
++
++int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, blk_t *blk)
++{
++	return ext2fs_u32_list_iterate((ext2_u32_iterate) iter,
++				       (__u32 *) blk);
++}
++
++
++void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter)
++{
++	if (!iter || (iter->magic != EXT2_ET_MAGIC_BADBLOCKS_ITERATE))
++		return;
++
++	iter->bb = 0;
++	ext2fs_free_mem(&iter);
++}
++
++void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter)
++{
++	ext2fs_u32_list_iterate_end((ext2_u32_iterate) iter);
++}
++
++
++int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2)
++{
++	EXT2_CHECK_MAGIC(bb1, EXT2_ET_MAGIC_BADBLOCKS_LIST);
++	EXT2_CHECK_MAGIC(bb2, EXT2_ET_MAGIC_BADBLOCKS_LIST);
++
++	if (bb1->num != bb2->num)
++		return 0;
++
++	if (memcmp(bb1->list, bb2->list, bb1->num * sizeof(blk_t)) != 0)
++		return 0;
++	return 1;
++}
++
++int ext2fs_badblocks_equal(ext2_badblocks_list bb1, ext2_badblocks_list bb2)
++{
++	return ext2fs_u32_list_equal((ext2_u32_list) bb1,
++				     (ext2_u32_list) bb2);
++}
++
++int ext2fs_u32_list_count(ext2_u32_list bb)
++{
++	return bb->num;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/bb_compat.c silo-1.4.11/libext2fs/bb_compat.c
+--- silo-1.4.11.orig/libext2fs/bb_compat.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bb_compat.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,63 @@
++/*
++ * bb_compat.c --- compatibility badblocks routines
++ * 
++ * Copyright (C) 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++errcode_t badblocks_list_create(badblocks_list *ret, int size)
++{
++	return ext2fs_badblocks_list_create(ret, size);
++}
++
++void badblocks_list_free(badblocks_list bb)
++{
++	ext2fs_badblocks_list_free(bb);
++}
++
++errcode_t badblocks_list_add(badblocks_list bb, blk_t blk)
++{
++	return ext2fs_badblocks_list_add(bb, blk);
++}
++
++int badblocks_list_test(badblocks_list bb, blk_t blk)
++{
++	return ext2fs_badblocks_list_test(bb, blk);
++}
++
++errcode_t badblocks_list_iterate_begin(badblocks_list bb,
++				       badblocks_iterate *ret)
++{
++	return ext2fs_badblocks_list_iterate_begin(bb, ret);
++}
++
++int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk)
++{
++	return ext2fs_badblocks_list_iterate(iter, blk);
++}
++
++void badblocks_list_iterate_end(badblocks_iterate iter)
++{
++	ext2fs_badblocks_list_iterate_end(iter);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/bb_inode.c silo-1.4.11/libext2fs/bb_inode.c
+--- silo-1.4.11.orig/libext2fs/bb_inode.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bb_inode.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,267 @@
++/*
++ * bb_inode.c --- routines to update the bad block inode.
++ * 
++ * WARNING: This routine modifies a lot of state in the filesystem; if
++ * this routine returns an error, the bad block inode may be in an
++ * inconsistent state.
++ * 
++ * Copyright (C) 1994, 1995 Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct set_badblock_record {
++	ext2_badblocks_iterate	bb_iter;
++	int		bad_block_count;
++	blk_t		*ind_blocks;
++	int		max_ind_blocks;
++	int		ind_blocks_size;
++	int		ind_blocks_ptr;
++	char		*block_buf;
++	errcode_t	err;
++};
++
++static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
++			      e2_blkcnt_t blockcnt,
++			      blk_t ref_block, int ref_offset,
++			      void *priv_data);
++static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
++				e2_blkcnt_t blockcnt,
++				blk_t ref_block, int ref_offset,
++				void *priv_data);
++	
++/*
++ * Given a bad blocks bitmap, update the bad blocks inode to reflect
++ * the map.
++ */
++errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
++{
++	errcode_t			retval;
++	struct set_badblock_record 	rec;
++	struct ext2_inode		inode;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!fs->block_map)
++		return EXT2_ET_NO_BLOCK_BITMAP;
++	
++	rec.bad_block_count = 0;
++	rec.ind_blocks_size = rec.ind_blocks_ptr = 0;
++	rec.max_ind_blocks = 10;
++	retval = ext2fs_get_mem(rec.max_ind_blocks * sizeof(blk_t),
++				&rec.ind_blocks);
++	if (retval)
++		return retval;
++	memset(rec.ind_blocks, 0, rec.max_ind_blocks * sizeof(blk_t));
++	retval = ext2fs_get_mem(fs->blocksize, &rec.block_buf);
++	if (retval)
++		goto cleanup;
++	memset(rec.block_buf, 0, fs->blocksize);
++	rec.err = 0;
++	
++	/*
++	 * First clear the old bad blocks (while saving the indirect blocks) 
++	 */
++	retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO,
++				       BLOCK_FLAG_DEPTH_TRAVERSE, 0,
++				       clear_bad_block_proc, &rec);
++	if (retval)
++		goto cleanup;
++	if (rec.err) {
++		retval = rec.err;
++		goto cleanup;
++	}
++	
++	/*
++	 * Now set the bad blocks!
++	 *
++	 * First, mark the bad blocks as used.  This prevents a bad
++	 * block from being used as an indirecto block for the bad
++	 * block inode (!).
++	 */
++	if (bb_list) {
++		retval = ext2fs_badblocks_list_iterate_begin(bb_list,
++							     &rec.bb_iter);
++		if (retval)
++			goto cleanup;
++		retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO,
++					       BLOCK_FLAG_APPEND, 0,
++					       set_bad_block_proc, &rec);
++		ext2fs_badblocks_list_iterate_end(rec.bb_iter);
++		if (retval) 
++			goto cleanup;
++		if (rec.err) {
++			retval = rec.err;
++			goto cleanup;
++		}
++	}
++	
++	/*
++	 * Update the bad block inode's mod time and block count
++	 * field.  
++	 */
++	retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode);
++	if (retval)
++		goto cleanup;
++	
++	inode.i_atime = inode.i_mtime = time(0);
++	if (!inode.i_ctime)
++		inode.i_ctime = time(0);
++	inode.i_blocks = rec.bad_block_count * (fs->blocksize / 512);
++	inode.i_size = rec.bad_block_count * fs->blocksize;
++
++	retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode);
++	if (retval)
++		goto cleanup;
++	
++cleanup:
++	ext2fs_free_mem(&rec.ind_blocks);
++	ext2fs_free_mem(&rec.block_buf);
++	return retval;
++}
++
++/*
++ * Helper function for update_bb_inode()
++ *
++ * Clear the bad blocks in the bad block inode, while saving the
++ * indirect blocks.
++ */
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
++				e2_blkcnt_t blockcnt,
++				blk_t ref_block EXT2FS_ATTR((unused)),
++				int ref_offset EXT2FS_ATTR((unused)),
++				void *priv_data)
++{
++	struct set_badblock_record *rec = (struct set_badblock_record *)
++		priv_data;
++	errcode_t	retval;
++	unsigned long 	old_size;
++
++	if (!*block_nr)
++		return 0;
++
++	/*
++	 * If the block number is outrageous, clear it and ignore it.
++	 */
++	if (*block_nr >= fs->super->s_blocks_count ||
++	    *block_nr < fs->super->s_first_data_block) {
++		*block_nr = 0;
++		return BLOCK_CHANGED;
++	}
++
++	if (blockcnt < 0) {
++		if (rec->ind_blocks_size >= rec->max_ind_blocks) {
++			old_size = rec->max_ind_blocks * sizeof(blk_t);
++			rec->max_ind_blocks += 10;
++			retval = ext2fs_resize_mem(old_size, 
++				   rec->max_ind_blocks * sizeof(blk_t),
++				   &rec->ind_blocks);
++			if (retval) {
++				rec->max_ind_blocks -= 10;
++				rec->err = retval;
++				return BLOCK_ABORT;
++			}
++		}
++		rec->ind_blocks[rec->ind_blocks_size++] = *block_nr;
++	}
++
++	/*
++	 * Mark the block as unused, and update accounting information
++	 */
++	ext2fs_block_alloc_stats(fs, *block_nr, -1);
++	
++	*block_nr = 0;
++	return BLOCK_CHANGED;
++}
++
++	
++/*
++ * Helper function for update_bb_inode()
++ *
++ * Set the block list in the bad block inode, using the supplied bitmap.
++ */
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
++			      e2_blkcnt_t blockcnt,
++			      blk_t ref_block EXT2FS_ATTR((unused)),
++			      int ref_offset EXT2FS_ATTR((unused)),
++			      void *priv_data)
++{
++	struct set_badblock_record *rec = (struct set_badblock_record *)
++		priv_data;
++	errcode_t	retval;
++	blk_t		blk;
++
++	if (blockcnt >= 0) {
++		/*
++		 * Get the next bad block.
++		 */
++		if (!ext2fs_badblocks_list_iterate(rec->bb_iter, &blk))
++			return BLOCK_ABORT;
++		rec->bad_block_count++;
++	} else {
++		/*
++		 * An indirect block; fetch a block from the
++		 * previously used indirect block list.  The block
++		 * most be not marked as used; if so, get another one.
++		 * If we run out of reserved indirect blocks, allocate
++		 * a new one.
++		 */
++	retry:
++		if (rec->ind_blocks_ptr < rec->ind_blocks_size) {
++			blk = rec->ind_blocks[rec->ind_blocks_ptr++];
++			if (ext2fs_test_block_bitmap(fs->block_map, blk))
++				goto retry;
++		} else {
++			retval = ext2fs_new_block(fs, 0, 0, &blk);
++			if (retval) {
++				rec->err = retval;
++				return BLOCK_ABORT;
++			}
++		}
++		retval = io_channel_write_blk(fs->io, blk, 1, rec->block_buf);
++		if (retval) {
++			rec->err = retval;
++			return BLOCK_ABORT;
++		}
++	}
++	
++	/*
++	 * Update block counts
++	 */
++	ext2fs_block_alloc_stats(fs, blk, +1);
++	
++	*block_nr = blk;
++	return BLOCK_CHANGED;
++}
++
++
++
++
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/bitmaps.c silo-1.4.11/libext2fs/bitmaps.c
+--- silo-1.4.11.orig/libext2fs/bitmaps.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bitmaps.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,212 @@
++/*
++ * bitmaps.c --- routines to read, write, and manipulate the inode and
++ * block bitmaps.
++ *
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end,
++			     const char *descr, char *init_map,
++			     ext2fs_generic_bitmap *ret)
++{
++	ext2fs_generic_bitmap	bitmap;
++	errcode_t		retval;
++	size_t			size;
++
++	retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), 
++				&bitmap);
++	if (retval)
++		return retval;
++
++	bitmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP;
++	bitmap->fs = NULL;
++	bitmap->start = start;
++	bitmap->end = end;
++	bitmap->real_end = real_end;
++	bitmap->base_error_code = EXT2_ET_BAD_GENERIC_MARK;
++	if (descr) {
++		retval = ext2fs_get_mem(strlen(descr)+1, &bitmap->description);
++		if (retval) {
++			ext2fs_free_mem(&bitmap);
++			return retval;
++		}
++		strcpy(bitmap->description, descr);
++	} else
++		bitmap->description = 0;
++
++	size = (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1);
++	retval = ext2fs_get_mem(size, &bitmap->bitmap);
++	if (retval) {
++		ext2fs_free_mem(&bitmap->description);
++		ext2fs_free_mem(&bitmap);
++		return retval;
++	}
++
++	if (init_map)
++		memcpy(bitmap->bitmap, init_map, size);
++	else
++		memset(bitmap->bitmap, 0, size);
++	*ret = bitmap;
++	return 0;
++}
++
++errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
++					 __u32 end,
++					 __u32 real_end,
++					 const char *descr,
++					 ext2fs_generic_bitmap *ret)
++{
++	return make_bitmap(start, end, real_end, descr, 0, ret);
++}
++
++errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
++			     ext2fs_generic_bitmap *dest)
++{
++	errcode_t		retval;
++	ext2fs_generic_bitmap	new_map;
++
++	retval = make_bitmap(src->start, src->end, src->real_end,
++			     src->description, src->bitmap, &new_map);
++	if (retval)
++		return retval;
++	new_map->magic = src->magic;
++	new_map->fs = src->fs;
++	new_map->base_error_code = src->base_error_code;
++	*dest = new_map;
++	return 0;
++}
++
++void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map)
++{
++	__u32	i, j;
++
++	for (i=map->end+1, j = i - map->start; i <= map->real_end; i++, j++)
++		ext2fs_set_bit(j, map->bitmap);
++
++	return;
++}	
++
++errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
++				       const char *descr,
++				       ext2fs_inode_bitmap *ret)
++{
++	ext2fs_inode_bitmap bitmap;
++	errcode_t	retval;
++	__u32		start, end, real_end;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	fs->write_bitmaps = ext2fs_write_bitmaps;
++
++	start = 1;
++	end = fs->super->s_inodes_count;
++	real_end = (EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count);
++
++	retval = ext2fs_allocate_generic_bitmap(start, end, real_end,
++						descr, &bitmap);
++	if (retval)
++		return retval;
++	
++	bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP;
++	bitmap->fs = fs;
++	bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK;
++	
++	*ret = bitmap;
++	return 0;
++}
++
++errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
++				       const char *descr,
++				       ext2fs_block_bitmap *ret)
++{
++	ext2fs_block_bitmap bitmap;
++	errcode_t	retval;
++	__u32		start, end, real_end;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	fs->write_bitmaps = ext2fs_write_bitmaps;
++
++	start = fs->super->s_first_data_block;
++	end = fs->super->s_blocks_count-1;
++	real_end = (EXT2_BLOCKS_PER_GROUP(fs->super)  
++		    * fs->group_desc_count)-1 + start;
++	
++	retval = ext2fs_allocate_generic_bitmap(start, end, real_end,
++						descr, &bitmap);
++	if (retval)
++		return retval;
++
++	bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP;
++	bitmap->fs = fs;
++	bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK;
++	
++	*ret = bitmap;
++	return 0;
++}
++
++errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
++					ext2_ino_t end, ext2_ino_t *oend)
++{
++	EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP);
++	
++	if (end > bitmap->real_end)
++		return EXT2_ET_FUDGE_INODE_BITMAP_END;
++	if (oend)
++		*oend = bitmap->end;
++	bitmap->end = end;
++	return 0;
++}
++
++errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
++					blk_t end, blk_t *oend)
++{
++	EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP);
++	
++	if (end > bitmap->real_end)
++		return EXT2_ET_FUDGE_BLOCK_BITMAP_END;
++	if (oend)
++		*oend = bitmap->end;
++	bitmap->end = end;
++	return 0;
++}
++
++void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap)
++{
++	if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP))
++		return;
++
++	memset(bitmap->bitmap, 0,
++	       (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1));
++}
++
++void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap)
++{
++	if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP))
++		return;
++
++	memset(bitmap->bitmap, 0,
++	       (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1));
++}
+diff -Naur silo-1.4.11.orig/libext2fs/bitops.c silo-1.4.11/libext2fs/bitops.c
+--- silo-1.4.11.orig/libext2fs/bitops.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bitops.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,91 @@
++/*
++ * bitops.c --- Bitmap frobbing code.  See bitops.h for the inlined
++ * 	routines.
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#ifndef _EXT2_HAVE_ASM_BITOPS_
++
++/*
++ * For the benefit of those who are trying to port Linux to another
++ * architecture, here are some C-language equivalents.  You should
++ * recode these in the native assmebly language, if at all possible.
++ *
++ * C language equivalents written by Theodore Ts'o, 9/26/92.
++ * Modified by Pete A. Zaitcev 7/14/95 to be portable to big endian
++ * systems, as well as non-32 bit systems.
++ */
++
++int ext2fs_set_bit(unsigned int nr,void * addr)
++{
++	int		mask, retval;
++	unsigned char	*ADDR = (unsigned char *) addr;
++
++	ADDR += nr >> 3;
++	mask = 1 << (nr & 0x07);
++	retval = mask & *ADDR;
++	*ADDR |= mask;
++	return retval;
++}
++
++int ext2fs_clear_bit(unsigned int nr, void * addr)
++{
++	int		mask, retval;
++	unsigned char	*ADDR = (unsigned char *) addr;
++
++	ADDR += nr >> 3;
++	mask = 1 << (nr & 0x07);
++	retval = mask & *ADDR;
++	*ADDR &= ~mask;
++	return retval;
++}
++
++int ext2fs_test_bit(unsigned int nr, const void * addr)
++{
++	int			mask;
++	const unsigned char	*ADDR = (const unsigned char *) addr;
++
++	ADDR += nr >> 3;
++	mask = 1 << (nr & 0x07);
++	return (mask & *ADDR);
++}
++
++#endif	/* !_EXT2_HAVE_ASM_BITOPS_ */
++
++void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
++			const char *description)
++{
++#ifndef OMIT_COM_ERR
++	if (description)
++		com_err(0, errcode, "#%lu for %s", arg, description);
++	else
++		com_err(0, errcode, "#%lu", arg);
++#endif
++}
++
++void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
++			    int code, unsigned long arg)
++{
++#ifndef OMIT_COM_ERR
++	if (bitmap->description)
++		com_err(0, bitmap->base_error_code+code,
++			"#%lu for %s", arg, bitmap->description);
++	else
++		com_err(0, bitmap->base_error_code + code, "#%lu", arg);
++#endif
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/bitops.h silo-1.4.11/libext2fs/bitops.h
+--- silo-1.4.11.orig/libext2fs/bitops.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bitops.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,617 @@
++/*
++ * bitops.h --- Bitmap frobbing code.  The byte swapping routines are
++ * 	also included here.
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ * 
++ * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
++ * Linus Torvalds.
++ */
++
++
++extern int ext2fs_set_bit(unsigned int nr,void * addr);
++extern int ext2fs_clear_bit(unsigned int nr, void * addr);
++extern int ext2fs_test_bit(unsigned int nr, const void * addr);
++extern __u16 ext2fs_swab16(__u16 val);
++extern __u32 ext2fs_swab32(__u32 val);
++
++#ifdef WORDS_BIGENDIAN
++#define ext2fs_cpu_to_le32(x) ext2fs_swab32((x))
++#define ext2fs_le32_to_cpu(x) ext2fs_swab32((x))
++#define ext2fs_cpu_to_le16(x) ext2fs_swab16((x))
++#define ext2fs_le16_to_cpu(x) ext2fs_swab16((x))
++#define ext2fs_cpu_to_be32(x) ((__u32)(x))
++#define ext2fs_be32_to_cpu(x) ((__u32)(x))
++#define ext2fs_cpu_to_be16(x) ((__u16)(x))
++#define ext2fs_be16_to_cpu(x) ((__u16)(x))
++#else
++#define ext2fs_cpu_to_le32(x) ((__u32)(x))
++#define ext2fs_le32_to_cpu(x) ((__u32)(x))
++#define ext2fs_cpu_to_le16(x) ((__u16)(x))
++#define ext2fs_le16_to_cpu(x) ((__u16)(x))
++#define ext2fs_cpu_to_be32(x) ext2fs_swab32((x))
++#define ext2fs_be32_to_cpu(x) ext2fs_swab32((x))
++#define ext2fs_cpu_to_be16(x) ext2fs_swab16((x))
++#define ext2fs_be16_to_cpu(x) ext2fs_swab16((x))
++#endif
++
++/*
++ * EXT2FS bitmap manipulation routines.
++ */
++
++/* Support for sending warning messages from the inline subroutines */
++extern const char *ext2fs_block_string;
++extern const char *ext2fs_inode_string;
++extern const char *ext2fs_mark_string;
++extern const char *ext2fs_unmark_string;
++extern const char *ext2fs_test_string;
++extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
++			       const char *description);
++extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
++				int code, unsigned long arg);
++
++extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
++extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
++				       blk_t block);
++extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
++
++extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
++extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++				       ext2_ino_t inode);
++extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
++
++extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
++					  blk_t block);
++extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
++					    blk_t block);
++extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
++					 blk_t block);
++
++extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					  ext2_ino_t inode);
++extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					    ext2_ino_t inode);
++extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					 ext2_ino_t inode);
++extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
++extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
++extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
++extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
++
++extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					   blk_t block, int num);
++extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					     blk_t block, int num);
++extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					  blk_t block, int num);
++extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++						blk_t block, int num);
++extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++						  blk_t block, int num);
++extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					       blk_t block, int num);
++extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
++
++/* These two routines moved to gen_bitmap.c */
++extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
++					 __u32 bitno);
++extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
++					   blk_t bitno);
++/*
++ * The inline routines themselves...
++ * 
++ * If NO_INLINE_FUNCS is defined, then we won't try to do inline
++ * functions at all; they will be included as normal functions in
++ * inline.c
++ */
++#ifdef NO_INLINE_FUNCS
++#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
++			   defined(__i586__) || defined(__mc68000__) || \
++			   defined(__sparc__)))
++	/* This prevents bitops.c from trying to include the C */
++	/* function version of these functions */
++#define _EXT2_HAVE_ASM_BITOPS_
++#endif
++#endif /* NO_INLINE_FUNCS */
++
++#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
++#ifdef INCLUDE_INLINE_FUNCS
++#define _INLINE_ extern
++#else
++#ifdef __GNUC__
++#define _INLINE_ extern __inline__
++#else				/* For Watcom C */
++#define _INLINE_ extern inline
++#endif
++#endif
++
++#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
++     (defined(__i386__) || defined(__i486__) || defined(__i586__)))
++
++#define _EXT2_HAVE_ASM_BITOPS_
++#define _EXT2_HAVE_ASM_SWAB_
++#define _EXT2_HAVE_ASM_FINDBIT_
++
++/*
++ * These are done by inline assembly for speed reasons.....
++ *
++ * All bitoperations return 0 if the bit was cleared before the
++ * operation and != 0 if it was not.  Bit 0 is the LSB of addr; bit 32
++ * is the LSB of (addr+1).
++ */
++
++/*
++ * Some hacks to defeat gcc over-optimizations..
++ */
++struct __dummy_h { unsigned long a[100]; };
++#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
++#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)	
++
++_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
++{
++	int oldbit;
++
++	__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
++		:"=r" (oldbit),"=m" (EXT2FS_ADDR)
++		:"r" (nr));
++	return oldbit;
++}
++
++_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
++{
++	int oldbit;
++
++	__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
++		:"=r" (oldbit),"=m" (EXT2FS_ADDR)
++		:"r" (nr));
++	return oldbit;
++}
++
++_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
++{
++	int oldbit;
++
++	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
++		:"=r" (oldbit)
++		:"m" (EXT2FS_CONST_ADDR),"r" (nr));
++	return oldbit;
++}
++
++#if 0
++_INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
++{
++	int d0, d1, d2;
++	int res;
++
++	if (!size)
++		return 0;
++	/* This looks at memory. Mark it volatile to tell gcc not to move it around */
++	__asm__ __volatile__(
++		"cld\n\t"			     
++		"xorl %%eax,%%eax\n\t"
++		"xorl %%edx,%%edx\n\t"
++		"repe; scasl\n\t"
++		"je 1f\n\t"
++		"movl -4(%%edi),%%eax\n\t"
++		"subl $4,%%edi\n\t"
++		"bsfl %%eax,%%edx\n"
++		"1:\tsubl %%esi,%%edi\n\t"
++		"shll $3,%%edi\n\t"
++		"addl %%edi,%%edx"
++		:"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
++		:"1" ((size + 31) >> 5), "2" (addr), "S" (addr));
++	return res;
++}
++
++_INLINE_ int ext2fs_find_next_bit_set (void * addr, int size, int offset)
++{
++	unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
++	int set = 0, bit = offset & 31, res;
++	
++	if (bit) {
++		/*
++		 * Look for zero in first byte
++		 */
++		__asm__("bsfl %1,%0\n\t"
++			"jne 1f\n\t"
++			"movl $32, %0\n"
++			"1:"
++			: "=r" (set)
++			: "r" (*p >> bit));
++		if (set < (32 - bit))
++			return set + offset;
++		set = 32 - bit;
++		p++;
++	}
++	/*
++	 * No bit found yet, search remaining full bytes for a bit
++	 */
++	res = ext2fs_find_first_bit_set(p, size - 32 * (p - (unsigned long *) addr));
++	return (offset + set + res);
++}
++#endif
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++_INLINE_ __u32 ext2fs_swab32(__u32 val)
++{
++#ifdef EXT2FS_REQUIRE_486
++	__asm__("bswap %0" : "=r" (val) : "0" (val));
++#else
++	__asm__("xchgb %b0,%h0\n\t"	/* swap lower bytes	*/
++		"rorl $16,%0\n\t"	/* swap words		*/
++		"xchgb %b0,%h0"		/* swap higher bytes	*/
++		:"=q" (val)
++		: "0" (val));
++#endif
++	return val;
++}
++
++_INLINE_ __u16 ext2fs_swab16(__u16 val)
++{
++	__asm__("xchgb %b0,%h0"		/* swap bytes		*/ \
++		: "=q" (val) \
++		:  "0" (val)); \
++		return val;
++}
++#endif
++
++#undef EXT2FS_ADDR
++
++#endif	/* i386 */
++
++#ifdef __mc68000__
++
++#define _EXT2_HAVE_ASM_BITOPS_
++
++_INLINE_ int ext2fs_set_bit(unsigned int nr,void * addr)
++{
++	char retval;
++
++	__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
++	     : "=d" (retval) : "d" (nr^7), "a" (addr));
++
++	return retval;
++}
++
++_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
++{
++	char retval;
++
++	__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
++	     : "=d" (retval) : "d" (nr^7), "a" (addr));
++
++	return retval;
++}
++
++_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
++{
++	char retval;
++
++	__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
++	     : "=d" (retval) : "d" (nr^7), "a" (addr));
++
++	return retval;
++}
++
++#endif /* __mc68000__ */
++
++
++#if !defined(_EXT2_HAVE_ASM_SWAB_) && defined(EXT2FS_ENABLE_SWAPFS)
++
++_INLINE_ __u16 ext2fs_swab16(__u16 val)
++{
++	return (val >> 8) | (val << 8);
++}
++
++_INLINE_ __u32 ext2fs_swab32(__u32 val)
++{
++	return ((val>>24) | ((val>>8)&0xFF00) |
++		((val<<8)&0xFF0000) | (val<<24));
++}
++
++#endif /* !_EXT2_HAVE_ASM_SWAB */
++
++#if !defined(_EXT2_HAVE_ASM_FINDBIT_)
++_INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
++{
++	char	*cp = (unsigned char *) addr;
++	int 	res = 0, d0;
++
++	if (!size)
++		return 0;
++
++	while ((size > res) && (*cp == 0)) {
++		cp++;
++		res += 8;
++	}
++	d0 = ffs(*cp);
++	if (d0 == 0)
++		return size;
++	
++	return res + d0 - 1;
++}
++
++_INLINE_ int ext2fs_find_next_bit_set (void * addr, int size, int offset)
++{
++	unsigned char * p;
++	int set = 0, bit = offset & 7, res = 0, d0;
++	
++	res = offset >> 3;
++	p = ((unsigned char *) addr) + res;
++	
++	if (bit) {
++		set = ffs(*p & ~((1 << bit) - 1));
++		if (set)
++			return (offset & ~7) + set - 1;
++		p++;
++		res += 8;
++	}
++	while ((size > res) && (*p == 0)) {
++		p++;
++		res += 8;
++	}
++	d0 = ffs(*p);
++	if (d0 == 0)
++		return size;
++
++	return (res + d0 - 1);
++}
++#endif	
++
++_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
++					blk_t bitno);
++
++_INLINE_ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
++					blk_t bitno)
++{
++	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
++		ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, bitno);
++		return 0;
++	}
++	return ext2fs_test_bit(bitno - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
++				       blk_t block)
++{
++	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap)
++				       bitmap,
++					  block);
++}
++
++_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
++					 blk_t block)
++{
++	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
++					    block);
++}
++
++_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
++				       blk_t block)
++{
++	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
++					  block);
++}
++
++_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++				       ext2_ino_t inode)
++{
++	return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
++					  inode);
++}
++
++_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					 ext2_ino_t inode)
++{
++	return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
++				     inode);
++}
++
++_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
++				       ext2_ino_t inode)
++{
++	return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
++					  inode);
++}
++
++_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
++					    blk_t block)
++{
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((block < bitmap->start) || (block > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
++				   bitmap->description);
++		return;
++	}
++#endif	
++	ext2fs_set_bit(block - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
++					      blk_t block)
++{
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((block < bitmap->start) || (block > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK,
++				   block, bitmap->description);
++		return;
++	}
++#endif
++	ext2fs_clear_bit(block - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
++					    blk_t block)
++{
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((block < bitmap->start) || (block > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
++				   block, bitmap->description);
++		return 0;
++	}
++#endif
++	return ext2fs_test_bit(block - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					    ext2_ino_t inode)
++{
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((inode < bitmap->start) || (inode > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_MARK,
++				   inode, bitmap->description);
++		return;
++	}
++#endif
++	ext2fs_set_bit(inode - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					      ext2_ino_t inode)
++{
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((inode < bitmap->start) || (inode > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_UNMARK,
++				   inode, bitmap->description);
++		return;
++	}
++#endif
++	ext2fs_clear_bit(inode - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
++					   ext2_ino_t inode)
++{
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((inode < bitmap->start) || (inode > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_INODE_TEST,
++				   inode, bitmap->description);
++		return 0;
++	}
++#endif
++	return ext2fs_test_bit(inode - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
++{
++	return bitmap->start;
++}
++
++_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
++{
++	return bitmap->start;
++}
++
++_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
++{
++	return bitmap->end;
++}
++
++_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
++{
++	return bitmap->end;
++}
++
++_INLINE_ int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					    blk_t block, int num)
++{
++	int	i;
++
++	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
++				   block, bitmap->description);
++		return 0;
++	}
++	for (i=0; i < num; i++) {
++		if (ext2fs_fast_test_block_bitmap(bitmap, block+i))
++			return 0;
++	}
++	return 1;
++}
++
++_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
++						 blk_t block, int num)
++{
++	int	i;
++
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_TEST,
++				   block, bitmap->description);
++		return 0;
++	}
++#endif
++	for (i=0; i < num; i++) {
++		if (ext2fs_fast_test_block_bitmap(bitmap, block+i))
++			return 0;
++	}
++	return 1;
++}
++
++_INLINE_ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					     blk_t block, int num)
++{
++	int	i;
++	
++	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
++				   bitmap->description);
++		return;
++	}
++	for (i=0; i < num; i++)
++		ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++						  blk_t block, int num)
++{
++	int	i;
++	
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block,
++				   bitmap->description);
++		return;
++	}
++#endif	
++	for (i=0; i < num; i++)
++		ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++					       blk_t block, int num)
++{
++	int	i;
++	
++	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
++				   bitmap->description);
++		return;
++	}
++	for (i=0; i < num; i++)
++		ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
++}
++
++_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
++						    blk_t block, int num)
++{
++	int	i;
++	
++#ifdef EXT2FS_DEBUG_FAST_OPS
++	if ((block < bitmap->start) || (block+num-1 > bitmap->end)) {
++		ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block,
++				   bitmap->description);
++		return;
++	}
++#endif	
++	for (i=0; i < num; i++)
++		ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap);
++}
++#undef _INLINE_
++#endif
++
+diff -Naur silo-1.4.11.orig/libext2fs/block.c silo-1.4.11/libext2fs/block.c
+--- silo-1.4.11.orig/libext2fs/block.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/block.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,437 @@
++/*
++ * block.c --- iterate over all blocks in an inode
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct block_context {
++	ext2_filsys	fs;
++	int (*func)(ext2_filsys	fs,
++		    blk_t	*blocknr,
++		    e2_blkcnt_t	bcount,
++		    blk_t	ref_blk,
++		    int		ref_offset,
++		    void	*priv_data);
++	e2_blkcnt_t	bcount;
++	int		bsize;
++	int		flags;
++	errcode_t	errcode;
++	char	*ind_buf;
++	char	*dind_buf;
++	char	*tind_buf;
++	void	*priv_data;
++};
++
++static int block_iterate_ind(blk_t *ind_block, blk_t ref_block,
++			     int ref_offset, struct block_context *ctx)
++{
++	int	ret = 0, changed = 0;
++	int	i, flags, limit, offset;
++	blk_t	*block_nr;
++
++	limit = ctx->fs->blocksize >> 2;
++	if (!(ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
++	    !(ctx->flags & BLOCK_FLAG_DATA_ONLY))
++		ret = (*ctx->func)(ctx->fs, ind_block,
++				   BLOCK_COUNT_IND, ref_block,
++				   ref_offset, ctx->priv_data);
++	if (!*ind_block || (ret & BLOCK_ABORT)) {
++		ctx->bcount += limit;
++		return ret;
++	}
++	if (*ind_block >= ctx->fs->super->s_blocks_count ||
++	    *ind_block < ctx->fs->super->s_first_data_block) {
++		ctx->errcode = EXT2_ET_BAD_IND_BLOCK;
++		ret |= BLOCK_ERROR;
++		return ret;
++	}
++	ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, 
++					     ctx->ind_buf);
++	if (ctx->errcode) {
++		ret |= BLOCK_ERROR;
++		return ret;
++	}
++
++	block_nr = (blk_t *) ctx->ind_buf;
++	offset = 0;
++	if (ctx->flags & BLOCK_FLAG_APPEND) {
++		for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
++			flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
++					     *ind_block, offset, 
++					     ctx->priv_data);
++			changed	|= flags;
++			if (flags & BLOCK_ABORT) {
++				ret |= BLOCK_ABORT;
++				break;
++			}
++			offset += sizeof(blk_t);
++		}
++	} else {
++		for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) {
++			if (*block_nr == 0)
++				continue;
++			flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount,
++					     *ind_block, offset, 
++					     ctx->priv_data);
++			changed	|= flags;
++			if (flags & BLOCK_ABORT) {
++				ret |= BLOCK_ABORT;
++				break;
++			}
++			offset += sizeof(blk_t);
++		}
++	}
++	if (changed & BLOCK_CHANGED) {
++		ctx->errcode = ext2fs_write_ind_block(ctx->fs, *ind_block,
++						      ctx->ind_buf);
++		if (ctx->errcode)
++			ret |= BLOCK_ERROR | BLOCK_ABORT;
++	}
++	if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
++	    !(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
++	    !(ret & BLOCK_ABORT))
++		ret |= (*ctx->func)(ctx->fs, ind_block,
++				    BLOCK_COUNT_IND, ref_block,
++				    ref_offset, ctx->priv_data);
++	return ret;
++}
++	
++static int block_iterate_dind(blk_t *dind_block, blk_t ref_block,
++			      int ref_offset, struct block_context *ctx)
++{
++	int	ret = 0, changed = 0;
++	int	i, flags, limit, offset;
++	blk_t	*block_nr;
++
++	limit = ctx->fs->blocksize >> 2;
++	if (!(ctx->flags & (BLOCK_FLAG_DEPTH_TRAVERSE |
++			    BLOCK_FLAG_DATA_ONLY)))
++		ret = (*ctx->func)(ctx->fs, dind_block,
++				   BLOCK_COUNT_DIND, ref_block,
++				   ref_offset, ctx->priv_data);
++	if (!*dind_block || (ret & BLOCK_ABORT)) {
++		ctx->bcount += limit*limit;
++		return ret;
++	}
++	if (*dind_block >= ctx->fs->super->s_blocks_count ||
++	    *dind_block < ctx->fs->super->s_first_data_block) {
++		ctx->errcode = EXT2_ET_BAD_DIND_BLOCK;
++		ret |= BLOCK_ERROR;
++		return ret;
++	}
++	ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, 
++					     ctx->dind_buf);
++	if (ctx->errcode) {
++		ret |= BLOCK_ERROR;
++		return ret;
++	}
++
++	block_nr = (blk_t *) ctx->dind_buf;
++	offset = 0;
++	if (ctx->flags & BLOCK_FLAG_APPEND) {
++		for (i = 0; i < limit; i++, block_nr++) {
++			flags = block_iterate_ind(block_nr,
++						  *dind_block, offset,
++						  ctx);
++			changed |= flags;
++			if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
++				ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
++				break;
++			}
++			offset += sizeof(blk_t);
++		}
++	} else {
++		for (i = 0; i < limit; i++, block_nr++) {
++			if (*block_nr == 0) {
++				ctx->bcount += limit;
++				continue;
++			}
++			flags = block_iterate_ind(block_nr,
++						  *dind_block, offset,
++						  ctx);
++			changed |= flags;
++			if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
++				ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
++				break;
++			}
++			offset += sizeof(blk_t);
++		}
++	}
++	if (changed & BLOCK_CHANGED) {
++		ctx->errcode = ext2fs_write_ind_block(ctx->fs, *dind_block,
++						      ctx->dind_buf);
++		if (ctx->errcode)
++			ret |= BLOCK_ERROR | BLOCK_ABORT;
++	}
++	if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
++	    !(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
++	    !(ret & BLOCK_ABORT))
++		ret |= (*ctx->func)(ctx->fs, dind_block,
++				    BLOCK_COUNT_DIND, ref_block,
++				    ref_offset, ctx->priv_data);
++	return ret;
++}
++	
++static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
++			      int ref_offset, struct block_context *ctx)
++{
++	int	ret = 0, changed = 0;
++	int	i, flags, limit, offset;
++	blk_t	*block_nr;
++
++	limit = ctx->fs->blocksize >> 2;
++	if (!(ctx->flags & (BLOCK_FLAG_DEPTH_TRAVERSE |
++			    BLOCK_FLAG_DATA_ONLY)))
++		ret = (*ctx->func)(ctx->fs, tind_block,
++				   BLOCK_COUNT_TIND, ref_block,
++				   ref_offset, ctx->priv_data);
++	if (!*tind_block || (ret & BLOCK_ABORT)) {
++		ctx->bcount += limit*limit*limit;
++		return ret;
++	}
++	if (*tind_block >= ctx->fs->super->s_blocks_count ||
++	    *tind_block < ctx->fs->super->s_first_data_block) {
++		ctx->errcode = EXT2_ET_BAD_TIND_BLOCK;
++		ret |= BLOCK_ERROR;
++		return ret;
++	}
++	ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, 
++					     ctx->tind_buf);
++	if (ctx->errcode) {
++		ret |= BLOCK_ERROR;
++		return ret;
++	}
++
++	block_nr = (blk_t *) ctx->tind_buf;
++	offset = 0;
++	if (ctx->flags & BLOCK_FLAG_APPEND) {
++		for (i = 0; i < limit; i++, block_nr++) {
++			flags = block_iterate_dind(block_nr,
++						   *tind_block,
++						   offset, ctx);
++			changed |= flags;
++			if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
++				ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
++				break;
++			}
++			offset += sizeof(blk_t);
++		}
++	} else {
++		for (i = 0; i < limit; i++, block_nr++) {
++			if (*block_nr == 0) {
++				ctx->bcount += limit*limit;
++				continue;
++			}
++			flags = block_iterate_dind(block_nr,
++						   *tind_block,
++						   offset, ctx);
++			changed |= flags;
++			if (flags & (BLOCK_ABORT | BLOCK_ERROR)) {
++				ret |= flags & (BLOCK_ABORT | BLOCK_ERROR);
++				break;
++			}
++			offset += sizeof(blk_t);
++		}
++	}
++	if (changed & BLOCK_CHANGED) {
++		ctx->errcode = ext2fs_write_ind_block(ctx->fs, *tind_block,
++						      ctx->tind_buf);
++		if (ctx->errcode)
++			ret |= BLOCK_ERROR | BLOCK_ABORT;
++	}
++	if ((ctx->flags & BLOCK_FLAG_DEPTH_TRAVERSE) &&
++	    !(ctx->flags & BLOCK_FLAG_DATA_ONLY) &&
++	    !(ret & BLOCK_ABORT))
++		ret |= (*ctx->func)(ctx->fs, tind_block,
++				    BLOCK_COUNT_TIND, ref_block,
++				    ref_offset, ctx->priv_data);
++	
++	return ret;
++}
++	
++errcode_t ext2fs_block_iterate2(ext2_filsys fs,
++				ext2_ino_t ino,
++				int	flags,
++				char *block_buf,
++				int (*func)(ext2_filsys fs,
++					    blk_t	*blocknr,
++					    e2_blkcnt_t	blockcnt,
++					    blk_t	ref_blk,
++					    int		ref_offset,
++					    void	*priv_data),
++				void *priv_data)
++{
++	int	i;
++	int	got_inode = 0;
++	int	ret = 0;
++	blk_t	blocks[EXT2_N_BLOCKS];	/* directory data blocks */
++	struct ext2_inode inode;
++	errcode_t	retval;
++	struct block_context ctx;
++	int	limit;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	/*
++	 * Check to see if we need to limit large files
++	 */
++	if (flags & BLOCK_FLAG_NO_LARGE) {
++		ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
++		if (ctx.errcode)
++			return ctx.errcode;
++		got_inode = 1;
++		if (!LINUX_S_ISDIR(inode.i_mode) &&
++		    (inode.i_size_high != 0))
++			return EXT2_ET_FILE_TOO_BIG;
++	}
++
++	retval = ext2fs_get_blocks(fs, ino, blocks);
++	if (retval)
++		return retval;
++
++	limit = fs->blocksize >> 2;
++
++	ctx.fs = fs;
++	ctx.func = func;
++	ctx.priv_data = priv_data;
++	ctx.flags = flags;
++	ctx.bcount = 0;
++	if (block_buf) {
++		ctx.ind_buf = block_buf;
++	} else {
++		retval = ext2fs_get_mem(fs->blocksize * 3, &ctx.ind_buf);
++		if (retval)
++			return retval;
++	}
++	ctx.dind_buf = ctx.ind_buf + fs->blocksize;
++	ctx.tind_buf = ctx.dind_buf + fs->blocksize;
++
++	/*
++	 * Iterate over the HURD translator block (if present)
++	 */
++	if ((fs->super->s_creator_os == EXT2_OS_HURD) &&
++	    !(flags & BLOCK_FLAG_DATA_ONLY)) {
++		ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
++		if (ctx.errcode)
++			goto abort_exit;
++		got_inode = 1;
++		if (inode.osd1.hurd1.h_i_translator) {
++			ret |= (*ctx.func)(fs,
++					   &inode.osd1.hurd1.h_i_translator,
++					   BLOCK_COUNT_TRANSLATOR,
++					   0, 0, priv_data);
++			if (ret & BLOCK_ABORT)
++				goto abort_exit;
++		}
++	}
++	
++	/*
++	 * Iterate over normal data blocks
++	 */
++	for (i = 0; i < EXT2_NDIR_BLOCKS ; i++, ctx.bcount++) {
++		if (blocks[i] || (flags & BLOCK_FLAG_APPEND)) {
++			ret |= (*ctx.func)(fs, &blocks[i],
++					    ctx.bcount, 0, i, priv_data);
++			if (ret & BLOCK_ABORT)
++				goto abort_exit;
++		}
++	}
++	if (*(blocks + EXT2_IND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
++		ret |= block_iterate_ind(blocks + EXT2_IND_BLOCK,
++					 0, EXT2_IND_BLOCK, &ctx);
++		if (ret & BLOCK_ABORT)
++			goto abort_exit;
++	} else
++		ctx.bcount += limit;
++	if (*(blocks + EXT2_DIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
++		ret |= block_iterate_dind(blocks + EXT2_DIND_BLOCK,
++					  0, EXT2_DIND_BLOCK, &ctx);
++		if (ret & BLOCK_ABORT)
++			goto abort_exit;
++	} else
++		ctx.bcount += limit * limit;
++	if (*(blocks + EXT2_TIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
++		ret |= block_iterate_tind(blocks + EXT2_TIND_BLOCK,
++					  0, EXT2_TIND_BLOCK, &ctx);
++		if (ret & BLOCK_ABORT)
++			goto abort_exit;
++	}
++
++abort_exit:
++	if (ret & BLOCK_CHANGED) {
++		if (!got_inode) {
++			retval = ext2fs_read_inode(fs, ino, &inode);
++			if (retval)
++				return retval;
++		}
++		for (i=0; i < EXT2_N_BLOCKS; i++)
++			inode.i_block[i] = blocks[i];
++		retval = ext2fs_write_inode(fs, ino, &inode);
++		if (retval)
++			return retval;
++	}
++
++	if (!block_buf)
++		ext2fs_free_mem(&ctx.ind_buf);
++
++	return (ret & BLOCK_ERROR) ? ctx.errcode : 0;
++}
++
++/*
++ * Emulate the old ext2fs_block_iterate function!
++ */
++
++struct xlate {
++	int (*func)(ext2_filsys	fs,
++		    blk_t	*blocknr,
++		    int		bcount,
++		    void	*priv_data);
++	void *real_private;
++};
++
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
++		      blk_t ref_block EXT2FS_ATTR((unused)),
++		      int ref_offset EXT2FS_ATTR((unused)),
++		      void *priv_data)
++{
++	struct xlate *xl = (struct xlate *) priv_data;
++
++	return (*xl->func)(fs, blocknr, (int) blockcnt, xl->real_private);
++}
++
++errcode_t ext2fs_block_iterate(ext2_filsys fs,
++			       ext2_ino_t ino,
++			       int	flags,
++			       char *block_buf,
++			       int (*func)(ext2_filsys fs,
++					   blk_t	*blocknr,
++					   int	blockcnt,
++					   void	*priv_data),
++			       void *priv_data)
++{
++	struct xlate xl;
++	
++	xl.real_private = priv_data;
++	xl.func = func;
++
++	return ext2fs_block_iterate2(fs, ino, BLOCK_FLAG_NO_LARGE | flags,
++				     block_buf, xlate_func, &xl);
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/bmap.c silo-1.4.11/libext2fs/bmap.c
+--- silo-1.4.11.orig/libext2fs/bmap.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bmap.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,270 @@
++/*
++ * bmap.c --- logical to physical block mapping
++ *
++ * Copyright (C) 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#if defined(__GNUC__) && !defined(NO_INLINE_FUNCS)
++#define _BMAP_INLINE_	__inline__
++#else
++#define _BMAP_INLINE_
++#endif
++
++extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
++			     struct ext2_inode *inode, 
++			     char *block_buf, int bmap_flags,
++			     blk_t block, blk_t *phys_blk);
++
++#define inode_bmap(inode, nr) ((inode)->i_block[(nr)])
++
++static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, 
++					      blk_t ind, char *block_buf, 
++					      int *blocks_alloc,
++					      blk_t nr, blk_t *ret_blk)
++{
++	errcode_t	retval;
++	blk_t		b;
++
++	if (!ind) {
++		if (flags & BMAP_SET)
++			return EXT2_ET_SET_BMAP_NO_IND;
++		*ret_blk = 0;
++		return 0;
++	}
++	retval = io_channel_read_blk(fs->io, ind, 1, block_buf);
++	if (retval)
++		return retval;
++
++	if (flags & BMAP_SET) {
++		b = *ret_blk;
++#ifdef EXT2FS_ENABLE_SWAPFS
++		if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++		    (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
++			b = ext2fs_swab32(b);
++#endif
++		((blk_t *) block_buf)[nr] = b;
++		return io_channel_write_blk(fs->io, ind, 1, block_buf);
++	}
++
++	b = ((blk_t *) block_buf)[nr];
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++	    (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
++		b = ext2fs_swab32(b);
++#endif
++
++	if (!b && (flags & BMAP_ALLOC)) {
++		b = nr ? ((blk_t *) block_buf)[nr-1] : 0;
++		retval = ext2fs_alloc_block(fs, b,
++					    block_buf + fs->blocksize, &b);
++		if (retval)
++			return retval;
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++		if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++		    (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
++			((blk_t *) block_buf)[nr] = ext2fs_swab32(b);
++		else
++#endif
++			((blk_t *) block_buf)[nr] = b;
++
++		retval = io_channel_write_blk(fs->io, ind, 1, block_buf);
++		if (retval)
++			return retval;
++
++		(*blocks_alloc)++;
++	}
++
++	*ret_blk = b;
++	return 0;
++}
++
++static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags,
++					       blk_t dind, char *block_buf, 
++					       int *blocks_alloc,
++					       blk_t nr, blk_t *ret_blk)
++{
++	blk_t		b;
++	errcode_t	retval;
++	blk_t		addr_per_block;
++	
++	addr_per_block = (blk_t) fs->blocksize >> 2;
++
++	retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, 
++				blocks_alloc, nr / addr_per_block, &b);
++	if (retval)
++		return retval;
++	retval = block_ind_bmap(fs, flags, b, block_buf, blocks_alloc,
++				nr % addr_per_block, ret_blk);
++	return retval;
++}
++
++static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags,
++					       blk_t tind, char *block_buf, 
++					       int *blocks_alloc,
++					       blk_t nr, blk_t *ret_blk)
++{
++	blk_t		b;
++	errcode_t	retval;
++	blk_t		addr_per_block;
++	
++	addr_per_block = (blk_t) fs->blocksize >> 2;
++
++	retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, 
++				 blocks_alloc, nr / addr_per_block, &b);
++	if (retval)
++		return retval;
++	retval = block_ind_bmap(fs, flags, b, block_buf, blocks_alloc,
++				nr % addr_per_block, ret_blk);
++	return retval;
++}
++
++errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
++		      char *block_buf, int bmap_flags, blk_t block,
++		      blk_t *phys_blk)
++{
++	struct ext2_inode inode_buf;
++	blk_t addr_per_block;
++	blk_t	b;
++	char	*buf = 0;
++	errcode_t	retval = 0;
++	int		blocks_alloc = 0, inode_dirty = 0;
++
++	if (!(bmap_flags & BMAP_SET))
++		*phys_blk = 0;
++
++	/* Read inode structure if necessary */
++	if (!inode) {
++		retval = ext2fs_read_inode(fs, ino, &inode_buf);
++		if (retval)
++			return retval;
++		inode = &inode_buf;
++	}
++	addr_per_block = (blk_t) fs->blocksize >> 2;
++
++	if (!block_buf) {
++		retval = ext2fs_get_mem(fs->blocksize * 2, &buf);
++		if (retval)
++			return retval;
++		block_buf = buf;
++	}
++
++	if (block < EXT2_NDIR_BLOCKS) {
++		if (bmap_flags & BMAP_SET) {
++			b = *phys_blk;
++#ifdef EXT2FS_ENABLE_SWAPFS
++			if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++			    (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
++				b = ext2fs_swab32(b);
++#endif
++			inode_bmap(inode, block) = b;
++			inode_dirty++;
++			goto done;
++		}
++
++		*phys_blk = inode_bmap(inode, block);
++		b = block ? inode_bmap(inode, block-1) : 0;
++		
++		if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) {
++			retval = ext2fs_alloc_block(fs, b, block_buf, &b);
++			if (retval)
++				goto done;
++			inode_bmap(inode, block) = b;
++			blocks_alloc++;
++			*phys_blk = b;
++		}
++		goto done;
++	}
++	
++	/* Indirect block */
++	block -= EXT2_NDIR_BLOCKS;
++	if (block < addr_per_block) {
++		b = inode_bmap(inode, EXT2_IND_BLOCK);
++		if (!b) {
++			if (!(bmap_flags & BMAP_ALLOC)) {
++				if (bmap_flags & BMAP_SET)
++					retval = EXT2_ET_SET_BMAP_NO_IND;
++				goto done;
++			}
++
++			b = inode_bmap(inode, EXT2_IND_BLOCK-1);
++ 			retval = ext2fs_alloc_block(fs, b, block_buf, &b);
++			if (retval)
++				goto done;
++			inode_bmap(inode, EXT2_IND_BLOCK) = b;
++			blocks_alloc++;
++		}
++		retval = block_ind_bmap(fs, bmap_flags, b, block_buf, 
++					&blocks_alloc, block, phys_blk);
++		goto done;
++	}
++	
++	/* Doubly indirect block  */
++	block -= addr_per_block;
++	if (block < addr_per_block * addr_per_block) {
++		b = inode_bmap(inode, EXT2_DIND_BLOCK);
++		if (!b) {
++			if (!(bmap_flags & BMAP_ALLOC)) {
++				if (bmap_flags & BMAP_SET)
++					retval = EXT2_ET_SET_BMAP_NO_IND;
++				goto done;
++			}
++
++			b = inode_bmap(inode, EXT2_IND_BLOCK);
++ 			retval = ext2fs_alloc_block(fs, b, block_buf, &b);
++			if (retval)
++				goto done;
++			inode_bmap(inode, EXT2_DIND_BLOCK) = b;
++			blocks_alloc++;
++		}
++		retval = block_dind_bmap(fs, bmap_flags, b, block_buf, 
++					 &blocks_alloc, block, phys_blk);
++		goto done;
++	}
++
++	/* Triply indirect block */
++	block -= addr_per_block * addr_per_block;
++	b = inode_bmap(inode, EXT2_TIND_BLOCK);
++	if (!b) {
++		if (!(bmap_flags & BMAP_ALLOC)) {
++			if (bmap_flags & BMAP_SET)
++				retval = EXT2_ET_SET_BMAP_NO_IND;
++			goto done;
++		}
++
++		b = inode_bmap(inode, EXT2_DIND_BLOCK);
++		retval = ext2fs_alloc_block(fs, b, block_buf, &b);
++		if (retval)
++			goto done;
++		inode_bmap(inode, EXT2_TIND_BLOCK) = b;
++		blocks_alloc++;
++	}
++	retval = block_tind_bmap(fs, bmap_flags, b, block_buf, 
++				 &blocks_alloc, block, phys_blk);
++done:
++	if (buf)
++		ext2fs_free_mem(&buf);
++	if ((retval == 0) && (blocks_alloc || inode_dirty)) {
++		inode->i_blocks += (blocks_alloc * fs->blocksize) / 512;
++		retval = ext2fs_write_inode(fs, ino, inode);
++	}
++	return retval;
++}
++
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/bmove.c silo-1.4.11/libext2fs/bmove.c
+--- silo-1.4.11.orig/libext2fs/bmove.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/bmove.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,160 @@
++/*
++ * bmove.c --- Move blocks around to make way for a particular
++ * 	filesystem structure.
++ *
++ * Copyright (C) 1997 Theodore Ts'o.  This file may be redistributed
++ * under the terms of the GNU Public License.
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#if HAVE_SYS_TIME_H
++#include <sys/time.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++struct process_block_struct {
++	ext2_ino_t		ino;
++	struct ext2_inode *	inode;
++	ext2fs_block_bitmap	reserve;
++	ext2fs_block_bitmap	alloc_map;
++	errcode_t		error;
++	char			*buf;
++	int			add_dir;
++	int			flags;
++};
++
++static int process_block(ext2_filsys fs, blk_t	*block_nr,
++			 e2_blkcnt_t blockcnt, blk_t ref_block,
++			 int ref_offset, void *priv_data)
++{
++	struct process_block_struct *pb;
++	errcode_t	retval;
++	int		ret;
++	blk_t		block, orig;
++
++	pb = (struct process_block_struct *) priv_data;
++	block = orig = *block_nr;
++	ret = 0;
++	
++	/*
++	 * Let's see if this is one which we need to relocate
++	 */
++	if (ext2fs_test_block_bitmap(pb->reserve, block)) {
++		do {
++			if (++block >= fs->super->s_blocks_count)
++				block = fs->super->s_first_data_block;
++			if (block == orig) {
++				pb->error = EXT2_ET_BLOCK_ALLOC_FAIL;
++				return BLOCK_ABORT;
++			}
++		} while (ext2fs_test_block_bitmap(pb->reserve, block) ||
++			 ext2fs_test_block_bitmap(pb->alloc_map, block));
++
++		retval = io_channel_read_blk(fs->io, orig, 1, pb->buf);
++		if (retval) {
++			pb->error = retval;
++			return BLOCK_ABORT;
++		}
++		retval = io_channel_write_blk(fs->io, block, 1, pb->buf);
++		if (retval) {
++			pb->error = retval;
++			return BLOCK_ABORT;
++		}
++		*block_nr = block;
++		ext2fs_mark_block_bitmap(pb->alloc_map, block);
++		ret = BLOCK_CHANGED;
++		if (pb->flags & EXT2_BMOVE_DEBUG)
++			printf("ino=%ld, blockcnt=%lld, %d->%d\n", pb->ino,
++			       blockcnt, orig, block);
++	}
++	if (pb->add_dir) {
++		retval = ext2fs_add_dir_block(fs->dblist, pb->ino,
++					      block, (int) blockcnt);
++		if (retval) {
++			pb->error = retval;
++			ret |= BLOCK_ABORT;
++		}
++	}
++	return ret;
++}
++
++errcode_t ext2fs_move_blocks(ext2_filsys fs,
++			     ext2fs_block_bitmap reserve,
++			     ext2fs_block_bitmap alloc_map,
++			     int flags)
++{
++	ext2_ino_t	ino;
++	struct ext2_inode inode;
++	errcode_t	retval;
++	struct process_block_struct pb;
++	ext2_inode_scan	scan;
++	char		*block_buf;
++	
++	retval = ext2fs_open_inode_scan(fs, 0, &scan);
++	if (retval)
++		return retval;
++
++	pb.reserve = reserve;
++	pb.error = 0;
++	pb.alloc_map = alloc_map ? alloc_map : fs->block_map;
++	pb.flags = flags;
++	
++	retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf);
++	if (retval)
++		return retval;
++	pb.buf = block_buf + fs->blocksize * 3;
++
++	/*
++	 * If GET_DBLIST is set in the flags field, then we should
++	 * gather directory block information while we're doing the
++	 * block move.
++	 */
++	if (flags & EXT2_BMOVE_GET_DBLIST) {
++		if (fs->dblist) {
++			ext2fs_free_dblist(fs->dblist);
++			fs->dblist = NULL;
++		}
++		retval = ext2fs_init_dblist(fs, 0);
++		if (retval)
++			return retval;
++	}
++
++	retval = ext2fs_get_next_inode(scan, &ino, &inode);
++	if (retval)
++		return retval;
++	
++	while (ino) {
++		if ((inode.i_links_count == 0) ||
++		    !ext2fs_inode_has_valid_blocks(&inode))
++			goto next;
++		
++		pb.ino = ino;
++		pb.inode = &inode;
++
++		pb.add_dir = (LINUX_S_ISDIR(inode.i_mode) &&
++			      flags & EXT2_BMOVE_GET_DBLIST);
++
++		retval = ext2fs_block_iterate2(fs, ino, 0, block_buf,
++					      process_block, &pb);
++		if (retval)
++			return retval;
++		if (pb.error)
++			return pb.error;
++
++	next:
++		retval = ext2fs_get_next_inode(scan, &ino, &inode);
++		if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE)
++			goto next;
++	}
++	return 0;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/brel.h silo-1.4.11/libext2fs/brel.h
+--- silo-1.4.11.orig/libext2fs/brel.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/brel.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,86 @@
++/*
++ * brel.h
++ * 
++ * Copyright (C) 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++struct ext2_block_relocate_entry {
++	blk_t	new;
++	__s16	offset;
++	__u16	flags;
++	union {
++		blk_t		block_ref;
++		ext2_ino_t	inode_ref;
++	} owner;
++};
++
++#define RELOCATE_TYPE_REF  0x0007
++#define RELOCATE_BLOCK_REF 0x0001
++#define RELOCATE_INODE_REF 0x0002
++
++typedef struct ext2_block_relocation_table *ext2_brel;
++
++struct ext2_block_relocation_table {
++	__u32	magic;
++	char	*name;
++	blk_t	current;
++	void	*priv_data;
++
++	/*
++	 * Add a block relocation entry.
++	 */
++	errcode_t (*put)(ext2_brel brel, blk_t old,
++			      struct ext2_block_relocate_entry *ent);
++
++	/*
++	 * Get a block relocation entry.
++	 */
++	errcode_t (*get)(ext2_brel brel, blk_t old,
++			      struct ext2_block_relocate_entry *ent);
++
++	/*
++	 * Initialize for iterating over the block relocation entries.
++	 */
++	errcode_t (*start_iter)(ext2_brel brel);
++	
++	/*
++	 * The iterator function for the inode relocation entries.
++	 * Returns an inode number of 0 when out of entries.
++	 */
++	errcode_t (*next)(ext2_brel brel, blk_t *old,
++			  struct ext2_block_relocate_entry *ent);
++
++	/*
++	 * Move the inode relocation table from one block number to
++	 * another.
++	 */
++	errcode_t (*move)(ext2_brel brel, blk_t old, blk_t new);
++
++	/*
++	 * Remove a block relocation entry.
++	 */
++	errcode_t (*delete)(ext2_brel brel, blk_t old);
++
++
++	/*
++	 * Free the block relocation table.
++	 */
++	errcode_t (*free)(ext2_brel brel);
++};
++
++errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
++				    ext2_brel *brel);
++
++#define ext2fs_brel_put(brel, old, ent) ((brel)->put((brel), old, ent))
++#define ext2fs_brel_get(brel, old, ent) ((brel)->get((brel), old, ent))
++#define ext2fs_brel_start_iter(brel) ((brel)->start_iter((brel)))
++#define ext2fs_brel_next(brel, old, ent) ((brel)->next((brel), old, ent))
++#define ext2fs_brel_move(brel, old, new) ((brel)->move((brel), old, new))
++#define ext2fs_brel_delete(brel, old) ((brel)->delete((brel), old))
++#define ext2fs_brel_free(brel) ((brel)->free((brel)))
++
+diff -Naur silo-1.4.11.orig/libext2fs/brel_ma.c silo-1.4.11/libext2fs/brel_ma.c
+--- silo-1.4.11.orig/libext2fs/brel_ma.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/brel_ma.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,197 @@
++/*
++ * brel_ma.c
++ * 
++ * Copyright (C) 1996, 1997 Theodore Ts'o.
++ *
++ * TODO: rewrite to not use a direct array!!!  (Fortunately this
++ * module isn't really used yet.)
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <fcntl.h>
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++#include "brel.h"
++
++static errcode_t bma_put(ext2_brel brel, blk_t old,
++			struct ext2_block_relocate_entry *ent);
++static errcode_t bma_get(ext2_brel brel, blk_t old,
++			struct ext2_block_relocate_entry *ent);
++static errcode_t bma_start_iter(ext2_brel brel);
++static errcode_t bma_next(ext2_brel brel, blk_t *old,
++			 struct ext2_block_relocate_entry *ent);
++static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new);
++static errcode_t bma_delete(ext2_brel brel, blk_t old);
++static errcode_t bma_free(ext2_brel brel);
++
++struct brel_ma {
++	__u32 magic;
++	blk_t max_block;
++	struct ext2_block_relocate_entry *entries;
++};
++
++errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block,
++				      ext2_brel *new_brel)
++{
++	ext2_brel		brel = 0;
++	errcode_t	retval;
++	struct brel_ma 	*ma = 0;
++	size_t		size;
++
++	*new_brel = 0;
++
++	/*
++	 * Allocate memory structures
++	 */
++	retval = ext2fs_get_mem(sizeof(struct ext2_block_relocation_table),
++				&brel);
++	if (retval)
++		goto errout;
++	memset(brel, 0, sizeof(struct ext2_block_relocation_table));
++	
++	retval = ext2fs_get_mem(strlen(name)+1, &brel->name);
++	if (retval)
++		goto errout;
++	strcpy(brel->name, name);
++	
++	retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma);
++	if (retval)
++		goto errout;
++	memset(ma, 0, sizeof(struct brel_ma));
++	brel->priv_data = ma;
++	
++	size = (size_t) (sizeof(struct ext2_block_relocate_entry) *
++			 (max_block+1));
++	retval = ext2fs_get_mem(size, &ma->entries);
++	if (retval)
++		goto errout;
++	memset(ma->entries, 0, size);
++	ma->max_block = max_block;
++
++	/*
++	 * Fill in the brel data structure
++	 */
++	brel->put = bma_put;
++	brel->get = bma_get;
++	brel->start_iter = bma_start_iter;
++	brel->next = bma_next;
++	brel->move = bma_move;
++	brel->delete = bma_delete;
++	brel->free = bma_free;
++	
++	*new_brel = brel;
++	return 0;
++
++errout:
++	bma_free(brel);
++	return retval;
++}
++
++static errcode_t bma_put(ext2_brel brel, blk_t old,
++			struct ext2_block_relocate_entry *ent)
++{
++	struct brel_ma 	*ma;
++
++	ma = brel->priv_data;
++	if (old > ma->max_block)
++		return EXT2_ET_INVALID_ARGUMENT;
++	ma->entries[(unsigned)old] = *ent;
++	return 0;
++}
++
++static errcode_t bma_get(ext2_brel brel, blk_t old,
++			struct ext2_block_relocate_entry *ent)
++{
++	struct brel_ma 	*ma;
++
++	ma = brel->priv_data;
++	if (old > ma->max_block)
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned)old].new == 0)
++		return ENOENT;
++	*ent = ma->entries[old];
++	return 0;
++}
++
++static errcode_t bma_start_iter(ext2_brel brel)
++{
++	brel->current = 0;
++	return 0;
++}
++
++static errcode_t bma_next(ext2_brel brel, blk_t *old,
++			  struct ext2_block_relocate_entry *ent)
++{
++	struct brel_ma 	*ma;
++
++	ma = brel->priv_data;
++	while (++brel->current < ma->max_block) {
++		if (ma->entries[(unsigned)brel->current].new == 0)
++			continue;
++		*old = brel->current;
++		*ent = ma->entries[(unsigned)brel->current];
++		return 0;
++	}
++	*old = 0;
++	return 0;
++}
++
++static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new)
++{
++	struct brel_ma 	*ma;
++
++	ma = brel->priv_data;
++	if ((old > ma->max_block) || (new > ma->max_block))
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned)old].new == 0)
++		return ENOENT;
++	ma->entries[(unsigned)new] = ma->entries[old];
++	ma->entries[(unsigned)old].new = 0;
++	return 0;
++}
++
++static errcode_t bma_delete(ext2_brel brel, blk_t old)
++{
++	struct brel_ma 	*ma;
++
++	ma = brel->priv_data;
++	if (old > ma->max_block)
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned)old].new == 0)
++		return ENOENT;
++	ma->entries[(unsigned)old].new = 0;
++	return 0;
++}
++
++static errcode_t bma_free(ext2_brel brel)
++{
++	struct brel_ma 	*ma;
++
++	if (!brel)
++		return 0;
++
++	ma = brel->priv_data;
++
++	if (ma) {
++		if (ma->entries)
++			ext2fs_free_mem(&ma->entries);
++		ext2fs_free_mem(&ma);
++	}
++	if (brel->name)
++		ext2fs_free_mem(&brel->name);
++	ext2fs_free_mem(&brel);
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/check_desc.c silo-1.4.11/libext2fs/check_desc.c
+--- silo-1.4.11.orig/libext2fs/check_desc.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/check_desc.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,68 @@
++/*
++ * check_desc.c --- Check the group descriptors of an ext2 filesystem
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * This routine sanity checks the group descriptors
++ */
++errcode_t ext2fs_check_desc(ext2_filsys fs)
++{
++	dgrp_t i;
++	blk_t block = fs->super->s_first_data_block;
++	blk_t next;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	for (i = 0; i < fs->group_desc_count; i++) {
++		next = block + fs->super->s_blocks_per_group;
++		/*
++		 * Check to make sure block bitmap for group is
++		 * located within the group.
++		 */
++		if (fs->group_desc[i].bg_block_bitmap < block ||
++		    fs->group_desc[i].bg_block_bitmap >= next)
++			return EXT2_ET_GDESC_BAD_BLOCK_MAP;
++		/*
++		 * Check to make sure inode bitmap for group is
++		 * located within the group
++		 */
++		if (fs->group_desc[i].bg_inode_bitmap < block ||
++		    fs->group_desc[i].bg_inode_bitmap >= next)
++			return EXT2_ET_GDESC_BAD_INODE_MAP;
++		/*
++		 * Check to make sure inode table for group is located
++		 * within the group
++		 */
++		if (fs->group_desc[i].bg_inode_table < block ||
++		    ((fs->group_desc[i].bg_inode_table +
++		      fs->inode_blocks_per_group) >= next))
++			return EXT2_ET_GDESC_BAD_INODE_TABLE;
++		
++		block = next;
++	}
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/closefs.c silo-1.4.11/libext2fs/closefs.c
+--- silo-1.4.11.orig/libext2fs/closefs.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/closefs.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,381 @@
++/*
++ * closefs.c --- close an ext2 filesystem
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <time.h>
++#include <string.h>
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++static int test_root(int a, int b)
++{
++	if (a == 0)
++		return 1;
++	while (1) {
++		if (a == 1)
++			return 1;
++		if (a % b)
++			return 0;
++		a = a / b;
++	}
++}
++
++int ext2fs_bg_has_super(ext2_filsys fs, int group_block)
++{
++	if (!(fs->super->s_feature_ro_compat &
++	      EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
++		return 1;
++
++	if (test_root(group_block, 3) || (test_root(group_block, 5)) ||
++	    test_root(group_block, 7))
++		return 1;
++
++	return 0;
++}
++
++int ext2fs_super_and_bgd_loc(ext2_filsys fs, 
++			     dgrp_t group,
++			     blk_t *ret_super_blk,
++			     blk_t *ret_old_desc_blk,
++			     blk_t *ret_new_desc_blk,
++			     int *ret_meta_bg)
++{
++	blk_t	group_block, super_blk = 0, old_desc_blk = 0, new_desc_blk = 0;
++	unsigned int meta_bg, meta_bg_size;
++	int	numblocks, has_super;
++	int	old_desc_blocks;
++
++	group_block = fs->super->s_first_data_block +
++		(group * fs->super->s_blocks_per_group);
++
++	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
++		old_desc_blocks = fs->super->s_first_meta_bg;
++	else
++		old_desc_blocks = 
++			fs->desc_blocks + fs->super->s_reserved_gdt_blocks;
++
++	if (group == fs->group_desc_count-1) {
++		numblocks = (fs->super->s_blocks_count -
++			     fs->super->s_first_data_block) %
++			fs->super->s_blocks_per_group;
++		if (!numblocks)
++			numblocks = fs->super->s_blocks_per_group;
++	} else
++		numblocks = fs->super->s_blocks_per_group;
++
++	has_super = ext2fs_bg_has_super(fs, group);
++
++	if (has_super) {
++		super_blk = group_block;
++		numblocks--;
++	}
++	meta_bg_size = (fs->blocksize / sizeof (struct ext2_group_desc));
++	meta_bg = group / meta_bg_size;
++
++	if (!(fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) ||
++	    (meta_bg < fs->super->s_first_meta_bg)) {
++		if (has_super) {
++			old_desc_blk = group_block + 1;
++			numblocks -= old_desc_blocks;
++		}
++	} else {
++		if (((group % meta_bg_size) == 0) ||
++		    ((group % meta_bg_size) == 1) ||
++		    ((group % meta_bg_size) == (meta_bg_size-1))) {
++			if (has_super)
++				has_super = 1;
++			new_desc_blk = group_block + has_super;
++			numblocks--;
++		}
++	}
++		
++	numblocks -= 2 + fs->inode_blocks_per_group;
++
++	if (ret_super_blk)
++		*ret_super_blk = super_blk;
++	if (ret_old_desc_blk)
++		*ret_old_desc_blk = old_desc_blk;
++	if (ret_new_desc_blk)
++		*ret_new_desc_blk = new_desc_blk;
++	if (ret_meta_bg)
++		*ret_meta_bg = meta_bg;
++	return (numblocks);
++}
++
++
++/*
++ * This function forces out the primary superblock.  We need to only
++ * write out those fields which we have changed, since if the
++ * filesystem is mounted, it may have changed some of the other
++ * fields.
++ *
++ * It takes as input a superblock which has already been byte swapped
++ * (if necessary).
++ *
++ */
++static errcode_t write_primary_superblock(ext2_filsys fs,
++					  struct ext2_super_block *super)
++{
++	__u16		*old_super, *new_super;
++	int		check_idx, write_idx, size;
++	errcode_t	retval;
++
++	if (!fs->io->manager->write_byte || !fs->orig_super) {
++		io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
++		retval = io_channel_write_blk(fs->io, 1, -SUPERBLOCK_SIZE,
++					      super);
++		io_channel_set_blksize(fs->io, fs->blocksize);
++		return retval;
++	}
++
++	old_super = (__u16 *) fs->orig_super;
++	new_super = (__u16 *) super;
++
++	for (check_idx = 0; check_idx < SUPERBLOCK_SIZE/2; check_idx++) {
++		if (old_super[check_idx] == new_super[check_idx])
++			continue;
++		write_idx = check_idx;
++		for (check_idx++; check_idx < SUPERBLOCK_SIZE/2; check_idx++)
++			if (old_super[check_idx] == new_super[check_idx])
++				break;
++		size = 2 * (check_idx - write_idx);
++#if 0
++		printf("Writing %d bytes starting at %d\n",
++		       size, write_idx*2);
++#endif
++		retval = io_channel_write_byte(fs->io,
++			       SUPERBLOCK_OFFSET + (2 * write_idx), size,
++					       new_super + write_idx);
++		if (retval)
++			return retval;
++	}
++	memcpy(fs->orig_super, super, SUPERBLOCK_SIZE);
++	return 0;
++}
++
++
++/*
++ * Updates the revision to EXT2_DYNAMIC_REV
++ */
++void ext2fs_update_dynamic_rev(ext2_filsys fs)
++{
++	struct ext2_super_block *sb = fs->super;
++
++	if (sb->s_rev_level > EXT2_GOOD_OLD_REV)
++		return;
++
++	sb->s_rev_level = EXT2_DYNAMIC_REV;
++	sb->s_first_ino = EXT2_GOOD_OLD_FIRST_INO;
++	sb->s_inode_size = EXT2_GOOD_OLD_INODE_SIZE;
++	/* s_uuid is handled by e2fsck already */
++	/* other fields should be left alone */
++}
++
++static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group,
++				    blk_t group_block,
++				    struct ext2_super_block *super_shadow)
++{
++	dgrp_t	sgrp = group;
++	
++	if (sgrp > ((1 << 16) - 1))
++		sgrp = (1 << 16) - 1;
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if (fs->flags & EXT2_FLAG_SWAP_BYTES)
++		super_shadow->s_block_group_nr = ext2fs_swab16(sgrp);
++	else
++#endif
++		fs->super->s_block_group_nr = sgrp;
++
++	return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, 
++				    super_shadow);
++}
++
++
++errcode_t ext2fs_flush(ext2_filsys fs)
++{
++	dgrp_t		i,j;
++	blk_t		group_block;
++	errcode_t	retval;
++	unsigned long	fs_state;
++	struct ext2_super_block *super_shadow = 0;
++	struct ext2_group_desc *group_shadow = 0;
++	struct ext2_group_desc *s, *t;
++	char	*group_ptr;
++	int	old_desc_blocks;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	fs_state = fs->super->s_state;
++
++	fs->super->s_wtime = time(NULL);
++	fs->super->s_block_group_nr = 0;
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
++		retval = EXT2_ET_NO_MEMORY;
++		retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &super_shadow);
++		if (retval)
++			goto errout;
++		retval = ext2fs_get_mem((size_t)(fs->blocksize *
++						 fs->desc_blocks),
++					&group_shadow);
++		if (retval)
++			goto errout;
++		memset(group_shadow, 0, (size_t) fs->blocksize *
++		       fs->desc_blocks);
++
++		/* swap the group descriptors */
++		for (j=0, s=fs->group_desc, t=group_shadow;
++		     j < fs->group_desc_count; j++, t++, s++) {
++			*t = *s;
++			ext2fs_swap_group_desc(t);
++		}
++	} else {
++		super_shadow = fs->super;
++		group_shadow = fs->group_desc;
++	}
++#else
++	super_shadow = fs->super;
++	group_shadow = fs->group_desc;
++#endif
++	
++	/*
++	 * If this is an external journal device, don't write out the
++	 * block group descriptors or any of the backup superblocks
++	 */
++	if (fs->super->s_feature_incompat &
++	    EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
++		goto write_primary_superblock_only;
++
++	/*
++	 * Set the state of the FS to be non-valid.  (The state has
++	 * already been backed up earlier, and will be restored after
++	 * we write out the backup superblocks.)
++	 */
++	fs->super->s_state &= ~EXT2_VALID_FS;
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
++		*super_shadow = *fs->super;
++		ext2fs_swap_super(super_shadow);
++	}
++#endif
++
++	/*
++	 * Write out the master group descriptors, and the backup
++	 * superblocks and group descriptors.
++	 */
++	group_block = fs->super->s_first_data_block;
++	group_ptr = (char *) group_shadow;
++	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
++		old_desc_blocks = fs->super->s_first_meta_bg;
++	else
++		old_desc_blocks = fs->desc_blocks;
++
++	for (i = 0; i < fs->group_desc_count; i++) {
++		blk_t	super_blk, old_desc_blk, new_desc_blk;
++		int	meta_bg;
++
++		ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, 
++					 &new_desc_blk, &meta_bg);
++
++		if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) {
++			retval = write_backup_super(fs, i, super_blk,
++						    super_shadow);
++			if (retval)
++				goto errout;
++		}
++		if (fs->flags & EXT2_FLAG_SUPER_ONLY)
++			continue;
++		if ((old_desc_blk) && 
++		    (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) {
++			retval = io_channel_write_blk(fs->io,
++			      old_desc_blk, old_desc_blocks, group_ptr);
++			if (retval)
++				goto errout;
++		}
++		if (new_desc_blk) {
++			retval = io_channel_write_blk(fs->io, new_desc_blk,
++				1, group_ptr + (meta_bg*fs->blocksize));
++			if (retval)
++				goto errout;
++		}
++	}
++	fs->super->s_block_group_nr = 0;
++	fs->super->s_state = fs_state;
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
++		*super_shadow = *fs->super;
++		ext2fs_swap_super(super_shadow);
++	}
++#endif
++
++	/*
++	 * If the write_bitmaps() function is present, call it to
++	 * flush the bitmaps.  This is done this way so that a simple
++	 * program that doesn't mess with the bitmaps doesn't need to
++	 * drag in the bitmaps.c code.
++	 */
++	if (fs->write_bitmaps) {
++		retval = fs->write_bitmaps(fs);
++		if (retval)
++			goto errout;
++	}
++
++write_primary_superblock_only:
++	/*
++	 * Write out master superblock.  This has to be done
++	 * separately, since it is located at a fixed location
++	 * (SUPERBLOCK_OFFSET).  We flush all other pending changes
++	 * out to disk first, just to avoid a race condition with an
++	 * insy-tinsy window....
++	 */
++	retval = io_channel_flush(fs->io);
++	retval = write_primary_superblock(fs, super_shadow);
++	if (retval)
++		goto errout;
++
++	fs->flags &= ~EXT2_FLAG_DIRTY;
++
++	retval = io_channel_flush(fs->io);
++errout:
++	fs->super->s_state = fs_state;
++	if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
++		if (super_shadow)
++			ext2fs_free_mem(&super_shadow);
++		if (group_shadow)
++			ext2fs_free_mem(&group_shadow);
++	}
++	return retval;
++}
++
++errcode_t ext2fs_close(ext2_filsys fs)
++{
++	errcode_t	retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (fs->flags & EXT2_FLAG_DIRTY) {
++		retval = ext2fs_flush(fs);
++		if (retval)
++			return retval;
++	}
++	if (fs->write_bitmaps) {
++		retval = fs->write_bitmaps(fs);
++		if (retval)
++			return retval;
++	}
++	ext2fs_free(fs);
++	return 0;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/cmp_bitmaps.c silo-1.4.11/libext2fs/cmp_bitmaps.c
+--- silo-1.4.11.orig/libext2fs/cmp_bitmaps.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/cmp_bitmaps.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,72 @@
++/*
++ * cmp_bitmaps.c --- routines to compare inode and block bitmaps.
++ *
++ * Copyright (C) 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
++				      ext2fs_block_bitmap bm2)
++{
++	blk_t	i;
++	
++	EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP);
++	EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP);
++
++	if ((bm1->start != bm2->start) ||
++	    (bm1->end != bm2->end) ||
++	    (memcmp(bm1->bitmap, bm2->bitmap,
++		    (size_t) (bm1->end - bm1->start)/8)))
++		return EXT2_ET_NEQ_BLOCK_BITMAP;
++
++	for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
++		if (ext2fs_fast_test_block_bitmap(bm1, i) !=
++		    ext2fs_fast_test_block_bitmap(bm2, i))
++			return EXT2_ET_NEQ_BLOCK_BITMAP;
++
++	return 0;
++}
++
++errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
++				      ext2fs_inode_bitmap bm2)
++{
++	ext2_ino_t	i;
++	
++	EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP);
++	EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP);
++
++	if ((bm1->start != bm2->start) ||
++	    (bm1->end != bm2->end) ||
++	    (memcmp(bm1->bitmap, bm2->bitmap,
++		    (size_t) (bm1->end - bm1->start)/8)))
++		return EXT2_ET_NEQ_INODE_BITMAP;
++
++	for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
++		if (ext2fs_fast_test_inode_bitmap(bm1, i) !=
++		    ext2fs_fast_test_inode_bitmap(bm2, i))
++			return EXT2_ET_NEQ_INODE_BITMAP;
++
++	return 0;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/dblist.c silo-1.4.11/libext2fs/dblist.c
+--- silo-1.4.11.orig/libext2fs/dblist.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dblist.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,260 @@
++/*
++ * dblist.c -- directory block list functions
++ * 
++ * Copyright 1997 by Theodore Ts'o
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ * 
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b);
++
++/*
++ * Returns the number of directories in the filesystem as reported by
++ * the group descriptors.  Of course, the group descriptors could be
++ * wrong!
++ */
++errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs)
++{
++	dgrp_t	i;
++	ext2_ino_t	num_dirs, max_dirs;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++	
++	num_dirs = 0;
++	max_dirs = fs->super->s_inodes_per_group;
++	for (i = 0; i < fs->group_desc_count; i++) {
++		if (fs->group_desc[i].bg_used_dirs_count > max_dirs)
++			num_dirs += max_dirs / 8;
++		else
++			num_dirs += fs->group_desc[i].bg_used_dirs_count;
++	}
++	if (num_dirs > fs->super->s_inodes_count)
++		num_dirs = fs->super->s_inodes_count;
++
++	*ret_num_dirs = num_dirs;
++
++	return 0;
++}
++
++/*
++ * helper function for making a new directory block list (for
++ * initialize and copy).
++ */
++static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count,
++			     struct ext2_db_entry *list,
++			     ext2_dblist *ret_dblist)
++{
++	ext2_dblist	dblist;
++	errcode_t	retval;
++	size_t		len;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if ((ret_dblist == 0) && fs->dblist &&
++	    (fs->dblist->magic == EXT2_ET_MAGIC_DBLIST))
++		return 0;
++
++	retval = ext2fs_get_mem(sizeof(struct ext2_struct_dblist), &dblist);
++	if (retval)
++		return retval;
++	memset(dblist, 0, sizeof(struct ext2_struct_dblist));
++
++	dblist->magic = EXT2_ET_MAGIC_DBLIST;
++	dblist->fs = fs;
++	if (size)
++		dblist->size = size;
++	else {
++		retval = ext2fs_get_num_dirs(fs, &dblist->size);
++		if (retval)
++			goto cleanup;
++		dblist->size = (dblist->size * 2) + 12;
++	}
++	len = (size_t) sizeof(struct ext2_db_entry) * dblist->size;
++	dblist->count = count;
++	retval = ext2fs_get_mem(len, &dblist->list);
++	if (retval)
++		goto cleanup;
++	
++	if (list)
++		memcpy(dblist->list, list, len);
++	else
++		memset(dblist->list, 0, len);
++	if (ret_dblist)
++		*ret_dblist = dblist;
++	else
++		fs->dblist = dblist;
++	return 0;
++cleanup:
++	if (dblist)
++		ext2fs_free_mem(&dblist);
++	return retval;
++}
++
++/*
++ * Initialize a directory block list
++ */
++errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist)
++{
++	ext2_dblist	dblist;
++	errcode_t	retval;
++
++	retval = make_dblist(fs, 0, 0, 0, &dblist);
++	if (retval)
++		return retval;
++
++	dblist->sorted = 1;
++	if (ret_dblist)
++		*ret_dblist = dblist;
++	else
++		fs->dblist = dblist;
++
++	return 0;
++}
++
++/*
++ * Copy a directory block list
++ */
++errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest)
++{
++	ext2_dblist	dblist;
++	errcode_t	retval;
++
++	retval = make_dblist(src->fs, src->size, src->count, src->list,
++			     &dblist);
++	if (retval)
++		return retval;
++	dblist->sorted = src->sorted;
++	*dest = dblist;
++	return 0;
++}
++
++/*
++ * Close a directory block list
++ *
++ * (moved to closefs.c)
++ */
++
++
++/*
++ * Add a directory block to the directory block list
++ */
++errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
++			       int blockcnt)
++{
++	struct ext2_db_entry 	*new_entry;
++	errcode_t		retval;
++	unsigned long		old_size;
++	
++	EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
++
++	if (dblist->count >= dblist->size) {
++		old_size = dblist->size * sizeof(struct ext2_db_entry);
++		dblist->size += 100;
++		retval = ext2fs_resize_mem(old_size, (size_t) dblist->size *
++					   sizeof(struct ext2_db_entry),
++					   &dblist->list);
++		if (retval) {
++			dblist->size -= 100;
++			return retval;
++		}
++	}
++	new_entry = dblist->list + ( (int) dblist->count++);
++	new_entry->blk = blk;
++	new_entry->ino = ino;
++	new_entry->blockcnt = blockcnt;
++
++	dblist->sorted = 0;
++
++	return 0;
++}
++
++/*
++ * Change the directory block to the directory block list
++ */
++errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
++			       int blockcnt)
++{
++	dgrp_t			i;
++	
++	EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
++
++	for (i=0; i < dblist->count; i++) {
++		if ((dblist->list[i].ino != ino) ||
++		    (dblist->list[i].blockcnt != blockcnt))
++			continue;
++		dblist->list[i].blk = blk;
++		dblist->sorted = 0;
++		return 0;
++	}
++	return EXT2_ET_DB_NOT_FOUND;
++}
++
++void ext2fs_dblist_sort(ext2_dblist dblist,
++			EXT2_QSORT_TYPE (*sortfunc)(const void *,
++						    const void *))
++{
++	if (!sortfunc)
++		sortfunc = dir_block_cmp;
++	qsort(dblist->list, (size_t) dblist->count,
++	      sizeof(struct ext2_db_entry), sortfunc);
++	dblist->sorted = 1;
++}
++
++/*
++ * This function iterates over the directory block list
++ */
++errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
++				int (*func)(ext2_filsys fs,
++					    struct ext2_db_entry *db_info,
++					    void	*priv_data),
++				void *priv_data)
++{
++	ext2_ino_t	i;
++	int		ret;
++	
++	EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
++
++	if (!dblist->sorted)
++		ext2fs_dblist_sort(dblist, 0);
++	for (i=0; i < dblist->count; i++) {
++		ret = (*func)(dblist->fs, &dblist->list[(int)i], priv_data);
++		if (ret & DBLIST_ABORT)
++			return 0;
++	}
++	return 0;
++}
++
++static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b)
++{
++	const struct ext2_db_entry *db_a =
++		(const struct ext2_db_entry *) a;
++	const struct ext2_db_entry *db_b =
++		(const struct ext2_db_entry *) b;
++
++	if (db_a->blk != db_b->blk)
++		return (int) (db_a->blk - db_b->blk);
++	
++	if (db_a->ino != db_b->ino)
++		return (int) (db_a->ino - db_b->ino);
++
++	return (int) (db_a->blockcnt - db_b->blockcnt);
++}
++
++int ext2fs_dblist_count(ext2_dblist dblist)
++{
++	return (int) dblist->count;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/dblist_dir.c silo-1.4.11/libext2fs/dblist_dir.c
+--- silo-1.4.11.orig/libext2fs/dblist_dir.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dblist_dir.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,75 @@
++/*
++ * dblist_dir.c --- iterate by directory entry
++ *
++ * Copyright 1997 by Theodore Ts'o
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ * 
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
++		       void *priv_data);
++
++errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist,
++				    int	flags,
++				    char	*block_buf,
++				    int (*func)(ext2_ino_t dir,
++						int	entry,
++						struct ext2_dir_entry *dirent,
++						int	offset,
++						int	blocksize,
++						char	*buf,
++						void	*priv_data),
++				    void *priv_data)
++{
++	errcode_t		retval;
++	struct dir_context	ctx;
++
++	EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
++
++	ctx.dir = 0;
++	ctx.flags = flags;
++	if (block_buf)
++		ctx.buf = block_buf;
++	else {
++		retval = ext2fs_get_mem(dblist->fs->blocksize, &ctx.buf);
++		if (retval)
++			return retval;
++	}
++	ctx.func = func;
++	ctx.priv_data = priv_data;
++	ctx.errcode = 0;
++
++	retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx);
++	
++	if (!block_buf)
++		ext2fs_free_mem(&ctx.buf);
++	if (retval)
++		return retval;
++	return ctx.errcode;
++}
++
++static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
++		       void *priv_data)
++{
++	struct dir_context	*ctx;
++
++	ctx = (struct dir_context *) priv_data;
++	ctx->dir = db_info->ino;
++	
++	return ext2fs_process_dir_block(fs, &db_info->blk,
++					db_info->blockcnt, 0, 0, priv_data);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/dir_iterate.c silo-1.4.11/libext2fs/dir_iterate.c
+--- silo-1.4.11.orig/libext2fs/dir_iterate.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dir_iterate.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,219 @@
++/*
++ * dir_iterate.c --- ext2fs directory iteration operations
++ * 
++ * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++/*
++ * This function checks to see whether or not a potential deleted
++ * directory entry looks valid.  What we do is check the deleted entry
++ * and each successive entry to make sure that they all look valid and
++ * that the last deleted entry ends at the beginning of the next
++ * undeleted entry.  Returns 1 if the deleted entry looks valid, zero
++ * if not valid.
++ */
++static int ext2fs_validate_entry(char *buf, int offset, int final_offset)
++{
++	struct ext2_dir_entry *dirent;
++	
++	while (offset < final_offset) {
++		dirent = (struct ext2_dir_entry *)(buf + offset);
++		offset += dirent->rec_len;
++		if ((dirent->rec_len < 8) ||
++		    ((dirent->rec_len % 4) != 0) ||
++		    (((dirent->name_len & 0xFF)+8) > dirent->rec_len))
++			return 0;
++	}
++	return (offset == final_offset);
++}
++
++errcode_t ext2fs_dir_iterate2(ext2_filsys fs,
++			      ext2_ino_t dir,
++			      int flags,
++			      char *block_buf,
++			      int (*func)(ext2_ino_t	dir,
++					  int		entry,
++					  struct ext2_dir_entry *dirent,
++					  int	offset,
++					  int	blocksize,
++					  char	*buf,
++					  void	*priv_data),
++			      void *priv_data)
++{
++	struct		dir_context	ctx;
++	errcode_t	retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	retval = ext2fs_check_directory(fs, dir);
++	if (retval)
++		return retval;
++	
++	ctx.dir = dir;
++	ctx.flags = flags;
++	if (block_buf)
++		ctx.buf = block_buf;
++	else {
++		retval = ext2fs_get_mem(fs->blocksize, &ctx.buf);
++		if (retval)
++			return retval;
++	}
++	ctx.func = func;
++	ctx.priv_data = priv_data;
++	ctx.errcode = 0;
++	retval = ext2fs_block_iterate2(fs, dir, 0, 0,
++				       ext2fs_process_dir_block, &ctx);
++	if (!block_buf)
++		ext2fs_free_mem(&ctx.buf);
++	if (retval)
++		return retval;
++	return ctx.errcode;
++}
++
++struct xlate {
++	int (*func)(struct ext2_dir_entry *dirent,
++		    int		offset,
++		    int		blocksize,
++		    char	*buf,
++		    void	*priv_data);
++	void *real_private;
++};
++
++static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)),
++		      int entry EXT2FS_ATTR((unused)),
++		      struct ext2_dir_entry *dirent, int offset,
++		      int blocksize, char *buf, void *priv_data)
++{
++	struct xlate *xl = (struct xlate *) priv_data;
++
++	return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private);
++}
++
++extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, 
++			      ext2_ino_t dir,
++			      int flags,
++			      char *block_buf,
++			      int (*func)(struct ext2_dir_entry *dirent,
++					  int	offset,
++					  int	blocksize,
++					  char	*buf,
++					  void	*priv_data),
++			      void *priv_data)
++{
++	struct xlate xl;
++	
++	xl.real_private = priv_data;
++	xl.func = func;
++
++	return ext2fs_dir_iterate2(fs, dir, flags, block_buf,
++				   xlate_func, &xl);
++}
++
++
++/*
++ * Helper function which is private to this module.  Used by
++ * ext2fs_dir_iterate() and ext2fs_dblist_dir_iterate()
++ */
++int ext2fs_process_dir_block(ext2_filsys fs,
++			     blk_t	*blocknr,
++			     e2_blkcnt_t blockcnt,
++			     blk_t	ref_block EXT2FS_ATTR((unused)),
++			     int	ref_offset EXT2FS_ATTR((unused)),
++			     void	*priv_data)
++{
++	struct dir_context *ctx = (struct dir_context *) priv_data;
++	unsigned int	offset = 0;
++	unsigned int	next_real_entry = 0;
++	int		ret = 0;
++	int		changed = 0;
++	int		do_abort = 0;
++	int		entry, size;
++	struct ext2_dir_entry *dirent;
++
++	if (blockcnt < 0)
++		return 0;
++
++	entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE;
++	
++	ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf);
++	if (ctx->errcode)
++		return BLOCK_ABORT;
++
++	while (offset < fs->blocksize) {
++		dirent = (struct ext2_dir_entry *) (ctx->buf + offset);
++		if (((offset + dirent->rec_len) > fs->blocksize) ||
++		    (dirent->rec_len < 8) ||
++		    ((dirent->rec_len % 4) != 0) ||
++		    (((dirent->name_len & 0xFF)+8) > dirent->rec_len)) {
++			ctx->errcode = EXT2_ET_DIR_CORRUPTED;
++			return BLOCK_ABORT;
++		}
++		if (!dirent->inode &&
++		    !(ctx->flags & DIRENT_FLAG_INCLUDE_EMPTY))
++			goto next;
++
++		ret = (ctx->func)(ctx->dir,
++				  (next_real_entry > offset) ?
++				  DIRENT_DELETED_FILE : entry,
++				  dirent, offset,
++				  fs->blocksize, ctx->buf,
++				  ctx->priv_data);
++		if (entry < DIRENT_OTHER_FILE)
++			entry++;
++			
++		if (ret & DIRENT_CHANGED)
++			changed++;
++		if (ret & DIRENT_ABORT) {
++			do_abort++;
++			break;
++		}
++next:		
++ 		if (next_real_entry == offset)
++			next_real_entry += dirent->rec_len;
++ 
++ 		if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) {
++			size = ((dirent->name_len & 0xFF) + 11) & ~3;
++
++			if (dirent->rec_len != size)  {
++				unsigned int final_offset;
++
++				final_offset = offset + dirent->rec_len;
++				offset += size;
++				while (offset < final_offset &&
++				       !ext2fs_validate_entry(ctx->buf,
++							      offset,
++							      final_offset))
++					offset += 4;
++				continue;
++			}
++		}
++		offset += dirent->rec_len;
++	}
++
++	if (changed) {
++		ctx->errcode = ext2fs_write_dir_block(fs, *blocknr, ctx->buf);
++		if (ctx->errcode)
++			return BLOCK_ABORT;
++	}
++	if (do_abort)
++		return BLOCK_ABORT;
++	return 0;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/dirblock.c silo-1.4.11/libext2fs/dirblock.c
+--- silo-1.4.11.orig/libext2fs/dirblock.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dirblock.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,130 @@
++/*
++ * dirblock.c --- directory block routines.
++ * 
++ * Copyright (C) 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
++				 void *buf, int flags EXT2FS_ATTR((unused)))
++{
++	errcode_t	retval;
++	char		*p, *end;
++	struct ext2_dir_entry *dirent;
++	unsigned int	name_len, rec_len, do_swap;
++	
++
++ 	retval = io_channel_read_blk(fs->io, block, 1, buf);
++	if (retval)
++		return retval;
++#ifdef EXT2FS_ENABLE_SWAPFS
++	do_swap = (fs->flags & (EXT2_FLAG_SWAP_BYTES|
++				EXT2_FLAG_SWAP_BYTES_READ)) != 0;
++#endif
++	p = (char *) buf;
++	end = (char *) buf + fs->blocksize;
++	while (p < end-8) {
++		dirent = (struct ext2_dir_entry *) p;
++#ifdef EXT2FS_ENABLE_SWAPFS
++		if (do_swap) {
++			dirent->inode = ext2fs_swab32(dirent->inode);
++			dirent->rec_len = ext2fs_swab16(dirent->rec_len);
++			dirent->name_len = ext2fs_swab16(dirent->name_len);
++		}
++#endif
++		name_len = dirent->name_len;
++#ifdef WORDS_BIGENDIAN
++		if (flags & EXT2_DIRBLOCK_V2_STRUCT)
++			dirent->name_len = ext2fs_swab16(dirent->name_len);
++#endif
++		rec_len = dirent->rec_len;
++		if ((rec_len < 8) || (rec_len % 4)) {
++			rec_len = 8;
++			retval = EXT2_ET_DIR_CORRUPTED;
++		}
++		if (((name_len & 0xFF) + 8) > dirent->rec_len)
++			retval = EXT2_ET_DIR_CORRUPTED;
++		p += rec_len;
++	}
++	return retval;
++}
++
++errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
++				 void *buf)
++{
++	return ext2fs_read_dir_block2(fs, block, buf, 0);
++}
++
++
++errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
++				  void *inbuf, int flags EXT2FS_ATTR((unused)))
++{
++#ifdef EXT2FS_ENABLE_SWAPFS
++	int		do_swap = 0;
++	errcode_t	retval;
++	char		*p, *end;
++	char		*buf = 0;
++	struct ext2_dir_entry *dirent;
++
++	if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++	    (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
++		do_swap = 1;
++
++#ifndef WORDS_BIGENDIAN
++	if (!do_swap)
++		return io_channel_write_blk(fs->io, block, 1, (char *) inbuf);
++#endif
++
++	retval = ext2fs_get_mem(fs->blocksize, &buf);
++	if (retval)
++		return retval;
++	memcpy(buf, inbuf, fs->blocksize);
++	p = buf;
++	end = buf + fs->blocksize;
++	while (p < end) {
++		dirent = (struct ext2_dir_entry *) p;
++		if ((dirent->rec_len < 8) ||
++		    (dirent->rec_len % 4)) {
++			ext2fs_free_mem(&buf);
++			return (EXT2_ET_DIR_CORRUPTED);
++		}
++		p += dirent->rec_len;
++		if (do_swap) {
++			dirent->inode = ext2fs_swab32(dirent->inode);
++			dirent->rec_len = ext2fs_swab16(dirent->rec_len);
++			dirent->name_len = ext2fs_swab16(dirent->name_len);
++		}
++#ifdef WORDS_BIGENDIAN 
++		if (flags & EXT2_DIRBLOCK_V2_STRUCT)
++			dirent->name_len = ext2fs_swab16(dirent->name_len);
++#endif
++	}
++ 	retval = io_channel_write_blk(fs->io, block, 1, buf);
++	ext2fs_free_mem(&buf);
++	return retval;
++#else
++ 	return io_channel_write_blk(fs->io, block, 1, (char *) inbuf);
++#endif
++}
++
++
++errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
++				 void *inbuf)
++{
++	return ext2fs_write_dir_block2(fs, block, inbuf, 0);
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/dirhash.c silo-1.4.11/libext2fs/dirhash.c
+--- silo-1.4.11.orig/libext2fs/dirhash.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dirhash.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,233 @@
++/*
++ * dirhash.c -- Calculate the hash of a directory entry
++ *
++ * Copyright (c) 2001  Daniel Phillips
++ * 
++ * Copyright (c) 2002 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * Keyed 32-bit hash function using TEA in a Davis-Meyer function
++ *   H0 = Key
++ *   Hi = E Mi(Hi-1) + Hi-1
++ *
++ * (see Applied Cryptography, 2nd edition, p448).
++ *
++ * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998
++ * 
++ * This code is made available under the terms of the GPL
++ */
++#define DELTA 0x9E3779B9
++
++static void TEA_transform(__u32 buf[4], __u32 const in[])
++{
++	__u32	sum = 0;
++	__u32	b0 = buf[0], b1 = buf[1];
++	__u32	a = in[0], b = in[1], c = in[2], d = in[3];
++	int	n = 16;
++
++	do {							
++		sum += DELTA;					
++		b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b);	
++		b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d);	
++	} while(--n);
++
++	buf[0] += b0;
++	buf[1] += b1;
++}
++
++/* F, G and H are basic MD4 functions: selection, majority, parity */
++#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
++#define G(x, y, z) (((x) & (y)) + (((x) ^ (y)) & (z)))
++#define H(x, y, z) ((x) ^ (y) ^ (z))
++
++/*
++ * The generic round function.  The application is so specific that
++ * we don't bother protecting all the arguments with parens, as is generally
++ * good macro practice, in favor of extra legibility.
++ * Rotation is separate from addition to prevent recomputation
++ */
++#define ROUND(f, a, b, c, d, x, s)	\
++	(a += f(b, c, d) + x, a = (a << s) | (a >> (32-s)))
++#define K1 0
++#define K2 013240474631UL
++#define K3 015666365641UL
++
++/*
++ * Basic cut-down MD4 transform.  Returns only 32 bits of result.
++ */
++static void halfMD4Transform (__u32 buf[4], __u32 const in[])
++{
++	__u32	a = buf[0], b = buf[1], c = buf[2], d = buf[3];
++
++	/* Round 1 */
++	ROUND(F, a, b, c, d, in[0] + K1,  3);
++	ROUND(F, d, a, b, c, in[1] + K1,  7);
++	ROUND(F, c, d, a, b, in[2] + K1, 11);
++	ROUND(F, b, c, d, a, in[3] + K1, 19);
++	ROUND(F, a, b, c, d, in[4] + K1,  3);
++	ROUND(F, d, a, b, c, in[5] + K1,  7);
++	ROUND(F, c, d, a, b, in[6] + K1, 11);
++	ROUND(F, b, c, d, a, in[7] + K1, 19);
++
++	/* Round 2 */
++	ROUND(G, a, b, c, d, in[1] + K2,  3);
++	ROUND(G, d, a, b, c, in[3] + K2,  5);
++	ROUND(G, c, d, a, b, in[5] + K2,  9);
++	ROUND(G, b, c, d, a, in[7] + K2, 13);
++	ROUND(G, a, b, c, d, in[0] + K2,  3);
++	ROUND(G, d, a, b, c, in[2] + K2,  5);
++	ROUND(G, c, d, a, b, in[4] + K2,  9);
++	ROUND(G, b, c, d, a, in[6] + K2, 13);
++
++	/* Round 3 */
++	ROUND(H, a, b, c, d, in[3] + K3,  3);
++	ROUND(H, d, a, b, c, in[7] + K3,  9);
++	ROUND(H, c, d, a, b, in[2] + K3, 11);
++	ROUND(H, b, c, d, a, in[6] + K3, 15);
++	ROUND(H, a, b, c, d, in[1] + K3,  3);
++	ROUND(H, d, a, b, c, in[5] + K3,  9);
++	ROUND(H, c, d, a, b, in[0] + K3, 11);
++	ROUND(H, b, c, d, a, in[4] + K3, 15);
++
++	buf[0] += a;
++	buf[1] += b;
++	buf[2] += c;
++	buf[3] += d;
++}
++
++#undef ROUND
++#undef F
++#undef G
++#undef H
++#undef K1
++#undef K2
++#undef K3
++
++/* The old legacy hash */
++static ext2_dirhash_t dx_hack_hash (const char *name, int len)
++{
++	__u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9;
++	while (len--) {
++		__u32 hash = hash1 + (hash0 ^ (*name++ * 7152373));
++		
++		if (hash & 0x80000000) hash -= 0x7fffffff;
++		hash1 = hash0;
++		hash0 = hash;
++	}
++	return (hash0 << 1);
++}
++
++static void str2hashbuf(const char *msg, int len, __u32 *buf, int num)
++{
++	__u32	pad, val;
++	int	i;
++
++	pad = (__u32)len | ((__u32)len << 8);
++	pad |= pad << 16;
++
++	val = pad;
++	if (len > num*4)
++		len = num * 4;
++	for (i=0; i < len; i++) {
++		if ((i % 4) == 0)
++			val = pad;
++		val = msg[i] + (val << 8);
++		if ((i % 4) == 3) {
++			*buf++ = val;
++			val = pad;
++			num--;
++		}
++	}
++	if (--num >= 0)
++		*buf++ = val;
++	while (--num >= 0)
++		*buf++ = pad;
++}
++
++/*
++ * Returns the hash of a filename.  If len is 0 and name is NULL, then
++ * this function can be used to test whether or not a hash version is
++ * supported.
++ * 
++ * The seed is an 4 longword (32 bits) "secret" which can be used to
++ * uniquify a hash.  If the seed is all zero's, then some default seed
++ * may be used.
++ * 
++ * A particular hash version specifies whether or not the seed is
++ * represented, and whether or not the returned hash is 32 bits or 64
++ * bits.  32 bit hashes will return 0 for the minor hash.
++ */
++errcode_t ext2fs_dirhash(int version, const char *name, int len,
++			 const __u32 *seed,
++			 ext2_dirhash_t *ret_hash,
++			 ext2_dirhash_t *ret_minor_hash)
++{
++	__u32	hash;
++	__u32	minor_hash = 0;
++	const char	*p;
++	int		i;
++	__u32 		in[8], buf[4];
++
++	/* Initialize the default seed for the hash checksum functions */
++	buf[0] = 0x67452301;
++	buf[1] = 0xefcdab89;
++	buf[2] = 0x98badcfe;
++	buf[3] = 0x10325476;
++
++	/* Check to see if the seed is all zero's */
++	if (seed) {
++		for (i=0; i < 4; i++) {
++			if (seed[i])
++				break;
++		}
++		if (i < 4)
++			memcpy(buf, seed, sizeof(buf));
++	}
++		
++	switch (version) {
++	case EXT2_HASH_LEGACY:
++		hash = dx_hack_hash(name, len);
++		break;
++	case EXT2_HASH_HALF_MD4:
++		p = name;
++		while (len > 0) {
++			str2hashbuf(p, len, in, 8);
++			halfMD4Transform(buf, in);
++			len -= 32;
++			p += 32;
++		}
++		minor_hash = buf[2];
++		hash = buf[1];
++		break;
++	case EXT2_HASH_TEA:
++		p = name;
++		while (len > 0) {
++			str2hashbuf(p, len, in, 4);
++			TEA_transform(buf, in);
++			len -= 16;
++			p += 16;
++		}
++		hash = buf[0];
++		minor_hash = buf[1];
++		break;
++	default:
++		*ret_hash = 0;
++		return EXT2_ET_DIRHASH_UNSUPP;
++	}
++	*ret_hash = hash & ~1;
++	if (ret_minor_hash)
++		*ret_minor_hash = minor_hash;
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/dosio.c silo-1.4.11/libext2fs/dosio.c
+--- silo-1.4.11.orig/libext2fs/dosio.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dosio.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,456 @@
++/*
++ * dosio.c -- Disk I/O module for the ext2fs/DOS library.
++ *
++ * Copyright (c) 1997 by Theodore Ts'o.
++ * 
++ * Copyright (c) 1997 Mark Habersack
++ * This file may be distributed under the terms of the GNU Public License.
++ *
++ */
++
++#include <stdio.h>
++#include <bios.h>
++#include <string.h>
++#include <ctype.h>
++#include <io.h>
++#ifdef HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include <ext2fs/ext2_types.h>
++#include "utils.h"
++#include "dosio.h"
++#include "et/com_err.h"
++#include "ext2_err.h"
++#include "ext2fs/io.h"
++
++/*
++ * Some helper macros
++ */
++#define LINUX_EXT2FS       0x83
++#define LINUX_SWAP         0x82
++#define WRITE_ERR(_msg_) write(2, _msg_, strlen(_msg_))
++#define WRITE_ERR_S(_msg_) write(2, _msg_, sizeof(_msg_))
++
++/*
++ * Exported variables
++ */
++unsigned long        _dio_error;
++unsigned long        _dio_hw_error;
++
++/*
++ * Array of all opened partitions
++ */
++static PARTITION        **partitions = NULL;
++static unsigned short   npart = 0; /* Number of mapped partitions */
++static PARTITION        *active = NULL;
++
++/*
++ * I/O Manager routine prototypes
++ */
++static errcode_t dos_open(const char *dev, int flags, io_channel *channel);
++static errcode_t dos_close(io_channel channel);
++static errcode_t dos_set_blksize(io_channel channel, int blksize);
++static errcode_t dos_read_blk(io_channel channel, unsigned long block,
++                                             int count, void *buf);
++static errcode_t dos_write_blk(io_channel channel, unsigned long block,
++                               int count, const void *buf);
++static errcode_t dos_flush(io_channel channel);
++
++static struct struct_io_manager struct_dos_manager = {
++        EXT2_ET_MAGIC_IO_MANAGER,
++        "DOS I/O Manager",
++        dos_open,
++        dos_close,
++        dos_set_blksize,
++        dos_read_blk,
++        dos_write_blk,
++        dos_flush
++};
++io_manager dos_io_manager = &struct_dos_manager;
++
++/*
++ * Macro taken from unix_io.c
++ */
++/*
++ * For checking structure magic numbers...
++ */
++
++#define EXT2_CHECK_MAGIC(struct, code) \
++          if ((struct)->magic != (code)) return (code)
++
++/*
++ * Calculates a CHS address of a sector from its LBA
++ * offset for the given partition.
++ */
++static void lba2chs(unsigned long lba_addr, CHS *chs, PARTITION *part)
++{
++  unsigned long      abss;
++
++  chs->offset = lba_addr & 0x000001FF;
++  abss = (lba_addr >> 9) + part->start;
++  chs->cyl    = abss / (part->sects * part->heads);
++  chs->head   = (abss / part->sects) % part->heads;
++  chs->sector = (abss % part->sects) + 1;
++}
++
++#ifdef __TURBOC__
++#pragma argsused
++#endif
++/*
++ * Scans the passed partition table looking for *pno partition
++ * that has LINUX_EXT2FS type.
++ *
++ * TODO:
++ * For partition numbers >5 Linux uses DOS extended partitions -
++ * dive into them an return an appropriate entry. Also dive into
++ * extended partitions when scanning for a first Linux/ext2fs.
++ */
++static PTABLE_ENTRY *scan_partition_table(PTABLE_ENTRY *pentry,
++                                          unsigned short phys,
++                                          unsigned char *pno)
++{
++  unsigned        i;
++
++  if(*pno != 0xFF && *pno >= 5)
++     return NULL; /* We don't support extended partitions for now */
++
++  if(*pno != 0xFF)
++  {
++    if(pentry[*pno].type == LINUX_EXT2FS)
++      return &pentry[*pno];
++    else
++    {
++      if(!pentry[*pno].type)
++        *pno = 0xFE;
++      else if(pentry[*pno].type == LINUX_SWAP)
++        *pno = 0xFD;
++      return NULL;
++    }
++  }
++
++  for(i = 0; i < 4; i++)
++    if(pentry[i].type == LINUX_EXT2FS)
++    {
++      *pno = i;
++      return &pentry[i];
++    }
++
++  return NULL;
++}
++
++/*
++ * Allocate libext2fs structures associated with I/O manager
++ */
++static io_channel alloc_io_channel(PARTITION *part)
++{
++  io_channel     ioch;
++
++  ioch = (io_channel)malloc(sizeof(struct struct_io_channel));
++  if (!ioch)
++	  return NULL;
++  memset(ioch, 0, sizeof(struct struct_io_channel));
++  ioch->magic = EXT2_ET_MAGIC_IO_CHANNEL;
++  ioch->manager = dos_io_manager;
++  ioch->name = (char *)malloc(strlen(part->dev)+1);
++  if (!ioch->name) {
++	  free(ioch);
++	  return NULL;
++  }
++  strcpy(ioch->name, part->dev);
++  ioch->private_data = part;
++  ioch->block_size = 1024; /* The smallest ext2fs block size */
++  ioch->read_error = 0;
++  ioch->write_error = 0;
++
++  return ioch;
++}
++
++#ifdef __TURBOC__
++#pragma argsused
++#endif
++/*
++ * Open the 'name' partition, initialize all information structures
++ * we need to keep and create libext2fs I/O manager.
++ */
++static errcode_t dos_open(const char *dev, int flags, io_channel *channel)
++{
++  unsigned char  *tmp, sec[512];
++  PARTITION      *part;
++  PTABLE_ENTRY   *pent;
++  PARTITION        **newparts;
++  
++  if(!dev)
++  {
++    _dio_error = ERR_BADDEV;
++    return EXT2_ET_BAD_DEVICE_NAME;
++  }
++
++  /*
++   * First check whether the dev name is OK
++   */
++  tmp = (unsigned char*)strrchr(dev, '/');
++  if(!tmp)
++  {
++    _dio_error = ERR_BADDEV;
++    return EXT2_ET_BAD_DEVICE_NAME;
++  }
++  *tmp = 0;
++  if(strcmp(dev, "/dev"))
++  {
++    _dio_error = ERR_BADDEV;
++    return EXT2_ET_BAD_DEVICE_NAME;
++  }
++  *tmp++ = '/';
++
++  /*
++   * Check whether the partition data is already in cache
++   */
++
++  part = (PARTITION*)malloc(sizeof(PARTITION));
++  if (!part)
++	  return ENOMEM;
++  {
++    int   i = 0;
++
++    for(;i < npart; i++)
++      if(!strcmp(partitions[i]->dev, dev))
++      {
++        /* Found it! Make it the active one */
++        active = partitions[i];
++        *channel = alloc_io_channel(active);
++	if (!*channel)
++		return ENOMEM;
++        return 0;
++      }
++  }
++
++  /*
++   * Drive number & optionally partn number
++   */
++  switch(tmp[0])
++  {
++    case 'h':
++    case 's':
++      part->phys = 0x80;
++      part->phys += toupper(tmp[2]) - 'A';
++      /*
++       * Do we have the partition number?
++       */
++      if(tmp[3])
++        part->pno = isdigit((int)tmp[3]) ? tmp[3] - '0' - 1: 0;
++      else
++        part->pno = 0xFF;
++      break;
++
++    case 'f':
++      if(tmp[2])
++        part->phys = isdigit((int)tmp[2]) ? tmp[2] - '0' : 0;
++      else
++        part->phys = 0x00; /* We'll assume /dev/fd0 */
++      break;
++
++    default:
++      _dio_error = ERR_BADDEV;
++      return ENODEV;
++  }
++
++  if(part->phys < 0x80)
++  {
++     /* We don't support floppies for now */
++     _dio_error = ERR_NOTSUPP;
++     return EINVAL;
++  }
++
++  part->dev = strdup(dev);
++
++  /*
++   * Get drive's geometry
++   */
++  _dio_hw_error = biosdisk(DISK_GET_GEOMETRY,
++                           part->phys,
++                           0, /* head */
++                           0, /* cylinder */
++                           1, /* sector */
++                           1, /* just one sector */
++                           sec);
++
++  if(!HW_OK())
++  {
++    _dio_error = ERR_HARDWARE;
++    if (part)
++	    free(part);
++    return EFAULT;
++  }
++
++  /*
++   * Calculate the geometry
++   */
++  part->cyls  = (unsigned short)(((sec[0] >> 6) << 8) + sec[1] + 1);
++  part->heads = sec[3] + 1;
++  part->sects = sec[0] & 0x3F;
++
++  /*
++   * Now that we know all we need, let's look for the partition
++   */
++  _dio_hw_error = biosdisk(DISK_READ, part->phys, 0, 0, 1, 1, sec);
++
++  if(!HW_OK())
++  {
++    _dio_error = ERR_HARDWARE;
++    if (part)
++	    free(part);
++    return EFAULT;
++  }
++
++  pent = (PTABLE_ENTRY*)&sec[0x1BE];
++  pent = scan_partition_table(pent, part->phys, &part->pno);
++
++  if(!pent)
++  {
++    _dio_error = part->pno == 0xFE ? ERR_EMPTYPART :
++                 part->pno == 0xFD ? ERR_LINUXSWAP : ERR_NOTEXT2FS;
++    if (part)
++	    free(part);
++    return ENODEV;
++  }
++
++  /*
++   * Calculate the remaining figures
++   */
++  {
++    unsigned long    fsec, fhead, fcyl;
++
++    fsec = (unsigned long)(pent->start_sec & 0x3F);
++    fhead = (unsigned long)pent->start_head;
++    fcyl = ((pent->start_sec >> 6) << 8) + pent->start_cyl;
++    part->start = fsec + fhead * part->sects + fcyl *
++                  (part->heads * part->sects) - 1;
++    part->len = pent->size;
++  }
++
++  /*
++   * Add the partition to the table
++   */
++  newparts = (PARTITION**)realloc(partitions, sizeof(PARTITION) * npart);
++  if (!newparts) {
++	  free(part);
++	  return ENOMEM;
++  }
++  partitions = newparts;
++  partitions[npart++] = active = part;
++
++  /*
++   * Now alloc all libe2fs structures
++   */
++  *channel = alloc_io_channel(active);
++  if (!*channel)
++	  return ENOMEM;
++
++  return 0;
++}
++
++static errcode_t dos_close(io_channel channel)
++{
++	if (channel->name)
++		free(channel->name);
++	if (channel)
++		free(channel);
++
++	return 0;
++}
++
++static errcode_t dos_set_blksize(io_channel channel, int blksize)
++{
++  channel->block_size = blksize;
++
++  return 0;
++}
++
++static errcode_t dos_read_blk(io_channel channel, unsigned long block,
++                                             int count, void *buf)
++{
++  PARTITION     *part;
++  size_t        size;
++  ext2_loff_t   loc;
++  CHS           chs;
++
++  EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++  part = (PARTITION*)channel->private_data;
++
++  size = (size_t)((count < 0) ? -count : count * channel->block_size);
++  loc = (ext2_loff_t) block * channel->block_size;
++
++  lba2chs(loc, &chs, part);
++  /*
++   * Potential bug here:
++   *   If DJGPP is used then reads of >18 sectors will fail!
++   *   Have to rewrite biosdisk.
++   */
++  _dio_hw_error = biosdisk(DISK_READ,
++                           part->phys,
++                           chs.head,
++                           chs.cyl,
++                           chs.sector,
++                           size < 512 ? 1 : size/512,
++                           buf);
++
++  if(!HW_OK())
++  {
++    _dio_error = ERR_HARDWARE;
++    return EFAULT;
++  }
++
++  return 0;
++}
++
++static errcode_t dos_write_blk(io_channel channel, unsigned long block,
++                               int count, const void *buf)
++{
++  PARTITION     *part;
++  size_t        size;
++  ext2_loff_t   loc;
++  CHS           chs;
++
++  EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++  part = (PARTITION*)channel->private_data;
++
++  if(count == 1)
++    size = (size_t)channel->block_size;
++  else
++  {
++    if (count < 0)
++      size = (size_t)-count;
++    else
++      size = (size_t)(count * channel->block_size);
++  }
++
++  loc = (ext2_loff_t)block * channel->block_size;
++  lba2chs(loc, &chs, part);
++  _dio_hw_error = biosdisk(DISK_WRITE,
++                           part->phys,
++                           chs.head,
++                           chs.cyl,
++                           chs.sector,
++                           size < 512 ? 1 : size/512,
++                           (void*)buf);
++
++  if(!HW_OK())
++  {
++    _dio_error = ERR_HARDWARE;
++    return EFAULT;
++  }
++
++  return 0;
++}
++
++#ifdef __TURBOC__
++#pragma argsused
++#endif
++static errcode_t dos_flush(io_channel channel)
++{
++  /*
++   * No buffers, no flush...
++   */
++  return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/dosio.h silo-1.4.11/libext2fs/dosio.h
+--- silo-1.4.11.orig/libext2fs/dosio.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dosio.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,153 @@
++/*
++ * v1.0
++ *
++ * Disk I/O include file for the ext2fs/DOS library.
++ *
++ * Copyright (c) 1997 Mark Habersack
++ * This file may be distributed under the terms of the GNU Public License.
++ *
++ */
++#ifndef __diskio_h
++#define __diskio_h
++#ifdef __TURBOC__
++#ifndef __LARGE__
++# error "ext2fs/DOS library requires LARGE model!"
++#endif
++#endif
++
++#ifdef __TURBOC__
++#include "msdos.h"
++#endif
++
++/*
++ * A helper structure used in LBA => CHS conversion
++ */
++typedef struct
++{
++  unsigned short       cyl;     /* Cylinder (or track) */
++  unsigned short       head;
++  unsigned short       sector;
++  unsigned short       offset;  /* Offset of byte within the sector */
++} CHS;
++
++/*
++ * All partition data we need is here
++ */
++typedef struct
++{
++  char                 *dev;  /* _Linux_ device name (like "/dev/hda1") */
++  unsigned char        phys;  /* Physical DOS drive number */
++  unsigned long        start; /* LBA address of partition start */
++  unsigned long        len;   /* length of partition in sectors */
++  unsigned char        pno;   /* Partition number (read from *dev) */
++
++  /* This partition's drive geometry */
++  unsigned short       cyls;
++  unsigned short       heads;
++  unsigned short       sects;
++} PARTITION;
++
++/*
++ * PC partition table entry format
++ */
++#ifdef __DJGPP__
++#pragma pack(1)
++#endif
++typedef struct
++{
++  unsigned char        active;
++  unsigned char        start_head;
++  unsigned char        start_sec;
++  unsigned char        start_cyl;
++  unsigned char        type;
++  unsigned char        end_head;
++  unsigned char        end_sec;
++  unsigned char        end_cyl;
++  unsigned long        first_sec_rel;
++  unsigned long        size;
++} PTABLE_ENTRY;
++#ifdef __DJGPP__
++#pragma pack()
++#endif
++
++/*
++ * INT 0x13 operation codes
++ */
++#define DISK_READ          0x02
++#define DISK_WRITE         0x03
++#define DISK_GET_GEOMETRY  0x08
++#define DISK_READY         0x10
++
++/*
++ * Errors to put in _dio_error
++ */
++#define ERR_BADDEV         0x00000001L
++#define ERR_HARDWARE       0x00000002L
++#define ERR_NOTSUPP        0x00000003L
++#define ERR_NOTEXT2FS      0x00000004L
++#define ERR_EMPTYPART      0x00000005L
++#define ERR_LINUXSWAP      0x00000006L
++
++/*
++ * Functions in diskio.c
++ */
++
++/*
++ * Variable contains last module's error
++ */
++extern unsigned long        _dio_error;
++
++/*
++ * This one contains last hardware error (if _dio_error == ERR_HARDWARE)
++ */
++extern unsigned long        _dio_hw_error;
++
++/*
++ * Macros to check for disk hardware errors
++ */
++#define HW_OK()             ((unsigned char)_dio_hw_error == 0x00)
++#define HW_BAD_CMD()        ((unsigned char)_dio_hw_error == 0x01)
++#define HW_NO_ADDR_MARK()   ((unsigned char)_dio_hw_error == 0x02)
++#define HW_WRITE_PROT()     ((unsigned char)_dio_hw_error == 0x03)
++#define HW_NO_SECTOR()      ((unsigned char)_dio_hw_error == 0x04)
++#define HW_RESET_FAIL()     ((unsigned char)_dio_hw_error == 0x05)
++#define HW_DISK_CHANGED()   ((unsigned char)_dio_hw_error == 0x06)
++#define HW_DRIVE_FAIL()     ((unsigned char)_dio_hw_error == 0x07)
++#define HW_DMA_OVERRUN()    ((unsigned char)_dio_hw_error == 0x08)
++#define HW_DMA_BOUNDARY()   ((unsigned char)_dio_hw_error == 0x09)
++#define HW_BAD_SECTOR()     ((unsigned char)_dio_hw_error == 0x0A)
++#define HW_BAD_TRACK()      ((unsigned char)_dio_hw_error == 0x0B)
++#define HW_UNSUPP_TRACK()   ((unsigned char)_dio_hw_error == 0x0C)
++#define HW_BAD_CRC_ECC()    ((unsigned char)_dio_hw_error == 0x10)
++#define HW_CRC_ECC_CORR()   ((unsigned char)_dio_hw_error == 0x11)
++#define HW_CONTR_FAIL()     ((unsigned char)_dio_hw_error == 0x20)
++#define HW_SEEK_FAIL()      ((unsigned char)_dio_hw_error == 0x40)
++#define HW_ATTACH_FAIL()    ((unsigned char)_dio_hw_error == 0x80)
++#define HW_DRIVE_NREADY()   ((unsigned char)_dio_hw_error == 0xAA)
++#define HW_UNDEF_ERROR()    ((unsigned char)_dio_hw_error == 0xBB)
++#define HW_WRITE_FAULT()    ((unsigned char)_dio_hw_error == 0xCC)
++#define HW_STATUS_ERROR()   ((unsigned char)_dio_hw_error == 0xE0)
++#define HW_SENSE_FAIL()     ((unsigned char)_dio_hw_error == 0xFF)
++
++
++/*
++ * Open the specified partition.
++ * String 'dev' must have a format:
++ *
++ *  /dev/{sd|hd|fd}[X]
++ *
++ * where,
++ *
++ *  only one of the option in curly braces can be used and X is an optional
++ *  partition number for the given device. If X is not specified, function
++ *  scans the drive's partition table in search for the first Linux ext2fs
++ *  partition (signature 0x83). Along the way it dives into every extended
++ *  partition encountered.
++ *  Scan ends if either (a) there are no more used partition entries, or
++ *  (b) there is no Xth partition.
++ *
++ * Routine returns 0 on success and !=0 otherwise.
++ */
++int open_partition(char *dev);
++
++#endif /* __diskio_h */
+diff -Naur silo-1.4.11.orig/libext2fs/dupfs.c silo-1.4.11/libext2fs/dupfs.c
+--- silo-1.4.11.orig/libext2fs/dupfs.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/dupfs.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,96 @@
++/*
++ * dupfs.c --- duplicate a ext2 filesystem handle
++ * 
++ * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <time.h>
++#include <string.h>
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest)
++{
++	ext2_filsys	fs;
++	errcode_t	retval;
++
++	EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++	
++	retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
++	if (retval)
++		return retval;
++
++	*fs = *src;
++	fs->device_name = 0;
++	fs->super = 0;
++	fs->orig_super = 0;
++	fs->group_desc = 0;
++	fs->inode_map = 0;
++	fs->block_map = 0;
++	fs->badblocks = 0;
++	fs->dblist = 0;
++
++	io_channel_bumpcount(fs->io);
++	if (fs->icache)
++		fs->icache->refcount++;
++
++	retval = ext2fs_get_mem(strlen(src->device_name)+1, &fs->device_name);
++	if (retval)
++		goto errout;
++	strcpy(fs->device_name, src->device_name);
++
++	retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->super);
++	if (retval)
++		goto errout;
++	memcpy(fs->super, src->super, SUPERBLOCK_SIZE);
++
++	retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->orig_super);
++	if (retval)
++		goto errout;
++	memcpy(fs->orig_super, src->orig_super, SUPERBLOCK_SIZE);
++
++	retval = ext2fs_get_mem((size_t) fs->desc_blocks * fs->blocksize,
++				&fs->group_desc);
++	if (retval)
++		goto errout;
++	memcpy(fs->group_desc, src->group_desc,
++	       (size_t) fs->desc_blocks * fs->blocksize);
++
++	if (src->inode_map) {
++		retval = ext2fs_copy_bitmap(src->inode_map, &fs->inode_map);
++		if (retval)
++			goto errout;
++	}
++	if (src->block_map) {
++		retval = ext2fs_copy_bitmap(src->block_map, &fs->block_map);
++		if (retval)
++			goto errout;
++	}
++	if (src->badblocks) {
++		retval = ext2fs_badblocks_copy(src->badblocks, &fs->badblocks);
++		if (retval)
++			goto errout;
++	}
++	if (src->dblist) {
++		retval = ext2fs_copy_dblist(src->dblist, &fs->dblist);
++		if (retval)
++			goto errout;
++	}
++	*dest = fs;
++	return 0;
++errout:
++	ext2fs_free(fs);
++	return retval;
++	
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/e2image.h silo-1.4.11/libext2fs/e2image.h
+--- silo-1.4.11.orig/libext2fs/e2image.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/e2image.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,51 @@
++/*
++ * e2image.h --- header file describing the ext2 image format
++ * 
++ * Copyright (C) 2000 Theodore Ts'o.
++ *
++ * Note: this uses the POSIX IO interfaces, unlike most of the other
++ * functions in this library.  So sue me.  
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++
++struct ext2_image_hdr {
++	__u32	magic_number;	/* This must be EXT2_ET_MAGIC_E2IMAGE */
++	char	magic_descriptor[16]; /* "Ext2 Image 1.0", w/ null padding */
++	char	fs_hostname[64];/* Hostname of machine of image */
++	char	fs_netaddr[32];	/* Network address */
++	__u32	fs_netaddr_type;/* 0 = IPV4, 1 = IPV6, etc. */
++	__u32	fs_device;	/* Device number of image */
++	char	fs_device_name[64]; /* Device name */
++	char	fs_uuid[16];	/* UUID of filesystem */
++	__u32	fs_blocksize;	/* Block size of the filesystem */
++	__u32	fs_reserved[8];
++	
++	__u32	image_device;	/* Device number of image file */
++	__u32	image_inode;	/* Inode number of image file */
++	__u32	image_time;	/* Time of image creation */
++	__u32	image_reserved[8];
++
++	__u32	offset_super;	/* Byte offset of the sb and descriptors */
++	__u32	offset_inode;	/* Byte offset of the inode table  */
++	__u32	offset_inodemap; /* Byte offset of the inode bitmaps */
++	__u32	offset_blockmap; /* Byte offset of the inode bitmaps */
++	__u32	offset_reserved[8];
++};
++
++	
++	
++	
++	
++	
++	
++	
++	
++	
++	
++	
++	
+diff -Naur silo-1.4.11.orig/libext2fs/expanddir.c silo-1.4.11/libext2fs/expanddir.c
+--- silo-1.4.11.orig/libext2fs/expanddir.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/expanddir.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,126 @@
++/*
++ * expand.c --- expand an ext2fs directory
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999  Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct expand_dir_struct {
++	int		done;
++	int		newblocks;
++	errcode_t	err;
++};
++
++static int expand_dir_proc(ext2_filsys	fs,
++			   blk_t	*blocknr,
++			   e2_blkcnt_t	blockcnt,
++			   blk_t	ref_block EXT2FS_ATTR((unused)),
++			   int		ref_offset EXT2FS_ATTR((unused)),
++			   void		*priv_data)
++{
++	struct expand_dir_struct *es = (struct expand_dir_struct *) priv_data;
++	blk_t	new_blk;
++	static blk_t	last_blk = 0;
++	char		*block;
++	errcode_t	retval;
++	
++	if (*blocknr) {
++		last_blk = *blocknr;
++		return 0;
++	}
++	retval = ext2fs_new_block(fs, last_blk, 0, &new_blk);
++	if (retval) {
++		es->err = retval;
++		return BLOCK_ABORT;
++	}
++	if (blockcnt > 0) {
++		retval = ext2fs_new_dir_block(fs, 0, 0, &block);
++		if (retval) {
++			es->err = retval;
++			return BLOCK_ABORT;
++		}
++		es->done = 1;
++		retval = ext2fs_write_dir_block(fs, new_blk, block);
++	} else {
++		retval = ext2fs_get_mem(fs->blocksize, &block);
++		if (retval) {
++			es->err = retval;
++			return BLOCK_ABORT;
++		}
++		memset(block, 0, fs->blocksize);
++		retval = io_channel_write_blk(fs->io, new_blk, 1, block);
++	}	
++	if (retval) {
++		es->err = retval;
++		return BLOCK_ABORT;
++	}
++	ext2fs_free_mem(&block);
++	*blocknr = new_blk;
++	ext2fs_block_alloc_stats(fs, new_blk, +1);
++	es->newblocks++;
++
++	if (es->done)
++		return (BLOCK_CHANGED | BLOCK_ABORT);
++	else
++		return BLOCK_CHANGED;
++}
++
++errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir)
++{
++	errcode_t	retval;
++	struct expand_dir_struct es;
++	struct ext2_inode	inode;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++
++	if (!fs->block_map)
++		return EXT2_ET_NO_BLOCK_BITMAP;
++
++	retval = ext2fs_check_directory(fs, dir);
++	if (retval)
++		return retval;
++	
++	es.done = 0;
++	es.err = 0;
++	es.newblocks = 0;
++	
++	retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND,
++				       0, expand_dir_proc, &es);
++
++	if (es.err)
++		return es.err;
++	if (!es.done)
++		return EXT2_ET_EXPAND_DIR_ERR;
++
++	/*
++	 * Update the size and block count fields in the inode.
++	 */
++	retval = ext2fs_read_inode(fs, dir, &inode);
++	if (retval)
++		return retval;
++	
++	inode.i_size += fs->blocksize;
++	inode.i_blocks += (fs->blocksize / 512) * es.newblocks;
++
++	retval = ext2fs_write_inode(fs, dir, &inode);
++	if (retval)
++		return retval;
++
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/ext2_err.c silo-1.4.11/libext2fs/ext2_err.c
+--- silo-1.4.11.orig/libext2fs/ext2_err.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext2_err.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,148 @@
++/*
++ * ext2_err.c:
++ * This file is automatically generated; please do not edit it.
++ */
++
++#include <stdlib.h>
++
++static const char * const text[] = {
++		"EXT2FS Library version 1.38",
++		"Wrong magic number for ext2_filsys structure",
++		"Wrong magic number for badblocks_list structure",
++		"Wrong magic number for badblocks_iterate structure",
++		"Wrong magic number for inode_scan structure",
++		"Wrong magic number for io_channel structure",
++		"Wrong magic number for unix io_channel structure",
++		"Wrong magic number for io_manager structure",
++		"Wrong magic number for block_bitmap structure",
++		"Wrong magic number for inode_bitmap structure",
++		"Wrong magic number for generic_bitmap structure",
++		"Wrong magic number for test io_channel structure",
++		"Wrong magic number for directory block list structure",
++		"Wrong magic number for icount structure",
++		"Wrong magic number for Powerquest io_channel structure",
++		"Wrong magic number for ext2 file structure",
++		"Wrong magic number for Ext2 Image Header",
++		"Wrong magic number for inode io_channel structure",
++		"Wrong magic number --- RESERVED_9",
++		"Bad magic number in super-block",
++		"Filesystem revision too high",
++		"Attempt to write to filesystem opened read-only",
++		"Can't read group descriptors",
++		"Can't write group descriptors",
++		"Corrupt group descriptor: bad block for block bitmap",
++		"Corrupt group descriptor: bad block for inode bitmap",
++		"Corrupt group descriptor: bad block for inode table",
++		"Can't write an inode bitmap",
++		"Can't read an inode bitmap",
++		"Can't write an block bitmap",
++		"Can't read an block bitmap",
++		"Can't write an inode table",
++		"Can't read an inode table",
++		"Can't read next inode",
++		"Filesystem has unexpected block size",
++		"EXT2 directory corrupted",
++		"Attempt to read block from filesystem resulted in short read",
++		"Attempt to write block from filesystem resulted in short write",
++		"No free space in the directory",
++		"Inode bitmap not loaded",
++		"Block bitmap not loaded",
++		"Illegal inode number",
++		"Illegal block number",
++		"Internal error in ext2fs_expand_dir",
++		"Not enough space to build proposed filesystem",
++		"Illegal block number passed to ext2fs_mark_block_bitmap",
++		"Illegal block number passed to ext2fs_unmark_block_bitmap",
++		"Illegal block number passed to ext2fs_test_block_bitmap",
++		"Illegal inode number passed to ext2fs_mark_inode_bitmap",
++		"Illegal inode number passed to ext2fs_unmark_inode_bitmap",
++		"Illegal inode number passed to ext2fs_test_inode_bitmap",
++		"Attempt to fudge end of block bitmap past the real end",
++		"Attempt to fudge end of inode bitmap past the real end",
++		"Illegal indirect block found" ,
++		"Illegal doubly indirect block found" ,
++		"Illegal triply indirect block found" ,
++		"Block bitmaps are not the same",
++		"Inode bitmaps are not the same",
++		"Illegal or malformed device name",
++		"A block group is missing an inode table",
++		"The ext2 superblock is corrupt",
++		"Illegal generic bit number passed to ext2fs_mark_generic_bitmap",
++		"Illegal generic bit number passed to ext2fs_unmark_generic_bitmap",
++		"Illegal generic bit number passed to ext2fs_test_generic_bitmap",
++		"Too many symbolic links encountered.",
++		"The callback function will not handle this case",
++		"The inode is from a bad block in the inode table",
++		"Filesystem has unsupported feature(s)",
++		"Filesystem has unsupported read-only feature(s)",
++		"IO Channel failed to seek on read or write",
++		"Memory allocation failed",
++		"Invalid argument passed to ext2 library",
++		"Could not allocate block in ext2 filesystem",
++		"Could not allocate inode in ext2 filesystem",
++		"Ext2 inode is not a directory",
++		"Too many references in table",
++		"File not found by ext2_lookup",
++		"File open read-only",
++		"Ext2 directory block not found",
++		"Ext2 directory already exists",
++		"Unimplemented ext2 library function",
++		"User cancel requested",
++		"Ext2 file too big",
++		"Supplied journal device not a block device",
++		"Journal superblock not found",
++		"Journal must be at least 1024 blocks",
++		"Unsupported journal version",
++		"Error loading external journal",
++		"Journal not found",
++		"Directory hash unsupported",
++		"Illegal extended attribute block number",
++		"Cannot create filesystem with requested number of inodes",
++		"E2image snapshot not in use",
++		"Too many reserved group descriptor blocks",
++		"Resize inode is corrupt",
++		"Missing indirect block not present",
++    0
++};
++
++struct error_table {
++    char const * const * msgs;
++    long base;
++    int n_msgs;
++};
++struct et_list {
++    struct et_list *next;
++    const struct error_table * table;
++};
++extern struct et_list *_et_list;
++
++const struct error_table et_ext2_error_table = { text, 2133571328L, 96 };
++
++static struct et_list link = { 0, 0 };
++
++void initialize_ext2_error_table_r(struct et_list **list);
++void initialize_ext2_error_table(void);
++
++void initialize_ext2_error_table(void) {
++    initialize_ext2_error_table_r(&_et_list);
++}
++
++/* For Heimdal compatibility */
++void initialize_ext2_error_table_r(struct et_list **list)
++{
++    struct et_list *et, **end;
++
++    for (end = list, et = *list; et; end = &et->next, et = et->next)
++        if (et->table->msgs == text)
++            return;
++    et = malloc(sizeof(struct et_list));
++    if (et == 0) {
++        if (!link.table)
++            et = &link;
++        else
++            return;
++    }
++    et->table = &et_ext2_error_table;
++    et->next = 0;
++    *end = et;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/ext2_ext_attr.h silo-1.4.11/libext2fs/ext2_ext_attr.h
+--- silo-1.4.11.orig/libext2fs/ext2_ext_attr.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext2_ext_attr.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,69 @@
++/*
++  File: linux/ext2_ext_attr.h
++
++  On-disk format of extended attributes for the ext2 filesystem.
++
++  (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
++*/
++
++/* Magic value in attribute blocks */
++#define EXT2_EXT_ATTR_MAGIC_v1		0xEA010000
++#define EXT2_EXT_ATTR_MAGIC		0xEA020000
++
++/* Maximum number of references to one attribute block */
++#define EXT2_EXT_ATTR_REFCOUNT_MAX	1024
++
++struct ext2_ext_attr_header {
++	__u32	h_magic;	/* magic number for identification */
++	__u32	h_refcount;	/* reference count */
++	__u32	h_blocks;	/* number of disk blocks used */
++	__u32	h_hash;		/* hash value of all attributes */
++	__u32	h_reserved[4];	/* zero right now */
++};
++
++struct ext2_ext_attr_entry {
++	__u8	e_name_len;	/* length of name */
++	__u8	e_name_index;	/* attribute name index */
++	__u16	e_value_offs;	/* offset in disk block of value */
++	__u32	e_value_block;	/* disk block attribute is stored on (n/i) */
++	__u32	e_value_size;	/* size of attribute value */
++	__u32	e_hash;		/* hash value of name and value */
++#if 0
++	char	e_name[0];	/* attribute name */
++#endif
++};
++
++#define EXT2_EXT_ATTR_PAD_BITS		2
++#define EXT2_EXT_ATTR_PAD		(1<<EXT2_EXT_ATTR_PAD_BITS)
++#define EXT2_EXT_ATTR_ROUND		(EXT2_EXT_ATTR_PAD-1)
++#define EXT2_EXT_ATTR_LEN(name_len) \
++	(((name_len) + EXT2_EXT_ATTR_ROUND + \
++	sizeof(struct ext2_ext_attr_entry)) & ~EXT2_EXT_ATTR_ROUND)
++#define EXT2_EXT_ATTR_NEXT(entry) \
++	( (struct ext2_ext_attr_entry *)( \
++	  (char *)(entry) + EXT2_EXT_ATTR_LEN((entry)->e_name_len)) )
++#define EXT2_EXT_ATTR_SIZE(size) \
++	(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
++#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL)
++#define EXT2_EXT_ATTR_NAME(entry) \
++	(((char *) (entry)) + sizeof(struct ext2_ext_attr_entry))
++#define EXT2_XATTR_LEN(name_len) \
++	(((name_len) + EXT2_EXT_ATTR_ROUND + \
++	sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND)
++#define EXT2_XATTR_SIZE(size) \
++	(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
++
++#ifdef __KERNEL__
++# ifdef CONFIG_EXT2_FS_EXT_ATTR
++extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int);
++extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int);
++extern void ext2_ext_attr_free_inode(struct inode *inode);
++extern void ext2_ext_attr_put_super(struct super_block *sb);
++extern int ext2_ext_attr_init(void);
++extern void ext2_ext_attr_done(void);
++# else
++#  define ext2_get_ext_attr NULL
++#  define ext2_set_ext_attr NULL
++# endif
++#endif  /* __KERNEL__ */
++
+diff -Naur silo-1.4.11.orig/libext2fs/ext2_fs.h silo-1.4.11/libext2fs/ext2_fs.h
+--- silo-1.4.11.orig/libext2fs/ext2_fs.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext2_fs.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,644 @@
++/*
++ *  linux/include/linux/ext2_fs.h
++ *
++ * Copyright (C) 1992, 1993, 1994, 1995
++ * Remy Card (card@masi.ibp.fr)
++ * Laboratoire MASI - Institut Blaise Pascal
++ * Universite Pierre et Marie Curie (Paris VI)
++ *
++ *  from
++ *
++ *  linux/include/linux/minix_fs.h
++ *
++ *  Copyright (C) 1991, 1992  Linus Torvalds
++ */
++
++#ifndef _LINUX_EXT2_FS_H
++#define _LINUX_EXT2_FS_H
++
++#include <ext2fs/ext2_types.h>		/* Changed from linux/types.h */
++
++/*
++ * The second extended filesystem constants/structures
++ */
++
++/*
++ * Define EXT2FS_DEBUG to produce debug messages
++ */
++#undef EXT2FS_DEBUG
++
++/*
++ * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
++ */
++#define EXT2_PREALLOCATE
++#define EXT2_DEFAULT_PREALLOC_BLOCKS	8
++
++/*
++ * The second extended file system version
++ */
++#define EXT2FS_DATE		"95/08/09"
++#define EXT2FS_VERSION		"0.5b"
++
++/*
++ * Special inode numbers
++ */
++#define EXT2_BAD_INO		 1	/* Bad blocks inode */
++#define EXT2_ROOT_INO		 2	/* Root inode */
++#define EXT2_ACL_IDX_INO	 3	/* ACL inode */
++#define EXT2_ACL_DATA_INO	 4	/* ACL inode */
++#define EXT2_BOOT_LOADER_INO	 5	/* Boot loader inode */
++#define EXT2_UNDEL_DIR_INO	 6	/* Undelete directory inode */
++#define EXT2_RESIZE_INO		 7	/* Reserved group descriptors inode */
++#define EXT2_JOURNAL_INO	 8	/* Journal inode */
++
++/* First non-reserved inode for old ext2 filesystems */
++#define EXT2_GOOD_OLD_FIRST_INO	11
++
++/*
++ * The second extended file system magic number
++ */
++#define EXT2_SUPER_MAGIC	0xEF53
++
++#ifdef __KERNEL__
++#define EXT2_SB(sb)	(&((sb)->u.ext2_sb))
++#else
++/* Assume that user mode programs are passing in an ext2fs superblock, not
++ * a kernel struct super_block.  This will allow us to call the feature-test
++ * macros from user land. */
++#define EXT2_SB(sb)	(sb)
++#endif
++
++/*
++ * Maximal count of links to a file
++ */
++#define EXT2_LINK_MAX		32000
++
++/*
++ * Macro-instructions used to manage several block sizes
++ */
++#define EXT2_MIN_BLOCK_LOG_SIZE		10	/* 1024 */
++#define EXT2_MAX_BLOCK_LOG_SIZE		16	/* 65536 */
++#define EXT2_MIN_BLOCK_SIZE	(1 << EXT2_MIN_BLOCK_LOG_SIZE)
++#define EXT2_MAX_BLOCK_SIZE	(1 << EXT2_MAX_BLOCK_LOG_SIZE)
++#ifdef __KERNEL__
++#define EXT2_BLOCK_SIZE(s)	((s)->s_blocksize)
++#define EXT2_BLOCK_SIZE_BITS(s)	((s)->s_blocksize_bits)
++#define EXT2_ADDR_PER_BLOCK_BITS(s)	(EXT2_SB(s)->addr_per_block_bits)
++#define EXT2_INODE_SIZE(s)	(EXT2_SB(s)->s_inode_size)
++#define EXT2_FIRST_INO(s)	(EXT2_SB(s)->s_first_ino)
++#else
++#define EXT2_BLOCK_SIZE(s)	(EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
++#define EXT2_BLOCK_SIZE_BITS(s)	((s)->s_log_block_size + 10)
++#define EXT2_INODE_SIZE(s)	(((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
++				 EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size)
++#define EXT2_FIRST_INO(s)	(((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
++				 EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino)
++#endif
++#define EXT2_ADDR_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s) / sizeof(__u32))
++
++/*
++ * Macro-instructions used to manage fragments
++ */
++#define EXT2_MIN_FRAG_SIZE		EXT2_MIN_BLOCK_SIZE
++#define EXT2_MAX_FRAG_SIZE		EXT2_MAX_BLOCK_SIZE
++#define EXT2_MIN_FRAG_LOG_SIZE		EXT2_MIN_BLOCK_LOG_SIZE
++#ifdef __KERNEL__
++# define EXT2_FRAG_SIZE(s)		(EXT2_SB(s)->s_frag_size)
++# define EXT2_FRAGS_PER_BLOCK(s)	(EXT2_SB(s)->s_frags_per_block)
++#else
++# define EXT2_FRAG_SIZE(s)		(EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
++# define EXT2_FRAGS_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
++#endif
++
++/*
++ * ACL structures
++ */
++struct ext2_acl_header	/* Header of Access Control Lists */
++{
++	__u32	aclh_size;
++	__u32	aclh_file_count;
++	__u32	aclh_acle_count;
++	__u32	aclh_first_acle;
++};
++
++struct ext2_acl_entry	/* Access Control List Entry */
++{
++	__u32	acle_size;
++	__u16	acle_perms;	/* Access permissions */
++	__u16	acle_type;	/* Type of entry */
++	__u16	acle_tag;	/* User or group identity */
++	__u16	acle_pad1;
++	__u32	acle_next;	/* Pointer on next entry for the */
++					/* same inode or on next free entry */
++};
++
++/*
++ * Structure of a blocks group descriptor
++ */
++struct ext2_group_desc
++{
++	__u32	bg_block_bitmap;		/* Blocks bitmap block */
++	__u32	bg_inode_bitmap;		/* Inodes bitmap block */
++	__u32	bg_inode_table;		/* Inodes table block */
++	__u16	bg_free_blocks_count;	/* Free blocks count */
++	__u16	bg_free_inodes_count;	/* Free inodes count */
++	__u16	bg_used_dirs_count;	/* Directories count */
++	__u16	bg_pad;
++	__u32	bg_reserved[3];
++};
++
++/*
++ * Data structures used by the directory indexing feature
++ *
++ * Note: all of the multibyte integer fields are little endian.
++ */
++
++/*
++ * Note: dx_root_info is laid out so that if it should somehow get
++ * overlaid by a dirent the two low bits of the hash version will be
++ * zero.  Therefore, the hash version mod 4 should never be 0.
++ * Sincerely, the paranoia department.
++ */
++struct ext2_dx_root_info {
++	__u32 reserved_zero;
++	__u8 hash_version; /* 0 now, 1 at release */
++	__u8 info_length; /* 8 */
++	__u8 indirect_levels;
++	__u8 unused_flags;
++};
++
++#define EXT2_HASH_LEGACY	0
++#define EXT2_HASH_HALF_MD4	1
++#define EXT2_HASH_TEA		2
++
++#define EXT2_HASH_FLAG_INCOMPAT	0x1
++
++struct ext2_dx_entry {
++	__u32 hash;
++	__u32 block;
++};
++
++struct ext2_dx_countlimit {
++	__u16 limit;
++	__u16 count;
++};
++
++
++/*
++ * Macro-instructions used to manage group descriptors
++ */
++#define EXT2_BLOCKS_PER_GROUP(s)	(EXT2_SB(s)->s_blocks_per_group)
++#define EXT2_INODES_PER_GROUP(s)	(EXT2_SB(s)->s_inodes_per_group)
++#define EXT2_INODES_PER_BLOCK(s)	(EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
++/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */
++#define EXT2_MAX_BLOCKS_PER_GROUP(s)	((1 << 16) - 8)
++#define EXT2_MAX_INODES_PER_GROUP(s)	((1 << 16) - EXT2_INODES_PER_BLOCK(s))
++#ifdef __KERNEL__
++#define EXT2_DESC_PER_BLOCK(s)		(EXT2_SB(s)->s_desc_per_block)
++#define EXT2_DESC_PER_BLOCK_BITS(s)	(EXT2_SB(s)->s_desc_per_block_bits)
++#else
++#define EXT2_DESC_PER_BLOCK(s)		(EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
++#endif
++
++/*
++ * Constants relative to the data blocks
++ */
++#define EXT2_NDIR_BLOCKS		12
++#define EXT2_IND_BLOCK			EXT2_NDIR_BLOCKS
++#define EXT2_DIND_BLOCK			(EXT2_IND_BLOCK + 1)
++#define EXT2_TIND_BLOCK			(EXT2_DIND_BLOCK + 1)
++#define EXT2_N_BLOCKS			(EXT2_TIND_BLOCK + 1)
++
++/*
++ * Inode flags
++ */
++#define EXT2_SECRM_FL			0x00000001 /* Secure deletion */
++#define EXT2_UNRM_FL			0x00000002 /* Undelete */
++#define EXT2_COMPR_FL			0x00000004 /* Compress file */
++#define EXT2_SYNC_FL			0x00000008 /* Synchronous updates */
++#define EXT2_IMMUTABLE_FL		0x00000010 /* Immutable file */
++#define EXT2_APPEND_FL			0x00000020 /* writes to file may only append */
++#define EXT2_NODUMP_FL			0x00000040 /* do not dump file */
++#define EXT2_NOATIME_FL			0x00000080 /* do not update atime */
++/* Reserved for compression usage... */
++#define EXT2_DIRTY_FL			0x00000100
++#define EXT2_COMPRBLK_FL		0x00000200 /* One or more compressed clusters */
++#define EXT2_NOCOMPR_FL			0x00000400 /* Access raw compressed data */
++#define EXT2_ECOMPR_FL			0x00000800 /* Compression error */
++/* End compression flags --- maybe not all used */
++#define EXT2_BTREE_FL			0x00001000 /* btree format dir */
++#define EXT2_INDEX_FL			0x00001000 /* hash-indexed directory */
++#define EXT2_IMAGIC_FL			0x00002000
++#define EXT3_JOURNAL_DATA_FL		0x00004000 /* file data should be journaled */
++#define EXT2_NOTAIL_FL			0x00008000 /* file tail should not be merged */
++#define EXT2_DIRSYNC_FL 		0x00010000 /* Synchronous directory modifications */
++#define EXT2_TOPDIR_FL			0x00020000 /* Top of directory hierarchies*/
++#define EXT3_EXTENTS_FL 		0x00080000 /* Inode uses extents */
++#define EXT2_RESERVED_FL		0x80000000 /* reserved for ext2 lib */
++
++#define EXT2_FL_USER_VISIBLE		0x0003DFFF /* User visible flags */
++#define EXT2_FL_USER_MODIFIABLE		0x000080FF /* User modifiable flags */
++
++/*
++ * ioctl commands
++ */
++#define EXT2_IOC_GETFLAGS		_IOR('f', 1, long)
++#define EXT2_IOC_SETFLAGS		_IOW('f', 2, long)
++#define EXT2_IOC_GETVERSION		_IOR('v', 1, long)
++#define EXT2_IOC_SETVERSION		_IOW('v', 2, long)
++
++/*
++ * Structure of an inode on the disk
++ */
++struct ext2_inode {
++	__u16	i_mode;		/* File mode */
++	__u16	i_uid;		/* Low 16 bits of Owner Uid */
++	__u32	i_size;		/* Size in bytes */
++	__u32	i_atime;	/* Access time */
++	__u32	i_ctime;	/* Creation time */
++	__u32	i_mtime;	/* Modification time */
++	__u32	i_dtime;	/* Deletion Time */
++	__u16	i_gid;		/* Low 16 bits of Group Id */
++	__u16	i_links_count;	/* Links count */
++	__u32	i_blocks;	/* Blocks count */
++	__u32	i_flags;	/* File flags */
++	union {
++		struct {
++			__u32  l_i_reserved1;
++		} linux1;
++		struct {
++			__u32  h_i_translator;
++		} hurd1;
++		struct {
++			__u32  m_i_reserved1;
++		} masix1;
++	} osd1;				/* OS dependent 1 */
++	__u32	i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
++	__u32	i_generation;	/* File version (for NFS) */
++	__u32	i_file_acl;	/* File ACL */
++	__u32	i_dir_acl;	/* Directory ACL */
++	__u32	i_faddr;	/* Fragment address */
++	union {
++		struct {
++			__u8	l_i_frag;	/* Fragment number */
++			__u8	l_i_fsize;	/* Fragment size */
++			__u16	i_pad1;
++			__u16	l_i_uid_high;	/* these 2 fields    */
++			__u16	l_i_gid_high;	/* were reserved2[0] */
++			__u32	l_i_reserved2;
++		} linux2;
++		struct {
++			__u8	h_i_frag;	/* Fragment number */
++			__u8	h_i_fsize;	/* Fragment size */
++			__u16	h_i_mode_high;
++			__u16	h_i_uid_high;
++			__u16	h_i_gid_high;
++			__u32	h_i_author;
++		} hurd2;
++		struct {
++			__u8	m_i_frag;	/* Fragment number */
++			__u8	m_i_fsize;	/* Fragment size */
++			__u16	m_pad1;
++			__u32	m_i_reserved2[2];
++		} masix2;
++	} osd2;				/* OS dependent 2 */
++};
++
++/*
++ * Permanent part of an large inode on the disk
++ */
++struct ext2_inode_large {
++	__u16	i_mode;		/* File mode */
++	__u16	i_uid;		/* Low 16 bits of Owner Uid */
++	__u32	i_size;		/* Size in bytes */
++	__u32	i_atime;	/* Access time */
++	__u32	i_ctime;	/* Creation time */
++	__u32	i_mtime;	/* Modification time */
++	__u32	i_dtime;	/* Deletion Time */
++	__u16	i_gid;		/* Low 16 bits of Group Id */
++	__u16	i_links_count;	/* Links count */
++	__u32	i_blocks;	/* Blocks count */
++	__u32	i_flags;	/* File flags */
++	union {
++		struct {
++			__u32  l_i_reserved1;
++		} linux1;
++		struct {
++			__u32  h_i_translator;
++		} hurd1;
++		struct {
++			__u32  m_i_reserved1;
++		} masix1;
++	} osd1;				/* OS dependent 1 */
++	__u32	i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
++	__u32	i_generation;	/* File version (for NFS) */
++	__u32	i_file_acl;	/* File ACL */
++	__u32	i_dir_acl;	/* Directory ACL */
++	__u32	i_faddr;	/* Fragment address */
++	union {
++		struct {
++			__u8	l_i_frag;	/* Fragment number */
++			__u8	l_i_fsize;	/* Fragment size */
++			__u16	i_pad1;
++			__u16	l_i_uid_high;	/* these 2 fields    */
++			__u16	l_i_gid_high;	/* were reserved2[0] */
++			__u32	l_i_reserved2;
++		} linux2;
++		struct {
++			__u8	h_i_frag;	/* Fragment number */
++			__u8	h_i_fsize;	/* Fragment size */
++			__u16	h_i_mode_high;
++			__u16	h_i_uid_high;
++			__u16	h_i_gid_high;
++			__u32	h_i_author;
++		} hurd2;
++		struct {
++			__u8	m_i_frag;	/* Fragment number */
++			__u8	m_i_fsize;	/* Fragment size */
++			__u16	m_pad1;
++			__u32	m_i_reserved2[2];
++		} masix2;
++	} osd2;				/* OS dependent 2 */
++	__u16	i_extra_isize;
++	__u16	i_pad1;
++};
++
++#define i_size_high	i_dir_acl
++
++#if defined(__KERNEL__) || defined(__linux__)
++#define i_reserved1	osd1.linux1.l_i_reserved1
++#define i_frag		osd2.linux2.l_i_frag
++#define i_fsize		osd2.linux2.l_i_fsize
++#define i_uid_low	i_uid
++#define i_gid_low	i_gid
++#define i_uid_high	osd2.linux2.l_i_uid_high
++#define i_gid_high	osd2.linux2.l_i_gid_high
++#define i_reserved2	osd2.linux2.l_i_reserved2
++
++#else
++#if defined(__GNU__)
++
++#define i_translator	osd1.hurd1.h_i_translator
++#define i_frag		osd2.hurd2.h_i_frag;
++#define i_fsize		osd2.hurd2.h_i_fsize;
++#define i_uid_high	osd2.hurd2.h_i_uid_high
++#define i_gid_high	osd2.hurd2.h_i_gid_high
++#define i_author	osd2.hurd2.h_i_author
++
++#else
++#if defined(__masix__)
++
++#define i_reserved1	osd1.masix1.m_i_reserved1
++#define i_frag		osd2.masix2.m_i_frag
++#define i_fsize		osd2.masix2.m_i_fsize
++#define i_reserved2	osd2.masix2.m_i_reserved2
++
++#endif  /* __masix__ */
++#endif  /* __GNU__ */
++#endif	/* defined(__KERNEL__) || defined(__linux__) */
++
++/*
++ * File system states
++ */
++#define EXT2_VALID_FS			0x0001	/* Unmounted cleanly */
++#define EXT2_ERROR_FS			0x0002	/* Errors detected */
++
++/*
++ * Mount flags
++ */
++#define EXT2_MOUNT_CHECK		0x0001	/* Do mount-time checks */
++#define EXT2_MOUNT_GRPID		0x0004	/* Create files with directory's group */
++#define EXT2_MOUNT_DEBUG		0x0008	/* Some debugging messages */
++#define EXT2_MOUNT_ERRORS_CONT		0x0010	/* Continue on errors */
++#define EXT2_MOUNT_ERRORS_RO		0x0020	/* Remount fs ro on errors */
++#define EXT2_MOUNT_ERRORS_PANIC		0x0040	/* Panic on errors */
++#define EXT2_MOUNT_MINIX_DF		0x0080	/* Mimics the Minix statfs */
++#define EXT2_MOUNT_NO_UID32		0x0200  /* Disable 32-bit UIDs */
++
++#define clear_opt(o, opt)		o &= ~EXT2_MOUNT_##opt
++#define set_opt(o, opt)			o |= EXT2_MOUNT_##opt
++#define test_opt(sb, opt)		(EXT2_SB(sb)->s_mount_opt & \
++					 EXT2_MOUNT_##opt)
++/*
++ * Maximal mount counts between two filesystem checks
++ */
++#define EXT2_DFL_MAX_MNT_COUNT		20	/* Allow 20 mounts */
++#define EXT2_DFL_CHECKINTERVAL		0	/* Don't use interval check */
++
++/*
++ * Behaviour when detecting errors
++ */
++#define EXT2_ERRORS_CONTINUE		1	/* Continue execution */
++#define EXT2_ERRORS_RO			2	/* Remount fs read-only */
++#define EXT2_ERRORS_PANIC		3	/* Panic */
++#define EXT2_ERRORS_DEFAULT		EXT2_ERRORS_CONTINUE
++
++/*
++ * Structure of the super block
++ */
++struct ext2_super_block {
++	__u32	s_inodes_count;		/* Inodes count */
++	__u32	s_blocks_count;		/* Blocks count */
++	__u32	s_r_blocks_count;	/* Reserved blocks count */
++	__u32	s_free_blocks_count;	/* Free blocks count */
++	__u32	s_free_inodes_count;	/* Free inodes count */
++	__u32	s_first_data_block;	/* First Data Block */
++	__u32	s_log_block_size;	/* Block size */
++	__s32	s_log_frag_size;	/* Fragment size */
++	__u32	s_blocks_per_group;	/* # Blocks per group */
++	__u32	s_frags_per_group;	/* # Fragments per group */
++	__u32	s_inodes_per_group;	/* # Inodes per group */
++	__u32	s_mtime;		/* Mount time */
++	__u32	s_wtime;		/* Write time */
++	__u16	s_mnt_count;		/* Mount count */
++	__s16	s_max_mnt_count;	/* Maximal mount count */
++	__u16	s_magic;		/* Magic signature */
++	__u16	s_state;		/* File system state */
++	__u16	s_errors;		/* Behaviour when detecting errors */
++	__u16	s_minor_rev_level;	/* minor revision level */
++	__u32	s_lastcheck;		/* time of last check */
++	__u32	s_checkinterval;	/* max. time between checks */
++	__u32	s_creator_os;		/* OS */
++	__u32	s_rev_level;		/* Revision level */
++	__u16	s_def_resuid;		/* Default uid for reserved blocks */
++	__u16	s_def_resgid;		/* Default gid for reserved blocks */
++	/*
++	 * These fields are for EXT2_DYNAMIC_REV superblocks only.
++	 *
++	 * Note: the difference between the compatible feature set and
++	 * the incompatible feature set is that if there is a bit set
++	 * in the incompatible feature set that the kernel doesn't
++	 * know about, it should refuse to mount the filesystem.
++	 *
++	 * e2fsck's requirements are more strict; if it doesn't know
++	 * about a feature in either the compatible or incompatible
++	 * feature set, it must abort and not try to meddle with
++	 * things it doesn't understand...
++	 */
++	__u32	s_first_ino;		/* First non-reserved inode */
++	__u16   s_inode_size;		/* size of inode structure */
++	__u16	s_block_group_nr;	/* block group # of this superblock */
++	__u32	s_feature_compat;	/* compatible feature set */
++	__u32	s_feature_incompat;	/* incompatible feature set */
++	__u32	s_feature_ro_compat;	/* readonly-compatible feature set */
++	__u8	s_uuid[16];		/* 128-bit uuid for volume */
++	char	s_volume_name[16];	/* volume name */
++	char	s_last_mounted[64];	/* directory where last mounted */
++	__u32	s_algorithm_usage_bitmap; /* For compression */
++	/*
++	 * Performance hints.  Directory preallocation should only
++	 * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
++	 */
++	__u8	s_prealloc_blocks;	/* Nr of blocks to try to preallocate*/
++	__u8	s_prealloc_dir_blocks;	/* Nr to preallocate for dirs */
++	__u16	s_reserved_gdt_blocks;	/* Per group table for online growth */
++	/*
++	 * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
++	 */
++	__u8	s_journal_uuid[16];	/* uuid of journal superblock */
++	__u32	s_journal_inum;		/* inode number of journal file */
++	__u32	s_journal_dev;		/* device number of journal file */
++	__u32	s_last_orphan;		/* start of list of inodes to delete */
++	__u32	s_hash_seed[4];		/* HTREE hash seed */
++	__u8	s_def_hash_version;	/* Default hash version to use */
++	__u8	s_jnl_backup_type; 	/* Default type of journal backup */
++	__u16	s_reserved_word_pad;
++	__u32	s_default_mount_opts;
++	__u32	s_first_meta_bg;	/* First metablock group */
++	__u32	s_mkfs_time;		/* When the filesystem was created */
++	__u32	s_jnl_blocks[17]; 	/* Backup of the journal inode */
++	__u32	s_reserved[172];	/* Padding to the end of the block */
++};
++
++/*
++ * Codes for operating systems
++ */
++#define EXT2_OS_LINUX		0
++#define EXT2_OS_HURD		1
++#define EXT2_OS_MASIX		2
++#define EXT2_OS_FREEBSD		3
++#define EXT2_OS_LITES		4
++
++/*
++ * Revision levels
++ */
++#define EXT2_GOOD_OLD_REV	0	/* The good old (original) format */
++#define EXT2_DYNAMIC_REV	1	/* V2 format w/ dynamic inode sizes */
++
++#define EXT2_CURRENT_REV	EXT2_GOOD_OLD_REV
++#define EXT2_MAX_SUPP_REV	EXT2_DYNAMIC_REV
++
++#define EXT2_GOOD_OLD_INODE_SIZE 128
++
++/*
++ * Journal inode backup types
++ */
++#define EXT3_JNL_BACKUP_BLOCKS	1
++
++/*
++ * Feature set definitions
++ */
++
++#define EXT2_HAS_COMPAT_FEATURE(sb,mask)			\
++	( EXT2_SB(sb)->s_feature_compat & (mask) )
++#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask)			\
++	( EXT2_SB(sb)->s_feature_ro_compat & (mask) )
++#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)			\
++	( EXT2_SB(sb)->s_feature_incompat & (mask) )
++
++#define EXT2_FEATURE_COMPAT_DIR_PREALLOC	0x0001
++#define EXT2_FEATURE_COMPAT_IMAGIC_INODES	0x0002
++#define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x0004
++#define EXT2_FEATURE_COMPAT_EXT_ATTR		0x0008
++#define EXT2_FEATURE_COMPAT_RESIZE_INODE	0x0010
++#define EXT2_FEATURE_COMPAT_DIR_INDEX		0x0020
++
++#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER	0x0001
++#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE	0x0002
++/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR	0x0004 not used */
++
++#define EXT2_FEATURE_INCOMPAT_COMPRESSION	0x0001
++#define EXT2_FEATURE_INCOMPAT_FILETYPE		0x0002
++#define EXT3_FEATURE_INCOMPAT_RECOVER		0x0004 /* Needs recovery */
++#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV	0x0008 /* Journal device */
++#define EXT2_FEATURE_INCOMPAT_META_BG		0x0010
++#define EXT3_FEATURE_INCOMPAT_EXTENTS		0x0040
++
++
++#define EXT2_FEATURE_COMPAT_SUPP	0
++#define EXT2_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE)
++#define EXT2_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
++					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
++					 EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
++
++/*
++ * Default values for user and/or group using reserved blocks
++ */
++#define EXT2_DEF_RESUID		0
++#define EXT2_DEF_RESGID		0
++
++/*
++ * Default mount options
++ */
++#define EXT2_DEFM_DEBUG		0x0001
++#define EXT2_DEFM_BSDGROUPS	0x0002
++#define EXT2_DEFM_XATTR_USER	0x0004
++#define EXT2_DEFM_ACL		0x0008
++#define EXT2_DEFM_UID16		0x0010
++#define EXT3_DEFM_JMODE		0x0060 
++#define EXT3_DEFM_JMODE_DATA	0x0020
++#define EXT3_DEFM_JMODE_ORDERED	0x0040
++#define EXT3_DEFM_JMODE_WBACK	0x0060
++
++/*
++ * Structure of a directory entry
++ */
++#define EXT2_NAME_LEN 255
++
++struct ext2_dir_entry {
++	__u32	inode;			/* Inode number */
++	__u16	rec_len;		/* Directory entry length */
++	__u16	name_len;		/* Name length */
++	char	name[EXT2_NAME_LEN];	/* File name */
++};
++
++/*
++ * The new version of the directory entry.  Since EXT2 structures are
++ * stored in intel byte order, and the name_len field could never be
++ * bigger than 255 chars, it's safe to reclaim the extra byte for the
++ * file_type field.
++ */
++struct ext2_dir_entry_2 {
++	__u32	inode;			/* Inode number */
++	__u16	rec_len;		/* Directory entry length */
++	__u8	name_len;		/* Name length */
++	__u8	file_type;
++	char	name[EXT2_NAME_LEN];	/* File name */
++};
++
++/*
++ * Ext2 directory file types.  Only the low 3 bits are used.  The
++ * other bits are reserved for now.
++ */
++#define EXT2_FT_UNKNOWN		0
++#define EXT2_FT_REG_FILE	1
++#define EXT2_FT_DIR		2
++#define EXT2_FT_CHRDEV		3
++#define EXT2_FT_BLKDEV		4
++#define EXT2_FT_FIFO		5
++#define EXT2_FT_SOCK		6
++#define EXT2_FT_SYMLINK		7
++
++#define EXT2_FT_MAX		8
++
++/*
++ * EXT2_DIR_PAD defines the directory entries boundaries
++ *
++ * NOTE: It must be a multiple of 4
++ */
++#define EXT2_DIR_PAD			4
++#define EXT2_DIR_ROUND			(EXT2_DIR_PAD - 1)
++#define EXT2_DIR_REC_LEN(name_len)	(((name_len) + 8 + EXT2_DIR_ROUND) & \
++					 ~EXT2_DIR_ROUND)
++
++#endif	/* _LINUX_EXT2_FS_H */
+diff -Naur silo-1.4.11.orig/libext2fs/ext2_io.h silo-1.4.11/libext2fs/ext2_io.h
+--- silo-1.4.11.orig/libext2fs/ext2_io.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext2_io.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,108 @@
++/*
++ * io.h --- the I/O manager abstraction
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#ifndef _EXT2FS_EXT2_IO_H
++#define _EXT2FS_EXT2_IO_H
++
++/*
++ * ext2_loff_t is defined here since unix_io.c needs it.
++ */
++#if defined(__GNUC__) || defined(HAS_LONG_LONG)
++typedef long long	ext2_loff_t;
++#else
++typedef long		ext2_loff_t;
++#endif
++
++/* llseek.c */
++ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int);
++
++typedef struct struct_io_manager *io_manager;
++typedef struct struct_io_channel *io_channel;
++
++#define CHANNEL_FLAGS_WRITETHROUGH	0x01
++
++struct struct_io_channel {
++	errcode_t	magic;
++	io_manager	manager;
++	char		*name;
++	int		block_size;
++	errcode_t	(*read_error)(io_channel channel,
++				      unsigned long block,
++				      int count,
++				      void *data,
++				      size_t size,
++				      int actual_bytes_read,
++				      errcode_t	error);
++	errcode_t	(*write_error)(io_channel channel,
++				       unsigned long block,
++				       int count,
++				       const void *data,
++				       size_t size,
++				       int actual_bytes_written,
++				       errcode_t error);
++	int		refcount;
++	int		flags;
++	int		reserved[14];
++	void		*private_data;
++	void		*app_data;
++};
++
++struct struct_io_manager {
++	errcode_t magic;
++	const char *name;
++	errcode_t (*open)(const char *name, int flags, io_channel *channel);
++	errcode_t (*close)(io_channel channel);
++	errcode_t (*set_blksize)(io_channel channel, int blksize);
++	errcode_t (*read_blk)(io_channel channel, unsigned long block,
++			      int count, void *data);
++	errcode_t (*write_blk)(io_channel channel, unsigned long block,
++			       int count, const void *data);
++	errcode_t (*flush)(io_channel channel);
++	errcode_t (*write_byte)(io_channel channel, unsigned long offset,
++				int count, const void *data);
++	errcode_t (*set_option)(io_channel channel, const char *option, 
++				const char *arg);
++	int		reserved[14];
++};
++
++#define IO_FLAG_RW	1
++
++/*
++ * Convenience functions....
++ */
++#define io_channel_close(c) 		((c)->manager->close((c)))
++#define io_channel_set_blksize(c,s)	((c)->manager->set_blksize((c),s))
++#define io_channel_read_blk(c,b,n,d)	((c)->manager->read_blk((c),b,n,d))
++#define io_channel_write_blk(c,b,n,d)	((c)->manager->write_blk((c),b,n,d))
++#define io_channel_flush(c) 		((c)->manager->flush((c)))
++#define io_channel_bumpcount(c)		((c)->refcount++)
++	
++/* io_manager.c */
++extern errcode_t io_channel_set_options(io_channel channel, 
++					const char *options);
++extern errcode_t io_channel_write_byte(io_channel channel, 
++				       unsigned long offset,
++				       int count, const void *data);
++
++/* unix_io.c */
++extern io_manager unix_io_manager;
++
++/* test_io.c */
++extern io_manager test_io_manager, test_io_backing_manager;
++extern void (*test_io_cb_read_blk)
++	(unsigned long block, int count, errcode_t err);
++extern void (*test_io_cb_write_blk)
++	(unsigned long block, int count, errcode_t err);
++extern void (*test_io_cb_set_blksize)
++	(int blksize, errcode_t err);
++
++#endif /* _EXT2FS_EXT2_IO_H */
++	
+diff -Naur silo-1.4.11.orig/libext2fs/ext2fs.h silo-1.4.11/libext2fs/ext2fs.h
+--- silo-1.4.11.orig/libext2fs/ext2fs.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext2fs.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,1140 @@
++/*
++ * ext2fs.h --- ext2fs
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#ifndef _EXT2FS_EXT2FS_H
++#define _EXT2FS_EXT2FS_H
++
++#ifdef __GNUC__
++#define EXT2FS_ATTR(x) __attribute__(x)
++#else
++#define EXT2FS_ATTR(x)
++#endif
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++/*
++ * Non-GNU C compilers won't necessarily understand inline
++ */
++#if (!defined(__GNUC__) && !defined(__WATCOMC__))
++#define NO_INLINE_FUNCS
++#endif
++
++/*
++ * Build in support for byte-swapping filesystems if we the feature
++ * has been configured or if we're being built on a CPU architecture
++ * with a non-native byte order.
++ */
++#if defined(ENABLE_SWAPFS) || defined(WORDS_BIGENDIAN)
++#define EXT2FS_ENABLE_SWAPFS
++#endif
++
++/*
++ * Where the master copy of the superblock is located, and how big
++ * superblocks are supposed to be.  We define SUPERBLOCK_SIZE because
++ * the size of the superblock structure is not necessarily trustworthy
++ * (some versions have the padding set up so that the superblock is
++ * 1032 bytes long).
++ */
++#define SUPERBLOCK_OFFSET	1024
++#define SUPERBLOCK_SIZE 	1024
++
++/*
++ * The last ext2fs revision level that this version of the library is
++ * able to support.
++ */
++#define EXT2_LIB_CURRENT_REV	EXT2_DYNAMIC_REV
++
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include <stdio.h>
++#include <stdlib.h>
++
++#if EXT2_FLAT_INCLUDES
++#include "e2_types.h"
++#include "ext2_fs.h"
++#else
++#include <ext2fs/ext2_types.h>
++#include <ext2fs/ext2_fs.h>
++#endif /* EXT2_FLAT_INCLUDES */
++
++typedef __u32		ext2_ino_t;
++typedef __u32		blk_t;
++typedef __u32		dgrp_t;
++typedef __u32		ext2_off_t;
++typedef __s64		e2_blkcnt_t;
++typedef __u32		ext2_dirhash_t;
++
++#if EXT2_FLAT_INCLUDES
++#include "com_err.h"
++#include "ext2_io.h"
++#include "ext2_err.h"
++#else
++#include <et/com_err.h>
++#include <ext2fs/ext2_io.h>
++#include <ext2fs/ext2_err.h>
++#endif
++
++/*
++ * Portability help for Microsoft Visual C++
++ */
++#ifdef _MSC_VER
++#define EXT2_QSORT_TYPE int __cdecl
++#else
++#define EXT2_QSORT_TYPE int
++#endif
++
++typedef struct struct_ext2_filsys *ext2_filsys;
++
++struct ext2fs_struct_generic_bitmap {
++	errcode_t	magic;
++	ext2_filsys 	fs;
++	__u32		start, end;
++	__u32		real_end;
++	char	*	description;
++	char	*	bitmap;
++	errcode_t	base_error_code;
++	__u32		reserved[7];
++};
++
++#define EXT2FS_MARK_ERROR 	0
++#define EXT2FS_UNMARK_ERROR 	1
++#define EXT2FS_TEST_ERROR	2
++
++typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
++typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap;
++typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
++
++#ifdef EXT2_DYNAMIC_REV
++#define EXT2_FIRST_INODE(s)	EXT2_FIRST_INO(s)
++#else
++#define EXT2_FIRST_INODE(s)	EXT2_FIRST_INO
++#define EXT2_INODE_SIZE(s)	sizeof(struct ext2_inode)
++#endif
++
++/*
++ * badblocks list definitions
++ */
++
++typedef struct ext2_struct_u32_list *ext2_badblocks_list;
++typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate;
++
++typedef struct ext2_struct_u32_list *ext2_u32_list;
++typedef struct ext2_struct_u32_iterate *ext2_u32_iterate;
++
++/* old */
++typedef struct ext2_struct_u32_list *badblocks_list;
++typedef struct ext2_struct_u32_iterate *badblocks_iterate;
++
++#define BADBLOCKS_FLAG_DIRTY	1
++
++/*
++ * ext2_dblist structure and abstractions (see dblist.c)
++ */
++struct ext2_db_entry {
++	ext2_ino_t	ino;
++	blk_t	blk;
++	int	blockcnt;
++};
++
++typedef struct ext2_struct_dblist *ext2_dblist;
++
++#define DBLIST_ABORT	1
++
++/*
++ * ext2_fileio definitions
++ */
++
++#define EXT2_FILE_WRITE		0x0001
++#define EXT2_FILE_CREATE	0x0002
++
++#define EXT2_FILE_MASK		0x00FF
++
++#define EXT2_FILE_BUF_DIRTY	0x4000
++#define EXT2_FILE_BUF_VALID	0x2000
++
++typedef struct ext2_file *ext2_file_t;
++
++#define EXT2_SEEK_SET	0
++#define EXT2_SEEK_CUR	1
++#define EXT2_SEEK_END	2
++
++/*
++ * Flags for the ext2_filsys structure and for ext2fs_open()
++ */
++#define EXT2_FLAG_RW			0x01
++#define EXT2_FLAG_CHANGED		0x02
++#define EXT2_FLAG_DIRTY			0x04
++#define EXT2_FLAG_VALID			0x08
++#define EXT2_FLAG_IB_DIRTY		0x10
++#define EXT2_FLAG_BB_DIRTY		0x20
++#define EXT2_FLAG_SWAP_BYTES		0x40
++#define EXT2_FLAG_SWAP_BYTES_READ	0x80
++#define EXT2_FLAG_SWAP_BYTES_WRITE	0x100
++#define EXT2_FLAG_MASTER_SB_ONLY	0x200
++#define EXT2_FLAG_FORCE			0x400
++#define EXT2_FLAG_SUPER_ONLY		0x800
++#define EXT2_FLAG_JOURNAL_DEV_OK	0x1000
++#define EXT2_FLAG_IMAGE_FILE		0x2000
++
++/*
++ * Special flag in the ext2 inode i_flag field that means that this is
++ * a new inode.  (So that ext2_write_inode() can clear extra fields.)
++ */
++#define EXT2_NEW_INODE_FL	0x80000000
++
++/*
++ * Flags for mkjournal
++ *
++ * EXT2_MKJOURNAL_V1_SUPER	Make a (deprecated) V1 journal superblock
++ */
++#define EXT2_MKJOURNAL_V1_SUPER	0x0000001
++
++struct struct_ext2_filsys {
++	errcode_t			magic;
++	io_channel			io;
++	int				flags;
++	char *				device_name;
++	struct ext2_super_block	* 	super;
++	unsigned int			blocksize;
++	int				fragsize;
++	dgrp_t				group_desc_count;
++	unsigned long			desc_blocks;
++	struct ext2_group_desc *	group_desc;
++	int				inode_blocks_per_group;
++	ext2fs_inode_bitmap		inode_map;
++	ext2fs_block_bitmap		block_map;
++	errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
++	errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino);
++	errcode_t (*write_bitmaps)(ext2_filsys fs);
++	errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino,
++				struct ext2_inode *inode);
++	errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino,
++				struct ext2_inode *inode);
++	ext2_badblocks_list		badblocks;
++	ext2_dblist			dblist;
++	__u32				stride;	/* for mke2fs */
++	struct ext2_super_block *	orig_super;
++	struct ext2_image_hdr *		image_header;
++	__u32				umask;
++	/*
++	 * Reserved for future expansion
++	 */
++	__u32				reserved[8];
++
++	/*
++	 * Reserved for the use of the calling application.
++	 */
++	void *				priv_data;
++
++	/*
++	 * Inode cache
++	 */
++	struct ext2_inode_cache		*icache;
++	io_channel			image_io;
++};
++
++#if EXT2_FLAT_INCLUDES
++#include "e2_bitops.h"
++#else
++#include <ext2fs/bitops.h>
++#endif
++
++/*
++ * Return flags for the block iterator functions
++ */
++#define BLOCK_CHANGED	1
++#define BLOCK_ABORT	2
++#define BLOCK_ERROR	4
++
++/*
++ * Block interate flags
++ *
++ * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator
++ * function should be called on blocks where the block number is zero.
++ * This is used by ext2fs_expand_dir() to be able to add a new block
++ * to an inode.  It can also be used for programs that want to be able
++ * to deal with files that contain "holes".
++ * 
++ * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the
++ * indirect, doubly indirect, etc. blocks should be called after all
++ * of the blocks containined in the indirect blocks are processed.
++ * This is useful if you are going to be deallocating blocks from an
++ * inode.
++ *
++ * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be
++ * called for data blocks only.
++ *
++ * BLOCK_FLAG_NO_LARGE is for internal use only.  It informs
++ * ext2fs_block_iterate2 that large files won't be accepted.
++ */
++#define BLOCK_FLAG_APPEND	1
++#define BLOCK_FLAG_HOLE		1
++#define BLOCK_FLAG_DEPTH_TRAVERSE	2
++#define BLOCK_FLAG_DATA_ONLY	4
++
++#define BLOCK_FLAG_NO_LARGE	0x1000
++
++/*
++ * Magic "block count" return values for the block iterator function.
++ */
++#define BLOCK_COUNT_IND		(-1)
++#define BLOCK_COUNT_DIND	(-2)
++#define BLOCK_COUNT_TIND	(-3)
++#define BLOCK_COUNT_TRANSLATOR	(-4)
++
++#if 0
++/*
++ * Flags for ext2fs_move_blocks
++ */
++#define EXT2_BMOVE_GET_DBLIST	0x0001	
++#define EXT2_BMOVE_DEBUG	0x0002
++#endif
++
++/*
++ * Flags for directory block reading and writing functions
++ */
++#define EXT2_DIRBLOCK_V2_STRUCT	0x0001
++
++/*
++ * Return flags for the directory iterator functions
++ */
++#define DIRENT_CHANGED	1
++#define DIRENT_ABORT	2
++#define DIRENT_ERROR	3
++
++/*
++ * Directory iterator flags
++ */
++
++#define DIRENT_FLAG_INCLUDE_EMPTY	1
++#define DIRENT_FLAG_INCLUDE_REMOVED	2
++
++#define DIRENT_DOT_FILE		1
++#define DIRENT_DOT_DOT_FILE	2
++#define DIRENT_OTHER_FILE	3
++#define DIRENT_DELETED_FILE	4
++
++/*
++ * Inode scan definitions
++ */
++typedef struct ext2_struct_inode_scan *ext2_inode_scan;
++
++/*
++ * ext2fs_scan flags
++ */
++#define EXT2_SF_CHK_BADBLOCKS	0x0001
++#define EXT2_SF_BAD_INODE_BLK	0x0002
++#define EXT2_SF_BAD_EXTRA_BYTES	0x0004
++#define EXT2_SF_SKIP_MISSING_ITABLE	0x0008
++
++/*
++ * ext2fs_check_if_mounted flags
++ */
++#define EXT2_MF_MOUNTED		1
++#define EXT2_MF_ISROOT		2
++#define EXT2_MF_READONLY	4
++#define EXT2_MF_SWAP		8
++#define EXT2_MF_BUSY		16
++
++/*
++ * Ext2/linux mode flags.  We define them here so that we don't need
++ * to depend on the OS's sys/stat.h, since we may be compiling on a
++ * non-Linux system.
++ */
++#define LINUX_S_IFMT  00170000
++#define LINUX_S_IFSOCK 0140000
++#define LINUX_S_IFLNK	 0120000
++#define LINUX_S_IFREG  0100000
++#define LINUX_S_IFBLK  0060000
++#define LINUX_S_IFDIR  0040000
++#define LINUX_S_IFCHR  0020000
++#define LINUX_S_IFIFO  0010000
++#define LINUX_S_ISUID  0004000
++#define LINUX_S_ISGID  0002000
++#define LINUX_S_ISVTX  0001000
++
++#define LINUX_S_IRWXU 00700
++#define LINUX_S_IRUSR 00400
++#define LINUX_S_IWUSR 00200
++#define LINUX_S_IXUSR 00100
++
++#define LINUX_S_IRWXG 00070
++#define LINUX_S_IRGRP 00040
++#define LINUX_S_IWGRP 00020
++#define LINUX_S_IXGRP 00010
++
++#define LINUX_S_IRWXO 00007
++#define LINUX_S_IROTH 00004
++#define LINUX_S_IWOTH 00002
++#define LINUX_S_IXOTH 00001
++
++#define LINUX_S_ISLNK(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
++#define LINUX_S_ISREG(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
++#define LINUX_S_ISDIR(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
++#define LINUX_S_ISCHR(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
++#define LINUX_S_ISBLK(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
++#define LINUX_S_ISFIFO(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
++#define LINUX_S_ISSOCK(m)	(((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
++
++/*
++ * ext2 size of an inode
++ */
++#define EXT2_I_SIZE(i)	((i)->i_size | ((__u64) (i)->i_size_high << 32))
++
++/*
++ * ext2_icount_t abstraction
++ */
++#define EXT2_ICOUNT_OPT_INCREMENT	0x01
++
++typedef struct ext2_icount *ext2_icount_t;
++
++/*
++ * Flags for ext2fs_bmap
++ */
++#define BMAP_ALLOC	0x0001
++#define BMAP_SET	0x0002
++
++/*
++ * Flags for imager.c functions
++ */
++#define IMAGER_FLAG_INODEMAP	1
++#define IMAGER_FLAG_SPARSEWRITE	2
++
++/*
++ * For checking structure magic numbers...
++ */
++
++#define EXT2_CHECK_MAGIC(struct, code) \
++	  if ((struct)->magic != (code)) return (code)
++
++
++/*
++ * For ext2 compression support
++ */
++#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) 0xffffffff)
++#define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR)
++
++/*
++ * Features supported by this version of the library
++ */
++#define EXT2_LIB_FEATURE_COMPAT_SUPP	(EXT2_FEATURE_COMPAT_DIR_PREALLOC|\
++					 EXT2_FEATURE_COMPAT_IMAGIC_INODES|\
++					 EXT3_FEATURE_COMPAT_HAS_JOURNAL|\
++					 EXT2_FEATURE_COMPAT_RESIZE_INODE|\
++					 EXT2_FEATURE_COMPAT_DIR_INDEX|\
++					 EXT2_FEATURE_COMPAT_EXT_ATTR)
++
++/* This #ifdef is temporary until compression is fully supported */
++#ifdef ENABLE_COMPRESSION
++#ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL
++/* If the below warning bugs you, then have
++   `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your
++   environment at configure time. */
++ #warning "Compression support is experimental"
++#endif
++#define EXT2_LIB_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE|\
++					 EXT2_FEATURE_INCOMPAT_COMPRESSION|\
++					 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
++					 EXT2_FEATURE_INCOMPAT_META_BG|\
++					 EXT3_FEATURE_INCOMPAT_RECOVER)
++#else
++#define EXT2_LIB_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE|\
++					 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
++					 EXT2_FEATURE_INCOMPAT_META_BG|\
++					 EXT3_FEATURE_INCOMPAT_RECOVER)
++#endif
++#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\
++					 EXT2_FEATURE_RO_COMPAT_LARGE_FILE)
++/*
++ * function prototypes
++ */
++
++/* alloc.c */
++extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
++				  ext2fs_inode_bitmap map, ext2_ino_t *ret);
++extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
++				  ext2fs_block_bitmap map, blk_t *ret);
++extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start,
++					blk_t finish, int num,
++					ext2fs_block_bitmap map,
++					blk_t *ret);
++extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
++				    char *block_buf, blk_t *ret);
++
++/* alloc_sb.c */
++extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, 
++					dgrp_t group,
++					ext2fs_block_bitmap bmap);
++
++/* alloc_stats.c */
++void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse);
++void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino,
++			       int inuse, int isdir);
++void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse);
++
++/* alloc_tables.c */
++extern errcode_t ext2fs_allocate_tables(ext2_filsys fs);
++extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
++					     ext2fs_block_bitmap bmap);
++
++/* badblocks.c */
++extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size);
++extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk);
++extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk);
++extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk);
++extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb,
++					       ext2_u32_iterate *ret);
++extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk);
++extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter);
++extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest);
++extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2);
++
++extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret,
++					    int size);
++extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb,
++					   blk_t blk);
++extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb,
++				    blk_t blk);
++extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk);
++extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk);
++extern errcode_t
++	ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb,
++					    ext2_badblocks_iterate *ret);
++extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter,
++					 blk_t *blk);
++extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter);
++extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src,
++				       ext2_badblocks_list *dest);
++extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1,
++				  ext2_badblocks_list bb2);
++extern int ext2fs_u32_list_count(ext2_u32_list bb);
++
++/* bb_compat */
++extern errcode_t badblocks_list_create(badblocks_list *ret, int size);
++extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk);
++extern int badblocks_list_test(badblocks_list bb, blk_t blk);
++extern errcode_t badblocks_list_iterate_begin(badblocks_list bb,
++					      badblocks_iterate *ret);
++extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk);
++extern void badblocks_list_iterate_end(badblocks_iterate iter);
++extern void badblocks_list_free(badblocks_list bb);
++
++/* bb_inode.c */
++extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs,
++					ext2_badblocks_list bb_list);
++
++/* bitmaps.c */
++extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs);
++extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs);
++extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs);
++extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs);
++extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
++						__u32 end,
++						__u32 real_end,
++						const char *descr,
++						ext2fs_generic_bitmap *ret);
++extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
++					      const char *descr,
++					      ext2fs_block_bitmap *ret);
++extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
++					      const char *descr,
++					      ext2fs_inode_bitmap *ret);
++extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
++					       ext2_ino_t end, ext2_ino_t *oend);
++extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
++					       blk_t end, blk_t *oend);
++extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
++extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap);
++extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs);
++extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
++
++/* block.c */
++extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
++				      ext2_ino_t	ino,
++				      int	flags,
++				      char *block_buf,
++				      int (*func)(ext2_filsys fs,
++						  blk_t	*blocknr,
++						  int	blockcnt,
++						  void	*priv_data),
++				      void *priv_data);
++errcode_t ext2fs_block_iterate2(ext2_filsys fs,
++				ext2_ino_t	ino,
++				int	flags,
++				char *block_buf,
++				int (*func)(ext2_filsys fs,
++					    blk_t	*blocknr,
++					    e2_blkcnt_t	blockcnt,
++					    blk_t	ref_blk,
++					    int		ref_offset,
++					    void	*priv_data),
++				void *priv_data);
++
++/* bmap.c */
++extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
++			     struct ext2_inode *inode, 
++			     char *block_buf, int bmap_flags,
++			     blk_t block, blk_t *phys_blk);
++
++
++#if 0
++/* bmove.c */
++extern errcode_t ext2fs_move_blocks(ext2_filsys fs,
++				    ext2fs_block_bitmap reserve,
++				    ext2fs_block_bitmap alloc_map,
++				    int flags);
++#endif
++
++/* check_desc.c */
++extern errcode_t ext2fs_check_desc(ext2_filsys fs);
++
++/* closefs.c */
++extern errcode_t ext2fs_close(ext2_filsys fs);
++extern errcode_t ext2fs_flush(ext2_filsys fs);
++extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block);
++extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, 
++				    dgrp_t group,
++				    blk_t *ret_super_blk,
++				    blk_t *ret_old_desc_blk,
++				    blk_t *ret_new_desc_blk,
++				    int *ret_meta_bg);
++extern void ext2fs_update_dynamic_rev(ext2_filsys fs);
++
++/* cmp_bitmaps.c */
++extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
++					     ext2fs_block_bitmap bm2);
++extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
++					     ext2fs_inode_bitmap bm2);
++
++/* dblist.c */
++
++extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs);
++extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist);
++extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino,
++				      blk_t blk, int blockcnt);
++extern void ext2fs_dblist_sort(ext2_dblist dblist,
++			       EXT2_QSORT_TYPE (*sortfunc)(const void *,
++							   const void *));
++extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
++	int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
++		    void	*priv_data),
++       void *priv_data);
++extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino,
++				      blk_t blk, int blockcnt);
++extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
++				    ext2_dblist *dest);
++extern int ext2fs_dblist_count(ext2_dblist dblist);
++
++/* dblist_dir.c */
++extern errcode_t
++	ext2fs_dblist_dir_iterate(ext2_dblist dblist,
++				  int	flags,
++				  char	*block_buf,
++				  int (*func)(ext2_ino_t	dir,
++					      int		entry,
++					      struct ext2_dir_entry *dirent,
++					      int	offset,
++					      int	blocksize,
++					      char	*buf,
++					      void	*priv_data),
++				  void *priv_data);
++
++/* dirblock.c */
++extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block,
++				       void *buf);
++extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block,
++					void *buf, int flags);
++extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
++					void *buf);
++extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
++					 void *buf, int flags);
++
++/* dirhash.c */
++extern errcode_t ext2fs_dirhash(int version, const char *name, int len,
++				const __u32 *seed,
++				ext2_dirhash_t *ret_hash,
++				ext2_dirhash_t *ret_minor_hash);
++
++
++/* dir_iterate.c */
++extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, 
++			      ext2_ino_t dir,
++			      int flags,
++			      char *block_buf,
++			      int (*func)(struct ext2_dir_entry *dirent,
++					  int	offset,
++					  int	blocksize,
++					  char	*buf,
++					  void	*priv_data),
++			      void *priv_data);
++extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, 
++			      ext2_ino_t dir,
++			      int flags,
++			      char *block_buf,
++			      int (*func)(ext2_ino_t	dir,
++					  int	entry,
++					  struct ext2_dir_entry *dirent,
++					  int	offset,
++					  int	blocksize,
++					  char	*buf,
++					  void	*priv_data),
++			      void *priv_data);
++
++/* dupfs.c */
++extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
++
++/* expanddir.c */
++extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);
++
++/* ext_attr.c */
++extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf);
++extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block,
++				       void *buf);
++extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
++					   char *block_buf,
++					   int adjust, __u32 *newcount);
++
++/* fileio.c */
++extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
++				   struct ext2_inode *inode,
++				   int flags, ext2_file_t *ret);
++extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
++				  int flags, ext2_file_t *ret);
++extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
++extern errcode_t ext2fs_file_close(ext2_file_t file);
++extern errcode_t ext2fs_file_flush(ext2_file_t file);
++extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
++				  unsigned int wanted, unsigned int *got);
++extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
++				   unsigned int nbytes, unsigned int *written);
++extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset,
++				   int whence, __u64 *ret_pos);
++extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
++				   int whence, ext2_off_t *ret_pos);
++errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size);
++extern ext2_off_t ext2fs_file_get_size(ext2_file_t file);
++extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size);
++
++/* finddev.c */
++extern char *ext2fs_find_block_device(dev_t device);
++
++/* flushb.c */
++extern errcode_t ext2fs_sync_device(int fd, int flushb);
++
++/* freefs.c */
++extern void ext2fs_free(ext2_filsys fs);
++extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap);
++extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap);
++extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap);
++extern void ext2fs_free_dblist(ext2_dblist dblist);
++extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb);
++extern void ext2fs_u32_list_free(ext2_u32_list bb);
++
++/* getsize.c */
++extern errcode_t ext2fs_get_device_size(const char *file, int blocksize,
++					blk_t *retblocks);
++
++/* getsectsize.c */
++errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize);
++
++/* imager.c */
++extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags);
++extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags);
++extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags);
++extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags);
++extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags);
++extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags);
++
++/* ind_block.c */
++errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf);
++errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf);
++
++/* initialize.c */
++extern errcode_t ext2fs_initialize(const char *name, int flags,
++				   struct ext2_super_block *param,
++				   io_manager manager, ext2_filsys *ret_fs);
++
++/* icount.c */
++extern void ext2fs_free_icount(ext2_icount_t icount);
++extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, 
++				       unsigned int size,
++				       ext2_icount_t hint, ext2_icount_t *ret);
++extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, 
++				      unsigned int size,
++				      ext2_icount_t *ret);
++extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
++				     __u16 *ret);
++extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
++					 __u16 *ret);
++extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
++					 __u16 *ret);
++extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
++				     __u16 count);
++extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
++errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
++
++/* inode.c */
++extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
++extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, 
++					    ext2_ino_t *ino,
++					    struct ext2_inode *inode, 
++					    int bufsize);
++extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
++				  ext2_inode_scan *ret_scan);
++extern void ext2fs_close_inode_scan(ext2_inode_scan scan);
++extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
++			       struct ext2_inode *inode);
++extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
++						   int	group);
++extern void ext2fs_set_inode_callback
++	(ext2_inode_scan scan,
++	 errcode_t (*done_group)(ext2_filsys fs,
++				 ext2_inode_scan scan,
++				 dgrp_t group,
++				 void * priv_data),
++	 void *done_group_data);
++extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
++				   int clear_flags);
++extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
++					struct ext2_inode * inode, 
++					int bufsize);
++extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
++			    struct ext2_inode * inode);
++extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
++					 struct ext2_inode * inode, 
++					 int bufsize);
++extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
++			    struct ext2_inode * inode);
++extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
++			    struct ext2_inode * inode);
++extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
++extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
++
++/* inode_io.c */
++extern io_manager inode_io_manager;
++extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, 
++					char **name);
++extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
++					 struct ext2_inode *inode,
++					 char **name);
++	
++/* ismounted.c */
++extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
++extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
++					  char *mtpt, int mtlen);
++
++/* namei.c */
++extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
++			 int namelen, char *buf, ext2_ino_t *inode);
++extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
++			const char *name, ext2_ino_t *inode);
++errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
++			      const char *name, ext2_ino_t *inode);
++extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
++			ext2_ino_t inode, ext2_ino_t *res_inode);
++
++/* native.c */
++int ext2fs_native_flag(void);
++
++/* newdir.c */
++extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
++				ext2_ino_t parent_ino, char **block);
++
++/* mkdir.c */
++extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
++			      const char *name);
++
++/* mkjournal.c */
++extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
++						  __u32 size, int flags,
++						  char  **ret_jsb);
++extern errcode_t ext2fs_add_journal_device(ext2_filsys fs,
++					   ext2_filsys journal_dev);
++extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size,
++					  int flags);
++
++/* openfs.c */
++extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
++			     unsigned int block_size, io_manager manager,
++			     ext2_filsys *ret_fs);
++extern errcode_t ext2fs_open2(const char *name, const char *io_options, 
++			      int flags, int superblock, 
++			      unsigned int block_size, io_manager manager,
++			      ext2_filsys *ret_fs);
++extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, 
++					 dgrp_t i);
++errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io);
++errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io);
++errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io);
++
++/* get_pathname.c */
++extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
++			       char **name);
++
++/* link.c */
++errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
++		      ext2_ino_t ino, int flags);
++errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name,
++			ext2_ino_t ino, int flags);
++
++/* read_bb.c */
++extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
++				      ext2_badblocks_list *bb_list);
++
++/* read_bb_file.c */
++extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, 
++				      ext2_badblocks_list *bb_list,
++				      void *priv_data,
++				      void (*invalid)(ext2_filsys fs,
++						      blk_t blk,
++						      char *badstr,
++						      void *priv_data));
++extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, 
++				     ext2_badblocks_list *bb_list,
++				     void (*invalid)(ext2_filsys fs,
++						     blk_t blk));
++
++/* res_gdt.c */
++extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs);
++
++/* rs_bitmap.c */
++extern errcode_t ext2fs_resize_generic_bitmap(__u32 new_end,
++					      __u32 new_real_end,
++					      ext2fs_generic_bitmap bmap);
++extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
++					    ext2fs_inode_bitmap bmap);
++extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
++					    ext2fs_block_bitmap bmap);
++extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src,
++				    ext2fs_generic_bitmap *dest);
++
++/* swapfs.c */
++extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, 
++				 int has_header);
++extern void ext2fs_swap_super(struct ext2_super_block * super);
++extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp);
++extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
++				   struct ext2_inode_large *f, int hostorder,
++				   int bufsize);
++extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t,
++			      struct ext2_inode *f, int hostorder);
++
++/* valid_blk.c */
++extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
++
++/* version.c */
++extern int ext2fs_parse_version_string(const char *ver_string);
++extern int ext2fs_get_library_version(const char **ver_string,
++				      const char **date_string);
++
++/* write_bb_file.c */
++extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
++				      unsigned int flags,
++				      FILE *f);
++
++
++/* inline functions */
++extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr);
++extern errcode_t ext2fs_free_mem(void *ptr);
++extern errcode_t ext2fs_resize_mem(unsigned long old_size,
++				   unsigned long size, void *ptr);
++extern void ext2fs_mark_super_dirty(ext2_filsys fs);
++extern void ext2fs_mark_changed(ext2_filsys fs);
++extern int ext2fs_test_changed(ext2_filsys fs);
++extern void ext2fs_mark_valid(ext2_filsys fs);
++extern void ext2fs_unmark_valid(ext2_filsys fs);
++extern int ext2fs_test_valid(ext2_filsys fs);
++extern void ext2fs_mark_ib_dirty(ext2_filsys fs);
++extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
++extern int ext2fs_test_ib_dirty(ext2_filsys fs);
++extern int ext2fs_test_bb_dirty(ext2_filsys fs);
++extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
++extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
++extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
++				      struct ext2_inode *inode);
++
++/*
++ * The actual inlined functions definitions themselves...
++ *
++ * If NO_INLINE_FUNCS is defined, then we won't try to do inline
++ * functions at all!
++ */
++#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
++#ifdef INCLUDE_INLINE_FUNCS
++#define _INLINE_ extern
++#else
++#ifdef __GNUC__
++#define _INLINE_ extern __inline__
++#else				/* For Watcom C */
++#define _INLINE_ extern inline
++#endif
++#endif
++
++#ifndef EXT2_CUSTOM_MEMORY_ROUTINES
++/*
++ *  Allocate memory
++ */
++_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr)
++{
++	void **pp = (void **)ptr;
++
++	*pp = malloc(size);
++	if (!*pp)
++		return EXT2_ET_NO_MEMORY;
++	return 0;
++}
++
++/*
++ * Free memory
++ */
++_INLINE_ errcode_t ext2fs_free_mem(void *ptr)
++{
++	void **pp = (void **)ptr;
++
++	free(*pp);
++	*pp = 0;
++	return 0;
++}
++	
++/*
++ *  Resize memory
++ */
++_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
++				     unsigned long size, void *ptr)
++{
++	void *p;
++
++	/* Use "memcpy" for pointer assignments here to avoid problems
++	 * with C99 strict type aliasing rules. */
++	memcpy(&p, ptr, sizeof (p));
++	p = realloc(p, size);
++	if (!p)
++		return EXT2_ET_NO_MEMORY;
++	memcpy(ptr, &p, sizeof (p));
++	return 0;
++}
++#endif	/* Custom memory routines */
++
++/*
++ * Mark a filesystem superblock as dirty
++ */
++_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs)
++{
++	fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED;
++}
++
++/*
++ * Mark a filesystem as changed
++ */
++_INLINE_ void ext2fs_mark_changed(ext2_filsys fs)
++{
++	fs->flags |= EXT2_FLAG_CHANGED;
++}
++
++/*
++ * Check to see if a filesystem has changed
++ */
++_INLINE_ int ext2fs_test_changed(ext2_filsys fs)
++{
++	return (fs->flags & EXT2_FLAG_CHANGED);
++}
++
++/*
++ * Mark a filesystem as valid
++ */
++_INLINE_ void ext2fs_mark_valid(ext2_filsys fs)
++{
++	fs->flags |= EXT2_FLAG_VALID;
++}
++
++/*
++ * Mark a filesystem as NOT valid
++ */
++_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs)
++{
++	fs->flags &= ~EXT2_FLAG_VALID;
++}
++
++/*
++ * Check to see if a filesystem is valid
++ */
++_INLINE_ int ext2fs_test_valid(ext2_filsys fs)
++{
++	return (fs->flags & EXT2_FLAG_VALID);
++}
++
++/*
++ * Mark the inode bitmap as dirty
++ */
++_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs)
++{
++	fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED;
++}
++
++/*
++ * Mark the block bitmap as dirty
++ */
++_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs)
++{
++	fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED;
++}
++
++/*
++ * Check to see if a filesystem's inode bitmap is dirty
++ */
++_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs)
++{
++	return (fs->flags & EXT2_FLAG_IB_DIRTY);
++}
++
++/*
++ * Check to see if a filesystem's block bitmap is dirty
++ */
++_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs)
++{
++	return (fs->flags & EXT2_FLAG_BB_DIRTY);
++}
++
++/*
++ * Return the group # of a block
++ */
++_INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
++{
++	return (blk - fs->super->s_first_data_block) /
++		fs->super->s_blocks_per_group;
++}
++
++/*
++ * Return the group # of an inode number
++ */
++_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
++{
++	return (ino - 1) / fs->super->s_inodes_per_group;
++}
++
++_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
++					struct ext2_inode *inode)
++{
++       return inode->i_blocks -
++              (inode->i_file_acl ? fs->blocksize >> 9 : 0);
++}
++#undef _INLINE_
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* _EXT2FS_EXT2FS_H */
+diff -Naur silo-1.4.11.orig/libext2fs/ext2fsP.h silo-1.4.11/libext2fs/ext2fsP.h
+--- silo-1.4.11.orig/libext2fs/ext2fsP.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext2fsP.h	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,88 @@
++/*
++ * ext2fsP.h --- private header file for ext2 library
++ * 
++ * Copyright (C) 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include "ext2fs.h"
++
++/*
++ * Badblocks list
++ */
++struct ext2_struct_u32_list {
++	int	magic;
++	int	num;
++	int	size;
++	__u32	*list;
++	int	badblocks_flags;
++};
++
++struct ext2_struct_u32_iterate {
++	int			magic;
++	ext2_u32_list		bb;
++	int			ptr;
++};
++
++
++/*
++ * Directory block iterator definition
++ */
++struct ext2_struct_dblist {
++	int			magic;
++	ext2_filsys		fs;
++	ext2_ino_t		size;
++	ext2_ino_t		count;
++	int			sorted;
++	struct ext2_db_entry *	list;
++};
++
++/*
++ * For directory iterators
++ */
++struct dir_context {
++	ext2_ino_t		dir;
++	int		flags;
++	char		*buf;
++	int (*func)(ext2_ino_t	dir,
++		    int	entry,
++		    struct ext2_dir_entry *dirent,
++		    int	offset,
++		    int	blocksize,
++		    char	*buf,
++		    void	*priv_data);
++	void		*priv_data;
++	errcode_t	errcode;
++};
++
++/*
++ * Inode cache structure
++ */
++struct ext2_inode_cache {
++	void *				buffer;
++	blk_t				buffer_blk;
++	int				cache_last;
++	int				cache_size;
++	int				refcount;
++	struct ext2_inode_cache_ent	*cache;
++};
++
++struct ext2_inode_cache_ent {
++	ext2_ino_t		ino;
++	struct ext2_inode	inode;
++};
++
++/* Function prototypes */
++
++extern int ext2fs_process_dir_block(ext2_filsys  	fs,
++				    blk_t		*blocknr,
++				    e2_blkcnt_t		blockcnt,
++				    blk_t		ref_block,
++				    int			ref_offset,
++				    void		*priv_data);
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/ext_attr.c silo-1.4.11/libext2fs/ext_attr.c
+--- silo-1.4.11.orig/libext2fs/ext_attr.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ext_attr.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,105 @@
++/*
++ * ext_attr.c --- extended attribute blocks
++ * 
++ * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org>
++ *
++ * Copyright (C) 2002 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2_ext_attr.h"
++
++#include "ext2fs.h"
++
++errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf)
++{
++	errcode_t	retval;
++
++ 	retval = io_channel_read_blk(fs->io, block, 1, buf);
++	if (retval)
++		return retval;
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if ((fs->flags & (EXT2_FLAG_SWAP_BYTES|
++			  EXT2_FLAG_SWAP_BYTES_READ)) != 0)
++		ext2fs_swap_ext_attr(buf, buf, fs->blocksize, 1);
++#endif
++	return 0;
++}
++
++errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)
++{
++	errcode_t	retval;
++	char		*write_buf;
++	char		*buf = NULL;
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++	    (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
++		retval = ext2fs_get_mem(fs->blocksize, &buf);
++		if (retval)
++			return retval;
++		write_buf = buf;
++		ext2fs_swap_ext_attr(buf, inbuf, fs->blocksize, 1);
++	} else
++#endif
++		write_buf = (char *) inbuf;
++ 	retval = io_channel_write_blk(fs->io, block, 1, write_buf);
++	if (buf)
++		ext2fs_free_mem(&buf);
++	if (!retval)
++		ext2fs_mark_changed(fs);
++	return retval;
++}
++
++/*
++ * This function adjusts the reference count of the EA block.
++ */
++errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
++				    char *block_buf, int adjust,
++				    __u32 *newcount)
++{
++	errcode_t	retval;
++	struct ext2_ext_attr_header *header;
++	char	*buf = 0;
++
++	if ((blk >= fs->super->s_blocks_count) ||
++	    (blk < fs->super->s_first_data_block))
++		return EXT2_ET_BAD_EA_BLOCK_NUM;
++
++	if (!block_buf) {
++		retval = ext2fs_get_mem(fs->blocksize, &buf);
++		if (retval)
++			return retval;
++		block_buf = buf;
++	}
++
++	retval = ext2fs_read_ext_attr(fs, blk, block_buf);
++	if (retval)
++		goto errout;
++
++	header = (struct ext2_ext_attr_header *) block_buf;
++	header->h_refcount += adjust;
++	if (newcount)
++		*newcount = header->h_refcount;
++
++	retval = ext2fs_write_ext_attr(fs, blk, block_buf);
++	if (retval)
++		goto errout;
++
++errout:
++	if (buf)
++		ext2fs_free_mem(&buf);
++	return retval;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/fileio.c silo-1.4.11/libext2fs/fileio.c
+--- silo-1.4.11.orig/libext2fs/fileio.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/fileio.c	2006-03-09 21:34:56 +0000
+@@ -0,0 +1,378 @@
++/*
++ * fileio.c --- Simple file I/O routines
++ * 
++ * Copyright (C) 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct ext2_file {
++	errcode_t		magic;
++	ext2_filsys 		fs;
++	ext2_ino_t		ino;
++	struct ext2_inode	inode;
++	int 			flags;
++	__u64			pos;
++	blk_t			blockno;
++	blk_t			physblock;
++	char 			*buf;
++};
++
++#define BMAP_BUFFER (file->buf + fs->blocksize)
++
++errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino,
++			    struct ext2_inode *inode,
++			    int flags, ext2_file_t *ret)
++{
++	ext2_file_t 	file;
++	errcode_t	retval;
++
++	/*
++	 * Don't let caller create or open a file for writing if the
++	 * filesystem is read-only.
++	 */
++	if ((flags & (EXT2_FILE_WRITE | EXT2_FILE_CREATE)) &&
++	    !(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++
++	retval = ext2fs_get_mem(sizeof(struct ext2_file), &file);
++	if (retval)
++		return retval;
++	
++	memset(file, 0, sizeof(struct ext2_file));
++	file->magic = EXT2_ET_MAGIC_EXT2_FILE;
++	file->fs = fs;
++	file->ino = ino;
++	file->flags = flags & EXT2_FILE_MASK;
++
++	if (inode) {
++		memcpy(&file->inode, inode, sizeof(struct ext2_inode));
++	} else {
++		retval = ext2fs_read_inode(fs, ino, &file->inode);
++		if (retval)
++			goto fail;
++	}
++	
++	retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf);
++	if (retval)
++		goto fail;
++
++	*ret = file;
++	return 0;
++	
++fail:
++	if (file->buf)
++		ext2fs_free_mem(&file->buf);
++	ext2fs_free_mem(&file);
++	return retval;
++}
++
++errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
++			   int flags, ext2_file_t *ret)
++{
++	return ext2fs_file_open2(fs, ino, NULL, flags, ret);
++}
++
++/*
++ * This function returns the filesystem handle of a file from the structure
++ */
++ext2_filsys ext2fs_file_get_fs(ext2_file_t file)
++{
++	if (file->magic != EXT2_ET_MAGIC_EXT2_FILE)
++		return 0;
++	return file->fs;
++}
++
++/*
++ * This function flushes the dirty block buffer out to disk if
++ * necessary.
++ */
++errcode_t ext2fs_file_flush(ext2_file_t file)
++{
++	errcode_t	retval;
++	ext2_filsys fs;
++	
++	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
++	fs = file->fs;
++
++	if (!(file->flags & EXT2_FILE_BUF_VALID) ||
++	    !(file->flags & EXT2_FILE_BUF_DIRTY))
++		return 0;
++
++	/*
++	 * OK, the physical block hasn't been allocated yet.
++	 * Allocate it.
++	 */
++	if (!file->physblock) {
++		retval = ext2fs_bmap(fs, file->ino, &file->inode,
++				     BMAP_BUFFER, file->ino ? BMAP_ALLOC : 0,
++				     file->blockno, &file->physblock);
++		if (retval)
++			return retval;
++	}
++
++	retval = io_channel_write_blk(fs->io, file->physblock,
++				      1, file->buf);
++	if (retval)
++		return retval;
++
++	file->flags &= ~EXT2_FILE_BUF_DIRTY;
++
++	return retval;
++}
++
++/*
++ * This function synchronizes the file's block buffer and the current
++ * file position, possibly invalidating block buffer if necessary
++ */
++static errcode_t sync_buffer_position(ext2_file_t file)
++{
++	blk_t	b;
++	errcode_t	retval;
++
++	b = file->pos / file->fs->blocksize;
++	if (b != file->blockno) {
++		retval = ext2fs_file_flush(file);
++		if (retval)
++			return retval;
++		file->flags &= ~EXT2_FILE_BUF_VALID;
++	}
++	file->blockno = b;
++	return 0;
++}
++
++/*
++ * This function loads the file's block buffer with valid data from
++ * the disk as necessary.
++ *
++ * If dontfill is true, then skip initializing the buffer since we're
++ * going to be replacing its entire contents anyway.  If set, then the
++ * function basically only sets file->physblock and EXT2_FILE_BUF_VALID
++ */
++#define DONTFILL 1
++static errcode_t load_buffer(ext2_file_t file, int dontfill)
++{
++	ext2_filsys	fs = file->fs;
++	errcode_t	retval;
++
++	if (!(file->flags & EXT2_FILE_BUF_VALID)) {
++		retval = ext2fs_bmap(fs, file->ino, &file->inode,
++				     BMAP_BUFFER, 0, file->blockno,
++				     &file->physblock);
++		if (retval)
++			return retval;
++		if (!dontfill) {
++			if (file->physblock) {
++				retval = io_channel_read_blk(fs->io,
++							     file->physblock, 
++							     1, file->buf);
++				if (retval)
++					return retval;
++			} else
++				memset(file->buf, 0, fs->blocksize);
++		}
++		file->flags |= EXT2_FILE_BUF_VALID;
++	}
++	return 0;
++}
++	
++
++errcode_t ext2fs_file_close(ext2_file_t file)
++{
++	errcode_t	retval;
++	
++	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
++
++	retval = ext2fs_file_flush(file);
++	
++	if (file->buf)
++		ext2fs_free_mem(&file->buf);
++	ext2fs_free_mem(&file);
++
++	return retval;
++}
++
++
++errcode_t ext2fs_file_read(ext2_file_t file, void *buf,
++			   unsigned int wanted, unsigned int *got)
++{
++	ext2_filsys	fs;
++	errcode_t	retval = 0;
++	unsigned int	start, c, count = 0;
++	__u64		left;
++	char		*ptr = (char *) buf;
++
++	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
++	fs = file->fs;
++
++	while ((file->pos < EXT2_I_SIZE(&file->inode)) && (wanted > 0)) {
++		retval = sync_buffer_position(file);
++		if (retval)
++			goto fail;
++		retval = load_buffer(file, 0);
++		if (retval)
++			goto fail;
++
++		start = file->pos % fs->blocksize;
++		c = fs->blocksize - start;
++		if (c > wanted)
++			c = wanted;
++		left = EXT2_I_SIZE(&file->inode) - file->pos ;
++		if (c > left)
++			c = left;
++	
++		memcpy(ptr, file->buf+start, c);
++		file->pos += c;
++		ptr += c;
++		count += c;
++		wanted -= c;
++	}
++	
++fail:
++	if (got)
++		*got = count;
++	return retval;
++}
++
++
++errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
++			    unsigned int nbytes, unsigned int *written)
++{
++	ext2_filsys	fs;
++	errcode_t	retval = 0;
++	unsigned int	start, c, count = 0;
++	const char	*ptr = (const char *) buf;
++
++	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
++	fs = file->fs;
++
++	if (!(file->flags & EXT2_FILE_WRITE))
++		return EXT2_ET_FILE_RO;
++
++	while (nbytes > 0) {
++		retval = sync_buffer_position(file);
++		if (retval)
++			goto fail;
++		
++		start = file->pos % fs->blocksize;
++		c = fs->blocksize - start;
++		if (c > nbytes)
++			c = nbytes;
++
++		/*
++		 * We only need to do a read-modify-update cycle if
++		 * we're doing a partial write.
++		 */
++		retval = load_buffer(file, (c == fs->blocksize));
++		if (retval)
++			goto fail;
++
++		file->flags |= EXT2_FILE_BUF_DIRTY;
++		memcpy(file->buf+start, ptr, c);
++		file->pos += c;
++		ptr += c;
++		count += c;
++		nbytes -= c;
++	}
++	
++fail:
++	if (written)
++		*written = count;
++	return retval;
++}
++
++errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset,
++			    int whence, __u64 *ret_pos)
++{
++	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
++
++	if (whence == EXT2_SEEK_SET)
++		file->pos = offset;
++	else if (whence == EXT2_SEEK_CUR)
++		file->pos += offset;
++	else if (whence == EXT2_SEEK_END)
++		file->pos = EXT2_I_SIZE(&file->inode) + offset;
++	else
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	if (ret_pos)
++		*ret_pos = file->pos;
++
++	return 0;
++}
++
++errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset,
++			    int whence, ext2_off_t *ret_pos)
++{
++	__u64		loffset, ret_loffset;
++	errcode_t	retval;
++	
++	loffset = offset;
++	retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset);
++	if (ret_pos)
++		*ret_pos = (ext2_off_t) ret_loffset;
++	return retval;
++}
++
++
++/*
++ * This function returns the size of the file, according to the inode
++ */
++errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size)
++{
++	if (file->magic != EXT2_ET_MAGIC_EXT2_FILE)
++		return EXT2_ET_MAGIC_EXT2_FILE;
++	*ret_size = EXT2_I_SIZE(&file->inode);
++	return 0;
++}
++
++/*
++ * This function returns the size of the file, according to the inode
++ */
++ext2_off_t ext2fs_file_get_size(ext2_file_t file)
++{
++	__u64	size;
++
++	if (ext2fs_file_get_lsize(file, &size))
++		return 0;
++	if ((size >> 32) != 0)
++		return 0;
++	return size;
++}
++
++/*
++ * This function sets the size of the file, truncating it if necessary
++ * 
++ * XXX still need to call truncate
++ */
++errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size)
++{
++	errcode_t	retval;
++	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
++	
++	file->inode.i_size = size;
++	file->inode.i_size_high = 0;
++	if (file->ino) {
++		retval = ext2fs_write_inode(file->fs, file->ino, &file->inode);
++		if (retval)
++			return retval;
++	}
++
++	/* 
++	 * XXX truncate inode if necessary
++	 */
++
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/finddev.c silo-1.4.11/libext2fs/finddev.c
+--- silo-1.4.11.orig/libext2fs/finddev.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/finddev.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,208 @@
++/*
++ * finddev.c -- this routine attempts to find a particular device in
++ * 	/dev
++ * 
++ * Copyright (C) 2000 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <stdlib.h>
++#include <string.h>
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#include <dirent.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#if HAVE_SYS_MKDEV_H
++#include <sys/mkdev.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct dir_list {
++	char	*name;
++	struct dir_list *next;
++};
++
++/*
++ * This function adds an entry to the directory list
++ */
++static void add_to_dirlist(const char *name, struct dir_list **list)
++{
++	struct dir_list *dp;
++
++	dp = malloc(sizeof(struct dir_list));
++	if (!dp)
++		return;
++	dp->name = malloc(strlen(name)+1);
++	if (!dp->name) {
++		free(dp);
++		return;
++	}
++	strcpy(dp->name, name);
++	dp->next = *list;
++	*list = dp;
++}
++
++/*
++ * This function frees a directory list
++ */
++static void free_dirlist(struct dir_list **list)
++{
++	struct dir_list *dp, *next;
++
++	for (dp = *list; dp; dp = next) {
++		next = dp->next;
++		free(dp->name);
++		free(dp);
++	}
++	*list = 0;
++}
++
++static int scan_dir(char *dirname, dev_t device, struct dir_list **list,
++		    char **ret_path)
++{
++	DIR	*dir;
++	struct dirent *dp;
++	char	path[1024], *cp;
++	int	dirlen;
++	struct stat st;
++
++	dirlen = strlen(dirname);
++	if ((dir = opendir(dirname)) == NULL)
++		return errno;
++	dp = readdir(dir);
++	while (dp) {
++		if (dirlen + strlen(dp->d_name) + 2 >= sizeof(path))
++			goto skip_to_next;
++		if (dp->d_name[0] == '.' &&
++		    ((dp->d_name[1] == 0) ||
++		     ((dp->d_name[1] == '.') && (dp->d_name[2] == 0))))
++			goto skip_to_next;
++		sprintf(path, "%s/%s", dirname, dp->d_name);
++		if (stat(path, &st) < 0)
++			goto skip_to_next;
++		if (S_ISDIR(st.st_mode))
++			add_to_dirlist(path, list);
++		if (S_ISBLK(st.st_mode) && st.st_rdev == device) {
++			cp = malloc(strlen(path)+1);
++			if (!cp) {
++				closedir(dir);
++				return ENOMEM;
++			}
++			strcpy(cp, path);
++			*ret_path = cp;
++			goto success;
++		}
++	skip_to_next:
++		dp = readdir(dir);
++	}
++success:
++	closedir(dir);
++	return 0;
++}
++
++/*
++ * This function finds the pathname to a block device with a given
++ * device number.  It returns a pointer to allocated memory to the
++ * pathname on success, and NULL on failure.
++ */
++char *ext2fs_find_block_device(dev_t device)
++{
++	struct dir_list *list = 0, *new_list = 0;
++	struct dir_list *current;
++	char	*ret_path = 0;
++
++	/*
++	 * Add the starting directories to search...
++	 */
++	add_to_dirlist("/devices", &list);
++	add_to_dirlist("/devfs", &list);
++	add_to_dirlist("/dev", &list);
++	
++	while (list) {
++		current = list;
++		list = list->next;
++#ifdef DEBUG
++		printf("Scanning directory %s\n", current->name);
++#endif
++		scan_dir(current->name, device, &new_list, &ret_path);
++		free(current->name);
++		free(current);
++		if (ret_path)
++			break;
++		/*
++		 * If we're done checking at this level, descend to
++		 * the next level of subdirectories. (breadth-first)
++		 */
++		if (list == 0) {
++			list = new_list;
++			new_list = 0;
++		}
++	}
++	free_dirlist(&list);
++	free_dirlist(&new_list);
++	return ret_path;
++}
++
++	
++#ifdef DEBUG
++int main(int argc, char** argv)
++{
++	char	*devname, *tmp;
++	int	major, minor;
++	dev_t	device;
++	const char *errmsg = "Couldn't parse %s: %s\n";
++
++	if ((argc != 2) && (argc != 3)) {
++		fprintf(stderr, "Usage: %s device_number\n", argv[0]);
++		fprintf(stderr, "\t: %s major minor\n", argv[0]);
++		exit(1);
++	}
++	if (argc == 2) {
++		device = strtoul(argv[1], &tmp, 0);
++		if (*tmp) {
++			fprintf(stderr, errmsg, "device number", argv[1]);
++			exit(1);
++		}
++	} else {
++		major = strtoul(argv[1], &tmp, 0);
++		if (*tmp) {
++			fprintf(stderr, errmsg, "major number", argv[1]);
++			exit(1);
++		}
++		minor = strtoul(argv[2], &tmp, 0);
++		if (*tmp) {
++			fprintf(stderr, errmsg, "minor number", argv[2]);
++			exit(1);
++		}
++		device = makedev(major, minor);
++		printf("Looking for device 0x%04x (%d:%d)\n", device,
++		       major, minor);
++	}
++	devname = ext2fs_find_block_device(device);
++	if (devname) {
++		printf("Found device!  %s\n", devname);
++		free(devname);
++	} else {
++		printf("Couldn't find device.\n");
++	}
++	return 0;
++}
++	
++#endif
+diff -Naur silo-1.4.11.orig/libext2fs/flushb.c silo-1.4.11/libext2fs/flushb.c
+--- silo-1.4.11.orig/libext2fs/flushb.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/flushb.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,82 @@
++/*
++ * flushb.c --- Hides system-dependent information for both syncing a
++ * 	device to disk and to flush any buffers from disk cache.
++ * 
++ * Copyright (C) 2000 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_SYS_IOCTL_H
++#include <sys/ioctl.h>
++#endif
++#if HAVE_SYS_MOUNT_H
++#include <sys/param.h>
++#include <sys/mount.h>		/* This may define BLKFLSBUF */
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since 
++ * not all portable header file does so for us.  This really should be
++ * fixed in the glibc header files.  (Recent glibcs appear to define
++ * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be
++ * defined anywhere portable.)  Until then....
++ */
++#ifdef __linux__
++#ifndef BLKFLSBUF
++#define BLKFLSBUF	_IO(0x12,97)	/* flush buffer cache */
++#endif
++#ifndef FDFLUSH
++#define FDFLUSH		_IO(2,0x4b)	/* flush floppy disk */
++#endif
++#endif
++
++/*
++ * This function will sync a device/file, and optionally attempt to
++ * flush the buffer cache.  The latter is basically only useful for
++ * system benchmarks and for torturing systems in burn-in tests.  :)
++ */
++errcode_t ext2fs_sync_device(int fd, int flushb)
++{
++	/*
++	 * We always sync the device in case we're running on old
++	 * kernels for which we can lose data if we don't.  (There
++	 * still is a race condition for those kernels, but this
++	 * reduces it greatly.)
++	 */
++	if (fsync (fd) == -1)
++		return errno;
++
++	if (flushb) {
++
++#ifdef BLKFLSBUF
++		if (ioctl (fd, BLKFLSBUF, 0) == 0)
++			return 0;
++#else
++#ifdef __GNUC__
++ #warning BLKFLSBUF not defined
++#endif /* __GNUC__ */
++#endif
++#ifdef FDFLUSH
++		ioctl (fd, FDFLUSH, 0);   /* In case this is a floppy */
++#else
++#ifdef __GNUC__
++ #warning FDFLUSH not defined
++#endif /* __GNUC__ */
++#endif
++	}
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/freefs.c silo-1.4.11/libext2fs/freefs.c
+--- silo-1.4.11.orig/libext2fs/freefs.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/freefs.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,147 @@
++/*
++ * freefs.c --- free an ext2 filesystem
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++static void ext2fs_free_inode_cache(struct ext2_inode_cache *icache);
++
++void ext2fs_free(ext2_filsys fs)
++{
++	if (!fs || (fs->magic != EXT2_ET_MAGIC_EXT2FS_FILSYS))
++		return;
++	if (fs->image_io != fs->io) {
++		if (fs->image_io)
++			io_channel_close(fs->image_io);
++	}
++	if (fs->io) {
++		io_channel_close(fs->io);
++	}
++	if (fs->device_name)
++		ext2fs_free_mem(&fs->device_name);
++	if (fs->super)
++		ext2fs_free_mem(&fs->super);
++	if (fs->orig_super)
++		ext2fs_free_mem(&fs->orig_super);
++	if (fs->group_desc)
++		ext2fs_free_mem(&fs->group_desc);
++	if (fs->block_map)
++		ext2fs_free_block_bitmap(fs->block_map);
++	if (fs->inode_map)
++		ext2fs_free_inode_bitmap(fs->inode_map);
++
++	if (fs->badblocks)
++		ext2fs_badblocks_list_free(fs->badblocks);
++	fs->badblocks = 0;
++
++	if (fs->dblist)
++		ext2fs_free_dblist(fs->dblist);
++
++	if (fs->icache)
++		ext2fs_free_inode_cache(fs->icache);
++	
++	fs->magic = 0;
++
++	ext2fs_free_mem(&fs);
++}
++
++void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap)
++{
++	if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_GENERIC_BITMAP))
++		return;
++
++	bitmap->magic = 0;
++	if (bitmap->description) {
++		ext2fs_free_mem(&bitmap->description);
++		bitmap->description = 0;
++	}
++	if (bitmap->bitmap) {
++		ext2fs_free_mem(&bitmap->bitmap);
++		bitmap->bitmap = 0;
++	}
++	ext2fs_free_mem(&bitmap);
++}
++
++void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap)
++{
++	if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_INODE_BITMAP))
++		return;
++
++	bitmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP;
++	ext2fs_free_generic_bitmap(bitmap);
++}
++
++void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap)
++{
++	if (!bitmap || (bitmap->magic != EXT2_ET_MAGIC_BLOCK_BITMAP))
++		return;
++
++	bitmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP;
++	ext2fs_free_generic_bitmap(bitmap);
++}
++
++/*
++ * Free the inode cache structure
++ */
++static void ext2fs_free_inode_cache(struct ext2_inode_cache *icache)
++{
++	if (--icache->refcount)
++		return;
++	if (icache->buffer)
++		ext2fs_free_mem(&icache->buffer);
++	if (icache->cache)
++		ext2fs_free_mem(&icache->cache);
++	icache->buffer_blk = 0;
++	ext2fs_free_mem(&icache);
++}
++
++/*
++ * This procedure frees a badblocks list.
++ */
++void ext2fs_u32_list_free(ext2_u32_list bb)
++{
++	if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST)
++		return;
++
++	if (bb->list)
++		ext2fs_free_mem(&bb->list);
++	bb->list = 0;
++	ext2fs_free_mem(&bb);
++}
++
++void ext2fs_badblocks_list_free(ext2_badblocks_list bb)
++{
++	ext2fs_u32_list_free((ext2_u32_list) bb);
++}
++
++
++/*
++ * Free a directory block list
++ */
++void ext2fs_free_dblist(ext2_dblist dblist)
++{
++	if (!dblist || (dblist->magic != EXT2_ET_MAGIC_DBLIST))
++		return;
++
++	if (dblist->list)
++		ext2fs_free_mem(&dblist->list);
++	dblist->list = 0;
++	if (dblist->fs && dblist->fs->dblist == dblist)
++		dblist->fs->dblist = 0;
++	dblist->magic = 0;
++	ext2fs_free_mem(&dblist);
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/gen_bitmap.c silo-1.4.11/libext2fs/gen_bitmap.c
+--- silo-1.4.11.orig/libext2fs/gen_bitmap.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/gen_bitmap.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,48 @@
++/*
++ * gen_bitmap.c --- Generic bitmap routines that used to be inlined.
++ * 
++ * Copyright (C) 2001 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
++					 __u32 bitno)
++{
++	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
++		ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno);
++		return 0;
++	}
++	return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap);
++}
++
++int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
++					   blk_t bitno)
++{
++	if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
++		ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno);
++		return 0;
++	}
++	return ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/get_pathname.c silo-1.4.11/libext2fs/get_pathname.c
+--- silo-1.4.11.orig/libext2fs/get_pathname.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/get_pathname.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,157 @@
++/*
++ * get_pathname.c --- do directry/inode -> name translation
++ * 
++ * Copyright (C) 1993, 1994, 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ *
++ * 	ext2fs_get_pathname(fs, dir, ino, name)
++ *
++ * 	This function translates takes two inode numbers into a
++ * 	string, placing the result in <name>.  <dir> is the containing
++ * 	directory inode, and <ino> is the inode number itself.  If
++ * 	<ino> is zero, then ext2fs_get_pathname will return pathname
++ * 	of the the directory <dir>.
++ * 
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct get_pathname_struct {
++	ext2_ino_t	search_ino;
++	ext2_ino_t	parent;
++	char		*name;
++	errcode_t	errcode;
++};
++
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int get_pathname_proc(struct ext2_dir_entry *dirent,
++			     int	offset EXT2FS_ATTR((unused)),
++			     int	blocksize EXT2FS_ATTR((unused)),
++			     char	*buf EXT2FS_ATTR((unused)),
++			     void	*priv_data)
++{
++	struct get_pathname_struct	*gp;
++	errcode_t			retval;
++
++	gp = (struct get_pathname_struct *) priv_data;
++
++	if (((dirent->name_len & 0xFF) == 2) &&
++	    !strncmp(dirent->name, "..", 2))
++		gp->parent = dirent->inode;
++	if (dirent->inode == gp->search_ino) {
++		retval = ext2fs_get_mem((dirent->name_len & 0xFF) + 1,
++					&gp->name);
++		if (retval) {
++			gp->errcode = retval;
++			return DIRENT_ABORT;
++		}
++		strncpy(gp->name, dirent->name, (dirent->name_len & 0xFF));
++		gp->name[dirent->name_len & 0xFF] = '\0';
++		return DIRENT_ABORT;
++	}
++	return 0;
++}
++
++static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, 
++					 ext2_ino_t ino, int maxdepth, 
++					 char *buf, char **name)
++{
++	struct get_pathname_struct gp;
++	char	*parent_name, *ret;
++	errcode_t	retval;
++
++	if (dir == ino) {
++		retval = ext2fs_get_mem(2, name);
++		if (retval)
++			return retval;
++		strcpy(*name, (dir == EXT2_ROOT_INO) ? "/" : ".");
++		return 0;
++	}
++
++	if (!dir || (maxdepth < 0)) {
++		retval = ext2fs_get_mem(4, name);
++		if (retval)
++			return retval;
++		strcpy(*name, "...");
++		return 0;
++	}
++
++	gp.search_ino = ino;
++	gp.parent = 0;
++	gp.name = 0;
++	gp.errcode = 0;
++	
++	retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp);
++	if (retval)
++		goto cleanup;
++	if (gp.errcode) {
++		retval = gp.errcode;
++		goto cleanup;
++	}
++
++	retval = ext2fs_get_pathname_int(fs, gp.parent, dir, maxdepth-1,
++					 buf, &parent_name);
++	if (retval)
++		goto cleanup;
++	if (!ino) {
++		*name = parent_name;
++		return 0;
++	}
++	
++	if (gp.name) 
++		retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2,
++					&ret);
++	else
++		retval = ext2fs_get_mem(strlen(parent_name)+5, &ret);
++	if (retval)
++		goto cleanup;
++	
++	ret[0] = 0;
++	if (parent_name[1])
++		strcat(ret, parent_name);
++	strcat(ret, "/");
++	if (gp.name)
++		strcat(ret, gp.name);
++	else
++		strcat(ret, "???");
++	*name = ret;
++	ext2fs_free_mem(&parent_name);
++	retval = 0;
++	
++cleanup:
++	if (gp.name)
++		ext2fs_free_mem(&gp.name);
++	return retval;
++}
++
++errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
++			      char **name)
++{
++	char	*buf;
++	errcode_t	retval;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	retval = ext2fs_get_mem(fs->blocksize, &buf);
++	if (retval)
++		return retval;
++	if (dir == ino)
++		ino = 0;
++	retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name);
++	ext2fs_free_mem(&buf);
++	return retval;
++	
++}
+diff -Naur silo-1.4.11.orig/libext2fs/getsectsize.c silo-1.4.11/libext2fs/getsectsize.c
+--- silo-1.4.11.orig/libext2fs/getsectsize.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/getsectsize.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,60 @@
++/*
++ * getsectsize.c --- get the sector size of a device.
++ * 
++ * Copyright (C) 1995, 1995 Theodore Ts'o.
++ * Copyright (C) 2003 VMware, Inc.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#define _LARGEFILE_SOURCE
++#define _LARGEFILE64_SOURCE
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <fcntl.h>
++#ifdef HAVE_LINUX_FD_H
++#include <sys/ioctl.h>
++#include <linux/fd.h>
++#endif
++
++#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET)
++#define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * Returns the number of blocks in a partition
++ */
++errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize)
++{
++	int	fd;
++
++#ifdef HAVE_OPEN64
++	fd = open64(file, O_RDONLY);
++#else
++	fd = open(file, O_RDONLY);
++#endif
++	if (fd < 0)
++		return errno;
++
++#ifdef BLKSSZGET
++	if (ioctl(fd, BLKSSZGET, sectsize) >= 0) {
++		close(fd);
++		return 0;
++	}
++#endif
++	*sectsize = 0;
++	close(fd);
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/getsize.c silo-1.4.11/libext2fs/getsize.c
+--- silo-1.4.11.orig/libext2fs/getsize.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/getsize.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,293 @@
++/*
++ * getsize.c --- get the size of a partition.
++ * 
++ * Copyright (C) 1995, 1995 Theodore Ts'o.
++ * Copyright (C) 2003 VMware, Inc.
++ *
++ * Windows version of ext2fs_get_device_size by Chris Li, VMware.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#define _LARGEFILE_SOURCE
++#define _LARGEFILE64_SOURCE
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <fcntl.h>
++#ifdef HAVE_SYS_IOCTL_H
++#include <sys/ioctl.h>
++#endif
++#ifdef HAVE_LINUX_FD_H
++#include <linux/fd.h>
++#endif
++#ifdef HAVE_SYS_DISKLABEL_H
++#include <sys/disklabel.h>
++#endif
++#ifdef HAVE_SYS_DISK_H
++#ifdef HAVE_SYS_QUEUE_H
++#include <sys/queue.h> /* for LIST_HEAD */
++#endif
++#include <sys/disk.h>
++#endif
++#ifdef __linux__
++#include <sys/utsname.h>
++#endif
++
++#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE)
++#define BLKGETSIZE _IO(0x12,96)	/* return device size */
++#endif
++
++#if defined(__linux__) && defined(_IOR) && !defined(BLKGETSIZE64)
++#define BLKGETSIZE64 _IOR(0x12,114,size_t)	/* return device size in bytes (u64 *arg) */
++#endif
++
++#ifdef APPLE_DARWIN
++#define BLKGETSIZE DKIOCGETBLOCKCOUNT32
++#endif /* APPLE_DARWIN */
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#if defined(__CYGWIN__) || defined (WIN32)
++#include "windows.h"
++#include "winioctl.h"
++
++#if (_WIN32_WINNT >= 0x0500)
++#define HAVE_GET_FILE_SIZE_EX 1
++#endif
++
++errcode_t ext2fs_get_device_size(const char *file, int blocksize,
++				 blk_t *retblocks)
++{
++	HANDLE dev;
++	PARTITION_INFORMATION pi;
++	DISK_GEOMETRY gi;
++	DWORD retbytes;
++#ifdef HAVE_GET_FILE_SIZE_EX
++	LARGE_INTEGER filesize;
++#else
++	DWORD filesize;
++#endif /* HAVE_GET_FILE_SIZE_EX */
++
++	dev = CreateFile(file, GENERIC_READ, 
++			 FILE_SHARE_READ | FILE_SHARE_WRITE ,
++                	 NULL,  OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,  NULL); 
++ 
++	if (dev == INVALID_HANDLE_VALUE)
++		return EBADF;
++	if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO,
++			    &pi, sizeof(PARTITION_INFORMATION),
++			    &pi, sizeof(PARTITION_INFORMATION),
++			    &retbytes, NULL)) {
++
++		*retblocks = pi.PartitionLength.QuadPart / blocksize;
++	
++	} else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY,
++				&gi, sizeof(DISK_GEOMETRY),
++				&gi, sizeof(DISK_GEOMETRY),
++				&retbytes, NULL)) {
++
++		*retblocks = gi.BytesPerSector *
++			     gi.SectorsPerTrack *
++			     gi.TracksPerCylinder *
++			     gi.Cylinders.QuadPart / blocksize;
++
++#ifdef HAVE_GET_FILE_SIZE_EX
++	} else if (GetFileSizeEx(dev, &filesize)) {
++		*retblocks = filesize.QuadPart / blocksize;
++	}
++#else
++	} else {
++		filesize = GetFileSize(dev, NULL);
++		if (INVALID_FILE_SIZE != filesize) {
++			*retblocks = filesize / blocksize;
++		}
++	}
++#endif /* HAVE_GET_FILE_SIZE_EX */
++
++	CloseHandle(dev);
++	return 0;
++}
++
++#else
++
++static int valid_offset (int fd, ext2_loff_t offset)
++{
++	char ch;
++
++	if (ext2fs_llseek (fd, offset, 0) < 0)
++		return 0;
++	if (read (fd, &ch, 1) < 1)
++		return 0;
++	return 1;
++}
++
++/*
++ * Returns the number of blocks in a partition
++ */
++errcode_t ext2fs_get_device_size(const char *file, int blocksize,
++				 blk_t *retblocks)
++{
++	int	fd;
++	int valid_blkgetsize64 = 1;
++#ifdef __linux__
++	struct 		utsname ut;
++#endif
++	unsigned long long size64;
++	unsigned long	size;
++	ext2_loff_t high, low;
++#ifdef FDGETPRM
++	struct floppy_struct this_floppy;
++#endif
++#ifdef HAVE_SYS_DISKLABEL_H
++	int part;
++	struct disklabel lab;
++	struct partition *pp;
++	char ch;
++#endif /* HAVE_SYS_DISKLABEL_H */
++
++#ifdef HAVE_OPEN64
++	fd = open64(file, O_RDONLY);
++#else
++	fd = open(file, O_RDONLY);
++#endif
++	if (fd < 0)
++		return errno;
++
++#ifdef DKIOCGETBLOCKCOUNT	/* For Apple Darwin */
++	if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size64) >= 0) {
++		if ((sizeof(*retblocks) < sizeof(unsigned long long))
++		    && ((size64 / (blocksize / 512)) > 0xFFFFFFFF))
++			return EFBIG;
++		close(fd);
++		*retblocks = size64 / (blocksize / 512);
++		return 0;
++	}
++#endif
++
++#ifdef BLKGETSIZE64
++#ifdef __linux__
++	if ((uname(&ut) == 0) &&
++	    ((ut.release[0] == '2') && (ut.release[1] == '.') &&
++	     (ut.release[2] < '6') && (ut.release[3] == '.')))
++		valid_blkgetsize64 = 0;
++#endif
++	if (valid_blkgetsize64 &&
++	    ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
++		if ((sizeof(*retblocks) < sizeof(unsigned long long))
++		    && ((size64 / blocksize) > 0xFFFFFFFF))
++			return EFBIG;
++		close(fd);
++		*retblocks = size64 / blocksize;
++		return 0;
++	}
++#endif
++
++#ifdef BLKGETSIZE
++	if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
++		close(fd);
++		*retblocks = size / (blocksize / 512);
++		return 0;
++	}
++#endif
++
++#ifdef FDGETPRM
++	if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) {
++		close(fd);
++		*retblocks = this_floppy.size / (blocksize / 512);
++		return 0;
++	}
++#endif
++
++#ifdef HAVE_SYS_DISKLABEL_H
++#if defined(DIOCGMEDIASIZE)
++	{
++	    off_t ms;
++	    u_int bs;
++	    if (ioctl(fd, DIOCGMEDIASIZE, &ms) >= 0) {
++		*retblocks = ms / blocksize;
++		return 0;
++	    }
++	}
++#elif defined(DIOCGDINFO)
++	/* old disklabel interface */
++	part = strlen(file) - 1;
++	if (part >= 0) {
++		ch = file[part];
++		if (isdigit(ch))
++			part = 0;
++		else if (ch >= 'a' && ch <= 'h')
++			part = ch - 'a';
++		else
++			part = -1;
++	}
++	if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
++		pp = &lab.d_partitions[part];
++		if (pp->p_size) {
++			close(fd);
++			*retblocks = pp->p_size / (blocksize / 512);
++			return 0;
++		}
++	}
++#endif /* defined(DIOCG*) */
++#endif /* HAVE_SYS_DISKLABEL_H */
++
++	/*
++	 * OK, we couldn't figure it out by using a specialized ioctl,
++	 * which is generally the best way.  So do binary search to
++	 * find the size of the partition.
++	 */
++	low = 0;
++	for (high = 1024; valid_offset (fd, high); high *= 2)
++		low = high;
++	while (low < high - 1)
++	{
++		const ext2_loff_t mid = (low + high) / 2;
++
++		if (valid_offset (fd, mid))
++			low = mid;
++		else
++			high = mid;
++	}
++	valid_offset (fd, 0);
++	close(fd);
++	size64 = low + 1;
++	if ((sizeof(*retblocks) < sizeof(unsigned long long))
++	    && ((size64 / blocksize) > 0xFFFFFFFF))
++		return EFBIG;
++	*retblocks = size64 / blocksize;
++	return 0;
++}
++
++#endif /* WIN32 */
++
++#ifdef DEBUG
++int main(int argc, char **argv)
++{
++	blk_t	blocks;
++	int	retval;
++	
++	if (argc < 2) {
++		fprintf(stderr, "Usage: %s device\n", argv[0]);
++		exit(1);
++	}
++
++	retval = ext2fs_get_device_size(argv[1], 1024, &blocks);
++	if (retval) {
++		com_err(argv[0], retval,
++			"while calling ext2fs_get_device_size");
++		exit(1);
++	}
++	printf("Device %s has %d 1k blocks.\n", argv[1], blocks);
++	exit(0);
++}
++#endif
+diff -Naur silo-1.4.11.orig/libext2fs/icount.c silo-1.4.11/libext2fs/icount.c
+--- silo-1.4.11.orig/libext2fs/icount.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/icount.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,483 @@
++/*
++ * icount.c --- an efficient inode count abstraction
++ *
++ * Copyright (C) 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <stdio.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * The data storage strategy used by icount relies on the observation
++ * that most inode counts are either zero (for non-allocated inodes),
++ * one (for most files), and only a few that are two or more
++ * (directories and files that are linked to more than one directory).
++ *
++ * Also, e2fsck tends to load the icount data sequentially.
++ *
++ * So, we use an inode bitmap to indicate which inodes have a count of
++ * one, and then use a sorted list to store the counts for inodes
++ * which are greater than one.
++ *
++ * We also use an optional bitmap to indicate which inodes are already
++ * in the sorted list, to speed up the use of this abstraction by
++ * e2fsck's pass 2.  Pass 2 increments inode counts as it finds them,
++ * so this extra bitmap avoids searching the sorted list to see if a
++ * particular inode is on the sorted list already.
++ */
++
++struct ext2_icount_el {
++	ext2_ino_t	ino;
++	__u16	count;
++};
++
++struct ext2_icount {
++	errcode_t		magic;
++	ext2fs_inode_bitmap	single;
++	ext2fs_inode_bitmap	multiple;
++	ext2_ino_t		count;
++	ext2_ino_t		size;
++	ext2_ino_t		num_inodes;
++	ext2_ino_t		cursor;
++	struct ext2_icount_el	*list;
++};
++
++void ext2fs_free_icount(ext2_icount_t icount)
++{
++	if (!icount)
++		return;
++
++	icount->magic = 0;
++	if (icount->list)
++		ext2fs_free_mem(&icount->list);
++	if (icount->single)
++		ext2fs_free_inode_bitmap(icount->single);
++	if (icount->multiple)
++		ext2fs_free_inode_bitmap(icount->multiple);
++	ext2fs_free_mem(&icount);
++}
++
++errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
++				ext2_icount_t hint, ext2_icount_t *ret)
++{
++	ext2_icount_t	icount;
++	errcode_t	retval;
++	size_t		bytes;
++	ext2_ino_t	i;
++
++	if (hint) {
++		EXT2_CHECK_MAGIC(hint, EXT2_ET_MAGIC_ICOUNT);
++		if (hint->size > size)
++			size = (size_t) hint->size;
++	}
++	
++	retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount);
++	if (retval)
++		return retval;
++	memset(icount, 0, sizeof(struct ext2_icount));
++
++	retval = ext2fs_allocate_inode_bitmap(fs, 0, 
++					      &icount->single);
++	if (retval)
++		goto errout;
++
++	if (flags & EXT2_ICOUNT_OPT_INCREMENT) {
++		retval = ext2fs_allocate_inode_bitmap(fs, 0, 
++						      &icount->multiple);
++		if (retval)
++			goto errout;
++	} else
++		icount->multiple = 0;
++
++	if (size) {
++		icount->size = size;
++	} else {
++		/*
++		 * Figure out how many special case inode counts we will
++		 * have.  We know we will need one for each directory;
++		 * we also need to reserve some extra room for file links
++		 */
++		retval = ext2fs_get_num_dirs(fs, &icount->size);
++		if (retval)
++			goto errout;
++		icount->size += fs->super->s_inodes_count / 50;
++	}
++	
++	bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el));
++#if 0
++	printf("Icount allocated %d entries, %d bytes.\n",
++	       icount->size, bytes);
++#endif
++	retval = ext2fs_get_mem(bytes, &icount->list);
++	if (retval)
++		goto errout;
++	memset(icount->list, 0, bytes);
++
++	icount->magic = EXT2_ET_MAGIC_ICOUNT;
++	icount->count = 0;
++	icount->cursor = 0;
++	icount->num_inodes = fs->super->s_inodes_count;
++
++	/*
++	 * Populate the sorted list with those entries which were
++	 * found in the hint icount (since those are ones which will
++	 * likely need to be in the sorted list this time around).
++	 */
++	if (hint) {
++		for (i=0; i < hint->count; i++)
++			icount->list[i].ino = hint->list[i].ino;
++		icount->count = hint->count;
++	}
++
++	*ret = icount;
++	return 0;
++
++errout:
++	ext2fs_free_icount(icount);
++	return(retval);
++}
++
++errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, 
++			       unsigned int size,
++			       ext2_icount_t *ret)
++{
++	return ext2fs_create_icount2(fs, flags, size, 0, ret);
++}
++
++/*
++ * insert_icount_el() --- Insert a new entry into the sorted list at a
++ * 	specified position.
++ */
++static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
++					    ext2_ino_t ino, int pos)
++{
++	struct ext2_icount_el 	*el;
++	errcode_t		retval;
++	ext2_ino_t			new_size = 0;
++	int			num;
++
++	if (icount->count >= icount->size) {
++		if (icount->count) {
++			new_size = icount->list[(unsigned)icount->count-1].ino;
++			new_size = (ext2_ino_t) (icount->count * 
++				((float) icount->num_inodes / new_size));
++		}
++		if (new_size < (icount->size + 100))
++			new_size = icount->size + 100;
++#if 0
++		printf("Reallocating icount %d entries...\n", new_size);
++#endif	
++		retval = ext2fs_resize_mem((size_t) icount->size *
++					   sizeof(struct ext2_icount_el),
++					   (size_t) new_size *
++					   sizeof(struct ext2_icount_el),
++					   &icount->list);
++		if (retval)
++			return 0;
++		icount->size = new_size;
++	}
++	num = (int) icount->count - pos;
++	if (num < 0)
++		return 0;	/* should never happen */
++	if (num) {
++		memmove(&icount->list[pos+1], &icount->list[pos],
++			sizeof(struct ext2_icount_el) * num);
++	}
++	icount->count++;
++	el = &icount->list[pos];
++	el->count = 0;
++	el->ino = ino;
++	return el;
++}
++
++/*
++ * get_icount_el() --- given an inode number, try to find icount
++ * 	information in the sorted list.  If the create flag is set,
++ * 	and we can't find an entry, create one in the sorted list.
++ */
++static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
++					    ext2_ino_t ino, int create)
++{
++	float	range;
++	int	low, high, mid;
++	ext2_ino_t	lowval, highval;
++
++	if (!icount || !icount->list)
++		return 0;
++
++	if (create && ((icount->count == 0) ||
++		       (ino > icount->list[(unsigned)icount->count-1].ino))) {
++		return insert_icount_el(icount, ino, (unsigned) icount->count);
++	}
++	if (icount->count == 0)
++		return 0;
++	
++	if (icount->cursor >= icount->count)
++		icount->cursor = 0;
++	if (ino == icount->list[icount->cursor].ino)
++		return &icount->list[icount->cursor++];
++#if 0
++	printf("Non-cursor get_icount_el: %u\n", ino);
++#endif
++	low = 0;
++	high = (int) icount->count-1;
++	while (low <= high) {
++#if 0
++		mid = (low+high)/2;
++#else
++		if (low == high)
++			mid = low;
++		else {
++			/* Interpolate for efficiency */
++			lowval = icount->list[low].ino;
++			highval = icount->list[high].ino;
++
++			if (ino < lowval)
++				range = 0;
++			else if (ino > highval)
++				range = 1;
++			else 
++				range = ((float) (ino - lowval)) /
++					(highval - lowval);
++			mid = low + ((int) (range * (high-low)));
++		}
++#endif
++		if (ino == icount->list[mid].ino) {
++			icount->cursor = mid+1;
++			return &icount->list[mid];
++		}
++		if (ino < icount->list[mid].ino)
++			high = mid-1;
++		else
++			low = mid+1;
++	}
++	/*
++	 * If we need to create a new entry, it should be right at
++	 * low (where high will be left at low-1).
++	 */
++	if (create)
++		return insert_icount_el(icount, ino, low);
++	return 0;
++}
++
++errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out)
++{
++	errcode_t	ret = 0;
++	unsigned int	i;
++	const char *bad = "bad icount";
++	
++	EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
++
++	if (icount->count > icount->size) {
++		fprintf(out, "%s: count > size\n", bad);
++		return EXT2_ET_INVALID_ARGUMENT;
++	}
++	for (i=1; i < icount->count; i++) {
++		if (icount->list[i-1].ino >= icount->list[i].ino) {
++			fprintf(out, "%s: list[%d].ino=%u, list[%d].ino=%u\n",
++				bad, i-1, icount->list[i-1].ino,
++				i, icount->list[i].ino);
++			ret = EXT2_ET_INVALID_ARGUMENT;
++		}
++	}
++	return ret;
++}
++
++errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret)
++{
++	struct ext2_icount_el	*el;
++	
++	EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
++
++	if (!ino || (ino > icount->num_inodes))
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	if (ext2fs_test_inode_bitmap(icount->single, ino)) {
++		*ret = 1;
++		return 0;
++	}
++	if (icount->multiple &&
++	    !ext2fs_test_inode_bitmap(icount->multiple, ino)) {
++		*ret = 0;
++		return 0;
++	}
++	el = get_icount_el(icount, ino, 0);
++	if (!el) {
++		*ret = 0;
++		return 0;
++	}
++	*ret = el->count;
++	return 0;
++}
++
++errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
++				  __u16 *ret)
++{
++	struct ext2_icount_el	*el;
++
++	EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
++
++	if (!ino || (ino > icount->num_inodes))
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	if (ext2fs_test_inode_bitmap(icount->single, ino)) {
++		/*
++		 * If the existing count is 1, then we know there is
++		 * no entry in the list.
++		 */
++		el = get_icount_el(icount, ino, 1);
++		if (!el)
++			return EXT2_ET_NO_MEMORY;
++		ext2fs_unmark_inode_bitmap(icount->single, ino);
++		el->count = 2;
++	} else if (icount->multiple) {
++		/*
++		 * The count is either zero or greater than 1; if the
++		 * inode is set in icount->multiple, then there should
++		 * be an entry in the list, so find it using
++		 * get_icount_el().
++		 */
++		if (ext2fs_test_inode_bitmap(icount->multiple, ino)) {
++			el = get_icount_el(icount, ino, 1);
++			if (!el)
++				return EXT2_ET_NO_MEMORY;
++			el->count++;
++		} else {
++			/*
++			 * The count was zero; mark the single bitmap
++			 * and return.
++			 */
++		zero_count:
++			ext2fs_mark_inode_bitmap(icount->single, ino);
++			if (ret)
++				*ret = 1;
++			return 0;
++		}
++	} else {
++		/*
++		 * The count is either zero or greater than 1; try to
++		 * find an entry in the list to determine which.
++		 */
++		el = get_icount_el(icount, ino, 0);
++		if (!el) {
++			/* No entry means the count was zero */
++			goto zero_count;
++		}
++		el = get_icount_el(icount, ino, 1);
++		if (!el)
++			return EXT2_ET_NO_MEMORY;
++		el->count++;
++	}
++	if (icount->multiple)
++		ext2fs_mark_inode_bitmap(icount->multiple, ino);
++	if (ret)
++		*ret = el->count;
++	return 0;
++}
++
++errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
++				  __u16 *ret)
++{
++	struct ext2_icount_el	*el;
++
++	if (!ino || (ino > icount->num_inodes))
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
++
++	if (ext2fs_test_inode_bitmap(icount->single, ino)) {
++		ext2fs_unmark_inode_bitmap(icount->single, ino);
++		if (icount->multiple)
++			ext2fs_unmark_inode_bitmap(icount->multiple, ino);
++		else {
++			el = get_icount_el(icount, ino, 0);
++			if (el)
++				el->count = 0;
++		}
++		if (ret)
++			*ret = 0;
++		return 0;
++	}
++
++	if (icount->multiple &&
++	    !ext2fs_test_inode_bitmap(icount->multiple, ino))
++		return EXT2_ET_INVALID_ARGUMENT;
++	
++	el = get_icount_el(icount, ino, 0);
++	if (!el || el->count == 0)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	el->count--;
++	if (el->count == 1)
++		ext2fs_mark_inode_bitmap(icount->single, ino);
++	if ((el->count == 0) && icount->multiple)
++		ext2fs_unmark_inode_bitmap(icount->multiple, ino);
++
++	if (ret)
++		*ret = el->count;
++	return 0;
++}
++
++errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
++			      __u16 count)
++{
++	struct ext2_icount_el	*el;
++
++	if (!ino || (ino > icount->num_inodes))
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT);
++
++	if (count == 1) {
++		ext2fs_mark_inode_bitmap(icount->single, ino);
++		if (icount->multiple)
++			ext2fs_unmark_inode_bitmap(icount->multiple, ino);
++		return 0;
++	}
++	if (count == 0) {
++		ext2fs_unmark_inode_bitmap(icount->single, ino);
++		if (icount->multiple) {
++			/*
++			 * If the icount->multiple bitmap is enabled,
++			 * we can just clear both bitmaps and we're done
++			 */
++			ext2fs_unmark_inode_bitmap(icount->multiple, ino);
++		} else {
++			el = get_icount_el(icount, ino, 0);
++			if (el)
++				el->count = 0;
++		}
++		return 0;
++	}
++
++	/*
++	 * Get the icount element
++	 */
++	el = get_icount_el(icount, ino, 1);
++	if (!el)
++		return EXT2_ET_NO_MEMORY;
++	el->count = count;
++	ext2fs_unmark_inode_bitmap(icount->single, ino);
++	if (icount->multiple)
++		ext2fs_mark_inode_bitmap(icount->multiple, ino);
++	return 0;
++}
++
++ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount)
++{
++	if (!icount || icount->magic != EXT2_ET_MAGIC_ICOUNT)
++		return 0;
++
++	return icount->size;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/imager.c silo-1.4.11/libext2fs/imager.c
+--- silo-1.4.11.orig/libext2fs/imager.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/imager.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,387 @@
++/*
++ * image.c --- writes out the critical parts of the filesystem as a
++ * 	flat file.
++ *
++ * Copyright (C) 2000 Theodore Ts'o.
++ *
++ * Note: this uses the POSIX IO interfaces, unlike most of the other
++ * functions in this library.  So sue me.  
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#ifndef HAVE_TYPE_SSIZE_T
++typedef int ssize_t;
++#endif
++
++/*
++ * This function returns 1 if the specified block is all zeros
++ */
++static int check_zero_block(char *buf, int blocksize)
++{
++	char	*cp = buf;
++	int	left = blocksize;
++
++	while (left > 0) {
++		if (*cp++)
++			return 0;
++		left--;
++	}
++	return 1;
++}
++
++/*
++ * Write the inode table out as a single block.
++ */
++#define BUF_BLOCKS	32
++
++errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags)
++{
++	unsigned int	group, left, c, d;
++	char		*buf, *cp;
++	blk_t		blk;
++	ssize_t		actual;
++	errcode_t	retval;
++
++	buf = malloc(fs->blocksize * BUF_BLOCKS);
++	if (!buf)
++		return ENOMEM;
++	
++	for (group = 0; group < fs->group_desc_count; group++) {
++		blk = fs->group_desc[(unsigned)group].bg_inode_table;
++		if (!blk)
++			return EXT2_ET_MISSING_INODE_TABLE;
++		left = fs->inode_blocks_per_group;
++		while (left) {
++			c = BUF_BLOCKS;
++			if (c > left)
++				c = left;
++			retval = io_channel_read_blk(fs->io, blk, c, buf);
++			if (retval)
++				goto errout;
++			cp = buf;
++			while (c) {
++				if (!(flags & IMAGER_FLAG_SPARSEWRITE)) {
++					d = c;
++					goto skip_sparse;
++				}
++				/* Skip zero blocks */
++				if (check_zero_block(cp, fs->blocksize)) {
++					c--;
++					blk++;
++					left--;
++					cp += fs->blocksize;
++					lseek(fd, fs->blocksize, SEEK_CUR);
++					continue;
++				}
++				/* Find non-zero blocks */
++				for (d=1; d < c; d++) {
++					if (check_zero_block(cp + d*fs->blocksize, fs->blocksize))
++						break;
++				}
++			skip_sparse:
++				actual = write(fd, cp, fs->blocksize * d);
++				if (actual == -1) {
++					retval = errno;
++					goto errout;
++				}
++				if (actual != (ssize_t) (fs->blocksize * d)) {
++					retval = EXT2_ET_SHORT_WRITE;
++					goto errout;
++				}
++				blk += d;
++				left -= d;
++				cp += fs->blocksize * d;
++				c -= d;
++			}
++		}
++	}
++	retval = 0;
++
++errout:
++	free(buf);
++	return retval;
++}
++
++/*
++ * Read in the inode table and stuff it into place
++ */
++errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, 
++				  int flags EXT2FS_ATTR((unused)))
++{
++	unsigned int	group, c, left;
++	char		*buf;
++	blk_t		blk;
++	ssize_t		actual;
++	errcode_t	retval;
++
++	buf = malloc(fs->blocksize * BUF_BLOCKS);
++	if (!buf)
++		return ENOMEM;
++	
++	for (group = 0; group < fs->group_desc_count; group++) {
++		blk = fs->group_desc[(unsigned)group].bg_inode_table;
++		if (!blk) {
++			retval = EXT2_ET_MISSING_INODE_TABLE;
++			goto errout;
++		}
++		left = fs->inode_blocks_per_group;
++		while (left) {
++			c = BUF_BLOCKS;
++			if (c > left)
++				c = left;
++			actual = read(fd, buf, fs->blocksize * c);
++			if (actual == -1) {
++				retval = errno;
++				goto errout;
++			}
++			if (actual != (ssize_t) (fs->blocksize * c)) {
++				retval = EXT2_ET_SHORT_READ;
++				goto errout;
++			}
++			retval = io_channel_write_blk(fs->io, blk, c, buf);
++			if (retval)
++				goto errout;
++			
++			blk += c;
++			left -= c;
++		}
++	}
++	retval = ext2fs_flush_icache(fs);
++
++errout:
++	free(buf);
++	return retval;
++}
++
++/*
++ * Write out superblock and group descriptors
++ */
++errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, 
++				   int flags EXT2FS_ATTR((unused)))
++{
++	char		*buf, *cp;
++	ssize_t		actual;
++	errcode_t	retval;
++
++	buf = malloc(fs->blocksize);
++	if (!buf)
++		return ENOMEM;
++
++	/*
++	 * Write out the superblock
++	 */
++	memset(buf, 0, fs->blocksize);
++	memcpy(buf, fs->super, SUPERBLOCK_SIZE);
++	actual = write(fd, buf, fs->blocksize);
++	if (actual == -1) {
++		retval = errno;
++		goto errout;
++	}
++	if (actual != (ssize_t) fs->blocksize) {
++		retval = EXT2_ET_SHORT_WRITE;
++		goto errout;
++	}
++
++	/*
++	 * Now write out the block group descriptors
++	 */
++	cp = (char *) fs->group_desc;
++	actual = write(fd, cp, fs->blocksize * fs->desc_blocks);
++	if (actual == -1) {
++		retval = errno;
++		goto errout;
++	}
++	if (actual != (ssize_t) (fs->blocksize * fs->desc_blocks)) {
++		retval = EXT2_ET_SHORT_WRITE;
++		goto errout;
++	}
++	
++	retval = 0;
++
++errout:
++	free(buf);
++	return retval;
++}
++
++/*
++ * Read the superblock and group descriptors and overwrite them.
++ */
++errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, 
++				  int flags EXT2FS_ATTR((unused)))
++{
++	char		*buf;
++	ssize_t		actual, size;
++	errcode_t	retval;
++
++	size = fs->blocksize * (fs->group_desc_count + 1);
++	buf = malloc(size);
++	if (!buf)
++		return ENOMEM;
++
++	/*
++	 * Read it all in.
++	 */
++	actual = read(fd, buf, size);
++	if (actual == -1) {
++		retval = errno;
++		goto errout;
++	}
++	if (actual != size) {
++		retval = EXT2_ET_SHORT_READ;
++		goto errout;
++	}
++
++	/*
++	 * Now copy in the superblock and group descriptors
++	 */
++	memcpy(fs->super, buf, SUPERBLOCK_SIZE);
++
++	memcpy(fs->group_desc, buf + fs->blocksize,
++	       fs->blocksize * fs->group_desc_count);
++
++	retval = 0;
++
++errout:
++	free(buf);
++	return retval;
++}
++
++/*
++ * Write the block/inode bitmaps.
++ */
++errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
++{
++	char		*ptr;
++	int		c, size;
++	char		zero_buf[1024];
++	ssize_t		actual;
++	errcode_t	retval;
++
++	if (flags & IMAGER_FLAG_INODEMAP) {
++		if (!fs->inode_map) {
++			retval = ext2fs_read_inode_bitmap(fs);
++			if (retval)
++				return retval;
++		}
++		ptr = fs->inode_map->bitmap;
++		size = (EXT2_INODES_PER_GROUP(fs->super) / 8);
++	} else {
++		if (!fs->block_map) {
++			retval = ext2fs_read_block_bitmap(fs);
++			if (retval)
++				return retval;
++		}
++		ptr = fs->block_map->bitmap;
++		size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
++	}
++	size = size * fs->group_desc_count;
++
++	actual = write(fd, ptr, size);
++	if (actual == -1) {
++		retval = errno;
++		goto errout;
++	}
++	if (actual != size) {
++		retval = EXT2_ET_SHORT_WRITE;
++		goto errout;
++	}
++	size = size % fs->blocksize;
++	memset(zero_buf, 0, sizeof(zero_buf));
++	if (size) {
++		size = fs->blocksize - size;
++		while (size) {
++			c = size;
++			if (c > (int) sizeof(zero_buf))
++				c = sizeof(zero_buf);
++			actual = write(fd, zero_buf, c);
++			if (actual == -1) {
++				retval = errno;
++				goto errout;
++			}
++			if (actual != c) {
++				retval = EXT2_ET_SHORT_WRITE;
++				goto errout;
++			}
++			size -= c;
++		}
++	}
++	retval = 0;
++errout:
++	return (retval);
++}
++
++
++/*
++ * Read the block/inode bitmaps.
++ */
++errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
++{
++	char		*ptr, *buf = 0;
++	int		size;
++	ssize_t		actual;
++	errcode_t	retval;
++
++	if (flags & IMAGER_FLAG_INODEMAP) {
++		if (!fs->inode_map) {
++			retval = ext2fs_read_inode_bitmap(fs);
++			if (retval)
++				return retval;
++		}
++		ptr = fs->inode_map->bitmap;
++		size = (EXT2_INODES_PER_GROUP(fs->super) / 8);
++	} else {
++		if (!fs->block_map) {
++			retval = ext2fs_read_block_bitmap(fs);
++			if (retval)
++				return retval;
++		}
++		ptr = fs->block_map->bitmap;
++		size = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
++	}
++	size = size * fs->group_desc_count;
++
++	buf = malloc(size);
++	if (!buf)
++		return ENOMEM;
++
++	actual = read(fd, buf, size);
++	if (actual == -1) {
++		retval = errno;
++		goto errout;
++	}
++	if (actual != size) {
++		retval = EXT2_ET_SHORT_WRITE;
++		goto errout;
++	}
++	memcpy(ptr, buf, size);
++	
++	retval = 0;
++errout:
++	if (buf)
++		free(buf);
++	return (retval);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/ind_block.c silo-1.4.11/libext2fs/ind_block.c
+--- silo-1.4.11.orig/libext2fs/ind_block.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ind_block.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,66 @@
++/*
++ * ind_block.c --- indirect block I/O routines
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 
++ * 	2001, 2002, 2003, 2004, 2005 by  Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf)
++{
++	errcode_t	retval;
++	blk_t		*block_nr;
++	int		i;
++	int		limit = fs->blocksize >> 2;
++
++	if ((fs->flags & EXT2_FLAG_IMAGE_FILE) &&
++	    (fs->io != fs->image_io))
++		memset(buf, 0, fs->blocksize);
++	else {
++		retval = io_channel_read_blk(fs->io, blk, 1, buf);
++		if (retval)
++			return retval;
++	}
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_READ)) {
++		block_nr = (blk_t *) buf;
++		for (i = 0; i < limit; i++, block_nr++)
++			*block_nr = ext2fs_swab32(*block_nr);
++	}
++#endif
++	return 0;
++}
++
++errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf)
++{
++	blk_t		*block_nr;
++	int		i;
++	int		limit = fs->blocksize >> 2;
++
++	if (fs->flags & EXT2_FLAG_IMAGE_FILE)
++		return 0;
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if (fs->flags & (EXT2_FLAG_SWAP_BYTES | EXT2_FLAG_SWAP_BYTES_WRITE)) {
++		block_nr = (blk_t *) buf;
++		for (i = 0; i < limit; i++, block_nr++)
++			*block_nr = ext2fs_swab32(*block_nr);
++	}
++#endif
++	return io_channel_write_blk(fs->io, blk, 1, buf);
++}
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/initialize.c silo-1.4.11/libext2fs/initialize.c
+--- silo-1.4.11.orig/libext2fs/initialize.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/initialize.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,387 @@
++/*
++ * initialize.c --- initialize a filesystem handle given superblock
++ * 	parameters.  Used by mke2fs when initializing a filesystem.
++ * 
++ * Copyright (C) 1994, 1995, 1996 Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#if defined(__linux__)    &&	defined(EXT2_OS_LINUX)
++#define CREATOR_OS EXT2_OS_LINUX
++#else
++#if defined(__GNU__)     &&	defined(EXT2_OS_HURD)
++#define CREATOR_OS EXT2_OS_HURD
++#else
++#if defined(__FreeBSD__) &&	defined(EXT2_OS_FREEBSD)
++#define CREATOR_OS EXT2_OS_FREEBSD
++#else
++#if defined(LITES) 	   &&	defined(EXT2_OS_LITES)
++#define CREATOR_OS EXT2_OS_LITES
++#else
++#define CREATOR_OS EXT2_OS_LINUX /* by default */
++#endif /* defined(LITES) && defined(EXT2_OS_LITES) */
++#endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */
++#endif /* defined(__GNU__)     && defined(EXT2_OS_HURD) */
++#endif /* defined(__linux__)   && defined(EXT2_OS_LINUX) */
++	
++/*
++ * Note we override the kernel include file's idea of what the default
++ * check interval (never) should be.  It's a good idea to check at
++ * least *occasionally*, specially since servers will never rarely get
++ * to reboot, since Linux is so robust these days.  :-)
++ * 
++ * 180 days (six months) seems like a good value.
++ */
++#ifdef EXT2_DFL_CHECKINTERVAL
++#undef EXT2_DFL_CHECKINTERVAL
++#endif
++#define EXT2_DFL_CHECKINTERVAL (86400L * 180L)
++
++/*
++ * Calculate the number of GDT blocks to reserve for online filesystem growth.
++ * The absolute maximum number of GDT blocks we can reserve is determined by
++ * the number of block pointers that can fit into a single block.
++ */
++static int calc_reserved_gdt_blocks(ext2_filsys fs)
++{
++	struct ext2_super_block *sb = fs->super;
++	unsigned long bpg = sb->s_blocks_per_group;
++	unsigned int gdpb = fs->blocksize / sizeof(struct ext2_group_desc);
++	unsigned long max_blocks = 0xffffffff;
++	unsigned long rsv_groups;
++	int rsv_gdb;
++
++	/* We set it at 1024x the current filesystem size, or
++	 * the upper block count limit (2^32), whichever is lower.
++	 */
++	if (sb->s_blocks_count < max_blocks / 1024)
++		max_blocks = sb->s_blocks_count * 1024;
++	rsv_groups = (max_blocks - sb->s_first_data_block + bpg - 1) / bpg;
++	rsv_gdb = (rsv_groups + gdpb - 1) / gdpb - fs->desc_blocks;
++	if (rsv_gdb > EXT2_ADDR_PER_BLOCK(sb))
++		rsv_gdb = EXT2_ADDR_PER_BLOCK(sb);
++#ifdef RES_GDT_DEBUG
++	printf("max_blocks %lu, rsv_groups = %lu, rsv_gdb = %lu\n",
++	       max_blocks, rsv_groups, rsv_gdb);
++#endif
++
++	return rsv_gdb;
++}
++
++errcode_t ext2fs_initialize(const char *name, int flags,
++			    struct ext2_super_block *param,
++			    io_manager manager, ext2_filsys *ret_fs)
++{
++	ext2_filsys	fs;
++	errcode_t	retval;
++	struct ext2_super_block *super;
++	int		frags_per_block;
++	unsigned int	rem;
++	unsigned int	overhead = 0;
++	blk_t		group_block;
++	unsigned int	ipg;
++	dgrp_t		i;
++	blk_t		numblocks;
++	int		rsv_gdt;
++	char		*buf;
++
++	if (!param || !param->s_blocks_count)
++		return EXT2_ET_INVALID_ARGUMENT;
++	
++	retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
++	if (retval)
++		return retval;
++	
++	memset(fs, 0, sizeof(struct struct_ext2_filsys));
++	fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
++	fs->flags = flags | EXT2_FLAG_RW;
++	fs->umask = 022;
++#ifdef WORDS_BIGENDIAN
++	fs->flags |= EXT2_FLAG_SWAP_BYTES;
++#endif
++	retval = manager->open(name, IO_FLAG_RW, &fs->io);
++	if (retval)
++		goto cleanup;
++	fs->image_io = fs->io;
++	fs->io->app_data = fs;
++	retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name);
++	if (retval)
++		goto cleanup;
++
++	strcpy(fs->device_name, name);
++	retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &super);
++	if (retval)
++		goto cleanup;
++	fs->super = super;
++
++	memset(super, 0, SUPERBLOCK_SIZE);
++
++#define set_field(field, default) (super->field = param->field ? \
++				   param->field : (default))
++
++	super->s_magic = EXT2_SUPER_MAGIC;
++	super->s_state = EXT2_VALID_FS;
++
++	set_field(s_log_block_size, 0);	/* default blocksize: 1024 bytes */
++	set_field(s_log_frag_size, 0); /* default fragsize: 1024 bytes */
++	set_field(s_first_data_block, super->s_log_block_size ? 0 : 1);
++	set_field(s_max_mnt_count, EXT2_DFL_MAX_MNT_COUNT);
++	set_field(s_errors, EXT2_ERRORS_DEFAULT);
++	set_field(s_feature_compat, 0);
++	set_field(s_feature_incompat, 0);
++	set_field(s_feature_ro_compat, 0);
++	set_field(s_first_meta_bg, 0);
++	if (super->s_feature_incompat & ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
++		retval = EXT2_ET_UNSUPP_FEATURE;
++		goto cleanup;
++	}
++	if (super->s_feature_ro_compat & ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP) {
++		retval = EXT2_ET_RO_UNSUPP_FEATURE;
++		goto cleanup;
++	}
++
++	set_field(s_rev_level, EXT2_GOOD_OLD_REV);
++	if (super->s_rev_level >= EXT2_DYNAMIC_REV) {
++		set_field(s_first_ino, EXT2_GOOD_OLD_FIRST_INO);
++		set_field(s_inode_size, EXT2_GOOD_OLD_INODE_SIZE);
++	}
++
++	set_field(s_checkinterval, EXT2_DFL_CHECKINTERVAL);
++	super->s_mkfs_time = super->s_lastcheck = time(NULL);
++
++	super->s_creator_os = CREATOR_OS;
++
++	fs->blocksize = EXT2_BLOCK_SIZE(super);
++	fs->fragsize = EXT2_FRAG_SIZE(super);
++	frags_per_block = fs->blocksize / fs->fragsize;
++
++	/* default: (fs->blocksize*8) blocks/group, up to 2^16 (GDT limit) */
++	set_field(s_blocks_per_group, fs->blocksize * 8);
++	if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super))
++		super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super);
++	super->s_frags_per_group = super->s_blocks_per_group * frags_per_block;
++	
++	super->s_blocks_count = param->s_blocks_count;
++	super->s_r_blocks_count = param->s_r_blocks_count;
++	if (super->s_r_blocks_count >= param->s_blocks_count) {
++		retval = EXT2_ET_INVALID_ARGUMENT;
++		goto cleanup;
++	}
++
++	/*
++	 * If we're creating an external journal device, we don't need
++	 * to bother with the rest.
++	 */
++	if (super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
++		fs->group_desc_count = 0;
++		ext2fs_mark_super_dirty(fs);
++		*ret_fs = fs;
++		return 0;
++	}
++
++retry:
++	fs->group_desc_count = (super->s_blocks_count -
++				super->s_first_data_block +
++				EXT2_BLOCKS_PER_GROUP(super) - 1)
++		/ EXT2_BLOCKS_PER_GROUP(super);
++	if (fs->group_desc_count == 0) {
++		retval = EXT2_ET_TOOSMALL;
++		goto cleanup;
++	}
++	fs->desc_blocks = (fs->group_desc_count +
++			   EXT2_DESC_PER_BLOCK(super) - 1)
++		/ EXT2_DESC_PER_BLOCK(super);
++
++	i = fs->blocksize >= 4096 ? 1 : 4096 / fs->blocksize;
++	set_field(s_inodes_count, super->s_blocks_count / i);
++
++	/*
++	 * Make sure we have at least EXT2_FIRST_INO + 1 inodes, so
++	 * that we have enough inodes for the filesystem(!)
++	 */
++	if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1)
++		super->s_inodes_count = EXT2_FIRST_INODE(super)+1;
++	
++	/*
++	 * There should be at least as many inodes as the user
++	 * requested.  Figure out how many inodes per group that
++	 * should be.  But make sure that we don't allocate more than
++	 * one bitmap's worth of inodes each group.
++	 */
++	ipg = (super->s_inodes_count + fs->group_desc_count - 1) /
++		fs->group_desc_count;
++	if (ipg > fs->blocksize * 8) {
++		if (super->s_blocks_per_group >= 256) {
++			/* Try again with slightly different parameters */
++			super->s_blocks_per_group -= 8;
++			super->s_blocks_count = param->s_blocks_count;
++			super->s_frags_per_group = super->s_blocks_per_group *
++				frags_per_block;
++			goto retry;
++		} else
++			return EXT2_ET_TOO_MANY_INODES;
++	}
++
++	if (ipg > (unsigned) EXT2_MAX_INODES_PER_GROUP(super))
++		ipg = EXT2_MAX_INODES_PER_GROUP(super);
++
++	super->s_inodes_per_group = ipg;
++	if (super->s_inodes_count > ipg * fs->group_desc_count)
++		super->s_inodes_count = ipg * fs->group_desc_count;
++
++	/*
++	 * Make sure the number of inodes per group completely fills
++	 * the inode table blocks in the descriptor.  If not, add some
++	 * additional inodes/group.  Waste not, want not...
++	 */
++	fs->inode_blocks_per_group = (((super->s_inodes_per_group *
++					EXT2_INODE_SIZE(super)) +
++				       EXT2_BLOCK_SIZE(super) - 1) /
++				      EXT2_BLOCK_SIZE(super));
++	super->s_inodes_per_group = ((fs->inode_blocks_per_group *
++				      EXT2_BLOCK_SIZE(super)) /
++				     EXT2_INODE_SIZE(super));
++	/*
++	 * Finally, make sure the number of inodes per group is a
++	 * multiple of 8.  This is needed to simplify the bitmap
++	 * splicing code.
++	 */
++	super->s_inodes_per_group &= ~7;
++	fs->inode_blocks_per_group = (((super->s_inodes_per_group *
++					EXT2_INODE_SIZE(super)) +
++				       EXT2_BLOCK_SIZE(super) - 1) /
++				      EXT2_BLOCK_SIZE(super));
++
++	/*
++	 * adjust inode count to reflect the adjusted inodes_per_group
++	 */
++	super->s_inodes_count = super->s_inodes_per_group *
++		fs->group_desc_count;
++	super->s_free_inodes_count = super->s_inodes_count;
++
++	/*
++	 * check the number of reserved group descriptor table blocks
++	 */
++	if (super->s_feature_compat & EXT2_FEATURE_COMPAT_RESIZE_INODE)
++		rsv_gdt = calc_reserved_gdt_blocks(fs);
++	else
++		rsv_gdt = 0;
++	set_field(s_reserved_gdt_blocks, rsv_gdt);
++	if (super->s_reserved_gdt_blocks > EXT2_ADDR_PER_BLOCK(super)) {
++		retval = EXT2_ET_RES_GDT_BLOCKS;
++		goto cleanup;
++	}
++
++	/*
++	 * Overhead is the number of bookkeeping blocks per group.  It
++	 * includes the superblock backup, the group descriptor
++	 * backups, the inode bitmap, the block bitmap, and the inode
++	 * table.
++	 */
++
++	overhead = (int) (2 + fs->inode_blocks_per_group);
++
++	if (ext2fs_bg_has_super(fs, fs->group_desc_count - 1))
++		overhead += 1 + fs->desc_blocks + super->s_reserved_gdt_blocks;
++
++	/* This can only happen if the user requested too many inodes */
++	if (overhead > super->s_blocks_per_group)
++		return EXT2_ET_TOO_MANY_INODES;
++
++	/*
++	 * See if the last group is big enough to support the
++	 * necessary data structures.  If not, we need to get rid of
++	 * it.
++	 */
++	rem = ((super->s_blocks_count - super->s_first_data_block) %
++	       super->s_blocks_per_group);
++	if ((fs->group_desc_count == 1) && rem && (rem < overhead))
++		return EXT2_ET_TOOSMALL;
++	if (rem && (rem < overhead+50)) {
++		super->s_blocks_count -= rem;
++		goto retry;
++	}
++
++	/*
++	 * At this point we know how big the filesystem will be.  So
++	 * we can do any and all allocations that depend on the block
++	 * count.
++	 */
++
++	retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf);
++	if (retval)
++		goto cleanup;
++	
++	sprintf(buf, "block bitmap for %s", fs->device_name);
++	retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map);
++	if (retval)
++		goto cleanup;
++	
++	sprintf(buf, "inode bitmap for %s", fs->device_name);
++	retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map);
++	if (retval)
++		goto cleanup;
++
++	ext2fs_free_mem(&buf);
++
++	retval = ext2fs_get_mem((size_t) fs->desc_blocks * fs->blocksize,
++				&fs->group_desc);
++	if (retval)
++		goto cleanup;
++
++	memset(fs->group_desc, 0, (size_t) fs->desc_blocks * fs->blocksize);
++
++	/*
++	 * Reserve the superblock and group descriptors for each
++	 * group, and fill in the correct group statistics for group.
++	 * Note that although the block bitmap, inode bitmap, and
++	 * inode table have not been allocated (and in fact won't be
++	 * by this routine), they are accounted for nevertheless.
++	 */
++	group_block = super->s_first_data_block;
++	super->s_free_blocks_count = 0;
++	for (i = 0; i < fs->group_desc_count; i++) {
++		numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map);
++
++		super->s_free_blocks_count += numblocks;
++		fs->group_desc[i].bg_free_blocks_count = numblocks;
++		fs->group_desc[i].bg_free_inodes_count =
++			fs->super->s_inodes_per_group;
++		fs->group_desc[i].bg_used_dirs_count = 0;
++		
++		group_block += super->s_blocks_per_group;
++	}
++	
++	ext2fs_mark_super_dirty(fs);
++	ext2fs_mark_bb_dirty(fs);
++	ext2fs_mark_ib_dirty(fs);
++	
++	io_channel_set_blksize(fs->io, fs->blocksize);
++
++	*ret_fs = fs;
++	return 0;
++cleanup:
++	ext2fs_free(fs);
++	return retval;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/inline.c silo-1.4.11/libext2fs/inline.c
+--- silo-1.4.11.orig/libext2fs/inline.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/inline.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,32 @@
++/*
++ * inline.c --- Includes the inlined functions defined in the header
++ * 	files as standalone functions, in case the application program
++ * 	is compiled with inlining turned off.
++ * 
++ * Copyright (C) 1993, 1994 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#define INCLUDE_INLINE_FUNCS
++#include "ext2fs.h"
++
+diff -Naur silo-1.4.11.orig/libext2fs/inode.c silo-1.4.11/libext2fs/inode.c
+--- silo-1.4.11.orig/libext2fs/inode.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/inode.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,794 @@
++/*
++ * inode.c --- utility routines to read and write inodes
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++#include "e2image.h"
++
++struct ext2_struct_inode_scan {
++	errcode_t		magic;
++	ext2_filsys		fs;
++	ext2_ino_t		current_inode;
++	blk_t			current_block;
++	dgrp_t			current_group;
++	ext2_ino_t		inodes_left;
++	blk_t			blocks_left;
++	dgrp_t			groups_left;
++	blk_t			inode_buffer_blocks;
++	char *			inode_buffer;
++	int			inode_size;
++	char *			ptr;
++	int			bytes_left;
++	char			*temp_buffer;
++	errcode_t		(*done_group)(ext2_filsys fs,
++					      ext2_inode_scan scan,
++					      dgrp_t group,
++					      void * priv_data);
++	void *			done_group_data;
++	int			bad_block_ptr;
++	int			scan_flags;
++	int			reserved[6];
++};
++
++/*
++ * This routine flushes the icache, if it exists.
++ */
++errcode_t ext2fs_flush_icache(ext2_filsys fs)
++{
++	int	i;
++	
++	if (!fs->icache)
++		return 0;
++
++	for (i=0; i < fs->icache->cache_size; i++)
++		fs->icache->cache[i].ino = 0;
++
++	fs->icache->buffer_blk = 0;
++	return 0;
++}
++
++static errcode_t create_icache(ext2_filsys fs)
++{
++	errcode_t	retval;
++	
++	if (fs->icache)
++		return 0;
++	retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache);
++	if (retval)
++		return retval;
++
++	memset(fs->icache, 0, sizeof(struct ext2_inode_cache));
++	retval = ext2fs_get_mem(fs->blocksize, &fs->icache->buffer);
++	if (retval) {
++		ext2fs_free_mem(&fs->icache);
++		return retval;
++	}
++	fs->icache->buffer_blk = 0;
++	fs->icache->cache_last = -1;
++	fs->icache->cache_size = 4;
++	fs->icache->refcount = 1;
++	retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache_ent)
++				* fs->icache->cache_size,
++				&fs->icache->cache);
++	if (retval) {
++		ext2fs_free_mem(&fs->icache->buffer);
++		ext2fs_free_mem(&fs->icache);
++		return retval;
++	}
++	ext2fs_flush_icache(fs);
++	return 0;
++}
++
++errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
++				 ext2_inode_scan *ret_scan)
++{
++	ext2_inode_scan	scan;
++	errcode_t	retval;
++	errcode_t (*save_get_blocks)(ext2_filsys f, ext2_ino_t ino, blk_t *blocks);
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	/*
++	 * If fs->badblocks isn't set, then set it --- since the inode
++	 * scanning functions require it.
++	 */
++	if (fs->badblocks == 0) {
++		/*
++		 * Temporarly save fs->get_blocks and set it to zero,
++		 * for compatibility with old e2fsck's.
++		 */
++		save_get_blocks = fs->get_blocks;
++		fs->get_blocks = 0;
++		retval = ext2fs_read_bb_inode(fs, &fs->badblocks);
++		if (retval && fs->badblocks) {
++			ext2fs_badblocks_list_free(fs->badblocks);
++			fs->badblocks = 0;
++		}
++		fs->get_blocks = save_get_blocks;
++	}
++
++	retval = ext2fs_get_mem(sizeof(struct ext2_struct_inode_scan), &scan);
++	if (retval)
++		return retval;
++	memset(scan, 0, sizeof(struct ext2_struct_inode_scan));
++
++	scan->magic = EXT2_ET_MAGIC_INODE_SCAN;
++	scan->fs = fs;
++	scan->inode_size = EXT2_INODE_SIZE(fs->super);
++	scan->bytes_left = 0;
++	scan->current_group = 0;
++	scan->groups_left = fs->group_desc_count - 1;
++	scan->inode_buffer_blocks = buffer_blocks ? buffer_blocks : 8;
++	scan->current_block = scan->fs->
++		group_desc[scan->current_group].bg_inode_table;
++	scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
++	scan->blocks_left = scan->fs->inode_blocks_per_group;
++	retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * 
++					  fs->blocksize),
++				&scan->inode_buffer);
++	scan->done_group = 0;
++	scan->done_group_data = 0;
++	scan->bad_block_ptr = 0;
++	if (retval) {
++		ext2fs_free_mem(&scan);
++		return retval;
++	}
++	retval = ext2fs_get_mem(scan->inode_size, &scan->temp_buffer);
++	if (retval) {
++		ext2fs_free_mem(&scan->inode_buffer);
++		ext2fs_free_mem(&scan);
++		return retval;
++	}
++	if (scan->fs->badblocks && scan->fs->badblocks->num)
++		scan->scan_flags |= EXT2_SF_CHK_BADBLOCKS;
++	*ret_scan = scan;
++	return 0;
++}
++
++void ext2fs_close_inode_scan(ext2_inode_scan scan)
++{
++	if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN))
++		return;
++	
++	ext2fs_free_mem(&scan->inode_buffer);
++	scan->inode_buffer = NULL;
++	ext2fs_free_mem(&scan->temp_buffer);
++	scan->temp_buffer = NULL;
++	ext2fs_free_mem(&scan);
++	return;
++}
++
++void ext2fs_set_inode_callback(ext2_inode_scan scan,
++			       errcode_t (*done_group)(ext2_filsys fs,
++						       ext2_inode_scan scan,
++						       dgrp_t group,
++						       void * priv_data),
++			       void *done_group_data)
++{
++	if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN))
++		return;
++	
++	scan->done_group = done_group;
++	scan->done_group_data = done_group_data;
++}
++
++int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
++			    int clear_flags)
++{
++	int	old_flags;
++
++	if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN))
++		return 0;
++
++	old_flags = scan->scan_flags;
++	scan->scan_flags &= ~clear_flags;
++	scan->scan_flags |= set_flags;
++	return old_flags;
++}
++
++/*
++ * This function is called by ext2fs_get_next_inode when it needs to
++ * get ready to read in a new blockgroup.
++ */
++static errcode_t get_next_blockgroup(ext2_inode_scan scan)
++{
++	scan->current_group++;
++	scan->groups_left--;
++			
++	scan->current_block = scan->fs->
++		group_desc[scan->current_group].bg_inode_table;
++
++	scan->current_inode = scan->current_group *
++		EXT2_INODES_PER_GROUP(scan->fs->super);
++
++	scan->bytes_left = 0;
++	scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
++	scan->blocks_left = scan->fs->inode_blocks_per_group;
++	return 0;
++}
++
++errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
++					    int	group)
++{
++	scan->current_group = group - 1;
++	scan->groups_left = scan->fs->group_desc_count - group;
++	return get_next_blockgroup(scan);
++}
++
++/*
++ * This function is called by get_next_blocks() to check for bad
++ * blocks in the inode table.
++ *
++ * This function assumes that badblocks_list->list is sorted in
++ * increasing order.
++ */
++static errcode_t check_for_inode_bad_blocks(ext2_inode_scan scan,
++					    blk_t *num_blocks)
++{
++	blk_t	blk = scan->current_block;
++	badblocks_list	bb = scan->fs->badblocks;
++
++	/*
++	 * If the inode table is missing, then obviously there are no
++	 * bad blocks.  :-)
++	 */
++	if (blk == 0)
++		return 0;
++
++	/*
++	 * If the current block is greater than the bad block listed
++	 * in the bad block list, then advance the pointer until this
++	 * is no longer the case.  If we run out of bad blocks, then
++	 * we don't need to do any more checking!
++	 */
++	while (blk > bb->list[scan->bad_block_ptr]) {
++		if (++scan->bad_block_ptr >= bb->num) {
++			scan->scan_flags &= ~EXT2_SF_CHK_BADBLOCKS;
++			return 0;
++		}
++	}
++
++	/*
++	 * If the current block is equal to the bad block listed in
++	 * the bad block list, then handle that one block specially.
++	 * (We could try to handle runs of bad blocks, but that
++	 * only increases CPU efficiency by a small amount, at the
++	 * expense of a huge expense of code complexity, and for an
++	 * uncommon case at that.)
++	 */
++	if (blk == bb->list[scan->bad_block_ptr]) {
++		scan->scan_flags |= EXT2_SF_BAD_INODE_BLK;
++		*num_blocks = 1;
++		if (++scan->bad_block_ptr >= bb->num)
++			scan->scan_flags &= ~EXT2_SF_CHK_BADBLOCKS;
++		return 0;
++	}
++
++	/*
++	 * If there is a bad block in the range that we're about to
++	 * read in, adjust the number of blocks to read so that we we
++	 * don't read in the bad block.  (Then the next block to read
++	 * will be the bad block, which is handled in the above case.)
++	 */
++	if ((blk + *num_blocks) > bb->list[scan->bad_block_ptr])
++		*num_blocks = (int) (bb->list[scan->bad_block_ptr] - blk);
++
++	return 0;
++}
++
++/*
++ * This function is called by ext2fs_get_next_inode when it needs to
++ * read in more blocks from the current blockgroup's inode table.
++ */
++static errcode_t get_next_blocks(ext2_inode_scan scan)
++{
++	blk_t		num_blocks;
++	errcode_t	retval;
++
++	/*
++	 * Figure out how many blocks to read; we read at most
++	 * inode_buffer_blocks, and perhaps less if there aren't that
++	 * many blocks left to read.
++	 */
++	num_blocks = scan->inode_buffer_blocks;
++	if (num_blocks > scan->blocks_left)
++		num_blocks = scan->blocks_left;
++
++	/*
++	 * If the past block "read" was a bad block, then mark the
++	 * left-over extra bytes as also being bad.
++	 */
++	if (scan->scan_flags & EXT2_SF_BAD_INODE_BLK) {
++		if (scan->bytes_left)
++			scan->scan_flags |= EXT2_SF_BAD_EXTRA_BYTES;
++		scan->scan_flags &= ~EXT2_SF_BAD_INODE_BLK;
++	}
++
++	/*
++	 * Do inode bad block processing, if necessary.
++	 */
++	if (scan->scan_flags & EXT2_SF_CHK_BADBLOCKS) {
++		retval = check_for_inode_bad_blocks(scan, &num_blocks);
++		if (retval)
++			return retval;
++	}
++		
++	if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) ||
++	    (scan->current_block == 0)) {
++		memset(scan->inode_buffer, 0,
++		       (size_t) num_blocks * scan->fs->blocksize);
++	} else {
++		retval = io_channel_read_blk(scan->fs->io,
++					     scan->current_block,
++					     (int) num_blocks,
++					     scan->inode_buffer);
++		if (retval)
++			return EXT2_ET_NEXT_INODE_READ;
++	}
++	scan->ptr = scan->inode_buffer;
++	scan->bytes_left = num_blocks * scan->fs->blocksize;
++
++	scan->blocks_left -= num_blocks;
++	if (scan->current_block)
++		scan->current_block += num_blocks;
++	return 0;
++}
++
++#if 0
++/*
++ * Returns 1 if the entire inode_buffer has a non-zero size and
++ * contains all zeros.  (Not just deleted inodes, since that means
++ * that part of the inode table was used at one point; we want all
++ * zeros, which means that the inode table is pristine.)
++ */
++static inline int is_empty_scan(ext2_inode_scan scan)
++{
++	int	i;
++	
++	if (scan->bytes_left == 0)
++		return 0;
++
++	for (i=0; i < scan->bytes_left; i++)
++		if (scan->ptr[i])
++			return 0;
++	return 1;
++}
++#endif
++
++errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
++				     struct ext2_inode *inode, int bufsize)
++{
++	errcode_t	retval;
++	int		extra_bytes = 0;
++	
++	EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN);
++
++	/*
++	 * Do we need to start reading a new block group?
++	 */
++	if (scan->inodes_left <= 0) {
++	force_new_group:
++		if (scan->done_group) {
++			retval = (scan->done_group)
++				(scan->fs, scan, scan->current_group,
++				 scan->done_group_data);
++			if (retval)
++				return retval;
++		}
++		if (scan->groups_left <= 0) {
++			*ino = 0;
++			return 0;
++		}
++		retval = get_next_blockgroup(scan);
++		if (retval)
++			return retval;
++	}
++	/*
++	 * This is done outside the above if statement so that the
++	 * check can be done for block group #0.
++	 */
++	if (scan->current_block == 0) {
++		if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) {
++			goto force_new_group;
++		} else
++			return EXT2_ET_MISSING_INODE_TABLE;
++	}
++	
++
++	/*
++	 * Have we run out of space in the inode buffer?  If so, we
++	 * need to read in more blocks.
++	 */
++	if (scan->bytes_left < scan->inode_size) {
++		memcpy(scan->temp_buffer, scan->ptr, scan->bytes_left);
++		extra_bytes = scan->bytes_left;
++
++		retval = get_next_blocks(scan);
++		if (retval)
++			return retval;
++#if 0
++		/*
++		 * XXX test  Need check for used inode somehow.
++		 * (Note: this is hard.)
++		 */
++		if (is_empty_scan(scan))
++			goto force_new_group;
++#endif
++	}
++
++	retval = 0;
++	if (extra_bytes) {
++		memcpy(scan->temp_buffer+extra_bytes, scan->ptr,
++		       scan->inode_size - extra_bytes);
++		scan->ptr += scan->inode_size - extra_bytes;
++		scan->bytes_left -= scan->inode_size - extra_bytes;
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++		if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++		    (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
++			ext2fs_swap_inode_full(scan->fs, 
++				(struct ext2_inode_large *) inode,
++				(struct ext2_inode_large *) scan->temp_buffer, 
++				0, bufsize);
++		else
++#endif
++			*inode = *((struct ext2_inode *) scan->temp_buffer);
++		if (scan->scan_flags & EXT2_SF_BAD_EXTRA_BYTES)
++			retval = EXT2_ET_BAD_BLOCK_IN_INODE_TABLE;
++		scan->scan_flags &= ~EXT2_SF_BAD_EXTRA_BYTES;
++	} else {
++#ifdef EXT2FS_ENABLE_SWAPFS
++		if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++		    (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
++			ext2fs_swap_inode_full(scan->fs, 
++				(struct ext2_inode_large *) inode,
++				(struct ext2_inode_large *) scan->ptr,
++				0, bufsize);
++		else
++#endif
++			memcpy(inode, scan->ptr, bufsize);
++		scan->ptr += scan->inode_size;
++		scan->bytes_left -= scan->inode_size;
++		if (scan->scan_flags & EXT2_SF_BAD_INODE_BLK)
++			retval = EXT2_ET_BAD_BLOCK_IN_INODE_TABLE;
++	}
++
++	scan->inodes_left--;
++	scan->current_inode++;
++	*ino = scan->current_inode;
++	return retval;
++}
++
++errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
++				struct ext2_inode *inode)
++{
++	return ext2fs_get_next_inode_full(scan, ino, inode,
++						sizeof(struct ext2_inode));
++}
++
++/*
++ * Functions to read and write a single inode.
++ */
++errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
++				 struct ext2_inode * inode, int bufsize)
++{
++	unsigned long 	group, block, block_nr, offset;
++	char 		*ptr;
++	errcode_t	retval;
++	int 		clen, i, inodes_per_block, length;
++	io_channel	io;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	/* Check to see if user has an override function */
++	if (fs->read_inode) {
++		retval = (fs->read_inode)(fs, ino, inode);
++		if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
++			return retval;
++	}
++	/* Create inode cache if not present */
++	if (!fs->icache) {
++		retval = create_icache(fs);
++		if (retval)
++			return retval;
++	}
++	/* Check to see if it's in the inode cache */
++	if (bufsize == sizeof(struct ext2_inode)) {
++		/* only old good inode can be retrieve from the cache */
++		for (i=0; i < fs->icache->cache_size; i++) {
++			if (fs->icache->cache[i].ino == ino) {
++				*inode = fs->icache->cache[i].inode;
++				return 0;
++			}
++		}
++	}
++	if ((ino == 0) || (ino > fs->super->s_inodes_count))
++		return EXT2_ET_BAD_INODE_NUM;
++	if (fs->flags & EXT2_FLAG_IMAGE_FILE) {
++		inodes_per_block = fs->blocksize / EXT2_INODE_SIZE(fs->super);
++		block_nr = fs->image_header->offset_inode / fs->blocksize;
++		block_nr += (ino - 1) / inodes_per_block;
++		offset = ((ino - 1) % inodes_per_block) *
++			EXT2_INODE_SIZE(fs->super);
++		io = fs->image_io;
++	} else {
++		group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super);
++		offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) *
++			EXT2_INODE_SIZE(fs->super);
++		block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super);
++		if (!fs->group_desc[(unsigned)group].bg_inode_table)
++			return EXT2_ET_MISSING_INODE_TABLE;
++		block_nr = fs->group_desc[(unsigned)group].bg_inode_table + 
++			block;
++		io = fs->io;
++	}
++	offset &= (EXT2_BLOCK_SIZE(fs->super) - 1);
++
++	length = EXT2_INODE_SIZE(fs->super);
++	if (bufsize < length)
++		length = bufsize;
++
++	ptr = (char *) inode;
++	while (length) {
++		clen = length;
++		if ((offset + length) > fs->blocksize)
++			clen = fs->blocksize - offset;
++
++		if (block_nr != fs->icache->buffer_blk) {
++			retval = io_channel_read_blk(io, block_nr, 1,
++						     fs->icache->buffer);
++			if (retval)
++				return retval;
++			fs->icache->buffer_blk = block_nr;
++		}
++
++		memcpy(ptr, ((char *) fs->icache->buffer) + (unsigned) offset,
++		       clen);
++
++		offset = 0;
++		length -= clen;
++		ptr += clen;
++		block_nr++;
++	}
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++	    (fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
++		ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, 
++				       (struct ext2_inode_large *) inode, 
++				       0, length);
++#endif
++
++	/* Update the inode cache */
++	fs->icache->cache_last = (fs->icache->cache_last + 1) %
++		fs->icache->cache_size;
++	fs->icache->cache[fs->icache->cache_last].ino = ino;
++	fs->icache->cache[fs->icache->cache_last].inode = *inode;
++	
++	return 0;
++}
++
++errcode_t ext2fs_read_inode(ext2_filsys fs, ext2_ino_t ino,
++			    struct ext2_inode * inode)
++{
++	return ext2fs_read_inode_full(fs, ino, inode,
++					sizeof(struct ext2_inode));
++}
++
++errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
++				  struct ext2_inode * inode, int bufsize)
++{
++	unsigned long group, block, block_nr, offset;
++	errcode_t retval = 0;
++	struct ext2_inode_large temp_inode, *w_inode;
++	char *ptr;
++	int clen, i, length;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	/* Check to see if user provided an override function */
++	if (fs->write_inode) {
++		retval = (fs->write_inode)(fs, ino, inode);
++		if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
++			return retval;
++	}
++
++	/* Check to see if the inode cache needs to be updated */
++	if (fs->icache) {
++		for (i=0; i < fs->icache->cache_size; i++) {
++			if (fs->icache->cache[i].ino == ino) {
++				fs->icache->cache[i].inode = *inode;
++				break;
++			}
++		}
++	} else {
++		retval = create_icache(fs);
++		if (retval)
++			return retval;
++	}
++		
++	if (!(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++
++	if ((ino == 0) || (ino > fs->super->s_inodes_count))
++		return EXT2_ET_BAD_INODE_NUM;
++
++	length = bufsize;
++	if (length < EXT2_INODE_SIZE(fs->super))
++		length = EXT2_INODE_SIZE(fs->super);
++
++	if (length > (int) sizeof(struct ext2_inode_large)) {
++		w_inode = malloc(length);
++		if (!w_inode)
++			return ENOMEM;
++	} else
++		w_inode = &temp_inode;
++	memset(w_inode, 0, length);
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++	    (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))
++		ext2fs_swap_inode_full(fs, w_inode, 
++				       (struct ext2_inode_large *) inode, 
++				       1, bufsize);
++	else
++#endif
++		memcpy(w_inode, inode, bufsize);
++	
++	group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super);
++	offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) *
++		EXT2_INODE_SIZE(fs->super);
++	block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super);
++	if (!fs->group_desc[(unsigned) group].bg_inode_table)
++		return EXT2_ET_MISSING_INODE_TABLE;
++	block_nr = fs->group_desc[(unsigned) group].bg_inode_table + block;
++
++	offset &= (EXT2_BLOCK_SIZE(fs->super) - 1);
++
++	length = EXT2_INODE_SIZE(fs->super);
++	if (length > bufsize)
++		length = bufsize;
++
++	ptr = (char *) w_inode;
++
++	while (length) {
++		clen = length;
++		if ((offset + length) > fs->blocksize)
++			clen = fs->blocksize - offset;
++
++		if (fs->icache->buffer_blk != block_nr) {
++			retval = io_channel_read_blk(fs->io, block_nr, 1,
++						     fs->icache->buffer);
++			if (retval)
++				goto errout;
++			fs->icache->buffer_blk = block_nr;
++		}
++
++	
++		memcpy((char *) fs->icache->buffer + (unsigned) offset, 
++		       ptr, clen);
++
++		retval = io_channel_write_blk(fs->io, block_nr, 1, 
++					      fs->icache->buffer);
++		if (retval)
++			goto errout;
++
++		offset = 0;
++		ptr += clen;
++		length -= clen;
++		block_nr++;
++	}
++		
++	fs->flags |= EXT2_FLAG_CHANGED;
++errout:
++	if (w_inode && w_inode != &temp_inode)
++		free(w_inode);
++	return retval;
++}
++
++errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
++			     struct ext2_inode *inode)
++{
++	return ext2fs_write_inode_full(fs, ino, inode,
++				       sizeof(struct ext2_inode));
++}
++
++/* 
++ * This function should be called when writing a new inode.  It makes
++ * sure that extra part of large inodes is initialized properly.
++ */
++errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino,
++				 struct ext2_inode *inode)
++{
++	struct ext2_inode	*buf;
++	int 			size = EXT2_INODE_SIZE(fs->super);
++	struct ext2_inode_large	*large_inode;
++
++	if (size == sizeof(struct ext2_inode))
++		return ext2fs_write_inode_full(fs, ino, inode,
++					       sizeof(struct ext2_inode));
++
++	buf = malloc(size);
++	if (!buf)
++		return ENOMEM;
++
++	memset(buf, 0, size);
++	*buf = *inode;
++
++	large_inode = (struct ext2_inode_large *) buf;
++	large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - 
++		EXT2_GOOD_OLD_INODE_SIZE;
++
++	return ext2fs_write_inode_full(fs, ino, buf, size);
++}
++
++ 
++errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks)
++{
++	struct ext2_inode	inode;
++	int			i;
++	errcode_t		retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (ino > fs->super->s_inodes_count)
++		return EXT2_ET_BAD_INODE_NUM;
++
++	if (fs->get_blocks) {
++		if (!(*fs->get_blocks)(fs, ino, blocks))
++			return 0;
++	}
++	retval = ext2fs_read_inode(fs, ino, &inode);
++	if (retval)
++		return retval;
++	for (i=0; i < EXT2_N_BLOCKS; i++)
++		blocks[i] = inode.i_block[i];
++	return 0;
++}
++
++errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino)
++{
++	struct	ext2_inode	inode;
++	errcode_t		retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (ino > fs->super->s_inodes_count)
++		return EXT2_ET_BAD_INODE_NUM;
++
++	if (fs->check_directory) {
++		retval = (fs->check_directory)(fs, ino);
++		if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
++			return retval;
++	}
++	retval = ext2fs_read_inode(fs, ino, &inode);
++	if (retval)
++		return retval;
++	if (!LINUX_S_ISDIR(inode.i_mode))
++		return EXT2_ET_NO_DIRECTORY;
++	return 0;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/inode_io.c silo-1.4.11/libext2fs/inode_io.c
+--- silo-1.4.11.orig/libext2fs/inode_io.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/inode_io.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,270 @@
++/*
++ * inode_io.c --- This is allows an inode in an ext2 filesystem image
++ * 	to be accessed via the I/O manager interface.
++ *
++ * Copyright (C) 2002 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * For checking structure magic numbers...
++ */
++
++#define EXT2_CHECK_MAGIC(struct, code) \
++	  if ((struct)->magic != (code)) return (code)
++
++struct inode_private_data {
++	int				magic;
++	char				name[32];
++	ext2_file_t			file;
++	ext2_filsys			fs;
++	ext2_ino_t 			ino;
++	struct ext2_inode		inode;
++	int				flags;
++	struct inode_private_data	*next;
++};
++
++#define CHANNEL_HAS_INODE	0x8000
++
++static struct inode_private_data *top_intern;
++static int ino_unique = 0;
++
++static errcode_t inode_open(const char *name, int flags, io_channel *channel);
++static errcode_t inode_close(io_channel channel);
++static errcode_t inode_set_blksize(io_channel channel, int blksize);
++static errcode_t inode_read_blk(io_channel channel, unsigned long block,
++			       int count, void *data);
++static errcode_t inode_write_blk(io_channel channel, unsigned long block,
++				int count, const void *data);
++static errcode_t inode_flush(io_channel channel);
++static errcode_t inode_write_byte(io_channel channel, unsigned long offset,
++				int size, const void *data);
++
++static struct struct_io_manager struct_inode_manager = {
++	EXT2_ET_MAGIC_IO_MANAGER,
++	"Inode I/O Manager",
++	inode_open,
++	inode_close,
++	inode_set_blksize,
++	inode_read_blk,
++	inode_write_blk,
++	inode_flush,
++	inode_write_byte
++};
++
++io_manager inode_io_manager = &struct_inode_manager;
++
++errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino,
++				  struct ext2_inode *inode,
++				  char **name)
++{
++	struct inode_private_data 	*data;
++	errcode_t			retval;
++
++	if ((retval = ext2fs_get_mem(sizeof(struct inode_private_data),
++				     &data)))
++		return retval;
++	data->magic = EXT2_ET_MAGIC_INODE_IO_CHANNEL;
++	sprintf(data->name, "%u:%d", ino, ino_unique++);
++	data->file = 0;
++	data->fs = fs;
++	data->ino = ino;
++	data->flags = 0;
++	if (inode) {
++		memcpy(&data->inode, inode, sizeof(struct ext2_inode));
++		data->flags |= CHANNEL_HAS_INODE;
++	}
++	data->next = top_intern;
++	top_intern = data;
++	*name = data->name;
++	return 0;
++}
++
++errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino,
++				 char **name)
++{
++	return ext2fs_inode_io_intern2(fs, ino, NULL, name);
++}
++
++
++static errcode_t inode_open(const char *name, int flags, io_channel *channel)
++{
++	io_channel	io = NULL;
++	struct inode_private_data *prev, *data = NULL;
++	errcode_t	retval;
++	int		open_flags;
++
++	if (name == 0)
++		return EXT2_ET_BAD_DEVICE_NAME;
++
++	for (data = top_intern, prev = NULL; data;
++	     prev = data, data = data->next)
++		if (strcmp(name, data->name) == 0)
++			break;
++	if (!data)
++		return ENOENT;
++	if (prev)
++		prev->next = data->next;
++	else
++		top_intern = data->next;
++
++	retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
++	if (retval)
++		goto cleanup;
++	memset(io, 0, sizeof(struct struct_io_channel));
++
++	io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
++	io->manager = inode_io_manager;
++	retval = ext2fs_get_mem(strlen(name)+1, &io->name);
++	if (retval)
++		goto cleanup;
++
++	strcpy(io->name, name);
++	io->private_data = data;
++	io->block_size = 1024;
++	io->read_error = 0;
++	io->write_error = 0;
++	io->refcount = 1;
++
++	open_flags = (flags & IO_FLAG_RW) ? EXT2_FILE_WRITE : 0;
++	retval = ext2fs_file_open2(data->fs, data->ino,
++				   (data->flags & CHANNEL_HAS_INODE) ?
++				   &data->inode : 0, open_flags,
++				   &data->file);
++	if (retval)
++		goto cleanup;
++		
++	*channel = io;
++	return 0;
++
++cleanup:
++	if (data) {
++		ext2fs_free_mem(&data);
++	}
++	if (io)
++		ext2fs_free_mem(&io);
++	return retval;
++}
++
++static errcode_t inode_close(io_channel channel)
++{
++	struct inode_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct inode_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);
++
++	if (--channel->refcount > 0)
++		return 0;
++
++	retval = ext2fs_file_close(data->file);
++	
++	ext2fs_free_mem(&channel->private_data);
++	if (channel->name)
++		ext2fs_free_mem(&channel->name);
++	ext2fs_free_mem(&channel);
++	return retval;
++}
++
++static errcode_t inode_set_blksize(io_channel channel, int blksize)
++{
++	struct inode_private_data *data;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct inode_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);
++
++	channel->block_size = blksize;
++	return 0;
++}
++
++
++static errcode_t inode_read_blk(io_channel channel, unsigned long block,
++			       int count, void *buf)
++{
++	struct inode_private_data *data;
++	errcode_t	retval;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct inode_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);
++
++	if ((retval = ext2fs_file_lseek(data->file,
++					block * channel->block_size,
++					EXT2_SEEK_SET, 0)))
++		return retval;
++
++	count = (count < 0) ? -count : (count * channel->block_size);
++
++	return ext2fs_file_read(data->file, buf, count, 0);
++}
++
++static errcode_t inode_write_blk(io_channel channel, unsigned long block,
++				int count, const void *buf)
++{
++	struct inode_private_data *data;
++	errcode_t	retval;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct inode_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);
++
++	if ((retval = ext2fs_file_lseek(data->file,
++					block * channel->block_size,
++					EXT2_SEEK_SET, 0)))
++		return retval;
++
++	count = (count < 0) ? -count : (count * channel->block_size);
++
++	return ext2fs_file_write(data->file, buf, count, 0);
++}
++
++static errcode_t inode_write_byte(io_channel channel, unsigned long offset,
++				 int size, const void *buf)
++{
++	struct inode_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct inode_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);
++
++	if ((retval = ext2fs_file_lseek(data->file, offset,
++					EXT2_SEEK_SET, 0)))
++		return retval;
++
++	return ext2fs_file_write(data->file, buf, size, 0);
++}
++
++/*
++ * Flush data buffers to disk.  
++ */
++static errcode_t inode_flush(io_channel channel)
++{
++	struct inode_private_data *data;
++	
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct inode_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);
++
++	return ext2fs_file_flush(data->file);
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/io_manager.c silo-1.4.11/libext2fs/io_manager.c
+--- silo-1.4.11.orig/libext2fs/io_manager.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/io_manager.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,69 @@
++/*
++ * io_manager.c --- the I/O manager abstraction
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t io_channel_set_options(io_channel channel, const char *opts)
++{
++	errcode_t retval = 0;
++	char *next, *ptr, *options, *arg;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++
++	if (!opts)
++		return 0;
++
++	if (!channel->manager->set_option)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	options = malloc(strlen(opts)+1);
++	if (!options)
++		return EXT2_ET_NO_MEMORY;
++	strcpy(options, opts);
++	ptr = options;
++
++	while (ptr && *ptr) {
++		next = strchr(ptr, '&');
++		if (next)
++			*next++ = 0;
++
++		arg = strchr(ptr, '=');
++		if (arg)
++			*arg++ = 0;
++
++		retval = (channel->manager->set_option)(channel, ptr, arg);
++		if (retval)
++			break;
++		ptr = next;
++	}
++	free(options);
++	return retval;
++}
++
++errcode_t io_channel_write_byte(io_channel channel, unsigned long offset,
++				int count, const void *data)
++{
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++
++	if (channel->manager->write_byte) 
++		return channel->manager->write_byte(channel, offset, 
++						    count, data);
++
++	return EXT2_ET_UNIMPLEMENTED;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/irel.h silo-1.4.11/libext2fs/irel.h
+--- silo-1.4.11.orig/libext2fs/irel.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/irel.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,114 @@
++/*
++ * irel.h
++ * 
++ * Copyright (C) 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++struct ext2_inode_reference {
++	blk_t	block;
++	__u16 offset;
++};
++
++struct ext2_inode_relocate_entry {
++	ext2_ino_t	new;
++	ext2_ino_t	orig;
++	__u16		flags;
++	__u16		max_refs;
++};
++
++typedef struct ext2_inode_relocation_table *ext2_irel;
++
++struct ext2_inode_relocation_table {
++	__u32	magic;
++	char	*name;
++	ext2_ino_t	current;
++	void	*priv_data;
++
++	/*
++	 * Add an inode relocation entry.
++	 */
++	errcode_t (*put)(ext2_irel irel, ext2_ino_t old,
++			      struct ext2_inode_relocate_entry *ent);
++	/*
++	 * Get an inode relocation entry.
++	 */
++	errcode_t (*get)(ext2_irel irel, ext2_ino_t old,
++			      struct ext2_inode_relocate_entry *ent);
++
++	/*
++	 * Get an inode relocation entry by its original inode number
++	 */
++	errcode_t (*get_by_orig)(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
++				 struct ext2_inode_relocate_entry *ent);
++
++	/*
++	 * Initialize for iterating over the inode relocation entries.
++	 */
++	errcode_t (*start_iter)(ext2_irel irel);
++
++	/*
++	 * The iterator function for the inode relocation entries.
++	 * Returns an inode number of 0 when out of entries.
++	 */
++	errcode_t (*next)(ext2_irel irel, ext2_ino_t *old,
++			  struct ext2_inode_relocate_entry *ent);
++
++	/*
++	 * Add an inode reference (i.e., note the fact that a
++	 * particular block/offset contains a reference to an inode)
++	 */
++	errcode_t (*add_ref)(ext2_irel irel, ext2_ino_t ino,
++			     struct ext2_inode_reference *ref);
++
++	/*
++	 * Initialize for iterating over the inode references for a
++	 * particular inode.
++	 */
++	errcode_t (*start_iter_ref)(ext2_irel irel, ext2_ino_t ino);
++
++	/*
++	 * The iterator function for the inode references for an
++	 * inode.  The references for only one inode can be interator
++	 * over at a time, as the iterator state is stored in ext2_irel.
++	 */
++	errcode_t (*next_ref)(ext2_irel irel,
++			      struct ext2_inode_reference *ref);
++
++	/*
++	 * Move the inode relocation table from one inode number to
++	 * another.  Note that the inode references also must move.
++	 */
++	errcode_t (*move)(ext2_irel irel, ext2_ino_t old, ext2_ino_t new);
++
++	/*
++	 * Remove an inode relocation entry, along with all of the
++	 * inode references.
++	 */
++	errcode_t (*delete)(ext2_irel irel, ext2_ino_t old);
++
++	/*
++	 * Free the inode relocation table.
++	 */
++	errcode_t (*free)(ext2_irel irel);
++};
++
++errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode,
++				    ext2_irel *irel);
++
++#define ext2fs_irel_put(irel, old, ent) ((irel)->put((irel), old, ent))
++#define ext2fs_irel_get(irel, old, ent) ((irel)->get((irel), old, ent))
++#define ext2fs_irel_get_by_orig(irel, orig, old, ent) \
++			((irel)->get_by_orig((irel), orig, old, ent))
++#define ext2fs_irel_start_iter(irel) ((irel)->start_iter((irel)))
++#define ext2fs_irel_next(irel, old, ent) ((irel)->next((irel), old, ent))
++#define ext2fs_irel_add_ref(irel, ino, ref) ((irel)->add_ref((irel), ino, ref))
++#define ext2fs_irel_start_iter_ref(irel, ino) ((irel)->start_iter_ref((irel), ino))
++#define ext2fs_irel_next_ref(irel, ref) ((irel)->next_ref((irel), ref))
++#define ext2fs_irel_move(irel, old, new) ((irel)->move((irel), old, new))
++#define ext2fs_irel_delete(irel, old) ((irel)->delete((irel), old))
++#define ext2fs_irel_free(irel) ((irel)->free((irel)))
+diff -Naur silo-1.4.11.orig/libext2fs/irel_ma.c silo-1.4.11/libext2fs/irel_ma.c
+--- silo-1.4.11.orig/libext2fs/irel_ma.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/irel_ma.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,372 @@
++/*
++ * irel_ma.c
++ * 
++ * Copyright (C) 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <fcntl.h>
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++#include "irel.h"
++
++static errcode_t ima_put(ext2_irel irel, ext2_ino_t old,
++			 struct ext2_inode_relocate_entry *ent);
++static errcode_t ima_get(ext2_irel irel, ext2_ino_t old,
++			 struct ext2_inode_relocate_entry *ent);
++static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
++				 struct ext2_inode_relocate_entry *ent);
++static errcode_t ima_start_iter(ext2_irel irel);
++static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old,
++			  struct ext2_inode_relocate_entry *ent);
++static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino,
++			     struct ext2_inode_reference *ref);
++static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino);
++static errcode_t ima_next_ref(ext2_irel irel, struct ext2_inode_reference *ref);
++static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new);
++static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old);
++static errcode_t ima_free(ext2_irel irel);
++
++/*
++ * This data structure stores the array of inode references; there is
++ * a structure for each inode.
++ */
++struct inode_reference_entry {
++	__u16 num;
++	struct ext2_inode_reference *refs;
++};
++
++struct irel_ma {
++	__u32 magic;
++	ext2_ino_t max_inode;
++	ext2_ino_t ref_current;
++	int   ref_iter;
++	ext2_ino_t	*orig_map;
++	struct ext2_inode_relocate_entry *entries;
++	struct inode_reference_entry *ref_entries;
++};
++
++errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode,
++				      ext2_irel *new_irel)
++{
++	ext2_irel		irel = 0;
++	errcode_t	retval;
++	struct irel_ma 	*ma = 0;
++	size_t		size;
++
++	*new_irel = 0;
++
++	/*
++	 * Allocate memory structures
++	 */
++	retval = ext2fs_get_mem(sizeof(struct ext2_inode_relocation_table),
++				&irel);
++	if (retval)
++		goto errout;
++	memset(irel, 0, sizeof(struct ext2_inode_relocation_table));
++	
++	retval = ext2fs_get_mem(strlen(name)+1, &irel->name);
++	if (retval)
++		goto errout;
++	strcpy(irel->name, name);
++	
++	retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma);
++	if (retval)
++		goto errout;
++	memset(ma, 0, sizeof(struct irel_ma));
++	irel->priv_data = ma;
++	
++	size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1));
++	retval = ext2fs_get_mem(size, &ma->orig_map);
++	if (retval)
++		goto errout;
++	memset(ma->orig_map, 0, size);
++
++	size = (size_t) (sizeof(struct ext2_inode_relocate_entry) *
++			 (max_inode+1));
++	retval = ext2fs_get_mem(size, &ma->entries);
++	if (retval)
++		goto errout;
++	memset(ma->entries, 0, size);
++
++	size = (size_t) (sizeof(struct inode_reference_entry) *
++			 (max_inode+1));
++	retval = ext2fs_get_mem(size, &ma->ref_entries);
++	if (retval)
++		goto errout;
++	memset(ma->ref_entries, 0, size);
++	ma->max_inode = max_inode;
++
++	/*
++	 * Fill in the irel data structure
++	 */
++	irel->put = ima_put;
++	irel->get = ima_get;
++	irel->get_by_orig = ima_get_by_orig;
++	irel->start_iter = ima_start_iter;
++	irel->next = ima_next;
++	irel->add_ref = ima_add_ref;
++	irel->start_iter_ref = ima_start_iter_ref;
++	irel->next_ref = ima_next_ref;
++	irel->move = ima_move;
++	irel->delete = ima_delete;
++	irel->free = ima_free;
++	
++	*new_irel = irel;
++	return 0;
++
++errout:
++	ima_free(irel);
++	return retval;
++}
++
++static errcode_t ima_put(ext2_irel irel, ext2_ino_t old,
++			struct ext2_inode_relocate_entry *ent)
++{
++	struct inode_reference_entry	*ref_ent;
++	struct irel_ma 			*ma;
++	errcode_t			retval;
++	size_t				size, old_size;
++
++	ma = irel->priv_data;
++	if (old > ma->max_inode)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	/*
++	 * Force the orig field to the correct value; the application
++	 * program shouldn't be messing with this field.
++	 */
++	if (ma->entries[(unsigned) old].new == 0)
++		ent->orig = old;
++	else
++		ent->orig = ma->entries[(unsigned) old].orig;
++	
++	/*
++	 * If max_refs has changed, reallocate the refs array
++	 */
++	ref_ent = ma->ref_entries + (unsigned) old;
++	if (ref_ent->refs && ent->max_refs !=
++	    ma->entries[(unsigned) old].max_refs) {
++		size = (sizeof(struct ext2_inode_reference) * ent->max_refs);
++		old_size = (sizeof(struct ext2_inode_reference) *
++			    ma->entries[(unsigned) old].max_refs);
++		retval = ext2fs_resize_mem(old_size, size, &ref_ent->refs);
++		if (retval)
++			return retval;
++	}
++
++	ma->entries[(unsigned) old] = *ent;
++	ma->orig_map[(unsigned) ent->orig] = old;
++	return 0;
++}
++
++static errcode_t ima_get(ext2_irel irel, ext2_ino_t old,
++			struct ext2_inode_relocate_entry *ent)
++{
++	struct irel_ma 	*ma;
++
++	ma = irel->priv_data;
++	if (old > ma->max_inode)
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned) old].new == 0)
++		return ENOENT;
++	*ent = ma->entries[(unsigned) old];
++	return 0;
++}
++
++static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
++			struct ext2_inode_relocate_entry *ent)
++{
++	struct irel_ma 	*ma;
++	ext2_ino_t	ino;
++
++	ma = irel->priv_data;
++	if (orig > ma->max_inode)
++		return EXT2_ET_INVALID_ARGUMENT;
++	ino = ma->orig_map[(unsigned) orig];
++	if (ino == 0)
++		return ENOENT;
++	*old = ino;
++	*ent = ma->entries[(unsigned) ino];
++	return 0;
++}
++
++static errcode_t ima_start_iter(ext2_irel irel)
++{
++	irel->current = 0;
++	return 0;
++}
++
++static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old,
++			 struct ext2_inode_relocate_entry *ent)
++{
++	struct irel_ma 	*ma;
++
++	ma = irel->priv_data;
++	while (++irel->current < ma->max_inode) {
++		if (ma->entries[(unsigned) irel->current].new == 0)
++			continue;
++		*old = irel->current;
++		*ent = ma->entries[(unsigned) irel->current];
++		return 0;
++	}
++	*old = 0;
++	return 0;
++}
++
++static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino,
++			     struct ext2_inode_reference *ref)
++{
++	struct irel_ma 	*ma;
++	size_t		size;
++	struct inode_reference_entry *ref_ent;
++	struct ext2_inode_relocate_entry *ent;
++	errcode_t		retval;
++
++	ma = irel->priv_data;
++	if (ino > ma->max_inode)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	ref_ent = ma->ref_entries + (unsigned) ino;
++	ent = ma->entries + (unsigned) ino;
++	
++	/*
++	 * If the inode reference array doesn't exist, create it.
++	 */
++	if (ref_ent->refs == 0) {
++		size = (size_t) ((sizeof(struct ext2_inode_reference) * 
++				  ent->max_refs));
++		retval = ext2fs_get_mem(size, &ref_ent->refs);
++		if (retval)
++			return retval;
++		memset(ref_ent->refs, 0, size);
++		ref_ent->num = 0;
++	}
++
++	if (ref_ent->num >= ent->max_refs)
++		return EXT2_ET_TOO_MANY_REFS;
++
++	ref_ent->refs[(unsigned) ref_ent->num++] = *ref;
++	return 0;
++}
++
++static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino)
++{
++	struct irel_ma 	*ma;
++
++	ma = irel->priv_data;
++	if (ino > ma->max_inode)
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned) ino].new == 0)
++		return ENOENT;
++	ma->ref_current = ino;
++	ma->ref_iter = 0;
++	return 0;
++}
++
++static errcode_t ima_next_ref(ext2_irel irel,
++			      struct ext2_inode_reference *ref)
++{
++	struct irel_ma 	*ma;
++	struct inode_reference_entry *ref_ent;
++
++	ma = irel->priv_data;
++	
++	ref_ent = ma->ref_entries + ma->ref_current;
++
++	if ((ref_ent->refs == NULL) ||
++	    (ma->ref_iter >= ref_ent->num)) {
++		ref->block = 0;
++		ref->offset = 0;
++		return 0;
++	}
++	*ref = ref_ent->refs[ma->ref_iter++];
++	return 0;
++}
++
++
++static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new)
++{
++	struct irel_ma 	*ma;
++
++	ma = irel->priv_data;
++	if ((old > ma->max_inode) || (new > ma->max_inode))
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned) old].new == 0)
++		return ENOENT;
++	
++	ma->entries[(unsigned) new] = ma->entries[(unsigned) old];
++	if (ma->ref_entries[(unsigned) new].refs)
++		ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs);
++	ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old];
++	
++	ma->entries[(unsigned) old].new = 0;
++	ma->ref_entries[(unsigned) old].num = 0;
++	ma->ref_entries[(unsigned) old].refs = 0;
++
++	ma->orig_map[ma->entries[new].orig] = new;
++	return 0;
++}
++
++static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old)
++{
++	struct irel_ma 	*ma;
++
++	ma = irel->priv_data;
++	if (old > ma->max_inode)
++		return EXT2_ET_INVALID_ARGUMENT;
++	if (ma->entries[(unsigned) old].new == 0)
++		return ENOENT;
++	
++	ma->entries[old].new = 0;
++	if (ma->ref_entries[(unsigned) old].refs)
++		ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs);
++	ma->orig_map[ma->entries[(unsigned) old].orig] = 0;
++	
++	ma->ref_entries[(unsigned) old].num = 0;
++	ma->ref_entries[(unsigned) old].refs = 0;
++	return 0;
++}
++
++static errcode_t ima_free(ext2_irel irel)
++{
++	struct irel_ma 	*ma;
++	ext2_ino_t	ino;
++
++	if (!irel)
++		return 0;
++
++	ma = irel->priv_data;
++
++	if (ma) {
++		if (ma->orig_map)
++			ext2fs_free_mem(&ma->orig_map);
++		if (ma->entries)
++			ext2fs_free_mem(&ma->entries);
++		if (ma->ref_entries) {
++			for (ino = 0; ino <= ma->max_inode; ino++) {
++				if (ma->ref_entries[(unsigned) ino].refs)
++					ext2fs_free_mem(&ma->ref_entries[(unsigned) ino].refs);
++			}
++			ext2fs_free_mem(&ma->ref_entries);
++		}
++		ext2fs_free_mem(&ma);
++	}
++	if (irel->name)
++		ext2fs_free_mem(&irel->name);
++	ext2fs_free_mem(&irel);
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/ismounted.c silo-1.4.11/libext2fs/ismounted.c
+--- silo-1.4.11.orig/libext2fs/ismounted.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/ismounted.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,377 @@
++/*
++ * ismounted.c --- Check to see if the filesystem was mounted
++ * 
++ * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <fcntl.h>
++#ifdef HAVE_LINUX_FD_H
++#include <linux/fd.h>
++#endif
++#ifdef HAVE_MNTENT_H
++#include <mntent.h>
++#endif
++#ifdef HAVE_GETMNTINFO
++#include <paths.h>
++#include <sys/param.h>
++#include <sys/mount.h>
++#endif /* HAVE_GETMNTINFO */
++#include <string.h>
++#include <sys/stat.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#ifdef HAVE_MNTENT_H
++/*
++ * Helper function which checks a file in /etc/mtab format to see if a
++ * filesystem is mounted.  Returns an error if the file doesn't exist
++ * or can't be opened.  
++ */
++static errcode_t check_mntent_file(const char *mtab_file, const char *file, 
++				   int *mount_flags, char *mtpt, int mtlen)
++{
++	struct mntent 	*mnt;
++	struct stat	st_buf;
++	errcode_t	retval = 0;
++	dev_t		file_dev=0, file_rdev=0;
++	ino_t		file_ino=0;
++	FILE 		*f;
++	int		fd;
++
++	*mount_flags = 0;
++	if ((f = setmntent (mtab_file, "r")) == NULL)
++		return errno;
++	if (stat(file, &st_buf) == 0) {
++		if (S_ISBLK(st_buf.st_mode)) {
++#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
++			file_rdev = st_buf.st_rdev;
++#endif	/* __GNU__ */
++		} else {
++			file_dev = st_buf.st_dev;
++			file_ino = st_buf.st_ino;
++		}
++	}
++	while ((mnt = getmntent (f)) != NULL) {
++		if (strcmp(file, mnt->mnt_fsname) == 0)
++			break;
++		if (stat(mnt->mnt_fsname, &st_buf) == 0) {
++			if (S_ISBLK(st_buf.st_mode)) {
++#ifndef __GNU__
++				if (file_rdev && (file_rdev == st_buf.st_rdev))
++					break;
++#endif	/* __GNU__ */
++			} else {
++				if (file_dev && ((file_dev == st_buf.st_dev) &&
++						 (file_ino == st_buf.st_ino)))
++					break;
++			}
++		}
++	}
++
++	if (mnt == 0) {
++#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
++		/*
++		 * Do an extra check to see if this is the root device.  We
++		 * can't trust /etc/mtab, and /proc/mounts will only list
++		 * /dev/root for the root filesystem.  Argh.  Instead we
++		 * check if the given device has the same major/minor number
++		 * as the device that the root directory is on.
++		 */
++		if (file_rdev && stat("/", &st_buf) == 0) {
++			if (st_buf.st_dev == file_rdev) {
++				*mount_flags = EXT2_MF_MOUNTED;
++				if (mtpt)
++					strncpy(mtpt, "/", mtlen);
++				goto is_root;
++			}
++		}
++#endif	/* __GNU__ */
++		goto errout;
++	}
++#ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */
++	/* Validate the entry in case /etc/mtab is out of date */
++	/* 
++	 * We need to be paranoid, because some broken distributions
++	 * (read: Slackware) don't initialize /etc/mtab before checking
++	 * all of the non-root filesystems on the disk.
++	 */
++	if (stat(mnt->mnt_dir, &st_buf) < 0) {
++		retval = errno;
++		if (retval == ENOENT) {
++#ifdef DEBUG
++			printf("Bogus entry in %s!  (%s does not exist)\n",
++			       mtab_file, mnt->mnt_dir);
++#endif /* DEBUG */
++			retval = 0;
++		}
++		goto errout;
++	}
++	if (file_rdev && (st_buf.st_dev != file_rdev)) {
++#ifdef DEBUG
++		printf("Bogus entry in %s!  (%s not mounted on %s)\n",
++		       mtab_file, file, mnt->mnt_dir);
++#endif /* DEBUG */
++		goto errout;
++	}
++#endif /* __GNU__ */
++	*mount_flags = EXT2_MF_MOUNTED;
++	
++#ifdef MNTOPT_RO
++	/* Check to see if the ro option is set */
++	if (hasmntopt(mnt, MNTOPT_RO))
++		*mount_flags |= EXT2_MF_READONLY;
++#endif
++
++	if (mtpt)
++		strncpy(mtpt, mnt->mnt_dir, mtlen);
++	/*
++	 * Check to see if we're referring to the root filesystem.
++	 * If so, do a manual check to see if we can open /etc/mtab
++	 * read/write, since if the root is mounted read/only, the
++	 * contents of /etc/mtab may not be accurate.
++	 */
++	if (!strcmp(mnt->mnt_dir, "/")) {
++is_root:
++#define TEST_FILE "/.ismount-test-file"		
++		*mount_flags |= EXT2_MF_ISROOT;
++		fd = open(TEST_FILE, O_RDWR|O_CREAT);
++		if (fd < 0) {
++			if (errno == EROFS)
++				*mount_flags |= EXT2_MF_READONLY;
++		} else
++			close(fd);
++		(void) unlink(TEST_FILE);
++	}
++	retval = 0;
++errout:
++	endmntent (f);
++	return retval;
++}
++
++static errcode_t check_mntent(const char *file, int *mount_flags,
++			      char *mtpt, int mtlen)
++{
++	errcode_t	retval;
++
++#ifdef DEBUG
++	retval = check_mntent_file("/tmp/mtab", file, mount_flags,
++				   mtpt, mtlen);
++	if (retval == 0)
++		return 0;
++#endif /* DEBUG */
++#ifdef __linux__
++	retval = check_mntent_file("/proc/mounts", file, mount_flags,
++				   mtpt, mtlen);
++	if (retval == 0 && (*mount_flags != 0))
++		return 0;
++#endif /* __linux__ */
++#if defined(MOUNTED) || defined(_PATH_MOUNTED)
++#ifndef MOUNTED
++#define MOUNTED _PATH_MOUNTED
++#endif /* MOUNTED */
++	retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen);
++	return retval;
++#else 
++	*mount_flags = 0;
++	return 0;
++#endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */
++}
++
++#else
++#if defined(HAVE_GETMNTINFO)
++
++static errcode_t check_getmntinfo(const char *file, int *mount_flags,
++				  char *mtpt, int mtlen)
++{
++	struct statfs *mp;
++        int    len, n;
++        const  char   *s1;
++	char	*s2;
++
++        n = getmntinfo(&mp, MNT_NOWAIT);
++        if (n == 0)
++		return errno;
++
++        len = sizeof(_PATH_DEV) - 1;
++        s1 = file;
++        if (strncmp(_PATH_DEV, s1, len) == 0)
++                s1 += len;
++ 
++	*mount_flags = 0;
++        while (--n >= 0) {
++                s2 = mp->f_mntfromname;
++                if (strncmp(_PATH_DEV, s2, len) == 0) {
++                        s2 += len - 1;
++                        *s2 = 'r';
++                }
++                if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) {
++			*mount_flags = EXT2_MF_MOUNTED;
++			break;
++		}
++                ++mp;
++	}
++	if (mtpt)
++		strncpy(mtpt, mp->f_mntonname, mtlen);
++	return 0;
++}
++#endif /* HAVE_GETMNTINFO */
++#endif /* HAVE_MNTENT_H */
++
++/*
++ * Check to see if we're dealing with the swap device.
++ */
++static int is_swap_device(const char *file)
++{
++	FILE		*f;
++	char		buf[1024], *cp;
++	dev_t		file_dev;
++	struct stat	st_buf;
++	int		ret = 0;
++
++	file_dev = 0;
++#ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
++	if ((stat(file, &st_buf) == 0) &&
++	    S_ISBLK(st_buf.st_mode))
++		file_dev = st_buf.st_rdev;
++#endif	/* __GNU__ */
++
++	if (!(f = fopen("/proc/swaps", "r")))
++		return 0;
++	/* Skip the first line */
++	fgets(buf, sizeof(buf), f);
++	while (!feof(f)) {
++		if (!fgets(buf, sizeof(buf), f))
++			break;
++		if ((cp = strchr(buf, ' ')) != NULL)
++			*cp = 0;
++		if ((cp = strchr(buf, '\t')) != NULL)
++			*cp = 0;
++		if (strcmp(buf, file) == 0) {
++			ret++;
++			break;
++		}
++#ifndef __GNU__
++		if (file_dev && (stat(buf, &st_buf) == 0) &&
++		    S_ISBLK(st_buf.st_mode) &&
++		    file_dev == st_buf.st_rdev) {
++			ret++;
++			break;
++		}
++#endif 	/* __GNU__ */
++	}
++	fclose(f);
++	return ret;
++}
++
++
++/*
++ * ext2fs_check_mount_point() fills determines if the device is
++ * mounted or otherwise busy, and fills in mount_flags with one or
++ * more of the following flags: EXT2_MF_MOUNTED, EXT2_MF_ISROOT,
++ * EXT2_MF_READONLY, EXT2_MF_SWAP, and EXT2_MF_BUSY.  If mtpt is
++ * non-NULL, the directory where the device is mounted is copied to
++ * where mtpt is pointing, up to mtlen characters.
++ */
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
++				  char *mtpt, int mtlen)
++{
++	struct stat	st_buf;
++	errcode_t	retval = 0;
++	int		fd;
++
++	if (is_swap_device(device)) {
++		*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_SWAP;
++		strncpy(mtpt, "<swap>", mtlen);
++	} else {
++#ifdef HAVE_MNTENT_H
++		retval = check_mntent(device, mount_flags, mtpt, mtlen);
++#else 
++#ifdef HAVE_GETMNTINFO
++		retval = check_getmntinfo(device, mount_flags, mtpt, mtlen);
++#else
++#ifdef __GNUC__
++ #warning "Can't use getmntent or getmntinfo to check for mounted filesystems!"
++#endif
++		*mount_flags = 0;
++#endif /* HAVE_GETMNTINFO */
++#endif /* HAVE_MNTENT_H */
++	}
++	if (retval)
++		return retval;
++
++#ifdef __linux__ /* This only works on Linux 2.6+ systems */
++	if ((stat(device, &st_buf) != 0) ||
++	    !S_ISBLK(st_buf.st_mode))
++		return 0;
++	fd = open(device, O_RDONLY | O_EXCL);
++	if (fd < 0) {
++		if (errno == EBUSY)
++			*mount_flags |= EXT2_MF_BUSY;
++	} else
++		close(fd);
++
++	return 0;
++#endif
++}
++
++/*
++ * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED,
++ * EXT2_MF_READONLY, and EXT2_MF_ROOT
++ * 
++ */
++errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags)
++{
++	return ext2fs_check_mount_point(file, mount_flags, NULL, 0);
++}
++
++#ifdef DEBUG
++int main(int argc, char **argv)
++{
++	int	retval, mount_flags;
++	char	mntpt[80];
++	
++	if (argc < 2) {
++		fprintf(stderr, "Usage: %s device\n", argv[0]);
++		exit(1);
++	}
++
++	mntpt[0] = 0;
++	retval = ext2fs_check_mount_point(argv[1], &mount_flags,
++					  mntpt, sizeof(mntpt));
++	if (retval) {
++		com_err(argv[0], retval,
++			"while calling ext2fs_check_if_mounted");
++		exit(1);
++	}
++	printf("Device %s reports flags %02x\n", argv[1], mount_flags);
++	if (mount_flags & EXT2_MF_BUSY)
++		printf("\t%s is apparently in use.\n", argv[1]);
++	if (mount_flags & EXT2_MF_MOUNTED)
++		printf("\t%s is mounted.\n", argv[1]);
++	if (mount_flags & EXT2_MF_SWAP)
++		printf("\t%s is a swap device.\n", argv[1]);
++	if (mount_flags & EXT2_MF_READONLY)
++		printf("\t%s is read-only.\n", argv[1]);
++	if (mount_flags & EXT2_MF_ISROOT)
++		printf("\t%s is the root filesystem.\n", argv[1]);
++	if (mntpt[0])
++		printf("\t%s is mounted on %s.\n", argv[1], mntpt);
++	exit(0);
++}
++#endif /* DEBUG */
+diff -Naur silo-1.4.11.orig/libext2fs/jfs_compat.h silo-1.4.11/libext2fs/jfs_compat.h
+--- silo-1.4.11.orig/libext2fs/jfs_compat.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/jfs_compat.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,67 @@
++
++#ifndef _JFS_COMPAT_H
++#define _JFS_COMPAT_H
++
++#include "kernel-list.h"
++#include <errno.h>
++#ifdef HAVE_NETINET_IN_H
++#include <netinet/in.h>
++#endif
++
++#define printk printf
++#define KERN_ERR ""
++#define KERN_DEBUG ""
++
++#define READ 0
++#define WRITE 1
++
++#define cpu_to_be32(n) htonl(n)
++#define be32_to_cpu(n) ntohl(n)
++
++typedef unsigned int tid_t;
++typedef struct journal_s journal_t;
++
++struct buffer_head;
++struct inode;
++
++struct journal_s
++{
++	unsigned long		j_flags;
++	int			j_errno;
++	struct buffer_head *	j_sb_buffer;
++	struct journal_superblock_s *j_superblock;
++	int			j_format_version;
++	unsigned long		j_head;
++	unsigned long		j_tail;
++	unsigned long		j_free;
++	unsigned long		j_first, j_last;
++	kdev_t			j_dev;
++	kdev_t			j_fs_dev;
++	int			j_blocksize;
++	unsigned int		j_blk_offset;
++	unsigned int		j_maxlen;
++	struct inode *		j_inode;
++	tid_t			j_tail_sequence;
++	tid_t			j_transaction_sequence;
++	__u8			j_uuid[16];
++	struct jbd_revoke_table_s *j_revoke;
++};
++
++#define J_ASSERT(assert)						\
++	do { if (!(assert)) {						\
++		printf ("Assertion failure in %s() at %s line %d: "	\
++			"\"%s\"\n",					\
++			__FUNCTION__, __FILE__, __LINE__, # assert);	\
++		fatal_error(e2fsck_global_ctx, 0);			\
++	} } while (0)
++
++#define is_journal_abort(x) 0
++
++#define BUFFER_TRACE(bh, info)	do {} while (0)
++
++/* Need this so we can compile with configure --enable-gcc-wall */
++#ifdef NO_INLINE_FUNCS
++#define inline
++#endif
++
++#endif /* _JFS_COMPAT_H */
+diff -Naur silo-1.4.11.orig/libext2fs/jfs_dat.h silo-1.4.11/libext2fs/jfs_dat.h
+--- silo-1.4.11.orig/libext2fs/jfs_dat.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/jfs_dat.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,64 @@
++/*
++ * jfs_dat.h --- stripped down header file which only contains the JFS
++ * 	on-disk data structures
++ */
++
++#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
++
++/*
++ * On-disk structures
++ */
++
++/* 
++ * Descriptor block types:
++ */
++
++#define JFS_DESCRIPTOR_BLOCK	1
++#define JFS_COMMIT_BLOCK	2
++#define JFS_SUPERBLOCK		3
++
++/*
++ * Standard header for all descriptor blocks:
++ */
++typedef struct journal_header_s
++{
++	__u32		h_magic;
++	__u32		h_blocktype;
++	__u32		h_sequence;
++} journal_header_t;
++
++
++/* 
++ * The block tag: used to describe a single buffer in the journal 
++ */
++typedef struct journal_block_tag_s
++{
++	__u32		t_blocknr;	/* The on-disk block number */
++	__u32		t_flags;	/* See below */
++} journal_block_tag_t;
++
++/* Definitions for the journal tag flags word: */
++#define JFS_FLAG_ESCAPE		1	/* on-disk block is escaped */
++#define JFS_FLAG_SAME_UUID	2	/* block has same uuid as previous */
++#define JFS_FLAG_DELETED	4	/* block deleted by this transaction */
++#define JFS_FLAG_LAST_TAG	8	/* last tag in this descriptor block */
++
++
++/*
++ * The journal superblock
++ */
++typedef struct journal_superblock_s
++{
++	journal_header_t s_header;
++
++	/* Static information describing the journal */
++	__u32		s_blocksize;	/* journal device blocksize */
++	__u32		s_maxlen;	/* total blocks in journal file */
++	__u32		s_first;	/* first block of log information */
++	
++	/* Dynamic information describing the current state of the log */
++	__u32		s_sequence;	/* first commit ID expected in log */
++	__u32		s_start;	/* blocknr of start of log */
++	
++} journal_superblock_t;
++
+diff -Naur silo-1.4.11.orig/libext2fs/jfs_user.h silo-1.4.11/libext2fs/jfs_user.h
+--- silo-1.4.11.orig/libext2fs/jfs_user.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/jfs_user.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,8 @@
++#ifndef _JFS_USER_H
++#define _JFS_USER_H
++
++typedef unsigned short kdev_t;
++
++#include "kernel-jbd.h"
++
++#endif /* _JFS_USER_H */
+diff -Naur silo-1.4.11.orig/libext2fs/kernel-jbd.h silo-1.4.11/libext2fs/kernel-jbd.h
+--- silo-1.4.11.orig/libext2fs/kernel-jbd.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/kernel-jbd.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,910 @@
++/*
++ * linux/include/linux/jbd.h
++ * 
++ * Written by Stephen C. Tweedie <sct@redhat.com>
++ *
++ * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
++ *
++ * This file is part of the Linux kernel and is made available under
++ * the terms of the GNU General Public License, version 2, or at your
++ * option, any later version, incorporated herein by reference.
++ *
++ * Definitions for transaction data structures for the buffer cache
++ * filesystem journaling support.
++ */
++
++#ifndef _LINUX_JBD_H
++#define _LINUX_JBD_H
++
++#if defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE) || !defined(__KERNEL__)
++
++/* Allow this file to be included directly into e2fsprogs */
++#ifndef __KERNEL__
++#include "jfs_compat.h"
++#define JFS_DEBUG
++#define jfs_debug jbd_debug
++#else
++
++#include <linux/journal-head.h>
++#include <linux/stddef.h>
++#include <asm/semaphore.h>
++#endif
++
++#ifndef __GNUC__
++#define __FUNCTION__ ""
++#endif
++
++#define journal_oom_retry 1
++
++#ifdef __STDC__
++#ifdef CONFIG_JBD_DEBUG
++/*
++ * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
++ * consistency checks.  By default we don't do this unless
++ * CONFIG_JBD_DEBUG is on.
++ */
++#define JBD_EXPENSIVE_CHECKING
++extern int journal_enable_debug;
++
++#define jbd_debug(n, f, a...)						\
++	do {								\
++		if ((n) <= journal_enable_debug) {			\
++			printk (KERN_DEBUG "(%s, %d): %s: ",		\
++				__FILE__, __LINE__, __FUNCTION__);	\
++		  	printk (f, ## a);				\
++		}							\
++	} while (0)
++#else
++#ifdef __GNUC__
++#define jbd_debug(f, a...)	/**/
++#else
++#define jbd_debug(f, ...)	/**/
++#endif	
++#endif
++#else
++#define jbd_debug(x)		/* AIX doesn't do STDC */
++#endif
++
++extern void * __jbd_kmalloc (char *where, size_t size, int flags, int retry);
++#define jbd_kmalloc(size, flags) \
++	__jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
++#define jbd_rep_kmalloc(size, flags) \
++	__jbd_kmalloc(__FUNCTION__, (size), (flags), 1)
++
++#define JFS_MIN_JOURNAL_BLOCKS 1024
++
++#ifdef __KERNEL__
++typedef struct handle_s		handle_t;	/* Atomic operation type */
++typedef struct journal_s	journal_t;	/* Journal control structure */
++#endif
++
++/*
++ * Internal structures used by the logging mechanism:
++ */
++
++#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
++
++/*
++ * On-disk structures
++ */
++
++/* 
++ * Descriptor block types:
++ */
++
++#define JFS_DESCRIPTOR_BLOCK	1
++#define JFS_COMMIT_BLOCK	2
++#define JFS_SUPERBLOCK_V1	3
++#define JFS_SUPERBLOCK_V2	4
++#define JFS_REVOKE_BLOCK	5
++
++/*
++ * Standard header for all descriptor blocks:
++ */
++typedef struct journal_header_s
++{
++	__u32		h_magic;
++	__u32		h_blocktype;
++	__u32		h_sequence;
++} journal_header_t;
++
++
++/* 
++ * The block tag: used to describe a single buffer in the journal 
++ */
++typedef struct journal_block_tag_s
++{
++	__u32		t_blocknr;	/* The on-disk block number */
++	__u32		t_flags;	/* See below */
++} journal_block_tag_t;
++
++/* 
++ * The revoke descriptor: used on disk to describe a series of blocks to
++ * be revoked from the log 
++ */
++typedef struct journal_revoke_header_s
++{
++	journal_header_t r_header;
++	int		 r_count;	/* Count of bytes used in the block */
++} journal_revoke_header_t;
++
++
++/* Definitions for the journal tag flags word: */
++#define JFS_FLAG_ESCAPE		1	/* on-disk block is escaped */
++#define JFS_FLAG_SAME_UUID	2	/* block has same uuid as previous */
++#define JFS_FLAG_DELETED	4	/* block deleted by this transaction */
++#define JFS_FLAG_LAST_TAG	8	/* last tag in this descriptor block */
++
++
++/*
++ * The journal superblock.  All fields are in big-endian byte order.
++ */
++typedef struct journal_superblock_s
++{
++/* 0x0000 */
++	journal_header_t s_header;
++
++/* 0x000C */
++	/* Static information describing the journal */
++	__u32	s_blocksize;		/* journal device blocksize */
++	__u32	s_maxlen;		/* total blocks in journal file */
++	__u32	s_first;		/* first block of log information */
++	
++/* 0x0018 */
++	/* Dynamic information describing the current state of the log */
++	__u32	s_sequence;		/* first commit ID expected in log */
++	__u32	s_start;		/* blocknr of start of log */
++
++/* 0x0020 */
++	/* Error value, as set by journal_abort(). */
++	__s32	s_errno;
++
++/* 0x0024 */
++	/* Remaining fields are only valid in a version-2 superblock */
++	__u32	s_feature_compat; 	/* compatible feature set */
++	__u32	s_feature_incompat; 	/* incompatible feature set */
++	__u32	s_feature_ro_compat; 	/* readonly-compatible feature set */
++/* 0x0030 */
++	__u8	s_uuid[16];		/* 128-bit uuid for journal */
++
++/* 0x0040 */
++	__u32	s_nr_users;		/* Nr of filesystems sharing log */
++	
++	__u32	s_dynsuper;		/* Blocknr of dynamic superblock copy*/
++	
++/* 0x0048 */
++	__u32	s_max_transaction;	/* Limit of journal blocks per trans.*/
++	__u32	s_max_trans_data;	/* Limit of data blocks per trans. */
++
++/* 0x0050 */
++	__u32	s_padding[44];
++
++/* 0x0100 */
++	__u8	s_users[16*48];		/* ids of all fs'es sharing the log */
++/* 0x0400 */
++} journal_superblock_t;
++
++#define JFS_HAS_COMPAT_FEATURE(j,mask)					\
++	((j)->j_format_version >= 2 &&					\
++	 ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
++#define JFS_HAS_RO_COMPAT_FEATURE(j,mask)				\
++	((j)->j_format_version >= 2 &&					\
++	 ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
++#define JFS_HAS_INCOMPAT_FEATURE(j,mask)				\
++	((j)->j_format_version >= 2 &&					\
++	 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
++
++#define JFS_FEATURE_INCOMPAT_REVOKE	0x00000001
++
++/* Features known to this kernel version: */
++#define JFS_KNOWN_COMPAT_FEATURES	0
++#define JFS_KNOWN_ROCOMPAT_FEATURES	0
++#define JFS_KNOWN_INCOMPAT_FEATURES	JFS_FEATURE_INCOMPAT_REVOKE
++
++#ifdef __KERNEL__
++
++#include <linux/fs.h>
++#include <linux/sched.h>
++
++#define JBD_ASSERTIONS
++#ifdef JBD_ASSERTIONS
++#define J_ASSERT(assert)						\
++do {									\
++	if (!(assert)) {						\
++		printk (KERN_EMERG					\
++			"Assertion failure in %s() at %s:%d: \"%s\"\n",	\
++			__FUNCTION__, __FILE__, __LINE__, # assert);	\
++		BUG();							\
++	}								\
++} while (0)
++
++#if defined(CONFIG_BUFFER_DEBUG)
++void buffer_assertion_failure(struct buffer_head *bh);
++#define J_ASSERT_BH(bh, expr)						\
++	do {								\
++		if (!(expr))						\
++			buffer_assertion_failure(bh);			\
++		J_ASSERT(expr);						\
++	} while (0)
++#define J_ASSERT_JH(jh, expr)	J_ASSERT_BH(jh2bh(jh), expr)
++#else
++#define J_ASSERT_BH(bh, expr)	J_ASSERT(expr)
++#define J_ASSERT_JH(jh, expr)	J_ASSERT(expr)
++#endif
++
++#else
++#define J_ASSERT(assert)
++#endif		/* JBD_ASSERTIONS */
++
++enum jbd_state_bits {
++	BH_JWrite
++	  = BH_PrivateStart,	/* 1 if being written to log (@@@ DEBUGGING) */
++	BH_Freed,		/* 1 if buffer has been freed (truncated) */
++	BH_Revoked,		/* 1 if buffer has been revoked from the log */
++	BH_RevokeValid,		/* 1 if buffer revoked flag is valid */
++	BH_JBDDirty,		/* 1 if buffer is dirty but journaled */
++};
++
++/* Return true if the buffer is one which JBD is managing */
++static inline int buffer_jbd(struct buffer_head *bh)
++{
++	return __buffer_state(bh, JBD);
++}
++
++static inline struct buffer_head *jh2bh(struct journal_head *jh)
++{
++	return jh->b_bh;
++}
++
++static inline struct journal_head *bh2jh(struct buffer_head *bh)
++{
++	return bh->b_private;
++}
++
++struct jbd_revoke_table_s;
++
++/* The handle_t type represents a single atomic update being performed
++ * by some process.  All filesystem modifications made by the process go
++ * through this handle.  Recursive operations (such as quota operations)
++ * are gathered into a single update.
++ *
++ * The buffer credits field is used to account for journaled buffers
++ * being modified by the running process.  To ensure that there is
++ * enough log space for all outstanding operations, we need to limit the
++ * number of outstanding buffers possible at any time.  When the
++ * operation completes, any buffer credits not used are credited back to
++ * the transaction, so that at all times we know how many buffers the
++ * outstanding updates on a transaction might possibly touch. */
++
++struct handle_s 
++{
++	/* Which compound transaction is this update a part of? */
++	transaction_t	      * h_transaction;
++
++	/* Number of remaining buffers we are allowed to dirty: */
++	int			h_buffer_credits;
++
++	/* Reference count on this handle */
++	int			h_ref;
++
++	/* Field for caller's use to track errors through large fs
++	   operations */
++	int			h_err;
++
++	/* Flags */
++	unsigned int	h_sync:		1;	/* sync-on-close */
++	unsigned int	h_jdata:	1;	/* force data journaling */
++	unsigned int	h_aborted:	1;	/* fatal error on handle */
++};
++
++
++/* The transaction_t type is the guts of the journaling mechanism.  It
++ * tracks a compound transaction through its various states:
++ *
++ * RUNNING:	accepting new updates
++ * LOCKED:	Updates still running but we don't accept new ones
++ * RUNDOWN:	Updates are tidying up but have finished requesting
++ *		new buffers to modify (state not used for now)
++ * FLUSH:       All updates complete, but we are still writing to disk
++ * COMMIT:      All data on disk, writing commit record
++ * FINISHED:	We still have to keep the transaction for checkpointing.
++ *
++ * The transaction keeps track of all of the buffers modified by a
++ * running transaction, and all of the buffers committed but not yet
++ * flushed to home for finished transactions.
++ */
++
++struct transaction_s 
++{
++	/* Pointer to the journal for this transaction. */
++	journal_t *		t_journal;
++	
++	/* Sequence number for this transaction */
++	tid_t			t_tid;
++	
++	/* Transaction's current state */
++	enum {
++		T_RUNNING,
++		T_LOCKED,
++		T_RUNDOWN,
++		T_FLUSH,
++		T_COMMIT,
++		T_FINISHED 
++	}			t_state;
++
++	/* Where in the log does this transaction's commit start? */
++	unsigned long		t_log_start;
++	
++	/* Doubly-linked circular list of all inodes owned by this
++           transaction */	/* AKPM: unused */
++	struct inode *		t_ilist;
++	
++	/* Number of buffers on the t_buffers list */
++	int			t_nr_buffers;
++	
++	/* Doubly-linked circular list of all buffers reserved but not
++           yet modified by this transaction */
++	struct journal_head *	t_reserved_list;
++	
++	/* Doubly-linked circular list of all metadata buffers owned by this
++           transaction */
++	struct journal_head *	t_buffers;
++	
++	/*
++	 * Doubly-linked circular list of all data buffers still to be
++	 * flushed before this transaction can be committed.
++	 * Protected by journal_datalist_lock.
++	 */
++	struct journal_head *	t_sync_datalist;
++	
++	/*
++	 * Doubly-linked circular list of all writepage data buffers
++	 * still to be written before this transaction can be committed.
++	 * Protected by journal_datalist_lock.
++	 */
++	struct journal_head *	t_async_datalist;
++	
++	/* Doubly-linked circular list of all forget buffers (superceded
++           buffers which we can un-checkpoint once this transaction
++           commits) */
++	struct journal_head *	t_forget;
++	
++	/*
++	 * Doubly-linked circular list of all buffers still to be
++	 * flushed before this transaction can be checkpointed.
++	 */
++	/* Protected by journal_datalist_lock */
++	struct journal_head *	t_checkpoint_list;
++	
++	/* Doubly-linked circular list of temporary buffers currently
++           undergoing IO in the log */
++	struct journal_head *	t_iobuf_list;
++	
++	/* Doubly-linked circular list of metadata buffers being
++           shadowed by log IO.  The IO buffers on the iobuf list and the
++           shadow buffers on this list match each other one for one at
++           all times. */
++	struct journal_head *	t_shadow_list;
++	
++	/* Doubly-linked circular list of control buffers being written
++           to the log. */
++	struct journal_head *	t_log_list;
++	
++	/* Number of outstanding updates running on this transaction */
++	int			t_updates;
++
++	/* Number of buffers reserved for use by all handles in this
++	 * transaction handle but not yet modified. */
++	int			t_outstanding_credits;
++	
++	/*
++	 * Forward and backward links for the circular list of all
++	 * transactions awaiting checkpoint.
++	 */
++	/* Protected by journal_datalist_lock */
++	transaction_t		*t_cpnext, *t_cpprev;
++
++	/* When will the transaction expire (become due for commit), in
++	 * jiffies ? */
++	unsigned long		t_expires;
++
++	/* How many handles used this transaction? */
++	int t_handle_count;
++};
++
++
++/* The journal_t maintains all of the journaling state information for a
++ * single filesystem.  It is linked to from the fs superblock structure.
++ * 
++ * We use the journal_t to keep track of all outstanding transaction
++ * activity on the filesystem, and to manage the state of the log
++ * writing process. */
++
++struct journal_s
++{
++	/* General journaling state flags */
++	unsigned long		j_flags;
++
++	/* Is there an outstanding uncleared error on the journal (from
++	 * a prior abort)? */
++	int			j_errno;
++	
++	/* The superblock buffer */
++	struct buffer_head *	j_sb_buffer;
++	journal_superblock_t *	j_superblock;
++
++	/* Version of the superblock format */
++	int			j_format_version;
++
++	/* Number of processes waiting to create a barrier lock */
++	int			j_barrier_count;
++	
++	/* The barrier lock itself */
++	struct semaphore	j_barrier;
++	
++	/* Transactions: The current running transaction... */
++	transaction_t *		j_running_transaction;
++	
++	/* ... the transaction we are pushing to disk ... */
++	transaction_t *		j_committing_transaction;
++	
++	/* ... and a linked circular list of all transactions waiting
++	 * for checkpointing. */
++	/* Protected by journal_datalist_lock */
++	transaction_t *		j_checkpoint_transactions;
++
++	/* Wait queue for waiting for a locked transaction to start
++           committing, or for a barrier lock to be released */
++	wait_queue_head_t	j_wait_transaction_locked;
++	
++	/* Wait queue for waiting for checkpointing to complete */
++	wait_queue_head_t	j_wait_logspace;
++	
++	/* Wait queue for waiting for commit to complete */
++	wait_queue_head_t	j_wait_done_commit;
++	
++	/* Wait queue to trigger checkpointing */
++	wait_queue_head_t	j_wait_checkpoint;
++	
++	/* Wait queue to trigger commit */
++	wait_queue_head_t	j_wait_commit;
++	
++	/* Wait queue to wait for updates to complete */
++	wait_queue_head_t	j_wait_updates;
++
++	/* Semaphore for locking against concurrent checkpoints */
++	struct semaphore 	j_checkpoint_sem;
++
++	/* The main journal lock, used by lock_journal() */
++	struct semaphore	j_sem;
++		
++	/* Journal head: identifies the first unused block in the journal. */
++	unsigned long		j_head;
++	
++	/* Journal tail: identifies the oldest still-used block in the
++	 * journal. */
++	unsigned long		j_tail;
++
++	/* Journal free: how many free blocks are there in the journal? */
++	unsigned long		j_free;
++
++	/* Journal start and end: the block numbers of the first usable
++	 * block and one beyond the last usable block in the journal. */
++	unsigned long		j_first, j_last;
++
++	/* Device, blocksize and starting block offset for the location
++	 * where we store the journal. */
++	kdev_t			j_dev;
++	int			j_blocksize;
++	unsigned int		j_blk_offset;
++
++	/* Device which holds the client fs.  For internal journal this
++	 * will be equal to j_dev. */
++	kdev_t			j_fs_dev;
++
++	/* Total maximum capacity of the journal region on disk. */
++	unsigned int		j_maxlen;
++
++	/* Optional inode where we store the journal.  If present, all
++	 * journal block numbers are mapped into this inode via
++	 * bmap(). */
++	struct inode *		j_inode;
++
++	/* Sequence number of the oldest transaction in the log */
++	tid_t			j_tail_sequence;
++	/* Sequence number of the next transaction to grant */
++	tid_t			j_transaction_sequence;
++	/* Sequence number of the most recently committed transaction */
++	tid_t			j_commit_sequence;
++	/* Sequence number of the most recent transaction wanting commit */
++	tid_t			j_commit_request;
++
++	/* Journal uuid: identifies the object (filesystem, LVM volume
++	 * etc) backed by this journal.  This will eventually be
++	 * replaced by an array of uuids, allowing us to index multiple
++	 * devices within a single journal and to perform atomic updates
++	 * across them.  */
++
++	__u8			j_uuid[16];
++
++	/* Pointer to the current commit thread for this journal */
++	struct task_struct *	j_task;
++
++	/* Maximum number of metadata buffers to allow in a single
++	 * compound commit transaction */
++	int			j_max_transaction_buffers;
++
++	/* What is the maximum transaction lifetime before we begin a
++	 * commit? */
++	unsigned long		j_commit_interval;
++
++	/* The timer used to wakeup the commit thread: */
++	struct timer_list *	j_commit_timer;
++	int			j_commit_timer_active;
++
++	/* Link all journals together - system-wide */
++	struct list_head	j_all_journals;
++
++	/* The revoke table: maintains the list of revoked blocks in the
++           current transaction. */
++	struct jbd_revoke_table_s *j_revoke;
++};
++
++/* 
++ * Journal flag definitions 
++ */
++#define JFS_UNMOUNT	0x001	/* Journal thread is being destroyed */
++#define JFS_ABORT	0x002	/* Journaling has been aborted for errors. */
++#define JFS_ACK_ERR	0x004	/* The errno in the sb has been acked */
++#define JFS_FLUSHED	0x008	/* The journal superblock has been flushed */
++#define JFS_LOADED	0x010	/* The journal superblock has been loaded */
++
++/* 
++ * Function declarations for the journaling transaction and buffer
++ * management
++ */
++
++/* Filing buffers */
++extern void __journal_unfile_buffer(struct journal_head *);
++extern void journal_unfile_buffer(struct journal_head *);
++extern void __journal_refile_buffer(struct journal_head *);
++extern void journal_refile_buffer(struct journal_head *);
++extern void __journal_file_buffer(struct journal_head *, transaction_t *, int);
++extern void __journal_free_buffer(struct journal_head *bh);
++extern void journal_file_buffer(struct journal_head *, transaction_t *, int);
++extern void __journal_clean_data_list(transaction_t *transaction);
++
++/* Log buffer allocation */
++extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
++extern unsigned long journal_next_log_block(journal_t *);
++
++/* Commit management */
++extern void journal_commit_transaction(journal_t *);
++
++/* Checkpoint list management */
++int __journal_clean_checkpoint_list(journal_t *journal);
++extern void journal_remove_checkpoint(struct journal_head *);
++extern void __journal_remove_checkpoint(struct journal_head *);
++extern void journal_insert_checkpoint(struct journal_head *, transaction_t *);
++extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *);
++
++/* Buffer IO */
++extern int 
++journal_write_metadata_buffer(transaction_t	  *transaction,
++			      struct journal_head  *jh_in,
++			      struct journal_head **jh_out,
++			      int		   blocknr);
++
++/* Transaction locking */
++extern void		__wait_on_journal (journal_t *);
++
++/*
++ * Journal locking.
++ *
++ * We need to lock the journal during transaction state changes so that
++ * nobody ever tries to take a handle on the running transaction while
++ * we are in the middle of moving it to the commit phase.  
++ *
++ * Note that the locking is completely interrupt unsafe.  We never touch
++ * journal structures from interrupts.
++ *
++ * In 2.2, the BKL was required for lock_journal.  This is no longer
++ * the case.
++ */
++
++static inline void lock_journal(journal_t *journal)
++{
++	down(&journal->j_sem);
++}
++
++/* This returns zero if we acquired the semaphore */
++static inline int try_lock_journal(journal_t * journal)
++{
++	return down_trylock(&journal->j_sem);
++}
++
++static inline void unlock_journal(journal_t * journal)
++{
++	up(&journal->j_sem);
++}
++
++
++static inline handle_t *journal_current_handle(void)
++{
++	return current->journal_info;
++}
++
++/* The journaling code user interface:
++ *
++ * Create and destroy handles
++ * Register buffer modifications against the current transaction. 
++ */
++
++extern handle_t *journal_start(journal_t *, int nblocks);
++extern handle_t *journal_try_start(journal_t *, int nblocks);
++extern int	 journal_restart (handle_t *, int nblocks);
++extern int	 journal_extend (handle_t *, int nblocks);
++extern int	 journal_get_write_access (handle_t *, struct buffer_head *);
++extern int	 journal_get_create_access (handle_t *, struct buffer_head *);
++extern int	 journal_get_undo_access (handle_t *, struct buffer_head *);
++extern int	 journal_dirty_data (handle_t *,
++				struct buffer_head *, int async);
++extern int	 journal_dirty_metadata (handle_t *, struct buffer_head *);
++extern void	 journal_release_buffer (handle_t *, struct buffer_head *);
++extern void	 journal_forget (handle_t *, struct buffer_head *);
++extern void	 journal_sync_buffer (struct buffer_head *);
++extern int	 journal_flushpage(journal_t *, struct page *, unsigned long);
++extern int	 journal_try_to_free_buffers(journal_t *, struct page *, int);
++extern int	 journal_stop(handle_t *);
++extern int	 journal_flush (journal_t *);
++
++extern void	 journal_lock_updates (journal_t *);
++extern void	 journal_unlock_updates (journal_t *);
++
++extern journal_t * journal_init_dev(kdev_t dev, kdev_t fs_dev,
++				int start, int len, int bsize);
++extern journal_t * journal_init_inode (struct inode *);
++extern int	   journal_update_format (journal_t *);
++extern int	   journal_check_used_features 
++		   (journal_t *, unsigned long, unsigned long, unsigned long);
++extern int	   journal_check_available_features 
++		   (journal_t *, unsigned long, unsigned long, unsigned long);
++extern int	   journal_set_features 
++		   (journal_t *, unsigned long, unsigned long, unsigned long);
++extern int	   journal_create     (journal_t *);
++extern int	   journal_load       (journal_t *journal);
++extern void	   journal_destroy    (journal_t *);
++extern int	   journal_recover    (journal_t *journal);
++extern int	   journal_wipe       (journal_t *, int);
++extern int	   journal_skip_recovery (journal_t *);
++extern void	   journal_update_superblock (journal_t *, int);
++extern void	   __journal_abort      (journal_t *);
++extern void	   journal_abort      (journal_t *, int);
++extern int	   journal_errno      (journal_t *);
++extern void	   journal_ack_err    (journal_t *);
++extern int	   journal_clear_err  (journal_t *);
++extern unsigned long journal_bmap(journal_t *journal, unsigned long blocknr);
++extern int	    journal_force_commit(journal_t *journal);
++
++/*
++ * journal_head management
++ */
++extern struct journal_head
++		*journal_add_journal_head(struct buffer_head *bh);
++extern void	journal_remove_journal_head(struct buffer_head *bh);
++extern void	__journal_remove_journal_head(struct buffer_head *bh);
++extern void	journal_unlock_journal_head(struct journal_head *jh);
++
++/* Primary revoke support */
++#define JOURNAL_REVOKE_DEFAULT_HASH 256
++extern int	   journal_init_revoke(journal_t *, int);
++extern void	   journal_destroy_revoke_caches(void);
++extern int	   journal_init_revoke_caches(void);
++
++extern void	   journal_destroy_revoke(journal_t *);
++extern int	   journal_revoke (handle_t *,
++				unsigned long, struct buffer_head *);
++extern int	   journal_cancel_revoke(handle_t *, struct journal_head *);
++extern void	   journal_write_revoke_records(journal_t *, transaction_t *);
++
++/* Recovery revoke support */
++extern int	   journal_set_revoke(journal_t *, unsigned long, tid_t);
++extern int	   journal_test_revoke(journal_t *, unsigned long, tid_t);
++extern void	   journal_clear_revoke(journal_t *);
++extern void	   journal_brelse_array(struct buffer_head *b[], int n);
++
++/* The log thread user interface:
++ *
++ * Request space in the current transaction, and force transaction commit
++ * transitions on demand.
++ */
++
++extern int	log_space_left (journal_t *); /* Called with journal locked */
++extern tid_t	log_start_commit (journal_t *, transaction_t *);
++extern void	log_wait_commit (journal_t *, tid_t);
++extern int	log_do_checkpoint (journal_t *, int);
++
++extern void	log_wait_for_space(journal_t *, int nblocks);
++extern void	__journal_drop_transaction(journal_t *, transaction_t *);
++extern int	cleanup_journal_tail(journal_t *);
++
++/* Reduce journal memory usage by flushing */
++extern void shrink_journal_memory(void);
++
++/* Debugging code only: */
++
++#define jbd_ENOSYS() \
++do {								      \
++	printk (KERN_ERR "JBD unimplemented function " __FUNCTION__); \
++	current->state = TASK_UNINTERRUPTIBLE;			      \
++	schedule();						      \
++} while (1)
++
++/*
++ * is_journal_abort
++ *
++ * Simple test wrapper function to test the JFS_ABORT state flag.  This
++ * bit, when set, indicates that we have had a fatal error somewhere,
++ * either inside the journaling layer or indicated to us by the client
++ * (eg. ext3), and that we and should not commit any further
++ * transactions.  
++ */
++
++static inline int is_journal_aborted(journal_t *journal)
++{
++	return journal->j_flags & JFS_ABORT;
++}
++
++static inline int is_handle_aborted(handle_t *handle)
++{
++	if (handle->h_aborted)
++		return 1;
++	return is_journal_aborted(handle->h_transaction->t_journal);
++}
++
++static inline void journal_abort_handle(handle_t *handle)
++{
++	handle->h_aborted = 1;
++}
++
++/* Not all architectures define BUG() */
++#ifndef BUG
++#define BUG() do { \
++        printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
++	* ((char *) 0) = 0; \
++ } while (0)
++#endif /* BUG */
++
++#else
++
++extern int	   journal_recover    (journal_t *journal);
++extern int	   journal_skip_recovery (journal_t *);
++
++/* Primary revoke support */
++extern int	   journal_init_revoke(journal_t *, int);
++extern void	   journal_destroy_revoke_caches(void);
++extern int	   journal_init_revoke_caches(void);
++
++/* Recovery revoke support */
++extern int	   journal_set_revoke(journal_t *, unsigned long, tid_t);
++extern int	   journal_test_revoke(journal_t *, unsigned long, tid_t);
++extern void	   journal_clear_revoke(journal_t *);
++extern void	   journal_brelse_array(struct buffer_head *b[], int n);
++
++extern void	   journal_destroy_revoke(journal_t *);
++#endif /* __KERNEL__   */
++
++/* Comparison functions for transaction IDs: perform comparisons using
++ * modulo arithmetic so that they work over sequence number wraps. */
++
++static inline int tid_gt(tid_t x, tid_t y)
++{
++	int difference = (x - y);
++	return (difference > 0);
++}
++
++static inline int tid_geq(tid_t x, tid_t y)
++{
++	int difference = (x - y);
++	return (difference >= 0);
++}
++
++extern int journal_blocks_per_page(struct inode *inode);
++
++/*
++ * Definitions which augment the buffer_head layer
++ */
++
++/* journaling buffer types */
++#define BJ_None		0	/* Not journaled */
++#define BJ_SyncData	1	/* Normal data: flush before commit */
++#define BJ_AsyncData	2	/* writepage data: wait on it before commit */
++#define BJ_Metadata	3	/* Normal journaled metadata */
++#define BJ_Forget	4	/* Buffer superceded by this transaction */
++#define BJ_IO		5	/* Buffer is for temporary IO use */
++#define BJ_Shadow	6	/* Buffer contents being shadowed to the log */
++#define BJ_LogCtl	7	/* Buffer contains log descriptors */
++#define BJ_Reserved	8	/* Buffer is reserved for access by journal */
++#define BJ_Types	9
++ 
++extern int jbd_blocks_per_page(struct inode *inode);
++
++#ifdef __KERNEL__
++
++extern spinlock_t jh_splice_lock;
++/*
++ * Once `expr1' has been found true, take jh_splice_lock
++ * and then reevaluate everything.
++ */
++#define SPLICE_LOCK(expr1, expr2)				\
++	({							\
++		int ret = (expr1);				\
++		if (ret) {					\
++			spin_lock(&jh_splice_lock);		\
++			ret = (expr1) && (expr2);		\
++			spin_unlock(&jh_splice_lock);		\
++		}						\
++		ret;						\
++	})
++
++/*
++ * A number of buffer state predicates.  They test for
++ * buffer_jbd() because they are used in core kernel code.
++ *
++ * These will be racy on SMP unless we're *sure* that the
++ * buffer won't be detached from the journalling system
++ * in parallel.
++ */
++
++/* Return true if the buffer is on journal list `list' */
++static inline int buffer_jlist_eq(struct buffer_head *bh, int list)
++{
++	return SPLICE_LOCK(buffer_jbd(bh), bh2jh(bh)->b_jlist == list);
++}
++
++/* Return true if this bufer is dirty wrt the journal */
++static inline int buffer_jdirty(struct buffer_head *bh)
++{
++	return buffer_jbd(bh) && __buffer_state(bh, JBDDirty);
++}
++
++/* Return true if it's a data buffer which journalling is managing */
++static inline int buffer_jbd_data(struct buffer_head *bh)
++{
++	return SPLICE_LOCK(buffer_jbd(bh),
++			bh2jh(bh)->b_jlist == BJ_SyncData ||
++			bh2jh(bh)->b_jlist == BJ_AsyncData);
++}
++
++#ifdef CONFIG_SMP
++#define assert_spin_locked(lock)	J_ASSERT(spin_is_locked(lock))
++#else
++#define assert_spin_locked(lock)	do {} while(0)
++#endif
++
++#define buffer_trace_init(bh)	do {} while (0)
++#define print_buffer_fields(bh)	do {} while (0)
++#define print_buffer_trace(bh)	do {} while (0)
++#define BUFFER_TRACE(bh, info)	do {} while (0)
++#define BUFFER_TRACE2(bh, bh2, info)	do {} while (0)
++#define JBUFFER_TRACE(jh, info)	do {} while (0)
++
++#endif	/* __KERNEL__ */
++
++#endif	/* CONFIG_JBD || CONFIG_JBD_MODULE || !__KERNEL__ */
++
++/*
++ * Compatibility no-ops which allow the kernel to compile without CONFIG_JBD
++ * go here.
++ */
++
++#if defined(__KERNEL__) && !(defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE))
++
++#define J_ASSERT(expr)			do {} while (0)
++#define J_ASSERT_BH(bh, expr)		do {} while (0)
++#define buffer_jbd(bh)			0
++#define buffer_jlist_eq(bh, val)	0
++#define journal_buffer_journal_lru(bh)	0
++
++#endif	/* defined(__KERNEL__) && !defined(CONFIG_JBD) */
++#endif	/* _LINUX_JBD_H */
+diff -Naur silo-1.4.11.orig/libext2fs/kernel-list.h silo-1.4.11/libext2fs/kernel-list.h
+--- silo-1.4.11.orig/libext2fs/kernel-list.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/kernel-list.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,112 @@
++#ifndef _LINUX_LIST_H
++#define _LINUX_LIST_H
++
++/*
++ * Simple doubly linked list implementation.
++ *
++ * Some of the internal functions ("__xxx") are useful when
++ * manipulating whole lists rather than single entries, as
++ * sometimes we already know the next/prev entries and we can
++ * generate better code by using them directly rather than
++ * using the generic single-entry routines.
++ */
++
++struct list_head {
++	struct list_head *next, *prev;
++};
++
++#define LIST_HEAD_INIT(name) { &(name), &(name) }
++
++#define LIST_HEAD(name) \
++	struct list_head name = { &name, &name }
++
++#define INIT_LIST_HEAD(ptr) do { \
++	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
++} while (0)
++
++#if (!defined(__GNUC__) && !defined(__WATCOMC__))
++#define __inline__
++#endif
++
++/*
++ * Insert a new entry between two known consecutive entries. 
++ *
++ * This is only for internal list manipulation where we know
++ * the prev/next entries already!
++ */
++static __inline__ void __list_add(struct list_head * new,
++	struct list_head * prev,
++	struct list_head * next)
++{
++	next->prev = new;
++	new->next = next;
++	new->prev = prev;
++	prev->next = new;
++}
++
++/*
++ * Insert a new entry after the specified head..
++ */
++static __inline__ void list_add(struct list_head *new, struct list_head *head)
++{
++	__list_add(new, head, head->next);
++}
++
++/*
++ * Insert a new entry at the tail
++ */
++static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
++{
++	__list_add(new, head->prev, head);
++}
++
++/*
++ * Delete a list entry by making the prev/next entries
++ * point to each other.
++ *
++ * This is only for internal list manipulation where we know
++ * the prev/next entries already!
++ */
++static __inline__ void __list_del(struct list_head * prev,
++				  struct list_head * next)
++{
++	next->prev = prev;
++	prev->next = next;
++}
++
++static __inline__ void list_del(struct list_head *entry)
++{
++	__list_del(entry->prev, entry->next);
++}
++
++static __inline__ int list_empty(struct list_head *head)
++{
++	return head->next == head;
++}
++
++/*
++ * Splice in "list" into "head"
++ */
++static __inline__ void list_splice(struct list_head *list, struct list_head *head)
++{
++	struct list_head *first = list->next;
++
++	if (first != list) {
++		struct list_head *last = list->prev;
++		struct list_head *at = head->next;
++
++		first->prev = head;
++		head->next = first;
++
++		last->next = at;
++		at->prev = last;
++	}
++}
++
++#define list_entry(ptr, type, member) \
++	((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
++
++#define list_for_each(pos, head) \
++        for (pos = (head)->next; pos != (head); pos = pos->next)
++
++#endif
+diff -Naur silo-1.4.11.orig/libext2fs/link.c silo-1.4.11/libext2fs/link.c
+--- silo-1.4.11.orig/libext2fs/link.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/link.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,134 @@
++/*
++ * link.c --- create links in a ext2fs directory
++ * 
++ * Copyright (C) 1993, 1994 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct link_struct  {
++	const char	*name;
++	int		namelen;
++	ext2_ino_t	inode;
++	int		flags;
++	int		done;
++	struct ext2_super_block *sb;
++};	
++
++static int link_proc(struct ext2_dir_entry *dirent,
++		     int	offset,
++		     int	blocksize,
++		     char	*buf,
++		     void	*priv_data)
++{
++	struct link_struct *ls = (struct link_struct *) priv_data;
++	struct ext2_dir_entry *next;
++	int rec_len, min_rec_len;
++	int ret = 0;
++
++	rec_len = EXT2_DIR_REC_LEN(ls->namelen);
++
++	/*
++	 * See if the following directory entry (if any) is unused;
++	 * if so, absorb it into this one.
++	 */
++	next = (struct ext2_dir_entry *) (buf + offset + dirent->rec_len);
++	if ((offset + dirent->rec_len < blocksize - 8) &&
++	    (next->inode == 0) &&
++	    (offset + dirent->rec_len + next->rec_len <= blocksize)) {
++		dirent->rec_len += next->rec_len;
++		ret = DIRENT_CHANGED;
++	}
++
++	/*
++	 * If the directory entry is used, see if we can split the
++	 * directory entry to make room for the new name.  If so,
++	 * truncate it and return.
++	 */
++	if (dirent->inode) {
++		min_rec_len = EXT2_DIR_REC_LEN(dirent->name_len & 0xFF);
++		if (dirent->rec_len < (min_rec_len + rec_len))
++			return ret;
++		rec_len = dirent->rec_len - min_rec_len;
++		dirent->rec_len = min_rec_len;
++		next = (struct ext2_dir_entry *) (buf + offset +
++						  dirent->rec_len);
++		next->inode = 0;
++		next->name_len = 0;
++		next->rec_len = rec_len;
++		return DIRENT_CHANGED;
++	}
++
++	/*
++	 * If we get this far, then the directory entry is not used.
++	 * See if we can fit the request entry in.  If so, do it.
++	 */
++	if (dirent->rec_len < rec_len)
++		return ret;
++	dirent->inode = ls->inode;
++	dirent->name_len = ls->namelen;
++	strncpy(dirent->name, ls->name, ls->namelen);
++	if (ls->sb->s_feature_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE)
++		dirent->name_len |= (ls->flags & 0x7) << 8;
++
++	ls->done++;
++	return DIRENT_ABORT|DIRENT_CHANGED;
++}
++
++/*
++ * Note: the low 3 bits of the flags field are used as the directory
++ * entry filetype.
++ */
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, 
++		      ext2_ino_t ino, int flags)
++{
++	errcode_t		retval;
++	struct link_struct	ls;
++	struct ext2_inode	inode;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++
++	ls.name = name;
++	ls.namelen = name ? strlen(name) : 0;
++	ls.inode = ino;
++	ls.flags = flags;
++	ls.done = 0;
++	ls.sb = fs->super;
++
++	retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY,
++				    0, link_proc, &ls);
++	if (retval)
++		return retval;
++
++	if (!ls.done)
++		return EXT2_ET_DIR_NO_SPACE;
++
++	if ((retval = ext2fs_read_inode(fs, dir, &inode)) != 0)
++		return retval;
++
++	if (inode.i_flags & EXT2_INDEX_FL) {
++		inode.i_flags &= ~EXT2_INDEX_FL;
++		if ((retval = ext2fs_write_inode(fs, dir, &inode)) != 0)
++			return retval;
++	}
++
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/llseek.c silo-1.4.11/libext2fs/llseek.c
+--- silo-1.4.11.orig/libext2fs/llseek.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/llseek.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,138 @@
++/*
++ * llseek.c -- stub calling the llseek system call
++ *
++ * Copyright (C) 1994, 1995, 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#define _LARGEFILE_SOURCE
++#define _LARGEFILE64_SOURCE
++
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#ifdef __MSDOS__
++#include <io.h>
++#endif
++#include "et/com_err.h"
++#include "ext2fs/ext2_io.h"
++
++#ifdef __linux__
++
++#if defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
++
++#define my_llseek lseek64
++
++#else
++#if defined(HAVE_LLSEEK)
++#include <syscall.h>
++
++#ifndef HAVE_LLSEEK_PROTOTYPE
++extern long long llseek (int fd, long long offset, int origin);
++#endif
++
++#define my_llseek llseek
++
++#else	/* ! HAVE_LLSEEK */
++
++#if defined(__alpha__) || defined (__ia64__)
++
++#define llseek lseek
++
++#else /* !__alpha__ && !__ia64__*/
++
++#include <linux/unistd.h>
++
++#ifndef __NR__llseek
++#define __NR__llseek            140
++#endif
++
++#ifndef __i386__
++static int _llseek (unsigned int, unsigned long,
++		   unsigned long, ext2_loff_t *, unsigned int);
++
++static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
++		 unsigned long, offset_low,ext2_loff_t *,result,
++		 unsigned int, origin)
++#endif
++
++static ext2_loff_t my_llseek (int fd, ext2_loff_t offset, int origin)
++{
++	ext2_loff_t result;
++	int retval;
++
++#ifndef __i386__
++	retval = _llseek(fd, ((unsigned long long) offset) >> 32,
++#else			  
++	retval = syscall(__NR__llseek, fd, (unsigned long long) (offset >> 32),
++#endif
++			  ((unsigned long long) offset) & 0xffffffff,
++			&result, origin);
++	return (retval == -1 ? (ext2_loff_t) retval : result);
++}
++
++#endif	/* __alpha__ || __ia64__ */
++
++#endif /* HAVE_LLSEEK */
++#endif /* defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE) */
++
++ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
++{
++	ext2_loff_t result;
++	static int do_compat = 0;
++
++	if ((sizeof(off_t) >= sizeof(ext2_loff_t)) ||
++	    (offset < ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1))))
++		return lseek(fd, (off_t) offset, origin);
++
++	if (do_compat) {
++		errno = EINVAL;
++		return -1;
++	}
++	
++	result = my_llseek (fd, offset, origin);
++	if (result == -1 && errno == ENOSYS) {
++		/*
++		 * Just in case this code runs on top of an old kernel
++		 * which does not support the llseek system call
++		 */
++		do_compat++;
++		errno = EINVAL;
++	}
++	return result;
++}
++
++#else /* !linux */
++
++#ifndef EINVAL
++#define EINVAL EXT2_ET_INVALID_ARGUMENT
++#endif
++
++ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
++{
++#if defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
++	return lseek64 (fd, offset, origin);
++#else
++	if ((sizeof(off_t) < sizeof(ext2_loff_t)) &&
++	    (offset >= ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))) {
++		errno = EINVAL;
++		return -1;
++	}
++	return lseek (fd, (off_t) offset, origin);
++#endif
++}
++
++#endif 	/* linux */
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/lookup.c silo-1.4.11/libext2fs/lookup.c
+--- silo-1.4.11.orig/libext2fs/lookup.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/lookup.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,69 @@
++/*
++ * lookup.c --- ext2fs directory lookup operations
++ * 
++ * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct lookup_struct  {
++	const char	*name;
++	int		len;
++	ext2_ino_t	*inode;
++	int		found;
++};	
++
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int lookup_proc(struct ext2_dir_entry *dirent,
++		       int	offset EXT2FS_ATTR((unused)),
++		       int	blocksize EXT2FS_ATTR((unused)),
++		       char	*buf EXT2FS_ATTR((unused)),
++		       void	*priv_data)
++{
++	struct lookup_struct *ls = (struct lookup_struct *) priv_data;
++
++	if (ls->len != (dirent->name_len & 0xFF))
++		return 0;
++	if (strncmp(ls->name, dirent->name, (dirent->name_len & 0xFF)))
++		return 0;
++	*ls->inode = dirent->inode;
++	ls->found++;
++	return DIRENT_ABORT;
++}
++
++
++errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
++			int namelen, char *buf, ext2_ino_t *inode)
++{
++	errcode_t	retval;
++	struct lookup_struct ls;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	ls.name = name;
++	ls.len = namelen;
++	ls.inode = inode;
++	ls.found = 0;
++
++	retval = ext2fs_dir_iterate(fs, dir, 0, buf, lookup_proc, &ls);
++	if (retval)
++		return retval;
++
++	return (ls.found) ? 0 : EXT2_ET_FILE_NOT_FOUND;
++}
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/mkdir.c silo-1.4.11/libext2fs/mkdir.c
+--- silo-1.4.11.orig/libext2fs/mkdir.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/mkdir.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,142 @@
++/*
++ * mkdir.c --- make a directory in the filesystem
++ * 
++ * Copyright (C) 1994, 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#ifndef EXT2_FT_DIR
++#define EXT2_FT_DIR		2
++#endif
++
++errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
++		       const char *name)
++{
++	errcode_t		retval;
++	struct ext2_inode	parent_inode, inode;
++	ext2_ino_t		ino = inum;
++	ext2_ino_t		scratch_ino;
++	blk_t			blk;
++	char			*block = 0;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	/*
++	 * Allocate an inode, if necessary
++	 */
++	if (!ino) {
++		retval = ext2fs_new_inode(fs, parent, LINUX_S_IFDIR | 0755,
++					  0, &ino);
++		if (retval)
++			goto cleanup;
++	}
++
++	/*
++	 * Allocate a data block for the directory
++	 */
++	retval = ext2fs_new_block(fs, 0, 0, &blk);
++	if (retval)
++		goto cleanup;
++
++	/*
++	 * Create a scratch template for the directory
++	 */
++	retval = ext2fs_new_dir_block(fs, ino, parent, &block);
++	if (retval)
++		goto cleanup;
++
++	/*
++	 * Get the parent's inode, if necessary
++	 */
++	if (parent != ino) {
++		retval = ext2fs_read_inode(fs, parent, &parent_inode);
++		if (retval)
++			goto cleanup;
++	} else
++		memset(&parent_inode, 0, sizeof(parent_inode));
++
++	/*
++	 * Create the inode structure....
++	 */
++	memset(&inode, 0, sizeof(struct ext2_inode));
++	inode.i_mode = LINUX_S_IFDIR | (0777 & ~fs->umask);
++	inode.i_uid = inode.i_gid = 0;
++	inode.i_blocks = fs->blocksize / 512;
++	inode.i_block[0] = blk;
++	inode.i_links_count = 2;
++	inode.i_ctime = inode.i_atime = inode.i_mtime = time(NULL);
++	inode.i_size = fs->blocksize;
++
++	/*
++	 * Write out the inode and inode data block
++	 */
++	retval = ext2fs_write_dir_block(fs, blk, block);
++	if (retval)
++		goto cleanup;
++	retval = ext2fs_write_new_inode(fs, ino, &inode); 
++	if (retval)
++		goto cleanup;
++
++	/*
++	 * Link the directory into the filesystem hierarchy
++	 */
++	if (name) {
++		retval = ext2fs_lookup(fs, parent, name, strlen(name), 0,
++				       &scratch_ino);
++		if (!retval) {
++			retval = EXT2_ET_DIR_EXISTS;
++			name = 0;
++			goto cleanup;
++		}
++		if (retval != EXT2_ET_FILE_NOT_FOUND)
++			goto cleanup;
++		retval = ext2fs_link(fs, parent, name, ino, EXT2_FT_DIR);
++		if (retval)
++			goto cleanup;
++	}
++
++	/*
++	 * Update parent inode's counts
++	 */
++	if (parent != ino) {
++		parent_inode.i_links_count++;
++		retval = ext2fs_write_inode(fs, parent, &parent_inode);
++		if (retval)
++			goto cleanup;
++	}
++	
++	/*
++	 * Update accounting....
++	 */
++	ext2fs_block_alloc_stats(fs, blk, +1);
++	ext2fs_inode_alloc_stats2(fs, ino, +1, 1);
++
++cleanup:
++	if (block)
++		ext2fs_free_mem(&block);
++	return retval;
++
++}
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/mkjournal.c silo-1.4.11/libext2fs/mkjournal.c
+--- silo-1.4.11.orig/libext2fs/mkjournal.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/mkjournal.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,425 @@
++/*
++ * mkjournal.c --- make a journal for a filesystem
++ *
++ * Copyright (C) 2000 Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#if HAVE_SYS_IOCTL_H
++#include <sys/ioctl.h>
++#endif
++#if HAVE_NETINET_IN_H
++#include <netinet/in.h>
++#endif
++
++#include "ext2_fs.h"
++#include "e2p/e2p.h"
++#include "ext2fs.h"
++#include "jfs_user.h"
++
++/*
++ * This function automatically sets up the journal superblock and
++ * returns it as an allocated block.
++ */
++errcode_t ext2fs_create_journal_superblock(ext2_filsys fs,
++					   __u32 size, int flags,
++					   char  **ret_jsb)
++{
++	errcode_t		retval;
++	journal_superblock_t	*jsb;
++
++	if (size < 1024)
++		return EXT2_ET_JOURNAL_TOO_SMALL;
++
++	if ((retval = ext2fs_get_mem(fs->blocksize, &jsb)))
++		return retval;
++
++	memset (jsb, 0, fs->blocksize);
++
++	jsb->s_header.h_magic = htonl(JFS_MAGIC_NUMBER);
++	if (flags & EXT2_MKJOURNAL_V1_SUPER)
++		jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V1);
++	else
++		jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
++	jsb->s_blocksize = htonl(fs->blocksize);
++	jsb->s_maxlen = htonl(size);
++	jsb->s_nr_users = htonl(1);
++	jsb->s_first = htonl(1);
++	jsb->s_sequence = htonl(1);
++	memcpy(jsb->s_uuid, fs->super->s_uuid, sizeof(fs->super->s_uuid));
++	/*
++	 * If we're creating an external journal device, we need to
++	 * adjust these fields.
++	 */
++	if (fs->super->s_feature_incompat &
++	    EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
++		jsb->s_nr_users = 0;
++		if (fs->blocksize == 1024)
++			jsb->s_first = htonl(3);
++		else
++			jsb->s_first = htonl(2);
++	}
++
++	*ret_jsb = (char *) jsb;
++	return 0;
++}
++
++/*
++ * This function writes a journal using POSIX routines.  It is used
++ * for creating external journals and creating journals on live
++ * filesystems.
++ */
++static errcode_t write_journal_file(ext2_filsys fs, char *filename,
++				    blk_t size, int flags)
++{
++	errcode_t	retval;
++	char		*buf = 0;
++	int		fd, ret_size;
++	blk_t		i;
++
++	if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf)))
++		return retval;
++
++	/* Open the device or journal file */
++	if ((fd = open(filename, O_WRONLY)) < 0) {
++		retval = errno;
++		goto errout;
++	}
++
++	/* Write the superblock out */
++	retval = EXT2_ET_SHORT_WRITE;
++	ret_size = write(fd, buf, fs->blocksize);
++	if (ret_size < 0) {
++		retval = errno;
++		goto errout;
++	}
++	if (ret_size != (int) fs->blocksize)
++		goto errout;
++	memset(buf, 0, fs->blocksize);
++
++	for (i = 1; i < size; i++) {
++		ret_size = write(fd, buf, fs->blocksize);
++		if (ret_size < 0) {
++			retval = errno;
++			goto errout;
++		}
++		if (ret_size != (int) fs->blocksize)
++			goto errout;
++	}
++	close(fd);
++
++	retval = 0;
++errout:
++	ext2fs_free_mem(&buf);
++	return retval;
++}
++
++/*
++ * Helper function for creating the journal using direct I/O routines
++ */
++struct mkjournal_struct {
++	int		num_blocks;
++	int		newblocks;
++	char		*buf;
++	errcode_t	err;
++};
++
++static int mkjournal_proc(ext2_filsys	fs,
++			   blk_t	*blocknr,
++			   e2_blkcnt_t	blockcnt,
++			   blk_t	ref_block EXT2FS_ATTR((unused)),
++			   int		ref_offset EXT2FS_ATTR((unused)),
++			   void		*priv_data)
++{
++	struct mkjournal_struct *es = (struct mkjournal_struct *) priv_data;
++	blk_t	new_blk;
++	static blk_t	last_blk = 0;
++	errcode_t	retval;
++	
++	if (*blocknr) {
++		last_blk = *blocknr;
++		return 0;
++	}
++	retval = ext2fs_new_block(fs, last_blk, 0, &new_blk);
++	if (retval) {
++		es->err = retval;
++		return BLOCK_ABORT;
++	}
++	if (blockcnt > 0)
++		es->num_blocks--;
++
++	es->newblocks++;
++	retval = io_channel_write_blk(fs->io, new_blk, 1, es->buf);
++
++	if (blockcnt == 0)
++		memset(es->buf, 0, fs->blocksize);
++
++	if (retval) {
++		es->err = retval;
++		return BLOCK_ABORT;
++	}
++	*blocknr = new_blk;
++	last_blk = new_blk;
++	ext2fs_block_alloc_stats(fs, new_blk, +1);
++
++	if (es->num_blocks == 0)
++		return (BLOCK_CHANGED | BLOCK_ABORT);
++	else
++		return BLOCK_CHANGED;
++	
++}
++
++/*
++ * This function creates a journal using direct I/O routines.
++ */
++static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino,
++				     blk_t size, int flags)
++{
++	char			*buf;
++	errcode_t		retval;
++	struct ext2_inode	inode;
++	struct mkjournal_struct	es;
++
++	if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf)))
++		return retval;
++	
++	if ((retval = ext2fs_read_bitmaps(fs)))
++		return retval;
++
++	if ((retval = ext2fs_read_inode(fs, journal_ino, &inode)))
++		return retval;
++
++	if (inode.i_blocks > 0)
++		return EEXIST;
++
++	es.num_blocks = size;
++	es.newblocks = 0;
++	es.buf = buf;
++	es.err = 0;
++
++	retval = ext2fs_block_iterate2(fs, journal_ino, BLOCK_FLAG_APPEND,
++				       0, mkjournal_proc, &es);
++	if (es.err) {
++		retval = es.err;
++		goto errout;
++	}
++
++	if ((retval = ext2fs_read_inode(fs, journal_ino, &inode)))
++		goto errout;
++
++ 	inode.i_size += fs->blocksize * size;
++	inode.i_blocks += (fs->blocksize / 512) * es.newblocks;
++	inode.i_mtime = inode.i_ctime = time(0);
++	inode.i_links_count = 1;
++	inode.i_mode = LINUX_S_IFREG | 0600;
++
++	if ((retval = ext2fs_write_inode(fs, journal_ino, &inode)))
++		goto errout;
++	retval = 0;
++
++	memcpy(fs->super->s_jnl_blocks, inode.i_block, EXT2_N_BLOCKS*4);
++	fs->super->s_jnl_blocks[16] = inode.i_size;
++	fs->super->s_jnl_backup_type = EXT3_JNL_BACKUP_BLOCKS;
++	ext2fs_mark_super_dirty(fs);
++
++errout:
++	ext2fs_free_mem(&buf);
++	return retval;
++}
++
++/*
++ * This function adds a journal device to a filesystem
++ */
++errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev)
++{
++	struct stat	st;
++	errcode_t	retval;
++	char		buf[1024];
++	journal_superblock_t	*jsb;
++	int		start;
++	__u32		i, nr_users;
++
++	/* Make sure the device exists and is a block device */
++	if (stat(journal_dev->device_name, &st) < 0)
++		return errno;
++	
++	if (!S_ISBLK(st.st_mode))
++		return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */
++
++	/* Get the journal superblock */
++	start = 1;
++	if (journal_dev->blocksize == 1024)
++		start++;
++	if ((retval = io_channel_read_blk(journal_dev->io, start, -1024, buf)))
++		return retval;
++
++	jsb = (journal_superblock_t *) buf;
++	if ((jsb->s_header.h_magic != (unsigned) ntohl(JFS_MAGIC_NUMBER)) ||
++	    (jsb->s_header.h_blocktype != (unsigned) ntohl(JFS_SUPERBLOCK_V2)))
++		return EXT2_ET_NO_JOURNAL_SB;
++
++	if (ntohl(jsb->s_blocksize) != (unsigned long) fs->blocksize)
++		return EXT2_ET_UNEXPECTED_BLOCK_SIZE;
++
++	/* Check and see if this filesystem has already been added */
++	nr_users = ntohl(jsb->s_nr_users);
++	for (i=0; i < nr_users; i++) {
++		if (memcmp(fs->super->s_uuid,
++			   &jsb->s_users[i*16], 16) == 0)
++			break;
++	}
++	if (i >= nr_users) {
++		memcpy(&jsb->s_users[nr_users*16],
++		       fs->super->s_uuid, 16);
++		jsb->s_nr_users = htonl(nr_users+1);
++	}
++
++	/* Writeback the journal superblock */
++	if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf)))
++		return retval;
++	
++	fs->super->s_journal_inum = 0;
++	fs->super->s_journal_dev = st.st_rdev;
++	memcpy(fs->super->s_journal_uuid, jsb->s_uuid,
++	       sizeof(fs->super->s_journal_uuid));
++	fs->super->s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL;
++	ext2fs_mark_super_dirty(fs);
++	return 0;
++}
++
++/*
++ * This function adds a journal inode to a filesystem, using either
++ * POSIX routines if the filesystem is mounted, or using direct I/O
++ * functions if it is not.
++ */
++errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
++{
++	errcode_t		retval;
++	ext2_ino_t		journal_ino;
++	struct stat		st;
++	char			jfile[1024];
++	int			fd, mount_flags, f;
++
++	if ((retval = ext2fs_check_mount_point(fs->device_name, &mount_flags,
++					       jfile, sizeof(jfile)-10)))
++		return retval;
++
++	if (mount_flags & EXT2_MF_MOUNTED) {
++		strcat(jfile, "/.journal");
++
++		/*
++		 * If .../.journal already exists, make sure any 
++		 * immutable or append-only flags are cleared.
++		 */
++#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP)
++		(void) chflags (jfile, 0);
++#else
++#if HAVE_EXT2_IOCTLS
++		fd = open(jfile, O_RDONLY);
++		if (fd >= 0) {
++			f = 0;
++			ioctl(fd, EXT2_IOC_SETFLAGS, &f);
++			close(fd);
++		}
++#endif
++#endif
++
++		/* Create the journal file */
++		if ((fd = open(jfile, O_CREAT|O_WRONLY, 0600)) < 0)
++			return errno;
++
++		if ((retval = write_journal_file(fs, jfile, size, flags)))
++			goto errout;
++		
++		/* Get inode number of the journal file */
++		if (fstat(fd, &st) < 0)
++			goto errout;
++
++#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP)
++		retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE);
++#else
++#if HAVE_EXT2_IOCTLS
++		f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;
++		retval = ioctl(fd, EXT2_IOC_SETFLAGS, &f);
++#endif
++#endif
++		if (retval)
++			goto errout;
++		
++		close(fd);
++		journal_ino = st.st_ino;
++	} else {
++		journal_ino = EXT2_JOURNAL_INO;
++		if ((retval = write_journal_inode(fs, journal_ino,
++						  size, flags)))
++			return retval;
++	}
++	
++	fs->super->s_journal_inum = journal_ino;
++	fs->super->s_journal_dev = 0;
++	memset(fs->super->s_journal_uuid, 0,
++	       sizeof(fs->super->s_journal_uuid));
++	fs->super->s_feature_compat |= EXT3_FEATURE_COMPAT_HAS_JOURNAL;
++
++	ext2fs_mark_super_dirty(fs);
++	return 0;
++errout:
++	close(fd);
++	return retval;
++}
++
++#ifdef DEBUG
++main(int argc, char **argv)
++{
++	errcode_t	retval;
++	char		*device_name;
++	ext2_filsys 	fs;
++
++	if (argc < 2) {
++		fprintf(stderr, "Usage: %s filesystem\n", argv[0]);
++		exit(1);
++	}
++	device_name = argv[1];
++	
++	retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0,
++			      unix_io_manager, &fs);
++	if (retval) {
++		com_err(argv[0], retval, "while opening %s", device_name);
++		exit(1);
++	}
++
++	retval = ext2fs_add_journal_inode(fs, 1024);
++	if (retval) {
++		com_err(argv[0], retval, "while adding journal to %s",
++			device_name);
++		exit(1);
++	}
++	retval = ext2fs_flush(fs);
++	if (retval) {
++		printf("Warning, had trouble writing out superblocks.\n");
++	}
++	ext2fs_close(fs);
++	exit(0);
++	
++}
++#endif
+diff -Naur silo-1.4.11.orig/libext2fs/namei.c silo-1.4.11/libext2fs/namei.c
+--- silo-1.4.11.orig/libext2fs/namei.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/namei.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,205 @@
++/*
++ * namei.c --- ext2fs directory lookup operations
++ * 
++ * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++/* #define NAMEI_DEBUG */
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
++			    const char *pathname, size_t pathlen, int follow,
++			    int link_count, char *buf, ext2_ino_t *res_inode);
++
++static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
++			     ext2_ino_t inode, int link_count,
++			     char *buf, ext2_ino_t *res_inode)
++{
++	char *pathname;
++	char *buffer = 0;
++	errcode_t retval;
++	struct ext2_inode ei;
++
++#ifdef NAMEI_DEBUG
++	printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n",
++	       root, dir, inode, link_count);
++	
++#endif
++	retval = ext2fs_read_inode (fs, inode, &ei);
++	if (retval) return retval;
++	if (!LINUX_S_ISLNK (ei.i_mode)) {
++		*res_inode = inode;
++		return 0;
++	}
++	if (link_count++ > 5) {
++		return EXT2_ET_SYMLINK_LOOP;
++	}
++	if (ext2fs_inode_data_blocks(fs,&ei)) {
++		retval = ext2fs_get_mem(fs->blocksize, &buffer);
++		if (retval)
++			return retval;
++		retval = io_channel_read_blk(fs->io, ei.i_block[0], 1, buffer);
++		if (retval) {
++			ext2fs_free_mem(&buffer);
++			return retval;
++		}
++		pathname = buffer;
++	} else
++		pathname = (char *)&(ei.i_block[0]);
++	retval = open_namei(fs, root, dir, pathname, ei.i_size, 1,
++			    link_count, buf, res_inode);
++	if (buffer)
++		ext2fs_free_mem(&buffer);
++	return retval;
++}
++
++/*
++ * This routine interprets a pathname in the context of the current
++ * directory and the root directory, and returns the inode of the
++ * containing directory, and a pointer to the filename of the file
++ * (pointing into the pathname) and the length of the filename.
++ */
++static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
++			   const char *pathname, int pathlen,
++			   int link_count, char *buf,
++			   const char **name, int *namelen,
++			   ext2_ino_t *res_inode)
++{
++	char c;
++	const char *thisname;
++	int len;
++	ext2_ino_t inode;
++	errcode_t retval;
++
++	if ((c = *pathname) == '/') {
++        	dir = root;
++		pathname++;
++		pathlen--;
++	}
++	while (1) {
++        	thisname = pathname;
++		for (len=0; --pathlen >= 0;len++) {
++			c = *(pathname++);
++			if (c == '/')
++				break;
++		}
++		if (pathlen < 0)
++			break;
++		retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode);
++		if (retval) return retval;
++        	retval = follow_link (fs, root, dir, inode,
++				      link_count, buf, &dir);
++        	if (retval) return retval;
++    	}
++	*name = thisname;
++	*namelen = len;
++	*res_inode = dir;
++	return 0;
++}
++
++static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
++			    const char *pathname, size_t pathlen, int follow,
++			    int link_count, char *buf, ext2_ino_t *res_inode)
++{
++	const char *basename;
++	int namelen;
++	ext2_ino_t dir, inode;
++	errcode_t retval;
++
++#ifdef NAMEI_DEBUG
++	printf("open_namei: root=%lu, dir=%lu, path=%*s, lc=%d\n",
++	       root, base, pathlen, pathname, link_count);
++#endif
++	retval = dir_namei(fs, root, base, pathname, pathlen,
++			   link_count, buf, &basename, &namelen, &dir);
++	if (retval) return retval;
++	if (!namelen) {                     /* special case: '/usr/' etc */
++		*res_inode=dir;
++		return 0;
++	}
++	retval = ext2fs_lookup (fs, dir, basename, namelen, buf, &inode);
++	if (retval)
++		return retval;
++	if (follow) {
++		retval = follow_link(fs, root, dir, inode, link_count,
++				     buf, &inode);
++		if (retval)
++			return retval;
++	}
++#ifdef NAMEI_DEBUG
++	printf("open_namei: (link_count=%d) returns %lu\n",
++	       link_count, inode);
++#endif
++	*res_inode = inode;
++	return 0;
++}
++
++errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
++		       const char *name, ext2_ino_t *inode)
++{
++	char *buf;
++	errcode_t retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	retval = ext2fs_get_mem(fs->blocksize, &buf);
++	if (retval)
++		return retval;
++	
++	retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0,
++			    buf, inode);
++
++	ext2fs_free_mem(&buf);
++	return retval;
++}
++
++errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
++			      const char *name, ext2_ino_t *inode)
++{
++	char *buf;
++	errcode_t retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	retval = ext2fs_get_mem(fs->blocksize, &buf);
++	if (retval)
++		return retval;
++	
++	retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0,
++			    buf, inode);
++
++	ext2fs_free_mem(&buf);
++	return retval;
++}
++
++errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
++			ext2_ino_t inode, ext2_ino_t *res_inode)
++{
++	char *buf;
++	errcode_t retval;
++	
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	retval = ext2fs_get_mem(fs->blocksize, &buf);
++	if (retval)
++		return retval;
++
++	retval = follow_link(fs, root, cwd, inode, 0, buf, res_inode);
++
++	ext2fs_free_mem(&buf);
++	return retval;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/native.c silo-1.4.11/libext2fs/native.c
+--- silo-1.4.11.orig/libext2fs/native.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/native.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,27 @@
++/*
++ * native.c --- returns the ext2_flag for a native byte order
++ * 
++ * Copyright (C) 1996 Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++int ext2fs_native_flag(void)
++{
++#ifdef WORDS_BIGENDIAN
++	return EXT2_FLAG_SWAP_BYTES;
++#else
++	return 0;
++#endif
++}
++
++	
++	
+diff -Naur silo-1.4.11.orig/libext2fs/newdir.c silo-1.4.11/libext2fs/newdir.c
+--- silo-1.4.11.orig/libext2fs/newdir.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/newdir.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,72 @@
++/*
++ * newdir.c --- create a new directory block
++ * 
++ * Copyright (C) 1994, 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#ifndef EXT2_FT_DIR
++#define EXT2_FT_DIR		2
++#endif
++
++/*
++ * Create new directory block
++ */
++errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
++			       ext2_ino_t parent_ino, char **block)
++{
++	struct ext2_dir_entry 	*dir = NULL;
++	errcode_t		retval;
++	char			*buf;
++	int			rec_len;
++	int			filetype = 0;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	retval = ext2fs_get_mem(fs->blocksize, &buf);
++	if (retval)
++		return retval;
++	memset(buf, 0, fs->blocksize);
++	dir = (struct ext2_dir_entry *) buf;
++	dir->rec_len = fs->blocksize;
++
++	if (dir_ino) {
++		if (fs->super->s_feature_incompat &
++		    EXT2_FEATURE_INCOMPAT_FILETYPE)
++			filetype = EXT2_FT_DIR << 8;
++		/*
++		 * Set up entry for '.'
++		 */
++		dir->inode = dir_ino;
++		dir->name_len = 1 | filetype;
++		dir->name[0] = '.';
++		rec_len = dir->rec_len - EXT2_DIR_REC_LEN(1);
++		dir->rec_len = EXT2_DIR_REC_LEN(1);
++
++		/*
++		 * Set up entry for '..'
++		 */
++		dir = (struct ext2_dir_entry *) (buf + dir->rec_len);
++		dir->rec_len = rec_len;
++		dir->inode = parent_ino;
++		dir->name_len = 2 | filetype;
++		dir->name[0] = '.';
++		dir->name[1] = '.';
++		
++	}
++	*block = buf;
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/nt_io.c silo-1.4.11/libext2fs/nt_io.c
+--- silo-1.4.11.orig/libext2fs/nt_io.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/nt_io.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,1513 @@
++/*
++ * nt_io.c --- This is the Nt I/O interface to the I/O manager.
++ *
++ * Implements a one-block write-through cache.
++ *
++ * Copyright (C) 1993, 1994, 1995 Theodore Ts'o.
++ * Copyright (C) 1998 Andrey Shedel (andreys@ns.cr.cyco.com)
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++
++//
++// I need some warnings to disable...
++//
++
++
++#pragma warning(disable:4514) // unreferenced inline function has been removed
++#pragma warning(push,4)
++
++#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union)
++#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int
++#pragma warning(disable:4115) // named type definition in parentheses
++
++#include <ntddk.h>
++#include <ntdddisk.h>
++#include <ntstatus.h>
++
++#pragma warning(pop)
++
++
++//
++// Some native APIs.
++//
++
++NTSYSAPI
++ULONG
++NTAPI
++RtlNtStatusToDosError(
++    IN NTSTATUS Status
++   );
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtClose(
++    IN HANDLE Handle
++   );
++
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtOpenFile(
++    OUT PHANDLE FileHandle,
++    IN ACCESS_MASK DesiredAccess,
++    IN POBJECT_ATTRIBUTES ObjectAttributes,
++    OUT PIO_STATUS_BLOCK IoStatusBlock,
++    IN ULONG ShareAccess,
++    IN ULONG OpenOptions
++    );
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtFlushBuffersFile(
++    IN HANDLE FileHandle,
++    OUT PIO_STATUS_BLOCK IoStatusBlock
++   );
++
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtReadFile(
++    IN HANDLE FileHandle,
++    IN HANDLE Event OPTIONAL,
++    IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
++    IN PVOID ApcContext OPTIONAL,
++    OUT PIO_STATUS_BLOCK IoStatusBlock,
++    OUT PVOID Buffer,
++    IN ULONG Length,
++    IN PLARGE_INTEGER ByteOffset OPTIONAL,
++    IN PULONG Key OPTIONAL
++    );
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtWriteFile(
++    IN HANDLE FileHandle,
++    IN HANDLE Event OPTIONAL,
++    IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
++    IN PVOID ApcContext OPTIONAL,
++    OUT PIO_STATUS_BLOCK IoStatusBlock,
++    IN PVOID Buffer,
++    IN ULONG Length,
++    IN PLARGE_INTEGER ByteOffset OPTIONAL,
++    IN PULONG Key OPTIONAL
++    );
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtDeviceIoControlFile(
++    IN HANDLE FileHandle,
++    IN HANDLE Event OPTIONAL,
++    IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
++    IN PVOID ApcContext OPTIONAL,
++    OUT PIO_STATUS_BLOCK IoStatusBlock,
++    IN ULONG IoControlCode,
++    IN PVOID InputBuffer OPTIONAL,
++    IN ULONG InputBufferLength,
++    OUT PVOID OutputBuffer OPTIONAL,
++    IN ULONG OutputBufferLength
++    );
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtFsControlFile(
++    IN HANDLE FileHandle,
++    IN HANDLE Event OPTIONAL,
++    IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
++    IN PVOID ApcContext OPTIONAL,
++    OUT PIO_STATUS_BLOCK IoStatusBlock,
++    IN ULONG IoControlCode,
++    IN PVOID InputBuffer OPTIONAL,
++    IN ULONG InputBufferLength,
++    OUT PVOID OutputBuffer OPTIONAL,
++    IN ULONG OutputBufferLength
++    );
++
++
++NTSYSAPI
++NTSTATUS
++NTAPI
++NtDelayExecution(
++    IN BOOLEAN Alertable,
++    IN PLARGE_INTEGER Interval
++    );
++
++
++#define FSCTL_LOCK_VOLUME               CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
++#define FSCTL_UNLOCK_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
++#define FSCTL_DISMOUNT_VOLUME           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
++#define FSCTL_IS_VOLUME_MOUNTED         CTL_CODE(FILE_DEVICE_FILE_SYSTEM,10, METHOD_BUFFERED, FILE_ANY_ACCESS)
++
++
++//
++// useful macros
++//
++
++#define BooleanFlagOn(Flags,SingleFlag) ((BOOLEAN)((((Flags) & (SingleFlag)) != 0)))
++
++
++//
++// Include Win32 error codes.
++//
++
++#include <winerror.h>
++
++//
++// standard stuff
++//
++
++#include <assert.h>
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
++#include <malloc.h>
++
++#include <linux/types.h>
++#include "ext2_fs.h"
++#include <errno.h>
++
++#include "et/com_err.h"
++#include "ext2fs/ext2fs.h"
++#include "ext2fs/ext2_err.h"
++
++
++
++
++//
++// For checking structure magic numbers...
++//
++
++
++#define EXT2_CHECK_MAGIC(struct, code) \
++	  if ((struct)->magic != (code)) return (code)
++
++#define EXT2_ET_MAGIC_NT_IO_CHANNEL  0x10ed
++
++
++//
++// Private data block
++//
++
++typedef struct _NT_PRIVATE_DATA {
++	int	   magic;
++	HANDLE Handle;
++	int	   Flags;
++	PCHAR  Buffer;
++	__u32  BufferBlockNumber;
++	ULONG  BufferSize;
++	BOOLEAN OpenedReadonly;
++	BOOLEAN Written;
++}NT_PRIVATE_DATA, *PNT_PRIVATE_DATA;
++
++
++
++//
++// Standard interface prototypes
++//
++
++static errcode_t nt_open(const char *name, int flags, io_channel *channel);
++static errcode_t nt_close(io_channel channel);
++static errcode_t nt_set_blksize(io_channel channel, int blksize);
++static errcode_t nt_read_blk(io_channel channel, unsigned long block,
++			       int count, void *data);
++static errcode_t nt_write_blk(io_channel channel, unsigned long block,
++				int count, const void *data);
++static errcode_t nt_flush(io_channel channel);
++
++static struct struct_io_manager struct_nt_manager = {
++	EXT2_ET_MAGIC_IO_MANAGER,
++	"NT I/O Manager",
++	nt_open,
++	nt_close,
++	nt_set_blksize,
++	nt_read_blk,
++	nt_write_blk,
++	nt_flush
++};
++
++
++
++//
++// function to get API
++//
++
++io_manager nt_io_manager()
++{
++	return &struct_nt_manager;
++}
++
++
++
++
++
++//
++// This is a code to convert Win32 errors to unix errno
++//
++
++typedef struct {
++	ULONG WinError;
++	int errnocode;
++}ERROR_ENTRY;
++
++static ERROR_ENTRY ErrorTable[] = {
++        {  ERROR_INVALID_FUNCTION,       EINVAL    },
++        {  ERROR_FILE_NOT_FOUND,         ENOENT    },
++        {  ERROR_PATH_NOT_FOUND,         ENOENT    },
++        {  ERROR_TOO_MANY_OPEN_FILES,    EMFILE    },
++        {  ERROR_ACCESS_DENIED,          EACCES    },
++        {  ERROR_INVALID_HANDLE,         EBADF     },
++        {  ERROR_ARENA_TRASHED,          ENOMEM    },
++        {  ERROR_NOT_ENOUGH_MEMORY,      ENOMEM    },
++        {  ERROR_INVALID_BLOCK,          ENOMEM    },
++        {  ERROR_BAD_ENVIRONMENT,        E2BIG     },
++        {  ERROR_BAD_FORMAT,             ENOEXEC   },
++        {  ERROR_INVALID_ACCESS,         EINVAL    },
++        {  ERROR_INVALID_DATA,           EINVAL    },
++        {  ERROR_INVALID_DRIVE,          ENOENT    },
++        {  ERROR_CURRENT_DIRECTORY,      EACCES    },
++        {  ERROR_NOT_SAME_DEVICE,        EXDEV     },
++        {  ERROR_NO_MORE_FILES,          ENOENT    },
++        {  ERROR_LOCK_VIOLATION,         EACCES    },
++        {  ERROR_BAD_NETPATH,            ENOENT    },
++        {  ERROR_NETWORK_ACCESS_DENIED,  EACCES    },
++        {  ERROR_BAD_NET_NAME,           ENOENT    },
++        {  ERROR_FILE_EXISTS,            EEXIST    },
++        {  ERROR_CANNOT_MAKE,            EACCES    },
++        {  ERROR_FAIL_I24,               EACCES    },
++        {  ERROR_INVALID_PARAMETER,      EINVAL    },
++        {  ERROR_NO_PROC_SLOTS,          EAGAIN    },
++        {  ERROR_DRIVE_LOCKED,           EACCES    },
++        {  ERROR_BROKEN_PIPE,            EPIPE     },
++        {  ERROR_DISK_FULL,              ENOSPC    },
++        {  ERROR_INVALID_TARGET_HANDLE,  EBADF     },
++        {  ERROR_INVALID_HANDLE,         EINVAL    },
++        {  ERROR_WAIT_NO_CHILDREN,       ECHILD    },
++        {  ERROR_CHILD_NOT_COMPLETE,     ECHILD    },
++        {  ERROR_DIRECT_ACCESS_HANDLE,   EBADF     },
++        {  ERROR_NEGATIVE_SEEK,          EINVAL    },
++        {  ERROR_SEEK_ON_DEVICE,         EACCES    },
++        {  ERROR_DIR_NOT_EMPTY,          ENOTEMPTY },
++        {  ERROR_NOT_LOCKED,             EACCES    },
++        {  ERROR_BAD_PATHNAME,           ENOENT    },
++        {  ERROR_MAX_THRDS_REACHED,      EAGAIN    },
++        {  ERROR_LOCK_FAILED,            EACCES    },
++        {  ERROR_ALREADY_EXISTS,         EEXIST    },
++        {  ERROR_FILENAME_EXCED_RANGE,   ENOENT    },
++        {  ERROR_NESTING_NOT_ALLOWED,    EAGAIN    },
++        {  ERROR_NOT_ENOUGH_QUOTA,       ENOMEM    }
++};
++
++
++
++
++static
++unsigned
++_MapDosError (
++    IN ULONG WinError
++   )
++{
++	int i;
++
++	//
++	// Lookup
++	//
++
++	for (i = 0; i < (sizeof(ErrorTable)/sizeof(ErrorTable[0])); ++i)
++	{
++		if (WinError == ErrorTable[i].WinError)
++		{
++			return ErrorTable[i].errnocode;
++		}
++	}
++
++	//
++	// not in table. Check ranges
++	//
++
++	if ((WinError >= ERROR_WRITE_PROTECT) &&
++		(WinError <= ERROR_SHARING_BUFFER_EXCEEDED))
++	{
++		return EACCES;
++	}
++	else if ((WinError >= ERROR_INVALID_STARTING_CODESEG) &&
++			 (WinError <= ERROR_INFLOOP_IN_RELOC_CHAIN))
++	{
++		return ENOEXEC;
++	}
++	else
++	{
++		return EINVAL;
++	}
++}
++
++
++
++
++
++
++
++//
++// Function to map NT status to dos error.
++//
++
++static
++__inline
++unsigned
++_MapNtStatus(
++    IN NTSTATUS Status
++   )
++{
++	return _MapDosError(RtlNtStatusToDosError(Status));
++}
++
++
++
++
++
++//
++// Helper functions to make things easyer
++//
++
++static
++NTSTATUS
++_OpenNtName(
++    IN PCSTR Name,
++    IN BOOLEAN Readonly,
++    OUT PHANDLE Handle,
++    OUT PBOOLEAN OpenedReadonly OPTIONAL
++   )
++{
++	UNICODE_STRING UnicodeString;
++	ANSI_STRING    AnsiString;
++	WCHAR Buffer[512];
++	NTSTATUS Status;
++	OBJECT_ATTRIBUTES ObjectAttributes;
++	IO_STATUS_BLOCK IoStatusBlock;
++
++	//
++	// Make Unicode name from inlut string
++	//
++
++	UnicodeString.Buffer = &Buffer[0];
++	UnicodeString.Length = 0;
++	UnicodeString.MaximumLength = sizeof(Buffer); // in bytes!!!
++
++	RtlInitAnsiString(&AnsiString, Name);
++
++	Status = RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE);
++
++	if(!NT_SUCCESS(Status))
++	{
++		return Status; // Unpappable character?
++	}
++
++	//
++	// Initialize object
++	//
++
++	InitializeObjectAttributes(&ObjectAttributes,
++							   &UnicodeString,
++							   OBJ_CASE_INSENSITIVE,
++							   NULL,
++							   NULL );
++
++	//
++	// Try to open it in initial mode
++	//
++
++	if(ARGUMENT_PRESENT(OpenedReadonly))
++	{
++		*OpenedReadonly = Readonly;
++	}
++
++
++	Status = NtOpenFile(Handle,
++						SYNCHRONIZE | FILE_READ_DATA | (Readonly ? 0 : FILE_WRITE_DATA),
++						&ObjectAttributes,
++						&IoStatusBlock,
++						FILE_SHARE_WRITE | FILE_SHARE_READ,
++						FILE_SYNCHRONOUS_IO_NONALERT);
++
++	if(!NT_SUCCESS(Status))
++	{
++		//
++		// Maybe was just mounted? wait 0.5 sec and retry.
++		//
++
++		LARGE_INTEGER Interval;
++		Interval.QuadPart = -5000000; // 0.5 sec. from now
++
++		NtDelayExecution(FALSE, &Interval);
++
++		Status = NtOpenFile(Handle,
++							SYNCHRONIZE | FILE_READ_DATA | (Readonly ? 0 : FILE_WRITE_DATA),
++							&ObjectAttributes,
++							&IoStatusBlock,
++							FILE_SHARE_WRITE | FILE_SHARE_READ,
++							FILE_SYNCHRONOUS_IO_NONALERT);
++
++		//
++		// Try to satisfy mode
++		//
++
++		if((STATUS_ACCESS_DENIED == Status) && !Readonly)
++		{
++			if(ARGUMENT_PRESENT(OpenedReadonly))
++			{
++				*OpenedReadonly = TRUE;
++			}
++
++			Status = NtOpenFile(Handle,
++							SYNCHRONIZE | FILE_READ_DATA,
++							&ObjectAttributes,
++							&IoStatusBlock,
++							FILE_SHARE_WRITE | FILE_SHARE_READ,
++							FILE_SYNCHRONOUS_IO_NONALERT);
++		}
++	}
++
++
++
++	//
++	// done
++	//
++
++	return Status;
++}
++
++
++static
++NTSTATUS
++_OpenDriveLetter(
++    IN CHAR Letter,
++    IN BOOLEAN ReadOnly,
++    OUT PHANDLE Handle,
++    OUT PBOOLEAN OpenedReadonly OPTIONAL
++   )
++{
++	CHAR Buffer[100];
++
++	sprintf(Buffer, "\\DosDevices\\%c:", Letter);
++
++	return _OpenNtName(Buffer, ReadOnly, Handle, OpenedReadonly);
++}
++
++
++//
++// Flush device
++//
++
++static
++__inline
++NTSTATUS
++_FlushDrive(
++		IN HANDLE Handle
++		)
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	return NtFlushBuffersFile(Handle, &IoStatusBlock);
++}
++
++
++//
++// lock drive
++//
++
++static
++__inline
++NTSTATUS
++_LockDrive(
++		IN HANDLE Handle
++		)
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	return NtFsControlFile(Handle, 0, 0, 0, &IoStatusBlock, FSCTL_LOCK_VOLUME, 0, 0, 0, 0);
++}
++
++
++//
++// unlock drive
++//
++
++static
++__inline
++NTSTATUS
++_UnlockDrive(
++	IN HANDLE Handle
++	)
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	return NtFsControlFile(Handle, 0, 0, 0, &IoStatusBlock, FSCTL_UNLOCK_VOLUME, 0, 0, 0, 0);
++}
++
++static
++__inline
++NTSTATUS
++_DismountDrive(
++	IN HANDLE Handle
++	)
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	return NtFsControlFile(Handle, 0, 0, 0, &IoStatusBlock, FSCTL_DISMOUNT_VOLUME, 0, 0, 0, 0);
++}
++
++
++//
++// is mounted
++//
++
++static
++__inline
++BOOLEAN
++_IsMounted(
++	IN HANDLE Handle
++	)
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	NTSTATUS Status;
++	Status = NtFsControlFile(Handle, 0, 0, 0, &IoStatusBlock, FSCTL_IS_VOLUME_MOUNTED, 0, 0, 0, 0);
++	return (BOOLEAN)(STATUS_SUCCESS == Status);
++}
++
++
++static
++__inline
++NTSTATUS
++_CloseDisk(
++		IN HANDLE Handle
++		)
++{
++	return NtClose(Handle);
++}
++
++
++
++
++//
++// Make NT name from any recognized name
++//
++
++static
++PCSTR
++_NormalizeDeviceName(
++    IN PCSTR Device,
++    IN PSTR NormalizedDeviceNameBuffer
++   )
++{
++	int PartitionNumber = -1;
++	UCHAR DiskNumber;
++	PSTR p;
++
++
++	//
++	// Do not try to parse NT name
++	//
++
++	if('\\' == *Device)
++		return Device;
++
++
++
++	//
++	// Strip leading '/dev/' if any
++	//
++
++	if(('/' == *(Device)) &&
++		('d' == *(Device + 1)) &&
++		('e' == *(Device + 2)) &&
++		('v' == *(Device + 3)) &&
++		('/' == *(Device + 4)))
++	{
++		Device += 5;
++	}
++
++	if('\0' == *Device)
++	{
++		return NULL;
++	}
++
++
++	//
++	// forms: hda[n], fd[n]
++	//
++
++	if('d' != *(Device + 1))
++	{
++		return NULL;
++	}
++
++	if('h' == *Device)
++	{
++		if((*(Device + 2) < 'a') || (*(Device + 2) > ('a' + 9)) ||
++		   ((*(Device + 3) != '\0') &&
++			((*(Device + 4) != '\0') ||
++			 ((*(Device + 3) < '0') || (*(Device + 3) > '9'))
++			)
++		   )
++		  )
++		{
++			return NULL;
++		}
++
++		DiskNumber = (UCHAR)(*(Device + 2) - 'a');
++
++		if(*(Device + 3) != '\0')
++		{
++			PartitionNumber = (*(Device + 3) - '0');
++		}
++
++	}
++	else if('f' == *Device)
++	{
++		//
++		// 3-d letted should be a digit.
++		//
++
++		if((*(Device + 3) != '\0') ||
++		   (*(Device + 2) < '0') || (*(Device + 2) > '9'))
++		{
++			return NULL;
++		}
++
++		DiskNumber = (UCHAR)(*(Device + 2) - '0');
++
++	}
++	else
++	{
++		//
++		// invalid prefix
++		//
++
++		return NULL;
++	}
++
++
++
++	//
++	// Prefix
++	//
++
++	strcpy(NormalizedDeviceNameBuffer, "\\Device\\");
++
++	//
++	// Media name
++	//
++
++	switch(*Device)
++	{
++
++	case 'f':
++		strcat(NormalizedDeviceNameBuffer, "Floppy0");
++		break;
++
++	case 'h':
++		strcat(NormalizedDeviceNameBuffer, "Harddisk0");
++		break;
++	}
++
++
++	p = NormalizedDeviceNameBuffer + strlen(NormalizedDeviceNameBuffer) - 1;
++	*p = (CHAR)(*p + DiskNumber);
++
++
++	//
++	// Partition nr.
++	//
++
++	if(PartitionNumber >= 0)
++	{
++		strcat(NormalizedDeviceNameBuffer, "\\Partition0");
++
++		p = NormalizedDeviceNameBuffer + strlen(NormalizedDeviceNameBuffer) - 1;
++		*p = (CHAR)(*p + PartitionNumber);
++	}
++
++
++	return NormalizedDeviceNameBuffer;
++}
++
++
++
++
++static
++VOID
++_GetDeviceSize(
++    IN HANDLE h,
++    OUT unsigned __int64 *FsSize
++   )
++{
++	PARTITION_INFORMATION pi;
++	DISK_GEOMETRY gi;
++	NTSTATUS Status;
++	IO_STATUS_BLOCK IoStatusBlock;
++
++	//
++	// Zero it
++	//
++
++	*FsSize = 0;
++
++	//
++	// Call driver
++	//
++
++	RtlZeroMemory(&pi, sizeof(PARTITION_INFORMATION));
++
++	Status = NtDeviceIoControlFile(
++		h, NULL, NULL, NULL, &IoStatusBlock, IOCTL_DISK_GET_PARTITION_INFO,
++		&pi, sizeof(PARTITION_INFORMATION),
++		&pi, sizeof(PARTITION_INFORMATION));
++
++
++	if(NT_SUCCESS(Status))
++	{
++		*FsSize = pi.PartitionLength.QuadPart;
++	}
++	else if(STATUS_INVALID_DEVICE_REQUEST == Status)
++	{
++		//
++		// No partitions: get device info.
++		//
++
++		RtlZeroMemory(&gi, sizeof(DISK_GEOMETRY));
++
++		Status = NtDeviceIoControlFile(
++				h, NULL, NULL, NULL, &IoStatusBlock, IOCTL_DISK_GET_DRIVE_GEOMETRY,
++				&gi, sizeof(DISK_GEOMETRY),
++				&gi, sizeof(DISK_GEOMETRY));
++
++
++		if(NT_SUCCESS(Status))
++		{
++			*FsSize =
++				gi.BytesPerSector *
++				gi.SectorsPerTrack *
++				gi.TracksPerCylinder *
++				gi.Cylinders.QuadPart;
++		}
++
++	}
++}
++
++
++
++//
++// Open device by name.
++//
++
++static
++BOOLEAN
++_Ext2OpenDevice(
++    IN PCSTR Name,
++    IN BOOLEAN ReadOnly,
++    OUT PHANDLE Handle,
++    OUT PBOOLEAN OpenedReadonly OPTIONAL,
++    OUT unsigned *Errno OPTIONAL
++   )
++{
++	CHAR NormalizedDeviceName[512];
++	NTSTATUS Status;
++
++	if(NULL == Name)
++	{
++		//
++		// Set not found
++		//
++
++		if(ARGUMENT_PRESENT(Errno))
++			*Errno = ENOENT;
++
++		return FALSE;
++	}
++
++
++	if((((*Name) | 0x20) >= 'a') && (((*Name) | 0x20) <= 'z') &&
++		(':' == *(Name + 1)) && ('\0' == *(Name + 2)))
++	{
++		Status = _OpenDriveLetter(*Name, ReadOnly, Handle, OpenedReadonly);
++	}
++	else
++	{
++		//
++		// Make name
++		//
++
++		Name = _NormalizeDeviceName(Name, NormalizedDeviceName);
++
++		if(NULL == Name)
++		{
++			//
++			// Set not found
++			//
++
++			if(ARGUMENT_PRESENT(Errno))
++				*Errno = ENOENT;
++
++			return FALSE;
++		}
++
++		//
++		// Try to open it
++		//
++
++		Status = _OpenNtName(Name, ReadOnly, Handle, OpenedReadonly);
++	}
++
++
++	if(!NT_SUCCESS(Status))
++	{
++		if(ARGUMENT_PRESENT(Errno))
++			*Errno = _MapNtStatus(Status);
++
++		return FALSE;
++	}
++
++	return TRUE;
++}
++
++
++//
++// Raw block io. Sets dos errno
++//
++
++static
++BOOLEAN
++_BlockIo(
++    IN HANDLE Handle,
++    IN LARGE_INTEGER Offset,
++    IN ULONG Bytes,
++    IN OUT PCHAR Buffer,
++    IN BOOLEAN Read,
++    OUT unsigned* Errno
++   )
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	NTSTATUS Status;
++
++	//
++	// Should be aligned
++	//
++
++	ASSERT(0 == (Bytes % 512));
++	ASSERT(0 == (Offset.LowPart % 512));
++
++
++	//
++	// perform io
++	//
++
++	if(Read)
++	{
++		Status = NtReadFile(Handle, NULL, NULL, NULL,
++			&IoStatusBlock, Buffer, Bytes, &Offset, NULL);
++	}
++	else
++	{
++		Status = NtWriteFile(Handle, NULL, NULL, NULL,
++			&IoStatusBlock, Buffer, Bytes, &Offset, NULL);
++	}
++
++
++	//
++	// translate error
++	//
++
++	if(NT_SUCCESS(Status))
++	{
++		*Errno = 0;
++		return TRUE;
++	}
++
++	*Errno = _MapNtStatus(Status);
++
++	return FALSE;
++}
++
++
++
++__inline
++BOOLEAN
++_RawWrite(
++    IN HANDLE Handle,
++    IN LARGE_INTEGER Offset,
++    IN ULONG Bytes,
++    OUT const CHAR* Buffer,
++    OUT unsigned* Errno
++   )
++{
++	return _BlockIo(Handle, Offset, Bytes, (PCHAR)Buffer, FALSE, Errno);
++}
++
++__inline
++BOOLEAN
++_RawRead(
++    IN HANDLE Handle,
++    IN LARGE_INTEGER Offset,
++    IN ULONG Bytes,
++    IN PCHAR Buffer,
++    OUT unsigned* Errno
++   )
++{
++	return _BlockIo(Handle, Offset, Bytes, Buffer, TRUE, Errno);
++}
++
++
++
++__inline
++BOOLEAN
++_SetPartType(
++    IN HANDLE Handle,
++    IN UCHAR Type
++   )
++{
++	IO_STATUS_BLOCK IoStatusBlock;
++	return STATUS_SUCCESS == NtDeviceIoControlFile(
++												   Handle, NULL, NULL, NULL, &IoStatusBlock, IOCTL_DISK_SET_PARTITION_INFO,
++												   &Type, sizeof(Type),
++												   NULL, 0);
++}
++
++
++
++//--------------------- interface part
++
++//
++// Interface functions.
++// Is_mounted is set to 1 if the device is mounted, 0 otherwise
++//
++
++errcode_t
++ext2fs_check_if_mounted(const char *file, int *mount_flags)
++{
++	HANDLE h;
++	BOOLEAN Readonly;
++
++	*mount_flags = 0;
++
++	if(!_Ext2OpenDevice(file, TRUE, &h, &Readonly, NULL))
++	{
++		return 0;
++	}
++
++
++	__try{
++		*mount_flags &= _IsMounted(h) ? EXT2_MF_MOUNTED : 0;
++	}
++	__finally{
++		_CloseDisk(h);
++	}
++
++	return 0;
++}
++
++
++
++//
++// Returns the number of blocks in a partition
++//
++
++static __int64 FsSize = 0;
++static char knowndevice[1024] = "";
++
++
++errcode_t
++ext2fs_get_device_size(const char *file, int blocksize,
++				 blk_t *retblocks)
++{
++	HANDLE h;
++	BOOLEAN Readonly;
++
++	if((0 == FsSize) || (0 != strcmp(knowndevice, file)))
++	{
++
++		if(!_Ext2OpenDevice(file, TRUE, &h, &Readonly, NULL))
++		{
++			return 0;
++		}
++
++
++		__try{
++
++			//
++			// Get size
++			//
++
++			_GetDeviceSize(h, &FsSize);
++			strcpy(knowndevice, file);
++		}
++		__finally{
++			_CloseDisk(h);
++		}
++
++	}
++
++	*retblocks = (blk_t)(unsigned __int64)(FsSize / blocksize);
++	UNREFERENCED_PARAMETER(file);
++	return 0;
++}
++
++
++
++
++
++
++//
++// Table elements
++//
++
++
++static
++errcode_t
++nt_open(const char *name, int flags, io_channel *channel)
++{
++	io_channel      io = NULL;
++	PNT_PRIVATE_DATA NtData = NULL;
++	errcode_t Errno = 0;
++
++	//
++	// Check name
++	//
++
++	if (NULL == name)
++	{
++		return EXT2_ET_BAD_DEVICE_NAME;
++	}
++
++	__try{
++
++		//
++		// Allocate channel handle
++		//
++
++		io = (io_channel) malloc(sizeof(struct struct_io_channel));
++
++		if (NULL == io)
++		{
++			Errno = ENOMEM;
++			__leave;
++		}
++
++		RtlZeroMemory(io, sizeof(struct struct_io_channel));
++		io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
++
++		NtData = (PNT_PRIVATE_DATA)malloc(sizeof(NT_PRIVATE_DATA));
++
++		if (NULL == NtData)
++		{
++			Errno = ENOMEM;
++			__leave;
++		}
++
++
++		io->manager = nt_io_manager();
++		io->name = malloc(strlen(name) + 1);
++		if (NULL == io->name)
++		{
++			Errno = ENOMEM;
++			__leave;
++		}
++
++		strcpy(io->name, name);
++		io->private_data = NtData;
++		io->block_size = 1024;
++		io->read_error = 0;
++		io->write_error = 0;
++		io->refcount = 1;
++
++		//
++		// Initialize data
++		//
++
++		RtlZeroMemory(NtData, sizeof(NT_PRIVATE_DATA));
++
++		NtData->magic = EXT2_ET_MAGIC_NT_IO_CHANNEL;
++		NtData->BufferBlockNumber = 0xffffffff;
++		NtData->BufferSize = 1024;
++		NtData->Buffer = malloc(NtData->BufferSize);
++
++		if (NULL == NtData->Buffer)
++		{
++			Errno = ENOMEM;
++			__leave;
++		}
++
++		//
++		// Open it
++		//
++
++		if(!_Ext2OpenDevice(name, (BOOLEAN)!BooleanFlagOn(flags, EXT2_FLAG_RW), &NtData->Handle, &NtData->OpenedReadonly, &Errno))
++		{
++			__leave;
++		}
++
++
++		//
++		// get size
++		//
++
++		_GetDeviceSize(NtData->Handle, &FsSize);
++		strcpy(knowndevice, name);
++
++
++		//
++		// Lock/dismount
++		//
++
++		if(!NT_SUCCESS(_LockDrive(NtData->Handle)) /*|| !NT_SUCCESS(_DismountDrive(NtData->Handle))*/)
++		{
++			NtData->OpenedReadonly = TRUE;
++		}
++
++		//
++		// Done
++		//
++
++		*channel = io;
++
++
++	}
++	__finally{
++
++		if(0 != Errno)
++		{
++			//
++			// Cleanup
++			//
++
++			if (NULL != io)
++			{
++				if(NULL != io->name)
++				{
++					free(io->name);
++				}
++
++				free(io);
++			}
++
++			if (NULL != NtData)
++			{
++				if(NULL != NtData->Handle)
++				{
++					_UnlockDrive(NtData->Handle);
++					_CloseDisk(NtData->Handle);
++				}
++
++				if(NULL != NtData->Buffer)
++				{
++					free(NtData->Buffer);
++				}
++
++				free(NtData);
++			}
++		}
++	}
++
++	return Errno;
++}
++
++
++//
++// Close api
++//
++
++static
++errcode_t
++nt_close(io_channel channel)
++{
++	PNT_PRIVATE_DATA NtData = NULL;
++
++	if(NULL == channel)
++	{
++		return 0;
++	}
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	NtData = (PNT_PRIVATE_DATA) channel->private_data;
++	EXT2_CHECK_MAGIC(NtData, EXT2_ET_MAGIC_NT_IO_CHANNEL);
++
++	if (--channel->refcount > 0)
++	{
++		return 0;
++	}
++
++	if(NULL != channel->name)
++	{
++		free(channel->name);
++	}
++
++
++	free(channel);
++
++	if (NULL != NtData)
++	{
++		if(NULL != NtData->Handle)
++		{
++			_DismountDrive(NtData->Handle);
++			_UnlockDrive(NtData->Handle);
++			_CloseDisk(NtData->Handle);
++		}
++
++		if(NULL != NtData->Buffer)
++		{
++			free(NtData->Buffer);
++		}
++
++		free(NtData);
++	}
++
++	return 0;
++}
++
++
++
++//
++// set block size
++//
++
++static
++errcode_t
++nt_set_blksize(io_channel channel, int blksize)
++{
++	PNT_PRIVATE_DATA NtData = NULL;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	NtData = (PNT_PRIVATE_DATA) channel->private_data;
++	EXT2_CHECK_MAGIC(NtData, EXT2_ET_MAGIC_NT_IO_CHANNEL);
++
++	if (channel->block_size != blksize)
++	{
++		channel->block_size = blksize;
++
++		free(NtData->Buffer);
++		NtData->BufferBlockNumber = 0xffffffff;
++		NtData->BufferSize = channel->block_size;
++		ASSERT(0 == (NtData->BufferSize % 512));
++
++		NtData->Buffer = malloc(NtData->BufferSize);
++
++		if (NULL == NtData->Buffer)
++		{
++			return ENOMEM;
++		}
++
++	}
++
++	return 0;
++}
++
++
++//
++// read block
++//
++
++static
++errcode_t
++nt_read_blk(io_channel channel, unsigned long block,
++			       int count, void *buf)
++{
++	PVOID BufferToRead;
++	ULONG SizeToRead;
++	ULONG Size;
++	LARGE_INTEGER Offset;
++	PNT_PRIVATE_DATA NtData = NULL;
++	unsigned Errno = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	NtData = (PNT_PRIVATE_DATA) channel->private_data;
++	EXT2_CHECK_MAGIC(NtData, EXT2_ET_MAGIC_NT_IO_CHANNEL);
++
++	//
++	// If it's in the cache, use it!
++	//
++
++	if ((1 == count) &&
++		(block == NtData->BufferBlockNumber) &&
++		(NtData->BufferBlockNumber != 0xffffffff))
++	{
++		memcpy(buf, NtData->Buffer, channel->block_size);
++		return 0;
++	}
++
++	Size = (count < 0) ? (ULONG)(-count) : (ULONG)(count * channel->block_size);
++
++	Offset.QuadPart = block * channel->block_size;
++
++	//
++	// If not fit to the block
++	//
++
++	if(Size <= NtData->BufferSize)
++	{
++		//
++		// Update the cache
++		//
++
++		NtData->BufferBlockNumber = block;
++		BufferToRead = NtData->Buffer;
++		SizeToRead = NtData->BufferSize;
++	}
++	else
++	{
++		SizeToRead = Size;
++		BufferToRead = buf;
++		ASSERT(0 == (SizeToRead % channel->block_size));
++	}
++
++	if(!_RawRead(NtData->Handle, Offset, SizeToRead, BufferToRead, &Errno))
++	{
++
++		if (channel->read_error)
++		{
++			return (channel->read_error)(channel, block, count, buf,
++					       Size, 0, Errno);
++		}
++		else
++		{
++			return Errno;
++		}
++	}
++
++
++	if(BufferToRead != buf)
++	{
++		ASSERT(Size <= SizeToRead);
++		memcpy(buf, BufferToRead, Size);
++	}
++
++	return 0;
++}
++
++
++//
++// write block
++//
++
++static
++errcode_t
++nt_write_blk(io_channel channel, unsigned long block,
++				int count, const void *buf)
++{
++	ULONG SizeToWrite;
++	LARGE_INTEGER Offset;
++	PNT_PRIVATE_DATA NtData = NULL;
++	unsigned Errno = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	NtData = (PNT_PRIVATE_DATA) channel->private_data;
++	EXT2_CHECK_MAGIC(NtData, EXT2_ET_MAGIC_NT_IO_CHANNEL);
++
++	if(NtData->OpenedReadonly)
++	{
++		return EACCES;
++	}
++
++	if (count == 1)
++	{
++		SizeToWrite = channel->block_size;
++	}
++	else
++	{
++		NtData->BufferBlockNumber = 0xffffffff;
++
++		if (count < 0)
++		{
++			SizeToWrite = (ULONG)(-count);
++		}
++		else
++		{
++			SizeToWrite = (ULONG)(count * channel->block_size);
++		}
++	}
++
++
++	ASSERT(0 == (SizeToWrite % 512));
++	Offset.QuadPart = block * channel->block_size;
++
++	if(!_RawWrite(NtData->Handle, Offset, SizeToWrite, buf, &Errno))
++	{
++		if (channel->write_error)
++		{
++			return (channel->write_error)(channel, block, count, buf,
++						SizeToWrite, 0, Errno);
++		}
++		else
++		{
++			return Errno;
++		}
++	}
++
++
++	//
++	// Stash a copy.
++	//
++
++	if(SizeToWrite >= NtData->BufferSize)
++	{
++		NtData->BufferBlockNumber = block;
++		memcpy(NtData->Buffer, buf, NtData->BufferSize);
++	}
++
++	NtData->Written = TRUE;
++
++	return 0;
++
++}
++
++
++
++//
++// Flush data buffers to disk.  Since we are currently using a
++// write-through cache, this is a no-op.
++//
++
++static
++errcode_t
++nt_flush(io_channel channel)
++{
++	PNT_PRIVATE_DATA NtData = NULL;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	NtData = (PNT_PRIVATE_DATA) channel->private_data;
++	EXT2_CHECK_MAGIC(NtData, EXT2_ET_MAGIC_NT_IO_CHANNEL);
++
++	if(NtData->OpenedReadonly)
++	{
++		return 0; // EACCESS;
++	}
++
++
++	//
++	// Flush file buffers.
++	//
++
++	_FlushDrive(NtData->Handle);
++
++
++	//
++	// Test and correct partition type.
++	//
++
++	if(NtData->Written)
++	{
++		_SetPartType(NtData->Handle, 0x83);
++	}
++
++	return 0;
++}
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/openfs.c silo-1.4.11/libext2fs/openfs.c
+--- silo-1.4.11.orig/libext2fs/openfs.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/openfs.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,326 @@
++/*
++ * openfs.c --- open an ext2 filesystem
++ * 
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++
++
++#include "ext2fs.h"
++#include "e2image.h"
++
++blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i)
++{
++	int	bg;
++	int	has_super = 0;
++	int	ret_blk;
++
++	if (!(fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) ||
++	    (i < fs->super->s_first_meta_bg))
++		return (group_block + i + 1);
++
++	bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i;
++	if (ext2fs_bg_has_super(fs, bg))
++		has_super = 1;
++	ret_blk = (fs->super->s_first_data_block + has_super + 
++		   (bg * fs->super->s_blocks_per_group));
++	/*
++	 * If group_block is not the normal value, we're trying to use
++	 * the backup group descriptors and superblock --- so use the
++	 * alternate location of the second block group in the
++	 * metablock group.  Ideally we should be testing each bg
++	 * descriptor block individually for correctness, but we don't
++	 * have the infrastructure in place to do that.
++	 */
++	if (group_block != fs->super->s_first_data_block &&
++	    ((ret_blk + fs->super->s_blocks_per_group) <
++	     fs->super->s_blocks_count))
++		ret_blk += fs->super->s_blocks_per_group;
++	return ret_blk;
++}
++
++errcode_t ext2fs_open(const char *name, int flags, int superblock,
++		      unsigned int block_size, io_manager manager, 
++		      ext2_filsys *ret_fs)
++{
++	return ext2fs_open2(name, 0, flags, superblock, block_size, 
++			    manager, ret_fs);
++}
++
++/*
++ *  Note: if superblock is non-zero, block-size must also be non-zero.
++ * 	Superblock and block_size can be zero to use the default size.
++ *
++ * Valid flags for ext2fs_open()
++ * 
++ * 	EXT2_FLAG_RW	- Open the filesystem for read/write.
++ * 	EXT2_FLAG_FORCE - Open the filesystem even if some of the
++ *				features aren't supported.
++ *	EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device
++ */
++errcode_t ext2fs_open2(const char *name, const char *io_options,
++		       int flags, int superblock,
++		       unsigned int block_size, io_manager manager, 
++		       ext2_filsys *ret_fs)
++{
++	ext2_filsys	fs;
++	errcode_t	retval;
++	unsigned long	i;
++	int		j, groups_per_block, blocks_per_group;
++	blk_t		group_block, blk;
++	char		*dest, *cp;
++	struct ext2_group_desc *gdp;
++	
++	EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);
++
++	retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs);
++	if (retval)
++		return retval;
++	
++	memset(fs, 0, sizeof(struct struct_ext2_filsys));
++	fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
++	fs->flags = flags;
++	fs->umask = 022;
++	retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name);
++	if (retval)
++		goto cleanup;
++	strcpy(fs->device_name, name);
++	cp = strchr(fs->device_name, '?');
++	if (!io_options && cp) {
++		*cp++ = 0;
++		io_options = cp;
++	}
++		
++	retval = manager->open(fs->device_name, 
++			       (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0,
++			       &fs->io);
++	if (retval)
++		goto cleanup;
++	if (io_options && 
++	    (retval = io_channel_set_options(fs->io, io_options)))
++		goto cleanup;
++	fs->image_io = fs->io;
++	fs->io->app_data = fs;
++	retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->super);
++	if (retval)
++		goto cleanup;
++	if (flags & EXT2_FLAG_IMAGE_FILE) {
++		retval = ext2fs_get_mem(sizeof(struct ext2_image_hdr),
++					&fs->image_header);
++		if (retval)
++			goto cleanup;
++		retval = io_channel_read_blk(fs->io, 0,
++					     -sizeof(struct ext2_image_hdr),
++					     fs->image_header);
++		if (retval)
++			goto cleanup;
++		if (fs->image_header->magic_number != EXT2_ET_MAGIC_E2IMAGE)
++			return EXT2_ET_MAGIC_E2IMAGE;
++		superblock = 1;
++		block_size = fs->image_header->fs_blocksize;
++	}
++
++	/*
++	 * If the user specifies a specific block # for the
++	 * superblock, then he/she must also specify the block size!
++	 * Otherwise, read the master superblock located at offset
++	 * SUPERBLOCK_OFFSET from the start of the partition.
++	 *
++	 * Note: we only save a backup copy of the superblock if we
++	 * are reading the superblock from the primary superblock location.
++	 */
++	if (superblock) {
++		if (!block_size) {
++			retval = EXT2_ET_INVALID_ARGUMENT;
++			goto cleanup;
++		}
++		io_channel_set_blksize(fs->io, block_size);
++		group_block = superblock;
++		fs->orig_super = 0;
++	} else {
++		io_channel_set_blksize(fs->io, SUPERBLOCK_OFFSET);
++		superblock = 1;
++		group_block = 0;
++		retval = ext2fs_get_mem(SUPERBLOCK_SIZE, &fs->orig_super);
++		if (retval)
++			goto cleanup;
++	}
++	retval = io_channel_read_blk(fs->io, superblock, -SUPERBLOCK_SIZE,
++				     fs->super);
++	if (retval)
++		goto cleanup;
++	if (fs->orig_super)
++		memcpy(fs->orig_super, fs->super, SUPERBLOCK_SIZE);
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++	if ((fs->super->s_magic == ext2fs_swab16(EXT2_SUPER_MAGIC)) ||
++	    (fs->flags & EXT2_FLAG_SWAP_BYTES)) {
++		fs->flags |= EXT2_FLAG_SWAP_BYTES;
++
++		ext2fs_swap_super(fs->super);
++	}
++#endif
++	
++	if (fs->super->s_magic != EXT2_SUPER_MAGIC) {
++		retval = EXT2_ET_BAD_MAGIC;
++		goto cleanup;
++	}
++	if (fs->super->s_rev_level > EXT2_LIB_CURRENT_REV) {
++		retval = EXT2_ET_REV_TOO_HIGH;
++		goto cleanup;
++	}
++
++	/*
++	 * Check for feature set incompatibility
++	 */
++	if (!(flags & EXT2_FLAG_FORCE)) {
++		if (fs->super->s_feature_incompat &
++		    ~EXT2_LIB_FEATURE_INCOMPAT_SUPP) {
++			retval = EXT2_ET_UNSUPP_FEATURE;
++			goto cleanup;
++		}
++		if ((flags & EXT2_FLAG_RW) &&
++		    (fs->super->s_feature_ro_compat &
++		     ~EXT2_LIB_FEATURE_RO_COMPAT_SUPP)) {
++			retval = EXT2_ET_RO_UNSUPP_FEATURE;
++			goto cleanup;
++		}
++		if (!(flags & EXT2_FLAG_JOURNAL_DEV_OK) &&
++		    (fs->super->s_feature_incompat &
++		     EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
++			retval = EXT2_ET_UNSUPP_FEATURE;
++			goto cleanup;
++		}
++	}
++	
++	fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
++	if (fs->blocksize == 0) {
++		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
++		goto cleanup;
++	}
++	fs->fragsize = EXT2_FRAG_SIZE(fs->super);
++	fs->inode_blocks_per_group = ((fs->super->s_inodes_per_group *
++				       EXT2_INODE_SIZE(fs->super) +
++				       EXT2_BLOCK_SIZE(fs->super) - 1) /
++				      EXT2_BLOCK_SIZE(fs->super));
++	if (block_size) {
++		if (block_size != fs->blocksize) {
++			retval = EXT2_ET_UNEXPECTED_BLOCK_SIZE;
++			goto cleanup;
++		}
++	}
++	/*
++	 * Set the blocksize to the filesystem's blocksize.
++	 */
++	io_channel_set_blksize(fs->io, fs->blocksize);
++
++	/*
++	 * If this is an external journal device, don't try to read
++	 * the group descriptors, because they're not there.
++	 */
++	if (fs->super->s_feature_incompat &
++	    EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
++		fs->group_desc_count = 0;
++		*ret_fs = fs;
++		return 0;
++	}
++	
++	/*
++	 * Read group descriptors
++	 */
++	blocks_per_group = EXT2_BLOCKS_PER_GROUP(fs->super);
++	if (blocks_per_group == 0 ||
++	    blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) ||
++	    fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super)) {
++		retval = EXT2_ET_CORRUPT_SUPERBLOCK;
++		goto cleanup;
++	}
++	fs->group_desc_count = (fs->super->s_blocks_count -
++				fs->super->s_first_data_block +
++				blocks_per_group - 1) / blocks_per_group;
++	fs->desc_blocks = (fs->group_desc_count +
++			   EXT2_DESC_PER_BLOCK(fs->super) - 1)
++		/ EXT2_DESC_PER_BLOCK(fs->super);
++	retval = ext2fs_get_mem(fs->desc_blocks * fs->blocksize,
++				&fs->group_desc);
++	if (retval)
++		goto cleanup;
++	if (!group_block)
++		group_block = fs->super->s_first_data_block;
++	dest = (char *) fs->group_desc;
++	groups_per_block = fs->blocksize / sizeof(struct ext2_group_desc);
++	for (i=0 ; i < fs->desc_blocks; i++) {
++		blk = ext2fs_descriptor_block_loc(fs, group_block, i);
++		retval = io_channel_read_blk(fs->io, blk, 1, dest);
++		if (retval)
++			goto cleanup;
++#ifdef EXT2FS_ENABLE_SWAPFS
++		if (fs->flags & EXT2_FLAG_SWAP_BYTES) {
++			gdp = (struct ext2_group_desc *) dest;
++			for (j=0; j < groups_per_block; j++)
++				ext2fs_swap_group_desc(gdp++);
++		}
++#endif
++		dest += fs->blocksize;
++	}
++
++	*ret_fs = fs;
++	return 0;
++cleanup:
++	ext2fs_free(fs);
++	return retval;
++}
++
++/*
++ * Set/get the filesystem data I/O channel.
++ * 
++ * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true.
++ */
++errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io)
++{
++	if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0)
++		return EXT2_ET_NOT_IMAGE_FILE;
++	if (old_io) {
++		*old_io = (fs->image_io == fs->io) ? 0 : fs->io;
++	}
++	return 0;
++}
++
++errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io)
++{
++	if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0)
++		return EXT2_ET_NOT_IMAGE_FILE;
++	fs->io = new_io ? new_io : fs->image_io;
++	return 0;
++}
++
++errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io)
++{
++	if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0)
++		return EXT2_ET_NOT_IMAGE_FILE;
++	fs->io = fs->image_io = new_io;
++	fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | 
++		EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY;
++	fs->flags &= ~EXT2_FLAG_IMAGE_FILE;
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/read_bb.c silo-1.4.11/libext2fs/read_bb.c
+--- silo-1.4.11.orig/libext2fs/read_bb.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/read_bb.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,97 @@
++/*
++ * read_bb --- read the bad blocks inode
++ *
++ * Copyright (C) 1994 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct read_bb_record {
++	ext2_badblocks_list	bb_list;
++	errcode_t	err;
++};
++
++/*
++ * Helper function for ext2fs_read_bb_inode()
++ */
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int mark_bad_block(ext2_filsys fs, blk_t *block_nr,
++			  e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), 
++			  blk_t ref_block EXT2FS_ATTR((unused)),
++			  int ref_offset EXT2FS_ATTR((unused)), 
++			  void *priv_data)
++{
++	struct read_bb_record *rb = (struct read_bb_record *) priv_data;
++	
++	if (blockcnt < 0)
++		return 0;
++	
++	if ((*block_nr < fs->super->s_first_data_block) ||
++	    (*block_nr >= fs->super->s_blocks_count))
++		return 0;	/* Ignore illegal blocks */
++
++	rb->err = ext2fs_badblocks_list_add(rb->bb_list, *block_nr);
++	if (rb->err)
++		return BLOCK_ABORT;
++	return 0;
++}
++
++/*
++ * Reads the current bad blocks from the bad blocks inode.
++ */
++errcode_t ext2fs_read_bb_inode(ext2_filsys fs, ext2_badblocks_list *bb_list)
++{
++	errcode_t	retval;
++	struct read_bb_record rb;
++	struct ext2_inode inode;
++	blk_t	numblocks;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!*bb_list) {
++		retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode);
++		if (retval)
++			return retval;
++		if (inode.i_blocks < 500)
++			numblocks = (inode.i_blocks /
++				     (fs->blocksize / 512)) + 20;
++		else
++			numblocks = 500;
++		retval = ext2fs_badblocks_list_create(bb_list, numblocks);
++		if (retval)
++			return retval;
++	}
++
++	rb.bb_list = *bb_list;
++	rb.err = 0;
++	retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, 0, 0,
++				      mark_bad_block, &rb);
++	if (retval)
++		return retval;
++
++	return rb.err;
++}
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/read_bb_file.c silo-1.4.11/libext2fs/read_bb_file.c
+--- silo-1.4.11.orig/libext2fs/read_bb_file.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/read_bb_file.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,97 @@
++/*
++ * read_bb_file.c --- read a list of bad blocks from a FILE *
++ *
++ * Copyright (C) 1994, 1995, 2000 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * Reads a list of bad blocks from  a FILE *
++ */
++errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, 
++			       ext2_badblocks_list *bb_list,
++			       void *priv_data,
++			       void (*invalid)(ext2_filsys fs,
++					       blk_t blk,
++					       char *badstr,
++					       void *priv_data))
++{
++	errcode_t	retval;
++	blk_t		blockno;
++	int		count;
++	char		buf[128];
++
++	if (fs)
++		EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!*bb_list) {
++		retval = ext2fs_badblocks_list_create(bb_list, 10);
++		if (retval)
++			return retval;
++	}
++
++	while (!feof (f)) {
++		if (fgets(buf, sizeof(buf), f) == NULL)
++			break;
++		count = sscanf(buf, "%u", &blockno);
++		if (count <= 0)
++			continue;
++		if (fs &&
++		    ((blockno < fs->super->s_first_data_block) ||
++		    (blockno >= fs->super->s_blocks_count))) {
++			if (invalid)
++				(invalid)(fs, blockno, buf, priv_data);
++			continue;
++		}
++		retval = ext2fs_badblocks_list_add(*bb_list, blockno);
++		if (retval)
++			return retval;
++	}
++	return 0;
++}
++
++static void call_compat_invalid(ext2_filsys fs, blk_t blk,
++				char *badstr EXT2FS_ATTR((unused)), 
++				void *priv_data)
++{
++	void (*invalid)(ext2_filsys, blk_t);
++
++	invalid = (void (*)(ext2_filsys, blk_t)) priv_data;
++	if (invalid)
++		invalid(fs, blk);
++}
++
++
++/*
++ * Reads a list of bad blocks from  a FILE *
++ */
++errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, 
++			      ext2_badblocks_list *bb_list,
++			      void (*invalid)(ext2_filsys fs, blk_t blk))
++{
++	return ext2fs_read_bb_FILE2(fs, f, bb_list, (void *) invalid,
++				    call_compat_invalid);
++}
++
++
+diff -Naur silo-1.4.11.orig/libext2fs/res_gdt.c silo-1.4.11/libext2fs/res_gdt.c
+--- silo-1.4.11.orig/libext2fs/res_gdt.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/res_gdt.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,220 @@
++/*
++ * res_gdt.c --- reserve blocks for growing the group descriptor table
++ *               during online resizing.
++ *
++ * Copyright (C) 2002 Andreas Dilger
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#include <time.h>
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * Iterate through the groups which hold BACKUP superblock/GDT copies in an
++ * ext3 filesystem.  The counters should be initialized to 1, 5, and 7 before
++ * calling this for the first time.  In a sparse filesystem it will be the
++ * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ...
++ * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ...
++ */
++static unsigned int list_backups(ext2_filsys fs, unsigned int *three,
++				 unsigned int *five, unsigned int *seven)
++{
++	unsigned int *min = three;
++	int mult = 3;
++	unsigned int ret;
++
++	if (!(fs->super->s_feature_ro_compat &
++	      EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
++		ret = *min;
++		*min += 1;
++		return ret;
++	}
++
++	if (*five < *min) {
++		min = five;
++		mult = 5;
++	}
++	if (*seven < *min) {
++		min = seven;
++		mult = 7;
++	}
++
++	ret = *min;
++	*min *= mult;
++
++	return ret;
++}
++
++/*
++ * This code assumes that the reserved blocks have already been marked in-use
++ * during ext2fs_initialize(), so that they are not allocated for other
++ * uses before we can add them to the resize inode (which has to come
++ * after the creation of the inode table).
++ */
++errcode_t ext2fs_create_resize_inode(ext2_filsys fs)
++{
++	errcode_t		retval, retval2;
++	struct ext2_super_block	*sb;
++	struct ext2_inode	inode;
++	__u32			*dindir_buf, *gdt_buf;
++	int			rsv_add;
++	unsigned long long	apb, inode_size;
++	blk_t			dindir_blk, rsv_off, gdt_off, gdt_blk;
++	int			dindir_dirty = 0, inode_dirty = 0;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	sb = fs->super;
++
++	retval = ext2fs_get_mem(2 * fs->blocksize, (void **)&dindir_buf);
++	if (retval)
++		goto out_free;
++	gdt_buf = (__u32 *)((char *)dindir_buf + fs->blocksize);
++
++	retval = ext2fs_read_inode(fs, EXT2_RESIZE_INO, &inode);
++	if (retval)
++		goto out_free;
++
++	/* Maximum possible file size (we donly use the dindirect blocks) */
++	apb = EXT2_ADDR_PER_BLOCK(sb);
++	rsv_add = fs->blocksize / 512;
++	if ((dindir_blk = inode.i_block[EXT2_DIND_BLOCK])) {
++#ifdef RES_GDT_DEBUG
++		printf("reading GDT dindir %u\n", dindir_blk);
++#endif
++		retval = ext2fs_read_ind_block(fs, dindir_blk, dindir_buf);
++		if (retval)
++			goto out_inode;
++	} else {
++		blk_t goal = 3 + sb->s_reserved_gdt_blocks +
++			fs->desc_blocks + fs->inode_blocks_per_group;
++
++		retval = ext2fs_alloc_block(fs, goal, 0, &dindir_blk);
++		if (retval)
++			goto out_free;
++		inode.i_mode = LINUX_S_IFREG | 0600;
++		inode.i_links_count = 1;
++		inode.i_block[EXT2_DIND_BLOCK] = dindir_blk;
++		inode.i_blocks = rsv_add;
++		memset(dindir_buf, 0, fs->blocksize);
++#ifdef RES_GDT_DEBUG
++		printf("allocated GDT dindir %u\n", dindir_blk);
++#endif
++		dindir_dirty = inode_dirty = 1;
++		inode_size = apb*apb + apb + EXT2_NDIR_BLOCKS;
++		inode_size *= fs->blocksize;
++		inode.i_size = inode_size & 0xFFFFFFFF;
++		inode.i_size_high = (inode_size >> 32) & 0xFFFFFFFF;
++		if(inode.i_size_high) {
++			sb->s_feature_ro_compat |=
++				EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
++		}
++		inode.i_ctime = time(0);
++	}
++
++	for (rsv_off = 0, gdt_off = fs->desc_blocks,
++	     gdt_blk = sb->s_first_data_block + 1 + fs->desc_blocks;
++	     rsv_off < sb->s_reserved_gdt_blocks;
++	     rsv_off++, gdt_off++, gdt_blk++) {
++		unsigned int three = 1, five = 5, seven = 7;
++		unsigned int grp, last = 0;
++		int gdt_dirty = 0;
++
++		gdt_off %= apb;
++		if (!dindir_buf[gdt_off]) {
++			/* FIXME XXX XXX
++			blk_t new_blk;
++
++			retval = ext2fs_new_block(fs, gdt_blk, 0, &new_blk);
++			if (retval)
++				goto out_free;
++			if (new_blk != gdt_blk) {
++				// XXX free block
++				retval = -1; // XXX
++			}
++			*/
++			gdt_dirty = dindir_dirty = inode_dirty = 1;
++			memset(gdt_buf, 0, fs->blocksize);
++			dindir_buf[gdt_off] = gdt_blk;
++			inode.i_blocks += rsv_add;
++#ifdef RES_GDT_DEBUG
++			printf("added primary GDT block %u at %u[%u]\n",
++			       gdt_blk, dindir_blk, gdt_off);
++#endif
++		} else if (dindir_buf[gdt_off] == gdt_blk) {
++#ifdef RES_GDT_DEBUG
++			printf("reading primary GDT block %u\n", gdt_blk);
++#endif
++			retval = ext2fs_read_ind_block(fs, gdt_blk, gdt_buf);
++			if (retval)
++				goto out_dindir;
++		} else {
++#ifdef RES_GDT_DEBUG
++			printf("bad primary GDT %u != %u at %u[%u]\n",
++			       dindir_buf[gdt_off], gdt_blk,dindir_blk,gdt_off);
++#endif
++			retval = EXT2_ET_RESIZE_INODE_CORRUPT;
++			goto out_dindir;
++		}
++
++		while ((grp = list_backups(fs, &three, &five, &seven)) <
++		       fs->group_desc_count) {
++			blk_t expect = gdt_blk + grp * sb->s_blocks_per_group;
++
++			if (!gdt_buf[last]) {
++#ifdef RES_GDT_DEBUG
++				printf("added backup GDT %u grp %u@%u[%u]\n",
++				       expect, grp, gdt_blk, last);
++#endif
++				gdt_buf[last] = expect;
++				inode.i_blocks += rsv_add;
++				gdt_dirty = inode_dirty = 1;
++			} else if (gdt_buf[last] != expect) {
++#ifdef RES_GDT_DEBUG
++				printf("bad backup GDT %u != %u at %u[%u]\n",
++				       gdt_buf[last], expect, gdt_blk, last);
++#endif
++				retval = EXT2_ET_RESIZE_INODE_CORRUPT;
++				goto out_dindir;
++			}
++			last++;
++		}
++		if (gdt_dirty) {
++#ifdef RES_GDT_DEBUG
++			printf("writing primary GDT block %u\n", gdt_blk);
++#endif
++			retval = ext2fs_write_ind_block(fs, gdt_blk, gdt_buf);
++			if (retval)
++				goto out_dindir;
++		}
++	}
++
++out_dindir:
++	if (dindir_dirty) {
++		retval2 = ext2fs_write_ind_block(fs, dindir_blk, dindir_buf);
++		if (!retval)
++			retval = retval2;
++	}
++out_inode:
++#ifdef RES_GDT_DEBUG
++	printf("inode.i_blocks = %u, i_size = %u\n", inode.i_blocks,
++	       inode.i_size);
++#endif
++	if (inode_dirty) {
++		inode.i_atime = inode.i_mtime = time(0);
++		retval2 = ext2fs_write_inode(fs, EXT2_RESIZE_INO, &inode);
++		if (!retval)
++			retval = retval2;
++	}
++out_free:
++	ext2fs_free_mem((void **)&dindir_buf);
++	return retval;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/rs_bitmap.c silo-1.4.11/libext2fs/rs_bitmap.c
+--- silo-1.4.11.orig/libext2fs/rs_bitmap.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/rs_bitmap.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,106 @@
++/*
++ * rs_bitmap.c --- routine for changing the size of a bitmap
++ *
++ * Copyright (C) 1996, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, __u32 new_real_end,
++				       ext2fs_generic_bitmap bmap)
++{
++	errcode_t	retval;
++	size_t		size, new_size;
++	__u32		bitno;
++
++	if (!bmap)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_GENERIC_BITMAP);
++
++	/*
++	 * If we're expanding the bitmap, make sure all of the new
++	 * parts of the bitmap are zero.
++	 */
++	if (new_end > bmap->end) {
++		bitno = bmap->real_end;
++		if (bitno > new_end)
++			bitno = new_end;
++		for (; bitno > bmap->end; bitno--)
++			ext2fs_clear_bit(bitno - bmap->start, bmap->bitmap);
++	}
++	if (new_real_end == bmap->real_end) {
++		bmap->end = new_end;
++		return 0;
++	}
++	
++	size = ((bmap->real_end - bmap->start) / 8) + 1;
++	new_size = ((new_real_end - bmap->start) / 8) + 1;
++
++	if (size != new_size) {
++		retval = ext2fs_resize_mem(size, new_size, &bmap->bitmap);
++		if (retval)
++			return retval;
++	}
++	if (new_size > size)
++		memset(bmap->bitmap + size, 0, new_size - size);
++
++	bmap->end = new_end;
++	bmap->real_end = new_real_end;
++	return 0;
++}
++
++errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end,
++				     ext2fs_inode_bitmap bmap)
++{
++	errcode_t	retval;
++	
++	if (!bmap)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_INODE_BITMAP);
++
++	bmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP;
++	retval = ext2fs_resize_generic_bitmap(new_end, new_real_end,
++					      bmap);
++	bmap->magic = EXT2_ET_MAGIC_INODE_BITMAP;
++	return retval;
++}
++
++errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end,
++				     ext2fs_block_bitmap bmap)
++{
++	errcode_t	retval;
++	
++	if (!bmap)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	EXT2_CHECK_MAGIC(bmap, EXT2_ET_MAGIC_BLOCK_BITMAP);
++
++	bmap->magic = EXT2_ET_MAGIC_GENERIC_BITMAP;
++	retval = ext2fs_resize_generic_bitmap(new_end, new_real_end,
++					      bmap);
++	bmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP;
++	return retval;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/rw_bitmaps.c silo-1.4.11/libext2fs/rw_bitmaps.c
+--- silo-1.4.11.orig/libext2fs/rw_bitmaps.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/rw_bitmaps.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,300 @@
++/*
++ * rw_bitmaps.c --- routines to read and write the  inode and block bitmaps.
++ *
++ * Copyright (C) 1993, 1994, 1994, 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#ifdef HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++#include "e2image.h"
++
++#if defined(__powerpc__) && defined(EXT2FS_ENABLE_SWAPFS)
++/*
++ * On the PowerPC, the big-endian variant of the ext2 filesystem
++ * has its bitmaps stored as 32-bit words with bit 0 as the LSB
++ * of each word.  Thus a bitmap with only bit 0 set would be, as
++ * a string of bytes, 00 00 00 01 00 ...
++ * To cope with this, we byte-reverse each word of a bitmap if
++ * we have a big-endian filesystem, that is, if we are *not*
++ * byte-swapping other word-sized numbers.
++ */
++#define EXT2_BIG_ENDIAN_BITMAPS
++#endif
++
++#ifdef EXT2_BIG_ENDIAN_BITMAPS
++static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes)
++{
++	__u32 *p = (__u32 *) bitmap;
++	int n;
++		
++	for (n = nbytes / sizeof(__u32); n > 0; --n, ++p)
++		*p = ext2fs_swab32(*p);
++}
++#endif
++
++errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs)
++{
++	dgrp_t 		i;
++	size_t		nbytes;
++	errcode_t	retval;
++	char * inode_bitmap = fs->inode_map->bitmap;
++	char * bitmap_block = NULL;
++	blk_t		blk;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++	if (!inode_bitmap)
++		return 0;
++	nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8);
++	
++	retval = ext2fs_get_mem(fs->blocksize, &bitmap_block);
++	if (retval)
++		return retval;
++	memset(bitmap_block, 0xff, fs->blocksize);
++	for (i = 0; i < fs->group_desc_count; i++) {
++		memcpy(bitmap_block, inode_bitmap, nbytes);
++		blk = fs->group_desc[i].bg_inode_bitmap;
++		if (blk) {
++#ifdef EXT2_BIG_ENDIAN_BITMAPS
++			if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++			      (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)))
++				ext2fs_swap_bitmap(fs, bitmap_block, nbytes);
++#endif
++			retval = io_channel_write_blk(fs->io, blk, 1,
++						      bitmap_block);
++			if (retval)
++				return EXT2_ET_INODE_BITMAP_WRITE;
++		}
++		inode_bitmap += nbytes;
++	}
++	fs->flags &= ~EXT2_FLAG_IB_DIRTY;
++	ext2fs_free_mem(&bitmap_block);
++	return 0;
++}
++
++errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
++{
++	dgrp_t 		i;
++	unsigned int	j;
++	int		nbytes;
++	unsigned int	nbits;
++	errcode_t	retval;
++	char * block_bitmap = fs->block_map->bitmap;
++	char * bitmap_block = NULL;
++	blk_t		blk;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++	if (!block_bitmap)
++		return 0;
++	nbytes = EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
++	retval = ext2fs_get_mem(fs->blocksize, &bitmap_block);
++	if (retval)
++		return retval;
++	memset(bitmap_block, 0xff, fs->blocksize);
++	for (i = 0; i < fs->group_desc_count; i++) {
++		memcpy(bitmap_block, block_bitmap, nbytes);
++		if (i == fs->group_desc_count - 1) {
++			/* Force bitmap padding for the last group */
++			nbits = ((fs->super->s_blocks_count
++				  - fs->super->s_first_data_block)
++				 % EXT2_BLOCKS_PER_GROUP(fs->super));
++			if (nbits)
++				for (j = nbits; j < fs->blocksize * 8; j++)
++					ext2fs_set_bit(j, bitmap_block);
++		}
++		blk = fs->group_desc[i].bg_block_bitmap;
++		if (blk) {
++#ifdef EXT2_BIG_ENDIAN_BITMAPS
++			if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++			      (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)))
++				ext2fs_swap_bitmap(fs, bitmap_block, nbytes);
++#endif
++			retval = io_channel_write_blk(fs->io, blk, 1,
++						      bitmap_block);
++			if (retval)
++				return EXT2_ET_BLOCK_BITMAP_WRITE;
++		}
++		block_bitmap += nbytes;
++	}
++	fs->flags &= ~EXT2_FLAG_BB_DIRTY;
++	ext2fs_free_mem(&bitmap_block);
++	return 0;
++}
++
++static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
++{
++	dgrp_t i;
++	char *block_bitmap = 0, *inode_bitmap = 0;
++	char *buf;
++	errcode_t retval;
++	int block_nbytes = (int) EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
++	int inode_nbytes = (int) EXT2_INODES_PER_GROUP(fs->super) / 8;
++	blk_t	blk;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	fs->write_bitmaps = ext2fs_write_bitmaps;
++
++	retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf);
++	if (retval)
++		return retval;
++	if (do_block) {
++		if (fs->block_map)
++			ext2fs_free_block_bitmap(fs->block_map);
++		sprintf(buf, "block bitmap for %s", fs->device_name);
++		retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map);
++		if (retval)
++			goto cleanup;
++		block_bitmap = fs->block_map->bitmap;
++	}
++	if (do_inode) {
++		if (fs->inode_map)
++			ext2fs_free_inode_bitmap(fs->inode_map);
++		sprintf(buf, "inode bitmap for %s", fs->device_name);
++		retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map);
++		if (retval)
++			goto cleanup;
++		inode_bitmap = fs->inode_map->bitmap;
++	}
++	ext2fs_free_mem(&buf);
++
++	if (fs->flags & EXT2_FLAG_IMAGE_FILE) {
++		if (inode_bitmap) {
++			blk = (fs->image_header->offset_inodemap /
++			       fs->blocksize);
++			retval = io_channel_read_blk(fs->image_io, blk,
++			     -(inode_nbytes * fs->group_desc_count),
++			     inode_bitmap);
++			if (retval)
++				goto cleanup;
++		}
++		if (block_bitmap) {
++			blk = (fs->image_header->offset_blockmap /
++			       fs->blocksize);
++			retval = io_channel_read_blk(fs->image_io, blk, 
++			     -(block_nbytes * fs->group_desc_count),
++			     block_bitmap);
++			if (retval)
++				goto cleanup;
++		}
++		return 0;
++	}
++
++	for (i = 0; i < fs->group_desc_count; i++) {
++		if (block_bitmap) {
++			blk = fs->group_desc[i].bg_block_bitmap;
++			if (blk) {
++				retval = io_channel_read_blk(fs->io, blk,
++					     -block_nbytes, block_bitmap);
++				if (retval) {
++					retval = EXT2_ET_BLOCK_BITMAP_READ;
++					goto cleanup;
++				}
++#ifdef EXT2_BIG_ENDIAN_BITMAPS
++				if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++				      (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)))
++					ext2fs_swap_bitmap(fs, block_bitmap, block_nbytes);
++#endif
++			} else
++				memset(block_bitmap, 0, block_nbytes);
++			block_bitmap += block_nbytes;
++		}
++		if (inode_bitmap) {
++			blk = fs->group_desc[i].bg_inode_bitmap;
++			if (blk) {
++				retval = io_channel_read_blk(fs->io, blk,
++					     -inode_nbytes, inode_bitmap);
++				if (retval) {
++					retval = EXT2_ET_INODE_BITMAP_READ;
++					goto cleanup;
++				}
++#ifdef EXT2_BIG_ENDIAN_BITMAPS
++				if (!((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
++				      (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)))
++					ext2fs_swap_bitmap(fs, inode_bitmap, inode_nbytes);
++#endif
++			} else
++				memset(inode_bitmap, 0, inode_nbytes);
++			inode_bitmap += inode_nbytes;
++		}
++	}
++	return 0;
++	
++cleanup:
++	if (do_block) {
++		ext2fs_free_mem(&fs->block_map);
++		fs->block_map = 0;
++	}
++	if (do_inode) {
++		ext2fs_free_mem(&fs->inode_map);
++		fs->inode_map = 0;
++	}
++	if (buf)
++		ext2fs_free_mem(&buf);
++	return retval;
++}
++
++errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs)
++{
++	return read_bitmaps(fs, 1, 0);
++}
++
++errcode_t ext2fs_read_block_bitmap(ext2_filsys fs)
++{
++	return read_bitmaps(fs, 0, 1);
++}
++
++errcode_t ext2fs_read_bitmaps(ext2_filsys fs)
++{
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (fs->inode_map && fs->block_map)
++		return 0;
++
++	return read_bitmaps(fs, !fs->inode_map, !fs->block_map);
++}
++
++errcode_t ext2fs_write_bitmaps(ext2_filsys fs)
++{
++	errcode_t	retval;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (fs->block_map && ext2fs_test_bb_dirty(fs)) {
++		retval = ext2fs_write_block_bitmap(fs);
++		if (retval)
++			return retval;
++	}
++	if (fs->inode_map && ext2fs_test_ib_dirty(fs)) {
++		retval = ext2fs_write_inode_bitmap(fs);
++		if (retval)
++			return retval;
++	}
++	return 0;
++}	
++
+diff -Naur silo-1.4.11.orig/libext2fs/sparse.c silo-1.4.11/libext2fs/sparse.c
+--- silo-1.4.11.orig/libext2fs/sparse.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/sparse.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,78 @@
++/*
++ * sparse.c --- find the groups in an ext2 filesystem with metadata backups
++ *
++ * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
++ * Copyright (C) 2002 Andreas Dilger.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++
++#include "ext2_fs.h"
++#include "ext2fsP.h"
++
++static int test_root(int a, int b)
++{
++	if (a == 0)
++		return 1;
++	while (1) {
++		if (a == 1)
++			return 1;
++		if (a % b)
++			return 0;
++		a = a / b;
++	}
++}
++
++int ext2fs_bg_has_super(ext2_filsys fs, int group_block)
++{
++	if (!(fs->super->s_feature_ro_compat &
++	      EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
++		return 1;
++
++	if (test_root(group_block, 3) || (test_root(group_block, 5)) ||
++	    test_root(group_block, 7))
++		return 1;
++
++	return 0;
++}
++
++/*
++ * Iterate through the groups which hold BACKUP superblock/GDT copies in an
++ * ext3 filesystem.  The counters should be initialized to 1, 5, and 7 before
++ * calling this for the first time.  In a sparse filesystem it will be the
++ * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ...
++ * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ...
++ */
++unsigned int ext2fs_list_backups(ext2_filsys fs, unsigned int *three,
++				 unsigned int *five, unsigned int *seven)
++{
++	unsigned int *min = three;
++	int mult = 3;
++	unsigned int ret;
++
++	if (!(fs->super->s_feature_ro_compat &
++	      EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
++		ret = *min;
++		*min += 1;
++		return ret;
++	}
++
++	if (*five < *min) {
++		min = five;
++		mult = 5;
++	}
++	if (*seven < *min) {
++		min = seven;
++		mult = 7;
++	}
++
++	ret = *min;
++	*min *= mult;
++
++	return ret;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/swapfs.c silo-1.4.11/libext2fs/swapfs.c
+--- silo-1.4.11.orig/libext2fs/swapfs.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/swapfs.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,237 @@
++/*
++ * swapfs.c --- swap ext2 filesystem data structures
++ * 
++ * Copyright (C) 1995, 1996, 2002 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++#include <ext2fs/ext2_ext_attr.h>
++
++#ifdef EXT2FS_ENABLE_SWAPFS
++void ext2fs_swap_super(struct ext2_super_block * sb)
++{
++  	int i;
++	sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count);
++	sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count);
++	sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count);
++	sb->s_free_blocks_count = ext2fs_swab32(sb->s_free_blocks_count);
++	sb->s_free_inodes_count = ext2fs_swab32(sb->s_free_inodes_count);
++	sb->s_first_data_block = ext2fs_swab32(sb->s_first_data_block);
++	sb->s_log_block_size = ext2fs_swab32(sb->s_log_block_size);
++	sb->s_log_frag_size = ext2fs_swab32(sb->s_log_frag_size);
++	sb->s_blocks_per_group = ext2fs_swab32(sb->s_blocks_per_group);
++	sb->s_frags_per_group = ext2fs_swab32(sb->s_frags_per_group);
++	sb->s_inodes_per_group = ext2fs_swab32(sb->s_inodes_per_group);
++	sb->s_mtime = ext2fs_swab32(sb->s_mtime);
++	sb->s_wtime = ext2fs_swab32(sb->s_wtime);
++	sb->s_mnt_count = ext2fs_swab16(sb->s_mnt_count);
++	sb->s_max_mnt_count = ext2fs_swab16(sb->s_max_mnt_count);
++	sb->s_magic = ext2fs_swab16(sb->s_magic);
++	sb->s_state = ext2fs_swab16(sb->s_state);
++	sb->s_errors = ext2fs_swab16(sb->s_errors);
++	sb->s_minor_rev_level = ext2fs_swab16(sb->s_minor_rev_level);
++	sb->s_lastcheck = ext2fs_swab32(sb->s_lastcheck);
++	sb->s_checkinterval = ext2fs_swab32(sb->s_checkinterval);
++	sb->s_creator_os = ext2fs_swab32(sb->s_creator_os);
++	sb->s_rev_level = ext2fs_swab32(sb->s_rev_level);
++	sb->s_def_resuid = ext2fs_swab16(sb->s_def_resuid);
++	sb->s_def_resgid = ext2fs_swab16(sb->s_def_resgid);
++	sb->s_first_ino = ext2fs_swab32(sb->s_first_ino);
++	sb->s_inode_size = ext2fs_swab16(sb->s_inode_size);
++	sb->s_block_group_nr = ext2fs_swab16(sb->s_block_group_nr);
++	sb->s_feature_compat = ext2fs_swab32(sb->s_feature_compat);
++	sb->s_feature_incompat = ext2fs_swab32(sb->s_feature_incompat);
++	sb->s_feature_ro_compat = ext2fs_swab32(sb->s_feature_ro_compat);
++	sb->s_algorithm_usage_bitmap = ext2fs_swab32(sb->s_algorithm_usage_bitmap);
++	sb->s_reserved_gdt_blocks = ext2fs_swab16(sb->s_reserved_gdt_blocks);
++	sb->s_journal_inum = ext2fs_swab32(sb->s_journal_inum);
++	sb->s_journal_dev = ext2fs_swab32(sb->s_journal_dev);
++	sb->s_last_orphan = ext2fs_swab32(sb->s_last_orphan);
++	sb->s_default_mount_opts = ext2fs_swab32(sb->s_default_mount_opts);
++	sb->s_first_meta_bg = ext2fs_swab32(sb->s_first_meta_bg);
++	sb->s_mkfs_time = ext2fs_swab32(sb->s_mkfs_time);
++	for (i=0; i < 4; i++)
++		sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
++	for (i=0; i < 17; i++)
++		sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]);
++
++}
++
++void ext2fs_swap_group_desc(struct ext2_group_desc *gdp)
++{
++	gdp->bg_block_bitmap = ext2fs_swab32(gdp->bg_block_bitmap);
++	gdp->bg_inode_bitmap = ext2fs_swab32(gdp->bg_inode_bitmap);
++	gdp->bg_inode_table = ext2fs_swab32(gdp->bg_inode_table);
++	gdp->bg_free_blocks_count = ext2fs_swab16(gdp->bg_free_blocks_count);
++	gdp->bg_free_inodes_count = ext2fs_swab16(gdp->bg_free_inodes_count);
++	gdp->bg_used_dirs_count = ext2fs_swab16(gdp->bg_used_dirs_count);
++}
++
++void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header)
++{
++	struct ext2_ext_attr_header *from_header =
++		(struct ext2_ext_attr_header *)from;
++	struct ext2_ext_attr_header *to_header =
++		(struct ext2_ext_attr_header *)to;
++	struct ext2_ext_attr_entry *from_entry, *to_entry;
++	char *from_end = (char *)from_header + bufsize;
++	int n;
++
++	if (to_header != from_header)
++		memcpy(to_header, from_header, bufsize);
++
++	from_entry = (struct ext2_ext_attr_entry *)from_header;
++	to_entry   = (struct ext2_ext_attr_entry *)to_header;
++
++	if (has_header) {
++		to_header->h_magic    = ext2fs_swab32(from_header->h_magic);
++		to_header->h_blocks   = ext2fs_swab32(from_header->h_blocks);
++		to_header->h_refcount = ext2fs_swab32(from_header->h_refcount);
++		for (n=0; n<4; n++)
++			to_header->h_reserved[n] =
++				ext2fs_swab32(from_header->h_reserved[n]);
++		from_entry = (struct ext2_ext_attr_entry *)(from_header+1);
++		to_entry   = (struct ext2_ext_attr_entry *)(to_header+1);
++	}
++
++	while ((char *)from_entry < from_end && *(__u32 *)from_entry) {
++		to_entry->e_value_offs  =	
++			ext2fs_swab16(from_entry->e_value_offs);
++		to_entry->e_value_block =	
++			ext2fs_swab32(from_entry->e_value_block);
++		to_entry->e_value_size  =	
++			ext2fs_swab32(from_entry->e_value_size);
++		from_entry = EXT2_EXT_ATTR_NEXT(from_entry);
++		to_entry   = EXT2_EXT_ATTR_NEXT(to_entry);
++	}
++}
++
++void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t,
++			    struct ext2_inode_large *f, int hostorder,
++			    int bufsize)
++{
++	unsigned i;
++	int islnk = 0;
++	__u32 *eaf, *eat;
++
++	if (hostorder && LINUX_S_ISLNK(f->i_mode))
++		islnk = 1;
++	t->i_mode = ext2fs_swab16(f->i_mode);
++	if (!hostorder && LINUX_S_ISLNK(t->i_mode))
++		islnk = 1;
++	t->i_uid = ext2fs_swab16(f->i_uid);
++	t->i_size = ext2fs_swab32(f->i_size);
++	t->i_atime = ext2fs_swab32(f->i_atime);
++	t->i_ctime = ext2fs_swab32(f->i_ctime);
++	t->i_mtime = ext2fs_swab32(f->i_mtime);
++	t->i_dtime = ext2fs_swab32(f->i_dtime);
++	t->i_gid = ext2fs_swab16(f->i_gid);
++	t->i_links_count = ext2fs_swab16(f->i_links_count);
++	t->i_blocks = ext2fs_swab32(f->i_blocks);
++	t->i_flags = ext2fs_swab32(f->i_flags);
++	t->i_file_acl = ext2fs_swab32(f->i_file_acl);
++	t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
++	if (!islnk || ext2fs_inode_data_blocks(fs, (struct ext2_inode *)t)) {
++		for (i = 0; i < EXT2_N_BLOCKS; i++)
++			t->i_block[i] = ext2fs_swab32(f->i_block[i]);
++	} else if (t != f) {
++		for (i = 0; i < EXT2_N_BLOCKS; i++)
++			t->i_block[i] = f->i_block[i];
++	}
++	t->i_generation = ext2fs_swab32(f->i_generation);
++	t->i_faddr = ext2fs_swab32(f->i_faddr);
++
++	switch (fs->super->s_creator_os) {
++	case EXT2_OS_LINUX:
++		t->osd1.linux1.l_i_reserved1 =
++			ext2fs_swab32(f->osd1.linux1.l_i_reserved1);
++		t->osd2.linux2.l_i_frag = f->osd2.linux2.l_i_frag;
++		t->osd2.linux2.l_i_fsize = f->osd2.linux2.l_i_fsize;
++		t->osd2.linux2.i_pad1 = ext2fs_swab16(f->osd2.linux2.i_pad1);
++		t->osd2.linux2.l_i_uid_high =
++		  ext2fs_swab16 (f->osd2.linux2.l_i_uid_high);
++		t->osd2.linux2.l_i_gid_high =
++		  ext2fs_swab16 (f->osd2.linux2.l_i_gid_high);
++		t->osd2.linux2.l_i_reserved2 =
++			ext2fs_swab32(f->osd2.linux2.l_i_reserved2);
++		break;
++	case EXT2_OS_HURD:
++		t->osd1.hurd1.h_i_translator =
++		  ext2fs_swab32 (f->osd1.hurd1.h_i_translator);
++		t->osd2.hurd2.h_i_frag = f->osd2.hurd2.h_i_frag;
++		t->osd2.hurd2.h_i_fsize = f->osd2.hurd2.h_i_fsize;
++		t->osd2.hurd2.h_i_mode_high =
++		  ext2fs_swab16 (f->osd2.hurd2.h_i_mode_high);
++		t->osd2.hurd2.h_i_uid_high =
++		  ext2fs_swab16 (f->osd2.hurd2.h_i_uid_high);
++		t->osd2.hurd2.h_i_gid_high =
++		  ext2fs_swab16 (f->osd2.hurd2.h_i_gid_high);
++		t->osd2.hurd2.h_i_author =
++		  ext2fs_swab32 (f->osd2.hurd2.h_i_author);
++		break;
++	case EXT2_OS_MASIX:
++		t->osd1.masix1.m_i_reserved1 =
++			ext2fs_swab32(f->osd1.masix1.m_i_reserved1);
++		t->osd2.masix2.m_i_frag = f->osd2.masix2.m_i_frag;
++		t->osd2.masix2.m_i_fsize = f->osd2.masix2.m_i_fsize;
++		t->osd2.masix2.m_pad1 = ext2fs_swab16(f->osd2.masix2.m_pad1);
++		t->osd2.masix2.m_i_reserved2[0] =
++			ext2fs_swab32(f->osd2.masix2.m_i_reserved2[0]);
++		t->osd2.masix2.m_i_reserved2[1] =
++			ext2fs_swab32(f->osd2.masix2.m_i_reserved2[1]);
++		break;
++	}
++
++	if (bufsize < (int) (sizeof(struct ext2_inode) + sizeof(__u16)))
++		return; /* no i_extra_isize field */
++
++	t->i_extra_isize = ext2fs_swab16(f->i_extra_isize);
++	if (t->i_extra_isize > EXT2_INODE_SIZE(fs->super) -
++				sizeof(struct ext2_inode)) {
++		/* this is error case: i_extra_size is too large */
++		return;
++	}
++
++	i = sizeof(struct ext2_inode) + t->i_extra_isize + sizeof(__u32);
++	if (bufsize < (int) i)
++		return; /* no space for EA magic */
++
++	eaf = (__u32 *) (((char *) f) + sizeof(struct ext2_inode) +
++					f->i_extra_isize);
++
++	if (ext2fs_swab32(*eaf) != EXT2_EXT_ATTR_MAGIC)
++		return; /* it seems no magic here */
++
++	eat = (__u32 *) (((char *) t) + sizeof(struct ext2_inode) +
++					f->i_extra_isize);
++	*eat = ext2fs_swab32(*eaf);
++
++	/* convert EA(s) */
++	ext2fs_swap_ext_attr((char *) (eat + 1), (char *) (eaf + 1),
++			     bufsize - sizeof(struct ext2_inode) -
++			     t->i_extra_isize - sizeof(__u32), 0);
++
++}
++
++void ext2fs_swap_inode(ext2_filsys fs, struct ext2_inode *t,
++		       struct ext2_inode *f, int hostorder)
++{
++	ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) t,
++				(struct ext2_inode_large *) f, hostorder,
++				sizeof(struct ext2_inode));
++}
++
++#endif
+diff -Naur silo-1.4.11.orig/libext2fs/test_io.c silo-1.4.11/libext2fs/test_io.c
+--- silo-1.4.11.orig/libext2fs/test_io.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/test_io.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,411 @@
++/*
++ * test_io.c --- This is the Test I/O interface.
++ *
++ * Copyright (C) 1996 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#ifdef HAVE_SYS_PRCTL_H
++#include <sys/prctl.h>
++#else
++#define PR_GET_DUMPABLE 3
++#endif
++#if (!defined(HAVE_PRCTL) && defined(linux))
++#include <sys/syscall.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * For checking structure magic numbers...
++ */
++
++#define EXT2_CHECK_MAGIC(struct, code) \
++	  if ((struct)->magic != (code)) return (code)
++  
++struct test_private_data {
++	int	magic;
++	io_channel real;
++	int flags;
++	FILE *outfile;
++	unsigned long block;
++	int read_abort_count, write_abort_count;
++	void (*read_blk)(unsigned long block, int count, errcode_t err);
++	void (*write_blk)(unsigned long block, int count, errcode_t err);
++	void (*set_blksize)(int blksize, errcode_t err);
++	void (*write_byte)(unsigned long block, int count, errcode_t err);
++};
++
++static errcode_t test_open(const char *name, int flags, io_channel *channel);
++static errcode_t test_close(io_channel channel);
++static errcode_t test_set_blksize(io_channel channel, int blksize);
++static errcode_t test_read_blk(io_channel channel, unsigned long block,
++			       int count, void *data);
++static errcode_t test_write_blk(io_channel channel, unsigned long block,
++				int count, const void *data);
++static errcode_t test_flush(io_channel channel);
++static errcode_t test_write_byte(io_channel channel, unsigned long offset,
++				 int count, const void *buf);
++static errcode_t test_set_option(io_channel channel, const char *option, 
++				 const char *arg);
++
++static struct struct_io_manager struct_test_manager = {
++	EXT2_ET_MAGIC_IO_MANAGER,
++	"Test I/O Manager",
++	test_open,
++	test_close,
++	test_set_blksize,
++	test_read_blk,
++	test_write_blk,
++	test_flush,
++	test_write_byte,
++	test_set_option
++};
++
++io_manager test_io_manager = &struct_test_manager;
++
++/*
++ * These global variable can be set by the test program as
++ * necessary *before* calling test_open
++ */
++io_manager test_io_backing_manager = 0;
++void (*test_io_cb_read_blk)
++	(unsigned long block, int count, errcode_t err) = 0;
++void (*test_io_cb_write_blk)
++	(unsigned long block, int count, errcode_t err) = 0;
++void (*test_io_cb_set_blksize)
++	(int blksize, errcode_t err) = 0;
++void (*test_io_cb_write_byte)
++	(unsigned long block, int count, errcode_t err) = 0;
++
++/*
++ * Test flags
++ */
++#define TEST_FLAG_READ			0x01
++#define TEST_FLAG_WRITE			0x02
++#define TEST_FLAG_SET_BLKSIZE		0x04
++#define TEST_FLAG_FLUSH			0x08
++#define TEST_FLAG_DUMP			0x10
++#define TEST_FLAG_SET_OPTION		0x20
++
++static void test_dump_block(io_channel channel,
++			    struct test_private_data *data,
++			    unsigned long block, const void *buf)
++{
++	const unsigned char *cp;
++	FILE *f = data->outfile;
++	int	i;
++	unsigned long	cksum = 0;
++
++	for (i=0, cp = buf; i < channel->block_size; i++, cp++) {
++		cksum += *cp;
++	}
++	fprintf(f, "Contents of block %lu, checksum %08lu: \n", block, cksum);
++	for (i=0, cp = buf; i < channel->block_size; i++, cp++) {
++		if ((i % 16) == 0)
++			fprintf(f, "%04x: ", i);
++		fprintf(f, "%02x%c", *cp, ((i % 16) == 15) ? '\n' : ' ');
++	}
++}
++
++static void test_abort(io_channel channel, unsigned long block)
++{
++	struct test_private_data *data;
++	FILE *f;
++
++	data = (struct test_private_data *) channel->private_data;
++	f = data->outfile;
++	test_flush(channel);
++
++	fprintf(f, "Aborting due to I/O to block %lu\n", block);
++	fflush(f);
++	abort();
++}
++
++static char *safe_getenv(const char *arg)
++{
++	if ((getuid() != geteuid()) || (getgid() != getegid()))
++		return NULL;
++#if HAVE_PRCTL
++	if (prctl(PR_GET_DUMPABLE) == 0)
++		return NULL;
++#else
++#if (defined(linux) && defined(SYS_prctl))
++	if (syscall(SYS_prctl, PR_GET_DUMPABLE) == 0)
++		return NULL;
++#endif
++#endif
++
++#ifdef HAVE___SECURE_GETENV
++	return __secure_getenv(arg);
++#else
++	return getenv(arg);
++#endif
++}
++
++static errcode_t test_open(const char *name, int flags, io_channel *channel)
++{
++	io_channel	io = NULL;
++	struct test_private_data *data = NULL;
++	errcode_t	retval;
++	char		*value;
++
++	if (name == 0)
++		return EXT2_ET_BAD_DEVICE_NAME;
++	retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
++	if (retval)
++		return retval;
++	memset(io, 0, sizeof(struct struct_io_channel));
++	io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
++	retval = ext2fs_get_mem(sizeof(struct test_private_data), &data);
++	if (retval) {
++		retval = EXT2_ET_NO_MEMORY;
++		goto cleanup;
++	}
++	io->manager = test_io_manager;
++	retval = ext2fs_get_mem(strlen(name)+1, &io->name);
++	if (retval)
++		goto cleanup;
++
++	strcpy(io->name, name);
++	io->private_data = data;
++	io->block_size = 1024;
++	io->read_error = 0;
++	io->write_error = 0;
++	io->refcount = 1;
++
++	memset(data, 0, sizeof(struct test_private_data));
++	data->magic = EXT2_ET_MAGIC_TEST_IO_CHANNEL;
++	if (test_io_backing_manager) {
++		retval = test_io_backing_manager->open(name, flags,
++						       &data->real);
++		if (retval)
++			goto cleanup;
++	} else
++		data->real = 0;
++	data->read_blk = 	test_io_cb_read_blk;
++	data->write_blk = 	test_io_cb_write_blk;
++	data->set_blksize = 	test_io_cb_set_blksize;
++	data->write_byte = 	test_io_cb_write_byte;
++
++	data->outfile = NULL;
++	if ((value = safe_getenv("TEST_IO_LOGFILE")) != NULL)
++		data->outfile = fopen(value, "w");
++	if (!data->outfile)
++		data->outfile = stderr;
++
++	data->flags = 0;
++	if ((value = safe_getenv("TEST_IO_FLAGS")) != NULL)
++		data->flags = strtoul(value, NULL, 0);
++	
++	data->block = 0;
++	if ((value = safe_getenv("TEST_IO_BLOCK")) != NULL)
++		data->block = strtoul(value, NULL, 0);
++
++	data->read_abort_count = 0;
++	if ((value = safe_getenv("TEST_IO_READ_ABORT")) != NULL)
++		data->read_abort_count = strtoul(value, NULL, 0);
++
++	data->write_abort_count = 0;
++	if ((value = safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
++		data->write_abort_count = strtoul(value, NULL, 0);
++	
++	*channel = io;
++	return 0;
++
++cleanup:
++	if (io)
++		ext2fs_free_mem(&io);
++	if (data)
++		ext2fs_free_mem(&data);
++	return retval;
++}
++
++static errcode_t test_close(io_channel channel)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++	if (--channel->refcount > 0)
++		return 0;
++	
++	if (data->real)
++		retval = io_channel_close(data->real);
++
++	if (data->outfile && data->outfile != stderr)
++		fclose(data->outfile);
++	
++	ext2fs_free_mem(&channel->private_data);
++	if (channel->name)
++		ext2fs_free_mem(&channel->name);
++	ext2fs_free_mem(&channel);
++	return retval;
++}
++
++static errcode_t test_set_blksize(io_channel channel, int blksize)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++	if (data->real)
++		retval = io_channel_set_blksize(data->real, blksize);
++	if (data->set_blksize)
++		data->set_blksize(blksize, retval);
++	if (data->flags & TEST_FLAG_SET_BLKSIZE)
++		fprintf(data->outfile,
++			"Test_io: set_blksize(%d) returned %s\n",
++			blksize, retval ? error_message(retval) : "OK");
++	channel->block_size = blksize;
++	return retval;
++}
++
++
++static errcode_t test_read_blk(io_channel channel, unsigned long block,
++			       int count, void *buf)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++	if (data->real)
++		retval = io_channel_read_blk(data->real, block, count, buf);
++	if (data->read_blk)
++		data->read_blk(block, count, retval);
++	if (data->flags & TEST_FLAG_READ)
++		fprintf(data->outfile,
++			"Test_io: read_blk(%lu, %d) returned %s\n",
++			block, count, retval ? error_message(retval) : "OK");
++	if (data->block && data->block == block) {
++		if (data->flags & TEST_FLAG_DUMP)
++			test_dump_block(channel, data, block, buf);
++		if (--data->read_abort_count == 0)
++			test_abort(channel, block);
++	} 
++	return retval;
++}
++
++static errcode_t test_write_blk(io_channel channel, unsigned long block,
++			       int count, const void *buf)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++	if (data->real)
++		retval = io_channel_write_blk(data->real, block, count, buf);
++	if (data->write_blk)
++		data->write_blk(block, count, retval);
++	if (data->flags & TEST_FLAG_WRITE)
++		fprintf(data->outfile,
++			"Test_io: write_blk(%lu, %d) returned %s\n",
++			block, count, retval ? error_message(retval) : "OK");
++	if (data->block && data->block == block) {
++		if (data->flags & TEST_FLAG_DUMP)
++			test_dump_block(channel, data, block, buf);
++		if (--data->write_abort_count == 0)
++			test_abort(channel, block);
++	}
++	return retval;
++}
++
++static errcode_t test_write_byte(io_channel channel, unsigned long offset,
++			       int count, const void *buf)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++	if (data->real && data->real->manager->write_byte)
++		retval = io_channel_write_byte(data->real, offset, count, buf);
++	if (data->write_byte)
++		data->write_byte(offset, count, retval);
++	if (data->flags & TEST_FLAG_WRITE)
++		fprintf(data->outfile,
++			"Test_io: write_byte(%lu, %d) returned %s\n",
++			offset, count, retval ? error_message(retval) : "OK");
++	return retval;
++}
++
++/*
++ * Flush data buffers to disk.
++ */
++static errcode_t test_flush(io_channel channel)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++	
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++	if (data->real)
++		retval = io_channel_flush(data->real);
++	
++	if (data->flags & TEST_FLAG_FLUSH)
++		fprintf(data->outfile, "Test_io: flush() returned %s\n",
++			retval ? error_message(retval) : "OK");
++	
++	return retval;
++}
++
++static errcode_t test_set_option(io_channel channel, const char *option, 
++				 const char *arg)
++{
++	struct test_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct test_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL);
++
++
++	if (data->flags & TEST_FLAG_SET_OPTION)
++		fprintf(data->outfile, "Test_io: set_option(%s, %s) ", 
++			option, arg);
++	if (data->real && data->real->manager->set_option) {
++		retval = (data->real->manager->set_option)(data->real, 
++							   option, arg);
++		if (data->flags & TEST_FLAG_SET_OPTION)
++			fprintf(data->outfile, "returned %s\n",
++				retval ? error_message(retval) : "OK");
++	} else {
++		if (data->flags & TEST_FLAG_SET_OPTION)
++			fprintf(data->outfile, "not implemented\n");
++	}
++	return retval;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/tst_badblocks.c silo-1.4.11/libext2fs/tst_badblocks.c
+--- silo-1.4.11.orig/libext2fs/tst_badblocks.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/tst_badblocks.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,293 @@
++/*
++ * This testing program makes sure the badblocks implementation works.
++ *
++ * Copyright (C) 1996 by Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#define ADD_BLK	0x0001
++#define DEL_BLK	0x0002
++
++blk_t test1[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0 };
++blk_t test2[] = { 11, 10, 9, 8, 7, 6, 5, 4, 3, 3, 2, 1 };
++blk_t test3[] = { 3, 1, 4, 5, 9, 2, 7, 10, 5, 6, 10, 8, 0 };
++blk_t test4[] = { 20, 50, 12, 17, 13, 2, 66, 23, 56, 0 };
++blk_t test4a[] = {
++ 	20, 1,
++	50, 1,
++	3, 0,
++	17, 1,
++	18, 0,
++	16, 0,
++	11, 0,
++	12, 1,
++	13, 1,
++	14, 0, 
++	80, 0,
++	45, 0,
++	66, 1,
++	0 };
++blk_t test5[] = { 31, 20, 17, 51, 23, 1, 56, 57, 0 };
++blk_t test5a[] = {
++	50, ADD_BLK,
++	51, DEL_BLK,
++	57, DEL_BLK,
++	66, ADD_BLK,
++	31, DEL_BLK,
++	12, ADD_BLK,
++	2, ADD_BLK,
++	13, ADD_BLK,
++	1, DEL_BLK,
++	0
++	};
++		
++
++static int test_fail = 0;
++
++static errcode_t create_test_list(blk_t *vec, badblocks_list *ret)
++{
++	errcode_t	retval;
++	badblocks_list	bb;
++	int		i;
++	
++	retval = ext2fs_badblocks_list_create(&bb, 5);
++	if (retval) {
++		com_err("create_test_list", retval, "while creating list");
++		return retval;
++	}
++	for (i=0; vec[i]; i++) {
++		retval = ext2fs_badblocks_list_add(bb, vec[i]);
++		if (retval) {
++			com_err("create_test_list", retval,
++				"while adding test vector %d", i);
++			ext2fs_badblocks_list_free(bb);
++			return retval;
++		}
++	}
++	*ret = bb;
++	return 0;
++}
++
++static void print_list(badblocks_list bb, int verify)
++{
++	errcode_t	retval;
++	badblocks_iterate	iter;
++	blk_t			blk;
++	int			i, ok;
++	
++	retval = ext2fs_badblocks_list_iterate_begin(bb, &iter);
++	if (retval) {
++		com_err("print_list", retval, "while setting up iterator");
++		return;
++	}
++	ok = i = 1;
++	while (ext2fs_badblocks_list_iterate(iter, &blk)) {
++		printf("%d ", blk);
++		if (i++ != blk)
++			ok = 0;
++	}
++	ext2fs_badblocks_list_iterate_end(iter);
++	if (verify) {
++		if (ok)
++			printf("--- OK");
++		else {
++			printf("--- NOT OK");
++			test_fail++;
++		}
++	}
++}
++
++static void validate_test_seq(badblocks_list bb, blk_t *vec)
++{
++	int	i, match, ok;
++
++	for (i = 0; vec[i]; i += 2) {
++		match = ext2fs_badblocks_list_test(bb, vec[i]);
++		if (match == vec[i+1])
++			ok = 1;
++		else {
++			ok = 0;
++			test_fail++;
++		}
++		printf("\tblock %d is %s --- %s\n", vec[i],
++		       match ? "present" : "absent",
++		       ok ? "OK" : "NOT OK");
++	}
++}
++
++static void do_test_seq(badblocks_list bb, blk_t *vec)
++{
++	int	i, match;
++
++	for (i = 0; vec[i]; i += 2) {
++		switch (vec[i+1]) {
++		case ADD_BLK:
++			ext2fs_badblocks_list_add(bb, vec[i]);
++			match = ext2fs_badblocks_list_test(bb, vec[i]);
++			printf("Adding block %d --- now %s\n", vec[i], 
++			       match ? "present" : "absent");
++			if (!match) {
++				printf("FAILURE!\n");
++				test_fail++;
++			}
++			break;
++		case DEL_BLK:
++			ext2fs_badblocks_list_del(bb, vec[i]);
++			match = ext2fs_badblocks_list_test(bb, vec[i]);
++			printf("Removing block %d --- now %s\n", vec[i], 
++			       ext2fs_badblocks_list_test(bb, vec[i]) ? 
++			       "present" : "absent");
++			if (match) {
++				printf("FAILURE!\n");
++				test_fail++;
++			}
++			break;
++		}
++	}
++}
++
++
++int file_test(badblocks_list bb)
++{
++	badblocks_list new_bb = 0;
++	errcode_t	retval;
++	FILE	*f;
++
++	f = tmpfile();
++	if (!f) {
++		fprintf(stderr, "Error opening temp file: %s\n",
++			error_message(errno));
++		return 1;
++	}
++	retval = ext2fs_write_bb_FILE(bb, 0, f);
++	if (retval) {
++		com_err("file_test", retval, "while writing bad blocks");
++		return 1;
++	}
++
++	rewind(f);
++	retval = ext2fs_read_bb_FILE2(0, f, &new_bb, 0, 0);
++	if (retval) {
++		com_err("file_test", retval, "while reading bad blocks");
++		return 1;
++	}
++	fclose(f);
++
++	if (ext2fs_badblocks_equal(bb, new_bb)) {
++		printf("Block bitmap matched after reading and writing.\n");
++	} else {
++		printf("Block bitmap NOT matched.\n");
++		test_fail++;
++	}
++	return 0;
++}
++
++
++int main(int argc, char **argv)
++{
++	badblocks_list bb1, bb2, bb3, bb4, bb5;
++	int	equal;
++	errcode_t	retval;
++
++	bb1 = bb2 = bb3 = bb4 = bb5 = 0;
++
++	printf("test1: ");
++	retval = create_test_list(test1, &bb1);
++	if (retval == 0)
++		print_list(bb1, 1);
++	printf("\n");
++	
++	printf("test2: ");
++	retval = create_test_list(test2, &bb2);
++	if (retval == 0)
++		print_list(bb2, 1);
++	printf("\n");
++
++	printf("test3: ");
++	retval = create_test_list(test3, &bb3);
++	if (retval == 0)
++		print_list(bb3, 1);
++	printf("\n");
++	
++	printf("test4: ");
++	retval = create_test_list(test4, &bb4);
++	if (retval == 0) {
++		print_list(bb4, 0);
++		printf("\n");
++		validate_test_seq(bb4, test4a);
++	}
++	printf("\n");
++
++	printf("test5: ");
++	retval = create_test_list(test5, &bb5);
++	if (retval == 0) {
++		print_list(bb5, 0);
++		printf("\n");
++		do_test_seq(bb5, test5a);
++		printf("After test5 sequence: ");
++		print_list(bb5, 0);
++		printf("\n");
++	}
++	printf("\n");
++
++	if (bb1 && bb2 && bb3 && bb4 && bb5) {
++		printf("Comparison tests:\n");
++		equal = ext2fs_badblocks_equal(bb1, bb2);
++		printf("bb1 and bb2 are %sequal.\n", equal ? "" : "NOT "); 
++		if (equal)
++			test_fail++;
++
++		equal = ext2fs_badblocks_equal(bb1, bb3);
++		printf("bb1 and bb3 are %sequal.\n", equal ? "" : "NOT "); 
++		if (!equal)
++			test_fail++;
++		
++		equal = ext2fs_badblocks_equal(bb1, bb4);
++		printf("bb1 and bb4 are %sequal.\n", equal ? "" : "NOT "); 
++		if (equal)
++			test_fail++;
++
++		equal = ext2fs_badblocks_equal(bb4, bb5);
++		printf("bb4 and bb5 are %sequal.\n", equal ? "" : "NOT "); 
++		if (!equal)
++			test_fail++;
++		printf("\n");
++	}
++	
++	file_test(bb4);
++	
++	if (test_fail == 0)
++		printf("ext2fs library badblocks tests checks out OK!\n");
++
++	if (bb1)
++		ext2fs_badblocks_list_free(bb1);
++	if (bb2)
++		ext2fs_badblocks_list_free(bb2);
++	if (bb3)
++		ext2fs_badblocks_list_free(bb3);
++	if (bb4)
++		ext2fs_badblocks_list_free(bb4);
++
++	return test_fail;
++
++}
+diff -Naur silo-1.4.11.orig/libext2fs/tst_bitops.c silo-1.4.11/libext2fs/tst_bitops.c
+--- silo-1.4.11.orig/libext2fs/tst_bitops.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/tst_bitops.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,44 @@
++/*
++ * This testing program makes sure the bitops functions work
++ *
++ * Copyright (C) 2001 by Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++/* #define _EXT2_USE_C_VERSIONS_ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++unsigned char bitarray[] = {
++	0x80, 0xF0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x10, 0x20, 0x00, 0x00
++	};
++
++main(int argc, char **argv)
++{
++	int	i, size;
++
++	size = sizeof(bitarray)*8;
++	i = ext2fs_find_first_bit_set(bitarray, size);
++	while (i < size) {
++		printf("Bit set: %d\n", i);
++		i = ext2fs_find_next_bit_set(bitarray, size, i+1);
++	}
++}
+diff -Naur silo-1.4.11.orig/libext2fs/tst_byteswap.c silo-1.4.11/libext2fs/tst_byteswap.c
+--- silo-1.4.11.orig/libext2fs/tst_byteswap.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/tst_byteswap.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,92 @@
++/*
++ * This testing program makes sure the byteswap functions work
++ *
++ * Copyright (C) 2000 by Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++__u16 test1[] = {
++	0x0001, 0x0100,
++	0x1234, 0x3412,
++	0xff00, 0x00ff,
++	0x4000, 0x0040,
++	0xfeff, 0xfffe,
++	0x0000, 0x0000
++	};
++
++__u32 test2[] = {
++	0x00000001, 0x01000000,
++	0x80000000, 0x00000080,
++	0x12345678, 0x78563412,
++	0xffff0000, 0x0000ffff,
++	0x00ff0000, 0x0000ff00,
++	0xff000000, 0x000000ff,
++	0x00000000, 0x00000000
++	};
++
++int main(int argc, char **argv)
++{
++	int	i;
++	int	errors = 0;
++
++	printf("Testing ext2fs_swab16\n");
++	i=0;
++	do {
++		printf("swab16(0x%04x) = 0x%04x\n", test1[i],
++		       ext2fs_swab16(test1[i]));
++		if (ext2fs_swab16(test1[i]) != test1[i+1]) {
++			printf("Error!!!   %04x != %04x\n",
++			       ext2fs_swab16(test1[i]), test1[i+1]);
++			errors++;
++		}
++		if (ext2fs_swab16(test1[i+1]) != test1[i]) {
++			printf("Error!!!   %04x != %04x\n",
++			       ext2fs_swab16(test1[i+1]), test1[i]);
++			errors++;
++		}
++		i += 2;
++	} while (test1[i] != 0);
++	
++	printf("Testing ext2fs_swab32\n");
++	i = 0;
++	do {
++		printf("swab32(0x%08x) = 0x%08x\n", test2[i],
++		       ext2fs_swab32(test2[i]));
++		if (ext2fs_swab32(test2[i]) != test2[i+1]) {
++			printf("Error!!!   %04x != %04x\n",
++			       ext2fs_swab32(test2[i]), test2[i+1]);
++			errors++;
++		}
++		if (ext2fs_swab32(test2[i+1]) != test2[i]) {
++			printf("Error!!!   %04x != %04x\n",
++			       ext2fs_swab32(test2[i+1]), test2[i]);
++			errors++;
++		}
++		i += 2;
++	} while (test2[i] != 0);
++
++	if (!errors)
++		printf("No errors found in the byteswap implementation!\n");
++	
++	return errors;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/tst_getsectsize.c silo-1.4.11/libext2fs/tst_getsectsize.c
+--- silo-1.4.11.orig/libext2fs/tst_getsectsize.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/tst_getsectsize.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,47 @@
++/*
++ * tst_getsize.c --- this function tests the getsize function
++ * 
++ * Copyright (C) 1997 by Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++int main(int argc, char **argv)
++{
++	int	sectsize;
++	int	retval;
++	
++	if (argc < 2) {
++		fprintf(stderr, "Usage: %s device\n", argv[0]);
++		exit(1);
++	}
++
++	retval = ext2fs_get_device_sectsize(argv[1], &sectsize);
++	if (retval) {
++		com_err(argv[0], retval,
++			"while calling ext2fs_get_device_sectsize");
++		exit(1);
++	}
++	printf("Device %s has a hardware sector size of %d.\n",
++	       argv[1], sectsize);
++	exit(0);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/tst_getsize.c silo-1.4.11/libext2fs/tst_getsize.c
+--- silo-1.4.11.orig/libext2fs/tst_getsize.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/tst_getsize.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,44 @@
++/*
++ * tst_getsize.c --- this function tests the getsize function
++ * 
++ * Copyright (C) 1997 by Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++int main(int argc, const char *argv[])
++{
++	errcode_t	retval;
++	blk_t		blocks;
++
++	if (argc < 2) {
++		fprintf(stderr, "%s device\n", argv[0]);
++		exit(1);
++	}
++	retval = ext2fs_get_device_size(argv[1], 1024, &blocks);
++	if (retval) {
++		com_err(argv[0], retval, "while getting device size");
++		exit(1);
++	}
++	printf("%s is device has %d blocks.\n", argv[1], blocks);
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/tst_iscan.c silo-1.4.11/libext2fs/tst_iscan.c
+--- silo-1.4.11.orig/libext2fs/tst_iscan.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/tst_iscan.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,218 @@
++/*
++ * tst_inode.c --- this function tests the inode scan function
++ * 
++ * Copyright (C) 1996 by Theodore Ts'o.
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++blk_t test_vec[] = { 8, 12, 24, 34, 43, 44, 100, 0 };
++
++ext2_filsys	test_fs;
++ext2fs_block_bitmap bad_block_map, touched_map;
++ext2fs_inode_bitmap bad_inode_map;
++badblocks_list	test_badblocks;
++
++int first_no_comma = 1;
++int failed = 0;
++
++static void test_read_blk(unsigned long block, int count, errcode_t err)
++{
++	int	i;
++
++	if (first_no_comma)
++		first_no_comma = 0;
++	else
++		printf(", ");
++
++	if (count > 1)
++		printf("%lu-%lu", block, block+count-1);
++	else
++		printf("%lu", block);
++
++	for (i=0; i < count; i++, block++) {
++		if (ext2fs_test_block_bitmap(touched_map, block)) {
++			printf("\nDuplicate block?!? --- %lu\n", block);
++			failed++;
++			first_no_comma = 1;
++		}
++		ext2fs_mark_block_bitmap(touched_map, block);
++	}
++}
++
++/*
++ * Setup the variables for doing the inode scan test.
++ */
++static void setup(void)
++{
++	errcode_t	retval;
++	int		i;
++	struct ext2_super_block param;
++
++	initialize_ext2_error_table();
++
++	memset(&param, 0, sizeof(param));
++	param.s_blocks_count = 12000;
++
++
++	test_io_cb_read_blk = test_read_blk;
++	
++	retval = ext2fs_initialize("test fs", 0, &param,
++				   test_io_manager, &test_fs);
++	if (retval) {
++		com_err("setup", retval,
++			"While initializing filesystem");
++		exit(1);
++	}
++	retval = ext2fs_allocate_tables(test_fs);
++	if (retval) {
++		com_err("setup", retval,
++			"While allocating tables for test filesystem");
++		exit(1);
++	}
++	retval = ext2fs_allocate_block_bitmap(test_fs, "bad block map",
++					      &bad_block_map);
++	if (retval) {
++		com_err("setup", retval,
++			"While allocating bad_block bitmap");
++		exit(1);
++	}
++	retval = ext2fs_allocate_block_bitmap(test_fs, "touched map",
++					      &touched_map);
++	if (retval) {
++		com_err("setup", retval,
++			"While allocating touched block bitmap");
++		exit(1);
++	}
++	retval = ext2fs_allocate_inode_bitmap(test_fs, "bad inode map",
++					      &bad_inode_map);
++	if (retval) {
++		com_err("setup", retval,
++			"While allocating bad inode bitmap");
++		exit(1);
++	}
++	
++	retval = ext2fs_badblocks_list_create(&test_badblocks, 5);
++	if (retval) {
++		com_err("setup", retval, "while creating badblocks list");
++		exit(1);
++	}
++	for (i=0; test_vec[i]; i++) {
++		retval = ext2fs_badblocks_list_add(test_badblocks, test_vec[i]);
++		if (retval) {
++			com_err("setup", retval,
++				"while adding test vector %d", i);
++			exit(1);
++		}
++		ext2fs_mark_block_bitmap(bad_block_map, test_vec[i]);
++	}
++	test_fs->badblocks = test_badblocks;
++}
++
++/*
++ * Iterate using inode_scan
++ */
++static void iterate(void)
++{
++	struct ext2_inode inode;
++	ext2_inode_scan	scan;
++	errcode_t	retval;
++	ext2_ino_t	ino;
++
++	retval = ext2fs_open_inode_scan(test_fs, 8, &scan);
++	if (retval) {
++		com_err("iterate", retval, "While opening inode scan");
++		exit(1);
++	}
++	printf("Reading blocks: ");
++	retval = ext2fs_get_next_inode(scan, &ino, &inode);
++	if (retval) {
++		com_err("iterate", retval, "while reading first inode");
++		exit(1);
++	}
++	while (ino) {
++		retval = ext2fs_get_next_inode(scan, &ino, &inode);
++		if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) {
++			ext2fs_mark_inode_bitmap(bad_inode_map, ino);
++			continue;
++		}
++		if (retval) {
++			com_err("iterate", retval,
++				"while getting next inode");
++			exit(1);
++		}
++	}
++	printf("\n");
++	ext2fs_close_inode_scan(scan);
++}
++
++/*
++ * Verify the touched map
++ */
++static void check_map(void)
++{
++	int	i, j, first=1;
++	unsigned long	blk;
++
++	for (i=0; test_vec[i]; i++) {
++		if (ext2fs_test_block_bitmap(touched_map, test_vec[i])) {
++			printf("Bad block was touched --- %d\n", test_vec[i]);
++			failed++;
++			first_no_comma = 1;
++		}
++		ext2fs_mark_block_bitmap(touched_map, test_vec[i]);
++	}
++	for (i = 0; i < test_fs->group_desc_count; i++) {
++		for (j=0, blk = test_fs->group_desc[i].bg_inode_table;
++		     j < test_fs->inode_blocks_per_group;
++		     j++, blk++) {
++			if (!ext2fs_test_block_bitmap(touched_map, blk) &&
++			    !ext2fs_test_block_bitmap(bad_block_map, blk)) {
++				printf("Missing block --- %lu\n", blk);
++				failed++;
++			}
++		}
++	}
++	printf("Bad inodes: ");
++	for (i=1; i <= test_fs->super->s_inodes_count; i++) {
++		if (ext2fs_test_inode_bitmap(bad_inode_map, i)) {
++			if (first)
++				first = 0;
++			else
++				printf(", ");
++			printf("%d", i);
++		}
++	}
++	printf("\n");
++}
++
++
++int main(int argc, char **argv)
++{
++	setup();
++	iterate();
++	check_map();
++	if (!failed)
++		printf("Inode scan tested OK!\n");
++	return failed;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/unix_io.c silo-1.4.11/libext2fs/unix_io.c
+--- silo-1.4.11.orig/libext2fs/unix_io.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/unix_io.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,710 @@
++/*
++ * unix_io.c --- This is the Unix (well, really POSIX) implementation
++ * 	of the I/O manager.
++ *
++ * Implements a one-block write-through cache.
++ *
++ * Includes support for Windows NT support under Cygwin. 
++ *
++ * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++ * 	2002 by Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#define _LARGEFILE_SOURCE
++#define _LARGEFILE64_SOURCE
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#if HAVE_ERRNO_H
++#include <errno.h>
++#endif
++#include <fcntl.h>
++#include <time.h>
++#ifdef __linux__
++#include <sys/utsname.h>
++#endif
++#if HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#if HAVE_SYS_TYPES_H
++#include <sys/types.h>
++#endif
++#if HAVE_SYS_RESOURCE_H
++#include <sys/resource.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * For checking structure magic numbers...
++ */
++
++#define EXT2_CHECK_MAGIC(struct, code) \
++	  if ((struct)->magic != (code)) return (code)
++
++struct unix_cache {
++	char		*buf;
++	unsigned long	block;
++	int		access_time;
++	unsigned	dirty:1;
++	unsigned	in_use:1;
++};
++
++#define CACHE_SIZE 8
++#define WRITE_DIRECT_SIZE 4	/* Must be smaller than CACHE_SIZE */
++#define READ_DIRECT_SIZE 4	/* Should be smaller than CACHE_SIZE */
++
++struct unix_private_data {
++	int	magic;
++	int	dev;
++	int	flags;
++	int	access_time;
++	ext2_loff_t offset;
++	struct unix_cache cache[CACHE_SIZE];
++};
++
++static errcode_t unix_open(const char *name, int flags, io_channel *channel);
++static errcode_t unix_close(io_channel channel);
++static errcode_t unix_set_blksize(io_channel channel, int blksize);
++static errcode_t unix_read_blk(io_channel channel, unsigned long block,
++			       int count, void *data);
++static errcode_t unix_write_blk(io_channel channel, unsigned long block,
++				int count, const void *data);
++static errcode_t unix_flush(io_channel channel);
++static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
++				int size, const void *data);
++static errcode_t unix_set_option(io_channel channel, const char *option, 
++				 const char *arg);
++
++static void reuse_cache(io_channel channel, struct unix_private_data *data,
++		 struct unix_cache *cache, unsigned long block);
++
++/* __FreeBSD_kernel__ is defined by GNU/kFreeBSD - the FreeBSD kernel
++ * does not know buffered block devices - everything is raw. */
++#if defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
++#define NEED_BOUNCE_BUFFER
++#else
++#undef NEED_BOUNCE_BUFFER
++#endif
++
++static struct struct_io_manager struct_unix_manager = {
++	EXT2_ET_MAGIC_IO_MANAGER,
++	"Unix I/O Manager",
++	unix_open,
++	unix_close,
++	unix_set_blksize,
++	unix_read_blk,
++	unix_write_blk,
++	unix_flush,
++#ifdef NEED_BOUNCE_BUFFER
++	0,
++#else
++	unix_write_byte,
++#endif
++	unix_set_option
++};
++
++io_manager unix_io_manager = &struct_unix_manager;
++
++/*
++ * Here are the raw I/O functions
++ */
++#ifndef NEED_BOUNCE_BUFFER
++static errcode_t raw_read_blk(io_channel channel,
++			      struct unix_private_data *data,
++			      unsigned long block,
++			      int count, void *buf)
++{
++	errcode_t	retval;
++	ssize_t		size;
++	ext2_loff_t	location;
++	int		actual = 0;
++
++	size = (count < 0) ? -count : count * channel->block_size;
++	location = ((ext2_loff_t) block * channel->block_size) + data->offset;
++	if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
++		retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
++		goto error_out;
++	}
++	actual = read(data->dev, buf, size);
++	if (actual != size) {
++		if (actual < 0)
++			actual = 0;
++		retval = EXT2_ET_SHORT_READ;
++		goto error_out;
++	}
++	return 0;
++	
++error_out:
++	memset((char *) buf+actual, 0, size-actual);
++	if (channel->read_error)
++		retval = (channel->read_error)(channel, block, count, buf,
++					       size, actual, retval);
++	return retval;
++}
++#else /* NEED_BOUNCE_BUFFER */
++/*
++ * Windows and FreeBSD block devices only allow sector alignment IO in offset and size
++ */
++static errcode_t raw_read_blk(io_channel channel,
++			      struct unix_private_data *data,
++			      unsigned long block,
++			      int count, void *buf)
++{
++	errcode_t	retval;
++	size_t		size, alignsize, fragment;
++	ext2_loff_t	location;
++	int		total = 0, actual;
++#define BLOCKALIGN 512
++	char		sector[BLOCKALIGN];
++
++	size = (count < 0) ? -count : count * channel->block_size;
++	location = ((ext2_loff_t) block * channel->block_size) + data->offset;
++#ifdef DEBUG
++	printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n",
++	 		count, size, block, channel->block_size, location);
++#endif
++	if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
++		retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
++		goto error_out;
++	}
++	fragment = size % BLOCKALIGN;
++	alignsize = size - fragment;
++	if (alignsize) {
++		actual = read(data->dev, buf, alignsize);
++		if (actual != alignsize)
++			goto short_read;
++	}
++	if (fragment) {
++		actual = read(data->dev, sector, BLOCKALIGN);
++		if (actual != BLOCKALIGN)
++			goto short_read;
++		memcpy(buf+alignsize, sector, fragment);
++	}
++	return 0;
++
++short_read:
++	if (actual>0)
++		total += actual;
++	retval = EXT2_ET_SHORT_READ;
++
++error_out:
++	memset((char *) buf+total, 0, size-actual);
++	if (channel->read_error)
++		retval = (channel->read_error)(channel, block, count, buf,
++					       size, actual, retval);
++	return retval;
++}
++#endif
++
++static errcode_t raw_write_blk(io_channel channel,
++			       struct unix_private_data *data,
++			       unsigned long block,
++			       int count, const void *buf)
++{
++	ssize_t		size;
++	ext2_loff_t	location;
++	int		actual = 0;
++	errcode_t	retval;
++
++	if (count == 1)
++		size = channel->block_size;
++	else {
++		if (count < 0)
++			size = -count;
++		else
++			size = count * channel->block_size;
++	}
++
++	location = ((ext2_loff_t) block * channel->block_size) + data->offset;
++	if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
++		retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
++		goto error_out;
++	}
++	
++	actual = write(data->dev, buf, size);
++	if (actual != size) {
++		retval = EXT2_ET_SHORT_WRITE;
++		goto error_out;
++	}
++	return 0;
++	
++error_out:
++	if (channel->write_error)
++		retval = (channel->write_error)(channel, block, count, buf,
++						size, actual, retval);
++	return retval;
++}
++
++
++/*
++ * Here we implement the cache functions
++ */
++
++/* Allocate the cache buffers */
++static errcode_t alloc_cache(io_channel channel,
++			     struct unix_private_data *data)
++{
++	errcode_t		retval;
++	struct unix_cache	*cache;
++	int			i;
++	
++	data->access_time = 0;
++	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
++		cache->block = 0;
++		cache->access_time = 0;
++		cache->dirty = 0;
++		cache->in_use = 0;
++		if ((retval = ext2fs_get_mem(channel->block_size,
++					     &cache->buf)))
++			return retval;
++	}
++	return 0;
++}
++
++/* Free the cache buffers */
++static void free_cache(struct unix_private_data *data)
++{
++	struct unix_cache	*cache;
++	int			i;
++	
++	data->access_time = 0;
++	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
++		cache->block = 0;
++		cache->access_time = 0;
++		cache->dirty = 0;
++		cache->in_use = 0;
++		if (cache->buf)
++			ext2fs_free_mem(&cache->buf);
++		cache->buf = 0;
++	}
++}
++
++#ifndef NO_IO_CACHE
++/*
++ * Try to find a block in the cache.  If the block is not found, and
++ * eldest is a non-zero pointer, then fill in eldest with the cache
++ * entry to that should be reused.
++ */
++static struct unix_cache *find_cached_block(struct unix_private_data *data,
++					    unsigned long block,
++					    struct unix_cache **eldest)
++{
++	struct unix_cache	*cache, *unused_cache, *oldest_cache;
++	int			i;
++	
++	unused_cache = oldest_cache = 0;
++	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
++		if (!cache->in_use) {
++			if (!unused_cache)
++				unused_cache = cache;
++			continue;
++		}
++		if (cache->block == block) {
++			cache->access_time = ++data->access_time;
++			return cache;
++		}
++		if (!oldest_cache ||
++		    (cache->access_time < oldest_cache->access_time))
++			oldest_cache = cache;
++	}
++	if (eldest)
++		*eldest = (unused_cache) ? unused_cache : oldest_cache;
++	return 0;
++}
++
++/*
++ * Reuse a particular cache entry for another block.
++ */
++static void reuse_cache(io_channel channel, struct unix_private_data *data,
++		 struct unix_cache *cache, unsigned long block)
++{
++	if (cache->dirty && cache->in_use)
++		raw_write_blk(channel, data, cache->block, 1, cache->buf);
++
++	cache->in_use = 1;
++	cache->dirty = 0;
++	cache->block = block;
++	cache->access_time = ++data->access_time;
++}
++
++/*
++ * Flush all of the blocks in the cache
++ */
++static errcode_t flush_cached_blocks(io_channel channel,
++				     struct unix_private_data *data,
++				     int invalidate)
++
++{
++	struct unix_cache	*cache;
++	errcode_t		retval, retval2;
++	int			i;
++	
++	retval2 = 0;
++	for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
++		if (!cache->in_use)
++			continue;
++		
++		if (invalidate)
++			cache->in_use = 0;
++		
++		if (!cache->dirty)
++			continue;
++		
++		retval = raw_write_blk(channel, data,
++				       cache->block, 1, cache->buf);
++		if (retval)
++			retval2 = retval;
++		else
++			cache->dirty = 0;
++	}
++	return retval2;
++}
++#endif /* NO_IO_CACHE */
++
++static errcode_t unix_open(const char *name, int flags, io_channel *channel)
++{
++	io_channel	io = NULL;
++	struct unix_private_data *data = NULL;
++	errcode_t	retval;
++	int		open_flags;
++	struct stat	st;
++#ifdef __linux__
++	struct 		utsname ut;
++#endif
++
++	if (name == 0)
++		return EXT2_ET_BAD_DEVICE_NAME;
++	retval = ext2fs_get_mem(sizeof(struct struct_io_channel), &io);
++	if (retval)
++		return retval;
++	memset(io, 0, sizeof(struct struct_io_channel));
++	io->magic = EXT2_ET_MAGIC_IO_CHANNEL;
++	retval = ext2fs_get_mem(sizeof(struct unix_private_data), &data);
++	if (retval)
++		goto cleanup;
++
++	io->manager = unix_io_manager;
++	retval = ext2fs_get_mem(strlen(name)+1, &io->name);
++	if (retval)
++		goto cleanup;
++
++	strcpy(io->name, name);
++	io->private_data = data;
++	io->block_size = 1024;
++	io->read_error = 0;
++	io->write_error = 0;
++	io->refcount = 1;
++
++	memset(data, 0, sizeof(struct unix_private_data));
++	data->magic = EXT2_ET_MAGIC_UNIX_IO_CHANNEL;
++
++	if ((retval = alloc_cache(io, data)))
++		goto cleanup;
++
++	open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
++#ifdef HAVE_OPEN64
++	data->dev = open64(io->name, open_flags);
++#else
++	data->dev = open(io->name, open_flags);
++#endif
++	if (data->dev < 0) {
++		retval = errno;
++		goto cleanup;
++	}
++
++#ifdef __linux__
++#undef RLIM_INFINITY
++#if (defined(__alpha__) || ((defined(__sparc__) || defined(__mips__)) && (SIZEOF_LONG == 4)))
++#define RLIM_INFINITY	((unsigned long)(~0UL>>1))
++#else
++#define RLIM_INFINITY  (~0UL)
++#endif
++	/*
++	 * Work around a bug in 2.4.10-2.4.18 kernels where writes to
++	 * block devices are wrongly getting hit by the filesize
++	 * limit.  This workaround isn't perfect, since it won't work
++	 * if glibc wasn't built against 2.2 header files.  (Sigh.)
++	 * 
++	 */
++	if ((flags & IO_FLAG_RW) &&
++	    (uname(&ut) == 0) &&
++	    ((ut.release[0] == '2') && (ut.release[1] == '.') &&
++	     (ut.release[2] == '4') && (ut.release[3] == '.') &&
++	     (ut.release[4] == '1') && (ut.release[5] >= '0') &&
++	     (ut.release[5] < '8')) &&
++	    (fstat(data->dev, &st) == 0) &&
++	    (S_ISBLK(st.st_mode))) {
++		struct rlimit	rlim;
++		
++		rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY;
++		setrlimit(RLIMIT_FSIZE, &rlim);
++		getrlimit(RLIMIT_FSIZE, &rlim);
++		if (((unsigned long) rlim.rlim_cur) <
++		    ((unsigned long) rlim.rlim_max)) {
++			rlim.rlim_cur = rlim.rlim_max;
++			setrlimit(RLIMIT_FSIZE, &rlim);
++		}
++	}
++#endif
++	*channel = io;
++	return 0;
++
++cleanup:
++	if (data) {
++		free_cache(data);
++		ext2fs_free_mem(&data);
++	}
++	if (io)
++		ext2fs_free_mem(&io);
++	return retval;
++}
++
++static errcode_t unix_close(io_channel channel)
++{
++	struct unix_private_data *data;
++	errcode_t	retval = 0;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++	if (--channel->refcount > 0)
++		return 0;
++
++#ifndef NO_IO_CACHE
++	retval = flush_cached_blocks(channel, data, 0);
++#endif
++
++	if (close(data->dev) < 0)
++		retval = errno;
++	free_cache(data);
++
++	ext2fs_free_mem(&channel->private_data);
++	if (channel->name)
++		ext2fs_free_mem(&channel->name);
++	ext2fs_free_mem(&channel);
++	return retval;
++}
++
++static errcode_t unix_set_blksize(io_channel channel, int blksize)
++{
++	struct unix_private_data *data;
++	errcode_t		retval;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++	if (channel->block_size != blksize) {
++#ifndef NO_IO_CACHE
++		if ((retval = flush_cached_blocks(channel, data, 0)))
++			return retval;
++#endif
++		
++		channel->block_size = blksize;
++		free_cache(data);
++		if ((retval = alloc_cache(channel, data)))
++			return retval;
++	}
++	return 0;
++}
++
++
++static errcode_t unix_read_blk(io_channel channel, unsigned long block,
++			       int count, void *buf)
++{
++	struct unix_private_data *data;
++	struct unix_cache *cache, *reuse[READ_DIRECT_SIZE];
++	errcode_t	retval;
++	char		*cp;
++	int		i, j;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++#ifdef NO_IO_CACHE
++	return raw_read_blk(channel, data, block, count, buf);
++#else
++	/*
++	 * If we're doing an odd-sized read or a very large read,
++	 * flush out the cache and then do a direct read.
++	 */
++	if (count < 0 || count > WRITE_DIRECT_SIZE) {
++		if ((retval = flush_cached_blocks(channel, data, 0)))
++			return retval;
++		return raw_read_blk(channel, data, block, count, buf);
++	}
++
++	cp = buf;
++	while (count > 0) {
++		/* If it's in the cache, use it! */
++		if ((cache = find_cached_block(data, block, &reuse[0]))) {
++#ifdef DEBUG
++			printf("Using cached block %d\n", block);
++#endif
++			memcpy(cp, cache->buf, channel->block_size);
++			count--;
++			block++;
++			cp += channel->block_size;
++			continue;
++		}
++		/*
++		 * Find the number of uncached blocks so we can do a
++		 * single read request
++		 */
++		for (i=1; i < count; i++)
++			if (find_cached_block(data, block+i, &reuse[i]))
++				break;
++#ifdef DEBUG
++		printf("Reading %d blocks starting at %d\n", i, block);
++#endif
++		if ((retval = raw_read_blk(channel, data, block, i, cp)))
++			return retval;
++		
++		/* Save the results in the cache */
++		for (j=0; j < i; j++) {
++			count--;
++			cache = reuse[j];
++			reuse_cache(channel, data, cache, block++);
++			memcpy(cache->buf, cp, channel->block_size);
++			cp += channel->block_size;
++		}
++	}
++	return 0;
++#endif /* NO_IO_CACHE */
++}
++
++static errcode_t unix_write_blk(io_channel channel, unsigned long block,
++				int count, const void *buf)
++{
++	struct unix_private_data *data;
++	struct unix_cache *cache, *reuse;
++	errcode_t	retval = 0;
++	const char	*cp;
++	int		writethrough;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++#ifdef NO_IO_CACHE
++	return raw_write_blk(channel, data, block, count, buf);
++#else	
++	/*
++	 * If we're doing an odd-sized write or a very large write,
++	 * flush out the cache completely and then do a direct write.
++	 */
++	if (count < 0 || count > WRITE_DIRECT_SIZE) {
++		if ((retval = flush_cached_blocks(channel, data, 1)))
++			return retval;
++		return raw_write_blk(channel, data, block, count, buf);
++	}
++
++	/*
++	 * For a moderate-sized multi-block write, first force a write
++	 * if we're in write-through cache mode, and then fill the
++	 * cache with the blocks.
++	 */
++	writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH;
++	if (writethrough)
++		retval = raw_write_blk(channel, data, block, count, buf);
++	
++	cp = buf;
++	while (count > 0) {
++		cache = find_cached_block(data, block, &reuse);
++		if (!cache) {
++			cache = reuse;
++			reuse_cache(channel, data, cache, block);
++		}
++		memcpy(cache->buf, cp, channel->block_size);
++		cache->dirty = !writethrough;
++		count--;
++		block++;
++		cp += channel->block_size;
++	}
++	return retval;
++#endif /* NO_IO_CACHE */
++}
++
++static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
++				 int size, const void *buf)
++{
++	struct unix_private_data *data;
++	errcode_t	retval = 0;
++	ssize_t		actual;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++#ifndef NO_IO_CACHE
++	/*
++	 * Flush out the cache completely
++	 */
++	if ((retval = flush_cached_blocks(channel, data, 1)))
++		return retval;
++#endif
++
++	if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0)
++		return errno;
++	
++	actual = write(data->dev, buf, size);
++	if (actual != size)
++		return EXT2_ET_SHORT_WRITE;
++
++	return 0;
++}
++
++/*
++ * Flush data buffers to disk.  
++ */
++static errcode_t unix_flush(io_channel channel)
++{
++	struct unix_private_data *data;
++	errcode_t retval = 0;
++	
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++#ifndef NO_IO_CACHE
++	retval = flush_cached_blocks(channel, data, 0);
++#endif
++	fsync(data->dev);
++	return retval;
++}
++
++static errcode_t unix_set_option(io_channel channel, const char *option, 
++				 const char *arg)
++{
++	struct unix_private_data *data;
++	unsigned long tmp;
++	char *end;
++
++	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
++	data = (struct unix_private_data *) channel->private_data;
++	EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL);
++
++	if (!strcmp(option, "offset")) {
++		if (!arg)
++			return EXT2_ET_INVALID_ARGUMENT;
++
++		tmp = strtoul(arg, &end, 0);
++		if (*end)
++			return EXT2_ET_INVALID_ARGUMENT;
++		data->offset = tmp;
++		return 0;
++	}
++	return EXT2_ET_INVALID_ARGUMENT;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/unlink.c silo-1.4.11/libext2fs/unlink.c
+--- silo-1.4.11.orig/libext2fs/unlink.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/unlink.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,99 @@
++/*
++ * unlink.c --- delete links in a ext2fs directory
++ * 
++ * Copyright (C) 1993, 1994, 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++#include <string.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++struct link_struct  {
++	const char	*name;
++	int		namelen;
++	ext2_ino_t	inode;
++	int		flags;
++	struct ext2_dir_entry *prev;
++	int		done;
++};	
++
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++static int unlink_proc(struct ext2_dir_entry *dirent,
++		     int	offset EXT2FS_ATTR((unused)),
++		     int	blocksize EXT2FS_ATTR((unused)),
++		     char	*buf EXT2FS_ATTR((unused)),
++		     void	*priv_data)
++{
++	struct link_struct *ls = (struct link_struct *) priv_data;
++	struct ext2_dir_entry *prev;
++
++	prev = ls->prev;
++	ls->prev = dirent;
++
++	if (ls->name) {
++		if ((dirent->name_len & 0xFF) != ls->namelen)
++			return 0;
++		if (strncmp(ls->name, dirent->name, dirent->name_len & 0xFF))
++			return 0;
++	}
++	if (ls->inode) {
++		if (dirent->inode != ls->inode)
++			return 0;
++	} else {
++		if (!dirent->inode)
++			return 0;
++	}
++
++	if (prev) 
++		prev->rec_len += dirent->rec_len;
++	else
++		dirent->inode = 0;
++	ls->done++;
++	return DIRENT_ABORT|DIRENT_CHANGED;
++}
++
++#ifdef __TURBOC__
++ #pragma argsused
++#endif
++errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir,
++			const char *name, ext2_ino_t ino,
++			int flags EXT2FS_ATTR((unused)))
++{
++	errcode_t	retval;
++	struct link_struct ls;
++
++	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
++
++	if (!name && !ino)
++		return EXT2_ET_INVALID_ARGUMENT;
++
++	if (!(fs->flags & EXT2_FLAG_RW))
++		return EXT2_ET_RO_FILSYS;
++
++	ls.name = name;
++	ls.namelen = name ? strlen(name) : 0;
++	ls.inode = ino;
++	ls.flags = 0;
++	ls.done = 0;
++	ls.prev = 0;
++
++	retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, 
++				    0, unlink_proc, &ls);
++	if (retval)
++		return retval;
++
++	return (ls.done) ? 0 : EXT2_ET_DIR_NO_SPACE;
++}
++
+diff -Naur silo-1.4.11.orig/libext2fs/valid_blk.c silo-1.4.11/libext2fs/valid_blk.c
+--- silo-1.4.11.orig/libext2fs/valid_blk.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/valid_blk.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,56 @@
++/*
++ * valid_blk.c --- does the inode have valid blocks?
++ *
++ * Copyright 1997 by Theodore Ts'o
++ * 
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ * 
++ */
++
++#include <stdio.h>
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <time.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++/*
++ * This function returns 1 if the inode's block entries actually
++ * contain block entries.
++ */
++int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode)
++{
++	/*
++	 * Only directories, regular files, and some symbolic links
++	 * have valid block entries.
++	 */
++	if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) &&
++	    !LINUX_S_ISLNK(inode->i_mode))
++		return 0;
++	
++	/*
++	 * If the symbolic link is a "fast symlink", then the symlink
++	 * target is stored in the block entries.
++	 */
++	if (LINUX_S_ISLNK (inode->i_mode)) {
++		if (inode->i_file_acl == 0) {
++			/* With no EA block, we can rely on i_blocks */
++			if (inode->i_blocks == 0)
++				return 0;
++		} else {
++			/* With an EA block, life gets more tricky */
++			if (inode->i_size >= EXT2_N_BLOCKS*4)
++				return 1; /* definitely using i_block[] */
++			if (inode->i_size > 4 && inode->i_block[1] == 0)
++				return 1; /* definitely using i_block[] */
++			return 0; /* Probably a fast symlink */
++		}
++	}
++	return 1;
++}
+diff -Naur silo-1.4.11.orig/libext2fs/version.c silo-1.4.11/libext2fs/version.c
+--- silo-1.4.11.orig/libext2fs/version.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/version.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,52 @@
++/*
++ * version.c --- Return the version of the ext2 library
++ *
++ * Copyright (C) 1997 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#if HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++#include <string.h>
++#include <stdio.h>
++#include <ctype.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++#include "version.h"
++
++static const char *lib_version = E2FSPROGS_VERSION;
++static const char *lib_date = E2FSPROGS_DATE;
++
++int ext2fs_parse_version_string(const char *ver_string)
++{
++	const char *cp;
++	int version = 0;
++
++	for (cp = ver_string; *cp; cp++) {
++		if (*cp == '.')
++			continue;
++		if (!isdigit(*cp))
++			break;
++		version = (version * 10) + (*cp - '0');
++	}
++	return version;
++}
++
++
++int ext2fs_get_library_version(const char **ver_string,
++			       const char **date_string)
++{
++	if (ver_string)
++		*ver_string = lib_version;
++	if (date_string)
++		*date_string = lib_date;
++
++	return ext2fs_parse_version_string(lib_version);
++}
+diff -Naur silo-1.4.11.orig/libext2fs/version.h silo-1.4.11/libext2fs/version.h
+--- silo-1.4.11.orig/libext2fs/version.h	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/version.h	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,11 @@
++/*
++ * version.h --- controls the version number printed by the e2fs
++ * programs.
++ * 
++ * Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
++ * 2004, 2005 by Theodore Ts'o.  This file may be redistributed under
++ * the GNU Public License.
++ */
++
++#define E2FSPROGS_VERSION "1.38"
++#define E2FSPROGS_DATE "30-Jun-2005"
+diff -Naur silo-1.4.11.orig/libext2fs/write_bb_file.c silo-1.4.11/libext2fs/write_bb_file.c
+--- silo-1.4.11.orig/libext2fs/write_bb_file.c	1970-01-01 00:00:00 +0000
++++ silo-1.4.11/libext2fs/write_bb_file.c	2006-03-09 21:34:57 +0000
+@@ -0,0 +1,34 @@
++/*
++ * write_bb_file.c --- write a list of bad blocks to a FILE *
++ *
++ * Copyright (C) 1994, 1995 Theodore Ts'o.
++ *
++ * %Begin-Header%
++ * This file may be redistributed under the terms of the GNU Public
++ * License.
++ * %End-Header%
++ */
++
++#include <stdio.h>
++
++#include "ext2_fs.h"
++#include "ext2fs.h"
++
++errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
++			       unsigned int flags EXT2FS_ATTR((unused)),
++			       FILE *f)
++{
++	badblocks_iterate	bb_iter;
++	blk_t			blk;
++	errcode_t		retval;
++
++	retval = ext2fs_badblocks_list_iterate_begin(bb_list, &bb_iter);
++	if (retval)
++		return retval;
++
++	while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
++		fprintf(f, "%d\n", blk);
++	}
++	ext2fs_badblocks_list_iterate_end(bb_iter);
++	return 0;
++}
+diff -Naur silo-1.4.11.orig/second/Makefile silo-1.4.11/second/Makefile
+--- silo-1.4.11.orig/second/Makefile	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/second/Makefile	2006-03-09 21:34:57 +0000
+@@ -27,10 +27,10 @@
+ LDFLAGS_LARGE=-N -Ttext $(LARGE_RELOC)
+ 
+ .c.o:
+-	$(CC) $(CFLAGS) -c $*.c -o $@
++	$(CC-SILO) $(CFLAGS) -c $*.c -o $@
+ 
+ .S.o:
+-	$(CC) $(CFLAGS) -c $*.S -o $@
++	$(CC-SILO) $(CFLAGS) -c $*.S -o $@
+ 
+ # The ordering here is very significant. Please add new object files to OBJS5 only.
+ OBJS1 = crt0.o
+@@ -43,8 +43,8 @@
+ OBJS4 = main.o
+ OBJS4N = mainnet.o
+ OBJS5 = cmdline.o disk.o file.o misc.o cfg.o strtol.o ranges.o timer.o \
+-	memory.o fs/libfs.a mul.o ../common/rem.o ../common/sdiv.o umul.o \
+-	../common/stringops2.o ls.o muldi3.o
++	memory.o fs/libfs.a ../common/rem.o ../common/sdiv.o umul.o \
++	../common/stringops2.o ls.o muldi3.o ../libext2fs/libext2fs.a
+ OBJS = $(OBJS1) $(OBJS2) $(OBJS3) bmark.o $(OBJS4) $(OBJS5)
+ OBJSNET = $(OBJS1) $(OBJS2N) $(OBJS3) bmark.o $(OBJS4N) $(OBJS5)
+ 
+@@ -53,18 +53,21 @@
+ # Should really switch to autoconf...
+ all: second.b silotftp.b
+ 
++../libext2fs/libext2fs.a:
++	@make -C ../libext2fs
++
+ fs/libfs.a: $(FS_OBJS)
+ 	$(RM) $@
+ 	$(AR) rc $@ $(FS_OBJS)
+ 
+ second: $(OBJS) mark.o
+-	$(LD) $(LDFLAGS_SMALL) -Bstatic -o second $(OBJS) -lext2fs mark.o
+-	$(LD) $(LDFLAGS_LARGE) -Bstatic -o second2 $(OBJS) -lext2fs mark.o
++	$(LD) $(LDFLAGS_SMALL) -Bstatic -o second $(OBJS) mark.o
++	$(LD) $(LDFLAGS_LARGE) -Bstatic -o second2 $(OBJS) mark.o
+ 	$(NM) second | grep -v '*ABS*' | sort > second.map
+ 
+ silotftp: $(OBJSNET) mark.o
+-	$(LD) $(LDFLAGS_SMALL) -Bstatic -o silotftp $(OBJSNET) -lext2fs mark.o
+-	$(LD) $(LDFLAGS_LARGE) -Bstatic -o silotftp2 $(OBJSNET) -lext2fs mark.o
++	$(LD) $(LDFLAGS_SMALL) -Bstatic -o silotftp $(OBJSNET) mark.o
++	$(LD) $(LDFLAGS_LARGE) -Bstatic -o silotftp2 $(OBJSNET) mark.o
+ 	$(NM) silotftp | grep -v '*ABS*' | sort > silotftp.map
+ 
+ second.l: second
+@@ -73,31 +76,31 @@
+ file.o:	       file.c
+ 
+ decompnet.o:   decomp.c
+-	$(CC) $(CFLAGS) -DTFTP -DVERSION='"$(VERSION)"' -c -o $@ $<
++	$(CC-SILO) $(CFLAGS) -DTFTP -DVERSION='"$(VERSION)"' -c -o $@ $<
+ 
+ decomp.o: decomp.c
+-	$(CC) $(CFLAGS) -DVERSION='"$(VERSION)"' -c $<
++	$(CC-SILO) $(CFLAGS) -DVERSION='"$(VERSION)"' -c $<
+ 
+ mainnet.o:   main.c
+-	$(CC) $(CFLAGS) -DTFTP -c -o $@ $<
++	$(CC-SILO) $(CFLAGS) -DTFTP -c -o $@ $<
+ 
+ malloc.o: ../common/malloc.c
+-	$(CC) $(CFLAGS) -c -o $@ $<
++	$(CC-SILO) $(CFLAGS) -c -o $@ $<
+ 
+ util:	util.c
+-	$(CC) -DSMALL_RELOC=$(SMALL_RELOC) -DLARGE_RELOC=$(LARGE_RELOC) -o $@ $<
++	$(BUILD_CC) -DSMALL_RELOC=$(SMALL_RELOC) -DLARGE_RELOC=$(LARGE_RELOC) -o $@ $<
+ 
+ clean:
+ 	$(RM) *.o fs/*.o second* silotftp* util fs/libfs.a
+ 
+ crt0.o:	crt0.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9 -DIMGVERSION='"SILO$(IMGVERSION)"' crt0.S
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9 -DIMGVERSION='"SILO$(IMGVERSION)"' crt0.S
+ 
+ memory.o: memory.c
+-	$(CC) $(CFLAGS) -c -Wa,-Av9 memory.c
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9 memory.c
+ 
+ timer.o: timer.c
+-	$(CC) $(CFLAGS) -c -Wa,-Av9a timer.c
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9a timer.c
+ 
+ second.b: second util
+ 	$(ELFTOAOUT) -o second.aout second
+diff -Naur silo-1.4.11.orig/second/ls.c silo-1.4.11/second/ls.c
+--- silo-1.4.11.orig/second/ls.c	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/second/ls.c	2006-03-09 21:34:57 +0000
+@@ -19,10 +19,10 @@
+    USA.  */
+ 
+ #include <silo.h>
++#include <linux/types.h>
+ #include <stringops.h>
+ 
+ typedef int FILE;
+-#include <linux/types.h>
+ #include <ext2fs/ext2_fs.h>
+ #include <ext2fs/ext2fs.h>
+ 
+diff -Naur silo-1.4.11.orig/silo/silo.c silo-1.4.11/silo/silo.c
+--- silo-1.4.11.orig/silo/silo.c	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/silo/silo.c	2006-03-09 21:34:57 +0000
+@@ -128,8 +128,8 @@
+     unsigned short nsect;	/* Sectors per track */
+     unsigned char spare3[4];	/* Even more magic... */
+     struct sun_partition {
+-	unsigned long start_cylinder;
+-	unsigned long num_sectors;
++	unsigned int start_cylinder;
++	unsigned int num_sectors;
+     } partitions[8];
+     unsigned short magic;	/* Magic number */
+     unsigned short csum;	/* Label xor'd checksum */
+diff -Naur silo-1.4.11.orig/silo/silocheck.c silo-1.4.11/silo/silocheck.c
+--- silo-1.4.11.orig/silo/silocheck.c	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/silo/silocheck.c	2006-03-09 21:34:57 +0000
+@@ -100,8 +100,8 @@
+     unsigned short nsect;	/* Sectors per track */
+     unsigned char spare3[4];	/* Even more magic... */
+     struct sun_partition {
+-	unsigned long start_cylinder;
+-	unsigned long num_sectors;
++	unsigned int start_cylinder;
++	unsigned int num_sectors;
+     } partitions[8];
+     unsigned short magic;	/* Magic number */
+     unsigned short csum;	/* Label xor'd checksum */
+diff -Naur silo-1.4.11.orig/tilo/Makefile silo-1.4.11/tilo/Makefile
+--- silo-1.4.11.orig/tilo/Makefile	2006-03-09 21:34:08 +0000
++++ silo-1.4.11/tilo/Makefile	2006-03-09 21:34:57 +0000
+@@ -14,10 +14,10 @@
+ all: maketilo
+ 
+ .c.o:
+-	$(CC) $(CFLAGS) -c $*.c
++	$(CC-SILO) $(CFLAGS) -c $*.c
+ 
+ .S.o:
+-	$(CC) $(CFLAGS) -c $*.S
++	$(CC-SILO) $(CFLAGS) -c $*.S
+ 
+ OBJS_COMMON = ../common/printf.o ../common/jmp.o ../common/prom.o \
+ 	../common/tree.o ../common/console.o ../common/stringops1.o \
+@@ -45,19 +45,19 @@
+ 
+ 
+ mallocl.o: ../common/malloc.c
+-	$(CC) $(CFLAGS) -DMALLOC_BASE=0x4D0000 -c -o $@ $<
++	$(CC-SILO) $(CFLAGS) -DMALLOC_BASE=0x4D0000 -c -o $@ $<
+ 
+ malloc.o: ../common/malloc.c
+-	$(CC) $(CFLAGS) -DMALLOC_BASE=0x3D0000 -c -o $@ $<
++	$(CC-SILO) $(CFLAGS) -DMALLOC_BASE=0x3D0000 -c -o $@ $<
+ 
+ tilol.o: tilo.c
+-	$(CC) $(CFLAGS) -DLARGETILO -c -o $@ $<
++	$(CC-SILO) $(CFLAGS) -DLARGETILO -c -o $@ $<
+ 
+ crt0.o:	crt0.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9 -o $@ $<
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9 -o $@ $<
+ 
+ crt0l.o: crt0.S
+-	$(CC) $(CFLAGS) -c -Wa,-Av9 -DLARGETILO -o $@ $<
++	$(CC-SILO) $(CFLAGS) -c -Wa,-Av9 -DLARGETILO -o $@ $<
+ 
+ clean:
+ 	$(RM) *.o boot boot2 *.out b.h b2.h maketilo
Index: patches/sysklogd-1.4.1-fixes-1.patch
===================================================================
--- patches/sysklogd-1.4.1-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/sysklogd-1.4.1-fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,833 @@
+Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
+Date: 2005-01-23
+Initial Package Version: 1.4.1
+Upstream Status: Not submitted
+Origin: http://www.infodrom.org/projects/sysklogd/cvs.php3
+Description: This patch is a cvs snapshot update as of 20050123.
+Minus the debain and CVS directories. See the CHANGES.
+
+diff -Naur sysklogd-1.4.1/CHANGES sysklogd-20050123/CHANGES
+--- sysklogd-1.4.1/CHANGES	2001-03-11 14:35:51.000000000 -0500
++++ sysklogd-20050123/CHANGES	2005-01-15 14:14:21.000000000 -0500
+@@ -1,3 +1,42 @@
++Version 1.4.2
++
++ . Dmitry V. Levin <ldv@altlinux.org>
++   - Close file descriptor in FindSymbolFile() in ksym.c in order not to
++     leak file descriptors.
++ . Solar Designer <solar@openwall.com>
++   - improve crunch_list()
++   - Prevent potential buffer overflow in reading messages from the
++     kernel log ringbuffer.
++   - Ensure that "len" is not placed in a register, and that the
++     endtty() signal handler is not installed too early which could
++     cause a segmentation fault or worse.
++ . Steve Grubb <linux_4ever@yahoo.com>
++   - fix memory calculation in crunch_list()
++ . Martin Schulze <joey@infodrom.org>
++   - klogd will reconnect to the logger (mostly syslogd) after it went
++     away
++   - On heavily loaded system syslog will not spit out error messages
++     anymore when recvfrom() results in EAGAIN
++   - Makefile improvements
++   - Local copy of module.h
++   - Improved sysklogd.8
++   - Always log with syslogd's timezone and locale
++   - Remove trailing newline when forwarding messages
++ . Jon Burgess <Jon_Burgess@eur.3com.com>
++   - Moved the installation of the signal handler up a little bit so it
++     guaranteed to be available when the child is forked, hence, fixing a
++     race condition.  This used to create problems with UML and fast
++     machines.
++ . Greg Trounson <gregt@maths.otago.ac.nz>
++   - Improved README.linux
++ . Ulf Härnhammar <Ulf.Harnhammar.9485@student.uu.se>
++   - Bondary check for fscanf() in InitKsyms() and CheckMapVersion()
++ . Colin Phipps <cph@cph.demon.co.uk>
++   - Don't block on the network socket in case of package los
++ . Dirk Mueller <mueller@kde.org>
++   - Don't crash when filesize limit is reached (e.g. without LFS)
++
++
+ Version 1.4.1
+ 
+  . klogd will set the console log level only if `-c' is given on the
+@@ -30,3 +69,9 @@
+  . Olaf Kirch <okir@caldera.de>
+    - Remove Unix Domain Sockets and switch to Datagram Unix Sockets
+  . Several bugfixes and improvements, please refer to the .c files
++
++
++Local variables:
++mode: indented-text
++fill-column: 72
++End:
+diff -Naur sysklogd-1.4.1/klogd.8 sysklogd-20050123/klogd.8
+--- sysklogd-1.4.1/klogd.8	2001-03-11 14:35:51.000000000 -0500
++++ sysklogd-20050123/klogd.8	2001-03-11 18:00:51.000000000 -0500
+@@ -321,7 +321,7 @@
+ .B klogd
+ to reload the module symbol information whenever a protection fault
+ is detected.  Caution should be used before invoking the program in
+-\'paranoid\' mode.  The stability of the kernel and the operating
++\&'paranoid\&' mode.  The stability of the kernel and the operating
+ environment is always under question when a protection fault occurs.
+ Since the klogd daemon must execute system calls in order to read the
+ module symbol information there is the possibility that the system may
+diff -Naur sysklogd-1.4.1/klogd.c sysklogd-20050123/klogd.c
+--- sysklogd-1.4.1/klogd.c	2001-03-11 14:40:10.000000000 -0500
++++ sysklogd-20050123/klogd.c	2004-04-29 09:29:03.000000000 -0400
+@@ -243,6 +243,9 @@
+  *	people have submitted patches: Troels Walsted Hansen
+  *	<troels@thule.no>, Wolfgang Oertl <Wolfgang.Oertl@uibk.ac.at>
+  *	and Thomas Roessler.
++ * Thu Apr 29 15:24:07 2004: Solar Designer <solar@openwall.com>
++ *	Prevent potential buffer overflow in reading messages from the
++ *	kernel log rinbuffer.
+  */
+ 
+ 
+@@ -938,7 +941,7 @@
+ 	 * messages into this fresh buffer.
+ 	 */
+ 	memset(log_buffer, '\0', sizeof(log_buffer));
+-	if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer))) < 0 )
++	if ( (rdcnt = ksyslog(2, log_buffer, sizeof(log_buffer)-1)) < 0 )
+ 	{
+ 		if ( errno == EINTR )
+ 			return;
+diff -Naur sysklogd-1.4.1/ksym.c sysklogd-20050123/ksym.c
+--- sysklogd-1.4.1/ksym.c	2000-09-12 17:53:31.000000000 -0400
++++ sysklogd-20050123/ksym.c	2004-07-16 02:48:27.000000000 -0400
+@@ -105,6 +105,15 @@
+  *
+  * Tue Sep 12 23:48:12 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
+  *	Close symbol file in InitKsyms() when an error occurred.
++ *
++ * Thu Apr 29 18:07:16 CEST 2004: Dmitry Levin <ldv@altlinux.org>
++ *	Close file descriptor in FindSymbolFile() in order not to leak
++ *	file descriptors.
++ *
++ * Fri Jul 16 08:32:49 CEST 2004: Ulf Härnhammar <Ulf.Harnhammar.9485@student.uu.se>
++ *	Added boundary check for fscanf() in InitKsyms() and
++ *	CheckMapVersion() to prevent an unintended crash when reading
++ *	an incorrect System.map.
+  */
+ 
+ 
+@@ -236,7 +245,7 @@
+ 	 */
+ 	while ( !feof(sym_file) )
+ 	{
+-		if ( fscanf(sym_file, "%lx %c %s\n", &address, &type, sym)
++		if ( fscanf(sym_file, "%lx %c %511s\n", &address, &type, sym)
+ 		    != 3 )
+ 		{
+ 			Syslog(LOG_ERR, "Error in symbol table input (#1).");
+@@ -344,6 +353,7 @@
+ 		if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) {
+ 			if (CheckMapVersion(symfile) == 1)
+ 				file = symfile;
++			fclose (sym_file);
+ 		}
+ 		if (sym_file == (FILE *) 0 || file == (char *) 0) {
+ 			sprintf (symfile, "%s", *mf);
+@@ -352,6 +362,7 @@
+ 			if ( (sym_file = fopen(symfile, "r")) != (FILE *) 0 ) {
+ 				if (CheckMapVersion(symfile) == 1)
+ 					file = symfile;
++				fclose (sym_file);
+ 			}
+ 		}
+ 
+@@ -533,7 +544,7 @@
+ 		version = 0;
+ 		while ( !feof(sym_file) && (version == 0) )
+ 		{
+-			if ( fscanf(sym_file, "%lx %c %s\n", &address, \
++			if ( fscanf(sym_file, "%lx %c %511s\n", &address, \
+ 				    &type, sym) != 3 )
+ 			{
+ 				Syslog(LOG_ERR, "Error in symbol table input (#2).");
+@@ -899,3 +910,11 @@
+ 	return;
+ }
+ #endif
++
++/*
++ * Local variables:
++ *  c-indent-level: 8
++ *  c-basic-offset: 8
++ *  tab-width: 8
++ * End:
++ */
+diff -Naur sysklogd-1.4.1/ksym_mod.c sysklogd-20050123/ksym_mod.c
+--- sysklogd-1.4.1/ksym_mod.c	2000-09-12 17:15:28.000000000 -0400
++++ sysklogd-20050123/ksym_mod.c	2004-03-31 10:47:08.000000000 -0500
+@@ -78,6 +78,11 @@
+  *
+  * Tue Sep 12 23:11:13 CEST 2000: Martin Schulze <joey@infodrom.ffis.de>
+  *	Changed llseek() to lseek64() in order to skip a libc warning.
++ *
++ * Wed Mar 31 17:35:01 CEST 2004: Martin Schulze <joey@infodrom.org>
++ *	Removed references to <linux/module.h> since it doesn't work
++ *	anymore with its recent content from Linux 2.4/2.6, created
++ *	module.h locally instead.
+  */
+ 
+ 
+@@ -89,11 +94,12 @@
+ #include <errno.h>
+ #include <sys/fcntl.h>
+ #include <sys/stat.h>
++#include "module.h"
+ #if !defined(__GLIBC__)
+ #include <linux/time.h>
+-#include <linux/module.h>
++#include <linux/linkage.h>
+ #else /* __GLIBC__ */
+-#include <linux/module.h>
++#include <linux/linkage.h>
+ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
+ extern int get_kernel_syms __P ((struct kernel_sym *__table));
+ #endif /* __GLIBC__ */
+@@ -107,7 +113,7 @@
+ 
+ #if !defined(__GLIBC__)
+ /*
+- * The following bit uses some kernel/library magic to product what
++ * The following bit uses some kernel/library magic to produce what
+  * looks like a function call to user level code.  This function is
+  * actually a system call in disguise.  The purpose of the getsyms
+  * call is to return a current copy of the in-kernel symbol table.
+diff -Naur sysklogd-1.4.1/Makefile sysklogd-20050123/Makefile
+--- sysklogd-1.4.1/Makefile	1998-10-12 16:25:15.000000000 -0400
++++ sysklogd-20050123/Makefile	2004-04-29 07:04:03.000000000 -0400
+@@ -4,12 +4,15 @@
+ #CFLAGS= -g -DSYSV -Wall
+ #LDFLAGS= -g
+ CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce
++# -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+ LDFLAGS= -s
+ 
+ # Look where your install program is.
+ INSTALL = /usr/bin/install
+-BINDIR = /usr/sbin
+-MANDIR = /usr/man
++
++# Destination paths, set prefix=/opt if required
++BINDIR = $(prefix)/usr/sbin
++MANDIR = $(prefix)/usr/share/man
+ 
+ # There is one report that under an all ELF system there may be a need to
+ # explicilty link with libresolv.a.  If linking syslogd fails you may wish
+@@ -34,8 +37,9 @@
+ # The following define establishes ownership for the man pages.
+ # Avery tells me that there is a difference between Debian and
+ # Slackware.  Rather than choose sides I am leaving it up to the user.
+-MAN_OWNER = root
+-# MAN_OWNER = man
++MAN_USER = root
++MAN_GROUP = root
++MAN_PERMS = 644
+ 
+ # The following define establishes the name of the pid file for the
+ # syslogd daemon.  The library include file (paths.h) defines the
+@@ -116,7 +120,7 @@
+ 	${INSTALL} -m 500 -s klogd ${BINDIR}/klogd
+ 
+ install_man:
+-	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 sysklogd.8 ${MANDIR}/man8/sysklogd.8
+-	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslogd.8 ${MANDIR}/man8/syslogd.8
+-	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
+-	${INSTALL} -o ${MAN_OWNER} -g ${MAN_OWNER} -m 644 klogd.8 ${MANDIR}/man8/klogd.8
++	${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} sysklogd.8 ${MANDIR}/man8/sysklogd.8
++	${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} syslogd.8 ${MANDIR}/man8/syslogd.8
++	${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} syslog.conf.5 ${MANDIR}/man5/syslog.conf.5
++	${INSTALL} -o ${MAN_USER} -g ${MAN_GROUP} -m ${MAN_PERMS} klogd.8 ${MANDIR}/man8/klogd.8
+diff -Naur sysklogd-1.4.1/module.h sysklogd-20050123/module.h
+--- sysklogd-1.4.1/module.h	1969-12-31 19:00:00.000000000 -0500
++++ sysklogd-20050123/module.h	2004-07-27 07:36:10.000000000 -0400
+@@ -0,0 +1,90 @@
++/*
++    module.h - Miscellaneous module definitions
++    Copyright (c) 1996 Richard Henderson <rth@tamu.edu>
++    Copyright (c) 2004 Martin Schulze <joey@infodrom.org>
++
++    This file is part of the sysklogd package.
++
++    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 Free Software Foundation; either version 2 of the License, or
++    (at your option) any later version.
++
++    This program is distributed in the hope that it will be useful,
++    but WITHOUT ANY WARRANTY; without even the implied warranty of
++    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++    GNU General Public License for more details.
++
++    You should have received a copy of the GNU General Public License
++    along with this program; if not, write to the Free Software
++    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++*/
++
++/* ChangeLog:
++ *
++ * Wed Mar 31 17:35:01 CEST 2004: Martin Schulze <joey@infodrom.org>
++ *	Created local copy of module.h based on the content of Linux
++ *	2.2 since <linux/module.h> doesn't work anymore with its
++ *	recent content from Linux 2.4/2.6.
++ */
++
++#include <asm/atomic.h>
++
++#define MODULE_NAME_LEN 60
++
++struct kernel_sym
++{
++	unsigned long value;
++	char name[MODULE_NAME_LEN];
++};
++
++
++struct list_head {
++	struct list_head *next, *prev;
++};
++
++
++struct module_info
++{
++	unsigned long addr;
++	unsigned long size;
++	unsigned long flags;
++	long usecount;
++};
++
++
++struct module
++{
++	unsigned long size_of_struct;	/* == sizeof(module) */
++	struct module *next;
++	const char *name;
++	unsigned long size;
++
++	union
++	{
++		int usecount;
++		long pad;
++	} uc;				/* Needs to keep its size - so says rth */
++
++	unsigned long flags;		/* AUTOCLEAN et al */
++
++	unsigned nsyms;
++	unsigned ndeps;
++
++	struct module_symbol *syms;
++	struct module_ref *deps;
++	struct module_ref *refs;
++	int (*init)(void);
++	void (*cleanup)(void);
++	const struct exception_table_entry *ex_table_start;
++	const struct exception_table_entry *ex_table_end;
++#ifdef __alpha__
++	unsigned long gp;
++#endif
++	/* Members past this point are extensions to the basic
++	   module support and are optional.  Use mod_opt_member()
++	   to examine them.  */
++	const struct module_persist *persist_start;
++	const struct module_persist *persist_end;
++	int (*can_unload)(void);
++};
+diff -Naur sysklogd-1.4.1/pidfile.c sysklogd-20050123/pidfile.c
+--- sysklogd-1.4.1/pidfile.c	1998-02-10 17:37:12.000000000 -0500
++++ sysklogd-20050123/pidfile.c	2003-09-27 22:38:18.000000000 -0400
+@@ -87,7 +87,7 @@
+   int fd;
+   int pid;
+ 
+-  if ( ((fd = open(pidfile, O_RDWR|O_CREAT, 0644)) == -1)
++  if ( ((fd = open(pidfile, O_RDWR|O_CREAT|O_TRUNC, 0644)) == -1)
+        || ((f = fdopen(fd, "r+")) == NULL) ) {
+       fprintf(stderr, "Can't open or create %s.\n", pidfile);
+       return 0;
+diff -Naur sysklogd-1.4.1/README.1st sysklogd-20050123/README.1st
+--- sysklogd-1.4.1/README.1st	1997-06-02 13:21:39.000000000 -0400
++++ sysklogd-20050123/README.1st	2003-09-04 09:22:23.000000000 -0400
+@@ -1,5 +1,5 @@
+-Very important information before using version 1.3
+----------------------------------------------------
++Important information
++---------------------
+ 
+ The included version of syslogd behaves in a slightly different manner
+ to the one in former releases.  Please review the following important
+@@ -63,3 +63,10 @@
+   these scripts should remove all old .pid files found in /var/run.
+   This will insure that klogd and syslogd start properly even if prior
+   executions have been terminated harshly.
++
++* Large file support, i.e. support to write to log files that are
++  larger than 2 GB is not part of syslogd, but a matter of the Glibc
++  emitting different system calls to the kernel interface.  To support
++  large files you'll have to compile syslogd with the compiler defines
++  -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE so that glibc adjusts the
++  system calls.
+diff -Naur sysklogd-1.4.1/README.linux sysklogd-20050123/README.linux
+--- sysklogd-1.4.1/README.linux	1999-01-18 19:09:12.000000000 -0500
++++ sysklogd-20050123/README.linux	2004-07-09 13:22:29.000000000 -0400
+@@ -40,12 +40,17 @@
+ a useful addition to the software gene pool.
+ 
+ There is a mailing list covering this package and syslog in general.
+-The lists address is sysklogd@Infodrom.North.DE .  To subscribe send a
+-mail to Majordomo@Infodrom.North.DE with a line "subscribe sysklogd"
++The lists address is infodrom-sysklogd@lists.infodrom.org .  To subscribe send a
++mail to majordomo@lists.infodrom.org with a line "subscribe infodrom-sysklogd"
+ in the message body.
+ 
+-New versions of this package will be available at Joey's ftp server.
+-ftp://ftp.infodrom.north.de/pub/people/joey/sysklogd/
++A second mailing list exists as infodrom-sysklogd-cvs@lists.infodrom.org.  Only
++CVS messages and diffs are distributed there. Whenever new code is added to
++sysklogd, CVS generates a mail from these changes which will be sent to
++this list.  Discussions will take place on the first list.
++
++The latest version of this software can be found at:
++http://www.infodrom.org/projects/sysklogd/download.php3
+ 
+ Best regards,
+ 
+@@ -67,6 +72,6 @@
+ 
+ Martin Schulze
+ Infodrom Oldenburg
+-joey@linux.de
++joey@infodrom.org
+ 
+-And a host of bug reporters whose contributions cannot be underestimated.
++And a number of bug reporters whose contributions cannot be underestimated.
+diff -Naur sysklogd-1.4.1/sysklogd.8 sysklogd-20050123/sysklogd.8
+--- sysklogd-1.4.1/sysklogd.8	2001-03-11 14:35:51.000000000 -0500
++++ sysklogd-20050123/sysklogd.8	2004-07-09 13:33:32.000000000 -0400
+@@ -84,7 +84,7 @@
+ .B MAXFUNIX
+ within the syslogd.c source file.  An example for a chroot() daemon is
+ described by the people from OpenBSD at
+-http://www.psionic.com/papers/dns.html.
++<http://www.guides.sk/psionic/dns/>.
+ .TP
+ .B "\-d"
+ Turns on debug mode.  Using this the daemon will not proceed a 
+@@ -117,7 +117,8 @@
+ between two \fI-- MARK --\fR lines is 20 minutes.  This can be changed
+ with this option.  Setting the
+ .I interval
+-to zero turns it off entirely.
++to zero turns it off entirely.  Depending on other log messages
++generated these lines may not be written consecutively.
+ .TP
+ .B "\-n"
+ Avoid auto-backgrounding.  This is needed especially if the
+@@ -364,8 +365,10 @@
+ 
+ To avoid this in further times no messages that were received from a
+ remote host are sent out to another (or the same) remote host
+-anymore.  If there are scenarios where this doesn't make sense, please
+-drop me (Joey) a line.
++anymore.  If you experience are setup in which this doesn't make
++sense, please use the
++.B \-h
++commandline switch.
+ 
+ If the remote host is located in the same domain as the host, 
+ .B syslogd
+diff -Naur sysklogd-1.4.1/syslog.c sysklogd-20050123/syslog.c
+--- sysklogd-1.4.1/syslog.c	2001-03-11 14:35:51.000000000 -0500
++++ sysklogd-20050123/syslog.c	2003-08-27 11:56:01.000000000 -0400
+@@ -47,6 +47,9 @@
+  * Sun Mar 11 20:23:44 CET 2001: Martin Schulze <joey@infodrom.ffis.de>
+  *	Use SOCK_DGRAM for loggin, renables it to work.	
+  *
++ * Wed Aug 27 17:48:16 CEST 2003: Martin Schulze <joey@Infodrom.org>
++ *	Improved patch by Michael Pomraning <mjp@securepipe.com> to
++ *	reconnect klogd to the logger after it went away.
+  */
+ 
+ #include <sys/types.h>
+@@ -98,6 +101,7 @@
+ 	register char *p;
+ 	time_t now;
+ 	int fd, saved_errno;
++	int result;
+ 	char tbuf[2048], fmt_cpy[1024], *stdp = (char *) 0;
+ 
+ 	saved_errno = errno;
+@@ -167,7 +171,16 @@
+ 	}
+ 
+ 	/* output the message to the local logger */
+-	if (write(LogFile, tbuf, cnt + 1) >= 0 || !(LogStat&LOG_CONS))
++	result = write(LogFile, tbuf, cnt + 1);
++
++	if (result == -1
++	    && (errno == ECONNRESET || errno == ENOTCONN || errno == ECONNREFUSED)) {
++		closelog();
++		openlog(LogTag, LogStat | LOG_NDELAY, LogFacility);
++		result = write(LogFile, tbuf, cnt + 1);
++	}
++
++	if (result >= 0 || !(LogStat&LOG_CONS))
+ 		return;
+ 
+ 	/*
+diff -Naur sysklogd-1.4.1/syslog.conf.5 sysklogd-20050123/syslog.conf.5
+--- sysklogd-1.4.1/syslog.conf.5	1999-08-21 06:49:14.000000000 -0400
++++ sysklogd-20050123/syslog.conf.5	2003-05-22 15:31:20.000000000 -0400
+@@ -64,7 +64,7 @@
+ The
+ .I facility
+ is one of the following keywords:
+-.BR auth ", " authpriv ", " cron ", " daemon ", " kern ", " lpr ", "
++.BR auth ", " authpriv ", " cron ", " daemon ", " ftp ", " kern ", " lpr ", "
+ .BR mail ", " mark ", " news ", " security " (same as " auth "), "
+ .BR syslog ", " user ", " uucp " and " local0 " through " local7 .
+ The keyword 
+@@ -121,12 +121,21 @@
+ 
+ This 
+ .BR syslogd (8)
+-has a syntax extension to the original BSD source, that makes its use
++has a syntax extension to the original BSD source, which makes its use
+ more intuitively.  You may precede every priority with an equation sign
+-(``='') to specify only this single priority and not any of the
+-above.  You may also (both is valid, too) precede the priority with an
+-exclamation mark (``!'') to ignore all that priorities, either exact
+-this one or this and any higher priority.  If you use both extensions
++(``='') to specify that
++.B syslogd
++should only refer to this single priority and not this priority and
++all higher priorities.
++
++You may also precide the priority with an exclamation mark (``!'') if
++you want
++.B syslogd
++to ignore this priority and all higher priorities.
++You may even use both, the exclamation mark and the equation sign if
++you want
++.B syslogd
++to ignore only this single priority.  If you use both extensions
+ than the exclamation mark must occur before the equation sign, just
+ use it intuitively.
+ 
+@@ -300,7 +309,7 @@
+ .B syslogd
+ log all messages that come with either the
+ .BR info " or the " notice
+-facility into the file
++priority into the file
+ .IR /var/log/messages ,
+ except for all messages that use the
+ .B mail
+diff -Naur sysklogd-1.4.1/syslogd.c sysklogd-20050123/syslogd.c
+--- sysklogd-1.4.1/syslogd.c	2001-03-11 14:40:10.000000000 -0500
++++ sysklogd-20050123/syslogd.c	2005-01-15 14:13:08.000000000 -0500
+@@ -441,6 +441,39 @@
+  *	Don't return a closed fd if `-a' is called with a wrong path.
+  *	Thanks to Bill Nottingham <notting@redhat.com> for providing
+  *	a patch.
++ * Thu Apr 13 05:08:10 CEST 2001: Jon Burgess <Jon_Burgess@eur.3com.com>
++ *	Moved the installation of the signal handler up a little bit
++ *	so it guaranteed to be available when the child is forked,
++ *	hence, fixing a  race condition.  This used to create problems
++ *	with UML and fast machines.
++ *
++ * Sat Apr 17 18:03:05 CEST 2004: Steve Grubb <linux_4ever@yahoo.com>
++ *	Correct memory allocation for for commandline arguments in
++ *	crunch_list().
++ *
++ * Thu Apr 29 12:38:39 CEST 2004: Solar Designer <solar@openwall.com>
++ *	Applied Openwall paranoia patches to improve crunch_list().
++ *
++ * Tue May  4 16:47:30 CEST 2004: Solar Designer <solar@openwall.com>
++ *	Ensure that "len" is not placed in a register, and that the
++ *	endtty() signal handler is not installed too early which could
++ *	cause a segmentation fault or worse.
++ *
++ * Tue May  4 16:52:01 CEST 2004: Solar Designer <solar@openwall.com>
++ *	Adjust the size of a variable to prevent a buffer overflow
++ *	should _PATH_DEV ever contain something different than "/dev/".
++ *
++ * Tue Nov  2 20:28:23 CET 2004: Colin Phipps <cph@cph.demon.co.uk>
++ *	Don't block on the network socket, in case a packet gets lost
++ *	between select and recv.
++ *
++ * Sun Nov  7 12:28:47 CET 2004: Martin Schulze <joey@infodrom.org>
++ *	Discard any timestamp information found in received syslog
++ *	messages.  This will affect local messages sent from a
++ *	different timezone.
++ *
++ * Sun Nov  7 13:47:00 CET 2004: Martin Schulze <joey@infodrom.org>
++ *	Remove trailing newline when forwarding messages.
+  */
+ 
+ 
+@@ -890,11 +923,11 @@
+ 		dprintf("Checking pidfile.\n");
+ 		if (!check_pid(PidFile))
+ 		{
++			signal (SIGTERM, doexit);
+ 			if (fork()) {
+ 				/*
+ 				 * Parent process
+ 				 */
+-				signal (SIGTERM, doexit);
+ 				sleep(300);
+ 				/*
+ 				 * Not reached unless something major went wrong.  5
+@@ -992,6 +1025,7 @@
+ 	(void) signal(SIGCHLD, reapchild);
+ 	(void) signal(SIGALRM, domark);
+ 	(void) signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
++	(void) signal(SIGXFSZ, SIG_IGN);
+ 	(void) alarm(TIMERINTVL);
+ 
+ 	/* Create a partial message table for all file descriptors. */
+@@ -1141,13 +1175,13 @@
+ 				 */
+ 				printchopped(from, line, \
+  					     i + 2,  finet);
+-			} else if (i < 0 && errno != EINTR) {
++			} else if (i < 0 && errno != EINTR && errno != EAGAIN) {
+ 				dprintf("INET socket error: %d = %s.\n", \
+ 					errno, strerror(errno));
+ 				logerror("recvfrom inet");
+ 				/* should be harmless now that we set
+ 				 * BSDCOMPAT on the socket */
+-				sleep(10);
++				sleep(1);
+ 			}
+ 		}
+ #endif
+@@ -1216,6 +1250,7 @@
+ {
+ 	int fd, on = 1;
+ 	struct sockaddr_in sin;
++	int sockflags;
+ 
+ 	fd = socket(AF_INET, SOCK_DGRAM, 0);
+ 	if (fd < 0) {
+@@ -1241,6 +1276,24 @@
+ 		close(fd);
+ 		return -1;
+ 	}
++	/* We must not block on the network socket, in case a packet
++	 * gets lost between select and recv, otherise the process
++	 * will stall until the timeout, and other processes trying to
++	 * log will also stall.
++	 */
++	if ((sockflags = fcntl(fd, F_GETFL)) != -1) {
++		sockflags |= O_NONBLOCK;
++		/*
++		 * SETFL could fail too, so get it caught by the subsequent
++		 * error check.
++		 */
++		sockflags = fcntl(fd, F_SETFL, sockflags);
++	}
++	if (sockflags == -1) {
++		logerror("fcntl(O_NONBLOCK), suspending inet");
++		close(fd);
++		return -1;
++	}
+ 	if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
+ 		logerror("bind, suspending inet");
+ 		close(fd);
+@@ -1254,30 +1307,26 @@
+ crunch_list(list)
+ 	char *list;
+ {
+-	int count, i;
++	int i, m, n;
+ 	char *p, *q;
+ 	char **result = NULL;
+ 
+ 	p = list;
+ 	
+ 	/* strip off trailing delimiters */
+-	while (p[strlen(p)-1] == LIST_DELIMITER) {
+-		count--;
++	while (*p && p[strlen(p)-1] == LIST_DELIMITER)
+ 		p[strlen(p)-1] = '\0';
+-	}
+ 	/* cut off leading delimiters */
+-	while (p[0] == LIST_DELIMITER) {
+-		count--;
++	while (p[0] == LIST_DELIMITER)
+ 		p++; 
+-	}
+ 	
+-	/* count delimiters to calculate elements */
+-	for (count=i=0; p[i]; i++)
+-		if (p[i] == LIST_DELIMITER) count++;
++	/* count delimiters to calculate the number of elements */
++	for (n = i = 0; p[i]; i++)
++		if (p[i] == LIST_DELIMITER) n++;
+ 	
+-	if ((result = (char **)malloc(sizeof(char *) * count+2)) == NULL) {
++	if ((result = (char **)malloc(sizeof(char *) * (n + 2))) == NULL) {
+ 		printf ("Sorry, can't get enough memory, exiting.\n");
+-		exit(0);
++		exit(1);
+ 	}
+ 	
+ 	/*
+@@ -1285,30 +1334,28 @@
+ 	 * characters are different from any delimiters,
+ 	 * so we don't have to care about this.
+ 	 */
+-	count = 0;
+-	while ((q=strchr(p, LIST_DELIMITER))) {
+-		result[count] = (char *) malloc((q - p + 1) * sizeof(char));
+-		if (result[count] == NULL) {
++	m = 0;
++	while ((q = strchr(p, LIST_DELIMITER)) && m < n) {
++		result[m] = (char *) malloc((q - p + 1) * sizeof(char));
++		if (result[m] == NULL) {
+ 			printf ("Sorry, can't get enough memory, exiting.\n");
+-			exit(0);
++			exit(1);
+ 		}
+-		strncpy(result[count], p, q - p);
+-		result[count][q - p] = '\0';
++		memcpy(result[m], p, q - p);
++		result[m][q - p] = '\0';
+ 		p = q; p++;
+-		count++;
++		m++;
+ 	}
+-	if ((result[count] = \
+-	     (char *)malloc(sizeof(char) * strlen(p) + 1)) == NULL) {
++	if ((result[m] = strdup(p)) == NULL) {
+ 		printf ("Sorry, can't get enough memory, exiting.\n");
+-		exit(0);
++		exit(1);
+ 	}
+-	strcpy(result[count],p);
+-	result[++count] = NULL;
++	result[++m] = NULL;
+ 
+ #if 0
+-	count=0;
+-	while (result[count])
+-		dprintf ("#%d: %s\n", count, StripDomains[count++]);
++	m = 0;
++	while (result[m])
++		dprintf ("#%d: %s\n", m, result[m++]);
+ #endif
+ 	return result;
+ }
+@@ -1548,21 +1595,25 @@
+ 
+ 	/*
+ 	 * Check to see if msg looks non-standard.
++	 *
++	 * A message looks like
++	 * Nov 17 11:42:33 CRON[
++	 * 01234567890123456
++	 *    ^  ^  ^  ^  ^
++	 *
++	 * Remote messages are not accompanied by a timestamp.
++	 * Local messages are accompanied by a timestamp (program's timezone)
+ 	 */
+ 	msglen = strlen(msg);
+-	if (msglen < 16 || msg[3] != ' ' || msg[6] != ' ' ||
+-	    msg[9] != ':' || msg[12] != ':' || msg[15] != ' ')
+-		flags |= ADDDATE;
+-
+-	(void) time(&now);
+-	if (flags & ADDDATE)
+-		timestamp = ctime(&now) + 4;
+-	else {
+-		timestamp = msg;
++	if (!(msglen < 16 || msg[3] != ' ' || msg[6] != ' ' ||
++	    msg[9] != ':' || msg[12] != ':' || msg[15] != ' ')) {
+ 		msg += 16;
+ 		msglen -= 16;
+ 	}
+ 
++	(void) time(&now);
++	timestamp = ctime(&now) + 4;
++
+ 	/* extract facility and priority level */
+ 	if (flags & MARK)
+ 		fac = LOG_NFACILITIES;
+@@ -1771,7 +1822,7 @@
+ 			dprintf("Not sending message to remote.\n");
+ 		else {
+ 			f->f_time = now;
+-			(void) snprintf(line, sizeof(line), "<%d>%s\n", f->f_prevpri, \
++			(void) snprintf(line, sizeof(line), "<%d>%s", f->f_prevpri, \
+ 				(char *) iov[4].iov_base);
+ 			l = strlen(line);
+ 			if (l > MAXLINE)
+@@ -1815,7 +1866,7 @@
+ 			v->iov_len = 1;
+ 		}
+ 	again:
+-		/* f->f_file == -1 is an indicator that the we couldn't
++		/* f->f_file == -1 is an indicator that we couldn't
+ 		   open the file at startup. */
+ 		if (f->f_file == -1)
+ 			break;
+@@ -1852,7 +1903,7 @@
+ 				errno = e;
+ 				logerror(f->f_un.f_fname);
+ 			}
+-		} else if (f->f_flags & SYNC_FILE)
++		} else if (f->f_type == F_FILE && (f->f_flags & SYNC_FILE))
+ 			(void) fsync(f->f_file);
+ 		break;
+ 
+@@ -1891,7 +1942,7 @@
+ 	register struct filed *f;
+ 	struct iovec *iov;
+ {
+-	char p[6 + UNAMESZ];
++	char p[sizeof (_PATH_DEV) + UNAMESZ];
+ 	register int i;
+ 	int ttyf, len;
+ 	static int reenter = 0;
+@@ -1899,6 +1950,8 @@
+ 	struct utmp *uptr;
+ 	char greetings[200];
+ 
++	(void) &len;
++
+ 	if (reenter++)
+ 		return;
+ 
+@@ -1913,7 +1966,6 @@
+ 	if (fork() == 0) {
+ 		(void) signal(SIGTERM, SIG_DFL);
+ 		(void) alarm(0);
+-		(void) signal(SIGALRM, endtty);
+ #ifndef SYSV
+ 		(void) signal(SIGTTOU, SIG_IGN);
+ 		(void) sigsetmask(0);
+@@ -1929,7 +1981,7 @@
+ 			/* is this slot used? */
+ 			if (ut.ut_name[0] == '\0')
+ 				continue;
+-			if (ut.ut_type == LOGIN_PROCESS)
++			if (ut.ut_type != USER_PROCESS)
+ 			        continue;
+ 			if (!(strcmp (ut.ut_name,"LOGIN"))) /* paranoia */
+ 			        continue;
+@@ -1959,6 +2011,7 @@
+ 				iov[1].iov_len = 0;
+ 			}
+ 			if (setjmp(ttybuf) == 0) {
++				(void) signal(SIGALRM, endtty);
+ 				(void) alarm(15);
+ 				/* open the terminal */
+ 				ttyf = open(p, O_WRONLY|O_NOCTTY);
Index: patches/tar-1.15.1-gcc4_fix_tests-1.patch
===================================================================
--- patches/tar-1.15.1-gcc4_fix_tests-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/tar-1.15.1-gcc4_fix_tests-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,25 @@
+Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
+Date: 2005-07-15
+Initial Package Version: 1.15.1
+Upstream Status: From Upstream
+Origin: Ryan Oliver
+Description: Fixes a compilation problem with gcc-4.0.x that results in:
+
+genfile.c:63: error: static declaration of 'argp_program_version' follows non-static declaration
+../lib/argp.h:428: error: previous declaration of 'argp_program_version' was here
+genfile.c:64: error: static declaration of 'argp_program_bug_address' follows non-static declaration
+../lib/argp.h:444: error: previous declaration of 'argp_program_bug_address' was here
+
+--- tar-1.15.1/tests/genfile.c-orig	2005-04-25 15:23:47.000000000 +1000
++++ tar-1.15.1/tests/genfile.c	2005-04-25 15:24:08.000000000 +1000
+@@ -60,8 +60,8 @@
+ /* Block buffer for sparse file */
+ char *buffer;
+ 
+-static const char *argp_program_version = "genfile (" PACKAGE ") " VERSION;
+-static const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
++const char *argp_program_version = "genfile (" PACKAGE ") " VERSION;
++const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
+ static char doc[] = N_("genfile generates data files for GNU paxutils test suite");
+ 
+ static struct argp_option options[] = {
Index: patches/tar-1.15.1-sparse_fix-1.patch
===================================================================
--- patches/tar-1.15.1-sparse_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/tar-1.15.1-sparse_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,26 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-03-19
+Initial Package Version: 1.15.1
+Origin: Tar Bug Reports List
+Upstream Status: Applied
+Description: Fixes large file corruptions using option -S
+	http://lists.gnu.org/archive/html/bug-tar/2005-03/msg00004.html
+--- tar-1.15.1/src/sparse.c.orig	2005-03-20 04:23:34.144506120 +0000
++++ tar-1.15.1/src/sparse.c	2005-03-20 04:23:56.842055568 +0000
+@@ -1,6 +1,6 @@
+ /* Functions for dealing with sparse files
+ 
+-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
++   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ 
+    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
+@@ -182,7 +182,7 @@
+ {
+   static char buffer[BLOCKSIZE];
+   size_t count;
+-  size_t offset = 0;
++  off_t offset = 0;
+   struct sp_array sp = {0, 0};
+ 
+   if (!lseek_or_error (file, 0, SEEK_SET))
Index: patches/texinfo-4.8-tempfile_fix-2.patch
===================================================================
--- patches/texinfo-4.8-tempfile_fix-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/texinfo-4.8-tempfile_fix-2.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,80 @@
+Updated By: Bruce Dubbs (bdubbs -aT- linuxfromscratch -DoT- org)
+Date: 2005-12-12
+Submitted By: Archaic (archaic -aT- linuxfromscratch -DoT- org)
+Date: 2005-10-08
+Initial Package Version: 4.8
+Origin: http://gentoo.kems.net/gentoo-portage/sys-apps/texinfo/files/texinfo-4.8-tempfile.patch
+Upstream Status: A few patches are floating around in Debian BZ #328365 of which
+                 upstream hasn't made a full commitment on yet.
+Description: (CAN-2005-3011) texindex in texinfo 4.8 and earlier allows local
+             users to overwrite arbitrary files via a symlink attack on
+             temporary files.
+Update: Changed to not pass a constant string to mktemp().
+
+diff -Naur texinfo-4.8.orig/util/texindex.c texinfo-4.8/util/texindex.c
+--- texinfo-4.8.orig/util/texindex.c	2005-12-11 23:29:08.000000000 -0600
++++ texinfo-4.8/util/texindex.c	2005-12-11 23:33:31.000000000 -0600
+@@ -99,6 +99,9 @@
+ /* Directory to use for temporary files.  On Unix, it ends with a slash.  */
+ char *tempdir;
+ 
++/* Basename for temp files inside of tempdir.  */
++char *tempbase;
++
+ /* Number of last temporary file.  */
+ int tempcount;
+ 
+@@ -153,6 +156,7 @@
+ main (int argc, char **argv)
+ {
+   int i;
++  char template[]="txidxXXXXXX";
+ 
+   tempcount = 0;
+   last_deleted_tempcount = 0;
+@@ -190,6 +194,11 @@
+ 
+   decode_command (argc, argv);
+ 
++  /* XXX mkstemp not appropriate, as we need to have somewhat predictable
++   * names. But race condition was fixed, see maketempname. 
++   */
++  tempbase = mktemp (template);
++
+   /* Process input files completely, one by one.  */
+ 
+   for (i = 0; i < num_infiles; i++)
+@@ -389,21 +398,21 @@
+ static char *
+ maketempname (int count)
+ {
+-  static char *tempbase = NULL;
+   char tempsuffix[10];
+-
+-  if (!tempbase)
+-    {
+-      int fd;
+-      tempbase = concat (tempdir, "txidxXXXXXX");
+-
+-      fd = mkstemp (tempbase);
+-      if (fd == -1)
+-        pfatal_with_name (tempbase);
+-    }
++  char *name, *tmp_name;
++  int fd;
+ 
+   sprintf (tempsuffix, ".%d", count);
+-  return concat (tempbase, tempsuffix);
++  tmp_name = concat (tempdir, tempbase);
++  name = concat (tmp_name, tempsuffix);
++  free(tmp_name);
++
++  fd = open (name, O_CREAT|O_EXCL|O_WRONLY, 0600);
++  if (fd == -1)
++    pfatal_with_name (name);
++
++  close(fd);
++  return name;
+ }
+ 
+
Index: patches/util-linux-2.12r-cramfs-1.patch
===================================================================
--- patches/util-linux-2.12r-cramfs-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/util-linux-2.12r-cramfs-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,93 @@
+Submitted by: Jeremy Utley <jeremy@linuxfromscratch.org>
+Date: 2004-12-25
+Initial Package Version: 2.12p (should apply to versions back to at least k)
+Upstream Status: Not Submitted - Test Version
+Origin: Alexander Patrakov, adapted from debian build of cramfs utilities
+Description: Util-Linux fails in cramfs compilation due to changes in the
+linux-libc-headers package 2.6.9 and after.  This patch is a proper fix to the
+problem, but may in fact not be accepted upstream.
+
+
+diff -Naur util-linux-2.12p/disk-utils/fsck.cramfs.c util-linux-2.12p-new/disk-utils/fsck.cramfs.c
+--- util-linux-2.12p/disk-utils/fsck.cramfs.c	2004-12-11 14:53:16.000000000 +0000
++++ util-linux-2.12p-new/disk-utils/fsck.cramfs.c	2004-12-26 00:53:10.665199086 +0000
+@@ -76,16 +76,7 @@
+ 
+ #define PAD_SIZE 512
+ 
+-#include <asm/page.h>
+-#ifdef PAGE_SIZE
+-#define PAGE_CACHE_SIZE ((int) PAGE_SIZE)
+-#elif defined __ia64__
+-#define PAGE_CACHE_SIZE (16384)
+-#elif defined __alpha__
+-#define PAGE_CACHE_SIZE (8192)
+-#else
+-#define PAGE_CACHE_SIZE (4096)
+-#endif
++#define PAGE_CACHE_SIZE  page_size
+ 
+ /* Guarantee access to at least 8kB at a time */
+ #define ROMBUFFER_BITS	13
+@@ -95,11 +86,13 @@
+ static unsigned long read_buffer_block = ~0UL;
+ 
+ /* Uncompressing data structures... */
+-static char outbuffer[PAGE_CACHE_SIZE*2];
++static char *outbuffer;
+ z_stream stream;
+ 
+ #endif /* INCLUDE_FS_TESTS */
+ 
++static size_t page_size;
++
+ /* Input status of 0 to print help and exit without an error. */
+ static void usage(int status)
+ {
+@@ -464,9 +457,17 @@
+ 	int c;			/* for getopt */
+ 	int start = 0;
+ 
++	page_size = sysconf(_SC_PAGESIZE);
++	
+ 	if (argc)
+ 		progname = argv[0];
+ 
++	outbuffer = malloc(page_size * 2);
++	if (!outbuffer) {
++		fprintf(stderr, _("failed to allocate outbuffer\n"));
++		exit(8);
++	}
++
+ 	/* command line options */
+ 	while ((c = getopt(argc, argv, "hx:v")) != EOF) {
+ 		switch (c) {
+diff -Naur util-linux-2.12p/disk-utils/mkfs.cramfs.c util-linux-2.12p-new/disk-utils/mkfs.cramfs.c
+--- util-linux-2.12p/disk-utils/mkfs.cramfs.c	2004-12-11 14:56:01.000000000 +0000
++++ util-linux-2.12p-new/disk-utils/mkfs.cramfs.c	2004-12-26 00:53:10.666198928 +0000
+@@ -46,16 +46,8 @@
+ static const char *progname = "mkcramfs";
+ static int verbose = 0;
+ 
+-#ifdef __ia64__
+-#define PAGE_CACHE_SIZE (16384)
+-#elif defined __alpha__
+-#define PAGE_CACHE_SIZE (8192)
+-#else
+-#define PAGE_CACHE_SIZE (4096)
+-#endif
+-
+ /* The kernel assumes PAGE_CACHE_SIZE as block size. */
+-static unsigned int blksize = PAGE_CACHE_SIZE; /* settable via -b option */
++static unsigned int blksize;                   /* settable via -b option */
+ static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */
+ static int image_length = 0;
+ 
+@@ -730,6 +722,7 @@
+ 	u32 crc = crc32(0L, Z_NULL, 0);
+ 	int c;
+ 
++	blksize = sysconf(_SC_PAGESIZE);
+ 	total_blocks = 0;
+ 
+ 	if (argc) {
Index: patches/util-linux-2.12r-gcc4_fixes-1.patch
===================================================================
--- patches/util-linux-2.12r-gcc4_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/util-linux-2.12r-gcc4_fixes-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,26 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-08-28
+Initial Package Version: 2.12q
+Origin: Joe Ciccone 
+Upstream Status: Sent
+Description: Fixes GCC4 Compile Issues
+ 
+diff -Naur util-linux-2.12q.orig/mount/umount.c util-linux-2.12q/mount/umount.c
+--- util-linux-2.12q.orig/mount/umount.c	2004-12-20 22:03:45.000000000 +0000
++++ util-linux-2.12q/mount/umount.c	2005-08-29 04:11:27.000000000 +0000
+@@ -40,13 +40,13 @@
+ #include <linux/unistd.h>
+ #ifdef __NR_umount2
+ 
+-static int umount2(const char *path, int flags);
++int umount2(const char *path, int flags);
+ 
+ _syscall2(int, umount2, const char *, path, int, flags);
+ 
+ #else /* __NR_umount2 */
+ 
+-static int
++int
+ umount2(const char *path, int flags) {
+ 	fprintf(stderr, _("umount: compiled without support for -f\n"));
+ 	errno = ENOSYS;
Index: patches/util-linux-2.12r-mips64_fix-1.patch
===================================================================
--- patches/util-linux-2.12r-mips64_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/util-linux-2.12r-mips64_fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,19 @@
+Submitted By: Jim Gifford (patches at jg555 dot com)
+Date: 2005-06-08
+Initial Package Version: 2.12q
+Origin: Jim Gifford
+Upstream Status: Sent
+Description: Fixes compile issue under MIPS 64 bit
+ 
+diff -Naur util-linux-2.12q.orig/fdisk/sfdisk.c util-linux-2.12q/fdisk/sfdisk.c
+--- util-linux-2.12q.orig/fdisk/sfdisk.c	2005-01-04 22:31:57.000000000 +0000
++++ util-linux-2.12q/fdisk/sfdisk.c	2005-06-08 23:15:17.000000000 +0000
+@@ -172,7 +172,7 @@
+  * Note: we use 512-byte sectors here, irrespective of the hardware ss.
+  */
+ #undef use_lseek
+-#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
++#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__) || defined (__mips__)
+ #define use_lseek
+ #endif
+ 
Index: patches/yaboot-1.3.13-fix-1.patch
===================================================================
--- patches/yaboot-1.3.13-fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/yaboot-1.3.13-fix-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,21 @@
+Submitted By: Jeremy Huntwork <jhuntwork@linuxfromscratch.org>
+Date: 2005-03-23
+Initial Package Version: 1.3.13
+Upstream Status: Applied
+Origin: Jeremy Huntwork
+Description: Fixes Compile Error.
+
+diff -Naur yaboot-1.3.13.orig/lib/strstr.c yaboot-1.3.13/lib/strstr.c
+--- yaboot-1.3.13.orig/lib/strstr.c	2001-09-20 09:15:31.000000000 -0400
++++ yaboot-1.3.13/lib/strstr.c	2005-02-20 22:03:10.215796824 -0500
+@@ -76,7 +76,9 @@
+ 	      a = *++haystack;
+ 	      if (a == '\0')
+ 		goto ret0;
+-shloop:	    }
++shloop:	
++		a = a;
++	}
+           while (a != b);
+ 
+ jin:	  a = *++haystack;
Index: patches/zlib-1.2.3-fPIC-1.patch
===================================================================
--- patches/zlib-1.2.3-fPIC-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
+++ patches/zlib-1.2.3-fPIC-1.patch	(revision 69cde8d978d05e8d3464427bf5bec6f1b074f7b4)
@@ -0,0 +1,93 @@
+Submitted By: Tushar Teredesai <tushar@linuxfromscratch.org>
+Date: 2005-06-14
+Initial Package Version: 1.2.2
+Origin: Gentoo ebuild?
+Upstream Status: Not submitted
+Description:
+ 1. Build shared and static lib in one pass
+ 2. Always add -fPIC when building shared lib, don't expect the user to set it.
+
+To build the shared and static library:
+	./configure --prefix=<prefix> --shared &&
+	make &&
+	make install
+Remove the --shared if you don't want the shared lib.
+
+diff -Naur zlib-1.2.2.orig/configure zlib-1.2.2/configure
+--- zlib-1.2.2.orig/configure	2004-09-07 00:50:06.000000000 -0500
++++ zlib-1.2.2/configure	2005-02-05 01:34:08.553292416 -0600
+@@ -73,7 +73,11 @@
+ 
+ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
+   CC="$cc"
+-  SFLAGS=${CFLAGS-"-fPIC -O3"}
++  #SFLAGS=${CFLAGS-"-fPIC -O3"}
++  # the above is horribly wrong on a few archs where -fPIC should ALWAYS be
++  # used in the creation of shared libraries. without the following, the
++  # shared lib test will sometimes fail even when shared libs -can- be created.
++  SFLAGS="${CFLAGS-"-O3"} -fPIC"
+   CFLAGS="$cflags"
+   case `(uname -s || echo unknown) 2>/dev/null` in
+   Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
+@@ -158,7 +162,7 @@
+   if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+      test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
+     CFLAGS="$SFLAGS"
+-    LIBS="$SHAREDLIBV"
++    LIBS="$LIBS $SHAREDLIBV"
+     echo Building shared library $SHAREDLIBV with $CC.
+   elif test -z "$old_cc" -a -z "$old_cflags"; then
+     echo No shared library support.
+diff -Naur zlib-1.2.2.orig/Makefile.in zlib-1.2.2/Makefile.in
+--- zlib-1.2.2.orig/Makefile.in	2004-09-15 09:27:20.000000000 -0500
++++ zlib-1.2.2/Makefile.in	2005-02-05 01:33:49.703158072 -0600
+@@ -49,6 +49,8 @@
+ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+        zutil.o inflate.o infback.o inftrees.o inffast.o
+ 
++PIC_OBJS = $(OBJS:%.o=%.lo)
++
+ OBJA =
+ # to use the asm code: make OBJA=match.o
+ 
+@@ -77,8 +79,11 @@
+ 	mv _match.o match.o
+ 	rm -f _match.s
+ 
+-$(SHAREDLIBV): $(OBJS)
+-	$(LDSHARED) -o $@ $(OBJS)
++%.lo: %.c
++	$(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
++
++$(SHAREDLIBV): $(PIC_OBJS)
++	$(LDSHARED) -o $@ $(PIC_OBJS) -lc
+ 	rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ 	ln -s $@ $(SHAREDLIB)
+ 	ln -s $@ $(SHAREDLIBM)
+@@ -89,13 +94,10 @@
+ minigzip$(EXE): minigzip.o $(LIBS)
+ 	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+ 
+-install: $(LIBS)
++install-libs: $(LIBS)
+ 	-@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
+-	-@if [ ! -d $(includedir)  ]; then mkdir -p $(includedir); fi
+ 	-@if [ ! -d $(libdir)      ]; then mkdir -p $(libdir); fi
+ 	-@if [ ! -d $(man3dir)     ]; then mkdir -p $(man3dir); fi
+-	cp zlib.h zconf.h $(includedir)
+-	chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
+ 	cp $(LIBS) $(libdir)
+ 	cd $(libdir); chmod 755 $(LIBS)
+ 	-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+@@ -110,6 +112,11 @@
+ # The ranlib in install is needed on NeXTSTEP which checks file times
+ # ldconfig is for Linux
+ 
++install: install-libs
++	-@if [ ! -d $(includedir)  ]; then mkdir $(includedir); fi
++	cp zlib.h zconf.h $(includedir)
++	chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
++
+ uninstall:
+ 	cd $(includedir); \
+ 	cd $(libdir); rm -f libz.a; \
