1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
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>
14 #include <generated/utsrelease.h>
17 * This macro checks if the kernel version is between the two specified
18 * versions (lower limit inclusive, upper limit exclusive).
20 #define LTTNG_KERNEL_RANGE(a_low, b_low, c_low, a_high, b_high, c_high) \
21 (LINUX_VERSION_CODE >= KERNEL_VERSION(a_low, b_low, c_low) && \
22 LINUX_VERSION_CODE < KERNEL_VERSION(a_high, b_high, c_high))
26 #define LTTNG_UBUNTU_KERNEL_VERSION(a, b, c, d) \
27 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
29 #ifdef UTS_UBUNTU_RELEASE_ABI
30 #define LTTNG_UBUNTU_VERSION_CODE \
31 ((LINUX_VERSION_CODE << 8) + UTS_UBUNTU_RELEASE_ABI)
33 #define LTTNG_UBUNTU_VERSION_CODE 0
36 #define LTTNG_UBUNTU_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
37 a_high, b_high, c_high, d_high) \
38 (LTTNG_UBUNTU_VERSION_CODE >= \
39 LTTNG_UBUNTU_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
40 LTTNG_UBUNTU_VERSION_CODE < \
41 LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
45 #define LTTNG_DEBIAN_KERNEL_VERSION(a, b, c, d, e, f) \
46 (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
48 #ifdef DEBIAN_API_VERSION
49 #define LTTNG_DEBIAN_VERSION_CODE \
50 ((LINUX_VERSION_CODE * 1000000ULL) + DEBIAN_API_VERSION)
52 #define LTTNG_DEBIAN_VERSION_CODE 0
55 #define LTTNG_DEBIAN_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
56 a_high, b_high, c_high, d_high, e_high, f_high) \
57 (LTTNG_DEBIAN_VERSION_CODE >= \
58 LTTNG_DEBIAN_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
59 LTTNG_DEBIAN_VERSION_CODE < \
60 LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
62 #define LTTNG_RHEL_KERNEL_VERSION(a, b, c, d, e, f) \
63 (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
67 #ifdef RHEL_API_VERSION
68 #define LTTNG_RHEL_VERSION_CODE \
69 ((LINUX_VERSION_CODE * 10000000ULL) + RHEL_API_VERSION)
71 #define LTTNG_RHEL_VERSION_CODE 0
74 #define LTTNG_RHEL_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
75 a_high, b_high, c_high, d_high, e_high, f_high) \
76 (LTTNG_RHEL_VERSION_CODE >= \
77 LTTNG_RHEL_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
78 LTTNG_RHEL_VERSION_CODE < \
79 LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
81 /* SUSE Linux enterprise */
83 #define LTTNG_SLE_KERNEL_VERSION(a, b, c, d, e, f) \
84 (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
86 #ifdef SLE_API_VERSION
87 #define LTTNG_SLE_VERSION_CODE \
88 ((LINUX_VERSION_CODE * 10000000ULL) + SLE_API_VERSION)
90 #define LTTNG_SLE_VERSION_CODE 0
93 #define LTTNG_SLE_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
94 a_high, b_high, c_high, d_high, e_high, f_high) \
95 (LTTNG_SLE_VERSION_CODE >= \
96 LTTNG_SLE_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
97 LTTNG_SLE_VERSION_CODE < \
98 LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
102 #define LTTNG_FEDORA_KERNEL_VERSION(a, b, c, d) \
103 (((((a) << 16) + ((b) << 8) + (c)) * 10000ULL) + (d))
105 #ifdef FEDORA_REVISION_VERSION
106 #define LTTNG_FEDORA_VERSION_CODE \
107 ((LINUX_VERSION_CODE * 10000ULL) + FEDORA_REVISION_VERSION)
109 #define LTTNG_FEDORA_VERSION_CODE 0
112 #define LTTNG_FEDORA_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
113 a_high, b_high, c_high, d_high) \
114 (LTTNG_FEDORA_VERSION_CODE >= \
115 LTTNG_FEDORA_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
116 LTTNG_FEDORA_VERSION_CODE < \
117 LTTNG_FEDORA_KERNEL_VERSION(a_high, b_high, c_high, d_high))
121 #define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
122 (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
124 #ifdef RT_PATCH_VERSION
125 #define LTTNG_RT_VERSION_CODE \
126 ((LINUX_VERSION_CODE << 8) + RT_PATCH_VERSION)
128 #define LTTNG_RT_VERSION_CODE 0
131 #define LTTNG_RT_KERNEL_RANGE(a_low, b_low, c_low, d_low, \
132 a_high, b_high, c_high, d_high) \
133 (LTTNG_RT_VERSION_CODE >= \
134 LTTNG_RT_KERNEL_VERSION(a_low, b_low, c_low, d_low) && \
135 LTTNG_RT_VERSION_CODE < \
136 LTTNG_RT_KERNEL_VERSION(a_high, b_high, c_high, d_high))
138 #endif /* _LTTNG_KERNEL_VERSION_H */
This page took 0.036418 seconds and 5 git commands to generate.