summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2015-02-11 15:40:27 +0100
committerPeter Krempa <pkrempa@redhat.com>2015-02-20 17:43:04 +0100
commita3673b225dc4a3c597a6784e67723511d2c977c2 (patch)
treebb379f7f99d869100b7ccbeb73414041849165c6
parent6bc80fa86d2cfd8cccfb5f246e172d84956da961 (diff)
downloadlibvirt-a3673b225dc4a3c597a6784e67723511d2c977c2.tar.gz
conf: Move enum virMemAccess to the NUMA code and rename it
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.
-rw-r--r--src/conf/cpu_conf.c6
-rw-r--r--src/conf/cpu_conf.h12
-rw-r--r--src/conf/numa_conf.c11
-rw-r--r--src/conf/numa_conf.h9
-rw-r--r--src/qemu/qemu_command.c10
5 files changed, 23 insertions, 25 deletions
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 28fbeade6a..49236186e6 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 d6efba71f7..01633840f9 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 75418ae777..dfd260637d 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 ec7760f071..107c83f5c4 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 14427f35d1..b6ef66d3b9 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 {