Lines Matching refs:ndp
150 namei(struct nameidata *ndp)
155 struct vnode *usedvp = ndp->ni_dvp; /* store pointer to vp in case we must loop due to
157 u_long cnpflags = ndp->ni_cnd.cn_flags; /* store in case we have to restore after loop */
160 struct componentname *cnp = &ndp->ni_cnd;
185 cnp->cn_pnbuf = ndp->ni_pathbuf;
189 if (IS_VALID_UIO_SEGFLG(ndp->ni_segflg) == 0) {
195 if (UIO_SEG_IS_USER_SPACE(ndp->ni_segflg)) {
196 error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf,
197 cnp->cn_pnlen, (size_t *)&ndp->ni_pathlen);
199 error = copystr(CAST_DOWN(void *, ndp->ni_dirp), cnp->cn_pnbuf,
200 cnp->cn_pnlen, (size_t *)&ndp->ni_pathlen);
224 if (ndp->ni_pathlen >= VOLFS_MIN_PATH_LEN &&
248 ndp->ni_pathlen = strlen(realpath) + 1;
268 ndp->ni_loopcnt = 0;
273 if ((ndp->ni_rootdir = fdp->fd_rdir) == NULLVP) {
275 ndp->ni_rootdir = rootvnode;
279 ndp->ni_usedvp = NULLVP;
284 ndp->ni_pathlen--;
286 dp = ndp->ni_rootdir;
288 dp = ndp->ni_dvp;
289 ndp->ni_usedvp = dp;
297 ndp->ni_dvp = NULLVP;
298 ndp->ni_vp = NULLVP;
304 ndp->ni_startdir = dp;
306 if ( (error = lookup(ndp)) ) {
317 unlock_fsnode(ndp->ni_dvp, NULL);
319 if (ndp->ni_loopcnt++ >= MAXSYMLINKS) {
324 if ((error = mac_vnode_check_readlink(ctx, ndp->ni_vp)) != 0)
327 if (ndp->ni_pathlen > 1 || !(cnp->cn_flags & HASBUF))
345 error = VNOP_READLINK(ndp->ni_vp, auio, ctx);
353 if (linklen + ndp->ni_pathlen > MAXPATHLEN) {
364 bcopy(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
375 ndp->ni_pathlen += linklen;
382 dp = ndp->ni_dvp;
386 vnode_put(ndp->ni_vp);
387 vnode_put(ndp->ni_dvp);
389 ndp->ni_vp = NULLVP;
390 ndp->ni_dvp = NULLVP;
398 ndp->ni_pathlen--;
400 if ((dp = ndp->ni_rootdir) == NULLVP) {
412 if (ndp->ni_dvp)
413 vnode_put(ndp->ni_dvp);
414 if (ndp->ni_vp)
415 vnode_put(ndp->ni_vp);
422 ndp->ni_vp = NULLVP;
426 ndp->ni_cnd.cn_flags = cnpflags;
427 ndp->ni_dvp = usedvp;
461 * identify next component of name at ndp->ni_ptr
493 lookup(struct nameidata *ndp)
505 struct componentname *cnp = &ndp->ni_cnd;
527 dp = ndp->ni_startdir;
528 ndp->ni_startdir = NULLVP;
543 ndp->ni_vp = NULLVP;
545 if ( (error = cache_lookup_path(ndp, cnp, dp, ctx, &trailing_slash, &dp_authorized, last_dp)) ) {
555 dp = ndp->ni_dvp;
557 if (ndp->ni_vp != NULLVP) {
586 if (dp == ndp->ni_rootdir || dp == rootvnode) {
587 ndp->ni_dvp = dp;
588 ndp->ni_vp = dp;
620 ndp->ni_dvp = dp;
629 ndp->ni_vp = NULLVP;
650 if ( (error = VNOP_LOOKUP(dp, &ndp->ni_vp, cnp, ctx)) ) {
669 ndp->ni_dvp = dp;
677 if (ndp->ni_vp != NULLVP)
695 * referenced directory vnode in ndp->ni_dvp.
698 if ( (vnode_get(ndp->ni_dvp)) ) {
702 ndp->ni_startdir = ndp->ni_dvp;
705 vnode_put(ndp->ni_dvp);
708 kdebug_lookup(ndp->ni_dvp, cnp);
712 dp = ndp->ni_vp;
720 ndp->ni_next += cnp->cn_consume;
721 ndp->ni_pathlen -= cnp->cn_consume;
733 if (ndp->ni_dvp != NULLVP && dp->v_parent == NULLVP)
737 vnode_update_identity(dp, ndp->ni_dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_hash, update_flags);
754 if (ndp->ni_dvp != NULLVP && (nc_generation == ndp->ni_dvp->v_nc_generation))
755 cache_enter_with_gen(ndp->ni_dvp, dp, cnp, nc_generation);
816 ndp->ni_vp = dp = tdp;
849 ((cnp->cn_flags & FOLLOW) || trailing_slash || *ndp->ni_next == '/')) {
870 if (*ndp->ni_next == '/') {
871 cnp->cn_nameptr = ndp->ni_next + 1;
872 ndp->ni_pathlen--;
875 ndp->ni_pathlen--;
877 vnode_put(ndp->ni_dvp);
908 if ( (vnode_get(ndp->ni_dvp)) ) {
912 ndp->ni_startdir = ndp->ni_dvp;
914 if (!wantparent && ndp->ni_dvp) {
915 vnode_put(ndp->ni_dvp);
916 ndp->ni_dvp = NULLVP;
980 if (ndp->ni_dvp) {
981 if (ndp->ni_cnd.cn_flags & FSNODELOCKHELD) {
982 ndp->ni_cnd.cn_flags &= ~FSNODELOCKHELD;
983 unlock_fsnode(ndp->ni_dvp, NULL);
985 vnode_put(ndp->ni_dvp);
987 ndp->ni_dvp = dp;
991 ndp->ni_vp = dp = svp; /* on create this may be null */
994 if (ndp->ni_pathlen == 1 && ndp->ni_next[0] == '\0') {
995 ndp->ni_next[0] = '/';
1029 ndp->ni_dvp = dp;
1033 ndp->ni_next = cp;
1034 ndp->ni_vp = dp;
1047 unlock_fsnode(ndp->ni_dvp, NULL);
1049 if (ndp->ni_dvp)
1050 vnode_put(ndp->ni_dvp);
1053 ndp->ni_vp = NULLVP;
1062 unlock_fsnode(ndp->ni_dvp, NULL);
1066 ndp->ni_vp = NULLVP;
1149 * (possibly locked) directory inode in ndp->ni_dvp.
1171 /* ASSERT(dvp == ndp->ni_startdir) */
1187 nameidone(struct nameidata *ndp)
1189 if ((ndp->ni_cnd.cn_flags & FSNODELOCKHELD)) {
1190 ndp->ni_cnd.cn_flags &= ~FSNODELOCKHELD;
1191 unlock_fsnode(ndp->ni_dvp, NULL);
1193 if (ndp->ni_cnd.cn_flags & HASBUF) {
1194 char *tmp = ndp->ni_cnd.cn_pnbuf;
1196 ndp->ni_cnd.cn_pnbuf = NULL;
1197 ndp->ni_cnd.cn_flags &= ~HASBUF;
1198 FREE_ZONE(tmp, ndp->ni_cnd.cn_pnlen, M_NAMEI);