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