libvirt/SOURCES/libvirt-conf-rename-namespa...

145 lines
5.6 KiB
Diff

From 9b070e02e7b5bb95728a1fcdc8b7dfaaacc5f30a Mon Sep 17 00:00:00 2001
Message-Id: <9b070e02e7b5bb95728a1fcdc8b7dfaaacc5f30a@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Tue, 24 Mar 2020 16:25:55 +0100
Subject: [PATCH] conf: rename 'namespace' property of struct
_virStorageSourceNVMeDef
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 5793b8baa75747860f6ba97470969047e60c8579)
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
Message-Id: <bfe6cf10a95868ae56a91f362a1ea50667754027.1585063415.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/conf/domain_conf.c | 12 ++++++------
src/qemu/qemu_block.c | 2 +-
src/util/virhostdev.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 8aec85e83c..1e8518139c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6054,7 +6054,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;
@@ -9433,7 +9433,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;
@@ -9452,16 +9452,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;
}
@@ -24444,7 +24444,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/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 73cb5ba4bc..5697d4fc73 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/virhostdev.c b/src/util/virhostdev.c
index 9b4ea30216..9596482146 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -2256,7 +2256,7 @@ virHostdevGetNVMeDeviceList(virNVMeDeviceListPtr nvmeDevices,
continue;
if (!(dev = virNVMeDeviceNew(&srcNVMe->pciAddr,
- srcNVMe->namespace,
+ srcNVMe->namespc,
srcNVMe->managed)))
return -1;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index fa37840532..2e54620139 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 c1430cadd1..0230f44652 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -246,7 +246,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.26.0