[PATCH 02/10] conf: Turn targetNode in struct virDomainMemoryDef to signed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Later on, we will need to know whether the user specified the target
node or not. Turn the variable into a signed value. We already treat it
as signed in various parts of the qemu driver.
---
 src/conf/domain_conf.c | 10 ++++++----
 src/conf/domain_conf.h |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 002bf13..514bd8a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12521,7 +12521,8 @@ virDomainMemoryTargetDefParseXML(xmlNodePtr node,
     xmlNodePtr save = ctxt->node;
     ctxt->node = node;

-    if (virXPathUInt("string(./node)", ctxt, &def->targetNode) < 0) {
+    if (virXPathInt("string(./node)", ctxt, &def->targetNode) < 0 ||
+        def->targetNode < 0) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("invalid or missing value of memory device node"));
         goto cleanup;
@@ -17668,8 +17669,8 @@ virDomainMemoryDefCheckABIStability(virDomainMemoryDefPtr src,

     if (src->targetNode != dst->targetNode) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target memory device targetNode '%u' "
-                         "doesn't match source targetNode '%u'"),
+                       _("Target memory device targetNode '%d' "
+                         "doesn't match source targetNode '%d'"),
                        dst->targetNode, src->targetNode);
         return false;
     }
@@ -20759,7 +20760,8 @@ virDomainMemoryTargetDefFormat(virBufferPtr buf,
     virBufferAdjustIndent(buf, 2);

     virBufferAsprintf(buf, "<size unit='KiB'>%llu</size>\n", def->size);
-    virBufferAsprintf(buf, "<node>%u</node>\n", def->targetNode);
+    if (def->targetNode >= 0)
+        virBufferAsprintf(buf, "<node>%d</node>\n", def->targetNode);

     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</target>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f10b534..8d43ee6 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2022,7 +2022,7 @@ struct _virDomainMemoryDef {

     /* target */
     int model; /* virDomainMemoryModel */
-    unsigned int targetNode;
+    int targetNode;
     unsigned long long size; /* kibibytes */

     virDomainDeviceInfo info;
-- 
2.4.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]