[PATCH 01/14] conf: rename 'namespace' property of struct _virStorageSourceNVMeDef

Peter Krempa pkrempa at redhat.com
Mon Mar 23 18:11:51 UTC 2020


While 'namespace' is not a reserved word in C, it is in C++. Our
compilers are happy with it but syntax-hilighting in some editors
hilights is as a keyword. Rename it to prevent confusion.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/conf/domain_conf.c      | 12 ++++++------
 src/hypervisor/virhostdev.c |  2 +-
 src/qemu/qemu_block.c       |  2 +-
 src/util/virstoragefile.c   |  4 ++--
 src/util/virstoragefile.h   |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e0432fc47d..f1e4d33a8d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6087,7 +6087,7 @@ virDomainDiskDefValidate(const virDomainDef *def,

     if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
         /* NVMe namespaces start from 1 */
-        if (disk->src->nvme->namespace == 0) {
+        if (disk->src->nvme->namespc == 0) {
             virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("NVMe namespace can't be zero"));
             return -1;
@@ -9525,7 +9525,7 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
 {
     g_autoptr(virStorageSourceNVMeDef) nvme = NULL;
     g_autofree char *type = NULL;
-    g_autofree char *namespace = NULL;
+    g_autofree char *namespc = NULL;
     g_autofree char *managed = NULL;
     xmlNodePtr address;

@@ -9544,16 +9544,16 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
         return -1;
     }

-    if (!(namespace = virXMLPropString(node, "namespace"))) {
+    if (!(namespc = virXMLPropString(node, "namespace"))) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("missing 'namespace' attribute to disk source"));
         return -1;
     }

-    if (virStrToLong_ull(namespace, NULL, 10, &nvme->namespace) < 0) {
+    if (virStrToLong_ull(namespc, NULL, 10, &nvme->namespc) < 0) {
         virReportError(VIR_ERR_XML_ERROR,
                        _("malformed namespace '%s'"),
-                       namespace);
+                       namespc);
         return -1;
     }

@@ -24664,7 +24664,7 @@ virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf,
     virBufferAddLit(attrBuf, " type='pci'");
     virBufferAsprintf(attrBuf, " managed='%s'",
                       virTristateBoolTypeToString(nvme->managed));
-    virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespace);
+    virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespc);
     virPCIDeviceAddressFormat(childBuf, nvme->pciAddr, false);
 }

diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 6565cebe57..9017cc3be8 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -2212,7 +2212,7 @@ virHostdevGetNVMeDeviceList(virNVMeDeviceListPtr nvmeDevices,
             continue;

         if (!(dev = virNVMeDeviceNew(&srcNVMe->pciAddr,
-                                     srcNVMe->namespace,
+                                     srcNVMe->namespc,
                                      srcNVMe->managed)))
             return -1;

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 5c85ddd44c..22ea2fe018 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1008,7 +1008,7 @@ qemuBlockStorageSourceGetNVMeProps(virStorageSourcePtr src)
     ignore_value(virJSONValueObjectCreate(&ret,
                                           "s:driver", "nvme",
                                           "s:device", pciAddr,
-                                          "U:namespace", nvme->namespace,
+                                          "U:namespace", nvme->namespc,
                                           NULL));
     return ret;
 }
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index e723cc9410..ca39391379 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -2052,7 +2052,7 @@ virStorageSourceNVMeDefCopy(const virStorageSourceNVMeDef *src)

     ret = g_new0(virStorageSourceNVMeDef, 1);

-    ret->namespace = src->namespace;
+    ret->namespc = src->namespc;
     ret->managed = src->managed;
     virPCIDeviceAddressCopy(&ret->pciAddr, &src->pciAddr);
     return ret;
@@ -2069,7 +2069,7 @@ virStorageSourceNVMeDefIsEqual(const virStorageSourceNVMeDef *a,
     if (!a || !b)
         return false;

-    if (a->namespace != b->namespace ||
+    if (a->namespc != b->namespc ||
         a->managed != b->managed ||
         !virPCIDeviceAddressEqual(&a->pciAddr, &b->pciAddr))
         return false;
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index f2a73feb6a..9427057f94 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -245,7 +245,7 @@ struct _virStorageSourceInitiatorDef {
 typedef struct _virStorageSourceNVMeDef virStorageSourceNVMeDef;
 typedef virStorageSourceNVMeDef *virStorageSourceNVMeDefPtr;
 struct _virStorageSourceNVMeDef {
-    unsigned long long namespace;
+    unsigned long long namespc;
     int managed; /* enum virTristateBool */
     virPCIDeviceAddress pciAddr;

-- 
2.24.1




More information about the libvir-list mailing list