Re: [PATCH] rust: block: mq: align init_request numa_node arg with C signature
From: Gary Guo
Date: Wed May 27 2026 - 07:00:42 EST
On Wed May 27, 2026 at 10:18 AM BST, Andreas Hindborg wrote:
> Commit b040a1a4523d ("block: switch numa_node to int in
> blk_mq_hw_ctx and init_request") changed the type of the
> `numa_node` argument of `blk_mq_ops::init_request` from
> `unsigned int` to `int`. Update the Rust callback signature to
> match, so that the function item can be coerced to the C fn
> pointer type stored in `blk_mq_ops`.
>
> Without this change the Rust block layer fails to build:
>
> error[E0308]: mismatched types
> --> rust/kernel/block/mq/operations.rs:274:28
> |
> 274 | init_request: Some(Self::init_request_callback),
> | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> | expected fn pointer, found fn item
> |
> = note: expected fn pointer
> `unsafe extern "C" fn(_, _, _, i32) -> _`
> found fn item
> `unsafe extern "C" fn(_, _, _, u32) -> _ {...}`
>
> The argument is unused on the Rust side, so this is a pure
> type-signature change with no functional impact.
>
> Fixes: b040a1a4523d ("block: switch numa_node to int in blk_mq_hw_ctx and init_request")
> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
You could also just use `i32` instead of `ffi::c_int`. But it doesn't really
matter for this patch.
Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> ---
> rust/kernel/block/mq/operations.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)