Home | History | Annotate | Download | only in config
History log of /src/usr.bin/config/sem.c
RevisionDateAuthorComments
 1.87  07-Jan-2025  joe clear: trailing whitespaces
 1.86  25-Aug-2021  rillig config: remove unused local variable
 1.85  13-Apr-2021  mrg ensure that pointer is filled in when used upon return.
 1.84  07-Mar-2020  christos Keep track where more objects are declared so that we can print where things
have been redefined.
 1.83  09-Apr-2018  christos branches: 1.83.2; 1.83.4;
Keep previous location of device definitions so we can print them in error
messages.
 1.82  27-Nov-2017  christos branches: 1.82.2;
use a reference count to avoid deleting psrefs still in use.
 1.81  24-Nov-2017  christos Tidy up error messages, line wraps, initialization. NFC.
 1.80  19-Nov-2017  kre Remove a stray left over debug printf that crashes the builds (ab==NULL).
 1.79  18-Nov-2017  christos 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.
 1.78  18-Nov-2017  christos - Factor out the remove_pspec code into a function.
- Avoid NULL pointer when printing an error.
 1.77  13-Sep-2016  christos define the attribute first.
 1.76  09-Sep-2016  christos Make attribute deselection work:
- when deselecting attributes, remove files that depend on them
- when deselecting attributes, remove devices that depend on them
 1.75  07-Aug-2016  christos Accept "-no" as a "no" that does not cause errors if the object deleted
does not exist.
 1.74  29-Apr-2016  mlelstv Extend syntax of config phrase, a quoted string instead of a device name
is passed as root specification string. This can be used to specify a
wedge by name.
 1.73  29-Aug-2015  uebayasi Fix previous.
 1.72  29-Aug-2015  uebayasi Define MAXUXERS in opt_param.h. Bump config(1) version.
 1.71  21-Nov-2014  christos Use proper index types, delete casts, use correct sizeof() in allocations.
 1.70  15-Nov-2014  uebayasi config(1): Sort objects by weight in modular build

Sort per-module kernel objects (*.ko) by dependency weight. Important modules
are placed in lower addresses. The ``machdep'' module will be always placed
in the lowest.

(At this moment, the order is not exact because dependency information is
incomplete in config files (files.*). Thus ``sysmon_power.ko'' comes lower
than ``machdep.ko'' and/or ``uvm.ko''; but still much better than alphabetical
sort.)
 1.69  04-Nov-2014  joerg nv_num is not a dev_t, so add explicit cast for the sake of
-Wconversion.
 1.68  04-Nov-2014  joerg To make -Wconversion happy, cast return value of tolower/toupper to
char.
 1.67  01-Nov-2014  uebayasi config(1): KNF
 1.66  31-Oct-2014  uebayasi config(1), config(5): Introduce "select"

o Introduce a new selection directive "select" to select an attribute (as a
module) and its dependencies.
o Support "no select" too.
o Stop abusing "options" to select an attribute.
o Bump config(1) version.
 1.65  29-Oct-2014  christos - add RCSID's
- fix -Wconversion (except scanner)
 1.64  18-Oct-2014  uebayasi Keep track of attribute (module) dependency using hash2.
 1.63  12-Oct-2014  uebayasi Don't shadow global 'devname' on macppc.
 1.62  11-Oct-2014  martin Remove a set but not used variable
 1.61  11-Oct-2014  uebayasi More debug messages.
 1.60  11-Oct-2014  uebayasi On second thought, resolving "device" dependency in enddefs() is correct.
The problem was to select things. So put back the code to record dependency
as attributes.

While here, sprinkle more debug messages.
 1.59  11-Oct-2014  uebayasi Don't conplain devclass redifition to the same value; it can happen while
resolving dependency.
 1.58  11-Oct-2014  uebayasi Redo "device" dependency. It was completely wrong to select things just
after definitions at enddefs(). Resolve dependency in selectbase().
 1.57  11-Oct-2014  uebayasi Pass stricter build.
 1.56  11-Oct-2014  uebayasi Resolve "device" definition dependency lazily.
 1.55  10-Oct-2014  uebayasi Allow dependency on undefined attributes, so that attribute definitions can
be written out-of-order, like:

# b is not defined yet
define a: b
file a.c a

# b is defined here
define b
fine b.c
 1.54  10-Oct-2014  uebayasi If an attribute is selected, select its dependencies too.
 1.53  10-Oct-2014  uebayasi Implicitly define attribute for device.
 1.52  10-Oct-2014  uebayasi Implicitly define attribute for options.
 1.51  10-Oct-2014  uebayasi Implicitly define attribute for filesystem.
 1.50  10-Oct-2014  uebayasi Implicitly define empty "attribute" for "device attachment". Much less
troublesome than "device" and "interface attribute".
 1.49  10-Oct-2014  uebayasi Split plain/interface/devclass attribute initializers.
 1.48  10-Oct-2014  uebayasi Refactor attr definition and initialization a little.
 1.47  09-Oct-2014  uebayasi Always select the fallback allattr.
 1.46  09-Oct-2014  uebayasi Define an implicit attribute "netbsd" internally to collect files that don't
belong to any specific attribute.

Eventually, all operations doing "foreach (files)" can be rewritten as "foreach
(attributes) foreach (files)".
 1.45  09-Oct-2014  uebayasi If a file is marked by an atom expression, like "file a.c foo", and if the
specified expression is an attribute, mark the file as belonging to the
attribute.

At this moment this information is not used for any purpose, but can be
traced by config -ddd.
 1.44  09-Oct-2014  uebayasi Debug print where things are selected (by user).
 1.43  29-May-2014  mrg branches: 1.43.2;
implement "no ident".
 1.42  11-Aug-2013  pooka branches: 1.42.2;
ioconf/pseudo-root have been in here unchanged for 3+ years and their use
has spread from rump kernels into dozens of kernel modules. Let's pretend
we don't want to see config yell about them being experimental every time.
 1.41  11-Mar-2012  dholland branches: 1.41.2;
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.
 1.40  11-Mar-2012  dholland Create a struct condexpr type to hold condition expressions, instead
of abusing struct nvlist to make trees.

(These are the a|b and a&b constructs.)
 1.39  11-Mar-2012  dholland 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.)
 1.38  02-May-2010  pooka branches: 1.38.6;
Prefer a real device for pseudoroot and only create a fake device
in the case we are attaching to a pure attribute. Otherwise we
end up creating a fake device instance every time ...
 1.37  01-May-2010  pooka ignore mainbus in previous for now
 1.36  01-May-2010  pooka Support interface attributes as pseudoroots. This makes things like
"pseudo-root audiobus*" possible.
 1.35  30-Apr-2010  pooka For the simple cases, augment device-major with information on how
