diff options
author | Andreas Hindborg <a.hindborg@samsung.com> | 2024-06-11 13:45:49 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-06-14 15:45:04 +0200 |
commit | 3253aba3408aa4eb2e4e09365eede3e63ef7536b (patch) | |
tree | 180dd0614aa29c2a789717ded08f209b66368640 /rust/helpers.c | |
parent | Merge tag 'md-6.11-20240612' of git://git.kernel.org/pub/scm/linux/kernel/git... (diff) | |
download | linux-3253aba3408aa4eb2e4e09365eede3e63ef7536b.tar.xz linux-3253aba3408aa4eb2e4e09365eede3e63ef7536b.zip |
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 <wedsonaf@gmail.com> [1].
[1] https://github.com/wedsonaf/linux/tree/f2cfd2fe0e2ca4e90994f96afe268bbd4382a891/rust/kernel/blk/mq.rs
Cc: Wedson Almeida Filho <wedsonaf@gmail.com>
Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20240611114551.228679-2-nmi@metaspace.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'rust/helpers.c')
-rw-r--r-- | rust/helpers.c | 16 |
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); |