[PATCH 8/8] util: conf: Rename VIR_CONF_{U, }LONG -> VIR_CONF_{U, }LLONG

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

 



Since commit 6381c89f8cce, we're storing long long integers
instead of long integers. Rename the corresponding virConfType
value accordingly.
---
 src/util/virconf.c         | 26 +++++++++++++-------------
 src/util/virconf.h         |  4 ++--
 src/xenconfig/xen_common.c |  8 ++++----
 tests/virconftest.c        | 16 ++++++++--------
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/util/virconf.c b/src/util/virconf.c
index eb55a1a..a41f896 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -280,10 +280,10 @@ virConfSaveValue(virBufferPtr buf, virConfValuePtr val)
     switch (val->type) {
         case VIR_CONF_NONE:
             return -1;
-        case VIR_CONF_LONG:
+        case VIR_CONF_LLONG:
             virBufferAsprintf(buf, "%lld", val->l);
             break;
-        case VIR_CONF_ULONG:
+        case VIR_CONF_ULLONG:
             virBufferAsprintf(buf, "%llu", val->l);
             break;
         case VIR_CONF_STRING:
@@ -545,7 +545,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
                          _("numbers not allowed in VMX format"));
             return NULL;
         }
-        type = (CUR == '-') ? VIR_CONF_LONG : VIR_CONF_ULONG;
+        type = (CUR == '-') ? VIR_CONF_LLONG : VIR_CONF_ULLONG;
         if (virConfParseLong(ctxt, &l) < 0)
             return NULL;
     } else {
@@ -1063,7 +1063,7 @@ int virConfGetValueBool(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type != VIR_CONF_ULONG) {
+    if (cval->type != VIR_CONF_ULLONG) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: expected a bool for '%s' parameter"),
                        conf->filename, setting);
@@ -1111,8 +1111,8 @@ int virConfGetValueInt(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type != VIR_CONF_LONG &&
-        cval->type != VIR_CONF_ULONG) {
+    if (cval->type != VIR_CONF_LLONG &&
+        cval->type != VIR_CONF_ULLONG) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: expected a signed integer for '%s' parameter"),
                        conf->filename, setting);
@@ -1160,7 +1160,7 @@ int virConfGetValueUInt(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type != VIR_CONF_ULONG) {
+    if (cval->type != VIR_CONF_ULLONG) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: expected an unsigned integer for '%s' parameter"),
                        conf->filename, setting);
@@ -1208,7 +1208,7 @@ int virConfGetValueSizeT(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type != VIR_CONF_ULONG) {
+    if (cval->type != VIR_CONF_ULLONG) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: expected an unsigned integer for '%s' parameter"),
                        conf->filename, setting);
@@ -1258,14 +1258,14 @@ int virConfGetValueSSizeT(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type == VIR_CONF_ULONG) {
+    if (cval->type == VIR_CONF_ULLONG) {
         if (((unsigned long long)cval->l) > SSIZE_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("%s: value for '%s' parameter must be in range %zd:%zd"),
                            conf->filename, setting, (ssize_t)-SSIZE_MAX - 1, (ssize_t)SSIZE_MAX);
             return -1;
         }
-    } else if (cval->type == VIR_CONF_LONG) {
+    } else if (cval->type == VIR_CONF_LLONG) {
 #if SSIZE_MAX < LLONG_MAX
         if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1315,14 +1315,14 @@ int virConfGetValueLLong(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type == VIR_CONF_ULONG) {
+    if (cval->type == VIR_CONF_ULLONG) {
         if (((unsigned long long)cval->l) > LLONG_MAX) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("%s: value for '%s' parameter must be in range %lld:%lld"),
                            conf->filename, setting, LLONG_MIN, LLONG_MAX);
             return -1;
         }
-    } else if (cval->type != VIR_CONF_LONG) {
+    } else if (cval->type != VIR_CONF_LLONG) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: expected a signed integer for '%s' parameter"),
                        conf->filename, setting);
