veridian_kernel/utils/
version.rs1#[derive(Debug, Clone, Copy)]
7#[repr(C)]
8pub struct KernelVersionInfo {
9 pub major: u16,
10 pub minor: u16,
11 pub patch: u16,
12 pub git_hash: [u8; 40],
13 pub build_timestamp: u64,
14 pub supported_archs: u64,
15}
16
17pub fn get_version_info() -> KernelVersionInfo {
19 let git_hash_str = env!("GIT_HASH", "0000000000000000000000000000000000000000");
21 let mut git_hash = [0u8; 40];
22 git_hash.copy_from_slice(git_hash_str.as_bytes());
23
24 KernelVersionInfo {
25 major: env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap_or(0),
26 minor: env!("CARGO_PKG_VERSION_MINOR").parse().unwrap_or(0),
27 patch: env!("CARGO_PKG_VERSION_PATCH").parse().unwrap_or(0),
28 git_hash,
29 build_timestamp: env!("BUILD_TIMESTAMP").parse().unwrap_or(0),
30 supported_archs: (1 << 0) | (1 << 1) | (1 << 2), }
32}