diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-06-21 19:30:33 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-06-21 19:30:33 +0000 |
commit | 1f7e54e8c51edb13935d195e0c1f2ec68c672794 (patch) | |
tree | 2cfffa4418c1fa90f1e9d094aa882742d0ababb9 /sys/net/route.c | |
parent | 2fc79768f33d575d200ae1482dc23207f9d93703 (diff) | |
download | FreeBSD-src-1f7e54e8c51edb13935d195e0c1f2ec68c672794.zip FreeBSD-src-1f7e54e8c51edb13935d195e0c1f2ec68c672794.tar.gz |
Clean up common ifaddr management:
- Unify reference count and lock initialization in a single function,
ifa_init().
- Move tear-down from a macro (IFAFREE) to a function ifa_free().
- Move reference count bump from a macro (IFAREF) to a function ifa_ref().
- Instead of using a u_int protected by a mutex to refcount(9) for
reference count management.
The ifa_mtx is now used for exactly one ioctl, and possibly should be
removed.
MFC after: 3 weeks
Diffstat (limited to 'sys/net/route.c')
-rw-r--r-- | sys/net/route.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index aaa38d7..1705e98 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -474,7 +474,7 @@ rtfree(struct rtentry *rt) * e.g other routes and ifaddrs. */ if (rt->rt_ifa) - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); /* * The key is separatly alloc'd so free it (see rt_setgate()). * This also frees the gateway, as they are always malloc'd @@ -1126,7 +1126,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt, * This moved from below so that rnh->rnh_addaddr() can * examine the ifa and ifa->ifa_ifp if it so desires. */ - IFAREF(ifa); + ifa_ref(ifa); rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; rt->rt_rmx.rmx_weight = 1; @@ -1136,7 +1136,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt, if (rn_mpath_capable(rnh) && rt_mpath_conflict(rnh, rt, netmask)) { if (rt->rt_ifa) { - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); } Free(rt_key(rt)); RT_LOCK_DESTROY(rt); @@ -1153,7 +1153,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt, */ if (rn == NULL) { if (rt->rt_ifa) - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); @@ -1409,8 +1409,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fibnum) */ if (memcmp(rt->rt_ifa->ifa_addr, ifa->ifa_addr, ifa->ifa_addr->sa_len)) { - IFAFREE(rt->rt_ifa); - IFAREF(ifa); + ifa_free(rt->rt_ifa); + ifa_ref(ifa); rt->rt_ifp = ifa->ifa_ifp; rt->rt_ifa = ifa; } |