All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] kconfig: add support to show hidden options which have prompts
@ 2010-04-14  3:43 Li Zefan
  2010-04-14  3:44 ` [PATCH 1/6] kconfig: some small fixes Li Zefan
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:43 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

Usage:
  (in menuconfig)
  Press <Z> to show all config symbols which have prompts.

Quote Tim Bird (http://lkml.org/lkml/2010/3/19/319):

| I've been bitten by this numerous times.  I most often
| use ftrace on ARM, but when I go back to x86, I almost
| always go through a sequence of searching for the
| function graph tracer in the menus, then realizing it's
| completely missing until I disable CC_OPTIMIZE_FOR_SIZE.
|
| Is there any way to have the menu item appear, but be
| unsettable unless the SIZE option is disabled?  I'm
| not a Kconfig guru...

I myself found this useful too. For example, I need to test
ftrace/tracing and want to be sure all the tracing features are
enabled, so I  enter the "Tracers" menu, and press <Z> to
see if there is any config hidden.

I noticed gconfig and xconfig have a button "Show all options",
but that's a bit too much, and I think normally what we are not
interested in those configs which have no prompt thus can't be
changed by users.

Exmaple:

      --- Tracers
      -*-   Kernel Function Tracer
      - -     Kernel Function Graph Tracer
      [*]   Interrupts-off Latency Tracer
      - -   Preemption-off Latency Tracer
      [*]   Sysprof Tracer

Here you can see 2 tracers are not selectable, and then can find
out how to make them selectable.

I also add this support for gconfig, but haven't done for xconfig.

btw: are there many users using gconfig/xconfig today ?

---
 Documentation/kbuild/kconfig-language.txt |    2 +-
 scripts/kconfig/gconf.c                   |  113 ++++++++++-------------------
 scripts/kconfig/gconf.glade               |   26 +++++--
 scripts/kconfig/lkc_proto.h               |    3 +-
 scripts/kconfig/lxdialog/inputbox.c       |    4 +-
 scripts/kconfig/lxdialog/menubox.c        |   22 +++---
 scripts/kconfig/mconf.c                   |   22 +++++-
 scripts/kconfig/menu.c                    |   12 +++-
 scripts/kconfig/zconf.tab.c_shipped       |   21 +++++-
 scripts/kconfig/zconf.y                   |   21 +++++-
 10 files changed, 136 insertions(+), 110 deletions(-)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/6] kconfig: some small fixes
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
@ 2010-04-14  3:44 ` Li Zefan
  2010-04-14  3:44 ` [PATCH 2/6] kconfig: fix zconfdump() Li Zefan
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:44 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

- fix a typo in documentation
- fix a typo in a printk on error
- fix comments in dialog_inputbox()

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 Documentation/kbuild/kconfig-language.txt |    2 +-
 scripts/kconfig/lxdialog/inputbox.c       |    4 ++--
 scripts/kconfig/menu.c                    |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index c412c24..b472e4e 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -181,7 +181,7 @@ Expressions are listed in decreasing order of precedence.
 (7) Returns the result of max(/expr/, /expr/).
 
 An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
-respectively for calculations). A menu entry becomes visible when it's
+respectively for calculations). A menu entry becomes visible when its
 expression evaluates to 'm' or 'y'.
 
 There are two types of symbols: constant and non-constant symbols.
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 616c601..dd8e587 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -180,7 +180,7 @@ do_resize:
 		case KEY_LEFT:
 			switch (button) {
 			case -1:
-				button = 1;	/* Indicates "Cancel" button is selected */
+				button = 1;	/* Indicates "Help" button is selected */
 				print_buttons(dialog, height, width, 1);
 				break;
 			case 0:
@@ -204,7 +204,7 @@ do_resize:
 				print_buttons(dialog, height, width, 0);
 				break;
 			case 0:
-				button = 1;	/* Indicates "Cancel" button is selected */
+				button = 1;	/* Indicates "Help" button is selected */
 				print_buttons(dialog, height, width, 1);
 				break;
 			case 1:
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 059a246..6761055 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -197,7 +197,7 @@ static void sym_check_prop(struct symbol *sym)
 			if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
 			    prop->expr->type != E_SYMBOL)
 				prop_warn(prop,
-				    "default for config symbol '%'"
+				    "default for config symbol '%s'"
 				    " must be a single symbol", sym->name);
 			break;
 		case P_SELECT:
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/6] kconfig: fix zconfdump()
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
  2010-04-14  3:44 ` [PATCH 1/6] kconfig: some small fixes Li Zefan
@ 2010-04-14  3:44 ` Li Zefan
  2010-04-14  3:44 ` [PATCH 3/6] gconfig: remove dbg_print_ptype() and dbg_print_stype() Li Zefan
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:44 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

zconfdump(), which is used for debugging, can't recognize P_SELECT,
P_RANGE and P_MENU (if associated with a symbol, aka "menuconfig"),
and output something like this:

