lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210319193705.267922-2-alobakin@pm.me>
Date:   Fri, 19 Mar 2021 19:37:11 +0000
From:   Alexander Lobakin <alobakin@...me>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     Alexander Lobakin <alobakin@...me>, linux-kbuild@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH RESEND 1/2] kconfig: fence choices and menuconfigs with comments in .config too

Comment blocks are now generated in .config only for menus. Provide
them for choices and menuconfigs too to greatly improve dotconfig
readability.

Choices before:

x CONFIG_BOOT_CONFIG is not set
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
x CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y

Choices after:

x CONFIG_BOOT_CONFIG is not set

x
x Compiler optimization level
x
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
x CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
x end of Compiler optimization level

CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y

Menuconfigs before:

x CONFIG_IPACK_BUS is not set
CONFIG_RESET_CONTROLLER=y
x CONFIG_RESET_BRCMSTB_RESCAL is not set
x CONFIG_RESET_INTEL_GW is not set
x CONFIG_RESET_TI_SYSCON is not set

Menuconfigs after:

x
x IndustryPack bus support
x
x CONFIG_IPACK_BUS is not set
x end of IndustryPack bus support

x
x Reset Controller Support
x
CONFIG_RESET_CONTROLLER=y
x CONFIG_RESET_BRCMSTB_RESCAL is not set
x CONFIG_RESET_INTEL_GW is not set
x CONFIG_RESET_TI_SYSCON is not set
x end of Reset Controller Support

Signed-off-by: Alexander Lobakin <alobakin@...me>
---
 scripts/kconfig/confdata.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2568dbe16ed6..e4f0a21fd469 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -869,17 +869,20 @@ int conf_write(const char *name)
 	menu = rootmenu.list;
 	while (menu) {
 		sym = menu->sym;
-		if (!sym) {
-			if (!menu_is_visible(menu))
-				goto next;
+
+		if ((!sym || (sym->flags & SYMBOL_CHOICE) ||
+		     (menu->prompt && menu->prompt->type == P_MENU)) &&
+		    menu_is_visible(menu)) {
 			str = menu_get_prompt(menu);
 			fprintf(out, "\n"
 				     "#\n"
 				     "# %s\n"
 				     "#\n", str);
 			need_newline = false;
-		} else if (!(sym->flags & SYMBOL_CHOICE) &&
-			   !(sym->flags & SYMBOL_WRITTEN)) {
+		}
+
+		if (sym && !(sym->flags & SYMBOL_CHOICE) &&
+		    !(sym->flags & SYMBOL_WRITTEN)) {
 			sym_calc_value(sym);
 			if (!(sym->flags & SYMBOL_WRITE))
 				goto next;
@@ -896,11 +899,11 @@ int conf_write(const char *name)
 			menu = menu->list;
 			continue;
 		}
-		if (menu->next)
-			menu = menu->next;
-		else while ((menu = menu->parent)) {
-			if (!menu->sym && menu_is_visible(menu) &&
-			    menu != &rootmenu) {
+
+		do {
+			if (((menu->sym && menu->sym->flags & SYMBOL_CHOICE) ||
+			     (menu->prompt && menu->prompt->type == P_MENU)) &&
+			    menu_is_visible(menu) && menu != &rootmenu) {
 				str = menu_get_prompt(menu);
 				fprintf(out, "# end of %s\n", str);
 				need_newline = true;
@@ -909,7 +912,7 @@ int conf_write(const char *name)
 				menu = menu->next;
 				break;
 			}
-		}
+		} while ((menu = menu->parent));
 	}
 	fclose(out);

--
2.31.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