[v4,6/8] tst_timer: Turn clock_name() function public

Message ID 20190129173659.27901-6-rafael.tinoco@linaro.org
State New
Headers show
Series
  • [v4,1/8] lib: add tst_clock_settime() to tst_clocks.h
Related show

Commit Message

Rafael David Tinoco Jan. 29, 2019, 5:36 p.m.
This commit exposes clock_name() function by removing its static
definition and creating a public function prototype. This function is
needed by clock/alarm tests and their error messages.

Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
---
 include/tst_timer.h | 5 +++++
 lib/tst_timer.c     | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Cyril Hrubis Jan. 30, 2019, 1:54 p.m. | #1
Hi!
I've renamed the function to tst_clock_name() just to keep it consistent
with the rest of the LTP API.

Patch

diff --git a/include/tst_timer.h b/include/tst_timer.h
index 043b71460..c66f630c4 100644
--- a/include/tst_timer.h
+++ b/include/tst_timer.h
@@ -332,4 +332,9 @@  static inline long long tst_timer_elapsed_us(void)
 	return tst_timespec_to_us(tst_timer_elapsed());
 }
 
+/*
+ * Returns a string containing given clock type name
+ */
+const char *clock_name(clockid_t);
+
 #endif /* TST_TIMER */
diff --git a/lib/tst_timer.c b/lib/tst_timer.c
index dffaba0cb..e83da7ff6 100644
--- a/lib/tst_timer.c
+++ b/lib/tst_timer.c
@@ -15,7 +15,7 @@ 
 static struct timespec start_time, stop_time;
 static clockid_t clock_id;
 
-static const char *clock_name(clockid_t clk_id)
+const char *clock_name(clockid_t clk_id)
 {
 	switch (clk_id) {
 	case CLOCK_REALTIME: