Re: [PATCH] rust: macros: document emit_base in ModInfoBuilder

From: MBKCHEL

Date: Fri Nov 13 2026 - 16:26:47 EST


Hi,

Friendly ping on this patch.

Thanks,
Ivan

чт, 29 окт. 2026 г. в 15:33, MBKCHEL <mbkchelofficialdev@xxxxxxxxx>:
>
> Hi,
>
> Please note that I made a typo in my last name in the "From" and
> "Signed-off-by" lines. My correct name is "Ivan Tverdokhleb".
>
> If the patch is accepted, could you please apply it with the corrected name?
>
> Thanks,
> Ivan
>
> ср, 28 окт. 2026 г. в 17:50, Ivan Tverdohleb <mbkchelofficialdev@xxxxxxxxx>:
> >
> > Add documentation for the emit_base method within the ModInfoBuilder
> > struct. Explain its role in formatting metadata strings, handling the
> > differentiation between built-in and loadable modules, and managing
> > linker sections and conditional compilation.
> >
> > Signed-off-by: Ivan Tverdohleb <mbkchelofficialdev@xxxxxxxxx>
> > ---
> > rust/macros/module.rs | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/rust/macros/module.rs b/rust/macros/module.rs
> > index 0a7b9e24c..6f361013f 100644
> > --- a/rust/macros/module.rs
> > +++ b/rust/macros/module.rs
> > @@ -49,6 +49,16 @@ fn new(module: &'a str) -> Self {
> > }
> > }
> >
> > + /// Emits a single metadata entry into the module information table.
> > + ///
> > + /// This method formats a `field=content\0` byte string and places it into the
> > + /// `.modinfo` linker section. For built-in modules (`builtin == true`), the string
> > + /// is prefixed with the module name (`module.field=content\0`) to avoid naming
> > + /// collisions in the final monolithic kernel binary.
> > + ///
> > + /// It automatically generates a unique static identifier using an internal counter
> > + /// and applies appropriate conditional compilation attributes (`#[cfg(MODULE)]` or
> > + /// `#[cfg(not(MODULE))]`) based on the target type.
> > fn emit_base(&mut self, field: &str, content: &str, builtin: bool, param: bool) {
> > let string = if builtin {
> > // Built-in modules prefix their modinfo strings by `module.`.
> > --
> > 2.56.0
> >