#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
-void modpost_log(bool is_error, const char *fmt, ...)
+void modpost_log(bool is_error, struct module *mod, const char *fmt, ...)
{
va_list arglist;
fprintf(stderr, "modpost: ");
+ if (mod)
+ fprintf(stderr, "%s%s: ", mod->name, mod->is_vmlinux ? "" : ".ko");
+
va_start(arglist, fmt);
vfprintf(stderr, fmt, arglist);
va_end(arglist);
}
+#define mod_warn(mod, fmt, args...) modpost_log(false, mod, fmt, ##args)
+#define mod_error(mod, fmt, args...) modpost_log(true, mod, fmt, ##args)
+
static inline bool strends(const char *str, const char *postfix)
{
if (strlen(str) < strlen(postfix))
exp = find_symbol(s->name);
if (!exp) {
if (!s->weak && nr_unresolved++ < MAX_UNRESOLVED_REPORTS)
- modpost_log(!warn_unresolved,
+ modpost_log(!warn_unresolved, NULL,
"\"%s\" [%s.ko] undefined!\n",
s->name, mod->name);
continue;
if (!verify_module_namespace(exp->namespace, basename) &&
!contains_namespace(&mod->imported_namespaces, exp->namespace)) {
- modpost_log(!allow_missing_ns_imports,
+ modpost_log(!allow_missing_ns_imports, NULL,
"module %s uses symbol %s from namespace %s, but does not import it.\n",
basename, exp->name, exp->namespace);
add_namespace(&mod->missing_namespaces, exp->namespace);
char *get_line(char **stringp);
void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym);
-void __attribute__((format(printf, 2, 3)))
-modpost_log(bool is_error, const char *fmt, ...);
+void __attribute__((format(printf, 3, 4)))
+modpost_log(bool is_error, struct module *mod, const char *fmt, ...);
/*
* warn - show the given message, then let modpost continue running, still
* fatal - show the given message, and bail out immediately. This should be
* used when there is no point to continue running modpost.
*/
-#define warn(fmt, args...) modpost_log(false, fmt, ##args)
-#define error(fmt, args...) modpost_log(true, fmt, ##args)
+#define warn(fmt, args...) modpost_log(false, NULL, fmt, ##args)
+#define error(fmt, args...) modpost_log(true, NULL, fmt, ##args)
#define fatal(fmt, args...) do { error(fmt, ##args); exit(1); } while (1)