From 24575392bff8bdb9ec7709a78b4fbd48367fc1f5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 22 Jun 2017 14:12:29 -0600 Subject: [PATCH 1/1] arch: tsc_reliable can be a bool Signed-off-by: Jens Axboe --- arch/arch-ia64.h | 4 ++-- arch/arch-ppc.h | 4 ++-- arch/arch-s390.h | 4 ++-- arch/arch-x86-common.h | 2 +- arch/arch.h | 2 ++ gettime.c | 4 ++-- t/arch.c | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/arch-ia64.h b/arch/arch-ia64.h index 53c049fd..ece3f7e2 100644 --- a/arch/arch-ia64.h +++ b/arch/arch-ia64.h @@ -28,10 +28,10 @@ static inline unsigned long long get_cpu_clock(void) } #define ARCH_HAVE_INIT -extern int tsc_reliable; +extern bool tsc_reliable; static inline int arch_init(char *envp[]) { - tsc_reliable = 1; + tsc_reliable = true; return 0; } diff --git a/arch/arch-ppc.h b/arch/arch-ppc.h index 4a8aa97c..ba452b15 100644 --- a/arch/arch-ppc.h +++ b/arch/arch-ppc.h @@ -117,12 +117,12 @@ static void atb_clocktest(void) #endif #define ARCH_HAVE_INIT -extern int tsc_reliable; +extern bool tsc_reliable; static inline int arch_init(char *envp[]) { #if 0 - tsc_reliable = 1; + tsc_reliable = true; atb_clocktest(); #endif return 0; diff --git a/arch/arch-s390.h b/arch/arch-s390.h index 2e84bf8a..6bf033b0 100644 --- a/arch/arch-s390.h +++ b/arch/arch-s390.h @@ -28,10 +28,10 @@ static inline unsigned long long get_cpu_clock(void) #undef ARCH_CPU_CLOCK_WRAPS #define ARCH_HAVE_INIT -extern int tsc_reliable; +extern bool tsc_reliable; static inline int arch_init(char *envp[]) { - tsc_reliable = 1; + tsc_reliable = true; return 0; } diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h index cbf66b8d..c51c04c2 100644 --- a/arch/arch-x86-common.h +++ b/arch/arch-x86-common.h @@ -14,7 +14,7 @@ static inline void cpuid(unsigned int op, #define ARCH_HAVE_INIT -extern int tsc_reliable; +extern bool tsc_reliable; extern int arch_random; static inline void arch_init_intel(unsigned int level) diff --git a/arch/arch.h b/arch/arch.h index 00d247c4..4fb9b518 100644 --- a/arch/arch.h +++ b/arch/arch.h @@ -1,6 +1,8 @@ #ifndef ARCH_H #define ARCH_H +#include "../lib/types.h" + enum { arch_x86_64 = 1, arch_x86, diff --git a/gettime.c b/gettime.c index a14a179b..5741932f 100644 --- a/gettime.c +++ b/gettime.c @@ -28,7 +28,7 @@ static unsigned int max_cycles_shift; static unsigned int cycles_wrap; #endif #endif -int tsc_reliable = 0; +bool tsc_reliable = false; struct tv_valid { int warned; @@ -413,7 +413,7 @@ void fio_clock_init(void) fio_clock_source_inited = fio_clock_source; if (calibrate_cpu_clock()) - tsc_reliable = 0; + tsc_reliable = false; /* * If the arch sets tsc_reliable != 0, then it must be good enough diff --git a/t/arch.c b/t/arch.c index befb7c7f..bd28a848 100644 --- a/t/arch.c +++ b/t/arch.c @@ -1,5 +1,5 @@ #include "../arch/arch.h" unsigned long arch_flags = 0; -int tsc_reliable; +bool tsc_reliable; int arch_random; -- 2.25.1