config X86
  boolean
  default y
  unknown prop 6!
  unknown prop 6!
  unknown prop 6!
  ...

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 scripts/kconfig/zconf.tab.c_shipped |   21 +++++++++++++++++----
 scripts/kconfig/zconf.y             |   21 +++++++++++++++++----
 2 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 6e9dcd5..54d5ba1 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -2336,9 +2336,9 @@ static void print_symbol(FILE *out, struct menu *menu)
 	struct property *prop;
 
 	if (sym_is_choice(sym))
-		fprintf(out, "choice\n");
+		fprintf(out, "\nchoice\n");
 	else
-		fprintf(out, "config %s\n", sym->name);
+		fprintf(out, "\nconfig %s\n", sym->name);
 	switch (sym->type) {
 	case S_BOOLEAN:
 		fputs("  boolean\n", out);
@@ -2384,6 +2384,21 @@ static void print_symbol(FILE *out, struct menu *menu)
 		case P_CHOICE:
 			fputs("  #choice value\n", out);
 			break;
+		case P_SELECT:
+			fputs( "  select ", out);
+			expr_fprint(prop->expr, out);
+			fputc('\n', out);
+			break;
+		case P_RANGE:
+			fputs( "  range ", out);
+			expr_fprint(prop->expr, out);
+			fputc('\n', out);
+			break;
+		case P_MENU:
+			fputs( "  menu ", out);
+			print_quoted_string(out, prop->text);
+			fputc('\n', out);
+			break;
 		default:
 			fprintf(out, "  unknown prop %d!\n", prop->type);
 			break;
@@ -2395,7 +2410,6 @@ static void print_symbol(FILE *out, struct menu *menu)
 			menu->help[len] = 0;
 		fprintf(out, "  help\n%s\n", menu->help);
 	}
-	fputc('\n', out);
 }
 
 void zconfdump(FILE *out)
@@ -2428,7 +2442,6 @@ void zconfdump(FILE *out)
 				expr_fprint(prop->visible.expr, out);
 				fputc('\n', out);
 			}
-			fputs("\n", out);
 		}
 
 		if (menu->list)
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 8c43491..98dae9f 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -591,9 +591,9 @@ static void print_symbol(FILE *out, struct menu *menu)
 	struct property *prop;
 
 	if (sym_is_choice(sym))
-		fprintf(out, "choice\n");
+		fprintf(out, "\nchoice\n");
 	else
-		fprintf(out, "config %s\n", sym->name);
+		fprintf(out, "\nconfig %s\n", sym->name);
 	switch (sym->type) {
 	case S_BOOLEAN:
 		fputs("  boolean\n", out);
@@ -639,6 +639,21 @@ static void print_symbol(FILE *out, struct menu *menu)
 		case P_CHOICE:
 			fputs("  #choice value\n", out);
 			break;
+		case P_SELECT:
+			fputs( "  select ", out);
+			expr_fprint(prop->expr, out);
+			fputc('\n', out);
+			break;
+		case P_RANGE:
+			fputs( "  range ", out);
+			expr_fprint(prop->expr, out);
+			fputc('\n', out);
+			break;
+		case P_MENU:
+			fputs( "  menu ", out);
+			print_quoted_string(out, prop->text);
+			fputc('\n', out);
+			break;
 		default:
 			fprintf(out, "  unknown prop %d!\n", prop->type);
 			break;
@@ -650,7 +665,6 @@ static void print_symbol(FILE *out, struct menu *menu)
 			menu->help[len] = 0;
 		fprintf(out, "  help\n%s\n", menu->help);
 	}
-	fputc('\n', out);
 }
 
 void zconfdump(FILE *out)
@@ -683,7 +697,6 @@ void zconfdump(FILE *out)
 				expr_fprint(prop->visible.expr, out);
 				fputc('\n', out);
 			}
-			fputs("\n", out);
 		}
 
 		if (menu->list)
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/6] gconfig: remove dbg_print_ptype() and dbg_print_stype()
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
  2010-04-14  3:44 ` [PATCH 1/6] kconfig: some small fixes Li Zefan
  2010-04-14  3:44 ` [PATCH 2/6] kconfig: fix zconfdump() Li Zefan
@ 2010-04-14  3:44 ` Li Zefan
  2010-04-14  3:44 ` [PATCH 4/6] gconfig: remove show_debug option Li Zefan
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:44 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

Just use sym_get_type() and prop_get_type_name().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 scripts/kconfig/gconf.c |   67 +++--------------------------------------------
 1 files changed, 4 insertions(+), 63 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 6546436..80fe9ca 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -76,36 +76,7 @@ static void conf_changed(void);
 
 /* Helping/Debugging Functions */
 
