wok-current view linux/stuff/linux-lzma-export.u @ rev 2161

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