blk-crypto-internal.h (ead5d1f4d877e92c051e1a1ade623d0d30e71619) blk-crypto-internal.h (93f221ae08381e994ac9f9ff6aa743e612e49718)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2019 Google LLC
4 */
5
6#ifndef __LINUX_BLK_CRYPTO_INTERNAL_H
7#define __LINUX_BLK_CRYPTO_INTERNAL_H
8

--- 128 unchanged lines hidden (view full) ---

137
138void __blk_crypto_free_request(struct request *rq);
139static inline void blk_crypto_free_request(struct request *rq)
140{
141 if (blk_crypto_rq_is_encrypted(rq))
142 __blk_crypto_free_request(rq);
143}
144
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2019 Google LLC
4 */
5
6#ifndef __LINUX_BLK_CRYPTO_INTERNAL_H
7#define __LINUX_BLK_CRYPTO_INTERNAL_H
8

--- 128 unchanged lines hidden (view full) ---

137
138void __blk_crypto_free_request(struct request *rq);
139static inline void blk_crypto_free_request(struct request *rq)
140{
141 if (blk_crypto_rq_is_encrypted(rq))
142 __blk_crypto_free_request(rq);
143}
144
145void __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
146 gfp_t gfp_mask);
147static inline void blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
148 gfp_t gfp_mask)
145int __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
146 gfp_t gfp_mask);
147/**
148 * blk_crypto_rq_bio_prep - Prepare a request's crypt_ctx when its first bio
149 * is inserted
150 * @rq: The request to prepare
151 * @bio: The first bio being inserted into the request
152 * @gfp_mask: Memory allocation flags
153 *
154 * Return: 0 on success, -ENOMEM if out of memory. -ENOMEM is only possible if
155 * @gfp_mask doesn't include %__GFP_DIRECT_RECLAIM.
156 */
157static inline int blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
158 gfp_t gfp_mask)
149{
150 if (bio_has_crypt_ctx(bio))
159{
160 if (bio_has_crypt_ctx(bio))
151 __blk_crypto_rq_bio_prep(rq, bio, gfp_mask);
161 return __blk_crypto_rq_bio_prep(rq, bio, gfp_mask);
162 return 0;
152}
153
154/**
155 * blk_crypto_insert_cloned_request - Prepare a cloned request to be inserted
156 * into a request queue.
157 * @rq: the request being queued
158 *
159 * Return: BLK_STS_OK on success, nonzero on error.

--- 42 unchanged lines hidden ---
163}
164
165/**
166 * blk_crypto_insert_cloned_request - Prepare a cloned request to be inserted
167 * into a request queue.
168 * @rq: the request being queued
169 *
170 * Return: BLK_STS_OK on success, nonzero on error.

--- 42 unchanged lines hidden ---