VirtualBox

Changeset 105069 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jun 27, 2024 8:26:21 PM (7 months ago)
Author:
vboxsync
Message:

Devices/Network: clean up code and comments. bugref:10268

Location:
trunk/src/VBox/Devices/Network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvNATlibslirp.cpp

    r105064 r105069  
    779779 *
    780780 * @returns VBox status code.
    781  * @param   pDevIns     The pcnet device instance.
     781 * @param   pDrvIns     The pcnet device instance.
    782782 * @param   pThread     The send thread.
    783783 *
     
    791791    drvNATNotifyNATThread(pThis, "drvNATAsyncIoWakeup");
    792792    return VINF_SUCCESS;
    793 }
    794 
    795 /** @todo r=jack: do we need? */
    796 static DECLCALLBACK(int) drvNATHostResThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
    797 {
    798     PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
    799 
    800     if (pThread->enmState == PDMTHREADSTATE_INITIALIZING)
    801         return VINF_SUCCESS;
    802 
    803     while (pThread->enmState == PDMTHREADSTATE_RUNNING)
    804     {
    805         RTReqQueueProcess(pThis->hHostResQueue, RT_INDEFINITE_WAIT);
    806     }
    807 
    808     return VINF_SUCCESS;
    809 }
    810 
    811 static DECLCALLBACK(int) drvNATReqQueueInterrupt()
    812 {
    813     /*
    814      * RTReqQueueProcess loops until request returns a warning or info
    815      * status code (other than VINF_SUCCESS).
    816      */
    817     return VINF_INTERRUPTED;
    818 }
    819 
    820 static DECLCALLBACK(int) drvNATHostResWakeup(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
    821 {
    822     RT_NOREF(pThread);
    823     PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
    824     Assert(pThis != NULL);
    825 
    826     int rc;
    827     rc = RTReqQueueCallEx(pThis->hHostResQueue, NULL /*ppReq*/, 0 /*cMillies*/,
    828                           RTREQFLAGS_IPRT_STATUS | RTREQFLAGS_NO_WAIT,
    829                           (PFNRT)drvNATReqQueueInterrupt, 0);
    830     return rc;
    831793}
    832794
     
    847809/**
    848810 * Info handler.
     811 *
     812 * @param   pDrvIns     The PDM driver context.
     813 * @param   pHlp        ....
     814 * @param   pszArgs     Unused.
     815 *
     816 * @thread  any
    849817 */
    850818static DECLCALLBACK(void) drvNATInfo(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
     
    11731141    }
    11741142
    1175     RTReqQueueDestroy(pThis->hHostResQueue);
    1176     pThis->hHostResQueue = NIL_RTREQQUEUE;
    1177 
    11781143    RTReqQueueDestroy(pThis->hSlirpReqQueue);
    11791144    pThis->hSlirpReqQueue = NIL_RTREQQUEUE;
     
    12491214    pThis->hSlirpReqQueue               = NIL_RTREQQUEUE;
    12501215    pThis->hUrgRecvReqQueue             = NIL_RTREQQUEUE;
    1251     pThis->hHostResQueue                = NIL_RTREQQUEUE;
    12521216    pThis->EventRecv                    = NIL_RTSEMEVENT;
    12531217    pThis->EventUrgRecv                 = NIL_RTSEMEVENT;
     
    13081272    int fDNSProxy = 0;
    13091273    GET_S32(rc, pDrvIns, pCfg, "DNSProxy", fDNSProxy);
    1310     int fUseHostResolver = 0;
    1311     GET_S32(rc, pDrvIns, pCfg, "UseHostResolver", fUseHostResolver);
    13121274    int MTU = 1500;
    13131275    GET_S32(rc, pDrvIns, pCfg, "SlirpMTU", MTU);
     
    14031365    pSlirpCfg->vdhcp_start = vdhcp_start;
    14041366    pSlirpCfg->vnameserver = vnameserver;
     1367    pSlirpCfg->if_mtu = MTU;
    14051368
    14061369#ifndef RT_OS_WINDOWS
     
    14631426    rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pUrgRecvThread, pThis, drvNATUrgRecv,
    14641427                                drvNATUrgRecvWakeup, 256 * _1K, RTTHREADTYPE_IO, "NATURGRX");
    1465     AssertRCReturn(rc, rc);
    1466 
    1467     rc = RTReqQueueCreate(&pThis->hHostResQueue);
    1468     AssertRCReturn(rc, rc);
    1469 
    1470     rc = PDMDrvHlpThreadCreate(pThis->pDrvIns, &pThis->pHostResThread,
    1471                                 pThis, drvNATHostResThread, drvNATHostResWakeup,
    1472                                 128 * _1K, RTTHREADTYPE_IO, "HOSTRES");
    14731428    AssertRCReturn(rc, rc);
    14741429
  • trunk/src/VBox/Devices/Network/DrvNATlibslirp.h

    r105064 r105069  
    301301    RTCRITSECT              XmitLock;
    302302
    303     /** Request queue for the async host resolver. */
    304     RTREQQUEUE               hHostResQueue;
    305     /** Async host resolver thread. */
    306     PPDMTHREAD               pHostResThread;
    307 
    308303#ifdef RT_OS_DARWIN
    309304    /* Handle of the DNS watcher runloop source. */
     
    332327static DECLCALLBACK(int) drvNATAsyncIoThread(PPDMDRVINS, PPDMTHREAD);
    333328static DECLCALLBACK(int) drvNATAsyncIoWakeup(PPDMDRVINS, PPDMTHREAD);
    334 static DECLCALLBACK(int) drvNATHostResThread(PPDMDRVINS, PPDMTHREAD);
    335 static DECLCALLBACK(int) drvNATReqQueueInterrupt();
    336 static DECLCALLBACK(int) drvNATHostResWakeup(PPDMDRVINS, PPDMTHREAD);
    337329static DECLCALLBACK(void *) drvNATQueryInterface(PPDMIBASE, const char *);
    338330static DECLCALLBACK(void) drvNATInfo(PPDMDRVINS, PCDBGFINFOHLP, const char *);
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