[prev in list] [next in list] [prev in thread] [next in thread] 

List:       reiserfs-devel
Subject:    Re: [PATCH 6/6] vfs: change inode times to use struct timespec64
From:       Arnd Bergmann <arnd () arndb ! de>
Date:       2018-05-17 1:13:05
Message-ID: CAK8P3a0d6j2KF+pSZQ5uM3jQ7=OZQXnc+ZjPb--52kdBV=k_vQ () mail ! gmail ! com
[Download RAW message or body]

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
--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic