VirtualBox

Changeset 93858 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Feb 20, 2022 7:47:37 AM (3 years ago)
Author:
vboxsync
Message:

Main: Restored bwGroups[i]->COMGETTER(Name)(strName.asOutParam()); accidentally removed by r150070; Corrected bogus AssertLogRelMsgRCReturn; various cleanups. bugref:10053

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r93855 r93858  
    784784    typedef struct LEDSET *PLEDSET;
    785785    PPDMLED *i_getLedSet(uint32_t iLedSet);
    786     PLEDSET i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppSubTypes);
     786    uint32_t i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppSubTypes);
    787787    void i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType,
    788788                              uint32_t uFirst, uint32_t uLast,
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r93856 r93858  
    40014001            pVMM->pfnCFGMR3RemoveNode(pLunL0);
    40024002
    4003             Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);
     4003            Utf8StrFmt devicePath("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);
    40044004            pThis->mapMediumAttachments.erase(devicePath);
    40054005
     
    1123711237    pThis->pDrvIns                          = pDrvIns;
    1123811238    pThis->pConsole                         = pConsole;
    11239     pThis->pmapMediumAttachments            = &pConsole->mapMediumAttachments;
     11239    pThis->pmapMediumAttachments            = NULL;
    1124011240    pThis->papLeds                          = pConsole->i_getLedSet(iLedSet);
    1124111241    pThis->pszDeviceInstance                = NULL;
     
    1124411244     * Read config.
    1124511245     */
    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);
    1125011249
    1125111250    if (fHasMediumAttachments)
    1125211251    {
     11252        pThis->pmapMediumAttachments = &pConsole->mapMediumAttachments;
    1125311253        rc = pHlp->pfnCFGMQueryStringAlloc(pCfg, "DeviceInstance", &pThis->pszDeviceInstance);
    1125411254        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  
    645645 * This grabs a maLedSets entry and populates it with @a cLeds.
    646646 *
    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.
    651652 */
    652 Console::PLEDSET Console::i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppaSubTypes)
     653uint32_t Console::i_allocateDriverLeds(uint32_t cLeds, DeviceType_T enmType, DeviceType_T **ppaSubTypes)
    653654{
    654655    Assert(cLeds > 0);
     
    659660    AssertStmt(mcLedSets < RT_ELEMENTS(maLedSets),
    660661               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];
    662664    pLS->papLeds = (PPDMLED *)RTMemAllocZ(sizeof(PPDMLED) * cLeds);
    663665    AssertStmt(pLS->papLeds, throw E_OUTOFMEMORY);
     
    674676    }
    675677
    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;
    678680}
    679681
     
    687689{
    688690    Assert(uFirst <= uLast);
    689     PCFGMNODE pLunL0, pCfg;
     691    PCFGMNODE pLunL0;
    690692    InsertConfigNode(pCtlInst,  "LUN#999", &pLunL0);
    691693    InsertConfigString(pLunL0,  "Driver",               "MainStatus");
     694    PCFGMNODE pCfg;
    692695    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);
    696700    if (pmapMediumAttachments)
    697701    {
    698         InsertConfigInteger(pCfg,   "HasMediumAttachments", 1);
    699702        AssertPtr(pcszDevice);
    700         Utf8Str deviceInstance = Utf8StrFmt("%s/%u", pcszDevice, uInstance);
     703        Utf8StrFmt deviceInstance("%s/%u", pcszDevice, uInstance);
    701704        InsertConfigString(pCfg,    "DeviceInstance", deviceInstance.c_str());
    702705    }
     
    14871490        {
    14881491            Bstr strName;
     1492            hrc = bwGroups[i]->COMGETTER(Name)(strName.asOutParam());                       H();
    14891493            if (strName.isEmpty())
    14901494                return pVMM->pfnVMR3SetError(pUVM, VERR_CFGM_NO_NODE, RT_SRC_POS, N_("No bandwidth group name specified"));
     
    14941498            LONG64 cMaxBytesPerSec = 0;
    14951499            hrc = bwGroups[i]->COMGETTER(MaxBytesPerSec)(&cMaxBytesPerSec);                 H();
     1500
    14961501            if (enmType == BandwidthGroupType_Disk)
    14971502            {
     
    48644869            *ppLunL0 = pLunL0;
    48654870
    4866         Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);
     4871        Utf8StrFmt devicePath("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);
    48674872        mapMediumAttachments[devicePath] = pMediumAtt;
    48684873
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette