diff options
author | phk <phk@FreeBSD.org> | 1999-05-09 17:23:38 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-05-09 17:23:38 +0000 |
commit | a3eb84b2f90889aa591aabf7feeb509d26e2db27 (patch) | |
tree | d98f0930ea4fbd53fe37a0eb14ad8acfd6d86a6a /usr.sbin/config/config.y | |
parent | 905ee53485c821ba902da18f869a5f4812763087 (diff) | |
download | FreeBSD-src-a3eb84b2f90889aa591aabf7feeb509d26e2db27.zip FreeBSD-src-a3eb84b2f90889aa591aabf7feeb509d26e2db27.tar.gz |
config(8) lobotomy, please see commit msg in sys.
(I have no idea why cvs didn't take these changes before.)
Diffstat (limited to 'usr.sbin/config/config.y')
-rw-r--r-- | usr.sbin/config/config.y | 366 |
1 files changed, 1 insertions, 365 deletions
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 8959e6c..eaa9346 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -6,13 +6,11 @@ %token AND %token ANY -%token ARGS %token AT %token BIO %token BUS %token CAM %token COMMA -%token CONFIG %token CONFLICTS %token CONTROLLER %token CPU @@ -21,7 +19,6 @@ %token DISK %token DRIVE %token DRQ -%token DUMPS %token EQUALS %token FLAGS %token IDENT @@ -36,18 +33,15 @@ %token MINUS %token NET %token NEXUS -%token ON %token OPTIONS %token MAKEOPTIONS %token PORT %token PRIORITY %token PSEUDO_DEVICE -%token ROOT %token SEMICOLON %token SEQUENTIAL %token SIZE %token SLAVE -%token SWAP %token TARGET %token TTY %token TRACE @@ -62,10 +56,6 @@ %type <str> Opt_value %type <str> Dev %type <str> device_name -%type <val> major_minor -%type <val> root_device_spec root_device_specs -%type <val> dump_device_spec -%type <file> swap_device_spec %{ @@ -104,9 +94,6 @@ * @(#)config.y 8.1 (Berkeley) 6/6/93 */ -#include <sys/disklabel.h> -#include <sys/diskslice.h> - #include <ctype.h> #include <err.h> #include <stdio.h> @@ -120,7 +107,7 @@ static struct device *curp = 0; struct device *dtab; char *ident; int yyline; -struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; +struct file_list *ftab, *conf_list, **confp; char errbuf[80]; int maxusers; int do_trace; @@ -129,12 +116,8 @@ int seen_scbus; #define ns(s) strdup(s) -static int alreadychecked __P((dev_t, dev_t[], dev_t *)); -static void deverror __P((char *, char *)); -static int finddev __P((dev_t)); static struct device *connect __P((char *, int)); static struct device *huhcon __P((char *)); -static dev_t *verifyswap __P((struct file_list *, dev_t *, dev_t *)); static void yyerror __P((char *s)); @@ -142,7 +125,6 @@ static void yyerror __P((char *s)); %% Configuration: Many_specs - = { verifysystemspecs(); } ; Many_specs: @@ -193,155 +175,9 @@ Config_spec: | IDENT ID = { ident = $2; } | - System_spec - | MAXUSERS NUMBER = { maxusers = $2; }; -System_spec: - System_id System_parameter_list - = { checksystemspec(*confp); } - ; - -System_id: - CONFIG Save_id - = { mkconf($2); } - ; - -System_parameter_list: - System_parameter_list System_parameter - | System_parameter - ; - -System_parameter: - addr_spec - | swap_spec - | root_spec - | dump_spec - | arg_spec - ; - -addr_spec: - AT NUMBER - = { loadaddress = $2; } - ; - -swap_spec: - SWAP optional_on swap_device_list - = { yyerror("swap specification obsolete, ignored"); } - ; - -swap_device_list: - swap_device_list AND swap_device - | swap_device - ; - -swap_device: - swap_device_spec optional_size optional_sflag - ; - -swap_device_spec: - device_name - = { - struct file_list *fl = newflist(SWAPSPEC); - - if (eq($1, "generic")) - fl->f_fn = $1; - else { - fl->f_swapdev = nametodev($1, 0, - COMPATIBILITY_SLICE, 'b'); - fl->f_fn = devtoname(fl->f_swapdev); - } - $$ = fl; - } - | major_minor - = { - struct file_list *fl = newflist(SWAPSPEC); - - fl->f_swapdev = $1; - fl->f_fn = devtoname($1); - $$ = fl; - } - ; - -root_spec: - ROOT optional_on root_device_specs - = { - struct file_list *fl = *confp; - - if (fl && fl->f_rootdev != NODEV) - yyerror("extraneous root device specification"); - else - fl->f_rootdev = $3; - } - ; - -root_device_specs: - root_device_spec AND root_device_specs - = { - warnx("extraneous root devices ignored"); - $$ = $1; - } - | root_device_spec - ; - -root_device_spec: - device_name - = { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'a'); } - | major_minor - ; - -dump_spec: - DUMPS optional_on dump_device_spec - = { - struct file_list *fl = *confp; - - if (fl && fl->f_dumpdev != NODEV) - yyerror("extraneous dump device specification"); - else - fl->f_dumpdev = $3; - } - - ; - -dump_device_spec: - device_name - = { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'b'); } - | major_minor - ; - -arg_spec: - ARGS optional_on arg_device_spec - = { yyerror("arg device specification obsolete, ignored"); } - ; - -arg_device_spec: - device_name - | major_minor - ; - -major_minor: - MAJOR NUMBER MINOR NUMBER - = { $$ = makedev($2, $4); } - ; - -optional_on: - ON - | /* empty */ - ; - -optional_size: - SIZE NUMBER - = { yyerror("`size nnn' swap spec obsolete"); } - | /* empty */ - ; - -optional_sflag: - SEQUENTIAL - = { yyerror("`sequential' swap spec obsolete"); } - | /* empty */ - ; - device_name: Save_id = { $$ = $1; } @@ -611,28 +447,6 @@ newdev(dp) curp = np; } -/* - * note that a configuration should be made - */ -static void -mkconf(sysname) - char *sysname; -{ - register struct file_list *fl, **flp; - - fl = (struct file_list *) malloc(sizeof *fl); - memset(fl, 0, sizeof(*fl)); - fl->f_type = SYSTEMSPEC; - fl->f_needs = sysname; - fl->f_rootdev = NODEV; - fl->f_dumpdev = NODEV; - fl->f_fn = 0; - fl->f_next = 0; - for (flp = confp; *flp; flp = &(*flp)->f_next) - ; - *flp = fl; - confp = flp; -} static struct file_list * newflist(ftype) @@ -643,55 +457,12 @@ newflist(ftype) fl->f_type = ftype; fl->f_next = 0; - fl->f_swapdev = NODEV; - fl->f_swapsize = 0; fl->f_needs = 0; fl->f_fn = 0; return (fl); } /* - * Add a swap device to the system's configuration - */ -static void -mkswap(system, fl, size, flag) - struct file_list *system, *fl; - int size, flag; -{ - register struct file_list **flp; - - if (system == 0 || system->f_type != SYSTEMSPEC) { - yyerror("\"swap\" spec precedes \"config\" specification"); - return; - } - if (size < 0) { - yyerror("illegal swap partition size"); - return; - } - /* - * Append swap description to the end of the list. - */ - flp = &system->f_next; - for (; *flp && (*flp)->f_type == SWAPSPEC; flp = &(*flp)->f_next) - ; - fl->f_next = *flp; - *flp = fl; - fl->f_swapsize = size; - fl->f_swapflag = flag; - /* - * If first swap device for this system, - * set up f_fn field to insure swap - * files are created with unique names. - */ - if (system->f_fn) - return; - if (eq(fl->f_fn, "generic")) - system->f_fn = ns(fl->f_fn); - else - system->f_fn = ns(system->f_needs); -} - -/* * find the pointer to connect to the given device and number. * returns 0 if no such device and prints an error message */ @@ -841,140 +612,5 @@ checksystemspec(fl) } swap = fl->f_next; generic = swap && swap->f_type == SWAPSPEC && eq(swap->f_fn, "generic"); - if (fl->f_rootdev == NODEV && !generic) { - yyerror("no root device specified"); - exit(1); - } - /* - * Default swap area to be in 'b' partition of root's - * device. If root specified to be other than on 'a' - * partition, give warning, something probably amiss. - */ - if (swap == 0 || swap->f_type != SWAPSPEC) { - dev_t dev; - - swap = newflist(SWAPSPEC); - dev = fl->f_rootdev; - if (dkpart(dev) != 0) { - (void) snprintf(buf, sizeof(buf), -"Warning, swap defaulted to 'b' partition with root on '%c' partition", - dkpart(dev) + 'a'); - yyerror(buf); - } - swap->f_swapdev = dkmodpart(dev, SWAP_PART); - swap->f_fn = devtoname(swap->f_swapdev); - mkswap(fl, swap, 0); - } - /* - * Make sure a generic swap isn't specified, along with - * other stuff (user must really be confused). - */ - if (generic) { - if (fl->f_rootdev != NODEV) - yyerror("root device specified with generic swap"); - if (fl->f_dumpdev != NODEV) - yyerror("dump device specified with generic swap"); - return; - } - /* - * Warn if dump device is not a swap area. - */ - if (fl->f_dumpdev != NODEV && fl->f_dumpdev != swap->f_swapdev) { - struct file_list *p = swap->f_next; - - for (; p && p->f_type == SWAPSPEC; p = p->f_next) - if (fl->f_dumpdev == p->f_swapdev) - return; - (void) snprintf(buf, sizeof(buf), - "Warning: dump device is not a swap partition"); - yyerror(buf); - } } -/* - * Verify all devices specified in the system specification - * are present in the device specifications. - */ -static void -verifysystemspecs() -{ - register struct file_list *fl; - dev_t checked[50]; - register dev_t *pchecked = checked; - - for (fl = conf_list; fl; fl = fl->f_next) { - if (fl->f_type != SYSTEMSPEC) - continue; - if (!finddev(fl->f_rootdev)) - deverror(fl->f_needs, "root"); - *pchecked++ = fl->f_rootdev; - pchecked = verifyswap(fl->f_next, checked, pchecked); - if (!alreadychecked(fl->f_dumpdev, checked, pchecked)) { - if (!finddev(fl->f_dumpdev)) - deverror(fl->f_needs, "dump"); - *pchecked++ = fl->f_dumpdev; - } - } -} - -/* - * Do as above, but for swap devices. - */ -static dev_t * -verifyswap(fl, checked, pchecked) - register struct file_list *fl; - dev_t checked[]; - register dev_t *pchecked; -{ - - for (;fl && fl->f_type == SWAPSPEC; fl = fl->f_next) { - if (eq(fl->f_fn, "generic")) - continue; - if (alreadychecked(fl->f_swapdev, checked, pchecked)) - continue; - if (!finddev(fl->f_swapdev)) - warnx("swap device %s not configured", fl->f_fn); - *pchecked++ = fl->f_swapdev; - } - return (pchecked); -} - -/* - * Has a device already been checked - * for its existence in the configuration? - */ -static int -alreadychecked(dev, list, last) - dev_t dev, list[]; - register dev_t *last; -{ - register dev_t *p; - - for (p = list; p < last; p++) - if (dkmodpart(*p, 0) != dkmodpart(dev, 0)) - return (1); - return (0); -} - -static void -deverror(systemname, devtype) - char *systemname, *devtype; -{ - - warnx("%s: %s device not configured", systemname, devtype); -} - -/* - * Look for the device in the list of - * configured hardware devices. Must - * take into account stuff wildcarded. - */ -/*ARGSUSED*/ -static int -finddev(dev) - dev_t dev; -{ - - /* punt on this right now */ - return (1); -} |