1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
23 /* return true if 'path' exists, false otherwise */
24 static bool is_present(const char *path
)
28 return !stat(path
, &st
);
31 /* return true if 'path' exists and it is a directory, false otherwise */
32 static bool is_dir(const char *path
)
39 return S_ISDIR(st
.st_mode
);
42 /* return true if the given two files are the same, false otherwise */
43 static bool is_same(const char *file1
, const char *file2
)
50 fd1
= open(file1
, O_RDONLY
);
54 fd2
= open(file2
, O_RDONLY
);
58 ret
= fstat(fd1
, &st1
);
61 ret
= fstat(fd2
, &st2
);
65 if (st1
.st_size
!= st2
.st_size
)
68 map1
= mmap(NULL
, st1
.st_size
, PROT_READ
, MAP_PRIVATE
, fd1
, 0);
69 if (map1
== MAP_FAILED
)
72 map2
= mmap(NULL
, st2
.st_size
, PROT_READ
, MAP_PRIVATE
, fd2
, 0);
73 if (map2
== MAP_FAILED
)
76 if (bcmp(map1
, map2
, st1
.st_size
))
89 * Create the parent directory of the given path.
91 * For example, if 'include/config/auto.conf' is given, create 'include/config'.
93 static int make_parent_dir(const char *path
)
95 char tmp
[PATH_MAX
+ 1];
98 strncpy(tmp
, path
, sizeof(tmp
));
99 tmp
[sizeof(tmp
) - 1] = 0;
101 /* Remove the base name. Just return if nothing is left */
102 p
= strrchr(tmp
, '/');
107 /* Just in case it is an absolute path */
112 while ((p
= strchr(p
, '/'))) {
115 /* skip if the directory exists */
116 if (!is_dir(tmp
) && mkdir(tmp
, 0755))
127 static char depfile_path
[PATH_MAX
];
128 static size_t depfile_prefix_len
;
130 /* touch depfile for symbol 'name' */
131 static int conf_touch_dep(const char *name
)
135 /* check overflow: prefix + name + '\0' must fit in buffer. */
136 if (depfile_prefix_len
+ strlen(name
) + 1 > sizeof(depfile_path
))
139 strcpy(depfile_path
+ depfile_prefix_len
, name
);
141 fd
= open(depfile_path
, O_WRONLY
| O_CREAT
| O_TRUNC
, 0644);
149 static void conf_warning(const char *fmt
, ...)
150 __attribute__ ((format (printf
, 1, 2)));
152 static void conf_message(const char *fmt
, ...)
153 __attribute__ ((format (printf
, 1, 2)));
155 static const char *conf_filename
;
156 static int conf_lineno
, conf_warnings
;
158 bool conf_errors(void)
161 return getenv("KCONFIG_WERROR");
166 #define mkdir(_n,_p) mkdir((_n))
169 static void conf_warning(const char *fmt
, ...)
173 fprintf(stderr
, "%s:%d:warning: ", conf_filename
, conf_lineno
);
174 vfprintf(stderr
, fmt
, ap
);
175 fprintf(stderr
, "\n");
180 static void conf_notice(const char *fmt
, ...)
184 fprintf(stderr
, "%s:%d:notice: ", conf_filename
, conf_lineno
);
185 vfprintf(stderr
, fmt
, ap
);
186 fprintf(stderr
, "\n");
190 static void conf_default_message_callback(const char *s
)
197 static void (*conf_message_callback
)(const char *s
) =
198 conf_default_message_callback
;
199 void conf_set_message_callback(void (*fn
)(const char *s
))
201 conf_message_callback
= fn
;
204 static void conf_message(const char *fmt
, ...)
209 if (!conf_message_callback
)
214 vsnprintf(buf
, sizeof(buf
), fmt
, ap
);
215 conf_message_callback(buf
);
219 const char *conf_get_configname(void)
221 char *name
= getenv("KCONFIG_CONFIG");
223 return name
? name
: ".config";
226 static const char *conf_get_autoconfig_name(void)
228 char *name
= getenv("KCONFIG_AUTOCONFIG");
230 return name
? name
: "include/config/auto.conf";
233 static const char *conf_get_autoheader_name(void)
235 char *name
= getenv("KCONFIG_AUTOHEADER");
237 return name
? name
: "include/generated/autoconf.h";
240 static const char *conf_get_rustccfg_name(void)
242 char *name
= getenv("KCONFIG_RUSTCCFG");
244 return name
? name
: "include/generated/rustc_cfg";
247 static const char *conf_get_autobase_name(void)
249 char *name
= getenv("KCONFIG_SPLITCONFIG");
251 return name
? name
: "include/config/";
254 static int conf_set_sym_val(struct symbol
*sym
, int def
, int def_flags
, char *p
)
261 sym
->def
[def
].tri
= mod
;
262 sym
->flags
|= def_flags
;
268 sym
->def
[def
].tri
= yes
;
269 sym
->flags
|= def_flags
;
273 sym
->def
[def
].tri
= no
;
274 sym
->flags
|= def_flags
;
277 if (def
!= S_DEF_AUTO
)
278 conf_warning("symbol value '%s' invalid for %s",
282 /* No escaping for S_DEF_AUTO (include/config/auto.conf) */
283 if (def
!= S_DEF_AUTO
) {
286 for (p2
= p
; (p2
= strpbrk(p2
, "\"\\")); p2
++) {
291 memmove(p2
, p2
+ 1, strlen(p2
));
294 conf_warning("invalid string found");
301 if (sym_string_valid(sym
, p
)) {
302 sym
->def
[def
].val
= xstrdup(p
);
303 sym
->flags
|= def_flags
;
305 if (def
!= S_DEF_AUTO
)
306 conf_warning("symbol value '%s' invalid for %s",
317 #define LINE_GROWTH 16
318 static int add_byte(int c
, char **lineptr
, size_t slen
, size_t *n
)
320 size_t new_size
= slen
+ 1;
323 new_size
+= LINE_GROWTH
- 1;
325 *lineptr
= xrealloc(*lineptr
, new_size
);
329 (*lineptr
)[slen
] = c
;
334 static ssize_t
compat_getline(char **lineptr
, size_t *n
, FILE *stream
)
336 char *line
= *lineptr
;
340 int c
= getc(stream
);
344 if (add_byte(c
, &line
, slen
, n
) < 0)
349 if (add_byte('\0', &line
, slen
, n
) < 0)
356 if (add_byte(c
, &line
, slen
, n
) < 0)
368 /* like getline(), but the newline character is stripped away */
369 static ssize_t
getline_stripped(char **lineptr
, size_t *n
, FILE *stream
)
373 len
= compat_getline(lineptr
, n
, stream
);
375 if (len
> 0 && (*lineptr
)[len
- 1] == '\n') {
377 (*lineptr
)[len
] = '\0';
379 if (len
> 0 && (*lineptr
)[len
- 1] == '\r') {
381 (*lineptr
)[len
] = '\0';
388 int conf_read_simple(const char *name
, int def
)
392 size_t line_asize
= 0;
396 const char *warn_unknown
, *sym_name
;
398 warn_unknown
= getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");
400 in
= zconf_fopen(name
);
404 name
= conf_get_configname();
405 in
= zconf_fopen(name
);
408 conf_set_changed(true);
410 env
= getenv("KCONFIG_DEFCONFIG_LIST");
417 while (isspace(*env
))
424 while (*p
&& !isspace(*p
))
427 is_last
= (*p
== '\0');
431 in
= zconf_fopen(env
);
433 conf_message("using defaults found in %s",
448 conf_filename
= name
;
452 def_flags
= SYMBOL_DEF
<< def
;
453 for_all_symbols(i
, sym
) {
454 sym
->flags
|= SYMBOL_CHANGED
;
455 sym
->flags
&= ~(def_flags
|SYMBOL_VALID
);
456 if (sym_is_choice(sym
))
457 sym
->flags
|= def_flags
;
462 free(sym
->def
[def
].val
);
465 sym
->def
[def
].val
= NULL
;
466 sym
->def
[def
].tri
= no
;
470 while (getline_stripped(&line
, &line_asize
, in
) != -1) {
473 if (!line
[0]) /* blank line */
476 if (line
[0] == '#') {
480 if (memcmp(p
, CONFIG_
, strlen(CONFIG_
)))
482 sym_name
= p
+ strlen(CONFIG_
);
483 p
= strchr(sym_name
, ' ');
487 if (strcmp(p
, "is not set"))
492 if (memcmp(line
, CONFIG_
, strlen(CONFIG_
))) {
493 conf_warning("unexpected data: %s", line
);
497 sym_name
= line
+ strlen(CONFIG_
);
498 p
= strchr(sym_name
, '=');
500 conf_warning("unexpected data: %s", line
);
507 sym
= sym_find(sym_name
);
509 if (def
== S_DEF_AUTO
) {
511 * Reading from include/config/auto.conf.
512 * If CONFIG_FOO previously existed in auto.conf
513 * but it is missing now, include/config/FOO
516 conf_touch_dep(sym_name
);
519 conf_warning("unknown symbol: %s", sym_name
);
521 conf_set_changed(true);
526 if (sym
->flags
& def_flags
)
527 conf_notice("override: reassigning to symbol %s", sym
->name
);
529 if (conf_set_sym_val(sym
, def
, def_flags
, val
))
532 if (sym
&& sym_is_choice_value(sym
)) {
533 struct symbol
*cs
= prop_get_symbol(sym_get_choice_prop(sym
));
534 switch (sym
->def
[def
].tri
) {
538 if (cs
->def
[def
].tri
== yes
) {
539 conf_warning("%s creates inconsistent choice state", sym
->name
);
540 cs
->flags
&= ~def_flags
;
544 if (cs
->def
[def
].tri
!= no
)
545 conf_notice("override: %s changes choice state", sym
->name
);
546 cs
->def
[def
].val
= sym
;
549 cs
->def
[def
].tri
= EXPR_OR(cs
->def
[def
].tri
, sym
->def
[def
].tri
);
558 int conf_read(const char *name
)
561 int conf_unsaved
= 0;
564 conf_set_changed(false);
566 if (conf_read_simple(name
, S_DEF_USER
)) {
567 sym_calc_value(modules_sym
);
571 sym_calc_value(modules_sym
);
573 for_all_symbols(i
, sym
) {
575 if (sym_is_choice(sym
) || (sym
->flags
& SYMBOL_NO_WRITE
))
577 if (sym_has_value(sym
) && (sym
->flags
& SYMBOL_WRITE
)) {
578 /* check that calculated value agrees with saved value */
582 if (sym
->def
[S_DEF_USER
].tri
== sym_get_tristate_value(sym
))
586 if (!strcmp(sym
->curr
.val
, sym
->def
[S_DEF_USER
].val
))
590 } else if (!sym_has_value(sym
) && !(sym
->flags
& SYMBOL_WRITE
))
591 /* no previous value and not saved */
594 /* maybe print value in verbose mode... */
597 for_all_symbols(i
, sym
) {
598 if (sym_has_value(sym
) && !sym_is_choice_value(sym
)) {
599 /* Reset values of generates values, so they'll appear
600 * as new, if they should become visible, but that
601 * doesn't quite work if the Kconfig and the saved
602 * configuration disagree.
604 if (sym
->visible
== no
&& !conf_unsaved
)
605 sym
->flags
&= ~SYMBOL_DEF_USER
;
610 /* Reset a string value if it's out of range */
611 if (sym_string_within_range(sym
, sym
->def
[S_DEF_USER
].val
))
613 sym
->flags
&= ~SYMBOL_VALID
;
622 if (conf_warnings
|| conf_unsaved
)
623 conf_set_changed(true);
628 struct comment_style
{
629 const char *decoration
;
634 static const struct comment_style comment_style_pound
= {
640 static const struct comment_style comment_style_c
= {
646 static void conf_write_heading(FILE *fp
, const struct comment_style
*cs
)
651 fprintf(fp
, "%s\n", cs
->prefix
);
653 fprintf(fp
, "%s Automatically generated file; DO NOT EDIT.\n",
656 fprintf(fp
, "%s %s\n", cs
->decoration
, rootmenu
.prompt
->text
);
658 fprintf(fp
, "%s\n", cs
->postfix
);
661 /* The returned pointer must be freed on the caller side */
662 static char *escape_string_value(const char *in
)
668 len
= strlen(in
) + strlen("\"\"") + 1;
672 p
+= strcspn(p
, "\"\\");
688 len
= strcspn(p
, "\"\\");
689 strncat(out
, p
, len
);
696 strncat(out
, p
++, 1);
704 enum output_n
{ OUTPUT_N
, OUTPUT_N_AS_UNSET
, OUTPUT_N_NONE
};
706 static void __print_symbol(FILE *fp
, struct symbol
*sym
, enum output_n output_n
,
710 char *escaped
= NULL
;
712 if (sym
->type
== S_UNKNOWN
)
715 val
= sym_get_string_value(sym
);
717 if ((sym
->type
== S_BOOLEAN
|| sym
->type
== S_TRISTATE
) &&
718 output_n
!= OUTPUT_N
&& *val
== 'n') {
719 if (output_n
== OUTPUT_N_AS_UNSET
)
720 fprintf(fp
, "# %s%s is not set\n", CONFIG_
, sym
->name
);
724 if (sym
->type
== S_STRING
&& escape_string
) {
725 escaped
= escape_string_value(val
);
729 fprintf(fp
, "%s%s=%s\n", CONFIG_
, sym
->name
, val
);
734 static void print_symbol_for_dotconfig(FILE *fp
, struct symbol
*sym
)
736 __print_symbol(fp
, sym
, OUTPUT_N_AS_UNSET
, true);
739 static void print_symbol_for_autoconf(FILE *fp
, struct symbol
*sym
)
741 int print_negatives
= getenv("KCONFIG_NEGATIVES") != NULL
;
742 enum output_n out
= OUTPUT_N_NONE
;
743 if (print_negatives
) {
746 __print_symbol(fp
, sym
, out
, false);
749 void print_symbol_for_listconfig(struct symbol
*sym
)
751 __print_symbol(stdout
, sym
, OUTPUT_N
, true);
754 static void print_symbol_for_c(FILE *fp
, struct symbol
*sym
)
757 const char *sym_suffix
= "";
758 const char *val_prefix
= "";
759 char *escaped
= NULL
;
761 if (sym
->type
== S_UNKNOWN
)
764 val
= sym_get_string_value(sym
);
771 if (getenv("KCONFIG_NEGATIVES") != NULL
) {
777 sym_suffix
= "_MODULE";
784 if (val
[0] != '0' || (val
[1] != 'x' && val
[1] != 'X'))
788 if (val
[0] == '\0') {
794 escaped
= escape_string_value(val
);
800 fprintf(fp
, "#define %s%s%s %s%s\n", CONFIG_
, sym
->name
, sym_suffix
,
806 static void print_symbol_for_rustccfg(FILE *fp
, struct symbol
*sym
)
809 const char *val_prefix
= "";
810 char *val_prefixed
= NULL
;
811 size_t val_prefixed_len
;
812 char *escaped
= NULL
;
814 if (sym
->type
== S_UNKNOWN
)
817 val
= sym_get_string_value(sym
);
823 * We do not care about disabled ones, i.e. no need for
824 * what otherwise are "comments" in other printers.
830 * To have similar functionality to the C macro `IS_ENABLED()`
831 * we provide an empty `--cfg CONFIG_X` here in both `y`
834 * Then, the common `fprintf()` below will also give us
835 * a `--cfg CONFIG_X="y"` or `--cfg CONFIG_X="m"`, which can
836 * be used as the equivalent of `IS_BUILTIN()`/`IS_MODULE()`.
838 fprintf(fp
, "--cfg=%s%s\n", CONFIG_
, sym
->name
);
841 if (val
[0] != '0' || (val
[1] != 'x' && val
[1] != 'X'))
848 if (strlen(val_prefix
) > 0) {
849 val_prefixed_len
= strlen(val
) + strlen(val_prefix
) + 1;
850 val_prefixed
= xmalloc(val_prefixed_len
);
851 snprintf(val_prefixed
, val_prefixed_len
, "%s%s", val_prefix
, val
);
855 /* All values get escaped: the `--cfg` option only takes strings */
856 escaped
= escape_string_value(val
);
859 fprintf(fp
, "--cfg=%s%s=%s\n", CONFIG_
, sym
->name
, val
);
866 * Write out a minimal config.
867 * All values that has default values are skipped as this is redundant.
869 int conf_write_defconfig(const char *filename
)
875 out
= fopen(filename
, "w");
879 sym_clear_all_valid();
881 /* Traverse all menus to find all relevant symbols */
882 menu
= rootmenu
.list
;
888 if (!menu_is_visible(menu
))
890 } else if (!sym_is_choice(sym
)) {
892 if (!(sym
->flags
& SYMBOL_WRITE
))
894 sym
->flags
&= ~SYMBOL_WRITE
;
895 /* If we cannot change the symbol - skip */
896 if (!sym_is_changeable(sym
))
898 /* If symbol equals to default value - skip */
899 if (strcmp(sym_get_string_value(sym
), sym_get_string_default(sym
)) == 0)
903 * If symbol is a choice value and equals to the
904 * default for a choice - skip.
905 * But only if value is bool and equal to "y" and
906 * choice is not "optional".
907 * (If choice is "optional" then all values can be "n")
909 if (sym_is_choice_value(sym
)) {
913 cs
= prop_get_symbol(sym_get_choice_prop(sym
));
914 ds
= sym_choice_default(cs
);
915 if (!sym_is_optional(cs
) && sym
== ds
) {
916 if ((sym
->type
== S_BOOLEAN
) &&
917 sym_get_tristate_value(sym
) == yes
)
921 print_symbol_for_dotconfig(out
, sym
);
924 if (menu
->list
!= NULL
) {
927 else if (menu
->next
!= NULL
) {
930 while ((menu
= menu
->parent
)) {
931 if (menu
->next
!= NULL
) {
942 int conf_write(const char *name
)
948 char tmpname
[PATH_MAX
+ 1], oldname
[PATH_MAX
+ 1];
951 bool need_newline
= false;
954 name
= conf_get_configname();
957 fprintf(stderr
, "config name is empty\n");
962 fprintf(stderr
, "%s: Is a directory\n", name
);
966 if (make_parent_dir(name
))
969 env
= getenv("KCONFIG_OVERWRITECONFIG");
972 out
= fopen(name
, "w");
974 snprintf(tmpname
, sizeof(tmpname
), "%s.%d.tmp",
975 name
, (int)getpid());
976 out
= fopen(tmpname
, "w");
981 conf_write_heading(out
, &comment_style_pound
);
983 if (!conf_get_changed())
984 sym_clear_all_valid();
986 menu
= rootmenu
.list
;
990 if (!menu_is_visible(menu
))
992 str
= menu_get_prompt(menu
);
997 need_newline
= false;
998 } else if (!(sym
->flags
& SYMBOL_CHOICE
) &&
999 !(sym
->flags
& SYMBOL_WRITTEN
)) {
1000 sym_calc_value(sym
);
1001 if (!(sym
->flags
& SYMBOL_WRITE
))
1005 need_newline
= false;
1007 sym
->flags
|= SYMBOL_WRITTEN
;
1008 print_symbol_for_dotconfig(out
, sym
);
1018 if (!menu
->sym
&& menu_is_visible(menu
) && menu
!= &rootmenu
&&
1019 menu
->prompt
->type
== P_MENU
) {
1020 fprintf(out
, "# end of %s\n", menu_get_prompt(menu
));
1021 need_newline
= true;
1027 menu
= menu
->parent
;
1034 for_all_symbols(i
, sym
)
1035 sym
->flags
&= ~SYMBOL_WRITTEN
;
1038 if (is_same(name
, tmpname
)) {
1039 conf_message("No change to %s", name
);
1041 conf_set_changed(false);
1045 snprintf(oldname
, sizeof(oldname
), "%s.old", name
);
1046 rename(name
, oldname
);
1047 if (rename(tmpname
, name
))
1051 conf_message("configuration written to %s", name
);
1053 conf_set_changed(false);
1058 /* write a dependency file as used by kbuild to track dependencies */
1059 static int conf_write_autoconf_cmd(const char *autoconf_name
)
1061 char name
[PATH_MAX
], tmp
[PATH_MAX
];
1066 ret
= snprintf(name
, sizeof(name
), "%s.cmd", autoconf_name
);
1067 if (ret
>= sizeof(name
)) /* check truncation */
1070 if (make_parent_dir(name
))
1073 ret
= snprintf(tmp
, sizeof(tmp
), "%s.cmd.tmp", autoconf_name
);
1074 if (ret
>= sizeof(tmp
)) /* check truncation */
1077 out
= fopen(tmp
, "w");
1083 fprintf(out
, "deps_config := \\\n");
1084 for (file
= file_list
; file
; file
= file
->next
)
1085 fprintf(out
, "\t%s \\\n", file
->name
);
1087 fprintf(out
, "\n%s: $(deps_config)\n\n", autoconf_name
);
1089 env_write_dep(out
, autoconf_name
);
1091 fprintf(out
, "\n$(deps_config): ;\n");
1094 ret
= ferror(out
); /* error check for all fprintf() calls */
1099 if (rename(tmp
, name
)) {
1107 static int conf_touch_deps(void)
1114 * Upstream Kconfig sets depfile_path based on the directory
1115 * prefix of the autoconfig path, but coreboot overrides this
1116 * using the KCONFIG_SPLITCONFIG environment variable
1118 strcpy(depfile_path
, conf_get_autobase_name());
1119 depfile_prefix_len
= strlen(depfile_path
);
1121 name
= conf_get_autoconfig_name();
1122 conf_read_simple(name
, S_DEF_AUTO
);
1123 sym_calc_value(modules_sym
);
1125 for_all_symbols(i
, sym
) {
1126 sym_calc_value(sym
);
1127 if ((sym
->flags
& SYMBOL_NO_WRITE
) || !sym
->name
)
1129 if (sym
->flags
& SYMBOL_WRITE
) {
1130 if (sym
->flags
& SYMBOL_DEF_AUTO
) {
1132 * symbol has old and new value,
1133 * so compare them...
1135 switch (sym
->type
) {
1138 if (sym_get_tristate_value(sym
) ==
1139 sym
->def
[S_DEF_AUTO
].tri
)
1145 if (!strcmp(sym_get_string_value(sym
),
1146 sym
->def
[S_DEF_AUTO
].val
))
1154 * If there is no old value, only 'no' (unset)
1155 * is allowed as new value.
1157 switch (sym
->type
) {
1160 if (sym_get_tristate_value(sym
) == no
)
1167 } else if (!(sym
->flags
& SYMBOL_DEF_AUTO
))
1168 /* There is neither an old nor a new value. */
1171 * There is an old value, but no new value ('no' (unset)
1172 * isn't saved in auto.conf, so the old value is always
1173 * different from 'no').
1176 res
= conf_touch_dep(sym
->name
);
1184 static int __conf_write_autoconf(const char *filename
,
1185 void (*print_symbol
)(FILE *, struct symbol
*),
1186 const struct comment_style
*comment_style
)
1193 if (make_parent_dir(filename
))
1196 ret
= snprintf(tmp
, sizeof(tmp
), "%s.tmp", filename
);
1197 if (ret
>= sizeof(tmp
)) /* check truncation */
1200 file
= fopen(tmp
, "w");
1206 conf_write_heading(file
, comment_style
);
1208 int print_negatives
= getenv("KCONFIG_NEGATIVES") != NULL
;
1209 for_all_symbols(i
, sym
)
1210 if (((sym
->flags
& SYMBOL_WRITE
) || (print_negatives
&& sym
->type
!= S_STRING
)) && sym
->name
)
1211 print_symbol(file
, sym
);
1214 /* check possible errors in conf_write_heading() and print_symbol() */
1220 if (rename(tmp
, filename
)) {
1228 int conf_write_autoconf(int overwrite
)
1231 const char *autoconf_name
= conf_get_autoconfig_name();
1234 if (!overwrite
&& is_present(autoconf_name
))
1237 ret
= conf_write_autoconf_cmd(autoconf_name
);
1241 if (conf_touch_deps())
1244 for_all_symbols(i
, sym
)
1245 sym_calc_value(sym
);
1247 ret
= __conf_write_autoconf(conf_get_autoheader_name(),
1253 ret
= __conf_write_autoconf(conf_get_rustccfg_name(),
1254 print_symbol_for_rustccfg
,
1260 * Create include/config/auto.conf. This must be the last step because
1261 * Kbuild has a dependency on auto.conf and this marks the successful
1262 * completion of the previous steps.
1264 ret
= __conf_write_autoconf(conf_get_autoconfig_name(),
1265 print_symbol_for_autoconf
,
1266 &comment_style_pound
);
1273 static bool conf_changed
;
1274 static void (*conf_changed_callback
)(void);
1276 void conf_set_changed(bool val
)
1278 bool changed
= conf_changed
!= val
;
1282 if (conf_changed_callback
&& changed
)
1283 conf_changed_callback();
1286 bool conf_get_changed(void)
1288 return conf_changed
;
1291 void conf_set_changed_callback(void (*fn
)(void))
1293 conf_changed_callback
= fn
;
1296 void set_all_choice_values(struct symbol
*csym
)
1298 struct property
*prop
;
1302 prop
= sym_get_choice_prop(csym
);
1305 * Set all non-assinged choice values to no
1307 expr_list_for_each_sym(prop
->expr
, e
, sym
) {
1308 if (!sym_has_value(sym
))
1309 sym
->def
[S_DEF_USER
].tri
= no
;
1311 csym
->flags
|= SYMBOL_DEF_USER
;
1312 /* clear VALID to get value calculated */
1313 csym
->flags
&= ~(SYMBOL_VALID
| SYMBOL_NEED_SET_CHOICE_VALUES
);