Skip to content

Commit b202c0d

Browse files
committed
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig updates from Michal Marek: - dependency solver fix for make defconfig - randconfig fixes, one of which had to be reverted again - more user-friendly sorting of search results - hex and range keywords support longs - fix for [mn]conf not to rely on particular behavior of the LINES and COLS variables - cleanup of magic constants in kconfig/lxdialog - [mn]conf formatting fixes - fix for scripts/config's help text in out-of-tree usage (under a different name) * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kconfig: allow "hex" and "range" to support longs Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG" kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG kconfig: loop as long as we changed some symbols in randconfig kconfig/[mn]conf: make it explicit in the search box that a regexp is possible kconfig: sort found symbols by relevance kconfig/conf: print the seed used to initialise the RNG for randconfig kconfig/conf: accept a base-16 seed for randconfig kconfig/conf: fix randconfig setting multiple symbols in a choice scripts/config: replace hard-coded script name by a dynamic value mconf/nconf: mark empty menus/menuconfigs different from non-empty ones nconf: use function calls instead of ncurses' variables LINES and COLS mconf: use function calls instead of ncurses' variables LINES and COLS kconfig/lxdialog: handle newline characters in print_autowrap() kconfig/lxdialog: Use new mininimum resize definitions in conf_choice() kconfig/lxdialog: Add definitions for mininimum (re)size values kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on
2 parents cb63fc2 + b57caaa commit b202c0d

19 files changed

Lines changed: 262 additions & 100 deletions

File tree

‎Documentation/kbuild/kconfig.txt‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,19 @@ Searching in menuconfig:
174174

175175
/^hotplug
176176

177+
When searching, symbols are sorted thus:
178+
- exact match first: an exact match is when the search matches
179+
the complete symbol name;
180+
- alphabetical order: when two symbols do not match exactly,
181+
they are sorted in alphabetical order (in the user's current
182+
locale).
183+
For example: ^ATH.K matches:
184+
ATH5K ATH9K ATH5K_AHB ATH5K_DEBUG [...] ATH6KL ATH6KL_DEBUG
185+
[...] ATH9K_AHB ATH9K_BTCOEX_SUPPORT ATH9K_COMMON [...]
186+
of which only ATH5K and ATH9K match exactly and so are sorted
187+
first (and in alphabetical order), then come all other symbols,
188+
sorted in alphabetical order.
189+
177190
______________________________________________________________________
178191
User interface options for 'menuconfig'
179192

‎scripts/config‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/bin/bash
22
# Manipulate options in a .config file from the command line
33

4+
myname=${0##*/}
5+
46
# If no prefix forced, use the default CONFIG_
57
CONFIG_="${CONFIG_-CONFIG_}"
68

79
usage() {
810
cat >&2 <<EOL
911
Manipulate options in a .config file from the command line.
1012
Usage:
11-
config options command ...
13+
$myname options command ...
1214
commands:
1315
--enable|-e option Enable option
1416
--disable|-d option Disable option
@@ -33,14 +35,14 @@ options:
3335
--file config-file .config file to change (default .config)
3436
--keep-case|-k Keep next symbols' case (dont' upper-case it)
3537
36-
config doesn't check the validity of the .config file. This is done at next
38+
$myname doesn't check the validity of the .config file. This is done at next
3739
make time.
3840
39-
By default, config will upper-case the given symbol. Use --keep-case to keep
41+
By default, $myname will upper-case the given symbol. Use --keep-case to keep
4042
the case of all following symbols unchanged.
4143
42-
config uses 'CONFIG_' as the default symbol prefix. Set the environment
43-
variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" config ...
44+
$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
45+
variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
4446
EOL
4547
exit 1
4648
}

