linux/samples/rust
Wenzhao Liao da991304c9 rust: module_param: support bool parameters
Add support for parsing boolean module parameters in the Rust
module! macro.

Currently, only integer types are supported by the `module_param!`
macros. This patch implements the `ModuleParam` trait for `bool`
by delegating the string parsing to the existing C implementation
via `kstrtobool_bytes()`. It also wires up `PARAM_OPS_BOOL` so that
the Rust parameter system correctly links to the C `param_ops_bool`
structure.

For demonstration and verification, a boolean parameter is added
to `samples/rust/rust_minimal.rs`.

Support for boolean parameters will initially be used by the Rust
null block driver [1].

Link: https://lore.kernel.org/all/20260609-rnull-v6-19-rc5-send-v2-4-82c7404542e2@kernel.org/ [1]
Assisted-by: Codex:GPT-5
Signed-off-by: Wenzhao Liao <wenzhaoliao@ruc.edu.cn>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/linux-modules/20260411130254.3510128-1-wenzhaoliao@ruc.edu.cn/
[ppavlu: add motivation to the commit message and rebase the patch]
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
2026-08-06 13:29:03 +02:00
..
hostprogs samples: add first Rust examples 2022-09-28 09:03:08 +02:00
Kconfig rust: Add SoC Driver Sample 2025-12-28 12:44:31 +01:00
Makefile rust: Add SoC Driver Sample 2025-12-28 12:44:31 +01:00
rust_configfs.rs rust: configfs: replace kernel::c_str! with C-Strings 2026-01-15 09:26:49 +01:00
rust_debugfs_scoped.rs samples: rust: debugfs: replace kernel::c_str! with C-Strings 2025-12-22 17:30:35 +01:00
rust_debugfs.rs rust: platform: make Driver trait lifetime-parameterized 2026-05-27 16:23:31 +02:00
rust_dma.rs Driver core changes for 7.2-rc1 2026-06-15 12:41:17 +05:30
rust_driver_auxiliary.rs samples: rust: rust_driver_auxiliary: showcase lifetime-bound registration data 2026-05-27 16:29:34 +02:00
rust_driver_faux.rs rust: samples: driver-core: remove redundant .as_ref() for dev_* print 2026-01-24 01:12:49 +01:00
rust_driver_i2c.rs rust: i2c: make Driver trait lifetime-parameterized 2026-05-27 16:24:10 +02:00
rust_driver_pci.rs samples: rust: rust_driver_pci: use HRT lifetime for Bar 2026-05-27 16:24:32 +02:00
rust_driver_platform.rs rust: platform: make Driver trait lifetime-parameterized 2026-05-27 16:23:31 +02:00
rust_driver_usb.rs rust: usb: make Driver trait lifetime-parameterized 2026-05-27 16:23:51 +02:00
rust_i2c_client.rs rust: platform: make Driver trait lifetime-parameterized 2026-05-27 16:23:31 +02:00
rust_minimal.rs rust: module_param: support bool parameters 2026-08-06 13:29:03 +02:00
rust_misc_device.rs samples: rust_misc_device: use vertical import style 2026-05-23 13:47:32 +02:00
rust_print_events.c rust: samples: add tracepoint to Rust sample 2024-11-04 16:21:44 -05:00
rust_print_main.rs samples: rust: remove imports available via prelude 2026-01-26 18:15:20 +01:00
rust_soc.rs rust: platform: make Driver trait lifetime-parameterized 2026-05-27 16:23:31 +02:00