PatchworkOS
Loading...
Searching...
No Matches
Module Management

Kernel module management. More...

Data Structures

struct  module_event_t
 
struct  module_t
 

Macros

#define MODULE_ACPI_HIDS(...)
 Macro to define what ACPI HIDs a module can handle.
 

Enumerations

enum  module_event_type_t {
  MODULE_EVENT_NONE = 0 ,
  MODULE_EVENT_LOAD ,
  MODULE_EVENT_UNLOAD
}
 Module event types. More...
 

Functions

void module_init (void)
 Initializes the module system.
 
uint64_t module_event (module_event_t *event)
 Propagates a module event to all registered modules.
 

Detailed Description

Kernel module management.

Macro Definition Documentation

◆ MODULE_ACPI_HIDS

#define MODULE_ACPI_HIDS (   ...)
Value:
static const char* _moduleAcpiHids __attribute__((section(".module_acpi_hids"), used)) = \
__VA_ARGS__

Macro to define what ACPI HIDs a module can handle.

To define what ACPI HIDs a module can handle we define a separate section in the module's binary called .module_acpi_hids this section stores a concatenated string of all ACPI HIDs the module can handle. We dont need terminators for each string as their length is fixed depending on their prefix, we do have a null-terminator at the end of the entire list though.

Example:

MODULE_ACPI_HIDS("PNP0C0A", "PNP0C0B", "ACPI0003");
#define MODULE_ACPI_HIDS(...)
Macro to define what ACPI HIDs a module can handle.
Definition module.h:76
Parameters
...A variable amount of ACPI HIDs as string literals.

Definition at line 76 of file module.h.

Enumeration Type Documentation

◆ module_event_type_t

Module event types.

Enumerator
MODULE_EVENT_NONE 
MODULE_EVENT_LOAD 
MODULE_EVENT_UNLOAD 

Definition at line 23 of file module.h.

Function Documentation

◆ module_event()

uint64_t module_event ( module_event_t event)

Propagates a module event to all registered modules.

If the event is a load or unload event, then the event's hid field will be matched against all modules' HIDs, if a match is found that module or modules will be loaded/unloaded.

Parameters
eventThe event to propagate.
Returns
On success, 0. On failure, ERR and errno is set.

Definition at line 13 of file module.c.

◆ module_init()

void module_init ( void  )

Initializes the module system.

Definition at line 8 of file module.c.

Referenced by init_finalize().