Skip to content

Commit 52aede4

Browse files
ulfalizermasahir0y
authored andcommitted
kconfig: Document the 'symbol' struct
Visibility and choices in particular might be a bit tricky to figure out. Also fix existing comment to point out that P_MENU is also used for menus. Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 33ca1a2 commit 52aede4

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

‎scripts/kconfig/expr.h‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,60 @@ enum {
7474
S_DEF_COUNT
7575
};
7676

77+
/*
78+
* Represents a configuration symbol.
79+
*
80+
* Choices are represented as a special kind of symbol and have the
81+
* SYMBOL_CHOICE bit set in 'flags'.
82+
*/
7783
struct symbol {
84+
/* The next symbol in the same bucket in the symbol hash table */
7885
struct symbol *next;
86+
87+
/* The name of the symbol, e.g. "FOO" for 'config FOO' */
7988
char *name;
89+
90+
/* S_BOOLEAN, S_TRISTATE, ... */
8091
enum symbol_type type;
92+
93+
/*
94+
* The calculated value of the symbol. The SYMBOL_VALID bit is set in
95+
* 'flags' when this is up to date. Note that this value might differ
96+
* from the user value set in e.g. a .config file, due to visibility.
97+
*/
8198
struct symbol_value curr;
99+
100+
/*
101+
* Values for the symbol provided from outside. def[S_DEF_USER] holds
102+
* the .config value.
103+
*/
82104
struct symbol_value def[S_DEF_COUNT];
105+
106+
/*
107+
* An upper bound on the tristate value the user can set for the symbol
108+
* if it is a boolean or tristate. Calculated from prompt dependencies,
109+
* which also inherit dependencies from enclosing menus, choices, and
110+
* ifs. If 'n', the user value will be ignored.
111+
*
112+
* Symbols lacking prompts always have visibility 'n'.
113+
*/
83114
tristate visible;
115+
116+
/* SYMBOL_* flags */
84117
int flags;
118+
119+
/* List of properties. See prop_type. */
85120
struct property *prop;
121+
122+
/* Dependencies from enclosing menus, choices, and ifs */
86123
struct expr_value dir_dep;
124+
125+
/* Reverse dependencies through being selected by other symbols */
87126
struct expr_value rev_dep;
127+
128+
/*
129+
* "Weak" reverse dependencies through being implied by other symbols
130+
*/
88131
struct expr_value implied;
89132
};
90133

@@ -133,7 +176,7 @@ enum prop_type {
133176
P_UNKNOWN,
134177
P_PROMPT, /* prompt "foo prompt" or "BAZ Value" */
135178
P_COMMENT, /* text associated with a comment */
136-
P_MENU, /* prompt associated with a menuconfig option */
179+
P_MENU, /* prompt associated with a menu or menuconfig symbol */
137180
P_DEFAULT, /* default y */
138181
P_CHOICE, /* choice value */
139182
P_SELECT, /* select BAR */

0 commit comments

Comments
 (0)