1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
3 * lttng-kernel-version.h
5 * Contains helpers to check more complex kernel version conditions.
7 * Copyright (C) 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #ifndef _LTTNG_KERNEL_VERSION_H
11 #define _LTTNG_KERNEL_VERSION_H
13 #include <linux/version.h>
15 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
16 #include <generated/utsrelease.h>
17 #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) */
18 #include <linux/utsrelease.h>
19 #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) */
22 * This macro checks if the kernel version is between the two specified
23 * versions (lower limit inclusive, upper limit exclusive).
25 #define LTTNG_KERNEL_RANGE(a_low, b_low, c_low, a_high, b_high, c_high) \
26 (LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
27 LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
31 #define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
32 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
34 #ifdef UTS_UBUNTU_RELEASE_ABI
35 #define LTTNG_UBUNTU_VERSION_CODE \
36 ((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
38 #define LTTNG_UBUNTU_VERSION_CODE 0
41 #define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
42 a_high, b_high, c_high, d_high) \
43 (LTTNG_UBUNTU_VERSION_CODE >= \
44 LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
45 LTTNG_UBUNTU_VERSION_CODE < \
46 LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
50 #define LTTNG_DEBIAN_KERNEL_VERSION(a, b, c, d, e, f) \
51 (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
53 #ifdef DEBIAN_API_VERSION
54 #define LTTNG_DEBIAN_VERSION_CODE \
55 ((LINUX_VERSION_CODE * 1000000ULL) + DEBIAN_API_VERSION)
57 #define LTTNG_DEBIAN_VERSION_CODE 0
60 #define LTTNG_DEBIAN_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
61 a_high, b_high, c_high, d_high, e_high, f_high) \
62 (LTTNG_DEBIAN_VERSION_CODE >= \
63 LTTNG_DEBIAN_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
64 LTTNG_DEBIAN_VERSION_CODE < \
65 LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
67 #define LTTNG_RHEL_KERNEL_VERSION(a, b, c, d, e, f) \
68 (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
72 #ifdef RHEL_API_VERSION
73 #define LTTNG_RHEL_VERSION_CODE \
74 ((LINUX_VERSION_CODE * 10000000ULL) + RHEL_API_VERSION)
76 #define LTTNG_RHEL_VERSION_CODE 0
79 #define LTTNG_RHEL_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
80 a_high, b_high, c_high, d_high, e_high, f_high) \
81 (LTTNG_RHEL_VERSION_CODE >= \
82 LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
83 LTTNG_RHEL_VERSION_CODE < \
84 LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
86 /* SUSE Linux enterprise */
88 #define LTTNG_SLE_KERNEL_VERSION(a, b, c, d, e, f) \
89 (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
91 #ifdef SLE_API_VERSION
92 #define LTTNG_SLE_VERSION_CODE \
93 ((LINUX_VERSION_CODE * 10000000ULL) + SLE_API_VERSION)
95 #define LTTNG_SLE_VERSION_CODE 0
98 #define LTTNG_SLE_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
99 a_high, b_high, c_high, d_high, e_high, f_high) \
100 (LTTNG_SLE_VERSION_CODE >= \
101 LTTNG_SLE_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
102 LTTNG_SLE_VERSION_CODE < \
103 LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
107 #define LTTNG_FEDORA_KERNEL_VERSION(a, b, c, d) \
108 (((((a) << 16) + ((b) << 8) + (c)) * 10000ULL) + (d))
110 #ifdef FEDORA_REVISION_VERSION
111 #define LTTNG_FEDORA_VERSION_CODE \
112 ((LINUX_VERSION_CODE * 10000ULL) + FEDORA_REVISION_VERSION)
114 #define LTTNG_FEDORA_VERSION_CODE 0
117 #define LTTNG_FEDORA_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
118 a_high, b_high, c_high, d_high) \
119 (LTTNG_FEDORA_VERSION_CODE >= \
120 LTTNG_FEDORA_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
121 LTTNG_FEDORA_VERSION_CODE < \
122 LTTNG_FEDORA_KERNEL_VERSION(a_high, b_high, c_high, d_high))
126 #define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
127 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
129 #ifdef RT_PATCH_VERSION
130 #define LTTNG_RT_VERSION_CODE \
131 ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
133 #define LTTNG_RT_VERSION_CODE 0
136 #define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
137 a_high, b_high, c_high, d_high) \
138 (LTTNG_RT_VERSION_CODE >= \
139 LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
140 LTTNG_RT_VERSION_CODE < \
141 LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
143 #endif /* _LTTNG_KERNEL_VERSION_H */
This page took 0.056311 seconds and 4 git commands to generate.