000-provide_lzo_kmod.patch 14 KB

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