pub struct KernelInfo {
pub version: String,
/* private fields */
}
Expand description
Metadata about the kernel and details about it
Fields§
§version: String
Implementations§
Source§impl KernelInfo
impl KernelInfo
Sourcepub fn new(rootpath: &str, kver: &str) -> Result<Self, Error>
pub fn new(rootpath: &str, kver: &str) -> Result<Self, Error>
Creates an instance of a KernelInfo struct with the version of the kernel and paths to required points for module analysis.
Root path is either “/” for the host filesystem or a mountpoint to the root filesystem.
NOTE: The module resolver is very simple here and won’t scale that much if a kernel will have millions of modules. But as of 2024 it works OK with those dozen of thousands as for a generator. Generated CPIO anyway will contain already sorted list.
Sourcepub fn get_kernel_path(&self) -> PathBuf
pub fn get_kernel_path(&self) -> PathBuf
Return current kernel info root path.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if there are actual modules on the media for this kernel. There are often kernel paths left after a kernel was not completely purged.
Sourcepub fn get_dep_path(&self) -> &str
pub fn get_dep_path(&self) -> &str
Get path of dependencies file
Sourcepub fn get_deps_for(&self, names: &[String]) -> HashMap<String, Vec<String>>
pub fn get_deps_for(&self, names: &[String]) -> HashMap<String, Vec<String>>
Resolve all module dependencies
Sourcepub fn is_dep(&self, name: &str) -> bool
pub fn is_dep(&self, name: &str) -> bool
Return true if a given module is a dependency to something else
Sourcepub fn get_deps_for_flatten(&self, names: &[String]) -> Vec<String>
pub fn get_deps_for_flatten(&self, names: &[String]) -> Vec<String>
Same as get_deps_for
, except returns flattened list
for all modules with their dependencies.
Sourcepub fn get_disk_modules(&self) -> Vec<String>
pub fn get_disk_modules(&self) -> Vec<String>
Get all found modules
Trait Implementations§
Source§impl Clone for KernelInfo
impl Clone for KernelInfo
Source§fn clone(&self) -> KernelInfo
fn clone(&self) -> KernelInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more