History

timex: use __kernel_timex internally

struct timex is not y2038 safe. Replace all uses of timex with y2038 safe __kernel_timex. Note that struct __kernel_timex is an ABI interface definition. We could define a new structure based on __kernel_timex that is only available internally instead. Right now, there isn't a strong motivation for this as the structure is isolated to a few defined struct timex interfaces and such a structure would be exactly the same as struct timex. The patch was generated by the following coccinelle script: virtual patch @depends on patch forall@ identifier ts; expression e; @@ ( - struct timex ts; + struct __kernel_timex ts; | - struct timex ts = {}; + struct __kernel_timex ts = {}; | - struct timex ts = e; + struct __kernel_timex ts = e; | - struct timex *ts; + struct __kernel_timex *ts; | (memset \| copy_from_user \| copy_to_user \)(..., - sizeof(struct timex)) + sizeof(struct __kernel_timex)) ) @depends on patch forall@ identifier ts; identifier fn; @@ fn(..., - struct timex *ts, + struct __kernel_timex *ts, ...) { ... } @depends on patch forall@ identifier ts; identifier fn; @@ fn(..., - struct timex *ts) { + struct __kernel_timex *ts) { ... }

Deepa Dinamani committed 8 years ago

Commit ead25411 parent 1a5963913 files · +38 −35Browse files

Showing the changes to include/linux (3 of 13 files). Show all

Unified · Split

3 files
  1. include/linux/posix-clock.h +1 −1
  2. include/linux/time32.h +3 −3
  3. include/linux/timex.h +2 −2
include/linux/posix-clock.h+1−1
@@ -51,7 +51,7 @@ struct posix_clock; · 50 unmodified lines
51struct posix_clock_operations {51struct posix_clock_operations {
52 struct module *owner;52 struct module *owner;
53 53
54 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);54 int (*clock_adjtime)(struct posix_clock *pc, struct __kernel_timex *tx);
55 55
56 int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);56 int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);
57 57
include/linux/time32.h+3−3
@@ -69,9 +69,9 @@ extern int get_old_itimerspec32(struct itimerspec64 *its, · 68 unmodified lines
69 const struct old_itimerspec32 __user *uits);69 const struct old_itimerspec32 __user *uits);
70extern int put_old_itimerspec32(const struct itimerspec64 *its,70extern int put_old_itimerspec32(const struct itimerspec64 *its,
71 struct old_itimerspec32 __user *uits);71 struct old_itimerspec32 __user *uits);
72struct timex;72struct __kernel_timex;
73int get_old_timex32(struct timex *, const struct old_timex32 __user *);73int get_old_timex32(struct __kernel_timex *, const struct old_timex32 __user *);
74int put_old_timex32(struct old_timex32 __user *, const struct timex *);74int put_old_timex32(struct old_timex32 __user *, const struct __kernel_timex *);
75 75
76#if __BITS_PER_LONG == 6476#if __BITS_PER_LONG == 64
77 77
include/linux/timex.h+2−2
@@ -158,8 +158,8 @@ extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ · 157 unmodified lines
158#define NTP_INTERVAL_FREQ (HZ)158#define NTP_INTERVAL_FREQ (HZ)
159#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)159#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
160 160
161extern int do_adjtimex(struct timex *);161extern int do_adjtimex(struct __kernel_timex *);
162extern int do_clock_adjtime(const clockid_t which_clock, struct timex * ktx);162extern int do_clock_adjtime(const clockid_t which_clock, struct __kernel_timex * ktx);
163 163
164extern void hardpps(const struct timespec64 *, const struct timespec64 *);164extern void hardpps(const struct timespec64 *, const struct timespec64 *);
165 165

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t