[PATCH 15/25] qemu: Modify qemuBuildTPMCommandLine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modify the argument order and types to match other similar helpers.

Also modify called functions to use the def->emulator instead of passing
def->emulator and def.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 71eeef0..d106f61 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7894,8 +7894,7 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
 
 static char *
 qemuBuildTPMDevStr(const virDomainDef *def,
-                   virQEMUCapsPtr qemuCaps,
-                   const char *emulator)
+                   virQEMUCapsPtr qemuCaps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const virDomainTPMDef *tpm = def->tpm;
@@ -7905,7 +7904,7 @@ qemuBuildTPMDevStr(const virDomainDef *def,
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("The QEMU executable %s does not support TPM "
                        "model %s"),
-                       emulator, model);
+                       def->emulator, model);
         goto error;
     }
 
@@ -7980,7 +7979,6 @@ static char *
 qemuBuildTPMBackendStr(const virDomainDef *def,
                        virCommandPtr cmd,
                        virQEMUCapsPtr qemuCaps,
-                       const char *emulator,
                        int *tpmfd,
                        int *cancelfd)
 {
@@ -8056,7 +8054,7 @@ qemuBuildTPMBackendStr(const virDomainDef *def,
     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                    _("The QEMU executable %s does not support TPM "
                      "backend type %s"),
-                   emulator, type);
+                   def->emulator, type);
 
  error:
     VIR_FREE(devset);
@@ -8068,17 +8066,19 @@ qemuBuildTPMBackendStr(const virDomainDef *def,
 
 
 static int
-qemuBuildTPMCommandLine(virDomainDefPtr def,
-                        virCommandPtr cmd,
-                        virQEMUCapsPtr qemuCaps,
-                        const char *emulator)
+qemuBuildTPMCommandLine(virCommandPtr cmd,
+                        const virDomainDef *def,
+                        virQEMUCapsPtr qemuCaps)
 {
     char *optstr;
     int tpmfd = -1;
     int cancelfd = -1;
     char *fdset;
 
-    if (!(optstr = qemuBuildTPMBackendStr(def, cmd, qemuCaps, emulator,
+    if (!def->tpm)
+        return 0;
+
+    if (!(optstr = qemuBuildTPMBackendStr(def, cmd, qemuCaps,
                                           &tpmfd, &cancelfd)))
         return -1;
 
@@ -8103,7 +8103,7 @@ qemuBuildTPMCommandLine(virDomainDefPtr def,
         VIR_FREE(fdset);
     }
 
-    if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
+    if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps)))
         return -1;
 
     virCommandAddArgList(cmd, "-device", optstr, NULL);
@@ -8384,10 +8384,8 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (qemuBuildConsoleCommandLine(cmd, def, qemuCaps) < 0)
         goto error;
 
-    if (def->tpm) {
-        if (qemuBuildTPMCommandLine(def, cmd, qemuCaps, def->emulator) < 0)
-            goto error;
-    }
+    if (qemuBuildTPMCommandLine(cmd, def, qemuCaps) < 0)
+        goto error;
 
     for (i = 0; i < def->ninputs; i++) {
         virDomainInputDefPtr input = def->inputs[i];
-- 
2.5.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]