From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f66.google.com ([209.85.220.66]:35926 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752727AbcDHPrb (ORCPT ); Fri, 8 Apr 2016 11:47:31 -0400 Received: by mail-pa0-f66.google.com with SMTP id k3so5634099pav.3 for ; Fri, 08 Apr 2016 08:47:31 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org Cc: tglx@linutronix.de, arnd@arndb.de, viro@zeniv.linux.org.uk Subject: [PATCH 1/2] fs: Add current_fs_time_sec() function Date: Fri, 8 Apr 2016 08:47:10 -0700 Message-Id: <1460130431-7865-2-git-send-email-deepa.kernel@gmail.com> In-Reply-To: <1460130431-7865-1-git-send-email-deepa.kernel@gmail.com> References: <1460130431-7865-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This is in preparation for the series that transitions filesystem timestamps to use 64 bit time and hence make them y2038 safe. The function is meant to replace CURRENT_TIME_SEC macro. The macro CURRENT_TIME_SEC does not represent filesystem times correctly as it cannot perform range checks. current_fs_time_sec() will be extended to include these. CURRENT_TIME_SEC is also not y2038 safe. current_fs_time_sec() will be transitioned to use 64 bit time along with vfs in a separate series. The function is inline for now to maintain similar performance to that of the macro. The function takes super block as a parameter to allow for future range checking of filesystem timestamps. Signed-off-by: Deepa Dinamani --- include/linux/fs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/fs.h b/include/linux/fs.h index e3c0b7e..fc09058 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1435,6 +1435,11 @@ struct super_block { extern struct timespec current_fs_time(struct super_block *sb); +static inline struct timespec current_fs_time_sec(struct super_block *sb) +{ + return (struct timespec) { get_seconds(), 0 }; +} + /* * Snapshotting support. */ -- 1.9.1