Subject: Re: More config changes, for ro source tree and disjoint build trees
To: None <thorpej@nas.nasa.gov>
From: Mike Long <mike.long@analog.com>
List: tech-kern
Date: 08/13/1996 10:54:57
>From: Jason Thorpe <thorpej@nas.nasa.gov>
>Date: Mon, 12 Aug 1996 20:40:16 -0700
>
>On 12 Aug 1996 23:05:56 -0400
> Michael Graff <explorer@flame.org> wrote:
>
> > To be honest, I would rather see something which allowd you to nearly
> > build a kernel config file from a running kernel. I would love to see
> > some sort of "supported options" list in the kernel itself, with names
> > and status info.
>
>That's certainly possible to implement. However, doing so could lead to
>bloat that's not universally useful.
>
>I guess you'd have to make it an option :-)
You could solve the LKM #ifdef problem and the supported-options
problem at the same time:
1) Options for which LKMs exist, and other "supported" options, are
declared in /sys/.../files* . Part of the declaration is a variable
name, e.g. compat_freebsd for the COMPAT_FREEBSD option.
2) Config generates an options.c file in the kernel build directory
which defines a variable for each supported option. The variable is
nonzero if the option is requested in the user's kernel config file:
int compat_freebsd = 1;
If the option is not requested, the flag is set to zero. Unsupported
options (e.g. driver debug options) end up in IDENT as usual.
options.c is (obviously) compiled into the kernel.
3) Replace #ifdefs for supported options with flag checks:
#ifdef COMPAT_FREEBSD if (compat_freebsd) {
... -> ...
#endif }
Advantages:
1) It's much easier to create LKMs for options for which support code
is scattered all over the tree. A COMPAT_FREEBSD LKM would set the
compat_freebsd variable flag when it loads, and clear it when it
unloads.
2) Userland code can check for the presence of supported options,
either through KVM or (preferably) through a sysctl(3) interface.
This can be done either by a separate utility, or by passing a special
flag to config(8).
Disadvantages:
1) You get some bloat, because those bits of support code are always
included instead of #ifdef'd out if the option is absent. There is
also a speed penalty, because of the added flag checks.
2) Introduces some redundancy for VFS, device, and syscall LKMs, where
you can just check the appropriate table for the presence of the
option.
--
Mike Long <mike.long@analog.com> <URL:http://www.shore.net/~mikel>
VLSI Design Engineer finger mikel@shore.net for PGP public key
Analog Devices, CPD Division CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA (eq (opinion 'ADI) (opinion 'mike)) -> nil