Module Name: src Committed By: matt Date: Fri Sep 5 09:20:59 UTC 2014
Modified Files: src/sys/kern: exec_script.c kern_descrip.c kern_event.c kern_ktrace_vfs.c subr_exec_fd.c sys_aio.c sys_descrip.c sys_generic.c sys_mqueue.c sys_pipe.c sys_socket.c tty_ptm.c uipc_domain.c uipc_sem.c uipc_socket.c uipc_syscalls.c uipc_usrreq.c vfs_syscalls.c vfs_vnops.c vfs_xattr.c Log Message: Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get a correctly typed pointer. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/kern/exec_script.c cvs rdiff -u -r1.226 -r1.227 src/sys/kern/kern_descrip.c cvs rdiff -u -r1.81 -r1.82 src/sys/kern/kern_event.c cvs rdiff -u -r1.1 -r1.2 src/sys/kern/kern_ktrace_vfs.c cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_exec_fd.c cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sys_aio.c cvs rdiff -u -r1.29 -r1.30 src/sys/kern/sys_descrip.c cvs rdiff -u -r1.129 -r1.130 src/sys/kern/sys_generic.c cvs rdiff -u -r1.36 -r1.37 src/sys/kern/sys_mqueue.c cvs rdiff -u -r1.139 -r1.140 src/sys/kern/sys_pipe.c cvs rdiff -u -r1.72 -r1.73 src/sys/kern/sys_socket.c cvs rdiff -u -r1.33 -r1.34 src/sys/kern/tty_ptm.c cvs rdiff -u -r1.94 -r1.95 src/sys/kern/uipc_domain.c cvs rdiff -u -r1.41 -r1.42 src/sys/kern/uipc_sem.c cvs rdiff -u -r1.234 -r1.235 src/sys/kern/uipc_socket.c cvs rdiff -u -r1.172 -r1.173 src/sys/kern/uipc_syscalls.c cvs rdiff -u -r1.170 -r1.171 src/sys/kern/uipc_usrreq.c cvs rdiff -u -r1.490 -r1.491 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.190 -r1.191 src/sys/kern/vfs_vnops.c cvs rdiff -u -r1.32 -r1.33 src/sys/kern/vfs_xattr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/exec_script.c diff -u src/sys/kern/exec_script.c:1.73 src/sys/kern/exec_script.c:1.74 --- src/sys/kern/exec_script.c:1.73 Mon Jun 30 17:31:15 2014 +++ src/sys/kern/exec_script.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_script.c,v 1.73 2014/06/30 17:31:15 maxv Exp $ */ +/* $NetBSD: exec_script.c,v 1.74 2014/09/05 09:20:59 matt Exp $ */ /* * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.73 2014/06/30 17:31:15 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.74 2014/09/05 09:20:59 matt Exp $"); #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS) #define FDSCRIPTS /* Need this for safe set-id scripts. */ @@ -228,7 +228,7 @@ check_shell: epp->ep_flags |= EXEC_HASFD; fp->f_type = DTYPE_VNODE; fp->f_ops = &vnops; - fp->f_data = (void *) epp->ep_vp; + fp->f_vnode = epp->ep_vp; fp->f_flag = FREAD; fd_affix(curproc, fp, epp->ep_fd); } Index: src/sys/kern/kern_descrip.c diff -u src/sys/kern/kern_descrip.c:1.226 src/sys/kern/kern_descrip.c:1.227 --- src/sys/kern/kern_descrip.c:1.226 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/kern_descrip.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_descrip.c,v 1.226 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: kern_descrip.c,v 1.227 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.226 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.227 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -492,7 +492,7 @@ fd_getvnode(unsigned fd, file_t **fpp) fd_putfile(fd); return EINVAL; } - vp = fp->f_data; + vp = fp->f_vnode; if (__predict_false(vp->v_type == VBAD)) { /* XXX Is this case really necessary? */ fd_putfile(fd); @@ -517,7 +517,7 @@ fd_getsock1(unsigned fd, struct socket * fd_putfile(fd); return ENOTSOCK; } - *sop = (*fp)->f_data; + *sop = (*fp)->f_socket; return 0; } @@ -704,7 +704,7 @@ fd_close(unsigned fd) lf.l_len = 0; lf.l_type = F_UNLCK; mutex_exit(&fdp->fd_lock); - (void)VOP_ADVLOCK(fp->f_data, p, F_UNLCK, &lf, F_POSIX); + (void)VOP_ADVLOCK(fp->f_vnode, p, F_UNLCK, &lf, F_POSIX); mutex_enter(&fdp->fd_lock); } @@ -825,7 +825,7 @@ closef(file_t *fp) lf.l_start = 0; lf.l_len = 0; lf.l_type = F_UNLCK; - (void)VOP_ADVLOCK(fp->f_data, fp, F_UNLCK, &lf, F_FLOCK); + (void)VOP_ADVLOCK(fp->f_vnode, fp, F_UNLCK, &lf, F_FLOCK); } if (fp->f_ops != NULL) { error = (*fp->f_ops->fo_close)(fp); @@ -2301,7 +2301,7 @@ fill_file(struct kinfo_file *kp, const f /* vnode information to glue this file to something */ if (fp->f_type == DTYPE_VNODE) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_vnode; kp->ki_vun = PTRTOUINT64(vp->v_un.vu_socket); kp->ki_vsize = vp->v_size; Index: src/sys/kern/kern_event.c diff -u src/sys/kern/kern_event.c:1.81 src/sys/kern/kern_event.c:1.82 --- src/sys/kern/kern_event.c:1.81 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/kern_event.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.81 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: kern_event.c,v 1.82 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.81 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.82 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -415,7 +415,7 @@ filt_kqdetach(struct knote *kn) { struct kqueue *kq; - kq = ((file_t *)kn->kn_obj)->f_data; + kq = ((file_t *)kn->kn_obj)->f_kqueue; mutex_spin_enter(&kq->kq_lock); SLIST_REMOVE(&kq->kq_sel.sel_klist, kn, knote, kn_selnext); @@ -432,7 +432,7 @@ filt_kqueue(struct knote *kn, long hint) struct kqueue *kq; int rv; - kq = ((file_t *)kn->kn_obj)->f_data; + kq = ((file_t *)kn->kn_obj)->f_kqueue; if (hint != NOTE_SUBMIT) mutex_spin_enter(&kq->kq_lock); @@ -744,7 +744,7 @@ kqueue1(struct lwp *l, int flags, regist cv_init(&kq->kq_cv, "kqueue"); selinit(&kq->kq_sel); TAILQ_INIT(&kq->kq_head); - fp->f_data = kq; + fp->f_kqueue = kq; *retval = fd; kq->kq_fdp = curlwp->l_fd; fd_set_exclose(l, fd, (flags & O_CLOEXEC) != 0); @@ -847,7 +847,7 @@ kevent1(register_t *retval, int fd, timeout = &ts; } - kq = (struct kqueue *)fp->f_data; + kq = fp->f_kqueue; nerrors = 0; ichange = 0; @@ -1152,7 +1152,7 @@ kqueue_scan(file_t *fp, size_t maxevents filedesc_t *fdp; fdp = curlwp->l_fd; - kq = fp->f_data; + kq = fp->f_kqueue; count = maxevents; nkev = nevents = error = 0; if (count == 0) { @@ -1374,7 +1374,7 @@ kqueue_poll(file_t *fp, int events) struct kqueue *kq; int revents; - kq = fp->f_data; + kq = fp->f_kqueue; revents = 0; if (events & (POLLIN | POLLRDNORM)) { @@ -1400,7 +1400,7 @@ kqueue_stat(file_t *fp, struct stat *st) { struct kqueue *kq; - kq = fp->f_data; + kq = fp->f_kqueue; memset(st, 0, sizeof(*st)); st->st_size = kq->kq_count; @@ -1443,8 +1443,8 @@ kqueue_close(file_t *fp) fdfile_t *ff; int i; - kq = fp->f_data; - fp->f_data = NULL; + kq = fp->f_kqueue; + fp->f_kqueue = NULL; fp->f_type = 0; fdp = curlwp->l_fd; @@ -1479,7 +1479,7 @@ kqueue_kqfilter(file_t *fp, struct knote { struct kqueue *kq; - kq = ((file_t *)kn->kn_obj)->f_data; + kq = ((file_t *)kn->kn_obj)->f_kqueue; KASSERT(fp == kn->kn_obj); Index: src/sys/kern/kern_ktrace_vfs.c diff -u src/sys/kern/kern_ktrace_vfs.c:1.1 src/sys/kern/kern_ktrace_vfs.c:1.2 --- src/sys/kern/kern_ktrace_vfs.c:1.1 Mon Dec 9 16:45:23 2013 +++ src/sys/kern/kern_ktrace_vfs.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ktrace_vfs.c,v 1.1 2013/12/09 16:45:23 pooka Exp $ */ +/* $NetBSD: kern_ktrace_vfs.c,v 1.2 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_ktrace_vfs.c,v 1.1 2013/12/09 16:45:23 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_ktrace_vfs.c,v 1.2 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -136,7 +136,7 @@ sys_ktrace(struct lwp *l, const struct s fp->f_flag = FWRITE; fp->f_type = DTYPE_VNODE; fp->f_ops = &vnops; - fp->f_data = (void *)vp; + fp->f_vnode = vp; vp = NULL; } error = ktrace_common(l, SCARG(uap, ops), SCARG(uap, facs), Index: src/sys/kern/subr_exec_fd.c diff -u src/sys/kern/subr_exec_fd.c:1.6 src/sys/kern/subr_exec_fd.c:1.7 --- src/sys/kern/subr_exec_fd.c:1.6 Wed Jun 1 21:25:01 2011 +++ src/sys/kern/subr_exec_fd.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_exec_fd.c,v 1.6 2011/06/01 21:25:01 alnsn Exp $ */ +/* $NetBSD: subr_exec_fd.c,v 1.7 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_exec_fd.c,v 1.6 2011/06/01 21:25:01 alnsn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_exec_fd.c,v 1.7 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/file.h> @@ -112,10 +112,10 @@ fd_checkstd(void) fd_abort(p, fp, fd); return (error); } - fp->f_data = nd.ni_vp; + fp->f_type = DTYPE_VNODE; + fp->f_vnode = nd.ni_vp; fp->f_flag = flags; fp->f_ops = &vnops; - fp->f_type = DTYPE_VNODE; VOP_UNLOCK(nd.ni_vp); fd_affix(p, fp, fd); pathbuf_destroy(pb); Index: src/sys/kern/sys_aio.c diff -u src/sys/kern/sys_aio.c:1.39 src/sys/kern/sys_aio.c:1.40 --- src/sys/kern/sys_aio.c:1.39 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/sys_aio.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_aio.c,v 1.39 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: sys_aio.c,v 1.40 2014/09/05 09:20:59 matt Exp $ */ /* * Copyright (c) 2007 Mindaugas Rasiukevicius <rmind at NetBSD org> @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.39 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_aio.c,v 1.40 2014/09/05 09:20:59 matt Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -438,7 +438,7 @@ aio_process(struct aio_job *a_job) goto done; } - vp = (struct vnode *)fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (a_job->aio_op & AIO_DSYNC) { error = VOP_FSYNC(vp, fp->f_cred, Index: src/sys/kern/sys_descrip.c diff -u src/sys/kern/sys_descrip.c:1.29 src/sys/kern/sys_descrip.c:1.30 --- src/sys/kern/sys_descrip.c:1.29 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/sys_descrip.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_descrip.c,v 1.29 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: sys_descrip.c,v 1.30 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.29 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.30 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -245,7 +245,7 @@ do_fcntl_lock(int fd, int cmd, struct fl fd_putfile(fd); return EINVAL; } - vp = fp->f_data; + vp = fp->f_vnode; if (fl->l_whence == SEEK_CUR) fl->l_start += fp->f_offset; @@ -567,7 +567,7 @@ sys_fpathconf(struct lwp *l, const struc break; case DTYPE_VNODE: - error = VOP_PATHCONF(fp->f_data, SCARG(uap, name), retval); + error = VOP_PATHCONF(fp->f_vnode, SCARG(uap, name), retval); break; case DTYPE_KQUEUE: @@ -614,7 +614,7 @@ sys_flock(struct lwp *l, const struct sy return EOPNOTSUPP; } - vp = fp->f_data; + vp = fp->f_vnode; lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; @@ -682,7 +682,7 @@ do_posix_fadvise(int fd, off_t offset, o switch (advice) { case POSIX_FADV_WILLNEED: case POSIX_FADV_DONTNEED: - vp = fp->f_data; + vp = fp->f_vnode; if (vp->v_type != VREG && vp->v_type != VBLK) { fd_putfile(fd); return 0; @@ -705,12 +705,12 @@ do_posix_fadvise(int fd, off_t offset, o break; case POSIX_FADV_WILLNEED: - vp = fp->f_data; + vp = fp->f_vnode; error = uvm_readahead(&vp->v_uobj, offset, endoffset - offset); break; case POSIX_FADV_DONTNEED: - vp = fp->f_data; + vp = fp->f_vnode; /* * Align the region to page boundaries as VOP_PUTPAGES expects * by shrinking it. We shrink instead of expand because we Index: src/sys/kern/sys_generic.c diff -u src/sys/kern/sys_generic.c:1.129 src/sys/kern/sys_generic.c:1.130 --- src/sys/kern/sys_generic.c:1.129 Thu Apr 4 12:51:39 2013 +++ src/sys/kern/sys_generic.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_generic.c,v 1.129 2013/04/04 12:51:39 martin Exp $ */ +/* $NetBSD: sys_generic.c,v 1.130 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.129 2013/04/04 12:51:39 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.130 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -208,7 +208,7 @@ do_filereadv(int fd, const struct iovec if (offset == NULL) offset = &fp->f_offset; else { - struct vnode *vp = fp->f_data; + struct vnode *vp = fp->f_vnode; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) { error = ESPIPE; goto out; @@ -413,7 +413,7 @@ do_filewritev(int fd, const struct iovec if (offset == NULL) offset = &fp->f_offset; else { - struct vnode *vp = fp->f_data; + struct vnode *vp = fp->f_vnode; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) { error = ESPIPE; goto out; Index: src/sys/kern/sys_mqueue.c diff -u src/sys/kern/sys_mqueue.c:1.36 src/sys/kern/sys_mqueue.c:1.37 --- src/sys/kern/sys_mqueue.c:1.36 Tue Feb 25 18:30:11 2014 +++ src/sys/kern/sys_mqueue.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_mqueue.c,v 1.36 2014/02/25 18:30:11 pooka Exp $ */ +/* $NetBSD: sys_mqueue.c,v 1.37 2014/09/05 09:20:59 matt Exp $ */ /* * Copyright (c) 2007-2011 Mindaugas Rasiukevicius <rmind at NetBSD org> @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.36 2014/02/25 18:30:11 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.37 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -303,7 +303,7 @@ mqueue_get(mqd_t mqd, int fflag, mqueue_ fd_putfile(fd); return EBADF; } - mq = fp->f_data; + mq = fp->f_mqueue; mutex_enter(&mq->mq_mtx); *mqret = mq; @@ -334,7 +334,7 @@ mqueue_linear_insert(struct mqueue *mq, static int mq_stat_fop(file_t *fp, struct stat *st) { - struct mqueue *mq = fp->f_data; + struct mqueue *mq = fp->f_mqueue; memset(st, 0, sizeof(*st)); @@ -355,7 +355,7 @@ mq_stat_fop(file_t *fp, struct stat *st) static int mq_poll_fop(file_t *fp, int events) { - struct mqueue *mq = fp->f_data; + struct mqueue *mq = fp->f_mqueue; struct mq_attr *mqattr; int revents = 0; @@ -384,7 +384,7 @@ static int mq_close_fop(file_t *fp) { proc_t *p = curproc; - mqueue_t *mq = fp->f_data; + mqueue_t *mq = fp->f_mqueue; bool destroy = false; mutex_enter(&mq->mq_mtx); @@ -596,7 +596,7 @@ sys_mq_open(struct lwp *l, const struct name = NULL; } KASSERT(mq != NULL); - fp->f_data = mq; + fp->f_mqueue = mq; fd_affix(p, fp, mqd); *retval = mqd; err: Index: src/sys/kern/sys_pipe.c diff -u src/sys/kern/sys_pipe.c:1.139 src/sys/kern/sys_pipe.c:1.140 --- src/sys/kern/sys_pipe.c:1.139 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/sys_pipe.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_pipe.c,v 1.139 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: sys_pipe.c,v 1.140 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.139 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.140 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -275,13 +275,13 @@ pipe1(struct lwp *l, register_t *retval, rf->f_flag = FREAD | flags; rf->f_type = DTYPE_PIPE; - rf->f_data = (void *)rpipe; + rf->f_pipe = rpipe; rf->f_ops = &pipeops; fd_set_exclose(l, (int)retval[0], (flags & O_CLOEXEC) != 0); wf->f_flag = FWRITE | flags; wf->f_type = DTYPE_PIPE; - wf->f_data = (void *)wpipe; + wf->f_pipe = wpipe; wf->f_ops = &pipeops; fd_set_exclose(l, (int)retval[1], (flags & O_CLOEXEC) != 0); @@ -447,7 +447,7 @@ static int pipe_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred, int flags) { - struct pipe *rpipe = (struct pipe *) fp->f_data; + struct pipe *rpipe = fp->f_pipe; struct pipebuf *bp = &rpipe->pipe_buffer; kmutex_t *lock = rpipe->pipe_lock; int error; @@ -839,7 +839,7 @@ pipe_write(file_t *fp, off_t *offset, st unsigned int wakeup_state = 0; /* We want to write to our peer */ - rpipe = (struct pipe *) fp->f_data; + rpipe = fp->f_pipe; lock = rpipe->pipe_lock; error = 0; @@ -1076,7 +1076,7 @@ pipe_write(file_t *fp, off_t *offset, st int pipe_ioctl(file_t *fp, u_long cmd, void *data) { - struct pipe *pipe = fp->f_data; + struct pipe *pipe = fp->f_pipe; kmutex_t *lock = pipe->pipe_lock; switch (cmd) { @@ -1152,7 +1152,7 @@ pipe_ioctl(file_t *fp, u_long cmd, void int pipe_poll(file_t *fp, int events) { - struct pipe *rpipe = fp->f_data; + struct pipe *rpipe = fp->f_pipe; struct pipe *wpipe; int eof = 0; int revents = 0; @@ -1202,7 +1202,7 @@ pipe_poll(file_t *fp, int events) static int pipe_stat(file_t *fp, struct stat *ub) { - struct pipe *pipe = fp->f_data; + struct pipe *pipe = fp->f_pipe; mutex_enter(pipe->pipe_lock); memset(ub, 0, sizeof(*ub)); @@ -1229,9 +1229,9 @@ pipe_stat(file_t *fp, struct stat *ub) static int pipe_close(file_t *fp) { - struct pipe *pipe = fp->f_data; + struct pipe *pipe = fp->f_pipe; - fp->f_data = NULL; + fp->f_pipe = NULL; pipeclose(pipe); return (0); } @@ -1239,7 +1239,7 @@ pipe_close(file_t *fp) static void pipe_restart(file_t *fp) { - struct pipe *pipe = fp->f_data; + struct pipe *pipe = fp->f_pipe; /* * Unblock blocked reads/writes in order to allow close() to complete. @@ -1360,7 +1360,7 @@ filt_pipedetach(struct knote *kn) struct pipe *pipe; kmutex_t *lock; - pipe = ((file_t *)kn->kn_obj)->f_data; + pipe = ((file_t *)kn->kn_obj)->f_pipe; lock = pipe->pipe_lock; mutex_enter(lock); @@ -1390,7 +1390,7 @@ filt_pipedetach(struct knote *kn) static int filt_piperead(struct knote *kn, long hint) { - struct pipe *rpipe = ((file_t *)kn->kn_obj)->f_data; + struct pipe *rpipe = ((file_t *)kn->kn_obj)->f_pipe; struct pipe *wpipe; if ((hint & NOTE_SUBMIT) == 0) { @@ -1420,7 +1420,7 @@ filt_piperead(struct knote *kn, long hin static int filt_pipewrite(struct knote *kn, long hint) { - struct pipe *rpipe = ((file_t *)kn->kn_obj)->f_data; + struct pipe *rpipe = ((file_t *)kn->kn_obj)->f_pipe; struct pipe *wpipe; if ((hint & NOTE_SUBMIT) == 0) { @@ -1457,7 +1457,7 @@ pipe_kqfilter(file_t *fp, struct knote * struct pipe *pipe; kmutex_t *lock; - pipe = ((file_t *)kn->kn_obj)->f_data; + pipe = ((file_t *)kn->kn_obj)->f_pipe; lock = pipe->pipe_lock; mutex_enter(lock); Index: src/sys/kern/sys_socket.c diff -u src/sys/kern/sys_socket.c:1.72 src/sys/kern/sys_socket.c:1.73 --- src/sys/kern/sys_socket.c:1.72 Sun Jul 6 03:33:33 2014 +++ src/sys/kern/sys_socket.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_socket.c,v 1.72 2014/07/06 03:33:33 rtr Exp $ */ +/* $NetBSD: sys_socket.c,v 1.73 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.72 2014/07/06 03:33:33 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.73 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -99,7 +99,7 @@ int soo_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred, int flags) { - struct socket *so = fp->f_data; + struct socket *so = fp->f_socket; int error; error = (*so->so_receive)(so, NULL, uio, NULL, NULL, NULL); @@ -112,7 +112,7 @@ int soo_write(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred, int flags) { - struct socket *so = fp->f_data; + struct socket *so = fp->f_socket; int error; error = (*so->so_send)(so, NULL, uio, NULL, NULL, 0, curlwp); @@ -123,7 +123,7 @@ soo_write(file_t *fp, off_t *offset, str int soo_ioctl(file_t *fp, u_long cmd, void *data) { - struct socket *so = fp->f_data; + struct socket *so = fp->f_socket; int error = 0; switch (cmd) { @@ -226,13 +226,13 @@ int soo_poll(file_t *fp, int events) { - return sopoll(fp->f_data, events); + return sopoll(fp->f_socket, events); } int soo_stat(file_t *fp, struct stat *ub) { - struct socket *so = fp->f_data; + struct socket *so = fp->f_socket; int error; memset(ub, 0, sizeof(*ub)); @@ -251,9 +251,9 @@ soo_close(file_t *fp) { int error = 0; - if (fp->f_data) - error = soclose(fp->f_data); - fp->f_data = 0; + if (fp->f_socket) + error = soclose(fp->f_socket); + fp->f_socket = NULL; return error; } @@ -262,5 +262,5 @@ void soo_restart(file_t *fp) { - sorestart(fp->f_data); + sorestart(fp->f_socket); } Index: src/sys/kern/tty_ptm.c diff -u src/sys/kern/tty_ptm.c:1.33 src/sys/kern/tty_ptm.c:1.34 --- src/sys/kern/tty_ptm.c:1.33 Fri Jul 25 08:10:40 2014 +++ src/sys/kern/tty_ptm.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tty_ptm.c,v 1.33 2014/07/25 08:10:40 dholland Exp $ */ +/* $NetBSD: tty_ptm.c,v 1.34 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.33 2014/07/25 08:10:40 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.34 2014/09/05 09:20:59 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ptm.h" @@ -213,7 +213,7 @@ retry: fp->f_flag = FREAD|FWRITE; fp->f_type = DTYPE_VNODE; fp->f_ops = &vnops; - fp->f_data = vp; + fp->f_vnode = vp; VOP_UNLOCK(vp); fd_affix(curproc, fp, *fd); return 0; @@ -290,7 +290,7 @@ pty_alloc_slave(struct lwp *l, int *fd, fp->f_flag = FREAD|FWRITE; fp->f_type = DTYPE_VNODE; fp->f_ops = &vnops; - fp->f_data = vp; + fp->f_vnode = vp; VOP_UNLOCK(vp); fd_affix(curproc, fp, *fd); return 0; Index: src/sys/kern/uipc_domain.c diff -u src/sys/kern/uipc_domain.c:1.94 src/sys/kern/uipc_domain.c:1.95 --- src/sys/kern/uipc_domain.c:1.94 Fri Aug 22 11:28:03 2014 +++ src/sys/kern/uipc_domain.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_domain.c,v 1.94 2014/08/22 11:28:03 pooka Exp $ */ +/* $NetBSD: uipc_domain.c,v 1.95 2014/09/05 09:20:59 matt Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.94 2014/08/22 11:28:03 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_domain.c,v 1.95 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/socket.h> @@ -517,9 +517,9 @@ sysctl_unpcblist(SYSCTLFN_ARGS) mutex_enter(&filelist_lock); LIST_FOREACH(fp, &filehead, f_list) { if (fp->f_count == 0 || fp->f_type != DTYPE_SOCKET || - fp->f_data == NULL) + fp->f_socket == NULL) continue; - so = (struct socket *)fp->f_data; + so = fp->f_socket; if (so->so_type != type) continue; if (so->so_proto->pr_domain->dom_family != pf) Index: src/sys/kern/uipc_sem.c diff -u src/sys/kern/uipc_sem.c:1.41 src/sys/kern/uipc_sem.c:1.42 --- src/sys/kern/uipc_sem.c:1.41 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/uipc_sem.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_sem.c,v 1.41 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: uipc_sem.c,v 1.42 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.41 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.42 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -260,7 +260,7 @@ ksem_get(int fd, ksem_t **ksret) fd_putfile(fd); return EINVAL; } - ks = fp->f_data; + ks = fp->f_ksem; mutex_enter(&ks->ks_lock); *ksret = ks; @@ -380,7 +380,7 @@ do_ksem_init(lwp_t *l, u_int val, intptr fd_abort(p, fp, fd); return error; } - fp->f_data = ks; + fp->f_ksem = ks; fd_affix(p, fp, fd); return error; } @@ -496,7 +496,7 @@ do_ksem_open(struct lwp *l, const char * ksnew = NULL; } KASSERT(ks != NULL); - fp->f_data = ks; + fp->f_ksem = ks; fd_affix(p, fp, fd); err: if (error) { @@ -529,7 +529,7 @@ ksem_read_fop(file_t *fp, off_t *offset, { size_t len; char *name; - ksem_t *ks = fp->f_data; + ksem_t *ks = fp->f_ksem; mutex_enter(&ks->ks_lock); len = ks->ks_namelen; @@ -543,7 +543,7 @@ ksem_read_fop(file_t *fp, off_t *offset, static int ksem_stat_fop(file_t *fp, struct stat *ub) { - ksem_t *ks = fp->f_data; + ksem_t *ks = fp->f_ksem; mutex_enter(&ks->ks_lock); @@ -573,7 +573,7 @@ ksem_stat_fop(file_t *fp, struct stat *u static int ksem_close_fop(file_t *fp) { - ksem_t *ks = fp->f_data; + ksem_t *ks = fp->f_ksem; bool destroy = false; mutex_enter(&ks->ks_lock); Index: src/sys/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.234 src/sys/kern/uipc_socket.c:1.235 --- src/sys/kern/uipc_socket.c:1.234 Sat Aug 9 05:33:00 2014 +++ src/sys/kern/uipc_socket.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.234 2014/08/09 05:33:00 rtr Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.235 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.234 2014/08/09 05:33:00 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.235 2014/09/05 09:20:59 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_sock_counters.h" @@ -600,7 +600,7 @@ fsocreate(int domain, struct socket **so if (flags & SOCK_NONBLOCK) { so->so_state |= SS_NBIO; } - fp->f_data = so; + fp->f_socket = so; fd_affix(curproc, fp, fd); if (sop != NULL) { @@ -2173,7 +2173,7 @@ filt_sordetach(struct knote *kn) { struct socket *so; - so = ((file_t *)kn->kn_obj)->f_data; + so = ((file_t *)kn->kn_obj)->f_socket; solock(so); SLIST_REMOVE(&so->so_rcv.sb_sel.sel_klist, kn, knote, kn_selnext); if (SLIST_EMPTY(&so->so_rcv.sb_sel.sel_klist)) @@ -2188,7 +2188,7 @@ filt_soread(struct knote *kn, long hint) struct socket *so; int rv; - so = ((file_t *)kn->kn_obj)->f_data; + so = ((file_t *)kn->kn_obj)->f_socket; if (hint != NOTE_SUBMIT) solock(so); kn->kn_data = so->so_rcv.sb_cc; @@ -2212,7 +2212,7 @@ filt_sowdetach(struct knote *kn) { struct socket *so; - so = ((file_t *)kn->kn_obj)->f_data; + so = ((file_t *)kn->kn_obj)->f_socket; solock(so); SLIST_REMOVE(&so->so_snd.sb_sel.sel_klist, kn, knote, kn_selnext); if (SLIST_EMPTY(&so->so_snd.sb_sel.sel_klist)) @@ -2227,7 +2227,7 @@ filt_sowrite(struct knote *kn, long hint struct socket *so; int rv; - so = ((file_t *)kn->kn_obj)->f_data; + so = ((file_t *)kn->kn_obj)->f_socket; if (hint != NOTE_SUBMIT) solock(so); kn->kn_data = sbspace(&so->so_snd); @@ -2256,7 +2256,7 @@ filt_solisten(struct knote *kn, long hin struct socket *so; int rv; - so = ((file_t *)kn->kn_obj)->f_data; + so = ((file_t *)kn->kn_obj)->f_socket; /* * Set kn_data to number of incoming connections, not @@ -2284,7 +2284,7 @@ soo_kqfilter(struct file *fp, struct kno struct socket *so; struct sockbuf *sb; - so = ((file_t *)kn->kn_obj)->f_data; + so = ((file_t *)kn->kn_obj)->f_socket; solock(so); switch (kn->kn_filter) { case EVFILT_READ: Index: src/sys/kern/uipc_syscalls.c diff -u src/sys/kern/uipc_syscalls.c:1.172 src/sys/kern/uipc_syscalls.c:1.173 --- src/sys/kern/uipc_syscalls.c:1.172 Sat Aug 9 05:33:00 2014 +++ src/sys/kern/uipc_syscalls.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $ */ +/* $NetBSD: uipc_syscalls.c,v 1.173 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.173 2014/09/05 09:20:59 matt Exp $"); #include "opt_pipe.h" @@ -185,7 +185,7 @@ do_sys_accept(struct lwp *l, int sock, s } nam = m_get(M_WAIT, MT_SONAME); *new_sock = fd; - so = fp->f_data; + so = fp->f_socket; solock(so); if (__predict_false(mask)) @@ -233,7 +233,7 @@ do_sys_accept(struct lwp *l, int sock, s ((flags & SOCK_NONBLOCK) ? FNONBLOCK : 0)| ((flags & SOCK_NOSIGPIPE) ? FNOSIGPIPE : 0); fp2->f_ops = &socketops; - fp2->f_data = so2; + fp2->f_socket = so2; if (fp2->f_flag & FNONBLOCK) so2->so_state |= SS_NBIO; else @@ -431,7 +431,7 @@ makesocket(struct lwp *l, file_t **fp, i ((flags & SOCK_NOSIGPIPE) ? FNOSIGPIPE : 0); (*fp)->f_type = DTYPE_SOCKET; (*fp)->f_ops = &socketops; - (*fp)->f_data = so; + (*fp)->f_socket = so; return 0; } @@ -457,13 +457,13 @@ sys_socketpair(struct lwp *l, const stru error = makesocket(l, &fp1, &fd, flags, type, domain, proto, NULL); if (error) return error; - so1 = fp1->f_data; + so1 = fp1->f_socket; sv[0] = fd; error = makesocket(l, &fp2, &fd, flags, type, domain, proto, so1); if (error) goto out; - so2 = fp2->f_data; + so2 = fp2->f_socket; sv[1] = fd; solock(so1); @@ -1267,13 +1267,13 @@ pipe1(struct lwp *l, register_t *retval, rf->f_flag = FREAD | flags; rf->f_type = DTYPE_SOCKET; rf->f_ops = &socketops; - rf->f_data = rso; + rf->f_socket = rso; if ((error = fd_allocfile(&wf, &fd)) != 0) goto free3; wf->f_flag = FWRITE | flags; wf->f_type = DTYPE_SOCKET; wf->f_ops = &socketops; - wf->f_data = wso; + wf->f_socket = wso; retval[1] = fd; solock(wso); error = unp_connect2(wso, rso); Index: src/sys/kern/uipc_usrreq.c diff -u src/sys/kern/uipc_usrreq.c:1.170 src/sys/kern/uipc_usrreq.c:1.171 --- src/sys/kern/uipc_usrreq.c:1.170 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/uipc_usrreq.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.170 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.171 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.170 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.171 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1408,7 +1408,7 @@ unp_externalize(struct mbuf *rights, str * to access. */ if (p->p_cwdi->cwdi_rdir != NULL && fp->f_type == DTYPE_VNODE) { - vnode_t *vp = (vnode_t *)fp->f_data; + vnode_t *vp = fp->f_vnode; if ((vp->v_type == VDIR) && !vn_isunder(vp, p->p_cwdi->cwdi_rdir, l)) { error = EPERM; @@ -1717,7 +1717,7 @@ unp_gc(file_t *dp) atomic_or_uint(&fp->f_flag, FMARK); if (fp->f_type != DTYPE_SOCKET || - (so = fp->f_data) == NULL || + (so = fp->f_socket) == NULL || so->so_proto->pr_domain != &unixdomain || (so->so_proto->pr_flags & PR_RIGHTS) == 0) { mutex_exit(&fp->f_lock); @@ -1798,7 +1798,7 @@ unp_gc(file_t *dp) * This will cause files referenced only by the * socket to be queued for close. */ - so = fp->f_data; + so = fp->f_socket; solock(so); sorflush(so); sounlock(so); Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.490 src/sys/kern/vfs_syscalls.c:1.491 --- src/sys/kern/vfs_syscalls.c:1.490 Fri Jul 25 16:28:12 2014 +++ src/sys/kern/vfs_syscalls.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.490 2014/07/25 16:28:12 maxv Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.491 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.490 2014/07/25 16:28:12 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.491 2014/09/05 09:20:59 matt Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -174,7 +174,7 @@ fd_nameiat(struct lwp *l, int fdat, stru if ((error = fd_getvnode(fdat, &dfp)) != 0) goto out; - NDAT(ndp, dfp->f_data); + NDAT(ndp, dfp->f_vnode); } error = namei(ndp); @@ -197,7 +197,7 @@ fd_nameiat_simple_user(struct lwp *l, in if ((error = fd_getvnode(fdat, &dfp)) != 0) goto out; - dvp = dfp->f_data; + dvp = dfp->f_vnode; } else { dvp = NULL; } @@ -218,7 +218,7 @@ open_setfp(struct lwp *l, file_t *fp, st fp->f_flag = flags & FMASK; fp->f_type = DTYPE_VNODE; fp->f_ops = &vnops; - fp->f_data = vp; + fp->f_vnode = vp; if (flags & (O_EXLOCK | O_SHLOCK)) { struct flock lf; @@ -1201,7 +1201,7 @@ do_sys_fstatvfs(struct lwp *l, int fd, i /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(fd, &fp)) != 0) return (error); - mp = ((struct vnode *)fp->f_data)->v_mount; + mp = fp->f_vnode->v_mount; error = dostatvfs(mp, sb, curlwp, flags, 1); fd_putfile(fd); return error; @@ -1329,7 +1329,7 @@ sys_fchdir(struct lwp *l, const struct s fd = SCARG(uap, fd); if ((error = fd_getvnode(fd, &fp)) != 0) return (error); - vp = fp->f_data; + vp = fp->f_vnode; vref(vp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); @@ -1392,7 +1392,7 @@ sys_fchroot(struct lwp *l, const struct /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(fd, &fp)) != 0) return error; - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_type != VDIR) error = ENOTDIR; @@ -1653,7 +1653,7 @@ do_sys_openat(lwp_t *l, int fdat, const if ((error = fd_getvnode(fdat, &dfp)) != 0) goto out; - dvp = dfp->f_data; + dvp = dfp->f_vnode; } error = do_open(l, dvp, pb, flags, mode, fd); @@ -2752,7 +2752,7 @@ sys_lseek(struct lwp *l, const struct sy if ((fp = fd_getfile(fd)) == NULL) return (EBADF); - vp = fp->f_data; + vp = fp->f_vnode; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) { error = ESPIPE; goto out; @@ -2811,7 +2811,7 @@ sys_pread(struct lwp *l, const struct sy return (EBADF); } - vp = fp->f_data; + vp = fp->f_vnode; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) { error = ESPIPE; goto out; @@ -2878,7 +2878,7 @@ sys_pwrite(struct lwp *l, const struct s return (EBADF); } - vp = fp->f_data; + vp = fp->f_vnode; if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) { error = ESPIPE; goto out; @@ -3260,7 +3260,7 @@ sys_fchflags(struct lwp *l, const struct /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - vp = fp->f_data; + vp = fp->f_vnode; error = change_flags(vp, SCARG(uap, flags), l); VOP_UNLOCK(vp); fd_putfile(SCARG(uap, fd)); @@ -3363,7 +3363,7 @@ sys_fchmod(struct lwp *l, const struct s /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - error = change_mode(fp->f_data, SCARG(uap, mode), l); + error = change_mode(fp->f_vnode, SCARG(uap, mode), l); fd_putfile(SCARG(uap, fd)); return (error); } @@ -3510,7 +3510,7 @@ sys_fchown(struct lwp *l, const struct s /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - error = change_owner(fp->f_data, SCARG(uap, uid), SCARG(uap, gid), + error = change_owner(fp->f_vnode, SCARG(uap, uid), SCARG(uap, gid), l, 0); fd_putfile(SCARG(uap, fd)); return (error); @@ -3551,7 +3551,7 @@ sys___posix_fchown(struct lwp *l, const /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - error = change_owner(fp->f_data, SCARG(uap, uid), SCARG(uap, gid), + error = change_owner(fp->f_vnode, SCARG(uap, uid), SCARG(uap, gid), l, 1); fd_putfile(SCARG(uap, fd)); return (error); @@ -3707,7 +3707,7 @@ sys___futimes50(struct lwp *l, const str /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - error = do_sys_utimes(l, fp->f_data, NULL, 0, SCARG(uap, tptr), + error = do_sys_utimes(l, fp->f_vnode, NULL, 0, SCARG(uap, tptr), UIO_USERSPACE); fd_putfile(SCARG(uap, fd)); return (error); @@ -3727,7 +3727,7 @@ sys_futimens(struct lwp *l, const struct /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - error = do_sys_utimensat(l, AT_FDCWD, fp->f_data, NULL, 0, + error = do_sys_utimensat(l, AT_FDCWD, fp->f_vnode, NULL, 0, SCARG(uap, tptr), UIO_USERSPACE); fd_putfile(SCARG(uap, fd)); return (error); @@ -3963,7 +3963,7 @@ sys_ftruncate(struct lwp *l, const struc error = EINVAL; goto out; } - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_type == VDIR) error = EISDIR; @@ -3995,7 +3995,7 @@ sys_fsync(struct lwp *l, const struct sy /* fd_getvnode() will use the descriptor for us */ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0) return (error); - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(vp, fp->f_cred, FSYNC_WAIT, 0, 0); VOP_UNLOCK(vp); @@ -4063,7 +4063,7 @@ sys_fsync_range(struct lwp *l, const str s = 0; } - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(vp, fp->f_cred, nflags, s, e); VOP_UNLOCK(vp); @@ -4093,7 +4093,7 @@ sys_fdatasync(struct lwp *l, const struc fd_putfile(SCARG(uap, fd)); return (EBADF); } - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = VOP_FSYNC(vp, fp->f_cred, FSYNC_WAIT|FSYNC_DATAONLY, 0, 0); VOP_UNLOCK(vp); @@ -4727,7 +4727,7 @@ sys_posix_fallocate(struct lwp *l, const error = EBADF; goto fail; } - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_type == VDIR) { @@ -4778,7 +4778,7 @@ sys_fdiscard(struct lwp *l, const struct error = EBADF; goto fail; } - vp = fp->f_data; + vp = fp->f_vnode; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (vp->v_type == VDIR) { Index: src/sys/kern/vfs_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.190 src/sys/kern/vfs_vnops.c:1.191 --- src/sys/kern/vfs_vnops.c:1.190 Sun Jun 22 18:32:27 2014 +++ src/sys/kern/vfs_vnops.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.190 2014/06/22 18:32:27 maxv Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.191 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.190 2014/06/22 18:32:27 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.191 2014/09/05 09:20:59 matt Exp $"); #include "veriexec.h" @@ -461,7 +461,7 @@ int vn_readdir(file_t *fp, char *bf, int segflg, u_int count, int *done, struct lwp *l, off_t **cookies, int *ncookies) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_vnode; struct iovec aiov; struct uio auio; int error, eofflag; @@ -511,7 +511,7 @@ unionread: vp = vp->v_mount->mnt_vnodecovered; vref(vp); mutex_enter(&fp->f_lock); - fp->f_data = vp; + fp->f_vnode = vp; fp->f_offset = 0; mutex_exit(&fp->f_lock); vrele(tvp); @@ -528,7 +528,7 @@ static int vn_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred, int flags) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_vnode; int error, ioflag, fflag; size_t count; @@ -559,7 +559,7 @@ static int vn_write(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred, int flags) { - struct vnode *vp = (struct vnode *)fp->f_data; + struct vnode *vp = fp->f_vnode; int error, ioflag, fflag; size_t count; @@ -613,7 +613,7 @@ vn_write(file_t *fp, off_t *offset, stru static int vn_statfile(file_t *fp, struct stat *sb) { - struct vnode *vp = fp->f_data; + struct vnode *vp = fp->f_vnode; int error; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); @@ -688,7 +688,7 @@ vn_stat(struct vnode *vp, struct stat *s static int vn_fcntl(file_t *fp, u_int com, void *data) { - struct vnode *vp = fp->f_data; + struct vnode *vp = fp->f_vnode; int error; error = VOP_FCNTL(vp, com, data, fp->f_flag, kauth_cred_get()); @@ -701,7 +701,7 @@ vn_fcntl(file_t *fp, u_int com, void *da static int vn_ioctl(file_t *fp, u_long com, void *data) { - struct vnode *vp = fp->f_data, *ovp; + struct vnode *vp = fp->f_vnode, *ovp; struct vattr vattr; int error; @@ -776,7 +776,7 @@ static int vn_poll(file_t *fp, int events) { - return (VOP_POLL(fp->f_data, events)); + return (VOP_POLL(fp->f_vnode, events)); } /* @@ -786,7 +786,7 @@ int vn_kqfilter(file_t *fp, struct knote *kn) { - return (VOP_KQFILTER(fp->f_data, kn)); + return (VOP_KQFILTER(fp->f_vnode, kn)); } /* @@ -826,7 +826,7 @@ static int vn_closefile(file_t *fp) { - return vn_close(fp->f_data, fp->f_flag, fp->f_cred); + return vn_close(fp->f_vnode, fp->f_flag, fp->f_cred); } /* Index: src/sys/kern/vfs_xattr.c diff -u src/sys/kern/vfs_xattr.c:1.32 src/sys/kern/vfs_xattr.c:1.33 --- src/sys/kern/vfs_xattr.c:1.32 Fri Sep 5 05:57:21 2014 +++ src/sys/kern/vfs_xattr.c Fri Sep 5 09:20:59 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_xattr.c,v 1.32 2014/09/05 05:57:21 matt Exp $ */ +/* $NetBSD: vfs_xattr.c,v 1.33 2014/09/05 09:20:59 matt Exp $ */ /*- * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.32 2014/09/05 05:57:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.33 2014/09/05 09:20:59 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -428,7 +428,7 @@ sys_extattr_set_fd(struct lwp *l, const error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; error = extattr_set_vp(vp, SCARG(uap, attrnamespace), attrname, SCARG(uap, data), SCARG(uap, nbytes), l, retval, 0); @@ -522,7 +522,7 @@ sys_extattr_get_fd(struct lwp *l, const error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; error = extattr_get_vp(vp, SCARG(uap, attrnamespace), attrname, SCARG(uap, data), SCARG(uap, nbytes), l, retval); @@ -614,7 +614,7 @@ sys_extattr_delete_fd(struct lwp *l, con error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; error = extattr_delete_vp(vp, SCARG(uap, attrnamespace), attrname, l); @@ -694,7 +694,7 @@ sys_extattr_list_fd(struct lwp *l, const error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; error = extattr_list_vp(vp, SCARG(uap, attrnamespace), SCARG(uap, data), SCARG(uap, nbytes), @@ -878,7 +878,7 @@ sys_fsetxattr(struct lwp *l, const struc error = fd_getvnode(SCARG(uap, fd), &fp); if (error) goto out; - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; attrnamespace = xattr_native(attrname); @@ -981,7 +981,7 @@ sys_fgetxattr(struct lwp *l, const struc error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; attrnamespace = xattr_native(attrname); @@ -1114,7 +1114,7 @@ sys_flistxattr(struct lwp *l, const stru error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; list = SCARG(uap, list); size = SCARG(uap, size); @@ -1231,7 +1231,7 @@ sys_fremovexattr(struct lwp *l, const st error = fd_getvnode(SCARG(uap, fd), &fp); if (error) return (error); - vp = (struct vnode *) fp->f_data; + vp = fp->f_vnode; attrnamespace = xattr_native(attrname);