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