VirtualBox

Changeset 30117 in vbox for trunk/src


Ignore:
Timestamp:
Jun 9, 2010 12:53:55 PM (15 years ago)
Author:
vboxsync
Message:

iprt/asm.h,*: Added ASMAtomicWriteNullPtr and ASMAtomicUoWriteNullPtr to better deal with NULL being 0 in C++.

Location:
trunk/src/VBox/HostDrivers/VBoxNetFlt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h

    r30107 r30117  
    192192#  else
    193193            /** Pointer to the bound IPv4 stream. */
    194             void volatile *pvIp4Stream;
     194            struct vboxnetflt_stream_t * volatile pvIp4Stream;
    195195            /** Pointer to the bound IPv6 stream. */
    196             void volatile *pvIp6Stream;
     196            struct vboxnetflt_stream_t * volatile pIp6Stream;
    197197            /** Pointer to the bound ARP stream. */
    198             void volatile *pvArpStream;
     198            struct vboxnetflt_stream_t * volatile pArpStream;
    199199            /** Pointer to the unbound promiscuous stream. */
    200             void volatile *pvPromiscStream;
     200            struct vboxnetflt_promisc_stream_t * volatile pPromiscStream;
    201201            /** Whether we are attaching to IPv6 stream dynamically now. */
    202202            bool volatile fAttaching;
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r30115 r30117  
    781781    switch (pStream->Type)
    782782    {
    783         case kIp4Stream:        ASMAtomicUoWritePtr(&pThis->u.s.pvIp4Stream, pStream);        break;
    784         case kIp6Stream:        ASMAtomicUoWritePtr(&pThis->u.s.pvIp6Stream, pStream);        break;
    785         case kArpStream:        ASMAtomicUoWritePtr(&pThis->u.s.pvArpStream, pStream);        break;
    786         case kPromiscStream:    ASMAtomicUoWritePtr(&pThis->u.s.pvPromiscStream, pStream);    break;
     783        case kIp4Stream:        ASMAtomicUoWritePtr(&pThis->u.s.pIp4Stream, pStream);        break;
     784        case kIp6Stream:        ASMAtomicUoWritePtr(&pThis->u.s.pIp6Stream, pStream);        break;
     785        case kArpStream:        ASMAtomicUoWritePtr(&pThis->u.s.pArpStream, pStream);        break;
     786        case kPromiscStream:    ASMAtomicUoWritePtr(&pThis->u.s.pPromiscStream, pStream);    break;
    787787        default:    /* Heh. */
    788788        {
     
    944944    switch (pStream->Type)
    945945    {
    946         case kIp4Stream:        ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pvIp4Stream);     break;
    947         case kIp6Stream:        ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pvIp6Stream);     break;
    948         case kArpStream:        ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pvArpStream);     break;
    949         case kPromiscStream:    ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pvPromiscStream); break;
     946        case kIp4Stream:        ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pIp4Stream);     break;
     947        case kIp6Stream:        ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pIp6Stream);     break;
     948        case kArpStream:        ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pArpStream);     break;
     949        case kPromiscStream:    ASMAtomicUoWriteNullPtr(&pStream->pThis->u.s.pPromiscStream); break;
    950950        default:    /* Heh. */
    951951        {
     
    24762476        && RT_LIKELY(pTimer))
    24772477    {
    2478         vboxnetflt_stream_t *pIp6Stream  = ASMAtomicUoReadPtrT(pThis->u.s.pvIp6Stream, vboxnetflt_stream_t *);
     2478        vboxnetflt_stream_t *pIp6Stream = ASMAtomicUoReadPtrT(&pThis->u.s.pIp6Stream, vboxnetflt_stream_t *);
    24792479        bool fIp6Attaching = ASMAtomicUoReadBool(&pThis->u.s.fAttaching);
    24802480        if (   !pIp6Stream
     
    25122512
    25132513    int rc = VERR_GENERAL_FAILURE;
    2514     vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
     2514    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pPromiscStream, vboxnetflt_promisc_stream_t *);
    25152515    if (RT_LIKELY(pPromiscStream))
    25162516    {
     
    25662566    vboxNetFltSolarisCloseStream(pThis);
    25672567    int rc = VINF_SUCCESS;
    2568     if (pThis->u.s.pvIp4Stream)
     2568    if (pThis->u.s.pIp4Stream)
    25692569        rc = vboxNetFltSolarisAttachIp4(pThis, false /* fAttach */);
    2570     if (pThis->u.s.pvIp6Stream)
     2570    if (pThis->u.s.pIp6Stream)
    25712571        rc = vboxNetFltSolarisAttachIp6(pThis, false /* fAttach */);
    25722572
    25732573#ifdef VBOXNETFLT_SOLARIS_IPV6_POLLING
    2574     vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
     2574    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pPromiscStream, vboxnetflt_promisc_stream_t *);
    25752575    if (   pPromiscStream
    25762576        && pPromiscStream->pIp6Timer == NULL)
     
    31983198    Assert(pStream->Type == kPromiscStream);
    31993199
    3200     vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_promisc_stream_t *);
     3200    vboxnetflt_promisc_stream_t *pPromiscStream = ASMAtomicUoReadPtrT(&pThis->u.s.pPromiscStream, vboxnetflt_promisc_stream_t *);
    32013201    if (RT_UNLIKELY(!pPromiscStream))
    32023202    {
     
    35793579     * Enable/disable promiscuous mode.
    35803580     */
    3581     vboxnetflt_stream_t *pStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvPromiscStream, vboxnetflt_stream_t *);
     3581    vboxnetflt_promisc_stream_t *pStream = ASMAtomicUoReadPtrT(&pThis->u.s.pPromiscStream, vboxnetflt_stream_t *);
    35823582    if (pStream)
    35833583    {
    3584         if (pStream->pReadQueue)
    3585         {
    3586             int rc = vboxNetFltSolarisPromiscReq(pStream->pReadQueue, fActive);
     3584        if (pStream->Stream.pReadQueue)
     3585        {
     3586            int rc = vboxNetFltSolarisPromiscReq(pStream->Stream.pReadQueue, fActive);
    35873587            if (RT_FAILURE(rc))
    35883588                LogRel((DEVICE_NAME ":vboxNetFltPortOsSetActive failed to request promiscuous mode! rc=%d\n", rc));
     
    36803680     */
    36813681    pThis->u.s.hIface = NULL;
    3682     pThis->u.s.pvIp4Stream = NULL;
    3683     pThis->u.s.pvIp6Stream = NULL;
    3684     pThis->u.s.pvArpStream = NULL;
    3685     pThis->u.s.pvPromiscStream = NULL;
     3682    pThis->u.s.pIp4Stream = NULL;
     3683    pThis->u.s.pIp6Stream = NULL;
     3684    pThis->u.s.pArpStream = NULL;
     3685    pThis->u.s.pPromiscStream = NULL;
    36863686    pThis->u.s.fAttaching = false;
    36873687    pThis->u.s.fVLAN = false;
     
    38303830         * We either bind to both or neither; so atomic reading one should be sufficient.
    38313831         */
    3832         vboxnetflt_stream_t *pIp4Stream = ASMAtomicUoReadPtrT(&pThis->u.s.pvIp4Stream, vboxnetflt_stream_t *);
     3832        vboxnetflt_stream_t *pIp4Stream = ASMAtomicUoReadPtrT(&pThis->u.s.pIp4Stream, vboxnetflt_stream_t *);
    38333833        if (!pIp4Stream)
    38343834            return rc;
     
    38493849                LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_HOST ARP\n"));
    38503850
    3851                 vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtrT(&pThis->u.s.pvArpStream, vboxnetflt_stream_t *);
     3851                vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtrT(&pThis->u.s.pArpStream, vboxnetflt_stream_t *);
    38523852                if (pArpStream)
    38533853                {
     
    38763876            else
    38773877            {
    3878                  vboxnetflt_stream_t *pIp6Stream  = ASMAtomicUoReadPtrT(&pThis->u.s.pvIp6Stream, vboxnetflt_stream_t *);
     3878                 vboxnetflt_stream_t *pIp6Stream = ASMAtomicUoReadPtrT(&pThis->u.s.pIp6Stream, vboxnetflt_stream_t *);
    38793879                 if (   pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV6)
    38803880                     && pIp6Stream)
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