modpost.c provides warn() and fatal() - so use them all over the place.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
const unsigned long id_size = sizeof(struct usb_device_id);
if (size % id_size || size < id_size) {
- fprintf(stderr, "*** Warning: %s ids %lu bad size "
- "(each on %lu)\n", mod->name, size, id_size);
+ warn("%s ids %lu bad size "
+ "(each on %lu)\n", mod->name, size, id_size);
}
/* Leave last one: it's the terminator. */
size -= id_size;
if ((baseclass_mask != 0 && baseclass_mask != 0xFF)
|| (subclass_mask != 0 && subclass_mask != 0xFF)
|| (interface_mask != 0 && interface_mask != 0xFF)) {
- fprintf(stderr,
- "*** Warning: Can't handle masks in %s:%04X\n",
- filename, id->class_mask);
+ warn("Can't handle masks in %s:%04X\n",
+ filename, id->class_mask);
return 0;
}
int (*do_entry)(const char *, void *entry, char *alias) = function;
if (size % id_size || size < id_size) {
- fprintf(stderr, "*** Warning: %s ids %lu bad size "
- "(each on %lu)\n", mod->name, size, id_size);
+ warn("%s ids %lu bad size "
+ "(each on %lu)\n", mod->name, size, id_size);
}
/* Leave last one: it's the terminator. */
size -= id_size;
sechdrs[sechdrs[i].sh_link].sh_offset;
}
if (!info->symtab_start) {
- fprintf(stderr, "modpost: %s no symtab?\n", filename);
- abort();
+ fatal("%s has no symtab?\n", filename);
}
/* Fix endianness in symbols */
for (sym = info->symtab_start; sym < info->symtab_stop; sym++) {
return;
truncated:
- fprintf(stderr, "modpost: %s is truncated.\n", filename);
- abort();
+ fatal("%s is truncated.\n", filename);
}
void
switch (sym->st_shndx) {
case SHN_COMMON:
- fprintf(stderr, "*** Warning: \"%s\" [%s] is COMMON symbol\n",
- symname, mod->name);
+ warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name);
break;
case SHN_ABS:
/* CRC'd symbol */
exp = find_symbol(s->name);
if (!exp || exp->module == mod) {
if (have_vmlinux && !s->weak)
- fprintf(stderr, "*** Warning: \"%s\" [%s.ko] "
- "undefined!\n", s->name, mod->name);
+ warn("\"%s\" [%s.ko] undefined!\n",
+ s->name, mod->name);
continue;
}
s->module = exp->module;
continue;
}
if (!s->crc_valid) {
- fprintf(stderr, "*** Warning: \"%s\" [%s.ko] "
- "has no CRC!\n",
+ warn("\"%s\" [%s.ko] has no CRC!\n",
s->name, mod->name);
continue;
}
unsigned int modinfo_len;
};
+/* file2alias.c */
void handle_moddevtable(struct module *mod, struct elf_info *info,
Elf_Sym *sym, const char *symname);
-
void add_moddevtable(struct buffer *buf, struct module *mod);
+/* sumversion.c */
void maybe_frob_rcs_version(const char *modfilename,
char *version,
void *modinfo,
unsigned long modinfo_offset);
void get_src_version(const char *modname, char sum[], unsigned sumlen);
+/* from modpost.c */
void *grab_file(const char *filename, unsigned long *size);
char* get_next_line(unsigned long *pos, void *file, unsigned long size);
void release_file(void *file, unsigned long size);
+
+void fatal(const char *fmt, ...);
+void warn(const char *fmt, ...);
file = grab_file(cmd, &flen);
if (!file) {
- fprintf(stderr, "Warning: could not find %s for %s\n",
- cmd, objfile);
+ warn("could not find %s for %s\n", cmd, objfile);
goto out;
}
/* Check if this file is in same dir as objfile */
if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) {
if (!parse_file(line, md)) {
- fprintf(stderr,
- "Warning: could not open %s: %s\n",
- line, strerror(errno));
+ warn("could not open %s: %s\n",
+ line, strerror(errno));
goto out_file;
}
file = grab_file(filelist, &len);
if (!file) {
- fprintf(stderr, "Warning: could not find versions for %s\n",
- filelist);
+ warn("could not find versions for %s\n", filelist);
return;
}
sources = strchr(file, '\n');
if (!sources) {
- fprintf(stderr, "Warning: malformed versions file for %s\n",
- modname);
+ warn("malformed versions file for %s\n", modname);
goto release;
}
sources++;
end = strchr(sources, '\n');
if (!end) {
- fprintf(stderr, "Warning: bad ending versions file for %s\n",
- modname);
+ warn("bad ending versions file for %s\n", modname);
goto release;
}
*end = '\0';
fd = open(filename, O_RDWR);
if (fd < 0) {
- fprintf(stderr, "Warning: changing sum in %s failed: %s\n",
+ warn("changing sum in %s failed: %s\n",
filename, strerror(errno));
return;
}
if (lseek(fd, offset, SEEK_SET) == (off_t)-1) {
- fprintf(stderr, "Warning: changing sum in %s:%lu failed: %s\n",
+ warn("changing sum in %s:%lu failed: %s\n",
filename, offset, strerror(errno));
goto out;
}
if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) {
- fprintf(stderr, "Warning: writing sum in %s failed: %s\n",
+ warn("writing sum in %s failed: %s\n",
filename, strerror(errno));
goto out;
}