diff options
author | peter <peter@FreeBSD.org> | 2004-08-30 23:03:58 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-08-30 23:03:58 +0000 |
commit | 1d9abdbe783a3f2587fde29b89cda1c8da982097 (patch) | |
tree | 48d9944fb7d50a767ae5d57a3e3f8f4c3facf67e /usr.sbin | |
parent | 78508cab2611f6e60cfba0bb7d5314c1fd36f4b3 (diff) | |
download | FreeBSD-src-1d9abdbe783a3f2587fde29b89cda1c8da982097.zip FreeBSD-src-1d9abdbe783a3f2587fde29b89cda1c8da982097.tar.gz |
Kill count device support from config. I've changed the last few
remaining consumers to have the count passed as an option. This is
i4b, pc98/wdc, and coda.
Bump configvers.h from 500013 to 600000.
Remove heuristics that tried to parse "device ed5" as 5 units of the ed
device. This broke things like the snd_emu10k1 device, which required
quotes to make it parse right. The no-longer-needed quotes have been
removed from NOTES, GENERIC etc. eg, I've removed the quotes from:
device snd_maestro
device "snd_maestro3"
device snd_mss
I believe everything will still compile and work after this.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/config/config.h | 8 | ||||
-rw-r--r-- | usr.sbin/config/config.y | 14 | ||||
-rw-r--r-- | usr.sbin/config/configvers.h | 2 | ||||
-rw-r--r-- | usr.sbin/config/lang.l | 19 | ||||
-rw-r--r-- | usr.sbin/config/mkheaders.c | 156 | ||||
-rw-r--r-- | usr.sbin/config/mkmakefile.c | 18 |
6 files changed, 12 insertions, 205 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index 691aa3a..f3d292d 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -41,7 +41,7 @@ struct file_list { STAILQ_ENTRY(file_list) f_next; char *f_fn; /* the name */ - int f_type; /* type or count */ + int f_type; /* type */ u_char f_flags; /* see below */ char *f_compilewith; /* special make rule if present */ char *f_depends; /* additional dependancies */ @@ -72,14 +72,12 @@ struct files_name { #define NO_IMPLCT_RULE 1 #define NO_OBJ 2 #define BEFORE_DEPEND 4 -#define NEED_COUNT 8 -#define ISDUP 16 -#define NOWERROR 32 +#define ISDUP 8 +#define NOWERROR 16 struct device { int d_done; /* processed */ char *d_name; /* name of device (e.g. rk11) */ - int d_count; /* device count */ #define UNKNOWN -2 /* -2 means not set yet */ STAILQ_ENTRY(device) d_next; /* Next one in list */ }; diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index d16982a..47b2568 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -250,16 +250,7 @@ Device_spec: = { newopt(&opt, devopt($2), ns("1")); /* and the device part */ - newdev($2, UNKNOWN); - } | - DEVICE Dev NUMBER - = { - newopt(&opt, devopt($2), ns("1")); - /* and the device part */ - newdev($2, $3); - if ($3 == 0) - errx(1, "%s:%d: devices with zero units are not " - "likely to be correct", yyfile, yyline); + newdev($2); } | NODEVICE Dev = { @@ -298,14 +289,13 @@ newfile(char *name) * add a device to the list of devices */ static void -newdev(char *name, int count) +newdev(char *name) { struct device *np; np = (struct device *) malloc(sizeof *np); memset(np, 0, sizeof(*np)); np->d_name = name; - np->d_count = count; STAILQ_INSERT_TAIL(&dtab, np, d_next); } diff --git a/usr.sbin/config/configvers.h b/usr.sbin/config/configvers.h index 4e6ccb9..1c66e66 100644 --- a/usr.sbin/config/configvers.h +++ b/usr.sbin/config/configvers.h @@ -8,4 +8,4 @@ * * $FreeBSD$ */ -#define CONFIGVERS 500013 +#define CONFIGVERS 600000 diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l index d9e70ba..a15dfe3 100644 --- a/usr.sbin/config/lang.l +++ b/usr.sbin/config/lang.l @@ -89,11 +89,10 @@ unsigned int hex(const char *); int yyerror(const char *); %} -WORD [A-Za-z_][-A-Za-z_]* ID [A-Za-z_][-A-Za-z_0-9]* -%START NONUM TOEOL +%START TOEOL %% -<NONUM>{WORD} { +{ID} { int i; BEGIN 0; @@ -104,20 +103,6 @@ ID [A-Za-z_][-A-Za-z_0-9]* } return i; } -<INITIAL>{WORD}/[0-9]* { - int i; - - if ((i = kw_lookup(yytext)) == -1) - REJECT; - if (i == DEVICE || i == NODEVICE) - BEGIN NONUM; - return i; - } -<INITIAL>{ID} { - BEGIN 0; - yylval.str = strdup(yytext); - return ID; - } \\\"[^"]+\\\" { BEGIN 0; yytext[yyleng-2] = '"'; diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c index 2df6a92..9babe78 100644 --- a/usr.sbin/config/mkheaders.c +++ b/usr.sbin/config/mkheaders.c @@ -47,10 +47,6 @@ static const char rcsid[] = #include "config.h" #include "y.tab.h" -static int do_header(char *, int); -static char *toheader(char *); -static char *tomacro(char *); - void headers(void) { @@ -69,8 +65,6 @@ headers(void) dp->d_done |= DEVDONE; } } - if (fl->f_flags & NEED_COUNT) - errors += do_header(fl->f_needs, match); } } STAILQ_FOREACH(dp, &dtab, d_next) { @@ -79,157 +73,7 @@ headers(void) dp->d_name); errors++; } - if (dp->d_count == UNKNOWN) - continue; - match = 0; - STAILQ_FOREACH(fl, &ftab, f_next) { - if (fl->f_needs == 0) - continue; - if ((fl->f_flags & NEED_COUNT) == 0) - continue; - if (eq(dp->d_name, fl->f_needs)) { - match++; - break; - } - } - if (match == 0) { - warnx("Error: device \"%s\" does not take a count", - dp->d_name); - errors++; - } } if (errors) errx(1, "%d errors", errors); } - -static int -do_header(char *dev, int match) -{ - char *file, *name, *inw; - struct file_list *fl, *tflp; - struct file_list_head fl_head; - struct device *dp; - FILE *inf, *outf; - int inc, oldcount; - int count, hicount; - int errors; - - /* - * After this loop, "count" will be the actual number of units, - * and "hicount" will be the highest unit declared. do_header() - * must use this higher of these values. - */ - errors = 0; - hicount = count = 0; - STAILQ_FOREACH(dp, &dtab, d_next) { - if (eq(dp->d_name, dev)) { - if (dp->d_count == UNKNOWN) { - warnx("Device \"%s\" requires a count", dev); - return 1; - } - count = dp->d_count; - break; - } - } - file = toheader(dev); - name = tomacro(dev); - if (match) - fprintf(stderr, - "FYI: static unit limits for %s are set: %s=%d\n", - dev, name, count); - remember(file); - inf = fopen(file, "r"); - oldcount = -1; - if (inf == 0) { - outf = fopen(file, "w"); - if (outf == 0) - err(1, "%s", file); - fprintf(outf, "#ifndef BURN_BRIDGES\n"); - fprintf(outf, "#define %s %d\n", name, count); - fprintf(outf, "#endif\n"); - (void) fclose(outf); - return 0; - } - STAILQ_INIT(&fl_head); - for (;;) { - char *cp; - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) - break; - if ((inw = get_word(inf)) == 0 || inw == (char *)EOF) - break; - inw = ns(inw); - cp = get_word(inf); - if (cp == 0 || cp == (char *)EOF) - break; - inc = atoi(cp); - if (eq(inw, name)) { - oldcount = inc; - inc = count; - } - cp = get_word(inf); - if (cp == (char *)EOF) - break; - fl = (struct file_list *) malloc(sizeof *fl); - bzero(fl, sizeof(*fl)); - fl->f_fn = inw; /* malloced */ - fl->f_type = inc; - STAILQ_INSERT_HEAD(&fl_head, fl, f_next); - } - (void) fclose(inf); - if (count == oldcount) { - for (fl = STAILQ_FIRST(&fl_head); fl != NULL; fl = tflp) { - tflp = STAILQ_NEXT(fl, f_next); - free(fl->f_fn); - free(fl); - } - return 0; - } - if (oldcount == -1) { - fl = (struct file_list *) malloc(sizeof *fl); - bzero(fl, sizeof(*fl)); - fl->f_fn = ns(name); - fl->f_type = count; - STAILQ_INSERT_HEAD(&fl_head, fl, f_next); - } - outf = fopen(file, "w"); - if (outf == 0) - err(1, "%s", file); - for (fl = STAILQ_FIRST(&fl_head); fl != NULL; fl = tflp) { - fprintf(outf, - "#define %s %u\n", fl->f_fn, count ? fl->f_type : 0); - tflp = STAILQ_NEXT(fl, f_next); - free(fl->f_fn); - free(fl); - } - (void) fclose(outf); - return 0; -} - -/* - * convert a dev name to a .h file name - */ -static char * -toheader(char *dev) -{ - static char hbuf[MAXPATHLEN]; - - snprintf(hbuf, sizeof(hbuf), "%s.h", path(dev)); - return (hbuf); -} - -/* - * convert a dev name to a macro name - */ -static char * -tomacro(char *dev) -{ - static char mbuf[20]; - char *cp; - - cp = mbuf; - *cp++ = 'N'; - while (*dev) - *cp++ = islower(*dev) ? toupper(*dev++) : *dev++; - *cp++ = 0; - return (mbuf); -} diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index a95bee2..d4b2466 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -298,14 +298,14 @@ read_file(char *fname) struct opt *op; char *wd, *this, *needs, *compilewith, *depends, *clean, *warning; int nreqs, isdup, std, filetype, - imp_rule, no_obj, needcount, before_depend, mandatory, nowerror; + imp_rule, no_obj, before_depend, mandatory, nowerror; fp = fopen(fname, "r"); if (fp == 0) err(1, "%s", fname); next: /* - * filename [ standard | mandatory | optional | count ] + * filename [ standard | mandatory | optional ] * [ dev* | profiling-routine ] [ no-obj ] * [ compile-with "compile rule" [no-implicit-rule] ] * [ dependency "dependency-list"] [ before-depend ] @@ -345,7 +345,6 @@ next: std = mandatory = 0; imp_rule = 0; no_obj = 0; - needcount = 0; before_depend = 0; nowerror = 0; filetype = NORMAL; @@ -358,10 +357,8 @@ next: */ } else if (eq(wd, "mandatory")) { mandatory = 1; - } else if (eq(wd, "count")) { - needcount = 1; } else if (!eq(wd, "optional")) { - printf("%s: %s must be count, optional, mandatory or standard\n", + printf("%s: %s must be optional, mandatory or standard\n", fname, this); exit(1); } @@ -451,11 +448,8 @@ nextparam: if (isdup) goto invis; STAILQ_FOREACH(dp, &dtab, d_next) - if (eq(dp->d_name, wd)) { - if (std && dp->d_count <= 0) - dp->d_count = 1; + if (eq(dp->d_name, wd)) goto nextparam; - } if (mandatory) { printf("%s: mandatory device \"%s\" not found\n", fname, wd); @@ -483,8 +477,6 @@ invis: tp->f_type = INVISIBLE; tp->f_needs = needs; tp->f_flags |= isdup; - if (needcount) - tp->f_flags |= NEED_COUNT; tp->f_compilewith = compilewith; tp->f_depends = depends; tp->f_clean = clean; @@ -516,8 +508,6 @@ doneparam: tp->f_flags |= NO_OBJ; if (before_depend) tp->f_flags |= BEFORE_DEPEND; - if (needcount) - tp->f_flags |= NEED_COUNT; if (nowerror) tp->f_flags |= NOWERROR; tp->f_needs = needs; |