- Timestamp:
- Jan 4, 2013 8:39:56 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83076
- Location:
- trunk/src/VBox/Storage
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/DMG.cpp
r44232 r44233 438 438 pInflateState->pImage->pStorage, 439 439 pInflateState->uFileOffset, 440 pvBuf, cbBuf , NULL);440 pvBuf, cbBuf); 441 441 if (RT_FAILURE(rc)) 442 442 return rc; … … 1394 1394 rc = vdIfIoIntFileReadSync(pThis->pIfIo, pThis->pStorage, 1395 1395 pThis->cbFile - sizeof(pThis->Ftr), 1396 &pThis->Ftr, sizeof(pThis->Ftr) , NULL);1396 &pThis->Ftr, sizeof(pThis->Ftr)); 1397 1397 if (RT_FAILURE(rc)) 1398 1398 return rc; … … 1425 1425 return VERR_NO_MEMORY; 1426 1426 rc = vdIfIoIntFileReadSync(pThis->pIfIo, pThis->pStorage, pThis->Ftr.offXml, 1427 pszXml, cchXml , NULL);1427 pszXml, cchXml); 1428 1428 if (RT_SUCCESS(rc)) 1429 1429 { … … 1515 1515 { 1516 1516 offFtr = cbFile - sizeof(Ftr); 1517 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offFtr, &Ftr, sizeof(Ftr) , NULL);1517 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offFtr, &Ftr, sizeof(Ftr)); 1518 1518 } 1519 1519 else … … 1694 1694 rc = vdIfIoIntFileReadSync(pThis->pIfIo, pThis->pStorage, 1695 1695 pExtent->offFileStart + DMG_BLOCK2BYTE(uExtentRel), 1696 pvBuf, cbToRead , NULL);1696 pvBuf, cbToRead); 1697 1697 break; 1698 1698 } -
trunk/src/VBox/Storage/Parallels.cpp
r44232 r44233 128 128 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 129 129 sizeof(ParallelsHeader), pImage->pAllocationBitmap, 130 pImage->cAllocationBitmapEntries * sizeof(uint32_t), 131 NULL); 130 pImage->cAllocationBitmapEntries * sizeof(uint32_t)); 132 131 if (RT_FAILURE(rc)) 133 132 return rc; … … 198 197 199 198 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, 200 ¶llelsHeader, sizeof(parallelsHeader) , NULL);199 ¶llelsHeader, sizeof(parallelsHeader)); 201 200 if (RT_FAILURE(rc)) 202 201 goto out; … … 248 247 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 249 248 sizeof(ParallelsHeader), pImage->pAllocationBitmap, 250 pImage->cAllocationBitmapEntries * sizeof(uint32_t), 251 NULL); 249 pImage->cAllocationBitmapEntries * sizeof(uint32_t)); 252 250 if (RT_FAILURE(rc)) 253 251 goto out; … … 342 340 if (RT_SUCCESS(rc)) 343 341 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, 344 &Header, sizeof(Header) , NULL);342 &Header, sizeof(Header)); 345 343 if (RT_SUCCESS(rc)) 346 344 rc = parallelsFlushImage(pImage); /* Writes the allocation bitmap. */ … … 375 373 376 374 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, ¶llelsHeader, 377 sizeof(ParallelsHeader) , NULL);375 sizeof(ParallelsHeader)); 378 376 if (RT_SUCCESS(rc)) 379 377 { … … 617 615 618 616 if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED) 619 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbToRead , NULL);617 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbToRead); 620 618 else 621 619 { … … 646 644 LogFlowFunc(("uOffsetInFile=%llu\n", uOffsetInFile)); 647 645 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffsetInFile, 648 pvBuf, cbToRead , NULL);646 pvBuf, cbToRead); 649 647 } 650 648 } … … 675 673 if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED) 676 674 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, 677 pvBuf, cbToWrite , NULL);675 pvBuf, cbToWrite); 678 676 else 679 677 { … … 720 718 */ 721 719 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 722 uOffsetInFile, pvBuf, cbToWrite , NULL);720 uOffsetInFile, pvBuf, cbToWrite); 723 721 } 724 722 else … … 737 735 LogFlowFunc(("uOffsetInFile=%llu\n", uOffsetInFile)); 738 736 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffsetInFile, 739 pvBuf, cbToWrite , NULL);737 pvBuf, cbToWrite); 740 738 } 741 739 } … … 1220 1218 1221 1219 if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED) 1222 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, uOffset,1223 1220 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset, 1221 pIoCtx, cbToRead); 1224 1222 else 1225 1223 { … … 1239 1237 { 1240 1238 uOffsetInFile = (pImage->pAllocationBitmap[iIndexInAllocationTable] + uSector) * 512; 1241 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, uOffsetInFile,1242 1239 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffsetInFile, 1240 pIoCtx, cbToRead); 1243 1241 } 1244 1242 } … … 1269 1267 1270 1268 if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED) 1271 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage, uOffset,1272 1269 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, uOffset, 1270 pIoCtx, cbToWrite, NULL, NULL); 1273 1271 else 1274 1272 { … … 1304 1302 * Write the new block at the current end of the file. 1305 1303 */ 1306 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,1307 1304 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 1305 uOffsetInFile, pIoCtx, cbToWrite, NULL, NULL); 1308 1306 if (RT_SUCCESS(rc) || (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)) 1309 1307 { 1310 1308 /* Write the changed allocation bitmap entry. */ 1311 1309 /** @todo: Error handling. */ 1312 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1313 1314 1315 1316 1310 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1311 sizeof(ParallelsHeader) + iIndexInAllocationTable * sizeof(uint32_t), 1312 &pImage->pAllocationBitmap[iIndexInAllocationTable], 1313 sizeof(uint32_t), pIoCtx, 1314 NULL, NULL); 1317 1315 } 1318 1316 … … 1323 1321 { 1324 1322 uOffsetInFile = (pImage->pAllocationBitmap[iIndexInAllocationTable] + uSector) * 512; 1325 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,1326 1323 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 1324 uOffsetInFile, pIoCtx, cbToWrite, NULL, NULL); 1327 1325 } 1328 1326 } … … 1344 1342 1345 1343 /* Flush the file, everything is up to date already. */ 1346 rc = vdIfIoIntFileFlush Async(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL);1344 rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL); 1347 1345 1348 1346 LogFlowFunc(("returns %Rrc\n", rc)); -
trunk/src/VBox/Storage/QCOW.cpp
r44232 r44233 705 705 pL2Entry->offL2Tbl = offL2Tbl; 706 706 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offL2Tbl, 707 pL2Entry->paL2Tbl, pImage->cbL2Table , NULL);707 pL2Entry->paL2Tbl, pImage->cbL2Table); 708 708 if (RT_SUCCESS(rc)) 709 709 { … … 757 757 758 758 pL2Entry->offL2Tbl = offL2Tbl; 759 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pImage->pStorage,760 761 762 759 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, 760 offL2Tbl, pL2Entry->paL2Tbl, 761 pImage->cbL2Table, pIoCtx, 762 &pMetaXfer, NULL, NULL); 763 763 if (RT_SUCCESS(rc)) 764 764 { … … 1018 1018 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1019 1019 pImage->offL1Table, paL1TblImg, 1020 pImage->cbL1Table , NULL);1020 pImage->cbL1Table); 1021 1021 RTMemFree(paL1TblImg); 1022 1022 } … … 1026 1026 /* Write L1 table directly. */ 1027 1027 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offL1Table, 1028 pImage->paL1Table, pImage->cbL1Table , NULL);1028 pImage->paL1Table, pImage->cbL1Table); 1029 1029 #endif 1030 1030 if (RT_SUCCESS(rc)) … … 1034 1034 qcowHdrConvertFromHostEndianess(pImage, &Header, &cbHeader); 1035 1035 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, &Header, 1036 cbHeader , NULL);1036 cbHeader); 1037 1037 if (RT_SUCCESS(rc)) 1038 1038 rc = vdIfIoIntFileFlushSync(pImage->pIfIo, pImage->pStorage); … … 1065 1065 qcowTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table, 1066 1066 pImage->cL1TableEntries); 1067 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1068 1069 1067 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1068 pImage->offL1Table, paL1TblImg, 1069 pImage->cbL1Table, pIoCtx, NULL, NULL); 1070 1070 RTMemFree(paL1TblImg); 1071 1071 } … … 1074 1074 #else 1075 1075 /* Write L1 table directly. */ 1076 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1077 1078 1076 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1077 pImage->offL1Table, pImage->paL1Table, 1078 pImage->cbL1Table, pIoCtx, NULL, NULL); 1079 1079 #endif 1080 1080 if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS) … … 1083 1083 size_t cbHeader = 0; 1084 1084 qcowHdrConvertFromHostEndianess(pImage, &Header, &cbHeader); 1085 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1086 1087 1085 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1086 0, &Header, cbHeader, 1087 pIoCtx, NULL, NULL); 1088 1088 if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1089 rc = vdIfIoIntFileFlush Async(pImage->pIfIo, pImage->pStorage,1090 1089 rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, 1090 pIoCtx, NULL, NULL); 1091 1091 } 1092 1092 } … … 1167 1167 if (cbFile > sizeof(Header)) 1168 1168 { 1169 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header) , NULL);1169 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header)); 1170 1170 if ( RT_SUCCESS(rc) 1171 1171 && qcowHdrConvertToHostEndianess(&Header)) … … 1247 1247 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1248 1248 pImage->offBackingFilename, pImage->pszBackingFilename, 1249 pImage->cbBackingFilename , NULL);1249 pImage->cbBackingFilename); 1250 1250 } 1251 1251 else … … 1264 1264 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1265 1265 pImage->offRefcountTable, pImage->paRefcountTable, 1266 pImage->cbRefcountTable , NULL);1266 pImage->cbRefcountTable); 1267 1267 if (RT_SUCCESS(rc)) 1268 1268 qcowTableConvertToHostEndianess(pImage->paRefcountTable, … … 1290 1290 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1291 1291 pImage->offL1Table, pImage->paL1Table, 1292 pImage->cbL1Table , NULL);1292 pImage->cbL1Table); 1293 1293 if (RT_SUCCESS(rc)) 1294 1294 qcowTableConvertToHostEndianess(pImage->paL1Table, pImage->cL1TableEntries); … … 1469 1469 /* Update the link in the on disk L1 table now. */ 1470 1470 pClusterAlloc->enmAllocState = QCOWCLUSTERASYNCALLOCSTATE_L2_LINK; 1471 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1472 1473 1474 1471 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1472 pImage->offL1Table + pClusterAlloc->idxL1*sizeof(uint64_t), 1473 &offUpdateLe, sizeof(uint64_t), pIoCtx, 1474 qcowAsyncClusterAllocUpdate, pClusterAlloc); 1475 1475 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1476 1476 break; … … 1497 1497 1498 1498 /* Write data. */ 1499 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,1500 1501 1499 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 1500 offData, pIoCtx, pClusterAlloc->cbToWrite, 1501 qcowAsyncClusterAllocUpdate, pClusterAlloc); 1502 1502 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1503 1503 break; … … 1516 1516 1517 1517 /* Link L2 table and update it. */ 1518 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1519 1520 1521 1518 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1519 pImage->paL1Table[pClusterAlloc->idxL1] + pClusterAlloc->idxL2*sizeof(uint64_t), 1520 &offUpdateLe, sizeof(uint64_t), pIoCtx, 1521 qcowAsyncClusterAllocUpdate, pClusterAlloc); 1522 1522 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1523 1523 break; … … 1581 1581 QCowHeader Header; 1582 1582 1583 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header) , NULL);1583 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header)); 1584 1584 if ( RT_SUCCESS(rc) 1585 1585 && qcowHdrConvertToHostEndianess(&Header)) … … 1823 1823 LogFlowFunc(("offFile=%llu\n", offFile)); 1824 1824 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offFile, 1825 pvBuf, cbToRead , NULL);1825 pvBuf, cbToRead); 1826 1826 } 1827 1827 … … 1877 1877 if (RT_SUCCESS(rc)) 1878 1878 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offImage, 1879 pvBuf, cbToWrite , NULL);1879 pvBuf, cbToWrite); 1880 1880 else if (rc == VERR_VD_BLOCK_FREE) 1881 1881 { … … 1915 1915 */ 1916 1916 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offL2Tbl, 1917 pL2Entry->paL2Tbl, pImage->cbL2Table , NULL);1917 pL2Entry->paL2Tbl, pImage->cbL2Table); 1918 1918 if (RT_FAILURE(rc)) 1919 1919 break; … … 1924 1924 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1925 1925 pImage->offL1Table + idxL1*sizeof(uint64_t), 1926 &idxUpdateLe, sizeof(uint64_t) , NULL);1926 &idxUpdateLe, sizeof(uint64_t)); 1927 1927 if (RT_FAILURE(rc)) 1928 1928 break; … … 1938 1938 /* Write data. */ 1939 1939 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1940 offData, pvBuf, cbToWrite , NULL);1940 offData, pvBuf, cbToWrite); 1941 1941 if (RT_FAILURE(rc)) 1942 1942 break; … … 1947 1947 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1948 1948 pImage->paL1Table[idxL1] + idxL2*sizeof(uint64_t), 1949 &idxUpdateLe, sizeof(uint64_t) , NULL);1949 &idxUpdateLe, sizeof(uint64_t)); 1950 1950 qcowL2TblCacheEntryRelease(pL2Entry); 1951 1951 } … … 2493 2493 pImage->offBackingFilename, 2494 2494 pImage->pszBackingFilename, 2495 strlen(pImage->pszBackingFilename), 2496 NULL); 2495 strlen(pImage->pszBackingFilename)); 2497 2496 } 2498 2497 } … … 2543 2542 &offFile); 2544 2543 if (RT_SUCCESS(rc)) 2545 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, offFile,2546 2544 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, offFile, 2545 pIoCtx, cbToRead); 2547 2546 2548 2547 if ( ( RT_SUCCESS(rc) … … 2605 2604 &offImage); 2606 2605 if (RT_SUCCESS(rc)) 2607 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2608 2606 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2607 offImage, pIoCtx, cbToWrite, NULL, NULL); 2609 2608 else if (rc == VERR_VD_BLOCK_FREE) 2610 2609 { … … 2661 2660 * is a leak of some clusters. 2662 2661 */ 2663 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,2664 2665 2662 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 2663 offL2Tbl, pL2Entry->paL2Tbl, pImage->cbL2Table, pIoCtx, 2664 qcowAsyncClusterAllocUpdate, pL2ClusterAlloc); 2666 2665 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 2667 2666 break; … … 2704 2703 2705 2704 /* Write data. */ 2706 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2707 2708 2705 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2706 offData, pIoCtx, cbToWrite, 2707 qcowAsyncClusterAllocUpdate, pDataClusterAlloc); 2709 2708 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 2710 2709 break; -
trunk/src/VBox/Storage/QED.cpp
r44232 r44233 581 581 pL2Entry->offL2Tbl = offL2Tbl; 582 582 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offL2Tbl, 583 pL2Entry->paL2Tbl, pImage->cbTable , NULL);583 pL2Entry->paL2Tbl, pImage->cbTable); 584 584 if (RT_SUCCESS(rc)) 585 585 { … … 633 633 634 634 pL2Entry->offL2Tbl = offL2Tbl; 635 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pImage->pStorage,636 637 638 635 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, 636 offL2Tbl, pL2Entry->paL2Tbl, 637 pImage->cbTable, pIoCtx, 638 &pMetaXfer, NULL, NULL); 639 639 if (RT_SUCCESS(rc)) 640 640 { … … 882 882 /* Write L1 table directly. */ 883 883 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offL1Table, 884 pImage->paL1Table, pImage->cbTable , NULL);884 pImage->paL1Table, pImage->cbTable); 885 885 #endif 886 886 if (RT_SUCCESS(rc)) … … 889 889 qedHdrConvertFromHostEndianess(pImage, &Header); 890 890 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, &Header, 891 sizeof(Header) , NULL);891 sizeof(Header)); 892 892 if (RT_SUCCESS(rc)) 893 893 rc = vdIfIoIntFileFlushSync(pImage->pIfIo, pImage->pStorage); … … 921 921 qedTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table, 922 922 pImage->cTableEntries); 923 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,924 925 923 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 924 pImage->offL1Table, paL1TblImg, 925 pImage->cbTable, pIoCtx, NULL, NULL); 926 926 RTMemFree(paL1TblImg); 927 927 } … … 930 930 #else 931 931 /* Write L1 table directly. */ 932 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,933 934 932 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 933 pImage->offL1Table, pImage->paL1Table, 934 pImage->cbTable, pIoCtx, NULL, NULL); 935 935 #endif 936 936 if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS) … … 938 938 /* Write header. */ 939 939 qedHdrConvertFromHostEndianess(pImage, &Header); 940 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,941 942 940 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 941 0, &Header, sizeof(Header), 942 pIoCtx, NULL, NULL); 943 943 if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 944 rc = vdIfIoIntFileFlush Async(pImage->pIfIo, pImage->pStorage,945 944 rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, 945 pIoCtx, NULL, NULL); 946 946 } 947 947 } … … 1077 1077 /* Read L1 table. */ 1078 1078 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1079 pHeader->u64OffL1Table, paL1Tbl, cbTable , NULL);1079 pHeader->u64OffL1Table, paL1Tbl, cbTable); 1080 1080 if (RT_FAILURE(rc)) 1081 1081 { … … 1121 1121 /* Read the linked L2 table and check it. */ 1122 1122 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1123 paL1Tbl[iL1], paL2Tbl, cbTable , NULL);1123 paL1Tbl[iL1], paL2Tbl, cbTable); 1124 1124 if (RT_FAILURE(rc)) 1125 1125 { … … 1240 1240 if (cbFile > sizeof(Header)) 1241 1241 { 1242 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header) , NULL);1242 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header)); 1243 1243 if ( RT_SUCCESS(rc) 1244 1244 && qedHdrConvertToHostEndianess(&Header)) … … 1269 1269 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1270 1270 Header.u32OffBackingFilename, pImage->pszBackingFilename, 1271 Header.u32BackingFilenameSize , NULL);1271 Header.u32BackingFilenameSize); 1272 1272 } 1273 1273 else … … 1292 1292 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1293 1293 pImage->offL1Table, pImage->paL1Table, 1294 pImage->cbTable , NULL);1294 pImage->cbTable); 1295 1295 if (RT_SUCCESS(rc)) 1296 1296 { … … 1483 1483 /* Update the link in the on disk L1 table now. */ 1484 1484 pClusterAlloc->enmAllocState = QEDCLUSTERASYNCALLOCSTATE_L2_LINK; 1485 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1486 1487 1488 1485 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1486 pImage->offL1Table + pClusterAlloc->idxL1*sizeof(uint64_t), 1487 &offUpdateLe, sizeof(uint64_t), pIoCtx, 1488 qedAsyncClusterAllocUpdate, pClusterAlloc); 1489 1489 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1490 1490 break; … … 1511 1511 1512 1512 /* Write data. */ 1513 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,1514 1515 1513 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 1514 offData, pIoCtx, pClusterAlloc->cbToWrite, 1515 qedAsyncClusterAllocUpdate, pClusterAlloc); 1516 1516 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1517 1517 break; … … 1530 1530 1531 1531 /* Link L2 table and update it. */ 1532 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1533 1534 1535 1532 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1533 pImage->paL1Table[pClusterAlloc->idxL1] + pClusterAlloc->idxL2*sizeof(uint64_t), 1534 &offUpdateLe, sizeof(uint64_t), pIoCtx, 1535 qedAsyncClusterAllocUpdate, pClusterAlloc); 1536 1536 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1537 1537 break; … … 1595 1595 QedHeader Header; 1596 1596 1597 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header) , NULL);1597 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header)); 1598 1598 if ( RT_SUCCESS(rc) 1599 1599 && qedHdrConvertToHostEndianess(&Header)) … … 1837 1837 LogFlowFunc(("offFile=%llu\n", offFile)); 1838 1838 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offFile, 1839 pvBuf, cbToRead , NULL);1839 pvBuf, cbToRead); 1840 1840 } 1841 1841 … … 1891 1891 if (RT_SUCCESS(rc)) 1892 1892 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offImage, 1893 pvBuf, cbToWrite , NULL);1893 pvBuf, cbToWrite); 1894 1894 else if (rc == VERR_VD_BLOCK_FREE) 1895 1895 { … … 1929 1929 */ 1930 1930 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offL2Tbl, 1931 pL2Entry->paL2Tbl, pImage->cbTable , NULL);1931 pL2Entry->paL2Tbl, pImage->cbTable); 1932 1932 if (RT_FAILURE(rc)) 1933 1933 break; … … 1938 1938 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1939 1939 pImage->offL1Table + idxL1*sizeof(uint64_t), 1940 &idxUpdateLe, sizeof(uint64_t) , NULL);1940 &idxUpdateLe, sizeof(uint64_t)); 1941 1941 if (RT_FAILURE(rc)) 1942 1942 break; … … 1952 1952 /* Write data. */ 1953 1953 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1954 offData, pvBuf, cbToWrite , NULL);1954 offData, pvBuf, cbToWrite); 1955 1955 if (RT_FAILURE(rc)) 1956 1956 break; … … 1961 1961 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1962 1962 pImage->paL1Table[idxL1] + idxL2*sizeof(uint64_t), 1963 &idxUpdateLe, sizeof(uint64_t) , NULL);1963 &idxUpdateLe, sizeof(uint64_t)); 1964 1964 qedL2TblCacheEntryRelease(pL2Entry); 1965 1965 } … … 2507 2507 pImage->offBackingFilename, 2508 2508 pImage->pszBackingFilename, 2509 strlen(pImage->pszBackingFilename), 2510 NULL); 2509 strlen(pImage->pszBackingFilename)); 2511 2510 } 2512 2511 } … … 2557 2556 &offFile); 2558 2557 if (RT_SUCCESS(rc)) 2559 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, offFile,2560 2558 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, offFile, 2559 pIoCtx, cbToRead); 2561 2560 2562 2561 if ( ( RT_SUCCESS(rc) … … 2619 2618 &offImage); 2620 2619 if (RT_SUCCESS(rc)) 2621 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2622 2620 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2621 offImage, pIoCtx, cbToWrite, NULL, NULL); 2623 2622 else if (rc == VERR_VD_BLOCK_FREE) 2624 2623 { … … 2675 2674 * is a leak of some clusters. 2676 2675 */ 2677 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,2678 2679 2676 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 2677 offL2Tbl, pL2Entry->paL2Tbl, pImage->cbTable, pIoCtx, 2678 qedAsyncClusterAllocUpdate, pL2ClusterAlloc); 2680 2679 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 2681 2680 break; … … 2718 2717 2719 2718 /* Write data. */ 2720 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2721 2722 2719 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2720 offData, pIoCtx, cbToWrite, 2721 qedAsyncClusterAllocUpdate, pDataClusterAlloc); 2723 2722 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 2724 2723 break; -
trunk/src/VBox/Storage/RAW.cpp
r44232 r44233 147 147 148 148 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 149 uOff, pvBuf, cbChunk , NULL);149 uOff, pvBuf, cbChunk); 150 150 if (RT_FAILURE(rc)) 151 151 goto out; … … 300 300 301 301 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOff, 302 pvBuf, cbChunk , NULL);302 pvBuf, cbChunk); 303 303 if (RT_FAILURE(rc)) 304 304 { … … 629 629 630 630 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, 631 cbToRead , NULL);631 cbToRead); 632 632 pImage->offAccess = uOffset + cbToRead; 633 633 if (pcbActuallyRead) … … 674 674 675 675 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, 676 cbToWrite , NULL);676 cbToWrite); 677 677 pImage->offAccess = uOffset + cbToWrite; 678 678 if (pcbWriteProcess) … … 1154 1154 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; 1155 1155 1156 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, uOffset,1157 1156 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset, 1157 pIoCtx, cbRead); 1158 1158 if (RT_SUCCESS(rc)) 1159 1159 *pcbActuallyRead = cbRead; … … 1171 1171 PRAWIMAGE pImage = (PRAWIMAGE)pBackendData; 1172 1172 1173 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage, uOffset,1174 1173 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, uOffset, 1174 pIoCtx, cbWrite, NULL, NULL); 1175 1175 if (RT_SUCCESS(rc)) 1176 1176 { … … 1190 1190 1191 1191 if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)) 1192 rc = vdIfIoIntFileFlush Async(pImage->pIfIo, pImage->pStorage, pIoCtx,1193 1192 rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx, 1193 NULL, NULL); 1194 1194 1195 1195 return rc; -
trunk/src/VBox/Storage/VCICache.cpp
r40843 r44233 536 536 537 537 rc = vdIfIoIntFileReadSync(pStorage->pIfIo, pStorage->pStorage, offBlkMap, 538 &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap)) , NULL);538 &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap))); 539 539 if (RT_SUCCESS(rc)) 540 540 { … … 575 575 rc = vdIfIoIntFileReadSync(pStorage->pIfIo, pStorage->pStorage, 576 576 offBlkMap, abBitmapBuffer, 577 cBlocksRead , NULL);577 cBlocksRead); 578 578 579 579 if (RT_SUCCESS(rc)) … … 648 648 cBlocksRead = RT_MIN(VCI_BYTE2BLOCK(sizeof(abBitmapBuffer)), cBlocksLeft); 649 649 rc = vdIfIoIntFileReadSync(pStorage->pIfIo, pStorage->pStorage, 650 offBlkMap, abBitmapBuffer, cBlocksRead , NULL);650 offBlkMap, abBitmapBuffer, cBlocksRead); 651 651 } 652 652 } … … 712 712 713 713 rc = vdIfIoIntFileWriteSync(pStorage->pIfIo, pStorage->pStorage, offBlkMap, 714 &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap)) , NULL);714 &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap))); 715 715 if (RT_SUCCESS(rc)) 716 716 { … … 743 743 rc = vdIfIoIntFileWriteSync(pStorage->pIfIo, pStorage->pStorage, 744 744 offBlkMap, abBitmapBuffer, 745 VCI_BYTE2BLOCK(sizeof(abBitmapBuffer)) , NULL);745 VCI_BYTE2BLOCK(sizeof(abBitmapBuffer))); 746 746 if (RT_FAILURE(rc)) 747 747 break; … … 759 759 if (RT_SUCCESS(rc) && iBit) 760 760 rc = vdIfIoIntFileWriteSync(pStorage->pIfIo, pStorage->pStorage, 761 offBlkMap, abBitmapBuffer, VCI_BYTE2BLOCK(iBit / 8) , NULL);761 offBlkMap, abBitmapBuffer, VCI_BYTE2BLOCK(iBit / 8)); 762 762 } 763 763 } … … 1110 1110 rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage, 1111 1111 VCI_BLOCK2BYTE(pInt->PtrChild.u.offAddrBlockNode), 1112 &NodeTree, sizeof(NodeTree) , NULL);1112 &NodeTree, sizeof(NodeTree)); 1113 1113 AssertRC(rc); 1114 1114 … … 1229 1229 1230 1230 rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage, 0, &Hdr, 1231 VCI_BYTE2BLOCK(sizeof(Hdr)) , NULL);1231 VCI_BYTE2BLOCK(sizeof(Hdr))); 1232 1232 if (RT_FAILURE(rc)) 1233 1233 { … … 1259 1259 rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage, 1260 1260 pCache->offTreeRoot, &RootNode, 1261 VCI_BYTE2BLOCK(sizeof(VciTreeNode)) , NULL);1261 VCI_BYTE2BLOCK(sizeof(VciTreeNode))); 1262 1262 if (RT_SUCCESS(rc)) 1263 1263 { … … 1394 1394 1395 1395 rc = vdIfIoIntFileWriteSync(pCache->pIfIo, pCache->pStorage, offHdr, &Hdr, 1396 VCI_BYTE2BLOCK(sizeof(VciHdr)) , NULL);1396 VCI_BYTE2BLOCK(sizeof(VciHdr))); 1397 1397 if (RT_FAILURE(rc)) 1398 1398 { … … 1413 1413 1414 1414 rc = vdIfIoIntFileWriteSync(pCache->pIfIo, pCache->pStorage, offTreeRoot, 1415 &NodeRoot, VCI_BYTE2BLOCK(sizeof(VciTreeNode)) , NULL);1415 &NodeRoot, VCI_BYTE2BLOCK(sizeof(VciTreeNode))); 1416 1416 if (RT_FAILURE(rc)) 1417 1417 { … … 1467 1467 } 1468 1468 1469 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Hdr, sizeof(Hdr) , NULL);1469 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Hdr, sizeof(Hdr)); 1470 1470 if (RT_FAILURE(rc)) 1471 1471 { … … 1654 1654 rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage, 1655 1655 pExtent->u64BlockAddr + offRead, 1656 pvBuf, cBlocksToRead , NULL);1656 pvBuf, cBlocksToRead); 1657 1657 } 1658 1658 else -
trunk/src/VBox/Storage/VD.cpp
r44232 r44233 4128 4128 } 4129 4129 4130 static int vdIOIntWriteSync(void *pvUser, PVDIOSTORAGE pIoStorage, 4131 uint64_t uOffset, const void *pvBuf, 4132 size_t cbWrite, size_t *pcbWritten) 4133 { 4134 PVDIO pVDIo = (PVDIO)pvUser; 4135 return pVDIo->pInterfaceIo->pfnWriteSync(pVDIo->pInterfaceIo->Core.pvUser, 4136 pIoStorage->pStorage, uOffset, 4137 pvBuf, cbWrite, pcbWritten); 4138 } 4139 4140 static int vdIOIntReadSync(void *pvUser, PVDIOSTORAGE pIoStorage, 4141 uint64_t uOffset, void *pvBuf, size_t cbRead, 4142 size_t *pcbRead) 4143 { 4144 PVDIO pVDIo = (PVDIO)pvUser; 4145 return pVDIo->pInterfaceIo->pfnReadSync(pVDIo->pInterfaceIo->Core.pvUser, 4146 pIoStorage->pStorage, uOffset, 4147 pvBuf, cbRead, pcbRead); 4148 } 4149 4150 static int vdIOIntFlushSync(void *pvUser, PVDIOSTORAGE pIoStorage) 4151 { 4152 int rc = VINF_SUCCESS; 4153 PVDIO pVDIo = (PVDIO)pvUser; 4154 4155 if (!pVDIo->fIgnoreFlush) 4156 rc = pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser, 4157 pIoStorage->pStorage); 4158 4159 return rc; 4160 } 4161 4162 static int vdIOIntReadUserAsync(void *pvUser, PVDIOSTORAGE pIoStorage, 4163 uint64_t uOffset, PVDIOCTX pIoCtx, 4164 size_t cbRead) 4130 static int vdIOIntReadUser(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset, 4131 PVDIOCTX pIoCtx, size_t cbRead) 4165 4132 { 4166 4133 int rc = VINF_SUCCESS; … … 4172 4139 4173 4140 VD_THREAD_IS_CRITSECT_OWNER(pDisk); 4141 4142 /** @todo: Handle synchronous I/O contexts. */ 4174 4143 4175 4144 Assert(cbRead > 0); … … 4230 4199 } 4231 4200 4232 static int vdIOIntWriteUserAsync(void *pvUser, PVDIOSTORAGE pIoStorage, 4233 uint64_t uOffset, PVDIOCTX pIoCtx, 4234 size_t cbWrite, 4235 PFNVDXFERCOMPLETED pfnComplete, 4236 void *pvCompleteUser) 4201 static int vdIOIntWriteUser(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset, 4202 PVDIOCTX pIoCtx, size_t cbWrite, PFNVDXFERCOMPLETED pfnComplete, 4203 void *pvCompleteUser) 4237 4204 { 4238 4205 int rc = VINF_SUCCESS; … … 4244 4211 4245 4212 VD_THREAD_IS_CRITSECT_OWNER(pDisk); 4213 4214 /** @todo: Handle synchronous I/O contexts. */ 4246 4215 4247 4216 Assert(cbWrite > 0); … … 4301 4270 } 4302 4271 4303 static int vdIOIntReadMetaAsync(void *pvUser, PVDIOSTORAGE pIoStorage, 4304 uint64_t uOffset, void *pvBuf, 4305 size_t cbRead, PVDIOCTX pIoCtx, 4306 PPVDMETAXFER ppMetaXfer, 4307 PFNVDXFERCOMPLETED pfnComplete, 4308 void *pvCompleteUser) 4272 static int vdIOIntReadMeta(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset, 4273 void *pvBuf, size_t cbRead, PVDIOCTX pIoCtx, 4274 PPVDMETAXFER ppMetaXfer, PFNVDXFERCOMPLETED pfnComplete, 4275 void *pvCompleteUser) 4309 4276 { 4310 4277 PVDIO pVDIo = (PVDIO)pvUser; … … 4319 4286 pvUser, pIoStorage, uOffset, pvBuf, cbRead)); 4320 4287 4288 AssertMsgReturn( pIoCtx 4289 || (!ppMetaXfer && !pfnComplete && !pvCompleteUser), 4290 ("A synchronous metadata read is requested but the parameters are wrong\n"), 4291 VERR_INVALID_POINTER); 4292 4293 if (!pIoCtx) 4294 { 4295 /* Handle synchronous metadata I/O. */ 4296 /** @todo: Integrate with metadata transfers below. */ 4297 return pVDIo->pInterfaceIo->pfnReadSync(pVDIo->pInterfaceIo->Core.pvUser, 4298 pIoStorage->pStorage, uOffset, 4299 pvBuf, cbRead, NULL); 4300 } 4301 4321 4302 VD_THREAD_IS_CRITSECT_OWNER(pDisk); 4322 4303 … … 4399 4380 } 4400 4381 4401 static int vdIOIntWriteMetaAsync(void *pvUser, PVDIOSTORAGE pIoStorage, 4402 uint64_t uOffset, void *pvBuf, 4403 size_t cbWrite, PVDIOCTX pIoCtx, 4404 PFNVDXFERCOMPLETED pfnComplete, 4405 void *pvCompleteUser) 4382 static int vdIOIntWriteMeta(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset, 4383 const void *pvBuf, size_t cbWrite, PVDIOCTX pIoCtx, 4384 PFNVDXFERCOMPLETED pfnComplete, void *pvCompleteUser) 4406 4385 { 4407 4386 PVDIO pVDIo = (PVDIO)pvUser; … … 4417 4396 pvUser, pIoStorage, uOffset, pvBuf, cbWrite)); 4418 4397 4398 AssertMsgReturn( pIoCtx 4399 || (!pfnComplete && !pvCompleteUser), 4400 ("A synchronous metadata write is requested but the parameters are wrong\n"), 4401 VERR_INVALID_POINTER); 4402 4403 if (!pIoCtx) 4404 { 4405 /* Handle synchronous metadata I/O. */ 4406 /** @todo: Integrate with metadata transfers below. */ 4407 return pVDIo->pInterfaceIo->pfnWriteSync(pVDIo->pInterfaceIo->Core.pvUser, 4408 pIoStorage->pStorage, uOffset, 4409 pvBuf, cbWrite, NULL); 4410 } 4411 4419 4412 VD_THREAD_IS_CRITSECT_OWNER(pDisk); 4420 4413 … … 4519 4512 } 4520 4513 4521 static int vdIOIntFlushAsync(void *pvUser, PVDIOSTORAGE pIoStorage, 4522 PVDIOCTX pIoCtx, PFNVDXFERCOMPLETED pfnComplete, 4523 void *pvCompleteUser) 4514 static int vdIOIntFlush(void *pvUser, PVDIOSTORAGE pIoStorage, PVDIOCTX pIoCtx, 4515 PFNVDXFERCOMPLETED pfnComplete, void *pvCompleteUser) 4524 4516 { 4525 4517 PVDIO pVDIo = (PVDIO)pvUser; … … 4530 4522 void *pvTask = NULL; 4531 4523 4532 VD_THREAD_IS_CRITSECT_OWNER(pDisk);4533 4534 4524 LogFlowFunc(("pvUser=%#p pIoStorage=%#p pIoCtx=%#p\n", 4535 4525 pvUser, pIoStorage, pIoCtx)); 4526 4527 AssertMsgReturn( pIoCtx 4528 || (!pfnComplete && !pvCompleteUser), 4529 ("A synchronous metadata write is requested but the parameters are wrong\n"), 4530 VERR_INVALID_POINTER); 4531 4532 if (!pIoCtx) 4533 { 4534 /* Handle synchronous flushes. */ 4535 /** @todo: Integrate with metadata transfers below. */ 4536 return pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser, 4537 pIoStorage->pStorage); 4538 } 4539 4540 VD_THREAD_IS_CRITSECT_OWNER(pDisk); 4536 4541 4537 4542 if (pVDIo->fIgnoreFlush) … … 4749 4754 } 4750 4755 4751 static int vdIOIntWriteSyncLimited(void *pvUser, PVDIOSTORAGE pIoStorage, 4752 uint64_t uOffset, const void *pvBuf, 4753 size_t cbWrite, size_t *pcbWritten) 4756 static int vdIOIntWriteUserLimited(void *pvUser, PVDIOSTORAGE pStorage, 4757 uint64_t uOffset, PVDIOCTX pIoCtx, 4758 size_t cbWrite, 4759 PFNVDXFERCOMPLETED pfnComplete, 4760 void *pvCompleteUser) 4761 { 4762 NOREF(pvUser); 4763 NOREF(pStorage); 4764 NOREF(uOffset); 4765 NOREF(pIoCtx); 4766 NOREF(cbWrite); 4767 NOREF(pfnComplete); 4768 NOREF(pvCompleteUser); 4769 AssertMsgFailedReturn(("This needs to be implemented when called\n"), VERR_NOT_IMPLEMENTED); 4770 } 4771 4772 static int vdIOIntReadUserLimited(void *pvUser, PVDIOSTORAGE pStorage, 4773 uint64_t uOffset, PVDIOCTX pIoCtx, 4774 size_t cbRead) 4775 { 4776 NOREF(pvUser); 4777 NOREF(pStorage); 4778 NOREF(uOffset); 4779 NOREF(pIoCtx); 4780 NOREF(cbRead); 4781 AssertMsgFailedReturn(("This needs to be implemented when called\n"), VERR_NOT_IMPLEMENTED); 4782 } 4783 4784 static int vdIOIntWriteMetaLimited(void *pvUser, PVDIOSTORAGE pStorage, 4785 uint64_t uOffset, const void *pvBuffer, 4786 size_t cbBuffer, PVDIOCTX pIoCtx, 4787 PFNVDXFERCOMPLETED pfnComplete, 4788 void *pvCompleteUser) 4754 4789 { 4755 4790 PVDINTERFACEIO pInterfaceIo = (PVDINTERFACEIO)pvUser; 4756 return pInterfaceIo->pfnWriteSync(NULL, pIoStorage->pStorage, uOffset, pvBuf, cbWrite, pcbWritten); 4757 } 4758 4759 static int vdIOIntReadSyncLimited(void *pvUser, PVDIOSTORAGE pIoStorage, 4760 uint64_t uOffset, void *pvBuf, size_t cbRead, 4761 size_t *pcbRead) 4791 4792 AssertMsgReturn(!pIoCtx && !pfnComplete && !pvCompleteUser, 4793 ("Async I/O not implemented for the limited interface"), 4794 VERR_NOT_SUPPORTED); 4795 4796 return pInterfaceIo->pfnWriteSync(NULL, pStorage->pStorage, uOffset, pvBuffer, cbBuffer, NULL); 4797 } 4798 4799 static int vdIOIntReadMetaLimited(void *pvUser, PVDIOSTORAGE pStorage, 4800 uint64_t uOffset, void *pvBuffer, 4801 size_t cbBuffer, PVDIOCTX pIoCtx, 4802 PPVDMETAXFER ppMetaXfer, 4803 PFNVDXFERCOMPLETED pfnComplete, 4804 void *pvCompleteUser) 4762 4805 { 4763 4806 PVDINTERFACEIO pInterfaceIo = (PVDINTERFACEIO)pvUser; 4764 return pInterfaceIo->pfnReadSync(NULL, pIoStorage->pStorage, uOffset, pvBuf, cbRead, pcbRead); 4765 } 4766 4767 static int vdIOIntFlushSyncLimited(void *pvUser, PVDIOSTORAGE pIoStorage) 4807 4808 AssertMsgReturn(!pIoCtx && !ppMetaXfer && !pfnComplete && !pvCompleteUser, 4809 ("Async I/O not implemented for the limited interface"), 4810 VERR_NOT_SUPPORTED); 4811 4812 return pInterfaceIo->pfnReadSync(NULL, pStorage->pStorage, uOffset, pvBuffer, cbBuffer, NULL); 4813 } 4814 4815 static int vdIOIntMetaXferReleaseLimited(void *pvUser, PVDMETAXFER pMetaXfer) 4816 { 4817 /* This is a NOP in this case. */ 4818 NOREF(pvUser); 4819 NOREF(pMetaXfer); 4820 return VINF_SUCCESS; 4821 } 4822 4823 static int vdIOIntFlushLimited(void *pvUser, PVDIOSTORAGE pStorage, 4824 PVDIOCTX pIoCtx, 4825 PFNVDXFERCOMPLETED pfnComplete, 4826 void *pvCompleteUser) 4768 4827 { 4769 4828 PVDINTERFACEIO pInterfaceIo = (PVDINTERFACEIO)pvUser; 4770 return pInterfaceIo->pfnFlushSync(NULL, pIoStorage->pStorage); 4829 4830 AssertMsgReturn(!pIoCtx && !pfnComplete && !pvCompleteUser, 4831 ("Async I/O not implemented for the limited interface"), 4832 VERR_NOT_SUPPORTED); 4833 4834 return pInterfaceIo->pfnFlushSync(NULL, pStorage->pStorage); 4771 4835 } 4772 4836 … … 4887 4951 pIfIoInt->pfnGetSize = vdIOIntGetSize; 4888 4952 pIfIoInt->pfnSetSize = vdIOIntSetSize; 4889 pIfIoInt->pfnReadSync = vdIOIntReadSync; 4890 pIfIoInt->pfnWriteSync = vdIOIntWriteSync; 4891 pIfIoInt->pfnFlushSync = vdIOIntFlushSync; 4892 pIfIoInt->pfnReadUserAsync = vdIOIntReadUserAsync; 4893 pIfIoInt->pfnWriteUserAsync = vdIOIntWriteUserAsync; 4894 pIfIoInt->pfnReadMetaAsync = vdIOIntReadMetaAsync; 4895 pIfIoInt->pfnWriteMetaAsync = vdIOIntWriteMetaAsync; 4953 pIfIoInt->pfnReadUser = vdIOIntReadUser; 4954 pIfIoInt->pfnWriteUser = vdIOIntWriteUser; 4955 pIfIoInt->pfnReadMeta = vdIOIntReadMeta; 4956 pIfIoInt->pfnWriteMeta = vdIOIntWriteMeta; 4896 4957 pIfIoInt->pfnMetaXferRelease = vdIOIntMetaXferRelease; 4897 pIfIoInt->pfnFlush Async = vdIOIntFlushAsync;4958 pIfIoInt->pfnFlush = vdIOIntFlush; 4898 4959 pIfIoInt->pfnIoCtxCopyFrom = vdIOIntIoCtxCopyFrom; 4899 4960 pIfIoInt->pfnIoCtxCopyTo = vdIOIntIoCtxCopyTo; … … 5226 5287 VDIfIoInt.pfnGetSize = vdIOIntGetSizeLimited; 5227 5288 VDIfIoInt.pfnSetSize = vdIOIntSetSizeLimited; 5228 VDIfIoInt.pfnReadSync = vdIOIntReadSyncLimited; 5229 VDIfIoInt.pfnWriteSync = vdIOIntWriteSyncLimited; 5230 VDIfIoInt.pfnFlushSync = vdIOIntFlushSyncLimited; 5231 VDIfIoInt.pfnReadUserAsync = NULL; 5232 VDIfIoInt.pfnWriteUserAsync = NULL; 5233 VDIfIoInt.pfnReadMetaAsync = NULL; 5234 VDIfIoInt.pfnWriteMetaAsync = NULL; 5235 VDIfIoInt.pfnFlushAsync = NULL; 5289 VDIfIoInt.pfnReadUser = vdIOIntReadUserLimited; 5290 VDIfIoInt.pfnWriteUser = vdIOIntWriteUserLimited; 5291 VDIfIoInt.pfnReadMeta = vdIOIntReadMetaLimited; 5292 VDIfIoInt.pfnWriteMeta = vdIOIntWriteMetaLimited; 5293 VDIfIoInt.pfnFlush = vdIOIntFlushLimited; 5236 5294 rc = VDInterfaceAdd(&VDIfIoInt.Core, "VD_IOINT", VDINTERFACETYPE_IOINT, 5237 5295 pInterfaceIo, sizeof(VDINTERFACEIOINT), &pVDIfsImage); … … 9667 9725 VDIfIoInt.pfnGetSize = vdIOIntGetSizeLimited; 9668 9726 VDIfIoInt.pfnSetSize = vdIOIntSetSizeLimited; 9669 VDIfIoInt.pfnReadSync = vdIOIntReadSyncLimited; 9670 VDIfIoInt.pfnWriteSync = vdIOIntWriteSyncLimited; 9671 VDIfIoInt.pfnFlushSync = vdIOIntFlushSyncLimited; 9672 VDIfIoInt.pfnReadUserAsync = NULL; 9673 VDIfIoInt.pfnWriteUserAsync = NULL; 9674 VDIfIoInt.pfnReadMetaAsync = NULL; 9675 VDIfIoInt.pfnWriteMetaAsync = NULL; 9676 VDIfIoInt.pfnFlushAsync = NULL; 9727 VDIfIoInt.pfnReadUser = vdIOIntReadUserLimited; 9728 VDIfIoInt.pfnWriteUser = vdIOIntWriteUserLimited; 9729 VDIfIoInt.pfnReadMeta = vdIOIntReadMetaLimited; 9730 VDIfIoInt.pfnWriteMeta = vdIOIntWriteMetaLimited; 9731 VDIfIoInt.pfnFlush = vdIOIntFlushLimited; 9677 9732 rc = VDInterfaceAdd(&VDIfIoInt.Core, "VD_IOINT", VDINTERFACETYPE_IOINT, 9678 9733 pInterfaceIo, sizeof(VDINTERFACEIOINT), &pVDIfsImage); -
trunk/src/VBox/Storage/VDI.cpp
r44232 r44233 654 654 vdiConvPreHeaderEndianess(VDIECONV_H2F, &PreHeader, &pImage->PreHeader); 655 655 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, 656 &PreHeader, sizeof(PreHeader) , NULL);656 &PreHeader, sizeof(PreHeader)); 657 657 if (RT_FAILURE(rc)) 658 658 { … … 666 666 vdiConvHeaderEndianessV1p(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1plus); 667 667 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(pImage->PreHeader), 668 &Hdr, sizeof(Hdr) , NULL);668 &Hdr, sizeof(Hdr)); 669 669 if (RT_FAILURE(rc)) 670 670 { … … 676 676 vdiConvBlocksEndianess(VDIECONV_H2F, pImage->paBlocks, getImageBlocks(&pImage->Header)); 677 677 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, pImage->paBlocks, 678 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER), 679 NULL); 678 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER)); 680 679 vdiConvBlocksEndianess(VDIECONV_F2H, pImage->paBlocks, getImageBlocks(&pImage->Header)); 681 680 if (RT_FAILURE(rc)) … … 712 711 713 712 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartData + uOff, 714 pvBuf, cbChunk , NULL);713 pvBuf, cbChunk); 715 714 if (RT_FAILURE(rc)) 716 715 { … … 781 780 VDIPREHEADER PreHeader; 782 781 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, 783 &PreHeader, sizeof(PreHeader) , NULL);782 &PreHeader, sizeof(PreHeader)); 784 783 if (RT_FAILURE(rc)) 785 784 { … … 802 801 case 0: 803 802 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, sizeof(pImage->PreHeader), 804 &pImage->Header.u.v0, sizeof(pImage->Header.u.v0), 805 NULL); 803 &pImage->Header.u.v0, sizeof(pImage->Header.u.v0)); 806 804 if (RT_FAILURE(rc)) 807 805 { … … 813 811 case 1: 814 812 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, sizeof(pImage->PreHeader), 815 &pImage->Header.u.v1, sizeof(pImage->Header.u.v1), 816 NULL); 813 &pImage->Header.u.v1, sizeof(pImage->Header.u.v1)); 817 814 if (RT_FAILURE(rc)) 818 815 { … … 840 837 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, sizeof(pImage->PreHeader), 841 838 &pImage->Header.u.v1plus, 842 sizeof(pImage->Header.u.v1plus) , NULL);839 sizeof(pImage->Header.u.v1plus)); 843 840 if (RT_FAILURE(rc)) 844 841 { … … 874 871 /* Read blocks array. */ 875 872 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, pImage->paBlocks, 876 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER), 877 NULL); 873 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER)); 878 874 if (RT_FAILURE(rc)) 879 875 { … … 945 941 vdiConvHeaderEndianessV0(VDIECONV_H2F, &Hdr, &pImage->Header.u.v0); 946 942 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VDIPREHEADER), 947 &Hdr, sizeof(Hdr) , NULL);943 &Hdr, sizeof(Hdr)); 948 944 break; 949 945 } … … 954 950 vdiConvHeaderEndianessV1(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1); 955 951 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VDIPREHEADER), 956 &Hdr, sizeof(Hdr) , NULL);952 &Hdr, sizeof(Hdr)); 957 953 } 958 954 else … … 961 957 vdiConvHeaderEndianessV1p(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1plus); 962 958 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VDIPREHEADER), 963 &Hdr, sizeof(Hdr) , NULL);959 &Hdr, sizeof(Hdr)); 964 960 } 965 961 break; … … 984 980 VDIHEADER0 Hdr; 985 981 vdiConvHeaderEndianessV0(VDIECONV_H2F, &Hdr, &pImage->Header.u.v0); 986 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,987 988 982 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 983 sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr), 984 pIoCtx, NULL, NULL); 989 985 break; 990 986 } … … 994 990 VDIHEADER1 Hdr; 995 991 vdiConvHeaderEndianessV1(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1); 996 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,997 998 992 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 993 sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr), 994 pIoCtx, NULL, NULL); 999 995 } 1000 996 else … … 1002 998 VDIHEADER1PLUS Hdr; 1003 999 vdiConvHeaderEndianessV1p(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1plus); 1004 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1005 1006 1000 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1001 sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr), 1002 pIoCtx, NULL, NULL); 1007 1003 } 1008 1004 break; … … 1029 1025 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1030 1026 pImage->offStartBlocks + uBlock * sizeof(VDIIMAGEBLOCKPOINTER), 1031 &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER), 1032 NULL); 1027 &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER)); 1033 1028 AssertMsgRC(rc, ("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n", 1034 1029 uBlock, pImage->pszFilename, rc)); … … 1053 1048 /* write only one block pointer. */ 1054 1049 VDIIMAGEBLOCKPOINTER ptrBlock = RT_H2LE_U32(pImage->paBlocks[uBlock]); 1055 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,1056 1057 1058 1050 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 1051 pImage->offStartBlocks + uBlock * sizeof(VDIIMAGEBLOCKPOINTER), 1052 &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER), 1053 pIoCtx, NULL, NULL); 1059 1054 AssertMsg(RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS, 1060 1055 ("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n", … … 1078 1073 ("vdiUpdateHeaderAsync() failed, filename=\"%s\", rc=%Rrc\n", 1079 1074 pImage->pszFilename, rc)); 1080 rc = vdIfIoIntFileFlush Async(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL);1075 rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL); 1081 1076 AssertMsg(RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS, 1082 1077 ("Flushing data to disk failed rc=%Rrc\n", rc)); … … 1123 1118 u64Offset = (uint64_t)idxLastBlock * pImage->cbTotalBlockData + pImage->offStartData; 1124 1119 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset, 1125 pvBlock, pImage->cbTotalBlockData , NULL);1120 pvBlock, pImage->cbTotalBlockData); 1126 1121 if (RT_FAILURE(rc)) 1127 1122 break; … … 1130 1125 u64Offset = (uint64_t)ptrBlockDiscard * pImage->cbTotalBlockData + pImage->offStartData; 1131 1126 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset, 1132 pvBlock, pImage->cbTotalBlockData , NULL);1127 pvBlock, pImage->cbTotalBlockData); 1133 1128 if (RT_FAILURE(rc)) 1134 1129 break; … … 1184 1179 PVDMETAXFER pMetaXfer; 1185 1180 uint64_t u64Offset = (uint64_t)pDiscardAsync->idxLastBlock * pImage->cbTotalBlockData + pImage->offStartData; 1186 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pImage->pStorage, u64Offset,1187 1188 1181 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, u64Offset, 1182 pDiscardAsync->pvBlock, pImage->cbTotalBlockData, pIoCtx, 1183 &pMetaXfer, vdiDiscardBlockAsyncUpdate, pDiscardAsync); 1189 1184 if (RT_FAILURE(rc)) 1190 1185 break; … … 1198 1193 /* Block read complete. Write to the new location (discarded block). */ 1199 1194 uint64_t u64Offset = (uint64_t)pDiscardAsync->ptrBlockDiscard * pImage->cbTotalBlockData + pImage->offStartData; 1200 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage, u64Offset,1201 1202 1195 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, u64Offset, 1196 pDiscardAsync->pvBlock, pImage->cbTotalBlockData, pIoCtx, 1197 vdiDiscardBlockAsyncUpdate, pDiscardAsync); 1203 1198 1204 1199 pDiscardAsync->enmState = VDIBLOCKDISCARDSTATE_UPDATE_METADATA; … … 1671 1666 if (u64Offset + cbToRead <= pImage->cbImage) 1672 1667 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset, 1673 pvBuf, cbToRead , NULL);1668 pvBuf, cbToRead); 1674 1669 else 1675 1670 { … … 1762 1757 + (pImage->offStartData + pImage->offStartBlockData); 1763 1758 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1764 u64Offset, pvBuf, cbToWrite , NULL);1759 u64Offset, pvBuf, cbToWrite); 1765 1760 if (RT_FAILURE(rc)) 1766 1761 goto out; … … 1795 1790 + (pImage->offStartData + pImage->offStartBlockData + offWrite); 1796 1791 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset, 1797 pvBuf, cbToWrite , NULL);1792 pvBuf, cbToWrite); 1798 1793 } 1799 1794 } while (0); … … 2485 2480 2486 2481 if (u64Offset + cbToRead <= pImage->cbImage) 2487 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, u64Offset,2488 2482 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, u64Offset, 2483 pIoCtx, cbToRead); 2489 2484 else 2490 2485 { … … 2591 2586 *pcbPostRead = 0; 2592 2587 2593 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2594 2595 2588 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2589 u64Offset, pIoCtx, cbToWrite, 2590 vdiAsyncBlockAllocUpdate, pBlockAlloc); 2596 2591 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 2597 2592 break; … … 2618 2613 uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData 2619 2614 + (pImage->offStartData + pImage->offStartBlockData + offWrite); 2620 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2621 2615 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2616 u64Offset, pIoCtx, cbToWrite, NULL, NULL); 2622 2617 } 2623 2618 } while (0); … … 2752 2747 uint64_t u64Offset = (uint64_t)ptrBlock * pImage->cbTotalBlockData 2753 2748 + (pImage->offStartData + pImage->offStartBlockData); 2754 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset, pvTmp, cbBlock , NULL);2749 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset, pvTmp, cbBlock); 2755 2750 if (RT_FAILURE(rc)) 2756 2751 break; … … 2837 2832 + (pImage->offStartData + pImage->offStartBlockData); 2838 2833 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset, 2839 pvTmp, cbBlock , NULL);2834 pvTmp, cbBlock); 2840 2835 u64Offset = (uint64_t)i * pImage->cbTotalBlockData 2841 2836 + (pImage->offStartData + pImage->offStartBlockData); 2842 2837 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset, 2843 pvTmp, cbBlock , NULL);2838 pvTmp, cbBlock); 2844 2839 pImage->paBlocks[uBlockData] = i; 2845 2840 setImageBlocksAllocated(&pImage->Header, cBlocksAllocated - cBlocksMoved); … … 2978 2973 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 2979 2974 offStartDataNew, pvBuf, 2980 pImage->cbTotalBlockData , NULL);2975 pImage->cbTotalBlockData); 2981 2976 if (RT_FAILURE(rc)) 2982 2977 break; … … 2989 2984 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 2990 2985 offBlockAppend, pvBuf, 2991 pImage->cbTotalBlockData , NULL);2986 pImage->cbTotalBlockData); 2992 2987 if (RT_FAILURE(rc)) 2993 2988 break; … … 2996 2991 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 2997 2992 offStartDataNew, pvZero, 2998 pImage->cbTotalBlockData , NULL);2993 pImage->cbTotalBlockData); 2999 2994 if (RT_FAILURE(rc)) 3000 2995 break; … … 3063 3058 vdiConvBlocksEndianess(VDIECONV_H2F, pImage->paBlocks, cBlocksNew); 3064 3059 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, 3065 pImage->paBlocks, cbBlockspaceNew , NULL);3060 pImage->paBlocks, cbBlockspaceNew); 3066 3061 vdiConvBlocksEndianess(VDIECONV_F2H, pImage->paBlocks, cBlocksNew); 3067 3062 … … 3182 3177 uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData; 3183 3178 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset, 3184 pvBlock, pImage->cbTotalBlockData , NULL);3179 pvBlock, pImage->cbTotalBlockData); 3185 3180 if (RT_FAILURE(rc)) 3186 3181 break; … … 3197 3192 /* Write changed data to the image. */ 3198 3193 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset + offDiscard, 3199 pbBlockData + offDiscard, cbDiscard , NULL);3194 pbBlockData + offDiscard, cbDiscard); 3200 3195 } 3201 3196 else … … 3310 3305 3311 3306 uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData + offDiscard; 3312 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,3313 3314 3307 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 3308 u64Offset, pvBlock, cbDiscard, pIoCtx, 3309 NULL, NULL); 3315 3310 RTMemFree(pvBlock); 3316 3311 } … … 3325 3320 3326 3321 uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData; 3327 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pImage->pStorage, u64Offset,3328 3329 3322 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, u64Offset, 3323 pbBlockData, pImage->cbTotalBlockData, 3324 pIoCtx, &pMetaXfer, NULL, NULL); 3330 3325 if (RT_FAILURE(rc)) 3331 3326 { … … 3413 3408 3414 3409 /* Read pre-header. */ 3415 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &PreHdr, sizeof(PreHdr) , NULL);3410 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &PreHdr, sizeof(PreHdr)); 3416 3411 if (RT_FAILURE(rc)) 3417 3412 { … … 3434 3429 case 0: 3435 3430 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, sizeof(PreHdr), 3436 &Hdr.u.v0, sizeof(Hdr.u.v0), 3437 NULL); 3431 &Hdr.u.v0, sizeof(Hdr.u.v0)); 3438 3432 if (RT_FAILURE(rc)) 3439 3433 rc = vdIfError(pIfError, rc, RT_SRC_POS, N_("VDI: error reading v0 header in '%s'"), … … 3443 3437 case 1: 3444 3438 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, sizeof(PreHdr), 3445 &Hdr.u.v1, sizeof(Hdr.u.v1) , NULL);3439 &Hdr.u.v1, sizeof(Hdr.u.v1)); 3446 3440 if (RT_FAILURE(rc)) 3447 3441 { … … 3454 3448 /* Read the VDI 1.1+ header completely. */ 3455 3449 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, sizeof(PreHdr), 3456 &Hdr.u.v1plus, sizeof(Hdr.u.v1plus), 3457 NULL); 3450 &Hdr.u.v1plus, sizeof(Hdr.u.v1plus)); 3458 3451 if (RT_FAILURE(rc)) 3459 3452 rc = vdIfError(pIfError, rc, RT_SRC_POS, N_("VDI: error reading v1.1+ header in '%s'"), … … 3499 3492 /* Read blocks array. */ 3500 3493 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offStartBlocks, paBlocks, 3501 getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER), 3502 NULL); 3494 getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER)); 3503 3495 if (RT_FAILURE(rc)) 3504 3496 { … … 3555 3547 vdiConvBlocksEndianess(VDIECONV_H2F, paBlocks, getImageBlocks(&Hdr)); 3556 3548 rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offStartBlocks, paBlocks, 3557 getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER), 3558 NULL); 3549 getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER)); 3559 3550 if (RT_FAILURE(rc)) 3560 3551 { -
trunk/src/VBox/Storage/VHD.cpp
r44232 r44233 363 363 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 364 364 RT_BE2H_U64(pLocator->u64DataOffset), 365 pvBuf, RT_BE2H_U32(pLocator->u32DataSpace) * VHD_SECTOR_SIZE, 366 NULL); 365 pvBuf, RT_BE2H_U32(pLocator->u32DataSpace) * VHD_SECTOR_SIZE); 367 366 368 367 out: … … 384 383 385 384 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 386 pImage->u64DataOffset, &ddh, sizeof(ddh) , NULL);385 pImage->u64DataOffset, &ddh, sizeof(ddh)); 387 386 if (RT_FAILURE(rc)) 388 387 return rc; … … 434 433 ddh.Checksum = RT_H2BE_U32(vhdChecksum(&ddh, sizeof(ddh))); 435 434 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 436 pImage->u64DataOffset, &ddh, sizeof(ddh) , NULL);435 pImage->u64DataOffset, &ddh, sizeof(ddh)); 437 436 return rc; 438 437 } … … 456 455 if (pImage->pBlockAllocationTable) 457 456 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, 458 &pImage->vhdFooterCopy, sizeof(VHDFooter) , NULL);457 &pImage->vhdFooterCopy, sizeof(VHDFooter)); 459 458 460 459 if (RT_SUCCESS(rc)) 461 460 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 462 461 pImage->uCurrentEndOfFile, &pImage->vhdFooterCopy, 463 sizeof(VHDFooter) , NULL);462 sizeof(VHDFooter)); 464 463 465 464 return rc; … … 497 496 */ 498 497 vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uBlockAllocationTableOffset, 499 pBlockAllocationTableToWrite, cbBlockAllocationTableToWrite , NULL);498 pBlockAllocationTableToWrite, cbBlockAllocationTableToWrite); 500 499 if (pImage->fDynHdrNeedsUpdate) 501 500 rc = vhdDynamicHeaderUpdate(pImage); … … 616 615 if (uStatus == VHDIMAGEEXPAND_STEP_SUCCESS) 617 616 { 618 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,619 620 621 622 617 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 618 pImage->uBlockAllocationTableOffset 619 + pExpand->idxBatAllocated * sizeof(uint32_t), 620 &pImage->pBlockAllocationTable[pExpand->idxBatAllocated], 621 sizeof(uint32_t), pIoCtx, NULL, NULL); 623 622 fIoInProgress |= rc == VERR_VD_ASYNC_IO_IN_PROGRESS; 624 623 } … … 633 632 634 633 pImage->uCurrentEndOfFile = pExpand->cbEofOld; 635 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,636 637 638 634 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 635 pImage->uCurrentEndOfFile, 636 &pImage->vhdFooterCopy, sizeof(VHDFooter), 637 pIoCtx, NULL, NULL); 639 638 fIoInProgress |= rc == VERR_VD_ASYNC_IO_IN_PROGRESS; 640 639 } … … 696 695 */ 697 696 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uDynamicDiskHeaderOffset, 698 &vhdDynamicDiskHeader, sizeof(VHDDynamicDiskHeader), 699 NULL); 697 &vhdDynamicDiskHeader, sizeof(VHDDynamicDiskHeader)); 700 698 if (memcmp(vhdDynamicDiskHeader.Cookie, VHD_DYNAMIC_DISK_HEADER_COOKIE, VHD_DYNAMIC_DISK_HEADER_COOKIE_SIZE)) 701 699 return VERR_INVALID_PARAMETER; … … 738 736 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 739 737 uBlockAllocationTableOffset, pBlockAllocationTable, 740 pImage->cBlockAllocationTableEntries * sizeof(uint32_t), 741 NULL); 738 pImage->cBlockAllocationTableEntries * sizeof(uint32_t)); 742 739 743 740 /* … … 792 789 793 790 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, pImage->uCurrentEndOfFile, 794 &vhdFooter, sizeof(VHDFooter) , NULL);791 &vhdFooter, sizeof(VHDFooter)); 795 792 if (RT_SUCCESS(rc)) 796 793 { … … 802 799 */ 803 800 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, 804 &vhdFooter, sizeof(VHDFooter) , NULL);801 &vhdFooter, sizeof(VHDFooter)); 805 802 if (RT_SUCCESS(rc)) 806 803 { … … 1034 1031 1035 1032 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, pvTmp, 1036 pImage->uCurrentEndOfFile + sizeof(VHDFooter) , NULL);1033 pImage->uCurrentEndOfFile + sizeof(VHDFooter)); 1037 1034 if (RT_FAILURE(rc)) 1038 1035 { … … 1055 1052 1056 1053 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VHDFooter), 1057 &DynamicDiskHeader, sizeof(DynamicDiskHeader) , NULL);1054 &DynamicDiskHeader, sizeof(DynamicDiskHeader)); 1058 1055 if (RT_FAILURE(rc)) 1059 1056 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VHD: cannot write dynamic disk header to image '%s'"), pImage->pszFilename); … … 1062 1059 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uBlockAllocationTableOffset, 1063 1060 pImage->pBlockAllocationTable, 1064 pImage->cBlockAllocationTableEntries * sizeof(uint32_t), 1065 NULL); 1061 pImage->cBlockAllocationTableEntries * sizeof(uint32_t)); 1066 1062 if (RT_FAILURE(rc)) 1067 1063 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VHD: cannot write BAT to image '%s'"), pImage->pszFilename); … … 1183 1179 /* Store the footer */ 1184 1180 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uCurrentEndOfFile, 1185 &Footer, sizeof(Footer) , NULL);1181 &Footer, sizeof(Footer)); 1186 1182 if (RT_FAILURE(rc)) 1187 1183 { … … 1194 1190 { 1195 1191 /* Write the copy of the footer. */ 1196 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, &Footer, sizeof(Footer) , NULL);1192 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, &Footer, sizeof(Footer)); 1197 1193 if (RT_FAILURE(rc)) 1198 1194 { … … 1241 1237 1242 1238 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, cbFile - sizeof(VHDFooter), 1243 &vhdFooter, sizeof(VHDFooter) , NULL);1239 &vhdFooter, sizeof(VHDFooter)); 1244 1240 if (RT_SUCCESS(rc)) 1245 1241 { … … 1250 1246 * Such corrupted images are detected here to let the open handler repair it later. 1251 1247 */ 1252 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, 1253 &vhdFooter, sizeof(VHDFooter), NULL); 1248 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &vhdFooter, sizeof(VHDFooter)); 1254 1249 if ( RT_FAILURE(rc) 1255 1250 || (memcmp(vhdFooter.Cookie, VHD_FOOTER_COOKIE, VHD_FOOTER_COOKIE_SIZE) != 0)) … … 1502 1497 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1503 1498 ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE, 1504 pImage->pu8Bitmap, pImage->cbDataBlockBitmap, 1505 NULL); 1499 pImage->pu8Bitmap, pImage->cbDataBlockBitmap); 1506 1500 if (RT_SUCCESS(rc)) 1507 1501 { … … 1529 1523 LogFlowFunc(("uVhdOffset=%llu cbBuf=%u\n", uVhdOffset, cbBuf)); 1530 1524 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1531 uVhdOffset, pvBuf, cbBuf , NULL);1525 uVhdOffset, pvBuf, cbBuf); 1532 1526 } 1533 1527 else … … 1561 1555 } 1562 1556 else 1563 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf , NULL);1557 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf); 1564 1558 1565 1559 if ( RT_SUCCESS(rc) … … 1644 1638 */ 1645 1639 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uCurrentEndOfFile, 1646 pNewBlock, cbNewBlock , NULL);1640 pNewBlock, cbNewBlock); 1647 1641 AssertRC(rc); 1648 1642 … … 1666 1660 /* Write data. */ 1667 1661 vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uVhdOffset, 1668 pvBuf, cbBuf , NULL);1662 pvBuf, cbBuf); 1669 1663 1670 1664 /* Read in the block's bitmap. */ 1671 1665 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 1672 1666 ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE, 1673 pImage->pu8Bitmap, pImage->cbDataBlockBitmap, 1674 NULL); 1667 pImage->pu8Bitmap, pImage->cbDataBlockBitmap); 1675 1668 if (RT_SUCCESS(rc)) 1676 1669 { … … 1689 1682 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 1690 1683 ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE, 1691 pImage->pu8Bitmap, pImage->cbDataBlockBitmap, 1692 NULL); 1684 pImage->pu8Bitmap, pImage->cbDataBlockBitmap); 1693 1685 } 1694 1686 } … … 1696 1688 else 1697 1689 { 1698 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf , NULL);1690 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf); 1699 1691 } 1700 1692 … … 2333 2325 /* Read in the block's bitmap. */ 2334 2326 PVDMETAXFER pMetaXfer; 2335 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pImage->pStorage,2336 2337 2338 2327 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, 2328 ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE, 2329 pImage->pu8Bitmap, pImage->cbDataBlockBitmap, 2330 pIoCtx, &pMetaXfer, NULL, NULL); 2339 2331 2340 2332 if (RT_SUCCESS(rc)) … … 2363 2355 2364 2356 LogFlowFunc(("uVhdOffset=%llu cbRead=%u\n", uVhdOffset, cbRead)); 2365 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage,2366 2357 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, 2358 uVhdOffset, pIoCtx, cbRead); 2367 2359 } 2368 2360 else … … 2396 2388 } 2397 2389 else 2398 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pImage->pStorage, uOffset, pIoCtx, cbRead);2390 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset, pIoCtx, cbRead); 2399 2391 2400 2392 if (pcbActuallyRead) … … 2481 2473 * Start with the sector bitmap. 2482 2474 */ 2483 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,2484 2485 2486 2487 2488 2475 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 2476 pImage->uCurrentEndOfFile, 2477 pExpand->au8Bitmap, 2478 pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE, pIoCtx, 2479 vhdAsyncExpansionDataBlockBitmapComplete, 2480 pExpand); 2489 2481 if (RT_SUCCESS(rc)) 2490 2482 VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_BLOCKBITMAP_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS); … … 2504 2496 * Write the new block at the current end of the file. 2505 2497 */ 2506 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2507 2508 2509 2510 2498 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2499 pImage->uCurrentEndOfFile + pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE, 2500 pIoCtx, cbWrite, 2501 vhdAsyncExpansionDataComplete, 2502 pExpand); 2511 2503 if (RT_SUCCESS(rc)) 2512 2504 VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_USERBLOCK_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS); … … 2524 2516 * Write entry in the BAT. 2525 2517 */ 2526 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage, 2527 pImage->uBlockAllocationTableOffset + cBlockAllocationTableEntry * sizeof(uint32_t), 2528 &pExpand->idxBlockBe, 2529 sizeof(uint32_t), pIoCtx, 2530 vhdAsyncExpansionBatUpdateComplete, 2531 pExpand); 2518 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 2519 pImage->uBlockAllocationTableOffset + cBlockAllocationTableEntry * sizeof(uint32_t), 2520 &pExpand->idxBlockBe, sizeof(uint32_t), pIoCtx, 2521 vhdAsyncExpansionBatUpdateComplete, 2522 pExpand); 2532 2523 if (RT_SUCCESS(rc)) 2533 2524 VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_BAT_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS); … … 2548 2539 2549 2540 /* Update the footer. */ 2550 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,2551 2552 2553 2554 2555 2541 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 2542 pImage->uCurrentEndOfFile, 2543 &pImage->vhdFooterCopy, 2544 sizeof(VHDFooter), pIoCtx, 2545 vhdAsyncExpansionFooterUpdateComplete, 2546 pExpand); 2556 2547 if (RT_SUCCESS(rc)) 2557 2548 VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_FOOTER_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS); … … 2580 2571 /* Read in the block's bitmap. */ 2581 2572 PVDMETAXFER pMetaXfer; 2582 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pImage->pStorage,2583 2584 2585 2586 2573 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, 2574 ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE, 2575 pImage->pu8Bitmap, 2576 pImage->cbDataBlockBitmap, pIoCtx, 2577 &pMetaXfer, NULL, NULL); 2587 2578 if (RT_SUCCESS(rc)) 2588 2579 { … … 2590 2581 2591 2582 /* Write data. */ 2592 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2593 2594 2583 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2584 uVhdOffset, pIoCtx, cbWrite, 2585 NULL, NULL); 2595 2586 if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 2596 2587 { … … 2616 2607 * to rollback anything here. 2617 2608 */ 2618 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pImage->pStorage,2619 2620 2621 2622 2609 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, 2610 ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE, 2611 pImage->pu8Bitmap, 2612 pImage->cbDataBlockBitmap, 2613 pIoCtx, NULL, NULL); 2623 2614 } 2624 2615 } … … 2627 2618 } 2628 2619 else 2629 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pImage->pStorage,2630 2620 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, 2621 uOffset, pIoCtx, cbWrite, NULL, NULL); 2631 2622 2632 2623 if (pcbWriteProcess) … … 2647 2638 2648 2639 /* No need to write anything here. Data is always updated on a write. */ 2649 return vdIfIoIntFileFlushAsync(pImage->pIfIo, pImage->pStorage, 2650 pIoCtx, NULL, NULL); 2640 return vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL); 2651 2641 } 2652 2642 … … 2761 2751 uint64_t u64Offset = ((uint64_t)paBat[i] + pImage->cDataBlockBitmapSectors) * VHD_SECTOR_SIZE; 2762 2752 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 2763 u64Offset, pvBuf, pImage->cbDataBlock , NULL);2753 u64Offset, pvBuf, pImage->cbDataBlock); 2764 2754 if (RT_FAILURE(rc)) 2765 2755 break; … … 2825 2815 + (offBlocksStart * VHD_SECTOR_SIZE); 2826 2816 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 2827 u64Offset, pvBuf, cbBlock , NULL);2817 u64Offset, pvBuf, cbBlock); 2828 2818 if (RT_FAILURE(rc)) 2829 2819 break; … … 2832 2822 + (offBlocksStart * VHD_SECTOR_SIZE); 2833 2823 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 2834 u64Offset, pvBuf, cbBlock , NULL);2824 u64Offset, pvBuf, cbBlock); 2835 2825 if (RT_FAILURE(rc)) 2836 2826 break; … … 2987 2977 /* Read data and append to the end of the image. */ 2988 2978 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 2989 offStartDataNew, pvBuf, cbBlock , NULL);2979 offStartDataNew, pvBuf, cbBlock); 2990 2980 if (RT_FAILURE(rc)) 2991 2981 break; 2992 2982 2993 2983 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 2994 pImage->uCurrentEndOfFile, pvBuf, cbBlock , NULL);2984 pImage->uCurrentEndOfFile, pvBuf, cbBlock); 2995 2985 if (RT_FAILURE(rc)) 2996 2986 break; … … 2998 2988 /* Zero out the old block area. */ 2999 2989 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 3000 offStartDataNew, pvZero, cbBlock , NULL);2990 offStartDataNew, pvZero, cbBlock); 3001 2991 if (RT_FAILURE(rc)) 3002 2992 break; … … 3049 3039 pImage->uBlockAllocationTableOffset, 3050 3040 pImage->pBlockAllocationTable, 3051 cBlocksNew * sizeof(uint32_t) , NULL);3041 cBlocksNew * sizeof(uint32_t)); 3052 3042 } 3053 3043 … … 3133 3123 3134 3124 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, cbFile - sizeof(VHDFooter), 3135 &vhdFooter, sizeof(VHDFooter) , NULL);3125 &vhdFooter, sizeof(VHDFooter)); 3136 3126 if (RT_FAILURE(rc)) 3137 3127 { … … 3144 3134 /* Dynamic images have a backup at the beginning of the image. */ 3145 3135 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, 3146 &vhdFooter, sizeof(VHDFooter) , NULL);3136 &vhdFooter, sizeof(VHDFooter)); 3147 3137 if (RT_FAILURE(rc)) 3148 3138 { … … 3219 3209 3220 3210 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offDynamicDiskHeader, 3221 &dynamicDiskHeader, sizeof(VHDDynamicDiskHeader) , NULL);3211 &dynamicDiskHeader, sizeof(VHDDynamicDiskHeader)); 3222 3212 if (RT_FAILURE(rc)) 3223 3213 { … … 3266 3256 3267 3257 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offBat, paBat, 3268 cBatEntries * sizeof(uint32_t) , NULL);3258 cBatEntries * sizeof(uint32_t)); 3269 3259 if (RT_FAILURE(rc)) 3270 3260 { … … 3343 3333 3344 3334 rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offBat, paBat, 3345 cBatEntries * sizeof(uint32_t) , NULL);3335 cBatEntries * sizeof(uint32_t)); 3346 3336 if (RT_FAILURE(rc)) 3347 3337 { … … 3359 3349 vdIfErrorMessage(pIfError, "Writing repaired dynamic disk header...\n"); 3360 3350 rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offDynamicDiskHeader, &dynamicDiskHeader, 3361 sizeof(VHDDynamicDiskHeader) , NULL);3351 sizeof(VHDDynamicDiskHeader)); 3362 3352 if (RT_FAILURE(rc)) 3363 3353 { … … 3377 3367 /* Write backup at image beginning. */ 3378 3368 rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, 0, &vhdFooter, 3379 sizeof(VHDFooter) , NULL);3369 sizeof(VHDFooter)); 3380 3370 if (RT_FAILURE(rc)) 3381 3371 { … … 3388 3378 3389 3379 rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offFooter, &vhdFooter, 3390 sizeof(VHDFooter) , NULL);3380 sizeof(VHDFooter)); 3391 3381 if (RT_FAILURE(rc)) 3392 3382 { -
trunk/src/VBox/Storage/VHDX.cpp
r44232 r44233 1056 1056 /* Read the first header. */ 1057 1057 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_HEADER1_OFFSET, 1058 pHdr1, sizeof(*pHdr1) , NULL);1058 pHdr1, sizeof(*pHdr1)); 1059 1059 if (RT_SUCCESS(rc)) 1060 1060 { … … 1073 1073 /* Try to read the second header in any case (even if reading the first failed). */ 1074 1074 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_HEADER2_OFFSET, 1075 pHdr2, sizeof(*pHdr2) , NULL);1075 pHdr2, sizeof(*pHdr2)); 1076 1076 if (RT_SUCCESS(rc)) 1077 1077 { … … 1166 1166 { 1167 1167 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offRegion, 1168 paBatEntries, cbBatEntries , NULL);1168 paBatEntries, cbBatEntries); 1169 1169 if (RT_SUCCESS(rc)) 1170 1170 { … … 1254 1254 1255 1255 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offItem, 1256 &FileParameters, sizeof(FileParameters) , NULL);1256 &FileParameters, sizeof(FileParameters)); 1257 1257 if (RT_SUCCESS(rc)) 1258 1258 { … … 1299 1299 1300 1300 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offItem, 1301 &VDiskSize, sizeof(VDiskSize) , NULL);1301 &VDiskSize, sizeof(VDiskSize)); 1302 1302 if (RT_SUCCESS(rc)) 1303 1303 { … … 1338 1338 1339 1339 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offItem, 1340 &VDiskLogSectSize, sizeof(VDiskLogSectSize) , NULL);1340 &VDiskLogSectSize, sizeof(VDiskLogSectSize)); 1341 1341 if (RT_SUCCESS(rc)) 1342 1342 { … … 1373 1373 /* Load the header first. */ 1374 1374 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offRegion, 1375 &MetadataTblHdr, sizeof(MetadataTblHdr) , NULL);1375 &MetadataTblHdr, sizeof(MetadataTblHdr)); 1376 1376 if (RT_SUCCESS(rc)) 1377 1377 { … … 1403 1403 1404 1404 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offMetadataTblEntry, 1405 &MetadataTblEntry, sizeof(MetadataTblEntry) , NULL);1405 &MetadataTblEntry, sizeof(MetadataTblEntry)); 1406 1406 if (RT_FAILURE(rc)) 1407 1407 { … … 1534 1534 { 1535 1535 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_REGION_TBL_HDR_OFFSET, 1536 pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX , NULL);1536 pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX); 1537 1537 if (RT_SUCCESS(rc)) 1538 1538 { … … 1664 1664 AssertPtrReturn(pImage->pIfIo, VERR_INVALID_PARAMETER); 1665 1665 1666 #if 01667 1666 /* Refuse write access, it is not implemented so far. */ 1668 1667 if (!(uOpenFlags & VD_OPEN_FLAGS_READONLY)) 1669 1668 return VERR_NOT_SUPPORTED; 1670 #endif1671 1669 1672 1670 /* … … 1688 1686 { 1689 1687 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_FILE_IDENTIFIER_OFFSET, 1690 &FileIdentifier, sizeof(FileIdentifier) , NULL);1688 &FileIdentifier, sizeof(FileIdentifier)); 1691 1689 if (RT_SUCCESS(rc)) 1692 1690 { … … 1748 1746 { 1749 1747 rc = vdIfIoIntFileReadSync(pIfIo, pStorage, VHDX_FILE_IDENTIFIER_OFFSET, 1750 &FileIdentifier, sizeof(FileIdentifier) , NULL);1748 &FileIdentifier, sizeof(FileIdentifier)); 1751 1749 if (RT_SUCCESS(rc)) 1752 1750 { … … 1905 1903 uint64_t offFile = VHDX_BAT_ENTRY_GET_FILE_OFFSET(uBatEntry) + offRead; 1906 1904 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offFile, 1907 pvBuf, cbToRead , NULL);1905 pvBuf, cbToRead); 1908 1906 break; 1909 1907 } -
trunk/src/VBox/Storage/VMDK.cpp
r44232 r44233 695 695 { 696 696 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 697 uOffset, pMarker, RT_OFFSETOF(VMDKMARKER, uType), 698 NULL); 697 uOffset, pMarker, RT_OFFSETOF(VMDKMARKER, uType)); 699 698 if (RT_FAILURE(rc)) 700 699 return rc; … … 728 727 + RT_OFFSETOF(VMDKMARKER, uType), 729 728 512) 730 - RT_OFFSETOF(VMDKMARKER, uType) , NULL);729 - RT_OFFSETOF(VMDKMARKER, uType)); 731 730 732 731 if (puLBA) … … 838 837 - RT_OFFSETOF(VMDKMARKER, uType)); 839 838 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 840 uOffset, pMarker, uSize , NULL);839 uOffset, pMarker, uSize); 841 840 if (RT_FAILURE(rc)) 842 841 return rc; … … 1076 1075 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 1077 1076 VMDK_SECTOR2BYTE(pExtent->uSectorGD), 1078 pExtent->pGD, cbGD , NULL);1077 pExtent->pGD, cbGD); 1079 1078 AssertRC(rc); 1080 1079 if (RT_FAILURE(rc)) … … 1093 1092 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 1094 1093 VMDK_SECTOR2BYTE(pExtent->uSectorRGD), 1095 pExtent->pRGD, cbGD , NULL);1094 pExtent->pRGD, cbGD); 1096 1095 AssertRC(rc); 1097 1096 if (RT_FAILURE(rc)) … … 1213 1212 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 1214 1213 VMDK_SECTOR2BYTE(uGTStart), 1215 pTmpGT1, cbGTRead , NULL);1214 pTmpGT1, cbGTRead); 1216 1215 if (RT_FAILURE(rc)) 1217 1216 { … … 1224 1223 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 1225 1224 VMDK_SECTOR2BYTE(uRGTStart), 1226 pTmpGT2, cbGTRead , NULL);1225 pTmpGT2, cbGTRead); 1227 1226 if (RT_FAILURE(rc)) 1228 1227 { … … 1331 1330 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 1332 1331 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + i * sizeof(uGTSectorLE), 1333 &uGTSectorLE, sizeof(uGTSectorLE) , NULL);1332 &uGTSectorLE, sizeof(uGTSectorLE)); 1334 1333 if (RT_FAILURE(rc)) 1335 1334 { … … 1349 1348 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 1350 1349 VMDK_SECTOR2BYTE(pExtent->uSectorGD) + i * sizeof(uGTSectorLE), 1351 &uGTSectorLE, sizeof(uGTSectorLE) , NULL);1350 &uGTSectorLE, sizeof(uGTSectorLE)); 1352 1351 if (RT_FAILURE(rc)) 1353 1352 { … … 2462 2461 { 2463 2462 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pDescFile->pStorage, uOffset, 2464 pvDescriptor, cbLimit ? cbLimit : cbDescriptor , NULL);2463 pvDescriptor, cbLimit ? cbLimit : cbDescriptor); 2465 2464 if (RT_FAILURE(rc)) 2466 2465 rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename); … … 2515 2514 if (RT_SUCCESS(rc)) 2516 2515 { 2517 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pDescFile->pStorage,2518 2519 2520 2516 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pDescFile->pStorage, 2517 uOffset, pvDescriptor, 2518 cbLimit ? cbLimit : cbDescriptor, 2519 pIoCtx, NULL, NULL); 2521 2520 if ( RT_FAILURE(rc) 2522 2521 && rc != VERR_VD_ASYNC_IO_IN_PROGRESS) … … 2581 2580 if (!fMagicAlreadyRead) 2582 2581 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 0, 2583 &Header, sizeof(Header) , NULL);2582 &Header, sizeof(Header)); 2584 2583 else 2585 2584 { … … 2589 2588 &Header.version, 2590 2589 sizeof(Header) 2591 - RT_OFFSETOF(SparseExtentHeader, version), 2592 NULL); 2590 - RT_OFFSETOF(SparseExtentHeader, version)); 2593 2591 } 2594 2592 AssertRC(rc); … … 2630 2628 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 2631 2629 cbFile - 2*512, &Header, 2632 sizeof(Header) , NULL);2630 sizeof(Header)); 2633 2631 AssertRC(rc); 2634 2632 if (RT_FAILURE(rc)) … … 2835 2833 2836 2834 int rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 2837 uOffset, &Header, sizeof(Header) , NULL);2835 uOffset, &Header, sizeof(Header)); 2838 2836 AssertRC(rc); 2839 2837 if (RT_FAILURE(rc)) … … 2897 2895 Header.compressAlgorithm = RT_H2LE_U16(pExtent->uCompression); 2898 2896 2899 int rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,2900 2901 2897 int rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 2898 uOffset, &Header, sizeof(Header), 2899 pIoCtx, NULL, NULL); 2902 2900 if (RT_FAILURE(rc) && (rc != VERR_VD_ASYNC_IO_IN_PROGRESS)) 2903 2901 rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error writing extent header in '%s'"), pExtent->pszFullname); … … 2917 2915 2918 2916 int rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 0, 2919 &Header, sizeof(Header) , NULL);2917 &Header, sizeof(Header)); 2920 2918 AssertRC(rc); 2921 2919 if (RT_FAILURE(rc)) … … 3130 3128 /* Read magic (if present). */ 3131 3129 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pFile->pStorage, 0, 3132 &u32Magic, sizeof(u32Magic) , NULL);3130 &u32Magic, sizeof(u32Magic)); 3133 3131 if (RT_FAILURE(rc)) 3134 3132 { … … 3188 3186 VMDK_SECTOR2BYTE(pExtent->uDescriptorSector), 3189 3187 pExtent->pDescData, 3190 VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors) , NULL);3188 VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors)); 3191 3189 AssertRC(rc); 3192 3190 if (RT_FAILURE(rc)) … … 3255 3253 * image if it's a descriptor based one. */ 3256 3254 memcpy(pImage->pDescData, &u32Magic, sizeof(u32Magic)); 3257 size_t cbRead;3258 3255 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pFile->pStorage, sizeof(u32Magic), 3259 3256 pImage->pDescData + sizeof(u32Magic), 3260 3257 RT_MIN(pImage->cbDescAlloc - sizeof(u32Magic), 3261 cbFileSize - sizeof(u32Magic)), 3262 &cbRead); 3258 cbFileSize - sizeof(u32Magic))); 3263 3259 if (RT_FAILURE(rc)) 3264 3260 { … … 3266 3262 goto out; 3267 3263 } 3264 3265 #if 0 /** @todo: Revisit */ 3268 3266 cbRead += sizeof(u32Magic); 3269 3267 if (cbRead == pImage->cbDescAlloc) … … 3274 3272 goto out; 3275 3273 } 3274 #endif 3276 3275 3277 3276 rc = vmdkParseDescriptor(pImage, pImage->pDescData, … … 3631 3630 VMDK_SECTOR2BYTE(uPartOffset), 3632 3631 pPart->pvPartitionData, 3633 pPart->cbData , NULL);3632 pPart->cbData); 3634 3633 if (RT_FAILURE(rc)) 3635 3634 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: could not write partition data to '%s'"), pExtent->pszFullname); … … 3835 3834 3836 3835 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 3837 uOff, pvBuf, cbChunk , NULL);3836 uOff, pvBuf, cbChunk); 3838 3837 if (RT_FAILURE(rc)) 3839 3838 { … … 4314 4313 pMarker->uType = RT_H2LE_U32(VMDK_MARKER_GT); 4315 4314 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, uFileOffset, 4316 aMarker, sizeof(aMarker) , NULL);4315 aMarker, sizeof(aMarker)); 4317 4316 AssertRC(rc); 4318 4317 uFileOffset += 512; … … 4333 4332 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, uFileOffset, 4334 4333 &pImage->pGTCache->aGTCache[i].aGTData[0], 4335 VMDK_GT_CACHELINE_SIZE * sizeof(uint32_t), 4336 NULL); 4334 VMDK_GT_CACHELINE_SIZE * sizeof(uint32_t)); 4337 4335 uFileOffset += VMDK_GT_CACHELINE_SIZE * sizeof(uint32_t); 4338 4336 if (RT_FAILURE(rc)) … … 4422 4420 pMarker->uType = RT_H2LE_U32(VMDK_MARKER_GD); 4423 4421 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, uFileOffset, 4424 aMarker, sizeof(aMarker) , NULL);4422 aMarker, sizeof(aMarker)); 4425 4423 AssertRC(rc); 4426 4424 uFileOffset += 512; … … 4433 4431 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4434 4432 uFileOffset, pExtent->pGD, 4435 pExtent->cGDEntries * sizeof(uint32_t), 4436 NULL); 4433 pExtent->cGDEntries * sizeof(uint32_t)); 4437 4434 AssertRC(rc); 4438 4435 … … 4448 4445 pMarker->uType = RT_H2LE_U32(VMDK_MARKER_FOOTER); 4449 4446 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4450 uFileOffset, aMarker, sizeof(aMarker) , NULL);4447 uFileOffset, aMarker, sizeof(aMarker)); 4451 4448 AssertRC(rc); 4452 4449 … … 4459 4456 memset(pMarker, '\0', sizeof(aMarker)); 4460 4457 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4461 uFileOffset, aMarker, sizeof(aMarker) , NULL);4458 uFileOffset, aMarker, sizeof(aMarker)); 4462 4459 AssertRC(rc); 4463 4460 } … … 4667 4664 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 4668 4665 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 4669 aGTDataTmp, sizeof(aGTDataTmp) , NULL);4666 aGTDataTmp, sizeof(aGTDataTmp)); 4670 4667 if (RT_FAILURE(rc)) 4671 4668 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot read grain table entry in '%s'"), pExtent->pszFullname); … … 4719 4716 /* Cache miss, fetch data from disk. */ 4720 4717 PVDMETAXFER pMetaXfer; 4721 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,4722 4723 4718 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pExtent->pFile->pStorage, 4719 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 4720 aGTDataTmp, sizeof(aGTDataTmp), pIoCtx, &pMetaXfer, NULL, NULL); 4724 4721 if (RT_FAILURE(rc)) 4725 4722 return rc; … … 4797 4794 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4798 4795 VMDK_SECTOR2BYTE(uGTSector) + i * sizeof(aGTDataTmp), 4799 aGTDataTmp, sizeof(aGTDataTmp) , NULL);4796 aGTDataTmp, sizeof(aGTDataTmp)); 4800 4797 if (RT_FAILURE(rc)) 4801 4798 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write grain table allocation in '%s'"), pExtent->pszFullname); … … 4832 4829 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4833 4830 VMDK_SECTOR2BYTE(uRGTSector) + i * sizeof(aGTDataTmp), 4834 aGTDataTmp, sizeof(aGTDataTmp) , NULL);4831 aGTDataTmp, sizeof(aGTDataTmp)); 4835 4832 if (RT_FAILURE(rc)) 4836 4833 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain table allocation in '%s'"), pExtent->pszFullname); … … 4848 4845 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4849 4846 VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE), 4850 &uGTSectorLE, sizeof(uGTSectorLE) , NULL);4847 &uGTSectorLE, sizeof(uGTSectorLE)); 4851 4848 if (RT_FAILURE(rc)) 4852 4849 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write grain directory entry in '%s'"), pExtent->pszFullname); … … 4856 4853 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4857 4854 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uRGTSectorLE), 4858 &uRGTSectorLE, sizeof(uRGTSectorLE) , NULL);4855 &uRGTSectorLE, sizeof(uRGTSectorLE)); 4859 4856 if (RT_FAILURE(rc)) 4860 4857 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain directory entry in '%s'"), pExtent->pszFullname); … … 4897 4894 { 4898 4895 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4899 uFileOffset, pvBuf, cbWrite , NULL);4896 uFileOffset, pvBuf, cbWrite); 4900 4897 if (RT_FAILURE(rc)) 4901 4898 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write allocated data block in '%s'"), pExtent->pszFullname); … … 4913 4910 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 4914 4911 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 4915 aGTDataTmp, sizeof(aGTDataTmp) , NULL);4912 aGTDataTmp, sizeof(aGTDataTmp)); 4916 4913 if (RT_FAILURE(rc)) 4917 4914 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot read allocated grain table entry in '%s'"), pExtent->pszFullname); … … 4934 4931 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4935 4932 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 4936 aGTDataTmp, sizeof(aGTDataTmp) , NULL);4933 aGTDataTmp, sizeof(aGTDataTmp)); 4937 4934 if (RT_FAILURE(rc)) 4938 4935 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write updated grain table in '%s'"), pExtent->pszFullname); … … 4942 4939 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 4943 4940 VMDK_SECTOR2BYTE(uRGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 4944 aGTDataTmp, sizeof(aGTDataTmp) , NULL);4941 aGTDataTmp, sizeof(aGTDataTmp)); 4945 4942 if (RT_FAILURE(rc)) 4946 4943 return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write updated backup grain table in '%s'"), pExtent->pszFullname); … … 5088 5085 LogFlow(("Cache miss, fetch data from disk\n")); 5089 5086 PVDMETAXFER pMetaXfer = NULL; 5090 rc = vdIfIoIntFileReadMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5091 5092 5093 5087 rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5088 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 5089 aGTDataTmp, sizeof(aGTDataTmp), pIoCtx, 5090 &pMetaXfer, vmdkAllocGrainAsyncComplete, pGrainAlloc); 5094 5091 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5095 5092 { … … 5120 5117 pGTCacheEntry->aGTData[uGTBlockIndex] = VMDK_BYTE2SECTOR(pGrainAlloc->uGrainOffset); 5121 5118 /* Update grain table on disk. */ 5122 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5123 5124 5125 5119 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5120 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 5121 aGTDataTmp, sizeof(aGTDataTmp), pIoCtx, 5122 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5126 5123 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5127 5124 pGrainAlloc->cIoXfersPending++; … … 5131 5128 { 5132 5129 /* Update backup grain table on disk. */ 5133 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5134 5135 5136 5130 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5131 VMDK_SECTOR2BYTE(uRGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 5132 aGTDataTmp, sizeof(aGTDataTmp), pIoCtx, 5133 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5137 5134 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5138 5135 pGrainAlloc->cIoXfersPending++; … … 5248 5245 5249 5246 memset(paGTDataTmp, '\0', cbGTDataTmp); 5250 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5251 5252 5253 5247 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5248 VMDK_SECTOR2BYTE(uGTSector), 5249 paGTDataTmp, cbGTDataTmp, pIoCtx, 5250 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5254 5251 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5255 5252 pGrainAlloc->cIoXfersPending++; … … 5283 5280 * cache chunks. Allocate memory dynamically here or we flood the 5284 5281 * metadata cache with very small entries. */ 5285 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5286 5287 5288 5282 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5283 VMDK_SECTOR2BYTE(uRGTSector), 5284 paGTDataTmp, cbGTDataTmp, pIoCtx, 5285 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5289 5286 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5290 5287 pGrainAlloc->cIoXfersPending++; … … 5305 5302 * some unused sectors in the extent. */ 5306 5303 uint32_t uGTSectorLE = RT_H2LE_U64(uGTSector); 5307 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5308 5309 5310 5304 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5305 VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE), 5306 &uGTSectorLE, sizeof(uGTSectorLE), pIoCtx, 5307 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5311 5308 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5312 5309 pGrainAlloc->cIoXfersPending++; … … 5316 5313 { 5317 5314 uint32_t uRGTSectorLE = RT_H2LE_U64(uRGTSector); 5318 rc = vdIfIoIntFileWriteMeta Async(pImage->pIfIo, pExtent->pFile->pStorage,5319 5320 5321 5315 rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage, 5316 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uGTSectorLE), 5317 &uRGTSectorLE, sizeof(uRGTSectorLE), pIoCtx, 5318 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5322 5319 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5323 5320 pGrainAlloc->cIoXfersPending++; … … 5344 5341 5345 5342 /* Write the data. Always a full grain, or we're in big trouble. */ 5346 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pExtent->pFile->pStorage,5347 5348 5343 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pExtent->pFile->pStorage, 5344 uFileOffset, pIoCtx, cbWrite, 5345 vmdkAllocGrainAsyncComplete, pGrainAlloc); 5349 5346 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 5350 5347 pGrainAlloc->cIoXfersPending++; … … 5407 5404 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 5408 5405 VMDK_SECTOR2BYTE(uGrainSectorAbs), 5409 &Marker, RT_OFFSETOF(VMDKMARKER, uType), 5410 NULL); 5406 &Marker, RT_OFFSETOF(VMDKMARKER, uType)); 5411 5407 if (RT_FAILURE(rc)) 5412 5408 return rc; … … 5420 5416 VMDK_SECTOR2BYTE(uGrainSectorAbs) 5421 5417 + RT_OFFSETOF(VMDKMARKER, uType), 5422 &Marker.uType, sizeof(Marker.uType), 5423 NULL); 5418 &Marker.uType, sizeof(Marker.uType)); 5424 5419 if (RT_FAILURE(rc)) 5425 5420 return rc; … … 5437 5432 VMDK_SECTOR2BYTE(uGrainSectorAbs) 5438 5433 + 511, 5439 &Marker.uSector, 1 , NULL);5434 &Marker.uSector, 1); 5440 5435 break; 5441 5436 case VMDK_MARKER_GT: … … 6123 6118 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 6124 6119 VMDK_SECTOR2BYTE(uSectorExtentAbs), 6125 pvBuf, cbToRead , NULL);6120 pvBuf, cbToRead); 6126 6121 } 6127 6122 } … … 6131 6126 rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 6132 6127 VMDK_SECTOR2BYTE(uSectorExtentRel), 6133 pvBuf, cbToRead , NULL);6128 pvBuf, cbToRead); 6134 6129 break; 6135 6130 case VMDKETYPE_ZERO: … … 6265 6260 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 6266 6261 VMDK_SECTOR2BYTE(uSectorExtentAbs), 6267 pvBuf, cbToWrite , NULL);6262 pvBuf, cbToWrite); 6268 6263 } 6269 6264 } … … 6275 6270 rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, 6276 6271 VMDK_SECTOR2BYTE(uSectorExtentRel), 6277 pvBuf, cbToWrite , NULL);6272 pvBuf, cbToWrite); 6278 6273 break; 6279 6274 case VMDKETYPE_ZERO: … … 6938 6933 { 6939 6934 AssertMsg(!(pImage->uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED), ("Async I/O is not supported for stream optimized VMDK's\n")); 6940 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pExtent->pFile->pStorage,6941 6942 6935 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pExtent->pFile->pStorage, 6936 VMDK_SECTOR2BYTE(uSectorExtentAbs), 6937 pIoCtx, cbRead); 6943 6938 } 6944 6939 break; 6945 6940 case VMDKETYPE_VMFS: 6946 6941 case VMDKETYPE_FLAT: 6947 rc = vdIfIoIntFileReadUser Async(pImage->pIfIo, pExtent->pFile->pStorage,6948 6949 6942 rc = vdIfIoIntFileReadUser(pImage->pIfIo, pExtent->pFile->pStorage, 6943 VMDK_SECTOR2BYTE(uSectorExtentRel), 6944 pIoCtx, cbRead); 6950 6945 break; 6951 6946 case VMDKETYPE_ZERO: … … 7063 7058 { 7064 7059 Assert(!(pImage->uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED)); 7065 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pExtent->pFile->pStorage,7066 7067 7060 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pExtent->pFile->pStorage, 7061 VMDK_SECTOR2BYTE(uSectorExtentAbs), 7062 pIoCtx, cbWrite, NULL, NULL); 7068 7063 } 7069 7064 break; … … 7072 7067 /* Clip write range to remain in this extent. */ 7073 7068 cbWrite = RT_MIN(cbWrite, VMDK_SECTOR2BYTE(pExtent->uSectorOffset + pExtent->cNominalSectors - uSectorExtentRel)); 7074 rc = vdIfIoIntFileWriteUser Async(pImage->pIfIo, pExtent->pFile->pStorage,7075 7076 7069 rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pExtent->pFile->pStorage, 7070 VMDK_SECTOR2BYTE(uSectorExtentRel), 7071 pIoCtx, cbWrite, NULL, NULL); 7077 7072 break; 7078 7073 case VMDKETYPE_ZERO: … … 7167 7162 if ( pExtent->pFile != NULL 7168 7163 && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)) 7169 rc = vdIfIoIntFileFlush Async(pImage->pIfIo, pExtent->pFile->pStorage,7170 7164 rc = vdIfIoIntFileFlush(pImage->pIfIo, pExtent->pFile->pStorage, 7165 pIoCtx, NULL, NULL); 7171 7166 break; 7172 7167 case VMDKETYPE_ZERO:
Note:
See TracChangeset
for help on using the changeset viewer.