Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_lookup.c
Context not available. | |||||
struct filecaps dirfd_caps; | struct filecaps dirfd_caps; | ||||
struct uio auio; | struct uio auio; | ||||
int error, linklen, startdir_used; | int error, linklen, startdir_used; | ||||
bool handled; | |||||
cnp = &ndp->ni_cnd; | cnp = &ndp->ni_cnd; | ||||
td = cnp->cn_thread; | td = cnp->cn_thread; | ||||
Context not available. | |||||
ndp->ni_startdir->v_type == VBAD); | ndp->ni_startdir->v_type == VBAD); | ||||
TAILQ_INIT(&ndp->ni_cap_tracker); | TAILQ_INIT(&ndp->ni_cap_tracker); | ||||
ndp->ni_lcf = 0; | ndp->ni_lcf = 0; | ||||
ndp->ni_loopcnt = 0; | |||||
startdir_used = 0; | |||||
dp = NULL; | |||||
/* We will set this ourselves if we need it. */ | /* We will set this ourselves if we need it. */ | ||||
cnp->cn_flags &= ~TRAILINGSLASH; | cnp->cn_flags &= ~TRAILINGSLASH; | ||||
ndp->ni_vp = NULL; | |||||
/* | /* | ||||
* Get a buffer for the name to be translated, and copy the | * Get a buffer for the name to be translated, and copy the | ||||
* name into the buffer. | * name into the buffer. | ||||
Context not available. | |||||
error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, | error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, | ||||
&ndp->ni_pathlen); | &ndp->ni_pathlen); | ||||
if (error != 0) { | |||||
namei_cleanup_cnp(cnp); | |||||
return (error); | |||||
} | |||||
cnp->cn_nameptr = cnp->cn_pnbuf; | |||||
/* | /* | ||||
* Don't allow empty pathnames. | * Don't allow empty pathnames. | ||||
*/ | */ | ||||
if (error == 0 && *cnp->cn_pnbuf == '\0') | if (*cnp->cn_pnbuf == '\0') { | ||||
error = ENOENT; | namei_cleanup_cnp(cnp); | ||||
return (ENOENT); | |||||
} | |||||
error = cache_fplookup(ndp, &handled); | |||||
if (handled) | |||||
return (error); | |||||
/* | |||||
* Ignore fast path. | |||||
*/ | |||||
error = 0; | |||||
#ifdef CAPABILITY_MODE | #ifdef CAPABILITY_MODE | ||||
/* | /* | ||||
* In capability mode, lookups must be restricted to happen in | * In capability mode, lookups must be restricted to happen in | ||||
Context not available. | |||||
#endif | #endif | ||||
if (error != 0) { | if (error != 0) { | ||||
namei_cleanup_cnp(cnp); | namei_cleanup_cnp(cnp); | ||||
ndp->ni_vp = NULL; | |||||
return (error); | return (error); | ||||
} | } | ||||
ndp->ni_loopcnt = 0; | |||||
#ifdef KTRACE | #ifdef KTRACE | ||||
if (KTRPOINT(td, KTR_NAMEI)) { | if (KTRPOINT(td, KTR_NAMEI)) { | ||||
KASSERT(cnp->cn_thread == curthread, | KASSERT(cnp->cn_thread == curthread, | ||||
Context not available. | |||||
ndp->ni_rootdir = pwd->pwd_rdir; | ndp->ni_rootdir = pwd->pwd_rdir; | ||||
ndp->ni_topdir = pwd->pwd_jdir; | ndp->ni_topdir = pwd->pwd_jdir; | ||||
startdir_used = 0; | |||||
dp = NULL; | |||||
cnp->cn_nameptr = cnp->cn_pnbuf; | |||||
if (cnp->cn_pnbuf[0] == '/') { | if (cnp->cn_pnbuf[0] == '/') { | ||||
ndp->ni_resflags |= NIRES_ABS; | ndp->ni_resflags |= NIRES_ABS; | ||||
error = namei_handle_root(ndp, &dp); | error = namei_handle_root(ndp, &dp); | ||||
Context not available. |