4 struct file_list *file;
37 * Copyright (c) 1988, 1993
38 * The Regents of the University of California. All rights reserved.
40 * Redistribution and use in source and binary forms, with or without
41 * modification, are permitted provided that the following conditions
43 * 1. Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * 2. Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in the
47 * documentation and/or other materials provided with the distribution.
48 * 3. All advertising materials mentioning features or use of this software
49 * must display the following acknowledgement:
50 * This product includes software developed by the University of
51 * California, Berkeley and its contributors.
52 * 4. Neither the name of the University nor the names of its contributors
53 * may be used to endorse or promote products derived from this software
54 * without specific prior written permission.
56 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
57 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
59 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
60 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
61 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
62 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
64 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
65 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * @(#)config.y 8.1 (Berkeley) 6/6/93
79 struct device_head dtab;
87 struct file_list_head ftab;
88 struct files_name_head fntab;
92 #define ns(s) strdup(s)
93 int include(const char *, int);
94 void yyerror(const char *s);
99 char *ret = malloc(strlen(dev) + 5);
101 sprintf(ret, "DEV_%s", dev);
119 Device_spec SEMICOLON
121 Config_spec SEMICOLON
124 = { include($2, 0); };
137 if (machinename != NULL)
138 errx(1, "%s:%d: only one machine directive is allowed",
145 if (machinename != NULL)
146 errx(1, "%s:%d: only one machine directive is allowed",
154 (struct cputype *)malloc(sizeof (struct cputype));
155 memset(cp, 0, sizeof(*cp));
157 SLIST_INSERT_HEAD(&cputype, cp, cpu_next);
162 = { rmopt(&opt, $2); } |
163 MAKEOPTIONS Mkopt_list
166 = { rmopt(&mkopt, $2); } |
172 = { maxusers = $2; } |
174 = { profiling = $2; } |
187 CONFIG System_id System_parameter_list
188 = { errx(1, "%s:%d: root/dump/swap specifications obsolete",
196 = { newopt(&mkopt, ns("KERNEL"), $1); };
198 System_parameter_list:
199 System_parameter_list ID
204 Opt_list COMMA Option
214 newopt(&opt, $1, NULL);
215 if ((s = strchr($1, '=')))
216 errx(1, "%s:%d: The `=' in options should not be "
217 "quoted", yyfile, yyline);
219 Save_id EQUALS Opt_value
221 newopt(&opt, $1, $3);
231 (void) snprintf(buf, sizeof(buf), "%d", $1);
241 Mkopt_list COMMA Mkoption
248 = { newopt(&mkopt, $1, ns("")); } |
249 Save_id EQUALS Opt_value
250 = { newopt(&mkopt, $1, $3); } ;
264 Dev_list COMMA Device
270 NoDev_list COMMA NoDevice
278 newopt(&opt, devopt($1), ns("1"));
279 /* and the device part */
286 char *s = devopt($1);
290 /* and the device part */
297 yyerror(const char *s)
300 errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
304 * Add a new file to the list of files.
309 struct files_name *nl;
311 nl = (struct files_name *) malloc(sizeof *nl);
312 bzero(nl, sizeof *nl);
314 STAILQ_INSERT_TAIL(&fntab, nl, f_next);
318 * add a device to the list of devices
325 np = (struct device *) malloc(sizeof *np);
326 memset(np, 0, sizeof(*np));
328 STAILQ_INSERT_TAIL(&dtab, np, d_next);
332 * remove a device from the list of devices
337 struct device *dp, *rmdp;
339 STAILQ_FOREACH(dp, &dtab, d_next) {
340 if (eq(dp->d_name, name)) {
342 dp = STAILQ_NEXT(dp, d_next);
343 STAILQ_REMOVE(&dtab, rmdp, device, d_next);
353 newopt(struct opt_head *list, char *name, char *value)
357 op = (struct opt *)malloc(sizeof (struct opt));
358 memset(op, 0, sizeof(*op));
361 op->op_value = value;
362 SLIST_INSERT_HEAD(list, op, op_next);
366 rmopt(struct opt_head *list, char *name)
368 struct opt *op, *rmop;
370 SLIST_FOREACH(op, list, op_next) {
371 if (eq(op->op_name, name)) {
373 op = SLIST_NEXT(op, op_next);
374 SLIST_REMOVE(list, rmop, opt, op_next);
376 if (rmop->op_value != NULL)
377 free(rmop->op_value);