From 018d80007e6d9469077d938872e605f826010767 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 9 Jan 2017 14:00:24 +0100 Subject: kernel: remove ubifs xz decompression support It has been unused, and less useful than squashfs for cases where flash space usage matters. Signed-off-by: Felix Fietkau --- .../540-crypto-xz-decompression-support.patch | 146 --------------------- .../541-ubifs-xz-decompression-support.patch | 92 ------------- 2 files changed, 238 deletions(-) delete mode 100644 target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch delete mode 100644 target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch (limited to 'target/linux/generic/patches-3.18') diff --git a/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch deleted file mode 100644 index 00b0b7cadd..0000000000 --- a/target/linux/generic/patches-3.18/540-crypto-xz-decompression-support.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- a/crypto/Kconfig -+++ b/crypto/Kconfig -@@ -1437,6 +1437,13 @@ config CRYPTO_LZ4HC - help - This is the LZ4 high compression mode algorithm. - -+config CRYPTO_XZ -+ tristate "XZ compression algorithm" -+ select CRYPTO_ALGAPI -+ select XZ_DEC -+ help -+ This is the XZ algorithm. Only decompression is supported for now. -+ - comment "Random Number Generation" - - config CRYPTO_ANSI_CPRNG ---- a/crypto/Makefile -+++ b/crypto/Makefile -@@ -89,6 +89,7 @@ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc. - obj-$(CONFIG_CRYPTO_LZO) += lzo.o - obj-$(CONFIG_CRYPTO_LZ4) += lz4.o - obj-$(CONFIG_CRYPTO_LZ4HC) += lz4hc.o -+obj-$(CONFIG_CRYPTO_XZ) += xz.o - obj-$(CONFIG_CRYPTO_842) += 842.o - obj-$(CONFIG_CRYPTO_RNG2) += rng.o - obj-$(CONFIG_CRYPTO_RNG2) += krng.o ---- /dev/null -+++ b/crypto/xz.c -@@ -0,0 +1,117 @@ -+/* -+ * Cryptographic API. -+ * -+ * XZ decompression support. -+ * -+ * Copyright (c) 2012 Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ * -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct xz_comp_ctx { -+ struct xz_dec *decomp_state; -+ struct xz_buf decomp_buf; -+}; -+ -+static int crypto_xz_decomp_init(struct xz_comp_ctx *ctx) -+{ -+ ctx->decomp_state = xz_dec_init(XZ_SINGLE, 0); -+ if (!ctx->decomp_state) -+ return -ENOMEM; -+ -+ return 0; -+} -+ -+static void crypto_xz_decomp_exit(struct xz_comp_ctx *ctx) -+{ -+ xz_dec_end(ctx->decomp_state); -+} -+ -+static int crypto_xz_init(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ return crypto_xz_decomp_init(ctx); -+} -+ -+static void crypto_xz_exit(struct crypto_tfm *tfm) -+{ -+ struct xz_comp_ctx *ctx = crypto_tfm_ctx(tfm); -+ -+ crypto_xz_decomp_exit(ctx); -+} -+ -+static int crypto_xz_compress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ return -EOPNOTSUPP; -+} -+ -+static int crypto_xz_decompress(struct crypto_tfm *tfm, const u8 *src, -+ unsigned int slen, u8 *dst, unsigned int *dlen) -+{ -+ struct xz_comp_ctx *dctx = crypto_tfm_ctx(tfm); -+ struct xz_buf *xz_buf = &dctx->decomp_buf; -+ int ret; -+ -+ memset(xz_buf, '\0', sizeof(struct xz_buf)); -+ -+ xz_buf->in = (u8 *) src; -+ xz_buf->in_pos = 0; -+ xz_buf->in_size = slen; -+ xz_buf->out = (u8 *) dst; -+ xz_buf->out_pos = 0; -+ xz_buf->out_size = *dlen; -+ -+ ret = xz_dec_run(dctx->decomp_state, xz_buf); -+ if (ret != XZ_STREAM_END) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ *dlen = xz_buf->out_pos; -+ ret = 0; -+ -+out: -+ return ret; -+} -+ -+static struct crypto_alg crypto_xz_alg = { -+ .cra_name = "xz", -+ .cra_flags = CRYPTO_ALG_TYPE_COMPRESS, -+ .cra_ctxsize = sizeof(struct xz_comp_ctx), -+ .cra_module = THIS_MODULE, -+ .cra_list = LIST_HEAD_INIT(crypto_xz_alg.cra_list), -+ .cra_init = crypto_xz_init, -+ .cra_exit = crypto_xz_exit, -+ .cra_u = { .compress = { -+ .coa_compress = crypto_xz_compress, -+ .coa_decompress = crypto_xz_decompress } } -+}; -+ -+static int __init crypto_xz_mod_init(void) -+{ -+ return crypto_register_alg(&crypto_xz_alg); -+} -+ -+static void __exit crypto_xz_mod_exit(void) -+{ -+ crypto_unregister_alg(&crypto_xz_alg); -+} -+ -+module_init(crypto_xz_mod_init); -+module_exit(crypto_xz_mod_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_DESCRIPTION("Crypto XZ decompression support"); -+MODULE_AUTHOR("Gabor Juhos "); diff --git a/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch deleted file mode 100644 index f85689c586..0000000000 --- a/target/linux/generic/patches-3.18/541-ubifs-xz-decompression-support.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- a/fs/ubifs/Kconfig -+++ b/fs/ubifs/Kconfig -@@ -5,8 +5,10 @@ config UBIFS_FS - select CRYPTO if UBIFS_FS_ADVANCED_COMPR - select CRYPTO if UBIFS_FS_LZO - select CRYPTO if UBIFS_FS_ZLIB -+ select CRYPTO if UBIFS_FS_XZ - select CRYPTO_LZO if UBIFS_FS_LZO - select CRYPTO_DEFLATE if UBIFS_FS_ZLIB -+ select CRYPTO_XZ if UBIFS_FS_XZ - depends on MTD_UBI - help - UBIFS is a file system for flash devices which works on top of UBI. -@@ -35,3 +37,12 @@ config UBIFS_FS_ZLIB - default y - help - Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. -+ -+config UBIFS_FS_XZ -+ bool "XZ decompression support" if UBIFS_FS_ADVANCED_COMPR -+ depends on UBIFS_FS -+ default y -+ help -+ XZ compresses better the ZLIB but it is slower.. -+ Say 'Y' if unsure. -+ ---- a/fs/ubifs/compress.c -+++ b/fs/ubifs/compress.c -@@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_comp - }; - #endif - -+#ifdef CONFIG_UBIFS_FS_XZ -+static DEFINE_MUTEX(xz_enc_mutex); -+static DEFINE_MUTEX(xz_dec_mutex); -+ -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .comp_mutex = &xz_enc_mutex, -+ .decomp_mutex = &xz_dec_mutex, -+ .name = "xz", -+ .capi_name = "xz", -+}; -+#else -+static struct ubifs_compressor xz_compr = { -+ .compr_type = UBIFS_COMPR_XZ, -+ .name = "xz", -+}; -+#endif -+ - /* All UBIFS compressors */ - struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; - -@@ -232,9 +250,15 @@ int __init ubifs_compressors_init(void) - if (err) - goto out_lzo; - -+ err = compr_init(&xz_compr); -+ if (err) -+ goto out_zlib; -+ - ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr; - return 0; - -+out_zlib: -+ compr_exit(&zlib_compr); - out_lzo: - compr_exit(&lzo_compr); - return err; -@@ -247,4 +271,5 @@ void ubifs_compressors_exit(void) - { - compr_exit(&lzo_compr); - compr_exit(&zlib_compr); -+ compr_exit(&xz_compr); - } ---- a/fs/ubifs/ubifs-media.h -+++ b/fs/ubifs/ubifs-media.h -@@ -332,12 +332,14 @@ enum { - * UBIFS_COMPR_NONE: no compression - * UBIFS_COMPR_LZO: LZO compression - * UBIFS_COMPR_ZLIB: ZLIB compression -+ * UBIFS_COMPR_XZ: XZ compression - * UBIFS_COMPR_TYPES_CNT: count of supported compression types - */ - enum { - UBIFS_COMPR_NONE, - UBIFS_COMPR_LZO, - UBIFS_COMPR_ZLIB, -+ UBIFS_COMPR_XZ, - UBIFS_COMPR_TYPES_CNT, - }; - -- cgit v1.2.3