1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
From d579410ca62ad161b774509fb261e28b4f2326bb Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 18 Jan 2019 17:22:44 -0700
Subject: [PATCH 5/5] Linux_5.0: replaced current_kernel_time with
ktime_get_coarse_real_ts64
In Kernel commit fb7fcc96a86cfaef0f6dcc0665516aa68611e736 the
current_kernel_time/current_kernel_time64 functions where renamed
and the calling was standardized.
According to the Linux Documentation/core-api/timekeeping.rst
ktime_get_coarse_real_ts64 is the direct replacement for
current_kernel_time64. Because of year 2038 issues, there is no
replacement for current_kernel_time.
Updated code that used current_kernel_time to use new name and calling
convention.
Updated autoconf test that sets IATTR_TAKES_64BIT_TIME as well.
Reviewed-on: https://gerrit.openafs.org/13434
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 21ad6a0c826c150c4227ece50554101641ab4626)
Change-Id: Idb8a2c1b74835601fb1fc699c3ebbcee75c94e3e
Reviewed-on: https://gerrit.openafs.org/13442
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
---
src/afs/LINUX/osi_file.c | 14 ++++++++++----
src/cf/linux-test4.m4 | 7 ++++++-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c
index fd68b16b3..35cf703cf 100644
--- a/src/afs/LINUX/osi_file.c
+++ b/src/afs/LINUX/osi_file.c
@@ -23,11 +23,17 @@
#include "osi_compat.h"
#ifndef CURRENT_TIME
-# ifdef IATTR_TAKES_64BIT_TIME
-# define CURRENT_TIME (current_kernel_time64())
+# if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64)
+# define AFS_CURRENT_TIME(x) (ktime_get_coarse_real_ts64((x)))
# else
-# define CURRENT_TIME (current_kernel_time())
+# ifdef IATTR_TAKES_64BIT_TIME
+# define AFS_CURRENT_TIME(x) do {*(x) = current_kernel_time64();} while (0)
+# else
+# define AFS_CURRENT_TIME(x) do {*(x) = current_kernel_time();} while (0)
+# endif
# endif
+#else
+# define AFS_CURRENT_TIME(x) do {*(x) = CURRENT_TIME;} while(0)
#endif
int cache_fh_type = -1;
@@ -200,7 +206,7 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
#endif
newattrs.ia_size = asize;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
- newattrs.ia_ctime = CURRENT_TIME;
+ AFS_CURRENT_TIME(&newattrs.ia_ctime);
/* avoid notify_change() since it wants to update dentry->d_parent */
#ifdef HAVE_LINUX_SETATTR_PREPARE
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
index 50b8a0ede..cf8205675 100644
--- a/src/cf/linux-test4.m4
+++ b/src/cf/linux-test4.m4
@@ -189,7 +189,12 @@ AC_DEFUN([LINUX_IATTR_64BIT_TIME], [
[#include <linux/fs.h>
#include <linux/timekeeping.h>],
[struct iattr _attrs;
- _attrs.ia_ctime = current_kernel_time64();],
+ #if defined(HAVE_LINUX_KTIME_GET_COARSE_REAL_TS64)
+ ktime_get_coarse_real_ts64(&_attrs.ia_ctime);
+ #else
+ _attrs.ia_ctime = current_kernel_time64();
+ #endif
+ ],
[IATTR_TAKES_64BIT_TIME],
[define if struct iattr->ia_ctime takes struct timespec64],
[])
--
2.20.1
|