summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-04-05 08:25:31 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-04-05 08:25:31 +0000
commit84c7c115879a734ff013eca4de8f5ac17c120b9c (patch)
treea33190fe7e93b01d3350eb0e69c12bd87708f964
parent01e270952b7426a92767b0d570dc4018a984162a (diff)
remove some obsolete casts
-rw-r--r--sys/kern/sys_socket.c13
-rw-r--r--sys/kern/uipc_socket.c25
-rw-r--r--sys/kern/uipc_socket2.c14
-rw-r--r--sys/kern/uipc_syscalls.c29
-rw-r--r--sys/kern/uipc_usrreq.c8
5 files changed, 41 insertions, 48 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 5d28d6da66d..9958e1f50cd 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_socket.c,v 1.15 2013/01/15 11:12:57 bluhm Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.16 2013/04/05 08:25:30 tedu Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
@@ -131,7 +131,7 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p)
int
soo_poll(struct file *fp, int events, struct proc *p)
{
- struct socket *so = (struct socket *)fp->f_data;
+ struct socket *so = fp->f_data;
int revents = 0;
int s = splsoftnet();
@@ -164,9 +164,9 @@ soo_poll(struct file *fp, int events, struct proc *p)
int
soo_stat(struct file *fp, struct stat *ub, struct proc *p)
{
- struct socket *so = (struct socket *)fp->f_data;
+ struct socket *so = fp->f_data;
- bzero((caddr_t)ub, sizeof (*ub));
+ bzero(ub, sizeof (*ub));
ub->st_mode = S_IFSOCK;
if ((so->so_state & SS_CANTRCVMORE) == 0 ||
so->so_rcv.sb_cc != 0)
@@ -176,8 +176,7 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p)
ub->st_uid = so->so_euid;
ub->st_gid = so->so_egid;
(void) ((*so->so_proto->pr_usrreq)(so, PRU_SENSE,
- (struct mbuf *)ub, (struct mbuf *)0,
- (struct mbuf *)0, p));
+ (struct mbuf *)ub, NULL, NULL, p));
return (0);
}
@@ -188,7 +187,7 @@ soo_close(struct file *fp, struct proc *p)
int error = 0;
if (fp->f_data)
- error = soclose((struct socket *)fp->f_data);
+ error = soclose(fp->f_data);
fp->f_data = 0;
return (error);
}
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 08641d4e2f7..04af49c0186 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.117 2013/04/04 18:13:43 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.118 2013/04/05 08:25:30 tedu Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -851,9 +851,7 @@ dontblock:
SBLASTMBUFCHK(&so->so_rcv, "soreceive uiomove");
resid = uio->uio_resid;
splx(s);
- uio_error =
- uiomove(mtod(m, caddr_t) + moff, (int)len,
- uio);
+ uio_error = uiomove(mtod(m, caddr_t) + moff, len, uio);
s = splsoftnet();
if (uio_error)
uio->uio_resid = resid - len;
@@ -1329,7 +1327,7 @@ somove(struct socket *so, int wait)
/* Send window update to source peer as receive buffer has changed. */
if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb)
(so->so_proto->pr_usrreq)(so, PRU_RCVD, NULL,
- (struct mbuf *)0L, NULL, NULL);
+ NULL, NULL, NULL);
/* Receive buffer did shrink by len bytes, adjust oob. */
state = so->so_state;
@@ -1741,9 +1739,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((caddr_t)(&(unp->unp_connid)),
- mtod(m, caddr_t),
- m->m_len);
+ bcopy(&(unp->unp_connid),
+ mtod(m, caddr_t), m->m_len);
break;
}
(void)m_free(m);
@@ -1772,7 +1769,7 @@ sohasoutofband(struct socket *so)
int
soo_kqfilter(struct file *fp, struct knote *kn)
{
- struct socket *so = (struct socket *)kn->kn_fp->f_data;
+ struct socket *so = kn->kn_fp->f_data;
struct sockbuf *sb;
int s;
@@ -1802,7 +1799,7 @@ soo_kqfilter(struct file *fp, struct knote *kn)
void
filt_sordetach(struct knote *kn)
{
- struct socket *so = (struct socket *)kn->kn_fp->f_data;
+ struct socket *so = kn->kn_fp->f_data;
int s = splnet();
SLIST_REMOVE(&so->so_rcv.sb_sel.si_note, kn, knote, kn_selnext);
@@ -1815,7 +1812,7 @@ filt_sordetach(struct knote *kn)
int
filt_soread(struct knote *kn, long hint)
{
- struct socket *so = (struct socket *)kn->kn_fp->f_data;
+ struct socket *so = kn->kn_fp->f_data;
kn->kn_data = so->so_rcv.sb_cc;
#ifdef SOCKET_SPLICE
@@ -1837,7 +1834,7 @@ filt_soread(struct knote *kn, long hint)
void
filt_sowdetach(struct knote *kn)
{
- struct socket *so = (struct socket *)kn->kn_fp->f_data;
+ struct socket *so = kn->kn_fp->f_data;
int s = splnet();
SLIST_REMOVE(&so->so_snd.sb_sel.si_note, kn, knote, kn_selnext);
@@ -1850,7 +1847,7 @@ filt_sowdetach(struct knote *kn)
int
filt_sowrite(struct knote *kn, long hint)
{
- struct socket *so = (struct socket *)kn->kn_fp->f_data;
+ struct socket *so = kn->kn_fp->f_data;
kn->kn_data = sbspace(&so->so_snd);
if (so->so_state & SS_CANTSENDMORE) {
@@ -1872,7 +1869,7 @@ filt_sowrite(struct knote *kn, long hint)
int
filt_solisten(struct knote *kn, long hint)
{
- struct socket *so = (struct socket *)kn->kn_fp->f_data;
+ struct socket *so = kn->kn_fp->f_data;
kn->kn_data = so->so_qlen;
return (so->so_qlen != 0);
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index efb81f4f23a..636e4a1efe3 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.55 2013/01/15 11:12:57 bluhm Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.56 2013/04/05 08:25:30 tedu Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -152,12 +152,12 @@ sonewconn(struct socket *head, int connstatus)
splsoftassert(IPL_SOFTNET);
if (mclpools[0].pr_nout > mclpools[0].pr_hardlimit * 95 / 100)
- return ((struct socket *)0);
+ return (NULL);
if (head->so_qlen + head->so_q0len > head->so_qlimit * 3)
- return ((struct socket *)0);
+ return (NULL);
so = pool_get(&socket_pool, PR_NOWAIT|PR_ZERO);
if (so == NULL)
- return ((struct socket *)0);
+ return (NULL);
so->so_type = head->so_type;
so->so_options = head->so_options &~ SO_ACCEPTCONN;
so->so_linger = head->so_linger;
@@ -178,7 +178,7 @@ sonewconn(struct socket *head, int connstatus)
*/
if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat)) {
pool_put(&socket_pool, so);
- return ((struct socket *)0);
+ return (NULL);
}
so->so_snd.sb_wat = head->so_snd.sb_wat;
so->so_snd.sb_lowat = head->so_snd.sb_lowat;
@@ -192,7 +192,7 @@ sonewconn(struct socket *head, int connstatus)
curproc)) {
(void) soqremque(so, soqueue);
pool_put(&socket_pool, so);
- return ((struct socket *)0);
+ return (NULL);
}
if (connstatus) {
sorwakeup(head);
@@ -931,7 +931,7 @@ sbcreatecontrol(caddr_t p, int size, int type, int level)
}
if ((m = m_get(M_DONTWAIT, MT_CONTROL)) == NULL)
- return ((struct mbuf *) NULL);
+ return (NULL);
if (CMSG_SPACE(size) > MLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 1eb096cebd2..3d54ed0a1c1 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.87 2012/10/17 05:07:55 guenther Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.88 2013/04/05 08:25:30 tedu Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -118,7 +118,7 @@ sys_bind(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error);
error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen),
- MT_SONAME);
+ MT_SONAME);
if (error == 0) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_STRUCT))
@@ -290,7 +290,7 @@ sys_connect(struct proc *p, void *v, register_t *retval)
return (EALREADY);
}
error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen),
- MT_SONAME);
+ MT_SONAME);
if (error)
goto bad;
#ifdef KTRACE
@@ -307,8 +307,7 @@ sys_connect(struct proc *p, void *v, register_t *retval)
}
s = splsoftnet();
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
- error = tsleep(&so->so_timeo, PSOCK | PCATCH,
- "netcon2", 0);
+ error = tsleep(&so->so_timeo, PSOCK | PCATCH, "netcon2", 0);
if (error)
break;
}
@@ -342,11 +341,11 @@ sys_socketpair(struct proc *p, void *v, register_t *retval)
int fd, error, sv[2];
error = socreate(SCARG(uap, domain), &so1, SCARG(uap, type),
- SCARG(uap, protocol));
+ SCARG(uap, protocol));
if (error)
return (error);
error = socreate(SCARG(uap, domain), &so2, SCARG(uap, type),
- SCARG(uap, protocol));
+ SCARG(uap, protocol));
if (error)
goto free1;
@@ -495,7 +494,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize)
}
if (mp->msg_name) {
error = sockargs(&to, mp->msg_name, mp->msg_namelen,
- MT_SONAME);
+ MT_SONAME);
if (error)
goto bad;
#ifdef KTRACE
@@ -509,7 +508,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize)
goto bad;
}
error = sockargs(&control, mp->msg_control,
- mp->msg_controllen, MT_CONTROL);
+ mp->msg_controllen, MT_CONTROL);
if (error)
goto bad;
} else
@@ -608,7 +607,7 @@ sys_recvmsg(struct proc *p, void *v, register_t *retval)
msg.msg_flags = SCARG(uap, flags);
if (msg.msg_iovlen > 0) {
error = copyin(msg.msg_iov, iov,
- (unsigned)(msg.msg_iovlen * sizeof (struct iovec)));
+ msg.msg_iovlen * sizeof(struct iovec));
if (error)
goto done;
}
@@ -678,8 +677,8 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0)
- ktrgenio(p, s, UIO_READ,
- ktriov, len - auio.uio_resid, error);
+ ktrgenio(p, s, UIO_READ, ktriov,
+ len - auio.uio_resid, error);
free(ktriov, M_TEMP);
}
#endif
@@ -722,8 +721,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
mp->msg_flags |= MSG_CTRUNC;
i = len;
}
- error = copyout(mtod(m, caddr_t), p,
- (unsigned)i);
+ error = copyout(mtod(m, caddr_t), p, i);
if (m->m_next)
i = ALIGN(i);
p += i;
@@ -807,8 +805,7 @@ sys_setsockopt(struct proc *p, void *v, register_t *retval)
}
m->m_len = SCARG(uap, valsize);
}
- error = sosetopt(fp->f_data, SCARG(uap, level),
- SCARG(uap, name), m);
+ error = sosetopt(fp->f_data, SCARG(uap, level), SCARG(uap, name), m);
m = NULL;
bad:
if (m)
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 47a2f7da091..d0c809c18a9 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.70 2013/03/30 06:32:25 tedu Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.71 2013/04/05 08:25:30 tedu Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -893,7 +893,7 @@ unp_gc(void)
fp->f_iflags |= FIF_MARK;
if (fp->f_type != DTYPE_SOCKET ||
- (so = (struct socket *)fp->f_data) == NULL)
+ (so = fp->f_data) == NULL)
continue;
if (so->so_proto->pr_domain != &unixdomain ||
(so->so_proto->pr_flags&PR_RIGHTS) == 0)
@@ -972,10 +972,10 @@ unp_gc(void)
}
for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp)
if ((*fpp)->f_type == DTYPE_SOCKET && (*fpp)->f_data != NULL)
- sorflush((struct socket *)(*fpp)->f_data);
+ sorflush((*fpp)->f_data);
for (i = nunref, fpp = extra_ref; --i >= 0; ++fpp)
(void) closef(*fpp, NULL);
- free((caddr_t)extra_ref, M_FILE);
+ free(extra_ref, M_FILE);
unp_gcing = 0;
}