diff mbox series

[04/26] libfrog: convert cvttime to return time64_t

Message ID 160375527139.881414.6476607474654532506.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfsprogs: widen timestamps to deal with y2038 | expand

Commit Message

Darrick J. Wong Oct. 26, 2020, 11:34 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Change the cvttime function to return 64-bit time values so that we can
put them to use with the bigtime feature.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libfrog/convert.c |    6 +++---
 libfrog/convert.h |    2 +-
 quota/edit.c      |   14 +++++++-------
 3 files changed, 11 insertions(+), 11 deletions(-)

Comments

Christoph Hellwig Oct. 29, 2020, 9:45 a.m. UTC | #1
On Mon, Oct 26, 2020 at 04:34:31PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Change the cvttime function to return 64-bit time values so that we can
> put them to use with the bigtime feature.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/libfrog/convert.c b/libfrog/convert.c
index 6b8ff30de24a..0ceeb389682a 100644
--- a/libfrog/convert.c
+++ b/libfrog/convert.c
@@ -271,14 +271,14 @@  cvtstr(
 #define DAYS_TO_SECONDS(d)	((d) * HOURS_TO_SECONDS(24))
 #define WEEKS_TO_SECONDS(w)	((w) * DAYS_TO_SECONDS(7))
 
-unsigned long
+time64_t
 cvttime(
 	char		*s)
 {
-	unsigned long	i;
+	time64_t	i;
 	char		*sp;
 
-	i = strtoul(s, &sp, 0);
+	i = strtoll(s, &sp, 0);
 	if (i == 0 && sp == s)
 		return 0;
 	if (*sp == '\0')
diff --git a/libfrog/convert.h b/libfrog/convert.h
index b307d31ce955..3e5fbe055986 100644
--- a/libfrog/convert.h
+++ b/libfrog/convert.h
@@ -16,7 +16,7 @@  extern uint16_t	cvt_u16(char *s, int base);
 
 extern long long cvtnum(size_t blocksize, size_t sectorsize, const char *s);
 extern void cvtstr(double value, char *str, size_t sz);
-extern unsigned long cvttime(char *s);
+extern time64_t cvttime(char *s);
 
 extern uid_t	uid_from_string(char *user);
 extern gid_t	gid_from_string(char *group);
diff --git a/quota/edit.c b/quota/edit.c
index 01d358f740c8..b3cad024b1f1 100644
--- a/quota/edit.c
+++ b/quota/edit.c
@@ -419,13 +419,13 @@  restore_f(
 
 static void
 set_timer(
-	uint32_t	id,
-	uint		type,
-	uint		mask,
-	char		*dev,
-	uint		value)
+	uint32_t		id,
+	uint			type,
+	uint			mask,
+	char			*dev,
+	time64_t		value)
 {
-	fs_disk_quota_t	d;
+	struct fs_disk_quota	d;
 
 	memset(&d, 0, sizeof(d));
 
@@ -476,7 +476,7 @@  timer_f(
 	int		argc,
 	char		**argv)
 {
-	uint		value;
+	time64_t	value;
 	char		*name = NULL;
 	uint32_t	id = 0;
 	int		c, flags = 0, type = 0, mask = 0;