I am playing around in the VFS code (fs/namei.c), and was wondering what
is the most efficient way of finding a child subdir if I already have
the mountpoint? Currently I am doing somethine like:
<... from_nd initialization ...>
to = kmalloc(PATH_MAX,GFP_KERNEL);
if (to == NULL)
goto rel_fnd;
to[0] = '\0';
/* build the to pathname */
strcat (to, from_nd.dentry->d_sb->s_root->d_name.name);
strcat (to, "/dir_to_find/");
/* check if the directory exists */
if (path_init(to, LOOKUP_POSITIVE, &to_nd))
error = path_walk(to, &to_nd);
if(!error)
...
This seems totally inefficient to me, but I can't seem to find a better
method. I do not want to go into the fs code (eg ext2, etc) for a
faster way-- I need to stay up high in VFS.
Thanks!
Jamie Strandboge
-- Email: jstrand1@rochester.rr.com GPG/PGP ID: 26384A3A Fingerprint: D9FF DF4A 2D46 A353 A289 E8F5 AA75 DCBE 2638 4A3A
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Mar 07 2002 - 21:01:09 EST