Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Aug 2003 22:21:36 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Tobias Roth <roth@iam.unibe.ch>
Cc:        current@freebsd.org
Subject:   Re: mdconfig feature request
Message-ID:  <3F31E1E0.FDE0911F@mindspring.com>
References:  <20030806090253.GA23980@speedy.unibe.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
Tobias Roth wrote:
> would it be possible to add the currently attached vnode (or the
> complete path to it) to the output of
> 
>   mdconfig -l -u <devicenumber>
> 
> that would simplify some things for me.

You could do the vnode.  Doing the path is hard.

The kernel doesn't really know from paths.

Basically, the path is not known to the kernel; it's thrown away
as soon as it's translated to a vnode, because it's pretty much
useless wasted space, as far as the kernel is concerned, and the
only reason it deals with them at all is because it has to deal
with humans.

The actual problem is that while there was *a* path to a file, it
may not be *the* path to the file, and it *may* have included
symbolic links, and it *may* have been one of several hard links
(how do you know which one to return, especially if you are using
exclusion groups or directory permissions to hide information?),
and it *may* be that the file was subsequently deleted, and the
only thing holding it in existance at all is the mdconfig reference
that's outstanding (in which case, the path would best be described
as "you, you fool!").

So, unless you are using an FS that doesn't permit hard links, and
doesn't permit deleting open files (e.g. a file share from an SMB
server, like Windows NT 3.5.1 or Windows XP or Windows 2000), you
are pretty much SOL as to reliably getting the path back from just
the vnode reference.

The best thing to do is to remember what you did, so you can tell
the kernel again later.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F31E1E0.FDE0911F>