aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorSam Ravnborg <sam@mars.ravnborg.org>2006-01-28 10:57:26 -0500
committerSam Ravnborg <sam@mars.ravnborg.org>2006-02-19 03:51:17 -0500
commitcb80514d9c517cc1d101ef304529a0e9b76b4468 (patch)
tree25c9203d808ce322f13cdf62c98c29bcc49a69be /scripts/mod
parent06300b21f4c79fd1578f4b7ca4b314fbab61a383 (diff)
kbuild: use warn()/fatal() consistent in modpost
modpost.c provides warn() and fatal() - so use them all over the place. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c13
-rw-r--r--scripts/mod/modpost.c16
-rw-r--r--scripts/mod/modpost.h7
-rw-r--r--scripts/mod/sumversion.c23
4 files changed, 27 insertions, 32 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index be97caf664bb..1346223f7809 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -153,8 +153,8 @@ static void do_usb_table(void *symval, unsigned long size,
153 const unsigned long id_size = sizeof(struct usb_device_id); 153 const unsigned long id_size = sizeof(struct usb_device_id);
154 154
155 if (size % id_size || size < id_size) { 155 if (size % id_size || size < id_size) {
156 fprintf(stderr, "*** Warning: %s ids %lu bad size " 156 warn("%s ids %lu bad size "
157 "(each on %lu)\n", mod->name, size, id_size); 157 "(each on %lu)\n", mod->name, size, id_size);
158 } 158 }
159 /* Leave last one: it's the terminator. */ 159 /* Leave last one: it's the terminator. */
160 size -= id_size; 160 size -= id_size;
@@ -217,9 +217,8 @@ static int do_pci_entry(const char *filename,
217 if ((baseclass_mask != 0 && baseclass_mask != 0xFF) 217 if ((baseclass_mask != 0 && baseclass_mask != 0xFF)
218 || (subclass_mask != 0 && subclass_mask != 0xFF) 218 || (subclass_mask != 0 && subclass_mask != 0xFF)
219 || (interface_mask != 0 && interface_mask != 0xFF)) { 219 || (interface_mask != 0 && interface_mask != 0xFF)) {
220 fprintf(stderr, 220 warn("Can't handle masks in %s:%04X\n",
221 "*** Warning: Can't handle masks in %s:%04X\n", 221 filename, id->class_mask);
222 filename, id->class_mask);
223 return 0; 222 return 0;
224 } 223 }
225 224
@@ -445,8 +444,8 @@ static void do_table(void *symval, unsigned long size,
445 int (*do_entry)(const char *, void *entry, char *alias) = function; 444 int (*do_entry)(const char *, void *entry, char *alias) = function;
446 445
447 if (size % id_size || size < id_size) { 446 if (size % id_size || size < id_size) {
448 fprintf(stderr, "*** Warning: %s ids %lu bad size " 447 warn("%s ids %lu bad size "
449 "(each on %lu)\n", mod->name, size, id_size); 448 "(each on %lu)\n", mod->name, size, id_size);
450 } 449 }
451 /* Leave last one: it's the terminator. */ 450 /* Leave last one: it's the terminator. */
452 size -= id_size; 451 size -= id_size;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f70ff13d4818..a3c57ec7d54a 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -303,8 +303,7 @@ parse_elf(struct elf_info *info, const char *filename)
303 sechdrs[sechdrs[i].sh_link].sh_offset; 303 sechdrs[sechdrs[i].sh_link].sh_offset;
304 } 304 }
305 if (!info->symtab_start) { 305 if (!info->symtab_start) {
306 fprintf(stderr, "modpost: %s no symtab?\n", filename); 306 fatal("%s has no symtab?\n", filename);
307 abort();
308 } 307 }
309 /* Fix endianness in symbols */ 308 /* Fix endianness in symbols */
310 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) { 309 for (sym = info->symtab_start; sym < info->symtab_stop; sym++) {
@@ -316,8 +315,7 @@ parse_elf(struct elf_info *info, const char *filename)
316 return; 315 return;
317 316
318 truncated: 317 truncated:
319 fprintf(stderr, "modpost: %s is truncated.\n", filename); 318 fatal("%s is truncated.\n", filename);
320 abort();
321} 319}
322 320
323void 321void
@@ -337,8 +335,7 @@ handle_modversions(struct module *mod, struct elf_info *info,
337 335
338 switch (sym->st_shndx) { 336 switch (sym->st_shndx) {
339 case SHN_COMMON: 337 case SHN_COMMON:
340 fprintf(stderr, "*** Warning: \"%s\" [%s] is COMMON symbol\n", 338 warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
341 symname, mod->name);
342 break; 339 break;
343 case SHN_ABS: 340 case SHN_ABS:
344 /* CRC'd symbol */ 341 /* CRC'd symbol */
@@ -562,8 +559,8 @@ add_versions(struct buffer *b, struct module *mod)
562 exp = find_symbol(s->name); 559 exp = find_symbol(s->name);
563 if (!exp || exp->module == mod) { 560 if (!exp || exp->module == mod) {
564 if (have_vmlinux && !s->weak) 561 if (have_vmlinux && !s->weak)
565 fprintf(stderr, "*** Warning: \"%s\" [%s.ko] " 562 warn("\"%s\" [%s.ko] undefined!\n",
566 "undefined!\n", s->name, mod->name); 563 s->name, mod->name);
567 continue; 564 continue;
568 } 565 }
569 s->module = exp->module; 566 s->module = exp->module;
@@ -584,8 +581,7 @@ add_versions(struct buffer *b, struct module *mod)
584 continue; 581 continue;
585 } 582 }
586 if (!s->crc_valid) { 583 if (!s->crc_valid) {
587 fprintf(stderr, "*** Warning: \"%s\" [%s.ko] " 584 warn("\"%s\" [%s.ko] has no CRC!\n",
588 "has no CRC!\n",
589 s->name, mod->name); 585 s->name, mod->name);
590 continue; 586 continue;
591 } 587 }
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 7334d839145d..c0de7b98c24c 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -91,17 +91,22 @@ struct elf_info {
91 unsigned int modinfo_len; 91 unsigned int modinfo_len;
92}; 92};
93 93
94/* file2alias.c */
94void handle_moddevtable(struct module *mod, struct elf_info *info, 95void handle_moddevtable(struct module *mod, struct elf_info *info,
95 Elf_Sym *sym, const char *symname); 96 Elf_Sym *sym, const char *symname);
96
97void add_moddevtable(struct buffer *buf, struct module *mod); 97void add_moddevtable(struct buffer *buf, struct module *mod);
98 98
99/* sumversion.c */
99void maybe_frob_rcs_version(const char *modfilename, 100void maybe_frob_rcs_version(const char *modfilename,
100 char *version, 101 char *version,
101 void *modinfo, 102 void *modinfo,
102 unsigned long modinfo_offset); 103 unsigned long modinfo_offset);
103void get_src_version(const char *modname, char sum[], unsigned sumlen); 104void get_src_version(const char *modname, char sum[], unsigned sumlen);
104 105
106/* from modpost.c */
105void *grab_file(const char *filename, unsigned long *size); 107void *grab_file(const char *filename, unsigned long *size);
106char* get_next_line(unsigned long *pos, void *file, unsigned long size); 108char* get_next_line(unsigned long *pos, void *file, unsigned long size);
107void release_file(void *file, unsigned long size); 109void release_file(void *file, unsigned long size);
110
111void fatal(const char *fmt, ...);
112void warn(const char *fmt, ...);
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 43271a1ca01e..5c0754526a26 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -316,8 +316,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
316 316
317 file = grab_file(cmd, &flen); 317 file = grab_file(cmd, &flen);
318 if (!file) { 318 if (!file) {
319 fprintf(stderr, "Warning: could not find %s for %s\n", 319 warn("could not find %s for %s\n", cmd, objfile);
320 cmd, objfile);
321 goto out; 320 goto out;
322 } 321 }
323 322
@@ -355,9 +354,8 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
355 /* Check if this file is in same dir as objfile */ 354 /* Check if this file is in same dir as objfile */
356 if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) { 355 if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) {
357 if (!parse_file(line, md)) { 356 if (!parse_file(line, md)) {
358 fprintf(stderr, 357 warn("could not open %s: %s\n",
359 "Warning: could not open %s: %s\n", 358 line, strerror(errno));
360 line, strerror(errno));
361 goto out_file; 359 goto out_file;
362 } 360 }
363 361
@@ -397,23 +395,20 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
397 395
398 file = grab_file(filelist, &len); 396 file = grab_file(filelist, &len);
399 if (!file) { 397 if (!file) {
400 fprintf(stderr, "Warning: could not find versions for %s\n", 398 warn("could not find versions for %s\n", filelist);
401 filelist);
402 return; 399 return;
403 } 400 }
404 401
405 sources = strchr(file, '\n'); 402 sources = strchr(file, '\n');
406 if (!sources) { 403 if (!sources) {
407 fprintf(stderr, "Warning: malformed versions file for %s\n", 404 warn("malformed versions file for %s\n", modname);
408 modname);
409 goto release; 405 goto release;
410 } 406 }
411 407
412 sources++; 408 sources++;
413 end = strchr(sources, '\n'); 409 end = strchr(sources, '\n');
414 if (!end) { 410 if (!end) {
415 fprintf(stderr, "Warning: bad ending versions file for %s\n", 411 warn("bad ending versions file for %s\n", modname);
416 modname);
417 goto release; 412 goto release;
418 } 413 }
419 *end = '\0'; 414 *end = '\0';
@@ -438,19 +433,19 @@ static void write_version(const char *filename, const char *sum,
438 433
439 fd = open(filename, O_RDWR); 434 fd = open(filename, O_RDWR);
440 if (fd < 0) { 435 if (fd < 0) {
441 fprintf(stderr, "Warning: changing sum in %s failed: %s\n", 436 warn("changing sum in %s failed: %s\n",
442 filename, strerror(errno)); 437 filename, strerror(errno));
443 return; 438 return;
444 } 439 }
445 440
446 if (lseek(fd, offset, SEEK_SET) == (off_t)-1) { 441 if (lseek(fd, offset, SEEK_SET) == (off_t)-1) {
447 fprintf(stderr, "Warning: changing sum in %s:%lu failed: %s\n", 442 warn("changing sum in %s:%lu failed: %s\n",
448 filename, offset, strerror(errno)); 443 filename, offset, strerror(errno));
449 goto out; 444 goto out;
450 } 445 }
451 446
452 if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) { 447 if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) {
453 fprintf(stderr, "Warning: writing sum in %s failed: %s\n", 448 warn("writing sum in %s failed: %s\n",
454 filename, strerror(errno)); 449 filename, strerror(errno));
455 goto out; 450 goto out;
456 } 451 }