vfs: remove the unused thread argument from NDINIT*
See b4a58fbf64
("vfs: remove cn_thread")
Bump __FreeBSD_version to 1400043.
This commit is contained in:
parent
c40fee6f7d
commit
7e1d3eefd4
@ -2232,7 +2232,7 @@ ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
|||||||
flags |= FWRITE;
|
flags |= FWRITE;
|
||||||
|
|
||||||
again:
|
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);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if ((error == EROFS || error == EACCES) && (flags & FWRITE)) {
|
if ((error == EROFS || error == EACCES) && (flags & FWRITE)) {
|
||||||
flags &= ~FWRITE;
|
flags &= ~FWRITE;
|
||||||
|
@ -482,7 +482,7 @@ linprocfs_domtab(PFS_FILL_ARGS)
|
|||||||
* Ideally, this would use the current chroot rather than some
|
* Ideally, this would use the current chroot rather than some
|
||||||
* hardcoded path.
|
* hardcoded path.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path);
|
||||||
flep = NULL;
|
flep = NULL;
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
lep = linux_emul_path;
|
lep = linux_emul_path;
|
||||||
@ -539,7 +539,7 @@ linprocfs_doprocmountinfo(PFS_FILL_ARGS)
|
|||||||
* Ideally, this would use the current chroot rather than some
|
* Ideally, this would use the current chroot rather than some
|
||||||
* hardcoded path.
|
* hardcoded path.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path);
|
||||||
flep = NULL;
|
flep = NULL;
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
lep = linux_emul_path;
|
lep = linux_emul_path;
|
||||||
|
@ -276,12 +276,12 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
|
|||||||
|
|
||||||
if (!LUSECONVPATH(td)) {
|
if (!LUSECONVPATH(td)) {
|
||||||
NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
|
||||||
UIO_USERSPACE, args->library, td);
|
UIO_USERSPACE, args->library);
|
||||||
error = namei(&ni);
|
error = namei(&ni);
|
||||||
} else {
|
} else {
|
||||||
LCONVPATHEXIST(args->library, &library);
|
LCONVPATHEXIST(args->library, &library);
|
||||||
NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
|
||||||
UIO_SYSSPACE, library, td);
|
UIO_SYSSPACE, library);
|
||||||
error = namei(&ni);
|
error = namei(&ni);
|
||||||
LFREEPATH(library);
|
LFREEPATH(library);
|
||||||
}
|
}
|
||||||
|
@ -5345,8 +5345,7 @@ zfs_getextattr_dir(struct vop_getextattr_args *ap, const char *attrname)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
flags = FREAD;
|
flags = FREAD;
|
||||||
NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname,
|
NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp);
|
||||||
xvp, td);
|
|
||||||
error = vn_open_cred(&nd, &flags, 0, VN_OPEN_INVFS, ap->a_cred, NULL);
|
error = vn_open_cred(&nd, &flags, 0, VN_OPEN_INVFS, ap->a_cred, NULL);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
@ -5460,7 +5459,7 @@ zfs_deleteextattr_dir(struct vop_deleteextattr_args *ap, const char *attrname)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF,
|
NDINIT_ATVP(&nd, DELETE, NOFOLLOW | LOCKPARENT | LOCKLEAF,
|
||||||
UIO_SYSSPACE, attrname, xvp, ap->a_td);
|
UIO_SYSSPACE, attrname, xvp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
@ -5588,7 +5587,7 @@ zfs_setextattr_dir(struct vop_setextattr_args *ap, const char *attrname)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
flags = FFLAGS(O_WRONLY | O_CREAT);
|
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,
|
error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred,
|
||||||
NULL);
|
NULL);
|
||||||
vp = nd.ni_vp;
|
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,
|
NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED,
|
||||||
UIO_SYSSPACE, ".", xvp, td);
|
UIO_SYSSPACE, ".", xvp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
|
@ -241,8 +241,7 @@ open_file(struct beri_vtblk_softc *sc, struct thread *td)
|
|||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = (FREAD | FWRITE);
|
flags = (FREAD | FWRITE);
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, sc->mdio->md_file);
|
||||||
sc->mdio->md_file, td);
|
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
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) \
|
flags = FREAD | ((mdr->md_options & MD_READONLY) ? 0 : FWRITE) \
|
||||||
| ((mdr->md_options & MD_VERIFY) ? O_VERIFY : 0);
|
| ((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);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
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
|
* FreeBSD seems to copy the args to kernel space
|
||||||
*/
|
*/
|
||||||
NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE,
|
NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, params->file);
|
||||||
params->file, td);
|
|
||||||
if ((error = vn_open(&nid, &flags, 0, NULL)) != 0)
|
if ((error = vn_open(&nid, &flags, 0, NULL)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -2683,7 +2683,7 @@ xbb_open_backend(struct xbb_softc *xbb)
|
|||||||
pwd_ensure_dirs();
|
pwd_ensure_dirs();
|
||||||
|
|
||||||
again:
|
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);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error) {
|
if (error) {
|
||||||
/*
|
/*
|
||||||
|
@ -159,7 +159,7 @@ cd9660_mount(struct mount *mp)
|
|||||||
* Not an update, or updating the name: look up the name
|
* Not an update, or updating the name: look up the name
|
||||||
* and verify that it refers to a sensible block device.
|
* 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)))
|
if ((error = namei(&ndp)))
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(&ndp, NDF_ONLY_PNBUF);
|
NDFREE(&ndp, NDF_ONLY_PNBUF);
|
||||||
|
@ -240,7 +240,7 @@ ext2_mount(struct mount *mp)
|
|||||||
*/
|
*/
|
||||||
if (fspec == NULL)
|
if (fspec == NULL)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td);
|
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec);
|
||||||
if ((error = namei(ndp)) != 0)
|
if ((error = namei(ndp)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
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.
|
* 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)
|
if ((err = namei(ndp)) != 0)
|
||||||
return err;
|
return err;
|
||||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
NDFREE(ndp, NDF_ONLY_PNBUF);
|
||||||
|
@ -344,7 +344,7 @@ msdosfs_mount(struct mount *mp)
|
|||||||
*/
|
*/
|
||||||
if (vfs_getopt(mp->mnt_optnew, "from", (void **)&from, NULL))
|
if (vfs_getopt(mp->mnt_optnew, "from", (void **)&from, NULL))
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from, td);
|
NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, from);
|
||||||
error = namei(&ndp);
|
error = namei(&ndp);
|
||||||
if (error)
|
if (error)
|
||||||
return (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().
|
* Look up a file name. Basically just initialize stuff and call namei().
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
nfsrv_lookupfilename(struct nameidata *ndp, char *fname, NFSPROC_T *p)
|
nfsrv_lookupfilename(struct nameidata *ndp, char *fname, NFSPROC_T *p __unused)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, fname,
|
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, fname);
|
||||||
p);
|
|
||||||
error = namei(ndp);
|
error = namei(ndp);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
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.
|
* If fspec != NULL, this is the v4root path.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, nfsexargp->fspec);
|
||||||
nfsexargp->fspec, p);
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
error = nfsvno_getfh(nd.ni_vp, &fh, p);
|
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);
|
NFSD_DEBUG(4, "setdssrv path=%s\n", dspathp);
|
||||||
*dsp = NULL;
|
*dsp = NULL;
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
||||||
dspathp, p);
|
dspathp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
NFSD_DEBUG(4, "lookup=%d\n", error);
|
NFSD_DEBUG(4, "lookup=%d\n", error);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
@ -7680,7 +7680,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p,
|
|||||||
for (i = 0; i < nfsrv_dsdirsize; i++) {
|
for (i = 0; i < nfsrv_dsdirsize; i++) {
|
||||||
snprintf(dsdirpath, dsdirsize, "%s/ds%d", dspathp, i);
|
snprintf(dsdirpath, dsdirsize, "%s/ds%d", dspathp, i);
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
||||||
UIO_SYSSPACE, dsdirpath, p);
|
UIO_SYSSPACE, dsdirpath);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
NFSD_DEBUG(4, "dsdirpath=%s lookup=%d\n", dsdirpath, error);
|
NFSD_DEBUG(4, "dsdirpath=%s lookup=%d\n", dsdirpath, error);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
@ -7708,7 +7708,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p,
|
|||||||
* system.
|
* system.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
||||||
UIO_SYSSPACE, mdspathp, p);
|
UIO_SYSSPACE, mdspathp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
NFSD_DEBUG(4, "mds lookup=%d\n", error);
|
NFSD_DEBUG(4, "mds lookup=%d\n", error);
|
||||||
if (error != 0)
|
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);
|
NFSD_DEBUG(4, "mdsopen path=%s\n", mdspathp);
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
||||||
mdspathp, p);
|
mdspathp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
NFSD_DEBUG(4, "lookup=%d\n", error);
|
NFSD_DEBUG(4, "lookup=%d\n", error);
|
||||||
if (error != 0)
|
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);
|
NFSD_DEBUG(4, "curmdsdev path=%s\n", curdspathp);
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
||||||
UIO_SYSSPACE, curdspathp, p);
|
UIO_SYSSPACE, curdspathp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
NFSD_DEBUG(4, "ds lookup=%d\n", error);
|
NFSD_DEBUG(4, "ds lookup=%d\n", error);
|
||||||
if (error != 0) {
|
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. */
|
/* Look up the nfsdev path and find the nfsdev structure. */
|
||||||
NFSD_DEBUG(4, "mdsdev path=%s\n", dspathp);
|
NFSD_DEBUG(4, "mdsdev path=%s\n", dspathp);
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
||||||
UIO_SYSSPACE, dspathp, p);
|
UIO_SYSSPACE, dspathp);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
NFSD_DEBUG(4, "ds lookup=%d\n", error);
|
NFSD_DEBUG(4, "ds lookup=%d\n", error);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
|
@ -125,7 +125,7 @@ nullfs_mount(struct mount *mp)
|
|||||||
* Find lower node
|
* Find lower node
|
||||||
*/
|
*/
|
||||||
ndp = &nd;
|
ndp = &nd;
|
||||||
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, curthread);
|
NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target);
|
||||||
error = namei(ndp);
|
error = namei(ndp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -227,7 +227,7 @@ udf_mount(struct mount *mp)
|
|||||||
/* Check that the mount device exists */
|
/* Check that the mount device exists */
|
||||||
if (fspec == NULL)
|
if (fspec == NULL)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td);
|
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec);
|
||||||
if ((error = namei(ndp)))
|
if ((error = namei(ndp)))
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
NDFREE(ndp, NDF_ONLY_PNBUF);
|
||||||
|
@ -234,7 +234,7 @@ unionfs_domount(struct mount *mp)
|
|||||||
/*
|
/*
|
||||||
* Find upper node
|
* Find upper node
|
||||||
*/
|
*/
|
||||||
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target, td);
|
NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target);
|
||||||
if ((error = namei(ndp)))
|
if ((error = namei(ndp)))
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
@ -800,7 +800,7 @@ __elfN(load_file)(struct proc *p, const char *file, u_long *addr,
|
|||||||
imgp->attr = attr;
|
imgp->attr = attr;
|
||||||
|
|
||||||
NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF,
|
NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF,
|
||||||
UIO_SYSSPACE, file, curthread);
|
UIO_SYSSPACE, file);
|
||||||
if ((error = namei(nd)) != 0) {
|
if ((error = namei(nd)) != 0) {
|
||||||
nd->ni_vp = NULL;
|
nd->ni_vp = NULL;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -216,8 +216,8 @@ sys_acct(struct thread *td, struct acct_args *uap)
|
|||||||
* appending and make sure it's a 'normal'.
|
* appending and make sure it's a 'normal'.
|
||||||
*/
|
*/
|
||||||
if (uap->path != NULL) {
|
if (uap->path != NULL) {
|
||||||
NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, UIO_USERSPACE,
|
||||||
UIO_USERSPACE, uap->path, td);
|
uap->path);
|
||||||
flags = FWRITE | O_APPEND;
|
flags = FWRITE | O_APPEND;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -431,7 +431,6 @@ int
|
|||||||
alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode,
|
alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode,
|
||||||
int size, int flags)
|
int size, int flags)
|
||||||
{
|
{
|
||||||
struct thread *td __unused;
|
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
struct alq *alq;
|
struct alq *alq;
|
||||||
int oflags;
|
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__));
|
KASSERT((size > 0), ("%s: size <= 0", __func__));
|
||||||
|
|
||||||
*alqp = NULL;
|
*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;
|
oflags = FWRITE | O_NOFOLLOW | O_CREAT;
|
||||||
|
|
||||||
error = vn_open_cred(&nd, &oflags, cmode, 0, cred, NULL);
|
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;
|
ef->ctfcnt = -1;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, lf->pathname, td);
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, lf->pathname);
|
||||||
flags = FREAD;
|
flags = FREAD;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -499,7 +499,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p,
|
|||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW |
|
NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | LOCKSHARED | FOLLOW |
|
||||||
SAVENAME | AUDITVNODE1 | WANTPARENT, UIO_SYSSPACE,
|
SAVENAME | AUDITVNODE1 | WANTPARENT, UIO_SYSSPACE,
|
||||||
args->fname, td);
|
args->fname);
|
||||||
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -962,8 +962,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
|
|||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
goto done_free;
|
goto done_free;
|
||||||
}
|
}
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, path);
|
||||||
path, td);
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto done_free;
|
goto done_free;
|
||||||
|
@ -1023,7 +1023,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap)
|
|||||||
/*
|
/*
|
||||||
* an operation which requires a file argument.
|
* 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;
|
flags = FREAD | FWRITE | O_NOFOLLOW;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error)
|
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
|
* Attempt to open the file, and return the path if
|
||||||
* we succeed and it's a regular file.
|
* 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;
|
flags = FREAD;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error == 0) {
|
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,
|
snprintf(pathbuf, reclen, "%.*s%s%s", pathlen, path, sep,
|
||||||
linker_hintfile);
|
linker_hintfile);
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, pathbuf, td);
|
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, pathbuf);
|
||||||
flags = FREAD;
|
flags = FREAD;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -2275,8 +2275,7 @@ proc_get_binpath(struct proc *p, char *binname, char **retbuf,
|
|||||||
* might have been renamed or replaced, in
|
* might have been renamed or replaced, in
|
||||||
* which case we should not report old name.
|
* which case we should not report old name.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf,
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, *retbuf);
|
||||||
curthread);
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
if (nd.ni_vp == vp)
|
if (nd.ni_vp == vp)
|
||||||
|
@ -3658,7 +3658,7 @@ corefile_open_last(struct thread *td, char *name, int indexpos,
|
|||||||
i);
|
i);
|
||||||
name[indexpos + indexlen] = ch;
|
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,
|
error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred,
|
||||||
NULL);
|
NULL);
|
||||||
if (error != 0)
|
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)
|
if ((td->td_proc->p_flag & P_SUGID) != 0)
|
||||||
flags |= O_EXCL;
|
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,
|
error = vn_open_cred(&nd, &flags, cmode, oflags, td->td_ucred,
|
||||||
NULL);
|
NULL);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
|
@ -972,7 +972,7 @@ link_elf_load_file(linker_class_t cls, const char* filename,
|
|||||||
lf = NULL;
|
lf = NULL;
|
||||||
shstrs = NULL;
|
shstrs = NULL;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td);
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename);
|
||||||
flags = FREAD;
|
flags = FREAD;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
|
@ -698,7 +698,7 @@ link_elf_load_file(linker_class_t cls, const char *filename,
|
|||||||
hdr = NULL;
|
hdr = NULL;
|
||||||
|
|
||||||
nd = malloc(sizeof(struct nameidata), M_TEMP, M_WAITOK);
|
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;
|
flags = FREAD;
|
||||||
error = vn_open(nd, &flags, 0, NULL);
|
error = vn_open(nd, &flags, 0, NULL);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -637,8 +637,7 @@ uipc_bindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td)
|
|||||||
|
|
||||||
restart:
|
restart:
|
||||||
NDINIT_ATRIGHTS(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME | NOCACHE,
|
NDINIT_ATRIGHTS(&nd, CREATE, NOFOLLOW | LOCKPARENT | SAVENAME | NOCACHE,
|
||||||
UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_BINDAT),
|
UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_BINDAT));
|
||||||
td);
|
|
||||||
/* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */
|
/* SHOULD BE ABLE TO ADOPT EXISTING AND wakeup() ALA FIFO's */
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
@ -1570,8 +1569,7 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam,
|
|||||||
else
|
else
|
||||||
sa = NULL;
|
sa = NULL;
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF,
|
||||||
UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_CONNECTAT),
|
UIO_SYSSPACE, buf, fd, cap_rights_init_one(&rights, CAP_CONNECTAT));
|
||||||
td);
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
vp = NULL;
|
vp = NULL;
|
||||||
|
@ -377,7 +377,7 @@ kern___acl_get_path(struct thread *td, const char *path, acl_type_t type,
|
|||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
error = vacl_get_acl(td, nd.ni_vp, type, aclp);
|
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;
|
struct nameidata nd;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
error = vacl_set_acl(td, nd.ni_vp, type, aclp);
|
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;
|
struct nameidata nd;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
error = vacl_delete(td, nd.ni_vp, type);
|
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;
|
struct nameidata nd;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
error = vacl_aclcheck(td, nd.ni_vp, type, aclp);
|
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)
|
if (flags != 0)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | SAVENAME | WANTPARENT | AUDITVNODE1,
|
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)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
error = vn_fullpath_hardlink(nd.ni_vp, nd.ni_dvp, nd.ni_cnd.cn_nameptr,
|
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.
|
* As a side effect, the vnode is relocked.
|
||||||
* If vnode was renamed, return ENOENT.
|
* If vnode was renamed, return ENOENT.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_SYSSPACE, path);
|
||||||
UIO_SYSSPACE, path, td);
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
vrele(vp);
|
vrele(vp);
|
||||||
|
@ -846,7 +846,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap)
|
|||||||
locked = VOP_ISLOCKED(vp);
|
locked = VOP_ISLOCKED(vp);
|
||||||
VOP_UNLOCK(vp);
|
VOP_UNLOCK(vp);
|
||||||
NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
||||||
"..", vp, td);
|
"..", vp);
|
||||||
flags = FREAD;
|
flags = FREAD;
|
||||||
error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, cred, NULL);
|
error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, cred, NULL);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
@ -102,8 +102,8 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
|
|||||||
mp = NULL;
|
mp = NULL;
|
||||||
filename_vp = NULL;
|
filename_vp = NULL;
|
||||||
if (uap->filename != NULL) {
|
if (uap->filename != NULL) {
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE2,
|
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE2, UIO_USERSPACE,
|
||||||
UIO_USERSPACE, uap->filename, td);
|
uap->filename);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -112,8 +112,8 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* uap->path is always defined. */
|
/* uap->path is always defined. */
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
|
||||||
UIO_USERSPACE, uap->path, td);
|
uap->path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
@ -302,7 +302,7 @@ kern_extattr_set_path(struct thread *td, const char *path, int attrnamespace,
|
|||||||
return (error);
|
return (error);
|
||||||
AUDIT_ARG_TEXT(attrname);
|
AUDIT_ARG_TEXT(attrname);
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -467,7 +467,7 @@ kern_extattr_get_path(struct thread *td, const char *path, int attrnamespace,
|
|||||||
return (error);
|
return (error);
|
||||||
AUDIT_ARG_TEXT(attrname);
|
AUDIT_ARG_TEXT(attrname);
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -599,7 +599,7 @@ kern_extattr_delete_path(struct thread *td, const char *path, int attrnamespace,
|
|||||||
return(error);
|
return(error);
|
||||||
AUDIT_ARG_TEXT(attrname);
|
AUDIT_ARG_TEXT(attrname);
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
return(error);
|
return(error);
|
||||||
@ -742,7 +742,7 @@ kern_extattr_list_path(struct thread *td, const char *path, int attrnamespace,
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
AUDIT_ARG_VALUE(attrnamespace);
|
AUDIT_ARG_VALUE(attrnamespace);
|
||||||
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path, td);
|
NDINIT(&nd, LOOKUP, follow | AUDITVNODE1, UIO_USERSPACE, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
return (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--);
|
for (cp = &ptr[len] - 1; *cp != '/'; cp--);
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td);
|
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
*cp = '/';
|
*cp = '/';
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
goto keeporig;
|
goto keeporig;
|
||||||
} else {
|
} else {
|
||||||
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf, td);
|
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, buf);
|
||||||
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
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
|
* root directory and never finding it, because "/" resolves
|
||||||
* to the emulation root directory. This is expensive :-(
|
* to the emulation root directory. This is expensive :-(
|
||||||
*/
|
*/
|
||||||
NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix,
|
NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix);
|
||||||
td);
|
|
||||||
|
|
||||||
/* We shouldn't ever get an error from this namei(). */
|
/* We shouldn't ever get an error from this namei(). */
|
||||||
error = namei(&ndroot);
|
error = namei(&ndroot);
|
||||||
|
@ -1538,8 +1538,8 @@ vfs_domount(
|
|||||||
/*
|
/*
|
||||||
* Get vnode to be covered or mount point's vnode in case of MNT_UPDATE.
|
* Get vnode to be covered or mount point's vnode in case of MNT_UPDATE.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_SYSSPACE,
|
||||||
UIO_SYSSPACE, fspath, td);
|
fspath);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -1633,7 +1633,7 @@ kern_unmount(struct thread *td, const char *path, int flags)
|
|||||||
* Try to find global path for path argument.
|
* Try to find global path for path argument.
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
|
||||||
UIO_SYSSPACE, pathbuf, td);
|
UIO_SYSSPACE, pathbuf);
|
||||||
if (namei(&nd) == 0) {
|
if (namei(&nd) == 0) {
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
error = vn_path_to_global_path(td, nd.ni_vp, pathbuf,
|
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) {
|
if (mporoot != mpdevfs) {
|
||||||
/* Remount old root under /.mount or /mnt */
|
/* Remount old root under /.mount or /mnt */
|
||||||
fspath = "/.mount";
|
fspath = "/.mount";
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspath);
|
||||||
fspath, td);
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error) {
|
if (error) {
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
fspath = "/mnt";
|
fspath = "/mnt";
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
|
||||||
fspath, td);
|
fspath);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
}
|
}
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@ -386,7 +385,7 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remount devfs under /dev */
|
/* Remount devfs under /dev */
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev", td);
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "/dev");
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
@ -726,7 +725,7 @@ parse_mount_dev_present(const char *dev)
|
|||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev, curthread);
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (!error)
|
if (!error)
|
||||||
vput(nd.ni_vp);
|
vput(nd.ni_vp);
|
||||||
@ -949,7 +948,7 @@ vfs_mountroot_readconf(struct thread *td, struct sbuf *sb)
|
|||||||
ssize_t resid;
|
ssize_t resid;
|
||||||
int error, flags, len;
|
int error, flags, len;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf", td);
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/.mount.conf");
|
||||||
flags = FREAD;
|
flags = FREAD;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -394,7 +394,7 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS)
|
|||||||
buf[req->newlen] = '\0';
|
buf[req->newlen] = '\0';
|
||||||
|
|
||||||
ndflags = LOCKLEAF | NOFOLLOW | AUDITVNODE1 | SAVENAME;
|
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)
|
if ((error = namei(&nd)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
vp = nd.ni_vp;
|
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))
|
if (!prison_allow(td->td_ucred, PR_ALLOW_QUOTAS))
|
||||||
return (EPERM);
|
return (EPERM);
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
|
||||||
uap->path, td);
|
uap->path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
@ -335,7 +335,7 @@ kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg,
|
|||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td);
|
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -953,7 +953,7 @@ kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
|
||||||
pathseg, path, td);
|
pathseg, path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
if ((error = change_dir(nd.ni_vp, td)) != 0) {
|
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);
|
PROC_UNLOCK(p);
|
||||||
}
|
}
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1,
|
||||||
UIO_USERSPACE, uap->path, td);
|
UIO_USERSPACE, uap->path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
goto error;
|
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;
|
fp->f_flag = flags & FMASK;
|
||||||
cmode = ((mode & ~pdp->pd_cmask) & ALLPERMS) & ~S_ISTXT;
|
cmode = ((mode & ~pdp->pd_cmask) & ALLPERMS) & ~S_ISTXT;
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd,
|
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd,
|
||||||
&rights, td);
|
&rights);
|
||||||
td->td_dupfd = -1; /* XXX check for fdopen */
|
td->td_dupfd = -1; /* XXX check for fdopen */
|
||||||
error = vn_open(&nd, &flags, cmode, fp);
|
error = vn_open(&nd, &flags, cmode, fp);
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
@ -1357,8 +1357,7 @@ kern_mknodat(struct thread *td, int fd, const char *path, enum uio_seg pathseg,
|
|||||||
restart:
|
restart:
|
||||||
bwillwrite();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
||||||
NOCACHE, pathseg, path, fd, &cap_mknodat_rights,
|
NOCACHE, pathseg, path, fd, &cap_mknodat_rights);
|
||||||
td);
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
@ -1466,8 +1465,7 @@ kern_mkfifoat(struct thread *td, int fd, const char *path,
|
|||||||
restart:
|
restart:
|
||||||
bwillwrite();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
||||||
NOCACHE, pathseg, path, fd, &cap_mkfifoat_rights,
|
NOCACHE, pathseg, path, fd, &cap_mkfifoat_rights);
|
||||||
td);
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
if (nd.ni_vp != NULL) {
|
if (nd.ni_vp != NULL) {
|
||||||
@ -1596,7 +1594,7 @@ kern_linkat(struct thread *td, int fd1, int fd2, const char *path1,
|
|||||||
bwillwrite();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag,
|
NDINIT_ATRIGHTS(&nd, LOOKUP, AUDITVNODE1 | at2cnpflags(flag,
|
||||||
AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH | AT_EMPTY_PATH),
|
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)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
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,
|
NDINIT_ATRIGHTS(&nd, CREATE,
|
||||||
LOCKPARENT | SAVENAME | AUDITVNODE2 | NOCACHE, segflag, path, fd,
|
LOCKPARENT | SAVENAME | AUDITVNODE2 | NOCACHE, segflag, path, fd,
|
||||||
&cap_linkat_target_rights, td);
|
&cap_linkat_target_rights);
|
||||||
if ((error = namei(&nd)) == 0) {
|
if ((error = namei(&nd)) == 0) {
|
||||||
if (nd.ni_vp != NULL) {
|
if (nd.ni_vp != NULL) {
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
@ -1744,8 +1742,7 @@ kern_symlinkat(struct thread *td, const char *path1, int fd, const char *path2,
|
|||||||
restart:
|
restart:
|
||||||
bwillwrite();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
||||||
NOCACHE, segflg, path2, fd, &cap_symlinkat_rights,
|
NOCACHE, segflg, path2, fd, &cap_symlinkat_rights);
|
||||||
td);
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
if (nd.ni_vp) {
|
if (nd.ni_vp) {
|
||||||
@ -1809,7 +1806,7 @@ sys_undelete(struct thread *td, struct undelete_args *uap)
|
|||||||
restart:
|
restart:
|
||||||
bwillwrite();
|
bwillwrite();
|
||||||
NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1,
|
NDINIT(&nd, DELETE, LOCKPARENT | DOWHITEOUT | AUDITVNODE1,
|
||||||
UIO_USERSPACE, uap->path, td);
|
UIO_USERSPACE, uap->path);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -1924,7 +1921,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd,
|
|||||||
bwillwrite();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
|
NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
|
||||||
at2cnpflags(flag, AT_RESOLVE_BENEATH),
|
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 = namei(&nd)) != 0) {
|
||||||
if (error == EINVAL)
|
if (error == EINVAL)
|
||||||
error = EPERM;
|
error = EPERM;
|
||||||
@ -2150,7 +2147,7 @@ kern_accessat(struct thread *td, int fd, const char *path,
|
|||||||
AUDIT_ARG_VALUE(amode);
|
AUDIT_ARG_VALUE(amode);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF |
|
||||||
AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH |
|
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)
|
if ((error = namei(&nd)) != 0)
|
||||||
goto out;
|
goto out;
|
||||||
vp = nd.ni_vp;
|
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 |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_RESOLVE_BENEATH |
|
||||||
AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) | LOCKSHARED | LOCKLEAF |
|
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 = namei(&nd)) != 0) {
|
||||||
if (error == ENOTDIR &&
|
if (error == ENOTDIR &&
|
||||||
@ -2607,7 +2604,7 @@ kern_pathconf(struct thread *td, const char *path, enum uio_seg pathseg,
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | AUDITVNODE1 | flags,
|
NDINIT(&nd, LOOKUP, LOCKSHARED | LOCKLEAF | AUDITVNODE1 | flags,
|
||||||
pathseg, path, td);
|
pathseg, path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE_NOTHING(&nd);
|
NDFREE_NOTHING(&nd);
|
||||||
@ -2662,7 +2659,7 @@ kern_readlinkat(struct thread *td, int fd, const char *path,
|
|||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1 |
|
NDINIT_AT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1 |
|
||||||
EMPTYPATH, pathseg, path, fd, td);
|
EMPTYPATH, pathseg, path, fd);
|
||||||
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -2814,7 +2811,7 @@ kern_chflagsat(struct thread *td, int fd, const char *path,
|
|||||||
AUDIT_ARG_FFLAGS(flags);
|
AUDIT_ARG_FFLAGS(flags);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(atflag, AT_SYMLINK_NOFOLLOW |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(atflag, AT_SYMLINK_NOFOLLOW |
|
||||||
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path,
|
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path,
|
||||||
fd, &cap_fchflags_rights, td);
|
fd, &cap_fchflags_rights);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE_NOTHING(&nd);
|
NDFREE_NOTHING(&nd);
|
||||||
@ -2945,7 +2942,7 @@ kern_fchmodat(struct thread *td, int fd, const char *path,
|
|||||||
AUDIT_ARG_MODE(mode);
|
AUDIT_ARG_MODE(mode);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW |
|
||||||
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path,
|
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path,
|
||||||
fd, &cap_fchmod_rights, td);
|
fd, &cap_fchmod_rights);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE_NOTHING(&nd);
|
NDFREE_NOTHING(&nd);
|
||||||
@ -3057,7 +3054,7 @@ kern_fchownat(struct thread *td, int fd, const char *path,
|
|||||||
AUDIT_ARG_OWNER(uid, gid);
|
AUDIT_ARG_OWNER(uid, gid);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW |
|
||||||
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path,
|
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1, pathseg, path,
|
||||||
fd, &cap_fchown_rights, td);
|
fd, &cap_fchown_rights);
|
||||||
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
@ -3274,7 +3271,7 @@ kern_utimesat(struct thread *td, int fd, const char *path,
|
|||||||
if ((error = getutimes(tptr, tptrseg, ts)) != 0)
|
if ((error = getutimes(tptr, tptrseg, ts)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd,
|
NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, fd,
|
||||||
&cap_futimes_rights, td);
|
&cap_futimes_rights);
|
||||||
|
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
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)
|
if ((error = getutimes(tptr, tptrseg, ts)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, pathseg, path, td);
|
NDINIT(&nd, LOOKUP, NOFOLLOW | AUDITVNODE1, pathseg, path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE_NOTHING(&nd);
|
NDFREE_NOTHING(&nd);
|
||||||
@ -3424,7 +3421,7 @@ kern_utimensat(struct thread *td, int fd, const char *path,
|
|||||||
return (error);
|
return (error);
|
||||||
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW |
|
NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_SYMLINK_NOFOLLOW |
|
||||||
AT_RESOLVE_BENEATH | AT_EMPTY_PATH) | AUDITVNODE1,
|
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)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
/*
|
/*
|
||||||
@ -3472,7 +3469,7 @@ kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg,
|
|||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
NDPREINIT(&nd);
|
NDPREINIT(&nd);
|
||||||
retry:
|
retry:
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td);
|
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
@ -3642,7 +3639,7 @@ kern_renameat_mac(struct thread *td, int oldfd, const char *old, int newfd,
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT_ATRIGHTS(fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART |
|
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)
|
if ((error = namei(fromnd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
error = mac_vnode_check_rename_from(td->td_ucred, fromnd->ni_dvp,
|
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 {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | SAVESTART | AUDITVNODE1,
|
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)
|
if ((error = namei(&fromnd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
#ifdef MAC
|
#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)
|
if (fromnd.ni_vp->v_type == VDIR)
|
||||||
tondflags |= WILLBEDIR;
|
tondflags |= WILLBEDIR;
|
||||||
NDINIT_ATRIGHTS(&tond, RENAME, tondflags, pathseg, new, newfd,
|
NDINIT_ATRIGHTS(&tond, RENAME, tondflags, pathseg, new, newfd,
|
||||||
&cap_renameat_target_rights, td);
|
&cap_renameat_target_rights);
|
||||||
if ((error = namei(&tond)) != 0) {
|
if ((error = namei(&tond)) != 0) {
|
||||||
/* Translate error code for rename("dir1", "dir2/."). */
|
/* Translate error code for rename("dir1", "dir2/."). */
|
||||||
if (error == EISDIR && fvp->v_type == VDIR)
|
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();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
|
||||||
NC_NOMAKEENTRY | NC_KEEPPOSENTRY | FAILIFEXISTS | WILLBEDIR,
|
NC_NOMAKEENTRY | NC_KEEPPOSENTRY | FAILIFEXISTS | WILLBEDIR,
|
||||||
segflg, path, fd, &cap_mkdirat_rights, td);
|
segflg, path, fd, &cap_mkdirat_rights);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
|
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();
|
bwillwrite();
|
||||||
NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
|
NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 |
|
||||||
at2cnpflags(flag, AT_RESOLVE_BENEATH),
|
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 = namei(&nd)) != 0)
|
||||||
goto fdout;
|
goto fdout;
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
@ -4280,7 +4277,7 @@ sys_revoke(struct thread *td, struct revoke_args *uap)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
|
||||||
uap->path, td);
|
uap->path);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
@ -4442,7 +4439,7 @@ kern_getfhat(struct thread *td, int flags, int fd, const char *path,
|
|||||||
return (error);
|
return (error);
|
||||||
NDINIT_AT(&nd, LOOKUP, at2cnpflags(flags, AT_SYMLINK_NOFOLLOW |
|
NDINIT_AT(&nd, LOOKUP, at2cnpflags(flags, AT_SYMLINK_NOFOLLOW |
|
||||||
AT_RESOLVE_BENEATH) | LOCKLEAF | AUDITVNODE1, pathseg, path,
|
AT_RESOLVE_BENEATH) | LOCKLEAF | AUDITVNODE1, pathseg, path,
|
||||||
fd, td);
|
fd);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
@ -801,8 +801,8 @@ sys_auditctl(struct thread *td, struct auditctl_args *uap)
|
|||||||
if (uap->path == NULL)
|
if (uap->path == NULL)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1,
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | AUDITVNODE1, UIO_USERSPACE,
|
||||||
UIO_USERSPACE, uap->path, td);
|
uap->path);
|
||||||
flags = AUDIT_OPEN_FLAGS;
|
flags = AUDIT_OPEN_FLAGS;
|
||||||
error = vn_open(&nd, &flags, 0, NULL);
|
error = vn_open(&nd, &flags, 0, NULL);
|
||||||
if (error)
|
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);
|
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);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
@ -534,7 +534,7 @@ kern___mac_set_path(struct thread *td, const char *path_p, struct mac *mac_p,
|
|||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, LOCKLEAF | follow, UIO_USERSPACE, path_p, td);
|
NDINIT(&nd, LOOKUP, LOCKLEAF | follow, UIO_USERSPACE, path_p);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH);
|
error = vn_start_write(nd.ni_vp, &mp, V_WAIT | PCATCH);
|
||||||
|
@ -701,7 +701,7 @@ mac_veriexec_syscall(struct thread *td, int call, void *arg)
|
|||||||
/* Look up the path to get the vnode */
|
/* Look up the path to get the vnode */
|
||||||
NDINIT(&nd, LOOKUP,
|
NDINIT(&nd, LOOKUP,
|
||||||
FOLLOW | LOCKLEAF | LOCKSHARED | AUDITVNODE1,
|
FOLLOW | LOCKLEAF | LOCKSHARED | AUDITVNODE1,
|
||||||
UIO_USERSPACE, arg, td);
|
UIO_USERSPACE, arg);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
break;
|
break;
|
||||||
|
@ -217,14 +217,14 @@ int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status,
|
|||||||
/*
|
/*
|
||||||
* Initialization of a nameidata structure.
|
* Initialization of a nameidata structure.
|
||||||
*/
|
*/
|
||||||
#define NDINIT(ndp, op, flags, segflg, namep, td) \
|
#define NDINIT(ndp, op, flags, segflg, namep) \
|
||||||
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, &cap_no_rights, td)
|
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, &cap_no_rights)
|
||||||
#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td) \
|
#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd) \
|
||||||
NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, &cap_no_rights, td)
|
NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, &cap_no_rights)
|
||||||
#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp, td) \
|
#define NDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rightsp) \
|
||||||
NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp, td)
|
NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rightsp)
|
||||||
#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \
|
#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp) \
|
||||||
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, &cap_no_rights, td)
|
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, &cap_no_rights)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note the constant pattern may *hide* bugs.
|
* 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)
|
#define NDREINIT_DBG(arg) do { } while (0)
|
||||||
#endif
|
#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 { \
|
do { \
|
||||||
struct nameidata *_ndp = (ndp); \
|
struct nameidata *_ndp = (ndp); \
|
||||||
cap_rights_t *_rightsp = (rightsp); \
|
cap_rights_t *_rightsp = (rightsp); \
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
* cannot include sys/param.h and should only be updated here.
|
* cannot include sys/param.h and should only be updated here.
|
||||||
*/
|
*/
|
||||||
#undef __FreeBSD_version
|
#undef __FreeBSD_version
|
||||||
#define __FreeBSD_version 1400042
|
#define __FreeBSD_version 1400043
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||||
|
@ -265,7 +265,7 @@ ffs_snapshot(mp, snapfile)
|
|||||||
*/
|
*/
|
||||||
restart:
|
restart:
|
||||||
NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF | NOCACHE, UIO_SYSSPACE,
|
NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF | NOCACHE, UIO_SYSSPACE,
|
||||||
snapfile, td);
|
snapfile);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
if (nd.ni_vp != NULL) {
|
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
|
* Not an update, or updating the name: look up the name
|
||||||
* and verify that it refers to a sensible disk device.
|
* 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);
|
error = namei(&ndp);
|
||||||
if ((mp->mnt_flag & MNT_UPDATE) != 0) {
|
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);
|
ump = VFSTOUFS(mp);
|
||||||
dq = NODQUOT;
|
dq = NODQUOT;
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname, td);
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, fname);
|
||||||
flags = FREAD | FWRITE;
|
flags = FREAD | FWRITE;
|
||||||
vfs_ref(mp);
|
vfs_ref(mp);
|
||||||
KASSERT(*mp_busy, ("%s called without busied mount", __func__));
|
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,
|
NDINIT(&nd, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
|
||||||
UIO_USERSPACE, uap->name, td);
|
UIO_USERSPACE, uap->name);
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto done;
|
goto done;
|
||||||
@ -2506,8 +2506,7 @@ sys_swapoff(struct thread *td, struct swapoff_args *uap)
|
|||||||
|
|
||||||
sx_xlock(&swdev_syscall_lock);
|
sx_xlock(&swdev_syscall_lock);
|
||||||
|
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->name,
|
NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->name);
|
||||||
td);
|
|
||||||
error = namei(&nd);
|
error = namei(&nd);
|
||||||
if (error)
|
if (error)
|
||||||
goto done;
|
goto done;
|
||||||
|
Loading…
Reference in New Issue
Block a user