y2038: remove unused interfaces
Subsystems (3)
Arnd Bergmann
maintainercover y2038: remove unused interfaces
Hi Andrew,
Can you add these to your patches for linux-5.6?
I have y2038 cleanups for sound, v4l, nfsd, scsi and xfs that are merged in the respective subsystem trees, as well as another series of individual patches queued up in my own y2038 tree.
With all that work merged, most of include/linux/time32.h and some other related code can be removed from the kernel, so it would be good to send these at the end of the coming merge window, and to give them some more testing in linux-next to make sure we don't gain any new users.
Arnd
Arnd Bergmann (3):
y2038: remove ktime to/from timespec/timeval conversion
y2038: remove unused time32 interfaces
y2038: hide timeval/timespec/itimerval/itimerspec types
include/linux/compat.h | 29 ----- include/linux/ktime.h | 37 ------ include/linux/time32.h | 154 +------------------------ include/linux/timekeeping32.h | 32 ----- include/linux/types.h | 5 - include/uapi/asm-generic/posix_types.h | 2 + include/uapi/linux/time.h | 22 ++-- kernel/compat.c | 64 ---------- kernel/time/time.c | 43 ------- 9 files changed, 15 insertions(+), 373 deletions(-)
Signature · 5 lines
Cc: [email protected] Cc: [email protected] Cc: Thomas Gleixner <[email protected]> Cc: Deepa Dinamani <[email protected]> 2.20.0
Arnd Bergmann
maintainerPATCH 1/3 y2038: remove ktime to/from timespec/timeval conversion
A couple of helpers are now obsolete and can be removed, so drivers can no longer start using them and instead use y2038-safe interfaces.
--- include/linux/ktime.h | 37 ------------------------------------- 1 file changed, 37 deletions(-)
include/linux/ktime.h +0 -37
@@ -66,33 +66,15 @@ static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs)*/ #define ktime_sub_ns (kt, nsval) ((kt) - (nsval)) -/* convert a timespec to ktime_t format: */ -static inline ktime_t timespec_to_ktime (struct timespec ts) -{ -return ktime_set (ts.tv_sec, ts.tv_nsec); -} -/* convert a timespec64 to ktime_t format: */ static inline ktime_t timespec64_to_ktime (struct timespec64 ts) {return ktime_set (ts.tv_sec, ts.tv_nsec); } -/* convert a timeval to ktime_t format: */ -static inline ktime_t timeval_to_ktime (struct timeval tv) -{ -return ktime_set (tv.tv_sec, tv.tv_usec *NSEC_PER_USEC ); -} - -/* Map the ktime_t to timespec conversion to ns_to_timespec function */ -#define ktime_to_timespec (kt) ns_to_timespec((kt)) -/* Map the ktime_t to timespec conversion to ns_to_timespec function */ #define ktime_to_timespec64 (kt) ns_to_timespec64((kt)) -/* Map the ktime_t to timeval conversion to ns_to_timeval function */ -#define ktime_to_timeval (kt) ns_to_timeval((kt)) -/* Convert ktime_t to nanoseconds */ static inline s64 ktime_to_ns (const ktime_t kt) {
@@ -215,25 +197,6 @@ static inline ktime_t ktime_sub_ms(const ktime_t kt, const u64 msec)extern ktime_t ktime_add_safe (const ktime_t lhs,const ktime_t rhs); -/** -* ktime_to_timespec_cond - convert a ktime_t variable to timespec -* format only if the variable contains data -* @kt: the ktime_t variable to convert -* @ts: the timespec variable to store the result in -* -* Return: %true if there was a successful conversion, %false if kt was 0. -*/ -static inline __must_check bool ktime_to_timespec_cond (const ktime_t kt, -struct timespec *ts) -{ -if (kt) { - *ts =ktime_to_timespec (kt); -return true; - }else { -return false; - } -} -/** * ktime_to_timespec64_cond - convert a ktime_t variable to timespec64 * format only if the variable contains data
Signature · 1 line
2.20.0
Re: [PATCH 1/3] y2038: remove ktime to/from timespec/timeval conversion
Quoted 4 lines · Arnd Bergmann
A couple of helpers are now obsolete and can be removed, so drivers can no longer start using them and instead use y2038-safe interfaces.
Signed-off-by Arnd Bergmann <[email protected]>
Arnd Bergmann
maintainerPATCH 2/3 y2038: remove unused time32 interfaces
In reply to Arnd BergmannNo users remain, so kill these off before we grow new ones.
--- include/linux/compat.h | 29 ------- include/linux/time32.h | 154 +--------------------------------- include/linux/timekeeping32.h | 32 ------- include/linux/types.h | 5 -- kernel/compat.c | 64 -------------- kernel/time/time.c | 43 ---------- 6 files changed, 1 insertion(+), 326 deletions(-)
include/linux/compat.h +0 -29
@@ -248,15 +248,6 @@ typedef struct compat_siginfo { } _sifields; } compat_siginfo_t; -/* -* These functions operate on 32- or 64-bit specs depending on -* COMPAT_USE_64BIT_TIME, hence the void user pointer arguments. -*/ -extern int compat_get_timespec (struct timespec *,const void __user *); -extern int compat_put_timespec (const struct timespec *,void __user *); -extern int compat_get_timeval (struct timeval *,const void __user *); -extern int compat_put_timeval (const struct timeval *,void __user *); -struct compat_iovec {compat_uptr_t iov_base;compat_size_t iov_len;
@@ -416,26 +407,6 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const kernel_siginfint get_compat_sigevent (struct sigevent *event,const struct compat_sigevent __user *u_event); -static inline int old_timeval32_compare (struct old_timeval32 *lhs, -struct old_timeval32 *rhs) -{ -if (lhs->tv_sec < rhs->tv_sec) -return -1 ; -if (lhs->tv_sec > rhs->tv_sec) -return 1 ; -return lhs->tv_usec - rhs->tv_usec; -} - -static inline int old_timespec32_compare (struct old_timespec32 *lhs, -struct old_timespec32 *rhs) -{ -if (lhs->tv_sec < rhs->tv_sec) -return -1 ; -if (lhs->tv_sec > rhs->tv_sec) -return 1 ; -return lhs->tv_nsec - rhs->tv_nsec; -} -extern int get_compat_sigset (sigset_t *set,const compat_sigset_t __user *compat);/*
include/linux/time32.h +1 -153
171 lines not on this page · raw message
include/linux/timekeeping32.h +0 -32
@@ -11,36 +11,4 @@ static inline unsigned long get_seconds(void) return ktime_get_real_seconds(); } -static inline void getnstimeofday (struct timespec *ts) -{ -struct timespec64 ts64; - -ktime_get_real_ts64 (&ts64); - *ts =timespec64_to_timespec (ts64); -} - -static inline void ktime_get_ts (struct timespec *ts) -{ -struct timespec64 ts64; - -ktime_get_ts64 (&ts64); - *ts =timespec64_to_timespec (ts64); -} - -static inline void getrawmonotonic (struct timespec *ts) -{ -struct timespec64 ts64; - -ktime_get_raw_ts64 (&ts64); - *ts =timespec64_to_timespec (ts64); -} - -static inline void getboottime (struct timespec *ts) -{ -struct timespec64 ts64; - -getboottime64 (&ts64); - *ts =timespec64_to_timespec (ts64); -} -#endif
include/linux/types.h +0 -5
@@ -65,11 +65,6 @@ typedef __kernel_ssize_t ssize_t;typedef __kernel_ptrdiff_t ptrdiff_t ;#endif -#ifndef _TIME_T -#define _TIME_T -typedef __kernel_old_time_t time_t ; -#endif -#ifndef _CLOCK_T#define _CLOCK_Ttypedef __kernel_clock_t clock_t ;
kernel/compat.c +0 -64
70 lines not on this page · raw message
kernel/time/time.c +0 -43
49 lines not on this page · raw message
Signature · 1 line
2.20.0
Re: [PATCH 2/3] y2038: remove unused time32 interfaces
Quoted 3 lines · Arnd Bergmann
No users remain, so kill these off before we grow new ones.
Signed-off-by Arnd Bergmann <[email protected]>
Arnd Bergmann
maintainerPATCH 3/3 y2038: hide timeval/timespec/itimerval/itimerspec types
In reply to Arnd BergmannThere are no in-kernel users remaining, but there may still be users that include linux/time.h instead of sys/time.h from user space, so leave the types available to user space while hiding them from kernel space.
Only the __kernel_old_* versions of these types remain now.
--- include/uapi/asm-generic/posix_types.h | 2 ++ include/uapi/linux/time.h | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-)
include/uapi/asm-generic/posix_types.h +2 -0
@@ -87,7 +87,9 @@ typedef struct {typedef __kernel_long_t __kernel_off_t ;typedef long long __kernel_loff_t ;typedef __kernel_long_t __kernel_old_time_t ; +#ifndef __KERNEL__typedef __kernel_long_t __kernel_time_t ; +#endif typedef long long __kernel_time64_t ;typedef __kernel_long_t __kernel_clock_t ;typedef int __kernel_timer_t ;
include/uapi/linux/time.h +12 -10
@@ -5,6 +5,7 @@#include <linux/types.h> #include <linux/time_types.h> +#ifndef __KERNEL__#ifndef _STRUCT_TIMESPEC#define _STRUCT_TIMESPEC struct timespec {
@@ -18,6 +19,17 @@ struct timeval {__kernel_suseconds_t tv_usec;/* microseconds */ }; +struct itimerspec { +struct timespec it_interval;/* timer period */ +struct timespec it_value;/* timer expiration */ +}; + +struct itimerval { +struct timeval it_interval;/* timer interval */ +struct timeval it_value;/* current value */ +}; +#endif +struct timezone {int tz_minuteswest;/* minutes west of Greenwich */ int tz_dsttime;/* type of dst correction */
@@ -31,16 +43,6 @@ struct timezone {#define ITIMER_VIRTUAL 1#define ITIMER_PROF 2 -struct itimerspec { -struct timespec it_interval;/* timer period */ -struct timespec it_value;/* timer expiration */ -}; - -struct itimerval { -struct timeval it_interval;/* timer interval */ -struct timeval it_value;/* current value */ -}; -/* * The IDs of the various system clocks (for POSIX.1b interval timers): */
Signature · 1 line
2.20.0
Re: [PATCH 3/3] y2038: hide timeval/timespec/itimerval/itimerspec types
Quoted 8 lines · Arnd Bergmann
There are no in-kernel users remaining, but there may still be users that include
linux/time.hinstead ofsys/time.hfrom user space, so leave the types available to user space while hiding them from kernel space.Only the __kernel_old_* versions of these types remain now.
Signed-off-by Arnd Bergmann <[email protected]>