From: tedu Date: Thu, 9 Jan 2014 21:57:51 +0000 (+0000) Subject: replace Bcopy macro with memmove and memcpy. ok mpi X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=158857bf19dd9c4e5ef8c006000eb44c714344f9;p=openbsd replace Bcopy macro with memmove and memcpy. ok mpi --- diff --git a/sys/net/radix.c b/sys/net/radix.c index 44b45b9febf..15ffac833d5 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix.c,v 1.32 2013/12/12 14:43:38 millert Exp $ */ +/* $OpenBSD: radix.c,v 1.33 2014/01/09 21:57:51 tedu Exp $ */ /* $NetBSD: radix.c,v 1.20 2003/08/07 16:32:56 agc Exp $ */ /* @@ -419,9 +419,9 @@ rn_addmask(void *n_arg, int search, int skip) if (mlen <= skip) return (mask_rnhead->rnh_nodes); if (skip > 1) - Bcopy(rn_ones + 1, addmask_key + 1, skip - 1); + memmove(addmask_key + 1, rn_ones + 1, skip - 1); if ((m0 = mlen) > skip) - Bcopy(netmask + skip, addmask_key + skip, mlen - skip); + memmove(addmask_key + skip, netmask + skip, mlen - skip); /* * Trim trailing zeroes. */ @@ -446,7 +446,7 @@ rn_addmask(void *n_arg, int search, int skip) return (0); Bzero(x, max_keylen + 2 * sizeof (*x)); netmask = cp = (caddr_t)(x + 2); - Bcopy(addmask_key, cp, mlen); + memmove(cp, addmask_key, mlen); x = rn_insert(cp, mask_rnhead, &maskduplicated, x); if (maskduplicated) { log(LOG_ERR, "rn_addmask: mask impossibly already in tree\n"); diff --git a/sys/net/radix.h b/sys/net/radix.h index a8e3621921d..e8f27581714 100644 --- a/sys/net/radix.h +++ b/sys/net/radix.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radix.h,v 1.20 2013/10/24 18:50:16 deraadt Exp $ */ +/* $OpenBSD: radix.h,v 1.21 2014/01/09 21:57:51 tedu Exp $ */ /* $NetBSD: radix.h,v 1.8 1996/02/13 22:00:37 christos Exp $ */ /* @@ -133,7 +133,6 @@ struct radix_node_head { #ifdef _KERNEL #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_NOWAIT)) #define Free(p) free((caddr_t)p, M_RTABLE); diff --git a/sys/net/route.c b/sys/net/route.c index cf90b51d865..8097142d49b 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.147 2013/10/20 13:21:57 claudio Exp $ */ +/* $OpenBSD: route.c,v 1.148 2014/01/09 21:57:52 tedu Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -843,7 +843,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, rt_maskedcopy(info->rti_info[RTAX_DST], ndst, info->rti_info[RTAX_NETMASK]); } else - Bcopy(info->rti_info[RTAX_DST], ndst, + memcpy(ndst, info->rti_info[RTAX_DST], info->rti_info[RTAX_DST]->sa_len); #ifndef SMALL_KERNEL if (rn_mpath_capable(rnh)) { @@ -1014,9 +1014,10 @@ rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate, new = rt->rt_nodes->rn_key; old = NULL; } - Bcopy(gate, (rt->rt_gateway = (struct sockaddr *)(new + dlen)), glen); + rt->rt_gateway = (struct sockaddr *)(new + dlen); + memmove(rt->rt_gateway, gate, glen); if (old) { - Bcopy(dst, new, dlen); + memmove(new, dst, dlen); Free(old); } if (rt->rt_gwroute != NULL) { diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 0796b67a12e..e46f1c3f259 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.131 2013/11/01 20:09:14 bluhm Exp $ */ +/* $OpenBSD: rtsock.c,v 1.132 2014/01/09 21:57:52 tedu Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -767,7 +767,7 @@ report: error = ENOBUFS; goto flush; } - Bcopy(rtm, new_rtm, rtm->rtm_msglen); + memcpy(new_rtm, rtm, rtm->rtm_msglen); Free(rtm); rtm = new_rtm; } rt_msg2(rtm->rtm_type, RTM_VERSION, &info, (caddr_t)rtm, diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index b556c89e0fa..2b8fa15f28b 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.115 2014/01/09 06:29:05 tedu Exp $ */ +/* $OpenBSD: if_ether.c,v 1.116 2014/01/09 21:57:52 tedu Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -253,9 +253,10 @@ arp_rtrequest(int req, struct rtentry *rt) * interface. */ rt->rt_expire = 0; - Bcopy(((struct arpcom *)rt->rt_ifp)->ac_enaddr, - LLADDR(SDL(gate)), - SDL(gate)->sdl_alen = ETHER_ADDR_LEN); + SDL(gate)->sdl_alen = ETHER_ADDR_LEN; + memcpy(LLADDR(SDL(gate)), + ((struct arpcom *)rt->rt_ifp)->ac_enaddr, + ETHER_ADDR_LEN); if (useloopback) rt->rt_ifp = lo0ifp; /* diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 92b0dbcbfeb..87606c4da3c 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.106 2014/01/07 17:07:46 mikeb Exp $ */ +/* $OpenBSD: nd6.c,v 1.107 2014/01/09 21:57:52 tedu Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -1155,7 +1155,7 @@ nd6_rtrequest(int req, struct rtentry *rt) ln->ln_state = ND6_LLINFO_REACHABLE; ln->ln_byhint = 0; if (macp) { - Bcopy(macp, LLADDR(SDL(gate)), ifp->if_addrlen); + memcpy(LLADDR(SDL(gate)), macp, ifp->if_addrlen); SDL(gate)->sdl_alen = ifp->if_addrlen; } if (nd6_useloopback) {