The virCapsHostNUMACellSiblingInfo structure really represents
distance to other NUMA node. Rename the structure and variables
of that type to make it more obvious.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/capabilities.c | 52 +++++++++++++++++-----------------
src/conf/capabilities.h | 10 +++----
src/conf/virconftypes.h | 2 +-
src/libxl/libxl_capabilities.c | 20 ++++++-------
4 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 7fe282ad3a..926ecb5a24 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -119,7 +119,7 @@ virCapabilitiesFreeHostNUMACell(virCapsHostNUMACell *cell)
virCapabilitiesClearHostNUMACellCPUTopology(cell->cpus, cell->ncpus);
g_free(cell->cpus);
- g_free(cell->siblings);
+ g_free(cell->distances);
g_free(cell->pageinfo);
g_free(cell);
}
@@ -331,8 +331,8 @@ virCapabilitiesSetNetPrefix(virCaps *caps,
* @mem: Total size of memory in the NUMA node (in KiB)
* @ncpus: number of CPUs in cell
* @cpus: array of CPU definition structures
- * @nsiblings: number of sibling NUMA nodes
- * @siblings: info on sibling NUMA nodes
+ * @ndistances: number of sibling NUMA nodes
+ * @distances: NUMA distances to other nodes
* @npageinfo: number of pages at node @num
* @pageinfo: info on each single memory page
*
@@ -348,8 +348,8 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
unsigned long long mem,
int ncpus,
virCapsHostNUMACellCPU **cpus,
- int nsiblings,
- virCapsHostNUMACellSiblingInfo **siblings,
+ int ndistances,
+ virCapsHostNUMACellDistance **distances,
int npageinfo,
virCapsHostNUMACellPageInfo **pageinfo)
{
@@ -361,9 +361,9 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
cell->ncpus = ncpus;
cell->cpus = g_steal_pointer(cpus);
}
- if (siblings) {
- cell->nsiblings = nsiblings;
- cell->siblings = g_steal_pointer(siblings);
+ if (distances) {
+ cell->ndistances = ndistances;
+ cell->distances = g_steal_pointer(distances);
}
if (pageinfo) {
cell->npageinfo = npageinfo;
@@ -833,13 +833,13 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf,
cell->pageinfo[j].avail);
}
- if (cell->nsiblings) {
+ if (cell->ndistances) {
virBufferAddLit(buf, "<distances>\n");
virBufferAdjustIndent(buf, 2);
- for (j = 0; j < cell->nsiblings; j++) {
+ for (j = 0; j < cell->ndistances; j++) {
virBufferAsprintf(buf, "<sibling id='%d'
value='%d'/>\n",
- cell->siblings[j].node,
- cell->siblings[j].distance);
+ cell->distances[j].node,
+ cell->distances[j].distance);
}
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</distances>\n");
@@ -1456,11 +1456,11 @@ virCapabilitiesFillCPUInfo(int cpu_id G_GNUC_UNUSED,
}
static int
-virCapabilitiesGetNUMASiblingInfo(int node,
- virCapsHostNUMACellSiblingInfo **siblings,
- int *nsiblings)
+virCapabilitiesGetNUMADistances(int node,
+ virCapsHostNUMACellDistance **distancesRet,
+ int *ndistancesRet)
{
- virCapsHostNUMACellSiblingInfo *tmp = NULL;
+ virCapsHostNUMACellDistance *tmp = NULL;
int tmp_size = 0;
int ret = -1;
int *distances = NULL;
@@ -1471,12 +1471,12 @@ virCapabilitiesGetNUMASiblingInfo(int node,
goto cleanup;
if (!distances) {
- *siblings = NULL;
- *nsiblings = 0;
+ *distancesRet = NULL;
+ *ndistancesRet = 0;
return 0;
}
- tmp = g_new0(virCapsHostNUMACellSiblingInfo, ndistances);
+ tmp = g_new0(virCapsHostNUMACellDistance, ndistances);
for (i = 0; i < ndistances; i++) {
if (!distances[i])
@@ -1489,8 +1489,8 @@ virCapabilitiesGetNUMASiblingInfo(int node,
VIR_REALLOC_N(tmp, tmp_size);
- *nsiblings = tmp_size;
- *siblings = g_steal_pointer(&tmp);
+ *ndistancesRet = tmp_size;
+ *distancesRet = g_steal_pointer(&tmp);
tmp_size = 0;
ret = 0;
cleanup:
@@ -1607,8 +1607,8 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
for (n = 0; n <= max_node; n++) {
g_autoptr(virBitmap) cpumap = NULL;
- g_autofree virCapsHostNUMACellSiblingInfo *siblings = NULL;
- int nsiblings = 0;
+ g_autofree virCapsHostNUMACellDistance *distances = NULL;
+ int ndistances = 0;
g_autofree virCapsHostNUMACellPageInfo *pageinfo = NULL;
int npageinfo;
unsigned long long memory;
@@ -1632,8 +1632,8 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
}
}
- if (virCapabilitiesGetNUMASiblingInfo(n, &siblings, &nsiblings) < 0)
- goto cleanup;
+ if (virCapabilitiesGetNUMADistances(n, &distances, &ndistances) < 0)
+ return -1;
if (virCapabilitiesGetNUMAPagesInfo(n, &pageinfo, &npageinfo) < 0)
goto cleanup;
@@ -1644,7 +1644,7 @@ virCapabilitiesHostNUMAInitReal(virCapsHostNUMA *caps)
virCapabilitiesHostNUMAAddCell(caps, n, memory,
ncpus, &cpus,
- nsiblings, &siblings,
+ ndistances, &distances,
npageinfo, &pageinfo);
}
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index ba863447c0..f11471ef6c 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -94,7 +94,7 @@ struct _virCapsHostNUMACellCPU {
virBitmap *siblings;
};
-struct _virCapsHostNUMACellSiblingInfo {
+struct _virCapsHostNUMACellDistance {
int node; /* foreign NUMA node */
unsigned int distance; /* distance to the node */
};
@@ -109,8 +109,8 @@ struct _virCapsHostNUMACell {
int ncpus;
unsigned long long mem; /* in kibibytes */
virCapsHostNUMACellCPU *cpus;
- int nsiblings;
- virCapsHostNUMACellSiblingInfo *siblings;
+ int ndistances;
+ virCapsHostNUMACellDistance *distances;
int npageinfo;
virCapsHostNUMACellPageInfo *pageinfo;
};
@@ -255,8 +255,8 @@ virCapabilitiesHostNUMAAddCell(virCapsHostNUMA *caps,
unsigned long long mem,
int ncpus,
virCapsHostNUMACellCPU **cpus,
- int nsiblings,
- virCapsHostNUMACellSiblingInfo **siblings,
+ int ndistances,
+ virCapsHostNUMACellDistance **distances,
int npageinfo,
virCapsHostNUMACellPageInfo **pageinfo);
diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h
index ff5d8145c3..d21d5a1be3 100644
--- a/src/conf/virconftypes.h
+++ b/src/conf/virconftypes.h
@@ -60,7 +60,7 @@ typedef struct _virCapsHostNUMACellCPU virCapsHostNUMACellCPU;
typedef struct _virCapsHostNUMACellPageInfo virCapsHostNUMACellPageInfo;
-typedef struct _virCapsHostNUMACellSiblingInfo virCapsHostNUMACellSiblingInfo;
+typedef struct _virCapsHostNUMACellDistance virCapsHostNUMACellDistance;
typedef struct _virCapsHostSecModel virCapsHostSecModel;
diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index ea4f370a6d..d1a1241279 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -247,9 +247,9 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCaps *caps)
{
libxl_numainfo *numa_info = NULL;
libxl_cputopology *cpu_topo = NULL;
- int nr_nodes = 0, nr_cpus = 0, nr_siblings = 0;
+ int nr_nodes = 0, nr_cpus = 0, nr_distances = 0;
virCapsHostNUMACellCPU **cpus = NULL;
- virCapsHostNUMACellSiblingInfo *siblings = NULL;
+ virCapsHostNUMACellDistance *distances = NULL;
int *nr_cpus_node = NULL;
size_t i;
int ret = -1;
@@ -316,22 +316,22 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCaps *caps)
if (numa_info[i].size == LIBXL_NUMAINFO_INVALID_ENTRY)
continue;
- nr_siblings = numa_info[i].num_dists;
- if (nr_siblings) {
+ nr_distances = numa_info[i].num_dists;
+ if (nr_distances) {
size_t j;
- siblings = g_new0(virCapsHostNUMACellSiblingInfo, nr_siblings);
+ distances = g_new0(virCapsHostNUMACellDistance, nr_distances);
- for (j = 0; j < nr_siblings; j++) {
- siblings[j].node = j;
- siblings[j].distance = numa_info[i].dists[j];
+ for (j = 0; j < nr_distances; j++) {
+ distances[j].node = j;
+ distances[j].distance = numa_info[i].dists[j];
}
}
virCapabilitiesHostNUMAAddCell(caps->host.numa, i,
numa_info[i].size / 1024,
nr_cpus_node[i], &cpus[i],
- nr_siblings, &siblings,
+ nr_distances, &distances,
0, NULL);
/* This is safe, as the CPU list is now stored in the NUMA cell */
@@ -348,7 +348,7 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCaps *caps)
virCapabilitiesHostNUMAUnref(caps->host.numa);
caps->host.numa = NULL;
}
- VIR_FREE(siblings);
+ VIR_FREE(distances);
}
VIR_FREE(cpus);
--
2.26.3