[package] update compcache to 0.5.4 (#6018)
[openwrt/svn-archive/archive.git] / package / compcache / patches / 000-provide_lzo_kmod.patch
1 diff -uNr compcache-0.5.4-old/Makefile compcache-0.5.4/Makefile
2 --- compcache-0.5.4-old/Makefile 2009-10-17 08:49:42.000000000 +0200
3 +++ compcache-0.5.4/Makefile 2009-10-17 09:39:34.000000000 +0200
4 @@ -1,19 +1,26 @@
5 KERNEL_BUILD_PATH ?= "/lib/modules/$(shell uname -r)/build"
6
7 XVM = sub-projects/allocators/xvmalloc-kmod
8 -EXTRA_CFLAGS := -DCONFIG_BLK_DEV_RAMZSWAP_STATS \
9 - -I$(PWD)/$(XVM) \
10 +LZO = sub-projects/compression/lzo-kmod
11 +
12 +EXTRA_CFLAGS += -DCONFIG_BLK_DEV_RAMZSWAP_STATS \
13 + -I$(PWD)/$(XVM) \
14 + -I$(PWD)/$(LZO) \
15 -g -Wall
16
17 obj-m += $(XVM)/xvmalloc.o \
18 + $(LZO)/lzo1x.o \
19 ramzswap.o
20
21 all:
22 make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(XVM) modules
23 + make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(LZO) modules
24 make -C $(KERNEL_BUILD_PATH) M=$(PWD) modules
25 @ln -sf $(XVM)/xvmalloc.ko
26 + @ln -sf $(LZO)/xvmalloc.ko
27
28 clean:
29 make -C $(KERNEL_BUILD_PATH) M=$(PWD) clean
30 make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(XVM) clean
31 + make -C $(KERNEL_BUILD_PATH) M=$(PWD)/$(LZO) clean
32 @rm -rf *.ko
33 diff -uNr compcache-0.5.4-old/ramzswap.c compcache-0.5.4/ramzswap.c
34 --- compcache-0.5.4-old/ramzswap.c 2009-10-17 08:50:06.000000000 +0200
35 +++ compcache-0.5.4/ramzswap.c 2009-10-17 09:35:59.000000000 +0200
36 @@ -20,7 +20,6 @@
37 #include <linux/device.h>
38 #include <linux/genhd.h>
39 #include <linux/highmem.h>
40 -#include <linux/lzo.h>
41 #include <linux/mutex.h>
42 #include <linux/proc_fs.h>
43 #include <linux/string.h>
44 diff -uNr compcache-0.5.4-old/ramzswap.h compcache-0.5.4/ramzswap.h
45 --- compcache-0.5.4-old/ramzswap.h 2009-10-17 08:50:06.000000000 +0200
46 +++ compcache-0.5.4/ramzswap.h 2009-10-17 09:40:45.000000000 +0200
47 @@ -16,6 +16,7 @@
48 #define _RAMZSWAP_H_
49
50 #include "xvmalloc.h"
51 +#include "lzo.h"
52
53 /*
54 * Stored at beginning of each compressed object.
55 diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x.c compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x.c
56 --- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x.c 1970-01-01 01:00:00.000000000 +0100
57 +++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x.c 2009-10-17 09:35:59.000000000 +0200
58 @@ -0,0 +1,7 @@
59 +#include <linux/module.h>
60 +
61 +#include "lzo1x_compress.c"
62 +#include "lzo1x_decompress.c"
63 +
64 +MODULE_LICENSE("GPL");
65 +MODULE_DESCRIPTION("LZO1X Lib");
66 diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_compress.c compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_compress.c
67 --- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_compress.c 1970-01-01 01:00:00.000000000 +0100
68 +++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_compress.c 2009-10-17 09:35:59.000000000 +0200
69 @@ -0,0 +1,227 @@
70 +/*
71 + * LZO1X Compressor from MiniLZO
72 + *
73 + * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com>
74 + *
75 + * The full LZO package can be found at:
76 + * http://www.oberhumer.com/opensource/lzo/
77 + *
78 + * Changed for kernel use by:
79 + * Nitin Gupta <nitingupta910@gmail.com>
80 + * Richard Purdie <rpurdie@openedhand.com>
81 + */
82 +
83 +#include <linux/module.h>
84 +#include <linux/kernel.h>
85 +#include <asm/unaligned.h>
86 +
87 +#include "lzodefs.h"
88 +#include "lzo.h"
89 +
90 +static noinline size_t
91 +_lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
92 + unsigned char *out, size_t *out_len, void *wrkmem)
93 +{
94 + const unsigned char * const in_end = in + in_len;
95 + const unsigned char * const ip_end = in + in_len - M2_MAX_LEN - 5;
96 + const unsigned char ** const dict = wrkmem;
97 + const unsigned char *ip = in, *ii = ip;
98 + const unsigned char *end, *m, *m_pos;
99 + size_t m_off, m_len, dindex;
100 + unsigned char *op = out;
101 +
102 + ip += 4;
103 +
104 + for (;;) {
105 + dindex = ((size_t)(0x21 * DX3(ip, 5, 5, 6)) >> 5) & D_MASK;
106 + m_pos = dict[dindex];
107 +
108 + if (m_pos < in)
109 + goto literal;
110 +
111 + if (ip == m_pos || ((size_t)(ip - m_pos) > M4_MAX_OFFSET))
112 + goto literal;
113 +
114 + m_off = ip - m_pos;
115 + if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
116 + goto try_match;
117 +
118 + dindex = (dindex & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f);
119 + m_pos = dict[dindex];
120 +
121 + if (m_pos < in)
122 + goto literal;
123 +
124 + if (ip == m_pos || ((size_t)(ip - m_pos) > M4_MAX_OFFSET))
125 + goto literal;
126 +
127 + m_off = ip - m_pos;
128 + if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3])
129 + goto try_match;
130 +
131 + goto literal;
132 +
133 +try_match:
134 + if (get_unaligned((const unsigned short *)m_pos)
135 + == get_unaligned((const unsigned short *)ip)) {
136 + if (likely(m_pos[2] == ip[2]))
137 + goto match;
138 + }
139 +
140 +literal:
141 + dict[dindex] = ip;
142 + ++ip;
143 + if (unlikely(ip >= ip_end))
144 + break;
145 + continue;
146 +
147 +match:
148 + dict[dindex] = ip;
149 + if (ip != ii) {
150 + size_t t = ip - ii;
151 +
152 + if (t <= 3) {
153 + op[-2] |= t;
154 + } else if (t <= 18) {
155 + *op++ = (t - 3);
156 + } else {
157 + size_t tt = t - 18;
158 +
159 + *op++ = 0;
160 + while (tt > 255) {
161 + tt -= 255;
162 + *op++ = 0;
163 + }
164 + *op++ = tt;
165 + }
166 + do {
167 + *op++ = *ii++;
168 + } while (--t > 0);
169 + }
170 +
171 + ip += 3;
172 + if (m_pos[3] != *ip++ || m_pos[4] != *ip++
173 + || m_pos[5] != *ip++ || m_pos[6] != *ip++
174 + || m_pos[7] != *ip++ || m_pos[8] != *ip++) {
175 + --ip;
176 + m_len = ip - ii;
177 +
178 + if (m_off <= M2_MAX_OFFSET) {
179 + m_off -= 1;
180 + *op++ = (((m_len - 1) << 5)
181 + | ((m_off & 7) << 2));
182 + *op++ = (m_off >> 3);
183 + } else if (m_off <= M3_MAX_OFFSET) {
184 + m_off -= 1;
185 + *op++ = (M3_MARKER | (m_len - 2));
186 + goto m3_m4_offset;
187 + } else {
188 + m_off -= 0x4000;
189 +
190 + *op++ = (M4_MARKER | ((m_off & 0x4000) >> 11)
191 + | (m_len - 2));
192 + goto m3_m4_offset;
193 + }
194 + } else {
195 + end = in_end;
196 + m = m_pos + M2_MAX_LEN + 1;
197 +
198 + while (ip < end && *m == *ip) {
199 + m++;
200 + ip++;
201 + }
202 + m_len = ip - ii;
203 +
204 + if (m_off <= M3_MAX_OFFSET) {
205 + m_off -= 1;
206 + if (m_len <= 33) {
207 + *op++ = (M3_MARKER | (m_len - 2));
208 + } else {
209 + m_len -= 33;
210 + *op++ = M3_MARKER | 0;
211 + goto m3_m4_len;
212 + }
213 + } else {
214 + m_off -= 0x4000;
215 + if (m_len <= M4_MAX_LEN) {
216 + *op++ = (M4_MARKER
217 + | ((m_off & 0x4000) >> 11)
218 + | (m_len - 2));
219 + } else {
220 + m_len -= M4_MAX_LEN;
221 + *op++ = (M4_MARKER
222 + | ((m_off & 0x4000) >> 11));
223 +m3_m4_len:
224 + while (m_len > 255) {
225 + m_len -= 255;
226 + *op++ = 0;
227 + }
228 +
229 + *op++ = (m_len);
230 + }
231 + }
232 +m3_m4_offset:
233 + *op++ = ((m_off & 63) << 2);
234 + *op++ = (m_off >> 6);
235 + }
236 +
237 + ii = ip;
238 + if (unlikely(ip >= ip_end))
239 + break;
240 + }
241 +
242 + *out_len = op - out;
243 + return in_end - ii;
244 +}
245 +
246 +int lzo1x_1_compress(const unsigned char *in, size_t in_len, unsigned char *out,
247 + size_t *out_len, void *wrkmem)
248 +{
249 + const unsigned char *ii;
250 + unsigned char *op = out;
251 + size_t t;
252 +
253 + if (unlikely(in_len <= M2_MAX_LEN + 5)) {
254 + t = in_len;
255 + } else {
256 + t = _lzo1x_1_do_compress(in, in_len, op, out_len, wrkmem);
257 + op += *out_len;
258 + }
259 +
260 + if (t > 0) {
261 + ii = in + in_len - t;
262 +
263 + if (op == out && t <= 238) {
264 + *op++ = (17 + t);
265 + } else if (t <= 3) {
266 + op[-2] |= t;
267 + } else if (t <= 18) {
268 + *op++ = (t - 3);
269 + } else {
270 + size_t tt = t - 18;
271 +
272 + *op++ = 0;
273 + while (tt > 255) {
274 + tt -= 255;
275 + *op++ = 0;
276 + }
277 +
278 + *op++ = tt;
279 + }
280 + do {
281 + *op++ = *ii++;
282 + } while (--t > 0);
283 + }
284 +
285 + *op++ = M4_MARKER | 1;
286 + *op++ = 0;
287 + *op++ = 0;
288 +
289 + *out_len = op - out;
290 + return LZO_E_OK;
291 +}
292 +EXPORT_SYMBOL_GPL(lzo1x_1_compress);
293 +
294 +MODULE_LICENSE("GPL");
295 +MODULE_DESCRIPTION("LZO1X-1 Compressor");
296 +
297 diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_decompress.c compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_decompress.c
298 --- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 1970-01-01 01:00:00.000000000 +0100
299 +++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo1x_decompress.c 2009-10-17 09:35:59.000000000 +0200
300 @@ -0,0 +1,255 @@
301 +/*
302 + * LZO1X Decompressor from MiniLZO
303 + *
304 + * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com>
305 + *
306 + * The full LZO package can be found at:
307 + * http://www.oberhumer.com/opensource/lzo/
308 + *
309 + * Changed for kernel use by:
310 + * Nitin Gupta <nitingupta910@gmail.com>
311 + * Richard Purdie <rpurdie@openedhand.com>
312 + */
313 +
314 +#include <linux/module.h>
315 +#include <linux/kernel.h>
316 +#include <asm/byteorder.h>
317 +#include <asm/unaligned.h>
318 +
319 +#include "lzodefs.h"
320 +#include "lzo.h"
321 +
322 +#define HAVE_IP(x, ip_end, ip) ((size_t)(ip_end - ip) < (x))
323 +#define HAVE_OP(x, op_end, op) ((size_t)(op_end - op) < (x))
324 +#define HAVE_LB(m_pos, out, op) (m_pos < out || m_pos >= op)
325 +
326 +#define COPY4(dst, src) \
327 + put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
328 +
329 +int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
330 + unsigned char *out, size_t *out_len)
331 +{
332 + const unsigned char * const ip_end = in + in_len;
333 + unsigned char * const op_end = out + *out_len;
334 + const unsigned char *ip = in, *m_pos;
335 + unsigned char *op = out;
336 + size_t t;
337 +
338 + *out_len = 0;
339 +
340 + if (*ip > 17) {
341 + t = *ip++ - 17;
342 + if (t < 4)
343 + goto match_next;
344 + if (HAVE_OP(t, op_end, op))
345 + goto output_overrun;
346 + if (HAVE_IP(t + 1, ip_end, ip))
347 + goto input_overrun;
348 + do {
349 + *op++ = *ip++;
350 + } while (--t > 0);
351 + goto first_literal_run;
352 + }
353 +
354 + while ((ip < ip_end)) {
355 + t = *ip++;
356 + if (t >= 16)
357 + goto match;
358 + if (t == 0) {
359 + if (HAVE_IP(1, ip_end, ip))
360 + goto input_overrun;
361 + while (*ip == 0) {
362 + t += 255;
363 + ip++;
364 + if (HAVE_IP(1, ip_end, ip))
365 + goto input_overrun;
366 + }
367 + t += 15 + *ip++;
368 + }
369 + if (HAVE_OP(t + 3, op_end, op))
370 + goto output_overrun;
371 + if (HAVE_IP(t + 4, ip_end, ip))
372 + goto input_overrun;
373 +
374 + COPY4(op, ip);
375 + op += 4;
376 + ip += 4;
377 + if (--t > 0) {
378 + if (t >= 4) {
379 + do {
380 + COPY4(op, ip);
381 + op += 4;
382 + ip += 4;
383 + t -= 4;
384 + } while (t >= 4);
385 + if (t > 0) {
386 + do {
387 + *op++ = *ip++;
388 + } while (--t > 0);
389 + }
390 + } else {
391 + do {
392 + *op++ = *ip++;
393 + } while (--t > 0);
394 + }
395 + }
396 +
397 +first_literal_run:
398 + t = *ip++;
399 + if (t >= 16)
400 + goto match;
401 + m_pos = op - (1 + M2_MAX_OFFSET);
402 + m_pos -= t >> 2;
403 + m_pos -= *ip++ << 2;
404 +
405 + if (HAVE_LB(m_pos, out, op))
406 + goto lookbehind_overrun;
407 +
408 + if (HAVE_OP(3, op_end, op))
409 + goto output_overrun;
410 + *op++ = *m_pos++;
411 + *op++ = *m_pos++;
412 + *op++ = *m_pos;
413 +
414 + goto match_done;
415 +
416 + do {
417 +match:
418 + if (t >= 64) {
419 + m_pos = op - 1;
420 + m_pos -= (t >> 2) & 7;
421 + m_pos -= *ip++ << 3;
422 + t = (t >> 5) - 1;
423 + if (HAVE_LB(m_pos, out, op))
424 + goto lookbehind_overrun;
425 + if (HAVE_OP(t + 3 - 1, op_end, op))
426 + goto output_overrun;
427 + goto copy_match;
428 + } else if (t >= 32) {
429 + t &= 31;
430 + if (t == 0) {
431 + if (HAVE_IP(1, ip_end, ip))
432 + goto input_overrun;
433 + while (*ip == 0) {
434 + t += 255;
435 + ip++;
436 + if (HAVE_IP(1, ip_end, ip))
437 + goto input_overrun;
438 + }
439 + t += 31 + *ip++;
440 + }
441 + m_pos = op - 1;
442 + m_pos -= le16_to_cpu(get_unaligned(
443 + (const unsigned short *)ip)) >> 2;
444 + ip += 2;
445 + } else if (t >= 16) {
446 + m_pos = op;
447 + m_pos -= (t & 8) << 11;
448 +
449 + t &= 7;
450 + if (t == 0) {
451 + if (HAVE_IP(1, ip_end, ip))
452 + goto input_overrun;
453 + while (*ip == 0) {
454 + t += 255;
455 + ip++;
456 + if (HAVE_IP(1, ip_end, ip))
457 + goto input_overrun;
458 + }
459 + t += 7 + *ip++;
460 + }
461 + m_pos -= le16_to_cpu(get_unaligned(
462 + (const unsigned short *)ip)) >> 2;
463 + ip += 2;
464 + if (m_pos == op)
465 + goto eof_found;
466 + m_pos -= 0x4000;
467 + } else {
468 + m_pos = op - 1;
469 + m_pos -= t >> 2;
470 + m_pos -= *ip++ << 2;
471 +
472 + if (HAVE_LB(m_pos, out, op))
473 + goto lookbehind_overrun;
474 + if (HAVE_OP(2, op_end, op))
475 + goto output_overrun;
476 +
477 + *op++ = *m_pos++;
478 + *op++ = *m_pos;
479 + goto match_done;
480 + }
481 +
482 + if (HAVE_LB(m_pos, out, op))
483 + goto lookbehind_overrun;
484 + if (HAVE_OP(t + 3 - 1, op_end, op))
485 + goto output_overrun;
486 +
487 + if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) {
488 + COPY4(op, m_pos);
489 + op += 4;
490 + m_pos += 4;
491 + t -= 4 - (3 - 1);
492 + do {
493 + COPY4(op, m_pos);
494 + op += 4;
495 + m_pos += 4;
496 + t -= 4;
497 + } while (t >= 4);
498 + if (t > 0)
499 + do {
500 + *op++ = *m_pos++;
501 + } while (--t > 0);
502 + } else {
503 +copy_match:
504 + *op++ = *m_pos++;
505 + *op++ = *m_pos++;
506 + do {
507 + *op++ = *m_pos++;
508 + } while (--t > 0);
509 + }
510 +match_done:
511 + t = ip[-2] & 3;
512 + if (t == 0)
513 + break;
514 +match_next:
515 + if (HAVE_OP(t, op_end, op))
516 + goto output_overrun;
517 + if (HAVE_IP(t + 1, ip_end, ip))
518 + goto input_overrun;
519 +
520 + *op++ = *ip++;
521 + if (t > 1) {
522 + *op++ = *ip++;
523 + if (t > 2)
524 + *op++ = *ip++;
525 + }
526 +
527 + t = *ip++;
528 + } while (ip < ip_end);
529 + }
530 +
531 + *out_len = op - out;
532 + return LZO_E_EOF_NOT_FOUND;
533 +
534 +eof_found:
535 + *out_len = op - out;
536 + return (ip == ip_end ? LZO_E_OK :
537 + (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
538 +input_overrun:
539 + *out_len = op - out;
540 + return LZO_E_INPUT_OVERRUN;
541 +
542 +output_overrun:
543 + *out_len = op - out;
544 + return LZO_E_OUTPUT_OVERRUN;
545 +
546 +lookbehind_overrun:
547 + *out_len = op - out;
548 + return LZO_E_LOOKBEHIND_OVERRUN;
549 +}
550 +
551 +EXPORT_SYMBOL_GPL(lzo1x_decompress_safe);
552 +
553 +MODULE_LICENSE("GPL");
554 +MODULE_DESCRIPTION("LZO1X Decompressor");
555 +
556 diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzodefs.h compcache-0.5.4/sub-projects/compression/lzo-kmod/lzodefs.h
557 --- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzodefs.h 1970-01-01 01:00:00.000000000 +0100
558 +++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzodefs.h 2009-10-17 09:35:59.000000000 +0200
559 @@ -0,0 +1,43 @@
560 +/*
561 + * lzodefs.h -- architecture, OS and compiler specific defines
562 + *
563 + * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com>
564 + *
565 + * The full LZO package can be found at:
566 + * http://www.oberhumer.com/opensource/lzo/
567 + *
568 + * Changed for kernel use by:
569 + * Nitin Gupta <nitingupta910@gmail.com>
570 + * Richard Purdie <rpurdie@openedhand.com>
571 + */
572 +
573 +#define LZO_VERSION 0x2020
574 +#define LZO_VERSION_STRING "2.02"
575 +#define LZO_VERSION_DATE "Oct 17 2005"
576 +
577 +#define M1_MAX_OFFSET 0x0400
578 +#define M2_MAX_OFFSET 0x0800
579 +#define M3_MAX_OFFSET 0x4000
580 +#define M4_MAX_OFFSET 0xbfff
581 +
582 +#define M1_MIN_LEN 2
583 +#define M1_MAX_LEN 2
584 +#define M2_MIN_LEN 3
585 +#define M2_MAX_LEN 8
586 +#define M3_MIN_LEN 3
587 +#define M3_MAX_LEN 33
588 +#define M4_MIN_LEN 3
589 +#define M4_MAX_LEN 9
590 +
591 +#define M1_MARKER 0
592 +#define M2_MARKER 64
593 +#define M3_MARKER 32
594 +#define M4_MARKER 16
595 +
596 +#define D_BITS 14
597 +#define D_MASK ((1u << D_BITS) - 1)
598 +#define D_HIGH ((D_MASK >> 1) + 1)
599 +
600 +#define DX2(p, s1, s2) (((((size_t)((p)[2]) << (s2)) ^ (p)[1]) \
601 + << (s1)) ^ (p)[0])
602 +#define DX3(p, s1, s2, s3) ((DX2((p)+1, s2, s3) << (s1)) ^ (p)[0])
603 diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo.h compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo.h
604 --- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/lzo.h 1970-01-01 01:00:00.000000000 +0100
605 +++ compcache-0.5.4/sub-projects/compression/lzo-kmod/lzo.h 2009-10-17 09:35:59.000000000 +0200
606 @@ -0,0 +1,44 @@
607 +#ifndef __LZO_H__
608 +#define __LZO_H__
609 +/*
610 + * LZO Public Kernel Interface
611 + * A mini subset of the LZO real-time data compression library
612 + *
613 + * Copyright (C) 1996-2005 Markus F.X.J. Oberhumer <markus@oberhumer.com>
614 + *
615 + * The full LZO package can be found at:
616 + * http://www.oberhumer.com/opensource/lzo/
617 + *
618 + * Changed for kernel use by:
619 + * Nitin Gupta <nitingupta910@gmail.com>
620 + * Richard Purdie <rpurdie@openedhand.com>
621 + */
622 +
623 +#define LZO1X_MEM_COMPRESS (16384 * sizeof(unsigned char *))
624 +#define LZO1X_1_MEM_COMPRESS LZO1X_MEM_COMPRESS
625 +
626 +#define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3)
627 +
628 +/* This requires 'workmem' of size LZO1X_1_MEM_COMPRESS */
629 +int lzo1x_1_compress(const unsigned char *src, size_t src_len,
630 + unsigned char *dst, size_t *dst_len, void *wrkmem);
631 +
632 +/* safe decompression with overrun testing */
633 +int lzo1x_decompress_safe(const unsigned char *src, size_t src_len,
634 + unsigned char *dst, size_t *dst_len);
635 +
636 +/*
637 + * Return values (< 0 = Error)
638 + */
639 +#define LZO_E_OK 0
640 +#define LZO_E_ERROR (-1)
641 +#define LZO_E_OUT_OF_MEMORY (-2)
642 +#define LZO_E_NOT_COMPRESSIBLE (-3)
643 +#define LZO_E_INPUT_OVERRUN (-4)
644 +#define LZO_E_OUTPUT_OVERRUN (-5)
645 +#define LZO_E_LOOKBEHIND_OVERRUN (-6)
646 +#define LZO_E_EOF_NOT_FOUND (-7)
647 +#define LZO_E_INPUT_NOT_CONSUMED (-8)
648 +#define LZO_E_NOT_YET_IMPLEMENTED (-9)
649 +
650 +#endif
651 diff -uNr compcache-0.5.4-old/sub-projects/compression/lzo-kmod/Makefile compcache-0.5.4/sub-projects/compression/lzo-kmod/Makefile
652 --- compcache-0.5.4-old/sub-projects/compression/lzo-kmod/Makefile 1970-01-01 01:00:00.000000000 +0100
653 +++ compcache-0.5.4/sub-projects/compression/lzo-kmod/Makefile 2009-10-17 09:35:59.000000000 +0200
654 @@ -0,0 +1,8 @@
655 +obj-m += lzo1x_compress.o lzo1x_decompress.o
656 +
657 +all:
658 + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
659 +
660 +clean:
661 + make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
662 +