diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c b/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c index 47df799b20b2..ba7902781e16 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c @@ -66,7 +66,6 @@ lookupnameat(char *dirname, enum uio_seg seg, enum symfollow follow, int traverse(vnode_t **cvpp, int lktype) { - kthread_t *td = curthread; vnode_t *cvp; vnode_t *tvp; vfs_t *vfsp; @@ -101,7 +100,7 @@ traverse(vnode_t **cvpp, int lktype) * The read lock must be held across the call to VFS_ROOT() to * prevent a concurrent unmount from destroying the vfs. */ - error = VFS_ROOT(vfsp, lktype, &tvp, td); + error = VFS_ROOT(vfsp, lktype, &tvp); if (error != 0) return (error); cvp = tvp; diff --git a/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c b/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c index 045b8aa2f6c2..a716b6395fbd 100644 --- a/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c +++ b/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c @@ -160,14 +160,14 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, */ cr = td->td_ucred; td->td_ucred = kcred; - error = VFS_MOUNT(mp, td); + error = VFS_MOUNT(mp); td->td_ucred = cr; if (!error) { if (mp->mnt_opt != NULL) vfs_freeopts(mp->mnt_opt); mp->mnt_opt = mp->mnt_optnew; - (void)VFS_STATFS(mp, &mp->mnt_stat, td); + (void)VFS_STATFS(mp, &mp->mnt_stat); } /* * Prevent external consumers of mount options from reading @@ -192,7 +192,7 @@ domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); vfs_event_signal(NULL, VQ_MOUNT, 0); - if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp, td)) + if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); mountcheckdirs(vp, mvp); vput(mvp); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index 654d2f949b3f..eef1d21bb972 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -180,7 +180,7 @@ zfsctl_create(zfsvfs_t *zfsvfs) zcp = vp->v_data; zcp->zc_id = ZFSCTL_INO_ROOT; - VERIFY(VFS_ROOT(zfsvfs->z_vfs, LK_EXCLUSIVE, &rvp, curthread) == 0); + VERIFY(VFS_ROOT(zfsvfs->z_vfs, LK_EXCLUSIVE, &rvp) == 0); ZFS_TIME_DECODE(&zcp->zc_cmtime, VTOZ(rvp)->z_phys->zp_crtime); VN_URELE(rvp); @@ -415,7 +415,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp, ZFS_ENTER(zfsvfs); if (strcmp(nm, "..") == 0) { - err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp, curthread); + err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp); if (err == 0) VOP_UNLOCK(*vpp, 0); } else { diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c index 5becdb46a9f1..835aa532327a 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c @@ -91,12 +91,12 @@ static int zfs_version_zpl = ZPL_VERSION; SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); -static int zfs_mount(vfs_t *vfsp, kthread_t *td); -static int zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td); -static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp, kthread_t *td); -static int zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td); +static int zfs_mount(vfs_t *vfsp); +static int zfs_umount(vfs_t *vfsp, int fflag); +static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); +static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); -static int zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td); +static int zfs_sync(vfs_t *vfsp, int waitfor); static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp); static void zfs_objset_close(zfsvfs_t *zfsvfs); static void zfs_freevfs(vfs_t *vfsp); @@ -122,7 +122,7 @@ static uint32_t zfs_active_fs_count = 0; /*ARGSUSED*/ static int -zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td) +zfs_sync(vfs_t *vfsp, int waitfor) { /* @@ -139,7 +139,7 @@ zfs_sync(vfs_t *vfsp, int waitfor, kthread_t *td) zfsvfs_t *zfsvfs = vfsp->vfs_data; int error; - error = vfs_stdsync(vfsp, waitfor, td); + error = vfs_stdsync(vfsp, waitfor); if (error != 0) return (error); @@ -688,8 +688,9 @@ zfs_unregister_callbacks(zfsvfs_t *zfsvfs) /*ARGSUSED*/ static int -zfs_mount(vfs_t *vfsp, kthread_t *td) +zfs_mount(vfs_t *vfsp) { + kthread_t *td = curthread; vnode_t *mvp = vfsp->mnt_vnodecovered; cred_t *cr = td->td_ucred; char *osname; @@ -782,7 +783,7 @@ zfs_mount(vfs_t *vfsp, kthread_t *td) } static int -zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td) +zfs_statfs(vfs_t *vfsp, struct statfs *statp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; uint64_t refdbytes, availbytes, usedobjs, availobjs; @@ -840,7 +841,7 @@ zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td) } static int -zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp, kthread_t *td) +zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; znode_t *rootzp; @@ -957,11 +958,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting) /*ARGSUSED*/ static int -zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td) +zfs_umount(vfs_t *vfsp, int fflag) { zfsvfs_t *zfsvfs = vfsp->vfs_data; objset_t *os; - cred_t *cr = td->td_ucred; + cred_t *cr = curthread->td_ucred; int ret; if (fflag & MS_FORCE) { @@ -992,7 +993,7 @@ zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td) if (zfsvfs->z_ctldir != NULL) { if ((ret = zfsctl_umount_snapshots(vfsp, fflag, cr)) != 0) return (ret); - ret = vflush(vfsp, 0, 0, td); + ret = vflush(vfsp, 0, 0, curthread); ASSERT(ret == EBUSY); if (!(fflag & MS_FORCE)) { if (zfsvfs->z_ctldir->v_count > 1) @@ -1006,7 +1007,7 @@ zfs_umount(vfs_t *vfsp, int fflag, kthread_t *td) /* * Flush all the files. */ - ret = vflush(vfsp, 1, (fflag & MS_FORCE) ? FORCECLOSE : 0, td); + ret = vflush(vfsp, 1, (fflag & MS_FORCE) ? FORCECLOSE : 0, curthread); if (ret != 0) { if (!zfsvfs->z_issnap) { zfsctl_create(zfsvfs); diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 95a9a23e9c87..b4c65e109291 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 @@ iso_mountfs(devvp, mp) * 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 5ce6499e179b..b12c43bc3626 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 1050ba5fa155..524bec830173 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 9a9bc3850010..ff86e36859fe 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 215f9438f4de..ece95597375e 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 06f53fb2ce86..477193aebc0d 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 96513130ce20..fdbcaba043be 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 d1788ae43490..9857d937f67f 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 a20614b3f481..9aa95ffd3c37 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 @@ hpfs_mountfs(devvp, mp, td) 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 2da25a74eb24..81867634e0d5 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 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp) * 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 bb1990272627..a398a72f5959 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 64b1e9026e6e..b41e0a679009 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 1ceba85b8532..66ea55b8c9ee 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 @@ nfs_mount(struct mount *mp, struct thread *td) */ /* 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 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, * 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 @@ nfs_unmount(struct mount *mp, int mntflags, struct thread *td) * 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 09a1d73ac9da..5dbb21d3e3ab 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 141a61474663..61c646c32f69 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 7b57949ab212..07dc2ddb2f24 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 @@ ntfs_mountfs(devvp, mp, td) 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 841c9cab60d9..7bd4ab7d2794 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 a7880b601afd..eed51c6b49c5 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 @@ static int nwfs_mount(struct mount *mp, struct thread *td) /* 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 c2057c67c642..a8c16c4b17fa 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 f7a042603c0b..f13aa83527a3 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 c9e1697245e0..6dc55356786a 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 71b3960893ba..b762bde99aff 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 @@ smbfs_mount(struct mount *mp, struct thread *td) /* 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 1ae8ca63c278..ffd705fe026d 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 3e5adf790c67..f2be735465e3 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 @@ tmpfs_alloc_vp(struct mount *mp, struct tmpfs_node *node, int lkflag, 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 264e19f83eef..f0ae6be143e5 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 16dad1b7e26b..64114fa94fca 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 8519a0701201..7be538436ce5 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 @@ udf_mountfs(struct vnode *devvp, struct mount *mp) }; 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 d74d1eae0e26..604d4a3943f0 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)); } } diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index 2db236440fcd..e6592d0c82d7 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2939,7 +2939,7 @@ g_journal_do_switch(struct g_class *classp) GJ_TIMER_STOP(1, &bt, "Msync time of %s", mountpoint); GJ_TIMER_START(1, &bt); - error = VFS_SYNC(mp, MNT_NOWAIT, curthread); + error = VFS_SYNC(mp, MNT_NOWAIT); if (error == 0) GJ_TIMER_STOP(1, &bt, "Sync time of %s", mountpoint); else { diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 5f4a84afca4b..c8d79fbc7048 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -127,12 +127,12 @@ static const char *ext2_opts[] = { "from", "export", "acls", "noexec", * mount system call */ static int -ext2_mount(mp, td) +ext2_mount(mp) struct mount *mp; - struct thread *td; { struct vfsoptlist *opts; struct vnode *devvp; + struct thread *td; struct ext2mount *ump = 0; struct ext2_sb_info *fs; char *path, *fspec; @@ -140,6 +140,7 @@ ext2_mount(mp, td) accmode_t accmode; struct nameidata nd, *ndp = &nd; + td = curthread; opts = mp->mnt_optnew; if (vfs_filteropt(opts, ext2_opts)) @@ -165,7 +166,7 @@ ext2_mount(mp, td) error = 0; if (fs->s_rd_only == 0 && vfs_flagopt(opts, "ro", NULL, 0)) { - error = VFS_SYNC(mp, MNT_WAIT, td); + error = VFS_SYNC(mp, MNT_WAIT); if (error) return (error); flags = WRITECLOSE; @@ -734,10 +735,9 @@ ext2_mountfs(devvp, mp) * unmount system call */ static int -ext2_unmount(mp, mntflags, td) +ext2_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct ext2mount *ump; struct ext2_sb_info *fs; @@ -749,7 +749,7 @@ ext2_unmount(mp, mntflags, td) return (EINVAL); flags |= FORCECLOSE; } - if ((error = ext2_flushfiles(mp, flags, td)) != 0) + if ((error = ext2_flushfiles(mp, flags, curthread)) != 0) return (error); ump = VFSTOEXT2(mp); fs = ump->um_e2fs; @@ -810,10 +810,9 @@ ext2_flushfiles(mp, flags, td) * taken from ext2/super.c ext2_statfs */ static int -ext2_statfs(mp, sbp, td) +ext2_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { unsigned long overhead; struct ext2mount *ump; @@ -862,17 +861,18 @@ ext2_statfs(mp, sbp, td) * Note: we are always called with the filesystem marked `MPBUSY'. */ static int -ext2_sync(mp, waitfor, td) +ext2_sync(mp, waitfor) struct mount *mp; int waitfor; - struct thread *td; { struct vnode *mvp, *vp; + struct thread *td; struct inode *ip; struct ext2mount *ump = VFSTOEXT2(mp); struct ext2_sb_info *fs; int error, allerror = 0; + td = curthread; fs = ump->um_e2fs; if (fs->s_dirt != 0 && fs->s_rd_only != 0) { /* XXX */ printf("fs = %s\n", fs->fs_fsmnt); @@ -1143,11 +1143,10 @@ printf("\nupdating superblock, waitfor=%s\n", waitfor == MNT_WAIT ? "yes":"no"); * Return the root of a filesystem. */ static int -ext2_root(mp, flags, vpp, td) +ext2_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *nvp; int error; diff --git a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c index 6704b07b1b4f..739eff9a56bf 100644 --- a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c +++ b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c @@ -49,7 +49,7 @@ MALLOC_DEFINE(M_REISERFSNODE, "reiserfs_node", "ReiserFS vnode private part"); * -------------------------------------------------------------------*/ static int -reiserfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +reiserfs_cmount(struct mntarg *ma, void *data, int flags) { struct reiserfs_args args; int error; @@ -70,7 +70,7 @@ reiserfs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) * Mount system call */ static int -reiserfs_mount(struct mount *mp, struct thread *td) +reiserfs_mount(struct mount *mp) { size_t size; int error, len; @@ -81,7 +81,9 @@ reiserfs_mount(struct mount *mp, struct thread *td) struct reiserfs_mount *rmp; struct reiserfs_sb_info *sbi; struct nameidata nd, *ndp = &nd; + struct thread *td; + td = curthread; if (!(mp->mnt_flag & MNT_RDONLY)) return EROFS; @@ -158,7 +160,7 @@ reiserfs_mount(struct mount *mp, struct thread *td) reiserfs_log(LOG_DEBUG, "prepare statfs data\n"); (void)copystr(fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size); bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size); - (void)reiserfs_statfs(mp, &mp->mnt_stat, td); + (void)reiserfs_statfs(mp, &mp->mnt_stat); reiserfs_log(LOG_DEBUG, "done\n"); return (0); @@ -168,7 +170,7 @@ reiserfs_mount(struct mount *mp, struct thread *td) * Unmount system call */ static int -reiserfs_unmount(struct mount *mp, int mntflags, struct thread *td) +reiserfs_unmount(struct mount *mp, int mntflags) { int error, flags = 0; struct reiserfs_mount *rmp; @@ -185,7 +187,7 @@ reiserfs_unmount(struct mount *mp, int mntflags, struct thread *td) /* Flush files -> vflush */ reiserfs_log(LOG_DEBUG, "flush vnodes\n"); - if ((error = vflush(mp, 0, flags, td))) + if ((error = vflush(mp, 0, flags, curthread))) return (error); /* XXX Super block update */ @@ -252,8 +254,7 @@ reiserfs_unmount(struct mount *mp, int mntflags, struct thread *td) * Return the root of a filesystem. */ static int -reiserfs_root(struct mount *mp, int flags, struct vnode **vpp, - struct thread *td) +reiserfs_root(struct mount *mp, int flags, struct vnode **vpp) { int error; struct vnode *vp; @@ -262,7 +263,7 @@ reiserfs_root(struct mount *mp, int flags, struct vnode **vpp, rootkey.on_disk_key.k_dir_id = REISERFS_ROOT_PARENT_OBJECTID; rootkey.on_disk_key.k_objectid = REISERFS_ROOT_OBJECTID; - error = reiserfs_iget(mp, &rootkey, &vp, td); + error = reiserfs_iget(mp, &rootkey, &vp, curthread); if (error == 0) *vpp = vp; @@ -273,7 +274,7 @@ reiserfs_root(struct mount *mp, int flags, struct vnode **vpp, * The statfs syscall */ static int -reiserfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +reiserfs_statfs(struct mount *mp, struct statfs *sbp) { struct reiserfs_mount *rmp; struct reiserfs_sb_info *sbi; diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c index 1374fa55c3c7..f89618e93d02 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c @@ -180,8 +180,7 @@ _xfs_param_copyin(struct mount *mp, struct thread *td) } static int -_xfs_mount(struct mount *mp, - struct thread *td) +_xfs_mount(struct mount *mp) { struct xfsmount *xmp; struct xfs_vnode *rootvp; @@ -189,8 +188,10 @@ _xfs_mount(struct mount *mp, struct vnode *rvp, *devvp; struct cdev *ddev; struct g_consumer *cp; + struct thread *td; int error; + td = curthread; ddev = NULL; cp = NULL; @@ -229,7 +230,7 @@ _xfs_mount(struct mount *mp, mp->mnt_stat.f_fsid.val[0] = dev2udev(ddev); mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum; - if ((error = VFS_STATFS(mp, &mp->mnt_stat, td)) != 0) + if ((error = VFS_STATFS(mp, &mp->mnt_stat)) != 0) goto fail_unmount; rvp = rootvp->v_vnode; @@ -263,10 +264,9 @@ _xfs_mount(struct mount *mp, * Free reference to null layer */ static int -_xfs_unmount(mp, mntflags, td) +_xfs_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { struct vnode *devvp; struct g_consumer *cp; @@ -278,7 +278,7 @@ _xfs_unmount(mp, mntflags, td) if (devvp != NULL) cp = devvp->v_bufobj.bo_private; - XVFS_UNMOUNT(MNTTOVFS(mp), 0, td->td_ucred, error); + XVFS_UNMOUNT(MNTTOVFS(mp), 0, curthread->td_ucred, error); if (error == 0) { if (cp != NULL) { DROP_GIANT(); @@ -292,11 +292,10 @@ _xfs_unmount(mp, mntflags, td) } static int -_xfs_root(mp, flags, vpp, td) +_xfs_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { xfs_vnode_t *vp; int error; @@ -310,22 +309,20 @@ _xfs_root(mp, flags, vpp, td) } static int -_xfs_quotactl(mp, cmd, uid, arg, td) +_xfs_quotactl(mp, cmd, uid, arg) struct mount *mp; int cmd; uid_t uid; void *arg; - struct thread *td; { printf("xfs_quotactl\n"); return EOPNOTSUPP; } static int -_xfs_statfs(mp, sbp, td) +_xfs_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { int error; @@ -340,10 +337,9 @@ _xfs_statfs(mp, sbp, td) } static int -_xfs_sync(mp, waitfor, td) +_xfs_sync(mp, waitfor) struct mount *mp; int waitfor; - struct thread *td; { int error; int flags = SYNC_FSDATA|SYNC_ATTR|SYNC_REFCACHE; @@ -352,7 +348,7 @@ _xfs_sync(mp, waitfor, td) flags |= SYNC_WAIT; else if (waitfor == MNT_LAZY) flags |= SYNC_BDFLUSH; - XVFS_SYNC(MNTTOVFS(mp), flags, td->td_ucred, error); + XVFS_SYNC(MNTTOVFS(mp), flags, curthread->td_ucred, error); return (error); } @@ -386,8 +382,7 @@ _xfs_fhtovp(mp, fidp, vpp) static int _xfs_extattrctl(struct mount *mp, int cm, struct vnode *filename_v, - int attrnamespace, const char *attrname, - struct thread *td) + int attrnamespace, const char *attrname) { printf("xfs_extattrctl\n"); return ENOSYS; diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 8355ca51df41..a7ddb17cada4 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -586,7 +586,7 @@ acctwatch(void) * Stopping here is better than continuing, maybe it will be VBAD * next time around. */ - if (VFS_STATFS(acct_vp->v_mount, &sb, curthread) < 0) { + if (VFS_STATFS(acct_vp->v_mount, &sb) < 0) { VFS_UNLOCK_GIANT(vfslocked); return; } diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index 451f5c22ec56..9343f54c996e 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -561,7 +561,7 @@ mqfs_destroy(struct mqfs_node *node) * Mount a mqfs instance */ static int -mqfs_mount(struct mount *mp, struct thread *td) +mqfs_mount(struct mount *mp) { struct statfs *sbp; @@ -591,11 +591,12 @@ mqfs_mount(struct mount *mp, struct thread *td) * Unmount a mqfs instance */ static int -mqfs_unmount(struct mount *mp, int mntflags, struct thread *td) +mqfs_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); } @@ -603,7 +604,7 @@ mqfs_unmount(struct mount *mp, int mntflags, struct thread *td) * Return a root vnode */ static int -mqfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +mqfs_root(struct mount *mp, int flags, struct vnode **vpp) { struct mqfs_info *mqfs; int ret; @@ -617,7 +618,7 @@ mqfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) * Return filesystem stats */ static int -mqfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +mqfs_statfs(struct mount *mp, struct statfs *sbp) { /* XXX update statistics */ return (0); diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 2fe64b3deb71..bbaca4b9f98a 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -795,47 +795,45 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap) * used to fill the vfs function table to get reasonable default return values. */ int -vfs_stdroot (mp, flags, vpp, td) +vfs_stdroot (mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { return (EOPNOTSUPP); } int -vfs_stdstatfs (mp, sbp, td) +vfs_stdstatfs (mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { return (EOPNOTSUPP); } int -vfs_stdquotactl (mp, cmds, uid, arg, td) +vfs_stdquotactl (mp, cmds, uid, arg) struct mount *mp; int cmds; uid_t uid; void *arg; - struct thread *td; { return (EOPNOTSUPP); } int -vfs_stdsync(mp, waitfor, td) +vfs_stdsync(mp, waitfor) struct mount *mp; int waitfor; - struct thread *td; { struct vnode *vp, *mvp; + struct thread *td; int error, lockreq, allerror = 0; + td = curthread; lockreq = LK_EXCLUSIVE | LK_INTERLOCK; if (waitfor != MNT_WAIT) lockreq |= LK_NOWAIT; @@ -872,10 +870,9 @@ vfs_stdsync(mp, waitfor, td) } int -vfs_stdnosync (mp, waitfor, td) +vfs_stdnosync (mp, waitfor) struct mount *mp; int waitfor; - struct thread *td; { return (0); @@ -919,13 +916,12 @@ vfs_stduninit (vfsp) } int -vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname, td) +vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname) struct mount *mp; int cmd; struct vnode *filename_vp; int attrnamespace; const char *attrname; - struct thread *td; { if (filename_vp != NULL) diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 8e3464611ad7..6ac4cc218f92 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -361,7 +361,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep, bzero(&nfs_pub.np_handle, sizeof(nfs_pub.np_handle)); nfs_pub.np_handle.fh_fsid = mp->mnt_stat.f_fsid; - if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp, curthread /* XXX */))) + if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp))) return (error); if ((error = VOP_VPTOFH(rvp, &nfs_pub.np_handle.fh_fid))) diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 18890b798d65..b75d364ee3fd 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -133,7 +133,7 @@ extattrctl(td, uap) } error = VFS_EXTATTRCTL(mp, uap->cmd, filename_vp, uap->attrnamespace, - uap->attrname != NULL ? attrname : NULL, td); + uap->attrname != NULL ? attrname : NULL); vn_finished_write(mp_writable); out: diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 757e56e7c571..6dbb8d05ad86 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -453,7 +453,6 @@ lookup(struct nameidata *ndp) int error = 0; int dpunlocked = 0; /* dp has already been unlocked */ struct componentname *cnp = &ndp->ni_cnd; - struct thread *td = cnp->cn_thread; int vfslocked; /* VFS Giant state for child */ int dvfslocked; /* VFS Giant state for parent */ int tvfslocked; @@ -637,7 +636,8 @@ lookup(struct nameidata *ndp) unionlookup: #ifdef MAC if ((cnp->cn_flags & NOMACCHECK) == 0) { - error = mac_vnode_check_lookup(td->td_ucred, dp, cnp); + error = mac_vnode_check_lookup(cnp->cn_thread->td_ucred, dp, + cnp); if (error) goto bad; } @@ -758,7 +758,8 @@ lookup(struct nameidata *ndp) dvfslocked = 0; vref(vp_crossmp); ndp->ni_dvp = vp_crossmp; - error = VFS_ROOT(mp, compute_cn_lkflags(mp, cnp->cn_lkflags), &tdp, td); + error = VFS_ROOT(mp, compute_cn_lkflags(mp, cnp->cn_lkflags), + &tdp); vfs_unbusy(mp); if (vn_lock(vp_crossmp, LK_SHARED | LK_NOWAIT)) panic("vp_crossmp exclusively locked or reclaimed"); diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index e4256c7f28e2..becc525a969b 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #define ROOTNAME "root_device" #define VFS_MOUNTARG_SIZE_MAX (1024 * 64) +static void set_rootvnode(void); static int vfs_domount(struct thread *td, const char *fstype, char *fspath, int fsflags, void *fsdata); static int vfs_mountroot_ask(void); @@ -782,7 +783,7 @@ mount(td, uap) ma = mount_argb(ma, !(uap->flags & MNT_NOSUID), "nosuid"); ma = mount_argb(ma, !(uap->flags & MNT_NOEXEC), "noexec"); - error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, uap->flags, td); + error = vfsp->vfc_vfsops->vfs_cmount(ma, uap->data, uap->flags); mtx_unlock(&Giant); return (error); } @@ -977,7 +978,7 @@ vfs_domount( * XXX The final recipients of VFS_MOUNT just overwrite the ndp they * get. No freeing of cn_pnbuf. */ - error = VFS_MOUNT(mp, td); + error = VFS_MOUNT(mp); /* * Process the export option only if we are @@ -1006,7 +1007,7 @@ vfs_domount( if (mp->mnt_opt != NULL) vfs_freeopts(mp->mnt_opt); mp->mnt_opt = mp->mnt_optnew; - (void)VFS_STATFS(mp, &mp->mnt_stat, td); + (void)VFS_STATFS(mp, &mp->mnt_stat); } /* * Prevent external consumers of mount options from reading @@ -1063,7 +1064,7 @@ vfs_domount( TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); vfs_event_signal(NULL, VQ_MOUNT, 0); - if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp, td)) + if (VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) panic("mount: lost mount"); mountcheckdirs(vp, newdp); vput(newdp); @@ -1269,7 +1270,7 @@ dounmount(mp, flags, td) * such references to cause an EBUSY error. */ if ((flags & MNT_FORCE) && - VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp, td) == 0) { + VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp) == 0) { if (mp->mnt_vnodecovered != NULL) mountcheckdirs(fsrootvp, mp->mnt_vnodecovered); if (fsrootvp == rootvnode) { @@ -1279,10 +1280,8 @@ dounmount(mp, flags, td) vput(fsrootvp); } if (((mp->mnt_flag & MNT_RDONLY) || - (error = VFS_SYNC(mp, MNT_WAIT, td)) == 0) || - (flags & MNT_FORCE)) { - error = VFS_UNMOUNT(mp, flags, td); - } + (error = VFS_SYNC(mp, MNT_WAIT)) == 0) || (flags & MNT_FORCE) != 0) + error = VFS_UNMOUNT(mp, flags); vn_finished_write(mp); /* * If we failed to flush the dirty blocks for this mount point, @@ -1292,7 +1291,7 @@ dounmount(mp, flags, td) */ if (error && error != ENXIO) { if ((flags & MNT_FORCE) && - VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp, td) == 0) { + VFS_ROOT(mp, LK_EXCLUSIVE, &fsrootvp) == 0) { if (mp->mnt_vnodecovered != NULL) mountcheckdirs(mp->mnt_vnodecovered, fsrootvp); if (rootvnode == NULL) { @@ -1464,14 +1463,14 @@ root_mount_wait(void) } static void -set_rootvnode(struct thread *td) +set_rootvnode() { struct proc *p; - if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode, td)) + if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode)) panic("Cannot find root vnode"); - p = td->td_proc; + p = curthread->td_proc; FILEDESC_XLOCK(p->p_fd); if (p->p_fd->fd_cdir != NULL) @@ -1512,7 +1511,7 @@ devfs_first(void) mp = vfs_mount_alloc(NULLVP, vfsp, "/dev", td->td_ucred); - error = VFS_MOUNT(mp, td); + error = VFS_MOUNT(mp); KASSERT(error == 0, ("VFS_MOUNT(devfs) failed %d", error)); if (error) return; @@ -1525,7 +1524,7 @@ devfs_first(void) TAILQ_INSERT_HEAD(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); - set_rootvnode(td); + set_rootvnode(); error = kern_symlink(td, "/", "dev", UIO_SYSSPACE); if (error) @@ -1551,7 +1550,7 @@ devfs_fixup(struct thread *td) mtx_unlock(&mountlist_mtx); cache_purgevfs(mp); - VFS_ROOT(mp, LK_EXCLUSIVE, &dvp, td); + VFS_ROOT(mp, LK_EXCLUSIVE, &dvp); VI_LOCK(dvp); dvp->v_iflag &= ~VI_MOUNT; VI_UNLOCK(dvp); @@ -1559,7 +1558,7 @@ devfs_fixup(struct thread *td) /* Set up the real rootvnode, and purge the cache */ TAILQ_FIRST(&mountlist)->mnt_vnodecovered = NULL; - set_rootvnode(td); + set_rootvnode(); cache_purgevfs(rootvnode->v_mount); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev", td); @@ -2176,11 +2175,11 @@ __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp) int -__vfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +__vfs_statfs(struct mount *mp, struct statfs *sbp) { int error; - error = mp->mnt_op->vfs_statfs(mp, &mp->mnt_stat, td); + error = mp->mnt_op->vfs_statfs(mp, &mp->mnt_stat); if (sbp != &mp->mnt_stat) *sbp = mp->mnt_stat; return (error); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index fcaf5140c691..8c26b13139bd 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2404,7 +2404,7 @@ vflush( struct mount *mp, int rootrefs, int flags, struct thread *td) * Get the filesystem root vnode. We can vput() it * immediately, since with rootrefs > 0, it won't go away. */ - if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rootvp, td)) != 0) { + if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rootvp)) != 0) { CTR2(KTR_VFS, "%s: vfs_root lookup failed with %d", __func__, error); return (error); @@ -3448,7 +3448,7 @@ sync_fsync(struct vop_fsync_args *ap) mp->mnt_kern_flag &= ~MNTK_ASYNC; MNT_IUNLOCK(mp); vfs_msync(mp, MNT_NOWAIT); - error = VFS_SYNC(mp, MNT_LAZY, ap->a_td); + error = VFS_SYNC(mp, MNT_LAZY); MNT_ILOCK(mp); mp->mnt_noasync--; if ((mp->mnt_flag & MNT_ASYNC) != 0 && mp->mnt_noasync == 0) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 202f2d119d59..98fbf1fc4dfb 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -146,7 +146,7 @@ sync(td, uap) mp->mnt_kern_flag &= ~MNTK_ASYNC; MNT_IUNLOCK(mp); vfs_msync(mp, MNT_NOWAIT); - VFS_SYNC(mp, MNT_NOWAIT, td); + VFS_SYNC(mp, MNT_NOWAIT); MNT_ILOCK(mp); mp->mnt_noasync--; if ((mp->mnt_flag & MNT_ASYNC) != 0 && @@ -215,7 +215,7 @@ quotactl(td, uap) VFS_UNLOCK_GIANT(vfslocked); return (error); } - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, td); + error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg); vfs_unbusy(mp); VFS_UNLOCK_GIANT(vfslocked); return (error); @@ -326,7 +326,7 @@ kern_statfs(struct thread *td, char *path, enum uio_seg pathseg, sp->f_version = STATFS_VERSION; sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - error = VFS_STATFS(mp, sp, td); + error = VFS_STATFS(mp, sp); if (error) goto out; if (priv_check(td, PRIV_VFS_GENERATION)) { @@ -415,7 +415,7 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf) sp->f_version = STATFS_VERSION; sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - error = VFS_STATFS(mp, sp, td); + error = VFS_STATFS(mp, sp); if (error) goto out; if (priv_check(td, PRIV_VFS_GENERATION)) { @@ -522,7 +522,7 @@ kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, */ if (((flags & (MNT_LAZY|MNT_NOWAIT)) == 0 || (flags & MNT_WAIT)) && - (error = VFS_STATFS(mp, sp, td))) { + (error = VFS_STATFS(mp, sp))) { VFS_UNLOCK_GIANT(vfslocked); mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); @@ -766,7 +766,7 @@ fchdir(td, uap) if (vfs_busy(mp, 0)) continue; tvfslocked = VFS_LOCK_GIANT(mp); - error = VFS_ROOT(mp, LK_SHARED, &tdp, td); + error = VFS_ROOT(mp, LK_SHARED, &tdp); vfs_unbusy(mp); if (error) { VFS_UNLOCK_GIANT(tvfslocked); @@ -4638,7 +4638,7 @@ kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf) sp->f_version = STATFS_VERSION; sp->f_namemax = NAME_MAX; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - error = VFS_STATFS(mp, sp, td); + error = VFS_STATFS(mp, sp); if (error == 0) *buf = *sp; out: diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 00082093431d..3cc6f22bfd80 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1107,7 +1107,6 @@ int vfs_write_suspend(mp) struct mount *mp; { - struct thread *td = curthread; int error; MNT_ILOCK(mp); @@ -1124,7 +1123,7 @@ vfs_write_suspend(mp) MNT_MTX(mp), (PUSER - 1)|PDROP, "suspwt", 0); else MNT_IUNLOCK(mp); - if ((error = VFS_SYNC(mp, MNT_SUSPEND, td)) != 0) + if ((error = VFS_SYNC(mp, MNT_SUSPEND)) != 0) vfs_write_resume(mp); return (error); } diff --git a/sys/nfs4client/nfs4_vfsops.c b/sys/nfs4client/nfs4_vfsops.c index 8980cef42709..808b63d9116a 100644 --- a/sys/nfs4client/nfs4_vfsops.c +++ b/sys/nfs4client/nfs4_vfsops.c @@ -185,9 +185,10 @@ nfs4_uninit(struct vfsconf *vfsp) * nfs statfs call */ static int -nfs4_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) +nfs4_statfs(struct mount *mp, struct statfs *sbp) { struct vnode *vp; + struct thread *td; struct nfs_statfs *sfp; caddr_t bpos, dpos; struct nfsmount *nmp = VFSTONFS(mp); @@ -198,6 +199,7 @@ nfs4_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) struct nfs4_oparg_getattr ga; struct nfsv4_fattr *fap = &ga.fa; + td = curthread; #ifndef nolint sfp = NULL; #endif @@ -393,7 +395,7 @@ nfs4_decode_args(struct nfsmount *nmp, struct nfs_args *argp) */ /* ARGSUSED */ static int -nfs4_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +nfs4_cmount(struct mntarg *ma, void *data, int flags) { struct nfs_args args; int error; @@ -407,7 +409,7 @@ nfs4_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) } static int -nfs4_mount(struct mount *mp, struct thread *td) +nfs4_mount(struct mount *mp) { int error; struct nfs_args args; @@ -451,7 +453,7 @@ nfs4_mount(struct mount *mp, struct thread *td) error = getsockaddr(&nam, (caddr_t)args.addr, args.addrlen); if (error) return (error); - error = mountnfs(&args, mp, nam, hst, &vp, td->td_ucred); + error = mountnfs(&args, mp, nam, hst, &vp, curthread->td_ucred); return (error); } @@ -669,7 +671,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, * unmount system call */ static int -nfs4_unmount(struct mount *mp, int mntflags, struct thread *td) +nfs4_unmount(struct mount *mp, int mntflags) { struct nfsmount *nmp; int error, flags = 0; @@ -679,7 +681,7 @@ nfs4_unmount(struct mount *mp, int mntflags, struct thread *td) nmp = VFSTONFS(mp); /* * Goes something like this.. - * - Call vflush(, td) to clear out vnodes for this filesystem + * - Call vflush to clear out vnodes for this filesystem * - Close the socket * - Free up the data structures */ @@ -691,7 +693,7 @@ nfs4_unmount(struct mount *mp, int mntflags, struct thread *td) nfs4dev_purge(); } - error = vflush(mp, 0, flags, td); + error = vflush(mp, 0, flags, curthread); if (error) return (error); @@ -713,7 +715,7 @@ nfs4_unmount(struct mount *mp, int mntflags, struct thread *td) * Return root of a filesystem */ static int -nfs4_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) +nfs4_root(struct mount *mp, int flags, struct vnode **vpp) { struct vnode *vp; struct nfsmount *nmp; @@ -738,11 +740,14 @@ nfs4_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) * Flush out the buffer cache */ static int -nfs4_sync(struct mount *mp, int waitfor, struct thread *td) +nfs4_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/nfsclient/nfs.h b/sys/nfsclient/nfs.h index 4dce2fe03464..7f3a0f311650 100644 --- a/sys/nfsclient/nfs.h +++ b/sys/nfsclient/nfs.h @@ -307,7 +307,7 @@ enum nfs_rto_timer_t { vfs_init_t nfs_init; vfs_uninit_t nfs_uninit; -int nfs_mountroot(struct mount *mp, struct thread *td); +int nfs_mountroot(struct mount *mp); #ifdef NFS_LEGACYRPC #ifndef NFS4_USE_RPCCLNT diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 9118d302e39a..d8ce36c1584e 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -256,9 +256,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 nfs_statfs *sfp; caddr_t bpos, dpos; struct nfsmount *nmp = VFSTONFS(mp); @@ -267,6 +268,7 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) struct nfsnode *np; u_quad_t tquad; + td = curthread; #ifndef nolint sfp = NULL; #endif @@ -411,8 +413,9 @@ nfs_fsinfo(struct nfsmount *nmp, struct vnode *vp, struct ucred *cred, * client activity occurs. */ int -nfs_mountroot(struct mount *mp, struct thread *td) +nfs_mountroot(struct mount *mp) { + struct thread *td = curthread; INIT_VPROCG(TD_TO_VPROCG(td)); struct nfsv3_diskless *nd = &nfsv3_diskless; struct socket *so; @@ -799,7 +802,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, @@ -846,7 +849,7 @@ nfs_mount(struct mount *mp, struct thread *td) } if ((mp->mnt_flag & (MNT_ROOTFS | MNT_UPDATE)) == MNT_ROOTFS) { - error = nfs_mountroot(mp, td); + error = nfs_mountroot(mp); goto out; } @@ -1131,7 +1134,8 @@ nfs_mount(struct mount *mp, struct thread *td) } } } - error = mountnfs(&args, mp, nam, args.hostname, &vp, td->td_ucred); + error = mountnfs(&args, mp, nam, args.hostname, &vp, + curthread->td_ucred); out: if (!error) { MNT_ILOCK(mp); @@ -1153,7 +1157,7 @@ nfs_mount(struct mount *mp, struct thread *td) */ /* 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; @@ -1298,7 +1302,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, * unmount system call */ static int -nfs_unmount(struct mount *mp, int mntflags, struct thread *td) +nfs_unmount(struct mount *mp, int mntflags) { struct nfsmount *nmp; int error, flags = 0; @@ -1319,7 +1323,7 @@ nfs_unmount(struct mount *mp, int mntflags, struct thread *td) goto out; } /* We hold 1 extra ref on the root vnode; see comment in mountnfs(). */ - error = vflush(mp, 1, flags, td); + error = vflush(mp, 1, flags, curthread); if (error) goto out; @@ -1339,7 +1343,7 @@ nfs_unmount(struct mount *mp, int mntflags, struct thread *td) * 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; @@ -1373,11 +1377,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/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 5c52da6caa18..b6a61a82e8a6 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -3988,7 +3988,7 @@ nfsrv_statfs(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, goto nfsmout; } sf = &statfs; - error = VFS_STATFS(vp->v_mount, sf, curthread); + error = VFS_STATFS(vp->v_mount, sf); getret = VOP_GETATTR(vp, &at, cred); vput(vp); vp = NULL; @@ -4083,7 +4083,7 @@ nfsrv_fsinfo(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, } /* XXX Try to make a guess on the max file size. */ - VFS_STATFS(vp->v_mount, &sb, curthread); + VFS_STATFS(vp->v_mount, &sb); maxfsize = (u_quad_t)0x80000000 * sb.f_bsize - 1; getret = VOP_GETATTR(vp, &at, cred); diff --git a/sys/security/audit/audit_worker.c b/sys/security/audit/audit_worker.c index 191d583f4d74..631b29ffb34f 100644 --- a/sys/security/audit/audit_worker.c +++ b/sys/security/audit/audit_worker.c @@ -131,7 +131,7 @@ audit_record_write(struct vnode *vp, struct ucred *cred, void *data, * that we know how we're doing on space. Consider failure of these * operations to indicate a future inability to write to the file. */ - error = VFS_STATFS(vp->v_mount, mnt_stat, curthread); + error = VFS_STATFS(vp->v_mount, mnt_stat); if (error) goto fail; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 45f21bc87607..ca90b19cc7d2 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -554,15 +554,12 @@ struct nameidata; struct sysctl_req; struct mntarg; -typedef int vfs_cmount_t(struct mntarg *ma, void *data, int flags, struct thread *td); -typedef int vfs_unmount_t(struct mount *mp, int mntflags, struct thread *td); -typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp, - struct thread *td); -typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, - void *arg, struct thread *td); -typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp, - struct thread *td); -typedef int vfs_sync_t(struct mount *mp, int waitfor, struct thread *td); +typedef int vfs_cmount_t(struct mntarg *ma, void *data, int flags); +typedef int vfs_unmount_t(struct mount *mp, int mntflags); +typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp); +typedef int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg); +typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp); +typedef int vfs_sync_t(struct mount *mp, int waitfor); typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags, struct vnode **vpp); typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp); @@ -573,8 +570,8 @@ typedef int vfs_init_t(struct vfsconf *); typedef int vfs_uninit_t(struct vfsconf *); typedef int vfs_extattrctl_t(struct mount *mp, int cmd, struct vnode *filename_vp, int attrnamespace, - const char *attrname, struct thread *td); -typedef int vfs_mount_t(struct mount *mp, struct thread *td); + const char *attrname); +typedef int vfs_mount_t(struct mount *mp); typedef int vfs_sysctl_t(struct mount *mp, fsctlop_t op, struct sysctl_req *req); typedef void vfs_susp_clean_t(struct mount *mp); @@ -599,21 +596,22 @@ struct vfsops { vfs_statfs_t __vfs_statfs; -#define VFS_MOUNT(MP, P) (*(MP)->mnt_op->vfs_mount)(MP, P) -#define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P) -#define VFS_ROOT(MP, FLAGS, VPP, P) \ - (*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP, P) -#define VFS_QUOTACTL(MP,C,U,A,P) (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P) -#define VFS_STATFS(MP, SBP, P) __vfs_statfs((MP), (SBP), (P)) -#define VFS_SYNC(MP, WAIT, P) (*(MP)->mnt_op->vfs_sync)(MP, WAIT, P) +#define VFS_MOUNT(MP) (*(MP)->mnt_op->vfs_mount)(MP) +#define VFS_UNMOUNT(MP, FORCE) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE) +#define VFS_ROOT(MP, FLAGS, VPP) \ + (*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP) +#define VFS_QUOTACTL(MP, C, U, A) \ + (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A) +#define VFS_STATFS(MP, SBP) __vfs_statfs((MP), (SBP)) +#define VFS_SYNC(MP, WAIT) (*(MP)->mnt_op->vfs_sync)(MP, WAIT) #define VFS_VGET(MP, INO, FLAGS, VPP) \ (*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP) #define VFS_FHTOVP(MP, FIDP, VPP) \ (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP) #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) \ (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC, SEC) -#define VFS_EXTATTRCTL(MP, C, FN, NS, N, P) \ - (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N, P) +#define VFS_EXTATTRCTL(MP, C, FN, NS, N) \ + (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N) #define VFS_SYSCTL(MP, OP, REQ) \ (*(MP)->mnt_op->vfs_sysctl)(MP, OP, REQ) #define VFS_SUSP_CLEAN(MP) \ diff --git a/sys/sys/param.h b/sys/sys/param.h index 7c77b9370ae4..3aea1012a2f9 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800086 /* Master, propagated to newvers */ +#define __FreeBSD_version 800087 /* Master, propagated to newvers */ #ifndef LOCORE #include diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 94752c7bc832..c5c13289ba75 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -132,9 +132,10 @@ static const char *ffs_opts[] = { "acls", "async", "noatime", "noclusterr", "union", NULL }; static int -ffs_mount(struct mount *mp, struct thread *td) +ffs_mount(struct mount *mp) { struct vnode *devvp; + struct thread *td; struct ufsmount *ump = 0; struct fs *fs; int error, flags; @@ -143,6 +144,7 @@ ffs_mount(struct mount *mp, struct thread *td) struct nameidata ndp; char *fspec; + td = curthread; if (vfs_filteropt(mp->mnt_optnew, ffs_opts)) return (EINVAL); if (uma_inode == NULL) { @@ -213,7 +215,7 @@ ffs_mount(struct mount *mp, struct thread *td) * ignore the suspension to * synchronize on-disk state. */ - curthread->td_pflags |= TDP_IGNSUSP; + td->td_pflags |= TDP_IGNSUSP; break; } MNT_IUNLOCK(mp); @@ -431,7 +433,7 @@ ffs_mount(struct mount *mp, struct thread *td) */ static int -ffs_cmount(struct mntarg *ma, void *data, int flags, struct thread *td) +ffs_cmount(struct mntarg *ma, void *data, int flags) { struct ufs_args args; int error; @@ -1025,11 +1027,11 @@ ffs_oldfscompat_write(fs, ump) * unmount system call */ static int -ffs_unmount(mp, mntflags, td) +ffs_unmount(mp, mntflags) struct mount *mp; int mntflags; - struct thread *td; { + struct thread *td; struct ufsmount *ump = VFSTOUFS(mp); struct fs *fs; int error, flags, susp; @@ -1038,6 +1040,7 @@ ffs_unmount(mp, mntflags, td) #endif flags = 0; + td = curthread; fs = ump->um_fs; if (mntflags & MNT_FORCE) { flags |= FORCECLOSE; @@ -1069,7 +1072,7 @@ ffs_unmount(mp, mntflags, td) MNTK_SUSPEND2); wakeup(&mp->mnt_flag); MNT_IUNLOCK(mp); - curthread->td_pflags |= TDP_IGNSUSP; + td->td_pflags |= TDP_IGNSUSP; break; } MNT_IUNLOCK(mp); @@ -1199,10 +1202,9 @@ ffs_flushfiles(mp, flags, td) * Get filesystem statistics. */ static int -ffs_statfs(mp, sbp, td) +ffs_statfs(mp, sbp) struct mount *mp; struct statfs *sbp; - struct thread *td; { struct ufsmount *ump; struct fs *fs; @@ -1235,12 +1237,12 @@ ffs_statfs(mp, sbp, td) * Note: we are always called with the filesystem marked `MPBUSY'. */ static int -ffs_sync(mp, waitfor, td) +ffs_sync(mp, waitfor) struct mount *mp; int waitfor; - struct thread *td; { struct vnode *mvp, *vp, *devvp; + struct thread *td; struct inode *ip; struct ufsmount *ump = VFSTOUFS(mp); struct fs *fs; @@ -1253,6 +1255,7 @@ ffs_sync(mp, waitfor, td) int softdep_accdeps; struct bufobj *bo; + td = curthread; fs = ump->um_fs; if (fs->fs_fmod != 0 && fs->fs_ronly != 0) { /* XXX */ printf("fs = %s\n", fs->fs_fsmnt); @@ -1698,15 +1701,15 @@ ffs_sbupdate(mp, waitfor, suspended) static int ffs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, - int attrnamespace, const char *attrname, struct thread *td) + int attrnamespace, const char *attrname) { #ifdef UFS_EXTATTR return (ufs_extattrctl(mp, cmd, filename_vp, attrnamespace, - attrname, td)); + attrname)); #else return (vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, - attrname, td)); + attrname)); #endif } diff --git a/sys/ufs/ufs/extattr.h b/sys/ufs/ufs/extattr.h index 5d26bf6cd552..3716ec27309a 100644 --- a/sys/ufs/ufs/extattr.h +++ b/sys/ufs/ufs/extattr.h @@ -143,7 +143,7 @@ int ufs_extattr_start(struct mount *mp, struct thread *td); int ufs_extattr_autostart(struct mount *mp, struct thread *td); int ufs_extattr_stop(struct mount *mp, struct thread *td); int ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename, - int attrnamespace, const char *attrname, struct thread *td); + int attrnamespace, const char *attrname); int ufs_getextattr(struct vop_getextattr_args *ap); int ufs_deleteextattr(struct vop_deleteextattr_args *ap); int ufs_setextattr(struct vop_setextattr_args *ap); diff --git a/sys/ufs/ufs/ufs_extattr.c b/sys/ufs/ufs/ufs_extattr.c index d034bee1f500..032d9cc34211 100644 --- a/sys/ufs/ufs/ufs_extattr.c +++ b/sys/ufs/ufs/ufs_extattr.c @@ -93,8 +93,10 @@ static int ufs_extattr_set(struct vnode *vp, int attrnamespace, struct thread *td); static int ufs_extattr_rm(struct vnode *vp, int attrnamespace, const char *name, struct ucred *cred, struct thread *td); +#ifdef UFS_EXTATTR_AUTOSTART static int ufs_extattr_autostart_locked(struct mount *mp, struct thread *td); +#endif static int ufs_extattr_start_locked(struct ufsmount *ump, struct thread *td); @@ -478,7 +480,7 @@ ufs_extattr_autostart_locked(struct mount *mp, struct thread *td) * Does UFS_EXTATTR_FSROOTSUBDIR exist off the filesystem root? * If so, automatically start EA's. */ - error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp, td); + error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp); if (error) { printf("ufs_extattr_autostart.VFS_ROOT() returned %d\n", error); @@ -714,9 +716,10 @@ ufs_extattr_disable(struct ufsmount *ump, int attrnamespace, */ int ufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, - int attrnamespace, const char *attrname, struct thread *td) + int attrnamespace, const char *attrname) { struct ufsmount *ump = VFSTOUFS(mp); + struct thread *td = curthread; int error; /* diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index ac1fbcf71070..f6b6b1e2ef8c 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -66,11 +66,10 @@ MALLOC_DEFINE(M_UFSMNT, "ufs_mount", "UFS mount structure"); * Return the root of a filesystem. */ int -ufs_root(mp, flags, vpp, td) +ufs_root(mp, flags, vpp) struct mount *mp; int flags; struct vnode **vpp; - struct thread *td; { struct vnode *nvp; int error; @@ -86,18 +85,19 @@ ufs_root(mp, flags, vpp, td) * Do operations associated with quotas */ int -ufs_quotactl(mp, cmds, id, arg, td) +ufs_quotactl(mp, cmds, id, arg) struct mount *mp; int cmds; uid_t id; void *arg; - struct thread *td; { #ifndef QUOTA return (EOPNOTSUPP); #else + struct thread *td; int cmd, type, error; + td = curthread; cmd = cmds >> SUBCMDSHIFT; type = cmds & SUBCMDMASK; if (id == -1) {