.. | .. |
---|
60 | 60 | return rq->crypt_ctx; |
---|
61 | 61 | } |
---|
62 | 62 | |
---|
| 63 | +static inline bool blk_crypto_rq_has_keyslot(struct request *rq) |
---|
| 64 | +{ |
---|
| 65 | + return rq->crypt_keyslot; |
---|
| 66 | +} |
---|
| 67 | + |
---|
63 | 68 | #else /* CONFIG_BLK_INLINE_ENCRYPTION */ |
---|
64 | 69 | |
---|
65 | 70 | static inline bool bio_crypt_rq_ctx_compatible(struct request *rq, |
---|
.. | .. |
---|
89 | 94 | static inline void blk_crypto_rq_set_defaults(struct request *rq) { } |
---|
90 | 95 | |
---|
91 | 96 | static inline bool blk_crypto_rq_is_encrypted(struct request *rq) |
---|
| 97 | +{ |
---|
| 98 | + return false; |
---|
| 99 | +} |
---|
| 100 | + |
---|
| 101 | +static inline bool blk_crypto_rq_has_keyslot(struct request *rq) |
---|
92 | 102 | { |
---|
93 | 103 | return false; |
---|
94 | 104 | } |
---|
.. | .. |
---|
127 | 137 | return true; |
---|
128 | 138 | } |
---|
129 | 139 | |
---|
130 | | -blk_status_t __blk_crypto_init_request(struct request *rq); |
---|
131 | | -static inline blk_status_t blk_crypto_init_request(struct request *rq) |
---|
| 140 | +blk_status_t __blk_crypto_rq_get_keyslot(struct request *rq); |
---|
| 141 | +static inline blk_status_t blk_crypto_rq_get_keyslot(struct request *rq) |
---|
132 | 142 | { |
---|
133 | 143 | if (blk_crypto_rq_is_encrypted(rq)) |
---|
134 | | - return __blk_crypto_init_request(rq); |
---|
| 144 | + return __blk_crypto_rq_get_keyslot(rq); |
---|
135 | 145 | return BLK_STS_OK; |
---|
| 146 | +} |
---|
| 147 | + |
---|
| 148 | +void __blk_crypto_rq_put_keyslot(struct request *rq); |
---|
| 149 | +static inline void blk_crypto_rq_put_keyslot(struct request *rq) |
---|
| 150 | +{ |
---|
| 151 | + if (blk_crypto_rq_has_keyslot(rq)) |
---|
| 152 | + __blk_crypto_rq_put_keyslot(rq); |
---|
136 | 153 | } |
---|
137 | 154 | |
---|
138 | 155 | void __blk_crypto_free_request(struct request *rq); |
---|
.. | .. |
---|
173 | 190 | { |
---|
174 | 191 | |
---|
175 | 192 | if (blk_crypto_rq_is_encrypted(rq)) |
---|
176 | | - return blk_crypto_init_request(rq); |
---|
| 193 | + return blk_crypto_rq_get_keyslot(rq); |
---|
177 | 194 | return BLK_STS_OK; |
---|
178 | 195 | } |
---|
179 | 196 | |
---|