VirtualBox

Ignore:
Timestamp:
Aug 11, 2020 5:05:29 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139838
Message:

IPRT,lnx-kmods: Use new linux kernel version checking macros. Moved them to separate wrapper header.

Location:
trunk/src/VBox/HostDrivers/VBoxNetAdp/linux
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c

    r82968 r85698  
    7676static int VBoxNetAdpLinuxOpen(struct inode *pInode, struct file *pFilp);
    7777static int VBoxNetAdpLinuxClose(struct inode *pInode, struct file *pFilp);
    78 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
     78#if RTLNX_VER_MAX(2,6,36)
    7979static int VBoxNetAdpLinuxIOCtl(struct inode *pInode, struct file *pFilp,
    8080                                unsigned int uCmd, unsigned long ulArg);
    81 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
     81#else  /* >= 2,6,36 */
    8282static long VBoxNetAdpLinuxIOCtlUnlocked(struct file *pFilp,
    8383                                         unsigned int uCmd, unsigned long ulArg);
    84 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
     84#endif /* >= 2,6,36 */
    8585
    8686static void vboxNetAdpEthGetDrvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
    87 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
     87#if RTLNX_VER_MIN(4,20,0)
    8888static int vboxNetAdpEthGetLinkSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *pLinkSettings);
    89 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
     89#else  /* < 4,20,0 */
    9090static int vboxNetAdpEthGetSettings(struct net_device *dev, struct ethtool_cmd *cmd);
    91 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
     91#endif /* < 4,20,0 */
    9292
    9393
     
    113113    open:       VBoxNetAdpLinuxOpen,
    114114    release:    VBoxNetAdpLinuxClose,
    115 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
     115#if RTLNX_VER_MAX(2,6,36)
    116116    ioctl:      VBoxNetAdpLinuxIOCtl,
    117 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
     117#else /* RTLNX_VER_MIN(2,6,36) */
    118118    unlocked_ioctl: VBoxNetAdpLinuxIOCtlUnlocked,
    119 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
     119#endif /* RTLNX_VER_MIN(2,6,36) */
    120120};
    121121
     
    126126    name:       VBOXNETADP_CTL_DEV_NAME,
    127127    fops:       &gFileOpsVBoxNetAdp,
    128 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)
     128# if RTLNX_VER_MAX(2,6,18)
    129129    devfs_name: VBOXNETADP_CTL_DEV_NAME
    130130# endif
    131131};
    132132
    133 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)
     133# if RTLNX_VER_MIN(2,6,19)
    134134static const struct ethtool_ops gEthToolOpsVBoxNetAdp =
    135135# else
     
    138138{
    139139    .get_drvinfo        = vboxNetAdpEthGetDrvinfo,
    140 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
     140# if RTLNX_VER_MIN(4,20,0)
    141141    .get_link_ksettings = vboxNetAdpEthGetLinkSettings,
    142 # else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
     142# else
    143143    .get_settings       = vboxNetAdpEthGetSettings,
    144 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
     144# endif
    145145    .get_link           = ethtool_op_get_link,
    146146};
     
    174174    pPriv->Stats.tx_packets++;
    175175    pPriv->Stats.tx_bytes += pSkb->len;
    176 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
     176#if RTLNX_VER_MAX(2,6,31)
    177177    /* Update transmission time stamp. */
    178178    pNetDev->trans_start = jiffies;
     
    214214
    215215
    216 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
     216# if RTLNX_VER_MIN(4,20,0)
    217217/* ethtool_ops::get_link_ksettings */
    218218static int vboxNetAdpEthGetLinkSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *pLinkSettings)
     
    230230    return 0;
    231231}
    232 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
     232#else /* RTLNX_VER_MAX(4,20,0) */
    233233/* ethtool_ops::get_settings */
    234234static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_cmd *cmd)
     
    236236    cmd->supported      = 0;
    237237    cmd->advertising    = 0;
    238 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
     238#if RTLNX_VER_MIN(2,6,27)
    239239    ethtool_cmd_speed_set(cmd, SPEED_10);
    240240#else
     
    250250    return 0;
    251251}
    252 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */
    253 
    254 
    255 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
     252#endif /* RTLNX_VER_MAX(4,20,0) */
     253
     254
     255#if RTLNX_VER_MIN(2,6,29)
    256256static const struct net_device_ops vboxNetAdpNetdevOps = {
    257257    .ndo_open               = vboxNetAdpLinuxOpen,
     
    267267
    268268    ether_setup(pNetDev);
    269 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
     269#if RTLNX_VER_MIN(2,6,29)
    270270    pNetDev->netdev_ops = &vboxNetAdpNetdevOps;
    271 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
     271#else /* RTLNX_VER_MAX(2,6,29) */
    272272    pNetDev->open = vboxNetAdpLinuxOpen;
    273273    pNetDev->stop = vboxNetAdpLinuxStop;
    274274    pNetDev->hard_start_xmit = vboxNetAdpLinuxXmit;
    275275    pNetDev->get_stats = vboxNetAdpLinuxGetStats;
    276 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
     276#endif /* RTLNX_VER_MAX(2,6,29) */
    277277
    278278    pNetDev->ethtool_ops = &gEthToolOpsVBoxNetAdp;
     
    291291    pNetDev = alloc_netdev(sizeof(VBOXNETADPPRIV),
    292292                           pThis->szName[0] ? pThis->szName : VBOXNETADP_LINUX_NAME,
    293 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)
     293#if RTLNX_VER_MIN(3,17,0)
    294294                           NET_NAME_UNKNOWN,
    295295#endif
     
    391391 * @param   ulArg       The argument specified to ioctl().
    392392 */
    393 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
     393#if RTLNX_VER_MAX(2,6,36)
    394394static int VBoxNetAdpLinuxIOCtl(struct inode *pInode, struct file *pFilp,
    395395                                unsigned int uCmd, unsigned long ulArg)
    396 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
     396#else /* RTLNX_VER_MIN(2,6,36) */
    397397static long VBoxNetAdpLinuxIOCtlUnlocked(struct file *pFilp,
    398398                                         unsigned int uCmd, unsigned long ulArg)
    399 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) */
     399#endif /* RTLNX_VER_MIN(2,6,36) */
    400400{
    401401    VBOXNETADPREQ Req;
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp

    r82968 r85698  
    6666    ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
    6767    ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \
     68    ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \
    6869    ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \
    6970    ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \
Note: See TracChangeset for help on using the changeset viewer.

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