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: <20210319193150.267510-3-alobakin@pm.me>
Date:   Fri, 19 Mar 2021 19:32: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 2/2] kconfig: mention submenu type in comment blocks in .config

To have a better understanding of the dotconfig blocks, mention if
a particular block-commented section is a choice or a menu{,config}.

Before:

CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y

CONFIG_NO_HZ_IDLE=y

CONFIG_HIGH_RES_TIMERS=y

After:

CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y

CONFIG_NO_HZ_IDLE=y

CONFIG_HIGH_RES_TIMERS=y

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

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index e4f0a21fd469..3f50d8b82a54 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -822,6 +822,17 @@ int conf_write_defconfig(const char *filename)
 	return 0;
 }

+static const char *menu_type_string(const struct menu *menu)
+{
+	if (menu->sym && (menu->sym->flags & SYMBOL_CHOICE))
+		return " choice";
+
+	if (menu->prompt && menu->prompt->type == P_MENU)
+		return " menu";
+
+	return "";
+}
+
 int conf_write(const char *name)
 {
 	FILE *out;
@@ -876,8 +887,8 @@ int conf_write(const char *name)
 			str = menu_get_prompt(menu);
 			fprintf(out, "\n"
 				     "#\n"
-				     "# %s\n"
-				     "#\n", str);
+				     "# %s%s\n"
+				     "#\n", str, menu_type_string(menu));
 			need_newline = false;
 		}

@@ -905,7 +916,8 @@ int conf_write(const char *name)
 			     (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);
+				fprintf(out, "# end of %s%s\n", str,
+					menu_type_string(menu));
 				need_newline = true;
 			}
 			if (menu->next) {
--
2.31.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