diff options
Diffstat (limited to 'kernel/module.c')
| -rw-r--r-- | kernel/module.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 3da76ad32d78..d36e45477fac 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -2149,6 +2149,33 @@ out: | |||
| 2149 | return -ERANGE; | 2149 | return -ERANGE; |
| 2150 | } | 2150 | } |
| 2151 | 2151 | ||
| 2152 | int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, | ||
| 2153 | unsigned long *offset, char *modname, char *name) | ||
| 2154 | { | ||
| 2155 | struct module *mod; | ||
| 2156 | |||
| 2157 | mutex_lock(&module_mutex); | ||
| 2158 | list_for_each_entry(mod, &modules, list) { | ||
| 2159 | if (within(addr, mod->module_init, mod->init_size) || | ||
| 2160 | within(addr, mod->module_core, mod->core_size)) { | ||
| 2161 | const char *sym; | ||
| 2162 | |||
| 2163 | sym = get_ksymbol(mod, addr, size, offset); | ||
| 2164 | if (!sym) | ||
| 2165 | goto out; | ||
| 2166 | if (modname) | ||
| 2167 | strlcpy(modname, mod->name, MODULE_NAME_LEN + 1); | ||
| 2168 | if (name) | ||
| 2169 | strlcpy(name, sym, KSYM_NAME_LEN + 1); | ||
| 2170 | mutex_unlock(&module_mutex); | ||
| 2171 | return 0; | ||
| 2172 | } | ||
| 2173 | } | ||
| 2174 | out: | ||
| 2175 | mutex_unlock(&module_mutex); | ||
| 2176 | return -ERANGE; | ||
| 2177 | } | ||
| 2178 | |||
| 2152 | int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, | 2179 | int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, |
| 2153 | char *name, char *module_name, int *exported) | 2180 | char *name, char *module_name, int *exported) |
| 2154 | { | 2181 | { |
