10-CURRENT r235646 && open-vm-tools-8.6.0-425873
John Baldwin
jhb at freebsd.org
Tue Jun 5 15:02:19 UTC 2012
On Tuesday, June 05, 2012 9:27:51 am Matthias Apitz wrote:
> El día Thursday, May 31, 2012 a las 11:34:55AM -0400, John Baldwin escribió:
>
> > > cc1: warnings being treated as errors
> > > if_vxn.c: In function 'vxn_load_multicast':
> > > if_vxn.c:719: warning: implicit declaration of function 'IF_ADDR_LOCK'
> > > if_vxn.c:719: warning: nested extern declaration of 'IF_ADDR_LOCK'
> > > [-Wnested-ext erns]
> > > if_vxn.c:746: warning: implicit declaration of function 'IF_ADDR_UNLOCK'
> > > if_vxn.c:746: warning: nested extern declaration of 'IF_ADDR_UNLOCK'
> > > [-Wnested-e xterns]
> > > *** [if_vxn.o] Error code 1
> > >
>
> > It should be using if_mcast_rlock() and if_mcast_runlock() instead of
using
> > those macros directly. This works all the way back to 8.0.
> >
>
> Thanks for your patch proposal; but using this it can't find the
> if_mcast_rlock() and if_mcast_runlock() functions declaration (and I
> don't see them in /usr/src/... );
Sorry, they are if_maddr_rlock() and if_maddr_runlock(). They are in if_var.h
right below the macro you looked at. :)
<quote>
/*
* Locks for address lists on the network interface.
*/
#define IF_ADDR_LOCK_INIT(if) rw_init(&(if)->if_addr_lock, "if_addr_lock")
#define IF_ADDR_LOCK_DESTROY(if) rw_destroy(&(if)->if_addr_lock)
#define IF_ADDR_WLOCK(if) rw_wlock(&(if)->if_addr_lock)
#define IF_ADDR_WUNLOCK(if) rw_wunlock(&(if)->if_addr_lock)
#define IF_ADDR_RLOCK(if) rw_rlock(&(if)->if_addr_lock)
#define IF_ADDR_RUNLOCK(if) rw_runlock(&(if)->if_addr_lock)
#define IF_ADDR_LOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_LOCKED)
#define IF_ADDR_WLOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_WLOCKED)
/*
* Function variations on locking macros intended to be used by loadable
* kernel modules in order to divorce them from the internals of address list
* locking.
*/
void if_addr_rlock(struct ifnet *ifp); /* if_addrhead */
void if_addr_runlock(struct ifnet *ifp); /* if_addrhead */
void if_maddr_rlock(struct ifnet *ifp); /* if_multiaddrs */
void if_maddr_runlock(struct ifnet *ifp); /* if_multiaddrs */
</quote>
> based on the SVN diff of the kernel:
>
>
http://svnweb.freebsd.org/base/head/sys/net/if_var.h?r1=231229&r2=233202&pathrev=233202
>
> I came up with another proposal:
>
> *** modules/freebsd/vmxnet/net_compat.h.orig Wed Sep 21 20:25:15 2011
> --- modules/freebsd/vmxnet/net_compat.h Tue Jun 5 15:13:55 2012
> ***************
> *** 170,178 ****
> #if __FreeBSD_version < 505000
> # define VXN_IF_ADDR_LOCK(_ifp)
> # define VXN_IF_ADDR_UNLOCK(_ifp)
> #else
> ! # define VXN_IF_ADDR_LOCK(_ifp) IF_ADDR_LOCK((_ifp))
> ! # define VXN_IF_ADDR_UNLOCK(_ifp) IF_ADDR_UNLOCK((_ifp))
> #endif
>
> #endif /* _VXN_NET_COMPAT_H_ */
> --- 170,181 ----
> #if __FreeBSD_version < 505000
> # define VXN_IF_ADDR_LOCK(_ifp)
> # define VXN_IF_ADDR_UNLOCK(_ifp)
> + #elif __FreeBSD_version < 800000
> + # define VXN_IF_ADDR_LOCK(_ifp) IF_ADDR_LOCK((_ifp))
> + # define VXN_IF_ADDR_UNLOCK(_ifp) IF_ADDR_UNLOCK((_ifp))
> #else
> ! # define VXN_IF_ADDR_LOCK(_ifp) IF_ADDR_WLOCK((_ifp))
> ! # define VXN_IF_ADDR_UNLOCK(_ifp) IF_ADDR_WUNLOCK((_ifp))
> #endif
>
> #endif /* _VXN_NET_COMPAT_H_ */
>
> and using this it compiles fine; but later on it has another problem:
No, we do not wish to expose those to drivers as we do not want the locks
part of the ABI. Plus, you should be using read-locks for this anyway.
--
John Baldwin
More information about the freebsd-current
mailing list