xref: /netbsd/usr.bin/config/defs.h (revision 6550d01e)
1 /*	$NetBSD: defs.h,v 1.35 2010/04/30 20:47:18 pooka Exp $	*/
2 
3 /*
4  * Copyright (c) 1992, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This software was developed by the Computer Systems Engineering group
8  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9  * contributed to Berkeley.
10  *
11  * All advertising materials mentioning features or use of this software
12  * must display the following acknowledgement:
13  *	This product includes software developed by the University of
14  *	California, Lawrence Berkeley Laboratories.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions
18  * are met:
19  * 1. Redistributions of source code must retain the above copyright
20  *    notice, this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the
23  *    documentation and/or other materials provided with the distribution.
24  * 3. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  *	from: @(#)config.h	8.1 (Berkeley) 6/6/93
41  */
42 
43 /*
44  * defs.h:  Global definitions for "config"
45  */
46 
47 #if HAVE_NBTOOL_CONFIG_H
48 #include "nbtool_config.h"
49 #endif
50 
51 #include <sys/types.h>
52 #include <sys/param.h>
53 #include <sys/queue.h>
54 
55 #if !defined(MAKE_BOOTSTRAP) && defined(BSD)
56 #include <sys/cdefs.h>
57 #include <paths.h>
58 #endif
59 
60 #include <stdio.h>
61 #include <stdlib.h>
62 #include <unistd.h>
63 
64 /* These are really for MAKE_BOOTSTRAP but harmless. */
65 #ifndef __dead
66 #define __dead
67 #endif
68 #ifndef _PATH_DEVNULL
69 #define _PATH_DEVNULL "/dev/null"
70 #endif
71 
72 #ifdef	MAKE_BOOTSTRAP
73 #undef	dev_t
74 #undef	devmajor_t
75 #undef	devminor_t
76 #undef	NODEV
77 #undef	NODEVMAJOR
78 #undef	major
79 #undef	minor
80 #undef	makedev
81 #define	dev_t		unsigned int	/* XXX: assumes int is 32 bits */
82 #define	NODEV		((dev_t)-1)
83 #define devmajor_t	int
84 #define devminor_t	int
85 #define NODEVMAJOR	(-1)
86 #define major(x)        ((devmajor_t)((((x) & 0x000fff00) >>  8)))
87 #define minor(x)        ((devminor_t)((((x) & 0xfff00000) >> 12) | \
88 			       (((x) & 0x000000ff) >>  0)))
89 #define makedev(x,y)    ((dev_t)((((x) <<  8) & 0x000fff00) | \
90                                  (((y) << 12) & 0xfff00000) | \
91                                  (((y) <<  0) & 0x000000ff)))
92 #define __attribute__(x)
93 #endif	/* MAKE_BOOTSTRAP */
94 
95 #undef setprogname
96 #undef getprogname
97 extern const char *progname;
98 #define	setprogname(s)	((void)(progname = (s)))
99 #define	getprogname()	(progname)
100 
101 #define ARRCHR '#'
102 
103 /*
104  * The next two lines define the current version of the config(1) binary,
105  * and the minimum version of the configuration files it supports.
106  */
107 #define CONFIG_VERSION		20100430
108 #define CONFIG_MINVERSION	0
109 
110 /*
111  * Name/value lists.  Values can be strings or pointers and/or can carry
112  * integers.  The names can be NULL, resulting in simple value lists.
113  */
114 struct nvlist {
115 	struct nvlist	*nv_next;
116 	const char	*nv_name;
117 	const char	*nv_str;
118 	void		*nv_ptr;
119 	long long	nv_num;
120 	int		nv_ifunit;		/* XXX XXX XXX */
121 	int		nv_flags;
122 #define	NV_DEPENDED	1
123 #define	NV_OBSOLETE	2
124 };
125 
126 /*
127  * Kernel configurations.
128  */
129 struct config {
130 	TAILQ_ENTRY(config) cf_next;
131 	const char *cf_name;		/* "netbsd" */
132 	int	cf_lineno;		/* source line */
133 	const char *cf_fstype;		/* file system type */
134 	struct	nvlist *cf_root;	/* "root on ra0a" */
135 	struct	nvlist *cf_swap;	/* "swap on ra0b and ra1b" */
136 	struct	nvlist *cf_dump;	/* "dumps on ra0b" */
137 };
138 
139 /*
140  * Attributes.  These come in three flavors: "plain", "device class,"
141  * and "interface".  Plain attributes (e.g., "ether") simply serve
142  * to pull in files.  Device class attributes are like plain
143  * attributes, but additionally specify a device class (e.g., the
144  * "disk" device class attribute specifies that devices with the
145  * attribute belong to the "DV_DISK" class) and are mutually exclusive.
146  * Interface attributes (e.g., "scsi") carry three lists: locators,
147  * child devices, and references.  The locators are those things
148  * that must be specified in order to configure a device instance
149  * using this attribute (e.g., "tg0 at scsi0").  The a_devs field
150  * lists child devices that can connect here (e.g., "tg"s), while
151  * the a_refs are parents that carry the attribute (e.g., actual
152  * SCSI host adapter drivers such as the SPARC "esp").
153  */
154 struct attr {
155 	const char *a_name;		/* name of this attribute */
156 	int	a_iattr;		/* true => allows children */
157 	const char *a_devclass;		/* device class described */
158 	struct	nvlist *a_locs;		/* locators required */
159 	int	a_loclen;		/* length of above list */
160 	struct	nvlist *a_devs;		/* children */
161 	struct	nvlist *a_refs;		/* parents */
162 	struct	nvlist *a_deps;		/* we depend on these other attrs */
163 	int	a_expanding;		/* to detect cycles in attr graph */
164 };
165 
166 /*
167  * Parent specification.  Multiple device instances may share a
168  * given parent spec.  Parent specs are emitted only if there are
169  * device instances which actually reference it.
170  */
171 struct pspec {
172 	TAILQ_ENTRY(pspec) p_list;	/* link on parent spec list */
173 	struct	attr *p_iattr;		/* interface attribute of parent */
174 	struct	devbase *p_atdev;	/* optional parent device base */
175 	int	p_atunit;		/* optional parent device unit */
176 	struct	nvlist *p_devs;		/* children using it */
177 	int	p_inst;			/* parent spec instance */
178 	int	p_active;		/* parent spec is actively used */
179 };
180 
181 /*
182  * The "base" part (struct devbase) of a device ("uba", "sd"; but not
183  * "uba2" or "sd0").  It may be found "at" one or more attributes,
184  * including "at root" (this is represented by a NULL attribute), as
185  * specified by the device attachments (struct deva).
186  *
187  * Each device may also export attributes.  If any provide an output
188  * interface (e.g., "esp" provides "scsi"), other devices (e.g.,
189  * "tg"s) can be found at instances of this one (e.g., "esp"s).
190  * Such a connection must provide locators as specified by that
191  * interface attribute (e.g., "target").  The base device can
192  * export both output (aka `interface') attributes, as well as
193  * import input (`plain') attributes.  Device attachments may
194  * only import input attributes; it makes no sense to have a
195  * specific attachment export a new interface to other devices.
196  *
197  * Each base carries a list of instances (via d_ihead).  Note that this
198  * list "skips over" aliases; those must be found through the instances
199  * themselves.  Each base also carries a list of possible attachments,
200  * each of which specify a set of devices that the device can attach
201  * to, as well as the device instances that are actually using that
202  * attachment.
203  */
204 struct devbase {
205 	const char *d_name;		/* e.g., "sd" */
206 	TAILQ_ENTRY(devbase) d_next;
207 	int	d_isdef;		/* set once properly defined */
208 	int	d_ispseudo;		/* is a pseudo-device */
209 	devmajor_t d_major;		/* used for "root on sd0", e.g. */
210 	struct	nvlist *d_attrs;	/* attributes, if any */
211 	int	d_umax;			/* highest unit number + 1 */
212 	struct	devi *d_ihead;		/* first instance, if any */
213 	struct	devi **d_ipp;		/* used for tacking on more instances */
214 	struct	deva *d_ahead;		/* first attachment, if any */
215 	struct	deva **d_app;		/* used for tacking on attachments */
216 	struct	attr *d_classattr;	/* device class attribute (if any) */
217 };
218 
219 struct deva {
220 	const char *d_name;		/* name of attachment, e.g. "com_isa" */
221 	TAILQ_ENTRY(deva) d_next;	/* list of all instances */
222 	struct	deva *d_bsame;		/* list on same base */
223 	int	d_isdef;		/* set once properly defined */
224 	struct	devbase *d_devbase;	/* the base device */
225 	struct	nvlist *d_atlist;	/* e.g., "at tg" (attr list) */
226 	struct	nvlist *d_attrs;	/* attributes, if any */
227 	struct	devi *d_ihead;		/* first instance, if any */
228 	struct	devi **d_ipp;		/* used for tacking on more instances */
229 };
230 
231 /*
232  * An "instance" of a device.  The same instance may be listed more
233  * than once, e.g., "xx0 at isa? port FOO" + "xx0 at isa? port BAR".
234  *
235  * After everything has been read in and verified, the devi's are
236  * "packed" to collect all the information needed to generate ioconf.c.
237  * In particular, we try to collapse multiple aliases into a single entry.
238  * We then assign each "primary" (non-collapsed) instance a cfdata index.
239  * Note that there may still be aliases among these.
240  */
241 struct devi {
242 	/* created while parsing config file */
243 	const char *i_name;	/* e.g., "sd0" */
244 	int	i_unit;		/* unit from name, e.g., 0 */
245 	struct	devbase *i_base;/* e.g., pointer to "sd" base */
246 	TAILQ_ENTRY(devi) i_next; /* list of all instances */
247 	struct	devi *i_bsame;	/* list on same base */
248 	struct	devi *i_asame;	/* list on same base attachment */
249 	struct	devi *i_alias;	/* other aliases of this instance */
250 	const char *i_at;	/* where this is "at" (NULL if at root) */
251 	struct	pspec *i_pspec;	/* parent spec (NULL if at root) */
252 	struct	deva *i_atdeva;
253 	const char **i_locs;	/* locators (as given by pspec's iattr) */
254 	int	i_cfflags;	/* flags from config line */
255 	int	i_lineno;	/* line # in config, for later errors */
256 	const char *i_srcfile;	/* file it appears in */
257 	int	i_level;	/* position between negated instances */
258 	int	i_active;
259 #define	DEVI_ORPHAN	0	/* instance has no active parent */
260 #define	DEVI_ACTIVE	1	/* instance has an active parent */
261 #define	DEVI_IGNORED	2	/* instance's parent has been removed */
262 #define DEVI_BROKEN	3	/* instance is broken (syntax error) */
263 	int	i_pseudoroot;	/* instance is pseudoroot */
264 
265 	/* created during packing or ioconf.c generation */
266 	short	i_collapsed;	/* set => this alias no longer needed */
267 	short	i_cfindex;	/* our index in cfdata */
268 	short	i_locoff;	/* offset in locators.vec */
269 
270 };
271 /* special units */
272 #define	STAR	(-1)		/* unit number for, e.g., "sd*" */
273 #define	WILD	(-2)		/* unit number for, e.g., "sd?" */
274 
275 /*
276  * Files or objects.  This structure defines the common fields
277  * between the two.
278  */
279 struct filetype
280 {
281 	const char *fit_srcfile;	/* the name of the "files" file that got us */
282 	u_short	fit_srcline;	/* and the line number */
283 	u_char	fit_flags;	/* as below */
284 	char	fit_lastc;	/* last char from path */
285 	const char *fit_path;	/* full file path */
286 	const char *fit_prefix;	/* any file prefix */
287 };
288 /* Anything less than 0x10 is sub-type specific */
289 #define FIT_NOPROLOGUE  0x10    /* Don't prepend $S/ */
290 #define FIT_FORCESELECT 0x20    /* Always include this file */
291 
292 /*
293  * Files.  Each file is either standard (always included) or optional,
294  * depending on whether it has names on which to *be* optional.  The
295  * options field (fi_optx) is actually an expression tree, with nodes
296  * for OR, AND, and NOT, as well as atoms (words) representing some
297  * particular option.  The node type is stored in the nv_num field.
298  * Subexpressions appear in the `next' field; for the binary operators
299  * AND and OR, the left subexpression is first stored in the nv_ptr field.
300  *
301  * For any file marked as needs-count or needs-flag, fixfiles() will
302  * build fi_optf, a `flat list' of the options with nv_num fields that
303  * contain counts or `need' flags; this is used in mkheaders().
304  */
305 struct files {
306 	struct filetype fi_fit;
307 	TAILQ_ENTRY(files) fi_next;
308 	const  char *fi_tail;	/* name, i.e., strrchr(fi_path, '/') + 1 */
309 	const  char *fi_base;	/* tail minus ".c" (or whatever) */
310 	struct nvlist *fi_optx; /* options expression */
311 	struct nvlist *fi_optf; /* flattened version of above, if needed */
312 	const  char *fi_mkrule;	/* special make rule, if any */
313 };
314 #define fi_srcfile fi_fit.fit_srcfile
315 #define fi_srcline fi_fit.fit_srcline
316 #define fi_flags   fi_fit.fit_flags
317 #define fi_lastc   fi_fit.fit_lastc
318 #define fi_path    fi_fit.fit_path
319 #define fi_prefix  fi_fit.fit_prefix
320 
321 /* flags */
322 #define	FI_SEL		0x01	/* selected */
323 #define	FI_NEEDSCOUNT	0x02	/* needs-count */
324 #define	FI_NEEDSFLAG	0x04	/* needs-flag */
325 #define	FI_HIDDEN	0x08	/* obscured by other(s), base names overlap */
326 
327 /*
328  * Objects and libraries.  This allows precompiled object and library
329  * files (e.g. binary-only device drivers) to be linked in.
330  */
331 struct objects {
332 	struct  filetype oi_fit;
333 	TAILQ_ENTRY(objects) oi_next;
334 	struct  nvlist *oi_optx;/* options expression */
335 	struct  nvlist *oi_optf;/* flattened version of above, if needed */
336 };
337 
338 #define oi_srcfile oi_fit.fit_srcfile
339 #define oi_srcline oi_fit.fit_srcline
340 #define oi_flags   oi_fit.fit_flags
341 #define oi_lastc   oi_fit.fit_lastc
342 #define oi_path    oi_fit.fit_path
343 #define oi_prefix  oi_fit.fit_prefix
344 
345 /* flags */
346 #define	OI_SEL		0x01	/* selected */
347 #define	OI_NEEDSFLAG	0x02	/* needs-flag */
348 
349 #define	FX_ATOM		0	/* atom (in nv_name) */
350 #define	FX_NOT		1	/* NOT expr (subexpression in nv_next) */
351 #define	FX_AND		2	/* AND expr (lhs in nv_ptr, rhs in nv_next) */
352 #define	FX_OR		3	/* OR expr (lhs in nv_ptr, rhs in nv_next) */
353 
354 /*
355  * File/object prefixes.  These are arranged in a stack, and affect
356  * the behavior of the source path.
357  */
358 struct prefix {
359 	SLIST_ENTRY(prefix)	pf_next;	/* next prefix in stack */
360 	const char		*pf_prefix;	/* the actual prefix */
361 };
362 
363 /*
364  * Device major informations.
365  */
366 struct devm {
367 	TAILQ_ENTRY(devm) dm_next;
368 	const char	*dm_srcfile;	/* the name of the "majors" file */
369 	u_short		dm_srcline;	/* the line number */
370 	const char	*dm_name;	/* [bc]devsw name */
371 	devmajor_t	dm_cmajor;	/* character major */
372 	devmajor_t	dm_bmajor;	/* block major */
373 	struct nvlist	*dm_opts;	/* options */
374 	struct nvlist	*dm_devnodes;	/* information on /dev nodes */
375 };
376 
377 /*
378  * Hash tables look up name=value pairs.  The pointer value of the name
379  * is assumed to be constant forever; this can be arranged by interning
380  * the name.  (This is fairly convenient since our lexer does this for
381  * all identifier-like strings---it has to save them anyway, lest yacc's
382  * look-ahead wipe out the current one.)
383  */
384 struct hashtab;
385 
386 int lkmmode;
387 const char *conffile;		/* source file, e.g., "GENERIC.sparc" */
388 const char *machine;		/* machine type, e.g., "sparc" or "sun3" */
389 const char *machinearch;	/* machine arch, e.g., "sparc" or "m68k" */
390 struct	nvlist *machinesubarches;
391 				/* machine subarches, e.g., "sun68k" or "hpc" */
392 const char *ioconfname;		/* ioconf name, mutually exclusive to machine */
393 const char *srcdir;		/* path to source directory (rel. to build) */
394 const char *builddir;		/* path to build directory */
395 const char *defbuilddir;	/* default build directory */
396 const char *ident;		/* kernel "ident"ification string */
397 int	errors;			/* counts calls to error() */
398 int	minmaxusers;		/* minimum "maxusers" parameter */
399 int	defmaxusers;		/* default "maxusers" parameter */
400 int	maxmaxusers;		/* default "maxusers" parameter */
401 int	maxusers;		/* configuration's "maxusers" parameter */
402 int	maxpartitions;		/* configuration's "maxpartitions" parameter */
403 int	version;		/* version of the configuration file */
404 struct	nvlist *options;	/* options */
405 struct	nvlist *fsoptions;	/* filesystems */
406 struct	nvlist *mkoptions;	/* makeoptions */
407 struct	nvlist *appmkoptions;	/* appending mkoptions */
408 struct	nvlist *condmkoptions;	/* conditional makeoption table */
409 struct	hashtab *devbasetab;	/* devbase lookup */
410 struct	hashtab *devroottab;	/* attach at root lookup */
411 struct	hashtab *devatab;	/* devbase attachment lookup */
412 struct	hashtab *devitab;	/* device instance lookup */
413 struct	hashtab *deaddevitab;	/* removed instances lookup */
414 struct	hashtab *selecttab;	/* selects things that are "optional foo" */
415 struct	hashtab *needcnttab;	/* retains names marked "needs-count" */
416 struct	hashtab *opttab;	/* table of configured options */
417 struct	hashtab *fsopttab;	/* table of configured file systems */
418 struct	hashtab *defopttab;	/* options that have been "defopt"'d */
419 struct	hashtab *defflagtab;	/* options that have been "defflag"'d */
420 struct	hashtab *defparamtab;	/* options that have been "defparam"'d */
421 struct	hashtab *defoptlint;	/* lint values for options */
422 struct	hashtab *deffstab;	/* defined file systems */
423 struct	hashtab *optfiletab;	/* "defopt"'d option .h files */
424 struct	hashtab *attrtab;	/* attributes (locators, etc.) */
425 struct	hashtab *bdevmtab;	/* block devm lookup */
426 struct	hashtab *cdevmtab;	/* character devm lookup */
427 
428 TAILQ_HEAD(, devbase)	allbases;	/* list of all devbase structures */
429 TAILQ_HEAD(, deva)	alldevas;	/* list of all devbase attachments */
430 TAILQ_HEAD(, config)	allcf;		/* list of configured kernels */
431 TAILQ_HEAD(, devi)	alldevi,	/* list of all instances */
432 			allpseudo;	/* list of all pseudo-devices */
433 TAILQ_HEAD(, devm)	alldevms;	/* list of all device-majors */
434 TAILQ_HEAD(, pspec)	allpspecs;	/* list of all parent specs */
435 int	ndevi;				/* number of devi's (before packing) */
436 int	npspecs;			/* number of parent specs */
437 devmajor_t maxbdevm;			/* max number of block major */
438 devmajor_t maxcdevm;			/* max number of character major */
439 int	do_devsw;			/* 0 if pre-devsw config */
440 int	oktopackage;			/* 0 before setmachine() */
441 int	devilevel;			/* used for devi->i_level */
442 
443 TAILQ_HEAD(, files)	allfiles;	/* list of all kernel source files */
444 TAILQ_HEAD(, objects)	allobjects;	/* list of all kernel object and
445 					   library files */
446 
447 SLIST_HEAD(, prefix)	prefixes,	/* prefix stack */
448 			allprefixes;	/* all prefixes used (after popped) */
449 SLIST_HEAD(, prefix)	curdirs;	/* curdir stack */
450 
451 struct	devi **packed;		/* arrayified table for packed devi's */
452 size_t	npacked;		/* size of packed table, <= ndevi */
453 
454 struct {			/* loc[] table for config */
455 	const char **vec;
456 	int	used;
457 } locators;
458 
459 struct numconst {
460 	int64_t	val;
461 	int fmt;
462 };
463 
464 /* files.c */
465 void	initfiles(void);
466 void	checkfiles(void);
467 int	fixfiles(void);		/* finalize */
468 int	fixobjects(void);
469 int	fixdevsw(void);
470 void	addfile(const char *, struct nvlist *, int, const char *);
471 void	addobject(const char *, struct nvlist *, int);
472 int	expr_eval(struct nvlist *, int (*)(const char *, void *), void *);
473 void	expr_free(struct nvlist *);
474 
475 /* hash.c */
476 struct	hashtab *ht_new(void);
477 void	ht_free(struct hashtab *);
478 int	ht_insrep(struct hashtab *, const char *, void *, int);
479 #define	ht_insert(ht, nam, val) ht_insrep(ht, nam, val, 0)
480 #define	ht_replace(ht, nam, val) ht_insrep(ht, nam, val, 1)
481 int	ht_remove(struct hashtab *, const char *);
482 void	*ht_lookup(struct hashtab *, const char *);
483 void	initintern(void);
484 const char *intern(const char *);
485 typedef int (*ht_callback)(const char *, void *, void *);
486 int	ht_enumerate(struct hashtab *, ht_callback, void *);
487 
488 /* lint.c */
489 void	emit_instances(void);
490 void	emit_options(void);
491 void	emit_params(void);
492 
493 /* main.c */
494 void	addoption(const char *, const char *);
495 void	addfsoption(const char *);
496 void	addmkoption(const char *, const char *);
497 void	appendmkoption(const char *, const char *);
498 void	appendcondmkoption(struct nvlist *, const char *, const char *);
499 void	deffilesystem(struct nvlist *, struct nvlist *);
500 void	defoption(const char *, struct nvlist *, struct nvlist *);
501 void	defflag(const char *, struct nvlist *, struct nvlist *, int);
502 void	defparam(const char *, struct nvlist *, struct nvlist *, int);
503 void	deloption(const char *);
504 void	delfsoption(const char *);
505 void	delmkoption(const char *);
506 int	devbase_has_instances(struct devbase *, int);
507 struct nvlist * find_declared_option(const char *);
508 int	deva_has_instances(struct deva *, int);
509 void	setupdirs(void);
510 const char *strtolower(const char *);
511 
512 /* tests on option types */
513 #define OPT_FSOPT(n)	(ht_lookup(deffstab, (n)) != NULL)
514 #define OPT_DEFOPT(n)	(ht_lookup(defopttab, (n)) != NULL)
515 #define OPT_DEFFLAG(n)	(ht_lookup(defflagtab, (n)) != NULL)
516 #define OPT_DEFPARAM(n)	(ht_lookup(defparamtab, (n)) != NULL)
517 #define OPT_OBSOLETE(n)	(ht_lookup(obsopttab, (n)) != NULL)
518 #define DEFINED_OPTION(n) (find_declared_option((n)) != NULL)
519 
520 /* main.c */
521 void	logconfig_include(FILE *, const char *);
522 
523 /* mkdevsw.c */
524 int	mkdevsw(void);
525 
526 /* mkheaders.c */
527 int	mkheaders(void);
528 int	moveifchanged(const char *, const char *);
529 int	emitlocs(void);
530 int	emitioconfh(void);
531 
532 /* mkioconf.c */
533 int	mkioconf(void);
534 
535 /* mkmakefile.c */
536 int	mkmakefile(void);
537 
538 /* mkswap.c */
539 int	mkswap(void);
540 
541 /* pack.c */
542 void	pack(void);
543 
544 /* scan.l */
545 int	currentline(void);
546 int	firstfile(const char *);
547 void	package(const char *);
548 int	include(const char *, int, int, int);
549 
550 /* sem.c, other than for yacc actions */
551 void	initsem(void);
552 int	onlist(struct nvlist *, void *);
553 
554 /* util.c */
555 void	prefix_push(const char *);
556 void	prefix_pop(void);
557 char	*sourcepath(const char *);
558 void	cfgwarn(const char *, ...)			/* immediate warns */
559      __attribute__((__format__(__printf__, 1, 2)));
560 void	cfgxwarn(const char *, int, const char *, ...)	/* delayed warns */
561      __attribute__((__format__(__printf__, 3, 4)));
562 void	cfgerror(const char *, ...)			/* immediate errs */
563      __attribute__((__format__(__printf__, 1, 2)));
564 void	cfgxerror(const char *, int, const char *, ...)	/* delayed errs */
565      __attribute__((__format__(__printf__, 3, 4)));
566 __dead void panic(const char *, ...)
567      __attribute__((__format__(__printf__, 1, 2)));
568 struct nvlist *newnv(const char *, const char *, void *, long long, struct nvlist *);
569 void	nvfree(struct nvlist *);
570 void	nvfreel(struct nvlist *);
571 struct nvlist *nvcat(struct nvlist *, struct nvlist *);
572 void	autogen_comment(FILE *, const char *);
573 
574 /* liby */
575 void	yyerror(const char *);
576 int	yylex(void);
577