Fallout from caddr_t deletion - remove a load of redundant (void *) casts.

This commit is contained in:
dsl 2007-05-13 20:24:21 +00:00
parent 9ec62257da
commit 2e12e4f4e1

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.109 2007/04/18 10:20:02 yamt Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.110 2007/05/13 20:24:21 dsl Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1990, 1993 * Copyright (c) 1982, 1986, 1989, 1990, 1993
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.109 2007/04/18 10:20:02 yamt Exp $"); __KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.110 2007/05/13 20:24:21 dsl Exp $");
#include "opt_ktrace.h" #include "opt_ktrace.h"
#include "opt_pipe.h" #include "opt_pipe.h"
@ -95,7 +95,7 @@ sys___socket30(struct lwp *l, void *v, register_t *retval)
fdremove(fdp, fd); fdremove(fdp, fd);
ffree(fp); ffree(fp);
} else { } else {
fp->f_data = (void *)so; fp->f_data = so;
FILE_SET_MATURE(fp); FILE_SET_MATURE(fp);
FILE_UNUSE(fp, l); FILE_UNUSE(fp, l);
*retval = fd; *retval = fd;
@ -199,7 +199,7 @@ sys_accept(struct lwp *l, void *v, register_t *retval)
so->so_error = ECONNABORTED; so->so_error = ECONNABORTED;
break; break;
} }
error = tsleep((void *)&so->so_timeo, PSOCK | PCATCH, error = tsleep(&so->so_timeo, PSOCK | PCATCH,
netcon, 0); netcon, 0);
if (error) { if (error) {
splx(s); splx(s);
@ -231,7 +231,7 @@ sys_accept(struct lwp *l, void *v, register_t *retval)
fp->f_type = DTYPE_SOCKET; fp->f_type = DTYPE_SOCKET;
fp->f_flag = fflag; fp->f_flag = fflag;
fp->f_ops = &socketops; fp->f_ops = &socketops;
fp->f_data = (void *)so; fp->f_data = so;
nam = m_get(M_WAIT, MT_SONAME); nam = m_get(M_WAIT, MT_SONAME);
if ((error = soaccept(so, nam)) == 0 && SCARG(uap, name)) { if ((error = soaccept(so, nam)) == 0 && SCARG(uap, name)) {
if (namelen > nam->m_len) if (namelen > nam->m_len)
@ -296,7 +296,7 @@ sys_connect(struct lwp *l, void *v, register_t *retval)
} }
s = splsoftnet(); s = splsoftnet();
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
error = tsleep((void *)&so->so_timeo, PSOCK | PCATCH, error = tsleep(&so->so_timeo, PSOCK | PCATCH,
netcon, 0); netcon, 0);
if (error) { if (error) {
if (error == EINTR || error == ERESTART) if (error == EINTR || error == ERESTART)
@ -350,13 +350,13 @@ sys_socketpair(struct lwp *l, void *v, register_t *retval)
fp1->f_flag = FREAD|FWRITE; fp1->f_flag = FREAD|FWRITE;
fp1->f_type = DTYPE_SOCKET; fp1->f_type = DTYPE_SOCKET;
fp1->f_ops = &socketops; fp1->f_ops = &socketops;
fp1->f_data = (void *)so1; fp1->f_data = so1;
if ((error = falloc(l, &fp2, &fd)) != 0) if ((error = falloc(l, &fp2, &fd)) != 0)
goto free3; goto free3;
fp2->f_flag = FREAD|FWRITE; fp2->f_flag = FREAD|FWRITE;
fp2->f_type = DTYPE_SOCKET; fp2->f_type = DTYPE_SOCKET;
fp2->f_ops = &socketops; fp2->f_ops = &socketops;
fp2->f_data = (void *)so2; fp2->f_data = so2;
sv[1] = fd; sv[1] = fd;
if ((error = soconnect2(so1, so2)) != 0) if ((error = soconnect2(so1, so2)) != 0)
goto free4; goto free4;
@ -367,8 +367,7 @@ sys_socketpair(struct lwp *l, void *v, register_t *retval)
if ((error = soconnect2(so2, so1)) != 0) if ((error = soconnect2(so2, so1)) != 0)
goto free4; goto free4;
} }
error = copyout((void *)sv, (void *)SCARG(uap, rsv), error = copyout(sv, SCARG(uap, rsv), 2 * sizeof(int));
2 * sizeof(int));
FILE_SET_MATURE(fp1); FILE_SET_MATURE(fp1);
FILE_SET_MATURE(fp2); FILE_SET_MATURE(fp2);
FILE_UNUSE(fp1, l); FILE_UNUSE(fp1, l);
@ -426,7 +425,7 @@ sys_sendmsg(struct lwp *l, void *v, register_t *retval)
struct iovec aiov[UIO_SMALLIOV], *iov; struct iovec aiov[UIO_SMALLIOV], *iov;
int error; int error;
error = copyin(SCARG(uap, msg), (void *)&msg, sizeof(msg)); error = copyin(SCARG(uap, msg), &msg, sizeof(msg));
if (error) if (error)
return (error); return (error);
if ((unsigned int)msg.msg_iovlen > UIO_SMALLIOV) { if ((unsigned int)msg.msg_iovlen > UIO_SMALLIOV) {
@ -437,7 +436,7 @@ sys_sendmsg(struct lwp *l, void *v, register_t *retval)
} else } else
iov = aiov; iov = aiov;
if ((unsigned int)msg.msg_iovlen > 0) { if ((unsigned int)msg.msg_iovlen > 0) {
error = copyin((void *)msg.msg_iov, (void *)iov, error = copyin(msg.msg_iov, iov,
(size_t)(msg.msg_iovlen * sizeof(struct iovec))); (size_t)(msg.msg_iovlen * sizeof(struct iovec)));
if (error) if (error)
goto done; goto done;
@ -525,7 +524,7 @@ sendit(struct lwp *l, int s, struct msghdr *mp, int flags, register_t *retsize)
int iovlen = auio.uio_iovcnt * sizeof(struct iovec); int iovlen = auio.uio_iovcnt * sizeof(struct iovec);
ktriov = malloc(iovlen, M_TEMP, M_WAITOK); ktriov = malloc(iovlen, M_TEMP, M_WAITOK);
memcpy((void *)ktriov, (void *)auio.uio_iov, iovlen); memcpy(ktriov, auio.uio_iov, iovlen);
} }
#endif #endif
len = auio.uio_resid; len = auio.uio_resid;
@ -573,22 +572,20 @@ sys_recvfrom(struct lwp *l, void *v, register_t *retval)
int error; int error;
if (SCARG(uap, fromlenaddr)) { if (SCARG(uap, fromlenaddr)) {
error = copyin((void *)SCARG(uap, fromlenaddr), error = copyin(SCARG(uap, fromlenaddr), &msg.msg_namelen,
(void *)&msg.msg_namelen,
sizeof(msg.msg_namelen)); sizeof(msg.msg_namelen));
if (error) if (error)
return (error); return (error);
} else } else
msg.msg_namelen = 0; msg.msg_namelen = 0;
msg.msg_name = (void *)SCARG(uap, from); msg.msg_name = SCARG(uap, from);
msg.msg_iov = &aiov; msg.msg_iov = &aiov;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
aiov.iov_base = SCARG(uap, buf); aiov.iov_base = SCARG(uap, buf);
aiov.iov_len = SCARG(uap, len); aiov.iov_len = SCARG(uap, len);
msg.msg_control = 0; msg.msg_control = 0;
msg.msg_flags = SCARG(uap, flags); msg.msg_flags = SCARG(uap, flags);
return (recvit(l, SCARG(uap, s), &msg, return recvit(l, SCARG(uap, s), &msg, SCARG(uap, fromlenaddr), retval);
(void *)SCARG(uap, fromlenaddr), retval));
} }
int int
@ -603,8 +600,7 @@ sys_recvmsg(struct lwp *l, void *v, register_t *retval)
struct msghdr msg; struct msghdr msg;
int error; int error;
error = copyin((void *)SCARG(uap, msg), (void *)&msg, error = copyin(SCARG(uap, msg), &msg, sizeof(msg));
sizeof(msg));
if (error) if (error)
return (error); return (error);
if ((unsigned int)msg.msg_iovlen > UIO_SMALLIOV) { if ((unsigned int)msg.msg_iovlen > UIO_SMALLIOV) {
@ -615,7 +611,7 @@ sys_recvmsg(struct lwp *l, void *v, register_t *retval)
} else } else
iov = aiov; iov = aiov;
if ((unsigned int)msg.msg_iovlen > 0) { if ((unsigned int)msg.msg_iovlen > 0) {
error = copyin((void *)msg.msg_iov, (void *)iov, error = copyin(msg.msg_iov, iov,
(size_t)(msg.msg_iovlen * sizeof(struct iovec))); (size_t)(msg.msg_iovlen * sizeof(struct iovec)));
if (error) if (error)
goto done; goto done;
@ -623,10 +619,9 @@ sys_recvmsg(struct lwp *l, void *v, register_t *retval)
uiov = msg.msg_iov; uiov = msg.msg_iov;
msg.msg_iov = iov; msg.msg_iov = iov;
msg.msg_flags = SCARG(uap, flags); msg.msg_flags = SCARG(uap, flags);
if ((error = recvit(l, SCARG(uap, s), &msg, (void *)0, retval)) == 0) { if ((error = recvit(l, SCARG(uap, s), &msg, NULL, retval)) == 0) {
msg.msg_iov = uiov; msg.msg_iov = uiov;
error = copyout((void *)&msg, (void *)SCARG(uap, msg), error = copyout(&msg, SCARG(uap, msg), sizeof(msg));
sizeof(msg));
} }
done: done:
if (iov != aiov) if (iov != aiov)
@ -715,7 +710,7 @@ recvit(struct lwp *l, int s, struct msghdr *mp, void *namelenp,
int iovlen = auio.uio_iovcnt * sizeof(struct iovec); int iovlen = auio.uio_iovcnt * sizeof(struct iovec);
ktriov = malloc(iovlen, M_TEMP, M_WAITOK); ktriov = malloc(iovlen, M_TEMP, M_WAITOK);
memcpy((void *)ktriov, (void *)auio.uio_iov, iovlen); memcpy(ktriov, auio.uio_iov, iovlen);
} }
#endif #endif
len = auio.uio_resid; len = auio.uio_resid;
@ -746,13 +741,13 @@ recvit(struct lwp *l, int s, struct msghdr *mp, void *namelenp,
len = from->m_len; len = from->m_len;
/* else if len < from->m_len ??? */ /* else if len < from->m_len ??? */
error = copyout(mtod(from, void *), error = copyout(mtod(from, void *),
(void *)mp->msg_name, (unsigned)len); mp->msg_name, (unsigned)len);
if (error) if (error)
goto out; goto out;
} }
mp->msg_namelen = len; mp->msg_namelen = len;
if (namelenp && if (namelenp &&
(error = copyout((void *)&len, namelenp, sizeof(int)))) (error = copyout(&len, namelenp, sizeof(int))))
goto out; goto out;
} }
if (mp->msg_control) { if (mp->msg_control) {
@ -891,8 +886,8 @@ sys_getsockopt(struct lwp *l, void *v, register_t *retval)
if ((error = getsock(l->l_proc->p_fd, SCARG(uap, s), &fp)) != 0) if ((error = getsock(l->l_proc->p_fd, SCARG(uap, s), &fp)) != 0)
return (error); return (error);
if (SCARG(uap, val)) { if (SCARG(uap, val)) {
error = copyin((void *)SCARG(uap, avalsize), error = copyin(SCARG(uap, avalsize),
(void *)&valsize, sizeof(valsize)); &valsize, sizeof(valsize));
if (error) if (error)
goto out; goto out;
} else } else
@ -945,13 +940,13 @@ sys_pipe(struct lwp *l, void *v, register_t *retval)
rf->f_flag = FREAD; rf->f_flag = FREAD;
rf->f_type = DTYPE_SOCKET; rf->f_type = DTYPE_SOCKET;
rf->f_ops = &socketops; rf->f_ops = &socketops;
rf->f_data = (void *)rso; rf->f_data = rso;
if ((error = falloc(l, &wf, &fd)) != 0) if ((error = falloc(l, &wf, &fd)) != 0)
goto free3; goto free3;
wf->f_flag = FWRITE; wf->f_flag = FWRITE;
wf->f_type = DTYPE_SOCKET; wf->f_type = DTYPE_SOCKET;
wf->f_ops = &socketops; wf->f_ops = &socketops;
wf->f_data = (void *)wso; wf->f_data = wso;
retval[1] = fd; retval[1] = fd;
if ((error = unp_connect2(wso, rso, PRU_CONNECT2)) != 0) if ((error = unp_connect2(wso, rso, PRU_CONNECT2)) != 0)
goto free4; goto free4;
@ -999,7 +994,7 @@ sys_getsockname(struct lwp *l, void *v, register_t *retval)
/* getsock() will use the descriptor for us */ /* getsock() will use the descriptor for us */
if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0) if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
return (error); return (error);
error = copyin((void *)SCARG(uap, alen), (void *)&len, sizeof(len)); error = copyin(SCARG(uap, alen), &len, sizeof(len));
if (error) if (error)
goto out; goto out;
so = (struct socket *)fp->f_data; so = (struct socket *)fp->f_data;
@ -1011,10 +1006,9 @@ sys_getsockname(struct lwp *l, void *v, register_t *retval)
goto bad; goto bad;
if (len > m->m_len) if (len > m->m_len)
len = m->m_len; len = m->m_len;
error = copyout(mtod(m, void *), (void *)SCARG(uap, asa), len); error = copyout(mtod(m, void *), SCARG(uap, asa), len);
if (error == 0) if (error == 0)
error = copyout((void *)&len, (void *)SCARG(uap, alen), error = copyout(&len, SCARG(uap, alen), sizeof(len));
sizeof(len));
bad: bad:
m_freem(m); m_freem(m);
out: out:
@ -1050,7 +1044,7 @@ sys_getpeername(struct lwp *l, void *v, register_t *retval)
error = ENOTCONN; error = ENOTCONN;
goto out; goto out;
} }
error = copyin((void *)SCARG(uap, alen), (void *)&len, sizeof(len)); error = copyin(SCARG(uap, alen), &len, sizeof(len));
if (error) if (error)
goto out; goto out;
m = m_getclr(M_WAIT, MT_SONAME); m = m_getclr(M_WAIT, MT_SONAME);
@ -1061,10 +1055,10 @@ sys_getpeername(struct lwp *l, void *v, register_t *retval)
goto bad; goto bad;
if (len > m->m_len) if (len > m->m_len)
len = m->m_len; len = m->m_len;
error = copyout(mtod(m, void *), (void *)SCARG(uap, asa), len); error = copyout(mtod(m, void *), SCARG(uap, asa), len);
if (error) if (error)
goto bad; goto bad;
error = copyout((void *)&len, (void *)SCARG(uap, alen), sizeof(len)); error = copyout(&len, SCARG(uap, alen), sizeof(len));
bad: bad:
m_freem(m); m_freem(m);
out: out: