summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-12-11 19:21:58 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-12-11 19:21:58 +0000
commita910e52291d2cfda61f90e627a5bad213f867725 (patch)
tree931f97a1573be7eab5816a0ebfb81db79383e17c
parentce5ed9abd090b575ddb198f85a99c6df14c7e6ed (diff)
convert bcopy to memcpy/memmove. ok krw
-rw-r--r--sys/kern/uipc_mbuf.c16
-rw-r--r--sys/kern/uipc_mbuf2.c8
-rw-r--r--sys/kern/uipc_socket.c6
-rw-r--r--sys/kern/uipc_socket2.c8
-rw-r--r--sys/kern/uipc_syscalls.c6
-rw-r--r--sys/kern/uipc_usrreq.c12
6 files changed, 28 insertions, 28 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 3c03cdc5167..1552168123e 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.198 2014/11/05 00:28:15 dlg Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.199 2014/12/11 19:21:57 tedu Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -606,7 +606,7 @@ m_copydata(struct mbuf *m, int off, int len, caddr_t cp)
if (m == NULL)
panic("m_copydata: null mbuf");
count = min(m->m_len - off, len);
- bcopy(mtod(m, caddr_t) + off, cp, count);
+ memmove(cp, mtod(m, caddr_t) + off, count);
len -= count;
cp += count;
off = 0;
@@ -659,7 +659,7 @@ m_copyback(struct mbuf *m0, int off, int len, const void *_cp, int wait)
m->m_len += min(len - (m->m_len - off),
M_TRAILINGSPACE(m));
mlen = min(m->m_len - off, len);
- bcopy(cp, mtod(m, caddr_t) + off, (size_t)mlen);
+ memmove(mtod(m, caddr_t) + off, cp, mlen);
cp += mlen;
len -= mlen;
totlen += mlen + off;
@@ -712,8 +712,8 @@ m_cat(struct mbuf *m, struct mbuf *n)
return;
}
/* splat the data from one into the other */
- bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len,
- (u_int)n->m_len);
+ memcpy(mtod(m, caddr_t) + m->m_len, mtod(n, caddr_t),
+ n->m_len);
m->m_len += n->m_len;
n = m_free(n);
}
@@ -841,8 +841,8 @@ m_pullup(struct mbuf *n, int len)
do {
count = min(len, n->m_len);
- bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len,
- (unsigned)count);
+ memcpy(mtod(m, caddr_t) + m->m_len, mtod(n, caddr_t),
+ count);
len -= count;
m->m_len += count;
n->m_len -= count;
@@ -1012,7 +1012,7 @@ extpacket:
MCLADDREFERENCE(m, n);
n->m_data = m->m_data + len;
} else {
- bcopy(mtod(m, caddr_t) + len, mtod(n, caddr_t), remain);
+ memcpy(mtod(n, caddr_t), mtod(m, caddr_t) + len, remain);
}
n->m_len = remain;
m->m_len = len;
diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c
index 257e90877bd..ec63e3e764b 100644
--- a/sys/kern/uipc_mbuf2.c
+++ b/sys/kern/uipc_mbuf2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf2.c,v 1.39 2014/09/14 14:17:26 jsg Exp $ */
+/* $OpenBSD: uipc_mbuf2.c,v 1.40 2014/12/11 19:21:57 tedu Exp $ */
/* $KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */
@@ -167,7 +167,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp)
!sharedcluster && n->m_next->m_len >= tlen) {
n->m_next->m_data -= hlen;
n->m_next->m_len += hlen;
- bcopy(mtod(n, caddr_t) + off, mtod(n->m_next, caddr_t), hlen);
+ memmove(mtod(n->m_next, caddr_t), mtod(n, caddr_t) + off, hlen);
n->m_len -= hlen;
n = n->m_next;
off = 0;
@@ -196,7 +196,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp)
}
/* get hlen from <n, off> into <o, 0> */
o->m_len = hlen;
- bcopy(mtod(n, caddr_t) + off, mtod(o, caddr_t), hlen);
+ memmove(mtod(o, caddr_t), mtod(n, caddr_t) + off, hlen);
n->m_len -= hlen;
/* get tlen from <n->m_next, 0> into <o, hlen> */
m_copydata(n->m_next, 0, tlen, mtod(o, caddr_t) + o->m_len);
@@ -335,7 +335,7 @@ m_tag_copy(struct m_tag *t, int wait)
p = m_tag_get(t->m_tag_id, t->m_tag_len, wait);
if (p == NULL)
return (NULL);
- bcopy(t + 1, p + 1, t->m_tag_len); /* Copy the data */
+ memcpy(p + 1, t + 1, t->m_tag_len); /* Copy the data */
return (p);
}
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index c848d3881a7..17149a97281 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.134 2014/11/03 17:20:46 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.135 2014/12/11 19:21:57 tedu Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1767,8 +1767,8 @@ sogetopt(struct socket *so, int level, int optname, struct mbuf **mp)
if (unp->unp_flags & UNP_FEIDS) {
m->m_len = sizeof(unp->unp_connid);
- bcopy(&(unp->unp_connid),
- mtod(m, caddr_t), m->m_len);
+ memcpy(mtod(m, caddr_t),
+ &(unp->unp_connid), m->m_len);
break;
}
(void)m_free(m);
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index d311f3e7eea..9df9383e848 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.58 2014/09/14 14:17:26 jsg Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.59 2014/12/11 19:21:57 tedu Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -705,7 +705,7 @@ sbappendaddr(struct sockbuf *sb, struct sockaddr *asa, struct mbuf *m0,
if (m == NULL)
return (0);
m->m_len = asa->sa_len;
- bcopy(asa, mtod(m, caddr_t), asa->sa_len);
+ memcpy(mtod(m, caddr_t), asa, asa->sa_len);
if (n)
n->m_next = m0; /* concatenate data to control */
else
@@ -791,7 +791,7 @@ sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
m->m_len <= MCLBYTES / 4 && /* XXX Don't copy too much */
m->m_len <= M_TRAILINGSPACE(n) &&
n->m_type == m->m_type) {
- bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len,
+ memcpy(mtod(n, caddr_t) + n->m_len, mtod(m, caddr_t),
m->m_len);
n->m_len += m->m_len;
sb->sb_cc += m->m_len;
@@ -939,7 +939,7 @@ sbcreatecontrol(caddr_t p, int size, int type, int level)
}
}
cp = mtod(m, struct cmsghdr *);
- bcopy(p, CMSG_DATA(cp), size);
+ memcpy(CMSG_DATA(cp), p, size);
m->m_len = CMSG_SPACE(size);
cp->cmsg_len = CMSG_LEN(size);
cp->cmsg_level = level;
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 4f0e451720b..03824de6000 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.95 2014/12/09 07:05:06 doug Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.96 2014/12/11 19:21:57 tedu Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -565,7 +565,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize)
iovlen = auio.uio_iovcnt * sizeof (struct iovec);
ktriov = malloc(iovlen, M_TEMP, M_WAITOK);
- bcopy(auio.uio_iov, ktriov, iovlen);
+ memcpy(ktriov, auio.uio_iov, iovlen);
}
#endif
len = auio.uio_resid;
@@ -709,7 +709,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
iovlen = auio.uio_iovcnt * sizeof (struct iovec);
ktriov = malloc(iovlen, M_TEMP, M_WAITOK);
- bcopy(auio.uio_iov, ktriov, iovlen);
+ memcpy(ktriov, auio.uio_iov, iovlen);
}
#endif
len = auio.uio_resid;
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 9f9f5145b55..cbec7498ce2 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.78 2014/11/03 03:08:00 deraadt Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.79 2014/12/11 19:21:57 tedu Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -66,11 +66,11 @@ uipc_setaddr(const struct unpcb *unp, struct mbuf *nam)
{
if (unp != NULL && unp->unp_addr != NULL) {
nam->m_len = unp->unp_addr->m_len;
- bcopy(mtod(unp->unp_addr, caddr_t), mtod(nam, caddr_t),
+ memcpy(mtod(nam, caddr_t), mtod(unp->unp_addr, caddr_t),
nam->m_len);
} else {
nam->m_len = sizeof(sun_noname);
- bcopy(&sun_noname, mtod(nam, struct sockaddr *),
+ memcpy(mtod(nam, struct sockaddr *), &sun_noname,
nam->m_len);
}
}
@@ -831,7 +831,7 @@ morespace:
ip = ((int *)CMSG_DATA(cm)) + nfds - 1;
rp = ((struct file **)CMSG_DATA(cm)) + nfds - 1;
for (i = 0; i < nfds; i++) {
- bcopy(ip, &fd, sizeof fd);
+ memcpy(&fd, ip, sizeof fd);
ip--;
if ((fp = fd_getfile(fdp, fd)) == NULL) {
error = EBADF;
@@ -848,7 +848,7 @@ morespace:
error = EINVAL;
goto fail;
}
- bcopy(&fp, rp, sizeof fp);
+ memcpy(rp, &fp, sizeof fp);
rp--;
fp->f_count++;
fp->f_msgcount++;
@@ -859,7 +859,7 @@ fail:
/* Back out what we just did. */
for ( ; i > 0; i--) {
rp++;
- bcopy(rp, &fp, sizeof(fp));
+ memcpy(&fp, rp, sizeof(fp));
fp->f_count--;
fp->f_msgcount--;
unp_rights--;