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/kallsyms.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/kallsyms.c')
-rw-r--r-- | kernel/kallsyms.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 7b8b0f21a5b1..374faf9bfdc7 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c | |||
@@ -161,6 +161,25 @@ unsigned long kallsyms_lookup_name(const char *name) | |||
161 | return module_kallsyms_lookup_name(name); | 161 | return module_kallsyms_lookup_name(name); |
162 | } | 162 | } |
163 | 163 | ||
164 | int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, | ||
165 | unsigned long), | ||
166 | void *data) | ||
167 | { | ||
168 | char namebuf[KSYM_NAME_LEN]; | ||
169 | unsigned long i; | ||
170 | unsigned int off; | ||
171 | int ret; | ||
172 | |||
173 | for (i = 0, off = 0; i < kallsyms_num_syms; i++) { | ||
174 | off = kallsyms_expand_symbol(off, namebuf); | ||
175 | ret = fn(data, namebuf, NULL, kallsyms_addresses[i]); | ||
176 | if (ret != 0) | ||
177 | return ret; | ||
178 | } | ||
179 | return module_kallsyms_on_each_symbol(fn, data); | ||
180 | } | ||
181 | EXPORT_SYMBOL_GPL(kallsyms_on_each_symbol); | ||
182 | |||
164 | static unsigned long get_symbol_pos(unsigned long addr, | 183 | static unsigned long get_symbol_pos(unsigned long addr, |
165 | unsigned long *symbolsize, | 184 | unsigned long *symbolsize, |
166 | unsigned long *offset) | 185 | unsigned long *offset) |