Add 'no config <name>'.

This commit is contained in:
cube 2006-02-11 20:15:53 +00:00
parent 81cb1ea305
commit 42b52b8a61
3 changed files with 25 additions and 3 deletions

View File

@ -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 @@ config_spec:
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

View File

@ -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
@ -851,6 +851,26 @@ setconf(struct nvlist **npp, const char *what, struct nvlist *v)
*npp = v;
}
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)
{

View File

@ -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 selectattr(struct attr *);
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 *);