From a48d7c281e4588acd8f7eb46da7488e2ca5a3246 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 13 Dec 2022 13:57:13 +0000 Subject: [PATCH] vmm: seccomp: Remove unreachable patterns Make HypervisorType enum's members conditional on build time features. Signed-off-by: Rob Bradford --- hypervisor/src/lib.rs | 2 ++ vmm/src/seccomp_filters.rs | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hypervisor/src/lib.rs b/hypervisor/src/lib.rs index 7b663701f..a485bf0c3 100644 --- a/hypervisor/src/lib.rs +++ b/hypervisor/src/lib.rs @@ -61,7 +61,9 @@ pub use vm::{ #[derive(Debug, Copy, Clone)] pub enum HypervisorType { + #[cfg(feature = "kvm")] Kvm, + #[cfg(feature = "mshv")] Mshv, } diff --git a/vmm/src/seccomp_filters.rs b/vmm/src/seccomp_filters.rs index b18e3c48c..6fa858998 100644 --- a/vmm/src/seccomp_filters.rs +++ b/vmm/src/seccomp_filters.rs @@ -241,8 +241,6 @@ fn create_vmm_ioctl_seccomp_rule_hypervisor( HypervisorType::Kvm => create_vmm_ioctl_seccomp_rule_common_kvm(), #[cfg(feature = "mshv")] HypervisorType::Mshv => create_vmm_ioctl_seccomp_rule_common_mshv(), - #[allow(unreachable_patterns)] - _ => panic!("Invalid hypervisor {:?}", hypervisor_type), } } @@ -418,8 +416,6 @@ fn create_vmm_ioctl_seccomp_rule( HypervisorType::Kvm => create_vmm_ioctl_seccomp_rule_kvm(), #[cfg(feature = "mshv")] HypervisorType::Mshv => create_vmm_ioctl_seccomp_rule_mshv(), - #[allow(unreachable_patterns)] - _ => panic!("Invalid hypervisor {:?}", hypervisor_type), } } @@ -653,8 +649,6 @@ fn create_vcpu_ioctl_seccomp_rule_hypervisor( HypervisorType::Kvm => create_vcpu_ioctl_seccomp_rule_kvm(), #[cfg(feature = "mshv")] HypervisorType::Mshv => create_vcpu_ioctl_seccomp_rule_mshv(), - #[allow(unreachable_patterns)] - _ => panic!("Invalid hypervisor {:?}", hypervisor_type), } }