-
-const char *dbg_print_stype(int val)
-{
-	static char buf[256];
-
-	bzero(buf, 256);
-
-	if (val == S_UNKNOWN)
-		strcpy(buf, "unknown");
-	if (val == S_BOOLEAN)
-		strcpy(buf, "boolean");
-	if (val == S_TRISTATE)
-		strcpy(buf, "tristate");
-	if (val == S_INT)
-		strcpy(buf, "int");
-	if (val == S_HEX)
-		strcpy(buf, "hex");
-	if (val == S_STRING)
-		strcpy(buf, "string");
-	if (val == S_OTHER)
-		strcpy(buf, "other");
-
-#ifdef DEBUG
-	printf("%s", buf);
-#endif
-
-	return buf;
-}
-
-const char *dbg_print_flags(int val)
+const char *dbg_sym_flags(int val)
 {
 	static char buf[256];
 
@@ -131,40 +102,10 @@ const char *dbg_print_flags(int val)
 		strcat(buf, "auto/");
 
 	buf[strlen(buf) - 1] = '\0';
-#ifdef DEBUG
-	printf("%s", buf);
-#endif
-
-	return buf;
-}
-
-const char *dbg_print_ptype(int val)
-{
-	static char buf[256];
-
-	bzero(buf, 256);
-
-	if (val == P_UNKNOWN)
-		strcpy(buf, "unknown");
-	if (val == P_PROMPT)
-		strcpy(buf, "prompt");
-	if (val == P_COMMENT)
-		strcpy(buf, "comment");
-	if (val == P_MENU)
-		strcpy(buf, "menu");
-	if (val == P_DEFAULT)
-		strcpy(buf, "default");
-	if (val == P_CHOICE)
-		strcpy(buf, "choice");
-
-#ifdef DEBUG
-	printf("%s", buf);
-#endif
 
 	return buf;
 }
 
-
 void replace_button_icon(GladeXML * xml, GdkDrawable * window,
 			 GtkStyle * style, gchar * btn_name, gchar ** xpm)
 {
@@ -1469,12 +1410,12 @@ static void display_tree(struct menu *menu)
 #ifdef DEBUG
 		printf("%*c%s: ", indent, ' ', menu_get_prompt(child));
 		printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : "");
-		dbg_print_ptype(ptype);
+		printf("%s", prop_get_type_name(ptype));
 		printf(" | ");
 		if (sym) {
-			dbg_print_stype(sym->type);
+			printf("%s", sym_type_name(sym->type));
 			printf(" | ");
-			dbg_print_flags(sym->flags);
+			printf("%s", dbg_sym_flags(sym->flags));
 			printf("\n");
 		} else
 			printf("\n");
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/6] gconfig: remove show_debug option
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
                   ` (2 preceding siblings ...)
  2010-04-14  3:44 ` [PATCH 3/6] gconfig: remove dbg_print_ptype() and dbg_print_stype() Li Zefan
@ 2010-04-14  3:44 ` Li Zefan
  2010-04-14  3:46 ` [PATCH 5/6] menuconfig: add support to show hidden options which have prompts Li Zefan
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:44 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

This option is a no-op, so remove it.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 scripts/kconfig/gconf.c     |    9 ---------
 scripts/kconfig/gconf.glade |   10 ----------
 2 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 80fe9ca..c6aa5a5 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -35,7 +35,6 @@ static gboolean show_name = TRUE;
 static gboolean show_range = TRUE;
 static gboolean show_value = TRUE;
 static gboolean show_all = FALSE;
-static gboolean show_debug = FALSE;
 static gboolean resizeable = FALSE;
 
 GtkWidget *main_wnd = NULL;
@@ -647,14 +646,6 @@ on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data)
 }
 
 
-void
-on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data)
-{
-	show_debug = GTK_CHECK_MENU_ITEM(menuitem)->active;
-	update_tree(&rootmenu, NULL);
-}
-
-
 void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
 	GtkWidget *dialog;
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade
index b1c86c1..909f5a4 100644
--- a/scripts/kconfig/gconf.glade
+++ b/scripts/kconfig/gconf.glade
@@ -200,16 +200,6 @@
 		    </widget>
 		  </child>
 
-		  <child>
-		    <widget class="GtkCheckMenuItem" id="show_debug_info1">
-		      <property name="visible">True</property>
-		      <property name="tooltip" translatable="yes">Show masked options</property>
-		      <property name="label" translatable="yes">Show _debug info</property>
-		      <property name="use_underline">True</property>
-		      <property name="active">False</property>
-		      <signal name="activate" handler="on_show_debug_info1_activate"/>
-		    </widget>
-		  </child>
 		</widget>
 	      </child>
 	    </widget>
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/6] menuconfig: add support to show hidden options which have prompts
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
                   ` (3 preceding siblings ...)
  2010-04-14  3:44 ` [PATCH 4/6] gconfig: remove show_debug option Li Zefan
