mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
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>
This commit is contained in:
parent
a6e6abd575
commit
75a66614db
4 changed files with 65 additions and 0 deletions
|
@ -2612,6 +2612,25 @@ unsigned long module_kallsyms_lookup_name(const char *name)
|
|||
preempt_enable();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
||||
struct module *, unsigned long),
|
||||
void *data)
|
||||
{
|
||||
struct module *mod;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
list_for_each_entry(mod, &modules, list) {
|
||||
for (i = 0; i < mod->num_symtab; i++) {
|
||||
ret = fn(data, mod->strtab + mod->symtab[i].st_name,
|
||||
mod, mod->symtab[i].st_value);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_KALLSYMS */
|
||||
|
||||
static char *module_flags(struct module *mod, char *buf)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue