vmm: simplify seccomp code

Only Thread::Vmm and Thread::Vcpu need to know the hypervisor type.
Make the type optional, and then simplify the users.

Assisted-by: Pi-agent:Claude-Opus-4.7
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2026-05-14 22:17:04 +00:00
parent 59b72c51c2
commit 73146be06b
8 changed files with 19 additions and 39 deletions

View File

@@ -9,7 +9,6 @@ use std::thread;
use futures::channel::oneshot;
use futures::{FutureExt, executor};
use hypervisor::HypervisorType;
use log::{error, warn};
use seccompiler::{SeccompAction, apply_filter};
use vmm_sys_util::eventfd::EventFd;
@@ -326,7 +325,6 @@ pub fn start_dbus_thread(
api_sender: Sender<ApiRequest>,
seccomp_action: &SeccompAction,
exit_evt: EventFd,
hypervisor_type: HypervisorType,
) -> VmmResult<(thread::JoinHandle<VmmResult<()>>, DBusApiShutdownChannels)> {
let dbus_iface = DBusApi::new(api_notifier, api_sender);
let (connection, iface_ref) = executor::block_on(async move {
@@ -356,7 +354,7 @@ pub fn start_dbus_thread(
let (send_done, recv_done) = oneshot::channel::<()>();
// Retrieve seccomp filter for API thread
let api_seccomp_filter = get_seccomp_filter(seccomp_action, Thread::DBusApi, hypervisor_type)
let api_seccomp_filter = get_seccomp_filter(seccomp_action, Thread::DBusApi, None)
.map_err(VmmError::CreateSeccompFilter)?;
let thread_join_handle = thread::Builder::new()