Forráskód Böngészése

generic: nuke 2.6.33 specific stuff, is not used by any platform

SVN-Revision: 24644
Gabor Juhos 15 éve
szülő
commit
0d01356fc6
100 módosított fájl, 0 hozzáadás és 35491 törlés
  1. 0 3
      include/kernel-version.mk
  2. 0 58
      target/linux/adm5120/patches-2.6.33/001-adm5120.patch
  3. 0 21
      target/linux/adm5120/patches-2.6.33/002-adm5120_flash.patch
  4. 0 23
      target/linux/adm5120/patches-2.6.33/003-adm5120_switch.patch
  5. 0 33
      target/linux/adm5120/patches-2.6.33/005-adm5120_usb.patch
  6. 0 22
      target/linux/adm5120/patches-2.6.33/007-adm5120_pci.patch
  7. 0 22
      target/linux/adm5120/patches-2.6.33/009-adm5120_leds_switch_trigger.patch
  8. 0 84
      target/linux/adm5120/patches-2.6.33/101-cfi_fixup_macronix_bootloc.patch
  9. 0 68
      target/linux/adm5120/patches-2.6.33/102-jedec_pmc_39lvxxx_chips.patch
  10. 0 24
      target/linux/adm5120/patches-2.6.33/103-mtd_trxsplit.patch
  11. 0 28
      target/linux/adm5120/patches-2.6.33/120-rb153_cf_driver.patch
  12. 0 378
      target/linux/adm5120/patches-2.6.33/200-amba_pl010_hacks.patch
  13. 0 13
      target/linux/adm5120/patches-2.6.33/201-amba_bus_hacks.patch
  14. 0 27
      target/linux/adm5120/patches-2.6.33/203-gpio_leds_brightness.patch
  15. 0 31
      target/linux/adm5120/patches-2.6.33/310-adm5120_wdt.patch
  16. 0 11
      target/linux/adm5120/patches-2.6.33/901-adm5120-usb-fix-compiler-warning.patch
  17. 0 11
      target/linux/adm5120/patches-2.6.33/902-adm5120-usb-remove-dev-power-power_state.patch
  18. 0 116
      target/linux/adm5120/patches-2.6.33/903-adm5120-usb-use-the-admhcd-structure-directly-in-debugfs-files.patch
  19. 0 252
      target/linux/adm5120/router_be/config-2.6.33
  20. 0 304
      target/linux/adm5120/router_le/config-2.6.33
  21. 0 168
      target/linux/atheros/config-2.6.33
  22. 0 39
      target/linux/atheros/patches-2.6.33/001-get_c0_compare_int_fix.patch
  23. 0 3126
      target/linux/atheros/patches-2.6.33/100-board.patch
  24. 0 68
      target/linux/atheros/patches-2.6.33/101-early-printk-support.patch
  25. 0 297
      target/linux/atheros/patches-2.6.33/105-ar2315_pci.patch
  26. 0 1611
      target/linux/atheros/patches-2.6.33/110-ar2313_ethernet.patch
  27. 0 659
      target/linux/atheros/patches-2.6.33/120-spiflash.patch
  28. 0 228
      target/linux/atheros/patches-2.6.33/130-watchdog.patch
  29. 0 54
      target/linux/atheros/patches-2.6.33/140-redboot_partition_scan.patch
  30. 0 72
      target/linux/atheros/patches-2.6.33/141-redboot_various_erase_size_fix.patch
  31. 0 70
      target/linux/atheros/patches-2.6.33/200-ar2313_enable_mvswitch.patch
  32. 0 174
      target/linux/atheros/patches-2.6.33/210-reset_button.patch
  33. 0 69
      target/linux/atheros/patches-2.6.33/220-enet_micrel_workaround.patch
  34. 0 2909
      target/linux/generic/config-2.6.33
  35. 0 244
      target/linux/generic/patches-2.6.33/001-squashfs_move_zlib_decomp.patch
  36. 0 317
      target/linux/generic/patches-2.6.33/002-squashfs_factor_out_remaining_zlib.patch
  37. 0 426
      target/linux/generic/patches-2.6.33/003-squashfs_add_decompressor_framework.patch
  38. 0 54
      target/linux/generic/patches-2.6.33/004-squashfs_add_decompressor_lzma_lzo.patch
  39. 0 42
      target/linux/generic/patches-2.6.33/005-squashfs_extra_parameter.patch
  40. 0 216
      target/linux/generic/patches-2.6.33/006-squashfs_add_lzma.patch
  41. 0 165
      target/linux/generic/patches-2.6.33/007-squashfs_make_lzma_available.patch
  42. 0 5142
      target/linux/generic/patches-2.6.33/008-jffs2_make_lzma_available.patch
  43. 0 11
      target/linux/generic/patches-2.6.33/011-mips_boot.patch
  44. 0 21
      target/linux/generic/patches-2.6.33/012-extra_optimization.patch
  45. 0 11
      target/linux/generic/patches-2.6.33/013-gcc4_inline_fix.patch
  46. 0 50
      target/linux/generic/patches-2.6.33/014-cfi_fix_amd_extended_table_check.patch
  47. 0 208
      target/linux/generic/patches-2.6.33/020-mips_multi_machine_support.patch
  48. 0 28
      target/linux/generic/patches-2.6.33/021-mips_image_cmdline_hack.patch
  49. 0 18
      target/linux/generic/patches-2.6.33/022-mips_use_generic_thread_info_allocator.patch
  50. 0 11
      target/linux/generic/patches-2.6.33/023-mips-fix-kexec.patch
  51. 0 161
      target/linux/generic/patches-2.6.33/025-mips_disable_fpu.patch
  52. 0 368
      target/linux/generic/patches-2.6.33/027-mips_module_reloc.patch
  53. 0 119
      target/linux/generic/patches-2.6.33/028-module_exports.patch
  54. 0 13
      target/linux/generic/patches-2.6.33/029-arm_module_unresolved_weak_sym.patch
  55. 0 43
      target/linux/generic/patches-2.6.33/030-pci_disable_common_quirks.patch
  56. 0 226
      target/linux/generic/patches-2.6.33/031-ppc_gcc_build_fix.patch
  57. 0 430
      target/linux/generic/patches-2.6.33/040-arm-update-mach-types.patch
  58. 0 30
      target/linux/generic/patches-2.6.33/040-compcache_swap_notify_core_support.patch
  59. 0 57
      target/linux/generic/patches-2.6.33/055-lzma_arm_kernel.patch
  60. 0 120
      target/linux/generic/patches-2.6.33/060-block2mtd_init.patch
  61. 0 625
      target/linux/generic/patches-2.6.33/065-rootfs_split.patch
  62. 0 10
      target/linux/generic/patches-2.6.33/066-block2mtd_probe.patch
  63. 0 30
      target/linux/generic/patches-2.6.33/070-redboot_space.patch
  64. 0 60
      target/linux/generic/patches-2.6.33/071-redboot_boardconfig.patch
  65. 0 32
      target/linux/generic/patches-2.6.33/080-mtd_plat_nand_chip_fixup.patch
  66. 0 35
      target/linux/generic/patches-2.6.33/081-mtd_myloader_partition_parser.patch
  67. 0 18
      target/linux/generic/patches-2.6.33/082-mtd_info_move_forward_decl.patch
  68. 0 12
      target/linux/generic/patches-2.6.33/083-mtd_fix_nand_correct_data_return_code.patch
  69. 0 39
      target/linux/generic/patches-2.6.33/084-mtd_m25p80_add_pm25lv_flash_support.patch
  70. 0 13
      target/linux/generic/patches-2.6.33/085-mtd_m25p80_add_en25pxx_support.patch
  71. 0 28
      target/linux/generic/patches-2.6.33/086-mtd_m25p80_add_xxxs33b_support.patch
  72. 0 10
      target/linux/generic/patches-2.6.33/087-mtd-m25p80-add-w25q32-chip-support.patch
  73. 0 10
      target/linux/generic/patches-2.6.33/088-winbond_cmdset.patch
  74. 0 37
      target/linux/generic/patches-2.6.33/089-mtd-samsung-flash.patch
  75. 0 12
      target/linux/generic/patches-2.6.33/090-mtd-m25p80-add-en25f32-chip-support.patch
  76. 0 2132
      target/linux/generic/patches-2.6.33/100-netfilter_layer7_2.21.patch
  77. 0 108
      target/linux/generic/patches-2.6.33/101-netfilter_layer7_pktmatch.patch
  78. 0 144
      target/linux/generic/patches-2.6.33/110-netfilter_match_speedup.patch
  79. 0 1337
      target/linux/generic/patches-2.6.33/150-netfilter_imq.patch
  80. 0 18
      target/linux/generic/patches-2.6.33/180-netfilter_depends.patch
  81. 0 1366
      target/linux/generic/patches-2.6.33/190-netfilter_rtsp.patch
  82. 0 795
      target/linux/generic/patches-2.6.33/200-sched_esfq.patch
  83. 0 227
      target/linux/generic/patches-2.6.33/201-jhash3.patch
  84. 0 83
      target/linux/generic/patches-2.6.33/202-mips_mem_functions_performance.patch
  85. 0 13
      target/linux/generic/patches-2.6.33/203-slab_maxsize.patch
  86. 0 132
      target/linux/generic/patches-2.6.33/204-jffs2_eofdetect.patch
  87. 0 56
      target/linux/generic/patches-2.6.33/205-skb_padding.patch
  88. 0 9
      target/linux/generic/patches-2.6.33/207-powerpc_asm_segment_h.patch
  89. 0 48
      target/linux/generic/patches-2.6.33/208-mips_oprofile_fix.patch
  90. 0 7782
      target/linux/generic/patches-2.6.33/209-mini_fo.patch
  91. 0 143
      target/linux/generic/patches-2.6.33/210-mini_fo_2.6.25_fixes.patch
  92. 0 66
      target/linux/generic/patches-2.6.33/211-mini_fo_2.6.25_dentry_open_war.patch
  93. 0 37
      target/linux/generic/patches-2.6.33/212-mini_fo_2.6.26_fixes.patch
  94. 0 41
      target/linux/generic/patches-2.6.33/213-mini_fo_2.6.27_fixes.patch
  95. 0 96
      target/linux/generic/patches-2.6.33/214-mini_fo_2.6.29.patch
  96. 0 157
      target/linux/generic/patches-2.6.33/215-mini_fo_2.6.30.patch
  97. 0 25
      target/linux/generic/patches-2.6.33/216-mini_fo_locking.patch
  98. 0 48
      target/linux/generic/patches-2.6.33/217-mini_fo_dentry_check.patch
  99. 0 42
      target/linux/generic/patches-2.6.33/219-kobject_uevent.patch
  100. 0 11
      target/linux/generic/patches-2.6.33/220-sound_kconfig.patch

+ 0 - 3
include/kernel-version.mk

@@ -11,9 +11,6 @@ endif
 ifeq ($(LINUX_VERSION),2.6.32.27)
   LINUX_KERNEL_MD5SUM:=c8df8bed01a3b7e4ce13563e74181d71
 endif
-ifeq ($(LINUX_VERSION),2.6.33.7)
-  LINUX_KERNEL_MD5SUM:=2cea51deeaa0620a07d005ec3b148f06
-endif
 ifeq ($(LINUX_VERSION),2.6.34.7)
   LINUX_KERNEL_MD5SUM:=8964e26120e84844998a673464a980ea
 endif

+ 0 - 58
target/linux/adm5120/patches-2.6.33/001-adm5120.patch

@@ -1,58 +0,0 @@
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -23,6 +23,21 @@ choice
- 	prompt "System type"
- 	default SGI_IP22
- 
-+config ADM5120
-+	bool "Infineon/ADMtek ADM5120 SoC based machines"
-+	select CEVT_R4K
-+	select CSRC_R4K
-+	select SYS_HAS_CPU_MIPS32_R1
-+	select SYS_HAS_EARLY_PRINTK
-+	select DMA_NONCOHERENT
-+	select IRQ_CPU
-+	select SYS_SUPPORTS_LITTLE_ENDIAN
-+	select SYS_SUPPORTS_BIG_ENDIAN
-+	select SYS_SUPPORTS_32BIT_KERNEL
-+	select ARCH_REQUIRE_GPIOLIB
-+	select SWAP_IO_SPACE if CPU_BIG_ENDIAN
-+	select MIPS_MACHINE
-+
- config MACH_ALCHEMY
- 	bool "Alchemy processor based machines"
- 	select SYS_SUPPORTS_ZBOOT
-@@ -681,6 +696,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
- 
- endchoice
- 
-+source "arch/mips/adm5120/Kconfig"
- source "arch/mips/alchemy/Kconfig"
- source "arch/mips/bcm63xx/Kconfig"
- source "arch/mips/jazz/Kconfig"
---- a/arch/mips/Makefile
-+++ b/arch/mips/Makefile
-@@ -205,6 +205,23 @@ cflags-$(CONFIG_MACH_JAZZ)	+= -I$(srctre
- load-$(CONFIG_MACH_JAZZ)	+= 0xffffffff80080000
- 
- #
-+# Infineon/ADMtek ADM5120
-+#
-+libs-$(CONFIG_ADM5120)			+= arch/mips/adm5120/prom/
-+core-$(CONFIG_ADM5120)			+= arch/mips/adm5120/common/
-+core-$(CONFIG_ADM5120_OEM_CELLVISION)	+= arch/mips/adm5120/cellvision/
-+core-$(CONFIG_ADM5120_OEM_COMPEX)	+= arch/mips/adm5120/compex/
-+core-$(CONFIG_ADM5120_OEM_EDIMAX)	+= arch/mips/adm5120/edimax/
-+core-$(CONFIG_ADM5120_OEM_GENERIC)	+= arch/mips/adm5120/generic/
-+core-$(CONFIG_ADM5120_OEM_INFINEON)	+= arch/mips/adm5120/infineon/
-+core-$(CONFIG_ADM5120_OEM_MIKROTIK)	+= arch/mips/adm5120/mikrotik/
-+core-$(CONFIG_ADM5120_OEM_MOTOROLA)	+= arch/mips/adm5120/motorola/
-+core-$(CONFIG_ADM5120_OEM_OSBRIDGE)	+= arch/mips/adm5120/osbridge/
-+core-$(CONFIG_ADM5120_OEM_ZYXEL)	+= arch/mips/adm5120/zyxel/
-+cflags-$(CONFIG_ADM5120)		+= -I$(srctree)/arch/mips/include/asm/mach-adm5120
-+load-$(CONFIG_ADM5120)			+= 0xffffffff80001000
-+
-+#
- # Common Alchemy Au1x00 stuff
- #
- core-$(CONFIG_SOC_AU1X00)	+= arch/mips/alchemy/common/

+ 0 - 21
target/linux/adm5120/patches-2.6.33/002-adm5120_flash.patch

@@ -1,21 +0,0 @@
---- a/drivers/mtd/maps/Kconfig
-+++ b/drivers/mtd/maps/Kconfig
-@@ -566,4 +566,8 @@ config MTD_PISMO
- 
- 	  When built as a module, it will be called pismo.ko
- 
-+config MTD_ADM5120
-+	tristate "Map driver for ADM5120 based boards"
-+	depends on ADM5120
-+
- endmenu
---- a/drivers/mtd/maps/Makefile
-+++ b/drivers/mtd/maps/Makefile
-@@ -41,6 +41,7 @@ obj-$(CONFIG_MTD_DBOX2)		+= dbox2-flash.
- obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
- obj-$(CONFIG_MTD_PCI)		+= pci.o
- obj-$(CONFIG_MTD_ALCHEMY)       += alchemy-flash.o
-+obj-$(CONFIG_MTD_ADM5120)      	+= adm5120-flash.o
- obj-$(CONFIG_MTD_AUTCPU12)	+= autcpu12-nvram.o
- obj-$(CONFIG_MTD_EDB7312)	+= edb7312.o
- obj-$(CONFIG_MTD_IMPA7)		+= impa7.o

+ 0 - 23
target/linux/adm5120/patches-2.6.33/003-adm5120_switch.patch

@@ -1,23 +0,0 @@
---- a/drivers/net/Kconfig
-+++ b/drivers/net/Kconfig
-@@ -602,6 +602,10 @@ config MIPS_AU1X00_ENET
- 	  If you have an Alchemy Semi AU1X00 based system
- 	  say Y.  Otherwise, say N.
- 
-+config ADM5120_ENET
-+	tristate "ADM5120 Ethernet switch support"
-+	depends on ADM5120
-+
- config SGI_IOC3_ETH
- 	bool "SGI IOC3 Ethernet"
- 	depends on PCI && SGI_IP27
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -208,6 +208,7 @@ obj-$(CONFIG_SC92031) += sc92031.o
- # This is also a 82596 and should probably be merged
- obj-$(CONFIG_LP486E) += lp486e.o
- 
-+obj-$(CONFIG_ADM5120_ENET) += adm5120sw.o
- obj-$(CONFIG_ETH16I) += eth16i.o
- obj-$(CONFIG_ZORRO8390) += zorro8390.o 8390.o
- obj-$(CONFIG_HPLANCE) += hplance.o 7990.o

+ 0 - 33
target/linux/adm5120/patches-2.6.33/005-adm5120_usb.patch

@@ -1,33 +0,0 @@
---- a/drivers/usb/Makefile
-+++ b/drivers/usb/Makefile
-@@ -9,6 +9,7 @@ obj-$(CONFIG_USB)		+= core/
- obj-$(CONFIG_USB_MON)		+= mon/
- 
- obj-$(CONFIG_PCI)		+= host/
-+obj-$(CONFIG_USB_ADM5120_HCD)	+= host/
- obj-$(CONFIG_USB_EHCI_HCD)	+= host/
- obj-$(CONFIG_USB_ISP116X_HCD)	+= host/
- obj-$(CONFIG_USB_OHCI_HCD)	+= host/
---- a/drivers/usb/host/Kconfig
-+++ b/drivers/usb/host/Kconfig
-@@ -4,6 +4,10 @@
- comment "USB Host Controller Drivers"
- 	depends on USB
- 
-+config USB_ADM5120_HCD
-+	tristate "ADM5120 HCD support (EXPERIMENTAL)"
-+	depends on USB && ADM5120 && EXPERIMENTAL
-+
- config USB_C67X00_HCD
- 	tristate "Cypress C67x00 HCD support"
- 	depends on USB
---- a/drivers/usb/host/Makefile
-+++ b/drivers/usb/host/Makefile
-@@ -18,6 +18,7 @@ obj-$(CONFIG_USB_WHCI_HCD)	+= whci/
- 
- obj-$(CONFIG_PCI)		+= pci-quirks.o
- 
-+obj-$(CONFIG_USB_ADM5120_HCD)	+= adm5120-hcd.o
- obj-$(CONFIG_USB_EHCI_HCD)	+= ehci-hcd.o
- obj-$(CONFIG_USB_OXU210HP_HCD)	+= oxu210hp-hcd.o
- obj-$(CONFIG_USB_ISP116X_HCD)	+= isp116x-hcd.o

+ 0 - 22
target/linux/adm5120/patches-2.6.33/007-adm5120_pci.patch

@@ -1,22 +0,0 @@
---- a/arch/mips/pci/Makefile
-+++ b/arch/mips/pci/Makefile
-@@ -55,6 +55,7 @@ obj-$(CONFIG_ZAO_CAPCELLA)	+= fixup-capc
- obj-$(CONFIG_WR_PPMC)		+= fixup-wrppmc.o
- obj-$(CONFIG_MIKROTIK_RB532)	+= pci-rc32434.o ops-rc32434.o fixup-rc32434.o
- obj-$(CONFIG_CPU_CAVIUM_OCTEON)	+= pci-octeon.o pcie-octeon.o
-+obj-$(CONFIG_ADM5120)		+= pci-adm5120.o
- 
- ifdef CONFIG_PCI_MSI
- obj-$(CONFIG_CPU_CAVIUM_OCTEON)	+= msi-octeon.o
---- a/include/linux/pci_ids.h
-+++ b/include/linux/pci_ids.h
-@@ -1753,6 +1753,9 @@
- #define PCI_VENDOR_ID_ESDGMBH		0x12fe
- #define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111
- 
-+#define PCI_VENDOR_ID_ADMTEK		0x1317
-+#define PCI_DEVICE_ID_ADMTEK_ADM5120	0x5120
-+
- #define PCI_VENDOR_ID_SIIG		0x131f
- #define PCI_SUBVENDOR_ID_SIIG		0x131f
- #define PCI_DEVICE_ID_SIIG_1S_10x_550	0x1000

+ 0 - 22
target/linux/adm5120/patches-2.6.33/009-adm5120_leds_switch_trigger.patch

@@ -1,22 +0,0 @@
---- a/drivers/leds/Kconfig
-+++ b/drivers/leds/Kconfig
-@@ -348,4 +348,12 @@ config LEDS_TRIGGER_NETDEV
- 	  This allows LEDs to be controlled by network device activity.
- 	  If unsure, say Y.
- 
-+config LEDS_TRIGGER_ADM5120_SWITCH
-+	tristate "LED ADM5120 Switch Port Status Trigger"
-+	depends on LEDS_TRIGGERS && ADM5120
-+	help
-+	  This allows LEDs to be controlled by the port states of
-+	  the ADM5120 built-in Ethernet Switch
-+	  If unsure, say N.
-+
- endif # NEW_LEDS
---- a/drivers/leds/Makefile
-+++ b/drivers/leds/Makefile
-@@ -46,3 +46,4 @@ obj-$(CONFIG_LEDS_TRIGGER_GPIO)		+= ledt
- obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON)	+= ledtrig-default-on.o
- obj-$(CONFIG_LEDS_TRIGGER_MORSE)	+= ledtrig-morse.o
- obj-$(CONFIG_LEDS_TRIGGER_NETDEV)      += ledtrig-netdev.o
-+obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o

+ 0 - 84
target/linux/adm5120/patches-2.6.33/101-cfi_fixup_macronix_bootloc.patch

@@ -1,84 +0,0 @@
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -53,6 +53,12 @@
- #define AT49BV6416		0x00d6
- #define MANUFACTURER_SAMSUNG	0x00ec
- 
-+/* Macronix */
-+#define MX29LV160B	0x2249	/* MX29LV160 Bottom-boot chip */
-+#define MX29LV160T	0x22C4	/* MX29LV160 Top-boot chip */
-+#define MX29LV320B	0x22A8	/* MX29LV320 Bottom-boot chip */
-+#define MX29LV320T	0x22A7	/* MX29LV320 Top-boot chip */
-+
- static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
- static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
- static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
-@@ -283,6 +289,41 @@ static void fixup_s29gl032n_sectors(stru
- 	}
- }
- 
-+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
-+/*
-+ * Some Macronix chips has no/bad bootblock information in the CFI table
-+ */
-+static void fixup_macronix_bootloc(struct mtd_info *mtd, void* param)
-+{
-+	struct map_info *map = mtd->priv;
-+	struct cfi_private *cfi = map->fldrv_priv;
-+	struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
-+	__u8 t;
-+
-+	switch (cfi->id) {
-+	/* TODO: put affected chip ids here */
-+	case MX29LV160B:
-+	case MX29LV320B:
-+		t = 2;	/* Bottom boot */
-+		break;
-+	case MX29LV160T:
-+	case MX29LV320T:
-+		t = 3;	/* Top boot */
-+		break;
-+	default:
-+		return;
-+	}
-+
-+	if (extp->TopBottom == t)
-+		/* boot location detected by the CFI layer is correct */
-+		return;
-+
-+	extp->TopBottom = t;
-+	printk("%s: Macronix chip detected, id:0x%04X, boot location forced "
-+		"to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top");
-+}
-+#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */
-+
- static struct cfi_fixup cfi_fixup_table[] = {
- 	{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
- #ifdef AMD_BOOTLOC_BUG
-@@ -319,6 +360,9 @@ static struct cfi_fixup fixup_table[] =
- 	 */
- 	{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_erase_chip, NULL },
- 	{ CFI_MFR_ATMEL, AT49BV6416, fixup_use_atmel_lock, NULL },
-+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
-+	{ MANUFACTURER_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc, NULL, },
-+#endif
- 	{ 0, 0, NULL, NULL }
- };
- 
---- a/drivers/mtd/chips/Kconfig
-+++ b/drivers/mtd/chips/Kconfig
-@@ -196,6 +196,14 @@ config MTD_CFI_AMDSTD
- 	  provides support for one of those command sets, used on chips
- 	  including the AMD Am29LV320.
- 
-+config MTD_CFI_FIXUP_MACRONIX_BOOTLOC
-+	bool "Fix boot-block location for Macronix flash chips"
-+	depends on MTD_CFI_AMDSTD
-+	help
-+	  Some Macronix flash chips have no/wrong boot-block location in the
-+	  CFI table, and the driver may detect the type incorrectly. Select
-+	  this if your board has such chip.
-+
- config MTD_CFI_STAA
- 	tristate "Support for ST (Advanced Architecture) flash chips"
- 	depends on MTD_GEN_PROBE

+ 0 - 68
target/linux/adm5120/patches-2.6.33/102-jedec_pmc_39lvxxx_chips.patch

@@ -1,68 +0,0 @@
---- a/drivers/mtd/chips/jedec_probe.c
-+++ b/drivers/mtd/chips/jedec_probe.c
-@@ -133,6 +133,10 @@
- #define UPD29F064115	0x221C
- 
- /* PMC */
-+#define PM39LV512	0x001B
-+#define PM39LV010	0x001C
-+#define PM39LV020	0x003D
-+#define PM39LV040	0x003E
- #define PM49FL002	0x006D
- #define PM49FL004	0x006E
- #define PM49FL008	0x006A
-@@ -1275,6 +1279,54 @@ static const struct amd_flash_info jedec
- 			ERASEINFO(0x02000,2),
- 			ERASEINFO(0x04000,1),
- 		}
-+        }, {
-+		.mfr_id		= MANUFACTURER_PMC,
-+		.dev_id		= PM39LV512,
-+		.name		= "PMC Pm39LV512",
-+		.devtypes	= CFI_DEVICETYPE_X8,
-+		.uaddr		= MTD_UADDR_0x0555_0x02AA,
-+		.dev_size	= SIZE_64KiB,
-+		.cmd_set	= P_ID_AMD_STD,
-+		.nr_regions	= 1,
-+		.regions	= {
-+			ERASEINFO(0x01000,16),
-+		}
-+        }, {
-+		.mfr_id		= MANUFACTURER_PMC,
-+		.dev_id		= PM39LV010,
-+		.name		= "PMC Pm39LV010",
-+		.devtypes	= CFI_DEVICETYPE_X8,
-+		.uaddr		= MTD_UADDR_0x0555_0x02AA,
-+		.dev_size	= SIZE_128KiB,
-+		.cmd_set	= P_ID_AMD_STD,
-+		.nr_regions	= 1,
-+		.regions	= {
-+			ERASEINFO(0x01000,32),
-+		}
-+        }, {
-+		.mfr_id		= MANUFACTURER_PMC,
-+		.dev_id		= PM39LV020,
-+		.name		= "PMC Pm39LV020",
-+		.devtypes	= CFI_DEVICETYPE_X8,
-+		.uaddr		= MTD_UADDR_0x0555_0x02AA,
-+		.dev_size	= SIZE_256KiB,
-+		.cmd_set	= P_ID_AMD_STD,
-+		.nr_regions	= 1,
-+		.regions	= {
-+			ERASEINFO(0x01000,64),
-+		}
-+        }, {
-+		.mfr_id		= MANUFACTURER_PMC,
-+		.dev_id		= PM39LV040,
-+		.name		= "PMC Pm39LV040",
-+		.devtypes	= CFI_DEVICETYPE_X8,
-+		.uaddr		= MTD_UADDR_0x0555_0x02AA,
-+		.dev_size	= SIZE_512KiB,
-+		.cmd_set	= P_ID_AMD_STD,
-+		.nr_regions	= 1,
-+		.regions	= {
-+			ERASEINFO(0x01000,128),
-+		}
- 	}, {
- 		.mfr_id		= MANUFACTURER_PMC,
- 		.dev_id		= PM49FL002,

+ 0 - 24
target/linux/adm5120/patches-2.6.33/103-mtd_trxsplit.patch

@@ -1,24 +0,0 @@
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -63,6 +63,11 @@ config MTD_ROOTFS_SPLIT
- 	depends on MTD_PARTITIONS
- 	default y
- 
-+config MTD_TRXSPLIT
-+	bool "Automatically find and split TRX partitions"
-+	depends on MTD_PARTITIONS
-+	default n
-+
- config MTD_REDBOOT_PARTS
- 	tristate "RedBoot partition table parsing"
- 	depends on MTD_PARTITIONS
---- a/drivers/mtd/Makefile
-+++ b/drivers/mtd/Makefile
-@@ -8,6 +8,7 @@ mtd-y				:= mtdcore.o mtdsuper.o mtdbdi.
- mtd-$(CONFIG_MTD_PARTITIONS)	+= mtdpart.o
- 
- obj-$(CONFIG_MTD_CONCAT)	+= mtdconcat.o
-+obj-$(CONFIG_MTD_TRXSPLIT)	+= trxsplit.o
- obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
- obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
- obj-$(CONFIG_MTD_AFS_PARTS)	+= afs.o

+ 0 - 28
target/linux/adm5120/patches-2.6.33/120-rb153_cf_driver.patch

@@ -1,28 +0,0 @@
---- a/drivers/ata/Makefile
-+++ b/drivers/ata/Makefile
-@@ -79,6 +79,7 @@ obj-$(CONFIG_PATA_PLATFORM)	+= pata_plat
- obj-$(CONFIG_PATA_AT91)	+= pata_at91.o
- obj-$(CONFIG_PATA_OF_PLATFORM)	+= pata_of_platform.o
- obj-$(CONFIG_PATA_ICSIDE)	+= pata_icside.o
-+obj-$(CONFIG_PATA_RB153_CF)	+= pata_rb153_cf.o
- # Should be last but two libata driver
- obj-$(CONFIG_PATA_ACPI)		+= pata_acpi.o
- # Should be last but one libata driver
---- a/drivers/ata/Kconfig
-+++ b/drivers/ata/Kconfig
-@@ -604,6 +604,15 @@ config PATA_RADISYS
- 
- 	  If unsure, say N.
- 
-+config PATA_RB153_CF
-+	tristate "RouterBOARD 153 Compact Flash support"
-+	depends on ADM5120_MACH_RB_153
-+	help
-+	  This option enables support for a Compact Flash connected on
-+	  the RouterBOARD 153.
-+
-+	  If unsure, say N.
-+
- config PATA_RB532
- 	tristate "RouterBoard 532 PATA CompactFlash support"
- 	depends on MIKROTIK_RB532

+ 0 - 378
target/linux/adm5120/patches-2.6.33/200-amba_pl010_hacks.patch

@@ -1,378 +0,0 @@
---- a/drivers/serial/amba-pl010.c
-+++ b/drivers/serial/amba-pl010.c
-@@ -50,11 +50,10 @@
- 
- #include <asm/io.h>
- 
--#define UART_NR		8
--
- #define SERIAL_AMBA_MAJOR	204
- #define SERIAL_AMBA_MINOR	16
--#define SERIAL_AMBA_NR		UART_NR
-+#define SERIAL_AMBA_NR		CONFIG_SERIAL_AMBA_PL010_NUMPORTS
-+#define SERIAL_AMBA_NAME	CONFIG_SERIAL_AMBA_PL010_PORTNAME
- 
- #define AMBA_ISR_PASS_LIMIT	256
- 
-@@ -80,9 +79,9 @@ static void pl010_stop_tx(struct uart_po
- 	struct uart_amba_port *uap = (struct uart_amba_port *)port;
- 	unsigned int cr;
- 
--	cr = readb(uap->port.membase + UART010_CR);
-+	cr = __raw_readl(uap->port.membase + UART010_CR);
- 	cr &= ~UART010_CR_TIE;
--	writel(cr, uap->port.membase + UART010_CR);
-+	__raw_writel(cr, uap->port.membase + UART010_CR);
- }
- 
- static void pl010_start_tx(struct uart_port *port)
-@@ -90,9 +89,9 @@ static void pl010_start_tx(struct uart_p
- 	struct uart_amba_port *uap = (struct uart_amba_port *)port;
- 	unsigned int cr;
- 
--	cr = readb(uap->port.membase + UART010_CR);
-+	cr = __raw_readl(uap->port.membase + UART010_CR);
- 	cr |= UART010_CR_TIE;
--	writel(cr, uap->port.membase + UART010_CR);
-+	__raw_writel(cr, uap->port.membase + UART010_CR);
- }
- 
- static void pl010_stop_rx(struct uart_port *port)
-@@ -100,9 +99,9 @@ static void pl010_stop_rx(struct uart_po
- 	struct uart_amba_port *uap = (struct uart_amba_port *)port;
- 	unsigned int cr;
- 
--	cr = readb(uap->port.membase + UART010_CR);
-+	cr = __raw_readl(uap->port.membase + UART010_CR);
- 	cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
--	writel(cr, uap->port.membase + UART010_CR);
-+	__raw_writel(cr, uap->port.membase + UART010_CR);
- }
- 
- static void pl010_enable_ms(struct uart_port *port)
-@@ -110,9 +109,9 @@ static void pl010_enable_ms(struct uart_
- 	struct uart_amba_port *uap = (struct uart_amba_port *)port;
- 	unsigned int cr;
- 
--	cr = readb(uap->port.membase + UART010_CR);
-+	cr = __raw_readl(uap->port.membase + UART010_CR);
- 	cr |= UART010_CR_MSIE;
--	writel(cr, uap->port.membase + UART010_CR);
-+	__raw_writel(cr, uap->port.membase + UART010_CR);
- }
- 
- static void pl010_rx_chars(struct uart_amba_port *uap)
-@@ -120,9 +119,9 @@ static void pl010_rx_chars(struct uart_a
- 	struct tty_struct *tty = uap->port.state->port.tty;
- 	unsigned int status, ch, flag, rsr, max_count = 256;
- 
--	status = readb(uap->port.membase + UART01x_FR);
-+	status = __raw_readl(uap->port.membase + UART01x_FR);
- 	while (UART_RX_DATA(status) && max_count--) {
--		ch = readb(uap->port.membase + UART01x_DR);
-+		ch = __raw_readl(uap->port.membase + UART01x_DR);
- 		flag = TTY_NORMAL;
- 
- 		uap->port.icount.rx++;
-@@ -131,9 +130,9 @@ static void pl010_rx_chars(struct uart_a
- 		 * Note that the error handling code is
- 		 * out of the main execution path
- 		 */
--		rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
-+		rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
- 		if (unlikely(rsr & UART01x_RSR_ANY)) {
--			writel(0, uap->port.membase + UART01x_ECR);
-+			__raw_writel(0, uap->port.membase + UART01x_ECR);
- 
- 			if (rsr & UART01x_RSR_BE) {
- 				rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
-@@ -163,7 +162,7 @@ static void pl010_rx_chars(struct uart_a
- 		uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
- 
- 	ignore_char:
--		status = readb(uap->port.membase + UART01x_FR);
-+		status = __raw_readl(uap->port.membase + UART01x_FR);
- 	}
- 	spin_unlock(&uap->port.lock);
- 	tty_flip_buffer_push(tty);
-@@ -176,7 +175,7 @@ static void pl010_tx_chars(struct uart_a
- 	int count;
- 
- 	if (uap->port.x_char) {
--		writel(uap->port.x_char, uap->port.membase + UART01x_DR);
-+		__raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR);
- 		uap->port.icount.tx++;
- 		uap->port.x_char = 0;
- 		return;
-@@ -188,7 +187,7 @@ static void pl010_tx_chars(struct uart_a
- 
- 	count = uap->port.fifosize >> 1;
- 	do {
--		writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
-+		__raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
- 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
- 		uap->port.icount.tx++;
- 		if (uart_circ_empty(xmit))
-@@ -206,9 +205,9 @@ static void pl010_modem_status(struct ua
- {
- 	unsigned int status, delta;
- 
--	writel(0, uap->port.membase + UART010_ICR);
-+	__raw_writel(0, uap->port.membase + UART010_ICR);
- 
--	status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
-+	status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
- 
- 	delta = status ^ uap->old_status;
- 	uap->old_status = status;
-@@ -236,7 +235,7 @@ static irqreturn_t pl010_int(int irq, vo
- 
- 	spin_lock(&uap->port.lock);
- 
--	status = readb(uap->port.membase + UART010_IIR);
-+	status = __raw_readl(uap->port.membase + UART010_IIR);
- 	if (status) {
- 		do {
- 			if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
-@@ -249,7 +248,7 @@ static irqreturn_t pl010_int(int irq, vo
- 			if (pass_counter-- == 0)
- 				break;
- 
--			status = readb(uap->port.membase + UART010_IIR);
-+			status = __raw_readl(uap->port.membase + UART010_IIR);
- 		} while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
- 				   UART010_IIR_TIS));
- 		handled = 1;
-@@ -263,7 +262,7 @@ static irqreturn_t pl010_int(int irq, vo
- static unsigned int pl010_tx_empty(struct uart_port *port)
- {
- 	struct uart_amba_port *uap = (struct uart_amba_port *)port;
--	unsigned int status = readb(uap->port.membase + UART01x_FR);
-+	unsigned int status = __raw_readl(uap->port.membase + UART01x_FR);
- 	return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
- }
- 
-@@ -273,7 +272,7 @@ static unsigned int pl010_get_mctrl(stru
- 	unsigned int result = 0;
- 	unsigned int status;
- 
--	status = readb(uap->port.membase + UART01x_FR);
-+	status = __raw_readl(uap->port.membase + UART01x_FR);
- 	if (status & UART01x_FR_DCD)
- 		result |= TIOCM_CAR;
- 	if (status & UART01x_FR_DSR)
-@@ -299,12 +298,12 @@ static void pl010_break_ctl(struct uart_
- 	unsigned int lcr_h;
- 
- 	spin_lock_irqsave(&uap->port.lock, flags);
--	lcr_h = readb(uap->port.membase + UART010_LCRH);
-+	lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
- 	if (break_state == -1)
- 		lcr_h |= UART01x_LCRH_BRK;
- 	else
- 		lcr_h &= ~UART01x_LCRH_BRK;
--	writel(lcr_h, uap->port.membase + UART010_LCRH);
-+	__raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
- 	spin_unlock_irqrestore(&uap->port.lock, flags);
- }
- 
-@@ -332,12 +331,12 @@ static int pl010_startup(struct uart_por
- 	/*
- 	 * initialise the old status of the modem signals
- 	 */
--	uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
-+	uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
- 
- 	/*
- 	 * Finally, enable interrupts
- 	 */
--	writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
-+	__raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
- 	       uap->port.membase + UART010_CR);
- 
- 	return 0;
-@@ -360,10 +359,10 @@ static void pl010_shutdown(struct uart_p
- 	/*
- 	 * disable all interrupts, disable the port
- 	 */
--	writel(0, uap->port.membase + UART010_CR);
-+	__raw_writel(0, uap->port.membase + UART010_CR);
- 
- 	/* disable break condition and fifos */
--	writel(readb(uap->port.membase + UART010_LCRH) &
-+	__raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) &
- 		~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
- 	       uap->port.membase + UART010_LCRH);
- 
-@@ -385,7 +384,7 @@ pl010_set_termios(struct uart_port *port
- 	/*
- 	 * Ask the core to calculate the divisor for us.
- 	 */
--	baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16); 
-+	baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
- 	quot = uart_get_divisor(port, baud);
- 
- 	switch (termios->c_cflag & CSIZE) {
-@@ -448,25 +447,25 @@ pl010_set_termios(struct uart_port *port
- 		uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
- 
- 	/* first, disable everything */
--	old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
-+	old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
- 
- 	if (UART_ENABLE_MS(port, termios->c_cflag))
- 		old_cr |= UART010_CR_MSIE;
- 
--	writel(0, uap->port.membase + UART010_CR);
-+	__raw_writel(0, uap->port.membase + UART010_CR);
- 
- 	/* Set baud rate */
- 	quot -= 1;
--	writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
--	writel(quot & 0xff, uap->port.membase + UART010_LCRL);
-+	__raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
-+	__raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL);
- 
- 	/*
- 	 * ----------v----------v----------v----------v-----
- 	 * NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
- 	 * ----------^----------^----------^----------^-----
- 	 */
--	writel(lcr_h, uap->port.membase + UART010_LCRH);
--	writel(old_cr, uap->port.membase + UART010_CR);
-+	__raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
-+	__raw_writel(old_cr, uap->port.membase + UART010_CR);
- 
- 	spin_unlock_irqrestore(&uap->port.lock, flags);
- }
-@@ -538,7 +537,7 @@ static struct uart_ops amba_pl010_pops =
- 	.verify_port	= pl010_verify_port,
- };
- 
--static struct uart_amba_port *amba_ports[UART_NR];
-+static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
- 
- #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
- 
-@@ -548,10 +547,10 @@ static void pl010_console_putchar(struct
- 	unsigned int status;
- 
- 	do {
--		status = readb(uap->port.membase + UART01x_FR);
-+		status = __raw_readl(uap->port.membase + UART01x_FR);
- 		barrier();
- 	} while (!UART_TX_READY(status));
--	writel(ch, uap->port.membase + UART01x_DR);
-+	__raw_writel(ch, uap->port.membase + UART01x_DR);
- }
- 
- static void
-@@ -565,8 +564,8 @@ pl010_console_write(struct console *co,
- 	/*
- 	 *	First save the CR then disable the interrupts
- 	 */
--	old_cr = readb(uap->port.membase + UART010_CR);
--	writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
-+	old_cr = __raw_readl(uap->port.membase + UART010_CR);
-+	__raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
- 
- 	uart_console_write(&uap->port, s, count, pl010_console_putchar);
- 
-@@ -575,10 +574,10 @@ pl010_console_write(struct console *co,
- 	 *	and restore the TCR
- 	 */
- 	do {
--		status = readb(uap->port.membase + UART01x_FR);
-+		status = __raw_readl(uap->port.membase + UART01x_FR);
- 		barrier();
- 	} while (status & UART01x_FR_BUSY);
--	writel(old_cr, uap->port.membase + UART010_CR);
-+	__raw_writel(old_cr, uap->port.membase + UART010_CR);
- 
- 	clk_disable(uap->clk);
- }
-@@ -587,9 +586,9 @@ static void __init
- pl010_console_get_options(struct uart_amba_port *uap, int *baud,
- 			     int *parity, int *bits)
- {
--	if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
-+	if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
- 		unsigned int lcr_h, quot;
--		lcr_h = readb(uap->port.membase + UART010_LCRH);
-+		lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
- 
- 		*parity = 'n';
- 		if (lcr_h & UART01x_LCRH_PEN) {
-@@ -604,8 +603,8 @@ pl010_console_get_options(struct uart_am
- 		else
- 			*bits = 8;
- 
--		quot = readb(uap->port.membase + UART010_LCRL) |
--		       readb(uap->port.membase + UART010_LCRM) << 8;
-+		quot = __raw_readl(uap->port.membase + UART010_LCRL) |
-+		       __raw_readl(uap->port.membase + UART010_LCRM) << 8;
- 		*baud = uap->port.uartclk / (16 * (quot + 1));
- 	}
- }
-@@ -623,7 +622,7 @@ static int __init pl010_console_setup(st
- 	 * if so, search for the first available port that does have
- 	 * console support.
- 	 */
--	if (co->index >= UART_NR)
-+	if (co->index >= SERIAL_AMBA_NR)
- 		co->index = 0;
- 	uap = amba_ports[co->index];
- 	if (!uap)
-@@ -641,7 +640,7 @@ static int __init pl010_console_setup(st
- 
- static struct uart_driver amba_reg;
- static struct console amba_console = {
--	.name		= "ttyAM",
-+	.name		= SERIAL_AMBA_NAME,
- 	.write		= pl010_console_write,
- 	.device		= uart_console_device,
- 	.setup		= pl010_console_setup,
-@@ -657,11 +656,11 @@ static struct console amba_console = {
- 
- static struct uart_driver amba_reg = {
- 	.owner			= THIS_MODULE,
--	.driver_name		= "ttyAM",
--	.dev_name		= "ttyAM",
-+	.driver_name		= SERIAL_AMBA_NAME,
-+	.dev_name		= SERIAL_AMBA_NAME,
- 	.major			= SERIAL_AMBA_MAJOR,
- 	.minor			= SERIAL_AMBA_MINOR,
--	.nr			= UART_NR,
-+	.nr			= SERIAL_AMBA_NR,
- 	.cons			= AMBA_CONSOLE,
- };
- 
---- a/drivers/serial/Kconfig
-+++ b/drivers/serial/Kconfig
-@@ -284,10 +284,25 @@ config SERIAL_AMBA_PL010
- 	help
- 	  This selects the ARM(R) AMBA(R) PrimeCell PL010 UART.  If you have
- 	  an Integrator/AP or Integrator/PP2 platform, or if you have a
--	  Cirrus Logic EP93xx CPU, say Y or M here.
-+	  Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
- 
- 	  If unsure, say N.
- 
-+config SERIAL_AMBA_PL010_NUMPORTS
-+	int "Maximum number of AMBA PL010 serial ports"
-+	depends on SERIAL_AMBA_PL010
-+	default "8"
-+	---help---
-+	  Set this to the number of serial ports you want the AMBA PL010 driver
-+	  to support.
-+
-+config SERIAL_AMBA_PL010_PORTNAME
-+	string "Name of the AMBA PL010 serial ports"
-+	depends on SERIAL_AMBA_PL010
-+	default "ttyAM"
-+	---help---
-+	  ::: To be written :::
-+
- config SERIAL_AMBA_PL010_CONSOLE
- 	bool "Support for console on AMBA serial port"
- 	depends on SERIAL_AMBA_PL010=y

+ 0 - 13
target/linux/adm5120/patches-2.6.33/201-amba_bus_hacks.patch

@@ -1,13 +0,0 @@
---- a/drivers/amba/bus.c
-+++ b/drivers/amba/bus.c
-@@ -18,6 +18,10 @@
- #include <asm/irq.h>
- #include <asm/sizes.h>
- 
-+#ifndef NO_IRQ
-+#define NO_IRQ		(-1)
-+#endif
-+
- #define to_amba_device(d)	container_of(d, struct amba_device, dev)
- #define to_amba_driver(d)	container_of(d, struct amba_driver, drv)
- 

+ 0 - 27
target/linux/adm5120/patches-2.6.33/203-gpio_leds_brightness.patch

@@ -1,27 +0,0 @@
---- a/drivers/leds/leds-gpio.c
-+++ b/drivers/leds/leds-gpio.c
-@@ -44,13 +44,17 @@ static void gpio_led_set(struct led_clas
- 		container_of(led_cdev, struct gpio_led_data, cdev);
- 	int level;
- 
--	if (value == LED_OFF)
--		level = 0;
--	else
--		level = 1;
--
--	if (led_dat->active_low)
--		level = !level;
-+	switch (value) {
-+	case LED_OFF:
-+		level = led_dat->active_low ? 1 : 0;
-+		break;
-+	case LED_FULL:
-+		level = led_dat->active_low ? 0 : 1;
-+		break;
-+	default:
-+		level = value;
-+		break;
-+	}
- 
- 	/* Setting GPIOs with I2C/etc requires a task context, and we don't
- 	 * seem to have a reliable way to know if we're already in one; so

+ 0 - 31
target/linux/adm5120/patches-2.6.33/310-adm5120_wdt.patch

@@ -1,31 +0,0 @@
---- a/drivers/watchdog/Kconfig
-+++ b/drivers/watchdog/Kconfig
-@@ -790,6 +790,18 @@ config RC32434_WDT
- 	  To compile this driver as a module, choose M here: the
- 	  module will be called rc32434_wdt.
- 
-+config ADM5120_WDT
-+	tristate "Infineon ADM5120 SoC hardware watchdog"
-+	depends on WATCHDOG && ADM5120
-+	help
-+	  This is a driver for hardware watchdog integrated in Infineon
-+	  ADM5120 SoC. This watchdog simply watches your kernel to make sure
-+	  it doesn't freeze, and if it does, it reboots your computer after a
-+	  certain amount of time.
-+
-+	  To compile this driver as a module, choose M here: the module will be
-+	  called adm5120_wdt.
-+
- config INDYDOG
- 	tristate "Indy/I2 Hardware Watchdog"
- 	depends on SGI_HAS_INDYDOG
---- a/drivers/watchdog/Makefile
-+++ b/drivers/watchdog/Makefile
-@@ -112,6 +112,7 @@ obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt
- obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
- obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
- obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
-+obj-$(CONFIG_ADM5120_WDT) += adm5120_wdt.o
- 
- # PARISC Architecture
- 

+ 0 - 11
target/linux/adm5120/patches-2.6.33/901-adm5120-usb-fix-compiler-warning.patch

@@ -1,11 +0,0 @@
---- a/drivers/usb/host/adm5120-dbg.c
-+++ b/drivers/usb/host/adm5120-dbg.c
-@@ -133,7 +133,7 @@ urb_print(struct admhcd *ahcd, struct ur
- 
- #define admhc_dbg_sw(ahcd, next, size, format, arg...) \
- 	do { \
--	if (next) { \
-+	if (next != NULL) { \
- 		unsigned s_len; \
- 		s_len = scnprintf(*next, *size, format, ## arg ); \
- 		*size -= s_len; *next += s_len; \

+ 0 - 11
target/linux/adm5120/patches-2.6.33/902-adm5120-usb-remove-dev-power-power_state.patch

@@ -1,11 +0,0 @@
---- a/drivers/usb/host/adm5120-dbg.c
-+++ b/drivers/usb/host/adm5120-dbg.c
-@@ -642,7 +642,7 @@ static ssize_t fill_registers_buffer(str
- 		hcd->product_desc,
- 		hcd_name);
- 
--	if (bus->controller->power.power_state.event) {
-+	if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
- 		size -= scnprintf(next, size,
- 			"SUSPENDED (no register access)\n");
- 		goto done;

+ 0 - 116
target/linux/adm5120/patches-2.6.33/903-adm5120-usb-use-the-admhcd-structure-directly-in-debugfs-files.patch

@@ -1,116 +0,0 @@
---- a/drivers/usb/host/adm5120-dbg.c
-+++ b/drivers/usb/host/adm5120-dbg.c
-@@ -419,7 +419,7 @@ static struct dentry *admhc_debug_root;
- 
- struct debug_buffer {
- 	ssize_t (*fill_func)(struct debug_buffer *);    /* fill method */
--	struct device *dev;
-+	struct admhcd *ahcd;
- 	struct mutex mutex;     /* protect filling of buffer */
- 	size_t count;           /* number of characters filled into buffer */
- 	char *page;
-@@ -494,15 +494,11 @@ show_list(struct admhcd *ahcd, char *buf
- 
- static ssize_t fill_async_buffer(struct debug_buffer *buf)
- {
--	struct usb_bus		*bus;
--	struct usb_hcd		*hcd;
- 	struct admhcd		*ahcd;
- 	size_t			temp;
- 	unsigned long		flags;
- 
--	bus = dev_get_drvdata(buf->dev);
--	hcd = bus_to_hcd(bus);
--	ahcd = hcd_to_admhcd(hcd);
-+	ahcd = buf->ahcd;
- 
- 	spin_lock_irqsave(&ahcd->lock, flags);
- 	temp = show_list(ahcd, buf->page, PAGE_SIZE, ahcd->ed_head);
-@@ -516,8 +512,6 @@ static ssize_t fill_async_buffer(struct
- 
- static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
- {
--	struct usb_bus		*bus;
--	struct usb_hcd		*hcd;
- 	struct admhcd		*ahcd;
- 	struct ed		**seen, *ed;
- 	unsigned long		flags;
-@@ -529,9 +523,7 @@ static ssize_t fill_periodic_buffer(stru
- 		return 0;
- 	seen_count = 0;
- 
--	bus = dev_get_drvdata(buf->dev);
--	hcd = bus_to_hcd(bus);
--	ahcd = hcd_to_admhcd(hcd);
-+	ahcd = buf->ahcd;
- 	next = buf->page;
- 	size = PAGE_SIZE;
- 
-@@ -613,7 +605,6 @@ static ssize_t fill_periodic_buffer(stru
- 
- static ssize_t fill_registers_buffer(struct debug_buffer *buf)
- {
--	struct usb_bus		*bus;
- 	struct usb_hcd		*hcd;
- 	struct admhcd		*ahcd;
- 	struct admhcd_regs __iomem *regs;
-@@ -622,9 +613,8 @@ static ssize_t fill_registers_buffer(str
- 	char			*next;
- 	u32			rdata;
- 
--	bus = dev_get_drvdata(buf->dev);
--	hcd = bus_to_hcd(bus);
--	ahcd = hcd_to_admhcd(hcd);
-+	ahcd = buf->ahcd;
-+	hcd = admhcd_to_hcd(ahcd);
- 	regs = ahcd->regs;
- 	next = buf->page;
- 	size = PAGE_SIZE;
-@@ -689,7 +679,7 @@ done:
- }
- 
- 
--static struct debug_buffer *alloc_buffer(struct device *dev,
-+static struct debug_buffer *alloc_buffer(struct admhcd *ahcd,
- 				ssize_t (*fill_func)(struct debug_buffer *))
- {
- 	struct debug_buffer *buf;
-@@ -697,7 +687,7 @@ static struct debug_buffer *alloc_buffer
- 	buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
- 
- 	if (buf) {
--		buf->dev = dev;
-+		buf->ahcd = ahcd;
- 		buf->fill_func = fill_func;
- 		mutex_init(&buf->mutex);
- 	}
-@@ -790,26 +780,25 @@ static int debug_registers_open(struct i
- static inline void create_debug_files(struct admhcd *ahcd)
- {
- 	struct usb_bus *bus = &admhcd_to_hcd(ahcd)->self;
--	struct device *dev = bus->dev;
- 
- 	ahcd->debug_dir = debugfs_create_dir(bus->bus_name, admhc_debug_root);
- 	if (!ahcd->debug_dir)
- 		goto dir_error;
- 
- 	ahcd->debug_async = debugfs_create_file("async", S_IRUGO,
--						ahcd->debug_dir, dev,
-+						ahcd->debug_dir, ahcd,
- 						&debug_async_fops);
- 	if (!ahcd->debug_async)
- 		goto async_error;
- 
- 	ahcd->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
--						ahcd->debug_dir, dev,
-+						ahcd->debug_dir, ahcd,
- 						&debug_periodic_fops);
- 	if (!ahcd->debug_periodic)
- 		goto periodic_error;
- 
- 	ahcd->debug_registers = debugfs_create_file("registers", S_IRUGO,
--						ahcd->debug_dir, dev,
-+						ahcd->debug_dir, ahcd,
- 						&debug_registers_fops);
- 	if (!ahcd->debug_registers)
- 		goto registers_error;

+ 0 - 252
target/linux/adm5120/router_be/config-2.6.33

@@ -1,252 +0,0 @@
-CONFIG_32BIT=y
-# CONFIG_64BIT is not set
-CONFIG_ADM5120=y
-CONFIG_ADM5120_ENET=y
-CONFIG_ADM5120_MACH_5GXI=y
-CONFIG_ADM5120_MACH_P_334WT=y
-CONFIG_ADM5120_MACH_P_335=y
-# CONFIG_ADM5120_OEM_CELLVISION is not set
-# CONFIG_ADM5120_OEM_COMPEX is not set
-# CONFIG_ADM5120_OEM_EDIMAX is not set
-# CONFIG_ADM5120_OEM_INFINEON is not set
-# CONFIG_ADM5120_OEM_MIKROTIK is not set
-# CONFIG_ADM5120_OEM_MOTOROLA is not set
-CONFIG_ADM5120_OEM_OSBRIDGE=y
-CONFIG_ADM5120_OEM_ZYXEL=y
-CONFIG_ADM5120_SOC_BGA=y
-CONFIG_ADM5120_WDT=y
-# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
-# CONFIG_AR7 is not set
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_POPULATES_NODE_MAP=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SUPPORTS_MSI is not set
-CONFIG_ARCH_SUPPORTS_OPROFILE=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARM_AMBA=y
-# CONFIG_BCM47XX is not set
-# CONFIG_BCM63XX is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_BITREVERSE=y
-# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
-# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CEVT_R4K=y
-CONFIG_CEVT_R4K_LIB=y
-CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2"
-CONFIG_CMDLINE_BOOL=y
-# CONFIG_CMDLINE_OVERRIDE is not set
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_CAVIUM_OCTEON is not set
-CONFIG_CPU_HAS_PREFETCH=y
-CONFIG_CPU_HAS_SYNC=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-# CONFIG_CPU_LOONGSON2E is not set
-# CONFIG_CPU_LOONGSON2F is not set
-CONFIG_CPU_MIPS32=y
-CONFIG_CPU_MIPS32_R1=y
-# CONFIG_CPU_MIPS32_R2 is not set
-# CONFIG_CPU_MIPS64_R1 is not set
-# CONFIG_CPU_MIPS64_R2 is not set
-CONFIG_CPU_MIPSR1=y
-# CONFIG_CPU_NEVADA is not set
-# CONFIG_CPU_R10000 is not set
-# CONFIG_CPU_R3000 is not set
-# CONFIG_CPU_R4300 is not set
-# CONFIG_CPU_R4X00 is not set
-# CONFIG_CPU_R5000 is not set
-# CONFIG_CPU_R5432 is not set
-# CONFIG_CPU_R5500 is not set
-# CONFIG_CPU_R6000 is not set
-# CONFIG_CPU_R8000 is not set
-# CONFIG_CPU_RM7000 is not set
-# CONFIG_CPU_RM9000 is not set
-# CONFIG_CPU_SB1 is not set
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-# CONFIG_CPU_TX39XX is not set
-# CONFIG_CPU_TX49XX is not set
-# CONFIG_CPU_VR41XX is not set
-CONFIG_CSRC_R4K=y
-CONFIG_CSRC_R4K_LIB=y
-CONFIG_DECOMPRESS_LZMA=y
-# CONFIG_DEFAULT_SECURITY_SELINUX is not set
-# CONFIG_DEFAULT_SECURITY_SMACK is not set
-# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
-CONFIG_DEVPORT=y
-# CONFIG_DM9000 is not set
-CONFIG_DMA_NEED_PCI_MAP_STATE=y
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_ELF_CORE=y
-CONFIG_FIRMWARE_IN_KERNEL=y
-CONFIG_FS_POSIX_ACL=y
-CONFIG_GENERIC_ACL=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_FIND_LAST_BIT=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_GPIO=y
-CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
-CONFIG_GPIOLIB=y
-# CONFIG_GPIO_PL061 is not set
-CONFIG_GPIO_SYSFS=y
-# CONFIG_HAMRADIO is not set
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HID=m
-CONFIG_HID_SUPPORT=y
-CONFIG_HW_HAS_PCI=y
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_IMAGE_CMDLINE_HACK=y
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_INLINE_READ_LOCK is not set
-# CONFIG_INLINE_READ_LOCK_BH is not set
-# CONFIG_INLINE_READ_LOCK_IRQ is not set
-# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_READ_TRYLOCK is not set
-CONFIG_INLINE_READ_UNLOCK=y
-# CONFIG_INLINE_READ_UNLOCK_BH is not set
-CONFIG_INLINE_READ_UNLOCK_IRQ=y
-# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
-# CONFIG_INLINE_SPIN_LOCK is not set
-# CONFIG_INLINE_SPIN_LOCK_BH is not set
-# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
-# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_SPIN_TRYLOCK is not set
-# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
-# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
-CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
-# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
-# CONFIG_INLINE_WRITE_LOCK is not set
-# CONFIG_INLINE_WRITE_LOCK_BH is not set
-# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
-# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_WRITE_TRYLOCK is not set
-CONFIG_INLINE_WRITE_UNLOCK=y
-# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
-CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
-# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-CONFIG_INPUT=m
-# CONFIG_INPUT_GPIO_BUTTONS is not set
-# CONFIG_INPUT_YEALINK is not set
-CONFIG_IRQ_CPU=y
-CONFIG_LEDS_GPIO=m
-CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-CONFIG_LOONGSON_UART_BASE=y
-# CONFIG_MACH_ALCHEMY is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MACH_LOONGSON is not set
-# CONFIG_MACH_TX39XX is not set
-# CONFIG_MACH_TX49XX is not set
-# CONFIG_MACH_VR41XX is not set
-CONFIG_MII=m
-# CONFIG_MIKROTIK_RB532 is not set
-CONFIG_MIPS=y
-# CONFIG_MIPS_COBALT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-CONFIG_MIPS_MACHINE=y
-# CONFIG_MIPS_MALTA is not set
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMP is not set
-# CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_SIM is not set
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MTD_ADM5120=y
-CONFIG_MTD_BLOCK2MTD=y
-CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_TRXSPLIT=y
-# CONFIG_MUTEX_SPIN_ON_OWNER is not set
-# CONFIG_NET_PCI is not set
-CONFIG_NLS=m
-CONFIG_NO_HZ=y
-# CONFIG_NO_IOPORT is not set
-# CONFIG_NXP_STB220 is not set
-# CONFIG_NXP_STB225 is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_PCI=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-# CONFIG_PMC_MSP is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-# CONFIG_POWERTV is not set
-CONFIG_SCHED_OMIT_FRAME_POINTER=y
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250 is not set
-CONFIG_SERIAL_AMBA_PL010=y
-CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
-CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2
-CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS"
-# CONFIG_SERIAL_AMBA_PL011 is not set
-CONFIG_SERIO=y
-# CONFIG_SERIO_ALTERA_PS2 is not set
-# CONFIG_SERIO_AMBAKMI is not set
-# CONFIG_SERIO_I8042 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_RAW is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP28 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_SWARM is not set
-CONFIG_SOFT_WATCHDOG=m
-# CONFIG_SWAP is not set
-CONFIG_SWAP_IO_SPACE=y
-CONFIG_SYS_HAS_CPU_MIPS32_R1=y
-CONFIG_SYS_HAS_EARLY_PRINTK=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_TMPFS_POSIX_ACL=y
-CONFIG_TRAD_SIGNALS=y
-# CONFIG_TREE_PREEMPT_RCU is not set
-CONFIG_USB=m
-CONFIG_USB_ADM5120_HCD=m
-CONFIG_USB_DEBUG=y
-CONFIG_USB_EHCI_HCD=m
-# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
-# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_SUPPORT=y
-# CONFIG_USB_UHCI_HCD is not set
-CONFIG_ZONE_DMA_FLAG=0

+ 0 - 304
target/linux/adm5120/router_le/config-2.6.33

@@ -1,304 +0,0 @@
-CONFIG_32BIT=y
-# CONFIG_64BIT is not set
-CONFIG_ADM5120=y
-CONFIG_ADM5120_ENET=y
-CONFIG_ADM5120_MACH_5GXI=y
-CONFIG_ADM5120_MACH_BR_6104K=y
-CONFIG_ADM5120_MACH_BR_6104KP=y
-CONFIG_ADM5120_MACH_BR_61X4WG=y
-CONFIG_ADM5120_MACH_CAS_771=y
-CONFIG_ADM5120_MACH_EASY5120P_ATA=y
-CONFIG_ADM5120_MACH_EASY5120_RT=y
-CONFIG_ADM5120_MACH_EASY5120_WVOIP=y
-CONFIG_ADM5120_MACH_EASY83000=y
-CONFIG_ADM5120_MACH_EB_214A=y
-CONFIG_ADM5120_MACH_NFS_101=y
-CONFIG_ADM5120_MACH_NP27G=y
-CONFIG_ADM5120_MACH_NP28G=y
-CONFIG_ADM5120_MACH_PMUGW=y
-CONFIG_ADM5120_MACH_RB_11X=y
-CONFIG_ADM5120_MACH_RB_133=y
-CONFIG_ADM5120_MACH_RB_133C=y
-CONFIG_ADM5120_MACH_RB_150=y
-CONFIG_ADM5120_MACH_RB_153=y
-CONFIG_ADM5120_MACH_RB_192=y
-CONFIG_ADM5120_MACH_WP54=y
-CONFIG_ADM5120_OEM_CELLVISION=y
-CONFIG_ADM5120_OEM_COMPEX=y
-CONFIG_ADM5120_OEM_EDIMAX=y
-CONFIG_ADM5120_OEM_GENERIC=y
-CONFIG_ADM5120_OEM_INFINEON=y
-CONFIG_ADM5120_OEM_MIKROTIK=y
-CONFIG_ADM5120_OEM_MOTOROLA=y
-CONFIG_ADM5120_OEM_OSBRIDGE=y
-# CONFIG_ADM5120_OEM_ZYXEL is not set
-CONFIG_ADM5120_SOC_BGA=y
-CONFIG_ADM5120_WDT=y
-# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
-# CONFIG_AR7 is not set
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_POPULATES_NODE_MAP=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SUPPORTS_MSI is not set
-CONFIG_ARCH_SUPPORTS_OPROFILE=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARM_AMBA=y
-CONFIG_ATA=m
-# CONFIG_BCM47XX is not set
-# CONFIG_BCM63XX is not set
-CONFIG_BITREVERSE=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
-# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CEVT_R4K=y
-CONFIG_CEVT_R4K_LIB=y
-CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,yaffs2,jffs2"
-CONFIG_CMDLINE_BOOL=y
-# CONFIG_CMDLINE_OVERRIDE is not set
-# CONFIG_CPU_BIG_ENDIAN is not set
-# CONFIG_CPU_CAVIUM_OCTEON is not set
-CONFIG_CPU_HAS_PREFETCH=y
-CONFIG_CPU_HAS_SYNC=y
-CONFIG_CPU_LITTLE_ENDIAN=y
-# CONFIG_CPU_LOONGSON2E is not set
-# CONFIG_CPU_LOONGSON2F is not set
-CONFIG_CPU_MIPS32=y
-CONFIG_CPU_MIPS32_R1=y
-# CONFIG_CPU_MIPS32_R2 is not set
-# CONFIG_CPU_MIPS64_R1 is not set
-# CONFIG_CPU_MIPS64_R2 is not set
-CONFIG_CPU_MIPSR1=y
-# CONFIG_CPU_NEVADA is not set
-# CONFIG_CPU_R10000 is not set
-# CONFIG_CPU_R3000 is not set
-# CONFIG_CPU_R4300 is not set
-# CONFIG_CPU_R4X00 is not set
-# CONFIG_CPU_R5000 is not set
-# CONFIG_CPU_R5432 is not set
-# CONFIG_CPU_R5500 is not set
-# CONFIG_CPU_R6000 is not set
-# CONFIG_CPU_R8000 is not set
-# CONFIG_CPU_RM7000 is not set
-# CONFIG_CPU_RM9000 is not set
-# CONFIG_CPU_SB1 is not set
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-# CONFIG_CPU_TX39XX is not set
-# CONFIG_CPU_TX49XX is not set
-# CONFIG_CPU_VR41XX is not set
-CONFIG_CRYPTO_AEAD2=y
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_ARC4=m
-CONFIG_CRYPTO_BLKCIPHER=m
-CONFIG_CRYPTO_BLKCIPHER2=y
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_HASH=m
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_MANAGER=m
-CONFIG_CRYPTO_MANAGER2=y
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_CSRC_R4K=y
-CONFIG_CSRC_R4K_LIB=y
-# CONFIG_DEBUG_FS is not set
-CONFIG_DECOMPRESS_LZMA=y
-# CONFIG_DEFAULT_SECURITY_SELINUX is not set
-# CONFIG_DEFAULT_SECURITY_SMACK is not set
-# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
-CONFIG_DEVPORT=y
-# CONFIG_DM9000 is not set
-CONFIG_DMA_NEED_PCI_MAP_STATE=y
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_FIRMWARE_IN_KERNEL=y
-CONFIG_FS_POSIX_ACL=y
-CONFIG_GENERIC_ACL=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_FIND_LAST_BIT=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_GPIO=y
-CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
-CONFIG_GPIOLIB=y
-# CONFIG_GPIO_PL061 is not set
-CONFIG_GPIO_SYSFS=y
-# CONFIG_HAMRADIO is not set
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HID=m
-CONFIG_HID_SUPPORT=y
-CONFIG_HOSTAP=m
-CONFIG_HOSTAP_FIRMWARE=y
-# CONFIG_HOSTAP_FIRMWARE_NVRAM is not set
-CONFIG_HOSTAP_PCI=m
-CONFIG_HW_HAS_PCI=y
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_IMAGE_CMDLINE_HACK=y
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_INLINE_READ_LOCK is not set
-# CONFIG_INLINE_READ_LOCK_BH is not set
-# CONFIG_INLINE_READ_LOCK_IRQ is not set
-# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_READ_TRYLOCK is not set
-CONFIG_INLINE_READ_UNLOCK=y
-# CONFIG_INLINE_READ_UNLOCK_BH is not set
-CONFIG_INLINE_READ_UNLOCK_IRQ=y
-# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
-# CONFIG_INLINE_SPIN_LOCK is not set
-# CONFIG_INLINE_SPIN_LOCK_BH is not set
-# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
-# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_SPIN_TRYLOCK is not set
-# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
-# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
-CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
-# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
-# CONFIG_INLINE_WRITE_LOCK is not set
-# CONFIG_INLINE_WRITE_LOCK_BH is not set
-# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
-# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_WRITE_TRYLOCK is not set
-CONFIG_INLINE_WRITE_UNLOCK=y
-# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
-CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
-# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-CONFIG_INPUT=m
-# CONFIG_INPUT_GPIO_BUTTONS is not set
-# CONFIG_INPUT_YEALINK is not set
-CONFIG_IRQ_CPU=y
-CONFIG_LEDS_GPIO=m
-CONFIG_LEDS_TRIGGER_ADM5120_SWITCH=m
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-CONFIG_LIB80211=m
-CONFIG_LIB80211_CRYPT_CCMP=m
-CONFIG_LIB80211_CRYPT_TKIP=m
-CONFIG_LIB80211_CRYPT_WEP=m
-CONFIG_LOONGSON_UART_BASE=y
-# CONFIG_MACH_ALCHEMY is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MACH_LOONGSON is not set
-# CONFIG_MACH_TX39XX is not set
-# CONFIG_MACH_TX49XX is not set
-# CONFIG_MACH_VR41XX is not set
-CONFIG_MII=m
-# CONFIG_MIKROTIK_RB532 is not set
-CONFIG_MIPS=y
-# CONFIG_MIPS_COBALT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-CONFIG_MIPS_MACHINE=y
-# CONFIG_MIPS_MALTA is not set
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMP is not set
-# CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_SIM is not set
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MTD_ADM5120=y
-CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_JEDECPROBE=y
-CONFIG_MTD_MYLOADER_PARTS=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_PLATFORM=y
-CONFIG_MTD_TRXSPLIT=y
-# CONFIG_MUTEX_SPIN_ON_OWNER is not set
-CONFIG_NLS=m
-CONFIG_NO_HZ=y
-# CONFIG_NO_IOPORT is not set
-# CONFIG_NXP_STB220 is not set
-# CONFIG_NXP_STB225 is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_PATA_RB153_CF=m
-CONFIG_PCI=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-# CONFIG_PMC_MSP is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-# CONFIG_POWERTV is not set
-CONFIG_SCHED_OMIT_FRAME_POINTER=y
-CONFIG_SCSI=m
-# CONFIG_SERIAL_8250 is not set
-CONFIG_SERIAL_AMBA_PL010=y
-CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
-CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2
-CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS"
-# CONFIG_SERIAL_AMBA_PL011 is not set
-CONFIG_SERIO=y
-# CONFIG_SERIO_ALTERA_PS2 is not set
-# CONFIG_SERIO_AMBAKMI is not set
-# CONFIG_SERIO_I8042 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_RAW is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP28 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_SWARM is not set
-CONFIG_SOFT_WATCHDOG=m
-# CONFIG_SWAP is not set
-CONFIG_SYS_HAS_CPU_MIPS32_R1=y
-CONFIG_SYS_HAS_EARLY_PRINTK=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-# CONFIG_TC35815 is not set
-CONFIG_TMPFS_POSIX_ACL=y
-CONFIG_TRAD_SIGNALS=y
-# CONFIG_TREE_PREEMPT_RCU is not set
-CONFIG_USB=m
-CONFIG_USB_ADM5120_HCD=m
-CONFIG_USB_EHCI_HCD=m
-# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
-# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_SUPPORT=y
-# CONFIG_USB_UHCI_HCD is not set
-CONFIG_YAFFS_9BYTE_TAGS=y
-# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
-CONFIG_YAFFS_AUTO_YAFFS2=y
-# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
-# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
-CONFIG_YAFFS_FS=y
-CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
-CONFIG_YAFFS_YAFFS1=y
-CONFIG_YAFFS_YAFFS2=y
-CONFIG_ZONE_DMA_FLAG=0

+ 0 - 168
target/linux/atheros/config-2.6.33

@@ -1,168 +0,0 @@
-CONFIG_32BIT=y
-# CONFIG_64BIT is not set
-# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
-CONFIG_AR231X_ETHERNET=y
-# CONFIG_AR7 is not set
-CONFIG_AR8216_PHY=y
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_POPULATES_NODE_MAP=y
-# CONFIG_ARCH_SUPPORTS_MSI is not set
-CONFIG_ARCH_SUPPORTS_OPROFILE=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ATHEROS_AR2315=y
-CONFIG_ATHEROS_AR2315_PCI=y
-CONFIG_ATHEROS_AR231X=y
-CONFIG_ATHEROS_AR5312=y
-CONFIG_ATHEROS_WDT=y
-# CONFIG_BCM47XX is not set
-# CONFIG_BCM63XX is not set
-CONFIG_BITREVERSE=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
-# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CEVT_R4K=y
-CONFIG_CEVT_R4K_LIB=y
-CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2"
-CONFIG_CMDLINE_BOOL=y
-# CONFIG_CMDLINE_OVERRIDE is not set
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_CAVIUM_OCTEON is not set
-CONFIG_CPU_HAS_PREFETCH=y
-CONFIG_CPU_HAS_SYNC=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-# CONFIG_CPU_LOONGSON2E is not set
-# CONFIG_CPU_LOONGSON2F is not set
-CONFIG_CPU_MIPS32=y
-CONFIG_CPU_MIPS32_R1=y
-# CONFIG_CPU_MIPS32_R2 is not set
-# CONFIG_CPU_MIPS64_R1 is not set
-# CONFIG_CPU_MIPS64_R2 is not set
-CONFIG_CPU_MIPSR1=y
-# CONFIG_CPU_NEVADA is not set
-# CONFIG_CPU_R10000 is not set
-# CONFIG_CPU_R3000 is not set
-# CONFIG_CPU_R4300 is not set
-# CONFIG_CPU_R4X00 is not set
-# CONFIG_CPU_R5000 is not set
-# CONFIG_CPU_R5432 is not set
-# CONFIG_CPU_R5500 is not set
-# CONFIG_CPU_R6000 is not set
-# CONFIG_CPU_R8000 is not set
-# CONFIG_CPU_RM7000 is not set
-# CONFIG_CPU_RM9000 is not set
-# CONFIG_CPU_SB1 is not set
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-# CONFIG_CPU_TX39XX is not set
-# CONFIG_CPU_TX49XX is not set
-# CONFIG_CPU_VR41XX is not set
-CONFIG_CSRC_R4K=y
-CONFIG_CSRC_R4K_LIB=y
-CONFIG_DECOMPRESS_LZMA=y
-CONFIG_DEVPORT=y
-# CONFIG_DM9000 is not set
-CONFIG_DMA_NEED_PCI_MAP_STATE=y
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_EARLY_PRINTK=y
-# CONFIG_FSNOTIFY is not set
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_FIND_LAST_BIT=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_GPIO=y
-CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
-CONFIG_GPIO_DEVICE=y
-# CONFIG_HAMRADIO is not set
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HW_HAS_PCI=y
-CONFIG_HW_RANDOM=y
-CONFIG_IMAGE_CMDLINE_HACK=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IP17XX_PHY=y
-CONFIG_IRQ_CPU=y
-# CONFIG_LEDS_GPIO is not set
-CONFIG_LOONGSON_UART_BASE=y
-# CONFIG_MACH_ALCHEMY is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MACH_LOONGSON is not set
-# CONFIG_MACH_TX39XX is not set
-# CONFIG_MACH_TX49XX is not set
-# CONFIG_MACH_VR41XX is not set
-# CONFIG_MIKROTIK_RB532 is not set
-CONFIG_MIPS=y
-# CONFIG_MIPS_COBALT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_MIPS_MACHINE is not set
-# CONFIG_MIPS_MALTA is not set
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMP is not set
-# CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_SIM is not set
-CONFIG_MTD_AR2315=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_MYLOADER_PARTS=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
-CONFIG_MTD_REDBOOT_PARTS=y
-CONFIG_MVSWITCH_PHY=y
-# CONFIG_NET_PCI is not set
-# CONFIG_NO_IOPORT is not set
-# CONFIG_NXP_STB220 is not set
-# CONFIG_NXP_STB225 is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PCI=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PHYLIB=y
-# CONFIG_PMC_MSP is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-# CONFIG_POWERTV is not set
-CONFIG_SCHED_OMIT_FRAME_POINTER=y
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250_EXTENDED is not set
-CONFIG_SERIAL_8250_NR_UARTS=1
-CONFIG_SERIAL_8250_RUNTIME_UARTS=1
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP28 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SWAP is not set
-CONFIG_SWCONFIG=y
-CONFIG_SYS_HAS_CPU_MIPS32_R1=y
-CONFIG_SYS_HAS_EARLY_PRINTK=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_TRAD_SIGNALS=y
-# CONFIG_TREE_PREEMPT_RCU is not set
-CONFIG_USB_SUPPORT=y
-CONFIG_ZONE_DMA_FLAG=0

+ 0 - 39
target/linux/atheros/patches-2.6.33/001-get_c0_compare_int_fix.patch

@@ -1,39 +0,0 @@
-Fix the usage of get_c0_compare_int: override cp0_compare_irq if the returned
-value is in the MIPS CPU IRQ range to ensure that c0_compare_int_usable()
-still works.
-
-Signed-off-by: Felix Fietkau <[email protected]>
-
---- a/arch/mips/kernel/cevt-r4k.c
-+++ b/arch/mips/kernel/cevt-r4k.c
-@@ -168,20 +168,23 @@ int __cpuinit r4k_clockevent_init(void)
- 	struct clock_event_device *cd;
- 	unsigned int irq;
- 
--	if (!cpu_has_counter || !mips_hpt_frequency)
--		return -ENXIO;
--
--	if (!c0_compare_int_usable())
--		return -ENXIO;
--
- 	/*
- 	 * With vectored interrupts things are getting platform specific.
- 	 * get_c0_compare_int is a hook to allow a platform to return the
- 	 * interrupt number of it's liking.
- 	 */
- 	irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
--	if (get_c0_compare_int)
-+	if (get_c0_compare_int) {
- 		irq = get_c0_compare_int();
-+		if ((irq >= MIPS_CPU_IRQ_BASE) && (irq < MIPS_CPU_IRQ_BASE + 8))
-+			cp0_compare_irq = irq - MIPS_CPU_IRQ_BASE;
-+	}
-+
-+	if (!cpu_has_counter || !mips_hpt_frequency)
-+		return -ENXIO;
-+
-+	if (!c0_compare_int_usable())
-+		return -ENXIO;
- 
- 	cd = &per_cpu(mips_clockevent_device, cpu);
- 

+ 0 - 3126
target/linux/atheros/patches-2.6.33/100-board.patch

@@ -1,3126 +0,0 @@
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -84,6 +84,19 @@ config BCM63XX
- 	help
- 	 Support for BCM63XX based boards
- 
-+config ATHEROS_AR231X
-+	bool "Atheros 231x/531x SoC support"
-+	select CEVT_R4K
-+	select CSRC_R4K
-+	select DMA_NONCOHERENT
-+	select IRQ_CPU
-+	select SYS_HAS_CPU_MIPS32_R1
-+	select SYS_SUPPORTS_BIG_ENDIAN
-+	select SYS_SUPPORTS_32BIT_KERNEL
-+	select GENERIC_GPIO
-+	help
-+	  Support for AR231x and AR531x based boards
-+
- config MIPS_COBALT
- 	bool "Cobalt Server"
- 	select CEVT_R4K
-@@ -681,6 +694,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
- 
- endchoice
- 
-+source "arch/mips/ar231x/Kconfig"
- source "arch/mips/alchemy/Kconfig"
- source "arch/mips/bcm63xx/Kconfig"
- source "arch/mips/jazz/Kconfig"
---- a/arch/mips/Makefile
-+++ b/arch/mips/Makefile
-@@ -310,6 +310,13 @@ cflags-$(CONFIG_SOC_AU1X00)	+= -I$(srctr
- 
- 
- #
-+# Atheros AR5312/AR2312 WiSoC
-+#
-+core-$(CONFIG_ATHEROS_AR231X)		+= arch/mips/ar231x/
-+cflags-$(CONFIG_ATHEROS_AR231X)	+= -I$(srctree)/arch/mips/include/asm/mach-ar231x
-+load-$(CONFIG_ATHEROS_AR231X)		+= 0xffffffff80041000
-+
-+#
- # Cobalt Server
- #
- core-$(CONFIG_MIPS_COBALT)	+= arch/mips/cobalt/
---- /dev/null
-+++ b/arch/mips/ar231x/Kconfig
-@@ -0,0 +1,17 @@
-+config ATHEROS_AR5312
-+	bool "Atheros 5312/2312+ support"
-+	depends on ATHEROS_AR231X
-+	default y
-+
-+config ATHEROS_AR2315
-+	bool "Atheros 2315+ support"
-+	depends on ATHEROS_AR231X
-+	select DMA_NONCOHERENT
-+	select CEVT_R4K
-+	select CSRC_R4K
-+	select IRQ_CPU
-+	select SYS_HAS_CPU_MIPS32_R1
-+	select SYS_SUPPORTS_32BIT_KERNEL
-+	select SYS_SUPPORTS_BIG_ENDIAN
-+	select GENERIC_GPIO
-+	default y
---- /dev/null
-+++ b/arch/mips/ar231x/Makefile
-@@ -0,0 +1,13 @@
-+#
-+# 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 FON Technology, SL.
-+# Copyright (C) 2006 Imre Kaloz <[email protected]>
-+# Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+#
-+
-+obj-y += board.o prom.o devices.o
-+obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
-+obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
---- /dev/null
-+++ b/arch/mips/ar231x/board.c
-@@ -0,0 +1,251 @@
-+/*
-+ * 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 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+ */
-+
-+#include <generated/autoconf.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/string.h>
-+#include <linux/platform_device.h>
-+#include <linux/kernel.h>
-+#include <linux/random.h>
-+#include <linux/etherdevice.h>
-+#include <asm/irq_cpu.h>
-+#include <asm/reboot.h>
-+#include <asm/io.h>
-+
-+#include <ar231x_platform.h>
-+#include "devices.h"
-+#include "ar5312.h"
-+#include "ar2315.h"
-+
-+void (*ar231x_irq_dispatch)(void);
-+
-+static inline bool
-+check_radio_magic(u8 *addr)
-+{
-+	addr += 0x7a; /* offset for flash magic */
-+	if ((addr[0] == 0x5a) && (addr[1] == 0xa5)) {
-+		return 1;
-+	}
-+	return 0;
-+}
-+
-+static inline bool
-+check_board_data(u8 *flash_limit, u8 *addr, bool broken)
-+{
-+	/* config magic found */
-+	if (*((u32 *)addr) == AR531X_BD_MAGIC)
-+		return 1;
-+
-+	if (!broken)
-+		return 0;
-+
-+	if (check_radio_magic(addr + 0xf8))
-+		ar231x_board.radio = addr + 0xf8;
-+	if ((addr < flash_limit + 0x10000) &&
-+	     check_radio_magic(addr + 0x10000))
-+		ar231x_board.radio = addr + 0x10000;
-+
-+	if (ar231x_board.radio) {
-+		/* broken board data detected, use radio data to find the offset,
-+		 * user will fix this */
-+		return 1;
-+	}
-+	return 0;
-+}
-+
-+static u8 *
-+find_board_config(u8 *flash_limit, bool broken)
-+{
-+	u8 *addr;
-+	int found = 0;
-+
-+	for (addr = flash_limit - 0x1000;
-+		addr >= flash_limit - 0x30000;
-+		addr -= 0x1000) {
-+
-+		if (check_board_data(flash_limit, addr, broken)) {
-+			found = 1;
-+			break;
-+		}
-+	}
-+
-+	if (!found)
-+		addr = NULL;
-+
-+	return addr;
-+}
-+
-+static u8 *
-+find_radio_config(u8 *flash_limit, u8 *board_config)
-+{
-+	int found;
-+	u8 *radio_config;
-+
-+	/*
-+	 * Now find the start of Radio Configuration data, using heuristics:
-+	 * Search forward from Board Configuration data by 0x1000 bytes
-+	 * at a time until we find non-0xffffffff.
-+	 */
-+	found = 0;
-+	for (radio_config = board_config + 0x1000;
-+	     (radio_config < flash_limit);
-+	     radio_config += 0x1000) {
-+		if ((*(u32 *)radio_config != 0xffffffff) &&
-+		    check_radio_magic(radio_config)) {
-+			found = 1;
-+			break;
-+		}
-+	}
-+
-+	/* AR2316 relocates radio config to new location */
-+	if (!found) {
-+	    for (radio_config = board_config + 0xf8;
-+			(radio_config < flash_limit - 0x1000 + 0xf8);
-+			 radio_config += 0x1000) {
-+			if ((*(u32 *)radio_config != 0xffffffff) &&
-+				check_radio_magic(radio_config)) {
-+				found = 1;
-+				break;
-+			}
-+	    }
-+	}
-+
-+	if (!found) {
-+		printk("Could not find Radio Configuration data\n");
-+		radio_config = 0;
-+	}
-+
-+	return (u8 *) radio_config;
-+}
-+
-+int __init
-+ar231x_find_config(u8 *flash_limit)
-+{
-+	struct ar231x_boarddata *config;
-+	unsigned int rcfg_size;
-+	int broken_boarddata = 0;
-+	u8 *bcfg, *rcfg;
-+	u8 *board_data;
-+	u8 *radio_data;
-+	u32 offset;
-+
-+	ar231x_board.config = NULL;
-+	ar231x_board.radio = NULL;
-+	/* Copy the board and radio data to RAM, because accessing the mapped
-+	 * memory of the flash directly after booting is not safe */
-+
-+	/* Try to find valid board and radio data */
-+	bcfg = find_board_config(flash_limit, false);
-+
-+	/* If that fails, try to at least find valid radio data */
-+	if (!bcfg) {
-+		bcfg = find_board_config(flash_limit, true);
-+		broken_boarddata = 1;
-+	}
-+
-+	if (!bcfg) {
-+		printk(KERN_WARNING "WARNING: No board configuration data found!\n");
-+		return -ENODEV;
-+	}
-+
-+	board_data = kzalloc(BOARD_CONFIG_BUFSZ, GFP_KERNEL);
-+	ar231x_board.config = (struct ar231x_boarddata *) board_data;
-+	memcpy(board_data, bcfg, 0x100);
-+	if (broken_boarddata) {
-+		printk(KERN_WARNING "WARNING: broken board data detected\n");
-+		config = ar231x_board.config;
-+		if (!memcmp(config->enet0_mac, "\x00\x00\x00\x00\x00\x00", 6)) {
-+			printk(KERN_INFO "Fixing up empty mac addresses\n");
-+			config->resetConfigGpio = 0xffff;
-+			config->sysLedGpio = 0xffff;
-+			random_ether_addr(config->wlan0_mac);
-+			config->wlan0_mac[0] &= ~0x06;
-+			random_ether_addr(config->enet0_mac);
-+			random_ether_addr(config->enet1_mac);
-+		}
-+	}
-+
-+
-+	/* Radio config starts 0x100 bytes after board config, regardless
-+	 * of what the physical layout on the flash chip looks like */
-+
-+	if (ar231x_board.radio)
-+		rcfg = (u8 *) ar231x_board.radio;
-+	else
-+		rcfg = find_radio_config(flash_limit, bcfg);
-+
-+	if (!rcfg)
-+		return -ENODEV;
-+
-+	radio_data = board_data + 0x100 + ((rcfg - bcfg) & 0xfff);
-+	ar231x_board.radio = radio_data;
-+	offset = radio_data - board_data;
-+	printk(KERN_INFO "Radio config found at offset 0x%x(0x%x)\n", rcfg - bcfg, offset);
-+	rcfg_size = BOARD_CONFIG_BUFSZ - offset;
-+	memcpy(radio_data, rcfg, rcfg_size);
-+
-+	return 0;
-+}
-+
-+static void
-+ar231x_halt(void)
-+{
-+	local_irq_disable();
-+	while (1);
-+}
-+
-+void __init
-+plat_mem_setup(void)
-+{
-+	_machine_halt = ar231x_halt;
-+	pm_power_off = ar231x_halt;
-+
-+	ar5312_plat_setup();
-+	ar2315_plat_setup();
-+
-+	/* Disable data watchpoints */
-+	write_c0_watchlo0(0);
-+}
-+
-+
-+asmlinkage void
-+plat_irq_dispatch(void)
-+{
-+	ar231x_irq_dispatch();
-+}
-+
-+void __init
-+plat_time_init(void)
-+{
-+	ar5312_time_init();
-+	ar2315_time_init();
-+}
-+
-+unsigned int __cpuinit
-+get_c0_compare_int(void)
-+{
-+	return CP0_LEGACY_COMPARE_IRQ;
-+}
-+
-+void __init
-+arch_init_irq(void)
-+{
-+	clear_c0_status(ST0_IM);
-+	mips_cpu_irq_init();
-+
-+	/* Initialize interrupt controllers */
-+	ar5312_irq_init();
-+	ar2315_irq_init();
-+}
-+
-+
---- /dev/null
-+++ b/arch/mips/ar231x/prom.c
-@@ -0,0 +1,37 @@
-+/*
-+ * 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 MontaVista Software Inc
-+ * Copyright (C) 2003 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006 Felix Fietkau <[email protected]>
-+ */
-+
-+/*
-+ * Prom setup file for ar531x
-+ */
-+
-+#include <linux/init.h>
-+#include <generated/autoconf.h>
-+#include <linux/kernel.h>
-+#include <linux/string.h>
-+#include <linux/mm.h>
-+#include <linux/bootmem.h>
-+
-+#include <asm/bootinfo.h>
-+#include <asm/addrspace.h>
-+#include "ar5312.h"
-+#include "ar2315.h"
-+
-+void __init prom_init(void)
-+{
-+	ar5312_prom_init();
-+	ar2315_prom_init();
-+}
-+
-+void __init prom_free_prom_memory(void)
-+{
-+}
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
-@@ -0,0 +1,83 @@
-+#ifndef __AR531X_PLATFORM_H
-+#define __AR531X_PLATFORM_H
-+
-+/*
-+ * This is board-specific data that is stored in a "fixed" location in flash.
-+ * It is shared across operating systems, so it should not be changed lightly.
-+ * The main reason we need it is in order to extract the ethernet MAC
-+ * address(es).
-+ */
-+struct ar231x_boarddata {
-+    u32 magic;                       /* board data is valid */
-+#define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
-+    u16 cksum;                       /* checksum (starting with BD_REV 2) */
-+    u16 rev;                         /* revision of this struct */
-+#define BD_REV  4
-+    char boardName[64];            /* Name of board */
-+    u16 major;                       /* Board major number */
-+    u16 minor;                       /* Board minor number */
-+    u32 flags;                      /* Board configuration */
-+#define BD_ENET0        0x00000001   /* ENET0 is stuffed */
-+#define BD_ENET1        0x00000002   /* ENET1 is stuffed */
-+#define BD_UART1        0x00000004   /* UART1 is stuffed */
-+#define BD_UART0        0x00000008   /* UART0 is stuffed (dma) */
-+#define BD_RSTFACTORY   0x00000010   /* Reset factory defaults stuffed */
-+#define BD_SYSLED       0x00000020   /* System LED stuffed */
-+#define BD_EXTUARTCLK   0x00000040   /* External UART clock */
-+#define BD_CPUFREQ      0x00000080   /* cpu freq is valid in nvram */
-+#define BD_SYSFREQ      0x00000100   /* sys freq is set in nvram */
-+#define BD_WLAN0        0x00000200   /* Enable WLAN0 */
-+#define BD_MEMCAP       0x00000400   /* CAP SDRAM @ memCap for testing */
-+#define BD_DISWATCHDOG  0x00000800   /* disable system watchdog */
-+#define BD_WLAN1        0x00001000   /* Enable WLAN1 (ar5212) */
-+#define BD_ISCASPER     0x00002000   /* FLAG for AR2312 */
-+#define BD_WLAN0_2G_EN  0x00004000   /* FLAG for radio0_2G */
-+#define BD_WLAN0_5G_EN  0x00008000   /* FLAG for radio0_2G */
-+#define BD_WLAN1_2G_EN  0x00020000   /* FLAG for radio0_2G */
-+#define BD_WLAN1_5G_EN  0x00040000   /* FLAG for radio0_2G */
-+    u16 resetConfigGpio;             /* Reset factory GPIO pin */
-+    u16 sysLedGpio;                  /* System LED GPIO pin */
-+
-+    u32 cpuFreq;                     /* CPU core frequency in Hz */
-+    u32 sysFreq;                     /* System frequency in Hz */
-+    u32 cntFreq;                     /* Calculated C0_COUNT frequency */
-+
-+    u8  wlan0_mac[6];
-+    u8  enet0_mac[6];
-+    u8  enet1_mac[6];
-+
-+    u16 pciId;                       /* Pseudo PCIID for common code */
-+    u16 memCap;                      /* cap bank1 in MB */
-+
-+    /* version 3 */
-+    u8  wlan1_mac[6];                 /* (ar5212) */
-+};
-+
-+#define BOARD_CONFIG_BUFSZ		0x1000
-+
-+/*
-+ * Platform device information for the Wireless MAC
-+ */
-+struct ar231x_board_config {
-+	u16 devid;
-+
-+	/* board config data */
-+	struct ar231x_boarddata *config;
-+
-+	/* radio calibration data */
-+	const char *radio;
-+};
-+
-+/*
-+ * Platform device information for the Ethernet MAC
-+ */
-+struct ar231x_eth {
-+	u32 reset_base;
-+	u32 reset_mac;
-+	u32 reset_phy;
-+	u32 phy_base;
-+	struct ar231x_board_config *config;
-+	char *macaddr;
-+};
-+
-+#endif /* __AR531X_PLATFORM_H */
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/cpu-feature-overrides.h
-@@ -0,0 +1,84 @@
-+/*
-+ *  Atheros SoC specific CPU feature overrides
-+ *
-+ *  Copyright (C) 2008 Gabor Juhos <[email protected]>
-+ *
-+ *  This file was derived from: include/asm-mips/cpu-features.h
-+ *	Copyright (C) 2003, 2004 Ralf Baechle
-+ *	Copyright (C) 2004 Maciej W. Rozycki
-+ *
-+ *  This program is free software; you can redistribute it and/or modify it
-+ *  under the terms of the GNU General Public License version 2 as published
-+ *  by the Free Software Foundation.
-+ *
-+ */
-+#ifndef __ASM_MACH_ATHEROS_CPU_FEATURE_OVERRIDES_H
-+#define __ASM_MACH_ATHEROS_CPU_FEATURE_OVERRIDES_H
-+
-+/*
-+ * The ATHEROS SoCs have MIPS 4Kc/4KEc core.
-+ */
-+#define cpu_has_tlb			1
-+#define cpu_has_4kex			1
-+#define cpu_has_3k_cache		0
-+#define cpu_has_4k_cache		1
-+#define cpu_has_tx39_cache		0
-+#define cpu_has_sb1_cache		0
-+#define cpu_has_fpu			0
-+#define cpu_has_32fpr			0
-+#define cpu_has_counter			1
-+/* #define cpu_has_watch		? */
-+/* #define cpu_has_divec		? */
-+/* #define cpu_has_vce			? */
-+/* #define cpu_has_cache_cdex_p		? */
-+/* #define cpu_has_cache_cdex_s		? */
-+/* #define cpu_has_prefetch		? */
-+/* #define cpu_has_mcheck		? */
-+#define cpu_has_ejtag			1
-+
-+#if !defined(CONFIG_ATHEROS_AR5312)
-+#  define cpu_has_llsc			1
-+#else
-+/*
-+ * The MIPS 4Kc V0.9 core in the AR5312/AR2312 have problems with the
-+ * ll/sc instructions.
-+ */
-+#  define cpu_has_llsc			0
-+#endif
-+
-+#define cpu_has_mips16			0
-+#define cpu_has_mdmx			0
-+#define cpu_has_mips3d			0
-+#define cpu_has_smartmips		0
-+
-+/* #define cpu_has_vtag_icache		? */
-+/* #define cpu_has_dc_aliases		? */
-+/* #define cpu_has_ic_fills_f_dc	? */
-+/* #define cpu_has_pindexed_dcache	? */
-+
-+/* #define cpu_icache_snoops_remote_store	? */
-+
-+#define cpu_has_mips32r1		1
-+
-+#if !defined(CONFIG_ATHEROS_AR5312)
-+#  define cpu_has_mips32r2		1
-+#endif
-+
-+#define cpu_has_mips64r1		0
-+#define cpu_has_mips64r2		0
-+
-+#define cpu_has_dsp			0
-+#define cpu_has_mipsmt			0
-+
-+/* #define cpu_has_nofpuex		? */
-+#define cpu_has_64bits			0
-+#define cpu_has_64bit_zero_reg		0
-+#define cpu_has_64bit_gp_regs		0
-+#define cpu_has_64bit_addresses		0
-+
-+/* #define cpu_has_inclusive_pcaches	? */
-+
-+/* #define cpu_dcache_line_size()	? */
-+/* #define cpu_icache_line_size()	? */
-+
-+#endif /* __ASM_MACH_ATHEROS_CPU_FEATURE_OVERRIDES_H */
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/dma-coherence.h
-@@ -0,0 +1,64 @@
-+/*
-+ * 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  Ralf Baechle <[email protected]>
-+ * Copyright (C) 2007  Felix Fietkau <[email protected]>
-+ *
-+ */
-+#ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H
-+#define __ASM_MACH_GENERIC_DMA_COHERENCE_H
-+
-+#define PCI_DMA_OFFSET	0x20000000
-+
-+struct device;
-+
-+static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size)
-+{
-+	return virt_to_phys(addr) + (dev != NULL ? PCI_DMA_OFFSET : 0);
-+}
-+
-+static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
-+{
-+	return page_to_phys(page) + (dev != NULL ? PCI_DMA_OFFSET : 0);
-+}
-+
-+static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
-+	dma_addr_t dma_addr)
-+{
-+	return (dma_addr > PCI_DMA_OFFSET ? dma_addr - PCI_DMA_OFFSET : dma_addr);
-+}
-+
-+static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
-+	size_t size, enum dma_data_direction direction)
-+{
-+}
-+
-+static inline int plat_dma_supported(struct device *dev, u64 mask)
-+{
-+	return 1;
-+}
-+
-+static inline void plat_extra_sync_for_device(struct device *dev)
-+{
-+	return;
-+}
-+
-+static inline int plat_dma_mapping_error(struct device *dev,
-+					 dma_addr_t dma_addr)
-+{
-+	return 0;
-+}
-+
-+static inline int plat_device_is_coherent(struct device *dev)
-+{
-+#ifdef CONFIG_DMA_COHERENT
-+	return 1;
-+#endif
-+#ifdef CONFIG_DMA_NONCOHERENT
-+	return 0;
-+#endif
-+}
-+
-+#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/gpio.h
-@@ -0,0 +1,79 @@
-+#ifndef _ATHEROS_GPIO_H_
-+#define _ATHEROS_GPIO_H_
-+
-+#include <ar231x.h>
-+
-+struct ar231x_gpiodev {
-+	u32 valid_mask;
-+	u32 (*get_output)(void);
-+	u32 (*set_output)(u32 mask, u32 val);
-+	u32 (*get)(void);
-+	u32 (*set)(u32 mask, u32 val);
-+};
-+
-+extern const struct ar231x_gpiodev *ar231x_gpiodev;
-+
-+/*
-+ * Wrappers for the generic GPIO layer
-+ */
-+
-+static inline int gpio_direction_input(unsigned gpio) {
-+	u32 mask = 1 << gpio;
-+
-+	if (!(ar231x_gpiodev->valid_mask & mask))
-+		return -ENXIO;
-+
-+	ar231x_gpiodev->set_output(mask, 0);
-+	return 0;
-+}
-+
-+static inline void gpio_set_value(unsigned gpio, int value) {
-+	u32 mask = 1 << gpio;
-+
-+	if (!(ar231x_gpiodev->valid_mask & mask))
-+		return;
-+
-+	ar231x_gpiodev->set(mask, (!!value) * mask);
-+}
-+
-+static inline int gpio_direction_output(unsigned gpio, int value) {
-+	u32 mask = 1 << gpio;
-+
-+	if (!(ar231x_gpiodev->valid_mask & mask))
-+		return -ENXIO;
-+
-+	ar231x_gpiodev->set_output(mask, mask);
-+	ar231x_gpiodev->set(mask, (!!value) * mask);
-+	return 0;
-+}
-+
-+/* Reads the gpio pin.  Unchecked function */
-+static inline int gpio_get_value(unsigned gpio) {
-+	u32 mask = 1 << gpio;
-+
-+	if (!(ar231x_gpiodev->valid_mask & mask))
-+		return 0;
-+
-+	return !!(ar231x_gpiodev->get() & mask);
-+}
-+
-+static inline int gpio_request(unsigned gpio, const char *label) {
-+	return 0;
-+}
-+
-+static inline void gpio_free(unsigned gpio) {
-+}
-+
-+/* Returns IRQ to attach for gpio.  Unchecked function */
-+static inline int gpio_to_irq(unsigned gpio) {
-+	return AR531X_GPIO_IRQ(gpio);
-+}
-+
-+/* Returns gpio for IRQ attached.  Unchecked function */
-+static inline int irq_to_gpio(unsigned irq) {
-+	return (irq - (AR531X_GPIO_IRQ(0)));
-+}
-+
-+#include <asm-generic/gpio.h> /* cansleep wrappers */
-+
-+#endif
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/reset.h
-@@ -0,0 +1,6 @@
-+#ifndef __AR531X_RESET_H
-+#define __AR531X_RESET_H
-+
-+void ar531x_disable_reset_button(void);
-+
-+#endif /* __AR531X_RESET_H */
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/war.h
-@@ -0,0 +1,25 @@
-+/*
-+ * 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) 2008 Felix Fietkau <[email protected]>
-+ */
-+#ifndef __ASM_MIPS_MACH_ATHEROS_WAR_H
-+#define __ASM_MIPS_MACH_ATHEROS_WAR_H
-+
-+#define R4600_V1_INDEX_ICACHEOP_WAR	0
-+#define R4600_V1_HIT_CACHEOP_WAR	0
-+#define R4600_V2_HIT_CACHEOP_WAR	0
-+#define R5432_CP0_INTERRUPT_WAR		0
-+#define BCM1250_M3_WAR			0
-+#define SIBYTE_1956_WAR			0
-+#define MIPS4K_ICACHE_REFILL_WAR	0
-+#define MIPS_CACHE_SYNC_WAR		0
-+#define TX49XX_ICACHE_INDEX_INV_WAR	0
-+#define RM9000_CDEX_SMP_WAR		0
-+#define ICACHE_REFILLS_WORKAROUND_WAR	0
-+#define R10000_LLSC_WAR			0
-+#define MIPS34K_MISSED_ITLB_WAR		0
-+
-+#endif /* __ASM_MIPS_MACH_ATHEROS_WAR_H */
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,580 @@
-+/*
-+ * Register definitions for AR2315+
-+ *
-+ * 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 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2008 Felix Fietkau <[email protected]>
-+ */
-+
-+#ifndef __AR2315_REG_H
-+#define __AR2315_REG_H
-+
-+/*
-+ * IRQs
-+ */
-+#define AR2315_IRQ_MISC_INTRS   MIPS_CPU_IRQ_BASE+2 /* C0_CAUSE: 0x0400 */
-+#define AR2315_IRQ_WLAN0_INTRS  MIPS_CPU_IRQ_BASE+3 /* C0_CAUSE: 0x0800 */
-+#define AR2315_IRQ_ENET0_INTRS  MIPS_CPU_IRQ_BASE+4 /* C0_CAUSE: 0x1000 */
-+#define AR2315_IRQ_LCBUS_PCI    MIPS_CPU_IRQ_BASE+5 /* C0_CAUSE: 0x2000 */
-+#define AR2315_IRQ_WLAN0_POLL   MIPS_CPU_IRQ_BASE+6 /* C0_CAUSE: 0x4000 */
-+
-+/*
-+ * Address map
-+ */
-+#define AR2315_SPI_READ         0x08000000      /* SPI FLASH */
-+#define AR2315_WLAN0            0xB0000000      /* Wireless MMR */
-+#define AR2315_PCI              0xB0100000      /* PCI MMR */
-+#define AR2315_SDRAMCTL         0xB0300000      /* SDRAM MMR */
-+#define AR2315_LOCAL            0xB0400000      /* LOCAL BUS MMR */
-+#define AR2315_ENET0            0xB0500000      /* ETHERNET MMR */
-+#define AR2315_DSLBASE          0xB1000000      /* RESET CONTROL MMR */
-+#define AR2315_UART0            0xB1100003      /* UART MMR */
-+#define AR2315_SPI              0xB1300000      /* SPI FLASH MMR */
-+#define AR2315_PCIEXT           0x80000000      /* pci external */
-+
-+/*
-+ * Reset Register
-+ */
-+#define AR2315_COLD_RESET       (AR2315_DSLBASE + 0x0000)
-+
-+#define AR2315_RESET_COLD_AHB              0x00000001
-+#define AR2315_RESET_COLD_APB              0x00000002
-+#define AR2315_RESET_COLD_CPU              0x00000004
-+#define AR2315_RESET_COLD_CPUWARM          0x00000008
-+#define AR2315_RESET_SYSTEM                (RESET_COLD_CPU | RESET_COLD_APB | RESET_COLD_AHB)      /* full system */
-+#define AR2317_RESET_SYSTEM                0x00000010
-+
-+
-+#define AR2315_RESET            (AR2315_DSLBASE + 0x0004)
-+
-+#define AR2315_RESET_WARM_WLAN0_MAC        0x00000001      /* warm reset WLAN0 MAC */
-+#define AR2315_RESET_WARM_WLAN0_BB         0x00000002      /* warm reset WLAN0 BaseBand */
-+#define AR2315_RESET_MPEGTS_RSVD           0x00000004      /* warm reset MPEG-TS */
-+#define AR2315_RESET_PCIDMA                0x00000008      /* warm reset PCI ahb/dma */
-+#define AR2315_RESET_MEMCTL                0x00000010      /* warm reset memory controller */
-+#define AR2315_RESET_LOCAL                 0x00000020      /* warm reset local bus */
-+#define AR2315_RESET_I2C_RSVD              0x00000040      /* warm reset I2C bus */
-+#define AR2315_RESET_SPI                   0x00000080      /* warm reset SPI interface */
-+#define AR2315_RESET_UART0                 0x00000100      /* warm reset UART0 */
-+#define AR2315_RESET_IR_RSVD               0x00000200      /* warm reset IR interface */
-+#define AR2315_RESET_EPHY0                 0x00000400      /* cold reset ENET0 phy */
-+#define AR2315_RESET_ENET0                 0x00000800      /* cold reset ENET0 mac */
-+
-+/*
-+ * AHB master arbitration control
-+ */
-+#define AR2315_AHB_ARB_CTL      (AR2315_DSLBASE + 0x0008)
-+
-+#define AR2315_ARB_CPU                     0x00000001      /* CPU, default */
-+#define AR2315_ARB_WLAN                    0x00000002      /* WLAN */
-+#define AR2315_ARB_MPEGTS_RSVD             0x00000004      /* MPEG-TS */
-+#define AR2315_ARB_LOCAL                   0x00000008      /* LOCAL */
-+#define AR2315_ARB_PCI                     0x00000010      /* PCI */
-+#define AR2315_ARB_ETHERNET                0x00000020      /* Ethernet */
-+#define AR2315_ARB_RETRY                   0x00000100      /* retry policy, debug only */
-+
-+/*
-+ * Config Register
-+ */
-+#define AR2315_ENDIAN_CTL       (AR2315_DSLBASE + 0x000c)
-+
-+#define AR2315_CONFIG_AHB                  0x00000001      /* EC - AHB bridge endianess */
-+#define AR2315_CONFIG_WLAN                 0x00000002      /* WLAN byteswap */
-+#define AR2315_CONFIG_MPEGTS_RSVD          0x00000004      /* MPEG-TS byteswap */
-+#define AR2315_CONFIG_PCI                  0x00000008      /* PCI byteswap */
-+#define AR2315_CONFIG_MEMCTL               0x00000010      /* Memory controller endianess */
-+#define AR2315_CONFIG_LOCAL                0x00000020      /* Local bus byteswap */
-+#define AR2315_CONFIG_ETHERNET             0x00000040      /* Ethernet byteswap */
-+
-+#define AR2315_CONFIG_MERGE                0x00000200      /* CPU write buffer merge */
-+#define AR2315_CONFIG_CPU                  0x00000400      /* CPU big endian */
-+#define AR2315_CONFIG_PCIAHB               0x00000800
-+#define AR2315_CONFIG_PCIAHB_BRIDGE        0x00001000
-+#define AR2315_CONFIG_SPI                  0x00008000      /* SPI byteswap */
-+#define AR2315_CONFIG_CPU_DRAM             0x00010000
-+#define AR2315_CONFIG_CPU_PCI              0x00020000
-+#define AR2315_CONFIG_CPU_MMR              0x00040000
-+#define AR2315_CONFIG_BIG                  0x00000400
-+
-+
-+/*
-+ * NMI control
-+ */
-+#define AR2315_NMI_CTL          (AR2315_DSLBASE + 0x0010)
-+
-+#define AR2315_NMI_EN  1
-+
-+/*
-+ * Revision Register - Initial value is 0x3010 (WMAC 3.0, AR531X 1.0).
-+ */
-+#define AR2315_SREV             (AR2315_DSLBASE + 0x0014)
-+
-+#define AR2315_REV_MAJ                     0x00f0
-+#define AR2315_REV_MAJ_S                   4
-+#define AR2315_REV_MIN                     0x000f
-+#define AR2315_REV_MIN_S                   0
-+#define AR2315_REV_CHIP                    (AR2315_REV_MAJ|AR2315_REV_MIN)
-+
-+/*
-+ * Interface Enable
-+ */
-+#define AR2315_IF_CTL           (AR2315_DSLBASE + 0x0018)
-+
-+#define AR2315_IF_MASK                     0x00000007
-+#define AR2315_IF_DISABLED                 0
-+#define AR2315_IF_PCI                      1
-+#define AR2315_IF_TS_LOCAL                 2
-+#define AR2315_IF_ALL                      3   /* only for emulation with separate pins */
-+#define AR2315_IF_LOCAL_HOST               0x00000008
-+#define AR2315_IF_PCI_HOST                 0x00000010
-+#define AR2315_IF_PCI_INTR                 0x00000020
-+#define AR2315_IF_PCI_CLK_MASK             0x00030000
-+#define AR2315_IF_PCI_CLK_INPUT            0
-+#define AR2315_IF_PCI_CLK_OUTPUT_LOW       1
-+#define AR2315_IF_PCI_CLK_OUTPUT_CLK       2
-+#define AR2315_IF_PCI_CLK_OUTPUT_HIGH      3
-+#define AR2315_IF_PCI_CLK_SHIFT            16
-+
-+/*
-+ * APB Interrupt control
-+ */
-+
-+#define AR2315_ISR              (AR2315_DSLBASE + 0x0020)
-+#define AR2315_IMR              (AR2315_DSLBASE + 0x0024)
-+#define AR2315_GISR             (AR2315_DSLBASE + 0x0028)
-+
-+#define AR2315_ISR_UART0                   0x0001           /* high speed UART */
-+#define AR2315_ISR_I2C_RSVD                0x0002           /* I2C bus */
-+#define AR2315_ISR_SPI                     0x0004           /* SPI bus */
-+#define AR2315_ISR_AHB                     0x0008           /* AHB error */
-+#define AR2315_ISR_APB                     0x0010           /* APB error */
-+#define AR2315_ISR_TIMER                   0x0020           /* timer */
-+#define AR2315_ISR_GPIO                    0x0040           /* GPIO */
-+#define AR2315_ISR_WD                      0x0080           /* watchdog */
-+#define AR2315_ISR_IR_RSVD                 0x0100           /* IR */
-+
-+#define AR2315_GISR_MISC                   0x0001
-+#define AR2315_GISR_WLAN0                  0x0002
-+#define AR2315_GISR_MPEGTS_RSVD            0x0004
-+#define AR2315_GISR_LOCALPCI               0x0008
-+#define AR2315_GISR_WMACPOLL               0x0010
-+#define AR2315_GISR_TIMER                  0x0020
-+#define AR2315_GISR_ETHERNET               0x0040
-+
-+/*
-+ * Interrupt routing from IO to the processor IP bits
-+ * Define our inter mask and level
-+ */
-+#define AR2315_INTR_MISCIO      SR_IBIT3
-+#define AR2315_INTR_WLAN0       SR_IBIT4
-+#define AR2315_INTR_ENET0       SR_IBIT5
-+#define AR2315_INTR_LOCALPCI    SR_IBIT6
-+#define AR2315_INTR_WMACPOLL    SR_IBIT7
-+#define AR2315_INTR_COMPARE     SR_IBIT8
-+
-+/*
-+ * Timers
-+ */
-+#define AR2315_TIMER            (AR2315_DSLBASE + 0x0030)
-+#define AR2315_RELOAD           (AR2315_DSLBASE + 0x0034)
-+#define AR2315_WD               (AR2315_DSLBASE + 0x0038)
-+#define AR2315_WDC              (AR2315_DSLBASE + 0x003c)
-+
-+#define AR2315_WDC_IGNORE_EXPIRATION       0x00000000
-+#define AR2315_WDC_NMI                     0x00000001               /* NMI on watchdog */
-+#define AR2315_WDC_RESET                   0x00000002               /* reset on watchdog */
-+
-+/*
-+ * CPU Performance Counters
-+ */
-+#define AR2315_PERFCNT0         (AR2315_DSLBASE + 0x0048)
-+#define AR2315_PERFCNT1         (AR2315_DSLBASE + 0x004c)
-+
-+#define AR2315_PERF0_DATAHIT                0x0001  /* Count Data Cache Hits */
-+#define AR2315_PERF0_DATAMISS               0x0002  /* Count Data Cache Misses */
-+#define AR2315_PERF0_INSTHIT                0x0004  /* Count Instruction Cache Hits */
-+#define AR2315_PERF0_INSTMISS               0x0008  /* Count Instruction Cache Misses */
-+#define AR2315_PERF0_ACTIVE                 0x0010  /* Count Active Processor Cycles */
-+#define AR2315_PERF0_WBHIT                  0x0020  /* Count CPU Write Buffer Hits */
-+#define AR2315_PERF0_WBMISS                 0x0040  /* Count CPU Write Buffer Misses */
-+
-+#define AR2315_PERF1_EB_ARDY                0x0001  /* Count EB_ARdy signal */
-+#define AR2315_PERF1_EB_AVALID              0x0002  /* Count EB_AValid signal */
-+#define AR2315_PERF1_EB_WDRDY               0x0004  /* Count EB_WDRdy signal */
-+#define AR2315_PERF1_EB_RDVAL               0x0008  /* Count EB_RdVal signal */
-+#define AR2315_PERF1_VRADDR                 0x0010  /* Count valid read address cycles */
-+#define AR2315_PERF1_VWADDR                 0x0020  /* Count valid write address cycles */
-+#define AR2315_PERF1_VWDATA                 0x0040  /* Count valid write data cycles */
-+
-+/*
-+ * AHB Error Reporting.
-+ */
-+#define AR2315_AHB_ERR0         (AR2315_DSLBASE + 0x0050)  /* error  */
-+#define AR2315_AHB_ERR1         (AR2315_DSLBASE + 0x0054)  /* haddr  */
-+#define AR2315_AHB_ERR2         (AR2315_DSLBASE + 0x0058)  /* hwdata */
-+#define AR2315_AHB_ERR3         (AR2315_DSLBASE + 0x005c)  /* hrdata */
-+#define AR2315_AHB_ERR4         (AR2315_DSLBASE + 0x0060)  /* status */
-+
-+#define AHB_ERROR_DET               1   /* AHB Error has been detected,          */
-+                                        /* write 1 to clear all bits in ERR0     */
-+#define AHB_ERROR_OVR               2   /* AHB Error overflow has been detected  */
-+#define AHB_ERROR_WDT               4   /* AHB Error due to wdt instead of hresp */
-+
-+#define AR2315_PROCERR_HMAST               0x0000000f
-+#define AR2315_PROCERR_HMAST_DFLT          0
-+#define AR2315_PROCERR_HMAST_WMAC          1
-+#define AR2315_PROCERR_HMAST_ENET          2
-+#define AR2315_PROCERR_HMAST_PCIENDPT      3
-+#define AR2315_PROCERR_HMAST_LOCAL         4
-+#define AR2315_PROCERR_HMAST_CPU           5
-+#define AR2315_PROCERR_HMAST_PCITGT        6
-+
-+#define AR2315_PROCERR_HMAST_S             0
-+#define AR2315_PROCERR_HWRITE              0x00000010
-+#define AR2315_PROCERR_HSIZE               0x00000060
-+#define AR2315_PROCERR_HSIZE_S             5
-+#define AR2315_PROCERR_HTRANS              0x00000180
-+#define AR2315_PROCERR_HTRANS_S            7
-+#define AR2315_PROCERR_HBURST              0x00000e00
-+#define AR2315_PROCERR_HBURST_S            9
-+
-+/*
-+ * Clock Control
-+ */
-+#define AR2315_PLLC_CTL         (AR2315_DSLBASE + 0x0064)
-+#define AR2315_PLLV_CTL         (AR2315_DSLBASE + 0x0068)
-+#define AR2315_CPUCLK           (AR2315_DSLBASE + 0x006c)
-+#define AR2315_AMBACLK          (AR2315_DSLBASE + 0x0070)
-+#define AR2315_SYNCCLK          (AR2315_DSLBASE + 0x0074)
-+#define AR2315_DSL_SLEEP_CTL    (AR2315_DSLBASE + 0x0080)
-+#define AR2315_DSL_SLEEP_DUR    (AR2315_DSLBASE + 0x0084)
-+
-+/* PLLc Control fields */
-+#define PLLC_REF_DIV_M              0x00000003
-+#define PLLC_REF_DIV_S              0
-+#define PLLC_FDBACK_DIV_M           0x0000007C
-+#define PLLC_FDBACK_DIV_S           2
-+#define PLLC_ADD_FDBACK_DIV_M       0x00000080
-+#define PLLC_ADD_FDBACK_DIV_S       7
-+#define PLLC_CLKC_DIV_M             0x0001c000
-+#define PLLC_CLKC_DIV_S             14
-+#define PLLC_CLKM_DIV_M             0x00700000
-+#define PLLC_CLKM_DIV_S             20
-+
-+/* CPU CLK Control fields */
-+#define CPUCLK_CLK_SEL_M            0x00000003
-+#define CPUCLK_CLK_SEL_S            0
-+#define CPUCLK_CLK_DIV_M            0x0000000c
-+#define CPUCLK_CLK_DIV_S            2
-+
-+/* AMBA CLK Control fields */
-+#define AMBACLK_CLK_SEL_M           0x00000003
-+#define AMBACLK_CLK_SEL_S           0
-+#define AMBACLK_CLK_DIV_M           0x0000000c
-+#define AMBACLK_CLK_DIV_S           2
-+
-+/*
-+ * GPIO
-+ */
-+#define AR2315_GPIO_DI          (AR2315_DSLBASE + 0x0088)
-+#define AR2315_GPIO_DO          (AR2315_DSLBASE + 0x0090)
-+#define AR2315_GPIO_CR          (AR2315_DSLBASE + 0x0098)
-+#define AR2315_GPIO_INT         (AR2315_DSLBASE + 0x00a0)
-+
-+#define AR2315_GPIO_CR_M(x)                (1 << (x))                  /* mask for i/o */
-+#define AR2315_GPIO_CR_O(x)                (1 << (x))                  /* output */
-+#define AR2315_GPIO_CR_I(x)                (0)                         /* input */
-+
-+#define AR2315_GPIO_INT_S(x)               (x)                         /* interrupt enable */
-+#define AR2315_GPIO_INT_M                  (0x3F)                      /* mask for int */
-+#define AR2315_GPIO_INT_LVL(x)             ((x) << 6)                  /* interrupt level */
-+#define AR2315_GPIO_INT_LVL_M              ((0x3) << 6)                /* mask for int level */
-+
-+#define AR2315_GPIO_INT_MAX_Y				1   /* Maximum value of Y for AR5313_GPIO_INT_* macros */
-+#define AR2315_GPIO_INT_LVL_OFF				0   /* Triggerring off */
-+#define AR2315_GPIO_INT_LVL_LOW				1   /* Low Level Triggered */
-+#define AR2315_GPIO_INT_LVL_HIGH			2   /* High Level Triggered */
-+#define AR2315_GPIO_INT_LVL_EDGE			3   /* Edge Triggered */
-+
-+#define AR2315_RESET_GPIO       5
-+#define AR2315_NUM_GPIO         22
-+
-+/*
-+ *  PCI Clock Control
-+ */
-+#define AR2315_PCICLK           (AR2315_DSLBASE + 0x00a4)
-+
-+#define AR2315_PCICLK_INPUT_M              0x3
-+#define AR2315_PCICLK_INPUT_S              0
-+
-+#define AR2315_PCICLK_PLLC_CLKM            0
-+#define AR2315_PCICLK_PLLC_CLKM1           1
-+#define AR2315_PCICLK_PLLC_CLKC            2
-+#define AR2315_PCICLK_REF_CLK              3
-+
-+#define AR2315_PCICLK_DIV_M                0xc
-+#define AR2315_PCICLK_DIV_S                2
-+
-+#define AR2315_PCICLK_IN_FREQ              0
-+#define AR2315_PCICLK_IN_FREQ_DIV_6        1
-+#define AR2315_PCICLK_IN_FREQ_DIV_8        2
-+#define AR2315_PCICLK_IN_FREQ_DIV_10       3
-+
-+/*
-+ * Observation Control Register
-+ */
-+#define AR2315_OCR              (AR2315_DSLBASE + 0x00b0)
-+#define OCR_GPIO0_IRIN              0x0040
-+#define OCR_GPIO1_IROUT             0x0080
-+#define OCR_GPIO3_RXCLR             0x0200
-+
-+/*
-+ *  General Clock Control
-+ */
-+
-+#define AR2315_MISCCLK          (AR2315_DSLBASE + 0x00b4)
-+#define MISCCLK_PLLBYPASS_EN        0x00000001
-+#define MISCCLK_PROCREFCLK          0x00000002
-+
-+/*
-+ * SDRAM Controller
-+ *   - No read or write buffers are included.
-+ */
-+#define AR2315_MEM_CFG          (AR2315_SDRAMCTL + 0x00)
-+#define AR2315_MEM_CTRL         (AR2315_SDRAMCTL + 0x0c)
-+#define AR2315_MEM_REF          (AR2315_SDRAMCTL + 0x10)
-+
-+#define SDRAM_DATA_WIDTH_M          0x00006000
-+#define SDRAM_DATA_WIDTH_S          13
-+
-+#define SDRAM_COL_WIDTH_M           0x00001E00
-+#define SDRAM_COL_WIDTH_S           9
-+
-+#define SDRAM_ROW_WIDTH_M           0x000001E0
-+#define SDRAM_ROW_WIDTH_S           5
-+
-+#define SDRAM_BANKADDR_BITS_M       0x00000018
-+#define SDRAM_BANKADDR_BITS_S       3
-+
-+/*
-+ * SPI Flash Interface Registers
-+ */
-+
-+#define AR2315_SPI_CTL      (AR2315_SPI + 0x00)
-+#define AR2315_SPI_OPCODE   (AR2315_SPI + 0x04)
-+#define AR2315_SPI_DATA     (AR2315_SPI + 0x08)
-+
-+#define SPI_CTL_START           0x00000100
-+#define SPI_CTL_BUSY            0x00010000
-+#define SPI_CTL_TXCNT_MASK      0x0000000f
-+#define SPI_CTL_RXCNT_MASK      0x000000f0
-+#define SPI_CTL_TX_RX_CNT_MASK  0x000000ff
-+#define SPI_CTL_SIZE_MASK       0x00060000
-+
-+#define SPI_CTL_CLK_SEL_MASK    0x03000000
-+#define SPI_OPCODE_MASK         0x000000ff
-+
-+/*
-+ * PCI Bus Interface Registers
-+ */
-+#define AR2315_PCI_1MS_REG      (AR2315_PCI + 0x0008)
-+#define AR2315_PCI_1MS_MASK     0x3FFFF         /* # of AHB clk cycles in 1ms */
-+
-+#define AR2315_PCI_MISC_CONFIG  (AR2315_PCI + 0x000c)
-+#define AR2315_PCIMISC_TXD_EN   0x00000001      /* Enable TXD for fragments */
-+#define AR2315_PCIMISC_CFG_SEL  0x00000002      /* mem or config cycles */
-+#define AR2315_PCIMISC_GIG_MASK 0x0000000C      /* bits 31-30 for pci req */
-+#define AR2315_PCIMISC_RST_MODE 0x00000030
-+#define AR2315_PCIRST_INPUT     0x00000000      /* 4:5=0 rst is input */
-+#define AR2315_PCIRST_LOW       0x00000010      /* 4:5=1 rst to GND */
-+#define AR2315_PCIRST_HIGH      0x00000020      /* 4:5=2 rst to VDD */
-+#define AR2315_PCIGRANT_EN      0x00000000      /* 6:7=0 early grant en */
-+#define AR2315_PCIGRANT_FRAME   0x00000040      /* 6:7=1 grant waits 4 frame */
-+#define AR2315_PCIGRANT_IDLE    0x00000080      /* 6:7=2 grant waits 4 idle */
-+#define AR2315_PCIGRANT_GAP     0x00000000      /* 6:7=2 grant waits 4 idle */
-+#define AR2315_PCICACHE_DIS     0x00001000      /* PCI external access cache disable */
-+
-+#define AR2315_PCI_OUT_TSTAMP   (AR2315_PCI + 0x0010)
-+
-+#define AR2315_PCI_UNCACHE_CFG  (AR2315_PCI + 0x0014)
-+
-+#define AR2315_PCI_IN_EN        (AR2315_PCI + 0x0100)
-+#define AR2315_PCI_IN_EN0       0x01            /* Enable chain 0 */
-+#define AR2315_PCI_IN_EN1       0x02            /* Enable chain 1 */
-+#define AR2315_PCI_IN_EN2       0x04            /* Enable chain 2 */
-+#define AR2315_PCI_IN_EN3       0x08            /* Enable chain 3 */
-+
-+#define AR2315_PCI_IN_DIS       (AR2315_PCI + 0x0104)
-+#define AR2315_PCI_IN_DIS0      0x01            /* Disable chain 0 */
-+#define AR2315_PCI_IN_DIS1      0x02            /* Disable chain 1 */
-+#define AR2315_PCI_IN_DIS2      0x04            /* Disable chain 2 */
-+#define AR2315_PCI_IN_DIS3      0x08            /* Disable chain 3 */
-+
-+#define AR2315_PCI_IN_PTR       (AR2315_PCI + 0x0200)
-+
-+#define AR2315_PCI_OUT_EN       (AR2315_PCI + 0x0400)
-+#define AR2315_PCI_OUT_EN0      0x01            /* Enable chain 0 */
-+
-+#define AR2315_PCI_OUT_DIS      (AR2315_PCI + 0x0404)
-+#define AR2315_PCI_OUT_DIS0     0x01            /* Disable chain 0 */
-+
-+#define AR2315_PCI_OUT_PTR      (AR2315_PCI + 0x0408)
-+
-+#define AR2315_PCI_INT_STATUS   (AR2315_PCI + 0x0500)   /* write one to clr */
-+#define AR2315_PCI_TXINT        0x00000001      /* Desc In Completed */
-+#define AR2315_PCI_TXOK         0x00000002      /* Desc In OK */
-+#define AR2315_PCI_TXERR        0x00000004      /* Desc In ERR */
-+#define AR2315_PCI_TXEOL        0x00000008      /* Desc In End-of-List */
-+#define AR2315_PCI_RXINT        0x00000010      /* Desc Out Completed */
-+#define AR2315_PCI_RXOK         0x00000020      /* Desc Out OK */
-+#define AR2315_PCI_RXERR        0x00000040      /* Desc Out ERR */
-+#define AR2315_PCI_RXEOL        0x00000080      /* Desc Out EOL */
-+#define AR2315_PCI_TXOOD        0x00000200      /* Desc In Out-of-Desc */
-+#define AR2315_PCI_MASK         0x0000FFFF      /* Desc Mask */
-+#define AR2315_PCI_EXT_INT      0x02000000
-+#define AR2315_PCI_ABORT_INT    0x04000000
-+
-+#define AR2315_PCI_INT_MASK     (AR2315_PCI + 0x0504)   /* same as INT_STATUS */
-+
-+#define AR2315_PCI_INTEN_REG    (AR2315_PCI + 0x0508)
-+#define AR2315_PCI_INT_DISABLE  0x00            /* disable pci interrupts */
-+#define AR2315_PCI_INT_ENABLE   0x01            /* enable pci interrupts */
-+
-+#define AR2315_PCI_HOST_IN_EN   (AR2315_PCI + 0x0800)
-+#define AR2315_PCI_HOST_IN_DIS  (AR2315_PCI + 0x0804)
-+#define AR2315_PCI_HOST_IN_PTR  (AR2315_PCI + 0x0810)
-+#define AR2315_PCI_HOST_OUT_EN  (AR2315_PCI + 0x0900)
-+#define AR2315_PCI_HOST_OUT_DIS (AR2315_PCI + 0x0904)
-+#define AR2315_PCI_HOST_OUT_PTR (AR2315_PCI + 0x0908)
-+
-+
-+/*
-+ * Local Bus Interface Registers
-+ */
-+#define AR2315_LB_CONFIG        (AR2315_LOCAL + 0x0000)
-+#define AR2315_LBCONF_OE        0x00000001      /* =1 OE is low-true */
-+#define AR2315_LBCONF_CS0       0x00000002      /* =1 first CS is low-true */
-+#define AR2315_LBCONF_CS1       0x00000004      /* =1 2nd CS is low-true */
-+#define AR2315_LBCONF_RDY       0x00000008      /* =1 RDY is low-true */
-+#define AR2315_LBCONF_WE        0x00000010      /* =1 Write En is low-true */
-+#define AR2315_LBCONF_WAIT      0x00000020      /* =1 WAIT is low-true */
-+#define AR2315_LBCONF_ADS       0x00000040      /* =1 Adr Strobe is low-true */
-+#define AR2315_LBCONF_MOT       0x00000080      /* =0 Intel, =1 Motorola */
-+#define AR2315_LBCONF_8CS       0x00000100      /* =1 8 bits CS, 0= 16bits */
-+#define AR2315_LBCONF_8DS       0x00000200      /* =1 8 bits Data S, 0=16bits */
-+#define AR2315_LBCONF_ADS_EN    0x00000400      /* =1 Enable ADS */
-+#define AR2315_LBCONF_ADR_OE    0x00000800      /* =1 Adr cap on OE, WE or DS */
-+#define AR2315_LBCONF_ADDT_MUX  0x00001000      /* =1 Adr and Data share bus */
-+#define AR2315_LBCONF_DATA_OE   0x00002000      /* =1 Data cap on OE, WE, DS */
-+#define AR2315_LBCONF_16DATA    0x00004000      /* =1 Data is 16 bits wide */
-+#define AR2315_LBCONF_SWAPDT    0x00008000      /* =1 Byte swap data */
-+#define AR2315_LBCONF_SYNC      0x00010000      /* =1 Bus synchronous to clk */
-+#define AR2315_LBCONF_INT       0x00020000      /* =1 Intr is low true */
-+#define AR2315_LBCONF_INT_CTR0  0x00000000      /* GND high-Z, Vdd is high-Z */
-+#define AR2315_LBCONF_INT_CTR1  0x00040000      /* GND drive, Vdd is high-Z */
-+#define AR2315_LBCONF_INT_CTR2  0x00080000      /* GND high-Z, Vdd drive */
-+#define AR2315_LBCONF_INT_CTR3  0x000C0000      /* GND drive, Vdd drive */
-+#define AR2315_LBCONF_RDY_WAIT  0x00100000      /* =1 RDY is negative of WAIT */
-+#define AR2315_LBCONF_INT_PULSE 0x00200000      /* =1 Interrupt is a pulse */
-+#define AR2315_LBCONF_ENABLE    0x00400000      /* =1 Falcon respond to LB */
-+
-+#define AR2315_LB_CLKSEL        (AR2315_LOCAL + 0x0004)
-+#define AR2315_LBCLK_EXT        0x0001          /* use external clk for lb */
-+
-+#define AR2315_LB_1MS           (AR2315_LOCAL + 0x0008)
-+#define AR2315_LB1MS_MASK       0x3FFFF         /* # of AHB clk cycles in 1ms */
-+
-+#define AR2315_LB_MISCCFG       (AR2315_LOCAL + 0x000C)
-+#define AR2315_LBM_TXD_EN       0x00000001      /* Enable TXD for fragments */
-+#define AR2315_LBM_RX_INTEN     0x00000002      /* Enable LB ints on RX ready */
-+#define AR2315_LBM_MBOXWR_INTEN 0x00000004      /* Enable LB ints on mbox wr */
-+#define AR2315_LBM_MBOXRD_INTEN 0x00000008      /* Enable LB ints on mbox rd */
-+#define AR2315_LMB_DESCSWAP_EN  0x00000010      /* Byte swap desc enable */
-+#define AR2315_LBM_TIMEOUT_MASK 0x00FFFF80
-+#define AR2315_LBM_TIMEOUT_SHFT 7
-+#define AR2315_LBM_PORTMUX      0x07000000
-+
-+
-+#define AR2315_LB_RXTSOFF       (AR2315_LOCAL + 0x0010)
-+
-+#define AR2315_LB_TX_CHAIN_EN   (AR2315_LOCAL + 0x0100)
-+#define AR2315_LB_TXEN_0        0x01
-+#define AR2315_LB_TXEN_1        0x02
-+#define AR2315_LB_TXEN_2        0x04
-+#define AR2315_LB_TXEN_3        0x08
-+
-+#define AR2315_LB_TX_CHAIN_DIS  (AR2315_LOCAL + 0x0104)
-+#define AR2315_LB_TX_DESC_PTR   (AR2315_LOCAL + 0x0200)
-+
-+#define AR2315_LB_RX_CHAIN_EN   (AR2315_LOCAL + 0x0400)
-+#define AR2315_LB_RXEN          0x01
-+
-+#define AR2315_LB_RX_CHAIN_DIS  (AR2315_LOCAL + 0x0404)
-+#define AR2315_LB_RX_DESC_PTR   (AR2315_LOCAL + 0x0408)
-+
-+#define AR2315_LB_INT_STATUS    (AR2315_LOCAL + 0x0500)
-+#define AR2315_INT_TX_DESC      0x0001
-+#define AR2315_INT_TX_OK        0x0002
-+#define AR2315_INT_TX_ERR       0x0004
-+#define AR2315_INT_TX_EOF       0x0008
-+#define AR2315_INT_RX_DESC      0x0010
-+#define AR2315_INT_RX_OK        0x0020
-+#define AR2315_INT_RX_ERR       0x0040
-+#define AR2315_INT_RX_EOF       0x0080
-+#define AR2315_INT_TX_TRUNC     0x0100
-+#define AR2315_INT_TX_STARVE    0x0200
-+#define AR2315_INT_LB_TIMEOUT   0x0400
-+#define AR2315_INT_LB_ERR       0x0800
-+#define AR2315_INT_MBOX_WR      0x1000
-+#define AR2315_INT_MBOX_RD      0x2000
-+
-+/* Bit definitions for INT MASK are the same as INT_STATUS */
-+#define AR2315_LB_INT_MASK      (AR2315_LOCAL + 0x0504)
-+
-+#define AR2315_LB_INT_EN        (AR2315_LOCAL + 0x0508)
-+#define AR2315_LB_MBOX          (AR2315_LOCAL + 0x0600)
-+
-+/*
-+ * IR Interface Registers
-+ */
-+#define AR2315_IR_PKTDATA                   (AR2315_IR + 0x0000)
-+
-+#define AR2315_IR_PKTLEN                    (AR2315_IR + 0x07fc) /* 0 - 63 */
-+
-+#define AR2315_IR_CONTROL                   (AR2315_IR + 0x0800)
-+#define AR2315_IRCTL_TX                     0x00000000  /* use as tranmitter */
-+#define AR2315_IRCTL_RX                     0x00000001  /* use as receiver   */
-+#define AR2315_IRCTL_SAMPLECLK_MASK         0x00003ffe  /* Sample clk divisor mask */
-+#define AR2315_IRCTL_SAMPLECLK_SHFT                  1
-+#define AR2315_IRCTL_OUTPUTCLK_MASK         0x03ffc000  /* Output clk divisor mask */
-+#define AR2315_IRCTL_OUTPUTCLK_SHFT                 14
-+
-+#define AR2315_IR_STATUS                    (AR2315_IR + 0x0804)
-+#define AR2315_IRSTS_RX                     0x00000001  /* receive in progress */
-+#define AR2315_IRSTS_TX                     0x00000002  /* transmit in progress */
-+
-+#define AR2315_IR_CONFIG                    (AR2315_IR + 0x0808)
-+#define AR2315_IRCFG_INVIN                  0x00000001  /* invert input polarity */
-+#define AR2315_IRCFG_INVOUT                 0x00000002  /* invert output polarity */
-+#define AR2315_IRCFG_SEQ_START_WIN_SEL      0x00000004  /* 1 => 28, 0 => 7 */
-+#define AR2315_IRCFG_SEQ_START_THRESH       0x000000f0  /*  */
-+#define AR2315_IRCFG_SEQ_END_UNIT_SEL       0x00000100  /*  */
-+#define AR2315_IRCFG_SEQ_END_UNIT_THRESH    0x00007e00  /*  */
-+#define AR2315_IRCFG_SEQ_END_WIN_SEL        0x00008000  /*  */
-+#define AR2315_IRCFG_SEQ_END_WIN_THRESH     0x001f0000  /*  */
-+#define AR2315_IRCFG_NUM_BACKOFF_WORDS      0x01e00000  /*  */
-+
-+#define HOST_PCI_DEV_ID         3
-+#define HOST_PCI_MBAR0          0x10000000
-+#define HOST_PCI_MBAR1          0x20000000
-+#define HOST_PCI_MBAR2          0x30000000
-+
-+#define HOST_PCI_SDRAM_BASEADDR HOST_PCI_MBAR1
-+#define PCI_DEVICE_MEM_SPACE    0x800000
-+
-+#endif /* __AR2315_REG_H */
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,236 @@
-+/*
-+ * 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 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006 Felix Fietkau <[email protected]>
-+ */
-+
-+#ifndef AR5312_H
-+#define AR5312_H
-+
-+#include <asm/addrspace.h>
-+
-+/*
-+ * IRQs
-+ */
-+
-+#define AR5312_IRQ_WLAN0_INTRS  MIPS_CPU_IRQ_BASE+2 /* C0_CAUSE: 0x0400 */
-+#define AR5312_IRQ_ENET0_INTRS  MIPS_CPU_IRQ_BASE+3 /* C0_CAUSE: 0x0800 */
-+#define AR5312_IRQ_ENET1_INTRS  MIPS_CPU_IRQ_BASE+4 /* C0_CAUSE: 0x1000 */
-+#define AR5312_IRQ_WLAN1_INTRS  MIPS_CPU_IRQ_BASE+5 /* C0_CAUSE: 0x2000 */
-+#define AR5312_IRQ_MISC_INTRS   MIPS_CPU_IRQ_BASE+6 /* C0_CAUSE: 0x4000 */
-+
-+
-+/* Address Map */
-+#define AR531X_WLAN0            0x18000000
-+#define AR531X_WLAN1            0x18500000
-+#define AR531X_ENET0            0x18100000
-+#define AR531X_ENET1            0x18200000
-+#define AR531X_SDRAMCTL         0x18300000
-+#define AR531X_FLASHCTL         0x18400000
-+#define AR531X_APBBASE		0x1c000000
-+#define AR531X_FLASH            0x1e000000
-+#define AR531X_UART0            0xbc000003      /* UART MMR */
-+
-+/*
-+ * AR531X_NUM_ENET_MAC defines the number of ethernet MACs that
-+ * should be considered available.  The AR5312 supports 2 enet MACS,
-+ * even though many reference boards only actually use 1 of them
-+ * (i.e. Only MAC 0 is actually connected to an enet PHY or PHY switch.
-+ * The AR2312 supports 1 enet MAC.
-+ */
-+#define AR531X_NUM_ENET_MAC             2
-+
-+/*
-+ * Need these defines to determine true number of ethernet MACs
-+ */
-+#define AR5212_AR5312_REV2      0x0052          /* AR5312 WMAC (AP31) */
-+#define AR5212_AR5312_REV7      0x0057          /* AR5312 WMAC (AP30-040) */
-+#define AR5212_AR2313_REV8      0x0058          /* AR2313 WMAC (AP43-030) */
-+#define AR531X_RADIO_MASK_OFF  0xc8
-+#define AR531X_RADIO0_MASK     0x0003
-+#define AR531X_RADIO1_MASK     0x000c
-+#define AR531X_RADIO1_S        2
-+
-+/*
-+ * AR531X_NUM_WMAC defines the number of Wireless MACs that\
-+ * should be considered available.
-+ */
-+#define AR531X_NUM_WMAC                 2
-+
-+/* Reset/Timer Block Address Map */
-+#define AR531X_RESETTMR		(AR531X_APBBASE  + 0x3000)
-+#define AR531X_TIMER		(AR531X_RESETTMR + 0x0000) /* countdown timer */
-+#define AR531X_WD_CTRL          (AR531X_RESETTMR + 0x0008) /* watchdog cntrl */
-+#define AR531X_WD_TIMER         (AR531X_RESETTMR + 0x000c) /* watchdog timer */
-+#define AR531X_ISR		(AR531X_RESETTMR + 0x0010) /* Intr Status Reg */
-+#define AR531X_IMR		(AR531X_RESETTMR + 0x0014) /* Intr Mask Reg */
-+#define AR531X_RESET		(AR531X_RESETTMR + 0x0020)
-+#define AR5312_CLOCKCTL1	(AR531X_RESETTMR + 0x0064)
-+#define AR5312_SCRATCH   	(AR531X_RESETTMR + 0x006c)
-+#define AR531X_PROCADDR		(AR531X_RESETTMR + 0x0070)
-+#define AR531X_PROC1		(AR531X_RESETTMR + 0x0074)
-+#define AR531X_DMAADDR		(AR531X_RESETTMR + 0x0078)
-+#define AR531X_DMA1		(AR531X_RESETTMR + 0x007c)
-+#define AR531X_ENABLE           (AR531X_RESETTMR + 0x0080) /* interface enb */
-+#define AR531X_REV		(AR531X_RESETTMR + 0x0090) /* revision */
-+
-+/* AR531X_WD_CTRL register bit field definitions */
-+#define AR531X_WD_CTRL_IGNORE_EXPIRATION 0x0000
-+#define AR531X_WD_CTRL_NMI               0x0001
-+#define AR531X_WD_CTRL_RESET             0x0002
-+
-+/* AR531X_ISR register bit field definitions */
-+#define AR531X_ISR_NONE		0x0000
-+#define AR531X_ISR_TIMER	0x0001
-+#define AR531X_ISR_AHBPROC	0x0002
-+#define AR531X_ISR_AHBDMA	0x0004
-+#define AR531X_ISR_GPIO		0x0008
-+#define AR531X_ISR_UART0	0x0010
-+#define AR531X_ISR_UART0DMA	0x0020
-+#define AR531X_ISR_WD		0x0040
-+#define AR531X_ISR_LOCAL	0x0080
-+
-+/* AR531X_RESET register bit field definitions */
-+#define AR531X_RESET_SYSTEM     0x00000001  /* cold reset full system */
-+#define AR531X_RESET_PROC       0x00000002  /* cold reset MIPS core */
-+#define AR531X_RESET_WLAN0      0x00000004  /* cold reset WLAN MAC and BB */
-+#define AR531X_RESET_EPHY0      0x00000008  /* cold reset ENET0 phy */
-+#define AR531X_RESET_EPHY1      0x00000010  /* cold reset ENET1 phy */
-+#define AR531X_RESET_ENET0      0x00000020  /* cold reset ENET0 mac */
-+#define AR531X_RESET_ENET1      0x00000040  /* cold reset ENET1 mac */
-+#define AR531X_RESET_UART0      0x00000100  /* cold reset UART0 (high speed) */
-+#define AR531X_RESET_WLAN1      0x00000200  /* cold reset WLAN MAC/BB */
-+#define AR531X_RESET_APB        0x00000400  /* cold reset APB (ar5312) */
-+#define AR531X_RESET_WARM_PROC  0x00001000  /* warm reset MIPS core */
-+#define AR531X_RESET_WARM_WLAN0_MAC 0x00002000  /* warm reset WLAN0 MAC */
-+#define AR531X_RESET_WARM_WLAN0_BB  0x00004000  /* warm reset WLAN0 BaseBand */
-+#define AR531X_RESET_NMI        0x00010000  /* send an NMI to the processor */
-+#define AR531X_RESET_WARM_WLAN1_MAC 0x00020000  /* warm reset WLAN1 mac */
-+#define AR531X_RESET_WARM_WLAN1_BB  0x00040000  /* warm reset WLAN1 baseband */
-+#define AR531X_RESET_LOCAL_BUS  0x00080000  /* reset local bus */
-+#define AR531X_RESET_WDOG       0x00100000  /* last reset was a watchdog */
-+
-+#define AR531X_RESET_WMAC0_BITS \
-+        AR531X_RESET_WLAN0 |\
-+        AR531X_RESET_WARM_WLAN0_MAC |\
-+        AR531X_RESET_WARM_WLAN0_BB
-+
-+#define AR531X_RESERT_WMAC1_BITS \
-+        AR531X_RESET_WLAN1 |\
-+        AR531X_RESET_WARM_WLAN1_MAC |\
-+        AR531X_RESET_WARM_WLAN1_BB
-+
-+/* AR5312_CLOCKCTL1 register bit field definitions */
-+#define AR5312_CLOCKCTL1_PREDIVIDE_MASK    0x00000030
-+#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT            4
-+#define AR5312_CLOCKCTL1_MULTIPLIER_MASK   0x00001f00
-+#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT           8
-+#define AR5312_CLOCKCTL1_DOUBLER_MASK      0x00010000
-+
-+/* Valid for AR5312 and AR2312 */
-+#define AR5312_CLOCKCTL1_PREDIVIDE_MASK    0x00000030
-+#define AR5312_CLOCKCTL1_PREDIVIDE_SHIFT            4
-+#define AR5312_CLOCKCTL1_MULTIPLIER_MASK   0x00001f00
-+#define AR5312_CLOCKCTL1_MULTIPLIER_SHIFT           8
-+#define AR5312_CLOCKCTL1_DOUBLER_MASK      0x00010000
-+
-+/* Valid for AR2313 */
-+#define AR2313_CLOCKCTL1_PREDIVIDE_MASK    0x00003000
-+#define AR2313_CLOCKCTL1_PREDIVIDE_SHIFT           12
-+#define AR2313_CLOCKCTL1_MULTIPLIER_MASK   0x001f0000
-+#define AR2313_CLOCKCTL1_MULTIPLIER_SHIFT          16
-+#define AR2313_CLOCKCTL1_DOUBLER_MASK      0x00000000
-+
-+
-+/* AR531X_ENABLE register bit field definitions */
-+#define AR531X_ENABLE_WLAN0              0x0001
-+#define AR531X_ENABLE_ENET0              0x0002
-+#define AR531X_ENABLE_ENET1              0x0004
-+#define AR531X_ENABLE_UART_AND_WLAN1_PIO 0x0008   /* UART, and WLAN1 PIOs */
-+#define AR531X_ENABLE_WLAN1_DMA          0x0010   /* WLAN1 DMAs */
-+#define AR531X_ENABLE_WLAN1 \
-+            (AR531X_ENABLE_UART_AND_WLAN1_PIO | AR531X_ENABLE_WLAN1_DMA)
-+
-+/* AR531X_REV register bit field definitions */
-+#define AR531X_REV_WMAC_MAJ    0xf000
-+#define AR531X_REV_WMAC_MAJ_S  12
-+#define AR531X_REV_WMAC_MIN    0x0f00
-+#define AR531X_REV_WMAC_MIN_S  8
-+#define AR531X_REV_MAJ         0x00f0
-+#define AR531X_REV_MAJ_S       4
-+#define AR531X_REV_MIN         0x000f
-+#define AR531X_REV_MIN_S       0
-+#define AR531X_REV_CHIP        (AR531X_REV_MAJ|AR531X_REV_MIN)
-+
-+/* Major revision numbers, bits 7..4 of Revision ID register */
-+#define AR531X_REV_MAJ_AR5312          0x4
-+#define AR531X_REV_MAJ_AR2313          0x5
-+
-+/* Minor revision numbers, bits 3..0 of Revision ID register */
-+#define AR5312_REV_MIN_DUAL     0x0     /* Dual WLAN version */
-+#define AR5312_REV_MIN_SINGLE   0x1     /* Single WLAN version */
-+
-+/* AR531X_FLASHCTL register bit field definitions */
-+#define FLASHCTL_IDCY   0x0000000f      /* Idle cycle turn around time */
-+#define FLASHCTL_IDCY_S 0
-+#define FLASHCTL_WST1   0x000003e0      /* Wait state 1 */
-+#define FLASHCTL_WST1_S 5
-+#define FLASHCTL_RBLE   0x00000400      /* Read byte lane enable */
-+#define FLASHCTL_WST2   0x0000f800      /* Wait state 2 */
-+#define FLASHCTL_WST2_S 11
-+#define FLASHCTL_AC     0x00070000      /* Flash address check (added) */
-+#define FLASHCTL_AC_S   16
-+#define FLASHCTL_AC_128K 0x00000000
-+#define FLASHCTL_AC_256K 0x00010000
-+#define FLASHCTL_AC_512K 0x00020000
-+#define FLASHCTL_AC_1M   0x00030000
-+#define FLASHCTL_AC_2M   0x00040000
-+#define FLASHCTL_AC_4M   0x00050000
-+#define FLASHCTL_AC_8M   0x00060000
-+#define FLASHCTL_AC_RES  0x00070000     /* 16MB is not supported */
-+#define FLASHCTL_E      0x00080000      /* Flash bank enable (added) */
-+#define FLASHCTL_BUSERR 0x01000000      /* Bus transfer error status flag */
-+#define FLASHCTL_WPERR  0x02000000      /* Write protect error status flag */
-+#define FLASHCTL_WP     0x04000000      /* Write protect */
-+#define FLASHCTL_BM     0x08000000      /* Burst mode */
-+#define FLASHCTL_MW     0x30000000      /* Memory width */
-+#define FLASHCTL_MWx8   0x00000000      /* Memory width x8 */
-+#define FLASHCTL_MWx16  0x10000000      /* Memory width x16 */
-+#define FLASHCTL_MWx32  0x20000000      /* Memory width x32 (not supported) */
-+#define FLASHCTL_ATNR   0x00000000      /* Access type == no retry */
-+#define FLASHCTL_ATR    0x80000000      /* Access type == retry every */
-+#define FLASHCTL_ATR4   0xc0000000      /* Access type == retry every 4 */
-+
-+/* ARM Flash Controller -- 3 flash banks with either x8 or x16 devices.  */
-+#define AR531X_FLASHCTL0        (AR531X_FLASHCTL + 0x00)
-+#define AR531X_FLASHCTL1        (AR531X_FLASHCTL + 0x04)
-+#define AR531X_FLASHCTL2        (AR531X_FLASHCTL + 0x08)
-+
-+/* ARM SDRAM Controller -- just enough to determine memory size */
-+#define AR531X_MEM_CFG1 (AR531X_SDRAMCTL + 0x04)
-+#define MEM_CFG1_AC0    0x00000700      /* bank 0: SDRAM addr check (added) */
-+#define MEM_CFG1_AC0_S  8
-+#define MEM_CFG1_AC1    0x00007000      /* bank 1: SDRAM addr check (added) */
-+#define MEM_CFG1_AC1_S  12
-+
-+/* GPIO Address Map */
-+#define AR531X_GPIO         (AR531X_APBBASE  + 0x2000)
-+#define AR531X_GPIO_DO      (AR531X_GPIO + 0x00)        /* output register */
-+#define AR531X_GPIO_DI      (AR531X_GPIO + 0x04)        /* intput register */
-+#define AR531X_GPIO_CR      (AR531X_GPIO + 0x08)        /* control register */
-+
-+/* GPIO Control Register bit field definitions */
-+#define AR531X_GPIO_CR_M(x)    (1 << (x))                      /* mask for i/o */
-+#define AR531X_GPIO_CR_O(x)    (0 << (x))                      /* mask for output */
-+#define AR531X_GPIO_CR_I(x)    (1 << (x))                      /* mask for input */
-+#define AR531X_GPIO_CR_INT(x)  (1 << ((x)+8))                  /* mask for interrupt */
-+#define AR531X_GPIO_CR_UART(x) (1 << ((x)+16))                 /* uart multiplex */
-+#define AR531X_NUM_GPIO		8
-+
-+
-+#endif
-+
---- /dev/null
-+++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,549 @@
-+/*
-+ * 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 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+ */
-+
-+/*
-+ * Platform devices for Atheros SoCs
-+ */
-+
-+#include <generated/autoconf.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/string.h>
-+#include <linux/mtd/physmap.h>
-+#include <linux/platform_device.h>
-+#include <linux/kernel.h>
-+#include <linux/reboot.h>
-+#include <linux/leds.h>
-+#include <asm/bootinfo.h>
-+#include <asm/reboot.h>
-+#include <asm/time.h>
-+#include <asm/irq.h>
-+#include <asm/io.h>
-+#include <gpio.h>
-+
-+#include <ar231x_platform.h>
-+#include <ar5312_regs.h>
-+#include <ar231x.h>
-+#include "devices.h"
-+#include "ar5312.h"
-+
-+static void
-+ar5312_misc_irq_dispatch(void)
-+{
-+	unsigned int ar231x_misc_intrs = ar231x_read_reg(AR531X_ISR) & ar231x_read_reg(AR531X_IMR);
-+
-+	if (ar231x_misc_intrs & AR531X_ISR_TIMER) {
-+		do_IRQ(AR531X_MISC_IRQ_TIMER);
-+		(void)ar231x_read_reg(AR531X_TIMER);
-+	} else if (ar231x_misc_intrs & AR531X_ISR_AHBPROC)
-+		do_IRQ(AR531X_MISC_IRQ_AHB_PROC);
-+	else if ((ar231x_misc_intrs & AR531X_ISR_UART0))
-+		do_IRQ(AR531X_MISC_IRQ_UART0);
-+	else if (ar231x_misc_intrs & AR531X_ISR_WD)
-+		do_IRQ(AR531X_MISC_IRQ_WATCHDOG);
-+	else
-+		do_IRQ(AR531X_MISC_IRQ_NONE);
-+}
-+
-+static asmlinkage void
-+ar5312_irq_dispatch(void)
-+{
-+	int pending = read_c0_status() & read_c0_cause();
-+
-+	if (pending & CAUSEF_IP2)
-+		do_IRQ(AR5312_IRQ_WLAN0_INTRS);
-+	else if (pending & CAUSEF_IP3)
-+		do_IRQ(AR5312_IRQ_ENET0_INTRS);
-+	else if (pending & CAUSEF_IP4)
-+		do_IRQ(AR5312_IRQ_ENET1_INTRS);
-+	else if (pending & CAUSEF_IP5)
-+		do_IRQ(AR5312_IRQ_WLAN1_INTRS);
-+	else if (pending & CAUSEF_IP6)
-+		ar5312_misc_irq_dispatch();
-+	else if (pending & CAUSEF_IP7)
-+		do_IRQ(AR531X_IRQ_CPU_CLOCK);
-+}
-+
-+
-+/* Enable the specified AR531X_MISC_IRQ interrupt */
-+static void
-+ar5312_misc_intr_enable(unsigned int irq)
-+{
-+	unsigned int imr;
-+
-+	imr = ar231x_read_reg(AR531X_IMR);
-+	imr |= (1 << (irq - AR531X_MISC_IRQ_BASE - 1));
-+	ar231x_write_reg(AR531X_IMR, imr);
-+}
-+
-+/* Disable the specified AR531X_MISC_IRQ interrupt */
-+static void
-+ar5312_misc_intr_disable(unsigned int irq)
-+{
-+	unsigned int imr;
-+
-+	imr = ar231x_read_reg(AR531X_IMR);
-+	imr &= ~(1 << (irq - AR531X_MISC_IRQ_BASE - 1));
-+	ar231x_write_reg(AR531X_IMR, imr);
-+	ar231x_read_reg(AR531X_IMR); /* flush write buffer */
-+}
-+
-+static void
-+ar5312_misc_intr_end(unsigned int irq)
-+{
-+	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-+		ar5312_misc_intr_enable(irq);
-+}
-+
-+static struct irq_chip ar5312_misc_intr_controller = {
-+	.name     = "AR5312-MISC",
-+	.disable  = ar5312_misc_intr_disable,
-+	.ack      = ar5312_misc_intr_disable,
-+	.mask_ack = ar5312_misc_intr_disable,
-+	.mask     = ar5312_misc_intr_disable,
-+	.unmask   = ar5312_misc_intr_enable,
-+	.end      = ar5312_misc_intr_end,
-+};
-+
-+
-+static irqreturn_t ar5312_ahb_proc_handler(int cpl, void *dev_id)
-+{
-+	u32 proc1 = ar231x_read_reg(AR531X_PROC1);
-+	u32 procAddr = ar231x_read_reg(AR531X_PROCADDR); /* clears error state */
-+	u32 dma1 = ar231x_read_reg(AR531X_DMA1);
-+	u32 dmaAddr = ar231x_read_reg(AR531X_DMAADDR);   /* clears error state */
-+
-+	printk("AHB interrupt: PROCADDR=0x%8.8x  PROC1=0x%8.8x  DMAADDR=0x%8.8x  DMA1=0x%8.8x\n",
-+			procAddr, proc1, dmaAddr, dma1);
-+
-+	machine_restart("AHB error"); /* Catastrophic failure */
-+	return IRQ_HANDLED;
-+}
-+
-+
-+static struct irqaction ar5312_ahb_proc_interrupt  = {
-+	.handler = ar5312_ahb_proc_handler,
-+	.flags   = IRQF_DISABLED,
-+	.name    = "ar5312_ahb_proc_interrupt",
-+};
-+
-+
-+static struct irqaction cascade  = {
-+	.handler = no_action,
-+	.flags   = IRQF_DISABLED,
-+	.name    = "cascade",
-+};
-+
-+void __init ar5312_irq_init(void)
-+{
-+	int i;
-+
-+	if (!is_5312())
-+		return;
-+
-+	ar231x_irq_dispatch = ar5312_irq_dispatch;
-+	for (i = 0; i < AR531X_MISC_IRQ_COUNT; i++) {
-+		int irq = AR531X_MISC_IRQ_BASE + i;
-+		set_irq_chip_and_handler(irq, &ar5312_misc_intr_controller,
-+			handle_level_irq);
-+	}
-+	setup_irq(AR531X_MISC_IRQ_AHB_PROC, &ar5312_ahb_proc_interrupt);
-+	setup_irq(AR5312_IRQ_MISC_INTRS, &cascade);
-+}
-+
-+const struct ar231x_gpiodev ar5312_gpiodev;
-+
-+static u32
-+ar5312_gpio_get_output(void)
-+{
-+	u32 reg;
-+	reg = ~(ar231x_read_reg(AR531X_GPIO_CR));
-+	reg &= ar5312_gpiodev.valid_mask;
-+	return reg;
-+}
-+
-+static u32
-+ar5312_gpio_set_output(u32 mask, u32 val)
-+{
-+	u32 reg;
-+
-+	reg = ar231x_read_reg(AR531X_GPIO_CR);
-+	reg |= mask;
-+	reg &= ~val;
-+	ar231x_write_reg(AR531X_GPIO_CR, reg);
-+	return reg;
-+}
-+
-+static u32
-+ar5312_gpio_get(void)
-+{
-+	u32 reg;
-+	reg = ar231x_read_reg(AR531X_GPIO_DI);
-+	reg &= ar5312_gpiodev.valid_mask;
-+	return reg;
-+}
-+
-+static u32
-+ar5312_gpio_set(u32 mask, u32 value)
-+{
-+	u32 reg;
-+	reg = ar231x_read_reg(AR531X_GPIO_DO);
-+	reg &= ~mask;
-+	reg |= value;
-+	ar231x_write_reg(AR531X_GPIO_DO, reg);
-+	return reg;
-+}
-+
-+const struct ar231x_gpiodev ar5312_gpiodev = {
-+	.valid_mask = (1 << 8) - 1,
-+	.get_output = ar5312_gpio_get_output,
-+	.set_output = ar5312_gpio_set_output,
-+	.get = ar5312_gpio_get,
-+	.set = ar5312_gpio_set,
-+};
-+
-+static struct physmap_flash_data ar5312_flash_data = {
-+	.width = 2,
-+};
-+
-+static struct resource ar5312_flash_resource = {
-+	.start = AR531X_FLASH,
-+	.end = AR531X_FLASH + 0x800000 - 1,
-+	.flags = IORESOURCE_MEM,
-+};
-+
-+static struct ar231x_eth ar5312_eth0_data = {
-+	.reset_base = AR531X_RESET,
-+	.reset_mac = AR531X_RESET_ENET0,
-+	.reset_phy = AR531X_RESET_EPHY0,
-+	.phy_base = KSEG1ADDR(AR531X_ENET0),
-+	.config = &ar231x_board,
-+};
-+
-+static struct ar231x_eth ar5312_eth1_data = {
-+	.reset_base = AR531X_RESET,
-+	.reset_mac = AR531X_RESET_ENET1,
-+	.reset_phy = AR531X_RESET_EPHY1,
-+	.phy_base = KSEG1ADDR(AR531X_ENET1),
-+	.config = &ar231x_board,
-+};
-+
-+static struct platform_device ar5312_physmap_flash = {
-+	.name = "physmap-flash",
-+	.id = 0,
-+	.dev.platform_data = &ar5312_flash_data,
-+	.resource = &ar5312_flash_resource,
-+	.num_resources = 1,
-+};
-+
-+#ifdef CONFIG_LEDS_GPIO
-+static struct gpio_led ar5312_leds[] = {
-+	{ .name = "wlan", .gpio = 0, .active_low = 1, },
-+};
-+
-+static const struct gpio_led_platform_data ar5312_led_data = {
-+	.num_leds = ARRAY_SIZE(ar5312_leds),
-+	.leds = (void *) ar5312_leds,
-+};
-+
-+static struct platform_device ar5312_gpio_leds = {
-+	.name = "leds-gpio",
-+	.id = -1,
-+	.dev.platform_data = (void *) &ar5312_led_data,
-+};
-+#endif
-+
-+/*
-+ * NB: This mapping size is larger than the actual flash size,
-+ * but this shouldn't be a problem here, because the flash
-+ * will simply be mapped multiple times.
-+ */
-+static char __init *ar5312_flash_limit(void)
-+{
-+	u32 ctl;
-+	/*
-+	 * Configure flash bank 0.
-+	 * Assume 8M window size. Flash will be aliased if it's smaller
-+	 */
-+	ctl = FLASHCTL_E |
-+		FLASHCTL_AC_8M |
-+		FLASHCTL_RBLE |
-+		(0x01 << FLASHCTL_IDCY_S) |
-+		(0x07 << FLASHCTL_WST1_S) |
-+		(0x07 << FLASHCTL_WST2_S) |
-+		(ar231x_read_reg(AR531X_FLASHCTL0) & FLASHCTL_MW);
-+
-+	ar231x_write_reg(AR531X_FLASHCTL0, ctl);
-+
-+	/* Disable other flash banks */
-+	ar231x_write_reg(AR531X_FLASHCTL1,
-+		ar231x_read_reg(AR531X_FLASHCTL1) & ~(FLASHCTL_E | FLASHCTL_AC));
-+
-+	ar231x_write_reg(AR531X_FLASHCTL2,
-+		ar231x_read_reg(AR531X_FLASHCTL2) & ~(FLASHCTL_E | FLASHCTL_AC));
-+
-+	return (char *) KSEG1ADDR(AR531X_FLASH + 0x800000);
-+}
-+
-+int __init ar5312_init_devices(void)
-+{
-+	struct ar231x_boarddata *config;
-+	u32 fctl = 0;
-+	const u8 *radio;
-+	u8 *c;
-+
-+	if (!is_5312())
-+		return 0;
-+
-+	/* Locate board/radio config data */
-+	ar231x_find_config(ar5312_flash_limit());
-+	config = ar231x_board.config;
-+
-+
-+	/*
-+	 * Chip IDs and hardware detection for some Atheros
-+	 * models are really broken!
-+	 *
-+	 * Atheros uses a disabled WMAC0 and Silicon ID of AR5312
-+	 * as indication for AR2312, which is otherwise
-+	 * indistinguishable from the real AR5312.
-+	 */
-+	if (ar231x_board.radio) {
-+		radio = ar231x_board.radio + AR531X_RADIO_MASK_OFF;
-+		if ((*((const u32 *) radio) & AR531X_RADIO0_MASK) == 0)
-+			config->flags |= BD_ISCASPER;
-+	} else
-+		radio = NULL;
-+
-+	/* AR2313 has CPU minor rev. 10 */
-+	if ((current_cpu_data.processor_id & 0xff) == 0x0a)
-+		ar231x_devtype = DEV_TYPE_AR2313;
-+
-+	/* AR2312 shares the same Silicon ID as AR5312 */
-+	else if (config->flags & BD_ISCASPER)
-+		ar231x_devtype = DEV_TYPE_AR2312;
-+
-+	/* Everything else is probably AR5312 or compatible */
-+	else
-+		ar231x_devtype = DEV_TYPE_AR5312;
-+
-+	/* fixup flash width */
-+	fctl = ar231x_read_reg(AR531X_FLASHCTL) & FLASHCTL_MW;
-+	switch (fctl) {
-+	case FLASHCTL_MWx16:
-+		ar5312_flash_data.width = 2;
-+		break;
-+	case FLASHCTL_MWx8:
-+	default:
-+		ar5312_flash_data.width = 1;
-+		break;
-+	}
-+
-+	platform_device_register(&ar5312_physmap_flash);
-+
-+#ifdef CONFIG_LEDS_GPIO
-+	ar5312_leds[0].gpio = config->sysLedGpio;
-+	platform_device_register(&ar5312_gpio_leds);
-+#endif
-+
-+	/* Fix up MAC addresses if necessary */
-+	if (!memcmp(config->enet0_mac, "\xff\xff\xff\xff\xff\xff", 6))
-+		memcpy(config->enet0_mac, config->enet1_mac, 6);
-+
-+	/* If ENET0 and ENET1 have the same mac address,
-+	 * increment the one from ENET1 */
-+	if (memcmp(config->enet0_mac, config->enet1_mac, 6) == 0) {
-+		c = config->enet1_mac + 5;
-+		while ((c >= config->enet1_mac) && !(++(*c)))
-+			c--;
-+	}
-+
-+	switch(ar231x_devtype) {
-+	case DEV_TYPE_AR5312:
-+		ar5312_eth0_data.macaddr = config->enet0_mac;
-+		ar231x_add_ethernet(0, KSEG1ADDR(AR531X_ENET0),
-+			AR5312_IRQ_ENET0_INTRS, &ar5312_eth0_data);
-+
-+		ar5312_eth1_data.macaddr = config->enet1_mac;
-+		ar231x_add_ethernet(1, KSEG1ADDR(AR531X_ENET1),
-+			AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
-+
-+		if (!ar231x_board.radio)
-+			return 0;
-+
-+		if ((*((u32 *) radio) & AR531X_RADIO0_MASK) &&
-+		    (config->flags & BD_WLAN0))
-+			ar231x_add_wmac(0, AR531X_WLAN0,
-+				AR5312_IRQ_WLAN0_INTRS);
-+
-+		break;
-+	/*
-+	 * AR2312/3 ethernet uses the PHY of ENET0, but the MAC
-+	 * of ENET1. Atheros calls it 'twisted' for a reason :)
-+	 */
-+	case DEV_TYPE_AR2312:
-+	case DEV_TYPE_AR2313:
-+		ar5312_eth1_data.phy_base = ar5312_eth0_data.phy_base;
-+		ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
-+		ar5312_eth1_data.macaddr = config->enet0_mac;
-+		ar231x_add_ethernet(0, KSEG1ADDR(AR531X_ENET1),
-+			AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
-+
-+		if (!ar231x_board.radio)
-+			return 0;
-+		break;
-+	default:
-+		break;
-+	}
-+
-+	if ((*((u32 *) radio) & AR531X_RADIO1_MASK) &&
-+	    (config->flags & BD_WLAN1))
-+		ar231x_add_wmac(1, AR531X_WLAN1,
-+			AR5312_IRQ_WLAN1_INTRS);
-+
-+	return 0;
-+}
-+
-+
-+static void ar5312_restart(char *command)
-+{
-+	/* reset the system */
-+	local_irq_disable();
-+	while(1) {
-+		ar231x_write_reg(AR531X_RESET, AR531X_RESET_SYSTEM);
-+	}
-+}
-+
-+
-+/*
-+ * This table is indexed by bits 5..4 of the CLOCKCTL1 register
-+ * to determine the predevisor value.
-+ */
-+static int __initdata CLOCKCTL1_PREDIVIDE_TABLE[4] = { 1, 2, 4, 5 };
-+
-+
-+static int __init
-+ar5312_cpu_frequency(void)
-+{
-+	unsigned int result;
-+	unsigned int predivide_mask, predivide_shift;
-+	unsigned int multiplier_mask, multiplier_shift;
-+	unsigned int clockCtl1, preDivideSelect, preDivisor, multiplier;
-+	unsigned int doubler_mask;
-+	u16 devid;
-+
-+	/* Trust the bootrom's idea of cpu frequency. */
-+	if ((result = ar231x_read_reg(AR5312_SCRATCH)))
-+		return result;
-+
-+	devid = ar231x_read_reg(AR531X_REV);
-+	devid &= AR531X_REV_MAJ;
-+	devid >>= AR531X_REV_MAJ_S;
-+	if (devid == AR531X_REV_MAJ_AR2313) {
-+		predivide_mask = AR2313_CLOCKCTL1_PREDIVIDE_MASK;
-+		predivide_shift = AR2313_CLOCKCTL1_PREDIVIDE_SHIFT;
-+		multiplier_mask = AR2313_CLOCKCTL1_MULTIPLIER_MASK;
-+		multiplier_shift = AR2313_CLOCKCTL1_MULTIPLIER_SHIFT;
-+		doubler_mask = AR2313_CLOCKCTL1_DOUBLER_MASK;
-+	} else { /* AR5312 and AR2312 */
-+		predivide_mask = AR5312_CLOCKCTL1_PREDIVIDE_MASK;
-+		predivide_shift = AR5312_CLOCKCTL1_PREDIVIDE_SHIFT;
-+		multiplier_mask = AR5312_CLOCKCTL1_MULTIPLIER_MASK;
-+		multiplier_shift = AR5312_CLOCKCTL1_MULTIPLIER_SHIFT;
-+		doubler_mask = AR5312_CLOCKCTL1_DOUBLER_MASK;
-+	}
-+
-+	/*
-+	 * Clocking is derived from a fixed 40MHz input clock.
-+	 *
-+	 *  cpuFreq = InputClock * MULT (where MULT is PLL multiplier)
-+	 *  sysFreq = cpuFreq / 4	   (used for APB clock, serial,
-+	 *							   flash, Timer, Watchdog Timer)
-+	 *
-+	 *  cntFreq = cpuFreq / 2	   (use for CPU count/compare)
-+	 *
-+	 * So, for example, with a PLL multiplier of 5, we have
-+	 *
-+	 *  cpuFreq = 200MHz
-+	 *  sysFreq = 50MHz
-+	 *  cntFreq = 100MHz
-+	 *
-+	 * We compute the CPU frequency, based on PLL settings.
-+	 */
-+
-+	clockCtl1 = ar231x_read_reg(AR5312_CLOCKCTL1);
-+	preDivideSelect = (clockCtl1 & predivide_mask) >> predivide_shift;
-+	preDivisor = CLOCKCTL1_PREDIVIDE_TABLE[preDivideSelect];
-+	multiplier = (clockCtl1 & multiplier_mask) >> multiplier_shift;
-+
-+	if (clockCtl1 & doubler_mask) {
-+		multiplier = multiplier << 1;
-+	}
-+	return (40000000 / preDivisor) * multiplier;
-+}
-+
-+static inline int
-+ar5312_sys_frequency(void)
-+{
-+	return ar5312_cpu_frequency() / 4;
-+}
-+
-+void __init
-+ar5312_time_init(void)
-+{
-+	if (!is_5312())
-+		return;
-+
-+	mips_hpt_frequency = ar5312_cpu_frequency() / 2;
-+}
-+
-+
-+void __init
-+ar5312_prom_init(void)
-+{
-+	u32 memsize, memcfg, bank0AC, bank1AC;
-+	u32 devid;
-+
-+	if (!is_5312())
-+		return;
-+
-+	/* Detect memory size */
-+	memcfg = ar231x_read_reg(AR531X_MEM_CFG1);
-+	bank0AC = (memcfg & MEM_CFG1_AC0) >> MEM_CFG1_AC0_S;
-+	bank1AC = (memcfg & MEM_CFG1_AC1) >> MEM_CFG1_AC1_S;
-+	memsize = (bank0AC ? (1 << (bank0AC+1)) : 0)
-+	        + (bank1AC ? (1 << (bank1AC+1)) : 0);
-+	memsize <<= 20;
-+	add_memory_region(0, memsize, BOOT_MEM_RAM);
-+
-+	devid = ar231x_read_reg(AR531X_REV);
-+	devid >>= AR531X_REV_WMAC_MIN_S;
-+	devid &= AR531X_REV_CHIP;
-+	ar231x_board.devid = (u16) devid;
-+	ar231x_gpiodev = &ar5312_gpiodev;
-+}
-+
-+void __init
-+ar5312_plat_setup(void)
-+{
-+	if (!is_5312())
-+		return;
-+
-+	/* Clear any lingering AHB errors */
-+	ar231x_read_reg(AR531X_PROCADDR);
-+	ar231x_read_reg(AR531X_DMAADDR);
-+	ar231x_write_reg(AR531X_WD_CTRL, AR531X_WD_CTRL_IGNORE_EXPIRATION);
-+
-+	_machine_restart = ar5312_restart;
-+	ar231x_serial_setup(KSEG1ADDR(AR531X_UART0), ar5312_sys_frequency());
-+}
-+
---- /dev/null
-+++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,658 @@
-+/*
-+ * 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 Atheros Communications, Inc.,  All Rights Reserved.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006 Felix Fietkau <[email protected]>
-+ */
-+
-+/*
-+ * Platform devices for Atheros SoCs
-+ */
-+
-+#include <generated/autoconf.h>
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/string.h>
-+#include <linux/platform_device.h>
-+#include <linux/kernel.h>
-+#include <linux/reboot.h>
-+#include <linux/delay.h>
-+#include <linux/leds.h>
-+#include <asm/bootinfo.h>
-+#include <asm/reboot.h>
-+#include <asm/time.h>
-+#include <asm/irq.h>
-+#include <asm/io.h>
-+#include <asm/gpio.h>
-+
-+#include <ar231x_platform.h>
-+#include <ar2315_regs.h>
-+#include <ar231x.h>
-+#include "devices.h"
-+#include "ar2315.h"
-+
-+static u32 gpiointmask = 0, gpiointval = 0;
-+
-+static inline void ar2315_gpio_irq(void)
-+{
-+	u32 pend;
-+	int bit = -1;
-+
-+	/* only do one gpio interrupt at a time */
-+	pend = (ar231x_read_reg(AR2315_GPIO_DI) ^ gpiointval) & gpiointmask;
-+
-+	if (pend) {
-+		bit = fls(pend) - 1;
-+		pend &= ~(1 << bit);
-+		gpiointval ^= (1 << bit);
-+	}
-+
-+	if (!pend)
-+		ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO);
-+
-+	/* Enable interrupt with edge detection */
-+	if ((ar231x_read_reg(AR2315_GPIO_CR) & AR2315_GPIO_CR_M(bit)) != AR2315_GPIO_CR_I(bit))
-+		return;
-+
-+	if (bit >= 0)
-+		do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
-+}
-+
-+
-+/*
-+ * Called when an interrupt is received, this function
-+ * determines exactly which interrupt it was, and it
-+ * invokes the appropriate handler.
-+ *
-+ * Implicitly, we also define interrupt priority by
-+ * choosing which to dispatch first.
-+ */
-+static asmlinkage void
-+ar2315_irq_dispatch(void)
-+{
-+	int pending = read_c0_status() & read_c0_cause();
-+
-+	if (pending & CAUSEF_IP3)
-+		do_IRQ(AR2315_IRQ_WLAN0_INTRS);
-+	else if (pending & CAUSEF_IP4)
-+		do_IRQ(AR2315_IRQ_ENET0_INTRS);
-+	else if (pending & CAUSEF_IP2) {
-+		unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) & ar231x_read_reg(AR2315_IMR);
-+
-+		if (misc_intr & AR2315_ISR_SPI)
-+			do_IRQ(AR531X_MISC_IRQ_SPI);
-+		else if (misc_intr & AR2315_ISR_TIMER)
-+			do_IRQ(AR531X_MISC_IRQ_TIMER);
-+		else if (misc_intr & AR2315_ISR_AHB)
-+			do_IRQ(AR531X_MISC_IRQ_AHB_PROC);
-+		else if (misc_intr & AR2315_ISR_GPIO)
-+			ar2315_gpio_irq();
-+		else if (misc_intr & AR2315_ISR_UART0)
-+			do_IRQ(AR531X_MISC_IRQ_UART0);
-+		else if (misc_intr & AR2315_ISR_WD)
-+			do_IRQ(AR531X_MISC_IRQ_WATCHDOG);
-+		else
-+			do_IRQ(AR531X_MISC_IRQ_NONE);
-+	} else if (pending & CAUSEF_IP7)
-+		do_IRQ(AR531X_IRQ_CPU_CLOCK);
-+}
-+
-+static void ar2315_set_gpiointmask(int gpio, int level)
-+{
-+	u32 reg;
-+
-+	reg = ar231x_read_reg(AR2315_GPIO_INT);
-+	reg &= ~(AR2315_GPIO_INT_M | AR2315_GPIO_INT_LVL_M);
-+	reg |= gpio | AR2315_GPIO_INT_LVL(level);
-+	ar231x_write_reg(AR2315_GPIO_INT, reg);
-+}
-+
-+static void ar2315_gpio_intr_enable(unsigned int irq)
-+{
-+	unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
-+
-+	/* Enable interrupt with edge detection */
-+	if ((ar231x_read_reg(AR2315_GPIO_CR) & AR2315_GPIO_CR_M(gpio)) != AR2315_GPIO_CR_I(gpio))
-+		return;
-+
-+	gpiointmask |= (1 << gpio);
-+	ar2315_set_gpiointmask(gpio, 3);
-+}
-+
-+static unsigned int ar2315_gpio_intr_startup(unsigned int irq)
-+{
-+	unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
-+
-+	/* reconfigure GPIO line as input */
-+	ar231x_mask_reg(AR2315_GPIO_CR, AR2315_GPIO_CR_M(gpio), AR2315_GPIO_CR_I(gpio));
-+	ar2315_gpio_intr_enable(irq);
-+	return 0;
-+}
-+
-+static void ar2315_gpio_intr_disable(unsigned int irq)
-+{
-+	unsigned int gpio = irq - AR531X_GPIO_IRQ_BASE;
-+
-+	/* Disable interrupt */
-+	gpiointmask &= ~(1 << gpio);
-+	ar2315_set_gpiointmask(gpio, 0);
-+}
-+
-+static void
-+ar2315_gpio_intr_end(unsigned int irq)
-+{
-+	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-+		ar2315_gpio_intr_enable(irq);
-+}
-+
-+static struct irq_chip ar2315_gpio_intr_controller = {
-+	.typename	= "AR2315-GPIO",
-+	.startup  = ar2315_gpio_intr_startup,
-+	.ack      = ar2315_gpio_intr_disable,
-+	.mask_ack = ar2315_gpio_intr_disable,
-+	.mask     = ar2315_gpio_intr_disable,
-+	.unmask   = ar2315_gpio_intr_enable,
-+	.end      = ar2315_gpio_intr_end,
-+};
-+
-+static void
-+ar2315_misc_intr_enable(unsigned int irq)
-+{
-+	unsigned int imr;
-+
-+	imr = ar231x_read_reg(AR2315_IMR);
-+	switch(irq) {
-+	case AR531X_MISC_IRQ_SPI:
-+		 imr |= AR2315_ISR_SPI;
-+		 break;
-+	case AR531X_MISC_IRQ_TIMER:
-+	     imr |= AR2315_ISR_TIMER;
-+	     break;
-+	case AR531X_MISC_IRQ_AHB_PROC:
-+	     imr |= AR2315_ISR_AHB;
-+	     break;
-+	case AR531X_MISC_IRQ_GPIO:
-+	     imr |= AR2315_ISR_GPIO;
-+	     break;
-+	case AR531X_MISC_IRQ_UART0:
-+	     imr |= AR2315_ISR_UART0;
-+	     break;
-+	case AR531X_MISC_IRQ_WATCHDOG:
-+	     imr |= AR2315_ISR_WD;
-+	     break;
-+	default:
-+		break;
-+	}
-+	ar231x_write_reg(AR2315_IMR, imr);
-+}
-+
-+static void
-+ar2315_misc_intr_disable(unsigned int irq)
-+{
-+	unsigned int imr;
-+
-+	imr = ar231x_read_reg(AR2315_IMR);
-+	switch(irq) {
-+	case AR531X_MISC_IRQ_SPI:
-+		 imr &= ~AR2315_ISR_SPI;
-+		 break;
-+	case AR531X_MISC_IRQ_TIMER:
-+	     imr &= ~AR2315_ISR_TIMER;
-+	     break;
-+	case AR531X_MISC_IRQ_AHB_PROC:
-+	     imr &= ~AR2315_ISR_AHB;
-+	     break;
-+	case AR531X_MISC_IRQ_GPIO:
-+	     imr &= ~AR2315_ISR_GPIO;
-+	     break;
-+	case AR531X_MISC_IRQ_UART0:
-+	     imr &= ~AR2315_ISR_UART0;
-+	     break;
-+	case AR531X_MISC_IRQ_WATCHDOG:
-+	     imr &= ~AR2315_ISR_WD;
-+	     break;
-+	default:
-+		break;
-+	}
-+	ar231x_write_reg(AR2315_IMR, imr);
-+}
-+
-+static void
-+ar2315_misc_intr_end(unsigned int irq)
-+{
-+	if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-+		ar2315_misc_intr_enable(irq);
-+}
-+
-+
-+static struct irq_chip ar2315_misc_intr_controller = {
-+	.typename	= "AR2315-MISC",
-+	.ack      = ar2315_misc_intr_disable,
-+	.mask_ack = ar2315_misc_intr_disable,
-+	.mask     = ar2315_misc_intr_disable,
-+	.unmask   = ar2315_misc_intr_enable,
-+	.end      = ar2315_misc_intr_end,
-+};
-+
-+static irqreturn_t ar2315_ahb_proc_handler(int cpl, void *dev_id)
-+{
-+    ar231x_write_reg(AR2315_AHB_ERR0, AHB_ERROR_DET);
-+    ar231x_read_reg(AR2315_AHB_ERR1);
-+
-+    printk(KERN_ERR "AHB fatal error\n");
-+    machine_restart("AHB error"); /* Catastrophic failure */
-+
-+    return IRQ_HANDLED;
-+}
-+
-+static struct irqaction ar2315_ahb_proc_interrupt  = {
-+	.handler	= ar2315_ahb_proc_handler,
-+	.flags		= IRQF_DISABLED,
-+	.name		= "ar2315_ahb_proc_interrupt",
-+};
-+
-+static struct irqaction cascade  = {
-+	.handler	= no_action,
-+	.flags		= IRQF_DISABLED,
-+	.name		= "cascade",
-+};
-+
-+void
-+ar2315_irq_init(void)
-+{
-+	int i;
-+
-+	if (!is_2315())
-+		return;
-+
-+	ar231x_irq_dispatch = ar2315_irq_dispatch;
-+	gpiointval = ar231x_read_reg(AR2315_GPIO_DI);
-+	for (i = 0; i < AR531X_MISC_IRQ_COUNT; i++) {
-+		int irq = AR531X_MISC_IRQ_BASE + i;
-+		set_irq_chip_and_handler(irq, &ar2315_misc_intr_controller,
-+			handle_level_irq);
-+	}
-+	for (i = 0; i < AR531X_GPIO_IRQ_COUNT; i++) {
-+		int irq = AR531X_GPIO_IRQ_BASE + i;
-+		set_irq_chip_and_handler(irq, &ar2315_gpio_intr_controller,
-+			handle_level_irq);
-+	}
-+	setup_irq(AR531X_MISC_IRQ_GPIO, &cascade);
-+	setup_irq(AR531X_MISC_IRQ_AHB_PROC, &ar2315_ahb_proc_interrupt);
-+	setup_irq(AR2315_IRQ_MISC_INTRS, &cascade);
-+}
-+
-+const struct ar231x_gpiodev ar2315_gpiodev;
-+
-+static u32
-+ar2315_gpio_get_output(void)
-+{
-+	u32 reg;
-+	reg = ar231x_read_reg(AR2315_GPIO_CR);
-+	reg &= ar2315_gpiodev.valid_mask;
-+	return reg;
-+}
-+
-+static u32
-+ar2315_gpio_set_output(u32 mask, u32 val)
-+{
-+	u32 reg;
-+
-+	reg = ar231x_read_reg(AR2315_GPIO_CR);
-+	reg &= ~mask;
-+	reg |= val;
-+	ar231x_write_reg(AR2315_GPIO_CR, reg);
-+	return reg;
-+}
-+
-+static u32
-+ar2315_gpio_get(void)
-+{
-+	u32 reg;
-+	reg = ar231x_read_reg(AR2315_GPIO_DI);
-+	reg &= ar2315_gpiodev.valid_mask;
-+	return reg;
-+}
-+
-+static u32
-+ar2315_gpio_set(u32 mask, u32 value)
-+{
-+	u32 reg;
-+	reg = ar231x_read_reg(AR2315_GPIO_DO);
-+	reg &= ~mask;
-+	reg |= value;
-+	ar231x_write_reg(AR2315_GPIO_DO, reg);
-+	return reg;
-+}
-+
-+const struct ar231x_gpiodev ar2315_gpiodev = {
-+	.valid_mask = (1 << 22) - 1,
-+	.get_output = ar2315_gpio_get_output,
-+	.set_output = ar2315_gpio_set_output,
-+	.get = ar2315_gpio_get,
-+	.set = ar2315_gpio_set,
-+};
-+
-+static struct ar231x_eth ar2315_eth_data = {
-+	.reset_base = AR2315_RESET,
-+	.reset_mac = AR2315_RESET_ENET0,
-+	.reset_phy = AR2315_RESET_EPHY0,
-+	.phy_base = AR2315_ENET0,
-+	.config = &ar231x_board,
-+};
-+
-+static struct resource ar2315_spiflash_res[] = {
-+	{
-+		.name = "flash_base",
-+		.flags = IORESOURCE_MEM,
-+		.start = KSEG1ADDR(AR2315_SPI_READ),
-+		.end = KSEG1ADDR(AR2315_SPI_READ) + 0x1000000 - 1,
-+	},
-+	{
-+		.name = "flash_regs",
-+		.flags = IORESOURCE_MEM,
-+		.start = 0x11300000,
-+		.end = 0x11300012,
-+	},
-+};
-+
-+static struct platform_device ar2315_spiflash = {
-+	.id = 0,
-+	.name = "spiflash",
-+	.resource = ar2315_spiflash_res,
-+	.num_resources = ARRAY_SIZE(ar2315_spiflash_res)
-+};
-+
-+static struct platform_device ar2315_wdt = {
-+	.id = 0,
-+	.name = "ar2315_wdt",
-+};
-+
-+#define SPI_FLASH_CTL      0x00
-+#define SPI_FLASH_OPCODE   0x04
-+#define SPI_FLASH_DATA     0x08
-+
-+static inline u32
-+spiflash_read_reg(int reg)
-+{
-+	return ar231x_read_reg(KSEG1ADDR(AR2315_SPI) + reg);
-+}
-+
-+static inline void
-+spiflash_write_reg(int reg, u32 data)
-+{
-+	ar231x_write_reg(KSEG1ADDR(AR2315_SPI) + reg, data);
-+}
-+
-+static u32
-+spiflash_wait_status(void)
-+{
-+	u32 reg;
-+
-+	do {
-+		reg = spiflash_read_reg(SPI_FLASH_CTL);
-+	} while (reg & SPI_CTL_BUSY);
-+
-+	return reg;
-+}
-+
-+static u8
-+spiflash_probe(void)
-+{
-+	u32 reg;
-+
-+	reg = spiflash_wait_status();
-+	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+	reg |= (1 << 4) | 4 | SPI_CTL_START;
-+
-+	spiflash_write_reg(SPI_FLASH_OPCODE, 0xab);
-+	spiflash_write_reg(SPI_FLASH_CTL, reg);
-+
-+	reg = spiflash_wait_status();
-+	reg = spiflash_read_reg(SPI_FLASH_DATA);
-+	reg &= 0xff;
-+
-+	return (u8) reg;
-+}
-+
-+
-+#define STM_8MBIT_SIGNATURE     0x13
-+#define STM_16MBIT_SIGNATURE    0x14
-+#define STM_32MBIT_SIGNATURE    0x15
-+#define STM_64MBIT_SIGNATURE    0x16
-+#define STM_128MBIT_SIGNATURE   0x17
-+
-+static u8 __init *
-+ar2315_flash_limit(void)
-+{
-+	u32 flash_size = 0;
-+
-+	/* probe the flash chip size */
-+	switch(spiflash_probe()) {
-+		case STM_8MBIT_SIGNATURE:
-+			flash_size = 0x00100000;
-+			break;
-+		case STM_16MBIT_SIGNATURE:
-+			flash_size = 0x00200000;
-+			break;
-+		case STM_32MBIT_SIGNATURE:
-+			flash_size = 0x00400000;
-+			break;
-+		case STM_64MBIT_SIGNATURE:
-+			flash_size = 0x00800000;
-+			break;
-+		case STM_128MBIT_SIGNATURE:
-+			flash_size = 0x01000000;
-+			break;
-+	}
-+
-+	ar2315_spiflash_res[0].end = ar2315_spiflash_res[0].start +
-+		flash_size - 1;
-+	return (u8 *) ar2315_spiflash_res[0].end + 1;
-+}
-+
-+#ifdef CONFIG_LEDS_GPIO
-+static struct gpio_led ar2315_leds[6];
-+static struct gpio_led_platform_data ar2315_led_data = {
-+	.leds = (void *) ar2315_leds,
-+};
-+
-+static struct platform_device ar2315_gpio_leds = {
-+	.name = "leds-gpio",
-+	.id = -1,
-+	.dev = {
-+		.platform_data = (void *) &ar2315_led_data,
-+	}
-+};
-+
-+static void __init
-+ar2315_init_gpio(void)
-+{
-+	static char led_names[6][6];
-+	int i, led = 0;
-+
-+	ar2315_led_data.num_leds = 0;
-+	for(i = 1; i < 8; i++)
-+	{
-+		if((i == AR2315_RESET_GPIO) ||
-+		   (i == ar231x_board.config->resetConfigGpio))
-+			continue;
-+
-+		if(i == ar231x_board.config->sysLedGpio)
-+			strcpy(led_names[led], "wlan");
-+		else
-+			sprintf(led_names[led], "gpio%d", i);
-+
-+		ar2315_leds[led].name = led_names[led];
-+		ar2315_leds[led].gpio = i;
-+		ar2315_leds[led].active_low = 0;
-+		led++;
-+	}
-+	ar2315_led_data.num_leds = led;
-+	platform_device_register(&ar2315_gpio_leds);
-+}
-+#else
-+static inline void ar2315_init_gpio(void)
-+{
-+}
-+#endif
-+
-+int __init
-+ar2315_init_devices(void)
-+{
-+	if (!is_2315())
-+		return 0;
-+
-+	/* Find board configuration */
-+	ar231x_find_config(ar2315_flash_limit());
-+	ar2315_eth_data.macaddr = ar231x_board.config->enet0_mac;
-+
-+	ar2315_init_gpio();
-+	platform_device_register(&ar2315_wdt);
-+	platform_device_register(&ar2315_spiflash);
-+	ar231x_add_ethernet(0, AR2315_ENET0, AR2315_IRQ_ENET0_INTRS,
-+		&ar2315_eth_data);
-+	ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS);
-+
-+	return 0;
-+}
-+
-+static void
-+ar2315_restart(char *command)
-+{
-+	void (*mips_reset_vec)(void) = (void *) 0xbfc00000;
-+
-+	local_irq_disable();
-+
-+	/* try reset the system via reset control */
-+	ar231x_write_reg(AR2315_COLD_RESET,AR2317_RESET_SYSTEM);
-+
-+	/* Cold reset does not work on the AR2315/6, use the GPIO reset bits a workaround.
-+	 * give it some time to attempt a gpio based hardware reset
-+	 * (atheros reference design workaround) */
-+	gpio_direction_output(AR2315_RESET_GPIO, 0);
-+	mdelay(100);
-+
-+	/* Some boards (e.g. Senao EOC-2610) don't implement the reset logic
-+	 * workaround. Attempt to jump to the mips reset location -
-+	 * the boot loader itself might be able to recover the system */
-+	mips_reset_vec();
-+}
-+
-+
-+/*
-+ * This table is indexed by bits 5..4 of the CLOCKCTL1 register
-+ * to determine the predevisor value.
-+ */
-+static int __initdata CLOCKCTL1_PREDIVIDE_TABLE[4] = { 1, 2, 4, 5 };
-+static int __initdata PLLC_DIVIDE_TABLE[5] = { 2, 3, 4, 6, 3 };
-+
-+static unsigned int __init
-+ar2315_sys_clk(unsigned int clockCtl)
-+{
-+    unsigned int pllcCtrl,cpuDiv;
-+    unsigned int pllcOut,refdiv,fdiv,divby2;
-+	unsigned int clkDiv;
-+
-+    pllcCtrl = ar231x_read_reg(AR2315_PLLC_CTL);
-+    refdiv = (pllcCtrl & PLLC_REF_DIV_M) >> PLLC_REF_DIV_S;
-+    refdiv = CLOCKCTL1_PREDIVIDE_TABLE[refdiv];
-+    fdiv = (pllcCtrl & PLLC_FDBACK_DIV_M) >> PLLC_FDBACK_DIV_S;
-+    divby2 = (pllcCtrl & PLLC_ADD_FDBACK_DIV_M) >> PLLC_ADD_FDBACK_DIV_S;
-+    divby2 += 1;
-+    pllcOut = (40000000/refdiv)*(2*divby2)*fdiv;
-+
-+
-+    /* clkm input selected */
-+	switch(clockCtl & CPUCLK_CLK_SEL_M) {
-+		case 0:
-+		case 1:
-+			clkDiv = PLLC_DIVIDE_TABLE[(pllcCtrl & PLLC_CLKM_DIV_M) >> PLLC_CLKM_DIV_S];
-+			break;
-+		case 2:
-+			clkDiv = PLLC_DIVIDE_TABLE[(pllcCtrl & PLLC_CLKC_DIV_M) >> PLLC_CLKC_DIV_S];
-+			break;
-+		default:
-+			pllcOut = 40000000;
-+			clkDiv = 1;
-+			break;
-+	}
-+	cpuDiv = (clockCtl & CPUCLK_CLK_DIV_M) >> CPUCLK_CLK_DIV_S;
-+	cpuDiv = cpuDiv * 2 ?: 1;
-+	return (pllcOut/(clkDiv * cpuDiv));
-+}
-+
-+static inline unsigned int
-+ar2315_cpu_frequency(void)
-+{
-+    return ar2315_sys_clk(ar231x_read_reg(AR2315_CPUCLK));
-+}
-+
-+static inline unsigned int
-+ar2315_apb_frequency(void)
-+{
-+    return ar2315_sys_clk(ar231x_read_reg(AR2315_AMBACLK));
-+}
-+
-+void __init
-+ar2315_time_init(void)
-+{
-+	if (!is_2315())
-+		return;
-+
-+	mips_hpt_frequency = ar2315_cpu_frequency() / 2;
-+}
-+
-+void __init
-+ar2315_prom_init(void)
-+{
-+	u32 memsize, memcfg, devid;
-+
-+	if (!is_2315())
-+		return;
-+
-+	memcfg = ar231x_read_reg(AR2315_MEM_CFG);
-+	memsize   = 1 + ((memcfg & SDRAM_DATA_WIDTH_M) >> SDRAM_DATA_WIDTH_S);
-+	memsize <<= 1 + ((memcfg & SDRAM_COL_WIDTH_M) >> SDRAM_COL_WIDTH_S);
-+	memsize <<= 1 + ((memcfg & SDRAM_ROW_WIDTH_M) >> SDRAM_ROW_WIDTH_S);
-+	memsize <<= 3;
-+	add_memory_region(0, memsize, BOOT_MEM_RAM);
-+
-+	/* Detect the hardware based on the device ID */
-+	devid = ar231x_read_reg(AR2315_SREV) & AR2315_REV_CHIP;
-+	switch(devid) {
-+		case 0x90:
-+		case 0x91:
-+			ar231x_devtype = DEV_TYPE_AR2317;
-+			break;
-+		default:
-+			ar231x_devtype = DEV_TYPE_AR2315;
-+			break;
-+	}
-+	ar231x_gpiodev = &ar2315_gpiodev;
-+	ar231x_board.devid = devid;
-+}
-+
-+void __init
-+ar2315_plat_setup(void)
-+{
-+	u32 config;
-+
-+	if (!is_2315())
-+		return;
-+
-+	/* Clear any lingering AHB errors */
-+	config = read_c0_config();
-+	write_c0_config(config & ~0x3);
-+	ar231x_write_reg(AR2315_AHB_ERR0,AHB_ERROR_DET);
-+	ar231x_read_reg(AR2315_AHB_ERR1);
-+	ar231x_write_reg(AR2315_WDC, AR2315_WDC_IGNORE_EXPIRATION);
-+
-+	_machine_restart = ar2315_restart;
-+	ar231x_serial_setup(KSEG1ADDR(AR2315_UART0), ar2315_apb_frequency());
-+}
---- /dev/null
-+++ b/arch/mips/ar231x/ar2315.h
-@@ -0,0 +1,37 @@
-+#ifndef __AR2315_H
-+#define __AR2315_H
-+
-+#ifdef CONFIG_ATHEROS_AR2315
-+
-+extern void ar2315_irq_init(void);
-+extern int ar2315_init_devices(void);
-+extern void ar2315_prom_init(void);
-+extern void ar2315_plat_setup(void);
-+extern void ar2315_time_init(void);
-+
-+#else
-+
-+static inline void ar2315_irq_init(void)
-+{
-+}
-+
-+static inline int ar2315_init_devices(void)
-+{
-+	return 0;
-+}
-+
-+static inline void ar2315_prom_init(void)
-+{
-+}
-+
-+static inline void ar2315_plat_setup(void)
-+{
-+}
-+
-+static inline void ar2315_time_init(void)
-+{
-+}
-+
-+#endif
-+
-+#endif
---- /dev/null
-+++ b/arch/mips/ar231x/ar5312.h
-@@ -0,0 +1,38 @@
-+#ifndef __AR5312_H
-+#define __AR5312_H
-+
-+#ifdef CONFIG_ATHEROS_AR5312
-+
-+extern void ar5312_irq_init(void);
-+extern int ar5312_init_devices(void);
-+extern void ar5312_prom_init(void);
-+extern void ar5312_plat_setup(void);
-+extern void ar5312_time_init(void);
-+extern void ar5312_time_init(void);
-+
-+#else
-+
-+static inline void ar5312_irq_init(void)
-+{
-+}
-+
-+static inline int ar5312_init_devices(void)
-+{
-+	return 0;
-+}
-+
-+static inline void ar5312_prom_init(void)
-+{
-+}
-+
-+static inline void ar5312_plat_setup(void)
-+{
-+}
-+
-+static inline void ar5312_time_init(void)
-+{
-+}
-+
-+#endif
-+
-+#endif
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/ar231x.h
-@@ -0,0 +1,54 @@
-+#ifndef __AR531X_H
-+#define __AR531X_H
-+
-+#define AR531X_MISC_IRQ_BASE		0x20
-+#define AR531X_GPIO_IRQ_BASE		0x30
-+
-+/* Software's idea of interrupts handled by "CPU Interrupt Controller" */
-+#define AR531X_IRQ_NONE		MIPS_CPU_IRQ_BASE+0
-+#define AR531X_IRQ_CPU_CLOCK	MIPS_CPU_IRQ_BASE+7 /* C0_CAUSE: 0x8000 */
-+
-+/* Miscellaneous interrupts, which share IP6 */
-+#define AR531X_MISC_IRQ_NONE		AR531X_MISC_IRQ_BASE+0
-+#define AR531X_MISC_IRQ_TIMER		AR531X_MISC_IRQ_BASE+1
-+#define AR531X_MISC_IRQ_AHB_PROC	AR531X_MISC_IRQ_BASE+2
-+#define AR531X_MISC_IRQ_AHB_DMA		AR531X_MISC_IRQ_BASE+3
-+#define AR531X_MISC_IRQ_GPIO		AR531X_MISC_IRQ_BASE+4
-+#define AR531X_MISC_IRQ_UART0		AR531X_MISC_IRQ_BASE+5
-+#define AR531X_MISC_IRQ_UART0_DMA	AR531X_MISC_IRQ_BASE+6
-+#define AR531X_MISC_IRQ_WATCHDOG	AR531X_MISC_IRQ_BASE+7
-+#define AR531X_MISC_IRQ_LOCAL		AR531X_MISC_IRQ_BASE+8
-+#define AR531X_MISC_IRQ_SPI 		AR531X_MISC_IRQ_BASE+9
-+#define AR531X_MISC_IRQ_COUNT		10
-+
-+/* GPIO Interrupts [0..7], share AR531X_MISC_IRQ_GPIO */
-+#define AR531X_GPIO_IRQ_NONE            AR531X_GPIO_IRQ_BASE+0
-+#define AR531X_GPIO_IRQ(n)              AR531X_GPIO_IRQ_BASE+n
-+#define AR531X_GPIO_IRQ_COUNT           22
-+
-+static inline u32
-+ar231x_read_reg(u32 reg)
-+{
-+	return __raw_readl((u32 *) KSEG1ADDR(reg));
-+}
-+
-+static inline void
-+ar231x_write_reg(u32 reg, u32 val)
-+{
-+	__raw_writel(val, (u32 *) KSEG1ADDR(reg));
-+}
-+
-+static inline u32
-+ar231x_mask_reg(u32 reg, u32 mask, u32 val)
-+{
-+	u32 ret;
-+
-+	ret = ar231x_read_reg(reg);
-+	ret &= ~mask;
-+	ret |= val;
-+	ar231x_write_reg(reg, ret);
-+
-+	return ret;
-+}
-+
-+#endif
---- /dev/null
-+++ b/arch/mips/ar231x/devices.h
-@@ -0,0 +1,37 @@
-+#ifndef __AR231X_DEVICES_H
-+#define __AR231X_DEVICES_H
-+
-+enum {
-+	/* handled by ar5312.c */
-+	DEV_TYPE_AR2312,
-+	DEV_TYPE_AR2313,
-+	DEV_TYPE_AR5312,
-+
-+	/* handled by ar2315.c */
-+	DEV_TYPE_AR2315,
-+	DEV_TYPE_AR2316,
-+	DEV_TYPE_AR2317,
-+
-+	DEV_TYPE_UNKNOWN
-+};
-+
-+extern int ar231x_devtype;
-+extern struct ar231x_board_config ar231x_board;
-+extern asmlinkage void (*ar231x_irq_dispatch)(void);
-+
-+extern int ar231x_find_config(u8 *flash_limit);
-+extern void ar231x_serial_setup(u32 mapbase, unsigned int uartclk);
-+extern int ar231x_add_wmac(int nr, u32 base, int irq);
-+extern int ar231x_add_ethernet(int nr, u32 base, int irq, void *pdata);
-+
-+static inline bool is_2315(void)
-+{
-+	return (current_cpu_data.cputype == CPU_4KEC);
-+}
-+
-+static inline bool is_5312(void)
-+{
-+	return !is_2315();
-+}
-+
-+#endif
---- /dev/null
-+++ b/arch/mips/ar231x/devices.c
-@@ -0,0 +1,175 @@
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/serial.h>
-+#include <linux/serial_core.h>
-+#include <linux/serial_8250.h>
-+#include <linux/platform_device.h>
-+#include <ar231x_platform.h>
-+#include <ar231x.h>
-+#include "devices.h"
-+#include "ar5312.h"
-+#include "ar2315.h"
-+
-+struct ar231x_board_config ar231x_board;
-+int ar231x_devtype = DEV_TYPE_UNKNOWN;
-+const struct ar231x_gpiodev *ar231x_gpiodev;
-+EXPORT_SYMBOL(ar231x_gpiodev);
-+
-+static struct resource ar231x_eth0_res[] = {
-+	{
-+		.name = "eth0_membase",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "eth0_irq",
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct resource ar231x_eth1_res[] = {
-+	{
-+		.name = "eth1_membase",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "eth1_irq",
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct platform_device ar231x_eth[] = {
-+	{
-+		.id = 0,
-+		.name = "ar231x-eth",
-+		.resource = ar231x_eth0_res,
-+		.num_resources = ARRAY_SIZE(ar231x_eth0_res)
-+	},
-+	{
-+		.id = 1,
-+		.name = "ar231x-eth",
-+		.resource = ar231x_eth1_res,
-+		.num_resources = ARRAY_SIZE(ar231x_eth1_res)
-+	}
-+};
-+
-+static struct resource ar231x_wmac0_res[] = {
-+	{
-+		.name = "wmac0_membase",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "wmac0_irq",
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+static struct resource ar231x_wmac1_res[] = {
-+	{
-+		.name = "wmac1_membase",
-+		.flags = IORESOURCE_MEM,
-+	},
-+	{
-+		.name = "wmac1_irq",
-+		.flags = IORESOURCE_IRQ,
-+	}
-+};
-+
-+
-+static struct platform_device ar231x_wmac[] = {
-+	{
-+		.id = 0,
-+		.name = "ar231x-wmac",
-+		.resource = ar231x_wmac0_res,
-+		.num_resources = ARRAY_SIZE(ar231x_wmac0_res),
-+		.dev.platform_data = &ar231x_board,
-+	},
-+	{
-+		.id = 1,
-+		.name = "ar231x-wmac",
-+		.resource = ar231x_wmac1_res,
-+		.num_resources = ARRAY_SIZE(ar231x_wmac1_res),
-+		.dev.platform_data = &ar231x_board,
-+	},
-+};
-+
-+static const char *devtype_strings[] = {
-+	[DEV_TYPE_AR5312] = "Atheros AR5312",
-+	[DEV_TYPE_AR2312] = "Atheros AR2312",
-+	[DEV_TYPE_AR2313] = "Atheros AR2313",
-+	[DEV_TYPE_AR2315] = "Atheros AR2315",
-+	[DEV_TYPE_AR2316] = "Atheros AR2316",
-+	[DEV_TYPE_AR2317] = "Atheros AR2317",
-+	[DEV_TYPE_UNKNOWN] = "Atheros (unknown)",
-+};
-+
-+const char *get_system_type(void)
-+{
-+	if ((ar231x_devtype >= ARRAY_SIZE(devtype_strings)) ||
-+		!devtype_strings[ar231x_devtype])
-+		return devtype_strings[DEV_TYPE_UNKNOWN];
-+	return devtype_strings[ar231x_devtype];
-+}
-+
-+
-+int __init
-+ar231x_add_ethernet(int nr, u32 base, int irq, void *pdata)
-+{
-+	struct resource *res;
-+
-+	ar231x_eth[nr].dev.platform_data = pdata;
-+	res = &ar231x_eth[nr].resource[0];
-+	res->start = base;
-+	res->end = base + 0x2000 - 1;
-+	res++;
-+	res->start = irq;
-+	res->end = irq;
-+	return platform_device_register(&ar231x_eth[nr]);
-+}
-+
-+void __init
-+ar231x_serial_setup(u32 mapbase, unsigned int uartclk)
-+{
-+	struct uart_port s;
-+
-+	memset(&s, 0, sizeof(s));
-+
-+	s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
-+	s.iotype = UPIO_MEM;
-+	s.irq = AR531X_MISC_IRQ_UART0;
-+	s.regshift = 2;
-+	s.mapbase = mapbase;
-+	s.uartclk = uartclk;
-+	s.membase = (void __iomem *)s.mapbase;
-+
-+	early_serial_setup(&s);
-+}
-+
-+int __init
-+ar231x_add_wmac(int nr, u32 base, int irq)
-+{
-+	struct resource *res;
-+
-+	ar231x_wmac[nr].dev.platform_data = &ar231x_board;
-+	res = &ar231x_wmac[nr].resource[0];
-+	res->start = base;
-+	res->end = base + 0x10000 - 1;
-+	res++;
-+	res->start = irq;
-+	res->end = irq;
-+	return platform_device_register(&ar231x_wmac[nr]);
-+}
-+
-+static int __init ar231x_register_devices(void)
-+{
-+	static struct resource res = {
-+		.start = 0xFFFFFFFF,
-+	};
-+
-+	platform_device_register_simple("GPIODEV", 0, &res, 1);
-+	ar5312_init_devices();
-+	ar2315_init_devices();
-+
-+	return 0;
-+}
-+
-+device_initcall(ar231x_register_devices);

+ 0 - 68
target/linux/atheros/patches-2.6.33/101-early-printk-support.patch

@@ -1,68 +0,0 @@
---- /dev/null
-+++ b/arch/mips/ar231x/early_printk.c
-@@ -0,0 +1,44 @@
-+/*
-+ * 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) 2010 Gabor Juhos <[email protected]>
-+ */
-+
-+#include <linux/mm.h>
-+#include <linux/io.h>
-+#include <linux/serial_reg.h>
-+#include <asm/addrspace.h>
-+
-+#include <asm/mach-ar231x/ar2315_regs.h>
-+#include <asm/mach-ar231x/ar5312_regs.h>
-+#include "devices.h"
-+
-+static inline void prom_uart_wr(void __iomem *base, unsigned reg,
-+				unsigned char ch)
-+{
-+	__raw_writeb(ch, base + 4 * reg);
-+}
-+
-+static inline unsigned char prom_uart_rr(void __iomem *base, unsigned reg)
-+{
-+	return __raw_readb(base + 4 * reg);
-+}
-+
-+void prom_putchar(unsigned char ch)
-+{
-+	static void __iomem *base;
-+
-+	if (unlikely(base == NULL)) {
-+		if (is_2315())
-+			base = (void __iomem *)(KSEG1ADDR(AR2315_UART0));
-+		else
-+			base = (void __iomem *)(KSEG1ADDR(AR531X_UART0));
-+	}
-+
-+	while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0);
-+	prom_uart_wr(base, UART_TX, ch);
-+	while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0);
-+}
-+
---- a/arch/mips/ar231x/Makefile
-+++ b/arch/mips/ar231x/Makefile
-@@ -9,5 +9,8 @@
- #
- 
- obj-y += board.o prom.o devices.o
-+
-+obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
-+
- obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
- obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -94,6 +94,7 @@ config ATHEROS_AR231X
- 	select SYS_SUPPORTS_BIG_ENDIAN
- 	select SYS_SUPPORTS_32BIT_KERNEL
- 	select GENERIC_GPIO
-+	select SYS_HAS_EARLY_PRINTK
- 	help
- 	  Support for AR231x and AR531x based boards
- 

+ 0 - 297
target/linux/atheros/patches-2.6.33/105-ar2315_pci.patch

@@ -1,297 +0,0 @@
---- a/arch/mips/ar231x/Makefile
-+++ b/arch/mips/ar231x/Makefile
-@@ -14,3 +14,4 @@ obj-$(CONFIG_EARLY_PRINTK) += early_prin
- 
- obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
- obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
-+obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
---- /dev/null
-+++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,230 @@
-+/*
-+ * 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.
-+ */
-+
-+#include <linux/types.h>
-+#include <linux/pci.h>
-+#include <linux/kernel.h>
-+#include <linux/init.h>
-+#include <linux/mm.h>
-+#include <linux/spinlock.h>
-+#include <linux/delay.h>
-+#include <linux/irq.h>
-+#include <asm/bootinfo.h>
-+#include <asm/paccess.h>
-+#include <asm/irq_cpu.h>
-+#include <asm/io.h>
-+#include <ar231x_platform.h>
-+#include <ar231x.h>
-+#include <ar2315_regs.h>
-+#include "devices.h"
-+
-+#define AR531X_MEM_BASE    0x80800000UL
-+#define AR531X_MEM_SIZE    0x00ffffffUL
-+#define AR531X_IO_SIZE     0x00007fffUL
-+
-+static unsigned long configspace;
-+
-+static int config_access(int devfn, int where, int size, u32 *ptr, bool write)
-+{
-+	unsigned long flags;
-+	int func = PCI_FUNC(devfn);
-+	int dev = PCI_SLOT(devfn);
-+	u32 value = 0;
-+	int err = 0;
-+	u32 addr;
-+
-+	if (((dev != 0) && (dev != 3)) || (func > 2))
-+		return PCIBIOS_DEVICE_NOT_FOUND;
-+
-+	/* Select Configuration access */
-+	local_irq_save(flags);
-+	ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, 0, AR2315_PCIMISC_CFG_SEL);
-+	mb();
-+
-+	addr = (u32) configspace + (1 << (13 + dev)) + (func << 8) + where;
-+	if (size == 1)
-+		addr ^= 0x3;
-+	else if (size == 2)
-+		addr ^= 0x2;
-+
-+	if (write) {
-+		value = *ptr;
-+		if (size == 1)
-+			err = put_dbe(value, (u8 *) addr);
-+		else if (size == 2)
-+			err = put_dbe(value, (u16 *) addr);
-+		else if (size == 4)
-+			err = put_dbe(value, (u32 *) addr);
-+	} else {
-+		if (size == 1)
-+			err = get_dbe(value, (u8 *) addr);
-+		else if (size == 2)
-+			err = get_dbe(value, (u16 *) addr);
-+		else if (size == 4)
-+			err = get_dbe(value, (u32 *) addr);
-+		if (err)
-+			*ptr = 0xffffffff;
-+		else
-+			*ptr = value;
-+	}
-+
-+	/* Select Memory access */
-+	ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_CFG_SEL, 0);
-+	local_irq_restore(flags);
-+
-+	return (err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL);
-+}
-+
-+static int ar231x_pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 * value)
-+{
-+	return config_access(devfn, where, size, value, 0);
-+}
-+
-+static int ar231x_pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
-+{
-+	return config_access(devfn, where, size, &value, 1);
-+}
-+
-+struct pci_ops ar231x_pci_ops = {
-+	.read	= ar231x_pci_read,
-+	.write	= ar231x_pci_write,
-+};
-+
-+static struct resource ar231x_mem_resource = {
-+	.name	= "AR531x PCI MEM",
-+	.start	= AR531X_MEM_BASE,
-+	.end	= AR531X_MEM_BASE + AR531X_MEM_SIZE - AR531X_IO_SIZE - 1 + 0x4000000,
-+	.flags	= IORESOURCE_MEM,
-+};
-+
-+static struct resource ar231x_io_resource = {
-+	.name	= "AR531x PCI I/O",
-+	.start	= AR531X_MEM_BASE + AR531X_MEM_SIZE - AR531X_IO_SIZE,
-+	.end	= AR531X_MEM_BASE + AR531X_MEM_SIZE - 1,
-+	.flags	= IORESOURCE_IO,
-+};
-+
-+struct pci_controller ar231x_pci_controller = {
-+	.pci_ops		= &ar231x_pci_ops,
-+	.mem_resource	= &ar231x_mem_resource,
-+	.io_resource	= &ar231x_io_resource,
-+	.mem_offset     = 0x00000000UL,
-+	.io_offset      = 0x00000000UL,
-+};
-+
-+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-+{
-+	return AR2315_IRQ_LCBUS_PCI;
-+}
-+
-+int pcibios_plat_dev_init(struct pci_dev *dev)
-+{
-+	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 5);
-+	pci_write_config_word(dev, 0x40, 0);
-+
-+	/* Clear any pending Abort or external Interrupts
-+	 * and enable interrupt processing */
-+	ar231x_mask_reg(AR2315_PCI_INTEN_REG, AR2315_PCI_INT_ENABLE, 0);
-+	ar231x_write_reg(AR2315_PCI_INT_STATUS, (AR2315_PCI_ABORT_INT | AR2315_PCI_EXT_INT));
-+	ar231x_write_reg(AR2315_PCI_INT_MASK, (AR2315_PCI_ABORT_INT | AR2315_PCI_EXT_INT));
-+	ar231x_mask_reg(AR2315_PCI_INTEN_REG, 0, AR2315_PCI_INT_ENABLE);
-+
-+	return 0;
-+}
-+
-+static void
-+ar2315_pci_fixup(struct pci_dev *dev)
-+{
-+	unsigned int devfn = dev->devfn;
-+
-+	if (dev->bus->number != 0)
-+		return;
-+
-+	/* Only fix up the PCI host settings */
-+	if ((PCI_SLOT(devfn) != 3) || (PCI_FUNC(devfn) != 0))
-+		return;
-+
-+	/* Fix up MBARs */
-+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, HOST_PCI_MBAR0);
-+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, HOST_PCI_MBAR1);
-+	pci_write_config_dword(dev, PCI_BASE_ADDRESS_2, HOST_PCI_MBAR2);
-+	pci_write_config_dword(dev, PCI_COMMAND,
-+		PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_SPECIAL |
-+		PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY | PCI_COMMAND_SERR |
-+		PCI_COMMAND_FAST_BACK);
-+}
-+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, ar2315_pci_fixup);
-+
-+static int __init
-+ar2315_pci_init(void)
-+{
-+	u32 reg;
-+
-+	if (ar231x_devtype != DEV_TYPE_AR2315)
-+		return -ENODEV;
-+
-+	configspace = (unsigned long) ioremap_nocache(0x80000000, 1*1024*1024); /* Remap PCI config space */
-+	ar231x_pci_controller.io_map_base =
-+		(unsigned long) ioremap_nocache(AR531X_MEM_BASE + AR531X_MEM_SIZE, AR531X_IO_SIZE);
-+	set_io_port_base(ar231x_pci_controller.io_map_base); /* PCI I/O space */
-+
-+	reg = ar231x_mask_reg(AR2315_RESET, 0, AR2315_RESET_PCIDMA);
-+	msleep(10);
-+
-+	reg &= ~AR2315_RESET_PCIDMA;
-+	ar231x_write_reg(AR2315_RESET, reg);
-+	msleep(10);
-+
-+	ar231x_mask_reg(AR2315_ENDIAN_CTL, 0,
-+		AR2315_CONFIG_PCIAHB | AR2315_CONFIG_PCIAHB_BRIDGE);
-+
-+	ar231x_write_reg(AR2315_PCICLK, AR2315_PCICLK_PLLC_CLKM |
-+		(AR2315_PCICLK_IN_FREQ_DIV_6 << AR2315_PCICLK_DIV_S));
-+	ar231x_mask_reg(AR2315_AHB_ARB_CTL, 0, AR2315_ARB_PCI);
-+	ar231x_mask_reg(AR2315_IF_CTL, AR2315_IF_PCI_CLK_MASK | AR2315_IF_MASK,
-+		AR2315_IF_PCI | AR2315_IF_PCI_HOST | AR2315_IF_PCI_INTR |
-+		 (AR2315_IF_PCI_CLK_OUTPUT_CLK << AR2315_IF_PCI_CLK_SHIFT));
-+
-+	/* Reset the PCI bus by setting bits 5-4 in PCI_MCFG */
-+	ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_RST_MODE,
-+		AR2315_PCIRST_LOW);
-+	msleep(100);
-+
-+	/* Bring the PCI out of reset */
-+	ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_RST_MODE,
-+		AR2315_PCIRST_HIGH | AR2315_PCICACHE_DIS | 0x8);
-+
-+	ar231x_write_reg(AR2315_PCI_UNCACHE_CFG,
-+			0x1E | /* 1GB uncached */
-+			(1 << 5) | /* Enable uncached */
-+			(0x2 << 30) /* Base: 0x80000000 */
-+	);
-+	ar231x_read_reg(AR2315_PCI_UNCACHE_CFG);
-+
-+	msleep(500);
-+
-+	/* dirty hack - anyone with a datasheet that knows the memory map ? */
-+	ioport_resource.start = 0x10000000;
-+	ioport_resource.end = 0xffffffff;
-+	iomem_resource.start = 0x10000000;
-+	iomem_resource.end = 0xffffffff;
-+
-+	register_pci_controller(&ar231x_pci_controller);
-+
-+	return 0;
-+}
-+
-+arch_initcall(ar2315_pci_init);
---- a/arch/mips/ar231x/Kconfig
-+++ b/arch/mips/ar231x/Kconfig
-@@ -15,3 +15,13 @@ config ATHEROS_AR2315
- 	select SYS_SUPPORTS_BIG_ENDIAN
- 	select GENERIC_GPIO
- 	default y
-+
-+config ATHEROS_AR2315_PCI
-+	bool "PCI support"
-+	depends on ATHEROS_AR2315
-+	select HW_HAS_PCI
-+	select PCI
-+	select USB_ARCH_HAS_HCD
-+	select USB_ARCH_HAS_OHCI
-+	select USB_ARCH_HAS_EHCI
-+	default y
---- a/arch/mips/ar231x/ar2315.c
-+++ b/arch/mips/ar231x/ar2315.c
-@@ -63,6 +63,27 @@ static inline void ar2315_gpio_irq(void)
- 		do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
- }
- 
-+#ifdef CONFIG_ATHEROS_AR2315_PCI
-+static inline void pci_abort_irq(void)
-+{
-+	ar231x_write_reg(AR2315_PCI_INT_STATUS, AR2315_PCI_ABORT_INT);
-+}
-+
-+static inline void pci_ack_irq(void)
-+{
-+	ar231x_write_reg(AR2315_PCI_INT_STATUS, AR2315_PCI_EXT_INT);
-+}
-+
-+void ar2315_pci_irq(int irq)
-+{
-+	if (ar231x_read_reg(AR2315_PCI_INT_STATUS) == AR2315_PCI_ABORT_INT)
-+		pci_abort_irq();
-+	else {
-+		do_IRQ(irq);
-+		pci_ack_irq();
-+	}
-+}
-+#endif /* CONFIG_ATHEROS_AR2315_PCI */
- 
- /*
-  * Called when an interrupt is received, this function
-@@ -81,6 +102,10 @@ ar2315_irq_dispatch(void)
- 		do_IRQ(AR2315_IRQ_WLAN0_INTRS);
- 	else if (pending & CAUSEF_IP4)
- 		do_IRQ(AR2315_IRQ_ENET0_INTRS);
-+#ifdef CONFIG_ATHEROS_AR2315_PCI
-+	else if (pending & CAUSEF_IP5)
-+		ar2315_pci_irq(AR2315_IRQ_LCBUS_PCI);
-+#endif
- 	else if (pending & CAUSEF_IP2) {
- 		unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) & ar231x_read_reg(AR2315_IMR);
- 

+ 0 - 1611
target/linux/atheros/patches-2.6.33/110-ar2313_ethernet.patch

@@ -1,1611 +0,0 @@
---- a/drivers/net/Kconfig
-+++ b/drivers/net/Kconfig
-@@ -359,6 +359,12 @@ config AX88796_93CX6
- 	help
- 	  Select this if your platform comes with an external 93CX6 eeprom.
- 
-+config AR231X_ETHERNET
-+	tristate "AR231x Ethernet support"
-+	depends on ATHEROS_AR231X
-+	help
-+	  Support for the AR231x/531x ethernet controller
-+
- config MACE
- 	tristate "MACE (Power Mac ethernet) support"
- 	depends on PPC_PMAC && PPC32
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -216,6 +216,7 @@ obj-$(CONFIG_EQUALIZER) += eql.o
- obj-$(CONFIG_KORINA) += korina.o
- obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o
- obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
-+obj-$(CONFIG_AR231X_ETHERNET) += ar231x.o
- obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
- obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o
- obj-$(CONFIG_DECLANCE) += declance.o
---- /dev/null
-+++ b/drivers/net/ar231x.c
-@@ -0,0 +1,1278 @@
-+/*
-+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
-+ *
-+ * Copyright (C) 2004 by Sameer Dekate <[email protected]>
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+ *
-+ * Thanks to Atheros for providing hardware and documentation
-+ * enabling me to write this driver.
-+ *
-+ * 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.
-+ *
-+ * Additional credits:
-+ * 	This code is taken from John Taylor's Sibyte driver and then
-+ * 	modified for the AR2313.
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/version.h>
-+#include <linux/types.h>
-+#include <linux/errno.h>
-+#include <linux/ioport.h>
-+#include <linux/pci.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/skbuff.h>
-+#include <linux/init.h>
-+#include <linux/delay.h>
-+#include <linux/mm.h>
-+#include <linux/highmem.h>
-+#include <linux/sockios.h>
-+#include <linux/pkt_sched.h>
-+#include <linux/mii.h>
-+#include <linux/phy.h>
-+#include <linux/ethtool.h>
-+#include <linux/ctype.h>
-+#include <linux/platform_device.h>
-+
-+#include <net/sock.h>
-+#include <net/ip.h>
-+
-+#include <asm/system.h>
-+#include <asm/io.h>
-+#include <asm/irq.h>
-+#include <asm/byteorder.h>
-+#include <asm/uaccess.h>
-+#include <asm/bootinfo.h>
-+
-+#define AR2313_MTU                     1692
-+#define AR2313_PRIOS                   1
-+#define AR2313_QUEUES                  (2*AR2313_PRIOS)
-+#define AR2313_DESCR_ENTRIES           64
-+
-+
-+#ifndef min
-+#define min(a,b)	(((a)<(b))?(a):(b))
-+#endif
-+
-+#ifndef SMP_CACHE_BYTES
-+#define SMP_CACHE_BYTES	L1_CACHE_BYTES
-+#endif
-+
-+#define AR2313_MBOX_SET_BIT  0x8
-+
-+#include "ar231x.h"
-+
-+/*
-+ * New interrupt handler strategy:
-+ *
-+ * An old interrupt handler worked using the traditional method of
-+ * replacing an skbuff with a new one when a packet arrives. However
-+ * the rx rings do not need to contain a static number of buffer
-+ * descriptors, thus it makes sense to move the memory allocation out
-+ * of the main interrupt handler and do it in a bottom half handler
-+ * and only allocate new buffers when the number of buffers in the
-+ * ring is below a certain threshold. In order to avoid starving the
-+ * NIC under heavy load it is however necessary to force allocation
-+ * when hitting a minimum threshold. The strategy for alloction is as
-+ * follows:
-+ *
-+ *     RX_LOW_BUF_THRES    - allocate buffers in the bottom half
-+ *     RX_PANIC_LOW_THRES  - we are very low on buffers, allocate
-+ *                           the buffers in the interrupt handler
-+ *     RX_RING_THRES       - maximum number of buffers in the rx ring
-+ *
-+ * One advantagous side effect of this allocation approach is that the
-+ * entire rx processing can be done without holding any spin lock
-+ * since the rx rings and registers are totally independent of the tx
-+ * ring and its registers.  This of course includes the kmalloc's of
-+ * new skb's. Thus start_xmit can run in parallel with rx processing
-+ * and the memory allocation on SMP systems.
-+ *
-+ * Note that running the skb reallocation in a bottom half opens up
-+ * another can of races which needs to be handled properly. In
-+ * particular it can happen that the interrupt handler tries to run
-+ * the reallocation while the bottom half is either running on another
-+ * CPU or was interrupted on the same CPU. To get around this the
-+ * driver uses bitops to prevent the reallocation routines from being
-+ * reentered.
-+ *
-+ * TX handling can also be done without holding any spin lock, wheee
-+ * this is fun! since tx_csm is only written to by the interrupt
-+ * handler.
-+ */
-+
-+/*
-+ * Threshold values for RX buffer allocation - the low water marks for
-+ * when to start refilling the rings are set to 75% of the ring
-+ * sizes. It seems to make sense to refill the rings entirely from the
-+ * intrrupt handler once it gets below the panic threshold, that way
-+ * we don't risk that the refilling is moved to another CPU when the
-+ * one running the interrupt handler just got the slab code hot in its
-+ * cache.
-+ */
-+#define RX_RING_SIZE		AR2313_DESCR_ENTRIES
-+#define RX_PANIC_THRES	        (RX_RING_SIZE/4)
-+#define RX_LOW_THRES	        ((3*RX_RING_SIZE)/4)
-+#define CRC_LEN                 4
-+#define RX_OFFSET               2
-+
-+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
-+#define VLAN_HDR                4
-+#else
-+#define VLAN_HDR                0
-+#endif
-+
-+#define AR2313_BUFSIZE		(AR2313_MTU + VLAN_HDR + ETH_HLEN + CRC_LEN + RX_OFFSET)
-+
-+#ifdef MODULE
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Sameer Dekate <[email protected]>, Imre Kaloz <[email protected]>, Felix Fietkau <[email protected]>");
-+MODULE_DESCRIPTION("AR231x Ethernet driver");
-+#endif
-+
-+#define virt_to_phys(x) ((u32)(x) & 0x1fffffff)
-+
-+// prototypes
-+static void ar231x_halt(struct net_device *dev);
-+static void rx_tasklet_func(unsigned long data);
-+static void rx_tasklet_cleanup(struct net_device *dev);
-+static void ar231x_multicast_list(struct net_device *dev);
-+static void ar231x_tx_timeout(struct net_device *dev);
-+
-+static int ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum);
-+static int ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value);
-+static int ar231x_mdiobus_reset(struct mii_bus *bus);
-+static int ar231x_mdiobus_probe (struct net_device *dev);
-+static void ar231x_adjust_link(struct net_device *dev);
-+
-+#ifndef ERR
-+#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
-+#endif
-+
-+static const struct net_device_ops ar231x_ops = {
-+	.ndo_open 		= ar231x_open,
-+	.ndo_stop 		= ar231x_close,
-+	.ndo_start_xmit 	= ar231x_start_xmit,
-+	.ndo_set_multicast_list = ar231x_multicast_list,
-+	.ndo_do_ioctl 		= ar231x_ioctl,
-+	.ndo_change_mtu 	= eth_change_mtu,
-+	.ndo_validate_addr	= eth_validate_addr,
-+	.ndo_set_mac_address 	= eth_mac_addr,
-+	.ndo_tx_timeout		= ar231x_tx_timeout,
-+};
-+
-+int __init ar231x_probe(struct platform_device *pdev)
-+{
-+	struct net_device *dev;
-+	struct ar231x_private *sp;
-+	struct resource *res;
-+	unsigned long ar_eth_base;
-+	char buf[64];
-+
-+	dev = alloc_etherdev(sizeof(struct ar231x_private));
-+
-+	if (dev == NULL) {
-+		printk(KERN_ERR
-+			   "ar231x: Unable to allocate net_device structure!\n");
-+		return -ENOMEM;
-+	}
-+
-+	platform_set_drvdata(pdev, dev);
-+
-+	sp = netdev_priv(dev);
-+	sp->dev = dev;
-+	sp->cfg = pdev->dev.platform_data;
-+
-+	sprintf(buf, "eth%d_membase", pdev->id);
-+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf);
-+	if (!res)
-+		return -ENODEV;
-+
-+	sp->link = 0;
-+	ar_eth_base = res->start;
-+
-+	sprintf(buf, "eth%d_irq", pdev->id);
-+	dev->irq = platform_get_irq_byname(pdev, buf);
-+
-+	spin_lock_init(&sp->lock);
-+
-+	dev->features |= NETIF_F_HIGHDMA;
-+	dev->netdev_ops = &ar231x_ops;
-+
-+	tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long) dev);
-+	tasklet_disable(&sp->rx_tasklet);
-+
-+	sp->eth_regs =
-+		ioremap_nocache(virt_to_phys(ar_eth_base), sizeof(*sp->eth_regs));
-+	if (!sp->eth_regs) {
-+		printk("Can't remap eth registers\n");
-+		return (-ENXIO);
-+	}
-+
-+	/*
-+	 * When there's only one MAC, PHY regs are typically on ENET0,
-+	 * even though the MAC might be on ENET1.
-+	 * Needto remap PHY regs separately in this case
-+	 */
-+	if (virt_to_phys(ar_eth_base) == virt_to_phys(sp->phy_regs))
-+		sp->phy_regs = sp->eth_regs;
-+	else {
-+		sp->phy_regs =
-+			ioremap_nocache(virt_to_phys(sp->cfg->phy_base),
-+							sizeof(*sp->phy_regs));
-+		if (!sp->phy_regs) {
-+			printk("Can't remap phy registers\n");
-+			return (-ENXIO);
-+		}
-+	}
-+
-+	sp->dma_regs =
-+		ioremap_nocache(virt_to_phys(ar_eth_base + 0x1000),
-+						sizeof(*sp->dma_regs));
-+	dev->base_addr = (unsigned int) sp->dma_regs;
-+	if (!sp->dma_regs) {
-+		printk("Can't remap DMA registers\n");
-+		return (-ENXIO);
-+	}
-+
-+	sp->int_regs = ioremap_nocache(virt_to_phys(sp->cfg->reset_base), 4);
-+	if (!sp->int_regs) {
-+		printk("Can't remap INTERRUPT registers\n");
-+		return (-ENXIO);
-+	}
-+
-+	strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
-+	sp->name[sizeof(sp->name) - 1] = '\0';
-+	memcpy(dev->dev_addr, sp->cfg->macaddr, 6);
-+
-+	if (ar231x_init(dev)) {
-+		/*
-+		 * ar231x_init() calls ar231x_init_cleanup() on error.
-+		 */
-+		kfree(dev);
-+		return -ENODEV;
-+	}
-+
-+	if (register_netdev(dev)) {
-+		printk("%s: register_netdev failed\n", __func__);
-+		return -1;
-+	}
-+
-+	printk("%s: %s: %02x:%02x:%02x:%02x:%02x:%02x, irq %d\n",
-+		   dev->name, sp->name,
-+		   dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
-+		   dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5], dev->irq);
-+
-+	sp->mii_bus = mdiobus_alloc();
-+	if (sp->mii_bus == NULL)
-+		return -1;
-+
-+	sp->mii_bus->priv = dev;
-+	sp->mii_bus->read = ar231x_mdiobus_read;
-+	sp->mii_bus->write = ar231x_mdiobus_write;
-+	sp->mii_bus->reset = ar231x_mdiobus_reset;
-+	sp->mii_bus->name = "ar231x_eth_mii";
-+	snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id);
-+	sp->mii_bus->irq = kmalloc(sizeof(int), GFP_KERNEL);
-+	*sp->mii_bus->irq = PHY_POLL;
-+
-+	mdiobus_register(sp->mii_bus);
-+
-+	if (ar231x_mdiobus_probe(dev) != 0) {
-+		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
-+		rx_tasklet_cleanup(dev);
-+		ar231x_init_cleanup(dev);
-+		unregister_netdev(dev);
-+		kfree(dev);
-+		return -ENODEV;
-+	}
-+
-+	/* start link poll timer */
-+	ar231x_setup_timer(dev);
-+
-+	return 0;
-+}
-+
-+
-+static void ar231x_multicast_list(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int filter;
-+
-+	filter = sp->eth_regs->mac_control;
-+
-+	if (dev->flags & IFF_PROMISC)
-+		filter |= MAC_CONTROL_PR;
-+	else
-+		filter &= ~MAC_CONTROL_PR;
-+	if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > 0))
-+		filter |= MAC_CONTROL_PM;
-+	else
-+		filter &= ~MAC_CONTROL_PM;
-+
-+	sp->eth_regs->mac_control = filter;
-+}
-+
-+static void rx_tasklet_cleanup(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	/*
-+	 * Tasklet may be scheduled. Need to get it removed from the list
-+	 * since we're about to free the struct.
-+	 */
-+
-+	sp->unloading = 1;
-+	tasklet_enable(&sp->rx_tasklet);
-+	tasklet_kill(&sp->rx_tasklet);
-+}
-+
-+static int __devexit ar231x_remove(struct platform_device *pdev)
-+{
-+	struct net_device *dev = platform_get_drvdata(pdev);
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	rx_tasklet_cleanup(dev);
-+	ar231x_init_cleanup(dev);
-+	unregister_netdev(dev);
-+	mdiobus_unregister(sp->mii_bus);
-+	mdiobus_free(sp->mii_bus);
-+	kfree(dev);
-+	return 0;
-+}
-+
-+
-+/*
-+ * Restart the AR2313 ethernet controller.
-+ */
-+static int ar231x_restart(struct net_device *dev)
-+{
-+	/* disable interrupts */
-+	disable_irq(dev->irq);
-+
-+	/* stop mac */
-+	ar231x_halt(dev);
-+
-+	/* initialize */
-+	ar231x_init(dev);
-+
-+	/* enable interrupts */
-+	enable_irq(dev->irq);
-+
-+	return 0;
-+}
-+
-+static struct platform_driver ar231x_driver = {
-+	.driver.name = "ar231x-eth",
-+	.probe = ar231x_probe,
-+	.remove = __devexit_p(ar231x_remove),
-+};
-+
-+int __init ar231x_module_init(void)
-+{
-+	return platform_driver_register(&ar231x_driver);
-+}
-+
-+void __exit ar231x_module_cleanup(void)
-+{
-+	platform_driver_unregister(&ar231x_driver);
-+}
-+
-+module_init(ar231x_module_init);
-+module_exit(ar231x_module_cleanup);
-+
-+
-+static void ar231x_free_descriptors(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	if (sp->rx_ring != NULL) {
-+		kfree((void *) KSEG0ADDR(sp->rx_ring));
-+		sp->rx_ring = NULL;
-+		sp->tx_ring = NULL;
-+	}
-+}
-+
-+
-+static int ar231x_allocate_descriptors(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int size;
-+	int j;
-+	ar231x_descr_t *space;
-+
-+	if (sp->rx_ring != NULL) {
-+		printk("%s: already done.\n", __FUNCTION__);
-+		return 0;
-+	}
-+
-+	size =
-+		(sizeof(ar231x_descr_t) * (AR2313_DESCR_ENTRIES * AR2313_QUEUES));
-+	space = kmalloc(size, GFP_KERNEL);
-+	if (space == NULL)
-+		return 1;
-+
-+	/* invalidate caches */
-+	dma_cache_inv((unsigned int) space, size);
-+
-+	/* now convert pointer to KSEG1 */
-+	space = (ar231x_descr_t *) KSEG1ADDR(space);
-+
-+	memset((void *) space, 0, size);
-+
-+	sp->rx_ring = space;
-+	space += AR2313_DESCR_ENTRIES;
-+
-+	sp->tx_ring = space;
-+	space += AR2313_DESCR_ENTRIES;
-+
-+	/* Initialize the transmit Descriptors */
-+	for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+		ar231x_descr_t *td = &sp->tx_ring[j];
-+		td->status = 0;
-+		td->devcs = DMA_TX1_CHAINED;
-+		td->addr = 0;
-+		td->descr =
-+			virt_to_phys(&sp->
-+						 tx_ring[(j + 1) & (AR2313_DESCR_ENTRIES - 1)]);
-+	}
-+
-+	return 0;
-+}
-+
-+
-+/*
-+ * Generic cleanup handling data allocated during init. Used when the
-+ * module is unloaded or if an error occurs during initialization
-+ */
-+static void ar231x_init_cleanup(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	struct sk_buff *skb;
-+	int j;
-+
-+	ar231x_free_descriptors(dev);
-+
-+	if (sp->eth_regs)
-+		iounmap((void *) sp->eth_regs);
-+	if (sp->dma_regs)
-+		iounmap((void *) sp->dma_regs);
-+
-+	if (sp->rx_skb) {
-+		for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+			skb = sp->rx_skb[j];
-+			if (skb) {
-+				sp->rx_skb[j] = NULL;
-+				dev_kfree_skb(skb);
-+			}
-+		}
-+		kfree(sp->rx_skb);
-+		sp->rx_skb = NULL;
-+	}
-+
-+	if (sp->tx_skb) {
-+		for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+			skb = sp->tx_skb[j];
-+			if (skb) {
-+				sp->tx_skb[j] = NULL;
-+				dev_kfree_skb(skb);
-+			}
-+		}
-+		kfree(sp->tx_skb);
-+		sp->tx_skb = NULL;
-+	}
-+}
-+
-+static int ar231x_setup_timer(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	init_timer(&sp->link_timer);
-+
-+	sp->link_timer.function = ar231x_link_timer_fn;
-+	sp->link_timer.data = (int) dev;
-+	sp->link_timer.expires = jiffies + HZ;
-+
-+	add_timer(&sp->link_timer);
-+	return 0;
-+
-+}
-+
-+static void ar231x_link_timer_fn(unsigned long data)
-+{
-+	struct net_device *dev = (struct net_device *) data;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	// see if the link status changed
-+	// This was needed to make sure we set the PHY to the
-+	// autonegotiated value of half or full duplex.
-+	ar231x_check_link(dev);
-+
-+	// Loop faster when we don't have link.
-+	// This was needed to speed up the AP bootstrap time.
-+	if (sp->link == 0) {
-+		mod_timer(&sp->link_timer, jiffies + HZ / 2);
-+	} else {
-+		mod_timer(&sp->link_timer, jiffies + LINK_TIMER);
-+	}
-+}
-+
-+static void ar231x_check_link(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	u16 phyData;
-+
-+	phyData = ar231x_mdiobus_read(sp->mii_bus, sp->phy, MII_BMSR);
-+	if (sp->phyData != phyData) {
-+		if (phyData & BMSR_LSTATUS) {
-+			/* link is present, ready link partner ability to deterine
-+			   duplexity */
-+			int duplex = 0;
-+			u16 reg;
-+
-+			sp->link = 1;
-+			reg = ar231x_mdiobus_read(sp->mii_bus, sp->phy, MII_BMCR);
-+			if (reg & BMCR_ANENABLE) {
-+				/* auto neg enabled */
-+				reg = ar231x_mdiobus_read(sp->mii_bus, sp->phy, MII_LPA);
-+				duplex = (reg & (LPA_100FULL | LPA_10FULL)) ? 1 : 0;
-+			} else {
-+				/* no auto neg, just read duplex config */
-+				duplex = (reg & BMCR_FULLDPLX) ? 1 : 0;
-+			}
-+
-+			printk(KERN_INFO "%s: Configuring MAC for %s duplex\n",
-+				   dev->name, (duplex) ? "full" : "half");
-+
-+			if (duplex) {
-+				/* full duplex */
-+				sp->eth_regs->mac_control =
-+					((sp->eth_regs->
-+					  mac_control | MAC_CONTROL_F) & ~MAC_CONTROL_DRO);
-+			} else {
-+				/* half duplex */
-+				sp->eth_regs->mac_control =
-+					((sp->eth_regs->
-+					  mac_control | MAC_CONTROL_DRO) & ~MAC_CONTROL_F);
-+			}
-+		} else {
-+			/* no link */
-+			sp->link = 0;
-+		}
-+		sp->phyData = phyData;
-+	}
-+}
-+
-+static int ar231x_reset_reg(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int ethsal, ethsah;
-+	unsigned int flags;
-+
-+	*sp->int_regs |= sp->cfg->reset_mac;
-+	mdelay(10);
-+	*sp->int_regs &= ~sp->cfg->reset_mac;
-+	mdelay(10);
-+	*sp->int_regs |= sp->cfg->reset_phy;
-+	mdelay(10);
-+	*sp->int_regs &= ~sp->cfg->reset_phy;
-+	mdelay(10);
-+
-+	sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR);
-+	mdelay(10);
-+	sp->dma_regs->bus_mode =
-+		((32 << DMA_BUS_MODE_PBL_SHIFT) | DMA_BUS_MODE_BLE);
-+
-+	/* enable interrupts */
-+	sp->dma_regs->intr_ena = (DMA_STATUS_AIS |
-+							  DMA_STATUS_NIS |
-+							  DMA_STATUS_RI |
-+							  DMA_STATUS_TI | DMA_STATUS_FBE);
-+	sp->dma_regs->xmt_base = virt_to_phys(sp->tx_ring);
-+	sp->dma_regs->rcv_base = virt_to_phys(sp->rx_ring);
-+	sp->dma_regs->control =
-+		(DMA_CONTROL_SR | DMA_CONTROL_ST | DMA_CONTROL_SF);
-+
-+	sp->eth_regs->flow_control = (FLOW_CONTROL_FCE);
-+	sp->eth_regs->vlan_tag = (0x8100);
-+
-+	/* Enable Ethernet Interface */
-+	flags = (MAC_CONTROL_TE |	/* transmit enable */
-+			 MAC_CONTROL_PM |	/* pass mcast */
-+			 MAC_CONTROL_F |	/* full duplex */
-+			 MAC_CONTROL_HBD);	/* heart beat disabled */
-+
-+	if (dev->flags & IFF_PROMISC) {	/* set promiscuous mode */
-+		flags |= MAC_CONTROL_PR;
-+	}
-+	sp->eth_regs->mac_control = flags;
-+
-+	/* Set all Ethernet station address registers to their initial values */
-+	ethsah = ((((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) |
-+			  (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF));
-+
-+	ethsal = ((((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) |
-+			  (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) |
-+			  (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) |
-+			  (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF));
-+
-+	sp->eth_regs->mac_addr[0] = ethsah;
-+	sp->eth_regs->mac_addr[1] = ethsal;
-+
-+	mdelay(10);
-+
-+	return (0);
-+}
-+
-+
-+static int ar231x_init(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int ecode = 0;
-+
-+	/*
-+	 * Allocate descriptors
-+	 */
-+	if (ar231x_allocate_descriptors(dev)) {
-+		printk("%s: %s: ar231x_allocate_descriptors failed\n",
-+			   dev->name, __FUNCTION__);
-+		ecode = -EAGAIN;
-+		goto init_error;
-+	}
-+
-+	/*
-+	 * Get the memory for the skb rings.
-+	 */
-+	if (sp->rx_skb == NULL) {
-+		sp->rx_skb =
-+			kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES,
-+					GFP_KERNEL);
-+		if (!(sp->rx_skb)) {
-+			printk("%s: %s: rx_skb kmalloc failed\n",
-+				   dev->name, __FUNCTION__);
-+			ecode = -EAGAIN;
-+			goto init_error;
-+		}
-+	}
-+	memset(sp->rx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
-+
-+	if (sp->tx_skb == NULL) {
-+		sp->tx_skb =
-+			kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES,
-+					GFP_KERNEL);
-+		if (!(sp->tx_skb)) {
-+			printk("%s: %s: tx_skb kmalloc failed\n",
-+				   dev->name, __FUNCTION__);
-+			ecode = -EAGAIN;
-+			goto init_error;
-+		}
-+	}
-+	memset(sp->tx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES);
-+
-+	/*
-+	 * Set tx_csm before we start receiving interrupts, otherwise
-+	 * the interrupt handler might think it is supposed to process
-+	 * tx ints before we are up and running, which may cause a null
-+	 * pointer access in the int handler.
-+	 */
-+	sp->rx_skbprd = 0;
-+	sp->cur_rx = 0;
-+	sp->tx_prd = 0;
-+	sp->tx_csm = 0;
-+
-+	/*
-+	 * Zero the stats before starting the interface
-+	 */
-+	memset(&dev->stats, 0, sizeof(dev->stats));
-+
-+	/*
-+	 * We load the ring here as there seem to be no way to tell the
-+	 * firmware to wipe the ring without re-initializing it.
-+	 */
-+	ar231x_load_rx_ring(dev, RX_RING_SIZE);
-+
-+	/*
-+	 * Init hardware
-+	 */
-+	ar231x_reset_reg(dev);
-+
-+	/*
-+	 * Get the IRQ
-+	 */
-+	ecode =
-+		request_irq(dev->irq, &ar231x_interrupt,
-+					IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
-+					dev->name, dev);
-+	if (ecode) {
-+		printk(KERN_WARNING "%s: %s: Requested IRQ %d is busy\n",
-+			   dev->name, __FUNCTION__, dev->irq);
-+		goto init_error;
-+	}
-+
-+
-+	tasklet_enable(&sp->rx_tasklet);
-+
-+	return 0;
-+
-+  init_error:
-+	ar231x_init_cleanup(dev);
-+	return ecode;
-+}
-+
-+/*
-+ * Load the rx ring.
-+ *
-+ * Loading rings is safe without holding the spin lock since this is
-+ * done only before the device is enabled, thus no interrupts are
-+ * generated and by the interrupt handler/tasklet handler.
-+ */
-+static void ar231x_load_rx_ring(struct net_device *dev, int nr_bufs)
-+{
-+
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	short i, idx;
-+
-+	idx = sp->rx_skbprd;
-+
-+	for (i = 0; i < nr_bufs; i++) {
-+		struct sk_buff *skb;
-+		ar231x_descr_t *rd;
-+
-+		if (sp->rx_skb[idx])
-+			break;
-+
-+		skb = netdev_alloc_skb(dev, AR2313_BUFSIZE);
-+		if (!skb) {
-+			printk("\n\n\n\n %s: No memory in system\n\n\n\n",
-+				   __FUNCTION__);
-+			break;
-+		}
-+
-+		/*
-+		 * Make sure IP header starts on a fresh cache line.
-+		 */
-+		skb->dev = dev;
-+		skb_reserve(skb, RX_OFFSET);
-+		sp->rx_skb[idx] = skb;
-+
-+		rd = (ar231x_descr_t *) & sp->rx_ring[idx];
-+
-+		/* initialize dma descriptor */
-+		rd->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
-+					 DMA_RX1_CHAINED);
-+		rd->addr = virt_to_phys(skb->data);
-+		rd->descr =
-+			virt_to_phys(&sp->
-+						 rx_ring[(idx + 1) & (AR2313_DESCR_ENTRIES - 1)]);
-+		rd->status = DMA_RX_OWN;
-+
-+		idx = DSC_NEXT(idx);
-+	}
-+
-+	if (i)
-+		sp->rx_skbprd = idx;
-+
-+	return;
-+}
-+
-+#define AR2313_MAX_PKTS_PER_CALL        64
-+
-+static int ar231x_rx_int(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	struct sk_buff *skb, *skb_new;
-+	ar231x_descr_t *rxdesc;
-+	unsigned int status;
-+	u32 idx;
-+	int pkts = 0;
-+	int rval;
-+
-+	idx = sp->cur_rx;
-+
-+	/* process at most the entire ring and then wait for another interrupt
-+	 */
-+	while (1) {
-+
-+		rxdesc = &sp->rx_ring[idx];
-+		status = rxdesc->status;
-+		if (status & DMA_RX_OWN) {
-+			/* SiByte owns descriptor or descr not yet filled in */
-+			rval = 0;
-+			break;
-+		}
-+
-+		if (++pkts > AR2313_MAX_PKTS_PER_CALL) {
-+			rval = 1;
-+			break;
-+		}
-+
-+		if ((status & DMA_RX_ERROR) && !(status & DMA_RX_LONG)) {
-+			dev->stats.rx_errors++;
-+			dev->stats.rx_dropped++;
-+
-+			/* add statistics counters */
-+			if (status & DMA_RX_ERR_CRC)
-+				dev->stats.rx_crc_errors++;
-+			if (status & DMA_RX_ERR_COL)
-+				dev->stats.rx_over_errors++;
-+			if (status & DMA_RX_ERR_LENGTH)
-+				dev->stats.rx_length_errors++;
-+			if (status & DMA_RX_ERR_RUNT)
-+				dev->stats.rx_over_errors++;
-+			if (status & DMA_RX_ERR_DESC)
-+				dev->stats.rx_over_errors++;
-+
-+		} else {
-+			/* alloc new buffer. */
-+			skb_new = netdev_alloc_skb(dev, AR2313_BUFSIZE + RX_OFFSET);
-+			if (skb_new != NULL) {
-+
-+				skb = sp->rx_skb[idx];
-+				/* set skb */
-+				skb_put(skb,
-+						((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN);
-+
-+				dev->stats.rx_bytes += skb->len;
-+				skb->protocol = eth_type_trans(skb, dev);
-+				/* pass the packet to upper layers */
-+				netif_rx(skb);
-+
-+				skb_new->dev = dev;
-+				/* 16 bit align */
-+				skb_reserve(skb_new, RX_OFFSET);
-+				/* reset descriptor's curr_addr */
-+				rxdesc->addr = virt_to_phys(skb_new->data);
-+
-+				dev->stats.rx_packets++;
-+				sp->rx_skb[idx] = skb_new;
-+			} else {
-+				dev->stats.rx_dropped++;
-+			}
-+		}
-+
-+		rxdesc->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) |
-+						 DMA_RX1_CHAINED);
-+		rxdesc->status = DMA_RX_OWN;
-+
-+		idx = DSC_NEXT(idx);
-+	}
-+
-+	sp->cur_rx = idx;
-+
-+	return rval;
-+}
-+
-+
-+static void ar231x_tx_int(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	u32 idx;
-+	struct sk_buff *skb;
-+	ar231x_descr_t *txdesc;
-+	unsigned int status = 0;
-+
-+	idx = sp->tx_csm;
-+
-+	while (idx != sp->tx_prd) {
-+		txdesc = &sp->tx_ring[idx];
-+
-+		if ((status = txdesc->status) & DMA_TX_OWN) {
-+			/* ar231x dma still owns descr */
-+			break;
-+		}
-+		/* done with this descriptor */
-+		dma_unmap_single(NULL, txdesc->addr,
-+						 txdesc->devcs & DMA_TX1_BSIZE_MASK,
-+						 DMA_TO_DEVICE);
-+		txdesc->status = 0;
-+
-+		if (status & DMA_TX_ERROR) {
-+			dev->stats.tx_errors++;
-+			dev->stats.tx_dropped++;
-+			if (status & DMA_TX_ERR_UNDER)
-+				dev->stats.tx_fifo_errors++;
-+			if (status & DMA_TX_ERR_HB)
-+				dev->stats.tx_heartbeat_errors++;
-+			if (status & (DMA_TX_ERR_LOSS | DMA_TX_ERR_LINK))
-+				dev->stats.tx_carrier_errors++;
-+			if (status & (DMA_TX_ERR_LATE |
-+						  DMA_TX_ERR_COL |
-+						  DMA_TX_ERR_JABBER | DMA_TX_ERR_DEFER))
-+				dev->stats.tx_aborted_errors++;
-+		} else {
-+			/* transmit OK */
-+			dev->stats.tx_packets++;
-+		}
-+
-+		skb = sp->tx_skb[idx];
-+		sp->tx_skb[idx] = NULL;
-+		idx = DSC_NEXT(idx);
-+		dev->stats.tx_bytes += skb->len;
-+		dev_kfree_skb_irq(skb);
-+	}
-+
-+	sp->tx_csm = idx;
-+
-+	return;
-+}
-+
-+
-+static void rx_tasklet_func(unsigned long data)
-+{
-+	struct net_device *dev = (struct net_device *) data;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	if (sp->unloading) {
-+		return;
-+	}
-+
-+	if (ar231x_rx_int(dev)) {
-+		tasklet_hi_schedule(&sp->rx_tasklet);
-+	} else {
-+		unsigned long flags;
-+		spin_lock_irqsave(&sp->lock, flags);
-+		sp->dma_regs->intr_ena |= DMA_STATUS_RI;
-+		spin_unlock_irqrestore(&sp->lock, flags);
-+	}
-+}
-+
-+static void rx_schedule(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+
-+	sp->dma_regs->intr_ena &= ~DMA_STATUS_RI;
-+
-+	tasklet_hi_schedule(&sp->rx_tasklet);
-+}
-+
-+static irqreturn_t ar231x_interrupt(int irq, void *dev_id)
-+{
-+	struct net_device *dev = (struct net_device *) dev_id;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int status, enabled;
-+
-+	/* clear interrupt */
-+	/*
-+	 * Don't clear RI bit if currently disabled.
-+	 */
-+	status = sp->dma_regs->status;
-+	enabled = sp->dma_regs->intr_ena;
-+	sp->dma_regs->status = status & enabled;
-+
-+	if (status & DMA_STATUS_NIS) {
-+		/* normal status */
-+		/*
-+		 * Don't schedule rx processing if interrupt
-+		 * is already disabled.
-+		 */
-+		if (status & enabled & DMA_STATUS_RI) {
-+			/* receive interrupt */
-+			rx_schedule(dev);
-+		}
-+		if (status & DMA_STATUS_TI) {
-+			/* transmit interrupt */
-+			ar231x_tx_int(dev);
-+		}
-+	}
-+
-+	/* abnormal status */
-+	if (status & (DMA_STATUS_FBE | DMA_STATUS_TPS)) {
-+		ar231x_restart(dev);
-+	}
-+	return IRQ_HANDLED;
-+}
-+
-+
-+static int ar231x_open(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int ethsal, ethsah;
-+
-+	/* reset the hardware, in case the MAC address changed */
-+	ethsah = ((((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) |
-+			  (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF));
-+
-+	ethsal = ((((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) |
-+			  (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) |
-+			  (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) |
-+			  (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF));
-+
-+	sp->eth_regs->mac_addr[0] = ethsah;
-+	sp->eth_regs->mac_addr[1] = ethsal;
-+
-+	mdelay(10);
-+
-+	dev->mtu = 1500;
-+	netif_start_queue(dev);
-+
-+	sp->eth_regs->mac_control |= MAC_CONTROL_RE;
-+
-+	return 0;
-+}
-+
-+static void ar231x_tx_timeout(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned long flags;
-+
-+	spin_lock_irqsave(&sp->lock, flags);
-+	ar231x_restart(dev);
-+	spin_unlock_irqrestore(&sp->lock, flags);
-+}
-+
-+static void ar231x_halt(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int j;
-+
-+	tasklet_disable(&sp->rx_tasklet);
-+
-+	/* kill the MAC */
-+	sp->eth_regs->mac_control &= ~(MAC_CONTROL_RE |	/* disable Receives */
-+								   MAC_CONTROL_TE);	/* disable Transmits */
-+	/* stop dma */
-+	sp->dma_regs->control = 0;
-+	sp->dma_regs->bus_mode = DMA_BUS_MODE_SWR;
-+
-+	/* place phy and MAC in reset */
-+	*sp->int_regs |= (sp->cfg->reset_mac | sp->cfg->reset_phy);
-+
-+	/* free buffers on tx ring */
-+	for (j = 0; j < AR2313_DESCR_ENTRIES; j++) {
-+		struct sk_buff *skb;
-+		ar231x_descr_t *txdesc;
-+
-+		txdesc = &sp->tx_ring[j];
-+		txdesc->descr = 0;
-+
-+		skb = sp->tx_skb[j];
-+		if (skb) {
-+			dev_kfree_skb(skb);
-+			sp->tx_skb[j] = NULL;
-+		}
-+	}
-+}
-+
-+/*
-+ * close should do nothing. Here's why. It's called when
-+ * 'ifconfig bond0 down' is run. If it calls free_irq then
-+ * the irq is gone forever ! When bond0 is made 'up' again,
-+ * the ar231x_open () does not call request_irq (). Worse,
-+ * the call to ar231x_halt() generates a WDOG reset due to
-+ * the write to 'sp->int_regs' and the box reboots.
-+ * Commenting this out is good since it allows the
-+ * system to resume when bond0 is made up again.
-+ */
-+static int ar231x_close(struct net_device *dev)
-+{
-+#if 0
-+	/*
-+	 * Disable interrupts
-+	 */
-+	disable_irq(dev->irq);
-+
-+	/*
-+	 * Without (or before) releasing irq and stopping hardware, this
-+	 * is an absolute non-sense, by the way. It will be reset instantly
-+	 * by the first irq.
-+	 */
-+	netif_stop_queue(dev);
-+
-+	/* stop the MAC and DMA engines */
-+	ar231x_halt(dev);
-+
-+	/* release the interrupt */
-+	free_irq(dev->irq, dev);
-+
-+#endif
-+	return 0;
-+}
-+
-+static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	ar231x_descr_t *td;
-+	u32 idx;
-+
-+	idx = sp->tx_prd;
-+	td = &sp->tx_ring[idx];
-+
-+	if (td->status & DMA_TX_OWN) {
-+		/* free skbuf and lie to the caller that we sent it out */
-+		dev->stats.tx_dropped++;
-+		dev_kfree_skb(skb);
-+
-+		/* restart transmitter in case locked */
-+		sp->dma_regs->xmt_poll = 0;
-+		return 0;
-+	}
-+
-+	/* Setup the transmit descriptor. */
-+	td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) |
-+				 (DMA_TX1_LS | DMA_TX1_IC | DMA_TX1_CHAINED));
-+	td->addr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE);
-+	td->status = DMA_TX_OWN;
-+
-+	/* kick transmitter last */
-+	sp->dma_regs->xmt_poll = 0;
-+
-+	sp->tx_skb[idx] = skb;
-+	idx = DSC_NEXT(idx);
-+	sp->tx_prd = idx;
-+
-+	return 0;
-+}
-+
-+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-+{
-+	struct mii_ioctl_data *data = (struct mii_ioctl_data *) &ifr->ifr_data;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	int ret;
-+
-+	switch (cmd) {
-+
-+	case SIOCETHTOOL:
-+		spin_lock_irq(&sp->lock);
-+		ret = phy_ethtool_ioctl(sp->phy_dev, (void *) ifr->ifr_data);
-+		spin_unlock_irq(&sp->lock);
-+		return ret;
-+
-+	case SIOCSIFHWADDR:
-+		if (copy_from_user
-+			(dev->dev_addr, ifr->ifr_data, sizeof(dev->dev_addr)))
-+			return -EFAULT;
-+		return 0;
-+
-+	case SIOCGIFHWADDR:
-+		if (copy_to_user
-+			(ifr->ifr_data, dev->dev_addr, sizeof(dev->dev_addr)))
-+			return -EFAULT;
-+		return 0;
-+
-+	case SIOCGMIIPHY:
-+	case SIOCGMIIREG:
-+	case SIOCSMIIREG:
-+		return phy_mii_ioctl(sp->phy_dev, data, cmd);
-+
-+	default:
-+		break;
-+	}
-+
-+	return -EOPNOTSUPP;
-+}
-+
-+static void ar231x_adjust_link(struct net_device *dev)
-+{
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	unsigned int mc;
-+
-+	if (!sp->phy_dev->link)
-+		return;
-+
-+	if (sp->phy_dev->duplex != sp->oldduplex) {
-+		mc = readl(&sp->eth_regs->mac_control);
-+		mc &= ~(MAC_CONTROL_F | MAC_CONTROL_DRO);
-+		if (sp->phy_dev->duplex)
-+			mc |= MAC_CONTROL_F;
-+		else
-+			mc |= MAC_CONTROL_DRO;
-+		writel(mc, &sp->eth_regs->mac_control);
-+		sp->oldduplex = sp->phy_dev->duplex;
-+	}
-+}
-+
-+#define MII_ADDR(phy, reg) \
-+	((reg << MII_ADDR_REG_SHIFT) | (phy << MII_ADDR_PHY_SHIFT))
-+
-+static int
-+ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
-+{
-+	struct net_device *const dev = bus->priv;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	volatile ETHERNET_STRUCT *ethernet = sp->phy_regs;
-+
-+	ethernet->mii_addr = MII_ADDR(phy_addr, regnum);
-+	while (ethernet->mii_addr & MII_ADDR_BUSY);
-+	return (ethernet->mii_data >> MII_DATA_SHIFT);
-+}
-+
-+static int
-+ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum,
-+             u16 value)
-+{
-+	struct net_device *const dev = bus->priv;
-+	struct ar231x_private *sp = netdev_priv(dev);
-+	volatile ETHERNET_STRUCT *ethernet = sp->phy_regs;
-+
-+	while (ethernet->mii_addr & MII_ADDR_BUSY);
-+	ethernet->mii_data = value << MII_DATA_SHIFT;
-+	ethernet->mii_addr = MII_ADDR(phy_addr, regnum) | MII_ADDR_WRITE;
-+
-+	return 0;
-+}
-+
-+static int ar231x_mdiobus_reset(struct mii_bus *bus)
-+{
-+	struct net_device *const dev = bus->priv;
-+
-+	ar231x_reset_reg(dev);
-+
-+	return 0;
-+}
-+
-+static int ar231x_mdiobus_probe (struct net_device *dev)
-+{
-+	struct ar231x_private *const sp = netdev_priv(dev);
-+	struct phy_device *phydev = NULL;
-+	int phy_addr;
-+
-+	/* find the first (lowest address) PHY on the current MAC's MII bus */
-+	for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
-+		if (sp->mii_bus->phy_map[phy_addr]) {
-+			phydev = sp->mii_bus->phy_map[phy_addr];
-+			sp->phy = phy_addr;
-+			break; /* break out with first one found */
-+		}
-+
-+	if (!phydev) {
-+		printk (KERN_ERR "ar231x: %s: no PHY found\n", dev->name);
-+		return -1;
-+	}
-+
-+	/* now we are supposed to have a proper phydev, to attach to... */
-+	BUG_ON(!phydev);
-+	BUG_ON(phydev->attached_dev);
-+
-+	phydev = phy_connect(dev, dev_name(&phydev->dev), &ar231x_adjust_link, 0,
-+		PHY_INTERFACE_MODE_MII);
-+
-+	if (IS_ERR(phydev)) {
-+		printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
-+		return PTR_ERR(phydev);
-+	}
-+
-+	/* mask with MAC supported features */
-+	phydev->supported &= (SUPPORTED_10baseT_Half
-+		| SUPPORTED_10baseT_Full
-+		| SUPPORTED_100baseT_Half
-+		| SUPPORTED_100baseT_Full
-+		| SUPPORTED_Autoneg
-+		/* | SUPPORTED_Pause | SUPPORTED_Asym_Pause */
-+		| SUPPORTED_MII
-+		| SUPPORTED_TP);
-+
-+	phydev->advertising = phydev->supported;
-+
-+	sp->oldduplex = -1;
-+	sp->phy_dev = phydev;
-+
-+	printk(KERN_INFO "%s: attached PHY driver [%s] "
-+		"(mii_bus:phy_addr=%s)\n",
-+		dev->name, phydev->drv->name, dev_name(&phydev->dev));
-+
-+	return 0;
-+}
-+
---- /dev/null
-+++ b/drivers/net/ar231x.h
-@@ -0,0 +1,302 @@
-+/*
-+ * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
-+ *
-+ * Copyright (C) 2004 by Sameer Dekate <[email protected]>
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+ *
-+ * Thanks to Atheros for providing hardware and documentation
-+ * enabling me to write this driver.
-+ *
-+ * 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.
-+ */
-+
-+#ifndef _AR2313_H_
-+#define _AR2313_H_
-+
-+#include <generated/autoconf.h>
-+#include <linux/bitops.h>
-+#include <asm/bootinfo.h>
-+#include <ar231x_platform.h>
-+
-+/*
-+ * probe link timer - 5 secs
-+ */
-+#define LINK_TIMER    (5*HZ)
-+
-+#define IS_DMA_TX_INT(X)   (((X) & (DMA_STATUS_TI)) != 0)
-+#define IS_DMA_RX_INT(X)   (((X) & (DMA_STATUS_RI)) != 0)
-+#define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN))    == 0)
-+
-+#define AR2313_TX_TIMEOUT (HZ/4)
-+
-+/*
-+ * Rings
-+ */
-+#define DSC_RING_ENTRIES_SIZE	(AR2313_DESCR_ENTRIES * sizeof(struct desc))
-+#define DSC_NEXT(idx)	        ((idx + 1) & (AR2313_DESCR_ENTRIES - 1))
-+
-+#define AR2313_MBGET		2
-+#define AR2313_MBSET		3
-+#define AR2313_PCI_RECONFIG	4
-+#define AR2313_PCI_DUMP		5
-+#define AR2313_TEST_PANIC	6
-+#define AR2313_TEST_NULLPTR	7
-+#define AR2313_READ_DATA	8
-+#define AR2313_WRITE_DATA	9
-+#define AR2313_GET_VERSION	10
-+#define AR2313_TEST_HANG	11
-+#define AR2313_SYNC		12
-+
-+#define DMA_RX_ERR_CRC		BIT(1)
-+#define DMA_RX_ERR_DRIB		BIT(2)
-+#define DMA_RX_ERR_MII		BIT(3)
-+#define DMA_RX_EV2		BIT(5)
-+#define DMA_RX_ERR_COL		BIT(6)
-+#define DMA_RX_LONG		BIT(7)
-+#define DMA_RX_LS		BIT(8)	/* last descriptor */
-+#define DMA_RX_FS		BIT(9)	/* first descriptor */
-+#define DMA_RX_MF		BIT(10)	/* multicast frame */
-+#define DMA_RX_ERR_RUNT		BIT(11)	/* runt frame */
-+#define DMA_RX_ERR_LENGTH	BIT(12)	/* length error */
-+#define DMA_RX_ERR_DESC		BIT(14)	/* descriptor error */
-+#define DMA_RX_ERROR		BIT(15)	/* error summary */
-+#define DMA_RX_LEN_MASK		0x3fff0000
-+#define DMA_RX_LEN_SHIFT	16
-+#define DMA_RX_FILT		BIT(30)
-+#define DMA_RX_OWN		BIT(31)	/* desc owned by DMA controller */
-+
-+#define DMA_RX1_BSIZE_MASK	0x000007ff
-+#define DMA_RX1_BSIZE_SHIFT	0
-+#define DMA_RX1_CHAINED		BIT(24)
-+#define DMA_RX1_RER		BIT(25)
-+
-+#define DMA_TX_ERR_UNDER	BIT(1)	/* underflow error */
-+#define DMA_TX_ERR_DEFER	BIT(2)	/* excessive deferral */
-+#define DMA_TX_COL_MASK		0x78
-+#define DMA_TX_COL_SHIFT	3
-+#define DMA_TX_ERR_HB		BIT(7)	/* hearbeat failure */
-+#define DMA_TX_ERR_COL		BIT(8)	/* excessive collisions */
-+#define DMA_TX_ERR_LATE		BIT(9)	/* late collision */
-+#define DMA_TX_ERR_LINK		BIT(10)	/* no carrier */
-+#define DMA_TX_ERR_LOSS		BIT(11)	/* loss of carrier */
-+#define DMA_TX_ERR_JABBER	BIT(14)	/* transmit jabber timeout */
-+#define DMA_TX_ERROR		BIT(15)	/* frame aborted */
-+#define DMA_TX_OWN		BIT(31)	/* descr owned by DMA controller */
-+
-+#define DMA_TX1_BSIZE_MASK	0x000007ff
-+#define DMA_TX1_BSIZE_SHIFT	0
-+#define DMA_TX1_CHAINED		BIT(24)	/* chained descriptors */
-+#define DMA_TX1_TER		BIT(25)	/* transmit end of ring */
-+#define DMA_TX1_FS		BIT(29)	/* first segment */
-+#define DMA_TX1_LS		BIT(30)	/* last segment */
-+#define DMA_TX1_IC		BIT(31)	/* interrupt on completion */
-+
-+#define RCVPKT_LENGTH(X)	(X  >> 16)	/* Received pkt Length */
-+
-+#define MAC_CONTROL_RE		BIT(2)	/* receive enable */
-+#define MAC_CONTROL_TE		BIT(3)	/* transmit enable */
-+#define MAC_CONTROL_DC		BIT(5)	/* Deferral check */
-+#define MAC_CONTROL_ASTP	BIT(8)	/* Auto pad strip */
-+#define MAC_CONTROL_DRTY	BIT(10)	/* Disable retry */
-+#define MAC_CONTROL_DBF		BIT(11)	/* Disable bcast frames */
-+#define MAC_CONTROL_LCC		BIT(12)	/* late collision ctrl */
-+#define MAC_CONTROL_HP		BIT(13)	/* Hash Perfect filtering */
-+#define MAC_CONTROL_HASH	BIT(14)	/* Unicast hash filtering */
-+#define MAC_CONTROL_HO		BIT(15)	/* Hash only filtering */
-+#define MAC_CONTROL_PB		BIT(16)	/* Pass Bad frames */
-+#define MAC_CONTROL_IF		BIT(17)	/* Inverse filtering */
-+#define MAC_CONTROL_PR		BIT(18)	/* promiscuous mode (valid frames only) */
-+#define MAC_CONTROL_PM		BIT(19)	/* pass multicast */
-+#define MAC_CONTROL_F		BIT(20)	/* full-duplex */
-+#define MAC_CONTROL_DRO		BIT(23)	/* Disable Receive Own */
-+#define MAC_CONTROL_HBD		BIT(28)	/* heart-beat disabled (MUST BE SET) */
-+#define MAC_CONTROL_BLE		BIT(30)	/* big endian mode */
-+#define MAC_CONTROL_RA		BIT(31)	/* receive all (valid and invalid frames) */
-+
-+#define MII_ADDR_BUSY		BIT(0)
-+#define MII_ADDR_WRITE		BIT(1)
-+#define MII_ADDR_REG_SHIFT	6
-+#define MII_ADDR_PHY_SHIFT	11
-+#define MII_DATA_SHIFT		0
-+
-+#define FLOW_CONTROL_FCE	BIT(1)
-+
-+#define DMA_BUS_MODE_SWR	BIT(0)	/* software reset */
-+#define DMA_BUS_MODE_BLE	BIT(7)	/* big endian mode */
-+#define DMA_BUS_MODE_PBL_SHIFT	8	/* programmable burst length 32 */
-+#define DMA_BUS_MODE_DBO	BIT(20)	/* big-endian descriptors */
-+
-+#define DMA_STATUS_TI		BIT(0)	/* transmit interrupt */
-+#define DMA_STATUS_TPS		BIT(1)	/* transmit process stopped */
-+#define DMA_STATUS_TU		BIT(2)	/* transmit buffer unavailable */
-+#define DMA_STATUS_TJT		BIT(3)	/* transmit buffer timeout */
-+#define DMA_STATUS_UNF		BIT(5)	/* transmit underflow */
-+#define DMA_STATUS_RI		BIT(6)	/* receive interrupt */
-+#define DMA_STATUS_RU		BIT(7)	/* receive buffer unavailable */
-+#define DMA_STATUS_RPS		BIT(8)	/* receive process stopped */
-+#define DMA_STATUS_ETI		BIT(10)	/* early transmit interrupt */
-+#define DMA_STATUS_FBE		BIT(13)	/* fatal bus interrupt */
-+#define DMA_STATUS_ERI		BIT(14)	/* early receive interrupt */
-+#define DMA_STATUS_AIS		BIT(15)	/* abnormal interrupt summary */
-+#define DMA_STATUS_NIS		BIT(16)	/* normal interrupt summary */
-+#define DMA_STATUS_RS_SHIFT	17	/* receive process state */
-+#define DMA_STATUS_TS_SHIFT	20	/* transmit process state */
-+#define DMA_STATUS_EB_SHIFT	23	/* error bits */
-+
-+#define DMA_CONTROL_SR		BIT(1)	/* start receive */
-+#define DMA_CONTROL_ST		BIT(13)	/* start transmit */
-+#define DMA_CONTROL_SF		BIT(21)	/* store and forward */
-+
-+
-+typedef struct {
-+	volatile unsigned int status;	// OWN, Device control and status.
-+	volatile unsigned int devcs;	// pkt Control bits + Length
-+	volatile unsigned int addr;	// Current Address.
-+	volatile unsigned int descr;	// Next descriptor in chain.
-+} ar231x_descr_t;
-+
-+
-+
-+//
-+// New Combo structure for Both Eth0 AND eth1
-+//
-+typedef struct {
-+	volatile unsigned int mac_control;	/* 0x00 */
-+	volatile unsigned int mac_addr[2];	/* 0x04 - 0x08 */
-+	volatile unsigned int mcast_table[2];	/* 0x0c - 0x10 */
-+	volatile unsigned int mii_addr;	/* 0x14 */
-+	volatile unsigned int mii_data;	/* 0x18 */
-+	volatile unsigned int flow_control;	/* 0x1c */
-+	volatile unsigned int vlan_tag;	/* 0x20 */
-+	volatile unsigned int pad[7];	/* 0x24 - 0x3c */
-+	volatile unsigned int ucast_table[8];	/* 0x40-0x5c */
-+
-+} ETHERNET_STRUCT;
-+
-+/********************************************************************
-+ * Interrupt controller
-+ ********************************************************************/
-+
-+typedef struct {
-+	volatile unsigned int wdog_control;	/* 0x08 */
-+	volatile unsigned int wdog_timer;	/* 0x0c */
-+	volatile unsigned int misc_status;	/* 0x10 */
-+	volatile unsigned int misc_mask;	/* 0x14 */
-+	volatile unsigned int global_status;	/* 0x18 */
-+	volatile unsigned int reserved;	/* 0x1c */
-+	volatile unsigned int reset_control;	/* 0x20 */
-+} INTERRUPT;
-+
-+/********************************************************************
-+ * DMA controller
-+ ********************************************************************/
-+typedef struct {
-+	volatile unsigned int bus_mode;	/* 0x00 (CSR0) */
-+	volatile unsigned int xmt_poll;	/* 0x04 (CSR1) */
-+	volatile unsigned int rcv_poll;	/* 0x08 (CSR2) */
-+	volatile unsigned int rcv_base;	/* 0x0c (CSR3) */
-+	volatile unsigned int xmt_base;	/* 0x10 (CSR4) */
-+	volatile unsigned int status;	/* 0x14 (CSR5) */
-+	volatile unsigned int control;	/* 0x18 (CSR6) */
-+	volatile unsigned int intr_ena;	/* 0x1c (CSR7) */
-+	volatile unsigned int rcv_missed;	/* 0x20 (CSR8) */
-+	volatile unsigned int reserved[11];	/* 0x24-0x4c (CSR9-19) */
-+	volatile unsigned int cur_tx_buf_addr;	/* 0x50 (CSR20) */
-+	volatile unsigned int cur_rx_buf_addr;	/* 0x50 (CSR21) */
-+} DMA;
-+
-+/*
-+ * Struct private for the Sibyte.
-+ *
-+ * Elements are grouped so variables used by the tx handling goes
-+ * together, and will go into the same cache lines etc. in order to
-+ * avoid cache line contention between the rx and tx handling on SMP.
-+ *
-+ * Frequently accessed variables are put at the beginning of the
-+ * struct to help the compiler generate better/shorter code.
-+ */
-+struct ar231x_private {
-+	struct net_device *dev;
-+	int version;
-+	u32 mb[2];
-+
-+	volatile ETHERNET_STRUCT *phy_regs;
-+	volatile ETHERNET_STRUCT *eth_regs;
-+	volatile DMA *dma_regs;
-+	volatile u32 *int_regs;
-+	struct ar231x_eth *cfg;
-+
-+	spinlock_t lock;			/* Serialise access to device */
-+
-+	/*
-+	 * RX and TX descriptors, must be adjacent
-+	 */
-+	ar231x_descr_t *rx_ring;
-+	ar231x_descr_t *tx_ring;
-+
-+
-+	struct sk_buff **rx_skb;
-+	struct sk_buff **tx_skb;
-+
-+	/*
-+	 * RX elements
-+	 */
-+	u32 rx_skbprd;
-+	u32 cur_rx;
-+
-+	/*
-+	 * TX elements
-+	 */
-+	u32 tx_prd;
-+	u32 tx_csm;
-+
-+	/*
-+	 * Misc elements
-+	 */
-+	char name[48];
-+	struct {
-+		u32 address;
-+		u32 length;
-+		char *mapping;
-+	} desc;
-+
-+
-+	struct timer_list link_timer;
-+	unsigned short phy;			/* merlot phy = 1, samsung phy = 0x1f */
-+	unsigned short mac;
-+	unsigned short link;		/* 0 - link down, 1 - link up */
-+	u16 phyData;
-+
-+	struct tasklet_struct rx_tasklet;
-+	int unloading;
-+
-+	struct phy_device *phy_dev;
-+	struct mii_bus *mii_bus;
-+	int oldduplex;
-+};
-+
-+
-+/*
-+ * Prototypes
-+ */
-+static int ar231x_init(struct net_device *dev);
-+#ifdef TX_TIMEOUT
-+static void ar231x_tx_timeout(struct net_device *dev);
-+#endif
-+static int ar231x_restart(struct net_device *dev);
-+static void ar231x_load_rx_ring(struct net_device *dev, int bufs);
-+static irqreturn_t ar231x_interrupt(int irq, void *dev_id);
-+static int ar231x_open(struct net_device *dev);
-+static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev);
-+static int ar231x_close(struct net_device *dev);
-+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr,
-+						int cmd);
-+static void ar231x_init_cleanup(struct net_device *dev);
-+static int ar231x_setup_timer(struct net_device *dev);
-+static void ar231x_link_timer_fn(unsigned long data);
-+static void ar231x_check_link(struct net_device *dev);
-+#endif							/* _AR2313_H_ */

+ 0 - 659
target/linux/atheros/patches-2.6.33/120-spiflash.patch

@@ -1,659 +0,0 @@
---- a/drivers/mtd/devices/Kconfig
-+++ b/drivers/mtd/devices/Kconfig
-@@ -112,6 +112,10 @@ config MTD_SST25L
- 	  Set up your spi devices with the right board-specific platform data,
- 	  if you want to specify device partitioning.
- 
-+config MTD_AR2315
-+	tristate "Atheros AR2315+ SPI Flash support"
-+	depends on ATHEROS_AR2315
-+
- config MTD_SLRAM
- 	tristate "Uncached system RAM"
- 	help
---- a/drivers/mtd/devices/Makefile
-+++ b/drivers/mtd/devices/Makefile
-@@ -17,3 +17,4 @@ obj-$(CONFIG_MTD_BLOCK2MTD)	+= block2mtd
- obj-$(CONFIG_MTD_DATAFLASH)	+= mtd_dataflash.o
- obj-$(CONFIG_MTD_M25P80)	+= m25p80.o
- obj-$(CONFIG_MTD_SST25L)	+= sst25l.o
-+obj-$(CONFIG_MTD_AR2315)	+= ar2315.o
---- /dev/null
-+++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,517 @@
-+
-+/*
-+ * MTD driver for the SPI Flash Memory support on Atheros AR2315
-+ *
-+ * Copyright (c) 2005-2006 Atheros Communications Inc.
-+ * Copyright (C) 2006-2007 FON Technology, SL.
-+ * Copyright (C) 2006-2007 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+ *
-+ * This code is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/types.h>
-+#include <linux/version.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+#include <linux/mtd/mtd.h>
-+#include <linux/mtd/partitions.h>
-+#include <linux/platform_device.h>
-+#include <linux/sched.h>
-+#include <linux/root_dev.h>
-+#include <linux/delay.h>
-+#include <asm/delay.h>
-+#include <asm/io.h>
-+
-+#include <ar2315_spiflash.h>
-+#include <ar231x_platform.h>
-+#include <ar231x.h>
-+
-+
-+#define SPIFLASH "spiflash: "
-+#define busy_wait(_priv, _condition, _wait) do { \
-+	while (_condition) { \
-+		spin_unlock_bh(&_priv->lock); \
-+		if (_wait > 1) \
-+			msleep(_wait); \
-+		else if ((_wait == 1) && need_resched()) \
-+			schedule(); \
-+		else \
-+			udelay(1); \
-+		spin_lock_bh(&_priv->lock); \
-+	} \
-+} while (0)
-+
-+enum {
-+	FLASH_NONE,
-+	FLASH_1MB,
-+	FLASH_2MB,
-+	FLASH_4MB,
-+	FLASH_8MB,
-+	FLASH_16MB,
-+};
-+
-+/* Flash configuration table */
-+struct flashconfig {
-+	u32 byte_cnt;
-+	u32 sector_cnt;
-+	u32 sector_size;
-+};
-+
-+const struct flashconfig flashconfig_tbl[] = {
-+	[FLASH_NONE] = { 0, 0, 0},
-+	[FLASH_1MB]  = { STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT, STM_1MB_SECTOR_SIZE},
-+	[FLASH_2MB]  = { STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT, STM_2MB_SECTOR_SIZE},
-+	[FLASH_4MB]  = { STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT, STM_4MB_SECTOR_SIZE},
-+	[FLASH_8MB]  = { STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT, STM_8MB_SECTOR_SIZE},
-+	[FLASH_16MB] = { STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT, STM_16MB_SECTOR_SIZE}
-+};
-+
-+/* Mapping of generic opcodes to STM serial flash opcodes */
-+enum {
-+	SPI_WRITE_ENABLE,
-+	SPI_WRITE_DISABLE,
-+	SPI_RD_STATUS,
-+	SPI_WR_STATUS,
-+	SPI_RD_DATA,
-+	SPI_FAST_RD_DATA,
-+	SPI_PAGE_PROGRAM,
-+	SPI_SECTOR_ERASE,
-+	SPI_BULK_ERASE,
-+	SPI_DEEP_PWRDOWN,
-+	SPI_RD_SIG,
-+};
-+
-+struct opcodes {
-+    __u16 code;
-+    __s8 tx_cnt;
-+    __s8 rx_cnt;
-+};
-+const struct opcodes stm_opcodes[] = {
-+	[SPI_WRITE_ENABLE] = {STM_OP_WR_ENABLE, 1, 0},
-+	[SPI_WRITE_DISABLE] = {STM_OP_WR_DISABLE, 1, 0},
-+	[SPI_RD_STATUS] = {STM_OP_RD_STATUS, 1, 1},
-+	[SPI_WR_STATUS] = {STM_OP_WR_STATUS, 1, 0},
-+	[SPI_RD_DATA] = {STM_OP_RD_DATA, 4, 4},
-+	[SPI_FAST_RD_DATA] = {STM_OP_FAST_RD_DATA, 5, 0},
-+	[SPI_PAGE_PROGRAM] = {STM_OP_PAGE_PGRM, 8, 0},
-+	[SPI_SECTOR_ERASE] = {STM_OP_SECTOR_ERASE, 4, 0},
-+	[SPI_BULK_ERASE] = {STM_OP_BULK_ERASE, 1, 0},
-+	[SPI_DEEP_PWRDOWN] = {STM_OP_DEEP_PWRDOWN, 1, 0},
-+	[SPI_RD_SIG] = {STM_OP_RD_SIG, 4, 1},
-+};
-+
-+/* Driver private data structure */
-+struct spiflash_priv {
-+	struct mtd_info mtd;
-+	void *readaddr; /* memory mapped data for read  */
-+	void *mmraddr;  /* memory mapped register space */
-+	wait_queue_head_t wq;
-+	spinlock_t lock;
-+	int state;
-+};
-+
-+#define to_spiflash(_mtd) container_of(_mtd, struct spiflash_priv, mtd)
-+
-+enum {
-+	FL_READY,
-+	FL_READING,
-+	FL_ERASING,
-+	FL_WRITING
-+};
-+
-+/***************************************************************************************************/
-+
-+static u32
-+spiflash_read_reg(struct spiflash_priv *priv, int reg)
-+{
-+	return ar231x_read_reg((u32) priv->mmraddr + reg);
-+}
-+
-+static void
-+spiflash_write_reg(struct spiflash_priv *priv, int reg, u32 data)
-+{
-+	ar231x_write_reg((u32) priv->mmraddr + reg, data);
-+}
-+
-+static u32
-+spiflash_wait_busy(struct spiflash_priv *priv)
-+{
-+	u32 reg;
-+
-+	busy_wait(priv, (reg = spiflash_read_reg(priv, SPI_FLASH_CTL)) &
-+		SPI_CTL_BUSY, 0);
-+	return reg;
-+}
-+
-+static u32
-+spiflash_sendcmd (struct spiflash_priv *priv, int opcode, u32 addr)
-+{
-+	const struct opcodes *op;
-+	u32 reg, mask;
-+
-+	op = &stm_opcodes[opcode];
-+	reg = spiflash_wait_busy(priv);
-+	spiflash_write_reg(priv, SPI_FLASH_OPCODE,
-+		((u32) op->code) | (addr << 8));
-+
-+	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+	reg |= SPI_CTL_START | op->tx_cnt | (op->rx_cnt << 4);
-+
-+	spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
-+	spiflash_wait_busy(priv);
-+
-+	if (!op->rx_cnt)
-+		return 0;
-+
-+	reg = spiflash_read_reg(priv, SPI_FLASH_DATA);
-+
-+	switch (op->rx_cnt) {
-+	case 1:
-+		mask = 0x000000ff;
-+		break;
-+	case 2:
-+		mask = 0x0000ffff;
-+		break;
-+	case 3:
-+		mask = 0x00ffffff;
-+		break;
-+	default:
-+		mask = 0xffffffff;
-+		break;
-+	}
-+	reg &= mask;
-+
-+	return reg;
-+}
-+
-+
-+/*
-+ * Probe SPI flash device
-+ * Function returns 0 for failure.
-+ * and flashconfig_tbl array index for success.
-+ */
-+static int
-+spiflash_probe_chip (struct spiflash_priv *priv)
-+{
-+	u32 sig;
-+	int flash_size;
-+
-+	/* Read the signature on the flash device */
-+	spin_lock_bh(&priv->lock);
-+	sig = spiflash_sendcmd(priv, SPI_RD_SIG, 0);
-+	spin_unlock_bh(&priv->lock);
-+
-+	switch (sig) {
-+	case STM_8MBIT_SIGNATURE:
-+		flash_size = FLASH_1MB;
-+		break;
-+	case STM_16MBIT_SIGNATURE:
-+		flash_size = FLASH_2MB;
-+		break;
-+	case STM_32MBIT_SIGNATURE:
-+		flash_size = FLASH_4MB;
-+		break;
-+	case STM_64MBIT_SIGNATURE:
-+		flash_size = FLASH_8MB;
-+		break;
-+	case STM_128MBIT_SIGNATURE:
-+		flash_size = FLASH_16MB;
-+		break;
-+	default:
-+		printk (KERN_WARNING SPIFLASH "Read of flash device signature failed!\n");
-+		return 0;
-+	}
-+
-+	return flash_size;
-+}
-+
-+
-+/* wait until the flash chip is ready and grab a lock */
-+static int spiflash_wait_ready(struct spiflash_priv *priv, int state)
-+{
-+	DECLARE_WAITQUEUE(wait, current);
-+
-+retry:
-+	spin_lock_bh(&priv->lock);
-+	if (priv->state != FL_READY) {
-+		set_current_state(TASK_UNINTERRUPTIBLE);
-+		add_wait_queue(&priv->wq, &wait);
-+		spin_unlock_bh(&priv->lock);
-+		schedule();
-+		remove_wait_queue(&priv->wq, &wait);
-+
-+		if(signal_pending(current))
-+			return 0;
-+
-+		goto retry;
-+	}
-+	priv->state = state;
-+
-+	return 1;
-+}
-+
-+static inline void spiflash_done(struct spiflash_priv *priv)
-+{
-+	priv->state = FL_READY;
-+	spin_unlock_bh(&priv->lock);
-+	wake_up(&priv->wq);
-+}
-+
-+static void
-+spiflash_wait_complete(struct spiflash_priv *priv, unsigned int timeout)
-+{
-+	busy_wait(priv, spiflash_sendcmd(priv, SPI_RD_STATUS, 0) &
-+		SPI_STATUS_WIP, timeout);
-+	spiflash_done(priv);
-+}
-+
-+
-+
-+static int
-+spiflash_erase (struct mtd_info *mtd, struct erase_info *instr)
-+{
-+	struct spiflash_priv *priv = to_spiflash(mtd);
-+	const struct opcodes *op;
-+	u32 temp, reg;
-+
-+	if (instr->addr + instr->len > mtd->size)
-+		return -EINVAL;
-+
-+	if (!spiflash_wait_ready(priv, FL_ERASING))
-+		return -EINTR;
-+
-+	spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
-+	reg = spiflash_wait_busy(priv);
-+
-+	op = &stm_opcodes[SPI_SECTOR_ERASE];
-+	temp = ((u32)instr->addr << 8) | (u32)(op->code);
-+	spiflash_write_reg(priv, SPI_FLASH_OPCODE, temp);
-+
-+	reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+	reg |= op->tx_cnt | SPI_CTL_START;
-+	spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
-+
-+	spiflash_wait_complete(priv, 20);
-+
-+	instr->state = MTD_ERASE_DONE;
-+	mtd_erase_callback(instr);
-+
-+	return 0;
-+}
-+
-+static int
-+spiflash_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
-+{
-+	struct spiflash_priv *priv = to_spiflash(mtd);
-+	u8 *read_addr;
-+
-+	if (!len)
-+		return 0;
-+
-+	if (from + len > mtd->size)
-+		return -EINVAL;
-+
-+	*retlen = len;
-+
-+	if (!spiflash_wait_ready(priv, FL_READING))
-+		return -EINTR;
-+
-+	read_addr = (u8 *)(priv->readaddr + from);
-+	memcpy_fromio(buf, read_addr, len);
-+	spiflash_done(priv);
-+
-+	return 0;
-+}
-+
-+static int
-+spiflash_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u8 *buf)
-+{
-+	struct spiflash_priv *priv = to_spiflash(mtd);
-+	u32 opcode, bytes_left;
-+
-+	*retlen = 0;
-+
-+	if (!len)
-+		return 0;
-+
-+	if (to + len > mtd->size)
-+		return -EINVAL;
-+
-+	bytes_left = len;
-+
-+	do {
-+		u32 read_len, reg, page_offset, spi_data = 0;
-+
-+		read_len = min(bytes_left, sizeof(u32));
-+
-+		/* 32-bit writes cannot span across a page boundary
-+		 * (256 bytes). This types of writes require two page
-+		 * program operations to handle it correctly. The STM part
-+		 * will write the overflow data to the beginning of the
-+		 * current page as opposed to the subsequent page.
-+		 */
-+		page_offset = (to & (STM_PAGE_SIZE - 1)) + read_len;
-+
-+		if (page_offset > STM_PAGE_SIZE)
-+			read_len -= (page_offset - STM_PAGE_SIZE);
-+
-+		if (!spiflash_wait_ready(priv, FL_WRITING))
-+			return -EINTR;
-+
-+		spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
-+		spi_data = 0;
-+		switch (read_len) {
-+		case 4:
-+			spi_data |= buf[3] << 24;
-+			/* fall through */
-+		case 3:
-+			spi_data |= buf[2] << 16;
-+			/* fall through */
-+		case 2:
-+			spi_data |= buf[1] << 8;
-+			/* fall through */
-+		case 1:
-+			spi_data |= buf[0] & 0xff;
-+			break;
-+		default:
-+			break;
-+		}
-+
-+		spiflash_write_reg(priv, SPI_FLASH_DATA, spi_data);
-+		opcode = stm_opcodes[SPI_PAGE_PROGRAM].code |
-+			(to & 0x00ffffff) << 8;
-+		spiflash_write_reg(priv, SPI_FLASH_OPCODE, opcode);
-+
-+		reg = spiflash_read_reg(priv, SPI_FLASH_CTL);
-+		reg &= ~SPI_CTL_TX_RX_CNT_MASK;
-+		reg |= (read_len + 4) | SPI_CTL_START;
-+		spiflash_write_reg(priv, SPI_FLASH_CTL, reg);
-+
-+		spiflash_wait_complete(priv, 1);
-+
-+		bytes_left -= read_len;
-+		to += read_len;
-+		buf += read_len;
-+
-+		*retlen += read_len;
-+	} while (bytes_left != 0);
-+
-+	return 0;
-+}
-+
-+
-+#ifdef CONFIG_MTD_PARTITIONS
-+static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "MyLoader", NULL };
-+#endif
-+
-+
-+static int
-+spiflash_probe(struct platform_device *pdev)
-+{
-+	struct spiflash_priv *priv;
-+	struct mtd_partition *parts;
-+	struct mtd_info *mtd;
-+	int index, num_parts;
-+	int result = 0;
-+
-+	priv = kzalloc(sizeof(struct spiflash_priv), GFP_KERNEL);
-+	spin_lock_init(&priv->lock);
-+	init_waitqueue_head(&priv->wq);
-+	priv->state = FL_READY;
-+	mtd = &priv->mtd;
-+
-+	priv->mmraddr = ioremap_nocache(SPI_FLASH_MMR, SPI_FLASH_MMR_SIZE);
-+	if (!priv->mmraddr) {
-+		printk(KERN_WARNING SPIFLASH "Failed to map flash device\n");
-+		goto error;
-+	}
-+
-+	index = spiflash_probe_chip(priv);
-+	if (!index) {
-+		printk (KERN_WARNING SPIFLASH "Found no serial flash device\n");
-+		goto error;
-+	}
-+
-+	priv->readaddr = ioremap_nocache(SPI_FLASH_READ, flashconfig_tbl[index].byte_cnt);
-+	if (!priv->readaddr) {
-+		printk (KERN_WARNING SPIFLASH "Failed to map flash device\n");
-+		goto error;
-+	}
-+
-+	platform_set_drvdata(pdev, priv);
-+	mtd->name = "spiflash";
-+	mtd->type = MTD_NORFLASH;
-+	mtd->flags = (MTD_CAP_NORFLASH|MTD_WRITEABLE);
-+	mtd->size = flashconfig_tbl[index].byte_cnt;
-+	mtd->erasesize = flashconfig_tbl[index].sector_size;
-+	mtd->writesize = 1;
-+	mtd->numeraseregions = 0;
-+	mtd->eraseregions = NULL;
-+	mtd->erase = spiflash_erase;
-+	mtd->read = spiflash_read;
-+	mtd->write = spiflash_write;
-+	mtd->owner = THIS_MODULE;
-+
-+#ifdef CONFIG_MTD_PARTITIONS
-+	/* parse redboot partitions */
-+	num_parts = parse_mtd_partitions(mtd, part_probe_types, &parts, 0);
-+	if (!num_parts)
-+		goto error;
-+
-+	result = add_mtd_partitions(mtd, parts, num_parts);
-+#endif
-+
-+	return result;
-+
-+error:
-+	if (priv->mmraddr)
-+		iounmap(priv->mmraddr);
-+	kfree(priv);
-+	return -ENXIO;
-+}
-+
-+static int
-+spiflash_remove (struct platform_device *pdev)
-+{
-+	struct spiflash_priv *priv = platform_get_drvdata(pdev);
-+	struct mtd_info *mtd = &priv->mtd;
-+
-+	del_mtd_partitions(mtd);
-+	iounmap(priv->mmraddr);
-+	iounmap(priv->readaddr);
-+	kfree(priv);
-+
-+	return 0;
-+}
-+
-+struct platform_driver spiflash_driver = {
-+	.driver.name = "spiflash",
-+	.probe = spiflash_probe,
-+	.remove = spiflash_remove,
-+};
-+
-+int __init
-+spiflash_init (void)
-+{
-+	return platform_driver_register(&spiflash_driver);
-+}
-+
-+void __exit
-+spiflash_exit (void)
-+{
-+	return platform_driver_unregister(&spiflash_driver);
-+}
-+
-+module_init (spiflash_init);
-+module_exit (spiflash_exit);
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("OpenWrt.org, Atheros Communications Inc");
-+MODULE_DESCRIPTION("MTD driver for SPI Flash on Atheros SOC");
-+
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ar231x/ar2315_spiflash.h
-@@ -0,0 +1,116 @@
-+/*
-+ * SPI Flash Memory support header file.
-+ *
-+ * Copyright (c) 2005, Atheros Communications Inc.
-+ * Copyright (C) 2006 FON Technology, SL.
-+ * Copyright (C) 2006 Imre Kaloz <[email protected]>
-+ * Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
-+ *
-+ * This code is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License version 2 as
-+ * published by the Free Software Foundation.
-+ *
-+ */
-+#ifndef __AR2315_SPIFLASH_H
-+#define __AR2315_SPIFLASH_H
-+
-+#define STM_PAGE_SIZE           256
-+
-+#define SFI_WRITE_BUFFER_SIZE   4
-+#define SFI_FLASH_ADDR_MASK     0x00ffffff
-+
-+#define STM_8MBIT_SIGNATURE     0x13
-+#define STM_M25P80_BYTE_COUNT   1048576
-+#define STM_M25P80_SECTOR_COUNT 16
-+#define STM_M25P80_SECTOR_SIZE  0x10000
-+
-+#define STM_16MBIT_SIGNATURE    0x14
-+#define STM_M25P16_BYTE_COUNT   2097152
-+#define STM_M25P16_SECTOR_COUNT 32
-+#define STM_M25P16_SECTOR_SIZE  0x10000
-+
-+#define STM_32MBIT_SIGNATURE    0x15
-+#define STM_M25P32_BYTE_COUNT   4194304
-+#define STM_M25P32_SECTOR_COUNT 64
-+#define STM_M25P32_SECTOR_SIZE  0x10000
-+
-+#define STM_64MBIT_SIGNATURE    0x16
-+#define STM_M25P64_BYTE_COUNT   8388608
-+#define STM_M25P64_SECTOR_COUNT 128
-+#define STM_M25P64_SECTOR_SIZE  0x10000
-+
-+#define STM_128MBIT_SIGNATURE   0x17
-+#define STM_M25P128_BYTE_COUNT   16777216
-+#define STM_M25P128_SECTOR_COUNT 256
-+#define STM_M25P128_SECTOR_SIZE  0x10000
-+
-+#define STM_1MB_BYTE_COUNT   STM_M25P80_BYTE_COUNT
-+#define STM_1MB_SECTOR_COUNT STM_M25P80_SECTOR_COUNT
-+#define STM_1MB_SECTOR_SIZE  STM_M25P80_SECTOR_SIZE
-+#define STM_2MB_BYTE_COUNT   STM_M25P16_BYTE_COUNT
-+#define STM_2MB_SECTOR_COUNT STM_M25P16_SECTOR_COUNT
-+#define STM_2MB_SECTOR_SIZE  STM_M25P16_SECTOR_SIZE
-+#define STM_4MB_BYTE_COUNT   STM_M25P32_BYTE_COUNT
-+#define STM_4MB_SECTOR_COUNT STM_M25P32_SECTOR_COUNT
-+#define STM_4MB_SECTOR_SIZE  STM_M25P32_SECTOR_SIZE
-+#define STM_8MB_BYTE_COUNT   STM_M25P64_BYTE_COUNT
-+#define STM_8MB_SECTOR_COUNT STM_M25P64_SECTOR_COUNT
-+#define STM_8MB_SECTOR_SIZE  STM_M25P64_SECTOR_SIZE
-+#define STM_16MB_BYTE_COUNT   STM_M25P128_BYTE_COUNT
-+#define STM_16MB_SECTOR_COUNT STM_M25P128_SECTOR_COUNT
-+#define STM_16MB_SECTOR_SIZE  STM_M25P128_SECTOR_SIZE
-+
-+/*
-+ * ST Microelectronics Opcodes for Serial Flash
-+ */
-+
-+#define STM_OP_WR_ENABLE       0x06     /* Write Enable */
-+#define STM_OP_WR_DISABLE      0x04     /* Write Disable */
-+#define STM_OP_RD_STATUS       0x05     /* Read Status */
-+#define STM_OP_WR_STATUS       0x01     /* Write Status */
-+#define STM_OP_RD_DATA         0x03     /* Read Data */
-+#define STM_OP_FAST_RD_DATA    0x0b     /* Fast Read Data */
-+#define STM_OP_PAGE_PGRM       0x02     /* Page Program */
-+#define STM_OP_SECTOR_ERASE    0xd8     /* Sector Erase */
-+#define STM_OP_BULK_ERASE      0xc7     /* Bulk Erase */
-+#define STM_OP_DEEP_PWRDOWN    0xb9     /* Deep Power-Down Mode */
-+#define STM_OP_RD_SIG          0xab     /* Read Electronic Signature */
-+
-+#define STM_STATUS_WIP       0x01       /* Write-In-Progress */
-+#define STM_STATUS_WEL       0x02       /* Write Enable Latch */
-+#define STM_STATUS_BP0       0x04       /* Block Protect 0 */
-+#define STM_STATUS_BP1       0x08       /* Block Protect 1 */
-+#define STM_STATUS_BP2       0x10       /* Block Protect 2 */
-+#define STM_STATUS_SRWD      0x80       /* Status Register Write Disable */
-+
-+/*
-+ * SPI Flash Interface Registers
-+ */
-+#define AR531XPLUS_SPI_READ     0x08000000
-+#define AR531XPLUS_SPI_MMR      0x11300000
-+#define AR531XPLUS_SPI_MMR_SIZE 12
-+
-+#define AR531XPLUS_SPI_CTL      0x00
-+#define AR531XPLUS_SPI_OPCODE   0x04
-+#define AR531XPLUS_SPI_DATA     0x08
-+
-+#define SPI_FLASH_READ          AR531XPLUS_SPI_READ
-+#define SPI_FLASH_MMR           AR531XPLUS_SPI_MMR
-+#define SPI_FLASH_MMR_SIZE      AR531XPLUS_SPI_MMR_SIZE
-+#define SPI_FLASH_CTL           AR531XPLUS_SPI_CTL
-+#define SPI_FLASH_OPCODE        AR531XPLUS_SPI_OPCODE
-+#define SPI_FLASH_DATA          AR531XPLUS_SPI_DATA
-+
-+#define SPI_CTL_START           0x00000100
-+#define SPI_CTL_BUSY            0x00010000
-+#define SPI_CTL_TXCNT_MASK      0x0000000f
-+#define SPI_CTL_RXCNT_MASK      0x000000f0
-+#define SPI_CTL_TX_RX_CNT_MASK  0x000000ff
-+#define SPI_CTL_SIZE_MASK       0x00060000
-+
-+#define SPI_CTL_CLK_SEL_MASK    0x03000000
-+#define SPI_OPCODE_MASK         0x000000ff
-+
-+#define SPI_STATUS_WIP		STM_STATUS_WIP
-+
-+#endif

+ 0 - 228
target/linux/atheros/patches-2.6.33/130-watchdog.patch

@@ -1,228 +0,0 @@
---- /dev/null
-+++ b/drivers/watchdog/ar2315-wtd.c
-@@ -0,0 +1,200 @@
-+/*
-+ * 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
-+ *
-+ * Copyright (C) 2008 John Crispin <[email protected]>
-+ * Based on EP93xx and ifxmips wdt driver
-+ */
-+
-+#include <linux/interrupt.h>
-+#include <linux/module.h>
-+#include <linux/moduleparam.h>
-+#include <linux/types.h>
-+#include <linux/miscdevice.h>
-+#include <linux/watchdog.h>
-+#include <linux/fs.h>
-+#include <linux/ioport.h>
-+#include <linux/notifier.h>
-+#include <linux/reboot.h>
-+#include <linux/init.h>
-+#include <linux/platform_device.h>
-+
-+#include <asm/io.h>
-+#include <asm/uaccess.h>
-+#include <asm/system.h>
-+#include <asm/addrspace.h>
-+#include <ar231x_platform.h>
-+#include <ar2315_regs.h>
-+#include <ar231x.h>
-+
-+#define CLOCK_RATE 40000000
-+#define HEARTBEAT(x) (x < 1 || x > 90)?(20):(x)
-+
-+static int wdt_timeout = 20;
-+static int started = 0;
-+static int in_use = 0;
-+
-+static void
-+ar2315_wdt_enable(void)
-+{
-+	ar231x_write_reg(AR2315_WD, wdt_timeout * CLOCK_RATE);
-+	ar231x_write_reg(AR2315_ISR, 0x80);
-+}
-+
-+static ssize_t
-+ar2315_wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
-+{
-+	if(len)
-+		ar2315_wdt_enable();
-+	return len;
-+}
-+
-+static int
-+ar2315_wdt_open(struct inode *inode, struct file *file)
-+{
-+	if(in_use)
-+		return -EBUSY;
-+	ar2315_wdt_enable();
-+	in_use = started = 1;
-+	return nonseekable_open(inode, file);
-+}
-+
-+static int
-+ar2315_wdt_release(struct inode *inode, struct file *file)
-+{
-+	in_use = 0;
-+	return 0;
-+}
-+
-+static irqreturn_t
-+ar2315_wdt_interrupt(int irq, void *dev_id)
-+{
-+	if(started)
-+	{
-+		printk(KERN_CRIT "watchdog expired, rebooting system\n");
-+		emergency_restart();
-+	} else {
-+		ar231x_write_reg(AR2315_WDC, 0);
-+		ar231x_write_reg(AR2315_WD, 0);
-+		ar231x_write_reg(AR2315_ISR, 0x80);
-+	}
-+	return IRQ_HANDLED;
-+}
-+
-+static struct watchdog_info ident = {
-+	.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
-+	.identity = "ar2315 Watchdog",
-+};
-+
-+static int
-+ar2315_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-+{
-+	int new_wdt_timeout;
-+	int ret = -ENOIOCTLCMD;
-+
-+	switch(cmd)
-+	{
-+		case WDIOC_GETSUPPORT:
-+			ret = copy_to_user((struct watchdog_info __user *)arg, &ident, sizeof(ident)) ? -EFAULT : 0;
-+			break;
-+
-+		case WDIOC_KEEPALIVE:
-+			ar2315_wdt_enable();
-+			ret = 0;
-+			break;
-+
-+		case WDIOC_SETTIMEOUT:
-+			if((ret = get_user(new_wdt_timeout, (int __user *)arg)))
-+				break;
-+			wdt_timeout = HEARTBEAT(new_wdt_timeout);
-+			ar2315_wdt_enable();
-+			break;
-+
-+		case WDIOC_GETTIMEOUT:
-+			ret = put_user(wdt_timeout, (int __user *)arg);
-+			break;
-+	}
-+	return ret;
-+}
-+
-+static struct file_operations ar2315_wdt_fops = {
-+	.owner		= THIS_MODULE,
-+	.llseek		= no_llseek,
-+	.write		= ar2315_wdt_write,
-+	.ioctl		= ar2315_wdt_ioctl,
-+	.open		= ar2315_wdt_open,
-+	.release	= ar2315_wdt_release,
-+};
-+
-+static struct miscdevice ar2315_wdt_miscdev = {
-+	.minor	= WATCHDOG_MINOR,
-+	.name	= "watchdog",
-+	.fops	= &ar2315_wdt_fops,
-+};
-+
-+static int
-+ar2315_wdt_probe(struct platform_device *dev)
-+{
-+	int ret = 0;
-+
-+	ar2315_wdt_enable();
-+	ret = request_irq(AR531X_MISC_IRQ_WATCHDOG, ar2315_wdt_interrupt, IRQF_DISABLED, "ar2315_wdt", NULL);
-+	if(ret)
-+	{
-+		printk(KERN_ERR "ar2315wdt: failed to register inetrrupt\n");
-+		goto out;
-+	}
-+
-+	ret = misc_register(&ar2315_wdt_miscdev);
-+	if(ret)
-+		printk(KERN_ERR "ar2315wdt: failed to register miscdev\n");
-+
-+out:
-+	return ret;
-+}
-+
-+static int
-+ar2315_wdt_remove(struct platform_device *dev)
-+{
-+	misc_deregister(&ar2315_wdt_miscdev);
-+	free_irq(AR531X_MISC_IRQ_WATCHDOG, NULL);
-+	return 0;
-+}
-+
-+static struct platform_driver ar2315_wdt_driver = {
-+	.probe = ar2315_wdt_probe,
-+	.remove = ar2315_wdt_remove,
-+	.driver = {
-+		.name = "ar2315_wdt",
-+		.owner = THIS_MODULE,
-+	},
-+};
-+
-+static int __init
-+init_ar2315_wdt(void)
-+{
-+	int ret = platform_driver_register(&ar2315_wdt_driver);
-+	if(ret)
-+		printk(KERN_INFO "ar2315_wdt: error registering platfom driver!");
-+	return ret;
-+}
-+
-+static void __exit
-+exit_ar2315_wdt(void)
-+{
-+	platform_driver_unregister(&ar2315_wdt_driver);
-+}
-+
-+module_init(init_ar2315_wdt);
-+module_exit(exit_ar2315_wdt);
---- a/drivers/watchdog/Kconfig
-+++ b/drivers/watchdog/Kconfig
-@@ -840,6 +840,12 @@ config TXX9_WDT
- 	help
- 	  Hardware driver for the built-in watchdog timer on TXx9 MIPS SoCs.
- 
-+config ATHEROS_WDT
-+	tristate "Atheros wisoc Watchdog Timer"
-+	depends on ATHEROS_AR231X
-+	help
-+	  Hardware driver for the Atheros wisoc Watchdog Timer.
-+
- # PARISC Architecture
- 
- # POWERPC Architecture
---- a/drivers/watchdog/Makefile
-+++ b/drivers/watchdog/Makefile
-@@ -112,6 +112,7 @@ obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt
- obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
- obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
- obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
-+obj-$(CONFIG_ATHEROS_WDT) += ar2315-wtd.o
- 
- # PARISC Architecture
- 

+ 0 - 54
target/linux/atheros/patches-2.6.33/140-redboot_partition_scan.patch

@@ -1,54 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -60,31 +60,32 @@ static int parse_redboot_partitions(stru
- 	static char nullstring[] = "unallocated";
- #endif
- 
-+	buf = vmalloc(master->erasesize);
-+	if (!buf)
-+		return -ENOMEM;
-+
-+ restart:
- 	if ( directory < 0 ) {
- 		offset = master->size + directory * master->erasesize;
--		while (master->block_isbad && 
-+		while (master->block_isbad &&
- 		       master->block_isbad(master, offset)) {
- 			if (!offset) {
- 			nogood:
- 				printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n");
-+				vfree(buf);
- 				return -EIO;
- 			}
- 			offset -= master->erasesize;
- 		}
- 	} else {
- 		offset = directory * master->erasesize;
--		while (master->block_isbad && 
-+		while (master->block_isbad &&
- 		       master->block_isbad(master, offset)) {
- 			offset += master->erasesize;
- 			if (offset == master->size)
- 				goto nogood;
- 		}
- 	}
--	buf = vmalloc(master->erasesize);
--
--	if (!buf)
--		return -ENOMEM;
--
- 	printk(KERN_NOTICE "Searching for RedBoot partition table in %s at offset 0x%lx\n",
- 	       master->name, offset);
- 
-@@ -156,6 +157,11 @@ static int parse_redboot_partitions(stru
- 	}
- 	if (i == numslots) {
- 		/* Didn't find it */
-+		if (offset + master->erasesize < master->size) {
-+			/* not at the end of the flash yet, maybe next block :) */
-+			directory++;
-+			goto restart;
-+		}
- 		printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
- 		       master->name);
- 		ret = 0;

+ 0 - 72
target/linux/atheros/patches-2.6.33/141-redboot_various_erase_size_fix.patch

@@ -1,72 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -39,6 +39,22 @@ static inline int redboot_checksum(struc
- 	return 1;
- }
- 
-+static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset)
-+{
-+	struct mtd_erase_region_info *regions = mtd->eraseregions;
-+	int i;
-+
-+	for (i = 0; i < mtd->numeraseregions; i++) {
-+		if (regions[i].offset +
-+		    regions[i].numblocks * regions[i].erasesize <= offset)
-+			continue;
-+
-+		return regions[i].erasesize;
-+	}
-+
-+	return mtd->erasesize;
-+}
-+
- static int parse_redboot_partitions(struct mtd_info *master,
-                              struct mtd_partition **pparts,
-                              unsigned long fis_origin)
-@@ -55,6 +71,7 @@ static int parse_redboot_partitions(stru
- 	int namelen = 0;
- 	int nulllen = 0;
- 	int numslots;
-+	int first_slot;
- 	unsigned long offset;
- #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
- 	static char nullstring[] = "unallocated";
-@@ -168,7 +185,10 @@ static int parse_redboot_partitions(stru
- 		goto out;
- 	}
- 
--	for (i = 0; i < numslots; i++) {
-+	first_slot = (buf[i].flash_base & (master->erasesize - 1)) /
-+		     sizeof(struct fis_image_desc);
-+
-+	for (i = first_slot; i < first_slot + numslots; i++) {
- 		struct fis_list *new_fl, **prev;
- 
- 		if (buf[i].name[0] == 0xff) {
-@@ -244,12 +264,13 @@ static int parse_redboot_partitions(stru
- 	}
- #endif
- 	for ( ; i<nrparts; i++) {
--		if(max_offset < buf[i].flash_base + buf[i].size)
--			max_offset = buf[i].flash_base + buf[i].size;
- 		parts[i].size = fl->img->size;
- 		parts[i].offset = fl->img->flash_base;
- 		parts[i].name = names;
- 
-+		if (max_offset < parts[i].offset + parts[i].size)
-+			max_offset = parts[i].offset + parts[i].size;
-+
- 		strcpy(names, fl->img->name);
- #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY
- 		if (!memcmp(names, "RedBoot", 8) ||
-@@ -279,7 +300,9 @@ static int parse_redboot_partitions(stru
- 		fl = fl->next;
- 		kfree(tmp_fl);
- 	}
--	if(master->size - max_offset >= master->erasesize)
-+
-+	if (master->size - max_offset >=
-+	    mtd_get_offset_erasesize(master, max_offset))
- 	{
- 		parts[nrparts].size = master->size - max_offset;
- 		parts[nrparts].offset = max_offset;

+ 0 - 70
target/linux/atheros/patches-2.6.33/200-ar2313_enable_mvswitch.patch

@@ -1,70 +0,0 @@
---- a/drivers/net/ar231x.c
-+++ b/drivers/net/ar231x.c
-@@ -735,6 +735,7 @@ static void ar231x_load_rx_ring(struct n
- 	for (i = 0; i < nr_bufs; i++) {
- 		struct sk_buff *skb;
- 		ar231x_descr_t *rd;
-+		int offset = RX_OFFSET;
- 
- 		if (sp->rx_skb[idx])
- 			break;
-@@ -750,7 +751,9 @@ static void ar231x_load_rx_ring(struct n
- 		 * Make sure IP header starts on a fresh cache line.
- 		 */
- 		skb->dev = dev;
--		skb_reserve(skb, RX_OFFSET);
-+		if (sp->phy_dev)
-+			offset += sp->phy_dev->pkt_align;
-+		skb_reserve(skb, offset);
- 		sp->rx_skb[idx] = skb;
- 
- 		rd = (ar231x_descr_t *) & sp->rx_ring[idx];
-@@ -824,20 +827,23 @@ static int ar231x_rx_int(struct net_devi
- 			/* alloc new buffer. */
- 			skb_new = netdev_alloc_skb(dev, AR2313_BUFSIZE + RX_OFFSET);
- 			if (skb_new != NULL) {
-+				int offset;
- 
- 				skb = sp->rx_skb[idx];
- 				/* set skb */
- 				skb_put(skb,
- 						((status >> DMA_RX_LEN_SHIFT) & 0x3fff) - CRC_LEN);
--
- 				dev->stats.rx_bytes += skb->len;
--				skb->protocol = eth_type_trans(skb, dev);
--				/* pass the packet to upper layers */
--				netif_rx(skb);
- 
-+				/* pass the packet to upper layers */
-+				sp->rx(skb);
- 				skb_new->dev = dev;
-+
- 				/* 16 bit align */
--				skb_reserve(skb_new, RX_OFFSET);
-+				offset = RX_OFFSET;
-+				if (sp->phy_dev)
-+					offset += sp->phy_dev->pkt_align;
-+				skb_reserve(skb_new, offset);
- 				/* reset descriptor's curr_addr */
- 				rxdesc->addr = virt_to_phys(skb_new->data);
- 
-@@ -1239,6 +1245,8 @@ static int ar231x_mdiobus_probe (struct
- 		return PTR_ERR(phydev);
- 	}
- 
-+	sp->rx = phydev->netif_rx;
-+
- 	/* mask with MAC supported features */
- 	phydev->supported &= (SUPPORTED_10baseT_Half
- 		| SUPPORTED_10baseT_Full
---- a/drivers/net/ar231x.h
-+++ b/drivers/net/ar231x.h
-@@ -221,6 +221,8 @@ typedef struct {
-  */
- struct ar231x_private {
- 	struct net_device *dev;
-+	int (*rx)(struct sk_buff *skb);
-+
- 	int version;
- 	u32 mb[2];
- 

+ 0 - 174
target/linux/atheros/patches-2.6.33/210-reset_button.patch

@@ -1,174 +0,0 @@
---- a/arch/mips/ar231x/Makefile
-+++ b/arch/mips/ar231x/Makefile
-@@ -8,7 +8,7 @@
- # Copyright (C) 2006-2009 Felix Fietkau <[email protected]>
- #
- 
--obj-y += board.o prom.o devices.o
-+obj-y += board.o prom.o devices.o reset.o
- 
- obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
- 
---- /dev/null
-+++ b/arch/mips/ar231x/reset.c
-@@ -0,0 +1,160 @@
-+#include <linux/init.h>
-+#include <linux/module.h>
-+#include <linux/timer.h>
-+#include <linux/interrupt.h>
-+#include <linux/kobject.h>
-+#include <linux/workqueue.h>
-+#include <linux/skbuff.h>
-+#include <linux/netlink.h>
-+#include <net/sock.h>
-+#include <asm/uaccess.h>
-+#include <ar231x_platform.h>
-+#include <ar231x.h>
-+#include <gpio.h>
-+#include "devices.h"
-+
-+#define AR531X_RESET_GPIO_IRQ	(AR531X_GPIO_IRQ(ar231x_board.config->resetConfigGpio))
-+
-+struct event_t {
-+	struct work_struct wq;
-+	int set;
-+	unsigned long jiffies;
-+};
-+
-+static struct timer_list rst_button_timer;
-+static unsigned long seen;
-+
-+extern struct sock *uevent_sock;
-+extern u64 uevent_next_seqnum(void);
-+
-+static int no_release_workaround = 1;
-+module_param(no_release_workaround, int, 0);
-+
-+static inline void
-+add_msg(struct sk_buff *skb, char *msg)
-+{
-+	char *scratch;
-+	scratch = skb_put(skb, strlen(msg) + 1);
-+	sprintf(scratch, msg);
-+}
-+
-+static void
-+hotplug_button(struct work_struct *wq)
-+{
-+	struct sk_buff *skb;
-+	struct event_t *event;
-+	size_t len;
-+	char *scratch, *s;
-+	char buf[128];
-+
-+	event = container_of(wq, struct event_t, wq);
-+	if (!uevent_sock)
-+		goto done;
-+
-+	/* allocate message with the maximum possible size */
-+	s = event->set ? "pressed" : "released";
-+	len = strlen(s) + 2;
-+	skb = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL);
-+	if (!skb)
-+		goto done;
-+
-+	/* add header */
-+	scratch = skb_put(skb, len);
-+	sprintf(scratch, "%s@",s);
-+
-+	/* copy keys to our continuous event payload buffer */
-+	add_msg(skb, "HOME=/");
-+	add_msg(skb, "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
-+	add_msg(skb, "SUBSYSTEM=button");
-+	add_msg(skb, "BUTTON=reset");
-+	add_msg(skb, (event->set ? "ACTION=pressed" : "ACTION=released"));
-+	sprintf(buf, "SEEN=%ld", (event->jiffies - seen)/HZ);
-+	add_msg(skb, buf);
-+	snprintf(buf, 128, "SEQNUM=%llu", uevent_next_seqnum());
-+	add_msg(skb, buf);
-+
-+	NETLINK_CB(skb).dst_group = 1;
-+	netlink_broadcast(uevent_sock, skb, 0, 1, GFP_KERNEL);
-+
-+done:
-+	kfree(event);
-+}
-+
-+static void
-+reset_button_poll(unsigned long unused)
-+{
-+	struct event_t *event;
-+	int gpio = ~0;
-+
-+	if(!no_release_workaround)
-+		return;
-+
-+	gpio = ar231x_gpiodev->get();
-+	gpio &= (1 << (AR531X_RESET_GPIO_IRQ - AR531X_GPIO_IRQ_BASE));
-+	if(gpio) {
-+		rst_button_timer.expires = jiffies + (HZ / 4);
-+		add_timer(&rst_button_timer);
-+		return;
-+	}
-+
-+	event = (struct event_t *) kzalloc(sizeof(struct event_t), GFP_ATOMIC);
-+	if (!event)
-+		return;
-+
-+	event->set = 0;
-+	event->jiffies = jiffies;
-+	INIT_WORK(&event->wq, hotplug_button);
-+	schedule_work(&event->wq);
-+}
-+
-+static irqreturn_t
-+button_handler(int irq, void *dev_id)
-+{
-+	static int pressed = 0;
-+	struct event_t *event;
-+	u32 gpio = ~0;
-+
-+	event = (struct event_t *) kzalloc(sizeof(struct event_t), GFP_ATOMIC);
-+	if (!event)
-+		return IRQ_NONE;
-+
-+	pressed = !pressed;
-+
-+	gpio = ar231x_gpiodev->get() & (1 << (irq - AR531X_GPIO_IRQ_BASE));
-+
-+	event->set = gpio;
-+	if(!event->set)
-+		no_release_workaround = 0;
-+
-+	event->jiffies = jiffies;
-+
-+	INIT_WORK(&event->wq, hotplug_button);
-+	schedule_work(&event->wq);
-+
-+	seen = jiffies;
-+	if(event->set && no_release_workaround)
-+		mod_timer(&rst_button_timer, jiffies + (HZ / 4));
-+
-+	return IRQ_HANDLED;
-+}
-+
-+
-+static int __init
-+ar231x_init_reset(void)
-+{
-+	seen = jiffies;
-+
-+	if (ar231x_board.config->resetConfigGpio == 0xffff)
-+		return -ENODEV;
-+
-+	init_timer(&rst_button_timer);
-+	rst_button_timer.function = reset_button_poll;
-+	rst_button_timer.expires = jiffies + HZ / 50;
-+	add_timer(&rst_button_timer);
-+
-+	request_irq(AR531X_RESET_GPIO_IRQ, &button_handler, IRQF_SAMPLE_RANDOM, "ar231x_reset", NULL);
-+
-+	return 0;
-+}
-+
-+module_init(ar231x_init_reset);

+ 0 - 69
target/linux/atheros/patches-2.6.33/220-enet_micrel_workaround.patch

@@ -1,69 +0,0 @@
---- a/drivers/net/ar231x.c
-+++ b/drivers/net/ar231x.c
-@@ -148,6 +148,7 @@ static int ar231x_mdiobus_write(struct m
- static int ar231x_mdiobus_reset(struct mii_bus *bus);
- static int ar231x_mdiobus_probe (struct net_device *dev);
- static void ar231x_adjust_link(struct net_device *dev);
-+static bool no_phy = false;
- 
- #ifndef ERR
- #define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args)
-@@ -278,6 +279,21 @@ int __init ar231x_probe(struct platform_
- 
- 	mdiobus_register(sp->mii_bus);
- 
-+	/* Workaround for Micrel switch, which is only available on
-+	 * one PHY and cannot be configured through MDIO */
-+	if (!no_phy) {
-+		u32 phy_id = 0;
-+		get_phy_id(sp->mii_bus, 1, &phy_id);
-+		if (phy_id == 0x00221450)
-+			no_phy = true;
-+	}
-+	if (no_phy) {
-+		sp->link = 1;
-+		netif_carrier_on(dev);
-+		return 0;
-+	}
-+	no_phy = true;
-+
- 	if (ar231x_mdiobus_probe(dev) != 0) {
- 		printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name);
- 		rx_tasklet_cleanup(dev);
-@@ -334,8 +350,10 @@ static int __devexit ar231x_remove(struc
- 	rx_tasklet_cleanup(dev);
- 	ar231x_init_cleanup(dev);
- 	unregister_netdev(dev);
--	mdiobus_unregister(sp->mii_bus);
--	mdiobus_free(sp->mii_bus);
-+	if (sp->mii_bus) {
-+		mdiobus_unregister(sp->mii_bus);
-+		mdiobus_free(sp->mii_bus);
-+	}
- 	kfree(dev);
- 	return 0;
- }
-@@ -836,7 +854,12 @@ static int ar231x_rx_int(struct net_devi
- 				dev->stats.rx_bytes += skb->len;
- 
- 				/* pass the packet to upper layers */
--				sp->rx(skb);
-+				if (sp->rx) {
-+					sp->rx(skb);
-+				} else {
-+					skb->protocol = eth_type_trans(skb, skb->dev);
-+					netif_rx(skb);
-+				}
- 				skb_new->dev = dev;
- 
- 				/* 16 bit align */
-@@ -1123,6 +1146,9 @@ static int ar231x_ioctl(struct net_devic
- 	struct ar231x_private *sp = netdev_priv(dev);
- 	int ret;
- 
-+	if (!sp->phy_dev)
-+		return -ENODEV;
-+
- 	switch (cmd) {
- 
- 	case SIOCETHTOOL:

+ 0 - 2909
target/linux/generic/config-2.6.33

@@ -1,2909 +0,0 @@
-# CONFIG_6PACK is not set
-# CONFIG_8139CP is not set
-# CONFIG_8139TOO is not set
-# CONFIG_9P_FS is not set
-# CONFIG_AB3100_CORE is not set
-# CONFIG_AB4500_CORE is not set
-# CONFIG_ACCESSIBILITY is not set
-# CONFIG_ACENIC is not set
-# CONFIG_ACORN_PARTITION is not set
-# CONFIG_ACPI_POWER_METER is not set
-# CONFIG_AD525X_DPOT is not set
-# CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_ADFS_FS is not set
-# CONFIG_ADM6996_PHY is not set
-# CONFIG_ADM8211 is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_AFS_FS is not set
-# CONFIG_AF_RXRPC is not set
-# CONFIG_AGP is not set
-CONFIG_AIO=y
-# CONFIG_AIRO is not set
-# CONFIG_AIRO_CS is not set
-# CONFIG_ALIM7101_WDT is not set
-# CONFIG_ALTERA_PCIE_CHDMA is not set
-# CONFIG_AMD8111_ETH is not set
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ANDROID is not set
-CONFIG_ANON_INODES=y
-# CONFIG_APPLICOM is not set
-# CONFIG_AR8216_PHY is not set
-# CONFIG_AR9170_USB is not set
-# CONFIG_ARCH_AAEC2000 is not set
-# CONFIG_ARCH_AT91 is not set
-# CONFIG_ARCH_BCMRING is not set
-# CONFIG_ARCH_CLPS711X is not set
-# CONFIG_ARCH_DAVINCI is not set
-# CONFIG_ARCH_DOVE is not set
-# CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_EP93XX is not set
-CONFIG_ARCH_FLATMEM_ENABLE=y
-# CONFIG_ARCH_FOOTBRIDGE is not set
-# CONFIG_ARCH_GEMINI is not set
-# CONFIG_ARCH_H720X is not set
-# CONFIG_ARCH_IMX is not set
-# CONFIG_ARCH_INTEGRATOR is not set
-# CONFIG_ARCH_IOP13XX is not set
-# CONFIG_ARCH_IOP32X is not set
-# CONFIG_ARCH_IOP33X is not set
-# CONFIG_ARCH_IXP2000 is not set
-# CONFIG_ARCH_IXP23XX is not set
-# CONFIG_ARCH_IXP4XX is not set
-# CONFIG_ARCH_KIRKWOOD is not set
-# CONFIG_ARCH_KS8695 is not set
-# CONFIG_ARCH_L7200 is not set
-# CONFIG_ARCH_LH7A40X is not set
-# CONFIG_ARCH_LOKI is not set
-# CONFIG_ARCH_MMP is not set
-# CONFIG_ARCH_MSM is not set
-# CONFIG_ARCH_MV78XX0 is not set
-# CONFIG_ARCH_MXC is not set
-# CONFIG_ARCH_NETX is not set
-# CONFIG_ARCH_NOMADIK is not set
-# CONFIG_ARCH_NS9XXX is not set
-# CONFIG_ARCH_OMAP is not set
-# CONFIG_ARCH_ORION5X is not set
-# CONFIG_ARCH_PNX4008 is not set
-# CONFIG_ARCH_PXA is not set
-# CONFIG_ARCH_REALVIEW is not set
-# CONFIG_ARCH_RPC is not set
-# CONFIG_ARCH_S3C2410 is not set
-# CONFIG_ARCH_S3C64XX is not set
-# CONFIG_ARCH_S5PC1XX is not set
-# CONFIG_ARCH_SA1100 is not set
-# CONFIG_ARCH_SHARK is not set
-# CONFIG_ARCH_STMP3XXX is not set
-# CONFIG_ARCH_U300 is not set
-# CONFIG_ARCH_U8500 is not set
-# CONFIG_ARCH_VERSATILE is not set
-# CONFIG_ARCH_W90X900 is not set
-# CONFIG_ARCNET is not set
-# CONFIG_ARM_UNWIND is not set
-CONFIG_ARPD=y
-# CONFIG_ARTHUR is not set
-CONFIG_ASK_IP_FIB_HASH=y
-# CONFIG_ASUS_OLED is not set
-# CONFIG_ASYNC_TX_DMA is not set
-# CONFIG_AT24 is not set
-# CONFIG_AT76C50X_USB is not set
-# CONFIG_ATA is not set
-# CONFIG_ATALK is not set
-# CONFIG_ATARI_PARTITION is not set
-# CONFIG_ATA_ACPI is not set
-# CONFIG_ATA_GENERIC is not set
-# CONFIG_ATA_NONSTANDARD is not set
-# CONFIG_ATA_OVER_ETH is not set
-# CONFIG_ATA_PIIX is not set
-CONFIG_ATA_SFF=y
-# CONFIG_ATA_VERBOSE_ERROR is not set
-# CONFIG_ATH5K is not set
-# CONFIG_ATH9K is not set
-# CONFIG_ATL1 is not set
-# CONFIG_ATL1C is not set
-# CONFIG_ATL1E is not set
-# CONFIG_ATL2 is not set
-# CONFIG_ATM is not set
-# CONFIG_ATMEL is not set
-# CONFIG_ATM_AMBASSADOR is not set
-# CONFIG_ATM_BR2684 is not set
-CONFIG_ATM_BR2684_IPFILTER=y
-# CONFIG_ATM_CLIP is not set
-CONFIG_ATM_CLIP_NO_ICMP=y
-# CONFIG_ATM_DRIVERS is not set
-# CONFIG_ATM_DUMMY is not set
-# CONFIG_ATM_ENI is not set
-# CONFIG_ATM_FIRESTREAM is not set
-# CONFIG_ATM_FORE200E is not set
-# CONFIG_ATM_FORE200E_MAYBE is not set
-# CONFIG_ATM_HE is not set
-# CONFIG_ATM_HORIZON is not set
-# CONFIG_ATM_IA is not set
-# CONFIG_ATM_IDT77252 is not set
-# CONFIG_ATM_LANAI is not set
-# CONFIG_ATM_LANE is not set
-# CONFIG_ATM_MPOA is not set
-# CONFIG_ATM_NICSTAR is not set
-# CONFIG_ATM_SOLOS is not set
-# CONFIG_ATM_TCP is not set
-# CONFIG_ATM_ZATM is not set
-# CONFIG_AUDIT is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUXDISPLAY is not set
-# CONFIG_AX25 is not set
-# CONFIG_AX25_DAMA_SLAVE is not set
-# CONFIG_AX88796 is not set
-# CONFIG_B3DFG is not set
-# CONFIG_B43 is not set
-# CONFIG_B43LEGACY is not set
-# CONFIG_B44 is not set
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-# CONFIG_BACKTRACE_SELF_TEST is not set
-CONFIG_BASE_FULL=y
-CONFIG_BASE_SMALL=0
-# CONFIG_BASLER_EXCITE is not set
-# CONFIG_BATMAN_ADV is not set
-# CONFIG_BATTERY_BQ27000_HDQ is not set
-# CONFIG_BATTERY_BQ27x00 is not set
-# CONFIG_BATTERY_DS2760 is not set
-# CONFIG_BATTERY_DS2782 is not set
-# CONFIG_BATTERY_MAX17040 is not set
-# CONFIG_BAYCOM_EPP is not set
-# CONFIG_BAYCOM_PAR is not set
-# CONFIG_BAYCOM_SER_FDX is not set
-# CONFIG_BAYCOM_SER_HDX is not set
-# CONFIG_BCM43XX is not set
-CONFIG_BCM43XX_DEBUG=y
-CONFIG_BCM43XX_DMA=y
-CONFIG_BCM43XX_DMA_AND_PIO_MODE=y
-# CONFIG_BCM43XX_DMA_MODE is not set
-CONFIG_BCM43XX_PIO=y
-# CONFIG_BCM43XX_PIO_MODE is not set
-# CONFIG_BE2ISCSI is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_BINARY_PRINTF is not set
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
-# CONFIG_BLINK is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_CPQ_DA is not set
-CONFIG_BLK_DEV=y
-# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
-# CONFIG_BLK_DEV_4DRIVES is not set
-# CONFIG_BLK_DEV_AEC62XX is not set
-# CONFIG_BLK_DEV_ALI14XX is not set
-# CONFIG_BLK_DEV_ALI15X3 is not set
-# CONFIG_BLK_DEV_AMD74XX is not set
-# CONFIG_BLK_DEV_ATIIXP is not set
-# CONFIG_BLK_DEV_BSG is not set
-# CONFIG_BLK_DEV_CMD640 is not set
-# CONFIG_BLK_DEV_CMD64X is not set
-# CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
-# CONFIG_BLK_DEV_CS5520 is not set
-# CONFIG_BLK_DEV_CS5530 is not set
-# CONFIG_BLK_DEV_CS5535 is not set
-# CONFIG_BLK_DEV_CS5536 is not set
-# CONFIG_BLK_DEV_CY82C693 is not set
-# CONFIG_BLK_DEV_DAC960 is not set
-# CONFIG_BLK_DEV_DELKIN is not set
-# CONFIG_BLK_DEV_DTC2278 is not set
-# CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_GENERIC is not set
-# CONFIG_BLK_DEV_HD is not set
-# CONFIG_BLK_DEV_HD_IDE is not set
-# CONFIG_BLK_DEV_HD_ONLY is not set
-# CONFIG_BLK_DEV_HPT34X is not set
-# CONFIG_BLK_DEV_HPT366 is not set
-# CONFIG_BLK_DEV_HT6560B is not set
-# CONFIG_BLK_DEV_IDEACPI is not set
-# CONFIG_BLK_DEV_IDECD is not set
-# CONFIG_BLK_DEV_IDECS is not set
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDEPCI is not set
-# CONFIG_BLK_DEV_IDEPNP is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_INITRD=y
-# CONFIG_BLK_DEV_INTEGRITY is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_BLK_DEV_IT8172 is not set
-# CONFIG_BLK_DEV_IT8213 is not set
-# CONFIG_BLK_DEV_IT821X is not set
-# CONFIG_BLK_DEV_JMICRON is not set
-# CONFIG_BLK_DEV_LOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_NS87415 is not set
-# CONFIG_BLK_DEV_OFFBOARD is not set
-# CONFIG_BLK_DEV_OPTI621 is not set
-# CONFIG_BLK_DEV_PDC202XX_NEW is not set
-# CONFIG_BLK_DEV_PDC202XX_OLD is not set
-# CONFIG_BLK_DEV_PIIX is not set
-# CONFIG_BLK_DEV_PLATFORM is not set
-# CONFIG_BLK_DEV_QD65XX is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_RZ1000 is not set
-# CONFIG_BLK_DEV_SC1200 is not set
-# CONFIG_BLK_DEV_SD is not set
-# CONFIG_BLK_DEV_SIIMAGE is not set
-# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_SL82C105 is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
-# CONFIG_BLK_DEV_SR is not set
-# CONFIG_BLK_DEV_SVWKS is not set
-# CONFIG_BLK_DEV_SX8 is not set
-# CONFIG_BLK_DEV_TC86C001 is not set
-# CONFIG_BLK_DEV_TRIFLEX is not set
-# CONFIG_BLK_DEV_TRM290 is not set
-# CONFIG_BLK_DEV_UB is not set
-# CONFIG_BLK_DEV_UMC8672 is not set
-# CONFIG_BLK_DEV_UMEM is not set
-# CONFIG_BLK_DEV_VIA82CXXX is not set
-# CONFIG_BLK_DEV_XIP is not set
-CONFIG_BLOCK=y
-# CONFIG_BNX2 is not set
-# CONFIG_BONDING is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
-# CONFIG_BOOT_TRACER is not set
-# CONFIG_BPQETHER is not set
-CONFIG_BRIDGE=y
-# CONFIG_BRIDGE_EBT_802_3 is not set
-# CONFIG_BRIDGE_EBT_AMONG is not set
-# CONFIG_BRIDGE_EBT_ARP is not set
-# CONFIG_BRIDGE_EBT_ARPREPLY is not set
-# CONFIG_BRIDGE_EBT_BROUTE is not set
-# CONFIG_BRIDGE_EBT_DNAT is not set
-# CONFIG_BRIDGE_EBT_IP is not set
-# CONFIG_BRIDGE_EBT_IP6 is not set
-# CONFIG_BRIDGE_EBT_LIMIT is not set
-# CONFIG_BRIDGE_EBT_LOG is not set
-# CONFIG_BRIDGE_EBT_MARK is not set
-# CONFIG_BRIDGE_EBT_MARK_T is not set
-# CONFIG_BRIDGE_EBT_NFLOG is not set
-# CONFIG_BRIDGE_EBT_PKTTYPE is not set
-# CONFIG_BRIDGE_EBT_REDIRECT is not set
-# CONFIG_BRIDGE_EBT_SNAT is not set
-# CONFIG_BRIDGE_EBT_STP is not set
-# CONFIG_BRIDGE_EBT_T_FILTER is not set
-# CONFIG_BRIDGE_EBT_T_NAT is not set
-# CONFIG_BRIDGE_EBT_ULOG is not set
-# CONFIG_BRIDGE_EBT_VLAN is not set
-# CONFIG_BRIDGE_NETFILTER is not set
-# CONFIG_BRIDGE_NF_EBTABLES is not set
-# CONFIG_BROADCOM_PHY is not set
-CONFIG_BROKEN_ON_SMP=y
-# CONFIG_BSD_DISKLABEL is not set
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-# CONFIG_BT is not set
-# CONFIG_BTRFS_FS is not set
-# CONFIG_BT_ATH3K is not set
-# CONFIG_BT_BNEP is not set
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-# CONFIG_BT_CMTP is not set
-# CONFIG_BT_HCIBCM203X is not set
-# CONFIG_BT_HCIBFUSB is not set
-# CONFIG_BT_HCIBLUECARD is not set
-# CONFIG_BT_HCIBPA10X is not set
-# CONFIG_BT_HCIBT3C is not set
-# CONFIG_BT_HCIBTSDIO is not set
-# CONFIG_BT_HCIBTUART is not set
-# CONFIG_BT_HCIBTUSB is not set
-# CONFIG_BT_HCIDTL1 is not set
-# CONFIG_BT_HCIUART is not set
-CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_H4=y
-# CONFIG_BT_HCIUART_LL is not set
-# CONFIG_BT_HCIUSB is not set
-CONFIG_BT_HCIUSB_SCO=y
-# CONFIG_BT_HCIVHCI is not set
-# CONFIG_BT_HIDP is not set
-# CONFIG_BT_L2CAP is not set
-# CONFIG_BT_MRVL is not set
-# CONFIG_BT_RFCOMM is not set
-CONFIG_BT_RFCOMM_TTY=y
-# CONFIG_BT_SCO is not set
-CONFIG_BUG=y
-# CONFIG_C2PORT is not set
-# CONFIG_CAN is not set
-# CONFIG_CAPI_AVM is not set
-# CONFIG_CAPI_EICON is not set
-# CONFIG_CAPI_TRACE is not set
-CONFIG_CARDBUS=y
-# CONFIG_CARDMAN_4000 is not set
-# CONFIG_CARDMAN_4040 is not set
-# CONFIG_CASSINI is not set
-# CONFIG_CB710_CORE is not set
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-# CONFIG_CDROM_PKTCDVD is not set
-# CONFIG_CFG80211 is not set
-# CONFIG_CGROUPS is not set
-# CONFIG_CHELSIO_T1 is not set
-# CONFIG_CHELSIO_T3 is not set
-# CONFIG_CHR_DEV_OSST is not set
-# CONFIG_CHR_DEV_SCH is not set
-# CONFIG_CHR_DEV_SG is not set
-# CONFIG_CHR_DEV_ST is not set
-# CONFIG_CICADA_PHY is not set
-# CONFIG_CIFS is not set
-# CONFIG_CIFS_DEBUG2 is not set
-# CONFIG_CIFS_EXPERIMENTAL is not set
-CONFIG_CIFS_POSIX=y
-CONFIG_CIFS_STATS=y
-# CONFIG_CIFS_STATS2 is not set
-# CONFIG_CIFS_WEAK_PW_HASH is not set
-# CONFIG_CIFS_XATTR is not set
-CONFIG_CLS_U32_MARK=y
-CONFIG_CLS_U32_PERF=y
-CONFIG_CMDLINE=""
-# CONFIG_CNIC is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_COMEDI is not set
-# CONFIG_COMPAT_BRK is not set
-CONFIG_COMPAT_NET_DEV_OPS=y
-# CONFIG_CONFIGFS_FS is not set
-# CONFIG_CONNECTOR is not set
-CONFIG_CONSTRUCTORS=y
-# CONFIG_CONTEXT_SWITCH_TRACER is not set
-# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-# CONFIG_CPU_DCACHE_DISABLE is not set
-# CONFIG_CPU_FREQ is not set
-# CONFIG_CPU_IDLE is not set
-# CONFIG_CRAMFS is not set
-CONFIG_CRASHLOG=y
-# CONFIG_CRASH_DUMP is not set
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_CRC7 is not set
-# CONFIG_CRC_CCITT is not set
-# CONFIG_CRC_ITU_T is not set
-# CONFIG_CRC_T10DIF is not set
-CONFIG_CROSSCOMPILE=y
-CONFIG_CRYPTO=y
-# CONFIG_CRYPTO_AEAD is not set
-# CONFIG_CRYPTO_AES is not set
-# CONFIG_CRYPTO_AES_586 is not set
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_ALGAPI2=y
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
-# CONFIG_CRYPTO_AUTHENC is not set
-# CONFIG_CRYPTO_BLKCIPHER is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_CAST5 is not set
-# CONFIG_CRYPTO_CAST6 is not set
-# CONFIG_CRYPTO_CBC is not set
-# CONFIG_CRYPTO_CCM is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_CRC32C_INTEL is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-# CONFIG_CRYPTO_CTR is not set
-# CONFIG_CRYPTO_CTS is not set
-# CONFIG_CRYPTO_DEFLATE is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_DEV_HIFN_795X is not set
-# CONFIG_CRYPTO_DEV_IFXMIPS is not set
-# CONFIG_CRYPTO_ECB is not set
-# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_FIPS is not set
-# CONFIG_CRYPTO_GCM is not set
-# CONFIG_CRYPTO_GF128MUL is not set
-# CONFIG_CRYPTO_GHASH is not set
-# CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL is not set
-# CONFIG_CRYPTO_HASH is not set
-# CONFIG_CRYPTO_HMAC is not set
-# CONFIG_CRYPTO_HW is not set
-# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_LRW is not set
-# CONFIG_CRYPTO_LZO is not set
-# CONFIG_CRYPTO_MANAGER is not set
-# CONFIG_CRYPTO_MANAGER2 is not set
-CONFIG_CRYPTO_MANAGER_NO_TESTS=y
-# CONFIG_CRYPTO_MD4 is not set
-# CONFIG_CRYPTO_MD5 is not set
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_NULL is not set
-# CONFIG_CRYPTO_PCBC is not set
-CONFIG_CRYPTO_PCOMP=y
-# CONFIG_CRYPTO_PRNG is not set
-# CONFIG_CRYPTO_RMD128 is not set
-# CONFIG_CRYPTO_RMD160 is not set
-# CONFIG_CRYPTO_RMD256 is not set
-# CONFIG_CRYPTO_RMD320 is not set
-# CONFIG_CRYPTO_RNG is not set
-# CONFIG_CRYPTO_SALSA20 is not set
-# CONFIG_CRYPTO_SALSA20_586 is not set
-# CONFIG_CRYPTO_SEED is not set
-# CONFIG_CRYPTO_SEQIV is not set
-# CONFIG_CRYPTO_SERPENT is not set
-# CONFIG_CRYPTO_SHA1 is not set
-# CONFIG_CRYPTO_SHA256 is not set
-# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_TEA is not set
-# CONFIG_CRYPTO_TEST is not set
-# CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_TWOFISH_586 is not set
-# CONFIG_CRYPTO_TWOFISH_COMMON is not set
-CONFIG_CRYPTO_UNLZMA=y
-# CONFIG_CRYPTO_VMAC is not set
-# CONFIG_CRYPTO_WP512 is not set
-# CONFIG_CRYPTO_XCBC is not set
-# CONFIG_CRYPTO_XTS is not set
-CONFIG_CRYPTO_ZLIB=y
-# CONFIG_CUSE is not set
-# CONFIG_DAB is not set
-# CONFIG_DAVICOM_PHY is not set
-# CONFIG_DCB is not set
-# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
-# CONFIG_DEBUG_CREDENTIALS is not set
-# CONFIG_DEBUG_DEVRES is not set
-# CONFIG_DEBUG_DRIVER is not set
-# CONFIG_DEBUG_ERRORS is not set
-# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
-CONFIG_DEBUG_FS=y
-# CONFIG_DEBUG_GPIO is not set
-# CONFIG_DEBUG_INFO is not set
-# CONFIG_DEBUG_KERNEL is not set
-# CONFIG_DEBUG_KMEMLEAK is not set
-# CONFIG_DEBUG_KOBJECT is not set
-# CONFIG_DEBUG_LIST is not set
-# CONFIG_DEBUG_LL is not set
-# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
-# CONFIG_DEBUG_LOCK_ALLOC is not set
-# CONFIG_DEBUG_MEMORY_INIT is not set
-# CONFIG_DEBUG_MUTEXES is not set
-# CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_DEBUG_OBJECTS is not set
-# CONFIG_DEBUG_PREEMPT is not set
-# CONFIG_DEBUG_RT_MUTEXES is not set
-# CONFIG_DEBUG_SG is not set
-# CONFIG_DEBUG_SHIRQ is not set
-# CONFIG_DEBUG_SLAB is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
-# CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_VM is not set
-# CONFIG_DEBUG_WRITECOUNT is not set
-# CONFIG_DECNET is not set
-CONFIG_DECOMPRESS_LZMA_NEEDED=y
-# CONFIG_DEFAULT_AS is not set
-# CONFIG_DEFAULT_BIC is not set
-# CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_CUBIC is not set
-CONFIG_DEFAULT_DEADLINE=y
-# CONFIG_DEFAULT_HTCP is not set
-CONFIG_DEFAULT_IOSCHED="deadline"
-CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
-# CONFIG_DEFAULT_NOOP is not set
-# CONFIG_DEFAULT_RENO is not set
-CONFIG_DEFAULT_SECURITY=""
-CONFIG_DEFAULT_SECURITY_DAC=y
-# CONFIG_DEFAULT_SECURITY_SELINUX is not set
-# CONFIG_DEFAULT_SECURITY_SMACK is not set
-# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
-CONFIG_DEFAULT_TCP_CONG="westwood"
-# CONFIG_DEFAULT_VEGAS is not set
-CONFIG_DEFAULT_WESTWOOD=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-# CONFIG_DETECT_HUNG_TASK is not set
-# CONFIG_DETECT_SOFTLOCKUP is not set
-# CONFIG_DEVKMEM is not set
-# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
-# CONFIG_DEVTMPFS is not set
-# CONFIG_DEVTMPFS_MOUNT is not set
-# CONFIG_DGRS is not set
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_DISPLAY_SUPPORT is not set
-# CONFIG_DL2K is not set
-# CONFIG_DLM is not set
-# CONFIG_DMADEVICES is not set
-# CONFIG_DMASCC is not set
-# CONFIG_DMATEST is not set
-# CONFIG_DMA_API_DEBUG is not set
-# CONFIG_DMA_ENGINE is not set
-# CONFIG_DM_LOG_USERSPACE is not set
-# CONFIG_DNET is not set
-# CONFIG_DNOTIFY is not set
-# CONFIG_DRAGONRISE_FF is not set
-# CONFIG_DRM is not set
-# CONFIG_DS1682 is not set
-# CONFIG_DST is not set
-# CONFIG_DTLK is not set
-# CONFIG_DUMMY is not set
-# CONFIG_DVB is not set
-# CONFIG_DVB_CORE is not set
-# CONFIG_DYNAMIC_DEBUG is not set
-# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
-# CONFIG_E100 is not set
-# CONFIG_E1000 is not set
-# CONFIG_E1000E is not set
-# CONFIG_ECHO is not set
-# CONFIG_ECONET is not set
-# CONFIG_EDAC is not set
-# CONFIG_EEPRO100 is not set
-# CONFIG_EEPROM_93CX6 is not set
-# CONFIG_EEPROM_AT24 is not set
-# CONFIG_EEPROM_AT25 is not set
-# CONFIG_EEPROM_LEGACY is not set
-# CONFIG_EEPROM_MAX6875 is not set
-# CONFIG_EFI_PARTITION is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_ELF_CORE is not set
-CONFIG_EMBEDDED=y
-# CONFIG_ENABLE_MUST_CHECK is not set
-CONFIG_ENABLE_WARN_DEPRECATED=y
-# CONFIG_ENC28J60 is not set
-# CONFIG_ENCLOSURE_SERVICES is not set
-# CONFIG_EPIC100 is not set
-CONFIG_EPOLL=y
-# CONFIG_EQUALIZER is not set
-# CONFIG_ET131X is not set
-# CONFIG_ETHOC is not set
-CONFIG_EVENTFD=y
-# CONFIG_EVENT_TRACER is not set
-CONFIG_EXPERIMENTAL=y
-# CONFIG_EXPORTFS is not set
-# CONFIG_EXT2_FS is not set
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_EXT3_FS_XATTR is not set
-# CONFIG_EXT4DEV_FS is not set
-# CONFIG_EXT4_DEBUG is not set
-# CONFIG_EXT4_FS is not set
-CONFIG_EXT4_USE_FOR_EXT23=y
-CONFIG_EXTRA_FIRMWARE=""
-CONFIG_EXTRA_TARGETS=""
-# CONFIG_EZX_PCAP is not set
-# CONFIG_FAIR_GROUP_SCHED is not set
-CONFIG_FAT_DEFAULT_CODEPAGE=437
-CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
-# CONFIG_FAT_FS is not set
-# CONFIG_FAULT_INJECTION is not set
-# CONFIG_FB is not set
-# CONFIG_FB_3DFX is not set
-# CONFIG_FB_ARC is not set
-# CONFIG_FB_ARK is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_ATY is not set
-# CONFIG_FB_ATY128 is not set
-# CONFIG_FB_BACKLIGHT is not set
-# CONFIG_FB_BOOT_VESA_SUPPORT is not set
-# CONFIG_FB_BROADSHEET is not set
-# CONFIG_FB_CARMINE is not set
-# CONFIG_FB_CFB_COPYAREA is not set
-# CONFIG_FB_CFB_FILLRECT is not set
-# CONFIG_FB_CFB_IMAGEBLIT is not set
-# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
-# CONFIG_FB_CIRRUS is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_DDC is not set
-# CONFIG_FB_EARLYSUSPEND is not set
-# CONFIG_FB_FOREIGN_ENDIAN is not set
-# CONFIG_FB_GEODE is not set
-# CONFIG_FB_GOLDFISH is not set
-# CONFIG_FB_HGA is not set
-# CONFIG_FB_IBM_GXT4500 is not set
-# CONFIG_FB_IMSTT is not set
-# CONFIG_FB_KYRO is not set
-# CONFIG_FB_LE80578 is not set
-# CONFIG_FB_MACMODES is not set
-# CONFIG_FB_MATROX is not set
-# CONFIG_FB_MB862XX is not set
-# CONFIG_FB_METRONOME is not set
-# CONFIG_FB_MODE_HELPERS is not set
-# CONFIG_FB_N411 is not set
-# CONFIG_FB_NEOMAGIC is not set
-# CONFIG_FB_NVIDIA is not set
-# CONFIG_FB_OF is not set
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_PM3 is not set
-# CONFIG_FB_PS3 is not set
-# CONFIG_FB_PXA is not set
-# CONFIG_FB_RADEON is not set
-# CONFIG_FB_RIVA is not set
-# CONFIG_FB_S1D13XXX is not set
-# CONFIG_FB_S3 is not set
-# CONFIG_FB_SAVAGE is not set
-# CONFIG_FB_SIS is not set
-# CONFIG_FB_SVGALIB is not set
-# CONFIG_FB_SYS_COPYAREA is not set
-# CONFIG_FB_SYS_FILLRECT is not set
-# CONFIG_FB_SYS_FOPS is not set
-# CONFIG_FB_SYS_IMAGEBLIT is not set
-# CONFIG_FB_TILEBLITTING is not set
-# CONFIG_FB_TRIDENT is not set
-# CONFIG_FB_UDL is not set
-# CONFIG_FB_VGA16 is not set
-# CONFIG_FB_VIA is not set
-# CONFIG_FB_VIRTUAL is not set
-# CONFIG_FB_VOODOO1 is not set
-# CONFIG_FB_VT8623 is not set
-# CONFIG_FCOE is not set
-# CONFIG_FCOE_FNIC is not set
-# CONFIG_FDDI is not set
-# CONFIG_FEALNX is not set
-CONFIG_FIB_RULES=y
-CONFIG_FILE_LOCKING=y
-# CONFIG_FIREWIRE is not set
-# CONFIG_FIRMWARE_IN_KERNEL is not set
-# CONFIG_FIXED_PHY is not set
-CONFIG_FLATMEM=y
-CONFIG_FLATMEM_MANUAL=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_FORCEDETH is not set
-# CONFIG_FRAMEBUFFER_CONSOLE is not set
-CONFIG_FRAME_WARN=1024
-# CONFIG_FREEZER is not set
-# CONFIG_FSCACHE is not set
-CONFIG_FSNOTIFY=y
-# CONFIG_FS_POSIX_ACL is not set
-# CONFIG_FTL is not set
-# CONFIG_FTRACE is not set
-# CONFIG_FTRACE_STARTUP_TEST is not set
-# CONFIG_FUNCTION_TRACER is not set
-# CONFIG_FUSE_FS is not set
-# CONFIG_FUSION is not set
-# CONFIG_FUSION_FC is not set
-# CONFIG_FUSION_SAS is not set
-# CONFIG_FUSION_SPI is not set
-CONFIG_FUTEX=y
-CONFIG_FW_LOADER=y
-CONFIG_GACT_PROB=y
-# CONFIG_GAMEPORT is not set
-# CONFIG_GCOV_KERNEL is not set
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_GENERIC_TIME=y
-# CONFIG_GFS2_FS is not set
-# CONFIG_GIGASET_CAPI is not set
-# CONFIG_GIGASET_DEBUG is not set
-# CONFIG_GPIOLIB is not set
-# CONFIG_GPIO_ADP5588 is not set
-# CONFIG_GPIO_BT8XX is not set
-# CONFIG_GPIO_CS5535 is not set
-# CONFIG_GPIO_DEVICE is not set
-# CONFIG_GPIO_LANGWELL is not set
-# CONFIG_GPIO_MAX7301 is not set
-# CONFIG_GPIO_MAX732X is not set
-# CONFIG_GPIO_MC33880 is not set
-# CONFIG_GPIO_MCP23S08 is not set
-# CONFIG_GPIO_PCA953X is not set
-# CONFIG_GPIO_PCF857X is not set
-# CONFIG_GPIO_SYSFS is not set
-# CONFIG_GPIO_XILINX is not set
-# CONFIG_GREENASIA_FF is not set
-# CONFIG_GROUP_SCHED is not set
-# CONFIG_HAMACHI is not set
-CONFIG_HAMRADIO=y
-# CONFIG_HAPPYMEAL is not set
-# CONFIG_HAVE_AOUT is not set
-CONFIG_HAVE_MLOCK=y
-CONFIG_HAVE_MLOCKED_PAGE_BIT=y
-# CONFIG_HCALL_STATS is not set
-# CONFIG_HDLC is not set
-# CONFIG_HDLC_CISCO is not set
-# CONFIG_HDLC_FR is not set
-# CONFIG_HDLC_PPP is not set
-# CONFIG_HDLC_RAW is not set
-# CONFIG_HDLC_RAW_ETH is not set
-# CONFIG_HEADERS_CHECK is not set
-# CONFIG_HECI is not set
-# CONFIG_HERMES is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HID is not set
-# CONFIG_HIDRAW is not set
-# CONFIG_HID_A4TECH is not set
-# CONFIG_HID_APPLE is not set
-# CONFIG_HID_BELKIN is not set
-# CONFIG_HID_BRIGHT is not set
-# CONFIG_HID_CHERRY is not set
-# CONFIG_HID_CHICONY is not set
-# CONFIG_HID_COMPAT is not set
-# CONFIG_HID_CYPRESS is not set
-# CONFIG_HID_DEBUG is not set
-# CONFIG_HID_DELL is not set
-# CONFIG_HID_DRAGONRISE is not set
-# CONFIG_HID_EZKEY is not set
-# CONFIG_HID_FF is not set
-# CONFIG_HID_GREENASIA is not set
-# CONFIG_HID_GYRATION is not set
-# CONFIG_HID_KENSINGTON is not set
-# CONFIG_HID_KYE is not set
-# CONFIG_HID_LOGITECH is not set
-# CONFIG_HID_MICROSOFT is not set
-# CONFIG_HID_MONTEREY is not set
-# CONFIG_HID_NTRIG is not set
-# CONFIG_HID_PANTHERLORD is not set
-# CONFIG_HID_PETALYNX is not set
-# CONFIG_HID_PID is not set
-# CONFIG_HID_SAMSUNG is not set
-# CONFIG_HID_SMARTJOYPLUS is not set
-# CONFIG_HID_SONY is not set
-# CONFIG_HID_SUNPLUS is not set
-# CONFIG_HID_SUPPORT is not set
-# CONFIG_HID_THRUSTMASTER is not set
-# CONFIG_HID_TOPSEED is not set
-# CONFIG_HID_TWINHAN is not set
-# CONFIG_HID_WACOM is not set
-# CONFIG_HID_ZEROPLUS is not set
-# CONFIG_HIGHMEM is not set
-CONFIG_HIGH_RES_TIMERS=y
-# CONFIG_HIPPI is not set
-# CONFIG_HOSTAP is not set
-# CONFIG_HOSTAP_CS is not set
-# CONFIG_HOSTAP_PCI is not set
-# CONFIG_HOSTAP_PLX is not set
-CONFIG_HOTPLUG=y
-# CONFIG_HOTPLUG_CPU is not set
-# CONFIG_HOTPLUG_PCI is not set
-# CONFIG_HP100 is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_HP_ILO is not set
-# CONFIG_HTC_EGPIO is not set
-# CONFIG_HTC_PASIC3 is not set
-# CONFIG_HUGETLB_PAGE is not set
-# CONFIG_HVC_UDBG is not set
-# CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
-# CONFIG_HW_RANDOM_AMD is not set
-# CONFIG_HW_RANDOM_GEODE is not set
-# CONFIG_HW_RANDOM_INTEL is not set
-# CONFIG_HW_RANDOM_TIMERIOMEM is not set
-# CONFIG_HW_RANDOM_VIA is not set
-# CONFIG_HYPERV is not set
-# CONFIG_HYSDN is not set
-CONFIG_HZ=100
-CONFIG_HZ_100=y
-# CONFIG_HZ_1000 is not set
-# CONFIG_HZ_1024 is not set
-# CONFIG_HZ_128 is not set
-# CONFIG_HZ_250 is not set
-# CONFIG_HZ_256 is not set
-# CONFIG_HZ_300 is not set
-# CONFIG_HZ_48 is not set
-# CONFIG_I2C is not set
-# CONFIG_I2C_ALGOBIT is not set
-# CONFIG_I2C_ALGOPCA is not set
-# CONFIG_I2C_ALGOPCF is not set
-# CONFIG_I2C_ALI1535 is not set
-# CONFIG_I2C_ALI1563 is not set
-# CONFIG_I2C_ALI15X3 is not set
-# CONFIG_I2C_AMD756 is not set
-# CONFIG_I2C_AMD8111 is not set
-# CONFIG_I2C_CHARDEV is not set
-# CONFIG_I2C_COMPAT is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_ELEKTOR is not set
-# CONFIG_I2C_GPIO is not set
-# CONFIG_I2C_HELPER_AUTO is not set
-# CONFIG_I2C_I801 is not set
-# CONFIG_I2C_I810 is not set
-# CONFIG_I2C_IBM_IIC is not set
-# CONFIG_I2C_ISCH is not set
-# CONFIG_I2C_MPC is not set
-# CONFIG_I2C_NFORCE2 is not set
-# CONFIG_I2C_OCORES is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
-# CONFIG_I2C_PCA_ISA is not set
-# CONFIG_I2C_PCA_PLATFORM is not set
-# CONFIG_I2C_PIIX4 is not set
-# CONFIG_I2C_PROSAVAGE is not set
-# CONFIG_I2C_SAVAGE4 is not set
-# CONFIG_I2C_SIMTEC is not set
-# CONFIG_I2C_SIS5595 is not set
-# CONFIG_I2C_SIS630 is not set
-# CONFIG_I2C_SIS96X is not set
-# CONFIG_I2C_STUB is not set
-# CONFIG_I2C_TAOS_EVM is not set
-# CONFIG_I2C_TINY_USB is not set
-# CONFIG_I2C_VIA is not set
-# CONFIG_I2C_VIAPRO is not set
-# CONFIG_I2C_VOODOO3 is not set
-# CONFIG_I2O is not set
-# CONFIG_I82092 is not set
-# CONFIG_I82365 is not set
-# CONFIG_IBM_ASM is not set
-# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
-# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
-# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
-# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
-# CONFIG_IBM_NEW_EMAC_RGMII is not set
-# CONFIG_IBM_NEW_EMAC_TAH is not set
-# CONFIG_IBM_NEW_EMAC_ZMII is not set
-# CONFIG_ICPLUS_PHY is not set
-# CONFIG_ICS932S401 is not set
-# CONFIG_IDE is not set
-# CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_IDEDMA_IVB is not set
-# CONFIG_IDEDMA_ONLYDISK is not set
-# CONFIG_IDEPCI_SHARE_IRQ is not set
-# CONFIG_IDE_GD is not set
-CONFIG_IDE_MAX_HWIFS=4
-# CONFIG_IDE_PHISON is not set
-CONFIG_IDE_PROC_FS=y
-# CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IEEE1394 is not set
-# CONFIG_IEEE1394_DV1394 is not set
-# CONFIG_IEEE1394_ETH1394 is not set
-# CONFIG_IEEE1394_OHCI1394 is not set
-# CONFIG_IEEE1394_PCILYNX is not set
-# CONFIG_IEEE1394_RAWIO is not set
-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
-# CONFIG_IEEE1394_VIDEO1394 is not set
-# CONFIG_IEEE80211 is not set
-# CONFIG_IEEE80211_CRYPT_CCMP is not set
-# CONFIG_IEEE80211_CRYPT_TKIP is not set
-# CONFIG_IEEE80211_CRYPT_WEP is not set
-# CONFIG_IEEE80211_DEBUG is not set
-# CONFIG_IEEE80211_SOFTMAC is not set
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-# CONFIG_IEEE802154 is not set
-# CONFIG_IFB is not set
-# CONFIG_IGB is not set
-# CONFIG_IGBVF is not set
-# CONFIG_IIO is not set
-# CONFIG_IKCONFIG is not set
-# CONFIG_IKCONFIG_PROC is not set
-# CONFIG_IMAGE_CMDLINE_HACK is not set
-# CONFIG_IMQ is not set
-# CONFIG_IMQ_BEHAVIOR_AA is not set
-# CONFIG_IMQ_BEHAVIOR_AB is not set
-# CONFIG_IMQ_BEHAVIOR_BA is not set
-# CONFIG_IMQ_BEHAVIOR_BB is not set
-CONFIG_IMQ_NUM_DEVS=2
-CONFIG_INET=y
-# CONFIG_INET6_AH is not set
-# CONFIG_INET6_ESP is not set
-# CONFIG_INET6_IPCOMP is not set
-# CONFIG_INET6_TUNNEL is not set
-# CONFIG_INET6_XFRM_MODE_BEET is not set
-# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
-# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_DIAG is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_LRO is not set
-# CONFIG_INET_TCP_DIAG is not set
-# CONFIG_INET_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INFINIBAND is not set
-# CONFIG_INFTL is not set
-# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
-# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set
-# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
-CONFIG_INITRAMFS_COMPRESSION_NONE=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-# CONFIG_INLINE_READ_LOCK is not set
-# CONFIG_INLINE_READ_LOCK_BH is not set
-# CONFIG_INLINE_READ_LOCK_IRQ is not set
-# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_READ_TRYLOCK is not set
-CONFIG_INLINE_READ_UNLOCK=y
-# CONFIG_INLINE_READ_UNLOCK_BH is not set
-CONFIG_INLINE_READ_UNLOCK_IRQ=y
-# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
-# CONFIG_INLINE_SPIN_LOCK is not set
-# CONFIG_INLINE_SPIN_LOCK_BH is not set
-# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
-# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_SPIN_TRYLOCK is not set
-# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
-CONFIG_INLINE_SPIN_UNLOCK=y
-# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
-CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
-# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
-# CONFIG_INLINE_WRITE_LOCK is not set
-# CONFIG_INLINE_WRITE_LOCK_BH is not set
-# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
-# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
-# CONFIG_INLINE_WRITE_TRYLOCK is not set
-CONFIG_INLINE_WRITE_UNLOCK=y
-# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
-CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
-# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
-# CONFIG_INOTIFY is not set
-# CONFIG_INOTIFY_USER is not set
-# CONFIG_INPUT is not set
-# CONFIG_INPUT_APANEL is not set
-# CONFIG_INPUT_ATI_REMOTE is not set
-# CONFIG_INPUT_ATI_REMOTE2 is not set
-# CONFIG_INPUT_ATLAS_BTNS is not set
-# CONFIG_INPUT_CM109 is not set
-# CONFIG_INPUT_EVBUG is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_FF_MEMLESS is not set
-# CONFIG_INPUT_GPIO is not set
-# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_KEYSPAN_REMOTE is not set
-# CONFIG_INPUT_MIMIO is not set
-CONFIG_INPUT_MISC=y
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_PCSPKR is not set
-# CONFIG_INPUT_POLLDEV is not set
-# CONFIG_INPUT_POWERMATE is not set
-# CONFIG_INPUT_SPARSEKMAP is not set
-# CONFIG_INPUT_TABLET is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_UINPUT is not set
-# CONFIG_INPUT_WINBOND_CIR is not set
-# CONFIG_INPUT_WISTRON_BTNS is not set
-# CONFIG_INSTRUMENTATION is not set
-# CONFIG_IOSCHED_AS is not set
-# CONFIG_IOSCHED_CFQ is not set
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_NOOP=y
-# CONFIG_IP1000 is not set
-# CONFIG_IP17XX_PHY is not set
-# CONFIG_IP6_NF_FILTER is not set
-# CONFIG_IP6_NF_IPTABLES is not set
-# CONFIG_IP6_NF_MANGLE is not set
-# CONFIG_IP6_NF_MATCH_AH is not set
-# CONFIG_IP6_NF_MATCH_EUI64 is not set
-# CONFIG_IP6_NF_MATCH_FRAG is not set
-# CONFIG_IP6_NF_MATCH_HL is not set
-# CONFIG_IP6_NF_MATCH_IPV6HEADER is not set
-# CONFIG_IP6_NF_MATCH_LIMIT is not set
-# CONFIG_IP6_NF_MATCH_MH is not set
-# CONFIG_IP6_NF_MATCH_OPTS is not set
-# CONFIG_IP6_NF_MATCH_OWNER is not set
-# CONFIG_IP6_NF_MATCH_RT is not set
-# CONFIG_IP6_NF_QUEUE is not set
-# CONFIG_IP6_NF_RAW is not set
-# CONFIG_IP6_NF_TARGET_HL is not set
-# CONFIG_IP6_NF_TARGET_IMQ is not set
-# CONFIG_IP6_NF_TARGET_LOG is not set
-# CONFIG_IP6_NF_TARGET_REJECT is not set
-# CONFIG_IP6_NF_TARGET_ROUTE is not set
-# CONFIG_IPC_NS is not set
-# CONFIG_IPMI_HANDLER is not set
-CONFIG_IPSEC_NAT_TRAVERSAL=y
-# CONFIG_IPV6 is not set
-# CONFIG_IPV6_MIP6 is not set
-# CONFIG_IPV6_MROUTE is not set
-# CONFIG_IPV6_MULTIPLE_TABLES is not set
-CONFIG_IPV6_NDISC_NODETYPE=y
-# CONFIG_IPV6_OPTIMISTIC_DAD is not set
-# CONFIG_IPV6_PRIVACY is not set
-# CONFIG_IPV6_ROUTER_PREF is not set
-# CONFIG_IPV6_ROUTE_INFO is not set
-# CONFIG_IPV6_SIT is not set
-# CONFIG_IPV6_SIT_6RD is not set
-# CONFIG_IPV6_TUNNEL is not set
-# CONFIG_IPW2100 is not set
-# CONFIG_IPW2100_DEBUG is not set
-CONFIG_IPW2100_MONITOR=y
-# CONFIG_IPW2200 is not set
-# CONFIG_IPW2200_DEBUG is not set
-CONFIG_IPW2200_MONITOR=y
-# CONFIG_IPW2200_PROMISCUOUS is not set
-# CONFIG_IPW2200_QOS is not set
-# CONFIG_IPW2200_RADIOTAP is not set
-# CONFIG_IPWIRELESS is not set
-# CONFIG_IPX is not set
-CONFIG_IP_ADVANCED_ROUTER=y
-# CONFIG_IP_DCCP is not set
-CONFIG_IP_FIB_HASH=y
-# CONFIG_IP_FIB_TRIE is not set
-CONFIG_IP_MROUTE=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_MULTIPLE_TABLES=y
-# CONFIG_IP_NF_AMANDA is not set
-# CONFIG_IP_NF_ARPFILTER is not set
-# CONFIG_IP_NF_ARPTABLES is not set
-# CONFIG_IP_NF_ARP_MANGLE is not set
-# CONFIG_IP_NF_CONNTRACK is not set
-# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
-# CONFIG_IP_NF_CONNTRACK_MARK  is not set
-# CONFIG_IP_NF_CT_ACCT is not set
-# CONFIG_IP_NF_CT_PROTO_SCTP is not set
-# CONFIG_IP_NF_FILTER is not set
-# CONFIG_IP_NF_FTP is not set
-# CONFIG_IP_NF_H323 is not set
-# CONFIG_IP_NF_IPTABLES is not set
-# CONFIG_IP_NF_IRC is not set
-# CONFIG_IP_NF_MANGLE is not set
-# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
-# CONFIG_IP_NF_MATCH_AH is not set
-# CONFIG_IP_NF_MATCH_ECN is not set
-# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
-# CONFIG_IP_NF_MATCH_IPP2P is not set
-# CONFIG_IP_NF_MATCH_OWNER is not set
-# CONFIG_IP_NF_MATCH_RECENT is not set
-# CONFIG_IP_NF_MATCH_SET is not set
-# CONFIG_IP_NF_MATCH_TIME is not set
-# CONFIG_IP_NF_MATCH_TOS is not set
-# CONFIG_IP_NF_MATCH_TTL is not set
-# CONFIG_IP_NF_NAT is not set
-# CONFIG_IP_NF_NAT_AMANDA is not set
-# CONFIG_IP_NF_NAT_FTP is not set
-# CONFIG_IP_NF_NAT_H323 is not set
-# CONFIG_IP_NF_NAT_IRC is not set
-# CONFIG_IP_NF_NAT_NEEDED is not set
-# CONFIG_IP_NF_NAT_PPTP is not set
-# CONFIG_IP_NF_NAT_SIP is not set
-# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
-# CONFIG_IP_NF_NAT_TFTP is not set
-# CONFIG_IP_NF_NETBIOS_NS is not set
-# CONFIG_IP_NF_PPTP is not set
-# CONFIG_IP_NF_QUEUE is not set
-# CONFIG_IP_NF_RAW is not set
-# CONFIG_IP_NF_SECURITY is not set
-# CONFIG_IP_NF_SET is not set
-# CONFIG_IP_NF_SET_HASHSIZE is not set
-# CONFIG_IP_NF_SET_IPHASH is not set
-# CONFIG_IP_NF_SET_IPMAP is not set
-# CONFIG_IP_NF_SET_IPPORTHASH is not set
-# CONFIG_IP_NF_SET_IPTREE is not set
-# CONFIG_IP_NF_SET_IPTREEMAP is not set
-# CONFIG_IP_NF_SET_MACIPMAP is not set
-# CONFIG_IP_NF_SET_MAX is not set
-# CONFIG_IP_NF_SET_NETHASH is not set
-# CONFIG_IP_NF_SET_PORTMAP is not set
-# CONFIG_IP_NF_SIP is not set
-# CONFIG_IP_NF_TARGET_CLUSTERIP is not set
-# CONFIG_IP_NF_TARGET_ECN is not set
-# CONFIG_IP_NF_TARGET_IMQ is not set
-# CONFIG_IP_NF_TARGET_LOG is not set
-# CONFIG_IP_NF_TARGET_MASQUERADE is not set
-# CONFIG_IP_NF_TARGET_NETMAP is not set
-# CONFIG_IP_NF_TARGET_REDIRECT is not set
-# CONFIG_IP_NF_TARGET_REJECT is not set
-# CONFIG_IP_NF_TARGET_ROUTE is not set
-# CONFIG_IP_NF_TARGET_SAME is not set
-# CONFIG_IP_NF_TARGET_SET is not set
-# CONFIG_IP_NF_TARGET_TOS is not set
-# CONFIG_IP_NF_TARGET_TTL is not set
-# CONFIG_IP_NF_TARGET_ULOG is not set
-# CONFIG_IP_NF_TFTP is not set
-# CONFIG_IP_PIMSM_V1 is not set
-# CONFIG_IP_PIMSM_V2 is not set
-# CONFIG_IP_PNP is not set
-CONFIG_IP_ROUTE_FWMARK=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_MULTIPATH_CACHED=y
-# CONFIG_IP_ROUTE_MULTIPATH_DRR is not set
-# CONFIG_IP_ROUTE_MULTIPATH_RANDOM is not set
-# CONFIG_IP_ROUTE_MULTIPATH_RR is not set
-# CONFIG_IP_ROUTE_MULTIPATH_WRANDOM is not set
-CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_SCTP is not set
-# CONFIG_IP_VS is not set
-# CONFIG_IRDA is not set
-# CONFIG_IRQSOFF_TRACER is not set
-# CONFIG_ISCSI_TCP is not set
-CONFIG_ISDN=y
-# CONFIG_ISDN_AUDIO is not set
-# CONFIG_ISDN_CAPI is not set
-# CONFIG_ISDN_CAPI_CAPIDRV is not set
-# CONFIG_ISDN_DIVERSION is not set
-# CONFIG_ISDN_DRV_ACT2000 is not set
-# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set
-# CONFIG_ISDN_DRV_EICON is not set
-# CONFIG_ISDN_DRV_GIGASET is not set
-# CONFIG_ISDN_DRV_HISAX is not set
-# CONFIG_ISDN_DRV_ICN is not set
-# CONFIG_ISDN_DRV_LOOP is not set
-# CONFIG_ISDN_DRV_PCBIT is not set
-# CONFIG_ISDN_DRV_SC is not set
-# CONFIG_ISDN_DRV_TPAM is not set
-# CONFIG_ISDN_I4L is not set
-# CONFIG_ISDN_WITH_ABC is not set
-# CONFIG_ISL29003 is not set
-# CONFIG_ISO9660_FS is not set
-# CONFIG_IWL3945 is not set
-# CONFIG_IWLAGN is not set
-# CONFIG_IWLCORE is not set
-# CONFIG_IWLWIFI is not set
-# CONFIG_IWLWIFI_LEDS is not set
-# CONFIG_IWMC3200TOP is not set
-# CONFIG_IXGB is not set
-# CONFIG_JBD is not set
-# CONFIG_JBD2_DEBUG is not set
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
-# CONFIG_JFFS2_CMODE_NONE is not set
-CONFIG_JFFS2_CMODE_PRIORITY=y
-# CONFIG_JFFS2_CMODE_SIZE is not set
-CONFIG_JFFS2_COMPRESSION_OPTIONS=y
-CONFIG_JFFS2_FS=y
-CONFIG_JFFS2_FS_DEBUG=0
-# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
-CONFIG_JFFS2_FS_WRITEBUFFER=y
-# CONFIG_JFFS2_FS_XATTR is not set
-CONFIG_JFFS2_LZMA=y
-# CONFIG_JFFS2_LZO is not set
-CONFIG_JFFS2_RTIME=y
-# CONFIG_JFFS2_RUBIN is not set
-CONFIG_JFFS2_SUMMARY=y
-# CONFIG_JFFS2_ZLIB is not set
-# CONFIG_JFFS_FS is not set
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_JFS_POSIX_ACL is not set
-# CONFIG_JFS_SECURITY is not set
-# CONFIG_JFS_STATISTICS is not set
-# CONFIG_JME is not set
-CONFIG_JOLIET=y
-# CONFIG_KALLSYMS is not set
-# CONFIG_KALLSYMS_ALL is not set
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-# CONFIG_KARMA_PARTITION is not set
-# CONFIG_KERNEL_BZIP2 is not set
-# CONFIG_KERNEL_GZIP is not set
-CONFIG_KERNEL_LZMA=y
-# CONFIG_KERNEL_LZO is not set
-# CONFIG_KEXEC is not set
-# CONFIG_KEYBOARD_ADP5588 is not set
-# CONFIG_KEYBOARD_LM8323 is not set
-# CONFIG_KEYBOARD_MAX7359 is not set
-# CONFIG_KEYBOARD_OPENCORES is not set
-# CONFIG_KEYS is not set
-# CONFIG_KGDB is not set
-# CONFIG_KMEMTRACE is not set
-CONFIG_KMOD=y
-# CONFIG_KPROBES is not set
-# CONFIG_KS8842 is not set
-# CONFIG_KS8851 is not set
-# CONFIG_KS8851_MLL is not set
-# CONFIG_KSM is not set
-# CONFIG_LANMEDIA is not set
-# CONFIG_LAPB is not set
-# CONFIG_LASAT is not set
-# CONFIG_LATENCYTOP is not set
-CONFIG_LBDAF=y
-# CONFIG_LDM_PARTITION is not set
-# CONFIG_LEDS_ALIX is not set
-# CONFIG_LEDS_BD2802 is not set
-CONFIG_LEDS_CLASS=y
-# CONFIG_LEDS_DAC124S085 is not set
-CONFIG_LEDS_GPIO_PLATFORM=y
-# CONFIG_LEDS_LP3944 is not set
-# CONFIG_LEDS_LP5521 is not set
-# CONFIG_LEDS_LT3593 is not set
-# CONFIG_LEDS_PCA9532 is not set
-# CONFIG_LEDS_PCA955X is not set
-CONFIG_LEDS_TRIGGERS=y
-# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
-CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
-# CONFIG_LEDS_TRIGGER_GPIO is not set
-CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
-# CONFIG_LEDS_TRIGGER_MORSE is not set
-CONFIG_LEDS_TRIGGER_NETDEV=y
-CONFIG_LEDS_TRIGGER_TIMER=y
-# CONFIG_LEGACY_PTYS is not set
-# CONFIG_LIB80211 is not set
-# CONFIG_LIB80211_CRYPT_CCMP is not set
-# CONFIG_LIB80211_CRYPT_TKIP is not set
-# CONFIG_LIB80211_CRYPT_WEP is not set
-# CONFIG_LIB80211_DEBUG is not set
-# CONFIG_LIBCRC32C is not set
-# CONFIG_LIBERTAS is not set
-# CONFIG_LIBERTAS_THINFIRM is not set
-# CONFIG_LIBERTAS_USB is not set
-# CONFIG_LIBFC is not set
-# CONFIG_LIBFCOE is not set
-# CONFIG_LIBIPW_DEBUG is not set
-# CONFIG_LINE6_USB is not set
-CONFIG_LLC=y
-# CONFIG_LLC2 is not set
-CONFIG_LOCALVERSION=""
-# CONFIG_LOCALVERSION_AUTO is not set
-# CONFIG_LOCKD is not set
-CONFIG_LOCKDEP_SUPPORT=y
-CONFIG_LOCKD_V4=y
-# CONFIG_LOCK_STAT is not set
-# CONFIG_LOGIRUMBLEPAD2_FF is not set
-# CONFIG_LOGITECH_FF is not set
-# CONFIG_LOGO is not set
-CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_LSF is not set
-# CONFIG_LSI_ET1011C_PHY is not set
-# CONFIG_LTPC is not set
-# CONFIG_LXT_PHY is not set
-CONFIG_LZMA_COMPRESS=y
-CONFIG_LZMA_DECOMPRESS=y
-# CONFIG_MAC80211 is not set
-CONFIG_MAC80211_DEFAULT_PS=y
-CONFIG_MAC80211_DEFAULT_PS_VALUE=1
-# CONFIG_MACINTOSH_DRIVERS is not set
-# CONFIG_MACVLAN is not set
-# CONFIG_MAC_EMUMOUSEBTN is not set
-# CONFIG_MAC_PARTITION is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_MARKEINS is not set
-# CONFIG_MARKERS is not set
-# CONFIG_MARVELL_PHY is not set
-# CONFIG_MD is not set
-# CONFIG_MDIO_BITBANG is not set
-# CONFIG_ME4000 is not set
-# CONFIG_MEDIA_ATTACH is not set
-# CONFIG_MEDIA_SUPPORT is not set
-# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
-# CONFIG_MEGARAID_LEGACY is not set
-# CONFIG_MEGARAID_NEWGEN is not set
-# CONFIG_MEGARAID_SAS is not set
-# CONFIG_MEILHAUS is not set
-# CONFIG_MEMORY_FAILURE is not set
-# CONFIG_MEMSTICK is not set
-# CONFIG_MFD_88PM8607 is not set
-# CONFIG_MFD_ASIC3 is not set
-# CONFIG_MFD_CORE is not set
-# CONFIG_MFD_MC13783 is not set
-# CONFIG_MFD_PCF50633 is not set
-# CONFIG_MFD_SM501 is not set
-# CONFIG_MFD_TC6387XB is not set
-# CONFIG_MFD_TC6393XB is not set
-# CONFIG_MFD_TMIO is not set
-# CONFIG_MFD_WM831X is not set
-# CONFIG_MFD_WM8350_I2C is not set
-# CONFIG_MFD_WM8400 is not set
-# CONFIG_MG_DISK is not set
-# CONFIG_MIGRATION is not set
-CONFIG_MII=y
-# CONFIG_MINIX_FS is not set
-# CONFIG_MINIX_SUBPARTITION is not set
-CONFIG_MINI_FO=y
-# CONFIG_MIPS_FPU_EMU is not set
-CONFIG_MISC_DEVICES=y
-CONFIG_MISC_FILESYSTEMS=y
-# CONFIG_MISDN is not set
-# CONFIG_MISDN_AVMFRITZ is not set
-# CONFIG_MISDN_HFCPCI is not set
-# CONFIG_MISDN_HFCUSB is not set
-# CONFIG_MISDN_INFINEON is not set
-# CONFIG_MISDN_NETJET is not set
-# CONFIG_MISDN_SPEEDFAX is not set
-# CONFIG_MISDN_W6692 is not set
-# CONFIG_MKISS is not set
-# CONFIG_MMC is not set
-# CONFIG_MMC_ARMMMCI is not set
-# CONFIG_MMC_BLOCK is not set
-CONFIG_MMC_BLOCK_BOUNCE=y
-# CONFIG_MMC_CB710 is not set
-# CONFIG_MMC_DEBUG is not set
-# CONFIG_MMC_MVSDIO is not set
-# CONFIG_MMC_S3C is not set
-# CONFIG_MMC_SDHCI is not set
-# CONFIG_MMC_SDRICOH_CS is not set
-# CONFIG_MMC_SPI is not set
-# CONFIG_MMC_TEST is not set
-# CONFIG_MMC_UNSAFE_RESUME is not set
-# CONFIG_MMC_VIA_SDMMC is not set
-CONFIG_MMU=y
-CONFIG_MODULES=y
-# CONFIG_MODULE_FORCE_LOAD is not set
-# CONFIG_MODULE_FORCE_UNLOAD is not set
-# CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_MODVERSIONS is not set
-# CONFIG_MOUSE_APPLETOUCH is not set
-# CONFIG_MOUSE_INPORT is not set
-# CONFIG_MOUSE_LOGIBM is not set
-# CONFIG_MOUSE_PC110PAD is not set
-# CONFIG_MOUSE_PS2_SENTELIC is not set
-# CONFIG_MOUSE_SYNAPTICS_I2C is not set
-# CONFIG_MSDOS_FS is not set
-CONFIG_MSDOS_PARTITION=y
-CONFIG_MTD=y
-# CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_AFS_PARTS is not set
-# CONFIG_MTD_ALAUDA is not set
-# CONFIG_MTD_AR7_PARTS is not set
-# CONFIG_MTD_ARM_INTEGRATOR is not set
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_MTD_BLOCK2MTD is not set
-CONFIG_MTD_CFI=y
-# CONFIG_MTD_CFI_ADV_OPTIONS is not set
-CONFIG_MTD_CFI_AMDSTD=y
-# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
-CONFIG_MTD_CFI_I1=y
-CONFIG_MTD_CFI_I2=y
-# CONFIG_MTD_CFI_I4 is not set
-# CONFIG_MTD_CFI_I8 is not set
-CONFIG_MTD_CFI_INTELEXT=y
-# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
-CONFIG_MTD_CFI_NOSWAP=y
-# CONFIG_MTD_CFI_STAA is not set
-CONFIG_MTD_CFI_UTIL=y
-CONFIG_MTD_CHAR=y
-# CONFIG_MTD_CMDLINE_PARTS is not set
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_CONCAT is not set
-# CONFIG_MTD_DATAFLASH is not set
-# CONFIG_MTD_DEBUG is not set
-# CONFIG_MTD_DOC2000 is not set
-# CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOC2001PLUS is not set
-CONFIG_MTD_GEN_PROBE=y
-# CONFIG_MTD_GPIO_ADDR is not set
-# CONFIG_MTD_INTEL_VR_NOR is not set
-# CONFIG_MTD_JEDECPROBE is not set
-# CONFIG_MTD_LPDDR is not set
-# CONFIG_MTD_M25P80 is not set
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
-CONFIG_MTD_MAP_BANK_WIDTH_2=y
-# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
-# CONFIG_MTD_MTDRAM is not set
-# CONFIG_MTD_MYLOADER_PARTS is not set
-# CONFIG_MTD_NAND is not set
-# CONFIG_MTD_NAND_CAFE is not set
-# CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_ECC_SMC is not set
-# CONFIG_MTD_NAND_GPIO is not set
-CONFIG_MTD_NAND_IDS=y
-# CONFIG_MTD_NAND_MUSEUM_IDS is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
-# CONFIG_MTD_NAND_PLATFORM is not set
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-# CONFIG_MTD_ONENAND is not set
-# CONFIG_MTD_OOPS is not set
-# CONFIG_MTD_OTP is not set
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_PCI is not set
-# CONFIG_MTD_PHRAM is not set
-# CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_PHYSMAP_COMPAT is not set
-# CONFIG_MTD_PLATRAM is not set
-# CONFIG_MTD_PMC551 is not set
-# CONFIG_MTD_RAM is not set
-CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
-# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
-# CONFIG_MTD_ROM is not set
-CONFIG_MTD_ROOTFS_ROOT_DEV=y
-CONFIG_MTD_ROOTFS_SPLIT=y
-# CONFIG_MTD_SLRAM is not set
-# CONFIG_MTD_SST25L is not set
-# CONFIG_MTD_TESTS is not set
-# CONFIG_MTD_UBI is not set
-# CONFIG_MUTEX_SPIN_ON_OWNER is not set
-# CONFIG_MV643XX_ETH is not set
-# CONFIG_MVSWITCH_PHY is not set
-# CONFIG_MWAVE is not set
-# CONFIG_MWL8K is not set
-# CONFIG_MYRI10GE is not set
-# CONFIG_NAMESPACES is not set
-# CONFIG_NATIONAL_PHY is not set
-# CONFIG_NATSEMI is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_NE2K_PCI is not set
-# CONFIG_NEC_MARKEINS is not set
-CONFIG_NET=y
-# CONFIG_NETCONSOLE is not set
-# CONFIG_NETDEBUG is not set
-CONFIG_NETDEVICES=y
-CONFIG_NETDEVICES_MULTIQUEUE=y
-CONFIG_NETDEV_1000=y
-# CONFIG_NETDEV_10000 is not set
-# CONFIG_NETFILTER is not set
-# CONFIG_NETFILTER_ADVANCED is not set
-# CONFIG_NETFILTER_DEBUG is not set
-# CONFIG_NETFILTER_NETLINK is not set
-# CONFIG_NETFILTER_NETLINK_LOG is not set
-# CONFIG_NETFILTER_NETLINK_QUEUE is not set
-# CONFIG_NETFILTER_TPROXY is not set
-# CONFIG_NETFILTER_XTABLES is not set
-# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
-# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
-# CONFIG_NETFILTER_XT_MATCH_CONNBYTES is not set
-# CONFIG_NETFILTER_XT_MATCH_CONNLIMIT is not set
-# CONFIG_NETFILTER_XT_MATCH_CONNMARK is not set
-# CONFIG_NETFILTER_XT_MATCH_CONNTRACK is not set
-# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
-# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
-# CONFIG_NETFILTER_XT_MATCH_ESP is not set
-# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
-# CONFIG_NETFILTER_XT_MATCH_HELPER is not set
-# CONFIG_NETFILTER_XT_MATCH_HL is not set
-# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
-# CONFIG_NETFILTER_XT_MATCH_LAYER7 is not set
-# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set
-# CONFIG_NETFILTER_XT_MATCH_LENGTH is not set
-# CONFIG_NETFILTER_XT_MATCH_LIMIT is not set
-# CONFIG_NETFILTER_XT_MATCH_MAC is not set
-# CONFIG_NETFILTER_XT_MATCH_MARK is not set
-# CONFIG_NETFILTER_XT_MATCH_MULTIPORT is not set
-# CONFIG_NETFILTER_XT_MATCH_OSF is not set
-# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
-# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
-# CONFIG_NETFILTER_XT_MATCH_PKTTYPE is not set
-# CONFIG_NETFILTER_XT_MATCH_POLICY is not set
-# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
-# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
-# CONFIG_NETFILTER_XT_MATCH_REALM is not set
-# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
-# CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT is not set
-# CONFIG_NETFILTER_XT_MATCH_SCTP is not set
-# CONFIG_NETFILTER_XT_MATCH_SOCKET is not set
-# CONFIG_NETFILTER_XT_MATCH_STATE is not set
-# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
-# CONFIG_NETFILTER_XT_MATCH_STRING is not set
-# CONFIG_NETFILTER_XT_MATCH_TCPMSS is not set
-# CONFIG_NETFILTER_XT_MATCH_TIME is not set
-# CONFIG_NETFILTER_XT_MATCH_U32 is not set
-# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
-# CONFIG_NETFILTER_XT_TARGET_CONNMARK is not set
-# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
-# CONFIG_NETFILTER_XT_TARGET_HL is not set
-# CONFIG_NETFILTER_XT_TARGET_IMQ is not set
-# CONFIG_NETFILTER_XT_TARGET_LED is not set
-# CONFIG_NETFILTER_XT_TARGET_MARK is not set
-# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
-# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
-# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
-# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
-# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
-# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
-# CONFIG_NETFILTER_XT_TARGET_TPROXY is not set
-# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NETROM is not set
-CONFIG_NETWORK_FILESYSTEMS=y
-# CONFIG_NETWORK_SECMARK is not set
-# CONFIG_NETXEN_NIC is not set
-# CONFIG_NET_9P is not set
-# CONFIG_NET_ACT_GACT is not set
-# CONFIG_NET_ACT_IPT is not set
-# CONFIG_NET_ACT_MIRRED is not set
-# CONFIG_NET_ACT_NAT is not set
-# CONFIG_NET_ACT_PEDIT is not set
-# CONFIG_NET_ACT_POLICE is not set
-# CONFIG_NET_ACT_SIMP is not set
-CONFIG_NET_ACT_SKBEDIT=y
-CONFIG_NET_CLS=y
-CONFIG_NET_CLS_ACT=y
-CONFIG_NET_CLS_BASIC=y
-# CONFIG_NET_CLS_FLOW is not set
-# CONFIG_NET_CLS_FW is not set
-CONFIG_NET_CLS_IND=y
-# CONFIG_NET_CLS_ROUTE4 is not set
-# CONFIG_NET_CLS_RSVP is not set
-# CONFIG_NET_CLS_RSVP6 is not set
-# CONFIG_NET_CLS_TCINDEX is not set
-# CONFIG_NET_CLS_U32 is not set
-# CONFIG_NET_DROP_MONITOR is not set
-# CONFIG_NET_DSA is not set
-# CONFIG_NET_EMATCH is not set
-# CONFIG_NET_EMATCH_CMP is not set
-# CONFIG_NET_EMATCH_META is not set
-# CONFIG_NET_EMATCH_NBYTE is not set
-CONFIG_NET_EMATCH_STACK=32
-# CONFIG_NET_EMATCH_TEXT is not set
-# CONFIG_NET_EMATCH_U32 is not set
-CONFIG_NET_ESTIMATOR=y
-CONFIG_NET_ETHERNET=y
-# CONFIG_NET_FC is not set
-# CONFIG_NET_IPGRE is not set
-CONFIG_NET_IPGRE_BROADCAST=y
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_ISA is not set
-# CONFIG_NET_KEY is not set
-# CONFIG_NET_KEY_MIGRATE is not set
-CONFIG_NET_PCI=y
-# CONFIG_NET_PCMCIA is not set
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-CONFIG_NET_RADIO=y
-# CONFIG_NET_SB1000 is not set
-CONFIG_NET_SCHED=y
-# CONFIG_NET_SCH_ATM is not set
-# CONFIG_NET_SCH_CBQ is not set
-# CONFIG_NET_SCH_CLK_CPU is not set
-# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
-CONFIG_NET_SCH_CLK_JIFFIES=y
-# CONFIG_NET_SCH_DRR is not set
-# CONFIG_NET_SCH_DSMARK is not set
-# CONFIG_NET_SCH_ESFQ is not set
-CONFIG_NET_SCH_ESFQ_NFCT=y
-CONFIG_NET_SCH_FIFO=y
-# CONFIG_NET_SCH_GRED is not set
-# CONFIG_NET_SCH_HFSC is not set
-# CONFIG_NET_SCH_HTB is not set
-# CONFIG_NET_SCH_INGRESS is not set
-# CONFIG_NET_SCH_MULTIQ is not set
-# CONFIG_NET_SCH_NETEM is not set
-# CONFIG_NET_SCH_PRIO is not set
-# CONFIG_NET_SCH_RED is not set
-# CONFIG_NET_SCH_RR is not set
-# CONFIG_NET_SCH_SFQ is not set
-# CONFIG_NET_SCH_TBF is not set
-# CONFIG_NET_SCH_TEQL is not set
-# CONFIG_NET_TULIP is not set
-# CONFIG_NET_VENDOR_3COM is not set
-CONFIG_NET_WIRELESS=y
-CONFIG_NET_WIRELESS_RTNETLINK=y
-# CONFIG_NEW_GPIO is not set
-CONFIG_NEW_LEDS=y
-# CONFIG_NFSD is not set
-CONFIG_NFSD_TCP=y
-# CONFIG_NFSD_V2_ACL is not set
-CONFIG_NFSD_V3=y
-# CONFIG_NFSD_V3_ACL is not set
-# CONFIG_NFSD_V4 is not set
-# CONFIG_NFS_ACL_SUPPORT is not set
-CONFIG_NFS_COMMON=y
-# CONFIG_NFS_DIRECTIO is not set
-# CONFIG_NFS_FS is not set
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V3_ACL is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_V4_1 is not set
-# CONFIG_NFTL is not set
-# CONFIG_NF_CONNTRACK is not set
-# CONFIG_NF_CONNTRACK_AMANDA is not set
-# CONFIG_NF_CONNTRACK_ENABLED is not set
-# CONFIG_NF_CONNTRACK_EVENTS is not set
-# CONFIG_NF_CONNTRACK_FTP is not set
-# CONFIG_NF_CONNTRACK_H323 is not set
-# CONFIG_NF_CONNTRACK_IPV4 is not set
-# CONFIG_NF_CONNTRACK_IPV6 is not set
-# CONFIG_NF_CONNTRACK_IRC is not set
-# CONFIG_NF_CONNTRACK_MARK is not set
-# CONFIG_NF_CONNTRACK_NETBIOS_NS is not set
-# CONFIG_NF_CONNTRACK_PPTP is not set
-# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
-# CONFIG_NF_CONNTRACK_RTSP is not set
-# CONFIG_NF_CONNTRACK_SANE is not set
-# CONFIG_NF_CONNTRACK_SIP is not set
-# CONFIG_NF_CONNTRACK_SUPPORT is not set
-# CONFIG_NF_CONNTRACK_TFTP is not set
-# CONFIG_NF_CT_ACCT is not set
-# CONFIG_NF_CT_NETLINK is not set
-# CONFIG_NF_CT_PROTO_DCCP is not set
-# CONFIG_NF_CT_PROTO_GRE is not set
-# CONFIG_NF_CT_PROTO_SCTP is not set
-# CONFIG_NF_CT_PROTO_UDPLITE is not set
-# CONFIG_NF_DEFRAG_IPV4 is not set
-# CONFIG_NF_NAT is not set
-# CONFIG_NF_NAT_AMANDA is not set
-# CONFIG_NF_NAT_FTP is not set
-# CONFIG_NF_NAT_H323 is not set
-# CONFIG_NF_NAT_IRC is not set
-# CONFIG_NF_NAT_NEEDED is not set
-# CONFIG_NF_NAT_PPTP is not set
-# CONFIG_NF_NAT_PROTO_GRE is not set
-# CONFIG_NF_NAT_RTSP is not set
-# CONFIG_NF_NAT_SIP is not set
-# CONFIG_NF_NAT_SNMP_BASIC is not set
-# CONFIG_NF_NAT_TFTP is not set
-# CONFIG_NILFS2_FS is not set
-CONFIG_NL80211=y
-CONFIG_NLATTR=y
-# CONFIG_NLS is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_CODEPAGE_437 is not set
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-# CONFIG_NLS_CODEPAGE_850 is not set
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_ISO8859_1 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-# CONFIG_NOP_USB_XCEIV is not set
-# CONFIG_NORTEL_HERMES is not set
-# CONFIG_NOZOMI is not set
-# CONFIG_NO_HZ is not set
-# CONFIG_NS83820 is not set
-# CONFIG_NTFS_DEBUG is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_RW is not set
-# CONFIG_NVRAM is not set
-# CONFIG_OCFS2_FS is not set
-# CONFIG_OCF_BENCH is not set
-# CONFIG_OCF_C7108 is not set
-# CONFIG_OCF_CRYPTOCTEON is not set
-# CONFIG_OCF_EP80579 is not set
-# CONFIG_OCF_HIFN is not set
-# CONFIG_OCF_HIFNHIPP is not set
-# CONFIG_OCF_IXP4XX is not set
-# CONFIG_OCF_KIRKWOOD is not set
-# CONFIG_OCF_OCF is not set
-# CONFIG_OCF_OCFNULL is not set
-# CONFIG_OCF_SAFE is not set
-# CONFIG_OCF_TALITOS is not set
-# CONFIG_OC_ETM is not set
-# CONFIG_OMFS_FS is not set
-# CONFIG_ORION_WATCHDOG is not set
-# CONFIG_OSF_PARTITION is not set
-# CONFIG_P54_COMMON is not set
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-# CONFIG_PAGE_POISONING is not set
-# CONFIG_PAGE_SIZE_16KB is not set
-# CONFIG_PAGE_SIZE_32KB is not set
-CONFIG_PAGE_SIZE_4KB=y
-# CONFIG_PAGE_SIZE_64KB is not set
-# CONFIG_PAGE_SIZE_8KB is not set
-# CONFIG_PANTHERLORD_FF is not set
-# CONFIG_PARPORT is not set
-# CONFIG_PARPORT_PC is not set
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_PATA_ALI is not set
-# CONFIG_PATA_AMD is not set
-# CONFIG_PATA_ARTOP is not set
-# CONFIG_PATA_ATIIXP is not set
-# CONFIG_PATA_ATP867X is not set
-# CONFIG_PATA_CMD640_PCI is not set
-# CONFIG_PATA_CMD64X is not set
-# CONFIG_PATA_CS5520 is not set
-# CONFIG_PATA_CS5530 is not set
-# CONFIG_PATA_CS5535 is not set
-# CONFIG_PATA_CS5536 is not set
-# CONFIG_PATA_CYPRESS is not set
-# CONFIG_PATA_EFAR is not set
-# CONFIG_PATA_HPT366 is not set
-# CONFIG_PATA_HPT37X is not set
-# CONFIG_PATA_HPT3X2N is not set
-# CONFIG_PATA_HPT3X3 is not set
-# CONFIG_PATA_ISAPNP is not set
-# CONFIG_PATA_IT8213 is not set
-# CONFIG_PATA_IT821X is not set
-# CONFIG_PATA_JMICRON is not set
-# CONFIG_PATA_LEGACY is not set
-# CONFIG_PATA_MARVELL is not set
-# CONFIG_PATA_MPIIX is not set
-# CONFIG_PATA_NETCELL is not set
-# CONFIG_PATA_NINJA32 is not set
-# CONFIG_PATA_NS87410 is not set
-# CONFIG_PATA_NS87415 is not set
-# CONFIG_PATA_OLDPIIX is not set
-# CONFIG_PATA_OPTI is not set
-# CONFIG_PATA_OPTIDMA is not set
-# CONFIG_PATA_PCMCIA is not set
-# CONFIG_PATA_PDC2027X is not set
-# CONFIG_PATA_PDC_OLD is not set
-# CONFIG_PATA_PLATFORM is not set
-# CONFIG_PATA_QDI is not set
-# CONFIG_PATA_RADISYS is not set
-# CONFIG_PATA_RDC is not set
-# CONFIG_PATA_RZ1000 is not set
-# CONFIG_PATA_SC1200 is not set
-# CONFIG_PATA_SCH is not set
-# CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_SIL680 is not set
-# CONFIG_PATA_SIS is not set
-# CONFIG_PATA_TOSHIBA is not set
-# CONFIG_PATA_TRIFLEX is not set
-# CONFIG_PATA_VIA is not set
-# CONFIG_PATA_WINBOND is not set
-# CONFIG_PATA_WINBOND_VLB is not set
-# CONFIG_PC300TOO is not set
-# CONFIG_PCCARD is not set
-# CONFIG_PCF8575 is not set
-# CONFIG_PCI is not set
-# CONFIG_PCI200SYN is not set
-# CONFIG_PCIEAER_INJECT is not set
-# CONFIG_PCIEASPM is not set
-# CONFIG_PCIE_ECRC is not set
-# CONFIG_PCIPCWATCHDOG is not set
-# CONFIG_PCI_ATMEL is not set
-# CONFIG_PCI_DEBUG is not set
-# CONFIG_PCI_DISABLE_COMMON_QUIRKS is not set
-# CONFIG_PCI_HERMES is not set
-# CONFIG_PCI_IOV is not set
-# CONFIG_PCI_LEGACY is not set
-# CONFIG_PCI_MSI is not set
-CONFIG_PCI_QUIRKS=y
-# CONFIG_PCI_STUB is not set
-CONFIG_PCI_SYSCALL=y
-# CONFIG_PCMCIA is not set
-# CONFIG_PCMCIA_AHA152X is not set
-# CONFIG_PCMCIA_ATMEL is not set
-# CONFIG_PCMCIA_DEBUG is not set
-# CONFIG_PCMCIA_FDOMAIN is not set
-# CONFIG_PCMCIA_HERMES is not set
-# CONFIG_PCMCIA_IOCTL is not set
-# CONFIG_PCMCIA_LOAD_CIS is not set
-# CONFIG_PCMCIA_NETWAVE is not set
-# CONFIG_PCMCIA_NINJA_SCSI is not set
-# CONFIG_PCMCIA_QLOGIC is not set
-# CONFIG_PCMCIA_RAYCS is not set
-# CONFIG_PCMCIA_SPECTRUM is not set
-# CONFIG_PCMCIA_SYM53C500 is not set
-# CONFIG_PCMCIA_WAVELAN is not set
-# CONFIG_PCMCIA_WL3501 is not set
-# CONFIG_PCMCIA_XIRCOM is not set
-# CONFIG_PCNET32 is not set
-# CONFIG_PCSPKR_PLATFORM is not set
-# CONFIG_PD6729 is not set
-# CONFIG_PDC_ADMA is not set
-# CONFIG_PERF_COUNTERS is not set
-# CONFIG_PERF_EVENTS is not set
-# CONFIG_PHANTOM is not set
-# CONFIG_PHONE is not set
-# CONFIG_PHONET is not set
-# CONFIG_PHYLIB is not set
-# CONFIG_PHYS_ADDR_T_64BIT is not set
-# CONFIG_PID_NS is not set
-# CONFIG_PLAN9AUTH is not set
-CONFIG_PLIST=y
-# CONFIG_PLX_HERMES is not set
-# CONFIG_PM is not set
-# CONFIG_PMIC_ADP5520 is not set
-# CONFIG_PMIC_DA903X is not set
-# CONFIG_POHMELFS is not set
-# CONFIG_POSIX_MQUEUE is not set
-# CONFIG_POWER_SUPPLY is not set
-CONFIG_PPC4xx_GPIO=y
-# CONFIG_PPC_16K_PAGES is not set
-# CONFIG_PPC_256K_PAGES is not set
-CONFIG_PPC_4K_PAGES=y
-# CONFIG_PPC_64K_PAGES is not set
-# CONFIG_PPC_DISABLE_WERROR is not set
-# CONFIG_PPC_EMULATED_STATS is not set
-# CONFIG_PPP is not set
-# CONFIG_PPPOATM is not set
-# CONFIG_PPPOE is not set
-# CONFIG_PPPOL2TP is not set
-# CONFIG_PPP_ASYNC is not set
-# CONFIG_PPP_BSDCOMP is not set
-# CONFIG_PPP_DEFLATE is not set
-CONFIG_PPP_FILTER=y
-# CONFIG_PPP_MPPE is not set
-CONFIG_PPP_MULTILINK=y
-# CONFIG_PPP_SYNC_TTY is not set
-# CONFIG_PPS is not set
-# CONFIG_PREEMPT is not set
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_PREEMPT_RCU_TRACE is not set
-# CONFIG_PREEMPT_VOLUNTARY is not set
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_PRINTK=y
-# CONFIG_PRINTK_TIME is not set
-# CONFIG_PRISM2_USB is not set
-# CONFIG_PRISM54 is not set
-# CONFIG_PROBE_INITRD_HEADER is not set
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-# CONFIG_PROC_PAGE_MONITOR is not set
-CONFIG_PROC_SYSCTL=y
-# CONFIG_PROFILING is not set
-# CONFIG_PROVE_LOCKING is not set
-# CONFIG_PSB6970_PHY is not set
-# CONFIG_QEMU is not set
-# CONFIG_QLA3XXX is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_QSEMI_PHY is not set
-# CONFIG_QT2160 is not set
-# CONFIG_QUOTA is not set
-# CONFIG_R3964 is not set
-# CONFIG_R6040 is not set
-# CONFIG_R8169 is not set
-# CONFIG_R8187SE is not set
-# CONFIG_RADIO_ADAPTERS is not set
-# CONFIG_RADIO_AZTECH is not set
-# CONFIG_RADIO_CADET is not set
-# CONFIG_RADIO_GEMTEK is not set
-# CONFIG_RADIO_GEMTEK_PCI is not set
-# CONFIG_RADIO_MAESTRO is not set
-# CONFIG_RADIO_MAXIRADIO is not set
-# CONFIG_RADIO_RTRACK is not set
-# CONFIG_RADIO_RTRACK2 is not set
-# CONFIG_RADIO_SF16FMI is not set
-# CONFIG_RADIO_SF16FMR2 is not set
-# CONFIG_RADIO_TERRATEC is not set
-# CONFIG_RADIO_TRUST is not set
-# CONFIG_RADIO_TYPHOON is not set
-# CONFIG_RADIO_ZOLTRIX is not set
-# CONFIG_RAID_ATTRS is not set
-CONFIG_RAMFS=y
-# CONFIG_RAMZSWAP is not set
-# CONFIG_RAR_REGISTER is not set
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_RCU_CPU_STALL_DETECTOR is not set
-CONFIG_RCU_FANOUT=32
-# CONFIG_RCU_FANOUT_EXACT is not set
-# CONFIG_RCU_TORTURE_TEST is not set
-# CONFIG_RCU_TRACE is not set
-# CONFIG_RDC_17F3101X is not set
-# CONFIG_RDS is not set
-# CONFIG_RD_BZIP2 is not set
-# CONFIG_RD_GZIP is not set
-CONFIG_RD_LZMA=y
-# CONFIG_RD_LZO is not set
-# CONFIG_REALTEK_PHY is not set
-# CONFIG_REDWOOD is not set
-# CONFIG_REGULATOR is not set
-# CONFIG_REGULATOR_BQ24022 is not set
-# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
-# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_REISERFS_FS_XATTR is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-# CONFIG_RELAY is not set
-# CONFIG_RESOURCES_64BIT is not set
-# CONFIG_RFD_FTL is not set
-# CONFIG_RFKILL is not set
-# CONFIG_RFKILL_INPUT is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_ROSE is not set
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-# CONFIG_RT2860 is not set
-# CONFIG_RT2870 is not set
-# CONFIG_RT2X00 is not set
-# CONFIG_RT3070 is not set
-# CONFIG_RT3090 is not set
-# CONFIG_RTC_CLASS is not set
-# CONFIG_RTC_DEBUG is not set
-# CONFIG_RTC_DRV_BQ32K is not set
-# CONFIG_RTC_DRV_BQ4802 is not set
-CONFIG_RTC_DRV_CMOS=y
-# CONFIG_RTC_DRV_DS1286 is not set
-# CONFIG_RTC_DRV_DS1305 is not set
-# CONFIG_RTC_DRV_DS1307 is not set
-# CONFIG_RTC_DRV_DS1374 is not set
-# CONFIG_RTC_DRV_DS1390 is not set
-# CONFIG_RTC_DRV_DS1511 is not set
-# CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_DS1672 is not set
-# CONFIG_RTC_DRV_DS1742 is not set
-# CONFIG_RTC_DRV_DS3234 is not set
-# CONFIG_RTC_DRV_FM3130 is not set
-# CONFIG_RTC_DRV_ISL1208 is not set
-# CONFIG_RTC_DRV_M41T80 is not set
-# CONFIG_RTC_DRV_M41T94 is not set
-# CONFIG_RTC_DRV_M48T35 is not set
-# CONFIG_RTC_DRV_M48T59 is not set
-# CONFIG_RTC_DRV_M48T86 is not set
-# CONFIG_RTC_DRV_MAX6900 is not set
-# CONFIG_RTC_DRV_MAX6902 is not set
-# CONFIG_RTC_DRV_MSM6242 is not set
-# CONFIG_RTC_DRV_PCF2123 is not set
-# CONFIG_RTC_DRV_PCF50606 is not set
-# CONFIG_RTC_DRV_PCF8563 is not set
-# CONFIG_RTC_DRV_PCF8583 is not set
-# CONFIG_RTC_DRV_R9701 is not set
-# CONFIG_RTC_DRV_RP5C01 is not set
-# CONFIG_RTC_DRV_RS5C348 is not set
-# CONFIG_RTC_DRV_RS5C372 is not set
-# CONFIG_RTC_DRV_RTC7301 is not set
-# CONFIG_RTC_DRV_RX8025 is not set
-# CONFIG_RTC_DRV_RX8581 is not set
-# CONFIG_RTC_DRV_S35390A is not set
-# CONFIG_RTC_DRV_STK17TA8 is not set
-# CONFIG_RTC_DRV_TEST is not set
-# CONFIG_RTC_DRV_V3020 is not set
-# CONFIG_RTC_DRV_X1205 is not set
-CONFIG_RTC_HCTOSYS=y
-CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
-CONFIG_RTC_INTF_DEV=y
-# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
-CONFIG_RTC_INTF_PROC=y
-CONFIG_RTC_INTF_SYSFS=y
-CONFIG_RTC_LIB=y
-# CONFIG_RTL8180 is not set
-# CONFIG_RTL8187 is not set
-# CONFIG_RTL8187SE is not set
-# CONFIG_RTL8192E is not set
-# CONFIG_RTL8192SU is not set
-# CONFIG_RTL8192U is not set
-# CONFIG_RTL8306_PHY is not set
-# CONFIG_RTL8366RB_PHY is not set
-# CONFIG_RTL8366S_PHY is not set
-# CONFIG_RTL8366S_PHY_DEBUG_FS is not set
-# CONFIG_RTL8366_SMI is not set
-CONFIG_RT_MUTEXES=y
-# CONFIG_RT_MUTEX_TESTER is not set
-# CONFIG_RUNTIME_DEBUG is not set
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_S2IO is not set
-# CONFIG_SAMPLES is not set
-# CONFIG_SATA_AHCI is not set
-# CONFIG_SATA_INIC162X is not set
-# CONFIG_SATA_MV is not set
-# CONFIG_SATA_NV is not set
-# CONFIG_SATA_PMP is not set
-# CONFIG_SATA_PROMISE is not set
-# CONFIG_SATA_QSTOR is not set
-# CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIL24 is not set
-# CONFIG_SATA_SIS is not set
-# CONFIG_SATA_SVW is not set
-# CONFIG_SATA_SX4 is not set
-# CONFIG_SATA_ULI is not set
-# CONFIG_SATA_VIA is not set
-# CONFIG_SATA_VITESSE is not set
-# CONFIG_SBC_FITPC2_WATCHDOG is not set
-# CONFIG_SC92031 is not set
-# CONFIG_SCC is not set
-# CONFIG_SCHEDSTATS is not set
-# CONFIG_SCHED_BFS is not set
-CONFIG_SCHED_CFS=y
-# CONFIG_SCHED_DEBUG is not set
-# CONFIG_SCHED_TRACER is not set
-# CONFIG_SCSI is not set
-# CONFIG_SCSI_3W_9XXX is not set
-# CONFIG_SCSI_3W_SAS is not set
-# CONFIG_SCSI_7000FASST is not set
-# CONFIG_SCSI_AACRAID is not set
-# CONFIG_SCSI_ACARD is not set
-# CONFIG_SCSI_ADVANSYS is not set
-# CONFIG_SCSI_AHA152X is not set
-# CONFIG_SCSI_AHA1542 is not set
-# CONFIG_SCSI_AIC79XX is not set
-# CONFIG_SCSI_AIC7XXX is not set
-# CONFIG_SCSI_AIC7XXX_OLD is not set
-# CONFIG_SCSI_AIC94XX is not set
-# CONFIG_SCSI_ARCMSR is not set
-# CONFIG_SCSI_BFA_FC is not set
-# CONFIG_SCSI_BNX2_ISCSI is not set
-# CONFIG_SCSI_BUSLOGIC is not set
-# CONFIG_SCSI_CONSTANTS is not set
-# CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_DC395x is not set
-# CONFIG_SCSI_DEBUG is not set
-# CONFIG_SCSI_DH is not set
-CONFIG_SCSI_DMA=y
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DPT_I2O is not set
-# CONFIG_SCSI_DTC3280 is not set
-# CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_ESP_CORE is not set
-# CONFIG_SCSI_FC_ATTRS is not set
-# CONFIG_SCSI_FUTURE_DOMAIN is not set
-# CONFIG_SCSI_GDTH is not set
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
-# CONFIG_SCSI_HPSA is not set
-# CONFIG_SCSI_HPTIOP is not set
-# CONFIG_SCSI_IN2000 is not set
-# CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_INITIO is not set
-# CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_IPS is not set
-# CONFIG_SCSI_ISCSI_ATTRS is not set
-# CONFIG_SCSI_LOGGING is not set
-CONFIG_SCSI_LOWLEVEL=y
-# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
-# CONFIG_SCSI_LPFC is not set
-# CONFIG_SCSI_MPT2SAS is not set
-CONFIG_SCSI_MULTI_LUN=y
-# CONFIG_SCSI_MVSAS is not set
-# CONFIG_SCSI_MVSAS_DEBUG is not set
-# CONFIG_SCSI_NCR53C406A is not set
-# CONFIG_SCSI_NETLINK is not set
-# CONFIG_SCSI_NSP32 is not set
-# CONFIG_SCSI_OSD_INITIATOR is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PM8001 is not set
-# CONFIG_SCSI_PMCRAID is not set
-CONFIG_SCSI_PROC_FS=y
-# CONFIG_SCSI_PSI240I is not set
-# CONFIG_SCSI_QLA_FC is not set
-# CONFIG_SCSI_QLA_ISCSI is not set
-# CONFIG_SCSI_QLOGIC_1280 is not set
-# CONFIG_SCSI_QLOGIC_FAS is not set
-# CONFIG_SCSI_SAS_ATTRS is not set
-# CONFIG_SCSI_SAS_LIBSAS is not set
-# CONFIG_SCSI_SCAN_ASYNC is not set
-# CONFIG_SCSI_SEAGATE is not set
-# CONFIG_SCSI_SPI_ATTRS is not set
-# CONFIG_SCSI_SRP is not set
-# CONFIG_SCSI_SRP_ATTRS is not set
-# CONFIG_SCSI_STEX is not set
-# CONFIG_SCSI_SYM53C416 is not set
-# CONFIG_SCSI_SYM53C8XX_2 is not set
-# CONFIG_SCSI_T128 is not set
-# CONFIG_SCSI_TGT is not set
-# CONFIG_SCSI_U14_34F is not set
-# CONFIG_SCSI_ULTRASTOR is not set
-CONFIG_SCSI_WAIT_SCAN=m
-# CONFIG_SECCOMP is not set
-# CONFIG_SECURITY is not set
-# CONFIG_SECURITYFS is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
-CONFIG_SELECT_MEMORY_MODEL=y
-# CONFIG_SENSORS_ABITUGURU is not set
-# CONFIG_SENSORS_ABITUGURU3 is not set
-# CONFIG_SENSORS_AD7414 is not set
-# CONFIG_SENSORS_AD7418 is not set
-# CONFIG_SENSORS_ADCXX is not set
-# CONFIG_SENSORS_ADM1021 is not set
-# CONFIG_SENSORS_ADM1025 is not set
-# CONFIG_SENSORS_ADM1026 is not set
-# CONFIG_SENSORS_ADM1029 is not set
-# CONFIG_SENSORS_ADM1031 is not set
-# CONFIG_SENSORS_ADM9240 is not set
-# CONFIG_SENSORS_ADS7828 is not set
-# CONFIG_SENSORS_ADT7462 is not set
-# CONFIG_SENSORS_ADT7470 is not set
-# CONFIG_SENSORS_ADT7473 is not set
-# CONFIG_SENSORS_ADT7475 is not set
-# CONFIG_SENSORS_AMC6821 is not set
-# CONFIG_SENSORS_APPLESMC is not set
-# CONFIG_SENSORS_ASB100 is not set
-# CONFIG_SENSORS_ATK0110 is not set
-# CONFIG_SENSORS_ATXP1 is not set
-# CONFIG_SENSORS_CORETEMP is not set
-# CONFIG_SENSORS_DME1737 is not set
-# CONFIG_SENSORS_DS1337 is not set
-# CONFIG_SENSORS_DS1374 is not set
-# CONFIG_SENSORS_DS1621 is not set
-# CONFIG_SENSORS_EEPROM is not set
-# CONFIG_SENSORS_F71805F is not set
-# CONFIG_SENSORS_F71882FG is not set
-# CONFIG_SENSORS_F75375S is not set
-# CONFIG_SENSORS_FSCHER is not set
-# CONFIG_SENSORS_FSCHMD is not set
-# CONFIG_SENSORS_FSCPOS is not set
-# CONFIG_SENSORS_G760A is not set
-# CONFIG_SENSORS_GL518SM is not set
-# CONFIG_SENSORS_GL520SM is not set
-# CONFIG_SENSORS_HDAPS is not set
-# CONFIG_SENSORS_I5K_AMB is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_K8TEMP is not set
-# CONFIG_SENSORS_LIS3LV02D is not set
-# CONFIG_SENSORS_LIS3_I2C is not set
-# CONFIG_SENSORS_LIS3_SPI is not set
-# CONFIG_SENSORS_LM63 is not set
-# CONFIG_SENSORS_LM70 is not set
-# CONFIG_SENSORS_LM73 is not set
-# CONFIG_SENSORS_LM75 is not set
-# CONFIG_SENSORS_LM77 is not set
-# CONFIG_SENSORS_LM78 is not set
-# CONFIG_SENSORS_LM80 is not set
-# CONFIG_SENSORS_LM83 is not set
-# CONFIG_SENSORS_LM85 is not set
-# CONFIG_SENSORS_LM87 is not set
-# CONFIG_SENSORS_LM90 is not set
-# CONFIG_SENSORS_LM92 is not set
-# CONFIG_SENSORS_LM93 is not set
-# CONFIG_SENSORS_LM95241 is not set
-# CONFIG_SENSORS_LTC4215 is not set
-# CONFIG_SENSORS_LTC4245 is not set
-# CONFIG_SENSORS_M41T00 is not set
-# CONFIG_SENSORS_MAX1111 is not set
-# CONFIG_SENSORS_MAX1619 is not set
-# CONFIG_SENSORS_MAX6650 is not set
-# CONFIG_SENSORS_MAX6875 is not set
-# CONFIG_SENSORS_PC87360 is not set
-# CONFIG_SENSORS_PC87427 is not set
-# CONFIG_SENSORS_PCA9539 is not set
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_SHT15 is not set
-# CONFIG_SENSORS_SIS5595 is not set
-# CONFIG_SENSORS_SMSC47B397 is not set
-# CONFIG_SENSORS_SMSC47M1 is not set
-# CONFIG_SENSORS_SMSC47M192 is not set
-# CONFIG_SENSORS_THMC50 is not set
-# CONFIG_SENSORS_TMP401 is not set
-# CONFIG_SENSORS_TMP421 is not set
-# CONFIG_SENSORS_TSL2550 is not set
-# CONFIG_SENSORS_VIA686A is not set
-# CONFIG_SENSORS_VT1211 is not set
-# CONFIG_SENSORS_VT8231 is not set
-# CONFIG_SENSORS_W83627EHF is not set
-# CONFIG_SENSORS_W83627HF is not set
-# CONFIG_SENSORS_W83781D is not set
-# CONFIG_SENSORS_W83791D is not set
-# CONFIG_SENSORS_W83792D is not set
-# CONFIG_SENSORS_W83793 is not set
-# CONFIG_SENSORS_W83L785TS is not set
-# CONFIG_SENSORS_W83L786NG is not set
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-# CONFIG_SERIAL_8250_CS is not set
-CONFIG_SERIAL_8250_NR_UARTS=2
-# CONFIG_SERIAL_8250_PCI is not set
-CONFIG_SERIAL_8250_RUNTIME_UARTS=2
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_SERIAL_JSM is not set
-# CONFIG_SERIAL_MAX3100 is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-# CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL is not set
-# CONFIG_SERIAL_UARTLITE is not set
-# CONFIG_SERIO is not set
-# CONFIG_SFI is not set
-# CONFIG_SGI_IOC4 is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_SHAPER is not set
-CONFIG_SHMEM=y
-CONFIG_SIGNALFD=y
-# CONFIG_SIMPLE_GPIO is not set
-# CONFIG_SIS190 is not set
-# CONFIG_SIS900 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_SKGE is not set
-# CONFIG_SKY2 is not set
-# CONFIG_SKY2_DEBUG is not set
-CONFIG_SLAB=y
-CONFIG_SLABINFO=y
-# CONFIG_SLHC is not set
-# CONFIG_SLICOSS is not set
-# CONFIG_SLIP is not set
-# CONFIG_SLOB is not set
-# CONFIG_SLOW_WORK is not set
-# CONFIG_SLOW_WORK_DEBUG is not set
-# CONFIG_SLUB is not set
-# CONFIG_SLUB_DEBUG is not set
-# CONFIG_SMARTJOYPLUS_FF is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_SMB_NLS_DEFAULT is not set
-# CONFIG_SMC911X is not set
-# CONFIG_SMC91X is not set
-# CONFIG_SMP is not set
-# CONFIG_SMSC911X is not set
-# CONFIG_SMSC9420 is not set
-# CONFIG_SMSC_PHY is not set
-# CONFIG_SND is not set
-# CONFIG_SND_AC97_POWER_SAVE is not set
-# CONFIG_SND_AD1816A is not set
-# CONFIG_SND_AD1848 is not set
-# CONFIG_SND_AD1889 is not set
-# CONFIG_SND_ADLIB is not set
-# CONFIG_SND_ALI5451 is not set
-# CONFIG_SND_ALS100 is not set
-# CONFIG_SND_ALS300 is not set
-# CONFIG_SND_ALS4000 is not set
-# CONFIG_SND_ARM is not set
-# CONFIG_SND_ATIIXP is not set
-# CONFIG_SND_ATIIXP_MODEM is not set
-# CONFIG_SND_AU8810 is not set
-# CONFIG_SND_AU8820 is not set
-# CONFIG_SND_AU8830 is not set
-# CONFIG_SND_AW2 is not set
-# CONFIG_SND_AZT2320 is not set
-# CONFIG_SND_AZT3328 is not set
-# CONFIG_SND_BT87X is not set
-# CONFIG_SND_CA0106 is not set
-# CONFIG_SND_CMI8330 is not set
-# CONFIG_SND_CMIPCI is not set
-# CONFIG_SND_CS4231 is not set
-# CONFIG_SND_CS4232 is not set
-# CONFIG_SND_CS4236 is not set
-# CONFIG_SND_CS4281 is not set
-# CONFIG_SND_CS46XX is not set
-# CONFIG_SND_CS5530 is not set
-# CONFIG_SND_CS5535AUDIO is not set
-# CONFIG_SND_CTXFI is not set
-# CONFIG_SND_DARLA20 is not set
-# CONFIG_SND_DARLA24 is not set
-# CONFIG_SND_DEBUG is not set
-CONFIG_SND_DRIVERS=y
-# CONFIG_SND_DT019X is not set
-# CONFIG_SND_DUMMY is not set
-# CONFIG_SND_DYNAMIC_MINORS is not set
-# CONFIG_SND_ECHO3G is not set
-# CONFIG_SND_EMU10K1 is not set
-# CONFIG_SND_EMU10K1X is not set
-# CONFIG_SND_ENS1370 is not set
-# CONFIG_SND_ENS1371 is not set
-# CONFIG_SND_ES1688 is not set
-# CONFIG_SND_ES18XX is not set
-# CONFIG_SND_ES1938 is not set
-# CONFIG_SND_ES1968 is not set
-# CONFIG_SND_ES968 is not set
-# CONFIG_SND_FM801 is not set
-# CONFIG_SND_GINA20 is not set
-# CONFIG_SND_GINA24 is not set
-# CONFIG_SND_GUSCLASSIC is not set
-# CONFIG_SND_GUSEXTREME is not set
-# CONFIG_SND_GUSMAX is not set
-# CONFIG_SND_HDA_INTEL is not set
-# CONFIG_SND_HDSP is not set
-# CONFIG_SND_HDSPM is not set
-# CONFIG_SND_HIFIER is not set
-# CONFIG_SND_HRTIMER is not set
-# CONFIG_SND_HWDEP is not set
-# CONFIG_SND_ICE1712 is not set
-# CONFIG_SND_ICE1724 is not set
-# CONFIG_SND_INDIGO is not set
-# CONFIG_SND_INDIGODJ is not set
-# CONFIG_SND_INDIGODJX is not set
-# CONFIG_SND_INDIGOIO is not set
-# CONFIG_SND_INDIGOIOX is not set
-# CONFIG_SND_INTEL8X0 is not set
-# CONFIG_SND_INTEL8X0M is not set
-# CONFIG_SND_INTERWAVE is not set
-# CONFIG_SND_INTERWAVE_STB is not set
-# CONFIG_SND_ISA is not set
-# CONFIG_SND_KORG1212 is not set
-# CONFIG_SND_LAYLA20 is not set
-# CONFIG_SND_LAYLA24 is not set
-# CONFIG_SND_LX6464ES is not set
-# CONFIG_SND_MAESTRO3 is not set
-# CONFIG_SND_MIA is not set
-# CONFIG_SND_MIPS is not set
-# CONFIG_SND_MIRO is not set
-# CONFIG_SND_MIXART is not set
-# CONFIG_SND_MIXER_OSS is not set
-# CONFIG_SND_MONA is not set
-# CONFIG_SND_MPU401 is not set
-# CONFIG_SND_MTPAV is not set
-# CONFIG_SND_NM256 is not set
-# CONFIG_SND_OPL3SA2 is not set
-# CONFIG_SND_OPTI92X_AD1848 is not set
-# CONFIG_SND_OPTI92X_CS4231 is not set
-# CONFIG_SND_OPTI93X is not set
-CONFIG_SND_OSSEMUL=y
-# CONFIG_SND_OXYGEN is not set
-CONFIG_SND_PCI=y
-# CONFIG_SND_PCM is not set
-# CONFIG_SND_PCMCIA is not set
-# CONFIG_SND_PCM_OSS is not set
-CONFIG_SND_PCM_OSS_PLUGINS=y
-# CONFIG_SND_PCXHR is not set
-# CONFIG_SND_PDAUDIOCF is not set
-# CONFIG_SND_RAWMIDI is not set
-# CONFIG_SND_RIPTIDE is not set
-# CONFIG_SND_RME32 is not set
-# CONFIG_SND_RME96 is not set
-# CONFIG_SND_RME9652 is not set
-# CONFIG_SND_RTCTIMER is not set
-# CONFIG_SND_SB16 is not set
-# CONFIG_SND_SB8 is not set
-# CONFIG_SND_SBAWE is not set
-# CONFIG_SND_SEQUENCER is not set
-# CONFIG_SND_SERIAL_U16550 is not set
-# CONFIG_SND_SGALAXY is not set
-# CONFIG_SND_SIS7019 is not set
-# CONFIG_SND_SOC is not set
-# CONFIG_SND_SONICVIBES is not set
-# CONFIG_SND_SPI is not set
-# CONFIG_SND_SSCAPE is not set
-# CONFIG_SND_SUPPORT_OLD_API is not set
-# CONFIG_SND_TIMER is not set
-# CONFIG_SND_TRIDENT is not set
-CONFIG_SND_USB=y
-# CONFIG_SND_USB_AUDIO is not set
-# CONFIG_SND_USB_CAIAQ is not set
-# CONFIG_SND_USB_US122L is not set
-# CONFIG_SND_USB_USX2Y is not set
-# CONFIG_SND_VERBOSE_PRINTK is not set
-CONFIG_SND_VERBOSE_PROCFS=y
-# CONFIG_SND_VIA82XX is not set
-# CONFIG_SND_VIA82XX_MODEM is not set
-# CONFIG_SND_VIRTUOSO is not set
-# CONFIG_SND_VX222 is not set
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_WAVEFRONT is not set
-# CONFIG_SND_YMFPCI is not set
-# CONFIG_SNI_RM is not set
-# CONFIG_SOC_CAMERA is not set
-# CONFIG_SOFT_WATCHDOG is not set
-# CONFIG_SOLARIS_X86_PARTITION is not set
-# CONFIG_SONYPI is not set
-# CONFIG_SONY_LAPTOP is not set
-# CONFIG_SOUND is not set
-# CONFIG_SOUND_PRIME is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_STATIC is not set
-# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
-# CONFIG_SPI is not set
-# CONFIG_SPI_AT25 is not set
-# CONFIG_SPI_DEBUG is not set
-# CONFIG_SPI_DESIGNWARE is not set
-# CONFIG_SPI_GPIO_OLD is not set
-# CONFIG_SPI_MASTER is not set
-# CONFIG_SPI_ORION is not set
-# CONFIG_SPI_TLE62X0 is not set
-# CONFIG_SPI_XILINX is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4
-CONFIG_SQUASHFS=y
-# CONFIG_SQUASHFS_EMBEDDED is not set
-CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
-CONFIG_SQUASHFS_LZMA=y
-CONFIG_SQUASHFS_SUPPORT_ZLIB=y
-# CONFIG_SQUASHFS_VMALLOC is not set
-# CONFIG_SSB is not set
-# CONFIG_SSB_DEBUG is not set
-# CONFIG_SSB_PCMCIAHOST is not set
-CONFIG_SSB_POSSIBLE=y
-# CONFIG_SSB_SDIOHOST is not set
-# CONFIG_SSB_SILENT is not set
-# CONFIG_SSFDC is not set
-CONFIG_STACKTRACE_SUPPORT=y
-# CONFIG_STACK_TRACER is not set
-CONFIG_STAGING=y
-# CONFIG_STAGING_EXCLUDE_BUILD is not set
-CONFIG_STANDALONE=y
-CONFIG_STDBINUTILS=y
-# CONFIG_STE10XP is not set
-CONFIG_STP=y
-# CONFIG_STRIP is not set
-CONFIG_STRIP_ASM_SYMS=y
-# CONFIG_SUNDANCE is not set
-# CONFIG_SUNGEM is not set
-# CONFIG_SUNRPC is not set
-# CONFIG_SUNRPC_BIND34 is not set
-# CONFIG_SUNRPC_GSS is not set
-# CONFIG_SUNRPC_REGISTER_V4 is not set
-# CONFIG_SUN_PARTITION is not set
-CONFIG_SUSPEND_UP_POSSIBLE=y
-CONFIG_SWAP=y
-# CONFIG_SWCONFIG is not set
-# CONFIG_SYNCLINK_CS is not set
-CONFIG_SYN_COOKIES=y
-CONFIG_SYSCTL=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_SYSCTL_SYSCALL_CHECK=y
-CONFIG_SYSFS=y
-# CONFIG_SYSFS_DEPRECATED is not set
-# CONFIG_SYSFS_DEPRECATED_V2 is not set
-# CONFIG_SYSV68_PARTITION is not set
-CONFIG_SYSVIPC=y
-CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_SYSV_FS is not set
-# CONFIG_SYS_HYPERVISOR is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_TCG_TPM is not set
-# CONFIG_TCIC is not set
-CONFIG_TCP_CONG_ADVANCED=y
-# CONFIG_TCP_CONG_BIC is not set
-# CONFIG_TCP_CONG_CUBIC is not set
-# CONFIG_TCP_CONG_HSTCP is not set
-# CONFIG_TCP_CONG_HTCP is not set
-# CONFIG_TCP_CONG_HYBLA is not set
-# CONFIG_TCP_CONG_ILLINOIS is not set
-# CONFIG_TCP_CONG_LP is not set
-# CONFIG_TCP_CONG_SCALABLE is not set
-# CONFIG_TCP_CONG_VEGAS is not set
-# CONFIG_TCP_CONG_VENO is not set
-CONFIG_TCP_CONG_WESTWOOD=y
-# CONFIG_TCP_CONG_YEAH is not set
-# CONFIG_TCP_MD5SIG is not set
-CONFIG_TEXTSEARCH=y
-# CONFIG_TEXTSEARCH_BM is not set
-# CONFIG_TEXTSEARCH_FSM is not set
-# CONFIG_TEXTSEARCH_KMP is not set
-# CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
-# CONFIG_THRUSTMASTER_FF is not set
-CONFIG_TICK_ONESHOT=y
-# CONFIG_TIFM_CORE is not set
-# CONFIG_TIGON3 is not set
-CONFIG_TIMERFD=y
-# CONFIG_TIMER_STATS is not set
-CONFIG_TINY_RCU=y
-# CONFIG_TINY_SHMEM is not set
-# CONFIG_TIPC is not set
-# CONFIG_TI_DAC7512 is not set
-# CONFIG_TLAN is not set
-# CONFIG_TMD_HERMES is not set
-CONFIG_TMPFS=y
-# CONFIG_TMPFS_POSIX_ACL is not set
-# CONFIG_TOUCHSCREEN_AD7877 is not set
-# CONFIG_TOUCHSCREEN_AD7879 is not set
-# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
-# CONFIG_TOUCHSCREEN_AD7879_SPI is not set
-# CONFIG_TOUCHSCREEN_ADS7846 is not set
-# CONFIG_TOUCHSCREEN_EETI is not set
-# CONFIG_TOUCHSCREEN_ELO is not set
-# CONFIG_TOUCHSCREEN_FILTER is not set
-# CONFIG_TOUCHSCREEN_FUJITSU is not set
-# CONFIG_TOUCHSCREEN_GUNZE is not set
-# CONFIG_TOUCHSCREEN_INEXIO is not set
-# CONFIG_TOUCHSCREEN_MK712 is not set
-# CONFIG_TOUCHSCREEN_MTOUCH is not set
-# CONFIG_TOUCHSCREEN_PENMOUNT is not set
-# CONFIG_TOUCHSCREEN_S3C2410 is not set
-# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
-# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
-# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
-# CONFIG_TOUCHSCREEN_TSC2007 is not set
-# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
-# CONFIG_TOUCHSCREEN_W90X900 is not set
-# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
-# CONFIG_TPS65010 is not set
-# CONFIG_TR is not set
-# CONFIG_TRACE_BRANCH_PROFILING is not set
-CONFIG_TRACE_IRQFLAGS_SUPPORT=y
-CONFIG_TRACING_SUPPORT=y
-# CONFIG_TRANZPORT is not set
-# CONFIG_TREE_RCU is not set
-# CONFIG_TREE_RCU_TRACE is not set
-# CONFIG_TUN is not set
-# CONFIG_TUNER_3036 is not set
-# CONFIG_TUNER_TEA5761 is not set
-# CONFIG_TWL4030_CORE is not set
-# CONFIG_UACCESS_WITH_MEMCPY is not set
-# CONFIG_UCB1400_CORE is not set
-# CONFIG_UDF_FS is not set
-CONFIG_UDF_NLS=y
-CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
-# CONFIG_UFS_FS is not set
-# CONFIG_UIO is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_UNEVICTABLE_LRU is not set
-# CONFIG_UNION_MOUNT is not set
-CONFIG_UNIX=y
-CONFIG_UNIX98_PTYS=y
-# CONFIG_UNIXWARE_DISKLABEL is not set
-# CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_USB is not set
-# CONFIG_USBPCWATCHDOG is not set
-# CONFIG_USB_ACECAD is not set
-# CONFIG_USB_ACM is not set
-# CONFIG_USB_ADUTUX is not set
-# CONFIG_USB_AIPTEK is not set
-CONFIG_USB_ALI_M5632=y
-CONFIG_USB_AN2720=y
-# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
-# CONFIG_USB_APPLEDISPLAY is not set
-# CONFIG_USB_APPLETOUCH is not set
-CONFIG_USB_ARCH_HAS_EHCI=y
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-CONFIG_USB_ARMLINUX=y
-# CONFIG_USB_ATI_REMOTE is not set
-# CONFIG_USB_ATI_REMOTE2 is not set
-# CONFIG_USB_ATM is not set
-# CONFIG_USB_ATMEL is not set
-# CONFIG_USB_AUERSWALD is not set
-# CONFIG_USB_BANDWIDTH is not set
-CONFIG_USB_BELKIN=y
-# CONFIG_USB_BERRY_CHARGE is not set
-# CONFIG_USB_C67X00_HCD is not set
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_CPC is not set
-# CONFIG_USB_CXACRU is not set
-# CONFIG_USB_CYPRESS_CY7C63 is not set
-# CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_DABUSB is not set
-# CONFIG_USB_DEBUG is not set
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_DEVICE_CLASS is not set
-# CONFIG_USB_DSBR is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_EHCI_HCD_PPC_OF is not set
-CONFIG_USB_EHCI_ROOT_HUB_TT=y
-# CONFIG_USB_EHCI_SPLIT_ISO is not set
-# CONFIG_USB_EHCI_TT_NEWSCHED is not set
-# CONFIG_USB_EMI26 is not set
-# CONFIG_USB_EMI62 is not set
-# CONFIG_USB_EPSON2888 is not set
-# CONFIG_USB_ET61X251 is not set
-CONFIG_USB_EZUSB=y
-# CONFIG_USB_FTDI_ELAN is not set
-# CONFIG_USB_GADGET is not set
-# CONFIG_USB_GADGET_DEBUG is not set
-# CONFIG_USB_GL860 is not set
-# CONFIG_USB_GPIO_VBUS is not set
-# CONFIG_USB_GSPCA is not set
-# CONFIG_USB_GSPCA_CONEX is not set
-# CONFIG_USB_GSPCA_ETOMS is not set
-# CONFIG_USB_GSPCA_FINEPIX is not set
-# CONFIG_USB_GSPCA_JEILINJ is not set
-# CONFIG_USB_GSPCA_MARS is not set
-# CONFIG_USB_GSPCA_MR97310A is not set
-# CONFIG_USB_GSPCA_OV519 is not set
-# CONFIG_USB_GSPCA_OV534 is not set
-# CONFIG_USB_GSPCA_PAC207 is not set
-# CONFIG_USB_GSPCA_PAC7302 is not set
-# CONFIG_USB_GSPCA_PAC7311 is not set
-# CONFIG_USB_GSPCA_SN9C20X is not set
-CONFIG_USB_GSPCA_SN9C20X_EVDEV=y
-# CONFIG_USB_GSPCA_SONIXB is not set
-# CONFIG_USB_GSPCA_SONIXJ is not set
-# CONFIG_USB_GSPCA_SPCA500 is not set
-# CONFIG_USB_GSPCA_SPCA501 is not set
-# CONFIG_USB_GSPCA_SPCA505 is not set
-# CONFIG_USB_GSPCA_SPCA506 is not set
-# CONFIG_USB_GSPCA_SPCA508 is not set
-# CONFIG_USB_GSPCA_SPCA561 is not set
-# CONFIG_USB_GSPCA_SQ905 is not set
-# CONFIG_USB_GSPCA_SQ905C is not set
-# CONFIG_USB_GSPCA_STK014 is not set
-# CONFIG_USB_GSPCA_STV0680 is not set
-# CONFIG_USB_GSPCA_SUNPLUS is not set
-# CONFIG_USB_GSPCA_T613 is not set
-# CONFIG_USB_GSPCA_TV8532 is not set
-# CONFIG_USB_GSPCA_VC032X is not set
-# CONFIG_USB_GSPCA_ZC3XX is not set
-# CONFIG_USB_HID is not set
-# CONFIG_USB_HIDDEV is not set
-CONFIG_USB_HIDINPUT=y
-# CONFIG_USB_HIDINPUT_POWERBOOK is not set
-# CONFIG_USB_HSO is not set
-# CONFIG_USB_HWA_HCD is not set
-# CONFIG_USB_IBMCAM is not set
-# CONFIG_USB_IDMOUSE is not set
-# CONFIG_USB_IOWARRIOR is not set
-# CONFIG_USB_IP_COMMON is not set
-# CONFIG_USB_ISIGHTFW is not set
-# CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1362_HCD is not set
-# CONFIG_USB_ISP1760_HCD is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_KBTAB is not set
-# CONFIG_USB_KC2190 is not set
-# CONFIG_USB_KEYSPAN_REMOTE is not set
-# CONFIG_USB_KONICAWC is not set
-# CONFIG_USB_LCD is not set
-# CONFIG_USB_LD is not set
-# CONFIG_USB_LED is not set
-# CONFIG_USB_LEGOTOWER is not set
-# CONFIG_USB_LIBUSUAL is not set
-# CONFIG_USB_M5602 is not set
-# CONFIG_USB_MDC800 is not set
-# CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_MON is not set
-# CONFIG_USB_MOUSE is not set
-# CONFIG_USB_MUSB_HDRC is not set
-# CONFIG_USB_NET_AX8817X is not set
-# CONFIG_USB_NET_CDCETHER is not set
-# CONFIG_USB_NET_CDC_EEM is not set
-# CONFIG_USB_NET_CDC_SUBSET is not set
-# CONFIG_USB_NET_DM9601 is not set
-# CONFIG_USB_NET_GL620A is not set
-# CONFIG_USB_NET_INT51X1 is not set
-# CONFIG_USB_NET_MCS7830 is not set
-# CONFIG_USB_NET_NET1080 is not set
-# CONFIG_USB_NET_PLUSB is not set
-# CONFIG_USB_NET_RNDIS_HOST is not set
-# CONFIG_USB_NET_RNDIS_WLAN is not set
-# CONFIG_USB_NET_SMSC95XX is not set
-# CONFIG_USB_NET_ZAURUS is not set
-# CONFIG_USB_OHCI_BIG_ENDIAN is not set
-# CONFIG_USB_OHCI_HCD is not set
-# CONFIG_USB_OHCI_HCD_PCI is not set
-# CONFIG_USB_OHCI_HCD_PPC_OF is not set
-# CONFIG_USB_OHCI_HCD_PPC_SOC is not set
-# CONFIG_USB_OHCI_HCD_SSB is not set
-CONFIG_USB_OHCI_LITTLE_ENDIAN=y
-# CONFIG_USB_OTG is not set
-# CONFIG_USB_OTG_BLACKLIST_HUB is not set
-# CONFIG_USB_OTG_WHITELIST is not set
-# CONFIG_USB_OV511 is not set
-# CONFIG_USB_OXU210HP_HCD is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_PHIDGET is not set
-# CONFIG_USB_POWERMATE is not set
-# CONFIG_USB_PRINTER is not set
-# CONFIG_USB_PWC_INPUT_EVDEV is not set
-# CONFIG_USB_QUICKCAM_MESSENGER is not set
-# CONFIG_USB_R8A66597_HCD is not set
-# CONFIG_USB_RIO500 is not set
-# CONFIG_USB_RTL8150 is not set
-# CONFIG_USB_S2255 is not set
-# CONFIG_USB_SE401 is not set
-# CONFIG_USB_SERIAL is not set
-# CONFIG_USB_SERIAL_AIRCABLE is not set
-# CONFIG_USB_SERIAL_AIRPRIME is not set
-# CONFIG_USB_SERIAL_ARK3116 is not set
-# CONFIG_USB_SERIAL_BELKIN is not set
-# CONFIG_USB_SERIAL_CH341 is not set
-# CONFIG_USB_SERIAL_CP2101 is not set
-# CONFIG_USB_SERIAL_CP210X is not set
-# CONFIG_USB_SERIAL_CYBERJACK is not set
-# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
-# CONFIG_USB_SERIAL_DEBUG is not set
-# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
-# CONFIG_USB_SERIAL_EDGEPORT is not set
-# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
-# CONFIG_USB_SERIAL_EMPEG is not set
-# CONFIG_USB_SERIAL_FTDI_SIO is not set
-# CONFIG_USB_SERIAL_FUNSOFT is not set
-# CONFIG_USB_SERIAL_GARMIN is not set
-CONFIG_USB_SERIAL_GENERIC=y
-# CONFIG_USB_SERIAL_HP4X is not set
-# CONFIG_USB_SERIAL_IPAQ is not set
-# CONFIG_USB_SERIAL_IPW is not set
-# CONFIG_USB_SERIAL_IR is not set
-# CONFIG_USB_SERIAL_IUU is not set
-# CONFIG_USB_SERIAL_KEYSPAN is not set
-CONFIG_USB_SERIAL_KEYSPAN_MPR=y
-# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
-CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
-# CONFIG_USB_SERIAL_KLSI is not set
-# CONFIG_USB_SERIAL_KOBIL_SCT is not set
-# CONFIG_USB_SERIAL_MCT_U232 is not set
-# CONFIG_USB_SERIAL_MOS7720 is not set
-# CONFIG_USB_SERIAL_MOS7840 is not set
-# CONFIG_USB_SERIAL_MOTOROLA is not set
-# CONFIG_USB_SERIAL_NAVMAN is not set
-# CONFIG_USB_SERIAL_OMNINET is not set
-# CONFIG_USB_SERIAL_OPTICON is not set
-# CONFIG_USB_SERIAL_OPTION is not set
-# CONFIG_USB_SERIAL_OTI6858 is not set
-# CONFIG_USB_SERIAL_PL2303 is not set
-# CONFIG_USB_SERIAL_QUALCOMM is not set
-# CONFIG_USB_SERIAL_QUATECH2 is not set
-# CONFIG_USB_SERIAL_QUATECH_USB2 is not set
-# CONFIG_USB_SERIAL_SAFE is not set
-CONFIG_USB_SERIAL_SAFE_PADDED=y
-# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
-# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
-# CONFIG_USB_SERIAL_SPCP8X5 is not set
-# CONFIG_USB_SERIAL_SYMBOL is not set
-# CONFIG_USB_SERIAL_TI is not set
-# CONFIG_USB_SERIAL_VISOR is not set
-# CONFIG_USB_SERIAL_WHITEHEAT is not set
-# CONFIG_USB_SERIAL_XIRCOM is not set
-# CONFIG_USB_SEVSEG is not set
-# CONFIG_USB_SISUSBVGA is not set
-# CONFIG_USB_SL811_HCD is not set
-# CONFIG_USB_SN9C102 is not set
-# CONFIG_USB_SPEEDTOUCH is not set
-# CONFIG_USB_STKWEBCAM is not set
-# CONFIG_USB_STORAGE is not set
-# CONFIG_USB_STORAGE_DEBUG is not set
-CONFIG_USB_STORAGE_DPCM=y
-# CONFIG_USB_STORAGE_ONETOUCH is not set
-# CONFIG_USB_STORAGE_SIERRA is not set
-# CONFIG_USB_STV06XX is not set
-# CONFIG_USB_STV680 is not set
-# CONFIG_USB_SUPPORT is not set
-# CONFIG_USB_SUSPEND is not set
-# CONFIG_USB_TEST is not set
-# CONFIG_USB_TMC is not set
-# CONFIG_USB_TOUCHSCREEN is not set
-# CONFIG_USB_TRANCEVIBRATOR is not set
-# CONFIG_USB_UEAGLEATM is not set
-# CONFIG_USB_ULPI is not set
-# CONFIG_USB_USBNET is not set
-# CONFIG_USB_USBNET_MII is not set
-# CONFIG_USB_VICAM is not set
-# CONFIG_USB_VIDEO_CLASS is not set
-CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
-# CONFIG_USB_VST is not set
-# CONFIG_USB_W9968CF is not set
-# CONFIG_USB_WACOM is not set
-# CONFIG_USB_WDM is not set
-# CONFIG_USB_WHCI_HCD is not set
-# CONFIG_USB_WUSB is not set
-# CONFIG_USB_WUSB_CBAF is not set
-# CONFIG_USB_XHCI_HCD is not set
-# CONFIG_USB_XPAD is not set
-# CONFIG_USB_XUSBATM is not set
-# CONFIG_USB_YEALINK is not set
-# CONFIG_USB_ZC0301 is not set
-# CONFIG_USB_ZD1201 is not set
-# CONFIG_USB_ZR364XX is not set
-# CONFIG_USE_GENERIC_SMP_HELPERS is not set
-# CONFIG_UTS_NS is not set
-# CONFIG_UWB is not set
-# CONFIG_VETH is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_VGASTATE is not set
-# CONFIG_VGA_ARB is not set
-# CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
-# CONFIG_VIDEO_ADV7170 is not set
-# CONFIG_VIDEO_ADV7175 is not set
-# CONFIG_VIDEO_ADV7180 is not set
-# CONFIG_VIDEO_ADV7343 is not set
-# CONFIG_VIDEO_ADV_DEBUG is not set
-# CONFIG_VIDEO_ALLOW_V4L1 is not set
-# CONFIG_VIDEO_BT819 is not set
-# CONFIG_VIDEO_BT848 is not set
-# CONFIG_VIDEO_BT856 is not set
-# CONFIG_VIDEO_BT866 is not set
-# CONFIG_VIDEO_CAFE_CCIC is not set
-# CONFIG_VIDEO_CAPTURE_DRIVERS is not set
-# CONFIG_VIDEO_CPIA is not set
-# CONFIG_VIDEO_CS5345 is not set
-# CONFIG_VIDEO_CS53L32A is not set
-# CONFIG_VIDEO_CX231XX is not set
-# CONFIG_VIDEO_CX2341X is not set
-# CONFIG_VIDEO_CX25840 is not set
-# CONFIG_VIDEO_CX88 is not set
-# CONFIG_VIDEO_DEV is not set
-# CONFIG_VIDEO_DPC is not set
-# CONFIG_VIDEO_EM28XX is not set
-# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
-# CONFIG_VIDEO_GO7007 is not set
-# CONFIG_VIDEO_HDPVR is not set
-# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set
-# CONFIG_VIDEO_HEXIUM_GEMINI is not set
-# CONFIG_VIDEO_HEXIUM_ORION is not set
-# CONFIG_VIDEO_IR_I2C is not set
-# CONFIG_VIDEO_IVTV is not set
-# CONFIG_VIDEO_KS0127 is not set
-# CONFIG_VIDEO_M52790 is not set
-# CONFIG_VIDEO_MEDIA is not set
-# CONFIG_VIDEO_MSP3400 is not set
-# CONFIG_VIDEO_MT9V011 is not set
-# CONFIG_VIDEO_MXB is not set
-# CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_VIDEO_OV7670 is not set
-# CONFIG_VIDEO_OVCAMCHIP is not set
-# CONFIG_VIDEO_PMS is not set
-# CONFIG_VIDEO_PVRUSB2 is not set
-# CONFIG_VIDEO_SAA5246A is not set
-# CONFIG_VIDEO_SAA5249 is not set
-# CONFIG_VIDEO_SAA6588 is not set
-# CONFIG_VIDEO_SAA7110 is not set
-# CONFIG_VIDEO_SAA7111 is not set
-# CONFIG_VIDEO_SAA7114 is not set
-# CONFIG_VIDEO_SAA711X is not set
-# CONFIG_VIDEO_SAA7127 is not set
-# CONFIG_VIDEO_SAA7134 is not set
-# CONFIG_VIDEO_SAA717X is not set
-# CONFIG_VIDEO_SAA7185 is not set
-# CONFIG_VIDEO_SAA7191 is not set
-# CONFIG_VIDEO_SH_MOBILE_CEU is not set
-# CONFIG_VIDEO_STRADIS is not set
-# CONFIG_VIDEO_TCM825X is not set
-# CONFIG_VIDEO_TDA7432 is not set
-# CONFIG_VIDEO_TDA9840 is not set
-# CONFIG_VIDEO_TDA9875 is not set
-# CONFIG_VIDEO_TEA6415C is not set
-# CONFIG_VIDEO_TEA6420 is not set
-# CONFIG_VIDEO_THS7303 is not set
-# CONFIG_VIDEO_TLV320AIC23B is not set
-# CONFIG_VIDEO_TVAUDIO is not set
-# CONFIG_VIDEO_TVP514X is not set
-# CONFIG_VIDEO_TVP5150 is not set
-# CONFIG_VIDEO_UPD64031A is not set
-# CONFIG_VIDEO_UPD64083 is not set
-# CONFIG_VIDEO_USBVISION is not set
-# CONFIG_VIDEO_V4L1 is not set
-CONFIG_VIDEO_V4L1_COMPAT=y
-# CONFIG_VIDEO_V4L2 is not set
-# CONFIG_VIDEO_V4L2_COMMON is not set
-# CONFIG_VIDEO_VIVI is not set
-# CONFIG_VIDEO_VP27SMPX is not set
-# CONFIG_VIDEO_VPX3220 is not set
-# CONFIG_VIDEO_WM8739 is not set
-# CONFIG_VIDEO_WM8775 is not set
-# CONFIG_VIDEO_ZORAN is not set
-# CONFIG_VIRQ_DEBUG is not set
-# CONFIG_VIRTUALIZATION is not set
-CONFIG_VIRT_TO_BUS=y
-# CONFIG_VITESSE_PHY is not set
-CONFIG_VLAN_8021Q=y
-# CONFIG_VLAN_8021Q_GVRP is not set
-# CONFIG_VME_BUS is not set
-# CONFIG_VMSPLIT_1G is not set
-# CONFIG_VMSPLIT_2G is not set
-# CONFIG_VMSPLIT_2G_OPT is not set
-CONFIG_VMSPLIT_3G=y
-# CONFIG_VMSPLIT_3G_OPT is not set
-# CONFIG_VMXNET3 is not set
-# CONFIG_VM_EVENT_COUNTERS is not set
-# CONFIG_VT is not set
-# CONFIG_VT6655 is not set
-# CONFIG_VT6656 is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_W1 is not set
-# CONFIG_W1_CON is not set
-# CONFIG_W1_MASTER_DS1WM is not set
-# CONFIG_W1_MASTER_DS2482 is not set
-# CONFIG_W1_MASTER_DS2490 is not set
-# CONFIG_W1_MASTER_GPIO is not set
-# CONFIG_W1_MASTER_MATROX is not set
-# CONFIG_W1_SLAVE_BQ27000 is not set
-# CONFIG_W1_SLAVE_DS2431 is not set
-# CONFIG_W1_SLAVE_DS2433 is not set
-# CONFIG_W1_SLAVE_DS2760 is not set
-# CONFIG_W1_SLAVE_SMEM is not set
-# CONFIG_W1_SLAVE_THERM is not set
-# CONFIG_W83627HF_WDT is not set
-# CONFIG_W83697HF_WDT is not set
-# CONFIG_W83877F_WDT is not set
-# CONFIG_W83977F_WDT is not set
-# CONFIG_WAN is not set
-# CONFIG_WANXL is not set
-# CONFIG_WAN_ROUTER is not set
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-# CONFIG_WDTPCI is not set
-CONFIG_WEXT_CORE=y
-CONFIG_WEXT_PRIV=y
-CONFIG_WEXT_PROC=y
-CONFIG_WEXT_SPY=y
-# CONFIG_WIMAX is not set
-CONFIG_WIRELESS=y
-CONFIG_WIRELESS_EXT=y
-CONFIG_WIRELESS_EXT_SYSFS=y
-CONFIG_WIRELESS_OLD_REGULATORY=y
-CONFIG_WLAN=y
-CONFIG_WLAN_80211=y
-# CONFIG_WLAN_PRE80211 is not set
-# CONFIG_WORKQUEUE_TRACER is not set
-# CONFIG_WR_PPMC is not set
-# CONFIG_X25 is not set
-CONFIG_XFRM=y
-# CONFIG_XFRM_IPCOMP is not set
-# CONFIG_XFRM_MIGRATE is not set
-# CONFIG_XFRM_STATISTICS is not set
-# CONFIG_XFRM_SUB_POLICY is not set
-# CONFIG_XFRM_USER is not set
-# CONFIG_XFS_DEBUG is not set
-# CONFIG_XFS_FS is not set
-# CONFIG_XFS_POSIX_ACL is not set
-# CONFIG_XFS_QUOTA is not set
-# CONFIG_XFS_RT is not set
-# CONFIG_XFS_SECURITY is not set
-# CONFIG_XILINX_EMACLITE is not set
-# CONFIG_XILINX_LL_TEMAC is not set
-# CONFIG_XIP_KERNEL is not set
-# CONFIG_YAFFS_FS is not set
-# CONFIG_YAM is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_YENTA is not set
-# CONFIG_YENTA_O2 is not set
-# CONFIG_YENTA_RICOH is not set
-# CONFIG_YENTA_TI is not set
-# CONFIG_YENTA_TOSHIBA is not set
-# CONFIG_ZD1211RW is not set
-# CONFIG_ZD1211RW_DEBUG is not set
-# CONFIG_ZEROPLUS_FF is not set
-CONFIG_ZISOFS=y
-# CONFIG_ZISOFS_FS is not set
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZONE_DMA=y
-CONFIG_ZONE_DMA_FLAG=1

+ 0 - 244
target/linux/generic/patches-2.6.33/001-squashfs_move_zlib_decomp.patch

@@ -1,244 +0,0 @@
-From 6c4419d997d4431bb62e73475cd6b084e83efbd1 Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Tue, 22 Sep 2009 19:25:24 +0100
-Subject: [PATCH] Squashfs: move zlib decompression wrapper code into a separate file
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/Makefile       |    2 +-
- fs/squashfs/block.c        |   74 ++----------------------------
- fs/squashfs/squashfs.h     |    4 ++
- fs/squashfs/zlib_wrapper.c |  109 ++++++++++++++++++++++++++++++++++++++++++++
- 4 files changed, 118 insertions(+), 71 deletions(-)
- create mode 100644 fs/squashfs/zlib_wrapper.c
-
---- a/fs/squashfs/Makefile
-+++ b/fs/squashfs/Makefile
-@@ -4,4 +4,4 @@
- 
- obj-$(CONFIG_SQUASHFS) += squashfs.o
- squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
--squashfs-y += namei.o super.o symlink.o
-+squashfs-y += namei.o super.o symlink.o zlib_wrapper.o
---- a/fs/squashfs/block.c
-+++ b/fs/squashfs/block.c
-@@ -29,7 +29,6 @@
- #include <linux/fs.h>
- #include <linux/vfs.h>
- #include <linux/slab.h>
--#include <linux/mutex.h>
- #include <linux/string.h>
- #include <linux/buffer_head.h>
- #include <linux/zlib.h>
-@@ -153,72 +152,10 @@ int squashfs_read_data(struct super_bloc
- 	}
- 
- 	if (compressed) {
--		int zlib_err = 0, zlib_init = 0;
--
--		/*
--		 * Uncompress block.
--		 */
--
--		mutex_lock(&msblk->read_data_mutex);
--
--		msblk->stream.avail_out = 0;
--		msblk->stream.avail_in = 0;
--
--		bytes = length;
--		do {
--			if (msblk->stream.avail_in == 0 && k < b) {
--				avail = min(bytes, msblk->devblksize - offset);
--				bytes -= avail;
--				wait_on_buffer(bh[k]);
--				if (!buffer_uptodate(bh[k]))
--					goto release_mutex;
--
--				if (avail == 0) {
--					offset = 0;
--					put_bh(bh[k++]);
--					continue;
--				}
--
--				msblk->stream.next_in = bh[k]->b_data + offset;
--				msblk->stream.avail_in = avail;
--				offset = 0;
--			}
--
--			if (msblk->stream.avail_out == 0 && page < pages) {
--				msblk->stream.next_out = buffer[page++];
--				msblk->stream.avail_out = PAGE_CACHE_SIZE;
--			}
--
--			if (!zlib_init) {
--				zlib_err = zlib_inflateInit(&msblk->stream);
--				if (zlib_err != Z_OK) {
--					ERROR("zlib_inflateInit returned"
--						" unexpected result 0x%x,"
--						" srclength %d\n", zlib_err,
--						srclength);
--					goto release_mutex;
--				}
--				zlib_init = 1;
--			}
--
--			zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH);
--
--			if (msblk->stream.avail_in == 0 && k < b)
--				put_bh(bh[k++]);
--		} while (zlib_err == Z_OK);
--
--		if (zlib_err != Z_STREAM_END) {
--			ERROR("zlib_inflate error, data probably corrupt\n");
--			goto release_mutex;
--		}
--
--		zlib_err = zlib_inflateEnd(&msblk->stream);
--		if (zlib_err != Z_OK) {
--			ERROR("zlib_inflate error, data probably corrupt\n");
--			goto release_mutex;
--		}
--		length = msblk->stream.total_out;
--		mutex_unlock(&msblk->read_data_mutex);
-+		length = zlib_uncompress(msblk, buffer, bh, b, offset, length,
-+			srclength, pages);
-+		if (length < 0)
-+			goto read_failure;
- 	} else {
- 		/*
- 		 * Block is uncompressed.
-@@ -255,9 +192,6 @@ int squashfs_read_data(struct super_bloc
- 	kfree(bh);
- 	return length;
- 
--release_mutex:
--	mutex_unlock(&msblk->read_data_mutex);
--
- block_release:
- 	for (; k < b; k++)
- 		put_bh(bh[k]);
---- a/fs/squashfs/squashfs.h
-+++ b/fs/squashfs/squashfs.h
-@@ -70,6 +70,10 @@ extern struct inode *squashfs_iget(struc
- 				unsigned int);
- extern int squashfs_read_inode(struct inode *, long long);
- 
-+/* zlib_wrapper.c */
-+extern int zlib_uncompress(struct squashfs_sb_info *, void **,
-+				struct buffer_head **, int, int, int, int, int);
-+
- /*
-  * Inodes and files operations
-  */
---- /dev/null
-+++ b/fs/squashfs/zlib_wrapper.c
-@@ -0,0 +1,109 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-+ * Phillip Lougher <[email protected]>
-+ *
-+ * 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,
-+ * 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ *
-+ * zlib_wrapper.c
-+ */
-+
-+
-+#include <linux/mutex.h>
-+#include <linux/buffer_head.h>
-+#include <linux/zlib.h>
-+
-+#include "squashfs_fs.h"
-+#include "squashfs_fs_sb.h"
-+#include "squashfs_fs_i.h"
-+#include "squashfs.h"
-+
-+int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
-+	struct buffer_head **bh, int b, int offset, int length, int srclength,
-+	int pages)
-+{
-+	int zlib_err = 0, zlib_init = 0;
-+	int avail, bytes, k = 0, page = 0;
-+
-+	mutex_lock(&msblk->read_data_mutex);
-+
-+	msblk->stream.avail_out = 0;
-+	msblk->stream.avail_in = 0;
-+
-+	bytes = length;
-+	do {
-+		if (msblk->stream.avail_in == 0 && k < b) {
-+			avail = min(bytes, msblk->devblksize - offset);
-+			bytes -= avail;
-+			wait_on_buffer(bh[k]);
-+			if (!buffer_uptodate(bh[k]))
-+				goto release_mutex;
-+
-+			if (avail == 0) {
-+				offset = 0;
-+				put_bh(bh[k++]);
-+				continue;
-+			}
-+
-+			msblk->stream.next_in = bh[k]->b_data + offset;
-+			msblk->stream.avail_in = avail;
-+			offset = 0;
-+		}
-+
-+		if (msblk->stream.avail_out == 0 && page < pages) {
-+			msblk->stream.next_out = buffer[page++];
-+			msblk->stream.avail_out = PAGE_CACHE_SIZE;
-+		}
-+
-+		if (!zlib_init) {
-+			zlib_err = zlib_inflateInit(&msblk->stream);
-+			if (zlib_err != Z_OK) {
-+				ERROR("zlib_inflateInit returned unexpected "
-+					"result 0x%x, srclength %d\n",
-+					zlib_err, srclength);
-+				goto release_mutex;
-+			}
-+			zlib_init = 1;
-+		}
-+
-+		zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH);
-+
-+		if (msblk->stream.avail_in == 0 && k < b)
-+			put_bh(bh[k++]);
-+	} while (zlib_err == Z_OK);
-+
-+	if (zlib_err != Z_STREAM_END) {
-+		ERROR("zlib_inflate error, data probably corrupt\n");
-+		goto release_mutex;
-+	}
-+
-+	zlib_err = zlib_inflateEnd(&msblk->stream);
-+	if (zlib_err != Z_OK) {
-+		ERROR("zlib_inflate error, data probably corrupt\n");
-+		goto release_mutex;
-+	}
-+
-+	mutex_unlock(&msblk->read_data_mutex);
-+	return msblk->stream.total_out;
-+
-+release_mutex:
-+	mutex_unlock(&msblk->read_data_mutex);
-+
-+	for (; k < b; k++)
-+		put_bh(bh[k]);
-+
-+	return -EIO;
-+}

+ 0 - 317
target/linux/generic/patches-2.6.33/002-squashfs_factor_out_remaining_zlib.patch

@@ -1,317 +0,0 @@
-From 37c44e85fd49676ec15ccaeea065662c1fbcda7d Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Wed, 23 Sep 2009 19:04:49 +0100
-Subject: [PATCH] Squashfs: Factor out remaining zlib dependencies into separate wrapper file
-
-Move zlib buffer init/destroy code into separate wrapper file.  Also
-make zlib z_stream field a void * removing the need to include zlib.h
-for most files.
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/block.c          |    1 -
- fs/squashfs/cache.c          |    1 -
- fs/squashfs/dir.c            |    1 -
- fs/squashfs/export.c         |    1 -
- fs/squashfs/file.c           |    1 -
- fs/squashfs/fragment.c       |    1 -
- fs/squashfs/id.c             |    1 -
- fs/squashfs/inode.c          |    1 -
- fs/squashfs/namei.c          |    1 -
- fs/squashfs/squashfs.h       |    2 +
- fs/squashfs/squashfs_fs_sb.h |    2 +-
- fs/squashfs/super.c          |   14 +++------
- fs/squashfs/symlink.c        |    1 -
- fs/squashfs/zlib_wrapper.c   |   56 ++++++++++++++++++++++++++++++++---------
- 14 files changed, 51 insertions(+), 33 deletions(-)
-
---- a/fs/squashfs/block.c
-+++ b/fs/squashfs/block.c
-@@ -31,7 +31,6 @@
- #include <linux/slab.h>
- #include <linux/string.h>
- #include <linux/buffer_head.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/cache.c
-+++ b/fs/squashfs/cache.c
-@@ -51,7 +51,6 @@
- #include <linux/sched.h>
- #include <linux/spinlock.h>
- #include <linux/wait.h>
--#include <linux/zlib.h>
- #include <linux/pagemap.h>
- 
- #include "squashfs_fs.h"
---- a/fs/squashfs/dir.c
-+++ b/fs/squashfs/dir.c
-@@ -30,7 +30,6 @@
- #include <linux/fs.h>
- #include <linux/vfs.h>
- #include <linux/slab.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/export.c
-+++ b/fs/squashfs/export.c
-@@ -39,7 +39,6 @@
- #include <linux/vfs.h>
- #include <linux/dcache.h>
- #include <linux/exportfs.h>
--#include <linux/zlib.h>
- #include <linux/slab.h>
- 
- #include "squashfs_fs.h"
---- a/fs/squashfs/file.c
-+++ b/fs/squashfs/file.c
-@@ -47,7 +47,6 @@
- #include <linux/string.h>
- #include <linux/pagemap.h>
- #include <linux/mutex.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/fragment.c
-+++ b/fs/squashfs/fragment.c
-@@ -36,7 +36,6 @@
- #include <linux/fs.h>
- #include <linux/vfs.h>
- #include <linux/slab.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/id.c
-+++ b/fs/squashfs/id.c
-@@ -34,7 +34,6 @@
- #include <linux/fs.h>
- #include <linux/vfs.h>
- #include <linux/slab.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/inode.c
-+++ b/fs/squashfs/inode.c
-@@ -40,7 +40,6 @@
- 
- #include <linux/fs.h>
- #include <linux/vfs.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/namei.c
-+++ b/fs/squashfs/namei.c
-@@ -57,7 +57,6 @@
- #include <linux/slab.h>
- #include <linux/string.h>
- #include <linux/dcache.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/squashfs.h
-+++ b/fs/squashfs/squashfs.h
-@@ -71,6 +71,8 @@ extern struct inode *squashfs_iget(struc
- extern int squashfs_read_inode(struct inode *, long long);
- 
- /* zlib_wrapper.c */
-+extern void *zlib_init(void);
-+extern void zlib_free(void *);
- extern int zlib_uncompress(struct squashfs_sb_info *, void **,
- 				struct buffer_head **, int, int, int, int, int);
- 
---- a/fs/squashfs/squashfs_fs_sb.h
-+++ b/fs/squashfs/squashfs_fs_sb.h
-@@ -64,7 +64,7 @@ struct squashfs_sb_info {
- 	struct mutex		read_data_mutex;
- 	struct mutex		meta_index_mutex;
- 	struct meta_index	*meta_index;
--	z_stream		stream;
-+	void			*stream;
- 	__le64			*inode_lookup_table;
- 	u64			inode_table;
- 	u64			directory_table;
---- a/fs/squashfs/super.c
-+++ b/fs/squashfs/super.c
-@@ -35,7 +35,6 @@
- #include <linux/pagemap.h>
- #include <linux/init.h>
- #include <linux/module.h>
--#include <linux/zlib.h>
- #include <linux/magic.h>
- 
- #include "squashfs_fs.h"
-@@ -87,12 +86,9 @@ static int squashfs_fill_super(struct su
- 	}
- 	msblk = sb->s_fs_info;
- 
--	msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(),
--		GFP_KERNEL);
--	if (msblk->stream.workspace == NULL) {
--		ERROR("Failed to allocate zlib workspace\n");
-+	msblk->stream = zlib_init();
-+	if (msblk->stream == NULL)
- 		goto failure;
--	}
- 
- 	sblk = kzalloc(sizeof(*sblk), GFP_KERNEL);
- 	if (sblk == NULL) {
-@@ -292,17 +288,17 @@ failed_mount:
- 	squashfs_cache_delete(msblk->block_cache);
- 	squashfs_cache_delete(msblk->fragment_cache);
- 	squashfs_cache_delete(msblk->read_page);
-+	zlib_free(msblk->stream);
- 	kfree(msblk->inode_lookup_table);
- 	kfree(msblk->fragment_index);
- 	kfree(msblk->id_table);
--	kfree(msblk->stream.workspace);
- 	kfree(sb->s_fs_info);
- 	sb->s_fs_info = NULL;
- 	kfree(sblk);
- 	return err;
- 
- failure:
--	kfree(msblk->stream.workspace);
-+	zlib_free(msblk->stream);
- 	kfree(sb->s_fs_info);
- 	sb->s_fs_info = NULL;
- 	return -ENOMEM;
-@@ -346,10 +342,10 @@ static void squashfs_put_super(struct su
- 		squashfs_cache_delete(sbi->block_cache);
- 		squashfs_cache_delete(sbi->fragment_cache);
- 		squashfs_cache_delete(sbi->read_page);
-+		zlib_free(sbi->stream);
- 		kfree(sbi->id_table);
- 		kfree(sbi->fragment_index);
- 		kfree(sbi->meta_index);
--		kfree(sbi->stream.workspace);
- 		kfree(sb->s_fs_info);
- 		sb->s_fs_info = NULL;
- 	}
---- a/fs/squashfs/symlink.c
-+++ b/fs/squashfs/symlink.c
-@@ -36,7 +36,6 @@
- #include <linux/slab.h>
- #include <linux/string.h>
- #include <linux/pagemap.h>
--#include <linux/zlib.h>
- 
- #include "squashfs_fs.h"
- #include "squashfs_fs_sb.h"
---- a/fs/squashfs/zlib_wrapper.c
-+++ b/fs/squashfs/zlib_wrapper.c
-@@ -31,21 +31,51 @@
- #include "squashfs_fs_i.h"
- #include "squashfs.h"
- 
-+void *zlib_init()
-+{
-+	z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
-+	if (stream == NULL)
-+		goto failed;
-+	stream->workspace = kmalloc(zlib_inflate_workspacesize(),
-+		GFP_KERNEL);
-+	if (stream->workspace == NULL)
-+		goto failed;
-+
-+	return stream;
-+
-+failed:
-+	ERROR("Failed to allocate zlib workspace\n");
-+	kfree(stream);
-+	return NULL;
-+}
-+
-+
-+void zlib_free(void *strm)
-+{
-+	z_stream *stream = strm;
-+
-+	if (stream)
-+		kfree(stream->workspace);
-+	kfree(stream);
-+}
-+
-+
- int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
- 	struct buffer_head **bh, int b, int offset, int length, int srclength,
- 	int pages)
- {
- 	int zlib_err = 0, zlib_init = 0;
- 	int avail, bytes, k = 0, page = 0;
-+	z_stream *stream = msblk->stream;
- 
- 	mutex_lock(&msblk->read_data_mutex);
- 
--	msblk->stream.avail_out = 0;
--	msblk->stream.avail_in = 0;
-+	stream->avail_out = 0;
-+	stream->avail_in = 0;
- 
- 	bytes = length;
- 	do {
--		if (msblk->stream.avail_in == 0 && k < b) {
-+		if (stream->avail_in == 0 && k < b) {
- 			avail = min(bytes, msblk->devblksize - offset);
- 			bytes -= avail;
- 			wait_on_buffer(bh[k]);
-@@ -58,18 +88,18 @@ int zlib_uncompress(struct squashfs_sb_i
- 				continue;
- 			}
- 
--			msblk->stream.next_in = bh[k]->b_data + offset;
--			msblk->stream.avail_in = avail;
-+			stream->next_in = bh[k]->b_data + offset;
-+			stream->avail_in = avail;
- 			offset = 0;
- 		}
- 
--		if (msblk->stream.avail_out == 0 && page < pages) {
--			msblk->stream.next_out = buffer[page++];
--			msblk->stream.avail_out = PAGE_CACHE_SIZE;
-+		if (stream->avail_out == 0 && page < pages) {
-+			stream->next_out = buffer[page++];
-+			stream->avail_out = PAGE_CACHE_SIZE;
- 		}
- 
- 		if (!zlib_init) {
--			zlib_err = zlib_inflateInit(&msblk->stream);
-+			zlib_err = zlib_inflateInit(stream);
- 			if (zlib_err != Z_OK) {
- 				ERROR("zlib_inflateInit returned unexpected "
- 					"result 0x%x, srclength %d\n",
-@@ -79,9 +109,9 @@ int zlib_uncompress(struct squashfs_sb_i
- 			zlib_init = 1;
- 		}
- 
--		zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH);
-+		zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH);
- 
--		if (msblk->stream.avail_in == 0 && k < b)
-+		if (stream->avail_in == 0 && k < b)
- 			put_bh(bh[k++]);
- 	} while (zlib_err == Z_OK);
- 
-@@ -90,14 +120,14 @@ int zlib_uncompress(struct squashfs_sb_i
- 		goto release_mutex;
- 	}
- 
--	zlib_err = zlib_inflateEnd(&msblk->stream);
-+	zlib_err = zlib_inflateEnd(stream);
- 	if (zlib_err != Z_OK) {
- 		ERROR("zlib_inflate error, data probably corrupt\n");
- 		goto release_mutex;
- 	}
- 
- 	mutex_unlock(&msblk->read_data_mutex);
--	return msblk->stream.total_out;
-+	return stream->total_out;
- 
- release_mutex:
- 	mutex_unlock(&msblk->read_data_mutex);

+ 0 - 426
target/linux/generic/patches-2.6.33/003-squashfs_add_decompressor_framework.patch

@@ -1,426 +0,0 @@
-From 327fbf47a419befc6bff74f3ca42d2b6f0841903 Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Tue, 6 Oct 2009 04:04:15 +0100
-Subject: [PATCH] Squashfs: add a decompressor framework
-
-This adds a decompressor framework which allows multiple compression
-algorithms to be cleanly supported.
-
-Also update zlib wrapper and other code to use the new framework.
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/Makefile         |    2 +-
- fs/squashfs/block.c          |    6 ++--
- fs/squashfs/decompressor.c   |   58 ++++++++++++++++++++++++++++++++++++++++++
- fs/squashfs/decompressor.h   |   55 +++++++++++++++++++++++++++++++++++++++
- fs/squashfs/squashfs.h       |   14 +++++-----
- fs/squashfs/squashfs_fs_sb.h |   41 +++++++++++++++--------------
- fs/squashfs/super.c          |   45 ++++++++++++++++++-------------
- fs/squashfs/zlib_wrapper.c   |   17 ++++++++++--
- 8 files changed, 185 insertions(+), 53 deletions(-)
- create mode 100644 fs/squashfs/decompressor.c
- create mode 100644 fs/squashfs/decompressor.h
-
---- a/fs/squashfs/Makefile
-+++ b/fs/squashfs/Makefile
-@@ -4,4 +4,4 @@
- 
- obj-$(CONFIG_SQUASHFS) += squashfs.o
- squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
--squashfs-y += namei.o super.o symlink.o zlib_wrapper.o
-+squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o
---- a/fs/squashfs/block.c
-+++ b/fs/squashfs/block.c
-@@ -36,7 +36,7 @@
- #include "squashfs_fs_sb.h"
- #include "squashfs_fs_i.h"
- #include "squashfs.h"
--
-+#include "decompressor.h"
- /*
-  * Read the metadata block length, this is stored in the first two
-  * bytes of the metadata block.
-@@ -151,8 +151,8 @@ int squashfs_read_data(struct super_bloc
- 	}
- 
- 	if (compressed) {
--		length = zlib_uncompress(msblk, buffer, bh, b, offset, length,
--			srclength, pages);
-+		length = squashfs_decompress(msblk, buffer, bh, b, offset,
-+			length, srclength, pages);
- 		if (length < 0)
- 			goto read_failure;
- 	} else {
---- /dev/null
-+++ b/fs/squashfs/decompressor.c
-@@ -0,0 +1,58 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-+ * Phillip Lougher <[email protected]>
-+ *
-+ * 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,
-+ * 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ *
-+ * decompressor.c
-+ */
-+
-+#include <linux/types.h>
-+#include <linux/mutex.h>
-+#include <linux/buffer_head.h>
-+
-+#include "squashfs_fs.h"
-+#include "squashfs_fs_sb.h"
-+#include "squashfs_fs_i.h"
-+#include "decompressor.h"
-+#include "squashfs.h"
-+
-+/*
-+ * This file (and decompressor.h) implements a decompressor framework for
-+ * Squashfs, allowing multiple decompressors to be easily supported
-+ */
-+
-+static const struct squashfs_decompressor squashfs_unknown_comp_ops = {
-+	NULL, NULL, NULL, 0, "unknown", 0
-+};
-+
-+static const struct squashfs_decompressor *decompressor[] = {
-+	&squashfs_zlib_comp_ops,
-+	&squashfs_unknown_comp_ops
-+};
-+
-+
-+const struct squashfs_decompressor *squashfs_lookup_decompressor(int id)
-+{
-+	int i;
-+
-+	for (i = 0; decompressor[i]->id; i++)
-+		if (id == decompressor[i]->id)
-+			break;
-+
-+	return decompressor[i];
-+}
---- /dev/null
-+++ b/fs/squashfs/decompressor.h
-@@ -0,0 +1,55 @@
-+#ifndef DECOMPRESSOR_H
-+#define DECOMPRESSOR_H
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-+ * Phillip Lougher <[email protected]>
-+ *
-+ * 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,
-+ * 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ *
-+ * decompressor.h
-+ */
-+
-+struct squashfs_decompressor {
-+	void	*(*init)(void);
-+	void	(*free)(void *);
-+	int	(*decompress)(struct squashfs_sb_info *, void **,
-+		struct buffer_head **, int, int, int, int, int);
-+	int	id;
-+	char	*name;
-+	int	supported;
-+};
-+
-+static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk)
-+{
-+	return msblk->decompressor->init();
-+}
-+
-+static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk,
-+	void *s)
-+{
-+	if (msblk->decompressor)
-+		msblk->decompressor->free(s);
-+}
-+
-+static inline int squashfs_decompress(struct squashfs_sb_info *msblk,
-+	void **buffer, struct buffer_head **bh, int b, int offset, int length,
-+	int srclength, int pages)
-+{
-+	return msblk->decompressor->decompress(msblk, buffer, bh, b, offset,
-+		length, srclength, pages);
-+}
-+#endif
---- a/fs/squashfs/squashfs.h
-+++ b/fs/squashfs/squashfs.h
-@@ -51,6 +51,9 @@ extern struct squashfs_cache_entry *squa
- 				u64, int);
- extern int squashfs_read_table(struct super_block *, void *, u64, int);
- 
-+/* decompressor.c */
-+extern const struct squashfs_decompressor *squashfs_lookup_decompressor(int);
-+
- /* export.c */
- extern __le64 *squashfs_read_inode_lookup_table(struct super_block *, u64,
- 				unsigned int);
-@@ -70,14 +73,8 @@ extern struct inode *squashfs_iget(struc
- 				unsigned int);
- extern int squashfs_read_inode(struct inode *, long long);
- 
--/* zlib_wrapper.c */
--extern void *zlib_init(void);
--extern void zlib_free(void *);
--extern int zlib_uncompress(struct squashfs_sb_info *, void **,
--				struct buffer_head **, int, int, int, int, int);
--
- /*
-- * Inodes and files operations
-+ * Inodes, files and decompressor operations
-  */
- 
- /* dir.c */
-@@ -94,3 +91,6 @@ extern const struct inode_operations squ
- 
- /* symlink.c */
- extern const struct address_space_operations squashfs_symlink_aops;
-+
-+/* zlib_wrapper.c */
-+extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
---- a/fs/squashfs/squashfs_fs_sb.h
-+++ b/fs/squashfs/squashfs_fs_sb.h
-@@ -52,25 +52,26 @@ struct squashfs_cache_entry {
- };
- 
- struct squashfs_sb_info {
--	int			devblksize;
--	int			devblksize_log2;
--	struct squashfs_cache	*block_cache;
--	struct squashfs_cache	*fragment_cache;
--	struct squashfs_cache	*read_page;
--	int			next_meta_index;
--	__le64			*id_table;
--	__le64			*fragment_index;
--	unsigned int		*fragment_index_2;
--	struct mutex		read_data_mutex;
--	struct mutex		meta_index_mutex;
--	struct meta_index	*meta_index;
--	void			*stream;
--	__le64			*inode_lookup_table;
--	u64			inode_table;
--	u64			directory_table;
--	unsigned int		block_size;
--	unsigned short		block_log;
--	long long		bytes_used;
--	unsigned int		inodes;
-+	const struct squashfs_decompressor	*decompressor;
-+	int					devblksize;
-+	int					devblksize_log2;
-+	struct squashfs_cache			*block_cache;
-+	struct squashfs_cache			*fragment_cache;
-+	struct squashfs_cache			*read_page;
-+	int					next_meta_index;
-+	__le64					*id_table;
-+	__le64					*fragment_index;
-+	unsigned int				*fragment_index_2;
-+	struct mutex				read_data_mutex;
-+	struct mutex				meta_index_mutex;
-+	struct meta_index			*meta_index;
-+	void					*stream;
-+	__le64					*inode_lookup_table;
-+	u64					inode_table;
-+	u64					directory_table;
-+	unsigned int				block_size;
-+	unsigned short				block_log;
-+	long long				bytes_used;
-+	unsigned int				inodes;
- };
- #endif
---- a/fs/squashfs/super.c
-+++ b/fs/squashfs/super.c
-@@ -41,27 +41,35 @@
- #include "squashfs_fs_sb.h"
- #include "squashfs_fs_i.h"
- #include "squashfs.h"
-+#include "decompressor.h"
- 
- static struct file_system_type squashfs_fs_type;
- static const struct super_operations squashfs_super_ops;
- 
--static int supported_squashfs_filesystem(short major, short minor, short comp)
-+static const struct squashfs_decompressor *supported_squashfs_filesystem(short
-+	major, short minor, short id)
- {
-+	const struct squashfs_decompressor *decompressor;
-+
- 	if (major < SQUASHFS_MAJOR) {
- 		ERROR("Major/Minor mismatch, older Squashfs %d.%d "
- 			"filesystems are unsupported\n", major, minor);
--		return -EINVAL;
-+		return NULL;
- 	} else if (major > SQUASHFS_MAJOR || minor > SQUASHFS_MINOR) {
- 		ERROR("Major/Minor mismatch, trying to mount newer "
- 			"%d.%d filesystem\n", major, minor);
- 		ERROR("Please update your kernel\n");
--		return -EINVAL;
-+		return NULL;
- 	}
- 
--	if (comp != ZLIB_COMPRESSION)
--		return -EINVAL;
-+	decompressor = squashfs_lookup_decompressor(id);
-+	if (!decompressor->supported) {
-+		ERROR("Filesystem uses \"%s\" compression. This is not "
-+			"supported\n", decompressor->name);
-+		return NULL;
-+	}
- 
--	return 0;
-+	return decompressor;
- }
- 
- 
-@@ -86,10 +94,6 @@ static int squashfs_fill_super(struct su
- 	}
- 	msblk = sb->s_fs_info;
- 
--	msblk->stream = zlib_init();
--	if (msblk->stream == NULL)
--		goto failure;
--
- 	sblk = kzalloc(sizeof(*sblk), GFP_KERNEL);
- 	if (sblk == NULL) {
- 		ERROR("Failed to allocate squashfs_super_block\n");
-@@ -116,25 +120,25 @@ static int squashfs_fill_super(struct su
- 		goto failed_mount;
- 	}
- 
-+	err = -EINVAL;
-+
- 	/* Check it is a SQUASHFS superblock */
- 	sb->s_magic = le32_to_cpu(sblk->s_magic);
- 	if (sb->s_magic != SQUASHFS_MAGIC) {
- 		if (!silent)
- 			ERROR("Can't find a SQUASHFS superblock on %s\n",
- 						bdevname(sb->s_bdev, b));
--		err = -EINVAL;
- 		goto failed_mount;
- 	}
- 
--	/* Check the MAJOR & MINOR versions and compression type */
--	err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major),
-+	/* Check the MAJOR & MINOR versions and lookup compression type */
-+	msblk->decompressor = supported_squashfs_filesystem(
-+			le16_to_cpu(sblk->s_major),
- 			le16_to_cpu(sblk->s_minor),
- 			le16_to_cpu(sblk->compression));
--	if (err < 0)
-+	if (msblk->decompressor == NULL)
- 		goto failed_mount;
- 
--	err = -EINVAL;
--
- 	/*
- 	 * Check if there's xattrs in the filesystem.  These are not
- 	 * supported in this version, so warn that they will be ignored.
-@@ -201,6 +205,10 @@ static int squashfs_fill_super(struct su
- 
- 	err = -ENOMEM;
- 
-+	msblk->stream = squashfs_decompressor_init(msblk);
-+	if (msblk->stream == NULL)
-+		goto failed_mount;
-+
- 	msblk->block_cache = squashfs_cache_init("metadata",
- 			SQUASHFS_CACHED_BLKS, SQUASHFS_METADATA_SIZE);
- 	if (msblk->block_cache == NULL)
-@@ -288,7 +296,7 @@ failed_mount:
- 	squashfs_cache_delete(msblk->block_cache);
- 	squashfs_cache_delete(msblk->fragment_cache);
- 	squashfs_cache_delete(msblk->read_page);
--	zlib_free(msblk->stream);
-+	squashfs_decompressor_free(msblk, msblk->stream);
- 	kfree(msblk->inode_lookup_table);
- 	kfree(msblk->fragment_index);
- 	kfree(msblk->id_table);
-@@ -298,7 +306,6 @@ failed_mount:
- 	return err;
- 
- failure:
--	zlib_free(msblk->stream);
- 	kfree(sb->s_fs_info);
- 	sb->s_fs_info = NULL;
- 	return -ENOMEM;
-@@ -342,7 +349,7 @@ static void squashfs_put_super(struct su
- 		squashfs_cache_delete(sbi->block_cache);
- 		squashfs_cache_delete(sbi->fragment_cache);
- 		squashfs_cache_delete(sbi->read_page);
--		zlib_free(sbi->stream);
-+		squashfs_decompressor_free(sbi, sbi->stream);
- 		kfree(sbi->id_table);
- 		kfree(sbi->fragment_index);
- 		kfree(sbi->meta_index);
---- a/fs/squashfs/zlib_wrapper.c
-+++ b/fs/squashfs/zlib_wrapper.c
-@@ -30,8 +30,9 @@
- #include "squashfs_fs_sb.h"
- #include "squashfs_fs_i.h"
- #include "squashfs.h"
-+#include "decompressor.h"
- 
--void *zlib_init()
-+static void *zlib_init(void)
- {
- 	z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
- 	if (stream == NULL)
-@@ -50,7 +51,7 @@ failed:
- }
- 
- 
--void zlib_free(void *strm)
-+static void zlib_free(void *strm)
- {
- 	z_stream *stream = strm;
- 
-@@ -60,7 +61,7 @@ void zlib_free(void *strm)
- }
- 
- 
--int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
-+static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
- 	struct buffer_head **bh, int b, int offset, int length, int srclength,
- 	int pages)
- {
-@@ -137,3 +138,13 @@ release_mutex:
- 
- 	return -EIO;
- }
-+
-+const struct squashfs_decompressor squashfs_zlib_comp_ops = {
-+	.init = zlib_init,
-+	.free = zlib_free,
-+	.decompress = zlib_uncompress,
-+	.id = ZLIB_COMPRESSION,
-+	.name = "zlib",
-+	.supported = 1
-+};
-+

+ 0 - 54
target/linux/generic/patches-2.6.33/004-squashfs_add_decompressor_lzma_lzo.patch

@@ -1,54 +0,0 @@
-From 1885ca0a1973944684f252094a703b7c80dfc974 Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Wed, 14 Oct 2009 03:58:11 +0100
-Subject: [PATCH] Squashfs: add decompressor entries for lzma and lzo
-
-Add knowledge of lzma/lzo compression formats to the decompressor
-framework.  For now these are added as unsupported.  Without
-these entries lzma/lzo compressed filesystems will be flagged as
-having unknown compression which is undesirable.
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/decompressor.c |   10 ++++++++++
- fs/squashfs/squashfs_fs.h  |    4 +++-
- 2 files changed, 13 insertions(+), 1 deletions(-)
-
---- a/fs/squashfs/decompressor.c
-+++ b/fs/squashfs/decompressor.c
-@@ -36,12 +36,22 @@
-  * Squashfs, allowing multiple decompressors to be easily supported
-  */
- 
-+static const struct squashfs_decompressor squashfs_lzma_unsupported_comp_ops = {
-+	NULL, NULL, NULL, LZMA_COMPRESSION, "lzma", 0
-+};
-+
-+static const struct squashfs_decompressor squashfs_lzo_unsupported_comp_ops = {
-+	NULL, NULL, NULL, LZO_COMPRESSION, "lzo", 0
-+};
-+
- static const struct squashfs_decompressor squashfs_unknown_comp_ops = {
- 	NULL, NULL, NULL, 0, "unknown", 0
- };
- 
- static const struct squashfs_decompressor *decompressor[] = {
- 	&squashfs_zlib_comp_ops,
-+	&squashfs_lzma_unsupported_comp_ops,
-+	&squashfs_lzo_unsupported_comp_ops,
- 	&squashfs_unknown_comp_ops
- };
- 
---- a/fs/squashfs/squashfs_fs.h
-+++ b/fs/squashfs/squashfs_fs.h
-@@ -211,7 +211,9 @@ struct meta_index {
- /*
-  * definitions for structures on disk
-  */
--#define ZLIB_COMPRESSION	 1
-+#define ZLIB_COMPRESSION	1
-+#define LZMA_COMPRESSION	2
-+#define LZO_COMPRESSION		3
- 
- struct squashfs_super_block {
- 	__le32			s_magic;

+ 0 - 42
target/linux/generic/patches-2.6.33/005-squashfs_extra_parameter.patch

@@ -1,42 +0,0 @@
-From 5f393ede3ddb5dd4cc2a9f243182fac45f1ce10b Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Wed, 14 Oct 2009 04:07:54 +0100
-Subject: [PATCH] Squashfs: add an extra parameter to the decompressor init function
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/decompressor.h |    4 ++--
- fs/squashfs/zlib_wrapper.c |    2 +-
- 2 files changed, 3 insertions(+), 3 deletions(-)
-
---- a/fs/squashfs/decompressor.h
-+++ b/fs/squashfs/decompressor.h
-@@ -24,7 +24,7 @@
-  */
- 
- struct squashfs_decompressor {
--	void	*(*init)(void);
-+	void	*(*init)(struct squashfs_sb_info *);
- 	void	(*free)(void *);
- 	int	(*decompress)(struct squashfs_sb_info *, void **,
- 		struct buffer_head **, int, int, int, int, int);
-@@ -35,7 +35,7 @@ struct squashfs_decompressor {
- 
- static inline void *squashfs_decompressor_init(struct squashfs_sb_info *msblk)
- {
--	return msblk->decompressor->init();
-+	return msblk->decompressor->init(msblk);
- }
- 
- static inline void squashfs_decompressor_free(struct squashfs_sb_info *msblk,
---- a/fs/squashfs/zlib_wrapper.c
-+++ b/fs/squashfs/zlib_wrapper.c
-@@ -32,7 +32,7 @@
- #include "squashfs.h"
- #include "decompressor.h"
- 
--static void *zlib_init(void)
-+static void *zlib_init(struct squashfs_sb_info *dummy)
- {
- 	z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
- 	if (stream == NULL)

+ 0 - 216
target/linux/generic/patches-2.6.33/006-squashfs_add_lzma.patch

@@ -1,216 +0,0 @@
-From f49e1efdd179d54e814ff2a8e8f469496583062c Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Tue, 20 Oct 2009 10:54:36 +0100
-Subject: [PATCH] Squashfs: add LZMA compression
-
-Add support for LZMA compressed filesystems.  This is an initial
-implementation.
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/Kconfig        |    5 ++
- fs/squashfs/Makefile       |    1 +
- fs/squashfs/decompressor.c |    4 +
- fs/squashfs/lzma_wrapper.c |  151 ++++++++++++++++++++++++++++++++++++++++++++
- fs/squashfs/squashfs.h     |    3 +
- 5 files changed, 164 insertions(+), 0 deletions(-)
- create mode 100644 fs/squashfs/lzma_wrapper.c
-
---- a/fs/squashfs/Kconfig
-+++ b/fs/squashfs/Kconfig
-@@ -26,6 +26,11 @@ config SQUASHFS
- 
- 	  If unsure, say N.
- 
-+config SQUASHFS_LZMA
-+	bool "Include support for LZMA compressed file systems"
-+	depends on SQUASHFS
-+	select DECOMPRESS_LZMA
-+
- config SQUASHFS_EMBEDDED
- 
- 	bool "Additional option for memory-constrained systems" 
---- a/fs/squashfs/Makefile
-+++ b/fs/squashfs/Makefile
-@@ -5,3 +5,4 @@
- obj-$(CONFIG_SQUASHFS) += squashfs.o
- squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
- squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o
-+squashfs-$(CONFIG_SQUASHFS_LZMA) += lzma_wrapper.o
---- a/fs/squashfs/decompressor.c
-+++ b/fs/squashfs/decompressor.c
-@@ -50,7 +50,11 @@ static const struct squashfs_decompresso
- 
- static const struct squashfs_decompressor *decompressor[] = {
- 	&squashfs_zlib_comp_ops,
-+#ifdef CONFIG_SQUASHFS_LZMA
-+	&squashfs_lzma_comp_ops,
-+#else
- 	&squashfs_lzma_unsupported_comp_ops,
-+#endif
- 	&squashfs_lzo_unsupported_comp_ops,
- 	&squashfs_unknown_comp_ops
- };
---- /dev/null
-+++ b/fs/squashfs/lzma_wrapper.c
-@@ -0,0 +1,151 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-+ * Phillip Lougher <[email protected]>
-+ *
-+ * 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,
-+ * 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-+ *
-+ * lzma_wrapper.c
-+ */
-+
-+#include <asm/unaligned.h>
-+#include <linux/buffer_head.h>
-+#include <linux/mutex.h>
-+#include <linux/vmalloc.h>
-+#include <linux/decompress/unlzma.h>
-+
-+#include "squashfs_fs.h"
-+#include "squashfs_fs_sb.h"
-+#include "squashfs_fs_i.h"
-+#include "squashfs.h"
-+#include "decompressor.h"
-+
-+struct squashfs_lzma {
-+	void	*input;
-+	void	*output;
-+};
-+
-+/* decompress_unlzma.c is currently non re-entrant... */
-+DEFINE_MUTEX(lzma_mutex);
-+
-+/* decompress_unlzma.c doesn't provide any context in its callbacks... */
-+static int lzma_error;
-+
-+static void error(char *m)
-+{
-+	ERROR("unlzma error: %s\n", m);
-+	lzma_error = 1;
-+}
-+
-+	
-+static void *lzma_init(struct squashfs_sb_info *msblk)
-+{
-+	struct squashfs_lzma *stream = kzalloc(sizeof(*stream), GFP_KERNEL);
-+	if (stream == NULL)
-+		goto failed;
-+	stream->input = vmalloc(msblk->block_size);
-+	if (stream->input == NULL)
-+		goto failed;
-+	stream->output = vmalloc(msblk->block_size);
-+	if (stream->output == NULL)
-+		goto failed2;
-+
-+	return stream;
-+
-+failed2:
-+	vfree(stream->input);
-+failed:
-+	ERROR("failed to allocate lzma workspace\n");
-+	kfree(stream);
-+	return NULL;
-+}
-+
-+
-+static void lzma_free(void *strm)
-+{
-+	struct squashfs_lzma *stream = strm;
-+
-+	if (stream) {
-+		vfree(stream->input);
-+		vfree(stream->output);
-+	}
-+	kfree(stream);
-+}
-+
-+
-+static int lzma_uncompress(struct squashfs_sb_info *msblk, void **buffer,
-+	struct buffer_head **bh, int b, int offset, int length, int srclength,
-+	int pages)
-+{
-+	struct squashfs_lzma *stream = msblk->stream;
-+	void *buff = stream->input;
-+	int avail, i, bytes = length, res;
-+
-+	mutex_lock(&lzma_mutex);
-+
-+	for (i = 0; i < b; i++) {
-+		wait_on_buffer(bh[i]);
-+		if (!buffer_uptodate(bh[i]))
-+			goto block_release;
-+
-+		avail = min(bytes, msblk->devblksize - offset);
-+		memcpy(buff, bh[i]->b_data + offset, avail);
-+		buff += avail;
-+		bytes -= avail;
-+		offset = 0;
-+		put_bh(bh[i]);
-+	}
-+
-+	lzma_error = 0;
-+	res = unlzma(stream->input, length, NULL, NULL, stream->output, NULL,
-+							error);
-+	if (res || lzma_error)
-+		goto failed;
-+
-+	/* uncompressed size is stored in the LZMA header (5 byte offset) */
-+	res = bytes = get_unaligned_le32(stream->input + 5);
-+	for (i = 0, buff = stream->output; bytes && i < pages; i++) {
-+		avail = min_t(int, bytes, PAGE_CACHE_SIZE);
-+		memcpy(buffer[i], buff, avail);
-+		buff += avail;
-+		bytes -= avail;
-+	}
-+	if (bytes)
-+		goto failed;
-+
-+	mutex_unlock(&lzma_mutex);
-+	return res;
-+
-+block_release:
-+	for (; i < b; i++)
-+		put_bh(bh[i]);
-+
-+failed:
-+	mutex_unlock(&lzma_mutex);
-+
-+	ERROR("lzma decompression failed, data probably corrupt\n");
-+	return -EIO;
-+}
-+
-+const struct squashfs_decompressor squashfs_lzma_comp_ops = {
-+	.init = lzma_init,
-+	.free = lzma_free,
-+	.decompress = lzma_uncompress,
-+	.id = LZMA_COMPRESSION,
-+	.name = "lzma",
-+	.supported = 1
-+};
-+
---- a/fs/squashfs/squashfs.h
-+++ b/fs/squashfs/squashfs.h
-@@ -94,3 +94,6 @@ extern const struct address_space_operat
- 
- /* zlib_wrapper.c */
- extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
-+
-+/* lzma wrapper.c */
-+extern const struct squashfs_decompressor squashfs_lzma_comp_ops;

+ 0 - 165
target/linux/generic/patches-2.6.33/007-squashfs_make_lzma_available.patch

@@ -1,165 +0,0 @@
-From fdf23ed283bc6ef5c25076ce2065f892120ff556 Mon Sep 17 00:00:00 2001
-From: Phillip Lougher <[email protected]>
-Date: Thu, 22 Oct 2009 04:57:38 +0100
-Subject: [PATCH] Squashfs: Make unlzma available to non initramfs/initrd code
-
-Add a config option DECOMPRESS_LZMA_NEEDED which allows subsystems to
-specify they need the unlzma code.  Normally decompress_unlzma.c is
-compiled with __init and unlzma is not exported to modules.
-
-Signed-off-by: Phillip Lougher <[email protected]>
----
- fs/squashfs/Kconfig                   |    1 +
- include/linux/decompress/bunzip2_mm.h |   12 ++++++++++++
- include/linux/decompress/inflate_mm.h |   12 ++++++++++++
- include/linux/decompress/mm.h         |    3 ---
- include/linux/decompress/unlzma_mm.h  |   20 ++++++++++++++++++++
- lib/Kconfig                           |    3 +++
- lib/decompress_bunzip2.c              |    1 +
- lib/decompress_inflate.c              |    1 +
- lib/decompress_unlzma.c               |    5 ++++-
- 9 files changed, 54 insertions(+), 4 deletions(-)
- create mode 100644 include/linux/decompress/bunzip2_mm.h
- create mode 100644 include/linux/decompress/inflate_mm.h
- create mode 100644 include/linux/decompress/unlzma_mm.h
-
---- a/fs/squashfs/Kconfig
-+++ b/fs/squashfs/Kconfig
-@@ -30,6 +30,7 @@ config SQUASHFS_LZMA
- 	bool "Include support for LZMA compressed file systems"
- 	depends on SQUASHFS
- 	select DECOMPRESS_LZMA
-+	select DECOMPRESS_LZMA_NEEDED
- 
- config SQUASHFS_EMBEDDED
- 
---- /dev/null
-+++ b/include/linux/decompress/bunzip2_mm.h
-@@ -0,0 +1,12 @@
-+#ifndef BUNZIP2_MM_H
-+#define BUNZIP2_MM_H
-+
-+#ifdef STATIC
-+/* Code active when included from pre-boot environment: */
-+#define INIT
-+#else
-+/* Compile for initramfs/initrd code only */
-+#define INIT __init
-+#endif
-+
-+#endif
---- /dev/null
-+++ b/include/linux/decompress/inflate_mm.h
-@@ -0,0 +1,12 @@
-+#ifndef INFLATE_MM_H
-+#define INFLATE_MM_H
-+
-+#ifdef STATIC
-+/* Code active when included from pre-boot environment: */
-+#define INIT
-+#else
-+/* Compile for initramfs/initrd code only */
-+#define INIT __init
-+#endif
-+
-+#endif
---- a/include/linux/decompress/mm.h
-+++ b/include/linux/decompress/mm.h
-@@ -63,8 +63,6 @@ static void free(void *where)
- 
- #define set_error_fn(x)
- 
--#define INIT
--
- #else /* STATIC */
- 
- /* Code active when compiled standalone for use when loading ramdisk: */
-@@ -87,7 +85,6 @@ static void free(void *where)
- static void(*error)(char *m);
- #define set_error_fn(x) error = x;
- 
--#define INIT __init
- #define STATIC
- 
- #include <linux/init.h>
---- /dev/null
-+++ b/include/linux/decompress/unlzma_mm.h
-@@ -0,0 +1,20 @@
-+#ifndef UNLZMA_MM_H
-+#define UNLZMA_MM_H
-+
-+#ifdef STATIC
-+
-+/* Code active when included from pre-boot environment: */
-+#define INIT
-+
-+#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED)
-+
-+/* Make it available to non initramfs/initrd code */
-+#define INIT
-+#include <linux/module.h>
-+#else
-+
-+/* Compile for initramfs/initrd code only */
-+#define INIT __init
-+#endif
-+
-+#endif
---- a/lib/Kconfig
-+++ b/lib/Kconfig
-@@ -121,6 +121,9 @@ config DECOMPRESS_LZO
- 	select LZO_DECOMPRESS
- 	tristate
- 
-+config DECOMPRESS_LZMA_NEEDED
-+	 boolean
-+
- #
- # Generic allocator support is selected if needed
- #
---- a/lib/decompress_bunzip2.c
-+++ b/lib/decompress_bunzip2.c
-@@ -52,6 +52,7 @@
- #include <linux/slab.h>
- #endif /* STATIC */
- 
-+#include <linux/decompress/bunzip2_mm.h>
- #include <linux/decompress/mm.h>
- 
- #ifndef INT_MAX
---- a/lib/decompress_inflate.c
-+++ b/lib/decompress_inflate.c
-@@ -23,6 +23,7 @@
- 
- #endif /* STATIC */
- 
-+#include <linux/decompress/inflate_mm.h>
- #include <linux/decompress/mm.h>
- 
- #define GZIP_IOBUF_SIZE (16*1024)
---- a/lib/decompress_unlzma.c
-+++ b/lib/decompress_unlzma.c
-@@ -36,6 +36,7 @@
- #include <linux/slab.h>
- #endif /* STATIC */
- 
-+#include <linux/decompress/unlzma_mm.h>
- #include <linux/decompress/mm.h>
- 
- #define	MIN(a, b) (((a) < (b)) ? (a) : (b))
-@@ -531,7 +532,7 @@ static inline void INIT process_bit1(str
- 
- 
- 
--STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
-+STATIC int INIT unlzma(unsigned char *buf, int in_len,
- 			      int(*fill)(void*, unsigned int),
- 			      int(*flush)(void*, unsigned int),
- 			      unsigned char *output,
-@@ -664,4 +665,6 @@ STATIC int INIT decompress(unsigned char
- {
- 	return unlzma(buf, in_len - 4, fill, flush, output, posp, error_fn);
- }
-+#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED)
-+EXPORT_SYMBOL(unlzma);
- #endif

+ 0 - 5142
target/linux/generic/patches-2.6.33/008-jffs2_make_lzma_available.patch

@@ -1,5142 +0,0 @@
---- a/fs/jffs2/Kconfig
-+++ b/fs/jffs2/Kconfig
-@@ -139,6 +139,15 @@ config JFFS2_LZO
- 	  This feature was added in July, 2007. Say 'N' if you need
- 	  compatibility with older bootloaders or kernels.
- 
-+config JFFS2_LZMA
-+	bool "JFFS2 LZMA compression support" if JFFS2_COMPRESSION_OPTIONS
-+	select LZMA_COMPRESS
-+	select LZMA_DECOMPRESS
-+	depends on JFFS2_FS
-+	default n
-+	help
-+	  JFFS2 wrapper to the LZMA C SDK
-+
- config JFFS2_RTIME
- 	bool "JFFS2 RTIME compression support" if JFFS2_COMPRESSION_OPTIONS
- 	depends on JFFS2_FS
---- a/fs/jffs2/Makefile
-+++ b/fs/jffs2/Makefile
-@@ -18,4 +18,7 @@ jffs2-$(CONFIG_JFFS2_RUBIN)	+= compr_rub
- jffs2-$(CONFIG_JFFS2_RTIME)	+= compr_rtime.o
- jffs2-$(CONFIG_JFFS2_ZLIB)	+= compr_zlib.o
- jffs2-$(CONFIG_JFFS2_LZO)	+= compr_lzo.o
-+jffs2-$(CONFIG_JFFS2_LZMA)      += compr_lzma.o
- jffs2-$(CONFIG_JFFS2_SUMMARY)   += summary.o
-+
-+CFLAGS_compr_lzma.o += -Iinclude/linux -Ilib/lzma
---- a/fs/jffs2/compr.c
-+++ b/fs/jffs2/compr.c
-@@ -319,6 +319,9 @@ int __init jffs2_compressors_init(void)
- #ifdef CONFIG_JFFS2_LZO
- 	jffs2_lzo_init();
- #endif
-+#ifdef CONFIG_JFFS2_LZMA
-+        jffs2_lzma_init();
-+#endif
- /* Setting default compression mode */
- #ifdef CONFIG_JFFS2_CMODE_NONE
- 	jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
-@@ -342,6 +345,9 @@ int __init jffs2_compressors_init(void)
- int jffs2_compressors_exit(void)
- {
- /* Unregistering compressors */
-+#ifdef CONFIG_JFFS2_LZMA
-+        jffs2_lzma_exit();
-+#endif
- #ifdef CONFIG_JFFS2_LZO
- 	jffs2_lzo_exit();
- #endif
---- a/fs/jffs2/compr.h
-+++ b/fs/jffs2/compr.h
-@@ -28,9 +28,9 @@
- #define JFFS2_DYNRUBIN_PRIORITY  20
- #define JFFS2_LZARI_PRIORITY     30
- #define JFFS2_RTIME_PRIORITY     50
--#define JFFS2_ZLIB_PRIORITY      60
--#define JFFS2_LZO_PRIORITY       80
--
-+#define JFFS2_LZMA_PRIORITY      70
-+#define JFFS2_ZLIB_PRIORITY      80
-+#define JFFS2_LZO_PRIORITY       90
- 
- #define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */
- #define JFFS2_DYNRUBIN_DISABLED  /*	   for decompression */
-@@ -98,5 +98,9 @@ void jffs2_zlib_exit(void);
- int jffs2_lzo_init(void);
- void jffs2_lzo_exit(void);
- #endif
-+#ifdef CONFIG_JFFS2_LZMA
-+int jffs2_lzma_init(void);
-+void jffs2_lzma_exit(void);
-+#endif
- 
- #endif /* __JFFS2_COMPR_H__ */
---- /dev/null
-+++ b/fs/jffs2/compr_lzma.c
-@@ -0,0 +1,128 @@
-+/*
-+ * JFFS2 -- Journalling Flash File System, Version 2.
-+ *
-+ * For licensing information, see the file 'LICENCE' in this directory.
-+ *
-+ * JFFS2 wrapper to the LZMA C SDK
-+ *
-+ */
-+
-+#include <linux/lzma.h>
-+#include "compr.h"
-+
-+#ifdef __KERNEL__
-+	static DEFINE_MUTEX(deflate_mutex);
-+#endif
-+
-+CLzmaEncHandle *p;
-+Byte propsEncoded[LZMA_PROPS_SIZE];
-+SizeT propsSize = sizeof(propsEncoded);
-+
-+STATIC void lzma_free_workspace(void)
-+{
-+	LzmaEnc_Destroy(p, &lzma_alloc, &lzma_alloc);
-+}
-+
-+STATIC int INIT lzma_alloc_workspace(CLzmaEncProps *props)
-+{
-+	if ((p = (CLzmaEncHandle *)LzmaEnc_Create(&lzma_alloc)) == NULL)
-+	{
-+		PRINT_ERROR("Failed to allocate lzma deflate workspace\n");
-+		return -ENOMEM;
-+	}
-+
-+	if (LzmaEnc_SetProps(p, props) != SZ_OK)
-+	{
-+		lzma_free_workspace();
-+		return -1;
-+	}
-+	
-+	if (LzmaEnc_WriteProperties(p, propsEncoded, &propsSize) != SZ_OK)
-+	{
-+		lzma_free_workspace();
-+		return -1;
-+	}
-+
-+        return 0;
-+}
-+
-+STATIC int jffs2_lzma_compress(unsigned char *data_in, unsigned char *cpage_out,
-+			      uint32_t *sourcelen, uint32_t *dstlen, void *model)
-+{
-+	SizeT compress_size = (SizeT)(*dstlen);
-+	int ret;
-+
-+	#ifdef __KERNEL__
-+		mutex_lock(&deflate_mutex);
-+	#endif
-+
-+	ret = LzmaEnc_MemEncode(p, cpage_out, &compress_size, data_in, *sourcelen,
-+		0, NULL, &lzma_alloc, &lzma_alloc);
-+
-+	#ifdef __KERNEL__
-+		mutex_unlock(&deflate_mutex);
-+	#endif
-+
-+	if (ret != SZ_OK)
-+		return -1;
-+
-+	*dstlen = (uint32_t)compress_size;
-+
-+	return 0;
-+}
-+
-+STATIC int jffs2_lzma_decompress(unsigned char *data_in, unsigned char *cpage_out,
-+				 uint32_t srclen, uint32_t destlen, void *model)
-+{
-+	int ret;
-+	SizeT dl = (SizeT)destlen;
-+	SizeT sl = (SizeT)srclen;
-+	ELzmaStatus status;
-+	
-+	ret = LzmaDecode(cpage_out, &dl, data_in, &sl, propsEncoded,
-+		propsSize, LZMA_FINISH_ANY, &status, &lzma_alloc);
-+
-+	if (ret != SZ_OK || status == LZMA_STATUS_NOT_FINISHED || dl != (SizeT)destlen)
-+		return -1;
-+
-+	return 0;
-+}
-+
-+static struct jffs2_compressor jffs2_lzma_comp = {
-+	.priority = JFFS2_LZMA_PRIORITY,
-+	.name = "lzma",
-+	.compr = JFFS2_COMPR_LZMA,
-+	.compress = &jffs2_lzma_compress,
-+	.decompress = &jffs2_lzma_decompress,
-+	.disabled = 0,
-+};
-+
-+int INIT jffs2_lzma_init(void)
-+{
-+        int ret;
-+	CLzmaEncProps props;
-+	LzmaEncProps_Init(&props);
-+
-+        props.dictSize = LZMA_BEST_DICT(0x2000);
-+        props.level = LZMA_BEST_LEVEL;
-+        props.lc = LZMA_BEST_LC;
-+        props.lp = LZMA_BEST_LP;
-+        props.pb = LZMA_BEST_PB;
-+        props.fb = LZMA_BEST_FB;
-+
-+	ret = lzma_alloc_workspace(&props);
-+        if (ret < 0)
-+                return ret;
-+
-+	ret = jffs2_register_compressor(&jffs2_lzma_comp);
-+	if (ret)
-+		lzma_free_workspace();
-+	
-+        return ret;
-+}
-+
-+void jffs2_lzma_exit(void)
-+{
-+	jffs2_unregister_compressor(&jffs2_lzma_comp);
-+	lzma_free_workspace();
-+}
---- a/fs/jffs2/super.c
-+++ b/fs/jffs2/super.c
-@@ -254,14 +254,41 @@ static int __init init_jffs2_fs(void)
- 	BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68);
- 	BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32);
- 
--	printk(KERN_INFO "JFFS2 version 2.2."
-+	printk(KERN_INFO "JFFS2 version 2.2"
- #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
- 	       " (NAND)"
- #endif
- #ifdef CONFIG_JFFS2_SUMMARY
--	       " (SUMMARY) "
-+	       " (SUMMARY)"
- #endif
--	       " © 2001-2006 Red Hat, Inc.\n");
-+#ifdef CONFIG_JFFS2_ZLIB
-+	       " (ZLIB)"
-+#endif
-+#ifdef CONFIG_JFFS2_LZO
-+	       " (LZO)"
-+#endif
-+#ifdef CONFIG_JFFS2_LZMA
-+	       " (LZMA)"
-+#endif
-+#ifdef CONFIG_JFFS2_RTIME
-+	       " (RTIME)"
-+#endif
-+#ifdef CONFIG_JFFS2_RUBIN
-+	       " (RUBIN)"
-+#endif
-+#ifdef  CONFIG_JFFS2_CMODE_NONE
-+	       " (CMODE_NONE)"
-+#endif
-+#ifdef CONFIG_JFFS2_CMODE_PRIORITY
-+	       " (CMODE_PRIORITY)"
-+#endif
-+#ifdef CONFIG_JFFS2_CMODE_SIZE
-+	       " (CMODE_SIZE)"
-+#endif
-+#ifdef CONFIG_JFFS2_CMODE_FAVOURLZO
-+	       " (CMODE_FAVOURLZO)"
-+#endif
-+	       " (c) 2001-2006 Red Hat, Inc.\n");
- 
- 	jffs2_inode_cachep = kmem_cache_create("jffs2_i",
- 					     sizeof(struct jffs2_inode_info),
---- a/include/linux/jffs2.h
-+++ b/include/linux/jffs2.h
-@@ -45,6 +45,7 @@
- #define JFFS2_COMPR_DYNRUBIN	0x05
- #define JFFS2_COMPR_ZLIB	0x06
- #define JFFS2_COMPR_LZO		0x07
-+#define JFFS2_COMPR_LZMA	0x08
- /* Compatibility flags. */
- #define JFFS2_COMPAT_MASK 0xc000      /* What do to if an unknown nodetype is found */
- #define JFFS2_NODE_ACCURATE 0x2000
---- /dev/null
-+++ b/include/linux/lzma.h
-@@ -0,0 +1,62 @@
-+#ifndef __LZMA_H__
-+#define __LZMA_H__
-+
-+#ifdef __KERNEL__
-+	#include <linux/kernel.h>
-+	#include <linux/sched.h>
-+	#include <linux/slab.h>
-+	#include <linux/vmalloc.h>
-+	#include <linux/init.h>
-+	#define LZMA_MALLOC vmalloc
-+	#define LZMA_FREE vfree
-+	#define PRINT_ERROR(msg) printk(KERN_WARNING #msg)
-+	#define INIT __init
-+	#define STATIC static
-+#else
-+	#include <stdint.h>
-+	#include <stdlib.h>
-+	#include <stdio.h>
-+	#include <unistd.h>
-+	#include <string.h>
-+	#include <asm/types.h>
-+	#include <errno.h>
-+	#include <linux/jffs2.h>
-+	#ifndef PAGE_SIZE
-+		extern int page_size;
-+		#define PAGE_SIZE page_size
-+	#endif
-+	#define LZMA_MALLOC malloc
-+	#define LZMA_FREE free
-+	#define PRINT_ERROR(msg) fprintf(stderr, msg)
-+	#define INIT
-+	#define STATIC
-+#endif
-+
-+#include "lzma/LzmaDec.h"
-+#include "lzma/LzmaEnc.h"
-+
-+#define LZMA_BEST_LEVEL (9)
-+#define LZMA_BEST_LC    (0)
-+#define LZMA_BEST_LP    (0)
-+#define LZMA_BEST_PB    (0)
-+#define LZMA_BEST_FB  (273)
-+
-+#define LZMA_BEST_DICT(n) (((int)((n) / 2)) * 2)
-+
-+static void *p_lzma_malloc(void *p, size_t size)
-+{
-+        if (size == 0)
-+                return NULL;
-+
-+        return LZMA_MALLOC(size);
-+}
-+
-+static void p_lzma_free(void *p, void *address)
-+{
-+        if (address != NULL)
-+                LZMA_FREE(address);
-+}
-+
-+static ISzAlloc lzma_alloc = {p_lzma_malloc, p_lzma_free};
-+
-+#endif
---- /dev/null
-+++ b/include/linux/lzma/LzFind.h
-@@ -0,0 +1,115 @@
-+/* LzFind.h -- Match finder for LZ algorithms
-+2009-04-22 : Igor Pavlov : Public domain */
-+
-+#ifndef __LZ_FIND_H
-+#define __LZ_FIND_H
-+
-+#include "Types.h"
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+typedef UInt32 CLzRef;
-+
-+typedef struct _CMatchFinder
-+{
-+  Byte *buffer;
-+  UInt32 pos;
-+  UInt32 posLimit;
-+  UInt32 streamPos;
-+  UInt32 lenLimit;
-+
-+  UInt32 cyclicBufferPos;
-+  UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
-+
-+  UInt32 matchMaxLen;
-+  CLzRef *hash;
-+  CLzRef *son;
-+  UInt32 hashMask;
-+  UInt32 cutValue;
-+
-+  Byte *bufferBase;
-+  ISeqInStream *stream;
-+  int streamEndWasReached;
-+
-+  UInt32 blockSize;
-+  UInt32 keepSizeBefore;
-+  UInt32 keepSizeAfter;
-+
-+  UInt32 numHashBytes;
-+  int directInput;
-+  size_t directInputRem;
-+  int btMode;
-+  int bigHash;
-+  UInt32 historySize;
-+  UInt32 fixedHashSize;
-+  UInt32 hashSizeSum;
-+  UInt32 numSons;
-+  SRes result;
-+  UInt32 crc[256];
-+} CMatchFinder;
-+
-+#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
-+#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
-+
-+#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
-+
-+int MatchFinder_NeedMove(CMatchFinder *p);
-+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
-+void MatchFinder_MoveBlock(CMatchFinder *p);
-+void MatchFinder_ReadIfRequired(CMatchFinder *p);
-+
-+void MatchFinder_Construct(CMatchFinder *p);
-+
-+/* Conditions:
-+     historySize <= 3 GB
-+     keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
-+*/
-+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
-+    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
-+    ISzAlloc *alloc);
-+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
-+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
-+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
-+
-+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
-+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
-+    UInt32 *distances, UInt32 maxLen);
-+
-+/*
-+Conditions:
-+  Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
-+  Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
-+*/
-+
-+typedef void (*Mf_Init_Func)(void *object);
-+typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
-+typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
-+typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
-+typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
-+typedef void (*Mf_Skip_Func)(void *object, UInt32);
-+
-+typedef struct _IMatchFinder
-+{
-+  Mf_Init_Func Init;
-+  Mf_GetIndexByte_Func GetIndexByte;
-+  Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
-+  Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
-+  Mf_GetMatches_Func GetMatches;
-+  Mf_Skip_Func Skip;
-+} IMatchFinder;
-+
-+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
-+
-+void MatchFinder_Init(CMatchFinder *p);
-+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
-+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif
---- /dev/null
-+++ b/include/linux/lzma/LzHash.h
-@@ -0,0 +1,54 @@
-+/* LzHash.h -- HASH functions for LZ algorithms
-+2009-02-07 : Igor Pavlov : Public domain */
-+
-+#ifndef __LZ_HASH_H
-+#define __LZ_HASH_H
-+
-+#define kHash2Size (1 << 10)
-+#define kHash3Size (1 << 16)
-+#define kHash4Size (1 << 20)
-+
-+#define kFix3HashSize (kHash2Size)
-+#define kFix4HashSize (kHash2Size + kHash3Size)
-+#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
-+
-+#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
-+
-+#define HASH3_CALC { \
-+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-+  hash2Value = temp & (kHash2Size - 1); \
-+  hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
-+
-+#define HASH4_CALC { \
-+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-+  hash2Value = temp & (kHash2Size - 1); \
-+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
-+  hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
-+
-+#define HASH5_CALC { \
-+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-+  hash2Value = temp & (kHash2Size - 1); \
-+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
-+  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
-+  hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
-+  hash4Value &= (kHash4Size - 1); }
-+
-+/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
-+#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
-+
-+
-+#define MT_HASH2_CALC \
-+  hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
-+
-+#define MT_HASH3_CALC { \
-+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-+  hash2Value = temp & (kHash2Size - 1); \
-+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
-+
-+#define MT_HASH4_CALC { \
-+  UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
-+  hash2Value = temp & (kHash2Size - 1); \
-+  hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
-+  hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
-+
-+#endif
---- /dev/null
-+++ b/include/linux/lzma/LzmaDec.h
-@@ -0,0 +1,231 @@
-+/* LzmaDec.h -- LZMA Decoder
-+2009-02-07 : Igor Pavlov : Public domain */
-+
-+#ifndef __LZMA_DEC_H
-+#define __LZMA_DEC_H
-+
-+#include "Types.h"
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+/* #define _LZMA_PROB32 */
-+/* _LZMA_PROB32 can increase the speed on some CPUs,
-+   but memory usage for CLzmaDec::probs will be doubled in that case */
-+
-+#ifdef _LZMA_PROB32
-+#define CLzmaProb UInt32
-+#else
-+#define CLzmaProb UInt16
-+#endif
-+
-+
-+/* ---------- LZMA Properties ---------- */
-+
-+#define LZMA_PROPS_SIZE 5
-+
-+typedef struct _CLzmaProps
-+{
-+  unsigned lc, lp, pb;
-+  UInt32 dicSize;
-+} CLzmaProps;
-+
-+/* LzmaProps_Decode - decodes properties
-+Returns:
-+  SZ_OK
-+  SZ_ERROR_UNSUPPORTED - Unsupported properties
-+*/
-+
-+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
-+
-+
-+/* ---------- LZMA Decoder state ---------- */
-+
-+/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
-+   Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
-+
-+#define LZMA_REQUIRED_INPUT_MAX 20
-+
-+typedef struct
-+{
-+  CLzmaProps prop;
-+  CLzmaProb *probs;
-+  Byte *dic;
-+  const Byte *buf;
-+  UInt32 range, code;
-+  SizeT dicPos;
-+  SizeT dicBufSize;
-+  UInt32 processedPos;
-+  UInt32 checkDicSize;
-+  unsigned state;
-+  UInt32 reps[4];
-+  unsigned remainLen;
-+  int needFlush;
-+  int needInitState;
-+  UInt32 numProbs;
-+  unsigned tempBufSize;
-+  Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
-+} CLzmaDec;
-+
-+#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
-+
-+void LzmaDec_Init(CLzmaDec *p);
-+
-+/* There are two types of LZMA streams:
-+     0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
-+     1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
-+
-+typedef enum
-+{
-+  LZMA_FINISH_ANY,   /* finish at any point */
-+  LZMA_FINISH_END    /* block must be finished at the end */
-+} ELzmaFinishMode;
-+
-+/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
-+
-+   You must use LZMA_FINISH_END, when you know that current output buffer
-+   covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
-+
-+   If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
-+   and output value of destLen will be less than output buffer size limit.
-+   You can check status result also.
-+
-+   You can use multiple checks to test data integrity after full decompression:
-+     1) Check Result and "status" variable.
-+     2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
-+     3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
-+        You must use correct finish mode in that case. */
-+
-+typedef enum
-+{
-+  LZMA_STATUS_NOT_SPECIFIED,               /* use main error code instead */
-+  LZMA_STATUS_FINISHED_WITH_MARK,          /* stream was finished with end mark. */
-+  LZMA_STATUS_NOT_FINISHED,                /* stream was not finished */
-+  LZMA_STATUS_NEEDS_MORE_INPUT,            /* you must provide more input bytes */
-+  LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK  /* there is probability that stream was finished without end mark */
-+} ELzmaStatus;
-+
-+/* ELzmaStatus is used only as output value for function call */
-+
-+
-+/* ---------- Interfaces ---------- */
-+
-+/* There are 3 levels of interfaces:
-+     1) Dictionary Interface
-+     2) Buffer Interface
-+     3) One Call Interface
-+   You can select any of these interfaces, but don't mix functions from different
-+   groups for same object. */
-+
-+
-+/* There are two variants to allocate state for Dictionary Interface:
-+     1) LzmaDec_Allocate / LzmaDec_Free
-+     2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
-+   You can use variant 2, if you set dictionary buffer manually.
-+   For Buffer Interface you must always use variant 1.
-+
-+LzmaDec_Allocate* can return:
-+  SZ_OK
-+  SZ_ERROR_MEM         - Memory allocation error
-+  SZ_ERROR_UNSUPPORTED - Unsupported properties
-+*/
-+   
-+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
-+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
-+
-+SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
-+void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
-+
-+/* ---------- Dictionary Interface ---------- */
-+
-+/* You can use it, if you want to eliminate the overhead for data copying from
-+   dictionary to some other external buffer.
-+   You must work with CLzmaDec variables directly in this interface.
-+
-+   STEPS:
-+     LzmaDec_Constr()
-+     LzmaDec_Allocate()
-+     for (each new stream)
-+     {
-+       LzmaDec_Init()
-+       while (it needs more decompression)
-+       {
-+         LzmaDec_DecodeToDic()
-+         use data from CLzmaDec::dic and update CLzmaDec::dicPos
-+       }
-+     }
-+     LzmaDec_Free()
-+*/
-+
-+/* LzmaDec_DecodeToDic
-+   
-+   The decoding to internal dictionary buffer (CLzmaDec::dic).
-+   You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
-+
-+finishMode:
-+  It has meaning only if the decoding reaches output limit (dicLimit).
-+  LZMA_FINISH_ANY - Decode just dicLimit bytes.
-+  LZMA_FINISH_END - Stream must be finished after dicLimit.
-+
-+Returns:
-+  SZ_OK
-+    status:
-+      LZMA_STATUS_FINISHED_WITH_MARK
-+      LZMA_STATUS_NOT_FINISHED
-+      LZMA_STATUS_NEEDS_MORE_INPUT
-+      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
-+  SZ_ERROR_DATA - Data error
-+*/
-+
-+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
-+    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-+
-+
-+/* ---------- Buffer Interface ---------- */
-+
-+/* It's zlib-like interface.
-+   See LzmaDec_DecodeToDic description for information about STEPS and return results,
-+   but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
-+   to work with CLzmaDec variables manually.
-+
-+finishMode:
-+  It has meaning only if the decoding reaches output limit (*destLen).
-+  LZMA_FINISH_ANY - Decode just destLen bytes.
-+  LZMA_FINISH_END - Stream must be finished after (*destLen).
-+*/
-+
-+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
-+    const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
-+
-+
-+/* ---------- One Call Interface ---------- */
-+
-+/* LzmaDecode
-+
-+finishMode:
-+  It has meaning only if the decoding reaches output limit (*destLen).
-+  LZMA_FINISH_ANY - Decode just destLen bytes.
-+  LZMA_FINISH_END - Stream must be finished after (*destLen).
-+
-+Returns:
-+  SZ_OK
-+    status:
-+      LZMA_STATUS_FINISHED_WITH_MARK
-+      LZMA_STATUS_NOT_FINISHED
-+      LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
-+  SZ_ERROR_DATA - Data error
-+  SZ_ERROR_MEM  - Memory allocation error
-+  SZ_ERROR_UNSUPPORTED - Unsupported properties
-+  SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
-+*/
-+
-+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
-+    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
-+    ELzmaStatus *status, ISzAlloc *alloc);
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif
---- /dev/null
-+++ b/include/linux/lzma/LzmaEnc.h
-@@ -0,0 +1,80 @@
-+/*  LzmaEnc.h -- LZMA Encoder
-+2009-02-07 : Igor Pavlov : Public domain */
-+
-+#ifndef __LZMA_ENC_H
-+#define __LZMA_ENC_H
-+
-+#include "Types.h"
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#define LZMA_PROPS_SIZE 5
-+
-+typedef struct _CLzmaEncProps
-+{
-+  int level;       /*  0 <= level <= 9 */
-+  UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
-+                      (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
-+                       default = (1 << 24) */
-+  int lc;          /* 0 <= lc <= 8, default = 3 */
-+  int lp;          /* 0 <= lp <= 4, default = 0 */
-+  int pb;          /* 0 <= pb <= 4, default = 2 */
-+  int algo;        /* 0 - fast, 1 - normal, default = 1 */
-+  int fb;          /* 5 <= fb <= 273, default = 32 */
-+  int btMode;      /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
-+  int numHashBytes; /* 2, 3 or 4, default = 4 */
-+  UInt32 mc;        /* 1 <= mc <= (1 << 30), default = 32 */
-+  unsigned writeEndMark;  /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
-+  int numThreads;  /* 1 or 2, default = 2 */
-+} CLzmaEncProps;
-+
-+void LzmaEncProps_Init(CLzmaEncProps *p);
-+void LzmaEncProps_Normalize(CLzmaEncProps *p);
-+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
-+
-+
-+/* ---------- CLzmaEncHandle Interface ---------- */
-+
-+/* LzmaEnc_* functions can return the following exit codes:
-+Returns:
-+  SZ_OK           - OK
-+  SZ_ERROR_MEM    - Memory allocation error
-+  SZ_ERROR_PARAM  - Incorrect paramater in props
-+  SZ_ERROR_WRITE  - Write callback error.
-+  SZ_ERROR_PROGRESS - some break from progress callback
-+  SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
-+*/
-+
-+typedef void * CLzmaEncHandle;
-+
-+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
-+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
-+SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
-+SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
-+SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
-+    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-+SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-+    int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-+
-+/* ---------- One Call Interface ---------- */
-+
-+/* LzmaEncode
-+Return code:
-+  SZ_OK               - OK
-+  SZ_ERROR_MEM        - Memory allocation error
-+  SZ_ERROR_PARAM      - Incorrect paramater
-+  SZ_ERROR_OUTPUT_EOF - output buffer overflow
-+  SZ_ERROR_THREAD     - errors in multithreading functions (only for Mt version)
-+*/
-+
-+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-+    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
-+    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif
---- /dev/null
-+++ b/include/linux/lzma/Types.h
-@@ -0,0 +1,226 @@
-+/* Types.h -- Basic types
-+2009-11-23 : Igor Pavlov : Public domain */
-+
-+#ifndef __7Z_TYPES_H
-+#define __7Z_TYPES_H
-+
-+#include <stddef.h>
-+
-+#ifdef _WIN32
-+#include <windows.h>
-+#endif
-+
-+#ifndef EXTERN_C_BEGIN
-+#ifdef __cplusplus
-+#define EXTERN_C_BEGIN extern "C" {
-+#define EXTERN_C_END }
-+#else
-+#define EXTERN_C_BEGIN
-+#define EXTERN_C_END
-+#endif
-+#endif
-+
-+EXTERN_C_BEGIN
-+
-+#define SZ_OK 0
-+
-+#define SZ_ERROR_DATA 1
-+#define SZ_ERROR_MEM 2
-+#define SZ_ERROR_CRC 3
-+#define SZ_ERROR_UNSUPPORTED 4
-+#define SZ_ERROR_PARAM 5
-+#define SZ_ERROR_INPUT_EOF 6
-+#define SZ_ERROR_OUTPUT_EOF 7
-+#define SZ_ERROR_READ 8
-+#define SZ_ERROR_WRITE 9
-+#define SZ_ERROR_PROGRESS 10
-+#define SZ_ERROR_FAIL 11
-+#define SZ_ERROR_THREAD 12
-+
-+#define SZ_ERROR_ARCHIVE 16
-+#define SZ_ERROR_NO_ARCHIVE 17
-+
-+typedef int SRes;
-+
-+#ifdef _WIN32
-+typedef DWORD WRes;
-+#else
-+typedef int WRes;
-+#endif
-+
-+#ifndef RINOK
-+#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
-+#endif
-+
-+typedef unsigned char Byte;
-+typedef short Int16;
-+typedef unsigned short UInt16;
-+
-+#ifdef _LZMA_UINT32_IS_ULONG
-+typedef long Int32;
-+typedef unsigned long UInt32;
-+#else
-+typedef int Int32;
-+typedef unsigned int UInt32;
-+#endif
-+
-+#ifdef _SZ_NO_INT_64
-+
-+/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
-+   NOTES: Some code will work incorrectly in that case! */
-+
-+typedef long Int64;
-+typedef unsigned long UInt64;
-+
-+#else
-+
-+#if defined(_MSC_VER) || defined(__BORLANDC__)
-+typedef __int64 Int64;
-+typedef unsigned __int64 UInt64;
-+#else
-+typedef long long int Int64;
-+typedef unsigned long long int UInt64;
-+#endif
-+
-+#endif
-+
-+#ifdef _LZMA_NO_SYSTEM_SIZE_T
-+typedef UInt32 SizeT;
-+#else
-+typedef size_t SizeT;
-+#endif
-+
-+typedef int Bool;
-+#define True 1
-+#define False 0
-+
-+
-+#ifdef _WIN32
-+#define MY_STD_CALL __stdcall
-+#else
-+#define MY_STD_CALL
-+#endif
-+
-+#ifdef _MSC_VER
-+
-+#if _MSC_VER >= 1300
-+#define MY_NO_INLINE __declspec(noinline)
-+#else
-+#define MY_NO_INLINE
-+#endif
-+
-+#define MY_CDECL __cdecl
-+#define MY_FAST_CALL __fastcall
-+
-+#else
-+
-+#define MY_CDECL
-+#define MY_FAST_CALL
-+
-+#endif
-+
-+
-+/* The following interfaces use first parameter as pointer to structure */
-+
-+typedef struct
-+{
-+  SRes (*Read)(void *p, void *buf, size_t *size);
-+    /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
-+       (output(*size) < input(*size)) is allowed */
-+} ISeqInStream;
-+
-+/* it can return SZ_ERROR_INPUT_EOF */
-+SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
-+SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
-+SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
-+
-+typedef struct
-+{
-+  size_t (*Write)(void *p, const void *buf, size_t size);
-+    /* Returns: result - the number of actually written bytes.
-+       (result < size) means error */
-+} ISeqOutStream;
-+
-+typedef enum
-+{
-+  SZ_SEEK_SET = 0,
-+  SZ_SEEK_CUR = 1,
-+  SZ_SEEK_END = 2
-+} ESzSeek;
-+
-+typedef struct
-+{
-+  SRes (*Read)(void *p, void *buf, size_t *size);  /* same as ISeqInStream::Read */
-+  SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
-+} ISeekInStream;
-+
-+typedef struct
-+{
-+  SRes (*Look)(void *p, void **buf, size_t *size);
-+    /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
-+       (output(*size) > input(*size)) is not allowed
-+       (output(*size) < input(*size)) is allowed */
-+  SRes (*Skip)(void *p, size_t offset);
-+    /* offset must be <= output(*size) of Look */
-+
-+  SRes (*Read)(void *p, void *buf, size_t *size);
-+    /* reads directly (without buffer). It's same as ISeqInStream::Read */
-+  SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
-+} ILookInStream;
-+
-+SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
-+SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
-+
-+/* reads via ILookInStream::Read */
-+SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
-+SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
-+
-+#define LookToRead_BUF_SIZE (1 << 14)
-+
-+typedef struct
-+{
-+  ILookInStream s;
-+  ISeekInStream *realStream;
-+  size_t pos;
-+  size_t size;
-+  Byte buf[LookToRead_BUF_SIZE];
-+} CLookToRead;
-+
-+void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
-+void LookToRead_Init(CLookToRead *p);
-+
-+typedef struct
-+{
-+  ISeqInStream s;
-+  ILookInStream *realStream;
-+} CSecToLook;
-+
-+void SecToLook_CreateVTable(CSecToLook *p);
-+
-+typedef struct
-+{
-+  ISeqInStream s;
-+  ILookInStream *realStream;
-+} CSecToRead;
-+
-+void SecToRead_CreateVTable(CSecToRead *p);
-+
-+typedef struct
-+{
-+  SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
-+    /* Returns: result. (result != SZ_OK) means break.
-+       Value (UInt64)(Int64)-1 for size means unknown value. */
-+} ICompressProgress;
-+
-+typedef struct
-+{
-+  void *(*Alloc)(void *p, size_t size);
-+  void (*Free)(void *p, void *address); /* address can be 0 */
-+} ISzAlloc;
-+
-+#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
-+#define IAlloc_Free(p, a) (p)->Free((p), a)
-+
-+EXTERN_C_END
-+
-+#endif
---- a/lib/Kconfig
-+++ b/lib/Kconfig
-@@ -103,6 +103,12 @@ config LZO_COMPRESS
- config LZO_DECOMPRESS
- 	tristate
- 
-+config LZMA_COMPRESS
-+    tristate
-+
-+config LZMA_DECOMPRESS
-+    tristate
-+
- #
- # These all provide a common interface (hence the apparent duplication with
- # ZLIB_INFLATE; DECOMPRESS_GZIP is just a wrapper.)
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -2,6 +2,16 @@
- # Makefile for some libs needed in the kernel.
- #
- 
-+ifdef CONFIG_JFFS2_ZLIB
-+	CONFIG_ZLIB_INFLATE:=y
-+	CONFIG_ZLIB_DEFLATE:=y
-+endif
-+
-+ifdef CONFIG_JFFS2_LZMA
-+	CONFIG_LZMA_DECOMPRESS:=y
-+	CONFIG_LZMA_COMPRESS:=y
-+endif
-+
- ifdef CONFIG_FUNCTION_TRACER
- ORIG_CFLAGS := $(KBUILD_CFLAGS)
- KBUILD_CFLAGS = $(subst -pg,,$(ORIG_CFLAGS))
-@@ -65,6 +75,8 @@ obj-$(CONFIG_ZLIB_DEFLATE) += zlib_defla
- obj-$(CONFIG_REED_SOLOMON) += reed_solomon/
- obj-$(CONFIG_LZO_COMPRESS) += lzo/
- obj-$(CONFIG_LZO_DECOMPRESS) += lzo/
-+obj-$(CONFIG_LZMA_COMPRESS) += lzma/
-+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma/
- 
- lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
- lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
---- /dev/null
-+++ b/lib/lzma/LzFind.c
-@@ -0,0 +1,761 @@
-+/* LzFind.c -- Match finder for LZ algorithms
-+2009-04-22 : Igor Pavlov : Public domain */
-+
-+#include <string.h>
-+
-+#include "LzFind.h"
-+#include "LzHash.h"
-+
-+#define kEmptyHashValue 0
-+#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
-+#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
-+#define kNormalizeMask (~(kNormalizeStepMin - 1))
-+#define kMaxHistorySize ((UInt32)3 << 30)
-+
-+#define kStartMaxLen 3
-+
-+static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
-+{
-+  if (!p->directInput)
-+  {
-+    alloc->Free(alloc, p->bufferBase);
-+    p->bufferBase = 0;
-+  }
-+}
-+
-+/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
-+
-+static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
-+{
-+  UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
-+  if (p->directInput)
-+  {
-+    p->blockSize = blockSize;
-+    return 1;
-+  }
-+  if (p->bufferBase == 0 || p->blockSize != blockSize)
-+  {
-+    LzInWindow_Free(p, alloc);
-+    p->blockSize = blockSize;
-+    p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
-+  }
-+  return (p->bufferBase != 0);
-+}
-+
-+Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
-+Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
-+
-+UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
-+
-+void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
-+{
-+  p->posLimit -= subValue;
-+  p->pos -= subValue;
-+  p->streamPos -= subValue;
-+}
-+
-+static void MatchFinder_ReadBlock(CMatchFinder *p)
-+{
-+  if (p->streamEndWasReached || p->result != SZ_OK)
-+    return;
-+  if (p->directInput)
-+  {
-+    UInt32 curSize = 0xFFFFFFFF - p->streamPos;
-+    if (curSize > p->directInputRem)
-+      curSize = (UInt32)p->directInputRem;
-+    p->directInputRem -= curSize;
-+    p->streamPos += curSize;
-+    if (p->directInputRem == 0)
-+      p->streamEndWasReached = 1;
-+    return;
-+  }
-+  for (;;)
-+  {
-+    Byte *dest = p->buffer + (p->streamPos - p->pos);
-+    size_t size = (p->bufferBase + p->blockSize - dest);
-+    if (size == 0)
-+      return;
-+    p->result = p->stream->Read(p->stream, dest, &size);
-+    if (p->result != SZ_OK)
-+      return;
-+    if (size == 0)
-+    {
-+      p->streamEndWasReached = 1;
-+      return;
-+    }
-+    p->streamPos += (UInt32)size;
-+    if (p->streamPos - p->pos > p->keepSizeAfter)
-+      return;
-+  }
-+}
-+
-+void MatchFinder_MoveBlock(CMatchFinder *p)
-+{
-+  memmove(p->bufferBase,
-+    p->buffer - p->keepSizeBefore,
-+    (size_t)(p->streamPos - p->pos + p->keepSizeBefore));
-+  p->buffer = p->bufferBase + p->keepSizeBefore;
-+}
-+
-+int MatchFinder_NeedMove(CMatchFinder *p)
-+{
-+  if (p->directInput)
-+    return 0;
-+  /* if (p->streamEndWasReached) return 0; */
-+  return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
-+}
-+
-+void MatchFinder_ReadIfRequired(CMatchFinder *p)
-+{
-+  if (p->streamEndWasReached)
-+    return;
-+  if (p->keepSizeAfter >= p->streamPos - p->pos)
-+    MatchFinder_ReadBlock(p);
-+}
-+
-+static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
-+{
-+  if (MatchFinder_NeedMove(p))
-+    MatchFinder_MoveBlock(p);
-+  MatchFinder_ReadBlock(p);
-+}
-+
-+static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
-+{
-+  p->cutValue = 32;
-+  p->btMode = 1;
-+  p->numHashBytes = 4;
-+  p->bigHash = 0;
-+}
-+
-+#define kCrcPoly 0xEDB88320
-+
-+void MatchFinder_Construct(CMatchFinder *p)
-+{
-+  UInt32 i;
-+  p->bufferBase = 0;
-+  p->directInput = 0;
-+  p->hash = 0;
-+  MatchFinder_SetDefaultSettings(p);
-+
-+  for (i = 0; i < 256; i++)
-+  {
-+    UInt32 r = i;
-+    int j;
-+    for (j = 0; j < 8; j++)
-+      r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
-+    p->crc[i] = r;
-+  }
-+}
-+
-+static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
-+{
-+  alloc->Free(alloc, p->hash);
-+  p->hash = 0;
-+}
-+
-+void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
-+{
-+  MatchFinder_FreeThisClassMemory(p, alloc);
-+  LzInWindow_Free(p, alloc);
-+}
-+
-+static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
-+{
-+  size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
-+  if (sizeInBytes / sizeof(CLzRef) != num)
-+    return 0;
-+  return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
-+}
-+
-+int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
-+    UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
-+    ISzAlloc *alloc)
-+{
-+  UInt32 sizeReserv;
-+  if (historySize > kMaxHistorySize)
-+  {
-+    MatchFinder_Free(p, alloc);
-+    return 0;
-+  }
-+  sizeReserv = historySize >> 1;
-+  if (historySize > ((UInt32)2 << 30))
-+    sizeReserv = historySize >> 2;
-+  sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
-+
-+  p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
-+  p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
-+  /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
-+  if (LzInWindow_Create(p, sizeReserv, alloc))
-+  {
-+    UInt32 newCyclicBufferSize = historySize + 1;
-+    UInt32 hs;
-+    p->matchMaxLen = matchMaxLen;
-+    {
-+      p->fixedHashSize = 0;
-+      if (p->numHashBytes == 2)
-+        hs = (1 << 16) - 1;
-+      else
-+      {
-+        hs = historySize - 1;
-+        hs |= (hs >> 1);
-+        hs |= (hs >> 2);
-+        hs |= (hs >> 4);
-+        hs |= (hs >> 8);
-+        hs >>= 1;
-+        hs |= 0xFFFF; /* don't change it! It's required for Deflate */
-+        if (hs > (1 << 24))
-+        {
-+          if (p->numHashBytes == 3)
-+            hs = (1 << 24) - 1;
-+          else
-+            hs >>= 1;
-+        }
-+      }
-+      p->hashMask = hs;
-+      hs++;
-+      if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
-+      if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
-+      if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
-+      hs += p->fixedHashSize;
-+    }
-+
-+    {
-+      UInt32 prevSize = p->hashSizeSum + p->numSons;
-+      UInt32 newSize;
-+      p->historySize = historySize;
-+      p->hashSizeSum = hs;
-+      p->cyclicBufferSize = newCyclicBufferSize;
-+      p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
-+      newSize = p->hashSizeSum + p->numSons;
-+      if (p->hash != 0 && prevSize == newSize)
-+        return 1;
-+      MatchFinder_FreeThisClassMemory(p, alloc);
-+      p->hash = AllocRefs(newSize, alloc);
-+      if (p->hash != 0)
-+      {
-+        p->son = p->hash + p->hashSizeSum;
-+        return 1;
-+      }
-+    }
-+  }
-+  MatchFinder_Free(p, alloc);
-+  return 0;
-+}
-+
-+static void MatchFinder_SetLimits(CMatchFinder *p)
-+{
-+  UInt32 limit = kMaxValForNormalize - p->pos;
-+  UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
-+  if (limit2 < limit)
-+    limit = limit2;
-+  limit2 = p->streamPos - p->pos;
-+  if (limit2 <= p->keepSizeAfter)
-+  {
-+    if (limit2 > 0)
-+      limit2 = 1;
-+  }
-+  else
-+    limit2 -= p->keepSizeAfter;
-+  if (limit2 < limit)
-+    limit = limit2;
-+  {
-+    UInt32 lenLimit = p->streamPos - p->pos;
-+    if (lenLimit > p->matchMaxLen)
-+      lenLimit = p->matchMaxLen;
-+    p->lenLimit = lenLimit;
-+  }
-+  p->posLimit = p->pos + limit;
-+}
-+
-+void MatchFinder_Init(CMatchFinder *p)
-+{
-+  UInt32 i;
-+  for (i = 0; i < p->hashSizeSum; i++)
-+    p->hash[i] = kEmptyHashValue;
-+  p->cyclicBufferPos = 0;
-+  p->buffer = p->bufferBase;
-+  p->pos = p->streamPos = p->cyclicBufferSize;
-+  p->result = SZ_OK;
-+  p->streamEndWasReached = 0;
-+  MatchFinder_ReadBlock(p);
-+  MatchFinder_SetLimits(p);
-+}
-+
-+static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
-+{
-+  return (p->pos - p->historySize - 1) & kNormalizeMask;
-+}
-+
-+void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
-+{
-+  UInt32 i;
-+  for (i = 0; i < numItems; i++)
-+  {
-+    UInt32 value = items[i];
-+    if (value <= subValue)
-+      value = kEmptyHashValue;
-+    else
-+      value -= subValue;
-+    items[i] = value;
-+  }
-+}
-+
-+static void MatchFinder_Normalize(CMatchFinder *p)
-+{
-+  UInt32 subValue = MatchFinder_GetSubValue(p);
-+  MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
-+  MatchFinder_ReduceOffsets(p, subValue);
-+}
-+
-+static void MatchFinder_CheckLimits(CMatchFinder *p)
-+{
-+  if (p->pos == kMaxValForNormalize)
-+    MatchFinder_Normalize(p);
-+  if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
-+    MatchFinder_CheckAndMoveAndRead(p);
-+  if (p->cyclicBufferPos == p->cyclicBufferSize)
-+    p->cyclicBufferPos = 0;
-+  MatchFinder_SetLimits(p);
-+}
-+
-+static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
-+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
-+    UInt32 *distances, UInt32 maxLen)
-+{
-+  son[_cyclicBufferPos] = curMatch;
-+  for (;;)
-+  {
-+    UInt32 delta = pos - curMatch;
-+    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-+      return distances;
-+    {
-+      const Byte *pb = cur - delta;
-+      curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
-+      if (pb[maxLen] == cur[maxLen] && *pb == *cur)
-+      {
-+        UInt32 len = 0;
-+        while (++len != lenLimit)
-+          if (pb[len] != cur[len])
-+            break;
-+        if (maxLen < len)
-+        {
-+          *distances++ = maxLen = len;
-+          *distances++ = delta - 1;
-+          if (len == lenLimit)
-+            return distances;
-+        }
-+      }
-+    }
-+  }
-+}
-+
-+UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
-+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
-+    UInt32 *distances, UInt32 maxLen)
-+{
-+  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
-+  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
-+  UInt32 len0 = 0, len1 = 0;
-+  for (;;)
-+  {
-+    UInt32 delta = pos - curMatch;
-+    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-+    {
-+      *ptr0 = *ptr1 = kEmptyHashValue;
-+      return distances;
-+    }
-+    {
-+      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
-+      const Byte *pb = cur - delta;
-+      UInt32 len = (len0 < len1 ? len0 : len1);
-+      if (pb[len] == cur[len])
-+      {
-+        if (++len != lenLimit && pb[len] == cur[len])
-+          while (++len != lenLimit)
-+            if (pb[len] != cur[len])
-+              break;
-+        if (maxLen < len)
-+        {
-+          *distances++ = maxLen = len;
-+          *distances++ = delta - 1;
-+          if (len == lenLimit)
-+          {
-+            *ptr1 = pair[0];
-+            *ptr0 = pair[1];
-+            return distances;
-+          }
-+        }
-+      }
-+      if (pb[len] < cur[len])
-+      {
-+        *ptr1 = curMatch;
-+        ptr1 = pair + 1;
-+        curMatch = *ptr1;
-+        len1 = len;
-+      }
-+      else
-+      {
-+        *ptr0 = curMatch;
-+        ptr0 = pair;
-+        curMatch = *ptr0;
-+        len0 = len;
-+      }
-+    }
-+  }
-+}
-+
-+static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
-+    UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
-+{
-+  CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
-+  CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
-+  UInt32 len0 = 0, len1 = 0;
-+  for (;;)
-+  {
-+    UInt32 delta = pos - curMatch;
-+    if (cutValue-- == 0 || delta >= _cyclicBufferSize)
-+    {
-+      *ptr0 = *ptr1 = kEmptyHashValue;
-+      return;
-+    }
-+    {
-+      CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
-+      const Byte *pb = cur - delta;
-+      UInt32 len = (len0 < len1 ? len0 : len1);
-+      if (pb[len] == cur[len])
-+      {
-+        while (++len != lenLimit)
-+          if (pb[len] != cur[len])
-+            break;
-+        {
-+          if (len == lenLimit)
-+          {
-+            *ptr1 = pair[0];
-+            *ptr0 = pair[1];
-+            return;
-+          }
-+        }
-+      }
-+      if (pb[len] < cur[len])
-+      {
-+        *ptr1 = curMatch;
-+        ptr1 = pair + 1;
-+        curMatch = *ptr1;
-+        len1 = len;
-+      }
-+      else
-+      {
-+        *ptr0 = curMatch;
-+        ptr0 = pair;
-+        curMatch = *ptr0;
-+        len0 = len;
-+      }
-+    }
-+  }
-+}
-+
-+#define MOVE_POS \
-+  ++p->cyclicBufferPos; \
-+  p->buffer++; \
-+  if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
-+
-+#define MOVE_POS_RET MOVE_POS return offset;
-+
-+static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
-+
-+#define GET_MATCHES_HEADER2(minLen, ret_op) \
-+  UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
-+  lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
-+  cur = p->buffer;
-+
-+#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
-+#define SKIP_HEADER(minLen)        GET_MATCHES_HEADER2(minLen, continue)
-+
-+#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
-+
-+#define GET_MATCHES_FOOTER(offset, maxLen) \
-+  offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
-+  distances + offset, maxLen) - distances); MOVE_POS_RET;
-+
-+#define SKIP_FOOTER \
-+  SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
-+
-+static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-+{
-+  UInt32 offset;
-+  GET_MATCHES_HEADER(2)
-+  HASH2_CALC;
-+  curMatch = p->hash[hashValue];
-+  p->hash[hashValue] = p->pos;
-+  offset = 0;
-+  GET_MATCHES_FOOTER(offset, 1)
-+}
-+
-+UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-+{
-+  UInt32 offset;
-+  GET_MATCHES_HEADER(3)
-+  HASH_ZIP_CALC;
-+  curMatch = p->hash[hashValue];
-+  p->hash[hashValue] = p->pos;
-+  offset = 0;
-+  GET_MATCHES_FOOTER(offset, 2)
-+}
-+
-+static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-+{
-+  UInt32 hash2Value, delta2, maxLen, offset;
-+  GET_MATCHES_HEADER(3)
-+
-+  HASH3_CALC;
-+
-+  delta2 = p->pos - p->hash[hash2Value];
-+  curMatch = p->hash[kFix3HashSize + hashValue];
-+  
-+  p->hash[hash2Value] =
-+  p->hash[kFix3HashSize + hashValue] = p->pos;
-+
-+
-+  maxLen = 2;
-+  offset = 0;
-+  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
-+  {
-+    for (; maxLen != lenLimit; maxLen++)
-+      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
-+        break;
-+    distances[0] = maxLen;
-+    distances[1] = delta2 - 1;
-+    offset = 2;
-+    if (maxLen == lenLimit)
-+    {
-+      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
-+      MOVE_POS_RET;
-+    }
-+  }
-+  GET_MATCHES_FOOTER(offset, maxLen)
-+}
-+
-+static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-+{
-+  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
-+  GET_MATCHES_HEADER(4)
-+
-+  HASH4_CALC;
-+
-+  delta2 = p->pos - p->hash[                hash2Value];
-+  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
-+  curMatch = p->hash[kFix4HashSize + hashValue];
-+  
-+  p->hash[                hash2Value] =
-+  p->hash[kFix3HashSize + hash3Value] =
-+  p->hash[kFix4HashSize + hashValue] = p->pos;
-+
-+  maxLen = 1;
-+  offset = 0;
-+  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
-+  {
-+    distances[0] = maxLen = 2;
-+    distances[1] = delta2 - 1;
-+    offset = 2;
-+  }
-+  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
-+  {
-+    maxLen = 3;
-+    distances[offset + 1] = delta3 - 1;
-+    offset += 2;
-+    delta2 = delta3;
-+  }
-+  if (offset != 0)
-+  {
-+    for (; maxLen != lenLimit; maxLen++)
-+      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
-+        break;
-+    distances[offset - 2] = maxLen;
-+    if (maxLen == lenLimit)
-+    {
-+      SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
-+      MOVE_POS_RET;
-+    }
-+  }
-+  if (maxLen < 3)
-+    maxLen = 3;
-+  GET_MATCHES_FOOTER(offset, maxLen)
-+}
-+
-+static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-+{
-+  UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
-+  GET_MATCHES_HEADER(4)
-+
-+  HASH4_CALC;
-+
-+  delta2 = p->pos - p->hash[                hash2Value];
-+  delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
-+  curMatch = p->hash[kFix4HashSize + hashValue];
-+
-+  p->hash[                hash2Value] =
-+  p->hash[kFix3HashSize + hash3Value] =
-+  p->hash[kFix4HashSize + hashValue] = p->pos;
-+
-+  maxLen = 1;
-+  offset = 0;
-+  if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
-+  {
-+    distances[0] = maxLen = 2;
-+    distances[1] = delta2 - 1;
-+    offset = 2;
-+  }
-+  if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
-+  {
-+    maxLen = 3;
-+    distances[offset + 1] = delta3 - 1;
-+    offset += 2;
-+    delta2 = delta3;
-+  }
-+  if (offset != 0)
-+  {
-+    for (; maxLen != lenLimit; maxLen++)
-+      if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
-+        break;
-+    distances[offset - 2] = maxLen;
-+    if (maxLen == lenLimit)
-+    {
-+      p->son[p->cyclicBufferPos] = curMatch;
-+      MOVE_POS_RET;
-+    }
-+  }
-+  if (maxLen < 3)
-+    maxLen = 3;
-+  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
-+    distances + offset, maxLen) - (distances));
-+  MOVE_POS_RET
-+}
-+
-+UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
-+{
-+  UInt32 offset;
-+  GET_MATCHES_HEADER(3)
-+  HASH_ZIP_CALC;
-+  curMatch = p->hash[hashValue];
-+  p->hash[hashValue] = p->pos;
-+  offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
-+    distances, 2) - (distances));
-+  MOVE_POS_RET
-+}
-+
-+static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-+{
-+  do
-+  {
-+    SKIP_HEADER(2)
-+    HASH2_CALC;
-+    curMatch = p->hash[hashValue];
-+    p->hash[hashValue] = p->pos;
-+    SKIP_FOOTER
-+  }
-+  while (--num != 0);
-+}
-+
-+void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-+{
-+  do
-+  {
-+    SKIP_HEADER(3)
-+    HASH_ZIP_CALC;
-+    curMatch = p->hash[hashValue];
-+    p->hash[hashValue] = p->pos;
-+    SKIP_FOOTER
-+  }
-+  while (--num != 0);
-+}
-+
-+static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-+{
-+  do
-+  {
-+    UInt32 hash2Value;
-+    SKIP_HEADER(3)
-+    HASH3_CALC;
-+    curMatch = p->hash[kFix3HashSize + hashValue];
-+    p->hash[hash2Value] =
-+    p->hash[kFix3HashSize + hashValue] = p->pos;
-+    SKIP_FOOTER
-+  }
-+  while (--num != 0);
-+}
-+
-+static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-+{
-+  do
-+  {
-+    UInt32 hash2Value, hash3Value;
-+    SKIP_HEADER(4)
-+    HASH4_CALC;
-+    curMatch = p->hash[kFix4HashSize + hashValue];
-+    p->hash[                hash2Value] =
-+    p->hash[kFix3HashSize + hash3Value] = p->pos;
-+    p->hash[kFix4HashSize + hashValue] = p->pos;
-+    SKIP_FOOTER
-+  }
-+  while (--num != 0);
-+}
-+
-+static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-+{
-+  do
-+  {
-+    UInt32 hash2Value, hash3Value;
-+    SKIP_HEADER(4)
-+    HASH4_CALC;
-+    curMatch = p->hash[kFix4HashSize + hashValue];
-+    p->hash[                hash2Value] =
-+    p->hash[kFix3HashSize + hash3Value] =
-+    p->hash[kFix4HashSize + hashValue] = p->pos;
-+    p->son[p->cyclicBufferPos] = curMatch;
-+    MOVE_POS
-+  }
-+  while (--num != 0);
-+}
-+
-+void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
-+{
-+  do
-+  {
-+    SKIP_HEADER(3)
-+    HASH_ZIP_CALC;
-+    curMatch = p->hash[hashValue];
-+    p->hash[hashValue] = p->pos;
-+    p->son[p->cyclicBufferPos] = curMatch;
-+    MOVE_POS
-+  }
-+  while (--num != 0);
-+}
-+
-+void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
-+{
-+  vTable->Init = (Mf_Init_Func)MatchFinder_Init;
-+  vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
-+  vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
-+  vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
-+  if (!p->btMode)
-+  {
-+    vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
-+    vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
-+  }
-+  else if (p->numHashBytes == 2)
-+  {
-+    vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
-+    vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
-+  }
-+  else if (p->numHashBytes == 3)
-+  {
-+    vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
-+    vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
-+  }
-+  else
-+  {
-+    vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
-+    vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
-+  }
-+}
---- /dev/null
-+++ b/lib/lzma/LzmaDec.c
-@@ -0,0 +1,999 @@
-+/* LzmaDec.c -- LZMA Decoder
-+2009-09-20 : Igor Pavlov : Public domain */
-+
-+#include "LzmaDec.h"
-+
-+#include <string.h>
-+
-+#define kNumTopBits 24
-+#define kTopValue ((UInt32)1 << kNumTopBits)
-+
-+#define kNumBitModelTotalBits 11
-+#define kBitModelTotal (1 << kNumBitModelTotalBits)
-+#define kNumMoveBits 5
-+
-+#define RC_INIT_SIZE 5
-+
-+#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
-+
-+#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-+#define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
-+#define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
-+#define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
-+  { UPDATE_0(p); i = (i + i); A0; } else \
-+  { UPDATE_1(p); i = (i + i) + 1; A1; }
-+#define GET_BIT(p, i) GET_BIT2(p, i, ; , ;)
-+
-+#define TREE_GET_BIT(probs, i) { GET_BIT((probs + i), i); }
-+#define TREE_DECODE(probs, limit, i) \
-+  { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
-+
-+/* #define _LZMA_SIZE_OPT */
-+
-+#ifdef _LZMA_SIZE_OPT
-+#define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
-+#else
-+#define TREE_6_DECODE(probs, i) \
-+  { i = 1; \
-+  TREE_GET_BIT(probs, i); \
-+  TREE_GET_BIT(probs, i); \
-+  TREE_GET_BIT(probs, i); \
-+  TREE_GET_BIT(probs, i); \
-+  TREE_GET_BIT(probs, i); \
-+  TREE_GET_BIT(probs, i); \
-+  i -= 0x40; }
-+#endif
-+
-+#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
-+
-+#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * ttt; if (code < bound)
-+#define UPDATE_0_CHECK range = bound;
-+#define UPDATE_1_CHECK range -= bound; code -= bound;
-+#define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
-+  { UPDATE_0_CHECK; i = (i + i); A0; } else \
-+  { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
-+#define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
-+#define TREE_DECODE_CHECK(probs, limit, i) \
-+  { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
-+
-+
-+#define kNumPosBitsMax 4
-+#define kNumPosStatesMax (1 << kNumPosBitsMax)
-+
-+#define kLenNumLowBits 3
-+#define kLenNumLowSymbols (1 << kLenNumLowBits)
-+#define kLenNumMidBits 3
-+#define kLenNumMidSymbols (1 << kLenNumMidBits)
-+#define kLenNumHighBits 8
-+#define kLenNumHighSymbols (1 << kLenNumHighBits)
-+
-+#define LenChoice 0
-+#define LenChoice2 (LenChoice + 1)
-+#define LenLow (LenChoice2 + 1)
-+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
-+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
-+
-+
-+#define kNumStates 12
-+#define kNumLitStates 7
-+
-+#define kStartPosModelIndex 4
-+#define kEndPosModelIndex 14
-+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-+
-+#define kNumPosSlotBits 6
-+#define kNumLenToPosStates 4
-+
-+#define kNumAlignBits 4
-+#define kAlignTableSize (1 << kNumAlignBits)
-+
-+#define kMatchMinLen 2
-+#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-+
-+#define IsMatch 0
-+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
-+#define IsRepG0 (IsRep + kNumStates)
-+#define IsRepG1 (IsRepG0 + kNumStates)
-+#define IsRepG2 (IsRepG1 + kNumStates)
-+#define IsRep0Long (IsRepG2 + kNumStates)
-+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
-+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
-+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
-+#define LenCoder (Align + kAlignTableSize)
-+#define RepLenCoder (LenCoder + kNumLenProbs)
-+#define Literal (RepLenCoder + kNumLenProbs)
-+
-+#define LZMA_BASE_SIZE 1846
-+#define LZMA_LIT_SIZE 768
-+
-+#define LzmaProps_GetNumProbs(p) ((UInt32)LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((p)->lc + (p)->lp)))
-+
-+#if Literal != LZMA_BASE_SIZE
-+StopCompilingDueBUG
-+#endif
-+
-+#define LZMA_DIC_MIN (1 << 12)
-+
-+/* First LZMA-symbol is always decoded.
-+And it decodes new LZMA-symbols while (buf < bufLimit), but "buf" is without last normalization
-+Out:
-+  Result:
-+    SZ_OK - OK
-+    SZ_ERROR_DATA - Error
-+  p->remainLen:
-+    < kMatchSpecLenStart : normal remain
-+    = kMatchSpecLenStart : finished
-+    = kMatchSpecLenStart + 1 : Flush marker
-+    = kMatchSpecLenStart + 2 : State Init Marker
-+*/
-+
-+static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
-+{
-+  CLzmaProb *probs = p->probs;
-+
-+  unsigned state = p->state;
-+  UInt32 rep0 = p->reps[0], rep1 = p->reps[1], rep2 = p->reps[2], rep3 = p->reps[3];
-+  unsigned pbMask = ((unsigned)1 << (p->prop.pb)) - 1;
-+  unsigned lpMask = ((unsigned)1 << (p->prop.lp)) - 1;
-+  unsigned lc = p->prop.lc;
-+
-+  Byte *dic = p->dic;
-+  SizeT dicBufSize = p->dicBufSize;
-+  SizeT dicPos = p->dicPos;
-+  
-+  UInt32 processedPos = p->processedPos;
-+  UInt32 checkDicSize = p->checkDicSize;
-+  unsigned len = 0;
-+
-+  const Byte *buf = p->buf;
-+  UInt32 range = p->range;
-+  UInt32 code = p->code;
-+
-+  do
-+  {
-+    CLzmaProb *prob;
-+    UInt32 bound;
-+    unsigned ttt;
-+    unsigned posState = processedPos & pbMask;
-+
-+    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
-+    IF_BIT_0(prob)
-+    {
-+      unsigned symbol;
-+      UPDATE_0(prob);
-+      prob = probs + Literal;
-+      if (checkDicSize != 0 || processedPos != 0)
-+        prob += (LZMA_LIT_SIZE * (((processedPos & lpMask) << lc) +
-+        (dic[(dicPos == 0 ? dicBufSize : dicPos) - 1] >> (8 - lc))));
-+
-+      if (state < kNumLitStates)
-+      {
-+        state -= (state < 4) ? state : 3;
-+        symbol = 1;
-+        do { GET_BIT(prob + symbol, symbol) } while (symbol < 0x100);
-+      }
-+      else
-+      {
-+        unsigned matchByte = p->dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
-+        unsigned offs = 0x100;
-+        state -= (state < 10) ? 3 : 6;
-+        symbol = 1;
-+        do
-+        {
-+          unsigned bit;
-+          CLzmaProb *probLit;
-+          matchByte <<= 1;
-+          bit = (matchByte & offs);
-+          probLit = prob + offs + bit + symbol;
-+          GET_BIT2(probLit, symbol, offs &= ~bit, offs &= bit)
-+        }
-+        while (symbol < 0x100);
-+      }
-+      dic[dicPos++] = (Byte)symbol;
-+      processedPos++;
-+      continue;
-+    }
-+    else
-+    {
-+      UPDATE_1(prob);
-+      prob = probs + IsRep + state;
-+      IF_BIT_0(prob)
-+      {
-+        UPDATE_0(prob);
-+        state += kNumStates;
-+        prob = probs + LenCoder;
-+      }
-+      else
-+      {
-+        UPDATE_1(prob);
-+        if (checkDicSize == 0 && processedPos == 0)
-+          return SZ_ERROR_DATA;
-+        prob = probs + IsRepG0 + state;
-+        IF_BIT_0(prob)
-+        {
-+          UPDATE_0(prob);
-+          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
-+          IF_BIT_0(prob)
-+          {
-+            UPDATE_0(prob);
-+            dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
-+            dicPos++;
-+            processedPos++;
-+            state = state < kNumLitStates ? 9 : 11;
-+            continue;
-+          }
-+          UPDATE_1(prob);
-+        }
-+        else
-+        {
-+          UInt32 distance;
-+          UPDATE_1(prob);
-+          prob = probs + IsRepG1 + state;
-+          IF_BIT_0(prob)
-+          {
-+            UPDATE_0(prob);
-+            distance = rep1;
-+          }
-+          else
-+          {
-+            UPDATE_1(prob);
-+            prob = probs + IsRepG2 + state;
-+            IF_BIT_0(prob)
-+            {
-+              UPDATE_0(prob);
-+              distance = rep2;
-+            }
-+            else
-+            {
-+              UPDATE_1(prob);
-+              distance = rep3;
-+              rep3 = rep2;
-+            }
-+            rep2 = rep1;
-+          }
-+          rep1 = rep0;
-+          rep0 = distance;
-+        }
-+        state = state < kNumLitStates ? 8 : 11;
-+        prob = probs + RepLenCoder;
-+      }
-+      {
-+        unsigned limit, offset;
-+        CLzmaProb *probLen = prob + LenChoice;
-+        IF_BIT_0(probLen)
-+        {
-+          UPDATE_0(probLen);
-+          probLen = prob + LenLow + (posState << kLenNumLowBits);
-+          offset = 0;
-+          limit = (1 << kLenNumLowBits);
-+        }
-+        else
-+        {
-+          UPDATE_1(probLen);
-+          probLen = prob + LenChoice2;
-+          IF_BIT_0(probLen)
-+          {
-+            UPDATE_0(probLen);
-+            probLen = prob + LenMid + (posState << kLenNumMidBits);
-+            offset = kLenNumLowSymbols;
-+            limit = (1 << kLenNumMidBits);
-+          }
-+          else
-+          {
-+            UPDATE_1(probLen);
-+            probLen = prob + LenHigh;
-+            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-+            limit = (1 << kLenNumHighBits);
-+          }
-+        }
-+        TREE_DECODE(probLen, limit, len);
-+        len += offset;
-+      }
-+
-+      if (state >= kNumStates)
-+      {
-+        UInt32 distance;
-+        prob = probs + PosSlot +
-+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
-+        TREE_6_DECODE(prob, distance);
-+        if (distance >= kStartPosModelIndex)
-+        {
-+          unsigned posSlot = (unsigned)distance;
-+          int numDirectBits = (int)(((distance >> 1) - 1));
-+          distance = (2 | (distance & 1));
-+          if (posSlot < kEndPosModelIndex)
-+          {
-+            distance <<= numDirectBits;
-+            prob = probs + SpecPos + distance - posSlot - 1;
-+            {
-+              UInt32 mask = 1;
-+              unsigned i = 1;
-+              do
-+              {
-+                GET_BIT2(prob + i, i, ; , distance |= mask);
-+                mask <<= 1;
-+              }
-+              while (--numDirectBits != 0);
-+            }
-+          }
-+          else
-+          {
-+            numDirectBits -= kNumAlignBits;
-+            do
-+            {
-+              NORMALIZE
-+              range >>= 1;
-+              
-+              {
-+                UInt32 t;
-+                code -= range;
-+                t = (0 - ((UInt32)code >> 31)); /* (UInt32)((Int32)code >> 31) */
-+                distance = (distance << 1) + (t + 1);
-+                code += range & t;
-+              }
-+              /*
-+              distance <<= 1;
-+              if (code >= range)
-+              {
-+                code -= range;
-+                distance |= 1;
-+              }
-+              */
-+            }
-+            while (--numDirectBits != 0);
-+            prob = probs + Align;
-+            distance <<= kNumAlignBits;
-+            {
-+              unsigned i = 1;
-+              GET_BIT2(prob + i, i, ; , distance |= 1);
-+              GET_BIT2(prob + i, i, ; , distance |= 2);
-+              GET_BIT2(prob + i, i, ; , distance |= 4);
-+              GET_BIT2(prob + i, i, ; , distance |= 8);
-+            }
-+            if (distance == (UInt32)0xFFFFFFFF)
-+            {
-+              len += kMatchSpecLenStart;
-+              state -= kNumStates;
-+              break;
-+            }
-+          }
-+        }
-+        rep3 = rep2;
-+        rep2 = rep1;
-+        rep1 = rep0;
-+        rep0 = distance + 1;
-+        if (checkDicSize == 0)
-+        {
-+          if (distance >= processedPos)
-+            return SZ_ERROR_DATA;
-+        }
-+        else if (distance >= checkDicSize)
-+          return SZ_ERROR_DATA;
-+        state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
-+      }
-+
-+      len += kMatchMinLen;
-+
-+      if (limit == dicPos)
-+        return SZ_ERROR_DATA;
-+      {
-+        SizeT rem = limit - dicPos;
-+        unsigned curLen = ((rem < len) ? (unsigned)rem : len);
-+        SizeT pos = (dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0);
-+
-+        processedPos += curLen;
-+
-+        len -= curLen;
-+        if (pos + curLen <= dicBufSize)
-+        {
-+          Byte *dest = dic + dicPos;
-+          ptrdiff_t src = (ptrdiff_t)pos - (ptrdiff_t)dicPos;
-+          const Byte *lim = dest + curLen;
-+          dicPos += curLen;
-+          do
-+            *(dest) = (Byte)*(dest + src);
-+          while (++dest != lim);
-+        }
-+        else
-+        {
-+          do
-+          {
-+            dic[dicPos++] = dic[pos];
-+            if (++pos == dicBufSize)
-+              pos = 0;
-+          }
-+          while (--curLen != 0);
-+        }
-+      }
-+    }
-+  }
-+  while (dicPos < limit && buf < bufLimit);
-+  NORMALIZE;
-+  p->buf = buf;
-+  p->range = range;
-+  p->code = code;
-+  p->remainLen = len;
-+  p->dicPos = dicPos;
-+  p->processedPos = processedPos;
-+  p->reps[0] = rep0;
-+  p->reps[1] = rep1;
-+  p->reps[2] = rep2;
-+  p->reps[3] = rep3;
-+  p->state = state;
-+
-+  return SZ_OK;
-+}
-+
-+static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
-+{
-+  if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
-+  {
-+    Byte *dic = p->dic;
-+    SizeT dicPos = p->dicPos;
-+    SizeT dicBufSize = p->dicBufSize;
-+    unsigned len = p->remainLen;
-+    UInt32 rep0 = p->reps[0];
-+    if (limit - dicPos < len)
-+      len = (unsigned)(limit - dicPos);
-+
-+    if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
-+      p->checkDicSize = p->prop.dicSize;
-+
-+    p->processedPos += len;
-+    p->remainLen -= len;
-+    while (len-- != 0)
-+    {
-+      dic[dicPos] = dic[(dicPos - rep0) + ((dicPos < rep0) ? dicBufSize : 0)];
-+      dicPos++;
-+    }
-+    p->dicPos = dicPos;
-+  }
-+}
-+
-+static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
-+{
-+  do
-+  {
-+    SizeT limit2 = limit;
-+    if (p->checkDicSize == 0)
-+    {
-+      UInt32 rem = p->prop.dicSize - p->processedPos;
-+      if (limit - p->dicPos > rem)
-+        limit2 = p->dicPos + rem;
-+    }
-+    RINOK(LzmaDec_DecodeReal(p, limit2, bufLimit));
-+    if (p->processedPos >= p->prop.dicSize)
-+      p->checkDicSize = p->prop.dicSize;
-+    LzmaDec_WriteRem(p, limit);
-+  }
-+  while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
-+
-+  if (p->remainLen > kMatchSpecLenStart)
-+  {
-+    p->remainLen = kMatchSpecLenStart;
-+  }
-+  return 0;
-+}
-+
-+typedef enum
-+{
-+  DUMMY_ERROR, /* unexpected end of input stream */
-+  DUMMY_LIT,
-+  DUMMY_MATCH,
-+  DUMMY_REP
-+} ELzmaDummy;
-+
-+static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
-+{
-+  UInt32 range = p->range;
-+  UInt32 code = p->code;
-+  const Byte *bufLimit = buf + inSize;
-+  CLzmaProb *probs = p->probs;
-+  unsigned state = p->state;
-+  ELzmaDummy res;
-+
-+  {
-+    CLzmaProb *prob;
-+    UInt32 bound;
-+    unsigned ttt;
-+    unsigned posState = (p->processedPos) & ((1 << p->prop.pb) - 1);
-+
-+    prob = probs + IsMatch + (state << kNumPosBitsMax) + posState;
-+    IF_BIT_0_CHECK(prob)
-+    {
-+      UPDATE_0_CHECK
-+
-+      /* if (bufLimit - buf >= 7) return DUMMY_LIT; */
-+
-+      prob = probs + Literal;
-+      if (p->checkDicSize != 0 || p->processedPos != 0)
-+        prob += (LZMA_LIT_SIZE *
-+          ((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
-+          (p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
-+
-+      if (state < kNumLitStates)
-+      {
-+        unsigned symbol = 1;
-+        do { GET_BIT_CHECK(prob + symbol, symbol) } while (symbol < 0x100);
-+      }
-+      else
-+      {
-+        unsigned matchByte = p->dic[p->dicPos - p->reps[0] +
-+            ((p->dicPos < p->reps[0]) ? p->dicBufSize : 0)];
-+        unsigned offs = 0x100;
-+        unsigned symbol = 1;
-+        do
-+        {
-+          unsigned bit;
-+          CLzmaProb *probLit;
-+          matchByte <<= 1;
-+          bit = (matchByte & offs);
-+          probLit = prob + offs + bit + symbol;
-+          GET_BIT2_CHECK(probLit, symbol, offs &= ~bit, offs &= bit)
-+        }
-+        while (symbol < 0x100);
-+      }
-+      res = DUMMY_LIT;
-+    }
-+    else
-+    {
-+      unsigned len;
-+      UPDATE_1_CHECK;
-+
-+      prob = probs + IsRep + state;
-+      IF_BIT_0_CHECK(prob)
-+      {
-+        UPDATE_0_CHECK;
-+        state = 0;
-+        prob = probs + LenCoder;
-+        res = DUMMY_MATCH;
-+      }
-+      else
-+      {
-+        UPDATE_1_CHECK;
-+        res = DUMMY_REP;
-+        prob = probs + IsRepG0 + state;
-+        IF_BIT_0_CHECK(prob)
-+        {
-+          UPDATE_0_CHECK;
-+          prob = probs + IsRep0Long + (state << kNumPosBitsMax) + posState;
-+          IF_BIT_0_CHECK(prob)
-+          {
-+            UPDATE_0_CHECK;
-+            NORMALIZE_CHECK;
-+            return DUMMY_REP;
-+          }
-+          else
-+          {
-+            UPDATE_1_CHECK;
-+          }
-+        }
-+        else
-+        {
-+          UPDATE_1_CHECK;
-+          prob = probs + IsRepG1 + state;
-+          IF_BIT_0_CHECK(prob)
-+          {
-+            UPDATE_0_CHECK;
-+          }
-+          else
-+          {
-+            UPDATE_1_CHECK;
-+            prob = probs + IsRepG2 + state;
-+            IF_BIT_0_CHECK(prob)
-+            {
-+              UPDATE_0_CHECK;
-+            }
-+            else
-+            {
-+              UPDATE_1_CHECK;
-+            }
-+          }
-+        }
-+        state = kNumStates;
-+        prob = probs + RepLenCoder;
-+      }
-+      {
-+        unsigned limit, offset;
-+        CLzmaProb *probLen = prob + LenChoice;
-+        IF_BIT_0_CHECK(probLen)
-+        {
-+          UPDATE_0_CHECK;
-+          probLen = prob + LenLow + (posState << kLenNumLowBits);
-+          offset = 0;
-+          limit = 1 << kLenNumLowBits;
-+        }
-+        else
-+        {
-+          UPDATE_1_CHECK;
-+          probLen = prob + LenChoice2;
-+          IF_BIT_0_CHECK(probLen)
-+          {
-+            UPDATE_0_CHECK;
-+            probLen = prob + LenMid + (posState << kLenNumMidBits);
-+            offset = kLenNumLowSymbols;
-+            limit = 1 << kLenNumMidBits;
-+          }
-+          else
-+          {
-+            UPDATE_1_CHECK;
-+            probLen = prob + LenHigh;
-+            offset = kLenNumLowSymbols + kLenNumMidSymbols;
-+            limit = 1 << kLenNumHighBits;
-+          }
-+        }
-+        TREE_DECODE_CHECK(probLen, limit, len);
-+        len += offset;
-+      }
-+
-+      if (state < 4)
-+      {
-+        unsigned posSlot;
-+        prob = probs + PosSlot +
-+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
-+            kNumPosSlotBits);
-+        TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
-+        if (posSlot >= kStartPosModelIndex)
-+        {
-+          int numDirectBits = ((posSlot >> 1) - 1);
-+
-+          /* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
-+
-+          if (posSlot < kEndPosModelIndex)
-+          {
-+            prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits) - posSlot - 1;
-+          }
-+          else
-+          {
-+            numDirectBits -= kNumAlignBits;
-+            do
-+            {
-+              NORMALIZE_CHECK
-+              range >>= 1;
-+              code -= range & (((code - range) >> 31) - 1);
-+              /* if (code >= range) code -= range; */
-+            }
-+            while (--numDirectBits != 0);
-+            prob = probs + Align;
-+            numDirectBits = kNumAlignBits;
-+          }
-+          {
-+            unsigned i = 1;
-+            do
-+            {
-+              GET_BIT_CHECK(prob + i, i);
-+            }
-+            while (--numDirectBits != 0);
-+          }
-+        }
-+      }
-+    }
-+  }
-+  NORMALIZE_CHECK;
-+  return res;
-+}
-+
-+
-+static void LzmaDec_InitRc(CLzmaDec *p, const Byte *data)
-+{
-+  p->code = ((UInt32)data[1] << 24) | ((UInt32)data[2] << 16) | ((UInt32)data[3] << 8) | ((UInt32)data[4]);
-+  p->range = 0xFFFFFFFF;
-+  p->needFlush = 0;
-+}
-+
-+void LzmaDec_InitDicAndState(CLzmaDec *p, Bool initDic, Bool initState)
-+{
-+  p->needFlush = 1;
-+  p->remainLen = 0;
-+  p->tempBufSize = 0;
-+
-+  if (initDic)
-+  {
-+    p->processedPos = 0;
-+    p->checkDicSize = 0;
-+    p->needInitState = 1;
-+  }
-+  if (initState)
-+    p->needInitState = 1;
-+}
-+
-+void LzmaDec_Init(CLzmaDec *p)
-+{
-+  p->dicPos = 0;
-+  LzmaDec_InitDicAndState(p, True, True);
-+}
-+
-+static void LzmaDec_InitStateReal(CLzmaDec *p)
-+{
-+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (p->prop.lc + p->prop.lp));
-+  UInt32 i;
-+  CLzmaProb *probs = p->probs;
-+  for (i = 0; i < numProbs; i++)
-+    probs[i] = kBitModelTotal >> 1;
-+  p->reps[0] = p->reps[1] = p->reps[2] = p->reps[3] = 1;
-+  p->state = 0;
-+  p->needInitState = 0;
-+}
-+
-+SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
-+    ELzmaFinishMode finishMode, ELzmaStatus *status)
-+{
-+  SizeT inSize = *srcLen;
-+  (*srcLen) = 0;
-+  LzmaDec_WriteRem(p, dicLimit);
-+  
-+  *status = LZMA_STATUS_NOT_SPECIFIED;
-+
-+  while (p->remainLen != kMatchSpecLenStart)
-+  {
-+      int checkEndMarkNow;
-+
-+      if (p->needFlush != 0)
-+      {
-+        for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
-+          p->tempBuf[p->tempBufSize++] = *src++;
-+        if (p->tempBufSize < RC_INIT_SIZE)
-+        {
-+          *status = LZMA_STATUS_NEEDS_MORE_INPUT;
-+          return SZ_OK;
-+        }
-+        if (p->tempBuf[0] != 0)
-+          return SZ_ERROR_DATA;
-+
-+        LzmaDec_InitRc(p, p->tempBuf);
-+        p->tempBufSize = 0;
-+      }
-+
-+      checkEndMarkNow = 0;
-+      if (p->dicPos >= dicLimit)
-+      {
-+        if (p->remainLen == 0 && p->code == 0)
-+        {
-+          *status = LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK;
-+          return SZ_OK;
-+        }
-+        if (finishMode == LZMA_FINISH_ANY)
-+        {
-+          *status = LZMA_STATUS_NOT_FINISHED;
-+          return SZ_OK;
-+        }
-+        if (p->remainLen != 0)
-+        {
-+          *status = LZMA_STATUS_NOT_FINISHED;
-+          return SZ_ERROR_DATA;
-+        }
-+        checkEndMarkNow = 1;
-+      }
-+
-+      if (p->needInitState)
-+        LzmaDec_InitStateReal(p);
-+  
-+      if (p->tempBufSize == 0)
-+      {
-+        SizeT processed;
-+        const Byte *bufLimit;
-+        if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
-+        {
-+          int dummyRes = LzmaDec_TryDummy(p, src, inSize);
-+          if (dummyRes == DUMMY_ERROR)
-+          {
-+            memcpy(p->tempBuf, src, inSize);
-+            p->tempBufSize = (unsigned)inSize;
-+            (*srcLen) += inSize;
-+            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
-+            return SZ_OK;
-+          }
-+          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
-+          {
-+            *status = LZMA_STATUS_NOT_FINISHED;
-+            return SZ_ERROR_DATA;
-+          }
-+          bufLimit = src;
-+        }
-+        else
-+          bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
-+        p->buf = src;
-+        if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
-+          return SZ_ERROR_DATA;
-+        processed = (SizeT)(p->buf - src);
-+        (*srcLen) += processed;
-+        src += processed;
-+        inSize -= processed;
-+      }
-+      else
-+      {
-+        unsigned rem = p->tempBufSize, lookAhead = 0;
-+        while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
-+          p->tempBuf[rem++] = src[lookAhead++];
-+        p->tempBufSize = rem;
-+        if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
-+        {
-+          int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, rem);
-+          if (dummyRes == DUMMY_ERROR)
-+          {
-+            (*srcLen) += lookAhead;
-+            *status = LZMA_STATUS_NEEDS_MORE_INPUT;
-+            return SZ_OK;
-+          }
-+          if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
-+          {
-+            *status = LZMA_STATUS_NOT_FINISHED;
-+            return SZ_ERROR_DATA;
-+          }
-+        }
-+        p->buf = p->tempBuf;
-+        if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
-+          return SZ_ERROR_DATA;
-+        lookAhead -= (rem - (unsigned)(p->buf - p->tempBuf));
-+        (*srcLen) += lookAhead;
-+        src += lookAhead;
-+        inSize -= lookAhead;
-+        p->tempBufSize = 0;
-+      }
-+  }
-+  if (p->code == 0)
-+    *status = LZMA_STATUS_FINISHED_WITH_MARK;
-+  return (p->code == 0) ? SZ_OK : SZ_ERROR_DATA;
-+}
-+
-+SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
-+{
-+  SizeT outSize = *destLen;
-+  SizeT inSize = *srcLen;
-+  *srcLen = *destLen = 0;
-+  for (;;)
-+  {
-+    SizeT inSizeCur = inSize, outSizeCur, dicPos;
-+    ELzmaFinishMode curFinishMode;
-+    SRes res;
-+    if (p->dicPos == p->dicBufSize)
-+      p->dicPos = 0;
-+    dicPos = p->dicPos;
-+    if (outSize > p->dicBufSize - dicPos)
-+    {
-+      outSizeCur = p->dicBufSize;
-+      curFinishMode = LZMA_FINISH_ANY;
-+    }
-+    else
-+    {
-+      outSizeCur = dicPos + outSize;
-+      curFinishMode = finishMode;
-+    }
-+
-+    res = LzmaDec_DecodeToDic(p, outSizeCur, src, &inSizeCur, curFinishMode, status);
-+    src += inSizeCur;
-+    inSize -= inSizeCur;
-+    *srcLen += inSizeCur;
-+    outSizeCur = p->dicPos - dicPos;
-+    memcpy(dest, p->dic + dicPos, outSizeCur);
-+    dest += outSizeCur;
-+    outSize -= outSizeCur;
-+    *destLen += outSizeCur;
-+    if (res != 0)
-+      return res;
-+    if (outSizeCur == 0 || outSize == 0)
-+      return SZ_OK;
-+  }
-+}
-+
-+void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
-+{
-+  alloc->Free(alloc, p->probs);
-+  p->probs = 0;
-+}
-+
-+static void LzmaDec_FreeDict(CLzmaDec *p, ISzAlloc *alloc)
-+{
-+  alloc->Free(alloc, p->dic);
-+  p->dic = 0;
-+}
-+
-+void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
-+{
-+  LzmaDec_FreeProbs(p, alloc);
-+  LzmaDec_FreeDict(p, alloc);
-+}
-+
-+SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size)
-+{
-+  UInt32 dicSize;
-+  Byte d;
-+  
-+  if (size < LZMA_PROPS_SIZE)
-+    return SZ_ERROR_UNSUPPORTED;
-+  else
-+    dicSize = data[1] | ((UInt32)data[2] << 8) | ((UInt32)data[3] << 16) | ((UInt32)data[4] << 24);
-+ 
-+  if (dicSize < LZMA_DIC_MIN)
-+    dicSize = LZMA_DIC_MIN;
-+  p->dicSize = dicSize;
-+
-+  d = data[0];
-+  if (d >= (9 * 5 * 5))
-+    return SZ_ERROR_UNSUPPORTED;
-+
-+  p->lc = d % 9;
-+  d /= 9;
-+  p->pb = d / 5;
-+  p->lp = d % 5;
-+
-+  return SZ_OK;
-+}
-+
-+static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const CLzmaProps *propNew, ISzAlloc *alloc)
-+{
-+  UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
-+  if (p->probs == 0 || numProbs != p->numProbs)
-+  {
-+    LzmaDec_FreeProbs(p, alloc);
-+    p->probs = (CLzmaProb *)alloc->Alloc(alloc, numProbs * sizeof(CLzmaProb));
-+    p->numProbs = numProbs;
-+    if (p->probs == 0)
-+      return SZ_ERROR_MEM;
-+  }
-+  return SZ_OK;
-+}
-+
-+SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
-+{
-+  CLzmaProps propNew;
-+  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
-+  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
-+  p->prop = propNew;
-+  return SZ_OK;
-+}
-+
-+SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
-+{
-+  CLzmaProps propNew;
-+  SizeT dicBufSize;
-+  RINOK(LzmaProps_Decode(&propNew, props, propsSize));
-+  RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
-+  dicBufSize = propNew.dicSize;
-+  if (p->dic == 0 || dicBufSize != p->dicBufSize)
-+  {
-+    LzmaDec_FreeDict(p, alloc);
-+    p->dic = (Byte *)alloc->Alloc(alloc, dicBufSize);
-+    if (p->dic == 0)
-+    {
-+      LzmaDec_FreeProbs(p, alloc);
-+      return SZ_ERROR_MEM;
-+    }
-+  }
-+  p->dicBufSize = dicBufSize;
-+  p->prop = propNew;
-+  return SZ_OK;
-+}
-+
-+SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
-+    const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
-+    ELzmaStatus *status, ISzAlloc *alloc)
-+{
-+  CLzmaDec p;
-+  SRes res;
-+  SizeT inSize = *srcLen;
-+  SizeT outSize = *destLen;
-+  *srcLen = *destLen = 0;
-+  if (inSize < RC_INIT_SIZE)
-+    return SZ_ERROR_INPUT_EOF;
-+
-+  LzmaDec_Construct(&p);
-+  res = LzmaDec_AllocateProbs(&p, propData, propSize, alloc);
-+  if (res != 0)
-+    return res;
-+  p.dic = dest;
-+  p.dicBufSize = outSize;
-+
-+  LzmaDec_Init(&p);
-+  
-+  *srcLen = inSize;
-+  res = LzmaDec_DecodeToDic(&p, outSize, src, srcLen, finishMode, status);
-+
-+  if (res == SZ_OK && *status == LZMA_STATUS_NEEDS_MORE_INPUT)
-+    res = SZ_ERROR_INPUT_EOF;
-+
-+  (*destLen) = p.dicPos;
-+  LzmaDec_FreeProbs(&p, alloc);
-+  return res;
-+}
---- /dev/null
-+++ b/lib/lzma/LzmaEnc.c
-@@ -0,0 +1,2271 @@
-+/* LzmaEnc.c -- LZMA Encoder
-+2009-11-24 : Igor Pavlov : Public domain */
-+
-+#include <string.h>
-+
-+/* #define SHOW_STAT */
-+/* #define SHOW_STAT2 */
-+
-+#if defined(SHOW_STAT) || defined(SHOW_STAT2)
-+#include <stdio.h>
-+#endif
-+
-+#include "LzmaEnc.h"
-+
-+/* disable MT */
-+#define _7ZIP_ST
-+
-+#include "LzFind.h"
-+#ifndef _7ZIP_ST
-+#include "LzFindMt.h"
-+#endif
-+
-+#ifdef SHOW_STAT
-+static int ttt = 0;
-+#endif
-+
-+#define kBlockSizeMax ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1)
-+
-+#define kBlockSize (9 << 10)
-+#define kUnpackBlockSize (1 << 18)
-+#define kMatchArraySize (1 << 21)
-+#define kMatchRecordMaxSize ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX)
-+
-+#define kNumMaxDirectBits (31)
-+
-+#define kNumTopBits 24
-+#define kTopValue ((UInt32)1 << kNumTopBits)
-+
-+#define kNumBitModelTotalBits 11
-+#define kBitModelTotal (1 << kNumBitModelTotalBits)
-+#define kNumMoveBits 5
-+#define kProbInitValue (kBitModelTotal >> 1)
-+
-+#define kNumMoveReducingBits 4
-+#define kNumBitPriceShiftBits 4
-+#define kBitPrice (1 << kNumBitPriceShiftBits)
-+
-+void LzmaEncProps_Init(CLzmaEncProps *p)
-+{
-+  p->level = 5;
-+  p->dictSize = p->mc = 0;
-+  p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
-+  p->writeEndMark = 0;
-+}
-+
-+void LzmaEncProps_Normalize(CLzmaEncProps *p)
-+{
-+  int level = p->level;
-+  if (level < 0) level = 5;
-+  p->level = level;
-+  if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)));
-+  if (p->lc < 0) p->lc = 3;
-+  if (p->lp < 0) p->lp = 0;
-+  if (p->pb < 0) p->pb = 2;
-+  if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
-+  if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
-+  if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
-+  if (p->numHashBytes < 0) p->numHashBytes = 4;
-+  if (p->mc == 0)  p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
-+  if (p->numThreads < 0)
-+    p->numThreads =
-+      #ifndef _7ZIP_ST
-+      ((p->btMode && p->algo) ? 2 : 1);
-+      #else
-+      1;
-+      #endif
-+}
-+
-+UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
-+{
-+  CLzmaEncProps props = *props2;
-+  LzmaEncProps_Normalize(&props);
-+  return props.dictSize;
-+}
-+
-+/* #define LZMA_LOG_BSR */
-+/* Define it for Intel's CPU */
-+
-+
-+#ifdef LZMA_LOG_BSR
-+
-+#define kDicLogSizeMaxCompress 30
-+
-+#define BSR2_RET(pos, res) { unsigned long i; _BitScanReverse(&i, (pos)); res = (i + i) + ((pos >> (i - 1)) & 1); }
-+
-+UInt32 GetPosSlot1(UInt32 pos)
-+{
-+  UInt32 res;
-+  BSR2_RET(pos, res);
-+  return res;
-+}
-+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-+#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
-+
-+#else
-+
-+#define kNumLogBits (9 + (int)sizeof(size_t) / 2)
-+#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
-+
-+void LzmaEnc_FastPosInit(Byte *g_FastPos)
-+{
-+  int c = 2, slotFast;
-+  g_FastPos[0] = 0;
-+  g_FastPos[1] = 1;
-+  
-+  for (slotFast = 2; slotFast < kNumLogBits * 2; slotFast++)
-+  {
-+    UInt32 k = (1 << ((slotFast >> 1) - 1));
-+    UInt32 j;
-+    for (j = 0; j < k; j++, c++)
-+      g_FastPos[c] = (Byte)slotFast;
-+  }
-+}
-+
-+#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \
-+  (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
-+  res = p->g_FastPos[pos >> i] + (i * 2); }
-+/*
-+#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
-+  p->g_FastPos[pos >> 6] + 12 : \
-+  p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; }
-+*/
-+
-+#define GetPosSlot1(pos) p->g_FastPos[pos]
-+#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
-+#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos]; else BSR2_RET(pos, res); }
-+
-+#endif
-+
-+
-+#define LZMA_NUM_REPS 4
-+
-+typedef unsigned CState;
-+
-+typedef struct
-+{
-+  UInt32 price;
-+
-+  CState state;
-+  int prev1IsChar;
-+  int prev2;
-+
-+  UInt32 posPrev2;
-+  UInt32 backPrev2;
-+
-+  UInt32 posPrev;
-+  UInt32 backPrev;
-+  UInt32 backs[LZMA_NUM_REPS];
-+} COptimal;
-+
-+#define kNumOpts (1 << 12)
-+
-+#define kNumLenToPosStates 4
-+#define kNumPosSlotBits 6
-+#define kDicLogSizeMin 0
-+#define kDicLogSizeMax 32
-+#define kDistTableSizeMax (kDicLogSizeMax * 2)
-+
-+
-+#define kNumAlignBits 4
-+#define kAlignTableSize (1 << kNumAlignBits)
-+#define kAlignMask (kAlignTableSize - 1)
-+
-+#define kStartPosModelIndex 4
-+#define kEndPosModelIndex 14
-+#define kNumPosModels (kEndPosModelIndex - kStartPosModelIndex)
-+
-+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
-+
-+#ifdef _LZMA_PROB32
-+#define CLzmaProb UInt32
-+#else
-+#define CLzmaProb UInt16
-+#endif
-+
-+#define LZMA_PB_MAX 4
-+#define LZMA_LC_MAX 8
-+#define LZMA_LP_MAX 4
-+
-+#define LZMA_NUM_PB_STATES_MAX (1 << LZMA_PB_MAX)
-+
-+
-+#define kLenNumLowBits 3
-+#define kLenNumLowSymbols (1 << kLenNumLowBits)
-+#define kLenNumMidBits 3
-+#define kLenNumMidSymbols (1 << kLenNumMidBits)
-+#define kLenNumHighBits 8
-+#define kLenNumHighSymbols (1 << kLenNumHighBits)
-+
-+#define kLenNumSymbolsTotal (kLenNumLowSymbols + kLenNumMidSymbols + kLenNumHighSymbols)
-+
-+#define LZMA_MATCH_LEN_MIN 2
-+#define LZMA_MATCH_LEN_MAX (LZMA_MATCH_LEN_MIN + kLenNumSymbolsTotal - 1)
-+
-+#define kNumStates 12
-+
-+typedef struct
-+{
-+  CLzmaProb choice;
-+  CLzmaProb choice2;
-+  CLzmaProb low[LZMA_NUM_PB_STATES_MAX << kLenNumLowBits];
-+  CLzmaProb mid[LZMA_NUM_PB_STATES_MAX << kLenNumMidBits];
-+  CLzmaProb high[kLenNumHighSymbols];
-+} CLenEnc;
-+
-+typedef struct
-+{
-+  CLenEnc p;
-+  UInt32 prices[LZMA_NUM_PB_STATES_MAX][kLenNumSymbolsTotal];
-+  UInt32 tableSize;
-+  UInt32 counters[LZMA_NUM_PB_STATES_MAX];
-+} CLenPriceEnc;
-+
-+typedef struct
-+{
-+  UInt32 range;
-+  Byte cache;
-+  UInt64 low;
-+  UInt64 cacheSize;
-+  Byte *buf;
-+  Byte *bufLim;
-+  Byte *bufBase;
-+  ISeqOutStream *outStream;
-+  UInt64 processed;
-+  SRes res;
-+} CRangeEnc;
-+
-+typedef struct
-+{
-+  CLzmaProb *litProbs;
-+
-+  CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
-+  CLzmaProb isRep[kNumStates];
-+  CLzmaProb isRepG0[kNumStates];
-+  CLzmaProb isRepG1[kNumStates];
-+  CLzmaProb isRepG2[kNumStates];
-+  CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
-+
-+  CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
-+  CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
-+  CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-+  
-+  CLenPriceEnc lenEnc;
-+  CLenPriceEnc repLenEnc;
-+
-+  UInt32 reps[LZMA_NUM_REPS];
-+  UInt32 state;
-+} CSaveState;
-+
-+typedef struct
-+{
-+  IMatchFinder matchFinder;
-+  void *matchFinderObj;
-+
-+  #ifndef _7ZIP_ST
-+  Bool mtMode;
-+  CMatchFinderMt matchFinderMt;
-+  #endif
-+
-+  CMatchFinder matchFinderBase;
-+
-+  #ifndef _7ZIP_ST
-+  Byte pad[128];
-+  #endif
-+  
-+  UInt32 optimumEndIndex;
-+  UInt32 optimumCurrentIndex;
-+
-+  UInt32 longestMatchLength;
-+  UInt32 numPairs;
-+  UInt32 numAvail;
-+  COptimal opt[kNumOpts];
-+  
-+  #ifndef LZMA_LOG_BSR
-+  Byte g_FastPos[1 << kNumLogBits];
-+  #endif
-+
-+  UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
-+  UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
-+  UInt32 numFastBytes;
-+  UInt32 additionalOffset;
-+  UInt32 reps[LZMA_NUM_REPS];
-+  UInt32 state;
-+
-+  UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
-+  UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
-+  UInt32 alignPrices[kAlignTableSize];
-+  UInt32 alignPriceCount;
-+
-+  UInt32 distTableSize;
-+
-+  unsigned lc, lp, pb;
-+  unsigned lpMask, pbMask;
-+
-+  CLzmaProb *litProbs;
-+
-+  CLzmaProb isMatch[kNumStates][LZMA_NUM_PB_STATES_MAX];
-+  CLzmaProb isRep[kNumStates];
-+  CLzmaProb isRepG0[kNumStates];
-+  CLzmaProb isRepG1[kNumStates];
-+  CLzmaProb isRepG2[kNumStates];
-+  CLzmaProb isRep0Long[kNumStates][LZMA_NUM_PB_STATES_MAX];
-+
-+  CLzmaProb posSlotEncoder[kNumLenToPosStates][1 << kNumPosSlotBits];
-+  CLzmaProb posEncoders[kNumFullDistances - kEndPosModelIndex];
-+  CLzmaProb posAlignEncoder[1 << kNumAlignBits];
-+  
-+  CLenPriceEnc lenEnc;
-+  CLenPriceEnc repLenEnc;
-+
-+  unsigned lclp;
-+
-+  Bool fastMode;
-+  
-+  CRangeEnc rc;
-+
-+  Bool writeEndMark;
-+  UInt64 nowPos64;
-+  UInt32 matchPriceCount;
-+  Bool finished;
-+  Bool multiThread;
-+
-+  SRes result;
-+  UInt32 dictSize;
-+  UInt32 matchFinderCycles;
-+
-+  int needInit;
-+
-+  CSaveState saveState;
-+} CLzmaEnc;
-+
-+void LzmaEnc_SaveState(CLzmaEncHandle pp)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  CSaveState *dest = &p->saveState;
-+  int i;
-+  dest->lenEnc = p->lenEnc;
-+  dest->repLenEnc = p->repLenEnc;
-+  dest->state = p->state;
-+
-+  for (i = 0; i < kNumStates; i++)
-+  {
-+    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
-+    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
-+  }
-+  for (i = 0; i < kNumLenToPosStates; i++)
-+    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
-+  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
-+  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
-+  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
-+  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
-+  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
-+  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
-+  memcpy(dest->reps, p->reps, sizeof(p->reps));
-+  memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb));
-+}
-+
-+void LzmaEnc_RestoreState(CLzmaEncHandle pp)
-+{
-+  CLzmaEnc *dest = (CLzmaEnc *)pp;
-+  const CSaveState *p = &dest->saveState;
-+  int i;
-+  dest->lenEnc = p->lenEnc;
-+  dest->repLenEnc = p->repLenEnc;
-+  dest->state = p->state;
-+
-+  for (i = 0; i < kNumStates; i++)
-+  {
-+    memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i]));
-+    memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i]));
-+  }
-+  for (i = 0; i < kNumLenToPosStates; i++)
-+    memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i]));
-+  memcpy(dest->isRep, p->isRep, sizeof(p->isRep));
-+  memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0));
-+  memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1));
-+  memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2));
-+  memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders));
-+  memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder));
-+  memcpy(dest->reps, p->reps, sizeof(p->reps));
-+  memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb));
-+}
-+
-+SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  CLzmaEncProps props = *props2;
-+  LzmaEncProps_Normalize(&props);
-+
-+  if (props.lc > LZMA_LC_MAX || props.lp > LZMA_LP_MAX || props.pb > LZMA_PB_MAX ||
-+      props.dictSize > (1 << kDicLogSizeMaxCompress) || props.dictSize > (1 << 30))
-+    return SZ_ERROR_PARAM;
-+  p->dictSize = props.dictSize;
-+  p->matchFinderCycles = props.mc;
-+  {
-+    unsigned fb = props.fb;
-+    if (fb < 5)
-+      fb = 5;
-+    if (fb > LZMA_MATCH_LEN_MAX)
-+      fb = LZMA_MATCH_LEN_MAX;
-+    p->numFastBytes = fb;
-+  }
-+  p->lc = props.lc;
-+  p->lp = props.lp;
-+  p->pb = props.pb;
-+  p->fastMode = (props.algo == 0);
-+  p->matchFinderBase.btMode = props.btMode;
-+  {
-+    UInt32 numHashBytes = 4;
-+    if (props.btMode)
-+    {
-+      if (props.numHashBytes < 2)
-+        numHashBytes = 2;
-+      else if (props.numHashBytes < 4)
-+        numHashBytes = props.numHashBytes;
-+    }
-+    p->matchFinderBase.numHashBytes = numHashBytes;
-+  }
-+
-+  p->matchFinderBase.cutValue = props.mc;
-+
-+  p->writeEndMark = props.writeEndMark;
-+
-+  #ifndef _7ZIP_ST
-+  /*
-+  if (newMultiThread != _multiThread)
-+  {
-+    ReleaseMatchFinder();
-+    _multiThread = newMultiThread;
-+  }
-+  */
-+  p->multiThread = (props.numThreads > 1);
-+  #endif
-+
-+  return SZ_OK;
-+}
-+
-+static const int kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4,  5,  6,   4, 5};
-+static const int kMatchNextStates[kNumStates]   = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
-+static const int kRepNextStates[kNumStates]     = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
-+static const int kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
-+
-+#define IsCharState(s) ((s) < 7)
-+
-+#define GetLenToPosState(len) (((len) < kNumLenToPosStates + 1) ? (len) - 2 : kNumLenToPosStates - 1)
-+
-+#define kInfinityPrice (1 << 30)
-+
-+static void RangeEnc_Construct(CRangeEnc *p)
-+{
-+  p->outStream = 0;
-+  p->bufBase = 0;
-+}
-+
-+#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
-+
-+#define RC_BUF_SIZE (1 << 16)
-+static int RangeEnc_Alloc(CRangeEnc *p, ISzAlloc *alloc)
-+{
-+  if (p->bufBase == 0)
-+  {
-+    p->bufBase = (Byte *)alloc->Alloc(alloc, RC_BUF_SIZE);
-+    if (p->bufBase == 0)
-+      return 0;
-+    p->bufLim = p->bufBase + RC_BUF_SIZE;
-+  }
-+  return 1;
-+}
-+
-+static void RangeEnc_Free(CRangeEnc *p, ISzAlloc *alloc)
-+{
-+  alloc->Free(alloc, p->bufBase);
-+  p->bufBase = 0;
-+}
-+
-+static void RangeEnc_Init(CRangeEnc *p)
-+{
-+  /* Stream.Init(); */
-+  p->low = 0;
-+  p->range = 0xFFFFFFFF;
-+  p->cacheSize = 1;
-+  p->cache = 0;
-+
-+  p->buf = p->bufBase;
-+
-+  p->processed = 0;
-+  p->res = SZ_OK;
-+}
-+
-+static void RangeEnc_FlushStream(CRangeEnc *p)
-+{
-+  size_t num;
-+  if (p->res != SZ_OK)
-+    return;
-+  num = p->buf - p->bufBase;
-+  if (num != p->outStream->Write(p->outStream, p->bufBase, num))
-+    p->res = SZ_ERROR_WRITE;
-+  p->processed += num;
-+  p->buf = p->bufBase;
-+}
-+
-+static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
-+{
-+  if ((UInt32)p->low < (UInt32)0xFF000000 || (int)(p->low >> 32) != 0)
-+  {
-+    Byte temp = p->cache;
-+    do
-+    {
-+      Byte *buf = p->buf;
-+      *buf++ = (Byte)(temp + (Byte)(p->low >> 32));
-+      p->buf = buf;
-+      if (buf == p->bufLim)
-+        RangeEnc_FlushStream(p);
-+      temp = 0xFF;
-+    }
-+    while (--p->cacheSize != 0);
-+    p->cache = (Byte)((UInt32)p->low >> 24);
-+  }
-+  p->cacheSize++;
-+  p->low = (UInt32)p->low << 8;
-+}
-+
-+static void RangeEnc_FlushData(CRangeEnc *p)
-+{
-+  int i;
-+  for (i = 0; i < 5; i++)
-+    RangeEnc_ShiftLow(p);
-+}
-+
-+static void RangeEnc_EncodeDirectBits(CRangeEnc *p, UInt32 value, int numBits)
-+{
-+  do
-+  {
-+    p->range >>= 1;
-+    p->low += p->range & (0 - ((value >> --numBits) & 1));
-+    if (p->range < kTopValue)
-+    {
-+      p->range <<= 8;
-+      RangeEnc_ShiftLow(p);
-+    }
-+  }
-+  while (numBits != 0);
-+}
-+
-+static void RangeEnc_EncodeBit(CRangeEnc *p, CLzmaProb *prob, UInt32 symbol)
-+{
-+  UInt32 ttt = *prob;
-+  UInt32 newBound = (p->range >> kNumBitModelTotalBits) * ttt;
-+  if (symbol == 0)
-+  {
-+    p->range = newBound;
-+    ttt += (kBitModelTotal - ttt) >> kNumMoveBits;
-+  }
-+  else
-+  {
-+    p->low += newBound;
-+    p->range -= newBound;
-+    ttt -= ttt >> kNumMoveBits;
-+  }
-+  *prob = (CLzmaProb)ttt;
-+  if (p->range < kTopValue)
-+  {
-+    p->range <<= 8;
-+    RangeEnc_ShiftLow(p);
-+  }
-+}
-+
-+static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol)
-+{
-+  symbol |= 0x100;
-+  do
-+  {
-+    RangeEnc_EncodeBit(p, probs + (symbol >> 8), (symbol >> 7) & 1);
-+    symbol <<= 1;
-+  }
-+  while (symbol < 0x10000);
-+}
-+
-+static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 symbol, UInt32 matchByte)
-+{
-+  UInt32 offs = 0x100;
-+  symbol |= 0x100;
-+  do
-+  {
-+    matchByte <<= 1;
-+    RangeEnc_EncodeBit(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1);
-+    symbol <<= 1;
-+    offs &= ~(matchByte ^ symbol);
-+  }
-+  while (symbol < 0x10000);
-+}
-+
-+void LzmaEnc_InitPriceTables(UInt32 *ProbPrices)
-+{
-+  UInt32 i;
-+  for (i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
-+  {
-+    const int kCyclesBits = kNumBitPriceShiftBits;
-+    UInt32 w = i;
-+    UInt32 bitCount = 0;
-+    int j;
-+    for (j = 0; j < kCyclesBits; j++)
-+    {
-+      w = w * w;
-+      bitCount <<= 1;
-+      while (w >= ((UInt32)1 << 16))
-+      {
-+        w >>= 1;
-+        bitCount++;
-+      }
-+    }
-+    ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
-+  }
-+}
-+
-+
-+#define GET_PRICE(prob, symbol) \
-+  p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
-+
-+#define GET_PRICEa(prob, symbol) \
-+  ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
-+
-+#define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
-+#define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
-+
-+#define GET_PRICE_0a(prob) ProbPrices[(prob) >> kNumMoveReducingBits]
-+#define GET_PRICE_1a(prob) ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
-+
-+static UInt32 LitEnc_GetPrice(const CLzmaProb *probs, UInt32 symbol, UInt32 *ProbPrices)
-+{
-+  UInt32 price = 0;
-+  symbol |= 0x100;
-+  do
-+  {
-+    price += GET_PRICEa(probs[symbol >> 8], (symbol >> 7) & 1);
-+    symbol <<= 1;
-+  }
-+  while (symbol < 0x10000);
-+  return price;
-+}
-+
-+static UInt32 LitEnc_GetPriceMatched(const CLzmaProb *probs, UInt32 symbol, UInt32 matchByte, UInt32 *ProbPrices)
-+{
-+  UInt32 price = 0;
-+  UInt32 offs = 0x100;
-+  symbol |= 0x100;
-+  do
-+  {
-+    matchByte <<= 1;
-+    price += GET_PRICEa(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1);
-+    symbol <<= 1;
-+    offs &= ~(matchByte ^ symbol);
-+  }
-+  while (symbol < 0x10000);
-+  return price;
-+}
-+
-+
-+static void RcTree_Encode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
-+{
-+  UInt32 m = 1;
-+  int i;
-+  for (i = numBitLevels; i != 0;)
-+  {
-+    UInt32 bit;
-+    i--;
-+    bit = (symbol >> i) & 1;
-+    RangeEnc_EncodeBit(rc, probs + m, bit);
-+    m = (m << 1) | bit;
-+  }
-+}
-+
-+static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, int numBitLevels, UInt32 symbol)
-+{
-+  UInt32 m = 1;
-+  int i;
-+  for (i = 0; i < numBitLevels; i++)
-+  {
-+    UInt32 bit = symbol & 1;
-+    RangeEnc_EncodeBit(rc, probs + m, bit);
-+    m = (m << 1) | bit;
-+    symbol >>= 1;
-+  }
-+}
-+
-+static UInt32 RcTree_GetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
-+{
-+  UInt32 price = 0;
-+  symbol |= (1 << numBitLevels);
-+  while (symbol != 1)
-+  {
-+    price += GET_PRICEa(probs[symbol >> 1], symbol & 1);
-+    symbol >>= 1;
-+  }
-+  return price;
-+}
-+
-+static UInt32 RcTree_ReverseGetPrice(const CLzmaProb *probs, int numBitLevels, UInt32 symbol, UInt32 *ProbPrices)
-+{
-+  UInt32 price = 0;
-+  UInt32 m = 1;
-+  int i;
-+  for (i = numBitLevels; i != 0; i--)
-+  {
-+    UInt32 bit = symbol & 1;
-+    symbol >>= 1;
-+    price += GET_PRICEa(probs[m], bit);
-+    m = (m << 1) | bit;
-+  }
-+  return price;
-+}
-+
-+
-+static void LenEnc_Init(CLenEnc *p)
-+{
-+  unsigned i;
-+  p->choice = p->choice2 = kProbInitValue;
-+  for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumLowBits); i++)
-+    p->low[i] = kProbInitValue;
-+  for (i = 0; i < (LZMA_NUM_PB_STATES_MAX << kLenNumMidBits); i++)
-+    p->mid[i] = kProbInitValue;
-+  for (i = 0; i < kLenNumHighSymbols; i++)
-+    p->high[i] = kProbInitValue;
-+}
-+
-+static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState)
-+{
-+  if (symbol < kLenNumLowSymbols)
-+  {
-+    RangeEnc_EncodeBit(rc, &p->choice, 0);
-+    RcTree_Encode(rc, p->low + (posState << kLenNumLowBits), kLenNumLowBits, symbol);
-+  }
-+  else
-+  {
-+    RangeEnc_EncodeBit(rc, &p->choice, 1);
-+    if (symbol < kLenNumLowSymbols + kLenNumMidSymbols)
-+    {
-+      RangeEnc_EncodeBit(rc, &p->choice2, 0);
-+      RcTree_Encode(rc, p->mid + (posState << kLenNumMidBits), kLenNumMidBits, symbol - kLenNumLowSymbols);
-+    }
-+    else
-+    {
-+      RangeEnc_EncodeBit(rc, &p->choice2, 1);
-+      RcTree_Encode(rc, p->high, kLenNumHighBits, symbol - kLenNumLowSymbols - kLenNumMidSymbols);
-+    }
-+  }
-+}
-+
-+static void LenEnc_SetPrices(CLenEnc *p, UInt32 posState, UInt32 numSymbols, UInt32 *prices, UInt32 *ProbPrices)
-+{
-+  UInt32 a0 = GET_PRICE_0a(p->choice);
-+  UInt32 a1 = GET_PRICE_1a(p->choice);
-+  UInt32 b0 = a1 + GET_PRICE_0a(p->choice2);
-+  UInt32 b1 = a1 + GET_PRICE_1a(p->choice2);
-+  UInt32 i = 0;
-+  for (i = 0; i < kLenNumLowSymbols; i++)
-+  {
-+    if (i >= numSymbols)
-+      return;
-+    prices[i] = a0 + RcTree_GetPrice(p->low + (posState << kLenNumLowBits), kLenNumLowBits, i, ProbPrices);
-+  }
-+  for (; i < kLenNumLowSymbols + kLenNumMidSymbols; i++)
-+  {
-+    if (i >= numSymbols)
-+      return;
-+    prices[i] = b0 + RcTree_GetPrice(p->mid + (posState << kLenNumMidBits), kLenNumMidBits, i - kLenNumLowSymbols, ProbPrices);
-+  }
-+  for (; i < numSymbols; i++)
-+    prices[i] = b1 + RcTree_GetPrice(p->high, kLenNumHighBits, i - kLenNumLowSymbols - kLenNumMidSymbols, ProbPrices);
-+}
-+
-+static void MY_FAST_CALL LenPriceEnc_UpdateTable(CLenPriceEnc *p, UInt32 posState, UInt32 *ProbPrices)
-+{
-+  LenEnc_SetPrices(&p->p, posState, p->tableSize, p->prices[posState], ProbPrices);
-+  p->counters[posState] = p->tableSize;
-+}
-+
-+static void LenPriceEnc_UpdateTables(CLenPriceEnc *p, UInt32 numPosStates, UInt32 *ProbPrices)
-+{
-+  UInt32 posState;
-+  for (posState = 0; posState < numPosStates; posState++)
-+    LenPriceEnc_UpdateTable(p, posState, ProbPrices);
-+}
-+
-+static void LenEnc_Encode2(CLenPriceEnc *p, CRangeEnc *rc, UInt32 symbol, UInt32 posState, Bool updatePrice, UInt32 *ProbPrices)
-+{
-+  LenEnc_Encode(&p->p, rc, symbol, posState);
-+  if (updatePrice)
-+    if (--p->counters[posState] == 0)
-+      LenPriceEnc_UpdateTable(p, posState, ProbPrices);
-+}
-+
-+
-+
-+
-+static void MovePos(CLzmaEnc *p, UInt32 num)
-+{
-+  #ifdef SHOW_STAT
-+  ttt += num;
-+  printf("\n MovePos %d", num);
-+  #endif
-+  if (num != 0)
-+  {
-+    p->additionalOffset += num;
-+    p->matchFinder.Skip(p->matchFinderObj, num);
-+  }
-+}
-+
-+static UInt32 ReadMatchDistances(CLzmaEnc *p, UInt32 *numDistancePairsRes)
-+{
-+  UInt32 lenRes = 0, numPairs;
-+  p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
-+  numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
-+  #ifdef SHOW_STAT
-+  printf("\n i = %d numPairs = %d    ", ttt, numPairs / 2);
-+  ttt++;
-+  {
-+    UInt32 i;
-+    for (i = 0; i < numPairs; i += 2)
-+      printf("%2d %6d   | ", p->matches[i], p->matches[i + 1]);
-+  }
-+  #endif
-+  if (numPairs > 0)
-+  {
-+    lenRes = p->matches[numPairs - 2];
-+    if (lenRes == p->numFastBytes)
-+    {
-+      const Byte *pby = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-+      UInt32 distance = p->matches[numPairs - 1] + 1;
-+      UInt32 numAvail = p->numAvail;
-+      if (numAvail > LZMA_MATCH_LEN_MAX)
-+        numAvail = LZMA_MATCH_LEN_MAX;
-+      {
-+        const Byte *pby2 = pby - distance;
-+        for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
-+      }
-+    }
-+  }
-+  p->additionalOffset++;
-+  *numDistancePairsRes = numPairs;
-+  return lenRes;
-+}
-+
-+
-+#define MakeAsChar(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = False;
-+#define MakeAsShortRep(p) (p)->backPrev = 0; (p)->prev1IsChar = False;
-+#define IsShortRep(p) ((p)->backPrev == 0)
-+
-+static UInt32 GetRepLen1Price(CLzmaEnc *p, UInt32 state, UInt32 posState)
-+{
-+  return
-+    GET_PRICE_0(p->isRepG0[state]) +
-+    GET_PRICE_0(p->isRep0Long[state][posState]);
-+}
-+
-+static UInt32 GetPureRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 state, UInt32 posState)
-+{
-+  UInt32 price;
-+  if (repIndex == 0)
-+  {
-+    price = GET_PRICE_0(p->isRepG0[state]);
-+    price += GET_PRICE_1(p->isRep0Long[state][posState]);
-+  }
-+  else
-+  {
-+    price = GET_PRICE_1(p->isRepG0[state]);
-+    if (repIndex == 1)
-+      price += GET_PRICE_0(p->isRepG1[state]);
-+    else
-+    {
-+      price += GET_PRICE_1(p->isRepG1[state]);
-+      price += GET_PRICE(p->isRepG2[state], repIndex - 2);
-+    }
-+  }
-+  return price;
-+}
-+
-+static UInt32 GetRepPrice(CLzmaEnc *p, UInt32 repIndex, UInt32 len, UInt32 state, UInt32 posState)
-+{
-+  return p->repLenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN] +
-+    GetPureRepPrice(p, repIndex, state, posState);
-+}
-+
-+static UInt32 Backward(CLzmaEnc *p, UInt32 *backRes, UInt32 cur)
-+{
-+  UInt32 posMem = p->opt[cur].posPrev;
-+  UInt32 backMem = p->opt[cur].backPrev;
-+  p->optimumEndIndex = cur;
-+  do
-+  {
-+    if (p->opt[cur].prev1IsChar)
-+    {
-+      MakeAsChar(&p->opt[posMem])
-+      p->opt[posMem].posPrev = posMem - 1;
-+      if (p->opt[cur].prev2)
-+      {
-+        p->opt[posMem - 1].prev1IsChar = False;
-+        p->opt[posMem - 1].posPrev = p->opt[cur].posPrev2;
-+        p->opt[posMem - 1].backPrev = p->opt[cur].backPrev2;
-+      }
-+    }
-+    {
-+      UInt32 posPrev = posMem;
-+      UInt32 backCur = backMem;
-+      
-+      backMem = p->opt[posPrev].backPrev;
-+      posMem = p->opt[posPrev].posPrev;
-+      
-+      p->opt[posPrev].backPrev = backCur;
-+      p->opt[posPrev].posPrev = cur;
-+      cur = posPrev;
-+    }
-+  }
-+  while (cur != 0);
-+  *backRes = p->opt[0].backPrev;
-+  p->optimumCurrentIndex  = p->opt[0].posPrev;
-+  return p->optimumCurrentIndex;
-+}
-+
-+#define LIT_PROBS(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + ((prevByte) >> (8 - p->lc))) * 0x300)
-+
-+static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
-+{
-+  UInt32 numAvail, mainLen, numPairs, repMaxIndex, i, posState, lenEnd, len, cur;
-+  UInt32 matchPrice, repMatchPrice, normalMatchPrice;
-+  UInt32 reps[LZMA_NUM_REPS], repLens[LZMA_NUM_REPS];
-+  UInt32 *matches;
-+  const Byte *data;
-+  Byte curByte, matchByte;
-+  if (p->optimumEndIndex != p->optimumCurrentIndex)
-+  {
-+    const COptimal *opt = &p->opt[p->optimumCurrentIndex];
-+    UInt32 lenRes = opt->posPrev - p->optimumCurrentIndex;
-+    *backRes = opt->backPrev;
-+    p->optimumCurrentIndex = opt->posPrev;
-+    return lenRes;
-+  }
-+  p->optimumCurrentIndex = p->optimumEndIndex = 0;
-+  
-+  if (p->additionalOffset == 0)
-+    mainLen = ReadMatchDistances(p, &numPairs);
-+  else
-+  {
-+    mainLen = p->longestMatchLength;
-+    numPairs = p->numPairs;
-+  }
-+
-+  numAvail = p->numAvail;
-+  if (numAvail < 2)
-+  {
-+    *backRes = (UInt32)(-1);
-+    return 1;
-+  }
-+  if (numAvail > LZMA_MATCH_LEN_MAX)
-+    numAvail = LZMA_MATCH_LEN_MAX;
-+
-+  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-+  repMaxIndex = 0;
-+  for (i = 0; i < LZMA_NUM_REPS; i++)
-+  {
-+    UInt32 lenTest;
-+    const Byte *data2;
-+    reps[i] = p->reps[i];
-+    data2 = data - (reps[i] + 1);
-+    if (data[0] != data2[0] || data[1] != data2[1])
-+    {
-+      repLens[i] = 0;
-+      continue;
-+    }
-+    for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
-+    repLens[i] = lenTest;
-+    if (lenTest > repLens[repMaxIndex])
-+      repMaxIndex = i;
-+  }
-+  if (repLens[repMaxIndex] >= p->numFastBytes)
-+  {
-+    UInt32 lenRes;
-+    *backRes = repMaxIndex;
-+    lenRes = repLens[repMaxIndex];
-+    MovePos(p, lenRes - 1);
-+    return lenRes;
-+  }
-+
-+  matches = p->matches;
-+  if (mainLen >= p->numFastBytes)
-+  {
-+    *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
-+    MovePos(p, mainLen - 1);
-+    return mainLen;
-+  }
-+  curByte = *data;
-+  matchByte = *(data - (reps[0] + 1));
-+
-+  if (mainLen < 2 && curByte != matchByte && repLens[repMaxIndex] < 2)
-+  {
-+    *backRes = (UInt32)-1;
-+    return 1;
-+  }
-+
-+  p->opt[0].state = (CState)p->state;
-+
-+  posState = (position & p->pbMask);
-+
-+  {
-+    const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
-+    p->opt[1].price = GET_PRICE_0(p->isMatch[p->state][posState]) +
-+        (!IsCharState(p->state) ?
-+          LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
-+          LitEnc_GetPrice(probs, curByte, p->ProbPrices));
-+  }
-+
-+  MakeAsChar(&p->opt[1]);
-+
-+  matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
-+  repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
-+
-+  if (matchByte == curByte)
-+  {
-+    UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, p->state, posState);
-+    if (shortRepPrice < p->opt[1].price)
-+    {
-+      p->opt[1].price = shortRepPrice;
-+      MakeAsShortRep(&p->opt[1]);
-+    }
-+  }
-+  lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]);
-+
-+  if (lenEnd < 2)
-+  {
-+    *backRes = p->opt[1].backPrev;
-+    return 1;
-+  }
-+
-+  p->opt[1].posPrev = 0;
-+  for (i = 0; i < LZMA_NUM_REPS; i++)
-+    p->opt[0].backs[i] = reps[i];
-+
-+  len = lenEnd;
-+  do
-+    p->opt[len--].price = kInfinityPrice;
-+  while (len >= 2);
-+
-+  for (i = 0; i < LZMA_NUM_REPS; i++)
-+  {
-+    UInt32 repLen = repLens[i];
-+    UInt32 price;
-+    if (repLen < 2)
-+      continue;
-+    price = repMatchPrice + GetPureRepPrice(p, i, p->state, posState);
-+    do
-+    {
-+      UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][repLen - 2];
-+      COptimal *opt = &p->opt[repLen];
-+      if (curAndLenPrice < opt->price)
-+      {
-+        opt->price = curAndLenPrice;
-+        opt->posPrev = 0;
-+        opt->backPrev = i;
-+        opt->prev1IsChar = False;
-+      }
-+    }
-+    while (--repLen >= 2);
-+  }
-+
-+  normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[p->state]);
-+
-+  len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2);
-+  if (len <= mainLen)
-+  {
-+    UInt32 offs = 0;
-+    while (len > matches[offs])
-+      offs += 2;
-+    for (; ; len++)
-+    {
-+      COptimal *opt;
-+      UInt32 distance = matches[offs + 1];
-+
-+      UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][len - LZMA_MATCH_LEN_MIN];
-+      UInt32 lenToPosState = GetLenToPosState(len);
-+      if (distance < kNumFullDistances)
-+        curAndLenPrice += p->distancesPrices[lenToPosState][distance];
-+      else
-+      {
-+        UInt32 slot;
-+        GetPosSlot2(distance, slot);
-+        curAndLenPrice += p->alignPrices[distance & kAlignMask] + p->posSlotPrices[lenToPosState][slot];
-+      }
-+      opt = &p->opt[len];
-+      if (curAndLenPrice < opt->price)
-+      {
-+        opt->price = curAndLenPrice;
-+        opt->posPrev = 0;
-+        opt->backPrev = distance + LZMA_NUM_REPS;
-+        opt->prev1IsChar = False;
-+      }
-+      if (len == matches[offs])
-+      {
-+        offs += 2;
-+        if (offs == numPairs)
-+          break;
-+      }
-+    }
-+  }
-+
-+  cur = 0;
-+
-+    #ifdef SHOW_STAT2
-+    if (position >= 0)
-+    {
-+      unsigned i;
-+      printf("\n pos = %4X", position);
-+      for (i = cur; i <= lenEnd; i++)
-+      printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);
-+    }
-+    #endif
-+
-+  for (;;)
-+  {
-+    UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;
-+    UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;
-+    Bool nextIsChar;
-+    Byte curByte, matchByte;
-+    const Byte *data;
-+    COptimal *curOpt;
-+    COptimal *nextOpt;
-+
-+    cur++;
-+    if (cur == lenEnd)
-+      return Backward(p, backRes, cur);
-+
-+    newLen = ReadMatchDistances(p, &numPairs);
-+    if (newLen >= p->numFastBytes)
-+    {
-+      p->numPairs = numPairs;
-+      p->longestMatchLength = newLen;
-+      return Backward(p, backRes, cur);
-+    }
-+    position++;
-+    curOpt = &p->opt[cur];
-+    posPrev = curOpt->posPrev;
-+    if (curOpt->prev1IsChar)
-+    {
-+      posPrev--;
-+      if (curOpt->prev2)
-+      {
-+        state = p->opt[curOpt->posPrev2].state;
-+        if (curOpt->backPrev2 < LZMA_NUM_REPS)
-+          state = kRepNextStates[state];
-+        else
-+          state = kMatchNextStates[state];
-+      }
-+      else
-+        state = p->opt[posPrev].state;
-+      state = kLiteralNextStates[state];
-+    }
-+    else
-+      state = p->opt[posPrev].state;
-+    if (posPrev == cur - 1)
-+    {
-+      if (IsShortRep(curOpt))
-+        state = kShortRepNextStates[state];
-+      else
-+        state = kLiteralNextStates[state];
-+    }
-+    else
-+    {
-+      UInt32 pos;
-+      const COptimal *prevOpt;
-+      if (curOpt->prev1IsChar && curOpt->prev2)
-+      {
-+        posPrev = curOpt->posPrev2;
-+        pos = curOpt->backPrev2;
-+        state = kRepNextStates[state];
-+      }
-+      else
-+      {
-+        pos = curOpt->backPrev;
-+        if (pos < LZMA_NUM_REPS)
-+          state = kRepNextStates[state];
-+        else
-+          state = kMatchNextStates[state];
-+      }
-+      prevOpt = &p->opt[posPrev];
-+      if (pos < LZMA_NUM_REPS)
-+      {
-+        UInt32 i;
-+        reps[0] = prevOpt->backs[pos];
-+        for (i = 1; i <= pos; i++)
-+          reps[i] = prevOpt->backs[i - 1];
-+        for (; i < LZMA_NUM_REPS; i++)
-+          reps[i] = prevOpt->backs[i];
-+      }
-+      else
-+      {
-+        UInt32 i;
-+        reps[0] = (pos - LZMA_NUM_REPS);
-+        for (i = 1; i < LZMA_NUM_REPS; i++)
-+          reps[i] = prevOpt->backs[i - 1];
-+      }
-+    }
-+    curOpt->state = (CState)state;
-+
-+    curOpt->backs[0] = reps[0];
-+    curOpt->backs[1] = reps[1];
-+    curOpt->backs[2] = reps[2];
-+    curOpt->backs[3] = reps[3];
-+
-+    curPrice = curOpt->price;
-+    nextIsChar = False;
-+    data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-+    curByte = *data;
-+    matchByte = *(data - (reps[0] + 1));
-+
-+    posState = (position & p->pbMask);
-+
-+    curAnd1Price = curPrice + GET_PRICE_0(p->isMatch[state][posState]);
-+    {
-+      const CLzmaProb *probs = LIT_PROBS(position, *(data - 1));
-+      curAnd1Price +=
-+        (!IsCharState(state) ?
-+          LitEnc_GetPriceMatched(probs, curByte, matchByte, p->ProbPrices) :
-+          LitEnc_GetPrice(probs, curByte, p->ProbPrices));
-+    }
-+
-+    nextOpt = &p->opt[cur + 1];
-+
-+    if (curAnd1Price < nextOpt->price)
-+    {
-+      nextOpt->price = curAnd1Price;
-+      nextOpt->posPrev = cur;
-+      MakeAsChar(nextOpt);
-+      nextIsChar = True;
-+    }
-+
-+    matchPrice = curPrice + GET_PRICE_1(p->isMatch[state][posState]);
-+    repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[state]);
-+    
-+    if (matchByte == curByte && !(nextOpt->posPrev < cur && nextOpt->backPrev == 0))
-+    {
-+      UInt32 shortRepPrice = repMatchPrice + GetRepLen1Price(p, state, posState);
-+      if (shortRepPrice <= nextOpt->price)
-+      {
-+        nextOpt->price = shortRepPrice;
-+        nextOpt->posPrev = cur;
-+        MakeAsShortRep(nextOpt);
-+        nextIsChar = True;
-+      }
-+    }
-+    numAvailFull = p->numAvail;
-+    {
-+      UInt32 temp = kNumOpts - 1 - cur;
-+      if (temp < numAvailFull)
-+        numAvailFull = temp;
-+    }
-+
-+    if (numAvailFull < 2)
-+      continue;
-+    numAvail = (numAvailFull <= p->numFastBytes ? numAvailFull : p->numFastBytes);
-+
-+    if (!nextIsChar && matchByte != curByte) /* speed optimization */
-+    {
-+      /* try Literal + rep0 */
-+      UInt32 temp;
-+      UInt32 lenTest2;
-+      const Byte *data2 = data - (reps[0] + 1);
-+      UInt32 limit = p->numFastBytes + 1;
-+      if (limit > numAvailFull)
-+        limit = numAvailFull;
-+
-+      for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
-+      lenTest2 = temp - 1;
-+      if (lenTest2 >= 2)
-+      {
-+        UInt32 state2 = kLiteralNextStates[state];
-+        UInt32 posStateNext = (position + 1) & p->pbMask;
-+        UInt32 nextRepMatchPrice = curAnd1Price +
-+            GET_PRICE_1(p->isMatch[state2][posStateNext]) +
-+            GET_PRICE_1(p->isRep[state2]);
-+        /* for (; lenTest2 >= 2; lenTest2--) */
-+        {
-+          UInt32 curAndLenPrice;
-+          COptimal *opt;
-+          UInt32 offset = cur + 1 + lenTest2;
-+          while (lenEnd < offset)
-+            p->opt[++lenEnd].price = kInfinityPrice;
-+          curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
-+          opt = &p->opt[offset];
-+          if (curAndLenPrice < opt->price)
-+          {
-+            opt->price = curAndLenPrice;
-+            opt->posPrev = cur + 1;
-+            opt->backPrev = 0;
-+            opt->prev1IsChar = True;
-+            opt->prev2 = False;
-+          }
-+        }
-+      }
-+    }
-+    
-+    startLen = 2; /* speed optimization */
-+    {
-+    UInt32 repIndex;
-+    for (repIndex = 0; repIndex < LZMA_NUM_REPS; repIndex++)
-+    {
-+      UInt32 lenTest;
-+      UInt32 lenTestTemp;
-+      UInt32 price;
-+      const Byte *data2 = data - (reps[repIndex] + 1);
-+      if (data[0] != data2[0] || data[1] != data2[1])
-+        continue;
-+      for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++);
-+      while (lenEnd < cur + lenTest)
-+        p->opt[++lenEnd].price = kInfinityPrice;
-+      lenTestTemp = lenTest;
-+      price = repMatchPrice + GetPureRepPrice(p, repIndex, state, posState);
-+      do
-+      {
-+        UInt32 curAndLenPrice = price + p->repLenEnc.prices[posState][lenTest - 2];
-+        COptimal *opt = &p->opt[cur + lenTest];
-+        if (curAndLenPrice < opt->price)
-+        {
-+          opt->price = curAndLenPrice;
-+          opt->posPrev = cur;
-+          opt->backPrev = repIndex;
-+          opt->prev1IsChar = False;
-+        }
-+      }
-+      while (--lenTest >= 2);
-+      lenTest = lenTestTemp;
-+      
-+      if (repIndex == 0)
-+        startLen = lenTest + 1;
-+        
-+      /* if (_maxMode) */
-+        {
-+          UInt32 lenTest2 = lenTest + 1;
-+          UInt32 limit = lenTest2 + p->numFastBytes;
-+          UInt32 nextRepMatchPrice;
-+          if (limit > numAvailFull)
-+            limit = numAvailFull;
-+          for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
-+          lenTest2 -= lenTest + 1;
-+          if (lenTest2 >= 2)
-+          {
-+            UInt32 state2 = kRepNextStates[state];
-+            UInt32 posStateNext = (position + lenTest) & p->pbMask;
-+            UInt32 curAndLenCharPrice =
-+                price + p->repLenEnc.prices[posState][lenTest - 2] +
-+                GET_PRICE_0(p->isMatch[state2][posStateNext]) +
-+                LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
-+                    data[lenTest], data2[lenTest], p->ProbPrices);
-+            state2 = kLiteralNextStates[state2];
-+            posStateNext = (position + lenTest + 1) & p->pbMask;
-+            nextRepMatchPrice = curAndLenCharPrice +
-+                GET_PRICE_1(p->isMatch[state2][posStateNext]) +
-+                GET_PRICE_1(p->isRep[state2]);
-+            
-+            /* for (; lenTest2 >= 2; lenTest2--) */
-+            {
-+              UInt32 curAndLenPrice;
-+              COptimal *opt;
-+              UInt32 offset = cur + lenTest + 1 + lenTest2;
-+              while (lenEnd < offset)
-+                p->opt[++lenEnd].price = kInfinityPrice;
-+              curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
-+              opt = &p->opt[offset];
-+              if (curAndLenPrice < opt->price)
-+              {
-+                opt->price = curAndLenPrice;
-+                opt->posPrev = cur + lenTest + 1;
-+                opt->backPrev = 0;
-+                opt->prev1IsChar = True;
-+                opt->prev2 = True;
-+                opt->posPrev2 = cur;
-+                opt->backPrev2 = repIndex;
-+              }
-+            }
-+          }
-+        }
-+    }
-+    }
-+    /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */
-+    if (newLen > numAvail)
-+    {
-+      newLen = numAvail;
-+      for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
-+      matches[numPairs] = newLen;
-+      numPairs += 2;
-+    }
-+    if (newLen >= startLen)
-+    {
-+      UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
-+      UInt32 offs, curBack, posSlot;
-+      UInt32 lenTest;
-+      while (lenEnd < cur + newLen)
-+        p->opt[++lenEnd].price = kInfinityPrice;
-+
-+      offs = 0;
-+      while (startLen > matches[offs])
-+        offs += 2;
-+      curBack = matches[offs + 1];
-+      GetPosSlot2(curBack, posSlot);
-+      for (lenTest = /*2*/ startLen; ; lenTest++)
-+      {
-+        UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
-+        UInt32 lenToPosState = GetLenToPosState(lenTest);
-+        COptimal *opt;
-+        if (curBack < kNumFullDistances)
-+          curAndLenPrice += p->distancesPrices[lenToPosState][curBack];
-+        else
-+          curAndLenPrice += p->posSlotPrices[lenToPosState][posSlot] + p->alignPrices[curBack & kAlignMask];
-+        
-+        opt = &p->opt[cur + lenTest];
-+        if (curAndLenPrice < opt->price)
-+        {
-+          opt->price = curAndLenPrice;
-+          opt->posPrev = cur;
-+          opt->backPrev = curBack + LZMA_NUM_REPS;
-+          opt->prev1IsChar = False;
-+        }
-+
-+        if (/*_maxMode && */lenTest == matches[offs])
-+        {
-+          /* Try Match + Literal + Rep0 */
-+          const Byte *data2 = data - (curBack + 1);
-+          UInt32 lenTest2 = lenTest + 1;
-+          UInt32 limit = lenTest2 + p->numFastBytes;
-+          UInt32 nextRepMatchPrice;
-+          if (limit > numAvailFull)
-+            limit = numAvailFull;
-+          for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
-+          lenTest2 -= lenTest + 1;
-+          if (lenTest2 >= 2)
-+          {
-+            UInt32 state2 = kMatchNextStates[state];
-+            UInt32 posStateNext = (position + lenTest) & p->pbMask;
-+            UInt32 curAndLenCharPrice = curAndLenPrice +
-+                GET_PRICE_0(p->isMatch[state2][posStateNext]) +
-+                LitEnc_GetPriceMatched(LIT_PROBS(position + lenTest, data[lenTest - 1]),
-+                    data[lenTest], data2[lenTest], p->ProbPrices);
-+            state2 = kLiteralNextStates[state2];
-+            posStateNext = (posStateNext + 1) & p->pbMask;
-+            nextRepMatchPrice = curAndLenCharPrice +
-+                GET_PRICE_1(p->isMatch[state2][posStateNext]) +
-+                GET_PRICE_1(p->isRep[state2]);
-+            
-+            /* for (; lenTest2 >= 2; lenTest2--) */
-+            {
-+              UInt32 offset = cur + lenTest + 1 + lenTest2;
-+              UInt32 curAndLenPrice;
-+              COptimal *opt;
-+              while (lenEnd < offset)
-+                p->opt[++lenEnd].price = kInfinityPrice;
-+              curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
-+              opt = &p->opt[offset];
-+              if (curAndLenPrice < opt->price)
-+              {
-+                opt->price = curAndLenPrice;
-+                opt->posPrev = cur + lenTest + 1;
-+                opt->backPrev = 0;
-+                opt->prev1IsChar = True;
-+                opt->prev2 = True;
-+                opt->posPrev2 = cur;
-+                opt->backPrev2 = curBack + LZMA_NUM_REPS;
-+              }
-+            }
-+          }
-+          offs += 2;
-+          if (offs == numPairs)
-+            break;
-+          curBack = matches[offs + 1];
-+          if (curBack >= kNumFullDistances)
-+            GetPosSlot2(curBack, posSlot);
-+        }
-+      }
-+    }
-+  }
-+}
-+
-+#define ChangePair(smallDist, bigDist) (((bigDist) >> 7) > (smallDist))
-+
-+static UInt32 GetOptimumFast(CLzmaEnc *p, UInt32 *backRes)
-+{
-+  UInt32 numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i;
-+  const Byte *data;
-+  const UInt32 *matches;
-+
-+  if (p->additionalOffset == 0)
-+    mainLen = ReadMatchDistances(p, &numPairs);
-+  else
-+  {
-+    mainLen = p->longestMatchLength;
-+    numPairs = p->numPairs;
-+  }
-+
-+  numAvail = p->numAvail;
-+  *backRes = (UInt32)-1;
-+  if (numAvail < 2)
-+    return 1;
-+  if (numAvail > LZMA_MATCH_LEN_MAX)
-+    numAvail = LZMA_MATCH_LEN_MAX;
-+  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-+
-+  repLen = repIndex = 0;
-+  for (i = 0; i < LZMA_NUM_REPS; i++)
-+  {
-+    UInt32 len;
-+    const Byte *data2 = data - (p->reps[i] + 1);
-+    if (data[0] != data2[0] || data[1] != data2[1])
-+      continue;
-+    for (len = 2; len < numAvail && data[len] == data2[len]; len++);
-+    if (len >= p->numFastBytes)
-+    {
-+      *backRes = i;
-+      MovePos(p, len - 1);
-+      return len;
-+    }
-+    if (len > repLen)
-+    {
-+      repIndex = i;
-+      repLen = len;
-+    }
-+  }
-+
-+  matches = p->matches;
-+  if (mainLen >= p->numFastBytes)
-+  {
-+    *backRes = matches[numPairs - 1] + LZMA_NUM_REPS;
-+    MovePos(p, mainLen - 1);
-+    return mainLen;
-+  }
-+
-+  mainDist = 0; /* for GCC */
-+  if (mainLen >= 2)
-+  {
-+    mainDist = matches[numPairs - 1];
-+    while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1)
-+    {
-+      if (!ChangePair(matches[numPairs - 3], mainDist))
-+        break;
-+      numPairs -= 2;
-+      mainLen = matches[numPairs - 2];
-+      mainDist = matches[numPairs - 1];
-+    }
-+    if (mainLen == 2 && mainDist >= 0x80)
-+      mainLen = 1;
-+  }
-+
-+  if (repLen >= 2 && (
-+        (repLen + 1 >= mainLen) ||
-+        (repLen + 2 >= mainLen && mainDist >= (1 << 9)) ||
-+        (repLen + 3 >= mainLen && mainDist >= (1 << 15))))
-+  {
-+    *backRes = repIndex;
-+    MovePos(p, repLen - 1);
-+    return repLen;
-+  }
-+  
-+  if (mainLen < 2 || numAvail <= 2)
-+    return 1;
-+
-+  p->longestMatchLength = ReadMatchDistances(p, &p->numPairs);
-+  if (p->longestMatchLength >= 2)
-+  {
-+    UInt32 newDistance = matches[p->numPairs - 1];
-+    if ((p->longestMatchLength >= mainLen && newDistance < mainDist) ||
-+        (p->longestMatchLength == mainLen + 1 && !ChangePair(mainDist, newDistance)) ||
-+        (p->longestMatchLength > mainLen + 1) ||
-+        (p->longestMatchLength + 1 >= mainLen && mainLen >= 3 && ChangePair(newDistance, mainDist)))
-+      return 1;
-+  }
-+  
-+  data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
-+  for (i = 0; i < LZMA_NUM_REPS; i++)
-+  {
-+    UInt32 len, limit;
-+    const Byte *data2 = data - (p->reps[i] + 1);
-+    if (data[0] != data2[0] || data[1] != data2[1])
-+      continue;
-+    limit = mainLen - 1;
-+    for (len = 2; len < limit && data[len] == data2[len]; len++);
-+    if (len >= limit)
-+      return 1;
-+  }
-+  *backRes = mainDist + LZMA_NUM_REPS;
-+  MovePos(p, mainLen - 2);
-+  return mainLen;
-+}
-+
-+static void WriteEndMarker(CLzmaEnc *p, UInt32 posState)
-+{
-+  UInt32 len;
-+  RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
-+  RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
-+  p->state = kMatchNextStates[p->state];
-+  len = LZMA_MATCH_LEN_MIN;
-+  LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
-+  RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, (1 << kNumPosSlotBits) - 1);
-+  RangeEnc_EncodeDirectBits(&p->rc, (((UInt32)1 << 30) - 1) >> kNumAlignBits, 30 - kNumAlignBits);
-+  RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, kAlignMask);
-+}
-+
-+static SRes CheckErrors(CLzmaEnc *p)
-+{
-+  if (p->result != SZ_OK)
-+    return p->result;
-+  if (p->rc.res != SZ_OK)
-+    p->result = SZ_ERROR_WRITE;
-+  if (p->matchFinderBase.result != SZ_OK)
-+    p->result = SZ_ERROR_READ;
-+  if (p->result != SZ_OK)
-+    p->finished = True;
-+  return p->result;
-+}
-+
-+static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
-+{
-+  /* ReleaseMFStream(); */
-+  p->finished = True;
-+  if (p->writeEndMark)
-+    WriteEndMarker(p, nowPos & p->pbMask);
-+  RangeEnc_FlushData(&p->rc);
-+  RangeEnc_FlushStream(&p->rc);
-+  return CheckErrors(p);
-+}
-+
-+static void FillAlignPrices(CLzmaEnc *p)
-+{
-+  UInt32 i;
-+  for (i = 0; i < kAlignTableSize; i++)
-+    p->alignPrices[i] = RcTree_ReverseGetPrice(p->posAlignEncoder, kNumAlignBits, i, p->ProbPrices);
-+  p->alignPriceCount = 0;
-+}
-+
-+static void FillDistancesPrices(CLzmaEnc *p)
-+{
-+  UInt32 tempPrices[kNumFullDistances];
-+  UInt32 i, lenToPosState;
-+  for (i = kStartPosModelIndex; i < kNumFullDistances; i++)
-+  {
-+    UInt32 posSlot = GetPosSlot1(i);
-+    UInt32 footerBits = ((posSlot >> 1) - 1);
-+    UInt32 base = ((2 | (posSlot & 1)) << footerBits);
-+    tempPrices[i] = RcTree_ReverseGetPrice(p->posEncoders + base - posSlot - 1, footerBits, i - base, p->ProbPrices);
-+  }
-+
-+  for (lenToPosState = 0; lenToPosState < kNumLenToPosStates; lenToPosState++)
-+  {
-+    UInt32 posSlot;
-+    const CLzmaProb *encoder = p->posSlotEncoder[lenToPosState];
-+    UInt32 *posSlotPrices = p->posSlotPrices[lenToPosState];
-+    for (posSlot = 0; posSlot < p->distTableSize; posSlot++)
-+      posSlotPrices[posSlot] = RcTree_GetPrice(encoder, kNumPosSlotBits, posSlot, p->ProbPrices);
-+    for (posSlot = kEndPosModelIndex; posSlot < p->distTableSize; posSlot++)
-+      posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBits) << kNumBitPriceShiftBits);
-+
-+    {
-+      UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
-+      UInt32 i;
-+      for (i = 0; i < kStartPosModelIndex; i++)
-+        distancesPrices[i] = posSlotPrices[i];
-+      for (; i < kNumFullDistances; i++)
-+        distancesPrices[i] = posSlotPrices[GetPosSlot1(i)] + tempPrices[i];
-+    }
-+  }
-+  p->matchPriceCount = 0;
-+}
-+
-+void LzmaEnc_Construct(CLzmaEnc *p)
-+{
-+  RangeEnc_Construct(&p->rc);
-+  MatchFinder_Construct(&p->matchFinderBase);
-+  #ifndef _7ZIP_ST
-+  MatchFinderMt_Construct(&p->matchFinderMt);
-+  p->matchFinderMt.MatchFinder = &p->matchFinderBase;
-+  #endif
-+
-+  {
-+    CLzmaEncProps props;
-+    LzmaEncProps_Init(&props);
-+    LzmaEnc_SetProps(p, &props);
-+  }
-+
-+  #ifndef LZMA_LOG_BSR
-+  LzmaEnc_FastPosInit(p->g_FastPos);
-+  #endif
-+
-+  LzmaEnc_InitPriceTables(p->ProbPrices);
-+  p->litProbs = 0;
-+  p->saveState.litProbs = 0;
-+}
-+
-+CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)
-+{
-+  void *p;
-+  p = alloc->Alloc(alloc, sizeof(CLzmaEnc));
-+  if (p != 0)
-+    LzmaEnc_Construct((CLzmaEnc *)p);
-+  return p;
-+}
-+
-+void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAlloc *alloc)
-+{
-+  alloc->Free(alloc, p->litProbs);
-+  alloc->Free(alloc, p->saveState.litProbs);
-+  p->litProbs = 0;
-+  p->saveState.litProbs = 0;
-+}
-+
-+void LzmaEnc_Destruct(CLzmaEnc *p, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  #ifndef _7ZIP_ST
-+  MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
-+  #endif
-+  MatchFinder_Free(&p->matchFinderBase, allocBig);
-+  LzmaEnc_FreeLits(p, alloc);
-+  RangeEnc_Free(&p->rc, alloc);
-+}
-+
-+void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
-+  alloc->Free(alloc, p);
-+}
-+
-+static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize, UInt32 maxUnpackSize)
-+{
-+  UInt32 nowPos32, startPos32;
-+  if (p->needInit)
-+  {
-+    p->matchFinder.Init(p->matchFinderObj);
-+    p->needInit = 0;
-+  }
-+
-+  if (p->finished)
-+    return p->result;
-+  RINOK(CheckErrors(p));
-+
-+  nowPos32 = (UInt32)p->nowPos64;
-+  startPos32 = nowPos32;
-+
-+  if (p->nowPos64 == 0)
-+  {
-+    UInt32 numPairs;
-+    Byte curByte;
-+    if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
-+      return Flush(p, nowPos32);
-+    ReadMatchDistances(p, &numPairs);
-+    RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][0], 0);
-+    p->state = kLiteralNextStates[p->state];
-+    curByte = p->matchFinder.GetIndexByte(p->matchFinderObj, 0 - p->additionalOffset);
-+    LitEnc_Encode(&p->rc, p->litProbs, curByte);
-+    p->additionalOffset--;
-+    nowPos32++;
-+  }
-+
-+  if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) != 0)
-+  for (;;)
-+  {
-+    UInt32 pos, len, posState;
-+
-+    if (p->fastMode)
-+      len = GetOptimumFast(p, &pos);
-+    else
-+      len = GetOptimum(p, nowPos32, &pos);
-+
-+    #ifdef SHOW_STAT2
-+    printf("\n pos = %4X,   len = %d   pos = %d", nowPos32, len, pos);
-+    #endif
-+
-+    posState = nowPos32 & p->pbMask;
-+    if (len == 1 && pos == (UInt32)-1)
-+    {
-+      Byte curByte;
-+      CLzmaProb *probs;
-+      const Byte *data;
-+
-+      RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 0);
-+      data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
-+      curByte = *data;
-+      probs = LIT_PROBS(nowPos32, *(data - 1));
-+      if (IsCharState(p->state))
-+        LitEnc_Encode(&p->rc, probs, curByte);
-+      else
-+        LitEnc_EncodeMatched(&p->rc, probs, curByte, *(data - p->reps[0] - 1));
-+      p->state = kLiteralNextStates[p->state];
-+    }
-+    else
-+    {
-+      RangeEnc_EncodeBit(&p->rc, &p->isMatch[p->state][posState], 1);
-+      if (pos < LZMA_NUM_REPS)
-+      {
-+        RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 1);
-+        if (pos == 0)
-+        {
-+          RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 0);
-+          RangeEnc_EncodeBit(&p->rc, &p->isRep0Long[p->state][posState], ((len == 1) ? 0 : 1));
-+        }
-+        else
-+        {
-+          UInt32 distance = p->reps[pos];
-+          RangeEnc_EncodeBit(&p->rc, &p->isRepG0[p->state], 1);
-+          if (pos == 1)
-+            RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 0);
-+          else
-+          {
-+            RangeEnc_EncodeBit(&p->rc, &p->isRepG1[p->state], 1);
-+            RangeEnc_EncodeBit(&p->rc, &p->isRepG2[p->state], pos - 2);
-+            if (pos == 3)
-+              p->reps[3] = p->reps[2];
-+            p->reps[2] = p->reps[1];
-+          }
-+          p->reps[1] = p->reps[0];
-+          p->reps[0] = distance;
-+        }
-+        if (len == 1)
-+          p->state = kShortRepNextStates[p->state];
-+        else
-+        {
-+          LenEnc_Encode2(&p->repLenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
-+          p->state = kRepNextStates[p->state];
-+        }
-+      }
-+      else
-+      {
-+        UInt32 posSlot;
-+        RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
-+        p->state = kMatchNextStates[p->state];
-+        LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
-+        pos -= LZMA_NUM_REPS;
-+        GetPosSlot(pos, posSlot);
-+        RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
-+        
-+        if (posSlot >= kStartPosModelIndex)
-+        {
-+          UInt32 footerBits = ((posSlot >> 1) - 1);
-+          UInt32 base = ((2 | (posSlot & 1)) << footerBits);
-+          UInt32 posReduced = pos - base;
-+
-+          if (posSlot < kEndPosModelIndex)
-+            RcTree_ReverseEncode(&p->rc, p->posEncoders + base - posSlot - 1, footerBits, posReduced);
-+          else
-+          {
-+            RangeEnc_EncodeDirectBits(&p->rc, posReduced >> kNumAlignBits, footerBits - kNumAlignBits);
-+            RcTree_ReverseEncode(&p->rc, p->posAlignEncoder, kNumAlignBits, posReduced & kAlignMask);
-+            p->alignPriceCount++;
-+          }
-+        }
-+        p->reps[3] = p->reps[2];
-+        p->reps[2] = p->reps[1];
-+        p->reps[1] = p->reps[0];
-+        p->reps[0] = pos;
-+        p->matchPriceCount++;
-+      }
-+    }
-+    p->additionalOffset -= len;
-+    nowPos32 += len;
-+    if (p->additionalOffset == 0)
-+    {
-+      UInt32 processed;
-+      if (!p->fastMode)
-+      {
-+        if (p->matchPriceCount >= (1 << 7))
-+          FillDistancesPrices(p);
-+        if (p->alignPriceCount >= kAlignTableSize)
-+          FillAlignPrices(p);
-+      }
-+      if (p->matchFinder.GetNumAvailableBytes(p->matchFinderObj) == 0)
-+        break;
-+      processed = nowPos32 - startPos32;
-+      if (useLimits)
-+      {
-+        if (processed + kNumOpts + 300 >= maxUnpackSize ||
-+            RangeEnc_GetProcessed(&p->rc) + kNumOpts * 2 >= maxPackSize)
-+          break;
-+      }
-+      else if (processed >= (1 << 15))
-+      {
-+        p->nowPos64 += nowPos32 - startPos32;
-+        return CheckErrors(p);
-+      }
-+    }
-+  }
-+  p->nowPos64 += nowPos32 - startPos32;
-+  return Flush(p, nowPos32);
-+}
-+
-+#define kBigHashDicLimit ((UInt32)1 << 24)
-+
-+static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  UInt32 beforeSize = kNumOpts;
-+  Bool btMode;
-+  if (!RangeEnc_Alloc(&p->rc, alloc))
-+    return SZ_ERROR_MEM;
-+  btMode = (p->matchFinderBase.btMode != 0);
-+  #ifndef _7ZIP_ST
-+  p->mtMode = (p->multiThread && !p->fastMode && btMode);
-+  #endif
-+
-+  {
-+    unsigned lclp = p->lc + p->lp;
-+    if (p->litProbs == 0 || p->saveState.litProbs == 0 || p->lclp != lclp)
-+    {
-+      LzmaEnc_FreeLits(p, alloc);
-+      p->litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
-+      p->saveState.litProbs = (CLzmaProb *)alloc->Alloc(alloc, (0x300 << lclp) * sizeof(CLzmaProb));
-+      if (p->litProbs == 0 || p->saveState.litProbs == 0)
-+      {
-+        LzmaEnc_FreeLits(p, alloc);
-+        return SZ_ERROR_MEM;
-+      }
-+      p->lclp = lclp;
-+    }
-+  }
-+
-+  p->matchFinderBase.bigHash = (p->dictSize > kBigHashDicLimit);
-+
-+  if (beforeSize + p->dictSize < keepWindowSize)
-+    beforeSize = keepWindowSize - p->dictSize;
-+
-+  #ifndef _7ZIP_ST
-+  if (p->mtMode)
-+  {
-+    RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig));
-+    p->matchFinderObj = &p->matchFinderMt;
-+    MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
-+  }
-+  else
-+  #endif
-+  {
-+    if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
-+      return SZ_ERROR_MEM;
-+    p->matchFinderObj = &p->matchFinderBase;
-+    MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
-+  }
-+  return SZ_OK;
-+}
-+
-+void LzmaEnc_Init(CLzmaEnc *p)
-+{
-+  UInt32 i;
-+  p->state = 0;
-+  for (i = 0 ; i < LZMA_NUM_REPS; i++)
-+    p->reps[i] = 0;
-+
-+  RangeEnc_Init(&p->rc);
-+
-+
-+  for (i = 0; i < kNumStates; i++)
-+  {
-+    UInt32 j;
-+    for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
-+    {
-+      p->isMatch[i][j] = kProbInitValue;
-+      p->isRep0Long[i][j] = kProbInitValue;
-+    }
-+    p->isRep[i] = kProbInitValue;
-+    p->isRepG0[i] = kProbInitValue;
-+    p->isRepG1[i] = kProbInitValue;
-+    p->isRepG2[i] = kProbInitValue;
-+  }
-+
-+  {
-+    UInt32 num = 0x300 << (p->lp + p->lc);
-+    for (i = 0; i < num; i++)
-+      p->litProbs[i] = kProbInitValue;
-+  }
-+
-+  {
-+    for (i = 0; i < kNumLenToPosStates; i++)
-+    {
-+      CLzmaProb *probs = p->posSlotEncoder[i];
-+      UInt32 j;
-+      for (j = 0; j < (1 << kNumPosSlotBits); j++)
-+        probs[j] = kProbInitValue;
-+    }
-+  }
-+  {
-+    for (i = 0; i < kNumFullDistances - kEndPosModelIndex; i++)
-+      p->posEncoders[i] = kProbInitValue;
-+  }
-+
-+  LenEnc_Init(&p->lenEnc.p);
-+  LenEnc_Init(&p->repLenEnc.p);
-+
-+  for (i = 0; i < (1 << kNumAlignBits); i++)
-+    p->posAlignEncoder[i] = kProbInitValue;
-+
-+  p->optimumEndIndex = 0;
-+  p->optimumCurrentIndex = 0;
-+  p->additionalOffset = 0;
-+
-+  p->pbMask = (1 << p->pb) - 1;
-+  p->lpMask = (1 << p->lp) - 1;
-+}
-+
-+void LzmaEnc_InitPrices(CLzmaEnc *p)
-+{
-+  if (!p->fastMode)
-+  {
-+    FillDistancesPrices(p);
-+    FillAlignPrices(p);
-+  }
-+
-+  p->lenEnc.tableSize =
-+  p->repLenEnc.tableSize =
-+      p->numFastBytes + 1 - LZMA_MATCH_LEN_MIN;
-+  LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, p->ProbPrices);
-+  LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, p->ProbPrices);
-+}
-+
-+static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  UInt32 i;
-+  for (i = 0; i < (UInt32)kDicLogSizeMaxCompress; i++)
-+    if (p->dictSize <= ((UInt32)1 << i))
-+      break;
-+  p->distTableSize = i * 2;
-+
-+  p->finished = False;
-+  p->result = SZ_OK;
-+  RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
-+  LzmaEnc_Init(p);
-+  LzmaEnc_InitPrices(p);
-+  p->nowPos64 = 0;
-+  return SZ_OK;
-+}
-+
-+static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
-+    ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  p->matchFinderBase.stream = inStream;
-+  p->needInit = 1;
-+  p->rc.outStream = outStream;
-+  return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
-+}
-+
-+SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
-+    ISeqInStream *inStream, UInt32 keepWindowSize,
-+    ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  p->matchFinderBase.stream = inStream;
-+  p->needInit = 1;
-+  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
-+}
-+
-+static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
-+{
-+  p->matchFinderBase.directInput = 1;
-+  p->matchFinderBase.bufferBase = (Byte *)src;
-+  p->matchFinderBase.directInputRem = srcLen;
-+}
-+
-+SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
-+    UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  LzmaEnc_SetInputBuf(p, src, srcLen);
-+  p->needInit = 1;
-+
-+  return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
-+}
-+
-+void LzmaEnc_Finish(CLzmaEncHandle pp)
-+{
-+  #ifndef _7ZIP_ST
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  if (p->mtMode)
-+    MatchFinderMt_ReleaseStream(&p->matchFinderMt);
-+  #else
-+  pp = pp;
-+  #endif
-+}
-+
-+typedef struct
-+{
-+  ISeqOutStream funcTable;
-+  Byte *data;
-+  SizeT rem;
-+  Bool overflow;
-+} CSeqOutStreamBuf;
-+
-+static size_t MyWrite(void *pp, const void *data, size_t size)
-+{
-+  CSeqOutStreamBuf *p = (CSeqOutStreamBuf *)pp;
-+  if (p->rem < size)
-+  {
-+    size = p->rem;
-+    p->overflow = True;
-+  }
-+  memcpy(p->data, data, size);
-+  p->rem -= size;
-+  p->data += size;
-+  return size;
-+}
-+
-+
-+UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
-+{
-+  const CLzmaEnc *p = (CLzmaEnc *)pp;
-+  return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
-+}
-+
-+const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
-+{
-+  const CLzmaEnc *p = (CLzmaEnc *)pp;
-+  return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
-+}
-+
-+SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit,
-+    Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  UInt64 nowPos64;
-+  SRes res;
-+  CSeqOutStreamBuf outStream;
-+
-+  outStream.funcTable.Write = MyWrite;
-+  outStream.data = dest;
-+  outStream.rem = *destLen;
-+  outStream.overflow = False;
-+
-+  p->writeEndMark = False;
-+  p->finished = False;
-+  p->result = SZ_OK;
-+
-+  if (reInit)
-+    LzmaEnc_Init(p);
-+  LzmaEnc_InitPrices(p);
-+  nowPos64 = p->nowPos64;
-+  RangeEnc_Init(&p->rc);
-+  p->rc.outStream = &outStream.funcTable;
-+
-+  res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize);
-+  
-+  *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
-+  *destLen -= outStream.rem;
-+  if (outStream.overflow)
-+    return SZ_ERROR_OUTPUT_EOF;
-+
-+  return res;
-+}
-+
-+static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
-+{
-+  SRes res = SZ_OK;
-+
-+  #ifndef _7ZIP_ST
-+  Byte allocaDummy[0x300];
-+  int i = 0;
-+  for (i = 0; i < 16; i++)
-+    allocaDummy[i] = (Byte)i;
-+  #endif
-+
-+  for (;;)
-+  {
-+    res = LzmaEnc_CodeOneBlock(p, False, 0, 0);
-+    if (res != SZ_OK || p->finished != 0)
-+      break;
-+    if (progress != 0)
-+    {
-+      res = progress->Progress(progress, p->nowPos64, RangeEnc_GetProcessed(&p->rc));
-+      if (res != SZ_OK)
-+      {
-+        res = SZ_ERROR_PROGRESS;
-+        break;
-+      }
-+    }
-+  }
-+  LzmaEnc_Finish(p);
-+  return res;
-+}
-+
-+SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
-+    ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
-+  return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
-+}
-+
-+SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+  int i;
-+  UInt32 dictSize = p->dictSize;
-+  if (*size < LZMA_PROPS_SIZE)
-+    return SZ_ERROR_PARAM;
-+  *size = LZMA_PROPS_SIZE;
-+  props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
-+
-+  for (i = 11; i <= 30; i++)
-+  {
-+    if (dictSize <= ((UInt32)2 << i))
-+    {
-+      dictSize = (2 << i);
-+      break;
-+    }
-+    if (dictSize <= ((UInt32)3 << i))
-+    {
-+      dictSize = (3 << i);
-+      break;
-+    }
-+  }
-+
-+  for (i = 0; i < 4; i++)
-+    props[1 + i] = (Byte)(dictSize >> (8 * i));
-+  return SZ_OK;
-+}
-+
-+SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-+    int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  SRes res;
-+  CLzmaEnc *p = (CLzmaEnc *)pp;
-+
-+  CSeqOutStreamBuf outStream;
-+
-+  LzmaEnc_SetInputBuf(p, src, srcLen);
-+
-+  outStream.funcTable.Write = MyWrite;
-+  outStream.data = dest;
-+  outStream.rem = *destLen;
-+  outStream.overflow = False;
-+
-+  p->writeEndMark = writeEndMark;
-+
-+  p->rc.outStream = &outStream.funcTable;
-+  res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
-+  if (res == SZ_OK)
-+    res = LzmaEnc_Encode2(p, progress);
-+
-+  *destLen -= outStream.rem;
-+  if (outStream.overflow)
-+    return SZ_ERROR_OUTPUT_EOF;
-+  return res;
-+}
-+
-+SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
-+    const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
-+    ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
-+{
-+  CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
-+  SRes res;
-+  if (p == 0)
-+    return SZ_ERROR_MEM;
-+
-+  res = LzmaEnc_SetProps(p, props);
-+  if (res == SZ_OK)
-+  {
-+    res = LzmaEnc_WriteProperties(p, propsEncoded, propsSize);
-+    if (res == SZ_OK)
-+      res = LzmaEnc_MemEncode(p, dest, destLen, src, srcLen,
-+          writeEndMark, progress, alloc, allocBig);
-+  }
-+
-+  LzmaEnc_Destroy(p, alloc, allocBig);
-+  return res;
-+}
---- /dev/null
-+++ b/lib/lzma/Makefile
-@@ -0,0 +1,7 @@
-+lzma_compress-objs := LzFind.o LzmaEnc.o
-+lzma_decompress-objs := LzmaDec.o
-+
-+obj-$(CONFIG_LZMA_COMPRESS) += lzma_compress.o
-+obj-$(CONFIG_LZMA_DECOMPRESS) += lzma_decompress.o
-+
-+EXTRA_CFLAGS += -Iinclude/linux -Iinclude/linux/lzma -include types.h

+ 0 - 11
target/linux/generic/patches-2.6.33/011-mips_boot.patch

@@ -1,11 +0,0 @@
---- a/arch/mips/kernel/head.S
-+++ b/arch/mips/kernel/head.S
-@@ -121,6 +121,8 @@
- #endif
- 	.endm
- 
-+	j kernel_entry
-+	nop
- #ifndef CONFIG_NO_EXCEPT_FILL
- 	/*
- 	 * Reserved space for exception handlers.

+ 0 - 21
target/linux/generic/patches-2.6.33/012-extra_optimization.patch

@@ -1,21 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -529,7 +529,7 @@ all: vmlinux
- ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
- KBUILD_CFLAGS	+= -Os
- else
--KBUILD_CFLAGS	+= -O2
-+KBUILD_CFLAGS	+= -O2 -fno-reorder-blocks -fno-tree-ch
- endif
- 
- include $(srctree)/arch/$(SRCARCH)/Makefile
-@@ -567,6 +567,9 @@ endif
- NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
- CHECKFLAGS     += $(NOSTDINC_FLAGS)
- 
-+# improve gcc optimization
-+CFLAGS += $(call cc-option,-funit-at-a-time,)
-+
- # warn about C99 declaration after statement
- KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
- 

+ 0 - 11
target/linux/generic/patches-2.6.33/013-gcc4_inline_fix.patch

@@ -1,11 +0,0 @@
---- a/arch/mips/include/asm/system.h
-+++ b/arch/mips/include/asm/system.h
-@@ -194,7 +194,7 @@ extern __u64 __xchg_u64_unsupported_on_3
- #define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels
- #endif
- 
--static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
-+static __always_inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
- {
- 	switch (size) {
- 	case 4:

+ 0 - 50
target/linux/generic/patches-2.6.33/014-cfi_fix_amd_extended_table_check.patch

@@ -1,50 +0,0 @@
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -325,6 +325,8 @@ static struct cfi_fixup fixup_table[] =
- static void cfi_fixup_major_minor(struct cfi_private *cfi,
- 				  struct cfi_pri_amdstd *extp)
- {
-+	// manufacturers defined in include/linux/mtd/cfi.h
-+
- 	if (cfi->mfr == CFI_MFR_SAMSUNG && cfi->id == 0x257e &&
- 	    extp->MajorVersion == '0')
- 		extp->MajorVersion = '1';
-@@ -355,6 +357,9 @@ struct mtd_info *cfi_cmdset_0002(struct
- 	mtd->name    = map->name;
- 	mtd->writesize = 1;
- 
-+	printk(" CFI mfr 0x%08x\n", cfi->mfr);	// TODO: Is there a more general place to print this info?
-+	printk(" CFI id  0x%08x\n", cfi->id);
-+
- 	if (cfi->cfi_mode==CFI_MODE_CFI){
- 		unsigned char bootloc;
- 		/*
-@@ -373,16 +378,24 @@ struct mtd_info *cfi_cmdset_0002(struct
- 
- 		cfi_fixup_major_minor(cfi, extp);
- 
--		if (extp->MajorVersion != '1' ||
--		    (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
-+		// valid primary extension versions are: 1.0, 1.1, 1.2, 1.3
-+		// see: http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_r20.pdf, page 19 and on
-+		//      http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_100_20011201.pdf
-+		if (extp->MajorVersion < '1' ||
-+		    extp->MajorVersion > '1' ||
-+		    (extp->MajorVersion == '1' && ( extp->MinorVersion < '0' || extp->MinorVersion > '3'))) {
- 			printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
--			       "version %c.%c.\n",  extp->MajorVersion,
--			       extp->MinorVersion);
-+			       "version %c.%c (0x%02x/0x%02x).\n",
-+			       extp->MajorVersion, extp->MinorVersion,
-+			       extp->MajorVersion, extp->MinorVersion);
- 			kfree(extp);
- 			kfree(mtd);
- 			return NULL;
- 		}
- 
-+		printk("  Amd/Fujitsu Extended Query version %c.%c.\n",
-+		       extp->MajorVersion, extp->MinorVersion);
-+
- 		/* Install our own private info structure */
- 		cfi->cmdset_priv = extp;
- 

+ 0 - 208
target/linux/generic/patches-2.6.33/020-mips_multi_machine_support.patch

@@ -1,208 +0,0 @@
---- /dev/null
-+++ b/arch/mips/include/asm/mips_machine.h
-@@ -0,0 +1,54 @@
-+/*
-+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
-+ *
-+ *  This program is free software; you can redistribute it and/or modify it
-+ *  under the terms of the GNU General Public License version 2 as published
-+ *  by the Free Software Foundation.
-+ *
-+ */
-+
-+#ifndef __ASM_MIPS_MACHINE_H
-+#define __ASM_MIPS_MACHINE_H
-+
-+#include <linux/init.h>
-+#include <linux/list.h>
-+
-+#include <asm/bootinfo.h>
-+
-+struct mips_machine {
-+	unsigned long		mach_type;
-+	const char		*mach_id;
-+	const char		*mach_name;
-+	void			(*mach_setup)(void);
-+};
-+
-+#define MIPS_MACHINE(_type, _id, _name, _setup) 		\
-+static const char machine_name_##_type[] __initconst		\
-+			__aligned(1) = _name;			\
-+static const char machine_id_##_type[] __initconst		\
-+			__aligned(1) = _id;			\
-+static struct mips_machine machine_##_type			\
-+		__used __section(.mips.machines.init) =		\
-+{								\
-+	.mach_type	= _type,				\
-+	.mach_id	= machine_id_##_type,			\
-+	.mach_name	= machine_name_##_type,			\
-+	.mach_setup	= _setup,				\
-+};
-+
-+extern long __mips_machines_start;
-+extern long __mips_machines_end;
-+
-+#ifdef CONFIG_MIPS_MACHINE
-+int  mips_machtype_setup(char *id) __init;
-+void mips_machine_setup(void) __init;
-+void mips_set_machine_name(const char *name) __init;
-+char *mips_get_machine_name(void);
-+#else
-+static inline int mips_machtype_setup(char *id) { return 1; }
-+static inline void mips_machine_setup(void) { }
-+static inline void mips_set_machine_name(const char *name) { }
-+static inline char *mips_get_machine_name(void) { return NULL; }
-+#endif /* CONFIG_MIPS_MACHINE */
-+
-+#endif /* __ASM_MIPS_MACHINE_H */
---- /dev/null
-+++ b/arch/mips/kernel/mips_machine.c
-@@ -0,0 +1,86 @@
-+/*
-+ *  Copyright (C) 2008-2010 Gabor Juhos <[email protected]>
-+ *
-+ *  This program is free software; you can redistribute it and/or modify it
-+ *  under the terms of the GNU General Public License version 2 as published
-+ *  by the Free Software Foundation.
-+ *
-+ */
-+#include <linux/mm.h>
-+#include <linux/string.h>
-+#include <linux/slab.h>
-+
-+#include <asm/mips_machine.h>
-+
-+static struct mips_machine *mips_machine __initdata;
-+static char *mips_machine_name = "Unknown";
-+
-+#define for_each_machine(mach) \
-+	for ((mach) = (struct mips_machine *)&__mips_machines_start; \
-+	     (mach) && \
-+	     (unsigned long)(mach) < (unsigned long)&__mips_machines_end; \
-+	     (mach)++)
-+
-+__init void mips_set_machine_name(const char *name)
-+{
-+	char *p;
-+
-+	if (name == NULL)
-+		return;
-+
-+	p = kstrdup(name, GFP_KERNEL);
-+	if (!p)
-+		pr_err("MIPS: no memory for machine_name\n");
-+
-+	mips_machine_name = p;
-+}
-+
-+char *mips_get_machine_name(void)
-+{
-+	return mips_machine_name;
-+}
-+
-+__init int mips_machtype_setup(char *id)
-+{
-+	struct mips_machine *mach;
-+
-+	for_each_machine(mach) {
-+		if (mach->mach_id == NULL)
-+			continue;
-+
-+		if (strcmp(mach->mach_id, id) == 0) {
-+			mips_machtype = mach->mach_type;
-+			return 0;
-+		}
-+	}
-+
-+	pr_err("MIPS: no machine found for id '%s', supported machines:\n", id);
-+	pr_err("%-24s : %s\n", "id", "name");
-+	for_each_machine(mach)
-+		pr_err("%-24s : %s\n", mach->mach_id, mach->mach_name);
-+
-+	return 1;
-+}
-+
-+__setup("machtype=", mips_machtype_setup);
-+
-+__init void mips_machine_setup(void)
-+{
-+	struct mips_machine *mach;
-+
-+	for_each_machine(mach) {
-+		if (mips_machtype == mach->mach_type) {
-+			mips_machine = mach;
-+			break;
-+		}
-+	}
-+
-+	if (!mips_machine)
-+		return;
-+
-+	mips_set_machine_name(mips_machine->mach_name);
-+	pr_info("MIPS: machine is %s\n", mips_machine_name);
-+
-+	if (mips_machine->mach_setup)
-+		mips_machine->mach_setup();
-+}
---- a/arch/mips/kernel/Makefile
-+++ b/arch/mips/kernel/Makefile
-@@ -93,6 +93,7 @@ obj-$(CONFIG_GPIO_TXX9)		+= gpio_txx9.o
- 
- obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o
- obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
-+obj-$(CONFIG_MIPS_MACHINE)	+= mips_machine.o
- 
- CFLAGS_cpu-bugs64.o	= $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
- 
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -851,6 +851,9 @@ config MIPS_DISABLE_OBSOLETE_IDE
- config SYNC_R4K
- 	bool
- 
-+config MIPS_MACHINE
-+	def_bool n
-+
- config NO_IOPORT
- 	def_bool n
- 
---- a/arch/mips/kernel/proc.c
-+++ b/arch/mips/kernel/proc.c
-@@ -12,6 +12,7 @@
- #include <asm/cpu-features.h>
- #include <asm/mipsregs.h>
- #include <asm/processor.h>
-+#include <asm/mips_machine.h>
- 
- unsigned int vced_count, vcei_count;
- 
-@@ -31,8 +32,12 @@ static int show_cpuinfo(struct seq_file
- 	/*
- 	 * For the first processor also print the system type
- 	 */
--	if (n == 0)
-+	if (n == 0) {
- 		seq_printf(m, "system type\t\t: %s\n", get_system_type());
-+		if (mips_get_machine_name())
-+			seq_printf(m, "machine\t\t\t: %s\n",
-+				   mips_get_machine_name());
-+	}
- 
- 	seq_printf(m, "processor\t\t: %ld\n", n);
- 	sprintf(fmt, "cpu model\t\t: %%s V%%d.%%d%s\n",
---- a/arch/mips/kernel/vmlinux.lds.S
-+++ b/arch/mips/kernel/vmlinux.lds.S
-@@ -98,6 +98,13 @@ SECTIONS
- 	INIT_TEXT_SECTION(PAGE_SIZE)
- 	INIT_DATA_SECTION(16)
- 
-+	. = ALIGN(4);
-+	.mips.machines.init : AT(ADDR(.mips.machines.init) - LOAD_OFFSET) {
-+		__mips_machines_start = .;
-+		*(.mips.machines.init)
-+		__mips_machines_end = .;
-+	}
-+
- 	/* .exit.text is discarded at runtime, not link time, to deal with
- 	 * references from .rodata
- 	 */

+ 0 - 28
target/linux/generic/patches-2.6.33/021-mips_image_cmdline_hack.patch

@@ -1,28 +0,0 @@
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -854,6 +854,10 @@ config SYNC_R4K
- config MIPS_MACHINE
- 	def_bool n
- 
-+config IMAGE_CMDLINE_HACK
-+	bool "OpenWrt specific image command line hack"
-+	default n
-+
- config NO_IOPORT
- 	def_bool n
- 
---- a/arch/mips/kernel/head.S
-+++ b/arch/mips/kernel/head.S
-@@ -143,6 +143,12 @@ FEXPORT(__kernel_entry)
- 	j	kernel_entry
- #endif
- 
-+#ifdef CONFIG_IMAGE_CMDLINE_HACK
-+	.ascii	"CMDLINE:"
-+EXPORT(__image_cmdline)
-+	.fill	0x400
-+#endif /* CONFIG_IMAGE_CMDLINE_HACK */
-+
- 	__REF
- 
- NESTED(kernel_entry, 16, sp)			# kernel entry point

+ 0 - 18
target/linux/generic/patches-2.6.33/022-mips_use_generic_thread_info_allocator.patch

@@ -1,18 +0,0 @@
---- a/arch/mips/include/asm/thread_info.h
-+++ b/arch/mips/include/asm/thread_info.h
-@@ -83,6 +83,7 @@ register struct thread_info *__current_t
- #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
- #define THREAD_MASK (THREAD_SIZE - 1UL)
- 
-+#if 0
- #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
- 
- #ifdef CONFIG_DEBUG_STACK_USAGE
-@@ -92,6 +93,7 @@ register struct thread_info *__current_t
- #endif
- 
- #define free_thread_info(info) kfree(info)
-+#endif
- 
- #endif /* !__ASSEMBLY__ */
- 

+ 0 - 11
target/linux/generic/patches-2.6.33/023-mips-fix-kexec.patch

@@ -1,11 +0,0 @@
---- a/arch/mips/kernel/machine_kexec.c
-+++ b/arch/mips/kernel/machine_kexec.c
-@@ -52,7 +52,7 @@ machine_kexec(struct kimage *image)
- 	reboot_code_buffer =
- 	  (unsigned long)page_address(image->control_code_page);
- 
--	kexec_start_address = image->start;
-+	kexec_start_address = (unsigned long) phys_to_virt(image->start);
- 	kexec_indirection_page =
- 		(unsigned long) phys_to_virt(image->head & PAGE_MASK);
- 

+ 0 - 161
target/linux/generic/patches-2.6.33/025-mips_disable_fpu.patch

@@ -1,161 +0,0 @@
-MIPS: allow disabling the kernel FPU emulator
-
-This patch allows turning off the in-kernel Algorithmics
-FPU emulator support, which allows one to save a couple of
-precious blocks on an embedded system.
-
-Signed-off-by: Florian Fainelli <[email protected]>
---
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -839,6 +839,17 @@ config I8259
- config MIPS_BONITO64
- 	bool
- 
-+config MIPS_FPU_EMU
-+	bool "Enable FPU emulation"
-+	default y
-+	help
-+	   This option allows building a kernel with or without the Algorithmics
-+	   FPU emulator enabled. Turning off this option results in a kernel which
-+	   does not catch floating operations exceptions. Make sure that your toolchain
-+	   is configured to enable software floating point emulation in that case.
-+		
-+	   If unsure say Y here.
-+
- config MIPS_MSC
- 	bool
- 
---- a/arch/mips/math-emu/Makefile
-+++ b/arch/mips/math-emu/Makefile
-@@ -2,12 +2,14 @@
- # Makefile for the Linux/MIPS kernel FPU emulation.
- #
- 
--obj-y	:= cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
-+obj-y	:=	kernel_linkage.o dsemul.o cp1emu.o
-+
-+obj-$(CONFIG_MIPS_FPU_EMU)	+= ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
- 	   ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
- 	   dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
- 	   dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \
- 	   sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
- 	   sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
--	   dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
-+	   dp_sqrt.o sp_sqrt.o
- 
- EXTRA_CFLAGS += -Werror
---- a/arch/mips/math-emu/cp1emu.c
-+++ b/arch/mips/math-emu/cp1emu.c
-@@ -58,7 +58,11 @@
- #define __mips 4
- 
- /* Function which emulates a floating point instruction. */
-+#ifdef CONFIG_DEBUG_FS
-+DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
-+#endif
- 
-+#ifdef CONFIG_MIPS_FPU_EMU
- static int fpu_emu(struct pt_regs *, struct mips_fpu_struct *,
- 	mips_instruction);
- 
-@@ -69,10 +73,6 @@ static int fpux_emu(struct pt_regs *,
- 
- /* Further private data for which no space exists in mips_fpu_struct */
- 
--#ifdef CONFIG_DEBUG_FS
--DEFINE_PER_CPU(struct mips_fpu_emulator_stats, fpuemustats);
--#endif
--
- /* Control registers */
- 
- #define FPCREG_RID	0	/* $0  = revision id */
-@@ -1284,7 +1284,6 @@ int fpu_emulator_cop1Handler(struct pt_r
- 
- 	return sig;
- }
--
- #ifdef CONFIG_DEBUG_FS
- 
- static int fpuemu_stat_get(void *data, u64 *val)
-@@ -1333,4 +1332,11 @@ static int __init debugfs_fpuemu(void)
- 	return 0;
- }
- __initcall(debugfs_fpuemu);
--#endif
-+#endif /* CONFIG_DEBUGFS */
-+#else
-+int fpu_emulator_cop1Handler(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
-+        int has_fpu)
-+{
-+	return 0;
-+}
-+#endif /* CONFIG_MIPS_FPU_EMU */
---- a/arch/mips/math-emu/dsemul.c
-+++ b/arch/mips/math-emu/dsemul.c
-@@ -109,6 +109,7 @@ int mips_dsemul(struct pt_regs *regs, mi
- 	return SIGILL;		/* force out of emulation loop */
- }
- 
-+#ifdef CONFIG_MIPS_FPU_EMU
- int do_dsemulret(struct pt_regs *xcp)
- {
- 	struct emuframe __user *fr;
-@@ -165,3 +166,9 @@ int do_dsemulret(struct pt_regs *xcp)
- 
- 	return 1;
- }
-+#else
-+int do_dsemulret(struct pt_regs *xcp)
-+{
-+	return 0;
-+}
-+#endif /* CONFIG_MIPS_FPU_EMU */
---- a/arch/mips/math-emu/kernel_linkage.c
-+++ b/arch/mips/math-emu/kernel_linkage.c
-@@ -29,6 +29,7 @@
- 
- #define SIGNALLING_NAN 0x7ff800007ff80000LL
- 
-+#ifdef CONFIG_MIPS_FPU_EMU
- void fpu_emulator_init_fpu(void)
- {
- 	static int first = 1;
-@@ -112,4 +113,36 @@ int fpu_emulator_restore_context32(struc
- 
- 	return err;
- }
--#endif
-+#endif	/* CONFIG_64BIT */
-+#else
-+
-+void fpu_emulator_init_fpu(void)
-+{
-+	printk(KERN_INFO "FPU emulator disabled, make sure your toolchain"
-+		"was compiled with software floating point support (soft-float)\n");
-+	return;
-+}
-+
-+int fpu_emulator_save_context(struct sigcontext __user *sc)
-+{
-+	return 0;
-+}
-+
-+int fpu_emulator_restore_context(struct sigcontext __user *sc)
-+{
-+	return 0;
-+}
-+
-+int fpu_emulator_save_context32(struct sigcontext32 __user *sc)
-+{
-+	return 0;
-+}
-+
-+int fpu_emulator_restore_context32(struct sigcontext32 __user *sc)
-+{
-+	return 0;
-+}
-+
-+#ifdef CONFIG_64BIT
-+#endif	/* CONFIG_64BIT */
-+#endif /* CONFIG_MIPS_FPU_EMU */

+ 0 - 368
target/linux/generic/patches-2.6.33/027-mips_module_reloc.patch

@@ -1,368 +0,0 @@
---- a/arch/mips/Makefile
-+++ b/arch/mips/Makefile
-@@ -93,7 +93,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
- cflags-y			+= -G 0 -mno-abicalls -fno-pic -pipe
- cflags-y			+= -msoft-float
- LDFLAGS_vmlinux			+= -G 0 -static -n -nostdlib
--MODFLAGS			+= -mlong-calls
-+MODFLAGS			+= -mno-long-calls
- 
- cflags-y += -ffreestanding
- 
---- a/arch/mips/include/asm/module.h
-+++ b/arch/mips/include/asm/module.h
-@@ -9,6 +9,11 @@ struct mod_arch_specific {
- 	struct list_head dbe_list;
- 	const struct exception_table_entry *dbe_start;
- 	const struct exception_table_entry *dbe_end;
-+
-+	void *phys_plt_tbl;
-+	void *virt_plt_tbl;
-+	unsigned int phys_plt_offset;
-+	unsigned int virt_plt_offset;
- };
- 
- typedef uint8_t Elf64_Byte;		/* Type for a 8-bit quantity.  */
---- a/arch/mips/kernel/module.c
-+++ b/arch/mips/kernel/module.c
-@@ -43,6 +43,117 @@ static struct mips_hi16 *mips_hi16_list;
- static LIST_HEAD(dbe_list);
- static DEFINE_SPINLOCK(dbe_lock);
- 
-+/*
-+ * Get the potential max trampolines size required of the init and
-+ * non-init sections. Only used if we cannot find enough contiguous
-+ * physically mapped memory to put the module into.
-+ */
-+static unsigned int
-+get_plt_size(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
-+             const char *secstrings, unsigned int symindex, bool is_init)
-+{
-+	unsigned long ret = 0;
-+	unsigned int i, j;
-+	Elf_Sym *syms;
-+
-+	/* Everything marked ALLOC (this includes the exported symbols) */
-+	for (i = 1; i < hdr->e_shnum; ++i) {
-+		unsigned int info = sechdrs[i].sh_info;
-+
-+		if (sechdrs[i].sh_type != SHT_REL
-+		    && sechdrs[i].sh_type != SHT_RELA)
-+			continue;
-+
-+		/* Not a valid relocation section? */
-+		if (info >= hdr->e_shnum)
-+			continue;
-+
-+		/* Don't bother with non-allocated sections */
-+		if (!(sechdrs[info].sh_flags & SHF_ALLOC))
-+			continue;
-+
-+		/* If it's called *.init*, and we're not init, we're
-+                   not interested */
-+		if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0)
-+		    != is_init)
-+			continue;
-+
-+		syms = (Elf_Sym *) sechdrs[symindex].sh_addr;
-+		if (sechdrs[i].sh_type == SHT_REL) {
-+			Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr;
-+			unsigned int size = sechdrs[i].sh_size / sizeof(*rel);
-+
-+			for (j = 0; j < size; ++j) {
-+				Elf_Sym *sym;
-+
-+				if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26)
-+					continue;
-+
-+				sym = syms + ELF_MIPS_R_SYM(rel[j]);
-+				if (!is_init && sym->st_shndx != SHN_UNDEF)
-+					continue;
-+
-+				ret += 4 * sizeof(int);
-+			}
-+		} else {
-+			Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr;
-+			unsigned int size = sechdrs[i].sh_size / sizeof(*rela);
-+
-+			for (j = 0; j < size; ++j) {
-+				Elf_Sym *sym;
-+
-+				if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26)
-+					continue;
-+
-+				sym = syms + ELF_MIPS_R_SYM(rela[j]);
-+				if (!is_init && sym->st_shndx != SHN_UNDEF)
-+					continue;
-+
-+				ret += 4 * sizeof(int);
-+			}
-+		}
-+	}
-+
-+	return ret;
-+}
-+
-+#ifndef MODULE_START
-+static void *alloc_phys(unsigned long size)
-+{
-+	unsigned order;
-+	struct page *page;
-+	struct page *p;
-+
-+	size = PAGE_ALIGN(size);
-+	order = get_order(size);
-+
-+	page = alloc_pages(GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN |
-+			__GFP_THISNODE, order);
-+	if (!page)
-+		return NULL;
-+
-+	split_page(page, order);
-+
-+	for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p)
-+		__free_page(p);
-+
-+	return page_address(page);
-+}
-+#endif
-+
-+static void free_phys(void *ptr, unsigned long size)
-+{
-+	struct page *page;
-+	struct page *end;
-+
-+	page = virt_to_page(ptr);
-+	end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT);
-+
-+	for (; page < end; ++page)
-+		__free_page(page);
-+}
-+
-+
- void *module_alloc(unsigned long size)
- {
- #ifdef MODULE_START
-@@ -58,21 +169,99 @@ void *module_alloc(unsigned long size)
- 
- 	return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL);
- #else
-+	void *ptr;
-+
- 	if (size == 0)
- 		return NULL;
--	return vmalloc(size);
-+
-+	ptr = alloc_phys(size);
-+
-+	/* If we failed to allocate physically contiguous memory,
-+	 * fall back to regular vmalloc. The module loader code will
-+	 * create jump tables to handle long jumps */
-+	if (!ptr)
-+		return vmalloc(size);
-+
-+	return ptr;
-+#endif
-+}
-+
-+static inline bool is_phys_addr(void *ptr)
-+{
-+#ifdef CONFIG_64BIT
-+	return (KSEGX((unsigned long)ptr) == CKSEG0);
-+#else
-+	return (KSEGX(ptr) == KSEG0);
- #endif
- }
- 
- /* Free memory returned from module_alloc */
- void module_free(struct module *mod, void *module_region)
- {
--	vfree(module_region);
-+	if (is_phys_addr(module_region)) {
-+		if (mod->module_init == module_region)
-+			free_phys(module_region, mod->init_size);
-+		else if (mod->module_core == module_region)
-+			free_phys(module_region, mod->core_size);
-+		else
-+			BUG();
-+	} else {
-+		vfree(module_region);
-+	}
-+}
-+
-+static void *__module_alloc(int size, bool phys)
-+{
-+	void *ptr;
-+
-+	if (phys)
-+		ptr = kmalloc(size, GFP_KERNEL);
-+	else
-+		ptr = vmalloc(size);
-+	return ptr;
-+}
-+
-+static void __module_free(void *ptr)
-+{
-+	if (is_phys_addr(ptr))
-+		kfree(ptr);
-+	else
-+		vfree(ptr);
- }
- 
- int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
- 			      char *secstrings, struct module *mod)
- {
-+	unsigned int symindex = 0;
-+	unsigned int core_size, init_size;
-+	int i;
-+
-+	for (i = 1; i < hdr->e_shnum; i++)
-+		if (sechdrs[i].sh_type == SHT_SYMTAB)
-+			symindex = i;
-+
-+	core_size = get_plt_size(hdr, sechdrs, secstrings, symindex, false);
-+	init_size = get_plt_size(hdr, sechdrs, secstrings, symindex, true);
-+
-+	mod->arch.phys_plt_offset = 0;
-+	mod->arch.virt_plt_offset = 0;
-+	mod->arch.phys_plt_tbl = NULL;
-+	mod->arch.virt_plt_tbl = NULL;
-+
-+	if ((core_size + init_size) == 0)
-+		return 0;
-+
-+	mod->arch.phys_plt_tbl = __module_alloc(core_size + init_size, 1);
-+	if (!mod->arch.phys_plt_tbl)
-+		return -ENOMEM;
-+
-+	mod->arch.virt_plt_tbl = __module_alloc(core_size + init_size, 0);
-+	if (!mod->arch.virt_plt_tbl) {
-+		__module_free(mod->arch.phys_plt_tbl);
-+		mod->arch.phys_plt_tbl = NULL;
-+		return -ENOMEM;
-+	}
-+
- 	return 0;
- }
- 
-@@ -95,28 +284,36 @@ static int apply_r_mips_32_rela(struct m
- 	return 0;
- }
- 
--static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
-+static Elf_Addr add_plt_entry_to(unsigned *plt_offset,
-+				 void *start, Elf_Addr v)
- {
--	if (v % 4) {
--		pr_err("module %s: dangerous R_MIPS_26 REL relocation\n",
--		       me->name);
--		return -ENOEXEC;
--	}
-+	unsigned *tramp = start + *plt_offset;
-+	*plt_offset += 4 * sizeof(int);
- 
--	if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
--		printk(KERN_ERR
--		       "module %s: relocation overflow\n",
--		       me->name);
--		return -ENOEXEC;
--	}
-+	/* adjust carry for addiu */
-+	if (v & 0x00008000)
-+		v += 0x10000;
- 
--	*location = (*location & ~0x03ffffff) |
--	            ((*location + (v >> 2)) & 0x03ffffff);
-+	tramp[0] = 0x3c190000 | (v >> 16);      /* lui t9, hi16 */
-+	tramp[1] = 0x27390000 | (v & 0xffff);   /* addiu t9, t9, lo16 */
-+	tramp[2] = 0x03200008;                  /* jr t9 */
-+	tramp[3] = 0x00000000;                  /* nop */
- 
--	return 0;
-+	return (Elf_Addr) tramp;
- }
- 
--static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v)
-+static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v)
-+{
-+	if (is_phys_addr(location))
-+		return add_plt_entry_to(&me->arch.phys_plt_offset,
-+				me->arch.phys_plt_tbl, v);
-+	else
-+		return add_plt_entry_to(&me->arch.virt_plt_offset,
-+				me->arch.virt_plt_tbl, v);
-+
-+}
-+
-+static int set_r_mips_26(struct module *me, u32 *location, u32 ofs, Elf_Addr v)
- {
- 	if (v % 4) {
- 		pr_err("module %s: dangerous R_MIPS_26 RELArelocation\n",
-@@ -125,17 +322,31 @@ static int apply_r_mips_26_rela(struct m
- 	}
- 
- 	if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
--		printk(KERN_ERR
-+	    v = add_plt_entry(me, location, v + (ofs << 2));
-+		if (!v) {
-+			printk(KERN_ERR
- 		       "module %s: relocation overflow\n",
- 		       me->name);
--		return -ENOEXEC;
-+			return -ENOEXEC;
-+		}
-+		ofs = 0;
- 	}
- 
--	*location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff);
-+	*location = (*location & ~0x03ffffff) | ((ofs + (v >> 2)) & 0x03ffffff);
- 
- 	return 0;
- }
- 
-+static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
-+{
-+	return set_r_mips_26(me, location, *location & 0x03ffffff, v);
-+}
-+
-+static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v)
-+{
-+	return set_r_mips_26(me, location, 0, v);
-+}
-+
- static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
- {
- 	struct mips_hi16 *n;
-@@ -400,11 +611,32 @@ int module_finalize(const Elf_Ehdr *hdr,
- 		list_add(&me->arch.dbe_list, &dbe_list);
- 		spin_unlock_irq(&dbe_lock);
- 	}
-+
-+	/* Get rid of the fixup trampoline if we're running the module
-+	 * from physically mapped address space */
-+	if (me->arch.phys_plt_offset == 0) {
-+		__module_free(me->arch.phys_plt_tbl);
-+		me->arch.phys_plt_tbl = NULL;
-+	}
-+	if (me->arch.virt_plt_offset == 0) {
-+		__module_free(me->arch.virt_plt_tbl);
-+		me->arch.virt_plt_tbl = NULL;
-+	}
-+
- 	return 0;
- }
- 
- void module_arch_cleanup(struct module *mod)
- {
-+	if (mod->arch.phys_plt_tbl) {
-+		__module_free(mod->arch.phys_plt_tbl);
-+		mod->arch.phys_plt_tbl = NULL;
-+	}
-+	if (mod->arch.virt_plt_tbl) {
-+		__module_free(mod->arch.virt_plt_tbl);
-+		mod->arch.virt_plt_tbl = NULL;
-+	}
-+
- 	spin_lock_irq(&dbe_lock);
- 	list_del(&mod->arch.dbe_list);
- 	spin_unlock_irq(&dbe_lock);

+ 0 - 119
target/linux/generic/patches-2.6.33/028-module_exports.patch

@@ -1,119 +0,0 @@
---- a/include/asm-generic/vmlinux.lds.h
-+++ b/include/asm-generic/vmlinux.lds.h
-@@ -52,6 +52,27 @@
- #define LOAD_OFFSET 0
- #endif
- 
-+#ifndef SYMTAB_KEEP_STR
-+#define SYMTAB_KEEP_STR *(__ksymtab_strings.*)
-+#define SYMTAB_DISCARD_STR
-+#else
-+#define SYMTAB_DISCARD_STR *(__ksymtab_strings.*)
-+#endif
-+
-+#ifndef SYMTAB_KEEP
-+#define SYMTAB_KEEP *(__ksymtab.*)
-+#define SYMTAB_DISCARD
-+#else
-+#define SYMTAB_DISCARD *(__ksymtab.*)
-+#endif
-+
-+#ifndef SYMTAB_KEEP_GPL
-+#define SYMTAB_KEEP_GPL *(__ksymtab_gpl.*)
-+#define SYMTAB_DISCARD_GPL
-+#else
-+#define SYMTAB_DISCARD_GPL *(__ksymtab_gpl.*)
-+#endif
-+
- #ifndef SYMBOL_PREFIX
- #define VMLINUX_SYMBOL(sym) sym
- #else
-@@ -258,35 +279,35 @@
- 	/* Kernel symbol table: Normal symbols */			\
- 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
- 		VMLINUX_SYMBOL(__start___ksymtab) = .;			\
--		*(__ksymtab)						\
-+		SYMTAB_KEEP						\
- 		VMLINUX_SYMBOL(__stop___ksymtab) = .;			\
- 	}								\
- 									\
- 	/* Kernel symbol table: GPL-only symbols */			\
- 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
- 		VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;		\
--		*(__ksymtab_gpl)					\
-+		SYMTAB_KEEP_GPL						\
- 		VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;		\
- 	}								\
- 									\
- 	/* Kernel symbol table: Normal unused symbols */		\
- 	__ksymtab_unused  : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) {	\
- 		VMLINUX_SYMBOL(__start___ksymtab_unused) = .;		\
--		*(__ksymtab_unused)					\
-+		*(__ksymtab_unused.*)					\
- 		VMLINUX_SYMBOL(__stop___ksymtab_unused) = .;		\
- 	}								\
- 									\
- 	/* Kernel symbol table: GPL-only unused symbols */		\
- 	__ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
- 		VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .;	\
--		*(__ksymtab_unused_gpl)					\
-+		*(__ksymtab_unused_gpl.*)				\
- 		VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .;	\
- 	}								\
- 									\
- 	/* Kernel symbol table: GPL-future-only symbols */		\
- 	__ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
- 		VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .;	\
--		*(__ksymtab_gpl_future)					\
-+		*(__ksymtab_gpl_future.*)				\
- 		VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .;	\
- 	}								\
- 									\
-@@ -327,7 +348,7 @@
- 									\
- 	/* Kernel symbol table: strings */				\
-         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {	\
--		*(__ksymtab_strings)					\
-+		SYMTAB_KEEP_STR						\
- 	}								\
- 									\
- 	/* __*init sections */						\
-@@ -642,6 +663,9 @@
- 	EXIT_TEXT							\
- 	EXIT_DATA							\
- 	EXIT_CALL							\
-+	SYMTAB_DISCARD							\
-+	SYMTAB_DISCARD_GPL						\
-+	SYMTAB_DISCARD_STR						\
- 	*(.discard)							\
- 	}
- 
---- a/include/linux/module.h
-+++ b/include/linux/module.h
-@@ -194,16 +194,24 @@ void *__symbol_get_gpl(const char *symbo
- #define __CRC_SYMBOL(sym, sec)
- #endif
- 
-+#ifdef MODULE
-+#define __EXPORT_SUFFIX(sym)
-+#else
-+#define __EXPORT_SUFFIX(sym) "." #sym
-+#endif
-+
- /* For every exported symbol, place a struct in the __ksymtab section */
- #define __EXPORT_SYMBOL(sym, sec)				\
- 	extern typeof(sym) sym;					\
- 	__CRC_SYMBOL(sym, sec)					\
- 	static const char __kstrtab_##sym[]			\
--	__attribute__((section("__ksymtab_strings"), aligned(1))) \
-+	__attribute__((section("__ksymtab_strings"		\
-+	  __EXPORT_SUFFIX(sym)), aligned(1)))			\
- 	= MODULE_SYMBOL_PREFIX #sym;                    	\
- 	static const struct kernel_symbol __ksymtab_##sym	\
- 	__used							\
--	__attribute__((section("__ksymtab" sec), unused))	\
-+	__attribute__((section("__ksymtab" sec			\
-+	  __EXPORT_SUFFIX(sym)), unused))			\
- 	= { (unsigned long)&sym, __kstrtab_##sym }
- 
- #define EXPORT_SYMBOL(sym)					\

+ 0 - 13
target/linux/generic/patches-2.6.33/029-arm_module_unresolved_weak_sym.patch

@@ -1,13 +0,0 @@
---- a/arch/arm/kernel/module.c
-+++ b/arch/arm/kernel/module.c
-@@ -121,6 +121,10 @@ apply_relocate(Elf32_Shdr *sechdrs, cons
- 			return -ENOEXEC;
- 		}
- 
-+		if ((IS_ERR_VALUE(sym->st_value) || !sym->st_value) &&
-+		    ELF_ST_BIND(sym->st_info) == STB_WEAK)
-+			continue;
-+
- 		loc = dstsec->sh_addr + rel->r_offset;
- 
- 		switch (ELF32_R_TYPE(rel->r_info)) {

+ 0 - 43
target/linux/generic/patches-2.6.33/030-pci_disable_common_quirks.patch

@@ -1,43 +0,0 @@
---- a/drivers/pci/Kconfig
-+++ b/drivers/pci/Kconfig
-@@ -51,6 +51,12 @@ config PCI_STUB
- 
- 	  When in doubt, say N.
- 
-+config PCI_DISABLE_COMMON_QUIRKS
-+	bool "PCI disable common quirks"
-+	depends on PCI
-+	help
-+	  If you don't know what to do here, say N.
-+
- config HT_IRQ
- 	bool "Interrupts on hypertransport devices"
- 	default y
---- a/drivers/pci/quirks.c
-+++ b/drivers/pci/quirks.c
-@@ -96,6 +96,7 @@ static void __devinit quirk_resource_ali
- }
- DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_resource_alignment);
- 
-+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
- /* The Mellanox Tavor device gives false positive parity errors
-  * Mark this device with a broken_parity_status, to allow
-  * PCI scanning code to "skip" this now blacklisted device.
-@@ -1908,7 +1909,9 @@ static void __devinit fixup_rev1_53c810(
- 	}
- }
- DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
-+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
- 
-+#ifndef CONFIG_PCI_DISABLE_COMMON_QUIRKS
- /* Enable 1k I/O space granularity on the Intel P64H2 */
- static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev)
- {
-@@ -2543,6 +2546,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_I
- DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1518, quirk_i82576_sriov);
- 
- #endif	/* CONFIG_PCI_IOV */
-+#endif /* !CONFIG_PCI_DISABLE_COMMON_QUIRKS */
- 
- static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
- 			  struct pci_fixup *end)

+ 0 - 226
target/linux/generic/patches-2.6.33/031-ppc_gcc_build_fix.patch

@@ -1,226 +0,0 @@
-GCC 4.4.x looks to be adding support for generating out-of-line register
-saves/restores based on:
-
-http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01678.html
-
-This breaks the kernel build as we'd have to link with libgcc to get the
-implementation of the register save/restores.
-
-To workaround this issue, we just stole the save/restore code from gcc
-and simplified it down for our needs (integer only).  We only do this if
-PPC32 as gcc makes believe the linker on ppc64 will deal with this and
-only if CONFIG_CC_OPTIMIZE_FOR_SIZE is set (thus -Os).
-
-Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
----
-
-If someone using cutting edge toolchains for ppc64 could test and make
-sure if we enable CONFIG_CC_OPTIMIZE_FOR_SIZE things work that would be
-nice.
-
-- k
-
- arch/powerpc/kernel/misc_32.S   |   77 +++++++++++++++++++++++++++
- arch/powerpc/kernel/ppc_ksyms.c |  111 +++++++++++++++++++++++++++++++++++++++
- 2 files changed, 188 insertions(+), 0 deletions(-)
-
---- a/arch/powerpc/kernel/misc_32.S
-+++ b/arch/powerpc/kernel/misc_32.S
-@@ -802,3 +802,80 @@ relocate_new_kernel_end:
- relocate_new_kernel_size:
- 	.long relocate_new_kernel_end - relocate_new_kernel
- #endif
-+
-+#if defined(CONFIG_PPC32) && defined(CONFIG_CC_OPTIMIZE_FOR_SIZE)
-+/* Routines for saving integer registers, called by the compiler.  */
-+/* Called with r11 pointing to the stack header word of the caller of the */
-+/* function, just beyond the end of the integer save area.  */
-+
-+_GLOBAL(_savegpr_14)   stw     14,-72(11)      /* save gp registers */
-+_GLOBAL(_savegpr_15)   stw     15,-68(11)
-+_GLOBAL(_savegpr_16)   stw     16,-64(11)
-+_GLOBAL(_savegpr_17)   stw     17,-60(11)
-+_GLOBAL(_savegpr_18)   stw     18,-56(11)
-+_GLOBAL(_savegpr_19)   stw     19,-52(11)
-+_GLOBAL(_savegpr_20)   stw     20,-48(11)
-+_GLOBAL(_savegpr_21)   stw     21,-44(11)
-+_GLOBAL(_savegpr_22)   stw     22,-40(11)
-+_GLOBAL(_savegpr_23)   stw     23,-36(11)
-+_GLOBAL(_savegpr_24)   stw     24,-32(11)
-+_GLOBAL(_savegpr_25)   stw     25,-28(11)
-+_GLOBAL(_savegpr_26)   stw     26,-24(11)
-+_GLOBAL(_savegpr_27)   stw     27,-20(11)
-+_GLOBAL(_savegpr_28)   stw     28,-16(11)
-+_GLOBAL(_savegpr_29)   stw     29,-12(11)
-+_GLOBAL(_savegpr_30)   stw     30,-8(11)
-+_GLOBAL(_savegpr_31)   stw     31,-4(11)
-+                       blr
-+
-+/* Routines for restoring integer registers, called by the compiler.  */
-+/* Called with r11 pointing to the stack header word of the caller of the */
-+/* function, just beyond the end of the integer restore area.  */
-+
-+_GLOBAL(_restgpr_14)   lwz     14,-72(11)      /* restore gp registers */
-+_GLOBAL(_restgpr_15)   lwz     15,-68(11)
-+_GLOBAL(_restgpr_16)   lwz     16,-64(11)
-+_GLOBAL(_restgpr_17)   lwz     17,-60(11)
-+_GLOBAL(_restgpr_18)   lwz     18,-56(11)
-+_GLOBAL(_restgpr_19)   lwz     19,-52(11)
-+_GLOBAL(_restgpr_20)   lwz     20,-48(11)
-+_GLOBAL(_restgpr_21)   lwz     21,-44(11)
-+_GLOBAL(_restgpr_22)   lwz     22,-40(11)
-+_GLOBAL(_restgpr_23)   lwz     23,-36(11)
-+_GLOBAL(_restgpr_24)   lwz     24,-32(11)
-+_GLOBAL(_restgpr_25)   lwz     25,-28(11)
-+_GLOBAL(_restgpr_26)   lwz     26,-24(11)
-+_GLOBAL(_restgpr_27)   lwz     27,-20(11)
-+_GLOBAL(_restgpr_28)   lwz     28,-16(11)
-+_GLOBAL(_restgpr_29)   lwz     29,-12(11)
-+_GLOBAL(_restgpr_30)   lwz     30,-8(11)
-+_GLOBAL(_restgpr_31)   lwz     31,-4(11)
-+                       blr
-+
-+/* Routines for restoring integer registers, called by the compiler.  */
-+/* Called with r11 pointing to the stack header word of the caller of the */
-+/* function, just beyond the end of the integer restore area.  */
-+
-+_GLOBAL(_restgpr_14_x) lwz     14,-72(11)      /* restore gp registers */
-+_GLOBAL(_restgpr_15_x) lwz     15,-68(11)
-+_GLOBAL(_restgpr_16_x) lwz     16,-64(11)
-+_GLOBAL(_restgpr_17_x) lwz     17,-60(11)
-+_GLOBAL(_restgpr_18_x) lwz     18,-56(11)
-+_GLOBAL(_restgpr_19_x) lwz     19,-52(11)
-+_GLOBAL(_restgpr_20_x) lwz     20,-48(11)
-+_GLOBAL(_restgpr_21_x) lwz     21,-44(11)
-+_GLOBAL(_restgpr_22_x) lwz     22,-40(11)
-+_GLOBAL(_restgpr_23_x) lwz     23,-36(11)
-+_GLOBAL(_restgpr_24_x) lwz     24,-32(11)
-+_GLOBAL(_restgpr_25_x) lwz     25,-28(11)
-+_GLOBAL(_restgpr_26_x) lwz     26,-24(11)
-+_GLOBAL(_restgpr_27_x) lwz     27,-20(11)
-+_GLOBAL(_restgpr_28_x) lwz     28,-16(11)
-+_GLOBAL(_restgpr_29_x) lwz     29,-12(11)
-+_GLOBAL(_restgpr_30_x) lwz     30,-8(11)
-+_GLOBAL(_restgpr_31_x) lwz     0,4(11)
-+                       lwz     31,-4(11)
-+                       mtlr    0
-+                       mr      1,11
-+                       blr
-+#endif
---- a/arch/powerpc/kernel/ppc_ksyms.c
-+++ b/arch/powerpc/kernel/ppc_ksyms.c
-@@ -185,3 +185,114 @@ EXPORT_SYMBOL(__mtdcr);
- EXPORT_SYMBOL(__mfdcr);
- #endif
- EXPORT_SYMBOL(empty_zero_page);
-+
-+#if defined(CONFIG_PPC32) && defined(CONFIG_CC_OPTIMIZE_FOR_SIZE)
-+void _savegpr_14(void);
-+void _savegpr_15(void);
-+void _savegpr_16(void);
-+void _savegpr_17(void);
-+void _savegpr_18(void);
-+void _savegpr_19(void);
-+void _savegpr_20(void);
-+void _savegpr_21(void);
-+void _savegpr_22(void);
-+void _savegpr_23(void);
-+void _savegpr_24(void);
-+void _savegpr_25(void);
-+void _savegpr_26(void);
-+void _savegpr_27(void);
-+void _savegpr_28(void);
-+void _savegpr_29(void);
-+void _savegpr_30(void);
-+void _savegpr_31(void);
-+void _restgpr_14(void);
-+void _restgpr_15(void);
-+void _restgpr_16(void);
-+void _restgpr_17(void);
-+void _restgpr_18(void);
-+void _restgpr_19(void);
-+void _restgpr_20(void);
-+void _restgpr_21(void);
-+void _restgpr_22(void);
-+void _restgpr_23(void);
-+void _restgpr_24(void);
-+void _restgpr_25(void);
-+void _restgpr_26(void);
-+void _restgpr_27(void);
-+void _restgpr_28(void);
-+void _restgpr_29(void);
-+void _restgpr_30(void);
-+void _restgpr_31(void);
-+void _restgpr_14_x(void);
-+void _restgpr_15_x(void);
-+void _restgpr_16_x(void);
-+void _restgpr_17_x(void);
-+void _restgpr_18_x(void);
-+void _restgpr_19_x(void);
-+void _restgpr_20_x(void);
-+void _restgpr_21_x(void);
-+void _restgpr_22_x(void);
-+void _restgpr_23_x(void);
-+void _restgpr_24_x(void);
-+void _restgpr_25_x(void);
-+void _restgpr_26_x(void);
-+void _restgpr_27_x(void);
-+void _restgpr_28_x(void);
-+void _restgpr_29_x(void);
-+void _restgpr_30_x(void);
-+void _restgpr_31_x(void);
-+EXPORT_SYMBOL(_savegpr_14);
-+EXPORT_SYMBOL(_savegpr_15);
-+EXPORT_SYMBOL(_savegpr_16);
-+EXPORT_SYMBOL(_savegpr_17);
-+EXPORT_SYMBOL(_savegpr_18);
-+EXPORT_SYMBOL(_savegpr_19);
-+EXPORT_SYMBOL(_savegpr_20);
-+EXPORT_SYMBOL(_savegpr_21);
-+EXPORT_SYMBOL(_savegpr_22);
-+EXPORT_SYMBOL(_savegpr_23);
-+EXPORT_SYMBOL(_savegpr_24);
-+EXPORT_SYMBOL(_savegpr_25);
-+EXPORT_SYMBOL(_savegpr_26);
-+EXPORT_SYMBOL(_savegpr_27);
-+EXPORT_SYMBOL(_savegpr_28);
-+EXPORT_SYMBOL(_savegpr_29);
-+EXPORT_SYMBOL(_savegpr_30);
-+EXPORT_SYMBOL(_savegpr_31);
-+EXPORT_SYMBOL(_restgpr_14);
-+EXPORT_SYMBOL(_restgpr_15);
-+EXPORT_SYMBOL(_restgpr_16);
-+EXPORT_SYMBOL(_restgpr_17);
-+EXPORT_SYMBOL(_restgpr_18);
-+EXPORT_SYMBOL(_restgpr_19);
-+EXPORT_SYMBOL(_restgpr_20);
-+EXPORT_SYMBOL(_restgpr_21);
-+EXPORT_SYMBOL(_restgpr_22);
-+EXPORT_SYMBOL(_restgpr_23);
-+EXPORT_SYMBOL(_restgpr_24);
-+EXPORT_SYMBOL(_restgpr_25);
-+EXPORT_SYMBOL(_restgpr_26);
-+EXPORT_SYMBOL(_restgpr_27);
-+EXPORT_SYMBOL(_restgpr_28);
-+EXPORT_SYMBOL(_restgpr_29);
-+EXPORT_SYMBOL(_restgpr_30);
-+EXPORT_SYMBOL(_restgpr_31);
-+EXPORT_SYMBOL(_restgpr_14_x);
-+EXPORT_SYMBOL(_restgpr_15_x);
-+EXPORT_SYMBOL(_restgpr_16_x);
-+EXPORT_SYMBOL(_restgpr_17_x);
-+EXPORT_SYMBOL(_restgpr_18_x);
-+EXPORT_SYMBOL(_restgpr_19_x);
-+EXPORT_SYMBOL(_restgpr_20_x);
-+EXPORT_SYMBOL(_restgpr_21_x);
-+EXPORT_SYMBOL(_restgpr_22_x);
-+EXPORT_SYMBOL(_restgpr_23_x);
-+EXPORT_SYMBOL(_restgpr_24_x);
-+EXPORT_SYMBOL(_restgpr_25_x);
-+EXPORT_SYMBOL(_restgpr_26_x);
-+EXPORT_SYMBOL(_restgpr_27_x);
-+EXPORT_SYMBOL(_restgpr_28_x);
-+EXPORT_SYMBOL(_restgpr_29_x);
-+EXPORT_SYMBOL(_restgpr_30_x);
-+EXPORT_SYMBOL(_restgpr_31_x);
-+#endif /* CONFIG_PPC32 && CONFIG_CC_OPTIMIZE_FOR_SIZE */

+ 0 - 430
target/linux/generic/patches-2.6.33/040-arm-update-mach-types.patch

@@ -1,430 +0,0 @@
---- a/arch/arm/tools/mach-types
-+++ b/arch/arm/tools/mach-types
-@@ -12,7 +12,7 @@
- #
- #   http://www.arm.linux.org.uk/developer/machines/?action=new
- #
--# Last update: Sat Feb 20 14:16:15 2010
-+# Last update: Sat Aug 14 08:06:22 2010
- #
- # machine_is_xxx	CONFIG_xxxx		MACH_TYPE_xxx		number
- #
-@@ -1319,7 +1319,7 @@ mistral			MACH_MISTRAL		MISTRAL			1315
- msm			MACH_MSM		MSM			1316
- ct5910			MACH_CT5910		CT5910			1317
- ct5912			MACH_CT5912		CT5912			1318
--hynet_ine		MACH_HYNET_INE		HYNET_INE		1319
-+argonst_foundation	MACH_HYNET_INE		HYNET_INE		1319
- hynet_app		MACH_HYNET_APP		HYNET_APP		1320
- msm7200			MACH_MSM7200		MSM7200			1321
- msm7600			MACH_MSM7600		MSM7600			1322
-@@ -1777,7 +1777,7 @@ wdg002			MACH_WDG002		WDG002			1785
- sg560adsl		MACH_SG560ADSL		SG560ADSL		1786
- nextio_n2800_ica	MACH_NEXTIO_N2800_ICA	NEXTIO_N2800_ICA	1787
- dove_db			MACH_DOVE_DB		DOVE_DB			1788
--marvell_newdb		MACH_MARVELL_NEWDB	MARVELL_NEWDB		1789
-+dove_avng		MACH_MARVELL_NEWDB	MARVELL_NEWDB		1789
- vandihud		MACH_VANDIHUD		VANDIHUD		1790
- magx_e8			MACH_MAGX_E8		MAGX_E8			1791
- magx_z6			MACH_MAGX_Z6		MAGX_Z6			1792
-@@ -1994,7 +1994,7 @@ spark			MACH_SPARK		SPARK			2002
- benzina			MACH_BENZINA		BENZINA			2003
- blaze			MACH_BLAZE		BLAZE			2004
- linkstation_ls_hgl	MACH_LINKSTATION_LS_HGL	LINKSTATION_LS_HGL	2005
--htckovsky		MACH_HTCVENUS		HTCVENUS		2006
-+htckovsky		MACH_HTCKOVSKY		HTCKOVSKY		2006
- sony_prs505		MACH_SONY_PRS505	SONY_PRS505		2007
- hanlin_v3		MACH_HANLIN_V3		HANLIN_V3		2008
- sapphira		MACH_SAPPHIRA		SAPPHIRA		2009
-@@ -2308,7 +2308,7 @@ ecac2378		MACH_ECAC2378		ECAC2378		2319
- tazkiosk		MACH_TAZKIOSK		TAZKIOSK		2320
- whiterabbit_mch		MACH_WHITERABBIT_MCH	WHITERABBIT_MCH		2321
- sbox9263		MACH_SBOX9263		SBOX9263		2322
--oreo			MACH_OREO		OREO			2323
-+oreo_camera		MACH_OREO		OREO			2323
- smdk6442		MACH_SMDK6442		SMDK6442		2324
- openrd_base		MACH_OPENRD_BASE	OPENRD_BASE		2325
- incredible		MACH_INCREDIBLE		INCREDIBLE		2326
-@@ -2374,7 +2374,7 @@ sch_m490		MACH_SCH_M490		SCH_M490		2386
- rbl01			MACH_RBL01		RBL01			2387
- omnifi			MACH_OMNIFI		OMNIFI			2388
- otavalo			MACH_OTAVALO		OTAVALO			2389
--sienna			MACH_SIENNA		SIENNA			2390
-+siena			MACH_SIENNA		SIENNA			2390
- htc_excalibur_s620	MACH_HTC_EXCALIBUR_S620	HTC_EXCALIBUR_S620	2391
- htc_opal		MACH_HTC_OPAL		HTC_OPAL		2392
- touchbook		MACH_TOUCHBOOK		TOUCHBOOK		2393
-@@ -2498,7 +2498,7 @@ hiram			MACH_HIRAM		HIRAM			2510
- phy3250			MACH_PHY3250		PHY3250			2511
- ea3250			MACH_EA3250		EA3250			2512
- fdi3250			MACH_FDI3250		FDI3250			2513
--whitestone		MACH_WHITESTONE		WHITESTONE		2514
-+htcwhitestone		MACH_WHITESTONE		WHITESTONE		2514
- at91sam9263nit		MACH_AT91SAM9263NIT	AT91SAM9263NIT		2515
- ccmx51			MACH_CCMX51		CCMX51			2516
- ccmx51js		MACH_CCMX51JS		CCMX51JS		2517
-@@ -2561,7 +2561,7 @@ magnolia2		MACH_MAGNOLIA2		MAGNOLIA2		25
- emxx			MACH_EMXX		EMXX			2574
- outlaw			MACH_OUTLAW		OUTLAW			2575
- riot_bei2		MACH_RIOT_BEI2		RIOT_BEI2		2576
--riot_vox		MACH_RIOT_VOX		RIOT_VOX		2577
-+riot_gx2		MACH_RIOT_VOX		RIOT_VOX		2577
- riot_x37		MACH_RIOT_X37		RIOT_X37		2578
- mega25mx		MACH_MEGA25MX		MEGA25MX		2579
- benzina2		MACH_BENZINA2		BENZINA2		2580
-@@ -2582,7 +2582,7 @@ omap3_bulldog		MACH_OMAP3_BULLDOG	OMAP3_
- pca101			MACH_PCA101		PCA101			2595
- buzzc			MACH_BUZZC		BUZZC			2596
- sasie2			MACH_SASIE2		SASIE2			2597
--davinci_cio		MACH_DAVINCI_CIO	DAVINCI_CIO		2598
-+davinci_dm6467_cio	MACH_DAVINCI_CIO	DAVINCI_CIO		2598
- smartmeter_dl		MACH_SMARTMETER_DL	SMARTMETER_DL		2599
- wzl6410			MACH_WZL6410		WZL6410			2600
- wzl6410m		MACH_WZL6410M		WZL6410M		2601
-@@ -2609,7 +2609,7 @@ fujitsu_tvstbsoc1	MACH_FUJITSU_TVSTBSOC1
- lexikon			MACH_LEXIKON		LEXIKON			2622
- mini2440v2		MACH_MINI2440V2		MINI2440V2		2623
- icontrol		MACH_ICONTROL		ICONTROL		2624
--sheevad			MACH_SHEEVAD		SHEEVAD			2625
-+gplugd			MACH_SHEEVAD		SHEEVAD			2625
- qsd8x50a_st1_1		MACH_QSD8X50A_ST1_1	QSD8X50A_ST1_1		2626
- qsd8x50a_st1_5		MACH_QSD8X50A_ST1_5	QSD8X50A_ST1_5		2627
- bee			MACH_BEE		BEE			2628
-@@ -2663,7 +2663,7 @@ reb01			MACH_REB01		REB01			2675
- aquila			MACH_AQUILA		AQUILA			2676
- spark_sls_hw2		MACH_SPARK_SLS_HW2	SPARK_SLS_HW2		2677
- sheeva_esata		MACH_ESATA_SHEEVAPLUG	ESATA_SHEEVAPLUG	2678
--surf7x30		MACH_SURF7X30		SURF7X30		2679
-+msm7x30_surf		MACH_MSM7X30_SURF	MSM7X30_SURF		2679
- micro2440		MACH_MICRO2440		MICRO2440		2680
- am2440			MACH_AM2440		AM2440			2681
- tq2440			MACH_TQ2440		TQ2440			2682
-@@ -2678,3 +2678,328 @@ vc088x			MACH_VC088X		VC088X			2690
- mioa702			MACH_MIOA702		MIOA702			2691
- hpmin			MACH_HPMIN		HPMIN			2692
- ak880xak		MACH_AK880XAK		AK880XAK		2693
-+arm926tomap850		MACH_ARM926TOMAP850	ARM926TOMAP850		2694
-+lkevm			MACH_LKEVM		LKEVM			2695
-+mw6410			MACH_MW6410		MW6410			2696
-+terastation_wxl		MACH_TERASTATION_WXL	TERASTATION_WXL		2697
-+cpu8000e		MACH_CPU8000E		CPU8000E		2698
-+catania			MACH_CATANIA		CATANIA			2699
-+tokyo			MACH_TOKYO		TOKYO			2700
-+msm7201a_surf		MACH_MSM7201A_SURF	MSM7201A_SURF		2701
-+msm7201a_ffa		MACH_MSM7201A_FFA	MSM7201A_FFA		2702
-+msm7x25_surf		MACH_MSM7X25_SURF	MSM7X25_SURF		2703
-+msm7x25_ffa		MACH_MSM7X25_FFA	MSM7X25_FFA		2704
-+msm7x27_surf		MACH_MSM7X27_SURF	MSM7X27_SURF		2705
-+msm7x27_ffa		MACH_MSM7X27_FFA	MSM7X27_FFA		2706
-+msm7x30_ffa		MACH_MSM7X30_FFA	MSM7X30_FFA		2707
-+qsd8x50_surf		MACH_QSD8X50_SURF	QSD8X50_SURF		2708
-+qsd8x50_comet		MACH_QSD8X50_COMET	QSD8X50_COMET		2709
-+qsd8x50_ffa		MACH_QSD8X50_FFA	QSD8X50_FFA		2710
-+qsd8x50a_surf		MACH_QSD8X50A_SURF	QSD8X50A_SURF		2711
-+qsd8x50a_ffa		MACH_QSD8X50A_FFA	QSD8X50A_FFA		2712
-+adx_xgcp10		MACH_ADX_XGCP10		ADX_XGCP10		2713
-+mcgwumts2a		MACH_MCGWUMTS2A		MCGWUMTS2A		2714
-+mobikt			MACH_MOBIKT		MOBIKT			2715
-+mx53_evk		MACH_MX53_EVK		MX53_EVK		2716
-+igep0030		MACH_IGEP0030		IGEP0030		2717
-+axell_h40_h50_ctrl	MACH_AXELL_H40_H50_CTRL	AXELL_H40_H50_CTRL	2718
-+dtcommod		MACH_DTCOMMOD		DTCOMMOD		2719
-+gould			MACH_GOULD		GOULD			2720
-+siberia			MACH_SIBERIA		SIBERIA			2721
-+sbc3530			MACH_SBC3530		SBC3530			2722
-+qarm			MACH_QARM		QARM			2723
-+mips			MACH_MIPS		MIPS			2724
-+mx27grb			MACH_MX27GRB		MX27GRB			2725
-+sbc8100			MACH_SBC8100		SBC8100			2726
-+saarb			MACH_SAARB		SAARB			2727
-+omap3mini		MACH_OMAP3MINI		OMAP3MINI		2728
-+cnmbook7se		MACH_CNMBOOK7SE		CNMBOOK7SE		2729
-+catan			MACH_CATAN		CATAN			2730
-+harmony			MACH_HARMONY		HARMONY			2731
-+tonga			MACH_TONGA		TONGA			2732
-+cybook_orizon		MACH_CYBOOK_ORIZON	CYBOOK_ORIZON		2733
-+htcrhodiumcdma		MACH_HTCRHODIUMCDMA	HTCRHODIUMCDMA		2734
-+epc_g45			MACH_EPC_G45		EPC_G45			2735
-+epc_lpc3250		MACH_EPC_LPC3250	EPC_LPC3250		2736
-+mxc91341evb		MACH_MXC91341EVB	MXC91341EVB		2737
-+rtw1000			MACH_RTW1000		RTW1000			2738
-+bobcat			MACH_BOBCAT		BOBCAT			2739
-+trizeps6		MACH_TRIZEPS6		TRIZEPS6		2740
-+msm7x30_fluid		MACH_MSM7X30_FLUID	MSM7X30_FLUID		2741
-+nedap9263		MACH_NEDAP9263		NEDAP9263		2742
-+netgear_ms2110		MACH_NETGEAR_MS2110	NETGEAR_MS2110		2743
-+bmx			MACH_BMX		BMX			2744
-+netstream		MACH_NETSTREAM		NETSTREAM		2745
-+vpnext_rcu		MACH_VPNEXT_RCU		VPNEXT_RCU		2746
-+vpnext_mpu		MACH_VPNEXT_MPU		VPNEXT_MPU		2747
-+bcmring_tablet_v1	MACH_BCMRING_TABLET_V1	BCMRING_TABLET_V1	2748
-+sgarm10			MACH_SGARM10		SGARM10			2749
-+cm_t3517		MACH_CM_T3517		CM_T3517		2750
-+omap3_cps		MACH_OMAP3_CPS		OMAP3_CPS		2751
-+axar1500_receiver	MACH_AXAR1500_RECEIVER	AXAR1500_RECEIVER	2752
-+wbd222			MACH_WBD222		WBD222			2753
-+mt65xx			MACH_MT65XX		MT65XX			2754
-+msm8x60_surf		MACH_MSM8X60_SURF	MSM8X60_SURF		2755
-+msm8x60_sim		MACH_MSM8X60_SIM	MSM8X60_SIM		2756
-+vmc300			MACH_VMC300		VMC300			2757
-+tcc8000_sdk		MACH_TCC8000_SDK	TCC8000_SDK		2758
-+nanos			MACH_NANOS		NANOS			2759
-+stamp9g10		MACH_STAMP9G10		STAMP9G10		2760
-+stamp9g45		MACH_STAMP9G45		STAMP9G45		2761
-+h6053			MACH_H6053		H6053			2762
-+smint01			MACH_SMINT01		SMINT01			2763
-+prtlvt2			MACH_PRTLVT2		PRTLVT2			2764
-+ap420			MACH_AP420		AP420			2765
-+htcclio			MACH_HTCSHIFT		HTCSHIFT		2766
-+davinci_dm365_fc	MACH_DAVINCI_DM365_FC	DAVINCI_DM365_FC	2767
-+msm8x55_surf		MACH_MSM8X55_SURF	MSM8X55_SURF		2768
-+msm8x55_ffa		MACH_MSM8X55_FFA	MSM8X55_FFA		2769
-+esl_vamana		MACH_ESL_VAMANA		ESL_VAMANA		2770
-+sbc35			MACH_SBC35		SBC35			2771
-+mpx6446			MACH_MPX6446		MPX6446			2772
-+oreo_controller		MACH_OREO_CONTROLLER	OREO_CONTROLLER		2773
-+kopin_models		MACH_KOPIN_MODELS	KOPIN_MODELS		2774
-+ttc_vision2		MACH_TTC_VISION2	TTC_VISION2		2775
-+cns3420vb		MACH_CNS3420VB		CNS3420VB		2776
-+lpc_evo			MACH_LPC2		LPC2			2777
-+olympus			MACH_OLYMPUS		OLYMPUS			2778
-+vortex			MACH_VORTEX		VORTEX			2779
-+s5pc200			MACH_S5PC200		S5PC200			2780
-+ecucore_9263		MACH_ECUCORE_9263	ECUCORE_9263		2781
-+smdkc200		MACH_SMDKC200		SMDKC200		2782
-+emsiso_sx27		MACH_EMSISO_SX27	EMSISO_SX27		2783
-+apx_som9g45_ek		MACH_APX_SOM9G45_EK	APX_SOM9G45_EK		2784
-+songshan		MACH_SONGSHAN		SONGSHAN		2785
-+tianshan		MACH_TIANSHAN		TIANSHAN		2786
-+vpx500			MACH_VPX500		VPX500			2787
-+am3517sam		MACH_AM3517SAM		AM3517SAM		2788
-+skat91_sim508		MACH_SKAT91_SIM508	SKAT91_SIM508		2789
-+skat91_s3e		MACH_SKAT91_S3E		SKAT91_S3E		2790
-+omap4_panda		MACH_OMAP4_PANDA	OMAP4_PANDA		2791
-+df7220			MACH_DF7220		DF7220			2792
-+nemini			MACH_NEMINI		NEMINI			2793
-+t8200			MACH_T8200		T8200			2794
-+apf51			MACH_APF51		APF51			2795
-+dr_rc_unit		MACH_DR_RC_UNIT		DR_RC_UNIT		2796
-+bordeaux		MACH_BORDEAUX		BORDEAUX		2797
-+catania_b		MACH_CATANIA_B		CATANIA_B		2798
-+mx51_ocean		MACH_MX51_OCEAN		MX51_OCEAN		2799
-+ti8168evm		MACH_TI8168EVM		TI8168EVM		2800
-+neocoreomap		MACH_NEOCOREOMAP	NEOCOREOMAP		2801
-+withings_wbp		MACH_WITHINGS_WBP	WITHINGS_WBP		2802
-+dbps			MACH_DBPS		DBPS			2803
-+at91sam9261		MACH_SBC9261		SBC9261			2804
-+pcbfp0001		MACH_PCBFP0001		PCBFP0001		2805
-+speedy			MACH_SPEEDY		SPEEDY			2806
-+chrysaor		MACH_CHRYSAOR		CHRYSAOR		2807
-+tango			MACH_TANGO		TANGO			2808
-+synology_dsx11		MACH_SYNOLOGY_DSX11	SYNOLOGY_DSX11		2809
-+hanlin_v3ext		MACH_HANLIN_V3EXT	HANLIN_V3EXT		2810
-+hanlin_v5		MACH_HANLIN_V5		HANLIN_V5		2811
-+hanlin_v3plus		MACH_HANLIN_V3PLUS	HANLIN_V3PLUS		2812
-+iriver_story		MACH_IRIVER_STORY	IRIVER_STORY		2813
-+irex_iliad		MACH_IREX_ILIAD		IREX_ILIAD		2814
-+irex_dr1000		MACH_IREX_DR1000	IREX_DR1000		2815
-+teton_bga		MACH_TETON_BGA		TETON_BGA		2816
-+snapper9g45		MACH_SNAPPER9G45	SNAPPER9G45		2817
-+tam3517			MACH_TAM3517		TAM3517			2818
-+pdc100			MACH_PDC100		PDC100			2819
-+eukrea_cpuimx25sd	MACH_EUKREA_CPUIMX25	EUKREA_CPUIMX25		2820
-+eukrea_cpuimx35sd	MACH_EUKREA_CPUIMX35	EUKREA_CPUIMX35		2821
-+eukrea_cpuimx51sd	MACH_EUKREA_CPUIMX51SD	EUKREA_CPUIMX51SD	2822
-+eukrea_cpuimx51		MACH_EUKREA_CPUIMX51	EUKREA_CPUIMX51		2823
-+p565			MACH_P565		P565			2824
-+acer_a4			MACH_ACER_A4		ACER_A4			2825
-+davinci_dm368_bip	MACH_DAVINCI_DM368_BIP	DAVINCI_DM368_BIP	2826
-+eshare			MACH_ESHARE		ESHARE			2827
-+omapl138_europa		MACH_HW_OMAPL138_EUROPA	HW_OMAPL138_EUROPA	2828
-+wlbargn			MACH_WLBARGN		WLBARGN			2829
-+bm170			MACH_BM170		BM170			2830
-+netspace_mini_v2	MACH_NETSPACE_MINI_V2	NETSPACE_MINI_V2	2831
-+netspace_plug_v2	MACH_NETSPACE_PLUG_V2	NETSPACE_PLUG_V2	2832
-+siemens_l1		MACH_SIEMENS_L1		SIEMENS_L1		2833
-+elv_lcu1		MACH_ELV_LCU1		ELV_LCU1		2834
-+mcu1			MACH_MCU1		MCU1			2835
-+omap3_tao3530		MACH_OMAP3_TAO3530	OMAP3_TAO3530		2836
-+omap3_pcutouch		MACH_OMAP3_PCUTOUCH	OMAP3_PCUTOUCH		2837
-+smdkc210		MACH_SMDKC210		SMDKC210		2838
-+omap3_braillo		MACH_OMAP3_BRAILLO	OMAP3_BRAILLO		2839
-+spyplug			MACH_SPYPLUG		SPYPLUG			2840
-+ginger			MACH_GINGER		GINGER			2841
-+tny_t3530		MACH_TNY_T3530		TNY_T3530		2842
-+pca102			MACH_PCA102		PCA102			2843
-+spade			MACH_SPADE		SPADE			2844
-+mxc25_topaz		MACH_MXC25_TOPAZ	MXC25_TOPAZ		2845
-+t5325			MACH_T5325		T5325			2846
-+gw2361			MACH_GW2361		GW2361			2847
-+elog			MACH_ELOG		ELOG			2848
-+income			MACH_INCOME		INCOME			2849
-+bcm589x			MACH_BCM589X		BCM589X			2850
-+etna			MACH_ETNA		ETNA			2851
-+hawks			MACH_HAWKS		HAWKS			2852
-+meson			MACH_MESON		MESON			2853
-+xsbase255		MACH_XSBASE255		XSBASE255		2854
-+pvm2030			MACH_PVM2030		PVM2030			2855
-+mioa502			MACH_MIOA502		MIOA502			2856
-+vvbox_sdorig2		MACH_VVBOX_SDORIG2	VVBOX_SDORIG2		2857
-+vvbox_sdlite2		MACH_VVBOX_SDLITE2	VVBOX_SDLITE2		2858
-+vvbox_sdpro4		MACH_VVBOX_SDPRO4	VVBOX_SDPRO4		2859
-+htc_spv_m700		MACH_HTC_SPV_M700	HTC_SPV_M700		2860
-+mx257sx			MACH_MX257SX		MX257SX			2861
-+goni			MACH_GONI		GONI			2862
-+msm8x55_svlte_ffa	MACH_MSM8X55_SVLTE_FFA	MSM8X55_SVLTE_FFA	2863
-+msm8x55_svlte_surf	MACH_MSM8X55_SVLTE_SURF	MSM8X55_SVLTE_SURF	2864
-+quickstep		MACH_QUICKSTEP		QUICKSTEP		2865
-+dmw96			MACH_DMW96		DMW96			2866
-+hammerhead		MACH_HAMMERHEAD		HAMMERHEAD		2867
-+trident			MACH_TRIDENT		TRIDENT			2868
-+lightning		MACH_LIGHTNING		LIGHTNING		2869
-+iconnect		MACH_ICONNECT		ICONNECT		2870
-+autobot			MACH_AUTOBOT		AUTOBOT			2871
-+coconut			MACH_COCONUT		COCONUT			2872
-+durian			MACH_DURIAN		DURIAN			2873
-+cayenne			MACH_CAYENNE		CAYENNE			2874
-+fuji			MACH_FUJI		FUJI			2875
-+synology_6282		MACH_SYNOLOGY_6282	SYNOLOGY_6282		2876
-+em1sy			MACH_EM1SY		EM1SY			2877
-+m502			MACH_M502		M502			2878
-+matrix518		MACH_MATRIX518		MATRIX518		2879
-+tiny_gurnard		MACH_TINY_GURNARD	TINY_GURNARD		2880
-+spear1310		MACH_SPEAR1310		SPEAR1310		2881
-+bv07			MACH_BV07		BV07			2882
-+mxt_td61		MACH_MXT_TD61		MXT_TD61		2883
-+openrd_ultimate		MACH_OPENRD_ULTIMATE	OPENRD_ULTIMATE		2884
-+devixp			MACH_DEVIXP		DEVIXP			2885
-+miccpt			MACH_MICCPT		MICCPT			2886
-+mic256			MACH_MIC256		MIC256			2887
-+as1167			MACH_AS1167		AS1167			2888
-+omap3_ibiza		MACH_OMAP3_IBIZA	OMAP3_IBIZA		2889
-+u5500			MACH_U5500		U5500			2890
-+davinci_picto		MACH_DAVINCI_PICTO	DAVINCI_PICTO		2891
-+mecha			MACH_MECHA		MECHA			2892
-+bubba3			MACH_BUBBA3		BUBBA3			2893
-+pupitre			MACH_PUPITRE		PUPITRE			2894
-+tegra_harmony		MACH_TEGRA_HARMONY	TEGRA_HARMONY		2895
-+tegra_vogue		MACH_TEGRA_VOGUE	TEGRA_VOGUE		2896
-+tegra_e1165		MACH_TEGRA_E1165	TEGRA_E1165		2897
-+simplenet		MACH_SIMPLENET		SIMPLENET		2898
-+ec4350tbm		MACH_EC4350TBM		EC4350TBM		2899
-+pec_tc			MACH_PEC_TC		PEC_TC			2900
-+pec_hc2			MACH_PEC_HC2		PEC_HC2			2901
-+esl_mobilis_a		MACH_ESL_MOBILIS_A	ESL_MOBILIS_A		2902
-+esl_mobilis_b		MACH_ESL_MOBILIS_B	ESL_MOBILIS_B		2903
-+esl_wave_a		MACH_ESL_WAVE_A		ESL_WAVE_A		2904
-+esl_wave_b		MACH_ESL_WAVE_B		ESL_WAVE_B		2905
-+unisense_mmm		MACH_UNISENSE_MMM	UNISENSE_MMM		2906
-+blueshark		MACH_BLUESHARK		BLUESHARK		2907
-+e10			MACH_E10		E10			2908
-+app3k_robin		MACH_APP3K_ROBIN	APP3K_ROBIN		2909
-+pov15hd			MACH_POV15HD		POV15HD			2910
-+stella			MACH_STELLA		STELLA			2911
-+htc_iolite		MACH_MACH_HTC_IOLITE	MACH_HTC_IOLITE		2912
-+linkstation_lschl	MACH_LINKSTATION_LSCHL	LINKSTATION_LSCHL	2913
-+netwalker		MACH_NETWALKER		NETWALKER		2914
-+acsx106			MACH_ACSX106		ACSX106			2915
-+atlas5_c1		MACH_ATLAS5_C1		ATLAS5_C1		2916
-+nsb3ast			MACH_NSB3AST		NSB3AST			2917
-+gnet_slc		MACH_GNET_SLC		GNET_SLC		2918
-+af4000			MACH_AF4000		AF4000			2919
-+ark9431			MACH_ARK9431		ARK9431			2920
-+fs_s5pc100		MACH_FS_S5PC100		FS_S5PC100		2921
-+omap3505nova8		MACH_OMAP3505NOVA8	OMAP3505NOVA8		2922
-+omap3621_edp1		MACH_OMAP3621_EDP1	OMAP3621_EDP1		2923
-+oratisaes		MACH_ORATISAES		ORATISAES		2924
-+smdkv310		MACH_SMDKV310		SMDKV310		2925
-+siemens_l0		MACH_SIEMENS_L0		SIEMENS_L0		2926
-+ventana			MACH_VENTANA		VENTANA			2927
-+wm8505_7in_netbook	MACH_WM8505_7IN_NETBOOK	WM8505_7IN_NETBOOK	2928
-+ec4350sdb		MACH_EC4350SDB		EC4350SDB		2929
-+mimas			MACH_MIMAS		MIMAS			2930
-+titan			MACH_TITAN		TITAN			2931
-+craneboard		MACH_CRANEBOARD		CRANEBOARD		2932
-+es2440			MACH_ES2440		ES2440			2933
-+najay_a9263		MACH_NAJAY_A9263	NAJAY_A9263		2934
-+htctornado		MACH_HTCTORNADO		HTCTORNADO		2935
-+dimm_mx257		MACH_DIMM_MX257		DIMM_MX257		2936
-+jigen301		MACH_JIGEN		JIGEN			2937
-+smdk6450		MACH_SMDK6450		SMDK6450		2938
-+meno_qng		MACH_MENO_QNG		MENO_QNG		2939
-+ns2416			MACH_NS2416		NS2416			2940
-+rpc353			MACH_RPC353		RPC353			2941
-+tq6410			MACH_TQ6410		TQ6410			2942
-+sky6410			MACH_SKY6410		SKY6410			2943
-+dynasty			MACH_DYNASTY		DYNASTY			2944
-+vivo			MACH_VIVO		VIVO			2945
-+bury_bl7582		MACH_BURY_BL7582	BURY_BL7582		2946
-+bury_bps5270		MACH_BURY_BPS5270	BURY_BPS5270		2947
-+basi			MACH_BASI		BASI			2948
-+tn200			MACH_TN200		TN200			2949
-+c2mmi			MACH_C2MMI		C2MMI			2950
-+meson_6236m		MACH_MESON_6236M	MESON_6236M		2951
-+meson_8626m		MACH_MESON_8626M	MESON_8626M		2952
-+tube			MACH_TUBE		TUBE			2953
-+messina			MACH_MESSINA		MESSINA			2954
-+mx50_arm2		MACH_MX50_ARM2		MX50_ARM2		2955
-+cetus9263		MACH_CETUS9263		CETUS9263		2956
-+brownstone		MACH_BROWNSTONE		BROWNSTONE		2957
-+vmx25			MACH_VMX25		VMX25			2958
-+vmx51			MACH_VMX51		VMX51			2959
-+abacus			MACH_ABACUS		ABACUS			2960
-+cm4745			MACH_CM4745		CM4745			2961
-+oratislink		MACH_ORATISLINK		ORATISLINK		2962
-+davinci_dm365_dvr	MACH_DAVINCI_DM365_DVR	DAVINCI_DM365_DVR	2963
-+netviz			MACH_NETVIZ		NETVIZ			2964
-+flexibity		MACH_FLEXIBITY		FLEXIBITY		2965
-+wlan_computer		MACH_WLAN_COMPUTER	WLAN_COMPUTER		2966
-+lpc24xx			MACH_LPC24XX		LPC24XX			2967
-+spica			MACH_SPICA		SPICA			2968
-+gpsdisplay		MACH_GPSDISPLAY		GPSDISPLAY		2969
-+bipnet			MACH_BIPNET		BIPNET			2970
-+overo_ctu_inertial	MACH_OVERO_CTU_INERTIAL	OVERO_CTU_INERTIAL	2971
-+davinci_dm355_mmm	MACH_DAVINCI_DM355_MMM	DAVINCI_DM355_MMM	2972
-+pc9260_v2		MACH_PC9260_V2		PC9260_V2		2973
-+ptx7545			MACH_PTX7545		PTX7545			2974
-+tm_efdc			MACH_TM_EFDC		TM_EFDC			2975
-+remove_me		MACH_WALDO1		WALDO1			2976
-+omap3_waldo1		MACH_OMAP3_WALDO1	OMAP3_WALDO1		2977
-+flyer			MACH_FLYER		FLYER			2978
-+tornado3240		MACH_TORNADO3240	TORNADO3240		2979
-+soli_01			MACH_SOLI_01		SOLI_01			2980
-+omapl138_europalc	MACH_OMAPL138_EUROPALC	OMAPL138_EUROPALC	2981
-+helios_v1		MACH_HELIOS_V1		HELIOS_V1		2982
-+netspace_lite_v2	MACH_NETSPACE_LITE_V2	NETSPACE_LITE_V2	2983
-+ssc			MACH_SSC		SSC			2984
-+premierwave_en		MACH_PREMIERWAVE_EN	PREMIERWAVE_EN		2985
-+wasabi			MACH_WASABI		WASABI			2986
-+vivo_w			MACH_VIVOW		VIVOW			2987
-+mx50_rdp		MACH_MX50_RDP		MX50_RDP		2988
-+universal		MACH_UNIVERSAL		UNIVERSAL		2989
-+real6410		MACH_REAL6410		REAL6410		2990
-+spx_sakura		MACH_SPX_SAKURA		SPX_SAKURA		2991
-+ij3k_2440		MACH_IJ3K_2440		IJ3K_2440		2992
-+omap3_bc10		MACH_OMAP3_BC10		OMAP3_BC10		2993
-+thebe			MACH_THEBE		THEBE			2994
-+rv082			MACH_RV082		RV082			2995
-+armlguest		MACH_ARMLGUEST		ARMLGUEST		2996
-+tjinc1000		MACH_TJINC1000		TJINC1000		2997
-+dockstar		MACH_DOCKSTAR		DOCKSTAR		2998
-+ax8008			MACH_AX8008		AX8008			2999
-+gnet_sgce		MACH_GNET_SGCE		GNET_SGCE		3000
-+pxwnas_500_1000		MACH_PXWNAS_500_1000	PXWNAS_500_1000		3001
-+ea20			MACH_EA20		EA20			3002
-+awm2			MACH_AWM2		AWM2			3003
-+ti8148evm		MACH_TI8148EVM		TI8148EVM		3004
-+tegra_seaboard		MACH_TEGRA_SEABOARD	TEGRA_SEABOARD		3005
-+linkstation_chlv2	MACH_LINKSTATION_CHLV2	LINKSTATION_CHLV2	3006
-+tera_pro2_rack		MACH_TERA_PRO2_RACK	TERA_PRO2_RACK		3007
-+rubys			MACH_RUBYS		RUBYS			3008
-+aquarius		MACH_AQUARIUS		AQUARIUS		3009
-+mx53_ard		MACH_MX53_ARD		MX53_ARD		3010
-+mx53_smd		MACH_MX53_SMD		MX53_SMD		3011
-+lswxl			MACH_LSWXL		LSWXL			3012
-+dove_avng_v3		MACH_DOVE_AVNG_V3	DOVE_AVNG_V3		3013
-+sdi_ess_9263		MACH_SDI_ESS_9263	SDI_ESS_9263		3014
-+jocpu550		MACH_JOCPU550		JOCPU550		3015
-+msm8x60_rumi3		MACH_MSM8X60_RUMI3	MSM8X60_RUMI3		3016
-+msm8x60_ffa		MACH_MSM8X60_FFA	MSM8X60_FFA		3017
-+yanomami		MACH_YANOMAMI		YANOMAMI		3018

+ 0 - 30
target/linux/generic/patches-2.6.33/040-compcache_swap_notify_core_support.patch

@@ -1,30 +0,0 @@
---- a/include/linux/blkdev.h
-+++ b/include/linux/blkdev.h
-@@ -1299,6 +1299,8 @@ struct block_device_operations {
- 						unsigned long long);
- 	int (*revalidate_disk) (struct gendisk *);
- 	int (*getgeo)(struct block_device *, struct hd_geometry *);
-+        /* this callback is with swap_lock and sometimes page table lock held */
-+        void (*swap_slot_free_notify) (struct block_device *, unsigned long);
- 	struct module *owner;
- };
- 
---- a/mm/swapfile.c
-+++ b/mm/swapfile.c
-@@ -574,6 +574,7 @@ static unsigned char swap_entry_free(str
- 
- 	/* free if no reference */
- 	if (!usage) {
-+		struct gendisk *disk = p->bdev->bd_disk;
- 		if (offset < p->lowest_bit)
- 			p->lowest_bit = offset;
- 		if (offset > p->highest_bit)
-@@ -583,6 +584,8 @@ static unsigned char swap_entry_free(str
- 			swap_list.next = p->type;
- 		nr_swap_pages++;
- 		p->inuse_pages--;
-+		if (disk->fops->swap_slot_free_notify)
-+			disk->fops->swap_slot_free_notify(p->bdev, offset);
- 	}
- 
- 	return usage;

+ 0 - 57
target/linux/generic/patches-2.6.33/055-lzma_arm_kernel.patch

@@ -1,57 +0,0 @@
-From d0f226a0f104c7d1da1d215b8013359273e39e18 Mon Sep 17 00:00:00 2001
-From: Albin Tonnerre <[email protected]>
-Date: Fri, 16 Oct 2009 16:17:22 +0200
-Subject: [PATCH] Add LZMA decompression on ARM
-
-
-Signed-off-by: Albin Tonnerre <[email protected]>
----
- arch/arm/Kconfig                      |    1 +
- arch/arm/boot/compressed/Makefile     |    1 +
- arch/arm/boot/compressed/misc.c       |    4 ++++
- arch/arm/boot/compressed/piggy.lzma.S |    6 ++++++
- 4 files changed, 12 insertions(+), 0 deletions(-)
- create mode 100644 arch/arm/boot/compressed/piggy.lzma.S
-
---- a/arch/arm/Kconfig
-+++ b/arch/arm/Kconfig
-@@ -20,6 +20,7 @@ config ARM
- 	select HAVE_GENERIC_DMA_COHERENT
- 	select HAVE_KERNEL_GZIP
- 	select HAVE_KERNEL_LZO
-+	select HAVE_KERNEL_LZMA
- 	help
- 	  The ARM series is a line of low-power-consumption RISC chip designs
- 	  licensed by ARM Ltd and targeted at embedded applications and
---- a/arch/arm/boot/compressed/Makefile
-+++ b/arch/arm/boot/compressed/Makefile
-@@ -65,6 +65,7 @@ SEDFLAGS	= s/TEXT_START/$(ZTEXTADDR)/;s/
- 
- suffix_$(CONFIG_KERNEL_GZIP) = gzip
- suffix_$(CONFIG_KERNEL_LZO)  = lzo
-+suffix_$(CONFIG_KERNEL_LZMA)  = lzma
- 
- targets       := vmlinux vmlinux.lds \
- 		 piggy.$(suffix_y) piggy.$(suffix_y).o \
---- a/arch/arm/boot/compressed/misc.c
-+++ b/arch/arm/boot/compressed/misc.c
-@@ -248,6 +248,10 @@ static unsigned long free_mem_end_ptr;
- #include "../../../../lib/decompress_inflate.c"
- #endif
- 
-+#ifdef CONFIG_KERNEL_LZMA
-+#include "../../../../lib/decompress_unlzma.c"
-+#endif
-+
- #ifdef CONFIG_KERNEL_LZO
- #include "../../../../lib/decompress_unlzo.c"
- #endif
---- /dev/null
-+++ b/arch/arm/boot/compressed/piggy.lzma.S
-@@ -0,0 +1,6 @@
-+	.section .piggydata,#alloc
-+	.globl	input_data
-+input_data:
-+	.incbin	"arch/arm/boot/compressed/piggy.lzma"
-+	.globl	input_data_end
-+input_data_end:

+ 0 - 120
target/linux/generic/patches-2.6.33/060-block2mtd_init.patch

@@ -1,120 +0,0 @@
---- a/drivers/mtd/devices/block2mtd.c
-+++ b/drivers/mtd/devices/block2mtd.c
-@@ -14,6 +14,7 @@
- #include <linux/list.h>
- #include <linux/init.h>
- #include <linux/mtd/mtd.h>
-+#include <linux/mtd/partitions.h>
- #include <linux/buffer_head.h>
- #include <linux/mutex.h>
- #include <linux/mount.h>
-@@ -232,10 +233,11 @@ static void block2mtd_free_device(struct
- 
- 
- /* FIXME: ensure that mtd->size % erase_size == 0 */
--static struct block2mtd_dev *add_device(char *devname, int erase_size)
-+static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
- {
- 	struct block_device *bdev;
- 	struct block2mtd_dev *dev;
-+	struct mtd_partition *part;
- 	char *name;
- 
- 	if (!devname)
-@@ -273,17 +275,17 @@ static struct block2mtd_dev *add_device(
- 
- 	mutex_init(&dev->write_mutex);
- 
--	/* Setup the MTD structure */
--	/* make the name contain the block device in */
--	name = kmalloc(sizeof("block2mtd: ") + strlen(devname) + 1,
--			GFP_KERNEL);
-+	if (!mtdname)
-+		mtdname = devname;
-+
-+	name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL);
- 	if (!name)
- 		goto devinit_err;
- 
--	sprintf(name, "block2mtd: %s", devname);
-+	strcpy(name, mtdname);
- 	dev->mtd.name = name;
- 
--	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
-+	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1);
- 	dev->mtd.erasesize = erase_size;
- 	dev->mtd.writesize = 1;
- 	dev->mtd.type = MTD_RAM;
-@@ -296,14 +298,17 @@ static struct block2mtd_dev *add_device(
- 	dev->mtd.priv = dev;
- 	dev->mtd.owner = THIS_MODULE;
- 
--	if (add_mtd_device(&dev->mtd)) {
-+	part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
-+	part->name = dev->mtd.name;
-+	part->offset = 0;
-+	part->size = dev->mtd.size;
-+	if (add_mtd_partitions(&dev->mtd, part, 1)) {
- 		/* Device didnt get added, so free the entry */
- 		goto devinit_err;
- 	}
- 	list_add(&dev->list, &blkmtd_device_list);
- 	INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index,
--			dev->mtd.name + strlen("block2mtd: "),
--			dev->mtd.erasesize >> 10, dev->mtd.erasesize);
-+			mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize);
- 	return dev;
- 
- devinit_err:
-@@ -376,9 +381,9 @@ static char block2mtd_paramline[80 + 12]
- 
- static int block2mtd_setup2(const char *val)
- {
--	char buf[80 + 12]; /* 80 for device, 12 for erase size */
-+	char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */
- 	char *str = buf;
--	char *token[2];
-+	char *token[3];
- 	char *name;
- 	size_t erase_size = PAGE_SIZE;
- 	int i, ret;
-@@ -389,7 +394,7 @@ static int block2mtd_setup2(const char *
- 	strcpy(str, val);
- 	kill_final_newline(str);
- 
--	for (i = 0; i < 2; i++)
-+	for (i = 0; i < 3; i++)
- 		token[i] = strsep(&str, ",");
- 
- 	if (str)
-@@ -408,8 +413,10 @@ static int block2mtd_setup2(const char *
- 			parse_err("illegal erase size");
- 		}
- 	}
-+	if (token[2] && (strlen(token[2]) + 1 > 80))
-+		parse_err("mtd device name too long");
- 
--	add_device(name, erase_size);
-+	add_device(name, erase_size, token[2]);
- 
- 	return 0;
- }
-@@ -443,7 +450,7 @@ static int block2mtd_setup(const char *v
- 
- 
- module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
--MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
-+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>]]\"");
- 
- static int __init block2mtd_init(void)
- {
---- a/fs/partitions/check.c
-+++ b/fs/partitions/check.c
-@@ -637,6 +637,7 @@ try_scan:
- 	kfree(state);
- 	return 0;
- }
-+EXPORT_SYMBOL(rescan_partitions);
- 
- unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
- {

+ 0 - 625
target/linux/generic/patches-2.6.33/065-rootfs_split.patch

@@ -1,625 +0,0 @@
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -53,6 +53,16 @@ config MTD_PARTITIONS
- 	  devices. Partitioning on NFTL 'devices' is a different - that's the
- 	  'normal' form of partitioning used on a block device.
- 
-+config MTD_ROOTFS_ROOT_DEV
-+	bool "Automatically set 'rootfs' partition to be root filesystem"
-+	depends on MTD_PARTITIONS
-+	default y
-+
-+config MTD_ROOTFS_SPLIT
-+	bool "Automatically split 'rootfs' partition for squashfs"
-+	depends on MTD_PARTITIONS
-+	default y
-+
- config MTD_REDBOOT_PARTS
- 	tristate "RedBoot partition table parsing"
- 	depends on MTD_PARTITIONS
---- a/drivers/mtd/mtdpart.c
-+++ b/drivers/mtd/mtdpart.c
-@@ -18,6 +18,8 @@
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/partitions.h>
- #include <linux/mtd/compatmac.h>
-+#include <linux/root_dev.h>
-+#include <linux/magic.h>
- 
- /* Our partition linked list */
- static LIST_HEAD(mtd_partitions);
-@@ -35,7 +37,7 @@ struct mtd_part {
-  * the pointer to that structure with this macro.
-  */
- #define PART(x)  ((struct mtd_part *)(x))
--
-+#define IS_PART(mtd) (mtd->read == part_read)
- 
- /*
-  * MTD methods which simply translate the effective address and pass through
-@@ -503,6 +505,150 @@ out_register:
- 	return slave;
- }
- 
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+#define ROOTFS_SPLIT_NAME "rootfs_data"
-+#define ROOTFS_REMOVED_NAME "<removed>"
-+
-+struct squashfs_super_block {
-+	__le32 s_magic;
-+	__le32 pad0[9];
-+	__le64 bytes_used;
-+};
-+
-+
-+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset)
-+{
-+	struct squashfs_super_block sb;
-+	int len, ret;
-+
-+	ret = master->read(master, offset, sizeof(sb), &len, (void *) &sb);
-+	if (ret || (len != sizeof(sb))) {
-+		printk(KERN_ALERT "split_squashfs: error occured while reading "
-+			"from \"%s\"\n", master->name);
-+		return -EINVAL;
-+	}
-+
-+	if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) {
-+		printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n",
-+			master->name);
-+		*split_offset = 0;
-+		return 0;
-+	}
-+
-+	if (le64_to_cpu((sb.bytes_used)) <= 0) {
-+		printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n",
-+			master->name);
-+		*split_offset = 0;
-+		return 0;
-+	}
-+
-+	len = (u32) le64_to_cpu(sb.bytes_used);
-+	len += (offset & 0x000fffff);
-+	len +=  (master->erasesize - 1);
-+	len &= ~(master->erasesize - 1);
-+	len -= (offset & 0x000fffff);
-+	*split_offset = offset + len;
-+
-+	return 0;
-+}
-+
-+static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part)
-+{
-+	struct mtd_partition *dpart;
-+	struct mtd_part *slave = NULL;
-+	int split_offset = 0;
-+	int ret;
-+
-+	ret = split_squashfs(master, part->offset, &split_offset);
-+	if (ret)
-+		return ret;
-+
-+	if (split_offset <= 0)
-+		return 0;
-+
-+	dpart = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL);
-+	if (dpart == NULL) {
-+		printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n",
-+			ROOTFS_SPLIT_NAME);
-+		return -ENOMEM;
-+	}
-+
-+	memcpy(dpart, part, sizeof(*part));
-+	dpart->name = (unsigned char *)&dpart[1];
-+	strcpy(dpart->name, ROOTFS_SPLIT_NAME);
-+
-+	dpart->size -= split_offset - dpart->offset;
-+	dpart->offset = split_offset;
-+
-+	if (dpart == NULL)
-+		return 1;
-+
-+	printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n",
-+		ROOTFS_SPLIT_NAME, dpart->offset, dpart->size);
-+
-+	slave = add_one_partition(master, dpart, 0, split_offset);
-+	if (!slave) {
-+		kfree(dpart);
-+		return -ENOMEM;
-+	}
-+	rpart->split = &slave->mtd;
-+
-+	return 0;
-+}
-+
-+static int refresh_rootfs_split(struct mtd_info *mtd)
-+{
-+	struct mtd_partition tpart;
-+	struct mtd_part *part;
-+	char *name;
-+	//int index = 0;
-+	int offset, size;
-+	int ret;
-+
-+	part = PART(mtd);
-+
-+	/* check for the new squashfs offset first */
-+	ret = split_squashfs(part->master, part->offset, &offset);
-+	if (ret)
-+		return ret;
-+
-+	if ((offset > 0) && !mtd->split) {
-+		printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name);
-+		/* if we don't have a rootfs split partition, create a new one */
-+		tpart.name = (char *) mtd->name;
-+		tpart.size = mtd->size;
-+		tpart.offset = part->offset;
-+
-+		return split_rootfs_data(part->master, &part->mtd, &tpart);
-+	} else if ((offset > 0) && mtd->split) {
-+		/* update the offsets of the existing partition */
-+		size = mtd->size + part->offset - offset;
-+
-+		part = PART(mtd->split);
-+		part->offset = offset;
-+		part->mtd.size = size;
-+		printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n",
-+			__func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"),
-+			(u32) part->offset, (u32) part->mtd.size);
-+		name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
-+		strcpy(name, ROOTFS_SPLIT_NAME);
-+		part->mtd.name = name;
-+	} else if ((offset <= 0) && mtd->split) {
-+		printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name);
-+
-+		/* mark existing partition as removed */
-+		part = PART(mtd->split);
-+		name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
-+		strcpy(name, ROOTFS_REMOVED_NAME);
-+		part->mtd.name = name;
-+		part->offset = 0;
-+		part->mtd.size = 0;
-+	}
-+
-+	return 0;
-+}
-+#endif /* CONFIG_MTD_ROOTFS_SPLIT */
-+
- /*
-  * This function, given a master MTD object and a partition table, creates
-  * and registers slave MTD objects which are bound to the master according to
-@@ -518,7 +664,7 @@ int add_mtd_partitions(struct mtd_info *
- {
- 	struct mtd_part *slave;
- 	uint64_t cur_offset = 0;
--	int i;
-+	int i, ret;
- 
- 	printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
- 
-@@ -526,6 +672,21 @@ int add_mtd_partitions(struct mtd_info *
- 		slave = add_one_partition(master, parts + i, i, cur_offset);
- 		if (!slave)
- 			return -ENOMEM;
-+
-+		if (!strcmp(parts[i].name, "rootfs")) {
-+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
-+			if (ROOT_DEV == 0) {
-+				printk(KERN_NOTICE "mtd: partition \"rootfs\" "
-+					"set to be root filesystem\n");
-+				ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index);
-+			}
-+#endif
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+			ret = split_rootfs_data(master, &slave->mtd, &parts[i]);
-+			/* if (ret == 0)
-+				j++; */
-+#endif
-+		}
- 		cur_offset = slave->offset + slave->mtd.size;
- 	}
- 
-@@ -533,6 +694,32 @@ int add_mtd_partitions(struct mtd_info *
- }
- EXPORT_SYMBOL(add_mtd_partitions);
- 
-+int refresh_mtd_partitions(struct mtd_info *mtd)
-+{
-+	int ret = 0;
-+
-+	if (IS_PART(mtd)) {
-+		struct mtd_part *part;
-+		struct mtd_info *master;
-+
-+		part = PART(mtd);
-+		master = part->master;
-+		if (master->refresh_device)
-+			ret = master->refresh_device(master);
-+	}
-+
-+	if (!ret && mtd->refresh_device)
-+		ret = mtd->refresh_device(mtd);
-+
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+	if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs"))
-+		refresh_rootfs_split(mtd);
-+#endif
-+
-+	return 0;
-+}
-+EXPORT_SYMBOL_GPL(refresh_mtd_partitions);
-+
- static DEFINE_SPINLOCK(part_parser_lock);
- static LIST_HEAD(part_parsers);
- 
---- a/drivers/mtd/devices/block2mtd.c
-+++ b/drivers/mtd/devices/block2mtd.c
-@@ -29,6 +29,8 @@ struct block2mtd_dev {
- 	struct block_device *blkdev;
- 	struct mtd_info mtd;
- 	struct mutex write_mutex;
-+	rwlock_t bdev_mutex;
-+	char devname[0];
- };
- 
- 
-@@ -81,6 +83,12 @@ static int block2mtd_erase(struct mtd_in
- 	size_t len = instr->len;
- 	int err;
- 
-+	read_lock(&dev->bdev_mutex);
-+	if (!dev->blkdev) {
-+		err = -EINVAL;
-+		goto done;
-+	}
-+
- 	instr->state = MTD_ERASING;
- 	mutex_lock(&dev->write_mutex);
- 	err = _block2mtd_erase(dev, from, len);
-@@ -93,6 +101,10 @@ static int block2mtd_erase(struct mtd_in
- 
- 	instr->state = MTD_ERASE_DONE;
- 	mtd_erase_callback(instr);
-+
-+done:
-+	read_unlock(&dev->bdev_mutex);
-+
- 	return err;
- }
- 
-@@ -104,10 +116,14 @@ static int block2mtd_read(struct mtd_inf
- 	struct page *page;
- 	int index = from >> PAGE_SHIFT;
- 	int offset = from & (PAGE_SIZE-1);
--	int cpylen;
-+	int cpylen, err = 0;
-+
-+	read_lock(&dev->bdev_mutex);
-+	if (!dev->blkdev || (from > mtd->size)) {
-+		err = -EINVAL;
-+		goto done;
-+	}
- 
--	if (from > mtd->size)
--		return -EINVAL;
- 	if (from + len > mtd->size)
- 		len = mtd->size - from;
- 
-@@ -122,10 +138,14 @@ static int block2mtd_read(struct mtd_inf
- 		len = len - cpylen;
- 
- 		page = page_read(dev->blkdev->bd_inode->i_mapping, index);
--		if (!page)
--			return -ENOMEM;
--		if (IS_ERR(page))
--			return PTR_ERR(page);
-+		if (!page) {
-+			err = -ENOMEM;
-+			goto done;
-+		}
-+		if (IS_ERR(page)) {
-+			err = PTR_ERR(page);
-+			goto done;
-+		}
- 
- 		memcpy(buf, page_address(page) + offset, cpylen);
- 		page_cache_release(page);
-@@ -136,7 +156,10 @@ static int block2mtd_read(struct mtd_inf
- 		offset = 0;
- 		index++;
- 	}
--	return 0;
-+
-+done:
-+	read_unlock(&dev->bdev_mutex);
-+	return err;
- }
- 
- 
-@@ -188,12 +211,22 @@ static int block2mtd_write(struct mtd_in
- 		size_t *retlen, const u_char *buf)
- {
- 	struct block2mtd_dev *dev = mtd->priv;
--	int err;
-+	int err = 0;
-+
-+	read_lock(&dev->bdev_mutex);
-+	if (!dev->blkdev) {
-+		err = -EINVAL;
-+		goto done;
-+	}
- 
- 	if (!len)
--		return 0;
--	if (to >= mtd->size)
--		return -ENOSPC;
-+		goto done;
-+
-+	if (to >= mtd->size) {
-+		err = -ENOSPC;
-+		goto done;
-+	}
-+
- 	if (to + len > mtd->size)
- 		len = mtd->size - to;
- 
-@@ -202,6 +235,9 @@ static int block2mtd_write(struct mtd_in
- 	mutex_unlock(&dev->write_mutex);
- 	if (err > 0)
- 		err = 0;
-+
-+done:
-+	read_unlock(&dev->bdev_mutex);
- 	return err;
- }
- 
-@@ -210,52 +246,29 @@ static int block2mtd_write(struct mtd_in
- static void block2mtd_sync(struct mtd_info *mtd)
- {
- 	struct block2mtd_dev *dev = mtd->priv;
--	sync_blockdev(dev->blkdev);
--	return;
--}
--
--
--static void block2mtd_free_device(struct block2mtd_dev *dev)
--{
--	if (!dev)
--		return;
--
--	kfree(dev->mtd.name);
- 
--	if (dev->blkdev) {
--		invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
--					0, -1);
--		close_bdev_exclusive(dev->blkdev, FMODE_READ|FMODE_WRITE);
--	}
-+	read_lock(&dev->bdev_mutex);
-+	if (dev->blkdev)
-+		sync_blockdev(dev->blkdev);
-+	read_unlock(&dev->bdev_mutex);
- 
--	kfree(dev);
-+	return;
- }
- 
- 
--/* FIXME: ensure that mtd->size % erase_size == 0 */
--static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
-+static int _open_bdev(struct block2mtd_dev *dev)
- {
- 	struct block_device *bdev;
--	struct block2mtd_dev *dev;
--	struct mtd_partition *part;
--	char *name;
--
--	if (!devname)
--		return NULL;
--
--	dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);
--	if (!dev)
--		return NULL;
- 
- 	/* Get a handle on the device */
--	bdev = open_bdev_exclusive(devname, FMODE_READ|FMODE_WRITE, NULL);
-+	bdev = open_bdev_exclusive(dev->devname, FMODE_READ|FMODE_WRITE, NULL);
- #ifndef MODULE
- 	if (IS_ERR(bdev)) {
- 
- 		/* We might not have rootfs mounted at this point. Try
- 		   to resolve the device name by other means. */
- 
--		dev_t devt = name_to_dev_t(devname);
-+		dev_t devt = name_to_dev_t(dev->devname);
- 		if (devt) {
- 			bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
- 		}
-@@ -263,17 +276,98 @@ static struct block2mtd_dev *add_device(
- #endif
- 
- 	if (IS_ERR(bdev)) {
--		ERROR("error: cannot open device %s", devname);
--		goto devinit_err;
-+		ERROR("error: cannot open device %s", dev->devname);
-+		return 1;
- 	}
- 	dev->blkdev = bdev;
- 
- 	if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
- 		ERROR("attempting to use an MTD device as a block device");
--		goto devinit_err;
-+		return 1;
- 	}
- 
-+	return 0;
-+}
-+
-+static void _close_bdev(struct block2mtd_dev *dev)
-+{
-+	struct block_device *bdev;
-+
-+	if (!dev->blkdev)
-+		return;
-+
-+	bdev = dev->blkdev;
-+	invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1);
-+	close_bdev_exclusive(dev->blkdev, FMODE_READ|FMODE_WRITE);
-+	dev->blkdev = NULL;
-+}
-+
-+static void block2mtd_free_device(struct block2mtd_dev *dev)
-+{
-+	if (!dev)
-+		return;
-+
-+	kfree(dev->mtd.name);
-+	_close_bdev(dev);
-+	kfree(dev);
-+}
-+
-+
-+static int block2mtd_refresh(struct mtd_info *mtd)
-+{
-+	struct block2mtd_dev *dev = mtd->priv;
-+	struct block_device *bdev;
-+	dev_t devt;
-+	int err = 0;
-+
-+	/* no other mtd function can run at this point */
-+	write_lock(&dev->bdev_mutex);
-+
-+	/* get the device number for the whole disk */
-+	devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0);
-+
-+	/* close the old block device */
-+	_close_bdev(dev);
-+
-+	/* open the whole disk, issue a partition rescan, then */
-+	bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
-+	if (!bdev || !bdev->bd_disk)
-+		err = -EINVAL;
-+#ifndef CONFIG_MTD_BLOCK2MTD_MODULE
-+	else
-+		err = rescan_partitions(bdev->bd_disk, bdev);
-+#endif
-+	if (bdev)
-+		close_bdev_exclusive(bdev, FMODE_READ|FMODE_WRITE);
-+
-+	/* try to open the partition block device again */
-+	_open_bdev(dev);
-+	write_unlock(&dev->bdev_mutex);
-+
-+	return err;
-+}
-+
-+/* FIXME: ensure that mtd->size % erase_size == 0 */
-+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
-+{
-+	struct block2mtd_dev *dev;
-+	struct mtd_partition *part;
-+	char *name;
-+
-+	if (!devname)
-+		return NULL;
-+
-+	dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL);
-+	if (!dev)
-+		return NULL;
-+
-+	strcpy(dev->devname, devname);
-+
-+	if (_open_bdev(dev))
-+		goto devinit_err;
-+
- 	mutex_init(&dev->write_mutex);
-+	rwlock_init(&dev->bdev_mutex);
- 
- 	if (!mtdname)
- 		mtdname = devname;
-@@ -297,6 +391,7 @@ static struct block2mtd_dev *add_device(
- 	dev->mtd.read = block2mtd_read;
- 	dev->mtd.priv = dev;
- 	dev->mtd.owner = THIS_MODULE;
-+	dev->mtd.refresh_device = block2mtd_refresh;
- 
- 	part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
- 	part->name = dev->mtd.name;
---- a/drivers/mtd/mtdchar.c
-+++ b/drivers/mtd/mtdchar.c
-@@ -18,6 +18,7 @@
- 
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/compatmac.h>
-+#include <linux/mtd/partitions.h>
- 
- #include <asm/uaccess.h>
- 
-@@ -814,6 +815,13 @@ static int mtd_ioctl(struct inode *inode
- 		file->f_pos = 0;
- 		break;
- 	}
-+#ifdef CONFIG_MTD_PARTITIONS
-+	case MTDREFRESH:
-+	{
-+		ret = refresh_mtd_partitions(mtd);
-+		break;
-+	}
-+#endif
- 
- 	default:
- 		ret = -ENOTTY;
---- a/include/linux/mtd/mtd.h
-+++ b/include/linux/mtd/mtd.h
-@@ -101,6 +101,7 @@ struct mtd_oob_ops {
- 	uint8_t		*oobbuf;
- };
- 
-+struct mtd_info;
- struct mtd_info {
- 	u_char type;
- 	uint32_t flags;
-@@ -241,6 +242,9 @@ struct mtd_info {
- 	struct device dev;
- 	int usecount;
- 
-+	int (*refresh_device)(struct mtd_info *mtd);
-+	struct mtd_info *split;
-+
- 	/* If the driver is something smart, like UBI, it may need to maintain
- 	 * its own reference counting. The below functions are only for driver.
- 	 * The driver may register its callbacks. These callbacks are not
---- a/include/linux/mtd/partitions.h
-+++ b/include/linux/mtd/partitions.h
-@@ -34,12 +34,14 @@
-  * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
-  */
- 
-+struct mtd_partition;
- struct mtd_partition {
- 	char *name;			/* identifier string */
- 	uint64_t size;			/* partition size */
- 	uint64_t offset;		/* offset within the master MTD space */
- 	uint32_t mask_flags;		/* master MTD flags to mask out for this partition */
- 	struct nand_ecclayout *ecclayout;	/* out of band layout for this partition (NAND only)*/
-+	int (*refresh_partition)(struct mtd_info *);
- };
- 
- #define MTDPART_OFS_NXTBLK	(-2)
-@@ -51,6 +53,7 @@ struct mtd_info;
- 
- int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
- int del_mtd_partitions(struct mtd_info *);
-+int refresh_mtd_partitions(struct mtd_info *);
- 
- /*
-  * Functions dealing with the various ways of partitioning the space
---- a/include/mtd/mtd-abi.h
-+++ b/include/mtd/mtd-abi.h
-@@ -110,6 +110,7 @@ struct otp_info {
- #define MEMERASE64		_IOW('M', 20, struct erase_info_user64)
- #define MEMWRITEOOB64		_IOWR('M', 21, struct mtd_oob_buf64)
- #define MEMREADOOB64		_IOWR('M', 22, struct mtd_oob_buf64)
-+#define MTDREFRESH		_IO('M', 23)
- 
- /*
-  * Obsolete legacy interface. Keep it in order not to break userspace

+ 0 - 10
target/linux/generic/patches-2.6.33/066-block2mtd_probe.patch

@@ -1,10 +0,0 @@
---- a/drivers/mtd/devices/block2mtd.c
-+++ b/drivers/mtd/devices/block2mtd.c
-@@ -268,6 +268,7 @@ static int _open_bdev(struct block2mtd_d
- 		/* We might not have rootfs mounted at this point. Try
- 		   to resolve the device name by other means. */
- 
-+		wait_for_device_probe();
- 		dev_t devt = name_to_dev_t(dev->devname);
- 		if (devt) {
- 			bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);

+ 0 - 30
target/linux/generic/patches-2.6.33/070-redboot_space.patch

@@ -1,30 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -249,14 +249,21 @@ static int parse_redboot_partitions(stru
- #endif
- 		names += strlen(names)+1;
- 
--#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
- 		if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
--			i++;
--			parts[i].offset = parts[i-1].size + parts[i-1].offset;
--			parts[i].size = fl->next->img->flash_base - parts[i].offset;
--			parts[i].name = nullname;
--		}
-+			if (!strcmp(parts[i].name, "rootfs")) {
-+				parts[i].size = fl->next->img->flash_base;
-+				parts[i].size &= ~(master->erasesize - 1);
-+				parts[i].size -= parts[i].offset;
-+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
-+				nrparts--;
-+			} else {
-+				i++;
-+				parts[i].offset = parts[i-1].size + parts[i-1].offset;
-+				parts[i].size = fl->next->img->flash_base - parts[i].offset;
-+				parts[i].name = nullname;
- #endif
-+			}
-+		}
- 		tmp_fl = fl;
- 		fl = fl->next;
- 		kfree(tmp_fl);

+ 0 - 60
target/linux/generic/patches-2.6.33/071-redboot_boardconfig.patch

@@ -1,60 +0,0 @@
---- a/drivers/mtd/redboot.c
-+++ b/drivers/mtd/redboot.c
-@@ -11,6 +11,8 @@
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/partitions.h>
- 
-+#define BOARD_CONFIG_PART		"boardconfig"
-+
- struct fis_image_desc {
-     unsigned char name[16];      // Null terminated name
-     uint32_t	  flash_base;    // Address within FLASH of image
-@@ -41,6 +43,7 @@ static int parse_redboot_partitions(stru
-                              struct mtd_partition **pparts,
-                              unsigned long fis_origin)
- {
-+	unsigned long max_offset = 0;
- 	int nrparts = 0;
- 	struct fis_image_desc *buf;
- 	struct mtd_partition *parts;
-@@ -209,14 +212,14 @@ static int parse_redboot_partitions(stru
- 		}
- 	}
- #endif
--	parts = kzalloc(sizeof(*parts)*nrparts + nulllen + namelen, GFP_KERNEL);
-+	parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + sizeof(BOARD_CONFIG_PART), GFP_KERNEL);
- 
- 	if (!parts) {
- 		ret = -ENOMEM;
- 		goto out;
- 	}
- 
--	nullname = (char *)&parts[nrparts];
-+	nullname = (char *)&parts[nrparts + 1];
- #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
- 	if (nulllen > 0) {
- 		strcpy(nullname, nullstring);
-@@ -235,6 +238,8 @@ static int parse_redboot_partitions(stru
- 	}
- #endif
- 	for ( ; i<nrparts; i++) {
-+		if(max_offset < buf[i].flash_base + buf[i].size)
-+			max_offset = buf[i].flash_base + buf[i].size;
- 		parts[i].size = fl->img->size;
- 		parts[i].offset = fl->img->flash_base;
- 		parts[i].name = names;
-@@ -268,6 +273,14 @@ static int parse_redboot_partitions(stru
- 		fl = fl->next;
- 		kfree(tmp_fl);
- 	}
-+	if(master->size - max_offset >= master->erasesize)
-+	{
-+		parts[nrparts].size = master->size - max_offset;
-+		parts[nrparts].offset = max_offset;
-+		parts[nrparts].name = names;
-+		strcpy(names, BOARD_CONFIG_PART);
-+		nrparts++;
-+	}
- 	ret = nrparts;
- 	*pparts = parts;
-  out:

+ 0 - 32
target/linux/generic/patches-2.6.33/080-mtd_plat_nand_chip_fixup.patch

@@ -1,32 +0,0 @@
---- a/include/linux/mtd/nand.h
-+++ b/include/linux/mtd/nand.h
-@@ -491,6 +491,7 @@ struct platform_nand_chip {
- 	int			chip_delay;
- 	unsigned int		options;
- 	const char		**part_probe_types;
-+	int			(*chip_fixup)(struct mtd_info *mtd);
- 	void			(*set_parts)(uint64_t size,
- 					struct platform_nand_chip *chip);
- 	void			*priv;
---- a/drivers/mtd/nand/plat_nand.c
-+++ b/drivers/mtd/nand/plat_nand.c
-@@ -91,7 +91,18 @@ static int __devinit plat_nand_probe(str
- 	}
- 
- 	/* Scan to find existance of the device */
--	if (nand_scan(&data->mtd, 1)) {
-+	if (nand_scan_ident(&data->mtd, 1)) {
-+		res = -ENXIO;
-+		goto out;
-+	}
-+
-+	if (pdata->chip.chip_fixup) {
-+		res = pdata->chip.chip_fixup(&data->mtd);
-+		if (res)
-+			goto out;
-+	}
-+
-+	if (nand_scan_tail(&data->mtd)) {
- 		err = -ENXIO;
- 		goto out;
- 	}

+ 0 - 35
target/linux/generic/patches-2.6.33/081-mtd_myloader_partition_parser.patch

@@ -1,35 +0,0 @@
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -181,6 +181,22 @@ config MTD_AR7_PARTS
- 	---help---
- 	  TI AR7 partitioning support
- 
-+config MTD_MYLOADER_PARTS
-+	tristate "MyLoader partition parsing"
-+	depends on MTD_PARTITIONS && (ADM5120 || ATHEROS_AR231X || ATHEROS_AR71XX)
-+	---help---
-+	  MyLoader is a bootloader which allows the user to define partitions
-+	  in flash devices, by putting a table in the second erase block
-+	  on the device, similar to a partition table. This table gives the 
-+	  offsets and lengths of the user defined partitions.
-+
-+	  If you need code which can detect and parse these tables, and
-+	  register MTD 'partitions' corresponding to each image detected,
-+	  enable this option.
-+
-+	  You will still need the parsing functions to be called by the driver
-+	  for your particular device. It won't happen automatically.
-+
- comment "User Modules And Translation Layers"
- 
- config MTD_CHAR
---- a/drivers/mtd/Makefile
-+++ b/drivers/mtd/Makefile
-@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdli
- obj-$(CONFIG_MTD_AFS_PARTS)	+= afs.o
- obj-$(CONFIG_MTD_AR7_PARTS)	+= ar7part.o
- obj-$(CONFIG_MTD_OF_PARTS)      += ofpart.o
-+obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
- 
- # 'Users' - code which presents functionality to userspace.
- obj-$(CONFIG_MTD_CHAR)		+= mtdchar.o

+ 0 - 18
target/linux/generic/patches-2.6.33/082-mtd_info_move_forward_decl.patch

@@ -1,18 +0,0 @@
---- a/include/linux/mtd/partitions.h
-+++ b/include/linux/mtd/partitions.h
-@@ -33,6 +33,7 @@
-  * Note: writeable partitions require their size and offset be
-  * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
-  */
-+struct mtd_info;
- 
- struct mtd_partition;
- struct mtd_partition {
-@@ -49,7 +50,6 @@ struct mtd_partition {
- #define MTDPART_SIZ_FULL	(0)
- 
- 
--struct mtd_info;
- 
- int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
- int del_mtd_partitions(struct mtd_info *);

+ 0 - 12
target/linux/generic/patches-2.6.33/083-mtd_fix_nand_correct_data_return_code.patch

@@ -1,12 +0,0 @@
---- a/drivers/mtd/nand/nand_ecc.c
-+++ b/drivers/mtd/nand/nand_ecc.c
-@@ -507,8 +507,7 @@ int __nand_correct_data(unsigned char *b
- 	if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1)
- 		return 1;	/* error in ecc data; no action needed */
- 
--	printk(KERN_ERR "uncorrectable error : ");
--	return -1;
-+	return -EBADMSG;
- }
- EXPORT_SYMBOL(__nand_correct_data);
- 

+ 0 - 39
target/linux/generic/patches-2.6.33/084-mtd_m25p80_add_pm25lv_flash_support.patch

@@ -1,39 +0,0 @@
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -40,6 +40,7 @@
- #define	OPCODE_BE_4K		0x20	/* Erase 4KiB block */
- #define	OPCODE_BE_32K		0x52	/* Erase 32KiB block */
- #define	OPCODE_CHIP_ERASE	0xc7	/* Erase whole flash chip */
-+#define	OPCODE_BE_4K_PMC	0xd7	/* Erase 4KiB block on PMC chips*/
- #define	OPCODE_SE		0xd8	/* Sector erase (usually 64KiB) */
- #define	OPCODE_RDID		0x9f	/* Read JEDEC ID */
- 
-@@ -599,6 +600,7 @@ struct flash_info {
- 	u16		flags;
- #define	SECT_4K		0x01		/* OPCODE_BE_4K works uniformly */
- #define	M25P_NO_ERASE	0x02		/* No erase command needed */
-+#define	SECT_4K_PMC	0x04		/* OPCODE_BE_4K_PMC works uniformly */
- };
- 
- #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
-@@ -645,6 +647,10 @@ static const struct spi_device_id m25p_i
- 	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
- 	{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
- 
-+	/* PMC -- pm25x "blocks" are 32K, sectors are 4K */
-+	{ "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
-+	{ "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },
-+
- 	/* Spansion -- single (large) sector size only, at least
- 	 * for the chips listed here (without boot sectors).
- 	 */
-@@ -857,6 +863,9 @@ static int __devinit m25p_probe(struct s
- 	if (info->flags & SECT_4K) {
- 		flash->erase_opcode = OPCODE_BE_4K;
- 		flash->mtd.erasesize = 4096;
-+	} else if (info->flags & SECT_4K_PMC) {
-+		flash->erase_opcode = OPCODE_BE_4K_PMC;
-+		flash->mtd.erasesize = 4096;
- 	} else {
- 		flash->erase_opcode = OPCODE_SE;
- 		flash->mtd.erasesize = info->sector_size;

+ 0 - 13
target/linux/generic/patches-2.6.33/085-mtd_m25p80_add_en25pxx_support.patch

@@ -1,13 +0,0 @@
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -647,6 +647,10 @@ static const struct spi_device_id m25p_i
- 	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
- 	{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
- 
-+	/* EON -- en25pxx */
-+	{ "en25p32", INFO(0x1c2016, 0, 64 * 1024,  64, 0) },
-+	{ "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) },
-+
- 	/* PMC -- pm25x "blocks" are 32K, sectors are 4K */
- 	{ "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
- 	{ "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },

+ 0 - 28
target/linux/generic/patches-2.6.33/086-mtd_m25p80_add_xxxs33b_support.patch

@@ -1,28 +0,0 @@
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -651,6 +651,11 @@ static const struct spi_device_id m25p_i
- 	{ "en25p32", INFO(0x1c2016, 0, 64 * 1024,  64, 0) },
- 	{ "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) },
- 
-+	/* Numonyx -- xxxs33b */
-+	{ "160s33b",  INFO(0x898911, 0, 64 * 1024,  32, 0) },
-+	{ "320s33b",  INFO(0x898912, 0, 64 * 1024,  64, 0) },
-+	{ "640s33b",  INFO(0x898913, 0, 64 * 1024, 128, 0) },
-+
- 	/* PMC -- pm25x "blocks" are 32K, sectors are 4K */
- 	{ "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
- 	{ "pm25lv010", INFO(0, 0, 32 * 1024, 4, SECT_4K_PMC) },
-@@ -835,11 +840,12 @@ static int __devinit m25p_probe(struct s
- 	dev_set_drvdata(&spi->dev, flash);
- 
- 	/*
--	 * Atmel and SST serial flash tend to power
-+	 * Atmel, SST and Intel/Numonyx serial flash tend to power
- 	 * up with the software protection bits set
- 	 */
- 
- 	if (info->jedec_id >> 16 == 0x1f ||
-+	    info->jedec_id >> 16 == 0x89 ||
- 	    info->jedec_id >> 16 == 0xbf) {
- 		write_enable(flash);
- 		write_sr(flash, 0);

+ 0 - 10
target/linux/generic/patches-2.6.33/087-mtd-m25p80-add-w25q32-chip-support.patch

@@ -1,10 +0,0 @@
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -708,6 +708,7 @@ static const struct spi_device_id m25p_i
- 	{ "w25x80", INFO(0xef3014, 0, 64 * 1024,  16, SECT_4K) },
- 	{ "w25x16", INFO(0xef3015, 0, 64 * 1024,  32, SECT_4K) },
- 	{ "w25x32", INFO(0xef3016, 0, 64 * 1024,  64, SECT_4K) },
-+	{ "w25q32", INFO(0xef4016, 0, 64 * 1024,  64, SECT_4K) },
- 	{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
- 
- 	/* Catalyst / On Semiconductor -- non-JEDEC */

+ 0 - 10
target/linux/generic/patches-2.6.33/088-winbond_cmdset.patch

@@ -1,10 +0,0 @@
---- a/drivers/mtd/chips/gen_probe.c
-+++ b/drivers/mtd/chips/gen_probe.c
-@@ -249,6 +249,7 @@ static struct mtd_info *check_cmd_set(st
- #endif
- #ifdef CONFIG_MTD_CFI_AMDSTD
- 	case 0x0002:
-+	case 0x0006:
- 		return cfi_cmdset_0002(map, primary);
- #endif
- #ifdef CONFIG_MTD_CFI_STAA

+ 0 - 37
target/linux/generic/patches-2.6.33/089-mtd-samsung-flash.patch

@@ -1,37 +0,0 @@
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -327,9 +327,32 @@ static void cfi_fixup_major_minor(struct
- {
- 	// manufacturers defined in include/linux/mtd/cfi.h
- 
--	if (cfi->mfr == CFI_MFR_SAMSUNG && cfi->id == 0x257e &&
--	    extp->MajorVersion == '0')
-+	if (cfi->mfr == CFI_MFR_SAMSUNG &&
-+	    extp->MajorVersion == '0') {
-+		printk("  Fixed Samsung's Amd/Fujitsu Extended Query version from %c.%c",
-+		       extp->MajorVersion, extp->MinorVersion);
-+
- 		extp->MajorVersion = '1';
-+		extp->MinorVersion = '0';
-+
-+		printk(" to %c.%c.\n",
-+		       extp->MajorVersion, extp->MinorVersion);
-+	}
-+
-+	if (cfi->mfr == CFI_MFR_SAMSUNG &&
-+	    extp->MajorVersion == '3' && extp->MinorVersion == '3') {
-+		printk(KERN_NOTICE "  Newer Samsung flash detected, "
-+		       "should be compatibile with Amd/Fujitsu.\n");
-+
-+		printk("  Fixed Samsung's Amd/Fujitsu Extended Query version from %c.%c",
-+		       extp->MajorVersion, extp->MinorVersion);
-+
-+		extp->MajorVersion = '1';	// set to 1.3 (last defined version)
-+		extp->MinorVersion = '3';
-+
-+		printk(" to %c.%c.\n",
-+		       extp->MajorVersion, extp->MinorVersion);
-+	}
- }
- 
- struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)

+ 0 - 12
target/linux/generic/patches-2.6.33/090-mtd-m25p80-add-en25f32-chip-support.patch

@@ -1,12 +0,0 @@
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -647,7 +647,8 @@ static const struct spi_device_id m25p_i
- 	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
- 	{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
- 
--	/* EON -- en25pxx */
-+	/* EON -- en25xxx */
-+	{ "en25f32", INFO(0x1c3116, 0, 64 * 1024,  64, SECT_4K) },
- 	{ "en25p32", INFO(0x1c2016, 0, 64 * 1024,  64, 0) },
- 	{ "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) },
- 

+ 0 - 2132
target/linux/generic/patches-2.6.33/100-netfilter_layer7_2.21.patch

@@ -1,2132 +0,0 @@
---- /dev/null
-+++ b/include/linux/netfilter/xt_layer7.h
-@@ -0,0 +1,13 @@
-+#ifndef _XT_LAYER7_H
-+#define _XT_LAYER7_H
-+
-+#define MAX_PATTERN_LEN 8192
-+#define MAX_PROTOCOL_LEN 256
-+
-+struct xt_layer7_info {
-+    char protocol[MAX_PROTOCOL_LEN];
-+    char pattern[MAX_PATTERN_LEN];
-+    u_int8_t invert;
-+};
-+
-+#endif /* _XT_LAYER7_H */
---- a/include/net/netfilter/nf_conntrack.h
-+++ b/include/net/netfilter/nf_conntrack.h
-@@ -116,6 +116,22 @@ struct nf_conn {
- 	u_int32_t secmark;
- #endif
- 
-+#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || \
-+    defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE)
-+	struct {
-+		/*
-+		 * e.g. "http". NULL before decision. "unknown" after decision
-+		 * if no match.
-+		 */
-+		char *app_proto;
-+		/*
-+		 * application layer data so far. NULL after match decision.
-+		 */
-+		char *app_data;
-+		unsigned int app_data_len;
-+	} layer7;
-+#endif
-+
- 	/* Storage reserved for other modules: */
- 	union nf_conntrack_proto proto;
- 
---- a/net/netfilter/Kconfig
-+++ b/net/netfilter/Kconfig
-@@ -858,6 +858,27 @@ config NETFILTER_XT_MATCH_STATE
- 
- 	  To compile it as a module, choose M here.  If unsure, say N.
- 
-+config NETFILTER_XT_MATCH_LAYER7
-+	tristate '"layer7" match support'
-+	depends on NETFILTER_XTABLES
-+	depends on EXPERIMENTAL && (IP_NF_CONNTRACK || NF_CONNTRACK)
-+       depends on NF_CT_ACCT
-+	help
-+	  Say Y if you want to be able to classify connections (and their
-+	  packets) based on regular expression matching of their application
-+	  layer data.   This is one way to classify applications such as
-+	  peer-to-peer filesharing systems that do not always use the same
-+	  port.
-+
-+	  To compile it as a module, choose M here.  If unsure, say N.
-+
-+config NETFILTER_XT_MATCH_LAYER7_DEBUG
-+        bool 'Layer 7 debugging output'
-+        depends on NETFILTER_XT_MATCH_LAYER7
-+        help
-+          Say Y to get lots of debugging output.
-+
-+
- config NETFILTER_XT_MATCH_STATISTIC
- 	tristate '"statistic" match support'
- 	depends on NETFILTER_ADVANCED
---- a/net/netfilter/Makefile
-+++ b/net/netfilter/Makefile
-@@ -89,6 +89,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_RECENT)
- obj-$(CONFIG_NETFILTER_XT_MATCH_SCTP) += xt_sctp.o
- obj-$(CONFIG_NETFILTER_XT_MATCH_SOCKET) += xt_socket.o
- obj-$(CONFIG_NETFILTER_XT_MATCH_STATE) += xt_state.o
-+obj-$(CONFIG_NETFILTER_XT_MATCH_LAYER7) += xt_layer7.o
- obj-$(CONFIG_NETFILTER_XT_MATCH_STATISTIC) += xt_statistic.o
- obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o
- obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o
---- a/net/netfilter/nf_conntrack_core.c
-+++ b/net/netfilter/nf_conntrack_core.c
-@@ -201,6 +201,14 @@ destroy_conntrack(struct nf_conntrack *n
- 	 * too. */
- 	nf_ct_remove_expectations(ct);
- 
-+	#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE)
-+	if(ct->layer7.app_proto)
-+		kfree(ct->layer7.app_proto);
-+	if(ct->layer7.app_data)
-+	kfree(ct->layer7.app_data);
-+	#endif
-+
-+
- 	/* We overload first tuple to link into unconfirmed list. */
- 	if (!nf_ct_is_confirmed(ct)) {
- 		BUG_ON(hlist_nulls_unhashed(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnnode));
---- a/net/netfilter/nf_conntrack_standalone.c
-+++ b/net/netfilter/nf_conntrack_standalone.c
-@@ -171,6 +171,12 @@ static int ct_seq_show(struct seq_file *
- 		goto release;
- #endif
- 
-+#if defined(CONFIG_NETFILTER_XT_MATCH_LAYER7) || defined(CONFIG_NETFILTER_XT_MATCH_LAYER7_MODULE)
-+	if(ct->layer7.app_proto &&
-+           seq_printf(s, "l7proto=%s ", ct->layer7.app_proto))
-+		return -ENOSPC;
-+#endif
-+
- 	if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)))
- 		goto release;
- 
---- /dev/null
-+++ b/net/netfilter/regexp/regexp.c
-@@ -0,0 +1,1197 @@
-+/*
-+ * regcomp and regexec -- regsub and regerror are elsewhere
-+ * @(#)regexp.c	1.3 of 18 April 87
-+ *
-+ *	Copyright (c) 1986 by University of Toronto.
-+ *	Written by Henry Spencer.  Not derived from licensed software.
-+ *
-+ *	Permission is granted to anyone to use this software for any
-+ *	purpose on any computer system, and to redistribute it freely,
-+ *	subject to the following restrictions:
-+ *
-+ *	1. The author is not responsible for the consequences of use of
-+ *		this software, no matter how awful, even if they arise
-+ *		from defects in it.
-+ *
-+ *	2. The origin of this software must not be misrepresented, either
-+ *		by explicit claim or by omission.
-+ *
-+ *	3. Altered versions must be plainly marked as such, and must not
-+ *		be misrepresented as being the original software.
-+ *
-+ * Beware that some of this code is subtly aware of the way operator
-+ * precedence is structured in regular expressions.  Serious changes in
-+ * regular-expression syntax might require a total rethink.
-+ *
-+ * This code was modified by Ethan Sommer to work within the kernel
-+ * (it now uses kmalloc etc..)
-+ *
-+ * Modified slightly by Matthew Strait to use more modern C.
-+ */
-+
-+#include "regexp.h"
-+#include "regmagic.h"
-+
-+/* added by ethan and matt.  Lets it work in both kernel and user space.
-+(So iptables can use it, for instance.)  Yea, it goes both ways... */
-+#if __KERNEL__
-+  #define malloc(foo) kmalloc(foo,GFP_ATOMIC)
-+#else
-+  #define printk(format,args...) printf(format,##args)
-+#endif
-+
-+void regerror(char * s)
-+{
-+        printk("<3>Regexp: %s\n", s);
-+        /* NOTREACHED */
-+}
-+
-+/*
-+ * The "internal use only" fields in regexp.h are present to pass info from
-+ * compile to execute that permits the execute phase to run lots faster on
-+ * simple cases.  They are:
-+ *
-+ * regstart	char that must begin a match; '\0' if none obvious
-+ * reganch	is the match anchored (at beginning-of-line only)?
-+ * regmust	string (pointer into program) that match must include, or NULL
-+ * regmlen	length of regmust string
-+ *
-+ * Regstart and reganch permit very fast decisions on suitable starting points
-+ * for a match, cutting down the work a lot.  Regmust permits fast rejection
-+ * of lines that cannot possibly match.  The regmust tests are costly enough
-+ * that regcomp() supplies a regmust only if the r.e. contains something
-+ * potentially expensive (at present, the only such thing detected is * or +
-+ * at the start of the r.e., which can involve a lot of backup).  Regmlen is
-+ * supplied because the test in regexec() needs it and regcomp() is computing
-+ * it anyway.
-+ */
-+
-+/*
-+ * Structure for regexp "program".  This is essentially a linear encoding
-+ * of a nondeterministic finite-state machine (aka syntax charts or
-+ * "railroad normal form" in parsing technology).  Each node is an opcode
-+ * plus a "next" pointer, possibly plus an operand.  "Next" pointers of
-+ * all nodes except BRANCH implement concatenation; a "next" pointer with
-+ * a BRANCH on both ends of it is connecting two alternatives.  (Here we
-+ * have one of the subtle syntax dependencies:  an individual BRANCH (as
-+ * opposed to a collection of them) is never concatenated with anything
-+ * because of operator precedence.)  The operand of some types of node is
-+ * a literal string; for others, it is a node leading into a sub-FSM.  In
-+ * particular, the operand of a BRANCH node is the first node of the branch.
-+ * (NB this is *not* a tree structure:  the tail of the branch connects
-+ * to the thing following the set of BRANCHes.)  The opcodes are:
-+ */
-+
-+/* definition	number	opnd?	meaning */
-+#define	END	0	/* no	End of program. */
-+#define	BOL	1	/* no	Match "" at beginning of line. */
-+#define	EOL	2	/* no	Match "" at end of line. */
-+#define	ANY	3	/* no	Match any one character. */
-+#define	ANYOF	4	/* str	Match any character in this string. */
-+#define	ANYBUT	5	/* str	Match any character not in this string. */
-+#define	BRANCH	6	/* node	Match this alternative, or the next... */
-+#define	BACK	7	/* no	Match "", "next" ptr points backward. */
-+#define	EXACTLY	8	/* str	Match this string. */
-+#define	NOTHING	9	/* no	Match empty string. */
-+#define	STAR	10	/* node	Match this (simple) thing 0 or more times. */
-+#define	PLUS	11	/* node	Match this (simple) thing 1 or more times. */
-+#define	OPEN	20	/* no	Mark this point in input as start of #n. */
-+			/*	OPEN+1 is number 1, etc. */
-+#define	CLOSE	30	/* no	Analogous to OPEN. */
-+
-+/*
-+ * Opcode notes:
-+ *
-+ * BRANCH	The set of branches constituting a single choice are hooked
-+ *		together with their "next" pointers, since precedence prevents
-+ *		anything being concatenated to any individual branch.  The
-+ *		"next" pointer of the last BRANCH in a choice points to the
-+ *		thing following the whole choice.  This is also where the
-+ *		final "next" pointer of each individual branch points; each
-+ *		branch starts with the operand node of a BRANCH node.
-+ *
-+ * BACK		Normal "next" pointers all implicitly point forward; BACK
-+ *		exists to make loop structures possible.
-+ *
-+ * STAR,PLUS	'?', and complex '*' and '+', are implemented as circular
-+ *		BRANCH structures using BACK.  Simple cases (one character
-+ *		per match) are implemented with STAR and PLUS for speed
-+ *		and to minimize recursive plunges.
-+ *
-+ * OPEN,CLOSE	...are numbered at compile time.
-+ */
-+
-+/*
-+ * A node is one char of opcode followed by two chars of "next" pointer.
-+ * "Next" pointers are stored as two 8-bit pieces, high order first.  The
-+ * value is a positive offset from the opcode of the node containing it.
-+ * An operand, if any, simply follows the node.  (Note that much of the
-+ * code generation knows about this implicit relationship.)
-+ *
-+ * Using two bytes for the "next" pointer is vast overkill for most things,
-+ * but allows patterns to get big without disasters.
-+ */
-+#define	OP(p)	(*(p))
-+#define	NEXT(p)	(((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
-+#define	OPERAND(p)	((p) + 3)
-+
-+/*
-+ * See regmagic.h for one further detail of program structure.
-+ */
-+
-+
-+/*
-+ * Utility definitions.
-+ */
-+#ifndef CHARBITS
-+#define	UCHARAT(p)	((int)*(unsigned char *)(p))
-+#else
-+#define	UCHARAT(p)	((int)*(p)&CHARBITS)
-+#endif
-+
-+#define	FAIL(m)	{ regerror(m); return(NULL); }
-+#define	ISMULT(c)	((c) == '*' || (c) == '+' || (c) == '?')
-+#define	META	"^$.[()|?+*\\"
-+
-+/*
-+ * Flags to be passed up and down.
-+ */
-+#define	HASWIDTH	01	/* Known never to match null string. */
-+#define	SIMPLE		02	/* Simple enough to be STAR/PLUS operand. */
-+#define	SPSTART		04	/* Starts with * or +. */
-+#define	WORST		0	/* Worst case. */
-+
-+/*
-+ * Global work variables for regcomp().
-+ */
-+struct match_globals {
-+char *reginput;		/* String-input pointer. */
-+char *regbol;		/* Beginning of input, for ^ check. */
-+char **regstartp;	/* Pointer to startp array. */
-+char **regendp;		/* Ditto for endp. */
-+char *regparse;		/* Input-scan pointer. */
-+int regnpar;		/* () count. */
-+char regdummy;
-+char *regcode;		/* Code-emit pointer; &regdummy = don't. */
-+long regsize;		/* Code size. */
-+};
-+
-+/*
-+ * Forward declarations for regcomp()'s friends.
-+ */
-+#ifndef STATIC
-+#define	STATIC	static
-+#endif
-+STATIC char *reg(struct match_globals *g, int paren,int *flagp);
-+STATIC char *regbranch(struct match_globals *g, int *flagp);
-+STATIC char *regpiece(struct match_globals *g, int *flagp);
-+STATIC char *regatom(struct match_globals *g, int *flagp);
-+STATIC char *regnode(struct match_globals *g, char op);
-+STATIC char *regnext(struct match_globals *g, char *p);
-+STATIC void regc(struct match_globals *g, char b);
-+STATIC void reginsert(struct match_globals *g, char op, char *opnd);
-+STATIC void regtail(struct match_globals *g, char *p, char *val);
-+STATIC void regoptail(struct match_globals *g, char *p, char *val);
-+
-+
-+__kernel_size_t my_strcspn(const char *s1,const char *s2)
-+{
-+        char *scan1;
-+        char *scan2;
-+        int count;
-+
-+        count = 0;
-+        for (scan1 = (char *)s1; *scan1 != '\0'; scan1++) {
-+                for (scan2 = (char *)s2; *scan2 != '\0';)       /* ++ moved down. */
-+                        if (*scan1 == *scan2++)
-+                                return(count);
-+                count++;
-+        }
-+        return(count);
-+}
-+
-+/*
-+ - regcomp - compile a regular expression into internal code
-+ *
-+ * We can't allocate space until we know how big the compiled form will be,
-+ * but we can't compile it (and thus know how big it is) until we've got a
-+ * place to put the code.  So we cheat:  we compile it twice, once with code
-+ * generation turned off and size counting turned on, and once "for real".
-+ * This also means that we don't allocate space until we are sure that the
-+ * thing really will compile successfully, and we never have to move the
-+ * code and thus invalidate pointers into it.  (Note that it has to be in
-+ * one piece because free() must be able to free it all.)
-+ *
-+ * Beware that the optimization-preparation code in here knows about some
-+ * of the structure of the compiled regexp.
-+ */
-+regexp *
-+regcomp(char *exp,int *patternsize)
-+{
-+	register regexp *r;
-+	register char *scan;
-+	register char *longest;
-+	register int len;
-+	int flags;
-+	struct match_globals g;
-+	
-+	/* commented out by ethan
-+	   extern char *malloc();
-+	*/
-+
-+	if (exp == NULL)
-+		FAIL("NULL argument");
-+
-+	/* First pass: determine size, legality. */
-+	g.regparse = exp;
-+	g.regnpar = 1;
-+	g.regsize = 0L;
-+	g.regcode = &g.regdummy;
-+	regc(&g, MAGIC);
-+	if (reg(&g, 0, &flags) == NULL)
-+		return(NULL);
-+
-+	/* Small enough for pointer-storage convention? */
-+	if (g.regsize >= 32767L)		/* Probably could be 65535L. */
-+		FAIL("regexp too big");
-+
-+	/* Allocate space. */
-+	*patternsize=sizeof(regexp) + (unsigned)g.regsize;
-+	r = (regexp *)malloc(sizeof(regexp) + (unsigned)g.regsize);
-+	if (r == NULL)
-+		FAIL("out of space");
-+
-+	/* Second pass: emit code. */
-+	g.regparse = exp;
-+	g.regnpar = 1;
-+	g.regcode = r->program;
-+	regc(&g, MAGIC);
-+	if (reg(&g, 0, &flags) == NULL)
-+		return(NULL);
-+
-+	/* Dig out information for optimizations. */
-+	r->regstart = '\0';	/* Worst-case defaults. */
-+	r->reganch = 0;
-+	r->regmust = NULL;
-+	r->regmlen = 0;
-+	scan = r->program+1;			/* First BRANCH. */
-+	if (OP(regnext(&g, scan)) == END) {		/* Only one top-level choice. */
-+		scan = OPERAND(scan);
-+
-+		/* Starting-point info. */
-+		if (OP(scan) == EXACTLY)
-+			r->regstart = *OPERAND(scan);
-+		else if (OP(scan) == BOL)
-+			r->reganch++;
-+
-+		/*
-+		 * If there's something expensive in the r.e., find the
-+		 * longest literal string that must appear and make it the
-+		 * regmust.  Resolve ties in favor of later strings, since
-+		 * the regstart check works with the beginning of the r.e.
-+		 * and avoiding duplication strengthens checking.  Not a
-+		 * strong reason, but sufficient in the absence of others.
-+		 */
-+		if (flags&SPSTART) {
-+			longest = NULL;
-+			len = 0;
-+			for (; scan != NULL; scan = regnext(&g, scan))
-+				if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
-+					longest = OPERAND(scan);
-+					len = strlen(OPERAND(scan));
-+				}
-+			r->regmust = longest;
-+			r->regmlen = len;
-+		}
-+	}
-+
-+	return(r);
-+}
-+
-+/*
-+ - reg - regular expression, i.e. main body or parenthesized thing
-+ *
-+ * Caller must absorb opening parenthesis.
-+ *
-+ * Combining parenthesis handling with the base level of regular expression
-+ * is a trifle forced, but the need to tie the tails of the branches to what
-+ * follows makes it hard to avoid.
-+ */
-+static char *
-+reg(struct match_globals *g, int paren, int *flagp /* Parenthesized? */ )
-+{
-+	register char *ret;
-+	register char *br;
-+	register char *ender;
-+	register int parno = 0; /* 0 makes gcc happy */
-+	int flags;
-+
-+	*flagp = HASWIDTH;	/* Tentatively. */
-+
-+	/* Make an OPEN node, if parenthesized. */
-+	if (paren) {
-+		if (g->regnpar >= NSUBEXP)
-+			FAIL("too many ()");
-+		parno = g->regnpar;
-+		g->regnpar++;
-+		ret = regnode(g, OPEN+parno);
-+	} else
-+		ret = NULL;
-+
-+	/* Pick up the branches, linking them together. */
-+	br = regbranch(g, &flags);
-+	if (br == NULL)
-+		return(NULL);
-+	if (ret != NULL)
-+		regtail(g, ret, br);	/* OPEN -> first. */
-+	else
-+		ret = br;
-+	if (!(flags&HASWIDTH))
-+		*flagp &= ~HASWIDTH;
-+	*flagp |= flags&SPSTART;
-+	while (*g->regparse == '|') {
-+		g->regparse++;
-+		br = regbranch(g, &flags);
-+		if (br == NULL)
-+			return(NULL);
-+		regtail(g, ret, br);	/* BRANCH -> BRANCH. */
-+		if (!(flags&HASWIDTH))
-+			*flagp &= ~HASWIDTH;
-+		*flagp |= flags&SPSTART;
-+	}
-+
-+	/* Make a closing node, and hook it on the end. */
-+	ender = regnode(g, (paren) ? CLOSE+parno : END);	
-+	regtail(g, ret, ender);
-+
-+	/* Hook the tails of the branches to the closing node. */
-+	for (br = ret; br != NULL; br = regnext(g, br))
-+		regoptail(g, br, ender);
-+
-+	/* Check for proper termination. */
-+	if (paren && *g->regparse++ != ')') {
-+		FAIL("unmatched ()");
-+	} else if (!paren && *g->regparse != '\0') {
-+		if (*g->regparse == ')') {
-+			FAIL("unmatched ()");
-+		} else
-+			FAIL("junk on end");	/* "Can't happen". */
-+		/* NOTREACHED */
-+	}
-+
-+	return(ret);
-+}
-+
-+/*
-+ - regbranch - one alternative of an | operator
-+ *
-+ * Implements the concatenation operator.
-+ */
-+static char *
-+regbranch(struct match_globals *g, int *flagp)
-+{
-+	register char *ret;
-+	register char *chain;
-+	register char *latest;
-+	int flags;
-+
-+	*flagp = WORST;		/* Tentatively. */
-+
-+	ret = regnode(g, BRANCH);
-+	chain = NULL;
-+	while (*g->regparse != '\0' && *g->regparse != '|' && *g->regparse != ')') {
-+		latest = regpiece(g, &flags);
-+		if (latest == NULL)
-+			return(NULL);
-+		*flagp |= flags&HASWIDTH;
-+		if (chain == NULL)	/* First piece. */
-+			*flagp |= flags&SPSTART;
-+		else
-+			regtail(g, chain, latest);
-+		chain = latest;
-+	}
-+	if (chain == NULL)	/* Loop ran zero times. */
-+		(void) regnode(g, NOTHING);
-+
-+	return(ret);
-+}
-+
-+/*
-+ - regpiece - something followed by possible [*+?]
-+ *
-+ * Note that the branching code sequences used for ? and the general cases
-+ * of * and + are somewhat optimized:  they use the same NOTHING node as
-+ * both the endmarker for their branch list and the body of the last branch.
-+ * It might seem that this node could be dispensed with entirely, but the
-+ * endmarker role is not redundant.
-+ */
-+static char *
-+regpiece(struct match_globals *g, int *flagp)
-+{
-+	register char *ret;
-+	register char op;
-+	register char *next;
-+	int flags;
-+
-+	ret = regatom(g, &flags);
-+	if (ret == NULL)
-+		return(NULL);
-+
-+	op = *g->regparse;
-+	if (!ISMULT(op)) {
-+		*flagp = flags;
-+		return(ret);
-+	}
-+
-+	if (!(flags&HASWIDTH) && op != '?')
-+		FAIL("*+ operand could be empty");
-+	*flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH);
-+
-+	if (op == '*' && (flags&SIMPLE))
-+		reginsert(g, STAR, ret);
-+	else if (op == '*') {
-+		/* Emit x* as (x&|), where & means "self". */
-+		reginsert(g, BRANCH, ret);			/* Either x */
-+		regoptail(g, ret, regnode(g, BACK));		/* and loop */
-+		regoptail(g, ret, ret);			/* back */
-+		regtail(g, ret, regnode(g, BRANCH));		/* or */
-+		regtail(g, ret, regnode(g, NOTHING));		/* null. */
-+	} else if (op == '+' && (flags&SIMPLE))
-+		reginsert(g, PLUS, ret);
-+	else if (op == '+') {
-+		/* Emit x+ as x(&|), where & means "self". */
-+		next = regnode(g, BRANCH);			/* Either */
-+		regtail(g, ret, next);
-+		regtail(g, regnode(g, BACK), ret);		/* loop back */
-+		regtail(g, next, regnode(g, BRANCH));		/* or */
-+		regtail(g, ret, regnode(g, NOTHING));		/* null. */
-+	} else if (op == '?') {
-+		/* Emit x? as (x|) */
-+		reginsert(g, BRANCH, ret);			/* Either x */
-+		regtail(g, ret, regnode(g, BRANCH));		/* or */
-+		next = regnode(g, NOTHING);		/* null. */
-+		regtail(g, ret, next);
-+		regoptail(g, ret, next);
-+	}
-+	g->regparse++;
-+	if (ISMULT(*g->regparse))
-+		FAIL("nested *?+");
-+
-+	return(ret);
-+}
-+
-+/*
-+ - regatom - the lowest level
-+ *
-+ * Optimization:  gobbles an entire sequence of ordinary characters so that
-+ * it can turn them into a single node, which is smaller to store and
-+ * faster to run.  Backslashed characters are exceptions, each becoming a
-+ * separate node; the code is simpler that way and it's not worth fixing.
-+ */
-+static char *
-+regatom(struct match_globals *g, int *flagp)
-+{
-+	register char *ret;
-+	int flags;
-+
-+	*flagp = WORST;		/* Tentatively. */
-+
-+	switch (*g->regparse++) {
-+	case '^':
-+		ret = regnode(g, BOL);
-+		break;
-+	case '$':
-+		ret = regnode(g, EOL);
-+		break;
-+	case '.':
-+		ret = regnode(g, ANY);
-+		*flagp |= HASWIDTH|SIMPLE;
-+		break;
-+	case '[': {
-+			register int class;
-+			register int classend;
-+
-+			if (*g->regparse == '^') {	/* Complement of range. */
-+				ret = regnode(g, ANYBUT);
-+				g->regparse++;
-+			} else
-+				ret = regnode(g, ANYOF);
-+			if (*g->regparse == ']' || *g->regparse == '-')
-+				regc(g, *g->regparse++);
-+			while (*g->regparse != '\0' && *g->regparse != ']') {
-+				if (*g->regparse == '-') {
-+					g->regparse++;
-+					if (*g->regparse == ']' || *g->regparse == '\0')
-+						regc(g, '-');
-+					else {
-+						class = UCHARAT(g->regparse-2)+1;
-+						classend = UCHARAT(g->regparse);
-+						if (class > classend+1)
-+							FAIL("invalid [] range");
-+						for (; class <= classend; class++)
-+							regc(g, class);
-+						g->regparse++;
-+					}
-+				} else
-+					regc(g, *g->regparse++);
-+			}
-+			regc(g, '\0');
-+			if (*g->regparse != ']')
-+				FAIL("unmatched []");
-+			g->regparse++;
-+			*flagp |= HASWIDTH|SIMPLE;
-+		}
-+		break;
-+	case '(':
-+		ret = reg(g, 1, &flags);
-+		if (ret == NULL)
-+			return(NULL);
-+		*flagp |= flags&(HASWIDTH|SPSTART);
-+		break;
-+	case '\0':
-+	case '|':
-+	case ')':
-+		FAIL("internal urp");	/* Supposed to be caught earlier. */
-+		break;
-+	case '?':
-+	case '+':
-+	case '*':
-+		FAIL("?+* follows nothing");
-+		break;
-+	case '\\':
-+		if (*g->regparse == '\0')
-+			FAIL("trailing \\");
-+		ret = regnode(g, EXACTLY);
-+		regc(g, *g->regparse++);
-+		regc(g, '\0');
-+		*flagp |= HASWIDTH|SIMPLE;
-+		break;
-+	default: {
-+			register int len;
-+			register char ender;
-+
-+			g->regparse--;
-+			len = my_strcspn((const char *)g->regparse, (const char *)META);
-+			if (len <= 0)
-+				FAIL("internal disaster");
-+			ender = *(g->regparse+len);
-+			if (len > 1 && ISMULT(ender))
-+				len--;		/* Back off clear of ?+* operand. */
-+			*flagp |= HASWIDTH;
-+			if (len == 1)
-+				*flagp |= SIMPLE;
-+			ret = regnode(g, EXACTLY);
-+			while (len > 0) {
-+				regc(g, *g->regparse++);
-+				len--;
-+			}
-+			regc(g, '\0');
-+		}
-+		break;
-+	}
-+
-+	return(ret);
-+}
-+
-+/*
-+ - regnode - emit a node
-+ */
-+static char *			/* Location. */
-+regnode(struct match_globals *g, char op)
-+{
-+	register char *ret;
-+	register char *ptr;
-+
-+	ret = g->regcode;
-+	if (ret == &g->regdummy) {
-+		g->regsize += 3;
-+		return(ret);
-+	}
-+
-+	ptr = ret;
-+	*ptr++ = op;
-+	*ptr++ = '\0';		/* Null "next" pointer. */
-+	*ptr++ = '\0';
-+	g->regcode = ptr;
-+
-+	return(ret);
-+}
-+
-+/*
-+ - regc - emit (if appropriate) a byte of code
-+ */
-+static void
-+regc(struct match_globals *g, char b)
-+{
-+	if (g->regcode != &g->regdummy)
-+		*g->regcode++ = b;
-+	else
-+		g->regsize++;
-+}
-+
-+/*
-+ - reginsert - insert an operator in front of already-emitted operand
-+ *
-+ * Means relocating the operand.
-+ */
-+static void
-+reginsert(struct match_globals *g, char op, char* opnd)
-+{
-+	register char *src;
-+	register char *dst;
-+	register char *place;
-+
-+	if (g->regcode == &g->regdummy) {
-+		g->regsize += 3;
-+		return;
-+	}
-+
-+	src = g->regcode;
-+	g->regcode += 3;
-+	dst = g->regcode;
-+	while (src > opnd)
-+		*--dst = *--src;
-+
-+	place = opnd;		/* Op node, where operand used to be. */
-+	*place++ = op;
-+	*place++ = '\0';
-+	*place++ = '\0';
-+}
-+
-+/*
-+ - regtail - set the next-pointer at the end of a node chain
-+ */
-+static void
-+regtail(struct match_globals *g, char *p, char *val)
-+{
-+	register char *scan;
-+	register char *temp;
-+	register int offset;
-+
-+	if (p == &g->regdummy)
-+		return;
-+
-+	/* Find last node. */
-+	scan = p;
-+	for (;;) {
-+		temp = regnext(g, scan);
-+		if (temp == NULL)
-+			break;
-+		scan = temp;
-+	}
-+
-+	if (OP(scan) == BACK)
-+		offset = scan - val;
-+	else
-+		offset = val - scan;
-+	*(scan+1) = (offset>>8)&0377;
-+	*(scan+2) = offset&0377;
-+}
-+
-+/*
-+ - regoptail - regtail on operand of first argument; nop if operandless
-+ */
-+static void
-+regoptail(struct match_globals *g, char *p, char *val)
-+{
-+	/* "Operandless" and "op != BRANCH" are synonymous in practice. */
-+	if (p == NULL || p == &g->regdummy || OP(p) != BRANCH)
-+		return;
-+	regtail(g, OPERAND(p), val);
-+}
-+
-+/*
-+ * regexec and friends
-+ */
-+
-+
-+/*
-+ * Forwards.
-+ */
-+STATIC int regtry(struct match_globals *g, regexp *prog, char *string);
-+STATIC int regmatch(struct match_globals *g, char *prog);
-+STATIC int regrepeat(struct match_globals *g, char *p);
-+
-+#ifdef DEBUG
-+int regnarrate = 0;
-+void regdump();
-+STATIC char *regprop(char *op);
-+#endif
-+
-+/*
-+ - regexec - match a regexp against a string
-+ */
-+int
-+regexec(regexp *prog, char *string)
-+{
-+	register char *s;
-+	struct match_globals g;
-+
-+	/* Be paranoid... */
-+	if (prog == NULL || string == NULL) {
-+		printk("<3>Regexp: NULL parameter\n");
-+		return(0);
-+	}
-+
-+	/* Check validity of program. */
-+	if (UCHARAT(prog->program) != MAGIC) {
-+		printk("<3>Regexp: corrupted program\n");
-+		return(0);
-+	}
-+
-+	/* If there is a "must appear" string, look for it. */
-+	if (prog->regmust != NULL) {
-+		s = string;
-+		while ((s = strchr(s, prog->regmust[0])) != NULL) {
-+			if (strncmp(s, prog->regmust, prog->regmlen) == 0)
-+				break;	/* Found it. */
-+			s++;
-+		}
-+		if (s == NULL)	/* Not present. */
-+			return(0);
-+	}
-+
-+	/* Mark beginning of line for ^ . */
-+	g.regbol = string;
-+
-+	/* Simplest case:  anchored match need be tried only once. */
-+	if (prog->reganch)
-+		return(regtry(&g, prog, string));
-+
-+	/* Messy cases:  unanchored match. */
-+	s = string;
-+	if (prog->regstart != '\0')
-+		/* We know what char it must start with. */
-+		while ((s = strchr(s, prog->regstart)) != NULL) {
-+			if (regtry(&g, prog, s))
-+				return(1);
-+			s++;
-+		}
-+	else
-+		/* We don't -- general case. */
-+		do {
-+			if (regtry(&g, prog, s))
-+				return(1);
-+		} while (*s++ != '\0');
-+
-+	/* Failure. */
-+	return(0);
-+}
-+
-+/*
-+ - regtry - try match at specific point
-+ */
-+static int			/* 0 failure, 1 success */
-+regtry(struct match_globals *g, regexp *prog, char *string)
-+{
-+	register int i;
-+	register char **sp;
-+	register char **ep;
-+
-+	g->reginput = string;
-+	g->regstartp = prog->startp;
-+	g->regendp = prog->endp;
-+
-+	sp = prog->startp;
-+	ep = prog->endp;
-+	for (i = NSUBEXP; i > 0; i--) {
-+		*sp++ = NULL;
-+		*ep++ = NULL;
-+	}
-+	if (regmatch(g, prog->program + 1)) {
-+		prog->startp[0] = string;
-+		prog->endp[0] = g->reginput;
-+		return(1);
-+	} else
-+		return(0);
-+}
-+
-+/*
-+ - regmatch - main matching routine
-+ *
-+ * Conceptually the strategy is simple:  check to see whether the current
-+ * node matches, call self recursively to see whether the rest matches,
-+ * and then act accordingly.  In practice we make some effort to avoid
-+ * recursion, in particular by going through "ordinary" nodes (that don't
-+ * need to know whether the rest of the match failed) by a loop instead of
-+ * by recursion.
-+ */
-+static int			/* 0 failure, 1 success */
-+regmatch(struct match_globals *g, char *prog)
-+{
-+	register char *scan = prog; /* Current node. */
-+	char *next;		    /* Next node. */
-+
-+#ifdef DEBUG
-+	if (scan != NULL && regnarrate)
-+		fprintf(stderr, "%s(\n", regprop(scan));
-+#endif
-+	while (scan != NULL) {
-+#ifdef DEBUG
-+		if (regnarrate)
-+			fprintf(stderr, "%s...\n", regprop(scan));
-+#endif
-+		next = regnext(g, scan);
-+
-+		switch (OP(scan)) {
-+		case BOL:
-+			if (g->reginput != g->regbol)
-+				return(0);
-+			break;
-+		case EOL:
-+			if (*g->reginput != '\0')
-+				return(0);
-+			break;
-+		case ANY:
-+			if (*g->reginput == '\0')
-+				return(0);
-+			g->reginput++;
-+			break;
-+		case EXACTLY: {
-+				register int len;
-+				register char *opnd;
-+
-+				opnd = OPERAND(scan);
-+				/* Inline the first character, for speed. */
-+				if (*opnd != *g->reginput)
-+					return(0);
-+				len = strlen(opnd);
-+				if (len > 1 && strncmp(opnd, g->reginput, len) != 0)
-+					return(0);
-+				g->reginput += len;
-+			}
-+			break;
-+		case ANYOF:
-+			if (*g->reginput == '\0' || strchr(OPERAND(scan), *g->reginput) == NULL)
-+				return(0);
-+			g->reginput++;
-+			break;
-+		case ANYBUT:
-+			if (*g->reginput == '\0' || strchr(OPERAND(scan), *g->reginput) != NULL)
-+				return(0);
-+			g->reginput++;
-+			break;
-+		case NOTHING:
-+		case BACK:
-+			break;
-+		case OPEN+1:
-+		case OPEN+2:
-+		case OPEN+3:
-+		case OPEN+4:
-+		case OPEN+5:
-+		case OPEN+6:
-+		case OPEN+7:
-+		case OPEN+8:
-+		case OPEN+9: {
-+				register int no;
-+				register char *save;
-+
-+				no = OP(scan) - OPEN;
-+				save = g->reginput;
-+
-+				if (regmatch(g, next)) {
-+					/*
-+					 * Don't set startp if some later
-+					 * invocation of the same parentheses
-+					 * already has.
-+					 */
-+					if (g->regstartp[no] == NULL)
-+						g->regstartp[no] = save;
-+					return(1);
-+				} else
-+					return(0);
-+			}
-+			break;
-+		case CLOSE+1:
-+		case CLOSE+2:
-+		case CLOSE+3:
-+		case CLOSE+4:
-+		case CLOSE+5:
-+		case CLOSE+6:
-+		case CLOSE+7:
-+		case CLOSE+8:
-+		case CLOSE+9:
-+			{
-+				register int no;
-+				register char *save;
-+
-+				no = OP(scan) - CLOSE;
-+				save = g->reginput;
-+
-+				if (regmatch(g, next)) {
-+					/*
-+					 * Don't set endp if some later
-+					 * invocation of the same parentheses
-+					 * already has.
-+					 */
-+					if (g->regendp[no] == NULL)
-+						g->regendp[no] = save;
-+					return(1);
-+				} else
-+					return(0);
-+			}
-+			break;
-+		case BRANCH: {
-+				register char *save;
-+
-+				if (OP(next) != BRANCH)		/* No choice. */
-+					next = OPERAND(scan);	/* Avoid recursion. */
-+				else {
-+					do {
-+						save = g->reginput;
-+						if (regmatch(g, OPERAND(scan)))
-+							return(1);
-+						g->reginput = save;
-+						scan = regnext(g, scan);
-+					} while (scan != NULL && OP(scan) == BRANCH);
-+					return(0);
-+					/* NOTREACHED */
-+				}
-+			}
-+			break;
-+		case STAR:
-+		case PLUS: {
-+				register char nextch;
-+				register int no;
-+				register char *save;
-+				register int min;
-+
-+				/*
-+				 * Lookahead to avoid useless match attempts
-+				 * when we know what character comes next.
-+				 */
-+				nextch = '\0';
-+				if (OP(next) == EXACTLY)
-+					nextch = *OPERAND(next);
-+				min = (OP(scan) == STAR) ? 0 : 1;
-+				save = g->reginput;
-+				no = regrepeat(g, OPERAND(scan));
-+				while (no >= min) {
-+					/* If it could work, try it. */
-+					if (nextch == '\0' || *g->reginput == nextch)
-+						if (regmatch(g, next))
-+							return(1);
-+					/* Couldn't or didn't -- back up. */
-+					no--;
-+					g->reginput = save + no;
-+				}
-+				return(0);
-+			}
-+			break;
-+		case END:
-+			return(1);	/* Success! */
-+			break;
-+		default:
-+			printk("<3>Regexp: memory corruption\n");
-+			return(0);
-+			break;
-+		}
-+
-+		scan = next;
-+	}
-+
-+	/*
-+	 * We get here only if there's trouble -- normally "case END" is
-+	 * the terminating point.
-+	 */
-+	printk("<3>Regexp: corrupted pointers\n");
-+	return(0);
-+}
-+
-+/*
-+ - regrepeat - repeatedly match something simple, report how many
-+ */
-+static int
-+regrepeat(struct match_globals *g, char *p)
-+{
-+	register int count = 0;
-+	register char *scan;
-+	register char *opnd;
-+
-+	scan = g->reginput;
-+	opnd = OPERAND(p);
-+	switch (OP(p)) {
-+	case ANY:
-+		count = strlen(scan);
-+		scan += count;
-+		break;
-+	case EXACTLY:
-+		while (*opnd == *scan) {
-+			count++;
-+			scan++;
-+		}
-+		break;
-+	case ANYOF:
-+		while (*scan != '\0' && strchr(opnd, *scan) != NULL) {
-+			count++;
-+			scan++;
-+		}
-+		break;
-+	case ANYBUT:
-+		while (*scan != '\0' && strchr(opnd, *scan) == NULL) {
-+			count++;
-+			scan++;
-+		}
-+		break;
-+	default:		/* Oh dear.  Called inappropriately. */
-+		printk("<3>Regexp: internal foulup\n");
-+		count = 0;	/* Best compromise. */
-+		break;
-+	}
-+	g->reginput = scan;
-+
-+	return(count);
-+}
-+
-+/*
-+ - regnext - dig the "next" pointer out of a node
-+ */
-+static char*
-+regnext(struct match_globals *g, char *p)
-+{
-+	register int offset;
-+
-+	if (p == &g->regdummy)
-+		return(NULL);
-+
-+	offset = NEXT(p);
-+	if (offset == 0)
-+		return(NULL);
-+
-+	if (OP(p) == BACK)
-+		return(p-offset);
-+	else
-+		return(p+offset);
-+}
-+
-+#ifdef DEBUG
-+
-+STATIC char *regprop();
-+
-+/*
-+ - regdump - dump a regexp onto stdout in vaguely comprehensible form
-+ */
-+void
-+regdump(regexp *r)
-+{
-+	register char *s;
-+	register char op = EXACTLY;	/* Arbitrary non-END op. */
-+	register char *next;
-+	/* extern char *strchr(); */
-+
-+
-+	s = r->program + 1;
-+	while (op != END) {	/* While that wasn't END last time... */
-+		op = OP(s);
-+		printf("%2d%s", s-r->program, regprop(s));	/* Where, what. */
-+		next = regnext(s);
-+		if (next == NULL)		/* Next ptr. */
-+			printf("(0)");
-+		else
-+			printf("(%d)", (s-r->program)+(next-s));
-+		s += 3;
-+		if (op == ANYOF || op == ANYBUT || op == EXACTLY) {
-+			/* Literal string, where present. */
-+			while (*s != '\0') {
-+				putchar(*s);
-+				s++;
-+			}
-+			s++;
-+		}
-+		putchar('\n');
-+	}
-+
-+	/* Header fields of interest. */
-+	if (r->regstart != '\0')
-+		printf("start `%c' ", r->regstart);
-+	if (r->reganch)
-+		printf("anchored ");
-+	if (r->regmust != NULL)
-+		printf("must have \"%s\"", r->regmust);
-+	printf("\n");
-+}
-+
-+/*
-+ - regprop - printable representation of opcode
-+ */
-+static char *
-+regprop(char *op)
-+{
-+#define BUFLEN 50
-+	register char *p;
-+	static char buf[BUFLEN];
-+
-+	strcpy(buf, ":");
-+
-+	switch (OP(op)) {
-+	case BOL:
-+		p = "BOL";
-+		break;
-+	case EOL:
-+		p = "EOL";
-+		break;
-+	case ANY:
-+		p = "ANY";
-+		break;
-+	case ANYOF:
-+		p = "ANYOF";
-+		break;
-+	case ANYBUT:
-+		p = "ANYBUT";
-+		break;
-+	case BRANCH:
-+		p = "BRANCH";
-+		break;
-+	case EXACTLY:
-+		p = "EXACTLY";
-+		break;
-+	case NOTHING:
-+		p = "NOTHING";
-+		break;
-+	case BACK:
-+		p = "BACK";
-+		break;
-+	case END:
-+		p = "END";
-+		break;
-+	case OPEN+1:
-+	case OPEN+2:
-+	case OPEN+3:
-+	case OPEN+4:
-+	case OPEN+5:
-+	case OPEN+6:
-+	case OPEN+7:
-+	case OPEN+8:
-+	case OPEN+9:
-+		snprintf(buf+strlen(buf),BUFLEN-strlen(buf), "OPEN%d", OP(op)-OPEN);
-+		p = NULL;
-+		break;
-+	case CLOSE+1:
-+	case CLOSE+2:
-+	case CLOSE+3:
-+	case CLOSE+4:
-+	case CLOSE+5:
-+	case CLOSE+6:
-+	case CLOSE+7:
-+	case CLOSE+8:
-+	case CLOSE+9:
-+		snprintf(buf+strlen(buf),BUFLEN-strlen(buf), "CLOSE%d", OP(op)-CLOSE);
-+		p = NULL;
-+		break;
-+	case STAR:
-+		p = "STAR";
-+		break;
-+	case PLUS:
-+		p = "PLUS";
-+		break;
-+	default:
-+		printk("<3>Regexp: corrupted opcode\n");
-+		break;
-+	}
-+	if (p != NULL)
-+		strncat(buf, p, BUFLEN-strlen(buf));
-+	return(buf);
-+}
-+#endif
-+
-+
---- /dev/null
-+++ b/net/netfilter/regexp/regexp.h
-@@ -0,0 +1,41 @@
-+/*
-+ * Definitions etc. for regexp(3) routines.
-+ *
-+ * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
-+ * not the System V one.
-+ */
-+
-+#ifndef REGEXP_H
-+#define REGEXP_H
-+
-+
-+/*
-+http://www.opensource.apple.com/darwinsource/10.3/expect-1/expect/expect.h ,
-+which contains a version of this library, says:
-+
-+ *
-+ * NSUBEXP must be at least 10, and no greater than 117 or the parser
-+ * will not work properly.
-+ *
-+
-+However, it looks rather like this library is limited to 10.  If you think
-+otherwise, let us know.
-+*/
-+
-+#define NSUBEXP  10
-+typedef struct regexp {
-+	char *startp[NSUBEXP];
-+	char *endp[NSUBEXP];
-+	char regstart;		/* Internal use only. */
-+	char reganch;		/* Internal use only. */
-+	char *regmust;		/* Internal use only. */
-+	int regmlen;		/* Internal use only. */
-+	char program[1];	/* Unwarranted chumminess with compiler. */
-+} regexp;
-+
-+regexp * regcomp(char *exp, int *patternsize);
-+int regexec(regexp *prog, char *string);
-+void regsub(regexp *prog, char *source, char *dest);
-+void regerror(char *s);
-+
-+#endif
---- /dev/null
-+++ b/net/netfilter/regexp/regmagic.h
-@@ -0,0 +1,5 @@
-+/*
-+ * The first byte of the regexp internal "program" is actually this magic
-+ * number; the start node begins in the second byte.
-+ */
-+#define	MAGIC	0234
---- /dev/null
-+++ b/net/netfilter/regexp/regsub.c
-@@ -0,0 +1,95 @@
-+/*
-+ * regsub
-+ * @(#)regsub.c	1.3 of 2 April 86
-+ *
-+ *	Copyright (c) 1986 by University of Toronto.
-+ *	Written by Henry Spencer.  Not derived from licensed software.
-+ *
-+ *	Permission is granted to anyone to use this software for any
-+ *	purpose on any computer system, and to redistribute it freely,
-+ *	subject to the following restrictions:
-+ *
-+ *	1. The author is not responsible for the consequences of use of
-+ *		this software, no matter how awful, even if they arise
-+ *		from defects in it.
-+ *
-+ *	2. The origin of this software must not be misrepresented, either
-+ *		by explicit claim or by omission.
-+ *
-+ *	3. Altered versions must be plainly marked as such, and must not
-+ *		be misrepresented as being the original software.
-+ *
-+ *
-+ * This code was modified by Ethan Sommer to work within the kernel
-+ * (it now uses kmalloc etc..)
-+ *
-+ */
-+#include "regexp.h"
-+#include "regmagic.h"
-+#include <linux/string.h>
-+
-+
-+#ifndef CHARBITS
-+#define	UCHARAT(p)	((int)*(unsigned char *)(p))
-+#else
-+#define	UCHARAT(p)	((int)*(p)&CHARBITS)
-+#endif
-+
-+#if 0
-+//void regerror(char * s)
-+//{
-+//        printk("regexp(3): %s", s);
-+//        /* NOTREACHED */
-+//}
-+#endif
-+
-+/*
-+ - regsub - perform substitutions after a regexp match
-+ */
-+void
-+regsub(regexp * prog, char * source, char * dest)
-+{
-+	register char *src;
-+	register char *dst;
-+	register char c;
-+	register int no;
-+	register int len;
-+	
-+	/* Not necessary and gcc doesn't like it -MLS */
-+	/*extern char *strncpy();*/
-+
-+	if (prog == NULL || source == NULL || dest == NULL) {
-+		regerror("NULL parm to regsub");
-+		return;
-+	}
-+	if (UCHARAT(prog->program) != MAGIC) {
-+		regerror("damaged regexp fed to regsub");
-+		return;
-+	}
-+
-+	src = source;
-+	dst = dest;
-+	while ((c = *src++) != '\0') {
-+		if (c == '&')
-+			no = 0;
-+		else if (c == '\\' && '0' <= *src && *src <= '9')
-+			no = *src++ - '0';
-+		else
-+			no = -1;
-+
-+		if (no < 0) {	/* Ordinary character. */
-+			if (c == '\\' && (*src == '\\' || *src == '&'))
-+				c = *src++;
-+			*dst++ = c;
-+		} else if (prog->startp[no] != NULL && prog->endp[no] != NULL) {
-+			len = prog->endp[no] - prog->startp[no];
-+			(void) strncpy(dst, prog->startp[no], len);
-+			dst += len;
-+			if (len != 0 && *(dst-1) == '\0') {	/* strncpy hit NUL. */
-+				regerror("damaged match string");
-+				return;
-+			}
-+		}
-+	}
-+	*dst++ = '\0';
-+}
---- /dev/null
-+++ b/net/netfilter/xt_layer7.c
-@@ -0,0 +1,666 @@
-+/*
-+  Kernel module to match application layer (OSI layer 7) data in connections.
-+
-+  http://l7-filter.sf.net
-+
-+  (C) 2003-2009 Matthew Strait and Ethan Sommer.
-+
-+  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.
-+  http://www.gnu.org/licenses/gpl.txt
-+
-+  Based on ipt_string.c (C) 2000 Emmanuel Roger <[email protected]>,
-+  xt_helper.c (C) 2002 Harald Welte and cls_layer7.c (C) 2003 Matthew Strait,
-+  Ethan Sommer, Justin Levandoski.
-+*/
-+
-+#include <linux/spinlock.h>
-+#include <linux/version.h>
-+#include <net/ip.h>
-+#include <net/tcp.h>
-+#include <linux/module.h>
-+#include <linux/skbuff.h>
-+#include <linux/netfilter.h>
-+#include <net/netfilter/nf_conntrack.h>
-+#include <net/netfilter/nf_conntrack_core.h>
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
-+#include <net/netfilter/nf_conntrack_extend.h>
-+#include <net/netfilter/nf_conntrack_acct.h>
-+#endif
-+#include <linux/netfilter/x_tables.h>
-+#include <linux/netfilter/xt_layer7.h>
-+#include <linux/ctype.h>
-+#include <linux/proc_fs.h>
-+
-+#include "regexp/regexp.c"
-+
-+MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Matthew Strait <[email protected]>, Ethan Sommer <[email protected]>");
-+MODULE_DESCRIPTION("iptables application layer match module");
-+MODULE_ALIAS("ipt_layer7");
-+MODULE_VERSION("2.21");
-+
-+static int maxdatalen = 2048; // this is the default
-+module_param(maxdatalen, int, 0444);
-+MODULE_PARM_DESC(maxdatalen, "maximum bytes of data looked at by l7-filter");
-+#ifdef CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG
-+	#define DPRINTK(format,args...) printk(format,##args)
-+#else
-+	#define DPRINTK(format,args...)
-+#endif
-+
-+/* Number of packets whose data we look at.
-+This can be modified through /proc/net/layer7_numpackets */
-+static int num_packets = 10;
-+
-+static struct pattern_cache {
-+	char * regex_string;
-+	regexp * pattern;
-+	struct pattern_cache * next;
-+} * first_pattern_cache = NULL;
-+
-+DEFINE_SPINLOCK(l7_lock);
-+
-+static int total_acct_packets(struct nf_conn *ct)
-+{
-+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
-+	BUG_ON(ct == NULL);
-+	return (ct->counters[IP_CT_DIR_ORIGINAL].packets + ct->counters[IP_CT_DIR_REPLY].packets);
-+#else
-+	struct nf_conn_counter *acct;
-+
-+	BUG_ON(ct == NULL);
-+	acct = nf_conn_acct_find(ct);
-+	if (!acct)
-+		return 0;
-+	return (acct[IP_CT_DIR_ORIGINAL].packets + acct[IP_CT_DIR_REPLY].packets);
-+#endif
-+}
-+
-+#ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG
-+/* Converts an unfriendly string into a friendly one by
-+replacing unprintables with periods and all whitespace with " ". */
-+static char * friendly_print(unsigned char * s)
-+{
-+	char * f = kmalloc(strlen(s) + 1, GFP_ATOMIC);
-+	int i;
-+
-+	if(!f) {
-+		if (net_ratelimit())
-+			printk(KERN_ERR "layer7: out of memory in "
-+					"friendly_print, bailing.\n");
-+		return NULL;
-+	}
-+
-+	for(i = 0; i < strlen(s); i++){
-+		if(isprint(s[i]) && s[i] < 128)	f[i] = s[i];
-+		else if(isspace(s[i]))		f[i] = ' ';
-+		else 				f[i] = '.';
-+	}
-+	f[i] = '\0';
-+	return f;
-+}
-+
-+static char dec2hex(int i)
-+{
-+	switch (i) {
-+		case 0 ... 9:
-+			return (i + '0');
-+			break;
-+		case 10 ... 15:
-+			return (i - 10 + 'a');
-+			break;
-+		default:
-+			if (net_ratelimit())
-+				printk("layer7: Problem in dec2hex\n");
-+			return '\0';
-+	}
-+}
-+
-+static char * hex_print(unsigned char * s)
-+{
-+	char * g = kmalloc(strlen(s)*3 + 1, GFP_ATOMIC);
-+	int i;
-+
-+	if(!g) {
-+	       if (net_ratelimit())
-+			printk(KERN_ERR "layer7: out of memory in hex_print, "
-+					"bailing.\n");
-+	       return NULL;
-+	}
-+
-+	for(i = 0; i < strlen(s); i++) {
-+		g[i*3    ] = dec2hex(s[i]/16);
-+		g[i*3 + 1] = dec2hex(s[i]%16);
-+		g[i*3 + 2] = ' ';
-+	}
-+	g[i*3] = '\0';
-+
-+	return g;
-+}
-+#endif // DEBUG
-+
-+/* Use instead of regcomp.  As we expect to be seeing the same regexps over and
-+over again, it make sense to cache the results. */
-+static regexp * compile_and_cache(const char * regex_string, 
-+                                  const char * protocol)
-+{
-+	struct pattern_cache * node               = first_pattern_cache;
-+	struct pattern_cache * last_pattern_cache = first_pattern_cache;
-+	struct pattern_cache * tmp;
-+	unsigned int len;
-+
-+	while (node != NULL) {
-+		if (!strcmp(node->regex_string, regex_string))
-+		return node->pattern;
-+
-+		last_pattern_cache = node;/* points at the last non-NULL node */
-+		node = node->next;
-+	}
-+
-+	/* If we reach the end of the list, then we have not yet cached
-+	   the pattern for this regex. Let's do that now.
-+	   Be paranoid about running out of memory to avoid list corruption. */
-+	tmp = kmalloc(sizeof(struct pattern_cache), GFP_ATOMIC);
-+
-+	if(!tmp) {
-+		if (net_ratelimit())
-+			printk(KERN_ERR "layer7: out of memory in "
-+					"compile_and_cache, bailing.\n");
-+		return NULL;
-+	}
-+
-+	tmp->regex_string  = kmalloc(strlen(regex_string) + 1, GFP_ATOMIC);
-+	tmp->pattern       = kmalloc(sizeof(struct regexp),    GFP_ATOMIC);
-+	tmp->next = NULL;
-+
-+	if(!tmp->regex_string || !tmp->pattern) {
-+		if (net_ratelimit())
-+			printk(KERN_ERR "layer7: out of memory in "
-+					"compile_and_cache, bailing.\n");
-+		kfree(tmp->regex_string);
-+		kfree(tmp->pattern);
-+		kfree(tmp);
-+		return NULL;
-+	}
-+
-+	/* Ok.  The new node is all ready now. */
-+	node = tmp;
-+
-+	if(first_pattern_cache == NULL) /* list is empty */
-+		first_pattern_cache = node; /* make node the beginning */
-+	else
-+		last_pattern_cache->next = node; /* attach node to the end */
-+
-+	/* copy the string and compile the regex */
-+	len = strlen(regex_string);
-+	DPRINTK("About to compile this: \"%s\"\n", regex_string);
-+	node->pattern = regcomp((char *)regex_string, &len);
-+	if ( !node->pattern ) {
-+		if (net_ratelimit())
-+			printk(KERN_ERR "layer7: Error compiling regexp "
-+					"\"%s\" (%s)\n", 
-+					regex_string, protocol);
-+		/* pattern is now cached as NULL, so we won't try again. */
-+	}
-+
-+	strcpy(node->regex_string, regex_string);
-+	return node->pattern;
-+}
-+
-+static int can_handle(const struct sk_buff *skb)
-+{
-+	if(!ip_hdr(skb)) /* not IP */
-+		return 0;
-+	if(ip_hdr(skb)->protocol != IPPROTO_TCP &&
-+	   ip_hdr(skb)->protocol != IPPROTO_UDP &&
-+	   ip_hdr(skb)->protocol != IPPROTO_ICMP)
-+		return 0;
-+	return 1;
-+}
-+
-+/* Returns offset the into the skb->data that the application data starts */
-+static int app_data_offset(const struct sk_buff *skb)
-+{
-+	/* In case we are ported somewhere (ebtables?) where ip_hdr(skb)
-+	isn't set, this can be gotten from 4*(skb->data[0] & 0x0f) as well. */
-+	int ip_hl = 4*ip_hdr(skb)->ihl;
-+
-+	if( ip_hdr(skb)->protocol == IPPROTO_TCP ) {
-+		/* 12 == offset into TCP header for the header length field.
-+		Can't get this with skb->h.th->doff because the tcphdr
-+		struct doesn't get set when routing (this is confirmed to be
-+		true in Netfilter as well as QoS.) */
-+		int tcp_hl = 4*(skb->data[ip_hl + 12] >> 4);
-+
-+		return ip_hl + tcp_hl;
-+	} else if( ip_hdr(skb)->protocol == IPPROTO_UDP  ) {
-+		return ip_hl + 8; /* UDP header is always 8 bytes */
-+	} else if( ip_hdr(skb)->protocol == IPPROTO_ICMP ) {
-+		return ip_hl + 8; /* ICMP header is 8 bytes */
-+	} else {
-+		if (net_ratelimit())
-+			printk(KERN_ERR "layer7: tried to handle unknown "
-+					"protocol!\n");
-+		return ip_hl + 8; /* something reasonable */
-+	}
-+}
-+
-+/* handles whether there's a match when we aren't appending data anymore */
-+static int match_no_append(struct nf_conn * conntrack, 
-+                           struct nf_conn * master_conntrack, 
-+                           enum ip_conntrack_info ctinfo,
-+                           enum ip_conntrack_info master_ctinfo,
-+                           const struct xt_layer7_info * info)
-+{
-+	/* If we're in here, throw the app data away */
-+	if(master_conntrack->layer7.app_data != NULL) {
-+
-+	#ifdef CONFIG_IP_NF_MATCH_LAYER7_DEBUG
-+		if(!master_conntrack->layer7.app_proto) {
-+			char * f = 
-+			  friendly_print(master_conntrack->layer7.app_data);
-+			char * g = 
-+			  hex_print(master_conntrack->layer7.app_data);
-+			DPRINTK("\nl7-filter gave up after %d bytes "
-+				"(%d packets):\n%s\n",
-+				strlen(f), total_acct_packets(master_conntrack), f);
-+			kfree(f);
-+			DPRINTK("In hex: %s\n", g);
-+			kfree(g);
-+		}
-+	#endif
-+
-+		kfree(master_conntrack->layer7.app_data);
-+		master_conntrack->layer7.app_data = NULL; /* don't free again */
-+	}
-+
-+	if(master_conntrack->layer7.app_proto){
-+		/* Here child connections set their .app_proto (for /proc) */
-+		if(!conntrack->layer7.app_proto) {
-+			conntrack->layer7.app_proto = 
-+			  kmalloc(strlen(master_conntrack->layer7.app_proto)+1, 
-+			    GFP_ATOMIC);
-+			if(!conntrack->layer7.app_proto){
-+				if (net_ratelimit())
-+					printk(KERN_ERR "layer7: out of memory "
-+							"in match_no_append, "
-+							"bailing.\n");
-+				return 1;
-+			}
-+			strcpy(conntrack->layer7.app_proto, 
-+				master_conntrack->layer7.app_proto);
-+		}
-+
-+		return (!strcmp(master_conntrack->layer7.app_proto, 
-+				info->protocol));
-+	}
-+	else {
-+		/* If not classified, set to "unknown" to distinguish from
-+		connections that are still being tested. */
-+		master_conntrack->layer7.app_proto = 
-+			kmalloc(strlen("unknown")+1, GFP_ATOMIC);
-+		if(!master_conntrack->layer7.app_proto){
-+			if (net_ratelimit())
-+				printk(KERN_ERR "layer7: out of memory in "
-+						"match_no_append, bailing.\n");
-+			return 1;
-+		}
-+		strcpy(master_conntrack->layer7.app_proto, "unknown");
-+		return 0;
-+	}
-+}
-+
-+/* add the new app data to the conntrack.  Return number of bytes added. */
-+static int add_data(struct nf_conn * master_conntrack,
-+                    char * app_data, int appdatalen)
-+{
-+	int length = 0, i;
-+	int oldlength = master_conntrack->layer7.app_data_len;
-+
-+	/* This is a fix for a race condition by Deti Fliegl. However, I'm not 
-+	   clear on whether the race condition exists or whether this really 
-+	   fixes it.  I might just be being dense... Anyway, if it's not really 
-+	   a fix, all it does is waste a very small amount of time. */
-+	if(!master_conntrack->layer7.app_data) return 0;
-+
-+	/* Strip nulls. Make everything lower case (our regex lib doesn't
-+	do case insensitivity).  Add it to the end of the current data. */
-+	for(i = 0; i < maxdatalen-oldlength-1 &&
-+		   i < appdatalen; i++) {
-+		if(app_data[i] != '\0') {
-+			/* the kernel version of tolower mungs 'upper ascii' */
-+			master_conntrack->layer7.app_data[length+oldlength] =
-+				isascii(app_data[i])? 
-+					tolower(app_data[i]) : app_data[i];
-+			length++;
-+		}
-+	}
-+
-+	master_conntrack->layer7.app_data[length+oldlength] = '\0';
-+	master_conntrack->layer7.app_data_len = length + oldlength;
-+
-+	return length;
-+}
-+
-+/* taken from drivers/video/modedb.c */
-+static int my_atoi(const char *s)
-+{
-+	int val = 0;
-+
-+	for (;; s++) {
-+		switch (*s) {
-+			case '0'...'9':
-+			val = 10*val+(*s-'0');
-+			break;
-+		default:
-+			return val;
-+		}
-+	}
-+}
-+
-+/* write out num_packets to userland. */
-+static int layer7_read_proc(char* page, char ** start, off_t off, int count,
-+                            int* eof, void * data)
-+{
-+	if(num_packets > 99 && net_ratelimit())
-+		printk(KERN_ERR "layer7: NOT REACHED. num_packets too big\n");
-+
-+	page[0] = num_packets/10 + '0';
-+	page[1] = num_packets%10 + '0';
-+	page[2] = '\n';
-+	page[3] = '\0';
-+
-+	*eof=1;
-+
-+	return 3;
-+}
-+
-+/* Read in num_packets from userland */
-+static int layer7_write_proc(struct file* file, const char* buffer,
-+                             unsigned long count, void *data)
-+{
-+	char * foo = kmalloc(count, GFP_ATOMIC);
-+
-+	if(!foo){
-+		if (net_ratelimit())
-+			printk(KERN_ERR "layer7: out of memory, bailing. "
-+					"num_packets unchanged.\n");
-+		return count;
-+	}
-+
-+	if(copy_from_user(foo, buffer, count)) {
-+		return -EFAULT;
-+	}
-+
-+
-+	num_packets = my_atoi(foo);
-+	kfree (foo);
-+
-+	/* This has an arbitrary limit to make the math easier. I'm lazy.
-+	But anyway, 99 is a LOT! If you want more, you're doing it wrong! */
-+	if(num_packets > 99) {
-+		printk(KERN_WARNING "layer7: num_packets can't be > 99.\n");
-+		num_packets = 99;
-+	} else if(num_packets < 1) {
-+		printk(KERN_WARNING "layer7: num_packets can't be < 1.\n");
-+		num_packets = 1;
-+	}
-+
-+	return count;
-+}
-+
-+static bool
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-+match(const struct sk_buff *skbin, const struct xt_match_param *par)
-+#else
-+match(const struct sk_buff *skbin,
-+      const struct net_device *in,
-+      const struct net_device *out,
-+      const struct xt_match *match,
-+      const void *matchinfo,
-+      int offset,
-+      unsigned int protoff,
-+      bool *hotdrop)
-+#endif
-+{
-+	/* sidestep const without getting a compiler warning... */
-+	struct sk_buff * skb = (struct sk_buff *)skbin; 
-+
-+	const struct xt_layer7_info * info = 
-+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-+		par->matchinfo;
-+	#else
-+		matchinfo;
-+	#endif
-+
-+	enum ip_conntrack_info master_ctinfo, ctinfo;
-+	struct nf_conn *master_conntrack, *conntrack;
-+	unsigned char * app_data;
-+	unsigned int pattern_result, appdatalen;
-+	regexp * comppattern;
-+
-+	/* Be paranoid/incompetent - lock the entire match function. */
-+	spin_lock_bh(&l7_lock);
-+
-+	if(!can_handle(skb)){
-+		DPRINTK("layer7: This is some protocol I can't handle.\n");
-+		spin_unlock_bh(&l7_lock);
-+		return info->invert;
-+	}
-+
-+	/* Treat parent & all its children together as one connection, except
-+	for the purpose of setting conntrack->layer7.app_proto in the actual
-+	connection. This makes /proc/net/ip_conntrack more satisfying. */
-+	if(!(conntrack = nf_ct_get(skb, &ctinfo)) ||
-+	   !(master_conntrack=nf_ct_get(skb,&master_ctinfo))){
-+		DPRINTK("layer7: couldn't get conntrack.\n");
-+		spin_unlock_bh(&l7_lock);
-+		return info->invert;
-+	}
-+
-+	/* Try to get a master conntrack (and its master etc) for FTP, etc. */
-+	while (master_ct(master_conntrack) != NULL)
-+		master_conntrack = master_ct(master_conntrack);
-+
-+	/* if we've classified it or seen too many packets */
-+	if(total_acct_packets(master_conntrack) > num_packets ||
-+	   master_conntrack->layer7.app_proto) {
-+
-+		pattern_result = match_no_append(conntrack, master_conntrack, 
-+						 ctinfo, master_ctinfo, info);
-+
-+		/* skb->cb[0] == seen. Don't do things twice if there are 
-+		multiple l7 rules. I'm not sure that using cb for this purpose 
-+		is correct, even though it says "put your private variables 
-+		there". But it doesn't look like it is being used for anything
-+		else in the skbs that make it here. */
-+		skb->cb[0] = 1; /* marking it seen here's probably irrelevant */
-+
-+		spin_unlock_bh(&l7_lock);
-+		return (pattern_result ^ info->invert);
-+	}
-+
-+	if(skb_is_nonlinear(skb)){
-+		if(skb_linearize(skb) != 0){
-+			if (net_ratelimit())
-+				printk(KERN_ERR "layer7: failed to linearize "
-+						"packet, bailing.\n");
-+			spin_unlock_bh(&l7_lock);
-+			return info->invert;
-+		}
-+	}
-+
-+	/* now that the skb is linearized, it's safe to set these. */
-+	app_data = skb->data + app_data_offset(skb);
-+	appdatalen = skb_tail_pointer(skb) - app_data;
-+
-+	/* the return value gets checked later, when we're ready to use it */
-+	comppattern = compile_and_cache(info->pattern, info->protocol);
-+
-+	/* On the first packet of a connection, allocate space for app data */
-+	if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] && 
-+	   !master_conntrack->layer7.app_data){
-+		master_conntrack->layer7.app_data = 
-+			kmalloc(maxdatalen, GFP_ATOMIC);
-+		if(!master_conntrack->layer7.app_data){
-+			if (net_ratelimit())
-+				printk(KERN_ERR "layer7: out of memory in "
-+						"match, bailing.\n");
-+			spin_unlock_bh(&l7_lock);
-+			return info->invert;
-+		}
-+
-+		master_conntrack->layer7.app_data[0] = '\0';
-+	}
-+
-+	/* Can be here, but unallocated, if numpackets is increased near
-+	the beginning of a connection */
-+	if(master_conntrack->layer7.app_data == NULL){
-+		spin_unlock_bh(&l7_lock);
-+		return info->invert; /* unmatched */
-+	}
-+
-+	if(!skb->cb[0]){
-+		int newbytes;
-+		newbytes = add_data(master_conntrack, app_data, appdatalen);
-+
-+		if(newbytes == 0) { /* didn't add any data */
-+			skb->cb[0] = 1;
-+			/* Didn't match before, not going to match now */
-+			spin_unlock_bh(&l7_lock);
-+			return info->invert;
-+		}
-+	}
-+
-+	/* If looking for "unknown", then never match.  "Unknown" means that
-+	we've given up; we're still trying with these packets. */
-+	if(!strcmp(info->protocol, "unknown")) {
-+		pattern_result = 0;
-+	/* If looking for "unset", then always match. "Unset" means that we
-+	haven't yet classified the connection. */
-+	} else if(!strcmp(info->protocol, "unset")) {
-+		pattern_result = 2;
-+		DPRINTK("layer7: matched unset: not yet classified "
-+			"(%d/%d packets)\n",
-+                        total_acct_packets(master_conntrack), num_packets);
-+	/* If the regexp failed to compile, don't bother running it */
-+	} else if(comppattern && 
-+		  regexec(comppattern, master_conntrack->layer7.app_data)){
-+		DPRINTK("layer7: matched %s\n", info->protocol);
-+		pattern_result = 1;
-+	} else pattern_result = 0;
-+
-+	if(pattern_result == 1) {
-+		master_conntrack->layer7.app_proto = 
-+			kmalloc(strlen(info->protocol)+1, GFP_ATOMIC);
-+		if(!master_conntrack->layer7.app_proto){
-+			if (net_ratelimit())
-+				printk(KERN_ERR "layer7: out of memory in "
-+						"match, bailing.\n");
-+			spin_unlock_bh(&l7_lock);
-+			return (pattern_result ^ info->invert);
-+		}
-+		strcpy(master_conntrack->layer7.app_proto, info->protocol);
-+	} else if(pattern_result > 1) { /* cleanup from "unset" */
-+		pattern_result = 1;
-+	}
-+
-+	/* mark the packet seen */
-+	skb->cb[0] = 1;
-+
-+	spin_unlock_bh(&l7_lock);
-+	return (pattern_result ^ info->invert);
-+}
-+
-+// load nf_conntrack_ipv4
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-+static bool check(const struct xt_mtchk_param *par)
-+{
-+        if (nf_ct_l3proto_try_module_get(par->match->family) < 0) {
-+                printk(KERN_WARNING "can't load conntrack support for "
-+                                    "proto=%d\n", par->match->family);
-+#else
-+static bool check(const char *tablename, const void *inf,
-+		 const struct xt_match *match, void *matchinfo,
-+		 unsigned int hook_mask)
-+{
-+        if (nf_ct_l3proto_try_module_get(match->family) < 0) {
-+                printk(KERN_WARNING "can't load conntrack support for "
-+                                    "proto=%d\n", match->family);
-+#endif
-+                return 0;
-+        }
-+	return 1;
-+}
-+
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
-+	static void destroy(const struct xt_mtdtor_param *par)
-+	{
-+		nf_ct_l3proto_module_put(par->match->family);
-+	}
-+#else
-+	static void destroy(const struct xt_match *match, void *matchinfo)
-+	{
-+		nf_ct_l3proto_module_put(match->family);
-+	}
-+#endif
-+
-+static struct xt_match xt_layer7_match[] __read_mostly = {
-+{
-+	.name		= "layer7",
-+	.family		= AF_INET,
-+	.checkentry	= check,
-+	.match		= match,
-+	.destroy	= destroy,
-+	.matchsize	= sizeof(struct xt_layer7_info),
-+	.me		= THIS_MODULE
-+}
-+};
-+
-+static void layer7_cleanup_proc(void)
-+{
-+	remove_proc_entry("layer7_numpackets", init_net.proc_net);
-+}
-+
-+/* register the proc file */
-+static void layer7_init_proc(void)
-+{
-+	struct proc_dir_entry* entry;
-+	entry = create_proc_entry("layer7_numpackets", 0644, init_net.proc_net);
-+	entry->read_proc = layer7_read_proc;
-+	entry->write_proc = layer7_write_proc;
-+}
-+
-+static int __init xt_layer7_init(void)
-+{
-+	need_conntrack();
-+
-+	layer7_init_proc();
-+	if(maxdatalen < 1) {
-+		printk(KERN_WARNING "layer7: maxdatalen can't be < 1, "
-+			"using 1\n");
-+		maxdatalen = 1;
-+	}
-+	/* This is not a hard limit.  It's just here to prevent people from
-+	bringing their slow machines to a grinding halt. */
-+	else if(maxdatalen > 65536) {
-+		printk(KERN_WARNING "layer7: maxdatalen can't be > 65536, "
-+			"using 65536\n");
-+		maxdatalen = 65536;
-+	}
-+	return xt_register_matches(xt_layer7_match,
-+				   ARRAY_SIZE(xt_layer7_match));
-+}
-+
-+static void __exit xt_layer7_fini(void)
-+{
-+	layer7_cleanup_proc();
-+	xt_unregister_matches(xt_layer7_match, ARRAY_SIZE(xt_layer7_match));
-+}
-+
-+module_init(xt_layer7_init);
-+module_exit(xt_layer7_fini);

+ 0 - 108
target/linux/generic/patches-2.6.33/101-netfilter_layer7_pktmatch.patch

@@ -1,108 +0,0 @@
---- a/include/linux/netfilter/xt_layer7.h
-+++ b/include/linux/netfilter/xt_layer7.h
-@@ -8,6 +8,7 @@ struct xt_layer7_info {
-     char protocol[MAX_PROTOCOL_LEN];
-     char pattern[MAX_PATTERN_LEN];
-     u_int8_t invert;
-+    u_int8_t pkt;
- };
- 
- #endif /* _XT_LAYER7_H */
---- a/net/netfilter/xt_layer7.c
-+++ b/net/netfilter/xt_layer7.c
-@@ -314,33 +314,35 @@ static int match_no_append(struct nf_con
- }
- 
- /* add the new app data to the conntrack.  Return number of bytes added. */
--static int add_data(struct nf_conn * master_conntrack,
--                    char * app_data, int appdatalen)
-+static int add_datastr(char *target, int offset, char *app_data, int len)
- {
- 	int length = 0, i;
--	int oldlength = master_conntrack->layer7.app_data_len;
--
--	/* This is a fix for a race condition by Deti Fliegl. However, I'm not 
--	   clear on whether the race condition exists or whether this really 
--	   fixes it.  I might just be being dense... Anyway, if it's not really 
--	   a fix, all it does is waste a very small amount of time. */
--	if(!master_conntrack->layer7.app_data) return 0;
-+	if (!target) return 0;
- 
- 	/* Strip nulls. Make everything lower case (our regex lib doesn't
- 	do case insensitivity).  Add it to the end of the current data. */
--	for(i = 0; i < maxdatalen-oldlength-1 &&
--		   i < appdatalen; i++) {
-+ 	for(i = 0; i < maxdatalen-offset-1 && i < len; i++) {
- 		if(app_data[i] != '\0') {
- 			/* the kernel version of tolower mungs 'upper ascii' */
--			master_conntrack->layer7.app_data[length+oldlength] =
-+			target[length+offset] =
- 				isascii(app_data[i])? 
- 					tolower(app_data[i]) : app_data[i];
- 			length++;
- 		}
- 	}
-+	target[length+offset] = '\0';
-+
-+	return length;
-+}
-+
-+/* add the new app data to the conntrack.  Return number of bytes added. */
-+static int add_data(struct nf_conn * master_conntrack,
-+                    char * app_data, int appdatalen)
-+{
-+	int length;
- 
--	master_conntrack->layer7.app_data[length+oldlength] = '\0';
--	master_conntrack->layer7.app_data_len = length + oldlength;
-+	length = add_datastr(master_conntrack->layer7.app_data, master_conntrack->layer7.app_data_len, app_data, appdatalen);
-+	master_conntrack->layer7.app_data_len += length;
- 
- 	return length;
- }
-@@ -438,7 +440,7 @@ match(const struct sk_buff *skbin,
- 
- 	enum ip_conntrack_info master_ctinfo, ctinfo;
- 	struct nf_conn *master_conntrack, *conntrack;
--	unsigned char * app_data;
-+	unsigned char *app_data, *tmp_data;
- 	unsigned int pattern_result, appdatalen;
- 	regexp * comppattern;
- 
-@@ -466,8 +468,8 @@ match(const struct sk_buff *skbin,
- 		master_conntrack = master_ct(master_conntrack);
- 
- 	/* if we've classified it or seen too many packets */
--	if(total_acct_packets(master_conntrack) > num_packets ||
--	   master_conntrack->layer7.app_proto) {
-+	if(!info->pkt && (total_acct_packets(master_conntrack) > num_packets ||
-+	   master_conntrack->layer7.app_proto)) {
- 
- 		pattern_result = match_no_append(conntrack, master_conntrack, 
- 						 ctinfo, master_ctinfo, info);
-@@ -500,6 +502,25 @@ match(const struct sk_buff *skbin,
- 	/* the return value gets checked later, when we're ready to use it */
- 	comppattern = compile_and_cache(info->pattern, info->protocol);
- 
-+	if (info->pkt) {
-+		tmp_data = kmalloc(maxdatalen, GFP_ATOMIC);
-+		if(!tmp_data){
-+			if (net_ratelimit())
-+				printk(KERN_ERR "layer7: out of memory in match, bailing.\n");
-+			return info->invert;
-+		}
-+
-+		tmp_data[0] = '\0';
-+		add_datastr(tmp_data, 0, app_data, appdatalen);
-+		pattern_result = ((comppattern && regexec(comppattern, tmp_data)) ? 1 : 0);
-+
-+		kfree(tmp_data);
-+		tmp_data = NULL;
-+		spin_unlock_bh(&l7_lock);
-+
-+		return (pattern_result ^ info->invert);
-+	}
-+
- 	/* On the first packet of a connection, allocate space for app data */
- 	if(total_acct_packets(master_conntrack) == 1 && !skb->cb[0] && 
- 	   !master_conntrack->layer7.app_data){

+ 0 - 144
target/linux/generic/patches-2.6.33/110-netfilter_match_speedup.patch

@@ -1,144 +0,0 @@
---- a/include/linux/netfilter_ipv4/ip_tables.h
-+++ b/include/linux/netfilter_ipv4/ip_tables.h
-@@ -62,6 +62,7 @@ struct ipt_ip {
- #define IPT_F_FRAG		0x01	/* Set if rule is a fragment rule */
- #define IPT_F_GOTO		0x02	/* Set if jump is a goto */
- #define IPT_F_MASK		0x03	/* All possible flag bits mask. */
-+#define IPT_F_NO_DEF_MATCH	0x80	/* Internal: no default match rules present */
- 
- /* Values for "inv" field in struct ipt_ip. */
- #define IPT_INV_VIA_IN		0x01	/* Invert the sense of IN IFACE. */
---- a/net/ipv4/netfilter/ip_tables.c
-+++ b/net/ipv4/netfilter/ip_tables.c
-@@ -88,6 +88,9 @@ ip_packet_match(const struct iphdr *ip,
- 
- #define FWINV(bool, invflg) ((bool) ^ !!(ipinfo->invflags & (invflg)))
- 
-+	if (ipinfo->flags & IPT_F_NO_DEF_MATCH)
-+		return true;
-+
- 	if (FWINV((ip->saddr&ipinfo->smsk.s_addr) != ipinfo->src.s_addr,
- 		  IPT_INV_SRCIP) ||
- 	    FWINV((ip->daddr&ipinfo->dmsk.s_addr) != ipinfo->dst.s_addr,
-@@ -138,13 +141,35 @@ ip_packet_match(const struct iphdr *ip,
- 		return false;
- 	}
- 
-+#undef FWINV
- 	return true;
- }
- 
- static bool
--ip_checkentry(const struct ipt_ip *ip)
-+ip_checkentry(struct ipt_ip *ip)
- {
--	if (ip->flags & ~IPT_F_MASK) {
-+#define FWINV(bool, invflg) ((bool) || (ip->invflags & (invflg)))
-+
-+	if (FWINV(ip->smsk.s_addr, IPT_INV_SRCIP) ||
-+		FWINV(ip->dmsk.s_addr, IPT_INV_DSTIP))
-+		goto has_match_rules;
-+
-+	if (FWINV(!!((const unsigned long *)ip->iniface_mask)[0],
-+		IPT_INV_VIA_IN) ||
-+	    FWINV(!!((const unsigned long *)ip->outiface_mask)[0],
-+		IPT_INV_VIA_OUT))
-+		goto has_match_rules;
-+
-+	if (FWINV(ip->proto, IPT_INV_PROTO))
-+		goto has_match_rules;
-+
-+	if (FWINV(ip->flags&IPT_F_FRAG, IPT_INV_FRAG))
-+		goto has_match_rules;
-+
-+	ip->flags |= IPT_F_NO_DEF_MATCH;
-+
-+has_match_rules:
-+	if (ip->flags & ~(IPT_F_MASK|IPT_F_NO_DEF_MATCH)) {
- 		duprintf("Unknown flag bits set: %08X\n",
- 			 ip->flags & ~IPT_F_MASK);
- 		return false;
-@@ -154,6 +179,8 @@ ip_checkentry(const struct ipt_ip *ip)
- 			 ip->invflags & ~IPT_INV_MASK);
- 		return false;
- 	}
-+
-+#undef FWINV
- 	return true;
- }
- 
-@@ -196,7 +223,6 @@ static inline bool unconditional(const s
- 	static const struct ipt_ip uncond;
- 
- 	return memcmp(ip, &uncond, sizeof(uncond)) == 0;
--#undef FWINV
- }
- 
- #if defined(CONFIG_NETFILTER_XT_TARGET_TRACE) || \
-@@ -321,8 +347,28 @@ ipt_do_table(struct sk_buff *skb,
- 	struct xt_match_param mtpar;
- 	struct xt_target_param tgpar;
- 
--	/* Initialization */
- 	ip = ip_hdr(skb);
-+
-+	IP_NF_ASSERT(table->valid_hooks & (1 << hook));
-+	xt_info_rdlock_bh();
-+	private = table->private;
-+	table_base = private->entries[smp_processor_id()];
-+	e = get_entry(table_base, private->hook_entry[hook]);
-+
-+	if (e->target_offset <= sizeof(struct ipt_entry) &&
-+		(e->ip.flags & IPT_F_NO_DEF_MATCH)) {
-+			struct ipt_entry_target *t = ipt_get_target(e);
-+			if (!t->u.kernel.target->target) {
-+				int v = ((struct ipt_standard_target *)t)->verdict;
-+				if ((v < 0) && (v != IPT_RETURN)) {
-+					ADD_COUNTER(e->counters, ntohs(ip->tot_len), 1);
-+					xt_info_rdunlock_bh();
-+					return (unsigned)(-v) - 1;
-+				}
-+			}
-+	}
-+
-+	/* Initialization */
- 	indev = in ? in->name : nulldevname;
- 	outdev = out ? out->name : nulldevname;
- 	/* We handle fragments by dealing with the first fragment as
-@@ -339,13 +385,6 @@ ipt_do_table(struct sk_buff *skb,
- 	mtpar.family  = tgpar.family = NFPROTO_IPV4;
- 	mtpar.hooknum = tgpar.hooknum = hook;
- 
--	IP_NF_ASSERT(table->valid_hooks & (1 << hook));
--	xt_info_rdlock_bh();
--	private = table->private;
--	table_base = private->entries[smp_processor_id()];
--
--	e = get_entry(table_base, private->hook_entry[hook]);
--
- 	/* For return from builtin chain */
- 	back = get_entry(table_base, private->underflow[hook]);
- 
-@@ -992,6 +1031,7 @@ copy_entries_to_user(unsigned int total_
- 		unsigned int i;
- 		const struct ipt_entry_match *m;
- 		const struct ipt_entry_target *t;
-+		u8 flags;
- 
- 		e = (struct ipt_entry *)(loc_cpu_entry + off);
- 		if (copy_to_user(userptr + off
-@@ -1001,6 +1041,14 @@ copy_entries_to_user(unsigned int total_
- 			ret = -EFAULT;
- 			goto free_counters;
- 		}
-+
-+		flags = e->ip.flags & ~IPT_F_NO_DEF_MATCH;
-+		if (copy_to_user(userptr + off
-+				 + offsetof(struct ipt_entry, ip.flags),
-+				 &flags, sizeof(flags)) != 0) {
-+			ret = -EFAULT;
-+			goto free_counters;
-+		}
- 
- 		for (i = sizeof(struct ipt_entry);
- 		     i < e->target_offset;

+ 0 - 1337
target/linux/generic/patches-2.6.33/150-netfilter_imq.patch

@@ -1,1337 +0,0 @@
---- /dev/null
-+++ b/drivers/net/imq.c
-@@ -0,0 +1,632 @@
-+/*
-+ *             Pseudo-driver for the intermediate queue device.
-+ *
-+ *             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.
-+ *
-+ * Authors:    Patrick McHardy, <[email protected]>
-+ *
-+ *            The first version was written by Martin Devera, <[email protected]>
-+ *
-+ * Credits:    Jan Rafaj <[email protected]>
-+ *              - Update patch to 2.4.21
-+ *             Sebastian Strollo <[email protected]>
-+ *              - Fix "Dead-loop on netdevice imq"-issue
-+ *             Marcel Sebek <[email protected]>
-+ *              - Update to 2.6.2-rc1
-+ *
-+ *	       After some time of inactivity there is a group taking care
-+ *	       of IMQ again: http://www.linuximq.net
-+ *
-+ *
-+ *	       2004/06/30 - New version of IMQ patch to kernels <=2.6.7
-+ *             including the following changes:
-+ *
-+ *	       - Correction of ipv6 support "+"s issue (Hasso Tepper)
-+ *	       - Correction of imq_init_devs() issue that resulted in
-+ *	       kernel OOPS unloading IMQ as module (Norbert Buchmuller)
-+ *	       - Addition of functionality to choose number of IMQ devices
-+ *	       during kernel config (Andre Correa)
-+ *	       - Addition of functionality to choose how IMQ hooks on
-+ *	       PRE and POSTROUTING (after or before NAT) (Andre Correa)
-+ *	       - Cosmetic corrections (Norbert Buchmuller) (Andre Correa)
-+ *
-+ *
-+ *             2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were
-+ *             released with almost no problems. 2.6.14-x was released
-+ *             with some important changes: nfcache was removed; After
-+ *             some weeks of trouble we figured out that some IMQ fields
-+ *             in skb were missing in skbuff.c - skb_clone and copy_skb_header.
-+ *             These functions are correctly patched by this new patch version.
-+ *
-+ *             Thanks for all who helped to figure out all the problems with
-+ *             2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX,
-+ *             Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully
-+ *             I didn't forget anybody). I apologize again for my lack of time.
-+ *
-+ *
-+ *             2008/06/17 - 2.6.25 - Changed imq.c to use qdisc_run() instead 
-+ *             of qdisc_restart() and moved qdisc_run() to tasklet to avoid
-+ *             recursive locking. New initialization routines to fix 'rmmod' not
-+ *             working anymore. Used code from ifb.c. (Jussi Kivilinna)
-+ *
-+ *             2008/08/06 - 2.6.26 - (JK)
-+ *              - Replaced tasklet with 'netif_schedule()'.
-+ *              - Cleaned up and added comments for imq_nf_queue().
-+ *
-+ *             2009/04/12
-+ *              - Add skb_save_cb/skb_restore_cb helper functions for backuping
-+ *                control buffer. This is needed because qdisc-layer on kernels
-+ *                2.6.27 and newer overwrite control buffer. (Jussi Kivilinna)
-+ *              - Add better locking for IMQ device. Hopefully this will solve
-+ *                SMP issues. (Jussi Kivilinna)
-+ *              - Port to 2.6.27
-+ *              - Port to 2.6.28
-+ *              - Port to 2.6.29 + fix rmmod not working
-+ *
-+ *             2009/04/20 - (Jussi Kivilinna)
-+ *              - Use netdevice feature flags to avoid extra packet handling
-+ *                by core networking layer and possibly increase performance.
-+ *
-+ *             2009/09/26 - (Jussi Kivilinna)
-+ *              - Add imq_nf_reinject_lockless to fix deadlock with
-+ *                imq_nf_queue/imq_nf_reinject.
-+ *
-+ *             2009/12/08 - (Jussi Kivilinna)
-+ *              - Port to 2.6.32
-+ *              - Add check for skb->nf_queue_entry==NULL in imq_dev_xmit()
-+ *              - Also add better error checking for skb->nf_queue_entry usage
-+ *
-+ *	       Also, many thanks to pablo Sebastian Greco for making the initial
-+ *	       patch and to those who helped the testing.
-+ *
-+ *             More info at: http://www.linuximq.net/ (Andre Correa)
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/kernel.h>
-+#include <linux/moduleparam.h>
-+#include <linux/list.h>
-+#include <linux/skbuff.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/rtnetlink.h>
-+#include <linux/if_arp.h>
-+#include <linux/netfilter.h>
-+#include <linux/netfilter_ipv4.h>
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+	#include <linux/netfilter_ipv6.h>
-+#endif
-+#include <linux/imq.h>
-+#include <net/pkt_sched.h>
-+#include <net/netfilter/nf_queue.h>
-+
-+static nf_hookfn imq_nf_hook;
-+
-+static struct nf_hook_ops imq_ingress_ipv4 = {
-+	.hook		= imq_nf_hook,
-+	.owner		= THIS_MODULE,
-+	.pf		= PF_INET,
-+	.hooknum	= NF_INET_PRE_ROUTING,
-+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
-+	.priority	= NF_IP_PRI_MANGLE + 1
-+#else
-+	.priority	= NF_IP_PRI_NAT_DST + 1
-+#endif
-+};
-+
-+static struct nf_hook_ops imq_egress_ipv4 = {
-+	.hook		= imq_nf_hook,
-+	.owner		= THIS_MODULE,
-+	.pf		= PF_INET,
-+	.hooknum	= NF_INET_POST_ROUTING,
-+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
-+	.priority	= NF_IP_PRI_LAST
-+#else
-+	.priority	= NF_IP_PRI_NAT_SRC - 1
-+#endif
-+};
-+
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+static struct nf_hook_ops imq_ingress_ipv6 = {
-+	.hook		= imq_nf_hook,
-+	.owner		= THIS_MODULE,
-+	.pf		= PF_INET6,
-+	.hooknum	= NF_INET_PRE_ROUTING,
-+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
-+	.priority	= NF_IP6_PRI_MANGLE + 1
-+#else
-+	.priority	= NF_IP6_PRI_NAT_DST + 1
-+#endif
-+};
-+
-+static struct nf_hook_ops imq_egress_ipv6 = {
-+	.hook		= imq_nf_hook,
-+	.owner		= THIS_MODULE,
-+	.pf		= PF_INET6,
-+	.hooknum	= NF_INET_POST_ROUTING,
-+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
-+	.priority	= NF_IP6_PRI_LAST
-+#else
-+	.priority	= NF_IP6_PRI_NAT_SRC - 1
-+#endif
-+};
-+#endif
-+
-+#if defined(CONFIG_IMQ_NUM_DEVS)
-+static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS;
-+#else
-+static unsigned int numdevs = IMQ_MAX_DEVS;
-+#endif
-+
-+static DEFINE_SPINLOCK(imq_nf_queue_lock);
-+
-+static struct net_device *imq_devs_cache[IMQ_MAX_DEVS];
-+
-+
-+static struct net_device_stats *imq_get_stats(struct net_device *dev)
-+{
-+	return &dev->stats;
-+}
-+
-+/* called for packets kfree'd in qdiscs at places other than enqueue */
-+static void imq_skb_destructor(struct sk_buff *skb)
-+{
-+	struct nf_queue_entry *entry = skb->nf_queue_entry;
-+
-+	skb->nf_queue_entry = NULL;
-+
-+	if (entry) {
-+		nf_queue_entry_release_refs(entry);
-+		kfree(entry);
-+	}
-+
-+	skb_restore_cb(skb); /* kfree backup */
-+}
-+
-+/* locking not needed when called from imq_nf_queue */
-+static void imq_nf_reinject_lockless(struct nf_queue_entry *entry,
-+						unsigned int verdict)
-+{
-+	int status;
-+
-+	if (!entry->next_outfn) {
-+		nf_reinject(entry, verdict);
-+		return;
-+	}
-+
-+	status = entry->next_outfn(entry, entry->next_queuenum);
-+	if (status < 0) {
-+		nf_queue_entry_release_refs(entry);
-+		kfree_skb(entry->skb);
-+		kfree(entry);
-+	}
-+}
-+
-+static void imq_nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
-+{
-+	int status;
-+
-+	if (!entry->next_outfn) {
-+		spin_lock_bh(&imq_nf_queue_lock);
-+		nf_reinject(entry, verdict);
-+		spin_unlock_bh(&imq_nf_queue_lock);
-+		return;
-+	}
-+
-+	rcu_read_lock();
-+	local_bh_disable();
-+	status = entry->next_outfn(entry, entry->next_queuenum);
-+	local_bh_enable();
-+	if (status < 0) {
-+		nf_queue_entry_release_refs(entry);
-+		kfree_skb(entry->skb);
-+		kfree(entry);
-+	}
-+
-+	rcu_read_unlock();
-+}
-+
-+static netdev_tx_t imq_dev_xmit(struct sk_buff *skb, struct net_device *dev)
-+{
-+	struct nf_queue_entry *entry = skb->nf_queue_entry;
-+
-+	skb->nf_queue_entry = NULL;
-+	dev->trans_start = jiffies;
-+
-+	dev->stats.tx_bytes += skb->len;
-+	dev->stats.tx_packets++;
-+
-+	if (entry == NULL) {
-+		/* We don't know what is going on here.. packet is queued for
-+		 * imq device, but (probably) not by us.
-+		 *
-+		 * If this packet was not send here by imq_nf_queue(), then
-+		 * skb_save_cb() was not used and skb_free() should not show:
-+		 *   WARNING: IMQ: kfree_skb: skb->cb_next:..
-+		 * and/or
-+		 *   WARNING: IMQ: kfree_skb: skb->nf_queue_entry...
-+		 *
-+		 * However if this message is shown, then IMQ is somehow broken
-+		 * and you should report this to linuximq.net.
-+		 */
-+
-+		/* imq_dev_xmit is black hole that eats all packets, report that
-+		 * we eat this packet happily and increase dropped counters.
-+		 */
-+
-+		dev->stats.tx_dropped++;
-+		dev_kfree_skb(skb);
-+
-+		return NETDEV_TX_OK;
-+	}
-+
-+	skb_restore_cb(skb); /* restore skb->cb */
-+
-+	skb->imq_flags = 0;
-+	skb->destructor = NULL;
-+
-+	imq_nf_reinject(entry, NF_ACCEPT);
-+
-+	return NETDEV_TX_OK;
-+}
-+
-+static int imq_nf_queue(struct nf_queue_entry *entry, unsigned queue_num)
-+{
-+	struct net_device *dev;
-+	struct sk_buff *skb_orig, *skb, *skb_shared;
-+	struct Qdisc *q;
-+	struct netdev_queue *txq;
-+	int users, index;
-+	int retval = -EINVAL;
-+
-+	index = entry->skb->imq_flags & IMQ_F_IFMASK;
-+	if (unlikely(index > numdevs - 1)) {
-+		if (net_ratelimit())
-+			printk(KERN_WARNING
-+			       "IMQ: invalid device specified, highest is %u\n",
-+			       numdevs - 1);
-+		retval = -EINVAL;
-+		goto out;
-+	}
-+
-+	/* check for imq device by index from cache */
-+	dev = imq_devs_cache[index];
-+	if (unlikely(!dev)) {
-+		char buf[8];
-+
-+		/* get device by name and cache result */
-+		snprintf(buf, sizeof(buf), "imq%d", index);
-+		dev = dev_get_by_name(&init_net, buf);
-+		if (!dev) {
-+			/* not found ?!*/
-+			BUG();
-+			retval = -ENODEV;
-+			goto out;
-+		}
-+
-+		imq_devs_cache[index] = dev;
-+		dev_put(dev);
-+	}
-+
-+	if (unlikely(!(dev->flags & IFF_UP))) {
-+		entry->skb->imq_flags = 0;
-+		imq_nf_reinject_lockless(entry, NF_ACCEPT);
-+		retval = 0;
-+		goto out;
-+	}
-+	dev->last_rx = jiffies;
-+
-+	skb = entry->skb;
-+	skb_orig = NULL;
-+
-+	/* skb has owner? => make clone */
-+	if (unlikely(skb->destructor)) {
-+		skb_orig = skb;
-+		skb = skb_clone(skb, GFP_ATOMIC);
-+		if (!skb) {
-+			retval = -ENOMEM;
-+			goto out;
-+		}
-+		entry->skb = skb;
-+	}
-+
-+	skb->nf_queue_entry = entry;
-+
-+	dev->stats.rx_bytes += skb->len;
-+	dev->stats.rx_packets++;
-+
-+	txq = dev_pick_tx(dev, skb);
-+
-+	q = rcu_dereference(txq->qdisc);
-+	if (unlikely(!q->enqueue))
-+		goto packet_not_eaten_by_imq_dev;
-+
-+	spin_lock_bh(qdisc_lock(q));
-+
-+	users = atomic_read(&skb->users);
-+
-+	skb_shared = skb_get(skb); /* increase reference count by one */
-+	skb_save_cb(skb_shared); /* backup skb->cb, as qdisc layer will
-+					overwrite it */
-+	qdisc_enqueue_root(skb_shared, q); /* might kfree_skb */
-+
-+	if (likely(atomic_read(&skb_shared->users) == users + 1)) {
-+		kfree_skb(skb_shared); /* decrease reference count by one */
-+
-+		skb->destructor = &imq_skb_destructor;
-+
-+		/* cloned? */
-+		if (skb_orig)
-+			kfree_skb(skb_orig); /* free original */
-+
-+		spin_unlock_bh(qdisc_lock(q));
-+
-+		/* schedule qdisc dequeue */
-+		__netif_schedule(q);
-+
-+		retval = 0;
-+		goto out;
-+	} else {
-+		skb_restore_cb(skb_shared); /* restore skb->cb */
-+		skb->nf_queue_entry = NULL;
-+		/* qdisc dropped packet and decreased skb reference count of
-+		 * skb, so we don't really want to and try refree as that would
-+		 * actually destroy the skb. */
-+		spin_unlock_bh(qdisc_lock(q));
-+		goto packet_not_eaten_by_imq_dev;
-+	}
-+
-+packet_not_eaten_by_imq_dev:
-+	/* cloned? restore original */
-+	if (skb_orig) {
-+		kfree_skb(skb);
-+		entry->skb = skb_orig;
-+	}
-+	retval = -1;
-+out:
-+	return retval;
-+}
-+
-+static struct nf_queue_handler nfqh = {
-+	.name  = "imq",
-+	.outfn = imq_nf_queue,
-+};
-+
-+static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff *pskb,
-+				const struct net_device *indev,
-+				const struct net_device *outdev,
-+				int (*okfn)(struct sk_buff *))
-+{
-+	if (pskb->imq_flags & IMQ_F_ENQUEUE)
-+		return NF_QUEUE;
-+
-+	return NF_ACCEPT;
-+}
-+
-+static int imq_close(struct net_device *dev)
-+{
-+	netif_stop_queue(dev);
-+	return 0;
-+}
-+
-+static int imq_open(struct net_device *dev)
-+{
-+	netif_start_queue(dev);
-+	return 0;
-+}
-+
-+static const struct net_device_ops imq_netdev_ops = {
-+	.ndo_open		= imq_open,
-+	.ndo_stop		= imq_close,
-+	.ndo_start_xmit		= imq_dev_xmit,
-+	.ndo_get_stats		= imq_get_stats,
-+};
-+
-+static void imq_setup(struct net_device *dev)
-+{
-+	dev->netdev_ops		= &imq_netdev_ops;
-+	dev->type               = ARPHRD_VOID;
-+	dev->mtu                = 16000;
-+	dev->tx_queue_len       = 11000;
-+	dev->flags              = IFF_NOARP;
-+	dev->features           = NETIF_F_SG | NETIF_F_FRAGLIST |
-+				  NETIF_F_GSO | NETIF_F_HW_CSUM |
-+				  NETIF_F_HIGHDMA;
-+	dev->priv_flags		&= ~IFF_XMIT_DST_RELEASE;
-+}
-+
-+static int imq_validate(struct nlattr *tb[], struct nlattr *data[])
-+{
-+	int ret = 0;
-+
-+	if (tb[IFLA_ADDRESS]) {
-+		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) {
-+			ret = -EINVAL;
-+			goto end;
-+		}
-+		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS]))) {
-+			ret = -EADDRNOTAVAIL;
-+			goto end;
-+		}
-+	}
-+	return 0;
-+end:
-+	printk(KERN_WARNING "IMQ: imq_validate failed (%d)\n", ret);
-+	return ret;
-+}
-+
-+static struct rtnl_link_ops imq_link_ops __read_mostly = {
-+	.kind		= "imq",
-+	.priv_size	= 0,
-+	.setup		= imq_setup,
-+	.validate	= imq_validate,
-+};
-+
-+static int __init imq_init_hooks(void)
-+{
-+	int err;
-+
-+	nf_register_queue_imq_handler(&nfqh);
-+
-+	err = nf_register_hook(&imq_ingress_ipv4);
-+	if (err)
-+		goto err1;
-+
-+	err = nf_register_hook(&imq_egress_ipv4);
-+	if (err)
-+		goto err2;
-+
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+	err = nf_register_hook(&imq_ingress_ipv6);
-+	if (err)
-+		goto err3;
-+
-+	err = nf_register_hook(&imq_egress_ipv6);
-+	if (err)
-+		goto err4;
-+#endif
-+
-+	return 0;
-+
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+err4:
-+	nf_unregister_hook(&imq_ingress_ipv6);
-+err3:
-+	nf_unregister_hook(&imq_egress_ipv4);
-+#endif
-+err2:
-+	nf_unregister_hook(&imq_ingress_ipv4);
-+err1:
-+	nf_unregister_queue_imq_handler();
-+	return err;
-+}
-+
-+static int __init imq_init_one(int index)
-+{
-+	struct net_device *dev;
-+	int ret;
-+
-+	dev = alloc_netdev(0, "imq%d", imq_setup);
-+	if (!dev)
-+		return -ENOMEM;
-+
-+	ret = dev_alloc_name(dev, dev->name);
-+	if (ret < 0)
-+		goto fail;
-+
-+	dev->rtnl_link_ops = &imq_link_ops;
-+	ret = register_netdevice(dev);
-+	if (ret < 0)
-+		goto fail;
-+
-+	return 0;
-+fail:
-+	free_netdev(dev);
-+	return ret;
-+}
-+
-+static int __init imq_init_devs(void)
-+{
-+	int err, i;
-+
-+	if (numdevs < 1 || numdevs > IMQ_MAX_DEVS) {
-+		printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n",
-+		       IMQ_MAX_DEVS);
-+		return -EINVAL;
-+	}
-+
-+	rtnl_lock();
-+	err = __rtnl_link_register(&imq_link_ops);
-+
-+	for (i = 0; i < numdevs && !err; i++)
-+		err = imq_init_one(i);
-+
-+	if (err) {
-+		__rtnl_link_unregister(&imq_link_ops);
-+		memset(imq_devs_cache, 0, sizeof(imq_devs_cache));
-+	}
-+	rtnl_unlock();
-+
-+	return err;
-+}
-+
-+static int __init imq_init_module(void)
-+{
-+	int err;
-+
-+#if defined(CONFIG_IMQ_NUM_DEVS)
-+	BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS > 16);
-+	BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS < 2);
-+	BUILD_BUG_ON(CONFIG_IMQ_NUM_DEVS - 1 > IMQ_F_IFMASK);
-+#endif
-+
-+	err = imq_init_devs();
-+	if (err) {
-+		printk(KERN_ERR "IMQ: Error trying imq_init_devs(net)\n");
-+		return err;
-+	}
-+
-+	err = imq_init_hooks();
-+	if (err) {
-+		printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n");
-+		rtnl_link_unregister(&imq_link_ops);
-+		memset(imq_devs_cache, 0, sizeof(imq_devs_cache));
-+		return err;
-+	}
-+
-+	printk(KERN_INFO "IMQ driver loaded successfully.\n");
-+
-+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
-+	printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n");
-+#else
-+	printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n");
-+#endif
-+#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB)
-+	printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n");
-+#else
-+	printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n");
-+#endif
-+
-+	return 0;
-+}
-+
-+static void __exit imq_unhook(void)
-+{
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+	nf_unregister_hook(&imq_ingress_ipv6);
-+	nf_unregister_hook(&imq_egress_ipv6);
-+#endif
-+	nf_unregister_hook(&imq_ingress_ipv4);
-+	nf_unregister_hook(&imq_egress_ipv4);
-+
-+	nf_unregister_queue_imq_handler();
-+}
-+
-+static void __exit imq_cleanup_devs(void)
-+{
-+	rtnl_link_unregister(&imq_link_ops);
-+	memset(imq_devs_cache, 0, sizeof(imq_devs_cache));
-+}
-+
-+static void __exit imq_exit_module(void)
-+{
-+	imq_unhook();
-+	imq_cleanup_devs();
-+	printk(KERN_INFO "IMQ driver unloaded successfully.\n");
-+}
-+
-+module_init(imq_init_module);
-+module_exit(imq_exit_module);
-+
-+module_param(numdevs, int, 0);
-+MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will "
-+			"be created)");
-+MODULE_AUTHOR("http://www.linuximq.net");
-+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See "
-+			"http://www.linuximq.net/ for more information.");
-+MODULE_LICENSE("GPL");
-+MODULE_ALIAS_RTNL_LINK("imq");
-+
---- a/drivers/net/Kconfig
-+++ b/drivers/net/Kconfig
-@@ -109,6 +109,129 @@ config EQUALIZER
- 	  To compile this driver as a module, choose M here: the module
- 	  will be called eql.  If unsure, say N.
- 
-+config IMQ
-+	tristate "IMQ (intermediate queueing device) support"
-+	depends on NETDEVICES && NETFILTER
-+	---help---
-+	  The IMQ device(s) is used as placeholder for QoS queueing
-+	  disciplines. Every packet entering/leaving the IP stack can be
-+	  directed through the IMQ device where it's enqueued/dequeued to the
-+	  attached qdisc. This allows you to treat network devices as classes
-+	  and distribute bandwidth among them. Iptables is used to specify
-+	  through which IMQ device, if any, packets travel.
-+
-+	  More information at: http://www.linuximq.net/
-+
-+	  To compile this driver as a module, choose M here: the module
-+	  will be called imq.  If unsure, say N.
-+
-+choice
-+	prompt "IMQ behavior (PRE/POSTROUTING)"
-+	depends on IMQ
-+	default IMQ_BEHAVIOR_AB
-+	help
-+
-+		This settings defines how IMQ behaves in respect to its
-+		hooking in PREROUTING and POSTROUTING.
-+
-+		IMQ can work in any of the following ways:
-+
-+		    PREROUTING   |      POSTROUTING
-+		-----------------|-------------------
-+		#1  After NAT    |      After NAT
-+		#2  After NAT    |      Before NAT
-+		#3  Before NAT   |      After NAT
-+		#4  Before NAT   |      Before NAT
-+
-+		The default behavior is to hook before NAT on PREROUTING
-+		and after NAT on POSTROUTING (#3).
-+
-+		This settings are specially usefull when trying to use IMQ
-+		to shape NATed clients.
-+
-+		More information can be found at: www.linuximq.net
-+
-+		If not sure leave the default settings alone.
-+
-+config IMQ_BEHAVIOR_AA
-+	bool "IMQ AA"
-+	help
-+		This settings defines how IMQ behaves in respect to its
-+		hooking in PREROUTING and POSTROUTING.
-+
-+		Choosing this option will make IMQ hook like this:
-+
-+		PREROUTING:   After NAT
-+		POSTROUTING:  After NAT
-+
-+		More information can be found at: www.linuximq.net
-+
-+		If not sure leave the default settings alone.
-+
-+config IMQ_BEHAVIOR_AB
-+	bool "IMQ AB"
-+	help
-+		This settings defines how IMQ behaves in respect to its
-+		hooking in PREROUTING and POSTROUTING.
-+
-+		Choosing this option will make IMQ hook like this:
-+
-+		PREROUTING:   After NAT
-+		POSTROUTING:  Before NAT
-+
-+		More information can be found at: www.linuximq.net
-+
-+		If not sure leave the default settings alone.
-+
-+config IMQ_BEHAVIOR_BA
-+	bool "IMQ BA"
-+	help
-+		This settings defines how IMQ behaves in respect to its
-+		hooking in PREROUTING and POSTROUTING.
-+
-+		Choosing this option will make IMQ hook like this:
-+
-+		PREROUTING:   Before NAT
-+		POSTROUTING:  After NAT
-+
-+		More information can be found at: www.linuximq.net
-+
-+		If not sure leave the default settings alone.
-+
-+config IMQ_BEHAVIOR_BB
-+	bool "IMQ BB"
-+	help
-+		This settings defines how IMQ behaves in respect to its
-+		hooking in PREROUTING and POSTROUTING.
-+
-+		Choosing this option will make IMQ hook like this:
-+
-+		PREROUTING:   Before NAT
-+		POSTROUTING:  Before NAT
-+
-+		More information can be found at: www.linuximq.net
-+
-+		If not sure leave the default settings alone.
-+
-+endchoice
-+
-+config IMQ_NUM_DEVS
-+
-+	int "Number of IMQ devices"
-+	range 2 16
-+	depends on IMQ
-+	default "16"
-+	help
-+
-+		This settings defines how many IMQ devices will be
-+		created.
-+
-+		The default value is 16.
-+
-+		More information can be found at: www.linuximq.net
-+
-+		If not sure leave the default settings alone.
-+
- config TUN
- 	tristate "Universal TUN/TAP device driver support"
- 	select CRC32
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -165,6 +165,7 @@ obj-$(CONFIG_SLHC) += slhc.o
- obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
- 
- obj-$(CONFIG_DUMMY) += dummy.o
-+obj-$(CONFIG_IMQ) += imq.o
- obj-$(CONFIG_IFB) += ifb.o
- obj-$(CONFIG_MACVLAN) += macvlan.o
- obj-$(CONFIG_DE600) += de600.o
---- /dev/null
-+++ b/include/linux/imq.h
-@@ -0,0 +1,13 @@
-+#ifndef _IMQ_H
-+#define _IMQ_H
-+
-+/* IFMASK (16 device indexes, 0 to 15) and flag(s) fit in 5 bits */
-+#define IMQ_F_BITS	5
-+
-+#define IMQ_F_IFMASK	0x0f
-+#define IMQ_F_ENQUEUE	0x10
-+
-+#define IMQ_MAX_DEVS	(IMQ_F_IFMASK + 1)
-+
-+#endif /* _IMQ_H */
-+
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -1168,6 +1168,7 @@ extern int		dev_alloc_name(struct net_de
- extern int		dev_open(struct net_device *dev);
- extern int		dev_close(struct net_device *dev);
- extern void		dev_disable_lro(struct net_device *dev);
-+extern struct netdev_queue *dev_pick_tx(struct net_device *dev, struct sk_buff *skb);
- extern int		dev_queue_xmit(struct sk_buff *skb);
- extern int		register_netdevice(struct net_device *dev);
- extern void		unregister_netdevice_queue(struct net_device *dev,
---- /dev/null
-+++ b/include/linux/netfilter/xt_IMQ.h
-@@ -0,0 +1,9 @@
-+#ifndef _XT_IMQ_H
-+#define _XT_IMQ_H
-+
-+struct xt_imq_info {
-+	unsigned int todev;     /* target imq device */
-+};
-+
-+#endif /* _XT_IMQ_H */
-+
---- /dev/null
-+++ b/include/linux/netfilter_ipv4/ipt_IMQ.h
-@@ -0,0 +1,10 @@
-+#ifndef _IPT_IMQ_H
-+#define _IPT_IMQ_H
-+
-+/* Backwards compatibility for old userspace */
-+#include <linux/netfilter/xt_IMQ.h>
-+
-+#define ipt_imq_info xt_imq_info
-+
-+#endif /* _IPT_IMQ_H */
-+
---- /dev/null
-+++ b/include/linux/netfilter_ipv6/ip6t_IMQ.h
-@@ -0,0 +1,10 @@
-+#ifndef _IP6T_IMQ_H
-+#define _IP6T_IMQ_H
-+
-+/* Backwards compatibility for old userspace */
-+#include <linux/netfilter/xt_IMQ.h>
-+
-+#define ip6t_imq_info xt_imq_info
-+
-+#endif /* _IP6T_IMQ_H */
-+
---- a/include/linux/skbuff.h
-+++ b/include/linux/skbuff.h
-@@ -29,6 +29,9 @@
- #include <linux/rcupdate.h>
- #include <linux/dmaengine.h>
- #include <linux/hrtimer.h>
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+#include <linux/imq.h>
-+#endif
- 
- /* Don't change this without changing skb_csum_unnecessary! */
- #define CHECKSUM_NONE 0
-@@ -323,6 +326,10 @@ struct sk_buff {
- 	char			cb[48] __aligned(8);
- 
- 	unsigned long		_skb_dst;
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	void			*cb_next;
-+#endif
-+
- #ifdef CONFIG_XFRM
- 	struct	sec_path	*sp;
- #endif
-@@ -357,6 +364,9 @@ struct sk_buff {
- 	struct nf_conntrack	*nfct;
- 	struct sk_buff		*nfct_reasm;
- #endif
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	struct nf_queue_entry	*nf_queue_entry;
-+#endif
- #ifdef CONFIG_BRIDGE_NETFILTER
- 	struct nf_bridge_info	*nf_bridge;
- #endif
-@@ -378,6 +388,10 @@ struct sk_buff {
- 
- 	/* 0/14 bit hole */
- 
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	__u8			imq_flags:IMQ_F_BITS;
-+#endif
-+
- #ifdef CONFIG_NET_DMA
- 	dma_cookie_t		dma_cookie;
- #endif
-@@ -426,6 +440,12 @@ static inline struct rtable *skb_rtable(
- 	return (struct rtable *)skb_dst(skb);
- }
- 
-+
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+extern int skb_save_cb(struct sk_buff *skb);
-+extern int skb_restore_cb(struct sk_buff *skb);
-+#endif
-+
- extern void kfree_skb(struct sk_buff *skb);
- extern void consume_skb(struct sk_buff *skb);
- extern void	       __kfree_skb(struct sk_buff *skb);
-@@ -1970,6 +1990,10 @@ static inline void __nf_copy(struct sk_b
- 	dst->nfct_reasm = src->nfct_reasm;
- 	nf_conntrack_get_reasm(src->nfct_reasm);
- #endif
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	dst->imq_flags = src->imq_flags;
-+	dst->nf_queue_entry = src->nf_queue_entry;
-+#endif
- #ifdef CONFIG_BRIDGE_NETFILTER
- 	dst->nf_bridge  = src->nf_bridge;
- 	nf_bridge_get(src->nf_bridge);
---- a/include/net/netfilter/nf_queue.h
-+++ b/include/net/netfilter/nf_queue.h
-@@ -13,6 +13,12 @@ struct nf_queue_entry {
- 	struct net_device	*indev;
- 	struct net_device	*outdev;
- 	int			(*okfn)(struct sk_buff *);
-+
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	int			(*next_outfn)(struct nf_queue_entry *entry,
-+					      unsigned int queuenum);
-+	unsigned int		next_queuenum;
-+#endif
- };
- 
- #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry))
-@@ -30,5 +36,11 @@ extern int nf_unregister_queue_handler(u
- 				       const struct nf_queue_handler *qh);
- extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh);
- extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
-+extern void nf_queue_entry_release_refs(struct nf_queue_entry *entry);
-+
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+extern void nf_register_queue_imq_handler(const struct nf_queue_handler *qh);
-+extern void nf_unregister_queue_imq_handler(void);
-+#endif
- 
- #endif /* _NF_QUEUE_H */
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -97,6 +97,9 @@
- #include <net/net_namespace.h>
- #include <net/sock.h>
- #include <linux/rtnetlink.h>
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+#include <linux/imq.h>
-+#endif
- #include <linux/proc_fs.h>
- #include <linux/seq_file.h>
- #include <linux/stat.h>
-@@ -1810,7 +1813,11 @@ int dev_hard_start_xmit(struct sk_buff *
- 	int rc = NETDEV_TX_OK;
- 
- 	if (likely(!skb->next)) {
--		if (!list_empty(&ptype_all))
-+		if (!list_empty(&ptype_all)
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+		    && !(skb->imq_flags & IMQ_F_ENQUEUE)
-+#endif
-+		    )
- 			dev_queue_xmit_nit(skb, dev);
- 
- 		if (netif_needs_gso(dev, skb)) {
-@@ -1912,8 +1919,7 @@ static inline u16 dev_cap_txqueue(struct
- 	return queue_index;
- }
- 
--static struct netdev_queue *dev_pick_tx(struct net_device *dev,
--					struct sk_buff *skb)
-+struct netdev_queue *dev_pick_tx(struct net_device *dev, struct sk_buff *skb)
- {
- 	int queue_index;
- 	struct sock *sk = skb->sk;
-@@ -1938,6 +1944,7 @@ static struct netdev_queue *dev_pick_tx(
- 	skb_set_queue_mapping(skb, queue_index);
- 	return netdev_get_tx_queue(dev, queue_index);
- }
-+EXPORT_SYMBOL(dev_pick_tx);
- 
- static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
- 				 struct net_device *dev,
---- a/net/core/skbuff.c
-+++ b/net/core/skbuff.c
-@@ -72,6 +72,9 @@
- 
- static struct kmem_cache *skbuff_head_cache __read_mostly;
- static struct kmem_cache *skbuff_fclone_cache __read_mostly;
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+static struct kmem_cache *skbuff_cb_store_cache __read_mostly;
-+#endif
- 
- static void sock_pipe_buf_release(struct pipe_inode_info *pipe,
- 				  struct pipe_buffer *buf)
-@@ -91,6 +94,83 @@ static int sock_pipe_buf_steal(struct pi
- 	return 1;
- }
- 
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+/* Control buffer save/restore for IMQ devices */
-+struct skb_cb_table {
-+	void			*cb_next;
-+	atomic_t		refcnt;
-+	char      		cb[48];
-+};
-+
-+static DEFINE_SPINLOCK(skb_cb_store_lock);
-+
-+int skb_save_cb(struct sk_buff *skb)
-+{
-+	struct skb_cb_table *next;
-+
-+	next = kmem_cache_alloc(skbuff_cb_store_cache, GFP_ATOMIC);
-+	if (!next)
-+		return -ENOMEM;
-+
-+	BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb));
-+
-+	memcpy(next->cb, skb->cb, sizeof(skb->cb));
-+	next->cb_next = skb->cb_next;
-+
-+	atomic_set(&next->refcnt, 1);
-+
-+	skb->cb_next = next;
-+	return 0;
-+}
-+EXPORT_SYMBOL(skb_save_cb);
-+
-+int skb_restore_cb(struct sk_buff *skb)
-+{
-+	struct skb_cb_table *next;
-+
-+	if (!skb->cb_next)
-+		return 0;
-+
-+	next = skb->cb_next;
-+
-+	BUILD_BUG_ON(sizeof(skb->cb) != sizeof(next->cb));
-+
-+	memcpy(skb->cb, next->cb, sizeof(skb->cb));
-+	skb->cb_next = next->cb_next;
-+
-+	spin_lock(&skb_cb_store_lock);
-+
-+	if (atomic_dec_and_test(&next->refcnt)) {
-+		kmem_cache_free(skbuff_cb_store_cache, next);
-+	}
-+
-+	spin_unlock(&skb_cb_store_lock);
-+
-+	return 0;
-+}
-+EXPORT_SYMBOL(skb_restore_cb);
-+
-+static void skb_copy_stored_cb(struct sk_buff *new, const struct sk_buff *__old)
-+{
-+	struct skb_cb_table *next;
-+	struct sk_buff *old;
-+
-+	if (!__old->cb_next) {
-+		new->cb_next = NULL;
-+		return;
-+	}
-+
-+	spin_lock(&skb_cb_store_lock);
-+
-+	old = (struct sk_buff *)__old;
-+
-+	next = old->cb_next;
-+	atomic_inc(&next->refcnt);
-+	new->cb_next = next;
-+
-+	spin_unlock(&skb_cb_store_lock);
-+}
-+#endif
- 
- /* Pipe buffer operations for a socket. */
- static const struct pipe_buf_operations sock_pipe_buf_ops = {
-@@ -398,6 +478,26 @@ static void skb_release_head_state(struc
- 		WARN_ON(in_irq());
- 		skb->destructor(skb);
- 	}
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	/* This should not happen. When it does, avoid memleak by restoring
-+	the chain of cb-backups. */
-+	while(skb->cb_next != NULL) {
-+		if (net_ratelimit())
-+			printk(KERN_WARNING "IMQ: kfree_skb: skb->cb_next: "
-+				"%08x\n", (unsigned int)skb->cb_next);
-+
-+		skb_restore_cb(skb);
-+	}
-+	/* This should not happen either, nf_queue_entry is nullified in
-+	 * imq_dev_xmit(). If we have non-NULL nf_queue_entry then we are
-+	 * leaking entry pointers, maybe memory. We don't know if this is
-+	 * pointer to already freed memory, or should this be freed.
-+	 * If this happens we need to add refcounting, etc for nf_queue_entry.
-+	 */
-+	if (skb->nf_queue_entry && net_ratelimit())
-+		printk(KERN_WARNING
-+				"IMQ: kfree_skb: skb->nf_queue_entry != NULL");
-+#endif
- #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
- 	nf_conntrack_put(skb->nfct);
- 	nf_conntrack_put_reasm(skb->nfct_reasm);
-@@ -538,6 +638,9 @@ static void __copy_skb_header(struct sk_
- 	new->sp			= secpath_get(old->sp);
- #endif
- 	memcpy(new->cb, old->cb, sizeof(old->cb));
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	skb_copy_stored_cb(new, old);
-+#endif
- 	new->csum		= old->csum;
- 	new->local_df		= old->local_df;
- 	new->pkt_type		= old->pkt_type;
-@@ -2780,6 +2883,13 @@ void __init skb_init(void)
- 						0,
- 						SLAB_HWCACHE_ALIGN|SLAB_PANIC,
- 						NULL);
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	skbuff_cb_store_cache = kmem_cache_create("skbuff_cb_store_cache",
-+						  sizeof(struct skb_cb_table),
-+						  0,
-+						  SLAB_HWCACHE_ALIGN|SLAB_PANIC,
-+						  NULL);
-+#endif
- }
- 
- /**
---- a/net/netfilter/Kconfig
-+++ b/net/netfilter/Kconfig
-@@ -396,6 +396,18 @@ config NETFILTER_XT_TARGET_LED
- 	  For more information on the LEDs available on your system, see
- 	  Documentation/leds-class.txt
- 
-+config NETFILTER_XT_TARGET_IMQ
-+        tristate '"IMQ" target support'
-+	depends on NETFILTER_XTABLES
-+	depends on IP_NF_MANGLE || IP6_NF_MANGLE
-+	select IMQ
-+	default m if NETFILTER_ADVANCED=n
-+        help
-+          This option adds a `IMQ' target which is used to specify if and
-+          to which imq device packets should get enqueued/dequeued.
-+
-+          To compile it as a module, choose M here.  If unsure, say N.
-+
- config NETFILTER_XT_TARGET_MARK
- 	tristate '"MARK" target support'
- 	default m if NETFILTER_ADVANCED=n
---- a/net/netfilter/Makefile
-+++ b/net/netfilter/Makefile
-@@ -46,6 +46,7 @@ obj-$(CONFIG_NETFILTER_XT_TARGET_CONNMAR
- obj-$(CONFIG_NETFILTER_XT_TARGET_CONNSECMARK) += xt_CONNSECMARK.o
- obj-$(CONFIG_NETFILTER_XT_TARGET_DSCP) += xt_DSCP.o
- obj-$(CONFIG_NETFILTER_XT_TARGET_HL) += xt_HL.o
-+obj-$(CONFIG_NETFILTER_XT_TARGET_IMQ) += xt_IMQ.o
- obj-$(CONFIG_NETFILTER_XT_TARGET_LED) += xt_LED.o
- obj-$(CONFIG_NETFILTER_XT_TARGET_MARK) += xt_MARK.o
- obj-$(CONFIG_NETFILTER_XT_TARGET_NFLOG) += xt_NFLOG.o
---- a/net/netfilter/nf_queue.c
-+++ b/net/netfilter/nf_queue.c
-@@ -20,6 +20,26 @@ static const struct nf_queue_handler *qu
- 
- static DEFINE_MUTEX(queue_handler_mutex);
- 
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+static const struct nf_queue_handler *queue_imq_handler;
-+
-+void nf_register_queue_imq_handler(const struct nf_queue_handler *qh)
-+{
-+	mutex_lock(&queue_handler_mutex);
-+	rcu_assign_pointer(queue_imq_handler, qh);
-+	mutex_unlock(&queue_handler_mutex);
-+}
-+EXPORT_SYMBOL(nf_register_queue_imq_handler);
-+
-+void nf_unregister_queue_imq_handler(void)
-+{
-+	mutex_lock(&queue_handler_mutex);
-+	rcu_assign_pointer(queue_imq_handler, NULL);
-+	mutex_unlock(&queue_handler_mutex);
-+}
-+EXPORT_SYMBOL(nf_unregister_queue_imq_handler);
-+#endif
-+
- /* return EBUSY when somebody else is registered, return EEXIST if the
-  * same handler is registered, return 0 in case of success. */
- int nf_register_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
-@@ -80,7 +100,7 @@ void nf_unregister_queue_handlers(const
- }
- EXPORT_SYMBOL_GPL(nf_unregister_queue_handlers);
- 
--static void nf_queue_entry_release_refs(struct nf_queue_entry *entry)
-+void nf_queue_entry_release_refs(struct nf_queue_entry *entry)
- {
- 	/* Release those devices we held, or Alexey will kill me. */
- 	if (entry->indev)
-@@ -100,6 +120,7 @@ static void nf_queue_entry_release_refs(
- 	/* Drop reference to owner of hook which queued us. */
- 	module_put(entry->elem->owner);
- }
-+EXPORT_SYMBOL_GPL(nf_queue_entry_release_refs);
- 
- /*
-  * Any packet that leaves via this function must come back
-@@ -121,12 +142,26 @@ static int __nf_queue(struct sk_buff *sk
- #endif
- 	const struct nf_afinfo *afinfo;
- 	const struct nf_queue_handler *qh;
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	const struct nf_queue_handler *qih = NULL;
-+#endif
- 
- 	/* QUEUE == DROP if noone is waiting, to be safe. */
- 	rcu_read_lock();
- 
- 	qh = rcu_dereference(queue_handler[pf]);
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-+	if (pf == PF_INET || pf == PF_INET6)
-+#else
-+	if (pf == PF_INET)
-+#endif
-+		qih = rcu_dereference(queue_imq_handler);
-+
-+	if (!qh && !qih)
-+#else /* !IMQ */
- 	if (!qh)
-+#endif
- 		goto err_unlock;
- 
- 	afinfo = nf_get_afinfo(pf);
-@@ -145,6 +180,10 @@ static int __nf_queue(struct sk_buff *sk
- 		.indev	= indev,
- 		.outdev	= outdev,
- 		.okfn	= okfn,
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+		.next_outfn = qh ? qh->outfn : NULL,
-+		.next_queuenum = queuenum,
-+#endif
- 	};
- 
- 	/* If it's going away, ignore hook. */
-@@ -170,8 +209,19 @@ static int __nf_queue(struct sk_buff *sk
- 	}
- #endif
- 	afinfo->saveroute(skb, entry);
-+
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+	if (qih) {
-+		status = qih->outfn(entry, queuenum);
-+		goto imq_skip_queue;
-+	}
-+#endif
-+
- 	status = qh->outfn(entry, queuenum);
- 
-+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
-+imq_skip_queue:
-+#endif
- 	rcu_read_unlock();
- 
- 	if (status < 0) {
---- /dev/null
-+++ b/net/netfilter/xt_IMQ.c
-@@ -0,0 +1,73 @@
-+/*
-+ * This target marks packets to be enqueued to an imq device
-+ */
-+#include <linux/module.h>
-+#include <linux/skbuff.h>
-+#include <linux/netfilter/x_tables.h>
-+#include <linux/netfilter/xt_IMQ.h>
-+#include <linux/imq.h>
-+
-+static unsigned int imq_target(struct sk_buff *pskb,
-+				const struct xt_target_param *par)
-+{
-+	const struct xt_imq_info *mr = par->targinfo;
-+
-+	pskb->imq_flags = (mr->todev & IMQ_F_IFMASK) | IMQ_F_ENQUEUE;
-+
-+	return XT_CONTINUE;
-+}
-+
-+static bool imq_checkentry(const struct xt_tgchk_param *par)
-+{
-+	struct xt_imq_info *mr = par->targinfo;
-+
-+	if (mr->todev > IMQ_MAX_DEVS - 1) {
-+		printk(KERN_WARNING
-+		       "IMQ: invalid device specified, highest is %u\n",
-+		       IMQ_MAX_DEVS - 1);
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+
-+static struct xt_target xt_imq_reg[] __read_mostly = {
-+	{
-+		.name           = "IMQ",
-+		.family		= AF_INET,
-+		.checkentry     = imq_checkentry,
-+		.target         = imq_target,
-+		.targetsize	= sizeof(struct xt_imq_info),
-+		.table		= "mangle",
-+		.me             = THIS_MODULE
-+	},
-+	{
-+		.name           = "IMQ",
-+		.family		= AF_INET6,
-+		.checkentry     = imq_checkentry,
-+		.target         = imq_target,
-+		.targetsize	= sizeof(struct xt_imq_info),
-+		.table		= "mangle",
-+		.me             = THIS_MODULE
-+	},
-+};
-+
-+static int __init imq_init(void)
-+{
-+	return xt_register_targets(xt_imq_reg, ARRAY_SIZE(xt_imq_reg));
-+}
-+
-+static void __exit imq_fini(void)
-+{
-+	xt_unregister_targets(xt_imq_reg, ARRAY_SIZE(xt_imq_reg));
-+}
-+
-+module_init(imq_init);
-+module_exit(imq_fini);
-+
-+MODULE_AUTHOR("http://www.linuximq.net");
-+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
-+MODULE_LICENSE("GPL");
-+MODULE_ALIAS("ipt_IMQ");
-+MODULE_ALIAS("ip6t_IMQ");
-+

+ 0 - 18
target/linux/generic/patches-2.6.33/180-netfilter_depends.patch

@@ -1,18 +0,0 @@
---- a/net/netfilter/Kconfig
-+++ b/net/netfilter/Kconfig
-@@ -160,7 +160,6 @@ config NF_CONNTRACK_FTP
- 
- config NF_CONNTRACK_H323
- 	tristate "H.323 protocol support"
--	depends on (IPV6 || IPV6=n)
- 	depends on NETFILTER_ADVANCED
- 	help
- 	  H.323 is a VoIP signalling protocol from ITU-T. As one of the most
-@@ -505,7 +504,6 @@ config NETFILTER_XT_TARGET_SECMARK
- 
- config NETFILTER_XT_TARGET_TCPMSS
- 	tristate '"TCPMSS" target support'
--	depends on (IPV6 || IPV6=n)
- 	default m if NETFILTER_ADVANCED=n
- 	---help---
- 	  This option adds a `TCPMSS' target, which allows you to alter the

+ 0 - 1366
target/linux/generic/patches-2.6.33/190-netfilter_rtsp.patch

@@ -1,1366 +0,0 @@
---- /dev/null
-+++ b/include/linux/netfilter/nf_conntrack_rtsp.h
-@@ -0,0 +1,63 @@
-+/*
-+ * RTSP extension for IP connection tracking.
-+ * (C) 2003 by Tom Marshall <tmarshall at real.com>
-+ * based on ip_conntrack_irc.h
-+ *
-+ *      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.
-+ */
-+#ifndef _IP_CONNTRACK_RTSP_H
-+#define _IP_CONNTRACK_RTSP_H
-+
-+//#define IP_NF_RTSP_DEBUG 1
-+#define IP_NF_RTSP_VERSION "0.6.21"
-+
-+#ifdef __KERNEL__
-+/* port block types */
-+typedef enum {
-+    pb_single,  /* client_port=x */
-+    pb_range,   /* client_port=x-y */
-+    pb_discon   /* client_port=x/y (rtspbis) */
-+} portblock_t;
-+
-+/* We record seq number and length of rtsp headers here, all in host order. */
-+
-+/*
-+ * This structure is per expected connection.  It is a member of struct
-+ * ip_conntrack_expect.  The TCP SEQ for the conntrack expect is stored
-+ * there and we are expected to only store the length of the data which
-+ * needs replaced.  If a packet contains multiple RTSP messages, we create
-+ * one expected connection per message.
-+ *
-+ * We use these variables to mark the entire header block.  This may seem
-+ * like overkill, but the nature of RTSP requires it.  A header may appear
-+ * multiple times in a message.  We must treat two Transport headers the
-+ * same as one Transport header with two entries.
-+ */
-+struct ip_ct_rtsp_expect
-+{
-+    u_int32_t   len;        /* length of header block */
-+    portblock_t pbtype;     /* Type of port block that was requested */
-+    u_int16_t   loport;     /* Port that was requested, low or first */
-+    u_int16_t   hiport;     /* Port that was requested, high or second */
-+#if 0
-+    uint        method;     /* RTSP method */
-+    uint        cseq;       /* CSeq from request */
-+#endif
-+};
-+
-+extern unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
-+				 enum ip_conntrack_info ctinfo,
-+				 unsigned int matchoff, unsigned int matchlen,
-+				 struct ip_ct_rtsp_expect *prtspexp,
-+				 struct nf_conntrack_expect *exp);
-+
-+extern void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
-+
-+#define RTSP_PORT   554
-+
-+#endif /* __KERNEL__ */
-+
-+#endif /* _IP_CONNTRACK_RTSP_H */
---- /dev/null
-+++ b/include/linux/netfilter_helpers.h
-@@ -0,0 +1,133 @@
-+/*
-+ * Helpers for netfiler modules.  This file provides implementations for basic
-+ * functions such as strncasecmp(), etc.
-+ *
-+ * gcc will warn for defined but unused functions, so we only include the
-+ * functions requested.  The following macros are used:
-+ *   NF_NEED_STRNCASECMP        nf_strncasecmp()
-+ *   NF_NEED_STRTOU16           nf_strtou16()
-+ *   NF_NEED_STRTOU32           nf_strtou32()
-+ */
-+#ifndef _NETFILTER_HELPERS_H
-+#define _NETFILTER_HELPERS_H
-+
-+/* Only include these functions for kernel code. */
-+#ifdef __KERNEL__
-+
-+#include <linux/ctype.h>
-+#define iseol(c) ( (c) == '\r' || (c) == '\n' )
-+
-+/*
-+ * The standard strncasecmp()
-+ */
-+#ifdef NF_NEED_STRNCASECMP
-+static int
-+nf_strncasecmp(const char* s1, const char* s2, u_int32_t len)
-+{
-+    if (s1 == NULL || s2 == NULL)
-+    {
-+        if (s1 == NULL && s2 == NULL)
-+        {
-+            return 0;
-+        }
-+        return (s1 == NULL) ? -1 : 1;
-+    }
-+    while (len > 0 && tolower(*s1) == tolower(*s2))
-+    {
-+        len--;
-+        s1++;
-+        s2++;
-+    }
-+    return ( (len == 0) ? 0 : (tolower(*s1) - tolower(*s2)) );
-+}
-+#endif /* NF_NEED_STRNCASECMP */
-+
-+/*
-+ * Parse a string containing a 16-bit unsigned integer.
-+ * Returns the number of chars used, or zero if no number is found.
-+ */
-+#ifdef NF_NEED_STRTOU16
-+static int
-+nf_strtou16(const char* pbuf, u_int16_t* pval)
-+{
-+    int n = 0;
-+
-+    *pval = 0;
-+    while (isdigit(pbuf[n]))
-+    {
-+        *pval = (*pval * 10) + (pbuf[n] - '0');
-+        n++;
-+    }
-+
-+    return n;
-+}
-+#endif /* NF_NEED_STRTOU16 */
-+
-+/*
-+ * Parse a string containing a 32-bit unsigned integer.
-+ * Returns the number of chars used, or zero if no number is found.
-+ */
-+#ifdef NF_NEED_STRTOU32
-+static int
-+nf_strtou32(const char* pbuf, u_int32_t* pval)
-+{
-+    int n = 0;
-+
-+    *pval = 0;
-+    while (pbuf[n] >= '0' && pbuf[n] <= '9')
-+    {
-+        *pval = (*pval * 10) + (pbuf[n] - '0');
-+        n++;
-+    }
-+
-+    return n;
-+}
-+#endif /* NF_NEED_STRTOU32 */
-+
-+/*
-+ * Given a buffer and length, advance to the next line and mark the current
-+ * line.
-+ */
-+#ifdef NF_NEED_NEXTLINE
-+static int
-+nf_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
-+{
-+    uint    off = *poff;
-+    uint    physlen = 0;
-+
-+    if (off >= len)
-+    {
-+        return 0;
-+    }
-+
-+    while (p[off] != '\n')
-+    {
-+        if (len-off <= 1)
-+        {
-+            return 0;
-+        }
-+
-+        physlen++;
-+        off++;
-+    }
-+
-+    /* if we saw a crlf, physlen needs adjusted */
-+    if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
-+    {
-+        physlen--;
-+    }
-+
-+    /* advance past the newline */
-+    off++;
-+
-+    *plineoff = *poff;
-+    *plinelen = physlen;
-+    *poff = off;
-+
-+    return 1;
-+}
-+#endif /* NF_NEED_NEXTLINE */
-+
-+#endif /* __KERNEL__ */
-+
-+#endif /* _NETFILTER_HELPERS_H */
---- /dev/null
-+++ b/include/linux/netfilter_mime.h
-@@ -0,0 +1,89 @@
-+/*
-+ * MIME functions for netfilter modules.  This file provides implementations
-+ * for basic MIME parsing.  MIME headers are used in many protocols, such as
-+ * HTTP, RTSP, SIP, etc.
-+ *
-+ * gcc will warn for defined but unused functions, so we only include the
-+ * functions requested.  The following macros are used:
-+ *   NF_NEED_MIME_NEXTLINE      nf_mime_nextline()
-+ */
-+#ifndef _NETFILTER_MIME_H
-+#define _NETFILTER_MIME_H
-+
-+/* Only include these functions for kernel code. */
-+#ifdef __KERNEL__
-+
-+#include <linux/ctype.h>
-+
-+/*
-+ * Given a buffer and length, advance to the next line and mark the current
-+ * line.  If the current line is empty, *plinelen will be set to zero.  If
-+ * not, it will be set to the actual line length (including CRLF).
-+ *
-+ * 'line' in this context means logical line (includes LWS continuations).
-+ * Returns 1 on success, 0 on failure.
-+ */
-+#ifdef NF_NEED_MIME_NEXTLINE
-+static int
-+nf_mime_nextline(char* p, uint len, uint* poff, uint* plineoff, uint* plinelen)
-+{
-+    uint    off = *poff;
-+    uint    physlen = 0;
-+    int     is_first_line = 1;
-+
-+    if (off >= len)
-+    {
-+        return 0;
-+    }
-+
-+    do
-+    {
-+        while (p[off] != '\n')
-+        {
-+            if (len-off <= 1)
-+            {
-+                return 0;
-+            }
-+
-+            physlen++;
-+            off++;
-+        }
-+
-+        /* if we saw a crlf, physlen needs adjusted */
-+        if (physlen > 0 && p[off] == '\n' && p[off-1] == '\r')
-+        {
-+            physlen--;
-+        }
-+
-+        /* advance past the newline */
-+        off++;
-+
-+        /* check for an empty line */
-+        if (physlen == 0)
-+        {
-+            break;
-+        }
-+
-+        /* check for colon on the first physical line */
-+        if (is_first_line)
-+        {
-+            is_first_line = 0;
-+            if (memchr(p+(*poff), ':', physlen) == NULL)
-+            {
-+                return 0;
-+            }
-+        }
-+    }
-+    while (p[off] == ' ' || p[off] == '\t');
-+
-+    *plineoff = *poff;
-+    *plinelen = (physlen == 0) ? 0 : (off - *poff);
-+    *poff = off;
-+
-+    return 1;
-+}
-+#endif /* NF_NEED_MIME_NEXTLINE */
-+
-+#endif /* __KERNEL__ */
-+
-+#endif /* _NETFILTER_MIME_H */
---- a/net/ipv4/netfilter/Makefile
-+++ b/net/ipv4/netfilter/Makefile
-@@ -26,6 +26,7 @@ obj-$(CONFIG_NF_NAT_AMANDA) += nf_nat_am
- obj-$(CONFIG_NF_NAT_FTP) += nf_nat_ftp.o
- obj-$(CONFIG_NF_NAT_H323) += nf_nat_h323.o
- obj-$(CONFIG_NF_NAT_IRC) += nf_nat_irc.o
-+obj-$(CONFIG_NF_NAT_RTSP) += nf_nat_rtsp.o
- obj-$(CONFIG_NF_NAT_PPTP) += nf_nat_pptp.o
- obj-$(CONFIG_NF_NAT_SIP) += nf_nat_sip.o
- obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o
---- a/net/netfilter/Kconfig
-+++ b/net/netfilter/Kconfig
-@@ -267,6 +267,16 @@ config NF_CONNTRACK_TFTP
- 
- 	  To compile it as a module, choose M here.  If unsure, say N.
- 
-+config NF_CONNTRACK_RTSP
-+	tristate "RTSP protocol support"
-+	depends on NF_CONNTRACK
-+	help
-+		Support the RTSP protocol.  This allows UDP transports to be setup
-+		properly, including RTP and RDT.
-+
-+		If you want to compile it as a module, say 'M' here and read
-+		Documentation/modules.txt.  If unsure, say 'Y'.
-+
- config NF_CT_NETLINK
- 	tristate 'Connection tracking netlink interface'
- 	select NETFILTER_NETLINK
---- a/net/netfilter/Makefile
-+++ b/net/netfilter/Makefile
-@@ -33,6 +33,7 @@ obj-$(CONFIG_NF_CONNTRACK_PPTP) += nf_co
- obj-$(CONFIG_NF_CONNTRACK_SANE) += nf_conntrack_sane.o
- obj-$(CONFIG_NF_CONNTRACK_SIP) += nf_conntrack_sip.o
- obj-$(CONFIG_NF_CONNTRACK_TFTP) += nf_conntrack_tftp.o
-+obj-$(CONFIG_NF_CONNTRACK_RTSP) += nf_conntrack_rtsp.o
- 
- # transparent proxy support
- obj-$(CONFIG_NETFILTER_TPROXY) += nf_tproxy_core.o
---- a/net/ipv4/netfilter/Kconfig
-+++ b/net/ipv4/netfilter/Kconfig
-@@ -257,6 +257,11 @@ config NF_NAT_IRC
- 	depends on NF_CONNTRACK && NF_NAT
- 	default NF_NAT && NF_CONNTRACK_IRC
- 
-+config NF_NAT_RTSP
-+	tristate
-+ 	depends on IP_NF_IPTABLES && NF_CONNTRACK && NF_NAT
-+ 	default NF_NAT && NF_CONNTRACK_RTSP
-+
- config NF_NAT_TFTP
- 	tristate
- 	depends on NF_CONNTRACK && NF_NAT
---- /dev/null
-+++ b/net/netfilter/nf_conntrack_rtsp.c
-@@ -0,0 +1,517 @@
-+/*
-+ * RTSP extension for IP connection tracking
-+ * (C) 2003 by Tom Marshall <tmarshall at real.com>
-+ * based on ip_conntrack_irc.c
-+ *
-+ *      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.
-+ *
-+ * Module load syntax:
-+ *   insmod nf_conntrack_rtsp.o ports=port1,port2,...port<MAX_PORTS>
-+ *                              max_outstanding=n setup_timeout=secs
-+ *
-+ * If no ports are specified, the default will be port 554.
-+ *
-+ * With max_outstanding you can define the maximum number of not yet
-+ * answered SETUP requests per RTSP session (default 8).
-+ * With setup_timeout you can specify how long the system waits for
-+ * an expected data channel (default 300 seconds).
-+ *
-+ * 2005-02-13: Harald Welte <laforge at netfilter.org>
-+ * 	- port to 2.6
-+ * 	- update to recent post-2.6.11 api changes
-+ * 2006-09-14: Steven Van Acker <deepstar at singularity.be>
-+ *      - removed calls to NAT code from conntrack helper: NAT no longer needed to use rtsp-conntrack
-+ * 2007-04-18: Michael Guntsche <mike at it-loops.com>
-+ * 			- Port to new NF API
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/netfilter.h>
-+#include <linux/ip.h>
-+#include <linux/inet.h>
-+#include <net/tcp.h>
-+
-+#include <net/netfilter/nf_conntrack.h>
-+#include <net/netfilter/nf_conntrack_expect.h>
-+#include <net/netfilter/nf_conntrack_helper.h>
-+#include <linux/netfilter/nf_conntrack_rtsp.h>
-+
-+#define NF_NEED_STRNCASECMP
-+#define NF_NEED_STRTOU16
-+#define NF_NEED_STRTOU32
-+#define NF_NEED_NEXTLINE
-+#include <linux/netfilter_helpers.h>
-+#define NF_NEED_MIME_NEXTLINE
-+#include <linux/netfilter_mime.h>
-+
-+#include <linux/ctype.h>
-+#define MAX_SIMUL_SETUP 8 /* XXX: use max_outstanding */
-+#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
-+#if 0
-+#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
-+#else
-+#define DEBUGP(fmt, args...)
-+#endif
-+
-+#define MAX_PORTS 8
-+static int ports[MAX_PORTS];
-+static int num_ports = 0;
-+static int max_outstanding = 8;
-+static unsigned int setup_timeout = 300;
-+
-+MODULE_AUTHOR("Tom Marshall <tmarshall at real.com>");
-+MODULE_DESCRIPTION("RTSP connection tracking module");
-+MODULE_LICENSE("GPL");
-+module_param_array(ports, int, &num_ports, 0400);
-+MODULE_PARM_DESC(ports, "port numbers of RTSP servers");
-+module_param(max_outstanding, int, 0400);
-+MODULE_PARM_DESC(max_outstanding, "max number of outstanding SETUP requests per RTSP session");
-+module_param(setup_timeout, int, 0400);
-+MODULE_PARM_DESC(setup_timeout, "timeout on for unestablished data channels");
-+
-+static char *rtsp_buffer;
-+static DEFINE_SPINLOCK(rtsp_buffer_lock);
-+
-+unsigned int (*nf_nat_rtsp_hook)(struct sk_buff *skb,
-+				 enum ip_conntrack_info ctinfo,
-+				 unsigned int matchoff, unsigned int matchlen,struct ip_ct_rtsp_expect* prtspexp,
-+				 struct nf_conntrack_expect *exp);
-+void (*nf_nat_rtsp_hook_expectfn)(struct nf_conn *ct, struct nf_conntrack_expect *exp);
-+
-+EXPORT_SYMBOL_GPL(nf_nat_rtsp_hook);
-+
-+/*
-+ * Max mappings we will allow for one RTSP connection (for RTP, the number
-+ * of allocated ports is twice this value).  Note that SMIL burns a lot of
-+ * ports so keep this reasonably high.  If this is too low, you will see a
-+ * lot of "no free client map entries" messages.
-+ */
-+#define MAX_PORT_MAPS 16
-+
-+/*** default port list was here in the masq code: 554, 3030, 4040 ***/
-+
-+#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
-+
-+/*
-+ * Parse an RTSP packet.
-+ *
-+ * Returns zero if parsing failed.
-+ *
-+ * Parameters:
-+ *  IN      ptcp        tcp data pointer
-+ *  IN      tcplen      tcp data len
-+ *  IN/OUT  ptcpoff     points to current tcp offset
-+ *  OUT     phdrsoff    set to offset of rtsp headers
-+ *  OUT     phdrslen    set to length of rtsp headers
-+ *  OUT     pcseqoff    set to offset of CSeq header
-+ *  OUT     pcseqlen    set to length of CSeq header
-+ */
-+static int
-+rtsp_parse_message(char* ptcp, uint tcplen, uint* ptcpoff,
-+                   uint* phdrsoff, uint* phdrslen,
-+                   uint* pcseqoff, uint* pcseqlen,
-+                   uint* transoff, uint* translen)
-+{
-+	uint    entitylen = 0;
-+	uint    lineoff;
-+	uint    linelen;
-+
-+	if (!nf_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen))
-+		return 0;
-+
-+	*phdrsoff = *ptcpoff;
-+	while (nf_mime_nextline(ptcp, tcplen, ptcpoff, &lineoff, &linelen)) {
-+		if (linelen == 0) {
-+			if (entitylen > 0)
-+				*ptcpoff += min(entitylen, tcplen - *ptcpoff);
-+			break;
-+		}
-+		if (lineoff+linelen > tcplen) {
-+			INFOP("!! overrun !!\n");
-+			break;
-+		}
-+
-+		if (nf_strncasecmp(ptcp+lineoff, "CSeq:", 5) == 0) {
-+			*pcseqoff = lineoff;
-+			*pcseqlen = linelen;
-+		}
-+
-+		if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0) {
-+			*transoff = lineoff;
-+			*translen = linelen;
-+		}
-+
-+		if (nf_strncasecmp(ptcp+lineoff, "Content-Length:", 15) == 0) {
-+			uint off = lineoff+15;
-+			SKIP_WSPACE(ptcp+lineoff, linelen, off);
-+			nf_strtou32(ptcp+off, &entitylen);
-+		}
-+	}
-+	*phdrslen = (*ptcpoff) - (*phdrsoff);
-+
-+	return 1;
-+}
-+
-+/*
-+ * Find lo/hi client ports (if any) in transport header
-+ * In:
-+ *   ptcp, tcplen = packet
-+ *   tranoff, tranlen = buffer to search
-+ *
-+ * Out:
-+ *   pport_lo, pport_hi = lo/hi ports (host endian)
-+ *
-+ * Returns nonzero if any client ports found
-+ *
-+ * Note: it is valid (and expected) for the client to request multiple
-+ * transports, so we need to parse the entire line.
-+ */
-+static int
-+rtsp_parse_transport(char* ptran, uint tranlen,
-+                     struct ip_ct_rtsp_expect* prtspexp)
-+{
-+	int     rc = 0;
-+	uint    off = 0;
-+
-+	if (tranlen < 10 || !iseol(ptran[tranlen-1]) ||
-+	    nf_strncasecmp(ptran, "Transport:", 10) != 0) {
-+		INFOP("sanity check failed\n");
-+		return 0;
-+	}
-+
-+	DEBUGP("tran='%.*s'\n", (int)tranlen, ptran);
-+	off += 10;
-+	SKIP_WSPACE(ptran, tranlen, off);
-+
-+	/* Transport: tran;field;field=val,tran;field;field=val,... */
-+	while (off < tranlen) {
-+		const char* pparamend;
-+		uint        nextparamoff;
-+
-+		pparamend = memchr(ptran+off, ',', tranlen-off);
-+		pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
-+		nextparamoff = pparamend-ptran;
-+
-+		while (off < nextparamoff) {
-+			const char* pfieldend;
-+			uint        nextfieldoff;
-+
-+			pfieldend = memchr(ptran+off, ';', nextparamoff-off);
-+			nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
-+
-+			if (strncmp(ptran+off, "client_port=", 12) == 0) {
-+				u_int16_t   port;
-+				uint        numlen;
-+
-+				off += 12;
-+				numlen = nf_strtou16(ptran+off, &port);
-+				off += numlen;
-+				if (prtspexp->loport != 0 && prtspexp->loport != port)
-+					DEBUGP("multiple ports found, port %hu ignored\n", port);
-+				else {
-+					DEBUGP("lo port found : %hu\n", port);
-+					prtspexp->loport = prtspexp->hiport = port;
-+					if (ptran[off] == '-') {
-+						off++;
-+						numlen = nf_strtou16(ptran+off, &port);
-+						off += numlen;
-+						prtspexp->pbtype = pb_range;
-+						prtspexp->hiport = port;
-+
-+						// If we have a range, assume rtp:
-+						// loport must be even, hiport must be loport+1
-+						if ((prtspexp->loport & 0x0001) != 0 ||
-+						    prtspexp->hiport != prtspexp->loport+1) {
-+							DEBUGP("incorrect range: %hu-%hu, correcting\n",
-+							       prtspexp->loport, prtspexp->hiport);
-+							prtspexp->loport &= 0xfffe;
-+							prtspexp->hiport = prtspexp->loport+1;
-+						}
-+					} else if (ptran[off] == '/') {
-+						off++;
-+						numlen = nf_strtou16(ptran+off, &port);
-+						off += numlen;
-+						prtspexp->pbtype = pb_discon;
-+						prtspexp->hiport = port;
-+					}
-+					rc = 1;
-+				}
-+			}
-+
-+			/*
-+			 * Note we don't look for the destination parameter here.
-+			 * If we are using NAT, the NAT module will handle it.  If not,
-+			 * and the client is sending packets elsewhere, the expectation
-+			 * will quietly time out.
-+			 */
-+
-+			off = nextfieldoff;
-+		}
-+
-+		off = nextparamoff;
-+	}
-+
-+	return rc;
-+}
-+
-+void expected(struct nf_conn *ct, struct nf_conntrack_expect *exp)
-+{
-+    if(nf_nat_rtsp_hook_expectfn) {
-+        nf_nat_rtsp_hook_expectfn(ct,exp);
-+    }
-+}
-+
-+/*** conntrack functions ***/
-+
-+/* outbound packet: client->server */
-+
-+static inline int
-+help_out(struct sk_buff *skb, unsigned char *rb_ptr, unsigned int datalen,
-+                struct nf_conn *ct, enum ip_conntrack_info ctinfo)
-+{
-+	struct ip_ct_rtsp_expect expinfo;
-+
-+	int dir = CTINFO2DIR(ctinfo);   /* = IP_CT_DIR_ORIGINAL */
-+	//struct  tcphdr* tcph = (void*)iph + iph->ihl * 4;
-+	//uint    tcplen = pktlen - iph->ihl * 4;
-+	char*   pdata = rb_ptr;
-+	//uint    datalen = tcplen - tcph->doff * 4;
-+	uint    dataoff = 0;
-+	int ret = NF_ACCEPT;
-+
-+	struct nf_conntrack_expect *exp;
-+
-+	__be16 be_loport;
-+
-+	memset(&expinfo, 0, sizeof(expinfo));
-+
-+	while (dataoff < datalen) {
-+		uint    cmdoff = dataoff;
-+		uint    hdrsoff = 0;
-+		uint    hdrslen = 0;
-+		uint    cseqoff = 0;
-+		uint    cseqlen = 0;
-+		uint    transoff = 0;
-+		uint    translen = 0;
-+		uint    off;
-+
-+		if (!rtsp_parse_message(pdata, datalen, &dataoff,
-+					&hdrsoff, &hdrslen,
-+					&cseqoff, &cseqlen,
-+					&transoff, &translen))
-+			break;      /* not a valid message */
-+
-+		if (strncmp(pdata+cmdoff, "SETUP ", 6) != 0)
-+			continue;   /* not a SETUP message */
-+		DEBUGP("found a setup message\n");
-+
-+		off = 0;
-+		if(translen) {
-+			rtsp_parse_transport(pdata+transoff, translen, &expinfo);
-+		}
-+
-+		if (expinfo.loport == 0) {
-+			DEBUGP("no udp transports found\n");
-+			continue;   /* no udp transports found */
-+		}
-+
-+		DEBUGP("udp transport found, ports=(%d,%hu,%hu)\n",
-+		       (int)expinfo.pbtype, expinfo.loport, expinfo.hiport);
-+
-+		exp = nf_ct_expect_alloc(ct);
-+		if (!exp) {
-+			ret = NF_DROP;
-+			goto out;
-+		}
-+
-+		be_loport = htons(expinfo.loport);
-+
-+		nf_ct_expect_init(exp, NF_CT_EXPECT_CLASS_DEFAULT,
-+			ct->tuplehash[!dir].tuple.src.l3num,
-+			&ct->tuplehash[!dir].tuple.src.u3, &ct->tuplehash[!dir].tuple.dst.u3,
-+			IPPROTO_UDP, NULL, &be_loport);
-+
-+		exp->master = ct;
-+
-+		exp->expectfn = expected;
-+		exp->flags = 0;
-+
-+		if (expinfo.pbtype == pb_range) {
-+			DEBUGP("Changing expectation mask to handle multiple ports\n");
-+			exp->mask.src.u.udp.port  = 0xfffe;
-+		}
-+
-+		DEBUGP("expect_related %u.%u.%u.%u:%u-%u.%u.%u.%u:%u\n",
-+		       NIPQUAD(exp->tuple.src.u3.ip),
-+		       ntohs(exp->tuple.src.u.udp.port),
-+		       NIPQUAD(exp->tuple.dst.u3.ip),
-+		       ntohs(exp->tuple.dst.u.udp.port));
-+
-+		if (nf_nat_rtsp_hook)
-+			/* pass the request off to the nat helper */
-+			ret = nf_nat_rtsp_hook(skb, ctinfo, hdrsoff, hdrslen, &expinfo, exp);
-+		else if (nf_ct_expect_related(exp) != 0) {
-+			INFOP("nf_ct_expect_related failed\n");
-+			ret  = NF_DROP;
-+		}
-+		nf_ct_expect_put(exp);
-+		goto out;
-+	}
-+out:
-+
-+	return ret;
-+}
-+
-+
-+static inline int
-+help_in(struct sk_buff *skb, size_t pktlen,
-+ struct nf_conn* ct, enum ip_conntrack_info ctinfo)
-+{
-+ return NF_ACCEPT;
-+}
-+
-+static int help(struct sk_buff *skb, unsigned int protoff,
-+		struct nf_conn *ct, enum ip_conntrack_info ctinfo)
-+{
-+	struct tcphdr _tcph, *th;
-+	unsigned int dataoff, datalen;
-+	char *rb_ptr;
-+	int ret = NF_DROP;
-+
-+	/* Until there's been traffic both ways, don't look in packets. */
-+	if (ctinfo != IP_CT_ESTABLISHED &&
-+	    ctinfo != IP_CT_ESTABLISHED + IP_CT_IS_REPLY) {
-+		DEBUGP("conntrackinfo = %u\n", ctinfo);
-+		return NF_ACCEPT;
-+	}
-+
-+	/* Not whole TCP header? */
-+	th = skb_header_pointer(skb, protoff, sizeof(_tcph), &_tcph);
-+
-+	if (!th)
-+		return NF_ACCEPT;
-+
-+	/* No data ? */
-+	dataoff = protoff + th->doff*4;
-+	datalen = skb->len - dataoff;
-+	if (dataoff >= skb->len)
-+		return NF_ACCEPT;
-+
-+	spin_lock_bh(&rtsp_buffer_lock);
-+	rb_ptr = skb_header_pointer(skb, dataoff,
-+				    skb->len - dataoff, rtsp_buffer);
-+	BUG_ON(rb_ptr == NULL);
-+
-+#if 0
-+	/* Checksum invalid?  Ignore. */
-+	/* FIXME: Source route IP option packets --RR */
-+	if (tcp_v4_check(tcph, tcplen, iph->saddr, iph->daddr,
-+			 csum_partial((char*)tcph, tcplen, 0)))
-+	{
-+		DEBUGP("bad csum: %p %u %u.%u.%u.%u %u.%u.%u.%u\n",
-+		       tcph, tcplen, NIPQUAD(iph->saddr), NIPQUAD(iph->daddr));
-+		return NF_ACCEPT;
-+	}
-+#endif
-+
-+	switch (CTINFO2DIR(ctinfo)) {
-+	case IP_CT_DIR_ORIGINAL:
-+		ret = help_out(skb, rb_ptr, datalen, ct, ctinfo);
-+		break;
-+	case IP_CT_DIR_REPLY:
-+		DEBUGP("IP_CT_DIR_REPLY\n");
-+		/* inbound packet: server->client */
-+		ret = NF_ACCEPT;
-+		break;
-+	}
-+
-+	spin_unlock_bh(&rtsp_buffer_lock);
-+
-+	return ret;
-+}
-+
-+static struct nf_conntrack_helper rtsp_helpers[MAX_PORTS];
-+static char rtsp_names[MAX_PORTS][10];
-+static struct nf_conntrack_expect_policy rtsp_expect_policy;
-+
-+/* This function is intentionally _NOT_ defined as __exit */
-+static void
-+fini(void)
-+{
-+	int i;
-+	for (i = 0; i < num_ports; i++) {
-+		DEBUGP("unregistering port %d\n", ports[i]);
-+		nf_conntrack_helper_unregister(&rtsp_helpers[i]);
-+	}
-+	kfree(rtsp_buffer);
-+}
-+
-+static int __init
-+init(void)
-+{
-+	int i, ret;
-+	struct nf_conntrack_helper *hlpr;
-+	char *tmpname;
-+
-+	printk("nf_conntrack_rtsp v" IP_NF_RTSP_VERSION " loading\n");
-+
-+	if (max_outstanding < 1) {
-+		printk("nf_conntrack_rtsp: max_outstanding must be a positive integer\n");
-+		return -EBUSY;
-+	}
-+	if (setup_timeout < 0) {
-+		printk("nf_conntrack_rtsp: setup_timeout must be a positive integer\n");
-+		return -EBUSY;
-+	}
-+
-+	rtsp_expect_policy.max_expected = max_outstanding;
-+	rtsp_expect_policy.timeout = setup_timeout;
-+
-+	rtsp_buffer = kmalloc(65536, GFP_KERNEL);
-+	if (!rtsp_buffer)
-+		return -ENOMEM;
-+
-+	/* If no port given, default to standard rtsp port */
-+	if (ports[0] == 0) {
-+		ports[0] = RTSP_PORT;
-+	}
-+
-+	for (i = 0; (i < MAX_PORTS) && ports[i]; i++) {
-+		hlpr = &rtsp_helpers[i];
-+		memset(hlpr, 0, sizeof(struct nf_conntrack_helper));
-+		hlpr->tuple.src.u.tcp.port = htons(ports[i]);
-+		hlpr->tuple.dst.protonum = IPPROTO_TCP;
-+		hlpr->expect_policy = &rtsp_expect_policy;
-+		hlpr->me = THIS_MODULE;
-+		hlpr->help = help;
-+
-+		tmpname = &rtsp_names[i][0];
-+		if (ports[i] == RTSP_PORT) {
-+			sprintf(tmpname, "rtsp");
-+		} else {
-+			sprintf(tmpname, "rtsp-%d", i);
-+		}
-+		hlpr->name = tmpname;
-+
-+		DEBUGP("port #%d: %d\n", i, ports[i]);
-+
-+		ret = nf_conntrack_helper_register(hlpr);
-+
-+		if (ret) {
-+			printk("nf_conntrack_rtsp: ERROR registering port %d\n", ports[i]);
-+			fini();
-+			return -EBUSY;
-+		}
-+		num_ports++;
-+	}
-+	return 0;
-+}
-+
-+module_init(init);
-+module_exit(fini);
-+
-+EXPORT_SYMBOL(nf_nat_rtsp_hook_expectfn);
-+
---- /dev/null
-+++ b/net/ipv4/netfilter/nf_nat_rtsp.c
-@@ -0,0 +1,496 @@
-+/*
-+ * RTSP extension for TCP NAT alteration
-+ * (C) 2003 by Tom Marshall <tmarshall at real.com>
-+ * based on ip_nat_irc.c
-+ *
-+ *      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.
-+ *
-+ * Module load syntax:
-+ *      insmod nf_nat_rtsp.o ports=port1,port2,...port<MAX_PORTS>
-+ *                           stunaddr=<address>
-+ *                           destaction=[auto|strip|none]
-+ *
-+ * If no ports are specified, the default will be port 554 only.
-+ *
-+ * stunaddr specifies the address used to detect that a client is using STUN.
-+ * If this address is seen in the destination parameter, it is assumed that
-+ * the client has already punched a UDP hole in the firewall, so we don't
-+ * mangle the client_port.  If none is specified, it is autodetected.  It
-+ * only needs to be set if you have multiple levels of NAT.  It should be
-+ * set to the external address that the STUN clients detect.  Note that in
-+ * this case, it will not be possible for clients to use UDP with servers
-+ * between the NATs.
-+ *
-+ * If no destaction is specified, auto is used.
-+ *   destaction=auto:  strip destination parameter if it is not stunaddr.
-+ *   destaction=strip: always strip destination parameter (not recommended).
-+ *   destaction=none:  do not touch destination parameter (not recommended).
-+ */
-+
-+#include <linux/module.h>
-+#include <net/tcp.h>
-+#include <net/netfilter/nf_nat_helper.h>
-+#include <net/netfilter/nf_nat_rule.h>
-+#include <linux/netfilter/nf_conntrack_rtsp.h>
-+#include <net/netfilter/nf_conntrack_expect.h>
-+
-+#include <linux/inet.h>
-+#include <linux/ctype.h>
-+#define NF_NEED_STRNCASECMP
-+#define NF_NEED_STRTOU16
-+#include <linux/netfilter_helpers.h>
-+#define NF_NEED_MIME_NEXTLINE
-+#include <linux/netfilter_mime.h>
-+
-+#define INFOP(fmt, args...) printk(KERN_INFO "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
-+#if 0
-+#define DEBUGP(fmt, args...) printk(KERN_DEBUG "%s: %s: " fmt, __FILE__, __FUNCTION__ , ## args)
-+#else
-+#define DEBUGP(fmt, args...)
-+#endif
-+
-+#define MAX_PORTS       8
-+#define DSTACT_AUTO     0
-+#define DSTACT_STRIP    1
-+#define DSTACT_NONE     2
-+
-+static char*    stunaddr = NULL;
-+static char*    destaction = NULL;
-+
-+static u_int32_t extip = 0;
-+static int       dstact = 0;
-+
-+MODULE_AUTHOR("Tom Marshall <tmarshall at real.com>");
-+MODULE_DESCRIPTION("RTSP network address translation module");
-+MODULE_LICENSE("GPL");
-+module_param(stunaddr, charp, 0644);
-+MODULE_PARM_DESC(stunaddr, "Address for detecting STUN");
-+module_param(destaction, charp, 0644);
-+MODULE_PARM_DESC(destaction, "Action for destination parameter (auto/strip/none)");
-+
-+#define SKIP_WSPACE(ptr,len,off) while(off < len && isspace(*(ptr+off))) { off++; }
-+
-+/*** helper functions ***/
-+
-+static void
-+get_skb_tcpdata(struct sk_buff* skb, char** pptcpdata, uint* ptcpdatalen)
-+{
-+    struct iphdr*   iph  = ip_hdr(skb);
-+    struct tcphdr*  tcph = (void *)iph + ip_hdrlen(skb);
-+
-+    *pptcpdata = (char*)tcph +  tcph->doff*4;
-+    *ptcpdatalen = ((char*)skb_transport_header(skb) + skb->len) - *pptcpdata;
-+}
-+
-+/*** nat functions ***/
-+
-+/*
-+ * Mangle the "Transport:" header:
-+ *   - Replace all occurences of "client_port=<spec>"
-+ *   - Handle destination parameter
-+ *
-+ * In:
-+ *   ct, ctinfo = conntrack context
-+ *   skb        = packet
-+ *   tranoff    = Transport header offset from TCP data
-+ *   tranlen    = Transport header length (incl. CRLF)
-+ *   rport_lo   = replacement low  port (host endian)
-+ *   rport_hi   = replacement high port (host endian)
-+ *
-+ * Returns packet size difference.
-+ *
-+ * Assumes that a complete transport header is present, ending with CR or LF
-+ */
-+static int
-+rtsp_mangle_tran(enum ip_conntrack_info ctinfo,
-+                 struct nf_conntrack_expect* exp,
-+								 struct ip_ct_rtsp_expect* prtspexp,
-+                 struct sk_buff* skb, uint tranoff, uint tranlen)
-+{
-+    char*       ptcp;
-+    uint        tcplen;
-+    char*       ptran;
-+    char        rbuf1[16];      /* Replacement buffer (one port) */
-+    uint        rbuf1len;       /* Replacement len (one port) */
-+    char        rbufa[16];      /* Replacement buffer (all ports) */
-+    uint        rbufalen;       /* Replacement len (all ports) */
-+    u_int32_t   newip;
-+    u_int16_t   loport, hiport;
-+    uint        off = 0;
-+    uint        diff;           /* Number of bytes we removed */
-+
-+    struct nf_conn *ct = exp->master;
-+    struct nf_conntrack_tuple *t;
-+
-+    char    szextaddr[15+1];
-+    uint    extaddrlen;
-+    int     is_stun;
-+
-+    get_skb_tcpdata(skb, &ptcp, &tcplen);
-+    ptran = ptcp+tranoff;
-+
-+    if (tranoff+tranlen > tcplen || tcplen-tranoff < tranlen ||
-+        tranlen < 10 || !iseol(ptran[tranlen-1]) ||
-+        nf_strncasecmp(ptran, "Transport:", 10) != 0)
-+    {
-+        INFOP("sanity check failed\n");
-+        return 0;
-+    }
-+    off += 10;
-+    SKIP_WSPACE(ptcp+tranoff, tranlen, off);
-+
-+    newip = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip;
-+    t = &exp->tuple;
-+    t->dst.u3.ip = newip;
-+
-+    extaddrlen = extip ? sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(extip))
-+                       : sprintf(szextaddr, "%u.%u.%u.%u", NIPQUAD(newip));
-+    DEBUGP("stunaddr=%s (%s)\n", szextaddr, (extip?"forced":"auto"));
-+
-+    rbuf1len = rbufalen = 0;
-+    switch (prtspexp->pbtype)
-+    {
-+    case pb_single:
-+        for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */
-+        {
-+            t->dst.u.udp.port = htons(loport);
-+            if (nf_ct_expect_related(exp) == 0)
-+            {
-+                DEBUGP("using port %hu\n", loport);
-+                break;
-+            }
-+        }
-+        if (loport != 0)
-+        {
-+            rbuf1len = sprintf(rbuf1, "%hu", loport);
-+            rbufalen = sprintf(rbufa, "%hu", loport);
-+        }
-+        break;
-+    case pb_range:
-+        for (loport = prtspexp->loport; loport != 0; loport += 2) /* XXX: improper wrap? */
-+        {
-+            t->dst.u.udp.port = htons(loport);
-+            if (nf_ct_expect_related(exp) == 0)
-+            {
-+                hiport = loport + ~exp->mask.src.u.udp.port;
-+                DEBUGP("using ports %hu-%hu\n", loport, hiport);
-+                break;
-+            }
-+        }
-+        if (loport != 0)
-+        {
-+            rbuf1len = sprintf(rbuf1, "%hu", loport);
-+            rbufalen = sprintf(rbufa, "%hu-%hu", loport, loport+1);
-+        }
-+        break;
-+    case pb_discon:
-+        for (loport = prtspexp->loport; loport != 0; loport++) /* XXX: improper wrap? */
-+        {
-+            t->dst.u.udp.port = htons(loport);
-+            if (nf_ct_expect_related(exp) == 0)
-+            {
-+                DEBUGP("using port %hu (1 of 2)\n", loport);
-+                break;
-+            }
-+        }
-+        for (hiport = prtspexp->hiport; hiport != 0; hiport++) /* XXX: improper wrap? */
-+        {
-+            t->dst.u.udp.port = htons(hiport);
-+            if (nf_ct_expect_related(exp) == 0)
-+            {
-+                DEBUGP("using port %hu (2 of 2)\n", hiport);
-+                break;
-+            }
-+        }
-+        if (loport != 0 && hiport != 0)
-+        {
-+            rbuf1len = sprintf(rbuf1, "%hu", loport);
-+            if (hiport == loport+1)
-+            {
-+                rbufalen = sprintf(rbufa, "%hu-%hu", loport, hiport);
-+            }
-+            else
-+            {
-+                rbufalen = sprintf(rbufa, "%hu/%hu", loport, hiport);
-+            }
-+        }
-+        break;
-+    }
-+
-+    if (rbuf1len == 0)
-+    {
-+        return 0;   /* cannot get replacement port(s) */
-+    }
-+
-+    /* Transport: tran;field;field=val,tran;field;field=val,... */
-+    while (off < tranlen)
-+    {
-+        uint        saveoff;
-+        const char* pparamend;
-+        uint        nextparamoff;
-+
-+        pparamend = memchr(ptran+off, ',', tranlen-off);
-+        pparamend = (pparamend == NULL) ? ptran+tranlen : pparamend+1;
-+        nextparamoff = pparamend-ptcp;
-+
-+        /*
-+         * We pass over each param twice.  On the first pass, we look for a
-+         * destination= field.  It is handled by the security policy.  If it
-+         * is present, allowed, and equal to our external address, we assume
-+         * that STUN is being used and we leave the client_port= field alone.
-+         */
-+        is_stun = 0;
-+        saveoff = off;
-+        while (off < nextparamoff)
-+        {
-+            const char* pfieldend;
-+            uint        nextfieldoff;
-+
-+            pfieldend = memchr(ptran+off, ';', nextparamoff-off);
-+            nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
-+
-+            if (dstact != DSTACT_NONE && strncmp(ptran+off, "destination=", 12) == 0)
-+            {
-+                if (strncmp(ptran+off+12, szextaddr, extaddrlen) == 0)
-+                {
-+                    is_stun = 1;
-+                }
-+                if (dstact == DSTACT_STRIP || (dstact == DSTACT_AUTO && !is_stun))
-+                {
-+                    diff = nextfieldoff-off;
-+                    if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
-+                                                         off, diff, NULL, 0))
-+                    {
-+                        /* mangle failed, all we can do is bail */
-+			nf_ct_unexpect_related(exp);
-+                        return 0;
-+                    }
-+                    get_skb_tcpdata(skb, &ptcp, &tcplen);
-+                    ptran = ptcp+tranoff;
-+                    tranlen -= diff;
-+                    nextparamoff -= diff;
-+                    nextfieldoff -= diff;
-+                }
-+            }
-+
-+            off = nextfieldoff;
-+        }
-+        if (is_stun)
-+        {
-+            continue;
-+        }
-+        off = saveoff;
-+        while (off < nextparamoff)
-+        {
-+            const char* pfieldend;
-+            uint        nextfieldoff;
-+
-+            pfieldend = memchr(ptran+off, ';', nextparamoff-off);
-+            nextfieldoff = (pfieldend == NULL) ? nextparamoff : pfieldend-ptran+1;
-+
-+            if (strncmp(ptran+off, "client_port=", 12) == 0)
-+            {
-+                u_int16_t   port;
-+                uint        numlen;
-+                uint        origoff;
-+                uint        origlen;
-+                char*       rbuf    = rbuf1;
-+                uint        rbuflen = rbuf1len;
-+
-+                off += 12;
-+                origoff = (ptran-ptcp)+off;
-+                origlen = 0;
-+                numlen = nf_strtou16(ptran+off, &port);
-+                off += numlen;
-+                origlen += numlen;
-+                if (port != prtspexp->loport)
-+                {
-+                    DEBUGP("multiple ports found, port %hu ignored\n", port);
-+                }
-+                else
-+                {
-+                    if (ptran[off] == '-' || ptran[off] == '/')
-+                    {
-+                        off++;
-+                        origlen++;
-+                        numlen = nf_strtou16(ptran+off, &port);
-+                        off += numlen;
-+                        origlen += numlen;
-+                        rbuf = rbufa;
-+                        rbuflen = rbufalen;
-+                    }
-+
-+                    /*
-+                     * note we cannot just memcpy() if the sizes are the same.
-+                     * the mangle function does skb resizing, checks for a
-+                     * cloned skb, and updates the checksums.
-+                     *
-+                     * parameter 4 below is offset from start of tcp data.
-+                     */
-+                    diff = origlen-rbuflen;
-+                    if (!nf_nat_mangle_tcp_packet(skb, ct, ctinfo,
-+                                              origoff, origlen, rbuf, rbuflen))
-+                    {
-+                        /* mangle failed, all we can do is bail */
-+			nf_ct_unexpect_related(exp);
-+                        return 0;
-+                    }
-+                    get_skb_tcpdata(skb, &ptcp, &tcplen);
-+                    ptran = ptcp+tranoff;
-+                    tranlen -= diff;
-+                    nextparamoff -= diff;
-+                    nextfieldoff -= diff;
-+                }
-+            }
-+
-+            off = nextfieldoff;
-+        }
-+
-+        off = nextparamoff;
-+    }
-+
-+    return 1;
-+}
-+
-+static uint
-+help_out(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
-+	 unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
-+	 struct nf_conntrack_expect* exp)
-+{
-+    char*   ptcp;
-+    uint    tcplen;
-+    uint    hdrsoff;
-+    uint    hdrslen;
-+    uint    lineoff;
-+    uint    linelen;
-+    uint    off;
-+
-+    //struct iphdr* iph = (struct iphdr*)skb->nh.iph;
-+    //struct tcphdr* tcph = (struct tcphdr*)((void*)iph + iph->ihl*4);
-+
-+    get_skb_tcpdata(skb, &ptcp, &tcplen);
-+    hdrsoff = matchoff;//exp->seq - ntohl(tcph->seq);
-+    hdrslen = matchlen;
-+    off = hdrsoff;
-+    DEBUGP("NAT rtsp help_out\n");
-+
-+    while (nf_mime_nextline(ptcp, hdrsoff+hdrslen, &off, &lineoff, &linelen))
-+    {
-+        if (linelen == 0)
-+        {
-+            break;
-+        }
-+        if (off > hdrsoff+hdrslen)
-+        {
-+            INFOP("!! overrun !!");
-+            break;
-+        }
-+        DEBUGP("hdr: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
-+
-+        if (nf_strncasecmp(ptcp+lineoff, "Transport:", 10) == 0)
-+        {
-+            uint oldtcplen = tcplen;
-+	    DEBUGP("hdr: Transport\n");
-+            if (!rtsp_mangle_tran(ctinfo, exp, prtspexp, skb, lineoff, linelen))
-+            {
-+		DEBUGP("hdr: Transport mangle failed");
-+                break;
-+            }
-+            get_skb_tcpdata(skb, &ptcp, &tcplen);
-+            hdrslen -= (oldtcplen-tcplen);
-+            off -= (oldtcplen-tcplen);
-+            lineoff -= (oldtcplen-tcplen);
-+            linelen -= (oldtcplen-tcplen);
-+            DEBUGP("rep: len=%u, %.*s", linelen, (int)linelen, ptcp+lineoff);
-+        }
-+    }
-+
-+    return NF_ACCEPT;
-+}
-+
-+static unsigned int
-+help(struct sk_buff *skb, enum ip_conntrack_info ctinfo,
-+     unsigned int matchoff, unsigned int matchlen, struct ip_ct_rtsp_expect* prtspexp,
-+     struct nf_conntrack_expect* exp)
-+{
-+    int dir = CTINFO2DIR(ctinfo);
-+    int rc = NF_ACCEPT;
-+
-+    switch (dir)
-+    {
-+    case IP_CT_DIR_ORIGINAL:
-+        rc = help_out(skb, ctinfo, matchoff, matchlen, prtspexp, exp);
-+        break;
-+    case IP_CT_DIR_REPLY:
-+	DEBUGP("unmangle ! %u\n", ctinfo);
-+    	/* XXX: unmangle */
-+	rc = NF_ACCEPT;
-+        break;
-+    }
-+    //UNLOCK_BH(&ip_rtsp_lock);
-+
-+    return rc;
-+}
-+
-+static void expected(struct nf_conn* ct, struct nf_conntrack_expect *exp)
-+{
-+    struct nf_nat_multi_range_compat mr;
-+    u_int32_t newdstip, newsrcip, newip;
-+
-+    struct nf_conn *master = ct->master;
-+
-+    newdstip = master->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip;
-+    newsrcip = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip;
-+    //FIXME (how to port that ?)
-+    //code from 2.4 : newip = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC) ? newsrcip : newdstip;
-+    newip = newdstip;
-+
-+    DEBUGP("newsrcip=%u.%u.%u.%u, newdstip=%u.%u.%u.%u, newip=%u.%u.%u.%u\n",
-+           NIPQUAD(newsrcip), NIPQUAD(newdstip), NIPQUAD(newip));
-+
-+    mr.rangesize = 1;
-+    // We don't want to manip the per-protocol, just the IPs.
-+    mr.range[0].flags = IP_NAT_RANGE_MAP_IPS;
-+    mr.range[0].min_ip = mr.range[0].max_ip = newip;
-+
-+    nf_nat_setup_info(ct, &mr.range[0], IP_NAT_MANIP_DST);
-+}
-+
-+
-+static void __exit fini(void)
-+{
-+	nf_nat_rtsp_hook = NULL;
-+        nf_nat_rtsp_hook_expectfn = NULL;
-+	synchronize_net();
-+}
-+
-+static int __init init(void)
-+{
-+	printk("nf_nat_rtsp v" IP_NF_RTSP_VERSION " loading\n");
-+
-+	BUG_ON(nf_nat_rtsp_hook);
-+	nf_nat_rtsp_hook = help;
-+        nf_nat_rtsp_hook_expectfn = &expected;
-+
-+	if (stunaddr != NULL)
-+		extip = in_aton(stunaddr);
-+
-+	if (destaction != NULL) {
-+	        if (strcmp(destaction, "auto") == 0)
-+			dstact = DSTACT_AUTO;
-+
-+		if (strcmp(destaction, "strip") == 0)
-+			dstact = DSTACT_STRIP;
-+
-+		if (strcmp(destaction, "none") == 0)
-+			dstact = DSTACT_NONE;
-+	}
-+
-+	return 0;
-+}
-+
-+module_init(init);
-+module_exit(fini);

+ 0 - 795
target/linux/generic/patches-2.6.33/200-sched_esfq.patch

@@ -1,795 +0,0 @@
---- a/include/linux/pkt_sched.h
-+++ b/include/linux/pkt_sched.h
-@@ -173,8 +173,37 @@ struct tc_sfq_xstats {
-  *
-  *	The only reason for this is efficiency, it is possible
-  *	to change these parameters in compile time.
-+ *
-+ *	If you need to play with these values, use esfq instead.
-  */
- 
-+/* ESFQ section */
-+
-+enum
-+{
-+        /* traditional */
-+	TCA_SFQ_HASH_CLASSIC,
-+	TCA_SFQ_HASH_DST,
-+	TCA_SFQ_HASH_SRC,
-+	TCA_SFQ_HASH_FWMARK,
-+	/* conntrack */
-+	TCA_SFQ_HASH_CTORIGDST,
-+	TCA_SFQ_HASH_CTORIGSRC,
-+	TCA_SFQ_HASH_CTREPLDST,
-+	TCA_SFQ_HASH_CTREPLSRC,
-+	TCA_SFQ_HASH_CTNATCHG,
-+};
-+
-+struct tc_esfq_qopt
-+{
-+	unsigned	quantum;	/* Bytes per round allocated to flow */
-+	int		perturb_period;	/* Period of hash perturbation */
-+	__u32		limit;		/* Maximal packets in queue */
-+	unsigned	divisor;	/* Hash divisor  */
-+	unsigned	flows;		/* Maximal number of flows  */
-+	unsigned	hash_kind;	/* Hash function to use for flow identification */
-+};
-+
- /* RED section */
- 
- enum {
---- a/net/sched/Kconfig
-+++ b/net/sched/Kconfig
-@@ -137,6 +137,37 @@ config NET_SCH_SFQ
- 	  To compile this code as a module, choose M here: the
- 	  module will be called sch_sfq.
- 
-+config NET_SCH_ESFQ
-+	tristate "Enhanced Stochastic Fairness Queueing (ESFQ)"
-+	---help---
-+	  Say Y here if you want to use the Enhanced Stochastic Fairness
-+	  Queueing (ESFQ) packet scheduling algorithm for some of your network
-+	  devices or as a leaf discipline for a classful qdisc such as HTB or
-+	  CBQ (see the top of <file:net/sched/sch_esfq.c> for details and
-+	  references to the SFQ algorithm).
-+
-+	  This is an enchanced SFQ version which allows you to control some
-+	  hardcoded values in the SFQ scheduler.
-+
-+	  ESFQ also adds control of the hash function used to identify packet
-+	  flows. The original SFQ discipline hashes by connection; ESFQ add
-+	  several other hashing methods, such as by src IP or by dst IP, which
-+	  can be more fair to users in some networking situations.
-+
-+	  To compile this code as a module, choose M here: the
-+	  module will be called sch_esfq.
-+
-+config NET_SCH_ESFQ_NFCT
-+	bool "Connection Tracking Hash Types"
-+	depends on NET_SCH_ESFQ && NF_CONNTRACK
-+	---help---
-+	  Say Y here to enable support for hashing based on netfilter connection
-+	  tracking information. This is useful for a router that is also using
-+	  NAT to connect privately-addressed hosts to the Internet. If you want
-+	  to provide fair distribution of upstream bandwidth, ESFQ must use
-+	  connection tracking information, since all outgoing packets will share
-+	  the same source address.
-+
- config NET_SCH_TEQL
- 	tristate "True Link Equalizer (TEQL)"
- 	---help---
---- a/net/sched/Makefile
-+++ b/net/sched/Makefile
-@@ -24,6 +24,7 @@ obj-$(CONFIG_NET_SCH_GRED)	+= sch_gred.o
- obj-$(CONFIG_NET_SCH_INGRESS)	+= sch_ingress.o 
- obj-$(CONFIG_NET_SCH_DSMARK)	+= sch_dsmark.o
- obj-$(CONFIG_NET_SCH_SFQ)	+= sch_sfq.o
-+obj-$(CONFIG_NET_SCH_ESFQ)	+= sch_esfq.o
- obj-$(CONFIG_NET_SCH_TBF)	+= sch_tbf.o
- obj-$(CONFIG_NET_SCH_TEQL)	+= sch_teql.o
- obj-$(CONFIG_NET_SCH_PRIO)	+= sch_prio.o
---- /dev/null
-+++ b/net/sched/sch_esfq.c
-@@ -0,0 +1,702 @@
-+/*
-+ * net/sched/sch_esfq.c	Extended Stochastic Fairness Queueing discipline.
-+ *
-+ *		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.
-+ *
-+ * Authors:	Alexey Kuznetsov, <[email protected]>
-+ *
-+ * Changes:	Alexander Atanasov, <[email protected]>
-+ *		Added dynamic depth,limit,divisor,hash_kind options.
-+ *		Added dst and src hashes.
-+ *
-+ * 		Alexander Clouter, <[email protected]>
-+ *		Ported ESFQ to Linux 2.6.
-+ *
-+ * 		Corey Hickey, <[email protected]>
-+ *		Maintenance of the Linux 2.6 port.
-+ *		Added fwmark hash (thanks to Robert Kurjata).
-+ *		Added usage of jhash.
-+ *		Added conntrack support.
-+ *		Added ctnatchg hash (thanks to Ben Pfountz).
-+ */
-+
-+#include <linux/module.h>
-+#include <asm/uaccess.h>
-+#include <asm/system.h>
-+#include <linux/bitops.h>
-+#include <linux/types.h>
-+#include <linux/kernel.h>
-+#include <linux/jiffies.h>
-+#include <linux/string.h>
-+#include <linux/mm.h>
-+#include <linux/socket.h>
-+#include <linux/sockios.h>
-+#include <linux/in.h>
-+#include <linux/errno.h>
-+#include <linux/interrupt.h>
-+#include <linux/if_ether.h>
-+#include <linux/inet.h>
-+#include <linux/netdevice.h>
-+#include <linux/etherdevice.h>
-+#include <linux/notifier.h>
-+#include <linux/init.h>
-+#include <net/ip.h>
-+#include <net/netlink.h>
-+#include <linux/ipv6.h>
-+#include <net/route.h>
-+#include <linux/skbuff.h>
-+#include <net/sock.h>
-+#include <net/pkt_sched.h>
-+#include <linux/jhash.h>
-+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
-+#include <net/netfilter/nf_conntrack.h>
-+#endif
-+
-+/*	Stochastic Fairness Queuing algorithm.
-+	For more comments look at sch_sfq.c.
-+	The difference is that you can change limit, depth,
-+	hash table size and choose alternate hash types.
-+
-+	classic:	same as in sch_sfq.c
-+	dst:		destination IP address
-+	src:		source IP address
-+	fwmark:		netfilter mark value
-+	ctorigdst:	original destination IP address
-+	ctorigsrc:	original source IP address
-+	ctrepldst:	reply destination IP address
-+	ctreplsrc:	reply source IP
-+
-+*/
-+
-+#define ESFQ_HEAD 0
-+#define ESFQ_TAIL 1
-+
-+/* This type should contain at least SFQ_DEPTH*2 values */
-+typedef unsigned int esfq_index;
-+
-+struct esfq_head
-+{
-+	esfq_index	next;
-+	esfq_index	prev;
-+};
-+
-+struct esfq_sched_data
-+{
-+/* Parameters */
-+	int		perturb_period;
-+	unsigned	quantum;	/* Allotment per round: MUST BE >= MTU */
-+	int		limit;
-+	unsigned	depth;
-+	unsigned	hash_divisor;
-+	unsigned	hash_kind;
-+/* Variables */
-+	struct timer_list perturb_timer;
-+	int		perturbation;
-+	esfq_index	tail;		/* Index of current slot in round */
-+	esfq_index	max_depth;	/* Maximal depth */
-+
-+	esfq_index	*ht;			/* Hash table */
-+	esfq_index	*next;			/* Active slots link */
-+	short		*allot;			/* Current allotment per slot */
-+	unsigned short	*hash;			/* Hash value indexed by slots */
-+	struct sk_buff_head	*qs;		/* Slot queue */
-+	struct esfq_head	*dep;		/* Linked list of slots, indexed by depth */
-+};
-+
-+/* This contains the info we will hash. */
-+struct esfq_packet_info
-+{
-+	u32	proto;		/* protocol or port */
-+	u32	src;		/* source from packet header */
-+	u32	dst;		/* destination from packet header */
-+	u32	ctorigsrc;	/* original source from conntrack */
-+	u32	ctorigdst;	/* original destination from conntrack */
-+	u32	ctreplsrc;	/* reply source from conntrack */
-+	u32	ctrepldst;	/* reply destination from conntrack */
-+	u32	mark;		/* netfilter mark (fwmark) */
-+};
-+
-+static __inline__ unsigned esfq_jhash_1word(struct esfq_sched_data *q,u32 a)
-+{
-+	return jhash_1word(a, q->perturbation) & (q->hash_divisor-1);
-+}
-+
-+static __inline__ unsigned esfq_jhash_2words(struct esfq_sched_data *q, u32 a, u32 b)
-+{
-+	return jhash_2words(a, b, q->perturbation) & (q->hash_divisor-1);
-+}
-+
-+static __inline__ unsigned esfq_jhash_3words(struct esfq_sched_data *q, u32 a, u32 b, u32 c)
-+{
-+	return jhash_3words(a, b, c, q->perturbation) & (q->hash_divisor-1);
-+}
-+
-+static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb)
-+{
-+	struct esfq_packet_info info;
-+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
-+	enum ip_conntrack_info ctinfo;
-+	struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
-+#endif
-+
-+	switch (skb->protocol) {
-+	case __constant_htons(ETH_P_IP):
-+	{
-+		struct iphdr *iph = ip_hdr(skb);
-+		info.dst = iph->daddr;
-+		info.src = iph->saddr;
-+		if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
-+		    (iph->protocol == IPPROTO_TCP ||
-+		     iph->protocol == IPPROTO_UDP ||
-+		     iph->protocol == IPPROTO_SCTP ||
-+		     iph->protocol == IPPROTO_DCCP ||
-+		     iph->protocol == IPPROTO_ESP))
-+			info.proto = *(((u32*)iph) + iph->ihl);
-+		else
-+			info.proto = iph->protocol;
-+		break;
-+	}
-+	case __constant_htons(ETH_P_IPV6):
-+	{
-+		struct ipv6hdr *iph = ipv6_hdr(skb);
-+		/* Hash ipv6 addresses into a u32. This isn't ideal,
-+		 * but the code is simple. */
-+		info.dst = jhash2(iph->daddr.s6_addr32, 4, q->perturbation);
-+		info.src = jhash2(iph->saddr.s6_addr32, 4, q->perturbation);
-+		if (iph->nexthdr == IPPROTO_TCP ||
-+		    iph->nexthdr == IPPROTO_UDP ||
-+		    iph->nexthdr == IPPROTO_SCTP ||
-+		    iph->nexthdr == IPPROTO_DCCP ||
-+		    iph->nexthdr == IPPROTO_ESP)
-+			info.proto = *(u32*)&iph[1];
-+		else
-+			info.proto = iph->nexthdr;
-+		break;
-+	}
-+	default:
-+		info.dst   = (u32)(unsigned long)skb_dst(skb);
-+		info.src   = (u32)(unsigned long)skb->sk;
-+		info.proto = skb->protocol;
-+	}
-+
-+	info.mark = skb->mark;
-+
-+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
-+	/* defaults if there is no conntrack info */
-+	info.ctorigsrc = info.src;
-+	info.ctorigdst = info.dst;
-+	info.ctreplsrc = info.dst;
-+	info.ctrepldst = info.src;
-+	/* collect conntrack info */
-+	if (ct && ct != &nf_conntrack_untracked) {
-+		if (skb->protocol == __constant_htons(ETH_P_IP)) {
-+			info.ctorigsrc = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip;
-+			info.ctorigdst = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip;
-+			info.ctreplsrc = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip;
-+			info.ctrepldst = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip;
-+		}
-+		else if (skb->protocol == __constant_htons(ETH_P_IPV6)) {
-+			/* Again, hash ipv6 addresses into a single u32. */
-+			info.ctorigsrc = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip6, 4, q->perturbation);
-+			info.ctorigdst = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip6, 4, q->perturbation);
-+			info.ctreplsrc = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip6, 4, q->perturbation);
-+			info.ctrepldst = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip6, 4, q->perturbation);
-+		}
-+
-+	}
-+#endif
-+
-+	switch(q->hash_kind) {
-+	case TCA_SFQ_HASH_CLASSIC:
-+		return esfq_jhash_3words(q, info.dst, info.src, info.proto);
-+	case TCA_SFQ_HASH_DST:
-+		return esfq_jhash_1word(q, info.dst);
-+	case TCA_SFQ_HASH_SRC:
-+		return esfq_jhash_1word(q, info.src);
-+	case TCA_SFQ_HASH_FWMARK:
-+		return esfq_jhash_1word(q, info.mark);
-+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
-+	case TCA_SFQ_HASH_CTORIGDST:
-+		return esfq_jhash_1word(q, info.ctorigdst);
-+	case TCA_SFQ_HASH_CTORIGSRC:
-+		return esfq_jhash_1word(q, info.ctorigsrc);
-+	case TCA_SFQ_HASH_CTREPLDST:
-+		return esfq_jhash_1word(q, info.ctrepldst);
-+	case TCA_SFQ_HASH_CTREPLSRC:
-+		return esfq_jhash_1word(q, info.ctreplsrc);
-+	case TCA_SFQ_HASH_CTNATCHG:
-+	{
-+		if (info.ctorigdst == info.ctreplsrc)
-+			return esfq_jhash_1word(q, info.ctorigsrc);
-+		return esfq_jhash_1word(q, info.ctreplsrc);
-+	}
-+#endif
-+	default:
-+		if (net_ratelimit())
-+			printk(KERN_WARNING "ESFQ: Unknown hash method. Falling back to classic.\n");
-+	}
-+	return esfq_jhash_3words(q, info.dst, info.src, info.proto);
-+}
-+
-+static inline void esfq_link(struct esfq_sched_data *q, esfq_index x)
-+{
-+	esfq_index p, n;
-+	int d = q->qs[x].qlen + q->depth;
-+
-+	p = d;
-+	n = q->dep[d].next;
-+	q->dep[x].next = n;
-+	q->dep[x].prev = p;
-+	q->dep[p].next = q->dep[n].prev = x;
-+}
-+
-+static inline void esfq_dec(struct esfq_sched_data *q, esfq_index x)
-+{
-+	esfq_index p, n;
-+
-+	n = q->dep[x].next;
-+	p = q->dep[x].prev;
-+	q->dep[p].next = n;
-+	q->dep[n].prev = p;
-+
-+	if (n == p && q->max_depth == q->qs[x].qlen + 1)
-+		q->max_depth--;
-+
-+	esfq_link(q, x);
-+}
-+
-+static inline void esfq_inc(struct esfq_sched_data *q, esfq_index x)
-+{
-+	esfq_index p, n;
-+	int d;
-+
-+	n = q->dep[x].next;
-+	p = q->dep[x].prev;
-+	q->dep[p].next = n;
-+	q->dep[n].prev = p;
-+	d = q->qs[x].qlen;
-+	if (q->max_depth < d)
-+		q->max_depth = d;
-+
-+	esfq_link(q, x);
-+}
-+
-+static unsigned int esfq_drop(struct Qdisc *sch)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	esfq_index d = q->max_depth;
-+	struct sk_buff *skb;
-+	unsigned int len;
-+
-+	/* Queue is full! Find the longest slot and
-+	   drop a packet from it */
-+
-+	if (d > 1) {
-+		esfq_index x = q->dep[d+q->depth].next;
-+		skb = q->qs[x].prev;
-+		len = skb->len;
-+		__skb_unlink(skb, &q->qs[x]);
-+		kfree_skb(skb);
-+		esfq_dec(q, x);
-+		sch->q.qlen--;
-+		sch->qstats.drops++;
-+		sch->qstats.backlog -= len;
-+		return len;
-+	}
-+
-+	if (d == 1) {
-+		/* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */
-+		d = q->next[q->tail];
-+		q->next[q->tail] = q->next[d];
-+		q->allot[q->next[d]] += q->quantum;
-+		skb = q->qs[d].prev;
-+		len = skb->len;
-+		__skb_unlink(skb, &q->qs[d]);
-+		kfree_skb(skb);
-+		esfq_dec(q, d);
-+		sch->q.qlen--;
-+		q->ht[q->hash[d]] = q->depth;
-+		sch->qstats.drops++;
-+		sch->qstats.backlog -= len;
-+		return len;
-+	}
-+
-+	return 0;
-+}
-+
-+static void esfq_q_enqueue(struct sk_buff *skb, struct esfq_sched_data *q, unsigned int end)
-+{
-+	unsigned hash = esfq_hash(q, skb);
-+	unsigned depth = q->depth;
-+	esfq_index x;
-+
-+	x = q->ht[hash];
-+	if (x == depth) {
-+		q->ht[hash] = x = q->dep[depth].next;
-+		q->hash[x] = hash;
-+	}
-+
-+	if (end == ESFQ_TAIL)
-+		__skb_queue_tail(&q->qs[x], skb);
-+	else
-+		__skb_queue_head(&q->qs[x], skb);
-+
-+	esfq_inc(q, x);
-+	if (q->qs[x].qlen == 1) {		/* The flow is new */
-+		if (q->tail == depth) {	/* It is the first flow */
-+			q->tail = x;
-+			q->next[x] = x;
-+			q->allot[x] = q->quantum;
-+		} else {
-+			q->next[x] = q->next[q->tail];
-+			q->next[q->tail] = x;
-+			q->tail = x;
-+		}
-+	}
-+}
-+
-+static int esfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	esfq_q_enqueue(skb, q, ESFQ_TAIL);
-+	sch->qstats.backlog += skb->len;
-+	if (++sch->q.qlen < q->limit-1) {
-+		sch->bstats.bytes += skb->len;
-+		sch->bstats.packets++;
-+		return 0;
-+	}
-+
-+	sch->qstats.drops++;
-+	esfq_drop(sch);
-+	return NET_XMIT_CN;
-+}
-+
-+static struct sk_buff *esfq_peek(struct Qdisc* sch)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	esfq_index a;
-+
-+	/* No active slots */
-+	if (q->tail == q->depth)
-+		return NULL;
-+
-+	a = q->next[q->tail];
-+	return skb_peek(&q->qs[a]);
-+}
-+
-+static struct sk_buff *esfq_q_dequeue(struct esfq_sched_data *q)
-+{
-+	struct sk_buff *skb;
-+	unsigned depth = q->depth;
-+	esfq_index a, old_a;
-+
-+	/* No active slots */
-+	if (q->tail == depth)
-+		return NULL;
-+
-+	a = old_a = q->next[q->tail];
-+
-+	/* Grab packet */
-+	skb = __skb_dequeue(&q->qs[a]);
-+	esfq_dec(q, a);
-+
-+	/* Is the slot empty? */
-+	if (q->qs[a].qlen == 0) {
-+		q->ht[q->hash[a]] = depth;
-+		a = q->next[a];
-+		if (a == old_a) {
-+			q->tail = depth;
-+			return skb;
-+		}
-+		q->next[q->tail] = a;
-+		q->allot[a] += q->quantum;
-+	} else if ((q->allot[a] -= skb->len) <= 0) {
-+		q->tail = a;
-+		a = q->next[a];
-+		q->allot[a] += q->quantum;
-+	}
-+
-+	return skb;
-+}
-+
-+static struct sk_buff *esfq_dequeue(struct Qdisc* sch)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	struct sk_buff *skb;
-+
-+	skb = esfq_q_dequeue(q);
-+	if (skb == NULL)
-+		return NULL;
-+	sch->q.qlen--;
-+	sch->qstats.backlog -= skb->len;
-+	return skb;
-+}
-+
-+static void esfq_q_destroy(struct esfq_sched_data *q)
-+{
-+	del_timer(&q->perturb_timer);
-+	if(q->ht)
-+		kfree(q->ht);
-+	if(q->dep)
-+		kfree(q->dep);
-+	if(q->next)
-+		kfree(q->next);
-+	if(q->allot)
-+		kfree(q->allot);
-+	if(q->hash)
-+		kfree(q->hash);
-+	if(q->qs)
-+		kfree(q->qs);
-+}
-+
-+static void esfq_destroy(struct Qdisc *sch)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	esfq_q_destroy(q);
-+}
-+
-+
-+static void esfq_reset(struct Qdisc* sch)
-+{
-+	struct sk_buff *skb;
-+
-+	while ((skb = esfq_dequeue(sch)) != NULL)
-+		kfree_skb(skb);
-+}
-+
-+static void esfq_perturbation(unsigned long arg)
-+{
-+	struct Qdisc *sch = (struct Qdisc*)arg;
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+
-+	q->perturbation = net_random()&0x1F;
-+
-+	if (q->perturb_period) {
-+		q->perturb_timer.expires = jiffies + q->perturb_period;
-+		add_timer(&q->perturb_timer);
-+	}
-+}
-+
-+static unsigned int esfq_check_hash(unsigned int kind)
-+{
-+	switch (kind) {
-+	case TCA_SFQ_HASH_CTORIGDST:
-+	case TCA_SFQ_HASH_CTORIGSRC:
-+	case TCA_SFQ_HASH_CTREPLDST:
-+	case TCA_SFQ_HASH_CTREPLSRC:
-+	case TCA_SFQ_HASH_CTNATCHG:
-+#ifndef CONFIG_NET_SCH_ESFQ_NFCT
-+	{
-+		if (net_ratelimit())
-+			printk(KERN_WARNING "ESFQ: Conntrack hash types disabled in kernel config. Falling back to classic.\n");
-+		return TCA_SFQ_HASH_CLASSIC;
-+	}
-+#endif
-+	case TCA_SFQ_HASH_CLASSIC:
-+	case TCA_SFQ_HASH_DST:
-+	case TCA_SFQ_HASH_SRC:
-+	case TCA_SFQ_HASH_FWMARK:
-+		return kind;
-+	default:
-+	{
-+		if (net_ratelimit())
-+			printk(KERN_WARNING "ESFQ: Unknown hash type. Falling back to classic.\n");
-+		return TCA_SFQ_HASH_CLASSIC;
-+	}
-+	}
-+}
-+
-+static int esfq_q_init(struct esfq_sched_data *q, struct nlattr *opt)
-+{
-+	struct tc_esfq_qopt *ctl = nla_data(opt);
-+	esfq_index p = ~0U/2;
-+	int i;
-+
-+	if (opt && opt->nla_len < nla_attr_size(sizeof(*ctl)))
-+		return -EINVAL;
-+
-+	q->perturbation = 0;
-+	q->hash_kind = TCA_SFQ_HASH_CLASSIC;
-+	q->max_depth = 0;
-+	if (opt == NULL) {
-+		q->perturb_period = 0;
-+		q->hash_divisor = 1024;
-+		q->tail = q->limit = q->depth = 128;
-+
-+	} else {
-+		struct tc_esfq_qopt *ctl = nla_data(opt);
-+		if (ctl->quantum)
-+			q->quantum = ctl->quantum;
-+		q->perturb_period = ctl->perturb_period*HZ;
-+		q->hash_divisor = ctl->divisor ? : 1024;
-+		q->tail = q->limit = q->depth = ctl->flows ? : 128;
-+
-+		if ( q->depth > p - 1 )
-+			return -EINVAL;
-+
-+		if (ctl->limit)
-+			q->limit = min_t(u32, ctl->limit, q->depth);
-+
-+		if (ctl->hash_kind) {
-+			q->hash_kind = esfq_check_hash(ctl->hash_kind);
-+		}
-+	}
-+
-+	q->ht = kmalloc(q->hash_divisor*sizeof(esfq_index), GFP_KERNEL);
-+	if (!q->ht)
-+		goto err_case;
-+	q->dep = kmalloc((1+q->depth*2)*sizeof(struct esfq_head), GFP_KERNEL);
-+	if (!q->dep)
-+		goto err_case;
-+	q->next = kmalloc(q->depth*sizeof(esfq_index), GFP_KERNEL);
-+	if (!q->next)
-+		goto err_case;
-+	q->allot = kmalloc(q->depth*sizeof(short), GFP_KERNEL);
-+	if (!q->allot)
-+		goto err_case;
-+	q->hash = kmalloc(q->depth*sizeof(unsigned short), GFP_KERNEL);
-+	if (!q->hash)
-+		goto err_case;
-+	q->qs = kmalloc(q->depth*sizeof(struct sk_buff_head), GFP_KERNEL);
-+	if (!q->qs)
-+		goto err_case;
-+
-+	for (i=0; i< q->hash_divisor; i++)
-+		q->ht[i] = q->depth;
-+	for (i=0; i<q->depth; i++) {
-+		skb_queue_head_init(&q->qs[i]);
-+		q->dep[i+q->depth].next = i+q->depth;
-+		q->dep[i+q->depth].prev = i+q->depth;
-+	}
-+
-+	for (i=0; i<q->depth; i++)
-+		esfq_link(q, i);
-+	return 0;
-+err_case:
-+	esfq_q_destroy(q);
-+	return -ENOBUFS;
-+}
-+
-+static int esfq_init(struct Qdisc *sch, struct nlattr *opt)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	int err;
-+
-+	q->quantum = psched_mtu(qdisc_dev(sch)); /* default */
-+	if ((err = esfq_q_init(q, opt)))
-+		return err;
-+
-+	init_timer(&q->perturb_timer);
-+	q->perturb_timer.data = (unsigned long)sch;
-+	q->perturb_timer.function = esfq_perturbation;
-+	if (q->perturb_period) {
-+		q->perturb_timer.expires = jiffies + q->perturb_period;
-+		add_timer(&q->perturb_timer);
-+	}
-+
-+	return 0;
-+}
-+
-+static int esfq_change(struct Qdisc *sch, struct nlattr *opt)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	struct esfq_sched_data new;
-+	struct sk_buff *skb;
-+	int err;
-+
-+	/* set up new queue */
-+	memset(&new, 0, sizeof(struct esfq_sched_data));
-+	new.quantum = psched_mtu(qdisc_dev(sch)); /* default */
-+	if ((err = esfq_q_init(&new, opt)))
-+		return err;
-+
-+	/* copy all packets from the old queue to the new queue */
-+	sch_tree_lock(sch);
-+	while ((skb = esfq_q_dequeue(q)) != NULL)
-+		esfq_q_enqueue(skb, &new, ESFQ_TAIL);
-+
-+	/* clean up the old queue */
-+	esfq_q_destroy(q);
-+
-+	/* copy elements of the new queue into the old queue */
-+	q->perturb_period = new.perturb_period;
-+	q->quantum        = new.quantum;
-+	q->limit          = new.limit;
-+	q->depth          = new.depth;
-+	q->hash_divisor   = new.hash_divisor;
-+	q->hash_kind      = new.hash_kind;
-+	q->tail           = new.tail;
-+	q->max_depth      = new.max_depth;
-+	q->ht    = new.ht;
-+	q->dep   = new.dep;
-+	q->next  = new.next;
-+	q->allot = new.allot;
-+	q->hash  = new.hash;
-+	q->qs    = new.qs;
-+
-+	/* finish up */
-+	if (q->perturb_period) {
-+		q->perturb_timer.expires = jiffies + q->perturb_period;
-+		add_timer(&q->perturb_timer);
-+	} else {
-+		q->perturbation = 0;
-+	}
-+	sch_tree_unlock(sch);
-+	return 0;
-+}
-+
-+static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb)
-+{
-+	struct esfq_sched_data *q = qdisc_priv(sch);
-+	unsigned char *b = skb_tail_pointer(skb);
-+	struct tc_esfq_qopt opt;
-+
-+	opt.quantum = q->quantum;
-+	opt.perturb_period = q->perturb_period/HZ;
-+
-+	opt.limit = q->limit;
-+	opt.divisor = q->hash_divisor;
-+	opt.flows = q->depth;
-+	opt.hash_kind = q->hash_kind;
-+
-+	NLA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
-+
-+	return skb->len;
-+
-+nla_put_failure:
-+	nlmsg_trim(skb, b);
-+	return -1;
-+}
-+
-+static struct Qdisc_ops esfq_qdisc_ops =
-+{
-+	.next		=	NULL,
-+	.cl_ops		=	NULL,
-+	.id		=	"esfq",
-+	.priv_size	=	sizeof(struct esfq_sched_data),
-+	.enqueue	=	esfq_enqueue,
-+	.dequeue	=	esfq_dequeue,
-+	.peek		=	esfq_peek,
-+	.drop		=	esfq_drop,
-+	.init		=	esfq_init,
-+	.reset		=	esfq_reset,
-+	.destroy	=	esfq_destroy,
-+	.change		=	esfq_change,
-+	.dump		=	esfq_dump,
-+	.owner		=	THIS_MODULE,
-+};
-+
-+static int __init esfq_module_init(void)
-+{
-+	return register_qdisc(&esfq_qdisc_ops);
-+}
-+static void __exit esfq_module_exit(void)
-+{
-+	unregister_qdisc(&esfq_qdisc_ops);
-+}
-+module_init(esfq_module_init)
-+module_exit(esfq_module_exit)
-+MODULE_LICENSE("GPL");

+ 0 - 227
target/linux/generic/patches-2.6.33/201-jhash3.patch

@@ -1,227 +0,0 @@
---- a/include/linux/jhash.h
-+++ b/include/linux/jhash.h
-@@ -3,80 +3,95 @@
- 
- /* jhash.h: Jenkins hash support.
-  *
-- * Copyright (C) 1996 Bob Jenkins ([email protected])
-+ * Copyright (C) 2006. Bob Jenkins ([email protected])
-  *
-  * http://burtleburtle.net/bob/hash/
-  *
-  * These are the credits from Bob's sources:
-  *
-- * lookup2.c, by Bob Jenkins, December 1996, Public Domain.
-- * hash(), hash2(), hash3, and mix() are externally useful functions.
-- * Routines to test the hash are included if SELF_TEST is defined.
-- * You can use this free for any purpose.  It has no warranty.
-+ * lookup3.c, by Bob Jenkins, May 2006, Public Domain.
-  *
-- * Copyright (C) 2003 David S. Miller ([email protected])
-+ * These are functions for producing 32-bit hashes for hash table lookup.
-+ * hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() 
-+ * are externally useful functions.  Routines to test the hash are included 
-+ * if SELF_TEST is defined.  You can use this free for any purpose.  It's in
-+ * the public domain.  It has no warranty.
-+ *
-+ * Copyright (C) 2009 Jozsef Kadlecsik ([email protected])
-  *
-  * I've modified Bob's hash to be useful in the Linux kernel, and
-- * any bugs present are surely my fault.  -DaveM
-+ * any bugs present are my fault.  Jozsef
-  */
- 
--/* NOTE: Arguments are modified. */
--#define __jhash_mix(a, b, c) \
-+#define __rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
-+
-+/* __jhash_mix - mix 3 32-bit values reversibly. */
-+#define __jhash_mix(a,b,c) \
-+{ \
-+  a -= c;  a ^= __rot(c, 4);  c += b; \
-+  b -= a;  b ^= __rot(a, 6);  a += c; \
-+  c -= b;  c ^= __rot(b, 8);  b += a; \
-+  a -= c;  a ^= __rot(c,16);  c += b; \
-+  b -= a;  b ^= __rot(a,19);  a += c; \
-+  c -= b;  c ^= __rot(b, 4);  b += a; \
-+}
-+
-+/* __jhash_final - final mixing of 3 32-bit values (a,b,c) into c */
-+#define __jhash_final(a,b,c) \
- { \
--  a -= b; a -= c; a ^= (c>>13); \
--  b -= c; b -= a; b ^= (a<<8); \
--  c -= a; c -= b; c ^= (b>>13); \
--  a -= b; a -= c; a ^= (c>>12);  \
--  b -= c; b -= a; b ^= (a<<16); \
--  c -= a; c -= b; c ^= (b>>5); \
--  a -= b; a -= c; a ^= (c>>3);  \
--  b -= c; b -= a; b ^= (a<<10); \
--  c -= a; c -= b; c ^= (b>>15); \
-+  c ^= b; c -= __rot(b,14); \
-+  a ^= c; a -= __rot(c,11); \
-+  b ^= a; b -= __rot(a,25); \
-+  c ^= b; c -= __rot(b,16); \
-+  a ^= c; a -= __rot(c,4);  \
-+  b ^= a; b -= __rot(a,14); \
-+  c ^= b; c -= __rot(b,24); \
- }
- 
--/* The golden ration: an arbitrary value */
--#define JHASH_GOLDEN_RATIO	0x9e3779b9
-+/* An arbitrary initial parameter */
-+#define JHASH_GOLDEN_RATIO	0xdeadbeef
- 
- /* The most generic version, hashes an arbitrary sequence
-  * of bytes.  No alignment or length assumptions are made about
-- * the input key.
-+ * the input key. The result depends on endianness.
-  */
- static inline u32 jhash(const void *key, u32 length, u32 initval)
- {
--	u32 a, b, c, len;
-+	u32 a,b,c;
- 	const u8 *k = key;
- 
--	len = length;
--	a = b = JHASH_GOLDEN_RATIO;
--	c = initval;
--
--	while (len >= 12) {
--		a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24));
--		b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24));
--		c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24));
--
--		__jhash_mix(a,b,c);
-+	/* Set up the internal state */
-+	a = b = c = JHASH_GOLDEN_RATIO + length + initval;
- 
-+	/* all but the last block: affect some 32 bits of (a,b,c) */
-+	while (length > 12) {
-+    		a += (k[0] + ((u32)k[1]<<8) + ((u32)k[2]<<16) + ((u32)k[3]<<24));
-+		b += (k[4] + ((u32)k[5]<<8) + ((u32)k[6]<<16) + ((u32)k[7]<<24));
-+		c += (k[8] + ((u32)k[9]<<8) + ((u32)k[10]<<16) + ((u32)k[11]<<24));
-+		__jhash_mix(a, b, c);
-+		length -= 12;
- 		k += 12;
--		len -= 12;
- 	}
- 
--	c += length;
--	switch (len) {
--	case 11: c += ((u32)k[10]<<24);
--	case 10: c += ((u32)k[9]<<16);
--	case 9 : c += ((u32)k[8]<<8);
--	case 8 : b += ((u32)k[7]<<24);
--	case 7 : b += ((u32)k[6]<<16);
--	case 6 : b += ((u32)k[5]<<8);
-+	/* last block: affect all 32 bits of (c) */
-+	/* all the case statements fall through */
-+	switch (length) {
-+	case 12: c += (u32)k[11]<<24;
-+	case 11: c += (u32)k[10]<<16;
-+	case 10: c += (u32)k[9]<<8;
-+	case 9 : c += k[8];
-+	case 8 : b += (u32)k[7]<<24;
-+	case 7 : b += (u32)k[6]<<16;
-+	case 6 : b += (u32)k[5]<<8;
- 	case 5 : b += k[4];
--	case 4 : a += ((u32)k[3]<<24);
--	case 3 : a += ((u32)k[2]<<16);
--	case 2 : a += ((u32)k[1]<<8);
-+	case 4 : a += (u32)k[3]<<24;
-+	case 3 : a += (u32)k[2]<<16;
-+	case 2 : a += (u32)k[1]<<8;
- 	case 1 : a += k[0];
--	};
--
--	__jhash_mix(a,b,c);
-+		__jhash_final(a, b, c);
-+	case 0 :
-+		break;
-+	}
- 
- 	return c;
- }
-@@ -86,58 +101,57 @@ static inline u32 jhash(const void *key,
-  */
- static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
- {
--	u32 a, b, c, len;
-+	u32 a, b, c;
- 
--	a = b = JHASH_GOLDEN_RATIO;
--	c = initval;
--	len = length;
-+	/* Set up the internal state */
-+	a = b = c = JHASH_GOLDEN_RATIO + (length<<2) + initval;
- 
--	while (len >= 3) {
-+	/* handle most of the key */
-+	while (length > 3) {
- 		a += k[0];
- 		b += k[1];
- 		c += k[2];
- 		__jhash_mix(a, b, c);
--		k += 3; len -= 3;
-+		length -= 3;
-+		k += 3;
- 	}
- 
--	c += length * 4;
--
--	switch (len) {
--	case 2 : b += k[1];
--	case 1 : a += k[0];
--	};
--
--	__jhash_mix(a,b,c);
-+	/* handle the last 3 u32's */
-+	/* all the case statements fall through */ 
-+	switch (length) {
-+	case 3: c += k[2];
-+	case 2: b += k[1];
-+	case 1: a += k[0];
-+		__jhash_final(a, b, c);
-+	case 0:     /* case 0: nothing left to add */
-+		break;
-+	}
- 
- 	return c;
- }
- 
--
- /* A special ultra-optimized versions that knows they are hashing exactly
-  * 3, 2 or 1 word(s).
-- *
-- * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally
-- *       done at the end is not done here.
-  */
- static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval)
- {
--	a += JHASH_GOLDEN_RATIO;
--	b += JHASH_GOLDEN_RATIO;
--	c += initval;
-+	a += JHASH_GOLDEN_RATIO + initval;
-+	b += JHASH_GOLDEN_RATIO + initval;
-+	c += JHASH_GOLDEN_RATIO + initval;
- 
--	__jhash_mix(a, b, c);
-+	__jhash_final(a, b, c);
- 
- 	return c;
- }
- 
- static inline u32 jhash_2words(u32 a, u32 b, u32 initval)
- {
--	return jhash_3words(a, b, 0, initval);
-+	return jhash_3words(0, a, b, initval);
- }
- 
- static inline u32 jhash_1word(u32 a, u32 initval)
- {
--	return jhash_3words(a, 0, 0, initval);
-+	return jhash_3words(0, 0, a, initval);
- }
- 
- #endif /* _LINUX_JHASH_H */

+ 0 - 83
target/linux/generic/patches-2.6.33/202-mips_mem_functions_performance.patch

@@ -1,83 +0,0 @@
---- a/arch/mips/include/asm/string.h
-+++ b/arch/mips/include/asm/string.h
-@@ -133,11 +133,44 @@ strncmp(__const__ char *__cs, __const__
- 
- #define __HAVE_ARCH_MEMSET
- extern void *memset(void *__s, int __c, size_t __count);
-+#define memset(__s, __c, len)					\
-+({								\
-+	size_t __len = (len);					\
-+	void *__ret;						\
-+	if (__builtin_constant_p(len) && __len >= 64)		\
-+		__ret = memset((__s), (__c), __len);		\
-+	else							\
-+		__ret = __builtin_memset((__s), (__c), __len);	\
-+	__ret;							\
-+})
- 
- #define __HAVE_ARCH_MEMCPY
- extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
-+#define memcpy(dst, src, len)					\
-+({								\
-+	size_t __len = (len);					\
-+	void *__ret;						\
-+	if (__builtin_constant_p(len) && __len >= 64)		\
-+		__ret = memcpy((dst), (src), __len);		\
-+	else							\
-+		__ret = __builtin_memcpy((dst), (src), __len);	\
-+	__ret;							\
-+})
- 
- #define __HAVE_ARCH_MEMMOVE
- extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
-+#define memmove(dst, src, len)					\
-+({								\
-+	size_t __len = (len);					\
-+	void *__ret;						\
-+	if (__builtin_constant_p(len) && __len >= 64)		\
-+		__ret = memmove((dst), (src), __len);		\
-+	else							\
-+		__ret = __builtin_memmove((dst), (src), __len);	\
-+	__ret;							\
-+})
-+
-+#define __HAVE_ARCH_MEMCMP
-+#define memcmp(src1, src2, len) __builtin_memcmp((src1), (src2), (len))
- 
- #endif /* _ASM_STRING_H */
---- a/arch/mips/lib/Makefile
-+++ b/arch/mips/lib/Makefile
-@@ -3,7 +3,7 @@
- #
- 
- lib-y	+= csum_partial.o delay.o memcpy.o memcpy-inatomic.o memset.o \
--	   strlen_user.o strncpy_user.o strnlen_user.o uncached.o
-+	   strlen_user.o strncpy_user.o strnlen_user.o uncached.o memcmp.o
- 
- obj-y			+= iomap.o
- obj-$(CONFIG_PCI)	+= iomap-pci.o
---- /dev/null
-+++ b/arch/mips/lib/memcmp.c
-@@ -0,0 +1,22 @@
-+/*
-+ *  copied from linux/lib/string.c
-+ *
-+ *  Copyright (C) 1991, 1992  Linus Torvalds
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/string.h>
-+
-+#undef memcmp
-+int memcmp(const void *cs, const void *ct, size_t count)
-+{
-+	const unsigned char *su1, *su2;
-+	int res = 0;
-+
-+	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
-+		if ((res = *su1 - *su2) != 0)
-+			break;
-+	return res;
-+}
-+EXPORT_SYMBOL(memcmp);
-+

+ 0 - 13
target/linux/generic/patches-2.6.33/203-slab_maxsize.patch

@@ -1,13 +0,0 @@
---- a/include/linux/slab.h
-+++ b/include/linux/slab.h
-@@ -124,8 +124,8 @@ int kmem_ptr_validate(struct kmem_cache
-  * to do various tricks to work around compiler limitations in order to
-  * ensure proper constant folding.
-  */
--#define KMALLOC_SHIFT_HIGH	((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
--				(MAX_ORDER + PAGE_SHIFT - 1) : 25)
-+#define KMALLOC_SHIFT_HIGH	((MAX_ORDER + PAGE_SHIFT - 1) <= 17 ? \
-+				(MAX_ORDER + PAGE_SHIFT - 1) : 17)
- 
- #define KMALLOC_MAX_SIZE	(1UL << KMALLOC_SHIFT_HIGH)
- #define KMALLOC_MAX_ORDER	(KMALLOC_SHIFT_HIGH - PAGE_SHIFT)

+ 0 - 132
target/linux/generic/patches-2.6.33/204-jffs2_eofdetect.patch

@@ -1,132 +0,0 @@
---- a/fs/jffs2/build.c
-+++ b/fs/jffs2/build.c
-@@ -111,6 +111,17 @@ static int jffs2_build_filesystem(struct
- 	dbg_fsbuild("scanned flash completely\n");
- 	jffs2_dbg_dump_block_lists_nolock(c);
- 
-+	if (c->flags & (1 << 7)) {
-+		printk("%s(): unlocking the mtd device... ", __func__);
-+		if (c->mtd->unlock)
-+			c->mtd->unlock(c->mtd, 0, c->mtd->size);
-+		printk("done.\n");
-+
-+		printk("%s(): erasing all blocks after the end marker... ", __func__);
-+		jffs2_erase_pending_blocks(c, -1);
-+		printk("done.\n");
-+	}
-+
- 	dbg_fsbuild("pass 1 starting\n");
- 	c->flags |= JFFS2_SB_FLAG_BUILDING;
- 	/* Now scan the directory tree, increasing nlink according to every dirent found. */
---- a/fs/jffs2/scan.c
-+++ b/fs/jffs2/scan.c
-@@ -72,7 +72,7 @@ static int file_dirty(struct jffs2_sb_in
- 		return ret;
- 	if ((ret = jffs2_scan_dirty_space(c, jeb, jeb->free_size)))
- 		return ret;
--	/* Turned wasted size into dirty, since we apparently 
-+	/* Turned wasted size into dirty, since we apparently
- 	   think it's recoverable now. */
- 	jeb->dirty_size += jeb->wasted_size;
- 	c->dirty_size += jeb->wasted_size;
-@@ -144,8 +144,11 @@ int jffs2_scan_medium(struct jffs2_sb_in
- 		/* reset summary info for next eraseblock scan */
- 		jffs2_sum_reset_collected(s);
- 
--		ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
--						buf_size, s);
-+		if (c->flags & (1 << 7))
-+			ret = BLK_STATE_ALLFF;
-+		else
-+			ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
-+							buf_size, s);
- 
- 		if (ret < 0)
- 			goto out;
-@@ -400,7 +403,7 @@ static int jffs2_scan_xref_node(struct j
- 	if (!ref)
- 		return -ENOMEM;
- 
--	/* BEFORE jffs2_build_xattr_subsystem() called, 
-+	/* BEFORE jffs2_build_xattr_subsystem() called,
- 	 * and AFTER xattr_ref is marked as a dead xref,
- 	 * ref->xid is used to store 32bit xid, xd is not used
- 	 * ref->ino is used to store 32bit inode-number, ic is not used
-@@ -473,7 +476,7 @@ static int jffs2_scan_eraseblock (struct
- 		struct jffs2_sum_marker *sm;
- 		void *sumptr = NULL;
- 		uint32_t sumlen;
--	      
-+
- 		if (!buf_size) {
- 			/* XIP case. Just look, point at the summary if it's there */
- 			sm = (void *)buf + c->sector_size - sizeof(*sm);
-@@ -489,9 +492,9 @@ static int jffs2_scan_eraseblock (struct
- 				buf_len = sizeof(*sm);
- 
- 			/* Read as much as we want into the _end_ of the preallocated buffer */
--			err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len, 
-+			err = jffs2_fill_scan_buf(c, buf + buf_size - buf_len,
- 						  jeb->offset + c->sector_size - buf_len,
--						  buf_len);				
-+						  buf_len);
- 			if (err)
- 				return err;
- 
-@@ -510,9 +513,9 @@ static int jffs2_scan_eraseblock (struct
- 				}
- 				if (buf_len < sumlen) {
- 					/* Need to read more so that the entire summary node is present */
--					err = jffs2_fill_scan_buf(c, sumptr, 
-+					err = jffs2_fill_scan_buf(c, sumptr,
- 								  jeb->offset + c->sector_size - sumlen,
--								  sumlen - buf_len);				
-+								  sumlen - buf_len);
- 					if (err)
- 						return err;
- 				}
-@@ -525,7 +528,7 @@ static int jffs2_scan_eraseblock (struct
- 
- 			if (buf_size && sumlen > buf_size)
- 				kfree(sumptr);
--			/* If it returns with a real error, bail. 
-+			/* If it returns with a real error, bail.
- 			   If it returns positive, that's a block classification
- 			   (i.e. BLK_STATE_xxx) so return that too.
- 			   If it returns zero, fall through to full scan. */
-@@ -546,6 +549,17 @@ static int jffs2_scan_eraseblock (struct
- 			return err;
- 	}
- 
-+	if ((buf[0] == 0xde) &&
-+		(buf[1] == 0xad) &&
-+		(buf[2] == 0xc0) &&
-+		(buf[3] == 0xde)) {
-+		/* end of filesystem. erase everything after this point */
-+		printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
-+		c->flags |= (1 << 7);
-+
-+		return BLK_STATE_ALLFF;
-+	}
-+
- 	/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
- 	ofs = 0;
- 
-@@ -671,7 +685,7 @@ scan_more:
- 				scan_end = buf_len;
- 				goto more_empty;
- 			}
--			
-+
- 			/* See how much more there is to read in this eraseblock... */
- 			buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs);
- 			if (!buf_len) {
-@@ -907,7 +921,7 @@ scan_more:
- 
- 	D1(printk(KERN_DEBUG "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x, wasted 0x%08x\n",
- 		  jeb->offset,jeb->free_size, jeb->dirty_size, jeb->unchecked_size, jeb->used_size, jeb->wasted_size));
--	
-+
- 	/* mark_node_obsolete can add to wasted !! */
- 	if (jeb->wasted_size) {
- 		jeb->dirty_size += jeb->wasted_size;

+ 0 - 56
target/linux/generic/patches-2.6.33/205-skb_padding.patch

@@ -1,56 +0,0 @@
---- a/include/linux/skbuff.h
-+++ b/include/linux/skbuff.h
-@@ -1373,11 +1373,18 @@ static inline int skb_network_offset(con
-  *
-  * Various parts of the networking layer expect at least 32 bytes of
-  * headroom, you should not reduce this.
-+ *
-+ * This has been changed to 64 to acommodate for routing between ethernet
-+ * and wireless, but only for new allocations
-  */
- #ifndef NET_SKB_PAD
- #define NET_SKB_PAD	32
- #endif
- 
-+#ifndef NET_SKB_PAD_ALLOC
-+#define NET_SKB_PAD_ALLOC	64
-+#endif
-+
- extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
- 
- static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
-@@ -1467,9 +1474,9 @@ static inline void __skb_queue_purge(str
- static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
- 					      gfp_t gfp_mask)
- {
--	struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
-+	struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD_ALLOC, gfp_mask);
- 	if (likely(skb))
--		skb_reserve(skb, NET_SKB_PAD);
-+		skb_reserve(skb, NET_SKB_PAD_ALLOC);
- 	return skb;
- }
- 
-@@ -1552,7 +1559,7 @@ static inline int __skb_cow(struct sk_bu
- 		delta = headroom - skb_headroom(skb);
- 
- 	if (delta || cloned)
--		return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
-+		return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD_ALLOC), 0,
- 					GFP_ATOMIC);
- 	return 0;
- }
---- a/net/core/skbuff.c
-+++ b/net/core/skbuff.c
-@@ -339,9 +339,9 @@ struct sk_buff *__netdev_alloc_skb(struc
- 	int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1;
- 	struct sk_buff *skb;
- 
--	skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask, 0, node);
-+	skb = __alloc_skb(length + NET_SKB_PAD_ALLOC, gfp_mask, 0, node);
- 	if (likely(skb)) {
--		skb_reserve(skb, NET_SKB_PAD);
-+		skb_reserve(skb, NET_SKB_PAD_ALLOC);
- 		skb->dev = dev;
- 	}
- 	return skb;

+ 0 - 9
target/linux/generic/patches-2.6.33/207-powerpc_asm_segment_h.patch

@@ -1,9 +0,0 @@
---- /dev/null
-+++ b/include/asm-powerpc/segment.h
-@@ -0,0 +1,6 @@
-+#ifndef _ASM_SEGMENT_H
-+#define _ASM_SEGMENT_H
-+
-+/* Only here because we have some old header files that expect it.. */
-+
-+#endif /* _ASM_SEGMENT_H */

+ 0 - 48
target/linux/generic/patches-2.6.33/208-mips_oprofile_fix.patch

@@ -1,48 +0,0 @@
---- a/arch/mips/Makefile
-+++ b/arch/mips/Makefile
-@@ -49,7 +49,9 @@ ifneq ($(SUBARCH),$(ARCH))
- endif
- 
- ifndef CONFIG_FUNCTION_TRACER
--cflags-y := -ffunction-sections
-+  ifndef CONFIG_PROFILING
-+    cflags-y := -ffunction-sections
-+  endif
- endif
- ifdef CONFIG_FUNCTION_GRAPH_TRACER
-   ifndef KBUILD_MCOUNT_RA_ADDRESS
---- a/arch/mips/oprofile/op_model_mipsxx.c
-+++ b/arch/mips/oprofile/op_model_mipsxx.c
-@@ -298,6 +298,11 @@ static void reset_counters(void *arg)
- 	}
- }
- 
-+static irqreturn_t mipsxx_perfcount_int(int irq, void *dev_id)
-+{
-+	return mipsxx_perfcount_handler();
-+}
-+
- static int __init mipsxx_init(void)
- {
- 	int counters;
-@@ -374,6 +379,10 @@ static int __init mipsxx_init(void)
- 	save_perf_irq = perf_irq;
- 	perf_irq = mipsxx_perfcount_handler;
- 
-+	if (cp0_perfcount_irq >= 0)
-+		return request_irq(cp0_perfcount_irq, mipsxx_perfcount_int,
-+			IRQF_SHARED, "Perfcounter", save_perf_irq);
-+
- 	return 0;
- }
- 
-@@ -381,6 +390,9 @@ static void mipsxx_exit(void)
- {
- 	int counters = op_model_mipsxx_ops.num_counters;
- 
-+	if (cp0_perfcount_irq >= 0)
-+		free_irq(cp0_perfcount_irq, save_perf_irq);
-+
- 	counters = counters_per_cpu_to_total(counters);
- 	on_each_cpu(reset_counters, (void *)(long)counters, 1);
- 

+ 0 - 7782
target/linux/generic/patches-2.6.33/209-mini_fo.patch

@@ -1,7782 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -180,6 +180,7 @@ source "fs/ubifs/Kconfig"
- source "fs/cramfs/Kconfig"
- source "fs/squashfs/Kconfig"
- source "fs/freevxfs/Kconfig"
-+source "fs/mini_fo/Kconfig"
- source "fs/minix/Kconfig"
- source "fs/omfs/Kconfig"
- source "fs/hpfs/Kconfig"
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -77,6 +77,7 @@ obj-$(CONFIG_SQUASHFS)		+= squashfs/
- obj-y				+= ramfs/
- obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
- obj-$(CONFIG_CODA_FS)		+= coda/
-+obj-$(CONFIG_MINI_FO)		+= mini_fo/
- obj-$(CONFIG_MINIX_FS)		+= minix/
- obj-$(CONFIG_FAT_FS)		+= fat/
- obj-$(CONFIG_BFS_FS)		+= bfs/
---- /dev/null
-+++ b/fs/mini_fo/aux.c
-@@ -0,0 +1,577 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+/* check if file exists in storage  */
-+int exists_in_storage(dentry_t *dentry)
-+{
-+	check_mini_fo_dentry(dentry);
-+	if(dtost(dentry) == MODIFIED || dtost(dentry) == CREATED || dtost(dentry) == DEL_REWRITTEN)
-+		return 1;
-+	return 0;
-+}
-+
-+/* check if dentry is in an existing state */
-+int is_mini_fo_existant(dentry_t *dentry)
-+{
-+	check_mini_fo_dentry(dentry);
-+
-+	if(dtost(dentry) == DELETED || dtost(dentry) == NON_EXISTANT)
-+		return 0;
-+	else
-+		return 1;
-+}
-+
-+/*
-+ * This function will create a negative storage dentry for
-+ * dentry, what is required for many create like options.
-+ * It will create the storage structure if necessary.
-+ */
-+int get_neg_sto_dentry(dentry_t *dentry)
-+{
-+	int err = 0;
-+	unsigned int len;
-+	const unsigned char *name;
-+
-+	if(!dentry ||
-+	   !dtopd(dentry) ||
-+	   !(dtost(dentry) == UNMODIFIED ||
-+	     dtost(dentry) == NON_EXISTANT ||
-+	     dtost(dentry) == DELETED)) {
-+		printk(KERN_CRIT "mini_fo: get_neg_sto_dentry: invalid dentry passed.\n");
-+		err = -1;
-+		goto out;
-+	}
-+	/* Have we got a neg. dentry already? */
-+	if(dtohd2(dentry)) {
-+		err = 0;
-+		goto out;
-+	}
-+	if(dtost(dentry->d_parent) == UNMODIFIED) {
-+		/* build sto struct */
-+		err = build_sto_structure(dentry->d_parent->d_parent, dentry->d_parent);
-+		if(err ||
-+		   dtost(dentry->d_parent) != MODIFIED) {
-+			printk(KERN_CRIT "mini_fo: get_neg_sto_dentry: ERROR building sto structure.\n");
-+			err = -1;
-+			goto out;
-+		}
-+	}
-+
-+	len = dentry->d_name.len;
-+	name = dentry->d_name.name;
-+
-+	dtohd2(dentry) =
-+		lookup_one_len(name, dtohd2(dentry->d_parent), len);
-+
-+ out:
-+	return err;
-+}
-+
-+int check_mini_fo_dentry(dentry_t *dentry)
-+{
-+ 	ASSERT(dentry != NULL);
-+	ASSERT(dtopd(dentry) != NULL);
-+	ASSERT((dtohd(dentry) != NULL) || (dtohd2(dentry) != NULL));
-+
-+/* 	if(dtost(dentry) == MODIFIED) { */
-+/* 		ASSERT(dentry->d_inode != NULL); */
-+/* 		ASSERT(dtohd(dentry) != NULL); */
-+/* 		ASSERT(dtohd(dentry)->d_inode != NULL); */
-+/* 		ASSERT(dtohd2(dentry) != NULL); */
-+/* 		ASSERT(dtohd2(dentry)->d_inode != NULL); */
-+/* 	} */
-+/* 	else if(dtost(dentry) == UNMODIFIED) { */
-+/* 		ASSERT(dentry->d_inode != NULL); */
-+/* 		ASSERT( */
-+/* 	} */
-+	return 0;
-+}
-+
-+int check_mini_fo_file(file_t *file)
-+{
-+	ASSERT(file != NULL);
-+	ASSERT(ftopd(file) != NULL);
-+	ASSERT(file->f_dentry != NULL);
-+
-+	/* violent checking, check depending of state and type
-+	 *	if(S_ISDIR(file->f_dentry->d_inode->i_mode)) {}
-+	 */
-+	ASSERT((ftohf(file) != NULL) || (ftohf2(file) != NULL));
-+	return 0;
-+}
-+
-+int check_mini_fo_inode(inode_t *inode)
-+{
-+	ASSERT(inode != NULL);
-+	ASSERT(itopd(inode) != NULL);
-+	ASSERT((itohi(inode) != NULL) || (itohi2(inode) != NULL));
-+	return 0;
-+}
-+
-+/*
-+ * will walk a base path as provided by get_mini_fo_bpath and return
-+ * the (hopefully ;-) ) positive dentry of the renamed base dir.
-+ *
-+ * This does some work of path_init.
-+ */
-+dentry_t *bpath_walk(super_block_t *sb, char *bpath)
-+{
-+	int err;
-+        struct vfsmount *mnt;
-+	struct nameidata nd;
-+
-+	/* be paranoid */
-+	if(!bpath || bpath[0] != '/') {
-+		printk(KERN_CRIT "mini_fo: bpath_walk: Invalid string.\n");
-+		return NULL;
-+	}
-+	if(!sb || !stopd(sb)) {
-+		printk(KERN_CRIT "mini_fo: bpath_walk: Invalid sb.\n");
-+		return NULL;
-+	}
-+
-+	/* fix this: how do I reach this lock?
-+	 * read_lock(&current->fs->lock); */
-+	mnt = mntget(stopd(sb)->hidden_mnt);
-+	/* read_unlock(&current->fs->lock); */
-+
-+	err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd);
-+
-+	/* validate */
-+	if (err || !nd.dentry || !nd.dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n");
-+		return NULL;
-+	}
-+	return nd.dentry;
-+}
-+
-+
-+/* returns the full path of the basefile incl. its name */
-+int get_mini_fo_bpath(dentry_t *dentry, char **bpath, int *bpath_len)
-+{
-+	char *buf_walker;
-+	int len = 0;
-+	dentry_t *sky_walker;
-+
-+	if(!dentry || !dtohd(dentry)) {
-+		printk(KERN_CRIT "mini_fo: get_mini_fo_bpath: invalid dentry passed.\n");
-+		return -1;
-+	}
-+	sky_walker = dtohd(dentry);
-+
-+	do {
-+		len += sky_walker->d_name.len + 1 ; /* 1 for '/' */
-+		sky_walker = sky_walker->d_parent;
-+	} while(sky_walker != stopd(dentry->d_inode->i_sb)->base_dir_dentry);
-+
-+	/* 1 to oil the loop */
-+	*bpath = (char*)  kmalloc(len + 1, GFP_KERNEL);
-+	if(!*bpath) {
-+		printk(KERN_CRIT "mini_fo: get_mini_fo_bpath: out of mem.\n");
-+		return -1;
-+	}
-+	buf_walker = *bpath+len; /* put it on last char */
-+	*buf_walker = '\n';
-+	sky_walker = dtohd(dentry);
-+
-+	do {
-+		buf_walker -= sky_walker->d_name.len;
-+		strncpy(buf_walker,
-+			sky_walker->d_name.name,
-+			sky_walker->d_name.len);
-+		*(--buf_walker) = '/';
-+		sky_walker = sky_walker->d_parent;
-+	} while(sky_walker != stopd(dentry->d_inode->i_sb)->base_dir_dentry);
-+
-+	/* bpath_len doesn't count newline! */
-+	*bpath_len = len;
-+ 	return 0;
-+}
-+
-+int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt,
-+		    dentry_t *src_dentry, struct vfsmount *src_mnt)
-+{
-+	void *buf;
-+	mm_segment_t old_fs;
-+	file_t *tgt_file;
-+	file_t *src_file;
-+	int bytes, len, tmp, err;
-+	err = 0;
-+
-+	if(!(tgt_dentry->d_inode && src_dentry->d_inode)) {
-+		printk(KERN_CRIT "mini_fo_cp_cont: ERROR, neg. dentry passed.\n");
-+		err = -EINVAL;
-+		goto out;
-+	}
-+
-+	dget(tgt_dentry);
-+	dget(src_dentry);
-+	mntget(tgt_mnt);
-+	mntget(src_mnt);
-+
-+	/* open file write only */
-+	tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1);
-+	if(!tgt_file || IS_ERR(tgt_file)) {
-+		printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening target file.\n");
-+		err = PTR_ERR(tgt_file);
-+		goto out_err;
-+	}
-+
-+	/* open file read only */
-+	src_file = dentry_open(src_dentry, src_mnt, 0x0);
-+	if(!src_file || IS_ERR(src_file)) {
-+		printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening source file.\n");
-+		err = PTR_ERR(src_file);
-+
-+		/* close target file */
-+		fput(tgt_file);
-+		goto out_err;
-+	}
-+
-+	/* check if the filesystem(s) support read respective write */
-+	if(!src_file->f_op->read || !tgt_file->f_op->write) {
-+		printk(KERN_CRIT "mini_fo_cp_cont: ERROR, no fs read or write support.\n");
-+		err = -EPERM;
-+		goto out_close;
-+	}
-+
-+	/* allocate a page for transfering the data */
-+	buf = (void *) __get_free_page(GFP_KERNEL);
-+	if(!buf) {
-+		printk(KERN_CRIT "mini_fo_cp_cont: ERROR, out of kernel mem.\n");
-+		goto out_err;
-+	}
-+
-+	tgt_file->f_pos = 0;
-+	src_file->f_pos = 0;
-+
-+	old_fs = get_fs();
-+	set_fs(KERNEL_DS);
-+
-+	/* Doing this I assume that a read operation will return a full
-+	 * buffer while there is still data to read, and a less than
-+	 * full buffer when all data has been read.
-+	 */
-+	bytes = len = PAGE_SIZE;
-+	while(bytes == len) {
-+		bytes = src_file->f_op->read(src_file, buf, len,
-+					     &src_file->f_pos);
-+		tmp = tgt_file->f_op->write(tgt_file, buf, bytes,
-+					    &tgt_file->f_pos);
-+		if(tmp != bytes) {
-+			printk(KERN_CRIT "mini_fo_cp_cont: ERROR writing.\n");
-+			goto out_close_unset;
-+		}
-+	}
-+
-+	free_page((unsigned long) buf);
-+	set_fs(old_fs);
-+	fput(tgt_file);
-+	fput(src_file);
-+	goto out;
-+
-+ out_close_unset:
-+	free_page((unsigned long) buf);
-+	set_fs(old_fs);
-+
-+ out_close:
-+	fput(tgt_file);
-+	fput(src_file);
-+
-+ out_err:
-+	dput(tgt_dentry);
-+	dput(src_dentry);
-+
-+	/* mk: not sure if this need to be done */
-+	mntput(tgt_mnt);
-+	mntput(src_mnt);
-+
-+ out:
-+	return err;
-+}
-+
-+/* mk:
-+ * ndl (no-duplicate list) stuff
-+ * This is used in mini_fo_readdir, to save the storage directory contents
-+ * and later when reading base, match them against the list in order
-+ * to avoid duplicates.
-+ */
-+
-+/* add a file specified by name and len to the ndl
-+ * Return values: 0 on success, <0 on failure.
-+ */
-+int ndl_add_entry(struct readdir_data *rd, const char *name, int len)
-+{
-+	struct ndl_entry *tmp_entry;
-+
-+	tmp_entry = (struct ndl_entry *)
-+		kmalloc(sizeof(struct ndl_entry), GFP_KERNEL);
-+	if(!tmp_entry) {
-+                printk(KERN_CRIT "mini_fo: ndl_add_entry: out of mem.\n");
-+                return -ENOMEM;
-+        }
-+        tmp_entry->name = (char*) kmalloc(len, GFP_KERNEL);
-+        if(!tmp_entry->name) {
-+                printk(KERN_CRIT "mini_fo: ndl_add_entry: out of mem.\n");
-+                return -ENOMEM;
-+        }
-+	strncpy(tmp_entry->name, name, len);
-+        tmp_entry->len = len;
-+
-+        list_add(&tmp_entry->list, &rd->ndl_list);
-+        rd->ndl_size++;
-+        return 0;
-+}
-+
-+/* delete all list entries and free memory */
-+void ndl_put_list(struct readdir_data *rd)
-+{
-+	struct list_head *tmp;
-+	struct ndl_entry *tmp_entry;
-+
-+	if(rd->ndl_size <= 0)
-+		return;
-+	while(!list_empty(&rd->ndl_list)) {
-+		tmp = rd->ndl_list.next;
-+                list_del(tmp);
-+                tmp_entry = list_entry(tmp, struct ndl_entry, list);
-+		kfree(tmp_entry->name);
-+                kfree(tmp_entry);
-+        }
-+	rd->ndl_size = 0;
-+}
-+
-+/* Check if a file specified by name and len is in the ndl
-+ * Return value: 0 if not in list, 1 if file is found in ndl.
-+ */
-+int ndl_check_entry(struct readdir_data *rd, const char *name, int len)
-+{
-+	struct list_head *tmp;
-+	struct ndl_entry *tmp_entry;
-+
-+	if(rd->ndl_size <= 0)
-+		return 0;
-+
-+	list_for_each(tmp, &rd->ndl_list) {
-+                tmp_entry = list_entry(tmp, struct ndl_entry, list);
-+                if(tmp_entry->len != len)
-+                        continue;
-+                if(!strncmp(tmp_entry->name, name, len))
-+                        return 1;
-+        }
-+        return 0;
-+}
-+
-+/* mk:
-+ * Recursive function to create corresponding directorys in the storage fs.
-+ * The function will build the storage directorys up to dentry.
-+ */
-+int build_sto_structure(dentry_t *dir, dentry_t *dentry)
-+{
-+	int err;
-+	dentry_t *hidden_sto_dentry;
-+	dentry_t *hidden_sto_dir_dentry;
-+
-+	if(dentry->d_parent != dir) {
-+		printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [1].\n");
-+		return 1;
-+	}
-+
-+       	if(dtost(dir) != MODIFIED) {
-+		err = build_sto_structure(dir->d_parent, dentry->d_parent);
-+		if(err)
-+			return err;
-+	}
-+
-+	/* ok, coming back again. */
-+	check_mini_fo_dentry(dentry);
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	if(!hidden_sto_dentry) {
-+		/*
-+		 * This is the case after creating the first
-+		 * hidden_sto_dentry.
-+		 * After one negative storage_dentry, all pointers to
-+		 * hidden_storage dentries are set to NULL. We need to
-+		 * create the negative dentry before we create the storage
-+		 * file.
-+		 */
-+		unsigned int len;
-+		const unsigned char *name;
-+		len = dtohd(dentry)->d_name.len;
-+		name = dtohd(dentry)->d_name.name;
-+		hidden_sto_dentry = lookup_one_len(name, dtohd2(dir), len);
-+		dtohd2(dentry) = hidden_sto_dentry;
-+	}
-+
-+	/* was:	hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	/* lets be safe */
-+	if(dtohd2(dir) != hidden_sto_dir_dentry) {
-+		printk(KERN_CRIT "mini_fo: build_sto_structure: invalid parameter or meta data corruption [2].\n");
-+		return 1;
-+	}
-+
-+	/* check for errors in lock_parent */
-+	err = PTR_ERR(hidden_sto_dir_dentry);
-+	if(IS_ERR(hidden_sto_dir_dentry)) {
-+		printk(KERN_CRIT "mini_fo: build_sto_structure: lock_parent failed.\n");
-+		return err;
-+	}
-+
-+	err = vfs_mkdir(hidden_sto_dir_dentry->d_inode,
-+			hidden_sto_dentry,
-+			dir->d_inode->i_mode);
-+
-+	if(err) {
-+		printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [1].\n");
-+		/* was: unlock_dir(dir); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&dir->d_inode->i_mutex);
-+#else
-+		up(&dir->d_inode->i_sem);
-+#endif
-+		dput(dir);
-+		return err;
-+	}
-+
-+	/* everything ok! */
-+	if(!dtohd2(dentry)->d_inode) {
-+		printk(KERN_CRIT "mini_fo: build_sto_structure: failed to create storage dir [2].\n");
-+		/* was: unlock_dir(dir); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&dir->d_inode->i_mutex);
-+#else
-+		up(&dir->d_inode->i_sem);
-+#endif
-+		dput(dir);
-+		return 1;
-+	}
-+
-+	/* interpose the new inode and set new state */
-+	itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode);
-+	dtopd(dentry)->state = MODIFIED;
-+
-+	/* initalize the wol list */
-+	itopd(dentry->d_inode)->deleted_list_size = -1;
-+	itopd(dentry->d_inode)->renamed_list_size = -1;
-+	meta_build_lists(dentry);
-+
-+	fist_copy_attr_all(dentry->d_inode, itohi2(dentry->d_inode));
-+	fist_copy_attr_timesizes(dir->d_inode,
-+				 hidden_sto_dir_dentry->d_inode);
-+	dir->d_inode->i_nlink++;
-+	/* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_sto_dir_dentry);
-+	return 0;
-+}
-+
-+
-+#if 0 /* unused */
-+
-+/*
-+ * Read "len" bytes from "filename" into "buf".
-+ * "buf" is in kernel space.
-+ */
-+int
-+mini_fo_read_file(const char *filename, void *buf, int len)
-+{
-+    file_t *filp;
-+    mm_segment_t oldfs;
-+    int bytes;
-+    /* Chroot? Maybe NULL isn't right here */
-+    filp = filp_open(filename, O_RDONLY, 0);
-+    if (!filp || IS_ERR(filp)) {
-+	printk("mini_fo_read_file err %d\n", (int) PTR_ERR(filp));
-+	return -1;  /* or do something else */
-+    }
-+
-+    if (!filp->f_op->read)
-+	return -2;  /* file(system) doesn't allow reads */
-+
-+    /* now read len bytes from offset 0 */
-+    filp->f_pos = 0;		/* start offset */
-+    oldfs = get_fs();
-+    set_fs(KERNEL_DS);
-+    bytes = filp->f_op->read(filp, buf, len, &filp->f_pos);
-+    set_fs(oldfs);
-+
-+    /* close the file */
-+    fput(filp);
-+
-+    return bytes;
-+}
-+
-+
-+
-+/*
-+ * Write "len" bytes from "buf" to "filename"
-+ * "buf" is in kernel space.
-+ */
-+int
-+mini_fo_write_file(const char *filename, void *buf, int len)
-+{
-+    file_t *filp;
-+    mm_segment_t oldfs;
-+    int bytes;
-+				/* Chroot? Maybe NULL isn't right here */
-+    filp = filp_open(filename, O_RDWR|O_CREAT, 0640);
-+    if (!filp || IS_ERR(filp)) {
-+	printk("mini_fo_write_file err %d\n", (int) PTR_ERR(filp));
-+	return -1;  /* or do something else */
-+    }
-+
-+    if (!filp->f_op->write)
-+	return -2;  /* file(system) doesn't allow writes */
-+
-+    /* now write len bytes from offset 0 */
-+    filp->f_pos = 0;		/* start offset */
-+    oldfs = get_fs();
-+    set_fs(KERNEL_DS);
-+    bytes = filp->f_op->write(filp, buf, len, &filp->f_pos);
-+    set_fs(oldfs);
-+
-+    /* close the file */
-+    fput(filp);
-+
-+    return bytes;
-+}
-+
-+#endif /* unused */
-+
---- /dev/null
-+++ b/fs/mini_fo/ChangeLog
-@@ -0,0 +1,281 @@
-+2006-01-24  Markus Klotzbuecher  <[email protected]>
-+
-+	* Add tons of ugly ifdefs to Ed L. Cashin's mutex patch to
-+          retain backwards compatibility.
-+
-+2006-01-24  Ed L. Cashin <[email protected]>
-+
-+	* Support for the new mutex infrastructure
-+	(7892f2f48d165a34b0b8130c8a195dfd807b8cb6)
-+
-+2005-10-15  Markus Klotzbuecher  <[email protected]>
-+
-+	* Bugfix for a serious memory leak in mini_fo_follow_link.
-+
-+2005-09-21  Markus Klotzbuecher  <mk@mary>
-+
-+	* new release 0.6.1
-+
-+	* fix of a compiler warning due to changes in 2.6.13
-+
-+2005-09-21  Klaus Wenninger  <[email protected]>
-+
-+	* file.c: readdir: fix for a bug that caused directory entries
-+          to show up twice when using storage filesystems such as
-+          minixfs or pramfs.
-+
-+2005-06-30  Eric Lammerts <[email protected]>
-+
-+	* fix for an oops when overwriting a binary thats beeing
-+          executed.
-+
-+2005-06-09    <mk@mary>
-+
-+	* Renamed overlay to mini_fo-overlay.
-+
-+	* Added mini_fo-merge script to allow merging of storage and base
-+	after making modifications.
-+
-+2005-05-22  root  <mk@mary>
-+
-+	* Added overlay script that allows to easily mount mini_fo ontop
-+	of a given base directory
-+
-+2005-05-10    <mk@mary>
-+
-+	* inode.c: xattr functions return -EOPNOSUPP instead of
-+          -ENOSUPP, what confuses "ls -l"
-+
-+	* Changed license from LGPL to GPL.
-+
-+2005-05-08  root  <mk@mary>
-+
-+	* Makefile: clean it up and added make install and make
-+          uninstall.
-+
-+2005-05-06    <mk@mary>
-+
-+	* merged devel branch back to main. [v0-6-0-pre3]
-+
-+	* removed unused files print.c and fist_ioctl. [devel-0-0-18]
-+
-+	* ioctl: removed fist_ioctl stuff, that is not needed for
-+          now.
-+
-+2005-05-03    <mk@mary>
-+
-+	* file.c: simplified mini_fo_open and mini_fo_setattr using
-+          new state changing functions. [devel-0-0-17]
-+
-+	* inode.c: Fixed getattr state bug (see below) in 2.4 function
-+          mini_fo_inode revalidate.
-+
-+	* inode.c: found an other bug in mini_fo_getattr. States are not
-+	  reliable in this function, as a file can be opened, unlinked and
-+	  the getattr function called. This results in a deleted dentry
-+	  with an inode. Fix is to ignore states and simply use the inode
-+	  available.
-+
-+2005-04-29    <mk@mary>
-+
-+	* file.c: Bugfix and cleanup in fasync and fsync. [devel-0-0-16]
-+
-+	* file.c: do not use mini_fo_lock so the generic version is
-+          used (I guess).
-+
-+	* inode.c: getattr, never call getattr on lower files, as this
-+          will cause the inum to change.
-+
-+	* inode.c: rename_reg_file renamed to rename_nondir, as it
-+          doesn't matter as long it't not a dir. Removed all
-+          rename_dev_file etc.
-+
-+	* tagged as devel-0-0-15
-+
-+	* inode.c: added support for chosing support for extended
-+          attrs at compile time by XATTR define in mini_fo.h .
-+
-+	* inode.c: fixed mini_fo_getattr to use mini_fo inode and not
-+          lower again, what avoids inode number changes that confused
-+          rm again. This is the proper solution.
-+
-+2005-04-24    <mk@mary>
-+
-+	* all files: updated Copyright notive to 2005. [devel-0-0-14]
-+
-+	* inode.c: fixed mini_fo_getattr to not change the inode
-+          number, even if lower files change.
-+
-+	* super.c: fixed a bug that caused deleted base file to show
-+          up suddenly after some time, or after creating a special
-+          file. The problem was that after some time or after special
-+          file creating sync_sb_inodes is called by the vfs, that
-+          called our mini_fo_put_inode. There was (wrongly) called
-+          __meta_put_lists, that nuked the lists, although the inode
-+          was going to continue its life. Moving __meta_put_lists to
-+          mini_fo_clear_inode, where an inode is really destroyed,
-+          solved the problem.
-+
-+
-+2005-04-23    <mk@mary>
-+
-+	* state.c, aux.c: more cleaning up and
-+          simplifications. [devel-0-0-13]
-+
-+	* inode.c: implemented mini_fo_getattr, that was required for
-+          2.6 because inode_revalidate has been remove there, and the
-+	  old "du" bug returned.
-+
-+
-+2005-04-20    <mk@mary>
-+
-+	* aux.c: get_neg_sto_dentry(): allow to be called for dentries
-+          in state UNMODIFIED, NON_EXISTANT _and_ DELETED.
-+
-+2005-04-19    <mk@mary>
-+
-+	* Fixed a bug under 2.6 that caused files deleted via mini_fo
-+          not to be deleted properly and therefore the fs filled up
-+          untill no memory was left. [devel-0-0-12]
-+
-+	* Added basic hard link support. This means that creating
-+          hardlinks will work, but existing ones will be treated as
-+          individual files. [devel-0-0-11]
-+
-+2005-04-17    <mk@mary>
-+
-+	* Bugfixes
-+
-+2005-04-13  root  <mk@mary>
-+
-+	* Added file state.c for the state transition
-+          functions. Doesn't work very well yet, though...
-+
-+2005-04-12    <mk@mary>
-+
-+	* Porting to 2.6 started, which is easier than expected, also
-+          due to Olivier previous work.
-+
-+2005-04-08    <mk@mary>
-+
-+	* Fixed the bug that caused du to return invalid sizes of
-+          directory trees. The problem was that
-+          mini_fo_inode_revalidate didn't always copy the attributes
-+          from the base inode properly.
-+
-+2005-04-01  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Merged devel branch back to main trunk and updated the
-+          RELEASE notes. This will be 0-6-0-pre1.
-+
-+2005-03-31  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Fixed some bugs in rename_reg_file, that only showed up in
-+          the kernel compile test. Kernel compiles cleanly ontop of
-+          mini_fo, now also make mrproper etc. work. Seems pretty stable.
-+
-+2005-03-28  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Many, many directory renaming bugfixes and a lot of other
-+          cleanup. Dir renaming seems to work relatively stable.
-+
-+2005-03-22  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Finished implementing lightweight directory renaming. Some
-+          basic testing indicates it works fine.
-+	  Next is to implement testcases for the testsuite and confirm
-+          everything is really working ok.
-+
-+2005-03-18  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Finished implementing meta.c stuff required for directory
-+          renaming.
-+
-+2005-03-17  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Fixed all compile warnings + an extremly old bug that
-+          somehow crept in while reworking the wol stuff to the META
-+          system. Turning on -Werror again... :-)
-+
-+	* Fixed some bugs in the new rename_reg_file function.
-+
-+	* Rewrote mini_fo rename and split it into several
-+          subfunctions, that handle the different types
-+          seperately. Rewrote the regular file function aswell, as it
-+          was implemented somewhat inefficient.
-+
-+2005-03-16  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Implemented new META subsystem, removed old WOL stuff in favor
-+	  if it.
-+
-+	* After some basic testing everything seems ok...
-+
-+2005-03-11  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Renaming a non regular file caused trouble because I always
-+	  tried to copy the contents. Now I only do this for regular
-+	  files. mini_fo_rename still isn't implemented properly, renaming
-+	  of device files, symlinks etc. results in a empty regular file
-+	  instead of the proper type.
-+
-+	* Directory renaming suddenly works! What a surprise! I guess
-+          this is because renaming is implemented as making a copy and
-+          removing the original. Still this might not work
-+          everywhere...
-+
-+2005-03-09  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Bugfix, when a mini_fo directory that exists in storage
-+  	  (state: MODIFIED, CREATED and DEL_REWRITTEN) is deleted, a
-+  	  possibly existing WOL file contained in it needs to be
-+  	  deleted too.
-+
-+	* Starting cleanup: defined state names in order to get rid of
-+          the state numbers.
-+
-+2005-03-08  Markus Klotzbuecher  <mk@chasey>
-+
-+	* Makefile fix, fist_ioctl was built against wrong sources if ARCH=um
-+
-+	* Fixed a bug in dentry.c, mini_fo_d_hash. In state 4 =
-+          DEL_REWRITTEN the hash was calculated from the base dentry,
-+          which was wrong and and caused assertions in
-+          __mini_fo_hidden_dentry to fail.
-+
-+2005-02-21    <mk@mary>
-+
-+	* Implemented directory deleting (inode.c)
-+
-+	* main.c: made mini_fo_parse_options a little more robust.
-+
-+2004-12-22    <mk@mary>
-+
-+	* Makefile cleanup and uml stuff, removed unneccessary files
-+
-+	* Created a new and hopefully more informative README
-+
-+	* CHANGELOG: created a new CHANGELOG and added old entries reversely
-+
-+
-+2004-10-24 Gleb Natapov <[email protected]>
-+
-+	* Fix: owner and group where not correctly copied from base to
-+          storage.
-+
-+
-+2004-10-05 Gleb Natapov <[email protected]>
-+
-+	* Implementation of fsync, fasync and lock mini_fo functions.
-+
-+
-+2004-09-29 Bob Lee <[email protected]>
-+
-+	* Fix of a serious pointer bug
-+
-+
-+2004-09-28 Gleb Natapov <[email protected]>
-+
-+	* Implementation of mini_fo_mknod and mini_fo_rename, support
-+          for device files.
-+
---- /dev/null
-+++ b/fs/mini_fo/dentry.c
-@@ -0,0 +1,244 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+/*
-+ * THIS IS A BOOLEAN FUNCTION: returns 1 if valid, 0 otherwise.
-+ */
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+mini_fo_d_revalidate(dentry_t *dentry, struct nameidata *nd)
-+#else
-+mini_fo_d_revalidate(dentry_t *dentry, int flags)
-+#endif
-+{
-+	int err1 = 1; /* valid = 1, invalid = 0 */
-+	int err2 = 1;
-+	dentry_t *hidden_dentry;
-+	dentry_t *hidden_sto_dentry;
-+
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	hidden_dentry  = dtohd(dentry);
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	if(hidden_dentry &&
-+	   hidden_dentry->d_op &&
-+	   hidden_dentry->d_op->d_revalidate) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		err1 = hidden_dentry->d_op->d_revalidate(hidden_dentry, nd);
-+#else
-+		err1 = hidden_dentry->d_op->d_revalidate(hidden_dentry, flags);
-+#endif
-+	}
-+	if(hidden_sto_dentry &&
-+	   hidden_sto_dentry->d_op &&
-+	   hidden_sto_dentry->d_op->d_revalidate) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		err2 = hidden_sto_dentry->d_op->d_revalidate(hidden_sto_dentry,
-+							     nd);
-+#else
-+		err2 = hidden_sto_dentry->d_op->d_revalidate(hidden_sto_dentry,
-+							     flags);
-+#endif
-+	}
-+
-+	/* mk: if one of the lower level dentries are valid,
-+	 * the mini_fo dentry is too.
-+	 */
-+	return (err1 || err2);
-+}
-+
-+
-+STATIC int
-+mini_fo_d_hash(dentry_t *dentry, qstr_t *name)
-+{
-+	int err = 0;
-+	dentry_t *hidden_dentry;
-+	dentry_t *hidden_sto_dentry;
-+
-+	/* hidden_dentry = mini_fo_hidden_dentry(dentry);
-+	 * hidden_sto_dentry = mini_fo_hidden_sto_dentry(dentry); */
-+
-+	/* state 1, 3, 4, 5: build the hash for the storage dentry */
-+	if((dtopd(dentry)->state == MODIFIED) ||
-+	   (dtopd(dentry)->state == CREATED) ||
-+	   (dtopd(dentry)->state == DEL_REWRITTEN) ||
-+	   (dtopd(dentry)->state == DELETED)) {
-+		hidden_sto_dentry = dtohd2(dentry);
-+		if(hidden_sto_dentry &&
-+		   hidden_sto_dentry->d_op &&
-+		   hidden_sto_dentry->d_op->d_hash) {
-+			err = hidden_sto_dentry->d_op->d_hash(hidden_sto_dentry, name);
-+		}
-+		goto out;
-+	}
-+	/* state 2: build the hash for the base dentry */
-+	if(dtopd(dentry)->state == UNMODIFIED) {
-+		hidden_dentry = dtohd(dentry);
-+		if(hidden_dentry &&
-+		   hidden_dentry->d_op &&
-+		   hidden_dentry->d_op->d_hash) {
-+			err = hidden_dentry->d_op->d_hash(hidden_dentry, name);
-+		}
-+		goto out;
-+	}
-+	/* state 6: build hash for the dentry that exists */
-+	if(dtopd(dentry)->state == NON_EXISTANT) {
-+		hidden_sto_dentry = dtohd2(dentry);
-+		if(hidden_sto_dentry &&
-+		   hidden_sto_dentry->d_op &&
-+		   hidden_sto_dentry->d_op->d_hash) {
-+			err = hidden_sto_dentry->d_op->d_hash(hidden_sto_dentry, name);
-+			goto out;
-+		}
-+		hidden_dentry = dtohd(dentry);
-+		if(hidden_dentry &&
-+		   hidden_dentry->d_op &&
-+		   hidden_dentry->d_op->d_hash) {
-+			err = hidden_dentry->d_op->d_hash(hidden_dentry, name);
-+			goto out;
-+		}
-+	}
-+
-+	printk(KERN_CRIT "mini_fo: d_hash: invalid state detected.\n");
-+
-+ out:
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_d_compare(dentry_t *dentry, qstr_t *a, qstr_t *b)
-+{
-+	int err;
-+	dentry_t *hidden_dentry=NULL;
-+
-+	/* hidden_dentry = mini_fo_hidden_dentry(dentry); */
-+	if(dtohd2(dentry))
-+		hidden_dentry = dtohd2(dentry);
-+	else if(dtohd(dentry))
-+		hidden_dentry = dtohd(dentry);
-+
-+	if (hidden_dentry && hidden_dentry->d_op && hidden_dentry->d_op->d_compare) {
-+		err = hidden_dentry->d_op->d_compare(hidden_dentry, a, b);
-+	} else {
-+		err = ((a->len != b->len) || memcmp(a->name, b->name, b->len));
-+	}
-+
-+	return err;
-+}
-+
-+
-+int
-+mini_fo_d_delete(dentry_t *dentry)
-+{
-+	dentry_t *hidden_dentry;
-+	dentry_t *hidden_sto_dentry;
-+	int err = 0;
-+
-+	/* this could be a negative dentry, so check first */
-+	if (!dtopd(dentry)) {
-+		printk(KERN_CRIT "mini_fo_d_delete: negative dentry passed.\n");
-+		goto out;
-+	}
-+	hidden_dentry = dtohd(dentry);
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	if(hidden_dentry) {
-+		if(hidden_dentry->d_op &&
-+		   hidden_dentry->d_op->d_delete) {
-+			err = hidden_dentry->d_op->d_delete(hidden_dentry);
-+		}
-+	}
-+	if(hidden_sto_dentry) {
-+		if(hidden_sto_dentry->d_op &&
-+		   hidden_sto_dentry->d_op->d_delete) {
-+			err = hidden_sto_dentry->d_op->d_delete(hidden_sto_dentry);
-+		}
-+	}
-+
-+ out:
-+	return err;
-+}
-+
-+
-+void
-+mini_fo_d_release(dentry_t *dentry)
-+{
-+	dentry_t *hidden_dentry;
-+	dentry_t *hidden_sto_dentry;
-+
-+
-+	/* this could be a negative dentry, so check first */
-+	if (!dtopd(dentry)) {
-+		printk(KERN_CRIT "mini_fo_d_release: no private data.\n");
-+		goto out;
-+	}
-+	hidden_dentry = dtohd(dentry);
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	if(hidden_dentry) {
-+		/* decrement hidden dentry's counter and free its inode */
-+		dput(hidden_dentry);
-+	}
-+	if(hidden_sto_dentry) {
-+                /* decrement hidden dentry's counter and free its inode */
-+		dput(hidden_sto_dentry);
-+	}
-+
-+	/* free private data (mini_fo_dentry_info) here */
-+	kfree(dtopd(dentry));
-+	__dtopd(dentry) = NULL;	/* just to be safe */
-+ out:
-+	return;
-+}
-+
-+
-+/*
-+ * we don't really need mini_fo_d_iput, because dentry_iput will call iput() if
-+ * mini_fo_d_iput is not defined. We left this implemented for ease of
-+ * tracing/debugging.
-+ */
-+void
-+mini_fo_d_iput(dentry_t *dentry, inode_t *inode)
-+{
-+	iput(inode);
-+}
-+
-+
-+struct dentry_operations mini_fo_dops = {
-+	d_revalidate:	mini_fo_d_revalidate,
-+	d_hash:		mini_fo_d_hash,
-+	d_compare:		mini_fo_d_compare,
-+	d_release:		mini_fo_d_release,
-+	d_delete:		mini_fo_d_delete,
-+	d_iput:		mini_fo_d_iput,
-+};
---- /dev/null
-+++ b/fs/mini_fo/file.c
-@@ -0,0 +1,713 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
-+
-+/*******************
-+ * File Operations *
-+ *******************/
-+
-+STATIC loff_t
-+mini_fo_llseek(file_t *file, loff_t offset, int origin)
-+{
-+	loff_t err;
-+	file_t *hidden_file = NULL;
-+
-+	if(S_ISDIR(file->f_dentry->d_inode->i_mode)) {
-+		/* Check if trying to llseek from a directory */
-+		err = -EISDIR;
-+		goto out;
-+	}
-+	if (ftopd(file) != NULL) {
-+		if(ftohf2(file)) {
-+			hidden_file = ftohf2(file);
-+		} else {
-+			hidden_file = ftohf(file);
-+		}
-+	}
-+
-+	/* always set hidden position to this one */
-+	hidden_file->f_pos = file->f_pos;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+	memcpy(&(hidden_file->f_ra),
-+	       &(file->f_ra),
-+	       sizeof(struct file_ra_state));
-+#else
-+	if (file->f_reada) { /* update readahead information if needed */
-+		hidden_file->f_reada = file->f_reada;
-+		hidden_file->f_ramax = file->f_ramax;
-+		hidden_file->f_raend = file->f_raend;
-+		hidden_file->f_ralen = file->f_ralen;
-+		hidden_file->f_rawin = file->f_rawin;
-+	}
-+#endif
-+	if (hidden_file->f_op && hidden_file->f_op->llseek)
-+		err = hidden_file->f_op->llseek(hidden_file, offset, origin);
-+	else
-+		err = generic_file_llseek(hidden_file, offset, origin);
-+
-+	if (err < 0)
-+		goto out;
-+
-+	if (err != file->f_pos) {
-+		file->f_pos = err;
-+		// ION maybe this?
-+		// 	file->f_pos = hidden_file->f_pos;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+		file->f_reada = 0;
-+#endif
-+		file->f_version++;
-+	}
-+
-+ out:
-+	return err;
-+}
-+
-+
-+/* mk: fanout capable */
-+STATIC ssize_t
-+mini_fo_read(file_t *file, char *buf, size_t count, loff_t *ppos)
-+{
-+	int err = -EINVAL;
-+	file_t *hidden_file = NULL;
-+	loff_t pos = *ppos;
-+
-+	if(S_ISDIR(file->f_dentry->d_inode->i_mode)) {
-+		/* Check if trying to read from a directory */
-+		/* printk(KERN_CRIT "mini_fo_read: ERROR: trying to read data from a directory.\n"); */
-+		err = -EISDIR;
-+		goto out;
-+	}
-+
-+	if (ftopd(file) != NULL) {
-+		if(ftohf2(file)) {
-+			hidden_file = ftohf2(file);
-+		} else {
-+			hidden_file = ftohf(file);
-+		}
-+	}
-+
-+	if (!hidden_file->f_op || !hidden_file->f_op->read)
-+		goto out;
-+
-+	err = hidden_file->f_op->read(hidden_file, buf, count, &pos);
-+	*ppos = pos;
-+
-+	if (err >= 0) {
-+		/* atime should also be updated for reads of size zero or more */
-+		fist_copy_attr_atime(file->f_dentry->d_inode,
-+				     hidden_file->f_dentry->d_inode);
-+	}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+	/*
-+	 * MAJOR HACK
-+	 * because pread() does not have any way to tell us that it is
-+	 * our caller, then we don't know for sure if we have to update
-+	 * the file positions.  This hack relies on read() having passed us
-+	 * the "real" pointer of its struct file's f_pos field.
-+	 */
-+	if (ppos == &file->f_pos)
-+		hidden_file->f_pos = *ppos = pos;
-+	if (hidden_file->f_reada) { /* update readahead information if needed */
-+		file->f_reada = hidden_file->f_reada;
-+		file->f_ramax = hidden_file->f_ramax;
-+		file->f_raend = hidden_file->f_raend;
-+		file->f_ralen = hidden_file->f_ralen;
-+		file->f_rawin = hidden_file->f_rawin;
-+	}
-+#else
-+	memcpy(&(file->f_ra),&(hidden_file->f_ra),sizeof(struct file_ra_state));
-+#endif
-+
-+ out:
-+	return err;
-+}
-+
-+
-+/* this mini_fo_write() does not modify data pages! */
-+STATIC ssize_t
-+mini_fo_write(file_t *file, const char *buf, size_t count, loff_t *ppos)
-+{
-+	int err = -EINVAL;
-+	file_t *hidden_file = NULL;
-+	inode_t *inode;
-+	inode_t *hidden_inode;
-+	loff_t pos = *ppos;
-+
-+	/* mk: fan out: */
-+	if (ftopd(file) != NULL) {
-+		if(ftohf2(file)) {
-+			hidden_file = ftohf2(file);
-+		} else {
-+			/* This is bad! We have no storage file to write to. This
-+			 * should never happen because if a file is opened for
-+			 * writing, a copy should have been made earlier.
-+			 */
-+			printk(KERN_CRIT "mini_fo: write : ERROR, no storage file to write.\n");
-+			err = -EINVAL;
-+			goto out;
-+		}
-+	}
-+
-+	inode = file->f_dentry->d_inode;
-+	hidden_inode = itohi2(inode);
-+	if(!hidden_inode) {
-+		printk(KERN_CRIT "mini_fo: write: no sto inode found, not good.\n");
-+		goto out;
-+	}
-+
-+	if (!hidden_file->f_op || !hidden_file->f_op->write)
-+		goto out;
-+
-+	/* adjust for append -- seek to the end of the file */
-+	if (file->f_flags & O_APPEND)
-+		pos = inode->i_size;
-+
-+	err = hidden_file->f_op->write(hidden_file, buf, count, &pos);
-+
-+	/*
-+	 * copy ctime and mtime from lower layer attributes
-+	 * atime is unchanged for both layers
-+	 */
-+	if (err >= 0)
-+		fist_copy_attr_times(inode, hidden_inode);
-+
-+	*ppos = pos;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+	/*
-+	 * XXX: MAJOR HACK
-+	 *
-+	 * because pwrite() does not have any way to tell us that it is
-+	 * our caller, then we don't know for sure if we have to update
-+	 * the file positions.  This hack relies on write() having passed us
-+	 * the "real" pointer of its struct file's f_pos field.
-+	 */
-+	if (ppos == &file->f_pos)
-+		hidden_file->f_pos = *ppos = pos;
-+#endif
-+	/* update this inode's size */
-+	if (pos > inode->i_size)
-+		inode->i_size = pos;
-+
-+ out:
-+	return err;
-+}
-+
-+/* Global variable to hold a file_t pointer.
-+ * This serves to allow mini_fo_filldir function to know which file is
-+ * beeing read, which is required for two reasons:
-+ *
-+ *   - be able to call wol functions in order to avoid listing deleted
-+ *     base files.
-+ *   - if we're reading a directory which is in state 1, we need to
-+ *     maintain a list (in mini_fo_filldir) of which files allready
-+ *     have been copied to userspace,to detect files existing in base
-+ *     and storage and not list them twice.
-+ */
-+filldir_t mini_fo_filldir_orig;
-+file_t *mini_fo_filldir_file;
-+
-+/* mainly copied from fs/readdir.c */
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+mini_fo_filldir(void * __buf, const char * name, int namlen, loff_t offset,
-+		  u64 ino, unsigned int d_type)
-+#else
-+mini_fo_filldir(void * __buf, const char * name, int namlen, loff_t offset,
-+		  ino_t ino, unsigned int d_type)
-+#endif
-+{
-+	struct getdents_callback * buf = (struct getdents_callback *) __buf;
-+	file_t* file = mini_fo_filldir_file;
-+
-+	/* In theses states we filter meta files in storage (WOL) */
-+	if(file && (dtopd(file->f_dentry)->state == MODIFIED ||
-+		    dtopd(file->f_dentry)->state == CREATED ||
-+		    dtopd(file->f_dentry)->state == DEL_REWRITTEN)) {
-+
-+		int tmp = strlen(META_FILENAME);
-+		if(tmp  == namlen) {
-+			if(!strncmp(name, META_FILENAME, namlen))
-+				return 0;
-+		}
-+	}
-+
-+	/* check if we are merging the contents of storage and base */
-+	if(file && dtopd(file->f_dentry)->state == MODIFIED) {
-+		/* check if we are still reading storage contents, if
-+		 * yes, we just save the name of the file for duplicate
-+		 * checking later. */
-+
-+		if(!ftopd(file)->rd.sto_done) {
-+			/* put file into ndl list */
-+			if(ndl_add_entry(&ftopd(file)->rd, name, namlen))
-+				printk(KERN_CRIT "mini_fo_filldir: Error adding to ndl.\n");
-+		} else {
-+			/* check if file has been deleted */
-+			if(meta_check_d_entry(file->f_dentry, name, namlen))
-+				return 0;
-+
-+			/* do duplicate checking */
-+			if(ndl_check_entry(&ftopd(file)->rd, name, namlen))
-+				return 0;
-+		}
-+	}
-+
-+	return mini_fo_filldir_orig(buf, name, namlen, offset, ino, d_type);
-+}
-+
-+
-+STATIC int
-+mini_fo_readdir(file_t *file, void *dirent, filldir_t filldir)
-+{
-+	int err = 0;/* mk: ??? -ENOTDIR; */
-+	file_t *hidden_file = NULL;
-+	file_t *hidden_sto_file = NULL;
-+	inode_t *inode;
-+	struct getdents_callback *buf;
-+	int oldcount;
-+
-+#if defined(FIST_FILTER_NAME) || defined(FIST_FILTER_SCA)
-+	struct mini_fo_getdents_callback buf;
-+#endif /* FIST_FILTER_NAME || FIST_FILTER_SCA */
-+
-+	buf = (struct getdents_callback *) dirent;
-+	oldcount = buf->count;
-+	inode = file->f_dentry->d_inode;
-+	mini_fo_filldir_file = file;
-+	mini_fo_filldir_orig = filldir;
-+
-+	ftopd(file)->rd.sto_done = 0;
-+	do {
-+		if (ftopd(file) != NULL) {
-+			if(ftohf2(file)) {
-+				hidden_sto_file = ftohf2(file);
-+				err = vfs_readdir(hidden_sto_file, mini_fo_filldir, dirent);
-+				file->f_pos = hidden_sto_file->f_pos;
-+				if (err > 0)
-+					fist_copy_attr_atime(inode, hidden_sto_file->f_dentry->d_inode);
-+				/* not finshed yet, we'll be called again */
-+				if (buf->count != oldcount)
-+					break;
-+			}
-+
-+			ftopd(file)->rd.sto_done = 1;
-+
-+			if(ftohf(file)) {
-+				hidden_file = ftohf(file);
-+				err = vfs_readdir(hidden_file, mini_fo_filldir, dirent);
-+				file->f_pos = hidden_file->f_pos;
-+				if (err > 0)
-+					fist_copy_attr_atime(inode, hidden_file->f_dentry->d_inode);
-+			}
-+
-+		}
-+	} while (0);
-+
-+	/* mk:
-+	 * we need to check if all the directory data has been copied to userspace,
-+	 * or if we will be called again by userspace to complete the operation.
-+	 */
-+	if(buf->count == oldcount) {
-+		ndl_put_list(&ftopd(file)->rd);
-+	}
-+
-+	/* unset this, safe */
-+	mini_fo_filldir_file = NULL;
-+	return err;
-+}
-+
-+
-+STATIC unsigned int
-+mini_fo_poll(file_t *file, poll_table *wait)
-+{
-+	unsigned int mask = DEFAULT_POLLMASK;
-+	file_t *hidden_file = NULL;
-+
-+	if (ftopd(file) != NULL) {
-+		if(ftohf2(file)) {
-+			hidden_file = ftohf2(file);
-+		} else {
-+			hidden_file = ftohf(file);
-+		}
-+	}
-+
-+	if (!hidden_file->f_op || !hidden_file->f_op->poll)
-+		goto out;
-+
-+	mask = hidden_file->f_op->poll(hidden_file, wait);
-+
-+ out:
-+	return mask;
-+}
-+
-+/* FIST-LITE special version of mmap */
-+STATIC int
-+mini_fo_mmap(file_t *file, vm_area_t *vma)
-+{
-+	int err = 0;
-+	file_t *hidden_file = NULL;
-+
-+	/* fanout capability */
-+	if (ftopd(file) != NULL) {
-+		if(ftohf2(file)) {
-+			hidden_file = ftohf2(file);
-+		} else {
-+			hidden_file = ftohf(file);
-+		}
-+	}
-+
-+	ASSERT(hidden_file != NULL);
-+	ASSERT(hidden_file->f_op != NULL);
-+	ASSERT(hidden_file->f_op->mmap != NULL);
-+
-+	vma->vm_file = hidden_file;
-+	err = hidden_file->f_op->mmap(hidden_file, vma);
-+	get_file(hidden_file); /* make sure it doesn't get freed on us */
-+	fput(file);	       /* no need to keep extra ref on ours */
-+
-+	return err;
-+}
-+
-+
-+
-+STATIC int
-+mini_fo_open(inode_t *inode, file_t *file)
-+{
-+	int err = 0;
-+ 	int hidden_flags;
-+	file_t *hidden_file = NULL;
-+	dentry_t *hidden_dentry = NULL;
-+
-+	/* fanout stuff */
-+	file_t *hidden_sto_file = NULL;
-+	dentry_t *hidden_sto_dentry = NULL;
-+
-+	__ftopd(file) =
-+		kmalloc(sizeof(struct mini_fo_file_info), GFP_KERNEL);
-+	if (!ftopd(file)) {
-+		err = -ENOMEM;
-+		goto out;
-+	}
-+
-+	/* init the readdir_helper structure */
-+	INIT_LIST_HEAD(&ftopd(file)->rd.ndl_list);
-+	ftopd(file)->rd.ndl_size = 0;
-+
-+	/* In certain paths this could stay uninitalized and cause trouble */
-+	ftohf(file) = NULL;
-+	ftohf2(file) = NULL;
-+	hidden_flags = file->f_flags;
-+
-+	/* create storage files? */
-+	if(dtost(file->f_dentry) == UNMODIFIED) {
-+		if(!IS_WRITE_FLAG(file->f_flags)) {
-+			hidden_dentry = dtohd(file->f_dentry);
-+			dget(hidden_dentry);
-+			/* dentry_open will decrement mnt refcnt if err.
-+			 * otherwise fput() will do an mntput() for us upon file close. */
-+			mntget(stopd(inode->i_sb)->hidden_mnt);
-+			hidden_file = dentry_open(hidden_dentry,
-+						  stopd(inode->i_sb)->hidden_mnt,
-+						  hidden_flags);
-+			if (IS_ERR(hidden_file)) {
-+				err = PTR_ERR(hidden_file);
-+				dput(hidden_dentry);
-+				goto out;
-+			}
-+			ftohf(file) = hidden_file;	/* link two files */
-+			goto out;
-+		}
-+		else {
-+			if(S_ISDIR(file->f_dentry->d_inode->i_mode)) {
-+				err = dir_unmod_to_mod(file->f_dentry);
-+			} else
-+				err = nondir_unmod_to_mod(file->f_dentry, 1);
-+
-+			if (err) {
-+				printk("mini_fo_open: ERROR creating storage file.\n");
-+				goto out;
-+			}
-+		}
-+	}
-+	hidden_sto_dentry = dtohd2(file->f_dentry);
-+	dget(hidden_sto_dentry);
-+
-+	if(dtopd(file->f_dentry)->state == MODIFIED) {
-+		/* Directorys are special, interpose on both lower level files */
-+		if(S_ISDIR(itohi(inode)->i_mode)) {
-+			/* check for invalid file types of lower level files */
-+			if(!(S_ISDIR(itohi(inode)->i_mode) && S_ISDIR(itohi2(inode)->i_mode))) {
-+				printk(KERN_CRIT "mini_fo_open: meta data corruption detected.\n");
-+				dput(hidden_sto_dentry);
-+				err = -EINVAL;
-+				goto out;
-+			}
-+
-+			/* lower level directorys are ok, open the base file */
-+			hidden_dentry = dtohd(file->f_dentry);
-+			dget(hidden_dentry);
-+
-+			mntget(stopd(inode->i_sb)->hidden_mnt);
-+			hidden_file = dentry_open(hidden_dentry,
-+						  stopd(inode->i_sb)->hidden_mnt,
-+						  hidden_flags);
-+			if (IS_ERR(hidden_file)) {
-+				err = PTR_ERR(hidden_file);
-+				dput(hidden_dentry);
-+				dput(hidden_sto_dentry);
-+				goto out;
-+			}
-+			ftohf(file) = hidden_file; /* link the two files */
-+		}
-+	}
-+
-+	if(!exists_in_storage(file->f_dentry)) {
-+		printk(KERN_CRIT "mini_fo_open: invalid file state detected.\n");
-+		err = -EINVAL;
-+		dput(hidden_sto_dentry);
-+
-+		/* If the base file has been opened, we need to close it here */
-+		if(ftohf(file)) {
-+			if (hidden_file->f_op && hidden_file->f_op->flush)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+				hidden_file->f_op->flush(hidden_file, NULL);
-+#else
-+				hidden_file->f_op->flush(hidden_file);
-+#endif
-+			dput(hidden_dentry);
-+		}
-+		goto out;
-+	}
-+
-+	/* ok, now we can safely open the storage file */
-+	mntget(stopd(inode->i_sb)->hidden_mnt2);
-+	hidden_sto_file = dentry_open(hidden_sto_dentry,
-+				      stopd(inode->i_sb)->hidden_mnt2,
-+				      hidden_flags);
-+
-+	/* dentry_open dputs the dentry if it fails */
-+	if (IS_ERR(hidden_sto_file)) {
-+		err = PTR_ERR(hidden_sto_file);
-+		/* close base file if open */
-+		if(ftohf(file)) {
-+			if (hidden_file->f_op && hidden_file->f_op->flush)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+				hidden_file->f_op->flush(hidden_file, NULL);
-+#else
-+				hidden_file->f_op->flush(hidden_file);
-+#endif
-+			dput(hidden_dentry);
-+		}
-+		goto out;
-+	}
-+	ftohf2(file) = hidden_sto_file; /* link storage file */
-+
-+ out:
-+	if (err < 0 && ftopd(file)) {
-+		kfree(ftopd(file));
-+	}
-+	return err;
-+}
-+
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+mini_fo_flush(file_t *file, fl_owner_t id)
-+#else
-+mini_fo_flush(file_t *file)
-+#endif
-+{
-+	int err1 = 0;		/* assume ok (see open.c:close_fp) */
-+	int err2 = 0;
-+	file_t *hidden_file = NULL;
-+
-+	check_mini_fo_file(file);
-+
-+	/* mk: we don't do any state checking here, as its not worth the time.
-+	 * Just flush the lower level files if they exist.
-+	 */
-+	if(ftopd(file) != NULL) {
-+		if(ftohf(file) != NULL) {
-+			hidden_file = ftohf(file);
-+			if (hidden_file->f_op && hidden_file->f_op->flush)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+				err1 = hidden_file->f_op->flush(hidden_file, id);
-+#else
-+				err1 = hidden_file->f_op->flush(hidden_file);
-+#endif
-+		}
-+		if(ftohf2(file) != NULL) {
-+			hidden_file = ftohf2(file);
-+			if (hidden_file->f_op && hidden_file->f_op->flush)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+				err2 = hidden_file->f_op->flush(hidden_file, id);
-+#else
-+				err2 = hidden_file->f_op->flush(hidden_file);
-+#endif
-+		}
-+	}
-+	return (err1 | err2);
-+}
-+
-+
-+STATIC int
-+mini_fo_release(inode_t *inode, file_t *file)
-+{
-+	int err = 0;
-+	file_t *hidden_file = NULL;
-+
-+	if (ftopd(file) != NULL) {
-+		if(ftohf(file)) {
-+			hidden_file = ftohf(file);
-+			fput(hidden_file);
-+		}
-+		if(ftohf2(file)) {
-+			hidden_file = ftohf2(file);
-+			fput(hidden_file);
-+		}
-+		kfree(ftopd(file));
-+	}
-+	return err;
-+}
-+
-+STATIC int
-+mini_fo_fsync(file_t *file, dentry_t *dentry, int datasync)
-+{
-+	int err1 = 0;
-+	int err2 = 0;
-+	file_t *hidden_file = NULL;
-+	dentry_t *hidden_dentry;
-+
-+	check_mini_fo_file(file);
-+
-+	if ((hidden_file = ftohf(file)) != NULL) {
-+		hidden_dentry = dtohd(dentry);
-+		if (hidden_file->f_op && hidden_file->f_op->fsync) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+			mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+			down(&hidden_dentry->d_inode->i_sem);
-+#endif
-+			err1 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+			mutex_unlock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+			up(&hidden_dentry->d_inode->i_sem);
-+#endif
-+		}
-+	}
-+
-+	if ((hidden_file = ftohf2(file)) != NULL) {
-+		hidden_dentry = dtohd2(dentry);
-+		if (hidden_file->f_op && hidden_file->f_op->fsync) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+			mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+			down(&hidden_dentry->d_inode->i_sem);
-+#endif
-+			err2 = hidden_file->f_op->fsync(hidden_file, hidden_dentry, datasync);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+			mutex_unlock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+			up(&hidden_dentry->d_inode->i_sem);
-+#endif
-+		}
-+	}
-+	else
-+		goto err;
-+
-+err:
-+	return (err1 || err2);
-+}
-+
-+
-+STATIC int
-+mini_fo_fasync(int fd, file_t *file, int flag)
-+{
-+	int err1 = 0;
-+	int err2 = 0;
-+
-+	file_t *hidden_file = NULL;
-+
-+	check_mini_fo_file(file);
-+
-+	if((hidden_file = ftohf(file)) != NULL) {
-+		err1 = hidden_file->f_op->fasync(fd, hidden_file, flag);
-+	}
-+	if((hidden_file = ftohf2(file)) != NULL) {
-+		err2 = hidden_file->f_op->fasync(fd, hidden_file, flag);
-+	}
-+
-+	return (err1 || err2);
-+}
-+
-+
-+
-+struct file_operations mini_fo_dir_fops =
-+	{
-+		read:	generic_read_dir,
-+		write:	mini_fo_write,
-+		readdir: mini_fo_readdir,
-+		poll:	mini_fo_poll,
-+		/* ioctl:	mini_fo_ioctl, */
-+		mmap:	mini_fo_mmap,
-+		open:	mini_fo_open,
-+		flush:	mini_fo_flush,
-+		release: mini_fo_release,
-+		fsync:	mini_fo_fsync,
-+		fasync:	mini_fo_fasync,
-+		/* not needed lock:	mini_fo_lock, */
-+		/* not needed: readv */
-+		/* not needed: writev */
-+		/* not implemented: sendpage */
-+		/* not implemented: get_unmapped_area */
-+	};
-+
-+struct file_operations mini_fo_main_fops =
-+	{
-+		llseek:	mini_fo_llseek,
-+		read:	mini_fo_read,
-+		write:	mini_fo_write,
-+		readdir: mini_fo_readdir,
-+		poll:	mini_fo_poll,
-+		/* ioctl:	mini_fo_ioctl, */
-+		mmap:	mini_fo_mmap,
-+		open:	mini_fo_open,
-+		flush:	mini_fo_flush,
-+		release: mini_fo_release,
-+		fsync:	mini_fo_fsync,
-+		fasync:	mini_fo_fasync,
-+		/* not needed: lock:	mini_fo_lock, */
-+		/* not needed: readv */
-+		/* not needed: writev */
-+		/* not implemented: sendpage */
-+		/* not implemented: get_unmapped_area */
-+	};
---- /dev/null
-+++ b/fs/mini_fo/fist.h
-@@ -0,0 +1,254 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifndef __FIST_H_
-+#define __FIST_H_
-+
-+/*
-+ * KERNEL ONLY CODE:
-+ */
-+#ifdef __KERNEL__
-+#include <linux/version.h>
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
-+#include <generated/autoconf.h>
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
-+#include <linux/autoconf.h>
-+#else
-+#include <linux/config.h>
-+#endif
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+#ifdef CONFIG_MODVERSIONS
-+# define MODVERSIONS
-+# include <linux/modversions.h>
-+#endif /* CONFIG_MODVERSIONS */
-+#endif /* KERNEL_VERSION < 2.6.0 */
-+#include <linux/sched.h>
-+#include <linux/kernel.h>
-+#include <linux/mm.h>
-+#include <linux/string.h>
-+#include <linux/stat.h>
-+#include <linux/errno.h>
-+#include <linux/wait.h>
-+#include <linux/limits.h>
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+#include <linux/locks.h>
-+#else
-+#include <linux/buffer_head.h>
-+#include <linux/pagemap.h>
-+#include <linux/namei.h>
-+#include <linux/module.h>
-+#include <linux/mount.h>
-+#include <linux/page-flags.h>
-+#include <linux/writeback.h>
-+#include <linux/statfs.h>
-+#endif
-+#include <linux/smp.h>
-+#include <linux/smp_lock.h>
-+#include <linux/file.h>
-+#include <linux/slab.h>
-+#include <linux/vmalloc.h>
-+#include <linux/poll.h>
-+#include <linux/list.h>
-+#include <linux/init.h>
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
-+#include <linux/xattr.h>
-+#endif
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#include <linux/security.h>
-+#endif
-+
-+#include <linux/swap.h>
-+
-+#include <asm/system.h>
-+/* #include <asm/segment.h> */
-+#include <asm/mman.h>
-+#include <linux/seq_file.h>
-+
-+/*
-+ * MACROS:
-+ */
-+
-+/* those mapped to ATTR_* were copied from linux/fs.h */
-+#define FA_MODE		ATTR_MODE
-+#define FA_UID		ATTR_UID
-+#define FA_GID		ATTR_GID
-+#define FA_SIZE		ATTR_SIZE
-+#define FA_ATIME	ATTR_ATIME
-+#define FA_MTIME	ATTR_MTIME
-+#define FA_CTIME	ATTR_CTIME
-+#define FA_ATIME_SET	ATTR_ATIME_SET
-+#define FA_MTIME_SET	ATTR_MTIME_SET
-+#define FA_FORCE	ATTR_FORCE
-+#define FA_ATTR_FLAGS	ATTR_ATTR_FLAG
-+
-+/* must be greater than all other ATTR_* flags! */
-+#define FA_NLINK	2048
-+#define FA_BLKSIZE	4096
-+#define FA_BLOCKS	8192
-+#define FA_TIMES	(FA_ATIME|FA_MTIME|FA_CTIME)
-+#define FA_ALL		0
-+
-+/* macros to manage changes between kernels */
-+#define INODE_DATA(i)	(&(i)->i_data)
-+
-+#define MIN(x,y) ((x < y) ? (x) : (y))
-+#define MAX(x,y) ((x > y) ? (x) : (y))
-+#define MAXPATHLEN PATH_MAX
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5)
-+# define lookup_one_len(a,b,c) lookup_one(a,b)
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,5) */
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,8)
-+# define generic_file_llseek default_llseek
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,8) */
-+
-+#ifndef SEEK_SET
-+# define SEEK_SET 0
-+#endif /* not SEEK_SET */
-+
-+#ifndef SEEK_CUR
-+# define SEEK_CUR 1
-+#endif /* not SEEK_CUR */
-+
-+#ifndef SEEK_END
-+# define SEEK_END 2
-+#endif /* not SEEK_END */
-+
-+#ifndef DEFAULT_POLLMASK
-+# define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
-+#endif /* not DEFAULT_POLLMASK */
-+
-+/* XXX: fix this so fistgen generates kfree() code directly */
-+#define kfree_s(a,b) kfree(a)
-+
-+/*
-+ * TYPEDEFS:
-+ */
-+typedef struct dentry dentry_t;
-+typedef struct file file_t;
-+typedef struct inode inode_t;
-+typedef inode_t vnode_t;
-+typedef struct page page_t;
-+typedef struct qstr qstr_t;
-+typedef struct super_block super_block_t;
-+typedef super_block_t vfs_t;
-+typedef struct vm_area_struct vm_area_t;
-+
-+
-+/*
-+ * EXTERNALS:
-+ */
-+
-+#define FPPF(str,page) printk("PPF %s 0x%x/%d: Lck:%d Err:%d Ref:%d Upd:%d Other::%d:%d:%d:%d:\n", \
-+		str, \
-+		(int) page, \
-+		(int) page->index, \
-+		(PageLocked(page) ? 1 : 0), \
-+		(PageError(page) ? 1 : 0), \
-+		(PageReferenced(page) ? 1 : 0), \
-+		(Page_Uptodate(page) ? 1 : 0), \
-+		(PageDecrAfter(page) ? 1 : 0), \
-+		(PageSlab(page) ? 1 : 0), \
-+		(PageSwapCache(page) ? 1 : 0), \
-+		(PageReserved(page) ? 1 : 0) \
-+		)
-+#define EZKDBG printk("EZK %s:%d:%s\n",__FILE__,__LINE__,__FUNCTION__)
-+#if 0
-+# define EZKDBG1 printk("EZK %s:%d\n",__FILE__,__LINE__)
-+#else
-+# define EZKDBG1
-+#endif
-+
-+extern int fist_get_debug_value(void);
-+extern int fist_set_debug_value(int val);
-+#if 0 /* mini_fo doesn't need these */
-+extern void fist_dprint_internal(int level, char *str,...);
-+extern void fist_print_dentry(char *str, const dentry_t *dentry);
-+extern void fist_print_inode(char *str, const inode_t *inode);
-+extern void fist_print_file(char *str, const file_t *file);
-+extern void fist_print_buffer_flags(char *str, struct buffer_head *buffer);
-+extern void fist_print_page_flags(char *str, page_t *page);
-+extern void fist_print_page_bytes(char *str, page_t *page);
-+extern void fist_print_pte_flags(char *str, const page_t *page);
-+extern void fist_checkinode(inode_t *inode, char *msg);
-+extern void fist_print_sb(char *str, const super_block_t *sb);
-+
-+/* §$% by mk: special debug functions */
-+extern void fist_mk_print_dentry(char *str, const dentry_t *dentry);
-+extern void fist_mk_print_inode(char *str, const inode_t *inode);
-+
-+extern char *add_indent(void);
-+extern char *del_indent(void);
-+#endif/* mini_fo doesn't need these */
-+
-+
-+#define STATIC
-+#define ASSERT(EX)	\
-+do {	\
-+    if (!(EX)) {	\
-+	printk(KERN_CRIT "ASSERTION FAILED: %s at %s:%d (%s)\n", #EX,	\
-+	       __FILE__, __LINE__, __FUNCTION__);	\
-+	(*((char *)0))=0;	\
-+    }	\
-+} while (0)
-+/* same ASSERT, but tell me who was the caller of the function */
-+#define ASSERT2(EX)	\
-+do {	\
-+    if (!(EX)) {	\
-+	printk(KERN_CRIT "ASSERTION FAILED (caller): %s at %s:%d (%s)\n", #EX,	\
-+	       file, line, func);	\
-+	(*((char *)0))=0;	\
-+    }	\
-+} while (0)
-+
-+#if 0 /* mini_fo doesn't need these */
-+#define dprintk(format, args...) printk(KERN_DEBUG format, ##args)
-+#define fist_dprint(level, str, args...) fist_dprint_internal(level, KERN_DEBUG str, ## args)
-+#define print_entry_location() fist_dprint(4, "%sIN:  %s %s:%d\n", add_indent(), __FUNCTION__, __FILE__, __LINE__)
-+#define print_exit_location() fist_dprint(4, "%s OUT: %s %s:%d\n", del_indent(), __FUNCTION__, __FILE__, __LINE__)
-+#define print_exit_status(status) fist_dprint(4, "%s OUT: %s %s:%d, STATUS: %d\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, status)
-+#define print_exit_pointer(status) \
-+do { \
-+  if (IS_ERR(status)) \
-+    fist_dprint(4, "%s OUT: %s %s:%d, RESULT: %ld\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, PTR_ERR(status)); \
-+  else \
-+    fist_dprint(4, "%s OUT: %s %s:%d, RESULT: 0x%x\n", del_indent(), __FUNCTION__, __FILE__, __LINE__, PTR_ERR(status)); \
-+} while (0)
-+#endif/* mini_fo doesn't need these */
-+
-+#endif /* __KERNEL__ */
-+
-+
-+/*
-+ * DEFINITIONS FOR USER AND KERNEL CODE:
-+ * (Note: ioctl numbers 1--9 are reserved for fistgen, the rest
-+ *  are auto-generated automatically based on the user's .fist file.)
-+ */
-+# define FIST_IOCTL_GET_DEBUG_VALUE	_IOR(0x15, 1, int)
-+# define FIST_IOCTL_SET_DEBUG_VALUE	_IOW(0x15, 2, int)
-+
-+#endif /* not __FIST_H_ */
---- /dev/null
-+++ b/fs/mini_fo/inode.c
-@@ -0,0 +1,1564 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd)
-+#else
-+mini_fo_create(inode_t *dir, dentry_t *dentry, int mode)
-+#endif
-+{
-+	int err = 0;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+	err = create_sto_reg_file(dentry, mode, nd);
-+#else
-+	err = create_sto_reg_file(dentry, mode);
-+#endif
-+	check_mini_fo_dentry(dentry);
-+	return err;
-+}
-+
-+
-+STATIC dentry_t *
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+mini_fo_lookup(inode_t *dir, dentry_t *dentry, struct nameidata* nd)
-+#else
-+mini_fo_lookup(inode_t *dir, dentry_t *dentry)
-+#endif
-+{
-+	int err = 0;
-+	dentry_t *hidden_dir_dentry;
-+	dentry_t *hidden_dentry = NULL;
-+
-+	dentry_t *hidden_sto_dir_dentry;
-+	dentry_t *hidden_sto_dentry = NULL;
-+
-+	/* whiteout flag */
-+	int del_flag = 0;
-+	char *bpath = NULL;
-+
-+	const char *name;
-+	unsigned int namelen;
-+
-+	/* Don't allow lookups of META-files */
-+	namelen = strlen(META_FILENAME);
-+	if(namelen == dentry->d_name.len) {
-+		if(!strncmp(dentry->d_name.name, META_FILENAME, namelen)) {
-+			err = -ENOENT;
-+			goto out;
-+		}
-+	}
-+
-+	hidden_dir_dentry = dtohd(dentry->d_parent);
-+	hidden_sto_dir_dentry = dtohd2(dentry->d_parent);
-+
-+	name = dentry->d_name.name;
-+	namelen = dentry->d_name.len;
-+
-+	/* must initialize dentry operations */
-+	dentry->d_op = &mini_fo_dops;
-+
-+	/* setup the del_flag */
-+	del_flag = __meta_check_d_entry(dir, name, namelen);
-+	bpath = __meta_check_r_entry(dir, name, namelen);
-+
-+	/* perform the lookups of base and storage files:
-+	 *
-+	 * This caused some serious trouble, as a lookup_one_len passing
-+	 * a negative dentry oopses. Solution is to only do the lookup
-+	 * if the dentry is positive, else we set it to NULL
-+	 * More trouble, who said a *_dir_dentry can't be NULL?
-+	 */
-+	if(bpath) {
-+		/* Cross-Interposing (C), yeah! */
-+		hidden_dentry = bpath_walk(dir->i_sb, bpath);
-+		if(!hidden_dentry || !hidden_dentry->d_inode) {
-+			printk(KERN_CRIT "mini_fo_lookup: bpath_walk failed.\n");
-+			err= -EINVAL;
-+			goto out;
-+		}
-+
-+		/* this can be set up safely without fear of spaghetti
-+		 * interposing as it is only used for copying times */
-+		hidden_dir_dentry = hidden_dentry->d_parent;
-+		kfree(bpath);
-+	}
-+	else if(hidden_dir_dentry && hidden_dir_dentry->d_inode)
-+		hidden_dentry =
-+			lookup_one_len(name, hidden_dir_dentry, namelen);
-+	else
-+		hidden_dentry = NULL;
-+
-+	if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode)
-+		hidden_sto_dentry =
-+			lookup_one_len(name, hidden_sto_dir_dentry, namelen);
-+	else
-+		hidden_sto_dentry =  NULL;
-+
-+	/* catch error in lookup */
-+	if (IS_ERR(hidden_dentry) || IS_ERR(hidden_sto_dentry)) {
-+		/* mk: we need to call dput on the dentry, whose
-+		 * lookup_one_len operation failed, in order to avoid
-+		 * unmount trouble.
-+		 */
-+		if(IS_ERR(hidden_dentry)) {
-+			printk(KERN_CRIT "mini_fo_lookup: ERR from base dentry, lookup failed.\n");
-+			err = PTR_ERR(hidden_dentry);
-+		} else {
-+			dput(hidden_dentry);
-+		}
-+		if(IS_ERR(hidden_sto_dentry)) {
-+			printk(KERN_CRIT "mini_fo_lookup: ERR from storage dentry, lookup failed.\n");
-+			err = PTR_ERR(hidden_sto_dentry);
-+		} else {
-+			dput(hidden_sto_dentry);
-+		}
-+		goto out;
-+	}
-+
-+	/* allocate dentry private data */
-+	__dtopd(dentry) = (struct mini_fo_dentry_info *)
-+		kmalloc(sizeof(struct mini_fo_dentry_info), GFP_KERNEL);
-+
-+	if (!dtopd(dentry)) {
-+		err = -ENOMEM;
-+		goto out_dput;
-+	}
-+
-+	/* check for different states of the mini_fo file to be looked up. */
-+
-+	/* state 1, file has been modified */
-+	if(hidden_dentry && hidden_sto_dentry &&
-+	   hidden_dentry->d_inode && hidden_sto_dentry->d_inode && !del_flag) {
-+
-+		/* update parent directory's atime */
-+		fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode);
-+
-+		dtopd(dentry)->state = MODIFIED;
-+		dtohd(dentry) = hidden_dentry;
-+		dtohd2(dentry) = hidden_sto_dentry;
-+
-+		err = mini_fo_tri_interpose(hidden_dentry,
-+					    hidden_sto_dentry,
-+					    dentry, dir->i_sb, 1);
-+		if (err) {
-+			printk(KERN_CRIT "mini_fo_lookup: error interposing (state1).\n");
-+			goto out_free;
-+		}
-+		goto out;
-+	}
-+	/* state 2, file is unmodified */
-+	if(hidden_dentry && hidden_dentry->d_inode && !del_flag) {
-+
-+		fist_copy_attr_atime(dir, hidden_dir_dentry->d_inode);
-+
-+		dtopd(dentry)->state = UNMODIFIED;
-+		dtohd(dentry) = hidden_dentry;
-+		dtohd2(dentry) = hidden_sto_dentry; /* could be negative */
-+
-+		err = mini_fo_tri_interpose(hidden_dentry,
-+					    hidden_sto_dentry,
-+					    dentry, dir->i_sb, 1);
-+		if (err) {
-+			printk(KERN_CRIT "mini_fo_lookup: error interposing (state2).\n");
-+			goto out_free;
-+		}
-+		goto out;
-+	}
-+	/* state 3, file has been newly created */
-+	if(hidden_sto_dentry && hidden_sto_dentry->d_inode && !del_flag) {
-+
-+		fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode);
-+		dtopd(dentry)->state = CREATED;
-+		dtohd(dentry) = hidden_dentry; /* could be negative */
-+		dtohd2(dentry) = hidden_sto_dentry;
-+
-+		err = mini_fo_tri_interpose(hidden_dentry,
-+					    hidden_sto_dentry,
-+					    dentry, dir->i_sb, 1);
-+		if (err) {
-+			printk(KERN_CRIT "mini_fo_lookup: error interposing (state3).\n");
-+			goto out_free;
-+		}
-+		goto out;
-+	}
-+
-+	/* state 4, file has deleted and created again. */
-+	if(hidden_dentry && hidden_sto_dentry &&
-+	   hidden_dentry->d_inode &&
-+	   hidden_sto_dentry->d_inode && del_flag) {
-+
-+		fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode);
-+		dtopd(dentry)->state = DEL_REWRITTEN;
-+		dtohd(dentry) = NULL;
-+		dtohd2(dentry) = hidden_sto_dentry;
-+
-+		err = mini_fo_tri_interpose(NULL,
-+					    hidden_sto_dentry,
-+					    dentry, dir->i_sb, 1);
-+		if (err) {
-+			printk(KERN_CRIT "mini_fo_lookup: error interposing (state4).\n");
-+			goto out_free;
-+		}
-+		/* We will never need this dentry again, as the file has been
-+		 * deleted from base */
-+		dput(hidden_dentry);
-+		goto out;
-+	}
-+	/* state 5, file has been deleted in base */
-+	if(hidden_dentry && hidden_sto_dentry &&
-+	   hidden_dentry->d_inode &&
-+	   !hidden_sto_dentry->d_inode && del_flag) {
-+
-+		/* check which parents atime we need for updating */
-+		if(hidden_sto_dir_dentry->d_inode)
-+			fist_copy_attr_atime(dir,
-+					     hidden_sto_dir_dentry->d_inode);
-+		else
-+			fist_copy_attr_atime(dir,
-+					     hidden_dir_dentry->d_inode);
-+
-+		dtopd(dentry)->state = DELETED;
-+		dtohd(dentry) = NULL;
-+		dtohd2(dentry) = hidden_sto_dentry;
-+
-+		/* add negative dentry to dcache to speed up lookups */
-+		d_add(dentry, NULL);
-+		dput(hidden_dentry);
-+		goto out;
-+	}
-+	/* state 6, file does not exist */
-+	if(((hidden_dentry && !hidden_dentry->d_inode) ||
-+	    (hidden_sto_dentry && !hidden_sto_dentry->d_inode)) && !del_flag)
-+		{
-+			/* check which parents atime we need for updating */
-+			if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode)
-+				fist_copy_attr_atime(dir, hidden_sto_dir_dentry->d_inode);
-+			else
-+				fist_copy_attr_atime(dir, hidden_dir_dentry->d_inode);
-+
-+			dtopd(dentry)->state = NON_EXISTANT;
-+			dtohd(dentry) = hidden_dentry;
-+			dtohd2(dentry) = hidden_sto_dentry;
-+			d_add(dentry, NULL);
-+			goto out;
-+		}
-+
-+	/* if we get to here, were in an invalid state. bad. */
-+	printk(KERN_CRIT "mini_fo_lookup: ERROR, meta data corruption detected.\n");
-+
-+	/* end state checking */
-+ out_free:
-+	d_drop(dentry);		/* so that our bad dentry will get destroyed */
-+	kfree(dtopd(dentry));
-+	__dtopd(dentry) = NULL;	/* be safe */
-+
-+ out_dput:
-+	if(hidden_dentry)
-+		dput(hidden_dentry);
-+	if(hidden_sto_dentry)
-+		dput(hidden_sto_dentry); /* drops usage count and marks for release */
-+
-+ out:
-+	/* initalize wol if file exists and is directory */
-+	if(dentry->d_inode) {
-+		if(S_ISDIR(dentry->d_inode->i_mode)) {
-+			itopd(dentry->d_inode)->deleted_list_size = -1;
-+			itopd(dentry->d_inode)->renamed_list_size = -1;
-+			meta_build_lists(dentry);
-+		}
-+	}
-+	return ERR_PTR(err);
-+}
-+
-+
-+STATIC int
-+mini_fo_link(dentry_t *old_dentry, inode_t *dir, dentry_t *new_dentry)
-+{
-+	int err;
-+	dentry_t *hidden_old_dentry;
-+	dentry_t *hidden_new_dentry;
-+	dentry_t *hidden_dir_dentry;
-+
-+
-+	check_mini_fo_dentry(old_dentry);
-+	check_mini_fo_dentry(new_dentry);
-+	check_mini_fo_inode(dir);
-+
-+	/* no links to directorys and existing targets target allowed */
-+	if(S_ISDIR(old_dentry->d_inode->i_mode) ||
-+	   is_mini_fo_existant(new_dentry)) {
-+		err = -EPERM;
-+		goto out;
-+	}
-+
-+	/* bring it directly from unmod to del_rew */
-+	if(dtost(old_dentry) == UNMODIFIED) {
-+		err = nondir_unmod_to_mod(old_dentry, 1);
-+		if(err) {
-+			err = -EINVAL;
-+			goto out;
-+		}
-+		err = meta_add_d_entry(old_dentry->d_parent,
-+				       old_dentry->d_name.name,
-+				       old_dentry->d_name.len);
-+		if(err) {
-+			err = -EINVAL;
-+			goto out;
-+		}
-+		dput(dtohd(old_dentry));
-+		dtohd(old_dentry) = NULL;
-+		dtost(old_dentry) = DEL_REWRITTEN;
-+	}
-+
-+	err = get_neg_sto_dentry(new_dentry);
-+	if(err) {
-+		err = -EINVAL;
-+		goto out;
-+	}
-+
-+	hidden_old_dentry = dtohd2(old_dentry);
-+	hidden_new_dentry = dtohd2(new_dentry);
-+
-+	dget(hidden_old_dentry);
-+	dget(hidden_new_dentry);
-+
-+	/* was: hidden_dir_dentry = lock_parent(hidden_new_dentry); */
-+	hidden_dir_dentry = dget(hidden_new_dentry->d_parent);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	err = vfs_link(hidden_old_dentry,
-+		       hidden_dir_dentry->d_inode,
-+		       hidden_new_dentry);
-+	if (err || !hidden_new_dentry->d_inode)
-+		goto out_lock;
-+
-+	dtost(new_dentry) = CREATED;
-+ 	err = mini_fo_tri_interpose(NULL, hidden_new_dentry, new_dentry, dir->i_sb, 0);
-+	if (err)
-+		goto out_lock;
-+
-+	fist_copy_attr_timesizes(dir, hidden_new_dentry->d_inode);
-+	/* propagate number of hard-links */
-+	old_dentry->d_inode->i_nlink = itohi2(old_dentry->d_inode)->i_nlink;
-+
-+ out_lock:
-+	/* was: unlock_dir(hidden_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_dir_dentry);
-+
-+	dput(hidden_new_dentry);
-+	dput(hidden_old_dentry);
-+	if (!new_dentry->d_inode)
-+		d_drop(new_dentry);
-+
-+ out:
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_unlink(inode_t *dir, dentry_t *dentry)
-+{
-+	int err = 0;
-+
-+	dget(dentry);
-+	if(dtopd(dentry)->state == MODIFIED) {
-+		err = nondir_mod_to_del(dentry);
-+		goto out;
-+	}
-+	else if(dtopd(dentry)->state == UNMODIFIED) {
-+		err = nondir_unmod_to_del(dentry);
-+		goto out;
-+	}
-+	else if(dtopd(dentry)->state == CREATED) {
-+		err = nondir_creat_to_del(dentry);
-+		goto out;
-+	}
-+	else if(dtopd(dentry)->state == DEL_REWRITTEN) {
-+		err = nondir_del_rew_to_del(dentry);
-+		goto out;
-+	}
-+
-+	printk(KERN_CRIT "mini_fo_unlink: ERROR, invalid state detected.\n");
-+
-+ out:
-+	fist_copy_attr_times(dir, itohi2(dentry->d_parent->d_inode));
-+
-+	if(!err) {
-+		/* is this causing my pain? d_delete(dentry); */
-+		d_drop(dentry);
-+	}
-+
-+	dput(dentry);
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_symlink(inode_t *dir, dentry_t *dentry, const char *symname)
-+{
-+	int err=0;
-+	dentry_t *hidden_sto_dentry;
-+	dentry_t *hidden_sto_dir_dentry;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+        umode_t mode;
-+#endif
-+
-+	/* Fail if the symlink file exists */
-+	if(!(dtost(dentry) == DELETED ||
-+	     dtost(dentry) == NON_EXISTANT)) {
-+		err = -EEXIST;
-+		goto out;
-+	}
-+
-+	err = get_neg_sto_dentry(dentry);
-+	if(err) {
-+		err = -EINVAL;
-+		goto out;
-+	}
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	dget(hidden_sto_dentry);
-+	/* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+	mode = S_IALLUGO;
-+	err = vfs_symlink(hidden_sto_dir_dentry->d_inode,
-+			  hidden_sto_dentry, symname, mode);
-+#else
-+	err = vfs_symlink(hidden_sto_dir_dentry->d_inode,
-+			  hidden_sto_dentry,
-+			  symname);
-+#endif
-+	if (err || !hidden_sto_dentry->d_inode)
-+                goto out_lock;
-+
-+        if(dtost(dentry) == DELETED) {
-+                dtost(dentry) = DEL_REWRITTEN;
-+                err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0);
-+                if(err)
-+                        goto out_lock;
-+        } else if(dtost(dentry) == NON_EXISTANT) {
-+                dtost(dentry) = CREATED;
-+                err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0);
-+                if(err)
-+                        goto out_lock;
-+        }
-+	fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode);
-+
-+ out_lock:
-+        /* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_sto_dir_dentry);
-+
-+        dput(hidden_sto_dentry);
-+        if (!dentry->d_inode)
-+                d_drop(dentry);
-+ out:
-+        return err;
-+}
-+
-+STATIC int
-+mini_fo_mkdir(inode_t *dir, dentry_t *dentry, int mode)
-+{
-+	int err;
-+
-+	err = create_sto_dir(dentry, mode);
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_rmdir(inode_t *dir, dentry_t *dentry)
-+{
-+	int err = 0;
-+
-+	dentry_t *hidden_sto_dentry;
-+	dentry_t *hidden_sto_dir_dentry;
-+	dentry_t *meta_dentry;
-+	inode_t *hidden_sto_dir = NULL;
-+
-+	check_mini_fo_dentry(dentry);
-+	check_mini_fo_inode(dir);
-+
-+	dget(dentry);
-+	if(dtopd(dentry)->state == MODIFIED) {
-+		/* XXX: disabled, because it does not bother to check files on
-+		 * the original filesystem - just a hack, but better than simply
-+		 * removing it without testing */
-+		err = -EINVAL;
-+		goto out;
-+
-+		hidden_sto_dir = itohi2(dir);
-+		hidden_sto_dentry = dtohd2(dentry);
-+
-+		/* was:hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */
-+		hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+		/* Delete an old WOL file contained in the storage dir */
-+		meta_dentry = lookup_one_len(META_FILENAME,
-+					     hidden_sto_dentry,
-+					     strlen(META_FILENAME));
-+		if(meta_dentry->d_inode) {
-+			err = vfs_unlink(hidden_sto_dentry->d_inode, meta_dentry);
-+			dput(meta_dentry);
-+			if(!err)
-+				d_delete(meta_dentry);
-+		}
-+
-+		err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry);
-+		dput(hidden_sto_dentry);
-+		if(!err)
-+			d_delete(hidden_sto_dentry);
-+
-+		/* propagate number of hard-links */
-+		dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink;
-+
-+		dput(dtohd(dentry));
-+
-+		dtohd(dentry) = NULL;
-+		dtopd(dentry)->state = DELETED;
-+
-+		/* carefull with R files */
-+		if( __meta_is_r_entry(dir,
-+				      dentry->d_name.name,
-+				      dentry->d_name.len) == 1) {
-+			err = meta_remove_r_entry(dentry->d_parent,
-+						  dentry->d_name.name,
-+						  dentry->d_name.len);
-+			if(err) {
-+				printk(KERN_CRIT "mini_fo: rmdir: meta_remove_r_entry failed.\n");
-+				goto out;
-+			}
-+		}
-+		else {
-+			/* ok, add deleted file to META */
-+			meta_add_d_entry(dentry->d_parent,
-+					 dentry->d_name.name,
-+					 dentry->d_name.len);
-+		}
-+		/* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+		dput(hidden_sto_dir_dentry);
-+		goto out;
-+	}
-+	else if(dtopd(dentry)->state == UNMODIFIED) {
-+		/* XXX: simply adding it to the delete list here is fscking dangerous!
-+		 * as a temporary hack, i will disable rmdir on unmodified directories
-+		 * for now.
-+		 */
-+		err = -EINVAL;
-+		goto out;
-+
-+		err = get_neg_sto_dentry(dentry);
-+		if(err) {
-+			err = -EINVAL;
-+			goto out;
-+		}
-+
-+		/* dput base dentry, this will relase the inode and free the
-+		 * dentry, as we will never need it again. */
-+		dput(dtohd(dentry));
-+		dtohd(dentry) = NULL;
-+		dtopd(dentry)->state = DELETED;
-+
-+		/* add deleted file to META-file */
-+		meta_add_d_entry(dentry->d_parent,
-+				 dentry->d_name.name,
-+				 dentry->d_name.len);
-+		goto out;
-+	}
-+	else if(dtopd(dentry)->state == CREATED) {
-+		hidden_sto_dir = itohi2(dir);
-+		hidden_sto_dentry = dtohd2(dentry);
-+
-+		/* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/
-+		hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+		/* Delete an old WOL file contained in the storage dir */
-+		meta_dentry = lookup_one_len(META_FILENAME,
-+					     hidden_sto_dentry,
-+					     strlen(META_FILENAME));
-+		if(meta_dentry->d_inode) {
-+			/* is this necessary? dget(meta_dentry); */
-+			err = vfs_unlink(hidden_sto_dentry->d_inode,
-+					 meta_dentry);
-+			dput(meta_dentry);
-+			if(!err)
-+				d_delete(meta_dentry);
-+		}
-+
-+		err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry);
-+		dput(hidden_sto_dentry);
-+		if(!err)
-+			d_delete(hidden_sto_dentry);
-+
-+		/* propagate number of hard-links */
-+		dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink;
-+		dtopd(dentry)->state = NON_EXISTANT;
-+
-+		/* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+		dput(hidden_sto_dir_dentry);
-+
-+		goto out;
-+	}
-+	else if(dtopd(dentry)->state == DEL_REWRITTEN) {
-+		hidden_sto_dir = itohi2(dir);
-+		hidden_sto_dentry = dtohd2(dentry);
-+
-+		/* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/
-+		hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+		/* Delete an old WOL file contained in the storage dir */
-+		meta_dentry = lookup_one_len(META_FILENAME,
-+					     hidden_sto_dentry,
-+					     strlen(META_FILENAME));
-+		if(meta_dentry->d_inode) {
-+			/* is this necessary? dget(meta_dentry); */
-+			err = vfs_unlink(hidden_sto_dentry->d_inode,
-+					 meta_dentry);
-+			dput(meta_dentry);
-+			if(!err)
-+				d_delete(meta_dentry);
-+		}
-+
-+		err = vfs_rmdir(hidden_sto_dir, hidden_sto_dentry);
-+		dput(hidden_sto_dentry);
-+		if(!err)
-+			d_delete(hidden_sto_dentry);
-+
-+		/* propagate number of hard-links */
-+		dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink;
-+		dtopd(dentry)->state = DELETED;
-+		/* was: unlock_dir(hidden_sto_dir_dentry); */
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+		dput(hidden_sto_dir_dentry);
-+		goto out;
-+	}
-+
-+	printk(KERN_CRIT "mini_fo_rmdir: ERROR, invalid state detected.\n");
-+
-+ out:
-+	if(!err) {
-+		d_drop(dentry);
-+	}
-+
-+	fist_copy_attr_times(dir, itohi2(dentry->d_parent->d_inode));
-+	dput(dentry);
-+
-+	return err;
-+}
-+
-+
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+mini_fo_mknod(inode_t *dir, dentry_t *dentry, int mode, dev_t dev)
-+#else
-+mini_fo_mknod(inode_t *dir, dentry_t *dentry, int mode, int dev)
-+#endif
-+{
-+	int err = 0;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	err = create_sto_nod(dentry, mode, dev);
-+	if(err) {
-+		printk(KERN_CRIT "mini_fo_mknod: creating sto nod failed.\n");
-+		err = -EINVAL;
-+	}
-+
-+	check_mini_fo_dentry(dentry);
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_rename(inode_t *old_dir, dentry_t *old_dentry,
-+	       inode_t *new_dir, dentry_t *new_dentry)
-+{
-+	/* dispatch */
-+	if(S_ISDIR(old_dentry->d_inode->i_mode))
-+		return rename_directory(old_dir, old_dentry, new_dir, new_dentry);
-+	return rename_nondir(old_dir, old_dentry, new_dir, new_dentry);
-+
-+}
-+
-+int rename_directory(inode_t *old_dir, dentry_t *old_dentry,
-+		     inode_t *new_dir, dentry_t *new_dentry)
-+{
-+	int err, bpath_len;
-+	char *bpath;
-+
-+	dentry_t *hidden_old_dentry;
-+	dentry_t *hidden_new_dentry;
-+	dentry_t *hidden_old_dir_dentry;
-+	dentry_t *hidden_new_dir_dentry;
-+
-+	err = 0;
-+	bpath = NULL;
-+	bpath_len = 0;
-+
-+	/* this is a test, chuck out if it works */
-+	if(!(dtopd(new_dentry)->state == DELETED ||
-+	     dtopd(new_dentry)->state == NON_EXISTANT)) {
-+		printk(KERN_CRIT "mini_fo: rename_directory: \
-+                                  uh, ah, new_dentry not negative.\n");
-+		/* return -1; */
-+	}
-+
-+	/* state = UNMODIFIED */
-+	if(dtopd(old_dentry)->state == UNMODIFIED) {
-+		err = dir_unmod_to_mod(old_dentry);
-+		if (err)
-+			goto out;
-+	}
-+
-+	/* state = MODIFIED */
-+	if(dtopd(old_dentry)->state == MODIFIED) {
-+		bpath = meta_check_r_entry(old_dentry->d_parent,
-+					   old_dentry->d_name.name,
-+					   old_dentry->d_name.len);
-+		if(bpath) {
-+			err = meta_remove_r_entry(old_dentry->d_parent,
-+						  old_dentry->d_name.name,
-+						  old_dentry->d_name.len);
-+			if(err) {
-+				printk(KERN_CRIT "mini_fo: rename_directory:\
-+                                                   meta_remove_r_entry \
-+                                                  failed.\n");
-+				goto out;
-+			}
-+			err = meta_add_r_entry(new_dentry->d_parent,
-+					       bpath,
-+					       strlen(bpath),
-+					       new_dentry->d_name.name,
-+					       new_dentry->d_name.len);
-+			kfree(bpath);
-+		}
-+		else {/* wol it */
-+			err = meta_add_d_entry(old_dentry->d_parent,
-+					       old_dentry->d_name.name,
-+					       old_dentry->d_name.len);
-+			if (err)
-+				goto out;
-+			/* put it on rename list */
-+			err = get_mini_fo_bpath(old_dentry,
-+						&bpath,
-+						&bpath_len);
-+			if (err)
-+				goto out;
-+			err = meta_add_r_entry(new_dentry->d_parent,
-+					       bpath, bpath_len,
-+					       new_dentry->d_name.name,
-+					       new_dentry->d_name.len);
-+			if (err)
-+				goto out;
-+		}
-+		/* no state change, MODIFIED stays MODIFIED */
-+	}
-+	/* state = CREATED */
-+	if(dtopd(old_dentry)->state == CREATED ||
-+	   dtopd(old_dentry)->state == DEL_REWRITTEN) {
-+		if(dtohd(old_dentry))
-+			dput(dtohd(old_dentry));
-+
-+		if(dtopd(new_dentry)->state == DELETED) {
-+			dtopd(old_dentry)->state = DEL_REWRITTEN;
-+			dtohd(old_dentry) = NULL;
-+		}
-+		else if(dtopd(new_dentry)->state == NON_EXISTANT) {
-+			dtopd(old_dentry)->state = CREATED;
-+			/* steal new dentry's neg. base dentry */
-+			dtohd(old_dentry) = dtohd(new_dentry);
-+			dtohd(new_dentry) = NULL;
-+		}
-+	}
-+	if(dtopd(new_dentry)->state == UNMODIFIED ||
-+	   dtopd(new_dentry)->state == NON_EXISTANT) {
-+		err = get_neg_sto_dentry(new_dentry);
-+		if(err)
-+			goto out;
-+	}
-+
-+	/* now move sto file */
-+	hidden_old_dentry = dtohd2(old_dentry);
-+	hidden_new_dentry = dtohd2(new_dentry);
-+
-+	dget(hidden_old_dentry);
-+	dget(hidden_new_dentry);
-+
-+	hidden_old_dir_dentry = dget(hidden_old_dentry->d_parent);
-+	hidden_new_dir_dentry = dget(hidden_new_dentry->d_parent);
-+	double_lock(hidden_old_dir_dentry, hidden_new_dir_dentry);
-+
-+	err = vfs_rename(hidden_old_dir_dentry->d_inode, hidden_old_dentry,
-+			 hidden_new_dir_dentry->d_inode, hidden_new_dentry);
-+	if(err)
-+		goto out_lock;
-+
-+	fist_copy_attr_all(new_dir, hidden_new_dir_dentry->d_inode);
-+	if (new_dir != old_dir)
-+		fist_copy_attr_all(old_dir,
-+				   hidden_old_dir_dentry->d_inode);
-+
-+ out_lock:
-+	/* double_unlock will dput the new/old parent dentries
-+	 * whose refcnts were incremented via get_parent above. */
-+	double_unlock(hidden_old_dir_dentry, hidden_new_dir_dentry);
-+	dput(hidden_new_dentry);
-+	dput(hidden_old_dentry);
-+
-+ out:
-+	return err;
-+}
-+
-+int rename_nondir(inode_t *old_dir, dentry_t *old_dentry,
-+		  inode_t *new_dir, dentry_t *new_dentry)
-+{
-+	int err=0;
-+
-+	check_mini_fo_dentry(old_dentry);
-+	check_mini_fo_dentry(new_dentry);
-+	check_mini_fo_inode(old_dir);
-+	check_mini_fo_inode(new_dir);
-+
-+	/* state: UNMODIFIED */
-+	if(dtost(old_dentry) == UNMODIFIED) {
-+		err = nondir_unmod_to_mod(old_dentry, 1);
-+		if(err) {
-+			err = -EINVAL;
-+			goto out;
-+		}
-+	}
-+
-+	/* the easy states */
-+	if(exists_in_storage(old_dentry)) {
-+
-+		dentry_t *hidden_old_dentry;
-+		dentry_t *hidden_new_dentry;
-+		dentry_t *hidden_old_dir_dentry;
-+		dentry_t *hidden_new_dir_dentry;
-+
-+		/* if old file is MODIFIED, add it to the deleted_list */
-+		if(dtopd(old_dentry)->state == MODIFIED) {
-+			meta_add_d_entry(old_dentry->d_parent,
-+					 old_dentry->d_name.name,
-+					 old_dentry->d_name.len);
-+
-+			dput(dtohd(old_dentry));
-+		}
-+		/* if old file is CREATED, we only release the base dentry */
-+		if(dtopd(old_dentry)->state == CREATED) {
-+			if(dtohd(old_dentry))
-+				dput(dtohd(old_dentry));
-+		}
-+
-+		/* now setup the new states (depends on new_dentry state) */
-+		/* new dentry state =  MODIFIED */
-+		if(dtopd(new_dentry)->state == MODIFIED) {
-+			meta_add_d_entry(new_dentry->d_parent,
-+					 new_dentry->d_name.name,
-+					 new_dentry->d_name.len);
-+
-+			/* new dentry will be d_put'ed later by the vfs
-+			 * so don't do it here
-+			 * dput(dtohd(new_dentry));
-+			 */
-+			dtohd(old_dentry) = NULL;
-+			dtopd(old_dentry)->state = DEL_REWRITTEN;
-+		}
-+		/* new dentry state =  UNMODIFIED */
-+		else if(dtopd(new_dentry)->state == UNMODIFIED) {
-+			if(get_neg_sto_dentry(new_dentry))
-+				return -EINVAL;
-+
-+			meta_add_d_entry(new_dentry->d_parent,
-+					 new_dentry->d_name.name,
-+					 new_dentry->d_name.len);
-+
-+			/* is this right??? */
-+			/*dput(dtohd(new_dentry));*/
-+			dtohd(old_dentry) = NULL;
-+			dtopd(old_dentry)->state = DEL_REWRITTEN;
-+		}
-+		/* new dentry state =  CREATED */
-+		else if(dtopd(new_dentry)->state == CREATED) {
-+			/* we keep the neg. base dentry (if exists) */
-+			dtohd(old_dentry) = dtohd(new_dentry);
-+			/* ...and set it to Null, or we'll get
-+			 * dcache.c:345 if it gets dput twice... */
-+			dtohd(new_dentry) = NULL;
-+			dtopd(old_dentry)->state = CREATED;
-+		}
-+		/* new dentry state =  NON_EXISTANT */
-+		else if(dtopd(new_dentry)->state == NON_EXISTANT) {
-+			if(get_neg_sto_dentry(new_dentry))
-+				return -EINVAL;
-+
-+			/* we keep the neg. base dentry (if exists) */
-+			dtohd(old_dentry) = dtohd(new_dentry);
-+			/* ...and set it to Null, or we'll get
-+			 * Dr. dcache.c:345 if it gets dput twice... */
-+			dtohd(new_dentry) = NULL;
-+			dtopd(old_dentry)->state = CREATED;
-+		}
-+		/* new dentry state =  DEL_REWRITTEN or DELETED */
-+		else if(dtopd(new_dentry)->state == DEL_REWRITTEN ||
-+			dtopd(new_dentry)->state == DELETED) {
-+			dtohd(old_dentry) = NULL;
-+			dtopd(old_dentry)->state = DEL_REWRITTEN;
-+		}
-+		else { /* not possible, uhh, ahh */
-+			printk(KERN_CRIT
-+			       "mini_fo: rename_reg_file: invalid state detected [1].\n");
-+			return -1;
-+		}
-+
-+		/* now we definitely have a sto file */
-+		hidden_old_dentry = dtohd2(old_dentry);
-+		hidden_new_dentry = dtohd2(new_dentry);
-+
-+		dget(hidden_old_dentry);
-+		dget(hidden_new_dentry);
-+
-+		hidden_old_dir_dentry = dget(hidden_old_dentry->d_parent);
-+		hidden_new_dir_dentry = dget(hidden_new_dentry->d_parent);
-+		double_lock(hidden_old_dir_dentry, hidden_new_dir_dentry);
-+
-+		err = vfs_rename(hidden_old_dir_dentry->d_inode,
-+				 hidden_old_dentry,
-+				 hidden_new_dir_dentry->d_inode,
-+				 hidden_new_dentry);
-+		if(err)
-+			goto out_lock;
-+
-+		fist_copy_attr_all(new_dir, hidden_new_dir_dentry->d_inode);
-+		if (new_dir != old_dir)
-+			fist_copy_attr_all(old_dir, hidden_old_dir_dentry->d_inode);
-+
-+	out_lock:
-+		/* double_unlock will dput the new/old parent dentries
-+		 * whose refcnts were incremented via get_parent above.
-+		 */
-+		double_unlock(hidden_old_dir_dentry, hidden_new_dir_dentry);
-+		dput(hidden_new_dentry);
-+		dput(hidden_old_dentry);
-+	out:
-+		return err;
-+	}
-+	else { /* invalid state */
-+		printk(KERN_CRIT "mini_fo: rename_reg_file: ERROR: invalid state detected [2].\n");
-+		return -1;
-+	}
-+}
-+
-+
-+STATIC int
-+mini_fo_readlink(dentry_t *dentry, char *buf, int bufsiz)
-+{
-+	int err=0;
-+	dentry_t *hidden_dentry = NULL;
-+
-+	if(dtohd2(dentry) && dtohd2(dentry)->d_inode) {
-+		hidden_dentry = dtohd2(dentry);
-+	} else if(dtohd(dentry) && dtohd(dentry)->d_inode) {
-+		hidden_dentry = dtohd(dentry);
-+	} else {
-+		goto out;
-+	}
-+
-+	if (!hidden_dentry->d_inode->i_op ||
-+	    !hidden_dentry->d_inode->i_op->readlink) {
-+		err = -EINVAL;		goto out;
-+	}
-+
-+	err = hidden_dentry->d_inode->i_op->readlink(hidden_dentry,
-+						     buf,
-+						     bufsiz);
-+	if (err > 0)
-+		fist_copy_attr_atime(dentry->d_inode, hidden_dentry->d_inode);
-+
-+ out:
-+	return err;
-+}
-+
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-+static int mini_fo_follow_link(dentry_t *dentry, struct nameidata *nd)
-+#else
-+static void* mini_fo_follow_link(dentry_t *dentry, struct nameidata *nd)
-+#endif
-+{
-+	char *buf;
-+	int len = PAGE_SIZE, err;
-+	mm_segment_t old_fs;
-+
-+	/* in 2.6 this is freed by mini_fo_put_link called by __do_follow_link */
-+	buf = kmalloc(len, GFP_KERNEL);
-+	if (!buf) {
-+		err = -ENOMEM;
-+		goto out;
-+	}
-+
-+	/* read the symlink, and then we will follow it */
-+	old_fs = get_fs();
-+	set_fs(KERNEL_DS);
-+	err = dentry->d_inode->i_op->readlink(dentry, buf, len);
-+	set_fs(old_fs);
-+	if (err < 0) {
-+		kfree(buf);
-+		buf = NULL;
-+		goto out;
-+	}
-+	buf[err] = 0;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+        nd_set_link(nd, buf);
-+        err = 0;
-+#else
-+	err = vfs_follow_link(nd, buf);
-+#endif
-+
-+ out:
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+	kfree(buf);
-+#endif
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-+        return err;
-+#else
-+        return ERR_PTR(err);
-+#endif
-+}
-+
-+STATIC
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
-+void mini_fo_put_link(struct dentry *dentry, struct nameidata *nd)
-+#else
-+void mini_fo_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
-+#endif
-+{
-+        char *link;
-+        link = nd_get_link(nd);
-+        kfree(link);
-+}
-+#endif
-+
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+mini_fo_permission(inode_t *inode, int mask, struct nameidata *nd)
-+#else
-+mini_fo_permission(inode_t *inode, int mask)
-+#endif
-+{
-+	inode_t *hidden_inode;
-+	int mode;
-+	int err;
-+
-+	if(itohi2(inode)) {
-+		hidden_inode = itohi2(inode);
-+	} else {
-+		hidden_inode = itohi(inode);
-+	}
-+	mode = inode->i_mode;
-+
-+	/* not really needed, as permission handles everything:
-+	 *	err = vfs_permission(inode, mask);
-+	 *	if (err)
-+	 *		goto out;
-+	 */
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+	err = permission(hidden_inode, mask, nd);
-+#else
-+	err = permission(hidden_inode, mask);
-+#endif
-+
-+	/*  out: */
-+	return err;
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+STATIC int
-+mini_fo_inode_revalidate(dentry_t *dentry)
-+{
-+	int err = 0;
-+	dentry_t *hidden_dentry;
-+	inode_t *hidden_inode;
-+
-+	ASSERT(dentry->d_inode);
-+	ASSERT(itopd(dentry->d_inode));
-+
-+	if(itohi2(dentry->d_inode)) {
-+                hidden_dentry = dtohd2(dentry);
-+		hidden_inode = hidden_dentry->d_inode;
-+	} else if(itohi(dentry->d_inode)) {
-+                hidden_dentry = dtohd(dentry);
-+		hidden_inode = hidden_dentry->d_inode;
-+	} else {
-+                printk(KERN_CRIT "mini_fo_inode_revalidate: ERROR, invalid state detected.\n");
-+                err = -ENOENT;
-+                goto out;
-+        }
-+	if (hidden_inode && hidden_inode->i_op && hidden_inode->i_op->revalidate){
-+		err = hidden_inode->i_op->revalidate(hidden_dentry);
-+		if (err)
-+			goto out;
-+	}
-+	fist_copy_attr_all(dentry->d_inode, hidden_inode);
-+ out:
-+	return err;
-+}
-+#endif
-+
-+STATIC int
-+mini_fo_setattr(dentry_t *dentry, struct iattr *ia)
-+{
-+	int err = 0;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(!is_mini_fo_existant(dentry)) {
-+		printk(KERN_CRIT "mini_fo_setattr: ERROR, invalid state detected [1].\n");
-+		goto out;
-+	}
-+
-+	if(dtost(dentry) == UNMODIFIED) {
-+		if(!IS_COPY_FLAG(ia->ia_valid))
-+			goto out; /* we ignore these changes to base */
-+
-+		if(S_ISDIR(dentry->d_inode->i_mode)) {
-+			err = dir_unmod_to_mod(dentry);
-+		} else {
-+			/* we copy contents if file is not beeing truncated */
-+			if(S_ISREG(dentry->d_inode->i_mode) &&
-+			   !(ia->ia_size == 0 && (ia->ia_valid & ATTR_SIZE))) {
-+				err = nondir_unmod_to_mod(dentry, 1);
-+			} else
-+				err = nondir_unmod_to_mod(dentry, 0);
-+		}
-+		if(err) {
-+			err = -EINVAL;
-+			printk(KERN_CRIT "mini_fo_setattr: ERROR changing states.\n");
-+			goto out;
-+		}
-+	}
-+	if(!exists_in_storage(dentry)) {
-+		printk(KERN_CRIT "mini_fo_setattr: ERROR, invalid state detected [2].\n");
-+		err = -EINVAL;
-+		goto out;
-+	}
-+	ASSERT(dentry->d_inode);
-+	ASSERT(dtohd2(dentry));
-+	ASSERT(itopd(dentry->d_inode));
-+	ASSERT(itohi2(dentry->d_inode));
-+
-+	err = notify_change(dtohd2(dentry), ia);
-+	fist_copy_attr_all(dentry->d_inode, itohi2(dentry->d_inode));
-+ out:
-+	return err;
-+}
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+STATIC int
-+mini_fo_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
-+{
-+	int err = 0;
-+        dentry_t *hidden_dentry;
-+
-+	ASSERT(dentry->d_inode);
-+	ASSERT(itopd(dentry->d_inode));
-+
-+	if(itohi2(dentry->d_inode)) {
-+                hidden_dentry = dtohd2(dentry);
-+	} else if(itohi(dentry->d_inode)) {
-+                hidden_dentry = dtohd(dentry);
-+	} else {
-+                printk(KERN_CRIT "mini_fo_getattr: ERROR, invalid state detected.\n");
-+                err = -ENOENT;
-+                goto out;
-+        }
-+	fist_copy_attr_all(dentry->d_inode, hidden_dentry->d_inode);
-+
-+	ASSERT(hidden_dentry);
-+	ASSERT(hidden_dentry->d_inode);
-+	ASSERT(hidden_dentry->d_inode->i_op);
-+
-+	generic_fillattr(dentry->d_inode, stat);
-+	if (!stat->blksize) {
-+		struct super_block *s = hidden_dentry->d_inode->i_sb;
-+		unsigned blocks;
-+		blocks = (stat->size+s->s_blocksize-1) >> s->s_blocksize_bits;
-+		stat->blocks = (s->s_blocksize / 512) * blocks;
-+		stat->blksize = s->s_blocksize;
-+	}
-+ out:
-+        return err;
-+}
-+#endif
-+
-+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20))
-+#if 0 /* no xattr_alloc() and xattr_free() */
-+/* This is lifted from fs/xattr.c */
-+static void *
-+xattr_alloc(size_t size, size_t limit)
-+{
-+	void *ptr;
-+
-+	if (size > limit)
-+		return ERR_PTR(-E2BIG);
-+
-+	if (!size)	/* size request, no buffer is needed */
-+		return NULL;
-+	else if (size <= PAGE_SIZE)
-+		ptr = kmalloc((unsigned long) size, GFP_KERNEL);
-+	else
-+		ptr = vmalloc((unsigned long) size);
-+	if (!ptr)
-+		return ERR_PTR(-ENOMEM);
-+	return ptr;
-+}
-+
-+static void
-+xattr_free(void *ptr, size_t size)
-+{
-+	if (!size)	/* size request, no buffer was needed */
-+		return;
-+	else if (size <= PAGE_SIZE)
-+		kfree(ptr);
-+	else
-+		vfree(ptr);
-+}
-+#endif /* no xattr_alloc() and xattr_free() */
-+
-+/* BKL held by caller.
-+ * dentry->d_inode->i_sem down
-+ */
-+STATIC int
-+mini_fo_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) {
-+	struct dentry *hidden_dentry = NULL;
-+	int err = -EOPNOTSUPP;
-+	/* Define these anyway so we don't need as much ifdef'ed code. */
-+	char *encoded_name = NULL;
-+	char *encoded_value = NULL;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(exists_in_storage(dentry))
-+		hidden_dentry = dtohd2(dentry);
-+	else
-+		hidden_dentry = dtohd(dentry);
-+
-+	ASSERT(hidden_dentry);
-+	ASSERT(hidden_dentry->d_inode);
-+	ASSERT(hidden_dentry->d_inode->i_op);
-+
-+	if (hidden_dentry->d_inode->i_op->getxattr) {
-+		encoded_name = (char *)name;
-+		encoded_value = (char *)value;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_dentry->d_inode->i_sem);
-+#endif
-+		/* lock_kernel() already done by caller. */
-+		err = hidden_dentry->d_inode->i_op->getxattr(hidden_dentry, encoded_name, encoded_value, size);
-+		/* unlock_kernel() will be done by caller. */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_dentry->d_inode->i_sem);
-+#endif
-+	}
-+	return err;
-+}
-+
-+/* BKL held by caller.
-+ * dentry->d_inode->i_sem down
-+ */
-+STATIC int
-+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21) \
-+     && LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,23)) \
-+     || LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
-+mini_fo_setxattr(struct dentry *dentry, const char *name,
-+		 const void *value, size_t size, int flags)
-+#else
-+mini_fo_setxattr(struct dentry *dentry, const char *name,
-+		 void *value, size_t size, int flags)
-+#endif
-+
-+{
-+	struct dentry *hidden_dentry = NULL;
-+	int err = -EOPNOTSUPP;
-+
-+	/* Define these anyway, so we don't have as much ifdef'ed code. */
-+	char *encoded_value = NULL;
-+	char *encoded_name = NULL;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(exists_in_storage(dentry))
-+		hidden_dentry = dtohd2(dentry);
-+	else
-+		hidden_dentry = dtohd(dentry);
-+
-+	ASSERT(hidden_dentry);
-+	ASSERT(hidden_dentry->d_inode);
-+	ASSERT(hidden_dentry->d_inode->i_op);
-+
-+	if (hidden_dentry->d_inode->i_op->setxattr) {
-+		encoded_name = (char *)name;
-+		encoded_value = (char *)value;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_dentry->d_inode->i_sem);
-+#endif
-+		/* lock_kernel() already done by caller. */
-+		err = hidden_dentry->d_inode->i_op->setxattr(hidden_dentry, encoded_name, encoded_value, size, flags);
-+		/* unlock_kernel() will be done by caller. */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_dentry->d_inode->i_sem);
-+#endif
-+	}
-+	return err;
-+}
-+
-+/* BKL held by caller.
-+ * dentry->d_inode->i_sem down
-+ */
-+STATIC int
-+mini_fo_removexattr(struct dentry *dentry, const char *name) {
-+	struct dentry *hidden_dentry = NULL;
-+	int err = -EOPNOTSUPP;
-+	char *encoded_name;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(exists_in_storage(dentry))
-+		hidden_dentry = dtohd2(dentry);
-+	else
-+		hidden_dentry = dtohd(dentry);
-+
-+	ASSERT(hidden_dentry);
-+	ASSERT(hidden_dentry->d_inode);
-+	ASSERT(hidden_dentry->d_inode->i_op);
-+
-+	if (hidden_dentry->d_inode->i_op->removexattr) {
-+		encoded_name = (char *)name;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_dentry->d_inode->i_sem);
-+#endif
-+		/* lock_kernel() already done by caller. */
-+		err = hidden_dentry->d_inode->i_op->removexattr(hidden_dentry, encoded_name);
-+		/* unlock_kernel() will be done by caller. */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_dentry->d_inode->i_sem);
-+#endif
-+	}
-+	return err;
-+}
-+
-+/* BKL held by caller.
-+ * dentry->d_inode->i_sem down
-+ */
-+STATIC int
-+mini_fo_listxattr(struct dentry *dentry, char *list, size_t size) {
-+	struct dentry *hidden_dentry = NULL;
-+	int err = -EOPNOTSUPP;
-+	char *encoded_list = NULL;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(exists_in_storage(dentry))
-+		hidden_dentry = dtohd2(dentry);
-+	else
-+		hidden_dentry = dtohd(dentry);
-+
-+	ASSERT(hidden_dentry);
-+	ASSERT(hidden_dentry->d_inode);
-+	ASSERT(hidden_dentry->d_inode->i_op);
-+
-+	if (hidden_dentry->d_inode->i_op->listxattr) {
-+		encoded_list = list;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		down(&hidden_dentry->d_inode->i_sem);
-+#endif
-+		/* lock_kernel() already done by caller. */
-+		err = hidden_dentry->d_inode->i_op->listxattr(hidden_dentry, encoded_list, size);
-+		/* unlock_kernel() will be done by caller. */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_dentry->d_inode->i_sem);
-+#endif
-+	}
-+	return err;
-+}
-+# endif /* defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) */
-+
-+struct inode_operations mini_fo_symlink_iops =
-+	{
-+		readlink:	mini_fo_readlink,
-+		follow_link: mini_fo_follow_link,
-+		/* mk: permission:	mini_fo_permission, */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+		revalidate:	mini_fo_inode_revalidate,
-+#endif
-+		setattr:	mini_fo_setattr,
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		getattr:	mini_fo_getattr,
-+		put_link:       mini_fo_put_link,
-+#endif
-+
-+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20))
-+		setxattr:	mini_fo_setxattr,
-+		getxattr:	mini_fo_getxattr,
-+		listxattr:	mini_fo_listxattr,
-+		removexattr: mini_fo_removexattr
-+# endif /* defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)) */
-+	};
-+
-+struct inode_operations mini_fo_dir_iops =
-+	{
-+		create:	mini_fo_create,
-+		lookup:	mini_fo_lookup,
-+		link:	mini_fo_link,
-+		unlink:	mini_fo_unlink,
-+		symlink:	mini_fo_symlink,
-+		mkdir:	mini_fo_mkdir,
-+		rmdir:	mini_fo_rmdir,
-+		mknod:	mini_fo_mknod,
-+		rename:	mini_fo_rename,
-+		/* no readlink/follow_link for non-symlinks */
-+		// off because we have setattr
-+		//    truncate:	mini_fo_truncate,
-+		/* mk:permission:	mini_fo_permission, */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+		revalidate:	mini_fo_inode_revalidate,
-+#endif
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		getattr:	mini_fo_getattr,
-+#endif
-+		setattr:	mini_fo_setattr,
-+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20))
-+		setxattr:	mini_fo_setxattr,
-+		getxattr:	mini_fo_getxattr,
-+		listxattr:	mini_fo_listxattr,
-+		removexattr: mini_fo_removexattr
-+# endif /* XATTR && LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) */
-+	};
-+
-+struct inode_operations mini_fo_main_iops =
-+	{
-+		/* permission:	mini_fo_permission, */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+		revalidate:	mini_fo_inode_revalidate,
-+#endif
-+		setattr:	mini_fo_setattr,
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		getattr:	mini_fo_getattr,
-+#endif
-+#if defined(XATTR) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20))
-+		setxattr:	mini_fo_setxattr,
-+		getxattr:	mini_fo_getxattr,
-+		listxattr:	mini_fo_listxattr,
-+		removexattr:    mini_fo_removexattr
-+# endif /* XATTR && LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20) */
-+	};
---- /dev/null
-+++ b/fs/mini_fo/main.c
-@@ -0,0 +1,423 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+#include <linux/module.h>
-+
-+/* This definition must only appear after we include <linux/module.h> */
-+#ifndef MODULE_LICENSE
-+# define MODULE_LICENSE(bison)
-+#endif /* not MODULE_LICENSE */
-+
-+/*
-+ * This is the mini_fo tri interpose function, which extends the
-+ * functionality of the regular interpose by interposing a higher
-+ * level inode on top of two lower level ones: the base filesystem
-+ * inode and the storage filesystem inode.
-+ *
-+ *  sb we pass is mini_fo's super_block
-+ */
-+int
-+mini_fo_tri_interpose(dentry_t *hidden_dentry,
-+		      dentry_t *hidden_sto_dentry,
-+		      dentry_t *dentry, super_block_t *sb, int flag)
-+{
-+	inode_t *hidden_inode = NULL;
-+	inode_t *hidden_sto_inode = NULL; /* store corresponding storage inode */
-+	int err = 0;
-+	inode_t *inode;
-+
-+	/* Pointer to hidden_sto_inode if exists, else to hidden_inode.
-+	 * This is used to copy the attributes of the correct inode. */
-+	inode_t *master_inode;
-+
-+	if(hidden_dentry)
-+		hidden_inode = hidden_dentry->d_inode;
-+	if(hidden_sto_dentry)
-+		hidden_sto_inode = hidden_sto_dentry->d_inode;
-+
-+	ASSERT(dentry->d_inode == NULL);
-+
-+	/* mk: One of the inodes associated with the dentrys is likely to
-+	 * be NULL, so carefull:
-+	 */
-+	ASSERT((hidden_inode != NULL) || (hidden_sto_inode != NULL));
-+
-+	if(hidden_sto_inode)
-+		master_inode = hidden_sto_inode;
-+	else
-+		master_inode = hidden_inode;
-+
-+	/*
-+	 * We allocate our new inode below, by calling iget.
-+	 * iget will call our read_inode which will initialize some
-+	 * of the new inode's fields
-+	 */
-+
-+	/*
-+	 * original: inode = iget(sb, hidden_inode->i_ino);
-+	 */
-+	inode = iget(sb, iunique(sb, 25));
-+	if (!inode) {
-+		err = -EACCES;		/* should be impossible??? */
-+		goto out;
-+	}
-+
-+	/*
-+	 * interpose the inode if not already interposed
-+	 *   this is possible if the inode is being reused
-+	 * XXX: what happens if we get_empty_inode() but there's another already?
-+	 * for now, ASSERT() that this can't happen; fix later.
-+	 */
-+	if (itohi(inode) != NULL) {
-+		printk(KERN_CRIT "mini_fo_tri_interpose: itohi(inode) != NULL.\n");
-+	}
-+	if (itohi2(inode) != NULL) {
-+		printk(KERN_CRIT "mini_fo_tri_interpose: itohi2(inode) != NULL.\n");
-+	}
-+
-+	/* mk: Carefull, igrab can't handle NULL inodes (ok, why should it?), so
-+	 * we need to check here:
-+	 */
-+	if(hidden_inode)
-+		itohi(inode) = igrab(hidden_inode);
-+	else
-+		itohi(inode) = NULL;
-+
-+	if(hidden_sto_inode)
-+		itohi2(inode) = igrab(hidden_sto_inode);
-+	else
-+		itohi2(inode) = NULL;
-+
-+
-+	/* Use different set of inode ops for symlinks & directories*/
-+	if (S_ISLNK(master_inode->i_mode))
-+		inode->i_op = &mini_fo_symlink_iops;
-+	else if (S_ISDIR(master_inode->i_mode))
-+		inode->i_op = &mini_fo_dir_iops;
-+
-+	/* Use different set of file ops for directories */
-+	if (S_ISDIR(master_inode->i_mode))
-+		inode->i_fop = &mini_fo_dir_fops;
-+
-+	/* properly initialize special inodes */
-+	if (S_ISBLK(master_inode->i_mode) || S_ISCHR(master_inode->i_mode) ||
-+	    S_ISFIFO(master_inode->i_mode) || S_ISSOCK(master_inode->i_mode)) {
-+		init_special_inode(inode, master_inode->i_mode, master_inode->i_rdev);
-+	}
-+
-+	/* Fix our inode's address operations to that of the lower inode */
-+	if (inode->i_mapping->a_ops != master_inode->i_mapping->a_ops) {
-+		inode->i_mapping->a_ops = master_inode->i_mapping->a_ops;
-+	}
-+
-+	/* only (our) lookup wants to do a d_add */
-+	if (flag)
-+		d_add(dentry, inode);
-+	else
-+		d_instantiate(dentry, inode);
-+
-+	ASSERT(dtopd(dentry) != NULL);
-+
-+	/* all well, copy inode attributes */
-+	fist_copy_attr_all(inode, master_inode);
-+
-+ out:
-+	return err;
-+}
-+
-+/* parse mount options "base=" and "sto=" */
-+dentry_t *
-+mini_fo_parse_options(super_block_t *sb, char *options)
-+{
-+	dentry_t *hidden_root = ERR_PTR(-EINVAL);
-+	dentry_t *hidden_root2 = ERR_PTR(-EINVAL);
-+	struct nameidata nd, nd2;
-+	char *name, *tmp, *end;
-+	int err = 0;
-+
-+	/* We don't want to go off the end of our arguments later on. */
-+	for (end = options; *end; end++);
-+
-+	while (options < end) {
-+		tmp = options;
-+		while (*tmp && *tmp != ',')
-+			tmp++;
-+		*tmp = '\0';
-+		if (!strncmp("base=", options, 5)) {
-+			name = options + 5;
-+			printk(KERN_INFO "mini_fo: using base directory: %s\n", name);
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+			if (path_init(name, LOOKUP_FOLLOW, &nd))
-+				err = path_walk(name, &nd);
-+#else
-+			err = path_lookup(name, LOOKUP_FOLLOW, &nd);
-+#endif
-+			if (err) {
-+				printk(KERN_CRIT "mini_fo: error accessing hidden directory '%s'\n", name);
-+				hidden_root = ERR_PTR(err);
-+				goto out;
-+			}
-+			hidden_root = nd.dentry;
-+			stopd(sb)->base_dir_dentry = nd.dentry;
-+			stopd(sb)->hidden_mnt = nd.mnt;
-+
-+		} else if(!strncmp("sto=", options, 4)) {
-+			/* parse the storage dir */
-+			name = options + 4;
-+			printk(KERN_INFO "mini_fo: using storage directory: %s\n", name);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+			if(path_init(name, LOOKUP_FOLLOW, &nd2))
-+				err = path_walk(name, &nd2);
-+#else
-+                        err = path_lookup(name, LOOKUP_FOLLOW, &nd2);
-+#endif
-+			if(err) {
-+				printk(KERN_CRIT "mini_fo: error accessing hidden storage directory '%s'\n", name);
-+
-+				hidden_root2 = ERR_PTR(err);
-+				goto out;
-+			}
-+			hidden_root2 = nd2.dentry;
-+			stopd(sb)->storage_dir_dentry = nd2.dentry;
-+			stopd(sb)->hidden_mnt2 = nd2.mnt;
-+			stohs2(sb) = hidden_root2->d_sb;
-+
-+			/* validate storage dir, this is done in
-+			 * mini_fo_read_super for the base directory.
-+			 */
-+			if (IS_ERR(hidden_root2)) {
-+				printk(KERN_WARNING "mini_fo_parse_options: storage dentry lookup failed (err = %ld)\n", PTR_ERR(hidden_root2));
-+				goto out;
-+			}
-+			if (!hidden_root2->d_inode) {
-+				printk(KERN_WARNING "mini_fo_parse_options: no storage dir to interpose on.\n");
-+				goto out;
-+			}
-+			stohs2(sb) = hidden_root2->d_sb;
-+		} else {
-+			printk(KERN_WARNING "mini_fo: unrecognized option '%s'\n", options);
-+			hidden_root = ERR_PTR(-EINVAL);
-+			goto out;
-+		}
-+		options = tmp + 1;
-+	}
-+
-+ out:
-+	if(IS_ERR(hidden_root2))
-+		return hidden_root2;
-+	return hidden_root;
-+}
-+
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+static int
-+#else
-+super_block_t *
-+#endif
-+mini_fo_read_super(super_block_t *sb, void *raw_data, int silent)
-+{
-+	dentry_t *hidden_root;
-+	int err = 0;
-+
-+	if (!raw_data) {
-+		printk(KERN_WARNING "mini_fo_read_super: missing argument\n");
-+		err = -EINVAL;
-+		goto out;
-+	}
-+	/*
-+	 * Allocate superblock private data
-+	 */
-+	__stopd(sb) = kmalloc(sizeof(struct mini_fo_sb_info), GFP_KERNEL);
-+	if (!stopd(sb)) {
-+		printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__);
-+		err = -ENOMEM;
-+		goto out;
-+	}
-+	stohs(sb) = NULL;
-+
-+	hidden_root = mini_fo_parse_options(sb, raw_data);
-+	if (IS_ERR(hidden_root)) {
-+		printk(KERN_WARNING "mini_fo_read_super: lookup_dentry failed (err = %ld)\n", PTR_ERR(hidden_root));
-+		err = PTR_ERR(hidden_root);
-+		goto out_free;
-+	}
-+	if (!hidden_root->d_inode) {
-+		printk(KERN_WARNING "mini_fo_read_super: no directory to interpose on\n");
-+		goto out_free;
-+	}
-+	stohs(sb) = hidden_root->d_sb;
-+
-+	/*
-+	 * Linux 2.4.2-ac3 and beyond has code in
-+	 * mm/filemap.c:generic_file_write() that requires sb->s_maxbytes
-+	 * to be populated.  If not set, all write()s under that sb will
-+	 * return 0.
-+	 *
-+	 * Linux 2.4.4+ automatically sets s_maxbytes to MAX_NON_LFS;
-+	 * the filesystem should override it only if it supports LFS.
-+	 */
-+	/* non-SCA code is good to go with LFS */
-+	sb->s_maxbytes = hidden_root->d_sb->s_maxbytes;
-+
-+	sb->s_op = &mini_fo_sops;
-+	/*
-+	 * we can't use d_alloc_root if we want to use
-+	 * our own interpose function unchanged,
-+	 * so we simply replicate *most* of the code in d_alloc_root here
-+	 */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+	sb->s_root = d_alloc(NULL, &(const struct qstr) { "/", 1, 0 });
-+#else
-+	sb->s_root = d_alloc(NULL, &(const struct qstr){hash: 0, name: "/", len : 1});
-+#endif
-+	if (IS_ERR(sb->s_root)) {
-+		printk(KERN_WARNING "mini_fo_read_super: d_alloc failed\n");
-+		err = -ENOMEM;
-+		goto out_dput;
-+	}
-+
-+	sb->s_root->d_op = &mini_fo_dops;
-+	sb->s_root->d_sb = sb;
-+	sb->s_root->d_parent = sb->s_root;
-+
-+	/* link the upper and lower dentries */
-+	__dtopd(sb->s_root) = (struct mini_fo_dentry_info *)
-+		kmalloc(sizeof(struct mini_fo_dentry_info), GFP_KERNEL);
-+	if (!dtopd(sb->s_root)) {
-+		err = -ENOMEM;
-+		goto out_dput2;
-+	}
-+	dtopd(sb->s_root)->state = MODIFIED;
-+	dtohd(sb->s_root) = hidden_root;
-+
-+	/* fanout relevant, interpose on storage root dentry too */
-+	dtohd2(sb->s_root) = stopd(sb)->storage_dir_dentry;
-+
-+	/* ...and call tri-interpose to interpose root dir inodes
-+	 * if (mini_fo_interpose(hidden_root, sb->s_root, sb, 0))
-+	 */
-+	if(mini_fo_tri_interpose(hidden_root, dtohd2(sb->s_root), sb->s_root, sb, 0))
-+		goto out_dput2;
-+
-+	/* initalize the wol list */
-+	itopd(sb->s_root->d_inode)->deleted_list_size = -1;
-+	itopd(sb->s_root->d_inode)->renamed_list_size = -1;
-+	meta_build_lists(sb->s_root);
-+
-+	goto out;
-+
-+ out_dput2:
-+	dput(sb->s_root);
-+ out_dput:
-+	dput(hidden_root);
-+	dput(dtohd2(sb->s_root)); /* release the hidden_sto_dentry too */
-+ out_free:
-+	kfree(stopd(sb));
-+	__stopd(sb) = NULL;
-+ out:
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+        return err;
-+#else
-+        if (err) {
-+		return ERR_PTR(err);
-+        } else {
-+		return sb;
-+        }
-+#endif
-+}
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+static int mini_fo_get_sb(struct file_system_type *fs_type,
-+					  int flags, const char *dev_name,
-+					  void *raw_data, struct vfsmount *mnt)
-+{
-+	return get_sb_nodev(fs_type, flags, raw_data, mini_fo_read_super, mnt);
-+}
-+#else
-+static struct super_block *mini_fo_get_sb(struct file_system_type *fs_type,
-+					  int flags, const char *dev_name,
-+					  void *raw_data)
-+{
-+	return get_sb_nodev(fs_type, flags, raw_data, mini_fo_read_super);
-+}
-+#endif
-+
-+void mini_fo_kill_block_super(struct super_block *sb)
-+{
-+	generic_shutdown_super(sb);
-+	/*
-+	 *      XXX: BUG: Halcrow: Things get unstable sometime after this point:
-+	 *      lib/rwsem-spinlock.c:127: spin_is_locked on uninitialized
-+	 *      fs/fs-writeback.c:402: spin_lock(fs/super.c:a0381828) already
-+	 *      locked by fs/fs-writeback.c/402
-+	 *
-+	 *      Apparently, someone's not releasing a lock on sb_lock...
-+	 */
-+}
-+
-+static struct file_system_type mini_fo_fs_type = {
-+	.owner          = THIS_MODULE,
-+	.name           = "mini_fo",
-+	.get_sb         = mini_fo_get_sb,
-+	.kill_sb        = mini_fo_kill_block_super,
-+	.fs_flags       = 0,
-+};
-+
-+
-+#else
-+static DECLARE_FSTYPE(mini_fo_fs_type, "mini_fo", mini_fo_read_super, 0);
-+#endif
-+
-+static int __init init_mini_fo_fs(void)
-+{
-+	printk("Registering mini_fo version $Id$\n");
-+	return register_filesystem(&mini_fo_fs_type);
-+}
-+static void __exit exit_mini_fo_fs(void)
-+{
-+	printk("Unregistering mini_fo version $Id$\n");
-+	unregister_filesystem(&mini_fo_fs_type);
-+}
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+EXPORT_NO_SYMBOLS;
-+#endif
-+
-+MODULE_AUTHOR("Erez Zadok <[email protected]>");
-+MODULE_DESCRIPTION("FiST-generated mini_fo filesystem");
-+MODULE_LICENSE("GPL");
-+
-+/* MODULE_PARM(fist_debug_var, "i"); */
-+/* MODULE_PARM_DESC(fist_debug_var, "Debug level"); */
-+
-+module_init(init_mini_fo_fs)
-+module_exit(exit_mini_fo_fs)
---- /dev/null
-+++ b/fs/mini_fo/Makefile
-@@ -0,0 +1,17 @@
-+#
-+# Makefile for mini_fo 2.4 and 2.6 Linux kernels
-+#
-+# Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+#
-+# 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.
-+#
-+
-+obj-$(CONFIG_MINI_FO) := mini_fo.o
-+mini_fo-objs   := meta.o dentry.o file.o inode.o main.o super.o state.o aux.o
-+
-+# dependencies
-+${mini_fo-objs}: mini_fo.h fist.h
-+
---- /dev/null
-+++ b/fs/mini_fo/meta.c
-@@ -0,0 +1,1000 @@
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif /* HAVE_CONFIG_H */
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+int meta_build_lists(dentry_t *dentry)
-+{
-+	struct mini_fo_inode_info *inode_info;
-+
-+	dentry_t *meta_dentry = 0;
-+	file_t *meta_file = 0;
-+	mm_segment_t old_fs;
-+	void *buf;
-+
-+	int bytes, len;
-+	struct vfsmount *meta_mnt;
-+	char *entry;
-+
-+	inode_info = itopd(dentry->d_inode);
-+	if(!(inode_info->deleted_list_size == -1 &&
-+	     inode_info->renamed_list_size == -1)) {
-+		printk(KERN_CRIT "mini_fo: meta_build_lists: \
-+                                  Error, list(s) not virgin.\n");
-+		return -1;
-+	}
-+
-+	/* init our meta lists */
-+	INIT_LIST_HEAD(&inode_info->deleted_list);
-+	inode_info->deleted_list_size = 0;
-+
-+	INIT_LIST_HEAD(&inode_info->renamed_list);
-+	inode_info->renamed_list_size = 0;
-+
-+  	/* might there be a META-file? */
-+	if(dtohd2(dentry) && dtohd2(dentry)->d_inode) {
-+		meta_dentry = lookup_one_len(META_FILENAME,
-+					     dtohd2(dentry),
-+					     strlen(META_FILENAME));
-+		if(!meta_dentry->d_inode) {
-+			dput(meta_dentry);
-+			goto out_ok;
-+		}
-+		/* $%& err, is this correct? */
-+		meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2;
-+		mntget(meta_mnt);
-+
-+
-+		/* open META-file for reading */
-+		meta_file = dentry_open(meta_dentry, meta_mnt, 0x0);
-+		if(!meta_file || IS_ERR(meta_file)) {
-+			printk(KERN_CRIT "mini_fo: meta_build_lists: \
-+                                          ERROR opening META file.\n");
-+			goto out_err;
-+		}
-+
-+		/* check if fs supports reading */
-+		if(!meta_file->f_op->read) {
-+			printk(KERN_CRIT "mini_fo: meta_build_lists: \
-+                                          ERROR, fs does not support reading.\n");
-+			goto out_err_close;
-+		}
-+
-+		/* allocate a page for transfering the data */
-+		buf = (void *) __get_free_page(GFP_KERNEL);
-+		if(!buf) {
-+			printk(KERN_CRIT "mini_fo: meta_build_lists: \
-+                                          ERROR, out of mem.\n");
-+			goto out_err_close;
-+		}
-+		meta_file->f_pos = 0;
-+		old_fs = get_fs();
-+		set_fs(KERNEL_DS);
-+		do {
-+			char *c;
-+			bytes = meta_file->f_op->read(meta_file, buf, PAGE_SIZE, &meta_file->f_pos);
-+			if(bytes == PAGE_SIZE) {
-+				/* trim a cut off filename and adjust f_pos to get it next time */
-+				for(c = (char*) buf+PAGE_SIZE;
-+				    *c != '\n';
-+				    c--, bytes--, meta_file->f_pos--);
-+			}
-+			entry = (char *) buf;
-+			while(entry < (char *) buf+bytes) {
-+
-+				char *old_path;
-+				char *dir_name;
-+				int old_len, new_len;
-+
-+				/* len without '\n'*/
-+				len = (int) (strchr(entry, '\n') - entry);
-+				switch (*entry) {
-+				case 'D':
-+					/* format: "D filename" */
-+					meta_list_add_d_entry(dentry,
-+							      entry+2,
-+							      len-2);
-+					break;
-+				case 'R':
-+					/* format: "R path/xy/dir newDir" */
-+					old_path = entry+2;
-+					dir_name = strchr(old_path, ' ') + 1;
-+					old_len =  dir_name - old_path - 1;
-+					new_len = ((int) entry) + len - ((int ) dir_name);
-+					meta_list_add_r_entry(dentry,
-+							      old_path,
-+							      old_len,
-+							      dir_name,
-+							      new_len);
-+					break;
-+				default:
-+					/* unknown entry type detected */
-+					break;
-+				}
-+				entry += len+1;
-+			}
-+
-+		} while(meta_file->f_pos < meta_dentry->d_inode->i_size);
-+
-+		free_page((unsigned long) buf);
-+		set_fs(old_fs);
-+		fput(meta_file);
-+	}
-+	goto out_ok;
-+
-+ out_err_close:
-+	fput(meta_file);
-+ out_err:
-+	mntput(meta_mnt);
-+	dput(meta_dentry);
-+	return -1;
-+ out_ok:
-+	return 1; /* check this!!! inode_info->wol_size; */
-+}
-+
-+/* cleanups up all lists and free's the mem by dentry */
-+int meta_put_lists(dentry_t *dentry)
-+{
-+	if(!dentry || !dentry->d_inode) {
-+		printk("mini_fo: meta_put_lists: invalid dentry passed.\n");
-+		return -1;
-+	}
-+	return __meta_put_lists(dentry->d_inode);
-+}
-+
-+/* cleanups up all lists and free's the mem by inode */
-+int __meta_put_lists(inode_t *inode)
-+{
-+	int err = 0;
-+	if(!inode || !itopd(inode)) {
-+		printk("mini_fo: __meta_put_lists: invalid inode passed.\n");
-+		return -1;
-+	}
-+	err = __meta_put_d_list(inode);
-+	err |= __meta_put_r_list(inode);
-+	return err;
-+}
-+
-+int meta_sync_lists(dentry_t *dentry)
-+{
-+	int err = 0;
-+	if(!dentry || !dentry->d_inode) {
-+		printk("mini_fo: meta_sync_lists: \
-+                        invalid dentry passed.\n");
-+		return -1;
-+	}
-+	err = meta_sync_d_list(dentry, 0);
-+	err |= meta_sync_r_list(dentry, 1);
-+	return err;
-+}
-+
-+
-+/* remove all D entries from the renamed list and free the mem */
-+int __meta_put_d_list(inode_t *inode)
-+{
-+	struct list_head *tmp;
-+        struct deleted_entry *del_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!inode || !itopd(inode)) {
-+		printk(KERN_CRIT "mini_fo: __meta_put_d_list: \
-+                                  invalid inode passed.\n");
-+		return -1;
-+	}
-+	inode_info = itopd(inode);
-+
-+        /* nuke the DELETED-list */
-+        if(inode_info->deleted_list_size <= 0)
-+		return 0;
-+
-+	while(!list_empty(&inode_info->deleted_list)) {
-+		tmp = inode_info->deleted_list.next;
-+		list_del(tmp);
-+		del_entry = list_entry(tmp, struct deleted_entry, list);
-+		kfree(del_entry->name);
-+		kfree(del_entry);
-+	}
-+	inode_info->deleted_list_size = 0;
-+
-+	return 0;
-+}
-+
-+/* remove all R entries from the renamed list and free the mem */
-+int __meta_put_r_list(inode_t *inode)
-+{
-+	struct list_head *tmp;
-+	struct renamed_entry *ren_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!inode || !itopd(inode)) {
-+		printk(KERN_CRIT "mini_fo: meta_put_r_list: invalid inode.\n");
-+		return -1;
-+	}
-+	inode_info = itopd(inode);
-+
-+        /* nuke the RENAMED-list */
-+        if(inode_info->renamed_list_size <= 0)
-+		return 0;
-+
-+	while(!list_empty(&inode_info->renamed_list)) {
-+		tmp = inode_info->renamed_list.next;
-+		list_del(tmp);
-+		ren_entry = list_entry(tmp, struct renamed_entry, list);
-+		kfree(ren_entry->new_name);
-+		kfree(ren_entry->old_name);
-+		kfree(ren_entry);
-+	}
-+	inode_info->renamed_list_size = 0;
-+
-+	return 0;
-+}
-+
-+int meta_add_d_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	int err = 0;
-+	err = meta_list_add_d_entry(dentry, name, len);
-+	err |= meta_write_d_entry(dentry,name,len);
-+	return err;
-+}
-+
-+/* add a D entry to the deleted list */
-+int meta_list_add_d_entry(dentry_t *dentry, const char *name, int len)
-+{
-+        struct deleted_entry *del_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: meta_list_add_d_entry: \
-+                                  invalid dentry passed.\n");
-+		return -1;
-+	}
-+	inode_info = itopd(dentry->d_inode);
-+
-+        if(inode_info->deleted_list_size < 0)
-+                return -1;
-+
-+        del_entry = (struct deleted_entry *)
-+		kmalloc(sizeof(struct deleted_entry), GFP_KERNEL);
-+        del_entry->name = (char*) kmalloc(len, GFP_KERNEL);
-+        if(!del_entry || !del_entry->name) {
-+                printk(KERN_CRIT "mini_fo: meta_list_add_d_entry: \
-+                                  out of mem.\n");
-+		kfree(del_entry->name);
-+		kfree(del_entry);
-+                return -ENOMEM;
-+        }
-+
-+        strncpy(del_entry->name, name, len);
-+        del_entry->len = len;
-+
-+        list_add(&del_entry->list, &inode_info->deleted_list);
-+        inode_info->deleted_list_size++;
-+        return 0;
-+}
-+
-+int meta_add_r_entry(dentry_t *dentry,
-+			  const char *old_name, int old_len,
-+			  const char *new_name, int new_len)
-+{
-+	int err = 0;
-+	err = meta_list_add_r_entry(dentry,
-+				    old_name, old_len,
-+				    new_name, new_len);
-+	err |= meta_write_r_entry(dentry,
-+				  old_name, old_len,
-+				  new_name, new_len);
-+	return err;
-+}
-+
-+/* add a R entry to the renamed list */
-+int meta_list_add_r_entry(dentry_t *dentry,
-+			  const char *old_name, int old_len,
-+			  const char *new_name, int new_len)
-+{
-+        struct renamed_entry *ren_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: meta_list_add_r_entry: \
-+                                  invalid dentry passed.\n");
-+		return -1;
-+	}
-+	inode_info = itopd(dentry->d_inode);
-+
-+        if(inode_info->renamed_list_size < 0)
-+                return -1;
-+
-+        ren_entry = (struct renamed_entry *)
-+		kmalloc(sizeof(struct renamed_entry), GFP_KERNEL);
-+        ren_entry->old_name = (char*) kmalloc(old_len, GFP_KERNEL);
-+        ren_entry->new_name = (char*) kmalloc(new_len, GFP_KERNEL);
-+
-+        if(!ren_entry || !ren_entry->old_name || !ren_entry->new_name) {
-+                printk(KERN_CRIT "mini_fo: meta_list_add_r_entry: \
-+                                  out of mem.\n");
-+		kfree(ren_entry->new_name);
-+		kfree(ren_entry->old_name);
-+		kfree(ren_entry);
-+                return -ENOMEM;
-+        }
-+
-+        strncpy(ren_entry->old_name, old_name, old_len);
-+        ren_entry->old_len = old_len;
-+        strncpy(ren_entry->new_name, new_name, new_len);
-+        ren_entry->new_len = new_len;
-+
-+        list_add(&ren_entry->list, &inode_info->renamed_list);
-+        inode_info->renamed_list_size++;
-+        return 0;
-+}
-+
-+
-+int meta_remove_r_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	int err = 0;
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT
-+		       "mini_fo: meta_remove_r_entry: \
-+                        invalid dentry passed.\n");
-+		return -1;
-+	}
-+
-+	err = meta_list_remove_r_entry(dentry, name, len);
-+	err |= meta_sync_lists(dentry);
-+	return err;
-+}
-+
-+int meta_list_remove_r_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT
-+		       "mini_fo: meta_list_remove_r_entry: \
-+                        invalid dentry passed.\n");
-+		return -1;
-+	}
-+	return __meta_list_remove_r_entry(dentry->d_inode, name, len);
-+}
-+
-+int __meta_list_remove_r_entry(inode_t *inode, const char *name, int len)
-+{
-+	struct list_head *tmp;
-+        struct renamed_entry *ren_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!inode || !itopd(inode))
-+		printk(KERN_CRIT
-+		       "mini_fo: __meta_list_remove_r_entry: \
-+                        invalid inode passed.\n");
-+	inode_info = itopd(inode);
-+
-+        if(inode_info->renamed_list_size < 0)
-+                return -1;
-+        if(inode_info->renamed_list_size == 0)
-+                return 1;
-+
-+	list_for_each(tmp, &inode_info->renamed_list) {
-+		ren_entry = list_entry(tmp, struct renamed_entry, list);
-+		if(ren_entry->new_len != len)
-+			continue;
-+
-+		if(!strncmp(ren_entry->new_name, name, len)) {
-+			list_del(tmp);
-+			kfree(ren_entry->new_name);
-+			kfree(ren_entry->old_name);
-+			kfree(ren_entry);
-+			inode_info->renamed_list_size--;
-+			return 0;
-+		}
-+	}
-+	return 1;
-+}
-+
-+
-+/* append a single D entry to the meta file */
-+int meta_write_d_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	dentry_t *meta_dentry = 0;
-+        file_t *meta_file = 0;
-+        mm_segment_t old_fs;
-+
-+        int bytes, err;
-+        struct vfsmount *meta_mnt = 0;
-+        char *buf;
-+
-+	err = 0;
-+
-+	if(itopd(dentry->d_inode)->deleted_list_size < 0) {
-+		err = -1;
-+		goto out;
-+	}
-+
-+	if(dtopd(dentry)->state == UNMODIFIED) {
-+                err = build_sto_structure(dentry->d_parent, dentry);
-+                if(err) {
-+                        printk(KERN_CRIT "mini_fo: meta_write_d_entry: \
-+                                          build_sto_structure failed.\n");
-+			goto out;
-+                }
-+        }
-+	meta_dentry = lookup_one_len(META_FILENAME,
-+				     dtohd2(dentry), strlen (META_FILENAME));
-+
-+	/* We need to create a META-file */
-+        if(!meta_dentry->d_inode) {
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry,
-+			   S_IRUSR | S_IWUSR,
-+			   NULL);
-+#else
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry,
-+			   S_IRUSR | S_IWUSR);
-+#endif
-+	}
-+        /* open META-file for writing */
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        if(!meta_file || IS_ERR(meta_file)) {
-+                printk(KERN_CRIT "mini_fo: meta_write_d_entry: \
-+                                  ERROR opening meta file.\n");
-+                mntput(meta_mnt); /* $%& is this necessary? */
-+                dput(meta_dentry);
-+		err = -1;
-+                goto out;
-+        }
-+
-+        /* check if fs supports writing */
-+        if(!meta_file->f_op->write) {
-+                printk(KERN_CRIT "mini_fo: meta_write_d_entry: \
-+                                  ERROR, fs does not support writing.\n");
-+                goto out_err_close;
-+        }
-+
-+	meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */
-+        old_fs = get_fs();
-+        set_fs(KERNEL_DS);
-+
-+	/* size: len for name, 1 for \n and 2 for "D " */
-+	buf = (char *) kmalloc(len+3, GFP_KERNEL);
-+	if (!buf) {
-+		printk(KERN_CRIT "mini_fo: meta_write_d_entry: \
-+                                  out of mem.\n");
-+		return -ENOMEM;
-+	}
-+
-+	buf[0] = 'D';
-+	buf[1] = ' ';
-+	strncpy(buf+2, name, len);
-+	buf[len+2] = '\n';
-+	bytes = meta_file->f_op->write(meta_file, buf, len+3,
-+				       &meta_file->f_pos);
-+	if(bytes != len+3) {
-+		printk(KERN_CRIT "mini_fo: meta_write_d_entry: \
-+                                  ERROR writing.\n");
-+		err = -1;
-+	}
-+	kfree(buf);
-+	set_fs(old_fs);
-+
-+ out_err_close:
-+	fput(meta_file);
-+ out:
-+	return err;
-+}
-+
-+/* append a single R entry to the meta file */
-+int meta_write_r_entry(dentry_t *dentry,
-+		       const char *old_name, int old_len,
-+		       const char *new_name, int new_len)
-+{
-+	dentry_t *meta_dentry = 0;
-+        file_t *meta_file = 0;
-+        mm_segment_t old_fs;
-+
-+        int bytes, err, buf_len;
-+	struct vfsmount *meta_mnt = 0;
-+        char *buf;
-+
-+
-+	err = 0;
-+
-+	if(itopd(dentry->d_inode)->renamed_list_size < 0) {
-+		err = -1;
-+		goto out;
-+	}
-+
-+	/* build the storage structure? */
-+	if(dtopd(dentry)->state == UNMODIFIED) {
-+                err = build_sto_structure(dentry->d_parent, dentry);
-+                if(err) {
-+                        printk(KERN_CRIT "mini_fo: meta_write_r_entry: \
-+                                          build_sto_structure failed.\n");
-+			goto out;
-+                }
-+        }
-+	meta_dentry = lookup_one_len(META_FILENAME,
-+				     dtohd2(dentry),
-+				     strlen (META_FILENAME));
-+        if(!meta_dentry->d_inode) {
-+                /* We need to create a META-file */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry, S_IRUSR | S_IWUSR, NULL);
-+#else
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry, S_IRUSR | S_IWUSR);
-+#endif
-+	}
-+        /* open META-file for writing */
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        if(!meta_file || IS_ERR(meta_file)) {
-+                printk(KERN_CRIT "mini_fo: meta_write_r_entry: \
-+                                  ERROR opening meta file.\n");
-+                mntput(meta_mnt);
-+                dput(meta_dentry);
-+		err = -1;
-+                goto out;
-+        }
-+
-+        /* check if fs supports writing */
-+        if(!meta_file->f_op->write) {
-+                printk(KERN_CRIT "mini_fo: meta_write_r_entry: \
-+                                  ERROR, fs does not support writing.\n");
-+                goto out_err_close;
-+        }
-+
-+	meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */
-+        old_fs = get_fs();
-+        set_fs(KERNEL_DS);
-+
-+	/* size: 2 for "R ", old_len+new_len for names, 1 blank+1 \n */
-+	buf_len = old_len + new_len + 4;
-+	buf = (char *) kmalloc(buf_len, GFP_KERNEL);
-+	if (!buf) {
-+		printk(KERN_CRIT "mini_fo: meta_write_r_entry: out of mem.\n");
-+		return -ENOMEM;
-+	}
-+
-+	buf[0] = 'R';
-+	buf[1] = ' ';
-+	strncpy(buf + 2, old_name, old_len);
-+	buf[old_len + 2] = ' ';
-+	strncpy(buf + old_len + 3, new_name, new_len);
-+	buf[buf_len -1] = '\n';
-+	bytes = meta_file->f_op->write(meta_file, buf, buf_len, &meta_file->f_pos);
-+	if(bytes != buf_len) {
-+		printk(KERN_CRIT "mini_fo: meta_write_r_entry: ERROR writing.\n");
-+		err = -1;
-+	}
-+
-+	kfree(buf);
-+	set_fs(old_fs);
-+
-+ out_err_close:
-+	fput(meta_file);
-+ out:
-+	return err;
-+}
-+
-+/* sync D list to disk, append data if app_flag is 1 */
-+/* check the meta_mnt, which seems not to be used (properly)  */
-+
-+int meta_sync_d_list(dentry_t *dentry, int app_flag)
-+{
-+	dentry_t *meta_dentry;
-+        file_t *meta_file;
-+        mm_segment_t old_fs;
-+
-+        int bytes, err;
-+        struct vfsmount *meta_mnt;
-+        char *buf;
-+
-+	struct list_head *tmp;
-+        struct deleted_entry *del_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	err = 0;
-+	meta_file=0;
-+	meta_mnt=0;
-+
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                  invalid inode passed.\n");
-+		err = -1;
-+		goto out;
-+	}
-+	inode_info = itopd(dentry->d_inode);
-+
-+        if(inode_info->deleted_list_size < 0) {
-+		err = -1;
-+		goto out;
-+	}
-+
-+	/* ok, there is something to sync */
-+
-+	/* build the storage structure? */
-+        if(!dtohd2(dentry) && !itohi2(dentry->d_inode)) {
-+                err = build_sto_structure(dentry->d_parent, dentry);
-+                if(err) {
-+                        printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                          build_sto_structure failed.\n");
-+			goto out;
-+                }
-+        }
-+	meta_dentry = lookup_one_len(META_FILENAME,
-+				     dtohd2(dentry),
-+				     strlen(META_FILENAME));
-+        if(!meta_dentry->d_inode) {
-+                /* We need to create a META-file */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry, S_IRUSR | S_IWUSR, NULL);
-+#else
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry, S_IRUSR | S_IWUSR);
-+#endif
-+		app_flag = 0;
-+	}
-+	/* need we truncate the meta file? */
-+	if(!app_flag) {
-+		struct iattr newattrs;
-+                newattrs.ia_size = 0;
-+                newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&meta_dentry->d_inode->i_mutex);
-+#else
-+                down(&meta_dentry->d_inode->i_sem);
-+#endif
-+                err = notify_change(meta_dentry, &newattrs);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&meta_dentry->d_inode->i_mutex);
-+#else
-+                up(&meta_dentry->d_inode->i_sem);
-+#endif
-+
-+                if(err || meta_dentry->d_inode->i_size != 0) {
-+                        printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                          ERROR truncating meta file.\n");
-+                        goto out_err_close;
-+		}
-+	}
-+
-+        /* open META-file for writing */
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        if(!meta_file || IS_ERR(meta_file)) {
-+                printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                  ERROR opening meta file.\n");
-+		/* we don't mntget so we dont't mntput (for now)
-+		 * mntput(meta_mnt);
-+		 */
-+		dput(meta_dentry);
-+		err = -1;
-+                goto out;
-+        }
-+
-+        /* check if fs supports writing */
-+        if(!meta_file->f_op->write) {
-+                printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                  ERROR, fs does not support writing.\n");
-+                goto out_err_close;
-+        }
-+
-+	meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */
-+        old_fs = get_fs();
-+        set_fs(KERNEL_DS);
-+
-+	/* here we go... */
-+        list_for_each(tmp, &inode_info->deleted_list) {
-+		del_entry = list_entry(tmp, struct deleted_entry, list);
-+
-+		/* size: len for name, 1 for \n and 2 for "D " */
-+		buf = (char *) kmalloc(del_entry->len+3, GFP_KERNEL);
-+		if (!buf) {
-+			printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                          out of mem.\n");
-+			return -ENOMEM;
-+		}
-+
-+		buf[0] = 'D';
-+		buf[1] = ' ';
-+		strncpy(buf+2, del_entry->name, del_entry->len);
-+		buf[del_entry->len+2] = '\n';
-+		bytes = meta_file->f_op->write(meta_file, buf,
-+					       del_entry->len+3,
-+					       &meta_file->f_pos);
-+		if(bytes != del_entry->len+3) {
-+			printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-+                                          ERROR writing.\n");
-+			err |= -1;
-+		}
-+		kfree(buf);
-+	}
-+	set_fs(old_fs);
-+
-+ out_err_close:
-+	fput(meta_file);
-+ out:
-+	return err;
-+
-+}
-+
-+int meta_sync_r_list(dentry_t *dentry, int app_flag)
-+{
-+	dentry_t *meta_dentry;
-+        file_t *meta_file;
-+        mm_segment_t old_fs;
-+
-+        int bytes, err, buf_len;
-+        struct vfsmount *meta_mnt;
-+        char *buf;
-+
-+	struct list_head *tmp;
-+        struct renamed_entry *ren_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	err = 0;
-+	meta_file=0;
-+	meta_mnt=0;
-+
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                  invalid dentry passed.\n");
-+		err = -1;
-+		goto out;
-+	}
-+	inode_info = itopd(dentry->d_inode);
-+
-+        if(inode_info->deleted_list_size < 0) {
-+		err = -1;
-+		goto out;
-+	}
-+
-+	/* ok, there is something to sync */
-+
-+	/* build the storage structure? */
-+        if(!dtohd2(dentry) && !itohi2(dentry->d_inode)) {
-+                err = build_sto_structure(dentry->d_parent, dentry);
-+                if(err) {
-+                        printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                          build_sto_structure failed.\n");
-+			goto out;
-+                }
-+        }
-+	meta_dentry = lookup_one_len(META_FILENAME,
-+				     dtohd2(dentry),
-+				     strlen(META_FILENAME));
-+        if(!meta_dentry->d_inode) {
-+                /* We need to create a META-file */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry, S_IRUSR | S_IWUSR, NULL);
-+#else
-+                vfs_create(dtohd2(dentry)->d_inode,
-+			   meta_dentry, S_IRUSR | S_IWUSR);
-+#endif
-+		app_flag = 0;
-+	}
-+	/* need we truncate the meta file? */
-+	if(!app_flag) {
-+		struct iattr newattrs;
-+                newattrs.ia_size = 0;
-+                newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_lock(&meta_dentry->d_inode->i_mutex);
-+#else
-+                down(&meta_dentry->d_inode->i_sem);
-+#endif
-+                err = notify_change(meta_dentry, &newattrs);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&meta_dentry->d_inode->i_mutex);
-+#else
-+                up(&meta_dentry->d_inode->i_sem);
-+#endif
-+                if(err || meta_dentry->d_inode->i_size != 0) {
-+                        printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                          ERROR truncating meta file.\n");
-+                        goto out_err_close;
-+		}
-+	}
-+
-+        /* open META-file for writing */
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        if(!meta_file || IS_ERR(meta_file)) {
-+                printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                  ERROR opening meta file.\n");
-+		/* we don't mntget so we dont't mntput (for now)
-+		 * mntput(meta_mnt);
-+		 */
-+		dput(meta_dentry);
-+		err = -1;
-+                goto out;
-+        }
-+
-+        /* check if fs supports writing */
-+        if(!meta_file->f_op->write) {
-+                printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                  ERROR, fs does not support writing.\n");
-+                goto out_err_close;
-+        }
-+
-+	meta_file->f_pos = meta_dentry->d_inode->i_size; /* append */
-+        old_fs = get_fs();
-+        set_fs(KERNEL_DS);
-+
-+	/* here we go... */
-+        list_for_each(tmp, &inode_info->renamed_list) {
-+		ren_entry = list_entry(tmp, struct renamed_entry, list);
-+		/* size:
-+		 * 2 for "R ", old_len+new_len for names, 1 blank+1 \n */
-+		buf_len = ren_entry->old_len + ren_entry->new_len + 4;
-+		buf = (char *) kmalloc(buf_len, GFP_KERNEL);
-+		if (!buf) {
-+			printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                          out of mem.\n");
-+			return -ENOMEM;
-+		}
-+		buf[0] = 'R';
-+		buf[1] = ' ';
-+		strncpy(buf + 2, ren_entry->old_name, ren_entry->old_len);
-+		buf[ren_entry->old_len + 2] = ' ';
-+		strncpy(buf + ren_entry->old_len + 3,
-+			ren_entry->new_name, ren_entry->new_len);
-+		buf[buf_len - 1] = '\n';
-+		bytes = meta_file->f_op->write(meta_file, buf,
-+					       buf_len, &meta_file->f_pos);
-+		if(bytes != buf_len) {
-+			printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-+                                          ERROR writing.\n");
-+			err |= -1;
-+		}
-+		kfree(buf);
-+	}
-+	set_fs(old_fs);
-+
-+ out_err_close:
-+	fput(meta_file);
-+ out:
-+	return err;
-+}
-+
-+int meta_check_d_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	if(!dentry || !dentry->d_inode)
-+		printk(KERN_CRIT "mini_fo: meta_check_d_dentry: \
-+                                  invalid dentry passed.\n");
-+	return __meta_check_d_entry(dentry->d_inode, name, len);
-+}
-+
-+int __meta_check_d_entry(inode_t *inode, const char *name, int len)
-+{
-+	struct list_head *tmp;
-+        struct deleted_entry *del_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!inode || !itopd(inode))
-+		printk(KERN_CRIT "mini_fo: __meta_check_d_dentry: \
-+                                  invalid inode passed.\n");
-+
-+        inode_info = itopd(inode);
-+
-+        if(inode_info->deleted_list_size <= 0)
-+                return 0;
-+
-+        list_for_each(tmp, &inode_info->deleted_list) {
-+		del_entry = list_entry(tmp, struct deleted_entry, list);
-+		if(del_entry->len != len)
-+			continue;
-+
-+		if(!strncmp(del_entry->name, name, len))
-+			return 1;
-+	}
-+	return 0;
-+}
-+
-+/*
-+ * check if file has been renamed and return path to orig. base dir.
-+ * Implements no error return values so far, what of course sucks.
-+ * String is null terminated.'
-+ */
-+char* meta_check_r_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: meta_check_r_dentry: \
-+                                  invalid dentry passed.\n");
-+		return NULL;
-+	}
-+	return __meta_check_r_entry(dentry->d_inode, name, len);
-+}
-+
-+char* __meta_check_r_entry(inode_t *inode, const char *name, int len)
-+{
-+	struct list_head *tmp;
-+        struct renamed_entry *ren_entry;
-+        struct mini_fo_inode_info *inode_info;
-+	char *old_path;
-+
-+	if(!inode || !itopd(inode)) {
-+		printk(KERN_CRIT "mini_fo: meta_check_r_dentry: \
-+                                  invalid inode passed.\n");
-+		return NULL;
-+	}
-+	inode_info = itopd(inode);
-+
-+        if(inode_info->renamed_list_size <= 0)
-+                return NULL;
-+
-+        list_for_each(tmp, &inode_info->renamed_list) {
-+		ren_entry = list_entry(tmp, struct renamed_entry, list);
-+		if(ren_entry->new_len != len)
-+			continue;
-+
-+		if(!strncmp(ren_entry->new_name, name, len)) {
-+			old_path = (char *)
-+				kmalloc(ren_entry->old_len+1, GFP_KERNEL);
-+			strncpy(old_path,
-+				ren_entry->old_name,
-+				ren_entry->old_len);
-+			old_path[ren_entry->old_len]='\0';
-+			return old_path;
-+		}
-+	}
-+	return NULL;
-+}
-+
-+/*
-+ * This version only checks if entry exists and return:
-+ *     1 if exists,
-+ *     0 if not,
-+ *    -1 if error.
-+ */
-+int meta_is_r_entry(dentry_t *dentry, const char *name, int len)
-+{
-+	if(!dentry || !dentry->d_inode) {
-+		printk(KERN_CRIT "mini_fo: meta_check_r_dentry [2]: \
-+                                  invalid dentry passed.\n");
-+		return -1;
-+	}
-+	return __meta_is_r_entry(dentry->d_inode, name, len);
-+}
-+
-+int __meta_is_r_entry(inode_t *inode, const char *name, int len)
-+{
-+	struct list_head *tmp;
-+        struct renamed_entry *ren_entry;
-+        struct mini_fo_inode_info *inode_info;
-+
-+	if(!inode || !itopd(inode)) {
-+		printk(KERN_CRIT "mini_fo: meta_check_r_dentry [2]: \
-+                                  invalid inode passed.\n");
-+		return -1;
-+	}
-+	inode_info = itopd(inode);
-+
-+        if(inode_info->renamed_list_size <= 0)
-+                return -1;
-+
-+        list_for_each(tmp, &inode_info->renamed_list) {
-+		ren_entry = list_entry(tmp, struct renamed_entry, list);
-+		if(ren_entry->new_len != len)
-+			continue;
-+
-+		if(!strncmp(ren_entry->new_name, name, len))
-+			return 1;
-+	}
-+	return 0;
-+}
-+
---- /dev/null
-+++ b/fs/mini_fo/mini_fo.h
-@@ -0,0 +1,510 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifndef __MINI_FO_H_
-+#define __MINI_FO_H_
-+
-+#ifdef __KERNEL__
-+
-+/* META stuff */
-+#define META_FILENAME "META_dAfFgHE39ktF3HD2sr"
-+
-+/* use xattrs? */
-+#define XATTR
-+
-+/* File attributes that when changed, result in a file beeing copied to storage */
-+#define COPY_FLAGS ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_SIZE
-+
-+/*
-+ * mini_fo filestates
-+ */
-+#define MODIFIED       1
-+#define UNMODIFIED     2
-+#define CREATED        3
-+#define DEL_REWRITTEN  4
-+#define DELETED        5
-+#define NON_EXISTANT   6
-+
-+/* fist file systems superblock magic */
-+# define MINI_FO_SUPER_MAGIC 0xf15f
-+
-+/*
-+ * STRUCTURES:
-+ */
-+
-+/* mini_fo inode data in memory */
-+struct mini_fo_inode_info {
-+	inode_t *wii_inode;
-+	inode_t *wii_inode2; /* pointer to storage inode */
-+
-+	/* META-data lists */
-+	/* deleted list, ex wol */
-+	struct list_head deleted_list;
-+	int deleted_list_size;
-+
-+	/* renamed list */
-+	struct list_head renamed_list;
-+	int renamed_list_size;
-+
-+	/* add other lists here ... */
-+};
-+
-+/* mini_fo dentry data in memory */
-+struct mini_fo_dentry_info {
-+	dentry_t *wdi_dentry;
-+	dentry_t *wdi_dentry2; /* pointer to  storage dentry */
-+	unsigned int state;  /* state of the mini_fo dentry */
-+};
-+
-+
-+/* mini_fo super-block data in memory */
-+struct mini_fo_sb_info {
-+	super_block_t *wsi_sb, *wsi_sb2; /* mk: might point to the same sb */
-+	struct vfsmount *hidden_mnt, *hidden_mnt2;
-+	dentry_t *base_dir_dentry;
-+	dentry_t *storage_dir_dentry;
-+	;
-+};
-+
-+/* readdir_data, readdir helper struct */
-+struct readdir_data {
-+	struct list_head ndl_list; /* linked list head ptr */
-+	int ndl_size; /* list size */
-+	int sto_done; /* flag to show that the storage dir entries have
-+		       * all been read an now follow base entries */
-+};
-+
-+/* file private data. */
-+struct mini_fo_file_info {
-+	struct file *wfi_file;
-+	struct file *wfi_file2; /* pointer to storage file */
-+	struct readdir_data rd;
-+};
-+
-+/* struct ndl_entry */
-+struct ndl_entry {
-+	struct list_head list;
-+	char *name;
-+	int len;
-+};
-+
-+/********************************
-+ *  META-data structures
-+ ********************************/
-+
-+/* deleted entry */
-+struct deleted_entry {
-+	struct list_head list;
-+	char *name;
-+	int len;
-+};
-+
-+/* renamed entry */
-+struct renamed_entry {
-+	struct list_head list;
-+	char *old_name;     /* old directory with full path */
-+	int old_len;        /* length of above string */
-+	char *new_name;     /* new directory name */
-+	int new_len;        /* length of above string */
-+};
-+
-+/* attr_change entry */
-+struct attr_change_entry {
-+	struct list_head list;
-+	char *name;
-+	int len;
-+};
-+
-+/* link entry */
-+struct link_entry {
-+	struct list_head list;
-+	int links_moved;
-+	int inum_base;
-+	int inum_sto;
-+	char *weird_name;
-+	int weird_name_len;
-+};
-+
-+
-+/* Some other stuff required for mini_fo_filldir64, copied from
-+ * fs/readdir.c
-+ */
-+
-+#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
-+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
-+
-+
-+struct linux_dirent64 {
-+        u64             d_ino;
-+        s64             d_off;
-+        unsigned short  d_reclen;
-+        unsigned char   d_type;
-+        char            d_name[0];
-+};
-+
-+
-+struct getdents_callback64 {
-+        struct linux_dirent64 * current_dir;
-+        struct linux_dirent64 * previous;
-+        int count;
-+        int error;
-+};
-+
-+struct linux_dirent {
-+	unsigned long   d_ino;
-+	unsigned long   d_off;
-+	unsigned short  d_reclen;
-+	char            d_name[1];
-+};
-+
-+struct getdents_callback {
-+	struct linux_dirent * current_dir;
-+	struct linux_dirent * previous;
-+	int count;
-+	int error;
-+};
-+
-+
-+/*
-+ * MACROS:
-+ */
-+
-+/* file TO private_data */
-+# define ftopd(file) ((struct mini_fo_file_info *)((file)->private_data))
-+# define __ftopd(file) ((file)->private_data)
-+/* file TO hidden_file */
-+# define ftohf(file) ((ftopd(file))->wfi_file)
-+# define ftohf2(file) ((ftopd(file))->wfi_file2)
-+
-+/* inode TO private_data */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+# define itopd(ino) ((struct mini_fo_inode_info *)(ino)->i_private)
-+# define __itopd(ino) ((ino)->i_private)
-+#else
-+# define itopd(ino) ((struct mini_fo_inode_info *)(ino)->u.generic_ip)
-+# define __itopd(ino) ((ino)->u.generic_ip)
-+#endif
-+/* inode TO hidden_inode */
-+# define itohi(ino) (itopd(ino)->wii_inode)
-+# define itohi2(ino) (itopd(ino)->wii_inode2)
-+
-+/* superblock TO private_data */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+# define stopd(super) ((struct mini_fo_sb_info *)(super)->s_fs_info)
-+# define __stopd(super) ((super)->s_fs_info)
-+#else
-+# define stopd(super) ((struct mini_fo_sb_info *)(super)->u.generic_sbp)
-+# define __stopd(super) ((super)->u.generic_sbp)
-+#endif
-+
-+/* unused? # define vfs2priv stopd */
-+/* superblock TO hidden_superblock */
-+
-+# define stohs(super) (stopd(super)->wsi_sb)
-+# define stohs2(super) (stopd(super)->wsi_sb2)
-+
-+/* dentry TO private_data */
-+# define dtopd(dentry) ((struct mini_fo_dentry_info *)(dentry)->d_fsdata)
-+# define __dtopd(dentry) ((dentry)->d_fsdata)
-+/* dentry TO hidden_dentry */
-+# define dtohd(dent) (dtopd(dent)->wdi_dentry)
-+# define dtohd2(dent) (dtopd(dent)->wdi_dentry2)
-+
-+/* dentry to state */
-+# define dtost(dent) (dtopd(dent)->state)
-+# define sbt(sb) ((sb)->s_type->name)
-+
-+#define IS_WRITE_FLAG(flag) (flag & (O_RDWR | O_WRONLY | O_APPEND))
-+#define IS_COPY_FLAG(flag) (flag & (COPY_FLAGS))
-+
-+/* macros to simplify non-SCA code */
-+#  define MALLOC_PAGE_POINTERS(hidden_pages, num_hidden_pages)
-+#  define MALLOC_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages)
-+#  define FREE_PAGE_POINTERS(hidden_pages, num)
-+#  define FREE_PAGEDATA_POINTERS(hidden_pages_data, num)
-+#  define FOR_EACH_PAGE
-+#  define CURRENT_HIDDEN_PAGE hidden_page
-+#  define CURRENT_HIDDEN_PAGEDATA hidden_page_data
-+#  define CURRENT_HIDDEN_PAGEINDEX page->index
-+
-+/*
-+ * EXTERNALS:
-+ */
-+extern struct file_operations mini_fo_main_fops;
-+extern struct file_operations mini_fo_dir_fops;
-+extern struct inode_operations mini_fo_main_iops;
-+extern struct inode_operations mini_fo_dir_iops;
-+extern struct inode_operations mini_fo_symlink_iops;
-+extern struct super_operations mini_fo_sops;
-+extern struct dentry_operations mini_fo_dops;
-+extern struct vm_operations_struct mini_fo_shared_vmops;
-+extern struct vm_operations_struct mini_fo_private_vmops;
-+extern struct address_space_operations mini_fo_aops;
-+
-+#if 0 /* unused by mini_fo */
-+extern int mini_fo_interpose(dentry_t *hidden_dentry, dentry_t *this_dentry, super_block_t *sb, int flag);
-+#if defined(FIST_FILTER_DATA) || defined(FIST_FILTER_SCA)
-+extern page_t *mini_fo_get1page(file_t *file, int index);
-+extern int mini_fo_fill_zeros(file_t *file, page_t *page, unsigned from);
-+# endif /* FIST_FILTER_DATA || FIST_FILTER_SCA */
-+
-+
-+#  define mini_fo_hidden_dentry(d) __mini_fo_hidden_dentry(__FILE__,__FUNCTION__,__LINE__,(d))
-+#  define mini_fo_hidden_sto_dentry(d) __mini_fo_hidden_sto_dentry(__FILE__,__FUNCTION__,__LINE__,(d))
-+
-+extern dentry_t *__mini_fo_hidden_dentry(char *file, char *func, int line, dentry_t *this_dentry);
-+extern dentry_t *__mini_fo_hidden_sto_dentry(char *file, char *func, int line, dentry_t *this_dentry);
-+
-+extern int mini_fo_read_file(const char *filename, void *buf, int len);
-+extern int mini_fo_write_file(const char *filename, void *buf, int len);
-+extern dentry_t *fist_lookup(dentry_t *dir, const char *name, vnode_t **out, uid_t uid, gid_t gid);
-+#endif /* unused by mini_fo */
-+
-+/* state transition functions */
-+extern int nondir_unmod_to_mod(dentry_t *dentry, int cp_flag);
-+extern int nondir_del_rew_to_del(dentry_t *dentry);
-+extern int nondir_creat_to_del(dentry_t *dentry);
-+extern int nondir_mod_to_del(dentry_t *dentry);
-+extern int nondir_unmod_to_del(dentry_t *dentry);
-+
-+extern int dir_unmod_to_mod(dentry_t *dentry);
-+
-+/* rename specials */
-+extern int rename_directory(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry);
-+extern int rename_nondir(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry);
-+
-+/* misc stuff */
-+extern int mini_fo_tri_interpose(dentry_t *hidden_dentry,
-+				 dentry_t *hidden_sto_dentry,
-+				 dentry_t *dentry,
-+				 super_block_t *sb, int flag);
-+
-+extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt,
-+			   dentry_t *src_dentry, struct vfsmount *src_mnt);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd);
-+
-+extern int create_sto_nod(dentry_t *dentry, int mode, dev_t dev);
-+extern int create_sto_reg_file(dentry_t *dentry, int mode, struct nameidata *nd);
-+#else
-+extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode);
-+
-+extern int create_sto_nod(dentry_t *dentry, int mode, int dev);
-+extern int create_sto_reg_file(dentry_t *dentry, int mode);
-+#endif
-+
-+extern int create_sto_dir(dentry_t *dentry, int mode);
-+
-+extern int exists_in_storage(dentry_t *dentry);
-+extern int is_mini_fo_existant(dentry_t *dentry);
-+extern int get_neg_sto_dentry(dentry_t *dentry);
-+extern int build_sto_structure(dentry_t *dir, dentry_t *dentry);
-+extern int get_mini_fo_bpath(dentry_t *dentry, char **bpath, int *bpath_len);
-+extern dentry_t *bpath_walk(super_block_t *sb, char *bpath);
-+extern int bpath_put(dentry_t *dentry);
-+
-+/* check_mini_fo types functions */
-+extern int check_mini_fo_dentry(dentry_t *dentry);
-+extern int check_mini_fo_file(file_t *file);
-+extern int check_mini_fo_inode(inode_t *inode);
-+
-+/* General meta functions, can be called from outside of meta.c */
-+extern int meta_build_lists(dentry_t *dentry);
-+extern int meta_put_lists(dentry_t *dentry);
-+extern int __meta_put_lists(inode_t *inode);
-+
-+extern int meta_add_d_entry(dentry_t *dentry, const char *name, int len);
-+extern int meta_add_r_entry(dentry_t *dentry,
-+			    const char *old_name, int old_len,
-+			    const char *new_name, int new_len);
-+
-+extern int meta_remove_r_entry(dentry_t *dentry, const char *name, int len);
-+
-+extern int meta_check_d_entry(dentry_t *dentry, const char *name, int len);
-+extern int __meta_check_d_entry(inode_t *inode, const char *name, int len);
-+
-+extern char* meta_check_r_entry(dentry_t *dentry, const char *name, int len);
-+extern char* __meta_check_r_entry(inode_t *inode, const char *name, int len);
-+extern int meta_is_r_entry(dentry_t *dentry, const char *name, int len);
-+extern int __meta_is_r_entry(inode_t *inode, const char *name, int len);
-+
-+/* Specific meta functions, should be called only inside meta.c */
-+extern int __meta_put_d_list(inode_t *inode);
-+extern int __meta_put_r_list(inode_t *inode);
-+
-+extern int meta_list_add_d_entry(dentry_t *dentry,
-+				 const char *name, int len);
-+extern int meta_list_add_r_entry(dentry_t *dentry,
-+				 const char *old_name, int old_len,
-+				 const char *new_name, int new_len);
-+
-+extern int meta_list_remove_r_entry(dentry_t *dentry,
-+				    const char *name, int len);
-+
-+extern int __meta_list_remove_r_entry(inode_t *inode,
-+				      const char *name, int len);
-+
-+extern int meta_write_d_entry(dentry_t *dentry, const char *name, int len);
-+extern int meta_write_r_entry(dentry_t *dentry,
-+			      const char *old_name, int old_len,
-+			      const char *new_name, int new_len);
-+
-+extern int meta_sync_lists(dentry_t *dentry);
-+extern int meta_sync_d_list(dentry_t *dentry, int app_flag);
-+extern int meta_sync_r_list(dentry_t *dentry, int app_flag);
-+
-+/* ndl stuff */
-+extern int ndl_add_entry(struct readdir_data *rd, const char *name, int len);
-+extern void ndl_put_list(struct readdir_data *rd);
-+extern int ndl_check_entry(struct readdir_data *rd,
-+			   const char *name, int len);
-+
-+
-+# define copy_inode_size(dst, src) \
-+    dst->i_size = src->i_size; \
-+    dst->i_blocks = src->i_blocks;
-+
-+static inline void
-+fist_copy_attr_atime(inode_t *dest, const inode_t *src)
-+{
-+	ASSERT(dest != NULL);
-+	ASSERT(src != NULL);
-+	dest->i_atime = src->i_atime;
-+}
-+static inline void
-+fist_copy_attr_times(inode_t *dest, const inode_t *src)
-+{
-+	ASSERT(dest != NULL);
-+	ASSERT(src != NULL);
-+	dest->i_atime = src->i_atime;
-+	dest->i_mtime = src->i_mtime;
-+	dest->i_ctime = src->i_ctime;
-+}
-+static inline void
-+fist_copy_attr_timesizes(inode_t *dest, const inode_t *src)
-+{
-+	ASSERT(dest != NULL);
-+	ASSERT(src != NULL);
-+	dest->i_atime = src->i_atime;
-+	dest->i_mtime = src->i_mtime;
-+	dest->i_ctime = src->i_ctime;
-+	copy_inode_size(dest, src);
-+}
-+static inline void
-+fist_copy_attr_all(inode_t *dest, const inode_t *src)
-+{
-+	ASSERT(dest != NULL);
-+	ASSERT(src != NULL);
-+	dest->i_mode = src->i_mode;
-+	dest->i_nlink = src->i_nlink;
-+	dest->i_uid = src->i_uid;
-+	dest->i_gid = src->i_gid;
-+	dest->i_rdev = src->i_rdev;
-+	dest->i_atime = src->i_atime;
-+	dest->i_mtime = src->i_mtime;
-+	dest->i_ctime = src->i_ctime;
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
-+	dest->i_blksize = src->i_blksize;
-+#endif
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,12)
-+	dest->i_blkbits = src->i_blkbits;
-+# endif /* linux 2.4.12 and newer */
-+	copy_inode_size(dest, src);
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-+	dest->i_attr_flags = src->i_attr_flags;
-+#else
-+	dest->i_flags = src->i_flags;
-+#endif
-+}
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+/* copied from linux/fs.h */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+static inline void double_lock(struct dentry *d1, struct dentry *d2)
-+{
-+	struct mutex *m1 = &d1->d_inode->i_mutex;
-+	struct mutex *m2 = &d2->d_inode->i_mutex;
-+	if (m1 != m2) {
-+		if ((unsigned long) m1 < (unsigned long) m2) {
-+			struct mutex *tmp = m2;
-+			m2 = m1; m1 = tmp;
-+		}
-+		mutex_lock(m1);
-+	}
-+	mutex_lock(m2);
-+}
-+
-+static inline void double_unlock(struct dentry *d1, struct dentry *d2)
-+{
-+	struct mutex *m1 = &d1->d_inode->i_mutex;
-+	struct mutex *m2 = &d2->d_inode->i_mutex;
-+	mutex_unlock(m1);
-+	if (m1 != m2)
-+		mutex_unlock(m2);
-+	dput(d1);
-+	dput(d2);
-+}
-+
-+#else
-+static inline void double_down(struct semaphore *s1, struct semaphore *s2)
-+{
-+        if (s1 != s2) {
-+                if ((unsigned long) s1 < (unsigned long) s2) {
-+                        struct semaphore *tmp = s2;
-+                        s2 = s1; s1 = tmp;
-+                }
-+                down(s1);
-+        }
-+        down(s2);
-+}
-+
-+static inline void double_up(struct semaphore *s1, struct semaphore *s2)
-+{
-+        up(s1);
-+        if (s1 != s2)
-+                up(s2);
-+}
-+
-+static inline void double_lock(struct dentry *d1, struct dentry *d2)
-+{
-+        double_down(&d1->d_inode->i_sem, &d2->d_inode->i_sem);
-+}
-+
-+static inline void double_unlock(struct dentry *d1, struct dentry *d2)
-+{
-+        double_up(&d1->d_inode->i_sem,&d2->d_inode->i_sem);
-+        dput(d1);
-+        dput(d2);
-+}
-+#endif   /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
-+#endif  /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
-+#endif /* __KERNEL__ */
-+
-+/*
-+ * Definitions for user and kernel code
-+ */
-+
-+/* ioctls */
-+
-+#endif	/* not __MINI_FO_H_ */
---- /dev/null
-+++ b/fs/mini_fo/mini_fo-merge
-@@ -0,0 +1,180 @@
-+#!/bin/bash
-+#
-+# Copyright (C) 2005 Markus Klotzbuecher <[email protected]>
-+# 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.
-+#
-+
-+BASE=
-+STO=
-+HELP=
-+DRYRUN=
-+VERBOSE=
-+TMP="/tmp/"
-+META_NAME="META_dAfFgHE39ktF3HD2sr"
-+SKIP_DEL_LIST="skip-delete-list.mini_fo-merge"
-+
-+COMMAND=
-+exec_command()
-+{
-+    if [ x$DRYRUN == "xset" ]; then
-+	echo "  would run: $COMMAND"
-+    elif ! [ x$DRYRUN == "xset" ]; then
-+	if [ x$VERBOSE == "xset" ]; then
-+	    echo "  running: $COMMAND"
-+	fi
-+	eval $COMMAND
-+    fi
-+}
-+
-+usage()
-+{
-+cat <<EOF
-+
-+USAGE: $0 -b <base dir> -s <storage dir>
-+Version 0.1
-+
-+This script merges the contents of a mini_fo storage file system back
-+to the base file system.
-+
-+!!! Warning: This will modify the base filesystem and can destroy data
-+             if used wrongly.
-+
-+Options:
-+     -b <base dir>
-+          the directory of the base file system.
-+
-+     -s <storage dir>
-+          the directory of the storage file system.
-+
-+     -d   dry run, will not change anything and print the commands that
-+          would be executed.
-+
-+     -t   tmp dir for storing temporary file. default: $TMP
-+
-+     -v   show what operations are performed.
-+
-+     -h   displays this message.
-+
-+EOF
-+}
-+
-+# parse parameters
-+while getopts hdvt:b:s: OPTS
-+  do
-+  case $OPTS in
-+      h)  HELP="set";;
-+      d)  DRYRUN="set";;
-+      v)  VERBOSE="set";;
-+      b)  BASE="$OPTARG";;
-+      s)  STO="$OPTARG";;
-+      t)  TMP="$OPTARG";;
-+      ?)  usage
-+	  exit 1;;
-+  esac
-+done
-+
-+if [ "x$HELP" == "xset" ]; then
-+    usage
-+    exit -1
-+fi
-+
-+if ! [ -d "$BASE" ] || ! [ -d "$STO" ]; then
-+    echo -e "$0:\n Error, -s and/or -b argument missing. type $0 -h for help."
-+    exit -1;
-+fi
-+
-+# get full paths
-+pushd $STO; STO=`pwd`; popd
-+pushd $BASE; BASE=`pwd`; popd
-+TMP=${TMP%/}
-+
-+
-+cat<<EOF
-+###############################################################################
-+# mini_fo-merge
-+#
-+# base dir:       $BASE
-+# storage dir:    $STO
-+# meta filename:  $META_NAME
-+# dry run:        $DRYRUN
-+# verbose:        $VERBOSE
-+# tmp files:      $TMP
-+###############################################################################
-+
-+EOF
-+
-+rm $TMP/$SKIP_DEL_LIST
-+
-+# first process all renamed dirs
-+echo "Merging renamed directories..."
-+pushd $STO &> /dev/null
-+find . -name $META_NAME -type f -print0  | xargs -0 -e grep  -e '^R ' | tr -s ':R' ' ' | while read ENTRY; do
-+    echo "entry: $ENTRY"
-+    META_FILE=`echo $ENTRY | cut -d ' ' -f 1`
-+    OLD_B_DIR=`echo $ENTRY | cut -d ' ' -f 2 | sed -e 's/\///'`
-+    NEW_NAME=`echo $ENTRY | cut -d ' ' -f 3`
-+    NEW_B_DIR=`echo $META_FILE | sed -e "s/$META_NAME/$NEW_NAME/" | sed -e 's/^\.\///'`
-+    echo "META_FILE: $META_FILE"
-+    echo "OLD_B_DIR: $OLD_B_DIR"
-+    echo "NEW_NAME: $NEW_NAME"
-+    echo  "NEW_B_DIR: $NEW_B_DIR"
-+
-+    pushd $BASE &> /dev/null
-+    # remove an existing dir in storage
-+    COMMAND="rm -rf $NEW_B_DIR"; exec_command
-+    COMMAND="cp -R $OLD_B_DIR $NEW_B_DIR"; exec_command
-+    echo ""
-+    popd &> /dev/null
-+
-+    # remember this dir to exclude it from deleting later
-+    echo $NEW_B_DIR >> $TMP/$SKIP_DEL_LIST
-+done
-+
-+# delete all whiteouted files from base
-+echo -e "\nDeleting whiteout'ed files from base file system..."
-+find . -name $META_NAME -type f -print0  | xargs -0 -e grep  -e '^D ' | sed -e 's/:D//' | while read ENTRY; do
-+    META_FILE=`echo $ENTRY | cut -d ' ' -f 1`
-+    DEL_NAME=`echo $ENTRY | cut -d ' ' -f 2`
-+    DEL_FILE=`echo $META_FILE | sed -e "s/$META_NAME/$DEL_NAME/" | sed -e 's/^\.\///'`
-+    grep -x $DEL_FILE $TMP/$SKIP_DEL_LIST &> /dev/null
-+    if [ $? -ne 0 ]; then
-+	pushd $BASE &> /dev/null
-+	COMMAND="rm -rf $DEL_FILE"; exec_command
-+	popd &> /dev/null
-+    else
-+	echo "  excluding: $DEL_FILE as in skip-del-list."
-+    fi
-+done
-+
-+# create all dirs and update permissions
-+echo -e "\nSetting up directory structures in base file system..."
-+find . -type d | sed -e 's/^\.\///' | while read DIR; do
-+    PERMS=`stat -c %a $DIR`
-+    DIR_UID=`stat -c %u $DIR`
-+    DIR_GID=`stat -c %g $DIR`
-+    pushd $BASE &> /dev/null
-+    if ! [ -d $DIR ]; then
-+	COMMAND="mkdir -p $DIR"; exec_command
-+    fi
-+    COMMAND="chmod $PERMS $DIR"; exec_command
-+    COMMAND="chown $DIR_UID:$DIR_GID $DIR"; exec_command
-+    popd &> /dev/null
-+done
-+
-+# merge all non-directory files
-+echo -e "\nMerging all non-directory files...."
-+for i in b c p f l s; do
-+    find . -type $i | sed -e 's/^\.\///' | grep -v "$META_NAME" | while read FILE; do
-+	pushd $BASE #&> /dev/null
-+	COMMAND="cp -df $STO/$FILE $BASE/$FILE"; exec_command
-+	popd &> /dev/null
-+    done
-+done
-+popd &> /dev/null
-+
-+#rm $TMP/$SKIP_DEL_LIST
-+
-+echo "Done!"
---- /dev/null
-+++ b/fs/mini_fo/mini_fo-overlay
-@@ -0,0 +1,130 @@
-+#!/bin/bash
-+#
-+# Copyright (C) 2005 Markus Klotzbuecher <[email protected]>
-+# 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.
-+#
-+
-+HELP=
-+SUFF=
-+MNTP=
-+MNT_DIR="/mnt"
-+STO=
-+STO_DIR="/tmp"
-+BASE=
-+
-+usage()
-+{
-+cat <<EOF
-+
-+Usage: $0 [-s suffix] [-d sto_dir_dir] [-m mount point] base_dir
-+Version 0.1
-+
-+This script overlays the given base directory using the mini_fo file
-+system. If only the base directory base_dir is given, $0
-+will use a storage directory called "sto-<base_dir_name>" in $STO_DIR,
-+and mount point "mini_fo-<base_dir_dir>" in $MNT_DIR.
-+
-+Options:
-+     -s <suffix>
-+          add given suffix to storage directory and the mount
-+          point. This is usefull for overlaying one base directory
-+          several times and avoiding conflicts with storage directory
-+          names and mount points.
-+
-+     -d <sto_dir_dir>
-+          change the directory in which the storage directory will be
-+          created (default is currently "$STO_DIR".
-+
-+     -m <mount point>
-+          use an alternative directory to create the mini_fo
-+          mountpoint (default is currently "$MNT_DIR".
-+
-+     -h   displays this message.
-+
-+EOF
-+exit 1;
-+}
-+
-+while getopts hm:s:d: OPTS
-+  do
-+  case $OPTS in
-+      s)  SUFF="$OPTARG";;
-+      d)  STO_DIR="$OPTARG";;
-+      m)  MNT_DIR="$OPTARG";;
-+      h)  HELP="set";;
-+      ?)  usage
-+	  exit 1;;
-+  esac
-+done
-+shift $(($OPTIND - 1))
-+
-+BASE="$1"
-+
-+if [ "x$HELP" == "xset" ]; then
-+    usage
-+    exit -1
-+fi
-+
-+# fix suffix
-+if [ "x$SUFF" != "x" ]; then
-+    SUFF="-$SUFF"
-+fi
-+
-+# kill trailing slashes
-+MNT_DIR=${MNT_DIR%/}
-+STO_DIR=${STO_DIR%/}
-+BASE=${BASE%/}
-+
-+
-+if ! [ -d "$BASE" ]; then
-+    echo "invalid base dir $BASE, run $0 -h for help."
-+    exit -1
-+fi
-+
-+# check opts
-+if ! [ -d "$MNT_DIR" ]; then
-+    echo "invalid mount dir $MNT_DIR, run $0 -h for help."
-+    exit -1
-+fi
-+
-+if ! [ -d "$STO_DIR" ]; then
-+    echo "invalid sto_dir_dir $STO_DIR, run $0 -h for help."
-+    exit -1
-+fi
-+
-+MNTP="$MNT_DIR/mini_fo-`basename $BASE`$SUFF"
-+STO="$STO_DIR/sto-`basename $BASE`$SUFF"
-+
-+# create the mount point if it doesn't exist
-+mkdir -p $MNTP
-+if [ $? -ne 0 ]; then
-+    echo "Error, failed to create mount point $MNTP"
-+fi
-+
-+mkdir -p $STO
-+if [ $? -ne 0 ]; then
-+    echo "Error, failed to create storage dir $STO"
-+fi
-+
-+# check if fs is already mounted
-+mount | grep mini_fo | grep $MNTP &> /dev/null
-+if [ $? -eq 0 ]; then
-+    echo "Error, existing mini_fo mount at $MNTP."
-+    exit -1
-+fi
-+
-+mount | grep mini_fo | grep $STO &> /dev/null
-+if [ $? -eq 0 ]; then
-+    echo "Error, $STO seems to be used already."
-+    exit -1
-+fi
-+
-+# mount
-+mount -t mini_fo -o base=$BASE,sto=$STO $BASE $MNTP
-+
-+if [ $? -ne 0 ]; then
-+    echo "Error, mounting failed, maybe no permisson to mount?"
-+fi
---- /dev/null
-+++ b/fs/mini_fo/mmap.c
-@@ -0,0 +1,637 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif /* HAVE_CONFIG_H */
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+
-+#ifdef FIST_COUNT_WRITES
-+/* for counting writes in the middle vs. regular writes */
-+unsigned long count_writes = 0, count_writes_middle = 0;
-+#endif /* FIST_COUNT_WRITES */
-+
-+/* forward declaration of commit write and prepare write */
-+STATIC int mini_fo_commit_write(file_t *file, page_t *page, unsigned from, unsigned to);
-+STATIC int mini_fo_prepare_write(file_t *file, page_t *page, unsigned from, unsigned to);
-+
-+
-+/*
-+ * Function for handling creation of holes when lseek-ing past the
-+ * end of the file and then writing some data.
-+ */
-+int
-+mini_fo_fill_zeros(file_t* file, page_t *page, unsigned from)
-+{
-+	int err = 0;
-+	dentry_t *dentry = file->f_dentry;
-+	inode_t *inode = dentry->d_inode;
-+	page_t *tmp_page;
-+	int index;
-+
-+	print_entry_location();
-+
-+	for (index = inode->i_size >> PAGE_CACHE_SHIFT; index < page->index; index++) {
-+		tmp_page = mini_fo_get1page(file, index);
-+		if (IS_ERR(tmp_page)) {
-+			err = PTR_ERR(tmp_page);
-+			goto out;
-+		}
-+
-+		/*
-+		 * zero out rest of the contents of the page between the appropriate
-+		 * offsets.
-+		 */
-+		memset((char*)page_address(tmp_page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, PAGE_CACHE_SIZE - (inode->i_size & ~PAGE_CACHE_MASK));
-+
-+		if (! (err = mini_fo_prepare_write(file, tmp_page, 0, PAGE_CACHE_SIZE)))
-+			err = mini_fo_commit_write(file, tmp_page, 0, PAGE_CACHE_SIZE);
-+
-+		page_cache_release(tmp_page);
-+		if (err < 0)
-+			goto out;
-+		if (current->need_resched)
-+			schedule();
-+	}
-+
-+	/* zero out appropriate parts of last page */
-+
-+	/*
-+	 * if the encoding type is block, then adjust the 'from' (where the
-+	 * zeroing will start) offset appropriately
-+	 */
-+	from = from & (~(FIST_ENCODING_BLOCKSIZE - 1));
-+
-+	if ((from - (inode->i_size & ~PAGE_CACHE_MASK)) > 0) {
-+
-+		memset((char*)page_address(page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, from - (inode->i_size & ~PAGE_CACHE_MASK));
-+		if (! (err = mini_fo_prepare_write(file, page, 0, PAGE_CACHE_SIZE)))
-+			err = mini_fo_commit_write(file, page, 0, PAGE_CACHE_SIZE);
-+
-+		if (err < 0)
-+			goto out;
-+		if (current->need_resched)
-+			schedule();
-+	}
-+
-+ out:
-+	print_exit_status(err);
-+	return err;
-+}
-+
-+
-+
-+STATIC int
-+mini_fo_writepage(page_t *page)
-+{
-+	int err = -EIO;
-+	inode_t *inode;
-+	inode_t *hidden_inode;
-+	page_t *hidden_page;
-+	char *kaddr, *hidden_kaddr;
-+
-+	print_entry_location();
-+
-+	inode = page->mapping->host;
-+	hidden_inode = itohi(inode);
-+
-+	/*
-+	 * writepage is called when shared mmap'ed files need to write
-+	 * their pages, while prepare/commit_write are called from the
-+	 * non-paged write() interface.  (However, in 2.3 the two interfaces
-+	 * share the same cache, while in 2.2 they didn't.)
-+	 *
-+	 * So we pretty much have to duplicate much of what commit_write does.
-+	 */
-+
-+	/* find lower page (returns a locked page) */
-+	hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index);
-+	if (!hidden_page)
-+		goto out;
-+
-+	/* get page address, and encode it */
-+	kaddr = (char *) kmap(page);
-+	hidden_kaddr = (char*) kmap(hidden_page);
-+	mini_fo_encode_block(kaddr, hidden_kaddr, PAGE_CACHE_SIZE, inode, inode->i_sb, page->index);
-+	/* if encode_block could fail, then return error */
-+	kunmap(page);
-+	kunmap(hidden_page);
-+
-+	/* call lower writepage (expects locked page) */
-+	err = hidden_inode->i_mapping->a_ops->writepage(hidden_page);
-+
-+	/*
-+	 * update mtime and ctime of lower level file system
-+	 * mini_fo' mtime and ctime are updated by generic_file_write
-+	 */
-+	hidden_inode->i_mtime = hidden_inode->i_ctime = CURRENT_TIME;
-+
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,1)
-+	UnlockPage(hidden_page);	/* b/c grab_cache_page locked it */
-+# endif /* kernel older than 2.4.1 */
-+	page_cache_release(hidden_page); /* b/c grab_cache_page increased refcnt */
-+
-+	if (err)
-+		ClearPageUptodate(page);
-+	else
-+		SetPageUptodate(page);
-+ out:
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,1)
-+	UnlockPage(page);
-+# endif /* kernel 2.4.1 and newer */
-+	print_exit_status(err);
-+	return err;
-+}
-+
-+
-+/*
-+ * get one page from cache or lower f/s, return error otherwise.
-+ * returns unlocked, up-to-date page (if ok), with increased refcnt.
-+ */
-+page_t *
-+mini_fo_get1page(file_t *file, int index)
-+{
-+	page_t *page;
-+	dentry_t *dentry;
-+	inode_t *inode;
-+	struct address_space *mapping;
-+	int err;
-+
-+	print_entry_location();
-+
-+	dentry = file->f_dentry; /* CPW: Moved below print_entry_location */
-+	inode = dentry->d_inode;
-+	mapping = inode->i_mapping;
-+
-+	fist_dprint(8, "%s: read page index %d pid %d\n", __FUNCTION__, index, current->pid);
-+	if (index < 0) {
-+		printk("%s BUG: index=%d\n", __FUNCTION__, index);
-+		page = ERR_PTR(-EIO);
-+		goto out;
-+	}
-+	page = read_cache_page(mapping,
-+			       index,
-+			       (filler_t *) mapping->a_ops->readpage,
-+			       (void *) file);
-+	if (IS_ERR(page))
-+		goto out;
-+	wait_on_page(page);
-+	if (!Page_Uptodate(page)) {
-+		lock_page(page);
-+		err = mapping->a_ops->readpage(file, page);
-+		if (err) {
-+			page = ERR_PTR(err);
-+			goto out;
-+		}
-+		wait_on_page(page);
-+		if (!Page_Uptodate(page)) {
-+			page = ERR_PTR(-EIO);
-+			goto out;
-+		}
-+	}
-+
-+ out:
-+	print_exit_pointer(page);
-+	return page;
-+}
-+
-+
-+/*
-+ * get one page from cache or lower f/s, return error otherwise.
-+ * similar to get1page, but doesn't guarantee that it will return
-+ * an unlocked page.
-+ */
-+page_t *
-+mini_fo_get1page_cached(file_t *file, int index)
-+{
-+	page_t *page;
-+	dentry_t *dentry;
-+	inode_t *inode;
-+	struct address_space *mapping;
-+	int err;
-+
-+	print_entry_location();
-+
-+	dentry = file->f_dentry; /* CPW: Moved below print_entry_location */
-+	inode = dentry->d_inode;
-+	mapping = inode->i_mapping;
-+
-+	fist_dprint(8, "%s: read page index %d pid %d\n", __FUNCTION__, index, current->pid);
-+	if (index < 0) {
-+		printk("%s BUG: index=%d\n", __FUNCTION__, index);
-+		page = ERR_PTR(-EIO);
-+		goto out;
-+	}
-+	page = read_cache_page(mapping,
-+			       index,
-+			       (filler_t *) mapping->a_ops->readpage,
-+			       (void *) file);
-+	if (IS_ERR(page))
-+		goto out;
-+
-+ out:
-+	print_exit_pointer(page);
-+	return page;
-+}
-+
-+
-+/*
-+ * readpage is called from generic_page_read and the fault handler.
-+ * If your file system uses generic_page_read for the read op, it
-+ * must implement readpage.
-+ *
-+ * Readpage expects a locked page, and must unlock it.
-+ */
-+STATIC int
-+mini_fo_do_readpage(file_t *file, page_t *page)
-+{
-+	int err = -EIO;
-+	dentry_t *dentry;
-+	file_t *hidden_file = NULL;
-+	dentry_t *hidden_dentry;
-+	inode_t *inode;
-+	inode_t *hidden_inode;
-+	char *page_data;
-+	page_t *hidden_page;
-+	char *hidden_page_data;
-+	int real_size;
-+
-+	print_entry_location();
-+
-+	dentry = file->f_dentry; /* CPW: Moved below print_entry_location */
-+	if (ftopd(file) != NULL)
-+		hidden_file = ftohf(file);
-+	hidden_dentry = dtohd(dentry);
-+	inode = dentry->d_inode;
-+	hidden_inode = itohi(inode);
-+
-+	fist_dprint(7, "%s: requesting page %d from file %s\n", __FUNCTION__, page->index, dentry->d_name.name);
-+
-+	MALLOC_PAGE_POINTERS(hidden_pages, num_hidden_pages);
-+	MALLOC_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages);
-+	FOR_EACH_PAGE
-+		CURRENT_HIDDEN_PAGE = NULL;
-+
-+	/* find lower page (returns a locked page) */
-+	FOR_EACH_PAGE {
-+		fist_dprint(8, "%s: Current page index = %d\n", __FUNCTION__, CURRENT_HIDDEN_PAGEINDEX);
-+		CURRENT_HIDDEN_PAGE = read_cache_page(hidden_inode->i_mapping,
-+						      CURRENT_HIDDEN_PAGEINDEX,
-+						      (filler_t *) hidden_inode->i_mapping->a_ops->readpage,
-+						      (void *) hidden_file);
-+		if (IS_ERR(CURRENT_HIDDEN_PAGE)) {
-+			err = PTR_ERR(CURRENT_HIDDEN_PAGE);
-+			CURRENT_HIDDEN_PAGE = NULL;
-+			goto out_release;
-+		}
-+	}
-+
-+	/*
-+	 * wait for the page data to show up
-+	 * (signaled by readpage as unlocking the page)
-+	 */
-+	FOR_EACH_PAGE {
-+		wait_on_page(CURRENT_HIDDEN_PAGE);
-+		if (!Page_Uptodate(CURRENT_HIDDEN_PAGE)) {
-+			/*
-+			 * call readpage() again if we returned from wait_on_page with a
-+			 * page that's not up-to-date; that can happen when a partial
-+			 * page has a few buffers which are ok, but not the whole
-+			 * page.
-+			 */
-+			lock_page(CURRENT_HIDDEN_PAGE);
-+			err = hidden_inode->i_mapping->a_ops->readpage(hidden_file,
-+								       CURRENT_HIDDEN_PAGE);
-+			if (err) {
-+				CURRENT_HIDDEN_PAGE = NULL;
-+				goto out_release;
-+			}
-+			wait_on_page(CURRENT_HIDDEN_PAGE);
-+			if (!Page_Uptodate(CURRENT_HIDDEN_PAGE)) {
-+				err = -EIO;
-+				goto out_release;
-+			}
-+		}
-+	}
-+
-+	/* map pages, get their addresses */
-+	page_data = (char *) kmap(page);
-+	FOR_EACH_PAGE
-+		CURRENT_HIDDEN_PAGEDATA = (char *) kmap(CURRENT_HIDDEN_PAGE);
-+
-+	/* if decode_block could fail, then return error */
-+	err = 0;
-+	real_size = hidden_inode->i_size - (page->index << PAGE_CACHE_SHIFT);
-+	if (real_size <= 0)
-+		memset(page_data, 0, PAGE_CACHE_SIZE);
-+	else if (real_size < PAGE_CACHE_SIZE) {
-+		mini_fo_decode_block(hidden_page_data, page_data, real_size, inode, inode->i_sb, page->index);
-+		memset(page_data + real_size, 0, PAGE_CACHE_SIZE - real_size);
-+	} else
-+		mini_fo_decode_block(hidden_page_data, page_data, PAGE_CACHE_SIZE, inode, inode->i_sb, page->index);
-+
-+	FOR_EACH_PAGE
-+		kunmap(CURRENT_HIDDEN_PAGE);
-+	kunmap(page);
-+
-+ out_release:
-+	FOR_EACH_PAGE
-+		if (CURRENT_HIDDEN_PAGE)
-+			page_cache_release(CURRENT_HIDDEN_PAGE); /* undo read_cache_page */
-+
-+	FREE_PAGE_POINTERS(hidden_pages, num_hidden_pages);
-+	FREE_PAGEDATA_POINTERS(hidden_pages_data, num_hidden_pages);
-+
-+ out:
-+	if (err == 0)
-+		SetPageUptodate(page);
-+	else
-+		ClearPageUptodate(page);
-+
-+	print_exit_status(err);
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_readpage(file_t *file, page_t *page)
-+{
-+	int err;
-+	print_entry_location();
-+
-+	err = mini_fo_do_readpage(file, page);
-+
-+	/*
-+	 * we have to unlock our page, b/c we _might_ have gotten a locked page.
-+	 * but we no longer have to wakeup on our page here, b/c UnlockPage does
-+	 * it
-+	 */
-+	UnlockPage(page);
-+
-+	print_exit_status(err);
-+	return err;
-+}
-+
-+
-+STATIC int
-+mini_fo_prepare_write(file_t *file, page_t *page, unsigned from, unsigned to)
-+{
-+	int err = 0;
-+
-+	print_entry_location();
-+
-+	/*
-+	 * we call kmap(page) only here, and do the kunmap
-+	 * and the actual downcalls, including unlockpage and uncache
-+	 * in commit_write.
-+	 */
-+	kmap(page);
-+
-+	/* fast path for whole page writes */
-+	if (from == 0 && to == PAGE_CACHE_SIZE)
-+		goto out;
-+	/* read the page to "revalidate" our data */
-+	/* call the helper function which doesn't unlock the page */
-+	if (!Page_Uptodate(page))
-+		err = mini_fo_do_readpage(file, page);
-+
-+ out:
-+	print_exit_status(err);
-+	return err;
-+}
-+
-+
-+
-+STATIC int
-+mini_fo_commit_write(file_t *file, page_t *page, unsigned from, unsigned to)
-+{
-+	int err = -ENOMEM;
-+	inode_t *inode;
-+	inode_t *hidden_inode;
-+	page_t *hidden_page;
-+	file_t *hidden_file = NULL;
-+	loff_t pos;
-+	unsigned bytes = to - from;
-+	unsigned hidden_from, hidden_to, hidden_bytes;
-+
-+	print_entry_location();
-+
-+	inode = page->mapping->host; /* CPW: Moved below print_entry_location */
-+	hidden_inode = itohi(inode);
-+
-+	ASSERT(file != NULL);
-+	/*
-+	 * here we have a kmapped page, with data from the user copied
-+	 * into it.  we need to encode_block it, and then call the lower
-+	 * commit_write.  We also need to simulate same behavior of
-+	 * generic_file_write, and call prepare_write on the lower f/s first.
-+	 */
-+#ifdef FIST_COUNT_WRITES
-+	count_writes++;
-+# endif /* FIST_COUNT_WRITES */
-+
-+	/* this is append and/or extend -- we can't have holes so fill them in */
-+	if (page->index > (hidden_inode->i_size >> PAGE_CACHE_SHIFT)) {
-+		page_t *tmp_page;
-+		int index;
-+		for (index = hidden_inode->i_size >> PAGE_CACHE_SHIFT; index < page->index; index++) {
-+			tmp_page = mini_fo_get1page(file, index);
-+			if (IS_ERR(tmp_page)) {
-+				err = PTR_ERR(tmp_page);
-+				goto out;
-+			}
-+			/* zero out the contents of the page at the appropriate offsets */
-+			memset((char*)page_address(tmp_page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, PAGE_CACHE_SIZE - (inode->i_size & ~PAGE_CACHE_MASK));
-+			if (!(err = mini_fo_prepare_write(file, tmp_page, 0, PAGE_CACHE_SIZE)))
-+				err = mini_fo_commit_write(file, tmp_page, 0, PAGE_CACHE_SIZE);
-+			page_cache_release(tmp_page);
-+			if (err < 0)
-+				goto out;
-+			if (current->need_resched)
-+				schedule();
-+		}
-+	}
-+
-+	if (ftopd(file) != NULL)
-+		hidden_file = ftohf(file);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_inode->i_mutex);
-+#else
-+	down(&hidden_inode->i_sem);
-+#endif
-+	/* find lower page (returns a locked page) */
-+	hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index);
-+	if (!hidden_page)
-+		goto out;
-+
-+#if FIST_ENCODING_BLOCKSIZE > 1
-+#  error encoding_blocksize greater than 1 is not yet supported
-+# endif /* FIST_ENCODING_BLOCKSIZE > 1 */
-+
-+	hidden_from = from & (~(FIST_ENCODING_BLOCKSIZE - 1));
-+	hidden_to = ((to + FIST_ENCODING_BLOCKSIZE - 1) & (~(FIST_ENCODING_BLOCKSIZE - 1)));
-+	if ((page->index << PAGE_CACHE_SHIFT) + to > hidden_inode->i_size) {
-+
-+		/*
-+		 * if this call to commit_write had introduced holes and the code
-+		 * for handling holes was invoked, then the beginning of this page
-+		 * must be zeroed out
-+		 * zero out bytes from 'size_of_file%pagesize' to 'from'.
-+		 */
-+		if ((hidden_from - (inode->i_size & ~PAGE_CACHE_MASK)) > 0)
-+			memset((char*)page_address(page) + (inode->i_size & ~PAGE_CACHE_MASK), 0, hidden_from - (inode->i_size & ~PAGE_CACHE_MASK));
-+
-+	}
-+	hidden_bytes = hidden_to - hidden_from;
-+
-+	/* call lower prepare_write */
-+	err = -EINVAL;
-+	if (hidden_inode->i_mapping &&
-+	    hidden_inode->i_mapping->a_ops &&
-+	    hidden_inode->i_mapping->a_ops->prepare_write)
-+		err = hidden_inode->i_mapping->a_ops->prepare_write(hidden_file,
-+								    hidden_page,
-+								    hidden_from,
-+								    hidden_to);
-+	if (err)
-+		/* don't leave locked pages behind, esp. on an ENOSPC */
-+		goto out_unlock;
-+
-+	fist_dprint(8, "%s: encoding %d bytes\n", __FUNCTION__, hidden_bytes);
-+	mini_fo_encode_block((char *) page_address(page) + hidden_from, (char*) page_address(hidden_page) + hidden_from, hidden_bytes, inode, inode->i_sb, page->index);
-+	/* if encode_block could fail, then goto unlock and return error */
-+
-+	/* call lower commit_write */
-+	err = hidden_inode->i_mapping->a_ops->commit_write(hidden_file,
-+							   hidden_page,
-+							   hidden_from,
-+							   hidden_to);
-+
-+	if (err < 0)
-+		goto out_unlock;
-+
-+	err = bytes;	/* convert error to no. of bytes */
-+
-+	inode->i_blocks = hidden_inode->i_blocks;
-+	/* we may have to update i_size */
-+	pos = (page->index << PAGE_CACHE_SHIFT) + to;
-+	if (pos > inode->i_size)
-+		inode->i_size = pos;
-+
-+	/*
-+	 * update mtime and ctime of lower level file system
-+	 * mini_fo' mtime and ctime are updated by generic_file_write
-+	 */
-+	hidden_inode->i_mtime = hidden_inode->i_ctime = CURRENT_TIME;
-+
-+	mark_inode_dirty_sync(inode);
-+
-+ out_unlock:
-+	UnlockPage(hidden_page);
-+	page_cache_release(hidden_page);
-+	kunmap(page);		/* kmap was done in prepare_write */
-+ out:
-+	/* we must set our page as up-to-date */
-+	if (err < 0)
-+		ClearPageUptodate(page);
-+	else
-+		SetPageUptodate(page);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_inode->i_mutex);
-+#else
-+	up(&hidden_inode->i_sem);
-+#endif
-+	print_exit_status(err);
-+	return err;			/* assume all is ok */
-+}
-+
-+
-+STATIC int
-+mini_fo_bmap(struct address_space *mapping, long block)
-+{
-+	int err = 0;
-+	inode_t *inode;
-+	inode_t *hidden_inode;
-+
-+	print_entry_location();
-+
-+	inode = (inode_t *) mapping->host;
-+	hidden_inode = itohi(inode);
-+
-+	if (hidden_inode->i_mapping->a_ops->bmap)
-+		err = hidden_inode->i_mapping->a_ops->bmap(hidden_inode->i_mapping, block);
-+	print_exit_location();
-+	return err;
-+}
-+
-+
-+/*
-+ * This function is copied verbatim from mm/filemap.c.
-+ * XXX: It should be simply moved to some header file instead -- bug Al about it!
-+ */
-+static inline int sync_page(struct page *page)
-+{
-+	struct address_space *mapping = page->mapping;
-+
-+	if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
-+		return mapping->a_ops->sync_page(page);
-+	return 0;
-+}
-+
-+
-+/*
-+ * XXX: we may not need this function if not FIST_FILTER_DATA.
-+ * FIXME: for FIST_FILTER_SCA, get all lower pages and sync them each.
-+ */
-+STATIC int
-+mini_fo_sync_page(page_t *page)
-+{
-+	int err = 0;
-+	inode_t *inode;
-+	inode_t *hidden_inode;
-+	page_t *hidden_page;
-+
-+	print_entry_location();
-+
-+	inode = page->mapping->host; /* CPW: Moved below print_entry_location */
-+	hidden_inode = itohi(inode);
-+
-+	/* find lower page (returns a locked page) */
-+	hidden_page = grab_cache_page(hidden_inode->i_mapping, page->index);
-+	if (!hidden_page)
-+		goto out;
-+
-+	err = sync_page(hidden_page);
-+
-+	UnlockPage(hidden_page);	/* b/c grab_cache_page locked it */
-+	page_cache_release(hidden_page); /* b/c grab_cache_page increased refcnt */
-+
-+ out:
-+	print_exit_status(err);
-+	return err;
-+}
---- /dev/null
-+++ b/fs/mini_fo/README
-@@ -0,0 +1,163 @@
-+README for the mini_fo overlay file system
-+=========================================
-+
-+
-+WHAT IS MINI_FO?
-+----------------
-+
-+mini_fo is a virtual kernel file system that can make read-only
-+file systems writable. This is done by redirecting modifying operations
-+to a writeable location called "storage directory", and leaving the
-+original data in the "base directory" untouched. When reading, the
-+file system merges the modifed and original data so that only the
-+newest versions will appear. This occurs transparently to the user,
-+who can access the data like on any other read-write file system.
-+
-+Base and storage directories may be located on the same or on
-+different partitions and may be of different file system types. While
-+the storage directory obviously needs to be writable, the base may or
-+may not be writable, what doesn't matter as it will no be modified
-+anyway.
-+
-+
-+WHAT IS GOOD FOR?
-+-----------------
-+
-+The primary purpose of the mini_fo file system is to allow easy
-+software updates to embedded systems, that often store their root
-+file system in a read-only flash file system, but there are many
-+more as for example sandboxing, or for allowing live-cds to
-+permanently store information.
-+
-+
-+BUILDING
-+--------
-+This should be simple. Adjust the Makefile to point to the correct
-+kernel headers you want to build the module for. Then:
-+
-+    # make
-+
-+should build "mini_fo.o" for a 2.4 kernel or "mini_fo.ko" for a 2.6
-+kernel.
-+
-+If you are building the module for you current kernel, you can install
-+the module (as root):
-+
-+    # make install
-+
-+or uninstall with
-+
-+    # make uninstall
-+
-+
-+USING THE FILE SYSTEM
-+--------------------
-+
-+the general mount syntax is:
-+
-+   mount -t mini_fo -o base=<base directory>,sto=<storage directory>\
-+                            <base directory> <mount point>
-+
-+Example:
-+
-+You have mounted a cdrom to /mnt/cdrom and want to modifiy some files
-+on it:
-+
-+load the module (as root)
-+
-+    # insmod mini_fo.o for a 2.4 kernel or
-+
-+    # insmod mini_fo.ko for a 2.6 kernel
-+
-+
-+create a storage dir in tmp and a mountpoint for mini_fo:
-+
-+    # mkdir /tmp/sto
-+    # mkdir /mnt/mini_fo
-+
-+and mount the mini_fo file system:
-+
-+    # mount -t mini_fo -o base=/mnt/cdrom,sto=/tmp/sto /mnt/cdrom /mnt/mini_fo
-+
-+
-+Now the data stored on the cd can be accessed via the mini_fo
-+mountpoint just like any read-write file system, files can be modified
-+and deleted, new ones can be created and so on. When done unmount the
-+file system:
-+
-+    # unmount /mnt/mini_fo
-+
-+Note that if the file system is mounted again using the same storage
-+file system, of course it will appear in the modified state again. If
-+you remount it using an new empty storage directory, it will be
-+unmodified. Therefore by executing:
-+
-+    # cd /tmp/sto
-+    # rm -rf *
-+
-+you can nuke all the changes you made to the original file system. But
-+ remember NEVER do this while the mini_fo file system is mounted!
-+
-+
-+Alternatively you can use the mini_fo-overlay bash script, that
-+simplifies managing mini_fo mounts. See TOOLS Section.
-+
-+
-+TOOLS
-+-----
-+
-+mini_fo-merge (experimental):
-+
-+This is a bash script that will merge changes contained in the storage
-+directory back to the base directory. This allows mini_fo to function
-+as a cache file system by overlaying a slow (network, ...) file system
-+and using a fast (ramdisk, ...) as storage. When done, changes can be
-+merged back to the (slow) base with mini_fo-merge. See "mini_fo-merge
-+-h" for details.
-+
-+It can be usefull for merging changes back after a successfull test
-+(patches, software updates...)
-+
-+
-+mini_fo-overlay:
-+
-+This bash script simplifies managing one or more mini_fo mounts. For
-+overlaying a directory called "basedir1", you can just call:
-+
-+    # mini_fo-overlay basedir1
-+
-+This will mount mini_fo with "basedir1" as base, "/tmp/sto-basedir1/"
-+as storage to "/mnt/mini_fo-basedir1/". It has more options though,
-+type "mini_fo-overlay -h" for details.
-+
-+
-+DOCUMENTATION, REPORTING BUGS, GETTING HELP
-+-------------------------------------------
-+
-+Please visit the mini_fo project page at:
-+
-+http://www.denx.de/twiki/bin/view/Know/MiniFOHome
-+
-+
-+WARNINGS
-+--------
-+
-+Never modify the base or the storage directorys while the mini_fo
-+file system is mounted, or you might crash you system. Simply accessing
-+and reading should not cause any trouble.
-+
-+Exporting a mini_fo mount point via NFS has not been tested, and may
-+or may not work.
-+
-+Check the RELEASE_NOTES for details on bugs and features.
-+
-+
-+
-+Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+
-+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.
-+
-+
---- /dev/null
-+++ b/fs/mini_fo/RELEASE_NOTES
-@@ -0,0 +1,111 @@
-+Release:	mini_fo-0.6.1 (v0-6-1)
-+Date:		21.09.2005
-+
-+
-+Changes:
-+--------
-+v0-6-1:
-+
-+- bugfixes (see ChangeLog)
-+
-+- two helper scripts "mini_fo_merge" and "mini_fo_overlay" (see
-+  README for details).
-+
-+v0-6-0:
-+
-+- Support for 2.4 and 2.6 (see Makefile)
-+
-+- Partial hard link support (creating works as expected, but already
-+  existing links in the base file system will be treated as if they
-+  were individual files).
-+
-+- Various bugfixes and cleanups.
-+
-+
-+v0-6-0-pre1:
-+
-+- This is mini_fo-0-6-0-pre1! This release is a complete rewrite of
-+  many vital mini_fo parts such as the old whiteout list code which
-+  has been replaced by the new META subsystem.
-+
-+- Light weight directory renaming implemented. This means if a
-+  directory is renamed via the mini_fo filesystem this will no longer
-+  result in a complete copy in storage, instead only one empty
-+  directory will be created. All base filed contained in the original
-+  directory stay there until modified.
-+
-+- Special files (creating, renaming, deleting etc.) now working.
-+
-+- Many bugfixes and cleanup, mini_fo is now a lot more stable.
-+
-+
-+v0-5-10:
-+
-+- Final release of the 0-5-* versions. Next will be a complete rewrite
-+  of many features. This release contains several bugfixes related to
-+  directory renaming.
-+
-+
-+v0-5-10-pre6:
-+
-+- Lots of cleanup and several bugfixes related to directory deleting
-+
-+- Directory renaming suddenly works, what is most likely due to the
-+  fact tha that "mv" is smart: if the classic rename doesn't work it
-+  will assume that source and target file are on different fs and will
-+  copy the directory and try to remove the source directory. Until
-+  directory removing wasn't implemented, it would fail to do this and
-+  rollback.
-+  So, directory renaming works for now, but it doesn't yet do what you
-+  would expect from a overlay fs, so use with care.
-+
-+
-+v0-5-10-pre5:
-+
-+- implemented directory deleting
-+- made parsing of mount options more stable
-+- New format of mount options! (See README)
-+- I can't reproduce the unknown panic with 2.4.25 anymore, so I'll
-+  happily assume it never existed!
-+
-+
-+Implemented features:
-+---------------------
-+
-+- creating hard links (see BUGS on already existing hard links)
-+- lightweight directory renaming
-+- renaming device files, pipes, sockets, etc.
-+- creating, renaming, deleting of special files
-+- deleting directorys
-+- general directory reading (simple "ls" )
-+- creating files in existing directorys
-+- creating directorys
-+- renaming files.
-+- reading and writing files (involves opening)
-+- appending to files (creates copy in storage)
-+- deleting files
-+- llseek works too, what allows editors to work
-+- persistency (a deleted file stay deleted over remounts)
-+- use of symbolic links
-+- creating of device files
-+
-+
-+Not (yet) implemented features:
-+-------------------------------
-+
-+- full hard link support.
-+
-+
-+
-+BUGS:
-+-----
-+
-+Hard links in the base file system will be treated as individual
-+files, not as links to one inode.
-+
-+The main problem with hard links isn't allowing to create them, but
-+their pure existence. If you modify a base hard link, the changes made
-+will only show up on this link, the other link will remain in the
-+original state. I hope to fix this someday. Please note that this does
-+not effect the special hard links '.' and '..', that are handled
-+seperately by the lower fs.
---- /dev/null
-+++ b/fs/mini_fo/state.c
-@@ -0,0 +1,620 @@
-+/*
-+ * Copyright (C) 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif /* HAVE_CONFIG_H */
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+
-+/* create the storage file, setup new states */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+int create_sto_reg_file(dentry_t *dentry, int mode, struct nameidata *nd)
-+#else
-+int create_sto_reg_file(dentry_t *dentry, int mode)
-+#endif
-+{
-+	int err = 0;
-+	inode_t *dir;
-+	dentry_t *hidden_sto_dentry;
-+	dentry_t *hidden_sto_dir_dentry;
-+
-+	if(exists_in_storage(dentry)) {
-+		printk(KERN_CRIT "mini_fo: create_sto_file: wrong type or state.\n");
-+		err = -EINVAL;
-+		goto out;
-+	}
-+	err = get_neg_sto_dentry(dentry);
-+
-+	if (err) {
-+		printk(KERN_CRIT "mini_fo: create_sto_file: ERROR getting neg. sto dentry.\n");
-+		goto out;
-+	}
-+
-+	dir = dentry->d_parent->d_inode;
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	/* lock parent */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+        down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	err = PTR_ERR(hidden_sto_dir_dentry);
-+        if (IS_ERR(hidden_sto_dir_dentry))
-+                goto out;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+	err = vfs_create(hidden_sto_dir_dentry->d_inode,
-+			 hidden_sto_dentry,
-+			 mode, nd);
-+#else
-+	err = vfs_create(hidden_sto_dir_dentry->d_inode,
-+			 hidden_sto_dentry,
-+			 mode);
-+#endif
-+        if(err) {
-+		printk(KERN_CRIT "mini_fo: create_sto_file: ERROR creating sto file.\n");
-+                goto out_lock;
-+	}
-+
-+	if(!dtohd2(dentry)->d_inode) {
-+		printk(KERN_CRIT "mini_fo: create_sto_file: ERROR creating sto file [2].\n");
-+                err = -EINVAL;
-+                goto out_lock;
-+        }
-+
-+        /* interpose the new inode */
-+        if(dtost(dentry) == DELETED) {
-+                dtost(dentry) = DEL_REWRITTEN;
-+                err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0);
-+                if(err)
-+                        goto out_lock;
-+        }
-+        else if(dtost(dentry) == NON_EXISTANT) {
-+                dtost(dentry) = CREATED;
-+                err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0);
-+                if(err)
-+                        goto out_lock;
-+        }
-+        else if(dtost(dentry) == UNMODIFIED) {
-+                dtost(dentry) = MODIFIED;
-+                /* interpose on new inode */
-+                if(itohi2(dentry->d_inode) != NULL) {
-+                        printk(KERN_CRIT "mini_fo: create_sto_file: invalid inode detected.\n");
-+                        err = -EINVAL;
-+                        goto out_lock;
-+                }
-+                itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode);
-+	}
-+	fist_copy_attr_timesizes(dentry->d_parent->d_inode,
-+				 hidden_sto_dir_dentry->d_inode);
-+
-+ out_lock:
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+        dput(hidden_sto_dir_dentry);
-+ out:
-+	return err;
-+}
-+
-+/* create the sto dir, setup states */
-+int create_sto_dir(dentry_t *dentry, int mode)
-+{
-+	int err = 0;
-+	inode_t *dir;
-+	dentry_t *hidden_sto_dentry;
-+        dentry_t *hidden_sto_dir_dentry;
-+
-+	/* had to take the "!S_ISDIR(mode))" check out, because it failed */
-+	if(exists_in_storage(dentry)) {
-+                printk(KERN_CRIT "mini_fo: create_sto_dir: wrong type or state.\\
-+n");
-+                err = -EINVAL;
-+                goto out;
-+        }
-+
-+	err = get_neg_sto_dentry(dentry);
-+	if(err) {
-+		err = -EINVAL;
-+		goto out;
-+	}
-+
-+	dir = dentry->d_parent->d_inode;
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	/* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	err = PTR_ERR(hidden_sto_dir_dentry);
-+	if (IS_ERR(hidden_sto_dir_dentry))
-+		goto out;
-+
-+	err = vfs_mkdir(hidden_sto_dir_dentry->d_inode,
-+			hidden_sto_dentry,
-+			mode);
-+	if(err) {
-+		printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR creating sto dir.\n");
-+		goto out_lock;
-+	}
-+
-+	if(!dtohd2(dentry)->d_inode) {
-+		printk(KERN_CRIT "mini_fo: create_sto_dir: ERROR creating sto dir [2].\n");
-+		err = -EINVAL;
-+		goto out_lock;
-+	}
-+
-+	/* interpose the new inode */
-+	if(dtost(dentry) == DELETED) {
-+		dtost(dentry) = DEL_REWRITTEN;
-+		err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0);
-+		if(err)
-+			goto out_lock;
-+	}
-+	else if(dtopd(dentry)->state == NON_EXISTANT) {
-+		dtopd(dentry)->state = CREATED;
-+		err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0);
-+		if(err)
-+			goto out_lock;
-+	}
-+	else if(dtopd(dentry)->state == UNMODIFIED) {
-+		dtopd(dentry)->state = MODIFIED;
-+		/* interpose on new inode */
-+		if(itohi2(dentry->d_inode) != NULL) {
-+			printk(KERN_CRIT "mini_fo:  create_sto_dir: ERROR, invalid inode detected.\n");
-+			err = -EINVAL;
-+			goto out_lock;
-+		}
-+		itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode);
-+	}
-+
-+	fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode);
-+
-+	/* initalize the wol list */
-+	itopd(dentry->d_inode)->deleted_list_size = -1;
-+	itopd(dentry->d_inode)->renamed_list_size = -1;
-+	meta_build_lists(dentry);
-+
-+
-+ out_lock:
-+	/* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_sto_dir_dentry);
-+ out:
-+	return err;
-+}
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+int create_sto_nod(dentry_t *dentry, int mode, dev_t dev)
-+#else
-+int create_sto_nod(dentry_t *dentry, int mode, int dev)
-+#endif
-+{
-+	int err = 0;
-+	inode_t *dir;
-+	dentry_t *hidden_sto_dentry;
-+	dentry_t *hidden_sto_dir_dentry;
-+
-+	if(exists_in_storage(dentry)) {
-+		err = -EEXIST;
-+		goto out;
-+	}
-+	err = get_neg_sto_dentry(dentry);
-+
-+	if (err) {
-+                printk(KERN_CRIT "mini_fo: create_sto_nod: ERROR getting neg. sto dentry.\n");
-+                goto out;
-+        }
-+
-+	dir = dentry->d_parent->d_inode;
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	/* lock parent */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	err = PTR_ERR(hidden_sto_dir_dentry);
-+	if (IS_ERR(hidden_sto_dir_dentry))
-+		goto out;
-+
-+	err = vfs_mknod(hidden_sto_dir_dentry->d_inode, hidden_sto_dentry, mode, dev);
-+	if(err)
-+		goto out_lock;
-+
-+	if(!dtohd2(dentry)->d_inode) {
-+		printk(KERN_CRIT "mini_fo: create_sto_nod: creating storage inode failed [1].\n");
-+		err = -EINVAL; /* return something indicating failure */
-+		goto out_lock;
-+	}
-+
-+	/* interpose the new inode */
-+	if(dtost(dentry) == DELETED) {
-+		dtost(dentry) = DEL_REWRITTEN;
-+		err = mini_fo_tri_interpose(NULL, hidden_sto_dentry, dentry, dir->i_sb, 0);
-+		if(err)
-+			goto out_lock;
-+	}
-+	else if(dtost(dentry) == NON_EXISTANT) {
-+		dtost(dentry) = CREATED;
-+		err = mini_fo_tri_interpose(dtohd(dentry), hidden_sto_dentry, dentry, dir->i_sb, 0);
-+		if(err)
-+			goto out_lock;
-+	}
-+	else if(dtost(dentry) == UNMODIFIED) {
-+		dtost(dentry) = MODIFIED;
-+		/* interpose on new inode */
-+		if(itohi2(dentry->d_inode) != NULL) {
-+			printk(KERN_CRIT "mini_fo: create_sto_nod: error, invalid inode detected.\n");
-+			err = -EINVAL;
-+			goto out_lock;
-+		}
-+		itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode);
-+	}
-+
-+	fist_copy_attr_timesizes(dir, hidden_sto_dir_dentry->d_inode);
-+
-+ out_lock:
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_sto_dir_dentry);
-+ out:
-+	return err;
-+}
-+
-+
-+/* unimplemented (and possibly not usefull):
-+
-+   nondir-del_to_del_rew
-+   nondir-non_exist_to_creat
-+
-+   dir-unmod_to_del
-+   dir-mod_to_del
-+   dir-creat_to_del
-+   dir-del_rew_to_del
-+   dir-del_to_del_rew
-+   dir-non_exist_to_creat
-+*/
-+
-+
-+/* bring a file of any type from state UNMODIFIED to MODIFIED */
-+int nondir_unmod_to_mod(dentry_t *dentry, int cp_flag)
-+{
-+	int err = 0;
-+	struct vfsmount *tgt_mnt;
-+	struct vfsmount *src_mnt;
-+	dentry_t *tgt_dentry;
-+	dentry_t *src_dentry;
-+	dentry_t *hidden_sto_dentry;
-+	dentry_t *hidden_sto_dir_dentry;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if((dtost(dentry) != UNMODIFIED) ||
-+	   S_ISDIR(dentry->d_inode->i_mode)) {
-+		printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \
-+                                  wrong type or state.\n");
-+		err = -1;
-+		goto out;
-+	}
-+	err = get_neg_sto_dentry(dentry);
-+
-+	if (err) {
-+		printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \
-+                                  ERROR getting neg. sto dentry.\n");
-+		goto out;
-+	}
-+
-+	/* create sto file */
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	/* lock parent */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+        down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	err = PTR_ERR(hidden_sto_dir_dentry);
-+        if (IS_ERR(hidden_sto_dir_dentry))
-+                goto out;
-+
-+	/* handle different types of nondirs */
-+	if(S_ISCHR(dentry->d_inode->i_mode) ||
-+	   S_ISBLK(dentry->d_inode->i_mode)) {
-+		err = vfs_mknod(hidden_sto_dir_dentry->d_inode,
-+				hidden_sto_dentry,
-+				dtohd(dentry)->d_inode->i_mode,
-+				dtohd(dentry)->d_inode->i_rdev);
-+	}
-+
-+	else if(S_ISREG(dentry->d_inode->i_mode)) {
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+		err = vfs_create(hidden_sto_dir_dentry->d_inode,
-+				 hidden_sto_dentry,
-+				 dtohd(dentry)->d_inode->i_mode, NULL);
-+#else
-+		err = vfs_create(hidden_sto_dir_dentry->d_inode,
-+				 hidden_sto_dentry,
-+				 dtohd(dentry)->d_inode->i_mode);
-+#endif
-+	}
-+        if(err) {
-+		printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \
-+                                  ERROR creating sto file.\n");
-+                goto out_lock;
-+	}
-+
-+	/* interpose on new inode */
-+	if(itohi2(dentry->d_inode) != NULL) {
-+		printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \
-+                                  ERROR, invalid inode detected.\n");
-+		err = -EINVAL;
-+		goto out_lock;
-+	}
-+
-+	itohi2(dentry->d_inode) = igrab(dtohd2(dentry)->d_inode);
-+
-+        fist_copy_attr_timesizes(dentry->d_parent->d_inode,
-+				 hidden_sto_dir_dentry->d_inode);
-+	dtost(dentry) = MODIFIED;
-+
-+	/* copy contents if regular file and cp_flag = 1 */
-+	if((cp_flag == 1) && S_ISREG(dentry->d_inode->i_mode)) {
-+
-+		/* unlock first */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+		mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+		up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+		dput(hidden_sto_dir_dentry);
-+
-+		tgt_dentry = dtohd2(dentry);
-+		tgt_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2;
-+		src_dentry = dtohd(dentry);
-+		src_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt;
-+
-+		err = mini_fo_cp_cont(tgt_dentry, tgt_mnt,
-+				      src_dentry, src_mnt);
-+		if(err) {
-+			printk(KERN_CRIT "mini_fo: nondir_unmod_to_mod: \
-+                                          ERROR copying contents.\n");
-+		}
-+		goto out;
-+	}
-+
-+ out_lock:
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+        dput(hidden_sto_dir_dentry);
-+ out:
-+	return err;
-+}
-+
-+/* this function is currently identical to nondir_creat_to_del */
-+int nondir_del_rew_to_del(dentry_t *dentry)
-+{
-+	return nondir_creat_to_del(dentry);
-+}
-+
-+int nondir_creat_to_del(dentry_t *dentry)
-+{
-+	int err = 0;
-+
-+	inode_t *hidden_sto_dir_inode;
-+	dentry_t *hidden_sto_dir_dentry;
-+	dentry_t *hidden_sto_dentry;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	/* for now this function serves for both state DEL_REWRITTEN and
-+	 * CREATED */
-+	if(!(dtost(dentry) == CREATED || (dtost(dentry) == DEL_REWRITTEN)) ||
-+	   S_ISDIR(dentry->d_inode->i_mode)) {
-+		printk(KERN_CRIT "mini_fo: nondir_mod_to_del/del_rew_to_del: \
-+                                  wrong type or state.\n");
-+		err = -1;
-+		goto out;
-+	}
-+
-+	hidden_sto_dir_inode = itohi2(dentry->d_parent->d_inode);
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	/* was: hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry);*/
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	/* avoid destroying the hidden inode if the file is in use */
-+	dget(hidden_sto_dentry);
-+	err = vfs_unlink(hidden_sto_dir_inode, hidden_sto_dentry);
-+	dput(hidden_sto_dentry);
-+	if(!err)
-+		d_delete(hidden_sto_dentry);
-+
-+	/* propagate number of hard-links */
-+	dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink;
-+
-+	dtost(dentry) = NON_EXISTANT;
-+
-+	/* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_sto_dir_dentry);
-+
-+ out:
-+	return err;
-+}
-+
-+int nondir_mod_to_del(dentry_t *dentry)
-+{
-+	int err;
-+	dentry_t *hidden_sto_dentry;
-+	inode_t *hidden_sto_dir_inode;
-+	dentry_t *hidden_sto_dir_dentry;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(dtost(dentry) != MODIFIED ||
-+	   S_ISDIR(dentry->d_inode->i_mode)) {
-+		printk(KERN_CRIT "mini_fo: nondir_mod_to_del: \
-+                                  wrong type or state.\n");
-+		err = -1;
-+		goto out;
-+	}
-+
-+	hidden_sto_dir_inode = itohi2(dentry->d_parent->d_inode);
-+	hidden_sto_dentry = dtohd2(dentry);
-+
-+	/* was hidden_sto_dir_dentry = lock_parent(hidden_sto_dentry); */
-+	hidden_sto_dir_dentry = dget(hidden_sto_dentry->d_parent);
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	down(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+
-+	/* avoid destroying the hidden inode if the file is in use */
-+	dget(hidden_sto_dentry);
-+	err = vfs_unlink(hidden_sto_dir_inode, hidden_sto_dentry);
-+	dput(hidden_sto_dentry);
-+	if(!err)
-+		d_delete(hidden_sto_dentry);
-+
-+	/* propagate number of hard-links */
-+	dentry->d_inode->i_nlink = itohi2(dentry->d_inode)->i_nlink;
-+
-+	/* dput base dentry, this will relase the inode and free the
-+	 * dentry, as we will never need it again. */
-+	dput(dtohd(dentry));
-+	dtohd(dentry) = NULL;
-+	dtost(dentry) = DELETED;
-+
-+	/* add deleted file to META-file */
-+	meta_add_d_entry(dentry->d_parent,
-+			 dentry->d_name.name,
-+			 dentry->d_name.len);
-+
-+	/* was: unlock_dir(hidden_sto_dir_dentry); */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-+	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+#else
-+	up(&hidden_sto_dir_dentry->d_inode->i_sem);
-+#endif
-+	dput(hidden_sto_dir_dentry);
-+
-+ out:
-+	return err;
-+}
-+
-+int nondir_unmod_to_del(dentry_t *dentry)
-+{
-+	int err = 0;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(dtost(dentry) != UNMODIFIED ||
-+	   S_ISDIR(dentry->d_inode->i_mode)) {
-+		printk(KERN_CRIT "mini_fo: nondir_unmod_to_del: \
-+                                  wrong type or state.\n");
-+		err = -1;
-+		goto out;
-+	}
-+
-+	 /* next we have to get a negative dentry for the storage file */
-+	err = get_neg_sto_dentry(dentry);
-+
-+	if(err)
-+		goto out;
-+
-+	/* add deleted file to META lists */
-+	err = meta_add_d_entry(dentry->d_parent,
-+			       dentry->d_name.name,
-+			       dentry->d_name.len);
-+
-+	if(err)
-+		goto out;
-+
-+	/* dput base dentry, this will relase the inode and free the
-+	 * dentry, as we will never need it again. */
-+	dput(dtohd(dentry));
-+	dtohd(dentry) = NULL;
-+	dtost(dentry) = DELETED;
-+
-+ out:
-+	return err;
-+}
-+
-+/* bring a dir from state UNMODIFIED to MODIFIED */
-+int dir_unmod_to_mod(dentry_t *dentry)
-+{
-+	int err;
-+
-+	check_mini_fo_dentry(dentry);
-+
-+	if(dtost(dentry) != UNMODIFIED ||
-+	   !S_ISDIR(dentry->d_inode->i_mode)) {
-+		printk(KERN_CRIT "mini_fo: dir_unmod_to_mod: \
-+                                  wrong type or state.\n");
-+		err = -1;
-+		goto out;
-+	}
-+
-+	/* this creates our dir incl. sto. structure */
-+	err = build_sto_structure(dentry->d_parent, dentry);
-+	if(err) {
-+		printk(KERN_CRIT "mini_fo: dir_unmod_to_mod: \
-+                                  build_sto_structure failed.\n");
-+		goto out;
-+	}
-+ out:
-+	return err;
-+}
-+
---- /dev/null
-+++ b/fs/mini_fo/super.c
-@@ -0,0 +1,281 @@
-+/*
-+ * Copyright (c) 1997-2003 Erez Zadok
-+ * Copyright (c) 2001-2003 Stony Brook University
-+ *
-+ * For specific licensing information, see the COPYING file distributed with
-+ * this package, or get one from ftp://ftp.filesystems.org/pub/fist/COPYING.
-+ *
-+ * This Copyright notice must be kept intact and distributed with all
-+ * fistgen sources INCLUDING sources generated by fistgen.
-+ */
-+/*
-+ * Copyright (C) 2004, 2005 Markus Klotzbuecher <[email protected]>
-+ *
-+ * 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.
-+ */
-+
-+/*
-+ *  $Id$
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+# include <config.h>
-+#endif
-+
-+#include "fist.h"
-+#include "mini_fo.h"
-+
-+
-+STATIC void
-+mini_fo_read_inode(inode_t *inode)
-+{
-+	static struct address_space_operations mini_fo_empty_aops;
-+
-+	__itopd(inode) = kmalloc(sizeof(struct mini_fo_inode_info), GFP_KERNEL);
-+	if (!itopd(inode)) {
-+		printk("<0>%s:%s:%d: No kernel memory!\n", __FILE__, __FUNCTION__, __LINE__);
-+		ASSERT(NULL);
-+	}
-+	itohi(inode) = NULL;
-+	itohi2(inode) = NULL;
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+	inode->i_version++;
-+#else
-+	inode->i_version = ++event;	/* increment inode version */
-+#endif
-+	inode->i_op = &mini_fo_main_iops;
-+	inode->i_fop = &mini_fo_main_fops;
-+#if 0
-+	/*
-+	 * XXX: To export a file system via NFS, it has to have the
-+	 * FS_REQUIRES_DEV flag, so turn it on.  But should we inherit it from
-+	 * the lower file system, or can we allow our file system to be exported
-+	 * even if the lower one cannot be natively exported.
-+	 */
-+	inode->i_sb->s_type->fs_flags |= FS_REQUIRES_DEV;
-+	/*
-+	 * OK, the above was a hack, which is now turned off because it may
-+	 * cause a panic/oops on some systems.  The correct way to export a
-+	 * "nodev" filesystem is via using nfs-utils > 1.0 and the "fsid=" export
-+	 * parameter, which requires 2.4.20 or later.
-+	 */
-+#endif
-+	/* I don't think ->a_ops is ever allowed to be NULL */
-+	inode->i_mapping->a_ops = &mini_fo_empty_aops;
-+}
-+
-+
-+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
-+/*
-+ * No need to call write_inode() on the lower inode, as it
-+ * will have been marked 'dirty' anyway. But we might need
-+ * to write some of our own stuff to disk.
-+ */
-+STATIC void
-+mini_fo_write_inode(inode_t *inode, int sync)
-+{
-+	print_entry_location();
-+	print_exit_location();
-+}
-+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
-+
-+
-+STATIC void
-+mini_fo_put_inode(inode_t *inode)
-+{
-+	/*
-+	 * This is really funky stuff:
-+	 * Basically, if i_count == 1, iput will then decrement it and this inode will be destroyed.
-+	 * It is currently holding a reference to the hidden inode.
-+	 * Therefore, it needs to release that reference by calling iput on the hidden inode.
-+	 * iput() _will_ do it for us (by calling our clear_inode), but _only_ if i_nlink == 0.
-+	 * The problem is, NFS keeps i_nlink == 1 for silly_rename'd files.
-+	 * So we must for our i_nlink to 0 here to trick iput() into calling our clear_inode.
-+	 */
-+	if (atomic_read(&inode->i_count) == 1)
-+		inode->i_nlink = 0;
-+}
-+
-+
-+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
-+/*
-+ * we now define delete_inode, because there are two VFS paths that may
-+ * destroy an inode: one of them calls clear inode before doing everything
-+ * else that's needed, and the other is fine.  This way we truncate the inode
-+ * size (and its pages) and then clear our own inode, which will do an iput
-+ * on our and the lower inode.
-+ */
-+STATIC void
-+mini_fo_delete_inode(inode_t *inode)
-+{
-+	print_entry_location();
-+
-+	fist_checkinode(inode, "mini_fo_delete_inode IN");
-+	inode->i_size = 0;		/* every f/s seems to do that */
-+	clear_inode(inode);
-+
-+	print_exit_location();
-+}
-+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
-+
-+
-+/* final actions when unmounting a file system */
-+STATIC void
-+mini_fo_put_super(super_block_t *sb)
-+{
-+	if (stopd(sb)) {
-+		mntput(stopd(sb)->hidden_mnt);
-+		mntput(stopd(sb)->hidden_mnt2);
-+
-+		/* mk: no! dput(stopd(sb)->base_dir_dentry);
-+		   dput(stopd(sb)->storage_dir_dentry); */
-+
-+		kfree(stopd(sb));
-+		__stopd(sb) = NULL;
-+	}
-+}
-+
-+
-+#ifdef NOT_NEEDED
-+/*
-+ * This is called in do_umount before put_super.
-+ * The superblock lock is not held yet.
-+ * We probably do not need to define this or call write_super
-+ * on the hidden_sb, because sync_supers() will get to hidden_sb
-+ * sooner or later.  But it is also called from file_fsync()...
-+ */
-+STATIC void
-+mini_fo_write_super(super_block_t *sb)
-+{
-+	return;
-+}
-+#endif /* NOT_NEEDED */
-+
-+
-+STATIC int
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+mini_fo_statfs(struct dentry *d, struct kstatfs *buf)
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+mini_fo_statfs(super_block_t *sb, struct kstatfs *buf)
-+#else
-+mini_fo_statfs(super_block_t *sb, struct statfs *buf)
-+#endif
-+{
-+	int err = 0;
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+	struct dentry *hidden_d;
-+
-+	hidden_d = dtohd(d);
-+	err = vfs_statfs(hidden_d, buf);
-+#else
-+	super_block_t *hidden_sb;
-+
-+	hidden_sb = stohs(sb);
-+	err = vfs_statfs(hidden_sb, buf);
-+#endif
-+
-+	return err;
-+}
-+
-+
-+/*
-+ * XXX: not implemented.  This is not allowed yet.
-+ * Should we call this on the hidden_sb?  Probably not.
-+ */
-+STATIC int
-+mini_fo_remount_fs(super_block_t *sb, int *flags, char *data)
-+{
-+	//printk(KERN_CRIT "mini_fo_remount_fs: WARNING, this function is umimplemented.\n");
-+	return -ENOSYS;
-+}
-+
-+
-+/*
-+ * Called by iput() when the inode reference count reached zero
-+ * and the inode is not hashed anywhere.  Used to clear anything
-+ * that needs to be, before the inode is completely destroyed and put
-+ * on the inode free list.
-+ */
-+STATIC void
-+mini_fo_clear_inode(inode_t *inode)
-+{
-+	/*
-+	 * Decrement a reference to a hidden_inode, which was incremented
-+	 * by our read_inode when it was created initially.
-+	 */
-+
-+	/* release the wol_list */
-+	if(S_ISDIR(inode->i_mode)) {
-+		__meta_put_lists(inode);
-+	}
-+
-+	/* mk: fan out fun */
-+	if(itohi(inode))
-+		iput(itohi(inode));
-+	if(itohi2(inode))
-+		iput(itohi2(inode));
-+
-+	// XXX: why this assertion fails?
-+	// because it doesn't like us
-+	// ASSERT((inode->i_state & I_DIRTY) == 0);
-+	kfree(itopd(inode));
-+	__itopd(inode) = NULL;
-+}
-+
-+
-+/*
-+ * Called in do_umount() if the MNT_FORCE flag was used and this
-+ * function is defined.  See comment in linux/fs/super.c:do_umount().
-+ * Used only in nfs, to kill any pending RPC tasks, so that subsequent
-+ * code can actually succeed and won't leave tasks that need handling.
-+ *
-+ * PS. I wonder if this is somehow useful to undo damage that was
-+ * left in the kernel after a user level file server (such as amd)
-+ * dies.
-+ */
-+STATIC void
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+mini_fo_umount_begin(struct vfsmount *mnt, int flags)
-+{
-+	struct vfsmount *hidden_mnt;
-+
-+	hidden_mnt = stopd(mnt->mnt_sb)->hidden_mnt;
-+
-+	if (hidden_mnt->mnt_sb->s_op->umount_begin)
-+		hidden_mnt->mnt_sb->s_op->umount_begin(hidden_mnt, flags);
-+
-+}
-+#else
-+mini_fo_umount_begin(super_block_t *sb)
-+{
-+	super_block_t *hidden_sb;
-+
-+	hidden_sb = stohs(sb);
-+
-+	if (hidden_sb->s_op->umount_begin)
-+		hidden_sb->s_op->umount_begin(hidden_sb);
-+
-+}
-+#endif
-+
-+
-+struct super_operations mini_fo_sops =
-+{
-+	read_inode:		mini_fo_read_inode,
-+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
-+	write_inode:	mini_fo_write_inode,
-+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
-+	put_inode:		mini_fo_put_inode,
-+#if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
-+	delete_inode:	mini_fo_delete_inode,
-+#endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
-+	put_super:		mini_fo_put_super,
-+	statfs:		mini_fo_statfs,
-+	remount_fs:		mini_fo_remount_fs,
-+	clear_inode:	mini_fo_clear_inode,
-+	umount_begin:	mini_fo_umount_begin,
-+};
---- /dev/null
-+++ b/fs/mini_fo/Kconfig
-@@ -0,0 +1,3 @@
-+config MINI_FO
-+	tristate "Mini fanout overlay filesystem"
-+

+ 0 - 143
target/linux/generic/patches-2.6.33/210-mini_fo_2.6.25_fixes.patch

@@ -1,143 +0,0 @@
---- a/fs/mini_fo/main.c
-+++ b/fs/mini_fo/main.c
-@@ -79,6 +79,7 @@ mini_fo_tri_interpose(dentry_t *hidden_d
- 	 * of the new inode's fields
- 	 */
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
- 	/*
- 	 * original: inode = iget(sb, hidden_inode->i_ino);
- 	 */
-@@ -87,6 +88,13 @@ mini_fo_tri_interpose(dentry_t *hidden_d
- 		err = -EACCES;		/* should be impossible??? */
- 		goto out;
- 	}
-+#else
-+	inode = mini_fo_iget(sb, iunique(sb, 25));
-+	if (IS_ERR(inode)) {
-+		err = PTR_ERR(inode);
-+		goto out;
-+	}
-+#endif
- 
- 	/*
- 	 * interpose the inode if not already interposed
-@@ -184,9 +192,9 @@ mini_fo_parse_options(super_block_t *sb,
- 				hidden_root = ERR_PTR(err);
- 				goto out;
- 			}
--			hidden_root = nd.dentry;
--			stopd(sb)->base_dir_dentry = nd.dentry;
--			stopd(sb)->hidden_mnt = nd.mnt;
-+			hidden_root = nd_get_dentry(&nd);
-+			stopd(sb)->base_dir_dentry = nd_get_dentry(&nd);
-+			stopd(sb)->hidden_mnt = nd_get_mnt(&nd);
- 
- 		} else if(!strncmp("sto=", options, 4)) {
- 			/* parse the storage dir */
-@@ -204,9 +212,9 @@ mini_fo_parse_options(super_block_t *sb,
- 				hidden_root2 = ERR_PTR(err);
- 				goto out;
- 			}
--			hidden_root2 = nd2.dentry;
--			stopd(sb)->storage_dir_dentry = nd2.dentry;
--			stopd(sb)->hidden_mnt2 = nd2.mnt;
-+			hidden_root2 = nd_get_dentry(&nd2);
-+			stopd(sb)->storage_dir_dentry = nd_get_dentry(&nd2);
-+			stopd(sb)->hidden_mnt2 = nd_get_mnt(&nd2);
- 			stohs2(sb) = hidden_root2->d_sb;
- 
- 			/* validate storage dir, this is done in
---- a/fs/mini_fo/mini_fo.h
-+++ b/fs/mini_fo/mini_fo.h
-@@ -302,6 +302,10 @@ extern int mini_fo_tri_interpose(dentry_
- extern int mini_fo_cp_cont(dentry_t *tgt_dentry, struct vfsmount *tgt_mnt,
- 			   dentry_t *src_dentry, struct vfsmount *src_mnt);
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
-+extern struct inode *mini_fo_iget(struct super_block *sb, unsigned long ino);
-+#endif
-+
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- extern int mini_fo_create(inode_t *dir, dentry_t *dentry, int mode, struct nameidata *nd);
- 
-@@ -501,6 +505,29 @@ static inline void double_unlock(struct
- #endif  /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
- #endif /* __KERNEL__ */
- 
-+
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
-+static inline dentry_t *nd_get_dentry(struct nameidata *nd)
-+{
-+	return (nd->path.dentry);
-+}
-+
-+static inline struct vfsmount *nd_get_mnt(struct nameidata *nd)
-+{
-+	return (nd->path.mnt);
-+}
-+#else
-+static inline dentry_t *nd_get_dentry(struct nameidata *nd)
-+{
-+	return (nd->dentry);
-+}
-+
-+static inline struct vfsmount *nd_get_mnt(struct nameidata *nd)
-+{
-+	return (nd->mnt);
-+}
-+#endif
-+
- /*
-  * Definitions for user and kernel code
-  */
---- a/fs/mini_fo/super.c
-+++ b/fs/mini_fo/super.c
-@@ -262,10 +262,31 @@ mini_fo_umount_begin(super_block_t *sb)
- }
- #endif
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
-+struct inode *
-+mini_fo_iget(struct super_block *sb, unsigned long ino)
-+{
-+	struct inode *inode;
-+
-+	inode = iget_locked(sb, ino);
-+	if (!inode)
-+		return ERR_PTR(-ENOMEM);
-+
-+	if (!(inode->i_state & I_NEW))
-+		return inode;
-+
-+	mini_fo_read_inode(inode);
-+
-+	unlock_new_inode(inode);
-+	return inode;
-+}
-+#endif /* if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) */
- 
- struct super_operations mini_fo_sops =
- {
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
- 	read_inode:		mini_fo_read_inode,
-+#endif
- #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
- 	write_inode:	mini_fo_write_inode,
- #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
---- a/fs/mini_fo/aux.c
-+++ b/fs/mini_fo/aux.c
-@@ -164,11 +164,11 @@ dentry_t *bpath_walk(super_block_t *sb,
- 	err = vfs_path_lookup(mnt->mnt_root, mnt, bpath+1, 0, &nd);
- 
- 	/* validate */
--	if (err || !nd.dentry || !nd.dentry->d_inode) {
-+	if (err || !nd_get_dentry(&nd) || !nd_get_dentry(&nd)->d_inode) {
- 		printk(KERN_CRIT "mini_fo: bpath_walk: path_walk failed.\n");
- 		return NULL;
- 	}
--	return nd.dentry;
-+	return nd_get_dentry(&nd);
- }
- 
- 

+ 0 - 66
target/linux/generic/patches-2.6.33/211-mini_fo_2.6.25_dentry_open_war.patch

@@ -1,66 +0,0 @@
---- a/fs/mini_fo/meta.c
-+++ b/fs/mini_fo/meta.c
-@@ -442,6 +442,11 @@ int meta_write_d_entry(dentry_t *dentry,
- 			   S_IRUSR | S_IWUSR);
- #endif
- 	}
-+
-+	/* $%& err, is this correct? */
-+	meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2;
-+	mntget(meta_mnt);
-+
-         /* open META-file for writing */
-         meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-         if(!meta_file || IS_ERR(meta_file)) {
-@@ -535,6 +540,11 @@ int meta_write_r_entry(dentry_t *dentry,
- 			   meta_dentry, S_IRUSR | S_IWUSR);
- #endif
- 	}
-+
-+	/* $%& err, is this correct? */
-+	meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2;
-+	mntget(meta_mnt);
-+
-         /* open META-file for writing */
-         meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-         if(!meta_file || IS_ERR(meta_file)) {
-@@ -671,14 +681,16 @@ int meta_sync_d_list(dentry_t *dentry, i
- 		}
- 	}
- 
-+	/* $%& err, is this correct? */
-+	meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2;
-+	mntget(meta_mnt);
-+
-         /* open META-file for writing */
-         meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-         if(!meta_file || IS_ERR(meta_file)) {
-                 printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-                                   ERROR opening meta file.\n");
--		/* we don't mntget so we dont't mntput (for now)
--		 * mntput(meta_mnt);
--		 */
-+		mntput(meta_mnt);
- 		dput(meta_dentry);
- 		err = -1;
-                 goto out;
-@@ -811,14 +823,16 @@ int meta_sync_r_list(dentry_t *dentry, i
- 		}
- 	}
- 
-+	/* $%& err, is this correct? */
-+	meta_mnt = stopd(dentry->d_inode->i_sb)->hidden_mnt2;
-+	mntget(meta_mnt);
-+
-         /* open META-file for writing */
-         meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-         if(!meta_file || IS_ERR(meta_file)) {
-                 printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-                                   ERROR opening meta file.\n");
--		/* we don't mntget so we dont't mntput (for now)
--		 * mntput(meta_mnt);
--		 */
-+		mntput(meta_mnt);
- 		dput(meta_dentry);
- 		err = -1;
-                 goto out;

+ 0 - 37
target/linux/generic/patches-2.6.33/212-mini_fo_2.6.26_fixes.patch

@@ -1,37 +0,0 @@
---- a/fs/mini_fo/super.c
-+++ b/fs/mini_fo/super.c
-@@ -84,6 +84,7 @@ mini_fo_write_inode(inode_t *inode, int
- #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
- 
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
- STATIC void
- mini_fo_put_inode(inode_t *inode)
- {
-@@ -99,6 +100,7 @@ mini_fo_put_inode(inode_t *inode)
- 	if (atomic_read(&inode->i_count) == 1)
- 		inode->i_nlink = 0;
- }
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */
- 
- 
- #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
-@@ -238,7 +240,7 @@ mini_fo_clear_inode(inode_t *inode)
-  * dies.
-  */
- STATIC void
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
- mini_fo_umount_begin(struct vfsmount *mnt, int flags)
- {
- 	struct vfsmount *hidden_mnt;
-@@ -290,7 +292,9 @@ struct super_operations mini_fo_sops =
- #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
- 	write_inode:	mini_fo_write_inode,
- #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
- 	put_inode:		mini_fo_put_inode,
-+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */
- #if defined(FIST_DEBUG) || defined(FIST_FILTER_SCA)
- 	delete_inode:	mini_fo_delete_inode,
- #endif /* defined(FIST_DEBUG) || defined(FIST_FILTER_SCA) */

+ 0 - 41
target/linux/generic/patches-2.6.33/213-mini_fo_2.6.27_fixes.patch

@@ -1,41 +0,0 @@
---- a/fs/mini_fo/inode.c
-+++ b/fs/mini_fo/inode.c
-@@ -439,7 +439,7 @@ mini_fo_symlink(inode_t *dir, dentry_t *
- 	int err=0;
- 	dentry_t *hidden_sto_dentry;
- 	dentry_t *hidden_sto_dir_dentry;
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
-         umode_t mode;
- #endif
- 
-@@ -466,7 +466,7 @@ mini_fo_symlink(inode_t *dir, dentry_t *
- 	down(&hidden_sto_dir_dentry->d_inode->i_sem);
- #endif
- 
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
- 	mode = S_IALLUGO;
- 	err = vfs_symlink(hidden_sto_dir_dentry->d_inode,
- 			  hidden_sto_dentry, symname, mode);
-@@ -1128,7 +1128,7 @@ void mini_fo_put_link(struct dentry *den
- #endif
- 
- STATIC int
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
- mini_fo_permission(inode_t *inode, int mask, struct nameidata *nd)
- #else
- mini_fo_permission(inode_t *inode, int mask)
-@@ -1150,8 +1150,9 @@ mini_fo_permission(inode_t *inode, int m
- 	 *	if (err)
- 	 *		goto out;
- 	 */
--
--#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-+	err = inode_permission(hidden_inode, mask);
-+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- 	err = permission(hidden_inode, mask, nd);
- #else
- 	err = permission(hidden_inode, mask);

+ 0 - 96
target/linux/generic/patches-2.6.33/214-mini_fo_2.6.29.patch

@@ -1,96 +0,0 @@
---- a/fs/mini_fo/aux.c
-+++ b/fs/mini_fo/aux.c
-@@ -236,7 +236,7 @@ int mini_fo_cp_cont(dentry_t *tgt_dentry
- 	mntget(src_mnt);
- 
- 	/* open file write only */
--	tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1);
-+	tgt_file = dentry_open(tgt_dentry, tgt_mnt, 0x1, current_cred());
- 	if(!tgt_file || IS_ERR(tgt_file)) {
- 		printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening target file.\n");
- 		err = PTR_ERR(tgt_file);
-@@ -244,7 +244,7 @@ int mini_fo_cp_cont(dentry_t *tgt_dentry
- 	}
- 
- 	/* open file read only */
--	src_file = dentry_open(src_dentry, src_mnt, 0x0);
-+	src_file = dentry_open(src_dentry, src_mnt, 0x0, current_cred());
- 	if(!src_file || IS_ERR(src_file)) {
- 		printk(KERN_CRIT "mini_fo_cp_cont: ERROR opening source file.\n");
- 		err = PTR_ERR(src_file);
---- a/fs/mini_fo/file.c
-+++ b/fs/mini_fo/file.c
-@@ -437,7 +437,7 @@ mini_fo_open(inode_t *inode, file_t *fil
- 			mntget(stopd(inode->i_sb)->hidden_mnt);
- 			hidden_file = dentry_open(hidden_dentry,
- 						  stopd(inode->i_sb)->hidden_mnt,
--						  hidden_flags);
-+						  hidden_flags, file->f_cred);
- 			if (IS_ERR(hidden_file)) {
- 				err = PTR_ERR(hidden_file);
- 				dput(hidden_dentry);
-@@ -479,7 +479,7 @@ mini_fo_open(inode_t *inode, file_t *fil
- 			mntget(stopd(inode->i_sb)->hidden_mnt);
- 			hidden_file = dentry_open(hidden_dentry,
- 						  stopd(inode->i_sb)->hidden_mnt,
--						  hidden_flags);
-+						  hidden_flags, file->f_cred);
- 			if (IS_ERR(hidden_file)) {
- 				err = PTR_ERR(hidden_file);
- 				dput(hidden_dentry);
-@@ -512,7 +512,7 @@ mini_fo_open(inode_t *inode, file_t *fil
- 	mntget(stopd(inode->i_sb)->hidden_mnt2);
- 	hidden_sto_file = dentry_open(hidden_sto_dentry,
- 				      stopd(inode->i_sb)->hidden_mnt2,
--				      hidden_flags);
-+				      hidden_flags, file->f_cred);
- 
- 	/* dentry_open dputs the dentry if it fails */
- 	if (IS_ERR(hidden_sto_file)) {
---- a/fs/mini_fo/meta.c
-+++ b/fs/mini_fo/meta.c
-@@ -56,7 +56,7 @@ int meta_build_lists(dentry_t *dentry)
- 
- 
- 		/* open META-file for reading */
--		meta_file = dentry_open(meta_dentry, meta_mnt, 0x0);
-+		meta_file = dentry_open(meta_dentry, meta_mnt, 0x0, current_cred());
- 		if(!meta_file || IS_ERR(meta_file)) {
- 			printk(KERN_CRIT "mini_fo: meta_build_lists: \
-                                           ERROR opening META file.\n");
-@@ -448,7 +448,7 @@ int meta_write_d_entry(dentry_t *dentry,
- 	mntget(meta_mnt);
- 
-         /* open META-file for writing */
--        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred());
-         if(!meta_file || IS_ERR(meta_file)) {
-                 printk(KERN_CRIT "mini_fo: meta_write_d_entry: \
-                                   ERROR opening meta file.\n");
-@@ -546,7 +546,7 @@ int meta_write_r_entry(dentry_t *dentry,
- 	mntget(meta_mnt);
- 
-         /* open META-file for writing */
--        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred());
-         if(!meta_file || IS_ERR(meta_file)) {
-                 printk(KERN_CRIT "mini_fo: meta_write_r_entry: \
-                                   ERROR opening meta file.\n");
-@@ -686,7 +686,7 @@ int meta_sync_d_list(dentry_t *dentry, i
- 	mntget(meta_mnt);
- 
-         /* open META-file for writing */
--        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred());
-         if(!meta_file || IS_ERR(meta_file)) {
-                 printk(KERN_CRIT "mini_fo: meta_sync_d_list: \
-                                   ERROR opening meta file.\n");
-@@ -828,7 +828,7 @@ int meta_sync_r_list(dentry_t *dentry, i
- 	mntget(meta_mnt);
- 
-         /* open META-file for writing */
--        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1);
-+        meta_file = dentry_open(meta_dentry, meta_mnt, 0x1, current_cred());
-         if(!meta_file || IS_ERR(meta_file)) {
-                 printk(KERN_CRIT "mini_fo: meta_sync_r_list: \
-                                   ERROR opening meta file.\n");

+ 0 - 157
target/linux/generic/patches-2.6.33/215-mini_fo_2.6.30.patch

@@ -1,157 +0,0 @@
---- a/fs/mini_fo/aux.c
-+++ b/fs/mini_fo/aux.c
-@@ -86,8 +86,10 @@ int get_neg_sto_dentry(dentry_t *dentry)
- 	len = dentry->d_name.len;
- 	name = dentry->d_name.name;
- 
-+	mutex_lock(&dtohd2(dentry->d_parent)->d_inode->i_mutex);
- 	dtohd2(dentry) =
- 		lookup_one_len(name, dtohd2(dentry->d_parent), len);
-+	mutex_unlock(&dtohd2(dentry->d_parent)->d_inode->i_mutex);
- 
-  out:
- 	return err;
-@@ -426,7 +428,9 @@ int build_sto_structure(dentry_t *dir, d
- 		const unsigned char *name;
- 		len = dtohd(dentry)->d_name.len;
- 		name = dtohd(dentry)->d_name.name;
-+		mutex_lock(&dtohd2(dir)->d_inode->i_mutex);
- 		hidden_sto_dentry = lookup_one_len(name, dtohd2(dir), len);
-+		mutex_unlock(&dtohd2(dir)->d_inode->i_mutex);
- 		dtohd2(dentry) = hidden_sto_dentry;
- 	}
- 
---- a/fs/mini_fo/inode.c
-+++ b/fs/mini_fo/inode.c
-@@ -113,17 +113,23 @@ mini_fo_lookup(inode_t *dir, dentry_t *d
- 		hidden_dir_dentry = hidden_dentry->d_parent;
- 		kfree(bpath);
- 	}
--	else if(hidden_dir_dentry && hidden_dir_dentry->d_inode)
-+	else if(hidden_dir_dentry && hidden_dir_dentry->d_inode) {
-+		mutex_lock(&hidden_dir_dentry->d_inode->i_mutex);
- 		hidden_dentry =
- 			lookup_one_len(name, hidden_dir_dentry, namelen);
--	else
-+		mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
-+	} else {
- 		hidden_dentry = NULL;
-+	}
- 
--	if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode)
-+	if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) {
-+		mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
- 		hidden_sto_dentry =
- 			lookup_one_len(name, hidden_sto_dir_dentry, namelen);
--	else
-+		mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
-+	} else {
- 		hidden_sto_dentry =  NULL;
-+	}
- 
- 	/* catch error in lookup */
- 	if (IS_ERR(hidden_dentry) || IS_ERR(hidden_sto_dentry)) {
-@@ -553,9 +559,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de
- #endif
- 
- 		/* Delete an old WOL file contained in the storage dir */
-+		mutex_lock(&hidden_sto_dentry->d_inode->i_mutex);
- 		meta_dentry = lookup_one_len(META_FILENAME,
- 					     hidden_sto_dentry,
- 					     strlen(META_FILENAME));
-+		mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex);
- 		if(meta_dentry->d_inode) {
- 			err = vfs_unlink(hidden_sto_dentry->d_inode, meta_dentry);
- 			dput(meta_dentry);
-@@ -643,9 +651,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de
- #endif
- 
- 		/* Delete an old WOL file contained in the storage dir */
-+		mutex_lock(&hidden_sto_dentry->d_inode->i_mutex);
- 		meta_dentry = lookup_one_len(META_FILENAME,
- 					     hidden_sto_dentry,
- 					     strlen(META_FILENAME));
-+		mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex);
- 		if(meta_dentry->d_inode) {
- 			/* is this necessary? dget(meta_dentry); */
- 			err = vfs_unlink(hidden_sto_dentry->d_inode,
-@@ -688,9 +698,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de
- #endif
- 
- 		/* Delete an old WOL file contained in the storage dir */
-+		mutex_lock(&hidden_sto_dentry->d_inode->i_mutex);
- 		meta_dentry = lookup_one_len(META_FILENAME,
- 					     hidden_sto_dentry,
- 					     strlen(META_FILENAME));
-+		mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex);
- 		if(meta_dentry->d_inode) {
- 			/* is this necessary? dget(meta_dentry); */
- 			err = vfs_unlink(hidden_sto_dentry->d_inode,
---- a/fs/mini_fo/meta.c
-+++ b/fs/mini_fo/meta.c
-@@ -43,9 +43,11 @@ int meta_build_lists(dentry_t *dentry)
- 
-   	/* might there be a META-file? */
- 	if(dtohd2(dentry) && dtohd2(dentry)->d_inode) {
-+		mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
- 		meta_dentry = lookup_one_len(META_FILENAME,
- 					     dtohd2(dentry),
- 					     strlen(META_FILENAME));
-+		mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
- 		if(!meta_dentry->d_inode) {
- 			dput(meta_dentry);
- 			goto out_ok;
-@@ -426,8 +428,11 @@ int meta_write_d_entry(dentry_t *dentry,
- 			goto out;
-                 }
-         }
-+
-+	mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
- 	meta_dentry = lookup_one_len(META_FILENAME,
- 				     dtohd2(dentry), strlen (META_FILENAME));
-+	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
- 
- 	/* We need to create a META-file */
-         if(!meta_dentry->d_inode) {
-@@ -527,9 +532,13 @@ int meta_write_r_entry(dentry_t *dentry,
- 			goto out;
-                 }
-         }
-+
-+	mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
- 	meta_dentry = lookup_one_len(META_FILENAME,
- 				     dtohd2(dentry),
- 				     strlen (META_FILENAME));
-+	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+
-         if(!meta_dentry->d_inode) {
-                 /* We need to create a META-file */
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-@@ -641,9 +650,13 @@ int meta_sync_d_list(dentry_t *dentry, i
- 			goto out;
-                 }
-         }
-+
-+	mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
- 	meta_dentry = lookup_one_len(META_FILENAME,
- 				     dtohd2(dentry),
- 				     strlen(META_FILENAME));
-+	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+
-         if(!meta_dentry->d_inode) {
-                 /* We need to create a META-file */
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-@@ -784,9 +797,13 @@ int meta_sync_r_list(dentry_t *dentry, i
- 			goto out;
-                 }
-         }
-+
-+	mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
- 	meta_dentry = lookup_one_len(META_FILENAME,
- 				     dtohd2(dentry),
- 				     strlen(META_FILENAME));
-+	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+
-         if(!meta_dentry->d_inode) {
-                 /* We need to create a META-file */
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)

+ 0 - 25
target/linux/generic/patches-2.6.33/216-mini_fo_locking.patch

@@ -1,25 +0,0 @@
---- a/fs/mini_fo/state.c
-+++ b/fs/mini_fo/state.c
-@@ -537,17 +537,17 @@ int nondir_mod_to_del(dentry_t *dentry)
- 	dtohd(dentry) = NULL;
- 	dtost(dentry) = DELETED;
- 
--	/* add deleted file to META-file */
--	meta_add_d_entry(dentry->d_parent,
--			 dentry->d_name.name,
--			 dentry->d_name.len);
--
- 	/* was: unlock_dir(hidden_sto_dir_dentry); */
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- 	mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
- #else
- 	up(&hidden_sto_dir_dentry->d_inode->i_sem);
- #endif
-+	/* add deleted file to META-file */
-+	meta_add_d_entry(dentry->d_parent,
-+			 dentry->d_name.name,
-+			 dentry->d_name.len);
-+
- 	dput(hidden_sto_dir_dentry);
- 
-  out:

+ 0 - 48
target/linux/generic/patches-2.6.33/217-mini_fo_dentry_check.patch

@@ -1,48 +0,0 @@
---- a/fs/mini_fo/meta.c
-+++ b/fs/mini_fo/meta.c
-@@ -48,6 +48,9 @@ int meta_build_lists(dentry_t *dentry)
- 					     dtohd2(dentry),
- 					     strlen(META_FILENAME));
- 		mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+		if (IS_ERR(meta_dentry))
-+			goto out_ok;
-+
- 		if(!meta_dentry->d_inode) {
- 			dput(meta_dentry);
- 			goto out_ok;
-@@ -433,6 +436,8 @@ int meta_write_d_entry(dentry_t *dentry,
- 	meta_dentry = lookup_one_len(META_FILENAME,
- 				     dtohd2(dentry), strlen (META_FILENAME));
- 	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+	if (IS_ERR(meta_dentry))
-+		return PTR_ERR(meta_dentry);
- 
- 	/* We need to create a META-file */
-         if(!meta_dentry->d_inode) {
-@@ -538,6 +543,8 @@ int meta_write_r_entry(dentry_t *dentry,
- 				     dtohd2(dentry),
- 				     strlen (META_FILENAME));
- 	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+	if (IS_ERR(meta_dentry))
-+		return PTR_ERR(meta_dentry);
- 
-         if(!meta_dentry->d_inode) {
-                 /* We need to create a META-file */
-@@ -656,6 +663,8 @@ int meta_sync_d_list(dentry_t *dentry, i
- 				     dtohd2(dentry),
- 				     strlen(META_FILENAME));
- 	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+	if (IS_ERR(meta_dentry))
-+		return PTR_ERR(meta_dentry);
- 
-         if(!meta_dentry->d_inode) {
-                 /* We need to create a META-file */
-@@ -803,6 +812,8 @@ int meta_sync_r_list(dentry_t *dentry, i
- 				     dtohd2(dentry),
- 				     strlen(META_FILENAME));
- 	mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
-+	if (IS_ERR(meta_dentry))
-+		return PTR_ERR(meta_dentry);
- 
-         if(!meta_dentry->d_inode) {
-                 /* We need to create a META-file */

+ 0 - 42
target/linux/generic/patches-2.6.33/219-kobject_uevent.patch

@@ -1,42 +0,0 @@
---- a/lib/kobject_uevent.c
-+++ b/lib/kobject_uevent.c
-@@ -29,7 +29,8 @@ u64 uevent_seqnum;
- char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
- static DEFINE_SPINLOCK(sequence_lock);
- #if defined(CONFIG_NET)
--static struct sock *uevent_sock;
-+struct sock *uevent_sock = NULL;
-+EXPORT_SYMBOL_GPL(uevent_sock);
- #endif
- 
- /* the strings here must match the enum in include/linux/kobject.h */
-@@ -42,6 +43,18 @@ static const char *kobject_actions[] = {
- 	[KOBJ_OFFLINE] =	"offline",
- };
- 
-+u64 uevent_next_seqnum(void)
-+{
-+	u64 seq;
-+
-+	spin_lock(&sequence_lock);
-+	seq = ++uevent_seqnum;
-+	spin_unlock(&sequence_lock);
-+
-+	return seq;
-+}
-+EXPORT_SYMBOL_GPL(uevent_next_seqnum);
-+
- /**
-  * kobject_action_type - translate action string to numeric type
-  *
-@@ -201,9 +214,7 @@ int kobject_uevent_env(struct kobject *k
- 		kobj->state_remove_uevent_sent = 1;
- 
- 	/* we will send an event, so request a new sequence number */
--	spin_lock(&sequence_lock);
--	seq = ++uevent_seqnum;
--	spin_unlock(&sequence_lock);
-+	seq = uevent_next_seqnum();
- 	retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
- 	if (retval)
- 		goto exit;

+ 0 - 11
target/linux/generic/patches-2.6.33/220-sound_kconfig.patch

@@ -1,11 +0,0 @@
---- a/sound/core/Kconfig
-+++ b/sound/core/Kconfig
-@@ -8,7 +8,7 @@ config SND_PCM
- 	select GCD
- 
- config SND_HWDEP
--	tristate
-+	tristate "Sound hardware support"
- 
- config SND_RAWMIDI
- 	tristate

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott