From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 14 15:56:01 2010 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7603106566B; Wed, 14 Apr 2010 15:56:01 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 5C6238FC19; Wed, 14 Apr 2010 15:56:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o3EFngKM047052; Wed, 14 Apr 2010 09:49:42 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 14 Apr 2010 09:49:55 -0600 (MDT) Message-Id: <20100414.094955.505347165636258137.imp@bsdimp.com> To: jhb@FreeBSD.org, freebsd-hackers@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20100414164722.062cac6e.ray@dlink.ua> References: <20100414130353.c28d5128.ray@dlink.ua> <201004140906.28205.jhb@freebsd.org> <20100414164722.062cac6e.ray@dlink.ua> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Subject: Patch to config for compatibility X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Apr 2010 15:56:01 -0000 I also have a patch to config. It lets you put a line of the form CONFIG_OLD_OPTION = CONFIG_NEW_OPTION in the options files. This is useful when optioning are changing and have a rather wide scope and need to be merged, as with the recent CONFIG_FREEBSD32 option. With this merged to stable, we can rename that without requiring config file tweaks on a stable branch. Comments? Warner Index: mkoptions.c =================================================================== --- mkoptions.c (revision 205300) +++ mkoptions.c (working copy) @@ -90,6 +90,17 @@ SLIST_INSERT_HEAD(&opt, op, op_next); read_options(); + SLIST_FOREACH(op, &opt, op_next) { + SLIST_FOREACH(ol, &otab, o_next) { + if (eq(op->op_name, ol->o_name) && + (ol->o_flags & OL_ALIAS)) { + printf("Mapping option %s to %s.\n", + op->op_name, ol->o_file); + op->op_name = ol->o_file; + break; + } + } + } SLIST_FOREACH(ol, &otab, o_next) do_option(ol->o_name); SLIST_FOREACH(op, &opt, op_next) { @@ -120,7 +131,6 @@ int tidy; file = tooption(name); - /* * Check to see if the option was specified.. */ @@ -284,6 +294,7 @@ struct opt_list *po; int first = 1; char genopt[MAXPATHLEN]; + int flags = 0; SLIST_INIT(&otab); (void) snprintf(fname, sizeof(fname), "../../conf/options"); @@ -293,6 +304,7 @@ return; } next: + flags = 0; wd = get_word(fp); if (wd == (char *)EOF) { (void) fclose(fp); @@ -324,6 +336,18 @@ (void) snprintf(genopt, sizeof(genopt), "opt_%s.h", lower(s)); val = genopt; free(s); + } else if (eq(val, "=")) { + val = get_word(fp); + if (val == (char *)EOF) { + printf("%s: unexpected end of file\n", fname); + exit(1); + } + if (val == 0) { + printf("%s: Expected a right hand side at %s\n", fname, + this); + exit(1); + } + flags |= OL_ALIAS; } val = ns(val); @@ -338,6 +362,7 @@ po = (struct opt_list *) calloc(1, sizeof *po); po->o_name = this; po->o_file = val; + po->o_flags = flags; SLIST_INSERT_HEAD(&otab, po, o_next); goto next; Index: config.h =================================================================== --- config.h (revision 205300) +++ config.h (working copy) @@ -129,6 +129,8 @@ struct opt_list { char *o_name; char *o_file; + int o_flags; +#define OL_ALIAS 1 SLIST_ENTRY(opt_list) o_next; };