summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-10-28 07:21:04 +0000
committerjoerg <joerg@FreeBSD.org>1997-10-28 07:21:04 +0000
commit5c37a12152dcd7c9ea69865faa6b23c106931489 (patch)
treea44cd0af96e0712bbfe1a65954e66e6030955cd9
parent5865a758bc78459ebe30511ab97dd81b2aa8597f (diff)
downloadFreeBSD-src-5c37a12152dcd7c9ea69865faa6b23c106931489.zip
FreeBSD-src-5c37a12152dcd7c9ea69865faa6b23c106931489.tar.gz
Allow for a keyword in the "files" file named "mandatory". The first
candidate for this is "npx0", more are likely to follow. Check for pseudo-devices that are being configured, but don't appear in any "files" file. The ``pseudo-device bpf 2'' already hit me too often.
-rw-r--r--usr.sbin/config/config.h2
-rw-r--r--usr.sbin/config/mkheaders.c12
-rw-r--r--usr.sbin/config/mkmakefile.c23
3 files changed, 31 insertions, 6 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
index 6c524f5..d72448d 100644
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -91,6 +91,8 @@ struct file_list {
#define SWAPSPEC 6
#define COMPDEVICE 7
#define COMPSPEC 8
+#define DEVDONE 0x80000000
+#define TYPEMASK 0x7fffffff
/*
* Attributes (flags).
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c
index c035e90..2e836e2 100644
--- a/usr.sbin/config/mkheaders.c
+++ b/usr.sbin/config/mkheaders.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: mkheaders.c,v 1.6 1997/09/15 06:37:09 charnier Exp $";
#endif /* not lint */
/*
@@ -59,10 +59,19 @@ void
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 (dp = dtab; dp != 0; dp = dp->d_next)
+ if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) {
+ if (!(dp->d_type & DEVDONE))
+ printf("Warning: pseudo-device \"%s\" is unknown\n",
+ dp->d_name);
+ else
+ dp->d_type &= TYPEMASK;
+ }
}
/*
@@ -87,6 +96,7 @@ do_count(dev, hname, search)
if (dp->d_type == PSEUDO_DEVICE) {
count =
dp->d_slave != UNKNOWN ? dp->d_slave : 1;
+ dp->d_type |= DEVDONE;
break;
}
count++;
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 852f86e..93674d2 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
- "$Id: mkmakefile.c,v 1.22 1997/09/15 06:37:09 charnier Exp $";
+ "$Id: mkmakefile.c,v 1.23 1997/10/22 00:38:48 peter Exp $";
#endif /* not lint */
/*
@@ -285,7 +285,7 @@ read_files()
char *wd, *this, *needs, *special, *depends, *clean;
char fname[80];
int nreqs, first = 1, configdep, isdup, std, filetype,
- imp_rule, no_obj, before_depend;
+ imp_rule, no_obj, before_depend, mandatory;
ftab = 0;
(void) snprintf(fname, sizeof fname, "../../conf/files");
@@ -299,7 +299,7 @@ openit:
}
next:
/*
- * filename [ standard | optional ] [ config-dependent ]
+ * filename [ standard | mandatory | optional ] [ config-dependent ]
* [ dev* | profiling-routine ] [ device-driver] [ no-obj ]
* [ compile-with "compile rule" [no-implicit-rule] ]
* [ dependency "dependency-list"] [ before-depend ]
@@ -354,15 +354,23 @@ next:
clean = 0;
configdep = 0;
needs = 0;
- std = 0;
+ std = mandatory = 0;
imp_rule = 0;
no_obj = 0;
before_depend = 0;
filetype = NORMAL;
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"))
+ mandatory = 1;
else if (!eq(wd, "optional")) {
- printf("%s: %s must be optional or standard\n", fname, this);
+ printf("%s: %s must be optional, mandatory or standard\n",
+ fname, this);
exit(1);
}
nextparam:
@@ -440,6 +448,11 @@ nextparam:
dp->d_slave = 1;
goto nextparam;
}
+ if (mandatory) {
+ printf("%s: mandatory device \"%s\" not found\n",
+ fname, wd);
+ exit(1);
+ }
if (std) {
dp = (struct device *) malloc(sizeof *dp);
bzero(dp, sizeof *dp);
OpenPOWER on IntegriCloud