‎scripts/kconfig/conf.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,12 @@ int main(int ac, char **av)
527527
seed_env = getenv("KCONFIG_SEED");
528528
if( seed_env && *seed_env ) {
529529
char *endp;
530-
int tmp = (int)strtol(seed_env, &endp, 10);
530+
int tmp = (int)strtol(seed_env, &endp, 0);
531531
if (*endp == '\0') {
532532
seed = tmp;
533533
}
534534
}
535+
fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed );
535536
srand(seed);
536537
break;
537538
}
@@ -653,7 +654,8 @@ int main(int ac, char **av)
653654
conf_set_all_new_symbols(def_default);
654655
break;
655656
case randconfig:
656-
conf_set_all_new_symbols(def_random);
657+
/* Really nothing to do in this loop */
658+
while (conf_set_all_new_symbols(def_random)) ;
657659
break;
658660
case defconfig:
659661
conf_set_all_new_symbols(def_default);

‎scripts/kconfig/confdata.c‎

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ void conf_set_changed_callback(void (*fn)(void))
10401040
conf_changed_callback = fn;
10411041
}
10421042

1043-
static void randomize_choice_values(struct symbol *csym)
1043+
static bool randomize_choice_values(struct symbol *csym)
10441044
{
10451045
struct property *prop;
10461046
struct symbol *sym;
@@ -1053,7 +1053,7 @@ static void randomize_choice_values(struct symbol *csym)
10531053
* In both cases stop.
10541054
*/
10551055
if (csym->curr.tri != yes)
1056-
return;
1056+
return false;
10571057

10581058
prop = sym_get_choice_prop(csym);
10591059

@@ -1077,13 +1077,18 @@ static void randomize_choice_values(struct symbol *csym)
10771077
else {
10781078
sym->def[S_DEF_USER].tri = no;
10791079
}
1080+
sym->flags |= SYMBOL_DEF_USER;
1081+
/* clear VALID to get value calculated */
1082+
sym->flags &= ~SYMBOL_VALID;
10801083
}
10811084
csym->flags |= SYMBOL_DEF_USER;
10821085
/* clear VALID to get value calculated */
10831086
csym->flags &= ~(SYMBOL_VALID);
1087+
1088+
return true;
10841089
}
10851090

1086-
static void set_all_choice_values(struct symbol *csym)
1091+
void set_all_choice_values(struct symbol *csym)
10871092
{
10881093
struct property *prop;
10891094
struct symbol *sym;
@@ -1100,10 +1105,10 @@ static void set_all_choice_values(struct symbol *csym)
11001105
}
11011106
csym->flags |= SYMBOL_DEF_USER;
11021107
/* clear VALID to get value calculated */
1103-
csym->flags &= ~(SYMBOL_VALID);
1108+
csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES);
11041109
}
11051110

1106-
void conf_set_all_new_symbols(enum conf_def_mode mode)
1111+
bool conf_set_all_new_symbols(enum conf_def_mode mode)
11071112
{
11081113
struct symbol *sym, *csym;
11091114
int i, cnt, pby, pty, ptm; /* pby: probability of boolean = y
@@ -1151,13 +1156,15 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
11511156
exit( 1 );
11521157
}
11531158
}
1159+
bool has_changed = false;
11541160

11551161
for_all_symbols(i, sym) {
11561162
if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
11571163
continue;
11581164
switch (sym_get_type(sym)) {
11591165
case S_BOOLEAN:
11601166
case S_TRISTATE:
1167+
has_changed = true;
11611168
switch (mode) {
11621169
case def_yes:
11631170
sym->def[S_DEF_USER].tri = yes;
@@ -1202,14 +1209,26 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
12021209
* selected in a choice block and we set it to yes,
12031210
* and the rest to no.
12041211
*/
1212+
if (mode != def_random) {
1213+
for_all_symbols(i, csym) {
1214+
if ((sym_is_choice(csym) && !sym_has_value(csym)) ||
1215+
sym_is_choice_value(csym))
1216+
csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES;
1217+
}
1218+
}
1219+
12051220
for_all_symbols(i, csym) {
12061221
if (sym_has_value(csym) || !sym_is_choice(csym))
12071222
continue;
12081223

12091224
sym_calc_value(csym);
12101225
if (mode == def_random)
1211-
randomize_choice_values(csym);
1212-
else
1226+
has_changed = randomize_choice_values(csym);
1227+
else {
12131228
set_all_choice_values(csym);
1229+
has_changed = true;
1230+
}
12141231
}
1232+
1233+
return has_changed;
12151234
}

