summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-03-03 14:10:27 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-03-03 14:10:27 +0000
commitda628121b079927c72191f6066dfa3fb70bd4163 (patch)
tree8c44a42ca520b9ca4541cbe0dca366e1dedff063
parent419d9e2f54b51ff65399cf357ff3a2ddb8dafe52 (diff)
downloadmtk-20170518-da628121b079927c72191f6066dfa3fb70bd4163.zip
mtk-20170518-da628121b079927c72191f6066dfa3fb70bd4163.tar.gz
mtk-20170518-da628121b079927c72191f6066dfa3fb70bd4163.tar.bz2
linux/3.3: merge recent ubifs patches from 3.2
SVN-Revision: 30800
-rw-r--r--target/linux/generic/config-3.31
-rw-r--r--target/linux/generic/patches-3.3/540-crypto-xz-decompression-support.patch146
-rw-r--r--target/linux/generic/patches-3.3/541-ubifs-xz-decompression-support.patch94
-rw-r--r--target/linux/generic/patches-3.3/550-ubifs-symlink-xattr-support.patch67
-rw-r--r--target/linux/generic/patches-3.3/940-ocf_kbuild_integration.patch4
5 files changed, 310 insertions, 2 deletions
diff --git a/target/linux/generic/config-3.3 b/target/linux/generic/config-3.3
index f53668d..967b898 100644
--- a/target/linux/generic/config-3.3
+++ b/target/linux/generic/config-3.3
@@ -491,6 +491,7 @@ CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
# CONFIG_CRYPTO_VMAC is not set
# CONFIG_CRYPTO_WP512 is not set
# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_XZ is not set
# CONFIG_CRYPTO_XTS is not set
# CONFIG_CRYPTO_ZLIB is not set
# CONFIG_CRYSTALHD is not set
diff --git a/target/linux/generic/patches-3.3/540-crypto-xz-decompression-support.patch b/target/linux/generic/patches-3.3/540-crypto-xz-decompression-support.patch
new file mode 100644
index 0000000..3b37007
--- /dev/null
+++ b/target/linux/generic/patches-3.3/540-crypto-xz-decompression-support.patch
@@ -0,0 +1,146 @@
+--- a/crypto/Kconfig
++++ b/crypto/Kconfig
+@@ -924,6 +924,13 @@ config CRYPTO_LZO
+ help
+ This is the LZO 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
+@@ -82,6 +82,7 @@ obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += mich
+ obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
+ obj-$(CONFIG_CRYPTO_AUTHENC) += authenc.o authencesn.o
+ obj-$(CONFIG_CRYPTO_LZO) += lzo.o
++obj-$(CONFIG_CRYPTO_XZ) += xz.o
+ obj-$(CONFIG_CRYPTO_RNG2) += rng.o
+ obj-$(CONFIG_CRYPTO_RNG2) += krng.o
+ obj-$(CONFIG_CRYPTO_ANSI_CPRNG) += ansi_cprng.o
+--- /dev/null
++++ b/crypto/xz.c
+@@ -0,0 +1,117 @@
++/*
++ * Cryptographic API.
++ *
++ * XZ decompression support.
++ *
++ * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
++ *
++ * 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 <linux/init.h>
++#include <linux/module.h>
++#include <linux/crypto.h>
++#include <linux/xz.h>
++#include <linux/interrupt.h>
++#include <linux/mm.h>
++#include <linux/net.h>
++
++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 <juhosg@openwrt.org>");
diff --git a/target/linux/generic/patches-3.3/541-ubifs-xz-decompression-support.patch b/target/linux/generic/patches-3.3/541-ubifs-xz-decompression-support.patch
new file mode 100644
index 0000000..3c917c1
--- /dev/null
+++ b/target/linux/generic/patches-3.3/541-ubifs-xz-decompression-support.patch
@@ -0,0 +1,94 @@
+--- 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.
+@@ -42,6 +44,14 @@ config UBIFS_FS_ZLIB
+ 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.
++
+ # Debugging-related stuff
+ config UBIFS_FS_DEBUG
+ bool "Enable debugging support"
+--- 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 zlib_compr = {
++ .compr_type = UBIFS_COMPR_XZ,
++ .name = "xz",
++};
++#endif
++
+ /* All UBIFS compressors */
+ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
+
+@@ -233,9 +251,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;
+@@ -248,4 +272,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,
+ };
+
diff --git a/target/linux/generic/patches-3.3/550-ubifs-symlink-xattr-support.patch b/target/linux/generic/patches-3.3/550-ubifs-symlink-xattr-support.patch
new file mode 100644
index 0000000..b0d818e
--- /dev/null
+++ b/target/linux/generic/patches-3.3/550-ubifs-symlink-xattr-support.patch
@@ -0,0 +1,67 @@
+--- a/fs/ubifs/file.c
++++ b/fs/ubifs/file.c
+@@ -1575,6 +1575,12 @@ const struct inode_operations ubifs_syml
+ .follow_link = ubifs_follow_link,
+ .setattr = ubifs_setattr,
+ .getattr = ubifs_getattr,
++#ifdef CONFIG_UBIFS_FS_XATTR
++ .setxattr = ubifs_setxattr,
++ .getxattr = ubifs_getxattr,
++ .listxattr = ubifs_listxattr,
++ .removexattr = ubifs_removexattr,
++#endif
+ };
+
+ const struct file_operations ubifs_file_operations = {
+--- a/fs/ubifs/journal.c
++++ b/fs/ubifs/journal.c
+@@ -553,7 +553,8 @@ int ubifs_jnl_update(struct ubifs_info *
+
+ dbg_jnl("ino %lu, dent '%.*s', data len %d in dir ino %lu",
+ inode->i_ino, nm->len, nm->name, ui->data_len, dir->i_ino);
+- ubifs_assert(dir_ui->data_len == 0);
++ if (!xent)
++ ubifs_assert(dir_ui->data_len == 0);
+ ubifs_assert(mutex_is_locked(&dir_ui->ui_mutex));
+
+ dlen = UBIFS_DENT_NODE_SZ + nm->len + 1;
+@@ -573,6 +574,13 @@ int ubifs_jnl_update(struct ubifs_info *
+ aligned_dlen = ALIGN(dlen, 8);
+ aligned_ilen = ALIGN(ilen, 8);
+ len = aligned_dlen + aligned_ilen + UBIFS_INO_NODE_SZ;
++ if (xent) {
++ /*
++ * Make sure to account for dir_ui->data_len in
++ * length calculation in case there is extended attribute.
++ */
++ len += dir_ui->data_len;
++ }
+ dent = kmalloc(len, GFP_NOFS);
+ if (!dent)
+ return -ENOMEM;
+@@ -649,7 +657,8 @@ int ubifs_jnl_update(struct ubifs_info *
+
+ ino_key_init(c, &ino_key, dir->i_ino);
+ ino_offs += aligned_ilen;
+- err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs, UBIFS_INO_NODE_SZ);
++ err = ubifs_tnc_add(c, &ino_key, lnum, ino_offs,
++ UBIFS_INO_NODE_SZ + dir_ui->data_len);
+ if (err)
+ goto out_ro;
+
+--- a/fs/ubifs/xattr.c
++++ b/fs/ubifs/xattr.c
+@@ -209,12 +209,12 @@ static int change_xattr(struct ubifs_inf
+ goto out_free;
+ }
+ inode->i_size = ui->ui_size = size;
+- ui->data_len = size;
+
+ mutex_lock(&host_ui->ui_mutex);
+ host->i_ctime = ubifs_current_time(host);
+ host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
+ host_ui->xattr_size += CALC_XATTR_BYTES(size);
++ ui->data_len = size;
+
+ /*
+ * It is important to write the host inode after the xattr inode
diff --git a/target/linux/generic/patches-3.3/940-ocf_kbuild_integration.patch b/target/linux/generic/patches-3.3/940-ocf_kbuild_integration.patch
index 55a2bed..b5cce90 100644
--- a/target/linux/generic/patches-3.3/940-ocf_kbuild_integration.patch
+++ b/target/linux/generic/patches-3.3/940-ocf_kbuild_integration.patch
@@ -1,6 +1,6 @@
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
-@@ -961,3 +961,6 @@ config CRYPTO_USER_API_SKCIPHER
+@@ -968,3 +968,6 @@ config CRYPTO_USER_API_SKCIPHER
source "drivers/crypto/Kconfig"
endif # if CRYPTO
@@ -9,7 +9,7 @@
+
--- a/crypto/Makefile
+++ b/crypto/Makefile
-@@ -91,6 +91,8 @@ obj-$(CONFIG_CRYPTO_USER_API) += af_alg.
+@@ -92,6 +92,8 @@ obj-$(CONFIG_CRYPTO_USER_API) += af_alg.
obj-$(CONFIG_CRYPTO_USER_API_HASH) += algif_hash.o
obj-$(CONFIG_CRYPTO_USER_API_SKCIPHER) += algif_skcipher.o