mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
qemu: Split virQEMUCapsFetchCPUModels
Most of the code moved to a new virQEMUCapsFetchCPUDefinitions function and the existing virQEMUCapsFetchCPUModels just becomes a small wrapper around virQEMUCapsFetchCPUDefinitions and virQEMUCapsCPUDefsToModels. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
76baa994b7
commit
857b88f5c3
@ -2470,15 +2470,15 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virQEMUCapsFetchCPUModels(qemuMonitorPtr mon,
|
||||
virArch arch,
|
||||
virDomainCapsCPUModelsPtr *cpuModels)
|
||||
static int
|
||||
virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon,
|
||||
virArch arch,
|
||||
qemuMonitorCPUDefsPtr *cpuDefs)
|
||||
{
|
||||
g_autoptr(qemuMonitorCPUDefs) defs = NULL;
|
||||
size_t i;
|
||||
|
||||
*cpuModels = NULL;
|
||||
*cpuDefs = NULL;
|
||||
|
||||
if (qemuMonitorGetCPUDefinitions(mon, &defs) < 0)
|
||||
return -1;
|
||||
@ -2506,7 +2506,24 @@ virQEMUCapsFetchCPUModels(qemuMonitorPtr mon,
|
||||
}
|
||||
}
|
||||
|
||||
if (!(*cpuModels = virQEMUCapsCPUDefsToModels(defs, NULL, NULL)))
|
||||
*cpuDefs = g_steal_pointer(&defs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
virQEMUCapsFetchCPUModels(qemuMonitorPtr mon,
|
||||
virArch arch,
|
||||
virDomainCapsCPUModelsPtr *cpuModels)
|
||||
{
|
||||
g_autoptr(qemuMonitorCPUDefs) defs = NULL;
|
||||
|
||||
*cpuModels = NULL;
|
||||
|
||||
if (virQEMUCapsFetchCPUDefinitions(mon, arch, &defs) < 0)
|
||||
return -1;
|
||||
|
||||
if (defs && !(*cpuModels = virQEMUCapsCPUDefsToModels(defs, NULL, NULL)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user