Commit 22e1c5c4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] implement print_modules()

From: Arjan van de Ven <arjanv@redhat.com>,
      Rusty Russell <rusty@rustcorp.com.au>

The patch below resolves the "Not Yet Implemented" print_modules() thing.
This is a really useful feature for distros; it allows us to do statistical
analysis on which modules are present how often in oopses compared to how
often they are used normally.  In addition it helps to spot candidates for
certain bugs without having to go back to the customer asking for this
information.
parent d0980c12
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
/* Not Yet Implemented */ /* Not Yet Implemented */
#define MODULE_SUPPORTED_DEVICE(name) #define MODULE_SUPPORTED_DEVICE(name)
#define print_modules()
/* v850 toolchain uses a `_' prefix for all user symbols */ /* v850 toolchain uses a `_' prefix for all user symbols */
#ifndef MODULE_SYMBOL_PREFIX #ifndef MODULE_SYMBOL_PREFIX
...@@ -425,6 +424,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr); ...@@ -425,6 +424,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr);
int register_module_notifier(struct notifier_block * nb); int register_module_notifier(struct notifier_block * nb);
int unregister_module_notifier(struct notifier_block * nb); int unregister_module_notifier(struct notifier_block * nb);
extern void print_modules(void);
#else /* !CONFIG_MODULES... */ #else /* !CONFIG_MODULES... */
#define EXPORT_SYMBOL(sym) #define EXPORT_SYMBOL(sym)
#define EXPORT_SYMBOL_GPL(sym) #define EXPORT_SYMBOL_GPL(sym)
...@@ -505,6 +505,9 @@ static inline int unregister_module_notifier(struct notifier_block * nb) ...@@ -505,6 +505,9 @@ static inline int unregister_module_notifier(struct notifier_block * nb)
#define module_put_and_exit(code) do_exit(code) #define module_put_and_exit(code) do_exit(code)
static inline void print_modules(void)
{
}
#endif /* CONFIG_MODULES */ #endif /* CONFIG_MODULES */
#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
......
...@@ -2040,6 +2040,17 @@ struct module *module_text_address(unsigned long addr) ...@@ -2040,6 +2040,17 @@ struct module *module_text_address(unsigned long addr)
return NULL; return NULL;
} }
/* Don't grab lock, we're oopsing. */
void print_modules(void)
{
struct module *mod;
printk("Modules linked in:");
list_for_each_entry(mod, &modules, list)
printk(" %s", mod->name);
printk("\n");
}
#ifdef CONFIG_MODVERSIONS #ifdef CONFIG_MODVERSIONS
/* Generate the signature for struct module here, too, for modversions. */ /* Generate the signature for struct module here, too, for modversions. */
void struct_module(struct module *mod) { return; } void struct_module(struct module *mod) { return; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment