Deleted Added
full compact
config.y (56869) config.y (61640)
1%union {
2 char *str;
3 int val;
4 struct file_list *file;
5}
6
1%union {
2 char *str;
3 int val;
4 struct file_list *file;
5}
6
7%token ANY
8%token ARCH
7%token ARCH
9%token AT
10%token BUS
11%token COMMA
12%token CONFIG
8%token COMMA
9%token CONFIG
13%token CONFLICTS
14%token CONTROLLER
15%token CPU
16%token DEVICE
10%token CPU
11%token DEVICE
17%token DISABLE
18%token DISK
19%token DRIVE
20%token DRQ
21%token EQUALS
12%token EQUALS
22%token FLAGS
13%token HINTS
23%token IDENT
14%token IDENT
24%token IOMEM
25%token IOSIZ
26%token IRQ
27%token MAXUSERS
15%token MAXUSERS
28%token MINUS
29%token NEXUS
30%token OPTIONS
31%token MAKEOPTIONS
16%token OPTIONS
17%token MAKEOPTIONS
32%token PORT
33%token PSEUDO_DEVICE
34%token SEMICOLON
18%token SEMICOLON
35%token TAPE
36%token TARGET
37%token TTY
38%token UNIT
39%token VECTOR
40
41%token <str> ID
42%token <val> NUMBER
19
20%token <str> ID
21%token <val> NUMBER
43%token <val> FPNUMBER
44
45%type <str> Save_id
46%type <str> Opt_value
47%type <str> Dev
22
23%type <str> Save_id
24%type <str> Opt_value
25%type <str> Dev
48%type <str> device_name
49
50%{
51
52/*
53 * Copyright (c) 1988, 1993
54 * The Regents of the University of California. All rights reserved.
55 *
56 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

77 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
78 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
79 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
80 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
81 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
82 * SUCH DAMAGE.
83 *
84 * @(#)config.y 8.1 (Berkeley) 6/6/93
26
27%{
28
29/*
30 * Copyright (c) 1988, 1993
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 * @(#)config.y 8.1 (Berkeley) 6/6/93
85 * $FreeBSD: head/usr.sbin/config/config.y 56869 2000-01-29 18:14:59Z peter $
62 * $FreeBSD: head/usr.sbin/config/config.y 61640 2000-06-13 22:28:50Z peter $
86 */
87
88#include <ctype.h>
89#include <err.h>
90#include <stdio.h>
91#include <string.h>
92
93#include "config.h"
94
95static struct device cur;
96static struct device *curp = 0;
97
98struct device *dtab;
99char *ident;
63 */
64
65#include <ctype.h>
66#include <err.h>
67#include <stdio.h>
68#include <string.h>
69
70#include "config.h"
71
72static struct device cur;
73static struct device *curp = 0;
74
75struct device *dtab;
76char *ident;
77char *hints;
100int yyline;
101struct file_list *ftab;
102char errbuf[80];
103int maxusers;
104
105#define ns(s) strdup(s)
106
78int yyline;
79struct file_list *ftab;
80char errbuf[80];
81int maxusers;
82
83#define ns(s) strdup(s)
84
107static int connect __P((char *, int));
108static void yyerror __P((char *s));
85static void yyerror(char *s);
109
110
111%}
112%%
113Configuration:
114 Many_specs
115 ;
116

--- 41 unchanged lines hidden (view full) ---

158 |
159 MAKEOPTIONS Mkopt_list
160 |
161 IDENT ID
162 = { ident = $2; } |
163 System_spec
164 |
165 MAXUSERS NUMBER
86
87
88%}
89%%
90Configuration:
91 Many_specs
92 ;
93

--- 41 unchanged lines hidden (view full) ---

135 |
136 MAKEOPTIONS Mkopt_list
137 |
138 IDENT ID
139 = { ident = $2; } |
140 System_spec
141 |
142 MAXUSERS NUMBER
166 = { maxusers = $2; };
143 = { maxusers = $2; } |
144 HINTS ID
145 = { hints = $2; };
167
168System_spec:
169 CONFIG System_id System_parameter_list
170 = { warnx("line %d: root/dump/swap specifications obsolete", yyline);}
171 |
172 CONFIG System_id
173 ;
174

--- 10 unchanged lines hidden (view full) ---

185 mkopt = op;
186 };
187
188System_parameter_list:
189 System_parameter_list ID
190 | ID
191 ;
192
146
147System_spec:
148 CONFIG System_id System_parameter_list
149 = { warnx("line %d: root/dump/swap specifications obsolete", yyline);}
150 |
151 CONFIG System_id
152 ;
153

--- 10 unchanged lines hidden (view full) ---

164 mkopt = op;
165 };
166
167System_parameter_list:
168 System_parameter_list ID
169 | ID
170 ;
171
193device_name:
194 Save_id
195 = { $$ = $1; }
196 | Save_id NUMBER
197 = {
198 char buf[80];
199
200 (void) snprintf(buf, sizeof(buf), "%s%d", $1, $2);
201 $$ = ns(buf); free($1);
202 }
203 | Save_id NUMBER ID
204 = {
205 char buf[80];
206
207 (void) snprintf(buf, sizeof(buf), "%s%d%s", $1, $2, $3);
208 $$ = ns(buf); free($1);
209 }
210 | Save_id NUMBER ID NUMBER
211 = {
212 char buf[80];
213
214 (void) snprintf(buf, sizeof(buf), "%s%d%s%d",
215 $1, $2, $3, $4);
216 $$ = ns(buf); free($1);
217 }
218 | Save_id NUMBER ID NUMBER ID
219 = {
220 char buf[80];
221
222 (void) snprintf(buf, sizeof(buf), "%s%d%s%d%s",
223 $1, $2, $3, $4, $5);
224 $$ = ns(buf); free($1);
225 }
226 ;
227
228Opt_list:
229 Opt_list COMMA Option
230 |
231 Option
232 ;
233
234Option:
235 Save_id

--- 63 unchanged lines hidden (view full) ---

299 } ;
300
301Dev:
302 ID
303 = { $$ = $1; }
304 ;
305
306Device_spec:
172Opt_list:
173 Opt_list COMMA Option
174 |
175 Option
176 ;
177
178Option:
179 Save_id

--- 63 unchanged lines hidden (view full) ---

