As advertised earlier, now that the _virDomainMemoryDef struct is cleaned up, we can shorten some names as their placement within unions define their use. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_conf.c | 62 ++++++++++++++++---------------- src/conf/domain_conf.h | 12 +++---- src/conf/domain_validate.c | 4 +-- src/qemu/qemu_cgroup.c | 8 ++--- src/qemu/qemu_command.c | 18 +++++----- src/qemu/qemu_hotplug.c | 4 +-- src/qemu/qemu_namespace.c | 4 +-- src/qemu/qemu_validate.c | 4 +-- src/security/security_apparmor.c | 4 +-- src/security/security_dac.c | 8 ++--- src/security/security_selinux.c | 8 ++--- src/security/virt-aa-helper.c | 4 +-- 12 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 38d7250c6d..b4af77103f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3492,20 +3492,20 @@ void virDomainMemoryDefFree(virDomainMemoryDef *def) switch (def->model) { case VIR_DOMAIN_MEMORY_MODEL_DIMM: - virBitmapFree(def->source.dimm.sourceNodes); + virBitmapFree(def->source.dimm.nodes); break; case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - g_free(def->source.nvdimm.nvdimmPath); + g_free(def->source.nvdimm.path); g_free(def->target.nvdimm.uuid); break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - g_free(def->source.virtio_pmem.nvdimmPath); + g_free(def->source.virtio_pmem.path); break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: - virBitmapFree(def->source.dimm.sourceNodes); + virBitmapFree(def->source.dimm.nodes); break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: - virBitmapFree(def->source.sgx_epc.sourceNodes); + virBitmapFree(def->source.sgx_epc.nodes); break; case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_LAST: @@ -13297,10 +13297,10 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node, if (def->model == VIR_DOMAIN_MEMORY_MODEL_DIMM) { pagesize = &def->source.dimm.pagesize; - sourceNodes = &def->source.dimm.sourceNodes; + sourceNodes = &def->source.dimm.nodes; } else { pagesize = &def->source.virtio_mem.pagesize; - sourceNodes = &def->source.virtio_mem.sourceNodes; + sourceNodes = &def->source.virtio_mem.nodes; } if (virDomainParseMemory("./pagesize", "./pagesize/@unit", ctxt, @@ -13321,28 +13321,28 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node, break; case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - def->source.nvdimm.nvdimmPath = virXPathString("string(./path)", ctxt); + def->source.nvdimm.path = virXPathString("string(./path)", ctxt); if (virDomainParseMemory("./alignsize", "./alignsize/@unit", ctxt, &def->source.nvdimm.alignsize, false, false) < 0) return -1; if (virXPathBoolean("boolean(./pmem)", ctxt)) - def->source.nvdimm.nvdimmPmem = true; + def->source.nvdimm.pmem = true; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - def->source.virtio_pmem.nvdimmPath = virXPathString("string(./path)", ctxt); + def->source.virtio_pmem.path = virXPathString("string(./path)", ctxt); break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: if ((nodemask = virXPathString("string(./nodemask)", ctxt))) { - if (virBitmapParse(nodemask, &def->source.sgx_epc.sourceNodes, + if (virBitmapParse(nodemask, &def->source.sgx_epc.nodes, VIR_DOMAIN_CPUMASK_LEN) < 0) return -1; - if (virBitmapIsAllClear(def->source.sgx_epc.sourceNodes)) { + if (virBitmapIsAllClear(def->source.sgx_epc.nodes)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid value of 'nodemask': %1$s"), nodemask); return -1; @@ -15293,8 +15293,8 @@ virDomainMemoryFindByDefInternal(virDomainDef *def, if (tmp->source.dimm.pagesize != mem->source.dimm.pagesize) continue; - if (!virBitmapEqual(tmp->source.dimm.sourceNodes, - mem->source.dimm.sourceNodes)) + if (!virBitmapEqual(tmp->source.dimm.nodes, + mem->source.dimm.nodes)) continue; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: @@ -15304,26 +15304,26 @@ virDomainMemoryFindByDefInternal(virDomainDef *def, tmp->target.virtio_mem.address != mem->target.virtio_mem.address) continue; - if (!virBitmapEqual(tmp->source.virtio_mem.sourceNodes, - mem->source.virtio_mem.sourceNodes)) + if (!virBitmapEqual(tmp->source.virtio_mem.nodes, + mem->source.virtio_mem.nodes)) continue; break; case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - if (STRNEQ(tmp->source.nvdimm.nvdimmPath, mem->source.nvdimm.nvdimmPath)) + if (STRNEQ(tmp->source.nvdimm.path, mem->source.nvdimm.path)) continue; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - if (STRNEQ(tmp->source.virtio_pmem.nvdimmPath, - mem->source.virtio_pmem.nvdimmPath) || + if (STRNEQ(tmp->source.virtio_pmem.path, + mem->source.virtio_pmem.path) || tmp->target.virtio_pmem.address != mem->target.virtio_pmem.address) continue; break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: - if (!virBitmapEqual(tmp->source.sgx_epc.sourceNodes, - mem->source.sgx_epc.sourceNodes)) + if (!virBitmapEqual(tmp->source.sgx_epc.nodes, + mem->source.sgx_epc.nodes)) continue; break; @@ -21044,7 +21044,7 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDef *src, return false; } - if (src->source.nvdimm.nvdimmPmem != dst->source.nvdimm.nvdimmPmem) { + if (src->source.nvdimm.pmem != dst->source.nvdimm.pmem) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Target NVDIMM pmem flag doesn't match " "source NVDIMM pmem flag")); @@ -25165,8 +25165,8 @@ virDomainMemorySourceDefFormat(virBuffer *buf, switch (def->model) { case VIR_DOMAIN_MEMORY_MODEL_DIMM: - if (def->source.dimm.sourceNodes) { - if (!(bitmap = virBitmapFormat(def->source.dimm.sourceNodes))) + if (def->source.dimm.nodes) { + if (!(bitmap = virBitmapFormat(def->source.dimm.nodes))) return -1; virBufferAsprintf(&childBuf, "<nodemask>%s</nodemask>\n", bitmap); @@ -25177,8 +25177,8 @@ virDomainMemorySourceDefFormat(virBuffer *buf, def->source.dimm.pagesize); break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: - if (def->source.virtio_mem.sourceNodes) { - if (!(bitmap = virBitmapFormat(def->source.virtio_mem.sourceNodes))) + if (def->source.virtio_mem.nodes) { + if (!(bitmap = virBitmapFormat(def->source.virtio_mem.nodes))) return -1; virBufferAsprintf(&childBuf, "<nodemask>%s</nodemask>\n", bitmap); @@ -25190,23 +25190,23 @@ virDomainMemorySourceDefFormat(virBuffer *buf, break; case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - virBufferEscapeString(&childBuf, "<path>%s</path>\n", def->source.nvdimm.nvdimmPath); + virBufferEscapeString(&childBuf, "<path>%s</path>\n", def->source.nvdimm.path); if (def->source.nvdimm.alignsize) virBufferAsprintf(&childBuf, "<alignsize unit='KiB'>%llu</alignsize>\n", def->source.nvdimm.alignsize); - if (def->source.nvdimm.nvdimmPmem) + if (def->source.nvdimm.pmem) virBufferAddLit(&childBuf, "<pmem/>\n"); break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - virBufferEscapeString(&childBuf, "<path>%s</path>\n", def->source.virtio_pmem.nvdimmPath); + virBufferEscapeString(&childBuf, "<path>%s</path>\n", def->source.virtio_pmem.path); break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: - if (def->source.sgx_epc.sourceNodes) { - if (!(bitmap = virBitmapFormat(def->source.sgx_epc.sourceNodes))) + if (def->source.sgx_epc.nodes) { + if (!(bitmap = virBitmapFormat(def->source.sgx_epc.nodes))) return -1; virBufferAsprintf(&childBuf, "<nodemask>%s</nodemask>\n", bitmap); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cf4cb04a6f..8bef097542 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2644,22 +2644,22 @@ struct _virDomainMemoryDef { union { struct { unsigned long long pagesize; /* kibibytes */ - virBitmap *sourceNodes; + virBitmap *nodes; /* source NUMA nodes */ } dimm; struct { - char *nvdimmPath; - bool nvdimmPmem; + char *path; + bool pmem; unsigned long long alignsize; /* kibibytes */ } nvdimm; struct { - char *nvdimmPath; + char *path; } virtio_pmem; struct { unsigned long long pagesize; /* kibibytes */ - virBitmap *sourceNodes; + virBitmap *nodes; /* source NUMA nodes */ } virtio_mem; struct { - virBitmap *sourceNodes; + virBitmap *nodes; /* source NUMA nodes */ } sgx_epc; } source; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index ddf2e8effa..b286990b19 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2260,7 +2260,7 @@ virDomainMemoryDefValidate(const virDomainMemoryDef *mem, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - if (!mem->source.nvdimm.nvdimmPath) { + if (!mem->source.nvdimm.path) { virReportError(VIR_ERR_XML_DETAIL, "%s", _("path is required for model 'nvdimm'")); return -1; @@ -2286,7 +2286,7 @@ virDomainMemoryDefValidate(const virDomainMemoryDef *mem, break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - if (!mem->source.virtio_pmem.nvdimmPath) { + if (!mem->source.virtio_pmem.path) { virReportError(VIR_ERR_XML_DETAIL, _("path is required for model '%1$s'"), virDomainMemoryModelTypeToString(mem->model)); diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index b9d893fd86..47402b3750 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -553,12 +553,12 @@ qemuSetupMemoryDevicesCgroup(virDomainObj *vm, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - if (qemuCgroupAllowDevicePath(vm, mem->source.nvdimm.nvdimmPath, + if (qemuCgroupAllowDevicePath(vm, mem->source.nvdimm.path, VIR_CGROUP_DEVICE_RW, false) < 0) return -1; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - if (qemuCgroupAllowDevicePath(vm, mem->source.virtio_pmem.nvdimmPath, + if (qemuCgroupAllowDevicePath(vm, mem->source.virtio_pmem.path, VIR_CGROUP_DEVICE_RW, false) < 0) return -1; break; @@ -591,12 +591,12 @@ qemuTeardownMemoryDevicesCgroup(virDomainObj *vm, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - if (qemuCgroupDenyDevicePath(vm, mem->source.nvdimm.nvdimmPath, + if (qemuCgroupDenyDevicePath(vm, mem->source.nvdimm.path, VIR_CGROUP_DEVICE_RWM, false) < 0) return -1; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - if (qemuCgroupDenyDevicePath(vm, mem->source.virtio_pmem.nvdimmPath, + if (qemuCgroupDenyDevicePath(vm, mem->source.virtio_pmem.path, VIR_CGROUP_DEVICE_RWM, false) < 0) return -1; break; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 77601d27c5..84a479a5b4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3160,10 +3160,10 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, pagesize = mem->source.virtio_mem.pagesize; break; case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - nvdimmPath = mem->source.nvdimm.nvdimmPath; + nvdimmPath = mem->source.nvdimm.path; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - nvdimmPath = mem->source.virtio_pmem.nvdimmPath; + nvdimmPath = mem->source.virtio_pmem.path; break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: case VIR_DOMAIN_MEMORY_MODEL_NONE: @@ -3241,7 +3241,7 @@ qemuBuildMemoryGetPagesize(virQEMUDriverConfig *cfg, * Similarly, virtio-pmem-pci doesn't need prealloc either. */ if (nvdimmPath) { if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM && - !mem->source.nvdimm.nvdimmPmem) { + !mem->source.nvdimm.pmem) { prealloc = true; } } else if (useHugepage) { @@ -3352,19 +3352,19 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_DIMM: - nodemask = mem->source.dimm.sourceNodes; + nodemask = mem->source.dimm.nodes; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM: - nodemask = mem->source.virtio_mem.sourceNodes; + nodemask = mem->source.virtio_mem.nodes; break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: - nodemask = mem->source.sgx_epc.sourceNodes; + nodemask = mem->source.sgx_epc.nodes; break; case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - nvdimmPath = mem->source.nvdimm.nvdimmPath; + nvdimmPath = mem->source.nvdimm.path; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - nvdimmPath = mem->source.virtio_pmem.nvdimmPath; + nvdimmPath = mem->source.virtio_pmem.path; break; case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_LAST: @@ -3479,7 +3479,7 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps, return -1; if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM && - mem->source.nvdimm.nvdimmPmem) { + mem->source.nvdimm.pmem) { if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("nvdimm pmem property is not available " diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c461c7454f..9c3f5b14dc 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -7022,8 +7022,8 @@ qemuDomainChangeMemoryLiveValidateChange(const virDomainMemoryDef *oldDef, return false; } - if (!virBitmapEqual(oldDef->source.virtio_mem.sourceNodes, - newDef->source.virtio_mem.sourceNodes)) { + if (!virBitmapEqual(oldDef->source.virtio_mem.nodes, + newDef->source.virtio_mem.nodes)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("cannot modify memory source nodes")); return false; diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 206bbd7375..f245712f9a 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -372,10 +372,10 @@ qemuDomainSetupMemory(virDomainMemoryDef *mem, { switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - *paths = g_slist_prepend(*paths, g_strdup(mem->source.nvdimm.nvdimmPath)); + *paths = g_slist_prepend(*paths, g_strdup(mem->source.nvdimm.path)); break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - *paths = g_slist_prepend(*paths, g_strdup(mem->source.virtio_pmem.nvdimmPath)); + *paths = g_slist_prepend(*paths, g_strdup(mem->source.virtio_pmem.path)); break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a9a21843b5..3fc4820409 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -5074,8 +5074,8 @@ qemuValidateDomainDeviceDefMemory(virDomainMemoryDef *mem, return -1; } - if (mem->source.sgx_epc.sourceNodes) { - while ((node = virBitmapNextSetBit(mem->source.sgx_epc.sourceNodes, node)) >= 0) { + if (mem->source.sgx_epc.nodes) { + while ((node = virBitmapNextSetBit(mem->source.sgx_epc.nodes, node)) >= 0) { if (mem->size > sgxCaps->sgxSections[node].size) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("sgx epc size %1$lld on host node %2$zd is less than requested size %3$lld"), diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index 4b904500ff..27d64a23bb 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -642,10 +642,10 @@ AppArmorSetMemoryLabel(virSecurityManager *mgr, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - path = mem->source.nvdimm.nvdimmPath; + path = mem->source.nvdimm.path; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - path = mem->source.virtio_pmem.nvdimmPath; + path = mem->source.virtio_pmem.path; break; case VIR_DOMAIN_MEMORY_MODEL_NONE: case VIR_DOMAIN_MEMORY_MODEL_DIMM: diff --git a/src/security/security_dac.c b/src/security/security_dac.c index a615c6b09e..20e0998fbc 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1857,9 +1857,9 @@ virSecurityDACRestoreMemoryLabel(virSecurityManager *mgr, { switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - return virSecurityDACRestoreFileLabel(mgr, mem->source.nvdimm.nvdimmPath); + return virSecurityDACRestoreFileLabel(mgr, mem->source.nvdimm.path); case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - return virSecurityDACRestoreFileLabel(mgr, mem->source.virtio_pmem.nvdimmPath); + return virSecurityDACRestoreFileLabel(mgr, mem->source.virtio_pmem.path); case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: /* We set label on SGX /dev nodes iff running with namespaces, so we @@ -2046,12 +2046,12 @@ virSecurityDACSetMemoryLabel(virSecurityManager *mgr, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: return virSecurityDACSetOwnership(mgr, NULL, - mem->source.nvdimm.nvdimmPath, + mem->source.nvdimm.path, user, group, true); case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: return virSecurityDACSetOwnership(mgr, NULL, - mem->source.virtio_pmem.nvdimmPath, + mem->source.virtio_pmem.path, user, group, true); case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index fdbfd5495f..7914aba84d 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1618,10 +1618,10 @@ virSecuritySELinuxSetMemoryLabel(virSecurityManager *mgr, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - path = mem->source.nvdimm.nvdimmPath; + path = mem->source.nvdimm.path; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - path = mem->source.virtio_pmem.nvdimmPath; + path = mem->source.virtio_pmem.path; break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: if (virSecuritySELinuxSetFilecon(mgr, DEV_SGX_VEPC, @@ -1663,10 +1663,10 @@ virSecuritySELinuxRestoreMemoryLabel(virSecurityManager *mgr, switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - path = mem->source.nvdimm.nvdimmPath; + path = mem->source.nvdimm.path; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - path = mem->source.virtio_pmem.nvdimmPath; + path = mem->source.virtio_pmem.path; break; case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC: ret = virSecuritySELinuxRestoreFileLabel(mgr, DEV_SGX_VEPC, true); diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index bf368cac47..91fa57ddfb 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1151,11 +1151,11 @@ get_files(vahControl * ctl) switch (mem->model) { case VIR_DOMAIN_MEMORY_MODEL_NVDIMM: - if (vah_add_file(&buf, mem->source.nvdimm.nvdimmPath, "rw") != 0) + if (vah_add_file(&buf, mem->source.nvdimm.path, "rw") != 0) goto cleanup; break; case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM: - if (vah_add_file(&buf, mem->source.virtio_pmem.nvdimmPath, "rw") != 0) + if (vah_add_file(&buf, mem->source.virtio_pmem.path, "rw") != 0) goto cleanup; break; case VIR_DOMAIN_MEMORY_MODEL_DIMM: -- 2.41.0