mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
kata-ctl: arch: Improve check call
Rework the architecture-specific `check()` call by moving all the conditional logic out of the function. Fixes: #5402. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
ff8bfdfe3b
commit
c322d1d12a
@ -7,36 +7,32 @@ use anyhow::Result;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub mod aarch64;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use aarch64 as arch_specific;
|
||||
|
||||
#[cfg(target_arch = "powerpc64le")]
|
||||
pub mod powerpc64le;
|
||||
#[cfg(target_arch = "powerpc64le")]
|
||||
pub use powerpc64le as arch_specific;
|
||||
|
||||
#[cfg(target_arch = "s390x")]
|
||||
pub mod s390x;
|
||||
#[cfg(target_arch = "s390x")]
|
||||
pub use s390x as arch_specific;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub mod x86_64;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub use x86_64 as arch_specific;
|
||||
|
||||
#[cfg(not(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "s390x",
|
||||
target_arch = "x86_64"
|
||||
)))]
|
||||
compile_error!("unknown architecture");
|
||||
|
||||
pub fn check() -> Result<()> {
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
let result = aarch64::check();
|
||||
|
||||
#[cfg(target_arch = "powerpc64le")]
|
||||
let result = powerpc64le::check();
|
||||
|
||||
#[cfg(target_arch = "s390x")]
|
||||
let result = s390x::check();
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
let result = x86_64::check();
|
||||
|
||||
#[cfg(not(any(
|
||||
target_arch = "aarch64",
|
||||
target_arch = "powerpc64le",
|
||||
target_arch = "s390x",
|
||||
target_arch = "x86_64"
|
||||
)))]
|
||||
compile_error!("unknown architecture");
|
||||
|
||||
result
|
||||
arch_specific::check()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user