Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: acomp - Add ACOMP_FBREQ_ON_STACK

Add a helper to create an on-stack fallback request from a given
request. Use this helper in acomp_do_nondma.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+27 -13
+1 -13
crypto/acompress.c
··· 253 253 254 254 static int acomp_do_nondma(struct acomp_req *req, bool comp) 255 255 { 256 - u32 keep = CRYPTO_ACOMP_REQ_SRC_VIRT | 257 - CRYPTO_ACOMP_REQ_SRC_NONDMA | 258 - CRYPTO_ACOMP_REQ_DST_VIRT | 259 - CRYPTO_ACOMP_REQ_DST_NONDMA; 260 - ACOMP_REQUEST_ON_STACK(fbreq, crypto_acomp_reqtfm(req)); 256 + ACOMP_FBREQ_ON_STACK(fbreq, req); 261 257 int err; 262 - 263 - acomp_request_set_callback(fbreq, req->base.flags, NULL, NULL); 264 - fbreq->base.flags &= ~keep; 265 - fbreq->base.flags |= req->base.flags & keep; 266 - fbreq->src = req->src; 267 - fbreq->dst = req->dst; 268 - fbreq->slen = req->slen; 269 - fbreq->dlen = req->dlen; 270 258 271 259 if (comp) 272 260 err = crypto_acomp_compress(fbreq);
+26
include/crypto/internal/acompress.h
··· 23 23 struct acomp_req *name = acomp_request_on_stack_init( \ 24 24 __##name##_req, (tfm), 0, true) 25 25 26 + #define ACOMP_FBREQ_ON_STACK(name, req) \ 27 + char __##name##_req[sizeof(struct acomp_req) + \ 28 + MAX_SYNC_COMP_REQSIZE] CRYPTO_MINALIGN_ATTR; \ 29 + struct acomp_req *name = acomp_fbreq_on_stack_init( \ 30 + __##name##_req, (req)) 31 + 26 32 /** 27 33 * struct acomp_alg - asynchronous compression algorithm 28 34 * ··· 239 233 static inline u32 acomp_request_flags(struct acomp_req *req) 240 234 { 241 235 return crypto_request_flags(&req->base) & ~CRYPTO_ACOMP_REQ_PRIVATE; 236 + } 237 + 238 + static inline struct acomp_req *acomp_fbreq_on_stack_init( 239 + char *buf, struct acomp_req *old) 240 + { 241 + struct crypto_acomp *tfm = crypto_acomp_reqtfm(old); 242 + struct acomp_req *req; 243 + 244 + req = acomp_request_on_stack_init(buf, tfm, 0, true); 245 + acomp_request_set_callback(req, acomp_request_flags(old), NULL, NULL); 246 + req->base.flags &= ~CRYPTO_ACOMP_REQ_PRIVATE; 247 + req->base.flags |= old->base.flags & CRYPTO_ACOMP_REQ_PRIVATE; 248 + req->src = old->src; 249 + req->dst = old->dst; 250 + req->slen = old->slen; 251 + req->dlen = old->dlen; 252 + req->soff = old->soff; 253 + req->doff = old->doff; 254 + 255 + return req; 242 256 } 243 257 244 258 #endif