diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-09-21 11:25:17 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-09-21 11:25:17 +0000 |
commit | 4296e978da0ab4198aa7f3d823690ee452e300c6 (patch) | |
tree | a5e666785df63064d1322e25030732622082b073 /target/linux/generic-2.6/patches-2.6.21/003-squashfs_lzma.patch | |
parent | e5dc717d220534bd61ee53c010ad050f648170c3 (diff) | |
download | upstream-4296e978da0ab4198aa7f3d823690ee452e300c6.tar.gz upstream-4296e978da0ab4198aa7f3d823690ee452e300c6.tar.bz2 upstream-4296e978da0ab4198aa7f3d823690ee452e300c6.zip |
rename generic-2.6/patches to generic-2.6/patches-2.6.21
SVN-Revision: 12636
Diffstat (limited to 'target/linux/generic-2.6/patches-2.6.21/003-squashfs_lzma.patch')
-rw-r--r-- | target/linux/generic-2.6/patches-2.6.21/003-squashfs_lzma.patch | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/target/linux/generic-2.6/patches-2.6.21/003-squashfs_lzma.patch b/target/linux/generic-2.6/patches-2.6.21/003-squashfs_lzma.patch new file mode 100644 index 0000000000..e476c76162 --- /dev/null +++ b/target/linux/generic-2.6/patches-2.6.21/003-squashfs_lzma.patch @@ -0,0 +1,109 @@ +Index: linux-2.6.21.7/fs/squashfs/inode.c +=================================================================== +--- linux-2.6.21.7.orig/fs/squashfs/inode.c ++++ linux-2.6.21.7/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 @@ static int squashfs_get_sb(struct file_s + 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 @@ SQSH_EXTERN unsigned int squashfs_read_d + 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 @@ SQSH_EXTERN unsigned int squashfs_read_d + bytes = 0; + } else + bytes = stream.total_out; +- ++#endif + up(&msblk->read_data_mutex); + } + +@@ -2045,15 +2075,19 @@ static int __init init_squashfs_fs(void) + 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 @@ out: + + static void __exit exit_squashfs_fs(void) + { ++#ifndef SQUASHFS_LZMA + vfree(stream.workspace); ++#endif + unregister_filesystem(&squashfs_fs_type); + destroy_inodecache(); + } |