diff options
author | Anders Kaseorg <andersk@mit.edu> | 2008-12-05 19:03:58 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2009-03-30 22:35:32 -0400 |
commit | 75a66614db21007bcc8c37f9c5d5b922981387b9 (patch) | |
tree | d02c905a3aee02ec25ce38700f47d0fa57d2cbf7 /include/linux | |
parent | a6e6abd575fcbe6572ebc7a70ad616406d206fa8 (diff) |
Ksplice: Add functions for walking kallsyms symbols
Impact: New API
kallsyms_lookup_name only returns the first match that it finds. Ksplice
needs information about all symbols with a given name in order to correctly
resolve local symbols.
kallsyms_on_each_symbol provides a generic mechanism for iterating over the
kallsyms table.
Cc: Jeff Arnold <jbarnold@mit.edu>
Cc: Tim Abbott <tabbott@mit.edu>
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/kallsyms.h | 15 | ||||
-rw-r--r-- | include/linux/module.h | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index f3fe34391d8e..792274269f2b 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h | |||
@@ -13,10 +13,17 @@ | |||
13 | #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ | 13 | #define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ |
14 | 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) | 14 | 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1) |
15 | 15 | ||
16 | struct module; | ||
17 | |||
16 | #ifdef CONFIG_KALLSYMS | 18 | #ifdef CONFIG_KALLSYMS |
17 | /* Lookup the address for a symbol. Returns 0 if not found. */ | 19 | /* Lookup the address for a symbol. Returns 0 if not found. */ |
18 | unsigned long kallsyms_lookup_name(const char *name); | 20 | unsigned long kallsyms_lookup_name(const char *name); |
19 | 21 | ||
22 | /* Call a function on each kallsyms symbol in the core kernel */ | ||
23 | int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, | ||
24 | unsigned long), | ||
25 | void *data); | ||
26 | |||
20 | extern int kallsyms_lookup_size_offset(unsigned long addr, | 27 | extern int kallsyms_lookup_size_offset(unsigned long addr, |
21 | unsigned long *symbolsize, | 28 | unsigned long *symbolsize, |
22 | unsigned long *offset); | 29 | unsigned long *offset); |
@@ -43,6 +50,14 @@ static inline unsigned long kallsyms_lookup_name(const char *name) | |||
43 | return 0; | 50 | return 0; |
44 | } | 51 | } |
45 | 52 | ||
53 | static inline int kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
54 | struct module *, | ||
55 | unsigned long), | ||
56 | void *data) | ||
57 | { | ||
58 | return 0; | ||
59 | } | ||
60 | |||
46 | static inline int kallsyms_lookup_size_offset(unsigned long addr, | 61 | static inline int kallsyms_lookup_size_offset(unsigned long addr, |
47 | unsigned long *symbolsize, | 62 | unsigned long *symbolsize, |
48 | unsigned long *offset) | 63 | unsigned long *offset) |
diff --git a/include/linux/module.h b/include/linux/module.h index 69761ce0dbf0..c3d3fc4ffb18 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -387,6 +387,10 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, | |||
387 | /* Look for this name: can be of form module:name. */ | 387 | /* Look for this name: can be of form module:name. */ |
388 | unsigned long module_kallsyms_lookup_name(const char *name); | 388 | unsigned long module_kallsyms_lookup_name(const char *name); |
389 | 389 | ||
390 | int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
391 | struct module *, unsigned long), | ||
392 | void *data); | ||
393 | |||
390 | extern void __module_put_and_exit(struct module *mod, long code) | 394 | extern void __module_put_and_exit(struct module *mod, long code) |
391 | __attribute__((noreturn)); | 395 | __attribute__((noreturn)); |
392 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); | 396 | #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); |
@@ -566,6 +570,14 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name) | |||
566 | return 0; | 570 | return 0; |
567 | } | 571 | } |
568 | 572 | ||
573 | static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, | ||
574 | struct module *, | ||
575 | unsigned long), | ||
576 | void *data) | ||
577 | { | ||
578 | return 0; | ||
579 | } | ||
580 | |||
569 | static inline int register_module_notifier(struct notifier_block * nb) | 581 | static inline int register_module_notifier(struct notifier_block * nb) |
570 | { | 582 | { |
571 | /* no events will happen anyway, so this can always succeed */ | 583 | /* no events will happen anyway, so this can always succeed */ |