Ensure we break ties in every case. This way, even though we use the
unstable qsort(3) library routine, the output is reproducible, no
matter what algorithm is behind qsort(3).
It would be nice if we could just use a stable sort function here,
but mergesort(3) is nonstandard, so we'd have to add it to
tools/compat, which is a big pain.
Instead, put a tie-breaking rule in every comparison function we use
with qsort, and abort() in the event of ties -- that way, we noisily
refuse to rely on unstable sort order.
While here, dispense with any question of integer overflow, and
sprinkle comments.
PR bin/58115
foo* at bar? with baz
foo* at bar? with barf
Do this by scanning the list of iba's and allocating a new cfparent for
each. Keep track of the shared parent+child combinations by using the
same id for them.
instead of using struct nvlist.
(struct nvlist holds lists (or trees!) of semi-arbitrary stuff with no
structure and almost no type safety; it should go away.)
This was nagging me already yesterday, but I decided to leave it
alone for better compat with old ioconf.c builds. But as it turns
out, new code depends on newly built ioconf.c with a new config(1)
anyway, so renaming is not an issue (at least not at this stage).
While renaming, namespace cfdriver and cfattach in "ioconf" rather
than "comp", since the former reflects the config(5) keyword.
This is done by giving the "ioconf" keyword in the config file.
As a result, config produces only ioconf.c and locators.h. Currently,
only "monolithic" configurations with the device path starting from
root are supported. Eventually, the goal is to support a local
root in the input file from any point along the device tree using
files.* in our kernel tree. This will make autogenerating the
config glue for device modules possible instead of having to write
it by hand like is currently required (yes, it sounds simple to
implement, but ...).
reviewed by cube.
(the next part will demand major discussions with you, so prepare ;)
devmajor_t/devminor_t, as proposed on tech-kern.
This avoids 64-bit arithmetics and 64-bit printf formats in parts
of the kernel where it is not really useful, and helps clarity.
call - which makes the code completely impossibly to follow, call fflush()
and ferror() just prior to calling fclose().
This has the advantage of actually detecting the any write errors, since
the output is block bufferred and will typically not happen during fprintf()
but only during the fclose() - where it is difficult to report.
I also singlilarly refuse to add (void) casts to every printf call in the
system - since it almost never makes any sense to look at the return value
(unless you want to know how many bytes were actually writtem).
o Rework do_kill_orphans() to use that information and mark explicitely
orphaned devices (i.e., the ones whose missing ancestor has been
negated)
o Make a distinction between erroneous orphans and explicit orphans.
Error out on the former, ignore the later (but print a warning when -v
is used)
Yes, now config(1) will actually stop if you comment out a parent. That
should help people still hoping adjustkernel is relevant these days :)
track of instances attaching at root, and walk down the tree of active
device instances. Then, all instances that are not marked active are
found as orphans.
Doing it that way allows us to simply ignore orphan devices, instead of
warning about them and still keep them in the configuration. Now, orphaned
instances are considered as never having existed.
In the end, this allows 'no <device> at <attachment>' to be much more
efficient, as the user doesn't have to negate all descendents of the
instance s/he actually wants to negate. Warnings are still emitted,
though.
While there, make official a side-effect of the previous lack of action
against orphaned instances: config(1) used to warn about instances that
attach at a numbered device when no instance of that device with that
number existed, even though there was a starred instance of the device.
E.g. (provided by Alan Barrett):
pciide* at pci? dev ? function ? flags 0x0000
wdc0 at isa? port 0x1f0 irq 14 flags 0x00
wdc1 at isa? port 0x170 irq 15 flags 0x00
atabus* at ata?
wd0 at atabus0 drive 0
With this commit, config(1) will no longer warn about 'wd0 at atabus0'.