aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-05-08 21:29:27 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-05-08 21:29:27 -0400
commitd585a021c0b10b0477d6b608c53e1feb8cde0507 (patch)
tree5ca059da1db7f15d4b29427644ad9c08270c885c /include/linux/module.h
parent84e5b0d00f8f84c4ae226be131d4bebbcee88bd3 (diff)
parent091bf7624d1c90cec9e578a18529f615213ff847 (diff)
Merge commit 'v2.6.30-rc5' into next
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h68
1 files changed, 60 insertions, 8 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index 145a75528cc1..627ac082e2a6 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -248,6 +248,10 @@ struct module
248 const unsigned long *crcs; 248 const unsigned long *crcs;
249 unsigned int num_syms; 249 unsigned int num_syms;
250 250
251 /* Kernel parameters. */
252 struct kernel_param *kp;
253 unsigned int num_kp;
254
251 /* GPL-only exported symbols. */ 255 /* GPL-only exported symbols. */
252 unsigned int num_gpl_syms; 256 unsigned int num_gpl_syms;
253 const struct kernel_symbol *gpl_syms; 257 const struct kernel_symbol *gpl_syms;
@@ -329,6 +333,11 @@ struct module
329 unsigned int num_tracepoints; 333 unsigned int num_tracepoints;
330#endif 334#endif
331 335
336#ifdef CONFIG_TRACING
337 const char **trace_bprintk_fmt_start;
338 unsigned int num_trace_bprintk_fmt;
339#endif
340
332#ifdef CONFIG_MODULE_UNLOAD 341#ifdef CONFIG_MODULE_UNLOAD
333 /* What modules depend on me? */ 342 /* What modules depend on me? */
334 struct list_head modules_which_use_me; 343 struct list_head modules_which_use_me;
@@ -350,6 +359,8 @@ struct module
350#define MODULE_ARCH_INIT {} 359#define MODULE_ARCH_INIT {}
351#endif 360#endif
352 361
362extern struct mutex module_mutex;
363
353/* FIXME: It'd be nice to isolate modules during init, too, so they 364/* FIXME: It'd be nice to isolate modules during init, too, so they
354 aren't used before they (may) fail. But presently too much code 365 aren't used before they (may) fail. But presently too much code
355 (IDE & SCSI) require entry into the module during init.*/ 366 (IDE & SCSI) require entry into the module during init.*/
@@ -358,10 +369,10 @@ static inline int module_is_live(struct module *mod)
358 return mod->state != MODULE_STATE_GOING; 369 return mod->state != MODULE_STATE_GOING;
359} 370}
360 371
361/* Is this address in a module? (second is with no locks, for oops) */
362struct module *module_text_address(unsigned long addr);
363struct module *__module_text_address(unsigned long addr); 372struct module *__module_text_address(unsigned long addr);
364int is_module_address(unsigned long addr); 373struct module *__module_address(unsigned long addr);
374bool is_module_address(unsigned long addr);
375bool is_module_text_address(unsigned long addr);
365 376
366static inline int within_module_core(unsigned long addr, struct module *mod) 377static inline int within_module_core(unsigned long addr, struct module *mod)
367{ 378{
@@ -375,6 +386,31 @@ static inline int within_module_init(unsigned long addr, struct module *mod)
375 addr < (unsigned long)mod->module_init + mod->init_size; 386 addr < (unsigned long)mod->module_init + mod->init_size;
376} 387}
377 388
389/* Search for module by name: must hold module_mutex. */
390struct module *find_module(const char *name);
391
392struct symsearch {
393 const struct kernel_symbol *start, *stop;
394 const unsigned long *crcs;
395 enum {
396 NOT_GPL_ONLY,
397 GPL_ONLY,
398 WILL_BE_GPL_ONLY,
399 } licence;
400 bool unused;
401};
402
403/* Search for an exported symbol by name. */
404const struct kernel_symbol *find_symbol(const char *name,
405 struct module **owner,
406 const unsigned long **crc,
407 bool gplok,
408 bool warn);
409
410/* Walk the exported symbol table */
411bool each_symbol(bool (*fn)(const struct symsearch *arr, struct module *owner,
412 unsigned int symnum, void *data), void *data);
413
378/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 414/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
379 symnum out of range. */ 415 symnum out of range. */
380int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 416int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
@@ -383,6 +419,10 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
383/* Look for this name: can be of form module:name. */ 419/* Look for this name: can be of form module:name. */
384unsigned long module_kallsyms_lookup_name(const char *name); 420unsigned long module_kallsyms_lookup_name(const char *name);
385 421
422int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
423 struct module *, unsigned long),
424 void *data);
425
386extern void __module_put_and_exit(struct module *mod, long code) 426extern void __module_put_and_exit(struct module *mod, long code)
387 __attribute__((noreturn)); 427 __attribute__((noreturn));
388#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); 428#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
@@ -444,6 +484,7 @@ static inline void __module_get(struct module *module)
444#define symbol_put_addr(p) do { } while(0) 484#define symbol_put_addr(p) do { } while(0)
445 485
446#endif /* CONFIG_MODULE_UNLOAD */ 486#endif /* CONFIG_MODULE_UNLOAD */
487int use_module(struct module *a, struct module *b);
447 488
448/* This is a #define so the string doesn't get put in every .o file */ 489/* This is a #define so the string doesn't get put in every .o file */
449#define module_name(mod) \ 490#define module_name(mod) \
@@ -490,21 +531,24 @@ search_module_extables(unsigned long addr)
490 return NULL; 531 return NULL;
491} 532}
492 533
493/* Is this address in a module? */ 534static inline struct module *__module_address(unsigned long addr)
494static inline struct module *module_text_address(unsigned long addr)
495{ 535{
496 return NULL; 536 return NULL;
497} 537}
498 538
499/* Is this address in a module? (don't take a lock, we're oopsing) */
500static inline struct module *__module_text_address(unsigned long addr) 539static inline struct module *__module_text_address(unsigned long addr)
501{ 540{
502 return NULL; 541 return NULL;
503} 542}
504 543
505static inline int is_module_address(unsigned long addr) 544static inline bool is_module_address(unsigned long addr)
506{ 545{
507 return 0; 546 return false;
547}
548
549static inline bool is_module_text_address(unsigned long addr)
550{
551 return false;
508} 552}
509 553
510/* Get/put a kernel symbol (calls should be symmetric) */ 554/* Get/put a kernel symbol (calls should be symmetric) */
@@ -559,6 +603,14 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name)
559 return 0; 603 return 0;
560} 604}
561 605
606static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
607 struct module *,
608 unsigned long),
609 void *data)
610{
611 return 0;
612}
613
562static inline int register_module_notifier(struct notifier_block * nb) 614static inline int register_module_notifier(struct notifier_block * nb)
563{ 615{
564 /* no events will happen anyway, so this can always succeed */ 616 /* no events will happen anyway, so this can always succeed */