Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/config Add 'no config <name>'.



details:   https://anonhg.NetBSD.org/src/rev/a0bd8f2dd92d
branches:  trunk
changeset: 588204:a0bd8f2dd92d
user:      cube <cube%NetBSD.org@localhost>
date:      Sat Feb 11 20:15:53 2006 +0000

description:
Add 'no config <name>'.

diffstat:

 usr.bin/config/gram.y |   3 ++-
 usr.bin/config/sem.c  |  22 +++++++++++++++++++++-
 usr.bin/config/sem.h  |   3 ++-
 3 files changed, 25 insertions(+), 3 deletions(-)

diffs (71 lines):

diff -r a505f4543705 -r a0bd8f2dd92d usr.bin/config/gram.y
--- a/usr.bin/config/gram.y     Sat Feb 11 19:39:01 2006 +0000
+++ b/usr.bin/config/gram.y     Sat Feb 11 20:15:53 2006 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: gram.y,v 1.4 2005/10/12 01:17:43 cube Exp $    */
+/*     $NetBSD: gram.y,v 1.5 2006/02/11 20:15:53 cube Exp $    */
 
 /*
  * Copyright (c) 1992, 1993
@@ -446,6 +446,7 @@
        IDENT stringvalue               { setident($2); } |
        CONFIG conf root_spec sysparam_list
                                        { addconf(&conf); } |
+       NO CONFIG WORD                  { delconf($3); } |
        NO PSEUDO_DEVICE WORD           { delpseudo($3); } |
        PSEUDO_DEVICE WORD npseudo      { addpseudo($2, $3); } |
        NO device_instance AT attachment
diff -r a505f4543705 -r a0bd8f2dd92d usr.bin/config/sem.c
--- a/usr.bin/config/sem.c      Sat Feb 11 19:39:01 2006 +0000
+++ b/usr.bin/config/sem.c      Sat Feb 11 20:15:53 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sem.c,v 1.17 2005/12/18 23:43:15 cube Exp $    */
+/*     $NetBSD: sem.c,v 1.18 2006/02/11 20:15:53 cube Exp $    */
 
 /*
  * Copyright (c) 1992, 1993
@@ -852,6 +852,26 @@
 }
 
 void
+delconf(const char *name)
+{
+       struct config *cf;
+
+       if (ht_lookup(cfhashtab, name) == NULL) {
+               error("configuration `%s' undefined", name);
+               return;
+       }
+       (void)ht_remove(cfhashtab, name);
+
+       TAILQ_FOREACH(cf, &allcf, cf_next)
+               if (!strcmp(cf->cf_name, name))
+                       break;
+       if (cf == NULL)
+               panic("lost configuration `%s'", name);
+
+       TAILQ_REMOVE(&allcf, cf, cf_next);
+}
+
+void
 setfstype(const char **fstp, const char *v)
 {
 
diff -r a505f4543705 -r a0bd8f2dd92d usr.bin/config/sem.h
--- a/usr.bin/config/sem.h      Sat Feb 11 19:39:01 2006 +0000
+++ b/usr.bin/config/sem.h      Sat Feb 11 20:15:53 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sem.h,v 1.4 2005/10/12 01:17:43 cube Exp $     */
+/*     $NetBSD: sem.h,v 1.5 2006/02/11 20:15:53 cube Exp $     */
 
 /*
  * Copyright (c) 1992, 1993
@@ -58,6 +58,7 @@
 void           setmajor(struct devbase *, int);
 void           addconf(struct config *);
 void           setconf(struct nvlist **, const char *, struct nvlist *);
+void           delconf(const char *);
 void           setfstype(const char **, const char *);
 void           adddev(const char *, const char *, struct nvlist *, int);
 void           deldevi(const char *, const char *);



Home | Main Index | Thread Index | Old Index