scripts/kconfig/conf.c
Source file repositories/reference/linux-study-clean/scripts/kconfig/conf.c
File Facts
- System
- Linux kernel
- Corpus path
scripts/kconfig/conf.c- Extension
.c- Size
- 18913 bytes
- Lines
- 868
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
ctype.hlimits.hstdio.hstdlib.hstring.htime.hunistd.hgetopt.hsys/time.herrno.hinternal.hlkc.h
Detected Declarations
enum input_modeenum conf_def_modefunction print_helpfunction stripfunction xfgetsfunction set_randconfig_seedfunction randomize_choice_valuesfunction menu_for_each_sub_entryfunction conf_set_all_new_symbolsfunction menu_for_each_entryfunction conf_rewrite_tristatesfunction for_all_symbolsfunction conf_askvaluefunction conf_stringfunction conf_symfunction conf_choicefunction conffunction check_conffunction conf_usagefunction main
Annotated Snippet
menu_for_each_sub_entry(menu, choice) {
struct symbol *sym = menu->sym;
if (sym && !sym_has_value(sym))
x--;
if (x < 0) {
sym->def[S_DEF_USER].tri = yes;
sym->flags |= SYMBOL_DEF_USER;
/*
* Move the selected item to the _tail_ because
* this needs to have a lower priority than the
* user input from KCONFIG_ALLCONFIG.
*/
list_move_tail(&sym->choice_link,
&choice->choice_members);
break;
}
}
cnt--;
}
}
enum conf_def_mode {
def_default,
def_yes,
def_mod,
def_no,
def_random
};
static void conf_set_all_new_symbols(enum conf_def_mode mode)
{
struct menu *menu;
int cnt;
/*
* can't go as the default in switch-case below, otherwise gcc whines
* about -Wmaybe-uninitialized
*/
int pby = 50; /* probability of bool = y */
int pty = 33; /* probability of tristate = y */
int ptm = 33; /* probability of tristate = m */
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);
}
}
menu_for_each_entry(menu) {
Annotation
- Immediate include surface: `ctype.h`, `limits.h`, `stdio.h`, `stdlib.h`, `string.h`, `time.h`, `unistd.h`, `getopt.h`.
- Detected declarations: `enum input_mode`, `enum conf_def_mode`, `function print_help`, `function strip`, `function xfgets`, `function set_randconfig_seed`, `function randomize_choice_values`, `function menu_for_each_sub_entry`, `function conf_set_all_new_symbols`, `function menu_for_each_entry`.
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.