Commit ed0733ea authored by Herbert Xu's avatar Herbert Xu

crypto: algapi - Move stat reporting into algapi

The stats code resurrected the unions from the early days of
kernel crypto.  This patch starts the process of moving them
out to the individual type structures as we do for everything
else.

In particular, add a report_stat function to cra_type and call
that from the stats code if available.  This allows us to move
the actual code over one-by-one.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent a71b772b
...@@ -204,6 +204,12 @@ static int crypto_reportstat_one(struct crypto_alg *alg, ...@@ -204,6 +204,12 @@ static int crypto_reportstat_one(struct crypto_alg *alg,
goto out; goto out;
} }
if (alg->cra_type && alg->cra_type->report_stat) {
if (alg->cra_type->report_stat(skb, alg))
goto nla_put_failure;
goto out;
}
switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) { switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) {
case CRYPTO_ALG_TYPE_AEAD: case CRYPTO_ALG_TYPE_AEAD:
if (crypto_report_aead(skb, alg)) if (crypto_report_aead(skb, alg))
......
...@@ -50,6 +50,9 @@ struct crypto_type { ...@@ -50,6 +50,9 @@ struct crypto_type {
void (*show)(struct seq_file *m, struct crypto_alg *alg); void (*show)(struct seq_file *m, struct crypto_alg *alg);
int (*report)(struct sk_buff *skb, struct crypto_alg *alg); int (*report)(struct sk_buff *skb, struct crypto_alg *alg);
void (*free)(struct crypto_instance *inst); void (*free)(struct crypto_instance *inst);
#ifdef CONFIG_CRYPTO_STATS
int (*report_stat)(struct sk_buff *skb, struct crypto_alg *alg);
#endif
unsigned int type; unsigned int type;
unsigned int maskclear; unsigned int maskclear;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment