Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys - Eliminate RTFREE() macro in favour of rtfree() function.
details: https://anonhg.NetBSD.org/src/rev/7770753d1760
branches: trunk
changeset: 329734:7770753d1760
user: rmind <rmind%NetBSD.org@localhost>
date: Fri Jun 06 01:02:47 2014 +0000
description:
- Eliminate RTFREE() macro in favour of rtfree() function.
- Make rtcache() function static.
diffstat:
sys/net/if.c | 6 +++---
sys/net/if_faith.c | 6 +++---
sys/net/if_mpls.c | 8 ++++----
sys/net/route.c | 14 +++++++-------
sys/net/route.h | 12 +-----------
sys/netinet/ip_carp.c | 8 ++++----
sys/netinet6/icmp6.c | 14 +++++++-------
sys/netinet6/in6.c | 12 ++++++------
sys/netinet6/nd6.c | 6 +++---
9 files changed, 38 insertions(+), 48 deletions(-)
diffs (truncated from 359 to 300 lines):
diff -r 9313fd419a64 -r 7770753d1760 sys/net/if.c
--- a/sys/net/if.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/net/if.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
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);
diff -r 9313fd419a64 -r 7770753d1760 sys/net/if_faith.c
--- a/sys/net/if_faith.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/net/if_faith.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
else
ret = 0;
if (rt)
- RTFREE(rt);
+ rtfree(rt);
return ret;
}
#endif
diff -r 9313fd419a64 -r 7770753d1760 sys/net/if_mpls.c
--- a/sys/net/if_mpls.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/net/if_mpls.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
}
err = mpls_send_frame(m, rt1->rt_ifp, rt);
- RTFREE(rt1);
+ rtfree(rt1);
return err;
}
@@ -439,7 +439,7 @@
if (error != 0 && m != NULL)
m_freem(m);
if (rt != NULL)
- RTFREE(rt);
+ rtfree(rt);
return error;
}
diff -r 9313fd419a64 -r 7770753d1760 sys/net/route.c
--- a/sys/net/route.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/net/route.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
rtcache_invalidate(&dom->dom_rtcache);
}
-void
+static void
rtcache(struct route *ro)
{
struct domain *dom;
@@ -703,7 +703,7 @@
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 @@
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_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 @@
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);
diff -r 9313fd419a64 -r 7770753d1760 sys/net/route.h
--- a/sys/net/route.h Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/net/route.h Fri Jun 06 01:02:47 2014 +0000
@@ -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_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 @@
}
-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);
diff -r 9313fd419a64 -r 7770753d1760 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/netinet/ip_carp.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
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 @@
break;
}
if (rt != NULL) {
- RTFREE(rt);
+ rtfree(rt);
rt = NULL;
}
break;
diff -r 9313fd419a64 -r 7770753d1760 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/netinet6/icmp6.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
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 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 @@
"%s\n",
ip6_sprintf(gw6),
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
- RTFREE(rt);
+ rtfree(rt);
goto bad;
}
} else {
@@ -2210,7 +2210,7 @@
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
goto bad;
}
- RTFREE(rt);
+ rtfree(rt);
rt = NULL;
}
if (IN6_IS_ADDR_MULTICAST(&reddst6)) {
diff -r 9313fd419a64 -r 7770753d1760 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c Fri Jun 06 00:25:28 2014 +0000
+++ b/sys/netinet6/in6.c Fri Jun 06 01:02:47 2014 +0000
@@ -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 @@
if (memcmp(&mltaddr.sin6_addr,
&satocsin6(rt_getkey(rt))->sin6_addr,
MLTMASK_LEN)) {
Home |
Main Index |
Thread Index |
Old Index