diff options
Diffstat (limited to 'target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch')
-rw-r--r-- | target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch | 244 |
1 files changed, 0 insertions, 244 deletions
diff --git a/target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch b/target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch deleted file mode 100644 index 2725f06699..0000000000 --- a/target/linux/generic-2.6/patches-2.6.31/053-squashfs_lzma.patch +++ /dev/null @@ -1,244 +0,0 @@ ---- a/fs/squashfs/Kconfig -+++ b/fs/squashfs/Kconfig -@@ -2,7 +2,6 @@ config SQUASHFS - tristate "SquashFS 4.0 - Squashed file system support" - depends on BLOCK - select CRYPTO -- select CRYPTO_ZLIB - help - Saying Y here includes support for SquashFS 4.0 (a Compressed - Read-Only File System). Squashfs is a highly compressed read-only -@@ -37,6 +36,26 @@ config SQUASHFS_EMBEDDED - - If unsure, say N. - -+config SQUASHFS_SUPPORT_ZLIB -+ bool -+ prompt "Support ZLIB compression" if SQUASHFS_SUPPORT_LZMA -+ depends on SQUASHFS -+ select CRYPTO_ZLIB -+ default y -+ help -+ ZLIB is the default compression used in squashfs. If you are -+ using LZMA compression instead, you can remove support for ZLIB -+ entirely. -+ -+config SQUASHFS_SUPPORT_LZMA -+ bool "Support LZMA compression" -+ depends on SQUASHFS -+ select CRYPTO_UNLZMA -+ help -+ By default SquashFS uses ZLIB compression, however (if your tools -+ support it, you can use LZMA instead, which saves space. -+ -+ - config SQUASHFS_FRAGMENT_CACHE_SIZE - int "Number of fragments cached" if SQUASHFS_EMBEDDED - depends on SQUASHFS ---- a/fs/squashfs/squashfs_fs.h -+++ b/fs/squashfs/squashfs_fs.h -@@ -212,6 +212,7 @@ struct meta_index { - * definitions for structures on disk - */ - #define ZLIB_COMPRESSION 1 -+#define LZMA_COMPRESSION 2 - - struct squashfs_super_block { - __le32 s_magic; ---- a/fs/squashfs/super.c -+++ b/fs/squashfs/super.c -@@ -48,13 +48,76 @@ - #include "squashfs.h" - - --#define SQUASHFS_CRYPTO_ALG "zlib" -+static int squashfs_setup_zlib(struct squashfs_sb_info *msblk) -+{ -+ int err = -EOPNOTSUPP; -+ -+#ifdef CONFIG_SQUASHFS_SUPPORT_ZLIB -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = ZLIB_DECOMP_WINDOWBITS, -+ }, -+ .val = DEF_WBITS, -+ }; -+ -+ msblk->tfm = crypto_alloc_pcomp("zlib", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load zlib crypto module\n"); -+ return PTR_ERR(msblk->tfm); -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); -+ crypto_free_pcomp(msblk->tfm); -+ } -+#endif -+ -+ return err; -+} -+ -+static int squashfs_setup_lzma(struct squashfs_sb_info *msblk) -+{ -+ int err = -EOPNOTSUPP; -+ -+#ifdef CONFIG_SQUASHFS_SUPPORT_LZMA -+ struct { -+ struct nlattr nla; -+ int val; -+ } params = { -+ .nla = { -+ .nla_len = nla_attr_size(sizeof(int)), -+ .nla_type = UNLZMA_DECOMP_OUT_BUFFERS, -+ }, -+ .val = (msblk->block_size / PAGE_CACHE_SIZE) + 1 -+ }; - -+ msblk->tfm = crypto_alloc_pcomp("lzma", 0, -+ CRYPTO_ALG_ASYNC); -+ if (IS_ERR(msblk->tfm)) { -+ ERROR("Failed to load lzma crypto module\n"); -+ return PTR_ERR(msblk->tfm); -+ } -+ -+ err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -+ if (err) { -+ ERROR("Failed to set up decompression parameters\n"); -+ crypto_free_pcomp(msblk->tfm); -+ } -+#endif -+ -+ return err; -+} - - static struct file_system_type squashfs_fs_type; - static struct super_operations squashfs_super_ops; - --static int supported_squashfs_filesystem(short major, short minor, short comp) -+static int supported_squashfs_filesystem(short major, short minor) - { - if (major < SQUASHFS_MAJOR) { - ERROR("Major/Minor mismatch, older Squashfs %d.%d " -@@ -67,9 +130,6 @@ static int supported_squashfs_filesystem - return -EINVAL; - } - -- if (comp != ZLIB_COMPRESSION) -- return -EINVAL; -- - return 0; - } - -@@ -84,16 +144,6 @@ static int squashfs_fill_super(struct su - unsigned short flags; - unsigned int fragments; - u64 lookup_table_start; -- struct { -- struct nlattr nla; -- int val; -- } params = { -- .nla = { -- .nla_len = nla_attr_size(sizeof(int)), -- .nla_type = ZLIB_DECOMP_WINDOWBITS, -- }, -- .val = DEF_WBITS, -- }; - int err; - - TRACE("Entered squashfs_fill_superblock\n"); -@@ -105,21 +155,6 @@ static int squashfs_fill_super(struct su - } - msblk = sb->s_fs_info; - -- msblk->tfm = crypto_alloc_pcomp(SQUASHFS_CRYPTO_ALG, 0, -- CRYPTO_ALG_ASYNC); -- if (IS_ERR(msblk->tfm)) { -- ERROR("Failed to load %s crypto module\n", -- SQUASHFS_CRYPTO_ALG); -- err = PTR_ERR(msblk->tfm); -- goto failed_pcomp; -- } -- -- err = crypto_decompress_setup(msblk->tfm, ¶ms, sizeof(params)); -- if (err) { -- ERROR("Failed to set up decompression parameters\n"); -- goto failure; -- } -- - sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); - if (sblk == NULL) { - ERROR("Failed to allocate squashfs_super_block\n"); -@@ -157,10 +192,28 @@ static int squashfs_fill_super(struct su - goto failed_mount; - } - -+ /* Check block size for sanity */ -+ msblk->block_size = le32_to_cpu(sblk->block_size); -+ if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) -+ goto failed_mount; -+ - /* Check the MAJOR & MINOR versions and compression type */ - err = supported_squashfs_filesystem(le16_to_cpu(sblk->s_major), -- le16_to_cpu(sblk->s_minor), -- le16_to_cpu(sblk->compression)); -+ le16_to_cpu(sblk->s_minor)); -+ if (err < 0) -+ goto failed_mount; -+ -+ switch(le16_to_cpu(sblk->compression)) { -+ case ZLIB_COMPRESSION: -+ err = squashfs_setup_zlib(msblk); -+ break; -+ case LZMA_COMPRESSION: -+ err = squashfs_setup_lzma(msblk); -+ break; -+ default: -+ err = -EINVAL; -+ break; -+ } - if (err < 0) - goto failed_mount; - -@@ -180,11 +233,6 @@ static int squashfs_fill_super(struct su - i_size_read(sb->s_bdev->bd_inode)) - goto failed_mount; - -- /* Check block size for sanity */ -- msblk->block_size = le32_to_cpu(sblk->block_size); -- if (msblk->block_size > SQUASHFS_FILE_MAX_SIZE) -- goto failed_mount; -- - /* - * Check the system page size is not larger than the filesystem - * block size (by default 128K). This is currently not supported. -@@ -316,21 +364,16 @@ allocate_root: - return 0; - - failed_mount: -+ if (msblk->tfm) -+ crypto_free_pcomp(msblk->tfm); - squashfs_cache_delete(msblk->block_cache); - squashfs_cache_delete(msblk->fragment_cache); - squashfs_cache_delete(msblk->read_page); - kfree(msblk->inode_lookup_table); - kfree(msblk->fragment_index); - kfree(msblk->id_table); -- crypto_free_pcomp(msblk->tfm); -- kfree(sb->s_fs_info); -- sb->s_fs_info = NULL; - kfree(sblk); -- return err; -- - failure: -- crypto_free_pcomp(msblk->tfm); --failed_pcomp: - kfree(sb->s_fs_info); - sb->s_fs_info = NULL; - return err; |