Add a "int fd" argument to VOP_OPEN() which in the future will

contain the filedescriptor number on opens from userland.

The index is used rather than a "struct file *" since it conveys a bit
more information, which may be useful to in particular fdescfs and /dev/fd/*

For now pass -1 all over the place.
This commit is contained in:
Poul-Henning Kamp 2003-07-26 07:32:23 +00:00
parent dc539f3ee0
commit a8d43c90af
28 changed files with 43 additions and 42 deletions

View File

@ -127,7 +127,7 @@ coda_fbsd_getpages(v)
if (cfvp == NULL) {
opened_internally = 1;
error = VOP_OPEN(vp, FREAD, cred, p);
error = VOP_OPEN(vp, FREAD, cred, p, -1);
printf("coda_getp: Internally Opening %p\n", vp);
if (error) {

View File

@ -296,7 +296,7 @@ coda_open(v)
cp->c_inode = inode;
/* Open the cache file. */
error = VOP_OPEN(vp, flag, cred, td);
error = VOP_OPEN(vp, flag, cred, td, -1);
if (error) {
printf("coda_open: VOP_OPEN on container failed %d\n", error);
return (error);
@ -467,7 +467,7 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, td)
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
cred, td);
cred, td, -1);
printf("coda_rdwr: Internally Opening %p\n", vp);
if (error) {
printf("coda_rdwr: VOP_OPEN on container failed %d\n", error);
@ -1646,7 +1646,7 @@ coda_readdir(v)
if (cp->c_ovp == NULL) {
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
error = VOP_OPEN(vp, FREAD, cred, td);
error = VOP_OPEN(vp, FREAD, cred, td, -1);
printf("coda_readdir: Internally Opening %p\n", vp);
if (error) {
printf("coda_readdir: VOP_OPEN on container failed %d\n", error);

View File

@ -310,7 +310,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
if (error)
goto cleanup;
#endif
error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1);
if (error)
goto cleanup;

View File

@ -2333,7 +2333,7 @@ rf_find_raid_components()
vref(vp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1);
VOP_UNLOCK(vp, 0, td);
if (error) {
vput(vp);
@ -2364,7 +2364,7 @@ rf_find_raid_components()
vref(vp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1);
VOP_UNLOCK(vp, 0, td);
if (error) {
continue;
@ -2419,7 +2419,7 @@ rf_search_label(dev_t dev, struct disklabel *label, RF_AutoConfig_t **ac_list)
vref(vp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1);
VOP_UNLOCK(vp, 0, td);
if (error) {
/* Whatever... */

View File

@ -154,7 +154,7 @@ iso_mountroot(mp, td)
args.flags = ISOFSMNT_ROOT;
vn_lock(rootvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(rootvp, FREAD, FSCRED, td);
error = VOP_OPEN(rootvp, FREAD, FSCRED, td, -1);
VOP_UNLOCK(rootvp, 0, td);
if (error)
return error;
@ -304,7 +304,7 @@ iso_mountfs(devvp, mp, td, argp)
return (error);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, FREAD, FSCRED, td);
error = VOP_OPEN(devvp, FREAD, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return error;

View File

@ -127,7 +127,7 @@ coda_fbsd_getpages(v)
if (cfvp == NULL) {
opened_internally = 1;
error = VOP_OPEN(vp, FREAD, cred, p);
error = VOP_OPEN(vp, FREAD, cred, p, -1);
printf("coda_getp: Internally Opening %p\n", vp);
if (error) {

View File

@ -296,7 +296,7 @@ coda_open(v)
cp->c_inode = inode;
/* Open the cache file. */
error = VOP_OPEN(vp, flag, cred, td);
error = VOP_OPEN(vp, flag, cred, td, -1);
if (error) {
printf("coda_open: VOP_OPEN on container failed %d\n", error);
return (error);
@ -467,7 +467,7 @@ coda_rdwr(vp, uiop, rw, ioflag, cred, td)
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE),
cred, td);
cred, td, -1);
printf("coda_rdwr: Internally Opening %p\n", vp);
if (error) {
printf("coda_rdwr: VOP_OPEN on container failed %d\n", error);
@ -1646,7 +1646,7 @@ coda_readdir(v)
if (cp->c_ovp == NULL) {
opened_internally = 1;
MARK_INT_GEN(CODA_OPEN_STATS);
error = VOP_OPEN(vp, FREAD, cred, td);
error = VOP_OPEN(vp, FREAD, cred, td, -1);
printf("coda_readdir: Internally Opening %p\n", vp);
if (error) {
printf("coda_readdir: VOP_OPEN on container failed %d\n", error);

View File

@ -243,7 +243,7 @@ hpfs_mountfs(devvp, mp, argsp, td)
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);

View File

@ -324,9 +324,9 @@ mountmsdosfs(devvp, mp, td, argp)
* we don't VOP_OPEN the device again in that case.
*/
#ifdef notyet
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
#else
error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td, -1);
#endif
VOP_UNLOCK(devvp, 0, td);
if (error)

View File

@ -299,7 +299,7 @@ ntfs_mountfs(devvp, mp, argsp, td)
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);

View File

@ -528,7 +528,7 @@ nwfs_putpages(ap)
#ifndef NWFS_RWCACHE
td = curthread; /* XXX */
cred = td->td_ucred; /* XXX */
VOP_OPEN(vp, FWRITE, cred, td);
VOP_OPEN(vp, FWRITE, cred, td, -1);
error = vop_stdputpages(ap);
VOP_CLOSE(vp, FWRITE, cred, td);
return error;
@ -545,7 +545,7 @@ nwfs_putpages(ap)
td = curthread; /* XXX */
cred = td->td_ucred; /* XXX */
/* VOP_OPEN(vp, FWRITE, cred, td);*/
/* VOP_OPEN(vp, FWRITE, cred, td, -1);*/
np = VTONW(vp);
nmp = VFSTONWFS(vp->v_mount);
pages = ap->a_m;

View File

@ -594,7 +594,7 @@ smbfs_putpages(ap)
#ifdef SMBFS_RWGENERIC
td = curthread; /* XXX */
cred = td->td_ucred; /* XXX */
VOP_OPEN(vp, FWRITE, cred, td);
VOP_OPEN(vp, FWRITE, cred, td, -1);
error = vop_stdputpages(ap);
VOP_CLOSE(vp, FWRITE, cred, td);
return error;
@ -612,7 +612,7 @@ smbfs_putpages(ap)
td = curthread; /* XXX */
cred = td->td_ucred; /* XXX */
/* VOP_OPEN(vp, FWRITE, cred, td);*/
/* VOP_OPEN(vp, FWRITE, cred, td, -1);*/
np = VTOSMB(vp);
smp = VFSTOSMBFS(vp->v_mount);
pages = ap->a_m;

View File

@ -380,7 +380,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);
error = VOP_OPEN(vp, FWRITE, ap->a_cred, ap->a_td, -1);
if (!error) {
/* error = smbfs_smb_setfattrNT(np, 0, mtime, atime, &scred);
VOP_GETATTR(vp, &vattr, ap->a_cred, ap->a_td);*/

View File

@ -305,7 +305,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td) {
return (error);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, FREAD, FSCRED, td);
error = VOP_OPEN(devvp, FREAD, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return error;

View File

@ -784,7 +784,7 @@ union_copyup(un, docopy, cred, td)
* from VOP_CLOSE()
*/
vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(lvp, FREAD, cred, td);
error = VOP_OPEN(lvp, FREAD, cred, td, -1);
if (error == 0 && vn_canvmio(lvp) == TRUE)
error = vfs_object_create(lvp, td, cred);
if (error == 0) {
@ -815,7 +815,7 @@ union_copyup(un, docopy, cred, td)
for (i = 0; i < un->un_openl; i++) {
(void) VOP_CLOSE(lvp, FREAD, cred, td);
(void) VOP_OPEN(uvp, FREAD, cred, td);
(void) VOP_OPEN(uvp, FREAD, cred, td, -1);
}
if (un->un_openl) {
if (vn_canvmio(uvp) == TRUE)
@ -1130,7 +1130,7 @@ union_vn_create(vpp, un, td)
if (error)
return (error);
error = VOP_OPEN(vp, fmode, cred, td);
error = VOP_OPEN(vp, fmode, cred, td, -1);
if (error == 0 && vn_canvmio(vp) == TRUE)
error = vfs_object_create(vp, td, cred);
if (error) {
@ -1340,7 +1340,7 @@ union_dircheck(struct thread *td, struct vnode **vp, struct file *fp)
}
if (lvp != NULLVP) {
error = VOP_OPEN(lvp, FREAD, fp->f_cred, td);
error = VOP_OPEN(lvp, FREAD, fp->f_cred, td, -1);
if (error == 0 && vn_canvmio(lvp) == TRUE)
error = vfs_object_create(lvp, td, fp->f_cred);
if (error) {

View File

@ -776,7 +776,7 @@ union_open(ap)
*/
if (error == 0)
error = VOP_OPEN(tvp, mode, cred, td);
error = VOP_OPEN(tvp, mode, cred, td, -1);
/*
* This is absolutely necessary or UFS will blow up.

View File

@ -649,7 +649,7 @@ ext2_mountfs(devvp, mp, td)
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);

View File

@ -649,7 +649,7 @@ ext2_mountfs(devvp, mp, td)
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);

View File

@ -200,7 +200,7 @@ coff_load_file(struct thread *td, char *name)
if ((error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td)) != 0)
goto fail;
if ((error = VOP_OPEN(vp, FREAD, td->td_ucred, td)) != 0)
if ((error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1)) != 0)
goto fail;
/*

View File

@ -154,7 +154,7 @@ iso_mountroot(mp, td)
args.flags = ISOFSMNT_ROOT;
vn_lock(rootvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(rootvp, FREAD, FSCRED, td);
error = VOP_OPEN(rootvp, FREAD, FSCRED, td, -1);
VOP_UNLOCK(rootvp, 0, td);
if (error)
return error;
@ -304,7 +304,7 @@ iso_mountfs(devvp, mp, td, argp)
return (error);
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_OPEN(devvp, FREAD, FSCRED, td);
error = VOP_OPEN(devvp, FREAD, FSCRED, td, -1);
VOP_UNLOCK(devvp, 0, td);
if (error)
return error;

View File

@ -1142,7 +1142,7 @@ exec_check_permissions(imgp)
* Call filesystem specific open routine (which does nothing in the
* general case).
*/
error = VOP_OPEN(vp, FREAD, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1);
return (error);
}

View File

@ -3621,7 +3621,7 @@ fhopen(td, uap)
if (error)
goto bad;
}
error = VOP_OPEN(vp, fmode, td->td_ucred, td);
error = VOP_OPEN(vp, fmode, td->td_ucred, td, -1);
if (error)
goto bad;
/*

View File

@ -3621,7 +3621,7 @@ fhopen(td, uap)
if (error)
goto bad;
}
error = VOP_OPEN(vp, fmode, td->td_ucred, td);
error = VOP_OPEN(vp, fmode, td->td_ucred, td, -1);
if (error)
goto bad;
/*

View File

@ -234,7 +234,7 @@ vn_open_cred(ndp, flagp, cmode, cred)
vp->v_cachedfs = vap->va_fsid;
vp->v_cachedid = vap->va_fileid;
}
if ((error = VOP_OPEN(vp, fmode, cred, td)) != 0)
if ((error = VOP_OPEN(vp, fmode, cred, td, -1)) != 0)
goto bad;
/*
* Make sure that a VM object is created for VMIO support.

View File

@ -135,6 +135,7 @@ vop_open {
IN int mode;
IN struct ucred *cred;
IN struct thread *td;
IN int fd;
};
#

View File

@ -610,9 +610,9 @@ ffs_mountfs(devvp, mp, td)
* XXX: start to avoid getting trashed later on.
*/
#ifdef notyet
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
#else
error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td);
error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td, -1);
#endif
VOP_UNLOCK(devvp, 0, td);
if (error)

View File

@ -324,7 +324,7 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
{
int error;
error = VOP_OPEN(vp, FREAD|FWRITE, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD|FWRITE, td->td_ucred, td, -1);
if (error) {
printf("ufs_extattr_enable_with_open.VOP_OPEN(): failed "
"with %d\n", error);

View File

@ -2493,7 +2493,7 @@ swaponvp(td, vp, dev, nblks)
error = mac_check_system_swapon(td->td_ucred, vp);
if (error == 0)
#endif
error = VOP_OPEN(vp, FREAD | FWRITE, td->td_ucred, td);
error = VOP_OPEN(vp, FREAD | FWRITE, td->td_ucred, td, -1);
(void) VOP_UNLOCK(vp, 0, td);
if (error)
return (error);