This will be used to load the host recommended CPU model, introduced in
a subsequent patch. Also move ctxt auto restore to end of variable
declarations to avoid a compiler warning.
Signed-off-by: Collin Walling <walling(a)linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
src/qemu/qemu_capabilities.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4ace8eea4a..40cdcffbfe 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3894,19 +3894,18 @@ virQEMUCapsSetCPUModelInfo(virQEMUCaps *qemuCaps,
static int
-virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
- xmlXPathContextPtr ctxt,
- const char *typeStr)
+virQEMUCapsLoadCPUModelInfo(qemuMonitorCPUModelInfo **modelInfo,
+ xmlXPathContextPtr ctxt,
+ char *xpath)
{
xmlNodePtr hostCPUNode;
g_autofree xmlNodePtr *nodes = NULL;
- VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autoptr(qemuMonitorCPUModelInfo) hostCPU = NULL;
- g_autofree char *xpath = g_strdup_printf("./hostCPU[@type='%s']",
typeStr);
size_t i;
int n;
virTristateBool migratability;
int val;
+ VIR_XPATH_NODE_AUTORESTORE(ctxt)
if (!(hostCPUNode = virXPathNode(xpath, ctxt))) {
return 0;
@@ -3991,11 +3990,22 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
}
}
- caps->hostCPU.info = g_steal_pointer(&hostCPU);
+ *modelInfo = g_steal_pointer(&hostCPU);
return 0;
}
+static int
+virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
+ xmlXPathContextPtr ctxt,
+ const char *typeStr)
+{
+ g_autofree char *xpath = g_strdup_printf("./hostCPU[@type='%s']",
typeStr);
+
+ return virQEMUCapsLoadCPUModelInfo(&caps->hostCPU.info, ctxt, xpath);
+}
+
+
static int
virQEMUCapsLoadCPUModels(virArch arch,
virQEMUCapsAccel *caps,
--
2.41.0