scripts/kconfig/menu.c
Source file repositories/reference/linux-study-clean/scripts/kconfig/menu.c
File Facts
- System
- Linux kernel
- Corpus path
scripts/kconfig/menu.c- Extension
.c- Size
- 20686 bytes
- Lines
- 875
- 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.hstdarg.hstdlib.hstring.hlist.hxalloc.hlkc.hinternal.h
Detected Declarations
function menu_warnfunction prop_warnfunction _menu_initfunction menu_add_entryfunction menu_end_menufunction menu_add_depfunction menu_set_typefunction menu_add_visibilityfunction menu_add_exprfunction menu_add_symbolfunction menu_validate_numberfunction sym_check_propfunction _menu_finalizefunction menu_finalizefunction menu_has_promptfunction menu_is_emptyfunction menu_is_visiblefunction get_def_strfunction get_dep_strfunction __attribute__function get_prompt_strfunction get_symbol_props_strfunction for_all_propertiesfunction get_symbol_strfunction list_for_each_entryfunction get_relations_strfunction menu_get_ext_helpfunction menu_dump
Annotated Snippet
while ((menu = menu->parent) != NULL) {
if (!menu->visibility)
continue;
prop->visible.expr = expr_alloc_and(prop->visible.expr,
menu->visibility);
}
}
current_entry->prompt = prop;
prop->text = prompt;
return prop;
}
void menu_add_visibility(struct expr *expr)
{
current_entry->visibility = expr_alloc_and(current_entry->visibility,
expr);
}
void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
{
menu_add_prop(type, expr, dep);
}
void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep)
{
menu_add_prop(type, expr_alloc_symbol(sym), dep);
}
static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
{
return sym2->type == S_INT || sym2->type == S_HEX ||
(sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
}
static void sym_check_prop(struct symbol *sym)
{
struct property *prop;
struct symbol *sym2;
char *use;
for (prop = sym->prop; prop; prop = prop->next) {
switch (prop->type) {
case P_DEFAULT:
if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
prop->expr->type != E_SYMBOL)
prop_warn(prop,
"default for config symbol '%s'"
" must be a single symbol", sym->name);
if (prop->expr->type != E_SYMBOL)
break;
sym2 = prop_get_symbol(prop);
if (sym->type == S_HEX || sym->type == S_INT) {
if (!menu_validate_number(sym, sym2))
prop_warn(prop,
"'%s': number is invalid",
sym->name);
}
if (sym_is_choice(sym)) {
struct menu *choice = sym_get_choice_menu(sym2);
if (!choice || choice->sym != sym)
prop_warn(prop,
"choice default symbol '%s' is not contained in the choice",
sym2->name);
}
break;
case P_SELECT:
case P_IMPLY:
use = prop->type == P_SELECT ? "select" : "imply";
sym2 = prop_get_symbol(prop);
if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE)
prop_warn(prop,
"config symbol '%s' uses %s, but is "
"not bool or tristate", sym->name, use);
else if (sym2->type != S_UNKNOWN &&
sym2->type != S_BOOLEAN &&
sym2->type != S_TRISTATE)
prop_warn(prop,
"'%s' has wrong type. '%s' only "
"accept arguments of bool and "
"tristate type", sym2->name, use);
break;
case P_RANGE:
if (sym->type != S_INT && sym->type != S_HEX)
prop_warn(prop, "range is only allowed "
"for int or hex symbols");
if (!menu_validate_number(sym, prop->expr->left.sym) ||
Annotation
- Immediate include surface: `ctype.h`, `stdarg.h`, `stdlib.h`, `string.h`, `list.h`, `xalloc.h`, `lkc.h`, `internal.h`.
- Detected declarations: `function menu_warn`, `function prop_warn`, `function _menu_init`, `function menu_add_entry`, `function menu_end_menu`, `function menu_add_dep`, `function menu_set_type`, `function menu_add_visibility`, `function menu_add_expr`, `function menu_add_symbol`.
- 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.