Subject: Re: How to resolve the filename(s) for a vnode?
To: None <tech-kern@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 10/18/2005 01:01:20
> Resolving the filename (at least one of them) for a vnode is not
> supported by the OS directly.  FreeBSD has vn_fullpath(), MacOS X has
> vn_getpath(), Linux has __d_path() although it's not public, NetBSD
> seems to lack such a routine.

This is probably because the problem is not very well defined.

A vnode may appear in any number of directory entries, from zero
upwards.  You may be satisfied with "pick one, any one" semantics for
cases where there are multiple paths, but what about the case where
there are *no* paths?  This is the normal case for a file which is open
but unlinked.  (You might want to look into what vn_fullpath,
vn_getpath, and __d_path return in such a case.)

For that matter, what do you do when there are multiple paths, you pick
one, and that path then becomes invalid?  How do you notice this, and
what do you do about it?  What if it was the last path to that vnode?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B