Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

y2038: remove unused time32 interfaces

No users remain, so kill these off before we grow new ones.

Link: http://lkml.kernel.org/r/20200110154232.4104492-3-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Linus Torvalds
412c53a6 595abbaf

+1 -326
-29
include/linux/compat.h
··· 248 248 } _sifields; 249 249 } compat_siginfo_t; 250 250 251 - /* 252 - * These functions operate on 32- or 64-bit specs depending on 253 - * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments. 254 - */ 255 - extern int compat_get_timespec(struct timespec *, const void __user *); 256 - extern int compat_put_timespec(const struct timespec *, void __user *); 257 - extern int compat_get_timeval(struct timeval *, const void __user *); 258 - extern int compat_put_timeval(const struct timeval *, void __user *); 259 - 260 251 struct compat_iovec { 261 252 compat_uptr_t iov_base; 262 253 compat_size_t iov_len; ··· 406 415 int copy_siginfo_to_user32(struct compat_siginfo __user *to, const kernel_siginfo_t *from); 407 416 int get_compat_sigevent(struct sigevent *event, 408 417 const struct compat_sigevent __user *u_event); 409 - 410 - static inline int old_timeval32_compare(struct old_timeval32 *lhs, 411 - struct old_timeval32 *rhs) 412 - { 413 - if (lhs->tv_sec < rhs->tv_sec) 414 - return -1; 415 - if (lhs->tv_sec > rhs->tv_sec) 416 - return 1; 417 - return lhs->tv_usec - rhs->tv_usec; 418 - } 419 - 420 - static inline int old_timespec32_compare(struct old_timespec32 *lhs, 421 - struct old_timespec32 *rhs) 422 - { 423 - if (lhs->tv_sec < rhs->tv_sec) 424 - return -1; 425 - if (lhs->tv_sec > rhs->tv_sec) 426 - return 1; 427 - return lhs->tv_nsec - rhs->tv_nsec; 428 - } 429 418 430 419 extern int get_compat_sigset(sigset_t *set, const compat_sigset_t __user *compat); 431 420
+1 -153
include/linux/time32.h
··· 12 12 #include <linux/time64.h> 13 13 #include <linux/timex.h> 14 14 15 - #define TIME_T_MAX (__kernel_old_time_t)((1UL << ((sizeof(__kernel_old_time_t) << 3) - 1)) - 1) 16 - 17 15 typedef s32 old_time32_t; 18 16 19 17 struct old_timespec32 { ··· 71 73 int get_old_timex32(struct __kernel_timex *, const struct old_timex32 __user *); 72 74 int put_old_timex32(struct old_timex32 __user *, const struct __kernel_timex *); 73 75 74 - #if __BITS_PER_LONG == 64 75 - 76 - /* timespec64 is defined as timespec here */ 77 - static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) 78 - { 79 - return *(const struct timespec *)&ts64; 80 - } 81 - 82 - static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) 83 - { 84 - return *(const struct timespec64 *)&ts; 85 - } 86 - 87 - #else 88 - static inline struct timespec timespec64_to_timespec(const struct timespec64 ts64) 89 - { 90 - struct timespec ret; 91 - 92 - ret.tv_sec = (time_t)ts64.tv_sec; 93 - ret.tv_nsec = ts64.tv_nsec; 94 - return ret; 95 - } 96 - 97 - static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) 98 - { 99 - struct timespec64 ret; 100 - 101 - ret.tv_sec = ts.tv_sec; 102 - ret.tv_nsec = ts.tv_nsec; 103 - return ret; 104 - } 105 - #endif 106 - 107 - static inline int timespec_equal(const struct timespec *a, 108 - const struct timespec *b) 109 - { 110 - return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 111 - } 112 - 113 - /* 114 - * lhs < rhs: return <0 115 - * lhs == rhs: return 0 116 - * lhs > rhs: return >0 117 - */ 118 - static inline int timespec_compare(const struct timespec *lhs, const struct timespec *rhs) 119 - { 120 - if (lhs->tv_sec < rhs->tv_sec) 121 - return -1; 122 - if (lhs->tv_sec > rhs->tv_sec) 123 - return 1; 124 - return lhs->tv_nsec - rhs->tv_nsec; 125 - } 126 - 127 - /* 128 - * Returns true if the timespec is norm, false if denorm: 129 - */ 130 - static inline bool timespec_valid(const struct timespec *ts) 131 - { 132 - /* Dates before 1970 are bogus */ 133 - if (ts->tv_sec < 0) 134 - return false; 135 - /* Can't have more nanoseconds then a second */ 136 - if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC) 137 - return false; 138 - return true; 139 - } 140 - 141 76 /** 142 - * timespec_to_ns - Convert timespec to nanoseconds 143 - * @ts: pointer to the timespec variable to be converted 144 - * 145 - * Returns the scalar nanosecond representation of the timespec 146 - * parameter. 147 - */ 148 - static inline s64 timespec_to_ns(const struct timespec *ts) 149 - { 150 - return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; 151 - } 152 - 153 - /** 154 - * ns_to_timespec - Convert nanoseconds to timespec 155 - * @nsec: the nanoseconds value to be converted 156 - * 157 - * Returns the timespec representation of the nsec parameter. 158 - */ 159 - extern struct timespec ns_to_timespec(const s64 nsec); 160 - 161 - /** 162 - * timespec_add_ns - Adds nanoseconds to a timespec 163 - * @a: pointer to timespec to be incremented 164 - * @ns: unsigned nanoseconds value to be added 165 - * 166 - * This must always be inlined because its used from the x86-64 vdso, 167 - * which cannot call other kernel functions. 168 - */ 169 - static __always_inline void timespec_add_ns(struct timespec *a, u64 ns) 170 - { 171 - a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns); 172 - a->tv_nsec = ns; 173 - } 174 - 175 - static inline unsigned long mktime(const unsigned int year, 176 - const unsigned int mon, const unsigned int day, 177 - const unsigned int hour, const unsigned int min, 178 - const unsigned int sec) 179 - { 180 - return mktime64(year, mon, day, hour, min, sec); 181 - } 182 - 183 - static inline bool timeval_valid(const struct timeval *tv) 184 - { 185 - /* Dates before 1970 are bogus */ 186 - if (tv->tv_sec < 0) 187 - return false; 188 - 189 - /* Can't have more microseconds then a second */ 190 - if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) 191 - return false; 192 - 193 - return true; 194 - } 195 - 196 - /** 197 - * timeval_to_ns - Convert timeval to nanoseconds 198 - * @ts: pointer to the timeval variable to be converted 199 - * 200 - * Returns the scalar nanosecond representation of the timeval 201 - * parameter. 202 - */ 203 - static inline s64 timeval_to_ns(const struct timeval *tv) 204 - { 205 - return ((s64) tv->tv_sec * NSEC_PER_SEC) + 206 - tv->tv_usec * NSEC_PER_USEC; 207 - } 208 - 209 - /** 210 - * ns_to_timeval - Convert nanoseconds to timeval 77 + * ns_to_kernel_old_timeval - Convert nanoseconds to timeval 211 78 * @nsec: the nanoseconds value to be converted 212 79 * 213 80 * Returns the timeval representation of the nsec parameter. 214 81 */ 215 - extern struct timeval ns_to_timeval(const s64 nsec); 216 82 extern struct __kernel_old_timeval ns_to_kernel_old_timeval(s64 nsec); 217 - 218 - /* 219 - * Old names for the 32-bit time_t interfaces, these will be removed 220 - * when everything uses the new names. 221 - */ 222 - #define compat_time_t old_time32_t 223 - #define compat_timeval old_timeval32 224 - #define compat_timespec old_timespec32 225 - #define compat_itimerspec old_itimerspec32 226 - #define ns_to_compat_timeval ns_to_old_timeval32 227 - #define get_compat_itimerspec64 get_old_itimerspec32 228 - #define put_compat_itimerspec64 put_old_itimerspec32 229 - #define compat_get_timespec64 get_old_timespec32 230 - #define compat_put_timespec64 put_old_timespec32 231 83 232 84 #endif
-32
include/linux/timekeeping32.h
··· 11 11 return ktime_get_real_seconds(); 12 12 } 13 13 14 - static inline void getnstimeofday(struct timespec *ts) 15 - { 16 - struct timespec64 ts64; 17 - 18 - ktime_get_real_ts64(&ts64); 19 - *ts = timespec64_to_timespec(ts64); 20 - } 21 - 22 - static inline void ktime_get_ts(struct timespec *ts) 23 - { 24 - struct timespec64 ts64; 25 - 26 - ktime_get_ts64(&ts64); 27 - *ts = timespec64_to_timespec(ts64); 28 - } 29 - 30 - static inline void getrawmonotonic(struct timespec *ts) 31 - { 32 - struct timespec64 ts64; 33 - 34 - ktime_get_raw_ts64(&ts64); 35 - *ts = timespec64_to_timespec(ts64); 36 - } 37 - 38 - static inline void getboottime(struct timespec *ts) 39 - { 40 - struct timespec64 ts64; 41 - 42 - getboottime64(&ts64); 43 - *ts = timespec64_to_timespec(ts64); 44 - } 45 - 46 14 #endif
-5
include/linux/types.h
··· 65 65 typedef __kernel_ptrdiff_t ptrdiff_t; 66 66 #endif 67 67 68 - #ifndef _TIME_T 69 - #define _TIME_T 70 - typedef __kernel_old_time_t time_t; 71 - #endif 72 - 73 68 #ifndef _CLOCK_T 74 69 #define _CLOCK_T 75 70 typedef __kernel_clock_t clock_t;
-64
kernel/compat.c
··· 26 26 27 27 #include <linux/uaccess.h> 28 28 29 - static int __compat_get_timeval(struct timeval *tv, const struct old_timeval32 __user *ctv) 30 - { 31 - return (!access_ok(ctv, sizeof(*ctv)) || 32 - __get_user(tv->tv_sec, &ctv->tv_sec) || 33 - __get_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; 34 - } 35 - 36 - static int __compat_put_timeval(const struct timeval *tv, struct old_timeval32 __user *ctv) 37 - { 38 - return (!access_ok(ctv, sizeof(*ctv)) || 39 - __put_user(tv->tv_sec, &ctv->tv_sec) || 40 - __put_user(tv->tv_usec, &ctv->tv_usec)) ? -EFAULT : 0; 41 - } 42 - 43 - static int __compat_get_timespec(struct timespec *ts, const struct old_timespec32 __user *cts) 44 - { 45 - return (!access_ok(cts, sizeof(*cts)) || 46 - __get_user(ts->tv_sec, &cts->tv_sec) || 47 - __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; 48 - } 49 - 50 - static int __compat_put_timespec(const struct timespec *ts, struct old_timespec32 __user *cts) 51 - { 52 - return (!access_ok(cts, sizeof(*cts)) || 53 - __put_user(ts->tv_sec, &cts->tv_sec) || 54 - __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; 55 - } 56 - 57 - int compat_get_timeval(struct timeval *tv, const void __user *utv) 58 - { 59 - if (COMPAT_USE_64BIT_TIME) 60 - return copy_from_user(tv, utv, sizeof(*tv)) ? -EFAULT : 0; 61 - else 62 - return __compat_get_timeval(tv, utv); 63 - } 64 - EXPORT_SYMBOL_GPL(compat_get_timeval); 65 - 66 - int compat_put_timeval(const struct timeval *tv, void __user *utv) 67 - { 68 - if (COMPAT_USE_64BIT_TIME) 69 - return copy_to_user(utv, tv, sizeof(*tv)) ? -EFAULT : 0; 70 - else 71 - return __compat_put_timeval(tv, utv); 72 - } 73 - EXPORT_SYMBOL_GPL(compat_put_timeval); 74 - 75 - int compat_get_timespec(struct timespec *ts, const void __user *uts) 76 - { 77 - if (COMPAT_USE_64BIT_TIME) 78 - return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; 79 - else 80 - return __compat_get_timespec(ts, uts); 81 - } 82 - EXPORT_SYMBOL_GPL(compat_get_timespec); 83 - 84 - int compat_put_timespec(const struct timespec *ts, void __user *uts) 85 - { 86 - if (COMPAT_USE_64BIT_TIME) 87 - return copy_to_user(uts, ts, sizeof(*ts)) ? -EFAULT : 0; 88 - else 89 - return __compat_put_timespec(ts, uts); 90 - } 91 - EXPORT_SYMBOL_GPL(compat_put_timespec); 92 - 93 29 #ifdef __ARCH_WANT_SYS_SIGPROCMASK 94 30 95 31 /*
-43
kernel/time/time.c
··· 449 449 } 450 450 EXPORT_SYMBOL(mktime64); 451 451 452 - /** 453 - * ns_to_timespec - Convert nanoseconds to timespec 454 - * @nsec: the nanoseconds value to be converted 455 - * 456 - * Returns the timespec representation of the nsec parameter. 457 - */ 458 - struct timespec ns_to_timespec(const s64 nsec) 459 - { 460 - struct timespec ts; 461 - s32 rem; 462 - 463 - if (!nsec) 464 - return (struct timespec) {0, 0}; 465 - 466 - ts.tv_sec = div_s64_rem(nsec, NSEC_PER_SEC, &rem); 467 - if (unlikely(rem < 0)) { 468 - ts.tv_sec--; 469 - rem += NSEC_PER_SEC; 470 - } 471 - ts.tv_nsec = rem; 472 - 473 - return ts; 474 - } 475 - EXPORT_SYMBOL(ns_to_timespec); 476 - 477 - /** 478 - * ns_to_timeval - Convert nanoseconds to timeval 479 - * @nsec: the nanoseconds value to be converted 480 - * 481 - * Returns the timeval representation of the nsec parameter. 482 - */ 483 - struct timeval ns_to_timeval(const s64 nsec) 484 - { 485 - struct timespec ts = ns_to_timespec(nsec); 486 - struct timeval tv; 487 - 488 - tv.tv_sec = ts.tv_sec; 489 - tv.tv_usec = (suseconds_t) ts.tv_nsec / 1000; 490 - 491 - return tv; 492 - } 493 - EXPORT_SYMBOL(ns_to_timeval); 494 - 495 452 struct __kernel_old_timeval ns_to_kernel_old_timeval(const s64 nsec) 496 453 { 497 454 struct timespec64 ts = ns_to_timespec64(nsec);