version 1.1.1.1, 2008/06/03 10:38:51 |
version 1.1.1.1.2.1, 2008/08/13 17:12:44 |
|
|
/* |
/* |
* Convert a pathname into a pointer to a locked vnode. |
* Convert a pathname into a pointer to a locked vnode. |
* @path: full path name. |
* @path: full path name. |
* @vpp: vnode to be returned. |
* @vpp: vnode to be returned. |
*/ |
*/ |
int |
int |
namei(char *path, vnode_t *vpp) |
namei(char *path, vnode_t *vpp) |
|
|
vnode_t dvp, vp; |
vnode_t dvp, vp; |
int err, i; |
int err, i; |
|
|
vn_printf("namei: path=%s\n", path); |
DPRINTF(VFSDB_VNODE, ("namei: path=%s\n", path)); |
|
|
/* |
/* |
* Convert a full path name to its mount point and |
* Convert a full path name to its mount point and |
|
|
vp = vn_lookup(mp, node); |
vp = vn_lookup(mp, node); |
if (vp) { |
if (vp) { |
/* vnode is already active. */ |
/* vnode is already active. */ |
vref(vp); |
|
*vpp = vp; |
*vpp = vp; |
return 0; |
return 0; |
} |
} |
/* |
/* |
* Find target vnode, started from root directory. This is |
* Find target vnode, started from root directory. |
* done to attach the fs specific data to the target vnode. |
* This is done to attach the fs specific data to |
|
* the target vnode. |
*/ |
*/ |
if ((dvp = mp->m_root) == NULL) |
if ((dvp = mp->m_root) == NULL) |
sys_panic("VFS: no root"); |
sys_panic("VFS: no root"); |
|
|
strlcat(node, "/", PATH_MAX); |
strlcat(node, "/", PATH_MAX); |
strlcat(node, name, PATH_MAX); |
strlcat(node, name, PATH_MAX); |
vp = vn_lookup(mp, node); |
vp = vn_lookup(mp, node); |
if (vp) { |
if (vp == NULL) { |
vref(vp); |
|
} else { |
|
vp = vget(mp, node); |
vp = vget(mp, node); |
if (vp == NULL) { |
if (vp == NULL) { |
vput(dvp); |
vput(dvp); |
|
|
vnode_t vp; |
vnode_t vp; |
int err; |
int err; |
|
|
vn_printf("lookup: path=%s\n", path); |
DPRINTF(VFSDB_VNODE, ("lookup: path=%s\n", path)); |
|
|
/* |
/* |
* Get the path for directory. |
* Get the path for directory. |