drivers

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupModule

func LookupModule(vendorID, deviceID string) string

LookupModule returns the kernel module name for a PCI vendor:device ID.

func RequiredModules

func RequiredModules() ([]string, error)

RequiredModules returns the kernel modules needed for detected PCI hardware.

func UniqueModulesFrom

func UniqueModulesFrom(devices []PCIDevice) []string

UniqueModulesFrom extracts unique module names from a list of PCI devices.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles kernel module operations.

func NewManager

func NewManager(log *slog.Logger) *Manager

NewManager creates a kernel module manager.

func (*Manager) FindModule

func (m *Manager) FindModule(name string) (string, error)

FindModule searches for a .ko file in the modules directory.

func (*Manager) IsLoaded

func (m *Manager) IsLoaded(name string) bool

IsLoaded checks if a module is currently loaded by reading procModulesPath.

func (*Manager) ListLoaded

func (m *Manager) ListLoaded() ([]Module, error)

ListLoaded returns currently loaded kernel modules from /proc/modules.

type Manifest

type Manifest struct {
	Common  []string `yaml:"common" json:"common"`
	NICs    []string `yaml:"nics" json:"nics,omitempty"`
	Storage []string `yaml:"storage" json:"storage,omitempty"`
	USB     []string `yaml:"usb" json:"usb,omitempty"`
	Custom  []string `yaml:"custom" json:"custom,omitempty"`
}

Manifest defines which modules to load per flavor.

func (*Manifest) AllModules

func (m *Manifest) AllModules() []string

AllModules returns all modules from the manifest in load order.

type Module

type Module struct {
	Name string `json:"name"`
	Path string `json:"path,omitempty"`
	// UsedBy is parsed from the 4th /proc/modules field.
	UsedBy []string `json:"usedBy,omitempty"`
	// Deprecated: kept for compatibility; mirrors UsedBy.
	Dependencies []string `json:"dependencies,omitempty"`
	Loaded       bool     `json:"loaded"`
}

Module represents a kernel module with its metadata.

type PCIDevice

type PCIDevice struct {
	Address string `json:"address"`
	Vendor  string `json:"vendor"`
	Device  string `json:"device"`
	Class   string `json:"class"`
	Driver  string `json:"driver,omitempty"`
	Module  string `json:"module,omitempty"`
}

PCIDevice represents a PCI device found in sysfs.

func ScanPCIDevices

func ScanPCIDevices() ([]PCIDevice, error)

ScanPCIDevices reads PCI devices from sysfs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL