Subject: Re: @booted_kernel magic symlink?
To: None <tech-kern@NetBSD.org>
From: Chapman Flack <nblists@anastigmatix.net>
List: tech-kern
Date: 04/26/2006 16:42:55
Charles M. Hannum wrote:
> Especially when there is already a sysctl that serves the same
> purpose.

The one thing that prevents the existing sysctl from serving the
same purpose is that it knows the basename of the booted kernel,
but it does not (and in the general case cannot) know where that
will ultimately be mounted to return a correct full path.  (The
sysctl probably *could* be made to search the mounts to find one
that matches the booted partition, but I am not advocating that
solution; more complex than it's worth and still unable to
handle NFS or other non-local cases).

The key observation is that although the sysctl doesn't and
can't have this information, the admininstrator of the system
certainly does.  There will always some unavoidable step where
the admin either says:

  ln -s /where-I-mount-it/@booted_kernel /netbsd

or writes some rc.d script that always does

  ln -sf /where-I-mount-it/$(sysctl machdep.booted_kernel) /netbsd

every boot. Either solution will work, neither is very much effort
(the first approach looks like < 8 new lines in vfs_lookup.c where
the other magic symlink patterns already are, done once and for all,
while the second asks a few lines of shell scripting of each admin,
and may be wrong before rc runs, but otherwise is just about as
good). I proposed the first approach and Steve proposed the second.
Either one allows the admin to solve problems that are not solved
by the present sysctl or getbootfile(3). And the same objections have
been raised to my proposal and to Steve's.

What I'm not understanding is how it can be suggested that the effort
of reworking all the grovellers to not grovel would be in any way
comparable to the effort of supplying and documenting either one of
these simple workarounds to admins who need them, or how offering a
simple workaround needs to mean we give up on migrating away from
grovelling long-term.

-Chap