X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/d5d38d7ac5a49733ac26a3c8c2c917d98e685dfd..66a8e8ec8d60368b6ccfa179d014424f409eed77:/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch diff --git a/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch b/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch index 35a7cd86f..7ab4f63ba 100644 --- a/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch +++ b/tools/mtd-utils/patches/101-ubifs-optional_lzo.patch @@ -1,39 +1,44 @@ -diff --git a/mkfs.ubifs/Makefile b/mkfs.ubifs/Makefile -index a678b0a..919ce89 100644 --- a/mkfs.ubifs/Makefile +++ b/mkfs.ubifs/Makefile -@@ -5,7 +5,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch] +@@ -6,7 +6,7 @@ ALL_SOURCES=*.[ch] hashtable/*.[ch] TARGETS = mkfs.ubifs --LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L../ubi-utils/ -lubi -+LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L../ubi-utils/ -lubi +-LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi ++LDLIBS_mkfs.ubifs = -lz $(if,$(NO_LZO),,-llzo2) -lm -luuid -L$(BUILDDIR)/../ubi-utils/ -lubi + LDLIBS_mkfs.ubifs += -L$(BUILDDIR)/../lib -lmtd -lcrc32 + LDLIBS_mkfs.ubifs += $(ZLIBLDFLAGS) $(LZOLDFLAGS) - include ../common.mk - -diff --git a/mkfs.ubifs/compr.c b/mkfs.ubifs/compr.c -index e378c5d..0208f80 100644 --- a/mkfs.ubifs/compr.c +++ b/mkfs.ubifs/compr.c -@@ -83,6 +83,17 @@ static int zlib_deflate(void *in_buf, size_t in_len, void *out_buf, +@@ -24,7 +24,9 @@ + #include + #include + #include ++#if CONFIG_UBIFS_LZO + #include ++#endif + #include + + #define crc32 __zlib_crc32 +@@ -86,6 +88,16 @@ static int zlib_deflate(void *in_buf, si return 0; } +static int no_compress(void *in_buf, size_t in_len, void *out_buf, -+ size_t *out_len) ++ size_t *out_len) +{ + memcpy(out_buf, in_buf, in_len); + *out_len = in_len; + return 0; +} + -+ +#if CONFIG_UBIFS_LZO + static int lzo_compress(void *in_buf, size_t in_len, void *out_buf, size_t *out_len) { -@@ -101,14 +112,16 @@ static int lzo_compress(void *in_buf, size_t in_len, void *out_buf, +@@ -104,14 +116,16 @@ static int lzo_compress(void *in_buf, si return 0; } @@ -47,7 +52,7 @@ index e378c5d..0208f80 100644 - memcpy(out_buf, in_buf, in_len); - *out_len = in_len; - return 0; -+ return -1; ++ return 1; } +#endif @@ -55,7 +60,7 @@ index e378c5d..0208f80 100644 static char *zlib_buf; static int favor_lzo_compress(void *in_buf, size_t in_len, void *out_buf, -@@ -195,9 +208,11 @@ int compress_data(void *in_buf, size_t in_len, void *out_buf, size_t *out_len, +@@ -198,9 +212,11 @@ int compress_data(void *in_buf, size_t i int init_compression(void) { @@ -67,7 +72,7 @@ index e378c5d..0208f80 100644 zlib_buf = malloc(UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR); if (!zlib_buf) { -@@ -211,7 +226,9 @@ int init_compression(void) +@@ -214,7 +230,9 @@ int init_compression(void) void destroy_compression(void) { free(zlib_buf);