Messages in this thread | | | From | Arnd Bergmann <> | Date | Wed, 16 May 2018 21:13:05 -0400 | Subject | Re: [PATCH 6/6] vfs: change inode times to use struct timespec64 |
| |
On Mon, May 14, 2018 at 2:23 PM, Deepa Dinamani <deepa.kernel@gmail.com> wrote: > On Mon, May 14, 2018 at 10:53 AM, Kees Cook <keescook@chromium.org> wrote: >> On Mon, May 14, 2018 at 10:25 AM, Deepa Dinamani <deepa.kernel@gmail.com> wrote: >>> On Mon, May 14, 2018 at 9:30 AM, Kees Cook <keescook@chromium.org> wrote: >> >> Can we do something like: >> >> #if __BITS_PER_LONG == 64 >> # define TVSEC_FMT "%ld" >> #else >> # define TVSEC_FMT "%lld" >> #endif >> >> so we can do stuff like: sprintf(buf, "seconds: " KTIME_FMT, time->tv_sec) >> >> ? It seems easier to clean up than casts. > > We have already introduced these casts in many places now. > It would be easier to do the clean up if they all follow a similar > pattern. ( I could probably write a coccinelle script that is not very > long). > But, it would be not much trouble if you wanted to follow this for pstore. > > We also contemplated adding a format specifier for time. But, I think > we deferred it until we have a uniform way of using time internally.
I have recently submitted a patch to completely remove the hack that leads to 'timespec64' and 'timespec' being aliases for the same type on 64-bit architectures. Once that goes in, we can just remove the type casts that got added over time, and won't need a format macro.
Arnd
| |