_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
such pseudo-devices, create cfdrivers for them which carry the appropriate
attributes. This allows devices in the config file to be attached to
pseudo-devices.
allowing for the following:
file foo.c foobar | bar
defflag BAR
device foobar
...to be expressed in the following (more natural) way:
define foo
file foo.c foo
defflag BAR: foo
device foobar: foo
allows for the following:
define foo
define bar { }: foo
device foobar: bar
An instance of "foobar" will select "bar", which will in turn select
"foo" due to "bar"'s dependency on "foo".
Circular dependencies are not allowed, and a dependency may also not
be an interface attribute.
a vector of indices into the cfdata table to specify potential parents,
record the interface attributes that devices have and add a new "parent
spec" structure which lists the iattr, as well as optionally listing
specific parent device instances.
See:
http://mail-index.netbsd.org/tech-kern/2002/09/25/0014.html
...for a detailed description.
While here, const poison some things, as suggested by Matt Thomas.
This merge changes the device switch tables from static array to
dynamically generated by config(8).
- All device switches is defined as a constant structure in device drivers.
- The new grammer ``device-major'' is introduced to ``files''.
device-major <prefix> char <num> [block <num>] [<rules>]
- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.
- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.
- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.
- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.
- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
- Add `no' keyword, which can be used in the following ways:
no file-system SOMEFS
no makeoptions FOO
no options OPT1[,OPT2[,...]]
no pseudo-device somepseudo
This turns off a previous file-system/makeoptions/options/pseudo-device
entry for the same item.
Grammar support for 'no device DEV at ATTACH' added, but not
implemented yet.
Code changes:
- Convert many simple lists to TAILQs
- Convert prefix to SLIST
- Remove argument names from prototypes.
- Don't bother with custom alloc code for hashtables; just use emalloc()
like everything else.
- Implement ht_remove(), to remove an entry from a hash table.
Add removed entries to a freelist for later reuse.
- Don't selectbase() devices and pseudo-devices at definition time; instead
do it at one pass after the config file has been parsed in fixdevis().
- Rename nvhead to nvfreelist; a more apt name...
- Minor code cleanups.
have a way to embed the revision number into the kernel's "uname -v"
output. The patch below does this, by generating a new keyword "ident"
that can be followed by any string, e.g.
ident "NOON-$Revision$"
will lead to
vvvvvvvvvvvvvvvvvvvvvv
char version[] = "NetBSD 1.4P (NOON-$Revision: 1.21 $) #37: Thu Jan
20 02:01:23 MET 2000\n feyrer@noon:/usr/cvs.local/src-current/sys/arch/i386/c
ompile/NOON\n";
This will lead to a version of "MYMACHINE-$Revision$" instead of the
kernel config file name. If "ident" is not present, the current behaviour
of using the kernel config file's name as identifier is used.
Implement by writing the ident to a file ("ident") in the compile dir,
which newvers.sh will pick up for generating the ident.
is declared at most once.
* Do option dependency across all def{opt,param, flag}.
* Make the default value of otherwise-unspecified defopt's be 1,
for consistency with non-defopt'ed options.
* Wrap an abstraction layer (macros) around tests for defopt, filesystem,
defparam, etc. to catch outdated defopt-vs-filesystem tests.
a change to the config grammar, to specify a device's class (i.e. DV_xxx)
like:
device sd class disk: ...
Also emit an ioconf.h, which contains extern declarations of the
cfdriver structures.
While I'm here, add support for specifying multiple options per defopt
line, as well as specifying the file name in which the options will
appear.
defopt foo bar baz
generates "opt_foo.h", "opt_bar.h", and "opt_baz.h"
defopt opt_mumble.h foo bar baz
generates "opt_mumble.h" which contains all three options.
Also, clean up and fix some bugs in the code that generates header files.
new swap system. The dump specification syntax is now more flexible,
and supports constructs like the following:
config netbsd root on ? type ? dumps on ?
- wildcarded root, fstype, and dump device
config netbsd root on ? type ffs dumps on sd0b
- wildcarded root, ffs root fs, always dump on sd0b
config netbsd root on de0 type nfs dumps on wd0b
- mount an nfs root using de0, and write kernel crash dumps
to wd0b
Also, garbage-collect some now unused code, now that swap configuration
is no longer handled by config(8).
reported in PR #3668 from maximum entropy <entropy@tanstaafl.bernstein.com>.
The problem: The unit number is not being conveyed to the configuration
crosscheck with root is a network interface; the device number is set
to NODEV, which sets up the (correct) defaults for swap/dump devices.
We can't change NODEV to a unit number, as the PR's patch suggests, as
this breaks the swap/dump defaults. Rewriting that code is not really
justified, since it's soon to be obsoleted.
The kludge: add an "nv_ifunit" member to struct nvlist, which convey's
a network interface's unit number to the crosscheck routine. It's not
pretty, but it's not terribly invasive, and can be garbage-collected
easily when the swap/dump goo is obsoleted.
and the root device:
- New "file-system" keyword is used to configure file systems into
the kernel.
- New way of specifying root device, which allows root file system
type to always be specified. Examples:
config gennetbsd swap generic
config sdnetbsd root on sd0a swap on sd0b
config nfsnetbsd root on nfs
are replaced by:
config gennetbsd root on ? type ?
config sdnetbsd root on sd0a type ffs swap on sd0b
config nfsnetbsd root on ? type nfs
config lenetbsd root on le0 type nfs
Note that specific network interfaces may now be specified as
the root device.
- swapgeneric.c is no longer used; generate a swap*.c file for each
"config" line in the kernel configuration file.
in XXX-marked comments in the recent attachment changes), this was a
long-standing bug in config.
The problem: If a device is attached to a device via an attribute exported
by that device (i.e. foo* at bar0, where 'bar' exports an attribute that
'foo' attaches to), but the device attached to is not present in the
kernel configuration file, AND another device which exports an attribute
that 'foo' attaches to _is_ present (e.g. a device baz0, if one could
specify 'foo0 at baz0'), then: the configuration file will (incorrectly)
be accepted by config, and the resulting ioconf.c will include a bogus
cfdata entry for the device (in the example, 'foo*'). This typically
causes the resulting kernel to crash during autoconfiguration.
The solution: Be much more careful about keeping track of where a device
was attached, and, in particular, if a device was attached to another device,
_always_ keep track of what device it was attached to. Then, when
cross-checking, if the attached-to device isn't present, give up and do not
check attributes. Also, document the process much more thoroughly.
used for checking device attachment names as are used for device name
checking, because device names can be used as attachment names. (Actually,
less strict rules could be used, but there's little point in that.) This
was not a mistake of design, this was just a mistake; i misunderstood
the devbase name checking code.
- split softc size and match/attach out from cfdriver into
a new struct cfattach.
- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.