x86/speculation/mds: Add sysfs reporting for MDS
[linux/fpc-iii.git] / include / crypto / internal / acompress.h
blob51052f65cefc6a81ef465437038492d1fe6c00f4
1 /*
2 * Asynchronous Compression operations
4 * Copyright (c) 2016, Intel Corporation
5 * Authors: Weigang Li <weigang.li@intel.com>
6 * Giovanni Cabiddu <giovanni.cabiddu@intel.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
14 #ifndef _CRYPTO_ACOMP_INT_H
15 #define _CRYPTO_ACOMP_INT_H
16 #include <crypto/acompress.h>
19 * Transform internal helpers.
21 static inline void *acomp_request_ctx(struct acomp_req *req)
23 return req->__ctx;
26 static inline void *acomp_tfm_ctx(struct crypto_acomp *tfm)
28 return tfm->base.__crt_ctx;
31 static inline void acomp_request_complete(struct acomp_req *req,
32 int err)
34 req->base.complete(&req->base, err);
37 static inline const char *acomp_alg_name(struct crypto_acomp *tfm)
39 return crypto_acomp_tfm(tfm)->__crt_alg->cra_name;
42 static inline struct acomp_req *__acomp_request_alloc(struct crypto_acomp *tfm)
44 struct acomp_req *req;
46 req = kzalloc(sizeof(*req) + crypto_acomp_reqsize(tfm), GFP_KERNEL);
47 if (likely(req))
48 acomp_request_set_tfm(req, tfm);
49 return req;
52 static inline void __acomp_request_free(struct acomp_req *req)
54 kzfree(req);
57 /**
58 * crypto_register_acomp() -- Register asynchronous compression algorithm
60 * Function registers an implementation of an asynchronous
61 * compression algorithm
63 * @alg: algorithm definition
65 * Return: zero on success; error code in case of error
67 int crypto_register_acomp(struct acomp_alg *alg);
69 /**
70 * crypto_unregister_acomp() -- Unregister asynchronous compression algorithm
72 * Function unregisters an implementation of an asynchronous
73 * compression algorithm
75 * @alg: algorithm definition
77 * Return: zero on success; error code in case of error
79 int crypto_unregister_acomp(struct acomp_alg *alg);
81 int crypto_register_acomps(struct acomp_alg *algs, int count);
82 void crypto_unregister_acomps(struct acomp_alg *algs, int count);
84 #endif