summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-09-19 16:37:34 +0000
committerbde <bde@FreeBSD.org>1995-09-19 16:37:34 +0000
commit85bf2e6eb15393415f53809c3cf9ff8a133490e1 (patch)
tree2c9f22bbc89f0656b59a3ad92c27289c641678b9 /usr.sbin/config
parent793697b948d2a75f36609f4077f1c182ce7c35a5 (diff)
downloadFreeBSD-src-85bf2e6eb15393415f53809c3cf9ff8a133490e1.zip
FreeBSD-src-85bf2e6eb15393415f53809c3cf9ff8a133490e1.tar.gz
Put declarations in a header file ("ioconf.h")
Generate prototypes for SCSI functions and function pointers. Fix redundant declarations of interrupt handlers. Generate 4.4-style includes (<> instead of ""). Clean up formatting of both the source and the output a bit.
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/mkioconf.c185
1 files changed, 113 insertions, 72 deletions
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c
index d180203..e1b7564 100644
--- a/usr.sbin/config/mkioconf.c
+++ b/usr.sbin/config/mkioconf.c
@@ -59,12 +59,12 @@ vax_ioconf()
perror(path("ioconf.c"));
exit(1);
}
- fprintf(fp, "#include \"vax/include/pte.h\"\n");
- fprintf(fp, "#include \"sys/param.h\"\n");
- fprintf(fp, "#include \"sys/buf.h\"\n");
+ fprintf(fp, "#include <vax/include/pte.h>\n");
+ fprintf(fp, "#include <sys/param.h>\n");
+ fprintf(fp, "#include <sys/buf.h>\n");
fprintf(fp, "\n");
- fprintf(fp, "#include \"vax/mba/mbavar.h\"\n");
- fprintf(fp, "#include \"vax/uba/ubavar.h\"\n\n");
+ fprintf(fp, "#include <vax/mba/mbavar.h>\n");
+ fprintf(fp, "#include <vax/uba/ubavar.h>\n\n");
fprintf(fp, "\n");
fprintf(fp, "#define C (caddr_t)\n\n");
/*
@@ -302,11 +302,11 @@ tahoe_ioconf()
perror(path("ioconf.c"));
exit(1);
}
- fprintf(fp, "#include \"sys/param.h\"\n");
- fprintf(fp, "#include \"tahoe/include/pte.h\"\n");
- fprintf(fp, "#include \"sys/buf.h\"\n");
+ fprintf(fp, "#include <sys/param.h>\n");
+ fprintf(fp, "#include <tahoe/include/pte.h>\n");
+ fprintf(fp, "#include <sys/buf.h>\n");
fprintf(fp, "\n");
- fprintf(fp, "#include \"tahoe/vba/vbavar.h\"\n");
+ fprintf(fp, "#include <tahoe/vba/vbavar.h>\n");
fprintf(fp, "\n");
fprintf(fp, "#define C (caddr_t)\n\n");
/*
@@ -476,13 +476,13 @@ hp300_ioconf()
perror(path("ioconf.c"));
exit(1);
}
- fprintf(fp, "#include \"sys/param.h\"\n");
- fprintf(fp, "#include \"sys/buf.h\"\n");
+ fprintf(fp, "#include <sys/param.h>\n");
+ fprintf(fp, "#include <sys/buf.h>\n");
fprintf(fp, "\n");
if (machine == MACHINE_HP300)
- fprintf(fp, "#include \"hp/dev/device.h\"\n\n");
+ fprintf(fp, "#include <hp/dev/device.h>\n\n");
else
- fprintf(fp, "#include \"luna68k/dev/device.h\"\n\n");
+ fprintf(fp, "#include <luna68k/dev/device.h>\n\n");
fprintf(fp, "\n");
fprintf(fp, "#define C (caddr_t)\n");
fprintf(fp, "#define D (struct driver *)\n\n");
@@ -604,9 +604,9 @@ i386_ioconf()
register struct device *dp, *mp, *np;
register int uba_n, slave;
int dev_id;
- FILE *fp;
- static struct device olddev;
- struct device *old = &olddev;
+ FILE *fp, *fp1;
+ static char *old_d_name;
+ static char old_shandler[32 + 1];
fp = fopen(path("ioconf.c"), "w");
if (fp == 0) {
@@ -614,68 +614,93 @@ i386_ioconf()
exit(1);
}
fprintf(fp, "/*\n");
- fprintf(fp, " * ioconf.c \n");
- fprintf(fp, " * Generated by config program\n");
- fprintf(fp, " */\n\n");
- fprintf(fp, "#include \"sys/param.h\"\n");
+ fprintf(fp, " * I/O configuration.\n");
+ fprintf(fp, " * DO NOT EDIT-- this file is automatically generated.\n");
+ fprintf(fp, " */\n");
fprintf(fp, "\n");
- fprintf(fp, "#define C (caddr_t)\n\n");
+ fprintf(fp, "#include <sys/param.h>\n");
+ fprintf(fp, "#include \"ioconf.h\"\n");
+ fprintf(fp, "\n");
+ fprintf(fp, "#define C (caddr_t)\n");
+ fp1 = fopen(path("ioconf.h"), "w");
+ if (fp1 == 0) {
+ perror(path("ioconf.h"));
+ exit(1);
+ }
+ fprintf(fp1, "/*\n");
+ fprintf(fp1, " * Extern declarations for I/O configuration.\n");
+ fprintf(fp1, " * DO NOT EDIT-- this file is automatically generated.\n");
+ fprintf(fp1, " */\n");
+ fprintf(fp1, "\n");
+ fprintf(fp1, "#ifndef IOCONF_H\n");
+ fprintf(fp1, "#define\tIOCONF_H\n");
/*
* First print the isa initialization structures
*/
if (seen_isa) {
int seen_wdc = 0, seen_fdc = 0;
+ fprintf(fp, "\n");
fprintf(fp, "/*\n");
- fprintf(fp, " * ISA devices\n");
- fprintf(fp, " */\n\n");
- fprintf(fp, "#include \"i386/isa/isa_device.h\"\n");
- fprintf(fp, "#include \"i386/isa/isa.h\"\n");
- fprintf(fp, "#include \"i386/isa/icu.h\"\n\n");
- fprintf(fp, "/*\n");
- fprintf(fp, " * XXX misplaced external declarations.\n");
+ fprintf(fp, " * ISA devices.\n");
fprintf(fp, " */\n");
+ fprintf(fp, "\n");
+ fprintf(fp, "#include <i386/isa/icu.h>\n");
+ fprintf(fp, "#include <i386/isa/isa.h>\n");
+ fprintf(fp1, "\n");
+ fprintf(fp1, "#include <i386/isa/isa_device.h>\n");
+ fprintf(fp1, "\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
+ int printed = 0;
+
mp = dp->d_conn;
if (mp == 0 || mp == TO_NEXUS ||
!eq(mp->d_name, "isa"))
continue;
- if(!old->d_name || strcmp(old->d_name, dp->d_name))
- fprintf(fp, "extern struct isa_driver %3sdriver;",
- dp->d_name);
- if(eq(dp->d_name, "wdc")) seen_wdc++;
- if(eq(dp->d_name, "fdc")) seen_fdc++;
- if (dp->d_irq == 2)
- {
- fprintf(stderr, "remapped irq 2 to irq 9, please update your config file\n");
+ if (old_d_name == NULL || !eq(dp->d_name, old_d_name)) {
+ old_d_name = dp->d_name;
+ fprintf(fp1,
+ "extern struct isa_driver %3sdriver;",
+ old_d_name);
+ printed = 1;
+ }
+ if (eq(dp->d_name, "wdc"))
+ seen_wdc++;
+ if (eq(dp->d_name, "fdc"))
+ seen_fdc++;
+ if (dp->d_irq == 2) {
+ fprintf(stderr,
+ "remapped irq 2 to irq 9, please update your config file\n");
dp->d_irq = 9;
- }
- if (dp->d_vec != NULL && dp->d_vec->id != NULL) {
- char buf[32];
-
- strcpy(buf, shandler(old));
- if(!old->d_name || strcmp(buf, shandler(dp)))
- fprintf(fp, " inthand2_t %s;", shandler(dp));
}
- fprintf(fp, "\n");
- old = dp;
+ if (dp->d_vec != NULL && dp->d_vec->id != NULL &&
+ !eq(shandler(dp), old_shandler)) {
+ strcpy(old_shandler, shandler(dp));
+ fprintf(fp1, " inthand2_t %s;", old_shandler);
+ printed = 1;
+ }
+ if (printed)
+ fprintf(fp1, "\n");
}
dev_id = 2;
isa_devtab(fp, "bio", &dev_id);
- if(seen_wdc)
+ if (seen_wdc)
isa_biotab(fp, "wdc");
- if(seen_fdc)
+ if (seen_fdc)
isa_biotab(fp, "fdc");
isa_devtab(fp, "tty", &dev_id);
isa_devtab(fp, "net", &dev_id);
isa_devtab(fp, "null", &dev_id);
}
- if (seen_scbus) {
- scbus_devtab(fp, &dev_id);
- }
+ if (seen_scbus)
+ scbus_devtab(fp, fp1, &dev_id);
+
/* XXX David did this differently!!! */
/* pseudo_ioconf(fp); */
(void) fclose(fp);
+ fprintf(fp1, "\n");
+ fprintf(fp1, "#endif /* IOCONF_H */\n");
+ (void) fclose(fp1);
}
isa_biotab(fp, table)
@@ -684,7 +709,8 @@ isa_biotab(fp, table)
{
register struct device *dp, *mp;
- fprintf(fp, "\n\nstruct isa_device isa_biotab_%s[] = {\n", table);
+ fprintf(fp, "\n");
+ fprintf(fp, "struct isa_device isa_biotab_%s[] = {\n", table);
fprintf(fp, "\
/* id driver iobase irq drq maddr msiz intr unit flags drive alive ri_flags reconfig enabled conflicts next */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
@@ -715,7 +741,8 @@ isa_devtab(fp, table, dev_idp)
{
register struct device *dp, *mp;
- fprintf(fp, "\n\nstruct isa_device isa_devtab_%s[] = {\n", table);
+ fprintf(fp, "\n");
+ fprintf(fp, "struct isa_device isa_devtab_%s[] = {\n", table);
fprintf(fp, "\
/* id driver iobase irq drq maddr msiz intr unit flags scsiid alive ri_flags reconfig enabled conflicts next */\n");
for (dp = dtab; dp != 0; dp = dp->d_next) {
@@ -807,8 +834,9 @@ is_old_scsi_device(char *name)
* All that nice "conflicting SCSI ID checking" is now
* lost and should be put back in.
*/
-scbus_devtab(fp, dev_idp)
+scbus_devtab(fp, fp1, dev_idp)
FILE *fp;
+ FILE *fp1;
int *dev_idp;
{
register struct device *dp, *mp;
@@ -816,9 +844,15 @@ scbus_devtab(fp, dev_idp)
unique.id = "unique";
unique.next = 0;
- fprintf(fp, "#include \"scsi/scsiconf.h\"\n");
- fprintf(fp, "\nstruct scsi_ctlr_config scsi_cinit[] = {\n");
- fprintf(fp, "/* scbus, driver, driver unit, ctlr bus*/\n");
+ fprintf(fp, "\n");
+ fprintf(fp, "/*\n");
+ fprintf(fp, " * SCSI devices.\n");
+ fprintf(fp, " */\n");
+ fprintf(fp, "\n");
+ fprintf(fp, "#include <scsi/scsiconf.h>\n");
+ fprintf(fp, "\n");
+ fprintf(fp, "struct scsi_ctlr_config scsi_cinit[] = {\n");
+ fprintf(fp, "/* scbus, driver, driver unit, ctlr bus */\n");
/* XXX: Why do we always get an entry such as:
* { '?', "ncr", '?', '?' },
@@ -835,9 +869,11 @@ scbus_devtab(fp, dev_idp)
fprintf(fp, "%s, ", id(mp->d_unit));
fprintf(fp, "%s },\n", id(dp->d_slave));
}
- fprintf(fp, "{ 0, 0, 0, 0 }\n};\n");
+ fprintf(fp, "{ 0, 0, 0, 0 }\n");
+ fprintf(fp, "};\n");
- fprintf(fp, "\nstruct scsi_device_config scsi_dinit[] = {\n");
+ fprintf(fp, "\n");
+ fprintf(fp, "struct scsi_device_config scsi_dinit[] = {\n");
fprintf(fp, "/* name unit cunit target LUN flags */\n");
for (dp = dtab; dp; dp = dp->d_next) {
if (dp->d_type == CONTROLLER || dp->d_type == MASTER ||
@@ -876,14 +912,19 @@ scbus_devtab(fp, dev_idp)
fprintf(fp, " 0x%x },\n", dp->d_flags);
add_unique(&unique, dp->d_name);
}
- fprintf(fp, "{ 0, 0, 0, 0, 0, 0 }\n};\n");
+ fprintf(fp, "{ 0, 0, 0, 0, 0, 0 }\n");
+ fprintf(fp, "};\n");
+ fprintf(fp1, "\n");
for (node = unique.next; node; node = node->next)
- fprintf(fp, "extern void %sinit();\n", node->id);
- fprintf(fp, "void (*scsi_tinit[])(void) = {\n");
+ fprintf(fp1, "void %sinit __P((void));\n", node->id);
+
+ fprintf(fp, "\n");
+ fprintf(fp, "void (*scsi_tinit[]) __P((void)) = {\n");
for (node = unique.next; node; node = node->next)
- fprintf(fp, " %sinit,\n", node->id);
- fprintf(fp, "0,\n};\n");
+ fprintf(fp, "\t%sinit,\n", node->id);
+ fprintf(fp, "\t0,\n");
+ fprintf(fp, "};\n");
}
/*
@@ -931,9 +972,9 @@ pmax_ioconf()
perror(path("ioconf.c"));
exit(1);
}
- fprintf(fp, "#include \"sys/types.h\"\n");
- fprintf(fp, "#include \"sys/time.h\"\n");
- fprintf(fp, "#include \"pmax/dev/device.h\"\n\n");
+ fprintf(fp, "#include <sys/types.h>\n");
+ fprintf(fp, "#include <sys/time.h>\n");
+ fprintf(fp, "#include <pmax/dev/device.h>\n\n");
fprintf(fp, "#define C (char *)\n\n");
/* print controller initialization structures */
@@ -1019,17 +1060,17 @@ news_ioconf()
perror(path("ioconf.c"));
exit(1);
}
- fprintf(fp, "#include \"sys/param.h\"\n");
- fprintf(fp, "#include \"sys/buf.h\"\n");
- fprintf(fp, "#include \"vm/vm.h\"\n");
+ fprintf(fp, "#include <sys/param.h>\n");
+ fprintf(fp, "#include <sys/buf.h>\n");
+ fprintf(fp, "#include <vm/vm.h>\n");
fprintf(fp, "#include \"iop.h\"\n");
fprintf(fp, "#include \"hb.h\"\n");
fprintf(fp, "\n");
fprintf(fp, "#if NIOP > 0\n");
- fprintf(fp, "#include \"news3400/iop/iopvar.h\"\n");
+ fprintf(fp, "#include <news3400/iop/iopvar.h>\n");
fprintf(fp, "#endif\n");
fprintf(fp, "#if NHB > 0\n");
- fprintf(fp, "#include \"news3400/hbdev/hbvar.h\"\n");
+ fprintf(fp, "#include <news3400/hbdev/hbvar.h>\n");
fprintf(fp, "#endif\n");
fprintf(fp, "\n");
fprintf(fp, "#define C (caddr_t)\n\n");
@@ -1241,7 +1282,7 @@ comp_config(fp)
register struct file_list *fl;
register struct device *dp;
- fprintf(fp, "\n#include \"dev/cdvar.h\"\n");
+ fprintf(fp, "\n#include <dev/cdvar.h>\n");
fprintf(fp, "\nstruct cddevice cddevice[] = {\n");
fprintf(fp, "/*\tunit\tileave\tflags\tdk\tdevs\t\t\t\t*/\n");
OpenPOWER on IntegriCloud