Skip to contentSkip to conversation

Minor module cleanup 2/3

PATCH New Rusty Russell 1 participant 1 message Mar 27, 2003 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Minor module cleanup 2/3

Linus, please apply.

This removes the separate symbol list: it has a 1:1 mapping with the module list anyway.

[ This is made trivial by the fact that noone accesses this list from
outside module.c any more. ]

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

Name: Symbol list removal
Author: Rusty Russell
Status: Tested on 2.5.66-bk2
Depends: Module/module-text-address.patch.gz

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 +6 -28
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .21809-linux-2.5.61-bk1/include/linux/module.h .21809-linux-2.5.61-bk1.updated/include/linux/module.h
@@ -115,22 +115,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;
-	const unsigned long *crcs;
-};
-
 /* Given an address, look for it in the exception tables */
 const struct exception_table_entry *search_exception_tables(unsigned long add);
 
@@ -214,10 +198,14 @@ struct module
 	char name[MODULE_NAME_LEN];
 
 	/* Exported symbols */
-	struct kernel_symbol_group symbols;
+	const struct kernel_symbol *syms;
+	unsigned int num_ksyms;
+	const unsigned long *crcs;
 
 	/* GPL-only exported symbols. */
-	struct kernel_symbol_group gpl_symbols;
+	const struct kernel_symbol *gpl_syms;
+	unsigned int num_gpl_syms;
+	const unsigned long *gpl_crcs;
 
 	/* Exception tables */
 	struct exception_table extable;
@@ -411,8 +399,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,
@@ -472,14 +458,6 @@ static inline void __deprecated _MOD_INC
 #define EXPORT_NO_SYMBOLS
 #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 *);
kernel/module.c +75 -86

264 lines not on this page · raw message

b_gpl;
- kernel_gpl_symbols.gplonly = 1;
- list_add(&kernel_gpl_symbols.list, &symbols);
-
- return 0;
+ return mod;
+ return NULL;
}
-
-__initcall(symbols_init);