kata-ctl: arch: Improve check call
Rework the architecture-specific `check()` call by moving all the
conditional logic out of the function.
Fixes:
@@ -7,28 +7,23 @@ 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;
-
-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();
+pub use x86_64 as arch_specific;
#[cfg(not(any(
target_arch = "aarch64",
@@ -38,5 +33,6 @@ pub fn check() -> Result<()> {
)))]
compile_error!("unknown architecture");
- result
+pub fn check() -> Result<()> {
+ arch_specific::check()
}
