mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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 <jferlan@redhat.com>
This commit is contained in:
parent
6d9dcc04d6
commit
5df342d334
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user