menuconfig: Display current values with symbols.
PATCH 1/1 menuconfig: Display current values with symbols.
While investigating why a CONFIG_ symbol was not displayed, I was frustrated with finding each of the dependent symbol's values. This patch adds a display of the symbol's value along side the symbol's name.
---
One additional suggestion would be an easy way to navigate from the search screen to the spot in the menus where that CONFIG_ value is set. I could not figure out a clear and convenient method for that. Some of the menus are fairly long and since they are not sorted, can result in some frustration while searching for the individual setting.
scripts/kconfig/expr.c +16 -12
@@ -1013,6 +1013,19 @@ int expr_compare_type(enum expr_type t1,#endif } +void expr_print_symbol (void (*fn)(void *,struct symbol *,const char *),void *data,struct symbol *sym) +{ +char sym_value_str[5 ]; + +if (sym->name) { +fn (data, sym, sym->name); +if (snprintf (sym_value_str,5 ,"[=%s]" ,sym_get_string_value (sym)) <5 ) +fn (data, sym, sym_value_str); + }else { +fn (data,NULL ,"<choice>" ); + } +} +void expr_print (struct expr *e,void (*fn)(void *,struct symbol *,const char *),void *data,int prevtoken) {if (!e) {
@@ -1024,28 +1037,19 @@ void expr_print(struct expr *e, void (*ffn (data,NULL ,"(" );switch (e->type) {case E_SYMBOL : -if (e->left.sym->name) -fn (data, e->left.sym, e->left.sym->name); -else -fn (data,NULL ,"<choice>" ); +expr_print_symbol (fn, data, e->left.sym);break ;case E_NOT :fn (data,NULL ,"!" );expr_print (e->left.expr, fn, data,E_NOT );break ;case E_EQUAL : -if (e->left.sym->name) -fn (data, e->left.sym, e->left.sym->name); -else -fn (data,NULL ,"<choice>" ); +expr_print_symbol (fn, data, e->left.sym);fn (data,NULL ,"=" );fn (data, e->right.sym, e->right.sym->name);break ;case E_UNEQUAL : -if (e->left.sym->name) -fn (data, e->left.sym, e->left.sym->name); -else -fn (data,NULL ,"<choice>" ); +expr_print_symbol (fn, data, e->left.sym);fn (data,NULL ,"!=" );fn (data, e->right.sym, e->right.sym->name);break ;
Added kconfig maintainer to CC.
Quoted 27 lines · Robin Holt
While investigating why a
CONFIG_symbol was not displayed, I was frustrated with finding each of the dependent symbol's values. This patch adds a display of the symbol's value along side the symbol's name.Signed-off-by Robin Holt <[email protected]>---
One additional suggestion would be an easy way to navigate from the search screen to the spot in the menus where that
CONFIG_value is set. I could not figure out a clear and convenient method for that. Some of the menus are fairly long and since they are not sorted, can result in some frustration while searching for the individual setting.Index:
xpmem_numatools_kernel/scripts/kconfig/expr.c
===================================================================scripts/kconfig/expr.c +3
-0@@ -1013,6 +1013,19 @@ int expr_compare_type(enum expr_type t1,#endif } +void expr_print_symbol (void (*fn)(void *,struct symbol *,const char *),void *data,struct symbol *sym) +{ +char sym_value_str[5 ];
scripts/kconfig/expr.c int expr_compare_type(enum expr_type t1, · line 1028
Quoted 10 lines
scripts/kconfig/expr.c +10
-0+ +if (sym->name) { +fn (data, sym, sym->name); +if (snprintf (sym_value_str,5 ,"[=%s]" ,sym_get_string_value (sym)) <5 ) +fn (data, sym, sym_value_str); + }else { +fn (data,NULL ,"<choice>" ); + } +} +
The subject says menuconfig, but expr_print() is also used by xconfig. Did you check that xconfig still works after this change?
Thanks.
Michal
Quoted 39 lines
scripts/kconfig/expr.c +3
-13void expr_print (struct expr *e,void (*fn)(void *,struct symbol *,const char *),void *data,int prevtoken) {if (!e) {@@ -1024,28 +1037,19 @@ void expr_print(struct expr *e, void (*ffn (data,NULL ,"(" );switch (e->type) {case E_SYMBOL : -if (e->left.sym->name) -fn (data, e->left.sym, e->left.sym->name); -else -fn (data,NULL ,"<choice>" ); +expr_print_symbol (fn, data, e->left.sym);break ;case E_NOT :fn (data,NULL ,"!" );expr_print (e->left.expr, fn, data,E_NOT );break ;case E_EQUAL : -if (e->left.sym->name) -fn (data, e->left.sym, e->left.sym->name); -else -fn (data,NULL ,"<choice>" ); +expr_print_symbol (fn, data, e->left.sym);fn (data,NULL ,"=" );fn (data, e->right.sym, e->right.sym->name);break ;case E_UNEQUAL : -if (e->left.sym->name) -fn (data, e->left.sym, e->left.sym->name); -else -fn (data,NULL ,"<choice>" ); +expr_print_symbol (fn, data, e->left.sym);fn (data,NULL ,"!=" );fn (data, e->right.sym, e->right.sym->name);break ; --To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html