[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <401afda17296e380049b129c92a9ae27e8e47fc3.1221280912.git.jbarnold@mit.edu>
Date: Sat, 13 Sep 2008 00:49:50 -0400
From: Jeffrey Brian Arnold <jbarnold@....EDU>
To: linux-kernel@...r.kernel.org
Cc: Tim Abbott <tabbott@....edu>, Anders Kaseorg <andersk@....edu>,
Waseem Daher <wdaher@....edu>,
Denys Vlasenko <vda.linux@...glemail.com>
Subject: [RFC PATCH 4/9] Ksplice: Make needed symbol and module functions global
From: Tim Abbott <tabbott@....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@....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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists