summaryrefslogtreecommitdiff
path: root/target/linux/generic-2.6/patches/002-squashfs_lzma.patch
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-12-14 16:41:33 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-12-14 16:41:33 +0000
commitc92885c466d11dc3b8e2837a8be1fd3b6b7e2e01 (patch)
tree1a38200fe1a33cb965650ca687167175938fbedd /target/linux/generic-2.6/patches/002-squashfs_lzma.patch
parenta8131d463830012d225fa1032222c3a38b168778 (diff)
Upgrade to Linux 2.6.19
- Includes large parts of the patch from #1021 by dpalffy - Includes RB532 NAND driver changes by n0-1 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5789 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic-2.6/patches/002-squashfs_lzma.patch')
-rw-r--r--target/linux/generic-2.6/patches/002-squashfs_lzma.patch113
1 files changed, 57 insertions, 56 deletions
diff --git a/target/linux/generic-2.6/patches/002-squashfs_lzma.patch b/target/linux/generic-2.6/patches/002-squashfs_lzma.patch
index a166e84971..f32692bae5 100644
--- a/target/linux/generic-2.6/patches/002-squashfs_lzma.patch
+++ b/target/linux/generic-2.6/patches/002-squashfs_lzma.patch
@@ -1,6 +1,6 @@
-diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
---- linux-2.6.16/fs/squashfs/inode.c 2006-03-21 10:55:59.000000000 +0100
-+++ linux-2.6.16-owrt/fs/squashfs/inode.c 2006-03-21 12:24:37.000000000 +0100
+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>
@@ -37,10 +37,10 @@ diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
+#endif
+
static void squashfs_put_super(struct super_block *);
- static int squashfs_statfs(struct super_block *, struct kstatfs *);
+ 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 *);
+ const char *, void *, struct vfsmount *);
+#ifdef SQUASHFS_LZMA
@@ -56,8 +56,8 @@ diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
int zlib_err;
+#ifdef SQUASHFS_LZMA
-+ if ((zlib_err = LzmaDecode(lzma_workspace,
-+ LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
++ 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);
@@ -67,15 +67,16 @@ diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
stream.next_in = c_buffer;
stream.avail_in = c_byte;
stream.next_out = buffer;
-@@ -263,6 +293,7 @@
+@@ -263,7 +293,7 @@
bytes = 0;
} else
bytes = stream.total_out;
+-
+#endif
-
up(&msblk->read_data_mutex);
}
-@@ -2046,15 +2077,19 @@
+
+@@ -2045,15 +2075,19 @@
printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
"Phillip Lougher\n");
@@ -95,7 +96,7 @@ diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
destroy_inodecache();
}
-@@ -2065,7 +2100,9 @@
+@@ -2064,7 +2098,9 @@
static void __exit exit_squashfs_fs(void)
{
@@ -105,28 +106,28 @@ diff -Nur linux-2.6.16/fs/squashfs/inode.c linux-2.6.16-owrt/fs/squashfs/inode.c
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
+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 @@
+/*
+ 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
++ 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
++ 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.
+*/
+
@@ -200,7 +201,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ rd->Code = (rd->Code << 8) | ReadByte;
+}
+
-+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
++#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; }
+
@@ -268,7 +269,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ { 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, ; , ;)
++#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
+
+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
+{
@@ -318,7 +319,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+}
+
+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
-+{
++{
+ int symbol = 1;
+ #ifdef _LZMA_LOC_OPT
+ RC_INIT_VAR
@@ -340,7 +341,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+}
+
+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
-+{
++{
+ int symbol = 1;
+ #ifdef _LZMA_LOC_OPT
+ RC_INIT_VAR
@@ -395,7 +396,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+#define LenLow (LenChoice2 + 1)
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
-+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
++#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
+
+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
+{
@@ -405,7 +406,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
+ return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
+ (posState << kLenNumMidBits), kLenNumMidBits, rd);
-+ return kLenNumLowSymbols + kLenNumMidSymbols +
++ return kLenNumLowSymbols + kLenNumMidSymbols +
+ RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
+}
+
@@ -488,8 +489,8 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ vs->RemainLen = 0;
+ dictionary[dictionarySize - 1] = 0;
+ for (i = 0; i < numProbs; i++)
-+ p[i] = kBitModelTotal >> 1;
-+ RangeDecoderInit(&vs->RangeDecoder,
++ p[i] = kBitModelTotal >> 1;
++ RangeDecoderInit(&vs->RangeDecoder,
+ #ifdef _LZMA_IN_CB
+ inCallback
+ #else
@@ -499,7 +500,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ return LZMA_RESULT_OK;
+}
+
-+int LzmaDecode(unsigned char *buffer,
++int LzmaDecode(unsigned char *buffer,
+ unsigned char *outStream, UInt32 outSize,
+ UInt32 *outSizeProcessed)
+{
@@ -569,8 +570,8 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ if (bufferSize < numProbs * sizeof(CProb))
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
+ for (i = 0; i < numProbs; i++)
-+ p[i] = kBitModelTotal >> 1;
-+ RangeDecoderInit(&rd,
++ p[i] = kBitModelTotal >> 1;
++ RangeDecoderInit(&rd,
+ #ifdef _LZMA_IN_CB
+ inCallback
+ #else
@@ -583,7 +584,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ while(nowPos < outSize)
+ {
+ int posState = (int)(
-+ (nowPos
++ (nowPos
+ #ifdef _LZMA_OUT_READ
+ + globalPos
+ #endif
@@ -597,9 +598,9 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ return LZMA_RESULT_DATA_ERROR;
+ if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
+ {
-+ CProb *probs = p + Literal + (LZMA_LIT_SIZE *
++ CProb *probs = p + Literal + (LZMA_LIT_SIZE *
+ (((
-+ (nowPos
++ (nowPos
+ #ifdef _LZMA_OUT_READ
+ + globalPos
+ #endif
@@ -632,7 +633,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ dictionaryPos = 0;
+ #endif
+ }
-+ else
++ else
+ {
+ previousIsMatch = 1;
+ if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
@@ -645,7 +646,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ UInt32 pos;
+ #endif
+ if (
-+ (nowPos
++ (nowPos
+ #ifdef _LZMA_OUT_READ
+ + globalPos
+ #endif
@@ -673,7 +674,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ UInt32 distance;
+ if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
+ distance = rep1;
-+ else
++ else
+ {
+ if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
+ distance = rep2;
@@ -699,7 +700,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ state = state < 7 ? 7 : 10;
+ len = LzmaLenDecode(p + LenCoder, &rd, posState);
+ posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
-+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
++ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
+ kNumPosSlotBits), kNumPosSlotBits, &rd);
+ if (posSlot >= kStartPosModelIndex)
+ {
@@ -712,7 +713,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ }
+ else
+ {
-+ rep0 += RangeDecoderDecodeDirectBits(&rd,
++ rep0 += RangeDecoderDecodeDirectBits(&rd,
+ numDirectBits - kNumAlignBits) << kNumAlignBits;
+ rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
+ }
@@ -727,7 +728,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ len = -1;
+ break;
+ }
-+ if (rep0 > nowPos
++ if (rep0 > nowPos
+ #ifdef _LZMA_OUT_READ
+ + globalPos
+ #endif
@@ -772,11 +773,11 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.c linux-2.6.16-owrt/fs/squashfs/Lz
+ *outSizeProcessed = nowPos;
+ return LZMA_RESULT_OK;
+}
-diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/LzmaDecode.h
---- linux-2.6.16/fs/squashfs/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.16-owrt/fs/squashfs/LzmaDecode.h 2006-03-21 10:56:57.000000000 +0100
+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/fs/squashfs/LzmaDecode.h 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19.dev/fs/squashfs/LzmaDecode.h 2006-12-14 03:13:20.000000000 +0100
@@ -0,0 +1,100 @@
-+/*
++/*
+ LzmaDecode.h
+ LZMA Decoder interface
+
@@ -786,14 +787,14 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/Lz
+ 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
++ 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
++ 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.
+*/
+
@@ -807,7 +808,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/Lz
+/* Use read function for output data */
+
+/* #define _LZMA_PROB32 */
-+/* It can increase speed on some 32-bit CPUs,
++/* It can increase speed on some 32-bit CPUs,
+ but memory usage will be doubled in that case */
+
+/* #define _LZMA_LOC_OPT */
@@ -841,10 +842,10 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/Lz
+#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,
++by default CProb is unsigned short,
+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
+*/
+
@@ -862,7 +863,7 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/Lz
+#endif
+
+int LzmaDecode(
-+ unsigned char *buffer,
++ unsigned char *buffer,
+ #ifndef _LZMA_OUT_READ
+ UInt32 bufferSize,
+ int lc, int lp, int pb,
@@ -876,9 +877,9 @@ diff -Nur linux-2.6.16/fs/squashfs/LzmaDecode.h linux-2.6.16-owrt/fs/squashfs/Lz
+ UInt32 *outSizeProcessed);
+
+#endif
-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 10:55:59.000000000 +0100
-+++ linux-2.6.16-owrt/fs/squashfs/Makefile 2006-03-21 10:57:08.000000000 +0100
+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