#[non_exhaustive]pub struct KernelMetadata {
pub version: Option<String>,
pub source: KernelSource,
pub arch: String,
pub image_name: String,
pub config_hash: Option<String>,
pub built_at: String,
pub ktstr_kconfig_hash: Option<String>,
pub extra_kconfig_hash: Option<String>,
pub source_vmlinux_size: Option<u64>,
pub source_vmlinux_mtime_secs: Option<i64>,
/* private fields */
}Expand description
Metadata stored alongside a cached kernel image.
Required fields (source, arch, image_name, built_at,
has_vmlinux, vmlinux_stripped) must be present in
metadata.json during deserialization; a truncated file that
drops any of them surfaces the entry as ListedEntry::Corrupt
via crate::cache::CacheDir::list rather than silently
defaulting. Optional fields tolerate absent keys as None.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.version: Option<String>Kernel version string (e.g. “6.14.2”, “6.15-rc3”).
None when no version could be established — a local or git
source whose Makefile is unreadable/unparsable, or an
acquisition path that records none.
source: KernelSourceHow the kernel source was acquired, with per-source payload.
arch: StringTarget architecture (e.g. “x86_64”, “aarch64”).
image_name: StringBoot image filename (e.g. “bzImage”, “Image”).
config_hash: Option<String>CRC32 of the final .config used for the build.
built_at: StringISO 8601 timestamp of when the image was built.
ktstr_kconfig_hash: Option<String>CRC32 of ktstr.kconfig at build time.
extra_kconfig_hash: Option<String>CRC32 of the user-supplied --extra-kconfig fragment (raw
bytes) at build time. None for builds without
--extra-kconfig.
source_vmlinux_size: Option<u64>Size in bytes of the SOURCE-TREE vmlinux at cache-store time.
source_vmlinux_mtime_secs: Option<i64>Modification time (seconds since UNIX epoch) of the SOURCE-TREE vmlinux at cache-store time.
Implementations§
Source§impl KernelMetadata
impl KernelMetadata
Sourcepub fn new(
source: KernelSource,
arch: impl Into<String>,
image_name: impl Into<String>,
built_at: impl Into<String>,
) -> Self
pub fn new( source: KernelSource, arch: impl Into<String>, image_name: impl Into<String>, built_at: impl Into<String>, ) -> Self
Create a new KernelMetadata with required fields.
Sourcepub fn with_source_vmlinux_stat(self, size: u64, mtime_secs: i64) -> Self
pub fn with_source_vmlinux_stat(self, size: u64, mtime_secs: i64) -> Self
Set the source-tree vmlinux size and mtime captured at cache store time.
Sourcepub fn clear_source_vmlinux_stat(self) -> Self
pub fn clear_source_vmlinux_stat(self) -> Self
Unset the source-tree vmlinux stat (both size and mtime back
to the None default).
Sourcepub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
Set the kernel version.
Sourcepub fn clear_version(self) -> Self
pub fn clear_version(self) -> Self
Unset the kernel version (back to the None default).
Sourcepub fn with_config_hash(self, hash: impl Into<String>) -> Self
pub fn with_config_hash(self, hash: impl Into<String>) -> Self
Set the .config CRC32 hash.
Sourcepub fn clear_config_hash(self) -> Self
pub fn clear_config_hash(self) -> Self
Unset the .config CRC32 hash (back to the None default).
Sourcepub fn with_ktstr_kconfig_hash(self, hash: impl Into<String>) -> Self
pub fn with_ktstr_kconfig_hash(self, hash: impl Into<String>) -> Self
Set the ktstr.kconfig CRC32 hash.
Sourcepub fn clear_ktstr_kconfig_hash(self) -> Self
pub fn clear_ktstr_kconfig_hash(self) -> Self
Unset the ktstr.kconfig CRC32 hash (back to the None default).
Sourcepub fn with_extra_kconfig_hash(self, hash: impl Into<String>) -> Self
pub fn with_extra_kconfig_hash(self, hash: impl Into<String>) -> Self
Set the --extra-kconfig fragment CRC32 hash.
Sourcepub fn clear_extra_kconfig_hash(self) -> Self
pub fn clear_extra_kconfig_hash(self) -> Self
Unset the --extra-kconfig fragment CRC32 hash (back to the None default).
Sourcepub fn has_vmlinux(&self) -> bool
pub fn has_vmlinux(&self) -> bool
Whether a vmlinux ELF was cached alongside the image.
Sourcepub fn vmlinux_stripped(&self) -> bool
pub fn vmlinux_stripped(&self) -> bool
Whether the cached vmlinux came from a successful strip pass.
Trait Implementations§
Source§impl Clone for KernelMetadata
impl Clone for KernelMetadata
Source§fn clone(&self) -> KernelMetadata
fn clone(&self) -> KernelMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KernelMetadata
impl Debug for KernelMetadata
Source§impl<'de> Deserialize<'de> for KernelMetadata
impl<'de> Deserialize<'de> for KernelMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for KernelMetadata
impl RefUnwindSafe for KernelMetadata
impl Send for KernelMetadata
impl Sync for KernelMetadata
impl Unpin for KernelMetadata
impl UnwindSafe for KernelMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more