1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
---
confdata.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
Index: kconfig/confdata.c
===================================================================
--- kconfig.orig/confdata.c
+++ kconfig/confdata.c
@@ -982,7 +982,16 @@
void conf_set_all_new_symbols(enum conf_def_mode mode)
{
struct symbol *sym, *csym;
- int i, cnt;
+ int i, cnt, prob = 50;
+
+ if (mode == def_random) {
+ char *endp, *env = getenv("KCONFIG_PROBABILITY");
+ if (env && *env) {
+ int tmp = (int)strtol(env, &endp, 10);
+ if (*endp == '\0' && tmp >= 0 && tmp <= 100)
+ prob = tmp;
+ }
+ }
for_all_symbols(i, sym) {
if (sym_has_value(sym))
@@ -1001,8 +1010,15 @@
sym->def[S_DEF_USER].tri = no;
break;
case def_random:
- cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
- sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
+ cnt = (rand() % 100) - (100 - prob);
+ if (cnt < 0)
+ sym->def[S_DEF_USER].tri = no;
+ else
+ if ((sym_get_type(sym) == S_TRISTATE)
+ && (cnt > prob/2))
+ sym->def[S_DEF_USER].tri = mod;
+ else
+ sym->def[S_DEF_USER].tri = yes;
break;
default:
continue;
|