Changeset 93858 in vbox for trunk/src/VBox/Main
- Timestamp:
- Feb 20, 2022 7:47:37 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r93855 r93858 784 784 typedef struct LEDSET *PLEDSET; 785 785 PPDMLED *i_getLedSet(uint32_t iLedSet); 786 PLEDSETi_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppSubTypes);786 uint32_t i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppSubTypes); 787 787 void i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType, 788 788 uint32_t uFirst, uint32_t uLast, -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r93856 r93858 4001 4001 pVMM->pfnCFGMR3RemoveNode(pLunL0); 4002 4002 4003 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);4003 Utf8StrFmt devicePath("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 4004 4004 pThis->mapMediumAttachments.erase(devicePath); 4005 4005 … … 11237 11237 pThis->pDrvIns = pDrvIns; 11238 11238 pThis->pConsole = pConsole; 11239 pThis->pmapMediumAttachments = &pConsole->mapMediumAttachments;11239 pThis->pmapMediumAttachments = NULL; 11240 11240 pThis->papLeds = pConsole->i_getLedSet(iLedSet); 11241 11241 pThis->pszDeviceInstance = NULL; … … 11244 11244 * Read config. 11245 11245 */ 11246 uint32_t fHasMediumAttachments; 11247 rc = pHlp->pfnCFGMQueryU32Def(pCfg, "HasMediumAttachments", &fHasMediumAttachments, 0); 11248 AssertLogRelMsgRCReturn(RT_SUCCESS(rc) || rc == VERR_CFGM_VALUE_NOT_FOUND, 11249 ("Configuration error: Failed to query the \"HasMediumAttachments\" value! rc=%Rrc\n", rc), rc); 11246 bool fHasMediumAttachments; 11247 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "HasMediumAttachments", &fHasMediumAttachments, false); 11248 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"HasMediumAttachments\" value! rc=%Rrc\n", rc), rc); 11250 11249 11251 11250 if (fHasMediumAttachments) 11252 11251 { 11252 pThis->pmapMediumAttachments = &pConsole->mapMediumAttachments; 11253 11253 rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "DeviceInstance", &pThis->pszDeviceInstance); 11254 11254 AssertLogRelMsgRCReturn(rc, ("Configuration error: Failed to query the \"DeviceInstance\" value! rc=%Rrc\n", rc), rc); -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r93857 r93858 645 645 * This grabs a maLedSets entry and populates it with @a cLeds. 646 646 * 647 * @param cLeds The number of LEDs in the set. 648 * @param enmType The device type. 649 * @param ppaSubTypes When not NULL, subtypes for each LED and return the array pointer here. 650 * @throws HRESULT or ConfigError on trouble 647 * @returns Index into maLedSets. 648 * @param cLeds The number of LEDs in the set. 649 * @param enmType The device type. 650 * @param ppaSubTypes When not NULL, subtypes for each LED and return the 651 * array pointer here. 651 652 */ 652 Console::PLEDSETConsole::i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppaSubTypes)653 uint32_t Console::i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppaSubTypes) 653 654 { 654 655 Assert(cLeds > 0); … … 659 660 AssertStmt(mcLedSets < RT_ELEMENTS(maLedSets), 660 661 throw ConfigError("AllocateDriverPapLeds", VERR_OUT_OF_RANGE, "Too many LED sets")); 661 PLEDSET pLS = &maLedSets[mcLedSets++]; 662 uint32_t const idxLedSet = mcLedSets++; 663 PLEDSET pLS = &maLedSets[idxLedSet]; 662 664 pLS->papLeds = (PPDMLED *)RTMemAllocZ(sizeof(PPDMLED) * cLeds); 663 665 AssertStmt(pLS->papLeds, throw E_OUTOFMEMORY); … … 674 676 } 675 677 676 LogRel (("mcLedSets = %d, RT_ELEMENTS(maLedSets) = %d\n", mcLedSets, RT_ELEMENTS(maLedSets)));677 return pLS;678 LogRel2(("mcLedSets = %d, RT_ELEMENTS(maLedSets) = %d\n", mcLedSets, RT_ELEMENTS(maLedSets))); 679 return idxLedSet; 678 680 } 679 681 … … 687 689 { 688 690 Assert(uFirst <= uLast); 689 PCFGMNODE pLunL0 , pCfg;691 PCFGMNODE pLunL0; 690 692 InsertConfigNode(pCtlInst, "LUN#999", &pLunL0); 691 693 InsertConfigString(pLunL0, "Driver", "MainStatus"); 694 PCFGMNODE pCfg; 692 695 InsertConfigNode(pLunL0, "Config", &pCfg); 693 InsertConfigInteger(pCfg, "iLedSet", mcLedSets); 694 (void) i_allocateDriverLeds(uLast - uFirst + 1, enmType, ppaSubTypes); 695 696 uint32_t const iLedSet = i_allocateDriverLeds(uLast - uFirst + 1, enmType, ppaSubTypes); 697 InsertConfigInteger(pCfg, "iLedSet", iLedSet); 698 699 InsertConfigInteger(pCfg, "HasMediumAttachments", pmapMediumAttachments != NULL); 696 700 if (pmapMediumAttachments) 697 701 { 698 InsertConfigInteger(pCfg, "HasMediumAttachments", 1);699 702 AssertPtr(pcszDevice); 700 Utf8Str deviceInstance = Utf8StrFmt("%s/%u", pcszDevice, uInstance);703 Utf8StrFmt deviceInstance("%s/%u", pcszDevice, uInstance); 701 704 InsertConfigString(pCfg, "DeviceInstance", deviceInstance.c_str()); 702 705 } … … 1487 1490 { 1488 1491 Bstr strName; 1492 hrc = bwGroups[i]->COMGETTER(Name)(strName.asOutParam()); H(); 1489 1493 if (strName.isEmpty()) 1490 1494 return pVMM->pfnVMR3SetError(pUVM, VERR_CFGM_NO_NODE, RT_SRC_POS, N_("No bandwidth group name specified")); … … 1494 1498 LONG64 cMaxBytesPerSec = 0; 1495 1499 hrc = bwGroups[i]->COMGETTER(MaxBytesPerSec)(&cMaxBytesPerSec); H(); 1500 1496 1501 if (enmType == BandwidthGroupType_Disk) 1497 1502 { … … 4864 4869 *ppLunL0 = pLunL0; 4865 4870 4866 Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);4871 Utf8StrFmt devicePath("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN); 4867 4872 mapMediumAttachments[devicePath] = pMediumAtt; 4868 4873
Note:
See TracChangeset
for help on using the changeset viewer.