[][src]Struct linapi::modules::LoadedModule

pub struct LoadedModule { /* fields omitted */ }

Describes a loaded Linux kernel Module

Methods

impl LoadedModule[src]

pub fn from_name(name: &str) -> Self[src]

Get an already loaded module by name

Panics

  • If no such module exists

pub fn get_loaded() -> Vec<Self>[src]

Get currently loaded dynamic kernel modules

Note

Modules can be unloaded, and if that happens methods on LoadedModule will panic

pub fn unload(self)[src]

Unload the module.

Panics

  • On failure

pub unsafe fn force_unload(self)[src]

Forcefully unload a kernel module.

Safety

Force unloading is wildly dangerous and will taint your kernel.

It can cause modules to be unloaded while still in use, or unload modules not designed to be unloaded.

Panics

  • On failure

pub fn name(&self) -> &str[src]

Name of the module

pub fn module_type(&self) -> Type[src]

Module type, Builtin or Dynamic

pub fn parameters(&self) -> HashMap<String, Vec<u8>>[src]

Module parameters.

The kernel exposes these as files in a directory, and their contents are entirely module specific, hence Vec<(String, Vec<u8>)>, which can be std::io::Read.

Stability

The stability of parameters depends entirely on the specific module.

pub fn ref_count(&self) -> Option<u32>[src]

Module reference count.

If the module is built-in, or if the kernel was not built with CONFIG_MODULE_UNLOAD, this will be None

pub fn size(&self) -> u64[src]

Module size in bytes

pub fn taint(&self) -> Option<Taint>[src]

Module taint, or None if untainted.

See Taint for details.

pub fn holders(&self) -> Vec<Self>[src]

List of other modules that use/reference this one.

Note

This uses the holders sysfs folder, which is completely undocumented by the kernel, beware.

pub fn file_path(&self) -> PathBuf[src]

Path to the module file.

Note

There is no guarantee the returned path is the same module. The file may have changed on disk.

This is equivalent to find_module_file(&module.name())

pub fn status(&self) -> Status[src]

Module status.

Note

This uses the undocumented initstate file, which is probably module_state from linux/module.h.

Trait Implementations

impl Debug for LoadedModule[src]

impl UEvent for LoadedModule[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> UEvent for T where
    T: Device
[src]