summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-10-10 17:36:11 +0000
committerpeter <peter@FreeBSD.org>1999-10-10 17:36:11 +0000
commitb7ec6580100588b92f69bae020a3b2bbaace18fb (patch)
treebb10d6445ddc5eea5cabc6ce7646ef39d6fcfbaf /usr.sbin/config
parentfb060568cc5a18c0787a1cf16b8f628b07e3ef0b (diff)
downloadFreeBSD-src-b7ec6580100588b92f69bae020a3b2bbaace18fb.zip
FreeBSD-src-b7ec6580100588b92f69bae020a3b2bbaace18fb.tar.gz
Further cleanup. Also remove the following unused or defunct tokens:
and, bio, cam, master, minor, net, priority, sequential, size, slave, trace
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/Makefile2
-rw-r--r--usr.sbin/config/config.h5
-rw-r--r--usr.sbin/config/config.y79
-rw-r--r--usr.sbin/config/lang.l30
-rw-r--r--usr.sbin/config/main.c45
-rw-r--r--usr.sbin/config/mkheaders.c4
-rw-r--r--usr.sbin/config/mkioconf.c13
-rw-r--r--usr.sbin/config/mkmakefile.c24
-rw-r--r--usr.sbin/config/mkoptions.c11
9 files changed, 49 insertions, 164 deletions
diff --git a/usr.sbin/config/Makefile b/usr.sbin/config/Makefile
index da02260..cd47fc4 100644
--- a/usr.sbin/config/Makefile
+++ b/usr.sbin/config/Makefile
@@ -3,7 +3,7 @@
PROG= config
CFLAGS+=-I. -I${.CURDIR}
-#CFLAGS+=-Wall -Wunused -Wmissing-prototypes -Wredundant-decls
+CFLAGS+=-Wall -Wunused -Wmissing-prototypes -Wredundant-decls
SRCS= config.y main.c lang.l mkioconf.c mkmakefile.c mkheaders.c \
mkoptions.c y.tab.h
MAN8= config.8
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
index faa5b31..d1fdb3e 100644
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -31,6 +31,7 @@
* SUCH DAMAGE.
*
* @(#)config.h 8.1 (Berkeley) 6/6/93
+ * $FreeBSD$
*/
/*
@@ -81,6 +82,7 @@ struct device {
int d_target; /* target number */
int d_lun; /* unit number */
int d_slave; /* slave number */
+ int d_count; /* pseudo-device count */
#define QUES -1 /* -1 means '?' */
#define UNKNOWN -2 /* -2 means not set yet */
int d_dk; /* if init 1 set to number for iostat */
@@ -96,10 +98,8 @@ struct device {
struct device *d_next; /* Next one in list */
};
#define TO_NEXUS (struct device *)-1
-#define TO_VBA (struct device *)-2
struct config {
- char *c_dev;
char *s_sysname;
};
@@ -179,3 +179,4 @@ extern int old_config_present; /* Old config/build directory still there */
extern char *PREFIX; /* Config file name - for error messages */
#define eq(a,b) (!strcmp(a,b))
+#define ns(s) strdup(s)
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index d71d0fa..2a3d989 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -4,12 +4,9 @@
struct file_list *file;
}
-%token AND
%token ANY
%token AT
-%token BIO
%token BUS
-%token CAM
%token COMMA
%token CONFIG
%token CONFLICTS
@@ -27,24 +24,16 @@
%token IOSIZ
%token IRQ
%token MACHINE
-%token MASTER
%token MAXUSERS
-%token MINOR
%token MINUS
-%token NET
%token NEXUS
%token OPTIONS
%token MAKEOPTIONS
%token PORT
-%token PRIORITY
%token PSEUDO_DEVICE
%token SEMICOLON
-%token SEQUENTIAL
-%token SIZE
-%token SLAVE
%token TARGET
%token TTY
-%token TRACE
%token UNIT
%token VECTOR
@@ -111,7 +100,6 @@ int yyline;
struct file_list *ftab;
char errbuf[80];
int maxusers;
-int do_trace;
int seen_scbus;
@@ -139,8 +127,6 @@ Spec:
= { newdev(&cur); } |
Config_spec SEMICOLON
|
- TRACE SEMICOLON
- = { do_trace = !do_trace; } |
SEMICOLON
|
error SEMICOLON
@@ -320,13 +306,11 @@ Dev:
;
Device_spec:
- DEVICE Dev_name Dev_info Int_spec
+ DEVICE Dev_name Dev_info
= { cur.d_type = DEVICE; } |
- MASTER Dev_name Dev_info Int_spec
- = { cur.d_type = MASTER; } |
- DISK Dev_name Dev_info Int_spec
+ DISK Dev_name Dev_info
= { cur.d_dk = 1; cur.d_type = DEVICE; } |
- CONTROLLER Dev_name Dev_info Int_spec
+ CONTROLLER Dev_name Dev_info
= { cur.d_type = CONTROLLER; } |
PSEUDO_DEVICE Init_dev Dev
= {
@@ -337,7 +321,7 @@ Device_spec:
= {
cur.d_name = $3;
cur.d_type = PSEUDO_DEVICE;
- cur.d_slave = $4;
+ cur.d_count = $4;
} ;
Dev_name:
@@ -370,7 +354,7 @@ Con_info:
cur.d_conn = connect($2, $3);
} |
AT NEXUS NUMBER
- = { check_nexus(&cur, $3); cur.d_conn = TO_NEXUS; };
+ = { cur.d_conn = TO_NEXUS; };
Info_list:
Info_list Info
@@ -379,7 +363,7 @@ Info_list:
;
Info:
- BUS NUMBER
+ BUS NUMBER /* controller scbus1 at ahc0 bus 1 - twin channel */
= {
if (cur.d_conn != 0 && cur.d_conn->d_type == CONTROLLER)
cur.d_slave = $2;
@@ -393,14 +377,6 @@ Info:
= { cur.d_lun = $2; } |
DRIVE NUMBER
= { cur.d_drive = $2; } |
- SLAVE NUMBER
- = {
- if (cur.d_conn != 0 && cur.d_conn != TO_NEXUS &&
- cur.d_conn->d_type == MASTER)
- cur.d_slave = $2;
- else
- yyerror("can't specify slave--not to master");
- } |
IRQ NUMBER
= { cur.d_irq = $2; } |
DRQ NUMBER
@@ -413,14 +389,6 @@ Info:
= { cur.d_port = $2; } |
PORT NUMBER
= { cur.d_portn = $2; } |
- TTY
- = { yyerror("`tty' interrupt label obsolete"); } |
- BIO
- = { yyerror("`bio' interrupt label obsolete"); } |
- CAM
- = { yyerror("`cam' interrupt label obsolete"); } |
- NET
- = { yyerror("`net' interrupt label obsolete"); } |
FLAGS NUMBER
= { cur.d_flags = $2; } |
DISABLE
@@ -428,14 +396,6 @@ Info:
CONFLICTS
= { cur.d_conflicts = 1; };
-Int_spec:
- VECTOR ID
- = { yyerror("`vector xxxintr' interrupt vector obsolete"); } |
- PRIORITY NUMBER
- = { yyerror("`priority nnn' interrupt priority obsolete"); } |
- /* lambda */
- ;
-
%%
static void
@@ -492,7 +452,7 @@ connect(dev, num)
for (dp = dtab; dp != 0; dp = dp->d_next) {
if ((num != dp->d_unit) || !eq(dev, dp->d_name))
continue;
- if (dp->d_type != CONTROLLER && dp->d_type != MASTER) {
+ if (dp->d_type != CONTROLLER) {
(void) snprintf(errbuf, sizeof(errbuf),
"%s connected to non-controller", dev);
yyerror(errbuf);
@@ -577,7 +537,8 @@ init_dev(dp)
dp->d_conflicts = 0;
dp->d_disabled = 0;
dp->d_flags = dp->d_dk = 0;
- dp->d_slave = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = UNKNOWN;
+ dp->d_slave = dp->d_lun = dp->d_target = dp->d_drive = dp->d_unit = \
+ dp->d_count = UNKNOWN;
dp->d_port = (char *)0;
dp->d_portn = -1;
dp->d_irq = -1;
@@ -585,25 +546,3 @@ init_dev(dp)
dp->d_maddr = 0;
dp->d_msize = 0;
}
-
-/*
- * make certain that this is a reasonable type of thing to connect to a nexus
- */
-static void
-check_nexus(dev, num)
- register struct device *dev;
- int num;
-{
-
- switch (machine) {
-
- case MACHINE_I386:
- case MACHINE_PC98:
-#if 0
- if (!eq(dev->d_name, "isa"))
- yyerror("only isa's should be connected to the nexus");
-#endif
- break;
-
- }
-}
diff --git a/usr.sbin/config/lang.l b/usr.sbin/config/lang.l
index 1bc0704..fe685ec 100644
--- a/usr.sbin/config/lang.l
+++ b/usr.sbin/config/lang.l
@@ -42,8 +42,6 @@
#define YY_NO_UNPUT
-#define tprintf if (do_trace) printf
-
/*
* Key word table
*/
@@ -52,11 +50,8 @@ struct kt {
char *kt_name;
int kt_val;
} key_words[] = {
- { "and", AND },
{ "at", AT },
- { "bio", BIO }, /* XXX going away */
{ "bus", BUS },
- { "cam", CAM }, /* XXX going away */
{ "conflicts", CONFLICTS },
{ "config", CONFIG },
{ "controller", CONTROLLER },
@@ -73,25 +68,14 @@ struct kt {
{ "irq", IRQ },
{ "machine", MACHINE },
{ "makeoptions", MAKEOPTIONS },
- { "master", MASTER },
{ "maxusers", MAXUSERS },
- { "minor", MINOR },
- { "net", NET }, /* XXX going away */
{ "nexus", NEXUS },
{ "option", OPTIONS },
{ "options", OPTIONS },
{ "port", PORT },
- { "priority", PRIORITY },
{ "pseudo-device",PSEUDO_DEVICE },
- { "sequential", SEQUENTIAL },
- { "size", SIZE },
- { "slave", SLAVE },
- { "tape", DEVICE },
{ "target", TARGET },
- { "tty", TTY }, /* XXX going away */
- { "trace", TRACE },
{ "unit", UNIT },
- { "vector", VECTOR },
{ 0, 0 },
};
@@ -112,10 +96,8 @@ ID [A-Za-z_][-A-Za-z_0-9]*
if ((i = kw_lookup(yytext)) == -1)
{
yylval.str = strdup(yytext);
- tprintf("id(%s) ", yytext);
return ID;
}
- tprintf("(%s) ", yytext);
return i;
}
<INITIAL>{WORD}/[0-9]* {
@@ -126,13 +108,11 @@ ID [A-Za-z_][-A-Za-z_0-9]*
if (i == CONTROLLER || i == DEVICE || i == DISK ||
i == PSEUDO_DEVICE || i == AT)
BEGIN NONUM;
- tprintf("(%s) ", yytext);
return i;
}
<INITIAL>{ID} {
BEGIN 0;
yylval.str = strdup(yytext);
- tprintf("id(%s) ", yytext);
return ID;
}
\\\"[^"]+\\\" {
@@ -140,54 +120,44 @@ ID [A-Za-z_][-A-Za-z_0-9]*
yytext[yyleng-2] = '"';
yytext[yyleng-1] = '\0';
yylval.str = strdup(yytext + 1);
- tprintf("id(%s) ", yytext+1);
return ID;
}
\"[^"]+\" {
BEGIN 0;
yytext[yyleng-1] = '\0';
yylval.str = strdup(yytext + 1);
- tprintf("id(%s) ", yytext+1);
return ID;
}
<TOEOL>[^# \t\n]* {
BEGIN 0;
yylval.str = strdup(yytext);
- tprintf("id(%s) ", yytext);
return ID;
}
0[0-7]* {
yylval.val = octal(yytext);
- tprintf("#O:%o ", yylval.val);
return NUMBER;
}
0x[0-9a-fA-F]+ {
yylval.val = hex(yytext);
- tprintf("#X:%x ", yylval.val);
return NUMBER;
}
-?[1-9][0-9]* {
yylval.val = atoi(yytext);
- tprintf("#D:%d ", yylval.val);
return NUMBER;
}
[0-9]"."[0-9]* {
yylval.val = (int) (60 * atof(yytext) + 0.5);
- tprintf("#F:%d ", yylval.val);
return FPNUMBER;
}
"?" {
yylval.val = -1;
- tprintf("? ");
return NUMBER;
}
\n/[ \t] {
yyline++;
- tprintf("\n... ");
}
\n {
yyline++;
- tprintf("\n");
return SEMICOLON;
}
#.* { /* Ignored (comment) */; }
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 450b307..7c74a7f 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -321,30 +321,30 @@ configfile()
char *p;
int i;
- fi = fopen(PREFIX,"r");
- if(!fi)
+ fi = fopen(PREFIX, "r");
+ if (!fi)
err(2, "%s", PREFIX);
- fo = fopen(p=path("config.c.new"),"w");
- if(!fo)
+ fo = fopen(p=path("config.c.new"), "w");
+ if (!fo)
err(2, "%s", p);
- fprintf(fo,"#include \"opt_config.h\"\n");
- fprintf(fo,"#ifdef INCLUDE_CONFIG_FILE \n");
- fprintf(fo,"static const char config[] = \"\\\n");
- fprintf(fo,"START CONFIG FILE %s\\n\\\n___",PREFIX);
+ fprintf(fo, "#include \"opt_config.h\"\n");
+ fprintf(fo, "#ifdef INCLUDE_CONFIG_FILE \n");
+ fprintf(fo, "static const char config[] = \"\\\n");
+ fprintf(fo, "START CONFIG FILE %s\\n\\\n___", PREFIX);
while (EOF != (i=getc(fi))) {
- if(i == '\n') {
- fprintf(fo,"\\n\\\n___");
- } else if(i == '\"') {
- fprintf(fo,"\\\"");
- } else if(i == '\\') {
- fprintf(fo,"\\\\");
+ if (i == '\n') {
+ fprintf(fo, "\\n\\\n___");
+ } else if (i == '\"') {
+ fprintf(fo, "\\\"");
+ } else if (i == '\\') {
+ fprintf(fo, "\\\\");
} else {
- putc(i,fo);
+ putc(i, fo);
}
}
- fprintf(fo,"\\n\\\nEND CONFIG FILE %s\\n\\\n",PREFIX);
- fprintf(fo,"\";\n");
- fprintf(fo,"\n#endif /* INCLUDE_CONFIG_FILE */\n");
+ fprintf(fo, "\\n\\\nEND CONFIG FILE %s\\n\\\n", PREFIX);
+ fprintf(fo, "\";\n");
+ fprintf(fo, "\n#endif /* INCLUDE_CONFIG_FILE */\n");
fclose(fi);
fclose(fo);
moveifchanged(path("config.c.new"), path("config.c"));
@@ -404,13 +404,4 @@ moveifchanged(const char *from_name, const char *to_name)
if (unlink(from_name) < 0)
err(EX_OSERR, "unlink(%s)", from_name);
}
-
-#ifdef DIAG
- if (changed)
- printf("CHANGED! rename (%s, %s)\n", from_name, to_name);
- else
- printf("SAME! unlink (%s)\n", from_name);
-#endif
-
- return;
}
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c
index 0c92550..2d98583 100644
--- a/usr.sbin/config/mkheaders.c
+++ b/usr.sbin/config/mkheaders.c
@@ -50,8 +50,6 @@ static const char rcsid[] =
#include "config.h"
#include "y.tab.h"
-#define ns(s) strdup(s)
-
static void do_header __P((char *, char *, int));
static void do_count __P((char *, char *, int));
static char *toheader __P((char *));
@@ -105,7 +103,7 @@ do_count(dev, hname, search)
if (dp->d_unit != -1 && eq(dp->d_name, dev)) {
if ((dp->d_type & TYPEMASK) == PSEUDO_DEVICE) {
count =
- dp->d_slave != UNKNOWN ? dp->d_slave : 1;
+ dp->d_count != UNKNOWN ? dp->d_count : 1;
dp->d_type |= DEVDONE;
break;
}
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c
index cf79ce5..c5c6377 100644
--- a/usr.sbin/config/mkioconf.c
+++ b/usr.sbin/config/mkioconf.c
@@ -135,8 +135,7 @@ write_all_device_resources(FILE *fp)
struct device *dp;
for (dp = dtab; dp != 0; dp = dp->d_next) {
- if (dp->d_type != CONTROLLER && dp->d_type != MASTER
- && dp->d_type != DEVICE)
+ if (dp->d_type != CONTROLLER && dp->d_type != DEVICE)
continue;
write_device_resources(fp, dp);
}
@@ -154,8 +153,7 @@ write_devtab(FILE *fp)
fprintf(fp, "struct config_device config_devtab[] = {\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
char* n = devstr(dp);
- if (dp->d_type != CONTROLLER && dp->d_type != MASTER
- && dp->d_type != DEVICE)
+ if (dp->d_type != CONTROLLER && dp->d_type != DEVICE)
continue;
fprintf(fp, "\t{ \"%s\",\t%d,\t%s_count,\t%s_resources },\n",
dp->d_name, dp->d_unit, n, n);
@@ -260,7 +258,7 @@ scbus_devtab(fp)
for (dp = dtab; dp; dp = dp->d_next) {
mp = dp->d_conn;
if (dp->d_type != CONTROLLER || mp == TO_NEXUS || mp == 0 ||
- !eq(dp->d_name, "scbus")) {
+ !eq(dp->d_name, "scbus")) {
continue;
}
fprintf(fp, "{ %s, ", id(dp->d_unit));
@@ -277,9 +275,8 @@ scbus_devtab(fp)
fprintf(fp,
"/* periph name, periph unit, pathid, target, LUN, flags */\n");
for (dp = dtab; dp; dp = dp->d_next) {
- if (dp->d_type == CONTROLLER || dp->d_type == MASTER ||
- dp->d_type == PSEUDO_DEVICE
- || dp->d_conn == TO_NEXUS)
+ if (dp->d_type == CONTROLLER || dp->d_type == PSEUDO_DEVICE ||
+ dp->d_conn == TO_NEXUS)
continue;
mp = dp->d_conn;
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 7536241..1b80772 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -68,8 +68,6 @@ static const char rcsid[] =
wd = word; \
}
-#define ns(s) strdup(s)
-
static struct file_list *fcur;
static char *tail __P((char *));
@@ -260,7 +258,7 @@ openit:
fp = fopen(fname, "r");
if (fp == 0)
err(1, "%s", fname);
- if(ident == NULL) {
+ if (ident == NULL) {
printf("no ident line specified\n");
exit(1);
}
@@ -291,13 +289,10 @@ next:
}
if (wd == 0)
goto next;
- /*************************************************\
- * If it's a comment ignore to the end of the line *
- \*************************************************/
- if(wd[0] == '#')
+ if (wd[0] == '#')
{
- while( ((wd = get_word(fp)) != (char *)EOF) && wd)
- ;
+ while (((wd = get_word(fp)) != (char *)EOF) && wd)
+ ;
goto next;
}
this = ns(wd);
@@ -422,8 +417,8 @@ nextparam:
for (dp = dtab; dp != 0; save_dp = dp, dp = dp->d_next)
if (eq(dp->d_name, wd)) {
if (std && dp->d_type == PSEUDO_DEVICE &&
- dp->d_slave <= 0)
- dp->d_slave = 1;
+ dp->d_count <= 0)
+ dp->d_count = 1;
goto nextparam;
}
if (mandatory) {
@@ -437,7 +432,7 @@ nextparam:
init_dev(dp);
dp->d_name = ns(wd);
dp->d_type = PSEUDO_DEVICE;
- dp->d_slave = 1;
+ dp->d_count = 1;
save_dp->d_next = dp;
goto nextparam;
}
@@ -690,9 +685,9 @@ do_rules(f)
och = *cp;
if (ftp->f_flags & NO_IMPLCT_RULE) {
if (ftp->f_depends)
- fprintf(f, "%s: %s\n", np, ftp->f_depends );
+ fprintf(f, "%s: %s\n", np, ftp->f_depends);
else
- fprintf(f, "%s: \n", np );
+ fprintf(f, "%s: \n", np);
}
else {
*cp = '\0';
@@ -775,4 +770,3 @@ raisestr(str)
}
return (cp);
}
-
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c
index f413a7b..89af213 100644
--- a/usr.sbin/config/mkoptions.c
+++ b/usr.sbin/config/mkoptions.c
@@ -51,8 +51,6 @@ static const char rcsid[] =
#include "config.h"
#include "y.tab.h"
-#define ns(s) strdup(s)
-
static struct users {
int u_default;
int u_min;
@@ -298,7 +296,7 @@ openit:
if (fp == 0) {
return;
}
- if(ident == NULL) {
+ if (ident == NULL) {
printf("no ident line specified\n");
exit(1);
}
@@ -322,12 +320,9 @@ next:
}
if (wd == 0)
goto next;
- /*************************************************\
- * If it's a comment ignore to the end of the line *
- \*************************************************/
- if(wd[0] == '#')
+ if (wd[0] == '#')
{
- while( ((wd = get_word(fp)) != (char *)EOF) && wd)
+ while (((wd = get_word(fp)) != (char *)EOF) && wd)
;
goto next;
}
OpenPOWER on IntegriCloud