diff options
author | 1996-07-07 22:02:19 +0000 | |
---|---|---|
committer | 1996-07-07 22:02:19 +0000 | |
commit | a6c0c78e0f7592e94044fdd5269878fcbe1bd9da (patch) | |
tree | 36dd502f55202f6c28f8b34e084c49e861fd2181 | |
parent | call inet_ntoa correctly, from wietse (diff) | |
download | wireguard-openbsd-a6c0c78e0f7592e94044fdd5269878fcbe1bd9da.tar.xz wireguard-openbsd-a6c0c78e0f7592e94044fdd5269878fcbe1bd9da.zip |
Add support for allowing disabled devices in a config file. e.g.
ep0 at isa? disable port ? irq ?
disable must be placed before any attribute for the device. /moj
-rw-r--r-- | usr.sbin/config/config.h | 3 | ||||
-rw-r--r-- | usr.sbin/config/gram.y | 17 | ||||
-rw-r--r-- | usr.sbin/config/mkioconf.c | 16 | ||||
-rw-r--r-- | usr.sbin/config/scan.l | 3 | ||||
-rw-r--r-- | usr.sbin/config/sem.c | 7 | ||||
-rw-r--r-- | usr.sbin/config/sem.h | 4 |
6 files changed, 34 insertions, 16 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index fc9e03225b1..760dea8139d 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -1,4 +1,4 @@ -/* $OpenBSD: config.h,v 1.4 1996/06/16 10:29:58 deraadt Exp $ */ +/* $OpenBSD: config.h,v 1.5 1996/07/07 22:02:19 maja Exp $ */ /* $NetBSD: config.h,v 1.23 1996/03/17 13:18:15 cgd Exp $ */ /* @@ -157,6 +157,7 @@ struct devi { /* created while parsing config file */ const char *i_name; /* e.g., "sd0" */ int i_unit; /* unit from name, e.g., 0 */ + int i_disable; /* device is disabled */ struct devbase *i_base;/* e.g., pointer to "sd" base */ struct devi *i_next; /* list of all instances */ struct devi *i_bsame; /* list on same base */ diff --git a/usr.sbin/config/gram.y b/usr.sbin/config/gram.y index 8d50756b2e3..ab1c8eb19b2 100644 --- a/usr.sbin/config/gram.y +++ b/usr.sbin/config/gram.y @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: gram.y,v 1.3 1996/04/21 23:40:11 deraadt Exp $ */ +/* $OpenBSD: gram.y,v 1.4 1996/07/07 22:02:20 maja Exp $ */ /* $NetBSD: gram.y,v 1.7 1996/03/17 13:18:18 cgd Exp $ */ /* @@ -100,7 +100,7 @@ static void setmaxpartitions __P((int)); int val; } -%token AND AT ATTACH COMPILE_WITH CONFIG DEFINE DEVICE DUMPS ENDFILE +%token AND AT ATTACH COMPILE_WITH CONFIG DEFINE DEVICE DISABLE DUMPS ENDFILE %token XFILE FLAGS INCLUDE XMACHINE MAJOR MAKEOPTIONS MAXUSERS MAXPARTITIONS %token MINOR ON OPTIONS PSEUDO_DEVICE ROOT SWAP VECTOR WITH %token <val> FFLAG NUMBER @@ -112,6 +112,7 @@ static void setmaxpartitions __P((int)); %type <attr> attr %type <devb> devbase %type <deva> devattach_opt +%type <val> disable %type <list> atlist interface_opt %type <str> atname %type <list> loclist_opt loclist locdef @@ -216,12 +217,16 @@ one_def: DEVICE devbase interface_opt attrs_opt = { defdev($2, 0, $3, $4); } | ATTACH devbase AT atlist veclist_opt devattach_opt attrs_opt - = { defdevattach($6, $2, $4, $5, - $7); } | + = { defdevattach($6, $2, $4, $5 , + $7); } | MAXUSERS NUMBER NUMBER NUMBER = { setdefmaxusers($2, $3, $4); } | PSEUDO_DEVICE devbase attrs_opt = { defdev($2,1,NULL,$3); } | MAJOR '{' majorlist '}'; +disable: + DISABLE = { $$ = 1; } | + /* empty */ = { $$ = 0; }; + atlist: atlist ',' atname = { $$ = new_nx($3, $1); } | atname = { $$ = new_n($1); }; @@ -318,8 +323,8 @@ config_spec: MAXUSERS NUMBER = { setmaxusers($2); } | CONFIG conf sysparam_list = { addconf(&conf); } | PSEUDO_DEVICE WORD npseudo = { addpseudo($2, $3); } | - device_instance AT attachment locators flags_opt - = { adddev($1, $3, $4, $5); }; + device_instance AT attachment disable locators flags_opt + = { adddev($1, $3, $5, $6, $4); }; mkopt_list: mkopt_list ',' mkoption | diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c index 19b56a5b41e..b3d7626f71f 100644 --- a/usr.sbin/config/mkioconf.c +++ b/usr.sbin/config/mkioconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkioconf.c,v 1.4 1996/06/16 10:30:00 deraadt Exp $ */ +/* $OpenBSD: mkioconf.c,v 1.5 1996/07/07 22:02:20 maja Exp $ */ /* $NetBSD: mkioconf.c,v 1.38 1996/03/17 06:29:27 cgd Exp $ */ /* @@ -358,6 +358,8 @@ emitcfdata(fp) if (fprintf(fp, "\n\ #define NORM FSTATE_NOTFOUND\n\ #define STAR FSTATE_STAR\n\ +#define DNRM FSTATE_DNOTFOUND\n\ +#define DSTR FSTATE_DSTAR\n\ \n\ struct cfdata cfdata[] = {\n\ /* attachment driver unit state loc flags parents nm ivstubs */\n") < 0) @@ -387,10 +389,18 @@ struct cfdata cfdata[] = {\n\ attachment = i->i_atdeva->d_name; if (i->i_unit == STAR) { unit = i->i_base->d_umax; - state = "STAR"; + if (i->i_disable) { + state = "DSTR"; + } else { + state = "STAR"; + } } else { unit = i->i_unit; - state = "NORM"; + if (i->i_disable) { + state = "DNRM"; + } else { + state = "NORM"; + } } if (i->i_ivoff < 0) { vs = ""; diff --git a/usr.sbin/config/scan.l b/usr.sbin/config/scan.l index 6a6009867ed..04e92438879 100644 --- a/usr.sbin/config/scan.l +++ b/usr.sbin/config/scan.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: scan.l,v 1.4 1996/06/29 17:06:54 deraadt Exp $ */ +/* $OpenBSD: scan.l,v 1.5 1996/07/07 22:02:21 maja Exp $ */ /* $NetBSD: scan.l,v 1.4 1996/03/17 06:29:35 cgd Exp $ */ /* @@ -92,6 +92,7 @@ compile-with { return COMPILE_WITH; } config { return CONFIG; } define { return DEFINE; } device { return DEVICE; } +disable { return DISABLE; } dumps { return DUMPS; } flags { return FLAGS; } file { return XFILE; } diff --git a/usr.sbin/config/sem.c b/usr.sbin/config/sem.c index cdd67f47e42..60cfb530c9b 100644 --- a/usr.sbin/config/sem.c +++ b/usr.sbin/config/sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sem.c,v 1.3 1996/04/21 23:40:25 deraadt Exp $ */ +/* $OpenBSD: sem.c,v 1.4 1996/07/07 22:02:21 maja Exp $ */ /* $NetBSD: sem.c,v 1.8 1996/03/17 21:12:03 cgd Exp $ */ /* @@ -739,10 +739,10 @@ newdevi(name, unit, d) * another device instead) plus unit number. */ void -adddev(name, at, loclist, flags) +adddev(name, at, loclist, flags, disable) const char *name, *at; struct nvlist *loclist; - int flags; + int flags, disable; { register struct devi *i; /* the new instance */ register struct attr *attr; /* attribute that allows attach */ @@ -870,6 +870,7 @@ ok: i->i_atdeva = iba; i->i_atunit = atunit; i->i_cfflags = flags; + i->i_disable = disable; *iba->d_ipp = i; iba->d_ipp = &i->i_asame; diff --git a/usr.sbin/config/sem.h b/usr.sbin/config/sem.h index ede56255b01..5b94ab3bacd 100644 --- a/usr.sbin/config/sem.h +++ b/usr.sbin/config/sem.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sem.h,v 1.3 1996/04/21 23:40:27 deraadt Exp $ */ +/* $OpenBSD: sem.h,v 1.4 1996/07/07 22:02:22 maja Exp $ */ /* $NetBSD: sem.h,v 1.4 1996/03/17 06:29:40 cgd Exp $ */ /* @@ -60,7 +60,7 @@ struct attr *getattr __P((const char *name)); void setmajor __P((struct devbase *d, int n)); void addconf __P((struct config *)); void setconf __P((struct nvlist **, const char *, struct nvlist *)); -void adddev __P((const char *, const char *, struct nvlist *, int)); +void adddev __P((const char *, const char *, struct nvlist *, int, int)); void addpseudo __P((const char *name, int number)); const char *ref __P((const char *name)); const char *starref __P((const char *name)); |