Changeset 29412 in vbox
- Timestamp:
- May 12, 2010 12:28:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
r29306 r29412 41 41 42 42 /** 43 * Transfer direction. 44 */ 45 typedef enum DRVDISKAIOTXDIR 46 { 47 /** Read */ 48 DRVDISKAIOTXDIR_READ = 0, 49 /** Write */ 50 DRVDISKAIOTXDIR_WRITE, 51 /** Flush */ 52 DRVDISKAIOTXDIR_FLUSH 53 } DRVDISKAIOTXDIR; 54 55 /** 43 56 * async I/O request. 44 57 */ 45 58 typedef struct DRVDISKAIOREQ 46 59 { 47 /** Flag whether this is a read or write request. */48 bool fRead;60 /** Transfer direction. */ 61 DRVDISKAIOTXDIR enmTxDir; 49 62 /** Start offset. */ 50 63 uint64_t off; … … 156 169 * 157 170 * @returns New I/O request. 158 * @param fRead Flag whether this is a read or a write.171 * @param enmTxDir Transfer direction. 159 172 * @param off Start offset. 160 173 * @param paSeg Segment array. … … 163 176 * @param pvUser User argument. 164 177 */ 165 static PDRVDISKAIOREQ drvdiskintIoReqAlloc( bool fRead, uint64_t off, PCRTSGSEG paSeg,178 static PDRVDISKAIOREQ drvdiskintIoReqAlloc(DRVDISKAIOTXDIR enmTxDir, uint64_t off, PCRTSGSEG paSeg, 166 179 unsigned cSeg, size_t cbTransfer, void *pvUser) 167 180 { … … 170 183 if (RT_LIKELY(pIoReq)) 171 184 { 172 pIoReq-> fRead = fRead;185 pIoReq->enmTxDir = enmTxDir; 173 186 pIoReq->off = off; 174 187 pIoReq->cbTransfer = cbTransfer; … … 529 542 uOffset, paSeg, cSeg, cbRead, pvUser)); 530 543 PDRVDISKINTEGRITY pThis = PDMIMEDIAASYNC_2_DRVDISKINTEGRITY(pInterface); 531 PDRVDISKAIOREQ pIoReq = drvdiskintIoReqAlloc( true, uOffset, paSeg, cSeg, cbRead, pvUser);544 PDRVDISKAIOREQ pIoReq = drvdiskintIoReqAlloc(DRVDISKAIOTXDIR_READ, uOffset, paSeg, cSeg, cbRead, pvUser); 532 545 AssertPtr(pIoReq); 533 546 … … 564 577 uOffset, paSeg, cSeg, cbWrite, pvUser)); 565 578 PDRVDISKINTEGRITY pThis = PDMIMEDIAASYNC_2_DRVDISKINTEGRITY(pInterface); 566 PDRVDISKAIOREQ pIoReq = drvdiskintIoReqAlloc( false, uOffset, paSeg, cSeg, cbWrite, pvUser);579 PDRVDISKAIOREQ pIoReq = drvdiskintIoReqAlloc(DRVDISKAIOTXDIR_WRITE, uOffset, paSeg, cSeg, cbWrite, pvUser); 567 580 AssertPtr(pIoReq); 568 581 … … 593 606 } 594 607 608 /** @copydoc PDMIMEDIAASYNC::pfnStartFlush */ 609 static DECLCALLBACK(int) drvdiskintStartFlush(PPDMIMEDIAASYNC pInterface, void *pvUser) 610 { 611 PDRVDISKINTEGRITY pThis = PDMIMEDIAASYNC_2_DRVDISKINTEGRITY(pInterface); 612 PDRVDISKAIOREQ pIoReq = drvdiskintIoReqAlloc(DRVDISKAIOTXDIR_FLUSH, 0, NULL, 0, 0, pvUser); 613 AssertPtr(pIoReq); 614 615 return pThis->pDrvMediaAsync->pfnStartFlush(pThis->pDrvMediaAsync, pIoReq); 616 } 617 595 618 /** @copydoc PDMIMEDIA::pfnFlush */ 596 619 static DECLCALLBACK(int) drvdiskintFlush(PPDMIMEDIA pInterface) … … 672 695 if (RT_SUCCESS(rcReq) && pThis->fCheckConsistency) 673 696 { 674 if (pIoReq-> fRead)697 if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_READ) 675 698 rc = drvdiskintReadVerify(pThis, pIoReq->paSeg, pIoReq->cSeg, pIoReq->off, pIoReq->cbTransfer); 699 else if (pIoReq->enmTxDir == DRVDISKAIOTXDIR_WRITE) 700 rc = drvdiskintWriteRecord(pThis, pIoReq->paSeg, pIoReq->cSeg, pIoReq->off, pIoReq->cbTransfer); 676 701 else 677 rc = drvdiskintWriteRecord(pThis, pIoReq->paSeg, pIoReq->cSeg, pIoReq->off, pIoReq->cbTransfer);702 AssertMsg(pIoReq->enmTxDir == DRVDISKAIOTXDIR_FLUSH, ("Huh?\n")); 678 703 679 704 AssertRC(rc); … … 789 814 pThis->IMediaAsync.pfnStartRead = drvdiskintStartRead; 790 815 pThis->IMediaAsync.pfnStartWrite = drvdiskintStartWrite; 816 pThis->IMediaAsync.pfnStartFlush = drvdiskintStartFlush; 791 817 792 818 /* IMediaAsyncPort. */
Note:
See TracChangeset
for help on using the changeset viewer.