@ 2010-04-14  3:46 ` Li Zefan
  2010-04-14 23:48   ` Randy Dunlap
  2010-04-14  3:46 ` [PATCH 6/6] gconfig: add support to show hidden options that " Li Zefan
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:46 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

Usage:
  Press <Z> to show all config symbols which have prompts.

Quote Tim Bird:

| I've been bitten by this numerous times.  I most often
| use ftrace on ARM, but when I go back to x86, I almost
| always go through a sequence of searching for the
| function graph tracer in the menus, then realizing it's
| completely missing until I disable CC_OPTIMIZE_FOR_SIZE.
|
| Is there any way to have the menu item appear, but be
| unsettable unless the SIZE option is disabled?  I'm
| not a Kconfig guru...

I myself found this useful too. For example, I need to test
ftrace/tracing and want to be sure all the tracing features are
enabled, so I  enter the "Tracers" menu, and press <Z> to
see if there is any config hidden.

I also noticed gconfig and xconfig have a button "Show all options",
but that's a bit too much, and I think normally what we are not
interested in those configs which have no prompt thus can't be
changed by users.

Exmaple:

      --- Tracers
      -*-   Kernel Function Tracer
      - -     Kernel Function Graph Tracer
      [*]   Interrupts-off Latency Tracer
      - -   Preemption-off Latency Tracer
      [*]   Sysprof Tracer

Here you can see 2 tracers are not selectable, and then can find
out how to make them selectable.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 scripts/kconfig/lkc_proto.h        |    3 ++-
 scripts/kconfig/lxdialog/menubox.c |   22 +++++++++++-----------
 scripts/kconfig/mconf.c            |   22 ++++++++++++++++++----
 scripts/kconfig/menu.c             |   10 ++++++++++
 4 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index ffeb532..15ab2b4 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -11,7 +11,8 @@ P(conf_set_changed_callback, void,(void (*fn)(void)));
 /* menu.c */
 P(rootmenu,struct menu,);
 
-P(menu_is_visible,bool,(struct menu *menu));
+P(menu_is_visible, bool, (struct menu *menu));
+P(menu_has_prompt, bool, (struct menu *menu));
 P(menu_get_prompt,const char *,(struct menu *menu));
 P(menu_get_root_menu,struct menu *,(struct menu *menu));
 P(menu_get_parent_menu,struct menu *,(struct menu *menu));
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index fa9d633..1d60473 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -383,6 +383,10 @@ do_resize:
 		case 'n':
 		case 'm':
 		case '/':
+		case 'h':
+		case '?':
+		case 'z':
+		case '\n':
 			/* save scroll info */
 			*s_scroll = scroll;
 			delwin(menu);
@@ -390,8 +394,10 @@ do_resize:
 			item_set(scroll + choice);
 			item_set_selected(1);
 			switch (key) {
+			case 'h':
+			case '?':
+				return 2;
 			case 's':
-				return 3;
 			case 'y':
 				return 3;
 			case 'n':
@@ -402,18 +408,12 @@ do_resize:
 				return 6;
 			case '/':
 				return 7;
+			case 'z':
+				return 8;
+			case '\n':
+				return button;
 			}
 			return 0;
-		case 'h':
-		case '?':
-			button = 2;
-		case '\n':
-			*s_scroll = scroll;
-			delwin(menu);
-			delwin(dialog);
-			item_set(scroll + choice);
-			item_set_selected(1);
-			return button;
 		case 'e':
 		case 'x':
 			key = KEY_ESC;
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 8413cf3..33f31eb 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -67,13 +67,15 @@ static const char mconf_readme[] = N_(
 "             there is a delayed response which you may find annoying.\n"
 "\n"
 "   Also, the <TAB> and cursor keys will cycle between <Select>,\n"
-"   <Exit> and <Help>\n"
+"   <Exit> and <Help>.\n"
 "\n"
 "o  To get help with an item, use the cursor keys to highlight <Help>\n"
-"   and Press <ENTER>.\n"
+"   and press <ENTER>.\n"
 "\n"
 "   Shortcut: Press <H> or <?>.\n"
 "\n"
+"o  To show hidden options, press <Z>.\n"
+"\n"
 "\n"
 "Radiolists  (Choice lists)\n"
 "-----------\n"
@@ -272,6 +274,7 @@ static int indent;
 static struct menu *current_menu;
 static int child_count;
 static int single_menu_mode;
+static int show_all_options;
 
 static void conf(struct menu *menu);
 static void conf_choice(struct menu *menu);
@@ -359,8 +362,16 @@ static void build_conf(struct menu *menu)
 	int type, tmp, doint = 2;
 	tristate val;
 	char ch;
-
-	if (!menu_is_visible(menu))
+	bool visible;
+
+	/*
+	 * note: menu_is_visible() has side effect that it will
+	 * recalc the value of the symbol.
+	 */
+	visible = menu_is_visible(menu);
+	if (show_all_options && !menu_has_prompt(menu))
+		return;
+	else if (!show_all_options && !visible)
 		return;
 
 	sym = menu->sym;
@@ -619,6 +630,9 @@ static void conf(struct menu *menu)
 		case 7:
 			search_conf();
 			break;
+		case 8:
+			show_all_options = !show_all_options;
+			break;
 		}
 	}
 }
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 6761055..e150176 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -390,6 +390,13 @@ void menu_finalize(struct menu *parent)
 	}
 }
 
+bool menu_has_prompt(struct menu *menu)
+{
+	if (!menu->prompt)
+		return false;
+	return true;
+}
+
 bool menu_is_visible(struct menu *menu)
 {
 	struct menu *child;
@@ -398,6 +405,7 @@ bool menu_is_visible(struct menu *menu)
 
 	if (!menu->prompt)
 		return false;
+
 	sym = menu->sym;
 	if (sym) {
 		sym_calc_value(sym);
@@ -407,12 +415,14 @@ bool menu_is_visible(struct menu *menu)
 
 	if (visible != no)
 		return true;
+
 	if (!sym || sym_get_tristate_value(menu->sym) == no)
 		return false;
 
 	for (child = menu->list; child; child = child->next)
 		if (menu_is_visible(child))
 			return true;
+
 	return false;
 }
 
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 6/6] gconfig: add support to show hidden options that have prompts
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
                   ` (4 preceding siblings ...)
  2010-04-14  3:46 ` [PATCH 5/6] menuconfig: add support to show hidden options which have prompts Li Zefan
@ 2010-04-14  3:46 ` Li Zefan
  2010-04-14 23:48   ` Randy Dunlap
  2010-04-14 13:57 ` [PATCH 0/6] kconfig: add support to show hidden options which " Michal Marek
  2010-04-14 23:00 ` Randy Dunlap
  7 siblings, 1 reply; 16+ messages in thread
From: Li Zefan @ 2010-04-14  3:46 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

There's a button in gconfig to "Show all options", but I think
normally we are not interested in those configs which have no
prompt and thus can't be changed, so here I add a new button to
show hidden options which have prompts.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 scripts/kconfig/gconf.c     |   47 ++++++++++++++++++++++++++++++++++--------
 scripts/kconfig/gconf.glade |   28 +++++++++++++++++++++++-
 2 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index c6aa5a5..bef1041 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -30,12 +30,16 @@ enum {
 	SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW
 };
 
+enum {
+	OPT_NORMAL, OPT_ALL, OPT_PROMPT
+};
+
 static gint view_mode = FULL_VIEW;
 static gboolean show_name = TRUE;
 static gboolean show_range = TRUE;
 static gboolean show_value = TRUE;
-static gboolean show_all = FALSE;
 static gboolean resizeable = FALSE;
+static int opt_mode = OPT_NORMAL;
 
 GtkWidget *main_wnd = NULL;
 GtkWidget *tree1_w = NULL;	// left  frame
@@ -637,12 +641,29 @@ void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data)
 
 
 void
-on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data)
+on_set_option_mode1_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	opt_mode = OPT_NORMAL;
+	gtk_tree_store_clear(tree2);
+	display_tree(&rootmenu);	/* instead of update_tree to speed-up */
+}
+
+
+void
+on_set_option_mode2_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
-	show_all = GTK_CHECK_MENU_ITEM(menuitem)->active;
+	opt_mode = OPT_ALL;
+	gtk_tree_store_clear(tree2);
+	display_tree(&rootmenu);	/* instead of update_tree to speed-up */
+}
+
 
+void
+on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+	opt_mode = OPT_PROMPT;
 	gtk_tree_store_clear(tree2);
-	display_tree(&rootmenu);	// instead of update_tree to speed-up
+	display_tree(&rootmenu);	/* instead of update_tree to speed-up */
 }
 
 
@@ -1095,7 +1116,10 @@ static gchar **fill_row(struct menu *menu)
 	    g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
 			    sym && sym_has_value(sym) ? "(NEW)" : "");
 
-	if (show_all && !menu_is_visible(menu))
+	if (opt_mode == OPT_ALL && !menu_is_visible(menu))
+		row[COL_COLOR] = g_strdup("DarkGray");
+	else if (opt_mode == OPT_PROMPT &&
+			menu_has_prompt(menu) && !menu_is_visible(menu))
 		row[COL_COLOR] = g_strdup("DarkGray");
 	else
 		row[COL_COLOR] = g_strdup("Black");
@@ -1318,16 +1342,19 @@ static void update_tree(struct menu *src, GtkTreeIter * dst)
 		       menu2 ? menu_get_prompt(menu2) : "nil");
 #endif
 
-		if (!menu_is_visible(child1) && !show_all) {	// remove node
+		if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) ||
+		    (opt_mode == OPT_PROMPT && !menu_has_prompt(child1))) {
+
+			/* remove node */
 			if (gtktree_iter_find_node(dst, menu1) != NULL) {
 				memcpy(&tmp, child2, sizeof(GtkTreeIter));
 				valid = gtk_tree_model_iter_next(model2,
 								 child2);
 				gtk_tree_store_remove(tree2, &tmp);
 				if (!valid)
-					return;	// next parent
+					return;		/* next parent */
 				else
-					goto reparse;	// next child
+					goto reparse;	/* next child */
 			} else
 				continue;
 		}
@@ -1396,7 +1423,9 @@ static void display_tree(struct menu *menu)
 		    && (tree == tree2))
 			continue;
 
-		if (menu_is_visible(child) || show_all)
+		if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) ||
+		    (opt_mode == OPT_PROMPT && menu_has_prompt(child)) ||
+		    (opt_mode == OPT_ALL))
 			place_node(child, fill_row(child));
 #ifdef DEBUG
 		printf("%*c%s: ", indent, ' ', menu_get_prompt(child));
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade
index 909f5a4..d52b0a7 100644
--- a/scripts/kconfig/gconf.glade
+++ b/scripts/kconfig/gconf.glade
@@ -190,13 +190,37 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkCheckMenuItem" id="show_all_options1">
+		    <widget class="GtkRadioMenuItem" id="set_option_mode1">
+		      <property name="visible">True</property>
+		      <property name="tooltip" translatable="yes">Show normal options</property>
+		      <property name="label" translatable="yes">Show normal options</property>
+		      <property name="use_underline">True</property>
+		      <property name="active">True</property>
+		      <signal name="activate" handler="on_set_option_mode1_activate"/>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioMenuItem" id="set_option_mode2">
 		      <property name="visible">True</property>
 		      <property name="tooltip" translatable="yes">Show all options</property>
 		      <property name="label" translatable="yes">Show all _options</property>
 		      <property name="use_underline">True</property>
 		      <property name="active">False</property>
-		      <signal name="activate" handler="on_show_all_options1_activate"/>
+		      <property name="group">set_option_mode1</property>
+		      <signal name="activate" handler="on_set_option_mode2_activate"/>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioMenuItem" id="set_option_mode3">
+		      <property name="visible">True</property>
+		      <property name="tooltip" translatable="yes">Show all options with prompts</property>
+		      <property name="label" translatable="yes">Show all prompt options</property>
+		      <property name="use_underline">True</property>
+		      <property name="active">False</property>
+		      <property name="group">set_option_mode1</property>
+		      <signal name="activate" handler="on_set_option_mode3_activate"/>
 		    </widget>
 		  </child>
 
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/6] kconfig: add support to show hidden options which have prompts
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
                   ` (5 preceding siblings ...)
  2010-04-14  3:46 ` [PATCH 6/6] gconfig: add support to show hidden options that " Li Zefan
@ 2010-04-14 13:57 ` Michal Marek
  2010-04-14 23:00 ` Randy Dunlap
  7 siblings, 0 replies; 16+ messages in thread
From: Michal Marek @ 2010-04-14 13:57 UTC (permalink / raw)
  To: Li Zefan; +Cc: LKML, Andrew Morton, Randy Dunlap, linux-kbuild, Tim Bird

On 14.4.2010 05:43, Li Zefan wrote:
> Usage:
>   (in menuconfig)
>   Press <Z> to show all config symbols which have prompts.
...
> Exmaple:
> 
>       --- Tracers
>       -*-   Kernel Function Tracer
>       - -     Kernel Function Graph Tracer
>       [*]   Interrupts-off Latency Tracer
>       - -   Preemption-off Latency Tracer
>       [*]   Sysprof Tracer
> 
> Here you can see 2 tracers are not selectable, and then can find
> out how to make them selectable.

This is really nice! Applied.

Michal


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/6] kconfig: add support to show hidden options which have prompts
  2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
                   ` (6 preceding siblings ...)
  2010-04-14 13:57 ` [PATCH 0/6] kconfig: add support to show hidden options which " Michal Marek
@ 2010-04-14 23:00 ` Randy Dunlap
  2010-04-15  7:29   ` Li Zefan
  7 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2010-04-14 23:00 UTC (permalink / raw)
  To: Li Zefan
  Cc: LKML, Andrew Morton, Randy Dunlap, Michal Marek, linux-kbuild, Tim Bird

On Wed, 14 Apr 2010 11:43:25 +0800 Li Zefan wrote:

> I noticed gconfig and xconfig have a button "Show all options",
> but that's a bit too much, and I think normally what we are not
> interested in those configs which have no prompt thus can't be
> changed by users.

Yes, I use that all of the time (i.e., once it has been set, it remains
set for the next execution, so I leave it that way).


> Exmaple:
> 
>       --- Tracers
>       -*-   Kernel Function Tracer
>       - -     Kernel Function Graph Tracer
>       [*]   Interrupts-off Latency Tracer
>       - -   Preemption-off Latency Tracer
>       [*]   Sysprof Tracer
> 
> Here you can see 2 tracers are not selectable, and then can find
> out how to make them selectable.
> 
> I also add this support for gconfig, but haven't done for xconfig.
> 
> btw: are there many users using gconfig/xconfig today ?

I use xconfig quite a bit, but only use gconfig for making sure that
it still works or displays a menu tree correctly.

---
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/6] menuconfig: add support to show hidden options which have prompts
  2010-04-14  3:46 ` [PATCH 5/6] menuconfig: add support to show hidden options which have prompts Li Zefan
