vbox的更動 11266 路徑 trunk/src/VBox/Devices/Storage
- 時間撮記:
- 2008-8-8 下午04:14:51 (16 年 以前)
- 位置:
- trunk/src/VBox/Devices/Storage
- 檔案:
-
- 修改 15 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r11184 r11266 299 299 LogBird(("ata: %x: signalling\n", pCtl->IOPortBase1)); 300 300 rc = PDMR3CritSectScheduleExitEvent(&pCtl->lock, pCtl->AsyncIOSem); 301 if ( VBOX_FAILURE(rc))301 if (RT_FAILURE(rc)) 302 302 { 303 303 LogBird(("ata: %x: schedule failed, rc=%Vrc\n", pCtl->IOPortBase1, rc)); … … 743 743 Assert(s->cbElementaryTransfer == 512); 744 744 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)) 746 746 { 747 747 PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); … … 867 867 Assert(s->cbElementaryTransfer == 512); 868 868 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)) 870 870 { 871 871 PATACONTROLLER pCtl = ATADEVSTATE_2_CONTROLLER(s); … … 1122 1122 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); 1123 1123 rc = ataReadSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors); 1124 if ( VBOX_SUCCESS(rc))1124 if (RT_SUCCESS(rc)) 1125 1125 { 1126 1126 ataSetSector(s, iLBA + cSectors); … … 1169 1169 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); 1170 1170 rc = ataWriteSectors(s, iLBA, s->CTX_SUFF(pbIOBuffer), cSectors); 1171 if ( VBOX_SUCCESS(rc))1171 if (RT_SUCCESS(rc)) 1172 1172 { 1173 1173 ataSetSector(s, iLBA + cSectors); … … 1276 1276 aModeSenseCmd[9] = 0; /* control */ 1277 1277 rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, aModeSenseCmd, PDMBLOCKTXDIR_FROM_DEVICE, aModeSenseResult, &cbTransfer, &uDummySense, 500); 1278 if ( VBOX_FAILURE(rc))1278 if (RT_FAILURE(rc)) 1279 1279 { 1280 1280 atapiCmdError(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_NONE); … … 1361 1361 /* data */ 1362 1362 rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)i * 2048, pbBuf, 2048); 1363 if ( VBOX_FAILURE(rc))1363 if (RT_FAILURE(rc)) 1364 1364 break; 1365 1365 pbBuf += 2048; … … 1379 1379 STAM_PROFILE_STOP(&pCtl->StatLockWait, a); 1380 1380 1381 if ( VBOX_SUCCESS(rc))1381 if (RT_SUCCESS(rc)) 1382 1382 { 1383 1383 s->Led.Actual.s.fReading = 0; … … 1539 1539 } 1540 1540 1541 if ( VBOX_SUCCESS(rc))1541 if (RT_SUCCESS(rc)) 1542 1542 { 1543 1543 if (s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) … … 2268 2268 break; 2269 2269 } 2270 if ( VBOX_SUCCESS(rc))2270 if (RT_SUCCESS(rc)) 2271 2271 atapiCmdOK(s); 2272 2272 else … … 3808 3808 { 3809 3809 rc = RTSemEventWait(pCtl->SuspendIOSem, RT_INDEFINITE_WAIT); 3810 if ( VBOX_FAILURE(rc) || pCtl->fShutdown)3810 if (RT_FAILURE(rc) || pCtl->fShutdown) 3811 3811 break; 3812 3812 … … 3820 3820 rc = RTSemEventWait(pCtl->AsyncIOSem, RT_INDEFINITE_WAIT); 3821 3821 LogBird(("ata: %x: waking up\n", pCtl->IOPortBase1)); 3822 if ( VBOX_FAILURE(rc) || pCtl->fShutdown)3822 if (RT_FAILURE(rc) || pCtl->fShutdown) 3823 3823 break; 3824 3824 … … 4970 4970 { 4971 4971 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)); 4973 4973 } 4974 4974 } … … 5103 5103 Assert(!pIf->pbIOBufferR3); 5104 5104 rc = MMHyperAlloc(pVM, pIf->cbIOBuffer, 1, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3); 5105 if ( VBOX_FAILURE(rc))5105 if (RT_FAILURE(rc)) 5106 5106 return VERR_NO_MEMORY; 5107 5107 pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3); … … 5196 5196 */ 5197 5197 rc = PDMDevHlpDriverAttach(pDevIns, pIf->iLUN, &pIf->IBase, &pIf->pDrvBase, NULL); 5198 if ( VBOX_SUCCESS(rc))5198 if (RT_SUCCESS(rc)) 5199 5199 rc = ataConfigLun(pDevIns, pIf); 5200 5200 else 5201 5201 AssertMsgFailed(("Failed to attach LUN#%d. rc=%Vrc\n", pIf->iLUN, rc)); 5202 5202 5203 if ( VBOX_FAILURE(rc))5203 if (RT_FAILURE(rc)) 5204 5204 { 5205 5205 pIf->pDrvBase = NULL; … … 5488 5488 5489 5489 rc = SSMR3GetU32(pSSMHandle, &u32); 5490 if ( VBOX_FAILURE(rc))5490 if (RT_FAILURE(rc)) 5491 5491 return rc; 5492 5492 if (u32 != ~0U) … … 5543 5543 5544 5544 rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true); 5545 if ( VBOX_FAILURE(rc))5545 if (RT_FAILURE(rc)) 5546 5546 return PDMDEV_SET_ERROR(pDevIns, rc, 5547 5547 N_("PIIX3 configuration error: failed to read GCEnabled as boolean")); … … 5549 5549 5550 5550 rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true); 5551 if ( VBOX_FAILURE(rc))5551 if (RT_FAILURE(rc)) 5552 5552 return PDMDEV_SET_ERROR(pDevIns, rc, 5553 5553 N_("PIIX3 configuration error: failed to read R0Enabled as boolean")); … … 5555 5555 5556 5556 rc = CFGMR3QueryU32Def(pCfgHandle, "IRQDelay", &DelayIRQMillies, 0); 5557 if ( VBOX_FAILURE(rc))5557 if (RT_FAILURE(rc)) 5558 5558 return PDMDEV_SET_ERROR(pDevIns, rc, 5559 5559 N_("PIIX3 configuration error: failed to read IRQDelay as integer")); … … 5562 5562 5563 5563 rc = CFGMR3QueryBoolDef(pCfgHandle, "PIIX4", &pData->fPIIX4, false); 5564 if ( VBOX_FAILURE(rc))5564 if (RT_FAILURE(rc)) 5565 5565 return PDMDEV_SET_ERROR(pDevIns, rc, 5566 5566 N_("PIIX3 configuration error: failed to read PIIX4 as boolean")); … … 5631 5631 */ 5632 5632 rc = PDMDevHlpPCIRegister(pDevIns, &pData->dev); 5633 if ( VBOX_FAILURE(rc))5633 if (RT_FAILURE(rc)) 5634 5634 return PDMDEV_SET_ERROR(pDevIns, rc, 5635 5635 N_("PIIX3 cannot register PCI device")); 5636 5636 AssertMsg(pData->dev.devfn == 9 || iInstance != 0, ("pData->dev.devfn=%d\n", pData->dev.devfn)); 5637 5637 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 4, 0x10, PCI_ADDRESS_SPACE_IO, ataBMDMAIORangeMap); 5638 if ( VBOX_FAILURE(rc))5638 if (RT_FAILURE(rc)) 5639 5639 return PDMDEV_SET_ERROR(pDevIns, rc, 5640 5640 N_("PIIX3 cannot register PCI I/O region for BMDMA")); … … 5648 5648 rc = PDMDevHlpIOPortRegister(pDevIns, pData->aCts[i].IOPortBase1, 8, (RTHCPTR)i, 5649 5649 ataIOPortWrite1, ataIOPortRead1, ataIOPortWriteStr1, ataIOPortReadStr1, "ATA I/O Base 1"); 5650 if ( VBOX_FAILURE(rc))5650 if (RT_FAILURE(rc)) 5651 5651 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register I/O handlers")); 5652 5652 … … 5655 5655 rc = PDMDevHlpIOPortRegisterGC(pDevIns, pData->aCts[i].IOPortBase1, 8, (RTGCPTR)i, 5656 5656 "ataIOPortWrite1", "ataIOPortRead1", "ataIOPortWriteStr1", "ataIOPortReadStr1", "ATA I/O Base 1"); 5657 if ( VBOX_FAILURE(rc))5657 if (RT_FAILURE(rc)) 5658 5658 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register I/O handlers (GC)")); 5659 5659 } … … 5668 5668 "ataIOPortWrite1", "ataIOPortRead1", "ataIOPortWriteStr1", "ataIOPortReadStr1", "ATA I/O Base 1"); 5669 5669 #endif 5670 if ( VBOX_FAILURE(rc))5670 if (RT_FAILURE(rc)) 5671 5671 return PDMDEV_SET_ERROR(pDevIns, rc, "PIIX3 cannot register I/O handlers (R0)."); 5672 5672 } … … 5674 5674 rc = PDMDevHlpIOPortRegister(pDevIns, pData->aCts[i].IOPortBase2, 1, (RTHCPTR)i, 5675 5675 ataIOPortWrite2, ataIOPortRead2, NULL, NULL, "ATA I/O Base 2"); 5676 if ( VBOX_FAILURE(rc))5676 if (RT_FAILURE(rc)) 5677 5677 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register base2 I/O handlers")); 5678 5678 … … 5681 5681 rc = PDMDevHlpIOPortRegisterGC(pDevIns, pData->aCts[i].IOPortBase2, 1, (RTGCPTR)i, 5682 5682 "ataIOPortWrite2", "ataIOPortRead2", NULL, NULL, "ATA I/O Base 2"); 5683 if ( VBOX_FAILURE(rc))5683 if (RT_FAILURE(rc)) 5684 5684 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register base2 I/O handlers (GC)")); 5685 5685 } … … 5688 5688 rc = PDMDevHlpIOPortRegisterR0(pDevIns, pData->aCts[i].IOPortBase2, 1, (RTR0PTR)i, 5689 5689 "ataIOPortWrite2", "ataIOPortRead2", NULL, NULL, "ATA I/O Base 2"); 5690 if ( VBOX_FAILURE(rc))5690 if (RT_FAILURE(rc)) 5691 5691 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register base2 I/O handlers (R0)")); 5692 5692 } … … 5728 5728 RTStrPrintf(szName, sizeof(szName), "ATA%d", i); 5729 5729 rc = PDMDevHlpCritSectInit(pDevIns, &pData->aCts[i].lock, szName); 5730 if ( VBOX_FAILURE(rc))5730 if (RT_FAILURE(rc)) 5731 5731 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot initialize critical section")); 5732 5732 } … … 5736 5736 */ 5737 5737 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pData->IBase, &pBase, "Status Port"); 5738 if ( VBOX_SUCCESS(rc))5738 if (RT_SUCCESS(rc)) 5739 5739 pData->pLedsConnector = (PDMILEDCONNECTORS *)pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS); 5740 5740 else if (rc != VERR_PDM_NO_ATTACHED_DRIVER) … … 5783 5783 5784 5784 rc = PDMDevHlpDriverAttach(pDevIns, pIf->iLUN, &pIf->IBase, &pIf->pDrvBase, s_apszDescs[i][j]); 5785 if ( VBOX_SUCCESS(rc))5785 if (RT_SUCCESS(rc)) 5786 5786 rc = ataConfigLun(pDevIns, pIf); 5787 5787 else if (rc == VERR_PDM_NO_ATTACHED_DRIVER) … … 5817 5817 ataSaveLoadPrep, ataSaveExec, NULL, 5818 5818 ataSaveLoadPrep, ataLoadExec, NULL); 5819 if ( VBOX_FAILURE(rc))5819 if (RT_FAILURE(rc)) 5820 5820 return PDMDEV_SET_ERROR(pDevIns, rc, N_("PIIX3 cannot register save state handlers")); 5821 5821 -
trunk/src/VBox/Devices/Storage/DrvBlock.cpp
r11187 r11266 343 343 int rc = pData->pDrvMedia->pfnBiosGetPCHSGeometry(pData->pDrvMedia, &pData->PCHSGeometry); 344 344 345 if ( VBOX_SUCCESS(rc))345 if (RT_SUCCESS(rc)) 346 346 { 347 347 *pPCHSGeometry = pData->PCHSGeometry; … … 377 377 int rc = pData->pDrvMedia->pfnBiosSetPCHSGeometry(pData->pDrvMedia, pPCHSGeometry); 378 378 379 if ( VBOX_SUCCESS(rc)379 if ( RT_SUCCESS(rc) 380 380 || rc == VERR_NOT_IMPLEMENTED) 381 381 { … … 415 415 int rc = pData->pDrvMedia->pfnBiosGetLCHSGeometry(pData->pDrvMedia, &pData->LCHSGeometry); 416 416 417 if ( VBOX_SUCCESS(rc))417 if (RT_SUCCESS(rc)) 418 418 { 419 419 *pLCHSGeometry = pData->LCHSGeometry; … … 449 449 int rc = pData->pDrvMedia->pfnBiosSetLCHSGeometry(pData->pDrvMedia, pLCHSGeometry); 450 450 451 if ( VBOX_SUCCESS(rc)451 if ( RT_SUCCESS(rc) 452 452 || rc == VERR_NOT_IMPLEMENTED) 453 453 { … … 505 505 { 506 506 int rc = pData->pDrvIns->pDrvHlp->pfnMountPrepare(pData->pDrvIns, pszFilename, pszCoreDriver); 507 if ( VBOX_FAILURE(rc))507 if (RT_FAILURE(rc)) 508 508 { 509 509 Log(("drvblockMount: Prepare failed for \"%s\" rc=%Vrc\n", pszFilename, rc)); … … 517 517 PPDMIBASE pBase; 518 518 int rc = pData->pDrvIns->pDrvHlp->pfnAttach(pData->pDrvIns, &pBase); 519 if ( VBOX_FAILURE(rc))519 if (RT_FAILURE(rc)) 520 520 { 521 521 Log(("drvblockMount: Attach failed rc=%Vrc\n", rc)); … … 588 588 */ 589 589 int rc = pData->pDrvIns->pDrvHlp->pfnDetach(pData->pDrvIns); 590 if ( VBOX_FAILURE(rc))590 if (RT_FAILURE(rc)) 591 591 { 592 592 Log(("drvblockUnmount: Detach failed rc=%Vrc\n", rc)); … … 772 772 char *psz; 773 773 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Type", &psz); 774 if ( VBOX_FAILURE(rc))774 if (RT_FAILURE(rc)) 775 775 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_BLOCK_NO_TYPE, N_("Failed to obtain the type")); 776 776 if (!strcmp(psz, "HardDisk")) … … 802 802 /* Mountable */ 803 803 rc = CFGMR3QueryBoolDef(pCfgHandle, "Mountable", &pData->fMountable, false); 804 if ( VBOX_FAILURE(rc))804 if (RT_FAILURE(rc)) 805 805 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Mountable\" from the config")); 806 806 807 807 /* Locked */ 808 808 rc = CFGMR3QueryBoolDef(pCfgHandle, "Locked", &pData->fLocked, false); 809 if ( VBOX_FAILURE(rc))809 if (RT_FAILURE(rc)) 810 810 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Locked\" from the config")); 811 811 812 812 /* BIOS visible */ 813 813 rc = CFGMR3QueryBoolDef(pCfgHandle, "BIOSVisible", &pData->fBiosVisible, true); 814 if ( VBOX_FAILURE(rc))814 if (RT_FAILURE(rc)) 815 815 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"BIOSVisible\" from the config")); 816 816 … … 819 819 /* Cylinders */ 820 820 rc = CFGMR3QueryU32Def(pCfgHandle, "Cylinders", &pData->LCHSGeometry.cCylinders, 0); 821 if ( VBOX_FAILURE(rc))821 if (RT_FAILURE(rc)) 822 822 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Cylinders\" from the config")); 823 823 824 824 /* Heads */ 825 825 rc = CFGMR3QueryU32Def(pCfgHandle, "Heads", &pData->LCHSGeometry.cHeads, 0); 826 if ( VBOX_FAILURE(rc))826 if (RT_FAILURE(rc)) 827 827 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Heads\" from the config")); 828 828 829 829 /* Sectors */ 830 830 rc = CFGMR3QueryU32Def(pCfgHandle, "Sectors", &pData->LCHSGeometry.cSectors, 0); 831 if ( VBOX_FAILURE(rc))831 if (RT_FAILURE(rc)) 832 832 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Sectors\" from the config")); 833 833 … … 836 836 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 837 837 RTUuidClear(&pData->Uuid); 838 else if ( VBOX_SUCCESS(rc))838 else if (RT_SUCCESS(rc)) 839 839 { 840 840 rc = RTUuidFromStr(&pData->Uuid, psz); 841 if ( VBOX_FAILURE(rc))841 if (RT_FAILURE(rc)) 842 842 { 843 843 PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, "%s", … … 853 853 #ifdef VBOX_PERIODIC_FLUSH 854 854 rc = CFGMR3QueryU32Def(pCfgHandle, "FlushInterval", &pData->cbFlushInterval, 0); 855 if ( VBOX_FAILURE(rc))855 if (RT_FAILURE(rc)) 856 856 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"FlushInterval\" from the config")); 857 857 #endif /* VBOX_PERIODIC_FLUSH */ … … 859 859 #ifdef VBOX_IGNORE_FLUSH 860 860 rc = CFGMR3QueryBoolDef(pCfgHandle, "IgnoreFlush", &pData->fIgnoreFlush, true); 861 if ( VBOX_FAILURE(rc))861 if (RT_FAILURE(rc)) 862 862 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"IgnoreFlush\" from the config")); 863 863 #endif /* VBOX_IGNORE_FLUSH */ … … 871 871 && pData->enmType != PDMBLOCKTYPE_HARD_DISK) 872 872 return VINF_SUCCESS; 873 if ( VBOX_FAILURE(rc))873 if (RT_FAILURE(rc)) 874 874 { 875 875 AssertLogRelMsgFailed(("Failed to attach driver below us! rc=%Vra\n", rc)); -
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r8579 r11266 166 166 */ 167 167 rc = RTFileSeek(pThis->FileDevice, off, RTFILE_SEEK_BEGIN, NULL); 168 if ( VBOX_SUCCESS(rc))168 if (RT_SUCCESS(rc)) 169 169 { 170 170 rc = RTFileRead(pThis->FileDevice, pvBuf, cbRead, NULL); 171 if ( VBOX_SUCCESS(rc))171 if (RT_SUCCESS(rc)) 172 172 { 173 173 Log2(("%s-%d: drvHostBaseRead: off=%#llx cbRead=%#x\n" … … 222 222 */ 223 223 rc = RTFileSeek(pThis->FileDevice, off, RTFILE_SEEK_BEGIN, NULL); 224 if ( VBOX_SUCCESS(rc))224 if (RT_SUCCESS(rc)) 225 225 { 226 226 rc = RTFileWrite(pThis->FileDevice, pvBuf, cbWrite, NULL); 227 if ( VBOX_FAILURE(rc))227 if (RT_FAILURE(rc)) 228 228 Log(("%s-%d: drvHostBaseWrite: RTFileWrite(%d, %p, %#x) -> %Vrc (off=%#llx '%s')\n", 229 229 pThis->pDrvIns->pDrvReg->szDriverName, pThis->pDrvIns->iInstance, pThis->FileDevice, … … 489 489 if (pThis->pfnDoLock) 490 490 rc = pThis->pfnDoLock(pThis, true); 491 if ( VBOX_SUCCESS(rc))491 if (RT_SUCCESS(rc)) 492 492 pThis->fLocked = true; 493 493 } … … 512 512 if (pThis->pfnDoLock) 513 513 rc = pThis->pfnDoLock(pThis, false); 514 if ( VBOX_SUCCESS(rc))514 if (RT_SUCCESS(rc)) 515 515 pThis->fLocked = false; 516 516 } … … 675 675 char szName[128]; 676 676 int rc = drvHostBaseGetBSDName(DVDService, &szName[0], 0); 677 if ( VBOX_SUCCESS(rc))677 if (RT_SUCCESS(rc)) 678 678 { 679 679 pThis->pDASession = DASessionCreate(kCFAllocatorDefault); … … 891 891 892 892 /* Obtain exclusive access to the device so we can send SCSI commands. */ 893 if ( VBOX_SUCCESS(rc))893 if (RT_SUCCESS(rc)) 894 894 rc = drvHostBaseObtainExclusiveAccess(pThis, DVDService); 895 895 896 896 /* Cleanup on failure. */ 897 if ( VBOX_FAILURE(rc))897 if (RT_FAILURE(rc)) 898 898 { 899 899 if (pThis->ppScsiTaskDI) … … 991 991 int rc = drvHostBaseOpen(pThis, &FileDevice, pThis->fReadOnlyConfig); 992 992 #endif 993 if ( VBOX_FAILURE(rc))993 if (RT_FAILURE(rc)) 994 994 { 995 995 if (!pThis->fReadOnlyConfig) … … 1002 1002 #endif 1003 1003 } 1004 if ( VBOX_FAILURE(rc))1004 if (RT_FAILURE(rc)) 1005 1005 { 1006 1006 LogFlow(("%s-%d: failed to open device '%s', rc=%Vrc\n", … … 1052 1052 }; 1053 1053 int rc = DRVHostBaseScsiCmd(pThis, abCmd, 6, PDMBLOCKTXDIR_FROM_DEVICE, &Buf, &cbBuf, NULL, 0, 0); 1054 if ( VBOX_SUCCESS(rc))1054 if (RT_SUCCESS(rc)) 1055 1055 { 1056 1056 Assert(cbBuf == sizeof(Buf)); … … 1244 1244 */ 1245 1245 int rc = drvHostBaseReopen(pThis); 1246 if ( VBOX_FAILURE(rc))1246 if (RT_FAILURE(rc)) 1247 1247 return rc; 1248 1248 … … 1252 1252 uint64_t cb; 1253 1253 rc = pThis->pfnGetMediaSize(pThis, &cb); 1254 if ( VBOX_FAILURE(rc))1254 if (RT_FAILURE(rc)) 1255 1255 { 1256 1256 LogFlow(("%s-%d: failed to figure media size of %s, rc=%Vrc\n", … … 1332 1332 int cRetries = 10; 1333 1333 int rc = DRVHostBaseMediaPresent(pThis); 1334 while ( VBOX_FAILURE(rc) && cRetries-- > 0)1334 while (RT_FAILURE(rc) && cRetries-- > 0) 1335 1335 { 1336 1336 RTThreadSleep(50); … … 1429 1429 1430 1430 int rc = pThis->pfnPoll(pThis); 1431 if ( VBOX_FAILURE(rc))1431 if (RT_FAILURE(rc)) 1432 1432 { 1433 1433 RTSemEventWait(pThis->EventPoller, 50); … … 1449 1449 */ 1450 1450 int rc = RTSemEventWait(pThis->EventPoller, pThis->cMilliesPoller); 1451 if ( VBOX_FAILURE(rc)1451 if ( RT_FAILURE(rc) 1452 1452 && rc != VERR_TIMEOUT) 1453 1453 { … … 1542 1542 { 1543 1543 int rc = pThis->pfnDoLock(pThis, false); 1544 if ( VBOX_SUCCESS(rc))1544 if (RT_SUCCESS(rc)) 1545 1545 pThis->fLocked = false; 1546 1546 } … … 1739 1739 /* Device */ 1740 1740 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pThis->pszDevice); 1741 if ( VBOX_FAILURE(rc))1741 if (RT_FAILURE(rc)) 1742 1742 { 1743 1743 AssertMsgFailed(("Configuration error: query for \"Path\" string returned %Vra.\n", rc)); … … 1748 1748 uint32_t u32; 1749 1749 rc = CFGMR3QueryU32(pCfgHandle, "Interval", &u32); 1750 if ( VBOX_SUCCESS(rc))1750 if (RT_SUCCESS(rc)) 1751 1751 pThis->cMilliesPoller = u32; 1752 1752 else if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1753 1753 pThis->cMilliesPoller = 1000; 1754 else if ( VBOX_FAILURE(rc))1754 else if (RT_FAILURE(rc)) 1755 1755 { 1756 1756 AssertMsgFailed(("Configuration error: Query \"Mountable\" resulted in %Vrc.\n", rc)); … … 1762 1762 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1763 1763 pThis->fReadOnlyConfig = enmType == PDMBLOCKTYPE_DVD || enmType == PDMBLOCKTYPE_CDROM ? true : false; 1764 else if ( VBOX_FAILURE(rc))1764 else if (RT_FAILURE(rc)) 1765 1765 { 1766 1766 AssertMsgFailed(("Configuration error: Query \"ReadOnly\" resulted in %Vrc.\n", rc)); … … 1772 1772 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1773 1773 pThis->fLocked = false; 1774 else if ( VBOX_FAILURE(rc))1774 else if (RT_FAILURE(rc)) 1775 1775 { 1776 1776 AssertMsgFailed(("Configuration error: Query \"Locked\" resulted in %Vrc.\n", rc)); … … 1782 1782 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1783 1783 pThis->fBiosVisible = true; 1784 else if ( VBOX_FAILURE(rc))1784 else if (RT_FAILURE(rc)) 1785 1785 { 1786 1786 AssertMsgFailed(("Configuration error: Query \"BIOSVisible\" resulted in %Vrc.\n", rc)); … … 1793 1793 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 1794 1794 RTUuidClear(&pThis->Uuid); 1795 else if ( VBOX_SUCCESS(rc))1795 else if (RT_SUCCESS(rc)) 1796 1796 { 1797 1797 rc = RTUuidFromStr(&pThis->Uuid, psz); 1798 if ( VBOX_FAILURE(rc))1798 if (RT_FAILURE(rc)) 1799 1799 { 1800 1800 AssertMsgFailed(("Configuration error: Uuid from string failed on \"%s\", rc=%Vrc.\n", psz, rc)); … … 1813 1813 bool fAttachFailError; 1814 1814 rc = CFGMR3QueryBool(pCfgHandle, "AttachFailError", &fAttachFailError); 1815 if ( VBOX_FAILURE(rc))1815 if (RT_FAILURE(rc)) 1816 1816 fAttachFailError = true; 1817 1817 pThis->fAttachFailError = fAttachFailError; … … 1884 1884 NULL, NULL, NULL, 1885 1885 NULL, NULL, drvHostBaseLoadDone); 1886 if ( VBOX_FAILURE(rc))1886 if (RT_FAILURE(rc)) 1887 1887 return rc; 1888 1888 … … 1930 1930 rc = drvHostBaseReopen(pThis); 1931 1931 #endif 1932 if ( VBOX_FAILURE(rc))1932 if (RT_FAILURE(rc)) 1933 1933 { 1934 1934 char *pszDevice = pThis->pszDevice; … … 1981 1981 } 1982 1982 #ifdef RT_OS_WINDOWS 1983 if ( VBOX_SUCCESS(src))1983 if (RT_SUCCESS(src)) 1984 1984 DRVHostBaseMediaPresent(pThis); 1985 1985 #endif … … 1992 1992 if (pThis->pfnDoLock) 1993 1993 rc = pThis->pfnDoLock(pThis, true); 1994 if ( VBOX_FAILURE(rc))1994 if (RT_FAILURE(rc)) 1995 1995 { 1996 1996 AssertMsgFailed(("Failed to lock the dvd drive. rc=%Vrc\n", rc)); … … 2000 2000 2001 2001 #ifndef RT_OS_WINDOWS 2002 if ( VBOX_SUCCESS(src))2002 if (RT_SUCCESS(src)) 2003 2003 { 2004 2004 /* … … 2006 2006 */ 2007 2007 rc = RTSemEventCreate(&pThis->EventPoller); 2008 if ( VBOX_FAILURE(rc))2008 if (RT_FAILURE(rc)) 2009 2009 return rc; 2010 2010 } … … 2015 2015 */ 2016 2016 rc = RTCritSectInit(&pThis->CritSect); 2017 if ( VBOX_FAILURE(rc))2017 if (RT_FAILURE(rc)) 2018 2018 return rc; 2019 2019 2020 if ( VBOX_SUCCESS(src))2020 if (RT_SUCCESS(src)) 2021 2021 { 2022 2022 /* … … 2025 2025 rc = RTThreadCreate(&pThis->ThreadPoller, drvHostBaseMediaThread, pThis, 0, 2026 2026 RTTHREADTYPE_INFREQUENT_POLLER, RTTHREADFLAGS_WAITABLE, "DVDMEDIA"); 2027 if ( VBOX_FAILURE(rc))2027 if (RT_FAILURE(rc)) 2028 2028 { 2029 2029 AssertMsgFailed(("Failed to create poller thread. rc=%Vrc\n", rc)); … … 2042 2042 } 2043 2043 2044 if ( VBOX_FAILURE(src))2044 if (RT_FAILURE(src)) 2045 2045 return src; 2046 2046 return rc; -
trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
r9330 r11266 162 162 if (FileDevice == NIL_RTFILE) /* obsolete crap */ 163 163 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)) 165 165 { 166 166 /* do ioctl */ … … 312 312 uint8_t abSense[32]; 313 313 int rc2 = DRVHostBaseScsiCmd(pThis, abCmd, 6, PDMBLOCKTXDIR_NONE, NULL, NULL, abSense, sizeof(abSense), 0); 314 if ( VBOX_SUCCESS(rc2))314 if (RT_SUCCESS(rc2)) 315 315 fMediaPresent = true; 316 316 else if ( rc2 == VERR_UNRESOLVED_ERROR … … 710 710 */ 711 711 int rc = DRVHostBaseInitData(pDrvIns, pCfgHandle, PDMBLOCKTYPE_DVD); 712 if ( VBOX_SUCCESS(rc))712 if (RT_SUCCESS(rc)) 713 713 { 714 714 /* … … 719 719 bool fPassthrough; 720 720 rc = CFGMR3QueryBool(pCfgHandle, "Passthrough", &fPassthrough); 721 if ( VBOX_SUCCESS(rc) && fPassthrough)721 if (RT_SUCCESS(rc) && fPassthrough) 722 722 { 723 723 pThis->IBlock.pfnSendCmd = drvHostDvdSendCmd; … … 726 726 # ifdef VBOX_WITH_SUID_WRAPPER /* Solaris setuid for Passthrough mode. */ 727 727 rc = solarisCheckUserAuth(); 728 if ( VBOX_FAILURE(rc))728 if (RT_FAILURE(rc)) 729 729 { 730 730 Log(("DVD: solarisCheckUserAuth failed. Permission denied!\n")); … … 752 752 rc = DRVHostBaseInitFinish(pThis); 753 753 } 754 if ( VBOX_FAILURE(rc))754 if (RT_FAILURE(rc)) 755 755 { 756 756 if (!pThis->fAttachFailError) -
trunk/src/VBox/Devices/Storage/DrvHostFloppy.cpp
r8155 r11266 124 124 DRVHostBaseMediaNotPresent(pThis); 125 125 rc = DRVHostBaseMediaPresent(pThis); 126 if ( VBOX_FAILURE(rc))126 if (RT_FAILURE(rc)) 127 127 { 128 128 pThisFloppy->fPrevDiskIn = fDiskIn; … … 162 162 */ 163 163 int rc = DRVHostBaseInitData(pDrvIns, pCfgHandle, PDMBLOCKTYPE_FLOPPY_1_44); 164 if ( VBOX_SUCCESS(rc))164 if (RT_SUCCESS(rc)) 165 165 { 166 166 /* … … 177 177 rc = DRVHostBaseInitFinish(&pThis->Base); 178 178 } 179 if ( VBOX_FAILURE(rc))179 if (RT_FAILURE(rc)) 180 180 { 181 181 if (!pThis->Base.fAttachFailError) -
trunk/src/VBox/Devices/Storage/DrvMediaISO.cpp
r11191 r11266 128 128 char *pszName; 129 129 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pszName); 130 if ( VBOX_FAILURE(rc))130 if (RT_FAILURE(rc)) 131 131 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Failed to query \"Path\" from the config")); 132 132 … … 136 136 rc = RTFileOpen(&pData->File, pszName, 137 137 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 138 if ( VBOX_SUCCESS(rc))138 if (RT_SUCCESS(rc)) 139 139 { 140 140 LogFlow(("drvMediaISOConstruct: ISO image '%s' opened successfully.\n", pszName)); … … 182 182 uint64_t cbFile; 183 183 int rc = RTFileGetSize(pData->File, &cbFile); 184 if ( VBOX_SUCCESS(rc))184 if (RT_SUCCESS(rc)) 185 185 { 186 186 LogFlow(("drvMediaISOGetSize: returns %lld (%s)\n", cbFile, pData->pszFilename)); … … 238 238 */ 239 239 int rc = RTFileSeek(pData->File, off, RTFILE_SEEK_BEGIN, NULL); 240 if ( VBOX_SUCCESS(rc))240 if (RT_SUCCESS(rc)) 241 241 { 242 242 rc = RTFileRead(pData->File, pvBuf, cbRead, NULL); 243 if ( VBOX_SUCCESS(rc))243 if (RT_SUCCESS(rc)) 244 244 { 245 245 Log2(("drvMediaISORead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n" -
trunk/src/VBox/Devices/Storage/DrvRawImage.cpp
r8155 r11266 131 131 char *pszName; 132 132 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "Path", &pszName); 133 if ( VBOX_FAILURE(rc))133 if (RT_FAILURE(rc)) 134 134 { 135 135 AssertMsgFailed(("Configuration error: query for \"Path\" string return %Vrc.\n", rc)); … … 142 142 rc = RTFileOpen(&pData->File, pszName, 143 143 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 144 if ( VBOX_SUCCESS(rc))144 if (RT_SUCCESS(rc)) 145 145 { 146 146 LogFlow(("drvRawImageConstruct: Raw image '%s' opened successfully.\n", pszName)); … … 152 152 rc = RTFileOpen(&pData->File, pszName, 153 153 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 154 if ( VBOX_SUCCESS(rc))154 if (RT_SUCCESS(rc)) 155 155 { 156 156 LogFlow(("drvRawImageConstruct: Raw image '%s' opened successfully.\n", pszName)); … … 200 200 uint64_t cbFile; 201 201 int rc = RTFileGetSize(pData->File, &cbFile); 202 if ( VBOX_SUCCESS(rc))202 if (RT_SUCCESS(rc)) 203 203 { 204 204 LogFlow(("drvRawImageGetSize: returns %lld (%s)\n", cbFile, pData->pszFilename)); … … 256 256 */ 257 257 int rc = RTFileSeek(pData->File, off, RTFILE_SEEK_BEGIN, NULL); 258 if ( VBOX_SUCCESS(rc))258 if (RT_SUCCESS(rc)) 259 259 { 260 260 rc = RTFileRead(pData->File, pvBuf, cbRead, NULL); 261 if ( VBOX_SUCCESS(rc))261 if (RT_SUCCESS(rc)) 262 262 { 263 263 Log2(("drvRawImageRead: off=%#llx pvBuf=%p cbRead=%#x (%s)\n" … … 290 290 */ 291 291 int rc = RTFileSeek(pData->File, off, RTFILE_SEEK_BEGIN, NULL); 292 if ( VBOX_SUCCESS(rc))292 if (RT_SUCCESS(rc)) 293 293 { 294 294 rc = RTFileWrite(pData->File, pvBuf, cbWrite, NULL); 295 if ( VBOX_SUCCESS(rc))295 if (RT_SUCCESS(rc)) 296 296 { 297 297 Log2(("drvRawImageWrite: off=%#llx pvBuf=%p cbWrite=%#x (%s)\n" -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r11047 r11266 146 146 } 147 147 148 static DECLCALLBACK(int) drvvdAsyncIORead(void *pvUser, void *pStorage, uint64_t uOffset, 148 static DECLCALLBACK(int) drvvdAsyncIORead(void *pvUser, void *pStorage, uint64_t uOffset, 149 149 size_t cbRead, void *pvBuf, size_t *pcbRead) 150 150 { … … 158 158 } 159 159 160 static DECLCALLBACK(int) drvvdAsyncIOWrite(void *pvUser, void *pStorage, uint64_t uOffset, 160 static DECLCALLBACK(int) drvvdAsyncIOWrite(void *pvUser, void *pStorage, uint64_t uOffset, 161 161 size_t cbWrite, const void *pvBuf, size_t *pcbWritten) 162 162 { … … 278 278 PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface); 279 279 int rc = VDRead(pData->pDisk, off, pvBuf, cbRead); 280 if ( VBOX_SUCCESS(rc))280 if (RT_SUCCESS(rc)) 281 281 Log2(("%s: off=%#llx pvBuf=%p cbRead=%d %.*Vhxd\n", __FUNCTION__, 282 282 off, pvBuf, cbRead, cbRead, pvBuf)); … … 337 337 PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface); 338 338 int rc = VDGetPCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pPCHSGeometry); 339 if ( VBOX_FAILURE(rc))339 if (RT_FAILURE(rc)) 340 340 { 341 341 Log(("%s: geometry not available.\n", __FUNCTION__)); … … 366 366 PVBOXDISK pData = PDMIMEDIA_2_VBOXDISK(pInterface); 367 367 int rc = VDGetLCHSGeometry(pData->pDisk, VD_LAST_IMAGE, pLCHSGeometry); 368 if ( VBOX_FAILURE(rc))368 if (RT_FAILURE(rc)) 369 369 { 370 370 Log(("%s: geometry not available.\n", __FUNCTION__)); … … 402 402 *******************************************************************************/ 403 403 404 static DECLCALLBACK(int) drvvdStartRead(PPDMIMEDIAASYNC pInterface, uint64_t uOffset, 404 static DECLCALLBACK(int) drvvdStartRead(PPDMIMEDIAASYNC pInterface, uint64_t uOffset, 405 405 PPDMDATASEG paSeg, unsigned cSeg, 406 406 size_t cbRead, void *pvUser) … … 435 435 PDRVVDASYNCTASK pDrvVDAsyncTask = (PDRVVDASYNCTASK)pvUser; 436 436 int rc = VINF_VDI_ASYNC_IO_FINISHED; 437 437 438 438 /* Having a completion callback for a task is not mandatory. */ 439 439 if (pDrvVDAsyncTask->pfnCompleted) … … 580 580 pData->pDrvMediaAsyncPort = (PPDMIMEDIAASYNCPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_MEDIA_ASYNC_PORT); 581 581 582 /* 582 /* 583 583 * Attach the async transport driver below of the device above us implements the 584 584 * async interface. … … 592 592 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 593 593 { 594 /* 594 /* 595 595 * Though the device supports async I/O the backend seems to not support it. 596 596 * Revert to non async I/O. … … 598 598 pData->pDrvMediaAsyncPort = NULL; 599 599 } 600 else if ( VBOX_FAILURE(rc))600 else if (RT_FAILURE(rc)) 601 601 { 602 602 AssertMsgFailed(("Failed to attach async transport driver below rc=%Vrc\n", rc)); … … 656 656 * Open the images. 657 657 */ 658 if ( VBOX_SUCCESS(rc))658 if (RT_SUCCESS(rc)) 659 659 { 660 660 /** @todo TEMP! later the iSCSI config callbacks won't be included here */ … … 664 664 665 665 unsigned cImages = iLevel; 666 while (pCurNode && VBOX_SUCCESS(rc))666 while (pCurNode && RT_SUCCESS(rc)) 667 667 { 668 668 /* … … 670 670 */ 671 671 rc = CFGMR3QueryStringAlloc(pCurNode, "Path", &pszName); 672 if ( VBOX_FAILURE(rc))672 if (RT_FAILURE(rc)) 673 673 { 674 674 rc = PDMDRV_SET_ERROR(pDrvIns, rc, … … 678 678 679 679 rc = CFGMR3QueryStringAlloc(pCfgHandle, "Format", &pszFormat); 680 if ( VBOX_FAILURE(rc))680 if (RT_FAILURE(rc)) 681 681 { 682 682 rc = PDMDRV_SET_ERROR(pDrvIns, rc, … … 690 690 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 691 691 fReadOnly = false; 692 else if ( VBOX_FAILURE(rc))692 else if (RT_FAILURE(rc)) 693 693 { 694 694 rc = PDMDRV_SET_ERROR(pDrvIns, rc, … … 700 700 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 701 701 fHonorZeroWrites = false; 702 else if ( VBOX_FAILURE(rc))702 else if (RT_FAILURE(rc)) 703 703 { 704 704 rc = PDMDRV_SET_ERROR(pDrvIns, rc, … … 742 742 } 743 743 744 if ( VBOX_SUCCESS(rc))744 if (RT_SUCCESS(rc)) 745 745 Log(("%s: %d - Opened '%s' in %s mode\n", __FUNCTION__, 746 746 iLevel, pszName, … … 763 763 } 764 764 765 if ( VBOX_FAILURE(rc))765 if (RT_FAILURE(rc)) 766 766 { 767 767 if (VALID_PTR(pData->pDisk)) … … 776 776 } 777 777 778 /* 778 /* 779 779 * Check for async I/O support. Every opened image has to support 780 780 * it. … … 790 790 if (vdBackendInfo.uBackendCaps & VD_CAP_ASYNC) 791 791 { 792 /* 792 /* 793 793 * Backend indicates support for at least some files. 794 794 * Check if current file is supported with async I/O) … … 797 797 AssertRC(rc); 798 798 799 /* 799 /* 800 800 * Check if current image is supported. 801 801 * If not we can stop checking because … … 895 895 PVBOXDISK pData = PDMINS2DATA(pDrvIns, PVBOXDISK); 896 896 897 /* 897 /* 898 898 * We must close the disk here to ensure that 899 899 * the backend closes all files before the -
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r11176 r11266 111 111 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 112 112 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 113 if ( VBOX_FAILURE(rc))113 if (RT_FAILURE(rc)) 114 114 { 115 115 /* Do NOT signal an appropriate error here, as the VD layer has the … … 120 120 121 121 rc = RTFileGetSize(pImage->File, &pImage->cbSize); 122 if ( VBOX_FAILURE(rc))122 if (RT_FAILURE(rc)) 123 123 goto out; 124 124 if (pImage->cbSize % 512) … … 130 130 131 131 out: 132 if ( VBOX_FAILURE(rc))132 if (RT_FAILURE(rc)) 133 133 rawFreeImage(pImage, false); 134 134 return rc; … … 167 167 rc = RTFileOpen(&File, pImage->pszFilename, 168 168 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL); 169 if ( VBOX_FAILURE(rc))169 if (RT_FAILURE(rc)) 170 170 { 171 171 rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: cannot create image '%s'"), pImage->pszFilename); … … 177 177 * sufficient space available. */ 178 178 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)) 180 180 { 181 181 rc = rawError(pImage, VERR_DISK_FULL, RT_SRC_POS, N_("Raw: disk would overflow creating image '%s'"), pImage->pszFilename); … … 186 186 * effective than expanding file by write operations. */ 187 187 rc = RTFileSetSize(File, cbSize); 188 if ( VBOX_FAILURE(rc))188 if (RT_FAILURE(rc)) 189 189 { 190 190 rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: setting image size failed for '%s'"), pImage->pszFilename); … … 210 210 211 211 rc = RTFileWriteAt(File, uOff, pvBuf, cbChunk, NULL); 212 if ( VBOX_FAILURE(rc))212 if (RT_FAILURE(rc)) 213 213 { 214 214 rc = rawError(pImage, rc, RT_SRC_POS, N_("Raw: writing block failed for '%s'"), pImage->pszFilename); … … 223 223 uPercentStart + uOff * uPercentSpan * 98 / (cbSize * 100), 224 224 pvUser); 225 if ( VBOX_FAILURE(rc))225 if (RT_FAILURE(rc)) 226 226 goto out; 227 227 } … … 229 229 RTMemTmpFree(pvBuf); 230 230 231 if ( VBOX_SUCCESS(rc) && pfnProgress)231 if (RT_SUCCESS(rc) && pfnProgress) 232 232 pfnProgress(NULL /* WARNING! pVM=NULL */, 233 233 uPercentStart + uPercentSpan * 98 / 100, pvUser); … … 239 239 240 240 out: 241 if ( VBOX_SUCCESS(rc) && pfnProgress)241 if (RT_SUCCESS(rc) && pfnProgress) 242 242 pfnProgress(NULL /* WARNING! pVM=NULL */, 243 243 uPercentStart + uPercentSpan, pvUser); 244 244 245 if ( VBOX_FAILURE(rc))245 if (RT_FAILURE(rc)) 246 246 rawFreeImage(pImage, rc != VERR_ALREADY_EXISTS); 247 247 return rc; … … 346 346 347 347 rc = rawOpenImage(pImage, uOpenFlags); 348 if ( VBOX_SUCCESS(rc))348 if (RT_SUCCESS(rc)) 349 349 *ppBackendData = pImage; 350 350 … … 404 404 pPCHSGeometry, pLCHSGeometry, 405 405 pfnProgress, pvUser, uPercentStart, uPercentSpan); 406 if ( VBOX_SUCCESS(rc))406 if (RT_SUCCESS(rc)) 407 407 { 408 408 /* So far the image is opened in read/write mode. Make sure the … … 412 412 rawFreeImage(pImage, false); 413 413 rc = rawOpenImage(pImage, uOpenFlags); 414 if ( VBOX_FAILURE(rc))414 if (RT_FAILURE(rc)) 415 415 goto out; 416 416 } … … 585 585 { 586 586 int rc = RTFileGetSize(pImage->File, &cbFile); 587 if ( VBOX_SUCCESS(rc))587 if (RT_SUCCESS(rc)) 588 588 cb += cbFile; 589 589 } -
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r11176 r11266 192 192 /* Try to load the plugin (RTldrLoad takes care of the suffix). */ 193 193 rc = RTLdrLoad(pszPluginName, &hPlugin); 194 if ( VBOX_SUCCESS(rc))194 if (RT_SUCCESS(rc)) 195 195 { 196 196 PFNVBOXHDDFORMATLOAD pfnHDDFormatLoad; … … 198 198 rc = RTLdrGetSymbol(hPlugin, VBOX_HDDFORMAT_LOAD_NAME, 199 199 (void**)&pfnHDDFormatLoad); 200 if ( VBOX_FAILURE(rc) || !pfnHDDFormatLoad)200 if (RT_FAILURE(rc) || !pfnHDDFormatLoad) 201 201 { 202 202 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)) 204 204 rc = VERR_SYMBOL_NOT_FOUND; 205 205 goto out; … … 209 209 PVBOXHDDBACKEND pBE; 210 210 rc = pfnHDDFormatLoad(&pBE); 211 if ( VBOX_FAILURE(rc))211 if (RT_FAILURE(rc)) 212 212 goto out; 213 213 /* Check if the sizes match. If not this plugin is too old. */ … … 230 230 231 231 out: 232 if ( VBOX_FAILURE(rc))232 if (RT_FAILURE(rc)) 233 233 { 234 234 if (hPlugin != NIL_RTLDRMOD) … … 344 344 uOffset += cbThisRead; 345 345 pvBuf = (char *)pvBuf + cbThisRead; 346 } while (cbRead != 0 && VBOX_SUCCESS(rc));346 } while (cbRead != 0 && RT_SUCCESS(rc)); 347 347 348 348 return rc; … … 407 407 rc = vdReadHelper(pDisk, pImage->pPrev, uOffset - cbPreRead, pvTmp, 408 408 cbPreRead); 409 if ( VBOX_FAILURE(rc))409 if (RT_FAILURE(rc)) 410 410 return rc; 411 411 } … … 444 444 (char *)pvTmp + cbPreRead + cbThisWrite + cbWriteCopy, 445 445 cbReadImage); 446 if ( VBOX_FAILURE(rc))446 if (RT_FAILURE(rc)) 447 447 return rc; 448 448 /* Zero out the remainder of this block. Will never be visible, as this … … 503 503 rc = vdReadHelper(pDisk, pImage->pPrev, uOffset - cbPreRead, pvTmp, 504 504 cbPreRead + cbThisWrite + cbPostRead - cbFill); 505 if ( VBOX_FAILURE(rc))505 if (RT_FAILURE(rc)) 506 506 return rc; 507 507 … … 595 595 } 596 596 RTMemTmpFree(pvTmp); 597 if ( VBOX_FAILURE(rc))597 if (RT_FAILURE(rc)) 598 598 break; 599 599 } … … 602 602 uOffset += cbThisWrite; 603 603 pvBuf = (char *)pvBuf + cbThisWrite; 604 } while (cbWrite != 0 && VBOX_SUCCESS(rc));604 } while (cbWrite != 0 && RT_SUCCESS(rc)); 605 605 606 606 return rc; … … 656 656 } 657 657 } 658 if ( VBOX_FAILURE(rc))658 if (RT_FAILURE(rc)) 659 659 break; 660 660 … … 662 662 char szPath[RTPATH_MAX]; 663 663 rc = RTPathSharedLibs(szPath, sizeof(szPath)); 664 if ( VBOX_FAILURE(rc))664 if (RT_FAILURE(rc)) 665 665 break; 666 666 … … 669 669 rc = RTStrAPrintf(&pszPluginFilter, "%s/%s*", szPath, 670 670 VBOX_HDDFORMAT_PLUGIN_PREFIX); 671 if ( VBOX_FAILURE(rc))671 if (RT_FAILURE(rc)) 672 672 { 673 673 rc = VERR_NO_MEMORY; … … 677 677 /* The plugins are in the same directory as the other shared libs. */ 678 678 rc = RTDirOpenFiltered(&pPluginDir, pszPluginFilter, RTDIRFILTER_WINNT); 679 if ( VBOX_FAILURE(rc))679 if (RT_FAILURE(rc)) 680 680 break; 681 681 … … 702 702 /* Retry. */ 703 703 rc = RTDirRead(pPluginDir, pPluginDirEntry, &cbPluginDirEntry); 704 if ( VBOX_FAILURE(rc))704 if (RT_FAILURE(rc)) 705 705 break; 706 706 } 707 else if ( VBOX_FAILURE(rc))707 else if (RT_FAILURE(rc)) 708 708 break; 709 709 … … 713 713 714 714 rc = RTLdrLoad(pPluginDirEntry->szName, &hPlugin); 715 if ( VBOX_SUCCESS(rc))715 if (RT_SUCCESS(rc)) 716 716 { 717 717 rc = RTLdrGetSymbol(hPlugin, VBOX_HDDFORMAT_LOAD_NAME, (void**)&pfnHDDFormatLoad); 718 if ( VBOX_FAILURE(rc) || !pfnHDDFormatLoad)718 if (RT_FAILURE(rc) || !pfnHDDFormatLoad) 719 719 { 720 720 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)) 722 722 rc = VERR_SYMBOL_NOT_FOUND; 723 723 } 724 724 725 if ( VBOX_SUCCESS(rc))725 if (RT_SUCCESS(rc)) 726 726 { 727 727 /* Get the function table. */ 728 728 rc = pfnHDDFormatLoad(&pBackend); 729 if ( VBOX_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND))729 if (RT_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND)) 730 730 { 731 731 char *pszName = RTStrDup(pBackend->pszBackendName); … … 885 885 { 886 886 rc = aBackends[i]->pfnCheckIfValid(pszFilename); 887 if ( VBOX_SUCCESS(rc))887 if (RT_SUCCESS(rc)) 888 888 { 889 889 fPluginFound = true; … … 906 906 char szPath[RTPATH_MAX]; 907 907 rc = RTPathSharedLibs(szPath, sizeof(szPath)); 908 if ( VBOX_FAILURE(rc))908 if (RT_FAILURE(rc)) 909 909 break; 910 910 … … 913 913 rc = RTStrAPrintf(&pszPluginFilter, "%s/%s*", szPath, 914 914 VBOX_HDDFORMAT_PLUGIN_PREFIX); 915 if ( VBOX_FAILURE(rc))915 if (RT_FAILURE(rc)) 916 916 { 917 917 rc = VERR_NO_MEMORY; … … 921 921 /* The plugins are in the same directory as the other shared libs. */ 922 922 rc = RTDirOpenFiltered(&pPluginDir, pszPluginFilter, RTDIRFILTER_WINNT); 923 if ( VBOX_FAILURE(rc))923 if (RT_FAILURE(rc)) 924 924 break; 925 925 … … 946 946 /* Retry. */ 947 947 rc = RTDirRead(pPluginDir, pPluginDirEntry, &cbPluginDirEntry); 948 if ( VBOX_FAILURE(rc))948 if (RT_FAILURE(rc)) 949 949 break; 950 950 } 951 else if ( VBOX_FAILURE(rc))951 else if (RT_FAILURE(rc)) 952 952 break; 953 953 … … 957 957 958 958 rc = RTLdrLoad(pPluginDirEntry->szName, &hPlugin); 959 if ( VBOX_SUCCESS(rc))959 if (RT_SUCCESS(rc)) 960 960 { 961 961 rc = RTLdrGetSymbol(hPlugin, VBOX_HDDFORMAT_LOAD_NAME, (void**)&pfnHDDFormatLoad); 962 if ( VBOX_FAILURE(rc) || !pfnHDDFormatLoad)962 if (RT_FAILURE(rc) || !pfnHDDFormatLoad) 963 963 { 964 964 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)) 966 966 rc = VERR_SYMBOL_NOT_FOUND; 967 967 } 968 968 969 if ( VBOX_SUCCESS(rc))969 if (RT_SUCCESS(rc)) 970 970 { 971 971 /* Get the function table. */ 972 972 rc = pfnHDDFormatLoad(&pBackend); 973 if ( VBOX_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND))973 if (RT_SUCCESS(rc) && pBackend->cbSize == sizeof(VBOXHDDBACKEND)) 974 974 { 975 975 976 976 /* Check if the plugin can handle this file. */ 977 977 rc = pBackend->pfnCheckIfValid(pszFilename); 978 if ( VBOX_SUCCESS(rc))978 if (RT_SUCCESS(rc)) 979 979 { 980 980 fPluginFound = true; … … 1080 1080 1081 1081 rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin); 1082 if ( VBOX_FAILURE(rc))1082 if (RT_FAILURE(rc)) 1083 1083 break; 1084 1084 if (!pImage->Backend) … … 1095 1095 &pImage->pvBackendData); 1096 1096 /* If the open in read-write mode failed, retry in read-only mode. */ 1097 if ( VBOX_FAILURE(rc))1097 if (RT_FAILURE(rc)) 1098 1098 { 1099 1099 if (!(uOpenFlags & VD_OPEN_FLAGS_READONLY) … … 1108 1108 pDisk->pInterfaces, 1109 1109 &pImage->pvBackendData); 1110 if ( VBOX_FAILURE(rc))1110 if (RT_FAILURE(rc)) 1111 1111 { 1112 1112 rc = vdError(pDisk, rc, RT_SRC_POS, … … 1124 1124 * diff images. Some image formats don't distinguish between normal 1125 1125 * and diff images, so this must be corrected here. */ 1126 if ( VBOX_FAILURE(rc))1126 if (RT_FAILURE(rc)) 1127 1127 enmImageType = VD_IMAGE_TYPE_INVALID; 1128 if ( VBOX_SUCCESS(rc)1128 if ( RT_SUCCESS(rc) 1129 1129 && !(uOpenFlags & VD_OPEN_FLAGS_INFO)) 1130 1130 { … … 1165 1165 rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData, 1166 1166 &pDisk->PCHSGeometry); 1167 if ( VBOX_FAILURE(rc2))1167 if (RT_FAILURE(rc2)) 1168 1168 { 1169 1169 pDisk->PCHSGeometry.cCylinders = 0; … … 1182 1182 rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData, 1183 1183 &pDisk->LCHSGeometry); 1184 if ( VBOX_FAILURE(rc2))1184 if (RT_FAILURE(rc2)) 1185 1185 { 1186 1186 pDisk->LCHSGeometry.cCylinders = 0; … … 1208 1208 } 1209 1209 1210 if ( VBOX_SUCCESS(rc))1210 if (RT_SUCCESS(rc)) 1211 1211 { 1212 1212 /* Image successfully opened, make it the last image. */ … … 1225 1225 } while (0); 1226 1226 1227 if ( VBOX_FAILURE(rc))1227 if (RT_FAILURE(rc)) 1228 1228 { 1229 1229 if (pImage) … … 1341 1341 1342 1342 rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin); 1343 if ( VBOX_FAILURE(rc))1343 if (RT_FAILURE(rc)) 1344 1344 break; 1345 1345 if (!pImage->Backend) … … 1359 1359 &pImage->pvBackendData); 1360 1360 1361 if ( VBOX_SUCCESS(rc))1361 if (RT_SUCCESS(rc)) 1362 1362 { 1363 1363 pImage->enmImageType = enmType; … … 1378 1378 rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData, 1379 1379 &pDisk->PCHSGeometry); 1380 if ( VBOX_FAILURE(rc2))1380 if (RT_FAILURE(rc2)) 1381 1381 { 1382 1382 pDisk->PCHSGeometry.cCylinders = 0; … … 1395 1395 rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData, 1396 1396 &pDisk->LCHSGeometry); 1397 if ( VBOX_FAILURE(rc2))1397 if (RT_FAILURE(rc2)) 1398 1398 { 1399 1399 pDisk->LCHSGeometry.cCylinders = 0; … … 1410 1410 } 1411 1411 1412 if ( VBOX_SUCCESS(rc))1412 if (RT_SUCCESS(rc)) 1413 1413 { 1414 1414 /* Image successfully opened, make it the last image. */ … … 1427 1427 } while (0); 1428 1428 1429 if ( VBOX_FAILURE(rc))1429 if (RT_FAILURE(rc)) 1430 1430 { 1431 1431 if (pImage) … … 1440 1440 } 1441 1441 1442 if ( VBOX_SUCCESS(rc) && pfnProgress)1442 if (RT_SUCCESS(rc) && pfnProgress) 1443 1443 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 1444 1444 … … 1512 1512 1513 1513 rc = vdFindBackend(pszBackend, &pImage->Backend, &pImage->hPlugin); 1514 if ( VBOX_FAILURE(rc))1514 if (RT_FAILURE(rc)) 1515 1515 break; 1516 1516 if (!pImage->Backend) … … 1532 1532 &pImage->pvBackendData); 1533 1533 1534 if ( VBOX_SUCCESS(rc) && pDisk->cImages != 0)1534 if (RT_SUCCESS(rc) && pDisk->cImages != 0) 1535 1535 { 1536 1536 pImage->enmImageType = VD_IMAGE_TYPE_DIFF; … … 1546 1546 } 1547 1547 1548 if ( VBOX_SUCCESS(rc))1548 if (RT_SUCCESS(rc)) 1549 1549 { 1550 1550 RTUUID Uuid; … … 1554 1554 rc2 = pDisk->pLast->Backend->pfnGetUuid(pDisk->pLast->pvBackendData, 1555 1555 &Uuid); 1556 if ( VBOX_SUCCESS(rc2))1556 if (RT_SUCCESS(rc2)) 1557 1557 pImage->Backend->pfnSetParentUuid(pImage->pvBackendData, &Uuid); 1558 1558 rc2 = pDisk->pLast->Backend->pfnGetModificationUuid(pDisk->pLast->pvBackendData, 1559 1559 &Uuid); 1560 if ( VBOX_SUCCESS(rc2))1560 if (RT_SUCCESS(rc2)) 1561 1561 pImage->Backend->pfnSetParentModificationUuid(pImage->pvBackendData, 1562 1562 &Uuid); 1563 1563 rc2 = pDisk->pLast->Backend->pfnGetTimeStamp(pDisk->pLast->pvBackendData, 1564 1564 &ts); 1565 if ( VBOX_SUCCESS(rc2))1565 if (RT_SUCCESS(rc2)) 1566 1566 pImage->Backend->pfnSetParentTimeStamp(pImage->pvBackendData, &ts); 1567 1567 … … 1569 1569 } 1570 1570 1571 if ( VBOX_SUCCESS(rc))1571 if (RT_SUCCESS(rc)) 1572 1572 { 1573 1573 /** @todo optionally check UUIDs */ 1574 1574 } 1575 1575 1576 if ( VBOX_SUCCESS(rc))1576 if (RT_SUCCESS(rc)) 1577 1577 { 1578 1578 /* Image successfully opened, make it the last image. */ … … 1591 1591 } while (0); 1592 1592 1593 if ( VBOX_FAILURE(rc))1593 if (RT_FAILURE(rc)) 1594 1594 { 1595 1595 if (pImage->hPlugin != NIL_RTLDRMOD) … … 1604 1604 } 1605 1605 1606 if ( VBOX_SUCCESS(rc) && pfnProgress)1606 if (RT_SUCCESS(rc) && pfnProgress) 1607 1607 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 1608 1608 … … 1656 1656 rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pvBackendData, 1657 1657 uOpenFlags); 1658 if ( VBOX_FAILURE(rc))1658 if (RT_FAILURE(rc)) 1659 1659 break; 1660 1660 } … … 1708 1708 if (rc != VERR_VDI_BLOCK_FREE) 1709 1709 { 1710 if ( VBOX_FAILURE(rc))1710 if (RT_FAILURE(rc)) 1711 1711 break; 1712 1712 rc = vdWriteHelper(pDisk, pImageTo, uOffset, pvBuf, 1713 1713 cbThisRead); 1714 if ( VBOX_FAILURE(rc))1714 if (RT_FAILURE(rc)) 1715 1715 break; 1716 1716 } … … 1718 1718 rc = VINF_SUCCESS; 1719 1719 } 1720 else if ( VBOX_FAILURE(rc))1720 else if (RT_FAILURE(rc)) 1721 1721 break; 1722 1722 … … 1751 1751 if (rc != VERR_VDI_BLOCK_FREE) 1752 1752 { 1753 if ( VBOX_FAILURE(rc))1753 if (RT_FAILURE(rc)) 1754 1754 break; 1755 1755 rc = vdWriteHelper(pDisk, pImageTo, uOffset, pvBuf, 1756 1756 cbThisRead); 1757 if ( VBOX_FAILURE(rc))1757 if (RT_FAILURE(rc)) 1758 1758 break; 1759 1759 } … … 1802 1802 rc = pImageTo->Backend->pfnSetOpenFlags(pImageTo->pvBackendData, 1803 1803 uOpenFlags); 1804 if ( VBOX_FAILURE(rc))1804 if (RT_FAILURE(rc)) 1805 1805 break; 1806 1806 } … … 1823 1823 RTMemTmpFree(pvBuf); 1824 1824 1825 if ( VBOX_SUCCESS(rc) && pfnProgress)1825 if (RT_SUCCESS(rc) && pfnProgress) 1826 1826 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 1827 1827 … … 1893 1893 /* Close the source image. */ 1894 1894 rc = pImageFrom->Backend->pfnClose(pImageFrom->pvBackendData, false); 1895 if ( VBOX_FAILURE(rc))1895 if (RT_FAILURE(rc)) 1896 1896 break; 1897 1897 1898 1898 /* Open the source image in the destination container. */ 1899 1899 rc = VDOpen(pDiskTo, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags); 1900 if ( VBOX_FAILURE(rc))1900 if (RT_FAILURE(rc)) 1901 1901 goto movefail; 1902 1902 … … 1905 1905 /* Rename the image. */ 1906 1906 rc = pImageTo->Backend->pfnRename(pImageTo->pvBackendData, pszFilename ? pszFilename : pImageTo->pszFilename); 1907 if ( VBOX_FAILURE(rc))1907 if (RT_FAILURE(rc)) 1908 1908 goto movefail; 1909 1909 … … 1924 1924 /* In case of failure, re-open the source image in the source container. */ 1925 1925 rc2 = VDOpen(pDiskFrom, pImageFrom->Backend->pszBackendName, pImageFrom->pszFilename, pImageFrom->uOpenFlags); 1926 if ( VBOX_FAILURE(rc2))1926 if (RT_FAILURE(rc2)) 1927 1927 /** @todo Uncertain what to do on error. If this happens pImageFrom and pImageTo are both closed. */ 1928 1928 rc = rc2; … … 1974 1974 uOpenFlagsFrom, NULL, NULL); 1975 1975 } 1976 if ( VBOX_FAILURE(rc))1976 if (RT_FAILURE(rc)) 1977 1977 break; 1978 1978 … … 1998 1998 rc = vdReadHelper(pDiskFrom, pImageFrom, uOffset, pvBuf, 1999 1999 cbThisRead); 2000 if ( VBOX_FAILURE(rc))2000 if (RT_FAILURE(rc)) 2001 2001 break; 2002 2002 2003 2003 rc = vdWriteHelper(pDiskTo, pImageTo, uOffset, pvBuf, 2004 2004 cbThisRead); 2005 if ( VBOX_FAILURE(rc))2005 if (RT_FAILURE(rc)) 2006 2006 break; 2007 2007 … … 2013 2013 ((cbSize - cbRemaining) * 100) / cbSize, 2014 2014 pvUser); 2015 if ( VBOX_FAILURE(rc))2015 if (RT_FAILURE(rc)) 2016 2016 break; 2017 2017 } … … 2040 2040 } while (0); 2041 2041 2042 if ( VBOX_FAILURE(rc) && pImageTo)2042 if (RT_FAILURE(rc) && pImageTo) 2043 2043 { 2044 2044 /* Error detected, but new image created. Remove image from list. */ … … 2063 2063 RTMemTmpFree(pvBuf); 2064 2064 2065 if ( VBOX_SUCCESS(rc) && pfnProgress)2065 if (RT_SUCCESS(rc) && pfnProgress) 2066 2066 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); 2067 2067 … … 2130 2130 rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData, 2131 2131 &pDisk->PCHSGeometry); 2132 if ( VBOX_FAILURE(rc2))2132 if (RT_FAILURE(rc2)) 2133 2133 { 2134 2134 pDisk->PCHSGeometry.cCylinders = 0; … … 2147 2147 rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData, 2148 2148 &pDisk->LCHSGeometry); 2149 if ( VBOX_FAILURE(rc2))2149 if (RT_FAILURE(rc2)) 2150 2150 { 2151 2151 pDisk->LCHSGeometry.cCylinders = 0; … … 2191 2191 /* Close image. */ 2192 2192 int rc2 = pImage->Backend->pfnClose(pImage->pvBackendData, false); 2193 if ( VBOX_FAILURE(rc2) && VBOX_SUCCESS(rc))2193 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) 2194 2194 rc = rc2; 2195 2195 /* Free remaining resources related to the image. */ … … 2261 2261 * @returns VERR_VDI_NOT_OPENED if no image is opened in HDD container. 2262 2262 * @param pDisk Pointer to HDD container. 2263 * @param uOffset Offset of the first byte being 2263 * @param uOffset Offset of the first byte being 2264 2264 * written from start of disk. 2265 2265 * @param pvBuf Pointer to buffer for writing data. … … 2547 2547 int rc2 = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData, 2548 2548 &pDisk->PCHSGeometry); 2549 if ( VBOX_FAILURE(rc2))2549 if (RT_FAILURE(rc2)) 2550 2550 { 2551 2551 pDisk->PCHSGeometry.cCylinders = 0; … … 2567 2567 rc = pImage->Backend->pfnGetPCHSGeometry(pImage->pvBackendData, 2568 2568 &PCHS); 2569 if ( VBOX_FAILURE(rc)2569 if ( RT_FAILURE(rc) 2570 2570 || pPCHSGeometry->cCylinders != PCHS.cCylinders 2571 2571 || pPCHSGeometry->cHeads != PCHS.cHeads … … 2693 2693 int rc2 = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData, 2694 2694 &pDisk->LCHSGeometry); 2695 if ( VBOX_FAILURE(rc2))2695 if (RT_FAILURE(rc2)) 2696 2696 { 2697 2697 pDisk->LCHSGeometry.cCylinders = 0; … … 2713 2713 rc = pImage->Backend->pfnGetLCHSGeometry(pImage->pvBackendData, 2714 2714 &LCHS); 2715 if ( VBOX_FAILURE(rc)2715 if ( RT_FAILURE(rc) 2716 2716 || pLCHSGeometry->cCylinders != LCHS.cCylinders 2717 2717 || pLCHSGeometry->cHeads != LCHS.cHeads … … 3415 3415 * @param pvUser User data which is passed on completion 3416 3416 */ 3417 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 3417 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 3418 3418 PPDMDATASEG paSeg, unsigned cSeg, 3419 3419 void *pvUser) … … 3522 3522 3523 3523 vdSetModifiedFlag(pDisk); 3524 rc = pImage->Backend->pfnAsyncWrite(pImage->pvBackendData, 3525 uOffset, cbWrite, 3524 rc = pImage->Backend->pfnAsyncWrite(pImage->pvBackendData, 3525 uOffset, cbWrite, 3526 3526 paSeg, cSeg, pvUser); 3527 3527 } while (0); -
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r8155 r11266 96 96 PVDIDISK pData = PDMIMEDIA_2_VDIDISK(pInterface); 97 97 int rc = VDIDiskGetLCHSGeometry(pData, pLCHSGeometry); 98 if ( VBOX_SUCCESS(rc))98 if (RT_SUCCESS(rc)) 99 99 { 100 100 LogFlow(("%s: returns VINF_SUCCESS\n", __FUNCTION__)); … … 130 130 PVDIDISK pData = PDMIMEDIA_2_VDIDISK(pInterface); 131 131 int rc = VDIDiskRead(pData, off, pvBuf, cbRead); 132 if ( VBOX_SUCCESS(rc))132 if (RT_SUCCESS(rc)) 133 133 Log2(("vdiRead: off=%#llx pvBuf=%p cbRead=%d\n" 134 134 "%.*Vhxd\n", … … 335 335 */ 336 336 int rc = VINF_SUCCESS; 337 while (pCurNode && VBOX_SUCCESS(rc))337 while (pCurNode && RT_SUCCESS(rc)) 338 338 { 339 339 /* … … 341 341 */ 342 342 int rc = CFGMR3QueryStringAlloc(pCurNode, "Path", &pszName); 343 if ( VBOX_FAILURE(rc))343 if (RT_FAILURE(rc)) 344 344 return PDMDRV_SET_ERROR(pDrvIns, rc, 345 345 N_("VHDD: Configuration error: Querying \"Path\" as string failed")); … … 348 348 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 349 349 fReadOnly = false; 350 else if ( VBOX_FAILURE(rc))350 else if (RT_FAILURE(rc)) 351 351 { 352 352 MMR3HeapFree(pszName); … … 360 360 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 361 361 fHonorZeroWrites = false; 362 else if ( VBOX_FAILURE(rc))362 else if (RT_FAILURE(rc)) 363 363 { 364 364 MMR3HeapFree(pszName); … … 373 373 rc = VDIDiskOpenImage(pData, pszName, fReadOnly ? VDI_OPEN_FLAGS_READONLY 374 374 : VDI_OPEN_FLAGS_NORMAL); 375 if ( VBOX_SUCCESS(rc))375 if (RT_SUCCESS(rc)) 376 376 Log(("vdiConstruct: %d - Opened '%s' in %s mode\n", 377 377 iLevel, pszName, VDIDiskIsReadOnly(pData) ? "read-only" : "read-write")); … … 386 386 387 387 /* If any of the images has the flag set, handle zero writes like normal. */ 388 if ( VBOX_SUCCESS(rc))388 if (RT_SUCCESS(rc)) 389 389 pData->fHonorZeroWrites = fHonorZeroWrites; 390 390 -
trunk/src/VBox/Devices/Storage/VDICore.cpp
r8512 r11266 422 422 pszFilename, 423 423 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)) 425 425 { 426 426 /* Lock image exclusively to close any wrong access by VDI API calls. */ … … 434 434 RTFOFF cbFree = 0; 435 435 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)) 437 437 { 438 438 rc = VERR_DISK_FULL; … … 444 444 rc = RTFileLock(pImage->File, 445 445 RTFILE_LOCK_WRITE | RTFILE_LOCK_IMMEDIATELY, 0, cbLock); 446 if ( VBOX_FAILURE(rc))446 if (RT_FAILURE(rc)) 447 447 { 448 448 cbLock = 0; /* Not locked. */ … … 463 463 rc = RTFileSetSize(pImage->File, pImage->offStartData); 464 464 } 465 if ( VBOX_FAILURE(rc))465 if (RT_FAILURE(rc)) 466 466 goto l_create_failed; 467 467 … … 471 471 /* Write pre-header. */ 472 472 rc = RTFileWrite(pImage->File, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL); 473 if ( VBOX_FAILURE(rc))473 if (RT_FAILURE(rc)) 474 474 goto l_create_failed; 475 475 476 476 /* Write header. */ 477 477 rc = RTFileWrite(pImage->File, &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL); 478 if ( VBOX_FAILURE(rc))478 if (RT_FAILURE(rc)) 479 479 goto l_create_failed; 480 480 481 481 /* Write blocks array. */ 482 482 rc = RTFileSeek(pImage->File, pImage->offStartBlocks, RTFILE_SEEK_BEGIN, NULL); 483 if ( VBOX_FAILURE(rc))483 if (RT_FAILURE(rc)) 484 484 goto l_create_failed; 485 485 rc = RTFileWrite(pImage->File, … … 487 487 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER), 488 488 NULL); 489 if ( VBOX_FAILURE(rc))489 if (RT_FAILURE(rc)) 490 490 goto l_create_failed; 491 491 … … 500 500 501 501 rc = RTFileSeek(pImage->File, pImage->offStartData, RTFILE_SEEK_BEGIN, NULL); 502 if ( VBOX_FAILURE(rc))502 if (RT_FAILURE(rc)) 503 503 goto l_create_failed; 504 504 … … 517 517 518 518 rc = RTFileWrite(pImage->File, pvBuf, to_fill, NULL); 519 if ( VBOX_FAILURE(rc))519 if (RT_FAILURE(rc)) 520 520 break; 521 521 … … 527 527 (unsigned)(((cbDisk - cbFill) * 100) / cbDisk), 528 528 pvUser); 529 if ( VBOX_FAILURE(rc))529 if (RT_FAILURE(rc)) 530 530 break; 531 531 } … … 549 549 550 550 /* Delete image file if error occured while creating */ 551 if ( VBOX_FAILURE(rc))551 if (RT_FAILURE(rc)) 552 552 RTFileDelete(pszFilename); 553 553 } … … 556 556 RTMemFree(pImage); 557 557 558 if ( VBOX_SUCCESS(rc)558 if ( RT_SUCCESS(rc) 559 559 && pfnProgress) 560 560 pfnProgress(NULL /* WARNING! pVM=NULL */, 100, pvUser); … … 603 603 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 604 604 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 605 if ( VBOX_FAILURE(rc))605 if (RT_FAILURE(rc)) 606 606 { 607 607 if (!(fOpen & VDI_OPEN_FLAGS_READONLY)) … … 611 611 pImage->szFilename, 612 612 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 613 if ( VBOX_SUCCESS(rc))613 if (RT_SUCCESS(rc)) 614 614 pImage->fOpen |= VDI_OPEN_FLAGS_READONLY; 615 615 } 616 if ( VBOX_FAILURE(rc))616 if (RT_FAILURE(rc)) 617 617 { 618 618 RTMemFree(pImage); … … 630 630 uint64_t cbLock = _1M; 631 631 rc = RTFileLock(pImage->File, RTFILE_LOCK_READ | RTFILE_LOCK_IMMEDIATELY, 0, cbLock); 632 if ( VBOX_FAILURE(rc))632 if (RT_FAILURE(rc)) 633 633 { 634 634 cbLock = 0; … … 639 639 /* Read pre-header. */ 640 640 rc = RTFileRead(pImage->File, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL); 641 if ( VBOX_FAILURE(rc))641 if (RT_FAILURE(rc)) 642 642 goto l_open_failed; 643 643 rc = vdiValidatePreHeader(&pImage->PreHeader); 644 if ( VBOX_FAILURE(rc))644 if (RT_FAILURE(rc)) 645 645 goto l_open_failed; 646 646 … … 661 661 * supporting VDI 1.1 doesn't touch fields it doesn't know 662 662 * about. And it accepts bigger headers. */ 663 if ( VBOX_SUCCESS(rc)663 if ( RT_SUCCESS(rc) 664 664 && !pImage->fReadOnly 665 665 && pImage->Header.u.v1.cbHeader < sizeof(pImage->Header.u.v1plus)) … … 672 672 pImage->Header.u.v1plus.LCHSGeometry.cbSector = VDI_GEOMETRY_SECTOR_SIZE; 673 673 } 674 else if ( VBOX_SUCCESS(rc)674 else if ( RT_SUCCESS(rc) 675 675 && pImage->Header.u.v1.cbHeader >= sizeof(pImage->Header.u.v1plus)) 676 676 { … … 688 688 break; 689 689 } 690 if ( VBOX_FAILURE(rc))690 if (RT_FAILURE(rc)) 691 691 goto l_open_failed; 692 692 693 693 rc = vdiValidateHeader(&pImage->Header); 694 if ( VBOX_FAILURE(rc))694 if (RT_FAILURE(rc)) 695 695 goto l_open_failed; 696 696 … … 749 749 0, 750 750 cbLock); 751 if ( VBOX_FAILURE(rc)751 if ( RT_FAILURE(rc) 752 752 && !pImage->fReadOnly) 753 753 { … … 755 755 rc = RTFileLock(pImage->File, 756 756 RTFILE_LOCK_READ | RTFILE_LOCK_IMMEDIATELY, 0, cbLock); 757 if ( VBOX_SUCCESS(rc))757 if (RT_SUCCESS(rc)) 758 758 pImage->fReadOnly = true; 759 759 } 760 if ( VBOX_FAILURE(rc))760 if (RT_FAILURE(rc)) 761 761 { 762 762 cbLock = 0; /* Not locked. */ … … 775 775 /* Read blocks array. */ 776 776 rc = RTFileSeek(pImage->File, pImage->offStartBlocks, RTFILE_SEEK_BEGIN, NULL); 777 if ( VBOX_FAILURE(rc))777 if (RT_FAILURE(rc)) 778 778 goto l_open_failed; 779 779 rc = RTFileRead(pImage->File, pImage->paBlocks, 780 780 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER), NULL); 781 if ( VBOX_FAILURE(rc))781 if (RT_FAILURE(rc)) 782 782 goto l_open_failed; 783 783 … … 807 807 /* Seek to header start. */ 808 808 int rc = RTFileSeek(pImage->File, sizeof(VDIPREHEADER), RTFILE_SEEK_BEGIN, NULL); 809 if ( VBOX_SUCCESS(rc))809 if (RT_SUCCESS(rc)) 810 810 { 811 811 switch (GET_MAJOR_HEADER_VERSION(&pImage->Header)) … … 844 844 /* Update image header. */ 845 845 int rc = vdiUpdateHeader(pImage); 846 if ( VBOX_SUCCESS(rc))846 if (RT_SUCCESS(rc)) 847 847 { 848 848 /* write only one block pointer. */ … … 851 851 RTFILE_SEEK_BEGIN, 852 852 NULL); 853 if ( VBOX_SUCCESS(rc))853 if (RT_SUCCESS(rc)) 854 854 rc = RTFileWrite(pImage->File, 855 855 &pImage->paBlocks[uBlock], … … 869 869 /* Update image header. */ 870 870 int rc = vdiUpdateHeader(pImage); 871 if ( VBOX_SUCCESS(rc))871 if (RT_SUCCESS(rc)) 872 872 { 873 873 /* write the block pointers array. */ 874 874 rc = RTFileSeek(pImage->File, pImage->offStartBlocks, RTFILE_SEEK_BEGIN, NULL); 875 if ( VBOX_SUCCESS(rc))875 if (RT_SUCCESS(rc)) 876 876 rc = RTFileWrite(pImage->File, 877 877 pImage->paBlocks, … … 998 998 + (pImage->offStartData + pImage->offStartBlockData + offRead); 999 999 int rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL); 1000 if ( VBOX_SUCCESS(rc))1000 if (RT_SUCCESS(rc)) 1001 1001 rc = RTFileRead(pImage->File, pvBuf, cbToRead, NULL); 1002 if ( VBOX_FAILURE(rc))1002 if (RT_FAILURE(rc)) 1003 1003 Log(("vdiReadInBlock: rc=%Vrc filename=\"%s\" uBlock=%u offRead=%u cbToRead=%u u64Offset=%llu\n", 1004 1004 rc, pImage->szFilename, uBlock, offRead, cbToRead, u64Offset)); … … 1076 1076 cbToRead -= to_read; 1077 1077 if ( cbToRead == 0 1078 || VBOX_FAILURE(rc))1078 || RT_FAILURE(rc)) 1079 1079 break; 1080 1080 … … 1102 1102 + (pImage->offStartData + pImage->offStartBlockData); 1103 1103 rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL); 1104 if ( VBOX_FAILURE(rc))1104 if (RT_FAILURE(rc)) 1105 1105 { 1106 1106 Log(("vdiFillBlockByZeroes: seek rc=%Vrc filename=\"%s\" uBlock=%u u64Offset=%llu\n", … … 1121 1121 unsigned to_fill = RT_MIN(cbFill, pDisk ? pDisk->cbBuf : VDIDISK_DEFAULT_BUFFER_SIZE); 1122 1122 rc = RTFileWrite(pImage->File, pvBuf, to_fill, NULL); 1123 if ( VBOX_FAILURE(rc))1123 if (RT_FAILURE(rc)) 1124 1124 { 1125 1125 Log(("vdiFillBlockByZeroes: write rc=%Vrc filename=\"%s\" uBlock=%u u64Offset=%llu cbFill=%u to_fill=%u\n", … … 1178 1178 + pImage->offStartData; 1179 1179 rc = RTFileSetSize(pImage->File, u64Size); 1180 if ( VBOX_FAILURE(rc))1180 if (RT_FAILURE(rc)) 1181 1181 { 1182 1182 Log(("vdiWriteInBlock: set size rc=%Vrc filename=\"%s\" uBlock=%u u64Size=%llu\n", … … 1197 1197 { 1198 1198 rc = vdiFillBlockByZeroes(pDisk, pImage, uBlock); 1199 if ( VBOX_FAILURE(rc))1199 if (RT_FAILURE(rc)) 1200 1200 return rc; 1201 1201 } … … 1203 1203 1204 1204 rc = vdiUpdateBlockInfo(pImage, uBlock); 1205 if ( VBOX_FAILURE(rc))1205 if (RT_FAILURE(rc)) 1206 1206 return rc; 1207 1207 } … … 1211 1211 + (pImage->offStartData + pImage->offStartBlockData + offWrite); 1212 1212 rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL); 1213 if ( VBOX_SUCCESS(rc))1213 if (RT_SUCCESS(rc)) 1214 1214 { 1215 1215 rc = RTFileWrite(pImage->File, pvBuf, cbToWrite, NULL); 1216 if ( VBOX_FAILURE(rc))1216 if (RT_FAILURE(rc)) 1217 1217 Log(("vdiWriteInBlock: write rc=%Vrc filename=\"%s\" uBlock=%u offWrite=%u u64Offset=%llu cbToWrite=%u\n", 1218 1218 rc, pImage->szFilename, uBlock, offWrite, u64Offset, cbToWrite)); … … 1256 1256 unsigned to_copy = RT_MIN(cbCopy, pDisk->cbBuf); 1257 1257 rc = vdiReadInBlock(pImage, uBlock, offCopy, to_copy, pvBuf); 1258 if ( VBOX_FAILURE(rc))1258 if (RT_FAILURE(rc)) 1259 1259 break; 1260 1260 1261 1261 rc = vdiWriteInBlock(pDisk, pDisk->pLast, uBlock, offCopy, to_copy, pvBuf); 1262 if ( VBOX_FAILURE(rc))1262 if (RT_FAILURE(rc)) 1263 1263 break; 1264 1264 … … 1338 1338 /* One of parent image has a block data, copy it into last image. */ 1339 1339 rc = vdiCopyBlock(pDisk, pImage, uBlock); 1340 if ( VBOX_FAILURE(rc))1340 if (RT_FAILURE(rc)) 1341 1341 break; 1342 1342 pImage = pDisk->pLast; … … 1349 1349 cbToWrite -= to_write; 1350 1350 if ( cbToWrite == 0 1351 || VBOX_FAILURE(rc))1351 || RT_FAILURE(rc)) 1352 1352 break; 1353 1353 … … 1426 1426 1427 1427 rc = vdiReadInBlock(pImageFrom, uBlock, offCommit, cbToCopy, pvBuf); 1428 if ( VBOX_FAILURE(rc))1428 if (RT_FAILURE(rc)) 1429 1429 break; 1430 1430 1431 1431 rc = vdiWriteInBlock(NULL, pImageTo, uBlock, offCommit, cbToCopy, pvBuf); 1432 if ( VBOX_FAILURE(rc))1432 if (RT_FAILURE(rc)) 1433 1433 break; 1434 1434 … … 1436 1436 offCommit += cbToCopy; 1437 1437 } 1438 if ( VBOX_FAILURE(rc))1438 if (RT_FAILURE(rc)) 1439 1439 break; 1440 1440 } … … 1487 1487 1488 1488 rc = vdiReadInBlock(pImageFrom, uBlock, offCommit, cbToCopy, pvBuf); 1489 if ( VBOX_FAILURE(rc))1489 if (RT_FAILURE(rc)) 1490 1490 break; 1491 1491 1492 1492 rc = vdiWriteInBlock(NULL, pImageTo, uBlock, offCommit, cbToCopy, pvBuf); 1493 if ( VBOX_FAILURE(rc))1493 if (RT_FAILURE(rc)) 1494 1494 break; 1495 1495 … … 1497 1497 offCommit += cbToCopy; 1498 1498 } 1499 if ( VBOX_FAILURE(rc))1499 if (RT_FAILURE(rc)) 1500 1500 break; 1501 1501 } … … 1588 1588 1589 1589 rc = vdiReadInBlock(pImage, uBlock, offCommit, cbToCopy, pvBuf); 1590 if ( VBOX_FAILURE(rc))1590 if (RT_FAILURE(rc)) 1591 1591 break; 1592 1592 1593 1593 rc = vdiWriteInBlock(pDisk, pDstImage, uBlock, offCommit, cbToCopy, pvBuf); 1594 if ( VBOX_FAILURE(rc))1594 if (RT_FAILURE(rc)) 1595 1595 break; 1596 1596 … … 1598 1598 offCommit += cbToCopy; 1599 1599 } 1600 if ( VBOX_FAILURE(rc))1600 if (RT_FAILURE(rc)) 1601 1601 break; 1602 1602 } … … 1638 1638 /* Truncate file. */ 1639 1639 int rc2 = RTFileSetSize(pImage->File, pImage->offStartData); 1640 if ( VBOX_FAILURE(rc2))1640 if (RT_FAILURE(rc2)) 1641 1641 { 1642 1642 rc = rc2; … … 1647 1647 /* Save header and blocks array. */ 1648 1648 rc2 = vdiUpdateBlocks(pImage); 1649 if ( VBOX_FAILURE(rc2))1649 if (RT_FAILURE(rc2)) 1650 1650 { 1651 1651 rc = rc2; … … 1695 1695 PVDIIMAGEDESC pImage; 1696 1696 int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_READONLY, NULL); 1697 if ( VBOX_SUCCESS(rc))1697 if (RT_SUCCESS(rc)) 1698 1698 { 1699 1699 Log(("VDICheckImage: filename=\"%s\" version=%08X type=%X cbDisk=%llu uuid={%Vuuid}\n", … … 1714 1714 rc = VERR_BUFFER_OVERFLOW; 1715 1715 } 1716 if ( VBOX_SUCCESS(rc))1716 if (RT_SUCCESS(rc)) 1717 1717 { 1718 1718 if (puVersion) … … 1767 1767 PVDIIMAGEDESC pImage; 1768 1768 int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL); 1769 if ( VBOX_FAILURE(rc))1769 if (RT_FAILURE(rc)) 1770 1770 { 1771 1771 Log(("VDISetImageComment: vdiOpenImage rc=%Vrc filename=\"%s\"!\n", rc, pszFilename)); … … 1866 1866 PVDIIMAGEDESC pParent; 1867 1867 int rc = vdiOpenImage(&pParent, pszParent, VDI_OPEN_FLAGS_READONLY, NULL); 1868 if ( VBOX_SUCCESS(rc))1868 if (RT_SUCCESS(rc)) 1869 1869 { 1870 1870 rc = vdiCreateImage(pszFilename, VDI_IMAGE_TYPE_DIFF, VDI_IMAGE_FLAGS_DEFAULT, … … 1895 1895 1896 1896 int rc = VDICheckImage(pszFilename, NULL, NULL, NULL, NULL, NULL, NULL, 0); 1897 if ( VBOX_SUCCESS(rc))1897 if (RT_SUCCESS(rc)) 1898 1898 rc = RTFileDelete(pszFilename); 1899 1899 … … 1939 1939 PVDIIMAGEDESC pImage; 1940 1940 int rc = vdiOpenImage(&pImage, pszSrcFilename, VDI_OPEN_FLAGS_READONLY, NULL); 1941 if ( VBOX_FAILURE(rc))1941 if (RT_FAILURE(rc)) 1942 1942 { 1943 1943 Log(("VDICopyImage: src image \"%s\" open failed rc=%Vrc\n", pszSrcFilename, rc)); … … 1953 1953 pszDstFilename, 1954 1954 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)) 1956 1956 { 1957 1957 #ifndef RT_OS_WINDOWS 1958 1958 /* lock new image exclusively to close any wrong access by VDI API calls. */ 1959 1959 rc = RTFileLock(File, RTFILE_LOCK_WRITE | RTFILE_LOCK_IMMEDIATELY, 0, cbFile); 1960 if ( VBOX_SUCCESS(rc))1960 if (RT_SUCCESS(rc)) 1961 1961 #endif 1962 1962 { 1963 1963 /* Set the size of a new file. */ 1964 1964 rc = RTFileSetSize(File, cbFile); 1965 if ( VBOX_SUCCESS(rc))1965 if (RT_SUCCESS(rc)) 1966 1966 { 1967 1967 /* A dirty trick - use original image data to fill the new image. */ … … 1980 1980 /* Write the pre-header to new image. */ 1981 1981 rc = RTFileSeek(pImage->File, 0, RTFILE_SEEK_BEGIN, NULL); 1982 if ( VBOX_SUCCESS(rc))1982 if (RT_SUCCESS(rc)) 1983 1983 rc = RTFileWrite(pImage->File, 1984 1984 &pImage->PreHeader, … … 1987 1987 1988 1988 /* Write the header and the blocks array to new image. */ 1989 if ( VBOX_SUCCESS(rc))1989 if (RT_SUCCESS(rc)) 1990 1990 rc = vdiUpdateBlocks(pImage); 1991 1991 … … 1994 1994 1995 1995 /* Seek to the data start in both images. */ 1996 if ( VBOX_SUCCESS(rc))1996 if (RT_SUCCESS(rc)) 1997 1997 rc = RTFileSeek(pImage->File, 1998 1998 pImage->offStartData, 1999 1999 RTFILE_SEEK_BEGIN, 2000 2000 NULL); 2001 if ( VBOX_SUCCESS(rc))2001 if (RT_SUCCESS(rc)) 2002 2002 rc = RTFileSeek(File, 2003 2003 pImage->offStartData, … … 2005 2005 NULL); 2006 2006 2007 if ( VBOX_SUCCESS(rc))2007 if (RT_SUCCESS(rc)) 2008 2008 { 2009 2009 /* alloc tmp buffer */ … … 2022 2022 /* Read. */ 2023 2023 rc = RTFileRead(pImage->File, pvBuf, cbToCopy, NULL); 2024 if ( VBOX_FAILURE(rc))2024 if (RT_FAILURE(rc)) 2025 2025 break; 2026 2026 2027 2027 /* Write. */ 2028 2028 rc = RTFileWrite(File, pvBuf, cbToCopy, NULL); 2029 if ( VBOX_FAILURE(rc))2029 if (RT_FAILURE(rc)) 2030 2030 break; 2031 2031 … … 2036 2036 (c * 100) / cBlocks, 2037 2037 pvUser); 2038 if ( VBOX_FAILURE(rc))2038 if (RT_FAILURE(rc)) 2039 2039 break; 2040 2040 } … … 2056 2056 RTFileClose(File); 2057 2057 2058 if ( VBOX_FAILURE(rc))2058 if (RT_FAILURE(rc)) 2059 2059 RTFileDelete(pszDstFilename); 2060 2060 … … 2092 2092 PVDIIMAGEDESC pImage; 2093 2093 int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL); 2094 if ( VBOX_FAILURE(rc))2094 if (RT_FAILURE(rc)) 2095 2095 { 2096 2096 Log(("VDIShrinkImage: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename)); … … 2114 2114 uint64_t cbFile; 2115 2115 rc = RTFileGetSize(pImage->File, &cbFile); 2116 if ( VBOX_FAILURE(rc))2116 if (RT_FAILURE(rc)) 2117 2117 { 2118 2118 Log(("VDIShrinkImage: RTFileGetSize rc=%Vrc for file=\"%s\"\n", rc, pszFilename)); … … 2182 2182 + (pImage->offStartData + pImage->offStartBlockData); 2183 2183 rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL); 2184 if ( VBOX_FAILURE(rc))2184 if (RT_FAILURE(rc)) 2185 2185 { 2186 2186 Log(("VDIShrinkImage: seek rc=%Vrc filename=\"%s\" uBlock=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n", … … 2189 2189 } 2190 2190 rc = RTFileRead(pImage->File, pvBuf, cbBlock, NULL); 2191 if ( VBOX_FAILURE(rc))2191 if (RT_FAILURE(rc)) 2192 2192 { 2193 2193 Log(("VDIShrinkImage: read rc=%Vrc filename=\"%s\" cbBlock=%u uBlock=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n", … … 2207 2207 + (pImage->offStartData + pImage->offStartBlockData); 2208 2208 rc = RTFileSeek(pImage->File, u64Offset, RTFILE_SEEK_BEGIN, NULL); 2209 if ( VBOX_FAILURE(rc))2209 if (RT_FAILURE(rc)) 2210 2210 { 2211 2211 Log(("VDIShrinkImage: seek(2) rc=%Vrc filename=\"%s\" uBlockWrite=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n", … … 2214 2214 } 2215 2215 rc = RTFileWrite(pImage->File, pvBuf, cbBlock, NULL); 2216 if ( VBOX_FAILURE(rc))2216 if (RT_FAILURE(rc)) 2217 2217 { 2218 2218 Log(("VDIShrinkImage: write rc=%Vrc filename=\"%s\" cbBlock=%u uBlockWrite=%u cBlocks=%u cBlocksAllocated=%u cBlocksAllocated2=%u cbData=%llu\n", … … 2247 2247 RTMemTmpFree(pvBuf); 2248 2248 2249 if ( VBOX_SUCCESS(rc)2249 if ( RT_SUCCESS(rc) 2250 2250 && uBlockWrite < cBlocksAllocated2) 2251 2251 { … … 2256 2256 rc = RTFileSetSize(pImage->File, 2257 2257 pImage->offStartData + ((uint64_t)uBlockWrite << pImage->uShiftIndex2Offset)); 2258 if ( VBOX_FAILURE(rc))2258 if (RT_FAILURE(rc)) 2259 2259 Log(("VDIShrinkImage: RTFileSetSize rc=%Vrc\n", rc)); 2260 2260 } … … 2268 2268 2269 2269 /* Save header and blocks array. */ 2270 if ( VBOX_SUCCESS(rc))2270 if (RT_SUCCESS(rc)) 2271 2271 { 2272 2272 setImageBlocksAllocated(&pImage->Header, cBlocksAllocated2); … … 2310 2310 PVDIIMAGEDESC pImage; 2311 2311 int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL); 2312 if ( VBOX_FAILURE(rc))2312 if (RT_FAILURE(rc)) 2313 2313 { 2314 2314 Log(("VDIConvertImage: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename)); … … 2364 2364 2365 2365 rc = RTFileGetSize(pImage->File, &cbFile); 2366 if ( VBOX_FAILURE(rc))2366 if (RT_FAILURE(rc)) 2367 2367 goto l_conversion_failed; 2368 2368 … … 2378 2378 /* Expand file. */ 2379 2379 rc = RTFileSetSize(pImage->File, cbFile + off); 2380 if ( VBOX_FAILURE(rc))2380 if (RT_FAILURE(rc)) 2381 2381 goto l_conversion_failed; 2382 2382 … … 2404 2404 /* Read. */ 2405 2405 rc = RTFileSeek(pImage->File, offFile, RTFILE_SEEK_BEGIN, NULL); 2406 if ( VBOX_FAILURE(rc))2406 if (RT_FAILURE(rc)) 2407 2407 break; 2408 2408 rc = RTFileRead(pImage->File, pvBuf, cbToMove, NULL); 2409 if ( VBOX_FAILURE(rc))2409 if (RT_FAILURE(rc)) 2410 2410 break; 2411 2411 2412 2412 /* Write. */ 2413 2413 rc = RTFileSeek(pImage->File, offFile + off, RTFILE_SEEK_BEGIN, NULL); 2414 if ( VBOX_FAILURE(rc))2414 if (RT_FAILURE(rc)) 2415 2415 break; 2416 2416 rc = RTFileWrite(pImage->File, pvBuf, cbToMove, NULL); 2417 if ( VBOX_FAILURE(rc))2417 if (RT_FAILURE(rc)) 2418 2418 break; 2419 2419 … … 2438 2438 2439 2439 /* Fill the beginning of file with zeroes to wipe out old headers etc. */ 2440 if ( VBOX_SUCCESS(rc))2440 if (RT_SUCCESS(rc)) 2441 2441 { 2442 2442 Assert(offFile + off <= VDIDISK_DEFAULT_BUFFER_SIZE); 2443 2443 rc = RTFileSeek(pImage->File, 0, RTFILE_SEEK_BEGIN, NULL); 2444 if ( VBOX_SUCCESS(rc))2444 if (RT_SUCCESS(rc)) 2445 2445 { 2446 2446 memset(pvBuf, 0, (unsigned)offFile + off); … … 2454 2454 rc = VERR_NO_MEMORY; 2455 2455 2456 if ( VBOX_FAILURE(rc))2456 if (RT_FAILURE(rc)) 2457 2457 goto l_conversion_failed; 2458 2458 } … … 2474 2474 /* Write pre-header. */ 2475 2475 rc = RTFileSeek(pImage->File, 0, RTFILE_SEEK_BEGIN, NULL); 2476 if ( VBOX_FAILURE(rc))2476 if (RT_FAILURE(rc)) 2477 2477 goto l_conversion_failed; 2478 2478 rc = RTFileWrite(pImage->File, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL); 2479 if ( VBOX_FAILURE(rc))2479 if (RT_FAILURE(rc)) 2480 2480 goto l_conversion_failed; 2481 2481 … … 2519 2519 PVDIIMAGEDESC pImage; 2520 2520 int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL); 2521 if ( VBOX_FAILURE(rc))2521 if (RT_FAILURE(rc)) 2522 2522 { 2523 2523 Log(("VDIGetImageUUIDs: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename)); … … 2595 2595 PVDIIMAGEDESC pImage; 2596 2596 int rc = vdiOpenImage(&pImage, pszFilename, VDI_OPEN_FLAGS_NORMAL, NULL); 2597 if ( VBOX_FAILURE(rc))2597 if (RT_FAILURE(rc)) 2598 2598 { 2599 2599 Log(("VDISetImageUUIDs: vdiOpenImage rc=%Vrc filename=\"%s\"\n", rc, pszFilename)); … … 2679 2679 PVDIIMAGEDESC pImageFrom; 2680 2680 int rc = vdiOpenImage(&pImageFrom, pszFilenameFrom, VDI_OPEN_FLAGS_READONLY, NULL); 2681 if ( VBOX_FAILURE(rc))2681 if (RT_FAILURE(rc)) 2682 2682 { 2683 2683 Log(("VDIMergeImage: vdiOpenImage rc=%Vrc pstFilenameFrom=\"%s\"\n", rc, pszFilenameFrom)); … … 2687 2687 PVDIIMAGEDESC pImageTo; 2688 2688 rc = vdiOpenImage(&pImageTo, pszFilenameTo, VDI_OPEN_FLAGS_NORMAL, NULL); 2689 if ( VBOX_FAILURE(rc))2689 if (RT_FAILURE(rc)) 2690 2690 { 2691 2691 Log(("VDIMergeImage: vdiOpenImage rc=%Vrc pszFilenameTo=\"%s\"\n", rc, pszFilenameTo)); … … 3345 3345 cbLock); 3346 3346 #endif 3347 if ( VBOX_SUCCESS(rc))3347 if (RT_SUCCESS(rc)) 3348 3348 { 3349 3349 pImage->fReadOnly = fReadOnly; … … 3388 3388 { 3389 3389 rc = vdiChangeImageMode(pImage, false); 3390 if ( VBOX_SUCCESS(rc))3390 if (RT_SUCCESS(rc)) 3391 3391 { 3392 3392 VDIFlushImage(pImage); … … 3437 3437 PVDIIMAGEDESC pImage; 3438 3438 int rc = vdiOpenImage(&pImage, pszFilename, fOpen, pDisk->pLast); 3439 if ( VBOX_SUCCESS(rc))3439 if (RT_SUCCESS(rc)) 3440 3440 { 3441 3441 if (pDisk->pLast) … … 3460 3460 } 3461 3461 3462 if ( VBOX_SUCCESS(rc))3462 if (RT_SUCCESS(rc)) 3463 3463 vdiAddImageToList(pDisk, pImage); 3464 3464 else … … 3583 3583 /* Change previous image mode to r/w. */ 3584 3584 rc = vdiChangeImageMode(pImage->pPrev, false); 3585 if ( VBOX_FAILURE(rc))3585 if (RT_FAILURE(rc)) 3586 3586 { 3587 3587 Log(("VDIDiskCommitLastDiff: can't switch previous image into r/w mode, rc=%Vrc\n", rc)); … … 3591 3591 3592 3592 rc = vdiCommitToImage(pDisk, pImage->pPrev, pfnProgress, pvUser); 3593 if ( VBOX_SUCCESS(rc) && fWasReadOnly)3593 if (RT_SUCCESS(rc) && fWasReadOnly) 3594 3594 { 3595 3595 /* Change previous image mode back to r/o. */ … … 3597 3597 } 3598 3598 3599 if ( VBOX_FAILURE(rc))3599 if (RT_FAILURE(rc)) 3600 3600 { 3601 3601 /* Failed! Close all images, can't work with VHDD at all. */ … … 3645 3645 pDisk->pLast, 3646 3646 pfnProgress, pvUser); 3647 if ( VBOX_SUCCESS(rc))3647 if (RT_SUCCESS(rc)) 3648 3648 { 3649 3649 rc = VDIDiskOpenImage(pDisk, pszFilename, VDI_OPEN_FLAGS_NORMAL); 3650 if ( VBOX_FAILURE(rc))3650 if (RT_FAILURE(rc)) 3651 3651 VDIDeleteImage(pszFilename); 3652 3652 } -
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r11176 r11266 374 374 rc = RTFileOpen(&File, pImage->pszFilename, 375 375 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_ALL); 376 if ( VBOX_FAILURE(rc))376 if (RT_FAILURE(rc)) 377 377 { 378 378 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: cannot create image '%s'"), pImage->pszFilename); … … 390 390 RTFOFF cbFree = 0; 391 391 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)) 393 393 { 394 394 rc = vdiError(pImage, VERR_DISK_FULL, RT_SRC_POS, N_("VDI: disk would overflow creating image '%s'"), pImage->pszFilename); … … 410 410 rc = RTFileSetSize(pImage->File, pImage->offStartData); 411 411 } 412 if ( VBOX_FAILURE(rc))412 if (RT_FAILURE(rc)) 413 413 { 414 414 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: setting image size failed for '%s'"), pImage->pszFilename); … … 421 421 /* Write pre-header. */ 422 422 rc = RTFileWriteAt(File, 0, &pImage->PreHeader, sizeof(pImage->PreHeader), NULL); 423 if ( VBOX_FAILURE(rc))423 if (RT_FAILURE(rc)) 424 424 { 425 425 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing pre-header failed for '%s'"), pImage->pszFilename); … … 429 429 /* Write header. */ 430 430 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)) 432 432 { 433 433 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing header failed for '%s'"), pImage->pszFilename); … … 439 439 getImageBlocks(&pImage->Header) * sizeof(VDIIMAGEBLOCKPOINTER), 440 440 NULL); 441 if ( VBOX_FAILURE(rc))441 if (RT_FAILURE(rc)) 442 442 { 443 443 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block pointers failed for '%s'"), pImage->pszFilename); … … 472 472 rc = RTFileWriteAt(File, pImage->offStartData + uOff, 473 473 pvBuf, cbChunk, NULL); 474 if ( VBOX_FAILURE(rc))474 if (RT_FAILURE(rc)) 475 475 { 476 476 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block failed for '%s'"), pImage->pszFilename); … … 485 485 uPercentStart + uOff * uPercentSpan / cbFill, 486 486 pvUser); 487 if ( VBOX_FAILURE(rc))487 if (RT_FAILURE(rc)) 488 488 goto out; 489 489 } … … 493 493 494 494 out: 495 if ( VBOX_SUCCESS(rc) && pfnProgress)495 if (RT_SUCCESS(rc) && pfnProgress) 496 496 pfnProgress(NULL /* WARNING! pVM=NULL */, 497 497 uPercentStart + uPercentSpan, pvUser); 498 498 499 if ( VBOX_FAILURE(rc))499 if (RT_FAILURE(rc)) 500 500 vdiFreeImage(pImage, rc != VERR_ALREADY_EXISTS); 501 501 return rc; … … 522 522 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 523 523 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 524 if ( VBOX_FAILURE(rc))524 if (RT_FAILURE(rc)) 525 525 { 526 526 /* Do NOT signal an appropriate error here, as the VD layer has the … … 533 533 rc = RTFileReadAt(File, 0, &pImage->PreHeader, sizeof(pImage->PreHeader), 534 534 NULL); 535 if ( VBOX_FAILURE(rc))535 if (RT_FAILURE(rc)) 536 536 { 537 537 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading pre-header in '%s'"), pImage->pszFilename); … … 539 539 } 540 540 rc = vdiValidatePreHeader(&pImage->PreHeader); 541 if ( VBOX_FAILURE(rc))541 if (RT_FAILURE(rc)) 542 542 { 543 543 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: invalid pre-header in '%s'"), pImage->pszFilename); … … 553 553 &pImage->Header.u.v0, sizeof(pImage->Header.u.v0), 554 554 NULL); 555 if ( VBOX_FAILURE(rc))555 if (RT_FAILURE(rc)) 556 556 { 557 557 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v0 header in '%s'"), pImage->pszFilename); … … 563 563 &pImage->Header.u.v1, sizeof(pImage->Header.u.v1), 564 564 NULL); 565 if ( VBOX_FAILURE(rc))565 if (RT_FAILURE(rc)) 566 566 { 567 567 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v1 header in '%s'"), pImage->pszFilename); … … 586 586 /* Read the actual VDI 1.1+ header completely. */ 587 587 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)) 589 589 { 590 590 rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v1.1+ header in '%s'"), pImage->pszFilename); … … 599 599 600 600 rc = vdiValidateHeader(&pImage->Header); 601 if ( VBOX_FAILURE(rc))601 if (RT_FAILURE(rc)) 602 602 { 603 603 rc = vdiError(pImage, VERR_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename); … … 622 622 623 623 out: 624 if ( VBOX_FAILURE(rc))624 if (RT_FAILURE(rc)) 625 625 vdiFreeImage(pImage, false); 626 626 return rc; … … 659 659 /* Update image header. */ 660 660 int rc = vdiUpdateHeader(pImage); 661 if ( VBOX_SUCCESS(rc))661 if (RT_SUCCESS(rc)) 662 662 { 663 663 /* write only one block pointer. */ … … 787 787 788 788 rc = vdiOpenImage(pImage, uOpenFlags); 789 if ( VBOX_SUCCESS(rc))789 if (RT_SUCCESS(rc)) 790 790 *ppBackendData = pImage; 791 791 … … 845 845 pPCHSGeometry, pLCHSGeometry, 846 846 pfnProgress, pvUser, uPercentStart, uPercentSpan); 847 if ( VBOX_SUCCESS(rc))847 if (RT_SUCCESS(rc)) 848 848 { 849 849 /* So far the image is opened in read/write mode. Make sure the … … 853 853 vdiFreeImage(pImage, false); 854 854 rc = vdiOpenImage(pImage, uOpenFlags); 855 if ( VBOX_FAILURE(rc))855 if (RT_FAILURE(rc)) 856 856 goto out; 857 857 } … … 886 886 /* Rename the file. */ 887 887 rc = RTFileMove(pImage->pszFilename, pszFilename, 0); 888 if ( VBOX_FAILURE(rc))889 { 888 if (RT_FAILURE(rc)) 889 { 890 890 /* The move failed, try to reopen the original image. */ 891 891 int rc2 = vdiOpenImage(pImage, pImage->uOpenFlags); 892 if ( VBOX_FAILURE(rc2))892 if (RT_FAILURE(rc2)) 893 893 rc = rc2; 894 894 … … 901 901 /* Open the new image. */ 902 902 rc = vdiOpenImage(pImage, pImage->uOpenFlags); 903 if ( VBOX_FAILURE(rc))903 if (RT_FAILURE(rc)) 904 904 goto out; 905 905 … … 970 970 } 971 971 972 if ( VBOX_SUCCESS(rc))972 if (RT_SUCCESS(rc)) 973 973 *pcbActuallyRead = cbToRead; 974 974 … … 1046 1046 + (pImage->offStartData + pImage->offStartBlockData); 1047 1047 rc = RTFileWriteAt(pImage->File, u64Offset, pvBuf, cbToWrite, NULL); 1048 if ( VBOX_FAILURE(rc))1048 if (RT_FAILURE(rc)) 1049 1049 goto out; 1050 1050 pImage->paBlocks[uBlock] = cBlocksAllocated; … … 1052 1052 1053 1053 rc = vdiUpdateBlockInfo(pImage, uBlock); 1054 if ( VBOX_FAILURE(rc))1054 if (RT_FAILURE(rc)) 1055 1055 goto out; 1056 1056 … … 1168 1168 { 1169 1169 int rc = RTFileGetSize(pImage->File, &cbFile); 1170 if ( VBOX_SUCCESS(rc))1170 if (RT_SUCCESS(rc)) 1171 1171 cb += cbFile; 1172 1172 } -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r11176 r11266 368 368 /** Async I/O interface callbacks. */ 369 369 PVDINTERFACEASYNCIO pInterfaceAsyncIOCallbacks; 370 /** 370 /** 371 371 * Pointer to an array of task handles for task submission. 372 372 * This is an optimization because the task number to submit is not known … … 496 496 pVmdkFile->fAsyncIO = false; 497 497 } 498 if ( VBOX_SUCCESS(rc))498 if (RT_SUCCESS(rc)) 499 499 { 500 500 pVmdkFile->uReferences = 1; … … 554 554 rc = RTFileClose(pVmdkFile->File); 555 555 } 556 if ( VBOX_SUCCESS(rc) && pVmdkFile->fDelete)556 if (RT_SUCCESS(rc) && pVmdkFile->fDelete) 557 557 rc = RTFileDelete(pVmdkFile->pszFilename); 558 558 RTStrFree((char *)(void *)pVmdkFile->pszFilename); … … 567 567 * Internal: read from a file distinguishing between async and normal operation 568 568 */ 569 DECLINLINE(int) vmdkFileReadAt(PVMDKFILE pVmdkFile, 570 uint64_t uOffset, void *pvBuf, 569 DECLINLINE(int) vmdkFileReadAt(PVMDKFILE pVmdkFile, 570 uint64_t uOffset, void *pvBuf, 571 571 size_t cbToRead, size_t *pcbRead) 572 572 { … … 584 584 * Internal: write to a file distinguishing between async and normal operation 585 585 */ 586 DECLINLINE(int) vmdkFileWriteAt(PVMDKFILE pVmdkFile, 587 uint64_t uOffset, const void *pvBuf, 586 DECLINLINE(int) vmdkFileWriteAt(PVMDKFILE pVmdkFile, 587 uint64_t uOffset, const void *pvBuf, 588 588 size_t cbToWrite, size_t *pcbWritten) 589 589 { … … 663 663 rc2 = RTFileClose(pVmdkFile->File); 664 664 665 if ( VBOX_SUCCESS(rc) && pVmdkFile->fDelete)665 if (RT_SUCCESS(rc) && pVmdkFile->fDelete) 666 666 rc2 = RTFileDelete(pVmdkFile->pszFilename); 667 667 RTStrFree((char *)(void *)pVmdkFile->pszFilename); 668 668 RTMemFree(pVmdkFile); 669 if ( VBOX_SUCCESS(rc))669 if (RT_SUCCESS(rc)) 670 670 rc = rc2; 671 671 } … … 781 781 pGD, cbGD, NULL); 782 782 AssertRC(rc); 783 if ( VBOX_FAILURE(rc))783 if (RT_FAILURE(rc)) 784 784 { 785 785 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: could not read grain directory in '%s'"), pExtent->pszFullname); … … 801 801 pRGD, cbGD, NULL); 802 802 AssertRC(rc); 803 if ( VBOX_FAILURE(rc))803 if (RT_FAILURE(rc)) 804 804 { 805 805 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: could not read redundant grain directory in '%s'"), pExtent->pszFullname); … … 845 845 rc = vmdkFileReadAt(pExtent->pFile, VMDK_SECTOR2BYTE(*pGDTmp), 846 846 pTmpGT1, cbGT, NULL); 847 if ( VBOX_FAILURE(rc))847 if (RT_FAILURE(rc)) 848 848 { 849 849 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error reading grain table in '%s'"), pExtent->pszFullname); … … 854 854 rc = vmdkFileReadAt(pExtent->pFile, VMDK_SECTOR2BYTE(*pRGDTmp), 855 855 pTmpGT2, cbGT, NULL); 856 if ( VBOX_FAILURE(rc))856 if (RT_FAILURE(rc)) 857 857 { 858 858 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error reading backup grain table in '%s'"), pExtent->pszFullname); … … 874 874 875 875 out: 876 if ( VBOX_FAILURE(rc))876 if (RT_FAILURE(rc)) 877 877 vmdkFreeGrainDirectory(pExtent); 878 878 return rc; … … 912 912 cbOverhead = RT_ALIGN_64(VMDK_SECTOR2BYTE(uStartSector) + 2 * (cbGDRounded + cbGTRounded), VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain)); 913 913 rc = vmdkFileSetSize(pExtent->pFile, cbOverhead); 914 if ( VBOX_FAILURE(rc))914 if (RT_FAILURE(rc)) 915 915 goto out; 916 916 pExtent->uSectorRGD = uStartSector; … … 931 931 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + i * sizeof(uGTSectorLE), 932 932 &uGTSectorLE, sizeof(uGTSectorLE), NULL); 933 if ( VBOX_FAILURE(rc))933 if (RT_FAILURE(rc)) 934 934 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new redundant grain directory entry in '%s'"), pExtent->pszFullname); 935 935 uOffsetSectors += VMDK_BYTE2SECTOR(pExtent->cGTEntries * sizeof(uint32_t)); … … 945 945 VMDK_SECTOR2BYTE(pExtent->uSectorGD) + i * sizeof(uGTSectorLE), 946 946 &uGTSectorLE, sizeof(uGTSectorLE), NULL); 947 if ( VBOX_FAILURE(rc))947 if (RT_FAILURE(rc)) 948 948 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new grain directory entry in '%s'"), pExtent->pszFullname); 949 949 uOffsetSectors += VMDK_BYTE2SECTOR(pExtent->cGTEntries * sizeof(uint32_t)); … … 953 953 954 954 out: 955 if ( VBOX_FAILURE(rc))955 if (RT_FAILURE(rc)) 956 956 vmdkFreeGrainDirectory(pExtent); 957 957 return rc; … … 1176 1176 return VERR_VDI_VALUE_NOT_FOUND; 1177 1177 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1178 if ( VBOX_FAILURE(rc))1178 if (RT_FAILURE(rc)) 1179 1179 return rc; 1180 1180 *ppszValue = pszValueUnquoted; … … 1188 1188 1189 1189 int rc = RTStrAPrintf(&pszValueQuoted, "\"%s\"", pszValue); 1190 if ( VBOX_FAILURE(rc))1190 if (RT_FAILURE(rc)) 1191 1191 return rc; 1192 1192 rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDesc, pszKey, … … 1305 1305 return VERR_VDI_VALUE_NOT_FOUND; 1306 1306 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1307 if ( VBOX_FAILURE(rc))1307 if (RT_FAILURE(rc)) 1308 1308 return rc; 1309 1309 *ppszValue = pszValueUnquoted; … … 1321 1321 return VERR_VDI_VALUE_NOT_FOUND; 1322 1322 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1323 if ( VBOX_FAILURE(rc))1323 if (RT_FAILURE(rc)) 1324 1324 return rc; 1325 1325 rc = RTStrToUInt32Ex(pszValueUnquoted, NULL, 10, puValue); … … 1338 1338 return VERR_VDI_VALUE_NOT_FOUND; 1339 1339 int rc = vmdkStringUnquote(pImage, pszValue, &pszValueUnquoted, NULL); 1340 if ( VBOX_FAILURE(rc))1340 if (RT_FAILURE(rc)) 1341 1341 return rc; 1342 1342 rc = RTUuidFromStr(pUuid, pszValueUnquoted); … … 1354 1354 { 1355 1355 rc = RTStrAPrintf(&pszValQuoted, "\"%s\"", pszVal); 1356 if ( VBOX_FAILURE(rc))1356 if (RT_FAILURE(rc)) 1357 1357 return rc; 1358 1358 } … … 1372 1372 1373 1373 int rc = RTStrAPrintf(&pszUuid, "\"%Vuuid\"", pUuid); 1374 if ( VBOX_FAILURE(rc))1374 if (RT_FAILURE(rc)) 1375 1375 return rc; 1376 1376 rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDDB, pszKey, … … 1386 1386 1387 1387 int rc = RTStrAPrintf(&pszValue, "\"%d\"", uValue); 1388 if ( VBOX_FAILURE(rc))1388 if (RT_FAILURE(rc)) 1389 1389 return rc; 1390 1390 rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDDB, pszKey, … … 1517 1517 VMDK_DDB_GEO_PCHS_CYLINDERS, 1518 1518 pPCHSGeometry->cCylinders); 1519 if ( VBOX_FAILURE(rc))1519 if (RT_FAILURE(rc)) 1520 1520 return rc; 1521 1521 rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor, 1522 1522 VMDK_DDB_GEO_PCHS_HEADS, 1523 1523 pPCHSGeometry->cHeads); 1524 if ( VBOX_FAILURE(rc))1524 if (RT_FAILURE(rc)) 1525 1525 return rc; 1526 1526 rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor, … … 1536 1536 VMDK_DDB_GEO_LCHS_CYLINDERS, 1537 1537 pLCHSGeometry->cCylinders); 1538 if ( VBOX_FAILURE(rc))1538 if (RT_FAILURE(rc)) 1539 1539 return rc; 1540 1540 rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor, 1541 1541 VMDK_DDB_GEO_LCHS_HEADS, 1542 1542 pLCHSGeometry->cHeads); 1543 if ( VBOX_FAILURE(rc))1543 if (RT_FAILURE(rc)) 1544 1544 return rc; 1545 1545 rc = vmdkDescDDBSetU32(pImage, &pImage->Descriptor, … … 1564 1564 1565 1565 rc = vmdkDescInitStr(pImage, pDescriptor, "# Disk DescriptorFile"); 1566 if ( VBOX_FAILURE(rc))1566 if (RT_FAILURE(rc)) 1567 1567 goto out; 1568 1568 rc = vmdkDescInitStr(pImage, pDescriptor, "version=1"); 1569 if ( VBOX_FAILURE(rc))1569 if (RT_FAILURE(rc)) 1570 1570 goto out; 1571 1571 pDescriptor->uFirstDesc = pDescriptor->cLines - 1; 1572 1572 rc = vmdkDescInitStr(pImage, pDescriptor, ""); 1573 if ( VBOX_FAILURE(rc))1573 if (RT_FAILURE(rc)) 1574 1574 goto out; 1575 1575 rc = vmdkDescInitStr(pImage, pDescriptor, "# Extent description"); 1576 if ( VBOX_FAILURE(rc))1576 if (RT_FAILURE(rc)) 1577 1577 goto out; 1578 1578 rc = vmdkDescInitStr(pImage, pDescriptor, "NOACCESS 0 ZERO "); 1579 if ( VBOX_FAILURE(rc))1579 if (RT_FAILURE(rc)) 1580 1580 goto out; 1581 1581 pDescriptor->uFirstExtent = pDescriptor->cLines - 1; 1582 1582 rc = vmdkDescInitStr(pImage, pDescriptor, ""); 1583 if ( VBOX_FAILURE(rc))1583 if (RT_FAILURE(rc)) 1584 1584 goto out; 1585 1585 /* The trailing space is created by VMware, too. */ 1586 1586 rc = vmdkDescInitStr(pImage, pDescriptor, "# The disk Data Base "); 1587 if ( VBOX_FAILURE(rc))1587 if (RT_FAILURE(rc)) 1588 1588 goto out; 1589 1589 rc = vmdkDescInitStr(pImage, pDescriptor, "#DDB"); 1590 if ( VBOX_FAILURE(rc))1590 if (RT_FAILURE(rc)) 1591 1591 goto out; 1592 1592 rc = vmdkDescInitStr(pImage, pDescriptor, ""); 1593 if ( VBOX_FAILURE(rc))1593 if (RT_FAILURE(rc)) 1594 1594 goto out; 1595 1595 rc = vmdkDescInitStr(pImage, pDescriptor, "ddb.virtualHWVersion = \"4\""); 1596 if ( VBOX_FAILURE(rc))1596 if (RT_FAILURE(rc)) 1597 1597 goto out; 1598 1598 pDescriptor->uFirstDDB = pDescriptor->cLines - 1; … … 1604 1604 rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDesc, 1605 1605 "CID", szBuf); 1606 if ( VBOX_FAILURE(rc))1606 if (RT_FAILURE(rc)) 1607 1607 goto out; 1608 1608 rc = vmdkDescSetStr(pImage, pDescriptor, pDescriptor->uFirstDesc, 1609 1609 "parentCID", "ffffffff"); 1610 if ( VBOX_FAILURE(rc))1610 if (RT_FAILURE(rc)) 1611 1611 goto out; 1612 1612 1613 1613 rc = vmdkDescDDBSetStr(pImage, pDescriptor, "ddb.adapterType", "ide"); 1614 if ( VBOX_FAILURE(rc))1614 if (RT_FAILURE(rc)) 1615 1615 goto out; 1616 1616 … … 1628 1628 rc = vmdkPreprocessDescriptor(pImage, pDescData, cbDescData, 1629 1629 &pImage->Descriptor); 1630 if ( VBOX_FAILURE(rc))1630 if (RT_FAILURE(rc)) 1631 1631 return rc; 1632 1632 … … 1634 1634 uint32_t uVersion; 1635 1635 rc = vmdkDescBaseGetU32(&pImage->Descriptor, "version", &uVersion); 1636 if ( VBOX_FAILURE(rc))1636 if (RT_FAILURE(rc)) 1637 1637 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error finding key 'version' in descriptor in '%s'"), pImage->pszFilename); 1638 1638 if (uVersion != 1) … … 1643 1643 rc = vmdkDescBaseGetStr(pImage, &pImage->Descriptor, "createType", 1644 1644 &pszCreateType); 1645 if ( VBOX_FAILURE(rc))1645 if (RT_FAILURE(rc)) 1646 1646 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: cannot get image type from descriptor in '%s'"), pImage->pszFilename); 1647 1647 if ( !strcmp(pszCreateType, "twoGbMaxExtentSparse") … … 1671 1671 /* Non-monolithic image, extents need to be allocated. */ 1672 1672 rc = vmdkCreateExtents(pImage, cExtents); 1673 if ( VBOX_FAILURE(rc))1673 if (RT_FAILURE(rc)) 1674 1674 return rc; 1675 1675 } … … 1704 1704 rc = RTStrToUInt64Ex(pszLine, &pszLine, 10, 1705 1705 &pImage->pExtents[i].cNominalSectors); 1706 if ( VBOX_FAILURE(rc))1706 if (RT_FAILURE(rc)) 1707 1707 return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename); 1708 1708 if (*pszLine++ != ' ') … … 1750 1750 char *pszBasename; 1751 1751 rc = vmdkStringUnquote(pImage, pszLine, &pszBasename, &pszLine); 1752 if ( VBOX_FAILURE(rc))1752 if (RT_FAILURE(rc)) 1753 1753 return rc; 1754 1754 pImage->pExtents[i].pszBasename = pszBasename; … … 1761 1761 rc = RTStrToUInt64Ex(pszLine, &pszLine, 10, 1762 1762 &pImage->pExtents[i].uSectorOffset); 1763 if ( VBOX_FAILURE(rc))1763 if (RT_FAILURE(rc)) 1764 1764 return vmdkError(pImage, VERR_VDI_INVALID_HEADER, RT_SRC_POS, N_("VMDK: parse error in extent description in '%s'"), pImage->pszFilename); 1765 1765 } … … 1777 1777 if (rc == VERR_VDI_VALUE_NOT_FOUND) 1778 1778 pImage->PCHSGeometry.cCylinders = 0; 1779 else if ( VBOX_FAILURE(rc))1779 else if (RT_FAILURE(rc)) 1780 1780 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting PCHS geometry from extent description in '%s'"), pImage->pszFilename); 1781 1781 rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor, … … 1784 1784 if (rc == VERR_VDI_VALUE_NOT_FOUND) 1785 1785 pImage->PCHSGeometry.cHeads = 0; 1786 else if ( VBOX_FAILURE(rc))1786 else if (RT_FAILURE(rc)) 1787 1787 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting PCHS geometry from extent description in '%s'"), pImage->pszFilename); 1788 1788 rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor, … … 1791 1791 if (rc == VERR_VDI_VALUE_NOT_FOUND) 1792 1792 pImage->PCHSGeometry.cSectors = 0; 1793 else if ( VBOX_FAILURE(rc))1793 else if (RT_FAILURE(rc)) 1794 1794 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting PCHS geometry from extent description in '%s'"), pImage->pszFilename); 1795 1795 if ( pImage->PCHSGeometry.cCylinders == 0 … … 1812 1812 if (rc == VERR_VDI_VALUE_NOT_FOUND) 1813 1813 pImage->LCHSGeometry.cCylinders = 0; 1814 else if ( VBOX_FAILURE(rc))1814 else if (RT_FAILURE(rc)) 1815 1815 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting LCHS geometry from extent description in '%s'"), pImage->pszFilename); 1816 1816 rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor, … … 1819 1819 if (rc == VERR_VDI_VALUE_NOT_FOUND) 1820 1820 pImage->LCHSGeometry.cHeads = 0; 1821 else if ( VBOX_FAILURE(rc))1821 else if (RT_FAILURE(rc)) 1822 1822 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting LCHS geometry from extent description in '%s'"), pImage->pszFilename); 1823 1823 rc = vmdkDescDDBGetU32(pImage, &pImage->Descriptor, … … 1826 1826 if (rc == VERR_VDI_VALUE_NOT_FOUND) 1827 1827 pImage->LCHSGeometry.cSectors = 0; 1828 else if ( VBOX_FAILURE(rc))1828 else if (RT_FAILURE(rc)) 1829 1829 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error getting LCHS geometry from extent description in '%s'"), pImage->pszFilename); 1830 1830 if ( pImage->LCHSGeometry.cCylinders == 0 … … 1850 1850 { 1851 1851 rc = RTUuidCreate(&pImage->ImageUuid); 1852 if ( VBOX_FAILURE(rc))1852 if (RT_FAILURE(rc)) 1853 1853 return rc; 1854 1854 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 1855 1855 VMDK_DDB_IMAGE_UUID, &pImage->ImageUuid); 1856 if ( VBOX_FAILURE(rc))1856 if (RT_FAILURE(rc)) 1857 1857 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image UUID in descriptor in '%s'"), pImage->pszFilename); 1858 1858 } 1859 1859 } 1860 else if ( VBOX_FAILURE(rc))1860 else if (RT_FAILURE(rc)) 1861 1861 return rc; 1862 1862 … … 1875 1875 { 1876 1876 rc = RTUuidCreate(&pImage->ModificationUuid); 1877 if ( VBOX_FAILURE(rc))1877 if (RT_FAILURE(rc)) 1878 1878 return rc; 1879 1879 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 1880 1880 VMDK_DDB_MODIFICATION_UUID, 1881 1881 &pImage->ModificationUuid); 1882 if ( VBOX_FAILURE(rc))1882 if (RT_FAILURE(rc)) 1883 1883 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image modification UUID in descriptor in '%s'"), pImage->pszFilename); 1884 1884 } 1885 1885 } 1886 else if ( VBOX_FAILURE(rc))1886 else if (RT_FAILURE(rc)) 1887 1887 return rc; 1888 1888 … … 1900 1900 { 1901 1901 rc = RTUuidClear(&pImage->ParentUuid); 1902 if ( VBOX_FAILURE(rc))1902 if (RT_FAILURE(rc)) 1903 1903 return rc; 1904 1904 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 1905 1905 VMDK_DDB_PARENT_UUID, &pImage->ParentUuid); 1906 if ( VBOX_FAILURE(rc))1906 if (RT_FAILURE(rc)) 1907 1907 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent UUID in descriptor in '%s'"), pImage->pszFilename); 1908 1908 } 1909 1909 } 1910 else if ( VBOX_FAILURE(rc))1910 else if (RT_FAILURE(rc)) 1911 1911 return rc; 1912 1912 … … 1925 1925 { 1926 1926 rc = RTUuidCreate(&pImage->ParentModificationUuid); 1927 if ( VBOX_FAILURE(rc))1927 if (RT_FAILURE(rc)) 1928 1928 return rc; 1929 1929 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 1930 1930 VMDK_DDB_PARENT_MODIFICATION_UUID, 1931 1931 &pImage->ParentModificationUuid); 1932 if ( VBOX_FAILURE(rc))1932 if (RT_FAILURE(rc)) 1933 1933 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent modification UUID in descriptor in '%s'"), pImage->pszFilename); 1934 1934 } 1935 1935 } 1936 else if ( VBOX_FAILURE(rc))1936 else if (RT_FAILURE(rc)) 1937 1937 return rc; 1938 1938 … … 1973 1973 return vmdkError(pImage, VERR_BUFFER_OVERFLOW, RT_SRC_POS, N_("VMDK: descriptor too long in '%s'"), pImage->pszFilename); 1974 1974 rc = vmdkFileWriteAt(pDescFile, uOffset, psz, cb, NULL); 1975 if ( VBOX_FAILURE(rc))1975 if (RT_FAILURE(rc)) 1976 1976 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename); 1977 1977 uOffset += cb; 1978 1978 rc = vmdkFileWriteAt(pDescFile, uOffset, "\n", 1, NULL); 1979 if ( VBOX_FAILURE(rc))1979 if (RT_FAILURE(rc)) 1980 1980 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename); 1981 1981 uOffset++; … … 1987 1987 { 1988 1988 rc = vmdkFileWriteAt(pDescFile, uOffset, "", 1, NULL); 1989 if ( VBOX_FAILURE(rc))1989 if (RT_FAILURE(rc)) 1990 1990 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error writing descriptor in '%s'"), pImage->pszFilename); 1991 1991 uOffset++; … … 1995 1995 { 1996 1996 rc = vmdkFileSetSize(pDescFile, uOffset); 1997 if ( VBOX_FAILURE(rc))1997 if (RT_FAILURE(rc)) 1998 1998 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error truncating descriptor in '%s'"), pImage->pszFilename); 1999 1999 } … … 2012 2012 int rc = vmdkFileReadAt(pExtent->pFile, 0, &Header, sizeof(Header), NULL); 2013 2013 AssertRC(rc); 2014 if ( VBOX_FAILURE(rc))2014 if (RT_FAILURE(rc)) 2015 2015 { 2016 2016 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error reading extent header in '%s'"), pExtent->pszFullname); … … 2026 2026 * image is at least truncated, or even seriously garbled. */ 2027 2027 rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize); 2028 if ( VBOX_FAILURE(rc))2028 if (RT_FAILURE(rc)) 2029 2029 { 2030 2030 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname); … … 2093 2093 2094 2094 out: 2095 if ( VBOX_FAILURE(rc))2095 if (RT_FAILURE(rc)) 2096 2096 vmdkFreeExtentData(pImage, pExtent, false); 2097 2097 … … 2136 2136 int rc = vmdkFileWriteAt(pExtent->pFile, 0, &Header, sizeof(Header), NULL); 2137 2137 AssertRC(rc); 2138 if ( VBOX_FAILURE(rc))2138 if (RT_FAILURE(rc)) 2139 2139 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error writing extent header in '%s'"), pExtent->pszFullname); 2140 2140 return rc; … … 2154 2154 int rc = vmdkFileReadAt(pExtent->pFile, 0, &Header, sizeof(Header), NULL); 2155 2155 AssertRC(rc); 2156 if ( VBOX_FAILURE(rc))2156 if (RT_FAILURE(rc)) 2157 2157 goto out; 2158 2158 if ( RT_LE2H_U32(Header.magicNumber) != VMDK_ESX_SPARSE_MAGICNUMBER … … 2202 2202 2203 2203 out: 2204 if ( VBOX_FAILURE(rc))2204 if (RT_FAILURE(rc)) 2205 2205 vmdkFreeExtentData(pImage, pExtent, false); 2206 2206 … … 2318 2318 /* 2319 2319 * 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 2321 2321 * we only support raw access and the opened file is a description 2322 2322 * file were no data is stored. … … 2326 2326 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 2327 2327 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, false); 2328 if ( VBOX_FAILURE(rc))2328 if (RT_FAILURE(rc)) 2329 2329 { 2330 2330 /* Do NOT signal an appropriate error here, as the VD layer has the … … 2336 2336 /* Read magic (if present). */ 2337 2337 rc = vmdkFileReadAt(pFile, 0, &u32Magic, sizeof(u32Magic), NULL); 2338 if ( VBOX_FAILURE(rc))2338 if (RT_FAILURE(rc)) 2339 2339 { 2340 2340 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error reading the magic number in '%s'"), pImage->pszFilename); … … 2347 2347 /* It's a hosted sparse single-extent image. */ 2348 2348 rc = vmdkCreateExtents(pImage, 1); 2349 if ( VBOX_FAILURE(rc))2349 if (RT_FAILURE(rc)) 2350 2350 goto out; 2351 2351 /* The opened file is passed to the extent. No separate descriptor … … 2361 2361 } 2362 2362 rc = vmdkReadMetaSparseExtent(pImage, pExtent); 2363 if ( VBOX_FAILURE(rc))2363 if (RT_FAILURE(rc)) 2364 2364 goto out; 2365 2365 /* As we're dealing with a monolithic sparse image here, there must … … 2382 2382 VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors), NULL); 2383 2383 AssertRC(rc); 2384 if ( VBOX_FAILURE(rc))2384 if (RT_FAILURE(rc)) 2385 2385 { 2386 2386 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: read error for descriptor in '%s'"), pExtent->pszFullname); … … 2390 2390 rc = vmdkParseDescriptor(pImage, pExtent->pDescData, 2391 2391 VMDK_SECTOR2BYTE(pExtent->cDescriptorSectors)); 2392 if ( VBOX_FAILURE(rc))2392 if (RT_FAILURE(rc)) 2393 2393 goto out; 2394 2394 … … 2413 2413 rc = vmdkFileReadAt(pImage->pFile, 0, pImage->pDescData, 2414 2414 pImage->cbDescAlloc, &cbRead); 2415 if ( VBOX_FAILURE(rc))2415 if (RT_FAILURE(rc)) 2416 2416 { 2417 2417 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: read error for descriptor in '%s'"), pImage->pszFilename); … … 2428 2428 rc = vmdkParseDescriptor(pImage, pImage->pDescData, 2429 2429 pImage->cbDescAlloc); 2430 if ( VBOX_FAILURE(rc))2430 if (RT_FAILURE(rc)) 2431 2431 goto out; 2432 2432 2433 /* 2433 /* 2434 2434 * We have to check for the asynchronous open flag. The 2435 2435 * extents are parsed and the type of all are known now. … … 2445 2445 && (pExtent->enmType != VMDKETYPE_ZERO)) 2446 2446 { 2447 /* 2447 /* 2448 2448 * Opened image contains at least one none flat or zero extent. 2449 2449 * Return error but don't set error message as the caller … … 2490 2490 RTPATH_SLASH, pExtent->pszBasename); 2491 2491 RTStrFree(pszDirname); 2492 if ( VBOX_FAILURE(rc))2492 if (RT_FAILURE(rc)) 2493 2493 goto out; 2494 2494 } … … 2505 2505 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 2506 2506 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, false); 2507 if ( VBOX_FAILURE(rc))2507 if (RT_FAILURE(rc)) 2508 2508 { 2509 2509 /* Do NOT signal an appropriate error here, as the VD … … 2513 2513 } 2514 2514 rc = vmdkReadMetaSparseExtent(pImage, pExtent); 2515 if ( VBOX_FAILURE(rc))2515 if (RT_FAILURE(rc)) 2516 2516 goto out; 2517 2517 … … 2528 2528 ? RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE 2529 2529 : RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, true); 2530 if ( VBOX_FAILURE(rc))2530 if (RT_FAILURE(rc)) 2531 2531 { 2532 2532 /* Do NOT signal an appropriate error here, as the VD … … 2564 2564 /* Update the image metadata now in case has changed. */ 2565 2565 rc = vmdkFlushImage(pImage); 2566 if ( VBOX_FAILURE(rc))2566 if (RT_FAILURE(rc)) 2567 2567 goto out; 2568 2568 … … 2599 2599 2600 2600 rc = vmdkAllocateGrainTableCache(pImage); 2601 if ( VBOX_FAILURE(rc))2601 if (RT_FAILURE(rc)) 2602 2602 goto out; 2603 2603 2604 2604 out: 2605 if ( VBOX_FAILURE(rc))2605 if (RT_FAILURE(rc)) 2606 2606 vmdkFreeImage(pImage, false); 2607 2607 return rc; … … 2622 2622 * file and open the (flat) raw disk. */ 2623 2623 rc = vmdkCreateExtents(pImage, 1); 2624 if ( VBOX_FAILURE(rc))2624 if (RT_FAILURE(rc)) 2625 2625 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new extent list in '%s'"), pImage->pszFilename); 2626 2626 pExtent = &pImage->pExtents[0]; … … 2629 2629 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED, 2630 2630 false); 2631 if ( VBOX_FAILURE(rc))2631 if (RT_FAILURE(rc)) 2632 2632 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new file '%s'"), pImage->pszFilename); 2633 2633 … … 2652 2652 rc = vmdkFileOpen(pImage, &pExtent->pFile, pExtent->pszFullname, 2653 2653 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, false); 2654 if ( VBOX_FAILURE(rc))2654 if (RT_FAILURE(rc)) 2655 2655 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not open raw disk file '%s'"), pExtent->pszFullname); 2656 2656 } … … 2695 2695 2696 2696 rc = vmdkCreateExtents(pImage, cExtents); 2697 if ( VBOX_FAILURE(rc))2697 if (RT_FAILURE(rc)) 2698 2698 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new extent list in '%s'"), pImage->pszFilename); 2699 2699 … … 2702 2702 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED, 2703 2703 false); 2704 if ( VBOX_FAILURE(rc))2704 if (RT_FAILURE(rc)) 2705 2705 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new file '%s'"), pImage->pszFilename); 2706 2706 … … 2761 2761 RTPATH_SLASH, pExtent->pszBasename); 2762 2762 RTStrFree(pszDirname); 2763 if ( VBOX_FAILURE(rc))2763 if (RT_FAILURE(rc)) 2764 2764 return rc; 2765 2765 pExtent->pszFullname = pszFullname; … … 2774 2774 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED, 2775 2775 false); 2776 if ( VBOX_FAILURE(rc))2776 if (RT_FAILURE(rc)) 2777 2777 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new partition data file '%s'"), pExtent->pszFullname); 2778 2778 rc = vmdkFileWriteAt(pExtent->pFile, … … 2780 2780 pPart->pvPartitionData, 2781 2781 pPart->cbPartitionData, NULL); 2782 if ( VBOX_FAILURE(rc))2782 if (RT_FAILURE(rc)) 2783 2783 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not write partition data to '%s'"), pExtent->pszFullname); 2784 2784 uPartOffset += VMDK_BYTE2SECTOR(pPart->cbPartitionData); … … 2822 2822 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, 2823 2823 false); 2824 if ( VBOX_FAILURE(rc))2824 if (RT_FAILURE(rc)) 2825 2825 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not open raw partition file '%s'"), pExtent->pszFullname); 2826 2826 } … … 2854 2854 pRaw->fRawDisk ? 2855 2855 "fullDevice" : "partitionedDevice"); 2856 if ( VBOX_FAILURE(rc))2856 if (RT_FAILURE(rc)) 2857 2857 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not set the image type in '%s'"), pImage->pszFilename); 2858 2858 return rc; … … 2881 2881 } 2882 2882 rc = vmdkCreateExtents(pImage, cExtents); 2883 if ( VBOX_FAILURE(rc))2883 if (RT_FAILURE(rc)) 2884 2884 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new extent list in '%s'"), pImage->pszFilename); 2885 2885 … … 2895 2895 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED, 2896 2896 false); 2897 if ( VBOX_FAILURE(rc))2897 if (RT_FAILURE(rc)) 2898 2898 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new sparse descriptor file '%s'"), pImage->pszFilename); 2899 2899 pImage->pszFilename = RTStrDup(pImage->pszFilename); … … 2940 2940 pszBasenameExt); 2941 2941 RTStrFree(pszBasenameBase); 2942 if ( VBOX_FAILURE(rc))2942 if (RT_FAILURE(rc)) 2943 2943 return rc; 2944 2944 cbTmp = strlen(pszTmp) + 1; … … 2958 2958 RTPATH_SLASH, pExtent->pszBasename); 2959 2959 RTStrFree(pszBasedirectory); 2960 if ( VBOX_FAILURE(rc))2960 if (RT_FAILURE(rc)) 2961 2961 return rc; 2962 2962 pExtent->pszFullname = pszFullname; … … 2966 2966 RTFILE_O_READWRITE | RTFILE_O_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_NOT_CONTENT_INDEXED, 2967 2967 false); 2968 if ( VBOX_FAILURE(rc))2968 if (RT_FAILURE(rc)) 2969 2969 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new file '%s'"), pExtent->pszFullname); 2970 2970 if (enmType == VD_IMAGE_TYPE_FIXED) 2971 2971 { 2972 2972 rc = vmdkFileSetSize(pExtent->pFile, cbExtent); 2973 if ( VBOX_FAILURE(rc))2973 if (RT_FAILURE(rc)) 2974 2974 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not set size of new file '%s'"), pExtent->pszFullname); 2975 2975 … … 2994 2994 2995 2995 rc = vmdkFileWriteAt(pExtent->pFile, uOff, pvBuf, cbChunk, NULL); 2996 if ( VBOX_FAILURE(rc))2996 if (RT_FAILURE(rc)) 2997 2997 { 2998 2998 RTMemFree(pvBuf); … … 3007 3007 uPercentStart + uOff * uPercentSpan / cbExtent, 3008 3008 pvUser); 3009 if ( VBOX_FAILURE(rc))3009 if (RT_FAILURE(rc)) 3010 3010 { 3011 3011 RTMemFree(pvBuf); … … 3055 3055 1), 3056 3056 true); 3057 if ( VBOX_FAILURE(rc))3057 if (RT_FAILURE(rc)) 3058 3058 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new grain directory in '%s'"), pExtent->pszFullname); 3059 3059 } 3060 3060 3061 if ( VBOX_SUCCESS(rc) && pfnProgress)3061 if (RT_SUCCESS(rc) && pfnProgress) 3062 3062 pfnProgress(NULL /* WARNING! pVM=NULL */, 3063 3063 uPercentStart + i * uPercentSpan / cExtents, … … 3083 3083 rc = vmdkDescBaseSetStr(pImage, &pImage->Descriptor, "createType", 3084 3084 pszDescType); 3085 if ( VBOX_FAILURE(rc))3085 if (RT_FAILURE(rc)) 3086 3086 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not set the image type in '%s'"), pImage->pszFilename); 3087 3087 return rc; … … 3105 3105 rc = vmdkCreateDescriptor(pImage, pImage->pDescData, pImage->cbDescAlloc, 3106 3106 &pImage->Descriptor); 3107 if ( VBOX_FAILURE(rc))3107 if (RT_FAILURE(rc)) 3108 3108 { 3109 3109 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new descriptor in '%s'"), pImage->pszFilename); … … 3135 3135 } 3136 3136 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) 3141 3141 pfnProgress(NULL /* WARNING! pVM=NULL */, 3142 3142 uPercentStart + uPercentSpan * 98 / 100, pvUser); … … 3152 3152 pExtent->cNominalSectors, pExtent->enmType, 3153 3153 pExtent->pszBasename, pExtent->uSectorOffset); 3154 if ( VBOX_FAILURE(rc))3154 if (RT_FAILURE(rc)) 3155 3155 { 3156 3156 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not insert the extent list into descriptor in '%s'"), pImage->pszFilename); … … 3165 3165 { 3166 3166 rc = vmdkDescSetPCHSGeometry(pImage, pPCHSGeometry); 3167 if ( VBOX_FAILURE(rc))3167 if (RT_FAILURE(rc)) 3168 3168 goto out; 3169 3169 } … … 3173 3173 { 3174 3174 rc = vmdkDescSetLCHSGeometry(pImage, pLCHSGeometry); 3175 if ( VBOX_FAILURE(rc))3175 if (RT_FAILURE(rc)) 3176 3176 goto out; 3177 3177 } … … 3181 3181 3182 3182 rc = RTUuidCreate(&pImage->ImageUuid); 3183 if ( VBOX_FAILURE(rc))3183 if (RT_FAILURE(rc)) 3184 3184 goto out; 3185 3185 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 3186 3186 VMDK_DDB_IMAGE_UUID, &pImage->ImageUuid); 3187 if ( VBOX_FAILURE(rc))3187 if (RT_FAILURE(rc)) 3188 3188 { 3189 3189 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image UUID in new descriptor in '%s'"), pImage->pszFilename); … … 3193 3193 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 3194 3194 VMDK_DDB_PARENT_UUID, &pImage->ParentUuid); 3195 if ( VBOX_FAILURE(rc))3195 if (RT_FAILURE(rc)) 3196 3196 { 3197 3197 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent image UUID in new descriptor in '%s'"), pImage->pszFilename); … … 3202 3202 VMDK_DDB_MODIFICATION_UUID, 3203 3203 &pImage->ModificationUuid); 3204 if ( VBOX_FAILURE(rc))3204 if (RT_FAILURE(rc)) 3205 3205 { 3206 3206 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing modification UUID in new descriptor in '%s'"), pImage->pszFilename); … … 3211 3211 VMDK_DDB_PARENT_MODIFICATION_UUID, 3212 3212 &pImage->ParentModificationUuid); 3213 if ( VBOX_FAILURE(rc))3213 if (RT_FAILURE(rc)) 3214 3214 { 3215 3215 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent modification UUID in new descriptor in '%s'"), pImage->pszFilename); … … 3218 3218 3219 3219 rc = vmdkAllocateGrainTableCache(pImage); 3220 if ( VBOX_FAILURE(rc))3220 if (RT_FAILURE(rc)) 3221 3221 goto out; 3222 3222 3223 3223 rc = vmdkSetImageComment(pImage, pszComment); 3224 if ( VBOX_FAILURE(rc))3224 if (RT_FAILURE(rc)) 3225 3225 { 3226 3226 rc = vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: cannot set image comment in '%s'"), pImage->pszFilename); … … 3228 3228 } 3229 3229 3230 if ( VBOX_SUCCESS(rc) && pfnProgress)3230 if (RT_SUCCESS(rc) && pfnProgress) 3231 3231 pfnProgress(NULL /* WARNING! pVM=NULL */, 3232 3232 uPercentStart + uPercentSpan * 99 / 100, pvUser); … … 3235 3235 3236 3236 out: 3237 if ( VBOX_SUCCESS(rc) && pfnProgress)3237 if (RT_SUCCESS(rc) && pfnProgress) 3238 3238 pfnProgress(NULL /* WARNING! pVM=NULL */, 3239 3239 uPercentStart + uPercentSpan, pvUser); 3240 3240 3241 if ( VBOX_FAILURE(rc))3241 if (RT_FAILURE(rc)) 3242 3242 vmdkFreeImage(pImage, rc != VERR_ALREADY_EXISTS); 3243 3243 return rc; … … 3262 3262 if (pszComment) 3263 3263 RTStrFree(pszCommentEncoded); 3264 if ( VBOX_FAILURE(rc))3264 if (RT_FAILURE(rc)) 3265 3265 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image comment in descriptor in '%s'"), pImage->pszFilename); 3266 3266 return VINF_SUCCESS; … … 3320 3320 { 3321 3321 rc = vmdkWriteDescriptor(pImage); 3322 if ( VBOX_FAILURE(rc))3322 if (RT_FAILURE(rc)) 3323 3323 goto out; 3324 3324 } … … 3333 3333 case VMDKETYPE_HOSTED_SPARSE: 3334 3334 rc = vmdkWriteMetaSparseExtent(pExtent); 3335 if ( VBOX_FAILURE(rc))3335 if (RT_FAILURE(rc)) 3336 3336 goto out; 3337 3337 break; … … 3451 3451 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 3452 3452 aGTDataTmp, sizeof(aGTDataTmp), NULL); 3453 if ( VBOX_FAILURE(rc))3453 if (RT_FAILURE(rc)) 3454 3454 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot read grain table entry in '%s'"), pExtent->pszFullname); 3455 3455 pGTCacheEntry->uExtent = pExtent->uExtent; … … 3498 3498 * a new grain table and put the reference to it in the GDs. */ 3499 3499 rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize); 3500 if ( VBOX_FAILURE(rc))3500 if (RT_FAILURE(rc)) 3501 3501 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname); 3502 3502 Assert(!(cbExtentSize % 512)); … … 3519 3519 VMDK_SECTOR2BYTE(uGTSector) + i * sizeof(aGTDataTmp), 3520 3520 aGTDataTmp, sizeof(aGTDataTmp), NULL); 3521 if ( VBOX_FAILURE(rc))3521 if (RT_FAILURE(rc)) 3522 3522 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write grain table allocation in '%s'"), pExtent->pszFullname); 3523 3523 } … … 3526 3526 AssertReturn(!uRGTSector, VERR_VDI_INVALID_HEADER); 3527 3527 rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize); 3528 if ( VBOX_FAILURE(rc))3528 if (RT_FAILURE(rc)) 3529 3529 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname); 3530 3530 Assert(!(cbExtentSize % 512)); … … 3546 3546 VMDK_SECTOR2BYTE(uRGTSector) + i * sizeof(aGTDataTmp), 3547 3547 aGTDataTmp, sizeof(aGTDataTmp), NULL); 3548 if ( VBOX_FAILURE(rc))3548 if (RT_FAILURE(rc)) 3549 3549 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain table allocation in '%s'"), pExtent->pszFullname); 3550 3550 } … … 3559 3559 VMDK_SECTOR2BYTE(pExtent->uSectorGD) + uGDIndex * sizeof(uGTSectorLE), 3560 3560 &uGTSectorLE, sizeof(uGTSectorLE), NULL); 3561 if ( VBOX_FAILURE(rc))3561 if (RT_FAILURE(rc)) 3562 3562 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write grain directory entry in '%s'"), pExtent->pszFullname); 3563 3563 if (pExtent->pRGD) … … 3567 3567 VMDK_SECTOR2BYTE(pExtent->uSectorRGD) + uGDIndex * sizeof(uRGTSectorLE), 3568 3568 &uRGTSectorLE, sizeof(uRGTSectorLE), NULL); 3569 if ( VBOX_FAILURE(rc))3569 if (RT_FAILURE(rc)) 3570 3570 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write backup grain directory entry in '%s'"), pExtent->pszFullname); 3571 3571 } … … 3578 3578 3579 3579 rc = vmdkFileGetSize(pExtent->pFile, &cbExtentSize); 3580 if ( VBOX_FAILURE(rc))3580 if (RT_FAILURE(rc)) 3581 3581 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: error getting size in '%s'"), pExtent->pszFullname); 3582 3582 Assert(!(cbExtentSize % 512)); … … 3584 3584 /* Write the data. */ 3585 3585 rc = vmdkFileWriteAt(pExtent->pFile, cbExtentSize, pvBuf, cbWrite, NULL); 3586 if ( VBOX_FAILURE(rc))3586 if (RT_FAILURE(rc)) 3587 3587 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write allocated data block in '%s'"), pExtent->pszFullname); 3588 3588 … … 3598 3598 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 3599 3599 aGTDataTmp, sizeof(aGTDataTmp), NULL); 3600 if ( VBOX_FAILURE(rc))3600 if (RT_FAILURE(rc)) 3601 3601 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot read allocated grain table entry in '%s'"), pExtent->pszFullname); 3602 3602 pGTCacheEntry->uExtent = pExtent->uExtent; … … 3619 3619 VMDK_SECTOR2BYTE(uGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 3620 3620 aGTDataTmp, sizeof(aGTDataTmp), NULL); 3621 if ( VBOX_FAILURE(rc))3621 if (RT_FAILURE(rc)) 3622 3622 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write updated grain table in '%s'"), pExtent->pszFullname); 3623 3623 if (pExtent->pRGD) … … 3627 3627 VMDK_SECTOR2BYTE(uRGTSector) + (uGTBlock % (pExtent->cGTEntries / VMDK_GT_CACHELINE_SIZE)) * sizeof(aGTDataTmp), 3628 3628 aGTDataTmp, sizeof(aGTDataTmp), NULL); 3629 if ( VBOX_FAILURE(rc))3629 if (RT_FAILURE(rc)) 3630 3630 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write updated backup grain table in '%s'"), pExtent->pszFullname); 3631 3631 } 3632 3632 #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) 3634 3634 { 3635 3635 pExtent->uFreeSector = uGTSector + VMDK_BYTE2SECTOR(cbWrite); … … 3733 3733 3734 3734 rc = vmdkOpenImage(pImage, uOpenFlags); 3735 if ( VBOX_SUCCESS(rc))3735 if (RT_SUCCESS(rc)) 3736 3736 *ppBackendData = pImage; 3737 3737 … … 3809 3809 pPCHSGeometry, pLCHSGeometry, 3810 3810 pfnProgress, pvUser, uPercentStart, uPercentSpan); 3811 if ( VBOX_SUCCESS(rc))3811 if (RT_SUCCESS(rc)) 3812 3812 { 3813 3813 /* So far the image is opened in read/write mode. Make sure the … … 3817 3817 vmdkFreeImage(pImage, false); 3818 3818 rc = vmdkOpenImage(pImage, uOpenFlags); 3819 if ( VBOX_FAILURE(rc))3819 if (RT_FAILURE(rc)) 3820 3820 goto out; 3821 3821 } … … 3895 3895 * with zeros. We actually save stuff when and if we change it. 3896 3896 */ 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*)); 3900 3900 if (!apszOldName || !apszNewName || !apszNewLines) 3901 3901 { … … 3954 3954 pImage->Descriptor.aLines[line] = apszNewLines[i]; 3955 3955 /* Compose new name for the extent. */ 3956 apszNewName[i] = vmdkStrReplace(pExtent->pszFullname, 3956 apszNewName[i] = vmdkStrReplace(pExtent->pszFullname, 3957 3957 pszOldBasename, pszNewBasename); 3958 3958 if (!apszNewName[i]) … … 3962 3962 /* Rename the extent file. */ 3963 3963 rc = RTFileMove(pExtent->pszFullname, apszNewName[i], 0); 3964 if ( VBOX_FAILURE(rc))3964 if (RT_FAILURE(rc)) 3965 3965 goto rollback; 3966 3966 /* Remember the old name. */ … … 3979 3979 */ 3980 3980 apszNewName[cExtents] = RTPathFilename(pszFilename); 3981 /* Rename the descriptor file if it's separate. */ 3981 /* Rename the descriptor file if it's separate. */ 3982 3982 if (!fEmbeddedDesc) 3983 3983 { 3984 3984 rc = RTFileMove(pImage->pszFilename, apszNewName[cExtents], 0); 3985 if ( VBOX_FAILURE(rc))3985 if (RT_FAILURE(rc)) 3986 3986 goto rollback; 3987 3987 /* Save old name only if we may need to change it back. */ … … 3994 3994 /* Open the new image. */ 3995 3995 rc = vmdkOpenImage(pImage, pImage->uOpenFlags); 3996 if ( VBOX_SUCCESS(rc))3996 if (RT_SUCCESS(rc)) 3997 3997 goto out; 3998 3998 3999 3999 rollback: 4000 4000 /* Roll back all changes in case of failure. */ 4001 if ( VBOX_FAILURE(rc))4001 if (RT_FAILURE(rc)) 4002 4002 { 4003 4003 int rrc; … … 4005 4005 { 4006 4006 /* 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. 4009 4009 */ 4010 4010 vmdkFreeImage(pImage, false); … … 4099 4099 rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset), 4100 4100 &pExtent, &uSectorExtentRel); 4101 if ( VBOX_FAILURE(rc))4101 if (RT_FAILURE(rc)) 4102 4102 goto out; 4103 4103 … … 4121 4121 rc = vmdkGetSector(pImage->pGTCache, pExtent, uSectorExtentRel, 4122 4122 &uSectorExtentAbs); 4123 if ( VBOX_FAILURE(rc))4123 if (RT_FAILURE(rc)) 4124 4124 goto out; 4125 4125 /* Clip read range to at most the rest of the grain. */ … … 4186 4186 rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset), 4187 4187 &pExtent, &uSectorExtentRel); 4188 if ( VBOX_FAILURE(rc))4188 if (RT_FAILURE(rc)) 4189 4189 goto out; 4190 4190 … … 4205 4205 rc = vmdkGetSector(pImage->pGTCache, pExtent, uSectorExtentRel, 4206 4206 &uSectorExtentAbs); 4207 if ( VBOX_FAILURE(rc))4207 if (RT_FAILURE(rc)) 4208 4208 goto out; 4209 4209 /* Clip write range to at most the rest of the grain. */ … … 4266 4266 PVMDKIMAGE pImage = (PVMDKIMAGE)pBackendData; 4267 4267 int rc; 4268 4268 4269 4269 Assert(pImage); 4270 4270 … … 4336 4336 { 4337 4337 int rc = vmdkFileGetSize(pImage->pFile, &cbFile); 4338 if ( VBOX_SUCCESS(rc))4338 if (RT_SUCCESS(rc)) 4339 4339 cb += cbFile; 4340 4340 for (unsigned i = 0; i <= pImage->cExtents; i++) 4341 4341 { 4342 4342 rc = vmdkFileGetSize(pImage->pFile, &cbFile); 4343 if ( VBOX_SUCCESS(rc))4343 if (RT_SUCCESS(rc)) 4344 4344 cb += cbFile; 4345 4345 } … … 4396 4396 } 4397 4397 rc = vmdkDescSetPCHSGeometry(pImage, pPCHSGeometry); 4398 if ( VBOX_FAILURE(rc))4398 if (RT_FAILURE(rc)) 4399 4399 goto out; 4400 4400 … … 4455 4455 } 4456 4456 rc = vmdkDescSetLCHSGeometry(pImage, pLCHSGeometry); 4457 if ( VBOX_FAILURE(rc))4457 if (RT_FAILURE(rc)) 4458 4458 goto out; 4459 4459 … … 4546 4546 if (rc == VERR_VDI_VALUE_NOT_FOUND) 4547 4547 pszCommentEncoded = NULL; 4548 else if ( VBOX_FAILURE(rc))4548 else if (RT_FAILURE(rc)) 4549 4549 goto out; 4550 4550 … … 4627 4627 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 4628 4628 VMDK_DDB_IMAGE_UUID, pUuid); 4629 if ( VBOX_FAILURE(rc))4629 if (RT_FAILURE(rc)) 4630 4630 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing image UUID in descriptor in '%s'"), pImage->pszFilename); 4631 4631 rc = VINF_SUCCESS; … … 4678 4678 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 4679 4679 VMDK_DDB_MODIFICATION_UUID, pUuid); 4680 if ( VBOX_FAILURE(rc))4680 if (RT_FAILURE(rc)) 4681 4681 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing modification UUID in descriptor in '%s'"), pImage->pszFilename); 4682 4682 rc = VINF_SUCCESS; … … 4729 4729 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 4730 4730 VMDK_DDB_PARENT_UUID, pUuid); 4731 if ( VBOX_FAILURE(rc))4731 if (RT_FAILURE(rc)) 4732 4732 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent image UUID in descriptor in '%s'"), pImage->pszFilename); 4733 4733 rc = VINF_SUCCESS; … … 4780 4780 rc = vmdkDescDDBSetUuid(pImage, &pImage->Descriptor, 4781 4781 VMDK_DDB_PARENT_MODIFICATION_UUID, pUuid); 4782 if ( VBOX_FAILURE(rc))4782 if (RT_FAILURE(rc)) 4783 4783 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: error storing parent image UUID in descriptor in '%s'"), pImage->pszFilename); 4784 4784 rc = VINF_SUCCESS; … … 4901 4901 rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset), 4902 4902 &pExtent, &uSectorExtentRel); 4903 if ( VBOX_FAILURE(rc))4903 if (RT_FAILURE(rc)) 4904 4904 goto out; 4905 4905 … … 4923 4923 void *pTask; 4924 4924 rc = pImage->pInterfaceAsyncIOCallbacks->pfnPrepareRead(pImage->pInterfaceAsyncIO->pvUser, pExtent->pFile->pStorage, 4925 VMDK_SECTOR2BYTE(uSectorExtentRel), 4925 VMDK_SECTOR2BYTE(uSectorExtentRel), 4926 4926 (uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment, 4927 4927 cbToRead, &pTask); 4928 if ( VBOX_FAILURE(rc))4928 if (RT_FAILURE(rc)) 4929 4929 { 4930 4930 AssertMsgFailed(("Preparing read failed rc=%Vrc\n", rc)); … … 4966 4966 } 4967 4967 case VMDKETYPE_ZERO: 4968 memset((uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment, 0, cbToRead); 4968 memset((uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment, 0, cbToRead); 4969 4969 break; 4970 4970 default: … … 5000 5000 NULL, pvUser, 5001 5001 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)); 5003 5003 } 5004 5004 … … 5037 5037 rc = vmdkFindExtent(pImage, VMDK_BYTE2SECTOR(uOffset), 5038 5038 &pExtent, &uSectorExtentRel); 5039 if ( VBOX_FAILURE(rc))5039 if (RT_FAILURE(rc)) 5040 5040 goto out; 5041 5041 … … 5059 5059 void *pTask; 5060 5060 rc = pImage->pInterfaceAsyncIOCallbacks->pfnPrepareWrite(pImage->pInterfaceAsyncIO->pvUser, pExtent->pFile->pStorage, 5061 VMDK_SECTOR2BYTE(uSectorExtentRel), 5061 VMDK_SECTOR2BYTE(uSectorExtentRel), 5062 5062 (uint8_t *)paSegCurrent->pvSeg + uOffsetInCurrentSegment, 5063 5063 cbToWrite, &pTask); 5064 if ( VBOX_FAILURE(rc))5064 if (RT_FAILURE(rc)) 5065 5065 { 5066 5066 AssertMsgFailed(("Preparing read failed rc=%Vrc\n", rc)); … … 5134 5134 rc = pImage->pInterfaceAsyncIOCallbacks->pfnTasksSubmit(pImage->pInterfaceAsyncIO->pvUser, 5135 5135 pImage->apTask, cTasksToSubmit, 5136 NULL, pvUser, 5136 NULL, pvUser, 5137 5137 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)); 5139 5139 } 5140 5140 -
trunk/src/VBox/Devices/Storage/fdc.c
r8155 r11266 1313 1313 rc = PDMDevHlpDMAReadMemory (fdctrl->pDevIns, nchan, tmpbuf, 1314 1314 fdctrl->data_pos, len, &read); 1315 AssertMsg ( VBOX_SUCCESS (rc), ("DMAReadMemory -> %Vrc\n", rc));1315 AssertMsg (RT_SUCCESS (rc), ("DMAReadMemory -> %Vrc\n", rc)); 1316 1316 #else 1317 1317 DMA_read_memory (nchan, tmpbuf, fdctrl->data_pos, len); … … 2579 2579 */ 2580 2580 rc = PDMDevHlpDriverAttach (pDevIns, drv->iLUN, &drv->IBase, &drv->pDrvBase, descs[drv->iLUN]); 2581 if ( VBOX_SUCCESS (rc)) {2581 if (RT_SUCCESS (rc)) { 2582 2582 drv->pDrvBlock = drv->pDrvBase->pfnQueryInterface ( 2583 2583 drv->pDrvBase, … … 2687 2687 AssertMsg (rc != VERR_PDM_NO_ATTACHED_DRIVER, 2688 2688 ("Configuration error: failed to configure drive %d, rc=%Vrc\n", rc)); 2689 if ( VBOX_SUCCESS(rc)) {2689 if (RT_SUCCESS(rc)) { 2690 2690 fd_revalidate (drv); 2691 2691 } … … 2899 2899 */ 2900 2900 rc = PDMDevHlpDriverAttach (pDevIns, PDM_STATUS_LUN, &fdctrl->IBaseStatus, &pBase, "Status Port"); 2901 if ( VBOX_SUCCESS (rc)) {2901 if (RT_SUCCESS (rc)) { 2902 2902 fdctrl->pLedsConnector = 2903 2903 pBase->pfnQueryInterface (pBase, PDMINTERFACE_LED_CONNECTORS);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器