diff options
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r-- | fs/timerfd.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c index 9ae4abb4110b..fb4407a7cf9e 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -55,7 +55,7 @@ static inline bool isalarm(struct timerfd_ctx *ctx) | |||
55 | /* | 55 | /* |
56 | * This gets called when the timer event triggers. We set the "expired" | 56 | * This gets called when the timer event triggers. We set the "expired" |
57 | * flag, but we do not re-arm the timer (in case it's necessary, | 57 | * flag, but we do not re-arm the timer (in case it's necessary, |
58 | * tintv.tv64 != 0) until the timer is accessed. | 58 | * tintv != 0) until the timer is accessed. |
59 | */ | 59 | */ |
60 | static void timerfd_triggered(struct timerfd_ctx *ctx) | 60 | static void timerfd_triggered(struct timerfd_ctx *ctx) |
61 | { | 61 | { |
@@ -93,7 +93,7 @@ static enum alarmtimer_restart timerfd_alarmproc(struct alarm *alarm, | |||
93 | */ | 93 | */ |
94 | void timerfd_clock_was_set(void) | 94 | void timerfd_clock_was_set(void) |
95 | { | 95 | { |
96 | ktime_t moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 }); | 96 | ktime_t moffs = ktime_mono_to_real(0); |
97 | struct timerfd_ctx *ctx; | 97 | struct timerfd_ctx *ctx; |
98 | unsigned long flags; | 98 | unsigned long flags; |
99 | 99 | ||
@@ -102,8 +102,8 @@ void timerfd_clock_was_set(void) | |||
102 | if (!ctx->might_cancel) | 102 | if (!ctx->might_cancel) |
103 | continue; | 103 | continue; |
104 | spin_lock_irqsave(&ctx->wqh.lock, flags); | 104 | spin_lock_irqsave(&ctx->wqh.lock, flags); |
105 | if (ctx->moffs.tv64 != moffs.tv64) { | 105 | if (ctx->moffs != moffs) { |
106 | ctx->moffs.tv64 = KTIME_MAX; | 106 | ctx->moffs = KTIME_MAX; |
107 | ctx->ticks++; | 107 | ctx->ticks++; |
108 | wake_up_locked(&ctx->wqh); | 108 | wake_up_locked(&ctx->wqh); |
109 | } | 109 | } |
@@ -124,9 +124,9 @@ static void timerfd_remove_cancel(struct timerfd_ctx *ctx) | |||
124 | 124 | ||
125 | static bool timerfd_canceled(struct timerfd_ctx *ctx) | 125 | static bool timerfd_canceled(struct timerfd_ctx *ctx) |
126 | { | 126 | { |
127 | if (!ctx->might_cancel || ctx->moffs.tv64 != KTIME_MAX) | 127 | if (!ctx->might_cancel || ctx->moffs != KTIME_MAX) |
128 | return false; | 128 | return false; |
129 | ctx->moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 }); | 129 | ctx->moffs = ktime_mono_to_real(0); |
130 | return true; | 130 | return true; |
131 | } | 131 | } |
132 | 132 | ||
@@ -155,7 +155,7 @@ static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx) | |||
155 | else | 155 | else |
156 | remaining = hrtimer_expires_remaining_adjusted(&ctx->t.tmr); | 156 | remaining = hrtimer_expires_remaining_adjusted(&ctx->t.tmr); |
157 | 157 | ||
158 | return remaining.tv64 < 0 ? ktime_set(0, 0): remaining; | 158 | return remaining < 0 ? ktime_set(0, 0): remaining; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int timerfd_setup(struct timerfd_ctx *ctx, int flags, | 161 | static int timerfd_setup(struct timerfd_ctx *ctx, int flags, |
@@ -184,7 +184,7 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags, | |||
184 | ctx->t.tmr.function = timerfd_tmrproc; | 184 | ctx->t.tmr.function = timerfd_tmrproc; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (texp.tv64 != 0) { | 187 | if (texp != 0) { |
188 | if (isalarm(ctx)) { | 188 | if (isalarm(ctx)) { |
189 | if (flags & TFD_TIMER_ABSTIME) | 189 | if (flags & TFD_TIMER_ABSTIME) |
190 | alarm_start(&ctx->t.alarm, texp); | 190 | alarm_start(&ctx->t.alarm, texp); |
@@ -261,9 +261,9 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count, | |||
261 | if (ctx->ticks) { | 261 | if (ctx->ticks) { |
262 | ticks = ctx->ticks; | 262 | ticks = ctx->ticks; |
263 | 263 | ||
264 | if (ctx->expired && ctx->tintv.tv64) { | 264 | if (ctx->expired && ctx->tintv) { |
265 | /* | 265 | /* |
266 | * If tintv.tv64 != 0, this is a periodic timer that | 266 | * If tintv != 0, this is a periodic timer that |
267 | * needs to be re-armed. We avoid doing it in the timer | 267 | * needs to be re-armed. We avoid doing it in the timer |
268 | * callback to avoid DoS attacks specifying a very | 268 | * callback to avoid DoS attacks specifying a very |
269 | * short timer period. | 269 | * short timer period. |
@@ -410,7 +410,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) | |||
410 | else | 410 | else |
411 | hrtimer_init(&ctx->t.tmr, clockid, HRTIMER_MODE_ABS); | 411 | hrtimer_init(&ctx->t.tmr, clockid, HRTIMER_MODE_ABS); |
412 | 412 | ||
413 | ctx->moffs = ktime_mono_to_real((ktime_t){ .tv64 = 0 }); | 413 | ctx->moffs = ktime_mono_to_real(0); |
414 | 414 | ||
415 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, | 415 | ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx, |
416 | O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); | 416 | O_RDWR | (flags & TFD_SHARED_FCNTL_FLAGS)); |
@@ -469,7 +469,7 @@ static int do_timerfd_settime(int ufd, int flags, | |||
469 | * We do not update "ticks" and "expired" since the timer will be | 469 | * We do not update "ticks" and "expired" since the timer will be |
470 | * re-programmed again in the following timerfd_setup() call. | 470 | * re-programmed again in the following timerfd_setup() call. |
471 | */ | 471 | */ |
472 | if (ctx->expired && ctx->tintv.tv64) { | 472 | if (ctx->expired && ctx->tintv) { |
473 | if (isalarm(ctx)) | 473 | if (isalarm(ctx)) |
474 | alarm_forward_now(&ctx->t.alarm, ctx->tintv); | 474 | alarm_forward_now(&ctx->t.alarm, ctx->tintv); |
475 | else | 475 | else |
@@ -499,7 +499,7 @@ static int do_timerfd_gettime(int ufd, struct itimerspec *t) | |||
499 | ctx = f.file->private_data; | 499 | ctx = f.file->private_data; |
500 | 500 | ||
501 | spin_lock_irq(&ctx->wqh.lock); | 501 | spin_lock_irq(&ctx->wqh.lock); |
502 | if (ctx->expired && ctx->tintv.tv64) { | 502 | if (ctx->expired && ctx->tintv) { |
503 | ctx->expired = 0; | 503 | ctx->expired = 0; |
504 | 504 | ||
505 | if (isalarm(ctx)) { | 505 | if (isalarm(ctx)) { |