This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
bsd_tcpip radix Free() changed to R_Free()
- From: Shaun Louie <sal at microplex dot com>
- To: eCos Patches <ecos-patches at sources dot redhat dot com>
- Date: Mon, 10 Dec 2007 11:40:05 -0600
- Subject: bsd_tcpip radix Free() changed to R_Free()
Hi,
This patch will change the Free() function name to R_Free() to match the
corresponding R_Malloc(). This also solves a conflict if you want to
write your own Malloc and Free wrappers elsewhere.
I'm just getting my feet wet with submitting patches to eCos, so let me
know if I've missed anything.
Shaun Louie
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/include/net/radix.h ecos.rfree/packages/net/bsd_tcpip/current/include/net/radix.h
--- ecos.cvs/packages/net/bsd_tcpip/current/include/net/radix.h 2002-05-20 16:25:01.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/include/net/radix.h 2007-12-10 11:03:29.000000000 -0600
@@ -160,17 +160,17 @@
#ifndef _KERNEL
#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n))
#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n))
#define Bzero(p, n) bzero((char *)(p), (int)(n));
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n)))
-#define Free(p) free((char *)p);
+#define R_Free(p) free((char *)p);
#else
#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n))
#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n))
#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n));
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT))
-#define Free(p) free((caddr_t)p, M_RTABLE);
+#define R_Free(p) free((caddr_t)p, M_RTABLE);
#endif /* _KERNEL */
void rn_init __P((void));
int rn_inithead __P((void **, int));
int rn_refines __P((void *, void *));
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/src/sys/net/radix.c ecos.rfree/packages/net/bsd_tcpip/current/src/sys/net/radix.c
--- ecos.cvs/packages/net/bsd_tcpip/current/src/sys/net/radix.c 2005-07-30 05:23:30.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/src/sys/net/radix.c 2007-12-10 11:10:13.000000000 -0600
@@ -492,11 +492,11 @@
netmask = cp = (caddr_t)(x + 2);
Bcopy(addmask_key, cp, mlen);
x = rn_insert(cp, mask_rnhead, &maskduplicated, x);
if (maskduplicated) {
log(LOG_ERR, "rn_addmask: mask impossibly already in tree");
- Free(saved_x);
+ R_Free(saved_x);
return (x);
}
/*
* Calculate index of mask, and check for normalcy.
*/
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/src/sys/net/route.c ecos.rfree/packages/net/bsd_tcpip/current/src/sys/net/route.c
--- ecos.cvs/packages/net/bsd_tcpip/current/src/sys/net/route.c 2003-07-24 12:04:25.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/src/sys/net/route.c 2007-12-10 11:11:08.000000000 -0600
@@ -306,16 +306,16 @@
/*
* The key is separatly alloc'd so free it (see rt_setgate()).
* This also frees the gateway, as they are always malloc'd
* together.
*/
- Free(rt_key(rt));
+ R_Free(rt_key(rt));
/*
* and the rtentry itself of course
*/
- Free(rt);
+ R_Free(rt);
}
}
void
ifafree(ifa)
@@ -661,11 +661,11 @@
/*
* Add the gateway. Possibly re-malloc-ing the storage for it
* also add the rt_gwroute if possible.
*/
if ((error = rt_setgate(rt, dst, gateway)) != 0) {
- Free(rt);
+ R_Free(rt);
senderr(error);
}
/*
* point to the (possibly newly malloc'd) dest address.
@@ -725,12 +725,12 @@
if (rt->rt_gwroute)
rtfree(rt->rt_gwroute);
if (rt->rt_ifa) {
IFAFREE(rt->rt_ifa);
}
- Free(rt_key(rt));
- Free(rt);
+ R_Free(rt_key(rt));
+ R_Free(rt);
senderr(EEXIST);
}
rt->rt_parent = 0;
@@ -966,11 +966,11 @@
* if we are replacing the chunk (or it's new) we need to
* replace the dst as well
*/
if (old) {
Bcopy(dst, new, dlen);
- Free(old);
+ R_Free(old);
}
/*
* If there is already a gwroute, it's now almost definitly wrong
* so drop it.
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c ecos.rfree/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c
--- ecos.cvs/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c 2005-07-30 05:23:30.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/src/sys/net/rtsock.c 2007-12-10 11:11:28.000000000 -0600
@@ -406,11 +406,11 @@
struct rt_msghdr *new_rtm;
R_Malloc(new_rtm, struct rt_msghdr *, len);
if (new_rtm == 0)
senderr(ENOBUFS);
Bcopy(rtm, new_rtm, rtm->rtm_msglen);
- Free(rtm); rtm = new_rtm;
+ R_Free(rtm); rtm = new_rtm;
}
(void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm,
(struct walkarg *)0);
rtm->rtm_flags = rt->rt_flags;
rtm->rtm_rmx = rt->rt_rmx;
@@ -490,11 +490,11 @@
* Check to see if we don't want our own messages.
*/
if ((so->so_options & SO_USELOOPBACK) == 0) {
if (route_cb.any_count <= 1) {
if (rtm)
- Free(rtm);
+ R_Free(rtm);
m_freem(m);
return (error);
}
/* There is another listener, so construct message */
rp = sotorawcb(so);
@@ -504,11 +504,11 @@
if (m->m_pkthdr.len < rtm->rtm_msglen) {
m_freem(m);
m = NULL;
} else if (m->m_pkthdr.len > rtm->rtm_msglen)
m_adj(m, rtm->rtm_msglen - m->m_pkthdr.len);
- Free(rtm);
+ R_Free(rtm);
}
if (rp)
rp->rcb_proto.sp_family = 0; /* Avoid us */
if (dst)
route_proto.sp_protocol = dst->sa_family;
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c ecos.rfree/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c
--- ecos.cvs/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c 2005-03-27 12:18:13.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/src/sys/netinet/if_ether.c 2007-12-10 11:11:35.000000000 -0600
@@ -288,11 +288,11 @@
LIST_REMOVE(la, la_le);
rt->rt_llinfo = 0;
rt->rt_flags &= ~RTF_LLINFO;
if (la->la_hold)
m_freem(la->la_hold);
- Free((caddr_t)la);
+ R_Free((caddr_t)la);
}
}
/*
* Broadcast an ARP request. Caller specifies:
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c ecos.rfree/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c
--- ecos.cvs/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c 2002-05-20 16:25:02.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/src/sys/netinet6/icmp6.c 2007-12-10 11:11:42.000000000 -0600
@@ -3518,11 +3518,11 @@
icmp6_mtuexpire(rt, rtt)
struct rtentry *rt;
struct rttimer *rtt;
{
rt->rt_flags |= RTF_PROBEMTU;
- Free(rtt);
+ R_Free(rtt);
}
int *icmp6_sysvars[] = ICMPV6CTL_VARS;
int
diff -r -U 5 -N -x CVS -x '*~' -x '.#~' ecos.cvs/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c ecos.rfree/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c
--- ecos.cvs/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c 2003-07-30 01:42:32.000000000 -0600
+++ ecos.rfree/packages/net/bsd_tcpip/current/src/sys/netinet6/nd6.c 2007-12-10 11:11:49.000000000 -0600
@@ -1525,11 +1525,11 @@
ln->ln_prev = NULL;
rt->rt_llinfo = 0;
rt->rt_flags &= ~RTF_LLINFO;
if (ln->ln_hold)
m_freem(ln->ln_hold);
- Free((caddr_t)ln);
+ R_Free((caddr_t)ln);
}
}
int
nd6_ioctl(cmd, data, ifp)