Cleanup 1/2: Remove exported symbol list
PATCH 1/1 Cleanup 1/2: Remove exported symbol list
Now that the symbol lists and module lists are finally static to kernel/module.c, we can get rid of the extable list (and just traverse the modules), without effecting anyone else.
Name: Symbol list removal
Author: Rusty Russell
Status: Tested on 2.5.56
D: This removes the symbol list, and the concept of kernel symbol groups,
D: in favour of just iterating through the modules. Now all iteration is
D: within kernel/module.c, this is a fairly trivial cleanup.
include/linux/module.h +7 -30
@@ -106,21 +106,6 @@ extern const struct gtype##_id __mod_##g#define MODULE_DEVICE_TABLE (type,name) \ MODULE_GENERIC_TABLE(type##_device,name) -struct kernel_symbol_group -{ -/* Links us into the global symbol list */ -struct list_head list; - -/* Module which owns it (if any) */ -struct module *owner; - -/* Are we internal use only? */ -int gplonly; - -unsigned int num_syms; -const struct kernel_symbol *syms; -}; -/* Given an address, look for it in the exception tables */ const struct exception_table_entry *search_exception_tables (unsigned long add);
@@ -175,10 +160,12 @@ struct modulechar name[MODULE_NAME_LEN ];/* Exported symbols */ -struct kernel_symbol_group symbols; +const struct kernel_symbol *syms; +unsigned int num_ksyms;/* GPL-only exported symbols. */ -struct kernel_symbol_group gpl_symbols; +const struct kernel_symbol *gpl_syms; +unsigned int num_gpl_syms;/* Exception tables */ struct exception_table extable;
@@ -239,7 +226,7 @@ static inline int module_is_live(struct }/* Is this address in a module? */ -int module_text_address (unsigned long addr); +struct module *module_text_address (unsigned long addr);#ifdef CONFIG_MODULE_UNLOAD
@@ -332,9 +319,9 @@ search_module_extables(unsigned long add }/* Is this address in a module? */ -static inline int module_text_address (unsigned long addr) +static inline struct module *module_text_address (unsigned long addr) { -return 0 ; +return NULL ; }/* Get/put a kernel symbol (calls should be symmetric) */
@@ -359,8 +352,6 @@ extern struct module __this_module; struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name =__stringify (KBUILD_MODNAME ), - .symbols = { .owner = &__this_module }, - .gpl_symbols = { .owner = &__this_module, .gplonly =1 }, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module,
@@ -436,14 +423,6 @@ extern int module_dummy_usage;#define MOD_IN_USE 0#define __MODULE_STRING (x) __stringify(x) -/* -* The exception and symbol tables, and the lock -* to protect them. -*/ -extern spinlock_t modlist_lock; -extern struct list_head extables; -extern struct list_head symbols; -/* Use symbol_get and symbol_put instead. You'll thank me. */ #define HAVE_INTER_MODULE extern void inter_module_register (const char *,struct module *,const void *);
include/linux/moduleloader.h +1 -1
@@ -11,7 +11,7 @@ unsigned long find_symbol_internal(Elf_Sconst char *strtab, const char *name, struct module *mod, - struct kernel_symbol_group **group); + struct module **owner);/* These must be implemented by the specific architecture */
kernel/extable.c +1 -1
@@ -38,5 +38,5 @@ int kernel_text_address(unsigned long ad addr <= (unsigned long)_etext)return 1 ; -return module_text_address (addr); +return module_text_address (addr) !=NULL ; }
kernel/module.c +51 -75
231 lines not on this page · raw message
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.