It was very similar to virQEMUCapsGetAccel. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- Notes: Version 3: - new patch src/qemu/qemu_capabilities.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e4188f7833..62667cb882 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1952,24 +1952,14 @@ virQEMUCapsGetCPUModels(virQEMUCapsPtr qemuCaps, } -static virQEMUCapsHostCPUDataPtr -virQEMUCapsGetHostCPUData(virQEMUCapsPtr qemuCaps, - virDomainVirtType type) -{ - if (type == VIR_DOMAIN_VIRT_KVM) - return &qemuCaps->kvm.hostCPU; - else - return &qemuCaps->tcg.hostCPU; -} - - virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, virDomainVirtType type, virQEMUCapsHostCPUType cpuType) { - virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); + virQEMUCapsHostCPUDataPtr cpuData; + cpuData = &virQEMUCapsGetAccel(qemuCaps, type)->hostCPU; switch (cpuType) { case VIR_QEMU_CAPS_HOST_CPU_REPORTED: return cpuData->reported; @@ -1994,8 +1984,9 @@ virQEMUCapsSetHostModel(virQEMUCapsPtr qemuCaps, virCPUDefPtr migratable, virCPUDefPtr full) { - virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); + virQEMUCapsHostCPUDataPtr cpuData; + cpuData = &virQEMUCapsGetAccel(qemuCaps, type)->hostCPU; cpuData->reported = reported; cpuData->migratable = migratable; cpuData->full = full; @@ -3333,9 +3324,7 @@ qemuMonitorCPUModelInfoPtr virQEMUCapsGetCPUModelInfo(virQEMUCapsPtr qemuCaps, virDomainVirtType type) { - virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); - - return cpuData->info; + return virQEMUCapsGetAccel(qemuCaps, type)->hostCPU.info; } @@ -3344,9 +3333,7 @@ virQEMUCapsSetCPUModelInfo(virQEMUCapsPtr qemuCaps, virDomainVirtType type, qemuMonitorCPUModelInfoPtr modelInfo) { - virQEMUCapsHostCPUDataPtr cpuData = virQEMUCapsGetHostCPUData(qemuCaps, type); - - cpuData->info = modelInfo; + virQEMUCapsGetAccel(qemuCaps, type)->hostCPU.info = modelInfo; } -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list