VirtualBox

Changeset 85690 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Aug 11, 2020 1:23:16 PM (4 years ago)
Author:
vboxsync
Message:

IPRT/the-linux-kernel.h: Adding macros for shortening the kernel version checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h

    r85518 r85690  
    4848#endif
    4949
     50
     51/** @def RTLNX_VER_MIN
     52 * Evaluates to true if the linux kernel version is equal or higher to the
     53 * one specfied. */
     54#define RTLNX_VER_MIN(a_Major, a_Minor, a_Patch) \
     55    (LINUX_VERSION_CODE >= KERNEL_VERSION(a_Major, a_Minor, a_Patch))
     56/** @def RTLNX_VER_MAX
     57 * Evaluates to true if the linux kernel version is less to the one specfied
     58 * (exclusive). */
     59#define RTLNX_VER_MAX(a_Major, a_Minor, a_Patch) \
     60    (LINUX_VERSION_CODE <  KERNEL_VERSION(a_Major, a_Minor, a_Patch))
     61/** @def RTLNX_VER_RANGE
     62 * Evaluates to true if the linux kernel version is equal or higher to the given
     63 * minimum version and less (but not equal) to the maximum version (exclusive). */
     64#define RTLNX_VER_RANGE(a_MajorMin, a_MinorMin, a_PatchMin,  a_MajorMax, a_MinorMax, a_PatchMax) \
     65    (   LINUX_VERSION_CODE >= KERNEL_VERSION(a_MajorMin, a_MinorMin, a_PatchMin) \
     66     && LINUX_VERSION_CODE <  KERNEL_VERSION(a_MajorMax, a_MinorMax, a_PatchMax) )
     67
     68
    5069#include <linux/version.h>
    5170#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
     
    5978/* We only support 2.4 and 2.6 series kernels */
    6079#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
    61 # error We only support 2.4 and 2.6 series kernels
     80# error Sorry, we do not support 2.3 and earlier kernels.
    6281#endif
    6382#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
    64 # error We only support 2.4 and 2.6 series kernels
     83# error Sorry, we do not support 2.5 series kernels (might work though).
    6584#endif
    6685
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