Hi Luis, Petr, Sami, Dani, I just noticed that I failed in email and forgot to add you to the recipient list of this series. Do you want a resend, or is this sufficient? Best regards, Andreas Hindborg "Andreas Hindborg" <a.hindborg@xxxxxxxxxx> writes: > This series extends the `module!` macro with support module parameters. It > also adds some string to integer parsing functions and updates `BStr` with > a method to strip a string prefix. > > This series stated out as code by Adam Bratschi-Kaye lifted from the original > `rust` branch [1]. > > Link: https://github.com/Rust-for-Linux/linux/tree/bc22545f38d74473cfef3e9fd65432733435b79f [1] > Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx> > --- > Changes since v2 [1]: > - use `SyncUnsafeCell` rather than `static mut` and simplify parameter access > - remove `Display` bound from `ModuleParam` > - automatically generate documentation for `PARAM_OPS_.*` > - remove `as *const _ as *mut_` phrasing > - inline parameter name in struct instantiation in `emit_params` > - move `RacyKernelParam` out of macro template > - use C string literals rather than byte string literals with explicit null > - template out `__{name}_{param_name}` in `emit_param` > - indent template in `emit_params` > - use let-else expression in `emit_params` to get rid of an indentation level > - document `expect_string_field` > - move invication of `impl_int_module_param` to be closer to macro def > - move attributes after docs in `make_param_ops` > - rename `impl_module_param` to impl_int_module_param` > - use `ty` instead of `ident` in `impl_parse_int` > - use `BStr` instead of `&str` for string manipulation > - move string parsing functions to seperate patch and add examples, fix bugs > - degrade comment about future support from doc comment to regular comment > - remove std lib path from `Sized` marker > - update documentation for `trait ModuleParam` > > Changes since v1 [2]: > - Remove support for params without values (`NOARG_ALLOWED`). > - Improve documentation for `try_from_param_arg`. > - Use prelude import. > - Refactor `try_from_param_arg` to return `Result`. > - Refactor `ParseInt::from_str` to return `Result`. > - Move C callable functions out of `ModuleParam` trait. > - Rename literal string field parser to `expect_string_field`. > - Move parameter parsing from generation to parsing stage. > - Use absolute type paths in macro code. > - Inline `kparam`and `read_func` values. > - Resolve TODO regarding alignment attributes. > - Remove unnecessary unsafe blocks in macro code. > - Improve error message for unrecognized parameter types. > - Do not use `self` receiver when reading parameter value. > - Add parameter documentation to `module!` macro. > - Use empty `enum` for parameter type. > - Use `addr_of_mut` to get address of parameter value variable. > - Enabled building of docs for for `module_param` module. > > Link: https://lore.kernel.org/rust-for-linux/20240705111455.142790-1-nmi@xxxxxxxxxxxx/ [2] > Link: https://lore.kernel.org/all/20240819133345.3438739-1-nmi@xxxxxxxxxxxx/ [1] > > --- > > --- > Andreas Hindborg (4): > rust: str: implement `PartialEq` for `BStr` > rust: str: implement `strip_prefix` for `BStr` > rust: str: add radix prefixed integer parsing functions > rust: add parameter support to the `module!` macro > > rust/kernel/lib.rs | 2 + > rust/kernel/module_param.rs | 238 +++++++++++++++++++++++++++++++++++++++++++ > rust/kernel/str.rs | 138 +++++++++++++++++++++++++ > rust/macros/helpers.rs | 10 ++ > rust/macros/lib.rs | 31 ++++++ > rust/macros/module.rs | 188 ++++++++++++++++++++++++++++++---- > samples/rust/rust_minimal.rs | 10 ++ > scripts/Makefile.build | 2 +- > 8 files changed, 600 insertions(+), 19 deletions(-) > --- > base-commit: fac04efc5c793dccbd07e2d59af9f90b7fc0dca4 > change-id: 20241211-module-params-v3-ae7e5c8d8b5a > > Best regards,