From b83543c563157f42955dce692d135f19d2ca5972 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 16 Feb 2015 17:19:15 +0100 Subject: [PATCH] conf: numa: Don't pass double pointer to virDomainNumatuneParseXML virDomainNumatuneParseXML now doesn't allocate the def->numa object any longer so we don't need to pass a double pointer. --- src/conf/domain_conf.c | 2 +- src/conf/numa_conf.c | 23 +++++++++++------------ src/conf/numa_conf.h | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e9c6a825b8..e3235bf9a2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13528,7 +13528,7 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } - if (virDomainNumatuneParseXML(&def->numa, + if (virDomainNumatuneParseXML(def->numa, def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC, def->cpu ? def->cpu->ncells : 0, diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index a674864b8b..7ee2b3e694 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -82,7 +82,7 @@ virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune, } static int -virDomainNumatuneNodeParseXML(virDomainNumaPtr *numatunePtr, +virDomainNumatuneNodeParseXML(virDomainNumaPtr numa, size_t ncells, xmlXPathContextPtr ctxt) { @@ -90,7 +90,6 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr *numatunePtr, int n = 0; int ret = -1; size_t i = 0; - virDomainNumaPtr numatune = *numatunePtr; xmlNodePtr *nodes = NULL; if ((n = virXPathNodeSet("./numatune/memnode", ctxt, &nodes)) < 0) { @@ -102,8 +101,8 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr *numatunePtr, if (!n) return 0; - if (numatune && numatune->memory.specified && - numatune->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) { + if (numa->memory.specified && + numa->memory.placement == VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Per-node binding is not compatible with " "automatic NUMA placement.")); @@ -117,11 +116,11 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr *numatunePtr, goto cleanup; } - VIR_FREE(numatune->mem_nodes); - if (VIR_ALLOC_N(numatune->mem_nodes, ncells) < 0) + VIR_FREE(numa->mem_nodes); + if (VIR_ALLOC_N(numa->mem_nodes, ncells) < 0) goto cleanup; - numatune->nmem_nodes = ncells; + numa->nmem_nodes = ncells; for (i = 0; i < n; i++) { int mode = 0; @@ -144,14 +143,14 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr *numatunePtr, } VIR_FREE(tmp); - if (cellid >= numatune->nmem_nodes) { + if (cellid >= numa->nmem_nodes) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Argument 'cellid' in memnode element must " "correspond to existing guest's NUMA cell")); goto cleanup; } - mem_node = &numatune->mem_nodes[cellid]; + mem_node = &numa->mem_nodes[cellid]; if (mem_node->nodeset) { virReportError(VIR_ERR_XML_ERROR, @@ -194,7 +193,7 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr *numatunePtr, } int -virDomainNumatuneParseXML(virDomainNumaPtr *numatunePtr, +virDomainNumatuneParseXML(virDomainNumaPtr numa, bool placement_static, size_t ncells, xmlXPathContextPtr ctxt) @@ -245,14 +244,14 @@ virDomainNumatuneParseXML(virDomainNumaPtr *numatunePtr, VIR_FREE(tmp); } - if (virDomainNumatuneSet(*numatunePtr, + if (virDomainNumatuneSet(numa, placement_static, placement, mode, nodeset) < 0) goto cleanup; - if (virDomainNumatuneNodeParseXML(numatunePtr, ncells, ctxt) < 0) + if (virDomainNumatuneNodeParseXML(numa, ncells, ctxt) < 0) goto cleanup; ret = 0; diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index 9bcacb0b55..5fa1b9a9b4 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -62,7 +62,7 @@ void virDomainNumaFree(virDomainNumaPtr numa); /* * XML Parse/Format functions */ -int virDomainNumatuneParseXML(virDomainNumaPtr *numatunePtr, +int virDomainNumatuneParseXML(virDomainNumaPtr numa, bool placement_static, size_t ncells, xmlXPathContextPtr ctxt) -- GitLab