VirtualBox

Ignore:
Timestamp:
Jun 22, 2011 7:30:06 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72442
Message:

*: RTFILE becomes a pointer, RTFileOpen++ expands it's flags paramter from uint32_t to uint64_t.

File:
1 edited

Legend:

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

    r37299 r37596  
    3434#include <iprt/param.h>
    3535#include <iprt/path.h>
     36#include <iprt/pipe.h>
    3637#include <iprt/semaphore.h>
    3738#include <iprt/string.h>
     
    6465    /** Pointer to the driver instance. */
    6566    PPDMDRVINS              pDrvIns;
    66     /** VDE device file handle. */
    67     RTFILE                  FileDevice;
    6867    /** The configured VDE device name. */
    6968    char                   *pszDeviceName;
    7069    /** The write end of the control pipe. */
    71     RTFILE                  PipeWrite;
     70    RTPIPE                  hPipeWrite;
    7271    /** The read end of the control pipe. */
    73     RTFILE                  PipeRead;
     72    RTPIPE                  hPipeRead;
    7473    /** Reader thread. */
    7574    PPDMTHREAD              pThread;
    7675    /** The connection to the VDE switch */
    77     VDECONN                *vdeconn;
     76    VDECONN                *pVdeConn;
    7877
    7978    /** @todo The transmit thread. */
     
    225224
    226225        ssize_t cbSent;
    227         cbSent = vde_send(pThis->vdeconn, pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, 0);
     226        cbSent = vde_send(pThis->pVdeConn, pSgBuf->aSegs[0].pvSeg, pSgBuf->cbUsed, 0);
    228227        rc = cbSent < 0 ? RTErrConvertFromErrno(-cbSent) : VINF_SUCCESS;
    229228    }
     
    241240                                                       iSeg, cSegs, &cbSegFrame);
    242241            ssize_t cbSent;
    243             cbSent = vde_send(pThis->vdeconn, pvSegFrame, cbSegFrame, 0);
     242            cbSent = vde_send(pThis->pVdeConn, pvSegFrame, cbSegFrame, 0);
    244243            rc = cbSent < 0 ? RTErrConvertFromErrno(-cbSent) : VINF_SUCCESS;
    245244            if (RT_FAILURE(rc))
     
    319318         */
    320319        struct pollfd aFDs[2];
    321         aFDs[0].fd      = vde_datafd(pThis->vdeconn);
     320        aFDs[0].fd      = vde_datafd(pThis->pVdeConn);
    322321        aFDs[0].events  = POLLIN | POLLPRI;
    323322        aFDs[0].revents = 0;
    324         aFDs[1].fd      = pThis->PipeRead;
     323        aFDs[1].fd      = RTPipeToNative(pThis->hPipeRead);
    325324        aFDs[1].events  = POLLIN | POLLPRI | POLLERR | POLLHUP;
    326325        aFDs[1].revents = 0;
     
    343342            char achBuf[16384];
    344343            ssize_t cbRead = 0;
    345             cbRead = vde_recv(pThis->vdeconn, achBuf, sizeof(achBuf), 0);
     344            cbRead = vde_recv(pThis->pVdeConn, achBuf, sizeof(achBuf), 0);
    346345            rc = cbRead < 0 ? RTErrConvertFromErrno(-cbRead) : VINF_SUCCESS;
    347346            if (RT_SUCCESS(rc))
     
    404403            char ch;
    405404            size_t cbRead;
    406             RTFileRead(pThis->PipeRead, &ch, 1, &cbRead);
     405            RTPipeRead(pThis->hPipeRead, &ch, 1, &cbRead);
    407406        }
    408407        else
     
    440439    PDRVVDE pThis = PDMINS_2_DATA(pDrvIns, PDRVVDE);
    441440
    442     int rc = RTFileWrite(pThis->PipeWrite, "", 1, NULL);
     441    size_t cbIgnored;
     442    int rc = RTPipeWrite(pThis->hPipeWrite, "", 1, &cbIgnored);
    443443    AssertRC(rc);
    444444
     
    481481     * Terminate the control pipe.
    482482     */
    483     if (pThis->PipeWrite != NIL_RTFILE)
    484     {
    485         int rc = RTFileClose(pThis->PipeWrite);
    486         AssertRC(rc);
    487         pThis->PipeWrite = NIL_RTFILE;
    488     }
    489     if (pThis->PipeRead != NIL_RTFILE)
    490     {
    491         int rc = RTFileClose(pThis->PipeRead);
    492         AssertRC(rc);
    493         pThis->PipeRead = NIL_RTFILE;
    494     }
     483    RTPipeClose(pThis->hPipeWrite);
     484    pThis->hPipeWrite = NIL_RTPIPE;
     485    RTPipeClose(pThis->hPipeRead);
     486    pThis->hPipeRead = NIL_RTPIPE;
    495487
    496488    MMR3HeapFree(pThis->pszDeviceName);
     
    502494        RTCritSectDelete(&pThis->XmitLock);
    503495
    504     vde_close(pThis->vdeconn);
     496    vde_close(pThis->pVdeConn);
     497    pThis->pVdeConn = NULL;
     498
    505499#ifdef VBOX_WITH_STATISTICS
    506500    /*
     
    530524     * Init the static parts.
    531525     */
    532     pThis->pDrvIns                      = pDrvIns;
    533     pThis->FileDevice                   = NIL_RTFILE;
    534     pThis->pszDeviceName                = NULL;
    535     pThis->PipeRead                     = NIL_RTFILE;
    536     pThis->PipeWrite                    = NIL_RTFILE;
     526    pThis->pDrvIns                              = pDrvIns;
     527    pThis->pszDeviceName                        = NULL;
     528    pThis->hPipeRead                            = NIL_RTPIPE;
     529    pThis->hPipeWrite                           = NIL_RTPIPE;
    537530
    538531    /* IBase */
    539     pDrvIns->IBase.pfnQueryInterface    = drvVDEQueryInterface;
     532    pDrvIns->IBase.pfnQueryInterface            = drvVDEQueryInterface;
    540533    /* INetwork */
    541534    pThis->INetworkUp.pfnBeginXmit              = drvVDENetworkUp_BeginXmit;
     
    592585        return PDMDrvHlpVMSetError(pDrvIns, VERR_PDM_HIF_OPEN_FAILED, RT_SRC_POS,
    593586                                   N_("VDEplug library: not found"));
    594     pThis->vdeconn = vde_open(szNetwork, "VirtualBOX", NULL);
    595     if (pThis->vdeconn == NULL)
     587    pThis->pVdeConn = vde_open(szNetwork, "VirtualBOX", NULL);
     588    if (pThis->pVdeConn == NULL)
    596589        return PDMDrvHlpVMSetError(pThis->pDrvIns, VERR_PDM_HIF_OPEN_FAILED, RT_SRC_POS,
    597590                                   N_("Failed to connect to the VDE SWITCH"));
     
    606599     * Create the control pipe.
    607600     */
    608     int fds[2];
    609     if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */
    610     {
    611         rc = RTErrConvertFromErrno(errno);
    612         AssertRC(rc);
    613         return rc;
    614     }
    615     pThis->PipeRead = fds[0];
    616     pThis->PipeWrite = fds[1];
     601    rc = RTPipeCreate(&pThis->hPipeRead, &pThis->hPipeWrite, 0 /*fFlags*/);
     602    AssertRCReturn(rc, rc);
    617603
    618604    /*
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