From 8b9cfca63e45badb418550c61397be4c33022752 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 7 Mar 2005 18:15:40 -0800 Subject: [PATCH] posix-timers: tidy up clock interfaces and consolidate dispatch logic This patch cleans up the posix-timers interfaces for defining clocks, and the calls to them. It fixes some sloppy types, adds a clockid_t parameter to the calls that lacked it, and adds a function pointer that can be used for clock_getres. It further cleans up the posix-timers.c code using the k_clock function pointers or default functions when no hooks are supplied, consolidating repeated code into shared inline functions or macros. This paves the way for adding the CPU clock hooks. The mmtimer.c changes are untested, but obviously can't be wrong. There aren't any other struct k_clock definitions in the tree, but any others would need to be updated for the function signature changes. Signed-off-by: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/posix-timers.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'include/linux') diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 006f3e9af475..61f4b12d82c1 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -30,12 +30,12 @@ struct k_clock_abs { }; struct k_clock { int res; /* in nano seconds */ + int (*clock_getres) (clockid_t which_clock, struct timespec *tp); struct k_clock_abs *abs_struct; - int (*clock_set) (struct timespec * tp); - int (*clock_get) (struct timespec * tp); + int (*clock_set) (clockid_t which_clock, struct timespec * tp); + int (*clock_get) (clockid_t which_clock, struct timespec * tp); int (*timer_create) (struct k_itimer *timer); - int (*nsleep) (int which_clock, int flags, - struct timespec * t); + int (*nsleep) (clockid_t which_clock, int flags, struct timespec *); int (*timer_set) (struct k_itimer * timr, int flags, struct itimerspec * new_setting, struct itimerspec * old_setting); @@ -44,12 +44,12 @@ struct k_clock { struct itimerspec * cur_setting); }; -void register_posix_clock(int clock_id, struct k_clock *new_clock); +void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock); /* Error handlers for timer_create, nanosleep and settime */ int do_posix_clock_notimer_create(struct k_itimer *timer); -int do_posix_clock_nonanosleep(int which_clock, int flags, struct timespec * t); -int do_posix_clock_nosettime(struct timespec *tp); +int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *); +int do_posix_clock_nosettime(clockid_t, struct timespec *tp); /* function to call to trigger timer event */ int posix_timer_event(struct k_itimer *timr, int si_private); -- cgit v1.2.3