At least in the 2.4 kernels, there's already a __d_path() routine (fs/dcache.c)
that builds the pathname using the mechanism you discussed.
Here's one way you could use it:
char *path = (char *) __get_free_page(GFP_USER);
struct vfsmnt *pwdmnt;
struct dentry *pwd;
pwdmnt = mntget(current->fs->pwdmnt);
pwd = dget(current->fs->pwd);
path = __d_path(pwd, pwdmnt, NULL, NULL, path, PAGE_SIZE);
If you only want the pathname back to the process root, use d_path() instead
(and don't grab the dcache_lock).
When you're done with path, free it with free_page() and not kfree().
BTW, I'm not subscribed to the kernel mailing list (I just read it on the web),
so please copy me on any response.
-- Brian Watson Compaq Computer - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to email@example.com More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/