Commit 685e56d2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull kconfig updates from Michal Marek:
 - use pkg-config to detect curses libraries
 - clean up the way curses headers are searched
 - Some randconfig fixes, of which one had to be reverted
 - KCONFIG_SEED for randconfig debugging
 - memuconfig memory leak plugged
 - menuconfig > breadcrumbs > navigation
 - xconfig compilation fix
 - Other minor fixes

* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kconfig: fix lists definition for C++
  Revert "kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG"
  kconfig: implement KCONFIG_PROBABILITY for randconfig
  kconfig: allow specifying the seed for randconfig
  kconfig: fix randomising choice entries in presence of KCONFIG_ALLCONFIG
  kconfig: do not override symbols already set
  kconfig: fix randconfig tristate detection
  kconfig/lxdialog: rationalise the include paths where to find {.n}curses{,w}.h
  menuconfig: Add "breadcrumbs" navigation aid
  menuconfig: Fix memory leak introduced by jump keys feature
  merge_config.sh: Avoid creating unnessary source softlinks
  kconfig: optionally use pkg-config to detect ncurses libs
  menuconfig: optionally use pkg-config to detect ncurses libs
parents 57c29bd3 21ca352b
Loading
Loading
Loading
Loading
+36 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,42 @@ These examples will disable most options (allnoconfig) but enable or
disable the options that are explicitly listed in the specified
disable the options that are explicitly listed in the specified
mini-config files.
mini-config files.


______________________________________________________________________
Environment variables for 'randconfig'

KCONFIG_SEED
--------------------------------------------------
You can set this to the integer value used to seed the RNG, if you want
to somehow debug the behaviour of the kconfig parser/frontends.
If not set, the current time will be used.

KCONFIG_PROBABILITY
--------------------------------------------------
This variable can be used to skew the probabilities. This variable can
be unset or empty, or set to three different formats:
	KCONFIG_PROBABILITY     y:n split           y:m:n split
	-----------------------------------------------------------------
	unset or empty          50  : 50            33  : 33  : 34
	N                        N  : 100-N         N/2 : N/2 : 100-N
    [1] N:M                     N+M : 100-(N+M)      N  :  M  : 100-(N+M)
    [2] N:M:L                    N  : 100-N          M  :  L  : 100-(M+L)

where N, M and L are integers (in base 10) in the range [0,100], and so
that:
    [1] N+M is in the range [0,100]
    [2] M+L is in the range [0,100]

Examples:
	KCONFIG_PROBABILITY=10
		10% of booleans will be set to 'y', 90% to 'n'
		5% of tristates will be set to 'y', 5% to 'm', 90% to 'n'
	KCONFIG_PROBABILITY=15:25
		40% of booleans will be set to 'y', 60% to 'n'
		15% of tristates will be set to 'y', 25% to 'm', 60% to 'n'
	KCONFIG_PROBABILITY=10:15:15
		10% of booleans will be set to 'y', 90% to 'n'
		15% of tristates will be set to 'y', 15% to 'm', 70% to 'n'

______________________________________________________________________
______________________________________________________________________
Environment variables for 'silentoldconfig'
Environment variables for 'silentoldconfig'


+3 −1
Original line number Original line Diff line number Diff line
@@ -219,7 +219,9 @@ HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \


HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOSTLOADLIBES_mconf   = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))


HOSTLOADLIBES_nconf	= -lmenu -lpanel -lncurses
HOSTLOADLIBES_nconf	= $(shell \
				pkg-config --libs menu panel ncurses 2>/dev/null \
				|| echo "-lmenu -lpanel -lncurses"  )
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
$(obj)/qconf.o: $(obj)/.tmp_qtcheck


ifeq ($(qconf-target),1)
ifeq ($(qconf-target),1)
+11 −1
Original line number Original line Diff line number Diff line
@@ -13,6 +13,7 @@
#include <getopt.h>
#include <getopt.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/time.h>
#include <errno.h>


#include "lkc.h"
#include "lkc.h"


@@ -514,14 +515,23 @@ int main(int ac, char **av)
		{
		{
			struct timeval now;
			struct timeval now;
			unsigned int seed;
			unsigned int seed;
			char *seed_env;


			/*
			/*
			 * Use microseconds derived seed,
			 * Use microseconds derived seed,
			 * compensate for systems where it may be zero
			 * compensate for systems where it may be zero
			 */
			 */
			gettimeofday(&now, NULL);
			gettimeofday(&now, NULL);

			seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
			seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));

			seed_env = getenv("KCONFIG_SEED");
			if( seed_env && *seed_env ) {
				char *endp;
				int tmp = (int)strtol(seed_env, &endp, 10);
				if (*endp == '\0') {
					seed = tmp;
				}
			}
			srand(seed);
			srand(seed);
			break;
			break;
		}
		}
