Further cleanups. i386_ioconf.c and alpha_ioconf.c were essentially the

same and were merged into a single newbus_ioconf.c.  CG'd some more unused
code.
This commit is contained in:
Peter Wemm 1999-04-18 13:36:29 +00:00
parent 8c1cc362b8
commit e6fbbbe459
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45775
9 changed files with 56 additions and 148 deletions

View File

@ -1,8 +1,9 @@
# @(#)Makefile 8.1 (Berkeley) 6/6/93
# $Id: Makefile,v 1.21 1999/04/13 18:22:57 peter Exp $
# $Id: Makefile,v 1.22 1999/04/17 14:41:40 peter Exp $
PROG= config
CFLAGS+=-I. -I${.CURDIR}
#CFLAGS+=-Wall -Wunused -Wmissing-prototypes -Wredundant-decls
SRCS= config.y main.c lang.l mkioconf.c mkmakefile.c mkheaders.c \
mkoptions.c mkswapconf.c y.tab.h
MAN8= config.8

View File

@ -147,8 +147,8 @@ struct config {
/*
* Config has a global notion of which machine type is
* being used. It uses the name of the machine in choosing
* files and directories. Thus if the name of the machine is ``vax'',
* it will build from ``Makefile.vax'' and use ``../vax/inline''
* files and directories. Thus if the name of the machine is ``i386'',
* it will build from ``Makefile.i386'' and use ``../i386/inline''
* in the makerules, etc.
*/
int machine;
@ -188,23 +188,24 @@ struct opt_list {
extern char *ident;
extern int do_trace;
char *ns();
char *tc();
char *get_word();
char *get_quoted_word();
char *path();
char *raisestr();
void moveifchanged();
dev_t nametodev();
char *devtoname();
char *get_word __P((FILE *));
char *get_quoted_word __P((FILE *));
char *path __P((char *));
char *raisestr __P((char *));
void moveifchanged __P((const char *, const char *));
dev_t nametodev __P((char *, int, int, char));
char *devtoname __P((dev_t));
void init_dev __P((struct device *));
void newbus_ioconf __P((void));
int yyparse __P((void));
int yylex __P((void));
void options __P((void));
void makefile __P((void));
void headers __P((void));
void swapconf __P((void));
#if MACHINE_I386
extern int seen_isa;
extern int seen_scbus;
#endif
extern struct device *dtab;
extern char errbuf[80];

View File

@ -12,7 +12,6 @@
%token BIO
%token BUS
%token CAM
%token HA
%token COMMA
%token CONFIG
%token CONFLICTS
@ -113,8 +112,6 @@
* @(#)config.y 8.1 (Berkeley) 6/6/93
*/
#include "config.h"
#include <sys/disklabel.h>
#include <sys/diskslice.h>
@ -123,6 +120,8 @@
#include <stdio.h>
#include <string.h>
#include "config.h"
static struct device cur;
static struct device *curp = 0;
@ -134,10 +133,7 @@ char errbuf[80];
int maxusers;
int do_trace;
#if MACHINE_I386
int seen_isa;
int seen_scbus;
#endif
#define ns(s) strdup(s)
@ -148,6 +144,8 @@ static void verifycomp __P((struct file_list *));
static struct device *connect __P((char *, int));
static struct device *huhcon __P((char *));
static dev_t *verifyswap __P((struct file_list *, dev_t *, dev_t *));
static void yyerror __P((char *s));
%}
%%
@ -550,9 +548,7 @@ Dev_name:
Init_dev Dev NUMBER
= {
cur.d_name = $2;
if (eq($2, "isa"))
seen_isa = 1;
else if (eq($2, "scbus"))
if (eq($2, "scbus"))
seen_scbus = 1;
cur.d_unit = $3;
};
@ -629,8 +625,6 @@ Info:
= { cur.d_mask = "bio"; } |
CAM
= { cur.d_mask = "cam"; } |
HA
= { cur.d_mask = "ha"; } |
NET
= { cur.d_mask = "net"; } |
FLAGS NUMBER
@ -664,7 +658,7 @@ Id_list:
%%
void
static void
yyerror(s)
char *s;
{

View File

@ -39,6 +39,8 @@
#include "y.tab.h"
#include "config.h"
#define YY_NO_UNPUT
#define tprintf if (do_trace) printf
/*
@ -52,52 +54,37 @@ struct kt {
{ "and", AND },
{ "args", ARGS },
{ "at", AT },
#if MACHINE_I386
{ "bio", BIO },
{ "bus", BUS },
{ "cam", CAM },
{ "bio", BIO }, /* XXX going away */
{ "bus", BUS }, /* XXX going away */
{ "cam", CAM }, /* XXX going away */
{ "conflicts", CONFLICTS },
#endif
{ "config", CONFIG },
{ "controller", CONTROLLER },
{ "cpu", CPU },
{ "csr", CSR },
{ "device", DEVICE },
#if MACHINE_I386
{ "disable", DISABLE },
#endif
{ "disk", DISK },
{ "drive", DRIVE },
#if MACHINE_I386
{ "drq", DRQ },
#endif
{ "dumps", DUMPS },
{ "flags", FLAGS },
#if MACHINE_I386
{ "ha", HA },
#endif
{ "ident", IDENT },
{ "interleave", INTERLEAVE },
#if MACHINE_I386
{ "iomem", IOMEM },
{ "iosiz", IOSIZ },
{ "irq", IRQ },
#endif
{ "machine", MACHINE },
{ "major", MAJOR },
{ "makeoptions", MAKEOPTIONS },
{ "master", MASTER },
{ "maxusers", MAXUSERS },
{ "minor", MINOR },
#if MACHINE_I386
{ "net", NET },
#endif
{ "net", NET }, /* XXX going away */
{ "nexus", NEXUS },
{ "on", ON },
{ "options", OPTIONS },
#if MACHINE_I386
{ "port", PORT },
#endif
{ "priority", PRIORITY },
{ "pseudo-device",PSEUDO_DEVICE },
{ "root", ROOT },
@ -107,9 +94,7 @@ struct kt {
{ "swap", SWAP },
{ "tape", DEVICE },
{ "target", TARGET },
#if MACHINE_I386
{ "tty", TTY },
#endif
{ "tty", TTY }, /* XXX going away */
{ "trace", TRACE },
{ "unit", UNIT },
{ "vector", VECTOR },
@ -163,7 +148,6 @@ WORD [A-Za-z_][-A-Za-z_]*
return NUMBER;
}
[0-9]"."[0-9]* {
double atof();
yylval.val = (int) (60 * atof(yytext) + 0.5);
return FPNUMBER;
}

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: main.c,v 1.29 1999/04/11 03:40:10 grog Exp $";
"$Id: main.c,v 1.30 1999/04/17 14:41:40 peter Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -153,15 +153,12 @@ main(argc, argv)
case MACHINE_I386:
case MACHINE_PC98:
i386_ioconf(); /* Print ioconf.c */
break;
case MACHINE_ALPHA:
alpha_ioconf();
newbus_ioconf(); /* Print ioconf.c */
break;
default:
printf("Specify machine type, e.g. ``machine vax''\n");
printf("Specify machine type, e.g. ``machine i386''\n");
exit(1);
}
/*
@ -216,13 +213,14 @@ get_word(fp)
escaped_nl = 1;
goto begin;
}
if (ch == '\n')
if (ch == '\n') {
if (escaped_nl){
escaped_nl = 0;
goto begin;
}
else
return (NULL);
}
cp = line;
*cp++ = ch;
while ((ch = getc(fp)) != EOF) {
@ -261,13 +259,14 @@ get_quoted_word(fp)
escaped_nl = 1;
goto begin;
}
if (ch == '\n')
if (ch == '\n') {
if (escaped_nl){
escaped_nl = 0;
goto begin;
}
else
return (NULL);
}
cp = line;
if (ch == '"' || ch == '\'') {
register int quote = ch;

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkioconf.c 8.2 (Berkeley) 1/21/94";
#endif
static const char rcsid[] =
"$Id: mkioconf.c,v 1.49 1999/04/16 21:28:10 peter Exp $";
"$Id: mkioconf.c,v 1.50 1999/04/17 14:41:40 peter Exp $";
#endif /* not lint */
#include <err.h>
@ -47,12 +47,9 @@ static const char rcsid[] =
/*
* build the ioconf.c file
*/
static char *qu();
static char *intv();
static char *wnum();
void scbus_devtab __P((FILE *, int *));
void i386_ioconf __P((void));
void alpha_ioconf __P((void));
static char *qu __P((int));
static char *wnum __P((int));
static void scbus_devtab __P((FILE *));
static char *
devstr(struct device *dp)
@ -168,17 +165,10 @@ write_devtab(FILE *fp)
fprintf(fp, "int devtab_count = %d;\n", count);
}
#if MACHINE_I386
static char *sirq();
void
i386_ioconf()
newbus_ioconf()
{
register struct device *dp, *mp;
int dev_id;
FILE *fp;
static char *old_d_name;
int count;
fp = fopen(path("ioconf.c.new"), "w");
if (fp == 0)
@ -189,11 +179,9 @@ i386_ioconf()
fprintf(fp, " */\n");
fprintf(fp, "\n");
fprintf(fp, "#include <sys/param.h>\n");
fprintf(fp, "\n");
fprintf(fp, "#define C (caddr_t)\n");
if (seen_scbus)
scbus_devtab(fp, &dev_id);
scbus_devtab(fp);
fprintf(fp, "\n");
fprintf(fp, "/*\n");
@ -246,10 +234,9 @@ id_put(fp, unit, s)
* All that nice "conflicting SCSI ID checking" is now
* lost and should be put back in.
*/
void
scbus_devtab(fp, dev_idp)
static void
scbus_devtab(fp)
FILE *fp;
int *dev_idp;
{
register struct device *dp, *mp;
@ -320,67 +307,9 @@ scbus_devtab(fp, dev_idp)
fprintf(fp, "};\n");
}
/*
* XXX - there should be a general function to print devtabs instead of these
* little pieces of it.
*/
static char *
sirq(num)
{
if (num == -1)
return ("0");
sprintf(errbuf, "IRQ%d", num);
return (errbuf);
}
#endif
#if MACHINE_ALPHA
void
alpha_ioconf()
{
register struct device *dp, *mp;
FILE *fp;
int dev_id = 10;
int count;
fp = fopen(path("ioconf.c.new"), "w");
if (fp == 0)
err(1, "%s", path("ioconf.c"));
fprintf(fp, "#include <sys/types.h>\n");
fprintf(fp, "#include <sys/time.h>\n");
fprintf(fp, "#include <sys/queue.h>\n\n");
fprintf(fp, "#include <sys/sysctl.h>\n");
fprintf(fp, "#include <sys/bus_private.h>\n");
fprintf(fp, "#include <isa/isareg.h>\n\n");
fprintf(fp, "#define C (char *)\n\n");
write_devtab(fp);
if (seen_scbus)
scbus_devtab(fp, &dev_id);
(void) fclose(fp);
moveifchanged(path("ioconf.c.new"), path("ioconf.c"));
}
#endif
static char *
intv(dev)
register struct device *dev;
{
static char buf[20];
if (dev->d_vec == 0)
return (" 0");
(void) sprintf(buf, "%sint%d", dev->d_name, dev->d_unit);
return (buf);
}
static char *
qu(num)
int num;
{
if (num == QUES)
@ -393,6 +322,7 @@ qu(num)
static char *
wnum(num)
int num;
{
if (num == QUES || num == UNKNOWN)

View File

@ -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.37 1999/04/13 18:22:57 peter Exp $";
"$Id: mkmakefile.c,v 1.38 1999/04/17 14:41:40 peter Exp $";
#endif /* not lint */
/*
@ -71,7 +71,6 @@ static const char rcsid[] =
#define ns(s) strdup(s)
static struct file_list *fcur;
extern int old_config_present;
static char *tail __P((char *));
static void do_swapspec __P((FILE *, char *));
@ -86,7 +85,6 @@ static void do_before_depend __P((FILE *));
static struct file_list *do_systemspec __P((FILE *, struct file_list *, int));
static int opteq __P((char *, char *));
static void read_files __P((void));
void makefile __P((void));
/*
* Lookup a file, by name.
@ -263,6 +261,7 @@ read_files()
imp_rule, no_obj, before_depend, mandatory;
ftab = 0;
save_dp = NULL;
(void) snprintf(fname, sizeof fname, "../../conf/files");
openit:
fp = fopen(fname, "r");
@ -475,7 +474,6 @@ read_files()
exit(1);
}
save:
if (wd) {
printf("%s: syntax error describing %s\n",
fname, this);
@ -742,7 +740,7 @@ do_rules(f)
tp = tail(np);
special = ftp->f_special;
if (special == 0) {
char *ftype;
char *ftype = NULL;
static char cmd[128];
switch (ftp->f_type) {

View File

@ -37,7 +37,7 @@
static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: mkoptions.c,v 1.8 1998/07/12 08:10:33 bde Exp $";
"$Id: mkoptions.c,v 1.9 1999/04/17 14:41:40 peter Exp $";
#endif /* not lint */
/*
@ -89,7 +89,7 @@ options()
/* Initialize `maxusers'. */
if ((unsigned)machine > NUSERS) {
printf("maxusers config info isn't present, using vax\n");
printf("maxusers config info isn't present, using i386\n");
up = &users[MACHINE_I386 - 1];
} else
up = &users[machine - 1];

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkswapconf.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id: mkswapconf.c,v 1.16 1999/04/15 14:52:22 bde Exp $";
"$Id: mkswapconf.c,v 1.17 1999/04/17 14:41:40 peter Exp $";
#endif /* not lint */
/*
@ -44,7 +44,6 @@ static const char rcsid[] =
*/
#include <err.h>
#include <unistd.h>
#include "config.h"
#include <sys/disklabel.h>
#include <sys/diskslice.h>
@ -53,6 +52,8 @@ static const char rcsid[] =
#include <stdio.h>
#include <string.h>
#include "config.h"
#define ns(s) strdup(s)
static void initdevtable __P((void));