confdata.c (8b41fc4454e36fbfdbb23f940d023d4dece2de29) | confdata.c (89b9060987d988333de59dd218c9666bd7ee95a5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 4 */ 5 6#include <sys/mman.h> 7#include <sys/stat.h> 8#include <ctype.h> --- 696 unchanged lines hidden (view full) --- 705} 706 707static struct conf_printer header_printer_cb = 708{ 709 .print_symbol = header_print_symbol, 710 .print_comment = header_print_comment, 711}; 712 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 4 */ 5 6#include <sys/mman.h> 7#include <sys/stat.h> 8#include <ctype.h> --- 696 unchanged lines hidden (view full) --- 705} 706 707static struct conf_printer header_printer_cb = 708{ 709 .print_symbol = header_print_symbol, 710 .print_comment = header_print_comment, 711}; 712 |
713/* 714 * Tristate printer 715 * 716 * This printer is used when generating the `include/config/tristate.conf' file. 717 */ 718static void 719tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) 720{ 721 722 if (sym->type == S_TRISTATE && *value != 'n') 723 fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value)); 724} 725 726static struct conf_printer tristate_printer_cb = 727{ 728 .print_symbol = tristate_print_symbol, 729 .print_comment = kconfig_print_comment, 730}; 731 |
|
713static void conf_write_symbol(FILE *fp, struct symbol *sym, 714 struct conf_printer *printer, void *printer_arg) 715{ 716 const char *str; 717 718 switch (sym->type) { 719 case S_UNKNOWN: 720 break; --- 317 unchanged lines hidden (view full) --- 1038 return 0; 1039} 1040 1041int conf_write_autoconf(int overwrite) 1042{ 1043 struct symbol *sym; 1044 const char *name; 1045 const char *autoconf_name = conf_get_autoconfig_name(); | 732static void conf_write_symbol(FILE *fp, struct symbol *sym, 733 struct conf_printer *printer, void *printer_arg) 734{ 735 const char *str; 736 737 switch (sym->type) { 738 case S_UNKNOWN: 739 break; --- 317 unchanged lines hidden (view full) --- 1057 return 0; 1058} 1059 1060int conf_write_autoconf(int overwrite) 1061{ 1062 struct symbol *sym; 1063 const char *name; 1064 const char *autoconf_name = conf_get_autoconfig_name(); |
1046 FILE *out, *out_h; | 1065 FILE *out, *tristate, *out_h; |
1047 int i; 1048 1049 if (!overwrite && is_present(autoconf_name)) 1050 return 0; 1051 1052 conf_write_dep("include/config/auto.conf.cmd"); 1053 1054 if (conf_touch_deps()) 1055 return 1; 1056 1057 out = fopen(".tmpconfig", "w"); 1058 if (!out) 1059 return 1; 1060 | 1066 int i; 1067 1068 if (!overwrite && is_present(autoconf_name)) 1069 return 0; 1070 1071 conf_write_dep("include/config/auto.conf.cmd"); 1072 1073 if (conf_touch_deps()) 1074 return 1; 1075 1076 out = fopen(".tmpconfig", "w"); 1077 if (!out) 1078 return 1; 1079 |
1080 tristate = fopen(".tmpconfig_tristate", "w"); 1081 if (!tristate) { 1082 fclose(out); 1083 return 1; 1084 } 1085 |
|
1061 out_h = fopen(".tmpconfig.h", "w"); 1062 if (!out_h) { 1063 fclose(out); | 1086 out_h = fopen(".tmpconfig.h", "w"); 1087 if (!out_h) { 1088 fclose(out); |
1089 fclose(tristate); |
|
1064 return 1; 1065 } 1066 1067 conf_write_heading(out, &kconfig_printer_cb, NULL); | 1090 return 1; 1091 } 1092 1093 conf_write_heading(out, &kconfig_printer_cb, NULL); |
1094 1095 conf_write_heading(tristate, &tristate_printer_cb, NULL); 1096 |
|
1068 conf_write_heading(out_h, &header_printer_cb, NULL); 1069 1070 for_all_symbols(i, sym) { 1071 sym_calc_value(sym); 1072 if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 1073 continue; 1074 | 1097 conf_write_heading(out_h, &header_printer_cb, NULL); 1098 1099 for_all_symbols(i, sym) { 1100 sym_calc_value(sym); 1101 if (!(sym->flags & SYMBOL_WRITE) || !sym->name) 1102 continue; 1103 |
1075 /* write symbols to auto.conf and autoconf.h */ | 1104 /* write symbol to auto.conf, tristate and header files */ |
1076 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); | 1105 conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
1106 1107 conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); 1108 |
|
1077 conf_write_symbol(out_h, sym, &header_printer_cb, NULL); 1078 } 1079 fclose(out); | 1109 conf_write_symbol(out_h, sym, &header_printer_cb, NULL); 1110 } 1111 fclose(out); |
1112 fclose(tristate); |
|
1080 fclose(out_h); 1081 1082 name = getenv("KCONFIG_AUTOHEADER"); 1083 if (!name) 1084 name = "include/generated/autoconf.h"; 1085 if (make_parent_dir(name)) 1086 return 1; 1087 if (rename(".tmpconfig.h", name)) 1088 return 1; 1089 | 1113 fclose(out_h); 1114 1115 name = getenv("KCONFIG_AUTOHEADER"); 1116 if (!name) 1117 name = "include/generated/autoconf.h"; 1118 if (make_parent_dir(name)) 1119 return 1; 1120 if (rename(".tmpconfig.h", name)) 1121 return 1; 1122 |
1123 name = getenv("KCONFIG_TRISTATE"); 1124 if (!name) 1125 name = "include/config/tristate.conf"; 1126 if (make_parent_dir(name)) 1127 return 1; 1128 if (rename(".tmpconfig_tristate", name)) 1129 return 1; 1130 |
|
1090 if (make_parent_dir(autoconf_name)) 1091 return 1; 1092 /* 1093 * This must be the last step, kbuild has a dependency on auto.conf 1094 * and this marks the successful completion of the previous steps. 1095 */ 1096 if (rename(".tmpconfig", autoconf_name)) 1097 return 1; --- 218 unchanged lines hidden (view full) --- 1316 else { 1317 set_all_choice_values(csym); 1318 has_changed = true; 1319 } 1320 } 1321 1322 return has_changed; 1323} | 1131 if (make_parent_dir(autoconf_name)) 1132 return 1; 1133 /* 1134 * This must be the last step, kbuild has a dependency on auto.conf 1135 * and this marks the successful completion of the previous steps. 1136 */ 1137 if (rename(".tmpconfig", autoconf_name)) 1138 return 1; --- 218 unchanged lines hidden (view full) --- 1357 else { 1358 set_all_choice_values(csym); 1359 has_changed = true; 1360 } 1361 } 1362 1363 return has_changed; 1364} |
1365 1366void conf_rewrite_mod_or_yes(enum conf_def_mode mode) 1367{ 1368 struct symbol *sym; 1369 int i; 1370 tristate old_val = (mode == def_y2m) ? yes : mod; 1371 tristate new_val = (mode == def_y2m) ? mod : yes; 1372 1373 for_all_symbols(i, sym) { 1374 if (sym_get_type(sym) == S_TRISTATE && 1375 sym->def[S_DEF_USER].tri == old_val) { 1376 sym->def[S_DEF_USER].tri = new_val; 1377 sym_add_change_count(1); 1378 } 1379 } 1380} |
|