Skip to content

Commit eaf8019

Browse files
avaginKAGA-KOKO
authored andcommitted
posix-clocks: Rename .clock_get_timespec() callbacks accordingly
The upcoming support for time namespaces requires to have access to: - The time in a task's time namespace for sys_clock_gettime() - The time in the root name space for common_timer_get() That adds a valid reason to finally implement a separate callback which returns the time in ktime_t format in (struct k_clock). As a preparation ground for introducing clock_get_ktime(), the original callback clock_get() was renamed into clock_get_timespec(). Reflect the renaming into the callback implementations. Suggested-by: Thomas Gleixner <[email protected]> Co-developed-by: Dmitry Safonov <[email protected]> Signed-off-by: Andrei Vagin <[email protected]> Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 819a95f commit eaf8019

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

kernel/time/alarmtimer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,13 +657,13 @@ static int alarm_clock_getres(const clockid_t which_clock, struct timespec64 *tp
657657
}
658658

659659
/**
660-
* alarm_clock_get - posix clock_get_timespec interface
660+
* alarm_clock_get_timespec - posix clock_get_timespec interface
661661
* @which_clock: clockid
662662
* @tp: timespec to fill.
663663
*
664664
* Provides the underlying alarm base time.
665665
*/
666-
static int alarm_clock_get(clockid_t which_clock, struct timespec64 *tp)
666+
static int alarm_clock_get_timespec(clockid_t which_clock, struct timespec64 *tp)
667667
{
668668
struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)];
669669

@@ -837,7 +837,7 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
837837

838838
const struct k_clock alarm_clock = {
839839
.clock_getres = alarm_clock_getres,
840-
.clock_get_timespec = alarm_clock_get,
840+
.clock_get_timespec = alarm_clock_get_timespec,
841841
.timer_create = alarm_timer_create,
842842
.timer_set = common_timer_set,
843843
.timer_del = common_timer_del,

kernel/time/posix-timers.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static inline void unlock_timer(struct k_itimer *timr, unsigned long flags)
165165
}
166166

167167
/* Get clock_realtime */
168-
static int posix_clock_realtime_get(clockid_t which_clock, struct timespec64 *tp)
168+
static int posix_get_realtime_timespec(clockid_t which_clock, struct timespec64 *tp)
169169
{
170170
ktime_get_real_ts64(tp);
171171
return 0;
@@ -187,7 +187,7 @@ static int posix_clock_realtime_adj(const clockid_t which_clock,
187187
/*
188188
* Get monotonic time for posix timers
189189
*/
190-
static int posix_ktime_get_ts(clockid_t which_clock, struct timespec64 *tp)
190+
static int posix_get_monotonic_timespec(clockid_t which_clock, struct timespec64 *tp)
191191
{
192192
ktime_get_ts64(tp);
193193
return 0;
@@ -222,13 +222,13 @@ static int posix_get_coarse_res(const clockid_t which_clock, struct timespec64 *
222222
return 0;
223223
}
224224

225-
static int posix_get_boottime(const clockid_t which_clock, struct timespec64 *tp)
225+
static int posix_get_boottime_timespec(const clockid_t which_clock, struct timespec64 *tp)
226226
{
227227
ktime_get_boottime_ts64(tp);
228228
return 0;
229229
}
230230

231-
static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp)
231+
static int posix_get_tai_timespec(clockid_t which_clock, struct timespec64 *tp)
232232
{
233233
ktime_get_clocktai_ts64(tp);
234234
return 0;
@@ -1261,7 +1261,7 @@ SYSCALL_DEFINE4(clock_nanosleep_time32, clockid_t, which_clock, int, flags,
12611261

12621262
static const struct k_clock clock_realtime = {
12631263
.clock_getres = posix_get_hrtimer_res,
1264-
.clock_get_timespec = posix_clock_realtime_get,
1264+
.clock_get_timespec = posix_get_realtime_timespec,
12651265
.clock_set = posix_clock_realtime_set,
12661266
.clock_adj = posix_clock_realtime_adj,
12671267
.nsleep = common_nsleep,
@@ -1279,7 +1279,7 @@ static const struct k_clock clock_realtime = {
12791279

12801280
static const struct k_clock clock_monotonic = {
12811281
.clock_getres = posix_get_hrtimer_res,
1282-
.clock_get_timespec = posix_ktime_get_ts,
1282+
.clock_get_timespec = posix_get_monotonic_timespec,
12831283
.nsleep = common_nsleep,
12841284
.timer_create = common_timer_create,
12851285
.timer_set = common_timer_set,
@@ -1310,7 +1310,7 @@ static const struct k_clock clock_monotonic_coarse = {
13101310

13111311
static const struct k_clock clock_tai = {
13121312
.clock_getres = posix_get_hrtimer_res,
1313-
.clock_get_timespec = posix_get_tai,
1313+
.clock_get_timespec = posix_get_tai_timespec,
13141314
.nsleep = common_nsleep,
13151315
.timer_create = common_timer_create,
13161316
.timer_set = common_timer_set,
@@ -1326,7 +1326,7 @@ static const struct k_clock clock_tai = {
13261326

13271327
static const struct k_clock clock_boottime = {
13281328
.clock_getres = posix_get_hrtimer_res,
1329-
.clock_get_timespec = posix_get_boottime,
1329+
.clock_get_timespec = posix_get_boottime_timespec,
13301330
.nsleep = common_nsleep,
13311331
.timer_create = common_timer_create,
13321332
.timer_set = common_timer_set,

0 commit comments

Comments
 (0)