Skip to content

Commit 3de4f5e

Browse files
gcabidduherbertx
authored andcommitted
crypto: scomp - allow registration of multiple scomps
Add crypto_register_scomps and crypto_unregister_scomps 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>
1 parent 6263b51 commit 3de4f5e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

crypto/scompress.c

+29
Original file line numberDiff line numberDiff line change
@@ -353,5 +353,34 @@ int crypto_unregister_scomp(struct scomp_alg *alg)
353353
}
354354
EXPORT_SYMBOL_GPL(crypto_unregister_scomp);
355355

356+
int crypto_register_scomps(struct scomp_alg *algs, int count)
357+
{
358+
int i, ret;
359+
360+
for (i = 0; i < count; i++) {
361+
ret = crypto_register_scomp(&algs[i]);
362+
if (ret)
363+
goto err;
364+
}
365+
366+
return 0;
367+
368+
err:
369+
for (--i; i >= 0; --i)
370+
crypto_unregister_scomp(&algs[i]);
371+
372+
return ret;
373+
}
374+
EXPORT_SYMBOL_GPL(crypto_register_scomps);
375+
376+
void crypto_unregister_scomps(struct scomp_alg *algs, int count)
377+
{
378+
int i;
379+
380+
for (i = count - 1; i >= 0; --i)
381+
crypto_unregister_scomp(&algs[i]);
382+
}
383+
EXPORT_SYMBOL_GPL(crypto_unregister_scomps);
384+
356385
MODULE_LICENSE("GPL");
357386
MODULE_DESCRIPTION("Synchronous compression type");

include/crypto/internal/scompress.h

+3
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,7 @@ int crypto_register_scomp(struct scomp_alg *alg);
133133
*/
134134
int crypto_unregister_scomp(struct scomp_alg *alg);
135135

136+
int crypto_register_scomps(struct scomp_alg *algs, int count);
137+
void crypto_unregister_scomps(struct scomp_alg *algs, int count);
138+
136139
#endif

0 commit comments

Comments
 (0)