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