Re: Pathname from inode?

Raul Miller (rdm@test.legislate.com)
Mon, 5 May 1997 09:26:51 -0400


On May 2, James R. Leu wrote
> If this is a dumb question just point me to the source file and flame lightly.
>
> Is there a fast way of resolving the pathname of a given inode?

If the inode refers to a directory, sure (take a look at the
implementation of pwd in sh).

For completely random files, with no directory, the best you can
do is an exhaustive search under the directory which is the mount
point for that device. And you still might not find it, since
not all inodes exist in the file system (for example you can have
a file that's open but which has been deleted -- storage isn't
reclaimed till you close the file).

-- 
Raul