vfs: remove the unused thread argument from NDINIT*
See b4a58fbf640409a1 ("vfs: remove cn_thread") Bump __FreeBSD_version to 1400043.
This commit is contained in:
parent
c40fee6f7d
commit
7e1d3eefd4
sys
cam/ctl
compat
contrib/openzfs/module/os/freebsd/zfs
dev
fs
cd9660
ext2fs
fuse
msdosfs
nfs
nfsserver
nullfs
udf
unionfs
kern
imgact_elf.ckern_acct.ckern_alq.ckern_ctf.ckern_exec.ckern_jail.ckern_ktrace.ckern_linker.ckern_proc.ckern_sig.clink_elf.clink_elf_obj.cuipc_usrreq.cvfs_acl.cvfs_cache.cvfs_default.cvfs_extattr.cvfs_lookup.cvfs_mount.cvfs_mountroot.cvfs_subr.cvfs_syscalls.c
security
sys
ufs
vm
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -499,7 +499,7 @@ interpret:
|
||||
*/
|
||||
NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW |
|
||||
SAVENAME | AUDITVNODE1 | WANTPARENT, UIO_SYSSPACE,
|
||||
args->fname, td);
|
||||
args->fname);
|
||||
|
||||
error = namei(&nd);
|
||||
if (error)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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 @@ restart:
|
||||
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 @@ again:
|
||||
} 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 @@ again:
|
||||
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 @@ restart:
|
||||
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 @@ restart:
|
||||
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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -701,7 +701,7 @@ cleanup_file:
|
||||
/* 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;
|
||||
|
@ -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); \
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
/*
|
||||
|
@ -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__));
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user