Skip to main content

Crate component

Crate component 

Source
Expand description

Component initialization system for Strat9-OS.

Provides modular component registration and dependency-ordered initialization. Components are registered at compile time via #[init_component] and discovered at runtime through the .component_entries linker section.

§Usage

#[component::init_component(bootstrap, priority = 1)]
fn vfs_init() -> Result<(), component::ComponentInitError> {
    vfs::init();
    Ok(())
}

#[component::init_component(kthread, priority = 2, depends_on = vfs_init)]
fn fs_ext4_init() -> Result<(), component::ComponentInitError> {
    fs_ext4::init();
    Ok(())
}

Call component::init_all(InitStage::Bootstrap) at the appropriate point in kernel_main to run all registered components in dependency order.

Macros§

parse_components_toml
Emit compile-time dependency metadata parsed from Components.toml.
parse_metadata
Parse Components.toml at compile time and return the dependency metadata.

Structs§

ComponentEntry
Entry placed in .component_entries by #[init_component].
ComponentInfo
Human-readable component metadata (not stored in the linker section).

Enums§

ComponentInitError
Errors that a component initializer may return.
InitStage
Initialization stages for components.

Functions§

init_all
Initialize all components registered for stage in dependency order.
list_components
Return all registered components sorted by stage then priority (for debug).

Attribute Macros§

init_component
Register a function as a kernel component initializer.