VirtualBox

Changeset 20727 in vbox for trunk


Ignore:
Timestamp:
Jun 19, 2009 2:13:31 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48843
Message:

NetworkAttachment: removed global variable passing down to functions

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r20720 r20727  
    32443244
    32453245#ifdef VBOX_DYNAMIC_NET_ATTACH
    3246             if (VBOX_SUCCESS (vrc) &&
    3247                 !((eAttachmentType == meAttachmentType[ulInstance]) ||
    3248                   (eAttachmentType == NetworkAttachmentType_Null &&
    3249                    meAttachmentType[ulInstance] == NetworkAttachmentType_Null)))
    3250             {
    3251                 rc = doNetworkAdapterChange(pszAdapterName,
    3252                                             ulInstance, 0,
    3253                                             eAttachmentType,
    3254                                             &meAttachmentType[ulInstance],
    3255                                             aNetworkAdapter);
    3256             }
     3246            if (VBOX_SUCCESS (vrc) && !(eAttachmentType == meAttachmentType[ulInstance]))
     3247                rc = doNetworkAdapterChange(pszAdapterName, ulInstance, 0, aNetworkAdapter);
    32573248#endif /* VBOX_DYNAMIC_NET_ATTACH */
    32583249
     
    32843275 * @param   uInstance           The PDM device instance.
    32853276 * @param   uLun                The PDM LUN number of the drive.
    3286  * @param   eAttachmentType     The new attachment type.
    3287  * @param   meAttachmentType    The current attachment type.
    32883277 * @param   aNetworkAdapter     The network adapter whose attachment needs to be changed
    32893278 *
    32903279 * @note Locks this object for writing.
    32913280 */
    3292 HRESULT Console::doNetworkAdapterChange (const char *pszDevice, unsigned uInstance,
    3293                                          unsigned uLun, NetworkAttachmentType_T eAttachmentType,
    3294                                          NetworkAttachmentType_T *meAttachmentType,
     3281HRESULT Console::doNetworkAdapterChange (const char *pszDevice,
     3282                                         unsigned uInstance,
     3283                                         unsigned uLun,
    32953284                                         INetworkAdapter *aNetworkAdapter)
    32963285{
    3297     LogFlowThisFunc (("pszDevice=%p:{%s} uInstance=%u uLun=%u eAttachmentType=%d "
    3298                       "meAttachmentType=%p:{%d} aNetworkAdapter=%p\n",
    3299                       pszDevice, pszDevice, uInstance, uLun, eAttachmentType,
    3300                       meAttachmentType, *meAttachmentType, aNetworkAdapter));
     3286    LogFlowThisFunc (("pszDevice=%p:{%s} uInstance=%u uLun=%u aNetworkAdapter=%p\n",
     3287                      pszDevice, pszDevice, uInstance, uLun, aNetworkAdapter));
    33013288
    33023289    AutoCaller autoCaller (this);
     
    33173304    PVMREQ pReq;
    33183305    int vrc = VMR3ReqCall (mpVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */,
    3319                            (PFNRT) Console::changeNetworkAttachment, 7,
    3320                            this, pszDevice, uInstance, uLun, eAttachmentType,
    3321                            meAttachmentType, aNetworkAdapter);
     3306                           (PFNRT) Console::changeNetworkAttachment, 5,
     3307                           this, pszDevice, uInstance, uLun, aNetworkAdapter);
    33223308
    33233309    /* leave the lock before waiting for a result (EMT will call us back!) */
     
    33533339 * @param   uInstance           The PDM device instance.
    33543340 * @param   uLun                The PDM LUN number of the drive.
    3355  * @param   eAttachmentType     The new attachment type.
    3356  * @param   meAttachmentType    The current attachment type.
    33573341 * @param   aNetworkAdapter     The network adapter whose attachment needs to be changed
    33583342 *
     
    33603344 * @note Locks the Console object for writing.
    33613345 */
    3362 DECLCALLBACK(int) Console::changeNetworkAttachment (Console *pThis, const char *pszDevice,
    3363                                                     unsigned uInstance, unsigned uLun,
    3364                                                     NetworkAttachmentType_T eAttachmentType,
    3365                                                     NetworkAttachmentType_T *meAttachmentType,
     3346DECLCALLBACK(int) Console::changeNetworkAttachment (Console *pThis,
     3347                                                    const char *pszDevice,
     3348                                                    unsigned uInstance,
     3349                                                    unsigned uLun,
    33663350                                                    INetworkAdapter *aNetworkAdapter)
    33673351{
    3368     LogFlowFunc (("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u eAttachmentType=%d "
    3369                   "meAttachmentType=%p{%d} aNetworkAdapter=%p\n",
    3370                   pThis, pszDevice, pszDevice, uInstance, uLun, eAttachmentType,
    3371                   meAttachmentType, *meAttachmentType, aNetworkAdapter));
     3352    LogFlowFunc (("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u aNetworkAdapter=%p\n",
     3353                  pThis, pszDevice, pszDevice, uInstance, uLun, aNetworkAdapter));
    33723354
    33733355    AssertReturn (pThis, VERR_INVALID_PARAMETER);
     
    34333415     * failing to attach.
    34343416     */
    3435     rcRet = configNetwork(pThis, pszDevice, uInstance, uLun, eAttachmentType, meAttachmentType,
    3436                           aNetworkAdapter, pCfg, pLunL0, pInst, true);
     3417    rcRet = configNetwork(pThis, pszDevice, uInstance, uLun, aNetworkAdapter, pCfg, pLunL0, pInst, true);
    34373418
    34383419    /*
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r20705 r20727  
    13511351         * Configure the network card now
    13521352         */
    1353         NetworkAttachmentType_T networkAttachment;
    1354         hrc = networkAdapter->COMGETTER(AttachmentType)(&networkAttachment);        H();
    1355 
    1356         rc = configNetwork((Console*) pvConsole, pszAdapterName, ulInstance, 0, networkAttachment,
    1357                            &meAttachmentType[ulInstance], networkAdapter, pCfg, pLunL0, pInst, false);
     1353
     1354        rc = configNetwork(pConsole, pszAdapterName, ulInstance, 0, networkAdapter, pCfg, pLunL0, pInst, false);
    13581355        RC_CHECK();
    13591356    }
     
    20542051 *  @param   uInstance           The PDM device instance.
    20552052 *  @param   uLun                The PDM LUN number of the drive.
    2056  *  @param   eAttachmentType     The new attachment type.
    2057  *  @param   meAttachmentType    The current attachment type.
    20582053 *  @param   aNetworkAdapter     The network adapter whose attachment needs to be changed
    20592054 *
     
    20622057DECLCALLBACK(int)  Console::configNetwork(Console *pThis, const char *pszDevice,
    20632058                                          unsigned uInstance, unsigned uLun,
    2064                                           NetworkAttachmentType_T eAttachmentType,
    2065                                           NetworkAttachmentType_T *meAttachmentType,
    20662059                                          INetworkAdapter *aNetworkAdapter,
    20672060                                          PCFGMNODE pCfg, PCFGMNODE pLunL0,
     
    21452138
    21462139        Bstr networkName, trunkName, trunkType;
     2140        NetworkAttachmentType_T eAttachmentType;
     2141        hrc = aNetworkAdapter->COMGETTER(AttachmentType)(&eAttachmentType);
     2142        H();
    21472143        switch (eAttachmentType)
    21482144        {
     
    28472843                    }
    28482844
     2845                    {
     2846                        /** @todo r=pritesh: get the dhcp server name from the
     2847                         * previous network configuration and then stop the server
     2848                         * else it may conflict with the dhcp server running  with
     2849                         * the current attachment type
     2850                         */
     2851                        /* Stop the hostonly DHCP Server */
     2852                    }
     2853
    28492854                    if(!networkName.isNull())
    28502855                    {
     
    28842889        }
    28852890
    2886         *meAttachmentType = eAttachmentType;
     2891        meAttachmentType[uInstance] = eAttachmentType;
    28872892    }
    28882893    while (0);
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r20631 r20727  
    432432    static DECLCALLBACK(int) configNetwork(Console *pThis, const char *pszDevice,
    433433                                           unsigned uInstance, unsigned uLun,
    434                                            NetworkAttachmentType_T eAttachmentType,
    435                                            NetworkAttachmentType_T *meAttachmentType,
    436434                                           INetworkAdapter *aNetworkAdapter,
    437435                                           PCFGMNODE pCfg, PCFGMNODE pLunL0,
     
    449447#ifdef VBOX_DYNAMIC_NET_ATTACH
    450448    HRESULT doNetworkAdapterChange (const char *pszDevice, unsigned uInstance,
    451                                     unsigned uLun, NetworkAttachmentType_T eAttachmentType,
    452                                     NetworkAttachmentType_T *meAttachmentType,
    453                                     INetworkAdapter *aNetworkAdapter);
     449                                    unsigned uLun, INetworkAdapter *aNetworkAdapter);
    454450    static DECLCALLBACK(int) changeNetworkAttachment (Console *pThis, const char *pszDevice,
    455451                                                      unsigned uInstance, unsigned uLun,
    456                                                       NetworkAttachmentType_T eAttachmentType,
    457                                                       NetworkAttachmentType_T *meAttachmentType,
    458452                                                      INetworkAdapter *aNetworkAdapter);
    459453#endif /* VBOX_DYNAMIC_NET_ATTACH */
Note: See TracChangeset for help on using the changeset viewer.

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