Annotation of researchv10no/sys/mkconf/subdev.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * routines for subdevices
                      3:  */
                      4: 
                      5: #include "mkconf.h"
                      6: 
                      7: static char *subfields[] = {
                      8:        "ctl", "unit", NULL
                      9: };
                     10: 
                     11: #define        a_ctl   addr[0] /* controller number; arbitrary */
                     12: #define        a_unit  addr[1] /* unit number; also arbitrary */
                     13: 
                     14: int
                     15: subsyntax(dp, ap, n)
                     16: register Dev *dp;
                     17: char **ap;
                     18: int n;
                     19: {
                     20:        char *p;
                     21: 
                     22:        if ((p = keyread(dp->addr, ap, n, subfields)) != 0) {
                     23:                fprint(STDERR, "%s %d: bad field %s\n", dp->mdev->name, dp->id, p);
                     24:                errs++;
                     25:                return (1);
                     26:        }
                     27:        return (0);
                     28: }
                     29: 
                     30: int
                     31: subputaddr(fd, dp)
                     32: int fd;
                     33: register Dev *dp;
                     34: {
                     35:        register int count;
                     36:        register Mdev *mp;
                     37: 
                     38:        mp = dp->mdev;
                     39:        count = 0;
                     40:        fprint(fd, "struct subaddr %saddr[] = {\n", mp->tag);
                     41:        for (mp = dp->mdev; dp && dp->mdev == mp; dp = dp->next) {
                     42:                while (count++ < dp->id)
                     43:                        fprint(fd, "\t{-1, -1},\n");
                     44:                fprint(fd, "\t{%ld, %ld},\n", dp->a_ctl, dp->a_unit);
                     45:        }
                     46:        fprint(fd, "};\nint %scnt = %d;\n", mp->tag, count);
                     47:        putstrs(fd, mp, count);
                     48: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.