rev |
line source |
pascal@310
|
1 --- linux-2.6.24.2/lib/decompress_unlzma.c
|
pascal@310
|
2 +++ linux-2.6.24.2/lib/decompress_unlzma.c
|
pascal@314
|
3 @@ -52,16 +52,6 @@
|
pascal@313
|
4 }
|
pascal@313
|
5
|
pascal@313
|
6 #ifndef TEST
|
pascal@313
|
7 -static void __init *malloc(size_t size)
|
pascal@313
|
8 -{
|
pascal@313
|
9 - return kmalloc(size, GFP_KERNEL);
|
pascal@313
|
10 -}
|
pascal@313
|
11 -
|
pascal@314
|
12 -static void __init free(void *where)
|
pascal@314
|
13 -{
|
pascal@314
|
14 - kfree(where);
|
pascal@314
|
15 -}
|
pascal@314
|
16 -
|
pascal@314
|
17 static void __init error(char *x)
|
pascal@313
|
18 {
|
pascal@314
|
19 printk(KERN_ERR "%s\n", x);
|
pascal@314
|
20 @@ -166,13 +156,6 @@
|
pascal@314
|
21 }
|
pascal@314
|
22 }
|
pascal@310
|
23
|
pascal@314
|
24 -
|
pascal@314
|
25 -/* Called once. TODO: bb_maybe_free() */
|
pascal@314
|
26 -static always_inline void rc_free(rc_t * rc)
|
pascal@314
|
27 -{
|
pascal@314
|
28 - free(rc->buffer);
|
pascal@314
|
29 -}
|
pascal@314
|
30 -
|
pascal@314
|
31 /* Called twice, but one callsite is in speed_inline'd rc_is_bit_0_helper() */
|
pascal@314
|
32 static void rc_do_normalize(rc_t * rc)
|
pascal@314
|
33 {
|
pascal@314
|
34 @@ -348,10 +331,22 @@
|
pascal@310
|
35
|
pascal@310
|
36 rc_init(&rc, fill, inbuf, in_len);
|
pascal@310
|
37
|
pascal@310
|
38 - for (i = 0; i < sizeof(header); i++) {
|
pascal@310
|
39 - if (rc.ptr >= rc.buffer_end)
|
pascal@310
|
40 - rc_read(&rc);
|
pascal@310
|
41 - ((unsigned char *)&header)[i] = *rc.ptr++;
|
pascal@310
|
42 + header.dict_size = header.dst_size = in_len;
|
pascal@314
|
43 + if (inbuf && in_len > 0 && inbuf[0] == 0) {
|
pascal@313
|
44 + const int LZMA_LC = 3, LZMA_LP = 0, LZMA_PB = 2;
|
pascal@310
|
45 + header.pos = (LZMA_PB * 45) + (LZMA_LP * 5) + LZMA_LC;
|
pascal@310
|
46 + rc.ptr++;
|
pascal@310
|
47 + }
|
pascal@310
|
48 + else {
|
pascal@310
|
49 + int hdrsize = sizeof(header);
|
pascal@314
|
50 + if (inbuf && in_len > 12 &&
|
pascal@314
|
51 + (1 + * (unsigned long *) &inbuf[9]) > 1U)
|
pascal@310
|
52 + hdrsize = 5;
|
pascal@310
|
53 + for (i = 0; i < hdrsize; i++) {
|
pascal@310
|
54 + if (rc.ptr >= rc.buffer_end)
|
pascal@310
|
55 + rc_read(&rc);
|
pascal@310
|
56 + ((unsigned char *)&header)[i] = *rc.ptr++;
|
pascal@310
|
57 + }
|
pascal@310
|
58 }
|
pascal@310
|
59
|
pascal@310
|
60 if (header.pos >= (9 * 5 * 5))
|
pascal@310
|
61
|
pascal@310
|
62 --- linux-2.6.24.2/lib/Makefile
|
pascal@310
|
63 +++ linux-2.6.24.2/lib/Makefile
|
pascal@310
|
64 @@ -51,7 +51,7 @@ obj-$(CONFIG_LIBCRC32C) += libcrc32c.o
|
pascal@310
|
65 obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o
|
pascal@310
|
66
|
pascal@310
|
67 obj-$(CONFIG_RD_BZIP2) += decompress_bunzip2.o
|
pascal@310
|
68 -obj-$(CONFIG_RD_LZMA) += decompress_unlzma.o
|
pascal@310
|
69 +obj-$(CONFIG_RD_LZMA) += decompress_unlzma.o unlzma_syms.o
|
pascal@310
|
70
|
pascal@310
|
71
|
pascal@310
|
72 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
|
pascal@310
|
73
|
pascal@310
|
74 --- linux-2.6.24.2/lib/unlzma_syms.c
|
pascal@310
|
75 +++ linux-2.6.24.2/lib/unlzma_syms.c
|
pascal@310
|
76 @@ -0,0 +1,14 @@
|
pascal@310
|
77 +/*
|
pascal@310
|
78 + * linux/lib/unlzma_syms.c
|
pascal@310
|
79 + *
|
pascal@310
|
80 + * Exported symbols for the unlzma functionality.
|
pascal@310
|
81 + *
|
pascal@310
|
82 + */
|
pascal@310
|
83 +
|
pascal@310
|
84 +#include <linux/module.h>
|
pascal@310
|
85 +#include <linux/init.h>
|
pascal@310
|
86 +
|
pascal@310
|
87 +#include <linux/decompress_unlzma.h>
|
pascal@310
|
88 +
|
pascal@310
|
89 +EXPORT_SYMBOL(unlzma);
|
pascal@310
|
90 +MODULE_LICENSE("GPL");
|