summaryrefslogtreecommitdiff
path: root/crypto/acompress.c
diff options
context:
space:
mode:
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>2017-04-19 14:23:05 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2017-04-21 20:30:50 +0800
commitca5ec25be9a6c04d46d5b893f060e7d001c69a34 (patch)
tree760a296fdfdc68daf167206862240b459e812d21 /crypto/acompress.c
parent6ca133a69d99f3f2b3590bcebb4d48553852b42a (diff)
downloadlinux-crypto-ca5ec25be9a6c04d46d5b893f060e7d001c69a34.tar.gz
linux-crypto-ca5ec25be9a6c04d46d5b893f060e7d001c69a34.zip
crypto: acomp - allow registration of multiple acomps
Add crypto_register_acomps and crypto_unregister_acomps to allow the registration of multiple implementations with one call. Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/acompress.c')
-rw-r--r--crypto/acompress.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/crypto/acompress.c b/crypto/acompress.c
index 47d11627..1544b7c0 100644
--- a/crypto/acompress.c
+++ b/crypto/acompress.c
@@ -166,5 +166,34 @@ int crypto_unregister_acomp(struct acomp_alg *alg)
}
EXPORT_SYMBOL_GPL(crypto_unregister_acomp);
+int crypto_register_acomps(struct acomp_alg *algs, int count)
+{
+ int i, ret;
+
+ for (i = 0; i < count; i++) {
+ ret = crypto_register_acomp(&algs[i]);
+ if (ret)
+ goto err;
+ }
+
+ return 0;
+
+err:
+ for (--i; i >= 0; --i)
+ crypto_unregister_acomp(&algs[i]);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(crypto_register_acomps);
+
+void crypto_unregister_acomps(struct acomp_alg *algs, int count)
+{
+ int i;
+
+ for (i = count - 1; i >= 0; --i)
+ crypto_unregister_acomp(&algs[i]);
+}
+EXPORT_SYMBOL_GPL(crypto_unregister_acomps);
+
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Asynchronous compression type");