hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/block/blk-crypto-internal.h
....@@ -60,6 +60,11 @@
6060 return rq->crypt_ctx;
6161 }
6262
63
+static inline bool blk_crypto_rq_has_keyslot(struct request *rq)
64
+{
65
+ return rq->crypt_keyslot;
66
+}
67
+
6368 #else /* CONFIG_BLK_INLINE_ENCRYPTION */
6469
6570 static inline bool bio_crypt_rq_ctx_compatible(struct request *rq,
....@@ -89,6 +94,11 @@
8994 static inline void blk_crypto_rq_set_defaults(struct request *rq) { }
9095
9196 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)
92102 {
93103 return false;
94104 }
....@@ -127,12 +137,19 @@
127137 return true;
128138 }
129139
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)
132142 {
133143 if (blk_crypto_rq_is_encrypted(rq))
134
- return __blk_crypto_init_request(rq);
144
+ return __blk_crypto_rq_get_keyslot(rq);
135145 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);
136153 }
137154
138155 void __blk_crypto_free_request(struct request *rq);
....@@ -173,7 +190,7 @@
173190 {
174191
175192 if (blk_crypto_rq_is_encrypted(rq))
176
- return blk_crypto_init_request(rq);
193
+ return blk_crypto_rq_get_keyslot(rq);
177194 return BLK_STS_OK;
178195 }
179196