Expand description
A pure-Rust library to work with Linux kernel modules.
It provides support for loading and unloading kernel
modules on Linux.
For further details, see init_module(2)
and delete_module(2)
manpages.
use likemod;
fn load_modfile(fpath: &std::path::Path) -> Result<()> {
// Get a file descriptor to the kernel module object.
let fmod = std::fs::File::open(fpath)?;
// Assemble module parameters for loading.
let mut params = likemod::ModParams::new();
params.insert("bus_delay".to_string(), likemod::ModParamValue::Int(5));
// Try to load the module. It can fail if the kernel
// version and signature don't match.
let loader = likemod::ModLoader::default().set_parameters(params);
loader.load_module_file(&fmod)
}
Modules§
- errors
- Error handling.
Structs§
- ModLoader
- Module loader.
- ModUnloader
- Module unloader.
Enums§
- ModParam
Value - A module parameter value.
Type Aliases§
- ModParams
- Parameters used for loading a module, map of name-value.