@ 2010-04-14 23:48   ` Randy Dunlap
  2010-04-15  7:31     ` Li Zefan
  0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2010-04-14 23:48 UTC (permalink / raw)
  To: Li Zefan; +Cc: LKML, Andrew Morton, Michal Marek, linux-kbuild, Tim Bird

On Wed, 14 Apr 2010 11:46:02 +0800 Li Zefan wrote:

> Usage:
>   Press <Z> to show all config symbols which have prompts.

to show or unshow (toggle) all config symbols which have prompts.

Nice and helpful, yes, thanks.


> diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
> index 8413cf3..33f31eb 100644
> --- a/scripts/kconfig/mconf.c
> +++ b/scripts/kconfig/mconf.c
> @@ -67,13 +67,15 @@ static const char mconf_readme[] = N_(
>  "             there is a delayed response which you may find annoying.\n"
>  "\n"
>  "   Also, the <TAB> and cursor keys will cycle between <Select>,\n"
> -"   <Exit> and <Help>\n"
> +"   <Exit> and <Help>.\n"
>  "\n"
>  "o  To get help with an item, use the cursor keys to highlight <Help>\n"
> -"   and Press <ENTER>.\n"
> +"   and press <ENTER>.\n"
>  "\n"
>  "   Shortcut: Press <H> or <?>.\n"
>  "\n"
> +"o  To show hidden options, press <Z>.\n"

maybe:
       To toggle the display of hidden options, press <Z>.
or     To alternate the ...
?

> +"\n"
>  "\n"
>  "Radiolists  (Choice lists)\n"
>  "-----------\n"

---
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/6] gconfig: add support to show hidden options that have prompts
  2010-04-14  3:46 ` [PATCH 6/6] gconfig: add support to show hidden options that " Li Zefan
@ 2010-04-14 23:48   ` Randy Dunlap
  2010-04-15  7:43     ` Li Zefan
  0 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2010-04-14 23:48 UTC (permalink / raw)
  To: Li Zefan; +Cc: LKML, Andrew Morton, Michal Marek, linux-kbuild, Tim Bird

On Wed, 14 Apr 2010 11:46:24 +0800 Li Zefan wrote:

> There's a button in gconfig to "Show all options", but I think
> normally we are not interested in those configs which have no
> prompt and thus can't be changed, so here I add a new button to
> show hidden options which have prompts.

(The new option is called "Show all prompt options".)

These patches are looking good so far in my limited testing.

However, if gconfig is going to live, it needs at least one more thing:
it should display the kconfig symbol type (tristate, boolean, etc.)
like xconfig does (explicitly) and menuconfig does (by using [x] or <x>
in the menu).

thanks,
---
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/6] kconfig: add support to show hidden options which have prompts
  2010-04-14 23:00 ` Randy Dunlap
