Changeset 11435 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Aug 14, 2008 6:23:31 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r11287 r11435 89 89 /** Flag whether suspend has changed image open mode to read only. */ 90 90 bool fTempReadOnly; 91 /** Pointer to list of VD interfaces. */ 92 PVDINTERFACE pVDIfs; 91 93 /** Common structure for the supported error interface. */ 92 94 VDINTERFACE VDIError; … … 535 537 536 538 /* Initialize supported VD interfaces. */ 539 pThis->pVDIfs = NULL; 540 537 541 pThis->VDIErrorCallbacks.cbSize = sizeof(VDINTERFACEERROR); 538 542 pThis->VDIErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR; 539 543 pThis->VDIErrorCallbacks.pfnError = drvvdErrorCallback; 540 544 541 rc = VDInterface Create(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR,542 &pThis->VDIErrorCallbacks, pDrvIns, NULL);545 rc = VDInterfaceAdd(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR, 546 &pThis->VDIErrorCallbacks, pDrvIns, &pThis->pVDIfs); 543 547 AssertRC(rc); 544 548 … … 554 558 pThis->VDIAsyncIOCallbacks.pfnTasksSubmit = drvvdAsyncIOTasksSubmit; 555 559 556 rc = VDInterface Create(&pThis->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO,557 &pThis->VDIAsyncIOCallbacks, pThis, &pThis->VDIError);560 rc = VDInterfaceAdd(&pThis->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO, 561 &pThis->VDIAsyncIOCallbacks, pThis, &pThis->pVDIfs); 558 562 AssertRC(rc); 559 563 … … 573 577 * At the moment this is harmless, as iSCSI can only be used as a base 574 578 * image, and no other backend uses the private data for these callbacks. */ 575 rc = VDInterface Create(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG,576 &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->VDIAsyncIO);579 rc = VDInterfaceAdd(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG, 580 &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->pVDIfs); 577 581 AssertRC(rc); 578 582 -
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r11421 r11435 47 47 RTFILE File; 48 48 49 /** Pointer to list of VD interfaces. */ 50 PVDINTERFACE pVDIfs; 49 51 /** Error callback. */ 50 52 PVDINTERFACE pInterfaceError; … … 116 118 pImage->uOpenFlags = uOpenFlags; 117 119 120 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR); 121 if (pImage->pInterfaceError) 122 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 123 118 124 /* 119 125 * Open the image. … … 176 182 pImage->LCHSGeometry = *pLCHSGeometry; 177 183 184 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR); 185 if (pImage->pInterfaceError) 186 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 187 178 188 /* Create image file. */ 179 189 rc = RTFileOpen(&File, pImage->pszFilename, … … 320 330 /** @copydoc VBOXHDDBACKEND::pfnOpen */ 321 331 static int rawOpen(const char *pszFilename, unsigned uOpenFlags, 322 PVDINTERFACE p Interfaces, void **ppBackendData)332 PVDINTERFACE pVDIfs, void **ppBackendData) 323 333 { 324 334 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData)); … … 352 362 pImage->pInterfaceError = NULL; 353 363 pImage->pInterfaceErrorCallbacks = NULL; 354 355 pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR); 356 if (pImage->pInterfaceError) 357 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 364 pImage->pVDIfs = pVDIfs; 358 365 359 366 rc = rawOpenImage(pImage, uOpenFlags); … … 374 381 unsigned uOpenFlags, PFNVMPROGRESS pfnProgress, 375 382 void *pvUser, unsigned uPercentStart, 376 unsigned uPercentSpan, PVDINTERFACE p Interfaces,383 unsigned uPercentSpan, PVDINTERFACE pVDIfs, 377 384 void **ppBackendData) 378 385 { 379 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u p Interfaces=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pInterfaces, ppBackendData));386 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pVDIfs=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pVDIfs, ppBackendData)); 380 387 int rc; 381 388 PRAWIMAGE pImage; … … 407 414 pImage->pszFilename = pszFilename; 408 415 pImage->File = NIL_RTFILE; 409 410 pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR); 411 if (pImage->pInterfaceError) 412 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 413 416 pImage->pVDIfs = pVDIfs; 414 417 415 418 rc = rawCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment, -
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r11421 r11435 819 819 pDisk->pInterfaceErrorCallbacks = NULL; 820 820 821 pDisk->pInterfaceError = VD GetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);821 pDisk->pInterfaceError = VDInterfaceGet(pInterfaces, VDINTERFACETYPE_ERROR); 822 822 if (pDisk->pInterfaceError) 823 823 pDisk->pInterfaceErrorCallbacks = VDGetInterfaceError(pDisk->pInterfaceError); -
trunk/src/VBox/Devices/Storage/VDICore.h
r10781 r11435 579 579 /** Physical geometry of this image (never actually stored). */ 580 580 PDMMEDIAGEOMETRY PCHSGeometry; 581 /** Pointer to list of VD interfaces. */ 582 PVDINTERFACE pVDIfs; 581 583 /** Error interface. */ 582 584 PVDINTERFACE pInterfaceError; -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r11421 r11435 347 347 Assert(VALID_PTR(pLCHSGeometry)); 348 348 349 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR); 350 if (pImage->pInterfaceError) 351 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 352 349 353 vdiInitPreHeader(&pImage->PreHeader); 350 354 vdiInitHeader(&pImage->Header, enmType, uImageFlags, pszComment, cbSize, VDI_IMAGE_DEFAULT_BLOCK_SIZE, 0); … … 528 532 529 533 pImage->uOpenFlags = uOpenFlags; 534 535 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR); 536 if (pImage->pInterfaceError) 537 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 530 538 531 539 /* … … 751 759 pImage->pInterfaceError = NULL; 752 760 pImage->pInterfaceErrorCallbacks = NULL; 761 pImage->pVDIfs = NULL; 753 762 754 763 rc = vdiOpenImage(pImage, VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_READONLY); … … 762 771 /** @copydoc VBOXHDDBACKEND::pfnOpen */ 763 772 static int vdiOpen(const char *pszFilename, unsigned uOpenFlags, 764 PVDINTERFACE pInterfaces, 765 void **ppBackendData) 773 PVDINTERFACE pVDIfs, void **ppBackendData) 766 774 { 767 775 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData)); … … 795 803 pImage->pInterfaceError = NULL; 796 804 pImage->pInterfaceErrorCallbacks = NULL; 797 798 pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR); 799 if (pImage->pInterfaceError) 800 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 805 pImage->pVDIfs = pVDIfs; 801 806 802 807 rc = vdiOpenImage(pImage, uOpenFlags); … … 817 822 unsigned uOpenFlags, PFNVMPROGRESS pfnProgress, 818 823 void *pvUser, unsigned uPercentStart, 819 unsigned uPercentSpan, PVDINTERFACE p Interfaces,824 unsigned uPercentSpan, PVDINTERFACE pVDIfs, 820 825 void **ppBackendData) 821 826 { 822 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u p Interfaces=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pInterfaces, ppBackendData));827 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pVDIfs=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pVDIfs, ppBackendData)); 823 828 int rc; 824 829 PVDIIMAGEDESC pImage; … … 855 860 pImage->pInterfaceError = NULL; 856 861 pImage->pInterfaceErrorCallbacks = NULL; 862 pImage->pVDIfs = pVDIfs; 857 863 858 864 rc = vdiCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment, -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r11421 r11435 359 359 PVMDKFILE pFile; 360 360 361 /** Pointer to list of VD interfaces. */ 362 PVDINTERFACE pVDIfs; 363 361 364 /** Error interface. */ 362 365 PVDINTERFACE pInterfaceError; … … 2326 2329 pImage->uOpenFlags = uOpenFlags; 2327 2330 2331 /* Try to get error interface. */ 2332 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR); 2333 if (pImage->pInterfaceError) 2334 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 2335 2336 /* Try to get async I/O interface. */ 2337 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ASYNCIO); 2338 if (pImage->pInterfaceAsyncIO) 2339 pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO); 2340 2328 2341 /* 2329 2342 * Open the image. … … 3113 3126 3114 3127 pImage->uImageFlags = uImageFlags; 3128 3129 /* Try to get error interface. */ 3130 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR); 3131 if (pImage->pInterfaceError) 3132 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 3133 3134 /* Try to get async I/O interface. */ 3135 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ASYNCIO); 3136 if (pImage->pInterfaceAsyncIO) 3137 pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO); 3138 3115 3139 rc = vmdkCreateDescriptor(pImage, pImage->pDescData, pImage->cbDescAlloc, 3116 3140 &pImage->Descriptor); … … 3678 3702 pImage->pInterfaceError = NULL; 3679 3703 pImage->pInterfaceErrorCallbacks = NULL; 3704 pImage->pInterfaceAsyncIO = NULL; 3705 pImage->pInterfaceAsyncIOCallbacks = NULL; 3706 pImage->pVDIfs = NULL; 3680 3707 /** @todo speed up this test open (VD_OPEN_FLAGS_INFO) by skipping as 3681 3708 * much as possible in vmdkOpenImage. */ … … 3690 3717 /** @copydoc VBOXHDDBACKEND::pfnOpen */ 3691 3718 static int vmdkOpen(const char *pszFilename, unsigned uOpenFlags, 3692 PVDINTERFACE pInterfaces, 3693 void **ppBackendData) 3719 PVDINTERFACE pVDIfs, void **ppBackendData) 3694 3720 { 3695 3721 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData)); … … 3728 3754 pImage->pInterfaceError = NULL; 3729 3755 pImage->pInterfaceErrorCallbacks = NULL; 3730 3731 /* Try to get error interface. */ 3732 pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR); 3733 if (pImage->pInterfaceError) 3734 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 3735 3736 /* Try to get async I/O interface. */ 3737 pImage->pInterfaceAsyncIO = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ASYNCIO); 3738 if (pImage->pInterfaceAsyncIO) 3739 pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO); 3740 3756 pImage->pInterfaceAsyncIO = NULL; 3757 pImage->pInterfaceAsyncIOCallbacks = NULL; 3758 pImage->pVDIfs = NULL; 3741 3759 3742 3760 rc = vmdkOpenImage(pImage, uOpenFlags); … … 3757 3775 unsigned uOpenFlags, PFNVMPROGRESS pfnProgress, 3758 3776 void *pvUser, unsigned uPercentStart, 3759 unsigned uPercentSpan, PVDINTERFACE p Interfaces,3777 unsigned uPercentSpan, PVDINTERFACE pVDIfs, 3760 3778 void **ppBackendData) 3761 3779 { 3762 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u p Interfaces=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pInterfaces, ppBackendData));3780 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pVDIfs=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pVDIfs, ppBackendData)); 3763 3781 int rc; 3764 3782 PVMDKIMAGE pImage; … … 3801 3819 pImage->pInterfaceError = NULL; 3802 3820 pImage->pInterfaceErrorCallbacks = NULL; 3821 pImage->pInterfaceAsyncIO = NULL; 3822 pImage->pInterfaceAsyncIOCallbacks = NULL; 3823 pImage->pVDIfs = NULL; 3803 3824 pImage->cbDescAlloc = VMDK_SECTOR2BYTE(20); 3804 3825 pImage->pDescData = (char *)RTMemAllocZ(pImage->cbDescAlloc); … … 3808 3829 goto out; 3809 3830 } 3810 3811 /* Get error interface. */3812 pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);3813 if (pImage->pInterfaceError)3814 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);3815 3831 3816 3832 rc = vmdkCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment, -
trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp
r11353 r11435 56 56 PDMMEDIAGEOMETRY PCHS = { 0, 0, 0 }; 57 57 PDMMEDIAGEOMETRY LCHS = { 0, 0, 0 }; 58 PVDINTERFACE pVDIfs = NULL; 58 59 VDINTERFACE VDIError; 59 60 VDINTERFACEERROR VDIErrorCallbacks; … … 75 76 VDIErrorCallbacks.pfnError = tstVDError; 76 77 77 rc = VDInterface Create(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,78 NULL, NULL);78 rc = VDInterfaceAdd(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks, 79 NULL, &pVDIfs); 79 80 AssertRC(rc); 80 81 … … 431 432 uint64_t u64DiskSize = 1000 * _1M; 432 433 uint32_t u32SectorSize = 512; 434 PVDINTERFACE pVDIfs = NULL; 433 435 VDINTERFACE VDIError; 434 436 VDINTERFACEERROR VDIErrorCallbacks; … … 450 452 VDIErrorCallbacks.pfnError = tstVDError; 451 453 452 rc = VDInterface Create(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,453 NULL, NULL);454 rc = VDInterfaceAdd(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks, 455 NULL, &pVDIfs); 454 456 AssertRC(rc); 455 457 … … 549 551 uint64_t u64DiskSize = 1000 * _1M; 550 552 uint32_t u32SectorSize = 512; 553 PVDINTERFACE pVDIfs; 551 554 VDINTERFACE VDIError; 552 555 VDINTERFACEERROR VDIErrorCallbacks; … … 568 571 VDIErrorCallbacks.pfnError = tstVDError; 569 572 570 rc = VDInterface Create(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,571 NULL, NULL);573 rc = VDInterfaceAdd(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks, 574 NULL, &pVDIfs); 572 575 AssertRC(rc); 573 576
Note:
See TracChangeset
for help on using the changeset viewer.