243 } ;
244
245Dev:
246 ID
247 = { $$ = $1; }
248 ;
249
250Device_spec:
307 DEVICE Dev_spec
308 = { cur.d_type = DEVICE; } |
309 DISK Dev_spec
251 DEVICE Dev
310 = {
252 = {
311 warnx("line %d: Obsolete keyword 'disk' found - use 'device'", yyline);
312 cur.d_type = DEVICE;
253 cur.d_type = DEVICE;
254 cur.d_name = $2;
255 cur.d_count = UNKNOWN;
313 } |
256 } |
314 TAPE Dev_spec
257 DEVICE Dev NUMBER
315 = {
258 = {
316 warnx("line %d: Obsolete keyword 'tape' found - use 'device'", yyline);
317 cur.d_type = DEVICE;
259 cur.d_type = DEVICE;
318 } |
319 CONTROLLER Dev_spec
320 = {
321 warnx("line %d: Obsolete keyword 'controller' found - use 'device'", yyline);
322 cur.d_type = DEVICE;
323 } |
324 PSEUDO_DEVICE Init_dev Dev
325 = {
326 cur.d_name = $3;
327 cur.d_type = PSEUDO_DEVICE;
328 } |
329 PSEUDO_DEVICE Init_dev Dev NUMBER
330 = {
331 cur.d_name = $3;
332 cur.d_type = PSEUDO_DEVICE;
333 cur.d_count = $4;
260 cur.d_name = $2;
261 cur.d_count = $3;
262 if (cur.d_count == 0)
263 warnx("line %d: devices with zero units are not likely to be correct", yyline);
334 } ;
335
264 } ;
265
336Dev_spec:
337 Init_dev Dev
338 = {
339 cur.d_name = $2;
340 cur.d_unit = UNKNOWN;
341 } |
342 Init_dev Dev NUMBER Dev_info
343 = {
344 cur.d_name = $2;
345 cur.d_unit = $3;
346 };
347
348Init_dev:
349 /* lambda */
350 = { init_dev(&cur); };
351
352Dev_info:
353 Con_info Info_list
354 |
355 /* lambda */
356 ;
357
358Con_info:
359 AT Dev NUMBER
360 = {
361 connect($2, $3);
362 cur.d_conn = $2;
363 cur.d_connunit = $3;
364 } |
365 AT NEXUS NUMBER
366 = {
367 cur.d_conn = "nexus";
368 cur.d_connunit = 0;
369 };
370
371Info_list:
372 Info_list Info
373 |
374 /* lambda */
375 ;
376
377Info:
378 BUS NUMBER /* device scbus1 at ahc0 bus 1 - twin channel */
379 = { cur.d_bus = $2; } |
380 TARGET NUMBER
381 = { cur.d_target = $2; } |
382 UNIT NUMBER
383 = { cur.d_lun = $2; } |
384 DRIVE NUMBER
385 = { cur.d_drive = $2; } |
386 IRQ NUMBER
387 = { cur.d_irq = $2; } |
388 DRQ NUMBER
389 = { cur.d_drq = $2; } |
390 IOMEM NUMBER
391 = { cur.d_maddr = $2; } |
392 IOSIZ NUMBER
393 = { cur.d_msize = $2; } |
394 PORT device_name
395 = { cur.d_port = $2; } |
396 PORT NUMBER
397 = { cur.d_portn = $2; } |
398 FLAGS NUMBER
399 = { cur.d_flags = $2; } |
400 DISABLE
401 = { cur.d_disabled = 1; } |
402 CONFLICTS
403 = {
404 warnx("line %d: Obsolete keyword 'conflicts' found", yyline);
405 };
406
407%%
408
409static void
266%%
267
268static void
410yyerror(s)
411 char *s;
269yyerror(char *s)
412{
413
414 warnx("line %d: %s", yyline + 1, s);
415}
416
417/*
418 * add a device to the list of devices
419 */
420static void
270{
271
272 warnx("line %d: %s", yyline + 1, s);
273}
274
275/*
276 * add a device to the list of devices
277 */
278static void
421newdev(dp)
422 register struct device *dp;
279newdev(struct device *dp)
423{
280{
424 register struct device *np, *xp;
281 struct device *np;
425
282
426 if (dp->d_unit >= 0) {
427 for (xp = dtab; xp != 0; xp = xp->d_next) {
428 if ((xp->d_unit == dp->d_unit) &&
429 eq(xp->d_name, dp->d_name)) {
430 warnx("line %d: already seen device %s%d",
431 yyline, xp->d_name, xp->d_unit);
432 }
433 }
434 }
435 np = (struct device *) malloc(sizeof *np);
436 memset(np, 0, sizeof(*np));
437 *np = *dp;
283 np = (struct device *) malloc(sizeof *np);
284 memset(np, 0, sizeof(*np));
285 *np = *dp;
286 np->d_name = dp->d_name;
287 np->d_type = dp->d_type;
288 np->d_count = dp->d_count;
438 np->d_next = 0;
439 if (curp == 0)
440 dtab = np;
441 else
442 curp->d_next = np;
443 curp = np;
444}
289 np->d_next = 0;
290 if (curp == 0)
291 dtab = np;
292 else
293 curp->d_next = np;
294 curp = np;
295}
445
446
447/*
448 * find the pointer to connect to the given device and number.
449 * returns 0 if no such device and prints an error message
450 */
451static int
452connect(dev, num)
453 register char *dev;
454 register int num;
455{
456 register struct device *dp;
457
458 if (num == QUES) {
459 for (dp = dtab; dp != 0; dp = dp->d_next)
460 if (eq(dp->d_name, dev))
461 break;
462 if (dp == 0) {
463 (void) snprintf(errbuf, sizeof(errbuf),
464 "no %s's to wildcard", dev);
465 yyerror(errbuf);
466 return (0);
467 }
468 return (1);
469 }
470 for (dp = dtab; dp != 0; dp = dp->d_next) {
471 if ((num != dp->d_unit) || !eq(dev, dp->d_name))
472 continue;
473 if (dp->d_type != DEVICE) {
474 (void) snprintf(errbuf, sizeof(errbuf),
475 "%s connected to non-device", dev);
476 yyerror(errbuf);
477 return (0);
478 }
479 return (1);
480 }
481 (void) snprintf(errbuf, sizeof(errbuf), "%s %d not defined", dev, num);
482 yyerror(errbuf);
483 return (0);
484}
485
486void
487init_dev(dp)
488 register struct device *dp;
489{
490
491 dp->d_name = "OHNO!!!";
492 dp->d_type = DEVICE;
493 dp->d_conn = 0;
494 dp->d_disabled = 0;
495 dp->d_flags = 0;
496 dp->d_bus = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = \
497 dp->d_count = UNKNOWN;
498 dp->d_port = (char *)0;
499 dp->d_portn = -1;
500 dp->d_irq = -1;
501 dp->d_drq = -1;
502 dp->d_maddr = 0;
503 dp->d_msize = 0;
504}