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