vode to pathname

Robert Watson rwatson at FreeBSD.org
Thu Aug 25 05:17:34 GMT 2005


On Wed, 24 Aug 2005, Dag-Erling Smørgrav wrote:

> "Kamal R. Prasad" <kamalpr at yahoo.com> writes:
>> So the question is, how do I get hold of pathname given
>> vnode*/(inode, devno, generation no) -without relying on the name
>> cache (on freebsd)?
>
> You can't.  The semantics of Unix file systems are such that the mapping 
> from file name to file is one-way.  Furthermore, a file can be 
> associated with more than one file name, or even none at all (if it has 
> been unlinked but is still held open by a process).

In fact, there's another troublesome edge case -- different files can also 
return the same name, if you have a way to generate names from linked 
files, due to mountpoint covering.  Covered vnodes can still be accessed 
after the mount, if they have been opened, or if the cwd of a process is a 
directory (other than the mountpoint vnode) of the covered file system, 
and an identically named node can exist in the covering file system.

Robert N M Watson


More information about the freebsd-hackers mailing list