[PATCH] qemu_security: Drop qemuSecurityStartVhostUserGPU()

Michal Privoznik mprivozn at redhat.com
Mon May 9 14:12:53 UTC 2022


There's no real difference between
qemuSecurityStartVhostUserGPU() and qemuSecurityCommandRun(). The
latter is used more frequently while the former has just one
user. Therefore, drop the less frequently used one.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_security.c       | 40 ----------------------------------
 src/qemu/qemu_security.h       |  6 -----
 src/qemu/qemu_vhost_user_gpu.c |  3 +--
 3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c
index 19d957dd4b..3be1766764 100644
--- a/src/qemu/qemu_security.c
+++ b/src/qemu/qemu_security.c
@@ -499,46 +499,6 @@ qemuSecurityRestoreNetdevLabel(virQEMUDriver *driver,
 }
 
 
-/*
- * qemuSecurityStartVhostUserGPU:
- *
- * @driver: the QEMU driver
- * @vm: the domain object
- * @cmd: the command to run
- * @existstatus: pointer to int returning exit status of process
- * @cmdret: pointer to int returning result of virCommandRun
- *
- * Start the vhost-user-gpu process with appropriate labels.
- * This function returns -1 on security setup error, 0 if all the
- * setup was done properly. In case the virCommand failed to run
- * 0 is returned but cmdret is set appropriately with the process
- * exitstatus also set.
- */
-int
-qemuSecurityStartVhostUserGPU(virQEMUDriver *driver,
-                              virDomainObj *vm,
-                              virCommand *cmd,
-                              int *exitstatus,
-                              int *cmdret)
-{
-    if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
-                                               vm->def, cmd) < 0)
-        return -1;
-
-    if (virSecurityManagerPreFork(driver->securityManager) < 0)
-        return -1;
-
-    *cmdret = virCommandRun(cmd, exitstatus);
-
-    virSecurityManagerPostFork(driver->securityManager);
-
-    if (*cmdret < 0)
-        return -1;
-
-    return 0;
-}
-
-
 /*
  * qemuSecurityStartTPMEmulator:
  *
diff --git a/src/qemu/qemu_security.h b/src/qemu/qemu_security.h
index 8b26ea3f99..eaf646f225 100644
--- a/src/qemu/qemu_security.h
+++ b/src/qemu/qemu_security.h
@@ -87,12 +87,6 @@ int qemuSecurityRestoreNetdevLabel(virQEMUDriver *driver,
                                    virDomainObj *vm,
                                    virDomainNetDef *net);
 
-int qemuSecurityStartVhostUserGPU(virQEMUDriver *driver,
-                                  virDomainObj *vm,
-                                  virCommand *cmd,
-                                  int *exitstatus,
-                                  int *cmdret);
-
 int qemuSecurityStartTPMEmulator(virQEMUDriver *driver,
                                  virDomainObj *vm,
                                  virCommand *cmd,
diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
index f7d444e851..6f601cebde 100644
--- a/src/qemu/qemu_vhost_user_gpu.c
+++ b/src/qemu/qemu_vhost_user_gpu.c
@@ -158,8 +158,7 @@ int qemuExtVhostUserGPUStart(virQEMUDriver *driver,
             virCommandAddArgFormat(cmd, "--render-node=%s", video->accel->rendernode);
     }
 
-    if (qemuSecurityStartVhostUserGPU(driver, vm, cmd,
-                                      &exitstatus, &cmdret) < 0)
+    if (qemuSecurityCommandRun(driver, vm, cmd, -1, -1, &exitstatus, &cmdret) < 0)
         goto error;
 
     if (cmdret < 0 || exitstatus != 0) {
-- 
2.35.1



More information about the libvir-list mailing list