diff options
author | 2016-01-06 17:59:30 +0000 | |
---|---|---|
committer | 2016-01-06 17:59:30 +0000 | |
commit | 6171e12047d202b38aae834ead672a6ada0ded39 (patch) | |
tree | a71bc5661ca21d8bd97958d521ef596455ff3e4a | |
parent | tidy up whitespace, etc. (diff) | |
download | wireguard-openbsd-6171e12047d202b38aae834ead672a6ada0ded39.tar.xz wireguard-openbsd-6171e12047d202b38aae834ead672a6ada0ded39.zip |
remove unnecessary casts where the incoming type is void *.
-rw-r--r-- | sys/kern/kern_descrip.c | 16 | ||||
-rw-r--r-- | sys/kern/kern_pledge.c | 8 | ||||
-rw-r--r-- | sys/kern/sys_pipe.c | 23 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 26 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 14 |
5 files changed, 43 insertions, 44 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index caaf491900d..33153e97f33 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.127 2015/12/17 16:59:26 tedu Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.128 2016/01/06 17:59:30 tedu Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -401,7 +401,7 @@ restart: break; case F_ISATTY: - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (fp->f_type == DTYPE_VNODE && (vp->v_flag & VISTTY)) *retval = 1; else { @@ -442,7 +442,7 @@ restart: case F_SETOWN: if (fp->f_type == DTYPE_SOCKET) { - struct socket *so = (struct socket *)fp->f_data; + struct socket *so = fp->f_data; so->so_pgid = (long)SCARG(uap, arg); so->so_siguid = p->p_ucred->cr_ruid; @@ -450,7 +450,7 @@ restart: break; } if (fp->f_type == DTYPE_PIPE) { - struct pipe *mpipe = (struct pipe *)fp->f_data; + struct pipe *mpipe = fp->f_data; mpipe->pipe_pgid = (long)SCARG(uap, arg); break; @@ -482,7 +482,7 @@ restart: error = EBADF; break; } - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; /* Copy in the lock structure */ error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&fl, sizeof (fl)); @@ -549,7 +549,7 @@ restart: error = EBADF; break; } - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; /* Copy in the lock structure */ error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&fl, sizeof (fl)); @@ -749,7 +749,7 @@ sys_fpathconf(struct proc *p, void *v, register_t *retval) break; case DTYPE_VNODE: - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_PATHCONF(vp, SCARG(uap, name), retval); VOP_UNLOCK(vp, 0, p); @@ -1194,7 +1194,7 @@ sys_flock(struct proc *p, void *v, register_t *retval) if (fp->f_type != DTYPE_VNODE) return (EOPNOTSUPP); FREF(fp); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; diff --git a/sys/kern/kern_pledge.c b/sys/kern/kern_pledge.c index 89808cd1178..8467f00d28f 100644 --- a/sys/kern/kern_pledge.c +++ b/sys/kern/kern_pledge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_pledge.c,v 1.142 2016/01/06 09:09:16 kettenis Exp $ */ +/* $OpenBSD: kern_pledge.c,v 1.143 2016/01/06 17:59:30 tedu Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -871,7 +871,7 @@ pledge_recvfd(struct proc *p, struct file *fp) case DTYPE_PIPE: return (0); case DTYPE_VNODE: - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (vp->v_type != VDIR) return (0); @@ -903,7 +903,7 @@ pledge_sendfd(struct proc *p, struct file *fp) case DTYPE_PIPE: return (0); case DTYPE_VNODE: - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (vp->v_type != VDIR) return (0); @@ -1147,7 +1147,7 @@ pledge_ioctl(struct proc *p, long com, struct file *fp) /* fp != NULL was already checked */ if (fp->f_type == DTYPE_VNODE) - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; /* * Further sets of ioctl become available, but are checked a diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 5af5c6cfcf6..22babb98e39 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.70 2015/12/05 10:11:53 tedu Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.71 2016/01/06 17:59:30 tedu Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -295,7 +295,7 @@ pipeselwakeup(struct pipe *cpipe) int pipe_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { - struct pipe *rpipe = (struct pipe *) fp->f_data; + struct pipe *rpipe = fp->f_data; int error; int nread = 0; int size; @@ -414,10 +414,9 @@ pipe_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { int error = 0; int orig_resid; - struct pipe *wpipe, *rpipe; - rpipe = (struct pipe *) fp->f_data; + rpipe = fp->f_data; wpipe = rpipe->pipe_peer; /* @@ -635,7 +634,7 @@ retrywrite: int pipe_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) { - struct pipe *mpipe = (struct pipe *)fp->f_data; + struct pipe *mpipe = fp->f_data; switch (cmd) { @@ -669,7 +668,7 @@ pipe_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) int pipe_poll(struct file *fp, int events, struct proc *p) { - struct pipe *rpipe = (struct pipe *)fp->f_data; + struct pipe *rpipe = fp->f_data; struct pipe *wpipe; int revents = 0; @@ -706,7 +705,7 @@ pipe_poll(struct file *fp, int events, struct proc *p) int pipe_stat(struct file *fp, struct stat *ub, struct proc *p) { - struct pipe *pipe = (struct pipe *)fp->f_data; + struct pipe *pipe = fp->f_data; memset(ub, 0, sizeof(*ub)); ub->st_mode = S_IFIFO; @@ -731,7 +730,7 @@ pipe_stat(struct file *fp, struct stat *ub, struct proc *p) int pipe_close(struct file *fp, struct proc *p) { - struct pipe *cpipe = (struct pipe *)fp->f_data; + struct pipe *cpipe = fp->f_data; fp->f_ops = NULL; fp->f_data = NULL; @@ -796,7 +795,7 @@ pipeclose(struct pipe *cpipe) int pipe_kqfilter(struct file *fp, struct knote *kn) { - struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data; + struct pipe *rpipe = kn->kn_fp->f_data; struct pipe *wpipe = rpipe->pipe_peer; switch (kn->kn_filter) { @@ -822,7 +821,7 @@ pipe_kqfilter(struct file *fp, struct knote *kn) void filt_pipedetach(struct knote *kn) { - struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data; + struct pipe *rpipe = kn->kn_fp->f_data; struct pipe *wpipe = rpipe->pipe_peer; switch (kn->kn_filter) { @@ -840,7 +839,7 @@ filt_pipedetach(struct knote *kn) int filt_piperead(struct knote *kn, long hint) { - struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data; + struct pipe *rpipe = kn->kn_fp->f_data; struct pipe *wpipe = rpipe->pipe_peer; kn->kn_data = rpipe->pipe_buffer.cnt; @@ -856,7 +855,7 @@ filt_piperead(struct knote *kn, long hint) int filt_pipewrite(struct knote *kn, long hint) { - struct pipe *rpipe = (struct pipe *)kn->kn_fp->f_data; + struct pipe *rpipe = kn->kn_fp->f_data; struct pipe *wpipe = rpipe->pipe_peer; if ((wpipe == NULL) || (wpipe->pipe_state & PIPE_EOF)) { diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 9702186c573..094097c99fb 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.250 2016/01/02 00:24:16 deraadt Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.251 2016/01/06 17:59:30 tedu Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -684,7 +684,7 @@ sys_fchdir(struct proc *p, void *v, register_t *retval) if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL) return (EBADF); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (fp->f_type != DTYPE_VNODE || vp->v_type != VDIR) return (ENOTDIR); vref(vp); @@ -1550,7 +1550,7 @@ sys_lseek(struct proc *p, void *v, register_t *retval) return (EBADF); if (fp->f_type != DTYPE_VNODE) return (ESPIPE); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (vp->v_type == VFIFO) return (ESPIPE); FREF(fp); @@ -2031,7 +2031,7 @@ sys_fchmod(struct proc *p, void *v, register_t *retval) if ((error = getvnode(p, SCARG(uap, fd), &fp)) != 0) return (error); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (vp->v_mount && vp->v_mount->mnt_flag & MNT_RDONLY) error = EROFS; @@ -2194,7 +2194,7 @@ sys_fchown(struct proc *p, void *v, register_t *retval) if ((error = getvnode(p, SCARG(uap, fd), &fp)) != 0) return (error); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (vp->v_mount->mnt_flag & MNT_RDONLY) error = EROFS; @@ -2410,7 +2410,7 @@ dofutimens(struct proc *p, int fd, struct timespec ts[2]) if ((error = getvnode(p, fd, &fp)) != 0) return (error); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; vref(vp); FRELE(fp, p); @@ -2475,7 +2475,7 @@ sys_ftruncate(struct proc *p, void *v, register_t *retval) error = EINVAL; goto bad; } - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (vp->v_type == VDIR) error = EISDIR; @@ -2505,7 +2505,7 @@ sys_fsync(struct proc *p, void *v, register_t *retval) if ((error = getvnode(p, SCARG(uap, fd), &fp)) != 0) return (error); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p); #ifdef FFS_SOFTUPDATES @@ -2827,7 +2827,7 @@ getvnode(struct proc *p, int fd, struct file **fpp) if (fp->f_type != DTYPE_VNODE) return (EINVAL); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (vp->v_type == VBAD) return (EBADF); @@ -2860,7 +2860,7 @@ sys_pread(struct proc *p, void *v, register_t *retval) if ((fp = fd_getfile_mode(fdp, fd, FREAD)) == NULL) return (EBADF); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO || (vp->v_flag & VISTTY)) { return (ESPIPE); @@ -2901,7 +2901,7 @@ sys_preadv(struct proc *p, void *v, register_t *retval) if ((fp = fd_getfile_mode(fdp, fd, FREAD)) == NULL) return (EBADF); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO || (vp->v_flag & VISTTY)) { return (ESPIPE); @@ -2941,7 +2941,7 @@ sys_pwrite(struct proc *p, void *v, register_t *retval) if ((fp = fd_getfile_mode(fdp, fd, FWRITE)) == NULL) return (EBADF); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO || (vp->v_flag & VISTTY)) { return (ESPIPE); @@ -2982,7 +2982,7 @@ sys_pwritev(struct proc *p, void *v, register_t *retval) if ((fp = fd_getfile_mode(fdp, fd, FWRITE)) == NULL) return (EBADF); - vp = (struct vnode *)fp->f_data; + vp = fp->f_data; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO || (vp->v_flag & VISTTY)) { return (ESPIPE); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f9e21004445..16655c6c72a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.82 2015/05/01 01:30:58 millert Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.83 2016/01/06 17:59:30 tedu Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -327,7 +327,7 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base, int len, off_t offset, int vn_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_data; int error = 0; size_t count = uio->uio_resid; struct proc *p = uio->uio_procp; @@ -352,7 +352,7 @@ vn_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) int vn_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_data; struct proc *p = uio->uio_procp; int error, ioflag = IO_UNIT; size_t count; @@ -384,7 +384,7 @@ vn_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) int vn_statfile(struct file *fp, struct stat *sb, struct proc *p) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_data; return vn_stat(vp, sb, p); } @@ -458,7 +458,7 @@ vn_stat(struct vnode *vp, struct stat *sb, struct proc *p) int vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) { - struct vnode *vp = ((struct vnode *)fp->f_data); + struct vnode *vp = fp->f_data; struct vattr vattr; int error; @@ -501,7 +501,7 @@ vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) int vn_poll(struct file *fp, int events, struct proc *p) { - return (VOP_POLL(((struct vnode *)fp->f_data), fp->f_flag, events, p)); + return (VOP_POLL(fp->f_data, fp->f_flag, events, p)); } /* @@ -553,7 +553,7 @@ vn_closefile(struct file *fp, struct proc *p) int vn_kqfilter(struct file *fp, struct knote *kn) { - return (VOP_KQFILTER(((struct vnode *)fp->f_data), kn)); + return (VOP_KQFILTER(fp->f_data, kn)); } /* |