@ 2010-04-15  7:29   ` Li Zefan
  0 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-15  7:29 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: LKML, Andrew Morton, Michal Marek, linux-kbuild, Tim Bird

>> Exmaple:
>>
>>       --- Tracers
>>       -*-   Kernel Function Tracer
>>       - -     Kernel Function Graph Tracer
>>       [*]   Interrupts-off Latency Tracer
>>       - -   Preemption-off Latency Tracer
>>       [*]   Sysprof Tracer
>>
>> Here you can see 2 tracers are not selectable, and then can find
>> out how to make them selectable.
>>
>> I also add this support for gconfig, but haven't done for xconfig.
>>
>> btw: are there many users using gconfig/xconfig today ?
> 
> I use xconfig quite a bit, but only use gconfig for making sure that
> it still works or displays a menu tree correctly.
> 

Ok, I wanted to make sure it worth effort to working on gconf/xconf.
(I always use menuconfig.)

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/6] menuconfig: add support to show hidden options which have prompts
  2010-04-14 23:48   ` Randy Dunlap
@ 2010-04-15  7:31     ` Li Zefan
  2010-04-15  7:54       ` Michal Marek
  0 siblings, 1 reply; 16+ messages in thread
From: Li Zefan @ 2010-04-15  7:31 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: LKML, Andrew Morton, Michal Marek, linux-kbuild, Tim Bird

