Changeset 11444 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Aug 15, 2008 2:33:02 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 34825
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r11435 r11444 77 77 78 78 /** 79 * VBox disk container, image information, private part. 80 */ 81 82 typedef struct VBOXIMAGE 83 { 84 /** Pointer to next image. */ 85 struct VBOXIMAGE *pNext; 86 /** Pointer to list of VD interfaces. Per-image. */ 87 PVDINTERFACE pVDIfsImage; 88 /** Common structure for the configuration information interface. */ 89 VDINTERFACE VDIConfig; 90 } VBOXIMAGE, *PVBOXIMAGE; 91 92 /** 79 93 * VBox disk container media main structure, private part. 80 94 */ … … 89 103 /** Flag whether suspend has changed image open mode to read only. */ 90 104 bool fTempReadOnly; 91 /** Pointer to list of VD interfaces. */92 PVDINTERFACE pVDIfs ;105 /** Pointer to list of VD interfaces. Per-disk. */ 106 PVDINTERFACE pVDIfsDisk; 93 107 /** Common structure for the supported error interface. */ 94 108 VDINTERFACE VDIError; … … 99 113 /** Callback table for async I/O interface. */ 100 114 VDINTERFACEASYNCIO VDIAsyncIOCallbacks; 101 /** Common structure for the configuration information interface. */102 VDINTERFACE VDIConfig;103 115 /** Callback table for the configuration information interface. */ 104 116 VDINTERFACECONFIG VDIConfigCallbacks; … … 115 127 /** Our cache to reduce allocation overhead. */ 116 128 PRTOBJCACHE pCache; 129 /** Pointer to the list of data we need to keep per image. */ 130 PVBOXIMAGE pImages; 117 131 } VBOXDISK, *PVBOXDISK; 118 132 … … 126 140 PPDMDRVINS pDrvIns = (PPDMDRVINS)pvUser; 127 141 pDrvIns->pDrvHlp->pfnVMSetErrorV(pDrvIns, rc, RT_SRC_POS_ARGS, pszFormat, va); 142 } 143 144 145 /** 146 * Internal: allocate new image descriptor and put it in the list 147 */ 148 static PVBOXIMAGE drvvdNewImage(PVBOXDISK pThis) 149 { 150 AssertPtr(pThis); 151 PVBOXIMAGE pImage = (PVBOXIMAGE)RTMemAllocZ(sizeof(VBOXIMAGE)); 152 if (pImage) 153 { 154 pImage->pVDIfsImage = NULL; 155 PVBOXIMAGE *pp = &pThis->pImages; 156 while (*pp != NULL) 157 pp = &(*pp)->pNext; 158 *pp = pImage; 159 pImage->pNext = NULL; 160 } 161 162 return pImage; 163 } 164 165 /** 166 * Internal: free the list of images descriptors. 167 */ 168 static void drvvdFreeImages(PVBOXDISK pThis) 169 { 170 while (pThis->pImages != NULL) 171 { 172 PVBOXIMAGE p = pThis->pImages; 173 pThis->pImages = pThis->pImages->pNext; 174 RTMemFree(p); 175 } 128 176 } 129 177 … … 537 585 538 586 /* Initialize supported VD interfaces. */ 539 pThis->pVDIfs = NULL;587 pThis->pVDIfsDisk = NULL; 540 588 541 589 pThis->VDIErrorCallbacks.cbSize = sizeof(VDINTERFACEERROR); … … 544 592 545 593 rc = VDInterfaceAdd(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR, 546 &pThis->VDIErrorCallbacks, pDrvIns, &pThis->pVDIfs );594 &pThis->VDIErrorCallbacks, pDrvIns, &pThis->pVDIfsDisk); 547 595 AssertRC(rc); 548 596 … … 559 607 560 608 rc = VDInterfaceAdd(&pThis->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO, 561 &pThis->VDIAsyncIOCallbacks, pThis, &pThis->pVDIfs );609 &pThis->VDIAsyncIOCallbacks, pThis, &pThis->pVDIfsDisk); 562 610 AssertRC(rc); 563 611 612 /* This is just prepared here, the actual interface is per-image, so it's 613 * added later. No need to have separate callback tables. */ 564 614 pThis->VDIConfigCallbacks.cbSize = sizeof(VDINTERFACECONFIG); 565 615 pThis->VDIConfigCallbacks.enmInterface = VDINTERFACETYPE_CONFIG; … … 573 623 pThis->VDIConfigCallbacks.pfnQueryBytes = drvvdCfgQueryBytes; 574 624 575 /** @todo TEMP! this isn't really correct - this needs to be made per image, 576 * as CFGM needs access to the right configuration node for each image. 577 * At the moment this is harmless, as iSCSI can only be used as a base 578 * image, and no other backend uses the private data for these callbacks. */ 579 rc = VDInterfaceAdd(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG, 580 &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->pVDIfs); 581 AssertRC(rc); 625 /* List of images is empty now. */ 626 pThis->pImages = NULL; 582 627 583 628 /* Try to attach async media port interface above.*/ … … 662 707 if (RT_SUCCESS(rc)) 663 708 { 664 /** @todo TEMP! later the iSCSI config callbacks won't be included here */ 665 rc = VDCreate(&pThis->VDIConfig, &pThis->pDisk); 709 rc = VDCreate(pThis->pVDIfsDisk, &pThis->pDisk); 666 710 /* Error message is already set correctly. */ 667 711 } 668 712 669 unsigned cImages = iLevel;670 713 while (pCurNode && RT_SUCCESS(rc)) 671 714 { 715 /* Allocate per-image data. */ 716 PVBOXIMAGE pImage = drvvdNewImage(pThis); 717 if (!pImage) 718 { 719 rc = VERR_NO_MEMORY; 720 break; 721 } 722 672 723 /* 673 724 * Read the image configuration. … … 717 768 } 718 769 719 /** @todo TEMP! Later this needs to be done for each image. */ 720 if (iLevel == cImages) 721 { 722 PCFGMNODE pCfg = CFGMR3GetChild(pCurNode, "VDConfig"); 723 pThis->VDIConfig.pvUser = pCfg; /**< @todo TEMP! */ 724 } 770 PCFGMNODE pCfg = CFGMR3GetChild(pCurNode, "VDConfig"); 771 rc = VDInterfaceAdd(&pImage->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG, 772 &pThis->VDIConfigCallbacks, pCfg, &pImage->pVDIfsImage); 773 AssertRC(rc); 725 774 726 775 /* … … 738 787 739 788 /** Try to open backend in asyc I/O mode first. */ 740 rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags );789 rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags, pImage->pVDIfsImage); 741 790 if (rc == VERR_NOT_SUPPORTED) 742 791 { 743 792 /* Seems async I/O is not supported by the backend, open in normal mode. */ 744 793 uOpenFlags &= ~VD_OPEN_FLAGS_ASYNC_IO; 745 rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags );794 rc = VDOpen(pThis->pDisk, pszFormat, pszName, uOpenFlags, pImage->pVDIfsImage); 746 795 } 747 796 … … 774 823 pThis->pDisk = NULL; 775 824 } 825 drvvdFreeImages(pThis); 776 826 if (VALID_PTR(pszName)) 777 827 MMR3HeapFree(pszName); … … 841 891 LogFlow(("%s:\n", __FUNCTION__)); 842 892 893 drvvdFreeImages(pThis); 843 894 if (pThis->pCache) 844 895 { -
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r11435 r11444 47 47 RTFILE File; 48 48 49 /** Pointer to list of VD interfaces. */ 50 PVDINTERFACE pVDIfs; 49 /** Pointer to the per-disk VD interface list. */ 50 PVDINTERFACE pVDIfsDisk; 51 51 52 /** Error callback. */ 52 53 PVDINTERFACE pInterfaceError; … … 118 119 pImage->uOpenFlags = uOpenFlags; 119 120 120 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ERROR);121 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR); 121 122 if (pImage->pInterfaceError) 122 123 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); … … 182 183 pImage->LCHSGeometry = *pLCHSGeometry; 183 184 184 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ERROR);185 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR); 185 186 if (pImage->pInterfaceError) 186 187 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); … … 330 331 /** @copydoc VBOXHDDBACKEND::pfnOpen */ 331 332 static int rawOpen(const char *pszFilename, unsigned uOpenFlags, 332 PVDINTERFACE pVDIfs, void **ppBackendData) 333 { 334 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData)); 333 PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage, 334 void **ppBackendData) 335 { 336 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData)); 335 337 int rc; 336 338 PRAWIMAGE pImage; … … 360 362 pImage->pszFilename = pszFilename; 361 363 pImage->File = NIL_RTFILE; 362 pImage->pInterfaceError = NULL; 363 pImage->pInterfaceErrorCallbacks = NULL; 364 pImage->pVDIfs = pVDIfs; 364 pImage->pVDIfsDisk = pVDIfsDisk; 365 365 366 366 rc = rawOpenImage(pImage, uOpenFlags); … … 379 379 PCPDMMEDIAGEOMETRY pPCHSGeometry, 380 380 PCPDMMEDIAGEOMETRY pLCHSGeometry, PCRTUUID pUuid, 381 unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,382 void *pvUser, unsigned uPercentStart,383 unsigned uPercentSpan, PVDINTERFACE pVDIfs,381 unsigned uOpenFlags, unsigned uPercentStart, 382 unsigned uPercentSpan, PVDINTERFACE pVDIfsDisk, 383 PVDINTERFACE pVDIfsImage, PVDINTERFACE pVDIfsOperation, 384 384 void **ppBackendData) 385 385 { 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));386 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData)); 387 387 int rc; 388 388 PRAWIMAGE pImage; 389 390 PFNVMPROGRESS pfnProgress = NULL; 391 void *pvUser = NULL; 392 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 393 VDINTERFACETYPE_PROGRESS); 394 PVDINTERFACEPROGRESS pCbProgress = NULL; 395 if (pIfProgress) 396 { 397 pCbProgress = VDGetInterfaceProgress(pIfProgress); 398 pfnProgress = pCbProgress->pfnProgress; 399 pvUser = pIfProgress->pvUser; 400 } 389 401 390 402 /* Check open flags. All valid flags are supported. */ … … 414 426 pImage->pszFilename = pszFilename; 415 427 pImage->File = NIL_RTFILE; 416 pImage->pVDIfs = pVDIfs;428 pImage->pVDIfsDisk = pVDIfsDisk; 417 429 418 430 rc = rawCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment, -
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r11435 r11444 70 70 /** Function pointers for the various backend methods. */ 71 71 PCVBOXHDDBACKEND Backend; 72 73 /** Pointer to list of VD interfaces, per-image. */ 74 PVDINTERFACE pVDIfsImage; 72 75 } VDIMAGE, *PVDIMAGE; 73 76 … … 108 111 PDMMEDIAGEOMETRY LCHSGeometry; 109 112 110 /** List of interfaces the caller supports. */111 PVDINTERFACE p Interfaces;113 /** Pointer to list of VD interfaces, per-disk. */ 114 PVDINTERFACE pVDIfsDisk; 112 115 /** Pointer to the common interface structure for error reporting. */ 113 116 PVDINTERFACE pInterfaceError; … … 785 788 * 786 789 * @returns VBox status code. 787 * @param p Interfaces Pointer to the first supported interface.790 * @param pVDIfsDisk Pointer to the per-disk VD interface list. 788 791 * @param ppDisk Where to store the reference to HDD container. 789 792 */ 790 VBOXDDU_DECL(int) VDCreate(PVDINTERFACE p Interfaces, PVBOXHDD *ppDisk)793 VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pVDIfsDisk, PVBOXHDD *ppDisk) 791 794 { 792 795 int rc = VINF_SUCCESS; 793 796 PVBOXHDD pDisk = NULL; 794 797 795 LogFlowFunc(("p Interfaces=%#p\n", pInterfaces));798 LogFlowFunc(("pVDIfsDisk=%#p\n", pVDIfsDisk)); 796 799 do 797 800 { … … 815 818 pDisk->LCHSGeometry.cHeads = 0; 816 819 pDisk->LCHSGeometry.cSectors = 0; 817 pDisk->p Interfaces = pInterfaces;820 pDisk->pVDIfsDisk = pVDIfsDisk; 818 821 pDisk->pInterfaceError = NULL; 819 822 pDisk->pInterfaceErrorCallbacks = NULL; 820 823 821 pDisk->pInterfaceError = VDInterfaceGet(p Interfaces, VDINTERFACETYPE_ERROR);824 pDisk->pInterfaceError = VDInterfaceGet(pVDIfsDisk, VDINTERFACETYPE_ERROR); 822 825 if (pDisk->pInterfaceError) 823 826 pDisk->pInterfaceErrorCallbacks = VDGetInterfaceError(pDisk->pInterfaceError); … … 1043 1046 * @param pszFilename Name of the image file to open. 1044 1047 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 1048 * @param pVDIfsImage Pointer to the per-image VD interface list. 1045 1049 */ 1046 1050 VBOXDDU_DECL(int) VDOpen(PVBOXHDD pDisk, const char *pszBackend, 1047 const char *pszFilename, unsigned uOpenFlags) 1051 const char *pszFilename, unsigned uOpenFlags, 1052 PVDINTERFACE pVDIfsImage) 1048 1053 { 1049 1054 int rc = VINF_SUCCESS; 1050 1055 PVDIMAGE pImage = NULL; 1051 1056 1052 LogFlowFunc(("pDisk=%#p pszBackend=\"%s\" pszFilename=\"%s\" uOpenFlags=%#x\n ",1053 pDisk, pszBackend, pszFilename, uOpenFlags ));1057 LogFlowFunc(("pDisk=%#p pszBackend=\"%s\" pszFilename=\"%s\" uOpenFlags=%#x\n, pVDIfsImage=%#p", 1058 pDisk, pszBackend, pszFilename, uOpenFlags, pVDIfsImage)); 1054 1059 do 1055 1060 { … … 1082 1087 break; 1083 1088 } 1089 pImage->pVDIfsImage = pVDIfsImage; 1084 1090 1085 1091 rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin); … … 1096 1102 rc = pImage->Backend->pfnOpen(pImage->pszFilename, 1097 1103 uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME, 1098 pDisk->pInterfaces, 1104 pDisk->pVDIfsDisk, 1105 pImage->pVDIfsImage, 1099 1106 &pImage->pvBackendData); 1100 1107 /* If the open in read-write mode failed, retry in read-only mode. */ … … 1110 1117 (uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME) 1111 1118 | VD_OPEN_FLAGS_READONLY, 1112 pDisk->pInterfaces, 1119 pDisk->pVDIfsDisk, 1120 pImage->pVDIfsImage, 1113 1121 &pImage->pvBackendData); 1114 1122 if (RT_FAILURE(rc)) … … 1261 1269 * @param pUuid New UUID of the image. If NULL, a new UUID is created. 1262 1270 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 1263 * @param p fnProgress Progress callback. Optional. NULL if not to be used.1264 * @param p vUser User argument for the progress callback.1271 * @param pVDIfsImage Pointer to the per-image VD interface list. 1272 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 1265 1273 */ 1266 1274 VBOXDDU_DECL(int) VDCreateBase(PVBOXHDD pDisk, const char *pszBackend, … … 1271 1279 PCPDMMEDIAGEOMETRY pLCHSGeometry, 1272 1280 PCRTUUID pUuid, unsigned uOpenFlags, 1273 PFNVMPROGRESS pfnProgress, void *pvUser) 1281 PVDINTERFACE pVDIfsImage, 1282 PVDINTERFACE pVDIfsOperation) 1274 1283 { 1275 1284 int rc = VINF_SUCCESS; … … 1277 1286 RTUUID uuid; 1278 1287 1279 LogFlowFunc(("pDisk=%#p pszBackend=\"%s\" pszFilename=\"%s\" enmType=%#x cbSize=%llu uImageFlags=%#x pszComment=\"%s\" PCHS=%u/%u/%u LCHS=%u/%u/%u Uuid=%RTuuid uOpenFlags=%#x p fnProgress=%#p pvUser=%#p\n",1288 LogFlowFunc(("pDisk=%#p pszBackend=\"%s\" pszFilename=\"%s\" enmType=%#x cbSize=%llu uImageFlags=%#x pszComment=\"%s\" PCHS=%u/%u/%u LCHS=%u/%u/%u Uuid=%RTuuid uOpenFlags=%#x pVDIfsImage=%#p pVDIfsOperation=%#p\n", 1280 1289 pDisk, pszBackend, pszFilename, enmType, cbSize, uImageFlags, pszComment, 1281 1290 pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, 1282 1291 pPCHSGeometry->cSectors, pLCHSGeometry->cCylinders, 1283 1292 pLCHSGeometry->cHeads, pLCHSGeometry->cSectors, pUuid, 1284 uOpenFlags, pfnProgress, pvUser)); 1293 uOpenFlags, pVDIfsImage, pVDIfsOperation)); 1294 1295 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 1296 VDINTERFACETYPE_PROGRESS); 1297 PVDINTERFACEPROGRESS pCbProgress = NULL; 1298 if (pIfProgress) 1299 pCbProgress = VDGetInterfaceProgress(pIfProgress); 1300 1285 1301 do 1286 1302 { … … 1349 1365 break; 1350 1366 } 1367 pImage->pVDIfsImage = pVDIfsImage; 1351 1368 1352 1369 rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin); … … 1379 1396 pLCHSGeometry, pUuid, 1380 1397 uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME, 1381 pfnProgress, pvUser, 0, 99, 1382 pDisk->pInterfaces, 1398 0, 99, 1399 pDisk->pVDIfsDisk, 1400 pImage->pVDIfsImage, 1401 pVDIfsOperation, 1383 1402 &pImage->pvBackendData); 1384 1403 … … 1464 1483 } 1465 1484 1466 if (RT_SUCCESS(rc) && pfnProgress) 1467 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 1485 if (RT_SUCCESS(rc) && pCbProgress->pfnProgress) 1486 pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 100, 1487 pIfProgress->pvUser); 1468 1488 1469 1489 LogFlowFunc(("returns %Rrc\n", rc)); … … 1483 1503 * @param pUuid New UUID of the image. If NULL, a new UUID is created. 1484 1504 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 1485 * @param p fnProgress Progress callback. Optional. NULL if not to be used.1486 * @param p vUser User argument for the progress callback.1505 * @param pVDIfsImage Pointer to the per-image VD interface list. 1506 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 1487 1507 */ 1488 1508 VBOXDDU_DECL(int) VDCreateDiff(PVBOXHDD pDisk, const char *pszBackend, 1489 1509 const char *pszFilename, unsigned uImageFlags, 1490 1510 const char *pszComment, PCRTUUID pUuid, 1491 unsigned uOpenFlags, P FNVMPROGRESS pfnProgress,1492 void *pvUser)1511 unsigned uOpenFlags, PVDINTERFACE pVDIfsImage, 1512 PVDINTERFACE pVDIfsOperation) 1493 1513 { 1494 1514 int rc = VINF_SUCCESS; … … 1496 1516 RTUUID uuid; 1497 1517 1498 LogFlowFunc(("pDisk=%#p pszBackend=\"%s\" pszFilename=\"%s\" uImageFlags=%#x pszComment=\"%s\" Uuid=%RTuuid uOpenFlags=%#x p fnProgress=%#p pvUser=%#p\n",1518 LogFlowFunc(("pDisk=%#p pszBackend=\"%s\" pszFilename=\"%s\" uImageFlags=%#x pszComment=\"%s\" Uuid=%RTuuid uOpenFlags=%#x pVDIfsImage=%#p pVDIfsOperation=%#p\n", 1499 1519 pDisk, pszBackend, pszFilename, uImageFlags, pszComment, pUuid, uOpenFlags, 1500 pfnProgress, pvUser)); 1520 pVDIfsImage, pVDIfsOperation)); 1521 1522 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 1523 VDINTERFACETYPE_PROGRESS); 1524 PVDINTERFACEPROGRESS pCbProgress = NULL; 1525 if (pIfProgress) 1526 pCbProgress = VDGetInterfaceProgress(pIfProgress); 1527 1501 1528 do 1502 1529 { … … 1573 1600 &pDisk->LCHSGeometry, pUuid, 1574 1601 uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME, 1575 pfnProgress, pvUser, 0, 99, 1576 pDisk->pInterfaces, 1602 0, 99, 1603 pDisk->pVDIfsDisk, 1604 pImage->pVDIfsImage, 1605 pVDIfsOperation, 1577 1606 &pImage->pvBackendData); 1578 1607 … … 1649 1678 } 1650 1679 1651 if (RT_SUCCESS(rc) && pfnProgress) 1652 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 1680 if (RT_SUCCESS(rc) && pCbProgress->pfnProgress) 1681 pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 100, 1682 pIfProgress->pvUser); 1653 1683 1654 1684 LogFlowFunc(("returns %Rrc\n", rc)); … … 1667 1697 * @param nImageFrom Name of the image file to merge from. 1668 1698 * @param nImageTo Name of the image file to merge to. 1669 * @param pfnProgress Progress callback. Optional. NULL if not to be used. 1670 * @param pvUser User argument for the progress callback. 1699 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 1671 1700 */ 1672 1701 VBOXDDU_DECL(int) VDMerge(PVBOXHDD pDisk, unsigned nImageFrom, 1673 unsigned nImageTo, PFNVMPROGRESS pfnProgress, 1674 void *pvUser) 1702 unsigned nImageTo, PVDINTERFACE pVDIfsOperation) 1675 1703 { 1676 1704 int rc = VINF_SUCCESS; 1677 1705 void *pvBuf = NULL; 1678 1706 1679 LogFlowFunc(("pDisk=%#p nImageFrom=%u nImageTo=%u pfnProgress=%#p pvUser=%#p\n", 1680 pDisk, nImageFrom, nImageTo, pfnProgress, pvUser)); 1707 LogFlowFunc(("pDisk=%#p nImageFrom=%u nImageTo=%u pVDIfsOperation=%#p\n", 1708 pDisk, nImageFrom, nImageTo, pVDIfsOperation)); 1709 1710 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 1711 VDINTERFACETYPE_PROGRESS); 1712 PVDINTERFACEPROGRESS pCbProgress = NULL; 1713 if (pIfProgress) 1714 pCbProgress = VDGetInterfaceProgress(pIfProgress); 1715 1681 1716 do 1682 1717 { … … 1768 1803 uOffset += cbThisRead; 1769 1804 cbRemaining -= cbThisRead; 1805 1806 if (pCbProgress->pfnProgress) 1807 { 1808 rc = pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 1809 uOffset * 99 / cbSize, 1810 pIfProgress->pvUser); 1811 if (RT_FAILURE(rc)) 1812 break; 1813 } 1770 1814 } while (uOffset < cbSize); 1771 1815 } … … 1808 1852 uOffset += cbThisRead; 1809 1853 cbRemaining -= cbThisRead; 1854 1855 if (pCbProgress->pfnProgress) 1856 { 1857 rc = pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 1858 uOffset * 99 / cbSize, 1859 pIfProgress->pvUser); 1860 if (RT_FAILURE(rc)) 1861 break; 1862 } 1810 1863 } while (uOffset < cbSize); 1811 1864 } … … 1868 1921 RTMemTmpFree(pvBuf); 1869 1922 1870 if (RT_SUCCESS(rc) && pfnProgress) 1871 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 1923 if (RT_SUCCESS(rc) && pCbProgress->pfnProgress) 1924 pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 100, 1925 pIfProgress->pvUser); 1872 1926 1873 1927 LogFlowFunc(("returns %Rrc\n", rc)); … … 1894 1948 * @param fMoveByRename If true, attempt to perform a move by renaming (if successful the new size is ignored). 1895 1949 * @param cbSize New image size (0 means leave unchanged). 1896 * @param pfnProgress Progress callback. Optional. NULL if not to be used. 1897 * @param pvUser User argument for the progress callback. 1950 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 1951 * @param pDstVDIfsImage Pointer to the per-image VD interface list, for the 1952 * destination image. 1953 * @param pDstVDIfsOperation Pointer to the per-image VD interface list, 1954 * for the destination image. 1898 1955 */ 1899 1956 VBOXDDU_DECL(int) VDCopy(PVBOXHDD pDiskFrom, unsigned nImage, PVBOXHDD pDiskTo, 1900 1957 const char *pszBackend, const char *pszFilename, 1901 1958 bool fMoveByRename, uint64_t cbSize, 1902 PFNVMPROGRESS pfnProgress, void *pvUser) 1959 PVDINTERFACE pVDIfsOperation, 1960 PVDINTERFACE pDstVDIfsImage, 1961 PVDINTERFACE pDstVDIfsOperation) 1903 1962 { 1904 1963 int rc, rc2 = VINF_SUCCESS; … … 1906 1965 PVDIMAGE pImageTo = NULL; 1907 1966 1908 LogFlowFunc(("pDiskFrom=%#p nImage=%u pDiskTo=%#p pszBackend=\"%s\" pszFilename=\"%s\" fMoveByRename=%d cbSize=%llu pfnProgress=%#p pvUser=%#p\n", 1909 pDiskFrom, nImage, pDiskTo, pszBackend, pszFilename, fMoveByRename, cbSize, pfnProgress, pvUser)); 1967 LogFlowFunc(("pDiskFrom=%#p nImage=%u pDiskTo=%#p pszBackend=\"%s\" pszFilename=\"%s\" fMoveByRename=%d cbSize=%llu pVDIfsOperation=%#p pDstVDIfsImage=%#p pDstVDIfsOperation=%#p\n", 1968 pDiskFrom, nImage, pDiskTo, pszBackend, pszFilename, fMoveByRename, cbSize, pVDIfsOperation, pDstVDIfsImage, pDstVDIfsOperation)); 1969 1970 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 1971 VDINTERFACETYPE_PROGRESS); 1972 PVDINTERFACEPROGRESS pCbProgress = NULL; 1973 if (pIfProgress) 1974 pCbProgress = VDGetInterfaceProgress(pIfProgress); 1975 1976 PVDINTERFACE pDstIfProgress = VDInterfaceGet(pDstVDIfsOperation, 1977 VDINTERFACETYPE_PROGRESS); 1978 PVDINTERFACEPROGRESS pDstCbProgress = NULL; 1979 if (pDstIfProgress) 1980 pDstCbProgress = VDGetInterfaceProgress(pDstIfProgress); 1910 1981 1911 1982 do { … … 1942 2013 1943 2014 /* Open the source image in the destination container. */ 1944 rc = VDOpen(pDiskTo, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags );2015 rc = VDOpen(pDiskTo, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags, pDstVDIfsImage); 1945 2016 if (RT_FAILURE(rc)) 1946 2017 goto movefail; … … 1968 2039 movefail: 1969 2040 /* In case of failure, re-open the source image in the source container. */ 1970 rc2 = VDOpen(pDiskFrom, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags );2041 rc2 = VDOpen(pDiskFrom, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags, pImageFrom->pVDIfsImage); 1971 2042 if (RT_FAILURE(rc2)) 1972 2043 /** @todo Uncertain what to do on error. If this happens pImageFrom and pImageTo are both closed. */ … … 2053 2124 uOffset += cbThisRead; 2054 2125 cbRemaining -= cbThisRead; 2055 if (pfnProgress) 2126 2127 if (pCbProgress->pfnProgress) 2056 2128 { 2057 rc = pfnProgress(NULL /* WARNING! pVM=NULL */, 2058 ((cbSize - cbRemaining) * 100) / cbSize, 2059 pvUser); 2129 rc = pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 2130 uOffset * 99 / cbSize, 2131 pIfProgress->pvUser); 2132 if (RT_FAILURE(rc)) 2133 break; 2134 } 2135 if (pDstCbProgress->pfnProgress) 2136 { 2137 rc = pDstCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 2138 uOffset * 99 / cbSize, 2139 pDstIfProgress->pvUser); 2060 2140 if (RT_FAILURE(rc)) 2061 2141 break; … … 2108 2188 RTMemTmpFree(pvBuf); 2109 2189 2110 if (RT_SUCCESS(rc) && pfnProgress) 2111 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 2190 if (RT_SUCCESS(rc)) 2191 { 2192 if (pCbProgress->pfnProgress) 2193 pCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 100, 2194 pIfProgress->pvUser); 2195 if (pDstCbProgress->pfnProgress) 2196 pDstCbProgress->pfnProgress(NULL /* WARNING! pVM=NULL */, 100, 2197 pDstIfProgress->pvUser); 2198 } 2112 2199 2113 2200 LogFlowFunc(("returns %Rrc\n", rc)); -
trunk/src/VBox/Devices/Storage/VBoxHDD-newInternal.h
r11421 r11444 78 78 * unchanged during the lifetime of this image. 79 79 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 80 * @param pInterfaces Pointer to the first element of supported interfaces of the caller. 80 * @param pVDIfsDisk Pointer to the per-disk VD interface list. 81 * @param pVDIfsImage Pointer to the per-image VD interface list. 81 82 * @param ppvBackendData Opaque state data for this image. 82 83 */ 83 84 DECLR3CALLBACKMEMBER(int, pfnOpen, (const char *pszFilename, unsigned uOpenFlags, 84 PVDINTERFACE pInterfaces, void **ppvBackendData)); 85 PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage, 86 void **ppvBackendData)); 85 87 86 88 /** … … 98 100 * @param pUuid New UUID of the image. Not NULL. 99 101 * @param uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants. 100 * @param pfnProgress Progress callback. Optional. NULL if not to be used.101 * @param pvUser User argument for the progress callback.102 102 * @param uPercentStart Starting value for progress percentage. 103 103 * @param uPercentSpan Span for varying progress percentage. 104 * @param pInterfaces Pointer to the supported interfaces of the caller. 104 * @param pVDIfsDisk Pointer to the per-disk VD interface list. 105 * @param pVDIfsImage Pointer to the per-image VD interface list. 106 * @param pVDIfsOperation Pointer to the per-operation VD interface list. 105 107 * @param ppvBackendData Opaque state data for this image. 106 108 */ 107 DECLR3CALLBACKMEMBER(int, pfnCreate, (const char *pszFilename, VDIMAGETYPE enmType, uint64_t cbSize, unsigned uImageFlags, const char *pszComment, PCPDMMEDIAGEOMETRY pPCHSGeometry, PCPDMMEDIAGEOMETRY pLCHSGeometry, PCRTUUID pUuid, unsigned uOpenFlags, PFNVMPROGRESS pfnProgress, void *pvUser, unsigned uPercentStart, unsigned uPercentSpan, PVDINTERFACE pInterfaces, void **ppvBackendData)); 109 DECLR3CALLBACKMEMBER(int, pfnCreate, (const char *pszFilename, VDIMAGETYPE enmType, 110 uint64_t cbSize, unsigned uImageFlags, 111 const char *pszComment, 112 PCPDMMEDIAGEOMETRY pPCHSGeometry, 113 PCPDMMEDIAGEOMETRY pLCHSGeometry, 114 PCRTUUID pUuid, unsigned uOpenFlags, 115 unsigned uPercentStart, unsigned uPercentSpan, 116 PVDINTERFACE pVDIfsDisk, 117 PVDINTERFACE pVDIfsImage, 118 PVDINTERFACE pVDIfsOperation, 119 void **ppvBackendData)); 108 120 109 121 /** … … 144 156 * @param pcbActuallyRead Pointer to returned number of bytes read. 145 157 */ 146 DECLR3CALLBACKMEMBER(int, pfnRead, (void *pvBackendData, uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbActuallyRead)); 158 DECLR3CALLBACKMEMBER(int, pfnRead, (void *pvBackendData, uint64_t off, void *pvBuf, 159 size_t cbRead, size_t *pcbActuallyRead)); 147 160 148 161 /** … … 174 187 * of the VD_WRITE_* flags. 175 188 */ 176 DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pvBackendData, uint64_t off, const void *pvBuf, size_t cbWrite, size_t *pcbWriteProcess, size_t *pcbPreRead, size_t *pcbPostRead, unsigned fWrite)); 189 DECLR3CALLBACKMEMBER(int, pfnWrite, (void *pvBackendData, uint64_t off, 190 const void *pvBuf, size_t cbWrite, 191 size_t *pcbWriteProcess, size_t *pcbPreRead, 192 size_t *pcbPostRead, unsigned fWrite)); 177 193 178 194 /** -
trunk/src/VBox/Devices/Storage/VDICore.h
r11435 r11444 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 /** Pointer to the per-disk VD interface list. */ 582 PVDINTERFACE pVDIfsDisk; 583 583 /** Error interface. */ 584 584 PVDINTERFACE pInterfaceError; -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r11435 r11444 347 347 Assert(VALID_PTR(pLCHSGeometry)); 348 348 349 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ERROR);349 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR); 350 350 if (pImage->pInterfaceError) 351 351 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); … … 533 533 pImage->uOpenFlags = uOpenFlags; 534 534 535 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ERROR);535 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR); 536 536 if (pImage->pInterfaceError) 537 537 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); … … 757 757 pImage->File = NIL_RTFILE; 758 758 pImage->paBlocks = NULL; 759 pImage->pInterfaceError = NULL; 760 pImage->pInterfaceErrorCallbacks = NULL; 761 pImage->pVDIfs = NULL; 759 pImage->pVDIfsDisk = NULL; 762 760 763 761 rc = vdiOpenImage(pImage, VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_READONLY); … … 771 769 /** @copydoc VBOXHDDBACKEND::pfnOpen */ 772 770 static int vdiOpen(const char *pszFilename, unsigned uOpenFlags, 773 PVDINTERFACE pVDIfs, void **ppBackendData) 774 { 775 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData)); 771 PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage, 772 void **ppBackendData) 773 { 774 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData)); 776 775 int rc; 777 776 PVDIIMAGEDESC pImage; … … 801 800 pImage->File = NIL_RTFILE; 802 801 pImage->paBlocks = NULL; 803 pImage->pInterfaceError = NULL; 804 pImage->pInterfaceErrorCallbacks = NULL; 805 pImage->pVDIfs = pVDIfs; 802 pImage->pVDIfsDisk = pVDIfsDisk; 806 803 807 804 rc = vdiOpenImage(pImage, uOpenFlags); … … 820 817 PCPDMMEDIAGEOMETRY pPCHSGeometry, 821 818 PCPDMMEDIAGEOMETRY pLCHSGeometry, PCRTUUID pUuid, 822 unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,823 void *pvUser, unsigned uPercentStart,824 unsigned uPercentSpan, PVDINTERFACE pVDIfs,819 unsigned uOpenFlags, unsigned uPercentStart, 820 unsigned uPercentSpan, PVDINTERFACE pVDIfsDisk, 821 PVDINTERFACE pVDIfsImage, PVDINTERFACE pVDIfsOperation, 825 822 void **ppBackendData) 826 823 { 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));824 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData)); 828 825 int rc; 829 826 PVDIIMAGEDESC pImage; 827 828 PFNVMPROGRESS pfnProgress = NULL; 829 void *pvUser = NULL; 830 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 831 VDINTERFACETYPE_PROGRESS); 832 PVDINTERFACEPROGRESS pCbProgress = NULL; 833 if (pIfProgress) 834 { 835 pCbProgress = VDGetInterfaceProgress(pIfProgress); 836 pfnProgress = pCbProgress->pfnProgress; 837 pvUser = pIfProgress->pvUser; 838 } 830 839 831 840 /* Check open flags. All valid flags are supported. */ … … 858 867 pImage->File = NIL_RTFILE; 859 868 pImage->paBlocks = NULL; 860 pImage->pInterfaceError = NULL; 861 pImage->pInterfaceErrorCallbacks = NULL; 862 pImage->pVDIfs = pVDIfs; 869 pImage->pVDIfsDisk = pVDIfsDisk; 863 870 864 871 rc = vdiCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment, -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r11435 r11444 359 359 PVMDKFILE pFile; 360 360 361 /** Pointer to list of VD interfaces. */362 PVDINTERFACE pVDIfs ;361 /** Pointer to the per-disk VD interface list. */ 362 PVDINTERFACE pVDIfsDisk; 363 363 364 364 /** Error interface. */ … … 2330 2330 2331 2331 /* Try to get error interface. */ 2332 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ERROR);2332 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR); 2333 2333 if (pImage->pInterfaceError) 2334 2334 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 2335 2335 2336 2336 /* Try to get async I/O interface. */ 2337 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ASYNCIO);2337 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ASYNCIO); 2338 2338 if (pImage->pInterfaceAsyncIO) 2339 2339 pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO); … … 3128 3128 3129 3129 /* Try to get error interface. */ 3130 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ERROR);3130 pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ERROR); 3131 3131 if (pImage->pInterfaceError) 3132 3132 pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError); 3133 3133 3134 3134 /* Try to get async I/O interface. */ 3135 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfs , VDINTERFACETYPE_ASYNCIO);3135 pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ASYNCIO); 3136 3136 if (pImage->pInterfaceAsyncIO) 3137 3137 pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO); … … 3700 3700 pImage->pGTCache = NULL; 3701 3701 pImage->pDescData = NULL; 3702 pImage->pInterfaceError = NULL; 3703 pImage->pInterfaceErrorCallbacks = NULL; 3704 pImage->pInterfaceAsyncIO = NULL; 3705 pImage->pInterfaceAsyncIOCallbacks = NULL; 3706 pImage->pVDIfs = NULL; 3702 pImage->pVDIfsDisk = NULL; 3707 3703 /** @todo speed up this test open (VD_OPEN_FLAGS_INFO) by skipping as 3708 3704 * much as possible in vmdkOpenImage. */ … … 3717 3713 /** @copydoc VBOXHDDBACKEND::pfnOpen */ 3718 3714 static int vmdkOpen(const char *pszFilename, unsigned uOpenFlags, 3719 PVDINTERFACE pVDIfs, void **ppBackendData) 3720 { 3721 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData)); 3715 PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage, 3716 void **ppBackendData) 3717 { 3718 LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData)); 3722 3719 int rc; 3723 3720 PVMDKIMAGE pImage; … … 3752 3749 pImage->pGTCache = NULL; 3753 3750 pImage->pDescData = NULL; 3754 pImage->pInterfaceError = NULL; 3755 pImage->pInterfaceErrorCallbacks = NULL; 3756 pImage->pInterfaceAsyncIO = NULL; 3757 pImage->pInterfaceAsyncIOCallbacks = NULL; 3758 pImage->pVDIfs = NULL; 3751 pImage->pVDIfsDisk = pVDIfsDisk; 3759 3752 3760 3753 rc = vmdkOpenImage(pImage, uOpenFlags); … … 3773 3766 PCPDMMEDIAGEOMETRY pPCHSGeometry, 3774 3767 PCPDMMEDIAGEOMETRY pLCHSGeometry, PCRTUUID pUuid, 3775 unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,3776 void *pvUser, unsigned uPercentStart,3777 unsigned uPercentSpan, PVDINTERFACE pVDIfs,3768 unsigned uOpenFlags, unsigned uPercentStart, 3769 unsigned uPercentSpan, PVDINTERFACE pVDIfsDisk, 3770 PVDINTERFACE pVDIfsImage, PVDINTERFACE pVDIfsOperation, 3778 3771 void **ppBackendData) 3779 3772 { 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));3773 LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData)); 3781 3774 int rc; 3782 3775 PVMDKIMAGE pImage; 3776 3777 PFNVMPROGRESS pfnProgress = NULL; 3778 void *pvUser = NULL; 3779 PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation, 3780 VDINTERFACETYPE_PROGRESS); 3781 PVDINTERFACEPROGRESS pCbProgress = NULL; 3782 if (pIfProgress) 3783 { 3784 pCbProgress = VDGetInterfaceProgress(pIfProgress); 3785 pfnProgress = pCbProgress->pfnProgress; 3786 pvUser = pIfProgress->pvUser; 3787 } 3783 3788 3784 3789 /* Check open flags. All valid flags are supported. */ … … 3817 3822 pImage->pGTCache = NULL; 3818 3823 pImage->pDescData = NULL; 3819 pImage->pInterfaceError = NULL; 3820 pImage->pInterfaceErrorCallbacks = NULL; 3821 pImage->pInterfaceAsyncIO = NULL; 3822 pImage->pInterfaceAsyncIOCallbacks = NULL; 3823 pImage->pVDIfs = NULL; 3824 pImage->pVDIfsDisk = NULL; 3824 3825 pImage->cbDescAlloc = VMDK_SECTOR2BYTE(20); 3825 3826 pImage->pDescData = (char *)RTMemAllocZ(pImage->cbDescAlloc); -
trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp
r11435 r11444 475 475 CHECK("VDGetFormat()"); 476 476 477 rc = VDOpen(pVD, pszBackend, pszBaseFilename, VD_OPEN_FLAGS_NORMAL); 477 rc = VDOpen(pVD, pszBackend, pszBaseFilename, VD_OPEN_FLAGS_NORMAL, 478 NULL); 478 479 CHECK("VDOpen()"); 479 480 } … … 520 521 521 522 RTPrintf("Merging diff into base..\n"); 522 rc = VDMerge(pVD, (unsigned)-1, 0, NULL, NULL);523 rc = VDMerge(pVD, VD_LAST_IMAGE, 0, NULL); 523 524 CHECK("VDMerge()"); 524 525 … … 610 611 VDCloseAll(pVD); 611 612 612 rc = VDOpen(pVD, pszBackend, pszFilename, VD_OPEN_FLAGS_NORMAL );613 rc = VDOpen(pVD, pszBackend, pszFilename, VD_OPEN_FLAGS_NORMAL, NULL); 613 614 CHECK("VDOpen()"); 614 615 rc = readAndCompareSegments(pVD, pvBuf, paSegments);
Note:
See TracChangeset
for help on using the changeset viewer.