diff options
Diffstat (limited to 'sys/fs')
28 files changed, 228 insertions, 224 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 95a9a23..b4c65e1 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -95,7 +95,7 @@ static int iso_mountfs(struct vnode *devvp, struct mount *mp); */ static int -cd9660_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +cd9660_cmount(struct mntarg *ma, void *data, int flags) { struct iso_args args; int error; @@ -123,15 +123,18 @@ cd9660_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) } static int -cd9660_mount(struct mount *mp, struct thread *td) +cd9660_mount(struct mount *mp) { struct vnode *devvp; + struct thread *td; char *fspec; int error; accmode_t accmode; struct nameidata ndp; struct iso_mnt *imp = 0; + td = curthread; + /* * Unconditionally mount as read-only. */ @@ -490,17 +493,16 @@ out: * unmount system call */ static int -cd9660_unmount(mp, mntflags, td) +cd9660_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct iso_mnt *isomp; int error, flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - if ((error = vflush(mp, 0, flags, td))) + if ((error = vflush(mp, 0, flags, curthread))) return (error); isomp = VFSTOISOFS(mp); @@ -530,11 +532,10 @@ cd9660_unmount(mp, mntflags, td) * Return root of a filesystem */ static int -cd9660_root(mp, flags, vpp, td) +cd9660_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct iso_mnt *imp = VFSTOISOFS(mp); struct iso_directory_record *dp = @@ -553,10 +554,9 @@ cd9660_root(mp, flags, vpp, td) * Get filesystem statistics. */ static int -cd9660_statfs(mp, sbp, td) +cd9660_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { struct iso_mnt *isomp; diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 5ce6499..b12c43b 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -106,7 +106,7 @@ static const char *coda_opts[] = { "from", NULL }; */ /*ARGSUSED*/ int -coda_mount(struct mount *vfsp, struct thread *td) +coda_mount(struct mount *vfsp) { struct vnode *dvp; struct cnode *cp; @@ -136,7 +136,7 @@ coda_mount(struct mount *vfsp, struct thread *td) /* * Validate mount device. Similar to getmdev(). */ - NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, td); + NDINIT(&ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, from, curthread); error = namei(&ndp); dvp = ndp.ni_vp; if (error) { @@ -206,7 +206,7 @@ coda_mount(struct mount *vfsp, struct thread *td) } int -coda_unmount(struct mount *vfsp, int mntflags, struct thread *td) +coda_unmount(struct mount *vfsp, int mntflags) { struct coda_mntinfo *mi = vftomi(vfsp); int active, error = 0; @@ -232,7 +232,7 @@ coda_unmount(struct mount *vfsp, int mntflags, struct thread *td) vrele(coda_ctlvp); coda_ctlvp = NULL; active = coda_kill(vfsp, NOT_DOWNCALL); - error = vflush(mi->mi_vfsp, 0, FORCECLOSE, td); + error = vflush(mi->mi_vfsp, 0, FORCECLOSE, curthread); #ifdef CODA_VERBOSE printf("coda_unmount: active = %d, vflush active %d\n", active, error); @@ -262,15 +262,17 @@ coda_unmount(struct mount *vfsp, int mntflags, struct thread *td) * Find root of cfs. */ int -coda_root(struct mount *vfsp, int flags, struct vnode **vpp, - struct thread *td) +coda_root(struct mount *vfsp, int flags, struct vnode **vpp) { struct coda_mntinfo *mi = vftomi(vfsp); int error; - struct proc *p = td->td_proc; + struct proc *p; + struct thread *td; CodaFid VFid; static const CodaFid invalfid = INVAL_FID; + td = curthread; + p = td->td_proc; ENTRY; MARK_ENTRY(CODA_ROOT_STATS); if (vfsp == mi->mi_vfsp) { @@ -345,7 +347,7 @@ coda_root(struct mount *vfsp, int flags, struct vnode **vpp, * Get filesystem statistics. */ int -coda_statfs(struct mount *vfsp, struct statfs *sbp, struct thread *td) +coda_statfs(struct mount *vfsp, struct statfs *sbp) { ENTRY; @@ -377,7 +379,7 @@ coda_statfs(struct mount *vfsp, struct statfs *sbp, struct thread *td) * Flush any pending I/O. */ int -coda_sync(struct mount *vfsp, int waitfor, struct thread *td) +coda_sync(struct mount *vfsp, int waitfor) { ENTRY; diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h index 1050ba5..524bec8 100644 --- a/sys/fs/devfs/devfs.h +++ b/sys/fs/devfs/devfs.h @@ -172,7 +172,8 @@ extern unsigned devfs_rule_depth; void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de); void devfs_rules_cleanup (struct devfs_mount *dm); int devfs_rules_ioctl(struct devfs_mount *dm, u_long cmd, caddr_t data, struct thread *td); -int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); +int devfs_allocv (struct devfs_dirent *de, struct mount *mp, + struct vnode **vpp); void devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int vp_locked); void devfs_dirent_free(struct devfs_dirent *de); void devfs_populate (struct devfs_mount *dm); diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 9a9bc38..ff86e36 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -60,7 +60,7 @@ static vfs_statfs_t devfs_statfs; * Mount the filesystem */ static int -devfs_mount(struct mount *mp, struct thread *td) +devfs_mount(struct mount *mp) { int error; struct devfs_mount *fmp; @@ -92,7 +92,7 @@ devfs_mount(struct mount *mp, struct thread *td) fmp->dm_rootdir = devfs_vmkdir(fmp, NULL, 0, NULL, DEVFS_ROOTINO); - error = devfs_root(mp, LK_EXCLUSIVE, &rvp, td); + error = devfs_root(mp, LK_EXCLUSIVE, &rvp); if (error) { sx_destroy(&fmp->dm_lock); free_unr(devfs_unr, fmp->dm_idx); @@ -115,7 +115,7 @@ devfs_unmount_final(struct devfs_mount *fmp) } static int -devfs_unmount(struct mount *mp, int mntflags, struct thread *td) +devfs_unmount(struct mount *mp, int mntflags) { int error; int flags = 0; @@ -127,7 +127,7 @@ devfs_unmount(struct mount *mp, int mntflags, struct thread *td) KASSERT(fmp->dm_mount != NULL, ("devfs_unmount unmounted devfs_mount")); /* There is 1 extra root vnode reference from devfs_mount(). */ - error = vflush(mp, 1, flags, td); + error = vflush(mp, 1, flags, curthread); if (error) return (error); sx_xlock(&fmp->dm_lock); @@ -147,7 +147,7 @@ devfs_unmount(struct mount *mp, int mntflags, struct thread *td) /* Return locked reference to root. */ static int -devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +devfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; struct vnode *vp; @@ -155,7 +155,7 @@ devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) dmp = VFSTODEVFS(mp); sx_xlock(&dmp->dm_lock); - error = devfs_allocv(dmp->dm_rootdir, mp, &vp, td); + error = devfs_allocv(dmp->dm_rootdir, mp, &vp); if (error) return (error); vp->v_vflag |= VV_ROOT; @@ -164,7 +164,7 @@ devfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) } static int -devfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +devfs_statfs(struct mount *mp, struct statfs *sbp) { sbp->f_flags = 0; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 215f943..ece9559 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -330,14 +330,13 @@ devfs_insmntque_dtr(struct vnode *vp, void *arg) * it on return. */ int -devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td) +devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp) { int error; struct vnode *vp; struct cdev *dev; struct devfs_mount *dmp; - KASSERT(td == curthread, ("devfs_allocv: td != curthread")); dmp = VFSTODEVFS(mp); if (de->de_flags & DE_DOOMED) { sx_xunlock(&dmp->dm_lock); @@ -351,7 +350,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, stru VI_LOCK(vp); mtx_unlock(&devfs_de_interlock); sx_xunlock(&dmp->dm_lock); - error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, td); + error = vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread); sx_xlock(&dmp->dm_lock); if (devfs_allocv_drop_refs(0, dmp, de)) { if (error == 0) @@ -761,7 +760,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock) de = TAILQ_FIRST(&dd->de_dlist); /* "." */ de = TAILQ_NEXT(de, de_list); /* ".." */ de = de->de_dir; - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); *dm_unlock = 0; vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); return (error); @@ -844,7 +843,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock) return (0); } } - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); *dm_unlock = 0; return (error); } @@ -870,7 +869,6 @@ devfs_mknod(struct vop_mknod_args *ap) { struct componentname *cnp; struct vnode *dvp, **vpp; - struct thread *td; struct devfs_dirent *dd, *de; struct devfs_mount *dmp; int error; @@ -886,7 +884,6 @@ devfs_mknod(struct vop_mknod_args *ap) cnp = ap->a_cnp; vpp = ap->a_vpp; - td = cnp->cn_thread; dd = dvp->v_data; error = ENOENT; @@ -904,7 +901,7 @@ devfs_mknod(struct vop_mknod_args *ap) if (de == NULL) goto notfound; de->de_flags &= ~DE_WHITEOUT; - error = devfs_allocv(de, dvp->v_mount, vpp, td); + error = devfs_allocv(de, dvp->v_mount, vpp); return (error); notfound: sx_xunlock(&dmp->dm_lock); @@ -1427,12 +1424,8 @@ devfs_symlink(struct vop_symlink_args *ap) struct devfs_dirent *dd; struct devfs_dirent *de; struct devfs_mount *dmp; - struct thread *td; - - td = ap->a_cnp->cn_thread; - KASSERT(td == curthread, ("devfs_symlink: td != curthread")); - error = priv_check(td, PRIV_DEVFS_SYMLINK); + error = priv_check(curthread, PRIV_DEVFS_SYMLINK); if (error) return(error); dmp = VFSTODEVFS(ap->a_dvp->v_mount); @@ -1451,7 +1444,7 @@ devfs_symlink(struct vop_symlink_args *ap) mac_devfs_create_symlink(ap->a_cnp->cn_cred, dmp->dm_mount, dd, de); #endif TAILQ_INSERT_TAIL(&dd->de_dlist, de, de_list); - return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp, td)); + return (devfs_allocv(de, ap->a_dvp->v_mount, ap->a_vpp)); } static int diff --git a/sys/fs/fdescfs/fdesc.h b/sys/fs/fdescfs/fdesc.h index 06f53fb..477193a 100644 --- a/sys/fs/fdescfs/fdesc.h +++ b/sys/fs/fdescfs/fdesc.h @@ -65,5 +65,5 @@ extern struct mtx fdesc_hashmtx; extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, - struct vnode **, struct thread *); + struct vnode **); #endif /* _KERNEL */ diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 9651313..fdbcaba 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -64,7 +64,7 @@ static vfs_root_t fdesc_root; * Compatibility shim for old mount(2) system call. */ int -fdesc_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +fdesc_cmount(struct mntarg *ma, void *data, int flags) { return kernel_mount(ma, flags); } @@ -73,7 +73,7 @@ fdesc_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) * Mount the per-process file descriptors (/dev/fd) */ static int -fdesc_mount(struct mount *mp, struct thread *td) +fdesc_mount(struct mount *mp) { int error = 0; struct fdescmount *fmp; @@ -94,7 +94,7 @@ fdesc_mount(struct mount *mp, struct thread *td) */ mp->mnt_data = (qaddr_t) fmp; fmp->flags = 0; - error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp, td); + error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); if (error) { free(fmp, M_FDESCMNT); mp->mnt_data = 0; @@ -116,10 +116,9 @@ fdesc_mount(struct mount *mp, struct thread *td) } static int -fdesc_unmount(mp, mntflags, td) +fdesc_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct fdescmount *fmp; caddr_t data; @@ -143,7 +142,7 @@ fdesc_unmount(mp, mntflags, td) * There is 1 extra root vnode reference corresponding * to f_root. */ - if ((error = vflush(mp, 1, flags, td)) != 0) + if ((error = vflush(mp, 1, flags, curthread)) != 0) return (error); /* @@ -160,11 +159,10 @@ fdesc_unmount(mp, mntflags, td) } static int -fdesc_root(mp, flags, vpp, td) +fdesc_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *vp; @@ -172,23 +170,25 @@ fdesc_root(mp, flags, vpp, td) * Return locked reference to root. */ vp = VFSTOFDESC(mp)->f_root; - vget(vp, LK_EXCLUSIVE | LK_RETRY, td); + vget(vp, LK_EXCLUSIVE | LK_RETRY, curthread); *vpp = vp; return (0); } static int -fdesc_statfs(mp, sbp, td) +fdesc_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { + struct thread *td; struct filedesc *fdp; int lim; int i; int last; int freefd; + td = curthread; + /* * Compute number of free file descriptors. * [ Strange results will ensue if the open file diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index d1788ae..9857d93 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -145,20 +145,21 @@ fdesc_remove_entry(struct fdescnode *fd) } int -fdesc_allocvp(ftype, fd_fd, ix, mp, vpp, td) +fdesc_allocvp(ftype, fd_fd, ix, mp, vpp) fdntype ftype; unsigned fd_fd; int ix; struct mount *mp; struct vnode **vpp; - struct thread *td; { struct fdescmount *fmp; struct fdhashhead *fc; struct fdescnode *fd, *fd2; struct vnode *vp, *vp2; + struct thread *td; int error = 0; + td = curthread; fc = FD_NHASH(ix); loop: mtx_lock(&fdesc_hashmtx); @@ -328,7 +329,7 @@ fdesc_lookup(ap) vhold(dvp); VOP_UNLOCK(dvp, 0); error = fdesc_allocvp(Fdesc, fd, FD_DESC + fd, dvp->v_mount, - &fvp, td); + &fvp); fdrop(fp, td); /* * The root vnode must be locked last to prevent deadlock condition. diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index a20614b..9aa95ff 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -73,8 +73,7 @@ static int hpfs_cmount ( struct mntarg *ma, void *data, - int flags, - struct thread *td ) + int flags) { struct hpfs_args args; int error; @@ -103,16 +102,16 @@ static const char *hpfs_opts[] = { }; static int -hpfs_mount ( - struct mount *mp, - struct thread *td ) +hpfs_mount (struct mount *mp) { int err = 0, error; struct vnode *devvp; + struct thread *td; struct nameidata ndp; struct export_args export; char *from; + td = curthread; dprintf(("hpfs_omount():\n")); /* *** @@ -299,7 +298,7 @@ hpfs_mountfs(devvp, mp, td) goto failed; } - error = hpfs_root(mp, LK_EXCLUSIVE, &vp, td); + error = hpfs_root(mp, LK_EXCLUSIVE, &vp); if (error) { hpfs_cpdeinit(hpmp); hpfs_bmdeinit(hpmp); @@ -331,8 +330,7 @@ failed: static int hpfs_unmount( struct mount *mp, - int mntflags, - struct thread *td) + int mntflags) { int error, flags; register struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -345,7 +343,7 @@ hpfs_unmount( dprintf(("hpfs_unmount: vflushing...\n")); - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error) { printf("hpfs_unmount: vflush failed: %d\n",error); return (error); @@ -375,8 +373,7 @@ static int hpfs_root( struct mount *mp, int flags, - struct vnode **vpp, - struct thread *td ) + struct vnode **vpp) { int error = 0; struct hpfsmount *hpmp = VFSTOHPFS(mp); @@ -394,8 +391,7 @@ hpfs_root( static int hpfs_statfs( struct mount *mp, - struct statfs *sbp, - struct thread *td) + struct statfs *sbp) { struct hpfsmount *hpmp = VFSTOHPFS(mp); diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 2da25a7..8186763 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -184,7 +184,7 @@ update_mp(struct mount *mp, struct thread *td) pmp->pm_flags |= MSDOSFSMNT_LONGNAME; else { if ((error = - msdosfs_root(mp, LK_EXCLUSIVE, &rootvp, td)) != 0) + msdosfs_root(mp, LK_EXCLUSIVE, &rootvp)) != 0) return error; pmp->pm_flags |= findwin95(VTODE(rootvp)) ? MSDOSFSMNT_LONGNAME : MSDOSFSMNT_SHORTNAME; @@ -195,7 +195,7 @@ update_mp(struct mount *mp, struct thread *td) } static int -msdosfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +msdosfs_cmount(struct mntarg *ma, void *data, int flags) { struct msdosfs_args args; int error; @@ -233,9 +233,10 @@ msdosfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) * special file to treat as a filesystem. */ static int -msdosfs_mount(struct mount *mp, struct thread *td) +msdosfs_mount(struct mount *mp) { struct vnode *devvp; /* vnode for blk device to mount */ + struct thread *td; /* msdosfs specific mount control block */ struct msdosfsmount *pmp = NULL; struct nameidata ndp; @@ -243,6 +244,7 @@ msdosfs_mount(struct mount *mp, struct thread *td) accmode_t accmode; char *from; + td = curthread; if (vfs_filteropt(mp->mnt_optnew, msdosfs_opts)) return (EINVAL); @@ -265,7 +267,7 @@ msdosfs_mount(struct mount *mp, struct thread *td) } if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) && vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { - error = VFS_SYNC(mp, MNT_WAIT, td); + error = VFS_SYNC(mp, MNT_WAIT); if (error) return (error); flags = WRITECLOSE; @@ -392,7 +394,7 @@ msdosfs_mount(struct mount *mp, struct thread *td) error = update_mp(mp, td); if (error) { if ((mp->mnt_flag & MNT_UPDATE) == 0) - msdosfs_unmount(mp, MNT_FORCE, td); + msdosfs_unmount(mp, MNT_FORCE); return error; } @@ -774,7 +776,7 @@ error_exit: * Unmount the filesystem described by mp. */ static int -msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) +msdosfs_unmount(struct mount *mp, int mntflags) { struct msdosfsmount *pmp; int error, flags; @@ -782,7 +784,7 @@ msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error && error != ENXIO) return error; pmp = VFSTOMSDOSFS(mp); @@ -844,7 +846,7 @@ msdosfs_unmount(struct mount *mp, int mntflags, struct thread *td) } static int -msdosfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +msdosfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); struct denode *ndep; @@ -861,7 +863,7 @@ msdosfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) } static int -msdosfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +msdosfs_statfs(struct mount *mp, struct statfs *sbp) { struct msdosfsmount *pmp; @@ -877,13 +879,16 @@ msdosfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) } static int -msdosfs_sync(struct mount *mp, int waitfor, struct thread *td) +msdosfs_sync(struct mount *mp, int waitfor) { struct vnode *vp, *nvp; + struct thread *td; struct denode *dep; struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); int error, allerror = 0; + td = curthread; + /* * If we ever switch to not updating all of the fats all the time, * this would be the place to update them from the first one. diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index bb19902..a398a72 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -1446,7 +1446,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bhardlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1475,7 +1475,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bsoftlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1501,7 +1501,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA, - USRQUOTA), cred->cr_uid, (caddr_t)&dqb, p)) + USRQUOTA), cred->cr_uid, (caddr_t)&dqb)) freenum = dqb.dqb_curblocks; p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -1943,7 +1943,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, vnode_t vp, NFSACL_T *saclp, * Get the VFS_STATFS(), since some attributes need them. */ if (NFSISSETSTATFS_ATTRBIT(retbitp)) { - error = VFS_STATFS(vnode_mount(vp), &fs, p); + error = VFS_STATFS(vnode_mount(vp), &fs); if (error != 0) { if (reterr) { nd->nd_repstat = NFSERR_ACCES; @@ -2138,7 +2138,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, vnode_t vp, NFSACL_T *saclp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_isoftlimit-dqb.dqb_curinodes, freenum); p->p_cred->p_ruid = savuid; @@ -2245,7 +2245,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, vnode_t vp, NFSACL_T *saclp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bhardlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -2269,7 +2269,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, vnode_t vp, NFSACL_T *saclp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = min(dqb.dqb_bsoftlimit, freenum); p->p_cred->p_ruid = savuid; #endif /* QUOTA */ @@ -2290,7 +2290,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, vnode_t vp, NFSACL_T *saclp, savuid = p->p_cred->p_ruid; p->p_cred->p_ruid = cred->cr_uid; if (!VFS_QUOTACTL(vnode_mount(vp),QCMD(Q_GETQUOTA,USRQUOTA), - cred->cr_uid, (caddr_t)&dqb, p)) + cred->cr_uid, (caddr_t)&dqb)) freenum = dqb.dqb_curblocks; p->p_cred->p_ruid = savuid; #endif /* QUOTA */ diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 64b1e90..b41e0a6 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -558,7 +558,7 @@ int nfsvno_rename(struct nameidata *, struct nameidata *, u_int32_t, int nfsvno_link(struct nameidata *, vnode_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *); int nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *); -int nfsvno_statfs(vnode_t, struct statfs *, struct ucred *, NFSPROC_T *); +int nfsvno_statfs(vnode_t, struct statfs *); void nfsvno_getfs(struct nfsfsinfo *, int); void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t, nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, u_char *, diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c index 1ceba85..66ea55b 100644 --- a/sys/fs/nfsclient/nfs_clvfsops.c +++ b/sys/fs/nfsclient/nfs_clvfsops.c @@ -244,9 +244,10 @@ nfs_convert_diskless(void) * nfs statfs call */ static int -nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +nfs_statfs(struct mount *mp, struct statfs *sbp) { struct vnode *vp; + struct thread *td; struct nfsmount *nmp = VFSTONFS(mp); struct nfsvattr nfsva; struct nfsfsinfo fs; @@ -254,6 +255,8 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) int error = 0, attrflag, gotfsinfo = 0, ret; struct nfsnode *np; + td = curthread; + error = vfs_busy(mp, MBF_NOWAIT); if (error) return (error); @@ -659,7 +662,7 @@ static const char *nfs_opts[] = { "from", "nfs_args", */ /* ARGSUSED */ static int -nfs_mount(struct mount *mp, struct thread *td) +nfs_mount(struct mount *mp) { struct nfs_args args = { .version = NFS_ARGSVERSION, @@ -689,6 +692,7 @@ nfs_mount(struct mount *mp, struct thread *td) int error; struct sockaddr *nam; struct vnode *vp; + struct thread *td; char hst[MNAMELEN]; size_t len; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; @@ -698,6 +702,7 @@ nfs_mount(struct mount *mp, struct thread *td) goto out; } + td = curthread; if ((mp->mnt_flag & (MNT_ROOTFS | MNT_UPDATE)) == MNT_ROOTFS) { error = ncl_mountroot(mp, td); goto out; @@ -835,7 +840,7 @@ out: */ /* ARGSUSED */ static int -nfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +nfs_cmount(struct mntarg *ma, void *data, int flags) { int error; struct nfs_args args; @@ -1069,11 +1074,14 @@ bad: * unmount system call */ static int -nfs_unmount(struct mount *mp, int mntflags, struct thread *td) +nfs_unmount(struct mount *mp, int mntflags) { + struct thread *td; struct nfsmount *nmp; int error, flags = 0, trycnt = 0; + td = curthread; + if (mntflags & MNT_FORCE) flags |= FORCECLOSE; nmp = VFSTONFS(mp); @@ -1120,7 +1128,7 @@ out: * Return root of a filesystem */ static int -nfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +nfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct vnode *vp; struct nfsmount *nmp; @@ -1153,11 +1161,14 @@ nfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) */ /* ARGSUSED */ static int -nfs_sync(struct mount *mp, int waitfor, struct thread *td) +nfs_sync(struct mount *mp, int waitfor) { struct vnode *vp, *mvp; + struct thread *td; int error, allerror = 0; + td = curthread; + /* * Force stale buffer cache information to be flushed. */ diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 09a1d73..5dbb21d 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -1257,13 +1257,10 @@ nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred, * Statfs vnode op. */ int -nfsvno_statfs(struct vnode *vp, struct statfs *sf, struct ucred *cred, - struct thread *p) +nfsvno_statfs(struct vnode *vp, struct statfs *sf) { - int error; - error = VFS_STATFS(vp->v_mount, sf, p); - return (error); + return (VFS_STATFS(vp->v_mount, sf)); } /* diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 141a614..61c646c 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -1907,7 +1907,7 @@ nfsrvd_statfs(struct nfsrv_descript *nd, __unused int isdgram, return (0); } sf = &sfs; - nd->nd_repstat = nfsvno_statfs(vp, sf, nd->nd_cred, p); + nd->nd_repstat = nfsvno_statfs(vp, sf); getret = nfsvno_getattr(vp, &at, nd->nd_cred, p); vput(vp); if (nd->nd_flag & ND_NFSV3) @@ -3285,7 +3285,7 @@ nfsrvd_verify(struct nfsrv_descript *nd, int isdgram, nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p); if (!nd->nd_repstat) - nd->nd_repstat = nfsvno_statfs(vp, &sf, nd->nd_cred, p); + nd->nd_repstat = nfsvno_statfs(vp, &sf); if (!nd->nd_repstat) nd->nd_repstat = nfsvno_getfh(vp, &fh, p); if (!nd->nd_repstat) { diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 7b57949..07dc2dd 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -117,8 +117,7 @@ static int ntfs_cmount ( struct mntarg *ma, void *data, - int flags, - struct thread *td ) + int flags) { int error; struct ntfs_args args; @@ -149,9 +148,7 @@ static const char *ntfs_opts[] = { }; static int -ntfs_mount ( - struct mount *mp, - struct thread *td ) +ntfs_mount (struct mount *mp) { int err = 0, error; struct vnode *devvp; @@ -184,7 +181,7 @@ ntfs_mount ( * Not an update, or updating the name: look up the name * and verify that it refers to a sensible block device. */ - NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from, curthread); err = namei(&ndp); if (err) { /* can't get devvp!*/ @@ -231,7 +228,7 @@ ntfs_mount ( /* Save "mounted from" info for mount point (NULL pad)*/ vfs_mountedfrom(mp, from); - err = ntfs_mountfs(devvp, mp, td); + err = ntfs_mountfs(devvp, mp, curthread); } if (err) { vrele(devvp); @@ -471,13 +468,14 @@ out: static int ntfs_unmount( struct mount *mp, - int mntflags, - struct thread *td) + int mntflags) { + struct thread *td; struct ntfsmount *ntmp; int error, flags, i; dprintf(("ntfs_unmount: unmounting...\n")); + td = curthread; ntmp = VFSTONTFS(mp); flags = 0; @@ -534,8 +532,7 @@ static int ntfs_root( struct mount *mp, int flags, - struct vnode **vpp, - struct thread *td ) + struct vnode **vpp) { struct vnode *nvp; int error = 0; @@ -587,8 +584,7 @@ ntfs_calccfree( static int ntfs_statfs( struct mount *mp, - struct statfs *sbp, - struct thread *td) + struct statfs *sbp) { struct ntfsmount *ntmp = VFSTONTFS(mp); u_int64_t mftsize,mftallocated; diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 841c9ca..7bd4ab7 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -69,7 +69,7 @@ static vfs_extattrctl_t nullfs_extattrctl; * Mount null layer */ static int -nullfs_mount(struct mount *mp, struct thread *td) +nullfs_mount(struct mount *mp) { int error = 0; struct vnode *lowerrootvp, *vp; @@ -115,8 +115,7 @@ nullfs_mount(struct mount *mp, struct thread *td) /* * Find lower node */ - NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, - UIO_SYSSPACE, target, td); + NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread); error = namei(ndp); /* * Re-lock vnode. @@ -200,10 +199,9 @@ nullfs_mount(struct mount *mp, struct thread *td) * Free reference to null layer */ static int -nullfs_unmount(mp, mntflags, td) +nullfs_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { void *mntdata; int error; @@ -215,7 +213,7 @@ nullfs_unmount(mp, mntflags, td) flags |= FORCECLOSE; /* There is 1 extra root vnode reference (nullm_rootvp). */ - error = vflush(mp, 1, flags, td); + error = vflush(mp, 1, flags, curthread); if (error) return (error); @@ -229,11 +227,10 @@ nullfs_unmount(mp, mntflags, td) } static int -nullfs_root(mp, flags, vpp, td) +nullfs_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *vp; @@ -257,21 +254,19 @@ nullfs_root(mp, flags, vpp, td) } static int -nullfs_quotactl(mp, cmd, uid, arg, td) +nullfs_quotactl(mp, cmd, uid, arg) struct mount *mp; int cmd; uid_t uid; void *arg; - struct thread *td; { - return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg, td); + return VFS_QUOTACTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, uid, arg); } static int -nullfs_statfs(mp, sbp, td) +nullfs_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { int error; struct statfs mstat; @@ -282,7 +277,7 @@ nullfs_statfs(mp, sbp, td) bzero(&mstat, sizeof(mstat)); - error = VFS_STATFS(MOUNTTONULLMOUNT(mp)->nullm_vfs, &mstat, td); + error = VFS_STATFS(MOUNTTONULLMOUNT(mp)->nullm_vfs, &mstat); if (error) return (error); @@ -300,10 +295,9 @@ nullfs_statfs(mp, sbp, td) } static int -nullfs_sync(mp, waitfor, td) +nullfs_sync(mp, waitfor) struct mount *mp; int waitfor; - struct thread *td; { /* * XXX - Assumes no data cached at null layer. @@ -341,16 +335,15 @@ nullfs_fhtovp(mp, fidp, vpp) } static int -nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) +nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname) struct mount *mp; int cmd; struct vnode *filename_vp; int namespace; const char *attrname; - struct thread *td; { return VFS_EXTATTRCTL(MOUNTTONULLMOUNT(mp)->nullm_vfs, cmd, filename_vp, - namespace, attrname, td); + namespace, attrname); } diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c index a7880b6..eed51c6 100644 --- a/sys/fs/nwfs/nwfs_vfsops.c +++ b/sys/fs/nwfs/nwfs_vfsops.c @@ -129,8 +129,7 @@ nwfs_initnls(struct nwmount *nmp) { return 0; } -static int nwfs_cmount(struct mntarg *ma, void *data, int flags, - struct thread *td) +static int nwfs_cmount(struct mntarg *ma, void *data, int flags) { struct nwfs_args args; /* will hold data from mount request */ int error; @@ -155,7 +154,7 @@ static int nwfs_cmount(struct mntarg *ma, void *data, int flags, * mp - path - addr in user space of mount point (ie /usr or whatever) * data - addr in user space of mount params */ -static int nwfs_mount(struct mount *mp, struct thread *td) +static int nwfs_mount(struct mount *mp) { struct nwfs_args args; /* will hold data from mount request */ int error; @@ -163,8 +162,10 @@ static int nwfs_mount(struct mount *mp, struct thread *td) struct ncp_conn *conn = NULL; struct ncp_handle *handle = NULL; struct vnode *vp; + struct thread *td; char *pc,*pe; + td = curthread; if (mp->mnt_flag & MNT_ROOTFS) return (EOPNOTSUPP); if (mp->mnt_flag & MNT_UPDATE) { @@ -224,7 +225,7 @@ static int nwfs_mount(struct mount *mp, struct thread *td) /* protect against invalid mount points */ nmp->m.mount_point[sizeof(nmp->m.mount_point)-1] = '\0'; vfs_getnewfsid(mp); - error = nwfs_root(mp, LK_EXCLUSIVE, &vp, td); + error = nwfs_root(mp, LK_EXCLUSIVE, &vp); if (error) goto bad; /* @@ -243,13 +244,15 @@ bad: /* Unmount the filesystem described by mp. */ static int -nwfs_unmount(struct mount *mp, int mntflags, struct thread *td) +nwfs_unmount(struct mount *mp, int mntflags) { + struct thread *td; struct nwmount *nmp = VFSTONWFS(mp); struct ncp_conn *conn; int error, flags; NCPVODEBUG("nwfs_unmount: flags=%04x\n",mntflags); + td = curthread; flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; @@ -275,16 +278,20 @@ nwfs_unmount(struct mount *mp, int mntflags, struct thread *td) /* Return locked vnode to root of a filesystem */ static int -nwfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { +nwfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct vnode *vp; struct nwmount *nmp; struct nwnode *np; struct ncp_conn *conn; struct nw_entry_info fattr; - struct ucred *cred = td->td_ucred; + struct thread *td; + struct ucred *cred; int error, nsf, opt; u_char vol; + td = curthread; + cred = td->td_ucred; + nmp = VFSTONWFS(mp); conn = NWFSTOCONN(nmp); if (nmp->n_root) { @@ -371,12 +378,11 @@ nwfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { */ /* ARGSUSED */ static int -nwfs_quotactl(mp, cmd, uid, arg, td) +nwfs_quotactl(mp, cmd, uid, arg) struct mount *mp; int cmd; uid_t uid; void *arg; - struct thread *td; { NCPVODEBUG("return EOPNOTSUPP\n"); return (EOPNOTSUPP); @@ -406,12 +412,12 @@ nwfs_uninit(struct vfsconf *vfsp) * nwfs_statfs call */ int -nwfs_statfs(mp, sbp, td) +nwfs_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { struct nwmount *nmp = VFSTONWFS(mp); + struct thread *td = curthread; int error = 0, secsize; struct nwnode *np = nmp->n_root; struct ncp_volume_info vi; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index c2057c6..a8c16c4 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -68,7 +68,7 @@ static const char *portal_opts[] = { }; static int -portal_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +portal_cmount(struct mntarg *ma, void *data, int flags) { struct portal_args args; int error; @@ -90,16 +90,18 @@ portal_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) * Mount the per-process file descriptors (/dev/fd) */ static int -portal_mount(struct mount *mp, struct thread *td) +portal_mount(struct mount *mp) { struct file *fp; struct portalmount *fmp; struct socket *so; struct vnode *rvp; + struct thread *td; struct portalnode *pn; int error, v; char *p; + td = curthread; if (vfs_filteropt(mp->mnt_optnew, portal_opts)) return (EINVAL); @@ -165,10 +167,9 @@ portal_mount(struct mount *mp, struct thread *td) } static int -portal_unmount(mp, mntflags, td) +portal_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { int error, flags = 0; @@ -187,7 +188,7 @@ portal_unmount(mp, mntflags, td) return (EBUSY); #endif /* There is 1 extra root vnode reference (pm_root). */ - error = vflush(mp, 1, flags, td); + error = vflush(mp, 1, flags, curthread); if (error) return (error); @@ -211,11 +212,10 @@ portal_unmount(mp, mntflags, td) } static int -portal_root(mp, flags, vpp, td) +portal_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *vp; @@ -230,10 +230,9 @@ portal_root(mp, flags, vpp, td) } static int -portal_statfs(mp, sbp, td) +portal_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { sbp->f_flags = 0; diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index f7a0426..f13aa83 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -299,7 +299,7 @@ pfs_destroy(struct pfs_node *pn) * Mount a pseudofs instance */ int -pfs_mount(struct pfs_info *pi, struct mount *mp, struct thread *td) +pfs_mount(struct pfs_info *pi, struct mount *mp) { struct statfs *sbp; @@ -330,7 +330,7 @@ pfs_mount(struct pfs_info *pi, struct mount *mp, struct thread *td) * Compatibility shim for old mount(2) system call */ int -pfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +pfs_cmount(struct mntarg *ma, void *data, int flags) { int error; @@ -342,11 +342,12 @@ pfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) * Unmount a pseudofs instance */ int -pfs_unmount(struct mount *mp, int mntflags, struct thread *td) +pfs_unmount(struct mount *mp, int mntflags) { int error; - error = vflush(mp, 0, (mntflags & MNT_FORCE) ? FORCECLOSE : 0, td); + error = vflush(mp, 0, (mntflags & MNT_FORCE) ? FORCECLOSE : 0, + curthread); return (error); } @@ -354,7 +355,7 @@ pfs_unmount(struct mount *mp, int mntflags, struct thread *td) * Return a root vnode */ int -pfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +pfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct pfs_info *pi; @@ -366,7 +367,7 @@ pfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) * Return filesystem stats */ int -pfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +pfs_statfs(struct mount *mp, struct statfs *sbp) { /* no-op: always called with mp->mnt_stat */ return (0); diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h index c9e1697..6dc5535 100644 --- a/sys/fs/pseudofs/pseudofs.h +++ b/sys/fs/pseudofs/pseudofs.h @@ -241,16 +241,12 @@ struct pfs_node { /* * VFS interface */ -int pfs_mount (struct pfs_info *pi, struct mount *mp, - struct thread *td); -int pfs_cmount (struct mntarg *ma, void *data, int flags, - struct thread *td); -int pfs_unmount (struct mount *mp, int mntflags, - struct thread *td); +int pfs_mount (struct pfs_info *pi, struct mount *mp); +int pfs_cmount (struct mntarg *ma, void *data, int flags); +int pfs_unmount (struct mount *mp, int mntflags); int pfs_root (struct mount *mp, int flags, - struct vnode **vpp, struct thread *td); -int pfs_statfs (struct mount *mp, struct statfs *sbp, - struct thread *td); + struct vnode **vpp); +int pfs_statfs (struct mount *mp, struct statfs *sbp); int pfs_init (struct pfs_info *pi, struct vfsconf *vfc); int pfs_uninit (struct pfs_info *pi, struct vfsconf *vfc); @@ -284,8 +280,8 @@ static struct pfs_info name##_info = { \ }; \ \ static int \ -_##name##_mount(struct mount *mp, struct thread *td) { \ - return pfs_mount(&name##_info, mp, td); \ +_##name##_mount(struct mount *mp) { \ + return pfs_mount(&name##_info, mp); \ } \ \ static int \ diff --git a/sys/fs/smbfs/smbfs_vfsops.c b/sys/fs/smbfs/smbfs_vfsops.c index 71b3960..b762bde 100644 --- a/sys/fs/smbfs/smbfs_vfsops.c +++ b/sys/fs/smbfs/smbfs_vfsops.c @@ -104,7 +104,7 @@ MODULE_DEPEND(smbfs, libmchain, 1, 1, 1); int smbfs_pbuf_freecnt = -1; /* start out unlimited */ static int -smbfs_cmount(struct mntarg *ma, void * data, int flags, struct thread *td) +smbfs_cmount(struct mntarg *ma, void * data, int flags) { struct smbfs_args args; int error; @@ -143,16 +143,18 @@ static const char *smbfs_opts[] = { }; static int -smbfs_mount(struct mount *mp, struct thread *td) +smbfs_mount(struct mount *mp) { struct smbmount *smp = NULL; struct smb_vc *vcp; struct smb_share *ssp = NULL; struct vnode *vp; + struct thread *td; struct smb_cred scred; int error, v; char *pc, *pe; + td = curthread; if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS)) return EOPNOTSUPP; @@ -249,7 +251,7 @@ smbfs_mount(struct mount *mp, struct thread *td) } } vfs_getnewfsid(mp); - error = smbfs_root(mp, LK_EXCLUSIVE, &vp, td); + error = smbfs_root(mp, LK_EXCLUSIVE, &vp); if (error) { vfs_mount_error(mp, "smbfs_root error: %d", error); goto bad; @@ -279,13 +281,15 @@ bad: /* Unmount the filesystem described by mp. */ static int -smbfs_unmount(struct mount *mp, int mntflags, struct thread *td) +smbfs_unmount(struct mount *mp, int mntflags) { + struct thread *td; struct smbmount *smp = VFSTOSMBFS(mp); struct smb_cred scred; int error, flags; SMBVDEBUG("smbfs_unmount: flags=%04x\n", mntflags); + td = curthread; flags = 0; if (mntflags & MNT_FORCE) flags |= FORCECLOSE; @@ -329,16 +333,20 @@ smbfs_unmount(struct mount *mp, int mntflags, struct thread *td) * Return locked root vnode of a filesystem */ static int -smbfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +smbfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct smbmount *smp = VFSTOSMBFS(mp); struct vnode *vp; struct smbnode *np; struct smbfattr fattr; - struct ucred *cred = td->td_ucred; + struct thread *td; + struct ucred *cred; struct smb_cred scred; int error; + td = curthread; + cred = td->td_ucred; + if (smp == NULL) { SMBERROR("smp == NULL (bug in umount)\n"); vfs_mount_error(mp, "smp == NULL (bug in umount)"); @@ -368,12 +376,11 @@ smbfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) */ /* ARGSUSED */ static int -smbfs_quotactl(mp, cmd, uid, arg, td) +smbfs_quotactl(mp, cmd, uid, arg) struct mount *mp; int cmd; uid_t uid; void *arg; - struct thread *td; { SMBVDEBUG("return EOPNOTSUPP\n"); return EOPNOTSUPP; @@ -404,8 +411,9 @@ smbfs_uninit(struct vfsconf *vfsp) * smbfs_statfs call */ int -smbfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +smbfs_statfs(struct mount *mp, struct statfs *sbp) { + struct thread *td = curthread; struct smbmount *smp = VFSTOSMBFS(mp); struct smbnode *np = smp->sm_root; struct smb_share *ssp = smp->sm_share; diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 1ae8ca6..ffd705f 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -394,14 +394,14 @@ struct tmpfs_fid { int tmpfs_alloc_node(struct tmpfs_mount *, enum vtype, uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *, - char *, dev_t, struct thread *, struct tmpfs_node **); + char *, dev_t, struct tmpfs_node **); void tmpfs_free_node(struct tmpfs_mount *, struct tmpfs_node *); int tmpfs_alloc_dirent(struct tmpfs_mount *, struct tmpfs_node *, const char *, uint16_t, struct tmpfs_dirent **); void tmpfs_free_dirent(struct tmpfs_mount *, struct tmpfs_dirent *, boolean_t); int tmpfs_alloc_vp(struct mount *, struct tmpfs_node *, int, - struct vnode **, struct thread *); + struct vnode **); void tmpfs_free_vp(struct vnode *); int tmpfs_alloc_file(struct vnode *, struct vnode **, struct vattr *, struct componentname *, char *); diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 3e5adf7..f2be735 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -82,7 +82,7 @@ __FBSDID("$FreeBSD$"); int tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type, uid_t uid, gid_t gid, mode_t mode, struct tmpfs_node *parent, - char *target, dev_t rdev, struct thread *p, struct tmpfs_node **node) + char *target, dev_t rdev, struct tmpfs_node **node) { struct tmpfs_node *nnode; @@ -303,7 +303,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de, */ int tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, int lkflag, - struct vnode **vpp, struct thread *td) + struct vnode **vpp) { int error = 0; struct vnode *vp; @@ -314,7 +314,7 @@ loop: VI_LOCK(vp); TMPFS_NODE_UNLOCK(node); vholdl(vp); - (void) vget(vp, lkflag | LK_INTERLOCK | LK_RETRY, td); + (void) vget(vp, lkflag | LK_INTERLOCK | LK_RETRY, curthread); vdrop(vp); /* @@ -482,8 +482,7 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap, /* Allocate a node that represents the new file. */ error = tmpfs_alloc_node(tmp, vap->va_type, cnp->cn_cred->cr_uid, - dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, - cnp->cn_thread, &node); + dnode->tn_gid, vap->va_mode, parent, target, vap->va_rdev, &node); if (error != 0) goto out; @@ -496,8 +495,7 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap, } /* Allocate a vnode for the new file. */ - error = tmpfs_alloc_vp(dvp->v_mount, node, LK_EXCLUSIVE, vpp, - cnp->cn_thread); + error = tmpfs_alloc_vp(dvp->v_mount, node, LK_EXCLUSIVE, vpp); if (error != 0) { tmpfs_free_dirent(tmp, de, TRUE); tmpfs_free_node(tmp, node); diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 264e19f..f0ae6be 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -68,12 +68,11 @@ MALLOC_DEFINE(M_TMPFSNAME, "tmpfs name", "tmpfs file names"); /* --------------------------------------------------------------------- */ -static int tmpfs_mount(struct mount *, struct thread *); -static int tmpfs_unmount(struct mount *, int, struct thread *); -static int tmpfs_root(struct mount *, int flags, struct vnode **, - struct thread *); +static int tmpfs_mount(struct mount *); +static int tmpfs_unmount(struct mount *, int); +static int tmpfs_root(struct mount *, int flags, struct vnode **); static int tmpfs_fhtovp(struct mount *, struct fid *, struct vnode **); -static int tmpfs_statfs(struct mount *, struct statfs *, struct thread *); +static int tmpfs_statfs(struct mount *, struct statfs *); /* --------------------------------------------------------------------- */ @@ -178,7 +177,7 @@ tmpfs_node_fini(void *mem, int size) } static int -tmpfs_mount(struct mount *mp, struct thread *td) +tmpfs_mount(struct mount *mp) { struct tmpfs_mount *tmp; struct tmpfs_node *root; @@ -278,7 +277,7 @@ tmpfs_mount(struct mount *mp, struct thread *td) /* Allocate the root node. */ error = tmpfs_alloc_node(tmp, VDIR, root_uid, root_gid, root_mode & ALLPERMS, NULL, NULL, - VNOVAL, td, &root); + VNOVAL, &root); if (error != 0 || root == NULL) { uma_zdestroy(tmp->tm_node_pool); @@ -307,7 +306,7 @@ tmpfs_mount(struct mount *mp, struct thread *td) /* ARGSUSED2 */ static int -tmpfs_unmount(struct mount *mp, int mntflags, struct thread *l) +tmpfs_unmount(struct mount *mp, int mntflags) { int error; int flags = 0; @@ -319,7 +318,7 @@ tmpfs_unmount(struct mount *mp, int mntflags, struct thread *l) flags |= FORCECLOSE; /* Finalize all pending I/O. */ - error = vflush(mp, 0, flags, l); + error = vflush(mp, 0, flags, curthread); if (error != 0) return error; @@ -374,10 +373,10 @@ tmpfs_unmount(struct mount *mp, int mntflags, struct thread *l) /* --------------------------------------------------------------------- */ static int -tmpfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +tmpfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp, td); + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp); if (!error) (*vpp)->v_vflag |= VV_ROOT; @@ -417,7 +416,7 @@ tmpfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) TMPFS_UNLOCK(tmp); if (found) - return (tmpfs_alloc_vp(mp, node, LK_EXCLUSIVE, vpp, curthread)); + return (tmpfs_alloc_vp(mp, node, LK_EXCLUSIVE, vpp)); return (EINVAL); } @@ -426,7 +425,7 @@ tmpfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) /* ARGSUSED2 */ static int -tmpfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *l) +tmpfs_statfs(struct mount *mp, struct statfs *sbp) { fsfilcnt_t freenodes; struct tmpfs_mount *tmp; diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 16dad1b..64114fa 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -67,7 +67,6 @@ tmpfs_lookup(struct vop_cachedlookup_args *v) struct vnode *dvp = v->a_dvp; struct vnode **vpp = v->a_vpp; struct componentname *cnp = v->a_cnp; - struct thread *td = cnp->cn_thread; int error; struct tmpfs_dirent *de; @@ -77,7 +76,7 @@ tmpfs_lookup(struct vop_cachedlookup_args *v) *vpp = NULLVP; /* Check accessibility of requested node as a first step. */ - error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td); + error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, cnp->cn_thread); if (error != 0) goto out; @@ -94,7 +93,7 @@ tmpfs_lookup(struct vop_cachedlookup_args *v) VOP_UNLOCK(dvp, 0); /* Allocate a new vnode on the matching entry. */ error = tmpfs_alloc_vp(dvp->v_mount, dnode->tn_dir.tn_parent, - cnp->cn_lkflags, vpp, td); + cnp->cn_lkflags, vpp); vn_lock(dvp, ltype | LK_RETRY); vdrop(dvp); @@ -155,7 +154,7 @@ tmpfs_lookup(struct vop_cachedlookup_args *v) /* Allocate a new vnode on the matching entry. */ error = tmpfs_alloc_vp(dvp->v_mount, tnode, - cnp->cn_lkflags, vpp, td); + cnp->cn_lkflags, vpp); if (error != 0) goto out; @@ -170,7 +169,7 @@ tmpfs_lookup(struct vop_cachedlookup_args *v) cnp->cn_flags |= SAVENAME; } else { error = tmpfs_alloc_vp(dvp->v_mount, tnode, - cnp->cn_lkflags, vpp, td); + cnp->cn_lkflags, vpp); } } } diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index 8519a07..7be5384 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -186,15 +186,17 @@ udf_uninit(struct vfsconf *foo) } static int -udf_mount(struct mount *mp, struct thread *td) +udf_mount(struct mount *mp) { struct vnode *devvp; /* vnode of the mount device */ + struct thread *td; struct udf_mnt *imp = 0; struct vfsoptlist *opts; char *fspec, *cs_disk, *cs_local; int error, len, *udf_flags; struct nameidata nd, *ndp = &nd; + td = curthread; opts = mp->mnt_optnew; /* @@ -510,7 +512,7 @@ bail: }; static int -udf_unmount(struct mount *mp, int mntflags, struct thread *td) +udf_unmount(struct mount *mp, int mntflags) { struct udf_mnt *udfmp; int error, flags = 0; @@ -520,7 +522,7 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td) if (mntflags & MNT_FORCE) flags |= FORCECLOSE; - if ((error = vflush(mp, 0, flags, td))) + if ((error = vflush(mp, 0, flags, curthread))) return (error); if (udfmp->im_flags & UDFMNT_KICONV && udf_iconv) { @@ -554,7 +556,7 @@ udf_unmount(struct mount *mp, int mntflags, struct thread *td) } static int -udf_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +udf_root(struct mount *mp, int flags, struct vnode **vpp) { struct udf_mnt *udfmp; ino_t id; @@ -567,7 +569,7 @@ udf_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) } static int -udf_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +udf_statfs(struct mount *mp, struct statfs *sbp) { struct udf_mnt *udfmp; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index d74d1ea..604d4a3 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -70,12 +70,13 @@ static struct vfsops unionfs_vfsops; * Mount unionfs layer. */ static int -unionfs_domount(struct mount *mp, struct thread *td) +unionfs_domount(struct mount *mp) { int error; struct vnode *lowerrootvp; struct vnode *upperrootvp; struct unionfs_mount *ump; + struct thread *td; char *target; char *tmp; char *ep; @@ -103,6 +104,7 @@ unionfs_domount(struct mount *mp, struct thread *td) copymode = UNIONFS_TRANSPARENT; /* default */ whitemode = UNIONFS_WHITE_ALWAYS; ndp = &nd; + td = curthread; if (mp->mnt_flag & MNT_ROOTFS) { vfs_mount_error(mp, "Cannot union mount root filesystem"); @@ -343,7 +345,7 @@ unionfs_domount(struct mount *mp, struct thread *td) * Free reference to unionfs layer */ static int -unionfs_unmount(struct mount *mp, int mntflags, struct thread *td) +unionfs_unmount(struct mount *mp, int mntflags) { struct unionfs_mount *ump; int error; @@ -360,7 +362,7 @@ unionfs_unmount(struct mount *mp, int mntflags, struct thread *td) flags |= FORCECLOSE; /* vflush (no need to call vrele) */ - for (freeing = 0; (error = vflush(mp, 1, flags, td)) != 0;) { + for (freeing = 0; (error = vflush(mp, 1, flags, curthread)) != 0;) { num = mp->mnt_nvnodelistsize; if (num == freeing) break; @@ -377,7 +379,7 @@ unionfs_unmount(struct mount *mp, int mntflags, struct thread *td) } static int -unionfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +unionfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct unionfs_mount *ump; struct vnode *vp; @@ -398,8 +400,7 @@ unionfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) } static int -unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, - struct thread *td) +unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg) { struct unionfs_mount *ump; @@ -408,11 +409,11 @@ unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, /* * Writing is always performed to upper vnode. */ - return (VFS_QUOTACTL(ump->um_uppervp->v_mount, cmd, uid, arg, td)); + return (VFS_QUOTACTL(ump->um_uppervp->v_mount, cmd, uid, arg)); } static int -unionfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +unionfs_statfs(struct mount *mp, struct statfs *sbp) { struct unionfs_mount *ump; int error; @@ -426,7 +427,7 @@ unionfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) bzero(&mstat, sizeof(mstat)); - error = VFS_STATFS(ump->um_lowervp->v_mount, &mstat, td); + error = VFS_STATFS(ump->um_lowervp->v_mount, &mstat); if (error) return (error); @@ -436,7 +437,7 @@ unionfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) lbsize = mstat.f_bsize; - error = VFS_STATFS(ump->um_uppervp->v_mount, &mstat, td); + error = VFS_STATFS(ump->um_uppervp->v_mount, &mstat); if (error) return (error); @@ -461,7 +462,7 @@ unionfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) } static int -unionfs_sync(struct mount *mp, int waitfor, struct thread *td) +unionfs_sync(struct mount *mp, int waitfor) { /* nothing to do */ return (0); @@ -488,7 +489,7 @@ unionfs_checkexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, static int unionfs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, - int namespace, const char *attrname, struct thread *td) + int namespace, const char *attrname) { struct unionfs_mount *ump; struct unionfs_node *unp; @@ -498,10 +499,10 @@ unionfs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, if (unp->un_uppervp != NULLVP) { return (VFS_EXTATTRCTL(ump->um_uppervp->v_mount, cmd, - unp->un_uppervp, namespace, attrname, td)); + unp->un_uppervp, namespace, attrname)); } else { return (VFS_EXTATTRCTL(ump->um_lowervp->v_mount, cmd, - unp->un_lowervp, namespace, attrname, td)); + unp->un_lowervp, namespace, attrname)); } } |