VirtualBox

Changeset 2728 in vbox for trunk/src


Ignore:
Timestamp:
May 21, 2007 11:57:36 AM (18 years ago)
Author:
vboxsync
Message:

Allow (but punish with an assertion) creation of a HDD container without
error callback. Also fix typo (copied several times) that passed wrong
data to the backend, which didn't work correctly then.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp

    r2718 r2728  
    134134    va_list va;
    135135    va_start(va, pszFormat);
    136     pfnError(pvErrorUser, rc, RT_SRC_POS_ARGS, pszFormat, va);
     136    if (pfnError)
     137        pfnError(pvErrorUser, rc, RT_SRC_POS_ARGS, pszFormat, va);
    137138    va_end(va);
    138139    return rc;
     
    147148    va_list va;
    148149    va_start(va, pszFormat);
    149     pDisk->pfnError(pDisk->pvErrorUser, rc, RT_SRC_POS_ARGS, pszFormat, va);
     150    if (pDisk->pfnError)
     151        pDisk->pfnError(pDisk->pvErrorUser, rc, RT_SRC_POS_ARGS, pszFormat, va);
    150152    va_end(va);
    151153    return rc;
     
    469471    PVBOXHDDBACKEND pBackend = NULL;
    470472    PVBOXHDD pDisk = NULL;
     473
     474    /* Passing an error callback is strictly not necessary any more. Any code
     475     * calling the HDD container functions should provide one, as otherwise
     476     * many detailed error messages will go unnoticed. If you find a situation
     477     * where you get no sensible error message from this code but you think
     478     * there should be one, shout loudly. There are no error messages for rare
     479     * and obvious error codes such as VERR_NO_MEMORY, and for situations which
     480     * the user cannot be made responsible for, such as program bugs causing
     481     * parameter checks to fail etc. */
     482    Assert(pfnError);
    471483
    472484    /* Find backend. */
     
    16171629    int rc;
    16181630    if (pImage)
    1619         rc = pDisk->Backend->pfnGetUuid(pImage, pUuid);
     1631        rc = pDisk->Backend->pfnGetUuid(pImage->pvBackendData, pUuid);
    16201632    else
    16211633        rc = VERR_VDI_IMAGE_NOT_FOUND;
     
    16461658    int rc;
    16471659    if (pImage)
    1648         rc = pDisk->Backend->pfnSetUuid(pImage, pUuid);
     1660        rc = pDisk->Backend->pfnSetUuid(pImage->pvBackendData, pUuid);
    16491661    else
    16501662        rc = VERR_VDI_IMAGE_NOT_FOUND;
     
    16731685    int rc;
    16741686    if (pImage)
    1675         rc = pDisk->Backend->pfnGetModificationUuid(pImage, pUuid);
     1687        rc = pDisk->Backend->pfnGetModificationUuid(pImage->pvBackendData, pUuid);
    16761688    else
    16771689        rc = VERR_VDI_IMAGE_NOT_FOUND;
     
    17021714    int rc;
    17031715    if (pImage)
    1704         rc = pDisk->Backend->pfnSetModificationUuid(pImage, pUuid);
     1716        rc = pDisk->Backend->pfnSetModificationUuid(pImage->pvBackendData, pUuid);
    17051717    else
    17061718        rc = VERR_VDI_IMAGE_NOT_FOUND;
     
    17301742    int rc;
    17311743    if (pImage)
    1732         rc = pDisk->Backend->pfnGetParentUuid(pImage, pUuid);
     1744        rc = pDisk->Backend->pfnGetParentUuid(pImage->pvBackendData, pUuid);
    17331745    else
    17341746        rc = VERR_VDI_IMAGE_NOT_FOUND;
     
    17591771    int rc;
    17601772    if (pImage)
    1761         rc = pDisk->Backend->pfnSetParentUuid(pImage, pUuid);
     1773        rc = pDisk->Backend->pfnSetParentUuid(pImage->pvBackendData, pUuid);
    17621774    else
    17631775        rc = VERR_VDI_IMAGE_NOT_FOUND;
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