diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-24 05:02:51 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-06-24 05:02:51 +0200 |
commit | a57bbede0c0a7b5ac9cb8e9710723d9099c5825b (patch) | |
tree | d866af24478ab80c2fffe275395f2913e69e4599 | |
parent | 245f0bd331330c80e28e56e95c85ebacf7570ac2 (diff) |
compat: more robust ktime backport
This is needed for frankenkernels, like android-common.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/compat/compat.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h index d08557f..2c1b663 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -327,7 +327,7 @@ static inline int get_random_bytes_wait(void *buf, int nbytes) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(ISRHEL7) -#include <linux/ktime.h> +#include <linux/hrtimer.h> static inline u64 ktime_get_boot_ns(void) { return ktime_to_ns(ktime_get_boottime()); @@ -335,11 +335,16 @@ static inline u64 ktime_get_boot_ns(void) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) -#include <linux/ktime.h> -static inline u64 ktime_get_boot_fast_ns(void) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) +#include <linux/hrtimer.h> +#else +#include <linux/timekeeping.h> +#endif +static inline u64 __wgcompat_ktime_get_boot_fast_ns(void) { return ktime_get_boot_ns(); } +#define ktime_get_boot_fast_ns __wgcompat_ktime_get_boot_fast_ns #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) |