summaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs/compr.c
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2015-03-10 15:20:52 +0100
committerRichard Weinberger <richard@nod.at>2015-11-12 11:05:55 +0100
commit1d04b4d5361af60c3b46a406fefaa2b5625b1793 (patch)
tree4e8d2e9eaf4ed4c82a7813c1bc6df3882693fcac /ubifs-utils/mkfs.ubifs/compr.c
parent803b8ddbaea4f049cbf360682e80bc2f1aea12e2 (diff)
fix build when WITHOUT_LZO is set
Make mkfs.ubifs honor the WITHOUT_LZO flag, too. Fixes this build error: mkfs.ubifs/compr.c:27:23: lzo/lzo1x.h: No such file or directory mkfs.ubifs/compr.c: In function `lzo_compress': mkfs.ubifs/compr.c:92: error: `lzo_uint' undeclared (first use in this function) mkfs.ubifs/compr.c:92: error: (Each undeclared identifier is reported only once mkfs.ubifs/compr.c:92: error: for each function it appears in.) mkfs.ubifs/compr.c:92: error: syntax error before "len" mkfs.ubifs/compr.c:95: error: `len' undeclared (first use in this function) mkfs.ubifs/compr.c:96: warning: implicit declaration of function `lzo1x_999_compress' mkfs.ubifs/compr.c:99: error: `LZO_E_OK' undeclared (first use in this function) mkfs.ubifs/compr.c: In function `init_compression': mkfs.ubifs/compr.c:201: error: `LZO1X_999_MEM_COMPRESS' undeclared (first use in this function) Signed-off-by: Rolf Eike Beer <eb@emlix.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/compr.c')
-rw-r--r--ubifs-utils/mkfs.ubifs/compr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ubifs-utils/mkfs.ubifs/compr.c b/ubifs-utils/mkfs.ubifs/compr.c
index 34b2f60..d534f10 100644
--- a/ubifs-utils/mkfs.ubifs/compr.c
+++ b/ubifs-utils/mkfs.ubifs/compr.c
@@ -24,7 +24,9 @@
#include <stdio.h>
#include <stdint.h>
#include <string.h>
+#ifndef WITHOUT_LZO
#include <lzo/lzo1x.h>
+#endif
#include <linux/types.h>
#define crc32 __zlib_crc32
@@ -85,6 +87,7 @@ static int zlib_deflate(void *in_buf, size_t in_len, void *out_buf,
return 0;
}
+#ifndef WITHOUT_LZO
static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
{
@@ -102,6 +105,7 @@ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf,
return 0;
}
+#endif
static int no_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len)
@@ -113,6 +117,7 @@ static int no_compress(void *in_buf, size_t in_len, void *out_buf,
static char *zlib_buf;
+#ifndef WITHOUT_LZO
static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf,
size_t *out_len, int *type)
{
@@ -158,6 +163,7 @@ select_zlib:
memcpy(out_buf, zlib_buf, zlib_len);
return 0;
}
+#endif
int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
int type)
@@ -169,6 +175,10 @@ int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
return MKFS_UBIFS_COMPR_NONE;
}
+#ifdef WITHOUT_LZO
+ {
+ switch (type) {
+#else
if (c->favor_lzo)
ret = favor_lzo_compress(in_buf, in_len, out_buf, out_len, &type);
else {
@@ -176,6 +186,7 @@ int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
case MKFS_UBIFS_COMPR_LZO:
ret = lzo_compress(in_buf, in_len, out_buf, out_len);
break;
+#endif
case MKFS_UBIFS_COMPR_ZLIB:
ret = zlib_deflate(in_buf, in_len, out_buf, out_len);
break;
@@ -197,9 +208,13 @@ int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len,
int init_compression(void)
{
+#ifdef WITHOUT_LZO
+ lzo_mem = NULL;
+#else
lzo_mem = malloc(LZO1X_999_MEM_COMPRESS);
if (!lzo_mem)
return -1;
+#endif
zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR);
if (!zlib_buf) {