Name it virNumaMemAccess and add it to conf/numa_conf.[ch]
Note that to avoid a circular dependency the type of the NUMA cell
memAccess variable was changed to int. It will be turned back later
after the circular dependency will not exist.
---
src/conf/cpu_conf.c | 6 ------
src/conf/cpu_conf.h | 12 +-----------
src/conf/numa_conf.c | 11 ++++++++---
src/conf/numa_conf.h | 9 +++++++++
src/qemu/qemu_command.c | 10 +++++-----
5 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 28fbead..4923618 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -56,12 +56,6 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
"disable",
"forbid")
-VIR_ENUM_IMPL(virMemAccess, VIR_MEM_ACCESS_LAST,
- "default",
- "shared",
- "private")
-
-
void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def)
{
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index d6efba7..0163384 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -83,16 +83,6 @@ typedef enum {
VIR_ENUM_DECL(virCPUFeaturePolicy)
-typedef enum {
- VIR_MEM_ACCESS_DEFAULT,
- VIR_MEM_ACCESS_SHARED,
- VIR_MEM_ACCESS_PRIVATE,
-
- VIR_MEM_ACCESS_LAST,
-} virMemAccess;
-
-VIR_ENUM_DECL(virMemAccess)
-
typedef struct _virCPUFeatureDef virCPUFeatureDef;
typedef virCPUFeatureDef *virCPUFeatureDefPtr;
struct _virCPUFeatureDef {
@@ -105,7 +95,7 @@ typedef virCellDef *virCellDefPtr;
struct _virCellDef {
virBitmapPtr cpumask; /* CPUs that are part of this node */
unsigned long long mem; /* Node memory in kB */
- virMemAccess memAccess;
+ int memAccess; /* virNumaMemAccess */
};
typedef struct _virCPUDef virCPUDef;
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index bcb8023..eea4172 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -43,6 +43,11 @@ VIR_ENUM_IMPL(virDomainNumatunePlacement,
"static",
"auto");
+VIR_ENUM_IMPL(virNumaMemAccess, VIR_NUMA_MEM_ACCESS_LAST,
+ "default",
+ "shared",
+ "private");
+
typedef struct _virDomainNumaNode virDomainNumaNode;
typedef virDomainNumaNode *virDomainNumaNodePtr;
@@ -757,7 +762,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
goto cleanup;
if ((tmp = virXMLPropString(nodes[i], "memAccess"))) {
- if ((rc = virMemAccessTypeFromString(tmp)) <= 0) {
+ if ((rc = virNumaMemAccessTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid 'memAccess' attribute value
'%s'"),
tmp);
@@ -783,7 +788,7 @@ int
virDomainNumaDefCPUFormat(virBufferPtr buf,
virCPUDefPtr def)
{
- virMemAccess memAccess;
+ virNumaMemAccess memAccess;
char *cpustr;
size_t i;
@@ -805,7 +810,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
virBufferAddLit(buf, " unit='KiB'");
if (memAccess)
virBufferAsprintf(buf, " memAccess='%s'",
- virMemAccessTypeToString(memAccess));
+ virNumaMemAccessTypeToString(memAccess));
virBufferAddLit(buf, "/>\n");
VIR_FREE(cpustr);
}
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 0adeaa4..ca89e05 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -46,6 +46,15 @@ typedef enum {
VIR_ENUM_DECL(virDomainNumatunePlacement)
VIR_ENUM_DECL(virDomainNumatuneMemMode)
+typedef enum {
+ VIR_NUMA_MEM_ACCESS_DEFAULT,
+ VIR_NUMA_MEM_ACCESS_SHARED,
+ VIR_NUMA_MEM_ACCESS_PRIVATE,
+
+ VIR_NUMA_MEM_ACCESS_LAST
+} virNumaMemAccess;
+
+VIR_ENUM_DECL(virNumaMemAccess)
void virDomainNumaFree(virDomainNumaPtr numa);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c4ae596..b6fca9c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4558,7 +4558,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
virDomainHugePagePtr hugepage = NULL;
virDomainNumatuneMemMode mode;
const long system_page_size = virGetSystemPageSizeKB();
- virMemAccess memAccess = def->cpu->cells[guestNode].memAccess;
+ virNumaMemAccess memAccess = def->cpu->cells[guestNode].memAccess;
size_t i;
char *mem_path = NULL;
virBitmapPtr nodemask = NULL;
@@ -4651,18 +4651,18 @@ qemuBuildMemoryBackendStr(unsigned long long size,
goto cleanup;
switch (memAccess) {
- case VIR_MEM_ACCESS_SHARED:
+ case VIR_NUMA_MEM_ACCESS_SHARED:
if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0)
goto cleanup;
break;
- case VIR_MEM_ACCESS_PRIVATE:
+ case VIR_NUMA_MEM_ACCESS_PRIVATE:
if (virJSONValueObjectAdd(props, "b:share", false, NULL) < 0)
goto cleanup;
break;
- case VIR_MEM_ACCESS_DEFAULT:
- case VIR_MEM_ACCESS_LAST:
+ case VIR_NUMA_MEM_ACCESS_DEFAULT:
+ case VIR_NUMA_MEM_ACCESS_LAST:
break;
}
} else {
--
2.2.2