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
5151 struct posix_clock_operations {
5252 struct module *owner;
5353
54− int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
54+ int (*clock_adjtime)(struct posix_clock *pc, struct __kernel_timex *tx);
5555
5656 int (*clock_gettime)(struct posix_clock *pc, struct timespec64 *ts);
5757
include/linux/time32.h+3−3
@@ -69,9 +69,9 @@ extern int get_old_itimerspec32(struct itimerspec64 *its, · 68 unmodified lines
6969 const struct old_itimerspec32 __user *uits);
7070 extern int put_old_itimerspec32(const struct itimerspec64 *its,
7171 struct old_itimerspec32 __user *uits);
72−struct timex;
73−int get_old_timex32(struct timex *, const struct old_timex32 __user *);
74−int put_old_timex32(struct old_timex32 __user *, const struct timex *);
72+struct __kernel_timex;
73+int get_old_timex32(struct __kernel_timex *, const struct old_timex32 __user *);
74+int put_old_timex32(struct old_timex32 __user *, const struct __kernel_timex *);
7575
7676 #if __BITS_PER_LONG == 64
7777
include/linux/timex.h+2−2
@@ -158,8 +158,8 @@ extern unsigned long tick_nsec; /* SHIFTED_HZ period (nsec) */ · 157 unmodified lines
158158 #define NTP_INTERVAL_FREQ (HZ)
159159 #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
160160
161−extern int do_adjtimex(struct timex *);
162−extern int do_clock_adjtime(const clockid_t which_clock, struct timex * ktx);
161+extern int do_adjtimex(struct __kernel_timex *);
162+extern int do_clock_adjtime(const clockid_t which_clock, struct __kernel_timex * ktx);
163163
164164 extern void hardpps(const struct timespec64 *, const struct timespec64 *);
165165

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