move the lzma decompressor out of squashfs-lzma patch and into a new patch (i want to use it for initramfs in the future)
SVN-Revision: 7001
This commit is contained in:
parent
d913bf3c49
commit
332fe44ed2
3 changed files with 124 additions and 123 deletions
|
@ -1,114 +1,15 @@
|
||||||
diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inode.c
|
--- linux-2.6.19.old/lib/Makefile 2007-04-18 17:41:22.679403384 +0200
|
||||||
--- linux-2.6.19.old/fs/squashfs/inode.c 2006-12-14 03:13:20.000000000 +0100
|
+++ linux-2.6.19.dev/lib/Makefile 2007-04-18 17:41:43.303268080 +0200
|
||||||
+++ linux-2.6.19.dev/fs/squashfs/inode.c 2006-12-14 03:13:20.000000000 +0100
|
@@ -54,6 +54,7 @@
|
||||||
@@ -4,6 +4,9 @@
|
obj-$(CONFIG_AUDIT_GENERIC) += audit.o
|
||||||
* 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
|
obj-$(CONFIG_SWIOTLB) += swiotlb.o
|
||||||
#include <linux/types.h>
|
+obj-y += LzmaDecode.o
|
||||||
#include <linux/squashfs_fs.h>
|
|
||||||
#include <linux/module.h>
|
|
||||||
@@ -44,6 +48,19 @@
|
|
||||||
|
|
||||||
#include "squashfs.h"
|
hostprogs-y := gen_crc32table
|
||||||
|
clean-files := crc32table.h
|
||||||
+#ifdef SQUASHFS_LZMA
|
--- linux-2.6.19.old/lib/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
+#include "LzmaDecode.h"
|
+++ linux-2.6.19.dev/lib/LzmaDecode.c 2006-12-14 03:13:20.000000000 +0100
|
||||||
+
|
|
||||||
+/* 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 -urN linux-2.6.19.old/fs/squashfs/LzmaDecode.c linux-2.6.19.dev/fs/squashfs/LzmaDecode.c
|
|
||||||
--- linux-2.6.19.old/fs/squashfs/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100
|
|
||||||
+++ linux-2.6.19.dev/fs/squashfs/LzmaDecode.c 2006-12-14 03:13:20.000000000 +0100
|
|
||||||
@@ -0,0 +1,663 @@
|
@@ -0,0 +1,663 @@
|
||||||
+/*
|
+/*
|
||||||
+ LzmaDecode.c
|
+ LzmaDecode.c
|
||||||
|
@ -131,7 +32,7 @@ diff -urN linux-2.6.19.old/fs/squashfs/LzmaDecode.c linux-2.6.19.dev/fs/squashfs
|
||||||
+ to this file, however, are subject to the LGPL or CPL terms.
|
+ to this file, however, are subject to the LGPL or CPL terms.
|
||||||
+*/
|
+*/
|
||||||
+
|
+
|
||||||
+#include "LzmaDecode.h"
|
+#include <linux/LzmaDecode.h>
|
||||||
+
|
+
|
||||||
+#ifndef Byte
|
+#ifndef Byte
|
||||||
+#define Byte unsigned char
|
+#define Byte unsigned char
|
||||||
|
@ -773,9 +674,8 @@ diff -urN linux-2.6.19.old/fs/squashfs/LzmaDecode.c linux-2.6.19.dev/fs/squashfs
|
||||||
+ *outSizeProcessed = nowPos;
|
+ *outSizeProcessed = nowPos;
|
||||||
+ return LZMA_RESULT_OK;
|
+ return LZMA_RESULT_OK;
|
||||||
+}
|
+}
|
||||||
diff -urN linux-2.6.19.old/fs/squashfs/LzmaDecode.h linux-2.6.19.dev/fs/squashfs/LzmaDecode.h
|
--- linux-2.6.19.old/include/linux/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
--- linux-2.6.19.old/fs/squashfs/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
|
+++ linux-2.6.19.dev/include/linux/LzmaDecode.h 2006-12-14 03:13:20.000000000 +0100
|
||||||
+++ linux-2.6.19.dev/fs/squashfs/LzmaDecode.h 2006-12-14 03:13:20.000000000 +0100
|
|
||||||
@@ -0,0 +1,100 @@
|
@@ -0,0 +1,100 @@
|
||||||
+/*
|
+/*
|
||||||
+ LzmaDecode.h
|
+ LzmaDecode.h
|
||||||
|
@ -877,11 +777,4 @@ diff -urN linux-2.6.19.old/fs/squashfs/LzmaDecode.h linux-2.6.19.dev/fs/squashfs
|
||||||
+ UInt32 *outSizeProcessed);
|
+ UInt32 *outSizeProcessed);
|
||||||
+
|
+
|
||||||
+#endif
|
+#endif
|
||||||
diff -urN linux-2.6.19.old/fs/squashfs/Makefile linux-2.6.19.dev/fs/squashfs/Makefile
|
|
||||||
--- linux-2.6.19.old/fs/squashfs/Makefile 2006-12-14 03:13:20.000000000 +0100
|
|
||||||
+++ linux-2.6.19.dev/fs/squashfs/Makefile 2006-12-14 03:13:20.000000000 +0100
|
|
||||||
@@ -5,3 +5,4 @@
|
|
||||||
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
|
||||||
squashfs-y += inode.o
|
|
||||||
squashfs-y += squashfs2_0.o
|
|
||||||
+squashfs-y += LzmaDecode.o
|
|
109
target/linux/generic-2.6/patches/003-squashfs_lzma.patch
Normal file
109
target/linux/generic-2.6/patches/003-squashfs_lzma.patch
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
diff -urN linux-2.6.19.old/fs/squashfs/inode.c linux-2.6.19.dev/fs/squashfs/inode.c
|
||||||
|
--- linux-2.6.19.old/fs/squashfs/inode.c 2006-12-14 03:13:20.000000000 +0100
|
||||||
|
+++ linux-2.6.19.dev/fs/squashfs/inode.c 2006-12-14 03:13:20.000000000 +0100
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
diff -urN linux-2.6.19.old/fs/squashfs/Makefile linux-2.6.19.dev/fs/squashfs/Makefile
|
diff -urN linux-2.6.19.old/fs/squashfs/Makefile linux-2.6.19.dev/fs/squashfs/Makefile
|
||||||
--- linux-2.6.19.old/fs/squashfs/Makefile 2006-12-14 03:13:22.000000000 +0100
|
--- linux-2.6.19.old/fs/squashfs/Makefile 2006-12-14 03:13:22.000000000 +0100
|
||||||
+++ linux-2.6.19.dev/fs/squashfs/Makefile 2006-12-14 03:13:31.000000000 +0100
|
+++ linux-2.6.19.dev/fs/squashfs/Makefile 2006-12-14 03:13:31.000000000 +0100
|
||||||
@@ -4,5 +4,4 @@
|
@@ -4,4 +4,3 @@
|
||||||
|
|
||||||
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
||||||
squashfs-y += inode.o
|
squashfs-y += inode.o
|
||||||
-squashfs-y += squashfs2_0.o
|
-squashfs-y += squashfs2_0.o
|
||||||
squashfs-y += LzmaDecode.o
|
|
||||||
diff -urN linux-2.6.19.old/fs/squashfs/squashfs.h linux-2.6.19.dev/fs/squashfs/squashfs.h
|
diff -urN linux-2.6.19.old/fs/squashfs/squashfs.h linux-2.6.19.dev/fs/squashfs/squashfs.h
|
||||||
--- linux-2.6.19.old/fs/squashfs/squashfs.h 2006-12-14 03:13:20.000000000 +0100
|
--- linux-2.6.19.old/fs/squashfs/squashfs.h 2006-12-14 03:13:20.000000000 +0100
|
||||||
+++ linux-2.6.19.dev/fs/squashfs/squashfs.h 2006-12-14 03:13:31.000000000 +0100
|
+++ linux-2.6.19.dev/fs/squashfs/squashfs.h 2006-12-14 03:13:31.000000000 +0100
|
||||||
|
|
Loading…
Reference in a new issue