mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rust: macros: document emit_base in ModInfoBuilder
@ 2026-10-28 15:50 Ivan Tverdohleb
       [not found] ` <CA+YDrKA1hTM-Yh+qsCz7Q_O9f4m_JWqyxkm4izaz4uAao_Jz5Q@mail.gmail.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ivan Tverdohleb @ 2026-10-28 15:50 UTC (permalink / raw)
  To: Luis Chamberlain, Miguel Ojeda
  Cc: Petr Pavlu, Daniel Gomez, Sami Tolvanen, rust-for-linux,
	linux-modules, linux-kernel, Ivan Tverdohleb

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@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rust: macros: document emit_base in ModInfoBuilder
       [not found] ` <CA+YDrKA1hTM-Yh+qsCz7Q_O9f4m_JWqyxkm4izaz4uAao_Jz5Q@mail.gmail.com>
@ 2026-10-28 20:05   ` MBKCHEL
  2026-10-28 20:07   ` MBKCHEL
  1 sibling, 0 replies; 5+ messages in thread
From: MBKCHEL @ 2026-10-28 20:05 UTC (permalink / raw)
  To: Luis Chamberlain, Miguel Ojeda
  Cc: Petr Pavlu, Daniel Gomez, Sami Tolvanen, rust-for-linux,
	linux-modules, linux-kernel

ср, 28 окт. 2026 г. в 21:57, MBKCHEL <mbkchelofficialdev@gmail.com>:
>
> 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@gmail.com>:
>>
>> 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@gmail.com>
>> ---
>>  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
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rust: macros: document emit_base in ModInfoBuilder
       [not found] ` <CA+YDrKA1hTM-Yh+qsCz7Q_O9f4m_JWqyxkm4izaz4uAao_Jz5Q@mail.gmail.com>
  2026-10-28 20:05   ` MBKCHEL
@ 2026-10-28 20:07   ` MBKCHEL
  1 sibling, 0 replies; 5+ messages in thread
From: MBKCHEL @ 2026-10-28 20:07 UTC (permalink / raw)
  To: Luis Chamberlain, Miguel Ojeda
  Cc: Petr Pavlu, Daniel Gomez, Sami Tolvanen, rust-for-linux,
	linux-modules, linux-kernel

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 г. в 21:57, MBKCHEL <mbkchelofficialdev@gmail.com>:
>
> 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@gmail.com>:
>>
>> 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@gmail.com>
>> ---
>>  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
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rust: macros: document emit_base in ModInfoBuilder
  2026-10-28 15:50 [PATCH] rust: macros: document emit_base in ModInfoBuilder Ivan Tverdohleb
       [not found] ` <CA+YDrKA1hTM-Yh+qsCz7Q_O9f4m_JWqyxkm4izaz4uAao_Jz5Q@mail.gmail.com>
@ 2026-10-28 20:13 ` MBKCHEL
  2026-10-29 13:33 ` MBKCHEL
  2 siblings, 0 replies; 5+ messages in thread
From: MBKCHEL @ 2026-10-28 20:13 UTC (permalink / raw)
  To: Luis Chamberlain, Miguel Ojeda
  Cc: Petr Pavlu, Daniel Gomez, Sami Tolvanen, rust-for-linux,
	linux-modules, linux-kernel

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@gmail.com>:
>
> 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@gmail.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] rust: macros: document emit_base in ModInfoBuilder
  2026-10-28 15:50 [PATCH] rust: macros: document emit_base in ModInfoBuilder Ivan Tverdohleb
       [not found] ` <CA+YDrKA1hTM-Yh+qsCz7Q_O9f4m_JWqyxkm4izaz4uAao_Jz5Q@mail.gmail.com>
  2026-10-28 20:13 ` MBKCHEL
@ 2026-10-29 13:33 ` MBKCHEL
  2 siblings, 0 replies; 5+ messages in thread
From: MBKCHEL @ 2026-10-29 13:33 UTC (permalink / raw)
  To: Luis Chamberlain, Miguel Ojeda
  Cc: Petr Pavlu, Daniel Gomez, Sami Tolvanen, rust-for-linux,
	linux-modules, linux-kernel

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@gmail.com>:
>
> 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@gmail.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-29 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 15:50 [PATCH] rust: macros: document emit_base in ModInfoBuilder Ivan Tverdohleb
     [not found] ` <CA+YDrKA1hTM-Yh+qsCz7Q_O9f4m_JWqyxkm4izaz4uAao_Jz5Q@mail.gmail.com>
2026-10-28 20:05   ` MBKCHEL
2026-10-28 20:07   ` MBKCHEL
2026-10-28 20:13 ` MBKCHEL
2026-10-29 13:33 ` MBKCHEL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®