>> --- a/scripts/kconfig/mconf.c
>> +++ b/scripts/kconfig/mconf.c
>> @@ -67,13 +67,15 @@ static const char mconf_readme[] = N_(
>>  "             there is a delayed response which you may find annoying.\n"
>>  "\n"
>>  "   Also, the <TAB> and cursor keys will cycle between <Select>,\n"
>> -"   <Exit> and <Help>\n"
>> +"   <Exit> and <Help>.\n"
>>  "\n"
>>  "o  To get help with an item, use the cursor keys to highlight <Help>\n"
>> -"   and Press <ENTER>.\n"
>> +"   and press <ENTER>.\n"
>>  "\n"
>>  "   Shortcut: Press <H> or <?>.\n"
>>  "\n"
>> +"o  To show hidden options, press <Z>.\n"
> 
> maybe:
>        To toggle the display of hidden options, press <Z>.
> or     To alternate the ...
> ?
> 

Sure, it does looks better. will include this change
in a next patchset.

>> +"\n"
>>  "\n"
>>  "Radiolists  (Choice lists)\n"
>>  "-----------\n"

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 6/6] gconfig: add support to show hidden options that have prompts
  2010-04-14 23:48   ` Randy Dunlap
@ 2010-04-15  7:43     ` Li Zefan
  0 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-15  7:43 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: LKML, Andrew Morton, Michal Marek, linux-kbuild, Tim Bird

