From: Peter Krempa Date: Wed, 5 Oct 2022 13:47:49 +0000 (+0200) Subject: virDomainTimerCatchupDef: Change members to 'unsigned long long' X-Git-Tag: v8.10.0-rc1~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9294713d83be2e77fcf0340e81dddf4ab2916ee;p=thirdparty%2Flibvirt.git virDomainTimerCatchupDef: Change members to 'unsigned long long' The struct used 'unsigned long' variables which we try to avoid due to being different size on different architectures. Convert the struct and use virXMLPropULongLong instead of virXPathULong when parsing the XML. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cdf05e8fae..ee9eb6bcc4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10610,33 +10610,17 @@ virDomainTimerDefParseXML(xmlNodePtr node, catchup = virXPathNode("./catchup", ctxt); if (catchup != NULL) { - ret = virXPathULong("string(./catchup/@threshold)", ctxt, - &def->catchup.threshold); - if (ret == -1) { - def->catchup.threshold = 0; - } else if (ret < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid catchup threshold")); + if (virXMLPropULongLong(catchup, "threshold", 10, VIR_XML_PROP_NONE, + &def->catchup.threshold) < 0) goto error; - } - ret = virXPathULong("string(./catchup/@slew)", ctxt, &def->catchup.slew); - if (ret == -1) { - def->catchup.slew = 0; - } else if (ret < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid catchup slew")); + if (virXMLPropULongLong(catchup, "slew", 10, VIR_XML_PROP_NONE, + &def->catchup.slew) < 0) goto error; - } - ret = virXPathULong("string(./catchup/@limit)", ctxt, &def->catchup.limit); - if (ret == -1) { - def->catchup.limit = 0; - } else if (ret < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("invalid catchup limit")); + if (virXMLPropULongLong(catchup, "limit", 10, VIR_XML_PROP_NONE, + &def->catchup.limit) < 0) goto error; - } } return def; @@ -24896,11 +24880,11 @@ virDomainTimerDefFormat(virBuffer *buf, } if (def->catchup.threshold > 0) - virBufferAsprintf(&catchupAttr, " threshold='%lu'", def->catchup.threshold); + virBufferAsprintf(&catchupAttr, " threshold='%llu'", def->catchup.threshold); if (def->catchup.slew > 0) - virBufferAsprintf(&catchupAttr, " slew='%lu'", def->catchup.slew); + virBufferAsprintf(&catchupAttr, " slew='%llu'", def->catchup.slew); if (def->catchup.limit > 0) - virBufferAsprintf(&catchupAttr, " limit='%lu'", def->catchup.limit); + virBufferAsprintf(&catchupAttr, " limit='%llu'", def->catchup.limit); virXMLFormatElement(&timerChld, "catchup", &catchupAttr, NULL); virXMLFormatElement(buf, "timer", &timerAttr, &timerChld); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8f8a54bc41..ba411bfa02 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2466,9 +2466,9 @@ struct _virDomainThreadSchedParam { }; struct _virDomainTimerCatchupDef { - unsigned long threshold; - unsigned long slew; - unsigned long limit; + unsigned long long threshold; + unsigned long long slew; + unsigned long long limit; }; struct _virDomainTimerDef {