VirtualBox

Ignore:
Timestamp:
Aug 8, 2008 4:14:51 PM (16 years ago)
Author:
vboxsync
Message:

Devices: VBOX_SUCCESS/FAILURE -> RT_SUCCESS/FAILURE.

File:
1 edited

Legend:

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

    r11176 r11266  
    368368    /** Async I/O interface callbacks. */
    369369    PVDINTERFACEASYNCIO pInterfaceAsyncIOCallbacks;
    370     /** 
     370    /**
    371371     * Pointer to an array of task handles for task submission.
    372372     * This is an optimization because the task number to submit is not known
     
    496496        pVmdkFile->fAsyncIO = false;
    497497    }
    498     if (VBOX_SUCCESS(rc))
     498    if (RT_SUCCESS(rc))
    499499    {
    500500        pVmdkFile->uReferences = 1;
     
    554554            rc = RTFileClose(pVmdkFile->File);
    555555        }
    556         if (VBOX_SUCCESS(rc) && pVmdkFile->fDelete)
     556        if (RT_SUCCESS(rc) && pVmdkFile->fDelete)
    557557            rc = RTFileDelete(pVmdkFile->pszFilename);
    558558        RTStrFree((char *)(void *)pVmdkFile->pszFilename);
     
    567567 * Internal: read from a file distinguishing between async and normal operation
    568568 */
    569 DECLINLINE(int) vmdkFileReadAt(PVMDKFILE pVmdkFile, 
    570                                uint64_t uOffset, void *pvBuf, 
     569DECLINLINE(int) vmdkFileReadAt(PVMDKFILE pVmdkFile,
     570                               uint64_t uOffset, void *pvBuf,
    571571                               size_t cbToRead, size_t *pcbRead)
    572572{
     
    584584 * Internal: write to a file distinguishing between async and normal operation
    585585 */
    586 DECLINLINE(int) vmdkFileWriteAt(PVMDKFILE pVmdkFile, 
    587                                 uint64_t uOffset, const void *pvBuf, 
     586DECLINLINE(int) vmdkFileWriteAt(PVMDKFILE pVmdkFile,
     587                                uint64_t uOffset, const void *pvBuf,
    588588                                size_t cbToWrite, size_t *pcbWritten)
    589589{
     
    663663            rc2 = RTFileClose(pVmdkFile->File);
    664664
    665         if (VBOX_SUCCESS(rc) && pVmdkFile->fDelete)
     665        if (RT_SUCCESS(rc) && pVmdkFile->fDelete)
    666666            rc2 = RTFileDelete(pVmdkFile->pszFilename);
    667667        RTStrFree((char *)(void *)pVmdkFile->pszFilename);
    668668        RTMemFree(pVmdkFile);
    669         if (VBOX_SUCCESS(rc))
     669        if (RT_SUCCESS(rc))
    670670            rc = rc2;
    671671    }
     
    781781                        pGD, cbGD, NULL);
    782782    AssertRC(rc);
    783     if (VBOX_FAILURE(rc))
     783    if (RT_FAILURE(rc))
    784784    {
    785785        rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: could not read grain directory in '%s'"), pExtent->pszFullname);
     
    801801                            pRGD, cbGD, NULL);
    802802        AssertRC(rc);
    803         if (VBOX_FAILURE(rc))
     803        if (RT_FAILURE(rc))
    804804        {
    805805            rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: could not read redundant grain directory in '%s'"), pExtent->pszFullname);
     
    845845            rc = vmdkFileReadAt(pExtent->pFile, VMDK_SECTOR2BYTE(*pGDTmp),
    846846                                pTmpGT1, cbGT, NULL);
    847             if (VBOX_FAILURE(rc))
     847            if (RT_FAILURE(rc))
    848848            {
    849849                rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error reading grain table in '%s'"), pExtent->pszFullname);
     
    854854            rc = vmdkFileReadAt(pExtent->pFile, VMDK_SECTOR2BYTE(*pRGDTmp),
    855855                                pTmpGT2, cbGT, NULL);
    856             if (VBOX_FAILURE(rc))
     856            if (RT_FAILURE(rc))
    857857            {
    858858                rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error reading backup grain table in '%s'"), pExtent->pszFullname);
     
    874874
    875875out:
    876     if (VBOX_FAILURE(rc))
     876    if (RT_FAILURE(rc))
    877877        vmdkFreeGrainDirectory(pExtent);
    878878    return rc;
     
    912912    cbOverhead = RT_ALIGN_64(VMDK_SECTOR2BYTE(uStartSector) + 2 * (cbGDRounded + cbGTRounded), VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain));
    913913    rc = vmdkFileSetSize(pExtent->pFile, cbOverhead);
    914     if (VBOX_FAILURE(rc))
     914    if (RT_FAILURE(rc))
    915915        goto out;
    916916    pExtent->uSectorRGD = uStartSector;
     
    931931                                 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + i * sizeof(uGTSectorLE),
    932932                                 &uGTSectorLE, sizeof(uGTSectorLE), NULL);
    933             if (VBOX_FAILURE(rc))
     933            if (RT_FAILURE(rc))
    934934                return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new redundant grain directory entry in '%s'"), pExtent->pszFullname);
    935935            uOffsetSectors += VMDK_BYTE2SECTOR(pExtent->cGTEntries * sizeof(uint32_t));
     
    945945                                 VMDK_SECTOR2BYTE(pExtent->uSectorGD) + i * sizeof(uGTSectorLE),
    946946                                 &uGTSectorLE, sizeof(uGTSectorLE), NULL);
    947             if (VBOX_FAILURE(rc))
     947            if (RT_FAILURE(rc))
    948948                return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new grain directory entry in '%s'"), pExtent->pszFullname);
    949949            uOffsetSectors += VMDK_BYTE2SECTOR(pExtent->cGTEntries * sizeof(uint32_t));
     
    953953
    954954out:
    955     if (VBOX_FAILURE(rc))
     955    if (RT_FAILURE(rc))
    956956        vmdkFreeGrainDirectory(pExtent);
    957957    return rc;
     
    11761176        return VERR_VDI_VALUE_NOT_FOUND;
    11771177    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    1178     if (VBOX_FAILURE(rc))
     1178    if (RT_FAILURE(rc))
    11791179        return rc;
    11801180    *ppszValue = pszValueUnquoted;
     
    11881188
    11891189    int rc = RTStrAPrintf(&pszValueQuoted, "\"%s\"", pszValue);
    1190     if (VBOX_FAILURE(rc))
     1190    if (RT_FAILURE(rc))
    11911191        return rc;
    11921192    rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDesc, pszKey,
     
    13051305        return VERR_VDI_VALUE_NOT_FOUND;
    13061306    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    1307     if (VBOX_FAILURE(rc))
     1307    if (RT_FAILURE(rc))
    13081308        return rc;
    13091309    *ppszValue = pszValueUnquoted;
     
    13211321        return VERR_VDI_VALUE_NOT_FOUND;
    13221322    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    1323     if (VBOX_FAILURE(rc))
     1323    if (RT_FAILURE(rc))
    13241324        return rc;
    13251325    rc = RTStrToUInt32Ex(pszValueUnquoted, NULL, 10, puValue);
     
    13381338        return VERR_VDI_VALUE_NOT_FOUND;
    13391339    int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL);
    1340     if (VBOX_FAILURE(rc))
     1340    if (RT_FAILURE(rc))
    13411341        return rc;
    13421342    rc = RTUuidFromStr(pUuid, pszValueUnquoted);
     
    13541354    {
    13551355        rc = RTStrAPrintf(&pszValQuoted, "\"%s\"", pszVal);
    1356         if (VBOX_FAILURE(rc))
     1356        if (RT_FAILURE(rc))
    13571357            return rc;
    13581358    }
     
    13721372
    13731373    int rc = RTStrAPrintf(&pszUuid, "\"%Vuuid\"", pUuid);
    1374     if (VBOX_FAILURE(rc))
     1374    if (RT_FAILURE(rc))
    13751375        return rc;
    13761376    rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDDB, pszKey,
     
    13861386
    13871387    int rc = RTStrAPrintf(&pszValue, "\"%d\"", uValue);
    1388     if (VBOX_FAILURE(rc))
     1388    if (RT_FAILURE(rc))
    13891389        return rc;
    13901390    rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDDB, pszKey,
     
    15171517                           VMDK_DDB_GEO_PCHS_CYLINDERS,
    15181518                           pPCHSGeometry->cCylinders);
    1519     if (VBOX_FAILURE(rc))
     1519    if (RT_FAILURE(rc))
    15201520        return rc;
    15211521    rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor,
    15221522                           VMDK_DDB_GEO_PCHS_HEADS,
    15231523                           pPCHSGeometry->cHeads);
    1524     if (VBOX_FAILURE(rc))
     1524    if (RT_FAILURE(rc))
    15251525        return rc;
    15261526    rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor,
     
    15361536                           VMDK_DDB_GEO_LCHS_CYLINDERS,
    15371537                           pLCHSGeometry->cCylinders);
    1538     if (VBOX_FAILURE(rc))
     1538    if (RT_FAILURE(rc))
    15391539        return rc;
    15401540    rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor,
    15411541                           VMDK_DDB_GEO_LCHS_HEADS,
    15421542                           pLCHSGeometry->cHeads);
    1543     if (VBOX_FAILURE(rc))
     1543    if (RT_FAILURE(rc))
    15441544        return rc;
    15451545    rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor,
     
    15641564
    15651565    rc = vmdkDescInitStr(pImage, pDescriptor, "# Disk DescriptorFile");
    1566     if (VBOX_FAILURE(rc))
     1566    if (RT_FAILURE(rc))
    15671567        goto out;
    15681568    rc = vmdkDescInitStr(pImage, pDescriptor, "version=1");
    1569     if (VBOX_FAILURE(rc))
     1569    if (RT_FAILURE(rc))
    15701570        goto out;
    15711571    pDescriptor->uFirstDesc = pDescriptor->cLines - 1;
    15721572    rc = vmdkDescInitStr(pImage, pDescriptor, "");
    1573     if (VBOX_FAILURE(rc))
     1573    if (RT_FAILURE(rc))
    15741574        goto out;
    15751575    rc = vmdkDescInitStr(pImage, pDescriptor, "# Extent description");
    1576     if (VBOX_FAILURE(rc))
     1576    if (RT_FAILURE(rc))
    15771577        goto out;
    15781578    rc = vmdkDescInitStr(pImage, pDescriptor, "NOACCESS 0 ZERO ");
    1579     if (VBOX_FAILURE(rc))
     1579    if (RT_FAILURE(rc))
    15801580        goto out;
    15811581    pDescriptor->uFirstExtent = pDescriptor->cLines - 1;
    15821582    rc = vmdkDescInitStr(pImage, pDescriptor, "");
    1583     if (VBOX_FAILURE(rc))
     1583    if (RT_FAILURE(rc))
    15841584        goto out;
    15851585    /* The trailing space is created by VMware, too. */
    15861586    rc = vmdkDescInitStr(pImage, pDescriptor, "# The disk Data Base ");
    1587     if (VBOX_FAILURE(rc))
     1587    if (RT_FAILURE(rc))
    15881588        goto out;
    15891589    rc = vmdkDescInitStr(pImage, pDescriptor, "#DDB");
    1590     if (VBOX_FAILURE(rc))
     1590    if (RT_FAILURE(rc))
    15911591        goto out;
    15921592    rc = vmdkDescInitStr(pImage, pDescriptor, "");
    1593     if (VBOX_FAILURE(rc))
     1593    if (RT_FAILURE(rc))
    15941594        goto out;
    15951595    rc = vmdkDescInitStr(pImage, pDescriptor, "ddb.virtualHWVersion = \"4\"");
    1596     if (VBOX_FAILURE(rc))
     1596    if (RT_FAILURE(rc))
    15971597        goto out;
    15981598    pDescriptor->uFirstDDB = pDescriptor->cLines - 1;
     
    16041604    rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDesc,
    16051605                        "CID", szBuf);
    1606     if (VBOX_FAILURE(rc))
     1606    if (RT_FAILURE(rc))
    16071607        goto out;
    16081608    rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDesc,
    16091609                        "parentCID", "ffffffff");
    1610     if (VBOX_FAILURE(rc))
     1610    if (RT_FAILURE(rc))
    16111611        goto out;
    16121612
    16131613    rc = vmdkDescDDBSetStr(pImage, pDescriptor, "ddb.adapterType", "ide");
    1614     if (VBOX_FAILURE(rc))
     1614    if (RT_FAILURE(rc))
    16151615        goto out;
    16161616
     
    16281628    rc = vmdkPreprocessDescriptor(pImage, pDescData, cbDescData,
    16291629                                  &pImage->Descriptor);
    1630     if (VBOX_FAILURE(rc))
     1630    if (RT_FAILURE(rc))
    16311631        return rc;
    16321632
     
    16341634    uint32_t uVersion;
    16351635    rc = vmdkDescBaseGetU32(&pImage->Descriptor, "version", &uVersion);
    1636     if (VBOX_FAILURE(rc))
     1636    if (RT_FAILURE(rc))
    16371637        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error finding key 'version' in descriptor in '%s'"), pImage->pszFilename);
    16381638    if (uVersion != 1)
     
    16431643    rc = vmdkDescBaseGetStr(pImage, &pImage->Descriptor, "createType",
    16441644                            &pszCreateType);
    1645     if (VBOX_FAILURE(rc))
     1645    if (RT_FAILURE(rc))
    16461646        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: cannot get image type from descriptor in '%s'"), pImage->pszFilename);
    16471647    if (    !strcmp(pszCreateType, "twoGbMaxExtentSparse")
     
    16711671        /* Non-monolithic image, extents need to be allocated. */
    16721672        rc = vmdkCreateExtents(pImage, cExtents);
    1673         if (VBOX_FAILURE(rc))
     1673        if (RT_FAILURE(rc))
    16741674            return rc;
    16751675    }
     
    17041704        rc = RTStrToUInt64Ex(pszLine, &pszLine, 10,
    17051705                             &pImage->pExtents[i].cNominalSectors);
    1706         if (VBOX_FAILURE(rc))
     1706        if (RT_FAILURE(rc))
    17071707            return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17081708        if (*pszLine++ != ' ')
     
    17501750            char *pszBasename;
    17511751            rc = vmdkStringUnquote(pImage, pszLine, &pszBasename, &pszLine);
    1752             if (VBOX_FAILURE(rc))
     1752            if (RT_FAILURE(rc))
    17531753                return rc;
    17541754            pImage->pExtents[i].pszBasename = pszBasename;
     
    17611761                    rc = RTStrToUInt64Ex(pszLine, &pszLine, 10,
    17621762                                         &pImage->pExtents[i].uSectorOffset);
    1763                     if (VBOX_FAILURE(rc))
     1763                    if (RT_FAILURE(rc))
    17641764                        return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename);
    17651765                }
     
    17771777    if (rc == VERR_VDI_VALUE_NOT_FOUND)
    17781778        pImage->PCHSGeometry.cCylinders = 0;
    1779     else if (VBOX_FAILURE(rc))
     1779    else if (RT_FAILURE(rc))
    17801780        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting PCHS geometry from extent description in '%s'"), pImage->pszFilename);
    17811781    rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor,
     
    17841784    if (rc == VERR_VDI_VALUE_NOT_FOUND)
    17851785        pImage->PCHSGeometry.cHeads = 0;
    1786     else if (VBOX_FAILURE(rc))
     1786    else if (RT_FAILURE(rc))
    17871787        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting PCHS geometry from extent description in '%s'"), pImage->pszFilename);
    17881788    rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor,
     
    17911791    if (rc == VERR_VDI_VALUE_NOT_FOUND)
    17921792        pImage->PCHSGeometry.cSectors = 0;
    1793     else if (VBOX_FAILURE(rc))
     1793    else if (RT_FAILURE(rc))
    17941794        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting PCHS geometry from extent description in '%s'"), pImage->pszFilename);
    17951795    if (    pImage->PCHSGeometry.cCylinders == 0
     
    18121812    if (rc == VERR_VDI_VALUE_NOT_FOUND)
    18131813        pImage->LCHSGeometry.cCylinders = 0;
    1814     else if (VBOX_FAILURE(rc))
     1814    else if (RT_FAILURE(rc))
    18151815        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting LCHS geometry from extent description in '%s'"), pImage->pszFilename);
    18161816    rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor,
     
    18191819    if (rc == VERR_VDI_VALUE_NOT_FOUND)
    18201820        pImage->LCHSGeometry.cHeads = 0;
    1821     else if (VBOX_FAILURE(rc))
     1821    else if (RT_FAILURE(rc))
    18221822        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting LCHS geometry from extent description in '%s'"), pImage->pszFilename);
    18231823    rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor,
     
    18261826    if (rc == VERR_VDI_VALUE_NOT_FOUND)
    18271827        pImage->LCHSGeometry.cSectors = 0;
    1828     else if (VBOX_FAILURE(rc))
     1828    else if (RT_FAILURE(rc))
    18291829        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting LCHS geometry from extent description in '%s'"), pImage->pszFilename);
    18301830    if (    pImage->LCHSGeometry.cCylinders == 0
     
    18501850        {
    18511851            rc = RTUuidCreate(&pImage->ImageUuid);
    1852             if (VBOX_FAILURE(rc))
     1852            if (RT_FAILURE(rc))
    18531853                return rc;
    18541854            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    18551855                                    VMDK_DDB_IMAGE_UUID, &pImage->ImageUuid);
    1856             if (VBOX_FAILURE(rc))
     1856            if (RT_FAILURE(rc))
    18571857                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image UUID in descriptor in '%s'"), pImage->pszFilename);
    18581858        }
    18591859    }
    1860     else if (VBOX_FAILURE(rc))
     1860    else if (RT_FAILURE(rc))
    18611861        return rc;
    18621862
     
    18751875        {
    18761876            rc = RTUuidCreate(&pImage->ModificationUuid);
    1877             if (VBOX_FAILURE(rc))
     1877            if (RT_FAILURE(rc))
    18781878                return rc;
    18791879            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    18801880                                    VMDK_DDB_MODIFICATION_UUID,
    18811881                                    &pImage->ModificationUuid);
    1882             if (VBOX_FAILURE(rc))
     1882            if (RT_FAILURE(rc))
    18831883                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image modification UUID in descriptor in '%s'"), pImage->pszFilename);
    18841884        }
    18851885    }
    1886     else if (VBOX_FAILURE(rc))
     1886    else if (RT_FAILURE(rc))
    18871887        return rc;
    18881888
     
    19001900        {
    19011901            rc = RTUuidClear(&pImage->ParentUuid);
    1902             if (VBOX_FAILURE(rc))
     1902            if (RT_FAILURE(rc))
    19031903                return rc;
    19041904            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    19051905                                    VMDK_DDB_PARENT_UUID, &pImage->ParentUuid);
    1906             if (VBOX_FAILURE(rc))
     1906            if (RT_FAILURE(rc))
    19071907                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent UUID in descriptor in '%s'"), pImage->pszFilename);
    19081908        }
    19091909    }
    1910     else if (VBOX_FAILURE(rc))
     1910    else if (RT_FAILURE(rc))
    19111911        return rc;
    19121912
     
    19251925        {
    19261926            rc = RTUuidCreate(&pImage->ParentModificationUuid);
    1927             if (VBOX_FAILURE(rc))
     1927            if (RT_FAILURE(rc))
    19281928                return rc;
    19291929            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    19301930                                    VMDK_DDB_PARENT_MODIFICATION_UUID,
    19311931                                    &pImage->ParentModificationUuid);
    1932             if (VBOX_FAILURE(rc))
     1932            if (RT_FAILURE(rc))
    19331933                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent modification UUID in descriptor in '%s'"), pImage->pszFilename);
    19341934        }
    19351935    }
    1936     else if (VBOX_FAILURE(rc))
     1936    else if (RT_FAILURE(rc))
    19371937        return rc;
    19381938
     
    19731973            return vmdkError(pImage, VERR_BUFFER_OVERFLOW, RT_SRC_POS, N_("VMDK: descriptor too long in '%s'"), pImage->pszFilename);
    19741974        rc = vmdkFileWriteAt(pDescFile, uOffset, psz, cb, NULL);
    1975         if (VBOX_FAILURE(rc))
     1975        if (RT_FAILURE(rc))
    19761976            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename);
    19771977        uOffset += cb;
    19781978        rc = vmdkFileWriteAt(pDescFile, uOffset, "\n", 1, NULL);
    1979         if (VBOX_FAILURE(rc))
     1979        if (RT_FAILURE(rc))
    19801980            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename);
    19811981        uOffset++;
     
    19871987        {
    19881988            rc = vmdkFileWriteAt(pDescFile, uOffset, "", 1, NULL);
    1989             if (VBOX_FAILURE(rc))
     1989            if (RT_FAILURE(rc))
    19901990                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename);
    19911991            uOffset++;
     
    19951995    {
    19961996        rc = vmdkFileSetSize(pDescFile, uOffset);
    1997         if (VBOX_FAILURE(rc))
     1997        if (RT_FAILURE(rc))
    19981998            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error truncating descriptor in '%s'"), pImage->pszFilename);
    19991999    }
     
    20122012    int rc = vmdkFileReadAt(pExtent->pFile, 0, &Header, sizeof(Header), NULL);
    20132013    AssertRC(rc);
    2014     if (VBOX_FAILURE(rc))
     2014    if (RT_FAILURE(rc))
    20152015    {
    20162016        rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error reading extent header in '%s'"), pExtent->pszFullname);
     
    20262026     * image is at least truncated, or even seriously garbled. */
    20272027    rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize);
    2028     if (VBOX_FAILURE(rc))
     2028    if (RT_FAILURE(rc))
    20292029    {
    20302030        rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname);
     
    20932093
    20942094out:
    2095     if (VBOX_FAILURE(rc))
     2095    if (RT_FAILURE(rc))
    20962096        vmdkFreeExtentData(pImage, pExtent, false);
    20972097
     
    21362136    int rc = vmdkFileWriteAt(pExtent->pFile, 0, &Header, sizeof(Header), NULL);
    21372137    AssertRC(rc);
    2138     if (VBOX_FAILURE(rc))
     2138    if (RT_FAILURE(rc))
    21392139        rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error writing extent header in '%s'"), pExtent->pszFullname);
    21402140    return rc;
     
    21542154    int rc = vmdkFileReadAt(pExtent->pFile, 0, &Header, sizeof(Header), NULL);
    21552155    AssertRC(rc);
    2156     if (VBOX_FAILURE(rc))
     2156    if (RT_FAILURE(rc))
    21572157        goto out;
    21582158    if (    RT_LE2H_U32(Header.magicNumber) != VMDK_ESX_SPARSE_MAGICNUMBER
     
    22022202
    22032203out:
    2204     if (VBOX_FAILURE(rc))
     2204    if (RT_FAILURE(rc))
    22052205        vmdkFreeExtentData(pImage, pExtent, false);
    22062206
     
    23182318    /*
    23192319     * Open the image.
    2320      * We don't have to check for asynchronous access because 
     2320     * We don't have to check for asynchronous access because
    23212321     * we only support raw access and the opened file is a description
    23222322     * file were no data is stored.
     
    23262326                       ? RTFILE_O_READ      | RTFILE_O_OPEN | RTFILE_O_DENY_NONE
    23272327                       : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, false);
    2328     if (VBOX_FAILURE(rc))
     2328    if (RT_FAILURE(rc))
    23292329    {
    23302330        /* Do NOT signal an appropriate error here, as the VD layer has the
     
    23362336    /* Read magic (if present). */
    23372337    rc = vmdkFileReadAt(pFile, 0, &u32Magic, sizeof(u32Magic), NULL);
    2338     if (VBOX_FAILURE(rc))
     2338    if (RT_FAILURE(rc))
    23392339    {
    23402340        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename);
     
    23472347        /* It's a hosted sparse single-extent image. */
    23482348        rc = vmdkCreateExtents(pImage, 1);
    2349         if (VBOX_FAILURE(rc))
     2349        if (RT_FAILURE(rc))
    23502350            goto out;
    23512351        /* The opened file is passed to the extent. No separate descriptor
     
    23612361        }
    23622362        rc = vmdkReadMetaSparseExtent(pImage, pExtent);
    2363         if (VBOX_FAILURE(rc))
     2363        if (RT_FAILURE(rc))
    23642364            goto out;
    23652365        /* As we're dealing with a monolithic sparse image here, there must
     
    23822382                            VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors), NULL);
    23832383        AssertRC(rc);
    2384         if (VBOX_FAILURE(rc))
     2384        if (RT_FAILURE(rc))
    23852385        {
    23862386            rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: read error for descriptor in '%s'"), pExtent->pszFullname);
     
    23902390        rc = vmdkParseDescriptor(pImage, pExtent->pDescData,
    23912391                                 VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors));
    2392         if (VBOX_FAILURE(rc))
     2392        if (RT_FAILURE(rc))
    23932393            goto out;
    23942394
     
    24132413        rc = vmdkFileReadAt(pImage->pFile, 0, pImage->pDescData,
    24142414                            pImage->cbDescAlloc, &cbRead);
    2415         if (VBOX_FAILURE(rc))
     2415        if (RT_FAILURE(rc))
    24162416        {
    24172417            rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: read error for descriptor in '%s'"), pImage->pszFilename);
     
    24282428        rc = vmdkParseDescriptor(pImage, pImage->pDescData,
    24292429                                 pImage->cbDescAlloc);
    2430         if (VBOX_FAILURE(rc))
     2430        if (RT_FAILURE(rc))
    24312431            goto out;
    24322432
    2433         /* 
     2433        /*
    24342434         * We have to check for the asynchronous open flag. The
    24352435         * extents are parsed and the type of all are known now.
     
    24452445                    && (pExtent->enmType != VMDKETYPE_ZERO))
    24462446                {
    2447                     /* 
     2447                    /*
    24482448                     * Opened image contains at least one none flat or zero extent.
    24492449                     * Return error but don't set error message as the caller
     
    24902490                                      RTPATH_SLASH, pExtent->pszBasename);
    24912491                    RTStrFree(pszDirname);
    2492                     if (VBOX_FAILURE(rc))
     2492                    if (RT_FAILURE(rc))
    24932493                        goto out;
    24942494                }
     
    25052505                                        ? RTFILE_O_READ      | RTFILE_O_OPEN | RTFILE_O_DENY_NONE
    25062506                                        : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, false);
    2507                     if (VBOX_FAILURE(rc))
     2507                    if (RT_FAILURE(rc))
    25082508                    {
    25092509                        /* Do NOT signal an appropriate error here, as the VD
     
    25132513                    }
    25142514                    rc = vmdkReadMetaSparseExtent(pImage, pExtent);
    2515                     if (VBOX_FAILURE(rc))
     2515                    if (RT_FAILURE(rc))
    25162516                        goto out;
    25172517
     
    25282528                                        ? RTFILE_O_READ      | RTFILE_O_OPEN | RTFILE_O_DENY_NONE
    25292529                                        : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, true);
    2530                     if (VBOX_FAILURE(rc))
     2530                    if (RT_FAILURE(rc))
    25312531                    {
    25322532                        /* Do NOT signal an appropriate error here, as the VD
     
    25642564    /* Update the image metadata now in case has changed. */
    25652565    rc = vmdkFlushImage(pImage);
    2566     if (VBOX_FAILURE(rc))
     2566    if (RT_FAILURE(rc))
    25672567        goto out;
    25682568
     
    25992599
    26002600    rc = vmdkAllocateGrainTableCache(pImage);
    2601     if (VBOX_FAILURE(rc))
     2601    if (RT_FAILURE(rc))
    26022602        goto out;
    26032603
    26042604out:
    2605     if (VBOX_FAILURE(rc))
     2605    if (RT_FAILURE(rc))
    26062606        vmdkFreeImage(pImage, false);
    26072607    return rc;
     
    26222622         * file and open the (flat) raw disk. */
    26232623        rc = vmdkCreateExtents(pImage, 1);
    2624         if (VBOX_FAILURE(rc))
     2624        if (RT_FAILURE(rc))
    26252625            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new extent list in '%s'"), pImage->pszFilename);
    26262626        pExtent = &pImage->pExtents[0];
     
    26292629                          RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED,
    26302630                          false);
    2631         if (VBOX_FAILURE(rc))
     2631        if (RT_FAILURE(rc))
    26322632            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new file '%s'"), pImage->pszFilename);
    26332633
     
    26522652        rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname,
    26532653                          RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, false);
    2654         if (VBOX_FAILURE(rc))
     2654        if (RT_FAILURE(rc))
    26552655            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not open raw disk file '%s'"), pExtent->pszFullname);
    26562656    }
     
    26952695
    26962696        rc = vmdkCreateExtents(pImage, cExtents);
    2697         if (VBOX_FAILURE(rc))
     2697        if (RT_FAILURE(rc))
    26982698            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new extent list in '%s'"), pImage->pszFilename);
    26992699
     
    27022702                          RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED,
    27032703                          false);
    2704         if (VBOX_FAILURE(rc))
     2704        if (RT_FAILURE(rc))
    27052705            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new file '%s'"), pImage->pszFilename);
    27062706
     
    27612761                                  RTPATH_SLASH, pExtent->pszBasename);
    27622762                RTStrFree(pszDirname);
    2763                 if (VBOX_FAILURE(rc))
     2763                if (RT_FAILURE(rc))
    27642764                    return rc;
    27652765                pExtent->pszFullname = pszFullname;
     
    27742774                                  RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED,
    27752775                                  false);
    2776                 if (VBOX_FAILURE(rc))
     2776                if (RT_FAILURE(rc))
    27772777                    return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new partition data file '%s'"), pExtent->pszFullname);
    27782778                rc = vmdkFileWriteAt(pExtent->pFile,
     
    27802780                                     pPart->pvPartitionData,
    27812781                                     pPart->cbPartitionData, NULL);
    2782                 if (VBOX_FAILURE(rc))
     2782                if (RT_FAILURE(rc))
    27832783                    return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not write partition data to '%s'"), pExtent->pszFullname);
    27842784                uPartOffset += VMDK_BYTE2SECTOR(pPart->cbPartitionData);
     
    28222822                                      RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE,
    28232823                                      false);
    2824                     if (VBOX_FAILURE(rc))
     2824                    if (RT_FAILURE(rc))
    28252825                        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not open raw partition file '%s'"), pExtent->pszFullname);
    28262826                }
     
    28542854                            pRaw->fRawDisk ?
    28552855                            "fullDevice" : "partitionedDevice");
    2856     if (VBOX_FAILURE(rc))
     2856    if (RT_FAILURE(rc))
    28572857        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not set the image type in '%s'"), pImage->pszFilename);
    28582858    return rc;
     
    28812881    }
    28822882    rc = vmdkCreateExtents(pImage, cExtents);
    2883     if (VBOX_FAILURE(rc))
     2883    if (RT_FAILURE(rc))
    28842884        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new extent list in '%s'"), pImage->pszFilename);
    28852885
     
    28952895                          RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED,
    28962896                          false);
    2897         if (VBOX_FAILURE(rc))
     2897        if (RT_FAILURE(rc))
    28982898            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new sparse descriptor file '%s'"), pImage->pszFilename);
    28992899        pImage->pszFilename = RTStrDup(pImage->pszFilename);
     
    29402940                                  pszBasenameExt);
    29412941            RTStrFree(pszBasenameBase);
    2942             if (VBOX_FAILURE(rc))
     2942            if (RT_FAILURE(rc))
    29432943                return rc;
    29442944            cbTmp = strlen(pszTmp) + 1;
     
    29582958                          RTPATH_SLASH, pExtent->pszBasename);
    29592959        RTStrFree(pszBasedirectory);
    2960         if (VBOX_FAILURE(rc))
     2960        if (RT_FAILURE(rc))
    29612961            return rc;
    29622962        pExtent->pszFullname = pszFullname;
     
    29662966                          RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED,
    29672967                          false);
    2968         if (VBOX_FAILURE(rc))
     2968        if (RT_FAILURE(rc))
    29692969            return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new file '%s'"), pExtent->pszFullname);
    29702970        if (enmType == VD_IMAGE_TYPE_FIXED)
    29712971        {
    29722972            rc = vmdkFileSetSize(pExtent->pFile, cbExtent);
    2973             if (VBOX_FAILURE(rc))
     2973            if (RT_FAILURE(rc))
    29742974                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not set size of new file '%s'"), pExtent->pszFullname);
    29752975
     
    29942994
    29952995                rc = vmdkFileWriteAt(pExtent->pFile, uOff, pvBuf, cbChunk, NULL);
    2996                 if (VBOX_FAILURE(rc))
     2996                if (RT_FAILURE(rc))
    29972997                {
    29982998                    RTMemFree(pvBuf);
     
    30073007                                     uPercentStart + uOff * uPercentSpan / cbExtent,
    30083008                                     pvUser);
    3009                     if (VBOX_FAILURE(rc))
     3009                    if (RT_FAILURE(rc))
    30103010                    {
    30113011                        RTMemFree(pvBuf);
     
    30553055                                                 1),
    30563056                                          true);
    3057             if (VBOX_FAILURE(rc))
     3057            if (RT_FAILURE(rc))
    30583058                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new grain directory in '%s'"), pExtent->pszFullname);
    30593059        }
    30603060
    3061         if (VBOX_SUCCESS(rc) && pfnProgress)
     3061        if (RT_SUCCESS(rc) && pfnProgress)
    30623062            pfnProgress(NULL /* WARNING! pVM=NULL  */,
    30633063                        uPercentStart + i * uPercentSpan / cExtents,
     
    30833083    rc = vmdkDescBaseSetStr(pImage, &pImage->Descriptor, "createType",
    30843084                            pszDescType);
    3085     if (VBOX_FAILURE(rc))
     3085    if (RT_FAILURE(rc))
    30863086        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not set the image type in '%s'"), pImage->pszFilename);
    30873087    return rc;
     
    31053105    rc = vmdkCreateDescriptor(pImage, pImage->pDescData, pImage->cbDescAlloc,
    31063106                              &pImage->Descriptor);
    3107     if (VBOX_FAILURE(rc))
     3107    if (RT_FAILURE(rc))
    31083108    {
    31093109        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new descriptor in '%s'"), pImage->pszFilename);
     
    31353135    }
    31363136
    3137     if (VBOX_FAILURE(rc))
    3138         goto out;
    3139 
    3140     if (VBOX_SUCCESS(rc) && pfnProgress)
     3137    if (RT_FAILURE(rc))
     3138        goto out;
     3139
     3140    if (RT_SUCCESS(rc) && pfnProgress)
    31413141        pfnProgress(NULL /* WARNING! pVM=NULL  */,
    31423142                    uPercentStart + uPercentSpan * 98 / 100, pvUser);
     
    31523152                               pExtent->cNominalSectors, pExtent->enmType,
    31533153                               pExtent->pszBasename, pExtent->uSectorOffset);
    3154         if (VBOX_FAILURE(rc))
     3154        if (RT_FAILURE(rc))
    31553155        {
    31563156            rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not insert the extent list into descriptor in '%s'"), pImage->pszFilename);
     
    31653165    {
    31663166        rc = vmdkDescSetPCHSGeometry(pImage, pPCHSGeometry);
    3167         if (VBOX_FAILURE(rc))
     3167        if (RT_FAILURE(rc))
    31683168            goto out;
    31693169    }
     
    31733173    {
    31743174        rc = vmdkDescSetLCHSGeometry(pImage, pLCHSGeometry);
    3175         if (VBOX_FAILURE(rc))
     3175        if (RT_FAILURE(rc))
    31763176            goto out;
    31773177    }
     
    31813181
    31823182    rc = RTUuidCreate(&pImage->ImageUuid);
    3183     if (VBOX_FAILURE(rc))
     3183    if (RT_FAILURE(rc))
    31843184        goto out;
    31853185    rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    31863186                            VMDK_DDB_IMAGE_UUID, &pImage->ImageUuid);
    3187     if (VBOX_FAILURE(rc))
     3187    if (RT_FAILURE(rc))
    31883188    {
    31893189        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image UUID in new descriptor in '%s'"), pImage->pszFilename);
     
    31933193    rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    31943194                            VMDK_DDB_PARENT_UUID, &pImage->ParentUuid);
    3195     if (VBOX_FAILURE(rc))
     3195    if (RT_FAILURE(rc))
    31963196    {
    31973197        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent image UUID in new descriptor in '%s'"), pImage->pszFilename);
     
    32023202                            VMDK_DDB_MODIFICATION_UUID,
    32033203                            &pImage->ModificationUuid);
    3204     if (VBOX_FAILURE(rc))
     3204    if (RT_FAILURE(rc))
    32053205    {
    32063206        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing modification UUID in new descriptor in '%s'"), pImage->pszFilename);
     
    32113211                            VMDK_DDB_PARENT_MODIFICATION_UUID,
    32123212                            &pImage->ParentModificationUuid);
    3213     if (VBOX_FAILURE(rc))
     3213    if (RT_FAILURE(rc))
    32143214    {
    32153215        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent modification UUID in new descriptor in '%s'"), pImage->pszFilename);
     
    32183218
    32193219    rc = vmdkAllocateGrainTableCache(pImage);
    3220     if (VBOX_FAILURE(rc))
     3220    if (RT_FAILURE(rc))
    32213221        goto out;
    32223222
    32233223    rc = vmdkSetImageComment(pImage, pszComment);
    3224     if (VBOX_FAILURE(rc))
     3224    if (RT_FAILURE(rc))
    32253225    {
    32263226        rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: cannot set image comment in '%s'"), pImage->pszFilename);
     
    32283228    }
    32293229
    3230     if (VBOX_SUCCESS(rc) && pfnProgress)
     3230    if (RT_SUCCESS(rc) && pfnProgress)
    32313231        pfnProgress(NULL /* WARNING! pVM=NULL  */,
    32323232                    uPercentStart + uPercentSpan * 99 / 100, pvUser);
     
    32353235
    32363236out:
    3237     if (VBOX_SUCCESS(rc) && pfnProgress)
     3237    if (RT_SUCCESS(rc) && pfnProgress)
    32383238        pfnProgress(NULL /* WARNING! pVM=NULL  */,
    32393239                    uPercentStart + uPercentSpan, pvUser);
    32403240
    3241     if (VBOX_FAILURE(rc))
     3241    if (RT_FAILURE(rc))
    32423242        vmdkFreeImage(pImage, rc != VERR_ALREADY_EXISTS);
    32433243    return rc;
     
    32623262    if (pszComment)
    32633263        RTStrFree(pszCommentEncoded);
    3264     if (VBOX_FAILURE(rc))
     3264    if (RT_FAILURE(rc))
    32653265        return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image comment in descriptor in '%s'"), pImage->pszFilename);
    32663266    return VINF_SUCCESS;
     
    33203320    {
    33213321        rc = vmdkWriteDescriptor(pImage);
    3322         if (VBOX_FAILURE(rc))
     3322        if (RT_FAILURE(rc))
    33233323            goto out;
    33243324    }
     
    33333333                case VMDKETYPE_HOSTED_SPARSE:
    33343334                    rc = vmdkWriteMetaSparseExtent(pExtent);
    3335                     if (VBOX_FAILURE(rc))
     3335                    if (RT_FAILURE(rc))
    33363336                        goto out;
    33373337                    break;
     
    34513451                            VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    34523452                            aGTDataTmp, sizeof(aGTDataTmp), NULL);
    3453         if (VBOX_FAILURE(rc))
     3453        if (RT_FAILURE(rc))
    34543454            return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot read grain table entry in '%s'"), pExtent->pszFullname);
    34553455        pGTCacheEntry->uExtent = pExtent->uExtent;
     
    34983498         * a new grain table and put the reference to it in the GDs. */
    34993499        rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize);
    3500         if (VBOX_FAILURE(rc))
     3500        if (RT_FAILURE(rc))
    35013501            return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname);
    35023502        Assert(!(cbExtentSize % 512));
     
    35193519                                 VMDK_SECTOR2BYTE(uGTSector) + i * sizeof(aGTDataTmp),
    35203520                                 aGTDataTmp, sizeof(aGTDataTmp), NULL);
    3521             if (VBOX_FAILURE(rc))
     3521            if (RT_FAILURE(rc))
    35223522                return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write grain table allocation in '%s'"), pExtent->pszFullname);
    35233523        }
     
    35263526            AssertReturn(!uRGTSector, VERR_VDI_INVALID_HEADER);
    35273527            rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize);
    3528             if (VBOX_FAILURE(rc))
     3528            if (RT_FAILURE(rc))
    35293529                return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname);
    35303530            Assert(!(cbExtentSize % 512));
     
    35463546                                     VMDK_SECTOR2BYTE(uRGTSector) + i * sizeof(aGTDataTmp),
    35473547                                     aGTDataTmp, sizeof(aGTDataTmp), NULL);
    3548                 if (VBOX_FAILURE(rc))
     3548                if (RT_FAILURE(rc))
    35493549                    return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain table allocation in '%s'"), pExtent->pszFullname);
    35503550            }
     
    35593559                             VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE),
    35603560                             &uGTSectorLE, sizeof(uGTSectorLE), NULL);
    3561         if (VBOX_FAILURE(rc))
     3561        if (RT_FAILURE(rc))
    35623562            return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write grain directory entry in '%s'"), pExtent->pszFullname);
    35633563        if (pExtent->pRGD)
     
    35673567                                 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uRGTSectorLE),
    35683568                                 &uRGTSectorLE, sizeof(uRGTSectorLE), NULL);
    3569             if (VBOX_FAILURE(rc))
     3569            if (RT_FAILURE(rc))
    35703570                return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain directory entry in '%s'"), pExtent->pszFullname);
    35713571        }
     
    35783578
    35793579    rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize);
    3580     if (VBOX_FAILURE(rc))
     3580    if (RT_FAILURE(rc))
    35813581        return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname);
    35823582    Assert(!(cbExtentSize % 512));
     
    35843584    /* Write the data. */
    35853585    rc = vmdkFileWriteAt(pExtent->pFile, cbExtentSize, pvBuf, cbWrite, NULL);
    3586     if (VBOX_FAILURE(rc))
     3586    if (RT_FAILURE(rc))
    35873587        return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write allocated data block in '%s'"), pExtent->pszFullname);
    35883588
     
    35983598                            VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    35993599                            aGTDataTmp, sizeof(aGTDataTmp), NULL);
    3600         if (VBOX_FAILURE(rc))
     3600        if (RT_FAILURE(rc))
    36013601            return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot read allocated grain table entry in '%s'"), pExtent->pszFullname);
    36023602        pGTCacheEntry->uExtent = pExtent->uExtent;
     
    36193619                         VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    36203620                         aGTDataTmp, sizeof(aGTDataTmp), NULL);
    3621     if (VBOX_FAILURE(rc))
     3621    if (RT_FAILURE(rc))
    36223622        return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write updated grain table in '%s'"), pExtent->pszFullname);
    36233623    if (pExtent->pRGD)
     
    36273627                             VMDK_SECTOR2BYTE(uRGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp),
    36283628                             aGTDataTmp, sizeof(aGTDataTmp), NULL);
    3629         if (VBOX_FAILURE(rc))
     3629        if (RT_FAILURE(rc))
    36303630            return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write updated backup grain table in '%s'"), pExtent->pszFullname);
    36313631    }
    36323632#ifdef VBOX_WITH_VMDK_ESX
    3633     if (VBOX_SUCCESS(rc) && pExtent->enmType == VMDKETYPE_ESX_SPARSE)
     3633    if (RT_SUCCESS(rc) && pExtent->enmType == VMDKETYPE_ESX_SPARSE)
    36343634    {
    36353635        pExtent->uFreeSector = uGTSector + VMDK_BYTE2SECTOR(cbWrite);
     
    37333733
    37343734    rc = vmdkOpenImage(pImage, uOpenFlags);
    3735     if (VBOX_SUCCESS(rc))
     3735    if (RT_SUCCESS(rc))
    37363736        *ppBackendData = pImage;
    37373737
     
    38093809                         pPCHSGeometry, pLCHSGeometry,
    38103810                         pfnProgress, pvUser, uPercentStart, uPercentSpan);
    3811     if (VBOX_SUCCESS(rc))
     3811    if (RT_SUCCESS(rc))
    38123812    {
    38133813        /* So far the image is opened in read/write mode. Make sure the
     
    38173817            vmdkFreeImage(pImage, false);
    38183818            rc = vmdkOpenImage(pImage, uOpenFlags);
    3819             if (VBOX_FAILURE(rc))
     3819            if (RT_FAILURE(rc))
    38203820                goto out;
    38213821        }
     
    38953895     * with zeros. We actually save stuff when and if we change it.
    38963896     */
    3897     apszOldName  = (char **)RTMemTmpAllocZ((cExtents + 1) * sizeof(char*)); 
    3898     apszNewName  = (char **)RTMemTmpAllocZ((cExtents + 1) * sizeof(char*)); 
    3899     apszNewLines = (char **)RTMemTmpAllocZ((cExtents) * sizeof(char*)); 
     3897    apszOldName  = (char **)RTMemTmpAllocZ((cExtents + 1) * sizeof(char*));
     3898    apszNewName  = (char **)RTMemTmpAllocZ((cExtents + 1) * sizeof(char*));
     3899    apszNewLines = (char **)RTMemTmpAllocZ((cExtents) * sizeof(char*));
    39003900    if (!apszOldName || !apszNewName || !apszNewLines)
    39013901    {
     
    39543954        pImage->Descriptor.aLines[line] = apszNewLines[i];
    39553955        /* Compose new name for the extent. */
    3956         apszNewName[i] = vmdkStrReplace(pExtent->pszFullname, 
     3956        apszNewName[i] = vmdkStrReplace(pExtent->pszFullname,
    39573957            pszOldBasename, pszNewBasename);
    39583958        if (!apszNewName[i])
     
    39623962        /* Rename the extent file. */
    39633963        rc = RTFileMove(pExtent->pszFullname, apszNewName[i], 0);
    3964         if (VBOX_FAILURE(rc))
     3964        if (RT_FAILURE(rc))
    39653965            goto rollback;
    39663966        /* Remember the old name. */
     
    39793979     */
    39803980    apszNewName[cExtents] = RTPathFilename(pszFilename);
    3981     /* Rename the descriptor file if it's separate. */ 
     3981    /* Rename the descriptor file if it's separate. */
    39823982    if (!fEmbeddedDesc)
    39833983    {
    39843984        rc = RTFileMove(pImage->pszFilename, apszNewName[cExtents], 0);
    3985         if (VBOX_FAILURE(rc))
     3985        if (RT_FAILURE(rc))
    39863986            goto rollback;
    39873987        /* Save old name only if we may need to change it back. */
     
    39943994    /* Open the new image. */
    39953995    rc = vmdkOpenImage(pImage, pImage->uOpenFlags);
    3996     if (VBOX_SUCCESS(rc))
     3996    if (RT_SUCCESS(rc))
    39973997        goto out;
    39983998
    39993999rollback:
    40004000    /* Roll back all changes in case of failure. */
    4001     if (VBOX_FAILURE(rc))
     4001    if (RT_FAILURE(rc))
    40024002    {
    40034003        int rrc;
     
    40054005        {
    40064006            /*
    4007              * Some extents may have been closed, close the rest. We will 
    4008              * re-open the whole thing later. 
     4007             * Some extents may have been closed, close the rest. We will
     4008             * re-open the whole thing later.
    40094009             */
    40104010            vmdkFreeImage(pImage, false);
     
    40994099    rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset),
    41004100                        &pExtent, &uSectorExtentRel);
    4101     if (VBOX_FAILURE(rc))
     4101    if (RT_FAILURE(rc))
    41024102        goto out;
    41034103
     
    41214121            rc = vmdkGetSector(pImage->pGTCache, pExtent, uSectorExtentRel,
    41224122                               &uSectorExtentAbs);
    4123             if (VBOX_FAILURE(rc))
     4123            if (RT_FAILURE(rc))
    41244124                goto out;
    41254125            /* Clip read range to at most the rest of the grain. */
     
    41864186    rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset),
    41874187                        &pExtent, &uSectorExtentRel);
    4188     if (VBOX_FAILURE(rc))
     4188    if (RT_FAILURE(rc))
    41894189        goto out;
    41904190
     
    42054205            rc = vmdkGetSector(pImage->pGTCache, pExtent, uSectorExtentRel,
    42064206                               &uSectorExtentAbs);
    4207             if (VBOX_FAILURE(rc))
     4207            if (RT_FAILURE(rc))
    42084208                goto out;
    42094209            /* Clip write range to at most the rest of the grain. */
     
    42664266    PVMDKIMAGE pImage = (PVMDKIMAGE)pBackendData;
    42674267    int rc;
    4268    
     4268
    42694269    Assert(pImage);
    42704270
     
    43364336        {
    43374337            int rc = vmdkFileGetSize(pImage->pFile, &cbFile);
    4338             if (VBOX_SUCCESS(rc))
     4338            if (RT_SUCCESS(rc))
    43394339                cb += cbFile;
    43404340            for (unsigned i = 0; i <= pImage->cExtents; i++)
    43414341            {
    43424342                rc = vmdkFileGetSize(pImage->pFile, &cbFile);
    4343                 if (VBOX_SUCCESS(rc))
     4343                if (RT_SUCCESS(rc))
    43444344                    cb += cbFile;
    43454345            }
     
    43964396        }
    43974397        rc = vmdkDescSetPCHSGeometry(pImage, pPCHSGeometry);
    4398         if (VBOX_FAILURE(rc))
     4398        if (RT_FAILURE(rc))
    43994399            goto out;
    44004400
     
    44554455        }
    44564456        rc = vmdkDescSetLCHSGeometry(pImage, pLCHSGeometry);
    4457         if (VBOX_FAILURE(rc))
     4457        if (RT_FAILURE(rc))
    44584458            goto out;
    44594459
     
    45464546        if (rc == VERR_VDI_VALUE_NOT_FOUND)
    45474547            pszCommentEncoded = NULL;
    4548         else if (VBOX_FAILURE(rc))
     4548        else if (RT_FAILURE(rc))
    45494549            goto out;
    45504550
     
    46274627            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    46284628                                    VMDK_DDB_IMAGE_UUID, pUuid);
    4629             if (VBOX_FAILURE(rc))
     4629            if (RT_FAILURE(rc))
    46304630                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image UUID in descriptor in '%s'"), pImage->pszFilename);
    46314631            rc = VINF_SUCCESS;
     
    46784678            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    46794679                                    VMDK_DDB_MODIFICATION_UUID, pUuid);
    4680             if (VBOX_FAILURE(rc))
     4680            if (RT_FAILURE(rc))
    46814681                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing modification UUID in descriptor in '%s'"), pImage->pszFilename);
    46824682            rc = VINF_SUCCESS;
     
    47294729            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    47304730                                    VMDK_DDB_PARENT_UUID, pUuid);
    4731             if (VBOX_FAILURE(rc))
     4731            if (RT_FAILURE(rc))
    47324732                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent image UUID in descriptor in '%s'"), pImage->pszFilename);
    47334733            rc = VINF_SUCCESS;
     
    47804780            rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor,
    47814781                                    VMDK_DDB_PARENT_MODIFICATION_UUID, pUuid);
    4782             if (VBOX_FAILURE(rc))
     4782            if (RT_FAILURE(rc))
    47834783                return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent image UUID in descriptor in '%s'"), pImage->pszFilename);
    47844784            rc = VINF_SUCCESS;
     
    49014901        rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset),
    49024902                            &pExtent, &uSectorExtentRel);
    4903         if (VBOX_FAILURE(rc))
     4903        if (RT_FAILURE(rc))
    49044904            goto out;
    49054905
     
    49234923                void *pTask;
    49244924                rc = pImage->pInterfaceAsyncIOCallbacks->pfnPrepareRead(pImage->pInterfaceAsyncIO->pvUser, pExtent->pFile->pStorage,
    4925                                                                        VMDK_SECTOR2BYTE(uSectorExtentRel), 
     4925                                                                       VMDK_SECTOR2BYTE(uSectorExtentRel),
    49264926                                                                       (uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment,
    49274927                                                                       cbToRead, &pTask);
    4928                 if (VBOX_FAILURE(rc))
     4928                if (RT_FAILURE(rc))
    49294929                {
    49304930                    AssertMsgFailed(("Preparing read failed rc=%Vrc\n", rc));
     
    49664966            }
    49674967            case VMDKETYPE_ZERO:
    4968                 memset((uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment, 0, cbToRead); 
     4968                memset((uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment, 0, cbToRead);
    49694969                break;
    49704970            default:
     
    50005000                                                                NULL, pvUser,
    50015001                                                                NULL /* Nothing required after read. */);
    5002         AssertMsg(VBOX_SUCCESS(rc), ("Failed to enqueue tasks rc=%Vrc\n", rc));
     5002        AssertMsg(RT_SUCCESS(rc), ("Failed to enqueue tasks rc=%Vrc\n", rc));
    50035003    }
    50045004
     
    50375037        rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset),
    50385038                            &pExtent, &uSectorExtentRel);
    5039         if (VBOX_FAILURE(rc))
     5039        if (RT_FAILURE(rc))
    50405040            goto out;
    50415041
     
    50595059                void *pTask;
    50605060                rc = pImage->pInterfaceAsyncIOCallbacks->pfnPrepareWrite(pImage->pInterfaceAsyncIO->pvUser, pExtent->pFile->pStorage,
    5061                                                                          VMDK_SECTOR2BYTE(uSectorExtentRel), 
     5061                                                                         VMDK_SECTOR2BYTE(uSectorExtentRel),
    50625062                                                                         (uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment,
    50635063                                                                         cbToWrite, &pTask);
    5064                 if (VBOX_FAILURE(rc))
     5064                if (RT_FAILURE(rc))
    50655065                {
    50665066                    AssertMsgFailed(("Preparing read failed rc=%Vrc\n", rc));
     
    51345134        rc = pImage->pInterfaceAsyncIOCallbacks->pfnTasksSubmit(pImage->pInterfaceAsyncIO->pvUser,
    51355135                                                                pImage->apTask, cTasksToSubmit,
    5136                                                                 NULL, pvUser, 
     5136                                                                NULL, pvUser,
    51375137                                                                NULL /* Nothing required after read. */);
    5138         AssertMsg(VBOX_SUCCESS(rc), ("Failed to enqueue tasks rc=%Vrc\n", rc));
     5138        AssertMsg(RT_SUCCESS(rc), ("Failed to enqueue tasks rc=%Vrc\n", rc));
    51395139    }
    51405140
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