4 struct file_list *file;
38 * Copyright (c) 1988, 1993
39 * The Regents of the University of California. All rights reserved.
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions
44 * 1. Redistributions of source code must retain the above copyright
45 * notice, this list of conditions and the following disclaimer.
46 * 2. Redistributions in binary form must reproduce the above copyright
47 * notice, this list of conditions and the following disclaimer in the
48 * documentation and/or other materials provided with the distribution.
49 * 3. All advertising materials mentioning features or use of this software
50 * must display the following acknowledgement:
51 * This product includes software developed by the University of
52 * California, Berkeley and its contributors.
53 * 4. Neither the name of the University nor the names of its contributors
54 * may be used to endorse or promote products derived from this software
55 * without specific prior written permission.
57 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
58 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
60 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
61 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
62 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
63 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
64 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
65 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * @(#)config.y 8.1 (Berkeley) 6/6/93
80 struct device_head dtab;
88 struct file_list_head ftab;
89 struct files_name_head fntab;
93 #define ns(s) strdup(s)
94 int include(const char *, int);
95 void yyerror(const char *s);
101 char *ret = malloc(strlen(dev) + 5);
103 sprintf(ret, "DEV_%s", dev);
121 Device_spec SEMICOLON
123 Config_spec SEMICOLON
126 = { include($2, 0); };
139 if (machinename != NULL && !eq($2, machinename))
140 errx(1, "%s:%d: only one machine directive is allowed",
147 if (machinename != NULL &&
148 !(eq($2, machinename) && eq($3, machinearch)))
149 errx(1, "%s:%d: only one machine directive is allowed",
157 (struct cputype *)malloc(sizeof (struct cputype));
158 memset(cp, 0, sizeof(*cp));
160 SLIST_INSERT_HEAD(&cputype, cp, cpu_next);
164 struct cputype *cp, *cp2;
165 SLIST_FOREACH_SAFE(cp, &cputype, cpu_next, cp2) {
166 if (eq(cp->cpu_name, $2)) {
167 SLIST_REMOVE(&cputype, cp, cputype, cpu_next);
175 = { rmopt(&opt, $2); } |
176 MAKEOPTIONS Mkopt_list
179 = { rmopt(&mkopt, $2); } |
185 = { maxusers = $2; } |
187 = { profiling = $2; } |
200 CONFIG System_id System_parameter_list
201 = { errx(1, "%s:%d: root/dump/swap specifications obsolete",
209 = { newopt(&mkopt, ns("KERNEL"), $1); };
211 System_parameter_list:
212 System_parameter_list ID
217 Opt_list COMMA Option
227 newopt(&opt, $1, NULL);
228 if ((s = strchr($1, '=')))
229 errx(1, "%s:%d: The `=' in options should not be "
230 "quoted", yyfile, yyline);
232 Save_id EQUALS Opt_value
234 newopt(&opt, $1, $3);
244 (void) snprintf(buf, sizeof(buf), "%d", $1);
254 Mkopt_list COMMA Mkoption
261 = { newopt(&mkopt, $1, ns("")); } |
262 Save_id EQUALS Opt_value
263 = { newopt(&mkopt, $1, $3); } ;
277 Dev_list COMMA Device
283 NoDev_list COMMA NoDevice
291 newopt(&opt, devopt($1), ns("1"));
292 /* and the device part */
299 char *s = devopt($1);
303 /* and the device part */
310 yyerror(const char *s)
313 errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
320 if (found_defaults) {
321 if (freopen(PREFIX, "r", stdin) == NULL)
322 err(2, "%s", PREFIX);
332 * Add a new file to the list of files.
337 struct files_name *nl;
339 nl = (struct files_name *) malloc(sizeof *nl);
340 bzero(nl, sizeof *nl);
342 STAILQ_INSERT_TAIL(&fntab, nl, f_next);
346 * Find a device in the list of devices.
348 static struct device *
353 STAILQ_FOREACH(dp, &dtab, d_next)
354 if (eq(dp->d_name, name))
361 * Add a device to the list of devices.
369 printf("WARNING: duplicate device `%s' encountered.\n", name);
373 np = (struct device *) malloc(sizeof *np);
374 memset(np, 0, sizeof(*np));
376 STAILQ_INSERT_TAIL(&dtab, np, d_next);
380 * Remove a device from the list of devices.
389 STAILQ_REMOVE(&dtab, dp, device, d_next);
396 * Find an option in the list of options.
399 findopt(struct opt_head *list, char *name)
403 SLIST_FOREACH(op, list, op_next)
404 if (eq(op->op_name, name))
411 * Add an option to the list of options.
414 newopt(struct opt_head *list, char *name, char *value)
418 if (findopt(list, name)) {
419 printf("WARNING: duplicate option `%s' encountered.\n", name);
423 op = (struct opt *)malloc(sizeof (struct opt));
424 memset(op, 0, sizeof(*op));
427 op->op_value = value;
428 SLIST_INSERT_HEAD(list, op, op_next);
432 * Remove an option from the list of options.
435 rmopt(struct opt_head *list, char *name)
439 op = findopt(list, name);
441 SLIST_REMOVE(list, op, opt, op_next);
443 if (op->op_value != NULL)