From nobody Tue Dec 16 15:25:10 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B695E275117; Tue, 6 May 2025 13:02:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746536568; cv=none; b=t2KwKV3ZCIGIIv+gBqI9e/oaVM5Y94RUpZipRSBh8TCTqHwOCix1z2Uv1D3+zdNO4b+h/iWrUIuEIqWjEj64AVPOdl5gmB+Vkt8dGossAtTW8fkttvxGBvQuU8vkVKREbaVTroAiFp6BG+/cAwCFjcIJqd1NK2NI41JC5cEUrKw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746536568; c=relaxed/simple; bh=7qMbYF0hu2Beyc3tPuUoKN5TnxPYQAC7lF5OsXQC2Go=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b+h7kj2AwTtDYvINru8ZcvtdI3uPcuEiuzIeEqBJRTof6RuJLbZL86Sz6ZAkYTM9qG7ZKqLy7YNKhOUW4KZxn/LJtRhSS03/go3+pfxu1cMQ7Urce4seJvA8UuHodUDrBG73aEUHoNs8TNsqaKacyEAo+PrYXtqZDrK1C80vfhA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DHzr4pfm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DHzr4pfm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69B0DC4CEE4; Tue, 6 May 2025 13:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746536568; bh=7qMbYF0hu2Beyc3tPuUoKN5TnxPYQAC7lF5OsXQC2Go=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DHzr4pfmUuOmKymf3jJf/Nbd7K+QhE5HIktfqsAULQF7zSZ0j02UrgXxvdawkTE0M l1ZCCFmTffO/O49QxgeQqpGJOUjND2305TVvsUiFxbqinYfFITjNHOjaZvwFfd2vIV ZDgBy5WHeNY8kDcHPNfduxRpVNMSk9XJ72fR883LGQ1qqIDdUmLueJznTUw2e3lnuK aG+H1ldJ8nV4QMdlz/hojISLx9wXhFZXrdFj3dWEFhKyzUCy98QlNlLWuajb5js3vu 5dOXwrEHBc/ttuuDKD/Z90j5Df5aw+7x/mczAl82GCNOqsea3/6OOXVgmkuH4J3qxC lbQ5whD/LR8FQ== From: Andreas Hindborg Date: Tue, 06 May 2025 15:02:28 +0200 Subject: [PATCH v12 1/3] rust: str: add radix prefixed integer parsing functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250506-module-params-v3-v12-1-c04d80c8a2b1@kernel.org> References: <20250506-module-params-v3-v12-0-c04d80c8a2b1@kernel.org> In-Reply-To: <20250506-module-params-v3-v12-0-c04d80c8a2b1@kernel.org> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Masahiro Yamada , Nathan Chancellor , Luis Chamberlain , Danilo Krummrich , Nicolas Schier Cc: Trevor Gross , Adam Bratschi-Kaye , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Petr Pavlu , Sami Tolvanen , Daniel Gomez , Simona Vetter , Greg KH , Fiona Behrens , Daniel Almeida , linux-modules@vger.kernel.org, Andreas Hindborg X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=7913; i=a.hindborg@kernel.org; h=from:subject:message-id; bh=7qMbYF0hu2Beyc3tPuUoKN5TnxPYQAC7lF5OsXQC2Go=; b=owEBbQKS/ZANAwAIAeG4Gj55KGN3AcsmYgBoGghneyr/AZMOCNZq7gbv+RWUWT/iwA0G0Rawf jU5uFEJqTCJAjMEAAEIAB0WIQQSwflHVr98KhXWwBLhuBo+eShjdwUCaBoIZwAKCRDhuBo+eShj d+YrD/4rTN3mpjdJgpRjIWlyl5WE3VvbGi2LqbuMp3r5CmSEwtEbA/ZdqrdmydbBPy6Lf0Rfpyd GDJDfMbVgcTXWL2hXxDq2tO7JKmRa1U0pkmdlf+DeAZNWWplUe/gKj5ADIIxC+EOvybmWmKQgMg Uek1PBXVN/atLVmPKhQZDD+t66XsbNqMwsGrhT2wcQFL0IvysJOMciGG7B82tGgcXkchFKf62rj 9/lOV7SiFNa7RuYN0pmdaMYATB0EVUcOHKI/tmkovrdlrHPg3J4w/RerjUcLhXiQAlwRyaqVpiJ hACG4e/+uq3TOmD73+ycAePvMqOI6fxxJ6Dqoic9u918RNFhsCcCXLma+HcFpiMYsbex7P7MzXw x0Ilqp1G9t4JH9tbwe4KTZ9wWOOdXsXcx78nr685tpcguuS3YaeHcWXIC9FrJlPuyc5ftOK13iS AuHKGRuOUCikwTSY/rsnD1C4t7pvBNUyD1R87TqStpRGeYHJG8yBaeXGw9VsAsABPw3voU1QTWx MAI7eoYIm5GKAbCRueRjmJ6t+FDCkAl5fMLM4SFWbIycT9ulWg0eTIfxa9kRCqWo7D/Wg9f2pKc bacR26IapAOdB+s2HDnJnGcOZzcTc7sW4NQc+J1bVPUWhrhkU877Zwx5YP5Tdbf3Cr8RELMa7gG hPVGuug8tvnJ4NA== X-Developer-Key: i=a.hindborg@kernel.org; a=openpgp; fpr=3108C10F46872E248D1FB221376EB100563EF7A7 Add the trait `ParseInt` for parsing string representations of integers where the string representations are optionally prefixed by a radix specifier. Implement the trait for the primitive integer types. Tested-by: Daniel Gomez Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andreas Hindborg --- rust/kernel/str.rs | 172 +++++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 171 insertions(+), 1 deletion(-) diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 878111cb77bc..174e70397305 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -573,7 +573,6 @@ macro_rules! c_str { } =20 #[cfg(test)] -#[expect(clippy::items_after_test_module)] mod tests { use super::*; =20 @@ -946,3 +945,174 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Res= ult { macro_rules! fmt { ($($f:tt)*) =3D> ( core::format_args!($($f)*) ) } + +/// Integer parsing functions for parsing signed and unsigned integers +/// potentially prefixed with `0x`, `0o`, or `0b`. +pub mod parse_int { + use crate::prelude::*; + use crate::str::BStr; + use core::ops::Deref; + + // Make `FromStrRadix` a public type with a private name. This seals + // `ParseInt`, that is, prevents downstream users from implementing the + // trait. + mod private { + use crate::str::BStr; + + /// Trait that allows parsing a [`&BStr`] to an integer with a rad= ix. + /// + /// # Safety + /// + /// The member functions of this trait must be implemented accordi= ng to + /// their documentation. + /// + /// [`&BStr`]: kernel::str::BStr + // This is required because the `from_str_radix` function on the p= rimitive + // integer types is not part of any trait. + pub unsafe trait FromStrRadix: Sized { + /// The minimum value this integer type can assume. + const MIN: Self; + + /// Parse `src` to [`Self`] using radix `radix`. + fn from_str_radix(src: &BStr, radix: u32) -> Result; + + /// Return the absolute value of [`Self::MIN`]. + fn abs_min() -> u64; + + /// Perform bitwise 2's complement on `self`. + /// + /// Note: This function does not make sense for unsigned integ= ers. + fn complement(self) -> Self; + } + } + + /// Extract the radix from an integer literal optionally prefixed with + /// one of `0x`, `0X`, `0o`, `0O`, `0b`, `0B`, `0`. + fn strip_radix(src: &BStr) -> (u32, &BStr) { + match src.deref() { + [b'0', b'x' | b'X', rest @ ..] =3D> (16, rest.as_ref()), + [b'0', b'o' | b'O', rest @ ..] =3D> (8, rest.as_ref()), + [b'0', b'b' | b'B', rest @ ..] =3D> (2, rest.as_ref()), + // NOTE: We are including the leading zero to be able to parse + // literal `0` here. If we removed it as a radix prefix, we wo= uld + // not be able to parse `0`. + [b'0', ..] =3D> (8, src), + _ =3D> (10, src), + } + } + + /// Trait for parsing string representations of integers. + /// + /// Strings beginning with `0x`, `0o`, or `0b` are parsed as hex, octa= l, or + /// binary respectively. Strings beginning with `0` otherwise are pars= ed as + /// octal. Anything else is parsed as decimal. A leading `+` or `-` is= also + /// permitted. Any string parsed by [`kstrtol()`] or [`kstrtoul()`] wi= ll be + /// successfully parsed. + /// + /// [`kstrtol()`]: https://docs.kernel.org/core-api/kernel-api.html#c.= kstrtol + /// [`kstrtoul()`]: https://docs.kernel.org/core-api/kernel-api.html#c= .kstrtoul + /// + /// # Examples + /// + /// ``` + /// # use kernel::str::parse_int::ParseInt; + /// # use kernel::b_str; + /// + /// assert_eq!(Ok(0u8), u8::from_str(b_str!("0"))); + /// + /// assert_eq!(Ok(0xa2u8), u8::from_str(b_str!("0xa2"))); + /// assert_eq!(Ok(-0xa2i32), i32::from_str(b_str!("-0xa2"))); + /// + /// assert_eq!(Ok(-0o57i8), i8::from_str(b_str!("-0o57"))); + /// assert_eq!(Ok(0o57i8), i8::from_str(b_str!("057"))); + /// + /// assert_eq!(Ok(0b1001i16), i16::from_str(b_str!("0b1001"))); + /// assert_eq!(Ok(-0b1001i16), i16::from_str(b_str!("-0b1001"))); + /// + /// assert_eq!(Ok(127i8), i8::from_str(b_str!("127"))); + /// assert!(i8::from_str(b_str!("128")).is_err()); + /// assert_eq!(Ok(-128i8), i8::from_str(b_str!("-128"))); + /// assert!(i8::from_str(b_str!("-129")).is_err()); + /// assert_eq!(Ok(255u8), u8::from_str(b_str!("255"))); + /// assert!(u8::from_str(b_str!("256")).is_err()); + /// ``` + pub trait ParseInt: private::FromStrRadix + TryFrom { + /// Parse a string according to the description in [`Self`]. + fn from_str(src: &BStr) -> Result { + match src.deref() { + [b'-', rest @ ..] =3D> { + let (radix, digits) =3D strip_radix(rest.as_ref()); + // 2's complement values range from -2^(b-1) to 2^(b-1= )-1. + // So if we want to parse negative numbers as positive= and + // later multiply by -1, we have to parse into a larger + // integer. We choose `u64` as sufficiently large. + // + // NOTE: 128 bit integers are not available on all + // platforms, hence the choice of 64 bits. + let val =3D u64::from_str_radix( + core::str::from_utf8(digits).map_err(|_| EINVAL)?, + radix, + ) + .map_err(|_| EINVAL)?; + + if val > Self::abs_min() { + return Err(EINVAL); + } + + if val =3D=3D Self::abs_min() { + return Ok(Self::MIN); + } + + // SAFETY: We checked that `val` will fit in `Self` ab= ove. + let val: Self =3D unsafe { val.try_into().unwrap_unche= cked() }; + + Ok(val.complement()) + } + _ =3D> { + let (radix, digits) =3D strip_radix(src); + Self::from_str_radix(digits, radix).map_err(|_| EINVAL) + } + } + } + } + + macro_rules! impl_parse_int { + ($ty:ty) =3D> { + // SAFETY: We implement the trait according to the documentati= on. + unsafe impl private::FromStrRadix for $ty { + const MIN: Self =3D <$ty>::MIN; + + fn from_str_radix(src: &BStr, radix: u32) -> Result { + <$ty>::from_str_radix(core::str::from_utf8(src).map_er= r(|_| EINVAL)?, radix) + .map_err(|_| EINVAL) + } + + fn abs_min() -> u64 { + #[allow(unused_comparisons)] + if Self::MIN < 0 { + 1u64 << (Self::BITS - 1) + } else { + 0 + } + } + + fn complement(self) -> Self { + (!self).wrapping_add((1 as $ty)) + } + } + + impl ParseInt for $ty {} + }; + } + + impl_parse_int!(i8); + impl_parse_int!(u8); + impl_parse_int!(i16); + impl_parse_int!(u16); + impl_parse_int!(i32); + impl_parse_int!(u32); + impl_parse_int!(i64); + impl_parse_int!(u64); + impl_parse_int!(isize); + impl_parse_int!(usize); +} --=20 2.47.2 From nobody Tue Dec 16 15:25:10 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00099230BF1; Tue, 6 May 2025 13:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746536581; cv=none; b=FVgZsP7Lx/q3JDmk+xwhQi+UJgfh7sHj/vBoRn5Fw9O7bFhgcWkC78Szk+vCjVVUe4WWyuu+0P1Tbl/oD+ZzlvtgxY+3w0BG18uZyNbKanPfbIx8MeAjAbllhtyom9+hHTobXbK4L/vNKCdmkJaVR+ZxmjX21+cUtqeT7Re/lvo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746536581; c=relaxed/simple; bh=IkdujT01QEdrUG86MNxGVmgTuN9oGuzUVjT3nW3H8Hg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iftJygkBDAG+nhdKZvDgpThEfGI9j+HCJwecgTARCgHMLorWvyGer1XnkWFw67sjeoK55omO10AWQ5VW6Kfuc7xj0bJDn7vHusyCyxwB09MzzUhq5gIx9HXU9wgjMJCIc+PdV3i+fZ7V5/LC+Lid1jKE7bmlWLPF8kVo5ks3SLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XAKFg5Bv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XAKFg5Bv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E45C7C4CEE4; Tue, 6 May 2025 13:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746536580; bh=IkdujT01QEdrUG86MNxGVmgTuN9oGuzUVjT3nW3H8Hg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XAKFg5BvHmw9yQxl++jQgmU7ApdQM429wongDfLEd7mpICy5poJ5ryH3TGbgzqjI4 hkTyWQZ9+D4zAr4kjwoECVFt1NxdwaEZNYsnW/wuZgkMtz2gX7/YmujI50UjiN/SSk xU9g/agbxU0fMj145CA7buaq3A9kYbnuk60DPQLXcTbARIvRB/fLBV5ps1OFLSlpFN +brikCspFQ+eSLkXbp1lK6VPO9dV03mn03HsRGsaktNp8OsvmiFCbOyIeDItCbQV/r i8FfsPm6I8YPN/bliJucMXc4uw8eayG1Hynun4xyC4LnLTyUEZH4g05dI2NQdC8zLs /VKVtL9OpPCCw== From: Andreas Hindborg Date: Tue, 06 May 2025 15:02:29 +0200 Subject: [PATCH v12 2/3] rust: add parameter support to the `module!` macro Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250506-module-params-v3-v12-2-c04d80c8a2b1@kernel.org> References: <20250506-module-params-v3-v12-0-c04d80c8a2b1@kernel.org> In-Reply-To: <20250506-module-params-v3-v12-0-c04d80c8a2b1@kernel.org> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Masahiro Yamada , Nathan Chancellor , Luis Chamberlain , Danilo Krummrich , Nicolas Schier Cc: Trevor Gross , Adam Bratschi-Kaye , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Petr Pavlu , Sami Tolvanen , Daniel Gomez , Simona Vetter , Greg KH , Fiona Behrens , Daniel Almeida , linux-modules@vger.kernel.org, Andreas Hindborg X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=23973; i=a.hindborg@kernel.org; h=from:subject:message-id; bh=IkdujT01QEdrUG86MNxGVmgTuN9oGuzUVjT3nW3H8Hg=; b=owEBbQKS/ZANAwAIAeG4Gj55KGN3AcsmYgBoGgho82pyyUY69gqPtUgjNnng6DhoatRB4uMY2 I9FP+/+QeqJAjMEAAEIAB0WIQQSwflHVr98KhXWwBLhuBo+eShjdwUCaBoIaAAKCRDhuBo+eShj d6HTEACMj+zk7P1HQqloBf+HSBhm9JJSKK1lqoprNfGW6yZyERJR6sW74yUY7lwesFN/dWzADSm E8vXdXMtZTZzvKsJWyo+mbEyvZq5muXuh82LY1nQfFNvnRFs71CT/JXSJ/mEWr4WhVZ7ngBNNXM pvFdLxrRzNct6yqHVDzM1jM6OKFOGsYge3C+LtkwsS1n04Pp8Hq1C8uZjM14IqRZEnPhVt4bns3 Y5tlRTe6XhzjC361A5HHts1gAsZhD61n69yYvYUmkeuxX6QQ/NgCNTOGFtlwrqv2deo5kDXqZzl 3ty8gJuwRnQzXGxiq1Y5ljrH0qHHEcXL+d8oye9sX0dBAHNlz1Geo9KP9NZKvYAd6OtIVSBMZ48 Sbmu3+vi2TkoluU3PFaOVumZUte/sjs/6i7EuwjDWvFaopAWeVvmzY+1ZdSQr9SvSgXE1c97twD AMaBR9ImWIGAFV+btjApHpOI8ZrpTfCCfucu5EyFGueikb0SiFFvxGMnQ8RLntZkXk8dDYpnNXl xBnL6PHVh4NJ5SofL4vFWbtxJXQsbU6YzygCha6WfYC8kAT8ziGvU1wJp6sjO/Xzfq1VcISHPbC 9otF4sGybfcEIod1Hw1buiMzT9PXZ6uGS6PEIT5xdSzGFqc2p3sdKTHcedmnnXRDBK+TvFPyerr qTUWjmrpNf+N5Ug== X-Developer-Key: i=a.hindborg@kernel.org; a=openpgp; fpr=3108C10F46872E248D1FB221376EB100563EF7A7 Add support for module parameters to the `module!` macro. Implement read only support for integer types without `sysfs` support. Acked-by: Petr Pavlu # from modules perspective Tested-by: Daniel Gomez Reviewed-by: Greg Kroah-Hartman Signed-off-by: Andreas Hindborg --- rust/kernel/lib.rs | 1 + rust/kernel/module_param.rs | 204 +++++++++++++++++++++++++++++++++++++++= ++++ rust/macros/helpers.rs | 25 ++++++ rust/macros/lib.rs | 31 +++++++ rust/macros/module.rs | 195 ++++++++++++++++++++++++++++++++++++---= -- samples/rust/rust_minimal.rs | 10 +++ 6 files changed, 446 insertions(+), 20 deletions(-) diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index de07aadd1ff5..9afb7eae9183 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -61,6 +61,7 @@ pub mod kunit; pub mod list; pub mod miscdevice; +pub mod module_param; #[cfg(CONFIG_NET)] pub mod net; pub mod of; diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs new file mode 100644 index 000000000000..ba80c9c87317 --- /dev/null +++ b/rust/kernel/module_param.rs @@ -0,0 +1,204 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Support for module parameters. +//! +//! C header: [`include/linux/moduleparam.h`](srctree/include/linux/module= param.h) + +use crate::prelude::*; +use crate::str::BStr; + +/// Newtype to make `bindings::kernel_param` [`Sync`]. +#[repr(transparent)] +#[doc(hidden)] +pub struct RacyKernelParam(pub ::kernel::bindings::kernel_param); + +// SAFETY: C kernel handles serializing access to this type. We never acce= ss it +// from Rust module. +unsafe impl Sync for RacyKernelParam {} + +/// Types that can be used for module parameters. +pub trait ModuleParam: Sized + Copy { + /// The [`ModuleParam`] will be used by the kernel module through this= type. + /// + /// This may differ from `Self` if, for example, `Self` needs to track + /// ownership without exposing it or allocate extra space for other po= ssible + /// parameter values. + // This is required to support string parameters in the future. + type Value: ?Sized; + + /// Parse a parameter argument into the parameter value. + /// + /// `Err(_)` should be returned when parsing of the argument fails. + /// + /// Parameters passed at boot time will be set before [`kmalloc`] is + /// available (even if the module is loaded at a later time). However,= in + /// this case, the argument buffer will be valid for the entire lifeti= me of + /// the kernel. So implementations of this method which need to alloca= te + /// should first check that the allocator is available (with + /// [`crate::bindings::slab_is_available`]) and when it is not availab= le + /// provide an alternative implementation which doesn't allocate. In c= ases + /// where the allocator is not available it is safe to save references= to + /// `arg` in `Self`, but in other cases a copy should be made. + /// + /// [`kmalloc`]: srctree/include/linux/slab.h + fn try_from_param_arg(arg: &'static BStr) -> Result; +} + +/// Set the module parameter from a string. +/// +/// Used to set the parameter value at kernel initialization, when loading +/// the module or when set through `sysfs`. +/// +/// See `struct kernel_param_ops.set`. +/// +/// # Safety +/// +/// - If `val` is non-null then it must point to a valid null-terminated s= tring. +/// The `arg` field of `param` must be an instance of `T`. +/// - `param.arg` must be a pointer to valid `*mut T` as set up by the +/// [`module!`] macro. +/// +/// # Invariants +/// +/// Currently, we only support read-only parameters that are not readable +/// from `sysfs`. Thus, this function is only called at kernel +/// initialization time, or at module load time, and we have exclusive +/// access to the parameter for the duration of the function. +/// +/// [`module!`]: macros::module +unsafe extern "C" fn set_param( + val: *const kernel::ffi::c_char, + param: *const crate::bindings::kernel_param, +) -> core::ffi::c_int +where + T: ModuleParam, +{ + // NOTE: If we start supporting arguments without values, val _is_ all= owed + // to be null here. + if val.is_null() { + // TODO: Use pr_warn_once available. + crate::pr_warn!("Null pointer passed to `module_param::set_param`"= ); + return EINVAL.to_errno(); + } + + // SAFETY: By function safety requirement, val is non-null and + // null-terminated. By C API contract, `val` is live and valid for rea= ds + // for the duration of this function. + let arg =3D unsafe { CStr::from_char_ptr(val) }; + + crate::error::from_result(|| { + let new_value =3D T::try_from_param_arg(arg)?; + + // SAFETY: `param` is guaranteed to be valid by C API contract + // and `arg` is guaranteed to point to an instance of `T`. + let old_value =3D unsafe { (*param).__bindgen_anon_1.arg as *mut T= }; + + // SAFETY: `old_value` is valid for writes, as we have exclusive + // access. `old_value` is pointing to an initialized static, and + // so it is properly initialized. + unsafe { *old_value =3D new_value }; + Ok(0) + }) +} + +macro_rules! impl_int_module_param { + ($ty:ident) =3D> { + impl ModuleParam for $ty { + type Value =3D $ty; + + fn try_from_param_arg(arg: &'static BStr) -> Result { + <$ty as crate::str::parse_int::ParseInt>::from_str(arg) + } + } + }; +} + +impl_int_module_param!(i8); +impl_int_module_param!(u8); +impl_int_module_param!(i16); +impl_int_module_param!(u16); +impl_int_module_param!(i32); +impl_int_module_param!(u32); +impl_int_module_param!(i64); +impl_int_module_param!(u64); +impl_int_module_param!(isize); +impl_int_module_param!(usize); + +/// A wrapper for kernel parameters. +/// +/// This type is instantiated by the [`module!`] macro when module paramet= ers are +/// defined. You should never need to instantiate this type directly. +/// +/// Note: This type is `pub` because it is used by module crates to access +/// parameter values. +#[repr(transparent)] +pub struct ModuleParamAccess { + data: core::cell::UnsafeCell, +} + +// SAFETY: We only create shared references to the contents of this contai= ner, +// so if `T` is `Sync`, so is `ModuleParamAccess`. +unsafe impl Sync for ModuleParamAccess {} + +impl ModuleParamAccess { + #[doc(hidden)] + pub const fn new(value: T) -> Self { + Self { + data: core::cell::UnsafeCell::new(value), + } + } + + /// Get a shared reference to the parameter value. + // Note: When sysfs access to parameters are enabled, we have to pass = in a + // held lock guard here. + pub fn get(&self) -> &T { + // SAFETY: As we only support read only parameters with no sysfs + // exposure, the kernel will not touch the parameter data after mo= dule + // initialization. + unsafe { &*self.data.get() } + } + + /// Get a mutable pointer to the parameter value. + pub const fn as_mut_ptr(&self) -> *mut T { + self.data.get() + } +} + +#[doc(hidden)] +#[macro_export] +/// Generate a static [`kernel_param_ops`](srctree/include/linux/modulepar= am.h) struct. +/// +/// # Examples +/// +/// ```ignore +/// make_param_ops!( +/// /// Documentation for new param ops. +/// PARAM_OPS_MYTYPE, // Name for the static. +/// MyType // A type which implements [`ModuleParam`]. +/// ); +/// ``` +macro_rules! make_param_ops { + ($ops:ident, $ty:ty) =3D> { + /// + /// Static [`kernel_param_ops`](srctree/include/linux/moduleparam.= h) + /// struct generated by `make_param_ops` + #[doc =3D concat!("for [`", stringify!($ty), "`].")] + pub static $ops: $crate::bindings::kernel_param_ops =3D $crate::bi= ndings::kernel_param_ops { + flags: 0, + set: Some(set_param::<$ty>), + get: None, + free: None, + }; + }; +} + +make_param_ops!(PARAM_OPS_I8, i8); +make_param_ops!(PARAM_OPS_U8, u8); +make_param_ops!(PARAM_OPS_I16, i16); +make_param_ops!(PARAM_OPS_U16, u16); +make_param_ops!(PARAM_OPS_I32, i32); +make_param_ops!(PARAM_OPS_U32, u32); +make_param_ops!(PARAM_OPS_I64, i64); +make_param_ops!(PARAM_OPS_U64, u64); +make_param_ops!(PARAM_OPS_ISIZE, isize); +make_param_ops!(PARAM_OPS_USIZE, usize); diff --git a/rust/macros/helpers.rs b/rust/macros/helpers.rs index a3ee27e29a6f..16d300ad3d3b 100644 --- a/rust/macros/helpers.rs +++ b/rust/macros/helpers.rs @@ -10,6 +10,17 @@ pub(crate) fn try_ident(it: &mut token_stream::IntoIter)= -> Option { } } =20 +pub(crate) fn try_sign(it: &mut token_stream::IntoIter) -> Option { + let peek =3D it.clone().next(); + match peek { + Some(TokenTree::Punct(punct)) if punct.as_char() =3D=3D '-' =3D> { + let _ =3D it.next(); + Some(punct.as_char()) + } + _ =3D> None, + } +} + pub(crate) fn try_literal(it: &mut token_stream::IntoIter) -> Option { if let Some(TokenTree::Literal(literal)) =3D it.next() { Some(literal.to_string()) @@ -86,3 +97,17 @@ pub(crate) fn function_name(input: TokenStream) -> Optio= n { } None } + +/// Parse a token stream of the form `expected_name: "value",` and return = the +/// string in the position of "value". +/// +/// # Panics +/// +/// - On parse error. +pub(crate) fn expect_string_field(it: &mut token_stream::IntoIter, expecte= d_name: &str) -> String { + assert_eq!(expect_ident(it), expected_name); + assert_eq!(expect_punct(it), ':'); + let string =3D expect_string(it); + assert_eq!(expect_punct(it), ','); + string +} diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs index 9acaa68c974e..7a3a54fcf88e 100644 --- a/rust/macros/lib.rs +++ b/rust/macros/lib.rs @@ -23,6 +23,30 @@ /// The `type` argument should be a type which implements the [`Module`] /// trait. Also accepts various forms of kernel metadata. /// +/// The `params` field describe module parameters. Each entry has the form +/// +/// ```ignore +/// parameter_name: type { +/// default: default_value, +/// description: "Description", +/// } +/// ``` +/// +/// `type` may be one of +/// +/// - [`i8`] +/// - [`u8`] +/// - [`i8`] +/// - [`u8`] +/// - [`i16`] +/// - [`u16`] +/// - [`i32`] +/// - [`u32`] +/// - [`i64`] +/// - [`u64`] +/// - [`isize`] +/// - [`usize`] +/// /// C header: [`include/linux/moduleparam.h`](srctree/include/linux/module= param.h) /// /// [`Module`]: ../kernel/trait.Module.html @@ -39,6 +63,12 @@ /// description: "My very own kernel module!", /// license: "GPL", /// alias: ["alternate_module_name"], +/// params: { +/// my_parameter: i64 { +/// default: 1, +/// description: "This parameter has a default of 1", +/// }, +/// }, /// } /// /// struct MyModule(i32); @@ -47,6 +77,7 @@ /// fn init(_module: &'static ThisModule) -> Result { /// let foo: i32 =3D 42; /// pr_info!("I contain: {}\n", foo); +/// pr_info!("i32 param is: {}\n", module_parameters::my_paramete= r.read()); /// Ok(Self(foo)) /// } /// } diff --git a/rust/macros/module.rs b/rust/macros/module.rs index a9418fbc9b44..342c9e91fb62 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -26,6 +26,7 @@ struct ModInfoBuilder<'a> { module: &'a str, counter: usize, buffer: String, + param_buffer: String, } =20 impl<'a> ModInfoBuilder<'a> { @@ -34,10 +35,11 @@ fn new(module: &'a str) -> Self { module, counter: 0, buffer: String::new(), + param_buffer: String::new(), } } =20 - fn emit_base(&mut self, field: &str, content: &str, builtin: bool) { + fn emit_base(&mut self, field: &str, content: &str, builtin: bool, par= am: bool) { let string =3D if builtin { // Built-in modules prefix their modinfo strings by `module.`. format!( @@ -51,8 +53,14 @@ fn emit_base(&mut self, field: &str, content: &str, buil= tin: bool) { format!("{field}=3D{content}\0", field =3D field, content =3D = content) }; =20 + let buffer =3D if param { + &mut self.param_buffer + } else { + &mut self.buffer + }; + write!( - &mut self.buffer, + buffer, " {cfg} #[doc(hidden)] @@ -75,20 +83,116 @@ fn emit_base(&mut self, field: &str, content: &str, bu= iltin: bool) { self.counter +=3D 1; } =20 - fn emit_only_builtin(&mut self, field: &str, content: &str) { - self.emit_base(field, content, true) + fn emit_only_builtin(&mut self, field: &str, content: &str, param: boo= l) { + self.emit_base(field, content, true, param) } =20 - fn emit_only_loadable(&mut self, field: &str, content: &str) { - self.emit_base(field, content, false) + fn emit_only_loadable(&mut self, field: &str, content: &str, param: bo= ol) { + self.emit_base(field, content, false, param) } =20 fn emit(&mut self, field: &str, content: &str) { - self.emit_only_builtin(field, content); - self.emit_only_loadable(field, content); + self.emit_internal(field, content, false); + } + + fn emit_internal(&mut self, field: &str, content: &str, param: bool) { + self.emit_only_builtin(field, content, param); + self.emit_only_loadable(field, content, param); + } + + fn emit_param(&mut self, field: &str, param: &str, content: &str) { + let content =3D format!("{param}:{content}", param =3D param, cont= ent =3D content); + self.emit_internal(field, &content, true); + } + + fn emit_params(&mut self, info: &ModuleInfo) { + let Some(params) =3D &info.params else { + return; + }; + + for param in params { + let ops =3D param_ops_path(¶m.ptype); + + // Note: The spelling of these fields is dictated by the user = space + // tool `modinfo`. + self.emit_param("parmtype", ¶m.name, ¶m.ptype); + self.emit_param("parm", ¶m.name, ¶m.description); + + write!( + self.param_buffer, + " + pub(crate) static {param_name}: + ::kernel::module_param::ModuleParamAccess<{param_t= ype}> =3D + ::kernel::module_param::ModuleParamAccess::new= ({param_default}); + + #[link_section =3D \"__param\"] + #[used] + static __{module_name}_{param_name}_struct: + ::kernel::module_param::RacyKernelParam =3D + ::kernel::module_param::RacyKernelParam(::kernel::= bindings::kernel_param {{ + name: if cfg!(MODULE) {{ + ::kernel::c_str!(\"{param_name}\").as_byte= s_with_nul() + }} else {{ + ::kernel::c_str!(\"{module_name}.{param_na= me}\").as_bytes_with_nul() + }}.as_ptr(), + // SAFETY: `__this_module` is constructed by t= he kernel at load time + // and will not be freed until the module is u= nloaded. + #[cfg(MODULE)] + mod_: unsafe {{ + (&::kernel::bindings::__this_module + as *const ::kernel::bindings::module) + .cast_mut() + }}, + #[cfg(not(MODULE))] + mod_: ::core::ptr::null_mut(), + ops: &{ops} as *const ::kernel::bindings::kern= el_param_ops, + perm: 0, // Will not appear in sysfs + level: -1, + flags: 0, + __bindgen_anon_1: + ::kernel::bindings::kernel_param__bindgen_= ty_1 {{ + arg: {param_name}.as_mut_ptr().cast() + }}, + }}); + ", + module_name =3D info.name, + param_type =3D param.ptype, + param_default =3D param.default, + param_name =3D param.name, + ops =3D ops, + ) + .unwrap(); + } + } +} + +fn param_ops_path(param_type: &str) -> &'static str { + match param_type { + "i8" =3D> "::kernel::module_param::PARAM_OPS_I8", + "u8" =3D> "::kernel::module_param::PARAM_OPS_U8", + "i16" =3D> "::kernel::module_param::PARAM_OPS_I16", + "u16" =3D> "::kernel::module_param::PARAM_OPS_U16", + "i32" =3D> "::kernel::module_param::PARAM_OPS_I32", + "u32" =3D> "::kernel::module_param::PARAM_OPS_U32", + "i64" =3D> "::kernel::module_param::PARAM_OPS_I64", + "u64" =3D> "::kernel::module_param::PARAM_OPS_U64", + "isize" =3D> "::kernel::module_param::PARAM_OPS_ISIZE", + "usize" =3D> "::kernel::module_param::PARAM_OPS_USIZE", + t =3D> panic!("Unsupported parameter type {}", t), } } =20 +fn expect_param_default(param_it: &mut token_stream::IntoIter) -> String { + assert_eq!(expect_ident(param_it), "default"); + assert_eq!(expect_punct(param_it), ':'); + let sign =3D try_sign(param_it); + let default =3D try_literal(param_it).expect("Expected default param v= alue"); + assert_eq!(expect_punct(param_it), ','); + let mut value =3D sign.map(String::from).unwrap_or_default(); + value.push_str(&default); + value +} + #[derive(Debug, Default)] struct ModuleInfo { type_: String, @@ -99,6 +203,50 @@ struct ModuleInfo { description: Option, alias: Option>, firmware: Option>, + params: Option>, +} + +#[derive(Debug)] +struct Parameter { + name: String, + ptype: String, + default: String, + description: String, +} + +fn expect_params(it: &mut token_stream::IntoIter) -> Vec { + let params =3D expect_group(it); + assert_eq!(params.delimiter(), Delimiter::Brace); + let mut it =3D params.stream().into_iter(); + let mut parsed =3D Vec::new(); + + loop { + let param_name =3D match it.next() { + Some(TokenTree::Ident(ident)) =3D> ident.to_string(), + Some(_) =3D> panic!("Expected Ident or end"), + None =3D> break, + }; + + assert_eq!(expect_punct(&mut it), ':'); + let param_type =3D expect_ident(&mut it); + let group =3D expect_group(&mut it); + assert_eq!(group.delimiter(), Delimiter::Brace); + assert_eq!(expect_punct(&mut it), ','); + + let mut param_it =3D group.stream().into_iter(); + let param_default =3D expect_param_default(&mut param_it); + let param_description =3D expect_string_field(&mut param_it, "desc= ription"); + expect_end(&mut param_it); + + parsed.push(Parameter { + name: param_name, + ptype: param_type, + default: param_default, + description: param_description, + }) + } + + parsed } =20 impl ModuleInfo { @@ -114,6 +262,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self { "license", "alias", "firmware", + "params", ]; const REQUIRED_KEYS: &[&str] =3D &["type", "name", "license"]; let mut seen_keys =3D Vec::new(); @@ -143,6 +292,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self { "license" =3D> info.license =3D expect_string_ascii(it), "alias" =3D> info.alias =3D Some(expect_string_array(it)), "firmware" =3D> info.firmware =3D Some(expect_string_array= (it)), + "params" =3D> info.params =3D Some(expect_params(it)), _ =3D> panic!( "Unknown key \"{}\". Valid keys are: {:?}.", key, EXPECTED_KEYS @@ -186,33 +336,35 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { let info =3D ModuleInfo::parse(&mut it); =20 let mut modinfo =3D ModInfoBuilder::new(info.name.as_ref()); - if let Some(author) =3D info.author { - modinfo.emit("author", &author); + if let Some(author) =3D &info.author { + modinfo.emit("author", author); } - if let Some(authors) =3D info.authors { + if let Some(authors) =3D &info.authors { for author in authors { - modinfo.emit("author", &author); + modinfo.emit("author", author); } } - if let Some(description) =3D info.description { - modinfo.emit("description", &description); + if let Some(description) =3D &info.description { + modinfo.emit("description", description); } modinfo.emit("license", &info.license); - if let Some(aliases) =3D info.alias { + if let Some(aliases) =3D &info.alias { for alias in aliases { - modinfo.emit("alias", &alias); + modinfo.emit("alias", alias); } } - if let Some(firmware) =3D info.firmware { + if let Some(firmware) =3D &info.firmware { for fw in firmware { - modinfo.emit("firmware", &fw); + modinfo.emit("firmware", fw); } } =20 // Built-in modules also export the `file` modinfo string. let file =3D std::env::var("RUST_MODFILE").expect("Unable to fetch RUST_MODFILE= environmental variable"); - modinfo.emit_only_builtin("file", &file); + modinfo.emit_only_builtin("file", &file, false); + + modinfo.emit_params(&info); =20 format!( " @@ -374,14 +526,17 @@ unsafe fn __exit() {{ __MOD.assume_init_drop(); }} }} - {modinfo} }} }} + mod module_parameters {{ + {params} + }} ", type_ =3D info.type_, name =3D info.name, modinfo =3D modinfo.buffer, + params =3D modinfo.param_buffer, initcall_section =3D ".initcall6.init" ) .parse() diff --git a/samples/rust/rust_minimal.rs b/samples/rust/rust_minimal.rs index 1fc7a1be6b6d..c04cc07b3249 100644 --- a/samples/rust/rust_minimal.rs +++ b/samples/rust/rust_minimal.rs @@ -10,6 +10,12 @@ authors: ["Rust for Linux Contributors"], description: "Rust minimal sample", license: "GPL", + params: { + test_parameter: i64 { + default: 1, + description: "This parameter has a default of 1", + }, + }, } =20 struct RustMinimal { @@ -20,6 +26,10 @@ impl kernel::Module for RustMinimal { fn init(_module: &'static ThisModule) -> Result { pr_info!("Rust minimal sample (init)\n"); pr_info!("Am I built-in? {}\n", !cfg!(MODULE)); + pr_info!( + "test_parameter: {}\n", + *module_parameters::test_parameter.get() + ); =20 let mut numbers =3D KVec::new(); numbers.push(72, GFP_KERNEL)?; --=20 2.47.2 From nobody Tue Dec 16 15:25:10 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE6CA27FD67; Tue, 6 May 2025 13:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746536575; cv=none; b=DneJ4h1l7IQx8z+qTKq/U+4pKJJiqUF0qxlq5g/j2dR9+eUwvLS1TDhegBy/sCuibFPoF34L3JOVAQh8Wwz7HTtoqSu0R2vxU5UjQBoQ+KBIDdJW8LU7Zo88hpLzX4VWuBSl/CvZy6AQWn466PNT/m3stwaabW9obbvnUeumIBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746536575; c=relaxed/simple; bh=Y298LSzWv3GbHqmcvO2wI8CypYsGzuXwta1YgsS7xr8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bbuWJE1xsujP1g5R7qL1ndYYxyJG4bgpAT7l7UHCocMHDV/xaWR8SnmqJ3rE/dtohncCBLxUtwdonCuUzlmKWJliTdxyMD100MUb+Vc74447r+enVuGzfGzIaCt6J9nHRZIx2u3Q7R022gF3lUv10bsiWOglYwIVrLbxl51sPKk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=loVvBnNg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="loVvBnNg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF17BC4CEEE; Tue, 6 May 2025 13:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746536574; bh=Y298LSzWv3GbHqmcvO2wI8CypYsGzuXwta1YgsS7xr8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=loVvBnNgwgxE/yYv/cBF6p+Z8c5hTfgCHOhi2b2cfCCHYYCsEe4aZyeo5NhE7HPQp 0AxneBY1qnQYYHVF8feQXRJwLnYzaVfaKflMhR104dWmszK2HrsCNZfhtYvqJOvA/7 2uGthOdKW3m7eNDNScD0DAvuKwyN+ARbQU5dSi5icVzCUBBqY8O0YYdEuhJZw7+egR TYexvg3MmIC7aTnnyROvrdChf1Dz9NgBZ7Xyue8X6b8H/k83px4ptcFofFq70cURB8 4uLHn8iZFoPsepDraWIMA4vrI6Jt0obewdScsU1IgTJ22VlLvGIqjKfpu66an8TP7v gBtM01qQKXE0g== From: Andreas Hindborg Date: Tue, 06 May 2025 15:02:30 +0200 Subject: [PATCH v12 3/3] modules: add rust modules files to MAINTAINERS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250506-module-params-v3-v12-3-c04d80c8a2b1@kernel.org> References: <20250506-module-params-v3-v12-0-c04d80c8a2b1@kernel.org> In-Reply-To: <20250506-module-params-v3-v12-0-c04d80c8a2b1@kernel.org> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Masahiro Yamada , Nathan Chancellor , Luis Chamberlain , Danilo Krummrich , Nicolas Schier Cc: Trevor Gross , Adam Bratschi-Kaye , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Petr Pavlu , Sami Tolvanen , Daniel Gomez , Simona Vetter , Greg KH , Fiona Behrens , Daniel Almeida , linux-modules@vger.kernel.org, Andreas Hindborg X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=808; i=a.hindborg@kernel.org; h=from:subject:message-id; bh=Y298LSzWv3GbHqmcvO2wI8CypYsGzuXwta1YgsS7xr8=; b=owEBbQKS/ZANAwAIAeG4Gj55KGN3AcsmYgBoGghpxcYnOXHBFqzBWj7e8LWmafqdOOufyaOZB qSnEM/5cVCJAjMEAAEIAB0WIQQSwflHVr98KhXWwBLhuBo+eShjdwUCaBoIaQAKCRDhuBo+eShj d/ckEACXRXgQpIe09b6cFYawOQap0Gb23Yw+XiMpwt07282Qdm6do2xri8zpphzOWf+SmanLyEo WpKCX9R+a+CMgaMDRa8qDklQS+iu7KSWwZJ2HSuaYWPR5MQ+wzjziE9VXNQxtds56DFMm3DFQNg rbA0L+DsPiszAfVxYNbsHnvUCTmJz3nuoc83lCYyELatHsE/t3ByAntxyT48/vyB7yX98gikGrJ MQ+pXePD1OwnrhKzP6Xe9I8BY+0+OhTcugOOZXCg3u4ngGxlxUp4afUx7xtxPY1vLswBrSv/0Wm E6Zb6AA55KbLwVO3BCMl/0Qg4CzIqB6og2h8vSxYZmQcPVj17WZYgNOY3GUf3PxcB0b9I+nZTF3 8jXp+uJA8wvjGTBYslDpCZMDtqhxt1BBBqAWbppPneVJCeGnxqFOSjX3BezmQZ+nJK1U1POQx7t JXpLaTACEt1uQbfD63S0rlPmt/G8jdkv6ni3qfTslzKq+quQbP8bZU4NPNKLnSwSndsCPh0Z4lr /V+k6RxtsWPlRiJIA/RRvjD8oncyKfdV2kHGVTPqEOctGlm/NSo6kBeBUXjZDpAAxVg54b3hbVR gCwMnX65VGLK9x2fSj9kvc8KBLeEeMhyNJtYViLae8jA5OYcafRFO0keUKDJMv1ynnOXPOLS0xD s2UTsyk+FQsIwRA== X-Developer-Key: i=a.hindborg@kernel.org; a=openpgp; fpr=3108C10F46872E248D1FB221376EB100563EF7A7 The module subsystem people agreed to maintain rust support for modules [1]. Thus, add entries for relevant files to modules entry in MAINTAINERS. Link: https://lore.kernel.org/all/0d9e596a-5316-4e00-862b-fd77552ae4b5@suse= .com/ [1] Acked-by: Daniel Gomez Signed-off-by: Andreas Hindborg --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3cbf9ac0d83f..d283874843a0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16395,6 +16395,8 @@ F: include/linux/module*.h F: kernel/module/ F: lib/test_kmod.c F: lib/tests/module/ +F: rust/kernel/module_param.rs +F: rust/macros/module.rs F: scripts/module* F: tools/testing/selftests/kmod/ F: tools/testing/selftests/module/ --=20 2.47.2