Skip to main content

load

Function load 

Source
pub fn load(image: &[u8], params: String) -> Result<()>
Expand description

Load kernel module by byte array.

Example:

extern crate liblmod;

use std::io::Read;
let mut file = std::fs::File::open(std::path::Path::new("./module.ko"))?;
let mut image = Vec::new();
file.read_to_end(&mut image)?;

if let Err(e) = liblmod::loader::load(&image, "module.param=0".to_string()) {
    eprintln!("Failed to insert module by image: {e}");
}