From 7e1d3eefd410ca0fbae5a217422821244c3eeee4 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Thu, 25 Nov 2021 21:43:06 +0000 Subject: [PATCH] vfs: remove the unused thread argument from NDINIT* See b4a58fbf640409a1 ("vfs: remove cn_thread") Bump __FreeBSD_version to 1400043. --- sys/cam/ctl/ctl_backend_block.c | 2 +- sys/compat/linprocfs/linprocfs.c | 4 +- sys/compat/linux/linux_misc.c | 4 +- .../module/os/freebsd/zfs/zfs_vnops_os.c | 9 ++- sys/dev/beri/virtio/virtio_block.c | 3 +- sys/dev/md/md.c | 2 +- sys/dev/veriexec/verified_exec.c | 3 +- sys/dev/xen/blkback/blkback.c | 2 +- sys/fs/cd9660/cd9660_vfsops.c | 2 +- sys/fs/ext2fs/ext2_vfsops.c | 2 +- sys/fs/fuse/fuse_vfsops.c | 2 +- sys/fs/msdosfs/msdosfs_vfsops.c | 2 +- sys/fs/nfs/nfs_commonport.c | 5 +- sys/fs/nfsserver/nfs_nfsdport.c | 3 +- sys/fs/nfsserver/nfs_nfsdstate.c | 12 ++-- sys/fs/nullfs/null_vfsops.c | 2 +- sys/fs/udf/udf_vfsops.c | 2 +- sys/fs/unionfs/union_vfsops.c | 2 +- sys/kern/imgact_elf.c | 2 +- sys/kern/kern_acct.c | 4 +- sys/kern/kern_alq.c | 4 +- sys/kern/kern_ctf.c | 2 +- sys/kern/kern_exec.c | 2 +- sys/kern/kern_jail.c | 3 +- sys/kern/kern_ktrace.c | 2 +- sys/kern/kern_linker.c | 4 +- sys/kern/kern_proc.c | 3 +- sys/kern/kern_sig.c | 4 +- sys/kern/link_elf.c | 2 +- sys/kern/link_elf_obj.c | 2 +- sys/kern/uipc_usrreq.c | 6 +- sys/kern/vfs_acl.c | 8 +-- sys/kern/vfs_cache.c | 5 +- sys/kern/vfs_default.c | 2 +- sys/kern/vfs_extattr.c | 16 ++--- sys/kern/vfs_lookup.c | 7 +-- sys/kern/vfs_mount.c | 6 +- sys/kern/vfs_mountroot.c | 11 ++-- sys/kern/vfs_subr.c | 2 +- sys/kern/vfs_syscalls.c | 63 +++++++++---------- sys/security/audit/audit_syscalls.c | 4 +- sys/security/mac/mac_syscalls.c | 4 +- sys/security/mac_veriexec/mac_veriexec.c | 2 +- sys/sys/namei.h | 18 +++--- sys/sys/param.h | 2 +- sys/ufs/ffs/ffs_snapshot.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 2 +- sys/ufs/ufs/ufs_quota.c | 2 +- sys/vm/swap_pager.c | 5 +- 49 files changed, 123 insertions(+), 141 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 8c126d8be229..ae558e496514 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -2232,7 +2232,7 @@ ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req) flags |= FWRITE; again: - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, be_lun->dev_path, curthread); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, be_lun->dev_path); error = vn_open(&nd, &flags, 0, NULL); if ((error == EROFS || error == EACCES) && (flags & FWRITE)) { flags &= ~FWRITE; diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 16755402bb7b..09144350a8ee 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -482,7 +482,7 @@ linprocfs_domtab(PFS_FILL_ARGS) * Ideally, this would use the current chroot rather than some * hardcoded path. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path); flep = NULL; error = namei(&nd); lep = linux_emul_path; @@ -539,7 +539,7 @@ linprocfs_doprocmountinfo(PFS_FILL_ARGS) * Ideally, this would use the current chroot rather than some * hardcoded path. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path); flep = NULL; error = namei(&nd); lep = linux_emul_path; diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 7960f8b80fa1..a7502465efbf 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -276,12 +276,12 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args) if (!LUSECONVPATH(td)) { NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_USERSPACE, args->library, td); + UIO_USERSPACE, args->library); error = namei(&ni); } else { LCONVPATHEXIST(args->library, &library); NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_SYSSPACE, library, td); + UIO_SYSSPACE, library); error = namei(&ni); LFREEPATH(library); } diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 2886eef0a2c5..11bbda5452a1 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -5345,8 +5345,7 @@ zfs_getextattr_dir(struct vop_getextattr_args *ap, const char *attrname) return (error); flags = FREAD; - NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, - xvp, td); + NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp); error = vn_open_cred(&nd, &flags, 0, VN_OPEN_INVFS, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); @@ -5460,7 +5459,7 @@ zfs_deleteextattr_dir(struct vop_deleteextattr_args *ap, const char *attrname) return (error); NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF, - UIO_SYSSPACE, attrname, xvp, ap->a_td); + UIO_SYSSPACE, attrname, xvp); error = namei(&nd); vp = nd.ni_vp; if (error != 0) { @@ -5588,7 +5587,7 @@ zfs_setextattr_dir(struct vop_setextattr_args *ap, const char *attrname) return (error); flags = FFLAGS(O_WRONLY | O_CREAT); - NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); + NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp); error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred, NULL); vp = nd.ni_vp; @@ -5744,7 +5743,7 @@ zfs_listextattr_dir(struct vop_listextattr_args *ap, const char *attrprefix) } NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED, - UIO_SYSSPACE, ".", xvp, td); + UIO_SYSSPACE, ".", xvp); error = namei(&nd); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); diff --git a/sys/dev/beri/virtio/virtio_block.c b/sys/dev/beri/virtio/virtio_block.c index ca11e46e9268..45c086f0e0bf 100644 --- a/sys/dev/beri/virtio/virtio_block.c +++ b/sys/dev/beri/virtio/virtio_block.c @@ -241,8 +241,7 @@ open_file(struct beri_vtblk_softc *sc, struct thread *td) int flags; flags = (FREAD | FWRITE); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, - sc->mdio->md_file, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->mdio->md_file); error = vn_open(&nd, &flags, 0, NULL); if (error != 0) return (error); diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 92d93f0f0f1d..f88b82aacb78 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1428,7 +1428,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) */ flags = FREAD | ((mdr->md_options & MD_READONLY) ? 0 : FWRITE) \ | ((mdr->md_options & MD_VERIFY) ? O_VERIFY : 0); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->file); error = vn_open(&nd, &flags, 0, NULL); if (error != 0) return (error); diff --git a/sys/dev/veriexec/verified_exec.c b/sys/dev/veriexec/verified_exec.c index d6fabf825212..1cb3cd75dbbe 100644 --- a/sys/dev/veriexec/verified_exec.c +++ b/sys/dev/veriexec/verified_exec.c @@ -196,8 +196,7 @@ verifiedexecioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, /* * FreeBSD seems to copy the args to kernel space */ - NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, - params->file, td); + NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, params->file); if ((error = vn_open(&nid, &flags, 0, NULL)) != 0) return (error); diff --git a/sys/dev/xen/blkback/blkback.c b/sys/dev/xen/blkback/blkback.c index 010e737740b8..6a4e8007f6b9 100644 --- a/sys/dev/xen/blkback/blkback.c +++ b/sys/dev/xen/blkback/blkback.c @@ -2683,7 +2683,7 @@ xbb_open_backend(struct xbb_softc *xbb) pwd_ensure_dirs(); again: - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, xbb->dev_name, curthread); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, xbb->dev_name); error = vn_open(&nd, &flags, 0, NULL); if (error) { /* diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 5d475bec93b8..606938c6faf5 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -159,7 +159,7 @@ cd9660_mount(struct mount *mp) * 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, fspec, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec); if ((error = namei(&ndp))) return (error); NDFREE(&ndp, NDF_ONLY_PNBUF); diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index b39d04649d17..65f429949f55 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -240,7 +240,7 @@ ext2_mount(struct mount *mp) */ if (fspec == NULL) return (EINVAL); - NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); + NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec); if ((error = namei(ndp)) != 0) return (error); NDFREE(ndp, NDF_ONLY_PNBUF); diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c index 3d5e168bcde2..7405f477fea4 100644 --- a/sys/fs/fuse/fuse_vfsops.c +++ b/sys/fs/fuse/fuse_vfsops.c @@ -149,7 +149,7 @@ fuse_getdevice(const char *fspec, struct thread *td, struct cdev **fdevp) * and verify that it refers to a sensible disk device. */ - NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td); + NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec); if ((err = namei(ndp)) != 0) return err; NDFREE(ndp, NDF_ONLY_PNBUF); diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 0f6d41b3c77c..32cc81c52ffd 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -344,7 +344,7 @@ msdosfs_mount(struct mount *mp) */ if (vfs_getopt(mp->mnt_optnew, "from", (void **)&from, NULL)) return (EINVAL); - NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from); error = namei(&ndp); if (error) return (error); diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c index 8a100749fc32..cd44698343d7 100644 --- a/sys/fs/nfs/nfs_commonport.c +++ b/sys/fs/nfs/nfs_commonport.c @@ -239,12 +239,11 @@ nfsrv_object_create(struct vnode *vp, struct thread *td) * Look up a file name. Basically just initialize stuff and call namei(). */ int -nfsrv_lookupfilename(struct nameidata *ndp, char *fname, NFSPROC_T *p) +nfsrv_lookupfilename(struct nameidata *ndp, char *fname, NFSPROC_T *p __unused) { int error; - NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, fname, - p); + NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, fname); error = namei(ndp); if (!error) { NDFREE(ndp, NDF_ONLY_PNBUF); diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index add13aca1d90..78151309896c 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -3468,8 +3468,7 @@ nfsrv_v4rootexport(void *argp, struct ucred *cred, struct thread *p) /* * If fspec != NULL, this is the v4root path. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, - nfsexargp->fspec, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, nfsexargp->fspec); if ((error = namei(&nd)) != 0) goto out; error = nfsvno_getfh(nd.ni_vp, &fh, p); diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index e9acacb27cbd..360bc00b8df3 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -7644,7 +7644,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p, NFSD_DEBUG(4, "setdssrv path=%s\n", dspathp); *dsp = NULL; NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, - dspathp, p); + dspathp); error = namei(&nd); NFSD_DEBUG(4, "lookup=%d\n", error); if (error != 0) @@ -7680,7 +7680,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p, for (i = 0; i < nfsrv_dsdirsize; i++) { snprintf(dsdirpath, dsdirsize, "%s/ds%d", dspathp, i); NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, - UIO_SYSSPACE, dsdirpath, p); + UIO_SYSSPACE, dsdirpath); error = namei(&nd); NFSD_DEBUG(4, "dsdirpath=%s lookup=%d\n", dsdirpath, error); if (error != 0) @@ -7708,7 +7708,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p, * system. */ NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, - UIO_SYSSPACE, mdspathp, p); + UIO_SYSSPACE, mdspathp); error = namei(&nd); NFSD_DEBUG(4, "mds lookup=%d\n", error); if (error != 0) @@ -8567,7 +8567,7 @@ nfsrv_mdscopymr(char *mdspathp, char *dspathp, char *curdspathp, char *buf, */ NFSD_DEBUG(4, "mdsopen path=%s\n", mdspathp); NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, - mdspathp, p); + mdspathp); error = namei(&nd); NFSD_DEBUG(4, "lookup=%d\n", error); if (error != 0) @@ -8586,7 +8586,7 @@ nfsrv_mdscopymr(char *mdspathp, char *dspathp, char *curdspathp, char *buf, */ NFSD_DEBUG(4, "curmdsdev path=%s\n", curdspathp); NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, - UIO_SYSSPACE, curdspathp, p); + UIO_SYSSPACE, curdspathp); error = namei(&nd); NFSD_DEBUG(4, "ds lookup=%d\n", error); if (error != 0) { @@ -8626,7 +8626,7 @@ nfsrv_mdscopymr(char *mdspathp, char *dspathp, char *curdspathp, char *buf, /* Look up the nfsdev path and find the nfsdev structure. */ NFSD_DEBUG(4, "mdsdev path=%s\n", dspathp); NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, - UIO_SYSSPACE, dspathp, p); + UIO_SYSSPACE, dspathp); error = namei(&nd); NFSD_DEBUG(4, "ds lookup=%d\n", error); if (error != 0) { diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 73301c9275d2..1dba5f51d619 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -125,7 +125,7 @@ nullfs_mount(struct mount *mp) * Find lower node */ ndp = &nd; - NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread); + NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target); error = namei(ndp); /* diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index 132f4e7703d7..37554582ef1b 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -227,7 +227,7 @@ udf_mount(struct mount *mp) /* Check that the mount device exists */ if (fspec == NULL) return (EINVAL); - NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); + NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec); if ((error = namei(ndp))) return (error); NDFREE(ndp, NDF_ONLY_PNBUF); diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 5096d46bea58..da9b3cce46f3 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -234,7 +234,7 @@ unionfs_domount(struct mount *mp) /* * Find upper node */ - NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target, td); + NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target); if ((error = namei(ndp))) return (error); diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index c7c131da184c..7e970c0215b6 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -800,7 +800,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr, imgp->attr = attr; NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF, - UIO_SYSSPACE, file, curthread); + UIO_SYSSPACE, file); if ((error = namei(nd)) != 0) { nd->ni_vp = NULL; goto fail; diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index ad272676083e..7a3ff1700b66 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -216,8 +216,8 @@ sys_acct(struct thread *td, struct acct_args *uap) * appending and make sure it's a 'normal'. */ if (uap->path != NULL) { - NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, - UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, UIO_USERSPACE, + uap->path); flags = FWRITE | O_APPEND; error = vn_open(&nd, &flags, 0, NULL); if (error) diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 4b30e519d335..4285ddb03b78 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -431,7 +431,6 @@ int alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode, int size, int flags) { - struct thread *td __unused; struct nameidata nd; struct alq *alq; int oflags; @@ -440,9 +439,8 @@ alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmod KASSERT((size > 0), ("%s: size <= 0", __func__)); *alqp = NULL; - td = curthread; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, file); oflags = FWRITE | O_NOFOLLOW | O_CREAT; error = vn_open_cred(&nd, &oflags, cmode, 0, cred, NULL); diff --git a/sys/kern/kern_ctf.c b/sys/kern/kern_ctf.c index ee7576ab6fb9..bd2186693f0b 100644 --- a/sys/kern/kern_ctf.c +++ b/sys/kern/kern_ctf.c @@ -100,7 +100,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc) */ ef->ctfcnt = -1; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, lf->pathname, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, lf->pathname); flags = FREAD; error = vn_open(&nd, &flags, 0, NULL); if (error) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 575771346fd1..b9684833fa0e 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -499,7 +499,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p, */ NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW | SAVENAME | AUDITVNODE1 | WANTPARENT, UIO_SYSSPACE, - args->fname, td); + args->fname); error = namei(&nd); if (error) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index e9019eda4d6c..377539f1d1bd 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -962,8 +962,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = EINVAL; goto done_free; } - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, - path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path); error = namei(&nd); if (error) goto done_free; diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index be0ccfd344fa..5371f73672a0 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1023,7 +1023,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) /* * an operation which requires a file argument. */ - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->fname, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->fname); flags = FREAD | FWRITE | O_NOFOLLOW; error = vn_open(&nd, &flags, 0, NULL); if (error) diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index c0005f2f5cf6..bcdbb467e84e 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1854,7 +1854,7 @@ linker_lookup_file(const char *path, int pathlen, const char *name, * Attempt to open the file, and return the path if * we succeed and it's a regular file. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, result, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, result); flags = FREAD; error = vn_open(&nd, &flags, 0, NULL); if (error == 0) { @@ -1904,7 +1904,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname, snprintf(pathbuf, reclen, "%.*s%s%s", pathlen, path, sep, linker_hintfile); - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, pathbuf, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, pathbuf); flags = FREAD; error = vn_open(&nd, &flags, 0, NULL); if (error) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 21af09265dd2..2f029e261427 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2275,8 +2275,7 @@ proc_get_binpath(struct proc *p, char *binname, char **retbuf, * might have been renamed or replaced, in * which case we should not report old name. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf, - curthread); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf); error = namei(&nd); if (error == 0) { if (nd.ni_vp == vp) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 15d509eca52d..4b036395f133 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3658,7 +3658,7 @@ corefile_open_last(struct thread *td, char *name, int indexpos, i); name[indexpos + indexlen] = ch; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name); error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred, NULL); if (error != 0) @@ -3833,7 +3833,7 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td, if ((td->td_proc->p_flag & P_SUGID) != 0) flags |= O_EXCL; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name); error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred, NULL); if (error == 0) { diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 4114bd46f0c0..075238b91d95 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -972,7 +972,7 @@ link_elf_load_file(linker_class_t cls, const char* filename, lf = NULL; shstrs = NULL; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename); flags = FREAD; error = vn_open(&nd, &flags, 0, NULL); if (error != 0) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index bafbd9f4c616..bb2b7628a60e 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -698,7 +698,7 @@ link_elf_load_file(linker_class_t cls, const char *filename, hdr = NULL; nd = malloc(sizeof(struct nameidata), M_TEMP, M_WAITOK); - NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td); + NDINIT(nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename); flags = FREAD; error = vn_open(nd, &flags, 0, NULL); if (error) { diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index fe018aa65d85..0ec1ba677173 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -637,8 +637,7 @@ uipc_bindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td) restart: NDINIT_ATRIGHTS(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME | NOCACHE, - UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_BINDAT), - td); + UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_BINDAT)); /* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */ error = namei(&nd); if (error) @@ -1570,8 +1569,7 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam, else sa = NULL; NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, - UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_CONNECTAT), - td); + UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_CONNECTAT)); error = namei(&nd); if (error) vp = NULL; diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c index 6bae01bd9d85..ba4c217ae6b9 100644 --- a/sys/kern/vfs_acl.c +++ b/sys/kern/vfs_acl.c @@ -377,7 +377,7 @@ kern___acl_get_path(struct thread *td, const char *path, acl_type_t type, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path); error = namei(&nd); if (error == 0) { error = vacl_get_acl(td, nd.ni_vp, type, aclp); @@ -415,7 +415,7 @@ kern___acl_set_path(struct thread *td, const char *path, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path); error = namei(&nd); if (error == 0) { error = vacl_set_acl(td, nd.ni_vp, type, aclp); @@ -491,7 +491,7 @@ kern___acl_delete_path(struct thread *td, const char *path, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path); error = namei(&nd); if (error == 0) { error = vacl_delete(td, nd.ni_vp, type); @@ -548,7 +548,7 @@ kern___acl_aclcheck_path(struct thread *td, const char *path, acl_type_t type, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path); error = namei(&nd); if (error == 0) { error = vacl_aclcheck(td, nd.ni_vp, type, aclp); diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 4c76244901bb..a34e0dad74a8 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3127,7 +3127,7 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf, if (flags != 0) return (EINVAL); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | SAVENAME | WANTPARENT | AUDITVNODE1, - pathseg, path, fd, &cap_fstat_rights, td); + pathseg, path, fd, &cap_fstat_rights); if ((error = namei(&nd)) != 0) return (error); error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, nd.ni_cnd.cn_nameptr, @@ -3772,8 +3772,7 @@ vn_path_to_global_path(struct thread *td, struct vnode *vp, char *path, * As a side effect, the vnode is relocked. * If vnode was renamed, return ENOENT. */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_SYSSPACE, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_SYSSPACE, path); error = namei(&nd); if (error != 0) { vrele(vp); diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 02fae41e3404..763e9a943f7d 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -846,7 +846,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap) locked = VOP_ISLOCKED(vp); VOP_UNLOCK(vp); NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, - "..", vp, td); + "..", vp); flags = FREAD; error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, cred, NULL); if (error) { diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 43b000c78110..d520e1655cf5 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -102,8 +102,8 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap) mp = NULL; filename_vp = NULL; if (uap->filename != NULL) { - NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE2, - UIO_USERSPACE, uap->filename, td); + NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE2, UIO_USERSPACE, + uap->filename); error = namei(&nd); if (error) return (error); @@ -112,8 +112,8 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap) } /* uap->path is always defined. */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, + uap->path); error = namei(&nd); if (error) goto out; @@ -302,7 +302,7 @@ kern_extattr_set_path(struct thread *td, const char *path, int attrnamespace, return (error); AUDIT_ARG_TEXT(attrname); - NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path); error = namei(&nd); if (error) return (error); @@ -467,7 +467,7 @@ kern_extattr_get_path(struct thread *td, const char *path, int attrnamespace, return (error); AUDIT_ARG_TEXT(attrname); - NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path); error = namei(&nd); if (error) return (error); @@ -599,7 +599,7 @@ kern_extattr_delete_path(struct thread *td, const char *path, int attrnamespace, return(error); AUDIT_ARG_TEXT(attrname); - NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path); error = namei(&nd); if (error) return(error); @@ -742,7 +742,7 @@ kern_extattr_list_path(struct thread *td, const char *path, int attrnamespace, int error; AUDIT_ARG_VALUE(attrnamespace); - NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td); + NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path); error = namei(&nd); if (error) return (error); diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 6ca8ac6de6fc..d5960dd9e920 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1735,13 +1735,13 @@ kern_alternate_path(const char *prefix, const char *path, enum uio_seg pathseg, for (cp = &ptr[len] - 1; *cp != '/'; cp--); *cp = '\0'; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf); error = namei(&nd); *cp = '/'; if (error != 0) goto keeporig; } else { - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf); error = namei(&nd); if (error != 0) @@ -1755,8 +1755,7 @@ kern_alternate_path(const char *prefix, const char *path, enum uio_seg pathseg, * root directory and never finding it, because "/" resolves * to the emulation root directory. This is expensive :-( */ - NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix, - td); + NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix); /* We shouldn't ever get an error from this namei(). */ error = namei(&ndroot); diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 07076bc2f4f7..ee163a5e8137 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1538,8 +1538,8 @@ vfs_domount( /* * Get vnode to be covered or mount point's vnode in case of MNT_UPDATE. */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_SYSSPACE, fspath, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_SYSSPACE, + fspath); error = namei(&nd); if (error != 0) return (error); @@ -1633,7 +1633,7 @@ kern_unmount(struct thread *td, const char *path, int flags) * Try to find global path for path argument. */ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_SYSSPACE, pathbuf, td); + UIO_SYSSPACE, pathbuf); if (namei(&nd) == 0) { NDFREE(&nd, NDF_ONLY_PNBUF); error = vn_path_to_global_path(td, nd.ni_vp, pathbuf, diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index 54d5a442c9ee..9f3959f06b86 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -350,14 +350,13 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) if (mporoot != mpdevfs) { /* Remount old root under /.mount or /mnt */ fspath = "/.mount"; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, - fspath, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspath); error = namei(&nd); if (error) { NDFREE(&nd, NDF_ONLY_PNBUF); fspath = "/mnt"; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, - fspath, td); + fspath); error = namei(&nd); } if (!error) { @@ -386,7 +385,7 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs) } /* Remount devfs under /dev */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev", td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev"); error = namei(&nd); if (!error) { vp = nd.ni_vp; @@ -726,7 +725,7 @@ parse_mount_dev_present(const char *dev) struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev, curthread); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev); error = namei(&nd); if (!error) vput(nd.ni_vp); @@ -949,7 +948,7 @@ vfs_mountroot_readconf(struct thread *td, struct sbuf *sb) ssize_t resid; int error, flags, len; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf", td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf"); flags = FREAD; error = vn_open(&nd, &flags, 0, NULL); if (error) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index cd784cd67961..65a9ebf304fe 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -394,7 +394,7 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS) buf[req->newlen] = '\0'; ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | SAVENAME; - NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf, curthread); + NDINIT(&nd, LOOKUP, ndflags, UIO_SYSSPACE, buf); if ((error = namei(&nd)) != 0) goto out; vp = nd.ni_vp; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 4391853337bd..00da4e7c1b07 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -203,7 +203,7 @@ sys_quotactl(struct thread *td, struct quotactl_args *uap) if (!prison_allow(td->td_ucred, PR_ALLOW_QUOTAS)) return (EPERM); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, - uap->path, td); + uap->path); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -335,7 +335,7 @@ kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path); error = namei(&nd); if (error != 0) return (error); @@ -953,7 +953,7 @@ kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg) int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, - pathseg, path, td); + pathseg, path); if ((error = namei(&nd)) != 0) return (error); if ((error = change_dir(nd.ni_vp, td)) != 0) { @@ -998,7 +998,7 @@ sys_chroot(struct thread *td, struct chroot_args *uap) PROC_UNLOCK(p); } NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, - UIO_USERSPACE, uap->path, td); + UIO_USERSPACE, uap->path); error = namei(&nd); if (error != 0) goto error; @@ -1165,7 +1165,7 @@ kern_openat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, fp->f_flag = flags & FMASK; cmode = ((mode & ~pdp->pd_cmask) & ALLPERMS) & ~S_ISTXT; NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd, - &rights, td); + &rights); td->td_dupfd = -1; /* XXX check for fdopen */ error = vn_open(&nd, &flags, cmode, fp); if (error != 0) { @@ -1357,8 +1357,7 @@ kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | - NOCACHE, pathseg, path, fd, &cap_mknodat_rights, - td); + NOCACHE, pathseg, path, fd, &cap_mknodat_rights); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1466,8 +1465,7 @@ kern_mkfifoat(struct thread *td, int fd, const char *path, restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | - NOCACHE, pathseg, path, fd, &cap_mkfifoat_rights, - td); + NOCACHE, pathseg, path, fd, &cap_mkfifoat_rights); if ((error = namei(&nd)) != 0) return (error); if (nd.ni_vp != NULL) { @@ -1596,7 +1594,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, bwillwrite(); NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH), - segflag, path1, fd1, &cap_linkat_source_rights, td); + segflag, path1, fd1, &cap_linkat_source_rights); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1626,7 +1624,7 @@ kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, const char *path, } NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE2 | NOCACHE, segflag, path, fd, - &cap_linkat_target_rights, td); + &cap_linkat_target_rights); if ((error = namei(&nd)) == 0) { if (nd.ni_vp != NULL) { NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1744,8 +1742,7 @@ kern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2, restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | - NOCACHE, segflg, path2, fd, &cap_symlinkat_rights, - td); + NOCACHE, segflg, path2, fd, &cap_symlinkat_rights); if ((error = namei(&nd)) != 0) goto out; if (nd.ni_vp) { @@ -1809,7 +1806,7 @@ sys_undelete(struct thread *td, struct undelete_args *uap) restart: bwillwrite(); NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1, - UIO_USERSPACE, uap->path, td); + UIO_USERSPACE, uap->path); error = namei(&nd); if (error != 0) return (error); @@ -1924,7 +1921,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH), - pathseg, path, dfd, &cap_unlinkat_rights, td); + pathseg, path, dfd, &cap_unlinkat_rights); if ((error = namei(&nd)) != 0) { if (error == EINVAL) error = EPERM; @@ -2150,7 +2147,7 @@ kern_accessat(struct thread *td, int fd, const char *path, AUDIT_ARG_VALUE(amode); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH | - AT_EMPTY_PATH), pathseg, path, fd, &cap_fstat_rights, td); + AT_EMPTY_PATH), pathseg, path, fd, &cap_fstat_rights); if ((error = namei(&nd)) != 0) goto out; vp = nd.ni_vp; @@ -2446,7 +2443,7 @@ kern_statat(struct thread *td, int flag, int fd, const char *path, NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_RESOLVE_BENEATH | AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) | LOCKSHARED | LOCKLEAF | - AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights, td); + AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights); if ((error = namei(&nd)) != 0) { if (error == ENOTDIR && @@ -2607,7 +2604,7 @@ kern_pathconf(struct thread *td, const char *path, enum uio_seg pathseg, int error; NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | AUDITVNODE1 | flags, - pathseg, path, td); + pathseg, path); if ((error = namei(&nd)) != 0) return (error); NDFREE_NOTHING(&nd); @@ -2662,7 +2659,7 @@ kern_readlinkat(struct thread *td, int fd, const char *path, return (EINVAL); NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1 | - EMPTYPATH, pathseg, path, fd, td); + EMPTYPATH, pathseg, path, fd); if ((error = namei(&nd)) != 0) return (error); @@ -2814,7 +2811,7 @@ kern_chflagsat(struct thread *td, int fd, const char *path, AUDIT_ARG_FFLAGS(flags); NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(atflag, AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path, - fd, &cap_fchflags_rights, td); + fd, &cap_fchflags_rights); if ((error = namei(&nd)) != 0) return (error); NDFREE_NOTHING(&nd); @@ -2945,7 +2942,7 @@ kern_fchmodat(struct thread *td, int fd, const char *path, AUDIT_ARG_MODE(mode); NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path, - fd, &cap_fchmod_rights, td); + fd, &cap_fchmod_rights); if ((error = namei(&nd)) != 0) return (error); NDFREE_NOTHING(&nd); @@ -3057,7 +3054,7 @@ kern_fchownat(struct thread *td, int fd, const char *path, AUDIT_ARG_OWNER(uid, gid); NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path, - fd, &cap_fchown_rights, td); + fd, &cap_fchown_rights); if ((error = namei(&nd)) != 0) return (error); @@ -3274,7 +3271,7 @@ kern_utimesat(struct thread *td, int fd, const char *path, if ((error = getutimes(tptr, tptrseg, ts)) != 0) return (error); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd, - &cap_futimes_rights, td); + &cap_futimes_rights); if ((error = namei(&nd)) != 0) return (error); @@ -3311,7 +3308,7 @@ kern_lutimes(struct thread *td, const char *path, enum uio_seg pathseg, if ((error = getutimes(tptr, tptrseg, ts)) != 0) return (error); - NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, pathseg, path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, pathseg, path); if ((error = namei(&nd)) != 0) return (error); NDFREE_NOTHING(&nd); @@ -3424,7 +3421,7 @@ kern_utimensat(struct thread *td, int fd, const char *path, return (error); NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, - pathseg, path, fd, &cap_futimes_rights, td); + pathseg, path, fd, &cap_futimes_rights); if ((error = namei(&nd)) != 0) return (error); /* @@ -3472,7 +3469,7 @@ kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg, return (EINVAL); NDPREINIT(&nd); retry: - NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -3642,7 +3639,7 @@ kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd, int error; NDINIT_ATRIGHTS(fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART | - AUDITVNODE1, pathseg, old, oldfd, &cap_renameat_source_rights, td); + AUDITVNODE1, pathseg, old, oldfd, &cap_renameat_source_rights); if ((error = namei(fromnd)) != 0) return (error); error = mac_vnode_check_rename_from(td->td_ucred, fromnd->ni_dvp, @@ -3682,7 +3679,7 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, } else { #endif NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | SAVESTART | AUDITVNODE1, - pathseg, old, oldfd, &cap_renameat_source_rights, td); + pathseg, old, oldfd, &cap_renameat_source_rights); if ((error = namei(&fromnd)) != 0) return (error); #ifdef MAC @@ -3693,7 +3690,7 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, if (fromnd.ni_vp->v_type == VDIR) tondflags |= WILLBEDIR; NDINIT_ATRIGHTS(&tond, RENAME, tondflags, pathseg, new, newfd, - &cap_renameat_target_rights, td); + &cap_renameat_target_rights); if ((error = namei(&tond)) != 0) { /* Translate error code for rename("dir1", "dir2/."). */ if (error == EISDIR && fvp->v_type == VDIR) @@ -3837,7 +3834,7 @@ kern_mkdirat(struct thread *td, int fd, const char *path, enum uio_seg segflg, bwillwrite(); NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 | NC_NOMAKEENTRY | NC_KEEPPOSENTRY | FAILIFEXISTS | WILLBEDIR, - segflg, path, fd, &cap_mkdirat_rights, td); + segflg, path, fd, &cap_mkdirat_rights); if ((error = namei(&nd)) != 0) return (error); if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) { @@ -3908,7 +3905,7 @@ kern_frmdirat(struct thread *td, int dfd, const char *path, int fd, bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH), - pathseg, path, dfd, &cap_unlinkat_rights, td); + pathseg, path, dfd, &cap_unlinkat_rights); if ((error = namei(&nd)) != 0) goto fdout; vp = nd.ni_vp; @@ -4280,7 +4277,7 @@ sys_revoke(struct thread *td, struct revoke_args *uap) int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, - uap->path, td); + uap->path); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -4442,7 +4439,7 @@ kern_getfhat(struct thread *td, int flags, int fd, const char *path, return (error); NDINIT_AT(&nd, LOOKUP, at2cnpflags(flags, AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH) | LOCKLEAF | AUDITVNODE1, pathseg, path, - fd, td); + fd); error = namei(&nd); if (error != 0) return (error); diff --git a/sys/security/audit/audit_syscalls.c b/sys/security/audit/audit_syscalls.c index 5f07241109f1..0747d9499e27 100644 --- a/sys/security/audit/audit_syscalls.c +++ b/sys/security/audit/audit_syscalls.c @@ -801,8 +801,8 @@ sys_auditctl(struct thread *td, struct auditctl_args *uap) if (uap->path == NULL) return (EINVAL); - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE, + uap->path); flags = AUDIT_OPEN_FLAGS; error = vn_open(&nd, &flags, 0, NULL); if (error) diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index e7d71b2e22da..eca9b18fb1dc 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -361,7 +361,7 @@ kern___mac_get_path(struct thread *td, const char *path_p, struct mac *mac_p, } buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); - NDINIT(&nd, LOOKUP, LOCKLEAF | follow, UIO_USERSPACE, path_p, td); + NDINIT(&nd, LOOKUP, LOCKLEAF | follow, UIO_USERSPACE, path_p); error = namei(&nd); if (error) goto out; @@ -534,7 +534,7 @@ kern___mac_set_path(struct thread *td, const char *path_p, struct mac *mac_p, if (error) goto out; - NDINIT(&nd, LOOKUP, LOCKLEAF | follow, UIO_USERSPACE, path_p, td); + NDINIT(&nd, LOOKUP, LOCKLEAF | follow, UIO_USERSPACE, path_p); error = namei(&nd); if (error == 0) { error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH); diff --git a/sys/security/mac_veriexec/mac_veriexec.c b/sys/security/mac_veriexec/mac_veriexec.c index dc95890f613e..a11ee68766ec 100644 --- a/sys/security/mac_veriexec/mac_veriexec.c +++ b/sys/security/mac_veriexec/mac_veriexec.c @@ -701,7 +701,7 @@ mac_veriexec_syscall(struct thread *td, int call, void *arg) /* Look up the path to get the vnode */ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | LOCKSHARED | AUDITVNODE1, - UIO_USERSPACE, arg, td); + UIO_USERSPACE, arg); error = namei(&nd); if (error != 0) break; diff --git a/sys/sys/namei.h b/sys/sys/namei.h index a467c6e1ebf3..965a2b757f49 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -217,14 +217,14 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, /* * Initialization of a nameidata structure. */ -#define NDINIT(ndp, op, flags, segflg, namep, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, &cap_no_rights, td) -#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, &cap_no_rights, td) -#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp, td) -#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \ - NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, &cap_no_rights, td) +#define NDINIT(ndp, op, flags, segflg, namep) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, &cap_no_rights) +#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, &cap_no_rights) +#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp) +#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, &cap_no_rights) /* * Note the constant pattern may *hide* bugs. @@ -246,7 +246,7 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, #define NDREINIT_DBG(arg) do { } while (0) #endif -#define NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, startdir, rightsp, td) \ +#define NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, startdir, rightsp) \ do { \ struct nameidata *_ndp = (ndp); \ cap_rights_t *_rightsp = (rightsp); \ diff --git a/sys/sys/param.h b/sys/sys/param.h index 74c1beea4968..2d7d5cf457cb 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400042 +#define __FreeBSD_version 1400043 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index a0d16d9eccef..59e5012c0019 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -265,7 +265,7 @@ ffs_snapshot(mp, snapfile) */ restart: NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF | NOCACHE, UIO_SYSSPACE, - snapfile, td); + snapfile); if ((error = namei(&nd)) != 0) return (error); if (nd.ni_vp != NULL) { diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 1edc127bd68c..f9fb854c9640 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -631,7 +631,7 @@ ffs_mount(struct mount *mp) * Not an update, or updating the name: look up the name * and verify that it refers to a sensible disk device. */ - NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); + NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec); error = namei(&ndp); if ((mp->mnt_flag & MNT_UPDATE) != 0) { /* diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 143e0afbf1e3..2456245b6632 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -512,7 +512,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname, ump = VFSTOUFS(mp); dq = NODQUOT; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname); flags = FREAD | FWRITE; vfs_ref(mp); KASSERT(*mp_busy, ("%s called without busied mount", __func__)); diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 6daedd02649d..4cfdb3fd2cc8 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2367,7 +2367,7 @@ sys_swapon(struct thread *td, struct swapon_args *uap) } NDINIT(&nd, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1, - UIO_USERSPACE, uap->name, td); + UIO_USERSPACE, uap->name); error = namei(&nd); if (error) goto done; @@ -2506,8 +2506,7 @@ sys_swapoff(struct thread *td, struct swapoff_args *uap) sx_xlock(&swdev_syscall_lock); - NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->name, - td); + NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->name); error = namei(&nd); if (error) goto done;