summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2007-05-31 11:51:53 +0000
committerkib <kib@FreeBSD.org>2007-05-31 11:51:53 +0000
commitf13486a2227b9165fce30aa40d12b728f327a909 (patch)
treed5e88e86417c996e0e901ce9a43de8d9ae3ad44e /sys/fs
parent7f276f0bff169823b786ea0a9bbdfe936361fcb4 (diff)
downloadFreeBSD-src-f13486a2227b9165fce30aa40d12b728f327a909.zip
FreeBSD-src-f13486a2227b9165fce30aa40d12b728f327a909.tar.gz
Revert UF_OPENING workaround for CURRENT.
Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation argument from being file descriptor index into the pointer to struct file. Proposed and reviewed by: jhb Reviewed by: daichi (unionfs) Approved by: re (kensmith)
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/coda/coda_vnops.c6
-rw-r--r--sys/fs/devfs/devfs_vnops.c19
-rw-r--r--sys/fs/fifofs/fifo_vnops.c7
-rw-r--r--sys/fs/smbfs/smbfs_vnops.c2
-rw-r--r--sys/fs/unionfs/union.h1
-rw-r--r--sys/fs/unionfs/union_subr.c6
-rw-r--r--sys/fs/unionfs/union_vnops.c8
7 files changed, 20 insertions, 29 deletions
diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c
index d1072da..d0b5c60 100644
--- a/sys/fs/coda/coda_vnops.c
+++ b/sys/fs/coda/coda_vnops.c
@@ -257,7 +257,7 @@ coda_open(struct vop_open_args *ap)
cp->c_inode = inode;
/* Open the cache file. */
- error = VOP_OPEN(vp, flag, cred, td, -1);
+ error = VOP_OPEN(vp, flag, cred, td, NULL);
if (error) {
printf("coda_open: VOP_OPEN on container failed %d\n", error);
return (error);
@@ -410,7 +410,7 @@ coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag,
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
- cred, td, -1);
+ cred, td, NULL);
printf("coda_rdwr: Internally Opening %p\n", vp);
if (error) {
printf("coda_rdwr: VOP_OPEN on container failed %d\n", error);
@@ -1525,7 +1525,7 @@ coda_readdir(struct vop_readdir_args *ap)
if (cp->c_ovp == NULL) {
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
- error = VOP_OPEN(vp, FREAD, cred, td, -1);
+ error = VOP_OPEN(vp, FREAD, cred, td, NULL);
printf("coda_readdir: Internally Opening %p\n", vp);
if (error) {
printf("coda_readdir: VOP_OPEN on container failed %d\n", error);
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 4f7cda2..d6c3232 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -734,7 +734,7 @@ devfs_open(struct vop_open_args *ap)
struct thread *td = ap->a_td;
struct vnode *vp = ap->a_vp;
struct cdev *dev = vp->v_rdev;
- struct file *fp;
+ struct file *fp = ap->a_fp;
int error;
struct cdevsw *dsw;
@@ -761,13 +761,13 @@ devfs_open(struct vop_open_args *ap)
if(!(dsw->d_flags & D_NEEDGIANT)) {
DROP_GIANT();
if (dsw->d_fdopen != NULL)
- error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx);
+ error = dsw->d_fdopen(dev, ap->a_mode, td, fp);
else
error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td);
PICKUP_GIANT();
} else {
if (dsw->d_fdopen != NULL)
- error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx);
+ error = dsw->d_fdopen(dev, ap->a_mode, td, fp);
else
error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td);
}
@@ -780,19 +780,12 @@ devfs_open(struct vop_open_args *ap)
return (error);
#if 0 /* /dev/console */
- KASSERT(ap->a_fdidx >= 0,
- ("Could not vnode bypass device on fd %d", ap->a_fdidx));
+ KASSERT(fp != NULL,
+ ("Could not vnode bypass device on NULL fp"));
#else
- if(ap->a_fdidx < 0)
+ if(fp == NULL)
return (error);
#endif
- /*
- * This is a pretty disgustingly long chain, but I am not
- * sure there is any better way. Passing the fdidx into
- * VOP_OPEN() offers us more information than just passing
- * the file *.
- */
- fp = ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx];
FILE_LOCK(fp);
KASSERT(fp->f_ops == &badfileops,
("Could not vnode bypass device on fdops %p", fp->f_ops));
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index 0c13c46..7161591 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -175,12 +175,12 @@ fifo_open(ap)
struct fifoinfo *fip;
struct thread *td = ap->a_td;
struct ucred *cred = ap->a_cred;
+ struct file *fp = ap->a_fp;
struct socket *rso, *wso;
- struct file *fp;
int error;
ASSERT_VOP_LOCKED(vp, "fifo_open");
- if (ap->a_fdidx < 0)
+ if (fp == NULL)
return (EINVAL);
if ((fip = vp->v_fifoinfo) == NULL) {
MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
@@ -293,8 +293,7 @@ fail1:
}
}
mtx_unlock(&fifo_mtx);
- KASSERT(ap->a_fdidx >= 0, ("can't fifo/vnode bypass %d", ap->a_fdidx));
- fp = ap->a_td->td_proc->p_fd->fd_ofiles[ap->a_fdidx];
+ KASSERT(fp != NULL, ("can't fifo/vnode bypass"));
FILE_LOCK(fp);
KASSERT(fp->f_ops == &badfileops, ("not badfileops in fifo_open"));
fp->f_data = fip;
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c
index bfac2aa..4c84e00 100644
--- a/sys/fs/smbfs/smbfs_vnops.c
+++ b/sys/fs/smbfs/smbfs_vnops.c
@@ -385,7 +385,7 @@ smbfs_setattr(ap)
*/
if ((np->n_flag & NOPEN) == 0) {
if (vcp->vc_flags & SMBV_WIN95) {
- error = VOP_OPEN(vp, FWRITE, ap->a_cred, ap->a_td, -1);
+ error = VOP_OPEN(vp, FWRITE, ap->a_cred, ap->a_td, NULL);
if (!error) {
/* error = smbfs_smb_setfattrNT(np, 0, mtime, atime, &scred);
VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);*/
diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h
index f35e1bb..e2df553 100644
--- a/sys/fs/unionfs/union.h
+++ b/sys/fs/unionfs/union.h
@@ -64,7 +64,6 @@ struct unionfs_node_status {
int uns_lower_opencnt; /* open count of lower */
int uns_upper_opencnt; /* open count of upper */
int uns_lower_openmode; /* open mode of lower */
- int uns_lower_fdidx; /* open fdidx of lower */
int uns_readdir_status; /* read status of readdir */
};
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index 4f66fb3..887ef70 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -913,7 +913,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
if ((error = VOP_CREATE(udvp, &vp, &cn, uvap)) != 0)
goto unionfs_vn_create_on_upper_free_out1;
- if ((error = VOP_OPEN(vp, fmode, cred, td, -1)) != 0) {
+ if ((error = VOP_OPEN(vp, fmode, cred, td, NULL)) != 0) {
vput(vp);
goto unionfs_vn_create_on_upper_free_out1;
}
@@ -1049,7 +1049,7 @@ unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred,
}
if (docopy != 0) {
- error = VOP_OPEN(lvp, FREAD, cred, td, -1);
+ error = VOP_OPEN(lvp, FREAD, cred, td, NULL);
if (error == 0) {
error = unionfs_copyfile_core(lvp, uvp, cred, td);
VOP_CLOSE(lvp, FREAD, cred, td);
@@ -1110,7 +1110,7 @@ unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td)
return (0);
/* open vnode */
- if ((error = VOP_OPEN(vp, FREAD, cred, td, -1)) != 0)
+ if ((error = VOP_OPEN(vp, FREAD, cred, td, NULL)) != 0)
return (error);
uio.uio_rw = UIO_READ;
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 134fe1c..fbce59d 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -475,13 +475,13 @@ unionfs_open(struct vop_open_args *ap)
targetvp = uvp;
}
- error = VOP_OPEN(targetvp, ap->a_mode, cred, td, ap->a_fdidx);
+ error = VOP_OPEN(targetvp, ap->a_mode, cred, td, ap->a_fp);
if (error == 0) {
if (targetvp == uvp) {
if (uvp->v_type == VDIR && lvp != NULLVP &&
unsp->uns_lower_opencnt <= 0) {
/* open lower for readdir */
- error = VOP_OPEN(lvp, FREAD, cred, td, -1);
+ error = VOP_OPEN(lvp, FREAD, cred, td, NULL);
if (error != 0) {
VOP_CLOSE(uvp, ap->a_mode, cred, td);
goto unionfs_open_abort;
@@ -493,7 +493,6 @@ unionfs_open(struct vop_open_args *ap)
} else {
unsp->uns_lower_opencnt++;
unsp->uns_lower_openmode = ap->a_mode;
- unsp->uns_lower_fdidx = ap->a_fdidx;
}
ap->a_vp->v_object = targetvp->v_object;
}
@@ -1852,7 +1851,8 @@ unionfs_advlock(struct vop_advlock_args *ap)
unionfs_get_node_status(unp, td, &unsp);
if (unsp->uns_lower_opencnt > 0) {
/* try reopen the vnode */
- error = VOP_OPEN(uvp, unsp->uns_lower_openmode, td->td_ucred, td, unsp->uns_lower_fdidx);
+ error = VOP_OPEN(uvp, unsp->uns_lower_openmode,
+ td->td_ucred, td, NULL);
if (error)
goto unionfs_advlock_abort;
unsp->uns_upper_opencnt++;
OpenPOWER on IntegriCloud