And make it use virQEMUCapsGetAccel once rather than repeating the same
code in all functions called from virQEMUCapsFormatAccel.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 3:
- new patch
src/qemu/qemu_capabilities.c | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d19bcebdeb..2bd0297364 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3905,12 +3905,11 @@ virQEMUCapsLoadCache(virArch hostArch,
static void
-virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
+virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccelPtr caps,
virBufferPtr buf,
- virDomainVirtType type)
+ const char *typeStr)
{
- qemuMonitorCPUModelInfoPtr model = virQEMUCapsGetCPUModelInfo(qemuCaps, type);
- const char *typeStr = type == VIR_DOMAIN_VIRT_KVM ? "kvm" :
"tcg";
+ qemuMonitorCPUModelInfoPtr model = caps->hostCPU.info;
size_t i;
if (!model)
@@ -3960,22 +3959,13 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
static void
-virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps,
+virQEMUCapsFormatCPUModels(virQEMUCapsAccelPtr caps,
virBufferPtr buf,
- virDomainVirtType type)
+ const char *typeStr)
{
- qemuMonitorCPUDefsPtr defs;
- const char *typeStr;
+ qemuMonitorCPUDefsPtr defs = caps->cpuModels;
size_t i;
- if (type == VIR_DOMAIN_VIRT_KVM) {
- typeStr = "kvm";
- defs = qemuCaps->kvm.cpuModels;
- } else {
- typeStr = "tcg";
- defs = qemuCaps->tcg.cpuModels;
- }
-
if (!defs)
return;
@@ -4013,8 +4003,11 @@ virQEMUCapsFormatAccel(virQEMUCapsPtr qemuCaps,
virBufferPtr buf,
virDomainVirtType type)
{
- virQEMUCapsFormatHostCPUModelInfo(qemuCaps, buf, type);
- virQEMUCapsFormatCPUModels(qemuCaps, buf, type);
+ virQEMUCapsAccelPtr caps = virQEMUCapsGetAccel(qemuCaps, type);
+ const char *typeStr = type == VIR_DOMAIN_VIRT_KVM ? "kvm" :
"tcg";
+
+ virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr);
+ virQEMUCapsFormatCPUModels(caps, buf, typeStr);
}
--
2.23.0