Changeset 35872 in vbox
- Timestamp:
- Feb 7, 2011 1:43:33 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r35755 r35872 471 471 472 472 static DECLCALLBACK(int) configConstructor(PVM pVM, void *pvConsole); 473 int configConstructorInner(PVM pVM, AutoWriteLock *pAlock); 473 474 int configCfgmOverlay(PVM pVM, IVirtualBox *pVirtualBox, IMachine *pMachine); 474 475 -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r35830 r35872 553 553 AutoWriteLock alock(pConsole COMMA_LOCKVAL_SRC_POS); 554 554 555 /* Save the VM pointer in the machine object */ 555 /* 556 * Set the VM handle and do the rest of the job in an worker method so we 557 * can easily reset the VM handle on failure. 558 */ 556 559 pConsole->mpVM = pVM; 557 558 VMMDev *pVMMDev = pConsole->m_pVMMDev; 560 int vrc = pConsole->configConstructorInner(pVM, &alock); 561 if (RT_FAILURE(vrc)) 562 pConsole->mpVM = NULL; 563 564 return vrc; 565 } 566 567 568 /** 569 * Worker for configConstructor. 570 * 571 * @return VBox status code. 572 * @param pVM The VM handle. 573 */ 574 int Console::configConstructorInner(PVM pVM, AutoWriteLock *pAlock) 575 { 576 VMMDev *pVMMDev = m_pVMMDev; 559 577 Assert(pVMMDev); 560 578 561 ComPtr<IMachine> pMachine = pConsole->machine();579 ComPtr<IMachine> pMachine = machine(); 562 580 563 581 int rc; … … 609 627 } 610 628 611 BusAssignmentManager* BusMgr = pConsole->mBusMgr = BusAssignmentManager::createInstance(chipsetType);629 BusAssignmentManager* BusMgr = mBusMgr = BusAssignmentManager::createInstance(chipsetType); 612 630 613 631 ULONG cCpus = 1; … … 983 1001 #ifdef VBOX_WITH_PCI_PASSTHROUGH 984 1002 /* Add PCI passthrough devices */ 985 hrc = attachRawPciDevices(BusMgr, pDevices, pConsole);H();1003 hrc = attachRawPciDevices(BusMgr, pDevices, this); H(); 986 1004 #endif 987 1005 } … … 1060 1078 InsertConfigString(pLunL1, "Driver", "MainKeyboard"); 1061 1079 InsertConfigNode(pLunL1, "Config", &pCfg); 1062 Keyboard *pKeyboard = pConsole->mKeyboard;1080 Keyboard *pKeyboard = mKeyboard; 1063 1081 InsertConfigInteger(pCfg, "Object", (uintptr_t)pKeyboard); 1064 1082 … … 1071 1089 InsertConfigString(pLunL1, "Driver", "MainMouse"); 1072 1090 InsertConfigNode(pLunL1, "Config", &pCfg); 1073 Mouse *pMouse = pConsole->mMouse;1091 Mouse *pMouse = mMouse; 1074 1092 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse); 1075 1093 … … 1190 1208 /* VESA height reduction */ 1191 1209 ULONG ulHeightReduction; 1192 IFramebuffer *pFramebuffer = pConsole->getDisplay()->getFramebuffer();1210 IFramebuffer *pFramebuffer = getDisplay()->getFramebuffer(); 1193 1211 if (pFramebuffer) 1194 1212 { … … 1206 1224 InsertConfigString(pLunL0, "Driver", "MainDisplay"); 1207 1225 InsertConfigNode(pLunL0, "Config", &pCfg); 1208 Display *pDisplay = pConsole->mDisplay;1226 Display *pDisplay = mDisplay; 1209 1227 InsertConfigInteger(pCfg, "Object", (uintptr_t)pDisplay); 1210 1228 … … 1383 1401 1384 1402 /* /Devices/<ctrldev>/ */ 1385 const char *pszCtrlDev = pConsole->convertControllerTypeToDev(enmCtrlType);1403 const char *pszCtrlDev = convertControllerTypeToDev(enmCtrlType); 1386 1404 pDev = aCtrlNodes[enmCtrlType]; 1387 1405 if (!pDev) … … 1411 1429 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1412 1430 InsertConfigNode(pLunL0, "Config", &pCfg); 1413 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapStorageLeds[iLedScsi]);1431 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedScsi]); 1414 1432 InsertConfigInteger(pCfg, "First", 0); 1415 1433 Assert(cLedScsi >= 16); 1416 1434 InsertConfigInteger(pCfg, "Last", 15); 1417 paLedDevType = & pConsole->maStorageDevType[iLedScsi];1435 paLedDevType = &maStorageDevType[iLedScsi]; 1418 1436 break; 1419 1437 } … … 1429 1447 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1430 1448 InsertConfigNode(pLunL0, "Config", &pCfg); 1431 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapStorageLeds[iLedScsi]);1449 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedScsi]); 1432 1450 InsertConfigInteger(pCfg, "First", 0); 1433 1451 Assert(cLedScsi >= 16); 1434 1452 InsertConfigInteger(pCfg, "Last", 15); 1435 paLedDevType = & pConsole->maStorageDevType[iLedScsi];1453 paLedDevType = &maStorageDevType[iLedScsi]; 1436 1454 break; 1437 1455 } … … 1474 1492 InsertConfigNode(pLunL0, "Config", &pCfg); 1475 1493 AssertRelease(cPorts <= cLedSata); 1476 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapStorageLeds[iLedSata]);1494 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedSata]); 1477 1495 InsertConfigInteger(pCfg, "First", 0); 1478 1496 InsertConfigInteger(pCfg, "Last", cPorts - 1); 1479 paLedDevType = & pConsole->maStorageDevType[iLedSata];1497 paLedDevType = &maStorageDevType[iLedSata]; 1480 1498 break; 1481 1499 } … … 1495 1513 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1496 1514 InsertConfigNode(pLunL0, "Config", &pCfg); 1497 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapStorageLeds[iLedIde]);1515 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedIde]); 1498 1516 InsertConfigInteger(pCfg, "First", 0); 1499 1517 Assert(cLedIde >= 4); 1500 1518 InsertConfigInteger(pCfg, "Last", 3); 1501 paLedDevType = & pConsole->maStorageDevType[iLedIde];1519 paLedDevType = &maStorageDevType[iLedIde]; 1502 1520 1503 1521 /* IDE flavors */ … … 1523 1541 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1524 1542 InsertConfigNode(pLunL0, "Config", &pCfg); 1525 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapStorageLeds[iLedFloppy]);1543 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedFloppy]); 1526 1544 InsertConfigInteger(pCfg, "First", 0); 1527 1545 Assert(cLedFloppy >= 1); 1528 1546 InsertConfigInteger(pCfg, "Last", 0); 1529 paLedDevType = & pConsole->maStorageDevType[iLedFloppy];1547 paLedDevType = &maStorageDevType[iLedFloppy]; 1530 1548 break; 1531 1549 } … … 1542 1560 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1543 1561 InsertConfigNode(pLunL0, "Config", &pCfg); 1544 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapStorageLeds[iLedSas]);1562 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapStorageLeds[iLedSas]); 1545 1563 InsertConfigInteger(pCfg, "First", 0); 1546 1564 Assert(cLedSas >= 8); 1547 1565 InsertConfigInteger(pCfg, "Last", 7); 1548 paLedDevType = & pConsole->maStorageDevType[iLedSas];1566 paLedDevType = &maStorageDevType[iLedSas]; 1549 1567 break; 1550 1568 } … … 1566 1584 for (size_t j = 0; j < atts.size(); ++j) 1567 1585 { 1568 rc = pConsole->configMediumAttachment(pCtlInst,1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 pConsole->mMachineState,1579 1580 1581 1582 1583 1586 rc = configMediumAttachment(pCtlInst, 1587 pszCtrlDev, 1588 ulInstance, 1589 enmBus, 1590 !!fUseHostIOCache, 1591 !!fBuiltinIoCache, 1592 false /* fSetupMerge */, 1593 0 /* uMergeSource */, 1594 0 /* uMergeTarget */, 1595 atts[j], 1596 mMachineState, 1597 NULL /* phrc */, 1598 false /* fAttachDetach */, 1599 false /* fForceUnmount */, 1600 pVM, 1601 paLedDevType); 1584 1602 if (RT_FAILURE(rc)) 1585 1603 return rc; … … 1772 1790 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1773 1791 InsertConfigNode(pLunL0, "Config", &pCfg); 1774 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapNetworkLeds[ulInstance]);1792 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapNetworkLeds[ulInstance]); 1775 1793 1776 1794 /* 1777 1795 * Configure the network card now 1778 1796 */ 1779 bool fIgnoreConnectFailure = pConsole->mMachineState == MachineState_Restoring;1780 rc = pConsole->configNetwork(pszAdapterName,1781 1782 1783 1784 1785 1786 1787 1788 1797 bool fIgnoreConnectFailure = mMachineState == MachineState_Restoring; 1798 rc = configNetwork(pszAdapterName, 1799 ulInstance, 1800 0, 1801 networkAdapter, 1802 pCfg, 1803 pLunL0, 1804 pInst, 1805 false /*fAttachDetach*/, 1806 fIgnoreConnectFailure); 1789 1807 if (RT_FAILURE(rc)) 1790 1808 return rc; … … 1943 1961 InsertConfigString(pLunL0, "Driver", "MainStatus"); 1944 1962 InsertConfigNode(pLunL0, "Config", &pCfg); 1945 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapSharedFolderLed);1963 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapSharedFolderLed); 1946 1964 InsertConfigInteger(pCfg, "First", 0); 1947 1965 InsertConfigInteger(pCfg, "Last", 0); … … 1958 1976 InsertConfigString(pLunL0, "Driver", "MainAudioSniffer"); 1959 1977 InsertConfigNode(pLunL0, "Config", &pCfg); 1960 AudioSniffer *pAudioSniffer = pConsole->mAudioSniffer;1978 AudioSniffer *pAudioSniffer = mAudioSniffer; 1961 1979 InsertConfigInteger(pCfg, "Object", (uintptr_t)pAudioSniffer); 1962 1980 … … 2116 2134 InsertConfigString(pLunL0, "Driver", "MainStatus"); 2117 2135 InsertConfigNode(pLunL0, "Config", &pCfg); 2118 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapUSBLed[0]);2136 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapUSBLed[0]); 2119 2137 InsertConfigInteger(pCfg, "First", 0); 2120 2138 InsertConfigInteger(pCfg, "Last", 0); … … 2135 2153 static const char *s_pszUsbExtPackName = "Oracle VM VirtualBox Extension Pack"; 2136 2154 # ifdef VBOX_WITH_EXTPACK 2137 if ( pConsole->mptrExtPackManager->isExtPackUsable(s_pszUsbExtPackName))2155 if (mptrExtPackManager->isExtPackUsable(s_pszUsbExtPackName)) 2138 2156 # endif 2139 2157 { … … 2154 2172 InsertConfigString(pLunL0, "Driver", "MainStatus"); 2155 2173 InsertConfigNode(pLunL0, "Config", &pCfg); 2156 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)& pConsole->mapUSBLed[1]);2174 InsertConfigInteger(pCfg, "papLeds", (uintptr_t)&mapUSBLed[1]); 2157 2175 InsertConfigInteger(pCfg, "First", 0); 2158 2176 InsertConfigInteger(pCfg, "Last", 0); … … 2162 2180 { 2163 2181 /* Fatal if a saved state is being restored, otherwise ignorable. */ 2164 if ( pConsole->mMachineState == MachineState_Restoring)2182 if (mMachineState == MachineState_Restoring) 2165 2183 return VMSetError(pVM, VERR_NOT_FOUND, RT_SRC_POS, 2166 2184 N_("Implementation of the USB 2.0 controller not found!\n" … … 2170 2188 "support in the VM settings"), 2171 2189 s_pszUsbExtPackName); 2172 setVMRuntimeErrorCallbackF(pVM, pConsole, 0, "ExtPackNoEhci",2190 setVMRuntimeErrorCallbackF(pVM, this, 0, "ExtPackNoEhci", 2173 2191 N_("Implementation of the USB 2.0 controller not found!\n" 2174 2192 "The device will be disabled. You can ignore this warning " … … 2253 2271 InsertConfigString(pLunL1, "Driver", "MainMouse"); 2254 2272 InsertConfigNode(pLunL1, "Config", &pCfg); 2255 pMouse = pConsole->mMouse;2273 pMouse = mMouse; 2256 2274 InsertConfigInteger(pCfg, "Object", (uintptr_t)pMouse); 2257 2275 } … … 2274 2292 InsertConfigString(pLunL1, "Driver", "MainKeyboard"); 2275 2293 InsertConfigNode(pLunL1, "Config", &pCfg); 2276 pKeyboard = pConsole->mKeyboard;2294 pKeyboard = mKeyboard; 2277 2295 InsertConfigInteger(pCfg, "Object", (uintptr_t)pKeyboard); 2278 2296 } … … 2367 2385 parm.type = VBOX_HGCM_SVC_PARM_PTR; 2368 2386 2369 parm.u.pointer.addr = (IConsole *) (Console*) pConsole;2387 parm.u.pointer.addr = (IConsole *)(Console *)this; 2370 2388 parm.u.pointer.size = sizeof(IConsole *); 2371 2389 … … 2390 2408 */ 2391 2409 2392 rc = configGuestProperties( pConsole);2410 rc = configGuestProperties(this); 2393 2411 #endif /* VBOX_WITH_GUEST_PROPS defined */ 2394 2412 … … 2398 2416 */ 2399 2417 2400 rc = configGuestControl( pConsole);2418 rc = configGuestControl(this); 2401 2419 #endif /* VBOX_WITH_GUEST_CONTROL defined */ 2402 2420 … … 2500 2518 if (RT_SUCCESS(rc)) 2501 2519 { 2502 alock.release();2503 rc = pConsole->mptrExtPackManager->callAllVmConfigureVmmHooks(pConsole, pVM);2504 alock.acquire();2520 pAlock->release(); 2521 rc = mptrExtPackManager->callAllVmConfigureVmmHooks(this, pVM); 2522 pAlock->acquire(); 2505 2523 } 2506 2524 #endif … … 2510 2528 */ 2511 2529 if (RT_SUCCESS(rc)) 2512 rc = pConsole->configCfgmOverlay(pVM, virtualBox, pMachine);2530 rc = configCfgmOverlay(pVM, virtualBox, pMachine); 2513 2531 2514 2532 #undef H … … 2517 2535 * Register VM state change handler. 2518 2536 */ 2519 int rc2 = VMR3AtStateRegister(pVM, Console::vmstateChangeCallback, pConsole);2537 int rc2 = VMR3AtStateRegister(pVM, Console::vmstateChangeCallback, this); 2520 2538 AssertRC(rc2); 2521 2539 if (RT_SUCCESS(rc)) … … 2525 2543 * Register VM runtime error handler. 2526 2544 */ 2527 rc2 = VMR3AtRuntimeErrorRegister(pVM, Console::setVMRuntimeErrorCallback, pConsole);2545 rc2 = VMR3AtRuntimeErrorRegister(pVM, Console::setVMRuntimeErrorCallback, this); 2528 2546 AssertRC(rc2); 2529 2547 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.