Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/config Keep track of attribute (module) dependency u...



details:   https://anonhg.NetBSD.org/src/rev/29c235650b86
branches:  trunk
changeset: 333084:29c235650b86
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Oct 18 06:36:40 2014 +0000

description:
Keep track of attribute (module) dependency using hash2.

diffstat:

 usr.bin/config/defs.h |   3 ++-
 usr.bin/config/main.c |   5 ++++-
 usr.bin/config/sem.c  |  21 ++++++++++++++++++++-
 usr.bin/config/sem.h  |   3 ++-
 4 files changed, 28 insertions(+), 4 deletions(-)

diffs (116 lines):

diff -r 097ca3fcedac -r 29c235650b86 usr.bin/config/defs.h
--- a/usr.bin/config/defs.h     Sat Oct 18 02:22:35 2014 +0000
+++ b/usr.bin/config/defs.h     Sat Oct 18 06:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.57 2014/10/12 05:20:54 uebayasi Exp $       */
+/*     $NetBSD: defs.h,v 1.58 2014/10/18 06:36:40 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -483,6 +483,7 @@
 struct nvhash *deffstab;       /* defined file systems */
 struct dlhash *optfiletab;     /* "defopt"'d option .h files */
 struct hashtab *attrtab;       /* attributes (locators, etc.) */
+struct hashtab *attrdeptab;    /* attribute dependencies */
 struct hashtab *bdevmtab;      /* block devm lookup */
 struct hashtab *cdevmtab;      /* character devm lookup */
 
diff -r 097ca3fcedac -r 29c235650b86 usr.bin/config/main.c
--- a/usr.bin/config/main.c     Sat Oct 18 02:22:35 2014 +0000
+++ b/usr.bin/config/main.c     Sat Oct 18 06:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.68 2014/10/14 08:00:27 uebayasi Exp $       */
+/*     $NetBSD: main.c,v 1.69 2014/10/18 06:36:40 uebayasi Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -439,6 +439,9 @@
                return 0;
        }
 
+       yyfile = "dependattrs";
+       dependattrs();
+
        /*
         * Deal with option dependencies.
         */
diff -r 097ca3fcedac -r 29c235650b86 usr.bin/config/sem.c
--- a/usr.bin/config/sem.c      Sat Oct 18 02:22:35 2014 +0000
+++ b/usr.bin/config/sem.c      Sat Oct 18 06:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sem.c,v 1.63 2014/10/12 15:35:40 uebayasi Exp $        */
+/*     $NetBSD: sem.c,v 1.64 2014/10/18 06:36:40 uebayasi Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -96,6 +96,7 @@
 {
 
        attrtab = ht_new();
+       attrdeptab = ht_new();
 
        allattr.a_name = "netbsd";
        TAILQ_INIT(&allattr.a_files);
@@ -303,6 +304,7 @@
                            "attribute", name, dep->a_name);
                        return (1);
                }
+               (void)ht_insert2(attrdeptab, name, dep->a_name, NULL);
                CFGDBG(2, "attr `%s' depends on attr `%s'", name, dep->a_name);
        }
 
@@ -530,6 +532,7 @@
                 * Implicit attribute definition for device dependencies.
                 */
                refattr(al->al_this->a_name);
+               (void)ht_insert2(attrdeptab, dev->d_name, al->al_this->a_name, NULL);
                CFGDBG(2, "device `%s' depends on attr `%s'", dev->d_name,
                    al->al_this->a_name);
        }
@@ -1947,6 +1950,21 @@
        CFGDBG(3, "attr selected `%s'", a->a_name);
 }
 
+static int
+dumpattrdepcb2(const char *name1, const char *name2, void *v, void *arg)
+{
+
+       CFGDBG(3, "attr `%s' depends on attr `%s'", name1, name2);
+       return 0;
+}
+
+void
+dependattrs(void)
+{
+
+       ht_enumerate2(attrdeptab, dumpattrdepcb2, NULL);
+}
+
 /*
  * We have an instance of the base foo, so select it and all its
  * attributes for "optional foo".
@@ -1959,6 +1977,7 @@
 
        (void)ht_insert(selecttab, d->d_name, __UNCONST(d->d_name));
        CFGDBG(3, "devbase selected `%s'", d->d_name);
+       CFGDBG(5, "selecting dependencies of devbase `%s'", d->d_name);
        for (al = d->d_attrs; al != NULL; al = al->al_next) {
                a = al->al_this;
                expandattr(a, selectattr);
diff -r 097ca3fcedac -r 29c235650b86 usr.bin/config/sem.h
--- a/usr.bin/config/sem.h      Sat Oct 18 02:22:35 2014 +0000
+++ b/usr.bin/config/sem.h      Sat Oct 18 06:36:40 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sem.h,v 1.14 2014/10/10 11:09:50 uebayasi Exp $        */
+/*     $NetBSD: sem.h,v 1.15 2014/10/18 06:36:40 uebayasi Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -61,6 +61,7 @@
 int            getrefattr(const char *, struct attr **);
 void           expandattr(struct attr *, void (*)(struct attr *));
 void           selectattr(struct attr *);
+void           dependattrs(void);
 void           setmajor(struct devbase *, int);
 void           addconf(struct config *);
 void           setconf(struct nvlist **, const char *, struct nvlist *);



Home | Main Index | Thread Index | Old Index