Randy Dunlap wrote:
> On Wed, 14 Apr 2010 11:46:24 +0800 Li Zefan wrote:
> 
>> There's a button in gconfig to "Show all options", but I think
>> normally we are not interested in those configs which have no
>> prompt and thus can't be changed, so here I add a new button to
>> show hidden options which have prompts.
> 
> (The new option is called "Show all prompt options".)
> 
> These patches are looking good so far in my limited testing.
> 
> However, if gconfig is going to live, it needs at least one more thing:
> it should display the kconfig symbol type (tristate, boolean, etc.)
> like xconfig does (explicitly) and menuconfig does (by using [x] or <x>
> in the menu).
> 

Hmm, I think I can spend some time on this.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/6] menuconfig: add support to show hidden options which have prompts
  2010-04-15  7:31     ` Li Zefan
@ 2010-04-15  7:54       ` Michal Marek
  2010-04-15  8:02         ` Li Zefan
  0 siblings, 1 reply; 16+ messages in thread
From: Michal Marek @ 2010-04-15  7:54 UTC (permalink / raw)
  To: Li Zefan; +Cc: Randy Dunlap, LKML, Andrew Morton, linux-kbuild, Tim Bird

On 15.4.2010 09:31, Li Zefan wrote:
>>> +"o  To show hidden options, press <Z>.\n"
>>
>> maybe:
>>        To toggle the display of hidden options, press <Z>.
>> or     To alternate the ...
>> ?
>>
> 
> Sure, it does looks better. will include this change
> in a next patchset.

Please send an incremental patch if you want to change the help text, I
already merged your first version.

Michal

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/6] menuconfig: add support to show hidden options which have prompts
  2010-04-15  7:54       ` Michal Marek
@ 2010-04-15  8:02         ` Li Zefan
  0 siblings, 0 replies; 16+ messages in thread
From: Li Zefan @ 2010-04-15  8:02 UTC (permalink / raw)
  To: Michal Marek; +Cc: Randy Dunlap, LKML, Andrew Morton, linux-kbuild, Tim Bird

15:54, Michal Marek wrote:
> On 15.4.2010 09:31, Li Zefan wrote:
>>>> +"o  To show hidden options, press <Z>.\n"
>>> maybe:
>>>        To toggle the display of hidden options, press <Z>.
>>> or     To alternate the ...
>>> ?
>>>
>> Sure, it does looks better. will include this change
>> in a next patchset.
> 
> Please send an incremental patch if you want to change the help text, I
> already merged your first version.
> 

That's what I meant. ;)

I'll do some more fixes and improvements, which is the phrase
"a next patchset" meant.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-04-15  8:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-14  3:43 [PATCH 0/6] kconfig: add support to show hidden options which have prompts Li Zefan
2010-04-14  3:44 ` [PATCH 1/6] kconfig: some small fixes Li Zefan
2010-04-14  3:44 ` [PATCH 2/6] kconfig: fix zconfdump() Li Zefan
2010-04-14  3:44 ` [PATCH 3/6] gconfig: remove dbg_print_ptype() and dbg_print_stype() Li Zefan
2010-04-14  3:44 ` [PATCH 4/6] gconfig: remove show_debug option Li Zefan
2010-04-14  3:46 ` [PATCH 5/6] menuconfig: add support to show hidden options which have prompts Li Zefan
2010-04-14 23:48   ` Randy Dunlap
2010-04-15  7:31     ` Li Zefan
2010-04-15  7:54       ` Michal Marek
2010-04-15  8:02         ` Li Zefan
2010-04-14  3:46 ` [PATCH 6/6] gconfig: add support to show hidden options that " Li Zefan
2010-04-14 23:48   ` Randy Dunlap
2010-04-15  7:43     ` Li Zefan
2010-04-14 13:57 ` [PATCH 0/6] kconfig: add support to show hidden options which " Michal Marek
2010-04-14 23:00 ` Randy Dunlap
2010-04-15  7:29   ` Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.