aboutsummaryrefslogtreecommitdiff
path: root/rust/helpers.c
diff options
context:
space:
mode:
authorAndreas Hindborg <[email protected]>2024-06-11 13:45:49 +0200
committerJens Axboe <[email protected]>2024-06-14 07:45:04 -0600
commit3253aba3408aa4eb2e4e09365eede3e63ef7536b (patch)
tree180dd0614aa29c2a789717ded08f209b66368640 /rust/helpers.c
parentc2670cf789500304097cd115483cc70e1feb9472 (diff)
rust: block: introduce `kernel::block::mq` module
Add initial abstractions for working with blk-mq. This patch is a maintained, refactored subset of code originally published by Wedson Almeida Filho <[email protected]> [1]. [1] https://github.com/wedsonaf/linux/tree/f2cfd2fe0e2ca4e90994f96afe268bbd4382a891/rust/kernel/blk/mq.rs Cc: Wedson Almeida Filho <[email protected]> Signed-off-by: Andreas Hindborg <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'rust/helpers.c')
-rw-r--r--rust/helpers.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/rust/helpers.c b/rust/helpers.c
index 2c37a0f5d7a8..3df5217fb2ff 100644
--- a/rust/helpers.c
+++ b/rust/helpers.c
@@ -186,3 +186,19 @@ static_assert(
__alignof__(size_t) == __alignof__(uintptr_t),
"Rust code expects C `size_t` to match Rust `usize`"
);
+
+// This will soon be moved to a separate file, so no need to merge with above.
+#include <linux/blk-mq.h>
+#include <linux/blkdev.h>
+
+void *rust_helper_blk_mq_rq_to_pdu(struct request *rq)
+{
+ return blk_mq_rq_to_pdu(rq);
+}
+EXPORT_SYMBOL_GPL(rust_helper_blk_mq_rq_to_pdu);
+
+struct request *rust_helper_blk_mq_rq_from_pdu(void *pdu)
+{
+ return blk_mq_rq_from_pdu(pdu);
+}
+EXPORT_SYMBOL_GPL(rust_helper_blk_mq_rq_from_pdu);