VirtualBox

Ignore:
Timestamp:
Jun 9, 2010 12:14:59 PM (14 years ago)
Author:
vboxsync
Message:

iprt/asm.h,*: Revised the ASMAtomic*Ptr functions and macros. The new saves lots of unsafe (void * volatile *) casts as well as adding some type safety when using GCC (typeof rulez).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c

    r29747 r30111  
    498498    int error;
    499499
    500     ifp = (void *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.ifp);
     500    ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
    501501
    502502    if (fDst & INTNETTRUNKDIR_WIRE)
     
    568568    RTSpinlockAcquireNoInts(pThis->hSpinlock, &Tmp);
    569569
    570     ASMAtomicUoWritePtr((void * volatile *)&pThis->u.s.ifp, ifp);
     570    ASMAtomicUoWritePtr(&pThis->u.s.ifp, ifp);
    571571    pThis->u.s.node = node;
    572572    bcopy(IF_LLADDR(ifp), &pThis->u.s.MacAddr, ETHER_ADDR_LEN);
     
    611611    struct ifnet *ifp, *ifp0;
    612612
    613     ifp = (struct ifnet *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.ifp);
     613    ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
    614614    /*
    615615     * Attempt to check if the interface is still there and re-initialize if
     
    669669    Log(("%s: fActive:%d\n", __func__, fActive));
    670670
    671     ifp = (struct ifnet *)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.ifp);
    672     node = (node_p)ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.node);
     671    ifp = ASMAtomicUoReadPtrT(&pThis->u.s.ifp, struct ifnet *);
     672    node = ASMAtomicUoReadPtrT(&pThis->u.s.node, node_p);
    673673
    674674    memset(&ifreq, 0, sizeof(struct ifreq));
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