[libvirt] [PATCH 03/12] qemu-command: Move qemuBuildTPMDevStr

John Ferlan jferlan at redhat.com
Mon Feb 15 19:37:17 UTC 2016


Move function closer to where it's used in qemuBuildTPMCommandLine

Also fix function header to match current coding practices

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_command.c | 61 +++++++++++++++++++++++++------------------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index db2ad05..c8dda55 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6832,36 +6832,6 @@ qemuBuildRNGDevStr(virDomainDefPtr def,
 }
 
 
-static char *qemuBuildTPMDevStr(const virDomainDef *def,
-                                virQEMUCapsPtr qemuCaps,
-                                const char *emulator)
-{
-    virBuffer buf = VIR_BUFFER_INITIALIZER;
-    const virDomainTPMDef *tpm = def->tpm;
-    const char *model = virDomainTPMModelTypeToString(tpm->model);
-
-    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("The QEMU executable %s does not support TPM "
-                       "model %s"),
-                       emulator, model);
-        goto error;
-    }
-
-    virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s",
-                      model, tpm->info.alias, tpm->info.alias);
-
-    if (virBufferCheckError(&buf) < 0)
-        goto error;
-
-    return virBufferContentAndReset(&buf);
-
- error:
-    virBufferFreeAndReset(&buf);
-    return NULL;
-}
-
-
 static char *qemuBuildSmbiosBiosStr(virSysinfoBIOSDefPtr def)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -8907,6 +8877,37 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
 }
 
 
+static char *
+qemuBuildTPMDevStr(const virDomainDef *def,
+                   virQEMUCapsPtr qemuCaps,
+                   const char *emulator)
+{
+    virBuffer buf = VIR_BUFFER_INITIALIZER;
+    const virDomainTPMDef *tpm = def->tpm;
+    const char *model = virDomainTPMModelTypeToString(tpm->model);
+
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("The QEMU executable %s does not support TPM "
+                       "model %s"),
+                       emulator, model);
+        goto error;
+    }
+
+    virBufferAsprintf(&buf, "%s,tpmdev=tpm-%s,id=%s",
+                      model, tpm->info.alias, tpm->info.alias);
+
+    if (virBufferCheckError(&buf) < 0)
+        goto error;
+
+    return virBufferContentAndReset(&buf);
+
+ error:
+    virBufferFreeAndReset(&buf);
+    return NULL;
+}
+
+
 /**
  * qemuVirCommandGetFDSet:
  * @cmd: the command to modify
-- 
2.5.0




More information about the libvir-list mailing list