2010-08-21 15:59:10 +02:00
|
|
|
---
|
2010-08-21 17:00:49 +02:00
|
|
|
confdata.c | 22 +++++++++++++++++++---
|
|
|
|
1 file changed, 19 insertions(+), 3 deletions(-)
|
2010-08-21 15:59:10 +02:00
|
|
|
|
2012-01-13 12:48:28 +01:00
|
|
|
Index: kconfig/confdata.c
|
2010-08-21 15:59:10 +02:00
|
|
|
===================================================================
|
2012-01-13 12:48:28 +01:00
|
|
|
--- kconfig.orig/confdata.c
|
|
|
|
+++ kconfig/confdata.c
|
|
|
|
@@ -982,7 +982,16 @@
|
2010-08-21 17:00:49 +02:00
|
|
|
void conf_set_all_new_symbols(enum conf_def_mode mode)
|
|
|
|
{
|
2010-08-21 15:59:10 +02:00
|
|
|
struct symbol *sym, *csym;
|
2010-08-21 17:00:49 +02:00
|
|
|
- int i, cnt;
|
|
|
|
+ int i, cnt, prob = 50;
|
2010-08-21 15:59:10 +02:00
|
|
|
+
|
|
|
|
+ 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))
|
2012-01-13 12:48:28 +01:00
|
|
|
@@ -1001,8 +1010,15 @@
|
2010-08-21 15:59:10 +02:00
|
|
|
sym->def[S_DEF_USER].tri = no;
|
|
|
|
break;
|
|
|
|
case def_random:
|
2010-08-21 17:00:49 +02:00
|
|
|
- cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
|
|
|
|
- sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
|
2010-08-21 15:59:10 +02:00
|
|
|
+ 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;
|