summaryrefslogtreecommitdiffstats
path: root/include/linux/time32.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-07-13 06:52:28 -0400
committerArnd Bergmann <arnd@arndb.de>2018-08-27 08:48:48 -0400
commit9afc5eee65ca7d717a99d6fe8f4adfe32a40940a (patch)
tree4e5585234e71076c0a5a470b157e0b9de96b8da6 /include/linux/time32.h
parent33e26418193f58d1895f2f968e1953b1caf8deb7 (diff)
y2038: globally rename compat_time to old_time32
Christoph Hellwig suggested a slightly different path for handling backwards compatibility with the 32-bit time_t based system calls: Rather than simply reusing the compat_sys_* entry points on 32-bit architectures unchanged, we get rid of those entry points and the compat_time types by renaming them to something that makes more sense on 32-bit architectures (which don't have a compat mode otherwise), and then share the entry points under the new name with the 64-bit architectures that use them for implementing the compatibility. The following types and interfaces are renamed here, and moved from linux/compat_time.h to linux/time32.h: old new --- --- compat_time_t old_time32_t struct compat_timeval struct old_timeval32 struct compat_timespec struct old_timespec32 struct compat_itimerspec struct old_itimerspec32 ns_to_compat_timeval() ns_to_old_timeval32() get_compat_itimerspec64() get_old_itimerspec32() put_compat_itimerspec64() put_old_itimerspec32() compat_get_timespec64() get_old_timespec32() compat_put_timespec64() put_old_timespec32() As we already have aliases in place, this patch addresses only the instances that are relevant to the system call interface in particular, not those that occur in device drivers and other modules. Those will get handled separately, while providing the 64-bit version of the respective interfaces. I'm not renaming the timex, rusage and itimerval structures, as we are still debating what the new interface will look like, and whether we will need a replacement at all. This also doesn't change the names of the syscall entry points, which can be done more easily when we actually switch over the 32-bit architectures to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix. Suggested-by: Christoph Hellwig <hch@infradead.org> Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/ Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include/linux/time32.h')
-rw-r--r--include/linux/time32.h48
1 files changed, 36 insertions, 12 deletions
diff --git a/include/linux/time32.h b/include/linux/time32.h
index 92c0ca092d93..0e0d7304d1a8 100644
--- a/include/linux/time32.h
+++ b/include/linux/time32.h
@@ -13,6 +13,31 @@
13 13
14#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1) 14#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
15 15
16typedef s32 old_time32_t;
17
18struct old_timespec32 {
19 old_time32_t tv_sec;
20 s32 tv_nsec;
21};
22
23struct old_timeval32 {
24 old_time32_t tv_sec;
25 s32 tv_usec;
26};
27
28struct old_itimerspec32 {
29 struct old_timespec32 it_interval;
30 struct old_timespec32 it_value;
31};
32
33extern int get_old_timespec32(struct timespec64 *, const void __user *);
34extern int put_old_timespec32(const struct timespec64 *, void __user *);
35extern int get_old_itimerspec32(struct itimerspec64 *its,
36 const struct old_itimerspec32 __user *uits);
37extern int put_old_itimerspec32(const struct itimerspec64 *its,
38 struct old_itimerspec32 __user *uits);
39
40
16#if __BITS_PER_LONG == 64 41#if __BITS_PER_LONG == 64
17 42
18/* timespec64 is defined as timespec here */ 43/* timespec64 is defined as timespec here */
@@ -183,18 +208,17 @@ extern struct timeval ns_to_timeval(const s64 nsec);
183extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec); 208extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec);
184 209
185/* 210/*
186 * New aliases for compat time functions. These will be used to replace 211 * Old names for the 32-bit time_t interfaces, these will be removed
187 * the compat code so it can be shared between 32-bit and 64-bit builds 212 * when everything uses the new names.
188 * both of which provide compatibility with old 32-bit tasks.
189 */ 213 */
190#define old_time32_t compat_time_t 214#define compat_time_t old_time32_t
191#define old_timeval32 compat_timeval 215#define compat_timeval old_timeval32
192#define old_timespec32 compat_timespec 216#define compat_timespec old_timespec32
193#define old_itimerspec32 compat_itimerspec 217#define compat_itimerspec old_itimerspec32
194#define ns_to_old_timeval32 ns_to_compat_timeval 218#define ns_to_compat_timeval ns_to_old_timeval32
195#define get_old_itimerspec32 get_compat_itimerspec64 219#define get_compat_itimerspec64 get_old_itimerspec32
196#define put_old_itimerspec32 put_compat_itimerspec64 220#define put_compat_itimerspec64 put_old_itimerspec32
197#define get_old_timespec32 compat_get_timespec64 221#define compat_get_timespec64 get_old_timespec32
198#define put_old_timespec32 compat_put_timespec64 222#define compat_put_timespec64 put_old_timespec32
199 223
200#endif 224#endif