VirtualBox

Changeset 40840 in vbox


Ignore:
Timestamp:
Apr 10, 2012 8:19:34 AM (13 years ago)
Author:
vboxsync
Message:

Storage/Debug: Function to log a CUE sheet

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/scsi.h

    r40543 r40840  
    271271int SCSILogModePage(char *pszBuf, size_t cchBuffer, uint8_t *pbModePage,
    272272                    size_t cbModePage);
     273int SCSILogCueSheet(char *pszBuf, size_t cchBuffer, uint8_t *pbCueSheet,
     274                    size_t cbCueSheet);
    273275#endif
    274276
  • trunk/src/VBox/Devices/Storage/Debug.cpp

    r40543 r40840  
    10431043
    10441044/**
    1045  * Log a mode page to a human readable form.
     1045 * Log a mode page in a human readable form.
    10461046 *
    10471047 * @returns VBox status code.
     
    10931093    return rc;
    10941094}
     1095
     1096/**
     1097 * Log a cue sheet in a human readable form.
     1098 *
     1099 * @returns VBox status code.
     1100 * @retval VERR_BUFFER_OVERFLOW if the given buffer is not large enough.
     1101 *         The buffer might contain valid data though.
     1102 * @param  pszBuffer     The buffer to log into.
     1103 * @param  cchBuffer     Size of the buffer in characters.
     1104 * @param  pbCueSheet    The cue sheet buffer.
     1105 * @param  cbCueSheet    Size of the cue sheet buffer in bytes.
     1106 */
     1107int SCSILogCueSheet(char *pszBuffer, size_t cchBuffer, uint8_t *pbCueSheet,
     1108                    size_t cbCueSheet)
     1109{
     1110    int rc = VINF_SUCCESS;
     1111    size_t cch = 0;
     1112    unsigned cCueSheetEntries = cbCueSheet / 8;
     1113
     1114    AssertReturn(cbCueSheet % 8 == 0, VERR_INVALID_PARAMETER);
     1115
     1116    for (unsigned i = 0; i < cCueSheetEntries; i++)
     1117    {
     1118        cch = RTStrPrintf(pszBuffer, cchBuffer,
     1119                          "CTL/ADR=%#x TNO=%#x INDEX=%#x DATA=%#x SCMS=%#x TIME=%u:%u:%u\n",
     1120                          pbCueSheet[0], pbCueSheet[1], pbCueSheet[2], pbCueSheet[3],
     1121                          pbCueSheet[4], pbCueSheet[5], pbCueSheet[6], pbCueSheet[7]);
     1122        pszBuffer += cch;
     1123        cchBuffer -= cch;
     1124        if (!cchBuffer)
     1125        {
     1126            rc = VERR_BUFFER_OVERFLOW;
     1127            break;
     1128        }
     1129
     1130        pbCueSheet += 8;
     1131        cbCueSheet -= 8;
     1132    }
     1133
     1134    return rc;
     1135}
     1136
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