From 1d04b4d5361af60c3b46a406fefaa2b5625b1793 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 10 Mar 2015 15:20:52 +0100 Subject: 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 Signed-off-by: Richard Weinberger --- ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'ubifs-utils/mkfs.ubifs/mkfs.ubifs.c') diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index 58200de..90e727c 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -483,7 +483,11 @@ static int get_options(int argc, char**argv) c->orph_lebs = 1; c->key_hash = key_r5_hash; c->key_len = UBIFS_SK_LEN; +#ifdef WITHOUT_LZO + c->default_compr = UBIFS_COMPR_ZLIB; +#else c->default_compr = UBIFS_COMPR_LZO; +#endif c->favor_percent = 20; c->lsave_cnt = 256; c->leb_size = -1; @@ -592,21 +596,29 @@ static int get_options(int argc, char**argv) return err_msg("bad key hash"); break; case 'x': - if (strcmp(optarg, "favor_lzo") == 0) - c->favor_lzo = 1; + if (strcmp(optarg, "none") == 0) + c->default_compr = UBIFS_COMPR_NONE; else if (strcmp(optarg, "zlib") == 0) c->default_compr = UBIFS_COMPR_ZLIB; - else if (strcmp(optarg, "none") == 0) - c->default_compr = UBIFS_COMPR_NONE; +#ifndef WITHOUT_LZO + else if (strcmp(optarg, "favor_lzo") == 0) + c->favor_lzo = 1; else if (strcmp(optarg, "lzo") != 0) +#else + else +#endif return err_msg("bad compressor name"); break; case 'X': +#ifdef WITHOT_LZO + return err_msg("built without LZO support"); +#else c->favor_percent = strtol(optarg, &endp, 0); if (*endp != '\0' || endp == optarg || c->favor_percent <= 0 || c->favor_percent >= 100) return err_msg("bad favor LZO percent '%s'", optarg); +#endif break; case 'j': c->max_bud_bytes = get_bytes(optarg); @@ -1464,7 +1476,11 @@ static int add_file(const char *path_name, struct stat *st, ino_t inum, out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ; if (c->default_compr == UBIFS_COMPR_NONE && (flags & FS_COMPR_FL)) +#ifdef WITHOUT_LZO + use_compr = UBIFS_COMPR_ZLIB; +#else use_compr = UBIFS_COMPR_LZO; +#endif else use_compr = c->default_compr; compr_type = compress_data(buf, bytes_read, &dn->data, -- cgit v1.2.3