From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f68.google.com ([209.85.214.68]:39938 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752076AbeENRZI (ORCPT ); Mon, 14 May 2018 13:25:08 -0400 MIME-Version: 1.0 In-Reply-To: References: <20180512045921.18311-1-deepa.kernel@gmail.com> <20180512045921.18311-7-deepa.kernel@gmail.com> From: Deepa Dinamani Date: Mon, 14 May 2018 10:25:06 -0700 Message-ID: Subject: Re: [PATCH 6/6] vfs: change inode times to use struct timespec64 To: Kees Cook Cc: Al Viro , Thomas Gleixner , Arnd Bergmann , LKML , "linux-fsdevel@vger.kernel.org" , y2038 Mailman List , anton@tuxera.com, Felipe Balbi , "J. Bruce Fields" , "Darrick J. Wong" , David Howells , David Sterba , David Woodhouse , Christoph Hellwig , OGAWA Hirofumi , Mike Marshall , Jan Kara , Jaegeuk Kim , Jan Harkes , Jiri Slaby , Mark Fasheh , Miklos Szeredi , Nicolas Pitre , reiserfs-devel@vger.kernel.org, Richard Weinberger , Sage Weil , Steve French , Steven Whitehouse , Tejun Heo , Trond Myklebust , "Ted Ts'o" Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, May 14, 2018 at 9:30 AM, Kees Cook wrote: > On Sun, May 13, 2018 at 9:05 PM, Deepa Dinamani wrote: >> Kees mentioned that he wants to merge a patch to pstore that changes >> it to use timespec64 internally for 4.17: >> https://lkml.org/lkml/2018/5/13/3 > > I'm still working on a v2 for pstore. What is the correct > cross-architecture format string for timespec64's tv_sec? In your > other patches, you're using %lld and a (long long) cast. I'd really > like to avoid the need for casts. We cannot really avoid it for now. struct timespec64 is defined this way for now: struct timespec { __kernel_time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #if __BITS_PER_LONG == 64 /* this trick allows us to optimize out timespec64_to_timespec */ # define timespec64 timespec #else struct timespec64 { time64_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #endif This will all lead to tv_sec being long on a 64 bit architecture and long long on a 32 bit architecture. So there is no way of avoiding the cast for now. We plan to get rid of this trick and to have a single definition for timespec64. But, that cleanup is planned for later when we cleanup all struct timespec uses internally. -Deepa