aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorTim Abbott <tabbott@mit.edu>2008-12-05 19:03:59 -0500
committerRusty Russell <rusty@rustcorp.com.au>2009-03-30 22:35:33 -0400
commitc6b37801911d7f4663c99cad8aa230bc934cea82 (patch)
treea39a317c5f9fa2d5ba9813bbe29e3139c52e194e /include/linux/module.h
parent75a66614db21007bcc8c37f9c5d5b922981387b9 (diff)
module: Export symbols needed for Ksplice
Impact: Expose some module.c symbols Ksplice uses several functions from module.c in order to resolve symbols and implement dependency handling. Calling these functions requires holding module_mutex, so it is exported. (This is just the module part of a bigger add-exports patch from Tim). Cc: Anders Kaseorg <andersk@mit.edu> Cc: Jeff Arnold <jbarnold@mit.edu> Signed-off-by: Tim Abbott <tabbott@mit.edu> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index c3d3fc4ffb1..d246da0b0f8 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -354,6 +354,8 @@ struct module
354#define MODULE_ARCH_INIT {} 354#define MODULE_ARCH_INIT {}
355#endif 355#endif
356 356
357extern struct mutex module_mutex;
358
357/* FIXME: It'd be nice to isolate modules during init, too, so they 359/* FIXME: It'd be nice to isolate modules during init, too, so they
358 aren't used before they (may) fail. But presently too much code 360 aren't used before they (may) fail. But presently too much code
359 (IDE & SCSI) require entry into the module during init.*/ 361 (IDE & SCSI) require entry into the module during init.*/
@@ -379,6 +381,31 @@ static inline int within_module_init(unsigned long addr, struct module *mod)
379 addr < (unsigned long)mod->module_init + mod->init_size; 381 addr < (unsigned long)mod->module_init + mod->init_size;
380} 382}
381 383
384/* Search for module by name: must hold module_mutex. */
385struct module *find_module(const char *name);
386
387struct symsearch {
388 const struct kernel_symbol *start, *stop;
389 const unsigned long *crcs;
390 enum {
391 NOT_GPL_ONLY,
392 GPL_ONLY,
393 WILL_BE_GPL_ONLY,
394 } licence;
395 bool unused;
396};
397
398/* Search for an exported symbol by name. */
399const struct kernel_symbol *find_symbol(const char *name,
400 struct module **owner,
401 const unsigned long **crc,
402 bool gplok,
403 bool warn);
404
405/* Walk the exported symbol table */
406bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner,
407 unsigned int symnum, void *data), void *data);
408
382/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 409/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
383 symnum out of range. */ 410 symnum out of range. */
384int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 411int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
@@ -452,6 +479,7 @@ static inline void __module_get(struct module *module)
452#define symbol_put_addr(p) do { } while(0) 479#define symbol_put_addr(p) do { } while(0)
453 480
454#endif /* CONFIG_MODULE_UNLOAD */ 481#endif /* CONFIG_MODULE_UNLOAD */
482int use_module(struct module *a, struct module *b);
455 483
456/* This is a #define so the string doesn't get put in every .o file */ 484/* This is a #define so the string doesn't get put in every .o file */
457#define module_name(mod) \ 485#define module_name(mod) \