2002-03-07 21:17:12

by James D Strandboge

[permalink] [raw]
Subject: Question regarding VFS programming

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: [email protected]
GPG/PGP ID: 26384A3A
Fingerprint: D9FF DF4A 2D46 A353 A289 E8F5 AA75 DCBE 2638 4A3A


Attachments:
signature.asc (240.00 B)
This is a digitally signed message part