render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 9b070e02e7b5bb95728a1fcdc8b7dfaaacc5f30a Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <9b070e02e7b5bb95728a1fcdc8b7dfaaacc5f30a@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 24 Mar 2020 16:25:55 +0100
a41c76
Subject: [PATCH] conf: rename 'namespace' property of struct
a41c76
 _virStorageSourceNVMeDef
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
While 'namespace' is not a reserved word in C, it is in C++. Our
a41c76
compilers are happy with it but syntax-hilighting in some editors
a41c76
hilights is as a keyword. Rename it to prevent confusion.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
(cherry picked from commit 5793b8baa75747860f6ba97470969047e60c8579)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
a41c76
Message-Id: <bfe6cf10a95868ae56a91f362a1ea50667754027.1585063415.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/conf/domain_conf.c    | 12 ++++++------
a41c76
 src/qemu/qemu_block.c     |  2 +-
a41c76
 src/util/virhostdev.c     |  2 +-
a41c76
 src/util/virstoragefile.c |  4 ++--
a41c76
 src/util/virstoragefile.h |  2 +-
a41c76
 5 files changed, 11 insertions(+), 11 deletions(-)
a41c76
a41c76
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
a41c76
index 8aec85e83c..1e8518139c 100644
a41c76
--- a/src/conf/domain_conf.c
a41c76
+++ b/src/conf/domain_conf.c
a41c76
@@ -6054,7 +6054,7 @@ virDomainDiskDefValidate(const virDomainDef *def,
a41c76
 
a41c76
     if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
a41c76
         /* NVMe namespaces start from 1 */
a41c76
-        if (disk->src->nvme->namespace == 0) {
a41c76
+        if (disk->src->nvme->namespc == 0) {
a41c76
             virReportError(VIR_ERR_XML_ERROR, "%s",
a41c76
                            _("NVMe namespace can't be zero"));
a41c76
             return -1;
a41c76
@@ -9433,7 +9433,7 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
a41c76
 {
a41c76
     g_autoptr(virStorageSourceNVMeDef) nvme = NULL;
a41c76
     g_autofree char *type = NULL;
a41c76
-    g_autofree char *namespace = NULL;
a41c76
+    g_autofree char *namespc = NULL;
a41c76
     g_autofree char *managed = NULL;
a41c76
     xmlNodePtr address;
a41c76
 
a41c76
@@ -9452,16 +9452,16 @@ virDomainDiskSourceNVMeParse(xmlNodePtr node,
a41c76
         return -1;
a41c76
     }
a41c76
 
a41c76
-    if (!(namespace = virXMLPropString(node, "namespace"))) {
a41c76
+    if (!(namespc = virXMLPropString(node, "namespace"))) {
a41c76
         virReportError(VIR_ERR_XML_ERROR, "%s",
a41c76
                        _("missing 'namespace' attribute to disk source"));
a41c76
         return -1;
a41c76
     }
a41c76
 
a41c76
-    if (virStrToLong_ull(namespace, NULL, 10, &nvme->namespace) < 0) {
a41c76
+    if (virStrToLong_ull(namespc, NULL, 10, &nvme->namespc) < 0) {
a41c76
         virReportError(VIR_ERR_XML_ERROR,
a41c76
                        _("malformed namespace '%s'"),
a41c76
-                       namespace);
a41c76
+                       namespc);
a41c76
         return -1;
a41c76
     }
a41c76
 
a41c76
@@ -24444,7 +24444,7 @@ virDomainDiskSourceNVMeFormat(virBufferPtr attrBuf,
a41c76
     virBufferAddLit(attrBuf, " type='pci'");
a41c76
     virBufferAsprintf(attrBuf, " managed='%s'",
a41c76
                       virTristateBoolTypeToString(nvme->managed));
a41c76
-    virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespace);
a41c76
+    virBufferAsprintf(attrBuf, " namespace='%llu'", nvme->namespc);
a41c76
     virPCIDeviceAddressFormat(childBuf, nvme->pciAddr, false);
a41c76
 }
a41c76
 
a41c76
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
a41c76
index 73cb5ba4bc..5697d4fc73 100644
a41c76
--- a/src/qemu/qemu_block.c
a41c76
+++ b/src/qemu/qemu_block.c
a41c76
@@ -1008,7 +1008,7 @@ qemuBlockStorageSourceGetNVMeProps(virStorageSourcePtr src)
a41c76
     ignore_value(virJSONValueObjectCreate(&ret,
a41c76
                                           "s:driver", "nvme",
a41c76
                                           "s:device", pciAddr,
a41c76
-                                          "U:namespace", nvme->namespace,
a41c76
+                                          "U:namespace", nvme->namespc,
a41c76
                                           NULL));
a41c76
     return ret;
a41c76
 }
a41c76
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
a41c76
index 9b4ea30216..9596482146 100644
a41c76
--- a/src/util/virhostdev.c
a41c76
+++ b/src/util/virhostdev.c
a41c76
@@ -2256,7 +2256,7 @@ virHostdevGetNVMeDeviceList(virNVMeDeviceListPtr nvmeDevices,
a41c76
             continue;
a41c76
 
a41c76
         if (!(dev = virNVMeDeviceNew(&srcNVMe->pciAddr,
a41c76
-                                     srcNVMe->namespace,
a41c76
+                                     srcNVMe->namespc,
a41c76
                                      srcNVMe->managed)))
a41c76
             return -1;
a41c76
 
a41c76
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
a41c76
index fa37840532..2e54620139 100644
a41c76
--- a/src/util/virstoragefile.c
a41c76
+++ b/src/util/virstoragefile.c
a41c76
@@ -2052,7 +2052,7 @@ virStorageSourceNVMeDefCopy(const virStorageSourceNVMeDef *src)
a41c76
 
a41c76
     ret = g_new0(virStorageSourceNVMeDef, 1);
a41c76
 
a41c76
-    ret->namespace = src->namespace;
a41c76
+    ret->namespc = src->namespc;
a41c76
     ret->managed = src->managed;
a41c76
     virPCIDeviceAddressCopy(&ret->pciAddr, &src->pciAddr);
a41c76
     return ret;
a41c76
@@ -2069,7 +2069,7 @@ virStorageSourceNVMeDefIsEqual(const virStorageSourceNVMeDef *a,
a41c76
     if (!a || !b)
a41c76
         return false;
a41c76
 
a41c76
-    if (a->namespace != b->namespace ||
a41c76
+    if (a->namespc != b->namespc ||
a41c76
         a->managed != b->managed ||
a41c76
         !virPCIDeviceAddressEqual(&a->pciAddr, &b->pciAddr))
a41c76
         return false;
a41c76
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
a41c76
index c1430cadd1..0230f44652 100644
a41c76
--- a/src/util/virstoragefile.h
a41c76
+++ b/src/util/virstoragefile.h
a41c76
@@ -246,7 +246,7 @@ struct _virStorageSourceInitiatorDef {
a41c76
 typedef struct _virStorageSourceNVMeDef virStorageSourceNVMeDef;
a41c76
 typedef virStorageSourceNVMeDef *virStorageSourceNVMeDefPtr;
a41c76
 struct _virStorageSourceNVMeDef {
a41c76
-    unsigned long long namespace;
a41c76
+    unsigned long long namespc;
a41c76
     int managed; /* enum virTristateBool */
a41c76
     virPCIDeviceAddress pciAddr;
a41c76
 
a41c76
-- 
a41c76
2.26.0
a41c76