4 struct file_list *file;
36 * Copyright (c) 1988, 1993
37 * The Regents of the University of California. All rights reserved.
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 3. All advertising materials mentioning features or use of this software
48 * must display the following acknowledgement:
49 * This product includes software developed by the University of
50 * California, Berkeley and its contributors.
51 * 4. Neither the name of the University nor the names of its contributors
52 * may be used to endorse or promote products derived from this software
53 * without specific prior written permission.
55 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 * @(#)config.y 8.1 (Berkeley) 6/6/93
78 struct device_head dtab;
86 struct file_list_head ftab;
90 #define ns(s) strdup(s)
91 int include(const char *, int);
92 void yyerror(const char *s);
97 char *ret = malloc(strlen(dev) + 5);
99 sprintf(ret, "DEV_%s", dev);
117 Device_spec SEMICOLON
119 Config_spec SEMICOLON
122 = { include($2, 0); };
132 if (machinename != NULL)
133 errx(1, "%s:%d: only one machine directive is allowed",
140 (struct cputype *)malloc(sizeof (struct cputype));
141 memset(cp, 0, sizeof(*cp));
143 SLIST_INSERT_HEAD(&cputype, cp, cpu_next);
148 = { rmopt(&opt, $2); } |
149 MAKEOPTIONS Mkopt_list
152 = { rmopt(&mkopt, $2); } |
158 = { maxusers = $2; } |
160 = { profiling = $2; } |
173 CONFIG System_id System_parameter_list
174 = { errx(1, "%s:%d: root/dump/swap specifications obsolete",
182 = { newopt(&mkopt, ns("KERNEL"), $1); };
184 System_parameter_list:
185 System_parameter_list ID
190 Opt_list COMMA Option
200 newopt(&opt, $1, NULL);
201 if ((s = strchr($1, '=')))
202 errx(1, "%s:%d: The `=' in options should not be "
203 "quoted", yyfile, yyline);
205 Save_id EQUALS Opt_value
207 newopt(&opt, $1, $3);
217 (void) snprintf(buf, sizeof(buf), "%d", $1);
227 Mkopt_list COMMA Mkoption
234 = { newopt(&mkopt, $1, ns("")); } |
235 Save_id EQUALS Opt_value
236 = { newopt(&mkopt, $1, $3); } ;
246 newopt(&opt, devopt($2), ns("1"));
247 /* and the device part */
252 newopt(&opt, devopt($2), ns("1"));
253 /* and the device part */
256 errx(1, "%s:%d: devices with zero units are not "
257 "likely to be correct", yyfile, yyline);
261 char *s = devopt($2);
265 /* and the device part */
272 yyerror(const char *s)
275 errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
279 * add a device to the list of devices
282 newdev(char *name, int count)
286 np = (struct device *) malloc(sizeof *np);
287 memset(np, 0, sizeof(*np));
290 STAILQ_INSERT_TAIL(&dtab, np, d_next);
294 * remove a device from the list of devices
299 struct device *dp, *rmdp;
301 STAILQ_FOREACH(dp, &dtab, d_next) {
302 if (eq(dp->d_name, name)) {
304 dp = STAILQ_NEXT(dp, d_next);
305 STAILQ_REMOVE(&dtab, rmdp, device, d_next);
315 newopt(struct opt_head *list, char *name, char *value)
319 op = (struct opt *)malloc(sizeof (struct opt));
320 memset(op, 0, sizeof(*op));
323 op->op_value = value;
324 SLIST_INSERT_HEAD(list, op, op_next);
328 rmopt(struct opt_head *list, char *name)
330 struct opt *op, *rmop;
332 SLIST_FOREACH(op, list, op_next) {
333 if (eq(op->op_name, name)) {
335 op = SLIST_NEXT(op, op_next);
336 SLIST_REMOVE(list, rmop, opt, op_next);
338 if (rmop->op_value != NULL)
339 free(rmop->op_value);