‎scripts/kconfig/expr.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ struct symbol {
106106
#define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */
107107
#define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
108108

109+
/* choice values need to be set before calculating this symbol value */
110+
#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
111+
109112
#define SYMBOL_MAXLENGTH 256
110113
#define SYMBOL_HASHSIZE 9973
111114

‎scripts/kconfig/lkc.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ const char *conf_get_autoconfig_name(void);
8686
char *conf_get_default_confname(void);
8787
void sym_set_change_count(int count);
8888
void sym_add_change_count(int count);
89-
void conf_set_all_new_symbols(enum conf_def_mode mode);
89+
bool conf_set_all_new_symbols(enum conf_def_mode mode);
90+
void set_all_choice_values(struct symbol *csym);
9091

9192
struct conf_printer {
9293
void (*print_symbol)(FILE *, struct symbol *, const char *, void *);

‎scripts/kconfig/lkc_proto.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
1414
/* menu.c */
1515
P(rootmenu,struct menu,);
1616

17+
P(menu_is_empty, bool, (struct menu *menu));
1718
P(menu_is_visible, bool, (struct menu *menu));
1819
P(menu_has_prompt, bool, (struct menu *menu));
1920
P(menu_get_prompt,const char *,(struct menu *menu));

‎scripts/kconfig/lxdialog/checklist.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,16 @@ int dialog_checklist(const char *title, const char *prompt, int height,
132132
}
133133

134134
do_resize:
135-
if (getmaxy(stdscr) < (height + 6))
135+
if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN))
136136
return -ERRDISPLAYTOOSMALL;
137-
if (getmaxx(stdscr) < (width + 6))
137+
if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN))
138138
return -ERRDISPLAYTOOSMALL;
139139

140140
max_choice = MIN(list_height, item_count());
141141

142142
/* center dialog box on screen */
143-
x = (COLS - width) / 2;
144-
y = (LINES - height) / 2;
143+
x = (getmaxx(stdscr) - width) / 2;
144+
y = (getmaxy(stdscr) - height) / 2;
145145

146146
draw_shadow(stdscr, y, x, height, width);
147147

‎scripts/kconfig/lxdialog/dialog.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,20 @@ int item_is_tag(char tag);
200200
int on_key_esc(WINDOW *win);
201201
int on_key_resize(void);
202202

203+
/* minimum (re)size values */
204+
#define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */
205+
#define CHECKLIST_WIDTH_MIN 6
206+
#define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */
207+
#define INPUTBOX_WIDTH_MIN 2
208+
#define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */
209+
#define MENUBOX_WIDTH_MIN 65
210+
#define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */
211+
#define TEXTBOX_WIDTH_MIN 8
212+
#define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */
213+
#define YESNO_WIDTH_MIN 4
214+
#define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */
215+
#define WINDOW_WIDTH_MIN 80
216+
203217
int init_dialog(const char *backtitle);
204218
void set_dialog_backtitle(const char *backtitle);
205219
void set_dialog_subtitles(struct subtitle_list *subtitles);

‎scripts/kconfig/lxdialog/inputbox.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
5656
strcpy(instr, init);
5757

5858
do_resize:
59-
if (getmaxy(stdscr) <= (height - 2))
59+
if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN))
6060
return -ERRDISPLAYTOOSMALL;
61-
if (getmaxx(stdscr) <= (width - 2))
61+
if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN))
6262
return -ERRDISPLAYTOOSMALL;
6363

6464
/* center dialog box on screen */
65-
x = (COLS - width) / 2;
66-
y = (LINES - height) / 2;
65+
x = (getmaxx(stdscr) - width) / 2;
66+
y = (getmaxy(stdscr) - height) / 2;
6767

6868
draw_shadow(stdscr, y, x, height, width);
6969

0 commit comments

Comments
 (0)