提交 bb612309 编写于 作者: P Peter Krempa

qemu: capabilities: Extract code from virQEMUCapsStripMachineAliases

Separate out the internals as they will become more complex soon.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 0b9d1a80
...@@ -6020,6 +6020,21 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps, ...@@ -6020,6 +6020,21 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
} }
static void
virQEMUCapsStripMachineAliasesForVirtType(virQEMUCapsPtr qemuCaps,
virDomainVirtType virtType)
{
virQEMUCapsAccelPtr accel = virQEMUCapsGetAccel(qemuCaps, virtType);
size_t i;
for (i = 0; i < accel->nmachineTypes; i++) {
virQEMUCapsMachineTypePtr mach = &accel->machineTypes[i];
VIR_FREE(mach->alias);
}
}
/** /**
* virQEMUCapsStripMachineAliases: * virQEMUCapsStripMachineAliases:
* @qemuCaps: capabilities object to process * @qemuCaps: capabilities object to process
...@@ -6030,11 +6045,6 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps, ...@@ -6030,11 +6045,6 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps,
void void
virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps) virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps)
{ {
size_t i; virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsStripMachineAliasesForVirtType(qemuCaps, VIR_DOMAIN_VIRT_QEMU);
for (i = 0; i < qemuCaps->kvm.nmachineTypes; i++)
VIR_FREE(qemuCaps->kvm.machineTypes[i].alias);
for (i = 0; i < qemuCaps->tcg.nmachineTypes; i++)
VIR_FREE(qemuCaps->tcg.machineTypes[i].alias);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册