mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-10 15:26:14 +02:00
upgrade to squashfs 3.0
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@3431 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
d7d704e4b5
commit
3ad673f492
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,9 @@
|
|||||||
This patch adds LZMA support to the squashfs code, you should also
|
diff -Nur linux-2.4.32/fs/squashfs/inode.c linux-2.4.32-owrt/fs/squashfs/inode.c
|
||||||
change mksquashfs appropriately.
|
--- linux-2.4.32/fs/squashfs/inode.c 2006-03-21 13:06:10.000000000 +0100
|
||||||
|
+++ linux-2.4.32-owrt/fs/squashfs/inode.c 2006-03-21 13:12:07.000000000 +0100
|
||||||
Oleg I. Vdovikin <oleg@cs.msu.su>
|
@@ -4,6 +4,9 @@
|
||||||
|
* Copyright (c) 2002, 2003, 2004, 2005, 2006
|
||||||
--- linuz/fs/squashfs/inode.c 2004-12-15 22:56:47.000000000 +0300
|
* Phillip Lougher <phillip@lougher.org.uk>
|
||||||
+++ linux/fs/squashfs/inode.c 2005-01-20 20:27:27.490010968 +0300
|
|
||||||
@@ -3,6 +3,9 @@
|
|
||||||
*
|
|
||||||
* Copyright (c) 2002, 2003, 2004 Phillip Lougher <plougher@users.sourceforge.net>
|
|
||||||
*
|
*
|
||||||
+ * LZMA decompressor support added by Oleg I. Vdovikin
|
+ * LZMA decompressor support added by Oleg I. Vdovikin
|
||||||
+ * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
|
+ * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
|
||||||
@ -15,21 +11,17 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2,
|
* as published by the Free Software Foundation; either version 2,
|
||||||
@@ -21,7 +24,11 @@
|
@@ -21,6 +24,7 @@
|
||||||
* inode.c
|
* inode.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
+#define SQUASHFS_LZMA
|
+#define SQUASHFS_LZMA
|
||||||
+
|
|
||||||
+#ifndef SQUASHFS_LZMA
|
|
||||||
#define SQUASHFS_1_0_COMPATIBILITY
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/squashfs_fs.h>
|
#include <linux/squashfs_fs.h>
|
||||||
@@ -39,6 +46,19 @@
|
#include <linux/module.h>
|
||||||
#include <linux/blkdev.h>
|
@@ -40,6 +44,20 @@
|
||||||
#include <linux/vmalloc.h>
|
|
||||||
|
#include "squashfs.h"
|
||||||
|
|
||||||
+#ifdef SQUASHFS_LZMA
|
+#ifdef SQUASHFS_LZMA
|
||||||
+#include "LzmaDecode.h"
|
+#include "LzmaDecode.h"
|
||||||
@ -40,16 +32,17 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
+#define LZMA_PB 2
|
+#define LZMA_PB 2
|
||||||
+
|
+
|
||||||
+#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
|
+#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
|
||||||
+ (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
|
+ (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
|
||||||
+
|
+
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
#ifdef SQUASHFS_TRACE
|
+
|
||||||
#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args)
|
static struct super_block *squashfs_read_super(struct super_block *, void *, int);
|
||||||
#else
|
static void squashfs_put_super(struct super_block *);
|
||||||
@@ -77,7 +97,11 @@
|
static int squashfs_statfs(struct super_block *, struct statfs *);
|
||||||
|
@@ -53,7 +71,11 @@
|
||||||
DECLARE_MUTEX(read_data_mutex);
|
int readahead_blks, char *block_list,
|
||||||
|
unsigned short **block_p, unsigned int *bsize);
|
||||||
|
|
||||||
+#ifdef SQUASHFS_LZMA
|
+#ifdef SQUASHFS_LZMA
|
||||||
+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
|
+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
|
||||||
@ -59,14 +52,14 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
|
|
||||||
static DECLARE_FSTYPE_DEV(squashfs_fs_type, "squashfs", squashfs_read_super);
|
static DECLARE_FSTYPE_DEV(squashfs_fs_type, "squashfs", squashfs_read_super);
|
||||||
|
|
||||||
@@ -232,6 +256,15 @@
|
@@ -229,6 +251,15 @@
|
||||||
if(compressed) {
|
if (compressed) {
|
||||||
int zlib_err;
|
int zlib_err;
|
||||||
|
|
||||||
+#ifdef SQUASHFS_LZMA
|
+#ifdef SQUASHFS_LZMA
|
||||||
+ if ((zlib_err = LzmaDecode(lzma_workspace,
|
+ if ((zlib_err = LzmaDecode(lzma_workspace,
|
||||||
+ LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
|
+ LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
|
||||||
+ c_buffer, c_byte, buffer, msBlk->read_size, &bytes)) != LZMA_RESULT_OK)
|
+ c_buffer, c_byte, buffer, msblk->read_size, &bytes)) != LZMA_RESULT_OK)
|
||||||
+ {
|
+ {
|
||||||
+ ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
|
+ ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
|
||||||
+ bytes = 0;
|
+ bytes = 0;
|
||||||
@ -75,20 +68,20 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
stream.next_in = c_buffer;
|
stream.next_in = c_buffer;
|
||||||
stream.avail_in = c_byte;
|
stream.avail_in = c_byte;
|
||||||
stream.next_out = buffer;
|
stream.next_out = buffer;
|
||||||
@@ -243,6 +276,7 @@
|
@@ -243,6 +274,7 @@
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
} else
|
} else
|
||||||
bytes = stream.total_out;
|
bytes = stream.total_out;
|
||||||
+#endif
|
+#endif
|
||||||
up(&read_data_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1491,17 +1525,21 @@
|
up(&msblk->read_data_mutex);
|
||||||
static int __init init_squashfs_fs(void)
|
}
|
||||||
{
|
@@ -2004,17 +2036,21 @@
|
||||||
|
printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
|
||||||
|
"Phillip Lougher\n");
|
||||||
|
|
||||||
+#ifndef SQUASHFS_LZMA
|
+#ifndef SQUASHFS_LZMA
|
||||||
if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) {
|
if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) {
|
||||||
ERROR("Failed to allocate zlib workspace\n");
|
ERROR("Failed to allocate zlib workspace\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@ -105,8 +98,9 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
unregister_filesystem(&squashfs_fs_type);
|
unregister_filesystem(&squashfs_fs_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
--- linuz/fs/squashfs/LzmaDecode.c 1970-01-01 03:00:00.000000000 +0300
|
diff -Nur linux-2.4.32/fs/squashfs/LzmaDecode.c linux-2.4.32-owrt/fs/squashfs/LzmaDecode.c
|
||||||
+++ linux/fs/squashfs/LzmaDecode.c 2005-01-20 19:40:35.400513552 +0300
|
--- linux-2.4.32/fs/squashfs/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ linux-2.4.32-owrt/fs/squashfs/LzmaDecode.c 2006-03-21 13:06:33.000000000 +0100
|
||||||
@@ -0,0 +1,663 @@
|
@@ -0,0 +1,663 @@
|
||||||
+/*
|
+/*
|
||||||
+ LzmaDecode.c
|
+ LzmaDecode.c
|
||||||
@ -771,8 +765,9 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
+ *outSizeProcessed = nowPos;
|
+ *outSizeProcessed = nowPos;
|
||||||
+ return LZMA_RESULT_OK;
|
+ return LZMA_RESULT_OK;
|
||||||
+}
|
+}
|
||||||
--- linuz/fs/squashfs/LzmaDecode.h 1970-01-01 03:00:00.000000000 +0300
|
diff -Nur linux-2.4.32/fs/squashfs/LzmaDecode.h linux-2.4.32-owrt/fs/squashfs/LzmaDecode.h
|
||||||
+++ linux/fs/squashfs/LzmaDecode.h 2005-01-20 19:40:36.794301664 +0300
|
--- linux-2.4.32/fs/squashfs/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ linux-2.4.32-owrt/fs/squashfs/LzmaDecode.h 2006-03-21 13:06:33.000000000 +0100
|
||||||
@@ -0,0 +1,100 @@
|
@@ -0,0 +1,100 @@
|
||||||
+/*
|
+/*
|
||||||
+ LzmaDecode.h
|
+ LzmaDecode.h
|
||||||
@ -874,14 +869,15 @@ Oleg I. Vdovikin <oleg@cs.msu.su>
|
|||||||
+ UInt32 *outSizeProcessed);
|
+ UInt32 *outSizeProcessed);
|
||||||
+
|
+
|
||||||
+#endif
|
+#endif
|
||||||
--- linuz/fs/squashfs/Makefile 2004-12-15 22:56:47.000000000 +0300
|
diff -Nur linux-2.4.32/fs/squashfs/Makefile linux-2.4.32-owrt/fs/squashfs/Makefile
|
||||||
+++ linux/fs/squashfs/Makefile 2005-01-19 23:04:25.000000000 +0300
|
--- linux-2.4.32/fs/squashfs/Makefile 2006-03-21 13:06:10.000000000 +0100
|
||||||
|
+++ linux-2.4.32-owrt/fs/squashfs/Makefile 2006-03-21 13:12:39.000000000 +0100
|
||||||
@@ -4,7 +4,7 @@
|
@@ -4,7 +4,7 @@
|
||||||
|
|
||||||
O_TARGET := squashfs.o
|
O_TARGET := squashfs.o
|
||||||
|
|
||||||
-obj-y := inode.o
|
-obj-y := inode.o squashfs2_0.o
|
||||||
+obj-y := inode.o LzmaDecode.o
|
+obj-y := inode.o squashfs2_0.o LzmaDecode.o
|
||||||
|
|
||||||
obj-m := $(O_TARGET)
|
obj-m := $(O_TARGET)
|
||||||
|
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
diff -Nur linux-2.4.32/fs/squashfs/Makefile linux-2.4.32-owrt/fs/squashfs/Makefile
|
||||||
|
--- linux-2.4.32/fs/squashfs/Makefile 2006-03-21 13:47:50.000000000 +0100
|
||||||
|
+++ linux-2.4.32-owrt/fs/squashfs/Makefile 2006-03-21 13:48:49.000000000 +0100
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
O_TARGET := squashfs.o
|
||||||
|
|
||||||
|
-obj-y := inode.o squashfs2_0.o LzmaDecode.o
|
||||||
|
+obj-y := inode.o LzmaDecode.o
|
||||||
|
|
||||||
|
obj-m := $(O_TARGET)
|
||||||
|
|
||||||
|
diff -Nur linux-2.4.32/fs/squashfs/squashfs.h linux-2.4.32-owrt/fs/squashfs/squashfs.h
|
||||||
|
--- linux-2.4.32/fs/squashfs/squashfs.h 2006-03-21 13:06:10.000000000 +0100
|
||||||
|
+++ linux-2.4.32-owrt/fs/squashfs/squashfs.h 2006-03-21 13:48:36.000000000 +0100
|
||||||
|
@@ -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)
|
||||||
|
#else
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,113 @@
|
|||||||
diff -Nur linux-2.6.12.5-brcm-squashfs/fs/squashfs/LzmaDecode.c linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/LzmaDecode.c
|
diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
|
||||||
--- linux-2.6.12.5-brcm-squashfs/fs/squashfs/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100
|
--- linux-2.6.16/fs/squashfs/inode.c 2006-03-21 10:55:59.000000000 +0100
|
||||||
+++ linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/LzmaDecode.c 2005-08-29 00:02:44.099124176 +0200
|
+++ linux-2.6.16-owrt/fs/squashfs/inode.c 2006-03-21 12:24:37.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 "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 super_block *, struct kstatfs *);
|
||||||
|
static int squashfs_symlink_readpage(struct file *file, struct page *page);
|
||||||
|
@@ -64,7 +81,11 @@
|
||||||
|
const char *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
+#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,6 +293,7 @@
|
||||||
|
bytes = 0;
|
||||||
|
} else
|
||||||
|
bytes = stream.total_out;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
up(&msblk->read_data_mutex);
|
||||||
|
}
|
||||||
|
@@ -2046,15 +2077,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();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2065,7 +2100,9 @@
|
||||||
|
|
||||||
|
static void __exit exit_squashfs_fs(void)
|
||||||
|
{
|
||||||
|
+#ifndef SQUASHFS_LZMA
|
||||||
|
vfree(stream.workspace);
|
||||||
|
+#endif
|
||||||
|
unregister_filesystem(&squashfs_fs_type);
|
||||||
|
destroy_inodecache();
|
||||||
|
}
|
||||||
|
diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/LzmaDecode.c
|
||||||
|
--- linux-2.6.16/fs/squashfs/LzmaDecode.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ linux-2.6.16-owrt/fs/squashfs/LzmaDecode.c 2006-03-21 10:56:57.000000000 +0100
|
||||||
@@ -0,0 +1,663 @@
|
@@ -0,0 +1,663 @@
|
||||||
+/*
|
+/*
|
||||||
+ LzmaDecode.c
|
+ LzmaDecode.c
|
||||||
@ -665,9 +772,9 @@ diff -Nur linux-2.6.12.5-brcm-squashfs/fs/squashfs/LzmaDecode.c linux-2.6.12.5-b
|
|||||||
+ *outSizeProcessed = nowPos;
|
+ *outSizeProcessed = nowPos;
|
||||||
+ return LZMA_RESULT_OK;
|
+ return LZMA_RESULT_OK;
|
||||||
+}
|
+}
|
||||||
diff -Nur linux-2.6.12.5-brcm-squashfs/fs/squashfs/LzmaDecode.h linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/LzmaDecode.h
|
diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/LzmaDecode.h
|
||||||
--- linux-2.6.12.5-brcm-squashfs/fs/squashfs/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
|
--- linux-2.6.16/fs/squashfs/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
+++ linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/LzmaDecode.h 2005-08-29 00:02:44.099124176 +0200
|
+++ linux-2.6.16-owrt/fs/squashfs/LzmaDecode.h 2006-03-21 10:56:57.000000000 +0100
|
||||||
@@ -0,0 +1,100 @@
|
@@ -0,0 +1,100 @@
|
||||||
+/*
|
+/*
|
||||||
+ LzmaDecode.h
|
+ LzmaDecode.h
|
||||||
@ -769,122 +876,11 @@ diff -Nur linux-2.6.12.5-brcm-squashfs/fs/squashfs/LzmaDecode.h linux-2.6.12.5-b
|
|||||||
+ UInt32 *outSizeProcessed);
|
+ UInt32 *outSizeProcessed);
|
||||||
+
|
+
|
||||||
+#endif
|
+#endif
|
||||||
diff -Nur linux-2.6.12.5-brcm-squashfs/fs/squashfs/Makefile linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/Makefile
|
diff -Nur linux-2.6.16/fs/squashfs/Makefile linux-2.6.16-owrt/fs/squashfs/Makefile
|
||||||
--- linux-2.6.12.5-brcm-squashfs/fs/squashfs/Makefile 2005-08-28 23:44:05.046246000 +0200
|
--- linux-2.6.16/fs/squashfs/Makefile 2006-03-21 10:55:59.000000000 +0100
|
||||||
+++ linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/Makefile 2005-08-29 00:06:21.872017664 +0200
|
+++ linux-2.6.16-owrt/fs/squashfs/Makefile 2006-03-21 10:57:08.000000000 +0100
|
||||||
@@ -4,4 +4,4 @@
|
@@ -5,3 +5,4 @@
|
||||||
|
|
||||||
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
||||||
|
squashfs-y += inode.o
|
||||||
-squashfs-objs := inode.o
|
squashfs-y += squashfs2_0.o
|
||||||
+squashfs-objs := inode.o LzmaDecode.o
|
+squashfs-y += LzmaDecode.o
|
||||||
diff -Nur linux-2.6.12.5-brcm-squashfs/fs/squashfs/inode.c linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/inode.c
|
|
||||||
--- linux-2.6.12.5-brcm-squashfs/fs/squashfs/inode.c 2005-08-28 23:44:05.045246000 +0200
|
|
||||||
+++ linux-2.6.12.5-brcm-squashfs-lzma/fs/squashfs/inode.c 2005-08-29 00:19:48.473476904 +0200
|
|
||||||
@@ -3,6 +3,9 @@
|
|
||||||
*
|
|
||||||
* Copyright (c) 2002, 2003, 2004, 2005 Phillip Lougher <phillip@lougher.demon.co.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,
|
|
||||||
@@ -20,7 +23,11 @@
|
|
||||||
* inode.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#define SQUASHFS_LZMA
|
|
||||||
+
|
|
||||||
+#ifndef SQUASHFS_LZMA
|
|
||||||
#define SQUASHFS_1_0_COMPATIBILITY
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#include <linux/types.h>
|
|
||||||
#include <linux/squashfs_fs.h>
|
|
||||||
@@ -43,6 +50,19 @@
|
|
||||||
#include <linux/blkdev.h>
|
|
||||||
#include <linux/vmalloc.h>
|
|
||||||
|
|
||||||
+#ifdef SQUASHFS_LZMA
|
|
||||||
+#include "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
|
|
||||||
+
|
|
||||||
#ifdef SQUASHFS_TRACE
|
|
||||||
#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args)
|
|
||||||
#else
|
|
||||||
@@ -85,7 +105,11 @@
|
|
||||||
|
|
||||||
DECLARE_MUTEX(read_data_mutex);
|
|
||||||
|
|
||||||
+#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,
|
|
||||||
@@ -274,6 +298,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;
|
|
||||||
@@ -285,6 +318,7 @@
|
|
||||||
bytes = 0;
|
|
||||||
} else
|
|
||||||
bytes = stream.total_out;
|
|
||||||
+#endif
|
|
||||||
up(&read_data_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1725,14 +1759,17 @@
|
|
||||||
|
|
||||||
printk(KERN_INFO "Squashfs 2.2 (released 2005/07/03) (C) 2002-2005 Phillip Lougher\n");
|
|
||||||
|
|
||||||
+#ifndef SQUASHFS_LZMA
|
|
||||||
if(!(stream.workspace = (char *) vmalloc(zlib_inflate_workspacesize()))) {
|
|
||||||
ERROR("Failed to allocate zlib workspace\n");
|
|
||||||
destroy_inodecache();
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+#endif
|
|
||||||
if((err = register_filesystem(&squashfs_fs_type))) {
|
|
||||||
+#ifndef SQUASHFS_LZMA
|
|
||||||
vfree(stream.workspace);
|
|
||||||
+#endif
|
|
||||||
destroy_inodecache();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1742,7 +1779,9 @@
|
|
||||||
|
|
||||||
static void __exit exit_squashfs_fs(void)
|
|
||||||
{
|
|
||||||
+#ifndef SQUASHFS_LZMA
|
|
||||||
vfree(stream.workspace);
|
|
||||||
+#endif
|
|
||||||
unregister_filesystem(&squashfs_fs_type);
|
|
||||||
destroy_inodecache();
|
|
||||||
}
|
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
diff -Nur linux-2.6.16/fs/squashfs/Makefile linux-2.6.16-owrt/fs/squashfs/Makefile
|
||||||
|
--- linux-2.6.16/fs/squashfs/Makefile 2006-03-21 13:50:31.000000000 +0100
|
||||||
|
+++ linux-2.6.16-owrt/fs/squashfs/Makefile 2006-03-21 13:51:09.000000000 +0100
|
||||||
|
@@ -4,5 +4,4 @@
|
||||||
|
|
||||||
|
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
||||||
|
squashfs-y += inode.o
|
||||||
|
-squashfs-y += squashfs2_0.o
|
||||||
|
squashfs-y += LzmaDecode.o
|
||||||
|
diff -Nur linux-2.6.16/fs/squashfs/squashfs.h linux-2.6.16-owrt/fs/squashfs/squashfs.h
|
||||||
|
--- linux-2.6.16/fs/squashfs/squashfs.h 2006-03-21 10:55:59.000000000 +0100
|
||||||
|
+++ linux-2.6.16-owrt/fs/squashfs/squashfs.h 2006-03-21 13:50:58.000000000 +0100
|
||||||
|
@@ -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)
|
@ -1,22 +1,25 @@
|
|||||||
--- squashfs2.0/squashfs-tools/Makefile 2004-04-30 19:29:35.000000000 +0400
|
diff -Nur squashfs3.0/squashfs-tools/Makefile squashfs3.0-owrt/squashfs-tools/Makefile
|
||||||
+++ squashfs-tools/Makefile 2005-01-20 14:57:53.423668596 +0300
|
--- squashfs3.0/squashfs-tools/Makefile 2006-03-15 22:36:20.000000000 +0100
|
||||||
@@ -1,12 +1,18 @@
|
+++ squashfs3.0-owrt/squashfs-tools/Makefile 2006-03-21 11:14:08.000000000 +0100
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
INCLUDEDIR = .
|
INCLUDEDIR = .
|
||||||
+#LZMAPATH = ../lzma/SRC/7zip/Compress/LZMA_Lib
|
+#LZMAPATH = ../lzma/SRC/7zip/Compress/LZMA_Lib
|
||||||
|
|
||||||
CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2
|
CFLAGS := -I$(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2
|
||||||
|
|
||||||
|
@@ -7,6 +8,9 @@
|
||||||
mksquashfs: mksquashfs.o read_fs.o sort.o
|
mksquashfs: mksquashfs.o read_fs.o sort.o
|
||||||
$(CC) mksquashfs.o read_fs.o sort.o -lz -o $@
|
$(CC) mksquashfs.o read_fs.o sort.o -lz -o $@
|
||||||
|
|
||||||
+mksquashfs-lzma: mksquashfs.o read_fs.o sort.o
|
+mksquashfs-lzma: mksquashfs.o read_fs.o sort.o
|
||||||
+ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma -o $@
|
+ $(CXX) mksquashfs.o read_fs.o sort.o -L$(LZMAPATH) -llzma -o $@
|
||||||
+
|
+
|
||||||
mksquashfs.o: mksquashfs.c mksquashfs.h
|
mksquashfs.o: mksquashfs.c squashfs_fs.h mksquashfs.h global.h sort.h
|
||||||
|
|
||||||
read_fs.o: read_fs.c read_fs.h
|
read_fs.o: read_fs.c squashfs_fs.h read_fs.h global.h
|
||||||
|
@@ -17,3 +21,5 @@
|
||||||
|
$(CC) unsquashfs.o -lz -o $@
|
||||||
|
|
||||||
sort.o: sort.c
|
unsquashfs.o: unsquashfs.c squashfs_fs.h read_fs.h global.h
|
||||||
+
|
+
|
||||||
+clean:
|
+clean:
|
||||||
+ rm -f *.o mksquashfs mksquashfs-lzma
|
|
||||||
|
Loading…
Reference in New Issue
Block a user