SHA256
1
0
forked from pool/openafs
openafs/Linux-4.20.patch
2019-01-21 16:15:53 +00:00

124 lines
4.3 KiB
Diff

commit 3c454b39d04f4886536267c211171dae30dc0344
Author: Mark Vitale <mvitale@sinenomine.net>
Date: Tue Nov 13 11:20:09 2018 -0500
Linux 4.20: current_kernel_time is gone
With Linux commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 'y2038:
remove unused time interfaces' (4.20-rc1), current_kernel_time() has
been removed.
Many y2038-compliant time APIs were introduced with Linux commit
fb7fcc96a86cfaef0f6dcc0665516aa68611e736 'timekeeping: Standardize on
ktime_get_*() naming' (4.18). According to
Documentation/core-api/timekeeping.rst, a suitable replacement for:
struct timespec current_kernel_time(void)
would be:
void ktime_get_coarse_real_ts64(struct timespec64 *ts))
Add an autoconf test and equivalent logic to deal.
Change-Id: I4ff622ad40cc6d398267276d13493d819b877350
Reviewed-on: https://gerrit.openafs.org/13391
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
index ce8cabf6e..a1a2f57c0 100644
--- a/src/afs/LINUX/osi_machdep.h
+++ b/src/afs/LINUX/osi_machdep.h
@@ -75,7 +75,14 @@
#if defined(HAVE_LINUX_CRED_H)
#include "h/cred.h"
#endif
-#if defined(HAVE_LINUX_CURRENT_KERNEL_TIME)
+
+#if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64)
+static inline time_t osi_Time(void) {
+ struct timespec64 xtime;
+ ktime_get_coarse_real_ts64(&xtime);
+ return xtime.tv_sec;
+}
+#elif defined(HAVE_LINUX_CURRENT_KERNEL_TIME)
static inline time_t osi_Time(void) {
struct timespec xtime;
xtime = current_kernel_time();
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index 0b17e172e..62fd528d6 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -72,6 +72,10 @@ AC_CHECK_LINUX_FUNC([iter_file_splice_write],
AC_CHECK_LINUX_FUNC([kernel_setsockopt],
[#include <linux/net.h>],
[kernel_setsockopt(NULL, 0, 0, NULL, 0);])
+AC_CHECK_LINUX_FUNC([ktime_get_coarse_real_ts64],
+ [#include <linux/time.h>],
+ [struct timespec64 *s;
+ ktime_get_coarse_real_ts64(s);])
AC_CHECK_LINUX_FUNC([locks_lock_file_wait],
[#include <linux/fs.h>],
[locks_lock_file_wait(NULL, NULL);])
commit aa80f892ec39e2984818090a6bb2047430836ee2
Author: Mark Vitale <mvitale@sinenomine.net>
Date: Thu Nov 15 15:31:37 2018 -0500
Linux 4.20: do_settimeofday is gone
With Linux commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8 'y2038:
remove unused time interfaces', do_settimeofday() is gone.
However, OpenAFS only calls do_settimeofday() from afs_osi_SetTime(),
which has been dead code since -settime support was removed from afsd
with commit 1d9888be486198868983048eeffabdfef5afa94b 'Remove
-settime/RXAFS_GetTime client support'.
Instead of fixing afs_osi_SetTime() to use a current Linux API, remove
it as dead code.
No functional change is incurred by this commit. However, this change
is required in order to build OpenAFS on Linux 4.20.
Change-Id: I74913deb249de66b0da71539f2596c971f0fd99a
Reviewed-on: https://gerrit.openafs.org/13392
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c
index 077d4edfb..655076779 100644
--- a/src/afs/LINUX/osi_misc.c
+++ b/src/afs/LINUX/osi_misc.c
@@ -28,18 +28,6 @@
int afs_osicred_initialized = 0;
afs_ucred_t afs_osi_cred;
-void
-afs_osi_SetTime(osi_timeval_t * tvp)
-{
- struct timespec tv;
- tv.tv_sec = tvp->tv_sec;
- tv.tv_nsec = tvp->tv_usec * NSEC_PER_USEC;
-
- AFS_STATCNT(osi_SetTime);
-
- do_settimeofday(&tv);
-}
-
void
osi_linux_mask(void)
{
diff --git a/src/afs/LINUX/osi_prototypes.h b/src/afs/LINUX/osi_prototypes.h
index 438b07789..130b5660e 100644
--- a/src/afs/LINUX/osi_prototypes.h
+++ b/src/afs/LINUX/osi_prototypes.h
@@ -44,7 +44,6 @@ extern void osi_ioctl_init(void);
extern void osi_ioctl_clean(void);
/* osi_misc.c */
-extern void afs_osi_SetTime(osi_timeval_t * tvp);
extern int osi_lookupname_internal(char *aname, int followlink,
struct vfsmount **mnt, struct dentry **dpp);
extern int osi_lookupname(char *aname, uio_seg_t seg, int followlink,