Re: [PATCH 25/73] staging/lustre: use 64-bit times in debug print

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 27 September 2015 23:57:30 Dilger, Andreas wrote:
> >diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c
> >b/drivers/staging/lustre/lustre/libcfs/debug.c
> >index e93f556..ae325f7 100644
> >--- a/drivers/staging/lustre/lustre/libcfs/debug.c
> >+++ b/drivers/staging/lustre/lustre/libcfs/debug.c
> >@@ -452,8 +452,8 @@ void libcfs_debug_dumplog_internal(void *arg)
> > 
> >       if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
> >               snprintf(debug_file_name, sizeof(debug_file_name) - 1,
> >-                       "%s.%ld.%ld", libcfs_debug_file_path_arr,
> >-                       get_seconds(), (long_ptr_t)arg);
> >+                       "%s.%lld.%ld", libcfs_debug_file_path_arr,
> >+                       (s64)ktime_get_real_seconds(), (long_ptr_t)arg);
> 
> One question about all of these patches - is "s64" always a "long long" or
> might it be just a "long" on some 64-bit platforms?

It's always 'long long' in the kernel, but always not in user space (ia64,
alpha, powerpc and mips). 

>  I recall times in the
> past where you needed to cast a __u64 to (unsigned long long) to avoid
> compiler warnings when using "%llu" in printk(), but maybe things have
> changed?  Otherwise, all of these patches need to be redone to cast the
> variables to "long long" before printing.

We fixed those a couple of years ago, and now we rely on s64 and u64 to
be 'long long' in a lot of places.

Reviewing what I did now, I find that a lot of the casts are actually
not needed, we only need it when printing the tv_sec portion of
a timespec64 (which is #defined to timespec with 'long tv_sec' on
64-bit architectures), but not for any of the plain time64_t variables,
which are already using 'long long'.

	Arnd
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux