Commit Graph

148 Commits

Author SHA1 Message Date
drochner 8456b350de Seperate pseudo-devs which don't use device_t et al. (the classical
ones, mostly network pseudo interfaces) and those which use autoconf
to attach instances dynamically, or to attach child devices.
Use a new keyword "defpseudodev" for the latter.
Issue a warning if interface attributes are used with "old" pseudodevs,
but let it work as before for now. This will be removed soon.
approved by cube
2008-06-10 12:35:32 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
skrll 280a563bc4 Typo. 2008-03-26 14:41:00 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +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
dsl 8222554340 Be more informative about duplicated device names. 2007-11-30 23:19:18 +00:00
cube 66a59dcc4f Don't defattr machinearch if it's NULL. Pointed out by
Juergen Hannken-Illjes.
2007-11-11 17:35:27 +00:00
cube 66796c65e4 Make the "machine" statement define attributes for `machine', `arch' and
all the `subarch' given as parameters.  This is useful in combination with
ifdef...
2007-11-10 00:15:43 +00:00
cube 656cdcc8fb Add support for "ifdef <attribute>" blocks. It goes like this:
ifdef <attr> / ifndef <attr>
elifdef <attr>
elifndef <attr>
else
endif

No indentation is possible for now, it will come later.
2007-11-09 23:41:08 +00:00
cube baec5c01fc Don't pollute fsopttab with duplicate options for the sake of a test that
has probably been gone for a very long time.  Produces identical output.
2007-11-09 05:21:30 +00:00
cube f51c36b80a - Make include/cinclude/package eat up to the next new-line character.
- Fix casts in getincludepath() and re-work it to ignore the unused end of
  the line.
2007-11-09 05:06:08 +00:00
cube 7a185660d8 Some more licence clean up. 2007-09-10 10:54:20 +00:00
cube 14a82de83a Improve the structure of the man page to make it more usual, with the hope
that people might actually read it some day.  Yeah, I know, dream on, dream
on.

Thanks schmonz@ for a quick english check.
2007-09-09 00:35:14 +00:00
veego 9ec62257da Using ${NETBSDSRCDIR} requires <bsd.own.mk> 2007-05-13 20:22:45 +00:00
dsl e934daaae7 Enable the code that adds global constants to every kernel object file
that uses each configuration parameter.
This will stop kernel objects build with different options (that come from
config files) being linked together or loaded as a LKM.
Currently some options that have an effect on the kernel DDI/KI are passed
directly as parameters to cc.
An aim (for anyone adequately bored) would be to reduce the number of these
constants that appear in each .o file.  .o files with the same constants
should be sharable between kernels (even between XEN and i386).
2007-05-12 10:15:31 +00:00
dsl c1079eace9 Use '.equ' instead of '.set' when defining global constants.
On alpha '.set' has a non-standard purpose.
2007-05-10 21:01:14 +00:00
cube bfc250f292 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.
2007-04-06 19:21:09 +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
cube 718ffd7615 Handle defopt lists properly, as ':=' syntax introduce an additional
element...  For that, introduce nvcat(nv1, nv2).
2007-01-12 21:49:51 +00:00
cube 072ab00089 Change the name of the resulting kernel binary, because "lint" confuses
our Makefiles.  While there, add a couple comments to explain how all
attachments are found.
2007-01-10 15:17:43 +00:00
cube 904262675b Add new syntaxic sugar to provide a value in lint (i.e., config -L)
configurations for defparams.  It will be used _only_ by config -L.

This will greatly help automating tests with lint configurations,
hopefully.
2007-01-09 13:03:47 +00:00
wiz 81c929da0c Bump date for previous (year was wrong). 2007-01-09 06:58:46 +00:00
cube 6ebb2291dc Print pseudo-devices in their own section and print all of them (d'oh). 2007-01-08 18:08:24 +00:00
cube aa3d024933 One %s is enough to print one string. 2007-01-08 17:50:43 +00:00
cube 59c945452a 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.
2007-01-08 16:08:08 +00:00
wiz b8808a8b5c Improve formatting, fix typo, bump date for previous. 2007-01-08 07:18:25 +00:00
cube f55d783c32 - Document "source /path" and "build /path".
- Move documentation for "package", because as I learned tonight, it's not
  allowed before setmachine.  You get to discover scary new stuff about
  config(1) each time you look at it.
2007-01-07 23:22:04 +00:00
cube db31f3b5e0 Mention that newlines mid-statement are allowed, and clarify how
needs-count and needs-flag work, notably for simple attributes.
2007-01-06 21:58:54 +00:00
cube c93963e680 Make deffilesystem check all defined options, not just defopttab (which
ought to be empty nowadays).
2007-01-06 18:54:32 +00:00
alc 0c17aa264d Fix a typo in ht_free() which caused the last list of the hashtable to be ignored.
It caused config(1) to crash on the following assert() if the list was used.

This bug shows up after the recent change in files.c which fixed a memory leak.

pointed out by dogcow@
reviewed by cube@
2006-12-27 17:50:27 +00:00
alc 2f403ebe4f CID-4275: don't leak `fixdevmtab' 2006-12-26 00:07:18 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
christos bbfbbde1e9 eliminate the only alloca use and simplify the code. 2006-11-09 20:42:45 +00:00
uwe 4e4935bba0 Include <sys/cdefs.h> and use __used on config[] instead of the ifdef dance.
Prevents gcc4 from g/c'ing embedded config from VAX kernels.
2006-10-29 23:00:44 +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 c0156a4952 Coverity CID 175: Avoid memory leak; add new function to destroy a hash table. 2006-09-27 19:05:46 +00:00
christos f11da4b014 make this compile again. 2006-09-04 18:42:14 +00:00
wiz 2ba7db1893 Fix typo. 2006-09-04 18:32:54 +00:00
cube 1e2d115e84 Bump version after last feature addition (default value for defparam). 2006-09-04 07:32:50 +00:00
dsl 6467d53e48 Add support for specifying a default value on a 'defparam' line.
If a default is specified then the option is always defined in the
corresponding .h file.
Particularly useful for parameters where the default action isn't the
same a defining the value zero, given that the current use of #if defined(opt)
is open to problems wehere the relevant .h file isn't actually included, so
requiring an option to always have a value makes sense.
Also included (but commented out) is code that adds a global symbol to
the object file to stop objects compiled with different values for the
same option being linked together - I'm not quite happy with it yet!
2006-09-04 06:45:14 +00:00
dsl 17ff309c84 There isn't really any point in the 'union' for nv_str and nv_ptr, all it
does is cause confusion when I try to add default values for defparam.
Also if malloc()/free() aren't efficient enough for us, we ought to fix
them rather than having local free list - so kill the local free lists.
2006-09-03 07:45:40 +00:00
he d425dd3b69 Remove unused local variable. 2006-08-30 15:03:56 +00:00
cube 08ba9c9303 Bump version after deffs change. 2006-08-30 13:48:11 +00:00
matt 4a82747a8f Allow deffs to take dependencies like defflag and defopt 2006-08-30 10:12:25 +00:00
christos 55ee861f25 protect libutil with HOSTPROG 2006-08-29 16:54:03 +00:00
christos e07b7e508b build complete initializations. 2006-08-28 01:45:41 +00:00
christos d0fb89015b Now that this is part of tools, we don't need the extra build glue. 2006-08-26 18:17:13 +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 71af9028c9 Check that the device is not a pseudo-device in deldev(), too (as in
deldevi()).

PR#34111 by jmmv@.
2006-08-07 12:03:32 +00:00
cube 15f9f25144 s/setmachine/machine. Overlook pointed out by Havard Eidnes. 2006-07-05 10:11:02 +00:00
cube 93e398b3e3 Reference config(5). Noted by perry@.
XXX options(4), config(9) and probably some others still have to be changed
XXX a bit.  A chaque jour suffit sa peine.
2006-06-04 20:07:52 +00:00
cube 3bde459b8f Set a more realistic date than the day I started writing it. 2006-06-04 20:06:14 +00:00
cube ecfd193d31 Install config.5 and config.samples.5. 2006-06-04 19:42:18 +00:00
cube 8a5d15c785 Everything you've always wanted to know about config(1) without daring
asking (with reason).

You've entered the config(1) dungeon--More--
An option hits you.  You die.
2006-06-04 19:41:26 +00:00
cube 1baa475170 Bump version after fix to obsolete syntax. 2006-06-04 13:52:27 +00:00
cube 87ab9060e2 D'uh. Forgot the file name argument in the "obsolete" statements. 2006-06-04 13:07:24 +00:00
cube ac24e16176 Introduce two new statements:
obsolete defflag <option> [, <option> [, ...]]
    obsolete defparam <option> [, <option> [, ...]]

The two statements actually do the same thing (there could be only one),
but it makes things less cryptic that way.  The optional ": deps" part of
a 'defflag' or 'defparam' still has to be dropped when it gets obsoleted.

When the user has 'options OBSOLETE_OPTION' in his configuration file, it
is ignored (that is, opt_*.h files are generated as if it wasn't there),
and the user gets a warning about it.

Bump version to 20060525.

When someone first uses that syntax in the tree, a "version 20060525"
statement should be added before its occurrence, preferably at the top
of sys/conf/files.

Suggested by Matt Thomas a few months ago.
2006-05-25 22:28:38 +00:00
christos fc19b961ac s/vax/__vax__/ 2006-05-25 22:06:53 +00:00
christos f81561404f deal with the vax gcc that does not understand __attribute__ used. 2006-05-24 23:16:50 +00:00
christos 9a02ff9b42 gcc-4.0 needs attribute used. Variables with attribute unused get removed. 2006-05-14 23:47:34 +00:00
cube c002406624 Fix a broken conditional that confused coverity. It cannot happen, anyway.
CID 178.
2006-03-29 09:16:36 +00:00
cube 6a6299eb8f Panic on an unlikely error condition. CID 177. 2006-03-19 23:36:10 +00:00
cube e50e4ee4b2 Free a nvlist used temporarily.
Found by Coverity, CID 179 and 180.
2006-03-19 23:12:59 +00:00
cube 11820066f8 Close file on error. CID 176. 2006-03-19 22:34:44 +00:00
cube 8e4130e5ee Fix various resource leaks, all happenning on error situations (IOW,
shortly before exit(1)).  CIDs 181, 182, 183, 184 and 185.
2006-03-19 22:27:14 +00:00
cube 3eaff5cb14 Proper resource handling in mkmakefile().
Coverity CIDs: 186, 187, 188 and 189.
2006-03-19 16:27:13 +00:00
wiz 5d1e8b2745 Fix some typos. 2006-02-25 02:28:55 +00:00
cube 42b52b8a61 Add 'no config <name>'. 2006-02-11 20:15:53 +00:00
cube c454f920b9 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.
2005-12-18 23:43:15 +00:00
cube 4225631532 The loop detection code could not detect the negation of an instance that
made a device its own parent.  Add a test that checks that and stop looping
in that special case (after all, everything is already being handled by the
parent instance).

Reported by Jukka Salmi on current-user.
2005-12-10 13:39:47 +00:00
cube 7230395132 Invert the meaning of a comment to match reality. Pointed out by uwe@. 2005-11-13 17:24:31 +00:00
erh 570d41f826 The swap*.o files actually do need to be specified on the individual kernel
build lines instead of in ${OBJS}.  Partially revert previous change.
2005-11-07 18:45:34 +00:00
erh cd42936263 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.
2005-11-07 03:26:20 +00:00
cube 437f8925a6 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.
2005-10-12 01:17:43 +00:00
cube b7505c1571 Stop walking the tree when two conditions are met: we've seen the device
already (one of its instances has been changed), and we have made no change
on any of the instances.

Previously, it stopped as soon as it detected the device had been seen.
While all the instances of the device at stake were eventually seen, the
same wasn't true for its children...

Fixes hpcmips's GENERIC.
2005-10-04 23:00:34 +00:00
cube a31ff6b408 - 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.
2005-10-04 20:13:39 +00:00
cube 9ea755eb2f Remove extra new line. 2005-10-04 13:33:20 +00:00
cube 5ec393e9ef 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.
2005-10-04 13:06:45 +00:00
cube 0dbd1c0e04 - 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.
2005-10-04 12:35:00 +00:00
cube 2fb411a123 Don't return immediately when detecting that a devbase has already been
seen:  aliases might have to be activated, too.  Fixes GENERIC of alpha
and amiga.
2005-10-02 21:22:56 +00:00
cube 895e5687a9 Allow 'maxusers' redefinition. 'maxusers 0' will cancel the existing
value and make config(1) use the machine-dependent default.
2005-10-02 00:18:09 +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 7b7c582a4f 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
2005-09-30 22:51:46 +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
martin 6fd5c01546 Move package/cinclude/include handling from the parser to the scanner,
where it belongs. This has the side effect of fixing PR toolchain/30903.
2005-09-10 15:38:46 +00:00
drochner f46880afbf in locators.h, also emit definitions about the number of locators per
interface attribute
2005-08-25 15:02:18 +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
cube 3b40577510 - 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.
2005-08-07 15:11:12 +00:00
yamt 19ff568b84 allow configuration without swap. 2005-07-30 06:40:30 +00:00
cube c3414672de 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.
2005-07-25 22:31:07 +00:00
cube 878c29f51a Correct an if test. 2005-07-25 06:22:09 +00:00
cube e499d8b53e 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.
2005-07-24 21:31:02 +00:00
drochner fd816c4745 don't put the xxxcf_locnames[] into the global namespace 2005-06-28 20:21:05 +00:00
thorpej dbe5d1e1f7 Remove bogus BINDIR assignment. 2005-06-06 06:12:09 +00:00
wiz d3918ffef7 config(1), not (8) 2005-06-05 18:59:35 +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