[PATCH] External module compatibility for hrtimer_expires_remaining

Alexander Graf
2009-01-22T20:05:47Z

Due to Marcelo's APIC fix we now depend on hrtimer_expires_remaining,
which is not available on my 2.6.27 kernel.

This patch adds a backwards compatibility layer for it.

Signed-off-by: Alexander Graf <agraf@suse.de>

---
kernel/external-module-compat-comm.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h
index 981dc96..634f717 100644
--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -501,6 +501,17 @@ struct timespec kvm_ns_to_timespec(const s64 nsec);

#endif

+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+
+#define hrtimer_expires_remaining kvm_hrtimer_expires_remaining
+
+static inline ktime_t kvm_hrtimer_expires_remaining(const struct hrtimer *timer)
+{
+ return ktime_sub(timer->expires, timer->base->get_time());
+}
+
+#endif
+
/* work_struct lost the 'data' field in 2.6.20 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)

--
1.6.0.2