Changeset 73097 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Jul 12, 2018 9:06:33 PM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r71775 r73097 844 844 845 845 #define PCIDEV_2_PAHCI(pPciDev) ( (PAHCI)(pPciDev) ) 846 #define PDMIBASE_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_ OFFSETOF(AHCIPort, IBase)) )847 #define PDMIMEDIAPORT_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_ OFFSETOF(AHCIPort, IPort)) )848 #define PDMIBASE_2_PAHCI(pInterface) ( (PAHCI)((uintptr_t)(pInterface) - RT_ OFFSETOF(AHCI, IBase)) )849 #define PDMILEDPORTS_2_PAHCI(pInterface) ( (PAHCI)((uintptr_t)(pInterface) - RT_ OFFSETOF(AHCI, ILeds)) )846 #define PDMIBASE_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_UOFFSETOF(AHCIPort, IBase)) ) 847 #define PDMIMEDIAPORT_2_PAHCIPORT(pInterface) ( (PAHCIPort)((uintptr_t)(pInterface) - RT_UOFFSETOF(AHCIPort, IPort)) ) 848 #define PDMIBASE_2_PAHCI(pInterface) ( (PAHCI)((uintptr_t)(pInterface) - RT_UOFFSETOF(AHCI, IBase)) ) 849 #define PDMILEDPORTS_2_PAHCI(pInterface) ( (PAHCI)((uintptr_t)(pInterface) - RT_UOFFSETOF(AHCI, ILeds)) ) 850 850 851 851 #define AHCI_RTGCPHYS_FROM_U32(Hi, Lo) ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) ) … … 3808 3808 u32PRDBC = (uint32_t)pAhciReq->cbTransfer; 3809 3809 3810 PDMDevHlpPCIPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciReq->GCPhysCmdHdrAddr + RT_ OFFSETOF(CmdHdr, u32PRDBC),3810 PDMDevHlpPCIPhysWrite(pAhciPort->CTX_SUFF(pDevIns), pAhciReq->GCPhysCmdHdrAddr + RT_UOFFSETOF(CmdHdr, u32PRDBC), 3811 3811 &u32PRDBC, sizeof(u32PRDBC)); 3812 3812 -
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r71775 r73097 1240 1240 /* Rewrite CCB up to the CDB; perhaps more than necessary. */ 1241 1241 PDMDevHlpPCIPhysWrite(pBusLogic->CTX_SUFF(pDevIns), GCPhysAddrCCB, 1242 pCCBGuest, RT_ OFFSETOF(CCBC, abCDB));1242 pCCBGuest, RT_UOFFSETOF(CCBC, abCDB)); 1243 1243 } 1244 1244 -
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r73091 r73097 923 923 if (pThis->cbMemRegns + 512 * sizeof(uint32_t) < LSILOGIC_MEMORY_REGIONS_MAX) 924 924 { 925 PLSILOGICMEMREGN pRegionNew = (PLSILOGICMEMREGN)RTMemRealloc(pRegion, RT_OFFSETOF(LSILOGICMEMREGN, au32Data[cRegionSizeNew]));926 925 PLSILOGICMEMREGN pRegionNew; 926 pRegionNew = (PLSILOGICMEMREGN)RTMemRealloc(pRegion, RT_UOFFSETOF_DYN(LSILOGICMEMREGN, au32Data[cRegionSizeNew])); 927 927 if (pRegionNew) 928 928 { … … 4868 4868 4869 4869 uint32_t cRegion = u32AddrEnd - u32AddrStart + 1; 4870 PLSILOGICMEMREGN pRegion = (PLSILOGICMEMREGN)RTMemAllocZ(RT_ OFFSETOF(LSILOGICMEMREGN, au32Data[cRegion]));4870 PLSILOGICMEMREGN pRegion = (PLSILOGICMEMREGN)RTMemAllocZ(RT_UOFFSETOF_DYN(LSILOGICMEMREGN, au32Data[cRegion])); 4871 4871 if (pRegion) 4872 4872 { -
trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
r73094 r73097 363 363 364 364 /* Create new segment */ 365 pSeg = (PDRVDISKSEGMENT)RTMemAllocZ(RT_ OFFSETOF(DRVDISKSEGMENT, apIoLog[cbRange / 512]));365 pSeg = (PDRVDISKSEGMENT)RTMemAllocZ(RT_UOFFSETOF_DYN(DRVDISKSEGMENT, apIoLog[cbRange / 512])); 366 366 if (pSeg) 367 367 { … … 601 601 for (unsigned idx = (uint32_t)(cbPreLeft / 512); idx < pSeg->cIoLogEntries; idx++) 602 602 drvdiskintIoLogEntryRelease(pSeg->apIoLog[idx]); 603 pSeg = (PDRVDISKSEGMENT)RTMemRealloc(pSeg, RT_ OFFSETOF(DRVDISKSEGMENT, apIoLog[cbPreLeft / 512]));603 pSeg = (PDRVDISKSEGMENT)RTMemRealloc(pSeg, RT_UOFFSETOF_DYN(DRVDISKSEGMENT, apIoLog[cbPreLeft / 512])); 604 604 pSeg->Core.KeyLast = pSeg->Core.Key + cbPreLeft - 1; 605 605 pSeg->cbSeg = cbPreLeft; … … 617 617 for (unsigned idx = 0; idx < cbPostLeft /512; idx++) 618 618 pSeg->apIoLog[idx] = pSeg->apIoLog[(cbRange / 512) + idx]; 619 pSeg = (PDRVDISKSEGMENT)RTMemRealloc(pSeg, RT_ OFFSETOF(DRVDISKSEGMENT, apIoLog[cbPostLeft / 512]));619 pSeg = (PDRVDISKSEGMENT)RTMemRealloc(pSeg, RT_UOFFSETOF_DYN(DRVDISKSEGMENT, apIoLog[cbPostLeft / 512])); 620 620 pSeg->pbSeg = (uint8_t *)RTMemRealloc(pSeg->pbSeg, cbPostLeft); 621 621 pSeg->Core.Key += cbRange; … … 629 629 /* Split the segment into 2 new segments. */ 630 630 LogFlowFunc(("Split segment pSeg=%#p\n", pSeg)); 631 PDRVDISKSEGMENT pSegPost = (PDRVDISKSEGMENT)RTMemAllocZ(RT_ OFFSETOF(DRVDISKSEGMENT, apIoLog[cbPostLeft / 512]));631 PDRVDISKSEGMENT pSegPost = (PDRVDISKSEGMENT)RTMemAllocZ(RT_UOFFSETOF_DYN(DRVDISKSEGMENT, apIoLog[cbPostLeft / 512])); 632 632 if (pSegPost) 633 633 { … … 654 654 for (unsigned idx = (uint32_t)(cbPreLeft / 512); idx < (uint32_t)((cbPreLeft + cbRange) / 512); idx++) 655 655 drvdiskintIoLogEntryRelease(pSeg->apIoLog[idx]); 656 pSeg = (PDRVDISKSEGMENT)RTMemRealloc(pSeg, RT_ OFFSETOF(DRVDISKSEGMENT, apIoLog[cbPreLeft / 512]));656 pSeg = (PDRVDISKSEGMENT)RTMemRealloc(pSeg, RT_UOFFSETOF_DYN(DRVDISKSEGMENT, apIoLog[cbPreLeft / 512])); 657 657 pSeg->Core.KeyLast = pSeg->Core.Key + cbPreLeft - 1; 658 658 pSeg->cbSeg = cbPreLeft; … … 860 860 861 861 /** Makes a PDRVDISKINTEGRITY out of a PPDMIMEDIA. */ 862 #define PDMIMEDIA_2_DRVDISKINTEGRITY(pInterface) ( (PDRVDISKINTEGRITY)((uintptr_t)pInterface - RT_ OFFSETOF(DRVDISKINTEGRITY, IMedia)) )862 #define PDMIMEDIA_2_DRVDISKINTEGRITY(pInterface) ( (PDRVDISKINTEGRITY)((uintptr_t)pInterface - RT_UOFFSETOF(DRVDISKINTEGRITY, IMedia)) ) 863 863 864 864 … … 1066 1066 1067 1067 /** Makes a PDRVBLOCK out of a PPDMIMEDIAPORT. */ 1068 #define PDMIMEDIAPORT_2_DRVDISKINTEGRITY(pInterface) ( (PDRVDISKINTEGRITY((uintptr_t)pInterface - RT_ OFFSETOF(DRVDISKINTEGRITY, IMediaPort))) )1068 #define PDMIMEDIAPORT_2_DRVDISKINTEGRITY(pInterface) ( (PDRVDISKINTEGRITY((uintptr_t)pInterface - RT_UOFFSETOF(DRVDISKINTEGRITY, IMediaPort))) ) 1069 1069 1070 1070 /** -
trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp
r69500 r73097 287 287 Assert(cbSense <= sizeof(Req.aSense)); 288 288 Req.spt.SenseInfoLength = (UCHAR)RT_MIN(sizeof(Req.aSense), cbSense); 289 Req.spt.SenseInfoOffset = RT_ OFFSETOF(struct _REQ, aSense);289 Req.spt.SenseInfoOffset = RT_UOFFSETOF(struct _REQ, aSense); 290 290 if (DeviceIoControl((HANDLE)RTFileToNative(pThis->Os.hFileDevice), IOCTL_SCSI_PASS_THROUGH_DIRECT, 291 291 &Req, sizeof(Req), &Req, sizeof(Req), &cbReturned, NULL)) 292 292 { 293 if (cbReturned > RT_ OFFSETOF(struct _REQ, aSense))293 if (cbReturned > RT_UOFFSETOF(struct _REQ, aSense)) 294 294 memcpy(pbSense, Req.aSense, cbSense); 295 295 else -
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r71807 r73097 506 506 PDRVHOSTBASE pThis = RT_FROM_MEMBER(pInterface, DRVHOSTBASE, IMediaEx); 507 507 508 pThis->cbIoReqAlloc = RT_ OFFSETOF(DRVHOSTBASEREQ, abAlloc[cbIoReqAlloc]);508 pThis->cbIoReqAlloc = RT_UOFFSETOF_DYN(DRVHOSTBASEREQ, abAlloc[cbIoReqAlloc]); 509 509 return VINF_SUCCESS; 510 510 } -
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r71807 r73097 776 776 PDRVSCSI pThis = RT_FROM_MEMBER(pInterface, DRVSCSI, IMediaEx); 777 777 778 pThis->cbIoReqAlloc = RT_ OFFSETOF(DRVSCSIREQ, abAlloc[cbIoReqAlloc]);778 pThis->cbIoReqAlloc = RT_UOFFSETOF_DYN(DRVSCSIREQ, abAlloc[cbIoReqAlloc]); 779 779 return VINF_SUCCESS; 780 780 } -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r71775 r73097 96 96 /** Converts a pointer to VBOXDISK::IMedia to a PVBOXDISK. */ 97 97 #define PDMIMEDIA_2_VBOXDISK(pInterface) \ 98 ( (PVBOXDISK)((uintptr_t)pInterface - RT_ OFFSETOF(VBOXDISK, IMedia)) )98 ( (PVBOXDISK)((uintptr_t)pInterface - RT_UOFFSETOF(VBOXDISK, IMedia)) ) 99 99 100 100 /** Saved state version of an I/O request .*/ -
trunk/src/VBox/Devices/Storage/HBDMgmt-win.cpp
r69500 r73097 451 451 LogFlowFunc(("Volume %u: %ls\n", i, papwszVolumes[i])); 452 452 #endif 453 pDev = (PHBDMGRDEV)RTMemAllocZ(RT_ OFFSETOF(HBDMGRDEV, ahVolumes[cVolumes]));453 pDev = (PHBDMGRDEV)RTMemAllocZ(RT_UOFFSETOF_DYN(HBDMGRDEV, ahVolumes[cVolumes])); 454 454 if (pDev) 455 455 { -
trunk/src/VBox/Devices/Storage/IOBufMgmt.cpp
r69500 r73097 334 334 unsigned cBins = iobufMgrGetBinCount(IOBUFMGR_BIN_SIZE_MIN, IOBUFMGR_BIN_SIZE_MAX); 335 335 uint32_t cObjs = iobufMgrGetObjCount(cbMax, cBins, IOBUFMGR_BIN_SIZE_MIN); 336 PIOBUFMGRINT pThis = (PIOBUFMGRINT)RTMemAllocZ(RT_ OFFSETOF(IOBUFMGRINT, apvObj[cObjs]) + cBins * sizeof(IOBUFMGRBIN));336 PIOBUFMGRINT pThis = (PIOBUFMGRINT)RTMemAllocZ(RT_UOFFSETOF_DYN(IOBUFMGRINT, apvObj[cObjs]) + cBins * sizeof(IOBUFMGRBIN)); 337 337 if (RT_LIKELY(pThis)) 338 338 { … … 344 344 pThis->u32OrderMin = ASMBitLastSetU32(IOBUFMGR_BIN_SIZE_MIN) - 1; 345 345 pThis->u32OrderMax = ASMBitLastSetU32(IOBUFMGR_BIN_SIZE_MAX) - 1; 346 pThis->paBins = (PIOBUFMGRBIN)((uint8_t *)pThis + RT_ OFFSETOF(IOBUFMGRINT, apvObj[cObjs]));346 pThis->paBins = (PIOBUFMGRBIN)((uint8_t *)pThis + RT_UOFFSETOF_DYN(IOBUFMGRINT, apvObj[cObjs])); 347 347 348 348 #ifdef IOBUFMGR_VERIFY_ALLOCATIONS -
trunk/src/VBox/Devices/Storage/UsbMsd.cpp
r71964 r73097 887 887 { 888 888 /* Copy the CBW */ 889 size_t cbCopy = RT_ OFFSETOF(USBCBW, CBWCB[pCbw->bCBWCBLength]);889 size_t cbCopy = RT_UOFFSETOF_DYN(USBCBW, CBWCB[pCbw->bCBWCBLength]); 890 890 memcpy(&pReq->Cbw, pCbw, cbCopy); 891 891 memset((uint8_t *)&pReq->Cbw + cbCopy, 0, sizeof(pReq->Cbw) - cbCopy); … … 1625 1625 return usbMsdCompleteStall(pThis, NULL, pUrb, "Bad CBW"); 1626 1626 } 1627 if (pUrb->cbData < RT_UOFFSETOF (USBCBW, CBWCB[pCbw->bCBWCBLength]))1627 if (pUrb->cbData < RT_UOFFSETOF_DYN(USBCBW, CBWCB[pCbw->bCBWCBLength])) 1628 1628 { 1629 1629 Log(("usbMsd: CBW: Mismatching cbData and bCBWCBLength values: %#x vs. %#x (%#x)\n", 1630 pUrb->cbData, RT_UOFFSETOF (USBCBW, CBWCB[pCbw->bCBWCBLength]), pCbw->bCBWCBLength));1630 pUrb->cbData, RT_UOFFSETOF_DYN(USBCBW, CBWCB[pCbw->bCBWCBLength]), pCbw->bCBWCBLength)); 1631 1631 return usbMsdCompleteStall(pThis, NULL, pUrb, "Bad CBW"); 1632 1632 } -
trunk/src/VBox/Devices/Storage/VSCSI/VSCSIVpdPagePool.cpp
r69500 r73097 84 84 } 85 85 86 pPage = (PVSCSIVPDPAGE)RTMemAllocZ(RT_ OFFSETOF(VSCSIVPDPAGE, abPage[cbPage]));86 pPage = (PVSCSIVPDPAGE)RTMemAllocZ(RT_UOFFSETOF_DYN(VSCSIVPDPAGE, abPage[cbPage])); 87 87 if (pPage) 88 88 {
Note:
See TracChangeset
for help on using the changeset viewer.