Changeset 73097 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Jul 12, 2018 9:06:33 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123672
- Location:
- trunk/src/VBox/HostDrivers
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
r69500 r73097 1759 1759 unsigned cCpus, size_t cbGipCpuGroups) 1760 1760 { 1761 size_t const cbGip = RT_ALIGN_Z(RT_ OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]) + cbGipCpuGroups, PAGE_SIZE);1761 size_t const cbGip = RT_ALIGN_Z(RT_UOFFSETOF_DYN(SUPGLOBALINFOPAGE, aCPUs[cCpus]) + cbGipCpuGroups, PAGE_SIZE); 1762 1762 unsigned i; 1763 1763 #ifdef DEBUG_DARWIN_GIP … … 1875 1875 cbGipCpuGroups = 0; 1876 1876 #endif 1877 cbGip = RT_UOFFSETOF (SUPGLOBALINFOPAGE, aCPUs[cCpus]) + cbGipCpuGroups;1877 cbGip = RT_UOFFSETOF_DYN(SUPGLOBALINFOPAGE, aCPUs[cCpus]) + cbGipCpuGroups; 1878 1878 rc = RTR0MemObjAllocCont(&pDevExt->GipMemObj, cbGip, false /*fExecutable*/); 1879 1879 if (RT_FAILURE(rc)) -
trunk/src/VBox/HostDrivers/Support/SUPDrvIOC.h
r72778 r73097 269 269 */ 270 270 #define SUP_IOCTL_QUERY_FUNCS(cFuncs) SUP_CTL_CODE_BIG(2) 271 #define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF (SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)])271 #define SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) RT_UOFFSETOF_DYN(SUPQUERYFUNCS, u.Out.aFunctions[(cFuncs)]) 272 272 #define SUP_IOCTL_QUERY_FUNCS_SIZE_IN sizeof(SUPREQHDR) 273 273 #define SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(cFuncs) SUP_IOCTL_QUERY_FUNCS_SIZE(cFuncs) … … 347 347 */ 348 348 #define SUP_IOCTL_LDR_LOAD SUP_CTL_CODE_BIG(4) 349 #define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_MAX(RT_UOFFSETOF (SUPLDRLOAD, u.In.abImage[cbImage]), SUP_IOCTL_LDR_LOAD_SIZE_OUT)350 #define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF (SUPLDRLOAD, u.In.abImage[cbImage])349 #define SUP_IOCTL_LDR_LOAD_SIZE(cbImage) RT_MAX(RT_UOFFSETOF_DYN(SUPLDRLOAD, u.In.abImage[cbImage]), SUP_IOCTL_LDR_LOAD_SIZE_OUT) 350 #define SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImage) RT_UOFFSETOF_DYN(SUPLDRLOAD, u.In.abImage[cbImage]) 351 351 #define SUP_IOCTL_LDR_LOAD_SIZE_OUT (RT_UOFFSETOF(SUPLDRLOAD, u.Out.szError) + RT_SIZEOFMEMB(SUPLDRLOAD, u.Out.szError)) 352 352 … … 547 547 #define SUP_IOCTL_CALL_VMMR0(cbReq) SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)) 548 548 #define SUP_IOCTL_CALL_VMMR0_NO_SIZE() SUP_CTL_CODE_SIZE(7, 0) 549 #define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF (SUPCALLVMMR0, abReqPkt[cbReq])549 #define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq]) 550 550 #define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) 551 551 #define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) … … 579 579 */ 580 580 #define SUP_IOCTL_CALL_VMMR0_BIG SUP_CTL_CODE_BIG(27) 581 #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF (SUPCALLVMMR0, abReqPkt[cbReq])581 #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLVMMR0, abReqPkt[cbReq]) 582 582 #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) 583 583 #define SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(cbReq) SUP_IOCTL_CALL_VMMR0_SIZE(cbReq) … … 590 590 */ 591 591 #define SUP_IOCTL_LOW_ALLOC SUP_CTL_CODE_BIG(8) 592 #define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF (SUPLOWALLOC, u.Out.aPages[cPages]))592 #define SUP_IOCTL_LOW_ALLOC_SIZE(cPages) ((uint32_t)RT_UOFFSETOF_DYN(SUPLOWALLOC, u.Out.aPages[cPages])) 593 593 #define SUP_IOCTL_LOW_ALLOC_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPLOWALLOC, u.In)) 594 594 #define SUP_IOCTL_LOW_ALLOC_SIZE_OUT(cPages) SUP_IOCTL_LOW_ALLOC_SIZE(cPages) … … 652 652 */ 653 653 #define SUP_IOCTL_PAGE_ALLOC_EX SUP_CTL_CODE_BIG(10) 654 #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF (SUPPAGEALLOCEX, u.Out.aPages[cPages])654 #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) RT_UOFFSETOF_DYN(SUPPAGEALLOCEX, u.Out.aPages[cPages]) 655 655 #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGEALLOCEX, u.In)) 656 656 #define SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(cPages) SUP_IOCTL_PAGE_ALLOC_EX_SIZE(cPages) … … 801 801 #define SUP_IOCTL_PAGE_LOCK_SIZE(cPages) (RT_MAX((size_t)SUP_IOCTL_PAGE_LOCK_SIZE_IN, (size_t)SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages))) 802 802 #define SUP_IOCTL_PAGE_LOCK_SIZE_IN (sizeof(SUPREQHDR) + RT_SIZEOFMEMB(SUPPAGELOCK, u.In)) 803 #define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF (SUPPAGELOCK, u.Out.aPages[cPages])803 #define SUP_IOCTL_PAGE_LOCK_SIZE_OUT(cPages) RT_UOFFSETOF_DYN(SUPPAGELOCK, u.Out.aPages[cPages]) 804 804 typedef struct SUPPAGELOCK 805 805 { … … 1008 1008 #define SUP_IOCTL_CALL_SERVICE(cbReq) SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)) 1009 1009 #define SUP_IOCTL_CALL_SERVICE_NO_SIZE() SUP_CTL_CODE_SIZE(22, 0) 1010 #define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF (SUPCALLSERVICE, abReqPkt[cbReq])1010 #define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) RT_UOFFSETOF_DYN(SUPCALLSERVICE, abReqPkt[cbReq]) 1011 1011 #define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) 1012 1012 #define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq) SUP_IOCTL_CALL_SERVICE_SIZE(cbReq) … … 1039 1039 #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab) SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab)) 1040 1040 #define SUP_IOCTL_LOGGER_SETTINGS_NO_SIZE() SUP_CTL_CODE_SIZE(23, 0) 1041 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF (SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])1042 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF (SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])1041 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab]) 1042 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab) RT_UOFFSETOF_DYN(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab]) 1043 1043 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT sizeof(SUPREQHDR) 1044 1044 typedef struct SUPLOGGERSETTINGS -
trunk/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
r69500 r73097 954 954 size_t const cchName = strlen(pszName) + (pUmod ? 16 : 0); 955 955 956 pProv = (PSUPDRVTPPROVIDER)RTMemAllocZ(RT_ OFFSETOF(SUPDRVTPPROVIDER, szName[cchName + 1 + cchModName + 1]));956 pProv = (PSUPDRVTPPROVIDER)RTMemAllocZ(RT_UOFFSETOF_DYN(SUPDRVTPPROVIDER, szName[cchName + 1 + cchModName + 1])); 957 957 if (pProv) 958 958 { … … 1727 1727 uint32_t const offProbeLocs = RT_ALIGN(pVtgHdr->cbObj, 8); 1728 1728 size_t const cb = offProbeLocs + cbProbeLocs + cbStrTab + 1; 1729 PSUPDRVVTGCOPY pThis = (PSUPDRVVTGCOPY)RTMemAlloc(RT_ OFFSETOF(SUPDRVVTGCOPY, Hdr) + cb);1729 PSUPDRVVTGCOPY pThis = (PSUPDRVVTGCOPY)RTMemAlloc(RT_UOFFSETOF(SUPDRVVTGCOPY, Hdr) + cb); 1730 1730 if (!pThis) 1731 1731 return VERR_NO_MEMORY; … … 2019 2019 * Allocate the tracker data we keep in the session. 2020 2020 */ 2021 pUmod = (PSUPDRVTRACERUMOD)RTMemAllocZ( RT_ OFFSETOF(SUPDRVTRACERUMOD, aProbeLocs[cProbeLocs])2021 pUmod = (PSUPDRVTRACERUMOD)RTMemAllocZ( RT_UOFFSETOF_DYN(SUPDRVTRACERUMOD, aProbeLocs[cProbeLocs]) 2022 2022 + (Hdr.cbProbeEnabled / sizeof(uint32_t) * sizeof(SUPDRVPROBEINFO)) ); 2023 2023 if (!pUmod) -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r72778 r73097 214 214 * (Got some trouble with compile time member alignment assertions.) 215 215 */ 216 Assert(!(RT_ OFFSETOF(SUPGLOBALINFOPAGE, u64NanoTSLastUpdateHz) & 0x7));217 Assert(!(RT_ OFFSETOF(SUPGLOBALINFOPAGE, aCPUs) & 0x1f));218 Assert(!(RT_ OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[1]) & 0x1f));219 Assert(!(RT_ OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[0].u64NanoTS) & 0x7));220 Assert(!(RT_ OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[0].u64TSC) & 0x7));221 Assert(!(RT_ OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[0].u64CpuHz) & 0x7));216 Assert(!(RT_UOFFSETOF(SUPGLOBALINFOPAGE, u64NanoTSLastUpdateHz) & 0x7)); 217 Assert(!(RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs) & 0x1f)); 218 Assert(!(RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[1]) & 0x1f)); 219 Assert(!(RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[0].u64NanoTS) & 0x7)); 220 Assert(!(RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[0].u64TSC) & 0x7)); 221 Assert(!(RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[0].u64CpuHz) & 0x7)); 222 222 223 223 /* … … 1893 1893 * Allocate the string table structures. 1894 1894 */ 1895 size_t cbThis = RT_ OFFSETOF(SUPDRVTRACERSTRTAB, apszOrgFunctions[cProbeLocs]);1895 size_t cbThis = RT_UOFFSETOF_DYN(SUPDRVTRACERSTRTAB, apszOrgFunctions[cProbeLocs]); 1896 1896 PSUPDRVTRACERSTRTAB pThis = (PSUPDRVTRACERSTRTAB)RTMemAlloc(cbThis); 1897 1897 if (!pThis) -
trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
r71198 r73097 1724 1724 uint32_t cGroups = RTMpGetMaxCpuGroupCount(); 1725 1725 1726 return cGroups * RT_ OFFSETOF(SUPGIPCPUGROUP, aiCpuSetIdxs)1726 return cGroups * RT_UOFFSETOF(SUPGIPCPUGROUP, aiCpuSetIdxs) 1727 1727 + RT_SIZEOFMEMB(SUPGIPCPUGROUP, aiCpuSetIdxs[0]) * cMaxCpus; 1728 1728 } … … 1742 1742 uint32_t cActive = 0; 1743 1743 uint32_t cMax = RTMpGetCpuGroupCounts(idxGroup, &cActive); 1744 uint32_t cbNeeded = RT_ OFFSETOF(SUPGIPCPUGROUP, aiCpuSetIdxs[cMax]);1744 uint32_t cbNeeded = RT_UOFFSETOF_DYN(SUPGIPCPUGROUP, aiCpuSetIdxs[cMax]); 1745 1745 AssertReturn(cbNeeded <= cbGipCpuGroups, VERR_INTERNAL_ERROR_3); 1746 1746 AssertReturn(cActive <= cMax, VERR_INTERNAL_ERROR_4); … … 2189 2189 IMAGE_NT_HEADERS const *pNtHdrsNtLd = (IMAGE_NT_HEADERS const *)((uintptr_t)pImage->pvImage + offNtHdrs); 2190 2190 2191 uint32_t const offImageBase = offNtHdrs + RT_ OFFSETOF(IMAGE_NT_HEADERS, OptionalHeader.ImageBase);2191 uint32_t const offImageBase = offNtHdrs + RT_UOFFSETOF(IMAGE_NT_HEADERS, OptionalHeader.ImageBase); 2192 2192 uint32_t const cbImageBase = RT_SIZEOFMEMB(IMAGE_NT_HEADERS, OptionalHeader.ImageBase); 2193 2193 if ( pNtHdrsNtLd->OptionalHeader.ImageBase != pNtHdrsIprt->OptionalHeader.ImageBase … … 4556 4556 SYSTEM_HANDLE_INFORMATION_EX const *pInfo = (SYSTEM_HANDLE_INFORMATION_EX const *)pbBuf; 4557 4557 ULONG_PTR i = pInfo->NumberOfHandles; 4558 AssertRelease(RT_ OFFSETOF(SYSTEM_HANDLE_INFORMATION_EX, Handles[i]) == cbNeeded);4558 AssertRelease(RT_UOFFSETOF_DYN(SYSTEM_HANDLE_INFORMATION_EX, Handles[i]) == cbNeeded); 4559 4559 while (i-- > 0) 4560 4560 { -
trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
r69500 r73097 861 861 uint32_t cbName = (uint32_t)strlen(uBuf.szName) + 1; 862 862 uint32_t cbNameAligned = RT_ALIGN_32(cbName, sizeof(RTUTF16)); 863 uint32_t cbNeeded = RT_ OFFSETOF(VERIFIERCACHEIMPORT, szName[cbNameAligned])863 uint32_t cbNeeded = RT_UOFFSETOF_DYN(VERIFIERCACHEIMPORT, szName[cbNameAligned]) 864 864 + (pawcDir ? (cwcDir + 1) * sizeof(RTUTF16) : 0); 865 865 PVERIFIERCACHEIMPORT pImport = (PVERIFIERCACHEIMPORT)RTMemAllocZ(cbNeeded); -
trunk/src/VBox/HostDrivers/VBoxNetAdp/win/VBoxNetAdp-win.cpp
r69500 r73097 183 183 184 184 #define IFPORT_2_VBOXNETADP_ADAPTER(pIfPort) \ 185 ( (PVBOXNETADP_ADAPTER)((uint8_t *) pIfPort - RT_OFFSETOF(VBOXNETADP_ADAPTER, MyPort)) )185 ( (PVBOXNETADP_ADAPTER)((uint8_t *)(pIfPort) - RT_UOFFSETOF(VBOXNETADP_ADAPTER, MyPort)) ) 186 186 187 187 DECLINLINE(VBOXNETADPWIN_ADAPTER_STATE) vboxNetAdpWinGetState(PVBOXNETADP_ADAPTER pThis) … … 490 490 /* Allocate and initialize SG */ 491 491 PINTNETSG pSG = (PINTNETSG)NdisAllocateMemoryWithTagPriority(pThis->hAdapter, 492 RT_ OFFSETOF(INTNETSG, aSegs[cSegs]),492 RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs]), 493 493 VBOXNETADP_MEM_TAG, 494 494 NormalPoolPriority); … … 792 792 */ 793 793 static DECLCALLBACK(void *) vboxNetAdpWinQueryFactoryInterface(PCSUPDRVFACTORY pSupDrvFactory, PSUPDRVSESSION pSession, 794 const char *pszInterfaceUuid)795 { 796 PVBOXNETADPGLOBALS pGlobals = (PVBOXNETADPGLOBALS)((uint8_t *)pSupDrvFactory - RT_ OFFSETOF(VBOXNETADPGLOBALS, SupDrvFactory));794 const char *pszInterfaceUuid) 795 { 796 PVBOXNETADPGLOBALS pGlobals = (PVBOXNETADPGLOBALS)((uint8_t *)pSupDrvFactory - RT_UOFFSETOF(VBOXNETADPGLOBALS, SupDrvFactory)); 797 797 798 798 /* … … 846 846 PINTNETTRUNKIFPORT *ppIfPort) 847 847 { 848 PVBOXNETADPGLOBALS pGlobals = (PVBOXNETADPGLOBALS)((uint8_t *)pIfFactory - RT_ OFFSETOF(VBOXNETADPGLOBALS, TrunkFactory));848 PVBOXNETADPGLOBALS pGlobals = (PVBOXNETADPGLOBALS)((uint8_t *)pIfFactory - RT_UOFFSETOF(VBOXNETADPGLOBALS, TrunkFactory)); 849 849 850 850 LogFlow(("==>vboxNetAdpWinFactoryCreateAndConnect: pszName=%p:{%s} fFlags=%#x\n", pszName, pszName, fFlags)); -
trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c
r69500 r73097 278 278 *********************************************************************************************************************************/ 279 279 #define IFPORT_2_VBOXNETFLTINS(pIfPort) \ 280 ( (PVBOXNETFLTINS)((uint8_t *) pIfPort - RT_OFFSETOF(VBOXNETFLTINS, MyPort)) )280 ( (PVBOXNETFLTINS)((uint8_t *)(pIfPort) - RT_UOFFSETOF(VBOXNETFLTINS, MyPort)) ) 281 281 282 282 … … 999 999 int rc; 1000 1000 size_t const cchName = strlen(pszName); 1001 PVBOXNETFLTINS pNew = (PVBOXNETFLTINS)RTMemAllocZ(RT_ OFFSETOF(VBOXNETFLTINS, szName[cchName + 1]));1001 PVBOXNETFLTINS pNew = (PVBOXNETFLTINS)RTMemAllocZ(RT_UOFFSETOF_DYN(VBOXNETFLTINS, szName[cchName + 1])); 1002 1002 if (!pNew) 1003 1003 return VERR_INTNET_FLT_IF_FAILED; … … 1239 1239 PINTNETTRUNKIFPORT *ppIfPort) 1240 1240 { 1241 PVBOXNETFLTGLOBALS pGlobals = (PVBOXNETFLTGLOBALS)((uint8_t *)pIfFactory - RT_ OFFSETOF(VBOXNETFLTGLOBALS, TrunkFactory));1241 PVBOXNETFLTGLOBALS pGlobals = (PVBOXNETFLTGLOBALS)((uint8_t *)pIfFactory - RT_UOFFSETOF(VBOXNETFLTGLOBALS, TrunkFactory)); 1242 1242 PVBOXNETFLTINS pCur; 1243 1243 int rc; … … 1326 1326 static DECLCALLBACK(void) vboxNetFltFactoryRelease(PINTNETTRUNKFACTORY pIfFactory) 1327 1327 { 1328 PVBOXNETFLTGLOBALS pGlobals = (PVBOXNETFLTGLOBALS)((uint8_t *)pIfFactory - RT_ OFFSETOF(VBOXNETFLTGLOBALS, TrunkFactory));1328 PVBOXNETFLTGLOBALS pGlobals = (PVBOXNETFLTGLOBALS)((uint8_t *)pIfFactory - RT_UOFFSETOF(VBOXNETFLTGLOBALS, TrunkFactory)); 1329 1329 1330 1330 int32_t cRefs = ASMAtomicDecS32(&pGlobals->cFactoryRefs); … … 1346 1346 const char *pszInterfaceUuid) 1347 1347 { 1348 PVBOXNETFLTGLOBALS pGlobals = (PVBOXNETFLTGLOBALS)((uint8_t *)pSupDrvFactory - RT_ OFFSETOF(VBOXNETFLTGLOBALS, SupDrvFactory));1348 PVBOXNETFLTGLOBALS pGlobals = (PVBOXNETFLTGLOBALS)((uint8_t *)pSupDrvFactory - RT_UOFFSETOF(VBOXNETFLTGLOBALS, SupDrvFactory)); 1349 1349 1350 1350 /* -
trunk/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
r69500 r73097 932 932 if (cSegs < VBOXNETFLT_DARWIN_MAX_SEGS) 933 933 { 934 PINTNETSG pSG = (PINTNETSG)alloca(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]));934 PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs])); 935 935 vboxNetFltDarwinMBufToSG(pThis, pMBuf, pvFrame, pSG, cSegs, fSrc); 936 936 -
trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
r57358 r73097 451 451 452 452 /* Create a copy and deliver to the virtual switch */ 453 pSG = RTMemTmpAlloc(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]));453 pSG = RTMemTmpAlloc(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs])); 454 454 vboxNetFltFreeBSDMBufToSG(pThis, m, pSG, cSegs, 0); 455 455 fDropIt = pThis->pSwitchPort->pfnRecv(pThis->pSwitchPort, NULL /* pvIf */, pSG, INTNETTRUNKDIR_WIRE); … … 495 495 #endif 496 496 /* Create a copy and deliver to the virtual switch */ 497 pSG = RTMemTmpAlloc(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]));497 pSG = RTMemTmpAlloc(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs])); 498 498 vboxNetFltFreeBSDMBufToSG(pThis, m, pSG, cSegs, 0); 499 499 fDropIt = pThis->pSwitchPort->pfnRecv(pThis->pSwitchPort, NULL /* pvIf */, pSG, INTNETTRUNKDIR_HOST); -
trunk/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
r70708 r73097 653 653 else if (pSG->cbTotal >= sizeof(RTNETETHERHDR)) 654 654 { 655 uint32_t off = RT_ OFFSETOF(RTNETETHERHDR, EtherType);655 uint32_t off = RT_UOFFSETOF(RTNETETHERHDR, EtherType); 656 656 uint32_t i; 657 657 for (i = 0; i < pSG->cSegsUsed; ++i) … … 768 768 pPkt->csum_start = skb_headroom(pPkt) + pSG->GsoCtx.offHdr2; 769 769 if (fGsoType & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) 770 pPkt->csum_offset = RT_ OFFSETOF(RTNETTCP, th_sum);770 pPkt->csum_offset = RT_UOFFSETOF(RTNETTCP, th_sum); 771 771 else 772 pPkt->csum_offset = RT_ OFFSETOF(RTNETUDP, uh_sum);772 pPkt->csum_offset = RT_UOFFSETOF(RTNETUDP, uh_sum); 773 773 # else 774 774 pPkt->h.raw = pPkt->data + pSG->GsoCtx.offHdr2; 775 775 if (fGsoType & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) 776 pPkt->csum = RT_ OFFSETOF(RTNETTCP, th_sum);776 pPkt->csum = RT_UOFFSETOF(RTNETTCP, th_sum); 777 777 else 778 pPkt->csum = RT_ OFFSETOF(RTNETUDP, uh_sum);778 pPkt->csum = RT_UOFFSETOF(RTNETUDP, uh_sum); 779 779 # endif 780 780 if (!fDstWire) … … 1457 1457 unsigned cbExtra; 1458 1458 unsigned cSegs = vboxNetFltLinuxCalcSGSegments(pSkb, &cbExtra); 1459 PINTNETSG pSG = (PINTNETSG)alloca(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]) + cbExtra);1459 PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs]) + cbExtra); 1460 1460 if (RT_LIKELY(pSG)) 1461 1461 { … … 1491 1491 unsigned cbExtra; 1492 1492 unsigned cSegs = vboxNetFltLinuxCalcSGSegments(pBuf, &cbExtra); 1493 PINTNETSG pSG = (PINTNETSG)alloca(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]) + cbExtra);1493 PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs]) + cbExtra); 1494 1494 if (RT_LIKELY(pSG)) 1495 1495 { -
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
r69500 r73097 3522 3522 */ 3523 3523 unsigned cSegs = vboxNetFltSolarisMBlkCalcSGSegs(pThis, pMsg); 3524 PINTNETSG pSG = (PINTNETSG)alloca(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]));3524 PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs])); 3525 3525 int rc = vboxNetFltSolarisMBlkToSG(pThis, pMsg, pSG, cSegs, fSrc); 3526 3526 if (RT_SUCCESS(rc)) -
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
r69500 r73097 688 688 { 689 689 unsigned cSegs = vboxNetFltSolarisMBlkCalcSGSegs(pThis, pCurMsg); 690 PINTNETSG pSG = (PINTNETSG)alloca(RT_ OFFSETOF(INTNETSG, aSegs[cSegs]));690 PINTNETSG pSG = (PINTNETSG)alloca(RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs])); 691 691 int rc = vboxNetFltSolarisMBlkToSG(pThis, pMsg, pSG, cSegs, fSrc); 692 692 if (RT_SUCCESS(rc)) -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp
r69500 r73097 138 138 *********************************************************************************************************************************/ 139 139 #define LIST_ENTRY_2_JOB(pListEntry) \ 140 ( (PVBOXNETFLT_JOB)((uint8_t *)(pListEntry) - RT_ OFFSETOF(VBOXNETFLT_JOB, ListEntry)) )140 ( (PVBOXNETFLT_JOB)((uint8_t *)(pListEntry) - RT_UOFFSETOF(VBOXNETFLT_JOB, ListEntry)) ) 141 141 142 142 … … 388 388 { 389 389 PINTNETSG pSG; 390 NTSTATUS Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, RT_ OFFSETOF(INTNETSG, aSegs[cSegs]));390 NTSTATUS Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs])); 391 391 if (Status == STATUS_SUCCESS) 392 392 { -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h
r69500 r73097 41 41 42 42 #define LIST_ENTRY_2_PACKET_INFO(pListEntry) \ 43 ( (PVBOXNETFLT_PACKET_INFO)((uint8_t *)(pListEntry) - RT_ OFFSETOF(VBOXNETFLT_PACKET_INFO, ListEntry)) )43 ( (PVBOXNETFLT_PACKET_INFO)((uint8_t *)(pListEntry) - RT_UOFFSETOF(VBOXNETFLT_PACKET_INFO, ListEntry)) ) 44 44 45 45 #if !defined(VBOX_LOOPBACK_USEFLAGS) || defined(DEBUG_NETFLT_PACKETS) 46 46 47 47 #define VBOX_SLE_2_PKTRSVD_PT(_pEntry) \ 48 ( (PVBOXNETFLT_PKTRSVD_PT)((uint8_t *)(_pEntry) - RT_ OFFSETOF(VBOXNETFLT_PKTRSVD_PT, ListEntry)) )48 ( (PVBOXNETFLT_PKTRSVD_PT)((uint8_t *)(_pEntry) - RT_UOFFSETOF(VBOXNETFLT_PKTRSVD_PT, ListEntry)) ) 49 49 50 50 #define VBOX_SLE_2_SENDPACKET(_pEntry) \ 51 ( (PNDIS_PACKET)((uint8_t *)(VBOX_SLE_2_PKTRSVD_PT(_pEntry)) - RT_ OFFSETOF(NDIS_PACKET, ProtocolReserved)) )51 ( (PNDIS_PACKET)((uint8_t *)(VBOX_SLE_2_PKTRSVD_PT(_pEntry)) - RT_UOFFSETOF(NDIS_PACKET, ProtocolReserved)) ) 52 52 53 53 #endif -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetLwf-win.cpp
r72275 r73097 1597 1597 /* Allocate and initialize SG */ 1598 1598 PINTNETSG pSG = (PINTNETSG)NdisAllocateMemoryWithTagPriority(pModule->hFilter, 1599 RT_ OFFSETOF(INTNETSG, aSegs[cSegs]),1599 RT_UOFFSETOF_DYN(INTNETSG, aSegs[cSegs]), 1600 1600 VBOXNETLWF_MEM_TAG, 1601 1601 NormalPoolPriority);
Note:
See TracChangeset
for help on using the changeset viewer.