Fixed the component-consumption-every-lookup problem.

Now components only consumed on child lookup recursions.
This commit is contained in:
Bahadir Balban
2008-04-16 00:04:54 +01:00
parent 8a3da9c709
commit ab588c279b
4 changed files with 11 additions and 7 deletions

View File

@@ -20,10 +20,11 @@ struct vnode *lookup_dentry_children(struct dentry *parentdir,
{
struct dentry *childdir;
struct vnode *v;
char *component = pathdata_next_component(pdata);
list_for_each_entry(childdir, &parentdir->children, child)
if (IS_ERR(v = childdir->vnode->ops.lookup(childdir->vnode,
pdata)))
pdata, component)))
/* Means not found, continue search */
if ((int)v == -ENOENT)
continue;
@@ -38,14 +39,13 @@ struct vnode *lookup_dentry_children(struct dentry *parentdir,
/* Lookup, recursive, assuming single-mountpoint */
struct vnode *generic_vnode_lookup(struct vnode *thisnode,
struct pathdata *pdata)
struct pathdata *pdata,
char *component)
{
char *component;
struct dentry *d;
struct vnode *found;
int err;
component = pathdata_next_component(pdata);
printf("looking up: %s\n", component);
/* Does this path component match with any of this vnode's dentries? */
list_for_each_entry(d, &thisnode->dentries, vref) {

View File

@@ -61,6 +61,7 @@ struct vnode *vfs_lookup_byvnum(struct superblock *sb, unsigned long vnum)
struct vnode *vfs_lookup_bypath(struct pathdata *pdata)
{
struct vnode *vstart;
char *firstcomp;
/* Do we start from root or curdir? */
if (pdata->root)
@@ -72,7 +73,8 @@ struct vnode *vfs_lookup_bypath(struct pathdata *pdata)
* This does vfs cache + fs lookup.
*/
BUG_ON(list_empty(&pdata->list));
return vstart->ops.lookup(vstart, pdata);
firstcomp = pathdata_next_component(pdata);
return vstart->ops.lookup(vstart, pdata, firstcomp);
}
int vfs_mount_root(struct superblock *sb)