Changeset 85698 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Aug 11, 2020 5:05:29 PM (4 years ago)
- Location:
- trunk/src/VBox/HostDrivers
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrvInternal.h
r85552 r85698 55 55 56 56 #elif defined(RT_OS_LINUX) 57 # include < linux/version.h>58 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,33)57 # include <iprt/linux/version.h> 58 # if RTLNX_VER_MIN(2,6,33) 59 59 # include <generated/autoconf.h> 60 60 # else … … 65 65 # if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS) 66 66 # define MODVERSIONS 67 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5,71)67 # if RTLNX_VER_MAX(2,5,71) 68 68 # include <linux/modversions.h> 69 69 # endif 70 70 # endif 71 71 # ifndef KBUILD_STR 72 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,16)72 # if RTLNX_VER_MAX(2,6,16) 73 73 # define KBUILD_STR(s) s 74 74 # else … … 79 79 # include <linux/spinlock.h> 80 80 # include <linux/slab.h> 81 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)81 # if RTLNX_VER_MIN(2,6,27) 82 82 # include <linux/semaphore.h> 83 83 # else /* older kernels */ -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r85505 r85698 47 47 48 48 /** @todo figure out the exact version number */ 49 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,16)49 #if RTLNX_VER_MIN(2,6,16) 50 50 # include <iprt/power.h> 51 51 # define VBOX_WITH_SUSPEND_NOTIFICATION … … 57 57 # include <linux/platform_device.h> 58 58 #endif 59 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)) && defined(SUPDRV_WITH_MSR_PROBER)59 #if (RTLNX_VER_MIN(2,6,28)) && defined(SUPDRV_WITH_MSR_PROBER) 60 60 # define SUPDRV_LINUX_HAS_SAFE_MSR_API 61 61 # include <asm/msr.h> … … 72 72 /* check kernel version */ 73 73 # ifndef SUPDRV_AGNOSTIC 74 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,0)74 # if RTLNX_VER_MAX(2,6,0) 75 75 # error Unsupported kernel version! 76 76 # endif … … 112 112 #ifdef VBOX_WITH_SUSPEND_NOTIFICATION 113 113 static int VBoxDrvProbe(struct platform_device *pDev); 114 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)114 # if RTLNX_VER_MIN(2,6,30) 115 115 static int VBoxDrvSuspend(struct device *pDev); 116 116 static int VBoxDrvResume(struct device *pDev); … … 140 140 #define DEVICE_NAME_USR "vboxdrvu" 141 141 142 #if (defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK)142 #if (defined(RT_ARCH_AMD64) && RTLNX_VER_MAX(2,6,23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK) 143 143 /** 144 144 * Memory for the executable memory heap (in IPRT). … … 203 203 name: DEVICE_NAME_SYS, 204 204 fops: &gFileOpsVBoxDrvSys, 205 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)205 # if RTLNX_VER_MAX(2,6,18) 206 206 devfs_name: DEVICE_NAME_SYS, 207 207 # endif … … 213 213 name: DEVICE_NAME_USR, 214 214 fops: &gFileOpsVBoxDrvUsr, 215 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)215 # if RTLNX_VER_MAX(2,6,18) 216 216 devfs_name: DEVICE_NAME_USR, 217 217 # endif … … 220 220 221 221 #ifdef VBOX_WITH_SUSPEND_NOTIFICATION 222 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)222 # if RTLNX_VER_MIN(2,6,30) 223 223 static struct dev_pm_ops gPlatformPMOps = 224 224 { … … 233 233 { 234 234 .probe = VBoxDrvProbe, 235 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,30)235 # if RTLNX_VER_MAX(2,6,30) 236 236 .suspend = VBoxDrvSuspend, 237 237 .resume = VBoxDrvResume, … … 241 241 { 242 242 .name = "vboxdrv", 243 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)243 # if RTLNX_VER_MIN(2,6,30) 244 244 .pm = &gPlatformPMOps, 245 245 # endif … … 260 260 DECLINLINE(RTUID) vboxdrvLinuxUid(void) 261 261 { 262 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)263 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)262 #if RTLNX_VER_MIN(2,6,29) 263 # if RTLNX_VER_MIN(3,5,0) 264 264 return from_kuid(current_user_ns(), current->cred->uid); 265 265 # else … … 273 273 DECLINLINE(RTGID) vboxdrvLinuxGid(void) 274 274 { 275 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)276 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)275 #if RTLNX_VER_MIN(2,6,29) 276 # if RTLNX_VER_MIN(3,5,0) 277 277 return from_kgid(current_user_ns(), current->cred->gid); 278 278 # else … … 286 286 DECLINLINE(RTUID) vboxdrvLinuxEuid(void) 287 287 { 288 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)289 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)288 #if RTLNX_VER_MIN(2,6,29) 289 # if RTLNX_VER_MIN(3,5,0) 290 290 return from_kuid(current_user_ns(), current->cred->euid); 291 291 # else … … 332 332 if (RT_SUCCESS(rc)) 333 333 { 334 #if (defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK)334 #if (defined(RT_ARCH_AMD64) && RTLNX_VER_MAX(2,6,23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK) 335 335 # ifdef VBOX_WITH_TEXT_MODMEM_HACK 336 336 set_memory_x(&g_abExecMemory[0], sizeof(g_abExecMemory) / PAGE_SIZE); … … 516 516 * Ignored. 517 517 */ 518 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30) && !defined(DOXYGEN_RUNNING)518 # if RTLNX_VER_MIN(2,6,30) && !defined(DOXYGEN_RUNNING) 519 519 static int VBoxDrvSuspend(struct device *pDev) 520 520 # else … … 531 531 * @param pDev Pointer to the platform device. 532 532 */ 533 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)533 # if RTLNX_VER_MIN(2,6,30) 534 534 static int VBoxDrvResume(struct device *pDev) 535 535 # else … … 757 757 RTCCUINTREG VBOXCALL supdrvOSChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask) 758 758 { 759 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8,0)759 #if RTLNX_VER_MIN(5,8,0) 760 760 RTCCUINTREG const uOld = __read_cr4(); 761 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20,0)761 #elif RTLNX_VER_MIN(3,20,0) 762 762 RTCCUINTREG const uOld = this_cpu_read(cpu_tlbstate.cr4); 763 763 #else … … 767 767 if (uNew != uOld) 768 768 { 769 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8,0)769 #if RTLNX_VER_MIN(5,8,0) 770 770 ASMSetCR4(uNew); 771 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20,0)771 #elif RTLNX_VER_MIN(3,20,0) 772 772 this_cpu_write(cpu_tlbstate.cr4, uNew); 773 773 __write_cr4(uNew); … … 1121 1121 1122 1122 /* Nobody waiting and no exit function. */ 1123 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13,0)1123 # if RTLNX_VER_MAX(3,13,0) 1124 1124 pMyMod->waiter = NULL; 1125 1125 # endif … … 1128 1128 /* References, very important as we must not allow the module 1129 1129 to be unloaded using rmmod. */ 1130 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19,0)1130 # if RTLNX_VER_MIN(3,19,0) 1131 1131 atomic_set(&pMyMod->refcnt, 42); 1132 1132 # else … … 1213 1213 mutex_unlock(&module_mutex); 1214 1214 1215 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19,0)1215 # if RTLNX_VER_MAX(3,19,0) 1216 1216 free_percpu(pMyMod->refptr); 1217 1217 # endif … … 1432 1432 fFlags |= SUPKERNELFEATURES_GDT_READ_ONLY; 1433 1433 #endif 1434 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)1434 #if RTLNX_VER_MIN(4,12,0) 1435 1435 fFlags |= SUPKERNELFEATURES_GDT_NEED_WRITABLE; 1436 1436 #endif … … 1447 1447 int VBOXCALL supdrvOSGetCurrentGdtRw(RTHCUINTPTR *pGdtRw) 1448 1448 { 1449 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12,0)1449 #if RTLNX_VER_MIN(4,12,0) 1450 1450 *pGdtRw = (RTHCUINTPTR)get_current_gdt_rw(); 1451 1451 return VINF_SUCCESS; -
trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv
r85523 r85698 73 73 ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ 74 74 ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \ 75 ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \ 75 76 ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ 76 77 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ -
trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c
r82968 r85698 76 76 static int VBoxNetAdpLinuxOpen(struct inode *pInode, struct file *pFilp); 77 77 static 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) 79 79 static int VBoxNetAdpLinuxIOCtl(struct inode *pInode, struct file *pFilp, 80 80 unsigned int uCmd, unsigned long ulArg); 81 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)*/81 #else /* >= 2,6,36 */ 82 82 static long VBoxNetAdpLinuxIOCtlUnlocked(struct file *pFilp, 83 83 unsigned int uCmd, unsigned long ulArg); 84 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36)*/84 #endif /* >= 2,6,36 */ 85 85 86 86 static 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) 88 88 static 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 */ 90 90 static 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 */ 92 92 93 93 … … 113 113 open: VBoxNetAdpLinuxOpen, 114 114 release: VBoxNetAdpLinuxClose, 115 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,36)115 #if RTLNX_VER_MAX(2,6,36) 116 116 ioctl: VBoxNetAdpLinuxIOCtl, 117 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36) */117 #else /* RTLNX_VER_MIN(2,6,36) */ 118 118 unlocked_ioctl: VBoxNetAdpLinuxIOCtlUnlocked, 119 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36) */119 #endif /* RTLNX_VER_MIN(2,6,36) */ 120 120 }; 121 121 … … 126 126 name: VBOXNETADP_CTL_DEV_NAME, 127 127 fops: &gFileOpsVBoxNetAdp, 128 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 17)128 # if RTLNX_VER_MAX(2,6,18) 129 129 devfs_name: VBOXNETADP_CTL_DEV_NAME 130 130 # endif 131 131 }; 132 132 133 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)133 # if RTLNX_VER_MIN(2,6,19) 134 134 static const struct ethtool_ops gEthToolOpsVBoxNetAdp = 135 135 # else … … 138 138 { 139 139 .get_drvinfo = vboxNetAdpEthGetDrvinfo, 140 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20,0)140 # if RTLNX_VER_MIN(4,20,0) 141 141 .get_link_ksettings = vboxNetAdpEthGetLinkSettings, 142 # else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */142 # else 143 143 .get_settings = vboxNetAdpEthGetSettings, 144 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) */144 # endif 145 145 .get_link = ethtool_op_get_link, 146 146 }; … … 174 174 pPriv->Stats.tx_packets++; 175 175 pPriv->Stats.tx_bytes += pSkb->len; 176 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,31)176 #if RTLNX_VER_MAX(2,6,31) 177 177 /* Update transmission time stamp. */ 178 178 pNetDev->trans_start = jiffies; … … 214 214 215 215 216 # if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20,0)216 # if RTLNX_VER_MIN(4,20,0) 217 217 /* ethtool_ops::get_link_ksettings */ 218 218 static int vboxNetAdpEthGetLinkSettings(struct net_device *pNetDev, struct ethtool_link_ksettings *pLinkSettings) … … 230 230 return 0; 231 231 } 232 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 20,0) */232 #else /* RTLNX_VER_MAX(4,20,0) */ 233 233 /* ethtool_ops::get_settings */ 234 234 static int vboxNetAdpEthGetSettings(struct net_device *pNetDev, struct ethtool_cmd *cmd) … … 236 236 cmd->supported = 0; 237 237 cmd->advertising = 0; 238 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)238 #if RTLNX_VER_MIN(2,6,27) 239 239 ethtool_cmd_speed_set(cmd, SPEED_10); 240 240 #else … … 250 250 return 0; 251 251 } 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) 256 256 static const struct net_device_ops vboxNetAdpNetdevOps = { 257 257 .ndo_open = vboxNetAdpLinuxOpen, … … 267 267 268 268 ether_setup(pNetDev); 269 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)269 #if RTLNX_VER_MIN(2,6,29) 270 270 pNetDev->netdev_ops = &vboxNetAdpNetdevOps; 271 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29) */271 #else /* RTLNX_VER_MAX(2,6,29) */ 272 272 pNetDev->open = vboxNetAdpLinuxOpen; 273 273 pNetDev->stop = vboxNetAdpLinuxStop; 274 274 pNetDev->hard_start_xmit = vboxNetAdpLinuxXmit; 275 275 pNetDev->get_stats = vboxNetAdpLinuxGetStats; 276 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29) */276 #endif /* RTLNX_VER_MAX(2,6,29) */ 277 277 278 278 pNetDev->ethtool_ops = &gEthToolOpsVBoxNetAdp; … … 291 291 pNetDev = alloc_netdev(sizeof(VBOXNETADPPRIV), 292 292 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) 294 294 NET_NAME_UNKNOWN, 295 295 #endif … … 391 391 * @param ulArg The argument specified to ioctl(). 392 392 */ 393 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,36)393 #if RTLNX_VER_MAX(2,6,36) 394 394 static int VBoxNetAdpLinuxIOCtl(struct inode *pInode, struct file *pFilp, 395 395 unsigned int uCmd, unsigned long ulArg) 396 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36) */396 #else /* RTLNX_VER_MIN(2,6,36) */ 397 397 static long VBoxNetAdpLinuxIOCtlUnlocked(struct file *pFilp, 398 398 unsigned int uCmd, unsigned long ulArg) 399 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36) */399 #endif /* RTLNX_VER_MIN(2,6,36) */ 400 400 { 401 401 VBOXNETADPREQ Req; -
trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/files_vboxnetadp
r82968 r85698 66 66 ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ 67 67 ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \ 68 ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \ 68 69 ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ 69 70 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r85588 r85698 35 35 #include "revision-generated.h" 36 36 #include "product-generated.h" 37 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,24)37 #if RTLNX_VER_MIN(2,6,24) 38 38 #include <linux/nsproxy.h> 39 39 #endif … … 46 46 #include <linux/ip.h> 47 47 #include <linux/if_vlan.h> 48 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5,0)48 #if RTLNX_VER_MIN(4,5,0) 49 49 #include <uapi/linux/pkt_cls.h> 50 50 #endif … … 90 90 #endif 91 91 92 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11,0)92 #if RTLNX_VER_MIN(3,11,0) 93 93 # define VBOX_NETDEV_NOTIFIER_INFO_TO_DEV(ptr) netdev_notifier_info_to_dev(ptr) 94 94 #else … … 96 96 #endif 97 97 98 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)98 #if RTLNX_VER_MIN(3,5,0) 99 99 # define VBOX_SKB_KMAP_FRAG(frag) kmap_atomic(skb_frag_page(frag)) 100 100 # define VBOX_SKB_KUNMAP_FRAG(vaddr) kunmap_atomic(vaddr) 101 101 #else 102 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2,0)102 # if RTLNX_VER_MIN(3,2,0) 103 103 # define VBOX_SKB_KMAP_FRAG(frag) kmap_atomic(skb_frag_page(frag), KM_SKB_DATA_SOFTIRQ) 104 104 # define VBOX_SKB_KUNMAP_FRAG(vaddr) kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ) … … 109 109 #endif 110 110 111 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,34)111 #if RTLNX_VER_MIN(2,6,34) 112 112 # define VBOX_NETDEV_NAME(dev) netdev_name(dev) 113 113 #else … … 115 115 #endif 116 116 117 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)117 #if RTLNX_VER_MIN(2,6,25) 118 118 # define VBOX_IPV4_IS_LOOPBACK(addr) ipv4_is_loopback(addr) 119 119 # define VBOX_IPV4_IS_LINKLOCAL_169(addr) ipv4_is_linklocal_169(addr) … … 123 123 #endif 124 124 125 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22)125 #if RTLNX_VER_MIN(2,6,22) 126 126 # define VBOX_SKB_RESET_NETWORK_HDR(skb) skb_reset_network_header(skb) 127 127 # define VBOX_SKB_RESET_MAC_HDR(skb) skb_reset_mac_header(skb) … … 133 133 #endif 134 134 135 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19)135 #if RTLNX_VER_MIN(2,6,19) 136 136 # define VBOX_SKB_CHECKSUM_HELP(skb) skb_checksum_help(skb) 137 137 #else 138 138 # define CHECKSUM_PARTIAL CHECKSUM_HW 139 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,10)139 # if RTLNX_VER_MIN(2,6,10) 140 140 # define VBOX_SKB_CHECKSUM_HELP(skb) skb_checksum_help(skb, 0) 141 141 # else 142 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,7)142 # if RTLNX_VER_MIN(2,6,7) 143 143 # define VBOX_SKB_CHECKSUM_HELP(skb) skb_checksum_help(&skb, 0) 144 144 # else … … 151 151 #endif 152 152 153 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20,0)153 #if RTLNX_VER_MIN(3,20,0) 154 154 # define VBOX_HAVE_SKB_VLAN 155 155 #else … … 177 177 #endif 178 178 179 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)179 #if RTLNX_VER_MIN(2,6,18) 180 180 181 181 /** Indicates that the linux kernel may send us GSO frames. */ … … 196 196 # define VBOXNETFLT_WITH_GSO_RECV 1 197 197 198 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18) */199 200 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)198 #endif /* RTLNX_VER_MIN(2,6,18) */ 199 200 #if RTLNX_VER_MIN(2,6,29) 201 201 /** This enables or disables handling of GSO frames coming from the wire (GRO). */ 202 202 # define VBOXNETFLT_WITH_GRO 1 … … 246 246 247 247 248 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,12) && defined(LOG_ENABLED)248 #if RTLNX_VER_MAX(2,6,12) && defined(LOG_ENABLED) 249 249 unsigned dev_get_flags(const struct net_device *dev) 250 250 { … … 262 262 return flags; 263 263 } 264 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,12) */264 #endif /* RTLNX_VER_MAX(2,6,12) */ 265 265 266 266 … … 344 344 #ifdef VBOXNETFLT_WITH_HOST2WIRE_FILTER 345 345 346 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29)346 # if RTLNX_VER_MAX(2,6,29) 347 347 348 348 # include <linux/ethtool.h> … … 352 352 # define OVR_XMIT pfnStartXmit 353 353 354 # else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29) */354 # else /* RTLNX_VER_MIN(2,6,29) */ 355 355 356 356 typedef struct net_device_ops OVR_OPSTYPE; … … 358 358 # define OVR_XMIT pOrgOps->ndo_start_xmit 359 359 360 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29) */360 # endif /* RTLNX_VER_MIN(2,6,29) */ 361 361 362 362 /** … … 379 379 /** Pointer to the original ops. */ 380 380 OVR_OPSTYPE const *pOrgOps; 381 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29)381 # if RTLNX_VER_MAX(2,6,29) 382 382 /** Pointer to the original hard_start_xmit function. */ 383 383 int (*pfnStartXmit)(struct sk_buff *pSkb, struct net_device *pDev); 384 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29) */384 # endif /* RTLNX_VER_MAX(2,6,29) */ 385 385 /** Pointer to the net filter instance. */ 386 386 PVBOXNETFLTINS pVBoxNetFlt; … … 419 419 if ( !VALID_PTR(pOverride) 420 420 || pOverride->u32Magic != VBOXNETDEVICEOPSOVERRIDE_MAGIC 421 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)421 # if RTLNX_VER_MIN(2,6,29) 422 422 || !VALID_PTR(pOverride->pOrgOps) 423 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29) */423 # endif /* RTLNX_VER_MIN(2,6,29) */ 424 424 ) 425 425 { … … 479 479 pOverride->pOrgOps = pDev->OVR_OPS; 480 480 pOverride->Ops = *pDev->OVR_OPS; 481 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29)481 # if RTLNX_VER_MAX(2,6,29) 482 482 pOverride->pfnStartXmit = pDev->hard_start_xmit; 483 # else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29) */483 # else /* RTLNX_VER_MIN(2,6,29) */ 484 484 pOverride->Ops.ndo_start_xmit = vboxNetFltLinuxStartXmitFilter; 485 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29) */485 # endif /* RTLNX_VER_MIN(2,6,29) */ 486 486 pOverride->u32Magic = VBOXNETDEVICEOPSOVERRIDE_MAGIC; 487 487 pOverride->cTotal = 0; … … 491 491 RTSpinlockAcquire(pThis->hSpinlock); /* (this isn't necessary, but so what) */ 492 492 ASMAtomicWritePtr((void * volatile *)&pDev->OVR_OPS, pOverride); 493 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29)493 # if RTLNX_VER_MAX(2,6,29) 494 494 ASMAtomicXchgPtr((void * volatile *)&pDev->hard_start_xmit, vboxNetFltLinuxStartXmitFilter); 495 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29) */495 # endif /* RTLNX_VER_MAX(2,6,29) */ 496 496 RTSpinlockRelease(pThis->hSpinlock); 497 497 } … … 519 519 ) 520 520 { 521 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29)521 # if RTLNX_VER_MAX(2,6,29) 522 522 ASMAtomicWritePtr((void * volatile *)&pDev->hard_start_xmit, pOverride->pfnStartXmit); 523 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,29) */523 # endif /* RTLNX_VER_MAX(2,6,29) */ 524 524 ASMAtomicWritePtr((void const * volatile *)&pDev->OVR_OPS, pOverride->pOrgOps); 525 525 ASMAtomicWriteU32(&pOverride->u32Magic, 0); … … 566 566 Log(("vboxNetFltLinuxRetainNetDev: Device %p(%s) retained. ref=%d\n", 567 567 pDev, pDev->name, 568 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,37)568 #if RTLNX_VER_MIN(2,6,37) 569 569 netdev_refcnt_read(pDev) 570 570 #else … … 602 602 Log(("vboxNetFltLinuxReleaseNetDev: Device %p(%s) released. ref=%d\n", 603 603 pDev, pDev->name, 604 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,37)604 #if RTLNX_VER_MIN(2,6,37) 605 605 netdev_refcnt_read(pDev) 606 606 #else … … 773 773 Assert(skb_headlen(pPkt) >= pSG->GsoCtx.cbHdrsTotal); 774 774 pPkt->ip_summed = CHECKSUM_PARTIAL; 775 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22)775 # if RTLNX_VER_MIN(2,6,22) 776 776 pPkt->csum_start = skb_headroom(pPkt) + pSG->GsoCtx.offHdr2; 777 777 if (fGsoType & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) … … 817 817 DECLINLINE(unsigned) vboxNetFltLinuxGetChecksumStartOffset(struct sk_buff *pBuf) 818 818 { 819 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 21) 819 #if RTLNX_VER_MIN(2,6,38) 820 return skb_checksum_start_offset(pBuf); 821 #elif RTLNX_VER_MIN(2,6,22) 822 return pBuf->csum_start - skb_headroom(pBuf); 823 #else 820 824 unsigned char *pTransportHdr = pBuf->h.raw; 821 # if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)825 # if RTLNX_VER_MAX(2,6,19) 822 826 /* 823 827 * Try to work around the problem with CentOS 4.7 and 5.2 (2.6.9 … … 828 832 if (pBuf->h.raw == pBuf->nh.raw && pBuf->protocol == htons(ETH_P_IP)) 829 833 pTransportHdr = pBuf->nh.raw + pBuf->nh.iph->ihl * 4; 830 # endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */834 # endif 831 835 return pTransportHdr - pBuf->data; 832 # else /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 21) */ 833 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38) 834 return pBuf->csum_start - skb_headroom(pBuf); 835 # else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) */ 836 return skb_checksum_start_offset(pBuf); 837 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) */ 838 # endif /* LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 21) */ 836 #endif 839 837 } 840 838 … … 867 865 unsigned cbProduced = 0; 868 866 869 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)867 # if RTLNX_VER_MIN(2,6,27) 870 868 /* Restore VLAN tag stripped by host hardware */ 871 869 if (vlan_tx_tag_present(pBuf)) … … 882 880 cbProduced += VLAN_ETH_HLEN; 883 881 } 884 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27) */882 # endif /* RTLNX_VER_MIN(2,6,27) */ 885 883 886 884 if (pBuf->ip_summed == CHECKSUM_PARTIAL && pBuf->pkt_type == PACKET_OUTGOING) … … 931 929 { 932 930 skb_frag_t *pFrag = &skb_shinfo(pBuf)->frags[i]; 933 # if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4,0) || defined(OPENSUSE_152)931 # if RTLNX_VER_MIN(5,4,0) || defined(OPENSUSE_152) 934 932 pSG->aSegs[iSeg].cb = pFrag->bv_len; 935 933 pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset; … … 952 950 { 953 951 skb_frag_t *pFrag = &skb_shinfo(pFragBuf)->frags[i]; 954 # if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4,0) || defined(OPENSUSE_152)952 # if RTLNX_VER_MIN(5,4,0) || defined(OPENSUSE_152) 955 953 pSG->aSegs[iSeg].cb = pFrag->bv_len; 956 954 pSG->aSegs[iSeg].pv = VBOX_SKB_KMAP_FRAG(pFrag) + pFrag->bv_offset; … … 1027 1025 * @returns 0 or EJUSTRETURN - this is probably copy & pastry and thus wrong. 1028 1026 */ 1029 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,14)1027 #if RTLNX_VER_MIN(2,6,14) 1030 1028 static int vboxNetFltLinuxPacketHandler(struct sk_buff *pBuf, 1031 1029 struct net_device *pSkbDev, … … 1042 1040 LogFlow(("vboxNetFltLinuxPacketHandler: pBuf=%p pSkbDev=%p pPacketType=%p\n", 1043 1041 pBuf, pSkbDev, pPacketType)); 1044 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)1042 #if RTLNX_VER_MIN(2,6,18) 1045 1043 Log3(("vboxNetFltLinuxPacketHandler: skb len=%u data_len=%u truesize=%u next=%p nr_frags=%u gso_size=%u gso_seqs=%u gso_type=%x frag_list=%p pkt_type=%x\n", 1046 1044 pBuf->len, pBuf->data_len, pBuf->truesize, pBuf->next, skb_shinfo(pBuf)->nr_frags, skb_shinfo(pBuf)->gso_size, skb_shinfo(pBuf)->gso_segs, skb_shinfo(pBuf)->gso_type, skb_shinfo(pBuf)->frag_list, pBuf->pkt_type)); 1047 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22)1045 # if RTLNX_VER_MIN(2,6,22) 1048 1046 Log6(("vboxNetFltLinuxPacketHandler: packet dump follows:\n%.*Rhxd\n", pBuf->len-pBuf->data_len, skb_mac_header(pBuf))); 1049 1047 # endif … … 1102 1100 /* Somehow skb_copy ignores mac_len */ 1103 1101 pBuf->mac_len = uMacLen; 1104 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)1102 # if RTLNX_VER_MIN(2,6,27) 1105 1103 /* Restore VLAN tag stripped by host hardware */ 1106 1104 if (vlan_tx_tag_present(pBuf) && skb_headroom(pBuf) >= VLAN_ETH_HLEN) … … 1114 1112 pBuf->mac_len += VLAN_HLEN; 1115 1113 } 1116 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27) */1117 1118 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,18)1114 # endif /* RTLNX_VER_MIN(2,6,27) */ 1115 1116 # if RTLNX_VER_MIN(2,6,18) 1119 1117 Log3(("vboxNetFltLinuxPacketHandler: skb copy len=%u data_len=%u truesize=%u next=%p nr_frags=%u gso_size=%u gso_seqs=%u gso_type=%x frag_list=%p pkt_type=%x\n", 1120 1118 pBuf->len, pBuf->data_len, pBuf->truesize, pBuf->next, skb_shinfo(pBuf)->nr_frags, skb_shinfo(pBuf)->gso_size, skb_shinfo(pBuf)->gso_segs, skb_shinfo(pBuf)->gso_type, skb_shinfo(pBuf)->frag_list, pBuf->pkt_type)); 1121 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22)1119 # if RTLNX_VER_MIN(2,6,22) 1122 1120 Log6(("vboxNetFltLinuxPacketHandler: packet dump follows:\n%.*Rhxd\n", pBuf->len-pBuf->data_len, skb_mac_header(pBuf))); 1123 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22) */1124 # else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,18) */1121 # endif /* RTLNX_VER_MIN(2,6,22) */ 1122 # else /* RTLNX_VER_MAX(2,6,18) */ 1125 1123 Log3(("vboxNetFltLinuxPacketHandler: skb copy len=%u data_len=%u truesize=%u next=%p nr_frags=%u tso_size=%u tso_seqs=%u frag_list=%p pkt_type=%x\n", 1126 1124 pBuf->len, pBuf->data_len, pBuf->truesize, pBuf->next, skb_shinfo(pBuf)->nr_frags, skb_shinfo(pBuf)->tso_size, skb_shinfo(pBuf)->tso_segs, skb_shinfo(pBuf)->frag_list, pBuf->pkt_type)); 1127 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,18) */1125 # endif /* RTLNX_VER_MAX(2,6,18) */ 1128 1126 } 1129 1127 #endif /* !VBOXNETFLT_SG_SUPPORT */ … … 1162 1160 *pcbTemp = vboxNetFltLinuxGetChecksumStartOffset(pBuf) + VBOX_SKB_CSUM_OFFSET(pBuf) + sizeof(uint16_t); 1163 1161 } 1164 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27)1162 # if RTLNX_VER_MIN(2,6,27) 1165 1163 if (vlan_tx_tag_present(pBuf)) 1166 1164 { … … 1170 1168 *pcbTemp = VLAN_ETH_HLEN; 1171 1169 } 1172 # endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,27) */1170 # endif /* RTLNX_VER_MIN(2,6,27) */ 1173 1171 if (*pcbTemp) 1174 1172 ++cSegs; … … 1554 1552 * skb_gso_segment does the following. Do we need to do it as well? 1555 1553 */ 1556 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,22)1554 # if RTLNX_VER_MIN(2,6,22) 1557 1555 skb_reset_mac_header(pBuf); 1558 1556 pBuf->mac_len = pBuf->network_header - pBuf->mac_header; … … 1604 1602 if (pBuf->ip_summed == CHECKSUM_PARTIAL && pBuf->pkt_type == PACKET_OUTGOING) 1605 1603 { 1606 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) 1604 # if RTLNX_VER_MIN(2,6,19) 1605 int rc = VBOX_SKB_CHECKSUM_HELP(pBuf); 1606 # else 1607 1607 /* 1608 1608 * Try to work around the problem with CentOS 4.7 and 5.2 (2.6.9 … … 1614 1614 if (pBuf->h.raw == pBuf->nh.raw && pBuf->protocol == htons(ETH_P_IP)) 1615 1615 pBuf->h.raw = pBuf->nh.raw + pBuf->nh.iph->ihl * 4; 1616 #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */1617 1616 int rc = VBOX_SKB_CHECKSUM_HELP(pBuf); 1618 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)1619 1617 /* Restore the original (wrong) pointer. */ 1620 1618 pBuf->h.raw = tmp; 1621 #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) */ 1622 if (rc) { 1619 # endif 1620 if (rc) 1621 { 1623 1622 LogRel(("VBoxNetFlt: Failed to compute checksum, dropping the packet.\n")); 1624 1623 return; … … 1674 1673 * @param pWork The work queue. 1675 1674 */ 1676 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)1675 # if RTLNX_VER_MIN(2,6,20) 1677 1676 static void vboxNetFltLinuxXmitTask(struct work_struct *pWork) 1678 1677 # else … … 1791 1790 return true; 1792 1791 1793 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,36) /* TAP started doing carrier */1792 #if RTLNX_VER_MIN(2,6,36) /* TAP started doing carrier */ 1794 1793 return !strncmp(Info.driver, "tun", 4) 1795 1794 && !strncmp(Info.bus_info, "tap", 4); … … 1800 1799 } 1801 1800 1802 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,18)1801 #if RTLNX_VER_MAX(2,6,18) 1803 1802 DECLINLINE(void) netif_tx_lock_bh(struct net_device *pDev) 1804 1803 { … … 1853 1852 Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n", 1854 1853 pDev, pDev->name, 1855 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,37)1854 #if RTLNX_VER_MIN(2,6,37) 1856 1855 netdev_refcnt_read(pDev) 1857 1856 #else … … 1950 1949 Log(("vboxNetFltLinuxUnregisterDevice: Device %p(%s) released. ref=%d\n", 1951 1950 pDev, pDev->name, 1952 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,37)1951 #if RTLNX_VER_MIN(2,6,37) 1953 1952 netdev_refcnt_read(pDev) 1954 1953 #else … … 2061 2060 if (ulEventType == NETDEV_REGISTER) 2062 2061 { 2063 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,24) /* cgroups/namespaces introduced */2064 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,26)2062 #if RTLNX_VER_MIN(2,6,24) /* cgroups/namespaces introduced */ 2063 # if RTLNX_VER_MIN(2,6,26) 2065 2064 # define VBOX_DEV_NET(dev) dev_net(dev) 2066 2065 # define VBOX_NET_EQ(n1, n2) net_eq((n1), (n2)) … … 2133 2132 * IPv4 2134 2133 */ 2135 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,14)2134 #if RTLNX_VER_MIN(2,6,14) 2136 2135 in_dev = __in_dev_get_rtnl(dev); 2137 2136 #else … … 2168 2167 2169 2168 read_lock_bh(&in6_dev->lock); 2170 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,35)2169 #if RTLNX_VER_MIN(2,6,35) 2171 2170 list_for_each_entry(ifa, &in6_dev->addr_list, if_list) 2172 2171 #else … … 2472 2471 Log(("vboxNetFltOsDeleteInstance: Device %p(%s) released. ref=%d\n", 2473 2472 pDev, pDev->name, 2474 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,37)2473 #if RTLNX_VER_MIN(2,6,37) 2475 2474 netdev_refcnt_read(pDev) 2476 2475 #else … … 2574 2573 #ifndef VBOXNETFLT_LINUX_NO_XMIT_QUEUE 2575 2574 skb_queue_head_init(&pThis->u.s.XmitQueue); 2576 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)2575 # if RTLNX_VER_MIN(2,6,20) 2577 2576 INIT_WORK(&pThis->u.s.XmitTask, vboxNetFltLinuxXmitTask); 2578 2577 # else -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/files_vboxnetflt
r82968 r85698 65 65 ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \ 66 66 ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ 67 ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \ 67 68 ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ 68 69 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ -
trunk/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h
r82968 r85698 38 38 #ifdef RT_OS_LINUX 39 39 40 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,35) && defined(CONFIG_IOMMU_API)40 #if RTLNX_VER_MIN(2,6,35) && defined(CONFIG_IOMMU_API) 41 41 # define VBOX_WITH_IOMMU 42 42 #endif -
trunk/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
r83471 r85698 48 48 # include <linux/intel-iommu.h> 49 49 # include <linux/pci.h> 50 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1,0) && \51 ( LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 41) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0,0))50 # if RTLNX_VER_MAX(3,1,0) && \ 51 (RTLNX_VER_MAX(2,6,41) || RTLNX_VER_MIN(3,0,0)) 52 52 # include <asm/amd_iommu.h> 53 53 # else 54 54 # include <linux/amd-iommu.h> 55 55 # endif 56 # if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2,0)56 # if RTLNX_VER_MAX(3,2,0) 57 57 # define IOMMU_PRESENT() iommu_found() 58 58 # define IOMMU_DOMAIN_ALLOC() iommu_domain_alloc() … … 87 87 88 88 89 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)89 #if RTLNX_VER_MIN(2,6,20) 90 90 # define PCI_DEV_GET(v,d,p) pci_get_device(v,d,p) 91 91 # define PCI_DEV_PUT(x) pci_dev_put(x) 92 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17,0)92 #if RTLNX_VER_MIN(4,17,0) 93 93 /* assume the domain number to be zero - exactly the same assumption of 94 94 * pci_get_bus_and_slot() … … 165 165 if (request_module(PCI_STUB_MODULE) == 0) 166 166 { 167 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,30)167 # if RTLNX_VER_MIN(2,6,30) 168 168 /* find_module() is static before Linux 2.6.30 */ 169 169 mutex_lock(&module_mutex); … … 320 320 if (RT_LIKELY(pIns->pPciDev)) 321 321 { 322 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,28)322 #if RTLNX_VER_MIN(2,6,28) 323 323 if (pci_reset_function(pIns->pPciDev)) 324 324 { … … 374 374 fs_save = get_fs(); 375 375 set_fs(KERNEL_DS); 376 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14,0)376 #if RTLNX_VER_MIN(4,14,0) 377 377 ret = kernel_write(file, data, size, &offset); 378 378 #else … … 448 448 int iCmdLen; 449 449 const int cMaxBuf = 128; 450 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)450 #if RTLNX_VER_MIN(2,6,29) 451 451 const struct cred *pOldCreds; 452 452 struct cred *pNewCreds; … … 469 469 470 470 /* Somewhat ugly hack - override current credentials */ 471 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)471 #if RTLNX_VER_MIN(2,6,29) 472 472 pNewCreds = prepare_creds(); 473 473 if (!pNewCreds) 474 474 goto done; 475 475 476 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)476 # if RTLNX_VER_MIN(3,5,0) 477 477 pNewCreds->fsuid = GLOBAL_ROOT_UID; 478 478 # else … … 533 533 printk(KERN_DEBUG "vboxpci: cannot open %s\n", szFileBuf); 534 534 535 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)535 #if RTLNX_VER_MIN(2,6,29) 536 536 revert_creds(pOldCreds); 537 537 put_cred(pNewCreds); … … 560 560 int iCmdLen; 561 561 const int cMaxBuf = 128; 562 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)562 #if RTLNX_VER_MIN(2,6,29) 563 563 const struct cred *pOldCreds; 564 564 struct cred *pNewCreds; … … 586 586 587 587 /* Somewhat ugly hack - override current credentials */ 588 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)588 #if RTLNX_VER_MIN(2,6,29) 589 589 pNewCreds = prepare_creds(); 590 590 if (!pNewCreds) 591 591 goto done; 592 592 593 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5,0)593 # if RTLNX_VER_MIN(3,5,0) 594 594 pNewCreds->fsuid = GLOBAL_ROOT_UID; 595 595 # else … … 627 627 printk(KERN_DEBUG "vboxpci: cannot open %s\n", szFileBuf); 628 628 629 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,29)629 #if RTLNX_VER_MIN(2,6,29) 630 630 revert_creds(pOldCreds); 631 631 put_cred(pNewCreds); … … 670 670 vbpci_printk(KERN_DEBUG, pPciDev, "%s\n", __func__); 671 671 672 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,1)672 #if RTLNX_VER_MIN(2,6,1) 673 673 if (pci_enable_msi(pPciDev) == 0) 674 674 pIns->fMsiUsed = true; … … 717 717 vboxPciLinuxDevUnregisterWithIommu(pIns); 718 718 719 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,1)719 #if RTLNX_VER_MIN(2,6,1) 720 720 if (pIns->fMsiUsed) 721 721 pci_disable_msi(pPciDev); … … 843 843 if (!rcLnx) 844 844 { 845 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)845 #if RTLNX_VER_MIN(2,6,25) 846 846 /* 847 847 * ioremap() defaults to no caching since the 2.6 kernels. … … 859 859 else 860 860 { 861 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,25)861 #if RTLNX_VER_MIN(2,6,25) 862 862 vbpci_printk(KERN_DEBUG, pPciDev, "ioremap() failed\n"); 863 863 #else … … 956 956 * @param pRegs Register set. Removed in 2.6.19. 957 957 */ 958 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,19) && !defined(DOXYGEN_RUNNING)958 #if RTLNX_VER_MIN(2,6,19) && !defined(DOXYGEN_RUNNING) 959 959 static irqreturn_t vboxPciOsIrqHandler(int iIrq, void *pvDevId) 960 960 #else … … 992 992 #ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS 993 993 /* Allow interrupts sharing. */ 994 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6,20)994 # if RTLNX_VER_MIN(2,6,20) 995 995 IRQF_SHARED, 996 996 # else … … 1002 1002 /* We don't allow interrupts sharing */ 1003 1003 /* XXX overhaul */ 1004 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 1,0)1004 # if RTLNX_VER_MIN(2,6,20) && RTLNX_VER_MAX(4,1,0) 1005 1005 IRQF_DISABLED, /* keep irqs disabled when calling the action handler */ 1006 1006 # else -
trunk/src/VBox/HostDrivers/VBoxPci/linux/files_vboxpci
r82968 r85698 64 64 ${PATH_ROOT}/include/iprt/utf16.h=>include/iprt/utf16.h \ 65 65 ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \ 66 ${PATH_ROOT}/include/iprt/linux/version.h=>include/iprt/linux/version.h \ 66 67 ${PATH_ROOT}/include/iprt/nocrt/limits.h=>include/iprt/nocrt/limits.h \ 67 68 ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \
Note:
See TracChangeset
for help on using the changeset viewer.