diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kallsyms.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 48f36fd7e10b..0008ada2b135 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -307,6 +307,24 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, return 0; } +int kallsyms_on_each_match_symbol(int (*fn)(void *, unsigned long), + const char *name, void *data) +{ + int ret; + unsigned int i, start, end; + + ret = kallsyms_lookup_names(name, &start, &end); + if (ret) + return 0; + + for (i = start; !ret && i <= end; i++) { + ret = fn(data, kallsyms_sym_address(get_symbol_seq(i))); + cond_resched(); + } + + return ret; +} + static unsigned long get_symbol_pos(unsigned long addr, unsigned long *symbolsize, unsigned long *offset) |