Messages in this thread Patch in this message | | | From | Jeffrey Brian Arnold <> | Subject | [RFC PATCH 4/9] Ksplice: Make needed symbol and module functions global | Date | Sat, 13 Sep 2008 00:49:50 -0400 |
| |
From: Tim Abbott <tabbott@mit.edu>
Make module_mutex, find_module(), find_symbol(), and use_module() global. Ksplice needs access to these functions from module.c in order to resolve symbols and implement dependency handling.
Signed-off-by: Tim Abbott <tabbott@mit.edu> --- include/linux/module.h | 13 +++++++++++++ kernel/module.c | 18 +++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/include/linux/module.h b/include/linux/module.h index cd982cd..6ae0fc9 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -351,6 +351,8 @@ struct module #define MODULE_ARCH_INIT {} #endif +extern struct mutex module_mutex; + /* FIXME: It'd be nice to isolate modules during init, too, so they aren't used before they (may) fail. But presently too much code (IDE & SCSI) require entry into the module during init.*/ @@ -366,6 +368,16 @@ struct module *module_data_address(unsigned long addr); struct module *__module_data_address(unsigned long addr); int is_module_address(unsigned long addr); +/* Search for module by name: must hold module_mutex. */ +struct module *find_module(const char *name); + +/* Search for an exported symbol by name. */ +const struct kernel_symbol *find_symbol(const char *name, + struct module **owner, + const unsigned long **crc, + bool gplok, + bool warn); + /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if symnum out of range. */ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, @@ -431,6 +443,7 @@ static inline void __module_get(struct module *module) #define symbol_put_addr(p) do { } while(0) #endif /* CONFIG_MODULE_UNLOAD */ +int use_module(struct module *a, struct module *b); /* This is a #define so the string doesn't get put in every .o file */ #define module_name(mod) \ diff --git a/kernel/module.c b/kernel/module.c index 343c8f8..2acb646 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -62,7 +62,7 @@ /* List of modules, protected by module_mutex or preempt_disable * (add/delete uses stop_machine). */ -static DEFINE_MUTEX(module_mutex); +DEFINE_MUTEX(module_mutex); static LIST_HEAD(modules); /* Waiting for a module to finish initializing? */ @@ -301,11 +301,11 @@ static bool find_symbol_in_section(const struct symsearch *syms, /* Find a symbol and return it, along with, (optional) crc and * (optional) module which owns it */ -static const struct kernel_symbol *find_symbol(const char *name, - struct module **owner, - const unsigned long **crc, - bool gplok, - bool warn) +const struct kernel_symbol *find_symbol(const char *name, + struct module **owner, + const unsigned long **crc, + bool gplok, + bool warn) { struct find_symbol_arg fsa; @@ -326,7 +326,7 @@ static const struct kernel_symbol *find_symbol(const char *name, } /* Search for module by name: must hold module_mutex. */ -static struct module *find_module(const char *name) +struct module *find_module(const char *name) { struct module *mod; @@ -579,7 +579,7 @@ static int already_uses(struct module *a, struct module *b) } /* Module a uses b */ -static int use_module(struct module *a, struct module *b) +int use_module(struct module *a, struct module *b) { struct module_use *use; int no_warn, err; @@ -874,7 +874,7 @@ static inline void module_unload_free(struct module *mod) { } -static inline int use_module(struct module *a, struct module *b) +int use_module(struct module *a, struct module *b) { return strong_try_module_get(b) == 0; } -- 1.5.4.3
| |