Subject: [patch 1/1] add cast to regain ablkcipher_request from private ctx

This cast allows to regain the struct ablkcipher_request for a request
from private data.

Signed-off-by: Sebastian Siewior <[email protected]>
Index: b/include/linux/crypto.h
===================================================================
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -600,6 +600,12 @@ static inline struct ablkcipher_request
return container_of(req, struct ablkcipher_request, base);
}

+static inline struct ablkcipher_request *ablkcipher_ctx_cast(
+ void *ctx)
+{
+ return container_of(ctx, struct ablkcipher_request, __ctx);
+}
+
static inline struct ablkcipher_request *ablkcipher_request_alloc(
struct crypto_ablkcipher *tfm, gfp_t gfp)
{

--


2007-06-22 12:39:19

by Herbert Xu

[permalink] [raw]
Subject: Re: [patch 1/1] add cast to regain ablkcipher_request from private ctx

On Tue, Jun 12, 2007 at 04:20:23PM +0000, Sebastian Siewior wrote:
> This cast allows to regain the struct ablkcipher_request for a request
> from private data.

How about just passing the ablkcipher_request instead of the ctx?

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Subject: Re: [patch 1/1] add cast to regain ablkcipher_request from private ctx

* Herbert Xu | 2007-06-22 20:39:16 [+0800]:

>On Tue, Jun 12, 2007 at 04:20:23PM +0000, Sebastian Siewior wrote:
>> This cast allows to regain the struct ablkcipher_request for a request
>> from private data.
>
>How about just passing the ablkcipher_request instead of the ctx?
Not pretty/possible/wanted.
I could write now 20 lines of text that explains it. Instead I defer it
until I post my source for the driver what is hopefully soon.

>Cheers,

Sebastian