VirtualBox

Changeset 11266 in vbox for trunk/src/VBox/Devices/Storage


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

Devices: VBOX_SUCCESS/FAILURE -> RT_SUCCESS/FAILURE.

Location:
trunk/src/VBox/Devices/Storage
Files:
15 edited

Legend:

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

    r11184 r11266  
    299299    LogBird(("ata: %x: signalling\n", pCtl->IOPortBase1));
    300300    rc = PDMR3CritSectScheduleExitEvent(&pCtl->lock, pCtl->AsyncIOSem);
    301     if (VBOX_FAILURE(rc))
     301    if (RT_FAILURE(rc))
    302302    {
    303303        LogBird(("ata: %x: schedule failed, rc=%Vrc\n", pCtl->IOPortBase1, rc));
     
    743743    Assert(s->cbElementaryTransfer == 512);
    744744    rc = s->pDrvBlock ? s->pDrvBlock->pfnGetUuid(s->pDrvBlock, &Uuid) : RTUuidClear(&Uuid);
    745     if (VBOX_FAILURE(rc) || RTUuidIsNull(&Uuid))
     745    if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid))
    746746    {
    747747        PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);
     
    867867    Assert(s->cbElementaryTransfer == 512);
    868868    rc = s->pDrvBlock ? s->pDrvBlock->pfnGetUuid(s->pDrvBlock, &Uuid) : RTUuidClear(&Uuid);
    869     if (VBOX_FAILURE(rc) || RTUuidIsNull(&Uuid))
     869    if (RT_FAILURE(rc) || RTUuidIsNull(&Uuid))
    870870    {
    871871        PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s);
     
    11221122    Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
    11231123    rc = ataReadSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors);
    1124     if (VBOX_SUCCESS(rc))
     1124    if (RT_SUCCESS(rc))
    11251125    {
    11261126        ataSetSector(s, iLBA + cSectors);
     
    11691169    Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA));
    11701170    rc = ataWriteSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors);
    1171     if (VBOX_SUCCESS(rc))
     1171    if (RT_SUCCESS(rc))
    11721172    {
    11731173        ataSetSector(s, iLBA + cSectors);
     
    12761276            aModeSenseCmd[9] = 0; /* control */
    12771277            rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, aModeSenseCmd, PDMBLOCKTXDIR_FROM_DEVICE, aModeSenseResult, &cbTransfer, &uDummySense, 500);
    1278             if (VBOX_FAILURE(rc))
     1278            if (RT_FAILURE(rc))
    12791279            {
    12801280                atapiCmdError(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_NONE);
     
    13611361                    /* data */
    13621362                    rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)i * 2048, pbBuf, 2048);
    1363                     if (VBOX_FAILURE(rc))
     1363                    if (RT_FAILURE(rc))
    13641364                        break;
    13651365                    pbBuf += 2048;
     
    13791379    STAM_PROFILE_STOP(&pCtl->StatLockWait, a);
    13801380
    1381     if (VBOX_SUCCESS(rc))
     1381    if (RT_SUCCESS(rc))
    13821382    {
    13831383        s->Led.Actual.s.fReading = 0;
     
    15391539    }
    15401540
    1541     if (VBOX_SUCCESS(rc))
     1541    if (RT_SUCCESS(rc))
    15421542    {
    15431543        if (s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE)
     
    22682268                        break;
    22692269                }
    2270                 if (VBOX_SUCCESS(rc))
     2270                if (RT_SUCCESS(rc))
    22712271                    atapiCmdOK(s);
    22722272                else
     
    38083808        {
    38093809            rc = RTSemEventWait(pCtl->SuspendIOSem, RT_INDEFINITE_WAIT);
    3810             if (VBOX_FAILURE(rc) || pCtl->fShutdown)
     3810            if (RT_FAILURE(rc) || pCtl->fShutdown)
    38113811                break;
    38123812
     
    38203820            rc = RTSemEventWait(pCtl->AsyncIOSem, RT_INDEFINITE_WAIT);
    38213821            LogBird(("ata: %x: waking up\n", pCtl->IOPortBase1));
    3822             if (VBOX_FAILURE(rc) || pCtl->fShutdown)
     3822            if (RT_FAILURE(rc) || pCtl->fShutdown)
    38233823                break;
    38243824
     
    49704970        {
    49714971            rc = RTThreadWait(pData->aCts[i].AsyncIOThread, 30000 /* 30 s*/, NULL);
    4972             AssertMsg(VBOX_SUCCESS(rc) || rc == VERR_INVALID_HANDLE, ("rc=%Rrc i=%d\n", rc, i));
     4972            AssertMsg(RT_SUCCESS(rc) || rc == VERR_INVALID_HANDLE, ("rc=%Rrc i=%d\n", rc, i));
    49734973        }
    49744974    }
     
    51035103        Assert(!pIf->pbIOBufferR3);
    51045104        rc = MMHyperAlloc(pVM, pIf->cbIOBuffer, 1, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3);
    5105         if (VBOX_FAILURE(rc))
     5105        if (RT_FAILURE(rc))
    51065106            return VERR_NO_MEMORY;
    51075107        pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3);
     
    51965196     */
    51975197    rc = PDMDevHlpDriverAttach(pDevIns, pIf->iLUN, &pIf->IBase, &pIf->pDrvBase, NULL);
    5198     if (VBOX_SUCCESS(rc))
     5198    if (RT_SUCCESS(rc))
    51995199        rc = ataConfigLun(pDevIns, pIf);
    52005200    else
    52015201        AssertMsgFailed(("Failed to attach LUN#%d. rc=%Vrc\n", pIf->iLUN, rc));
    52025202
    5203     if (VBOX_FAILURE(rc))
     5203    if (RT_FAILURE(rc))
    52045204    {
    52055205        pIf->pDrvBase = NULL;
     
    54885488
    54895489    rc = SSMR3GetU32(pSSMHandle, &u32);
    5490     if (VBOX_FAILURE(rc))
     5490    if (RT_FAILURE(rc))
    54915491        return rc;
    54925492    if (u32 != ~0U)
     
    55435543
    55445544    rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true);
    5545     if (VBOX_FAILURE(rc))
     5545    if (RT_FAILURE(rc))
    55465546        return PDMDEV_SET_ERROR(pDevIns, rc,
    55475547                                N_("PIIX3 configuration error: failed to read GCEnabled as boolean"));
     
    55495549
    55505550    rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true);
    5551     if (VBOX_FAILURE(rc))
     5551    if (RT_FAILURE(rc))
    55525552        return PDMDEV_SET_ERROR(pDevIns, rc,
    55535553                                N_("PIIX3 configuration error: failed to read R0Enabled as boolean"));
     
    55555555
    55565556    rc = CFGMR3QueryU32Def(pCfgHandle, "IRQDelay", &DelayIRQMillies, 0);
    5557     if (VBOX_FAILURE(rc))
     5557    if (RT_FAILURE(rc))
    55585558        return PDMDEV_SET_ERROR(pDevIns, rc,
    55595559                                N_("PIIX3 configuration error: failed to read IRQDelay as integer"));
     
    55625562
    55635563    rc = CFGMR3QueryBoolDef(pCfgHandle, "PIIX4", &pData->fPIIX4, false);
    5564     if (VBOX_FAILURE(rc))
     5564    if (RT_FAILURE(rc))
    55655565        return PDMDEV_SET_ERROR(pDevIns, rc,
    55665566                                N_("PIIX3 configuration error: failed to read PIIX4 as boolean"));
     
    56315631     */
    56325632    rc = PDMDevHlpPCIRegister(pDevIns, &pData->dev);
    5633     if (VBOX_FAILURE(rc))
     5633    if (RT_FAILURE(rc))
    56345634        return PDMDEV_SET_ERROR(pDevIns, rc,
    56355635                                N_("PIIX3 cannot register PCI device"));
    56365636    AssertMsg(pData->dev.devfn == 9 || iInstance != 0, ("pData->dev.devfn=%d\n", pData->dev.devfn));
    56375637    rc = PDMDevHlpPCIIORegionRegister(pDevIns, 4, 0x10, PCI_ADDRESS_SPACE_IO, ataBMDMAIORangeMap);
    5638     if (VBOX_FAILURE(rc))
     5638    if (RT_FAILURE(rc))
    56395639        return PDMDEV_SET_ERROR(pDevIns, rc,
    56405640                                N_("PIIX3 cannot register PCI I/O region for BMDMA"));
     
    56485648        rc = PDMDevHlpIOPortRegister(pDevIns, pData->aCts[i].IOPortBase1, 8, (RTHCPTR)i,
    56495649                                     ataIOPortWrite1, ataIOPortRead1, ataIOPortWriteStr1, ataIOPortReadStr1, "ATA I/O Base 1");
    5650         if (VBOX_FAILURE(rc))
     5650        if (RT_FAILURE(rc))
    56515651            return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register I/O handlers"));
    56525652
     
    56555655            rc = PDMDevHlpIOPortRegisterGC(pDevIns, pData->aCts[i].IOPortBase1, 8, (RTGCPTR)i,
    56565656                                           "ataIOPortWrite1", "ataIOPortRead1", "ataIOPortWriteStr1", "ataIOPortReadStr1", "ATA I/O Base 1");
    5657             if (VBOX_FAILURE(rc))
     5657            if (RT_FAILURE(rc))
    56585658                return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register I/O handlers (GC)"));
    56595659        }
     
    56685668                                           "ataIOPortWrite1", "ataIOPortRead1", "ataIOPortWriteStr1", "ataIOPortReadStr1", "ATA I/O Base 1");
    56695669#endif
    5670             if (VBOX_FAILURE(rc))
     5670            if (RT_FAILURE(rc))
    56715671                return PDMDEV_SET_ERROR(pDevIns, rc, "PIIX3 cannot register I/O handlers (R0).");
    56725672        }
     
    56745674        rc = PDMDevHlpIOPortRegister(pDevIns, pData->aCts[i].IOPortBase2, 1, (RTHCPTR)i,
    56755675                                     ataIOPortWrite2, ataIOPortRead2, NULL, NULL, "ATA I/O Base 2");
    5676         if (VBOX_FAILURE(rc))
     5676        if (RT_FAILURE(rc))
    56775677            return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register base2 I/O handlers"));
    56785678
     
    56815681            rc = PDMDevHlpIOPortRegisterGC(pDevIns, pData->aCts[i].IOPortBase2, 1, (RTGCPTR)i,
    56825682                                           "ataIOPortWrite2", "ataIOPortRead2", NULL, NULL, "ATA I/O Base 2");
    5683             if (VBOX_FAILURE(rc))
     5683            if (RT_FAILURE(rc))
    56845684                return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register base2 I/O handlers (GC)"));
    56855685        }
     
    56885688            rc = PDMDevHlpIOPortRegisterR0(pDevIns, pData->aCts[i].IOPortBase2, 1, (RTR0PTR)i,
    56895689                                           "ataIOPortWrite2", "ataIOPortRead2", NULL, NULL, "ATA I/O Base 2");
    5690             if (VBOX_FAILURE(rc))
     5690            if (RT_FAILURE(rc))
    56915691                return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register base2 I/O handlers (R0)"));
    56925692        }
     
    57285728        RTStrPrintf(szName, sizeof(szName), "ATA%d", i);
    57295729        rc = PDMDevHlpCritSectInit(pDevIns, &pData->aCts[i].lock, szName);
    5730         if (VBOX_FAILURE(rc))
     5730        if (RT_FAILURE(rc))
    57315731            return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot initialize critical section"));
    57325732    }
     
    57365736     */
    57375737    rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pData->IBase, &pBase, "Status Port");
    5738     if (VBOX_SUCCESS(rc))
     5738    if (RT_SUCCESS(rc))
    57395739        pData->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS);
    57405740    else if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
     
    57835783
    57845784            rc = PDMDevHlpDriverAttach(pDevIns, pIf->iLUN, &pIf->IBase, &pIf->pDrvBase, s_apszDescs[i][j]);
    5785             if (VBOX_SUCCESS(rc))
     5785            if (RT_SUCCESS(rc))
    57865786                rc = ataConfigLun(pDevIns, pIf);
    57875787            else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
     
    58175817                              ataSaveLoadPrep, ataSaveExec, NULL,
    58185818                              ataSaveLoadPrep, ataLoadExec, NULL);
    5819     if (VBOX_FAILURE(rc))
     5819    if (RT_FAILURE(rc))
    58205820        return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register save state handlers"));
    58215821
  • trunk/src/VBox/Devices/Storage/DrvBlock.cpp

    r11187 r11266  
    343343    int rc = pData->pDrvMedia->pfnBiosGetPCHSGeometry(pData->pDrvMedia, &pData->PCHSGeometry);
    344344
    345     if (VBOX_SUCCESS(rc))
     345    if (RT_SUCCESS(rc))
    346346    {
    347347        *pPCHSGeometry = pData->PCHSGeometry;
     
    377377    int rc = pData->pDrvMedia->pfnBiosSetPCHSGeometry(pData->pDrvMedia, pPCHSGeometry);
    378378
    379     if (    VBOX_SUCCESS(rc)
     379    if (    RT_SUCCESS(rc)
    380380        ||  rc == VERR_NOT_IMPLEMENTED)
    381381    {
     
    415415    int rc = pData->pDrvMedia->pfnBiosGetLCHSGeometry(pData->pDrvMedia, &pData->LCHSGeometry);
    416416
    417     if (VBOX_SUCCESS(rc))
     417    if (RT_SUCCESS(rc))
    418418    {
    419419        *pLCHSGeometry = pData->LCHSGeometry;
     
    449449    int rc = pData->pDrvMedia->pfnBiosSetLCHSGeometry(pData->pDrvMedia, pLCHSGeometry);
    450450
    451     if (    VBOX_SUCCESS(rc)
     451    if (    RT_SUCCESS(rc)
    452452        ||  rc == VERR_NOT_IMPLEMENTED)
    453453    {
     
    505505    {
    506506        int rc = pData->pDrvIns->pDrvHlp->pfnMountPrepare(pData->pDrvIns, pszFilename, pszCoreDriver);
    507         if (VBOX_FAILURE(rc))
     507        if (RT_FAILURE(rc))
    508508        {
    509509            Log(("drvblockMount: Prepare failed for \"%s\" rc=%Vrc\n", pszFilename, rc));
     
    517517    PPDMIBASE pBase;
    518518    int rc = pData->pDrvIns->pDrvHlp->pfnAttach(pData->pDrvIns, &pBase);
    519     if (VBOX_FAILURE(rc))
     519    if (RT_FAILURE(rc))
    520520    {
    521521        Log(("drvblockMount: Attach failed rc=%Vrc\n", rc));
     
    588588     */
    589589    int rc = pData->pDrvIns->pDrvHlp->pfnDetach(pData->pDrvIns);
    590     if (VBOX_FAILURE(rc))
     590    if (RT_FAILURE(rc))
    591591    {
    592592        Log(("drvblockUnmount: Detach failed rc=%Vrc\n", rc));
     
    772772    char *psz;
    773773    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Type", &psz);
    774     if (VBOX_FAILURE(rc))
     774    if (RT_FAILURE(rc))
    775775        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_BLOCK_NO_TYPE, N_("Failed to obtain the type"));
    776776    if (!strcmp(psz, "HardDisk"))
     
    802802    /* Mountable */
    803803    rc = CFGMR3QueryBoolDef(pCfgHandle, "Mountable", &pData->fMountable, false);
    804     if (VBOX_FAILURE(rc))
     804    if (RT_FAILURE(rc))
    805805        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Mountable\" from the config"));
    806806
    807807    /* Locked */
    808808    rc = CFGMR3QueryBoolDef(pCfgHandle, "Locked", &pData->fLocked, false);
    809     if (VBOX_FAILURE(rc))
     809    if (RT_FAILURE(rc))
    810810        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Locked\" from the config"));
    811811
    812812    /* BIOS visible */
    813813    rc = CFGMR3QueryBoolDef(pCfgHandle, "BIOSVisible", &pData->fBiosVisible, true);
    814     if (VBOX_FAILURE(rc))
     814    if (RT_FAILURE(rc))
    815815        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"BIOSVisible\" from the config"));
    816816
     
    819819    /* Cylinders */
    820820    rc = CFGMR3QueryU32Def(pCfgHandle, "Cylinders", &pData->LCHSGeometry.cCylinders, 0);
    821     if (VBOX_FAILURE(rc))
     821    if (RT_FAILURE(rc))
    822822        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Cylinders\" from the config"));
    823823
    824824    /* Heads */
    825825    rc = CFGMR3QueryU32Def(pCfgHandle, "Heads", &pData->LCHSGeometry.cHeads, 0);
    826     if (VBOX_FAILURE(rc))
     826    if (RT_FAILURE(rc))
    827827        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Heads\" from the config"));
    828828
    829829    /* Sectors */
    830830    rc = CFGMR3QueryU32Def(pCfgHandle, "Sectors", &pData->LCHSGeometry.cSectors, 0);
    831     if (VBOX_FAILURE(rc))
     831    if (RT_FAILURE(rc))
    832832        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Sectors\" from the config"));
    833833
     
    836836    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    837837        RTUuidClear(&pData->Uuid);
    838     else if (VBOX_SUCCESS(rc))
     838    else if (RT_SUCCESS(rc))
    839839    {
    840840        rc = RTUuidFromStr(&pData->Uuid, psz);
    841         if (VBOX_FAILURE(rc))
     841        if (RT_FAILURE(rc))
    842842        {
    843843            PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, "%s",
     
    853853#ifdef VBOX_PERIODIC_FLUSH
    854854    rc = CFGMR3QueryU32Def(pCfgHandle, "FlushInterval", &pData->cbFlushInterval, 0);
    855     if (VBOX_FAILURE(rc))
     855    if (RT_FAILURE(rc))
    856856        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"FlushInterval\" from the config"));
    857857#endif /* VBOX_PERIODIC_FLUSH */
     
    859859#ifdef VBOX_IGNORE_FLUSH
    860860    rc = CFGMR3QueryBoolDef(pCfgHandle, "IgnoreFlush", &pData->fIgnoreFlush, true);
    861     if (VBOX_FAILURE(rc))
     861    if (RT_FAILURE(rc))
    862862        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"IgnoreFlush\" from the config"));
    863863#endif /* VBOX_IGNORE_FLUSH */
     
    871871        &&  pData->enmType != PDMBLOCKTYPE_HARD_DISK)
    872872        return VINF_SUCCESS;
    873     if (VBOX_FAILURE(rc))
     873    if (RT_FAILURE(rc))
    874874    {
    875875        AssertLogRelMsgFailed(("Failed to attach driver below us! rc=%Vra\n", rc));
  • trunk/src/VBox/Devices/Storage/DrvHostBase.cpp

    r8579 r11266  
    166166         */
    167167        rc = RTFileSeek(pThis->FileDevice, off, RTFILE_SEEK_BEGIN, NULL);
    168         if (VBOX_SUCCESS(rc))
     168        if (RT_SUCCESS(rc))
    169169        {
    170170            rc = RTFileRead(pThis->FileDevice, pvBuf, cbRead, NULL);
    171             if (VBOX_SUCCESS(rc))
     171            if (RT_SUCCESS(rc))
    172172            {
    173173                Log2(("%s-%d: drvHostBaseRead: off=%#llx cbRead=%#x\n"
     
    222222             */
    223223            rc = RTFileSeek(pThis->FileDevice, off, RTFILE_SEEK_BEGIN, NULL);
    224             if (VBOX_SUCCESS(rc))
     224            if (RT_SUCCESS(rc))
    225225            {
    226226                rc = RTFileWrite(pThis->FileDevice, pvBuf, cbWrite, NULL);
    227                 if (VBOX_FAILURE(rc))
     227                if (RT_FAILURE(rc))
    228228                    Log(("%s-%d: drvHostBaseWrite: RTFileWrite(%d, %p, %#x) -> %Vrc (off=%#llx '%s')\n",
    229229                         pThis->pDrvIns->pDrvReg->szDriverName, pThis->pDrvIns->iInstance, pThis->FileDevice,
     
    489489        if (pThis->pfnDoLock)
    490490            rc = pThis->pfnDoLock(pThis, true);
    491         if (VBOX_SUCCESS(rc))
     491        if (RT_SUCCESS(rc))
    492492            pThis->fLocked = true;
    493493    }
     
    512512        if (pThis->pfnDoLock)
    513513            rc = pThis->pfnDoLock(pThis, false);
    514         if (VBOX_SUCCESS(rc))
     514        if (RT_SUCCESS(rc))
    515515            pThis->fLocked = false;
    516516    }
     
    675675        char szName[128];
    676676        int rc = drvHostBaseGetBSDName(DVDService, &szName[0], 0);
    677         if (VBOX_SUCCESS(rc))
     677        if (RT_SUCCESS(rc))
    678678        {
    679679            pThis->pDASession = DASessionCreate(kCFAllocatorDefault);
     
    891891
    892892                    /* Obtain exclusive access to the device so we can send SCSI commands. */
    893                     if (VBOX_SUCCESS(rc))
     893                    if (RT_SUCCESS(rc))
    894894                        rc = drvHostBaseObtainExclusiveAccess(pThis, DVDService);
    895895
    896896                    /* Cleanup on failure. */
    897                     if (VBOX_FAILURE(rc))
     897                    if (RT_FAILURE(rc))
    898898                    {
    899899                        if (pThis->ppScsiTaskDI)
     
    991991    int rc = drvHostBaseOpen(pThis, &FileDevice, pThis->fReadOnlyConfig);
    992992#endif
    993     if (VBOX_FAILURE(rc))
     993    if (RT_FAILURE(rc))
    994994    {
    995995        if (!pThis->fReadOnlyConfig)
     
    10021002#endif
    10031003        }
    1004         if (VBOX_FAILURE(rc))
     1004        if (RT_FAILURE(rc))
    10051005        {
    10061006            LogFlow(("%s-%d: failed to open device '%s', rc=%Vrc\n",
     
    10521052    };
    10531053    int rc = DRVHostBaseScsiCmd(pThis, abCmd, 6, PDMBLOCKTXDIR_FROM_DEVICE, &Buf, &cbBuf, NULL, 0, 0);
    1054     if (VBOX_SUCCESS(rc))
     1054    if (RT_SUCCESS(rc))
    10551055    {
    10561056        Assert(cbBuf == sizeof(Buf));
     
    12441244     */
    12451245    int rc = drvHostBaseReopen(pThis);
    1246     if (VBOX_FAILURE(rc))
     1246    if (RT_FAILURE(rc))
    12471247        return rc;
    12481248
     
    12521252    uint64_t cb;
    12531253    rc = pThis->pfnGetMediaSize(pThis, &cb);
    1254     if (VBOX_FAILURE(rc))
     1254    if (RT_FAILURE(rc))
    12551255    {
    12561256        LogFlow(("%s-%d: failed to figure media size of %s, rc=%Vrc\n",
     
    13321332                        int cRetries = 10;
    13331333                        int rc = DRVHostBaseMediaPresent(pThis);
    1334                         while (VBOX_FAILURE(rc) && cRetries-- > 0)
     1334                        while (RT_FAILURE(rc) && cRetries-- > 0)
    13351335                        {
    13361336                            RTThreadSleep(50);
     
    14291429
    14301430            int rc = pThis->pfnPoll(pThis);
    1431             if (VBOX_FAILURE(rc))
     1431            if (RT_FAILURE(rc))
    14321432            {
    14331433                RTSemEventWait(pThis->EventPoller, 50);
     
    14491449         */
    14501450        int rc = RTSemEventWait(pThis->EventPoller, pThis->cMilliesPoller);
    1451         if (    VBOX_FAILURE(rc)
     1451        if (    RT_FAILURE(rc)
    14521452            &&  rc != VERR_TIMEOUT)
    14531453        {
     
    15421542    {
    15431543        int rc = pThis->pfnDoLock(pThis, false);
    1544         if (VBOX_SUCCESS(rc))
     1544        if (RT_SUCCESS(rc))
    15451545            pThis->fLocked = false;
    15461546    }
     
    17391739    /* Device */
    17401740    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pThis->pszDevice);
    1741     if (VBOX_FAILURE(rc))
     1741    if (RT_FAILURE(rc))
    17421742    {
    17431743        AssertMsgFailed(("Configuration error: query for \"Path\" string returned %Vra.\n", rc));
     
    17481748    uint32_t u32;
    17491749    rc = CFGMR3QueryU32(pCfgHandle, "Interval", &u32);
    1750     if (VBOX_SUCCESS(rc))
     1750    if (RT_SUCCESS(rc))
    17511751        pThis->cMilliesPoller = u32;
    17521752    else if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    17531753        pThis->cMilliesPoller = 1000;
    1754     else if (VBOX_FAILURE(rc))
     1754    else if (RT_FAILURE(rc))
    17551755    {
    17561756        AssertMsgFailed(("Configuration error: Query \"Mountable\" resulted in %Vrc.\n", rc));
     
    17621762    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    17631763        pThis->fReadOnlyConfig = enmType == PDMBLOCKTYPE_DVD || enmType == PDMBLOCKTYPE_CDROM ? true : false;
    1764     else if (VBOX_FAILURE(rc))
     1764    else if (RT_FAILURE(rc))
    17651765    {
    17661766        AssertMsgFailed(("Configuration error: Query \"ReadOnly\" resulted in %Vrc.\n", rc));
     
    17721772    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    17731773        pThis->fLocked = false;
    1774     else if (VBOX_FAILURE(rc))
     1774    else if (RT_FAILURE(rc))
    17751775    {
    17761776        AssertMsgFailed(("Configuration error: Query \"Locked\" resulted in %Vrc.\n", rc));
     
    17821782    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    17831783        pThis->fBiosVisible = true;
    1784     else if (VBOX_FAILURE(rc))
     1784    else if (RT_FAILURE(rc))
    17851785    {
    17861786        AssertMsgFailed(("Configuration error: Query \"BIOSVisible\" resulted in %Vrc.\n", rc));
     
    17931793    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    17941794        RTUuidClear(&pThis->Uuid);
    1795     else if (VBOX_SUCCESS(rc))
     1795    else if (RT_SUCCESS(rc))
    17961796    {
    17971797        rc = RTUuidFromStr(&pThis->Uuid, psz);
    1798         if (VBOX_FAILURE(rc))
     1798        if (RT_FAILURE(rc))
    17991799        {
    18001800            AssertMsgFailed(("Configuration error: Uuid from string failed on \"%s\", rc=%Vrc.\n", psz, rc));
     
    18131813    bool fAttachFailError;
    18141814    rc = CFGMR3QueryBool(pCfgHandle, "AttachFailError", &fAttachFailError);
    1815     if (VBOX_FAILURE(rc))
     1815    if (RT_FAILURE(rc))
    18161816        fAttachFailError = true;
    18171817    pThis->fAttachFailError = fAttachFailError;
     
    18841884                                          NULL, NULL, NULL,
    18851885                                          NULL, NULL, drvHostBaseLoadDone);
    1886     if (VBOX_FAILURE(rc))
     1886    if (RT_FAILURE(rc))
    18871887        return rc;
    18881888
     
    19301930    rc = drvHostBaseReopen(pThis);
    19311931#endif
    1932     if (VBOX_FAILURE(rc))
     1932    if (RT_FAILURE(rc))
    19331933    {
    19341934        char *pszDevice = pThis->pszDevice;
     
    19811981    }
    19821982#ifdef RT_OS_WINDOWS
    1983     if (VBOX_SUCCESS(src))
     1983    if (RT_SUCCESS(src))
    19841984        DRVHostBaseMediaPresent(pThis);
    19851985#endif
     
    19921992        if (pThis->pfnDoLock)
    19931993            rc = pThis->pfnDoLock(pThis, true);
    1994         if (VBOX_FAILURE(rc))
     1994        if (RT_FAILURE(rc))
    19951995        {
    19961996            AssertMsgFailed(("Failed to lock the dvd drive. rc=%Vrc\n", rc));
     
    20002000
    20012001#ifndef RT_OS_WINDOWS
    2002     if (VBOX_SUCCESS(src))
     2002    if (RT_SUCCESS(src))
    20032003    {
    20042004        /*
     
    20062006         */
    20072007        rc = RTSemEventCreate(&pThis->EventPoller);
    2008         if (VBOX_FAILURE(rc))
     2008        if (RT_FAILURE(rc))
    20092009            return rc;
    20102010    }
     
    20152015     */
    20162016    rc = RTCritSectInit(&pThis->CritSect);
    2017     if (VBOX_FAILURE(rc))
     2017    if (RT_FAILURE(rc))
    20182018        return rc;
    20192019
    2020     if (VBOX_SUCCESS(src))
     2020    if (RT_SUCCESS(src))
    20212021    {
    20222022        /*
     
    20252025        rc = RTThreadCreate(&pThis->ThreadPoller, drvHostBaseMediaThread, pThis, 0,
    20262026                            RTTHREADTYPE_INFREQUENT_POLLER, RTTHREADFLAGS_WAITABLE, "DVDMEDIA");
    2027         if (VBOX_FAILURE(rc))
     2027        if (RT_FAILURE(rc))
    20282028        {
    20292029            AssertMsgFailed(("Failed to create poller thread. rc=%Vrc\n", rc));
     
    20422042    }
    20432043
    2044     if (VBOX_FAILURE(src))
     2044    if (RT_FAILURE(src))
    20452045        return src;
    20462046    return rc;
  • trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp

    r9330 r11266  
    162162         if (FileDevice == NIL_RTFILE) /* obsolete crap */
    163163             rc = RTFileOpen(&FileDevice, pThis->pszDeviceOpen, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    164          if (VBOX_SUCCESS(rc))
     164         if (RT_SUCCESS(rc))
    165165         {
    166166             /* do ioctl */
     
    312312    uint8_t abSense[32];
    313313    int rc2 = DRVHostBaseScsiCmd(pThis, abCmd, 6, PDMBLOCKTXDIR_NONE, NULL, NULL, abSense, sizeof(abSense), 0);
    314     if (VBOX_SUCCESS(rc2))
     314    if (RT_SUCCESS(rc2))
    315315        fMediaPresent = true;
    316316    else if (   rc2 == VERR_UNRESOLVED_ERROR
     
    710710     */
    711711    int rc = DRVHostBaseInitData(pDrvIns, pCfgHandle, PDMBLOCKTYPE_DVD);
    712     if (VBOX_SUCCESS(rc))
     712    if (RT_SUCCESS(rc))
    713713    {
    714714        /*
     
    719719        bool fPassthrough;
    720720        rc = CFGMR3QueryBool(pCfgHandle, "Passthrough", &fPassthrough);
    721         if (VBOX_SUCCESS(rc) && fPassthrough)
     721        if (RT_SUCCESS(rc) && fPassthrough)
    722722        {
    723723            pThis->IBlock.pfnSendCmd = drvHostDvdSendCmd;
     
    726726# ifdef VBOX_WITH_SUID_WRAPPER  /* Solaris setuid for Passthrough mode. */
    727727            rc = solarisCheckUserAuth();
    728             if (VBOX_FAILURE(rc))
     728            if (RT_FAILURE(rc))
    729729            {
    730730                Log(("DVD: solarisCheckUserAuth failed. Permission denied!\n"));
     
    752752        rc = DRVHostBaseInitFinish(pThis);
    753753    }
    754     if (VBOX_FAILURE(rc))
     754    if (RT_FAILURE(rc))
    755755    {
    756756        if (!pThis->fAttachFailError)
  • trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp

    r8155 r11266  
    124124            DRVHostBaseMediaNotPresent(pThis);
    125125        rc = DRVHostBaseMediaPresent(pThis);
    126         if (VBOX_FAILURE(rc))
     126        if (RT_FAILURE(rc))
    127127        {
    128128            pThisFloppy->fPrevDiskIn = fDiskIn;
     
    162162     */
    163163    int rc = DRVHostBaseInitData(pDrvIns, pCfgHandle, PDMBLOCKTYPE_FLOPPY_1_44);
    164     if (VBOX_SUCCESS(rc))
     164    if (RT_SUCCESS(rc))
    165165    {
    166166        /*
     
    177177        rc = DRVHostBaseInitFinish(&pThis->Base);
    178178    }
    179     if (VBOX_FAILURE(rc))
     179    if (RT_FAILURE(rc))
    180180    {
    181181        if (!pThis->Base.fAttachFailError)
  • trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp

    r11191 r11266  
    128128    char *pszName;
    129129    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pszName);
    130     if (VBOX_FAILURE(rc))
     130    if (RT_FAILURE(rc))
    131131        return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Path\" from the config"));
    132132
     
    136136    rc = RTFileOpen(&pData->File, pszName,
    137137                    RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
    138     if (VBOX_SUCCESS(rc))
     138    if (RT_SUCCESS(rc))
    139139    {
    140140        LogFlow(("drvMediaISOConstruct: ISO image '%s' opened successfully.\n", pszName));
     
    182182    uint64_t cbFile;
    183183    int rc = RTFileGetSize(pData->File, &cbFile);
    184     if (VBOX_SUCCESS(rc))
     184    if (RT_SUCCESS(rc))
    185185    {
    186186        LogFlow(("drvMediaISOGetSize: returns %lld (%s)\n", cbFile, pData->pszFilename));
     
    238238     */
    239239    int rc = RTFileSeek(pData->File, off, RTFILE_SEEK_BEGIN, NULL);
    240     if (VBOX_SUCCESS(rc))
     240    if (RT_SUCCESS(rc))
    241241    {
    242242        rc = RTFileRead(pData->File, pvBuf, cbRead, NULL);
    243         if (VBOX_SUCCESS(rc))
     243        if (RT_SUCCESS(rc))
    244244        {
    245245            Log2(("drvMediaISORead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n"
  • trunk/src/VBox/Devices/Storage/DrvRawImage.cpp

    r8155 r11266  
    131131    char *pszName;
    132132    int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pszName);
    133     if (VBOX_FAILURE(rc))
     133    if (RT_FAILURE(rc))
    134134    {
    135135        AssertMsgFailed(("Configuration error: query for \"Path\" string return %Vrc.\n", rc));
     
    142142    rc = RTFileOpen(&pData->File, pszName,
    143143                    RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    144     if (VBOX_SUCCESS(rc))
     144    if (RT_SUCCESS(rc))
    145145    {
    146146        LogFlow(("drvRawImageConstruct: Raw image '%s' opened successfully.\n", pszName));
     
    152152        rc = RTFileOpen(&pData->File, pszName,
    153153                        RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    154         if (VBOX_SUCCESS(rc))
     154        if (RT_SUCCESS(rc))
    155155        {
    156156            LogFlow(("drvRawImageConstruct: Raw image '%s' opened successfully.\n", pszName));
     
    200200    uint64_t cbFile;
    201201    int rc = RTFileGetSize(pData->File, &cbFile);
    202     if (VBOX_SUCCESS(rc))
     202    if (RT_SUCCESS(rc))
    203203    {
    204204        LogFlow(("drvRawImageGetSize: returns %lld (%s)\n", cbFile, pData->pszFilename));
     
    256256     */
    257257    int rc = RTFileSeek(pData->File, off, RTFILE_SEEK_BEGIN, NULL);
    258     if (VBOX_SUCCESS(rc))
     258    if (RT_SUCCESS(rc))
    259259    {
    260260        rc = RTFileRead(pData->File, pvBuf, cbRead, NULL);
    261         if (VBOX_SUCCESS(rc))
     261        if (RT_SUCCESS(rc))
    262262        {
    263263            Log2(("drvRawImageRead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n"
     
    290290     */
    291291    int rc = RTFileSeek(pData->File, off, RTFILE_SEEK_BEGIN, NULL);
    292     if (VBOX_SUCCESS(rc))
     292    if (RT_SUCCESS(rc))
    293293    {
    294294        rc = RTFileWrite(pData->File, pvBuf, cbWrite, NULL);
    295         if (VBOX_SUCCESS(rc))
     295        if (RT_SUCCESS(rc))
    296296        {
    297297            Log2(("drvRawImageWrite: off=%#llx pvBuf=%p cbWrite=%#x (%s)\n"
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r11047 r11266  
    146146}
    147147
    148 static DECLCALLBACK(int) drvvdAsyncIORead(void *pvUser, void *pStorage, uint64_t uOffset, 
     148static DECLCALLBACK(int) drvvdAsyncIORead(void *pvUser, void *pStorage, uint64_t uOffset,
    149149                                          size_t cbRead, void *pvBuf, size_t *pcbRead)
    150150{
     
    158158}
    159159
    160 static DECLCALLBACK(int) drvvdAsyncIOWrite(void *pvUser, void *pStorage, uint64_t uOffset, 
     160static DECLCALLBACK(int) drvvdAsyncIOWrite(void *pvUser, void *pStorage, uint64_t uOffset,
    161161                                           size_t cbWrite, const void *pvBuf, size_t *pcbWritten)
    162162{
     
    278278    PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    279279    int rc = VDRead(pData->pDisk, off, pvBuf, cbRead);
    280     if (VBOX_SUCCESS(rc))
     280    if (RT_SUCCESS(rc))
    281281        Log2(("%s: off=%#llx pvBuf=%p cbRead=%d %.*Vhxd\n", __FUNCTION__,
    282282              off, pvBuf, cbRead, cbRead, pvBuf));
     
    337337    PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    338338    int rc = VDGetPCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pPCHSGeometry);
    339     if (VBOX_FAILURE(rc))
     339    if (RT_FAILURE(rc))
    340340    {
    341341        Log(("%s: geometry not available.\n", __FUNCTION__));
     
    366366    PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface);
    367367    int rc = VDGetLCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pLCHSGeometry);
    368     if (VBOX_FAILURE(rc))
     368    if (RT_FAILURE(rc))
    369369    {
    370370        Log(("%s: geometry not available.\n", __FUNCTION__));
     
    402402*******************************************************************************/
    403403
    404 static DECLCALLBACK(int) drvvdStartRead(PPDMIMEDIAASYNC pInterface, uint64_t uOffset, 
     404static DECLCALLBACK(int) drvvdStartRead(PPDMIMEDIAASYNC pInterface, uint64_t uOffset,
    405405                                        PPDMDATASEG paSeg, unsigned cSeg,
    406406                                        size_t cbRead, void *pvUser)
     
    435435    PDRVVDASYNCTASK pDrvVDAsyncTask = (PDRVVDASYNCTASK)pvUser;
    436436    int rc = VINF_VDI_ASYNC_IO_FINISHED;
    437    
     437
    438438    /* Having a completion callback for a task is not mandatory. */
    439439    if (pDrvVDAsyncTask->pfnCompleted)
     
    580580    pData->pDrvMediaAsyncPort = (PPDMIMEDIAASYNCPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MEDIA_ASYNC_PORT);
    581581
    582     /* 
     582    /*
    583583     * Attach the async transport driver below of the device above us implements the
    584584     * async interface.
     
    592592        if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
    593593        {
    594             /* 
     594            /*
    595595             * Though the device supports async I/O the backend seems to not support it.
    596596             * Revert to non async I/O.
     
    598598            pData->pDrvMediaAsyncPort = NULL;
    599599        }
    600         else if (VBOX_FAILURE(rc))
     600        else if (RT_FAILURE(rc))
    601601        {
    602602            AssertMsgFailed(("Failed to attach async transport driver below rc=%Vrc\n", rc));
     
    656656     * Open the images.
    657657     */
    658     if (VBOX_SUCCESS(rc))
     658    if (RT_SUCCESS(rc))
    659659    {
    660660        /** @todo TEMP! later the iSCSI config callbacks won't be included here */
     
    664664
    665665    unsigned cImages = iLevel;
    666     while (pCurNode && VBOX_SUCCESS(rc))
     666    while (pCurNode && RT_SUCCESS(rc))
    667667    {
    668668        /*
     
    670670         */
    671671        rc = CFGMR3QueryStringAlloc(pCurNode, "Path", &pszName);
    672         if (VBOX_FAILURE(rc))
     672        if (RT_FAILURE(rc))
    673673        {
    674674            rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     
    678678
    679679        rc = CFGMR3QueryStringAlloc(pCfgHandle, "Format", &pszFormat);
    680         if (VBOX_FAILURE(rc))
     680        if (RT_FAILURE(rc))
    681681        {
    682682            rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     
    690690            if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    691691                fReadOnly = false;
    692             else if (VBOX_FAILURE(rc))
     692            else if (RT_FAILURE(rc))
    693693            {
    694694                rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     
    700700            if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    701701                fHonorZeroWrites = false;
    702             else if (VBOX_FAILURE(rc))
     702            else if (RT_FAILURE(rc))
    703703            {
    704704                rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     
    742742        }
    743743
    744         if (VBOX_SUCCESS(rc))
     744        if (RT_SUCCESS(rc))
    745745            Log(("%s: %d - Opened '%s' in %s mode\n", __FUNCTION__,
    746746                 iLevel, pszName,
     
    763763    }
    764764
    765     if (VBOX_FAILURE(rc))
     765    if (RT_FAILURE(rc))
    766766    {
    767767        if (VALID_PTR(pData->pDisk))
     
    776776    }
    777777
    778     /* 
     778    /*
    779779     * Check for async I/O support. Every opened image has to support
    780780     * it.
     
    790790        if (vdBackendInfo.uBackendCaps & VD_CAP_ASYNC)
    791791        {
    792             /* 
     792            /*
    793793             * Backend indicates support for at least some files.
    794794             * Check if current file is supported with async I/O)
     
    797797            AssertRC(rc);
    798798
    799             /* 
     799            /*
    800800             * Check if current image is supported.
    801801             * If not we can stop checking because
     
    895895    PVBOXDISK pData = PDMINS2DATA(pDrvIns, PVBOXDISK);
    896896
    897     /* 
     897    /*
    898898     * We must close the disk here to ensure that
    899899     * the backend closes all files before the
  • trunk/src/VBox/Devices/Storage/RawHDDCore.cpp

    r11176 r11266  
    111111                     ? RTFILE_O_READ      | RTFILE_O_OPEN | RTFILE_O_DENY_NONE
    112112                     : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
    113     if (VBOX_FAILURE(rc))
     113    if (RT_FAILURE(rc))
    114114    {
    115115        /* Do NOT signal an appropriate error here, as the VD layer has the
     
    120120
    121121    rc = RTFileGetSize(pImage->File, &pImage->cbSize);
    122     if (VBOX_FAILURE(rc))
     122    if (RT_FAILURE(rc))
    123123        goto out;
    124124    if (pImage->cbSize % 512)
     
    130130
    131131out:
    132     if (VBOX_FAILURE(rc))
     132    if (RT_FAILURE(rc))
    133133        rawFreeImage(pImage, false);
    134134    return rc;
     
    167167    rc = RTFileOpen(&File, pImage->pszFilename,
    168168                    RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL);
    169     if (VBOX_FAILURE(rc))
     169    if (RT_FAILURE(rc))
    170170    {
    171171        rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: cannot create image '%s'"), pImage->pszFilename);
     
    177177     * sufficient space available. */
    178178    rc = RTFsQuerySizes(pImage->pszFilename, NULL, &cbFree, NULL, NULL);
    179     if (VBOX_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbSize))
     179    if (RT_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbSize))
    180180    {
    181181        rc = rawError(pImage, VERR_DISK_FULL, RT_SRC_POS, N_("Raw: disk would overflow creating image '%s'"), pImage->pszFilename);
     
    186186     * effective than expanding file by write operations. */
    187187    rc = RTFileSetSize(File, cbSize);
    188     if (VBOX_FAILURE(rc))
     188    if (RT_FAILURE(rc))
    189189    {
    190190        rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: setting image size failed for '%s'"), pImage->pszFilename);
     
    210210
    211211        rc = RTFileWriteAt(File, uOff, pvBuf, cbChunk, NULL);
    212         if (VBOX_FAILURE(rc))
     212        if (RT_FAILURE(rc))
    213213        {
    214214            rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: writing block failed for '%s'"), pImage->pszFilename);
     
    223223                             uPercentStart + uOff * uPercentSpan * 98 / (cbSize * 100),
    224224                             pvUser);
    225             if (VBOX_FAILURE(rc))
     225            if (RT_FAILURE(rc))
    226226                goto out;
    227227        }
     
    229229    RTMemTmpFree(pvBuf);
    230230
    231     if (VBOX_SUCCESS(rc) && pfnProgress)
     231    if (RT_SUCCESS(rc) && pfnProgress)
    232232        pfnProgress(NULL /* WARNING! pVM=NULL  */,
    233233                    uPercentStart + uPercentSpan * 98 / 100, pvUser);
     
    239239
    240240out:
    241     if (VBOX_SUCCESS(rc) && pfnProgress)
     241    if (RT_SUCCESS(rc) && pfnProgress)
    242242        pfnProgress(NULL /* WARNING! pVM=NULL  */,
    243243                    uPercentStart + uPercentSpan, pvUser);
    244244
    245     if (VBOX_FAILURE(rc))
     245    if (RT_FAILURE(rc))
    246246        rawFreeImage(pImage, rc != VERR_ALREADY_EXISTS);
    247247    return rc;
     
    346346
    347347    rc = rawOpenImage(pImage, uOpenFlags);
    348     if (VBOX_SUCCESS(rc))
     348    if (RT_SUCCESS(rc))
    349349        *ppBackendData = pImage;
    350350
     
    404404                        pPCHSGeometry, pLCHSGeometry,
    405405                        pfnProgress, pvUser, uPercentStart, uPercentSpan);
    406     if (VBOX_SUCCESS(rc))
     406    if (RT_SUCCESS(rc))
    407407    {
    408408        /* So far the image is opened in read/write mode. Make sure the
     
    412412            rawFreeImage(pImage, false);
    413413            rc = rawOpenImage(pImage, uOpenFlags);
    414             if (VBOX_FAILURE(rc))
     414            if (RT_FAILURE(rc))
    415415                goto out;
    416416        }
     
    585585        {
    586586            int rc = RTFileGetSize(pImage->File, &cbFile);
    587             if (VBOX_SUCCESS(rc))
     587            if (RT_SUCCESS(rc))
    588588                cb += cbFile;
    589589        }
  • trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp

    r11176 r11266  
    192192        /* Try to load the plugin (RTldrLoad takes care of the suffix). */
    193193        rc = RTLdrLoad(pszPluginName, &hPlugin);
    194         if (VBOX_SUCCESS(rc))
     194        if (RT_SUCCESS(rc))
    195195        {
    196196            PFNVBOXHDDFORMATLOAD pfnHDDFormatLoad;
     
    198198            rc = RTLdrGetSymbol(hPlugin, VBOX_HDDFORMAT_LOAD_NAME,
    199199                                (void**)&pfnHDDFormatLoad);
    200             if (VBOX_FAILURE(rc) || !pfnHDDFormatLoad)
     200            if (RT_FAILURE(rc) || !pfnHDDFormatLoad)
    201201            {
    202202                LogFunc(("error resolving the entry point %s in plugin %s, rc=%Vrc, pfnHDDFormat=%#p\n", VBOX_HDDFORMAT_LOAD_NAME, pszPluginName, rc, pfnHDDFormatLoad));
    203                 if (VBOX_SUCCESS(rc))
     203                if (RT_SUCCESS(rc))
    204204                    rc = VERR_SYMBOL_NOT_FOUND;
    205205                goto out;
     
    209209            PVBOXHDDBACKEND pBE;
    210210            rc = pfnHDDFormatLoad(&pBE);
    211             if (VBOX_FAILURE(rc))
     211            if (RT_FAILURE(rc))
    212212                goto out;
    213213            /* Check if the sizes match. If not this plugin is too old. */
     
    230230
    231231out:
    232     if (VBOX_FAILURE(rc))
     232    if (RT_FAILURE(rc))
    233233    {
    234234        if (hPlugin != NIL_RTLDRMOD)
     
    344344        uOffset += cbThisRead;
    345345        pvBuf = (char *)pvBuf + cbThisRead;
    346     } while (cbRead != 0 && VBOX_SUCCESS(rc));
     346    } while (cbRead != 0 && RT_SUCCESS(rc));
    347347
    348348    return rc;
     
    407407        rc = vdReadHelper(pDisk, pImage->pPrev, uOffset - cbPreRead, pvTmp,
    408408                          cbPreRead);
    409         if (VBOX_FAILURE(rc))
     409        if (RT_FAILURE(rc))
    410410            return rc;
    411411    }
     
    444444                              (char *)pvTmp + cbPreRead + cbThisWrite + cbWriteCopy,
    445445                              cbReadImage);
    446         if (VBOX_FAILURE(rc))
     446        if (RT_FAILURE(rc))
    447447            return rc;
    448448        /* Zero out the remainder of this block. Will never be visible, as this
     
    503503    rc = vdReadHelper(pDisk, pImage->pPrev, uOffset - cbPreRead, pvTmp,
    504504                      cbPreRead + cbThisWrite + cbPostRead - cbFill);
    505     if (VBOX_FAILURE(rc))
     505    if (RT_FAILURE(rc))
    506506        return rc;
    507507
     
    595595            }
    596596            RTMemTmpFree(pvTmp);
    597             if (VBOX_FAILURE(rc))
     597            if (RT_FAILURE(rc))
    598598                break;
    599599        }
     
    602602        uOffset += cbThisWrite;
    603603        pvBuf = (char *)pvBuf + cbThisWrite;
    604     } while (cbWrite != 0 && VBOX_SUCCESS(rc));
     604    } while (cbWrite != 0 && RT_SUCCESS(rc));
    605605
    606606    return rc;
     
    656656            }
    657657        }
    658         if (VBOX_FAILURE(rc))
     658        if (RT_FAILURE(rc))
    659659            break;
    660660
     
    662662        char szPath[RTPATH_MAX];
    663663        rc = RTPathSharedLibs(szPath, sizeof(szPath));
    664         if (VBOX_FAILURE(rc))
     664        if (RT_FAILURE(rc))
    665665            break;
    666666
     
    669669        rc = RTStrAPrintf(&pszPluginFilter, "%s/%s*", szPath,
    670670                          VBOX_HDDFORMAT_PLUGIN_PREFIX);
    671         if (VBOX_FAILURE(rc))
     671        if (RT_FAILURE(rc))
    672672        {
    673673            rc = VERR_NO_MEMORY;
     
    677677        /* The plugins are in the same directory as the other shared libs. */
    678678        rc = RTDirOpenFiltered(&pPluginDir, pszPluginFilter, RTDIRFILTER_WINNT);
    679         if (VBOX_FAILURE(rc))
     679        if (RT_FAILURE(rc))
    680680            break;
    681681
     
    702702                /* Retry. */
    703703                rc = RTDirRead(pPluginDir, pPluginDirEntry, &cbPluginDirEntry);
    704                 if (VBOX_FAILURE(rc))
     704                if (RT_FAILURE(rc))
    705705                    break;
    706706            }
    707             else if (VBOX_FAILURE(rc))
     707            else if (RT_FAILURE(rc))
    708708                break;
    709709
     
    713713
    714714            rc = RTLdrLoad(pPluginDirEntry->szName, &hPlugin);
    715             if (VBOX_SUCCESS(rc))
     715            if (RT_SUCCESS(rc))
    716716            {
    717717                rc = RTLdrGetSymbol(hPlugin, VBOX_HDDFORMAT_LOAD_NAME, (void**)&pfnHDDFormatLoad);
    718                 if (VBOX_FAILURE(rc) || !pfnHDDFormatLoad)
     718                if (RT_FAILURE(rc) || !pfnHDDFormatLoad)
    719719                {
    720720                    LogFunc(("error resolving the entry point %s in plugin %s, rc=%Vrc, pfnHDDFormat=%#p\n", VBOX_HDDFORMAT_LOAD_NAME, pPluginDirEntry->szName, rc, pfnHDDFormatLoad));
    721                     if (VBOX_SUCCESS(rc))
     721                    if (RT_SUCCESS(rc))
    722722                        rc = VERR_SYMBOL_NOT_FOUND;
    723723                }
    724724
    725                 if (VBOX_SUCCESS(rc))
     725                if (RT_SUCCESS(rc))
    726726                {
    727727                    /* Get the function table. */
    728728                    rc = pfnHDDFormatLoad(&pBackend);
    729                     if (VBOX_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND))
     729                    if (RT_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND))
    730730                    {
    731731                        char *pszName = RTStrDup(pBackend->pszBackendName);
     
    885885            {
    886886                rc = aBackends[i]->pfnCheckIfValid(pszFilename);
    887                 if (VBOX_SUCCESS(rc))
     887                if (RT_SUCCESS(rc))
    888888                {
    889889                    fPluginFound = true;
     
    906906        char szPath[RTPATH_MAX];
    907907        rc = RTPathSharedLibs(szPath, sizeof(szPath));
    908         if (VBOX_FAILURE(rc))
     908        if (RT_FAILURE(rc))
    909909            break;
    910910
     
    913913        rc = RTStrAPrintf(&pszPluginFilter, "%s/%s*", szPath,
    914914                          VBOX_HDDFORMAT_PLUGIN_PREFIX);
    915         if (VBOX_FAILURE(rc))
     915        if (RT_FAILURE(rc))
    916916        {
    917917            rc = VERR_NO_MEMORY;
     
    921921        /* The plugins are in the same directory as the other shared libs. */
    922922        rc = RTDirOpenFiltered(&pPluginDir, pszPluginFilter, RTDIRFILTER_WINNT);
    923         if (VBOX_FAILURE(rc))
     923        if (RT_FAILURE(rc))
    924924            break;
    925925
     
    946946                /* Retry. */
    947947                rc = RTDirRead(pPluginDir, pPluginDirEntry, &cbPluginDirEntry);
    948                 if (VBOX_FAILURE(rc))
     948                if (RT_FAILURE(rc))
    949949                    break;
    950950            }
    951             else if (VBOX_FAILURE(rc))
     951            else if (RT_FAILURE(rc))
    952952                break;
    953953
     
    957957
    958958            rc = RTLdrLoad(pPluginDirEntry->szName, &hPlugin);
    959             if (VBOX_SUCCESS(rc))
     959            if (RT_SUCCESS(rc))
    960960            {
    961961                rc = RTLdrGetSymbol(hPlugin, VBOX_HDDFORMAT_LOAD_NAME, (void**)&pfnHDDFormatLoad);
    962                 if (VBOX_FAILURE(rc) || !pfnHDDFormatLoad)
     962                if (RT_FAILURE(rc) || !pfnHDDFormatLoad)
    963963                {
    964964                    LogFunc(("error resolving the entry point %s in plugin %s, rc=%Vrc, pfnHDDFormat=%#p\n", VBOX_HDDFORMAT_LOAD_NAME, pPluginDirEntry->szName, rc, pfnHDDFormatLoad));
    965                     if (VBOX_SUCCESS(rc))
     965                    if (RT_SUCCESS(rc))
    966966                        rc = VERR_SYMBOL_NOT_FOUND;
    967967                }
    968968
    969                 if (VBOX_SUCCESS(rc))
     969                if (RT_SUCCESS(rc))
    970970                {
    971971                    /* Get the function table. */
    972972                    rc = pfnHDDFormatLoad(&pBackend);
    973                     if (VBOX_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND))
     973                    if (RT_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND))
    974974                    {
    975975
    976976                        /* Check if the plugin can handle this file. */
    977977                        rc = pBackend->pfnCheckIfValid(pszFilename);
    978                         if (VBOX_SUCCESS(rc))
     978                        if (RT_SUCCESS(rc))
    979979                        {
    980980                            fPluginFound = true;
     
    10801080
    10811081        rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin);
    1082         if (VBOX_FAILURE(rc))
     1082        if (RT_FAILURE(rc))
    10831083            break;
    10841084        if (!pImage->Backend)
     
    10951095                                      &pImage->pvBackendData);
    10961096        /* If the open in read-write mode failed, retry in read-only mode. */
    1097         if (VBOX_FAILURE(rc))
     1097        if (RT_FAILURE(rc))
    10981098        {
    10991099            if (!(uOpenFlags & VD_OPEN_FLAGS_READONLY)
     
    11081108                                               pDisk->pInterfaces,
    11091109                                               &pImage->pvBackendData);
    1110             if (VBOX_FAILURE(rc))
     1110            if (RT_FAILURE(rc))
    11111111            {
    11121112                rc = vdError(pDisk, rc, RT_SRC_POS,
     
    11241124         * diff images. Some image formats don't distinguish between normal
    11251125         * and diff images, so this must be corrected here. */
    1126         if (VBOX_FAILURE(rc))
     1126        if (RT_FAILURE(rc))
    11271127            enmImageType = VD_IMAGE_TYPE_INVALID;
    1128         if (    VBOX_SUCCESS(rc)
     1128        if (    RT_SUCCESS(rc)
    11291129            &&  !(uOpenFlags & VD_OPEN_FLAGS_INFO))
    11301130        {
     
    11651165        rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData,
    11661166                                                  &pDisk->PCHSGeometry);
    1167         if (VBOX_FAILURE(rc2))
     1167        if (RT_FAILURE(rc2))
    11681168        {
    11691169            pDisk->PCHSGeometry.cCylinders = 0;
     
    11821182        rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData,
    11831183                                                  &pDisk->LCHSGeometry);
    1184         if (VBOX_FAILURE(rc2))
     1184        if (RT_FAILURE(rc2))
    11851185        {
    11861186            pDisk->LCHSGeometry.cCylinders = 0;
     
    12081208        }
    12091209
    1210         if (VBOX_SUCCESS(rc))
     1210        if (RT_SUCCESS(rc))
    12111211        {
    12121212            /* Image successfully opened, make it the last image. */
     
    12251225    } while (0);
    12261226
    1227     if (VBOX_FAILURE(rc))
     1227    if (RT_FAILURE(rc))
    12281228    {
    12291229        if (pImage)
     
    13411341
    13421342        rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin);
    1343         if (VBOX_FAILURE(rc))
     1343        if (RT_FAILURE(rc))
    13441344            break;
    13451345        if (!pImage->Backend)
     
    13591359                                        &pImage->pvBackendData);
    13601360
    1361         if (VBOX_SUCCESS(rc))
     1361        if (RT_SUCCESS(rc))
    13621362        {
    13631363            pImage->enmImageType = enmType;
     
    13781378            rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData,
    13791379                                                      &pDisk->PCHSGeometry);
    1380             if (VBOX_FAILURE(rc2))
     1380            if (RT_FAILURE(rc2))
    13811381            {
    13821382                pDisk->PCHSGeometry.cCylinders = 0;
     
    13951395            rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData,
    13961396                                                      &pDisk->LCHSGeometry);
    1397             if (VBOX_FAILURE(rc2))
     1397            if (RT_FAILURE(rc2))
    13981398            {
    13991399                pDisk->LCHSGeometry.cCylinders = 0;
     
    14101410        }
    14111411
    1412         if (VBOX_SUCCESS(rc))
     1412        if (RT_SUCCESS(rc))
    14131413        {
    14141414            /* Image successfully opened, make it the last image. */
     
    14271427    } while (0);
    14281428
    1429     if (VBOX_FAILURE(rc))
     1429    if (RT_FAILURE(rc))
    14301430    {
    14311431        if (pImage)
     
    14401440    }
    14411441
    1442     if (VBOX_SUCCESS(rc) && pfnProgress)
     1442    if (RT_SUCCESS(rc) && pfnProgress)
    14431443        pfnProgress(NULL /* WARNING! pVM=NULL  */, 100, pvUser);
    14441444
     
    15121512
    15131513        rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin);
    1514         if (VBOX_FAILURE(rc))
     1514        if (RT_FAILURE(rc))
    15151515            break;
    15161516        if (!pImage->Backend)
     
    15321532                                        &pImage->pvBackendData);
    15331533
    1534         if (VBOX_SUCCESS(rc) && pDisk->cImages != 0)
     1534        if (RT_SUCCESS(rc) && pDisk->cImages != 0)
    15351535        {
    15361536            pImage->enmImageType = VD_IMAGE_TYPE_DIFF;
     
    15461546        }
    15471547
    1548         if (VBOX_SUCCESS(rc))
     1548        if (RT_SUCCESS(rc))
    15491549        {
    15501550            RTUUID Uuid;
     
    15541554            rc2 = pDisk->pLast->Backend->pfnGetUuid(pDisk->pLast->pvBackendData,
    15551555                                                    &Uuid);
    1556             if (VBOX_SUCCESS(rc2))
     1556            if (RT_SUCCESS(rc2))
    15571557                pImage->Backend->pfnSetParentUuid(pImage->pvBackendData, &Uuid);
    15581558            rc2 = pDisk->pLast->Backend->pfnGetModificationUuid(pDisk->pLast->pvBackendData,
    15591559                                                                &Uuid);
    1560             if (VBOX_SUCCESS(rc2))
     1560            if (RT_SUCCESS(rc2))
    15611561                pImage->Backend->pfnSetParentModificationUuid(pImage->pvBackendData,
    15621562                                                              &Uuid);
    15631563            rc2 = pDisk->pLast->Backend->pfnGetTimeStamp(pDisk->pLast->pvBackendData,
    15641564                                                             &ts);
    1565             if (VBOX_SUCCESS(rc2))
     1565            if (RT_SUCCESS(rc2))
    15661566                pImage->Backend->pfnSetParentTimeStamp(pImage->pvBackendData, &ts);
    15671567
     
    15691569        }
    15701570
    1571         if (VBOX_SUCCESS(rc))
     1571        if (RT_SUCCESS(rc))
    15721572        {
    15731573            /** @todo optionally check UUIDs */
    15741574        }
    15751575
    1576         if (VBOX_SUCCESS(rc))
     1576        if (RT_SUCCESS(rc))
    15771577        {
    15781578            /* Image successfully opened, make it the last image. */
     
    15911591    } while (0);
    15921592
    1593     if (VBOX_FAILURE(rc))
     1593    if (RT_FAILURE(rc))
    15941594    {
    15951595        if (pImage->hPlugin != NIL_RTLDRMOD)
     
    16041604    }
    16051605
    1606     if (VBOX_SUCCESS(rc) && pfnProgress)
     1606    if (RT_SUCCESS(rc) && pfnProgress)
    16071607        pfnProgress(NULL /* WARNING! pVM=NULL  */, 100, pvUser);
    16081608
     
    16561656            rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pvBackendData,
    16571657                                                    uOpenFlags);
    1658             if (VBOX_FAILURE(rc))
     1658            if (RT_FAILURE(rc))
    16591659                break;
    16601660        }
     
    17081708                    if (rc != VERR_VDI_BLOCK_FREE)
    17091709                    {
    1710                         if (VBOX_FAILURE(rc))
     1710                        if (RT_FAILURE(rc))
    17111711                            break;
    17121712                        rc = vdWriteHelper(pDisk, pImageTo, uOffset, pvBuf,
    17131713                                           cbThisRead);
    1714                         if (VBOX_FAILURE(rc))
     1714                        if (RT_FAILURE(rc))
    17151715                            break;
    17161716                    }
     
    17181718                        rc = VINF_SUCCESS;
    17191719                }
    1720                 else if (VBOX_FAILURE(rc))
     1720                else if (RT_FAILURE(rc))
    17211721                    break;
    17221722
     
    17511751                if (rc != VERR_VDI_BLOCK_FREE)
    17521752                {
    1753                     if (VBOX_FAILURE(rc))
     1753                    if (RT_FAILURE(rc))
    17541754                        break;
    17551755                    rc = vdWriteHelper(pDisk, pImageTo, uOffset, pvBuf,
    17561756                                       cbThisRead);
    1757                     if (VBOX_FAILURE(rc))
     1757                    if (RT_FAILURE(rc))
    17581758                        break;
    17591759                }
     
    18021802            rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pvBackendData,
    18031803                                                    uOpenFlags);
    1804             if (VBOX_FAILURE(rc))
     1804            if (RT_FAILURE(rc))
    18051805                break;
    18061806        }
     
    18231823        RTMemTmpFree(pvBuf);
    18241824
    1825     if (VBOX_SUCCESS(rc) && pfnProgress)
     1825    if (RT_SUCCESS(rc) && pfnProgress)
    18261826        pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser);
    18271827
     
    18931893            /* Close the source image. */
    18941894            rc = pImageFrom->Backend->pfnClose(pImageFrom->pvBackendData, false);
    1895             if (VBOX_FAILURE(rc))
     1895            if (RT_FAILURE(rc))
    18961896                break;
    18971897
    18981898            /* Open the source image in the destination container. */
    18991899            rc = VDOpen(pDiskTo, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags);
    1900             if (VBOX_FAILURE(rc))
     1900            if (RT_FAILURE(rc))
    19011901                goto movefail;
    19021902
     
    19051905            /* Rename the image. */
    19061906            rc = pImageTo->Backend->pfnRename(pImageTo->pvBackendData, pszFilename ? pszFilename : pImageTo->pszFilename);
    1907             if (VBOX_FAILURE(rc))
     1907            if (RT_FAILURE(rc))
    19081908                goto movefail;
    19091909
     
    19241924            /* In case of failure, re-open the source image in the source container. */
    19251925            rc2 = VDOpen(pDiskFrom, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags);
    1926             if (VBOX_FAILURE(rc2))
     1926            if (RT_FAILURE(rc2))
    19271927                /** @todo Uncertain what to do on error. If this happens pImageFrom and pImageTo are both closed. */
    19281928                rc = rc2;
     
    19741974                              uOpenFlagsFrom, NULL, NULL);
    19751975        }
    1976         if (VBOX_FAILURE(rc))
     1976        if (RT_FAILURE(rc))
    19771977            break;
    19781978
     
    19981998            rc = vdReadHelper(pDiskFrom, pImageFrom, uOffset, pvBuf,
    19991999                              cbThisRead);
    2000             if (VBOX_FAILURE(rc))
     2000            if (RT_FAILURE(rc))
    20012001                break;
    20022002
    20032003            rc = vdWriteHelper(pDiskTo, pImageTo, uOffset, pvBuf,
    20042004                               cbThisRead);
    2005             if (VBOX_FAILURE(rc))
     2005            if (RT_FAILURE(rc))
    20062006                break;
    20072007
     
    20132013                                 ((cbSize - cbRemaining) * 100) / cbSize,
    20142014                                 pvUser);
    2015                 if (VBOX_FAILURE(rc))
     2015                if (RT_FAILURE(rc))
    20162016                    break;
    20172017            }
     
    20402040    } while (0);
    20412041
    2042     if (VBOX_FAILURE(rc) && pImageTo)
     2042    if (RT_FAILURE(rc) && pImageTo)
    20432043    {
    20442044        /* Error detected, but new image created. Remove image from list. */
     
    20632063        RTMemTmpFree(pvBuf);
    20642064
    2065     if (VBOX_SUCCESS(rc) && pfnProgress)
     2065    if (RT_SUCCESS(rc) && pfnProgress)
    20662066        pfnProgress(NULL /* WARNING! pVM=NULL  */, 100, pvUser);
    20672067
     
    21302130        rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData,
    21312131                                                 &pDisk->PCHSGeometry);
    2132         if (VBOX_FAILURE(rc2))
     2132        if (RT_FAILURE(rc2))
    21332133        {
    21342134            pDisk->PCHSGeometry.cCylinders = 0;
     
    21472147        rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData,
    21482148                                                  &pDisk->LCHSGeometry);
    2149         if (VBOX_FAILURE(rc2))
     2149        if (RT_FAILURE(rc2))
    21502150        {
    21512151            pDisk->LCHSGeometry.cCylinders = 0;
     
    21912191            /* Close image. */
    21922192            int rc2 = pImage->Backend->pfnClose(pImage->pvBackendData, false);
    2193             if (VBOX_FAILURE(rc2) && VBOX_SUCCESS(rc))
     2193            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
    21942194                rc = rc2;
    21952195            /* Free remaining resources related to the image. */
     
    22612261 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container.
    22622262 * @param   pDisk           Pointer to HDD container.
    2263  * @param   uOffset         Offset of the first byte being 
     2263 * @param   uOffset         Offset of the first byte being
    22642264 *                          written from start of disk.
    22652265 * @param   pvBuf           Pointer to buffer for writing data.
     
    25472547                int rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData,
    25482548                                                              &pDisk->PCHSGeometry);
    2549                 if (VBOX_FAILURE(rc2))
     2549                if (RT_FAILURE(rc2))
    25502550                {
    25512551                    pDisk->PCHSGeometry.cCylinders = 0;
     
    25672567            rc = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData,
    25682568                                                     &PCHS);
    2569             if (    VBOX_FAILURE(rc)
     2569            if (    RT_FAILURE(rc)
    25702570                ||  pPCHSGeometry->cCylinders != PCHS.cCylinders
    25712571                ||  pPCHSGeometry->cHeads != PCHS.cHeads
     
    26932693                int rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData,
    26942694                                                              &pDisk->LCHSGeometry);
    2695                 if (VBOX_FAILURE(rc2))
     2695                if (RT_FAILURE(rc2))
    26962696                {
    26972697                    pDisk->LCHSGeometry.cCylinders = 0;
     
    27132713            rc = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData,
    27142714                                                     &LCHS);
    2715             if (    VBOX_FAILURE(rc)
     2715            if (    RT_FAILURE(rc)
    27162716                ||  pLCHSGeometry->cCylinders != LCHS.cCylinders
    27172717                ||  pLCHSGeometry->cHeads != LCHS.cHeads
     
    34153415 * @param   pvUser          User data which is passed on completion
    34163416 */
    3417 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 
     3417VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead,
    34183418                              PPDMDATASEG paSeg, unsigned cSeg,
    34193419                              void *pvUser)
     
    35223522
    35233523        vdSetModifiedFlag(pDisk);
    3524         rc = pImage->Backend->pfnAsyncWrite(pImage->pvBackendData, 
    3525                                             uOffset, cbWrite, 
     3524        rc = pImage->Backend->pfnAsyncWrite(pImage->pvBackendData,
     3525                                            uOffset, cbWrite,
    35263526                                            paSeg, cSeg, pvUser);
    35273527    } while (0);
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r8155 r11266  
    9696    PVDIDISK pData = PDMIMEDIA_2_VDIDISK(pInterface);
    9797    int rc = VDIDiskGetLCHSGeometry(pData, pLCHSGeometry);
    98     if (VBOX_SUCCESS(rc))
     98    if (RT_SUCCESS(rc))
    9999    {
    100100        LogFlow(("%s: returns VINF_SUCCESS\n", __FUNCTION__));
     
    130130    PVDIDISK pData = PDMIMEDIA_2_VDIDISK(pInterface);
    131131    int rc = VDIDiskRead(pData, off, pvBuf, cbRead);
    132     if (VBOX_SUCCESS(rc))
     132    if (RT_SUCCESS(rc))
    133133        Log2(("vdiRead: off=%#llx pvBuf=%p cbRead=%d\n"
    134134              "%.*Vhxd\n",
     
    335335     */
    336336    int rc = VINF_SUCCESS;
    337     while (pCurNode && VBOX_SUCCESS(rc))
     337    while (pCurNode && RT_SUCCESS(rc))
    338338    {
    339339        /*
     
    341341         */
    342342        int rc = CFGMR3QueryStringAlloc(pCurNode, "Path", &pszName);
    343         if (VBOX_FAILURE(rc))
     343        if (RT_FAILURE(rc))
    344344            return PDMDRV_SET_ERROR(pDrvIns, rc,
    345345                                    N_("VHDD: Configuration error: Querying \"Path\" as string failed"));
     
    348348        if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    349349            fReadOnly = false;
    350         else if (VBOX_FAILURE(rc))
     350        else if (RT_FAILURE(rc))
    351351        {
    352352            MMR3HeapFree(pszName);
     
    360360            if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    361361                fHonorZeroWrites = false;
    362             else if (VBOX_FAILURE(rc))
     362            else if (RT_FAILURE(rc))
    363363            {
    364364                MMR3HeapFree(pszName);
     
    373373        rc = VDIDiskOpenImage(pData, pszName, fReadOnly ? VDI_OPEN_FLAGS_READONLY
    374374                                                        : VDI_OPEN_FLAGS_NORMAL);
    375         if (VBOX_SUCCESS(rc))
     375        if (RT_SUCCESS(rc))
    376376            Log(("vdiConstruct: %d - Opened '%s' in %s mode\n",
    377377                 iLevel, pszName, VDIDiskIsReadOnly(pData) ? "read-only" : "read-write"));
     
    386386
    387387    /* If any of the images has the flag set, handle zero writes like normal. */
    388     if (VBOX_SUCCESS(rc))
     388    if (RT_SUCCESS(rc))
    389389        pData->fHonorZeroWrites = fHonorZeroWrites;
    390390
  • trunk/src/VBox/Devices/Storage/VDICore.cpp

    r8512 r11266  
    422422                        pszFilename,
    423423                        RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL | RTFILE_O_NOT_CONTENT_INDEXED);
    424     if (VBOX_SUCCESS(rc))
     424    if (RT_SUCCESS(rc))
    425425    {
    426426        /* Lock image exclusively to close any wrong access by VDI API calls. */
     
    434434            RTFOFF cbFree = 0;
    435435            rc = RTFsQuerySizes(pszFilename, NULL, &cbFree, NULL, NULL);
    436             if (VBOX_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbLock))
     436            if (RT_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbLock))
    437437            {
    438438                rc = VERR_DISK_FULL;
     
    444444        rc = RTFileLock(pImage->File,
    445445                        RTFILE_LOCK_WRITE | RTFILE_LOCK_IMMEDIATELY, 0, cbLock);
    446         if (VBOX_FAILURE(rc))
     446        if (RT_FAILURE(rc))
    447447        {
    448448            cbLock = 0;    /* Not locked. */
     
    463463            rc = RTFileSetSize(pImage->File, pImage->offStartData);
    464464        }
    465         if (VBOX_FAILURE(rc))
     465        if (RT_FAILURE(rc))
    466466            goto l_create_failed;
    467467
     
    471471        /* Write pre-header. */
    472472        rc = RTFileWrite(pImage->File, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL);
    473         if (VBOX_FAILURE(rc))
     473        if (RT_FAILURE(rc))
    474474            goto l_create_failed;
    475475
    476476        /* Write header. */
    477477        rc = RTFileWrite(pImage->File, &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL);
    478         if (VBOX_FAILURE(rc))
     478        if (RT_FAILURE(rc))
    479479            goto l_create_failed;
    480480
    481481        /* Write blocks array. */
    482482        rc = RTFileSeek(pImage->File, pImage->offStartBlocks, RTFILE_SEEK_BEGIN, NULL);
    483         if (VBOX_FAILURE(rc))
     483        if (RT_FAILURE(rc))
    484484            goto l_create_failed;
    485485        rc = RTFileWrite(pImage->File,
     
    487487                         getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER),
    488488                         NULL);
    489         if (VBOX_FAILURE(rc))
     489        if (RT_FAILURE(rc))
    490490            goto l_create_failed;
    491491
     
    500500
    501501            rc = RTFileSeek(pImage->File, pImage->offStartData, RTFILE_SEEK_BEGIN, NULL);
    502             if (VBOX_FAILURE(rc))
     502            if (RT_FAILURE(rc))
    503503                goto l_create_failed;
    504504
     
    517517
    518518                    rc = RTFileWrite(pImage->File, pvBuf, to_fill, NULL);
    519                     if (VBOX_FAILURE(rc))
     519                    if (RT_FAILURE(rc))
    520520                        break;
    521521
     
    527527                                         (unsigned)(((cbDisk - cbFill) * 100) / cbDisk),
    528528                                         pvUser);
    529                         if (VBOX_FAILURE(rc))
     529                        if (RT_FAILURE(rc))
    530530                            break;
    531531                    }
     
    549549
    550550        /* Delete image file if error occured while creating */
    551         if (VBOX_FAILURE(rc))
     551        if (RT_FAILURE(rc))
    552552            RTFileDelete(pszFilename);
    553553    }
     
    556556    RTMemFree(pImage);
    557557
    558     if (    VBOX_SUCCESS(rc)
     558    if (    RT_SUCCESS(rc)
    559559        &&  pfnProgress)
    560560        pfnProgress(NULL /* WARNING! pVM=NULL  */, 100, pvUser);
     
    603603                        ? RTFILE_O_READ      | RTFILE_O_OPEN | RTFILE_O_DENY_NONE
    604604                        : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
    605     if (VBOX_FAILURE(rc))
     605    if (RT_FAILURE(rc))
    606606    {
    607607        if (!(fOpen & VDI_OPEN_FLAGS_READONLY))
     
    611611                            pImage->szFilename,
    612612                            RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    613             if (VBOX_SUCCESS(rc))
     613            if (RT_SUCCESS(rc))
    614614                pImage->fOpen |= VDI_OPEN_FLAGS_READONLY;
    615615        }
    616         if (VBOX_FAILURE(rc))
     616        if (RT_FAILURE(rc))
    617617        {
    618618            RTMemFree(pImage);
     
    630630    uint64_t cbLock = _1M;
    631631    rc = RTFileLock(pImage->File, RTFILE_LOCK_READ | RTFILE_LOCK_IMMEDIATELY, 0, cbLock);
    632     if (VBOX_FAILURE(rc))
     632    if (RT_FAILURE(rc))
    633633    {
    634634        cbLock = 0;
     
    639639    /* Read pre-header. */
    640640    rc = RTFileRead(pImage->File, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL);
    641     if (VBOX_FAILURE(rc))
     641    if (RT_FAILURE(rc))
    642642        goto l_open_failed;
    643643    rc = vdiValidatePreHeader(&pImage->PreHeader);
    644     if (VBOX_FAILURE(rc))
     644    if (RT_FAILURE(rc))
    645645        goto l_open_failed;
    646646
     
    661661                     * supporting VDI 1.1 doesn't touch fields it doesn't know
    662662                     * about. And it accepts bigger headers. */
    663                     if (   VBOX_SUCCESS(rc)
     663                    if (   RT_SUCCESS(rc)
    664664                        && !pImage->fReadOnly
    665665                        && pImage->Header.u.v1.cbHeader < sizeof(pImage->Header.u.v1plus))
     
    672672                        pImage->Header.u.v1plus.LCHSGeometry.cbSector = VDI_GEOMETRY_SECTOR_SIZE;
    673673                    }
    674                     else if (   VBOX_SUCCESS(rc)
     674                    else if (   RT_SUCCESS(rc)
    675675                             && pImage->Header.u.v1.cbHeader >= sizeof(pImage->Header.u.v1plus))
    676676                    {
     
    688688            break;
    689689    }
    690     if (VBOX_FAILURE(rc))
     690    if (RT_FAILURE(rc))
    691691        goto l_open_failed;
    692692
    693693    rc = vdiValidateHeader(&pImage->Header);
    694     if (VBOX_FAILURE(rc))
     694    if (RT_FAILURE(rc))
    695695        goto l_open_failed;
    696696
     
    749749                    0,
    750750                    cbLock);
    751     if (    VBOX_FAILURE(rc)
     751    if (    RT_FAILURE(rc)
    752752        &&  !pImage->fReadOnly)
    753753    {
     
    755755        rc = RTFileLock(pImage->File,
    756756                        RTFILE_LOCK_READ | RTFILE_LOCK_IMMEDIATELY, 0, cbLock);
    757         if (VBOX_SUCCESS(rc))
     757        if (RT_SUCCESS(rc))
    758758            pImage->fReadOnly = true;
    759759    }
    760     if (VBOX_FAILURE(rc))
     760    if (RT_FAILURE(rc))
    761761    {
    762762        cbLock = 0;    /* Not locked. */
     
    775775    /* Read blocks array. */
    776776    rc = RTFileSeek(pImage->File, pImage->offStartBlocks, RTFILE_SEEK_BEGIN, NULL);
    777     if (VBOX_FAILURE(rc))
     777    if (RT_FAILURE(rc))
    778778        goto l_open_failed;
    779779    rc = RTFileRead(pImage->File, pImage->paBlocks,
    780780                    getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER), NULL);
    781     if (VBOX_FAILURE(rc))
     781    if (RT_FAILURE(rc))
    782782        goto l_open_failed;
    783783
     
    807807    /* Seek to header start. */
    808808    int rc = RTFileSeek(pImage->File, sizeof(VDIPREHEADER), RTFILE_SEEK_BEGIN, NULL);
    809     if (VBOX_SUCCESS(rc))
     809    if (RT_SUCCESS(rc))
    810810    {
    811811        switch (GET_MAJOR_HEADER_VERSION(&pImage->Header))
     
    844844    /* Update image header. */
    845845    int rc = vdiUpdateHeader(pImage);
    846     if (VBOX_SUCCESS(rc))
     846    if (RT_SUCCESS(rc))
    847847    {
    848848        /* write only one block pointer. */
     
    851851                        RTFILE_SEEK_BEGIN,
    852852                        NULL);
    853         if (VBOX_SUCCESS(rc))
     853        if (RT_SUCCESS(rc))
    854854            rc = RTFileWrite(pImage->File,
    855855                             &pImage->paBlocks[uBlock],
     
    869869    /* Update image header. */
    870870    int rc = vdiUpdateHeader(pImage);
    871     if (VBOX_SUCCESS(rc))
     871    if (RT_SUCCESS(rc))
    872872    {
    873873        /* write the block pointers array. */
    874874        rc = RTFileSeek(pImage->File, pImage->offStartBlocks, RTFILE_SEEK_BEGIN, NULL);
    875         if (VBOX_SUCCESS(rc))
     875        if (RT_SUCCESS(rc))
    876876            rc = RTFileWrite(pImage->File,
    877877                             pImage->paBlocks,
     
    998998                           + (pImage->offStartData + pImage->offStartBlockData + offRead);
    999999        int rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL);
    1000         if (VBOX_SUCCESS(rc))
     1000        if (RT_SUCCESS(rc))
    10011001            rc = RTFileRead(pImage->File, pvBuf, cbToRead, NULL);
    1002         if (VBOX_FAILURE(rc))
     1002        if (RT_FAILURE(rc))
    10031003            Log(("vdiReadInBlock: rc=%Vrc filename=\"%s\" uBlock=%u offRead=%u cbToRead=%u u64Offset=%llu\n",
    10041004                 rc, pImage->szFilename, uBlock, offRead, cbToRead, u64Offset));
     
    10761076        cbToRead -= to_read;
    10771077        if (    cbToRead == 0
    1078             ||  VBOX_FAILURE(rc))
     1078            ||  RT_FAILURE(rc))
    10791079            break;
    10801080
     
    11021102                       + (pImage->offStartData + pImage->offStartBlockData);
    11031103    rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL);
    1104     if (VBOX_FAILURE(rc))
     1104    if (RT_FAILURE(rc))
    11051105    {
    11061106        Log(("vdiFillBlockByZeroes: seek rc=%Vrc filename=\"%s\" uBlock=%u u64Offset=%llu\n",
     
    11211121        unsigned to_fill = RT_MIN(cbFill, pDisk ? pDisk->cbBuf : VDIDISK_DEFAULT_BUFFER_SIZE);
    11221122        rc = RTFileWrite(pImage->File, pvBuf, to_fill, NULL);
    1123         if (VBOX_FAILURE(rc))
     1123        if (RT_FAILURE(rc))
    11241124        {
    11251125            Log(("vdiFillBlockByZeroes: write rc=%Vrc filename=\"%s\" uBlock=%u u64Offset=%llu cbFill=%u to_fill=%u\n",
     
    11781178                         + pImage->offStartData;
    11791179        rc = RTFileSetSize(pImage->File, u64Size);
    1180         if (VBOX_FAILURE(rc))
     1180        if (RT_FAILURE(rc))
    11811181        {
    11821182            Log(("vdiWriteInBlock: set size rc=%Vrc filename=\"%s\" uBlock=%u u64Size=%llu\n",
     
    11971197            {
    11981198                rc = vdiFillBlockByZeroes(pDisk, pImage, uBlock);
    1199                 if (VBOX_FAILURE(rc))
     1199                if (RT_FAILURE(rc))
    12001200                    return rc;
    12011201            }
     
    12031203
    12041204        rc = vdiUpdateBlockInfo(pImage, uBlock);
    1205         if (VBOX_FAILURE(rc))
     1205        if (RT_FAILURE(rc))
    12061206            return rc;
    12071207    }
     
    12111211                       + (pImage->offStartData + pImage->offStartBlockData + offWrite);
    12121212    rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL);
    1213     if (VBOX_SUCCESS(rc))
     1213    if (RT_SUCCESS(rc))
    12141214    {
    12151215        rc = RTFileWrite(pImage->File, pvBuf, cbToWrite, NULL);
    1216         if (VBOX_FAILURE(rc))
     1216        if (RT_FAILURE(rc))
    12171217            Log(("vdiWriteInBlock: write rc=%Vrc filename=\"%s\" uBlock=%u offWrite=%u u64Offset=%llu cbToWrite=%u\n",
    12181218                 rc, pImage->szFilename, uBlock, offWrite, u64Offset, cbToWrite));
     
    12561256        unsigned to_copy = RT_MIN(cbCopy, pDisk->cbBuf);
    12571257        rc = vdiReadInBlock(pImage, uBlock, offCopy, to_copy, pvBuf);
    1258         if (VBOX_FAILURE(rc))
     1258        if (RT_FAILURE(rc))
    12591259            break;
    12601260
    12611261        rc = vdiWriteInBlock(pDisk, pDisk->pLast, uBlock, offCopy, to_copy, pvBuf);
    1262         if (VBOX_FAILURE(rc))
     1262        if (RT_FAILURE(rc))
    12631263            break;
    12641264
     
    13381338                /* One of parent image has a block data, copy it into last image. */
    13391339                rc = vdiCopyBlock(pDisk, pImage, uBlock);
    1340                 if (VBOX_FAILURE(rc))
     1340                if (RT_FAILURE(rc))
    13411341                    break;
    13421342                pImage = pDisk->pLast;
     
    13491349        cbToWrite -= to_write;
    13501350        if (    cbToWrite == 0
    1351             || VBOX_FAILURE(rc))
     1351            || RT_FAILURE(rc))
    13521352            break;
    13531353
     
    14261426
    14271427                        rc = vdiReadInBlock(pImageFrom, uBlock, offCommit, cbToCopy, pvBuf);
    1428                         if (VBOX_FAILURE(rc))
     1428                        if (RT_FAILURE(rc))
    14291429                            break;
    14301430
    14311431                        rc = vdiWriteInBlock(NULL, pImageTo, uBlock, offCommit, cbToCopy, pvBuf);
    1432                         if (VBOX_FAILURE(rc))
     1432                        if (RT_FAILURE(rc))
    14331433                            break;
    14341434
     
    14361436                        offCommit += cbToCopy;
    14371437                    }
    1438                     if (VBOX_FAILURE(rc))
     1438                    if (RT_FAILURE(rc))
    14391439                        break;
    14401440                }
     
    14871487
    14881488                        rc = vdiReadInBlock(pImageFrom, uBlock, offCommit, cbToCopy, pvBuf);
    1489                         if (VBOX_FAILURE(rc))
     1489                        if (RT_FAILURE(rc))
    14901490                            break;
    14911491
    14921492                        rc = vdiWriteInBlock(NULL, pImageTo, uBlock, offCommit, cbToCopy, pvBuf);
    1493                         if (VBOX_FAILURE(rc))
     1493                        if (RT_FAILURE(rc))
    14941494                            break;
    14951495
     
    14971497                        offCommit += cbToCopy;
    14981498                    }
    1499                     if (VBOX_FAILURE(rc))
     1499                    if (RT_FAILURE(rc))
    15001500                        break;
    15011501                }
     
    15881588
    15891589                    rc = vdiReadInBlock(pImage, uBlock, offCommit, cbToCopy, pvBuf);
    1590                     if (VBOX_FAILURE(rc))
     1590                    if (RT_FAILURE(rc))
    15911591                        break;
    15921592
    15931593                    rc = vdiWriteInBlock(pDisk, pDstImage, uBlock, offCommit, cbToCopy, pvBuf);
    1594                     if (VBOX_FAILURE(rc))
     1594                    if (RT_FAILURE(rc))
    15951595                        break;
    15961596
     
    15981598                    offCommit += cbToCopy;
    15991599                }
    1600                 if (VBOX_FAILURE(rc))
     1600                if (RT_FAILURE(rc))
    16011601                    break;
    16021602            }
     
    16381638        /* Truncate file. */
    16391639        int rc2 = RTFileSetSize(pImage->File, pImage->offStartData);
    1640         if (VBOX_FAILURE(rc2))
     1640        if (RT_FAILURE(rc2))
    16411641        {
    16421642            rc = rc2;
     
    16471647        /* Save header and blocks array. */
    16481648        rc2 = vdiUpdateBlocks(pImage);
    1649         if (VBOX_FAILURE(rc2))
     1649        if (RT_FAILURE(rc2))
    16501650        {
    16511651            rc = rc2;
     
    16951695    PVDIIMAGEDESC pImage;
    16961696    int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_READONLY, NULL);
    1697     if (VBOX_SUCCESS(rc))
     1697    if (RT_SUCCESS(rc))
    16981698    {
    16991699        Log(("VDICheckImage: filename=\"%s\" version=%08X type=%X cbDisk=%llu uuid={%Vuuid}\n",
     
    17141714                rc = VERR_BUFFER_OVERFLOW;
    17151715        }
    1716         if (VBOX_SUCCESS(rc))
     1716        if (RT_SUCCESS(rc))
    17171717        {
    17181718            if (puVersion)
     
    17671767    PVDIIMAGEDESC pImage;
    17681768    int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL);
    1769     if (VBOX_FAILURE(rc))
     1769    if (RT_FAILURE(rc))
    17701770    {
    17711771        Log(("VDISetImageComment: vdiOpenImage rc=%Vrc filename=\"%s\"!\n", rc, pszFilename));
     
    18661866    PVDIIMAGEDESC pParent;
    18671867    int rc = vdiOpenImage(&pParent, pszParent, VDI_OPEN_FLAGS_READONLY, NULL);
    1868     if (VBOX_SUCCESS(rc))
     1868    if (RT_SUCCESS(rc))
    18691869    {
    18701870        rc = vdiCreateImage(pszFilename, VDI_IMAGE_TYPE_DIFF, VDI_IMAGE_FLAGS_DEFAULT,
     
    18951895
    18961896    int rc = VDICheckImage(pszFilename, NULL, NULL, NULL, NULL, NULL, NULL, 0);
    1897     if (VBOX_SUCCESS(rc))
     1897    if (RT_SUCCESS(rc))
    18981898        rc = RTFileDelete(pszFilename);
    18991899
     
    19391939    PVDIIMAGEDESC pImage;
    19401940    int rc = vdiOpenImage(&pImage, pszSrcFilename, VDI_OPEN_FLAGS_READONLY, NULL);
    1941     if (VBOX_FAILURE(rc))
     1941    if (RT_FAILURE(rc))
    19421942    {
    19431943        Log(("VDICopyImage: src image \"%s\" open failed rc=%Vrc\n", pszSrcFilename, rc));
     
    19531953                    pszDstFilename,
    19541954                    RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL | RTFILE_O_NOT_CONTENT_INDEXED);
    1955     if (VBOX_SUCCESS(rc))
     1955    if (RT_SUCCESS(rc))
    19561956    {
    19571957#ifndef RT_OS_WINDOWS
    19581958        /* lock new image exclusively to close any wrong access by VDI API calls. */
    19591959        rc = RTFileLock(File, RTFILE_LOCK_WRITE | RTFILE_LOCK_IMMEDIATELY, 0, cbFile);
    1960         if (VBOX_SUCCESS(rc))
     1960        if (RT_SUCCESS(rc))
    19611961#endif
    19621962        {
    19631963            /* Set the size of a new file. */
    19641964            rc = RTFileSetSize(File, cbFile);
    1965             if (VBOX_SUCCESS(rc))
     1965            if (RT_SUCCESS(rc))
    19661966            {
    19671967                /* A dirty trick - use original image data to fill the new image. */
     
    19801980                /* Write the pre-header to new image. */
    19811981                rc = RTFileSeek(pImage->File, 0, RTFILE_SEEK_BEGIN, NULL);
    1982                 if (VBOX_SUCCESS(rc))
     1982                if (RT_SUCCESS(rc))
    19831983                    rc = RTFileWrite(pImage->File,
    19841984                                     &pImage->PreHeader,
     
    19871987
    19881988                /* Write the header and the blocks array to new image. */
    1989                 if (VBOX_SUCCESS(rc))
     1989                if (RT_SUCCESS(rc))
    19901990                    rc = vdiUpdateBlocks(pImage);
    19911991
     
    19941994
    19951995                /* Seek to the data start in both images. */
    1996                 if (VBOX_SUCCESS(rc))
     1996                if (RT_SUCCESS(rc))
    19971997                    rc = RTFileSeek(pImage->File,
    19981998                                    pImage->offStartData,
    19991999                                    RTFILE_SEEK_BEGIN,
    20002000                                    NULL);
    2001                 if (VBOX_SUCCESS(rc))
     2001                if (RT_SUCCESS(rc))
    20022002                    rc = RTFileSeek(File,
    20032003                                    pImage->offStartData,
     
    20052005                                    NULL);
    20062006
    2007                 if (VBOX_SUCCESS(rc))
     2007                if (RT_SUCCESS(rc))
    20082008                {
    20092009                    /* alloc tmp buffer */
     
    20222022                            /* Read. */
    20232023                            rc = RTFileRead(pImage->File, pvBuf, cbToCopy, NULL);
    2024                             if (VBOX_FAILURE(rc))
     2024                            if (RT_FAILURE(rc))
    20252025                                break;
    20262026
    20272027                            /* Write. */
    20282028                            rc = RTFileWrite(File, pvBuf, cbToCopy, NULL);
    2029                             if (VBOX_FAILURE(rc))
     2029                            if (RT_FAILURE(rc))
    20302030                                break;
    20312031
     
    20362036                                                 (c * 100) / cBlocks,
    20372037                                                 pvUser);
    2038                                 if (VBOX_FAILURE(rc))
     2038                                if (RT_FAILURE(rc))
    20392039                                    break;
    20402040                            }
     
    20562056        RTFileClose(File);
    20572057
    2058         if (VBOX_FAILURE(rc))
     2058        if (RT_FAILURE(rc))
    20592059            RTFileDelete(pszDstFilename);
    20602060
     
    20922092    PVDIIMAGEDESC pImage;
    20932093    int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL);
    2094     if (VBOX_FAILURE(rc))
     2094    if (RT_FAILURE(rc))
    20952095    {
    20962096        Log(("VDIShrinkImage: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename));
     
    21142114    uint64_t cbFile;
    21152115    rc = RTFileGetSize(pImage->File, &cbFile);
    2116     if (VBOX_FAILURE(rc))
     2116    if (RT_FAILURE(rc))
    21172117    {
    21182118        Log(("VDIShrinkImage: RTFileGetSize rc=%Vrc for file=\"%s\"\n", rc, pszFilename));
     
    21822182                                   + (pImage->offStartData + pImage->offStartBlockData);
    21832183                rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL);
    2184                 if (VBOX_FAILURE(rc))
     2184                if (RT_FAILURE(rc))
    21852185                {
    21862186                    Log(("VDIShrinkImage: seek rc=%Vrc filename=\"%s\" uBlock=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n",
     
    21892189                }
    21902190                rc = RTFileRead(pImage->File, pvBuf, cbBlock, NULL);
    2191                 if (VBOX_FAILURE(rc))
     2191                if (RT_FAILURE(rc))
    21922192                {
    21932193                    Log(("VDIShrinkImage: read rc=%Vrc filename=\"%s\" cbBlock=%u uBlock=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n",
     
    22072207                                  + (pImage->offStartData + pImage->offStartBlockData);
    22082208                        rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL);
    2209                         if (VBOX_FAILURE(rc))
     2209                        if (RT_FAILURE(rc))
    22102210                        {
    22112211                            Log(("VDIShrinkImage: seek(2) rc=%Vrc filename=\"%s\" uBlockWrite=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n",
     
    22142214                        }
    22152215                        rc = RTFileWrite(pImage->File, pvBuf, cbBlock, NULL);
    2216                         if (VBOX_FAILURE(rc))
     2216                        if (RT_FAILURE(rc))
    22172217                        {
    22182218                            Log(("VDIShrinkImage: write rc=%Vrc filename=\"%s\" cbBlock=%u uBlockWrite=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n",
     
    22472247        RTMemTmpFree(pvBuf);
    22482248
    2249         if (    VBOX_SUCCESS(rc)
     2249        if (    RT_SUCCESS(rc)
    22502250            &&  uBlockWrite < cBlocksAllocated2)
    22512251        {
     
    22562256            rc = RTFileSetSize(pImage->File,
    22572257                               pImage->offStartData + ((uint64_t)uBlockWrite << pImage->uShiftIndex2Offset));
    2258             if (VBOX_FAILURE(rc))
     2258            if (RT_FAILURE(rc))
    22592259                Log(("VDIShrinkImage: RTFileSetSize rc=%Vrc\n", rc));
    22602260        }
     
    22682268
    22692269    /* Save header and blocks array. */
    2270     if (VBOX_SUCCESS(rc))
     2270    if (RT_SUCCESS(rc))
    22712271    {
    22722272        setImageBlocksAllocated(&pImage->Header, cBlocksAllocated2);
     
    23102310    PVDIIMAGEDESC pImage;
    23112311    int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL);
    2312     if (VBOX_FAILURE(rc))
     2312    if (RT_FAILURE(rc))
    23132313    {
    23142314        Log(("VDIConvertImage: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename));
     
    23642364
    23652365    rc = RTFileGetSize(pImage->File, &cbFile);
    2366     if (VBOX_FAILURE(rc))
     2366    if (RT_FAILURE(rc))
    23672367        goto l_conversion_failed;
    23682368
     
    23782378    /* Expand file. */
    23792379    rc = RTFileSetSize(pImage->File, cbFile + off);
    2380     if (VBOX_FAILURE(rc))
     2380    if (RT_FAILURE(rc))
    23812381        goto l_conversion_failed;
    23822382
     
    24042404                /* Read. */
    24052405                rc = RTFileSeek(pImage->File, offFile, RTFILE_SEEK_BEGIN, NULL);
    2406                 if (VBOX_FAILURE(rc))
     2406                if (RT_FAILURE(rc))
    24072407                    break;
    24082408                rc = RTFileRead(pImage->File, pvBuf, cbToMove, NULL);
    2409                 if (VBOX_FAILURE(rc))
     2409                if (RT_FAILURE(rc))
    24102410                    break;
    24112411
    24122412                /* Write. */
    24132413                rc = RTFileSeek(pImage->File, offFile + off, RTFILE_SEEK_BEGIN, NULL);
    2414                 if (VBOX_FAILURE(rc))
     2414                if (RT_FAILURE(rc))
    24152415                    break;
    24162416                rc = RTFileWrite(pImage->File, pvBuf, cbToMove, NULL);
    2417                 if (VBOX_FAILURE(rc))
     2417                if (RT_FAILURE(rc))
    24182418                    break;
    24192419
     
    24382438
    24392439            /* Fill the beginning of file with zeroes to wipe out old headers etc. */
    2440             if (VBOX_SUCCESS(rc))
     2440            if (RT_SUCCESS(rc))
    24412441            {
    24422442                Assert(offFile + off <= VDIDISK_DEFAULT_BUFFER_SIZE);
    24432443                rc = RTFileSeek(pImage->File, 0, RTFILE_SEEK_BEGIN, NULL);
    2444                 if (VBOX_SUCCESS(rc))
     2444                if (RT_SUCCESS(rc))
    24452445                {
    24462446                    memset(pvBuf, 0, (unsigned)offFile + off);
     
    24542454            rc = VERR_NO_MEMORY;
    24552455
    2456         if (VBOX_FAILURE(rc))
     2456        if (RT_FAILURE(rc))
    24572457            goto l_conversion_failed;
    24582458    }
     
    24742474    /* Write pre-header. */
    24752475    rc = RTFileSeek(pImage->File, 0, RTFILE_SEEK_BEGIN, NULL);
    2476     if (VBOX_FAILURE(rc))
     2476    if (RT_FAILURE(rc))
    24772477        goto l_conversion_failed;
    24782478    rc = RTFileWrite(pImage->File, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL);
    2479     if (VBOX_FAILURE(rc))
     2479    if (RT_FAILURE(rc))
    24802480        goto l_conversion_failed;
    24812481
     
    25192519    PVDIIMAGEDESC pImage;
    25202520    int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL);
    2521     if (VBOX_FAILURE(rc))
     2521    if (RT_FAILURE(rc))
    25222522    {
    25232523        Log(("VDIGetImageUUIDs: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename));
     
    25952595    PVDIIMAGEDESC pImage;
    25962596    int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL);
    2597     if (VBOX_FAILURE(rc))
     2597    if (RT_FAILURE(rc))
    25982598    {
    25992599        Log(("VDISetImageUUIDs: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename));
     
    26792679    PVDIIMAGEDESC pImageFrom;
    26802680    int rc = vdiOpenImage(&pImageFrom, pszFilenameFrom, VDI_OPEN_FLAGS_READONLY, NULL);
    2681     if (VBOX_FAILURE(rc))
     2681    if (RT_FAILURE(rc))
    26822682    {
    26832683        Log(("VDIMergeImage: vdiOpenImage rc=%Vrc pstFilenameFrom=\"%s\"\n", rc, pszFilenameFrom));
     
    26872687    PVDIIMAGEDESC pImageTo;
    26882688    rc = vdiOpenImage(&pImageTo, pszFilenameTo, VDI_OPEN_FLAGS_NORMAL, NULL);
    2689     if (VBOX_FAILURE(rc))
     2689    if (RT_FAILURE(rc))
    26902690    {
    26912691        Log(("VDIMergeImage: vdiOpenImage rc=%Vrc pszFilenameTo=\"%s\"\n", rc, pszFilenameTo));
     
    33453345                              cbLock);
    33463346#endif
    3347     if (VBOX_SUCCESS(rc))
     3347    if (RT_SUCCESS(rc))
    33483348    {
    33493349        pImage->fReadOnly = fReadOnly;
     
    33883388    {
    33893389        rc = vdiChangeImageMode(pImage, false);
    3390         if (VBOX_SUCCESS(rc))
     3390        if (RT_SUCCESS(rc))
    33913391        {
    33923392            VDIFlushImage(pImage);
     
    34373437    PVDIIMAGEDESC pImage;
    34383438    int rc = vdiOpenImage(&pImage, pszFilename, fOpen, pDisk->pLast);
    3439     if (VBOX_SUCCESS(rc))
     3439    if (RT_SUCCESS(rc))
    34403440    {
    34413441        if (pDisk->pLast)
     
    34603460        }
    34613461
    3462         if (VBOX_SUCCESS(rc))
     3462        if (RT_SUCCESS(rc))
    34633463            vdiAddImageToList(pDisk, pImage);
    34643464        else
     
    35833583        /* Change previous image mode to r/w. */
    35843584        rc = vdiChangeImageMode(pImage->pPrev, false);
    3585         if (VBOX_FAILURE(rc))
     3585        if (RT_FAILURE(rc))
    35863586        {
    35873587            Log(("VDIDiskCommitLastDiff: can't switch previous image into r/w mode, rc=%Vrc\n", rc));
     
    35913591
    35923592    rc = vdiCommitToImage(pDisk, pImage->pPrev, pfnProgress, pvUser);
    3593     if (VBOX_SUCCESS(rc) && fWasReadOnly)
     3593    if (RT_SUCCESS(rc) && fWasReadOnly)
    35943594    {
    35953595        /* Change previous image mode back to r/o. */
     
    35973597    }
    35983598
    3599     if (VBOX_FAILURE(rc))
     3599    if (RT_FAILURE(rc))
    36003600    {
    36013601        /* Failed! Close all images, can't work with VHDD at all. */
     
    36453645                            pDisk->pLast,
    36463646                            pfnProgress, pvUser);
    3647     if (VBOX_SUCCESS(rc))
     3647    if (RT_SUCCESS(rc))
    36483648    {
    36493649        rc = VDIDiskOpenImage(pDisk, pszFilename, VDI_OPEN_FLAGS_NORMAL);
    3650         if (VBOX_FAILURE(rc))
     3650        if (RT_FAILURE(rc))
    36513651            VDIDeleteImage(pszFilename);
    36523652    }
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r11176 r11266  
    374374    rc = RTFileOpen(&File, pImage->pszFilename,
    375375                    RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL);
    376     if (VBOX_FAILURE(rc))
     376    if (RT_FAILURE(rc))
    377377    {
    378378        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: cannot create image '%s'"), pImage->pszFilename);
     
    390390        RTFOFF cbFree = 0;
    391391        rc = RTFsQuerySizes(pImage->pszFilename, NULL, &cbFree, NULL, NULL);
    392         if (VBOX_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbTotal))
     392        if (RT_SUCCESS(rc) /* ignore errors */ && ((uint64_t)cbFree < cbTotal))
    393393        {
    394394            rc = vdiError(pImage, VERR_DISK_FULL, RT_SRC_POS, N_("VDI: disk would overflow creating image '%s'"), pImage->pszFilename);
     
    410410        rc = RTFileSetSize(pImage->File, pImage->offStartData);
    411411    }
    412     if (VBOX_FAILURE(rc))
     412    if (RT_FAILURE(rc))
    413413    {
    414414        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: setting image size failed for '%s'"), pImage->pszFilename);
     
    421421    /* Write pre-header. */
    422422    rc = RTFileWriteAt(File, 0, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL);
    423     if (VBOX_FAILURE(rc))
     423    if (RT_FAILURE(rc))
    424424    {
    425425        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing pre-header failed for '%s'"), pImage->pszFilename);
     
    429429    /* Write header. */
    430430    rc = RTFileWriteAt(File, sizeof(pImage->PreHeader), &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL);
    431     if (VBOX_FAILURE(rc))
     431    if (RT_FAILURE(rc))
    432432    {
    433433        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing header failed for '%s'"), pImage->pszFilename);
     
    439439                       getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER),
    440440                       NULL);
    441     if (VBOX_FAILURE(rc))
     441    if (RT_FAILURE(rc))
    442442    {
    443443        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block pointers failed for '%s'"), pImage->pszFilename);
     
    472472            rc = RTFileWriteAt(File, pImage->offStartData + uOff,
    473473                               pvBuf, cbChunk, NULL);
    474             if (VBOX_FAILURE(rc))
     474            if (RT_FAILURE(rc))
    475475            {
    476476                rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block failed for '%s'"), pImage->pszFilename);
     
    485485                                 uPercentStart + uOff * uPercentSpan / cbFill,
    486486                                 pvUser);
    487                 if (VBOX_FAILURE(rc))
     487                if (RT_FAILURE(rc))
    488488                    goto out;
    489489            }
     
    493493
    494494out:
    495     if (VBOX_SUCCESS(rc) && pfnProgress)
     495    if (RT_SUCCESS(rc) && pfnProgress)
    496496        pfnProgress(NULL /* WARNING! pVM=NULL  */,
    497497                    uPercentStart + uPercentSpan, pvUser);
    498498
    499     if (VBOX_FAILURE(rc))
     499    if (RT_FAILURE(rc))
    500500        vdiFreeImage(pImage, rc != VERR_ALREADY_EXISTS);
    501501    return rc;
     
    522522                     ? RTFILE_O_READ      | RTFILE_O_OPEN | RTFILE_O_DENY_NONE
    523523                     : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    524     if (VBOX_FAILURE(rc))
     524    if (RT_FAILURE(rc))
    525525    {
    526526        /* Do NOT signal an appropriate error here, as the VD layer has the
     
    533533    rc = RTFileReadAt(File, 0, &pImage->PreHeader, sizeof(pImage->PreHeader),
    534534                      NULL);
    535     if (VBOX_FAILURE(rc))
     535    if (RT_FAILURE(rc))
    536536    {
    537537        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading pre-header in '%s'"), pImage->pszFilename);
     
    539539    }
    540540    rc = vdiValidatePreHeader(&pImage->PreHeader);
    541     if (VBOX_FAILURE(rc))
     541    if (RT_FAILURE(rc))
    542542    {
    543543        rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: invalid pre-header in '%s'"), pImage->pszFilename);
     
    553553                              &pImage->Header.u.v0, sizeof(pImage->Header.u.v0),
    554554                              NULL);
    555             if (VBOX_FAILURE(rc))
     555            if (RT_FAILURE(rc))
    556556            {
    557557                rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v0 header in '%s'"), pImage->pszFilename);
     
    563563                              &pImage->Header.u.v1, sizeof(pImage->Header.u.v1),
    564564                              NULL);
    565             if (VBOX_FAILURE(rc))
     565            if (RT_FAILURE(rc))
    566566            {
    567567                rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v1 header in '%s'"), pImage->pszFilename);
     
    586586                /* Read the actual VDI 1.1+ header completely. */
    587587                rc = RTFileReadAt(File, sizeof(pImage->PreHeader), &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL);
    588                 if (VBOX_FAILURE(rc))
     588                if (RT_FAILURE(rc))
    589589                {
    590590                    rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v1.1+ header in '%s'"), pImage->pszFilename);
     
    599599
    600600    rc = vdiValidateHeader(&pImage->Header);
    601     if (VBOX_FAILURE(rc))
     601    if (RT_FAILURE(rc))
    602602    {
    603603        rc = vdiError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
     
    622622
    623623out:
    624     if (VBOX_FAILURE(rc))
     624    if (RT_FAILURE(rc))
    625625        vdiFreeImage(pImage, false);
    626626    return rc;
     
    659659    /* Update image header. */
    660660    int rc = vdiUpdateHeader(pImage);
    661     if (VBOX_SUCCESS(rc))
     661    if (RT_SUCCESS(rc))
    662662    {
    663663        /* write only one block pointer. */
     
    787787
    788788    rc = vdiOpenImage(pImage, uOpenFlags);
    789     if (VBOX_SUCCESS(rc))
     789    if (RT_SUCCESS(rc))
    790790        *ppBackendData = pImage;
    791791
     
    845845                        pPCHSGeometry, pLCHSGeometry,
    846846                        pfnProgress, pvUser, uPercentStart, uPercentSpan);
    847     if (VBOX_SUCCESS(rc))
     847    if (RT_SUCCESS(rc))
    848848    {
    849849        /* So far the image is opened in read/write mode. Make sure the
     
    853853            vdiFreeImage(pImage, false);
    854854            rc = vdiOpenImage(pImage, uOpenFlags);
    855             if (VBOX_FAILURE(rc))
     855            if (RT_FAILURE(rc))
    856856                goto out;
    857857        }
     
    886886    /* Rename the file. */
    887887    rc = RTFileMove(pImage->pszFilename, pszFilename, 0);
    888     if (VBOX_FAILURE(rc))
    889     {   
     888    if (RT_FAILURE(rc))
     889    {
    890890        /* The move failed, try to reopen the original image. */
    891891        int rc2 = vdiOpenImage(pImage, pImage->uOpenFlags);
    892         if (VBOX_FAILURE(rc2))
     892        if (RT_FAILURE(rc2))
    893893            rc = rc2;
    894894
     
    901901    /* Open the new image. */
    902902    rc = vdiOpenImage(pImage, pImage->uOpenFlags);
    903     if (VBOX_FAILURE(rc))
     903    if (RT_FAILURE(rc))
    904904        goto out;
    905905
     
    970970    }
    971971
    972     if (VBOX_SUCCESS(rc))
     972    if (RT_SUCCESS(rc))
    973973        *pcbActuallyRead = cbToRead;
    974974
     
    10461046                               + (pImage->offStartData + pImage->offStartBlockData);
    10471047            rc = RTFileWriteAt(pImage->File, u64Offset, pvBuf, cbToWrite, NULL);
    1048             if (VBOX_FAILURE(rc))
     1048            if (RT_FAILURE(rc))
    10491049                goto out;
    10501050            pImage->paBlocks[uBlock] = cBlocksAllocated;
     
    10521052
    10531053            rc = vdiUpdateBlockInfo(pImage, uBlock);
    1054             if (VBOX_FAILURE(rc))
     1054            if (RT_FAILURE(rc))
    10551055                goto out;
    10561056
     
    11681168        {
    11691169            int rc = RTFileGetSize(pImage->File, &cbFile);
    1170             if (VBOX_SUCCESS(rc))
     1170            if (RT_SUCCESS(rc))
    11711171                cb += cbFile;
    11721172        }
  • 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
  • trunk/src/VBox/Devices/Storage/fdc.c

    r8155 r11266  
    13131313                rc = PDMDevHlpDMAReadMemory (fdctrl->pDevIns, nchan, tmpbuf,
    13141314                                             fdctrl->data_pos, len, &read);
    1315                 AssertMsg (VBOX_SUCCESS (rc), ("DMAReadMemory -> %Vrc\n", rc));
     1315                AssertMsg (RT_SUCCESS (rc), ("DMAReadMemory -> %Vrc\n", rc));
    13161316#else
    13171317                DMA_read_memory (nchan, tmpbuf, fdctrl->data_pos, len);
     
    25792579     */
    25802580    rc = PDMDevHlpDriverAttach (pDevIns, drv->iLUN, &drv->IBase, &drv->pDrvBase, descs[drv->iLUN]);
    2581     if (VBOX_SUCCESS (rc)) {
     2581    if (RT_SUCCESS (rc)) {
    25822582        drv->pDrvBlock = drv->pDrvBase->pfnQueryInterface (
    25832583            drv->pDrvBase,
     
    26872687    AssertMsg (rc != VERR_PDM_NO_ATTACHED_DRIVER,
    26882688               ("Configuration error: failed to configure drive %d, rc=%Vrc\n", rc));
    2689     if (VBOX_SUCCESS(rc)) {
     2689    if (RT_SUCCESS(rc)) {
    26902690        fd_revalidate (drv);
    26912691    }
     
    28992899     */
    29002900    rc = PDMDevHlpDriverAttach (pDevIns, PDM_STATUS_LUN, &fdctrl->IBaseStatus, &pBase, "Status Port");
    2901     if (VBOX_SUCCESS (rc)) {
     2901    if (RT_SUCCESS (rc)) {
    29022902        fdctrl->pLedsConnector =
    29032903            pBase->pfnQueryInterface (pBase, PDMINTERFACE_LED_CONNECTORS);
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