With 4.18+ Linux kernels we see a transition to 64-bit time stamps by
default.
current_kernel_time() returns the 32-bit struct timespec.
current_kernel_time64() returns the 64-bit struct timespec64.
struct iattr->ia_ctime expects struct timespec64 as of 4.18+.
Timestamps greater than 31-bit rollover after
2147483647 or
January 19, 2038 03:14:07 UTC. This is the same approach taken by
the Linux developers for converting between timepsec64 and timespec.
Change-Id: Icc1cf5d1a6679f5c749f8720f225a9b293f675fd
Reviewed-on: https://gerrit.openafs.org/13241
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
#include "osi_compat.h"
#ifndef CURRENT_TIME
-#define CURRENT_TIME (current_kernel_time())
+# ifdef IATTR_TAKES_64BIT_TIME
+# define CURRENT_TIME (current_kernel_time64())
+# else
+# define CURRENT_TIME (current_kernel_time())
+# endif
#endif
int cache_fh_type = -1;
LINUX_D_PATH_TAKES_STRUCT_PATH
LINUX_NEW_EXPORT_OPS
LINUX_INODE_SETATTR_RETURN_TYPE
+LINUX_IATTR_64BIT_TIME
LINUX_IOP_I_CREATE_TAKES_NAMEIDATA
LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA
LINUX_IOP_I_PERMISSION_TAKES_FLAGS
[])
])
-
+AC_DEFUN([LINUX_IATTR_64BIT_TIME], [
+ AC_CHECK_LINUX_BUILD([whether struct iattr->ia_ctime takes struct timespec64 or 32-bit struct timespec],
+ [ac_cv_linux_func_iattr_ctime_takes_timespec64],
+ [#include <linux/fs.h>
+ #include <linux/timekeeping.h>],
+ [struct iattr _attrs;
+ _attrs.ia_ctime = current_kernel_time64();],
+ [IATTR_TAKES_64BIT_TIME],
+ [define if struct iattr->ia_ctime takes struct timespec64],
+ [])
+])
AC_DEFUN([LINUX_AOP_WRITEBACK_CONTROL], [
AC_CHECK_LINUX_BUILD([whether aop.writepage takes a writeback_control],