# HG changeset patch # User Pascal Bellard # Date 1204490877 0 # Node ID bb5704323e2b6c7c5a0dac0febf59b01b5a994fa # Parent 3a5e92c048e05558fe75781608e37e71f5adb7fb Linux: export unlzma diff -r 3a5e92c048e0 -r bb5704323e2b linux/receipt --- a/linux/receipt Sat Mar 01 12:55:33 2008 +0000 +++ b/linux/receipt Sun Mar 02 20:47:57 2008 +0000 @@ -22,6 +22,7 @@ patch -p1 < ../stuff/config-acpi-$VERSION.u patch -p1 < ../stuff/linux-utf8-$VERSION.u patch -p1 < ../stuff/config-ieee1394-$VERSION.u + patch -p1 < ../stuff/linux-lzma-export.u make oldconfig make bzImage make modules diff -r 3a5e92c048e0 -r bb5704323e2b linux/stuff/linux-lzma-export.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linux/stuff/linux-lzma-export.u Sun Mar 02 20:47:57 2008 +0000 @@ -0,0 +1,67 @@ +--- linux-2.6.24.2/lib/decompress_unlzma.c ++++ linux-2.6.24.2/lib/decompress_unlzma.c +@@ -321,7 +321,7 @@ typedef struct { + #define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) + + +-STATIC int unlzma(char *inbuf, int in_len, ++int unlzma(char *inbuf, int in_len, + int(*fill)(void*,unsigned int), + int(*writebb)(char*,unsigned int), + int *posp) +@@ -348,10 +348,21 @@ STATIC int unlzma(char *inbuf, int in_le + + rc_init(&rc, fill, inbuf, in_len); + +- for (i = 0; i < sizeof(header); i++) { +- if (rc.ptr >= rc.buffer_end) +- rc_read(&rc); +- ((unsigned char *)&header)[i] = *rc.ptr++; ++ header.dict_size = header.dst_size = in_len; ++ if (inbuf && inbuf[0] == 0) { ++ const LZMA_LC = 3, LZMA_LP = 0, LZMA_PB = 2; ++ header.pos = (LZMA_PB * 45) + (LZMA_LP * 5) + LZMA_LC; ++ rc.ptr++; ++ } ++ else { ++ int hdrsize = sizeof(header); ++ if (inbuf && (1 + * (unsigned long *) &inbuf[9]) > 1U) ++ hdrsize = 5; ++ for (i = 0; i < hdrsize; i++) { ++ if (rc.ptr >= rc.buffer_end) ++ rc_read(&rc); ++ ((unsigned char *)&header)[i] = *rc.ptr++; ++ } + } + + if (header.pos >= (9 * 5 * 5)) + +--- linux-2.6.24.2/lib/Makefile ++++ linux-2.6.24.2/lib/Makefile +@@ -51,7 +51,7 @@ obj-$(CONFIG_LIBCRC32C) += libcrc32c.o + obj-$(CONFIG_GENERIC_ALLOCATOR) += genalloc.o + + obj-$(CONFIG_RD_BZIP2) += decompress_bunzip2.o +-obj-$(CONFIG_RD_LZMA) += decompress_unlzma.o ++obj-$(CONFIG_RD_LZMA) += decompress_unlzma.o unlzma_syms.o + + + obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/ + +--- linux-2.6.24.2/lib/unlzma_syms.c ++++ linux-2.6.24.2/lib/unlzma_syms.c +@@ -0,0 +1,14 @@ ++/* ++ * linux/lib/unlzma_syms.c ++ * ++ * Exported symbols for the unlzma functionality. ++ * ++ */ ++ ++#include ++#include ++ ++#include ++ ++EXPORT_SYMBOL(unlzma); ++MODULE_LICENSE("GPL");