- Eliminate RTFREE() macro in favour of rtfree() function.

- Make rtcache() function static.
This commit is contained in:
rmind 2014-06-06 01:02:47 +00:00
parent bc5cc9055a
commit 32293d340f
9 changed files with 38 additions and 48 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.276 2014/06/05 23:48:16 rmind Exp $ */
/* $NetBSD: if.c,v 1.277 2014/06/06 01:02:47 rmind Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.276 2014/06/05 23:48:16 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.277 2014/06/06 01:02:47 rmind Exp $");
#include "opt_inet.h"
@ -927,7 +927,7 @@ if_rt_walktree(struct rtentry *rt, void *v)
rt_mask(rt), rt->rt_flags, NULL);
KASSERT((rt->rt_flags & RTF_UP) == 0);
rt->rt_ifp = NULL;
RTFREE(rt);
rtfree(rt);
if (error != 0)
printf("%s: warning: unable to delete rtentry @ %p, "
"error = %d\n", ifp->if_xname, rt, error);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_faith.c,v 1.48 2014/06/05 23:48:16 rmind Exp $ */
/* $NetBSD: if_faith.c,v 1.49 2014/06/06 01:02:47 rmind Exp $ */
/* $KAME: if_faith.c,v 1.21 2001/02/20 07:59:26 itojun Exp $ */
/*
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.48 2014/06/05 23:48:16 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.49 2014/06/06 01:02:47 rmind Exp $");
#include "opt_inet.h"
@ -290,7 +290,7 @@ faithprefix(struct in6_addr *in6)
else
ret = 0;
if (rt)
RTFREE(rt);
rtfree(rt);
return ret;
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_mpls.c,v 1.13 2014/06/05 23:48:16 rmind Exp $ */
/* $NetBSD: if_mpls.c,v 1.14 2014/06/06 01:02:47 rmind Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.13 2014/06/05 23:48:16 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.14 2014/06/06 01:02:47 rmind Exp $");
#include "opt_inet.h"
#include "opt_mpls.h"
@ -268,7 +268,7 @@ mpls_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struc
}
err = mpls_send_frame(m, rt1->rt_ifp, rt);
RTFREE(rt1);
rtfree(rt1);
return err;
}
@ -439,7 +439,7 @@ done:
if (error != 0 && m != NULL)
m_freem(m);
if (rt != NULL)
RTFREE(rt);
rtfree(rt);
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.130 2014/04/26 11:10:10 pooka Exp $ */
/* $NetBSD: route.c,v 1.131 2014/06/06 01:02:47 rmind Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@ -93,7 +93,7 @@
#include "opt_route.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.130 2014/04/26 11:10:10 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.131 2014/06/06 01:02:47 rmind Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -301,7 +301,7 @@ rtflushall(int family)
rtcache_invalidate(&dom->dom_rtcache);
}
void
static void
rtcache(struct route *ro)
{
struct domain *dom;
@ -703,7 +703,7 @@ rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt)
if ((rt = rt_deladdr(rtbl, dst, netmask)) == NULL)
senderr(ESRCH);
if (rt->rt_gwroute) {
RTFREE(rt->rt_gwroute);
rtfree(rt->rt_gwroute);
rt->rt_gwroute = NULL;
}
if (rt->rt_parent) {
@ -795,7 +795,7 @@ rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt)
rtdeletemsg(crt);
rc = rt_addaddr(rtbl, rt, netmask);
}
RTFREE(crt);
rtfree(crt);
RT_DPRINTF("rt->_rt_key = %p\n", (void *)rt->_rt_key);
}
RT_DPRINTF("rt->_rt_key = %p\n", (void *)rt->_rt_key);
@ -851,7 +851,7 @@ rt_setgate(struct rtentry *rt, const struct sockaddr *gate)
RT_DPRINTF("rt->_rt_key = %p\n", (void *)rt->_rt_key);
if (rt->rt_gwroute) {
RTFREE(rt->rt_gwroute);
rtfree(rt->rt_gwroute);
rt->rt_gwroute = NULL;
}
KASSERT(rt->_rt_key != NULL);
@ -1284,7 +1284,7 @@ rtcache_clear(struct route *ro)
LIST_REMOVE(ro, ro_rtcache_next);
RTFREE(ro->_ro_rt);
rtfree(ro->_ro_rt);
ro->_ro_rt = NULL;
ro->ro_invalid = false;
rtcache_invariants(ro);

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.h,v 1.83 2014/04/26 11:10:10 pooka Exp $ */
/* $NetBSD: route.h,v 1.84 2014/06/06 01:02:47 rmind Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -382,7 +382,6 @@ void rt_timer_queue_destroy(struct rttimer_queue *, int);
void rt_timer_remove_all(struct rtentry *, int);
unsigned long rt_timer_count(struct rttimer_queue *);
void rt_timer_timer(void *);
void rtcache(struct route *);
void rtflushall(int);
struct rtentry *
rtalloc1(const struct sockaddr *, int);
@ -495,15 +494,6 @@ rtcache_validate(const struct route *ro)
}
static inline void
RTFREE(struct rtentry *rt)
{
if (rt->rt_refcnt <= 1)
rtfree(rt);
else
rt->rt_refcnt--;
}
int rt_walktree(sa_family_t, int (*)(struct rtentry *, void *), void *);
void route_enqueue(struct mbuf *, int);
int rt_inithead(rtbl_t **, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_carp.c,v 1.56 2014/05/29 23:02:48 rmind Exp $ */
/* $NetBSD: ip_carp.c,v 1.57 2014/06/06 01:02:47 rmind Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@ -31,7 +31,7 @@
#include "opt_mbuftrace.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.56 2014/05/29 23:02:48 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.57 2014/06/06 01:02:47 rmind Exp $");
/*
* TODO:
@ -390,7 +390,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
hr_otherif = (rt && rt->rt_ifp != &sc->sc_if &&
rt->rt_flags & (RTF_CLONING|RTF_CLONED));
if (rt != NULL) {
RTFREE(rt);
rtfree(rt);
rt = NULL;
}
@ -434,7 +434,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
break;
}
if (rt != NULL) {
RTFREE(rt);
rtfree(rt);
rt = NULL;
}
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: icmp6.c,v 1.168 2014/05/30 01:39:03 christos Exp $ */
/* $NetBSD: icmp6.c,v 1.169 2014/06/06 01:02:47 rmind Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.168 2014/05/30 01:39:03 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.169 2014/06/06 01:02:47 rmind Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -1132,8 +1132,8 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated)
rt->rt_rmx.rmx_mtu = mtu;
}
}
if (rt) { /* XXX: need braces to avoid conflict with else in RTFREE. */
RTFREE(rt);
if (rt) {
rtfree(rt);
}
/*
@ -2188,7 +2188,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
"ICMP6 redirect rejected; no route "
"with inet6 gateway found for redirect dst: %s\n",
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
RTFREE(rt);
rtfree(rt);
goto bad;
}
@ -2200,7 +2200,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
"%s\n",
ip6_sprintf(gw6),
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
RTFREE(rt);
rtfree(rt);
goto bad;
}
} else {
@ -2210,7 +2210,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
goto bad;
}
RTFREE(rt);
rtfree(rt);
rt = NULL;
}
if (IN6_IS_ADDR_MULTICAST(&reddst6)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6.c,v 1.170 2014/05/17 20:44:24 rmind Exp $ */
/* $NetBSD: in6.c,v 1.171 2014/06/06 01:02:47 rmind Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.170 2014/05/17 20:44:24 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.171 2014/06/06 01:02:47 rmind Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -1168,7 +1168,7 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
if (memcmp(&mltaddr.sin6_addr,
&satocsin6(rt_getkey(rt))->sin6_addr,
MLTMASK_LEN)) {
RTFREE(rt);
rtfree(rt);
rt = NULL;
} else if (rt->rt_ifp != ifp) {
IN6_DPRINTF("%s: rt_ifp %p -> %p (%s) "
@ -1199,7 +1199,7 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
if (error)
goto cleanup;
} else {
RTFREE(rt);
rtfree(rt);
}
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0);
if (!imm) {
@ -1253,7 +1253,7 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
if (memcmp(&mltaddr.sin6_addr,
&satocsin6(rt_getkey(rt))->sin6_addr,
32 / NBBY)) {
RTFREE(rt);
rtfree(rt);
rt = NULL;
} else if (rt->rt_ifp != ifp) {
IN6_DPRINTF("%s: rt_ifp %p -> %p (%s) "
@ -1284,7 +1284,7 @@ in6_update_ifa1(struct ifnet *ifp, struct in6_aliasreq *ifra,
goto cleanup;
#undef MLTMASK_LEN
} else {
RTFREE(rt);
rtfree(rt);
}
imm = in6_joingroup(ifp, &mltaddr.sin6_addr, &error, 0);
if (!imm) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6.c,v 1.151 2014/06/05 16:06:49 roy Exp $ */
/* $NetBSD: nd6.c,v 1.152 2014/06/06 01:02:47 rmind Exp $ */
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
/*
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.151 2014/06/05 16:06:49 roy Exp $");
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.152 2014/06/06 01:02:47 rmind Exp $");
#include "opt_ipsec.h"
@ -847,7 +847,7 @@ nd6_lookup1(const struct in6_addr *addr6, int create, struct ifnet *ifp,
* interface route.
*/
if (create) {
RTFREE(rt);
rtfree(rt);
rt = NULL;
}
}