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
129 if (machinename != NULL)
130 errx(1, "%s:%d: only one machine directive is allowed",
137 (struct cputype *)malloc(sizeof (struct cputype));
138 memset(cp, 0, sizeof(*cp));
140 SLIST_INSERT_HEAD(&cputype, cp, cpu_next);
145 = { rmopt(&opt, $2); } |
146 MAKEOPTIONS Mkopt_list
149 = { rmopt(&mkopt, $2); } |
155 = { maxusers = $2; } |
157 = { profiling = $2; } |
169 = { include($2, 0); };
172 CONFIG System_id System_parameter_list
173 = { errx(1, "%s:%d: root/dump/swap specifications obsolete",
181 = { newopt(&mkopt, ns("KERNEL"), $1); };
183 System_parameter_list:
184 System_parameter_list ID
189 Opt_list COMMA Option
199 newopt(&opt, $1, NULL);
200 if ((s = strchr($1, '=')))
201 errx(1, "%s:%d: The `=' in options should not be "
202 "quoted", yyfile, yyline);
204 Save_id EQUALS Opt_value
206 newopt(&opt, $1, $3);
216 (void) snprintf(buf, sizeof(buf), "%d", $1);
226 Mkopt_list COMMA Mkoption
233 = { newopt(&mkopt, $1, ns("")); } |
234 Save_id EQUALS Opt_value
235 = { newopt(&mkopt, $1, $3); } ;
245 newopt(&opt, devopt($2), ns("1"));
246 /* and the device part */
251 newopt(&opt, devopt($2), ns("1"));
252 /* and the device part */
255 errx(1, "%s:%d: devices with zero units are not "
256 "likely to be correct", yyfile, yyline);
260 char *s = devopt($2);
264 /* and the device part */
271 yyerror(const char *s)
274 errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
278 * add a device to the list of devices
281 newdev(char *name, int count)
285 np = (struct device *) malloc(sizeof *np);
286 memset(np, 0, sizeof(*np));
289 STAILQ_INSERT_TAIL(&dtab, np, d_next);
293 * remove a device from the list of devices
298 struct device *dp, *rmdp;
300 STAILQ_FOREACH(dp, &dtab, d_next) {
301 if (eq(dp->d_name, name)) {
303 dp = STAILQ_NEXT(dp, d_next);
304 STAILQ_REMOVE(&dtab, rmdp, device, d_next);
314 newopt(struct opt_head *list, char *name, char *value)
318 op = (struct opt *)malloc(sizeof (struct opt));
319 memset(op, 0, sizeof(*op));
322 op->op_value = value;
323 SLIST_INSERT_HEAD(list, op, op_next);
327 rmopt(struct opt_head *list, char *name)
329 struct opt *op, *rmop;
331 SLIST_FOREACH(op, list, op_next) {
332 if (eq(op->op_name, name)) {
334 op = SLIST_NEXT(op, op_next);
335 SLIST_REMOVE(list, rmop, opt, op_next);
337 if (rmop->op_value != NULL)
338 free(rmop->op_value);