Commit Graph

36 Commits

Author SHA1 Message Date
riastradh 6dc5a3c0cc config(1): Make sort order deterministic.
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
2024-04-05 00:43:42 +00:00
christos 536abc0958 Don't print instances we've already printed. 2017-11-19 01:46:29 +00:00
christos 3011cfe714 Allow multiple attachments methods to the same child+parent combination:
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.
2017-11-18 18:44:20 +00:00
pooka d0f0cf2fcb In ioconfname mode, #define IOCONF as the ioconf token.
Avoids having to retype the name to call config_init/fini_component().
2015-11-12 14:38:21 +00:00
uebayasi b5b4952dae After thought, revert "Generate *.c files under conf/". Generate *.c files
under top build directory.  *.c files are never placed just under $S/.  Keep
this exclusiveness.
2015-09-03 13:53:36 +00:00
uebayasi dccd2cf552 In `-S' mode, generate *.c files under conf/ subdirectory. Register generated
.c files to the `files' list internally.
2015-09-02 05:09:25 +00:00
uebayasi 50408f97eb Global paths looked up at output stage (mk*()) are relative to `srcdir'.
Ignore "prefix" by not calling sourcepath().
2015-08-28 03:55:15 +00:00
christos 92a97b467e move driver attach declarations to ioconf.h 2015-08-20 09:44:24 +00:00
uebayasi fe2a50734b config(1): Don't emit unused empty loc[] 2014-11-01 11:02:41 +00:00
uebayasi 6c283bdad1 config(1): Emit pdevinit[] into .rodata 2014-11-01 07:26:11 +00:00
uebayasi def3cecb48 config(1): Set NULL to unused cfdata::cf_loc 2014-11-01 06:20:24 +00:00
uebayasi 304be40991 config(1): Better indent of cfdata in ioconf.c 2014-10-31 18:26:06 +00:00
uebayasi 084f527f2d config(1): KNF generated ioconf.c 2014-10-31 17:58:02 +00:00
uebayasi 374e86cbe4 config(1): Emit only referenced interface attributes in ioconf.c 2014-10-31 17:43:55 +00:00
christos d12b0036c5 - add RCSID's
- fix -Wconversion (except scanner)
2014-10-29 17:14:50 +00:00
dholland f5d4142b2d Move locator lists to their own data structure. This can use more tidying;
it is not clear to me at the moment what the "string" and "num" values
pushed around in locator lists are supposed to actually mean.
2012-03-11 21:16:07 +00:00
dholland bbe96a5ad8 Create a new type struct attrlist to manage lists of attributes,
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.)
2012-03-11 07:32:41 +00:00
nakayama c09c2a7b34 Fix build on Solaris 10. 2011-03-03 14:53:01 +00:00
pooka b7a2b071f9 Put cfdata* in a similar namespace with cfdriver** cfattachinit*.
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.
2010-03-26 15:51:17 +00:00
pooka abc34bd561 Generate cfdriver and cfattach lists for ioconf configs. 2010-03-25 19:39:05 +00:00
pooka ec78f798c7 ... aaand make the emit-order slightly more sensible for ioconf.c to
actually work again.
2010-02-03 21:32:27 +00:00
pooka e239742f9b Introduce experimental support for ioconf-only configuration files.
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 ;)
2010-02-03 21:00:49 +00:00
lukem 5cc303e13d Fix WARNS=4 issues (-Wcast-qual -Wsign-compare -Wshadow) 2009-04-11 12:41:10 +00:00
drochner d767912be3 Change major()/minor() to return 32-bit types again, called
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.
2009-01-20 18:20:47 +00:00
uebayasi 547b81ca4c Better whitespace in ioconf.c output. 2009-01-16 09:43:41 +00:00
christos 0001b92828 rename nv_int -> nv_num and make it long long, so that dev_t will fit when
we change it.
2008-12-28 01:23:46 +00:00
lukem 82d7cb8306 Use a common function to generate the "MACHINE GENERATED" comment,
and ensure mkswap.c adds it too.
2007-12-12 00:03:33 +00:00
christos c7295a4c51 - rename {x,}error -> cfg{x,}error and {x,}warn -> cfg{x,}warn so that we
can use err(3) and warn(3) to display errors instead of using inconsistent
  fprintf's.
- remove emalloc/estrdup etc. We have them in libutil.
2007-01-13 23:47:36 +00:00
dsl 342d35797b Instead of trying to check the return value of every fprintf() and fputs()
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).
2006-10-04 20:34:48 +00:00
christos e07b7e508b build complete initializations. 2006-08-28 01:45:41 +00:00
drochner fe5f2a85b5 Make sure that only specisications for _interface_ attributes are
emitted, the rest is useless at runtime.
saves some bloat in ioconf.c
2006-08-09 18:03:23 +00:00
cube 7aa6070d4e o Keep track of negated devices in deaddevitab
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 :)
2005-10-01 23:30:37 +00:00
cube c130d400ba Rework the way orphan device instances are handled. To achieve that, keep
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'.
2005-09-30 22:36:20 +00:00
drochner 0d6cb6f10c Replace the "locnames", attached to cfdata, which was solely good for
userconf, by more complete information (including default values) about
interface attributes, attached to the drivers which provide them.
2005-08-25 15:01:07 +00:00
drochner fd816c4745 don't put the xxxcf_locnames[] into the global namespace 2005-06-28 20:21:05 +00:00
thorpej 5ecc953bdb config and genassym are not sysadmin tools, they are development tools.
As such, they don't belong in /usr/sbin, but rather /usr/bin.  Move them
there.
2005-06-05 18:19:52 +00:00