aboutsummaryrefslogtreecommitdiffstats
path: root/rust/macros/module.rs
diff options
context:
space:
mode:
authorGuilherme Giacomo Simoes <[email protected]>2025-03-09 17:57:11 +0000
committerMiguel Ojeda <[email protected]>2025-03-10 14:12:17 +0000
commit38559da6afb239e271e709588babe7f98195096b (patch)
tree70d2d504487f453a5ca03b27859a6efc14f4d391 /rust/macros/module.rs
parentpanic_qr: use new #[export] macro (diff)
downloadkernel-38559da6afb239e271e709588babe7f98195096b.tar.gz
kernel-38559da6afb239e271e709588babe7f98195096b.zip
rust: module: introduce `authors` key
In the `module!` macro, the `author` field is currently of type `String`. Since modules can have multiple authors, this limitation prevents specifying more than one. Add an `authors` field as `Option<Vec<String>>` to allow creating modules with multiple authors, and change the documentation and all current users to use it. Eventually, the single `author` field may be removed. [ The `modinfo` key needs to still be `author`; otherwise, tooling may not work properly, e.g.: $ modinfo --author samples/rust/rust_print.ko Rust for Linux Contributors I have also kept the original `author` field (undocumented), so that we can drop it more easily in a kernel cycle or two. - Miguel ] Suggested-by: Miguel Ojeda <[email protected]> Link: https://github.com/Rust-for-Linux/linux/issues/244 Reviewed-by: Charalampos Mitrodimas <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Reviewed-by: Andreas Hindborg <[email protected]> Signed-off-by: Guilherme Giacomo Simoes <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Fixed `modinfo` key. Kept `author` field. Reworded message accordingly. Updated my email. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/macros/module.rs')
-rw-r--r--rust/macros/module.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index cdf94f4982df..42ed16c48b37 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -95,6 +95,7 @@ struct ModuleInfo {
license: String,
name: String,
author: Option<String>,
+ authors: Option<Vec<String>>,
description: Option<String>,
alias: Option<Vec<String>>,
firmware: Option<Vec<String>>,
@@ -108,6 +109,7 @@ impl ModuleInfo {
"type",
"name",
"author",
+ "authors",
"description",
"license",
"alias",
@@ -136,6 +138,7 @@ impl ModuleInfo {
"type" => info.type_ = expect_ident(it),
"name" => info.name = expect_string_ascii(it),
"author" => info.author = Some(expect_string(it)),
+ "authors" => info.authors = Some(expect_string_array(it)),
"description" => info.description = Some(expect_string(it)),
"license" => info.license = expect_string_ascii(it),
"alias" => info.alias = Some(expect_string_array(it)),
@@ -186,6 +189,11 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
if let Some(author) = info.author {
modinfo.emit("author", &author);
}
+ if let Some(authors) = info.authors {
+ for author in authors {
+ modinfo.emit("author", &author);
+ }
+ }
if let Some(description) = info.description {
modinfo.emit("description", &description);
}