+55 −4
Original line number Original line Diff line number Diff line
@@ -1106,10 +1106,54 @@ static void set_all_choice_values(struct symbol *csym)
void conf_set_all_new_symbols(enum conf_def_mode mode)
void conf_set_all_new_symbols(enum conf_def_mode mode)
{
{
	struct symbol *sym, *csym;
	struct symbol *sym, *csym;
	int i, cnt;
	int i, cnt, pby, pty, ptm;	/* pby: probability of boolean  = y
					 * pty: probability of tristate = y
					 * ptm: probability of tristate = m
					 */

	pby = 50; pty = ptm = 33; /* can't go as the default in switch-case
				   * below, otherwise gcc whines about
				   * -Wmaybe-uninitialized */
	if (mode == def_random) {
		int n, p[3];
		char *env = getenv("KCONFIG_PROBABILITY");
		n = 0;
		while( env && *env ) {
			char *endp;
			int tmp = strtol( env, &endp, 10 );
			if( tmp >= 0 && tmp <= 100 ) {
				p[n++] = tmp;
			} else {
				errno = ERANGE;
				perror( "KCONFIG_PROBABILITY" );
				exit( 1 );
			}
			env = (*endp == ':') ? endp+1 : endp;
			if( n >=3 ) {
				break;
			}
		}
		switch( n ) {
		case 1:
			pby = p[0]; ptm = pby/2; pty = pby-ptm;
			break;
		case 2:
			pty = p[0]; ptm = p[1]; pby = pty + ptm;
			break;
		case 3:
			pby = p[0]; pty = p[1]; ptm = p[2];
			break;
		}

		if( pty+ptm > 100 ) {
			errno = ERANGE;
			perror( "KCONFIG_PROBABILITY" );
			exit( 1 );
		}
	}


	for_all_symbols(i, sym) {
	for_all_symbols(i, sym) {
		if (sym_has_value(sym))
		if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
			continue;
			continue;
		switch (sym_get_type(sym)) {
		switch (sym_get_type(sym)) {
		case S_BOOLEAN:
		case S_BOOLEAN:
@@ -1125,8 +1169,15 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)
				sym->def[S_DEF_USER].tri = no;
				sym->def[S_DEF_USER].tri = no;
				break;
				break;
			case def_random:
			case def_random:
				cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
				sym->def[S_DEF_USER].tri = no;
				sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
				cnt = rand() % 100;
				if (sym->type == S_TRISTATE) {
					if (cnt < pty)
						sym->def[S_DEF_USER].tri = yes;
					else if (cnt < (pty+ptm))
						sym->def[S_DEF_USER].tri = mod;
				} else if (cnt < pby)
					sym->def[S_DEF_USER].tri = yes;
				break;
				break;
			default:
			default:
				continue;
				continue;
+40 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,19 @@ struct list_head {
	     &pos->member != (head); 	\
	     &pos->member != (head); 	\
	     pos = list_entry(pos->member.next, typeof(*pos), member))
	     pos = list_entry(pos->member.next, typeof(*pos), member))


/**
 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
 * @pos:	the type * to use as a loop cursor.
 * @n:		another type * to use as temporary storage
 * @head:	the head for your list.
 * @member:	the name of the list_struct within the struct.
 */
#define list_for_each_entry_safe(pos, n, head, member)			\
	for (pos = list_entry((head)->next, typeof(*pos), member),	\
		n = list_entry(pos->member.next, typeof(*pos), member);	\
	     &pos->member != (head);					\
	     pos = n, n = list_entry(n->member.next, typeof(*n), member))

/**
/**
 * list_empty - tests whether a list is empty
 * list_empty - tests whether a list is empty
 * @head: the list to test.
 * @head: the list to test.
@@ -88,4 +101,31 @@ static inline void list_add_tail(struct list_head *_new, struct list_head *head)
	__list_add(_new, head->prev, head);
	__list_add(_new, head->prev, head);
}
}


/*
 * Delete a list entry by making the prev/next entries
 * point to each other.
 *
 * This is only for internal list manipulation where we know
 * the prev/next entries already!
 */
static inline void __list_del(struct list_head *prev, struct list_head *next)
{
	next->prev = prev;
	prev->next = next;
}

#define LIST_POISON1  ((void *) 0x00100100)
#define LIST_POISON2  ((void *) 0x00200200)
/**
 * list_del - deletes entry from list.
 * @entry: the element to delete from the list.
 * Note: list_empty() on entry does not return true after this, the entry is
 * in an undefined state.
 */
static inline void list_del(struct list_head *entry)
{
	__list_del(entry->prev, entry->next);
	entry->next = (struct list_head*)LIST_POISON1;
	entry->prev = (struct list_head*)LIST_POISON2;
}
#endif
#endif
Loading