Remove 2.6.22 files, no target uses them anymore
authorFlorian Fainelli <florian@openwrt.org>
Sun, 21 Sep 2008 11:32:06 +0000 (11:32 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 21 Sep 2008 11:32:06 +0000 (11:32 +0000)
SVN-Revision: 12638

50 files changed:
include/kernel-version.mk
target/linux/generic-2.6/patches-2.6.22/001-squashfs.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/002-lzma_decompress.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/003-squashfs_lzma.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/004-extra_optimization.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/006-gcc4_inline_fix.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/007-samsung_flash.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/009-revert_intel_flash_breakage.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/010-disable_old_squashfs_compatibility.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/011-mips_boot.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/012-mips_cpu_tlb.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/013-mips_generic_gpio_support.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/014-x86_newsetup.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/015-x86_newsetup_fixup.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/060-block2mtd_init.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/065-rootfs_split.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/100-netfilter_layer7_2.17.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/101-netfilter_layer7_pktmatch.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/110-ipp2p_0.8.1rc1.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/120-openswan-2.4.0.kernel-2.6-natt.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/130-netfilter_ipset.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/140-netfilter_time.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/150-netfilter_imq.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/160-netfilter_route.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/170-netfilter_chaostables_0.8.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/171-netfilter_tarpit.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/180-netfilter_depends.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/190-netfilter_rtsp.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/200-sched_esfq.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/201-multiple_default_gateways.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/202-mips-freestanding.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/204-jffs2_eofdetect.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/207-powerpc_asm_segment_h.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/208-rtl8110sb_fix.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/209-mini_fo.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/210-mac80211_include_wireless_dev.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/213-kobject_uevent.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/400-ledtrig_morse.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/410-gpio_buttons.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/510-yaffs_support.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/511-yaffs_reduce_compiler_warnings.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/600-eeprom_93cx6.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/601-eeprom_93cx6_fixes.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/801-usb_serial_endpoint_size.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/900-headers_type_and_time.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/902-darwin_scripts_include.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/903-stddef_include.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/904-ls_time_locale.patch [deleted file]
target/linux/generic-2.6/patches-2.6.22/999-icplus.patch [deleted file]
target/linux/rb532/config-2.6.22 [deleted file]

index e434234..8602696 100644 (file)
@@ -16,9 +16,6 @@ endif
 ifeq ($(LINUX_VERSION),2.6.21.7)
   LINUX_KERNEL_MD5SUM:=bc15fad1487336d5dcb0945cd039d8ed
 endif
-ifeq ($(LINUX_VERSION),2.6.22.19)
-  LINUX_KERNEL_MD5SUM:=4db27facb78aeb79d06e6ae6bf0ac0b6
-endif
 ifeq ($(LINUX_VERSION),2.6.23.17)
   LINUX_KERNEL_MD5SUM:=a0300a393ac91ce9c64bf31522b45e2e
 endif
diff --git a/target/linux/generic-2.6/patches-2.6.22/001-squashfs.patch b/target/linux/generic-2.6/patches-2.6.22/001-squashfs.patch
deleted file mode 100644 (file)
index 0807d1d..0000000
+++ /dev/null
@@ -1,4170 +0,0 @@
---- a/fs/Kconfig
-+++ b/fs/Kconfig
-@@ -1367,6 +1367,71 @@
-         If unsure, say N.
-+config SQUASHFS
-+      tristate "SquashFS 3.0 - Squashed file system support"
-+      select ZLIB_INFLATE
-+      help
-+        Saying Y here includes support for SquashFS 3.0 (a Compressed Read-Only File
-+        System).  Squashfs is a highly compressed read-only filesystem for Linux.
-+        It uses zlib compression to compress both files, inodes and directories.
-+        Inodes in the system are very small and all blocks are packed to minimise
-+        data overhead. Block sizes greater than 4K are supported up to a maximum of 64K.
-+        SquashFS 3.0 supports 64 bit filesystems and files (larger than 4GB), full
-+        uid/gid information, hard links and timestamps.
-+
-+        Squashfs is intended for general read-only filesystem use, for archival
-+        use (i.e. in cases where a .tar.gz file may be used), and in embedded
-+        systems where low overhead is needed.  Further information and filesystem tools
-+        are available from http://squashfs.sourceforge.net.
-+
-+        If you want to compile this as a module ( = code which can be
-+        inserted in and removed from the running kernel whenever you want),
-+        say M here and read <file:Documentation/modules.txt>.  The module
-+        will be called squashfs.  Note that the root file system (the one
-+        containing the directory /) cannot be compiled as a module.
-+
-+        If unsure, say N.
-+
-+config SQUASHFS_EMBEDDED
-+
-+      bool "Additional options for memory-constrained systems"
-+      depends on SQUASHFS
-+      default n
-+      help
-+        Saying Y here allows you to specify cache sizes and how Squashfs
-+        allocates memory.  This is only intended for memory constrained
-+        systems.
-+
-+        If unsure, say N.
-+
-+config SQUASHFS_FRAGMENT_CACHE_SIZE
-+      int "Number of fragments cached" if SQUASHFS_EMBEDDED
-+      depends on SQUASHFS
-+      default "3"
-+      help
-+        By default SquashFS caches the last 3 fragments read from
-+        the filesystem.  Increasing this amount may mean SquashFS
-+        has to re-read fragments less often from disk, at the expense
-+        of extra system memory.  Decreasing this amount will mean
-+        SquashFS uses less memory at the expense of extra reads from disk.
-+
-+        Note there must be at least one cached fragment.  Anything
-+        much more than three will probably not make much difference.
-+
-+config SQUASHFS_VMALLOC
-+      bool "Use Vmalloc rather than Kmalloc" if SQUASHFS_EMBEDDED
-+      depends on SQUASHFS
-+      default n
-+      help
-+        By default SquashFS uses kmalloc to obtain fragment cache memory.
-+        Kmalloc memory is the standard kernel allocator, but it can fail
-+        on memory constrained systems.  Because of the way Vmalloc works,
-+        Vmalloc can succeed when kmalloc fails.  Specifying this option
-+        will make SquashFS always use Vmalloc to allocate the
-+        fragment cache memory.
-+
-+        If unsure, say N.
-+
- config VXFS_FS
-       tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
-       depends on BLOCK
---- a/fs/Makefile
-+++ b/fs/Makefile
-@@ -72,6 +72,7 @@
- obj-$(CONFIG_JBD2)            += jbd2/
- obj-$(CONFIG_EXT2_FS)         += ext2/
- obj-$(CONFIG_CRAMFS)          += cramfs/
-+obj-$(CONFIG_SQUASHFS)                += squashfs/
- obj-$(CONFIG_RAMFS)           += ramfs/
- obj-$(CONFIG_HUGETLBFS)               += hugetlbfs/
- obj-$(CONFIG_CODA_FS)         += coda/
---- /dev/null
-+++ b/fs/squashfs/inode.c
-@@ -0,0 +1,2122 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
-+ * Phillip Lougher <phillip@lougher.org.uk>
-+ *
-+ * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * inode.c
-+ */
-+
-+#include <linux/types.h>
-+#include <linux/squashfs_fs.h>
-+#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+#include <linux/fs.h>
-+#include <linux/smp_lock.h>
-+#include <linux/slab.h>
-+#include <linux/squashfs_fs_sb.h>
-+#include <linux/squashfs_fs_i.h>
-+#include <linux/buffer_head.h>
-+#include <linux/vfs.h>
-+#include <linux/init.h>
-+#include <linux/dcache.h>
-+#include <linux/wait.h>
-+#include <linux/zlib.h>
-+#include <linux/blkdev.h>
-+#include <linux/vmalloc.h>
-+#include <asm/uaccess.h>
-+#include <asm/semaphore.h>
-+
-+#include "squashfs.h"
-+
-+static void squashfs_put_super(struct super_block *);
-+static int squashfs_statfs(struct dentry *, struct kstatfs *);
-+static int squashfs_symlink_readpage(struct file *file, struct page *page);
-+static int squashfs_readpage(struct file *file, struct page *page);
-+static int squashfs_readpage4K(struct file *file, struct page *page);
-+static int squashfs_readdir(struct file *, void *, filldir_t);
-+static struct inode *squashfs_alloc_inode(struct super_block *sb);
-+static void squashfs_destroy_inode(struct inode *inode);
-+static int init_inodecache(void);
-+static void destroy_inodecache(void);
-+static struct dentry *squashfs_lookup(struct inode *, struct dentry *,
-+                              struct nameidata *);
-+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode);
-+static long long read_blocklist(struct inode *inode, int index,
-+                              int readahead_blks, char *block_list,
-+                              unsigned short **block_p, unsigned int *bsize);
-+static int squashfs_get_sb(struct file_system_type *, int,
-+                      const char *, void *, struct vfsmount *);
-+
-+
-+static z_stream stream;
-+
-+static struct file_system_type squashfs_fs_type = {
-+      .owner = THIS_MODULE,
-+      .name = "squashfs",
-+      .get_sb = squashfs_get_sb,
-+      .kill_sb = kill_block_super,
-+      .fs_flags = FS_REQUIRES_DEV
-+};
-+
-+static unsigned char squashfs_filetype_table[] = {
-+      DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK
-+};
-+
-+static struct super_operations squashfs_ops = {
-+      .alloc_inode = squashfs_alloc_inode,
-+      .destroy_inode = squashfs_destroy_inode,
-+      .statfs = squashfs_statfs,
-+      .put_super = squashfs_put_super,
-+};
-+
-+SQSH_EXTERN struct address_space_operations squashfs_symlink_aops = {
-+      .readpage = squashfs_symlink_readpage
-+};
-+
-+SQSH_EXTERN struct address_space_operations squashfs_aops = {
-+      .readpage = squashfs_readpage
-+};
-+
-+SQSH_EXTERN struct address_space_operations squashfs_aops_4K = {
-+      .readpage = squashfs_readpage4K
-+};
-+
-+static struct file_operations squashfs_dir_ops = {
-+      .read = generic_read_dir,
-+      .readdir = squashfs_readdir
-+};
-+
-+SQSH_EXTERN struct inode_operations squashfs_dir_inode_ops = {
-+      .lookup = squashfs_lookup
-+};
-+
-+
-+static struct buffer_head *get_block_length(struct super_block *s,
-+                              int *cur_index, int *offset, int *c_byte)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      unsigned short temp;
-+      struct buffer_head *bh;
-+
-+      if (!(bh = sb_bread(s, *cur_index)))
-+              goto out;
-+
-+      if (msblk->devblksize - *offset == 1) {
-+              if (msblk->swap)
-+                      ((unsigned char *) &temp)[1] = *((unsigned char *)
-+                              (bh->b_data + *offset));
-+              else
-+                      ((unsigned char *) &temp)[0] = *((unsigned char *)
-+                              (bh->b_data + *offset));
-+              brelse(bh);
-+              if (!(bh = sb_bread(s, ++(*cur_index))))
-+                      goto out;
-+              if (msblk->swap)
-+                      ((unsigned char *) &temp)[0] = *((unsigned char *)
-+                              bh->b_data);
-+              else
-+                      ((unsigned char *) &temp)[1] = *((unsigned char *)
-+                              bh->b_data);
-+              *c_byte = temp;
-+              *offset = 1;
-+      } else {
-+              if (msblk->swap) {
-+                      ((unsigned char *) &temp)[1] = *((unsigned char *)
-+                              (bh->b_data + *offset));
-+                      ((unsigned char *) &temp)[0] = *((unsigned char *)
-+                              (bh->b_data + *offset + 1));
-+              } else {
-+                      ((unsigned char *) &temp)[0] = *((unsigned char *)
-+                              (bh->b_data + *offset));
-+                      ((unsigned char *) &temp)[1] = *((unsigned char *)
-+                              (bh->b_data + *offset + 1));
-+              }
-+              *c_byte = temp;
-+              *offset += 2;
-+      }
-+
-+      if (SQUASHFS_CHECK_DATA(msblk->sblk.flags)) {
-+              if (*offset == msblk->devblksize) {
-+                      brelse(bh);
-+                      if (!(bh = sb_bread(s, ++(*cur_index))))
-+                              goto out;
-+                      *offset = 0;
-+              }
-+              if (*((unsigned char *) (bh->b_data + *offset)) !=
-+                                              SQUASHFS_MARKER_BYTE) {
-+                      ERROR("Metadata block marker corrupt @ %x\n",
-+                                              *cur_index);
-+                      brelse(bh);
-+                      goto out;
-+              }
-+              (*offset)++;
-+      }
-+      return bh;
-+
-+out:
-+      return NULL;
-+}
-+
-+
-+SQSH_EXTERN unsigned int squashfs_read_data(struct super_block *s, char *buffer,
-+                      long long index, unsigned int length,
-+                      long long *next_index)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >>
-+                      msblk->devblksize_log2) + 2];
-+      unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1);
-+      unsigned int cur_index = index >> msblk->devblksize_log2;
-+      int bytes, avail_bytes, b = 0, k;
-+      char *c_buffer;
-+      unsigned int compressed;
-+      unsigned int c_byte = length;
-+
-+      if (c_byte) {
-+              bytes = msblk->devblksize - offset;
-+              compressed = SQUASHFS_COMPRESSED_BLOCK(c_byte);
-+              c_buffer = compressed ? msblk->read_data : buffer;
-+              c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte);
-+
-+              TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
-+                                      ? "" : "un", (unsigned int) c_byte);
-+
-+              if (!(bh[0] = sb_getblk(s, cur_index)))
-+                      goto block_release;
-+
-+              for (b = 1; bytes < c_byte; b++) {
-+                      if (!(bh[b] = sb_getblk(s, ++cur_index)))
-+                              goto block_release;
-+                      bytes += msblk->devblksize;
-+              }
-+              ll_rw_block(READ, b, bh);
-+      } else {
-+              if (!(bh[0] = get_block_length(s, &cur_index, &offset,
-+                                                              &c_byte)))
-+                      goto read_failure;
-+
-+              bytes = msblk->devblksize - offset;
-+              compressed = SQUASHFS_COMPRESSED(c_byte);
-+              c_buffer = compressed ? msblk->read_data : buffer;
-+              c_byte = SQUASHFS_COMPRESSED_SIZE(c_byte);
-+
-+              TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
-+                                      ? "" : "un", (unsigned int) c_byte);
-+
-+              for (b = 1; bytes < c_byte; b++) {
-+                      if (!(bh[b] = sb_getblk(s, ++cur_index)))
-+                              goto block_release;
-+                      bytes += msblk->devblksize;
-+              }
-+              ll_rw_block(READ, b - 1, bh + 1);
-+      }
-+
-+      if (compressed)
-+              down(&msblk->read_data_mutex);
-+
-+      for (bytes = 0, k = 0; k < b; k++) {
-+              avail_bytes = (c_byte - bytes) > (msblk->devblksize - offset) ?
-+                                      msblk->devblksize - offset :
-+                                      c_byte - bytes;
-+              wait_on_buffer(bh[k]);
-+              if (!buffer_uptodate(bh[k]))
-+                      goto block_release;
-+              memcpy(c_buffer + bytes, bh[k]->b_data + offset, avail_bytes);
-+              bytes += avail_bytes;
-+              offset = 0;
-+              brelse(bh[k]);
-+      }
-+
-+      /*
-+       * uncompress block
-+       */
-+      if (compressed) {
-+              int zlib_err;
-+
-+              stream.next_in = c_buffer;
-+              stream.avail_in = c_byte;
-+              stream.next_out = buffer;
-+              stream.avail_out = msblk->read_size;
-+
-+              if (((zlib_err = zlib_inflateInit(&stream)) != Z_OK) ||
-+                              ((zlib_err = zlib_inflate(&stream, Z_FINISH))
-+                               != Z_STREAM_END) || ((zlib_err =
-+                              zlib_inflateEnd(&stream)) != Z_OK)) {
-+                      ERROR("zlib_fs returned unexpected result 0x%x\n",
-+                              zlib_err);
-+                      bytes = 0;
-+              } else
-+                      bytes = stream.total_out;
-+
-+              up(&msblk->read_data_mutex);
-+      }
-+
-+      if (next_index)
-+              *next_index = index + c_byte + (length ? 0 :
-+                              (SQUASHFS_CHECK_DATA(msblk->sblk.flags)
-+                               ? 3 : 2));
-+      return bytes;
-+
-+block_release:
-+      while (--b >= 0)
-+              brelse(bh[b]);
-+
-+read_failure:
-+      ERROR("sb_bread failed reading block 0x%x\n", cur_index);
-+      return 0;
-+}
-+
-+
-+SQSH_EXTERN int squashfs_get_cached_block(struct super_block *s, char *buffer,
-+                              long long block, unsigned int offset,
-+                              int length, long long *next_block,
-+                              unsigned int *next_offset)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      int n, i, bytes, return_length = length;
-+      long long next_index;
-+
-+      TRACE("Entered squashfs_get_cached_block [%llx:%x]\n", block, offset);
-+
-+      while ( 1 ) {
-+              for (i = 0; i < SQUASHFS_CACHED_BLKS; i++)
-+                      if (msblk->block_cache[i].block == block)
-+                              break;
-+
-+              down(&msblk->block_cache_mutex);
-+
-+              if (i == SQUASHFS_CACHED_BLKS) {
-+                      /* read inode header block */
-+                      for (i = msblk->next_cache, n = SQUASHFS_CACHED_BLKS;
-+                                      n ; n --, i = (i + 1) %
-+                                      SQUASHFS_CACHED_BLKS)
-+                              if (msblk->block_cache[i].block !=
-+                                                      SQUASHFS_USED_BLK)
-+                                      break;
-+
-+                      if (n == 0) {
-+                              wait_queue_t wait;
-+
-+                              init_waitqueue_entry(&wait, current);
-+                              add_wait_queue(&msblk->waitq, &wait);
-+                              set_current_state(TASK_UNINTERRUPTIBLE);
-+                              up(&msblk->block_cache_mutex);
-+                              schedule();
-+                              set_current_state(TASK_RUNNING);
-+                              remove_wait_queue(&msblk->waitq, &wait);
-+                              continue;
-+                      }
-+                      msblk->next_cache = (i + 1) % SQUASHFS_CACHED_BLKS;
-+
-+                      if (msblk->block_cache[i].block ==
-+                                                      SQUASHFS_INVALID_BLK) {
-+                              if (!(msblk->block_cache[i].data =
-+                                              kmalloc(SQUASHFS_METADATA_SIZE,
-+                                              GFP_KERNEL))) {
-+                                      ERROR("Failed to allocate cache"
-+                                                      "block\n");
-+                                      up(&msblk->block_cache_mutex);
-+                                      goto out;
-+                              }
-+                      }
-+
-+                      msblk->block_cache[i].block = SQUASHFS_USED_BLK;
-+                      up(&msblk->block_cache_mutex);
-+
-+                      if (!(msblk->block_cache[i].length =
-+                                              squashfs_read_data(s,
-+                                              msblk->block_cache[i].data,
-+                                              block, 0, &next_index))) {
-+                              ERROR("Unable to read cache block [%llx:%x]\n",
-+                                              block, offset);
-+                              goto out;
-+                      }
-+
-+                      down(&msblk->block_cache_mutex);
-+                      wake_up(&msblk->waitq);
-+                      msblk->block_cache[i].block = block;
-+                      msblk->block_cache[i].next_index = next_index;
-+                      TRACE("Read cache block [%llx:%x]\n", block, offset);
-+              }
-+
-+              if (msblk->block_cache[i].block != block) {
-+                      up(&msblk->block_cache_mutex);
-+                      continue;
-+              }
-+
-+              if ((bytes = msblk->block_cache[i].length - offset) >= length) {
-+                      if (buffer)
-+                              memcpy(buffer, msblk->block_cache[i].data +
-+                                              offset, length);
-+                      if (msblk->block_cache[i].length - offset == length) {
-+                              *next_block = msblk->block_cache[i].next_index;
-+                              *next_offset = 0;
-+                      } else {
-+                              *next_block = block;
-+                              *next_offset = offset + length;
-+                      }
-+                      up(&msblk->block_cache_mutex);
-+                      goto finish;
-+              } else {
-+                      if (buffer) {
-+                              memcpy(buffer, msblk->block_cache[i].data +
-+                                              offset, bytes);
-+                              buffer += bytes;
-+                      }
-+                      block = msblk->block_cache[i].next_index;
-+                      up(&msblk->block_cache_mutex);
-+                      length -= bytes;
-+                      offset = 0;
-+              }
-+      }
-+
-+finish:
-+      return return_length;
-+out:
-+      return 0;
-+}
-+
-+
-+static int get_fragment_location(struct super_block *s, unsigned int fragment,
-+                              long long *fragment_start_block,
-+                              unsigned int *fragment_size)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      long long start_block =
-+              msblk->fragment_index[SQUASHFS_FRAGMENT_INDEX(fragment)];
-+      int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET(fragment);
-+      struct squashfs_fragment_entry fragment_entry;
-+
-+      if (msblk->swap) {
-+              struct squashfs_fragment_entry sfragment_entry;
-+
-+              if (!squashfs_get_cached_block(s, (char *) &sfragment_entry,
-+                                      start_block, offset,
-+                                      sizeof(sfragment_entry), &start_block,
-+                                      &offset))
-+                      goto out;
-+              SQUASHFS_SWAP_FRAGMENT_ENTRY(&fragment_entry, &sfragment_entry);
-+      } else
-+              if (!squashfs_get_cached_block(s, (char *) &fragment_entry,
-+                                      start_block, offset,
-+                                      sizeof(fragment_entry), &start_block,
-+                                      &offset))
-+                      goto out;
-+
-+      *fragment_start_block = fragment_entry.start_block;
-+      *fragment_size = fragment_entry.size;
-+
-+      return 1;
-+
-+out:
-+      return 0;
-+}
-+
-+
-+SQSH_EXTERN void release_cached_fragment(struct squashfs_sb_info *msblk, struct
-+                                      squashfs_fragment_cache *fragment)
-+{
-+      down(&msblk->fragment_mutex);
-+      fragment->locked --;
-+      wake_up(&msblk->fragment_wait_queue);
-+      up(&msblk->fragment_mutex);
-+}
-+
-+
-+SQSH_EXTERN struct squashfs_fragment_cache *get_cached_fragment(struct super_block
-+                                      *s, long long start_block,
-+                                      int length)
-+{
-+      int i, n;
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+
-+      while ( 1 ) {
-+              down(&msblk->fragment_mutex);
-+
-+              for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS &&
-+                              msblk->fragment[i].block != start_block; i++);
-+
-+              if (i == SQUASHFS_CACHED_FRAGMENTS) {
-+                      for (i = msblk->next_fragment, n =
-+                              SQUASHFS_CACHED_FRAGMENTS; n &&
-+                              msblk->fragment[i].locked; n--, i = (i + 1) %
-+                              SQUASHFS_CACHED_FRAGMENTS);
-+
-+                      if (n == 0) {
-+                              wait_queue_t wait;
-+
-+                              init_waitqueue_entry(&wait, current);
-+                              add_wait_queue(&msblk->fragment_wait_queue,
-+                                                                      &wait);
-+                              set_current_state(TASK_UNINTERRUPTIBLE);
-+                              up(&msblk->fragment_mutex);
-+                              schedule();
-+                              set_current_state(TASK_RUNNING);
-+                              remove_wait_queue(&msblk->fragment_wait_queue,
-+                                                                      &wait);
-+                              continue;
-+                      }
-+                      msblk->next_fragment = (msblk->next_fragment + 1) %
-+                              SQUASHFS_CACHED_FRAGMENTS;
-+
-+                      if (msblk->fragment[i].data == NULL)
-+                              if (!(msblk->fragment[i].data = SQUASHFS_ALLOC
-+                                              (SQUASHFS_FILE_MAX_SIZE))) {
-+                                      ERROR("Failed to allocate fragment "
-+                                                      "cache block\n");
-+                                      up(&msblk->fragment_mutex);
-+                                      goto out;
-+                              }
-+
-+                      msblk->fragment[i].block = SQUASHFS_INVALID_BLK;
-+                      msblk->fragment[i].locked = 1;
-+                      up(&msblk->fragment_mutex);
-+
-+                      if (!(msblk->fragment[i].length = squashfs_read_data(s,
-+                                              msblk->fragment[i].data,
-+                                              start_block, length, NULL))) {
-+                              ERROR("Unable to read fragment cache block "
-+                                                      "[%llx]\n", start_block);
-+                              msblk->fragment[i].locked = 0;
-+                              goto out;
-+                      }
-+
-+                      msblk->fragment[i].block = start_block;
-+                      TRACE("New fragment %d, start block %lld, locked %d\n",
-+                                              i, msblk->fragment[i].block,
-+                                              msblk->fragment[i].locked);
-+                      break;
-+              }
-+
-+              msblk->fragment[i].locked++;
-+              up(&msblk->fragment_mutex);
-+              TRACE("Got fragment %d, start block %lld, locked %d\n", i,
-+                                              msblk->fragment[i].block,
-+                                              msblk->fragment[i].locked);
-+              break;
-+      }
-+
-+      return &msblk->fragment[i];
-+
-+out:
-+      return NULL;
-+}
-+
-+
-+static struct inode *squashfs_new_inode(struct super_block *s,
-+              struct squashfs_base_inode_header *inodeb)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct inode *i = new_inode(s);
-+
-+      if (i) {
-+              i->i_ino = inodeb->inode_number;
-+              i->i_mtime.tv_sec = inodeb->mtime;
-+              i->i_atime.tv_sec = inodeb->mtime;
-+              i->i_ctime.tv_sec = inodeb->mtime;
-+              i->i_uid = msblk->uid[inodeb->uid];
-+              i->i_mode = inodeb->mode;
-+              i->i_size = 0;
-+              if (inodeb->guid == SQUASHFS_GUIDS)
-+                      i->i_gid = i->i_uid;
-+              else
-+                      i->i_gid = msblk->guid[inodeb->guid];
-+      }
-+
-+      return i;
-+}
-+
-+
-+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode)
-+{
-+      struct inode *i;
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      long long block = SQUASHFS_INODE_BLK(inode) +
-+              sblk->inode_table_start;
-+      unsigned int offset = SQUASHFS_INODE_OFFSET(inode);
-+      long long next_block;
-+      unsigned int next_offset;
-+      union squashfs_inode_header id, sid;
-+      struct squashfs_base_inode_header *inodeb = &id.base,
-+                                        *sinodeb = &sid.base;
-+
-+      TRACE("Entered squashfs_iget\n");
-+
-+      if (msblk->swap) {
-+              if (!squashfs_get_cached_block(s, (char *) sinodeb, block,
-+                                      offset, sizeof(*sinodeb), &next_block,
-+                                      &next_offset))
-+                      goto failed_read;
-+              SQUASHFS_SWAP_BASE_INODE_HEADER(inodeb, sinodeb,
-+                                      sizeof(*sinodeb));
-+      } else
-+              if (!squashfs_get_cached_block(s, (char *) inodeb, block,
-+                                      offset, sizeof(*inodeb), &next_block,
-+                                      &next_offset))
-+                      goto failed_read;
-+
-+      switch(inodeb->inode_type) {
-+              case SQUASHFS_FILE_TYPE: {
-+                      unsigned int frag_size;
-+                      long long frag_blk;
-+                      struct squashfs_reg_inode_header *inodep = &id.reg;
-+                      struct squashfs_reg_inode_header *sinodep = &sid.reg;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_REG_INODE_HEADER(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      frag_blk = SQUASHFS_INVALID_BLK;
-+                      if (inodep->fragment != SQUASHFS_INVALID_FRAG &&
-+                                      !get_fragment_location(s,
-+                                      inodep->fragment, &frag_blk, &frag_size))
-+                              goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = 1;
-+                      i->i_size = inodep->file_size;
-+                      i->i_fop = &generic_ro_fops;
-+                      i->i_mode |= S_IFREG;
-+                      i->i_blocks = ((i->i_size - 1) >> 9) + 1;
-+                      SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk;
-+                      SQUASHFS_I(i)->u.s1.fragment_size = frag_size;
-+                      SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->u.s1.block_list_start = next_block;
-+                      SQUASHFS_I(i)->offset = next_offset;
-+                      if (sblk->block_size > 4096)
-+                              i->i_data.a_ops = &squashfs_aops;
-+                      else
-+                              i->i_data.a_ops = &squashfs_aops_4K;
-+
-+                      TRACE("File inode %x:%x, start_block %llx, "
-+                                      "block_list_start %llx, offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->start_block, next_block,
-+                                      next_offset);
-+                      break;
-+              }
-+              case SQUASHFS_LREG_TYPE: {
-+                      unsigned int frag_size;
-+                      long long frag_blk;
-+                      struct squashfs_lreg_inode_header *inodep = &id.lreg;
-+                      struct squashfs_lreg_inode_header *sinodep = &sid.lreg;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_LREG_INODE_HEADER(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      frag_blk = SQUASHFS_INVALID_BLK;
-+                      if (inodep->fragment != SQUASHFS_INVALID_FRAG &&
-+                                      !get_fragment_location(s,
-+                                      inodep->fragment, &frag_blk, &frag_size))
-+                              goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = inodep->nlink;
-+                      i->i_size = inodep->file_size;
-+                      i->i_fop = &generic_ro_fops;
-+                      i->i_mode |= S_IFREG;
-+                      i->i_blocks = ((i->i_size - 1) >> 9) + 1;
-+                      SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk;
-+                      SQUASHFS_I(i)->u.s1.fragment_size = frag_size;
-+                      SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->u.s1.block_list_start = next_block;
-+                      SQUASHFS_I(i)->offset = next_offset;
-+                      if (sblk->block_size > 4096)
-+                              i->i_data.a_ops = &squashfs_aops;
-+                      else
-+                              i->i_data.a_ops = &squashfs_aops_4K;
-+
-+                      TRACE("File inode %x:%x, start_block %llx, "
-+                                      "block_list_start %llx, offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->start_block, next_block,
-+                                      next_offset);
-+                      break;
-+              }
-+              case SQUASHFS_DIR_TYPE: {
-+                      struct squashfs_dir_inode_header *inodep = &id.dir;
-+                      struct squashfs_dir_inode_header *sinodep = &sid.dir;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_DIR_INODE_HEADER(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = inodep->nlink;
-+                      i->i_size = inodep->file_size;
-+                      i->i_op = &squashfs_dir_inode_ops;
-+                      i->i_fop = &squashfs_dir_ops;
-+                      i->i_mode |= S_IFDIR;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->offset = inodep->offset;
-+                      SQUASHFS_I(i)->u.s2.directory_index_count = 0;
-+                      SQUASHFS_I(i)->u.s2.parent_inode = inodep->parent_inode;
-+
-+                      TRACE("Directory inode %x:%x, start_block %x, offset "
-+                                      "%x\n", SQUASHFS_INODE_BLK(inode),
-+                                      offset, inodep->start_block,
-+                                      inodep->offset);
-+                      break;
-+              }
-+              case SQUASHFS_LDIR_TYPE: {
-+                      struct squashfs_ldir_inode_header *inodep = &id.ldir;
-+                      struct squashfs_ldir_inode_header *sinodep = &sid.ldir;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_LDIR_INODE_HEADER(inodep,
-+                                              sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = inodep->nlink;
-+                      i->i_size = inodep->file_size;
-+                      i->i_op = &squashfs_dir_inode_ops;
-+                      i->i_fop = &squashfs_dir_ops;
-+                      i->i_mode |= S_IFDIR;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->offset = inodep->offset;
-+                      SQUASHFS_I(i)->u.s2.directory_index_start = next_block;
-+                      SQUASHFS_I(i)->u.s2.directory_index_offset =
-+                                                              next_offset;
-+                      SQUASHFS_I(i)->u.s2.directory_index_count =
-+                                                              inodep->i_count;
-+                      SQUASHFS_I(i)->u.s2.parent_inode = inodep->parent_inode;
-+
-+                      TRACE("Long directory inode %x:%x, start_block %x, "
-+                                      "offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->start_block, inodep->offset);
-+                      break;
-+              }
-+              case SQUASHFS_SYMLINK_TYPE: {
-+                      struct squashfs_symlink_inode_header *inodep =
-+                                                              &id.symlink;
-+                      struct squashfs_symlink_inode_header *sinodep =
-+                                                              &sid.symlink;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_SYMLINK_INODE_HEADER(inodep,
-+                                                              sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = inodep->nlink;
-+                      i->i_size = inodep->symlink_size;
-+                      i->i_op = &page_symlink_inode_operations;
-+                      i->i_data.a_ops = &squashfs_symlink_aops;
-+                      i->i_mode |= S_IFLNK;
-+                      SQUASHFS_I(i)->start_block = next_block;
-+                      SQUASHFS_I(i)->offset = next_offset;
-+
-+                      TRACE("Symbolic link inode %x:%x, start_block %llx, "
-+                                      "offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      next_block, next_offset);
-+                      break;
-+               }
-+               case SQUASHFS_BLKDEV_TYPE:
-+               case SQUASHFS_CHRDEV_TYPE: {
-+                      struct squashfs_dev_inode_header *inodep = &id.dev;
-+                      struct squashfs_dev_inode_header *sinodep = &sid.dev;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_DEV_INODE_HEADER(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if ((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = inodep->nlink;
-+                      i->i_mode |= (inodeb->inode_type ==
-+                                      SQUASHFS_CHRDEV_TYPE) ?  S_IFCHR :
-+                                      S_IFBLK;
-+                      init_special_inode(i, i->i_mode,
-+                                      old_decode_dev(inodep->rdev));
-+
-+                      TRACE("Device inode %x:%x, rdev %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->rdev);
-+                      break;
-+               }
-+               case SQUASHFS_FIFO_TYPE:
-+               case SQUASHFS_SOCKET_TYPE: {
-+                      struct squashfs_ipc_inode_header *inodep = &id.ipc;
-+                      struct squashfs_ipc_inode_header *sinodep = &sid.ipc;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_IPC_INODE_HEADER(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if ((i = squashfs_new_inode(s, inodeb)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_nlink = inodep->nlink;
-+                      i->i_mode |= (inodeb->inode_type == SQUASHFS_FIFO_TYPE)
-+                                                      ? S_IFIFO : S_IFSOCK;
-+                      init_special_inode(i, i->i_mode, 0);
-+                      break;
-+               }
-+               default:
-+                      ERROR("Unknown inode type %d in squashfs_iget!\n",
-+                                      inodeb->inode_type);
-+                      goto failed_read1;
-+      }
-+
-+      insert_inode_hash(i);
-+      return i;
-+
-+failed_read:
-+      ERROR("Unable to read inode [%llx:%x]\n", block, offset);
-+
-+failed_read1:
-+      return NULL;
-+}
-+
-+
-+static int read_fragment_index_table(struct super_block *s)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+
-+      /* Allocate fragment index table */
-+      if (!(msblk->fragment_index = kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES
-+                                      (sblk->fragments), GFP_KERNEL))) {
-+              ERROR("Failed to allocate uid/gid table\n");
-+              return 0;
-+      }
-+
-+      if (SQUASHFS_FRAGMENT_INDEX_BYTES(sblk->fragments) &&
-+                                      !squashfs_read_data(s, (char *)
-+                                      msblk->fragment_index,
-+                                      sblk->fragment_table_start,
-+                                      SQUASHFS_FRAGMENT_INDEX_BYTES
-+                                      (sblk->fragments) |
-+                                      SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+              ERROR("unable to read fragment index table\n");
-+              return 0;
-+      }
-+
-+      if (msblk->swap) {
-+              int i;
-+              long long fragment;
-+
-+              for (i = 0; i < SQUASHFS_FRAGMENT_INDEXES(sblk->fragments);
-+                                                                      i++) {
-+                      SQUASHFS_SWAP_FRAGMENT_INDEXES((&fragment),
-+                                              &msblk->fragment_index[i], 1);
-+                      msblk->fragment_index[i] = fragment;
-+              }
-+      }
-+
-+      return 1;
-+}
-+
-+
-+static int supported_squashfs_filesystem(struct squashfs_sb_info *msblk, int silent)
-+{
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+
-+      msblk->iget = squashfs_iget;
-+      msblk->read_blocklist = read_blocklist;
-+      msblk->read_fragment_index_table = read_fragment_index_table;
-+
-+      if (sblk->s_major == 1) {
-+              if (!squashfs_1_0_supported(msblk)) {
-+                      SERROR("Major/Minor mismatch, Squashfs 1.0 filesystems "
-+                              "are unsupported\n");
-+                      SERROR("Please recompile with "
-+                              "Squashfs 1.0 support enabled\n");
-+                      return 0;
-+              }
-+      } else if (sblk->s_major == 2) {
-+              if (!squashfs_2_0_supported(msblk)) {
-+                      SERROR("Major/Minor mismatch, Squashfs 2.0 filesystems "
-+                              "are unsupported\n");
-+                      SERROR("Please recompile with "
-+                              "Squashfs 2.0 support enabled\n");
-+                      return 0;
-+              }
-+      } else if(sblk->s_major != SQUASHFS_MAJOR || sblk->s_minor >
-+                      SQUASHFS_MINOR) {
-+              SERROR("Major/Minor mismatch, trying to mount newer %d.%d "
-+                              "filesystem\n", sblk->s_major, sblk->s_minor);
-+              SERROR("Please update your kernel\n");
-+              return 0;
-+      }
-+
-+      return 1;
-+}
-+
-+
-+static int squashfs_fill_super(struct super_block *s, void *data, int silent)
-+{
-+      struct squashfs_sb_info *msblk;
-+      struct squashfs_super_block *sblk;
-+      int i;
-+      char b[BDEVNAME_SIZE];
-+      struct inode *root;
-+
-+      TRACE("Entered squashfs_read_superblock\n");
-+
-+      if (!(s->s_fs_info = kmalloc(sizeof(struct squashfs_sb_info),
-+                                              GFP_KERNEL))) {
-+              ERROR("Failed to allocate superblock\n");
-+              goto failure;
-+      }
-+      memset(s->s_fs_info, 0, sizeof(struct squashfs_sb_info));
-+      msblk = s->s_fs_info;
-+      sblk = &msblk->sblk;
-+
-+      msblk->devblksize = sb_min_blocksize(s, BLOCK_SIZE);
-+      msblk->devblksize_log2 = ffz(~msblk->devblksize);
-+
-+      init_MUTEX(&msblk->read_data_mutex);
-+      init_MUTEX(&msblk->read_page_mutex);
-+      init_MUTEX(&msblk->block_cache_mutex);
-+      init_MUTEX(&msblk->fragment_mutex);
-+      init_MUTEX(&msblk->meta_index_mutex);
-+
-+      init_waitqueue_head(&msblk->waitq);
-+      init_waitqueue_head(&msblk->fragment_wait_queue);
-+
-+      if (!squashfs_read_data(s, (char *) sblk, SQUASHFS_START,
-+                                      sizeof(struct squashfs_super_block) |
-+                                      SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+              SERROR("unable to read superblock\n");
-+              goto failed_mount;
-+      }
-+
-+      /* Check it is a SQUASHFS superblock */
-+      msblk->swap = 0;
-+      if ((s->s_magic = sblk->s_magic) != SQUASHFS_MAGIC) {
-+              if (sblk->s_magic == SQUASHFS_MAGIC_SWAP) {
-+                      struct squashfs_super_block ssblk;
-+
-+                      WARNING("Mounting a different endian SQUASHFS "
-+                              "filesystem on %s\n", bdevname(s->s_bdev, b));
-+
-+                      SQUASHFS_SWAP_SUPER_BLOCK(&ssblk, sblk);
-+                      memcpy(sblk, &ssblk, sizeof(struct squashfs_super_block));
-+                      msblk->swap = 1;
-+              } else  {
-+                      SERROR("Can't find a SQUASHFS superblock on %s\n",
-+                                                      bdevname(s->s_bdev, b));
-+                      goto failed_mount;
-+              }
-+      }
-+
-+      /* Check the MAJOR & MINOR versions */
-+      if(!supported_squashfs_filesystem(msblk, silent))
-+              goto failed_mount;
-+
-+      TRACE("Found valid superblock on %s\n", bdevname(s->s_bdev, b));
-+      TRACE("Inodes are %scompressed\n",
-+                                      SQUASHFS_UNCOMPRESSED_INODES
-+                                      (sblk->flags) ? "un" : "");
-+      TRACE("Data is %scompressed\n",
-+                                      SQUASHFS_UNCOMPRESSED_DATA(sblk->flags)
-+                                      ? "un" : "");
-+      TRACE("Check data is %s present in the filesystem\n",
-+                                      SQUASHFS_CHECK_DATA(sblk->flags) ?
-+                                      "" : "not");
-+      TRACE("Filesystem size %lld bytes\n", sblk->bytes_used);
-+      TRACE("Block size %d\n", sblk->block_size);
-+      TRACE("Number of inodes %d\n", sblk->inodes);
-+      if (sblk->s_major > 1)
-+              TRACE("Number of fragments %d\n", sblk->fragments);
-+      TRACE("Number of uids %d\n", sblk->no_uids);
-+      TRACE("Number of gids %d\n", sblk->no_guids);
-+      TRACE("sblk->inode_table_start %llx\n", sblk->inode_table_start);
-+      TRACE("sblk->directory_table_start %llx\n", sblk->directory_table_start);
-+      if (sblk->s_major > 1)
-+              TRACE("sblk->fragment_table_start %llx\n",
-+                                      sblk->fragment_table_start);
-+      TRACE("sblk->uid_start %llx\n", sblk->uid_start);
-+
-+      s->s_flags |= MS_RDONLY;
-+      s->s_op = &squashfs_ops;
-+
-+      /* Init inode_table block pointer array */
-+      if (!(msblk->block_cache = kmalloc(sizeof(struct squashfs_cache) *
-+                                      SQUASHFS_CACHED_BLKS, GFP_KERNEL))) {
-+              ERROR("Failed to allocate block cache\n");
-+              goto failed_mount;
-+      }
-+
-+      for (i = 0; i < SQUASHFS_CACHED_BLKS; i++)
-+              msblk->block_cache[i].block = SQUASHFS_INVALID_BLK;
-+
-+      msblk->next_cache = 0;
-+
-+      /* Allocate read_data block */
-+      msblk->read_size = (sblk->block_size < SQUASHFS_METADATA_SIZE) ?
-+                                      SQUASHFS_METADATA_SIZE :
-+                                      sblk->block_size;
-+
-+      if (!(msblk->read_data = kmalloc(msblk->read_size, GFP_KERNEL))) {
-+              ERROR("Failed to allocate read_data block\n");
-+              goto failed_mount;
-+      }
-+
-+      /* Allocate read_page block */
-+      if (!(msblk->read_page = kmalloc(sblk->block_size, GFP_KERNEL))) {
-+              ERROR("Failed to allocate read_page block\n");
-+              goto failed_mount;
-+      }
-+
-+      /* Allocate uid and gid tables */
-+      if (!(msblk->uid = kmalloc((sblk->no_uids + sblk->no_guids) *
-+                                      sizeof(unsigned int), GFP_KERNEL))) {
-+              ERROR("Failed to allocate uid/gid table\n");
-+              goto failed_mount;
-+      }
-+      msblk->guid = msblk->uid + sblk->no_uids;
-+
-+      if (msblk->swap) {
-+              unsigned int suid[sblk->no_uids + sblk->no_guids];
-+
-+              if (!squashfs_read_data(s, (char *) &suid, sblk->uid_start,
-+                                      ((sblk->no_uids + sblk->no_guids) *
-+                                       sizeof(unsigned int)) |
-+                                      SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+                      ERROR("unable to read uid/gid table\n");
-+                      goto failed_mount;
-+              }
-+
-+              SQUASHFS_SWAP_DATA(msblk->uid, suid, (sblk->no_uids +
-+                      sblk->no_guids), (sizeof(unsigned int) * 8));
-+      } else
-+              if (!squashfs_read_data(s, (char *) msblk->uid, sblk->uid_start,
-+                                      ((sblk->no_uids + sblk->no_guids) *
-+                                       sizeof(unsigned int)) |
-+                                      SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+                      ERROR("unable to read uid/gid table\n");
-+                      goto failed_mount;
-+              }
-+
-+
-+      if (sblk->s_major == 1 && squashfs_1_0_supported(msblk))
-+              goto allocate_root;
-+
-+      if (!(msblk->fragment = kmalloc(sizeof(struct squashfs_fragment_cache) *
-+                              SQUASHFS_CACHED_FRAGMENTS, GFP_KERNEL))) {
-+              ERROR("Failed to allocate fragment block cache\n");
-+              goto failed_mount;
-+      }
-+
-+      for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS; i++) {
-+              msblk->fragment[i].locked = 0;
-+              msblk->fragment[i].block = SQUASHFS_INVALID_BLK;
-+              msblk->fragment[i].data = NULL;
-+      }
-+
-+      msblk->next_fragment = 0;
-+
-+      /* Allocate fragment index table */
-+      if (msblk->read_fragment_index_table(s) == 0)
-+              goto failed_mount;
-+
-+allocate_root:
-+      if ((root = (msblk->iget)(s, sblk->root_inode)) == NULL)
-+              goto failed_mount;
-+
-+      if ((s->s_root = d_alloc_root(root)) == NULL) {
-+              ERROR("Root inode create failed\n");
-+              iput(root);
-+              goto failed_mount;
-+      }
-+
-+      TRACE("Leaving squashfs_read_super\n");
-+      return 0;
-+
-+failed_mount:
-+      kfree(msblk->fragment_index);
-+      kfree(msblk->fragment);
-+      kfree(msblk->uid);
-+      kfree(msblk->read_page);
-+      kfree(msblk->read_data);
-+      kfree(msblk->block_cache);
-+      kfree(msblk->fragment_index_2);
-+      kfree(s->s_fs_info);
-+      s->s_fs_info = NULL;
-+      return -EINVAL;
-+
-+failure:
-+      return -ENOMEM;
-+}
-+
-+
-+static int squashfs_statfs(struct dentry *dentry, struct kstatfs *buf)
-+{
-+      struct squashfs_sb_info *msblk = dentry->d_inode->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+
-+      TRACE("Entered squashfs_statfs\n");
-+
-+      buf->f_type = SQUASHFS_MAGIC;
-+      buf->f_bsize = sblk->block_size;
-+      buf->f_blocks = ((sblk->bytes_used - 1) >> sblk->block_log) + 1;
-+      buf->f_bfree = buf->f_bavail = 0;
-+      buf->f_files = sblk->inodes;
-+      buf->f_ffree = 0;
-+      buf->f_namelen = SQUASHFS_NAME_LEN;
-+
-+      return 0;
-+}
-+
-+
-+static int squashfs_symlink_readpage(struct file *file, struct page *page)
-+{
-+      struct inode *inode = page->mapping->host;
-+      int index = page->index << PAGE_CACHE_SHIFT, length, bytes;
-+      long long block = SQUASHFS_I(inode)->start_block;
-+      int offset = SQUASHFS_I(inode)->offset;
-+      void *pageaddr = kmap(page);
-+
-+      TRACE("Entered squashfs_symlink_readpage, page index %ld, start block "
-+                              "%llx, offset %x\n", page->index,
-+                              SQUASHFS_I(inode)->start_block,
-+                              SQUASHFS_I(inode)->offset);
-+
-+      for (length = 0; length < index; length += bytes) {
-+              if (!(bytes = squashfs_get_cached_block(inode->i_sb, NULL,
-+                              block, offset, PAGE_CACHE_SIZE, &block,
-+                              &offset))) {
-+                      ERROR("Unable to read symbolic link [%llx:%x]\n", block,
-+                                      offset);
-+                      goto skip_read;
-+              }
-+      }
-+
-+      if (length != index) {
-+              ERROR("(squashfs_symlink_readpage) length != index\n");
-+              bytes = 0;
-+              goto skip_read;
-+      }
-+
-+      bytes = (i_size_read(inode) - length) > PAGE_CACHE_SIZE ? PAGE_CACHE_SIZE :
-+                                      i_size_read(inode) - length;
-+
-+      if (!(bytes = squashfs_get_cached_block(inode->i_sb, pageaddr, block,
-+                                      offset, bytes, &block, &offset)))
-+              ERROR("Unable to read symbolic link [%llx:%x]\n", block, offset);
-+
-+skip_read:
-+      memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
-+      kunmap(page);
-+      SetPageUptodate(page);
-+      unlock_page(page);
-+
-+      return 0;
-+}
-+
-+
-+struct meta_index *locate_meta_index(struct inode *inode, int index, int offset)
-+{
-+      struct meta_index *meta = NULL;
-+      struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-+      int i;
-+
-+      down(&msblk->meta_index_mutex);
-+
-+      TRACE("locate_meta_index: index %d, offset %d\n", index, offset);
-+
-+      if(msblk->meta_index == NULL)
-+              goto not_allocated;
-+
-+      for (i = 0; i < SQUASHFS_META_NUMBER; i ++)
-+              if (msblk->meta_index[i].inode_number == inode->i_ino &&
-+                              msblk->meta_index[i].offset >= offset &&
-+                              msblk->meta_index[i].offset <= index &&
-+                              msblk->meta_index[i].locked == 0) {
-+                      TRACE("locate_meta_index: entry %d, offset %d\n", i,
-+                                      msblk->meta_index[i].offset);
-+                      meta = &msblk->meta_index[i];
-+                      offset = meta->offset;
-+              }
-+
-+      if (meta)
-+              meta->locked = 1;
-+
-+not_allocated:
-+      up(&msblk->meta_index_mutex);
-+
-+      return meta;
-+}
-+
-+
-+struct meta_index *empty_meta_index(struct inode *inode, int offset, int skip)
-+{
-+      struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-+      struct meta_index *meta = NULL;
-+      int i;
-+
-+      down(&msblk->meta_index_mutex);
-+
-+      TRACE("empty_meta_index: offset %d, skip %d\n", offset, skip);
-+
-+      if(msblk->meta_index == NULL) {
-+              if (!(msblk->meta_index = kmalloc(sizeof(struct meta_index) *
-+                                      SQUASHFS_META_NUMBER, GFP_KERNEL))) {
-+                      ERROR("Failed to allocate meta_index\n");
-+                      goto failed;
-+              }
-+              for(i = 0; i < SQUASHFS_META_NUMBER; i++) {
-+                      msblk->meta_index[i].inode_number = 0;
-+                      msblk->meta_index[i].locked = 0;
-+              }
-+              msblk->next_meta_index = 0;
-+      }
-+
-+      for(i = SQUASHFS_META_NUMBER; i &&
-+                      msblk->meta_index[msblk->next_meta_index].locked; i --)
-+              msblk->next_meta_index = (msblk->next_meta_index + 1) %
-+                      SQUASHFS_META_NUMBER;
-+
-+      if(i == 0) {
-+              TRACE("empty_meta_index: failed!\n");
-+              goto failed;
-+      }
-+
-+      TRACE("empty_meta_index: returned meta entry %d, %p\n",
-+                      msblk->next_meta_index,
-+                      &msblk->meta_index[msblk->next_meta_index]);
-+
-+      meta = &msblk->meta_index[msblk->next_meta_index];
-+      msblk->next_meta_index = (msblk->next_meta_index + 1) %
-+                      SQUASHFS_META_NUMBER;
-+
-+      meta->inode_number = inode->i_ino;
-+      meta->offset = offset;
-+      meta->skip = skip;
-+      meta->entries = 0;
-+      meta->locked = 1;
-+
-+failed:
-+      up(&msblk->meta_index_mutex);
-+      return meta;
-+}
-+
-+
-+void release_meta_index(struct inode *inode, struct meta_index *meta)
-+{
-+      meta->locked = 0;
-+}
-+
-+
-+static int read_block_index(struct super_block *s, int blocks, char *block_list,
-+              long long *start_block, int *offset)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      unsigned int *block_listp;
-+      int block = 0;
-+
-+      if (msblk->swap) {
-+              char sblock_list[blocks << 2];
-+
-+              if (!squashfs_get_cached_block(s, sblock_list, *start_block,
-+                              *offset, blocks << 2, start_block, offset)) {
-+                      ERROR("Unable to read block list [%llx:%x]\n",
-+                              *start_block, *offset);
-+                      goto failure;
-+              }
-+              SQUASHFS_SWAP_INTS(((unsigned int *)block_list),
-+                              ((unsigned int *)sblock_list), blocks);
-+      } else
-+              if (!squashfs_get_cached_block(s, block_list, *start_block,
-+                              *offset, blocks << 2, start_block, offset)) {
-+                      ERROR("Unable to read block list [%llx:%x]\n",
-+                              *start_block, *offset);
-+                      goto failure;
-+              }
-+
-+      for (block_listp = (unsigned int *) block_list; blocks;
-+                              block_listp++, blocks --)
-+              block += SQUASHFS_COMPRESSED_SIZE_BLOCK(*block_listp);
-+
-+      return block;
-+
-+failure:
-+      return -1;
-+}
-+
-+
-+#define SIZE 256
-+
-+static inline int calculate_skip(int blocks) {
-+      int skip = (blocks - 1) / ((SQUASHFS_SLOTS * SQUASHFS_META_ENTRIES + 1) * SQUASHFS_META_INDEXES);
-+      return skip >= 7 ? 7 : skip + 1;
-+}
-+
-+
-+static int get_meta_index(struct inode *inode, int index,
-+              long long *index_block, int *index_offset,
-+              long long *data_block, char *block_list)
-+{
-+      struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      int skip = calculate_skip(i_size_read(inode) >> sblk->block_log);
-+      int offset = 0;
-+      struct meta_index *meta;
-+      struct meta_entry *meta_entry;
-+      long long cur_index_block = SQUASHFS_I(inode)->u.s1.block_list_start;
-+      int cur_offset = SQUASHFS_I(inode)->offset;
-+      long long cur_data_block = SQUASHFS_I(inode)->start_block;
-+      int i;
-+
-+      index /= SQUASHFS_META_INDEXES * skip;
-+
-+      while ( offset < index ) {
-+              meta = locate_meta_index(inode, index, offset + 1);
-+
-+              if (meta == NULL) {
-+                      if ((meta = empty_meta_index(inode, offset + 1,
-+                                                      skip)) == NULL)
-+                              goto all_done;
-+              } else {
-+                      offset = index < meta->offset + meta->entries ? index :
-+                              meta->offset + meta->entries - 1;
-+                      meta_entry = &meta->meta_entry[offset - meta->offset];
-+                      cur_index_block = meta_entry->index_block + sblk->inode_table_start;
-+                      cur_offset = meta_entry->offset;
-+                      cur_data_block = meta_entry->data_block;
-+                      TRACE("get_meta_index: offset %d, meta->offset %d, "
-+                              "meta->entries %d\n", offset, meta->offset,
-+                              meta->entries);
-+                      TRACE("get_meta_index: index_block 0x%llx, offset 0x%x"
-+                              " data_block 0x%llx\n", cur_index_block,
-+                              cur_offset, cur_data_block);
-+              }
-+
-+              for (i = meta->offset + meta->entries; i <= index &&
-+                              i < meta->offset + SQUASHFS_META_ENTRIES; i++) {
-+                      int blocks = skip * SQUASHFS_META_INDEXES;
-+
-+                      while (blocks) {
-+                              int block = blocks > (SIZE >> 2) ? (SIZE >> 2) :
-+                                      blocks;
-+                              int res = read_block_index(inode->i_sb, block,
-+                                      block_list, &cur_index_block,
-+                                      &cur_offset);
-+
-+                              if (res == -1)
-+                                      goto failed;
-+
-+                              cur_data_block += res;
-+                              blocks -= block;
-+                      }
-+
-+                      meta_entry = &meta->meta_entry[i - meta->offset];
-+                      meta_entry->index_block = cur_index_block - sblk->inode_table_start;
-+                      meta_entry->offset = cur_offset;
-+                      meta_entry->data_block = cur_data_block;
-+                      meta->entries ++;
-+                      offset ++;
-+              }
-+
-+              TRACE("get_meta_index: meta->offset %d, meta->entries %d\n",
-+                              meta->offset, meta->entries);
-+
-+              release_meta_index(inode, meta);
-+      }
-+
-+all_done:
-+      *index_block = cur_index_block;
-+      *index_offset = cur_offset;
-+      *data_block = cur_data_block;
-+
-+      return offset * SQUASHFS_META_INDEXES * skip;
-+
-+failed:
-+      release_meta_index(inode, meta);
-+      return -1;
-+}
-+
-+
-+static long long read_blocklist(struct inode *inode, int index,
-+                              int readahead_blks, char *block_list,
-+                              unsigned short **block_p, unsigned int *bsize)
-+{
-+      long long block_ptr;
-+      int offset;
-+      long long block;
-+      int res = get_meta_index(inode, index, &block_ptr, &offset, &block,
-+              block_list);
-+
-+      TRACE("read_blocklist: res %d, index %d, block_ptr 0x%llx, offset"
-+                     " 0x%x, block 0x%llx\n", res, index, block_ptr, offset,
-+                     block);
-+
-+      if(res == -1)
-+              goto failure;
-+
-+      index -= res;
-+
-+      while ( index ) {
-+              int blocks = index > (SIZE >> 2) ? (SIZE >> 2) : index;
-+              int res = read_block_index(inode->i_sb, blocks, block_list,
-+                      &block_ptr, &offset);
-+              if (res == -1)
-+                      goto failure;
-+              block += res;
-+              index -= blocks;
-+      }
-+
-+      if (read_block_index(inode->i_sb, 1, block_list,
-+                      &block_ptr, &offset) == -1)
-+              goto failure;
-+      *bsize = *((unsigned int *) block_list);
-+
-+      return block;
-+
-+failure:
-+      return 0;
-+}
-+
-+
-+static int squashfs_readpage(struct file *file, struct page *page)
-+{
-+      struct inode *inode = page->mapping->host;
-+      struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      unsigned char block_list[SIZE];
-+      long long block;
-+      unsigned int bsize, i = 0, bytes = 0, byte_offset = 0;
-+      int index = page->index >> (sblk->block_log - PAGE_CACHE_SHIFT);
-+      void *pageaddr;
-+      struct squashfs_fragment_cache *fragment = NULL;
-+      char *data_ptr = msblk->read_page;
-+
-+      int mask = (1 << (sblk->block_log - PAGE_CACHE_SHIFT)) - 1;
-+      int start_index = page->index & ~mask;
-+      int end_index = start_index | mask;
-+
-+      TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n",
-+                                      page->index,
-+                                      SQUASHFS_I(inode)->start_block);
-+
-+      if (page->index >= ((i_size_read(inode) + PAGE_CACHE_SIZE - 1) >>
-+                                      PAGE_CACHE_SHIFT))
-+              goto skip_read;
-+
-+      if (SQUASHFS_I(inode)->u.s1.fragment_start_block == SQUASHFS_INVALID_BLK
-+                                      || index < (i_size_read(inode) >>
-+                                      sblk->block_log)) {
-+              if ((block = (msblk->read_blocklist)(inode, index, 1,
-+                                      block_list, NULL, &bsize)) == 0)
-+                      goto skip_read;
-+
-+              down(&msblk->read_page_mutex);
-+
-+              if (!(bytes = squashfs_read_data(inode->i_sb, msblk->read_page,
-+                                      block, bsize, NULL))) {
-+                      ERROR("Unable to read page, block %llx, size %x\n", block,
-+                                      bsize);
-+                      up(&msblk->read_page_mutex);
-+                      goto skip_read;
-+              }
-+      } else {
-+              if ((fragment = get_cached_fragment(inode->i_sb,
-+                                      SQUASHFS_I(inode)->
-+                                      u.s1.fragment_start_block,
-+                                      SQUASHFS_I(inode)->u.s1.fragment_size))
-+                                      == NULL) {
-+                      ERROR("Unable to read page, block %llx, size %x\n",
-+                                      SQUASHFS_I(inode)->
-+                                      u.s1.fragment_start_block,
-+                                      (int) SQUASHFS_I(inode)->
-+                                      u.s1.fragment_size);
-+                      goto skip_read;
-+              }
-+              bytes = SQUASHFS_I(inode)->u.s1.fragment_offset +
-+                                      (i_size_read(inode) & (sblk->block_size
-+                                      - 1));
-+              byte_offset = SQUASHFS_I(inode)->u.s1.fragment_offset;
-+              data_ptr = fragment->data;
-+      }
-+
-+      for (i = start_index; i <= end_index && byte_offset < bytes;
-+                                      i++, byte_offset += PAGE_CACHE_SIZE) {
-+              struct page *push_page;
-+              int available_bytes = (bytes - byte_offset) > PAGE_CACHE_SIZE ?
-+                                      PAGE_CACHE_SIZE : bytes - byte_offset;
-+
-+              TRACE("bytes %d, i %d, byte_offset %d, available_bytes %d\n",
-+                                      bytes, i, byte_offset, available_bytes);
-+
-+              if (i == page->index)  {
-+                      pageaddr = kmap_atomic(page, KM_USER0);
-+                      memcpy(pageaddr, data_ptr + byte_offset,
-+                                      available_bytes);
-+                      memset(pageaddr + available_bytes, 0,
-+                                      PAGE_CACHE_SIZE - available_bytes);
-+                      kunmap_atomic(pageaddr, KM_USER0);
-+                      flush_dcache_page(page);
-+                      SetPageUptodate(page);
-+                      unlock_page(page);
-+              } else if ((push_page =
-+                              grab_cache_page_nowait(page->mapping, i))) {
-+                      pageaddr = kmap_atomic(push_page, KM_USER0);
-+
-+                      memcpy(pageaddr, data_ptr + byte_offset,
-+                                      available_bytes);
-+                      memset(pageaddr + available_bytes, 0,
-+                                      PAGE_CACHE_SIZE - available_bytes);
-+                      kunmap_atomic(pageaddr, KM_USER0);
-+                      flush_dcache_page(push_page);
-+                      SetPageUptodate(push_page);
-+                      unlock_page(push_page);
-+                      page_cache_release(push_page);
-+              }
-+      }
-+
-+      if (SQUASHFS_I(inode)->u.s1.fragment_start_block == SQUASHFS_INVALID_BLK
-+                                      || index < (i_size_read(inode) >>
-+                                      sblk->block_log))
-+              up(&msblk->read_page_mutex);
-+      else
-+              release_cached_fragment(msblk, fragment);
-+
-+      return 0;
-+
-+skip_read:
-+      pageaddr = kmap_atomic(page, KM_USER0);
-+      memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
-+      kunmap_atomic(pageaddr, KM_USER0);
-+      flush_dcache_page(page);
-+      SetPageUptodate(page);
-+      unlock_page(page);
-+
-+      return 0;
-+}
-+
-+
-+static int squashfs_readpage4K(struct file *file, struct page *page)
-+{
-+      struct inode *inode = page->mapping->host;
-+      struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      unsigned char block_list[SIZE];
-+      long long block;
-+      unsigned int bsize, bytes = 0;
-+      void *pageaddr;
-+
-+      TRACE("Entered squashfs_readpage4K, page index %lx, start block %llx\n",
-+                                      page->index,
-+                                      SQUASHFS_I(inode)->start_block);
-+
-+      if (page->index >= ((i_size_read(inode) + PAGE_CACHE_SIZE - 1) >>
-+                                      PAGE_CACHE_SHIFT)) {
-+              pageaddr = kmap_atomic(page, KM_USER0);
-+              goto skip_read;
-+      }
-+
-+      if (SQUASHFS_I(inode)->u.s1.fragment_start_block == SQUASHFS_INVALID_BLK
-+                                      || page->index < (i_size_read(inode) >>
-+                                      sblk->block_log)) {
-+              block = (msblk->read_blocklist)(inode, page->index, 1,
-+                                      block_list, NULL, &bsize);
-+
-+              down(&msblk->read_page_mutex);
-+              bytes = squashfs_read_data(inode->i_sb, msblk->read_page, block,
-+                                      bsize, NULL);
-+              pageaddr = kmap_atomic(page, KM_USER0);
-+              if (bytes)
-+                      memcpy(pageaddr, msblk->read_page, bytes);
-+              else
-+                      ERROR("Unable to read page, block %llx, size %x\n",
-+                                      block, bsize);
-+              up(&msblk->read_page_mutex);
-+      } else {
-+              struct squashfs_fragment_cache *fragment =
-+                      get_cached_fragment(inode->i_sb,
-+                                      SQUASHFS_I(inode)->
-+                                      u.s1.fragment_start_block,
-+                                      SQUASHFS_I(inode)-> u.s1.fragment_size);
-+              pageaddr = kmap_atomic(page, KM_USER0);
-+              if (fragment) {
-+                      bytes = i_size_read(inode) & (sblk->block_size - 1);
-+                      memcpy(pageaddr, fragment->data + SQUASHFS_I(inode)->
-+                                      u.s1.fragment_offset, bytes);
-+                      release_cached_fragment(msblk, fragment);
-+              } else
-+                      ERROR("Unable to read page, block %llx, size %x\n",
-+                                      SQUASHFS_I(inode)->
-+                                      u.s1.fragment_start_block, (int)
-+                                      SQUASHFS_I(inode)-> u.s1.fragment_size);
-+      }
-+
-+skip_read:
-+      memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
-+      kunmap_atomic(pageaddr, KM_USER0);
-+      flush_dcache_page(page);
-+      SetPageUptodate(page);
-+      unlock_page(page);
-+
-+      return 0;
-+}
-+
-+
-+static int get_dir_index_using_offset(struct super_block *s, long long
-+                              *next_block, unsigned int *next_offset,
-+                              long long index_start,
-+                              unsigned int index_offset, int i_count,
-+                              long long f_pos)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      int i, length = 0;
-+      struct squashfs_dir_index index;
-+
-+      TRACE("Entered get_dir_index_using_offset, i_count %d, f_pos %d\n",
-+                                      i_count, (unsigned int) f_pos);
-+
-+      f_pos =- 3;
-+      if (f_pos == 0)
-+              goto finish;
-+
-+      for (i = 0; i < i_count; i++) {
-+              if (msblk->swap) {
-+                      struct squashfs_dir_index sindex;
-+                      squashfs_get_cached_block(s, (char *) &sindex,
-+                                      index_start, index_offset,
-+                                      sizeof(sindex), &index_start,
-+                                      &index_offset);
-+                      SQUASHFS_SWAP_DIR_INDEX(&index, &sindex);
-+              } else
-+                      squashfs_get_cached_block(s, (char *) &index,
-+                                      index_start, index_offset,
-+                                      sizeof(index), &index_start,
-+                                      &index_offset);
-+
-+              if (index.index > f_pos)
-+                      break;
-+
-+              squashfs_get_cached_block(s, NULL, index_start, index_offset,
-+                                      index.size + 1, &index_start,
-+                                      &index_offset);
-+
-+              length = index.index;
-+              *next_block = index.start_block + sblk->directory_table_start;
-+      }
-+
-+      *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE;
-+
-+finish:
-+      return length + 3;
-+}
-+
-+
-+static int get_dir_index_using_name(struct super_block *s, long long
-+                              *next_block, unsigned int *next_offset,
-+                              long long index_start,
-+                              unsigned int index_offset, int i_count,
-+                              const char *name, int size)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      int i, length = 0;
-+      char buffer[sizeof(struct squashfs_dir_index) + SQUASHFS_NAME_LEN + 1];
-+      struct squashfs_dir_index *index = (struct squashfs_dir_index *) buffer;
-+      char str[SQUASHFS_NAME_LEN + 1];
-+
-+      TRACE("Entered get_dir_index_using_name, i_count %d\n", i_count);
-+
-+      strncpy(str, name, size);
-+      str[size] = '\0';
-+
-+      for (i = 0; i < i_count; i++) {
-+              if (msblk->swap) {
-+                      struct squashfs_dir_index sindex;
-+                      squashfs_get_cached_block(s, (char *) &sindex,
-+                                      index_start, index_offset,
-+                                      sizeof(sindex), &index_start,
-+                                      &index_offset);
-+                      SQUASHFS_SWAP_DIR_INDEX(index, &sindex);
-+              } else
-+                      squashfs_get_cached_block(s, (char *) index,
-+                                      index_start, index_offset,
-+                                      sizeof(struct squashfs_dir_index),
-+                                      &index_start, &index_offset);
-+
-+              squashfs_get_cached_block(s, index->name, index_start,
-+                                      index_offset, index->size + 1,
-+                                      &index_start, &index_offset);
-+
-+              index->name[index->size + 1] = '\0';
-+
-+              if (strcmp(index->name, str) > 0)
-+                      break;
-+
-+              length = index->index;
-+              *next_block = index->start_block + sblk->directory_table_start;
-+      }
-+
-+      *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE;
-+      return length + 3;
-+}
-+
-+
-+static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir)
-+{
-+      struct inode *i = file->f_dentry->d_inode;
-+      struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      long long next_block = SQUASHFS_I(i)->start_block +
-+              sblk->directory_table_start;
-+      int next_offset = SQUASHFS_I(i)->offset, length = 0, dirs_read = 0,
-+              dir_count;
-+      struct squashfs_dir_header dirh;
-+      char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN + 1];
-+      struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer;
-+
-+      TRACE("Entered squashfs_readdir [%llx:%x]\n", next_block, next_offset);
-+
-+      while(file->f_pos < 3) {
-+              char *name;
-+              int size, i_ino;
-+
-+              if(file->f_pos == 0) {
-+                      name = ".";
-+                      size = 1;
-+                      i_ino = i->i_ino;
-+              } else {
-+                      name = "..";
-+                      size = 2;
-+                      i_ino = SQUASHFS_I(i)->u.s2.parent_inode;
-+              }
-+              TRACE("Calling filldir(%x, %s, %d, %d, %d, %d)\n",
-+                              (unsigned int) dirent, name, size, (int)
-+                              file->f_pos, i_ino,
-+                              squashfs_filetype_table[1]);
-+
-+              if (filldir(dirent, name, size,
-+                              file->f_pos, i_ino,
-+                              squashfs_filetype_table[1]) < 0) {
-+                              TRACE("Filldir returned less than 0\n");
-+                              goto finish;
-+              }
-+              file->f_pos += size;
-+              dirs_read++;
-+      }
-+
-+      length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_start,
-+                              SQUASHFS_I(i)->u.s2.directory_index_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_count,
-+                              file->f_pos);
-+
-+      while (length < i_size_read(i)) {
-+              /* read directory header */
-+              if (msblk->swap) {
-+                      struct squashfs_dir_header sdirh;
-+
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh,
-+                                      next_block, next_offset, sizeof(sdirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(sdirh);
-+                      SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh);
-+              } else {
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh,
-+                                      next_block, next_offset, sizeof(dirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(dirh);
-+              }
-+
-+              dir_count = dirh.count + 1;
-+              while (dir_count--) {
-+                      if (msblk->swap) {
-+                              struct squashfs_dir_entry sdire;
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              &sdire, next_block, next_offset,
-+                                              sizeof(sdire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(sdire);
-+                              SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire);
-+                      } else {
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              dire, next_block, next_offset,
-+                                              sizeof(*dire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(*dire);
-+                      }
-+
-+                      if (!squashfs_get_cached_block(i->i_sb, dire->name,
-+                                              next_block, next_offset,
-+                                              dire->size + 1, &next_block,
-+                                              &next_offset))
-+                              goto failed_read;
-+
-+                      length += dire->size + 1;
-+
-+                      if (file->f_pos >= length)
-+                              continue;
-+
-+                      dire->name[dire->size + 1] = '\0';
-+
-+                      TRACE("Calling filldir(%x, %s, %d, %d, %x:%x, %d, %d)\n",
-+                                      (unsigned int) dirent, dire->name,
-+                                      dire->size + 1, (int) file->f_pos,
-+                                      dirh.start_block, dire->offset,
-+                                      dirh.inode_number + dire->inode_number,
-+                                      squashfs_filetype_table[dire->type]);
-+
-+                      if (filldir(dirent, dire->name, dire->size + 1,
-+                                      file->f_pos,
-+                                      dirh.inode_number + dire->inode_number,
-+                                      squashfs_filetype_table[dire->type])
-+                                      < 0) {
-+                              TRACE("Filldir returned less than 0\n");
-+                              goto finish;
-+                      }
-+                      file->f_pos = length;
-+                      dirs_read++;
-+              }
-+      }
-+
-+finish:
-+      return dirs_read;
-+
-+failed_read:
-+      ERROR("Unable to read directory block [%llx:%x]\n", next_block,
-+              next_offset);
-+      return 0;
-+}
-+
-+
-+static struct dentry *squashfs_lookup(struct inode *i, struct dentry *dentry,
-+                              struct nameidata *nd)
-+{
-+      const unsigned char *name = dentry->d_name.name;
-+      int len = dentry->d_name.len;
-+      struct inode *inode = NULL;
-+      struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      long long next_block = SQUASHFS_I(i)->start_block +
-+                              sblk->directory_table_start;
-+      int next_offset = SQUASHFS_I(i)->offset, length = 0,
-+                              dir_count;
-+      struct squashfs_dir_header dirh;
-+      char buffer[sizeof(struct squashfs_dir_entry) + SQUASHFS_NAME_LEN];
-+      struct squashfs_dir_entry *dire = (struct squashfs_dir_entry *) buffer;
-+
-+      TRACE("Entered squashfs_lookup [%llx:%x]\n", next_block, next_offset);
-+
-+      if (len > SQUASHFS_NAME_LEN)
-+              goto exit_loop;
-+
-+      length = get_dir_index_using_name(i->i_sb, &next_block, &next_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_start,
-+                              SQUASHFS_I(i)->u.s2.directory_index_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_count, name,
-+                              len);
-+
-+      while (length < i_size_read(i)) {
-+              /* read directory header */
-+              if (msblk->swap) {
-+                      struct squashfs_dir_header sdirh;
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh,
-+                                      next_block, next_offset, sizeof(sdirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(sdirh);
-+                      SQUASHFS_SWAP_DIR_HEADER(&dirh, &sdirh);
-+              } else {
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh,
-+                                      next_block, next_offset, sizeof(dirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(dirh);
-+              }
-+
-+              dir_count = dirh.count + 1;
-+              while (dir_count--) {
-+                      if (msblk->swap) {
-+                              struct squashfs_dir_entry sdire;
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              &sdire, next_block,next_offset,
-+                                              sizeof(sdire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(sdire);
-+                              SQUASHFS_SWAP_DIR_ENTRY(dire, &sdire);
-+                      } else {
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              dire, next_block,next_offset,
-+                                              sizeof(*dire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(*dire);
-+                      }
-+
-+                      if (!squashfs_get_cached_block(i->i_sb, dire->name,
-+                                      next_block, next_offset, dire->size + 1,
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += dire->size + 1;
-+
-+                      if (name[0] < dire->name[0])
-+                              goto exit_loop;
-+
-+                      if ((len == dire->size + 1) && !strncmp(name,
-+                                              dire->name, len)) {
-+                              squashfs_inode_t ino =
-+                                      SQUASHFS_MKINODE(dirh.start_block,
-+                                      dire->offset);
-+
-+                              TRACE("calling squashfs_iget for directory "
-+                                      "entry %s, inode %x:%x, %d\n", name,
-+                                      dirh.start_block, dire->offset,
-+                                      dirh.inode_number + dire->inode_number);
-+
-+                              inode = (msblk->iget)(i->i_sb, ino);
-+
-+                              goto exit_loop;
-+                      }
-+              }
-+      }
-+
-+exit_loop:
-+      d_add(dentry, inode);
-+      return ERR_PTR(0);
-+
-+failed_read:
-+      ERROR("Unable to read directory block [%llx:%x]\n", next_block,
-+              next_offset);
-+      goto exit_loop;
-+}
-+
-+
-+static void squashfs_put_super(struct super_block *s)
-+{
-+      int i;
-+
-+      if (s->s_fs_info) {
-+              struct squashfs_sb_info *sbi = s->s_fs_info;
-+              if (sbi->block_cache)
-+                      for (i = 0; i < SQUASHFS_CACHED_BLKS; i++)
-+                              if (sbi->block_cache[i].block !=
-+                                                      SQUASHFS_INVALID_BLK)
-+                                      kfree(sbi->block_cache[i].data);
-+              if (sbi->fragment)
-+                      for (i = 0; i < SQUASHFS_CACHED_FRAGMENTS; i++)
-+                              SQUASHFS_FREE(sbi->fragment[i].data);
-+              kfree(sbi->fragment);
-+              kfree(sbi->block_cache);
-+              kfree(sbi->read_data);
-+              kfree(sbi->read_page);
-+              kfree(sbi->uid);
-+              kfree(sbi->fragment_index);
-+              kfree(sbi->fragment_index_2);
-+              kfree(sbi->meta_index);
-+              kfree(s->s_fs_info);
-+              s->s_fs_info = NULL;
-+      }
-+}
-+
-+
-+static int squashfs_get_sb(struct file_system_type *fs_type,
-+                      int flags, const char *dev_name, void *data,
-+                      struct vfsmount *mnt)
-+{
-+      return get_sb_bdev(fs_type, flags, dev_name, data, squashfs_fill_super, mnt);
-+}
-+
-+
-+static int __init init_squashfs_fs(void)
-+{
-+      int err = init_inodecache();
-+      if (err)
-+              goto out;
-+
-+      printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
-+              "Phillip Lougher\n");
-+
-+      if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) {
-+              ERROR("Failed to allocate zlib workspace\n");
-+              destroy_inodecache();
-+              err = -ENOMEM;
-+              goto out;
-+      }
-+
-+      if ((err = register_filesystem(&squashfs_fs_type))) {
-+              vfree(stream.workspace);
-+              destroy_inodecache();
-+      }
-+
-+out:
-+      return err;
-+}
-+
-+
-+static void __exit exit_squashfs_fs(void)
-+{
-+      vfree(stream.workspace);
-+      unregister_filesystem(&squashfs_fs_type);
-+      destroy_inodecache();
-+}
-+
-+
-+static struct kmem_cache * squashfs_inode_cachep;
-+
-+
-+static struct inode *squashfs_alloc_inode(struct super_block *sb)
-+{
-+      struct squashfs_inode_info *ei;
-+      ei = kmem_cache_alloc(squashfs_inode_cachep, GFP_KERNEL);
-+      if (!ei)
-+              return NULL;
-+      return &ei->vfs_inode;
-+}
-+
-+
-+static void squashfs_destroy_inode(struct inode *inode)
-+{
-+      kmem_cache_free(squashfs_inode_cachep, SQUASHFS_I(inode));
-+}
-+
-+
-+static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
-+{
-+      struct squashfs_inode_info *ei = foo;
-+
-+      inode_init_once(&ei->vfs_inode);
-+}
-+
-+
-+static int __init init_inodecache(void)
-+{
-+      squashfs_inode_cachep = kmem_cache_create("squashfs_inode_cache",
-+           sizeof(struct squashfs_inode_info),
-+           0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
-+           init_once, NULL);
-+      if (squashfs_inode_cachep == NULL)
-+              return -ENOMEM;
-+      return 0;
-+}
-+
-+
-+static void destroy_inodecache(void)
-+{
-+      kmem_cache_destroy(squashfs_inode_cachep);
-+}
-+
-+
-+module_init(init_squashfs_fs);
-+module_exit(exit_squashfs_fs);
-+MODULE_DESCRIPTION("squashfs, a compressed read-only filesystem");
-+MODULE_AUTHOR("Phillip Lougher <phillip@lougher.org.uk>");
-+MODULE_LICENSE("GPL");
---- /dev/null
-+++ b/fs/squashfs/Makefile
-@@ -0,0 +1,7 @@
-+#
-+# Makefile for the linux squashfs routines.
-+#
-+
-+obj-$(CONFIG_SQUASHFS) += squashfs.o
-+squashfs-y += inode.o
-+squashfs-y += squashfs2_0.o
---- /dev/null
-+++ b/fs/squashfs/squashfs2_0.c
-@@ -0,0 +1,758 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
-+ * Phillip Lougher <phillip@lougher.org.uk>
-+ *
-+ * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * squashfs2_0.c
-+ */
-+
-+#include <linux/types.h>
-+#include <linux/squashfs_fs.h>
-+#include <linux/module.h>
-+#include <linux/errno.h>
-+#include <linux/slab.h>
-+#include <linux/fs.h>
-+#include <linux/smp_lock.h>
-+#include <linux/slab.h>
-+#include <linux/squashfs_fs_sb.h>
-+#include <linux/squashfs_fs_i.h>
-+#include <linux/buffer_head.h>
-+#include <linux/vfs.h>
-+#include <linux/init.h>
-+#include <linux/dcache.h>
-+#include <linux/wait.h>
-+#include <linux/zlib.h>
-+#include <linux/blkdev.h>
-+#include <linux/vmalloc.h>
-+#include <asm/uaccess.h>
-+#include <asm/semaphore.h>
-+
-+#include "squashfs.h"
-+static int squashfs_readdir_2(struct file *file, void *dirent, filldir_t filldir);
-+static struct dentry *squashfs_lookup_2(struct inode *, struct dentry *,
-+                              struct nameidata *);
-+
-+static struct file_operations squashfs_dir_ops_2 = {
-+      .read = generic_read_dir,
-+      .readdir = squashfs_readdir_2
-+};
-+
-+static struct inode_operations squashfs_dir_inode_ops_2 = {
-+      .lookup = squashfs_lookup_2
-+};
-+
-+static unsigned char squashfs_filetype_table[] = {
-+      DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK
-+};
-+
-+static int read_fragment_index_table_2(struct super_block *s)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+
-+      if (!(msblk->fragment_index_2 = kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES_2
-+                                      (sblk->fragments), GFP_KERNEL))) {
-+              ERROR("Failed to allocate uid/gid table\n");
-+              return 0;
-+      }
-+
-+      if (SQUASHFS_FRAGMENT_INDEX_BYTES_2(sblk->fragments) &&
-+                                      !squashfs_read_data(s, (char *)
-+                                      msblk->fragment_index_2,
-+                                      sblk->fragment_table_start,
-+                                      SQUASHFS_FRAGMENT_INDEX_BYTES_2
-+                                      (sblk->fragments) |
-+                                      SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+              ERROR("unable to read fragment index table\n");
-+              return 0;
-+      }
-+
-+      if (msblk->swap) {
-+              int i;
-+              unsigned int fragment;
-+
-+              for (i = 0; i < SQUASHFS_FRAGMENT_INDEXES_2(sblk->fragments);
-+                                                                      i++) {
-+                      SQUASHFS_SWAP_FRAGMENT_INDEXES_2((&fragment),
-+                                              &msblk->fragment_index_2[i], 1);
-+                      msblk->fragment_index_2[i] = fragment;
-+              }
-+      }
-+
-+      return 1;
-+}
-+
-+
-+static int get_fragment_location_2(struct super_block *s, unsigned int fragment,
-+                              long long *fragment_start_block,
-+                              unsigned int *fragment_size)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      long long start_block =
-+              msblk->fragment_index_2[SQUASHFS_FRAGMENT_INDEX_2(fragment)];
-+      int offset = SQUASHFS_FRAGMENT_INDEX_OFFSET_2(fragment);
-+      struct squashfs_fragment_entry_2 fragment_entry;
-+
-+      if (msblk->swap) {
-+              struct squashfs_fragment_entry_2 sfragment_entry;
-+
-+              if (!squashfs_get_cached_block(s, (char *) &sfragment_entry,
-+                                      start_block, offset,
-+                                      sizeof(sfragment_entry), &start_block,
-+                                      &offset))
-+                      goto out;
-+              SQUASHFS_SWAP_FRAGMENT_ENTRY_2(&fragment_entry, &sfragment_entry);
-+      } else
-+              if (!squashfs_get_cached_block(s, (char *) &fragment_entry,
-+                                      start_block, offset,
-+                                      sizeof(fragment_entry), &start_block,
-+                                      &offset))
-+                      goto out;
-+
-+      *fragment_start_block = fragment_entry.start_block;
-+      *fragment_size = fragment_entry.size;
-+
-+      return 1;
-+
-+out:
-+      return 0;
-+}
-+
-+
-+static struct inode *squashfs_new_inode(struct super_block *s,
-+              struct squashfs_base_inode_header_2 *inodeb, unsigned int ino)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      struct inode *i = new_inode(s);
-+
-+      if (i) {
-+              i->i_ino = ino;
-+              i->i_mtime.tv_sec = sblk->mkfs_time;
-+              i->i_atime.tv_sec = sblk->mkfs_time;
-+              i->i_ctime.tv_sec = sblk->mkfs_time;
-+              i->i_uid = msblk->uid[inodeb->uid];
-+              i->i_mode = inodeb->mode;
-+              i->i_nlink = 1;
-+              i->i_size = 0;
-+              if (inodeb->guid == SQUASHFS_GUIDS)
-+                      i->i_gid = i->i_uid;
-+              else
-+                      i->i_gid = msblk->guid[inodeb->guid];
-+      }
-+
-+      return i;
-+}
-+
-+
-+static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t inode)
-+{
-+      struct inode *i;
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      unsigned int block = SQUASHFS_INODE_BLK(inode) +
-+              sblk->inode_table_start;
-+      unsigned int offset = SQUASHFS_INODE_OFFSET(inode);
-+      unsigned int ino = SQUASHFS_MK_VFS_INODE(block
-+              - sblk->inode_table_start, offset);
-+      long long next_block;
-+      unsigned int next_offset;
-+      union squashfs_inode_header_2 id, sid;
-+      struct squashfs_base_inode_header_2 *inodeb = &id.base,
-+                                        *sinodeb = &sid.base;
-+
-+      TRACE("Entered squashfs_iget\n");
-+
-+      if (msblk->swap) {
-+              if (!squashfs_get_cached_block(s, (char *) sinodeb, block,
-+                                      offset, sizeof(*sinodeb), &next_block,
-+                                      &next_offset))
-+                      goto failed_read;
-+              SQUASHFS_SWAP_BASE_INODE_HEADER_2(inodeb, sinodeb,
-+                                      sizeof(*sinodeb));
-+      } else
-+              if (!squashfs_get_cached_block(s, (char *) inodeb, block,
-+                                      offset, sizeof(*inodeb), &next_block,
-+                                      &next_offset))
-+                      goto failed_read;
-+
-+      switch(inodeb->inode_type) {
-+              case SQUASHFS_FILE_TYPE: {
-+                      struct squashfs_reg_inode_header_2 *inodep = &id.reg;
-+                      struct squashfs_reg_inode_header_2 *sinodep = &sid.reg;
-+                      long long frag_blk;
-+                      unsigned int frag_size;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_REG_INODE_HEADER_2(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      frag_blk = SQUASHFS_INVALID_BLK;
-+                      if (inodep->fragment != SQUASHFS_INVALID_FRAG &&
-+                                      !get_fragment_location_2(s,
-+                                      inodep->fragment, &frag_blk, &frag_size))
-+                              goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_size = inodep->file_size;
-+                      i->i_fop = &generic_ro_fops;
-+                      i->i_mode |= S_IFREG;
-+                      i->i_mtime.tv_sec = inodep->mtime;
-+                      i->i_atime.tv_sec = inodep->mtime;
-+                      i->i_ctime.tv_sec = inodep->mtime;
-+                      i->i_blocks = ((i->i_size - 1) >> 9) + 1;
-+                      i->i_blksize = PAGE_CACHE_SIZE;
-+                      SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk;
-+                      SQUASHFS_I(i)->u.s1.fragment_size = frag_size;
-+                      SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->u.s1.block_list_start = next_block;
-+                      SQUASHFS_I(i)->offset = next_offset;
-+                      if (sblk->block_size > 4096)
-+                              i->i_data.a_ops = &squashfs_aops;
-+                      else
-+                              i->i_data.a_ops = &squashfs_aops_4K;
-+
-+                      TRACE("File inode %x:%x, start_block %x, "
-+                                      "block_list_start %llx, offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->start_block, next_block,
-+                                      next_offset);
-+                      break;
-+              }
-+              case SQUASHFS_DIR_TYPE: {
-+                      struct squashfs_dir_inode_header_2 *inodep = &id.dir;
-+                      struct squashfs_dir_inode_header_2 *sinodep = &sid.dir;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_DIR_INODE_HEADER_2(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_size = inodep->file_size;
-+                      i->i_op = &squashfs_dir_inode_ops_2;
-+                      i->i_fop = &squashfs_dir_ops_2;
-+                      i->i_mode |= S_IFDIR;
-+                      i->i_mtime.tv_sec = inodep->mtime;
-+                      i->i_atime.tv_sec = inodep->mtime;
-+                      i->i_ctime.tv_sec = inodep->mtime;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->offset = inodep->offset;
-+                      SQUASHFS_I(i)->u.s2.directory_index_count = 0;
-+                      SQUASHFS_I(i)->u.s2.parent_inode = 0;
-+
-+                      TRACE("Directory inode %x:%x, start_block %x, offset "
-+                                      "%x\n", SQUASHFS_INODE_BLK(inode),
-+                                      offset, inodep->start_block,
-+                                      inodep->offset);
-+                      break;
-+              }
-+              case SQUASHFS_LDIR_TYPE: {
-+                      struct squashfs_ldir_inode_header_2 *inodep = &id.ldir;
-+                      struct squashfs_ldir_inode_header_2 *sinodep = &sid.ldir;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_LDIR_INODE_HEADER_2(inodep,
-+                                              sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_size = inodep->file_size;
-+                      i->i_op = &squashfs_dir_inode_ops_2;
-+                      i->i_fop = &squashfs_dir_ops_2;
-+                      i->i_mode |= S_IFDIR;
-+                      i->i_mtime.tv_sec = inodep->mtime;
-+                      i->i_atime.tv_sec = inodep->mtime;
-+                      i->i_ctime.tv_sec = inodep->mtime;
-+                      SQUASHFS_I(i)->start_block = inodep->start_block;
-+                      SQUASHFS_I(i)->offset = inodep->offset;
-+                      SQUASHFS_I(i)->u.s2.directory_index_start = next_block;
-+                      SQUASHFS_I(i)->u.s2.directory_index_offset =
-+                                                              next_offset;
-+                      SQUASHFS_I(i)->u.s2.directory_index_count =
-+                                                              inodep->i_count;
-+                      SQUASHFS_I(i)->u.s2.parent_inode = 0;
-+
-+                      TRACE("Long directory inode %x:%x, start_block %x, "
-+                                      "offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->start_block, inodep->offset);
-+                      break;
-+              }
-+              case SQUASHFS_SYMLINK_TYPE: {
-+                      struct squashfs_symlink_inode_header_2 *inodep =
-+                                                              &id.symlink;
-+                      struct squashfs_symlink_inode_header_2 *sinodep =
-+                                                              &sid.symlink;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(inodep,
-+                                                              sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_size = inodep->symlink_size;
-+                      i->i_op = &page_symlink_inode_operations;
-+                      i->i_data.a_ops = &squashfs_symlink_aops;
-+                      i->i_mode |= S_IFLNK;
-+                      SQUASHFS_I(i)->start_block = next_block;
-+                      SQUASHFS_I(i)->offset = next_offset;
-+
-+                      TRACE("Symbolic link inode %x:%x, start_block %llx, "
-+                                      "offset %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      next_block, next_offset);
-+                      break;
-+               }
-+               case SQUASHFS_BLKDEV_TYPE:
-+               case SQUASHFS_CHRDEV_TYPE: {
-+                      struct squashfs_dev_inode_header_2 *inodep = &id.dev;
-+                      struct squashfs_dev_inode_header_2 *sinodep = &sid.dev;
-+
-+                      if (msblk->swap) {
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              sinodep, block, offset,
-+                                              sizeof(*sinodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+                              SQUASHFS_SWAP_DEV_INODE_HEADER_2(inodep, sinodep);
-+                      } else
-+                              if (!squashfs_get_cached_block(s, (char *)
-+                                              inodep, block, offset,
-+                                              sizeof(*inodep), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                      if ((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_mode |= (inodeb->inode_type ==
-+                                      SQUASHFS_CHRDEV_TYPE) ?  S_IFCHR :
-+                                      S_IFBLK;
-+                      init_special_inode(i, i->i_mode,
-+                                      old_decode_dev(inodep->rdev));
-+
-+                      TRACE("Device inode %x:%x, rdev %x\n",
-+                                      SQUASHFS_INODE_BLK(inode), offset,
-+                                      inodep->rdev);
-+                      break;
-+               }
-+               case SQUASHFS_FIFO_TYPE:
-+               case SQUASHFS_SOCKET_TYPE: {
-+                      if ((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-+                              goto failed_read1;
-+
-+                      i->i_mode |= (inodeb->inode_type == SQUASHFS_FIFO_TYPE)
-+                                                      ? S_IFIFO : S_IFSOCK;
-+                      init_special_inode(i, i->i_mode, 0);
-+                      break;
-+               }
-+               default:
-+                      ERROR("Unknown inode type %d in squashfs_iget!\n",
-+                                      inodeb->inode_type);
-+                      goto failed_read1;
-+      }
-+
-+      insert_inode_hash(i);
-+      return i;
-+
-+failed_read:
-+      ERROR("Unable to read inode [%x:%x]\n", block, offset);
-+
-+failed_read1:
-+      return NULL;
-+}
-+
-+
-+static int get_dir_index_using_offset(struct super_block *s, long long
-+                              *next_block, unsigned int *next_offset,
-+                              long long index_start,
-+                              unsigned int index_offset, int i_count,
-+                              long long f_pos)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      int i, length = 0;
-+      struct squashfs_dir_index_2 index;
-+
-+      TRACE("Entered get_dir_index_using_offset, i_count %d, f_pos %d\n",
-+                                      i_count, (unsigned int) f_pos);
-+
-+      if (f_pos == 0)
-+              goto finish;
-+
-+      for (i = 0; i < i_count; i++) {
-+              if (msblk->swap) {
-+                      struct squashfs_dir_index_2 sindex;
-+                      squashfs_get_cached_block(s, (char *) &sindex,
-+                                      index_start, index_offset,
-+                                      sizeof(sindex), &index_start,
-+                                      &index_offset);
-+                      SQUASHFS_SWAP_DIR_INDEX_2(&index, &sindex);
-+              } else
-+                      squashfs_get_cached_block(s, (char *) &index,
-+                                      index_start, index_offset,
-+                                      sizeof(index), &index_start,
-+                                      &index_offset);
-+
-+              if (index.index > f_pos)
-+                      break;
-+
-+              squashfs_get_cached_block(s, NULL, index_start, index_offset,
-+                                      index.size + 1, &index_start,
-+                                      &index_offset);
-+
-+              length = index.index;
-+              *next_block = index.start_block + sblk->directory_table_start;
-+      }
-+
-+      *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE;
-+
-+finish:
-+      return length;
-+}
-+
-+
-+static int get_dir_index_using_name(struct super_block *s, long long
-+                              *next_block, unsigned int *next_offset,
-+                              long long index_start,
-+                              unsigned int index_offset, int i_count,
-+                              const char *name, int size)
-+{
-+      struct squashfs_sb_info *msblk = s->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      int i, length = 0;
-+      char buffer[sizeof(struct squashfs_dir_index_2) + SQUASHFS_NAME_LEN + 1];
-+      struct squashfs_dir_index_2 *index = (struct squashfs_dir_index_2 *) buffer;
-+      char str[SQUASHFS_NAME_LEN + 1];
-+
-+      TRACE("Entered get_dir_index_using_name, i_count %d\n", i_count);
-+
-+      strncpy(str, name, size);
-+      str[size] = '\0';
-+
-+      for (i = 0; i < i_count; i++) {
-+              if (msblk->swap) {
-+                      struct squashfs_dir_index_2 sindex;
-+                      squashfs_get_cached_block(s, (char *) &sindex,
-+                                      index_start, index_offset,
-+                                      sizeof(sindex), &index_start,
-+                                      &index_offset);
-+                      SQUASHFS_SWAP_DIR_INDEX_2(index, &sindex);
-+              } else
-+                      squashfs_get_cached_block(s, (char *) index,
-+                                      index_start, index_offset,
-+                                      sizeof(struct squashfs_dir_index_2),
-+                                      &index_start, &index_offset);
-+
-+              squashfs_get_cached_block(s, index->name, index_start,
-+                                      index_offset, index->size + 1,
-+                                      &index_start, &index_offset);
-+
-+              index->name[index->size + 1] = '\0';
-+
-+              if (strcmp(index->name, str) > 0)
-+                      break;
-+
-+              length = index->index;
-+              *next_block = index->start_block + sblk->directory_table_start;
-+      }
-+
-+      *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE;
-+      return length;
-+}
-+
-+
-+static int squashfs_readdir_2(struct file *file, void *dirent, filldir_t filldir)
-+{
-+      struct inode *i = file->f_dentry->d_inode;
-+      struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      long long next_block = SQUASHFS_I(i)->start_block +
-+              sblk->directory_table_start;
-+      int next_offset = SQUASHFS_I(i)->offset, length = 0, dirs_read = 0,
-+              dir_count;
-+      struct squashfs_dir_header_2 dirh;
-+      char buffer[sizeof(struct squashfs_dir_entry_2) + SQUASHFS_NAME_LEN + 1];
-+      struct squashfs_dir_entry_2 *dire = (struct squashfs_dir_entry_2 *) buffer;
-+
-+      TRACE("Entered squashfs_readdir_2 [%llx:%x]\n", next_block, next_offset);
-+
-+      length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_start,
-+                              SQUASHFS_I(i)->u.s2.directory_index_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_count,
-+                              file->f_pos);
-+
-+      while (length < i_size_read(i)) {
-+              /* read directory header */
-+              if (msblk->swap) {
-+                      struct squashfs_dir_header_2 sdirh;
-+
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh,
-+                                      next_block, next_offset, sizeof(sdirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(sdirh);
-+                      SQUASHFS_SWAP_DIR_HEADER_2(&dirh, &sdirh);
-+              } else {
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh,
-+                                      next_block, next_offset, sizeof(dirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(dirh);
-+              }
-+
-+              dir_count = dirh.count + 1;
-+              while (dir_count--) {
-+                      if (msblk->swap) {
-+                              struct squashfs_dir_entry_2 sdire;
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              &sdire, next_block, next_offset,
-+                                              sizeof(sdire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(sdire);
-+                              SQUASHFS_SWAP_DIR_ENTRY_2(dire, &sdire);
-+                      } else {
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              dire, next_block, next_offset,
-+                                              sizeof(*dire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(*dire);
-+                      }
-+
-+                      if (!squashfs_get_cached_block(i->i_sb, dire->name,
-+                                              next_block, next_offset,
-+                                              dire->size + 1, &next_block,
-+                                              &next_offset))
-+                              goto failed_read;
-+
-+                      length += dire->size + 1;
-+
-+                      if (file->f_pos >= length)
-+                              continue;
-+
-+                      dire->name[dire->size + 1] = '\0';
-+
-+                      TRACE("Calling filldir(%x, %s, %d, %d, %x:%x, %d)\n",
-+                                      (unsigned int) dirent, dire->name,
-+                                      dire->size + 1, (int) file->f_pos,
-+                                      dirh.start_block, dire->offset,
-+                                      squashfs_filetype_table[dire->type]);
-+
-+                      if (filldir(dirent, dire->name, dire->size + 1,
-+                                      file->f_pos, SQUASHFS_MK_VFS_INODE(
-+                                      dirh.start_block, dire->offset),
-+                                      squashfs_filetype_table[dire->type])
-+                                      < 0) {
-+                              TRACE("Filldir returned less than 0\n");
-+                              goto finish;
-+                      }
-+                      file->f_pos = length;
-+                      dirs_read++;
-+              }
-+      }
-+
-+finish:
-+      return dirs_read;
-+
-+failed_read:
-+      ERROR("Unable to read directory block [%llx:%x]\n", next_block,
-+              next_offset);
-+      return 0;
-+}
-+
-+
-+static struct dentry *squashfs_lookup_2(struct inode *i, struct dentry *dentry,
-+                              struct nameidata *nd)
-+{
-+      const unsigned char *name = dentry->d_name.name;
-+      int len = dentry->d_name.len;
-+      struct inode *inode = NULL;
-+      struct squashfs_sb_info *msblk = i->i_sb->s_fs_info;
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+      long long next_block = SQUASHFS_I(i)->start_block +
-+                              sblk->directory_table_start;
-+      int next_offset = SQUASHFS_I(i)->offset, length = 0,
-+                              dir_count;
-+      struct squashfs_dir_header_2 dirh;
-+      char buffer[sizeof(struct squashfs_dir_entry_2) + SQUASHFS_NAME_LEN];
-+      struct squashfs_dir_entry_2 *dire = (struct squashfs_dir_entry_2 *) buffer;
-+      int sorted = sblk->s_major == 2 && sblk->s_minor >= 1;
-+
-+      TRACE("Entered squashfs_lookup [%llx:%x]\n", next_block, next_offset);
-+
-+      if (len > SQUASHFS_NAME_LEN)
-+              goto exit_loop;
-+
-+      length = get_dir_index_using_name(i->i_sb, &next_block, &next_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_start,
-+                              SQUASHFS_I(i)->u.s2.directory_index_offset,
-+                              SQUASHFS_I(i)->u.s2.directory_index_count, name,
-+                              len);
-+
-+      while (length < i_size_read(i)) {
-+              /* read directory header */
-+              if (msblk->swap) {
-+                      struct squashfs_dir_header_2 sdirh;
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &sdirh,
-+                                      next_block, next_offset, sizeof(sdirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(sdirh);
-+                      SQUASHFS_SWAP_DIR_HEADER_2(&dirh, &sdirh);
-+              } else {
-+                      if (!squashfs_get_cached_block(i->i_sb, (char *) &dirh,
-+                                      next_block, next_offset, sizeof(dirh),
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += sizeof(dirh);
-+              }
-+
-+              dir_count = dirh.count + 1;
-+              while (dir_count--) {
-+                      if (msblk->swap) {
-+                              struct squashfs_dir_entry_2 sdire;
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              &sdire, next_block,next_offset,
-+                                              sizeof(sdire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(sdire);
-+                              SQUASHFS_SWAP_DIR_ENTRY_2(dire, &sdire);
-+                      } else {
-+                              if (!squashfs_get_cached_block(i->i_sb, (char *)
-+                                              dire, next_block,next_offset,
-+                                              sizeof(*dire), &next_block,
-+                                              &next_offset))
-+                                      goto failed_read;
-+
-+                              length += sizeof(*dire);
-+                      }
-+
-+                      if (!squashfs_get_cached_block(i->i_sb, dire->name,
-+                                      next_block, next_offset, dire->size + 1,
-+                                      &next_block, &next_offset))
-+                              goto failed_read;
-+
-+                      length += dire->size + 1;
-+
-+                      if (sorted && name[0] < dire->name[0])
-+                              goto exit_loop;
-+
-+                      if ((len == dire->size + 1) && !strncmp(name,
-+                                              dire->name, len)) {
-+                              squashfs_inode_t ino =
-+                                      SQUASHFS_MKINODE(dirh.start_block,
-+                                      dire->offset);
-+
-+                              TRACE("calling squashfs_iget for directory "
-+                                      "entry %s, inode %x:%x, %lld\n", name,
-+                                      dirh.start_block, dire->offset, ino);
-+
-+                              inode = (msblk->iget)(i->i_sb, ino);
-+
-+                              goto exit_loop;
-+                      }
-+              }
-+      }
-+
-+exit_loop:
-+      d_add(dentry, inode);
-+      return ERR_PTR(0);
-+
-+failed_read:
-+      ERROR("Unable to read directory block [%llx:%x]\n", next_block,
-+              next_offset);
-+      goto exit_loop;
-+}
-+
-+
-+int squashfs_2_0_supported(struct squashfs_sb_info *msblk)
-+{
-+      struct squashfs_super_block *sblk = &msblk->sblk;
-+
-+      msblk->iget = squashfs_iget_2;
-+      msblk->read_fragment_index_table = read_fragment_index_table_2;
-+
-+      sblk->bytes_used = sblk->bytes_used_2;
-+      sblk->uid_start = sblk->uid_start_2;
-+      sblk->guid_start = sblk->guid_start_2;
-+      sblk->inode_table_start = sblk->inode_table_start_2;
-+      sblk->directory_table_start = sblk->directory_table_start_2;
-+      sblk->fragment_table_start = sblk->fragment_table_start_2;
-+
-+      return 1;
-+}
---- /dev/null
-+++ b/fs/squashfs/squashfs.h
-@@ -0,0 +1,86 @@
-+/*
-+ * Squashfs - a compressed read only filesystem for Linux
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
-+ * Phillip Lougher <phillip@lougher.org.uk>
-+ *
-+ * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * squashfs.h
-+ */
-+
-+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+#undef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+#endif
-+
-+#ifdef SQUASHFS_TRACE
-+#define TRACE(s, args...)     printk(KERN_NOTICE "SQUASHFS: "s, ## args)
-+#else
-+#define TRACE(s, args...)     {}
-+#endif
-+
-+#define ERROR(s, args...)     printk(KERN_ERR "SQUASHFS error: "s, ## args)
-+
-+#define SERROR(s, args...)    do { \
-+                              if (!silent) \
-+                              printk(KERN_ERR "SQUASHFS error: "s, ## args);\
-+                              } while(0)
-+
-+#define WARNING(s, args...)   printk(KERN_WARNING "SQUASHFS: "s, ## args)
-+
-+static inline struct squashfs_inode_info *SQUASHFS_I(struct inode *inode)
-+{
-+      return list_entry(inode, struct squashfs_inode_info, vfs_inode);
-+}
-+
-+#if defined(CONFIG_SQUASHFS_1_0_COMPATIBILITY ) || defined(CONFIG_SQUASHFS_2_0_COMPATIBILITY)
-+#define SQSH_EXTERN
-+extern unsigned int squashfs_read_data(struct super_block *s, char *buffer,
-+                              long long index, unsigned int length,
-+                              long long *next_index);
-+extern int squashfs_get_cached_block(struct super_block *s, char *buffer,
-+                              long long block, unsigned int offset,
-+                              int length, long long *next_block,
-+                              unsigned int *next_offset);
-+extern void release_cached_fragment(struct squashfs_sb_info *msblk, struct
-+                                      squashfs_fragment_cache *fragment);
-+extern struct squashfs_fragment_cache *get_cached_fragment(struct super_block
-+                                      *s, long long start_block,
-+                                      int length);
-+extern struct address_space_operations squashfs_symlink_aops;
-+extern struct address_space_operations squashfs_aops;
-+extern struct address_space_operations squashfs_aops_4K;
-+extern struct inode_operations squashfs_dir_inode_ops;
-+#else
-+#define SQSH_EXTERN static
-+#endif
-+
-+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+extern int squashfs_1_0_supported(struct squashfs_sb_info *msblk);
-+#else
-+static inline int squashfs_1_0_supported(struct squashfs_sb_info *msblk)
-+{
-+      return 0;
-+}
-+#endif
-+
-+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+extern int squashfs_2_0_supported(struct squashfs_sb_info *msblk);
-+#else
-+static inline int squashfs_2_0_supported(struct squashfs_sb_info *msblk)
-+{
-+      return 0;
-+}
-+#endif
---- a/include/linux/magic.h
-+++ b/include/linux/magic.h
-@@ -36,6 +36,9 @@
- #define REISER2FS_SUPER_MAGIC_STRING  "ReIsEr2Fs"
- #define REISER2FS_JR_SUPER_MAGIC_STRING       "ReIsEr3Fs"
-+#define SQUASHFS_MAGIC                        0x73717368
-+#define SQUASHFS_MAGIC_SWAP           0x68737173
-+
- #define SMB_SUPER_MAGIC               0x517B
- #define USBDEVICE_SUPER_MAGIC 0x9fa2
---- /dev/null
-+++ b/include/linux/squashfs_fs.h
-@@ -0,0 +1,911 @@
-+#ifndef SQUASHFS_FS
-+#define SQUASHFS_FS
-+
-+/*
-+ * Squashfs
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
-+ * Phillip Lougher <phillip@lougher.org.uk>
-+ *
-+ * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * squashfs_fs.h
-+ */
-+
-+#ifndef CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+#define CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+#endif
-+
-+#ifdef        CONFIG_SQUASHFS_VMALLOC
-+#define SQUASHFS_ALLOC(a)             vmalloc(a)
-+#define SQUASHFS_FREE(a)              vfree(a)
-+#else
-+#define SQUASHFS_ALLOC(a)             kmalloc(a, GFP_KERNEL)
-+#define SQUASHFS_FREE(a)              kfree(a)
-+#endif
-+#define SQUASHFS_CACHED_FRAGMENTS     CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE
-+#define SQUASHFS_MAJOR                        3
-+#define SQUASHFS_MINOR                        0
-+#define SQUASHFS_START                        0
-+
-+/* size of metadata (inode and directory) blocks */
-+#define SQUASHFS_METADATA_SIZE                8192
-+#define SQUASHFS_METADATA_LOG         13
-+
-+/* default size of data blocks */
-+#define SQUASHFS_FILE_SIZE            65536
-+#define SQUASHFS_FILE_LOG             16
-+
-+#define SQUASHFS_FILE_MAX_SIZE                65536
-+
-+/* Max number of uids and gids */
-+#define SQUASHFS_UIDS                 256
-+#define SQUASHFS_GUIDS                        255
-+
-+/* Max length of filename (not 255) */
-+#define SQUASHFS_NAME_LEN             256
-+
-+#define SQUASHFS_INVALID              ((long long) 0xffffffffffff)
-+#define SQUASHFS_INVALID_FRAG         ((unsigned int) 0xffffffff)
-+#define SQUASHFS_INVALID_BLK          ((long long) -1)
-+#define SQUASHFS_USED_BLK             ((long long) -2)
-+
-+/* Filesystem flags */
-+#define SQUASHFS_NOI                  0
-+#define SQUASHFS_NOD                  1
-+#define SQUASHFS_CHECK                        2
-+#define SQUASHFS_NOF                  3
-+#define SQUASHFS_NO_FRAG              4
-+#define SQUASHFS_ALWAYS_FRAG          5
-+#define SQUASHFS_DUPLICATE            6
-+
-+#define SQUASHFS_BIT(flag, bit)               ((flag >> bit) & 1)
-+
-+#define SQUASHFS_UNCOMPRESSED_INODES(flags)   SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_NOI)
-+
-+#define SQUASHFS_UNCOMPRESSED_DATA(flags)     SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_NOD)
-+
-+#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags)        SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_NOF)
-+
-+#define SQUASHFS_NO_FRAGMENTS(flags)          SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_NO_FRAG)
-+
-+#define SQUASHFS_ALWAYS_FRAGMENTS(flags)      SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_ALWAYS_FRAG)
-+
-+#define SQUASHFS_DUPLICATES(flags)            SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_DUPLICATE)
-+
-+#define SQUASHFS_CHECK_DATA(flags)            SQUASHFS_BIT(flags, \
-+                                              SQUASHFS_CHECK)
-+
-+#define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, \
-+              duplicate_checking)     (noi | (nod << 1) | (check_data << 2) \
-+              | (nof << 3) | (no_frag << 4) | (always_frag << 5) | \
-+              (duplicate_checking << 6))
-+
-+/* Max number of types and file types */
-+#define SQUASHFS_DIR_TYPE             1
-+#define SQUASHFS_FILE_TYPE            2
-+#define SQUASHFS_SYMLINK_TYPE         3
-+#define SQUASHFS_BLKDEV_TYPE          4
-+#define SQUASHFS_CHRDEV_TYPE          5
-+#define SQUASHFS_FIFO_TYPE            6
-+#define SQUASHFS_SOCKET_TYPE          7
-+#define SQUASHFS_LDIR_TYPE            8
-+#define SQUASHFS_LREG_TYPE            9
-+
-+/* 1.0 filesystem type definitions */
-+#define SQUASHFS_TYPES                        5
-+#define SQUASHFS_IPC_TYPE             0
-+
-+/* Flag whether block is compressed or uncompressed, bit is set if block is
-+ * uncompressed */
-+#define SQUASHFS_COMPRESSED_BIT               (1 << 15)
-+
-+#define SQUASHFS_COMPRESSED_SIZE(B)   (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \
-+              (B) & ~SQUASHFS_COMPRESSED_BIT :  SQUASHFS_COMPRESSED_BIT)
-+
-+#define SQUASHFS_COMPRESSED(B)                (!((B) & SQUASHFS_COMPRESSED_BIT))
-+
-+#define SQUASHFS_COMPRESSED_BIT_BLOCK         (1 << 24)
-+
-+#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B)     (((B) & \
-+      ~SQUASHFS_COMPRESSED_BIT_BLOCK) ? (B) & \
-+      ~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK)
-+
-+#define SQUASHFS_COMPRESSED_BLOCK(B)  (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK))
-+
-+/*
-+ * Inode number ops.  Inodes consist of a compressed block number, and an
-+ * uncompressed  offset within that block
-+ */
-+#define SQUASHFS_INODE_BLK(a)         ((unsigned int) ((a) >> 16))
-+
-+#define SQUASHFS_INODE_OFFSET(a)      ((unsigned int) ((a) & 0xffff))
-+
-+#define SQUASHFS_MKINODE(A, B)                ((squashfs_inode_t)(((squashfs_inode_t) (A)\
-+                                      << 16) + (B)))
-+
-+/* Compute 32 bit VFS inode number from squashfs inode number */
-+#define SQUASHFS_MK_VFS_INODE(a, b)   ((unsigned int) (((a) << 8) + \
-+                                      ((b) >> 2) + 1))
-+/* XXX */
-+
-+/* Translate between VFS mode and squashfs mode */
-+#define SQUASHFS_MODE(a)              ((a) & 0xfff)
-+
-+/* fragment and fragment table defines */
-+#define SQUASHFS_FRAGMENT_BYTES(A)    (A * sizeof(struct squashfs_fragment_entry))
-+
-+#define SQUASHFS_FRAGMENT_INDEX(A)    (SQUASHFS_FRAGMENT_BYTES(A) / \
-+                                      SQUASHFS_METADATA_SIZE)
-+
-+#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A)     (SQUASHFS_FRAGMENT_BYTES(A) % \
-+                                              SQUASHFS_METADATA_SIZE)
-+
-+#define SQUASHFS_FRAGMENT_INDEXES(A)  ((SQUASHFS_FRAGMENT_BYTES(A) + \
-+                                      SQUASHFS_METADATA_SIZE - 1) / \
-+                                      SQUASHFS_METADATA_SIZE)
-+
-+#define SQUASHFS_FRAGMENT_INDEX_BYTES(A)      (SQUASHFS_FRAGMENT_INDEXES(A) *\
-+                                              sizeof(long long))
-+
-+/* cached data constants for filesystem */
-+#define SQUASHFS_CACHED_BLKS          8
-+
-+#define SQUASHFS_MAX_FILE_SIZE_LOG    64
-+
-+#define SQUASHFS_MAX_FILE_SIZE                ((long long) 1 << \
-+                                      (SQUASHFS_MAX_FILE_SIZE_LOG - 2))
-+
-+#define SQUASHFS_MARKER_BYTE          0xff
-+
-+/* meta index cache */
-+#define SQUASHFS_META_INDEXES (SQUASHFS_METADATA_SIZE / sizeof(unsigned int))
-+#define SQUASHFS_META_ENTRIES 31
-+#define SQUASHFS_META_NUMBER  8
-+#define SQUASHFS_SLOTS                4
-+
-+#include <linux/magic.h>
-+
-+struct meta_entry {
-+      long long               data_block;
-+      unsigned int            index_block;
-+      unsigned short          offset;
-+      unsigned short          pad;
-+};
-+
-+struct meta_index {
-+      unsigned int            inode_number;
-+      unsigned int            offset;
-+      unsigned short          entries;
-+      unsigned short          skip;
-+      unsigned short          locked;
-+      unsigned short          pad;
-+      struct meta_entry       meta_entry[SQUASHFS_META_ENTRIES];
-+};
-+
-+
-+/*
-+ * definitions for structures on disk
-+ */
-+
-+typedef long long             squashfs_block_t;
-+typedef long long             squashfs_inode_t;
-+
-+struct squashfs_super_block {
-+      unsigned int            s_magic;
-+      unsigned int            inodes;
-+      unsigned int            bytes_used_2;
-+      unsigned int            uid_start_2;
-+      unsigned int            guid_start_2;
-+      unsigned int            inode_table_start_2;
-+      unsigned int            directory_table_start_2;
-+      unsigned int            s_major:16;
-+      unsigned int            s_minor:16;
-+      unsigned int            block_size_1:16;
-+      unsigned int            block_log:16;
-+      unsigned int            flags:8;
-+      unsigned int            no_uids:8;
-+      unsigned int            no_guids:8;
-+      unsigned int            mkfs_time /* time of filesystem creation */;
-+      squashfs_inode_t        root_inode;
-+      unsigned int            block_size;
-+      unsigned int            fragments;
-+      unsigned int            fragment_table_start_2;
-+      long long               bytes_used;
-+      long long               uid_start;
-+      long long               guid_start;
-+      long long               inode_table_start;
-+      long long               directory_table_start;
-+      long long               fragment_table_start;
-+      long long               unused;
-+} __attribute__ ((packed));
-+
-+struct squashfs_dir_index {
-+      unsigned int            index;
-+      unsigned int            start_block;
-+      unsigned char           size;
-+      unsigned char           name[0];
-+} __attribute__ ((packed));
-+
-+#define SQUASHFS_BASE_INODE_HEADER            \
-+      unsigned int            inode_type:4;   \
-+      unsigned int            mode:12;        \
-+      unsigned int            uid:8;          \
-+      unsigned int            guid:8;         \
-+      unsigned int            mtime;          \
-+      unsigned int            inode_number;
-+
-+struct squashfs_base_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+} __attribute__ ((packed));
-+
-+struct squashfs_ipc_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      unsigned int            nlink;
-+} __attribute__ ((packed));
-+
-+struct squashfs_dev_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      unsigned int            nlink;
-+      unsigned short          rdev;
-+} __attribute__ ((packed));
-+
-+struct squashfs_symlink_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      unsigned int            nlink;
-+      unsigned short          symlink_size;
-+      char                    symlink[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_reg_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      squashfs_block_t        start_block;
-+      unsigned int            fragment;
-+      unsigned int            offset;
-+      unsigned int            file_size;
-+      unsigned short          block_list[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_lreg_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      unsigned int            nlink;
-+      squashfs_block_t        start_block;
-+      unsigned int            fragment;
-+      unsigned int            offset;
-+      long long               file_size;
-+      unsigned short          block_list[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_dir_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      unsigned int            nlink;
-+      unsigned int            file_size:19;
-+      unsigned int            offset:13;
-+      unsigned int            start_block;
-+      unsigned int            parent_inode;
-+} __attribute__  ((packed));
-+
-+struct squashfs_ldir_inode_header {
-+      SQUASHFS_BASE_INODE_HEADER;
-+      unsigned int            nlink;
-+      unsigned int            file_size:27;
-+      unsigned int            offset:13;
-+      unsigned int            start_block;
-+      unsigned int            i_count:16;
-+      unsigned int            parent_inode;
-+      struct squashfs_dir_index       index[0];
-+} __attribute__  ((packed));
-+
-+union squashfs_inode_header {
-+      struct squashfs_base_inode_header       base;
-+      struct squashfs_dev_inode_header        dev;
-+      struct squashfs_symlink_inode_header    symlink;
-+      struct squashfs_reg_inode_header        reg;
-+      struct squashfs_lreg_inode_header       lreg;
-+      struct squashfs_dir_inode_header        dir;
-+      struct squashfs_ldir_inode_header       ldir;
-+      struct squashfs_ipc_inode_header        ipc;
-+};
-+
-+struct squashfs_dir_entry {
-+      unsigned int            offset:13;
-+      unsigned int            type:3;
-+      unsigned int            size:8;
-+      int                     inode_number:16;
-+      char                    name[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_dir_header {
-+      unsigned int            count:8;
-+      unsigned int            start_block;
-+      unsigned int            inode_number;
-+} __attribute__ ((packed));
-+
-+struct squashfs_fragment_entry {
-+      long long               start_block;
-+      unsigned int            size;
-+      unsigned int            unused;
-+} __attribute__ ((packed));
-+
-+extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen);
-+extern int squashfs_uncompress_init(void);
-+extern int squashfs_uncompress_exit(void);
-+
-+/*
-+ * macros to convert each packed bitfield structure from little endian to big
-+ * endian and vice versa.  These are needed when creating or using a filesystem
-+ * on a machine with different byte ordering to the target architecture.
-+ *
-+ */
-+
-+#define SQUASHFS_SWAP_START \
-+      int bits;\
-+      int b_pos;\
-+      unsigned long long val;\
-+      unsigned char *s;\
-+      unsigned char *d;
-+
-+#define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_super_block));\
-+      SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\
-+      SQUASHFS_SWAP((s)->inodes, d, 32, 32);\
-+      SQUASHFS_SWAP((s)->bytes_used_2, d, 64, 32);\
-+      SQUASHFS_SWAP((s)->uid_start_2, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->guid_start_2, d, 128, 32);\
-+      SQUASHFS_SWAP((s)->inode_table_start_2, d, 160, 32);\
-+      SQUASHFS_SWAP((s)->directory_table_start_2, d, 192, 32);\
-+      SQUASHFS_SWAP((s)->s_major, d, 224, 16);\
-+      SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\
-+      SQUASHFS_SWAP((s)->block_size_1, d, 256, 16);\
-+      SQUASHFS_SWAP((s)->block_log, d, 272, 16);\
-+      SQUASHFS_SWAP((s)->flags, d, 288, 8);\
-+      SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\
-+      SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\
-+      SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\
-+      SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\
-+      SQUASHFS_SWAP((s)->block_size, d, 408, 32);\
-+      SQUASHFS_SWAP((s)->fragments, d, 440, 32);\
-+      SQUASHFS_SWAP((s)->fragment_table_start_2, d, 472, 32);\
-+      SQUASHFS_SWAP((s)->bytes_used, d, 504, 64);\
-+      SQUASHFS_SWAP((s)->uid_start, d, 568, 64);\
-+      SQUASHFS_SWAP((s)->guid_start, d, 632, 64);\
-+      SQUASHFS_SWAP((s)->inode_table_start, d, 696, 64);\
-+      SQUASHFS_SWAP((s)->directory_table_start, d, 760, 64);\
-+      SQUASHFS_SWAP((s)->fragment_table_start, d, 824, 64);\
-+      SQUASHFS_SWAP((s)->unused, d, 888, 64);\
-+}
-+
-+#define SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\
-+      SQUASHFS_MEMSET(s, d, n);\
-+      SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
-+      SQUASHFS_SWAP((s)->mode, d, 4, 12);\
-+      SQUASHFS_SWAP((s)->uid, d, 16, 8);\
-+      SQUASHFS_SWAP((s)->guid, d, 24, 8);\
-+      SQUASHFS_SWAP((s)->mtime, d, 32, 32);\
-+      SQUASHFS_SWAP((s)->inode_number, d, 64, 32);
-+
-+#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\
-+}
-+
-+#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_ipc_inode_header))\
-+      SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_dev_inode_header)); \
-+      SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->rdev, d, 128, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_symlink_inode_header));\
-+      SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->symlink_size, d, 128, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_reg_inode_header));\
-+      SQUASHFS_SWAP((s)->start_block, d, 96, 64);\
-+      SQUASHFS_SWAP((s)->fragment, d, 160, 32);\
-+      SQUASHFS_SWAP((s)->offset, d, 192, 32);\
-+      SQUASHFS_SWAP((s)->file_size, d, 224, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_LREG_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_lreg_inode_header));\
-+      SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 128, 64);\
-+      SQUASHFS_SWAP((s)->fragment, d, 192, 32);\
-+      SQUASHFS_SWAP((s)->offset, d, 224, 32);\
-+      SQUASHFS_SWAP((s)->file_size, d, 256, 64);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_dir_inode_header));\
-+      SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->file_size, d, 128, 19);\
-+      SQUASHFS_SWAP((s)->offset, d, 147, 13);\
-+      SQUASHFS_SWAP((s)->start_block, d, 160, 32);\
-+      SQUASHFS_SWAP((s)->parent_inode, d, 192, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_LDIR_INODE_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \
-+                      sizeof(struct squashfs_ldir_inode_header));\
-+      SQUASHFS_SWAP((s)->nlink, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->file_size, d, 128, 27);\
-+      SQUASHFS_SWAP((s)->offset, d, 155, 13);\
-+      SQUASHFS_SWAP((s)->start_block, d, 168, 32);\
-+      SQUASHFS_SWAP((s)->i_count, d, 200, 16);\
-+      SQUASHFS_SWAP((s)->parent_inode, d, 216, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_INDEX(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index));\
-+      SQUASHFS_SWAP((s)->index, d, 0, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 32, 32);\
-+      SQUASHFS_SWAP((s)->size, d, 64, 8);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_HEADER(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header));\
-+      SQUASHFS_SWAP((s)->count, d, 0, 8);\
-+      SQUASHFS_SWAP((s)->start_block, d, 8, 32);\
-+      SQUASHFS_SWAP((s)->inode_number, d, 40, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry));\
-+      SQUASHFS_SWAP((s)->offset, d, 0, 13);\
-+      SQUASHFS_SWAP((s)->type, d, 13, 3);\
-+      SQUASHFS_SWAP((s)->size, d, 16, 8);\
-+      SQUASHFS_SWAP((s)->inode_number, d, 24, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_FRAGMENT_ENTRY(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry));\
-+      SQUASHFS_SWAP((s)->start_block, d, 0, 64);\
-+      SQUASHFS_SWAP((s)->size, d, 64, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_SHORTS(s, d, n) {\
-+      int entry;\
-+      int bit_position;\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, n * 2);\
-+      for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
-+                      16)\
-+              SQUASHFS_SWAP(s[entry], d, bit_position, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_INTS(s, d, n) {\
-+      int entry;\
-+      int bit_position;\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, n * 4);\
-+      for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
-+                      32)\
-+              SQUASHFS_SWAP(s[entry], d, bit_position, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) {\
-+      int entry;\
-+      int bit_position;\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, n * 8);\
-+      for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
-+                      64)\
-+              SQUASHFS_SWAP(s[entry], d, bit_position, 64);\
-+}
-+
-+#define SQUASHFS_SWAP_DATA(s, d, n, bits) {\
-+      int entry;\
-+      int bit_position;\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, n * bits / 8);\
-+      for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \
-+                      bits)\
-+              SQUASHFS_SWAP(s[entry], d, bit_position, bits);\
-+}
-+
-+#define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n)
-+
-+#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
-+
-+struct squashfs_base_inode_header_1 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:4; /* index into uid table */
-+      unsigned int            guid:4; /* index into guid table */
-+} __attribute__ ((packed));
-+
-+struct squashfs_ipc_inode_header_1 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:4; /* index into uid table */
-+      unsigned int            guid:4; /* index into guid table */
-+      unsigned int            type:4;
-+      unsigned int            offset:4;
-+} __attribute__ ((packed));
-+
-+struct squashfs_dev_inode_header_1 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:4; /* index into uid table */
-+      unsigned int            guid:4; /* index into guid table */
-+      unsigned short          rdev;
-+} __attribute__ ((packed));
-+
-+struct squashfs_symlink_inode_header_1 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:4; /* index into uid table */
-+      unsigned int            guid:4; /* index into guid table */
-+      unsigned short          symlink_size;
-+      char                    symlink[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_reg_inode_header_1 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:4; /* index into uid table */
-+      unsigned int            guid:4; /* index into guid table */
-+      unsigned int            mtime;
-+      unsigned int            start_block;
-+      unsigned int            file_size:32;
-+      unsigned short          block_list[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_dir_inode_header_1 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:4; /* index into uid table */
-+      unsigned int            guid:4; /* index into guid table */
-+      unsigned int            file_size:19;
-+      unsigned int            offset:13;
-+      unsigned int            mtime;
-+      unsigned int            start_block:24;
-+} __attribute__  ((packed));
-+
-+#define SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n) \
-+      SQUASHFS_MEMSET(s, d, n);\
-+      SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
-+      SQUASHFS_SWAP((s)->mode, d, 4, 12);\
-+      SQUASHFS_SWAP((s)->uid, d, 16, 4);\
-+      SQUASHFS_SWAP((s)->guid, d, 20, 4);
-+
-+#define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n)\
-+}
-+
-+#define SQUASHFS_SWAP_IPC_INODE_HEADER_1(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
-+                      sizeof(struct squashfs_ipc_inode_header_1));\
-+      SQUASHFS_SWAP((s)->type, d, 24, 4);\
-+      SQUASHFS_SWAP((s)->offset, d, 28, 4);\
-+}
-+
-+#define SQUASHFS_SWAP_DEV_INODE_HEADER_1(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
-+                      sizeof(struct squashfs_dev_inode_header_1));\
-+      SQUASHFS_SWAP((s)->rdev, d, 24, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
-+                      sizeof(struct squashfs_symlink_inode_header_1));\
-+      SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
-+                      sizeof(struct squashfs_reg_inode_header_1));\
-+      SQUASHFS_SWAP((s)->mtime, d, 24, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 56, 32);\
-+      SQUASHFS_SWAP((s)->file_size, d, 88, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \
-+                      sizeof(struct squashfs_dir_inode_header_1));\
-+      SQUASHFS_SWAP((s)->file_size, d, 24, 19);\
-+      SQUASHFS_SWAP((s)->offset, d, 43, 13);\
-+      SQUASHFS_SWAP((s)->mtime, d, 56, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 88, 24);\
-+}
-+
-+#endif
-+
-+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+
-+struct squashfs_dir_index_2 {
-+      unsigned int            index:27;
-+      unsigned int            start_block:29;
-+      unsigned char           size;
-+      unsigned char           name[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_base_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+} __attribute__ ((packed));
-+
-+struct squashfs_ipc_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+} __attribute__ ((packed));
-+
-+struct squashfs_dev_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+      unsigned short          rdev;
-+} __attribute__ ((packed));
-+
-+struct squashfs_symlink_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+      unsigned short          symlink_size;
-+      char                    symlink[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_reg_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+      unsigned int            mtime;
-+      unsigned int            start_block;
-+      unsigned int            fragment;
-+      unsigned int            offset;
-+      unsigned int            file_size:32;
-+      unsigned short          block_list[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_dir_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+      unsigned int            file_size:19;
-+      unsigned int            offset:13;
-+      unsigned int            mtime;
-+      unsigned int            start_block:24;
-+} __attribute__  ((packed));
-+
-+struct squashfs_ldir_inode_header_2 {
-+      unsigned int            inode_type:4;
-+      unsigned int            mode:12; /* protection */
-+      unsigned int            uid:8; /* index into uid table */
-+      unsigned int            guid:8; /* index into guid table */
-+      unsigned int            file_size:27;
-+      unsigned int            offset:13;
-+      unsigned int            mtime;
-+      unsigned int            start_block:24;
-+      unsigned int            i_count:16;
-+      struct squashfs_dir_index_2     index[0];
-+} __attribute__  ((packed));
-+
-+union squashfs_inode_header_2 {
-+      struct squashfs_base_inode_header_2     base;
-+      struct squashfs_dev_inode_header_2      dev;
-+      struct squashfs_symlink_inode_header_2  symlink;
-+      struct squashfs_reg_inode_header_2      reg;
-+      struct squashfs_dir_inode_header_2      dir;
-+      struct squashfs_ldir_inode_header_2     ldir;
-+      struct squashfs_ipc_inode_header_2      ipc;
-+};
-+
-+struct squashfs_dir_header_2 {
-+      unsigned int            count:8;
-+      unsigned int            start_block:24;
-+} __attribute__ ((packed));
-+
-+struct squashfs_dir_entry_2 {
-+      unsigned int            offset:13;
-+      unsigned int            type:3;
-+      unsigned int            size:8;
-+      char                    name[0];
-+} __attribute__ ((packed));
-+
-+struct squashfs_fragment_entry_2 {
-+      unsigned int            start_block;
-+      unsigned int            size;
-+} __attribute__ ((packed));
-+
-+#define SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\
-+      SQUASHFS_MEMSET(s, d, n);\
-+      SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\
-+      SQUASHFS_SWAP((s)->mode, d, 4, 12);\
-+      SQUASHFS_SWAP((s)->uid, d, 16, 8);\
-+      SQUASHFS_SWAP((s)->guid, d, 24, 8);\
-+
-+#define SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, n) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\
-+}
-+
-+#define SQUASHFS_SWAP_IPC_INODE_HEADER_2(s, d) \
-+      SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, sizeof(struct squashfs_ipc_inode_header_2))
-+
-+#define SQUASHFS_SWAP_DEV_INODE_HEADER_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
-+                      sizeof(struct squashfs_dev_inode_header_2)); \
-+      SQUASHFS_SWAP((s)->rdev, d, 32, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
-+                      sizeof(struct squashfs_symlink_inode_header_2));\
-+      SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_REG_INODE_HEADER_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
-+                      sizeof(struct squashfs_reg_inode_header_2));\
-+      SQUASHFS_SWAP((s)->mtime, d, 32, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 64, 32);\
-+      SQUASHFS_SWAP((s)->fragment, d, 96, 32);\
-+      SQUASHFS_SWAP((s)->offset, d, 128, 32);\
-+      SQUASHFS_SWAP((s)->file_size, d, 160, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_INODE_HEADER_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
-+                      sizeof(struct squashfs_dir_inode_header_2));\
-+      SQUASHFS_SWAP((s)->file_size, d, 32, 19);\
-+      SQUASHFS_SWAP((s)->offset, d, 51, 13);\
-+      SQUASHFS_SWAP((s)->mtime, d, 64, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 96, 24);\
-+}
-+
-+#define SQUASHFS_SWAP_LDIR_INODE_HEADER_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \
-+                      sizeof(struct squashfs_ldir_inode_header_2));\
-+      SQUASHFS_SWAP((s)->file_size, d, 32, 27);\
-+      SQUASHFS_SWAP((s)->offset, d, 59, 13);\
-+      SQUASHFS_SWAP((s)->mtime, d, 72, 32);\
-+      SQUASHFS_SWAP((s)->start_block, d, 104, 24);\
-+      SQUASHFS_SWAP((s)->i_count, d, 128, 16);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_INDEX_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index_2));\
-+      SQUASHFS_SWAP((s)->index, d, 0, 27);\
-+      SQUASHFS_SWAP((s)->start_block, d, 27, 29);\
-+      SQUASHFS_SWAP((s)->size, d, 56, 8);\
-+}
-+#define SQUASHFS_SWAP_DIR_HEADER_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header_2));\
-+      SQUASHFS_SWAP((s)->count, d, 0, 8);\
-+      SQUASHFS_SWAP((s)->start_block, d, 8, 24);\
-+}
-+
-+#define SQUASHFS_SWAP_DIR_ENTRY_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry_2));\
-+      SQUASHFS_SWAP((s)->offset, d, 0, 13);\
-+      SQUASHFS_SWAP((s)->type, d, 13, 3);\
-+      SQUASHFS_SWAP((s)->size, d, 16, 8);\
-+}
-+
-+#define SQUASHFS_SWAP_FRAGMENT_ENTRY_2(s, d) {\
-+      SQUASHFS_SWAP_START\
-+      SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry_2));\
-+      SQUASHFS_SWAP((s)->start_block, d, 0, 32);\
-+      SQUASHFS_SWAP((s)->size, d, 32, 32);\
-+}
-+
-+#define SQUASHFS_SWAP_FRAGMENT_INDEXES_2(s, d, n) SQUASHFS_SWAP_INTS(s, d, n)
-+
-+/* fragment and fragment table defines */
-+#define SQUASHFS_FRAGMENT_BYTES_2(A)  (A * sizeof(struct squashfs_fragment_entry_2))
-+
-+#define SQUASHFS_FRAGMENT_INDEX_2(A)  (SQUASHFS_FRAGMENT_BYTES_2(A) / \
-+                                      SQUASHFS_METADATA_SIZE)
-+
-+#define SQUASHFS_FRAGMENT_INDEX_OFFSET_2(A)   (SQUASHFS_FRAGMENT_BYTES_2(A) % \
-+                                              SQUASHFS_METADATA_SIZE)
-+
-+#define SQUASHFS_FRAGMENT_INDEXES_2(A)        ((SQUASHFS_FRAGMENT_BYTES_2(A) + \
-+                                      SQUASHFS_METADATA_SIZE - 1) / \
-+                                      SQUASHFS_METADATA_SIZE)
-+
-+#define SQUASHFS_FRAGMENT_INDEX_BYTES_2(A)    (SQUASHFS_FRAGMENT_INDEXES_2(A) *\
-+                                              sizeof(int))
-+
-+#endif
-+
-+#ifdef __KERNEL__
-+
-+/*
-+ * macros used to swap each structure entry, taking into account
-+ * bitfields and different bitfield placing conventions on differing
-+ * architectures
-+ */
-+
-+#include <asm/byteorder.h>
-+
-+#ifdef __BIG_ENDIAN
-+      /* convert from little endian to big endian */
-+#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \
-+              tbits, b_pos)
-+#else
-+      /* convert from big endian to little endian */
-+#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \
-+              tbits, 64 - tbits - b_pos)
-+#endif
-+
-+#define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\
-+      b_pos = pos % 8;\
-+      val = 0;\
-+      s = (unsigned char *)p + (pos / 8);\
-+      d = ((unsigned char *) &val) + 7;\
-+      for(bits = 0; bits < (tbits + b_pos); bits += 8) \
-+              *d-- = *s++;\
-+      value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\
-+}
-+
-+#define SQUASHFS_MEMSET(s, d, n)      memset(s, 0, n);
-+
-+#endif
-+#endif
---- /dev/null
-+++ b/include/linux/squashfs_fs_i.h
-@@ -0,0 +1,45 @@
-+#ifndef SQUASHFS_FS_I
-+#define SQUASHFS_FS_I
-+/*
-+ * Squashfs
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
-+ * Phillip Lougher <phillip@lougher.org.uk>
-+ *
-+ * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * squashfs_fs_i.h
-+ */
-+
-+struct squashfs_inode_info {
-+      long long       start_block;
-+      unsigned int    offset;
-+      union {
-+              struct {
-+                      long long       fragment_start_block;
-+                      unsigned int    fragment_size;
-+                      unsigned int    fragment_offset;
-+                      long long       block_list_start;
-+              } s1;
-+              struct {
-+                      long long       directory_index_start;
-+                      unsigned int    directory_index_offset;
-+                      unsigned int    directory_index_count;
-+                      unsigned int    parent_inode;
-+              } s2;
-+      } u;
-+      struct inode    vfs_inode;
-+};
-+#endif
---- /dev/null
-+++ b/include/linux/squashfs_fs_sb.h
-@@ -0,0 +1,74 @@
-+#ifndef SQUASHFS_FS_SB
-+#define SQUASHFS_FS_SB
-+/*
-+ * Squashfs
-+ *
-+ * Copyright (c) 2002, 2003, 2004, 2005, 2006
-+ * Phillip Lougher <phillip@lougher.org.uk>
-+ *
-+ * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+ *
-+ * squashfs_fs_sb.h
-+ */
-+
-+#include <linux/squashfs_fs.h>
-+
-+struct squashfs_cache {
-+      long long       block;
-+      int             length;
-+      long long       next_index;
-+      char            *data;
-+};
-+
-+struct squashfs_fragment_cache {
-+      long long       block;
-+      int             length;
-+      unsigned int    locked;
-+      char            *data;
-+};
-+
-+struct squashfs_sb_info {
-+      struct squashfs_super_block     sblk;
-+      int                     devblksize;
-+      int                     devblksize_log2;
-+      int                     swap;
-+      struct squashfs_cache   *block_cache;
-+      struct squashfs_fragment_cache  *fragment;
-+      int                     next_cache;
-+      int                     next_fragment;
-+      int                     next_meta_index;
-+      unsigned int            *uid;
-+      unsigned int            *guid;
-+      long long               *fragment_index;
-+      unsigned int            *fragment_index_2;
-+      unsigned int            read_size;
-+      char                    *read_data;
-+      char                    *read_page;
-+      struct semaphore        read_data_mutex;
-+      struct semaphore        read_page_mutex;
-+      struct semaphore        block_cache_mutex;
-+      struct semaphore        fragment_mutex;
-+      struct semaphore        meta_index_mutex;
-+      wait_queue_head_t       waitq;
-+      wait_queue_head_t       fragment_wait_queue;
-+      struct meta_index       *meta_index;
-+      struct inode            *(*iget)(struct super_block *s,  squashfs_inode_t \
-+                              inode);
-+      long long               (*read_blocklist)(struct inode *inode, int \
-+                              index, int readahead_blks, char *block_list, \
-+                              unsigned short **block_p, unsigned int *bsize);
-+      int                     (*read_fragment_index_table)(struct super_block *s);
-+};
-+#endif
---- a/init/do_mounts_rd.c
-+++ b/init/do_mounts_rd.c
-@@ -5,6 +5,7 @@
- #include <linux/ext2_fs.h>
- #include <linux/romfs_fs.h>
- #include <linux/cramfs_fs.h>
-+#include <linux/squashfs_fs.h>
- #include <linux/initrd.h>
- #include <linux/string.h>
-@@ -39,6 +40,7 @@
-  * numbers could not be found.
-  *
-  * We currently check for the following magic numbers:
-+ *      squashfs
-  *    minix
-  *    ext2
-  *    romfs
-@@ -53,6 +55,7 @@
-       struct ext2_super_block *ext2sb;
-       struct romfs_super_block *romfsb;
-       struct cramfs_super *cramfsb;
-+      struct squashfs_super_block *squashfsb;
-       int nblocks = -1;
-       unsigned char *buf;
-@@ -64,6 +67,7 @@
-       ext2sb = (struct ext2_super_block *) buf;
-       romfsb = (struct romfs_super_block *) buf;
-       cramfsb = (struct cramfs_super *) buf;
-+      squashfsb = (struct squashfs_super_block *) buf;
-       memset(buf, 0xe5, size);
-       /*
-@@ -101,6 +105,15 @@
-               goto done;
-       }
-+      /* squashfs is at block zero too */
-+      if (squashfsb->s_magic == SQUASHFS_MAGIC) {
-+              printk(KERN_NOTICE
-+                     "RAMDISK: squashfs filesystem found at block %d\n",
-+                     start_block);
-+              nblocks = (squashfsb->bytes_used+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;
-+              goto done;
-+      }
-+
-       /*
-        * Read block 1 to test for minix and ext2 superblock
-        */
diff --git a/target/linux/generic-2.6/patches-2.6.22/002-lzma_decompress.patch b/target/linux/generic-2.6/patches-2.6.22/002-lzma_decompress.patch
deleted file mode 100644 (file)
index f2f31f9..0000000
+++ /dev/null
@@ -1,788 +0,0 @@
---- /dev/null
-+++ b/include/linux/LzmaDecode.h
-@@ -0,0 +1,100 @@
-+/*
-+  LzmaDecode.h
-+  LZMA Decoder interface
-+
-+  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-+  http://www.7-zip.org/
-+
-+  LZMA SDK is licensed under two licenses:
-+  1) GNU Lesser General Public License (GNU LGPL)
-+  2) Common Public License (CPL)
-+  It means that you can select one of these two licenses and
-+  follow rules of that license.
-+
-+  SPECIAL EXCEPTION:
-+  Igor Pavlov, as the author of this code, expressly permits you to
-+  statically or dynamically link your code (or bind by name) to the
-+  interfaces of this file without subjecting your linked code to the
-+  terms of the CPL or GNU LGPL. Any modifications or additions
-+  to this file, however, are subject to the LGPL or CPL terms.
-+*/
-+
-+#ifndef __LZMADECODE_H
-+#define __LZMADECODE_H
-+
-+/* #define _LZMA_IN_CB */
-+/* Use callback for input data */
-+
-+/* #define _LZMA_OUT_READ */
-+/* Use read function for output data */
-+
-+/* #define _LZMA_PROB32 */
-+/* It can increase speed on some 32-bit CPUs,
-+   but memory usage will be doubled in that case */
-+
-+/* #define _LZMA_LOC_OPT */
-+/* Enable local speed optimizations inside code */
-+
-+#ifndef UInt32
-+#ifdef _LZMA_UINT32_IS_ULONG
-+#define UInt32 unsigned long
-+#else
-+#define UInt32 unsigned int
-+#endif
-+#endif
-+
-+#ifdef _LZMA_PROB32
-+#define CProb UInt32
-+#else
-+#define CProb unsigned short
-+#endif
-+
-+#define LZMA_RESULT_OK 0
-+#define LZMA_RESULT_DATA_ERROR 1
-+#define LZMA_RESULT_NOT_ENOUGH_MEM 2
-+
-+#ifdef _LZMA_IN_CB
-+typedef struct _ILzmaInCallback
-+{
-+  int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
-+} ILzmaInCallback;
-+#endif
-+
-+#define LZMA_BASE_SIZE 1846
-+#define LZMA_LIT_SIZE 768
-+
-+/*
-+bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
-+bufferSize += 100 in case of _LZMA_OUT_READ
-+by default CProb is unsigned short,
-+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
-+*/
-+
-+#ifdef _LZMA_OUT_READ
-+int LzmaDecoderInit(
-+    unsigned char *buffer, UInt32 bufferSize,
-+    int lc, int lp, int pb,
-+    unsigned char *dictionary, UInt32 dictionarySize,
-+  #ifdef _LZMA_IN_CB
-+    ILzmaInCallback *inCallback
-+  #else
-+    unsigned char *inStream, UInt32 inSize
-+  #endif
-+);
-+#endif
-+
-+int LzmaDecode(
-+    unsigned char *buffer,
-+  #ifndef _LZMA_OUT_READ
-+    UInt32 bufferSize,
-+    int lc, int lp, int pb,
-+  #ifdef _LZMA_IN_CB
-+    ILzmaInCallback *inCallback,
-+  #else
-+    unsigned char *inStream, UInt32 inSize,
-+  #endif
-+  #endif
-+    unsigned char *outStream, UInt32 outSize,
-+    UInt32 *outSizeProcessed);
-+
-+#endif
---- /dev/null
-+++ b/lib/LzmaDecode.c
-@@ -0,0 +1,663 @@
-+/*
-+  LzmaDecode.c
-+  LZMA Decoder
-+
-+  LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
-+  http://www.7-zip.org/
-+
-+  LZMA SDK is licensed under two licenses:
-+  1) GNU Lesser General Public License (GNU LGPL)
-+  2) Common Public License (CPL)
-+  It means that you can select one of these two licenses and
-+  follow rules of that license.
-+
-+  SPECIAL EXCEPTION:
-+  Igor Pavlov, as the author of this code, expressly permits you to
-+  statically or dynamically link your code (or bind by name) to the
-+  interfaces of this file without subjecting your linked code to the
-+  terms of the CPL or GNU LGPL. Any modifications or additions
-+  to this file, however, are subject to the LGPL or CPL terms.
-+*/
-+
-+#include <linux/LzmaDecode.h>
-+
-+#ifndef Byte
-+#define Byte unsigned char
-+#endif
-+
-+#define kNumTopBits 24
-+#define kTopValue ((UInt32)1 << kNumTopBits)
-+
-+#define kNumBitModelTotalBits 11
-+#define kBitModelTotal (1 << kNumBitModelTotalBits)
-+#define kNumMoveBits 5
-+
-+typedef struct _CRangeDecoder
-+{
-+  Byte *Buffer;
-+  Byte *BufferLim;
-+  UInt32 Range;
-+  UInt32 Code;
-+  #ifdef _LZMA_IN_CB
-+  ILzmaInCallback *InCallback;
-+  int Result;
-+  #endif
-+  int ExtraBytes;
-+} CRangeDecoder;
-+
-+Byte RangeDecoderReadByte(CRangeDecoder *rd)
-+{
-+  if (rd->Buffer == rd->BufferLim)
-+  {
-+    #ifdef _LZMA_IN_CB
-+    UInt32 size;
-+    rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
-+    rd->BufferLim = rd->Buffer + size;
-+    if (size == 0)
-+    #endif
-+    {
-+      rd->ExtraBytes = 1;
-+      return 0xFF;
-+    }
-+  }
-+  return (*rd->Buffer++);
-+}
-+
-+/* #define ReadByte (*rd->Buffer++) */
-+#define ReadByte (RangeDecoderReadByte(rd))
-+
-+void RangeDecoderInit(CRangeDecoder *rd,
-+  #ifdef _LZMA_IN_CB
-+    ILzmaInCallback *inCallback
-+  #else
-+    Byte *stream, UInt32 bufferSize
-+  #endif
-+    )
-+{
-+  int i;
-+  #ifdef _LZMA_IN_CB
-+  rd->InCallback = inCallback;
-+  rd->Buffer = rd->BufferLim = 0;
-+  #else
-+  rd->Buffer = stream;
-+  rd->BufferLim = stream + bufferSize;
-+  #endif
-+  rd->ExtraBytes = 0;
-+  rd->Code = 0;
-+  rd->Range = (0xFFFFFFFF);
-+  for(i = 0; i < 5; i++)
-+    rd->Code = (rd->Code << 8) | ReadByte;
-+}
-+
-+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
-+#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
-+#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
-+
-+UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
-+{
-+  RC_INIT_VAR
-+  UInt32 result = 0;
-+  int i;
-+  for (i = numTotalBits; i > 0; i--)
-+  {
-+    /* UInt32 t; */
-+    range >>= 1;
-+
-+    result <<= 1;
-+    if (code >= range)
-+    {
-+      code -= range;
-+      result |= 1;
-+    }
-+    /*
-+    t = (code - range) >> 31;
-+    t &= 1;
-+    code -= range & (t - 1);
-+    result = (result + result) | (1 - t);
-+    */
-+    RC_NORMALIZE
-+  }
-+  RC_FLUSH_VAR
-+  return result;
-+}
-+
-+int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
-+{
-+  UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
-+  if (rd->Code < bound)
-+  {
-+    rd->Range = bound;
-+    *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
-+    if (rd->Range < kTopValue)
-+    {
-+      rd->Code = (rd->Code << 8) | ReadByte;
-+      rd->Range <<= 8;
-+    }
-+    return 0;
-+  }
-+  else
-+  {
-+    rd->Range -= bound;
-+    rd->Code -= bound;
-+    *prob -= (*prob) >> kNumMoveBits;
-+    if (rd->Range < kTopValue)
-+    {
-+      rd->Code = (rd->Code << 8) | ReadByte;
-+      rd->Range <<= 8;
-+    }
-+    return 1;
-+  }
-+}
-+
-+#define RC_GET_BIT2(prob, mi, A0, A1) \
-+  UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
-+  if (code < bound) \
-+    { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
-+  else \
-+    { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
-+  RC_NORMALIZE
-+
-+#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
-+
-+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-+{
-+  int mi = 1;
-+  int i;
-+  #ifdef _LZMA_LOC_OPT
-+  RC_INIT_VAR
-+  #endif
-+  for(i = numLevels; i > 0; i--)
-+  {
-+    #ifdef _LZMA_LOC_OPT
-+    CProb *prob = probs + mi;
-+    RC_GET_BIT(prob, mi)
-+    #else
-+    mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
-+    #endif
-+  }
-+  #ifdef _LZMA_LOC_OPT
-+  RC_FLUSH_VAR
-+  #endif
-+  return mi - (1 << numLevels);
-+}
-+
-+int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
-+{
-+  int mi = 1;
-+  int i;
-+  int symbol = 0;
-+  #ifdef _LZMA_LOC_OPT
-+  RC_INIT_VAR
-+  #endif
-+  for(i = 0; i < numLevels; i++)
-+  {
-+    #ifdef _LZMA_LOC_OPT
-+    CProb *prob = probs + mi;
-+    RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
-+    #else
-+    int bit = RangeDecoderBitDecode(probs + mi, rd);
-+    mi = mi + mi + bit;
-+    symbol |= (bit << i);
-+    #endif
-+  }
-+  #ifdef _LZMA_LOC_OPT
-+  RC_FLUSH_VAR
-+  #endif
-+  return symbol;
-+}
-+
-+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
-+{
-+  int symbol = 1;
-+  #ifdef _LZMA_LOC_OPT
-+  RC_INIT_VAR
-+  #endif
-+  do
-+  {
-+    #ifdef _LZMA_LOC_OPT
-+    CProb *prob = probs + symbol;
-+    RC_GET_BIT(prob, symbol)
-+    #else
-+    symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-+    #endif
-+  }
-+  while (symbol < 0x100);
-+  #ifdef _LZMA_LOC_OPT
-+  RC_FLUSH_VAR
-+  #endif
-+  return symbol;
-+}
-+
-+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
-+{
-+  int symbol = 1;
-+  #ifdef _LZMA_LOC_OPT
-+  RC_INIT_VAR
-+  #endif
-+  do
-+  {
-+    int bit;
-+    int matchBit = (matchByte >> 7) & 1;
-+    matchByte <<= 1;
-+    #ifdef _LZMA_LOC_OPT
-+    {
-+      CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
-+      RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
-+    }
-+    #else
-+    bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
-+    symbol = (symbol << 1) | bit;
-+    #endif
-+    if (matchBit != bit)
-+    {
-+      while (symbol < 0x100)
-+      {
-+        #ifdef _LZMA_LOC_OPT
-+        CProb *prob = probs + symbol;
-+        RC_GET_BIT(prob, symbol)
-+        #else
-+        symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
-+        #endif
-+      }
-+      break;
-+    }
-+  }
-+  while (symbol < 0x100);
-+  #ifdef _LZMA_LOC_OPT
-+  RC_FLUSH_VAR
-+  #endif
-+  return symbol;
-+}
-+
-+#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)
-+
-+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
-+{
-+  if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
-+    return RangeDecoderBitTreeDecode(p + LenLow +
-+        (posState << kLenNumLowBits), kLenNumLowBits, rd);
-+  if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
-+    return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
-+        (posState << kLenNumMidBits), kLenNumMidBits, rd);
-+  return kLenNumLowSymbols + kLenNumMidSymbols +
-+      RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
-+}
-+
-+#define kNumStates 12
-+
-+#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 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)
-+
-+#if Literal != LZMA_BASE_SIZE
-+StopCompilingDueBUG
-+#endif
-+
-+#ifdef _LZMA_OUT_READ
-+
-+typedef struct _LzmaVarState
-+{
-+  CRangeDecoder RangeDecoder;
-+  Byte *Dictionary;
-+  UInt32 DictionarySize;
-+  UInt32 DictionaryPos;
-+  UInt32 GlobalPos;
-+  UInt32 Reps[4];
-+  int lc;
-+  int lp;
-+  int pb;
-+  int State;
-+  int PreviousIsMatch;
-+  int RemainLen;
-+} LzmaVarState;
-+
-+int LzmaDecoderInit(
-+    unsigned char *buffer, UInt32 bufferSize,
-+    int lc, int lp, int pb,
-+    unsigned char *dictionary, UInt32 dictionarySize,
-+    #ifdef _LZMA_IN_CB
-+    ILzmaInCallback *inCallback
-+    #else
-+    unsigned char *inStream, UInt32 inSize
-+    #endif
-+    )
-+{
-+  LzmaVarState *vs = (LzmaVarState *)buffer;
-+  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-+  UInt32 i;
-+  if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
-+    return LZMA_RESULT_NOT_ENOUGH_MEM;
-+  vs->Dictionary = dictionary;
-+  vs->DictionarySize = dictionarySize;
-+  vs->DictionaryPos = 0;
-+  vs->GlobalPos = 0;
-+  vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
-+  vs->lc = lc;
-+  vs->lp = lp;
-+  vs->pb = pb;
-+  vs->State = 0;
-+  vs->PreviousIsMatch = 0;
-+  vs->RemainLen = 0;
-+  dictionary[dictionarySize - 1] = 0;
-+  for (i = 0; i < numProbs; i++)
-+    p[i] = kBitModelTotal >> 1;
-+  RangeDecoderInit(&vs->RangeDecoder,
-+      #ifdef _LZMA_IN_CB
-+      inCallback
-+      #else
-+      inStream, inSize
-+      #endif
-+  );
-+  return LZMA_RESULT_OK;
-+}
-+
-+int LzmaDecode(unsigned char *buffer,
-+    unsigned char *outStream, UInt32 outSize,
-+    UInt32 *outSizeProcessed)
-+{
-+  LzmaVarState *vs = (LzmaVarState *)buffer;
-+  CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
-+  CRangeDecoder rd = vs->RangeDecoder;
-+  int state = vs->State;
-+  int previousIsMatch = vs->PreviousIsMatch;
-+  Byte previousByte;
-+  UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
-+  UInt32 nowPos = 0;
-+  UInt32 posStateMask = (1 << (vs->pb)) - 1;
-+  UInt32 literalPosMask = (1 << (vs->lp)) - 1;
-+  int lc = vs->lc;
-+  int len = vs->RemainLen;
-+  UInt32 globalPos = vs->GlobalPos;
-+
-+  Byte *dictionary = vs->Dictionary;
-+  UInt32 dictionarySize = vs->DictionarySize;
-+  UInt32 dictionaryPos = vs->DictionaryPos;
-+
-+  if (len == -1)
-+  {
-+    *outSizeProcessed = 0;
-+    return LZMA_RESULT_OK;
-+  }
-+
-+  while(len > 0 && nowPos < outSize)
-+  {
-+    UInt32 pos = dictionaryPos - rep0;
-+    if (pos >= dictionarySize)
-+      pos += dictionarySize;
-+    outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
-+    if (++dictionaryPos == dictionarySize)
-+      dictionaryPos = 0;
-+    len--;
-+  }
-+  if (dictionaryPos == 0)
-+    previousByte = dictionary[dictionarySize - 1];
-+  else
-+    previousByte = dictionary[dictionaryPos - 1];
-+#else
-+
-+int LzmaDecode(
-+    Byte *buffer, UInt32 bufferSize,
-+    int lc, int lp, int pb,
-+    #ifdef _LZMA_IN_CB
-+    ILzmaInCallback *inCallback,
-+    #else
-+    unsigned char *inStream, UInt32 inSize,
-+    #endif
-+    unsigned char *outStream, UInt32 outSize,
-+    UInt32 *outSizeProcessed)
-+{
-+  UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
-+  CProb *p = (CProb *)buffer;
-+  CRangeDecoder rd;
-+  UInt32 i;
-+  int state = 0;
-+  int previousIsMatch = 0;
-+  Byte previousByte = 0;
-+  UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
-+  UInt32 nowPos = 0;
-+  UInt32 posStateMask = (1 << pb) - 1;
-+  UInt32 literalPosMask = (1 << lp) - 1;
-+  int len = 0;
-+  if (bufferSize < numProbs * sizeof(CProb))
-+    return LZMA_RESULT_NOT_ENOUGH_MEM;
-+  for (i = 0; i < numProbs; i++)
-+    p[i] = kBitModelTotal >> 1;
-+  RangeDecoderInit(&rd,
-+      #ifdef _LZMA_IN_CB
-+      inCallback
-+      #else
-+      inStream, inSize
-+      #endif
-+      );
-+#endif
-+
-+  *outSizeProcessed = 0;
-+  while(nowPos < outSize)
-+  {
-+    int posState = (int)(
-+        (nowPos
-+        #ifdef _LZMA_OUT_READ
-+        + globalPos
-+        #endif
-+        )
-+        & posStateMask);
-+    #ifdef _LZMA_IN_CB
-+    if (rd.Result != LZMA_RESULT_OK)
-+      return rd.Result;
-+    #endif
-+    if (rd.ExtraBytes != 0)
-+      return LZMA_RESULT_DATA_ERROR;
-+    if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
-+    {
-+      CProb *probs = p + Literal + (LZMA_LIT_SIZE *
-+        (((
-+        (nowPos
-+        #ifdef _LZMA_OUT_READ
-+        + globalPos
-+        #endif
-+        )
-+        & literalPosMask) << lc) + (previousByte >> (8 - lc))));
-+
-+      if (state < 4) state = 0;
-+      else if (state < 10) state -= 3;
-+      else state -= 6;
-+      if (previousIsMatch)
-+      {
-+        Byte matchByte;
-+        #ifdef _LZMA_OUT_READ
-+        UInt32 pos = dictionaryPos - rep0;
-+        if (pos >= dictionarySize)
-+          pos += dictionarySize;
-+        matchByte = dictionary[pos];
-+        #else
-+        matchByte = outStream[nowPos - rep0];
-+        #endif
-+        previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
-+        previousIsMatch = 0;
-+      }
-+      else
-+        previousByte = LzmaLiteralDecode(probs, &rd);
-+      outStream[nowPos++] = previousByte;
-+      #ifdef _LZMA_OUT_READ
-+      dictionary[dictionaryPos] = previousByte;
-+      if (++dictionaryPos == dictionarySize)
-+        dictionaryPos = 0;
-+      #endif
-+    }
-+    else
-+    {
-+      previousIsMatch = 1;
-+      if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
-+      {
-+        if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
-+        {
-+          if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
-+          {
-+            #ifdef _LZMA_OUT_READ
-+            UInt32 pos;
-+            #endif
-+            if (
-+               (nowPos
-+                #ifdef _LZMA_OUT_READ
-+                + globalPos
-+                #endif
-+               )
-+               == 0)
-+              return LZMA_RESULT_DATA_ERROR;
-+            state = state < 7 ? 9 : 11;
-+            #ifdef _LZMA_OUT_READ
-+            pos = dictionaryPos - rep0;
-+            if (pos >= dictionarySize)
-+              pos += dictionarySize;
-+            previousByte = dictionary[pos];
-+            dictionary[dictionaryPos] = previousByte;
-+            if (++dictionaryPos == dictionarySize)
-+              dictionaryPos = 0;
-+            #else
-+            previousByte = outStream[nowPos - rep0];
-+            #endif
-+            outStream[nowPos++] = previousByte;
-+            continue;
-+          }
-+        }
-+        else
-+        {
-+          UInt32 distance;
-+          if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
-+            distance = rep1;
-+          else
-+          {
-+            if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
-+              distance = rep2;
-+            else
-+            {
-+              distance = rep3;
-+              rep3 = rep2;
-+            }
-+            rep2 = rep1;
-+          }
-+          rep1 = rep0;
-+          rep0 = distance;
-+        }
-+        len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
-+        state = state < 7 ? 8 : 11;
-+      }
-+      else
-+      {
-+        int posSlot;
-+        rep3 = rep2;
-+        rep2 = rep1;
-+        rep1 = rep0;
-+        state = state < 7 ? 7 : 10;
-+        len = LzmaLenDecode(p + LenCoder, &rd, posState);
-+        posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
-+            ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
-+            kNumPosSlotBits), kNumPosSlotBits, &rd);
-+        if (posSlot >= kStartPosModelIndex)
-+        {
-+          int numDirectBits = ((posSlot >> 1) - 1);
-+          rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
-+          if (posSlot < kEndPosModelIndex)
-+          {
-+            rep0 += RangeDecoderReverseBitTreeDecode(
-+                p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
-+          }
-+          else
-+          {
-+            rep0 += RangeDecoderDecodeDirectBits(&rd,
-+                numDirectBits - kNumAlignBits) << kNumAlignBits;
-+            rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
-+          }
-+        }
-+        else
-+          rep0 = posSlot;
-+        rep0++;
-+      }
-+      if (rep0 == (UInt32)(0))
-+      {
-+        /* it's for stream version */
-+        len = -1;
-+        break;
-+      }
-+      if (rep0 > nowPos
-+        #ifdef _LZMA_OUT_READ
-+        + globalPos
-+        #endif
-+        )
-+      {
-+        return LZMA_RESULT_DATA_ERROR;
-+      }
-+      len += kMatchMinLen;
-+      do
-+      {
-+        #ifdef _LZMA_OUT_READ
-+        UInt32 pos = dictionaryPos - rep0;
-+        if (pos >= dictionarySize)
-+          pos += dictionarySize;
-+        previousByte = dictionary[pos];
-+        dictionary[dictionaryPos] = previousByte;
-+        if (++dictionaryPos == dictionarySize)
-+          dictionaryPos = 0;
-+        #else
-+        previousByte = outStream[nowPos - rep0];
-+        #endif
-+        outStream[nowPos++] = previousByte;
-+        len--;
-+      }
-+      while(len > 0 && nowPos < outSize);
-+    }
-+  }
-+
-+  #ifdef _LZMA_OUT_READ
-+  vs->RangeDecoder = rd;
-+  vs->DictionaryPos = dictionaryPos;
-+  vs->GlobalPos = globalPos + nowPos;
-+  vs->Reps[0] = rep0;
-+  vs->Reps[1] = rep1;
-+  vs->Reps[2] = rep2;
-+  vs->Reps[3] = rep3;
-+  vs->State = state;
-+  vs->PreviousIsMatch = previousIsMatch;
-+  vs->RemainLen = len;
-+  #endif
-+
-+  *outSizeProcessed = nowPos;
-+  return LZMA_RESULT_OK;
-+}
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -13,7 +13,7 @@
- lib-y += kobject.o kref.o kobject_uevent.o klist.o
- obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
--       bust_spinlocks.o hexdump.o
-+       bust_spinlocks.o hexdump.o LzmaDecode.o
- ifeq ($(CONFIG_DEBUG_KOBJECT),y)
- CFLAGS_kobject.o += -DDEBUG
-@@ -58,6 +58,7 @@
- obj-$(CONFIG_AUDIT_GENERIC) += audit.o
- obj-$(CONFIG_SWIOTLB) += swiotlb.o
-+
- obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
- lib-$(CONFIG_GENERIC_BUG) += bug.o
diff --git a/target/linux/generic-2.6/patches-2.6.22/003-squashfs_lzma.patch b/target/linux/generic-2.6/patches-2.6.22/003-squashfs_lzma.patch
deleted file mode 100644 (file)
index 16cc873..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
---- a/fs/squashfs/inode.c
-+++ b/fs/squashfs/inode.c
-@@ -4,6 +4,9 @@
-  * Copyright (c) 2002, 2003, 2004, 2005, 2006
-  * Phillip Lougher <phillip@lougher.org.uk>
-  *
-+ * LZMA decompressor support added by Oleg I. Vdovikin
-+ * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
-+ *
-  * 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,
-@@ -21,6 +24,7 @@
-  * inode.c
-  */
-+#define SQUASHFS_LZMA
- #include <linux/types.h>
- #include <linux/squashfs_fs.h>
- #include <linux/module.h>
-@@ -44,6 +48,19 @@
- #include "squashfs.h"
-+#ifdef SQUASHFS_LZMA
-+#include <linux/LzmaDecode.h>
-+
-+/* default LZMA settings, should be in sync with mksquashfs */
-+#define LZMA_LC 3
-+#define LZMA_LP 0
-+#define LZMA_PB 2
-+
-+#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
-+      (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
-+
-+#endif
-+
- static void squashfs_put_super(struct super_block *);
- static int squashfs_statfs(struct dentry *, struct kstatfs *);
- static int squashfs_symlink_readpage(struct file *file, struct page *page);
-@@ -64,7 +81,11 @@
-                       const char *, void *, struct vfsmount *);
-+#ifdef SQUASHFS_LZMA
-+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
-+#else
- static z_stream stream;
-+#endif
- static struct file_system_type squashfs_fs_type = {
-       .owner = THIS_MODULE,
-@@ -249,6 +270,15 @@
-       if (compressed) {
-               int zlib_err;
-+#ifdef SQUASHFS_LZMA
-+              if ((zlib_err = LzmaDecode(lzma_workspace,
-+                      LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
-+                      c_buffer, c_byte, buffer, msblk->read_size, &bytes)) != LZMA_RESULT_OK)
-+              {
-+                      ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
-+                      bytes = 0;
-+              }
-+#else
-               stream.next_in = c_buffer;
-               stream.avail_in = c_byte;
-               stream.next_out = buffer;
-@@ -263,7 +293,7 @@
-                       bytes = 0;
-               } else
-                       bytes = stream.total_out;
--
-+#endif
-               up(&msblk->read_data_mutex);
-       }
-@@ -2045,15 +2075,19 @@
-       printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
-               "Phillip Lougher\n");
-+#ifndef SQUASHFS_LZMA
-       if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) {
-               ERROR("Failed to allocate zlib workspace\n");
-               destroy_inodecache();
-               err = -ENOMEM;
-               goto out;
-       }
-+#endif
-       if ((err = register_filesystem(&squashfs_fs_type))) {
-+#ifndef SQUASHFS_LZMA
-               vfree(stream.workspace);
-+#endif
-               destroy_inodecache();
-       }
-@@ -2064,7 +2098,9 @@
- static void __exit exit_squashfs_fs(void)
- {
-+#ifndef SQUASHFS_LZMA
-       vfree(stream.workspace);
-+#endif
-       unregister_filesystem(&squashfs_fs_type);
-       destroy_inodecache();
- }
diff --git a/target/linux/generic-2.6/patches-2.6.22/004-extra_optimization.patch b/target/linux/generic-2.6/patches-2.6.22/004-extra_optimization.patch
deleted file mode 100644 (file)
index 5e70e1b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/Makefile
-+++ b/Makefile
-@@ -507,6 +507,9 @@
- 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
- CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
diff --git a/target/linux/generic-2.6/patches-2.6.22/006-gcc4_inline_fix.patch b/target/linux/generic-2.6/patches-2.6.22/006-gcc4_inline_fix.patch
deleted file mode 100644 (file)
index 0059088..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/include/asm-mips/system.h
-+++ b/include/asm-mips/system.h
-@@ -188,7 +188,7 @@
-    if something tries to do an invalid xchg().  */
- extern void __xchg_called_with_bad_pointer(void);
--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:
diff --git a/target/linux/generic-2.6/patches-2.6.22/007-samsung_flash.patch b/target/linux/generic-2.6/patches-2.6.22/007-samsung_flash.patch
deleted file mode 100644 (file)
index 335ffd9..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -51,6 +51,7 @@
- #define SST49LF040B           0x0050
- #define SST49LF008A           0x005a
- #define AT49BV6416            0x00d6
-+#define MANUFACTURER_SAMSUNG  0x00ec
- 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 *);
-@@ -294,12 +295,19 @@
-               if (extp->MajorVersion != '1' ||
-                   (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
--                      printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
--                             "version %c.%c.\n",  extp->MajorVersion,
--                             extp->MinorVersion);
--                      kfree(extp);
--                      kfree(mtd);
--                      return NULL;
-+                      if (cfi->mfr == MANUFACTURER_SAMSUNG &&
-+                          (extp->MajorVersion == '3' && extp->MinorVersion == '3')) {
-+                          printk(KERN_NOTICE "  Newer Samsung flash detected, "
-+                                 "should be compatibile with Amd/Fujitsu.\n");
-+                      }
-+                      else {
-+                          printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
-+                                 "version %c.%c.\n",  extp->MajorVersion,
-+                                 extp->MinorVersion);
-+                          kfree(extp);
-+                          kfree(mtd);
-+                          return NULL;
-+                      }
-               }
-               /* Install our own private info structure */
diff --git a/target/linux/generic-2.6/patches-2.6.22/009-revert_intel_flash_breakage.patch b/target/linux/generic-2.6/patches-2.6.22/009-revert_intel_flash_breakage.patch
deleted file mode 100644 (file)
index 51b84a7..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
---- a/drivers/mtd/chips/cfi_cmdset_0001.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
-@@ -933,7 +933,7 @@
- static int __xipram xip_wait_for_operation(
-               struct map_info *map, struct flchip *chip,
--              unsigned long adr, unsigned int chip_op_time )
-+              unsigned long adr, int *chip_op_time )
- {
-       struct cfi_private *cfi = map->fldrv_priv;
-       struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
-@@ -942,7 +942,7 @@
-       flstate_t oldstate, newstate;
-               start = xip_currtime();
--      usec = chip_op_time * 8;
-+      usec = *chip_op_time * 8;
-       if (usec == 0)
-               usec = 500000;
-       done = 0;
-@@ -1052,8 +1052,8 @@
- #define XIP_INVAL_CACHED_RANGE(map, from, size)  \
-       INVALIDATE_CACHED_RANGE(map, from, size)
--#define INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, inval_adr, inval_len, usec) \
--      xip_wait_for_operation(map, chip, cmd_adr, usec)
-+#define INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, inval_adr, inval_len, p_usec) \
-+      xip_wait_for_operation(map, chip, cmd_adr, p_usec)
- #else
-@@ -1065,65 +1065,65 @@
- static int inval_cache_and_wait_for_operation(
-               struct map_info *map, struct flchip *chip,
-               unsigned long cmd_adr, unsigned long inval_adr, int inval_len,
--              unsigned int chip_op_time)
-+              int *chip_op_time )
- {
-       struct cfi_private *cfi = map->fldrv_priv;
-       map_word status, status_OK = CMD(0x80);
--      int chip_state = chip->state;
--      unsigned int timeo, sleep_time;
-+      int z, chip_state = chip->state;
-+      unsigned long timeo;
-       spin_unlock(chip->mutex);
-       if (inval_len)
-               INVALIDATE_CACHED_RANGE(map, inval_adr, inval_len);
-+      if (*chip_op_time)
-+              cfi_udelay(*chip_op_time);
-       spin_lock(chip->mutex);
--      /* set our timeout to 8 times the expected delay */
--      timeo = chip_op_time * 8;
--      if (!timeo)
--              timeo = 500000;
--      sleep_time = chip_op_time / 2;
-+      timeo = *chip_op_time * 8 * HZ / 1000000;
-+      if (timeo < HZ/2)
-+              timeo = HZ/2;
-+      timeo += jiffies;
-+      z = 0;
-       for (;;) {
-+              if (chip->state != chip_state) {
-+                      /* Someone's suspended the operation: sleep */
-+                      DECLARE_WAITQUEUE(wait, current);
-+
-+                      set_current_state(TASK_UNINTERRUPTIBLE);
-+                      add_wait_queue(&chip->wq, &wait);
-+                      spin_unlock(chip->mutex);
-+                      schedule();
-+                      remove_wait_queue(&chip->wq, &wait);
-+                      timeo = jiffies + (HZ / 2); /* FIXME */
-+                      spin_lock(chip->mutex);
-+                      continue;
-+              }
-+
-               status = map_read(map, cmd_adr);
-               if (map_word_andequal(map, status, status_OK, status_OK))
-                       break;
--              if (!timeo) {
-+              /* OK Still waiting */
-+              if (time_after(jiffies, timeo)) {
-                       map_write(map, CMD(0x70), cmd_adr);
-                       chip->state = FL_STATUS;
-                       return -ETIME;
-               }
--              /* OK Still waiting. Drop the lock, wait a while and retry. */
-+              /* Latency issues. Drop the lock, wait a while and retry */
-+              z++;
-               spin_unlock(chip->mutex);
--              if (sleep_time >= 1000000/HZ) {
--                      /*
--                       * Half of the normal delay still remaining
--                       * can be performed with a sleeping delay instead
--                       * of busy waiting.
--                       */
--                      msleep(sleep_time/1000);
--                      timeo -= sleep_time;
--                      sleep_time = 1000000/HZ;
--              } else {
--                      udelay(1);
--                      cond_resched();
--                      timeo--;
--              }
-+              cfi_udelay(1);
-               spin_lock(chip->mutex);
--
--              while (chip->state != chip_state) {
--                      /* Someone's suspended the operation: sleep */
--                      DECLARE_WAITQUEUE(wait, current);
--                      set_current_state(TASK_UNINTERRUPTIBLE);
--                      add_wait_queue(&chip->wq, &wait);
--                      spin_unlock(chip->mutex);
--                      schedule();
--                      remove_wait_queue(&chip->wq, &wait);
--                      spin_lock(chip->mutex);
--              }
-       }
-+      if (!z) {
-+              if (!--(*chip_op_time))
-+                      *chip_op_time = 1;
-+      } else if (z > 1)
-+              ++(*chip_op_time);
-+
-       /* Done and happy. */
-       chip->state = FL_STATUS;
-       return 0;
-@@ -1132,7 +1132,8 @@
- #endif
- #define WAIT_TIMEOUT(map, chip, adr, udelay) \
--      INVAL_CACHE_AND_WAIT(map, chip, adr, 0, 0, udelay);
-+      ({ int __udelay = (udelay); \
-+         INVAL_CACHE_AND_WAIT(map, chip, adr, 0, 0, &__udelay); })
- static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t adr, size_t len)
-@@ -1356,7 +1357,7 @@
-       ret = INVAL_CACHE_AND_WAIT(map, chip, adr,
-                                  adr, map_bankwidth(map),
--                                 chip->word_write_time);
-+                                 &chip->word_write_time);
-       if (ret) {
-               xip_enable(map, chip, adr);
-               printk(KERN_ERR "%s: word write error (status timeout)\n", map->name);
-@@ -1593,7 +1594,7 @@
-       ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
-                                  adr, len,
--                                 chip->buffer_write_time);
-+                                 &chip->buffer_write_time);
-       if (ret) {
-               map_write(map, CMD(0x70), cmd_adr);
-               chip->state = FL_STATUS;
-@@ -1728,7 +1729,7 @@
-       ret = INVAL_CACHE_AND_WAIT(map, chip, adr,
-                                  adr, len,
--                                 chip->erase_time);
-+                                 &chip->erase_time);
-       if (ret) {
-               map_write(map, CMD(0x70), adr);
-               chip->state = FL_STATUS;
diff --git a/target/linux/generic-2.6/patches-2.6.22/010-disable_old_squashfs_compatibility.patch b/target/linux/generic-2.6/patches-2.6.22/010-disable_old_squashfs_compatibility.patch
deleted file mode 100644 (file)
index 01e2757..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/fs/squashfs/Makefile
-+++ b/fs/squashfs/Makefile
-@@ -4,4 +4,3 @@
- obj-$(CONFIG_SQUASHFS) += squashfs.o
- squashfs-y += inode.o
--squashfs-y += squashfs2_0.o
---- a/fs/squashfs/squashfs.h
-+++ b/fs/squashfs/squashfs.h
-@@ -24,6 +24,9 @@
- #ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
- #undef CONFIG_SQUASHFS_1_0_COMPATIBILITY
- #endif
-+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+#undef CONFIG_SQUASHFS_2_0_COMPATIBILITY
-+#endif
- #ifdef SQUASHFS_TRACE
- #define TRACE(s, args...)     printk(KERN_NOTICE "SQUASHFS: "s, ## args)
diff --git a/target/linux/generic-2.6/patches-2.6.22/011-mips_boot.patch b/target/linux/generic-2.6/patches-2.6.22/011-mips_boot.patch
deleted file mode 100644 (file)
index 6b1caca..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---- a/arch/mips/kernel/head.S
-+++ b/arch/mips/kernel/head.S
-@@ -129,11 +129,15 @@
- #endif
-       .endm
-+
-+      j kernel_entry
-+      nop
-+
-       /*
-        * Reserved space for exception handlers.
-        * Necessary for machines which link their kernels at KSEG0.
-        */
--      .fill   0x400
-+      .align 10
- EXPORT(stext)                                 # used for profiling
- EXPORT(_stext)
diff --git a/target/linux/generic-2.6/patches-2.6.22/012-mips_cpu_tlb.patch b/target/linux/generic-2.6/patches-2.6.22/012-mips_cpu_tlb.patch
deleted file mode 100644 (file)
index 47316d2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/arch/mips/mm/tlbex.c
-+++ b/arch/mips/mm/tlbex.c
-@@ -887,7 +887,6 @@
-       case CPU_R10000:
-       case CPU_R12000:
-       case CPU_R14000:
--      case CPU_4KC:
-       case CPU_SB1:
-       case CPU_SB1A:
-       case CPU_4KSC:
-@@ -915,6 +914,7 @@
-               tlbw(p);
-               break;
-+      case CPU_4KC:
-       case CPU_4KEC:
-       case CPU_24K:
-       case CPU_34K:
diff --git a/target/linux/generic-2.6/patches-2.6.22/013-mips_generic_gpio_support.patch b/target/linux/generic-2.6/patches-2.6.22/013-mips_generic_gpio_support.patch
deleted file mode 100644 (file)
index 8f2632b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/arch/mips/defconfig
-+++ b/arch/mips/defconfig
-@@ -69,6 +69,7 @@
- CONFIG_GENERIC_HWEIGHT=y
- CONFIG_GENERIC_CALIBRATE_DELAY=y
- CONFIG_GENERIC_TIME=y
-+CONFIG_GENERIC_GPIO=n
- CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
- # CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
- CONFIG_ARC=y
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -704,6 +704,10 @@
-       bool
-       default y
-+config GENERIC_GPIO
-+      bool
-+      default n
-+
- config SCHED_NO_NO_OMIT_FRAME_POINTER
-       bool
-       default y
---- /dev/null
-+++ b/include/asm-mips/gpio.h
-@@ -0,0 +1,6 @@
-+#ifndef _ASM_MIPS_GPIO_H
-+#define _ASM_MIPS_GPIO_H
-+
-+#include <gpio.h>
-+
-+#endif /* _ASM_MIPS_GPIO_H */
diff --git a/target/linux/generic-2.6/patches-2.6.22/014-x86_newsetup.patch b/target/linux/generic-2.6/patches-2.6.22/014-x86_newsetup.patch
deleted file mode 100644 (file)
index 9d77c83..0000000
+++ /dev/null
@@ -1,11865 +0,0 @@
-GIT 1783e2f0f21444020e3dee1be46b1e34af0ea3e7 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-newsetup.git
-
-commit 1783e2f0f21444020e3dee1be46b1e34af0ea3e7
-Author: Venki Pallipadi <venkatesh.pallipadi@intel.com>
-Date:   Wed Jun 20 14:12:39 2007 -0700
-
-    Use a new CPU feature word to cover all Intel features that are spread around
-    
-    in different CPUID leafs like 0x5, 0x6 and 0xA. Make this
-    feature detection code common across i386 and x86_64.
-    
-    Display Intel Dynamic Acceleration feature in /proc/cpuinfo. This feature
-    will be enabled automatically by current acpi-cpufreq driver.
-    
-    Refer to Intel Software Developer's Manual for more details about the feature.
-    
-    Thanks to hpa (H Peter Anvin) for the making the actual code detecting the
-    scattered features data-driven.
-    
-    Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit cd19eb67cd6636a4e5c9df99631422c7c7286f59
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed Jun 20 14:33:17 2007 -0700
-
-    x86 setup: move __bss_start into the .bss segment
-    
-    Move __bss_start into the .bss segment, and create __bss_end.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 100327ad6b609cd28970219be57d293847d1261d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed Jun 6 22:07:01 2007 -0700
-
-    x86 setup: remove TSC as a required feature
-    
-    Remove TSC as a required feature, in anticipation of CONFIG_X86_TSC
-    removal.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 7c91a172b8af7d4ba087f1f88ed5b155ed459ca3
-Author: Antonino A. Daplas <adaplas@gmail.com>
-Date:   Tue Jun 5 19:21:05 2007 +0800
-
-    i386: Set 6-bit DAC channel properties in vesa video setup
-    
-    If the video BIOS is not capable of switching or failed to switch the
-    hardware to 8-bit DAC, the channel properties are not set.  This leads
-    to a blank (all black) display with vesafb at 8 bpp. Fix by defaulting
-    to a 6-bit DAC.
-    
-    Signed-off-by: Antonino Daplas <adaplas@gmail.com>
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 6eac2d442de8d87eac94a4ca8600bd87219fa06b
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue Jun 5 16:19:36 2007 -0700
-
-    x86 setup: arch/i386/boot/cpucheck.c whitespace cleanup
-    
-    Remove stealth whitespace
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit f7d89f05a30433034a1b4651143afdbb2a8a9c92
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 24 16:56:44 2007 -0700
-
-    hd.c: remove BIOS/CMOS queries
-    
-    An ST-506 disk these days is pretty much someone trying to pull ancient
-    data using an auxilliary controller.  Pulling data from the BIOS or CMOS
-    is just plain wrong, since it's likely to be the primary OS disk... and
-    would be user-entered data anyway.  Instead, require the user enters it
-    on the command line.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 14c2fdb3bbfd6a9a774980e446c2443150749891
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 24 15:25:10 2007 -0700
-
-    x86: add back pbe bit to visible CPUID flags
-    
-    Add pbe back to the visible CPUID flags.  We *do* correctly filter abuses
-    of this bit for 3DNow! in all the appropriate paths.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e071b068a3b9f318be314f0378e655e2eb50ac89
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 23 14:52:34 2007 -0700
-
-    x86 setup: VIA feature mask MSR doesn't just apply to model <= 9
-    
-    The VIA feature mask MSR is known to be present on model 10, and it
-    seems likely it will continue to be supported.  Since we only touch the
-    MSR if we're about to print an error message anyway, go ahead and be
-    aggressive.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit abe0c5aa1827932cda9c754a3842ec22b278d704
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 22 17:17:41 2007 -0700
-
-    x86 setup: correct inline assembly constraints in edd.c
-    
-    Fix the inline assembly constraints in edd.c.  In particular, "driveno"
-    was getting clobbered on some (buggy?) BIOSes.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit c2e5887ad275aab90673a3e33344f09946159cf7
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 18 10:02:55 2007 -0700
-
-    x86 setup: force the assembler to generate a 2-byte jump in header
-    
-    The jump instruction in the header only has two bytes available, so
-    it *better* be a 2-byte jump!  Unfortunately, the assembler will
-    always generate a 3/5-byte jump when the target is in a different
-    section.  Deal with that by generating the jump instruction
-    explicitly from .byte's, just like we do elsewhere when we need a
-    specific binary representation of a certain instruction.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit ce82e3b93eba48b6852822a03efa73c74e165d4f
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 17 15:44:48 2007 -0700
-
-    x86 setup: move the symbol start_of_setup into the proper section.
-    
-    start_of_setup is the beginning of the executable code and should be
-    located in the appropriate section.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e5f3a529457a5bfaf8f8783fb86013221279a81c
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 17 15:43:19 2007 -0700
-
-    x86 setup: add an ASSERT that the header ends up in the right place
-    
-    Just in case we have funnies involving the linker or people putting
-    inappropriate align statements, make the linker abort if the setup
-    header ends up in the wrong place.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit d9dbde725687ab99d1f529f49f14d1e280cc5cac
-Author: Alexander van Heukelum <heukelum@mailshack.com>
-Date:   Thu May 17 20:54:25 2007 +0200
-
-    x86 new setup: use appropriate sections for code and data
-    
-    An intermediate elf file is generated for the 16-bit setup code.
-    The generated code can be viewed using objdump -m i8086 -d. As it
-    stands, it also tries to disassemble the bugger_off_msg, which
-    results in garbage. This introduces two new sections to separate
-    the code and the data part of the bootsector stub. It also moves
-    some code from the .header section (a data section) to .inittext.
-    
-    Signed-off-by: Alexander van Heukelum <heukelum@mailshack.com>
-
-commit 0d7558a81cf61e9fd2332a54897c5fd18df0d7f2
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 16 22:03:16 2007 -0700
-
-    x86 setup: use -include code16gcc.h instead of explicit #include
-    
-    Use -include in the Makefile instead of #include to include code16gcc.h.
-    This really is more of a compiler switch than anything else, and is a lot
-    cleaner to do implicitly.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 017ce54e8a4a9628a76d6b510c7309a7e4e111a8
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 16 18:48:06 2007 -0700
-
-    x86 setup: enable features on Centaur (VIA) and Transmeta processors
-    
-    AMD are not the only ones who sometimes mask features which the kernel
-    may very well depend on.  VIA and Transmeta do, too.  Add code to enable
-    these features during checking.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit b794f5f9c5089709f3df38c6d91869fa38a9c1a4
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 16 16:37:47 2007 -0700
-
-    x86 setup: in older versions of ld, ASSERT() is an expression
-    
-    Older versions of ld (pre-2.15 or so) need:
-    
-       . = ASSERT(foo, "msg");
-    
-    instead of:
-    
-       ASSERT(foo, "msg")
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 21c2b7c99c417d07015ee8e516a634ec3d98c4ee
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 16 10:52:41 2007 -0700
-
-    x86 setup: print a warning message if the bootloader gave us no heap.
-    
-    If the bootloader is so old it doesn't set the CAN_USE_HEAP flag,
-    a lot of functionality will by necessity be disabled, so print a
-    warning message.  This means either a 2.00 protocol bootloader or
-    a buggy bootloader; the Qemu bootloader falls in this category.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 52ca0431390d389a2a2246f02fe652ea84c1ddd8
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 16 10:51:03 2007 -0700
-
-    x86 setup: rely on a compiled-in default for load high/load low
-    
-    When deciding if we should move the kernel from 0x10000 to 0x1000, as
-    is required for a zImage kernel, rely on a compiled-in default since
-    Qemu unconditionally zeroes the loadflags.  This, of course, is a bug
-    in Qemu, but still...
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 4db77a97793104a32e5fb83e62b943fa144b329d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 16 08:45:37 2007 -0700
-
-    x86 setup: correct assembly constraints.
-    
-    Double use of "d" in an asm() constraints; most gcc versions correctly
-    detect and avoid using it, but some version of gcc runs itself into
-    a brick wall instead.  Fix the one "d" which should have been "a".
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 4fbccbc1457d6710d3a9ce55ad70ec6cb0b75fc5
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 15 09:16:29 2007 -0700
-
-    x86 setup: include <asm/msr-index.h> not <asm/msr.h>
-    
-    <asm/msr.h> brings in the accessor functions, which may potentially
-    bring in all other kinds of kernel headers which are inappropriate for
-    the setup code.  For the setup code, include <asm/msr-index.h>
-    instead, which only includes the numeric constants.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 839cafa9c0020e7506722dd2a4fd82a71c2939cc
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 14 15:49:01 2007 -0700
-
-    x86 setup: protocol 2.0[01]: base for CL_OFFSET depends on setup_move_size
-    
-    Handle the use of boot protocol 2.00 and 2.01: the base segment for
-    CL_OFFSET depends on the value of setup_move_size.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit d60357ad68a694b03e9b952eadba5ac277c31df0
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 12 12:18:53 2007 -0700
-
-    x86 setup: remove unused variable
-    
-    Remove unused variable
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e21a2030b01081612259847321bcce13eae1e883
-Author: Sam Ravnborg <sam@ravnborg.org>
-Date:   Sat May 12 12:17:30 2007 -0700
-
-    x86 setup: share i386 Makefile with x86_64
-    
-    The boot Makefile for i386 and x86_64 are equal
-    except for the CFLAGS setting.
-    Teach x86_64 to use the Makefile from i386 and
-    make CFLAGS setting arch dependent in i386 Makefile.
-    
-    Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 8618d92339d0d106045f98f34833d863c3235cdb
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 12 00:32:12 2007 -0700
-
-    x86 setup: video-bios.c missed the pointer to the set_mode method!
-    
-    We need the actual pointer to the set_mode method (oops!)
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 85dfc374ea9aad33b9e0315f07a4b2722dc11e3e
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 12 00:14:43 2007 -0700
-
-    x86 setup: when setting unknown BIOS modes and failing, try to revert
-    
-    If we set an unknown BIOS mode and fail, then explicitly try to revert
-    to the original mode.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit f4f7949f126d2f152b09fa9367b1ec693f2ea818
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 11 11:20:59 2007 -0700
-
-    x86 setup: fix typo "video_bios" should be "video-bios"
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 51ba7113ea5b07189b7f8a0534d400a072535197
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 11 11:09:55 2007 -0700
-
-    x86 setup: allow setting VESA modes "blind"
-    
-    Apparently, people really do set VESA modes "blind".  As a result, make
-    the framework for settting blind modes more general, to remove some
-    special cases.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 1b8f73d9b2bf7630a2914ddab606db16fddb509e
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 10 22:08:45 2007 -0700
-
-    x86_64: CONFIG_PHYSICAL_ALIGN should be 2 MB
-    
-    It's not actually used yet, but set CONFIG_PHYSICAL_ALIGN to 2 MB
-    as it should be, to prevent conflicts with other works in progress.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit b81f3c88923e4470cd0942d4596fafc0fb1cf4fd
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 10 19:11:32 2007 -0700
-
-    x86 setup: remove debugging statements
-    
-    Remove debugging statements in video.c that were not meant for
-    production.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit be58b6d7e9c14e482bce495e8343955999dea77f
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 10 18:49:40 2007 -0700
-
-    x86 setup: only restore the screen image when needed
-    
-    Only restore the screen image when needed.  This is how the original
-    code behaves, so it's presumably the desired behaviour.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 22f6bd8cc23b512af28e34ae7d40036982a0ac63
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 10 18:44:08 2007 -0700
-
-    x86 setup: correct the definition of the GDT limit
-    
-    Like all other x86 segment limits, the GDT limit points to the last byte
-    that is *permitted* to access, so it needs to be sizeof(boot_gdt)-1.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 7f73f1f4aa4c97745bffe07a3ebcf226a4965b00
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 10 15:47:48 2007 -0700
-
-    x86 setup: Re-implement scanning for hidden video modes
-    
-    Re-implement scanning for hidden video modes.  Every now and then,
-    apparently, you can find them hidden like easter eggs.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 6770176714bc12ec92372311ac02c14f0d22776e
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 10 15:24:27 2007 -0700
-
-    x86 setup: whitespace cleanup
-    
-    Clean up stealth whitespace.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit ba0480a3537cf471b08bdb99dae6d0780cfb1972
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 9 16:54:42 2007 -0700
-
-    x86: sync the CPU feature string arrays
-    
-    With <asm/cpufeature.h> unified, synchronize the CPU feature string
-    arrays.  The whole kernel/cpu directory really needs to be unified.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit ecb53b84efddbad3d9aa49e95598550831324348
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 8 22:06:04 2007 -0700
-
-    x86 setup: need to set orig_video_isVGA
-    
-    After detecting a VGA console, we need to set
-    boot_params.screen_info.orig_video_isVGA.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit dc97fc053faff17b984ec962686caea52bd27628
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 8 20:51:17 2007 -0700
-
-    x86 setup: boot sector should use ljmp, not jmpl
-    
-    We have an "jmpl" instruction in the boot sector, which was meant
-    to be an "ljmp" instruction.  It worked anyway because gas interpreted
-    a two-argument "jmpl" as an "ljmpl" instruction, however, use plain
-    "ljmp" (i.e. "ljmpw".)
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 7907f05e9692557c53c9ac13647db5e5343c7c76
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 8 20:27:10 2007 -0700
-
-    x86 setup: only make VESA graphics modes selectable if CONFIG_FB
-    
-    If we select a VESA graphics mode, we better have framebuffer support
-    or the user will have no console.  Therefore, make these modes
-    non-selectable if CONFIG_FB is not set.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 8e509f9ebc44f45544d231454e84f10bf78d5772
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 8 20:24:11 2007 -0700
-
-    x86 setup: need to probe VESA EDID block 0 only
-    
-    The VESA EDID BIOS call takes the EDID block number in %dx, and may
-    corrupt it by spec.  Pass it in properly.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 9912b9aed7943773d1fadaa2e2e52f42af395048
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 18:22:04 2007 -0700
-
-    x86 setup: add missing file "bitops.h" missing from previous checkins
-    
-    The file "bitops.h" was missing from previous checkins.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 732eb3fac2d772980e6555b8c69902c8107c72aa
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 14:59:43 2007 -0700
-
-    x86 setup: add -fno-stack-protector; other Makefile fixes
-    
-    Add -fno-stack-protector for the gcc's that need that;
-    Use -ffreestanding consistently;
-    Use $(LINUXINCLUDE);
-    Handle linker scripts consistently with other Makefiles.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 2d5e47f21202e156fe97aba0a88d158d5c157a33
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 14:45:25 2007 -0700
-
-    x86 setup: swap cpu.c and cpucheck.c; rename functions
-    
-    Make cpucheck.c the reusable component; the generically-named cpu.c
-    gets to be the wrapper.  Accordingly, rename functions to make it
-    less confusing.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit bf2a428a4e7c1ee3ab9acb23cfafb45e818887a1
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 14:09:38 2007 -0700
-
-    x86 setup: remove code moved from cpucheck.c -> cpu.c
-    
-    Move all info about requirements into cpu.c.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 9ea8429fabe5df6aed6393ac3a00d0b64445ba6a
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 09:42:51 2007 -0700
-
-    x86 setup: remove double nesting of a20_test()
-    
-    a20_test() was invoked as either a20_test() or a20_wait(), where the
-    latter was simply a loop around a loop.  Make the count a parameter
-    instead; this is clearer and saves a couple of bytes.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 9edc55718f57195c664ee3175514d652f651cfd2
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 09:30:41 2007 -0700
-
-    x86 setup: compile with -fomit-frame-pointer
-    
-    Compiling with -fomit-frame-pointer reduces the size by about 2%.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e1003433f2d491bf17c79437cd75268da220dab5
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon May 7 09:30:04 2007 -0700
-
-    x86 setup: be more paranoid about the stack setup in header.S
-    
-    In particular, deal correctly with the stack pointer being zero on entry.
-    While we're at it, align the stack.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 853499c3dc3fcbeb192a613ac241d150ebc7c5a0
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sun May 6 23:25:10 2007 -0700
-
-    x86 setup: Factor out the environment-independent part of the CPU check.
-    
-    Factor out the environment-independent part of the CPU check so it can
-    be invoked from other parts of the kernel as well.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit f235a61f6d6dff57883efad351d746540bcb8caf
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 22:16:54 2007 -0700
-
-    x86 setup: when watching the setup size, take the stack into account
-    
-    When watching the setup size, we have to take the stack into account.
-    In particular, the stack is used not only by the setup code itself, but
-    by BIOS interrupt handlers and system calls.  Reserve a minimum of
-    512 bytes.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 0d0e10091be48f7e4c8888e9d5c2836c704994f5
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 19:25:51 2007 -0700
-
-    x86 setup: actually check the end of the heap.
-    
-    Keep track of where the heap ends and actually watch out for it.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 47aab0b8f4d012fad3c42b5b0754d3cb87961b37
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 15:47:58 2007 -0700
-
-    x86 setup: coppyright rPath, Inc.
-    
-    This work was done on the dime of rPath, Inc.; they own the copyright.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit d22571534d7eabf9408f29d9da423e1c6e04445f
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 15:21:11 2007 -0700
-
-    x86 setup: implement screen contents save/restore
-    
-    The old setup code had screen contents save and restore, so implement
-    it for the new one as well.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e5145601a752bd998e783d159c187d3017d45d6d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 15:20:19 2007 -0700
-
-    x86 setup: whitespace cleanup
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 045ecb52f91a74eecad93ffc8791eefe59cf7fd1
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 14:22:39 2007 -0700
-
-    x86 setup: allow setting of VESA graphics modes; cleanups
-    
-    - Allow setting of VESA graphics modes (used by vesafb)
-    - Clean up the macros related to the heap
-    - #if 0 copy functions that aren't actually currently being used
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 58c04ed7e2d7d5979e1917a74b49bdc0f3dde211
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 12:06:14 2007 -0700
-
-    x86 setup: move all VESA-related code into video-vesa.c; add EDID
-    
-    - Move all VESA-related code into video-vesa.c
-    - Add VESA EDID query support
-    - Remove some totally obsolete definitions from video.h
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 07bc3931175fb98256140275c03194426d441b74
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Sat May 5 12:04:40 2007 -0700
-
-    x86-64: remove -traditional from AFLAGS
-    
-    In arch/x86_64/boot/compressed, remove -traditional from AFLAGS.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a830f615eeef838d461cbf7bbbee8c1c84708ec8
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 18:44:38 2007 -0700
-
-    x86 setup: share code between i386 and x86-64
-    
-    Share the boot (setup) code and tools between i386 and x86-64.
-    The compression code is now running in 64-bit mode in order to support
-    relocation, so do *not* share that code.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 3e159a323bdfa5d5a7be2c1f6be089ca22d598e0
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 18:43:35 2007 -0700
-
-    x86-64: use 0x1b4 as the scratch area in boot_params, not 0x3c
-    
-    Use 0x1b4 as the scratch area in boot_params rather than 0x3c.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 4cf4424e7a0f29f251b781f9b5e3655b0645cb7f
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 18:26:18 2007 -0700
-
-    Revert "x86-64: Make arch/x86-64/boot a symlink to arch/i386/boot"
-    
-    This reverts commit b2ad90f4969226fe8cf3edc5330711ed5fc20105.
-    
-    Restore arch/x86_64/boot as a separate directory hierarchy.
-    
-    Conflicts:
-
-commit 8ed1ae1d2f94410811b7cca4b1a426e37652457f
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 17:00:33 2007 -0700
-
-    x86-64: It appears MTRR isn't a required feature after all.
-    
-    MTRR was documented as a required feature, but appears to boot fine
-    without it (tested since Bochs doesn't have MTRR support.)
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 7c616d098579fb790662cdc703f2a0f26ea1668c
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 16:22:57 2007 -0700
-
-    x86 setup: use 0x1e4 as scratch, instead of 0x3c
-    
-    The compressed relocation needs a 4-byte scratch area to obtain
-    its own address.
-    
-    0x3c is at the end of the video area, which is quite constrained -- it
-    only has 6 bytes left (12 if we recycle the obsolete fields which invade
-    this space.)  Define 0x1e4 as a scratch field, and use it.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 5bc1019227e94576e4876d05ee920f59195bce90
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 16:09:15 2007 -0700
-
-    x86 setup: boot_params.e820_map is just the map, not the count; adjust
-    
-    boot_params.e820_map is just a list of entries, whereas
-    "struct e820map" contains a count as well.  Thus, don't use
-    "struct e820map" to describe struct boot_params.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 0f96b52497f444be2d52d1184ca90be49f713ea3
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 15:49:03 2007 -0700
-
-    x86 setup: E820MAX is a definitional constant; no need to use sizeof hacks
-    
-    Now when we're using the standard headers for the setup code, we can use
-    E820MAX instead of playing sizeof games.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 3a23a428b20cbb31fd7ff5516a053b99afc447f7
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 12:08:46 2007 -0700
-
-    x86: move the bootparam structure definition into include/
-    
-    Move the bootparam structure definition into include/, and make other
-    things use it.  Haven't cleaned up all the macros yet, though.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e93ec58911995971aa059990f8a91a02b05f6c8f
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 12:07:50 2007 -0700
-
-    i386: change %lu to %u in arch/i386/kernel/e820.h
-    
-    It's an u32, print it with %u
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 2f47f004f614e2744867c0df274c55d8af2a42d5
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 12:06:04 2007 -0700
-
-    x86: fix differences between i386 and x86-64 <asm/e820.h>
-    
-    Fix minor differences between i386 and x86-64 <asm/e820.h>
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 56ec52f14e948f430af941052adee98019a617b7
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 11:45:17 2007 -0700
-
-    x86: fix the definition of struct screen_info
-    
-    Name the fields that aren't really struct screen_info, and declare
-    the structure packed (the "capabilities" field is misaligned.)
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 1d4429eaa564b0085d9ee3aa2de57e87a093a14e
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 11:43:10 2007 -0700
-
-    x86-64: Make arch/x86-64/boot a symlink to arch/i386/boot
-    
-    Until such time that Kbuild allows for a cleaner solution, make
-    arch/x86-64/boot a symlink to arch/i386/boot.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 6a85f1b5fd041ea99d8604782559ce0502a60cc0
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:42:06 2007 -0700
-
-    x86-64: rearrange includes due to unifications and inclusion from setup
-    
-    Unification caused a circular dependency between <asm/alternative.h>
-    and <asm/cpufeature.h>; resolve this.
-    
-    Add #ifndef _SETUP in <asm/e820.h> so it can be included from the boot
-    code.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit f6bbdc254bdbd5f7cf7a40c4cd6f9844af90824a
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:40:26 2007 -0700
-
-    x86: Complete <asm/cpufeature.h> with the union of i386 and x86-64
-    
-    Add a feature to <asm/cpufeature.h> which was previously present
-    in x86-64 but missing in i386.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 1a0819281060489901732914f67869e0aa8f26fd
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:39:32 2007 -0700
-
-    x86: unify <asm/boot.h>
-    
-    Unify <asm/boot.h> between i386 and x86-64
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 8d9c54585f4623e0310f970fb5c6eda7ec1614df
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:38:35 2007 -0700
-
-    x86-64: verify_cpu.S: use new masks
-    
-    Use the <asm/required-features.h> masks.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 6cf3308646bb7a3210f0f76bcb895b2dea76a93c
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:37:26 2007 -0700
-
-    x86-64: fix compilation errors due to required-features.h change
-    
-    Fix compilation errors induced by required-features.h change.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 1324201a93ce380b46a3128826ecbd794e617e59
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:35:37 2007 -0700
-
-    x86-64: <asm/segment.h>: add boot segment descriptors
-    
-    Add boot segment descriptors to <asm/segment.h> to match i386.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a0b15a9e79ed0310813709cd0690d6838917fe82
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:34:37 2007 -0700
-
-    x86-64: add CONFIG_PHYSICAL_ALIGN to match i386
-    
-    Add CONFIG_PHYSICAL_ALIGN to match i386, even though we don't use it.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 8f5d14d11a7318e257351ae477392c7f7e314602
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 10:33:54 2007 -0700
-
-    x86 setup: cleanups for compatibility with x86-64
-    
-    These changes are necessary to compile on x86-64.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a32f68b6d4023c1c6b1e62e8561189516c571ab9
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Fri May 4 08:40:07 2007 -0700
-
-    x86 setup: add missing linker script
-    
-    Add linker script for the setup code, apparently missing from previous
-    checkins.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 4f34ca8e926b2d0bf3a7502b99f8dfced8cdba9d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 17:42:29 2007 -0700
-
-    x86 setup: paranoia: clear the high half of %esp
-    
-    We're invoked in 16-bit mode from an unknown bootloader.  Make sure
-    we explicitly zero the upper half of %esp to avoid nasty surprises.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 19eb9b73cc1632a923003a002108b242af7a6080
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 17:35:41 2007 -0700
-
-    x86 setup: bootlin is *so* dead...
-    
-    Bootlin was never able to load bzImage kernels, so who cares about it.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 3b9fb73c65151ee043bc74c333d9e3c9b1872125
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 10:56:40 2007 -0700
-
-    x86 setup: apparently $(src) is insufficient, needs $(srctree)/$(src)
-    
-    For some unfanthomable reason the location of the source tree that
-    corresponds to the current directory has to be written as
-    $(srctree)/$(src) apparently.  There might be a good reason for it,
-    but shorthand would be appreciated, and $(src) really should be the
-    short form.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a6d01d375a2269be1e3a6b31bcc4d426ad5a473d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 10:51:45 2007 -0700
-
-    x86 setup: remove reference to obsolete cpureq.c
-    
-    cpureq.c has been removed; remove it from the Makefile too.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit cbe5b7585d800435080bcbf1b1fd242926982674
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 10:33:12 2007 -0700
-
-    x86 setup: use the required masks from <asm/required-features.h>
-    
-    Use the now-uniform features from <asm/required-features.h>.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 99ed30180ecc1bb4e93f6edda5f6bad1adf3e630
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 10:31:12 2007 -0700
-
-    x86: make the handling of required features consistent
-    
-    Make the handling of required features consistent between i386
-    and x86-64.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 1120d70a2be8f2deb6bda64047da288d8f86dad3
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 00:09:53 2007 -0700
-
-    x86: Kconfig.cpu: the minimum CPU model is always 3; WP_WORKS_OK = i486
-    
-    The minimum CPU model number is always 3 (i386), and if we have
-    WP_WORKS_OK it means we need an i486.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit ebc308c204149b86984ae2216f5b9b2e63932028
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Thu May 3 00:08:48 2007 -0700
-
-    x86 setup: use CONFIG_X86_MINIMUM_CPU_MODEL
-    
-    Use CONFIG_X86_MINIMUM_CPU_MODEL as defined in Kconfig.cpu.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 8b50b640e015bf5d0f65502437da6fcab46c391b
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 23:45:42 2007 -0700
-
-    x86 setup: remove bogus "static"
-    
-    Remove invalid "static" declarations in cpu.c
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 35d23b60dfb110da81c24bcbfcda089cfc4fd264
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 23:37:50 2007 -0700
-
-    x86 setup: cpu detection cleanups
-    
-    - Use <asm/processor-flags.h>
-    - Make sure %cr0 isn't in a dangerous configuration before probing the FPU
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a1150a03247b355d11a4bb696b8aae1f46612992
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 23:36:55 2007 -0700
-
-    x86 setup: compile with -DSETUP
-    
-    Define SETUP to make it easier to share code with the rest of the kernel.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 7eb52e8ad1bdf01886023d1a13b3313084cd7db6
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 23:34:57 2007 -0700
-
-    x86 setup: remove unused verify_cpu.S
-    
-    verify_cpu.S is obsoleted by boot/cpu.c.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit e90317a027c30176968220d18eb18bd6a9d9cc74
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 20:07:43 2007 -0700
-
-    x86 setup: files missing from previous checkin (cpu.c, cpureq.c)
-    
-    These files were missing from a previous checkin; CPU feature-checking
-    code and the list of CPU features to check for.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 060f9b3db33c67b5344b2b4110bc823eb776e5cd
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 19:51:34 2007 -0700
-
-    x86 setup: whitespace cleanup
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 9f997a5569ec8fceaa15c2e9cf28e728e2ce118d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 19:07:14 2007 -0700
-
-    x86 setup: add CPU feature detect/abort on insufficient featurage
-    
-    The x86 setup is the right place to check features and abort if they
-    are not present, since we can still get a message to the user via the
-    firmware.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit de4e976376fddec340651ef40b16a45f6189619d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 19:05:34 2007 -0700
-
-    x86 setup: whitespace cleanup
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit bcd2d2f8de5d4568b6628aa133fce1ac40ece526
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 16:19:59 2007 -0700
-
-    x86 setup: tag functions noreturn; error message on A20 failure
-    
-    Tag appropriate functions noreturn.
-    If the A20 gate fails, output an error message and refuse to boot.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 752aef90cbfc888084bf11fd83f8f72b6a668fc9
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 15:45:08 2007 -0700
-
-    x86 setup: clobber registers in keyboard BIOS call
-    
-    Keyboard BIOS call to set repeat rate is known to clobber registers on
-    "many" BIOSes.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit dde94003e4759aab275732cf9f1834440cd381d0
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 15:44:21 2007 -0700
-
-    x86 setup: implement APM BIOS probe
-    
-    APM BIOS probe ported from assembly
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 9403917d79e3349184318704476fa080836bd52c
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 15:17:14 2007 -0700
-
-    x86 setup: remove references to obsolete probes
-    
-    Remove "Hello, World!" as well as references to probes which are no
-    longer used...
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 712f65ffbd1d4b55b4c55d68b4dcd32406c28fb8
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 12:17:15 2007 -0700
-
-    x86 setup: video.c: correct the handling of special mode numbers
-    
-    Special mode numbers with the high bit set need to be handled *before*
-    masking out the high bit.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 9cf083204fe14cda3b09840eba8d131d2e48ccdf
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 11:44:16 2007 -0700
-
-    x86 setup: Modern ATI cards pass the probe but lacks the modes.
-    
-    It appears modern ATI cards pass the probe for ATI-ness but lack the
-    modes.  Kill off the driver as being incorrect.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 890cbe950589e30af17eac9da800efc76e35e01d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 11:32:21 2007 -0700
-
-    x86 setup: a20.c: make empty_8042() return status
-    
-    Make functions which could reasonably return status do so.  It may
-    be relevant in the future, and it's a lot better if the programmer
-    doesn't have to figure out where everything should hook in.
-    
-    Just on principle.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 08a44dc655e0086d23fc3c70cb93eb51eaeec259
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 11:31:03 2007 -0700
-
-    x86 setup: video.c: clean up unused stuff
-    
-    Clean up unused variables that we have no intent on using, as well
-    as other cruft.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 57e69acff1f577de430cae1523fd49a5d113e885
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 11:18:13 2007 -0700
-
-    x86 setup: drop video mode range checking
-    
-    Drop video mode range checking.  If someone really has, say, 12x40 mode
-    visible through the BIOS then allow them to select it... odds are low
-    that it will actually conflict with the very sparse allocation we have
-    anyway.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit c0dda0b90f92d43872d55d295630a71cd357cfa6
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 11:15:53 2007 -0700
-
-    x86 setup: if no specific video mode ID is given, generate one
-    
-    If we don't specify a certain video mode ID in the driver, then
-    generate the 0xRRCC mode ID automatically.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 0db5086e79810e7c5d560006b1c9a7501a02d80c
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 11:10:28 2007 -0700
-
-    x86 setup: Sadly, Cirrus removed extended text modes from their BIOS.
-    
-    In the later era of the Cirrus 54xx series, Cirrus removed extended text
-    modes from their BIOS.  Neither Qemu nor Bochs implement them in the BIOS.
-    If we can find a direct-register-poking method of setting them that
-    works in Bochs/Qemu it might be worthwhile to resurrect this; the probing
-    routine *does* work.
-    
-    Of course, the Right Thing[TM] would be to submit such a routine to the
-    Bochs/Qemu BIOS as a VESA text mode.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 41f3fddeeb764687bf3fb0cf77fd858128571d58
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Wed May 2 10:18:07 2007 -0700
-
-    x86 setup: remove assembly implementation of putchar and puts
-    
-    Already unused, remove assembly implementation of putchar and puts.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit dfa94cd86aca2c01d2f5e14b6e7c3e8258276195
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:41:28 2007 -0700
-
-    x86 setup: Call INT 15h AX=E820h properly
-    
-    The calling convention for BIOS call 15:E820 was messed up.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 2487575a36435c0a983febbb4f3751331bd2df7a
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:34:12 2007 -0700
-
-    x86 setup: advance one e820 descriptor at a time...
-    
-    Adding sizeof(foo) to a foo * is not just useless, it's pretty damaging...
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 530d4f4f1732335ae8725c0b8c332a618e63ea1d
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:33:28 2007 -0700
-
-    x86 setup: fix memcmp_[fg]s()
-    
-    Actually return a value from memcmp_[fg]s()...
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 8617cd56ff2e43303147da012b26c9dd46af726e
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:32:47 2007 -0700
-
-    x86 setup: fix missing semicolon in video-ati.c
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 7bbf7fa3e199b9cef4877c5a56128faff8636cc9
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:26:48 2007 -0700
-
-    x86 setup: make the video setup code actually do something...
-    
-    Basic video setup now works (there is still work to be done, however.)
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 45bcd4406e4b812b32d317d9b3b8db2e5f135a3c
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:25:20 2007 -0700
-
-    x86 setup: segment descriptors need to be Present
-    
-    The segment descriptors were missing the Present bit.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a39479d4ccf4dceffb623ad2ec7e2d708c38c637
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:24:32 2007 -0700
-
-    build: setup sectors doesn't include the boot sector
-    
-    The "setup sectors" field doesn't include the old boot sector,
-    even though the two are now one module.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit d8f3d4928ead72e8febe2fcd740d0fee71a61f42
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:23:44 2007 -0700
-
-    x86 setup: in tty.c, actually tell it what character to print
-    
-    putchar() was missing the actual passing of the character code to the
-    BIOS call, with very silly-looking results.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 4f1462ed0377e180484a223e622d62432baa64b7
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Tue May 1 21:22:46 2007 -0700
-
-    x86 setup: printf.c needs code16gcc.h
-    
-    printf.c was missing code16gcc.h, with predictable consequences.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit a5ba7e6df198bd204b0f87fc6e3f68388b9d14c1
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon Apr 30 20:56:42 2007 -0700
-
-    MAINTAINERS: formally take responsibility for the i386 boot code
-    
-    Change MAINTAINERS to formally take responsibility for the i386 boot code.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-
-commit 6c821fc005655a99eff6e86c2e4b13654de94dea
-Author: H. Peter Anvin <hpa@zytor.com>
-Date:   Mon Apr 30 20:54:07 2007 -0700
-
-    x86 setup code rewrite: initial development snapshot
-    
-    Clean up the setup code and rewrite it in C.
-    This is an initial development snapshot, not a working tree.
-    
-    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
----
-
- MAINTAINERS                                 |    4 
- arch/i386/Kconfig.cpu                       |    4 
- arch/i386/boot/Makefile                     |   45 
- arch/i386/boot/a20.c                        |  161 +
- arch/i386/boot/apm.c                        |   97 
- arch/i386/boot/bitops.h                     |   45 
- arch/i386/boot/boot.h                       |  290 ++
- arch/i386/boot/bootsect.S                   |   98 
- arch/i386/boot/cmdline.c                    |   97 
- arch/i386/boot/code16gcc.h                  |    9 
- arch/i386/boot/compressed/Makefile          |    7 
- arch/i386/boot/compressed/head.S            |    6 
- arch/i386/boot/compressed/misc.c            |    3 
- arch/i386/boot/copy.S                       |  101 
- arch/i386/boot/cpu.c                        |   69 
- arch/i386/boot/cpucheck.c                   |  266 ++
- arch/i386/boot/edd.S                        |  231 --
- arch/i386/boot/edd.c                        |  196 +
- arch/i386/boot/header.S                     |  283 ++
- arch/i386/boot/main.c                       |  161 +
- arch/i386/boot/mca.c                        |   43 
- arch/i386/boot/memory.c                     |   99 
- arch/i386/boot/pm.c                         |  170 +
- arch/i386/boot/pmjump.S                     |   54 
- arch/i386/boot/printf.c                     |  331 ++
- arch/i386/boot/setup.S                      | 1075 ---------
- arch/i386/boot/setup.ld                     |   54 
- arch/i386/boot/string.c                     |   34 
- arch/i386/boot/tools/build.c                |  156 -
- arch/i386/boot/tty.c                        |  112 
- arch/i386/boot/version.c                    |   23 
- arch/i386/boot/vesa.h                       |   79 
- arch/i386/boot/video-bios.c                 |  125 +
- arch/i386/boot/video-vesa.c                 |  283 ++
- arch/i386/boot/video-vga.c                  |  260 ++
- arch/i386/boot/video.S                      | 2043 ------------------
- arch/i386/boot/video.c                      |  456 ++++
- arch/i386/boot/video.h                      |  145 +
- arch/i386/boot/voyager.c                    |   46 
- arch/i386/kernel/cpu/addon_cpuid_features.c |   50 
- arch/i386/kernel/cpu/common.c               |    2 
- arch/i386/kernel/cpu/proc.c                 |   21 
- arch/i386/kernel/e820.c                     |    2 
- arch/i386/kernel/setup.c                    |   12 
- arch/i386/kernel/verify_cpu.S               |   94 
- arch/x86_64/Kconfig                         |    4 
- arch/x86_64/boot/Makefile                   |  136 -
- arch/x86_64/boot/bootsect.S                 |   98 
- arch/x86_64/boot/compressed/Makefile        |    9 
- arch/x86_64/boot/compressed/head.S          |    6 
- arch/x86_64/boot/install.sh                 |    2 
- arch/x86_64/boot/mtools.conf.in             |   17 
- arch/x86_64/boot/setup.S                    |  826 -------
- arch/x86_64/boot/tools/build.c              |  185 -
- arch/x86_64/kernel/Makefile                 |    2 
- arch/x86_64/kernel/setup.c                  |   21 
- arch/x86_64/kernel/verify_cpu.S             |   22 
- drivers/ide/legacy/hd.c                     |   73 
- include/asm-i386/boot.h                     |    6 
- include/asm-i386/bootparam.h                |   85 
- include/asm-i386/cpufeature.h               |   26 
- include/asm-i386/e820.h                     |   14 
- include/asm-i386/processor.h                |    1 
- include/asm-i386/required-features.h        |   37 
- include/asm-i386/setup.h                    |   10 
- include/asm-x86_64/alternative.h            |   68 
- include/asm-x86_64/boot.h                   |   16 
- include/asm-x86_64/bootparam.h              |    1 
- include/asm-x86_64/cpufeature.h             |  115 -
- include/asm-x86_64/e820.h                   |    6 
- include/asm-x86_64/processor.h              |    3 
- include/asm-x86_64/required-features.h      |   46 
- include/asm-x86_64/segment.h                |    8 
- include/linux/edd.h                         |    4 
- include/linux/screen_info.h                 |    9 
- 75 files changed, 4594 insertions(+), 5204 deletions(-)
-
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -1750,8 +1750,8 @@
- S:    Maintained
- i386 BOOT CODE
--P:    Riley H. Williams
--M:    Riley@Williams.Name
-+P:    H. Peter Anvin
-+M:    hpa@zytor.com
- L:    Linux-Kernel@vger.kernel.org
- S:    Maintained
---- a/arch/i386/Kconfig.cpu
-+++ b/arch/i386/Kconfig.cpu
-@@ -346,6 +346,6 @@
- config X86_MINIMUM_CPU_MODEL
-       int
--      default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP
--      default "0"
-+      default "4" if X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK
-+      default "3"
---- a/arch/i386/boot/Makefile
-+++ b/arch/i386/boot/Makefile
-@@ -25,27 +25,53 @@
- #RAMDISK := -DRAMDISK=512
--targets               := vmlinux.bin bootsect bootsect.o \
--                 setup setup.o zImage bzImage
-+targets               := vmlinux.bin setup.bin setup.elf zImage bzImage
- subdir-       := compressed
-+setup-y               += a20.o apm.o cmdline.o copy.o cpu.o cpucheck.o edd.o
-+setup-y               += header.o main.o mca.o memory.o pm.o pmjump.o
-+setup-y               += printf.o string.o tty.o video.o version.o voyager.o
-+
-+# The link order of the video-*.o modules can matter.  In particular,
-+# video-vga.o *must* be listed first, followed by video-vesa.o.
-+# Hardware-specific drivers should follow in the order they should be
-+# probed, and video-bios.o should typically be last.
-+setup-y               += video-vga.o
-+setup-y               += video-vesa.o
-+setup-y               += video-bios.o
-+
- hostprogs-y   := tools/build
- HOSTCFLAGS_build.o := $(LINUXINCLUDE)
- # ---------------------------------------------------------------------------
-+# How to compile the 16-bit code.  Note we always compile for -march=i386,
-+# that way we can complain to the user if the CPU is insufficient.
-+cflags-i386   := 
-+cflags-x86_64 := -m32
-+CFLAGS                := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
-+                 $(cflags-$(ARCH)) \
-+                 -Wall -Wstrict-prototypes \
-+                 -march=i386 -mregparm=3 \
-+                 -include $(srctree)/$(src)/code16gcc.h \
-+                 -fno-strict-aliasing -fomit-frame-pointer \
-+                 $(call cc-option, -ffreestanding) \
-+                 $(call cc-option, -fno-stack-protector)
-+AFLAGS                := $(CFLAGS) -D__ASSEMBLY__
-+
- $(obj)/zImage:  IMAGE_OFFSET := 0x1000
- $(obj)/zImage:  EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK)
- $(obj)/bzImage: IMAGE_OFFSET := 0x100000
-+$(obj)/bzImage: EXTRA_CFLAGS := -D__BIG_KERNEL__
- $(obj)/bzImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) -D__BIG_KERNEL__
- $(obj)/bzImage: BUILDFLAGS   := -b
- quiet_cmd_image = BUILD   $@
--cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/bootsect $(obj)/setup \
-+cmd_image = $(obj)/tools/build $(BUILDFLAGS) $(obj)/setup.bin \
-           $(obj)/vmlinux.bin $(ROOT_DEV) > $@
--$(obj)/zImage $(obj)/bzImage: $(obj)/bootsect $(obj)/setup \
-+$(obj)/zImage $(obj)/bzImage: $(obj)/setup.bin \
-                             $(obj)/vmlinux.bin $(obj)/tools/build FORCE
-       $(call if_changed,image)
-       @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
-@@ -53,12 +79,17 @@
- $(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
-       $(call if_changed,objcopy)
--LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary
--LDFLAGS_setup  := -Ttext 0x0 -s --oformat binary -e begtext
-+SETUP_OBJS = $(addprefix $(obj)/,$(setup-y))
--$(obj)/setup $(obj)/bootsect: %: %.o FORCE
-+LDFLAGS_setup.elf     := -T
-+$(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE
-       $(call if_changed,ld)
-+OBJCOPYFLAGS_setup.bin        := -O binary
-+
-+$(obj)/setup.bin: $(obj)/setup.elf FORCE
-+      $(call if_changed,objcopy)
-+
- $(obj)/compressed/vmlinux: FORCE
-       $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@
---- /dev/null
-+++ b/arch/i386/boot/a20.c
-@@ -0,0 +1,161 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/a20.c
-+ *
-+ * Enable A20 gate (return -1 on failure)
-+ */
-+
-+#include "boot.h"
-+
-+#define MAX_8042_LOOPS        100000
-+
-+static int empty_8042(void)
-+{
-+      u8 status;
-+      int loops = MAX_8042_LOOPS;
-+
-+      while (loops--) {
-+              io_delay();
-+
-+              status = inb(0x64);
-+              if (status & 1) {
-+                      /* Read and discard input data */
-+                      io_delay();
-+                      (void)inb(0x60);
-+              } else if (!(status & 2)) {
-+                      /* Buffers empty, finished! */
-+                      return 0;
-+              }
-+      }
-+
-+      return -1;
-+}
-+
-+/* Returns nonzero if the A20 line is enabled.  The memory address
-+   used as a test is the int $0x80 vector, which should be safe. */
-+
-+#define A20_TEST_ADDR (4*0x80)
-+#define A20_TEST_SHORT  32
-+#define A20_TEST_LONG 2097152 /* 2^21 */
-+
-+static int a20_test(int loops)
-+{
-+      int ok = 0;
-+      int saved, ctr;
-+
-+      set_fs(0x0000);
-+      set_gs(0xffff);
-+
-+      saved = ctr = rdfs32(A20_TEST_ADDR);
-+
-+      while (loops--) {
-+              wrfs32(++ctr, A20_TEST_ADDR);
-+              io_delay();     /* Serialize and make delay constant */
-+              ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr;
-+              if (ok)
-+                      break;
-+      }
-+
-+      wrfs32(saved, A20_TEST_ADDR);
-+      return ok;
-+}
-+
-+/* Quick test to see if A20 is already enabled */
-+static int a20_test_short(void)
-+{
-+      return a20_test(A20_TEST_SHORT);
-+}
-+
-+/* Longer test that actually waits for A20 to come on line; this
-+   is useful when dealing with the KBC or other slow external circuitry. */
-+static int a20_test_long(void)
-+{
-+      return a20_test(A20_TEST_LONG);
-+}
-+
-+static void enable_a20_bios(void)
-+{
-+      asm volatile("pushfl; int $0x15; popfl"
-+                   : : "a" ((u16)0x2401));
-+}
-+
-+static void enable_a20_kbc(void)
-+{
-+      empty_8042();
-+
-+      outb(0xd1, 0x64);       /* Command write */
-+      empty_8042();
-+
-+      outb(0xdf, 0x60);       /* A20 on */
-+      empty_8042();
-+}
-+
-+static void enable_a20_fast(void)
-+{
-+      u8 port_a;
-+
-+      port_a = inb(0x92);     /* Configuration port A */
-+      port_a |=  0x02;        /* Enable A20 */
-+      port_a &= ~0x01;        /* Do not reset machine */
-+      outb(port_a, 0x92);
-+}
-+
-+/*
-+ * Actual routine to enable A20; return 0 on ok, -1 on failure
-+ */
-+
-+#define A20_ENABLE_LOOPS 255  /* Number of times to try */
-+
-+int enable_a20(void)
-+{
-+      int loops = A20_ENABLE_LOOPS;
-+
-+#if defined(CONFIG_X86_ELAN)
-+      /* Elan croaks if we try to touch the KBC */
-+      enable_a20_fast();
-+      while (!a20_test_long())
-+              ;
-+      return 0;
-+#elif defined(CONFIG_X86_VOYAGER)
-+      /* On Voyager, a20_test() is unsafe? */
-+      enable_a20_kbc();
-+      return 0;
-+#else
-+      while (loops--) {
-+              /* First, check to see if A20 is already enabled
-+                 (legacy free, etc.) */
-+              if (a20_test_short())
-+                      return 0;
-+
-+              /* Next, try the BIOS (INT 0x15, AX=0x2401) */
-+              enable_a20_bios();
-+              if (a20_test_short())
-+                      return 0;
-+
-+              /* Try enabling A20 through the keyboard controller */
-+              empty_8042();
-+              if (a20_test_short())
-+                      return 0; /* BIOS worked, but with delayed reaction */
-+
-+              enable_a20_kbc();
-+              if (a20_test_long())
-+                      return 0;
-+
-+              /* Finally, try enabling the "fast A20 gate" */
-+              enable_a20_fast();
-+              if (a20_test_long())
-+                      return 0;
-+      }
-+
-+      return -1;
-+#endif
-+}
---- /dev/null
-+++ b/arch/i386/boot/apm.c
-@@ -0,0 +1,97 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   Original APM BIOS checking by Stephen Rothwell, May 1994
-+ *   (sfr@canb.auug.org.au)
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/apm.c
-+ *
-+ * Get APM BIOS information
-+ */
-+
-+#include "boot.h"
-+
-+#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
-+
-+int query_apm_bios(void)
-+{
-+      u16 ax, bx, cx, dx, di;
-+      u32 ebx, esi;
-+      u8 err;
-+
-+      /* APM BIOS installation check */
-+      ax = 0x5300;
-+      bx = cx = 0;
-+      asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
-+                   : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
-+                   : : "esi", "edi");
-+
-+      if (err)
-+              return -1;              /* No APM BIOS */
-+
-+      if (bx != 0x504d)       /* "PM" signature */
-+              return -1;
-+
-+      if (cx & 0x02)          /* 32 bits supported? */
-+              return -1;
-+
-+      /* Disconnect first, just in case */
-+      ax = 0x5304;
-+      asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
-+                   : "+a" (ax)
-+                   : : "ebx", "ecx", "edx", "esi", "edi");
-+
-+      /* Paranoia */
-+      ebx = esi = 0;
-+      cx = dx = di = 0;
-+
-+      /* 32-bit connect */
-+      asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %6"
-+                   : "=a" (ax), "+b" (ebx), "+c" (cx), "+d" (dx),
-+                     "+S" (esi), "+D" (di), "=m" (err)
-+                   : "a" (0x5303));
-+
-+      boot_params.apm_bios_info.cseg = ax;
-+      boot_params.apm_bios_info.offset = ebx;
-+      boot_params.apm_bios_info.cseg_16 = cx;
-+      boot_params.apm_bios_info.dseg = dx;
-+      boot_params.apm_bios_info.cseg_len = (u16)esi;
-+      boot_params.apm_bios_info.cseg_16_len = esi >> 16;
-+      boot_params.apm_bios_info.dseg_len = di;
-+
-+      if (err)
-+              return -1;
-+
-+      /* Redo the installation check as the 32-bit connect;
-+         some BIOSes return different flags this way... */
-+
-+      ax = 0x5300;
-+      bx = cx = 0;
-+      asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp ; setc %0"
-+                   : "=d" (err), "+a" (ax), "+b" (bx), "+c" (cx)
-+                   : : "esi", "edi");
-+
-+      if (err || bx != 0x504d) {
-+              /* Failure with 32-bit connect, try to disconect and ignore */
-+              ax = 0x5304;
-+              bx = 0;
-+              asm volatile("pushl %%ebp ; int $0x15 ; popl %%ebp"
-+                           : "+a" (ax), "+b" (bx)
-+                           : : "ecx", "edx", "esi", "edi");
-+              return -1;
-+      }
-+
-+      boot_params.apm_bios_info.version = ax;
-+      boot_params.apm_bios_info.flags = cx;
-+      return 0;
-+}
-+
-+#endif
---- /dev/null
-+++ b/arch/i386/boot/bitops.h
-@@ -0,0 +1,45 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/bitops.h
-+ *
-+ * Very simple bitops for the boot code.
-+ */
-+
-+#ifndef BOOT_BITOPS_H
-+#define BOOT_BITOPS_H
-+#define _LINUX_BITOPS_H               /* Inhibit inclusion of <linux/bitops.h> */
-+
-+static inline int constant_test_bit(int nr, const void *addr)
-+{
-+      const u32 *p = (const u32 *)addr;
-+      return ((1UL << (nr & 31)) & (p[nr >> 5])) != 0;
-+}
-+static inline int variable_test_bit(int nr, const void *addr)
-+{
-+      u8 v;
-+      const u32 *p = (const u32 *)addr;
-+
-+      asm("btl %2,%1; setc %0" : "=qm" (v) : "m" (*p), "Ir" (nr));
-+      return v;
-+}
-+
-+#define test_bit(nr,addr) \
-+(__builtin_constant_p(nr) ? \
-+ constant_test_bit((nr),(addr)) : \
-+ variable_test_bit((nr),(addr)))
-+
-+static inline void set_bit(int nr, void *addr)
-+{
-+      asm("btsl %1,%0" : "+m" (*(u32 *)addr) : "Ir" (nr));
-+}
-+
-+#endif /* BOOT_BITOPS_H */
---- /dev/null
-+++ b/arch/i386/boot/boot.h
-@@ -0,0 +1,290 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/boot.h
-+ *
-+ * Header file for the real-mode kernel code
-+ */
-+
-+#ifndef BOOT_BOOT_H
-+#define BOOT_BOOT_H
-+
-+#ifndef __ASSEMBLY__
-+
-+#include <stdarg.h>
-+#include <linux/types.h>
-+#include <linux/edd.h>
-+#include <asm/boot.h>
-+#include <asm/bootparam.h>
-+
-+/* Useful macros */
-+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-+
-+extern struct setup_header hdr;
-+extern struct boot_params boot_params;
-+
-+/* Basic port I/O */
-+static inline void outb(u8 v, u16 port)
-+{
-+      asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
-+}
-+static inline u8 inb(u16 port)
-+{
-+      u8 v;
-+      asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
-+      return v;
-+}
-+
-+static inline void outw(u16 v, u16 port)
-+{
-+      asm volatile("outw %0,%1" : : "a" (v), "dN" (port));
-+}
-+static inline u16 inw(u16 port)
-+{
-+      u16 v;
-+      asm volatile("inw %1,%0" : "=a" (v) : "dN" (port));
-+      return v;
-+}
-+
-+static inline void outl(u32 v, u16 port)
-+{
-+      asm volatile("outl %0,%1" : : "a" (v), "dn" (port));
-+}
-+static inline u32 inl(u32 port)
-+{
-+      u32 v;
-+      asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
-+      return v;
-+}
-+
-+static inline void io_delay(void)
-+{
-+      const u16 DELAY_PORT = 0x80;
-+      asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));
-+}
-+
-+/* These functions are used to reference data in other segments. */
-+
-+static inline u16 ds(void)
-+{
-+      u16 seg;
-+      asm("movw %%ds,%0" : "=rm" (seg));
-+      return seg;
-+}
-+
-+static inline void set_fs(u16 seg)
-+{
-+      asm volatile("movw %0,%%fs" : : "rm" (seg));
-+}
-+static inline u16 fs(void)
-+{
-+      u16 seg;
-+      asm("movw %%fs,%0" : "=rm" (seg));
-+      return seg;
-+}
-+
-+static inline void set_gs(u16 seg)
-+{
-+      asm volatile("movw %0,%%gs" : : "rm" (seg));
-+}
-+static inline u16 gs(void)
-+{
-+      u16 seg;
-+      asm("movw %%gs,%0" : "=rm" (seg));
-+      return seg;
-+}
-+
-+typedef unsigned int addr_t;
-+
-+static inline u8 rdfs8(addr_t addr)
-+{
-+      u8 v;
-+      asm("movb %%fs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
-+      return v;
-+}
-+static inline u16 rdfs16(addr_t addr)
-+{
-+      u16 v;
-+      asm("movw %%fs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
-+      return v;
-+}
-+static inline u32 rdfs32(addr_t addr)
-+{
-+      u32 v;
-+      asm("movl %%fs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
-+      return v;
-+}
-+
-+static inline void wrfs8(u8 v, addr_t addr)
-+{
-+      asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "r" (v));
-+}
-+static inline void wrfs16(u16 v, addr_t addr)
-+{
-+      asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "r" (v));
-+}
-+static inline void wrfs32(u32 v, addr_t addr)
-+{
-+      asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "r" (v));
-+}
-+
-+static inline u8 rdgs8(addr_t addr)
-+{
-+      u8 v;
-+      asm("movb %%gs:%1,%0" : "=r" (v) : "m" (*(u8 *)addr));
-+      return v;
-+}
-+static inline u16 rdgs16(addr_t addr)
-+{
-+      u16 v;
-+      asm("movw %%gs:%1,%0" : "=r" (v) : "m" (*(u16 *)addr));
-+      return v;
-+}
-+static inline u32 rdgs32(addr_t addr)
-+{
-+      u32 v;
-+      asm("movl %%gs:%1,%0" : "=r" (v) : "m" (*(u32 *)addr));
-+      return v;
-+}
-+
-+static inline void wrgs8(u8 v, addr_t addr)
-+{
-+      asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "r" (v));
-+}
-+static inline void wrgs16(u16 v, addr_t addr)
-+{
-+      asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "r" (v));
-+}
-+static inline void wrgs32(u32 v, addr_t addr)
-+{
-+      asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "r" (v));
-+}
-+
-+/* Note: these only return true/false, not a signed return value! */
-+static inline int memcmp(const void *s1, const void *s2, size_t len)
-+{
-+      u8 diff;
-+      asm("repe; cmpsb; setnz %0"
-+          : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
-+      return diff;
-+}
-+
-+static inline int memcmp_fs(const void *s1, addr_t s2, size_t len)
-+{
-+      u8 diff;
-+      asm("fs; repe; cmpsb; setnz %0"
-+          : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
-+      return diff;
-+}
-+static inline int memcmp_gs(const void *s1, addr_t s2, size_t len)
-+{
-+      u8 diff;
-+      asm("gs; repe; cmpsb; setnz %0"
-+          : "=qm" (diff), "+D" (s1), "+S" (s2), "+c" (len));
-+      return diff;
-+}
-+
-+/* Heap -- available for dynamic lists. */
-+#define STACK_SIZE    512     /* Minimum number of bytes for stack */
-+
-+extern char _end[];
-+extern char *HEAP;
-+extern char *heap_end;
-+#define RESET_HEAP() ((void *)( HEAP = _end ))
-+static inline char *__get_heap(size_t s, size_t a, size_t n)
-+{
-+      char *tmp;
-+
-+      HEAP = (char *)(((size_t)HEAP+(a-1)) & ~(a-1));
-+      tmp = HEAP;
-+      HEAP += s*n;
-+      return tmp;
-+}
-+#define GET_HEAP(type, n) \
-+      ((type *)__get_heap(sizeof(type),__alignof__(type),(n)))
-+
-+static inline int heap_free(void)
-+{
-+      return heap_end-HEAP;
-+}
-+
-+/* copy.S */
-+
-+void copy_to_fs(addr_t dst, void *src, size_t len);
-+void *copy_from_fs(void *dst, addr_t src, size_t len);
-+void copy_to_gs(addr_t dst, void *src, size_t len);
-+void *copy_from_gs(void *dst, addr_t src, size_t len);
-+void *memcpy(void *dst, void *src, size_t len);
-+void *memset(void *dst, int c, size_t len);
-+
-+#define memcpy(d,s,l) __builtin_memcpy(d,s,l)
-+#define memset(d,c,l) __builtin_memset(d,c,l)
-+
-+/* a20.c */
-+int enable_a20(void);
-+
-+/* apm.c */
-+int query_apm_bios(void);
-+
-+/* cmdline.c */
-+int cmdline_find_option(const char *option, char *buffer, int bufsize);
-+
-+/* cpu.c, cpucheck.c */
-+int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
-+int validate_cpu(void);
-+
-+/* edd.c */
-+void query_edd(void);
-+
-+/* header.S */
-+void __attribute__((noreturn)) die(void);
-+
-+/* mca.c */
-+int query_mca(void);
-+
-+/* memory.c */
-+int detect_memory(void);
-+
-+/* pm.c */
-+void __attribute__((noreturn)) go_to_protected_mode(void);
-+
-+/* pmjump.S */
-+void __attribute__((noreturn))
-+      protected_mode_jump(u32 entrypoint, u32 bootparams);
-+
-+/* printf.c */
-+unsigned int atou(const char *s);
-+int sprintf(char *buf, const char *fmt, ...);
-+int vsprintf(char *buf, const char *fmt, va_list args);
-+int printf(const char *fmt, ...);
-+
-+/* string.c */
-+int strcmp(const char *str1, const char *str2);
-+
-+/* tty.c */
-+void puts(const char *);
-+void putchar(int);
-+int getchar(void);
-+void kbd_flush(void);
-+int getchar_timeout(void);
-+
-+/* video.c */
-+void set_video(void);
-+
-+/* video-vesa.c */
-+void vesa_store_edid(void);
-+
-+/* voyager.c */
-+int query_voyager(void);
-+
-+#endif /* __ASSEMBLY__ */
-+
-+#endif /* BOOT_BOOT_H */
---- a/arch/i386/boot/bootsect.S
-+++ /dev/null
-@@ -1,98 +0,0 @@
--/*
-- *    bootsect.S              Copyright (C) 1991, 1992 Linus Torvalds
-- *
-- *    modified by Drew Eckhardt
-- *    modified by Bruce Evans (bde)
-- *    modified by Chris Noe (May 1999) (as86 -> gas)
-- *    gutted by H. Peter Anvin (Jan 2003)
-- *
-- * BIG FAT NOTE: We're in real mode using 64k segments.  Therefore segment
-- * addresses must be multiplied by 16 to obtain their respective linear
-- * addresses. To avoid confusion, linear addresses are written using leading
-- * hex while segment addresses are written as segment:offset.
-- *
-- */
--
--#include <asm/boot.h>
--
--SETUPSECTS    = 4                     /* default nr of setup-sectors */
--BOOTSEG               = 0x07C0                /* original address of boot-sector */
--INITSEG               = DEF_INITSEG           /* we move boot here - out of the way */
--SETUPSEG      = DEF_SETUPSEG          /* setup starts here */
--SYSSEG                = DEF_SYSSEG            /* system loaded at 0x10000 (65536) */
--SYSSIZE               = DEF_SYSSIZE           /* system size: # of 16-byte clicks */
--                                      /* to be loaded */
--ROOT_DEV      = 0                     /* ROOT_DEV is now written by "build" */
--SWAP_DEV      = 0                     /* SWAP_DEV is now written by "build" */
--
--#ifndef SVGA_MODE
--#define SVGA_MODE ASK_VGA
--#endif
--
--#ifndef RAMDISK
--#define RAMDISK 0
--#endif
--
--#ifndef ROOT_RDONLY
--#define ROOT_RDONLY 1
--#endif
--
--.code16
--.text
--
--.global _start
--_start:
--
--      # Normalize the start address
--      jmpl    $BOOTSEG, $start2
--
--start2:
--      movw    %cs, %ax
--      movw    %ax, %ds
--      movw    %ax, %es
--      movw    %ax, %ss
--      movw    $0x7c00, %sp
--      sti
--      cld
--
--      movw    $bugger_off_msg, %si
--
--msg_loop:
--      lodsb
--      andb    %al, %al
--      jz      die
--      movb    $0xe, %ah
--      movw    $7, %bx
--      int     $0x10
--      jmp     msg_loop
--
--die:
--      # Allow the user to press a key, then reboot
--      xorw    %ax, %ax
--      int     $0x16
--      int     $0x19
--
--      # int 0x19 should never return.  In case it does anyway,
--      # invoke the BIOS reset code...
--      ljmp    $0xf000,$0xfff0
--
--
--bugger_off_msg:
--      .ascii  "Direct booting from floppy is no longer supported.\r\n"
--      .ascii  "Please use a boot loader program instead.\r\n"
--      .ascii  "\n"
--      .ascii  "Remove disk and press any key to reboot . . .\r\n"
--      .byte   0
--
--
--      # Kernel attributes; used by setup
--
--      .org 497
--setup_sects:  .byte SETUPSECTS
--root_flags:   .word ROOT_RDONLY
--syssize:      .word SYSSIZE
--swap_dev:     .word SWAP_DEV
--ram_size:     .word RAMDISK
--vid_mode:     .word SVGA_MODE
--root_dev:     .word ROOT_DEV
--boot_flag:    .word 0xAA55
---- /dev/null
-+++ b/arch/i386/boot/cmdline.c
-@@ -0,0 +1,97 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/cmdline.c
-+ *
-+ * Simple command-line parser for early boot.
-+ */
-+
-+#include "boot.h"
-+
-+static inline int myisspace(u8 c)
-+{
-+      return c <= ' ';        /* Close enough approximation */
-+}
-+
-+/*
-+ * Find a non-boolean option, that is, "option=argument".  In accordance
-+ * with standard Linux practice, if this option is repeated, this returns
-+ * the last instance on the command line.
-+ *
-+ * Returns the length of the argument (regardless of if it was
-+ * truncated to fit in the buffer), or -1 on not found.
-+ */
-+int cmdline_find_option(const char *option, char *buffer, int bufsize)
-+{
-+      u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr;
-+      addr_t cptr;
-+      char c;
-+      int len = -1;
-+      const char *opptr = NULL;
-+      char *bufptr = buffer;
-+      enum {
-+              st_wordstart,   /* Start of word/after whitespace */
-+              st_wordcmp,     /* Comparing this word */
-+              st_wordskip,    /* Miscompare, skip */
-+              st_bufcpy       /* Copying this to buffer */
-+      } state = st_wordstart;
-+
-+      if (!cmdline_ptr || cmdline_ptr >= 0x100000)
-+              return -1;      /* No command line, or inaccessible */
-+
-+      cptr = cmdline_ptr & 0xf;
-+      set_fs(cmdline_ptr >> 4);
-+
-+      while (cptr < 0x10000 && (c = rdfs8(cptr++))) {
-+              switch (state) {
-+              case st_wordstart:
-+                      if (myisspace(c))
-+                              break;
-+
-+                      /* else */
-+                      state = st_wordcmp;
-+                      opptr = option;
-+                      /* fall through */
-+
-+              case st_wordcmp:
-+                      if (c == '=' && !*opptr) {
-+                              len = 0;
-+                              bufptr = buffer;
-+                              state = st_bufcpy;
-+                      } else if (myisspace(c)) {
-+                              state = st_wordstart;
-+                      } else if (c != *opptr++) {
-+                              state = st_wordskip;
-+                      }
-+                      break;
-+
-+              case st_wordskip:
-+                      if (myisspace(c))
-+                              state = st_wordstart;
-+                      break;
-+
-+              case st_bufcpy:
-+                      if (myisspace(c)) {
-+                              state = st_wordstart;
-+                      } else {
-+                              if (len < bufsize-1)
-+                                      *bufptr++ = c;
-+                              len++;
-+                      }
-+                      break;
-+              }
-+      }
-+
-+      if (bufsize)
-+              *bufptr = '\0';
-+
-+      return len;
-+}
---- /dev/null
-+++ b/arch/i386/boot/code16gcc.h
-@@ -0,0 +1,9 @@
-+/*
-+ * code16gcc.h
-+ *
-+ * This file is -include'd when compiling 16-bit C code.
-+ */
-+
-+#ifndef __ASSEMBLY__
-+asm(".code16gcc");
-+#endif
---- a/arch/i386/boot/compressed/Makefile
-+++ b/arch/i386/boot/compressed/Makefile
-@@ -9,9 +9,14 @@
- EXTRA_AFLAGS  := -traditional
- LDFLAGS_vmlinux := -T
--CFLAGS_misc.o += -fPIC
- hostprogs-y   := relocs
-+CFLAGS  := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
-+         -fno-strict-aliasing -fPIC \
-+         $(call cc-option,-ffreestanding) \
-+         $(call cc-option,-fno-stack-protector)
-+LDFLAGS := -m elf_i386
-+
- $(obj)/vmlinux: $(src)/vmlinux.lds $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
-       $(call if_changed,ld)
-       @:
---- a/arch/i386/boot/compressed/head.S
-+++ b/arch/i386/boot/compressed/head.S
-@@ -45,10 +45,10 @@
-  * at and where we were actually loaded at.  This can only be done
-  * with a short local call on x86.  Nothing  else will tell us what
-  * address we are running at.  The reserved chunk of the real-mode
-- * data at 0x34-0x3f are used as the stack for this calculation.
-- * Only 4 bytes are needed.
-+ * data at 0x1e4 (defined as a scratch field) are used as the stack
-+ * for this calculation. Only 4 bytes are needed.
-  */
--      leal 0x40(%esi), %esp
-+      leal (0x1e4+4)(%esi), %esp
-       call 1f
- 1:    popl %ebp
-       subl $1b, %ebp
---- a/arch/i386/boot/compressed/misc.c
-+++ b/arch/i386/boot/compressed/misc.c
-@@ -11,7 +11,6 @@
- #undef CONFIG_PARAVIRT
- #include <linux/linkage.h>
--#include <linux/vmalloc.h>
- #include <linux/screen_info.h>
- #include <asm/io.h>
- #include <asm/page.h>
-@@ -364,8 +363,10 @@
-       if ((u32)output & (CONFIG_PHYSICAL_ALIGN -1))
-               error("Destination address not CONFIG_PHYSICAL_ALIGN aligned");
-+#ifndef CONFIG_X86_64
-       if (end > ((-__PAGE_OFFSET-(512 <<20)-1) & 0x7fffffff))
-               error("Destination address too large");
-+#endif
- #ifndef CONFIG_RELOCATABLE
-       if ((u32)output != LOAD_PHYSICAL_ADDR)
-               error("Wrong destination address");
---- /dev/null
-+++ b/arch/i386/boot/copy.S
-@@ -0,0 +1,101 @@
-+/* ----------------------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/copy.S
-+ *
-+ * Memory copy routines
-+ */
-+
-+      .code16gcc
-+      .text
-+
-+      .globl  memcpy
-+      .type   memcpy, @function
-+memcpy:
-+      pushw   %si
-+      pushw   %di
-+      movw    %ax, %di
-+      movw    %dx, %si
-+      pushw   %cx
-+      shrw    $2, %cx
-+      rep; movsl
-+      popw    %cx
-+      andw    $3, %cx
-+      rep; movsb
-+      popw    %di
-+      popw    %si
-+      ret
-+      .size   memcpy, .-memcpy
-+
-+      .globl  memset
-+      .type   memset, @function
-+memset:
-+      pushw   %di
-+      movw    %ax, %di
-+      movzbl  %dl, %eax
-+      imull   $0x01010101,%eax
-+      pushw   %cx
-+      shrw    $2, %cx
-+      rep; stosl
-+      popw    %cx
-+      andw    $3, %cx
-+      rep; stosb
-+      popw    %di
-+      ret
-+      .size   memset, .-memset
-+
-+      .globl  copy_from_fs
-+      .type   copy_from_fs, @function
-+copy_from_fs:
-+      pushw   %ds
-+      pushw   %fs
-+      popw    %ds
-+      call    memcpy
-+      popw    %ds
-+      ret
-+      .size   copy_from_fs, .-copy_from_fs
-+
-+      .globl  copy_to_fs
-+      .type   copy_to_fs, @function
-+copy_to_fs:
-+      pushw   %es
-+      pushw   %fs
-+      popw    %es
-+      call    memcpy
-+      popw    %es
-+      ret
-+      .size   copy_to_fs, .-copy_to_fs
-+
-+#if 0 /* Not currently used, but can be enabled as needed */
-+
-+      .globl  copy_from_gs
-+      .type   copy_from_gs, @function
-+copy_from_gs:
-+      pushw   %ds
-+      pushw   %gs
-+      popw    %ds
-+      call    memcpy
-+      popw    %ds
-+      ret
-+      .size   copy_from_gs, .-copy_from_gs
-+      .globl  copy_to_gs
-+
-+      .type   copy_to_gs, @function
-+copy_to_gs:
-+      pushw   %es
-+      pushw   %gs
-+      popw    %es
-+      call    memcpy
-+      popw    %es
-+      ret
-+      .size   copy_to_gs, .-copy_to_gs
-+
-+#endif
---- /dev/null
-+++ b/arch/i386/boot/cpu.c
-@@ -0,0 +1,69 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/cpucheck.c
-+ *
-+ * Check for obligatory CPU features and abort if the features are not
-+ * present.
-+ */
-+
-+#include "boot.h"
-+#include "bitops.h"
-+#include <asm/cpufeature.h>
-+
-+static char *cpu_name(int level)
-+{
-+      static char buf[6];
-+
-+      if (level == 64) {
-+              return "x86-64";
-+      } else {
-+              sprintf(buf, "i%d86", level);
-+              return buf;
-+      }
-+}
-+
-+int validate_cpu(void)
-+{
-+      u32 *err_flags;
-+      int cpu_level, req_level;
-+
-+      check_cpu(&cpu_level, &req_level, &err_flags);
-+
-+      if (cpu_level < req_level) {
-+              printf("This kernel requires an %s CPU, ",
-+                     cpu_name(req_level));
-+              printf("but only detected an %s CPU.\n",
-+                     cpu_name(cpu_level));
-+              return -1;
-+      }
-+
-+      if (err_flags) {
-+              int i, j;
-+              puts("This kernel requires the following features "
-+                   "not present on the CPU:\n");
-+
-+              for (i = 0; i < NCAPINTS; i++) {
-+                      u32 e = err_flags[i];
-+
-+                      for (j = 0; j < 32; j++) {
-+                              if (e & 1)
-+                                      printf("%d:%d ", i, j);
-+
-+                              e >>= 1;
-+                      }
-+              }
-+              putchar('\n');
-+              return -1;
-+      } else {
-+              return 0;
-+      }
-+}
---- /dev/null
-+++ b/arch/i386/boot/cpucheck.c
-@@ -0,0 +1,266 @@
-+/* -*- linux-c -*- ------------------------------------------------------- *
-+ *
-+ *   Copyright (C) 1991, 1992 Linus Torvalds
-+ *   Copyright 2007 rPath, Inc. - All Rights Reserved
-+ *
-+ *   This file is part of the Linux kernel, and is made available under
-+ *   the terms of the GNU General Public License version 2.
-+ *
-+ * ----------------------------------------------------------------------- */
-+
-+/*
-+ * arch/i386/boot/cpu.c
-+ *
-+ * Check for obligatory CPU features and abort if the features are not
-+ * present.  This code should be compilable as 16-, 32- or 64-bit
-+ * code, so be very careful with types and inline assembly.
-+ *
-+ * This code should not contain any messages; that requires an
-+ * additional wrapper.
-+ *
-+ * As written, this code is not safe for inclusion into the kernel
-+ * proper (after FPU initialization, in particular).
-+ */
-+
-+#ifdef _SETUP
-+# include "boot.h"
-+# include "bitops.h"
-+#endif
-+#include <linux/types.h>
-+#include <asm/cpufeature.h>
-+#include <asm/processor-flags.h>
-+#include <asm/required-features.h>
-+#include <asm/msr-index.h>
-+
-+struct cpu_features {
-+      int level;
-+      int model;
-+      u32 flags[NCAPINTS];
-+};
-+
-+static struct cpu_features cpu;
-+static u32 cpu_vendor[3];
-+static u32 err_flags[NCAPINTS];
-+
-+#ifdef CONFIG_X86_64
-+static const int req_level = 64;
-+#elif defined(CONFIG_X86_MINIMUM_CPU_MODEL)
-+static const int req_level = CONFIG_X86_MINIMUM_CPU_MODEL;
-+#else
-+static const int req_level = 3;
-+#endif
-+
-+static const u32 req_flags[NCAPINTS] =
-+{
-+      REQUIRED_MASK0,
-+      REQUIRED_MASK1,
-+      REQUIRED_MASK2,
-+      REQUIRED_MASK3,
-+      REQUIRED_MASK4,
-+      REQUIRED_MASK5,
-+      REQUIRED_MASK6,
-+};
-+
-+#define A32(a,b,c,d) (((d) << 24)+((c) << 16)+((b) << 8)+(a))
-+
-+static int is_amd(void)
-+{
-+      return cpu_vendor[0] == A32('A','u','t','h') &&
-+             cpu_vendor[1] == A32('e','n','t','i') &&
-+             cpu_vendor[2] == A32('c','A','M','D');
-+}
-+
-+static int is_centaur(void)
-+{
-+      return cpu_vendor[0] == A32('C','e','n','t') &&
-+             cpu_vendor[1] == A32('a','u','r','H') &&
-+             cpu_vendor[2] == A32('a','u','l','s'