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 - Use request flag helpers and add acomp_request_flags

Use the newly added request flag helpers to manage the request
flags.

Also add acomp_request_flags which lets bottom-level users to
access the request flags without the bits private to the acomp
API.

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

+22 -11
+16 -11
include/crypto/acompress.h
··· 38 38 /* Set this bit if destination is a folio. */ 39 39 #define CRYPTO_ACOMP_REQ_DST_FOLIO 0x00000040 40 40 41 + /* Private flags that should not be touched by the user. */ 42 + #define CRYPTO_ACOMP_REQ_PRIVATE \ 43 + (CRYPTO_ACOMP_REQ_SRC_VIRT | CRYPTO_ACOMP_REQ_SRC_NONDMA | \ 44 + CRYPTO_ACOMP_REQ_DST_VIRT | CRYPTO_ACOMP_REQ_DST_NONDMA | \ 45 + CRYPTO_ACOMP_REQ_SRC_FOLIO | CRYPTO_ACOMP_REQ_DST_FOLIO) 46 + 41 47 #define CRYPTO_ACOMP_DST_MAX 131072 42 48 43 49 #define MAX_SYNC_COMP_REQSIZE 0 ··· 207 201 static inline void acomp_request_set_tfm(struct acomp_req *req, 208 202 struct crypto_acomp *tfm) 209 203 { 210 - req->base.tfm = crypto_acomp_tfm(tfm); 204 + crypto_request_set_tfm(&req->base, crypto_acomp_tfm(tfm)); 211 205 } 212 206 213 207 static inline bool acomp_is_async(struct crypto_acomp *tfm) ··· 304 298 return (void *)((char *)req + len); 305 299 } 306 300 301 + static inline bool acomp_req_on_stack(struct acomp_req *req) 302 + { 303 + return crypto_req_on_stack(&req->base); 304 + } 305 + 307 306 /** 308 307 * acomp_request_free() -- zeroize and free asynchronous (de)compression 309 308 * request as well as the output buffer if allocated ··· 318 307 */ 319 308 static inline void acomp_request_free(struct acomp_req *req) 320 309 { 321 - if (!req || (req->base.flags & CRYPTO_TFM_REQ_ON_STACK)) 310 + if (!req || acomp_req_on_stack(req)) 322 311 return; 323 312 kfree_sensitive(req); 324 313 } ··· 339 328 crypto_completion_t cmpl, 340 329 void *data) 341 330 { 342 - u32 keep = CRYPTO_ACOMP_REQ_SRC_VIRT | CRYPTO_ACOMP_REQ_SRC_NONDMA | 343 - CRYPTO_ACOMP_REQ_DST_VIRT | CRYPTO_ACOMP_REQ_DST_NONDMA | 344 - CRYPTO_ACOMP_REQ_SRC_FOLIO | CRYPTO_ACOMP_REQ_DST_FOLIO | 345 - CRYPTO_TFM_REQ_ON_STACK; 346 - 347 - req->base.complete = cmpl; 348 - req->base.data = data; 349 - req->base.flags &= keep; 350 - req->base.flags |= flgs & ~keep; 331 + flgs &= ~CRYPTO_ACOMP_REQ_PRIVATE; 332 + flgs |= req->base.flags & CRYPTO_ACOMP_REQ_PRIVATE; 333 + crypto_request_set_callback(&req->base, flgs, cmpl, data); 351 334 } 352 335 353 336 /**
+6
include/crypto/internal/acompress.h
··· 229 229 { 230 230 return walk->slen != cur; 231 231 } 232 + 233 + static inline u32 acomp_request_flags(struct acomp_req *req) 234 + { 235 + return crypto_request_flags(&req->base) & ~CRYPTO_ACOMP_REQ_PRIVATE; 236 + } 237 + 232 238 #endif