Lines Matching refs:cnp

108 static	void kdebug_lookup(struct vnode *dp, struct componentname *cnp);
115 int lookup_traverse_mountpoints(struct nameidata *ndp, struct componentname *cnp, vnode_t dp, int vbusyflags, vfs_context_t ctx);
117 int lookup_authorize_search(vnode_t dp, struct componentname *cnp, int dp_authorized_in_cache, vfs_context_t ctx);
118 void lookup_consider_update_cache(vnode_t dvp, vnode_t vp, struct componentname *cnp, int nc_generation);
119 int lookup_handle_rsrc_fork(vnode_t dp, struct nameidata *ndp, struct componentname *cnp, int wantparent, vfs_context_t ctx);
120 int lookup_handle_found_vnode(struct nameidata *ndp, struct componentname *cnp, int rdonly,
123 int lookup_handle_emptyname(struct nameidata *ndp, struct componentname *cnp, int wantparent);
169 struct componentname *cnp = &ndp->ni_cnd;
170 vfs_context_t ctx = cnp->cn_context;
182 if (cnp->cn_nameiop & (~OPMASK))
184 if (cnp->cn_flags & OPMASK)
195 rdonly = cnp->cn_flags & RDONLY;
196 vbusyflags = ((cnp->cn_flags & CN_NBMOUNTLOOK) != 0) ? LK_NOWAIT : 0;
198 wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT);
207 if ((cnp->cn_flags & ISSYMLINK) == 0) {
223 if ((cnp->cn_flags & HASBUF) == 0) {
224 cnp->cn_pnbuf = ndp->ni_pathbuf;
225 cnp->cn_pnlen = PATHBUFLEN;
237 error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf,
238 cnp->cn_pnlen, (size_t *)&ndp->ni_pathlen);
240 error = copystr(CAST_DOWN(void *, ndp->ni_dirp), cnp->cn_pnbuf,
241 cnp->cn_pnlen, (size_t *)&ndp->ni_pathlen);
243 if (error == ENAMETOOLONG && !(cnp->cn_flags & HASBUF)) {
244 MALLOC_ZONE(cnp->cn_pnbuf, caddr_t, MAXPATHLEN, M_NAMEI, M_WAITOK);
245 if (cnp->cn_pnbuf == NULL) {
250 cnp->cn_flags |= HASBUF;
251 cnp->cn_pnlen = MAXPATHLEN;
266 cnp->cn_pnbuf[0] == '/' &&
267 cnp->cn_pnbuf[1] == '.' &&
268 cnp->cn_pnbuf[2] == 'v' &&
269 cnp->cn_pnbuf[3] == 'o' &&
270 cnp->cn_pnbuf[4] == 'l' &&
271 cnp->cn_pnbuf[5] == '/' ) {
283 if ((realpath_err= vfs_getrealpath(&cnp->cn_pnbuf[6], realpath, MAXPATHLEN, ctx))) {
290 if (cnp->cn_flags & HASBUF) {
291 FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
293 cnp->cn_pnbuf = realpath;
294 cnp->cn_pnlen = MAXPATHLEN;
296 cnp->cn_flags |= HASBUF | CN_VOLFSPATH;
304 if (cnp->cn_flags & AUDITVNPATH1)
305 AUDIT_ARG(upath, ut->uu_cdir, cnp->cn_pnbuf, ARG_UPATH1);
306 if (cnp->cn_flags & AUDITVNPATH2)
307 AUDIT_ARG(upath, ut->uu_cdir, cnp->cn_pnbuf, ARG_UPATH2);
313 if (*cnp->cn_pnbuf == '\0') {
326 cnp->cn_nameptr = cnp->cn_pnbuf;
330 if (*(cnp->cn_nameptr) == '/') {
331 while (*(cnp->cn_nameptr) == '/') {
332 cnp->cn_nameptr++;
336 } else if (cnp->cn_flags & USEDVP) {
358 if ((cnp->cn_flags & ISSYMLINK) == 0) {
381 if ( (cnp->cn_flags & HASBUF) ) {
382 cnp->cn_flags &= ~HASBUF;
383 FREE_ZONE(cnp->cn_pnbuf, cnp->cn_pnlen, M_NAMEI);
385 cnp->cn_pnbuf = NULL;
410 lookup_authorize_search(vnode_t dp, struct componentname *cnp, int dp_authorized_in_cache, vfs_context_t ctx)
420 error = mac_vnode_check_lookup(ctx, dp, cnp);
429 lookup_consider_update_cache(vnode_t dvp, vnode_t vp, struct componentname *cnp, int nc_generation)
432 isdot_or_dotdot = (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') || (cnp->cn_flags & ISDOTDOT);
444 vnode_update_identity(vp, dvp, cnp->cn_nameptr, cnp->cn_namelen, cnp->cn_hash, update_flags);
447 if ( (cnp->cn_flags & MAKEENTRY) && (vp->v_flag & VNCACHEABLE) && LIST_FIRST(&vp->v_nclinks) == NULL) {
462 cache_enter_with_gen(dvp, vp, cnp, nc_generation);
474 lookup_handle_rsrc_fork(vnode_t dp, struct nameidata *ndp, struct componentname *cnp, int wantparent, vfs_context_t ctx)
484 switch (cnp->cn_nameiop) {
486 if (cnp->cn_flags & CN_ALLOWRSRCFORK) {
494 if (cnp->cn_flags & CN_ALLOWRSRCFORK) {
503 if (cnp->cn_flags & CN_ALLOWRSRCFORK) {
545 cnp->cn_flags &= ~MAKEENTRY;
568 lookup_handle_found_vnode(struct nameidata *ndp, struct componentname *cnp, int rdonly,
600 if (cnp->cn_consume > 0) {
601 cnp->cn_nameptr += cnp->cn_consume;
602 ndp->ni_next += cnp->cn_consume;
603 ndp->ni_pathlen -= cnp->cn_consume;
604 cnp->cn_consume = 0;
606 lookup_consider_update_cache(ndp->ni_dvp, dp, cnp, nc_generation);
614 error = lookup_traverse_mountpoints(ndp, cnp, dp, vbusyflags, ctx);
632 ((cnp->cn_flags & FOLLOW) || (ndp->ni_flag & NAMEI_TRAILINGSLASH) || *ndp->ni_next == '/')) {
633 cnp->cn_flags |= ISSYMLINK;
669 cnp->cn_nameptr = ndp->ni_next + 1;
671 while (*cnp->cn_nameptr == '/') {
672 cnp->cn_nameptr++;
676 cp = cnp->cn_nameptr;
692 (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) {
698 if (cnp->cn_flags & SAVESTART) {
716 if (cnp->cn_flags & AUDITVNPATH1)
718 else if (cnp->cn_flags & AUDITVNPATH2)
725 if ((cnp->cn_flags & CN_WANTSRSRCFORK) && (dp != NULLVP)) {
726 error = lookup_handle_rsrc_fork(dp, ndp, cnp, wantparent, ctx);
734 kdebug_lookup(dp, cnp);
739 error = lookup_handle_emptyname(ndp, cnp, wantparent);
753 lookup_handle_emptyname(struct nameidata *ndp, struct componentname *cnp, int wantparent)
759 cnp->cn_namelen = 0;
768 if (cnp->cn_nameiop != LOOKUP) {
785 cnp->cn_flags &= ~ISDOTDOT;
786 cnp->cn_flags |= ISLASTCN;
787 ndp->ni_next = cnp->cn_nameptr;
790 if (cnp->cn_flags & AUDITVNPATH1)
792 else if (cnp->cn_flags & AUDITVNPATH2)
794 if (cnp->cn_flags & SAVESTART)
868 struct componentname *cnp = &ndp->ni_cnd;
869 vfs_context_t ctx = cnp->cn_context;
879 if (cnp->cn_flags & (NOCACHE | DOWHITEOUT)) {
880 if ((cnp->cn_flags & NOCACHE) || (cnp->cn_nameiop == DELETE))
883 wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT);
884 rdonly = cnp->cn_flags & RDONLY;
885 cnp->cn_flags &= ~ISSYMLINK;
886 cnp->cn_consume = 0;
891 if ((cnp->cn_flags & CN_NBMOUNTLOOK) != 0)
893 cp = cnp->cn_nameptr;
902 error = lookup_handle_emptyname(ndp, cnp, wantparent);
913 if ( (error = cache_lookup_path(ndp, cnp, dp, ctx, &dp_authorized, last_dp)) ) {
917 if ((cnp->cn_flags & ISLASTCN)) {
919 cnp->cn_flags |= MAKEENTRY;
921 cnp->cn_flags |= MAKEENTRY;
952 if ( (cnp->cn_flags & ISDOTDOT) ) {
973 (cnp->cn_flags & NOCROSSMOUNT))
1004 if ( (cnp->cn_flags & DONOTAUTH) != DONOTAUTH ) {
1005 error = lookup_authorize_search(dp, cnp, dp_authorized, ctx);
1016 if ((cnp->cn_flags & ISLASTCN) && namei_compound_available(dp, ndp) && !(cnp->cn_flags & CN_WANTSRSRCFORK)) {
1018 if ((cnp->cn_flags & ISLASTCN) && namei_compound_available(dp, ndp)) {
1027 error = VNOP_LOOKUP(dp, &ndp->ni_vp, cnp, ctx);
1036 if ((cnp->cn_flags & FSNODELOCKHELD)) {
1037 cnp->cn_flags &= ~FSNODELOCKHELD;
1070 if (cnp->cn_flags & SAVESTART) {
1081 kdebug_lookup(ndp->ni_dvp, cnp);
1086 error = lookup_handle_found_vnode(ndp, cnp, rdonly, vbusyflags, &keep_going, nc_generation, wantparent, atroot, ctx);
1096 ((cnp->cn_flags & FOLLOW) || (ndp->ni_flag & NAMEI_TRAILINGSLASH) || *ndp->ni_next == '/')) {
1114 if ((cnp->cn_flags & FSNODELOCKHELD)) {
1115 cnp->cn_flags &= ~FSNODELOCKHELD;
1126 kdebug_lookup(dp, cnp);
1131 if ((cnp->cn_flags & FSNODELOCKHELD)) {
1132 cnp->cn_flags &= ~FSNODELOCKHELD;
1141 kdebug_lookup(dp, cnp);
1148 struct componentname *cnp = &ndp->ni_cnd;
1154 if (cnp->cn_flags & RDONLY) {
1157 if ((cnp->cn_flags & ISLASTCN) && (ndp->ni_flag & NAMEI_TRAILINGSLASH) && !(cnp->cn_flags & WILLBEDIR)) {
1168 lookup_traverse_mountpoints(struct nameidata *ndp, struct componentname *cnp, vnode_t dp,
1184 ((cnp->cn_flags & NOCROSSMOUNT) == 0)) {
1220 if ((cnp->cn_flags & ISLASTCN) &&
1221 (cnp->cn_nameiop != LOOKUP ||
1222 (cnp->cn_flags & NOTRIGGER))) {
1291 struct componentname *cnp = &ndp->ni_cnd;
1296 if ((cnp->cn_flags & FSNODELOCKHELD)) {
1297 cnp->cn_flags &= ~FSNODELOCKHELD;
1309 if (ndp->ni_pathlen > 1 || !(cnp->cn_flags & HASBUF))
1320 cp = cnp->cn_pnbuf;
1346 long len = cnp->cn_pnlen;
1348 tmppn = cnp->cn_pnbuf;
1350 cnp->cn_pnbuf = cp;
1351 cnp->cn_pnlen = MAXPATHLEN;
1353 if ( (cnp->cn_flags & HASBUF) )
1356 cnp->cn_flags |= HASBUF;
1358 cnp->cn_pnbuf[linklen] = '\0';
1361 cnp->cn_nameptr = cnp->cn_pnbuf;
1381 if (*(cnp->cn_nameptr) == '/') {
1382 while (*(cnp->cn_nameptr) == '/') {
1383 cnp->cn_nameptr++;
1401 relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
1411 vfs_context_t ctx = cnp->cn_context;;
1416 wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT);
1417 rdonly = cnp->cn_flags & RDONLY;
1418 cnp->cn_flags &= ~ISSYMLINK;
1420 if (cnp->cn_flags & NOCACHE)
1421 cnp->cn_flags &= ~MAKEENTRY;
1423 cnp->cn_flags |= MAKEENTRY;
1432 if (cnp->cn_nameptr[0] == '\0') {
1433 if (cnp->cn_nameiop != LOOKUP || wantparent) {
1447 if (cnp->cn_flags & SAVESTART)
1454 if ( (error = VNOP_LOOKUP(dp, vpp, cnp, ctx)) ) {
1482 if (dp->v_type == VLNK && (cnp->cn_flags & FOLLOW))
1490 (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) {
1570 kdebug_lookup(struct vnode *dp, struct componentname *cnp)
1579 dbg_namelen = (cnp->cn_nameptr - cnp->cn_pnbuf) + cnp->cn_namelen;
1580 dbg_nameptr = cnp->cn_nameptr + cnp->cn_namelen;
1592 *(cnp->cn_nameptr + cnp->cn_namelen) ? '>' : 0,
1618 kdebug_lookup(struct vnode *dp __unused, struct componentname *cnp __unused)