Rename to avoid duplicate code. Because virDomainMemoryAccess will be used
in memorybacking for setting default behaviour.
NOTE: The enum cannot be moved to qemu/domain_conf because of headers
dependency
---
src/conf/numa_conf.c | 15 ++++++++-------
src/conf/numa_conf.h | 14 +++++++-------
src/qemu/qemu_command.c | 10 +++++-----
src/qemu/qemu_process.c | 2 +-
4 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 9818d95..bfd3703 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -43,10 +43,11 @@ VIR_ENUM_IMPL(virDomainNumatunePlacement,
"static",
"auto");
-VIR_ENUM_IMPL(virNumaMemAccess, VIR_NUMA_MEM_ACCESS_LAST,
+VIR_ENUM_IMPL(virDomainMemoryAccess, VIR_DOMAIN_MEMORY_ACCESS_LAST,
"default",
"shared",
- "private");
+ "private")
+
typedef struct _virDomainNumaNode virDomainNumaNode;
typedef virDomainNumaNode *virDomainNumaNodePtr;
@@ -64,7 +65,7 @@ struct _virDomainNuma {
virBitmapPtr cpumask; /* bitmap of vCPUs corresponding to the node */
virBitmapPtr nodeset; /* host memory nodes where this guest node resides */
virDomainNumatuneMemMode mode; /* memory mode selection */
- virNumaMemAccess memAccess; /* shared memory access configuration */
+ virDomainMemoryAccess memAccess; /* shared memory access configuration */
} *mem_nodes; /* guest node configuration */
size_t nmem_nodes;
@@ -777,7 +778,7 @@ virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
goto cleanup;
if ((tmp = virXMLPropString(nodes[i], "memAccess"))) {
- if ((rc = virNumaMemAccessTypeFromString(tmp)) <= 0) {
+ if ((rc = virDomainMemoryAccessTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid 'memAccess' attribute value
'%s'"),
tmp);
@@ -803,7 +804,7 @@ int
virDomainNumaDefCPUFormat(virBufferPtr buf,
virDomainNumaPtr def)
{
- virNumaMemAccess memAccess;
+ virDomainMemoryAccess memAccess;
char *cpustr;
size_t ncells = virDomainNumaGetNodeCount(def);
size_t i;
@@ -827,7 +828,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
virBufferAddLit(buf, " unit='KiB'");
if (memAccess)
virBufferAsprintf(buf, " memAccess='%s'",
- virNumaMemAccessTypeToString(memAccess));
+ virDomainMemoryAccessTypeToString(memAccess));
virBufferAddLit(buf, "/>\n");
VIR_FREE(cpustr);
}
@@ -936,7 +937,7 @@ virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
}
-virNumaMemAccess
+virDomainMemoryAccess
virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
size_t node)
{
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 90deacb..05529ba 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -46,14 +46,14 @@ 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_DOMAIN_MEMORY_ACCESS_DEFAULT = 0, /* No memory access defined */
+ VIR_DOMAIN_MEMORY_ACCESS_SHARED, /* Memory access is set as shared */
+ VIR_DOMAIN_MEMORY_ACCESS_PRIVATE, /* Memory access is set as private */
- VIR_NUMA_MEM_ACCESS_LAST
-} virNumaMemAccess;
+ VIR_DOMAIN_MEMORY_ACCESS_LAST,
+} virDomainMemoryAccess;
+VIR_ENUM_DECL(virDomainMemoryAccess)
-VIR_ENUM_DECL(virNumaMemAccess)
virDomainNumaPtr virDomainNumaNew(void);
void virDomainNumaFree(virDomainNumaPtr numa);
@@ -90,7 +90,7 @@ size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa)
virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
size_t node)
ATTRIBUTE_NONNULL(1);
-virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
+virDomainMemoryAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
size_t node)
ATTRIBUTE_NONNULL(1);
unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f8e48d2..7d186d2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3233,7 +3233,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
virDomainHugePagePtr hugepage = NULL;
virDomainNumatuneMemMode mode;
const long system_page_size = virGetSystemPageSizeKB();
- virNumaMemAccess memAccess = VIR_NUMA_MEM_ACCESS_DEFAULT;
+ virDomainMemoryAccess memAccess = VIR_DOMAIN_MEMORY_ACCESS_DEFAULT;
size_t i;
char *mem_path = NULL;
virBitmapPtr nodemask = NULL;
@@ -3328,18 +3328,18 @@ qemuBuildMemoryBackendStr(unsigned long long size,
goto cleanup;
switch (memAccess) {
- case VIR_NUMA_MEM_ACCESS_SHARED:
+ case VIR_DOMAIN_MEMORY_ACCESS_SHARED:
if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0)
goto cleanup;
break;
- case VIR_NUMA_MEM_ACCESS_PRIVATE:
+ case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE:
if (virJSONValueObjectAdd(props, "b:share", false, NULL) < 0)
goto cleanup;
break;
- case VIR_NUMA_MEM_ACCESS_DEFAULT:
- case VIR_NUMA_MEM_ACCESS_LAST:
+ case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT:
+ case VIR_DOMAIN_MEMORY_ACCESS_LAST:
break;
}
} else {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e5b77d6..ab67773 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4488,7 +4488,7 @@ qemuProcessStartWarnShmem(virDomainObjPtr vm)
if (!shmem && vm->def->mem.nhugepages) {
for (i = 0; i < virDomainNumaGetNodeCount(vm->def->numa); i++) {
if (virDomainNumaGetNodeMemoryAccessMode(vm->def->numa, i) ==
- VIR_NUMA_MEM_ACCESS_SHARED) {
+ VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
shmem = true;
break;
}
--
2.7.4
--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263
This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.