VirtualBox

Changeset 65108 in vbox


Ignore:
Timestamp:
Jan 4, 2017 2:07:09 PM (8 years ago)
Author:
vboxsync
Message:

Storage/Devices/ATAPIPassthrough: Make use of the new SCSI inline helpers and remove the the local inlines

File:
1 edited

Legend:

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

    r64410 r65108  
    2424#include <VBox/cdefs.h>
    2525#include <VBox/scsi.h>
     26#include <VBox/scsiinline.h>
    2627
    2728#include "ATAPIPassthrough.h"
     
    111112} TRACKLIST, *PTRACKLIST;
    112113
    113 DECLINLINE(uint16_t) atapiBE2H_U16(const uint8_t *pbBuf)
    114 {
    115     return (pbBuf[0] << 8) | pbBuf[1];
    116 }
    117 
    118 
    119 DECLINLINE(uint32_t) atapiBE2H_U24(const uint8_t *pbBuf)
    120 {
    121     return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2];
    122 }
    123 
    124 
    125 DECLINLINE(uint32_t) atapiBE2H_U32(const uint8_t *pbBuf)
    126 {
    127     return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3];
    128 }
    129 
    130 DECLINLINE(int64_t) atapiMSF2LBA(const uint8_t *pbBuf)
    131 {
    132     return ((int64_t)(pbBuf[0] * 60 + pbBuf[1]) * 75 + pbBuf[2]) - 150; /* 2 second pregap */
    133 }
    134114
    135115/**
     
    247227    pTrack->enmMainDataForm = enmTrackDataForm;
    248228    pTrack->enmSubChnDataForm = enmSubChnDataForm;
    249     pTrack->iLbaStart = atapiMSF2LBA(&pbCueSheetEntry[5]);
     229    pTrack->iLbaStart = scsiMSF2LBA(&pbCueSheetEntry[5]);
    250230    if (pbCueSheetEntry[1] != 0xaa)
    251231    {
    252232        /* Calculate number of sectors from the next entry. */
    253         int64_t iLbaNext = atapiMSF2LBA(&pbCueSheetEntry[5+8]);
     233        int64_t iLbaNext = scsiMSF2LBA(&pbCueSheetEntry[5+8]);
    254234        pTrack->cSectors = iLbaNext - pTrack->iLbaStart;
    255235    }
     
    273253{
    274254    int rc = VINF_SUCCESS;
    275     unsigned cbCueSheet = atapiBE2H_U24(pbCDB + 6);
     255    unsigned cbCueSheet = scsiBE2H_U24(pbCDB + 6);
    276256    unsigned cTracks = cbCueSheet / 8;
    277257
     
    318298    RT_NOREF(iTrack, cbBuffer); /** @todo unused parameters */
    319299    int rc = VINF_SUCCESS;
    320     unsigned cbToc = atapiBE2H_U16(pbBuf);
     300    unsigned cbToc = scsiBE2H_U16(pbBuf);
    321301    uint8_t iTrackFirst = pbBuf[2];
    322302    unsigned cTracks;
     
    342322            pTrack->enmSubChnDataForm = SUBCHNDATAFORM_0;
    343323            if (fMSF)
    344                 pTrack->iLbaStart = atapiMSF2LBA(&pbBuf[4]);
     324                pTrack->iLbaStart = scsiMSF2LBA(&pbBuf[4]);
    345325            else
    346                 pTrack->iLbaStart = atapiBE2H_U32(&pbBuf[4]);
     326                pTrack->iLbaStart = scsiBE2H_U32(&pbBuf[4]);
    347327
    348328            if (pbBuf[2] != 0xaa)
     
    352332
    353333                if (fMSF)
    354                     iLbaNext = atapiMSF2LBA(&pbBuf[4+8]);
     334                    iLbaNext = scsiMSF2LBA(&pbBuf[4+8]);
    355335                else
    356                     iLbaNext = atapiBE2H_U32(&pbBuf[4+8]);
     336                    iLbaNext = scsiBE2H_U32(&pbBuf[4+8]);
    357337
    358338                pTrack->cSectors = iLbaNext - pTrack->iLbaStart;
     
    373353{
    374354    int rc = VINF_SUCCESS;
    375     uint16_t cbBuffer = atapiBE2H_U16(&pbCDB[7]);
     355    uint16_t cbBuffer = scsiBE2H_U16(&pbCDB[7]);
    376356    bool fMSF = (pbCDB[1] & 0x2) != 0;
    377357    uint8_t uFmt = pbCDB[2] & 0xf;
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