VirtualBox

Changeset 88978 in vbox for trunk/include


Ignore:
Timestamp:
May 11, 2021 12:10:09 PM (4 years ago)
Author:
vboxsync
Message:

Reverted for rework r144310, r144311, r144312 and r144313, ​bugref:10007.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/linux/version.h

    r88975 r88978  
    3232
    3333#include <linux/version.h>
    34 
    35 /* We need utsrelease.h in order to detect Ubuntu kernel,
    36  * i.e. check if UTS_UBUNTU_RELEASE_ABI is defined. Support kernels
    37  * starting from Ubuntu 14.04 Trusty which is based on upstream
    38  * kernel 3.13.11. */
    39 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,11))
    40 # include <generated/utsrelease.h>
    41 # include <iprt/cdefs.h>
    42 #endif
    4334
    4435/** @def RTLNX_VER_MIN
     
    125116
    126117
    127 #if defined(UTS_UBUNTU_RELEASE_ABI)
    128 /** @def RTLNX_UBUNTU_VERSION
    129  * Ubuntu kernels are based on upstream kernels and provide
    130  * version information with regular KERNEL_VERSION() macro. However,
    131  * Ubuntu kernel additionally provides UTS_UBUNTU_RELEASE_ABI macro
    132  * which increases with the kernel update while KERNEL_VERSION() info
    133  * stays the same.
    134  *
    135  * UTS_UBUNTU_RELEASE_ABI does not increase constantly, but rather reset
    136  * when the next kernel update is based on a newer upstream version (i.e.
    137  * KERNEL_VERSION() value has changed). Therefore, in order to compare
    138  * Ubuntu kernels, UTS_UBUNTU_RELEASE_ABI macro is treated as a KERNEL_VERSION()
    139  * extension and appended to the end of it. So, regular 24-bit-value
    140  * of KERNEL_VERSION() becomes 32-bit-value, as can be seen below.
    141  *
    142  * NOTE: @a_iVer is expected to be in range of [0x000000..0xFFFFFF],
    143  * @a_iAbi is expected to be in range of [0x00..0xFF].
    144  *
    145  * @param a_iVer        The 24-bit-value of kernel version number, result
    146  *                      of KERNEL_VERSION() macro.
    147  * @param a_iAbi        8-bit Ubuntu kernel ABI version number.
    148  */
    149 # define RTLNX_UBUNTU_VERSION(a_iVer, a_iAbi) \
    150     (((a_iVer) << 8) | (RT_MIN((a_iAbi), 0xFF)))
    151 
    152 /** @def RTLNX_UBUNTU_MIN
    153  * Require Ubuntu release to be equal or newer than specified version.
    154  * @param a_iMajor      The major kernel version number.
    155  * @param a_iMinor      The minor kernel version number.
    156  * @param a_iPatch      The micro kernel version number.
    157  * @param a_iAbi        Ubuntu kernel ABI version number.
    158  */
    159 # define RTLNX_UBUNTU_MIN(a_iMajor, a_iMinor, a_iPatch, a_iAbi) \
    160     (   RTLNX_UBUNTU_VERSION(LINUX_VERSION_CODE, UTS_UBUNTU_RELEASE_ABI) \
    161      >= RTLNX_UBUNTU_VERSION(KERNEL_VERSION(a_iMajor, a_iMinor, a_iPatch), a_iAbi) )
    162 
    163 /** @def RTLNX_UBUNTU_MAX
    164  * Require Ubuntu release to be older than specified version.
    165  * @param a_iMajor      The major kernel version number.
    166  * @param a_iMinor      The minor kernel version number.
    167  * @param a_iPatch      The micro kernel version number.
    168  * @param a_iAbi        Ubuntu kernel ABI version number.
    169  */
    170 # define RTLNX_UBUNTU_MAX(a_iMajor, a_iMinor, a_iPatch, a_iAbi) \
    171     (   RTLNX_UBUNTU_VERSION(LINUX_VERSION_CODE, UTS_UBUNTU_RELEASE_ABI) \
    172      <  RTLNX_UBUNTU_VERSION(KERNEL_VERSION(a_iMajor, a_iMinor, a_iPatch), a_iAbi) )
    173 
    174 /** @def RTLNX_UBUNTU_RANGE
    175  * Require Ubuntu release to be in specified versions range.
    176  * The max version is exclusive, the minimum inclusive.
    177  *
    178  * @param a_iMajorMin   The major kernel version number (minimum).
    179  * @param a_iMinorMin   The minor kernel version number (minimum).
    180  * @param a_iPatchMin   The micro kernel version number (minimum).
    181  * @param a_iAbiMin     Ubuntu kernel ABI version number (minimum).
    182  * @param a_iMajorMax   The major kernel version number (maximum).
    183  * @param a_iMinorMax   The minor kernel version number (maximum).
    184  * @param a_iPatchMax   The micro kernel version number (maximum).
    185  * @param a_iAbiMax     Ubuntu kernel ABI version number (maximum).
    186  */
    187 # define RTLNX_UBUNTU_RANGE(a_iMajorMin, a_iMinorMin, a_iPatchMin, a_iAbiMin, \
    188     a_iMajorMax, a_iMinorMax, a_iPatchMax, a_iAbiMax) \
    189     (   RTLNX_UBUNTU_MIN(a_iMajorMin, a_iMinorMin, a_iPatchMin, a_iAbiMin) \
    190      && RTLNX_UBUNTU_MAX(a_iMajorMax, a_iMinorMax, a_iPatchMax, a_iAbiMax))
    191 
    192 #else /* !UTS_UBUNTU_RELEASE_ABI */
    193 # define RTLNX_UBUNTU_MIN(a_iMajor, a_iMinor, a_iPatch, a_iAbi)  (0)
    194 # define RTLNX_UBUNTU_MAX(a_iMajor, a_iMinor, a_iPatch, a_iAbi)  (0)
    195 #define RTLNX_UBUNTU_RANGE(a_iMajorMin, a_iMinorMin, a_iPatchMin, a_iAbiMin, \
    196     a_iMajorMax, a_iMinorMax, a_iPatchMax, a_iAbiMax) (0)
    197 #endif /* !UTS_UBUNTU_RELEASE_ABI */
    198 
    199118#endif /* !IPRT_INCLUDED_linux_version_h */
    200119
Note: See TracChangeset for help on using the changeset viewer.

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