Skip to main content

kversion

Macro kversion 

Source
macro_rules! kversion {
    (>  $($rest:tt)+) => { ... };
    (<  $($rest:tt)+) => { ... };
    (== $($rest:tt)+) => { ... };
    (>= $($rest:tt)+) => { ... };
    (<= $($rest:tt)+) => { ... };
    ($major:expr) => { ... };
    ($major:expr, $minor:expr) => { ... };
    ($major:expr, $minor:expr, $revision:expr) => { ... };
}
Available on ((32-bit and ARM, or 32-bit and little-endian and x86, or 64-bit and AArch64, or 64-bit and little-endian and x86-64) and (Android or Linux), or Linux and (32-bit and big-endian and PowerPC, or 32-bit and little-endian and RISC-V RV32, or 32-bit and little-endian and x86-64, or 32-bit and MIPS, or 64-bit and big-endian and s390x, or 64-bit and little-endian and LoongArch64, or 64-bit and little-endian and RISC-V RV64, or 64-bit and MIPS-64, or 64-bit and PowerPC64)) and non-crate feature bare only.
Expand description

A macro to create/query kernel version.

§Create a Version

kversion!(major [, minor [, revision]])

§Query version

kversion!( (>|<|==|>=|<=) major [, minor [, revision]])

§Examples

kversion!(4);          // Create version 4.0.0
kversion!(4, 11);      // Create version 4.11.0
kversion!(4, 11, 6)    // Create version 4.11.6
kversion!(>= 4);       // `true` if kernel version is 4.0.0 or superior
kversion!(< 4, 11);    // `true` if kernel version is earlier than 4.11.0
kversion!(== 5, 15, 6) // `true` if kernel is exactly 5.15.6