diff mbox series

[3/3] reiserfs: use 64-bit values in print_time

Message ID 20180619154343.3640484-3-arnd@arndb.de
State New
Headers show
Series [1/3] reiserfs: remove unused j_timestamp | expand

Commit Message

Arnd Bergmann June 19, 2018, 3:43 p.m. UTC
Inode timestamps are now 64-bit wide even on 32-bit machines, and reiserfs
interprets the 32-bit on-disk timestamps as unsigned when returning them
to user space with statx(), so for consistency we should print them
the same way in the emergency console logs.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 fs/reiserfs/item_ops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.9.0

Comments

Jan Kara June 20, 2018, 8:28 a.m. UTC | #1
On Tue 19-06-18 17:43:15, Arnd Bergmann wrote:
> Inode timestamps are now 64-bit wide even on 32-bit machines, and reiserfs

> interprets the 32-bit on-disk timestamps as unsigned when returning them

> to user space with statx(), so for consistency we should print them

> the same way in the emergency console logs.

> 

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

...
> diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c

> index e3c558d1b78c..d0ab3a763962 100644

> --- a/fs/reiserfs/item_ops.c

> +++ b/fs/reiserfs/item_ops.c

> @@ -33,11 +33,11 @@ static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize)

>  	return 0;

>  }

>  

> -static char *print_time(time_t t)

> +static char *print_time(time64_t t)

>  {

>  	static char timebuf[256];

>  

> -	sprintf(timebuf, "%ld", t);

> +	sprintf(timebuf, "%lld", t);

>  	return timebuf;

>  }


Well, seeing how print_time() is used, more appropriate prototype would be:

static char *print_time(u32 t)

and then print it as %u.

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
diff mbox series

Patch

diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index e3c558d1b78c..d0ab3a763962 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -33,11 +33,11 @@  static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize)
 	return 0;
 }
 
-static char *print_time(time_t t)
+static char *print_time(time64_t t)
 {
 	static char timebuf[256];
 
-	sprintf(timebuf, "%ld", t);
+	sprintf(timebuf, "%lld", t);
 	return timebuf;
 }