VirtualBox

Changeset 44233 in vbox for trunk/src


Ignore:
Timestamp:
Jan 4, 2013 8:39:56 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83076
Message:

Storage: Preparations for the sync/async I/O unification

Location:
trunk/src/VBox/Storage
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/DMG.cpp

    r44232 r44233  
    438438                                   pInflateState->pImage->pStorage,
    439439                                   pInflateState->uFileOffset,
    440                                    pvBuf, cbBuf, NULL);
     440                                   pvBuf, cbBuf);
    441441    if (RT_FAILURE(rc))
    442442        return rc;
     
    13941394    rc = vdIfIoIntFileReadSync(pThis->pIfIo, pThis->pStorage,
    13951395                               pThis->cbFile - sizeof(pThis->Ftr),
    1396                                &pThis->Ftr, sizeof(pThis->Ftr), NULL);
     1396                               &pThis->Ftr, sizeof(pThis->Ftr));
    13971397    if (RT_FAILURE(rc))
    13981398        return rc;
     
    14251425        return VERR_NO_MEMORY;
    14261426    rc = vdIfIoIntFileReadSync(pThis->pIfIo, pThis->pStorage, pThis->Ftr.offXml,
    1427                                pszXml, cchXml, NULL);
     1427                               pszXml, cchXml);
    14281428    if (RT_SUCCESS(rc))
    14291429    {
     
    15151515    {
    15161516        offFtr = cbFile - sizeof(Ftr);
    1517         rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offFtr, &Ftr, sizeof(Ftr), NULL);
     1517        rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offFtr, &Ftr, sizeof(Ftr));
    15181518    }
    15191519    else
     
    16941694                rc = vdIfIoIntFileReadSync(pThis->pIfIo, pThis->pStorage,
    16951695                                           pExtent->offFileStart + DMG_BLOCK2BYTE(uExtentRel),
    1696                                            pvBuf, cbToRead, NULL);
     1696                                           pvBuf, cbToRead);
    16971697                break;
    16981698            }
  • trunk/src/VBox/Storage/Parallels.cpp

    r44232 r44233  
    128128        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    129129                                    sizeof(ParallelsHeader), pImage->pAllocationBitmap,
    130                                     pImage->cAllocationBitmapEntries * sizeof(uint32_t),
    131                                     NULL);
     130                                    pImage->cAllocationBitmapEntries * sizeof(uint32_t));
    132131        if (RT_FAILURE(rc))
    133132            return rc;
     
    198197
    199198    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0,
    200                                &parallelsHeader, sizeof(parallelsHeader), NULL);
     199                               &parallelsHeader, sizeof(parallelsHeader));
    201200    if (RT_FAILURE(rc))
    202201        goto out;
     
    248247        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    249248                                   sizeof(ParallelsHeader), pImage->pAllocationBitmap,
    250                                    pImage->cAllocationBitmapEntries * sizeof(uint32_t),
    251                                    NULL);
     249                                   pImage->cAllocationBitmapEntries * sizeof(uint32_t));
    252250        if (RT_FAILURE(rc))
    253251            goto out;
     
    342340        if (RT_SUCCESS(rc))
    343341            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0,
    344                                         &Header, sizeof(Header), NULL);
     342                                        &Header, sizeof(Header));
    345343        if (RT_SUCCESS(rc))
    346344            rc = parallelsFlushImage(pImage); /* Writes the allocation bitmap. */
     
    375373
    376374    rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &parallelsHeader,
    377                                sizeof(ParallelsHeader), NULL);
     375                               sizeof(ParallelsHeader));
    378376    if (RT_SUCCESS(rc))
    379377    {
     
    617615
    618616    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);
    620618    else
    621619    {
     
    646644            LogFlowFunc(("uOffsetInFile=%llu\n", uOffsetInFile));
    647645            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffsetInFile,
    648                                        pvBuf, cbToRead, NULL);
     646                                       pvBuf, cbToRead);
    649647        }
    650648    }
     
    675673    if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED)
    676674        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset,
    677                                     pvBuf, cbToWrite, NULL);
     675                                    pvBuf, cbToWrite);
    678676    else
    679677    {
     
    720718                 */
    721719                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    722                                             uOffsetInFile, pvBuf, cbToWrite, NULL);
     720                                            uOffsetInFile, pvBuf, cbToWrite);
    723721            }
    724722            else
     
    737735            LogFlowFunc(("uOffsetInFile=%llu\n", uOffsetInFile));
    738736            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffsetInFile,
    739                                         pvBuf, cbToWrite, NULL);
     737                                        pvBuf, cbToWrite);
    740738        }
    741739    }
     
    12201218
    12211219    if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED)
    1222         rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, uOffset,
    1223                                         pIoCtx, cbToRead);
     1220        rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset,
     1221                                   pIoCtx, cbToRead);
    12241222    else
    12251223    {
     
    12391237        {
    12401238            uOffsetInFile = (pImage->pAllocationBitmap[iIndexInAllocationTable] + uSector) * 512;
    1241             rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, uOffsetInFile,
    1242                                             pIoCtx, cbToRead);
     1239            rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffsetInFile,
     1240                                       pIoCtx, cbToRead);
    12431241        }
    12441242    }
     
    12691267
    12701268    if (pImage->uImageFlags & VD_IMAGE_FLAGS_FIXED)
    1271         rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage, uOffset,
    1272                                          pIoCtx, cbToWrite, NULL, NULL);
     1269        rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, uOffset,
     1270                                    pIoCtx, cbToWrite, NULL, NULL);
    12731271    else
    12741272    {
     
    13041302             * Write the new block at the current end of the file.
    13051303             */
    1306             rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    1307                                              uOffsetInFile, pIoCtx, cbToWrite, NULL, NULL);
     1304            rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     1305                                        uOffsetInFile, pIoCtx, cbToWrite, NULL, NULL);
    13081306            if (RT_SUCCESS(rc) || (rc == VERR_VD_ASYNC_IO_IN_PROGRESS))
    13091307            {
    13101308                /* Write the changed allocation bitmap entry. */
    13111309                /** @todo: Error handling. */
    1312                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1313                                                  sizeof(ParallelsHeader) + iIndexInAllocationTable * sizeof(uint32_t),
    1314                                                  &pImage->pAllocationBitmap[iIndexInAllocationTable],
    1315                                                  sizeof(uint32_t), pIoCtx,
    1316                                                  NULL, NULL);
     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);
    13171315            }
    13181316
     
    13231321        {
    13241322            uOffsetInFile = (pImage->pAllocationBitmap[iIndexInAllocationTable] + uSector) * 512;
    1325             rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    1326                                              uOffsetInFile, pIoCtx, cbToWrite, NULL, NULL);
     1323            rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     1324                                        uOffsetInFile, pIoCtx, cbToWrite, NULL, NULL);
    13271325        }
    13281326    }
     
    13441342
    13451343    /* Flush the file, everything is up to date already. */
    1346     rc = vdIfIoIntFileFlushAsync(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL);
     1344    rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL);
    13471345
    13481346    LogFlowFunc(("returns %Rrc\n", rc));
  • trunk/src/VBox/Storage/QCOW.cpp

    r44232 r44233  
    705705            pL2Entry->offL2Tbl = offL2Tbl;
    706706            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offL2Tbl,
    707                                        pL2Entry->paL2Tbl, pImage->cbL2Table, NULL);
     707                                       pL2Entry->paL2Tbl, pImage->cbL2Table);
    708708            if (RT_SUCCESS(rc))
    709709            {
     
    757757
    758758            pL2Entry->offL2Tbl = offL2Tbl;
    759             rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pImage->pStorage,
    760                                             offL2Tbl, pL2Entry->paL2Tbl,
    761                                             pImage->cbL2Table, pIoCtx,
    762                                             &pMetaXfer, NULL, NULL);
     759            rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage,
     760                                       offL2Tbl, pL2Entry->paL2Tbl,
     761                                       pImage->cbL2Table, pIoCtx,
     762                                       &pMetaXfer, NULL, NULL);
    763763            if (RT_SUCCESS(rc))
    764764            {
     
    10181018            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    10191019                                        pImage->offL1Table, paL1TblImg,
    1020                                         pImage->cbL1Table, NULL);
     1020                                        pImage->cbL1Table);
    10211021            RTMemFree(paL1TblImg);
    10221022        }
     
    10261026        /* Write L1 table directly. */
    10271027        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offL1Table,
    1028                                     pImage->paL1Table, pImage->cbL1Table, NULL);
     1028                                    pImage->paL1Table, pImage->cbL1Table);
    10291029#endif
    10301030        if (RT_SUCCESS(rc))
     
    10341034            qcowHdrConvertFromHostEndianess(pImage, &Header, &cbHeader);
    10351035            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, &Header,
    1036                                         cbHeader, NULL);
     1036                                        cbHeader);
    10371037            if (RT_SUCCESS(rc))
    10381038                rc = vdIfIoIntFileFlushSync(pImage->pIfIo, pImage->pStorage);
     
    10651065            qcowTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table,
    10661066                                             pImage->cL1TableEntries);
    1067             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1068                                              pImage->offL1Table, paL1TblImg,
    1069                                              pImage->cbL1Table, pIoCtx, NULL, NULL);
     1067            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1068                                        pImage->offL1Table, paL1TblImg,
     1069                                        pImage->cbL1Table, pIoCtx, NULL, NULL);
    10701070            RTMemFree(paL1TblImg);
    10711071        }
     
    10741074#else
    10751075        /* Write L1 table directly. */
    1076         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1077                                          pImage->offL1Table, pImage->paL1Table,
    1078                                          pImage->cbL1Table, pIoCtx, NULL, NULL);
     1076        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1077                                    pImage->offL1Table, pImage->paL1Table,
     1078                                    pImage->cbL1Table, pIoCtx, NULL, NULL);
    10791079#endif
    10801080        if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
     
    10831083            size_t cbHeader = 0;
    10841084            qcowHdrConvertFromHostEndianess(pImage, &Header, &cbHeader);
    1085             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1086                                              0, &Header, cbHeader,
    1087                                              pIoCtx, NULL, NULL);
     1085            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1086                                        0, &Header, cbHeader,
     1087                                        pIoCtx, NULL, NULL);
    10881088            if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    1089                 rc = vdIfIoIntFileFlushAsync(pImage->pIfIo, pImage->pStorage,
    1090                                              pIoCtx, NULL, NULL);
     1089                rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage,
     1090                                        pIoCtx, NULL, NULL);
    10911091        }
    10921092    }
     
    11671167    if (cbFile > sizeof(Header))
    11681168    {
    1169         rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header), NULL);
     1169        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header));
    11701170        if (   RT_SUCCESS(rc)
    11711171            && qcowHdrConvertToHostEndianess(&Header))
     
    12471247                    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    12481248                                               pImage->offBackingFilename, pImage->pszBackingFilename,
    1249                                                pImage->cbBackingFilename, NULL);
     1249                                               pImage->cbBackingFilename);
    12501250                }
    12511251                else
     
    12641264                    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    12651265                                               pImage->offRefcountTable, pImage->paRefcountTable,
    1266                                                pImage->cbRefcountTable, NULL);
     1266                                               pImage->cbRefcountTable);
    12671267                    if (RT_SUCCESS(rc))
    12681268                        qcowTableConvertToHostEndianess(pImage->paRefcountTable,
     
    12901290                    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    12911291                                               pImage->offL1Table, pImage->paL1Table,
    1292                                                pImage->cbL1Table, NULL);
     1292                                               pImage->cbL1Table);
    12931293                    if (RT_SUCCESS(rc))
    12941294                        qcowTableConvertToHostEndianess(pImage->paL1Table, pImage->cL1TableEntries);
     
    14691469            /* Update the link in the on disk L1 table now. */
    14701470            pClusterAlloc->enmAllocState = QCOWCLUSTERASYNCALLOCSTATE_L2_LINK;
    1471             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1472                                              pImage->offL1Table + pClusterAlloc->idxL1*sizeof(uint64_t),
    1473                                              &offUpdateLe, sizeof(uint64_t), pIoCtx,
    1474                                              qcowAsyncClusterAllocUpdate, pClusterAlloc);
     1471            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1472                                        pImage->offL1Table + pClusterAlloc->idxL1*sizeof(uint64_t),
     1473                                        &offUpdateLe, sizeof(uint64_t), pIoCtx,
     1474                                        qcowAsyncClusterAllocUpdate, pClusterAlloc);
    14751475            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    14761476                break;
     
    14971497
    14981498            /* Write data. */
    1499             rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    1500                                              offData, pIoCtx, pClusterAlloc->cbToWrite,
    1501                                              qcowAsyncClusterAllocUpdate, pClusterAlloc);
     1499            rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     1500                                        offData, pIoCtx, pClusterAlloc->cbToWrite,
     1501                                        qcowAsyncClusterAllocUpdate, pClusterAlloc);
    15021502            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    15031503                break;
     
    15161516
    15171517            /* Link L2 table and update it. */
    1518             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1519                                              pImage->paL1Table[pClusterAlloc->idxL1] + pClusterAlloc->idxL2*sizeof(uint64_t),
    1520                                              &offUpdateLe, sizeof(uint64_t), pIoCtx,
    1521                                              qcowAsyncClusterAllocUpdate, pClusterAlloc);
     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);
    15221522            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    15231523                break;
     
    15811581        QCowHeader Header;
    15821582
    1583         rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header), NULL);
     1583        rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header));
    15841584        if (   RT_SUCCESS(rc)
    15851585            && qcowHdrConvertToHostEndianess(&Header))
     
    18231823        LogFlowFunc(("offFile=%llu\n", offFile));
    18241824        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offFile,
    1825                                    pvBuf, cbToRead, NULL);
     1825                                   pvBuf, cbToRead);
    18261826    }
    18271827
     
    18771877    if (RT_SUCCESS(rc))
    18781878        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offImage,
    1879                                     pvBuf, cbToWrite, NULL);
     1879                                    pvBuf, cbToWrite);
    18801880    else if (rc == VERR_VD_BLOCK_FREE)
    18811881    {
     
    19151915                     */
    19161916                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offL2Tbl,
    1917                                                 pL2Entry->paL2Tbl, pImage->cbL2Table, NULL);
     1917                                                pL2Entry->paL2Tbl, pImage->cbL2Table);
    19181918                    if (RT_FAILURE(rc))
    19191919                        break;
     
    19241924                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    19251925                                                pImage->offL1Table + idxL1*sizeof(uint64_t),
    1926                                                 &idxUpdateLe, sizeof(uint64_t), NULL);
     1926                                                &idxUpdateLe, sizeof(uint64_t));
    19271927                    if (RT_FAILURE(rc))
    19281928                        break;
     
    19381938                    /* Write data. */
    19391939                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    1940                                                 offData, pvBuf, cbToWrite, NULL);
     1940                                                offData, pvBuf, cbToWrite);
    19411941                    if (RT_FAILURE(rc))
    19421942                        break;
     
    19471947                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    19481948                                                pImage->paL1Table[idxL1] + idxL2*sizeof(uint64_t),
    1949                                                 &idxUpdateLe, sizeof(uint64_t), NULL);
     1949                                                &idxUpdateLe, sizeof(uint64_t));
    19501950                    qcowL2TblCacheEntryRelease(pL2Entry);
    19511951                }
     
    24932493                                                pImage->offBackingFilename,
    24942494                                                pImage->pszBackingFilename,
    2495                                                 strlen(pImage->pszBackingFilename),
    2496                                                 NULL);
     2495                                                strlen(pImage->pszBackingFilename));
    24972496            }
    24982497        }
     
    25432542                                       &offFile);
    25442543    if (RT_SUCCESS(rc))
    2545         rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, offFile,
    2546                                         pIoCtx, cbToRead);
     2544        rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, offFile,
     2545                                   pIoCtx, cbToRead);
    25472546
    25482547    if (   (   RT_SUCCESS(rc)
     
    26052604                                      &offImage);
    26062605    if (RT_SUCCESS(rc))
    2607         rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2608                                          offImage, pIoCtx, cbToWrite, NULL, NULL);
     2606        rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2607                                    offImage, pIoCtx, cbToWrite, NULL, NULL);
    26092608    else if (rc == VERR_VD_BLOCK_FREE)
    26102609    {
     
    26612660                     * is a leak of some clusters.
    26622661                     */
    2663                     rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    2664                                                      offL2Tbl, pL2Entry->paL2Tbl, pImage->cbL2Table, pIoCtx,
    2665                                                      qcowAsyncClusterAllocUpdate, pL2ClusterAlloc);
     2662                    rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     2663                                                offL2Tbl, pL2Entry->paL2Tbl, pImage->cbL2Table, pIoCtx,
     2664                                                qcowAsyncClusterAllocUpdate, pL2ClusterAlloc);
    26662665                    if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    26672666                        break;
     
    27042703
    27052704                        /* Write data. */
    2706                         rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2707                                                          offData, pIoCtx, cbToWrite,
    2708                                                          qcowAsyncClusterAllocUpdate, pDataClusterAlloc);
     2705                        rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2706                                                    offData, pIoCtx, cbToWrite,
     2707                                                    qcowAsyncClusterAllocUpdate, pDataClusterAlloc);
    27092708                        if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    27102709                            break;
  • trunk/src/VBox/Storage/QED.cpp

    r44232 r44233  
    581581            pL2Entry->offL2Tbl = offL2Tbl;
    582582            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offL2Tbl,
    583                                        pL2Entry->paL2Tbl, pImage->cbTable, NULL);
     583                                       pL2Entry->paL2Tbl, pImage->cbTable);
    584584            if (RT_SUCCESS(rc))
    585585            {
     
    633633
    634634            pL2Entry->offL2Tbl = offL2Tbl;
    635             rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pImage->pStorage,
    636                                             offL2Tbl, pL2Entry->paL2Tbl,
    637                                             pImage->cbTable, pIoCtx,
    638                                             &pMetaXfer, NULL, NULL);
     635            rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage,
     636                                       offL2Tbl, pL2Entry->paL2Tbl,
     637                                       pImage->cbTable, pIoCtx,
     638                                       &pMetaXfer, NULL, NULL);
    639639            if (RT_SUCCESS(rc))
    640640            {
     
    882882        /* Write L1 table directly. */
    883883        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offL1Table,
    884                                     pImage->paL1Table, pImage->cbTable, NULL);
     884                                    pImage->paL1Table, pImage->cbTable);
    885885#endif
    886886        if (RT_SUCCESS(rc))
     
    889889            qedHdrConvertFromHostEndianess(pImage, &Header);
    890890            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, &Header,
    891                                         sizeof(Header), NULL);
     891                                        sizeof(Header));
    892892            if (RT_SUCCESS(rc))
    893893                rc = vdIfIoIntFileFlushSync(pImage->pIfIo, pImage->pStorage);
     
    921921            qedTableConvertFromHostEndianess(paL1TblImg, pImage->paL1Table,
    922922                                             pImage->cTableEntries);
    923             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    924                                              pImage->offL1Table, paL1TblImg,
    925                                              pImage->cbTable, pIoCtx, NULL, NULL);
     923            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     924                                        pImage->offL1Table, paL1TblImg,
     925                                        pImage->cbTable, pIoCtx, NULL, NULL);
    926926            RTMemFree(paL1TblImg);
    927927        }
     
    930930#else
    931931        /* Write L1 table directly. */
    932         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    933                                          pImage->offL1Table, pImage->paL1Table,
    934                                          pImage->cbTable, pIoCtx, NULL, NULL);
     932        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     933                                    pImage->offL1Table, pImage->paL1Table,
     934                                    pImage->cbTable, pIoCtx, NULL, NULL);
    935935#endif
    936936        if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
     
    938938            /* Write header. */
    939939            qedHdrConvertFromHostEndianess(pImage, &Header);
    940             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    941                                              0, &Header, sizeof(Header),
    942                                              pIoCtx, NULL, NULL);
     940            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     941                                        0, &Header, sizeof(Header),
     942                                        pIoCtx, NULL, NULL);
    943943            if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    944                 rc = vdIfIoIntFileFlushAsync(pImage->pIfIo, pImage->pStorage,
    945                                              pIoCtx, NULL, NULL);
     944                rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage,
     945                                        pIoCtx, NULL, NULL);
    946946        }
    947947    }
     
    10771077        /* Read L1 table. */
    10781078        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    1079                                    pHeader->u64OffL1Table, paL1Tbl, cbTable, NULL);
     1079                                   pHeader->u64OffL1Table, paL1Tbl, cbTable);
    10801080        if (RT_FAILURE(rc))
    10811081        {
     
    11211121            /* Read the linked L2 table and check it. */
    11221122            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    1123                                        paL1Tbl[iL1], paL2Tbl, cbTable, NULL);
     1123                                       paL1Tbl[iL1], paL2Tbl, cbTable);
    11241124            if (RT_FAILURE(rc))
    11251125            {
     
    12401240    if (cbFile > sizeof(Header))
    12411241    {
    1242         rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header), NULL);
     1242        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0, &Header, sizeof(Header));
    12431243        if (   RT_SUCCESS(rc)
    12441244            && qedHdrConvertToHostEndianess(&Header))
     
    12691269                        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    12701270                                                   Header.u32OffBackingFilename, pImage->pszBackingFilename,
    1271                                                    Header.u32BackingFilenameSize, NULL);
     1271                                                   Header.u32BackingFilenameSize);
    12721272                    }
    12731273                    else
     
    12921292                        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    12931293                                                   pImage->offL1Table, pImage->paL1Table,
    1294                                                    pImage->cbTable, NULL);
     1294                                                   pImage->cbTable);
    12951295                        if (RT_SUCCESS(rc))
    12961296                        {
     
    14831483            /* Update the link in the on disk L1 table now. */
    14841484            pClusterAlloc->enmAllocState = QEDCLUSTERASYNCALLOCSTATE_L2_LINK;
    1485             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1486                                              pImage->offL1Table + pClusterAlloc->idxL1*sizeof(uint64_t),
    1487                                              &offUpdateLe, sizeof(uint64_t), pIoCtx,
    1488                                              qedAsyncClusterAllocUpdate, pClusterAlloc);
     1485            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1486                                        pImage->offL1Table + pClusterAlloc->idxL1*sizeof(uint64_t),
     1487                                        &offUpdateLe, sizeof(uint64_t), pIoCtx,
     1488                                        qedAsyncClusterAllocUpdate, pClusterAlloc);
    14891489            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    14901490                break;
     
    15111511
    15121512            /* Write data. */
    1513             rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    1514                                              offData, pIoCtx, pClusterAlloc->cbToWrite,
    1515                                              qedAsyncClusterAllocUpdate, pClusterAlloc);
     1513            rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     1514                                        offData, pIoCtx, pClusterAlloc->cbToWrite,
     1515                                        qedAsyncClusterAllocUpdate, pClusterAlloc);
    15161516            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    15171517                break;
     
    15301530
    15311531            /* Link L2 table and update it. */
    1532             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1533                                              pImage->paL1Table[pClusterAlloc->idxL1] + pClusterAlloc->idxL2*sizeof(uint64_t),
    1534                                              &offUpdateLe, sizeof(uint64_t), pIoCtx,
    1535                                              qedAsyncClusterAllocUpdate, pClusterAlloc);
     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);
    15361536            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    15371537                break;
     
    15951595        QedHeader Header;
    15961596
    1597         rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header), NULL);
     1597        rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Header, sizeof(Header));
    15981598        if (   RT_SUCCESS(rc)
    15991599            && qedHdrConvertToHostEndianess(&Header))
     
    18371837        LogFlowFunc(("offFile=%llu\n", offFile));
    18381838        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offFile,
    1839                                    pvBuf, cbToRead, NULL);
     1839                                   pvBuf, cbToRead);
    18401840    }
    18411841
     
    18911891    if (RT_SUCCESS(rc))
    18921892        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offImage,
    1893                                     pvBuf, cbToWrite, NULL);
     1893                                    pvBuf, cbToWrite);
    18941894    else if (rc == VERR_VD_BLOCK_FREE)
    18951895    {
     
    19291929                     */
    19301930                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, offL2Tbl,
    1931                                                 pL2Entry->paL2Tbl, pImage->cbTable, NULL);
     1931                                                pL2Entry->paL2Tbl, pImage->cbTable);
    19321932                    if (RT_FAILURE(rc))
    19331933                        break;
     
    19381938                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    19391939                                                pImage->offL1Table + idxL1*sizeof(uint64_t),
    1940                                                 &idxUpdateLe, sizeof(uint64_t), NULL);
     1940                                                &idxUpdateLe, sizeof(uint64_t));
    19411941                    if (RT_FAILURE(rc))
    19421942                        break;
     
    19521952                    /* Write data. */
    19531953                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    1954                                                 offData, pvBuf, cbToWrite, NULL);
     1954                                                offData, pvBuf, cbToWrite);
    19551955                    if (RT_FAILURE(rc))
    19561956                        break;
     
    19611961                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    19621962                                                pImage->paL1Table[idxL1] + idxL2*sizeof(uint64_t),
    1963                                                 &idxUpdateLe, sizeof(uint64_t), NULL);
     1963                                                &idxUpdateLe, sizeof(uint64_t));
    19641964                    qedL2TblCacheEntryRelease(pL2Entry);
    19651965                }
     
    25072507                                                pImage->offBackingFilename,
    25082508                                                pImage->pszBackingFilename,
    2509                                                 strlen(pImage->pszBackingFilename),
    2510                                                 NULL);
     2509                                                strlen(pImage->pszBackingFilename));
    25112510            }
    25122511        }
     
    25572556                                      &offFile);
    25582557    if (RT_SUCCESS(rc))
    2559         rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, offFile,
    2560                                         pIoCtx, cbToRead);
     2558        rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, offFile,
     2559                                   pIoCtx, cbToRead);
    25612560
    25622561    if (   (   RT_SUCCESS(rc)
     
    26192618                                      &offImage);
    26202619    if (RT_SUCCESS(rc))
    2621         rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2622                                          offImage, pIoCtx, cbToWrite, NULL, NULL);
     2620        rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2621                                    offImage, pIoCtx, cbToWrite, NULL, NULL);
    26232622    else if (rc == VERR_VD_BLOCK_FREE)
    26242623    {
     
    26752674                     * is a leak of some clusters.
    26762675                     */
    2677                     rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    2678                                                      offL2Tbl, pL2Entry->paL2Tbl, pImage->cbTable, pIoCtx,
    2679                                                      qedAsyncClusterAllocUpdate, pL2ClusterAlloc);
     2676                    rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     2677                                                offL2Tbl, pL2Entry->paL2Tbl, pImage->cbTable, pIoCtx,
     2678                                                qedAsyncClusterAllocUpdate, pL2ClusterAlloc);
    26802679                    if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    26812680                        break;
     
    27182717
    27192718                        /* Write data. */
    2720                         rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2721                                                          offData, pIoCtx, cbToWrite,
    2722                                                          qedAsyncClusterAllocUpdate, pDataClusterAlloc);
     2719                        rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2720                                                    offData, pIoCtx, cbToWrite,
     2721                                                    qedAsyncClusterAllocUpdate, pDataClusterAlloc);
    27232722                        if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    27242723                            break;
  • trunk/src/VBox/Storage/RAW.cpp

    r44232 r44233  
    147147
    148148                        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    149                                                     uOff, pvBuf, cbChunk, NULL);
     149                                                    uOff, pvBuf, cbChunk);
    150150                        if (RT_FAILURE(rc))
    151151                            goto out;
     
    300300
    301301            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOff,
    302                                         pvBuf, cbChunk, NULL);
     302                                        pvBuf, cbChunk);
    303303            if (RT_FAILURE(rc))
    304304            {
     
    629629
    630630    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf,
    631                                cbToRead, NULL);
     631                               cbToRead);
    632632    pImage->offAccess = uOffset + cbToRead;
    633633    if (pcbActuallyRead)
     
    674674
    675675    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf,
    676                                 cbToWrite, NULL);
     676                                cbToWrite);
    677677    pImage->offAccess = uOffset + cbToWrite;
    678678    if (pcbWriteProcess)
     
    11541154    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
    11551155
    1156     rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, uOffset,
    1157                                     pIoCtx, cbRead);
     1156    rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset,
     1157                               pIoCtx, cbRead);
    11581158    if (RT_SUCCESS(rc))
    11591159        *pcbActuallyRead = cbRead;
     
    11711171    PRAWIMAGE pImage = (PRAWIMAGE)pBackendData;
    11721172
    1173     rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage, uOffset,
    1174                                      pIoCtx, cbWrite, NULL, NULL);
     1173    rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage, uOffset,
     1174                                pIoCtx, cbWrite, NULL, NULL);
    11751175    if (RT_SUCCESS(rc))
    11761176    {
     
    11901190
    11911191    if (!(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    1192         rc = vdIfIoIntFileFlushAsync(pImage->pIfIo, pImage->pStorage, pIoCtx,
    1193                                      NULL, NULL);
     1192        rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx,
     1193                                NULL, NULL);
    11941194
    11951195    return rc;
  • trunk/src/VBox/Storage/VCICache.cpp

    r40843 r44233  
    536536
    537537        rc = vdIfIoIntFileReadSync(pStorage->pIfIo, pStorage->pStorage, offBlkMap,
    538                                    &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap)), NULL);
     538                                   &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap)));
    539539        if (RT_SUCCESS(rc))
    540540        {
     
    575575                        rc = vdIfIoIntFileReadSync(pStorage->pIfIo, pStorage->pStorage,
    576576                                                   offBlkMap, abBitmapBuffer,
    577                                                    cBlocksRead, NULL);
     577                                                   cBlocksRead);
    578578
    579579                        if (RT_SUCCESS(rc))
     
    648648                                cBlocksRead = RT_MIN(VCI_BYTE2BLOCK(sizeof(abBitmapBuffer)), cBlocksLeft);
    649649                                rc = vdIfIoIntFileReadSync(pStorage->pIfIo, pStorage->pStorage,
    650                                                            offBlkMap, abBitmapBuffer, cBlocksRead, NULL);
     650                                                           offBlkMap, abBitmapBuffer, cBlocksRead);
    651651                            }
    652652                        }
     
    712712
    713713        rc = vdIfIoIntFileWriteSync(pStorage->pIfIo, pStorage->pStorage, offBlkMap,
    714                                     &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap)), NULL);
     714                                    &BlkMap, VCI_BYTE2BLOCK(sizeof(VciBlkMap)));
    715715        if (RT_SUCCESS(rc))
    716716        {
     
    743743                        rc = vdIfIoIntFileWriteSync(pStorage->pIfIo, pStorage->pStorage,
    744744                                                    offBlkMap, abBitmapBuffer,
    745                                                     VCI_BYTE2BLOCK(sizeof(abBitmapBuffer)), NULL);
     745                                                    VCI_BYTE2BLOCK(sizeof(abBitmapBuffer)));
    746746                        if (RT_FAILURE(rc))
    747747                            break;
     
    759759            if (RT_SUCCESS(rc) && iBit)
    760760                rc = vdIfIoIntFileWriteSync(pStorage->pIfIo, pStorage->pStorage,
    761                                             offBlkMap, abBitmapBuffer, VCI_BYTE2BLOCK(iBit / 8), NULL);
     761                                            offBlkMap, abBitmapBuffer, VCI_BYTE2BLOCK(iBit / 8));
    762762        }
    763763    }
     
    11101110                    rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage,
    11111111                                               VCI_BLOCK2BYTE(pInt->PtrChild.u.offAddrBlockNode),
    1112                                                &NodeTree, sizeof(NodeTree), NULL);
     1112                                               &NodeTree, sizeof(NodeTree));
    11131113                    AssertRC(rc);
    11141114
     
    12291229
    12301230    rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage, 0, &Hdr,
    1231                                VCI_BYTE2BLOCK(sizeof(Hdr)), NULL);
     1231                               VCI_BYTE2BLOCK(sizeof(Hdr)));
    12321232    if (RT_FAILURE(rc))
    12331233    {
     
    12591259            rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage,
    12601260                                       pCache->offTreeRoot, &RootNode,
    1261                                        VCI_BYTE2BLOCK(sizeof(VciTreeNode)), NULL);
     1261                                       VCI_BYTE2BLOCK(sizeof(VciTreeNode)));
    12621262            if (RT_SUCCESS(rc))
    12631263            {
     
    13941394
    13951395        rc = vdIfIoIntFileWriteSync(pCache->pIfIo, pCache->pStorage, offHdr, &Hdr,
    1396                                     VCI_BYTE2BLOCK(sizeof(VciHdr)), NULL);
     1396                                    VCI_BYTE2BLOCK(sizeof(VciHdr)));
    13971397        if (RT_FAILURE(rc))
    13981398        {
     
    14131413
    14141414        rc = vdIfIoIntFileWriteSync(pCache->pIfIo, pCache->pStorage, offTreeRoot,
    1415                                     &NodeRoot, VCI_BYTE2BLOCK(sizeof(VciTreeNode)), NULL);
     1415                                    &NodeRoot, VCI_BYTE2BLOCK(sizeof(VciTreeNode)));
    14161416        if (RT_FAILURE(rc))
    14171417        {
     
    14671467    }
    14681468
    1469     rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Hdr, sizeof(Hdr), NULL);
     1469    rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &Hdr, sizeof(Hdr));
    14701470    if (RT_FAILURE(rc))
    14711471    {
     
    16541654        rc = vdIfIoIntFileReadSync(pCache->pIfIo, pCache->pStorage,
    16551655                                   pExtent->u64BlockAddr + offRead,
    1656                                    pvBuf, cBlocksToRead, NULL);
     1656                                   pvBuf, cBlocksToRead);
    16571657    }
    16581658    else
  • trunk/src/VBox/Storage/VD.cpp

    r44232 r44233  
    41284128}
    41294129
    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)
     4130static int vdIOIntReadUser(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset,
     4131                           PVDIOCTX pIoCtx, size_t cbRead)
    41654132{
    41664133    int rc = VINF_SUCCESS;
     
    41724139
    41734140    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
     4141
     4142    /** @todo: Handle synchronous I/O contexts. */
    41744143
    41754144    Assert(cbRead > 0);
     
    42304199}
    42314200
    4232 static int vdIOIntWriteUserAsync(void *pvUser, PVDIOSTORAGE pIoStorage,
    4233                                  uint64_t uOffset, PVDIOCTX pIoCtx,
    4234                                  size_t cbWrite,
    4235                                  PFNVDXFERCOMPLETED pfnComplete,
    4236                                  void *pvCompleteUser)
     4201static int vdIOIntWriteUser(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset,
     4202                            PVDIOCTX pIoCtx, size_t cbWrite, PFNVDXFERCOMPLETED pfnComplete,
     4203                            void *pvCompleteUser)
    42374204{
    42384205    int rc = VINF_SUCCESS;
     
    42444211
    42454212    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
     4213
     4214    /** @todo: Handle synchronous I/O contexts. */
    42464215
    42474216    Assert(cbWrite > 0);
     
    43014270}
    43024271
    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)
     4272static 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)
    43094276{
    43104277    PVDIO pVDIo     = (PVDIO)pvUser;
     
    43194286                 pvUser, pIoStorage, uOffset, pvBuf, cbRead));
    43204287
     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
    43214302    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
    43224303
     
    43994380}
    44004381
    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)
     4382static int vdIOIntWriteMeta(void *pvUser, PVDIOSTORAGE pIoStorage, uint64_t uOffset,
     4383                            const void *pvBuf, size_t cbWrite, PVDIOCTX pIoCtx,
     4384                            PFNVDXFERCOMPLETED pfnComplete, void *pvCompleteUser)
    44064385{
    44074386    PVDIO    pVDIo = (PVDIO)pvUser;
     
    44174396                 pvUser, pIoStorage, uOffset, pvBuf, cbWrite));
    44184397
     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
    44194412    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
    44204413
     
    45194512}
    45204513
    4521 static int vdIOIntFlushAsync(void *pvUser, PVDIOSTORAGE pIoStorage,
    4522                              PVDIOCTX pIoCtx, PFNVDXFERCOMPLETED pfnComplete,
    4523                              void *pvCompleteUser)
     4514static int vdIOIntFlush(void *pvUser, PVDIOSTORAGE pIoStorage, PVDIOCTX pIoCtx,
     4515                        PFNVDXFERCOMPLETED pfnComplete, void *pvCompleteUser)
    45244516{
    45254517    PVDIO    pVDIo = (PVDIO)pvUser;
     
    45304522    void *pvTask = NULL;
    45314523
    4532     VD_THREAD_IS_CRITSECT_OWNER(pDisk);
    4533 
    45344524    LogFlowFunc(("pvUser=%#p pIoStorage=%#p pIoCtx=%#p\n",
    45354525                 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);
    45364541
    45374542    if (pVDIo->fIgnoreFlush)
     
    47494754}
    47504755
    4751 static int vdIOIntWriteSyncLimited(void *pvUser, PVDIOSTORAGE pIoStorage,
    4752                                    uint64_t uOffset, const void *pvBuf,
    4753                                    size_t cbWrite, size_t *pcbWritten)
     4756static 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
     4772static 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
     4784static 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)
    47544789{
    47554790    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
     4799static 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)
    47624805{
    47634806    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
     4815static 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
     4823static int vdIOIntFlushLimited(void *pvUser, PVDIOSTORAGE pStorage,
     4824                               PVDIOCTX pIoCtx,
     4825                               PFNVDXFERCOMPLETED pfnComplete,
     4826                               void *pvCompleteUser)
    47684827{
    47694828    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);
    47714835}
    47724836
     
    48874951    pIfIoInt->pfnGetSize             = vdIOIntGetSize;
    48884952    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;
    48964957    pIfIoInt->pfnMetaXferRelease     = vdIOIntMetaXferRelease;
    4897     pIfIoInt->pfnFlushAsync          = vdIOIntFlushAsync;
     4958    pIfIoInt->pfnFlush               = vdIOIntFlush;
    48984959    pIfIoInt->pfnIoCtxCopyFrom       = vdIOIntIoCtxCopyFrom;
    48994960    pIfIoInt->pfnIoCtxCopyTo         = vdIOIntIoCtxCopyTo;
     
    52265287    VDIfIoInt.pfnGetSize                = vdIOIntGetSizeLimited;
    52275288    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;
    52365294    rc = VDInterfaceAdd(&VDIfIoInt.Core, "VD_IOINT", VDINTERFACETYPE_IOINT,
    52375295                        pInterfaceIo, sizeof(VDINTERFACEIOINT), &pVDIfsImage);
     
    96679725    VDIfIoInt.pfnGetSize                = vdIOIntGetSizeLimited;
    96689726    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;
    96779732    rc = VDInterfaceAdd(&VDIfIoInt.Core, "VD_IOINT", VDINTERFACETYPE_IOINT,
    96789733                        pInterfaceIo, sizeof(VDINTERFACEIOINT), &pVDIfsImage);
  • trunk/src/VBox/Storage/VDI.cpp

    r44232 r44233  
    654654    vdiConvPreHeaderEndianess(VDIECONV_H2F, &PreHeader, &pImage->PreHeader);
    655655    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0,
    656                                 &PreHeader, sizeof(PreHeader), NULL);
     656                                &PreHeader, sizeof(PreHeader));
    657657    if (RT_FAILURE(rc))
    658658    {
     
    666666    vdiConvHeaderEndianessV1p(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1plus);
    667667    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(pImage->PreHeader),
    668                                 &Hdr, sizeof(Hdr), NULL);
     668                                &Hdr, sizeof(Hdr));
    669669    if (RT_FAILURE(rc))
    670670    {
     
    676676    vdiConvBlocksEndianess(VDIECONV_H2F, pImage->paBlocks, getImageBlocks(&pImage->Header));
    677677    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, pImage->paBlocks,
    678                                 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER),
    679                                 NULL);
     678                                getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER));
    680679    vdiConvBlocksEndianess(VDIECONV_F2H, pImage->paBlocks, getImageBlocks(&pImage->Header));
    681680    if (RT_FAILURE(rc))
     
    712711
    713712            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartData + uOff,
    714                                         pvBuf, cbChunk, NULL);
     713                                        pvBuf, cbChunk);
    715714            if (RT_FAILURE(rc))
    716715            {
     
    781780    VDIPREHEADER PreHeader;
    782781    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0,
    783                                &PreHeader, sizeof(PreHeader), NULL);
     782                               &PreHeader, sizeof(PreHeader));
    784783    if (RT_FAILURE(rc))
    785784    {
     
    802801        case 0:
    803802            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));
    806804            if (RT_FAILURE(rc))
    807805            {
     
    813811        case 1:
    814812            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));
    817814            if (RT_FAILURE(rc))
    818815            {
     
    840837                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, sizeof(pImage->PreHeader),
    841838                                           &pImage->Header.u.v1plus,
    842                                            sizeof(pImage->Header.u.v1plus), NULL);
     839                                           sizeof(pImage->Header.u.v1plus));
    843840                if (RT_FAILURE(rc))
    844841                {
     
    874871    /* Read blocks array. */
    875872    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, pImage->paBlocks,
    876                                getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER),
    877                                NULL);
     873                               getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER));
    878874    if (RT_FAILURE(rc))
    879875    {
     
    945941            vdiConvHeaderEndianessV0(VDIECONV_H2F, &Hdr, &pImage->Header.u.v0);
    946942            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VDIPREHEADER),
    947                                         &Hdr, sizeof(Hdr), NULL);
     943                                        &Hdr, sizeof(Hdr));
    948944            break;
    949945        }
     
    954950                vdiConvHeaderEndianessV1(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1);
    955951                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VDIPREHEADER),
    956                                             &Hdr, sizeof(Hdr), NULL);
     952                                            &Hdr, sizeof(Hdr));
    957953            }
    958954            else
     
    961957                vdiConvHeaderEndianessV1p(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1plus);
    962958                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VDIPREHEADER),
    963                                             &Hdr, sizeof(Hdr), NULL);
     959                                            &Hdr, sizeof(Hdr));
    964960            }
    965961            break;
     
    984980            VDIHEADER0 Hdr;
    985981            vdiConvHeaderEndianessV0(VDIECONV_H2F, &Hdr, &pImage->Header.u.v0);
    986             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    987                                              sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr),
    988                                              pIoCtx, NULL, NULL);
     982            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     983                                        sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr),
     984                                        pIoCtx, NULL, NULL);
    989985            break;
    990986        }
     
    994990                VDIHEADER1 Hdr;
    995991                vdiConvHeaderEndianessV1(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1);
    996                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    997                                                  sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr),
    998                                                  pIoCtx, NULL, NULL);
     992                rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     993                                            sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr),
     994                                            pIoCtx, NULL, NULL);
    999995            }
    1000996            else
     
    1002998                VDIHEADER1PLUS Hdr;
    1003999                vdiConvHeaderEndianessV1p(VDIECONV_H2F, &Hdr, &pImage->Header.u.v1plus);
    1004                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1005                                                  sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr),
    1006                                                  pIoCtx, NULL, NULL);
     1000                rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1001                                            sizeof(VDIPREHEADER), &Hdr, sizeof(Hdr),
     1002                                            pIoCtx, NULL, NULL);
    10071003            }
    10081004            break;
     
    10291025        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    10301026                                    pImage->offStartBlocks + uBlock * sizeof(VDIIMAGEBLOCKPOINTER),
    1031                                     &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER),
    1032                                     NULL);
     1027                                    &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER));
    10331028        AssertMsgRC(rc, ("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n",
    10341029                         uBlock, pImage->pszFilename, rc));
     
    10531048        /* write only one block pointer. */
    10541049        VDIIMAGEBLOCKPOINTER ptrBlock = RT_H2LE_U32(pImage->paBlocks[uBlock]);
    1055         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    1056                                          pImage->offStartBlocks + uBlock * sizeof(VDIIMAGEBLOCKPOINTER),
    1057                                          &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER),
    1058                                          pIoCtx, NULL, NULL);
     1050        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     1051                                    pImage->offStartBlocks + uBlock * sizeof(VDIIMAGEBLOCKPOINTER),
     1052                                    &ptrBlock, sizeof(VDIIMAGEBLOCKPOINTER),
     1053                                    pIoCtx, NULL, NULL);
    10591054        AssertMsg(RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS,
    10601055                  ("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n",
     
    10781073                  ("vdiUpdateHeaderAsync() failed, filename=\"%s\", rc=%Rrc\n",
    10791074                  pImage->pszFilename, rc));
    1080         rc = vdIfIoIntFileFlushAsync(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL);
     1075        rc = vdIfIoIntFileFlush(pImage->pIfIo, pImage->pStorage, pIoCtx, NULL, NULL);
    10811076        AssertMsg(RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS,
    10821077                  ("Flushing data to disk failed rc=%Rrc\n", rc));
     
    11231118            u64Offset = (uint64_t)idxLastBlock * pImage->cbTotalBlockData + pImage->offStartData;
    11241119            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    1125                                        pvBlock, pImage->cbTotalBlockData, NULL);
     1120                                       pvBlock, pImage->cbTotalBlockData);
    11261121            if (RT_FAILURE(rc))
    11271122                break;
     
    11301125            u64Offset = (uint64_t)ptrBlockDiscard * pImage->cbTotalBlockData + pImage->offStartData;
    11311126            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    1132                                         pvBlock, pImage->cbTotalBlockData, NULL);
     1127                                        pvBlock, pImage->cbTotalBlockData);
    11331128            if (RT_FAILURE(rc))
    11341129                break;
     
    11841179            PVDMETAXFER pMetaXfer;
    11851180            uint64_t u64Offset = (uint64_t)pDiscardAsync->idxLastBlock * pImage->cbTotalBlockData + pImage->offStartData;
    1186             rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pImage->pStorage, u64Offset,
    1187                                             pDiscardAsync->pvBlock, pImage->cbTotalBlockData, pIoCtx,
    1188                                             &pMetaXfer, vdiDiscardBlockAsyncUpdate, pDiscardAsync);
     1181            rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, u64Offset,
     1182                                       pDiscardAsync->pvBlock, pImage->cbTotalBlockData, pIoCtx,
     1183                                       &pMetaXfer, vdiDiscardBlockAsyncUpdate, pDiscardAsync);
    11891184            if (RT_FAILURE(rc))
    11901185                break;
     
    11981193            /* Block read complete. Write to the new location (discarded block). */
    11991194            uint64_t u64Offset = (uint64_t)pDiscardAsync->ptrBlockDiscard * pImage->cbTotalBlockData + pImage->offStartData;
    1200             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage, u64Offset,
    1201                                              pDiscardAsync->pvBlock, pImage->cbTotalBlockData, pIoCtx,
    1202                                              vdiDiscardBlockAsyncUpdate, pDiscardAsync);
     1195            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage, u64Offset,
     1196                                        pDiscardAsync->pvBlock, pImage->cbTotalBlockData, pIoCtx,
     1197                                        vdiDiscardBlockAsyncUpdate, pDiscardAsync);
    12031198
    12041199            pDiscardAsync->enmState = VDIBLOCKDISCARDSTATE_UPDATE_METADATA;
     
    16711666        if (u64Offset + cbToRead <= pImage->cbImage)
    16721667            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    1673                                        pvBuf, cbToRead, NULL);
     1668                                       pvBuf, cbToRead);
    16741669        else
    16751670        {
     
    17621757                                   + (pImage->offStartData + pImage->offStartBlockData);
    17631758                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    1764                                             u64Offset, pvBuf, cbToWrite, NULL);
     1759                                            u64Offset, pvBuf, cbToWrite);
    17651760                if (RT_FAILURE(rc))
    17661761                    goto out;
     
    17951790                               + (pImage->offStartData + pImage->offStartBlockData + offWrite);
    17961791            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    1797                                         pvBuf, cbToWrite, NULL);
     1792                                        pvBuf, cbToWrite);
    17981793        }
    17991794    } while (0);
     
    24852480
    24862481        if (u64Offset + cbToRead <= pImage->cbImage)
    2487             rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, u64Offset,
    2488                                             pIoCtx, cbToRead);
     2482            rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, u64Offset,
     2483                                       pIoCtx, cbToRead);
    24892484        else
    24902485        {
     
    25912586                *pcbPostRead = 0;
    25922587
    2593                 rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2594                                                  u64Offset, pIoCtx, cbToWrite,
    2595                                                  vdiAsyncBlockAllocUpdate, pBlockAlloc);
     2588                rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2589                                            u64Offset, pIoCtx, cbToWrite,
     2590                                            vdiAsyncBlockAllocUpdate, pBlockAlloc);
    25962591                if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    25972592                    break;
     
    26182613            uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData
    26192614                               + (pImage->offStartData + pImage->offStartBlockData + offWrite);
    2620             rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2621                                              u64Offset, pIoCtx, cbToWrite, NULL, NULL);
     2615            rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2616                                        u64Offset, pIoCtx, cbToWrite, NULL, NULL);
    26222617        }
    26232618    } while (0);
     
    27522747                uint64_t u64Offset = (uint64_t)ptrBlock * pImage->cbTotalBlockData
    27532748                                   + (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);
    27552750                if (RT_FAILURE(rc))
    27562751                    break;
     
    28372832                                   + (pImage->offStartData + pImage->offStartBlockData);
    28382833                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    2839                                            pvTmp, cbBlock, NULL);
     2834                                           pvTmp, cbBlock);
    28402835                u64Offset = (uint64_t)i * pImage->cbTotalBlockData
    28412836                          + (pImage->offStartData + pImage->offStartBlockData);
    28422837                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    2843                                             pvTmp, cbBlock, NULL);
     2838                                            pvTmp, cbBlock);
    28442839                pImage->paBlocks[uBlockData] = i;
    28452840                setImageBlocksAllocated(&pImage->Header, cBlocksAllocated - cBlocksMoved);
     
    29782973                            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    29792974                                                       offStartDataNew, pvBuf,
    2980                                                        pImage->cbTotalBlockData, NULL);
     2975                                                       pImage->cbTotalBlockData);
    29812976                            if (RT_FAILURE(rc))
    29822977                                break;
     
    29892984                            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    29902985                                                        offBlockAppend, pvBuf,
    2991                                                         pImage->cbTotalBlockData, NULL);
     2986                                                        pImage->cbTotalBlockData);
    29922987                            if (RT_FAILURE(rc))
    29932988                                break;
     
    29962991                            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    29972992                                                        offStartDataNew, pvZero,
    2998                                                         pImage->cbTotalBlockData, NULL);
     2993                                                        pImage->cbTotalBlockData);
    29992994                            if (RT_FAILURE(rc))
    30002995                                break;
     
    30633058            vdiConvBlocksEndianess(VDIECONV_H2F, pImage->paBlocks, cBlocksNew);
    30643059            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks,
    3065                                         pImage->paBlocks, cbBlockspaceNew, NULL);
     3060                                        pImage->paBlocks, cbBlockspaceNew);
    30663061            vdiConvBlocksEndianess(VDIECONV_F2H, pImage->paBlocks, cBlocksNew);
    30673062
     
    31823177                uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData;
    31833178                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, u64Offset,
    3184                                            pvBlock, pImage->cbTotalBlockData, NULL);
     3179                                           pvBlock, pImage->cbTotalBlockData);
    31853180                if (RT_FAILURE(rc))
    31863181                    break;
     
    31973192                    /* Write changed data to the image. */
    31983193                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, u64Offset + offDiscard,
    3199                                                 pbBlockData + offDiscard, cbDiscard, NULL);
     3194                                                pbBlockData + offDiscard, cbDiscard);
    32003195                }
    32013196                else
     
    33103305
    33113306                uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData + offDiscard;
    3312                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    3313                                                  u64Offset, pvBlock, cbDiscard, pIoCtx,
    3314                                                  NULL, NULL);
     3307                rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     3308                                            u64Offset, pvBlock, cbDiscard, pIoCtx,
     3309                                            NULL, NULL);
    33153310                RTMemFree(pvBlock);
    33163311            }
     
    33253320
    33263321                uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData;
    3327                 rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pImage->pStorage, u64Offset,
    3328                                                 pbBlockData, pImage->cbTotalBlockData,
    3329                                                 pIoCtx, &pMetaXfer, NULL, NULL);
     3322                rc = vdIfIoIntFileReadMeta(pImage->pIfIo, pImage->pStorage, u64Offset,
     3323                                           pbBlockData, pImage->cbTotalBlockData,
     3324                                           pIoCtx, &pMetaXfer, NULL, NULL);
    33303325                if (RT_FAILURE(rc))
    33313326                {
     
    34133408
    34143409        /* Read pre-header. */
    3415         rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &PreHdr, sizeof(PreHdr), NULL);
     3410        rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &PreHdr, sizeof(PreHdr));
    34163411        if (RT_FAILURE(rc))
    34173412        {
     
    34343429            case 0:
    34353430                rc = vdIfIoIntFileReadSync(pIfIo, pStorage, sizeof(PreHdr),
    3436                                            &Hdr.u.v0, sizeof(Hdr.u.v0),
    3437                                            NULL);
     3431                                           &Hdr.u.v0, sizeof(Hdr.u.v0));
    34383432                if (RT_FAILURE(rc))
    34393433                    rc = vdIfError(pIfError, rc, RT_SRC_POS, N_("VDI: error reading v0 header in '%s'"),
     
    34433437            case 1:
    34443438                rc = vdIfIoIntFileReadSync(pIfIo, pStorage, sizeof(PreHdr),
    3445                                            &Hdr.u.v1, sizeof(Hdr.u.v1), NULL);
     3439                                           &Hdr.u.v1, sizeof(Hdr.u.v1));
    34463440                if (RT_FAILURE(rc))
    34473441                {
     
    34543448                    /* Read the VDI 1.1+ header completely. */
    34553449                    rc = vdIfIoIntFileReadSync(pIfIo, pStorage, sizeof(PreHdr),
    3456                                                &Hdr.u.v1plus, sizeof(Hdr.u.v1plus),
    3457                                                NULL);
     3450                                               &Hdr.u.v1plus, sizeof(Hdr.u.v1plus));
    34583451                    if (RT_FAILURE(rc))
    34593452                        rc = vdIfError(pIfError, rc, RT_SRC_POS, N_("VDI: error reading v1.1+ header in '%s'"),
     
    34993492        /* Read blocks array. */
    35003493        rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offStartBlocks, paBlocks,
    3501                                    getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER),
    3502                                    NULL);
     3494                                   getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER));
    35033495        if (RT_FAILURE(rc))
    35043496        {
     
    35553547            vdiConvBlocksEndianess(VDIECONV_H2F, paBlocks, getImageBlocks(&Hdr));
    35563548            rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offStartBlocks, paBlocks,
    3557                                         getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER),
    3558                                         NULL);
     3549                                        getImageBlocks(&Hdr) * sizeof(VDIIMAGEBLOCKPOINTER));
    35593550            if (RT_FAILURE(rc))
    35603551            {
  • trunk/src/VBox/Storage/VHD.cpp

    r44232 r44233  
    363363    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    364364                                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);
    367366
    368367out:
     
    384383
    385384    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    386                                pImage->u64DataOffset, &ddh, sizeof(ddh), NULL);
     385                               pImage->u64DataOffset, &ddh, sizeof(ddh));
    387386    if (RT_FAILURE(rc))
    388387        return rc;
     
    434433    ddh.Checksum = RT_H2BE_U32(vhdChecksum(&ddh, sizeof(ddh)));
    435434    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    436                                 pImage->u64DataOffset, &ddh, sizeof(ddh), NULL);
     435                                pImage->u64DataOffset, &ddh, sizeof(ddh));
    437436    return rc;
    438437}
     
    456455    if (pImage->pBlockAllocationTable)
    457456        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0,
    458                                     &pImage->vhdFooterCopy, sizeof(VHDFooter), NULL);
     457                                    &pImage->vhdFooterCopy, sizeof(VHDFooter));
    459458
    460459    if (RT_SUCCESS(rc))
    461460        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    462461                                    pImage->uCurrentEndOfFile, &pImage->vhdFooterCopy,
    463                                     sizeof(VHDFooter), NULL);
     462                                    sizeof(VHDFooter));
    464463
    465464    return rc;
     
    497496         */
    498497        vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uBlockAllocationTableOffset,
    499                                pBlockAllocationTableToWrite, cbBlockAllocationTableToWrite, NULL);
     498                               pBlockAllocationTableToWrite, cbBlockAllocationTableToWrite);
    500499        if (pImage->fDynHdrNeedsUpdate)
    501500            rc = vhdDynamicHeaderUpdate(pImage);
     
    616615            if (uStatus == VHDIMAGEEXPAND_STEP_SUCCESS)
    617616            {
    618                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    619                                                    pImage->uBlockAllocationTableOffset
    620                                                  + pExpand->idxBatAllocated * sizeof(uint32_t),
    621                                                  &pImage->pBlockAllocationTable[pExpand->idxBatAllocated],
    622                                                  sizeof(uint32_t), pIoCtx, NULL, NULL);
     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);
    623622                fIoInProgress |= rc == VERR_VD_ASYNC_IO_IN_PROGRESS;
    624623            }
     
    633632
    634633        pImage->uCurrentEndOfFile = pExpand->cbEofOld;
    635         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    636                                          pImage->uCurrentEndOfFile,
    637                                          &pImage->vhdFooterCopy, sizeof(VHDFooter),
    638                                          pIoCtx, NULL, NULL);
     634        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     635                                    pImage->uCurrentEndOfFile,
     636                                    &pImage->vhdFooterCopy, sizeof(VHDFooter),
     637                                    pIoCtx, NULL, NULL);
    639638        fIoInProgress |= rc == VERR_VD_ASYNC_IO_IN_PROGRESS;
    640639    }
     
    696695     */
    697696    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uDynamicDiskHeaderOffset,
    698                          &vhdDynamicDiskHeader, sizeof(VHDDynamicDiskHeader),
    699                          NULL);
     697                               &vhdDynamicDiskHeader, sizeof(VHDDynamicDiskHeader));
    700698    if (memcmp(vhdDynamicDiskHeader.Cookie, VHD_DYNAMIC_DISK_HEADER_COOKIE, VHD_DYNAMIC_DISK_HEADER_COOKIE_SIZE))
    701699        return VERR_INVALID_PARAMETER;
     
    738736    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    739737                               uBlockAllocationTableOffset, pBlockAllocationTable,
    740                                pImage->cBlockAllocationTableEntries * sizeof(uint32_t),
    741                                NULL);
     738                               pImage->cBlockAllocationTableEntries * sizeof(uint32_t));
    742739
    743740    /*
     
    792789
    793790    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, pImage->uCurrentEndOfFile,
    794                                &vhdFooter, sizeof(VHDFooter), NULL);
     791                               &vhdFooter, sizeof(VHDFooter));
    795792    if (RT_SUCCESS(rc))
    796793    {
     
    802799             */
    803800            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, 0,
    804                                        &vhdFooter, sizeof(VHDFooter), NULL);
     801                                       &vhdFooter, sizeof(VHDFooter));
    805802            if (RT_SUCCESS(rc))
    806803            {
     
    10341031
    10351032    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, 0, pvTmp,
    1036                           pImage->uCurrentEndOfFile + sizeof(VHDFooter), NULL);
     1033                          pImage->uCurrentEndOfFile + sizeof(VHDFooter));
    10371034    if (RT_FAILURE(rc))
    10381035    {
     
    10551052
    10561053    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, sizeof(VHDFooter),
    1057                                 &DynamicDiskHeader, sizeof(DynamicDiskHeader), NULL);
     1054                                &DynamicDiskHeader, sizeof(DynamicDiskHeader));
    10581055    if (RT_FAILURE(rc))
    10591056        return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VHD: cannot write dynamic disk header to image '%s'"), pImage->pszFilename);
     
    10621059    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uBlockAllocationTableOffset,
    10631060                                pImage->pBlockAllocationTable,
    1064                                 pImage->cBlockAllocationTableEntries * sizeof(uint32_t),
    1065                                 NULL);
     1061                                pImage->cBlockAllocationTableEntries * sizeof(uint32_t));
    10661062    if (RT_FAILURE(rc))
    10671063        return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VHD: cannot write BAT to image '%s'"), pImage->pszFilename);
     
    11831179    /* Store the footer */
    11841180    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uCurrentEndOfFile,
    1185                                 &Footer, sizeof(Footer), NULL);
     1181                                &Footer, sizeof(Footer));
    11861182    if (RT_FAILURE(rc))
    11871183    {
     
    11941190    {
    11951191        /* 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));
    11971193        if (RT_FAILURE(rc))
    11981194        {
     
    12411237
    12421238    rc = vdIfIoIntFileReadSync(pIfIo, pStorage, cbFile - sizeof(VHDFooter),
    1243                                &vhdFooter, sizeof(VHDFooter), NULL);
     1239                               &vhdFooter, sizeof(VHDFooter));
    12441240    if (RT_SUCCESS(rc))
    12451241    {
     
    12501246             * Such corrupted images are detected here to let the open handler repair it later.
    12511247             */
    1252             rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0,
    1253                                        &vhdFooter, sizeof(VHDFooter), NULL);
     1248            rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0, &vhdFooter, sizeof(VHDFooter));
    12541249            if (   RT_FAILURE(rc)
    12551250                || (memcmp(vhdFooter.Cookie, VHD_FOOTER_COOKIE, VHD_FOOTER_COOKIE_SIZE) != 0))
     
    15021497            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    15031498                                       ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE,
    1504                                        pImage->pu8Bitmap, pImage->cbDataBlockBitmap,
    1505                                        NULL);
     1499                                       pImage->pu8Bitmap, pImage->cbDataBlockBitmap);
    15061500            if (RT_SUCCESS(rc))
    15071501            {
     
    15291523                    LogFlowFunc(("uVhdOffset=%llu cbBuf=%u\n", uVhdOffset, cbBuf));
    15301524                    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    1531                                                uVhdOffset, pvBuf, cbBuf, NULL);
     1525                                               uVhdOffset, pvBuf, cbBuf);
    15321526                }
    15331527                else
     
    15611555    }
    15621556    else
    1563         rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf, NULL);
     1557        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf);
    15641558
    15651559    if (   RT_SUCCESS(rc)
     
    16441638             */
    16451639            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->uCurrentEndOfFile,
    1646                                         pNewBlock, cbNewBlock, NULL);
     1640                                        pNewBlock, cbNewBlock);
    16471641            AssertRC(rc);
    16481642
     
    16661660        /* Write data. */
    16671661        vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uVhdOffset,
    1668                                pvBuf, cbBuf, NULL);
     1662                               pvBuf, cbBuf);
    16691663
    16701664        /* Read in the block's bitmap. */
    16711665        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    16721666                                   ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE,
    1673                                    pImage->pu8Bitmap, pImage->cbDataBlockBitmap,
    1674                                    NULL);
     1667                                   pImage->pu8Bitmap, pImage->cbDataBlockBitmap);
    16751668        if (RT_SUCCESS(rc))
    16761669        {
     
    16891682                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    16901683                                            ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE,
    1691                                             pImage->pu8Bitmap, pImage->cbDataBlockBitmap,
    1692                                             NULL);
     1684                                            pImage->pu8Bitmap, pImage->cbDataBlockBitmap);
    16931685            }
    16941686        }
     
    16961688    else
    16971689    {
    1698         rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf, NULL);
     1690        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOffset, pvBuf, cbBuf);
    16991691    }
    17001692
     
    23332325            /* Read in the block's bitmap. */
    23342326            PVDMETAXFER pMetaXfer;
    2335             rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pImage->pStorage,
    2336                                             ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE,
    2337                                             pImage->pu8Bitmap, pImage->cbDataBlockBitmap,
    2338                                             pIoCtx, &pMetaXfer, NULL, NULL);
     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);
    23392331
    23402332            if (RT_SUCCESS(rc))
     
    23632355
    23642356                    LogFlowFunc(("uVhdOffset=%llu cbRead=%u\n", uVhdOffset, cbRead));
    2365                     rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage,
    2366                                                     uVhdOffset, pIoCtx, cbRead);
     2357                    rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage,
     2358                                               uVhdOffset, pIoCtx, cbRead);
    23672359                }
    23682360                else
     
    23962388    }
    23972389    else
    2398         rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pImage->pStorage, uOffset, pIoCtx, cbRead);
     2390        rc = vdIfIoIntFileReadUser(pImage->pIfIo, pImage->pStorage, uOffset, pIoCtx, cbRead);
    23992391
    24002392    if (pcbActuallyRead)
     
    24812473                 * Start with the sector bitmap.
    24822474                 */
    2483                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    2484                                                  pImage->uCurrentEndOfFile,
    2485                                                  pExpand->au8Bitmap,
    2486                                                  pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE, pIoCtx,
    2487                                                  vhdAsyncExpansionDataBlockBitmapComplete,
    2488                                                  pExpand);
     2475                rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     2476                                            pImage->uCurrentEndOfFile,
     2477                                            pExpand->au8Bitmap,
     2478                                            pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE, pIoCtx,
     2479                                            vhdAsyncExpansionDataBlockBitmapComplete,
     2480                                            pExpand);
    24892481                if (RT_SUCCESS(rc))
    24902482                    VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_BLOCKBITMAP_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS);
     
    25042496                 * Write the new block at the current end of the file.
    25052497                 */
    2506                 rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2507                                                  pImage->uCurrentEndOfFile + pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE,
    2508                                                  pIoCtx, cbWrite,
    2509                                                  vhdAsyncExpansionDataComplete,
    2510                                                  pExpand);
     2498                rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2499                                            pImage->uCurrentEndOfFile + pImage->cDataBlockBitmapSectors * VHD_SECTOR_SIZE,
     2500                                            pIoCtx, cbWrite,
     2501                                            vhdAsyncExpansionDataComplete,
     2502                                            pExpand);
    25112503                if (RT_SUCCESS(rc))
    25122504                    VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_USERBLOCK_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS);
     
    25242516                 * Write entry in the BAT.
    25252517                 */
    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);
    25322523                if (RT_SUCCESS(rc))
    25332524                    VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_BAT_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS);
     
    25482539
    25492540                /* Update the footer. */
    2550                 rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    2551                                                  pImage->uCurrentEndOfFile,
    2552                                                  &pImage->vhdFooterCopy,
    2553                                                  sizeof(VHDFooter), pIoCtx,
    2554                                                  vhdAsyncExpansionFooterUpdateComplete,
    2555                                                  pExpand);
     2541                rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pImage->pStorage,
     2542                                            pImage->uCurrentEndOfFile,
     2543                                            &pImage->vhdFooterCopy,
     2544                                            sizeof(VHDFooter), pIoCtx,
     2545                                            vhdAsyncExpansionFooterUpdateComplete,
     2546                                            pExpand);
    25562547                if (RT_SUCCESS(rc))
    25572548                    VHDIMAGEEXPAND_STATUS_SET(pExpand->fFlags, VHDIMAGEEXPAND_FOOTER_STATUS_SHIFT, VHDIMAGEEXPAND_STEP_SUCCESS);
     
    25802571            /* Read in the block's bitmap. */
    25812572            PVDMETAXFER pMetaXfer;
    2582             rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pImage->pStorage,
    2583                                             ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE,
    2584                                             pImage->pu8Bitmap,
    2585                                             pImage->cbDataBlockBitmap, pIoCtx,
    2586                                             &pMetaXfer, NULL, NULL);
     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);
    25872578            if (RT_SUCCESS(rc))
    25882579            {
     
    25902581
    25912582                /* Write data. */
    2592                 rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2593                                                  uVhdOffset, pIoCtx, cbWrite,
    2594                                                  NULL, NULL);
     2583                rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2584                                            uVhdOffset, pIoCtx, cbWrite,
     2585                                            NULL, NULL);
    25952586                if (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    25962587                {
     
    26162607                         * to rollback anything here.
    26172608                         */
    2618                         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pImage->pStorage,
    2619                                                          ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry]) * VHD_SECTOR_SIZE,
    2620                                                          pImage->pu8Bitmap,
    2621                                                          pImage->cbDataBlockBitmap,
    2622                                                          pIoCtx, NULL, NULL);
     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);
    26232614                    }
    26242615                }
     
    26272618    }
    26282619    else
    2629         rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pImage->pStorage,
    2630                                          uOffset, pIoCtx, cbWrite, NULL, NULL);
     2620        rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pImage->pStorage,
     2621                                    uOffset, pIoCtx, cbWrite, NULL, NULL);
    26312622
    26322623    if (pcbWriteProcess)
     
    26472638
    26482639    /* 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);
    26512641}
    26522642
     
    27612751                uint64_t u64Offset = ((uint64_t)paBat[i] + pImage->cDataBlockBitmapSectors) * VHD_SECTOR_SIZE;
    27622752                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    2763                                            u64Offset, pvBuf, pImage->cbDataBlock, NULL);
     2753                                           u64Offset, pvBuf, pImage->cbDataBlock);
    27642754                if (RT_FAILURE(rc))
    27652755                    break;
     
    28252815                                       + (offBlocksStart * VHD_SECTOR_SIZE);
    28262816                    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    2827                                                u64Offset, pvBuf, cbBlock, NULL);
     2817                                               u64Offset, pvBuf, cbBlock);
    28282818                    if (RT_FAILURE(rc))
    28292819                        break;
     
    28322822                                       + (offBlocksStart * VHD_SECTOR_SIZE);
    28332823                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    2834                                                 u64Offset, pvBuf, cbBlock, NULL);
     2824                                                u64Offset, pvBuf, cbBlock);
    28352825                    if (RT_FAILURE(rc))
    28362826                        break;
     
    29872977                            /* Read data and append to the end of the image. */
    29882978                            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage,
    2989                                                        offStartDataNew, pvBuf, cbBlock, NULL);
     2979                                                       offStartDataNew, pvBuf, cbBlock);
    29902980                            if (RT_FAILURE(rc))
    29912981                                break;
    29922982
    29932983                            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    2994                                                         pImage->uCurrentEndOfFile, pvBuf, cbBlock, NULL);
     2984                                                        pImage->uCurrentEndOfFile, pvBuf, cbBlock);
    29952985                            if (RT_FAILURE(rc))
    29962986                                break;
     
    29982988                            /* Zero out the old block area. */
    29992989                            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
    3000                                                         offStartDataNew, pvZero, cbBlock, NULL);
     2990                                                        offStartDataNew, pvZero, cbBlock);
    30012991                            if (RT_FAILURE(rc))
    30022992                                break;
     
    30493039                                            pImage->uBlockAllocationTableOffset,
    30503040                                            pImage->pBlockAllocationTable,
    3051                                             cBlocksNew * sizeof(uint32_t), NULL);
     3041                                            cBlocksNew * sizeof(uint32_t));
    30523042            }
    30533043
     
    31333123
    31343124        rc = vdIfIoIntFileReadSync(pIfIo, pStorage, cbFile - sizeof(VHDFooter),
    3135                                    &vhdFooter, sizeof(VHDFooter), NULL);
     3125                                   &vhdFooter, sizeof(VHDFooter));
    31363126        if (RT_FAILURE(rc))
    31373127        {
     
    31443134            /* Dynamic images have a backup at the beginning of the image. */
    31453135            rc = vdIfIoIntFileReadSync(pIfIo, pStorage, 0,
    3146                                        &vhdFooter, sizeof(VHDFooter), NULL);
     3136                                       &vhdFooter, sizeof(VHDFooter));
    31473137            if (RT_FAILURE(rc))
    31483138            {
     
    32193209
    32203210            rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offDynamicDiskHeader,
    3221                                        &dynamicDiskHeader, sizeof(VHDDynamicDiskHeader), NULL);
     3211                                       &dynamicDiskHeader, sizeof(VHDDynamicDiskHeader));
    32223212            if (RT_FAILURE(rc))
    32233213            {
     
    32663256
    32673257            rc = vdIfIoIntFileReadSync(pIfIo, pStorage, offBat, paBat,
    3268                                        cBatEntries * sizeof(uint32_t), NULL);
     3258                                       cBatEntries * sizeof(uint32_t));
    32693259            if (RT_FAILURE(rc))
    32703260            {
     
    33433333
    33443334                rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offBat, paBat,
    3345                                             cBatEntries * sizeof(uint32_t), NULL);
     3335                                            cBatEntries * sizeof(uint32_t));
    33463336                if (RT_FAILURE(rc))
    33473337                {
     
    33593349                vdIfErrorMessage(pIfError, "Writing repaired dynamic disk header...\n");
    33603350                rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offDynamicDiskHeader, &dynamicDiskHeader,
    3361                                             sizeof(VHDDynamicDiskHeader), NULL);
     3351                                            sizeof(VHDDynamicDiskHeader));
    33623352                if (RT_FAILURE(rc))
    33633353                {
     
    33773367                    /* Write backup at image beginning. */
    33783368                    rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, 0, &vhdFooter,
    3379                                                 sizeof(VHDFooter), NULL);
     3369                                                sizeof(VHDFooter));
    33803370                    if (RT_FAILURE(rc))
    33813371                    {
     
    33883378
    33893379                rc = vdIfIoIntFileWriteSync(pIfIo, pStorage, offFooter, &vhdFooter,
    3390                                             sizeof(VHDFooter), NULL);
     3380                                            sizeof(VHDFooter));
    33913381                if (RT_FAILURE(rc))
    33923382                {
  • trunk/src/VBox/Storage/VHDX.cpp

    r44232 r44233  
    10561056        /* Read the first header. */
    10571057        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_HEADER1_OFFSET,
    1058                                    pHdr1, sizeof(*pHdr1), NULL);
     1058                                   pHdr1, sizeof(*pHdr1));
    10591059        if (RT_SUCCESS(rc))
    10601060        {
     
    10731073        /* Try to read the second header in any case (even if reading the first failed). */
    10741074        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_HEADER2_OFFSET,
    1075                                    pHdr2, sizeof(*pHdr2), NULL);
     1075                                   pHdr2, sizeof(*pHdr2));
    10761076        if (RT_SUCCESS(rc))
    10771077        {
     
    11661166        {
    11671167            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offRegion,
    1168                                        paBatEntries, cbBatEntries, NULL);
     1168                                       paBatEntries, cbBatEntries);
    11691169            if (RT_SUCCESS(rc))
    11701170            {
     
    12541254
    12551255        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offItem,
    1256                                    &FileParameters, sizeof(FileParameters), NULL);
     1256                                   &FileParameters, sizeof(FileParameters));
    12571257        if (RT_SUCCESS(rc))
    12581258        {
     
    12991299
    13001300        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offItem,
    1301                                    &VDiskSize, sizeof(VDiskSize), NULL);
     1301                                   &VDiskSize, sizeof(VDiskSize));
    13021302        if (RT_SUCCESS(rc))
    13031303        {
     
    13381338
    13391339        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offItem,
    1340                                    &VDiskLogSectSize, sizeof(VDiskLogSectSize), NULL);
     1340                                   &VDiskLogSectSize, sizeof(VDiskLogSectSize));
    13411341        if (RT_SUCCESS(rc))
    13421342        {
     
    13731373    /* Load the header first. */
    13741374    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offRegion,
    1375                                &MetadataTblHdr, sizeof(MetadataTblHdr), NULL);
     1375                               &MetadataTblHdr, sizeof(MetadataTblHdr));
    13761376    if (RT_SUCCESS(rc))
    13771377    {
     
    14031403
    14041404                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offMetadataTblEntry,
    1405                                            &MetadataTblEntry, sizeof(MetadataTblEntry), NULL);
     1405                                           &MetadataTblEntry, sizeof(MetadataTblEntry));
    14061406                if (RT_FAILURE(rc))
    14071407                {
     
    15341534    {
    15351535        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);
    15371537        if (RT_SUCCESS(rc))
    15381538        {
     
    16641664    AssertPtrReturn(pImage->pIfIo, VERR_INVALID_PARAMETER);
    16651665
    1666 #if 0
    16671666    /* Refuse write access, it is not implemented so far. */
    16681667    if (!(uOpenFlags & VD_OPEN_FLAGS_READONLY))
    16691668        return VERR_NOT_SUPPORTED;
    1670 #endif
    16711669
    16721670    /*
     
    16881686        {
    16891687            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, VHDX_FILE_IDENTIFIER_OFFSET,
    1690                                        &FileIdentifier, sizeof(FileIdentifier), NULL);
     1688                                       &FileIdentifier, sizeof(FileIdentifier));
    16911689            if (RT_SUCCESS(rc))
    16921690            {
     
    17481746            {
    17491747                rc = vdIfIoIntFileReadSync(pIfIo, pStorage, VHDX_FILE_IDENTIFIER_OFFSET,
    1750                                            &FileIdentifier, sizeof(FileIdentifier), NULL);
     1748                                           &FileIdentifier, sizeof(FileIdentifier));
    17511749                if (RT_SUCCESS(rc))
    17521750                {
     
    19051903                uint64_t offFile = VHDX_BAT_ENTRY_GET_FILE_OFFSET(uBatEntry) + offRead;
    19061904                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, offFile,
    1907                                            pvBuf, cbToRead, NULL);
     1905                                           pvBuf, cbToRead);
    19081906                break;
    19091907            }
  • trunk/src/VBox/Storage/VMDK.cpp

    r44232 r44233  
    695695        {
    696696            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    697                                        uOffset, pMarker, RT_OFFSETOF(VMDKMARKER, uType),
    698                                        NULL);
     697                                       uOffset, pMarker, RT_OFFSETOF(VMDKMARKER, uType));
    699698            if (RT_FAILURE(rc))
    700699                return rc;
     
    728727                                              + RT_OFFSETOF(VMDKMARKER, uType),
    729728                                              512)
    730                                    - RT_OFFSETOF(VMDKMARKER, uType), NULL);
     729                                   - RT_OFFSETOF(VMDKMARKER, uType));
    731730
    732731        if (puLBA)
     
    838837                                          - RT_OFFSETOF(VMDKMARKER, uType));
    839838            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    840                                         uOffset, pMarker, uSize, NULL);
     839                                        uOffset, pMarker, uSize);
    841840            if (RT_FAILURE(rc))
    842841                return rc;
     
    10761075    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    10771076                               VMDK_SECTOR2BYTE(pExtent->uSectorGD),
    1078                                pExtent->pGD, cbGD, NULL);
     1077                               pExtent->pGD, cbGD);
    10791078    AssertRC(rc);
    10801079    if (RT_FAILURE(rc))
     
    10931092        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    10941093                                   VMDK_SECTOR2BYTE(pExtent->uSectorRGD),
    1095                                    pExtent->pRGD, cbGD, NULL);
     1094                                   pExtent->pRGD, cbGD);
    10961095        AssertRC(rc);
    10971096        if (RT_FAILURE(rc))
     
    12131212                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    12141213                                           VMDK_SECTOR2BYTE(uGTStart),
    1215                                            pTmpGT1, cbGTRead, NULL);
     1214                                           pTmpGT1, cbGTRead);
    12161215                if (RT_FAILURE(rc))
    12171216                {
     
    12241223                rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    12251224                                           VMDK_SECTOR2BYTE(uRGTStart),
    1226                                            pTmpGT2, cbGTRead, NULL);
     1225                                           pTmpGT2, cbGTRead);
    12271226                if (RT_FAILURE(rc))
    12281227                {
     
    13311330                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    13321331                                            VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + i * sizeof(uGTSectorLE),
    1333                                             &uGTSectorLE, sizeof(uGTSectorLE), NULL);
     1332                                            &uGTSectorLE, sizeof(uGTSectorLE));
    13341333                if (RT_FAILURE(rc))
    13351334                {
     
    13491348            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    13501349                                        VMDK_SECTOR2BYTE(pExtent->uSectorGD) + i * sizeof(uGTSectorLE),
    1351                                         &uGTSectorLE, sizeof(uGTSectorLE), NULL);
     1350                                        &uGTSectorLE, sizeof(uGTSectorLE));
    13521351            if (RT_FAILURE(rc))
    13531352            {
     
    24622461    {
    24632462        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pDescFile->pStorage, uOffset,
    2464                                     pvDescriptor, cbLimit ? cbLimit : cbDescriptor, NULL);
     2463                                    pvDescriptor, cbLimit ? cbLimit : cbDescriptor);
    24652464        if (RT_FAILURE(rc))
    24662465            rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename);
     
    25152514    if (RT_SUCCESS(rc))
    25162515    {
    2517         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pDescFile->pStorage,
    2518                                          uOffset, pvDescriptor,
    2519                                          cbLimit ? cbLimit : cbDescriptor,
    2520                                          pIoCtx, NULL, NULL);
     2516        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pDescFile->pStorage,
     2517                                    uOffset, pvDescriptor,
     2518                                    cbLimit ? cbLimit : cbDescriptor,
     2519                                    pIoCtx, NULL, NULL);
    25212520        if (   RT_FAILURE(rc)
    25222521            && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
     
    25812580    if (!fMagicAlreadyRead)
    25822581        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 0,
    2583                                    &Header, sizeof(Header), NULL);
     2582                                   &Header, sizeof(Header));
    25842583    else
    25852584    {
     
    25892588                                   &Header.version,
    25902589                                     sizeof(Header)
    2591                                    - RT_OFFSETOF(SparseExtentHeader, version),
    2592                                    NULL);
     2590                                   - RT_OFFSETOF(SparseExtentHeader, version));
    25932591    }
    25942592    AssertRC(rc);
     
    26302628        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    26312629                                   cbFile - 2*512, &Header,
    2632                                    sizeof(Header), NULL);
     2630                                   sizeof(Header));
    26332631        AssertRC(rc);
    26342632        if (RT_FAILURE(rc))
     
    28352833
    28362834    int rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    2837                                     uOffset, &Header, sizeof(Header), NULL);
     2835                                    uOffset, &Header, sizeof(Header));
    28382836    AssertRC(rc);
    28392837    if (RT_FAILURE(rc))
     
    28972895    Header.compressAlgorithm = RT_H2LE_U16(pExtent->uCompression);
    28982896
    2899     int rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    2900                                          uOffset, &Header, sizeof(Header),
    2901                                          pIoCtx, NULL, NULL);
     2897    int rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage,
     2898                                    uOffset, &Header, sizeof(Header),
     2899                                    pIoCtx, NULL, NULL);
    29022900    if (RT_FAILURE(rc) && (rc != VERR_VD_ASYNC_IO_IN_PROGRESS))
    29032901        rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: error writing extent header in '%s'"), pExtent->pszFullname);
     
    29172915
    29182916    int rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage, 0,
    2919                                    &Header, sizeof(Header), NULL);
     2917                                   &Header, sizeof(Header));
    29202918    AssertRC(rc);
    29212919    if (RT_FAILURE(rc))
     
    31303128    /* Read magic (if present). */
    31313129    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pFile->pStorage, 0,
    3132                                &u32Magic, sizeof(u32Magic), NULL);
     3130                               &u32Magic, sizeof(u32Magic));
    31333131    if (RT_FAILURE(rc))
    31343132    {
     
    31883186                                   VMDK_SECTOR2BYTE(pExtent->uDescriptorSector),
    31893187                                   pExtent->pDescData,
    3190                                    VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors), NULL);
     3188                                   VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors));
    31913189        AssertRC(rc);
    31923190        if (RT_FAILURE(rc))
     
    32553253         * image if it's a descriptor based one. */
    32563254        memcpy(pImage->pDescData, &u32Magic, sizeof(u32Magic));
    3257         size_t cbRead;
    32583255        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pFile->pStorage, sizeof(u32Magic),
    32593256                                   pImage->pDescData + sizeof(u32Magic),
    32603257                                   RT_MIN(pImage->cbDescAlloc - sizeof(u32Magic),
    3261                                           cbFileSize - sizeof(u32Magic)),
    3262                                    &cbRead);
     3258                                          cbFileSize - sizeof(u32Magic)));
    32633259        if (RT_FAILURE(rc))
    32643260        {
     
    32663262            goto out;
    32673263        }
     3264
     3265#if 0 /** @todo: Revisit */
    32683266        cbRead += sizeof(u32Magic);
    32693267        if (cbRead == pImage->cbDescAlloc)
     
    32743272            goto out;
    32753273        }
     3274#endif
    32763275
    32773276        rc = vmdkParseDescriptor(pImage, pImage->pDescData,
     
    36313630                                            VMDK_SECTOR2BYTE(uPartOffset),
    36323631                                            pPart->pvPartitionData,
    3633                                             pPart->cbData, NULL);
     3632                                            pPart->cbData);
    36343633                if (RT_FAILURE(rc))
    36353634                    return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: could not write partition data to '%s'"), pExtent->pszFullname);
     
    38353834
    38363835                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    3837                                             uOff, pvBuf, cbChunk, NULL);
     3836                                            uOff, pvBuf, cbChunk);
    38383837                if (RT_FAILURE(rc))
    38393838                {
     
    43144313    pMarker->uType = RT_H2LE_U32(VMDK_MARKER_GT);
    43154314    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, uFileOffset,
    4316                                 aMarker, sizeof(aMarker), NULL);
     4315                                aMarker, sizeof(aMarker));
    43174316    AssertRC(rc);
    43184317    uFileOffset += 512;
     
    43334332        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, uFileOffset,
    43344333                                    &pImage->pGTCache->aGTCache[i].aGTData[0],
    4335                                     VMDK_GT_CACHELINE_SIZE * sizeof(uint32_t),
    4336                                     NULL);
     4334                                    VMDK_GT_CACHELINE_SIZE * sizeof(uint32_t));
    43374335        uFileOffset += VMDK_GT_CACHELINE_SIZE * sizeof(uint32_t);
    43384336        if (RT_FAILURE(rc))
     
    44224420                pMarker->uType = RT_H2LE_U32(VMDK_MARKER_GD);
    44234421                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage, uFileOffset,
    4424                                             aMarker, sizeof(aMarker), NULL);
     4422                                            aMarker, sizeof(aMarker));
    44254423                AssertRC(rc);
    44264424                uFileOffset += 512;
     
    44334431                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    44344432                                            uFileOffset, pExtent->pGD,
    4435                                             pExtent->cGDEntries * sizeof(uint32_t),
    4436                                             NULL);
     4433                                            pExtent->cGDEntries * sizeof(uint32_t));
    44374434                AssertRC(rc);
    44384435
     
    44484445                pMarker->uType = RT_H2LE_U32(VMDK_MARKER_FOOTER);
    44494446                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    4450                                             uFileOffset, aMarker, sizeof(aMarker), NULL);
     4447                                            uFileOffset, aMarker, sizeof(aMarker));
    44514448                AssertRC(rc);
    44524449
     
    44594456                memset(pMarker, '\0', sizeof(aMarker));
    44604457                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    4461                                             uFileOffset, aMarker, sizeof(aMarker), NULL);
     4458                                            uFileOffset, aMarker, sizeof(aMarker));
    44624459                AssertRC(rc);
    44634460            }
     
    46674664        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    46684665                                   VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    4669                                    aGTDataTmp, sizeof(aGTDataTmp), NULL);
     4666                                   aGTDataTmp, sizeof(aGTDataTmp));
    46704667        if (RT_FAILURE(rc))
    46714668            return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot read grain table entry in '%s'"), pExtent->pszFullname);
     
    47194716        /* Cache miss, fetch data from disk. */
    47204717        PVDMETAXFER pMetaXfer;
    4721         rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    4722                                         VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    4723                                         aGTDataTmp, sizeof(aGTDataTmp), pIoCtx, &pMetaXfer, NULL, NULL);
     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);
    47244721        if (RT_FAILURE(rc))
    47254722            return rc;
     
    47974794            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    47984795                                        VMDK_SECTOR2BYTE(uGTSector) + i * sizeof(aGTDataTmp),
    4799                                         aGTDataTmp, sizeof(aGTDataTmp), NULL);
     4796                                        aGTDataTmp, sizeof(aGTDataTmp));
    48004797            if (RT_FAILURE(rc))
    48014798                return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write grain table allocation in '%s'"), pExtent->pszFullname);
     
    48324829                rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    48334830                                            VMDK_SECTOR2BYTE(uRGTSector) + i * sizeof(aGTDataTmp),
    4834                                             aGTDataTmp, sizeof(aGTDataTmp), NULL);
     4831                                            aGTDataTmp, sizeof(aGTDataTmp));
    48354832                if (RT_FAILURE(rc))
    48364833                    return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain table allocation in '%s'"), pExtent->pszFullname);
     
    48484845        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    48494846                                    VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE),
    4850                                     &uGTSectorLE, sizeof(uGTSectorLE), NULL);
     4847                                    &uGTSectorLE, sizeof(uGTSectorLE));
    48514848        if (RT_FAILURE(rc))
    48524849            return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write grain directory entry in '%s'"), pExtent->pszFullname);
     
    48564853            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    48574854                                        VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uRGTSectorLE),
    4858                                         &uRGTSectorLE, sizeof(uRGTSectorLE), NULL);
     4855                                        &uRGTSectorLE, sizeof(uRGTSectorLE));
    48594856            if (RT_FAILURE(rc))
    48604857                return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain directory entry in '%s'"), pExtent->pszFullname);
     
    48974894    {
    48984895        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    4899                                     uFileOffset, pvBuf, cbWrite, NULL);
     4896                                    uFileOffset, pvBuf, cbWrite);
    49004897        if (RT_FAILURE(rc))
    49014898            return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write allocated data block in '%s'"), pExtent->pszFullname);
     
    49134910        rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    49144911                                   VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    4915                                    aGTDataTmp, sizeof(aGTDataTmp), NULL);
     4912                                   aGTDataTmp, sizeof(aGTDataTmp));
    49164913        if (RT_FAILURE(rc))
    49174914            return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot read allocated grain table entry in '%s'"), pExtent->pszFullname);
     
    49344931    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    49354932                                VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    4936                                 aGTDataTmp, sizeof(aGTDataTmp), NULL);
     4933                                aGTDataTmp, sizeof(aGTDataTmp));
    49374934    if (RT_FAILURE(rc))
    49384935        return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write updated grain table in '%s'"), pExtent->pszFullname);
     
    49424939        rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    49434940                                    VMDK_SECTOR2BYTE(uRGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    4944                                     aGTDataTmp, sizeof(aGTDataTmp), NULL);
     4941                                    aGTDataTmp, sizeof(aGTDataTmp));
    49454942        if (RT_FAILURE(rc))
    49464943            return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: cannot write updated backup grain table in '%s'"), pExtent->pszFullname);
     
    50885085        LogFlow(("Cache miss, fetch data from disk\n"));
    50895086        PVDMETAXFER pMetaXfer = NULL;
    5090         rc = vdIfIoIntFileReadMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5091                                         VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    5092                                         aGTDataTmp, sizeof(aGTDataTmp), pIoCtx,
    5093                                         &pMetaXfer, vmdkAllocGrainAsyncComplete, pGrainAlloc);
     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);
    50945091        if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    50955092        {
     
    51205117    pGTCacheEntry->aGTData[uGTBlockIndex] = VMDK_BYTE2SECTOR(pGrainAlloc->uGrainOffset);
    51215118    /* Update grain table on disk. */
    5122     rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5123                                      VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    5124                                      aGTDataTmp, sizeof(aGTDataTmp), pIoCtx,
    5125                                      vmdkAllocGrainAsyncComplete, pGrainAlloc);
     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);
    51265123    if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    51275124        pGrainAlloc->cIoXfersPending++;
     
    51315128    {
    51325129        /* Update backup grain table on disk. */
    5133         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5134                                          VMDK_SECTOR2BYTE(uRGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    5135                                          aGTDataTmp, sizeof(aGTDataTmp), pIoCtx,
    5136                                          vmdkAllocGrainAsyncComplete, pGrainAlloc);
     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);
    51375134        if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    51385135            pGrainAlloc->cIoXfersPending++;
     
    52485245
    52495246        memset(paGTDataTmp, '\0', cbGTDataTmp);
    5250         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5251                                          VMDK_SECTOR2BYTE(uGTSector),
    5252                                          paGTDataTmp, cbGTDataTmp, pIoCtx,
    5253                                          vmdkAllocGrainAsyncComplete, pGrainAlloc);
     5247        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage,
     5248                                    VMDK_SECTOR2BYTE(uGTSector),
     5249                                    paGTDataTmp, cbGTDataTmp, pIoCtx,
     5250                                    vmdkAllocGrainAsyncComplete, pGrainAlloc);
    52545251        if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    52555252            pGrainAlloc->cIoXfersPending++;
     
    52835280             * cache chunks. Allocate memory dynamically here or we flood the
    52845281             * metadata cache with very small entries. */
    5285             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5286                                              VMDK_SECTOR2BYTE(uRGTSector),
    5287                                              paGTDataTmp, cbGTDataTmp, pIoCtx,
    5288                                              vmdkAllocGrainAsyncComplete, pGrainAlloc);
     5282            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage,
     5283                                        VMDK_SECTOR2BYTE(uRGTSector),
     5284                                        paGTDataTmp, cbGTDataTmp, pIoCtx,
     5285                                        vmdkAllocGrainAsyncComplete, pGrainAlloc);
    52895286            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    52905287                pGrainAlloc->cIoXfersPending++;
     
    53055302         * some unused sectors in the extent. */
    53065303        uint32_t uGTSectorLE = RT_H2LE_U64(uGTSector);
    5307         rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5308                                          VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE),
    5309                                          &uGTSectorLE, sizeof(uGTSectorLE), pIoCtx,
    5310                                          vmdkAllocGrainAsyncComplete, pGrainAlloc);
     5304        rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage,
     5305                                    VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE),
     5306                                    &uGTSectorLE, sizeof(uGTSectorLE), pIoCtx,
     5307                                    vmdkAllocGrainAsyncComplete, pGrainAlloc);
    53115308        if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    53125309            pGrainAlloc->cIoXfersPending++;
     
    53165313        {
    53175314            uint32_t uRGTSectorLE = RT_H2LE_U64(uRGTSector);
    5318             rc = vdIfIoIntFileWriteMetaAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5319                                              VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uGTSectorLE),
    5320                                              &uRGTSectorLE, sizeof(uRGTSectorLE), pIoCtx,
    5321                                              vmdkAllocGrainAsyncComplete, pGrainAlloc);
     5315            rc = vdIfIoIntFileWriteMeta(pImage->pIfIo, pExtent->pFile->pStorage,
     5316                                        VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uGTSectorLE),
     5317                                        &uRGTSectorLE, sizeof(uRGTSectorLE), pIoCtx,
     5318                                        vmdkAllocGrainAsyncComplete, pGrainAlloc);
    53225319            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    53235320                pGrainAlloc->cIoXfersPending++;
     
    53445341
    53455342    /* Write the data. Always a full grain, or we're in big trouble. */
    5346     rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    5347                                      uFileOffset, pIoCtx, cbWrite,
    5348                                      vmdkAllocGrainAsyncComplete, pGrainAlloc);
     5343    rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pExtent->pFile->pStorage,
     5344                                uFileOffset, pIoCtx, cbWrite,
     5345                                vmdkAllocGrainAsyncComplete, pGrainAlloc);
    53495346    if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    53505347        pGrainAlloc->cIoXfersPending++;
     
    54075404            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    54085405                                       VMDK_SECTOR2BYTE(uGrainSectorAbs),
    5409                                        &Marker, RT_OFFSETOF(VMDKMARKER, uType),
    5410                                        NULL);
     5406                                       &Marker, RT_OFFSETOF(VMDKMARKER, uType));
    54115407            if (RT_FAILURE(rc))
    54125408                return rc;
     
    54205416                                             VMDK_SECTOR2BYTE(uGrainSectorAbs)
    54215417                                           + RT_OFFSETOF(VMDKMARKER, uType),
    5422                                            &Marker.uType, sizeof(Marker.uType),
    5423                                            NULL);
     5418                                           &Marker.uType, sizeof(Marker.uType));
    54245419                if (RT_FAILURE(rc))
    54255420                    return rc;
     
    54375432                                                VMDK_SECTOR2BYTE(uGrainSectorAbs)
    54385433                                              + 511,
    5439                                               &Marker.uSector, 1, NULL);
     5434                                              &Marker.uSector, 1);
    54405435                        break;
    54415436                    case VMDK_MARKER_GT:
     
    61236118                    rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    61246119                                               VMDK_SECTOR2BYTE(uSectorExtentAbs),
    6125                                                pvBuf, cbToRead, NULL);
     6120                                               pvBuf, cbToRead);
    61266121                }
    61276122            }
     
    61316126            rc = vdIfIoIntFileReadSync(pImage->pIfIo, pExtent->pFile->pStorage,
    61326127                                       VMDK_SECTOR2BYTE(uSectorExtentRel),
    6133                                        pvBuf, cbToRead, NULL);
     6128                                       pvBuf, cbToRead);
    61346129            break;
    61356130        case VMDKETYPE_ZERO:
     
    62656260                    rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    62666261                                                VMDK_SECTOR2BYTE(uSectorExtentAbs),
    6267                                                 pvBuf, cbToWrite, NULL);
     6262                                                pvBuf, cbToWrite);
    62686263                }
    62696264            }
     
    62756270            rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pExtent->pFile->pStorage,
    62766271                                        VMDK_SECTOR2BYTE(uSectorExtentRel),
    6277                                         pvBuf, cbToWrite, NULL);
     6272                                        pvBuf, cbToWrite);
    62786273            break;
    62796274        case VMDKETYPE_ZERO:
     
    69386933            {
    69396934                AssertMsg(!(pImage->uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED), ("Async I/O is not supported for stream optimized VMDK's\n"));
    6940                 rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    6941                                                 VMDK_SECTOR2BYTE(uSectorExtentAbs),
    6942                                                 pIoCtx, cbRead);
     6935                rc = vdIfIoIntFileReadUser(pImage->pIfIo, pExtent->pFile->pStorage,
     6936                                           VMDK_SECTOR2BYTE(uSectorExtentAbs),
     6937                                           pIoCtx, cbRead);
    69436938            }
    69446939            break;
    69456940        case VMDKETYPE_VMFS:
    69466941        case VMDKETYPE_FLAT:
    6947             rc = vdIfIoIntFileReadUserAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    6948                                             VMDK_SECTOR2BYTE(uSectorExtentRel),
    6949                                             pIoCtx, cbRead);
     6942            rc = vdIfIoIntFileReadUser(pImage->pIfIo, pExtent->pFile->pStorage,
     6943                                       VMDK_SECTOR2BYTE(uSectorExtentRel),
     6944                                       pIoCtx, cbRead);
    69506945            break;
    69516946        case VMDKETYPE_ZERO:
     
    70637058            {
    70647059                Assert(!(pImage->uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED));
    7065                 rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    7066                                                  VMDK_SECTOR2BYTE(uSectorExtentAbs),
    7067                                                  pIoCtx, cbWrite, NULL, NULL);
     7060                rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pExtent->pFile->pStorage,
     7061                                            VMDK_SECTOR2BYTE(uSectorExtentAbs),
     7062                                            pIoCtx, cbWrite, NULL, NULL);
    70687063            }
    70697064            break;
     
    70727067            /* Clip write range to remain in this extent. */
    70737068            cbWrite = RT_MIN(cbWrite, VMDK_SECTOR2BYTE(pExtent->uSectorOffset + pExtent->cNominalSectors - uSectorExtentRel));
    7074             rc = vdIfIoIntFileWriteUserAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    7075                                              VMDK_SECTOR2BYTE(uSectorExtentRel),
    7076                                              pIoCtx, cbWrite, NULL, NULL);
     7069            rc = vdIfIoIntFileWriteUser(pImage->pIfIo, pExtent->pFile->pStorage,
     7070                                        VMDK_SECTOR2BYTE(uSectorExtentRel),
     7071                                        pIoCtx, cbWrite, NULL, NULL);
    70777072            break;
    70787073        case VMDKETYPE_ZERO:
     
    71677162                if (   pExtent->pFile != NULL
    71687163                    && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
    7169                     rc = vdIfIoIntFileFlushAsync(pImage->pIfIo, pExtent->pFile->pStorage,
    7170                                                  pIoCtx, NULL, NULL);
     7164                    rc = vdIfIoIntFileFlush(pImage->pIfIo, pExtent->pFile->pStorage,
     7165                                            pIoCtx, NULL, NULL);
    71717166                break;
    71727167            case VMDKETYPE_ZERO:
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette