Add RT patch version macros
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 5 Feb 2016 22:53:06 +0000 (17:53 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 6 Feb 2016 22:21:49 +0000 (17:21 -0500)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.ABI.workarounds
lttng-kernel-version.h
rt-patch-version.sh [new file with mode: 0755]

index be9f1cb5455ba061bf2cad0917ad45c9efcfed54..cb46c17707c242af54027c21bd03ed1e5d682754 100644 (file)
@@ -4,8 +4,14 @@
 # the kernel EXTRAVERSION to figure it out. Translate this information
 # into a define visible from the C preprocessor.
 
-DEB_API_VERSION=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
+DEB_API_VERSION:=$(shell $(MAKEFILEDIR)/abi-debian-version.sh $(KERNELDIR))
 
 ifneq ($(DEB_API_VERSION), 0)
 ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
 endif
+
+RT_PATCH_VERSION:=$(shell $(MAKEFILEDIR)/rt-patch-version.sh $(KERNELDIR))
+
+ifneq ($(RT_PATCH_VERSION), 0)
+  ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
+endif
index f98a1925e9419bfa6365743d49ecf6a748d7b306..ac61739b9812eed4771abfb56b254da2e42d5113 100644 (file)
                LTTNG_RHEL_VERSION_CODE < \
                LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high))
 
+#define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
+       (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
+
+#ifdef RT_PATCH_VERSION
+#define LTTNG_RT_VERSION_CODE \
+       ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
+#else
+#define LTTNG_RT_VERSION_CODE  0
+#endif
+
+#define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+               a_high, b_high, c_high, d_high) \
+       (LTTNG_RT_VERSION_CODE >= \
+               LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+               LTTNG_RT_VERSION_CODE < \
+               LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
 #endif /* _LTTNG_KERNEL_VERSION_H */
diff --git a/rt-patch-version.sh b/rt-patch-version.sh
new file mode 100755 (executable)
index 0000000..89c7755
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# First argument is the path to the kernel headers.
+KPATH=$1
+
+VERSIONFILE=""
+
+if [ -f "${KPATH}/localversion-rt" ]; then
+       VERSIONFILE="${KPATH}/localversion-rt"
+
+elif [ -f "${KPATH}/source/localversion-rt" ]; then
+       VERSIONFILE="${KPATH}/source/localversion-rt"
+else
+       echo 0
+       exit 0
+fi
+
+RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")
+
+if [ "x${RT_PATCH_VERSION}" = "x" ]; then
+       echo 0
+       exit 0
+fi
+
+echo ${RT_PATCH_VERSION}
This page took 0.026389 seconds and 4 git commands to generate.