Changeset 11266 in vbox for trunk/src/VBox
- Timestamp:
- Aug 8, 2008 4:14:51 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 34348
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r11167 r11266 1403 1403 ichac97IOPortNABMWrite, ichac97IOPortNABMRead, 1404 1404 NULL, NULL, "ICHAC97 NABM"); 1405 if ( VBOX_FAILURE(rc))1405 if (RT_FAILURE(rc)) 1406 1406 return rc; 1407 1407 … … 1622 1622 */ 1623 1623 rc = PDMDevHlpPCIRegister (pDevIns, &pData->dev); 1624 if ( VBOX_FAILURE (rc))1624 if (RT_FAILURE (rc)) 1625 1625 return rc; 1626 1626 1627 1627 rc = PDMDevHlpPCIIORegionRegister (pDevIns, 0, 256, PCI_ADDRESS_SPACE_IO, 1628 1628 ichac97IOPortMap); 1629 if ( VBOX_FAILURE (rc))1629 if (RT_FAILURE (rc)) 1630 1630 return rc; 1631 1631 1632 1632 rc = PDMDevHlpPCIIORegionRegister (pDevIns, 1, 64, PCI_ADDRESS_SPACE_IO, 1633 1633 ichac97IOPortMap); 1634 if ( VBOX_FAILURE (rc))1634 if (RT_FAILURE (rc)) 1635 1635 return rc; 1636 1636 … … 1639 1639 NULL, ichac97SaveExec, NULL, 1640 1640 NULL, ichac97LoadExec, NULL); 1641 if ( VBOX_FAILURE (rc))1641 if (RT_FAILURE (rc)) 1642 1642 return rc; 1643 1643 … … 1649 1649 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 1650 1650 Log (("ac97: No attached driver!\n")); 1651 else if ( VBOX_FAILURE (rc))1651 else if (RT_FAILURE (rc)) 1652 1652 { 1653 1653 AssertMsgFailed (("Failed to attach AC97 LUN #0! rc=%Vrc\n", rc)); -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r11168 r11266 1747 1747 */ 1748 1748 rc = CFGMR3QuerySIntDef(pCfgHandle, "IRQ", &s->irq, 5); 1749 if ( VBOX_FAILURE(rc))1749 if (RT_FAILURE(rc)) 1750 1750 return PDMDEV_SET_ERROR(pDevIns, rc, 1751 1751 N_("Configuration error: Failed to get the \"IRQ\" value")); 1752 1752 1753 1753 rc = CFGMR3QuerySIntDef(pCfgHandle, "DMA", &s->dma, 1); 1754 if ( VBOX_FAILURE(rc))1754 if (RT_FAILURE(rc)) 1755 1755 return PDMDEV_SET_ERROR(pDevIns, rc, 1756 1756 N_("Configuration error: Failed to get the \"DMA\" value")); 1757 1757 1758 1758 rc = CFGMR3QuerySIntDef(pCfgHandle, "DMA16", &s->hdma, 5); 1759 if ( VBOX_FAILURE(rc))1759 if (RT_FAILURE(rc)) 1760 1760 return PDMDEV_SET_ERROR(pDevIns, rc, 1761 1761 N_("Configuration error: Failed to get the \"DMA16\" value")); … … 1763 1763 RTIOPORT Port; 1764 1764 rc = CFGMR3QueryPortDef(pCfgHandle, "Port", &Port, 0x220); 1765 if ( VBOX_FAILURE(rc))1765 if (RT_FAILURE(rc)) 1766 1766 return PDMDEV_SET_ERROR(pDevIns, rc, 1767 1767 N_("Configuration error: Failed to get the \"Port\" value")); … … 1770 1770 uint16_t u16Version; 1771 1771 rc = CFGMR3QueryU16Def(pCfgHandle, "Version", &u16Version, 0x0405); 1772 if ( VBOX_FAILURE(rc))1772 if (RT_FAILURE(rc)) 1773 1773 return PDMDEV_SET_ERROR(pDevIns, rc, 1774 1774 N_("Configuration error: Failed to get the \"Version\" value")); … … 1795 1795 */ 1796 1796 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, sb16Timer, "SB16 timer", &s->pTimer); 1797 if ( VBOX_FAILURE(rc))1797 if (RT_FAILURE(rc)) 1798 1798 AssertMsgFailedReturn(("pfnTMTimerCreate -> %Vrc\n", rc), rc); 1799 1799 1800 1800 rc = PDMDevHlpIOPortRegister(pDevIns, s->port + 0x04, 2, s, 1801 1801 mixer_write, mixer_read, NULL, NULL, "SB16"); 1802 if ( VBOX_FAILURE(rc))1802 if (RT_FAILURE(rc)) 1803 1803 return rc; 1804 1804 rc = PDMDevHlpIOPortRegister(pDevIns, s->port + 0x06, 10, s, 1805 1805 dsp_write, dsp_read, NULL, NULL, "SB16"); 1806 if ( VBOX_FAILURE(rc))1806 if (RT_FAILURE(rc)) 1807 1807 return rc; 1808 1808 1809 1809 rc = PDMDevHlpDMARegister(pDevIns, s->hdma, SB_read_DMA, s); 1810 if ( VBOX_FAILURE(rc))1810 if (RT_FAILURE(rc)) 1811 1811 return rc; 1812 1812 rc = PDMDevHlpDMARegister(pDevIns, s->dma, SB_read_DMA, s); 1813 if ( VBOX_FAILURE(rc))1813 if (RT_FAILURE(rc)) 1814 1814 return rc; 1815 1815 … … 1818 1818 rc = PDMDevHlpSSMRegister(pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, SB16_SSM_VERSION, 1819 1819 sizeof(*s), NULL, SaveExec, NULL, NULL, LoadExec, NULL); 1820 if ( VBOX_FAILURE(rc))1820 if (RT_FAILURE(rc)) 1821 1821 return rc; 1822 1822 … … 1824 1824 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 1825 1825 Log(("sb16: No attached driver!\n")); 1826 else if ( VBOX_FAILURE(rc))1826 else if (RT_FAILURE(rc)) 1827 1827 AssertMsgFailedReturn(("Failed to attach SB16 LUN #0! rc=%Vrc\n", rc), rc); 1828 1828 -
trunk/src/VBox/Devices/Audio/audio.c
r8132 r11266 1628 1628 rc = pDrvIns->pDrvHlp->pfnTMTimerCreate (pDrvIns, TMCLOCK_VIRTUAL, 1629 1629 audio_timer_helper, "Audio timer", &s->ts); 1630 if ( VBOX_FAILURE (rc))1630 if (RT_FAILURE (rc)) 1631 1631 return rc; 1632 1632 … … 2002 2002 2003 2003 rc = CFGMR3QueryStringAlloc (pCfgHandle, "AudioDriver", &drvname); 2004 if ( VBOX_FAILURE (rc))2004 if (RT_FAILURE (rc)) 2005 2005 return rc; 2006 2006 2007 2007 rc = CFGMR3QueryStringAlloc (pCfgHandle, "StreamName", &audio_streamname); 2008 if ( VBOX_FAILURE (rc))2008 if (RT_FAILURE (rc)) 2009 2009 audio_streamname = NULL; 2010 2010 2011 2011 rc = AUD_init (pDrvIns, drvname); 2012 if ( VBOX_FAILURE (rc))2012 if (RT_FAILURE (rc)) 2013 2013 return rc; 2014 2014 -
trunk/src/VBox/Devices/Audio/audiosniffer.c
r8155 r11266 196 196 rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->Base, &pData->pDrvBase, "Audio Sniffer Port"); 197 197 198 if ( VBOX_SUCCESS(rc))198 if (RT_SUCCESS(rc)) 199 199 { 200 200 pData->pDrv = (PPDMIAUDIOSNIFFERCONNECTOR)pData->pDrvBase->pfnQueryInterface(pData->pDrvBase, PDMINTERFACE_AUDIO_SNIFFER_CONNECTOR); … … 216 216 } 217 217 218 if ( VBOX_SUCCESS (rc))218 if (RT_SUCCESS (rc)) 219 219 { 220 220 /* Save PDM device instance data for future reference. */ -
trunk/src/VBox/Devices/Builtins.cpp
r9124 r11266 59 59 60 60 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCI); 61 if ( VBOX_FAILURE(rc))61 if (RT_FAILURE(rc)) 62 62 return rc; 63 63 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcArch); 64 if ( VBOX_FAILURE(rc))64 if (RT_FAILURE(rc)) 65 65 return rc; 66 66 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePcBios); 67 if ( VBOX_FAILURE(rc))67 if (RT_FAILURE(rc)) 68 68 return rc; 69 69 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePS2KeyboardMouse); 70 if ( VBOX_FAILURE(rc))70 if (RT_FAILURE(rc)) 71 71 return rc; 72 72 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePIIX3IDE); 73 if ( VBOX_FAILURE(rc))73 if (RT_FAILURE(rc)) 74 74 return rc; 75 75 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8254); 76 if ( VBOX_FAILURE(rc))76 if (RT_FAILURE(rc)) 77 77 return rc; 78 78 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceI8259); 79 if ( VBOX_FAILURE(rc))79 if (RT_FAILURE(rc)) 80 80 return rc; 81 81 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceMC146818); 82 if ( VBOX_FAILURE(rc))82 if (RT_FAILURE(rc)) 83 83 return rc; 84 84 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVga); 85 if ( VBOX_FAILURE(rc))85 if (RT_FAILURE(rc)) 86 86 return rc; 87 87 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVMMDev); 88 if ( VBOX_FAILURE(rc))88 if (RT_FAILURE(rc)) 89 89 return rc; 90 90 rc = pCallbacks->pfnRegister(pCallbacks, &g_DevicePCNet); 91 if ( VBOX_FAILURE(rc))91 if (RT_FAILURE(rc)) 92 92 return rc; 93 93 #ifdef VBOX_WITH_E1000 94 94 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceE1000); 95 if ( VBOX_FAILURE(rc))95 if (RT_FAILURE(rc)) 96 96 return rc; 97 97 #endif 98 98 #ifdef VBOX_WITH_INIP 99 99 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceINIP); 100 if ( VBOX_FAILURE(rc))100 if (RT_FAILURE(rc)) 101 101 return rc; 102 102 #endif 103 103 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICHAC97); 104 if ( VBOX_FAILURE(rc))104 if (RT_FAILURE(rc)) 105 105 return rc; 106 106 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSB16); 107 if ( VBOX_FAILURE(rc))107 if (RT_FAILURE(rc)) 108 108 return rc; 109 109 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer); 110 if ( VBOX_FAILURE(rc))110 if (RT_FAILURE(rc)) 111 111 return rc; 112 112 #ifdef VBOX_WITH_USB 113 113 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI); 114 if ( VBOX_FAILURE(rc))114 if (RT_FAILURE(rc)) 115 115 return rc; 116 116 #endif 117 117 #ifdef VBOX_WITH_EHCI 118 118 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceEHCI); 119 if ( VBOX_FAILURE(rc))119 if (RT_FAILURE(rc)) 120 120 return rc; 121 121 #endif 122 122 #ifdef VBOX_ACPI 123 123 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI); 124 if ( VBOX_FAILURE(rc))124 if (RT_FAILURE(rc)) 125 125 return rc; 126 126 #endif 127 127 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceDMA); 128 if ( VBOX_FAILURE(rc))128 if (RT_FAILURE(rc)) 129 129 return rc; 130 130 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceFloppyController); 131 if ( VBOX_FAILURE(rc))131 if (RT_FAILURE(rc)) 132 132 return rc; 133 133 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceSerialPort); 134 if ( VBOX_FAILURE(rc))134 if (RT_FAILURE(rc)) 135 135 return rc; 136 136 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceParallelPort); 137 if ( VBOX_FAILURE(rc))137 if (RT_FAILURE(rc)) 138 138 return rc; 139 139 #ifdef VBOX_WITH_AHCI 140 140 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAHCI); 141 if ( VBOX_FAILURE(rc))141 if (RT_FAILURE(rc)) 142 142 return rc; 143 143 #endif … … 160 160 161 161 int rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMouseQueue); 162 if ( VBOX_FAILURE(rc))162 if (RT_FAILURE(rc)) 163 163 return rc; 164 164 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvKeyboardQueue); 165 if ( VBOX_FAILURE(rc))165 if (RT_FAILURE(rc)) 166 166 return rc; 167 167 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvBlock); 168 if ( VBOX_FAILURE(rc))168 if (RT_FAILURE(rc)) 169 169 return rc; 170 170 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVBoxHDD); 171 if ( VBOX_FAILURE(rc))171 if (RT_FAILURE(rc)) 172 172 return rc; 173 173 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVD); 174 if ( VBOX_FAILURE(rc))174 if (RT_FAILURE(rc)) 175 175 return rc; 176 176 #if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) 177 177 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDVD); 178 if ( VBOX_FAILURE(rc))178 if (RT_FAILURE(rc)) 179 179 return rc; 180 180 #endif 181 181 #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) 182 182 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostFloppy); 183 if ( VBOX_FAILURE(rc))183 if (RT_FAILURE(rc)) 184 184 return rc; 185 185 #endif 186 186 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvMediaISO); 187 if ( VBOX_FAILURE(rc))187 if (RT_FAILURE(rc)) 188 188 return rc; 189 189 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImage); 190 if ( VBOX_FAILURE(rc))190 if (RT_FAILURE(rc)) 191 191 return rc; 192 192 #ifdef VBOX_WITH_ISCSI 193 193 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSI); 194 if ( VBOX_FAILURE(rc))194 if (RT_FAILURE(rc)) 195 195 return rc; 196 196 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvISCSITransportTcp); 197 if ( VBOX_FAILURE(rc))197 if (RT_FAILURE(rc)) 198 198 return rc; 199 199 #endif 200 200 #ifndef RT_OS_L4 201 201 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNAT); 202 if ( VBOX_FAILURE(rc))202 if (RT_FAILURE(rc)) 203 203 return rc; 204 204 #endif 205 205 #if defined(RT_OS_L4) || defined(RT_OS_LINUX) || defined(RT_OS_OS2) || (defined(RT_OS_SOLARIS) && !defined(RT_OS_SOLARIS_10)) || defined(RT_OS_WINDOWS) 206 206 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostInterface); 207 if ( VBOX_FAILURE(rc))207 if (RT_FAILURE(rc)) 208 208 return rc; 209 209 #endif 210 210 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvIntNet); 211 if ( VBOX_FAILURE(rc))211 if (RT_FAILURE(rc)) 212 212 return rc; 213 213 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNetSniffer); 214 if ( VBOX_FAILURE(rc))214 if (RT_FAILURE(rc)) 215 215 return rc; 216 216 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO); 217 if ( VBOX_FAILURE(rc))217 if (RT_FAILURE(rc)) 218 218 return rc; 219 219 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI); 220 if ( VBOX_FAILURE(rc))220 if (RT_FAILURE(rc)) 221 221 return rc; 222 222 223 223 #ifdef VBOX_WITH_USB 224 224 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvVUSBRootHub); 225 if ( VBOX_FAILURE(rc))225 if (RT_FAILURE(rc)) 226 226 return rc; 227 227 #endif … … 229 229 #if !defined(RT_OS_L4) 230 230 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe); 231 if ( VBOX_FAILURE(rc))231 if (RT_FAILURE(rc)) 232 232 return rc; 233 233 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvChar); 234 if ( VBOX_FAILURE(rc))234 if (RT_FAILURE(rc)) 235 235 return rc; 236 236 #endif … … 238 238 #if defined(RT_OS_LINUX) 239 239 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostParallel); 240 if ( VBOX_FAILURE(rc))240 if (RT_FAILURE(rc)) 241 241 return rc; 242 242 #endif … … 244 244 #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS) 245 245 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSerial); 246 if ( VBOX_FAILURE(rc))246 if (RT_FAILURE(rc)) 247 247 return rc; 248 248 #endif … … 250 250 #if defined(VBOX_WITH_PDM_ASYNC_COMPLETION) 251 251 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawImageAsync); 252 if ( VBOX_FAILURE(rc))252 if (RT_FAILURE(rc)) 253 253 return rc; 254 254 255 255 rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTransportAsync); 256 if ( VBOX_FAILURE(rc))256 if (RT_FAILURE(rc)) 257 257 return rc; 258 258 #endif … … 273 273 { 274 274 int rc = pCallbacks->pfnRegister(pCallbacks, &g_UsbDevProxy); 275 if ( VBOX_FAILURE(rc))275 if (RT_FAILURE(rc)) 276 276 return rc; 277 277 -
trunk/src/VBox/Devices/Builtins2.cpp
r9693 r11266 63 63 64 64 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAPIC); 65 if ( VBOX_FAILURE(rc))65 if (RT_FAILURE(rc)) 66 66 return rc; 67 67 rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceIOAPIC); 68 if ( VBOX_FAILURE(rc))68 if (RT_FAILURE(rc)) 69 69 return rc; 70 70 -
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r11233 r11266 1018 1018 SSMR3PutMem(pSSMHandle, pDev->config, sizeof(pDev->config)); 1019 1019 rc = SSMR3PutS32(pSSMHandle, pDev->Int.s.iIrq); 1020 if ( VBOX_FAILURE(rc))1020 if (RT_FAILURE(rc)) 1021 1021 return rc; 1022 1022 } … … 1059 1059 /* separator */ 1060 1060 rc = SSMR3GetU32(pSSMHandle, &u32); 1061 if ( VBOX_FAILURE(rc))1061 if (RT_FAILURE(rc)) 1062 1062 return rc; 1063 1063 if (u32 != (uint32_t)~0) … … 1074 1074 /* index / terminator */ 1075 1075 rc = SSMR3GetU32(pSSMHandle, &u32); 1076 if ( VBOX_FAILURE(rc))1076 if (RT_FAILURE(rc)) 1077 1077 return rc; 1078 1078 if (u32 == (uint32_t)~0) … … 1100 1100 SSMR3GetMem(pSSMHandle, DevTmp.config, sizeof(DevTmp.config)); 1101 1101 rc = SSMR3GetS32(pSSMHandle, &DevTmp.Int.s.iIrq); 1102 if ( VBOX_FAILURE(rc))1102 if (RT_FAILURE(rc)) 1103 1103 return rc; 1104 1104 … … 1389 1389 { 1390 1390 AssertMsgFailed(("Writing to PIC failed!\n")); 1391 return VBOX_SUCCESS(rc) ? VERR_INTERNAL_ERROR : rc;1391 return RT_SUCCESS(rc) ? VERR_INTERNAL_ERROR : rc; 1392 1392 } 1393 1393 … … 1445 1445 bool fUseIoApic; 1446 1446 rc = CFGMR3QueryBoolDef(pCfgHandle, "IOAPIC", &fUseIoApic, false); 1447 if ( VBOX_FAILURE(rc))1447 if (RT_FAILURE(rc)) 1448 1448 return PDMDEV_SET_ERROR(pDevIns, rc, 1449 1449 N_("Configuration error: Failed to query boolean value \"IOAPIC\"")); … … 1452 1452 bool fGCEnabled; 1453 1453 rc = CFGMR3QueryBoolDef(pCfgHandle, "GCEnabled", &fGCEnabled, true); 1454 if ( VBOX_FAILURE(rc))1454 if (RT_FAILURE(rc)) 1455 1455 return PDMDEV_SET_ERROR(pDevIns, rc, 1456 1456 N_("Configuration error: Failed to query boolean value \"GCEnabled\"")); … … 1459 1459 bool fR0Enabled; 1460 1460 rc = CFGMR3QueryBoolDef(pCfgHandle, "R0Enabled", &fR0Enabled, true); 1461 if ( VBOX_FAILURE(rc))1461 if (RT_FAILURE(rc)) 1462 1462 return PDMDEV_SET_ERROR(pDevIns, rc, 1463 1463 N_("Configuration error: Failed to query boolean value \"R0Enabled\"")); … … 1492 1492 PciBusReg.pszSetIrqR0 = fR0Enabled ? "pciSetIrq" : NULL; 1493 1493 rc = pDevIns->pDevHlp->pfnPCIBusRegister(pDevIns, &PciBusReg, &pBus->pPciHlpR3); 1494 if ( VBOX_FAILURE(rc))1494 if (RT_FAILURE(rc)) 1495 1495 return PDMDEV_SET_ERROR(pDevIns, rc, 1496 1496 N_("Failed to register ourselves as a PCI Bus")); … … 1536 1536 */ 1537 1537 rc = PDMDevHlpIOPortRegister(pDevIns, 0x0cf8, 1, NULL, pciIOPortAddressWrite, pciIOPortAddressRead, NULL, NULL, "i440FX (PCI)"); 1538 if ( VBOX_FAILURE(rc))1538 if (RT_FAILURE(rc)) 1539 1539 return rc; 1540 1540 rc = PDMDevHlpIOPortRegister(pDevIns, 0x0cfc, 4, NULL, pciIOPortDataWrite, pciIOPortDataRead, NULL, NULL, "i440FX (PCI)"); 1541 if ( VBOX_FAILURE(rc))1541 if (RT_FAILURE(rc)) 1542 1542 return rc; 1543 1543 rc = PDMDevHlpSSMRegister(pDevIns, "pci", iInstance, 2, sizeof(*pBus), 1544 1544 NULL, pciSaveExec, NULL, NULL, pciLoadExec, NULL); 1545 if ( VBOX_FAILURE(rc))1545 if (RT_FAILURE(rc)) 1546 1546 return rc; 1547 1547 -
trunk/src/VBox/Devices/Input/DevPS2.cpp
r11196 r11266 1186 1186 */ 1187 1187 rc = SSMR3GetU32(f, &u32); 1188 if ( VBOX_FAILURE(rc))1188 if (RT_FAILURE(rc)) 1189 1189 return rc; 1190 1190 if (u32 > ELEMENTS(s->queue.data)) … … 1196 1196 { 1197 1197 rc = SSMR3GetU8(f, &s->queue.data[i]); 1198 if ( VBOX_FAILURE(rc))1198 if (RT_FAILURE(rc)) 1199 1199 return rc; 1200 1200 } … … 1204 1204 1205 1205 rc = SSMR3GetU32(f, &u32); 1206 if ( VBOX_FAILURE(rc))1206 if (RT_FAILURE(rc)) 1207 1207 return rc; 1208 1208 if (u32 > ELEMENTS(s->mouse_command_queue.data)) … … 1214 1214 { 1215 1215 rc = SSMR3GetU8(f, &s->mouse_command_queue.data[i]); 1216 if ( VBOX_FAILURE(rc))1216 if (RT_FAILURE(rc)) 1217 1217 return rc; 1218 1218 } … … 1222 1222 1223 1223 rc = SSMR3GetU32(f, &u32); 1224 if ( VBOX_FAILURE(rc))1224 if (RT_FAILURE(rc)) 1225 1225 return rc; 1226 1226 if (u32 > ELEMENTS(s->mouse_event_queue.data)) … … 1232 1232 { 1233 1233 rc = SSMR3GetU8(f, &s->mouse_event_queue.data[i]); 1234 if ( VBOX_FAILURE(rc))1234 if (RT_FAILURE(rc)) 1235 1235 return rc; 1236 1236 } … … 1241 1241 /* terminator */ 1242 1242 rc = SSMR3GetU32(f, &u32); 1243 if ( VBOX_FAILURE(rc))1243 if (RT_FAILURE(rc)) 1244 1244 return rc; 1245 1245 if (u32 != ~0U) -
trunk/src/VBox/Devices/Input/DrvKeyboardQueue.cpp
r8155 r11266 167 167 PDRVKBDQUEUEITEM pItem = (PDRVKBDQUEUEITEM)pItemCore; 168 168 int rc = pData->pUpPort->pfnPutEvent(pData->pUpPort, pItem->u8KeyCode); 169 return VBOX_SUCCESS(rc);169 return RT_SUCCESS(rc); 170 170 } 171 171 … … 284 284 PPDMIBASE pDownBase; 285 285 int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pDownBase); 286 if ( VBOX_FAILURE(rc))286 if (RT_FAILURE(rc)) 287 287 { 288 288 AssertMsgFailed(("Failed to attach driver below us! rc=%Vra\n", rc)); … … 303 303 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 304 304 cMilliesInterval = 0; 305 else if ( VBOX_FAILURE(rc))305 else if (RT_FAILURE(rc)) 306 306 { 307 307 AssertMsgFailed(("Configuration error: 32-bit \"Interval\" -> rc=%Vrc\n", rc)); … … 313 313 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 314 314 cItems = 128; 315 else if ( VBOX_FAILURE(rc))315 else if (RT_FAILURE(rc)) 316 316 { 317 317 AssertMsgFailed(("Configuration error: 32-bit \"QueueSize\" -> rc=%Vrc\n", rc)); … … 320 320 321 321 rc = pDrvIns->pDrvHlp->pfnPDMQueueCreate(pDrvIns, sizeof(DRVKBDQUEUEITEM), cItems, cMilliesInterval, drvKbdQueueConsumer, &pDrv->pQueue); 322 if ( VBOX_FAILURE(rc))322 if (RT_FAILURE(rc)) 323 323 { 324 324 AssertMsgFailed(("Failed to create driver: cItems=%d cMilliesInterval=%d rc=%Vrc\n", cItems, cMilliesInterval, rc)); -
trunk/src/VBox/Devices/Input/DrvMouseQueue.cpp
r9022 r11266 155 155 PDRVMOUSEQUEUEITEM pItem = (PDRVMOUSEQUEUEITEM)pItemCore; 156 156 int rc = pData->pUpPort->pfnPutEvent(pData->pUpPort, pItem->i32DeltaX, pItem->i32DeltaY, pItem->i32DeltaZ, pItem->fButtonStates); 157 return VBOX_SUCCESS(rc);157 return RT_SUCCESS(rc); 158 158 } 159 159 … … 270 270 PPDMIBASE pDownBase; 271 271 int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pDownBase); 272 if ( VBOX_FAILURE(rc))272 if (RT_FAILURE(rc)) 273 273 { 274 274 AssertMsgFailed(("Failed to attach driver below us! rc=%Vra\n", rc)); … … 289 289 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 290 290 cMilliesInterval = 0; 291 else if ( VBOX_FAILURE(rc))291 else if (RT_FAILURE(rc)) 292 292 { 293 293 AssertMsgFailed(("Configuration error: 32-bit \"Interval\" -> rc=%Vrc\n", rc)); … … 299 299 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 300 300 cItems = 128; 301 else if ( VBOX_FAILURE(rc))301 else if (RT_FAILURE(rc)) 302 302 { 303 303 AssertMsgFailed(("Configuration error: 32-bit \"QueueSize\" -> rc=%Vrc\n", rc)); … … 306 306 307 307 rc = pDrvIns->pDrvHlp->pfnPDMQueueCreate(pDrvIns, sizeof(DRVMOUSEQUEUEITEM), cItems, cMilliesInterval, drvMouseQueueConsumer, &pDrv->pQueue); 308 if ( VBOX_FAILURE(rc))308 if (RT_FAILURE(rc)) 309 309 { 310 310 AssertMsgFailed(("Failed to create driver: cItems=%d cMilliesInterval=%d rc=%Vrc\n", cItems, cMilliesInterval, rc)); -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r11259 r11266 461 461 */ 462 462 rc = drvIntNetAsyncIoWaitForSpace(pThis); 463 if ( VBOX_FAILURE(rc))463 if (RT_FAILURE(rc)) 464 464 { 465 465 STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a); … … 497 497 STAM_PROFILE_ADV_STOP(&pThis->StatReceive, a); 498 498 int rc = pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_IF_WAIT, &WaitReq, sizeof(WaitReq)); 499 if ( VBOX_FAILURE(rc)499 if ( RT_FAILURE(rc) 500 500 && rc != VERR_TIMEOUT 501 501 && rc != VERR_INTERRUPTED) … … 533 533 { 534 534 int rc = RTSemEventWait(pThis->EventSuspended, 30000); 535 if ( VBOX_FAILURE(rc)535 if ( RT_FAILURE(rc) 536 536 && rc != VERR_TIMEOUT) 537 537 { … … 546 546 int rc = drvIntNetAsyncIoRun(pThis); 547 547 if ( rc != VERR_STATE_CHANGED 548 && VBOX_FAILURE(rc))548 && RT_FAILURE(rc)) 549 549 { 550 550 LogFlow(("drvIntNetAsyncIoThread: returns %Vrc\n", rc)); … … 795 795 */ 796 796 rc = CFGMR3QueryString(pCfgHandle, "Network", OpenReq.szNetwork, sizeof(OpenReq.szNetwork)); 797 if ( VBOX_FAILURE(rc))797 if (RT_FAILURE(rc)) 798 798 return PDMDRV_SET_ERROR(pDrvIns, rc, 799 799 N_("Configuration error: Failed to get the \"Network\" value")); … … 807 807 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 808 808 u32TrunkType = kIntNetTrunkType_None; 809 else if ( VBOX_FAILURE(rc))809 else if (RT_FAILURE(rc)) 810 810 return PDMDRV_SET_ERROR(pDrvIns, rc, 811 811 N_("Configuration error: Failed to get the \"TrunkType\" value")); … … 818 818 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 819 819 OpenReq.szTrunk[0] = '\0'; 820 else if ( VBOX_FAILURE(rc))820 else if (RT_FAILURE(rc)) 821 821 return PDMDRV_SET_ERROR(pDrvIns, rc, 822 822 N_("Configuration error: Failed to get the \"Trunk\" value")); … … 830 830 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 831 831 fRestrictAccess = true; 832 else if ( VBOX_FAILURE(rc))832 else if (RT_FAILURE(rc)) 833 833 return PDMDRV_SET_ERROR(pDrvIns, rc, 834 834 N_("Configuration error: Failed to get the \"RestrictAccess\" value")); … … 841 841 bool fSharedMacOnWire; 842 842 rc = CFGMR3QueryBoolDef(pCfgHandle, "SharedMacOnWire", &fSharedMacOnWire, false); 843 if ( VBOX_FAILURE(rc))843 if (RT_FAILURE(rc)) 844 844 return PDMDRV_SET_ERROR(pDrvIns, rc, 845 845 N_("Configuration error: Failed to get the \"SharedMacOnWire\" value")); … … 853 853 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 854 854 OpenReq.cbRecv = 218 * _1K ; 855 else if ( VBOX_FAILURE(rc))855 else if (RT_FAILURE(rc)) 856 856 return PDMDRV_SET_ERROR(pDrvIns, rc, 857 857 N_("Configuration error: Failed to get the \"ReceiveBufferSize\" value")); … … 868 868 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 869 869 OpenReq.cbSend = 36*_1K; 870 else if ( VBOX_FAILURE(rc))870 else if (RT_FAILURE(rc)) 871 871 return PDMDRV_SET_ERROR(pDrvIns, rc, 872 872 N_("Configuration error: Failed to get the \"SendBufferSize\" value")); … … 884 884 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 885 885 pThis->fActivateEarlyDeactivateLate = false; 886 else if ( VBOX_FAILURE(rc))886 else if (RT_FAILURE(rc)) 887 887 return PDMDRV_SET_ERROR(pDrvIns, rc, 888 888 N_("Configuration error: Failed to get the \"IsService\" value")); … … 920 920 */ 921 921 rc = RTSemEventCreate(&pThis->EventSuspended); 922 if ( VBOX_FAILURE(rc))922 if (RT_FAILURE(rc)) 923 923 return rc; 924 924 … … 928 928 OpenReq.hIf = INTNET_HANDLE_INVALID; 929 929 rc = pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_OPEN, &OpenReq, sizeof(OpenReq)); 930 if ( VBOX_FAILURE(rc))930 if (RT_FAILURE(rc)) 931 931 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 932 932 N_("Failed to open/create the internal network '%s'"), pThis->szNetwork); … … 945 945 GetRing3BufferReq.pRing3Buf = NULL; 946 946 rc = pDrvIns->pDrvHlp->pfnSUPCallVMMR0Ex(pDrvIns, VMMR0_DO_INTNET_IF_GET_RING3_BUFFER, &GetRing3BufferReq, sizeof(GetRing3BufferReq)); 947 if ( VBOX_FAILURE(rc))947 if (RT_FAILURE(rc)) 948 948 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 949 949 N_("Failed to get ring-3 buffer for the newly created interface to '%s'"), pThis->szNetwork); … … 956 956 */ 957 957 rc = RTThreadCreate(&pThis->Thread, drvIntNetAsyncIoThread, pThis, _128K, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "INTNET"); 958 if ( VBOX_FAILURE(rc))958 if (RT_FAILURE(rc)) 959 959 { 960 960 AssertRC(rc); -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r11170 r11266 378 378 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 379 379 fUDP = false; 380 else if ( VBOX_FAILURE(rc))380 else if (RT_FAILURE(rc)) 381 381 return PDMDrvHlpVMSetError(pData->pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"UDP\" boolean failed"), iInstance); 382 382 } 383 else if ( VBOX_SUCCESS(rc))383 else if (RT_SUCCESS(rc)) 384 384 { 385 385 if (!RTStrICmp(szProtocol, "TCP")) … … 396 396 int32_t iHostPort; 397 397 rc = CFGMR3QueryS32(pNode, "HostPort", &iHostPort); 398 if ( VBOX_FAILURE(rc))398 if (RT_FAILURE(rc)) 399 399 return PDMDrvHlpVMSetError(pData->pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"HostPort\" integer failed"), iInstance); 400 400 … … 402 402 int32_t iGuestPort; 403 403 rc = CFGMR3QueryS32(pNode, "GuestPort", &iGuestPort); 404 if ( VBOX_FAILURE(rc))404 if (RT_FAILURE(rc)) 405 405 return PDMDrvHlpVMSetError(pData->pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"GuestPort\" integer failed"), iInstance); 406 406 … … 411 411 RTStrPrintf(szGuestIP, sizeof(szGuestIP), "%d.%d.%d.%d", 412 412 (Network & 0xFF000000) >> 24, (Network & 0xFF0000) >> 16, (Network & 0xFF00) >> 8, (Network & 0xE0) | 15); 413 else if ( VBOX_FAILURE(rc))413 else if (RT_FAILURE(rc)) 414 414 return PDMDrvHlpVMSetError(pData->pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"GuestIP\" string failed"), iInstance); 415 415 struct in_addr GuestIP; … … 514 514 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 515 515 fPassDomain = true; 516 else if ( VBOX_FAILURE(rc))516 else if (RT_FAILURE(rc)) 517 517 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"PassDomain\" boolean failed"), pDrvIns->iInstance); 518 518 519 519 rc = CFGMR3QueryStringAlloc(pCfgHandle, "TFTPPrefix", &pData->pszTFTPPrefix); 520 if ( VBOX_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND)520 if (RT_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND) 521 521 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"TFTPPrefix\" string failed"), pDrvIns->iInstance); 522 522 rc = CFGMR3QueryStringAlloc(pCfgHandle, "BootFile", &pData->pszBootFile); 523 if ( VBOX_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND)523 if (RT_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND) 524 524 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"BootFile\" string failed"), pDrvIns->iInstance); 525 525 … … 540 540 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 541 541 RTStrPrintf(szNetwork, sizeof(szNetwork), "10.0.%d.0/24", pDrvIns->iInstance + 2); 542 else if ( VBOX_FAILURE(rc))542 else if (RT_FAILURE(rc)) 543 543 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NAT#%d: configuration query for \"Network\" string failed"), pDrvIns->iInstance); 544 544 … … 556 556 */ 557 557 rc = RTCritSectInit(&pData->CritSect); 558 if ( VBOX_FAILURE(rc))558 if (RT_FAILURE(rc)) 559 559 return rc; 560 560 #if 0 561 561 rc = RTSemEventCreate(&g_EventSem); 562 if ( VBOX_SUCCESS(rc))562 if (RT_SUCCESS(rc)) 563 563 { 564 564 /* … … 567 567 g_fThreadTerm = false; 568 568 rc = RTThreadCreate(&g_ThreadSelect, drvNATSelectThread, 0, NULL, "NATSEL"); 569 if ( VBOX_SUCCESS(rc))569 if (RT_SUCCESS(rc)) 570 570 { 571 571 #endif … … 575 575 */ 576 576 rc = slirp_init(&pData->pNATState, &szNetAddr[0], Netmask, fPassDomain, pData->pszTFTPPrefix, pData->pszBootFile, pData); 577 if ( VBOX_SUCCESS(rc))577 if (RT_SUCCESS(rc)) 578 578 { 579 579 int rc2 = drvNATConstructRedir(pDrvIns->iInstance, pData, pCfgHandle, Network); 580 if ( VBOX_SUCCESS(rc2))580 if (RT_SUCCESS(rc2)) 581 581 { 582 582 /* -
trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp
r11157 r11266 346 346 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 347 347 RTStrPrintf(pThis->szFilename, sizeof(pThis->szFilename), "./VBox-%x.pcap", RTProcSelf()); 348 else if ( VBOX_FAILURE(rc))348 else if (RT_FAILURE(rc)) 349 349 { 350 350 AssertMsgFailed(("Failed to query \"File\", rc=%Vrc.\n", rc)); … … 379 379 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 380 380 pThis->pConnector = NULL; 381 else if ( VBOX_SUCCESS(rc))381 else if (RT_SUCCESS(rc)) 382 382 { 383 383 pThis->pConnector = (PPDMINETWORKCONNECTOR)pBaseDown->pfnQueryInterface(pBaseDown, PDMINTERFACE_NETWORK_CONNECTOR); … … 398 398 */ 399 399 rc = RTCritSectInit(&pThis->Lock); 400 if ( VBOX_FAILURE(rc))400 if (RT_FAILURE(rc)) 401 401 return rc; 402 402 … … 406 406 rc = RTFileOpen(&pThis->File, pThis->szFilename, 407 407 RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_WRITE); 408 if ( VBOX_FAILURE(rc))408 if (RT_FAILURE(rc)) 409 409 { 410 410 AssertMsgFailed(("Failed to create file '%s' for writing. rc=%Vrc\n", pThis->szFilename, rc)); -
trunk/src/VBox/Devices/Network/DrvTAP.cpp
r11246 r11266 284 284 rc = RTFileRead(pData->FileDevice, achBuf, sizeof(achBuf), &cbRead); 285 285 #endif 286 if ( VBOX_SUCCESS(rc))286 if (RT_SUCCESS(rc)) 287 287 { 288 288 /* … … 932 932 #if defined(RT_OS_SOLARIS) /** @todo Other platforms' TAP code should be moved here from ConsoleImpl & VBoxBFE. */ 933 933 rc = CFGMR3QueryStringAlloc(pCfgHandle, "TAPSetupApplication", &pData->pszSetupApplication); 934 if ( VBOX_SUCCESS(rc))934 if (RT_SUCCESS(rc)) 935 935 { 936 936 if (!RTPathExists(pData->pszSetupApplication)) … … 942 942 943 943 rc = CFGMR3QueryStringAlloc(pCfgHandle, "TAPTerminateApplication", &pData->pszTerminateApplication); 944 if ( VBOX_SUCCESS(rc))944 if (RT_SUCCESS(rc)) 945 945 { 946 946 if (!RTPathExists(pData->pszTerminateApplication)) … … 953 953 # ifdef VBOX_WITH_CROSSBOW 954 954 rc = CFGMR3QueryBytes(pCfgHandle, "MAC", &pData->MacAddress, sizeof(pData->MacAddress)); 955 if ( VBOX_FAILURE(rc))955 if (RT_FAILURE(rc)) 956 956 return PDMDRV_SET_ERROR(pDrvIns, rc, N_("Configuration error: Failed to query \"MAC\"")); 957 957 # endif 958 958 959 959 rc = CFGMR3QueryStringAlloc(pCfgHandle, "Device", &pData->pszDeviceName); 960 if ( VBOX_FAILURE(rc))960 if (RT_FAILURE(rc)) 961 961 pData->fStatic = false; 962 962 … … 965 965 { 966 966 rc = drvTAPSetupApplication(pData); 967 if ( VBOX_FAILURE(rc))967 if (RT_FAILURE(rc)) 968 968 return PDMDrvHlpVMSetError(pDrvIns, VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, 969 969 N_("Error running TAP setup application. rc=%d"), rc); … … 983 983 rc = SolarisTAPAttach(pData); 984 984 # endif 985 if ( VBOX_FAILURE(rc))985 if (RT_FAILURE(rc)) 986 986 return rc; 987 987 … … 990 990 int32_t iFile; 991 991 rc = CFGMR3QueryS32(pCfgHandle, "FileHandle", &iFile); 992 if ( VBOX_FAILURE(rc))992 if (RT_FAILURE(rc)) 993 993 return PDMDRV_SET_ERROR(pDrvIns, rc, 994 994 N_("Configuration error: Query for \"FileHandle\" 32-bit signed integer failed")); -
trunk/src/VBox/Devices/Network/DrvTAPOs2.cpp
r11157 r11266 450 450 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 451 451 strcpy(pThis->szDevice, "\\DEV\\TAP$"); 452 else if ( VBOX_FAILURE(rc))452 else if (RT_FAILURE(rc)) 453 453 return PDMDRV_SET_ERROR(pDrvIns, rc, 454 454 N_("Configuration error: Query for \"Device\" failed")); … … 458 458 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 459 459 iConnectTo = -1; 460 else if ( VBOX_FAILURE(rc))460 else if (RT_FAILURE(rc)) 461 461 return PDMDRV_SET_ERROR(pDrvIns, rc, 462 462 N_("Configuration error: Query for \"ConnectTo\" failed")); … … 467 467 */ 468 468 rc = RTFileOpen(&pThis->hDevice, pThis->szDevice, RTFILE_O_DENY_NONE | RTFILE_O_READ); 469 if ( VBOX_FAILURE(rc))469 if (RT_FAILURE(rc)) 470 470 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 471 471 N_("Failed to open tap device '%s'"), pThis->szDevice); … … 482 482 else if (Parm[0]) 483 483 rc = VERR_GENERAL_FAILURE; 484 if ( VBOX_FAILURE(rc))484 if (RT_FAILURE(rc)) 485 485 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 486 486 N_("Failed to query LanNumber! orc=%d Parm={%ld,%ld}"), … … 509 509 else if (Parm[0]) 510 510 rc = VERR_GENERAL_FAILURE; 511 if ( VBOX_FAILURE(rc))511 if (RT_FAILURE(rc)) 512 512 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 513 513 N_("Failed to connect %d to %d! orc=%d Parm={%ld,%ld}"), -
trunk/src/VBox/Devices/Network/DrvTAPWin.cpp
r8773 r11266 381 381 char *pszHostDriver = NULL; 382 382 rc = CFGMR3QueryStringAlloc(pCfgHandle, "HostInterfaceName", &pszHostDriver); 383 if ( VBOX_FAILURE(rc))383 if (RT_FAILURE(rc)) 384 384 return PDMDRV_SET_ERROR(pDrvIns, rc, 385 385 N_("Configuration error: query for \"HostInterfaceName\" failed")); … … 391 391 392 392 rc = CFGMR3QueryBytes(pCfgHandle, "GUID", szDriverGUID, sizeof(szDriverGUID)); 393 if ( VBOX_FAILURE(rc))393 if (RT_FAILURE(rc)) 394 394 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 395 395 N_("Configuration error: could not query GUID")); -
trunk/src/VBox/Devices/PC/DevDMA.cpp
r11249 r11266 908 908 #if 0 909 909 rc = CFGMR3QueryBool (pCfgHandle, "HighPageEnable", &high_page_enable); 910 if ( VBOX_FAILURE (rc)) {910 if (RT_FAILURE (rc)) { 911 911 return rc; 912 912 } … … 928 928 Assert(pDevIns->pDevHlp->pfnDMARegister); 929 929 rc = pDevIns->pDevHlp->pfnDMACRegister (pDevIns, ®, &s->pHlp); 930 if ( VBOX_FAILURE (rc)) {930 if (RT_FAILURE (rc)) { 931 931 return rc; 932 932 } … … 934 934 rc = PDMDevHlpSSMRegister (pDevIns, pDevIns->pDevReg->szDeviceName, iInstance, 1, sizeof (*s), 935 935 NULL, SaveExec, NULL, NULL, LoadExec, NULL); 936 if ( VBOX_FAILURE(rc))936 if (RT_FAILURE(rc)) 937 937 return rc; 938 938 -
trunk/src/VBox/Devices/Parallel/DevParallel.cpp
r9212 r11266 597 597 598 598 rc = SSMR3GetU32(pSSMHandle, &u32); 599 if ( VBOX_FAILURE(rc))599 if (RT_FAILURE(rc)) 600 600 return rc; 601 601 … … 693 693 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 694 694 pData->fGCEnabled = true; 695 else if ( VBOX_FAILURE(rc))695 else if (RT_FAILURE(rc)) 696 696 return PDMDEV_SET_ERROR(pDevIns, rc, 697 697 N_("Configuration error: Failed to get the \"GCEnabled\" value")); … … 700 700 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 701 701 pData->fR0Enabled = true; 702 else if ( VBOX_FAILURE(rc))702 else if (RT_FAILURE(rc)) 703 703 return PDMDEV_SET_ERROR(pDevIns, rc, 704 704 N_("Configuration error: Failed to get the \"R0Enabled\" value")); … … 720 720 RTStrPrintf(szName, sizeof(szName), "Parallel#%d", iInstance); 721 721 rc = PDMDevHlpCritSectInit(pDevIns, &pData->CritSect, szName); 722 if ( VBOX_FAILURE(rc))722 if (RT_FAILURE(rc)) 723 723 return rc; 724 724 … … 726 726 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 727 727 irq_lvl = 7; 728 else if ( VBOX_FAILURE(rc))728 else if (RT_FAILURE(rc)) 729 729 return PDMDEV_SET_ERROR(pDevIns, rc, 730 730 N_("Configuration error: Failed to get the \"IRQ\" value")); … … 733 733 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 734 734 io_base = 0x378; 735 else if ( VBOX_FAILURE(rc))735 else if (RT_FAILURE(rc)) 736 736 return PDMDEV_SET_ERROR(pDevIns, rc, 737 737 N_("Configuration error: Failed to get the \"IOBase\" value")); … … 741 741 pData->irq = irq_lvl; 742 742 pData->base = io_base; 743 743 744 744 /* Init parallel state */ 745 745 pData->reg_data = 0; … … 751 751 parallelIOPortWrite, parallelIOPortRead, 752 752 NULL, NULL, "PARALLEL"); 753 if ( VBOX_FAILURE(rc))753 if (RT_FAILURE(rc)) 754 754 return rc; 755 755 … … 759 759 parallelIOPortWriteECP, parallelIOPortReadECP, 760 760 NULL, NULL, "PARALLEL ECP"); 761 if ( VBOX_FAILURE(rc))761 if (RT_FAILURE(rc)) 762 762 return rc; 763 763 #endif … … 767 767 rc = PDMDevHlpIOPortRegisterGC(pDevIns, io_base, 8, 0, "parallelIOPortWrite", 768 768 "parallelIOPortRead", NULL, NULL, "Parallel"); 769 if ( VBOX_FAILURE(rc))769 if (RT_FAILURE(rc)) 770 770 return rc; 771 771 … … 773 773 rc = PDMDevHlpIOPortRegisterGC(pDevIns, io_base+0x400, 8, 0, "parallelIOPortWriteECP", 774 774 "parallelIOPortReadECP", NULL, NULL, "Parallel Ecp"); 775 if ( VBOX_FAILURE(rc))775 if (RT_FAILURE(rc)) 776 776 return rc; 777 777 #endif … … 782 782 rc = PDMDevHlpIOPortRegisterR0(pDevIns, io_base, 8, 0, "parallelIOPortWrite", 783 783 "parallelIOPortRead", NULL, NULL, "Parallel"); 784 if ( VBOX_FAILURE(rc))784 if (RT_FAILURE(rc)) 785 785 return rc; 786 786 … … 788 788 rc = PDMDevHlpIOPortRegisterR0(pDevIns, io_base+0x400, 8, 0, "parallelIOPortWriteECP", 789 789 "parallelIOPortReadECP", NULL, NULL, "Parallel Ecp"); 790 if ( VBOX_FAILURE(rc))790 if (RT_FAILURE(rc)) 791 791 return rc; 792 792 #endif … … 796 796 * changes are supported. */ 797 797 rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->IBase, &pData->pDrvBase, "Parallel Host"); 798 if ( VBOX_SUCCESS(rc))799 { 800 pData->pDrvHostParallelConnector = (PDMIHOSTPARALLELCONNECTOR *)pData->pDrvBase->pfnQueryInterface(pData->pDrvBase, 798 if (RT_SUCCESS(rc)) 799 { 800 pData->pDrvHostParallelConnector = (PDMIHOSTPARALLELCONNECTOR *)pData->pDrvBase->pfnQueryInterface(pData->pDrvBase, 801 801 PDMINTERFACE_HOST_PARALLEL_CONNECTOR); 802 802 if (!pData->pDrvHostParallelConnector) … … 838 838 NULL /* pfnLoadDone */ 839 839 ); 840 if ( VBOX_FAILURE(rc))840 if (RT_FAILURE(rc)) 841 841 return rc; 842 842 -
trunk/src/VBox/Devices/Parallel/DrvHostParallel.cpp
r8155 r11266 153 153 break; 154 154 } 155 155 156 156 ioctl(pData->FileDevice, PPSETMODE, &ppdev_mode); 157 157 … … 301 301 /* Device */ 302 302 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "DevicePath", &pData->pszDevicePath); 303 if ( VBOX_FAILURE(rc))303 if (RT_FAILURE(rc)) 304 304 { 305 305 AssertMsgFailed(("Configuration error: query for \"DevicePath\" string returned %Vra.\n", rc)); … … 311 311 */ 312 312 rc = RTFileOpen(&pData->FileDevice, pData->pszDevicePath, RTFILE_O_OPEN | RTFILE_O_READWRITE); 313 if ( VBOX_FAILURE(rc))314 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Parallel#%d could not open '%s'"), 313 if (RT_FAILURE(rc)) 314 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Parallel#%d could not open '%s'"), 315 315 pDrvIns->iInstance, pData->pszDevicePath); 316 316 … … 318 318 * Try to get exclusive access to parallel port 319 319 */ 320 rc = ioctl(pData->FileDevice, PPEXCL); 320 rc = ioctl(pData->FileDevice, PPEXCL); 321 321 if (rc < 0) 322 return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS, 322 return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS, 323 323 N_("Parallel#%d could not get exclusive access for parallel port '%s'" 324 "Be sure that no other process or driver accesses this port"), 324 "Be sure that no other process or driver accesses this port"), 325 325 pDrvIns->iInstance, pData->pszDevicePath); 326 326 … … 330 330 rc = ioctl(pData->FileDevice, PPCLAIM); 331 331 if (rc < 0) 332 return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS, 332 return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS, 333 333 N_("Parallel#%d could not claim parallel port '%s'" 334 "Be sure that no other process or driver accesses this port"), 334 "Be sure that no other process or driver accesses this port"), 335 335 pDrvIns->iInstance, pData->pszDevicePath); 336 336 … … 340 340 pData->pDrvHostParallelPort = (PPDMIHOSTPARALLELPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_HOST_PARALLEL_PORT); 341 341 if (!pData->pDrvHostParallelPort) 342 return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, RT_SRC_POS, N_("Parallel#%d has no parallel port interface above"), 342 return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_MISSING_INTERFACE_ABOVE, RT_SRC_POS, N_("Parallel#%d has no parallel port interface above"), 343 343 pDrvIns->iInstance); 344 344 … … 359 359 * Start waiting for interrupts. 360 360 */ 361 rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pData->pMonitorThread, pData, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0, 361 rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pData->pMonitorThread, pData, drvHostParallelMonitorThread, drvHostParallelWakeupMonitorThread, 0, 362 362 RTTHREADTYPE_IO, "ParMon"); 363 if ( VBOX_FAILURE(rc))363 if (RT_FAILURE(rc)) 364 364 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostParallel#%d cannot create monitor thread"), pDrvIns->iInstance); 365 365 -
trunk/src/VBox/Devices/Serial/DevSerial.cpp
r9387 r11266 411 411 PDMCritSectLeave(&pData->CritSect); 412 412 rc = RTSemEventWait(pData->ReceiveSem, 250); 413 if ( VBOX_FAILURE(rc))413 if (RT_FAILURE(rc)) 414 414 return rc; 415 415 … … 605 605 606 606 rc = SSMR3GetU32(pSSMHandle, &u32); 607 if ( VBOX_FAILURE(rc))607 if (RT_FAILURE(rc)) 608 608 return rc; 609 609 … … 738 738 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 739 739 pData->fGCEnabled = true; 740 else if ( VBOX_FAILURE(rc))740 else if (RT_FAILURE(rc)) 741 741 return PDMDEV_SET_ERROR(pDevIns, rc, 742 742 N_("Configuration error: Failed to get the \"GCEnabled\" value")); … … 745 745 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 746 746 pData->fR0Enabled = true; 747 else if ( VBOX_FAILURE(rc))747 else if (RT_FAILURE(rc)) 748 748 return PDMDEV_SET_ERROR(pDevIns, rc, 749 749 N_("Configuration error: Failed to get the \"R0Enabled\" value")); … … 766 766 RTStrPrintf(szName, sizeof(szName), "Serial#%d", iInstance); 767 767 rc = PDMDevHlpCritSectInit(pDevIns, &pData->CritSect, szName); 768 if ( VBOX_FAILURE(rc))768 if (RT_FAILURE(rc)) 769 769 return rc; 770 770 … … 778 778 irq_lvl = 3; 779 779 } 780 else if ( VBOX_FAILURE(rc))780 else if (RT_FAILURE(rc)) 781 781 return PDMDEV_SET_ERROR(pDevIns, rc, 782 782 N_("Configuration error: Failed to get the \"IRQ\" value")); … … 790 790 io_base = 0x2f8; 791 791 } 792 else if ( VBOX_FAILURE(rc))792 else if (RT_FAILURE(rc)) 793 793 return PDMDEV_SET_ERROR(pDevIns, rc, 794 794 N_("Configuration error: Failed to get the \"IOBase\" value")); … … 814 814 pData->dev.config[0x3d] = 1; /* interrupt pin 0 */ 815 815 rc = PDMDevHlpPCIRegister(pDevIns, &pData->dev); 816 if ( VBOX_FAILURE(rc))816 if (RT_FAILURE(rc)) 817 817 return rc; 818 818 /* … … 820 820 */ 821 821 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 8, PCI_ADDRESS_SPACE_IO, serialIOPortRegionMap); 822 if ( VBOX_FAILURE(rc))822 if (RT_FAILURE(rc)) 823 823 return rc; 824 824 #else /* !VBOX_SERIAL_PCI */ … … 827 827 serialIOPortWrite, serialIOPortRead, 828 828 NULL, NULL, "SERIAL"); 829 if ( VBOX_FAILURE (rc))829 if (RT_FAILURE (rc)) 830 830 return rc; 831 831 … … 843 843 * changes are supported. */ 844 844 rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->IBase, &pData->pDrvBase, "Serial Char"); 845 if ( VBOX_SUCCESS(rc))845 if (RT_SUCCESS(rc)) 846 846 { 847 847 pData->pDrvChar = (PDMICHAR *)pData->pDrvBase->pfnQueryInterface(pData->pDrvBase, PDMINTERFACE_CHAR); … … 879 879 NULL /* pfnLoadDone */ 880 880 ); 881 if ( VBOX_FAILURE(rc))881 if (RT_FAILURE(rc)) 882 882 return rc; 883 883 -
trunk/src/VBox/Devices/Serial/DrvChar.cpp
r8155 r11266 157 157 { 158 158 int rc = RTSemEventWait(pData->SendSem, RT_INDEFINITE_WAIT); 159 if ( VBOX_FAILURE(rc))159 if (RT_FAILURE(rc)) 160 160 break; 161 161 … … 171 171 172 172 rc = pData->pDrvStream->pfnWrite(pData->pDrvStream, &pData->aSendQueue[pData->iSendQueueTail], &cbProcessed); 173 if ( VBOX_SUCCESS(rc))173 if (RT_SUCCESS(rc)) 174 174 { 175 175 Assert(cbProcessed); … … 226 226 cbRemaining = sizeof(aBuffer); 227 227 rc = pData->pDrvStream->pfnRead(pData->pDrvStream, aBuffer, &cbRemaining); 228 if ( VBOX_FAILURE(rc))228 if (RT_FAILURE(rc)) 229 229 { 230 230 LogFlow(("Read failed with %Vrc\n", rc)); … … 244 244 cbProcessed = cbRemaining; 245 245 rc = pData->pDrvCharPort->pfnNotifyRead(pData->pDrvCharPort, pBuffer, &cbProcessed); 246 if ( VBOX_SUCCESS(rc))246 if (RT_SUCCESS(rc)) 247 247 { 248 248 Assert(cbProcessed); … … 327 327 PPDMIBASE pBase; 328 328 int rc = pDrvIns->pDrvHlp->pfnAttach(pDrvIns, &pBase); 329 if ( VBOX_FAILURE(rc))329 if (RT_FAILURE(rc)) 330 330 return rc; /* Don't call PDMDrvHlpVMSetError here as we assume that the driver already set an appropriate error */ 331 331 pData->pDrvStream = (PPDMISTREAM)pBase->pfnQueryInterface(pBase, PDMINTERFACE_STREAM); … … 334 334 335 335 rc = RTThreadCreate(&pData->ReceiveThread, drvCharReceiveLoop, (void *)pData, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "CharRecv"); 336 if ( VBOX_FAILURE(rc))336 if (RT_FAILURE(rc)) 337 337 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Char#%d cannot create receive thread"), pDrvIns->iInstance); 338 338 … … 341 341 342 342 rc = RTThreadCreate(&pData->SendThread, drvCharSendLoop, (void *)pData, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "CharSend"); 343 if ( VBOX_FAILURE(rc))343 if (RT_FAILURE(rc)) 344 344 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("Char#%d cannot create send thread"), pDrvIns->iInstance); 345 345 -
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
r10902 r11266 428 428 { 429 429 int rc = RTSemEventWait(pData->SendSem, RT_INDEFINITE_WAIT); 430 if ( VBOX_FAILURE(rc))430 if (RT_FAILURE(rc)) 431 431 break; 432 432 … … 467 467 #endif 468 468 469 if ( VBOX_SUCCESS(rc))469 if (RT_SUCCESS(rc)) 470 470 { 471 471 Assert(cbProcessed); … … 473 473 pData->iSendQueueTail &= CHAR_MAX_SEND_QUEUE_MASK; 474 474 } 475 else if ( VBOX_FAILURE(rc))475 else if (RT_FAILURE(rc)) 476 476 { 477 477 LogRel(("HostSerial#%d: Serial Write failed with %Vrc; terminating send thread\n", pDrvIns->iInstance, rc)); … … 573 573 } 574 574 rc = RTFileRead(pData->DeviceFile, abBuffer, sizeof(abBuffer), &cbRead); 575 if ( VBOX_FAILURE(rc))575 if (RT_FAILURE(rc)) 576 576 { 577 577 LogRel(("HostSerial#%d: Read failed with %Vrc, terminating the worker thread.\n", pDrvIns->iInstance, rc)); … … 638 638 uNewStatusLinesState |= PDM_ICHAR_STATUS_LINES_CTS; 639 639 rc = pData->pDrvCharPort->pfnNotifyStatusLinesChanged(pData->pDrvCharPort, uNewStatusLinesState); 640 if ( VBOX_FAILURE(rc))640 if (RT_FAILURE(rc)) 641 641 { 642 642 /* Notifying device failed, continue but log it */ … … 660 660 size_t cbProcessed = cbRemaining; 661 661 rc = pData->pDrvCharPort->pfnNotifyRead(pData->pDrvCharPort, pbBuffer, &cbProcessed); 662 if ( VBOX_SUCCESS(rc))662 if (RT_SUCCESS(rc)) 663 663 { 664 664 Assert(cbProcessed); Assert(cbProcessed <= cbRemaining); … … 802 802 goto ioctl_error; 803 803 804 /* 804 /* 805 805 * Change current level on the RTS pin to make the ioctl call return in the 806 806 * monitor thread. … … 921 921 /* Device */ 922 922 int rc = CFGMR3QueryStringAlloc(pCfgHandle, "DevicePath", &pData->pszDevicePath); 923 if ( VBOX_FAILURE(rc))923 if (RT_FAILURE(rc)) 924 924 { 925 925 AssertMsgFailed(("Configuration error: query for \"DevicePath\" string returned %Vra.\n", rc)); … … 968 968 #endif 969 969 970 if ( VBOX_FAILURE(rc))970 if (RT_FAILURE(rc)) 971 971 { 972 972 AssertMsgFailed(("Could not open host device %s, rc=%Vrc\n", pData->pszDevicePath, rc)); … … 1029 1029 1030 1030 rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pData->pRecvThread, pData, drvHostSerialRecvThread, drvHostSerialWakeupRecvThread, 0, RTTHREADTYPE_IO, "SerRecv"); 1031 if ( VBOX_FAILURE(rc))1031 if (RT_FAILURE(rc)) 1032 1032 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostSerial#%d cannot create receive thread"), pDrvIns->iInstance); 1033 1033 … … 1036 1036 1037 1037 rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pData->pSendThread, pData, drvHostSerialSendThread, drvHostSerialWakeupSendThread, 0, RTTHREADTYPE_IO, "SerSend"); 1038 if ( VBOX_FAILURE(rc))1038 if (RT_FAILURE(rc)) 1039 1039 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostSerial#%d cannot create send thread"), pDrvIns->iInstance); 1040 1040 … … 1042 1042 /* Linux needs a separate thread which monitors the status lines. */ 1043 1043 rc = PDMDrvHlpPDMThreadCreate(pDrvIns, &pData->pMonitorThread, pData, drvHostSerialMonitorThread, drvHostSerialWakeupMonitorThread, 0, RTTHREADTYPE_IO, "SerMon"); 1044 if ( VBOX_FAILURE(rc))1044 if (RT_FAILURE(rc)) 1045 1045 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("HostSerial#%d cannot create monitor thread"), pDrvIns->iInstance); 1046 1046 #endif -
trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
r8155 r11266 142 142 } 143 143 144 if ( VBOX_FAILURE(rc))144 if (RT_FAILURE(rc)) 145 145 { 146 146 Log(("drvNamedPipeRead: FileRead returned %Vrc fShutdown=%d\n", rc, pData->fShutdown)); … … 236 236 cbWritten = *cbWrite; 237 237 238 if ( VBOX_FAILURE(rc))238 if (RT_FAILURE(rc)) 239 239 { 240 240 if ( rc == VERR_EOF … … 442 442 443 443 rc = CFGMR3QueryStringAlloc(pCfgHandle, "Location", &pszLocation); 444 if ( VBOX_FAILURE(rc))444 if (RT_FAILURE(rc)) 445 445 { 446 446 AssertMsgFailed(("Configuration error: query \"Location\" resulted in %Vrc.\n", rc)); … … 451 451 bool fIsServer; 452 452 rc = CFGMR3QueryBool(pCfgHandle, "IsServer", &fIsServer); 453 if ( VBOX_FAILURE(rc))453 if (RT_FAILURE(rc)) 454 454 { 455 455 AssertMsgFailed(("Configuration error: query \"IsServer\" resulted in %Vrc.\n", rc)); … … 474 474 475 475 rc = RTThreadCreate(&pData->ListenThread, drvNamedPipeListenLoop, (void *)pData, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SerPipe"); 476 if VBOX_FAILURE(rc)476 if RT_FAILURE(rc) 477 477 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NamedPipe#%d failed to create listening thread"), pDrvIns->iInstance); 478 478 … … 514 514 pData->LocalSocketServer = s; 515 515 rc = RTThreadCreate(&pData->ListenThread, drvNamedPipeListenLoop, (void *)pData, 0, RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SerPipe"); 516 if VBOX_FAILURE(rc)516 if RT_FAILURE(rc) 517 517 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, N_("NamedPipe#%d failed to create listening thread"), pDrvIns->iInstance); 518 518 } … … 527 527 528 528 out: 529 if ( VBOX_FAILURE(rc))529 if (RT_FAILURE(rc)) 530 530 { 531 531 if (pszLocation) … … 582 582 if (pData->NamedPipe != INVALID_HANDLE_VALUE) 583 583 { 584 if (pData->fIsServer) 584 if (pData->fIsServer) 585 585 { 586 586 FlushFileBuffers(pData->NamedPipe); -
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); -
trunk/src/VBox/Devices/VMMDev/VBoxDev.cpp
r9662 r11266 782 782 uint32_t mappingsSize; 783 783 pRequestHeader->rc = PGMR3MappingsSize(pVM, &mappingsSize); 784 if ( VBOX_SUCCESS(pRequestHeader->rc) && hypervisorInfo->hypervisorSize == mappingsSize)784 if (RT_SUCCESS(pRequestHeader->rc) && hypervisorInfo->hypervisorSize == mappingsSize) 785 785 { 786 786 /* new reservation */ … … 1157 1157 1158 1158 if ( ptr->u32Enable 1159 && VBOX_SUCCESS (pRequestHeader->rc))1159 && RT_SUCCESS (pRequestHeader->rc)) 1160 1160 { 1161 1161 ptr->fu32Status |= VBVA_F_STATUS_ENABLED; … … 2158 2158 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 2159 2159 pData->fGetHostTimeDisabled = false; 2160 else if ( VBOX_FAILURE(rc))2160 else if (RT_FAILURE(rc)) 2161 2161 return PDMDEV_SET_ERROR(pDevIns, rc, 2162 2162 N_("Configuration error: Failed querying \"GetHostTimeDisabled\" as a boolean")); … … 2165 2165 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 2166 2166 pData->fBackdoorLogDisabled = false; 2167 else if ( VBOX_FAILURE(rc))2167 else if (RT_FAILURE(rc)) 2168 2168 return PDMDEV_SET_ERROR(pDevIns, rc, 2169 2169 N_("Configuration error: Failed querying \"BackdoorLogDisabled\" as a boolean")); … … 2172 2172 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 2173 2173 pData->fKeepCredentials = false; 2174 else if ( VBOX_FAILURE(rc))2174 else if (RT_FAILURE(rc)) 2175 2175 return PDMDEV_SET_ERROR(pDevIns, rc, 2176 2176 N_("Configuration error: Failed querying \"KeepCredentials\" as a boolean")); … … 2255 2255 */ 2256 2256 rc = PDMDevHlpPCIRegister(pDevIns, &pData->dev); 2257 if ( VBOX_FAILURE(rc))2257 if (RT_FAILURE(rc)) 2258 2258 return rc; 2259 2259 if (pData->dev.devfn == 32 || iInstance != 0) 2260 2260 Log(("!!WARNING!!: pData->dev.devfn=%d (ignore if testcase or no started by Main)\n", pData->dev.devfn)); 2261 2261 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 0x20, PCI_ADDRESS_SPACE_IO, vmmdevIOPortRegionMap); 2262 if ( VBOX_FAILURE(rc))2262 if (RT_FAILURE(rc)) 2263 2263 return rc; 2264 2264 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, VMMDEV_RAM_SIZE, PCI_ADDRESS_SPACE_MEM, vmmdevIORAMRegionMap); 2265 if ( VBOX_FAILURE(rc))2265 if (RT_FAILURE(rc)) 2266 2266 return rc; 2267 2267 … … 2270 2270 */ 2271 2271 rc = PDMDevHlpDriverAttach(pDevIns, 0, &pData->Base, &pData->pDrvBase, "VMM Driver Port"); 2272 if ( VBOX_SUCCESS(rc))2272 if (RT_SUCCESS(rc)) 2273 2273 { 2274 2274 pData->pDrv = (PPDMIVMMDEVCONNECTOR)pData->pDrvBase->pfnQueryInterface(pData->pDrvBase, PDMINTERFACE_VMMDEV_CONNECTOR); … … 2297 2297 PPDMIBASE pBase; 2298 2298 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pData->Base, &pBase, "Status Port"); 2299 if ( VBOX_SUCCESS(rc))2299 if (RT_SUCCESS(rc)) 2300 2300 pData->SharedFolders.pLedsConnector = (PPDMILEDCONNECTORS) 2301 2301 pBase->pfnQueryInterface(pBase, PDMINTERFACE_LED_CONNECTORS); -
trunk/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
r9662 r11266 50 50 /* Index of the parameter. */ 51 51 int iParm; 52 52 53 53 /* Offset in the first physical page of the region. */ 54 54 size_t cbOffsetFirstPage; 55 55 56 56 /* How many pages. */ 57 57 uint32_t cPages; 58 59 /* Pointer to array of the GC physical addresses for these pages. 58 59 /* Pointer to array of the GC physical addresses for these pages. 60 60 * It is assumed that the physical address of the locked resident 61 61 * guest page does not change. 62 62 */ 63 63 RTGCPHYS *paPages; 64 64 65 65 } VBOXHGCMLINPTR; 66 66 … … 111 111 112 112 int rc = vmmdevHGCMCmdListLock (pVMMDevState); 113 114 if ( VBOX_SUCCESS (rc))113 114 if (RT_SUCCESS (rc)) 115 115 { 116 116 LogFlowFunc(("%p type %d\n", pCmd, enmCmdType)); … … 119 119 pCmd->pNext = pVMMDevState->pHGCMCmdList; 120 120 pCmd->pPrev = NULL; 121 121 122 122 if (pVMMDevState->pHGCMCmdList) 123 123 { 124 124 pVMMDevState->pHGCMCmdList->pPrev = pCmd; 125 125 } 126 126 127 127 pVMMDevState->pHGCMCmdList = pCmd; 128 128 129 129 pCmd->enmCmdType = enmCmdType; 130 130 pCmd->GCPhys = GCPhys; 131 131 pCmd->cbSize = cbSize; 132 132 133 133 /* Automatically enable HGCM events, if there are HGCM commands. */ 134 134 if ( enmCmdType == VBOXHGCMCMDTYPE_CONNECT … … 145 145 vmmdevHGCMCmdListUnlock (pVMMDevState); 146 146 } 147 147 148 148 return rc; 149 149 } … … 154 154 155 155 int rc = vmmdevHGCMCmdListLock (pVMMDevState); 156 157 if ( VBOX_SUCCESS (rc))156 157 if (RT_SUCCESS (rc)) 158 158 { 159 159 LogFlowFunc(("%p\n", pCmd)); … … 167 167 /* Tail, do nothing. */ 168 168 } 169 169 170 170 if (pCmd->pPrev) 171 171 { … … 179 179 vmmdevHGCMCmdListUnlock (pVMMDevState); 180 180 } 181 181 182 182 return rc; 183 183 } … … 189 189 190 190 int rc = vmmdevHGCMCmdListLock (pVMMDevState); 191 192 if ( VBOX_SUCCESS (rc))191 192 if (RT_SUCCESS (rc)) 193 193 { 194 194 pCmd = pVMMDevState->pHGCMCmdList; … … 205 205 vmmdevHGCMCmdListUnlock (pVMMDevState); 206 206 } 207 207 208 208 LogFlowFunc(("%p\n", pCmd)); 209 209 return pCmd; … … 220 220 { 221 221 int rc = VINF_SUCCESS; 222 222 223 223 AssertRelease (u32Size > 0); 224 224 225 225 VBOXHGCMLINPTR *pLinPtr = &paLinPtrs[iLinPtr]; 226 226 227 227 /* Take the offset into the current page also into account! */ 228 228 u32Size += GCPtr & PAGE_OFFSET_MASK; 229 229 230 230 uint32_t cPages = (u32Size + PAGE_SIZE - 1) / PAGE_SIZE; 231 231 232 232 Log(("vmmdevHGCMSaveLinPtr: parm %d: %VGv %d = %d pages\n", iParm, GCPtr, u32Size, cPages)); 233 233 234 234 pLinPtr->iParm = iParm; 235 235 pLinPtr->cbOffsetFirstPage = (RTGCUINTPTR)GCPtr & PAGE_OFFSET_MASK; 236 236 pLinPtr->cPages = cPages; 237 237 pLinPtr->paPages = *ppPages; 238 238 239 239 *ppPages += cPages; 240 240 241 241 uint32_t iPage = 0; 242 242 243 243 GCPtr &= PAGE_BASE_GC_MASK; 244 244 245 245 /* Gonvert the guest linear pointers of pages to HC addresses. */ 246 246 while (iPage < cPages) … … 248 248 /* convert */ 249 249 RTGCPHYS GCPhys; 250 250 251 251 rc = PDMDevHlpPhysGCPtr2GCPhys(pDevIns, GCPtr, &GCPhys); 252 252 253 253 Log(("vmmdevHGCMSaveLinPtr: Page %d: %VGv -> %VGp. %Vrc\n", iPage, GCPtr, GCPhys, rc)); 254 255 if ( VBOX_FAILURE (rc))254 255 if (RT_FAILURE (rc)) 256 256 { 257 257 break; … … 264 264 GCPtr += PAGE_SIZE; 265 265 } 266 266 267 267 AssertRelease (iPage == cPages); 268 268 269 269 return rc; 270 270 } … … 278 278 { 279 279 int rc = VINF_SUCCESS; 280 280 281 281 VBOXHGCMLINPTR *pLinPtr = &paLinPtrs[iLinPtr]; 282 282 283 283 AssertRelease (u32Size > 0 && iParm == (uint32_t)pLinPtr->iParm); 284 284 285 285 RTGCPHYS GCPhysDst = pLinPtr->paPages[0] + pLinPtr->cbOffsetFirstPage; 286 286 uint8_t *pu8Src = (uint8_t *)pvHost; 287 287 288 288 Log(("vmmdevHGCMWriteLinPtr: parm %d: size %d, cPages = %d\n", iParm, u32Size, pLinPtr->cPages)); 289 289 290 290 uint32_t iPage = 0; 291 291 292 292 while (iPage < pLinPtr->cPages) 293 293 { … … 296 296 PAGE_SIZE - pLinPtr->cbOffsetFirstPage: 297 297 PAGE_SIZE; 298 298 299 299 Log(("vmmdevHGCMWriteLinPtr: page %d: dst %VGp, src %p, cbWrite %d\n", iPage, GCPhysDst, pu8Src, cbWrite)); 300 300 301 301 iPage++; 302 302 303 303 if (cbWrite >= u32Size) 304 304 { … … 307 307 break; 308 308 } 309 309 310 310 PDMDevHlpPhysWrite(pDevIns, GCPhysDst, pu8Src, cbWrite); 311 311 … … 313 313 u32Size -= cbWrite; 314 314 pu8Src += cbWrite; 315 315 316 316 GCPhysDst = pLinPtr->paPages[iPage]; 317 317 } 318 318 319 319 AssertRelease (iPage == pLinPtr->cPages); 320 320 Assert(u32Size == 0); 321 321 322 322 return rc; 323 323 } … … 332 332 { 333 333 VMMDevHGCMConnect *pHGCMConnectCopy = (VMMDevHGCMConnect *)(pCmd+1); 334 334 335 335 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPhys, pHGCMConnect->header.header.size, VBOXHGCMCMDTYPE_CONNECT); 336 336 … … 417 417 418 418 /* Look for pointer parameters, which require a host buffer. */ 419 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++)419 for (i = 0; i < cParms && RT_SUCCESS(rc); i++, pGuestParm++) 420 420 { 421 421 switch (pGuestParm->type) … … 426 426 { 427 427 cbCmdSize += pGuestParm->u.Pointer.size; 428 428 429 429 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 430 430 { … … 434 434 + pGuestParm->u.Pointer.size + PAGE_SIZE - 1) / PAGE_SIZE; 435 435 } 436 436 437 437 Log(("vmmdevHGCMCall: linptr size = %d\n", pGuestParm->u.Pointer.size)); 438 438 } break; … … 462 462 463 463 /* Look for pointer parameters, which require a host buffer. */ 464 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++)464 for (i = 0; i < cParms && RT_SUCCESS(rc); i++, pGuestParm++) 465 465 { 466 466 switch (pGuestParm->type) … … 471 471 { 472 472 cbCmdSize += pGuestParm->u.Pointer.size; 473 473 474 474 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 475 475 { … … 479 479 + pGuestParm->u.Pointer.size + PAGE_SIZE - 1) / PAGE_SIZE; 480 480 } 481 481 482 482 Log(("vmmdevHGCMCall: linptr size = %d\n", pGuestParm->u.Pointer.size)); 483 483 } break; … … 499 499 } 500 500 501 if ( VBOX_FAILURE (rc))501 if (RT_FAILURE (rc)) 502 502 { 503 503 return rc; … … 512 512 513 513 memset (pCmd, 0, sizeof (*pCmd)); 514 514 515 515 pCmd->paHostParms = NULL; 516 516 pCmd->cLinPtrs = cLinPtrs; 517 517 518 518 if (cLinPtrs > 0) 519 519 { 520 520 pCmd->paLinPtrs = (VBOXHGCMLINPTR *)RTMemAlloc ( sizeof (VBOXHGCMLINPTR) * cLinPtrs 521 521 + sizeof (RTGCPHYS) * cLinPtrPages); 522 522 523 523 if (pCmd->paLinPtrs == NULL) 524 524 { … … 541 541 /* Compute addresses of host parms array and first memory buffer. */ 542 542 VBOXHGCMSVCPARM *pHostParm = (VBOXHGCMSVCPARM *)((char *)pCmd + sizeof (struct VBOXHGCMCMD)); 543 543 544 544 uint8_t *pcBuf = (uint8_t *)pHostParm + cParms * sizeof (VBOXHGCMSVCPARM); 545 545 … … 559 559 560 560 561 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++, pHostParm++)561 for (i = 0; i < cParms && RT_SUCCESS(rc); i++, pGuestParm++, pHostParm++) 562 562 { 563 563 switch (pGuestParm->type) … … 572 572 Log(("vmmdevHGCMCall: uint32 guest parameter %u\n", u32)); 573 573 break; 574 } 574 } 575 575 576 576 case VMMDevHGCMParmType_64bit: … … 583 583 Log(("vmmdevHGCMCall: uint64 guest parameter %llu\n", u64)); 584 584 break; 585 } 585 } 586 586 587 587 case VMMDevHGCMParmType_PhysAddr: … … 600 600 Log(("vmmdevHGCMCall: PhysAddr guest parameter %VGp\n", physAddr)); 601 601 break; 602 } 602 } 603 603 604 604 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ … … 628 628 rc = VINF_SUCCESS; 629 629 630 if ( VBOX_SUCCESS(rc))630 if (RT_SUCCESS(rc)) 631 631 { 632 632 pHostParm->u.pointer.addr = pcBuf; 633 633 pcBuf += size; 634 634 635 635 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 636 636 { 637 /* Remember the guest physical pages that belong to the virtual address 637 /* Remember the guest physical pages that belong to the virtual address 638 638 * region. 639 639 */ … … 661 661 #endif /* VBOX_WITH_64_BITS_GUESTS */ 662 662 663 for (i = 0; i < cParms && VBOX_SUCCESS(rc); i++, pGuestParm++, pHostParm++)663 for (i = 0; i < cParms && RT_SUCCESS(rc); i++, pGuestParm++, pHostParm++) 664 664 { 665 665 switch (pGuestParm->type) … … 674 674 Log(("vmmdevHGCMCall: uint32 guest parameter %u\n", u32)); 675 675 break; 676 } 676 } 677 677 678 678 case VMMDevHGCMParmType_64bit: … … 685 685 Log(("vmmdevHGCMCall: uint64 guest parameter %llu\n", u64)); 686 686 break; 687 } 687 } 688 688 689 689 case VMMDevHGCMParmType_PhysAddr: … … 702 702 Log(("vmmdevHGCMCall: PhysAddr guest parameter %VGp\n", physAddr)); 703 703 break; 704 } 704 } 705 705 706 706 case VMMDevHGCMParmType_LinAddr_In: /* In (read) */ … … 730 730 rc = VINF_SUCCESS; 731 731 732 if ( VBOX_SUCCESS(rc))732 if (RT_SUCCESS(rc)) 733 733 { 734 734 pHostParm->u.pointer.addr = pcBuf; 735 735 pcBuf += size; 736 736 737 737 if (pGuestParm->type != VMMDevHGCMParmType_LinAddr_In) 738 738 { 739 /* Remember the guest physical pages that belong to the virtual address 739 /* Remember the guest physical pages that belong to the virtual address 740 740 * region. 741 741 */ … … 757 757 } 758 758 759 if ( VBOX_SUCCESS (rc))759 if (RT_SUCCESS (rc)) 760 760 { 761 761 vmmdevHGCMAddCommand (pVMMDevState, pCmd, GCPhys, pHGCMCall->header.header.size, VBOXHGCMCMDTYPE_CALL); … … 770 770 RTMemFree (pCmd->paLinPtrs); 771 771 } 772 772 773 773 RTMemFree (pCmd); 774 774 } … … 901 901 /* Setup return codes. */ 902 902 pHeader->result = result; 903 903 904 904 /* Verify the request type. */ 905 905 rc = vmmdevHGCMCmdVerify (pCmd, pHeader); 906 906 907 if ( VBOX_SUCCESS (rc))907 if (RT_SUCCESS (rc)) 908 908 { 909 909 /* Update parameters and data buffers. */ 910 910 911 911 switch (pHeader->header.requestType) 912 912 { … … 1128 1128 RTMemFree (pCmd->paLinPtrs); 1129 1129 } 1130 1130 1131 1131 RTMemFree (pCmd); 1132 1132 … … 1242 1242 int rc = vmmdevHGCMCmdListLock (pVMMDevState); 1243 1243 1244 if ( VBOX_SUCCESS (rc))1244 if (RT_SUCCESS (rc)) 1245 1245 { 1246 1246 PVBOXHGCMCMD pIter = pVMMDevState->pHGCMCmdList; … … 1374 1374 vmmdevHGCMCmdListUnlock (pVMMDevState); 1375 1375 } 1376 1376 1377 1377 return rc; 1378 1378 } -
trunk/src/VBox/Devices/vl_vbox.h
r8155 r11266 125 125 { 126 126 int rc = SSMR3GetMem(f, buf, size); 127 return VBOX_SUCCESS(rc) ? size : 0;127 return RT_SUCCESS(rc) ? size : 0; 128 128 } 129 129 … … 132 132 uint8_t u8; 133 133 int rc = SSMR3GetU8(f, &u8); 134 return VBOX_SUCCESS(rc) ? (int)u8 : -1;134 return RT_SUCCESS(rc) ? (int)u8 : -1; 135 135 } 136 136 … … 139 139 uint16_t u16; 140 140 int rc = SSMR3GetU16(f, &u16); 141 return VBOX_SUCCESS(rc) ? u16 : ~0;141 return RT_SUCCESS(rc) ? u16 : ~0; 142 142 } 143 143 … … 146 146 uint32_t u32; 147 147 int rc = SSMR3GetU32(f, &u32); 148 return VBOX_SUCCESS(rc) ? u32 : ~0;148 return RT_SUCCESS(rc) ? u32 : ~0; 149 149 } 150 150 … … 153 153 uint64_t u64; 154 154 int rc = SSMR3GetU64(f, &u64); 155 return VBOX_SUCCESS(rc) ? u64 : ~0;155 return RT_SUCCESS(rc) ? u64 : ~0; 156 156 } 157 157
Note:
See TracChangeset
for help on using the changeset viewer.