[libvirt] [PATCH 0/8] virConf fixes and cleanups

The interesting bits: * patch 1 fixes a bug affecting 32-bit systems * patch 2 removes some unnecessary code The rest: * very minor stuff Andrea Bolognani (8): util: conf: Use long long when parsing util: conf: Improve virConfGet*() logic util: conf: Add integer casts util: conf: Claim the proper range for signed numbers util: conf: Fix comment for virConfGetValueULLong() util: conf: Fix parameters alignment util: conf: Clarify choice between VIR_CONF_LONG and VIR_CONF_ULONG util: conf: Rename VIR_CONF_{U,}LONG -> VIR_CONF_{U,}LLONG src/util/virconf.c | 82 +++++++++++++++++++--------------------------- src/util/virconf.h | 4 +-- src/xenconfig/xen_common.c | 8 ++--- tests/virconftest.c | 16 ++++----- 4 files changed, 48 insertions(+), 62 deletions(-) -- 2.7.4

Commit 6381c89f8cce changed virConfValue to store long long integers instead of long integers; however, the temporary variable used in virConfParseLong() was not updated accordingly, causing trouble for 32-bit machines. --- src/util/virconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 33d6d92..66f8144 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -364,9 +364,9 @@ virConfSaveEntry(virBufferPtr buf, virConfEntryPtr cur) * Returns 0 in case of success and -1 in case of error */ static int -virConfParseLong(virConfParserCtxtPtr ctxt, long *val) +virConfParseLong(virConfParserCtxtPtr ctxt, long long *val) { - long l = 0; + long long l = 0; int neg = 0; if (CUR == '-') { @@ -476,7 +476,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt) virConfValuePtr ret, lst = NULL, tmp, prev; virConfType type = VIR_CONF_NONE; char *str = NULL; - long l = 0; + long long l = 0; SKIP_BLANKS; if (ctxt->cur >= ctxt->end) { -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:23PM +0200, Andrea Bolognani wrote:
Commit 6381c89f8cce changed virConfValue to store long long integers instead of long integers; however, the temporary variable used in virConfParseLong() was not updated accordingly, causing trouble for 32-bit machines. --- src/util/virconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c index 33d6d92..66f8144 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -364,9 +364,9 @@ virConfSaveEntry(virBufferPtr buf, virConfEntryPtr cur) * Returns 0 in case of success and -1 in case of error */ static int -virConfParseLong(virConfParserCtxtPtr ctxt, long *val) +virConfParseLong(virConfParserCtxtPtr ctxt, long long *val) { - long l = 0; + long long l = 0; int neg = 0;
if (CUR == '-') { @@ -476,7 +476,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt) virConfValuePtr ret, lst = NULL, tmp, prev; virConfType type = VIR_CONF_NONE; char *str = NULL; - long l = 0; + long long l = 0;
SKIP_BLANKS; if (ctxt->cur >= ctxt->end) {
ACK, but perhaps you could add a test case to tests/virconftest to validate this too. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Mon, 2016-07-18 at 09:16 +0100, Daniel P. Berrange wrote:
On Fri, Jul 15, 2016 at 07:46:23PM +0200, Andrea Bolognani wrote:
Commit 6381c89f8cce changed virConfValue to store long long integers instead of long integers; however, the temporary variable used in virConfParseLong() was not updated accordingly, causing trouble for 32-bit machines. --- src/util/virconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 33d6d92..66f8144 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -364,9 +364,9 @@ virConfSaveEntry(virBufferPtr buf, virConfEntryPtr cur) * Returns 0 in case of success and -1 in case of error */ static int -virConfParseLong(virConfParserCtxtPtr ctxt, long *val) +virConfParseLong(virConfParserCtxtPtr ctxt, long long *val) { - long l = 0; + long long l = 0; int neg = 0; if (CUR == '-') { @@ -476,7 +476,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt) virConfValuePtr ret, lst = NULL, tmp, prev; virConfType type = VIR_CONF_NONE; char *str = NULL; - long l = 0; + long long l = 0; SKIP_BLANKS; if (ctxt->cur >= ctxt->end) { ACK, but perhaps you could add a test case to tests/virconftest to validate this too.
virconftest will already fail without this patch: 4) int ... Expected -6963472309248 got -1330322432 because the call to virConfGetValueLLong() will not be able to return the correct value. So I think we're covered. I've pushed the whole series, thanks for reviewing it! -- Andrea Bolognani / Red Hat / Virtualization

When parsing numeric values, we always store them as unsigned unless they're negative. We can use this fact to simplify the logic by removing a bunch of unnecessary checks. --- src/util/virconf.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 66f8144..433b57b 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1070,7 +1070,7 @@ int virConfGetValueBool(virConfPtr conf, return -1; } - if (cval->l < 0 || cval->l > 1) { + if (((unsigned long long)cval->l) > 1) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be 0 or 1"), conf->filename, setting); @@ -1167,7 +1167,7 @@ int virConfGetValueUInt(virConfPtr conf, return -1; } - if (cval->l > UINT_MAX || cval->l < 0) { + if (((unsigned long long)cval->l) > UINT_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: value for '%s' parameter must be in range 0:%u"), conf->filename, setting, UINT_MAX); @@ -1208,29 +1208,22 @@ int virConfGetValueSizeT(virConfPtr conf, if (!cval) return 0; - if (cval->type == VIR_CONF_LONG) { - if (cval->l < 0 || cval->l > SIZE_MAX) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range 0:%zu"), - conf->filename, setting, SIZE_MAX); - return -1; - } - } else if (cval->type == VIR_CONF_ULONG) { -#if ULLONG_MAX > SIZE_MAX - if (((unsigned long long)cval->l) > SIZE_MAX) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range 0:%zu"), - conf->filename, setting, SIZE_MAX); - return -1; - } -#endif - } else { + if (cval->type != VIR_CONF_ULONG) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: expected an unsigned integer for '%s' parameter"), conf->filename, setting); return -1; } +#if ULLONG_MAX > SIZE_MAX + if (((unsigned long long)cval->l) > SIZE_MAX) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s: value for '%s' parameter must be in range 0:%zu"), + conf->filename, setting, SIZE_MAX); + return -1; + } +#endif + *value = (size_t)cval->l; return 1; @@ -1369,14 +1362,7 @@ int virConfGetValueULLong(virConfPtr conf, if (!cval) return 0; - if (cval->type == VIR_CONF_LONG) { - if (cval->l < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range 0:%llu"), - conf->filename, setting, ULLONG_MAX); - return -1; - } - } else if (cval->type != VIR_CONF_ULONG) { + if (cval->type != VIR_CONF_ULONG) { virReportError(VIR_ERR_INTERNAL_ERROR, _("%s: expected an unsigned integer for '%s' parameter"), conf->filename, setting); -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:24PM +0200, Andrea Bolognani wrote:
When parsing numeric values, we always store them as unsigned unless they're negative. We can use this fact to simplify the logic by removing a bunch of unnecessary checks. --- src/util/virconf.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

For good measure. --- src/util/virconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 433b57b..2d42227 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1126,7 +1126,7 @@ int virConfGetValueInt(virConfPtr conf, return -1; } - *value = cval->l; + *value = (int)cval->l; return 1; } @@ -1174,7 +1174,7 @@ int virConfGetValueUInt(virConfPtr conf, return -1; } - *value = cval->l; + *value = (unsigned int)cval->l; return 1; } -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:25PM +0200, Andrea Bolognani wrote:
For good measure. --- src/util/virconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

virConfGetValueLLong() errors out if the value is too big to fit into a long long integer, but claims the supported range to be (0,LLONG_MAX) instead of (LLONG_MIN,LLONG_MAX). --- src/util/virconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 2d42227..6e1d2f4 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1318,8 +1318,8 @@ int virConfGetValueLLong(virConfPtr conf, if (cval->type == VIR_CONF_ULONG) { if (((unsigned long long)cval->l) > LLONG_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range 0:%lld"), - conf->filename, setting, LLONG_MAX); + _("%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) { -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:26PM +0200, Andrea Bolognani wrote:
virConfGetValueLLong() errors out if the value is too big to fit into a long long integer, but claims the supported range to be (0,LLONG_MAX) instead of (LLONG_MIN,LLONG_MAX). --- src/util/virconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

The name of the function is not virConfGetValueULongLong(). --- src/util/virconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index 6e1d2f4..d635539 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1336,7 +1336,7 @@ int virConfGetValueLLong(virConfPtr conf, /** - * virConfGetValueULongLong: + * virConfGetValueULLong: * @conf: the config object * @setting: the config entry name * @value: pointer to hold integer value -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:27PM +0200, Andrea Bolognani wrote:
The name of the function is not virConfGetValueULongLong(). --- src/util/virconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

The parameters for virConfGetValueLLong() were not aligned properly. --- src/util/virconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index d635539..f2d543c 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1304,8 +1304,8 @@ int virConfGetValueSSizeT(virConfPtr conf, * Returns: 1 if the value was present, 0 if missing, -1 on error */ int virConfGetValueLLong(virConfPtr conf, - const char *setting, - long long *value) + const char *setting, + long long *value) { virConfValuePtr cval = virConfGetValue(conf, setting); -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:28PM +0200, Andrea Bolognani wrote:
The parameters for virConfGetValueLLong() were not aligned properly. --- src/util/virconf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c index d635539..f2d543c 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -1304,8 +1304,8 @@ int virConfGetValueSSizeT(virConfPtr conf, * Returns: 1 if the value was present, 0 if missing, -1 on error */ int virConfGetValueLLong(virConfPtr conf, - const char *setting, - long long *value) + const char *setting, + long long *value)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

We use unsigned long long integers unless we need to store a negative value. Rewrite the condition to make this more obvious. --- src/util/virconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index f2d543c..eb55a1a 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -545,7 +545,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt) _("numbers not allowed in VMX format")); return NULL; } - type = (c_isdigit(CUR) || CUR == '+') ? VIR_CONF_ULONG : VIR_CONF_LONG; + type = (CUR == '-') ? VIR_CONF_LONG : VIR_CONF_ULONG; if (virConfParseLong(ctxt, &l) < 0) return NULL; } else { -- 2.7.4

On Fri, Jul 15, 2016 at 07:46:29PM +0200, Andrea Bolognani wrote:
We use unsigned long long integers unless we need to store a negative value. Rewrite the condition to make this more obvious. --- src/util/virconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

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

On Fri, Jul 15, 2016 at 07:46:30PM +0200, Andrea Bolognani wrote:
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(-)
ACK Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Andrea Bolognani
-
Daniel P. Berrange