[libvirt] [PATCH v2] time_t is not a long on FreeBSD, switch internal type to long long

--- v2: switch internal type to long long instead of adding casts for time_t src/conf/domain_conf.c | 8 ++++---- src/conf/domain_conf.h | 2 +- src/esx/esx_vi_types.c | 2 +- src/esx/esx_vi_types.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3f2fb11..8ff155b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9183,7 +9183,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr, def->name = virXPathString("string(./name)", ctxt); if (def->name == NULL) - ignore_value(virAsprintf(&def->name, "%ld", tv.tv_sec)); + ignore_value(virAsprintf(&def->name, "%lld", (long long)tv.tv_sec)); if (def->name == NULL) { virReportOOMError(); @@ -9193,8 +9193,8 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseString(const char *xmlStr, def->description = virXPathString("string(./description)", ctxt); if (!newSnapshot) { - if (virXPathLong("string(./creationTime)", ctxt, - &def->creationTime) < 0) { + if (virXPathLongLong("string(./creationTime)", ctxt, + &def->creationTime) < 0) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing creationTime from existing snapshot")); goto cleanup; @@ -9259,7 +9259,7 @@ char *virDomainSnapshotDefFormat(char *domain_uuid, virBufferAsprintf(&buf, " <name>%s</name>\n", def->parent); virBufferAddLit(&buf, " </parent>\n"); } - virBufferAsprintf(&buf, " <creationTime>%ld</creationTime>\n", + virBufferAsprintf(&buf, " <creationTime>%lld</creationTime>\n", def->creationTime); virBufferAddLit(&buf, " <domain>\n"); virBufferAsprintf(&buf, " <uuid>%s</uuid>\n", domain_uuid); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9d4349e..d4245d8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1042,7 +1042,7 @@ struct _virDomainSnapshotDef { char *name; char *description; char *parent; - time_t creationTime; + long long creationTime; /* in seconds */ int state; long active; diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index c689ab0..2332fde 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -1402,7 +1402,7 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime) int esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, - time_t *secondsSinceEpoch) + long long *secondsSinceEpoch) { char value[64] = ""; char *tmp; diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h index d141a38..3d843bf 100644 --- a/src/esx/esx_vi_types.h +++ b/src/esx/esx_vi_types.h @@ -264,7 +264,7 @@ int esxVI_DateTime_Serialize(esxVI_DateTime *dateTime, const char *element, virBufferPtr output); int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime); int esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime, - time_t *secondsSinceEpoch); + long long *secondsSinceEpoch); -- 1.7.0.4

On 05/25/2011 09:05 AM, Matthias Bolte wrote:
--- v2: switch internal type to long long instead of adding casts for time_t
src/conf/domain_conf.c | 8 ++++---- src/conf/domain_conf.h | 2 +- src/esx/esx_vi_types.c | 2 +- src/esx/esx_vi_types.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2011/5/25 Eric Blake <eblake@redhat.com>:
On 05/25/2011 09:05 AM, Matthias Bolte wrote:
--- v2: switch internal type to long long instead of adding casts for time_t
src/conf/domain_conf.c | 8 ++++---- src/conf/domain_conf.h | 2 +- src/esx/esx_vi_types.c | 2 +- src/esx/esx_vi_types.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
ACK.
I missed to fix the test case to the esxVI_DateTime_ConvertToCalendarTime function, so fold this in before pushing. diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c index 2b36535..51c1e34 100644 --- a/tests/esxutilstest.c +++ b/tests/esxutilstest.c @@ -169,7 +169,7 @@ testParseDatastorePath(const void *data ATTRIBUTE_UNUSED) struct testDateTime { const char *dateTime; - time_t calendarTime; + long long calendarTime; }; static struct testDateTime times[] = { @@ -205,7 +205,7 @@ testConvertDateTimeToCalendarTime(const void *data ATTRIBUTE_UNUSED) { int i; esxVI_DateTime dateTime; - time_t calendarTime; + long long calendarTime; for (i = 0; i < ARRAY_CARDINALITY(times); ++i) { dateTime.value = (char *)times[i].dateTime; Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte