VirtualBox

source: vbox/trunk/include/iprt/linux/version.h@ 85702

Last change on this file since 85702 was 85702, checked in by vboxsync, 5 years ago

IPRT,lnx-kmods: s/VBOX_RHEL_MAJ_PREREQ/RTLNX_RHEL_MAJ_PREREQ/ and added RTLNX_RHEL_PREREQ. Eliminated confusing RHEL_81 & RHEL_82 defines from the-linux-kernel.h.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/* $Id: version.h 85702 2020-08-11 18:38:50Z vboxsync $ */
2/** @file
3 * IPRT - Linux kernel version.
4 */
5
6/*
7 * Copyright (C) 2006-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef IPRT_INCLUDED_linux_version_h
28#define IPRT_INCLUDED_linux_version_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <linux/version.h>
34
35/** @def RTLNX_VER_MIN
36 * Evaluates to true if the linux kernel version is equal or higher to the
37 * one specfied. */
38#define RTLNX_VER_MIN(a_Major, a_Minor, a_Patch) \
39 (LINUX_VERSION_CODE >= KERNEL_VERSION(a_Major, a_Minor, a_Patch))
40
41/** @def RTLNX_VER_MAX
42 * Evaluates to true if the linux kernel version is less to the one specfied
43 * (exclusive). */
44#define RTLNX_VER_MAX(a_Major, a_Minor, a_Patch) \
45 (LINUX_VERSION_CODE < KERNEL_VERSION(a_Major, a_Minor, a_Patch))
46
47/** @def RTLNX_VER_RANGE
48 * Evaluates to true if the linux kernel version is equal or higher to the given
49 * minimum version and less (but not equal) to the maximum version (exclusive). */
50#define RTLNX_VER_RANGE(a_MajorMin, a_MinorMin, a_PatchMin, a_MajorMax, a_MinorMax, a_PatchMax) \
51 ( LINUX_VERSION_CODE >= KERNEL_VERSION(a_MajorMin, a_MinorMin, a_PatchMin) \
52 && LINUX_VERSION_CODE < KERNEL_VERSION(a_MajorMax, a_MinorMax, a_PatchMax) )
53
54
55/** @def RTLNX_RHEL_PREREQ
56 * Require a minium RedHat release.
57 * @param a_iMajor The major release number (RHEL_MAJOR).
58 * @param a_iMinor The minor release number (RHEL_MINOR).
59 * @sa RTLNX_RHEL_MAJ_PREREQ
60 */
61#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
62# define RTLNX_RHEL_PREREQ(a_iMajor, a_iMinor) \
63 ((RHEL_MAJOR) > (a_iMajor) || ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) >= (a_iMinor)))
64#else
65# define RTLNX_RHEL_PREREQ(a_iMajor, a_iMinor) (0)
66#endif
67
68/** @def RTLNX_RHEL_MAJ_PREREQ
69 * Require a minimum minor release number for the given RedHat release.
70 * @param a_iMajor RHEL_MAJOR must _equal_ this.
71 * @param a_iMinor RHEL_MINOR must be greater or equal to this.
72 * @sa RTLNX_RHEL_PREREQ
73 */
74#if defined(RHEL_MAJOR) && defined(RHEL_MINOR)
75# define RTLNX_RHEL_MAJ_PREREQ(a_iMajor, a_iMinor) ((RHEL_MAJOR) == (a_iMajor) && (RHEL_MINOR) >= (a_iMinor))
76#else
77# define RTLNX_RHEL_MAJ_PREREQ(a_iMajor, a_iMinor) (0)
78#endif
79
80/** @def RTLNX_SUSE_MAJ_PREREQ
81 * Require a minimum minor release number for the given SUSE release.
82 * @param a_iMajor CONFIG_SUSE_VERSION must _equal_ this.
83 * @param a_iMinor CONFIG_SUSE_PATCHLEVEL must be greater or equal to this.
84 */
85#if defined(CONFIG_SUSE_VERSION) && defined(CONFIG_SUSE_PATCHLEVEL)
86# define RTLNX_SUSE_MAJ_PREREQ(a_iMajor, a_iMinor) ((CONFIG_SUSE_VERSION) == (a_iMajor) && (CONFIG_SUSE_PATCHLEVEL) >= (a_iMinor))
87#else
88# define RTLNX_SUSE_MAJ_PREREQ(a_iMajor, a_iMinor) (0)
89#endif
90
91
92#endif /* !IPRT_INCLUDED_linux_version_h */
93
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette