From: Davide Libenzi Date: Tue, 5 Feb 2008 06:27:25 +0000 (-0800) Subject: timerfd: introduce a new hrtimer_forward_now() function X-Git-Tag: v2.6.25-rc1~1045 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e05ad7d4e3b11f935998882b5d9c3b257137f1b;p=linux-2.6 timerfd: introduce a new hrtimer_forward_now() function I think that advancing the timer against the timer's current "now" can be a pretty common usage, so, w/out exposing hrtimer's internals, we add a new hrtimer_forward_now() function. Signed-off-by: Davide Libenzi Cc: Michael Kerrisk Cc: Thomas Gleixner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index f79dcba4b2..3fed27c88c 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -304,6 +304,13 @@ static inline int hrtimer_is_queued(struct hrtimer *timer) extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); +/* Forward a hrtimer so it expires after the hrtimer's current now */ +static inline unsigned long hrtimer_forward_now(struct hrtimer *timer, + ktime_t interval) +{ + return hrtimer_forward(timer, timer->base->get_time(), interval); +} + /* Precise sleep: */ extern long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp,