Messages in this thread | | | Date | Wed, 17 Dec 1997 19:49:32 +0100 | From | Pavel Machek <> | Subject | Re: /proc/memmap [name from inode?] |
| |
Hi!
> >The one thing I haven't figured out is how to get from the inode to the > >filename which would be nice ... you comment that this should be possible > >given the dentry stuff in 2.1 but I can't see an obvious path to do this > >looking at the 2.1 structures and code in the kernel. > > Have a look at how /proc/<pid>/maps does it in fs/proc/array.c > Basically: > > buffer = (char *) __get_free_page(GFP_KERNEL); > if (buffer && pdentry) > { > line = d_path(pdentry, buffer, PAGE_SIZE); > free_page((unsigned long) buffer); > } > else > /* show dev, ino instead */
But they are doing lookup of name from dentry. I *think* that you can *not* get name from inode - inode may have 0, 1, 2, 3, ... names! (Think of deleted files - 0 names. Think of hardlinks - many names).
Pavel
-- I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).
| |