]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-squashfs-lzma.patch
- real update for .35
[packages/kernel.git] / kernel-squashfs-lzma.patch
CommitLineData
40bf088a
AM
1diff -Nru a/fs/squashfs/decompressor.c b/fs/squashfs/decompressor.c
2--- a/fs/squashfs/decompressor.c 2010-05-16 23:17:36.000000000 +0200
3+++ b/fs/squashfs/decompressor.c 2010-05-17 14:57:45.271547099 +0200
4@@ -50,7 +50,11 @@
5
6 static const struct squashfs_decompressor *decompressor[] = {
7 &squashfs_zlib_comp_ops,
8+#ifdef CONFIG_SQUASHFS_LZMA
9+ &squashfs_lzma_comp_ops,
10+#else
11 &squashfs_lzma_unsupported_comp_ops,
12+#endif
13 &squashfs_lzo_unsupported_comp_ops,
14 &squashfs_unknown_comp_ops
15 };
16diff -Nru a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
17--- a/fs/squashfs/Kconfig 2010-05-16 23:17:36.000000000 +0200
18+++ b/fs/squashfs/Kconfig 2010-05-17 15:13:49.807545765 +0200
19@@ -26,6 +26,12 @@
20
21 If unsure, say N.
22
23+config SQUASHFS_LZMA
24+ bool "Include support for LZMA compressed file systems"
25+ depends on SQUASHFS
26+ select DECOMPRESS_LZMA
27+ select DECOMPRESS_LZMA_NEEDED
28+
29 config SQUASHFS_EMBEDDED
30
31 bool "Additional option for memory-constrained systems"
32diff -Nru a/fs/squashfs/lzma_wrapper.c b/fs/squashfs/lzma_wrapper.c
33--- a/fs/squashfs/lzma_wrapper.c 1970-01-01 01:00:00.000000000 +0100
34+++ b/fs/squashfs/lzma_wrapper.c 2010-05-17 15:15:12.637552661 +0200
35@@ -0,0 +1,152 @@
36+/*
37+ * Squashfs - a compressed read only filesystem for Linux
38+ *
39+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
40+ * Phillip Lougher <phillip@lougher.demon.co.uk>
41+ *
42+ * This program is free software; you can redistribute it and/or
43+ * modify it under the terms of the GNU General Public License
44+ * as published by the Free Software Foundation; either version 2,
45+ * or (at your option) any later version.
46+ *
47+ * This program is distributed in the hope that it will be useful,
48+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
49+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+ * GNU General Public License for more details.
51+ *
52+ * You should have received a copy of the GNU General Public License
53+ * along with this program; if not, write to the Free Software
54+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
55+ *
56+ * lzma_wrapper.c
57+ */
58+
59+#include <asm/unaligned.h>
60+#include <linux/slab.h>
61+#include <linux/buffer_head.h>
62+#include <linux/mutex.h>
63+#include <linux/vmalloc.h>
64+#include <linux/decompress/unlzma.h>
65+
66+#include "squashfs_fs.h"
67+#include "squashfs_fs_sb.h"
68+#include "squashfs_fs_i.h"
69+#include "squashfs.h"
70+#include "decompressor.h"
71+
72+struct squashfs_lzma {
73+ void *input;
74+ void *output;
75+};
76+
77+/* decompress_unlzma.c is currently non re-entrant... */
78+DEFINE_MUTEX(lzma_mutex);
79+
80+/* decompress_unlzma.c doesn't provide any context in its callbacks... */
81+static int lzma_error;
82+
83+static void error(char *m)
84+{
85+ ERROR("unlzma error: %s\n", m);
86+ lzma_error = 1;
87+}
88+
89+
90+static void *lzma_init(struct squashfs_sb_info *msblk)
91+{
92+ struct squashfs_lzma *stream = kzalloc(sizeof(*stream), GFP_KERNEL);
93+ if (stream == NULL)
94+ goto failed;
95+ stream->input = vmalloc(msblk->block_size);
96+ if (stream->input == NULL)
97+ goto failed;
98+ stream->output = vmalloc(msblk->block_size);
99+ if (stream->output == NULL)
100+ goto failed2;
101+
102+ return stream;
103+
104+failed2:
105+ vfree(stream->input);
106+failed:
107+ ERROR("failed to allocate lzma workspace\n");
108+ kfree(stream);
109+ return NULL;
110+}
111+
112+
113+static void lzma_free(void *strm)
114+{
115+ struct squashfs_lzma *stream = strm;
116+
117+ if (stream) {
118+ vfree(stream->input);
119+ vfree(stream->output);
120+ }
121+ kfree(stream);
122+}
123+
124+
125+static int lzma_uncompress(struct squashfs_sb_info *msblk, void **buffer,
126+ struct buffer_head **bh, int b, int offset, int length, int srclength,
127+ int pages)
128+{
129+ struct squashfs_lzma *stream = msblk->stream;
130+ void *buff = stream->input;
131+ int avail, i, bytes = length, res;
132+
133+ mutex_lock(&lzma_mutex);
134+
135+ for (i = 0; i < b; i++) {
136+ wait_on_buffer(bh[i]);
137+ if (!buffer_uptodate(bh[i]))
138+ goto block_release;
139+
140+ avail = min(bytes, msblk->devblksize - offset);
141+ memcpy(buff, bh[i]->b_data + offset, avail);
142+ buff += avail;
143+ bytes -= avail;
144+ offset = 0;
145+ put_bh(bh[i]);
146+ }
147+
148+ lzma_error = 0;
149+ res = unlzma(stream->input, length, NULL, NULL, stream->output, NULL,
150+ error);
151+ if (res || lzma_error)
152+ goto failed;
153+
154+ /* uncompressed size is stored in the LZMA header (5 byte offset) */
155+ res = bytes = get_unaligned_le32(stream->input + 5);
156+ for (i = 0, buff = stream->output; bytes && i < pages; i++) {
157+ avail = min_t(int, bytes, PAGE_CACHE_SIZE);
158+ memcpy(buffer[i], buff, avail);
159+ buff += avail;
160+ bytes -= avail;
161+ }
162+ if (bytes)
163+ goto failed;
164+
165+ mutex_unlock(&lzma_mutex);
166+ return res;
167+
168+block_release:
169+ for (; i < b; i++)
170+ put_bh(bh[i]);
171+
172+failed:
173+ mutex_unlock(&lzma_mutex);
174+
175+ ERROR("lzma decompression failed, data probably corrupt\n");
176+ return -EIO;
177+}
178+
179+const struct squashfs_decompressor squashfs_lzma_comp_ops = {
180+ .init = lzma_init,
181+ .free = lzma_free,
182+ .decompress = lzma_uncompress,
183+ .id = LZMA_COMPRESSION,
184+ .name = "lzma",
185+ .supported = 1
186+};
187+
188diff -Nru a/fs/squashfs/Makefile b/fs/squashfs/Makefile
189--- a/fs/squashfs/Makefile 2010-05-16 23:17:36.000000000 +0200
190+++ b/fs/squashfs/Makefile 2010-05-17 14:57:45.270554026 +0200
76514441 191@@ -6,4 +6,4 @@
40bf088a
AM
192 squashfs-y += block.o cache.o dir.o export.o file.o fragment.o id.o inode.o
193 squashfs-y += namei.o super.o symlink.o zlib_wrapper.o decompressor.o
76514441
AM
194 squashfs-$(CONFIG_SQUASHFS_XATTRS) += xattr.o xattr_id.o
195-
40bf088a
AM
196+squashfs-$(CONFIG_SQUASHFS_LZMA) += lzma_wrapper.o
197diff -Nru a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h
198--- a/fs/squashfs/squashfs.h 2010-05-16 23:17:36.000000000 +0200
199+++ b/fs/squashfs/squashfs.h 2010-05-17 14:57:45.310795600 +0200
200@@ -94,3 +94,6 @@
201
202 /* zlib_wrapper.c */
203 extern const struct squashfs_decompressor squashfs_zlib_comp_ops;
204+
205+/* lzma wrapper.c */
206+extern const struct squashfs_decompressor squashfs_lzma_comp_ops;
207diff -Nru a/include/linux/decompress/bunzip2_mm.h b/include/linux/decompress/bunzip2_mm.h
208--- a/include/linux/decompress/bunzip2_mm.h 1970-01-01 01:00:00.000000000 +0100
209+++ b/include/linux/decompress/bunzip2_mm.h 2010-05-17 15:14:15.255545839 +0200
210@@ -0,0 +1,13 @@
211+#ifndef BUNZIP2_MM_H
212+#define BUNZIP2_MM_H
213+
214+#ifdef STATIC
215+/* Code active when included from pre-boot environment: */
216+#define INIT
217+#else
218+/* Compile for initramfs/initrd code only */
219+#define INIT __init
220+static void(*error)(char *m);
221+#endif
222+
223+#endif
224diff -Nru a/include/linux/decompress/inflate_mm.h b/include/linux/decompress/inflate_mm.h
225--- a/include/linux/decompress/inflate_mm.h 1970-01-01 01:00:00.000000000 +0100
226+++ b/include/linux/decompress/inflate_mm.h 2010-05-17 15:14:15.255545839 +0200
227@@ -0,0 +1,13 @@
228+#ifndef INFLATE_MM_H
229+#define INFLATE_MM_H
230+
231+#ifdef STATIC
232+/* Code active when included from pre-boot environment: */
233+#define INIT
234+#else
235+/* Compile for initramfs/initrd code only */
236+#define INIT __init
237+static void(*error)(char *m);
238+#endif
239+
240+#endif
241diff -Nru a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
242--- a/include/linux/decompress/mm.h 2010-05-16 23:17:36.000000000 +0200
243+++ b/include/linux/decompress/mm.h 2010-05-17 15:14:15.259546209 +0200
244@@ -63,8 +63,6 @@
245
246 #define set_error_fn(x)
247
248-#define INIT
249-
250 #else /* STATIC */
251
252 /* Code active when compiled standalone for use when loading ramdisk: */
253@@ -84,10 +82,8 @@
254 #define large_malloc(a) vmalloc(a)
255 #define large_free(a) vfree(a)
256
257-static void(*error)(char *m);
258 #define set_error_fn(x) error = x;
259
260-#define INIT __init
261 #define STATIC
262
263 #include <linux/init.h>
264diff -Nru a/include/linux/decompress/unlzma_mm.h b/include/linux/decompress/unlzma_mm.h
265--- a/include/linux/decompress/unlzma_mm.h 1970-01-01 01:00:00.000000000 +0100
266+++ b/include/linux/decompress/unlzma_mm.h 2010-05-17 15:13:10.802553245 +0200
267@@ -0,0 +1,20 @@
268+#ifndef UNLZMA_MM_H
269+#define UNLZMA_MM_H
270+
271+#ifdef STATIC
272+
273+/* Code active when included from pre-boot environment: */
274+#define INIT
275+
276+#elif defined(CONFIG_DECOMPRESS_LZMA_NEEDED)
277+
278+/* Make it available to non initramfs/initrd code */
279+#define INIT
280+#include <linux/module.h>
281+#else
282+
283+/* Compile for initramfs/initrd code only */
284+#define INIT __init
285+#endif
286+
287+#endif
288diff -Nru a/include/linux/decompress/unlzo_mm.h b/include/linux/decompress/unlzo_mm.h
289--- a/include/linux/decompress/unlzo_mm.h 1970-01-01 01:00:00.000000000 +0100
290+++ b/include/linux/decompress/unlzo_mm.h 2010-05-17 15:14:15.259546209 +0200
291@@ -0,0 +1,13 @@
292+#ifndef UNLZO_MM_H
293+#define UNLZO_MM_H
294+
295+#ifdef STATIC
296+/* Code active when included from pre-boot environment: */
297+#define INIT
298+#else
299+/* Compile for initramfs/initrd code only */
300+#define INIT __init
301+static void(*error)(char *m);
302+#endif
303+
304+#endif
305diff -Nru a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
306--- a/lib/decompress_bunzip2.c 2010-05-16 23:17:36.000000000 +0200
307+++ b/lib/decompress_bunzip2.c 2010-05-17 15:13:10.812574144 +0200
308@@ -52,6 +52,7 @@
309 #include <linux/slab.h>
310 #endif /* STATIC */
311
312+#include <linux/decompress/bunzip2_mm.h>
313 #include <linux/decompress/mm.h>
314
315 #ifndef INT_MAX
316diff -Nru a/lib/decompress_inflate.c b/lib/decompress_inflate.c
317--- a/lib/decompress_inflate.c 2010-05-16 23:17:36.000000000 +0200
318+++ b/lib/decompress_inflate.c 2010-05-17 15:13:10.815573687 +0200
319@@ -23,6 +23,7 @@
320
321 #endif /* STATIC */
322
323+#include <linux/decompress/inflate_mm.h>
324 #include <linux/decompress/mm.h>
325
326 #define GZIP_IOBUF_SIZE (16*1024)
327diff -Nru a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c
328--- a/lib/decompress_unlzma.c 2010-05-16 23:17:36.000000000 +0200
329+++ b/lib/decompress_unlzma.c 2010-05-17 15:14:15.260574202 +0200
330@@ -36,6 +36,7 @@
331 #include <linux/slab.h>
332 #endif /* STATIC */
333
334+#include <linux/decompress/unlzma_mm.h>
335 #include <linux/decompress/mm.h>
336
337 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
338@@ -88,7 +89,7 @@
339 }
340
341 /* Called twice: once at startup and once in rc_normalize() */
342-static void INIT rc_read(struct rc *rc)
343+static void INIT rc_read(struct rc *rc, void(*error)(char *x))
344 {
345 rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE);
346 if (rc->buffer_size <= 0)
347@@ -115,13 +116,13 @@
348 rc->range = 0xFFFFFFFF;
349 }
350
351-static inline void INIT rc_init_code(struct rc *rc)
352+static inline void INIT rc_init_code(struct rc *rc, void(*error)(char *x))
353 {
354 int i;
355
356 for (i = 0; i < 5; i++) {
357 if (rc->ptr >= rc->buffer_end)
358- rc_read(rc);
359+ rc_read(rc, error);
360 rc->code = (rc->code << 8) | *rc->ptr++;
361 }
362 }
363@@ -134,32 +135,33 @@
364 }
365
366 /* Called twice, but one callsite is in inline'd rc_is_bit_0_helper() */
367-static void INIT rc_do_normalize(struct rc *rc)
368+static void INIT rc_do_normalize(struct rc *rc, void(*error)(char *x))
369 {
370 if (rc->ptr >= rc->buffer_end)
371- rc_read(rc);
372+ rc_read(rc, error);
373 rc->range <<= 8;
374 rc->code = (rc->code << 8) | *rc->ptr++;
375 }
376-static inline void INIT rc_normalize(struct rc *rc)
377+static inline void INIT rc_normalize(struct rc *rc, void(*error)(char *x))
378 {
379 if (rc->range < (1 << RC_TOP_BITS))
380- rc_do_normalize(rc);
381+ rc_do_normalize(rc, error);
382 }
383
384 /* Called 9 times */
385 /* Why rc_is_bit_0_helper exists?
386 *Because we want to always expose (rc->code < rc->bound) to optimizer
387 */
388-static inline uint32_t INIT rc_is_bit_0_helper(struct rc *rc, uint16_t *p)
389+static inline uint32_t INIT rc_is_bit_0_helper(struct rc *rc, uint16_t *p,
390+ void (*error)(char *x))
391 {
392- rc_normalize(rc);
393+ rc_normalize(rc, error);
394 rc->bound = *p * (rc->range >> RC_MODEL_TOTAL_BITS);
395 return rc->bound;
396 }
397-static inline int INIT rc_is_bit_0(struct rc *rc, uint16_t *p)
398+static inline int INIT rc_is_bit_0(struct rc *rc, uint16_t *p, void(*error)(char *x))
399 {
400- uint32_t t = rc_is_bit_0_helper(rc, p);
401+ uint32_t t = rc_is_bit_0_helper(rc, p, error);
402 return rc->code < t;
403 }
404
405@@ -177,9 +179,9 @@
406 }
407
408 /* Called 4 times in unlzma loop */
409-static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol)
410+static int INIT rc_get_bit(struct rc *rc, uint16_t *p, int *symbol, void(*error)(char *x))
411 {
412- if (rc_is_bit_0(rc, p)) {
413+ if (rc_is_bit_0(rc, p, error)) {
414 rc_update_bit_0(rc, p);
415 *symbol *= 2;
416 return 0;
417@@ -191,9 +193,9 @@
418 }
419
420 /* Called once */
421-static inline int INIT rc_direct_bit(struct rc *rc)
422+static inline int INIT rc_direct_bit(struct rc *rc , void(*error)(char *x))
423 {
424- rc_normalize(rc);
425+ rc_normalize(rc, error);
426 rc->range >>= 1;
427 if (rc->code >= rc->range) {
428 rc->code -= rc->range;
429@@ -204,13 +206,14 @@
430
431 /* Called twice */
432 static inline void INIT
433-rc_bit_tree_decode(struct rc *rc, uint16_t *p, int num_levels, int *symbol)
434+rc_bit_tree_decode(struct rc *rc, uint16_t *p, int num_levels, int *symbol,
435+ void(*error)(char *x))
436 {
437 int i = num_levels;
438
439 *symbol = 1;
440 while (i--)
441- rc_get_bit(rc, p + *symbol, symbol);
442+ rc_get_bit(rc, p + *symbol, symbol, error);
443 *symbol -= 1 << num_levels;
444 }
445
446@@ -347,7 +350,8 @@
447 static inline void INIT process_bit0(struct writer *wr, struct rc *rc,
448 struct cstate *cst, uint16_t *p,
449 int pos_state, uint16_t *prob,
450- int lc, uint32_t literal_pos_mask) {
451+ int lc, uint32_t literal_pos_mask,
452+ void(*error)(char *x)) {
453 int mi = 1;
454 rc_update_bit_0(rc, prob);
455 prob = (p + LZMA_LITERAL +
456@@ -365,7 +369,7 @@
457 match_byte <<= 1;
458 bit = match_byte & 0x100;
459 prob_lit = prob + 0x100 + bit + mi;
460- if (rc_get_bit(rc, prob_lit, &mi)) {
461+ if (rc_get_bit(rc, prob_lit, &mi, error)) {
462 if (!bit)
463 break;
464 } else {
465@@ -376,7 +380,7 @@
466 }
467 while (mi < 0x100) {
468 uint16_t *prob_lit = prob + mi;
469- rc_get_bit(rc, prob_lit, &mi);
470+ rc_get_bit(rc, prob_lit, &mi, error);
471 }
472 write_byte(wr, mi);
473 if (cst->state < 4)
474@@ -389,7 +393,8 @@
475
476 static inline void INIT process_bit1(struct writer *wr, struct rc *rc,
477 struct cstate *cst, uint16_t *p,
478- int pos_state, uint16_t *prob) {
479+ int pos_state, uint16_t *prob,
480+ void(*error)(char *x)) {
481 int offset;
482 uint16_t *prob_len;
483 int num_bits;
484@@ -397,7 +402,7 @@
485
486 rc_update_bit_1(rc, prob);
487 prob = p + LZMA_IS_REP + cst->state;
488- if (rc_is_bit_0(rc, prob)) {
489+ if (rc_is_bit_0(rc, prob, error)) {
490 rc_update_bit_0(rc, prob);
491 cst->rep3 = cst->rep2;
492 cst->rep2 = cst->rep1;
493@@ -407,13 +412,13 @@
494 } else {
495 rc_update_bit_1(rc, prob);
496 prob = p + LZMA_IS_REP_G0 + cst->state;
497- if (rc_is_bit_0(rc, prob)) {
498+ if (rc_is_bit_0(rc, prob, error)) {
499 rc_update_bit_0(rc, prob);
500 prob = (p + LZMA_IS_REP_0_LONG
501 + (cst->state <<
502 LZMA_NUM_POS_BITS_MAX) +
503 pos_state);
504- if (rc_is_bit_0(rc, prob)) {
505+ if (rc_is_bit_0(rc, prob, error)) {
506 rc_update_bit_0(rc, prob);
507
508 cst->state = cst->state < LZMA_NUM_LIT_STATES ?
509@@ -428,13 +433,13 @@
510
511 rc_update_bit_1(rc, prob);
512 prob = p + LZMA_IS_REP_G1 + cst->state;
513- if (rc_is_bit_0(rc, prob)) {
514+ if (rc_is_bit_0(rc, prob, error)) {
515 rc_update_bit_0(rc, prob);
516 distance = cst->rep1;
517 } else {
518 rc_update_bit_1(rc, prob);
519 prob = p + LZMA_IS_REP_G2 + cst->state;
520- if (rc_is_bit_0(rc, prob)) {
521+ if (rc_is_bit_0(rc, prob, error)) {
522 rc_update_bit_0(rc, prob);
523 distance = cst->rep2;
524 } else {
525@@ -452,7 +457,7 @@
526 }
527
528 prob_len = prob + LZMA_LEN_CHOICE;
529- if (rc_is_bit_0(rc, prob_len)) {
530+ if (rc_is_bit_0(rc, prob_len, error)) {
531 rc_update_bit_0(rc, prob_len);
532 prob_len = (prob + LZMA_LEN_LOW
533 + (pos_state <<
534@@ -462,7 +467,7 @@
535 } else {
536 rc_update_bit_1(rc, prob_len);
537 prob_len = prob + LZMA_LEN_CHOICE_2;
538- if (rc_is_bit_0(rc, prob_len)) {
539+ if (rc_is_bit_0(rc, prob_len, error)) {
540 rc_update_bit_0(rc, prob_len);
541 prob_len = (prob + LZMA_LEN_MID
542 + (pos_state <<
543@@ -478,7 +483,7 @@
544 }
545 }
546
547- rc_bit_tree_decode(rc, prob_len, num_bits, &len);
548+ rc_bit_tree_decode(rc, prob_len, num_bits, &len, error);
549 len += offset;
550
551 if (cst->state < 4) {
552@@ -493,7 +498,7 @@
553 << LZMA_NUM_POS_SLOT_BITS);
554 rc_bit_tree_decode(rc, prob,
555 LZMA_NUM_POS_SLOT_BITS,
556- &pos_slot);
557+ &pos_slot, error);
558 if (pos_slot >= LZMA_START_POS_MODEL_INDEX) {
559 int i, mi;
560 num_bits = (pos_slot >> 1) - 1;
561@@ -506,7 +511,7 @@
562 num_bits -= LZMA_NUM_ALIGN_BITS;
563 while (num_bits--)
564 cst->rep0 = (cst->rep0 << 1) |
565- rc_direct_bit(rc);
566+ rc_direct_bit(rc, error);
567 prob = p + LZMA_ALIGN;
568 cst->rep0 <<= LZMA_NUM_ALIGN_BITS;
569 num_bits = LZMA_NUM_ALIGN_BITS;
570@@ -514,7 +519,7 @@
571 i = 1;
572 mi = 1;
573 while (num_bits--) {
574- if (rc_get_bit(rc, prob + mi, &mi))
575+ if (rc_get_bit(rc, prob + mi, &mi, error))
576 cst->rep0 |= i;
577 i <<= 1;
578 }
579@@ -531,12 +536,12 @@
580
581
582
583-STATIC inline int INIT unlzma(unsigned char *buf, int in_len,
584+STATIC int INIT unlzma(unsigned char *buf, int in_len,
585 int(*fill)(void*, unsigned int),
586 int(*flush)(void*, unsigned int),
587 unsigned char *output,
588 int *posp,
589- void(*error_fn)(char *x)
590+ void(*error)(char *x)
591 )
592 {
593 struct lzma_header header;
594@@ -552,8 +557,6 @@
595 unsigned char *inbuf;
596 int ret = -1;
597
598- set_error_fn(error_fn);
599-
600 if (buf)
601 inbuf = buf;
602 else
603@@ -576,7 +579,7 @@
604
605 for (i = 0; i < sizeof(header); i++) {
606 if (rc.ptr >= rc.buffer_end)
607- rc_read(&rc);
608+ rc_read(&rc, error);
609 ((unsigned char *)&header)[i] = *rc.ptr++;
610 }
611
612@@ -621,17 +624,17 @@
613 for (i = 0; i < num_probs; i++)
614 p[i] = (1 << RC_MODEL_TOTAL_BITS) >> 1;
615
616- rc_init_code(&rc);
617+ rc_init_code(&rc, error);
618
619 while (get_pos(&wr) < header.dst_size) {
620 int pos_state = get_pos(&wr) & pos_state_mask;
621 uint16_t *prob = p + LZMA_IS_MATCH +
622 (cst.state << LZMA_NUM_POS_BITS_MAX) + pos_state;
623- if (rc_is_bit_0(&rc, prob))
624+ if (rc_is_bit_0(&rc, prob, error))
625 process_bit0(&wr, &rc, &cst, p, pos_state, prob,
626- lc, literal_pos_mask);
627+ lc, literal_pos_mask, error);
628 else {
629- process_bit1(&wr, &rc, &cst, p, pos_state, prob);
630+ process_bit1(&wr, &rc, &cst, p, pos_state, prob, error);
631 if (cst.rep0 == 0)
632 break;
633 }
634@@ -652,6 +655,9 @@
635 exit_0:
636 return ret;
637 }
638+#if defined(CONFIG_DECOMPRESS_LZMA_NEEDED) && !defined(PREBOOT)
639+EXPORT_SYMBOL(unlzma);
640+#endif
641
642 #ifdef PREBOOT
643 STATIC int INIT decompress(unsigned char *buf, int in_len,
644diff -Nru a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c
645--- a/lib/decompress_unlzo.c 2010-05-16 23:17:36.000000000 +0200
646+++ b/lib/decompress_unlzo.c 2010-05-17 15:13:10.820554001 +0200
647@@ -39,6 +39,7 @@
648
649 #include <linux/types.h>
650 #include <linux/lzo.h>
651+#include <linux/decompress/unlzo_mm.h>
652 #include <linux/decompress/mm.h>
653
654 #include <linux/compiler.h>
655diff -Nru a/lib/Kconfig b/lib/Kconfig
656--- a/lib/Kconfig 2010-05-16 23:17:36.000000000 +0200
657+++ b/lib/Kconfig 2010-05-17 15:13:10.809574529 +0200
658@@ -121,6 +121,9 @@
659 select LZO_DECOMPRESS
660 tristate
661
662+config DECOMPRESS_LZMA_NEEDED
663+ boolean
664+
665 #
666 # Generic allocator support is selected if needed
667 #
668diff -Nru a/lib/Makefile b/lib/Makefile
669--- a/lib/Makefile 2010-05-16 23:17:36.000000000 +0200
670+++ b/lib/Makefile 2010-05-17 15:14:36.312796051 +0200
671@@ -69,7 +69,7 @@
672
673 lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
674 lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
675-lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
676+obj-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
677 lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
678
679 obj-$(CONFIG_TEXTSEARCH) += textsearch.o
This page took 0.127095 seconds and 4 git commands to generate.