diff options
author | peter <peter@FreeBSD.org> | 2000-06-10 22:13:40 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-06-10 22:13:40 +0000 |
commit | 9fbe309befea3309aaa3b4ba51b0a98b67237143 (patch) | |
tree | d1d5b4de3ae6d63afdbed089889761df8d9c9f2c /usr.sbin/config/mkheaders.c | |
parent | 705b81c200d1314114fe9874115a22605e085a4c (diff) | |
download | FreeBSD-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/mkheaders.c')
-rw-r--r-- | usr.sbin/config/mkheaders.c | 54 |
1 files changed, 22 insertions, 32 deletions
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; |