Introduce macros to check Ubuntu kernel version
authorJulien Desfossez <jdesfossez@efficios.com>
Wed, 1 Oct 2014 15:05:08 +0000 (11:05 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Oct 2014 15:11:17 +0000 (11:11 -0400)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-kernel-version.h

index 0eb56b3820d256bcce5ef399552f95d2ea398e08..8fad8b09c98b4b44b5e9fdacfbd6cc9548d00d20 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <linux/version.h>
+#include <linux/vermagic.h>
 
 /*
  * This macro checks if the kernel version is between the two specified
        (LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
         LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
 
+#define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
+       (((a) << 24) + ((b) << 16) + (c << 8) + (d))
+
+#define LTTNG_UBUNTU_VERSION_CODE \
+       ((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
+
+#define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+               a_high, b_high, c_high, d_high) \
+       (defined(UTS_UBUNTU_RELEASE_ABI) && \
+               LTTNG_UBUNTU_VERSION_CODE >= \
+               LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+               LTTNG_UBUNTU_VERSION_CODE < \
+               LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
 #endif /* _LTTNG_KERNEL_VERSION_H */
This page took 0.044018 seconds and 4 git commands to generate.