diff options
author | Anders Kaseorg <andersk@mit.edu> | 2008-12-05 19:03:58 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 22:35:32 -0400 |
commit | 75a66614db21007bcc8c37f9c5d5b922981387b9 (patch) | |
tree | d02c905a3aee02ec25ce38700f47d0fa57d2cbf7 /kernel/module.c | |
parent | a6e6abd575fcbe6572ebc7a70ad616406d206fa8 (diff) |
Ksplice: Add functions for walking kallsyms symbols
Impact: New API
kallsyms_lookup_name only returns the first match that it finds. Ksplice
needs information about all symbols with a given name in order to correctly
resolve local symbols.
kallsyms_on_each_symbol provides a generic mechanism for iterating over the
kallsyms table.
Cc: Jeff Arnold <jbarnold@mit.edu>
Cc: Tim Abbott <tabbott@mit.edu>
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 8ddca629e079..dd4389be9152 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2612,6 +2612,25 @@ unsigned long module_kallsyms_lookup_name(const char *name) | |||
2612 | preempt_enable(); | 2612 | preempt_enable(); |
2613 | return ret; | 2613 | return ret; |
2614 | } | 2614 | } |
2615 | |||
2616 | int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
2617 | struct module *, unsigned long), | ||
2618 | void *data) | ||
2619 | { | ||
2620 | struct module *mod; | ||
2621 | unsigned int i; | ||
2622 | int ret; | ||
2623 | |||
2624 | list_for_each_entry(mod, &modules, list) { | ||
2625 | for (i = 0; i < mod->num_symtab; i++) { | ||
2626 | ret = fn(data, mod->strtab + mod->symtab[i].st_name, | ||
2627 | mod, mod->symtab[i].st_value); | ||
2628 | if (ret != 0) | ||
2629 | return ret; | ||
2630 | } | ||
2631 | } | ||
2632 | return 0; | ||
2633 | } | ||
2615 | #endif /* CONFIG_KALLSYMS */ | 2634 | #endif /* CONFIG_KALLSYMS */ |
2616 | 2635 | ||
2617 | static char *module_flags(struct module *mod, char *buf) | 2636 | static char *module_flags(struct module *mod, char *buf) |