summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-06-22 08:41:43 +0000
committerphk <phk@FreeBSD.org>2003-06-22 08:41:43 +0000
commitc81c59299bd255eb5ab7510c9e84e9c54b8003d0 (patch)
treec8262a3d430fc3cafab7fb6aec641ce293cd3361 /sys/kern
parent4a223af282e5f60223c443ce3755f565f9db2465 (diff)
downloadFreeBSD-src-c81c59299bd255eb5ab7510c9e84e9c54b8003d0.zip
FreeBSD-src-c81c59299bd255eb5ab7510c9e84e9c54b8003d0.tar.gz
Add a f_vnode field to struct file.
Several of the subtypes have an associated vnode which is used for stuff like the f*() functions. By giving the vnode a speparate field, a number of checks for the specific subtype can be replaced simply with a check for f_vnode != NULL, and we can later free f_data up to subtype specific use. At this point in time, f_data still points to the vnode, so any code I might have overlooked will still work.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_acl.c8
-rw-r--r--sys/kern/kern_descrip.c21
-rw-r--r--sys/kern/kern_mac.c4
-rw-r--r--sys/kern/subr_acl_posix1e.c8
-rw-r--r--sys/kern/vfs_acl.c8
-rw-r--r--sys/kern/vfs_aio.c4
-rw-r--r--sys/kern/vfs_extattr.c36
-rw-r--r--sys/kern/vfs_syscalls.c36
-rw-r--r--sys/kern/vfs_vnops.c14
9 files changed, 74 insertions, 65 deletions
diff --git a/sys/kern/kern_acl.c b/sys/kern/kern_acl.c
index d1bce92..5a60f78 100644
--- a/sys/kern/kern_acl.c
+++ b/sys/kern/kern_acl.c
@@ -781,7 +781,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_get_acl(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -802,7 +802,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_set_acl(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -867,7 +867,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_delete(td, fp->f_data, uap->type);
+ error = vacl_delete(td, fp->f_vnode, uap->type);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -932,7 +932,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_aclcheck(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 6699e32..c61d08a 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -352,7 +352,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
*/
fhold(fp);
FILEDESC_UNLOCK(fdp);
- vp = fp->f_data;
+ vp = fp->f_vnode;
switch (flp->l_type) {
case F_RDLCK:
@@ -430,7 +430,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
*/
fhold(fp);
FILEDESC_UNLOCK(fdp);
- vp = fp->f_data;
+ vp = fp->f_vnode;
error = VOP_ADVLOCK(vp, (caddr_t)p->p_leader, F_GETLK, flp,
F_POSIX);
fdrop(fp, td);
@@ -1028,7 +1028,7 @@ fpathconf(td, uap)
break;
case DTYPE_FIFO:
case DTYPE_VNODE:
- vp = fp->f_data;
+ vp = fp->f_vnode;
mtx_lock(&Giant);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_PATHCONF(vp, uap->name, td->td_retval);
@@ -1465,7 +1465,7 @@ fdfree(td)
lf.l_start = 0;
lf.l_len = 0;
lf.l_type = F_UNLCK;
- vp = fp->f_data;
+ vp = fp->f_vnode;
(void) VOP_ADVLOCK(vp,
(caddr_t)td->td_proc->
p_leader,
@@ -1564,7 +1564,7 @@ static int
is_unsafe(struct file *fp)
{
if (fp->f_type == DTYPE_VNODE) {
- struct vnode *vp = fp->f_data;
+ struct vnode *vp = fp->f_vnode;
if ((vp->v_vflag & VV_PROCDEP) != 0)
return (1);
@@ -1722,6 +1722,7 @@ fdcheckstd(td)
break;
}
NDFREE(&nd, NDF_ONLY_PNBUF);
+ fp->f_vnode = nd.ni_vp;
fp->f_data = nd.ni_vp;
fp->f_flag = flags;
fp->f_ops = &vnops;
@@ -1770,7 +1771,7 @@ closef(fp, td)
lf.l_start = 0;
lf.l_len = 0;
lf.l_type = F_UNLCK;
- vp = fp->f_data;
+ vp = fp->f_vnode;
(void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader,
F_UNLCK, &lf, F_POSIX);
}
@@ -1794,7 +1795,7 @@ closef(fp, td)
lf.l_start = 0;
lf.l_len = 0;
lf.l_type = F_UNLCK;
- vp = fp->f_data;
+ vp = fp->f_vnode;
(void) VOP_ADVLOCK(vp,
(caddr_t)fdtol->fdl_leader,
F_UNLCK, &lf, F_POSIX);
@@ -1919,7 +1920,7 @@ _fgetvp(struct thread *td, int fd, struct vnode **vpp, int flags)
if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) {
error = EINVAL;
} else {
- *vpp = fp->f_data;
+ *vpp = fp->f_vnode;
vref(*vpp);
}
FILEDESC_UNLOCK(td->td_proc->p_fd);
@@ -2018,7 +2019,7 @@ fdrop_locked(fp, td)
lf.l_start = 0;
lf.l_len = 0;
lf.l_type = F_UNLCK;
- vp = fp->f_data;
+ vp = fp->f_vnode;
(void) VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
}
if (fp->f_ops != &badfileops)
@@ -2064,7 +2065,7 @@ flock(td, uap)
}
mtx_lock(&Giant);
- vp = fp->f_data;
+ vp = fp->f_vnode;
lf.l_whence = SEEK_SET;
lf.l_start = 0;
lf.l_len = 0;
diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c
index e5e25dc..79a12ec 100644
--- a/sys/kern/kern_mac.c
+++ b/sys/kern/kern_mac.c
@@ -3496,7 +3496,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
switch (fp->f_type) {
case DTYPE_FIFO:
case DTYPE_VNODE:
- vp = fp->f_data;
+ vp = fp->f_vnode;
mac_init_vnode_label(&intlabel);
@@ -3704,7 +3704,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
break;
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
if (error != 0) {
mac_destroy_vnode_label(&intlabel);
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c
index d1bce92..5a60f78 100644
--- a/sys/kern/subr_acl_posix1e.c
+++ b/sys/kern/subr_acl_posix1e.c
@@ -781,7 +781,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_get_acl(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -802,7 +802,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_set_acl(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -867,7 +867,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_delete(td, fp->f_data, uap->type);
+ error = vacl_delete(td, fp->f_vnode, uap->type);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -932,7 +932,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_aclcheck(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c
index d1bce92..5a60f78 100644
--- a/sys/kern/vfs_acl.c
+++ b/sys/kern/vfs_acl.c
@@ -781,7 +781,7 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_get_acl(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -802,7 +802,7 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_set_acl(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -867,7 +867,7 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_delete(td, fp->f_data, uap->type);
+ error = vacl_delete(td, fp->f_vnode, uap->type);
fdrop(fp, td);
}
mtx_unlock(&Giant);
@@ -932,7 +932,7 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap)
mtx_lock(&Giant);
error = getvnode(td->td_proc->p_fd, uap->filedes, &fp);
if (error == 0) {
- error = vacl_aclcheck(td, fp->f_data, uap->type, uap->aclp);
+ error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp);
fdrop(fp, td);
}
mtx_unlock(&Giant);
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index ef6e305..fc52073 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -1059,7 +1059,7 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
if (fp->f_type != DTYPE_VNODE)
return (-1);
- vp = fp->f_data;
+ vp = fp->f_vnode;
/*
* If its not a disk, we don't want to return a positive error.
@@ -1723,7 +1723,7 @@ aio_cancel(struct thread *td, struct aio_cancel_args *uap)
return (EBADF);
if (fp->f_type == DTYPE_VNODE) {
- vp = fp->f_data;
+ vp = fp->f_vnode;
if (vn_isdisk(vp,&error)) {
td->td_retval[0] = AIO_NOTCANCELED;
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 30e16fc..3b45d43 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -282,7 +282,7 @@ fstatfs(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- mp = ((struct vnode *)fp->f_data)->v_mount;
+ mp = fp->f_vnode->v_mount;
fdrop(fp, td);
if (mp == NULL)
return (EBADF);
@@ -403,7 +403,7 @@ fchdir(td, uap)
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
return (error);
- vp = fp->f_data;
+ vp = fp->f_vnode;
VREF(vp);
fdrop(fp, td);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
@@ -502,7 +502,7 @@ chroot_refuse_vdir_fds(fdp)
if (fp == NULL)
continue;
if (fp->f_type == DTYPE_VNODE) {
- vp = fp->f_data;
+ vp = fp->f_vnode;
if (vp->v_type == VDIR)
return (EPERM);
}
@@ -745,6 +745,7 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
td->td_retval[0] = indx;
return 0;
}
+ fp->f_vnode = vp;
fp->f_data = vp;
fp->f_flag = flags & FMASK;
fp->f_ops = &vnops;
@@ -1346,7 +1347,7 @@ lseek(td, uap)
fdrop(fp, td);
return (ESPIPE);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
noneg = (vp->v_type != VCHR);
offset = uap->offset;
switch (uap->whence) {
@@ -2056,7 +2057,7 @@ fchflags(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- error = setfflags(td, fp->f_data, uap->flags);
+ error = setfflags(td, fp->f_vnode, uap->flags);
fdrop(fp, td);
return (error);
}
@@ -2180,7 +2181,7 @@ fchmod(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- error = setfmode(td, fp->f_data, uap->mode);
+ error = setfmode(td, fp->f_vnode, uap->mode);
fdrop(fp, td);
return (error);
}
@@ -2322,7 +2323,7 @@ fchown(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- error = setfown(td, fp->f_data, uap->uid, uap->gid);
+ error = setfown(td, fp->f_vnode, uap->uid, uap->gid);
fdrop(fp, td);
return (error);
}
@@ -2520,7 +2521,7 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr,
return (error);
if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0)
return (error);
- error = setutimes(td, fp->f_data, ts, 2, tptr == NULL);
+ error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL);
fdrop(fp, td);
return (error);
}
@@ -2622,7 +2623,7 @@ ftruncate(td, uap)
fdrop(fp, td);
return (EINVAL);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
fdrop(fp, td);
return (error);
@@ -2733,7 +2734,7 @@ fsync(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- vp = fp->f_data;
+ vp = fp->f_vnode;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
fdrop(fp, td);
return (error);
@@ -3096,7 +3097,7 @@ ogetdirentries(td, uap)
fdrop(fp, td);
return (EBADF);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
unionread:
if (vp->v_type != VDIR) {
fdrop(fp, td);
@@ -3196,6 +3197,7 @@ unionread:
struct vnode *tvp = vp;
vp = vp->v_mount->mnt_vnodecovered;
VREF(vp);
+ fp->f_vnode = vp;
fp->f_data = vp;
fp->f_offset = 0;
vput(tvp);
@@ -3244,7 +3246,7 @@ getdirentries(td, uap)
fdrop(fp, td);
return (EBADF);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
unionread:
if (vp->v_type != VDIR) {
fdrop(fp, td);
@@ -3293,6 +3295,7 @@ unionread:
struct vnode *tvp = vp;
vp = vp->v_mount->mnt_vnodecovered;
VREF(vp);
+ fp->f_vnode = vp;
fp->f_data = vp;
fp->f_offset = 0;
vput(tvp);
@@ -3646,6 +3649,7 @@ fhopen(td, uap)
* from under us while we block in the lock op
*/
fhold(fp);
+ nfp->f_vnode = vp;
nfp->f_data = vp;
nfp->f_flag = fmode & FMASK;
nfp->f_ops = &vnops;
@@ -3967,7 +3971,7 @@ extattr_set_fd(td, uap)
if (error)
return (error);
- error = extattr_set_vp(fp->f_data, uap->attrnamespace,
+ error = extattr_set_vp(fp->f_vnode, uap->attrnamespace,
attrname, uap->data, uap->nbytes, td);
fdrop(fp, td);
@@ -4140,7 +4144,7 @@ extattr_get_fd(td, uap)
if (error)
return (error);
- error = extattr_get_vp(fp->f_data, uap->attrnamespace,
+ error = extattr_get_vp(fp->f_vnode, uap->attrnamespace,
attrname, uap->data, uap->nbytes, td);
fdrop(fp, td);
@@ -4272,7 +4276,7 @@ extattr_delete_fd(td, uap)
error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
if (error)
return (error);
- vp = fp->f_data;
+ vp = fp->f_vnode;
error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
fdrop(fp, td);
@@ -4418,7 +4422,7 @@ extattr_list_fd(td, uap)
if (error)
return (error);
- error = extattr_list_vp(fp->f_data, uap->attrnamespace, uap->data,
+ error = extattr_list_vp(fp->f_vnode, uap->attrnamespace, uap->data,
uap->nbytes, td);
fdrop(fp, td);
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 30e16fc..3b45d43 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -282,7 +282,7 @@ fstatfs(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- mp = ((struct vnode *)fp->f_data)->v_mount;
+ mp = fp->f_vnode->v_mount;
fdrop(fp, td);
if (mp == NULL)
return (EBADF);
@@ -403,7 +403,7 @@ fchdir(td, uap)
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
return (error);
- vp = fp->f_data;
+ vp = fp->f_vnode;
VREF(vp);
fdrop(fp, td);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
@@ -502,7 +502,7 @@ chroot_refuse_vdir_fds(fdp)
if (fp == NULL)
continue;
if (fp->f_type == DTYPE_VNODE) {
- vp = fp->f_data;
+ vp = fp->f_vnode;
if (vp->v_type == VDIR)
return (EPERM);
}
@@ -745,6 +745,7 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
td->td_retval[0] = indx;
return 0;
}
+ fp->f_vnode = vp;
fp->f_data = vp;
fp->f_flag = flags & FMASK;
fp->f_ops = &vnops;
@@ -1346,7 +1347,7 @@ lseek(td, uap)
fdrop(fp, td);
return (ESPIPE);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
noneg = (vp->v_type != VCHR);
offset = uap->offset;
switch (uap->whence) {
@@ -2056,7 +2057,7 @@ fchflags(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- error = setfflags(td, fp->f_data, uap->flags);
+ error = setfflags(td, fp->f_vnode, uap->flags);
fdrop(fp, td);
return (error);
}
@@ -2180,7 +2181,7 @@ fchmod(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- error = setfmode(td, fp->f_data, uap->mode);
+ error = setfmode(td, fp->f_vnode, uap->mode);
fdrop(fp, td);
return (error);
}
@@ -2322,7 +2323,7 @@ fchown(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- error = setfown(td, fp->f_data, uap->uid, uap->gid);
+ error = setfown(td, fp->f_vnode, uap->uid, uap->gid);
fdrop(fp, td);
return (error);
}
@@ -2520,7 +2521,7 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr,
return (error);
if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0)
return (error);
- error = setutimes(td, fp->f_data, ts, 2, tptr == NULL);
+ error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL);
fdrop(fp, td);
return (error);
}
@@ -2622,7 +2623,7 @@ ftruncate(td, uap)
fdrop(fp, td);
return (EINVAL);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
fdrop(fp, td);
return (error);
@@ -2733,7 +2734,7 @@ fsync(td, uap)
if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0)
return (error);
- vp = fp->f_data;
+ vp = fp->f_vnode;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) {
fdrop(fp, td);
return (error);
@@ -3096,7 +3097,7 @@ ogetdirentries(td, uap)
fdrop(fp, td);
return (EBADF);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
unionread:
if (vp->v_type != VDIR) {
fdrop(fp, td);
@@ -3196,6 +3197,7 @@ unionread:
struct vnode *tvp = vp;
vp = vp->v_mount->mnt_vnodecovered;
VREF(vp);
+ fp->f_vnode = vp;
fp->f_data = vp;
fp->f_offset = 0;
vput(tvp);
@@ -3244,7 +3246,7 @@ getdirentries(td, uap)
fdrop(fp, td);
return (EBADF);
}
- vp = fp->f_data;
+ vp = fp->f_vnode;
unionread:
if (vp->v_type != VDIR) {
fdrop(fp, td);
@@ -3293,6 +3295,7 @@ unionread:
struct vnode *tvp = vp;
vp = vp->v_mount->mnt_vnodecovered;
VREF(vp);
+ fp->f_vnode = vp;
fp->f_data = vp;
fp->f_offset = 0;
vput(tvp);
@@ -3646,6 +3649,7 @@ fhopen(td, uap)
* from under us while we block in the lock op
*/
fhold(fp);
+ nfp->f_vnode = vp;
nfp->f_data = vp;
nfp->f_flag = fmode & FMASK;
nfp->f_ops = &vnops;
@@ -3967,7 +3971,7 @@ extattr_set_fd(td, uap)
if (error)
return (error);
- error = extattr_set_vp(fp->f_data, uap->attrnamespace,
+ error = extattr_set_vp(fp->f_vnode, uap->attrnamespace,
attrname, uap->data, uap->nbytes, td);
fdrop(fp, td);
@@ -4140,7 +4144,7 @@ extattr_get_fd(td, uap)
if (error)
return (error);
- error = extattr_get_vp(fp->f_data, uap->attrnamespace,
+ error = extattr_get_vp(fp->f_vnode, uap->attrnamespace,
attrname, uap->data, uap->nbytes, td);
fdrop(fp, td);
@@ -4272,7 +4276,7 @@ extattr_delete_fd(td, uap)
error = getvnode(td->td_proc->p_fd, uap->fd, &fp);
if (error)
return (error);
- vp = fp->f_data;
+ vp = fp->f_vnode;
error = extattr_delete_vp(vp, uap->attrnamespace, attrname, td);
fdrop(fp, td);
@@ -4418,7 +4422,7 @@ extattr_list_fd(td, uap)
if (error)
return (error);
- error = extattr_list_vp(fp->f_data, uap->attrnamespace, uap->data,
+ error = extattr_list_vp(fp->f_vnode, uap->attrnamespace, uap->data,
uap->nbytes, td);
fdrop(fp, td);
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 786fad1..8d8f13d 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -510,7 +510,7 @@ vn_read(fp, uio, active_cred, flags, td)
mtx_lock(&Giant);
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
uio->uio_td, td));
- vp = fp->f_data;
+ vp = fp->f_vnode;
ioflag = 0;
if (fp->f_flag & FNONBLOCK)
ioflag |= IO_NDELAY;
@@ -560,7 +560,7 @@ vn_write(fp, uio, active_cred, flags, td)
mtx_lock(&Giant);
KASSERT(uio->uio_td == td, ("uio_td %p is not td %p",
uio->uio_td, td));
- vp = fp->f_data;
+ vp = fp->f_vnode;
if (vp->v_type == VREG)
bwillwrite();
ioflag = IO_UNIT;
@@ -608,7 +608,7 @@ vn_statfile(fp, sb, active_cred, td)
struct ucred *active_cred;
struct thread *td;
{
- struct vnode *vp = fp->f_data;
+ struct vnode *vp = fp->f_vnode;
int error;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
@@ -751,7 +751,7 @@ vn_ioctl(fp, com, data, active_cred, td)
struct ucred *active_cred;
struct thread *td;
{
- struct vnode *vp = fp->f_data;
+ struct vnode *vp = fp->f_vnode;
struct vnode *vpold;
struct vattr vattr;
int error;
@@ -833,7 +833,7 @@ vn_poll(fp, events, active_cred, td)
int error;
#endif
- vp = fp->f_data;
+ vp = fp->f_vnode;
#ifdef MAC
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = mac_check_vnode_poll(active_cred, fp->f_cred, vp);
@@ -901,7 +901,7 @@ vn_closefile(fp, td)
{
fp->f_ops = &badfileops;
- return (vn_close(fp->f_data, fp->f_flag, fp->f_cred, td));
+ return (vn_close(fp->f_vnode, fp->f_flag, fp->f_cred, td));
}
/*
@@ -1052,7 +1052,7 @@ static int
vn_kqfilter(struct file *fp, struct knote *kn)
{
- return (VOP_KQFILTER(fp->f_data, kn));
+ return (VOP_KQFILTER(fp->f_vnode, kn));
}
/*
OpenPOWER on IntegriCloud