Documentation ¶
Overview ¶
Package kmod provides functions to load and unload Linux kernel modules.
Module dependencies are loaded / unloaded automatically according to <mod_dir>/modules.dep. Compressed module files can be loaded via a custom InitFunc provided by the caller. See SetInitFunc and cmd/modprobe for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrModuleInUse = errors.New("module is in use")
ErrModuleInUse is the error resulting if a module can't be unloaded because it is in use.
var ErrModuleNotFound = errors.New("module not found")
ErrModuleNotFound is the error resulting if a module can't be found.
Functions ¶
This section is empty.
Types ¶
type Kmod ¶
type Kmod struct {
// contains filtered or unexported fields
}
Kmod represents internal configuration
func (*Kmod) Dependencies ¶
Dependencies returns a list of module dependencies.
type Option ¶
type Option func(*Kmod)
Option configures Kmod.
func SetConfigFile ¶
SetConfigFile returns an Option that specifies the (optional) configuration file for modules, default: /etc/modprobe.conf. The config file is used only for module parameters. options <name> parameter [parameter]...
func SetDryrun ¶
func SetDryrun() Option
SetDryrun returns an Option that specifies to do everything but actually load or unload.
func SetIgnoreAlias ¶
func SetIgnoreAlias() Option
SetIgnoreAlias returns an Option that specifies not to consult modules.alias to resolve aliases.
func SetIgnoreBuiltin ¶
func SetIgnoreBuiltin() Option
SetIgnoreBuiltin returns an Option that specifies not to consult modules.builtin to find built-in modules.
func SetIgnoreStatus ¶
func SetIgnoreStatus() Option
SetIgnoreStatus returns an Option that specifies not to consult /proc/modules to get the current status of a module.
func SetInitFunc ¶
SetInitFunc returns an Option that sets fn to be used for loading module files into the kernel. The default function tries to use finit_module(2) first and if that failes init_module(2). To support compressed module files see the example cmd/modprobe.
func SetRootDir ¶
SetRootDir returns an Option that sets dir as root directory for modules, default: /lib/modules
func SetVerbose ¶
func SetVerbose() Option
SetVerbose returns an Option that specifies to log info messages about what's going on.