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 23:12:59
>>>> What, exactly, would you use [a path-for-vnode routine] for?
>>> There are applications where: [...]
>> I think that the original poster hat something like "access control"
> Yes, access control was the context my problems came up in, logging
> may be a nice byproduct.

I still think a vnode-to-path routine is a wrong answer.

For logging, I think the appropriate answer is to record the path via
which the vnode was opened in the relevant open file table entry.  (The
name under which it was opened is probably mroe useful than whatever
name it might now have, and certainly much easier to arrange to have on
hand.)

For access checks, I don't think the pathname is a right answer either.
What do you need a pathname for?  If it's a call involving a pathname
walk (such as open()), you have a pathname at hand; if not, you have to
either have it saved or base your checks on the vnode itself, and in
the latter case a path to it is misleading because it introduces a
bunch of unrelated directories.  I think it would be better to have
something like the fh*() family of syscalls for this purpose - or
perhaps a vnode filesystem, in which live vnodes appear as entries in a
directory, since all you use the pathname for is as a handle on the
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