Fix: Add Fedora version macros
authorLoïc Gelle <loic.gelle@polymtl.ca>
Tue, 20 Feb 2018 17:10:04 +0000 (12:10 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 20 Feb 2018 17:32:19 +0000 (12:32 -0500)
Signed-off-by: Loïc Gelle <loic.gelle@polymtl.ca>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.ABI.workarounds
abi-fedora-version.sh [new file with mode: 0755]
lttng-kernel-version.h

index 2e6c4aa231577057a7c6476977095b29261a677d..fcd980deafd0f4e52385f34b8a384c569248e6a4 100644 (file)
@@ -22,6 +22,12 @@ ifneq ($(SLE_API_VERSION), 0)
   ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
 endif
 
+FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-fedora-version.sh $(CURDIR))
+
+ifneq ($(FEDORA_REVISION_VERSION), 0)
+  ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
+endif
+
 RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR))
 
 ifneq ($(RT_PATCH_VERSION), 0)
diff --git a/abi-fedora-version.sh b/abi-fedora-version.sh
new file mode 100755 (executable)
index 0000000..52dd044
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# First argument is the path to the kernel headers.
+KPATH="$1"
+
+if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
+       echo 0
+       exit 0
+fi
+
+# Assuming KPATH is the target kernel headers directory
+UTS_RELEASE=$(sed -rn 's/^#define UTS_RELEASE "(.*)"/\1/p' "${KPATH}/include/generated/utsrelease.h")
+FEDORA_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/.*\.fc\([0-9]*\)\..*/\1/p')
+
+if [ "x${FEDORA_VERSION}" = "x" ]; then
+        echo 0
+        exit 0
+fi
+
+FEDORA_REVISION_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\-\([0-9]*\).*/\4/p')
+echo "${FEDORA_REVISION_VERSION}"
index 387aa0ab4322cec99753f6982cd2a35867ef1124..2b63a5d3048d66e424309fe10c4c005640076492 100644 (file)
                LTTNG_SLE_VERSION_CODE < \
                LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
 
+/* Fedora */
+
+#define LTTNG_FEDORA_KERNEL_VERSION(a, b, c, d) \
+        (((((a) << 16) + ((b) << 8) + (c)) * 10000ULL) + (d))
+
+#ifdef FEDORA_REVISION_VERSION
+#define LTTNG_FEDORA_VERSION_CODE \
+        ((LINUX_VERSION_CODE * 10000ULL) + FEDORA_REVISION_VERSION)
+#else
+#define LTTNG_FEDORA_VERSION_CODE         0
+#endif
+
+#define LTTNG_FEDORA_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
+                a_high, b_high, c_high, d_high) \
+        (LTTNG_FEDORA_VERSION_CODE >= \
+                LTTNG_FEDORA_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
+                LTTNG_FEDORA_VERSION_CODE < \
+                LTTNG_FEDORA_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+
 /* RT patch */
 
 #define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
This page took 0.028286 seconds and 4 git commands to generate.