[libvirt] [PATCH 2/3] qemu: Move TPM command line build code into own function
Martin Kletzander
mkletzan at redhat.com
Tue Feb 24 13:36:35 UTC 2015
On Mon, Feb 23, 2015 at 06:50:47AM -0500, Stefan Berger wrote:
>Move the TPM command line build code into its own function.
>
>Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>---
> src/qemu/qemu_command.c | 37 +++++++++++++++++++++++++------------
> 1 file changed, 25 insertions(+), 12 deletions(-)
>
ACK
>diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>index 7853125..539c956 100644
>--- a/src/qemu/qemu_command.c
>+++ b/src/qemu/qemu_command.c
>@@ -8148,6 +8148,30 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
> return ret;
> }
>
>+static int
>+qemuBuildTPMCommandLine(virDomainDefPtr def,
>+ virCommandPtr cmd,
>+ virQEMUCapsPtr qemuCaps,
>+ const char *emulator)
>+{
>+ char *optstr;
>+
>+ if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
>+ return -1;
>+
>+ virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
>+ VIR_FREE(optstr);
>+
>+ if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
>+ return -1;
>+
>+ virCommandAddArgList(cmd, "-device", optstr, NULL);
>+ VIR_FREE(optstr);
>+
>+ return 0;
>+}
>+
>+
> qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
> .qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
> };
>@@ -9579,19 +9603,8 @@ qemuBuildCommandLine(virConnectPtr conn,
> }
>
> if (def->tpm) {
>- char *optstr;
>-
>- if (!(optstr = qemuBuildTPMBackendStr(def, qemuCaps, emulator)))
>+ if (qemuBuildTPMCommandLine(def, cmd, qemuCaps, emulator) < 0)
> goto error;
>-
>- virCommandAddArgList(cmd, "-tpmdev", optstr, NULL);
>- VIR_FREE(optstr);
>-
>- if (!(optstr = qemuBuildTPMDevStr(def, qemuCaps, emulator)))
>- goto error;
>-
>- virCommandAddArgList(cmd, "-device", optstr, NULL);
>- VIR_FREE(optstr);
> }
>
> for (i = 0; i < def->ninputs; i++) {
>--
>1.9.3
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150224/7cc017e2/attachment-0001.sig>
More information about the libvir-list
mailing list