summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-04-02 02:10:23 -0600
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-04-02 02:10:23 -0600
commit494c779a0cd1f63eeca35eaaa4a4038eca0b4b84 (patch)
tree2d60ae5984da9e650ced26be54fba0e0b33be414
parentb35e3015ec7ab817f731ce9a275825484d579abd (diff)
modules: Fix exporting symbols from modules
This patch fixes two issues: o The CONFIG_MODVERSIONING=y case broke at compile time since some functions were not updated with the latest module changes o Exporting symbols from modules stopped working due to confusion of mod->num_syms and mod->num_ksyms. Rename mod->num_ksyms to mod->num_syms, which is more logical since the associated array is called ->syms, and for the kallsyms member use "num_symtab", since the associated array is ->symtab.
-rw-r--r--include/linux/module.h4
-rw-r--r--kernel/module.c18
2 files changed, 12 insertions, 10 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 57918bfaba25..30892e436401 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -183,7 +183,7 @@ struct module
/* Exported symbols */
const struct kernel_symbol *syms;
- unsigned int num_ksyms;
+ unsigned int num_syms;
const unsigned long *crcs;
/* GPL-only exported symbols. */
@@ -233,7 +233,7 @@ struct module
#ifdef CONFIG_KALLSYMS
/* We keep the symbol and string tables for kallsyms. */
Elf_Sym *symtab;
- unsigned long num_syms;
+ unsigned long num_symtab;
char *strtab;
#endif
diff --git a/kernel/module.c b/kernel/module.c
index f37abf4c1e1b..dbb503b729ee 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -156,7 +156,7 @@ static unsigned long __find_symbol(const char *name,
/* Now try modules. */
list_for_each_entry(mod, &modules, list) {
*owner = mod;
- for (i = 0; i < mod->num_ksyms; i++)
+ for (i = 0; i < mod->num_syms; i++)
if (strcmp(mod->syms[i].name, name) == 0) {
*crc = symversion(mod->crcs, i);
return mod->syms[i].value;
@@ -839,12 +839,13 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
unsigned int versindex,
struct module *mod)
{
- unsigned int i;
- struct kernel_symbol_group *ksg;
+ const unsigned long *crc;
+ struct module *owner;
- if (!__find_symbol("struct_module", &ksg, &i, 1))
+ if (!__find_symbol("struct_module", &owner, &crc, 1))
BUG();
- return check_version(sechdrs, versindex, "struct_module", mod, ksg, i);
+ return check_version(sechdrs, versindex, "struct_module", mod,
+ crc);
}
/* First part is kernel version, which we ignore. */
@@ -1283,7 +1284,8 @@ static struct module *load_module(void *umod,
mod->gpl_crcs = (void *)sechdrs[gplcrcindex].sh_addr;
#ifdef CONFIG_MODVERSIONS
- if ((mod->num_ksyms&&!crcindex) || (mod->num_gpl_syms&&!gplcrcindex)) {
+ if ((mod->num_syms && !crcindex) ||
+ (mod->num_gpl_syms && !gplcrcindex)) {
printk(KERN_WARNING "%s: No versions for exported symbols."
" Tainting kernel.\n", mod->name);
tainted |= TAINT_FORCED_MODULE;
@@ -1309,7 +1311,7 @@ static struct module *load_module(void *umod,
#ifdef CONFIG_KALLSYMS
mod->symtab = (void *)sechdrs[symindex].sh_addr;
- mod->num_syms = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
+ mod->num_symtab = sechdrs[symindex].sh_size / sizeof(Elf_Sym);
mod->strtab = (void *)sechdrs[strindex].sh_addr;
#endif
err = module_finalize(hdr, sechdrs, mod);
@@ -1452,7 +1454,7 @@ static const char *get_ksymbol(struct module *mod,
/* Scan for closest preceeding symbol, and next symbol. (ELF
starts real symbols at 1). */
- for (i = 1; i < mod->num_syms; i++) {
+ for (i = 1; i < mod->num_symtab; i++) {
if (mod->symtab[i].st_shndx == SHN_UNDEF)
continue;