VirtualBox

Changeset 63700 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Sep 2, 2016 1:43:20 PM (8 years ago)
Author:
vboxsync
Message:

Storage/DrvDiskIntegrity: Start integration to work with the extended media interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp

    r63689 r63700  
    161161    /** Our media async port interface */
    162162    PDMIMEDIAASYNCPORT      IMediaAsyncPort;
     163
     164    /** The extended media port interface above. */
     165    PPDMIMEDIAEXPORT        pDrvMediaExPort;
     166    /** Our extended media port interface */
     167    PDMIMEDIAEXPORT         IMediaExPort;
     168
     169    /** The extended media interface below. */
     170    PPDMIMEDIAEX            pDrvMediaEx;
     171    /** Our extended media interface */
     172    PDMIMEDIAEX             IMediaEx;
    163173
    164174    /** Flag whether consistency checks are enabled. */
     
    12851295}
    12861296
     1297/* -=-=-=-=- IMediaExPort -=-=-=-=- */
     1298
     1299/**
     1300 * @interface_method_impl{PDMIMEDIAEXPORT,pfnIoReqCompleteNotify}
     1301 */
     1302static DECLCALLBACK(int) drvdiskintIoReqCompleteNotify(PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
     1303                                                       void *pvIoReqAlloc, int rcReq)
     1304{
     1305    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaExPort);
     1306    return pThis->pDrvMediaExPort->pfnIoReqCompleteNotify(pThis->pDrvMediaExPort, hIoReq, pvIoReqAlloc, rcReq);
     1307}
     1308
     1309/**
     1310 * @interface_method_impl{PDMIMEDIAEXPORT,pfnIoReqCopyFromBuf}
     1311 */
     1312static DECLCALLBACK(int) drvdiskintIoReqCopyFromBuf(PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
     1313                                                    void *pvIoReqAlloc, uint32_t offDst, PRTSGBUF pSgBuf,
     1314                                                    size_t cbCopy)
     1315{
     1316    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaExPort);
     1317    return pThis->pDrvMediaExPort->pfnIoReqCopyFromBuf(pThis->pDrvMediaExPort, hIoReq, pvIoReqAlloc, offDst,
     1318                                                       pSgBuf, cbCopy);
     1319}
     1320
     1321/**
     1322 * @interface_method_impl{PDMIMEDIAEXPORT,pfnIoReqCopyToBuf}
     1323 */
     1324static DECLCALLBACK(int) drvdiskintIoReqCopyToBuf(PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
     1325                                                  void *pvIoReqAlloc, uint32_t offSrc, PRTSGBUF pSgBuf,
     1326                                                  size_t cbCopy)
     1327{
     1328    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaExPort);
     1329    return pThis->pDrvMediaExPort->pfnIoReqCopyToBuf(pThis->pDrvMediaExPort, hIoReq, pvIoReqAlloc, offSrc,
     1330                                                     pSgBuf, cbCopy);
     1331}
     1332
     1333/**
     1334 * @interface_method_impl{PDMIMEDIAEXPORT,pfnIoReqStateChanged}
     1335 */
     1336static DECLCALLBACK(void) drvdiskintIoReqStateChanged(PPDMIMEDIAEXPORT pInterface, PDMMEDIAEXIOREQ hIoReq,
     1337                                                     void *pvIoReqAlloc, PDMMEDIAEXIOREQSTATE enmState)
     1338{
     1339    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaExPort);
     1340    pThis->pDrvMediaExPort->pfnIoReqStateChanged(pThis->pDrvMediaExPort, hIoReq, pvIoReqAlloc, enmState);
     1341}
     1342
     1343/* -=-=-=-=- IMediaEx -=-=-=-=- */
     1344
     1345/**
     1346 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqAllocSizeSet}
     1347 */
     1348static DECLCALLBACK(int) drvdiskintIoReqAllocSizeSet(PPDMIMEDIAEX pInterface, size_t cbIoReqAlloc)
     1349{
     1350    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1351    return pThis->pDrvMediaEx->pfnIoReqAllocSizeSet(pThis->pDrvMediaEx, cbIoReqAlloc);
     1352}
     1353
     1354/**
     1355 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqAlloc}
     1356 */
     1357static DECLCALLBACK(int) drvdiskintIoReqAlloc(PPDMIMEDIAEX pInterface, PPDMMEDIAEXIOREQ phIoReq, void **ppvIoReqAlloc,
     1358                                              PDMMEDIAEXIOREQID uIoReqId, uint32_t fFlags)
     1359{
     1360    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1361    return pThis->pDrvMediaEx->pfnIoReqAlloc(pThis->pDrvMediaEx, phIoReq, ppvIoReqAlloc, uIoReqId, fFlags);
     1362}
     1363
     1364/**
     1365 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqFree}
     1366 */
     1367static DECLCALLBACK(int) drvdiskintIoReqFree(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq)
     1368{
     1369    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1370    return pThis->pDrvMediaEx->pfnIoReqFree(pThis->pDrvMediaEx, hIoReq);
     1371}
     1372
     1373/**
     1374 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqCancel}
     1375 */
     1376static DECLCALLBACK(int) drvdiskintIoReqCancel(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQID uIoReqId)
     1377{
     1378    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1379    return pThis->pDrvMediaEx->pfnIoReqCancel(pThis->pDrvMediaEx, uIoReqId);
     1380}
     1381
     1382/**
     1383 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqRead}
     1384 */
     1385static DECLCALLBACK(int) drvdiskintIoReqRead(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, uint64_t off, size_t cbRead)
     1386{
     1387    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1388    return pThis->pDrvMediaEx->pfnIoReqRead(pThis->pDrvMediaEx, hIoReq, off, cbRead);
     1389}
     1390
     1391/**
     1392 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqWrite}
     1393 */
     1394static DECLCALLBACK(int) drvdiskintIoReqWrite(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, uint64_t off, size_t cbWrite)
     1395{
     1396    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1397    return pThis->pDrvMediaEx->pfnIoReqWrite(pThis->pDrvMediaEx, hIoReq, off, cbWrite);
     1398}
     1399
     1400/**
     1401 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqFlush}
     1402 */
     1403static DECLCALLBACK(int) drvdiskintIoReqFlush(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq)
     1404{
     1405    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1406    return pThis->pDrvMediaEx->pfnIoReqFlush(pThis->pDrvMediaEx, hIoReq);
     1407}
     1408
     1409/**
     1410 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqDiscard}
     1411 */
     1412static DECLCALLBACK(int) drvdiskintIoReqDiscard(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq, PCRTRANGE paRanges, unsigned cRanges)
     1413{
     1414    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1415    return pThis->pDrvMediaEx->pfnIoReqDiscard(pThis->pDrvMediaEx, hIoReq, paRanges, cRanges);
     1416}
     1417
     1418/**
     1419 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqGetActiveCount}
     1420 */
     1421static DECLCALLBACK(uint32_t) drvdiskintIoReqGetActiveCount(PPDMIMEDIAEX pInterface)
     1422{
     1423    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1424    return pThis->pDrvMediaEx->pfnIoReqGetActiveCount(pThis->pDrvMediaEx);
     1425}
     1426
     1427/**
     1428 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqGetSuspendedCount}
     1429 */
     1430static DECLCALLBACK(uint32_t) drvdiskintIoReqGetSuspendedCount(PPDMIMEDIAEX pInterface)
     1431{
     1432    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1433    return pThis->pDrvMediaEx->pfnIoReqGetSuspendedCount(pThis->pDrvMediaEx);
     1434}
     1435
     1436/**
     1437 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqQuerySuspendedStart}
     1438 */
     1439static DECLCALLBACK(int) drvdiskintIoReqQuerySuspendedStart(PPDMIMEDIAEX pInterface, PPDMMEDIAEXIOREQ phIoReq, void **ppvIoReqAlloc)
     1440{
     1441    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1442    return pThis->pDrvMediaEx->pfnIoReqQuerySuspendedStart(pThis->pDrvMediaEx, phIoReq, ppvIoReqAlloc);
     1443}
     1444
     1445/**
     1446 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqQuerySuspendedNext}
     1447 */
     1448static DECLCALLBACK(int) drvdiskintIoReqQuerySuspendedNext(PPDMIMEDIAEX pInterface, PDMMEDIAEXIOREQ hIoReq,
     1449                                                           PPDMMEDIAEXIOREQ phIoReqNext, void **ppvIoReqAllocNext)
     1450{
     1451    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1452    return pThis->pDrvMediaEx->pfnIoReqQuerySuspendedNext(pThis->pDrvMediaEx, hIoReq, phIoReqNext, ppvIoReqAllocNext);
     1453}
     1454
     1455/**
     1456 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqSuspendedSave}
     1457 */
     1458static DECLCALLBACK(int) drvdiskintIoReqSuspendedSave(PPDMIMEDIAEX pInterface, PSSMHANDLE pSSM, PDMMEDIAEXIOREQ hIoReq)
     1459{
     1460    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1461    return pThis->pDrvMediaEx->pfnIoReqSuspendedSave(pThis->pDrvMediaEx, pSSM, hIoReq);
     1462}
     1463
     1464/**
     1465 * @interface_method_impl{PDMIMEDIAEX,pfnIoReqSuspendedLoad}
     1466 */
     1467static DECLCALLBACK(int) drvdiskintIoReqSuspendedLoad(PPDMIMEDIAEX pInterface, PSSMHANDLE pSSM, PDMMEDIAEXIOREQ hIoReq)
     1468{
     1469    PDRVDISKINTEGRITY pThis = RT_FROM_MEMBER(pInterface, DRVDISKINTEGRITY, IMediaEx);
     1470    return pThis->pDrvMediaEx->pfnIoReqSuspendedLoad(pThis->pDrvMediaEx, pSSM, hIoReq);
     1471}
     1472
    12871473/* -=-=-=-=- IBase -=-=-=-=- */
    12881474
     
    13001486    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAASYNCPORT, &pThis->IMediaAsyncPort);
    13011487    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAPORT, &pThis->IMediaPort);
     1488    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAEXPORT, &pThis->IMediaExPort);
     1489    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIMEDIAEX, pThis->pDrvMediaEx ? &pThis->IMediaEx : NULL);
    13021490    return NULL;
    13031491}
     
    14311619    pThis->IMediaAsync.pfnStartFlush     = drvdiskintStartFlush;
    14321620
     1621    /* IMediaEx. */
     1622    pThis->IMediaEx.pfnIoReqAllocSizeSet        = drvdiskintIoReqAllocSizeSet;
     1623    pThis->IMediaEx.pfnIoReqAlloc               = drvdiskintIoReqAlloc;
     1624    pThis->IMediaEx.pfnIoReqFree                = drvdiskintIoReqFree;
     1625    pThis->IMediaEx.pfnIoReqCancel              = drvdiskintIoReqCancel;
     1626    pThis->IMediaEx.pfnIoReqRead                = drvdiskintIoReqRead;
     1627    pThis->IMediaEx.pfnIoReqWrite               = drvdiskintIoReqWrite;
     1628    pThis->IMediaEx.pfnIoReqFlush               = drvdiskintIoReqFlush;
     1629    pThis->IMediaEx.pfnIoReqDiscard             = drvdiskintIoReqDiscard;
     1630    pThis->IMediaEx.pfnIoReqGetActiveCount      = drvdiskintIoReqGetActiveCount;
     1631    pThis->IMediaEx.pfnIoReqGetSuspendedCount   = drvdiskintIoReqGetSuspendedCount;
     1632    pThis->IMediaEx.pfnIoReqQuerySuspendedStart = drvdiskintIoReqQuerySuspendedStart;
     1633    pThis->IMediaEx.pfnIoReqQuerySuspendedNext  = drvdiskintIoReqQuerySuspendedNext;
     1634    pThis->IMediaEx.pfnIoReqSuspendedSave       = drvdiskintIoReqSuspendedSave;
     1635    pThis->IMediaEx.pfnIoReqSuspendedLoad       = drvdiskintIoReqSuspendedLoad;
     1636
    14331637    /* IMediaAsyncPort. */
    14341638    pThis->IMediaAsyncPort.pfnTransferCompleteNotify  = drvdiskintAsyncTransferCompleteNotify;
     
    14361640    /* IMediaPort. */
    14371641    pThis->IMediaPort.pfnQueryDeviceLocation = drvdiskintQueryDeviceLocation;
     1642
     1643    /* IMediaExPort. */
     1644    pThis->IMediaExPort.pfnIoReqCompleteNotify = drvdiskintIoReqCompleteNotify;
     1645    pThis->IMediaExPort.pfnIoReqCopyFromBuf    = drvdiskintIoReqCopyFromBuf;
     1646    pThis->IMediaExPort.pfnIoReqCopyToBuf      = drvdiskintIoReqCopyToBuf;
     1647    pThis->IMediaExPort.pfnIoReqStateChanged   = drvdiskintIoReqStateChanged;
    14381648
    14391649    /* Query the media port interface above us. */
     
    14451655    /* Try to attach async media port interface above.*/
    14461656    pThis->pDrvMediaAsyncPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIMEDIAASYNCPORT);
     1657
     1658    /* Try to attach extended media port interface above.*/
     1659    pThis->pDrvMediaExPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIMEDIAEXPORT);
    14471660
    14481661    /*
     
    14611674
    14621675    pThis->pDrvMediaAsync = PDMIBASE_QUERY_INTERFACE(pBase, PDMIMEDIAASYNC);
     1676    pThis->pDrvMediaEx = PDMIBASE_QUERY_INTERFACE(pBase, PDMIMEDIAEX);
    14631677
    14641678    if (pThis->pDrvMedia->pfnDiscard)
Note: See TracChangeset for help on using the changeset viewer.

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