Lines Matching defs:ndp
438 * identify next component of name at ndp->ni_ptr
455 * cnp is always equal to &ndp->ni_cnp.
458 struct nameidata *ndp;
466 unsigned root_referenced:1; /* true if ndp->ni_rootdir and
467 ndp->ni_erootdir were referenced */
475 namei_init(struct namei_state *state, struct nameidata *ndp)
478 state->ndp = ndp;
479 state->cnp = &ndp->ni_cnd;
499 state->ndp->ni_pnbuf = state->ndp->ni_pathbuf->pb_path;
510 KASSERT(state->cnp == &state->ndp->ni_cnd);
513 if (state->ndp->ni_rootdir != NULL)
514 vrele(state->ndp->ni_rootdir);
515 if (state->ndp->ni_erootdir != NULL)
516 vrele(state->ndp->ni_erootdir);
530 struct nameidata *ndp = state->ndp;
537 if (state->ndp->ni_rootdir != NULL)
538 vrele(state->ndp->ni_rootdir);
539 if (state->ndp->ni_erootdir != NULL)
540 vrele(state->ndp->ni_erootdir);
560 erootdir = ndp->ni_erootdir;
561 } else if (!strncmp(ndp->ni_pnbuf, "/../", 4)) {
572 if (ndp->ni_pnbuf[0] != '/') {
573 if (ndp->ni_atdir != NULL) {
574 startdir = ndp->ni_atdir;
586 state->ndp->ni_rootdir = rootdir;
587 state->ndp->ni_erootdir = erootdir;
597 if (state->ndp->ni_rootdir != NULL)
598 ndp->ni_rootdir);
599 if (state->ndp->ni_erootdir != NULL)
600 vref(state->ndp->ni_erootdir);
616 KASSERT(state->ndp->ni_atdir != NULL);
622 state->ndp->ni_rootdir = rootvnode;
623 state->ndp->ni_erootdir = NULL;
625 vref(state->ndp->ni_atdir);
627 vref(state->ndp->ni_rootdir);
629 return state->ndp->ni_atdir;
639 struct nameidata *ndp = state->ndp;
645 if (ndp->ni_erootdir != NULL) {
655 emul_path = ndp->ni_next;
659 ndp->ni_pnbuf, ndp->ni_pathlen);
661 ktrnamei(ndp->ni_pnbuf, ndp->ni_pathlen);
674 struct nameidata *ndp = state->ndp;
678 ndp->ni_pathlen = strlen(ndp->ni_pnbuf) + 1;
683 if (ndp->ni_pathlen == 1) {
684 ndp->ni_erootdir = NULL;
688 ndp->ni_loopcnt = 0;
737 struct nameidata *ndp = state->ndp;
747 if (ndp->ni_loopcnt++ >= MAXSYMLINKS) {
791 (linklen + ndp->ni_pathlen >= MAXPATHLEN)) {
795 if (ndp->ni_pathlen > 1) {
797 memcpy(cp + linklen, ndp->ni_next, ndp->ni_pathlen);
801 ndp->ni_pathlen += linklen;
802 memcpy(ndp->ni_pnbuf, cp, ndp->ni_pathlen);
806 cnp->cn_nameptr = ndp->ni_pnbuf;
811 if (ndp->ni_pnbuf[0] == '/') {
814 searchdir = ndp->ni_erootdir;
816 (ndp->ni_pnbuf[1] == '.'
817 && ndp->ni_pnbuf[2] == '.'
818 && ndp->ni_pnbuf[3] == '/')) {
819 ndp->ni_erootdir = NULL;
820 searchdir = ndp->ni_rootdir;
825 ndp->ni_pathlen--;
844 struct nameidata *ndp = state->ndp;
846 KASSERT(cnp == &ndp->ni_cnd);
873 ndp->ni_pathlen -= cnp->cn_namelen;
874 ndp->ni_next = cp;
884 state->slashes = cp - ndp->ni_next;
885 ndp->ni_pathlen -= state->slashes;
886 ndp->ni_next = cp;
1080 struct nameidata *ndp = state->ndp;
1082 KASSERT(cnp == &ndp->ni_cnd);
1103 if (searchdir == ndp->ni_rootdir ||
1116 if (ndp->ni_rootdir != rootvnode) {
1119 retval = vn_isunder(searchdir, ndp->ni_rootdir,
1132 foundobj = ndp->ni_rootdir;
1272 struct nameidata *ndp = state->ndp;
1288 oldpathlen = ndp->ni_pathlen;
1314 if (ndp->ni_rootdir != rootvnode) {
1426 cnp->cn_nameptr = ndp->ni_next;
1475 ndp->ni_pathlen = oldpathlen;
1501 struct nameidata *ndp = state->ndp;
1509 ndp->ni_dvp = NULL;
1510 ndp->ni_vp = NULL;
1526 cnp->cn_nameptr = ndp->ni_pnbuf;
1531 ndp->ni_pathlen--;
1587 ndp->ni_dvp = NULL;
1588 ndp->ni_vp = NULL;
1628 ndp->ni_pathlen += state->slashes;
1629 ndp->ni_next -= state->slashes;
1672 ndp->ni_dvp = NULL;
1673 ndp->ni_vp = NULL;
1716 ndp->ni_dvp = NULL;
1717 ndp->ni_vp = NULL;
1732 cnp->cn_nameptr = ndp->ni_next;
1750 if (foundobj == ndp->ni_erootdir) {
1768 foundobj = ndp->ni_rootdir;
1815 ndp->ni_dvp = NULL;
1816 ndp->ni_vp = NULL;
1848 ndp->ni_dvp = NULL;
1849 ndp->ni_vp = NULL;
1892 ndp->ni_dvp = searchdir;
1893 ndp->ni_vp = foundobj;
1906 struct nameidata *ndp = state->ndp;
1910 KASSERT(cnp == &ndp->ni_cnd);
1913 savepath = pathbuf_stringcopy_get(ndp->ni_pathbuf);
1926 if (ndp->ni_erootdir != NULL && state->attempt_retry) {
1932 strcpy(ndp->ni_pathbuf->pb_path, savepath);
1933 pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath);
1940 pathbuf_stringcopy_put(ndp->ni_pathbuf, savepath);
1949 namei(struct nameidata *ndp)
1954 namei_init(&state, ndp);
1961 KASSERT(ndp->ni_dvp == NULL);
1962 KASSERT(ndp->ni_vp == NULL);
1982 lookup_for_nfsd(struct nameidata *ndp, struct vnode *forcecwd, int neverfollow)
1987 KASSERT(ndp->ni_atdir == NULL);
1988 ndp->ni_atdir = forcecwd;
1990 namei_init(&state, ndp);
1997 KASSERT(ndp->ni_dvp == NULL);
1998 KASSERT(ndp->ni_vp == NULL);
2026 struct nameidata *ndp = state->ndp;
2032 KASSERT(cnp == &ndp->ni_cnd);
2034 startdir = state->ndp->ni_atdir;
2036 cnp->cn_nameptr = ndp->ni_pnbuf;
2039 ndp->ni_dvp = NULL;
2048 ndp->ni_pathlen -= cnp->cn_namelen;
2049 ndp->ni_next = cp;
2095 ndp->ni_vp = foundobj;
2106 lookup_for_nfsd_index(struct nameidata *ndp, struct vnode *startdir)
2111 KASSERT(ndp->ni_atdir == NULL);
2112 ndp->ni_atdir = startdir;
2118 if (strlen(ndp->ni_pathbuf->pb_path) > KERNEL_NAME_MAX) {
2121 if (strchr(ndp->ni_pathbuf->pb_path, '/')) {
2125 ndp->ni_pathlen = strlen(ndp->ni_pathbuf->pb_path) + 1;
2126 ndp->ni_pnbuf = NULL;
2127 ndp->ni_cnd.cn_nameptr = NULL;
2129 namei_init(&state, ndp);