From: John Ferlan Date: Mon, 15 Feb 2016 14:32:23 +0000 (-0500) Subject: qemu: Move qemuBuildTPMDevStr X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5df342d3348ce0e455085ab84c2822862603565b;p=libvirt.git qemu: Move qemuBuildTPMDevStr Move function closer to where it's used in qemuBuildTPMCommandLine Also fix function header to match current coding practices Signed-off-by: John Ferlan --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 72b6d15852..1bffa97cc5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6833,36 +6833,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; @@ -8909,6 +8879,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