author | kergoth <kergoth> | 2003-06-17 17:03:49 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-06-17 17:03:49 (UTC) |
commit | 16e53b2a2e94742f3b55ee73700bb264e36638d4 (patch) (unidiff) | |
tree | 4f2b65a635d25c1ce0cfeea7953623c2bf7d9534 /scripts/kconfig/confdata.c | |
parent | 384b7f1a42f9f2f101dc8fe11c3625055d96f672 (diff) | |
download | opie-16e53b2a2e94742f3b55ee73700bb264e36638d4.zip opie-16e53b2a2e94742f3b55ee73700bb264e36638d4.tar.gz opie-16e53b2a2e94742f3b55ee73700bb264e36638d4.tar.bz2 |
Update LinuxKernelConf version to 1.4.
-rw-r--r-- | scripts/kconfig/confdata.c | 106 |
1 files changed, 75 insertions, 31 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 9bf7af9..f3796ce 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -21,5 +21,2 @@ const char *conf_confnames[] = { | |||
21 | ".config", | 21 | ".config", |
22 | "/lib/modules/$UNAME_RELEASE/.config", | ||
23 | "/etc/kernel-config", | ||
24 | "/boot/config-$UNAME_RELEASE", | ||
25 | conf_defname, | 22 | conf_defname, |
@@ -107,7 +104,7 @@ int conf_read(const char *name) | |||
107 | case S_STRING: | 104 | case S_STRING: |
108 | if (S_VAL(sym->def)) | 105 | if (sym->user.val) |
109 | free(S_VAL(sym->def)); | 106 | free(sym->user.val); |
110 | default: | 107 | default: |
111 | S_VAL(sym->def) = NULL; | 108 | sym->user.val = NULL; |
112 | S_TRI(sym->def) = no; | 109 | sym->user.tri = no; |
113 | } | 110 | } |
@@ -131,3 +128,3 @@ int conf_read(const char *name) | |||
131 | case S_TRISTATE: | 128 | case S_TRISTATE: |
132 | sym->def = symbol_no.curr; | 129 | sym->user = symbol_no.curr; |
133 | sym->flags &= ~SYMBOL_NEW; | 130 | sym->flags &= ~SYMBOL_NEW; |
@@ -156,3 +153,3 @@ int conf_read(const char *name) | |||
156 | if (p[0] == 'm') { | 153 | if (p[0] == 'm') { |
157 | S_TRI(sym->def) = mod; | 154 | sym->user.tri = mod; |
158 | sym->flags &= ~SYMBOL_NEW; | 155 | sym->flags &= ~SYMBOL_NEW; |
@@ -162,3 +159,3 @@ int conf_read(const char *name) | |||
162 | if (p[0] == 'y') { | 159 | if (p[0] == 'y') { |
163 | S_TRI(sym->def) = yes; | 160 | sym->user.tri = yes; |
164 | sym->flags &= ~SYMBOL_NEW; | 161 | sym->flags &= ~SYMBOL_NEW; |
@@ -167,3 +164,3 @@ int conf_read(const char *name) | |||
167 | if (p[0] == 'n') { | 164 | if (p[0] == 'n') { |
168 | S_TRI(sym->def) = no; | 165 | sym->user.tri = no; |
169 | sym->flags &= ~SYMBOL_NEW; | 166 | sym->flags &= ~SYMBOL_NEW; |
@@ -189,3 +186,3 @@ int conf_read(const char *name) | |||
189 | if (sym_string_valid(sym, p)) { | 186 | if (sym_string_valid(sym, p)) { |
190 | S_VAL(sym->def) = strdup(p); | 187 | sym->user.val = strdup(p); |
191 | sym->flags &= ~SYMBOL_NEW; | 188 | sym->flags &= ~SYMBOL_NEW; |
@@ -200,6 +197,6 @@ int conf_read(const char *name) | |||
200 | if (sym_is_choice_value(sym)) { | 197 | if (sym_is_choice_value(sym)) { |
201 | prop = sym_get_choice_prop(sym); | 198 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); |
202 | switch (S_TRI(sym->def)) { | 199 | switch (sym->user.tri) { |
203 | case mod: | 200 | case mod: |
204 | if (S_TRI(prop->def->def) == yes) | 201 | if (cs->user.tri == yes) |
205 | /* warn? */; | 202 | /* warn? */; |
@@ -207,5 +204,5 @@ int conf_read(const char *name) | |||
207 | case yes: | 204 | case yes: |
208 | if (S_TRI(prop->def->def) != no) | 205 | if (cs->user.tri != no) |
209 | /* warn? */; | 206 | /* warn? */; |
210 | S_VAL(prop->def->def) = sym; | 207 | cs->user.val = sym; |
211 | break; | 208 | break; |
@@ -214,3 +211,3 @@ int conf_read(const char *name) | |||
214 | } | 211 | } |
215 | S_TRI(prop->def->def) = S_TRI(sym->def); | 212 | cs->user.tri = sym->user.tri; |
216 | } | 213 | } |
@@ -226,2 +223,16 @@ int conf_read(const char *name) | |||
226 | for_all_symbols(i, sym) { | 223 | for_all_symbols(i, sym) { |
224 | sym_calc_value(sym); | ||
225 | if (sym_has_value(sym)) { | ||
226 | if (sym->visible == no) | ||
227 | sym->flags |= SYMBOL_NEW; | ||
228 | switch (sym->type) { | ||
229 | case S_STRING: | ||
230 | case S_INT: | ||
231 | case S_HEX: | ||
232 | if (!sym_string_within_range(sym, sym->user.val)) | ||
233 | sym->flags |= SYMBOL_NEW; | ||
234 | default: | ||
235 | break; | ||
236 | } | ||
237 | } | ||
227 | if (!sym_is_choice(sym)) | 238 | if (!sym_is_choice(sym)) |
@@ -230,3 +241,4 @@ int conf_read(const char *name) | |||
230 | sym->flags &= ~SYMBOL_NEW; | 241 | sym->flags &= ~SYMBOL_NEW; |
231 | for (e = prop->dep; e; e = e->left.expr) | 242 | for (e = prop->expr; e; e = e->left.expr) |
243 | if (e->right.sym->visible != no) | ||
232 | sym->flags |= e->right.sym->flags & SYMBOL_NEW; | 244 | sym->flags |= e->right.sym->flags & SYMBOL_NEW; |
@@ -244,3 +256,4 @@ int conf_write(const char *name) | |||
244 | struct menu *menu; | 256 | struct menu *menu; |
245 | char oldname[128]; | 257 | const char *basename; |
258 | char dirname[128], tmpname[128], newname[128]; | ||
246 | int type, l; | 259 | int type, l; |
@@ -248,5 +261,24 @@ int conf_write(const char *name) | |||
248 | 261 | ||
249 | out = fopen(".tmpconfig", "w"); | 262 | dirname[0] = 0; |
263 | if (name && name[0]) { | ||
264 | char *slash = strrchr(name, '/'); | ||
265 | if (slash) { | ||
266 | int size = slash - name + 1; | ||
267 | memcpy(dirname, name, size); | ||
268 | dirname[size] = 0; | ||
269 | if (slash[1]) | ||
270 | basename = slash + 1; | ||
271 | else | ||
272 | basename = conf_def_filename; | ||
273 | } else | ||
274 | basename = name; | ||
275 | } else | ||
276 | basename = conf_def_filename; | ||
277 | |||
278 | sprintf(newname, "%s.tmpconfig.%d", dirname, getpid()); | ||
279 | out = fopen(newname, "w"); | ||
250 | if (!out) | 280 | if (!out) |
251 | return 1; | 281 | return 1; |
282 | out_h = NULL; | ||
283 | if (!name) { | ||
252 | out_h = fopen(".tmpconfig.h", "w"); | 284 | out_h = fopen(".tmpconfig.h", "w"); |
@@ -254,2 +286,3 @@ int conf_write(const char *name) | |||
254 | return 1; | 286 | return 1; |
287 | } | ||
255 | fprintf(out, "#\n" | 288 | fprintf(out, "#\n" |
@@ -257,2 +290,3 @@ int conf_write(const char *name) | |||
257 | "#\n"); | 290 | "#\n"); |
291 | if (out_h) | ||
258 | fprintf(out_h, "/*\n" | 292 | fprintf(out_h, "/*\n" |
@@ -276,2 +310,3 @@ int conf_write(const char *name) | |||
276 | "#\n", str); | 310 | "#\n", str); |
311 | if (out_h) | ||
277 | fprintf(out_h, "\n" | 312 | fprintf(out_h, "\n" |
@@ -288,3 +323,3 @@ int conf_write(const char *name) | |||
288 | sym_calc_value(modules_sym); | 323 | sym_calc_value(modules_sym); |
289 | if (S_TRI(modules_sym->curr) == no) | 324 | if (modules_sym->curr.tri == no) |
290 | type = S_BOOLEAN; | 325 | type = S_BOOLEAN; |
@@ -297,2 +332,3 @@ int conf_write(const char *name) | |||
297 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); | 332 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); |
333 | if (out_h) | ||
298 | fprintf(out_h, "#undef CONFIG_%s\n", sym->name); | 334 | fprintf(out_h, "#undef CONFIG_%s\n", sym->name); |
@@ -301,2 +337,3 @@ int conf_write(const char *name) | |||
301 | fprintf(out, "CONFIG_%s=m\n", sym->name); | 337 | fprintf(out, "CONFIG_%s=m\n", sym->name); |
338 | if (out_h) | ||
302 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); | 339 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); |
@@ -305,2 +342,3 @@ int conf_write(const char *name) | |||
305 | fprintf(out, "CONFIG_%s=y\n", sym->name); | 342 | fprintf(out, "CONFIG_%s=y\n", sym->name); |
343 | if (out_h) | ||
306 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); | 344 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); |
@@ -313,2 +351,3 @@ int conf_write(const char *name) | |||
313 | fprintf(out, "CONFIG_%s=\"", sym->name); | 351 | fprintf(out, "CONFIG_%s=\"", sym->name); |
352 | if (out_h) | ||
314 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); | 353 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); |
@@ -318,2 +357,3 @@ int conf_write(const char *name) | |||
318 | fwrite(str, l, 1, out); | 357 | fwrite(str, l, 1, out); |
358 | if (out_h) | ||
319 | fwrite(str, l, 1, out_h); | 359 | fwrite(str, l, 1, out_h); |
@@ -323,2 +363,3 @@ int conf_write(const char *name) | |||
323 | fprintf(out, "\\%c", *str); | 363 | fprintf(out, "\\%c", *str); |
364 | if (out_h) | ||
324 | fprintf(out_h, "\\%c", *str); | 365 | fprintf(out_h, "\\%c", *str); |
@@ -328,2 +369,3 @@ int conf_write(const char *name) | |||
328 | fputs("\"\n", out); | 369 | fputs("\"\n", out); |
370 | if (out_h) | ||
329 | fputs("\"\n", out_h); | 371 | fputs("\"\n", out_h); |
@@ -334,2 +376,3 @@ int conf_write(const char *name) | |||
334 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | 376 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); |
377 | if (out_h) | ||
335 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); | 378 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); |
@@ -340,2 +383,3 @@ int conf_write(const char *name) | |||
340 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | 383 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); |
384 | if (out_h) | ||
341 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); | 385 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); |
@@ -360,14 +404,14 @@ int conf_write(const char *name) | |||
360 | fclose(out); | 404 | fclose(out); |
405 | if (out_h) { | ||
361 | fclose(out_h); | 406 | fclose(out_h); |
362 | |||
363 | if (!name) { | ||
364 | rename(".tmpconfig.h", "include/linux/autoconf.h"); | 407 | rename(".tmpconfig.h", "include/linux/autoconf.h"); |
408 | } | ||
409 | if (!name || basename != conf_def_filename) { | ||
410 | if (!name) | ||
365 | name = conf_def_filename; | 411 | name = conf_def_filename; |
366 | file_write_dep(NULL); | 412 | sprintf(tmpname, "%s.old", name); |
367 | } else | 413 | rename(name, tmpname); |
368 | unlink(".tmpconfig.h"); | 414 | } |
369 | 415 | sprintf(tmpname, "%s%s", dirname, basename); | |
370 | sprintf(oldname, "%s.old", name); | 416 | if (rename(newname, tmpname)) |
371 | rename(name, oldname); | ||
372 | if (rename(".tmpconfig", name)) | ||
373 | return 1; | 417 | return 1; |