a driver expects /dev/node -> minor mappings to go and include that
information in devsw_conv.
(no, I didn't plow through all the MD majors files)
 1.34  08-Mar-2010  pooka Add a highly experimental pseudo-root feature to be used in conjuction
with the also-experimental ioconf keyword. pseudo-root allows to
specify a root at any point in the device tree without having
attachments from the actual root.

For example, instead of having a config file like this:
mainbus0 at root
bus_a? at mainbus0
bus_b? at bus_a*
device7 at bus_b?

You can have one like this:
pseudo-root bus_b*
device7 at bus_b?

This will produce the relevant ioconf.c glue for device number 7
only instead of the whole 9 yards from root. Perhaps needless to
say, this can be used to generate snippets of config glue for
modules and, let's not deny that my main motivation for doing this,
rump components.

This is part 2/3 of my modifications to config (the last part is
autogenerating source file lists and component Makefiles).

No strong objection from cube (after a little pressuring ;), but
like he said, the implementation will most likely need some more
tweaking and may not work correctly under all pseudo-root uses yet.
 1.33  11-Apr-2009  lukem Fix WARNS=4 issues (-Wcast-qual -Wsign-compare -Wshadow)
 1.32  20-Jan-2009  drochner branches: 1.32.2;
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.
 1.31  28-Dec-2008  christos rename nv_int -> nv_num and make it long long, so that dev_t will fit when
we change it.
 1.30  07-Jul-2008  cube It actually makes no sense to warn on a behaviour that was allowed in
previous versions, when we know we're working on an old file. That way,
a -current config(1) works on a 4.0 source tree (or older) without
warning. Pointed out by Christos Zoulas.

XXX We should set up way to note compatibility code we can get rid of
XXX the day we choose to bump CONFIG_MINVERSION.
 1.29  10-Jun-2008  drochner Disable use of pseudo-devices defined "defpseudo" with interface
attributes, but provide compatibility for older source trees (according
to the "version" in conf/files and other files.*.
reviewed by cube
 1.28  06-Apr-2007  cube branches: 1.28.10; 1.28.12;
Add some sanity checking in order to avoid some segfaults. There might be
other ways of producing a segfault, but keep in mind those happens when the
negation applies to an erroneous instance.
 1.27  13-Jan-2007  christos - 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.
 1.26  08-Jan-2007  cube Introduce a new option to config(1): -L. What it does is takes a regular
configuration file (although it is meant to be used mostly with
std.${ARCH}), and prints out a configuration file that includes it and
select every single option and parameter, and define an instance for every
single possible attachment. IOW, selects everything, into a would-be
"LINT" config.

The resulting config really isn't meant to be runnable, but should be
somewhat buildable on most archs. It still needs adjustments because some
options are peculiar (e.g., ACPI_DSDT_FILE wants an existing file as its
value), so it's not yet possible to do "config -L; config; build" in an
automated way.
 1.25  09-Nov-2006  christos eliminate the only alloca use and simplify the code.
 1.24  26-Aug-2006  christos Now that this is part of tools, we don't need the extra build glue.
 1.23  07-Aug-2006  cube Check that the device is not a pseudo-device in deldev(), too (as in
deldevi()).

PR#34111 by jmmv@.
 1.22  29-Mar-2006  cube Fix a broken conditional that confused coverity. It cannot happen, anyway.
CID 178.
 1.21  19-Mar-2006  cube Panic on an unlikely error condition. CID 177.
 1.20  19-Mar-2006  cube Free a nvlist used temporarily.
Found by Coverity, CID 179 and 180.
 1.19  25-Feb-2006  wiz Fix some typos.
 1.18  11-Feb-2006  cube Add 'no config <name>'.
 1.17  18-Dec-2005  cube Having explicit locators is not a sufficient condition to be able to have
children for a pseudo-device. Depending on an interface attribute is,
though.

Instead of looking at locators, walk the 'attrs' list and look for an
interface attribute (which might have been added just a few lines before
in case there was explicit locators defined).

Fixes PR#32329 by Valeriy E. Ushakov. Regression test is PSEUDO_PARENT.
 1.16  07-Nov-2005  erh The swap*.o files actually do need to be specified on the individual kernel
build lines instead of in ${OBJS}. Partially revert previous change.
 1.15  07-Nov-2005  erh Remove special hack for swapnetbsd.c when generating the makefile.
Instead, just add it to the list of files.
Make "prefix foo" lines actually work right when foo is an absolute path,
and make sure the length calculations correspond to the output.
Provide a way to specify a file that will always be included, and a way
to omit the prologue ("$S/") on that file.
 1.14  12-Oct-2005  cube Introduce versioning to config(1). This will allow us to provide a way to
error out in a bit more friendly way when the user is trying to use
config(1) on a too old or too recent source tree.

To achieve that, introduce the "version NUMBER" statement which can be use
about anywhere in the config files. Also, use two defines, CONFIG_VERSION
(which is the actual version of binary), and CONFIG_MINVERSION, which is
the minimum version the binary supports.

Allowing a range of versions serves several purposes: first it allows me
to introduce the versioning without requiring it to be used right away in
the kernel tree, which means it will be possible to introduce new features
of config(1) rather progressively in the future. E.g., using 'no pci' in
a config file could only require the new version in that config file, so
that the rest remains compatible.

In the end, an actual bump of the main config system (i.e., in conf/files)
will only be required when e.g., ioconf.c semantics change.

(Mostly-)silently accepted on tech-kern. Error messages turned into
correct and meaningful English thanks to Tracy and Perry.
 1.13  04-Oct-2005  cube - Make sure to try aliases of removed device instances when walking
deaddevitab.
- Record the position in the config file of device instances so it is
possible to tell if a device instance was declared before or after its
parent's removal.

E.g.:

child* at parent?
no parent

will have the child instance ignored as an explicit orphan, while

no parent
child* at parent?

will error out because now the child instance is a real orphan.

That let the POSTPONED_ORPHAN regression test pass.
 1.12  04-Oct-2005  cube Remove extra new line.
 1.11  04-Oct-2005  cube Add a flag to mark broken instances. That might happen when there is a
syntax error in the file, yet we want to somehow gracefully go on in order
to print out all the errors in the file, which means we have to take
special care with those structures.

Reported by Simon Burge in private mail.
 1.10  04-Oct-2005  cube - Keep track of the file in which we find the device instance
- Introduce xwarn() for delayed warnings
- Use xerror() and xwarn() in fixdevis() to notify about orphans

That way the correct file is printed when listing orphaned devices.

Reported by Juergen Hannken-Illjes in private mail.
 1.9  02-Oct-2005  cube Allow 'maxusers' redefinition. 'maxusers 0' will cancel the existing
value and make config(1) use the machine-dependent default.
 1.8  01-Oct-2005  cube 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 :)
 1.7  30-Sep-2005  cube Introduce two new statements:

no device at <attachment>

<attachment> can take two forms: either numbered/wildcarded, in which
case only exactly matching instances will be removed, or plain (with
no number or wildcard), in which case all matching instances will be
removed.

When <attachment> is a plain interface attribute, all instances using
that attribute (either directly or through an explicit device) will be
removed.

E.g.:
auich* at pci? dev ? function ?
audio0 at audiobus?
audio1 at auich?
audio* at auich0

no device at auich0 -> removes audio*
no device at auich? -> removes audio1
no device at auich -> removes audio1 _and_ audio*
no device at audiobus? -> removes audio0
no device at audiobus -> removes audio0, audio1 and audio*

no <device>

As in the previous case, <device> can either be numbered/starred, in
which case all exactly matching instances are removed, or plain, in
which case all instances of the device are removed.

E.g.: (continuing previous example)

no audio* -> removes 'audio* at auich0'
no audio -> removes all audio instances
 1.6  30-Sep-2005  cube 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'.
 1.5  07-Aug-2005  cube - Make sure devitab is correctly handled, in case we're removing the entry
it contains,
- Properly update the d_ihead list: if we have remaining aliases, use them
to fill in the gap

Thanks to Bernd Ernesti for the test cases.
 1.4  25-Jul-2005  cube The devi lists in struct devbase and struct deva really should use the
TAILQ set of macros from queue.h... It's way too easy to make mistakes...

config(1) was segfaulting in deldev() in some situations... Reported by
Brend Ernesti.
 1.3  25-Jul-2005  cube Correct an if test.
 1.2  24-Jul-2005  cube Implement the long overdue syntax "no <dev> at <attachment>". We can't
pretend anymore we don't have it.

This is the result of 7 hours of work on the train journey forth and
back to the family reunion for the birthday of my cousin Mickael, whom
I thank for living just far away enough.
 1.1  05-Jun-2005  thorpej 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.
 1.28.12.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.28.12.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28.10.1  17-Jun-2008  yamt sync with head.
 1.32.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.38.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.6.1  17-Apr-2012  yamt sync with head
 1.41.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.2.1  10-Aug-2014  tls Rebase.
 1.43.2.2  11-May-2016  martin Pull up following revision(s) (requested by mlelstv in ticket #1164):
usr.bin/config/sem.c: revision 1.74
usr.bin/config/config.5: revision 1.35
usr.bin/config/gram.y: revision 1.53
Extend syntax of config phrase, a quoted string instead of a device name
is passed as root specification string. This can be used to specify a
wedge by name.
 1.43.2.1  06-Mar-2015  snj Pull up following revision(s) (requested by mrg in ticket #572):
usr.bin/config/Makefile: up to 1.10
usr.bin/config/TODO: up to 1.14
usr.bin/config/config.1: up to 1.17
usr.bin/config/config.5: up to 1.25
usr.bin/config/defs.h: up to 1.64
usr.bin/config/files.c: up to 1.18
usr.bin/config/gram.y: up to 1.46
usr.bin/config/hash.c: up to 1.11
usr.bin/config/lint.c: up to 1.15
usr.bin/config/main.c: up to 1.74
usr.bin/config/mkdevsw.c: up to 1.12
usr.bin/config/mkheaders.c: up to 1.26
usr.bin/config/mkioconf.c: up to 1.28
usr.bin/config/mkmakefile.c: up to 1.37
usr.bin/config/mkswap.c: up to 1.8
usr.bin/config/pack.c: up to 1.9
usr.bin/config/scan.l: up to 1.22
usr.bin/config/sem.c: up to 1.71
usr.bin/config/sem.h: up to 1.19
usr.bin/config/util.c: up to 1.19
sync config(1) with HEAD.
 1.82.2.1  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.83.4.1  09-Mar-2020  martin Pull up the following, requested by christos in ticket #776:

usr.bin/config/TODO up to 1.32
usr.bin/config/defs.h up to 1.105
usr.bin/config/files.c up to 1.37
usr.bin/config/gram.y up to 1.55
usr.bin/config/main.c up to 1.99
usr.bin/config/scan.l up to 1.30
usr.bin/config/sem.c up to 1.84
usr.bin/config/util.c up to 1.21

config(1): fix issue with incorrect handling of elifdef statements.
 1.83.2.1  08-Apr-2020  martin Merge changes from current as of 20200406

RSS XML Feed