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 <[email protected]>
---
 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


Reply via email to