@@ -1362,7 +1362,7 @@ int virConfGetValueULLong(virConfPtr conf,
     if (!cval)
         return 0;
 
-    if (cval->type != VIR_CONF_ULONG) {
+    if (cval->type != VIR_CONF_ULLONG) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("%s: expected an unsigned integer for '%s' parameter"),
                        conf->filename, setting);
diff --git a/src/util/virconf.h b/src/util/virconf.h
index ccae9d9..23fea49 100644
--- a/src/util/virconf.h
+++ b/src/util/virconf.h
@@ -33,8 +33,8 @@
  */
 typedef enum {
     VIR_CONF_NONE = 0,      /* undefined */
-    VIR_CONF_LONG,          /* a long int */
-    VIR_CONF_ULONG,         /* an unsigned long int */
+    VIR_CONF_LLONG,         /* a long long int */
+    VIR_CONF_ULLONG,        /* an unsigned long long int */
     VIR_CONF_STRING,        /* a string */
     VIR_CONF_LIST,          /* a list */
     VIR_CONF_LAST,          /* sentinel */
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index 8365a2c..8447990 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -58,7 +58,7 @@ xenConfigGetBool(virConfPtr conf,
         return 0;
     }
 
-    if (val->type == VIR_CONF_ULONG) {
+    if (val->type == VIR_CONF_ULLONG) {
         *value = val->l ? 1 : 0;
     } else if (val->type == VIR_CONF_STRING) {
         *value = STREQ(val->str, "1") ? 1 : 0;
@@ -88,7 +88,7 @@ xenConfigGetULong(virConfPtr conf,
         return 0;
     }
 
-    if (val->type == VIR_CONF_ULONG) {
+    if (val->type == VIR_CONF_ULLONG) {
         *value = val->l;
     } else if (val->type == VIR_CONF_STRING) {
         if (virStrToLong_ul(val->str, NULL, 10, value) < 0) {
@@ -122,7 +122,7 @@ xenConfigGetULongLong(virConfPtr conf,
         return 0;
     }
 
-    if (val->type == VIR_CONF_ULONG) {
+    if (val->type == VIR_CONF_ULLONG) {
         *value = val->l;
     } else if (val->type == VIR_CONF_STRING) {
         if (virStrToLong_ull(val->str, NULL, 10, value) < 0) {
@@ -276,7 +276,7 @@ xenConfigSetInt(virConfPtr conf, const char *setting, long long l)
     if (VIR_ALLOC(value) < 0)
         return -1;
 
-    value->type = VIR_CONF_LONG;
+    value->type = VIR_CONF_LLONG;
     value->next = NULL;
     value->l = l;
 
diff --git a/tests/virconftest.c b/tests/virconftest.c
index d9ebda4..dbf6ed6 100644
--- a/tests/virconftest.c
+++ b/tests/virconftest.c
@@ -101,7 +101,7 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED)
         return -1;
 
     if (virConfGetValueType(conf, "int") !=
-        VIR_CONF_LONG) {
+        VIR_CONF_LLONG) {
         fprintf(stderr, "expected a long for 'int'\n");
         goto cleanup;
     }
@@ -121,7 +121,7 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED)
 
 
     if (virConfGetValueType(conf, "uint") !=
-        VIR_CONF_ULONG) {
+        VIR_CONF_ULLONG) {
         fprintf(stderr, "expected a unsigned long for 'uint'\n");
         goto cleanup;
     }
@@ -142,7 +142,7 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED)
 
 
     if (virConfGetValueType(conf, "llong") !=
-        VIR_CONF_LONG) {
+        VIR_CONF_LLONG) {
         fprintf(stderr, "expected a long for 'llong'\n");
         goto cleanup;
     }
@@ -163,7 +163,7 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED)
 
 
     if (virConfGetValueType(conf, "ullong") !=
-        VIR_CONF_ULONG) {
+        VIR_CONF_ULLONG) {
         fprintf(stderr, "expected a unsigned long for 'ullong'\n");
         goto cleanup;
     }
@@ -184,7 +184,7 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED)
 
 
     if (virConfGetValueType(conf, "size_t") !=
-        VIR_CONF_ULONG) {
+        VIR_CONF_ULLONG) {
         fprintf(stderr, "expected a unsigned long for 'size_T'\n");
         goto cleanup;
     }
@@ -205,7 +205,7 @@ static int testConfParseInt(const void *opaque ATTRIBUTE_UNUSED)
 
 
     if (virConfGetValueType(conf, "ssize_t") !=
-        VIR_CONF_LONG) {
+        VIR_CONF_LLONG) {
         fprintf(stderr, "expected a unsigned long for 'ssize_t'\n");
         goto cleanup;
     }
@@ -246,7 +246,7 @@ static int testConfParseBool(const void *opaque ATTRIBUTE_UNUSED)
         return -1;
 
     if (virConfGetValueType(conf, "false") !=
-        VIR_CONF_ULONG) {
+        VIR_CONF_ULLONG) {
         fprintf(stderr, "expected a long for 'false'\n");
         goto cleanup;
     }
@@ -262,7 +262,7 @@ static int testConfParseBool(const void *opaque ATTRIBUTE_UNUSED)
 
 
     if (virConfGetValueType(conf, "true") !=
-        VIR_CONF_ULONG) {
+        VIR_CONF_ULLONG) {
         fprintf(stderr, "expected a long for 'true'\n");
         goto cleanup;
     }
-- 
2.7.4

--
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]