summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-06-10 22:13:40 +0000
committerpeter <peter@FreeBSD.org>2000-06-10 22:13:40 +0000
commit9fbe309befea3309aaa3b4ba51b0a98b67237143 (patch)
treed1d5b4de3ae6d63afdbed089889761df8d9c9f2c /usr.sbin/config
parent705b81c200d1314114fe9874115a22605e085a4c (diff)
downloadFreeBSD-src-9fbe309befea3309aaa3b4ba51b0a98b67237143.zip
FreeBSD-src-9fbe309befea3309aaa3b4ba51b0a98b67237143.tar.gz
A checkpoint of a part of a work-in-progress. Some more cleanups for
config(8). This commit allows control of the creation of the #include "foo.h" files. We now only create them explicitly when needed. BTW; these are mostly bad because they usually imply static limits on numbers of units for devices. eg: struct mysoftc sc[NFOO]; These static limits have Got To Go.
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/config.h4
-rw-r--r--usr.sbin/config/configvers.h2
-rw-r--r--usr.sbin/config/main.c3
-rw-r--r--usr.sbin/config/mkheaders.c54
-rw-r--r--usr.sbin/config/mkmakefile.c50
-rw-r--r--usr.sbin/config/mkoptions.c7
6 files changed, 52 insertions, 68 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
index 5d1ff48..41a00b1 100644
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -71,6 +71,8 @@ struct file_list {
#define NO_IMPLCT_RULE 2
#define NO_OBJ 4
#define BEFORE_DEPEND 8
+#define NEED_COUNT 16
+#define ISDUP 32
struct device {
int d_type; /* DEVICE, bus adaptor */
@@ -169,8 +171,6 @@ extern int debugging;
extern int maxusers;
-extern int old_config_present; /* Old config/build directory still there */
-
extern char *PREFIX; /* Config file name - for error messages */
extern char srcdir[]; /* root of the kernel source tree */
diff --git a/usr.sbin/config/configvers.h b/usr.sbin/config/configvers.h
index fad0cae..99226d9 100644
--- a/usr.sbin/config/configvers.h
+++ b/usr.sbin/config/configvers.h
@@ -8,4 +8,4 @@
*
* $FreeBSD$
*/
-#define CONFIGVERS 400018
+#define CONFIGVERS 500001
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index fa6fe9f..4a0748e 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -73,7 +73,6 @@ char destdir[MAXPATHLEN];
char srcdir[MAXPATHLEN];
static int no_config_clobber = TRUE;
-int old_config_present;
int debugging;
int profiling;
@@ -162,8 +161,6 @@ main(argc, argv)
if (mkdir(p, 0777))
err(2, "%s", p);
}
- else
- old_config_present = 1;
dtab = NULL;
if (yyparse())
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c
index 8bbcfbf..5ba6503 100644
--- a/usr.sbin/config/mkheaders.c
+++ b/usr.sbin/config/mkheaders.c
@@ -50,8 +50,8 @@ static const char rcsid[] =
#include "config.h"
#include "y.tab.h"
-static void do_header __P((char *, char *, int));
-static void do_count __P((char *, char *, int));
+static void do_header __P((char *, int));
+static void do_count __P((char *));
static char *toheader __P((char *));
static char *tomacro __P((char *));
@@ -61,9 +61,20 @@ headers()
register struct file_list *fl;
struct device *dp;
- for (fl = ftab; fl != 0; fl = fl->f_next)
- if (fl->f_needs != 0)
- do_count(fl->f_needs, fl->f_needs, 1);
+ for (fl = ftab; fl != 0; fl = fl->f_next) {
+ if (fl->f_needs != 0) {
+ for (dp = dtab; dp != 0; dp = dp->d_next) {
+ if (eq(dp->d_name, fl->f_needs)) {
+ if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE)
+ dp->d_type |= DEVDONE;
+ else if ((dp->d_type & TYPEMASK) == DEVICE)
+ dp->d_type |= DEVDONE;
+ }
+ }
+ if (fl->f_flags & NEED_COUNT)
+ do_count(fl->f_needs);
+ }
+ }
for (dp = dtab; dp != 0; dp = dp->d_next) {
if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) {
if (!(dp->d_type & DEVDONE))
@@ -83,27 +94,17 @@ headers()
* whatever the device is connected to
*/
static void
-do_count(dev, hname, search)
- register char *dev, *hname;
- int search;
+do_count(dev)
+ register char *dev;
{
register struct device *dp;
register int count, hicount;
- char *mp;
/*
* 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.
*/
- for (dp = dtab; dp != 0; dp = dp->d_next) {
- if (eq(dp->d_name, dev)) {
- if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE)
- dp->d_type |= DEVDONE;
- else if ((dp->d_type & TYPEMASK) == DEVICE)
- dp->d_type |= DEVDONE;
- }
- }
for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next) {
if (dp->d_unit != -1 && eq(dp->d_name, dev)) {
if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) {
@@ -119,25 +120,14 @@ do_count(dev, hname, search)
*/
if (dp->d_unit + 1 > hicount)
hicount = dp->d_unit + 1;
- if (search) {
- mp = dp->d_conn;
- if (mp != 0 && dp->d_connunit < 0)
- mp = 0;
- if (mp != 0 && eq(mp, "nexus"))
- mp = 0;
- if (mp != 0) {
- do_count(mp, hname, 0);
- search = 0;
- }
- }
}
}
- do_header(dev, hname, count > hicount ? count : hicount);
+ do_header(dev, count > hicount ? count : hicount);
}
static void
-do_header(dev, hname, count)
- char *dev, *hname;
+do_header(dev, count)
+ char *dev;
int count;
{
char *file, *name, *inw;
@@ -145,7 +135,7 @@ do_header(dev, hname, count)
FILE *inf, *outf;
int inc, oldcount;
- file = toheader(hname);
+ file = toheader(dev);
name = tomacro(dev);
inf = fopen(file, "r");
oldcount = -1;
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 0dc5d03..516b225 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -140,7 +140,6 @@ makefile()
FILE *ifp, *ofp;
char line[BUFSIZ];
struct opt *op;
- int warn_make_clean = 0;
int versreq;
read_files();
@@ -164,17 +163,6 @@ makefile()
printf("cpu type must be specified\n");
exit(1);
}
- for (op = opt; op; op = op->op_next) {
- if (!op->op_ownfile) {
- warn_make_clean++;
- if (op->op_value)
- fprintf(ofp, " -D%s=%s", op->op_name, op->op_value);
- else
- fprintf(ofp, " -D%s", op->op_name);
- printf("%s:%d: unknown option \"%s\"\n",
- PREFIX, op->op_line, op->op_name);
- }
- }
fprintf(ofp, "\n");
for (op = mkopt; op; op = op->op_next)
fprintf(ofp, "%s=%s\n", op->op_name, op->op_value);
@@ -228,14 +216,7 @@ makefile()
(void) fclose(ofp);
moveifchanged(path("Makefile.new"), path("Makefile"));
- if (warn_make_clean != 0 && old_config_present) {
- printf(
- "Unknown option%s used - it is VERY important that you do\n",
- (warn_make_clean > 1 ? "s" : ""));
- printf(" make clean && make depend\n");
- printf("before recompiling\n");
- } else
- printf("Don't forget to do a ``make depend''\n");
+ printf("Don't forget to do a ``make depend''\n");
}
/*
@@ -254,7 +235,7 @@ read_files()
char fname[80];
int ddwarned = 0;
int nreqs, first = 1, configdep, isdup, std, filetype,
- imp_rule, no_obj, before_depend, mandatory;
+ imp_rule, no_obj, needcount, before_depend, mandatory;
ftab = 0;
save_dp = NULL;
@@ -269,7 +250,8 @@ openit:
err(1, "%s", fname);
next:
/*
- * filename [ standard | mandatory | optional ] [ config-dependent ]
+ * filename [ standard | mandatory | optional | count]
+ * [ config-dependent ]
* [ dev* | profiling-routine ] [ no-obj ]
* [ compile-with "compile rule" [no-implicit-rule] ]
* [ dependency "dependency-list"] [ before-depend ]
@@ -312,7 +294,7 @@ next:
exit(1);
}
if ((pf = fl_lookup(this)) && (pf->f_type != INVISIBLE || pf->f_flags))
- isdup = 1;
+ isdup = ISDUP;
else
isdup = 0;
tp = 0;
@@ -335,19 +317,23 @@ next:
std = mandatory = 0;
imp_rule = 0;
no_obj = 0;
+ needcount = 0;
before_depend = 0;
filetype = NORMAL;
- if (eq(wd, "standard"))
+ if (eq(wd, "standard")) {
std = 1;
/*
* If an entry is marked "mandatory", config will abort if it's
* not called by a configuration line in the config file. Apart
* from this, the device is handled like one marked "optional".
*/
- else if (eq(wd, "mandatory"))
+ } else if (eq(wd, "mandatory")) {
mandatory = 1;
- else if (!eq(wd, "optional")) {
- printf("%s: %s must be optional, mandatory or standard\n",
+ needcount = 1;
+ } else if (eq(wd, "count")) {
+ needcount = 1;
+ } else if (!eq(wd, "optional")) {
+ printf("%s: %s must be count, optional, mandatory or standard\n",
fname, this);
exit(1);
}
@@ -478,7 +464,9 @@ invis:
tp->f_fn = this;
tp->f_type = INVISIBLE;
tp->f_needs = needs;
- tp->f_flags = isdup;
+ tp->f_flags |= isdup;
+ if (needcount)
+ tp->f_flags |= NEED_COUNT;
tp->f_special = special;
tp->f_depends = depends;
tp->f_clean = clean;
@@ -503,7 +491,7 @@ doneparam:
tp = new_fent();
tp->f_fn = this;
tp->f_type = filetype;
- tp->f_flags = 0;
+ tp->f_flags &= ~ISDUP;
if (configdep)
tp->f_flags |= CONFIGDEP;
if (imp_rule)
@@ -516,13 +504,15 @@ doneparam:
tp->f_flags |= NO_IMPLCT_RULE;
if (no_obj)
tp->f_flags |= NO_OBJ;
+ if (needcount)
+ tp->f_flags |= NEED_COUNT;
tp->f_needs = needs;
tp->f_special = special;
tp->f_depends = depends;
tp->f_clean = clean;
tp->f_warn = warn;
if (pf && pf->f_type == INVISIBLE)
- pf->f_flags = 1; /* mark as duplicate */
+ pf->f_flags |= ISDUP; /* mark as duplicate */
goto next;
}
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c
index d53affd..f663331 100644
--- a/usr.sbin/config/mkoptions.c
+++ b/usr.sbin/config/mkoptions.c
@@ -112,6 +112,13 @@ options()
read_options();
for (ol = otab; ol != 0; ol = ol->o_next)
do_option(ol->o_name);
+ for (op = opt; op; op = op->op_next) {
+ if (!op->op_ownfile) {
+ printf("%s:%d: unknown option \"%s\"\n",
+ PREFIX, op->op_line, op->op_name);
+ exit(1);
+ }
+ }
}
/*
OpenPOWER on IntegriCloud