diff options
author | Alexey Dobriyan <adobriyan@sw.ru> | 2007-05-08 00:28:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 11:15:08 -0700 |
commit | ffb45122766db220d0bf3d01848d575fbbcb6430 (patch) | |
tree | a8fedf0518407ad12578a7c03aa2c3344f11ff3c /kernel | |
parent | ea07890a680273b25127129fb555aac0d9324bea (diff) |
Simplify kallsyms_lookup()
Several kallsyms_lookup() pass dummy arguments but only need, say, module's
name. Make kallsyms_lookup() accept NULLs where possible.
Also, makes picture clearer about what interfaces are needed for all symbol
resolving business.
Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kallsyms.c | 6 | ||||
-rw-r--r-- | kernel/kprobes.c | 4 | ||||
-rw-r--r-- | kernel/lockdep.c | 5 | ||||
-rw-r--r-- | kernel/module.c | 6 | ||||
-rw-r--r-- | kernel/time/timer_list.c | 4 | ||||
-rw-r--r-- | kernel/time/timer_stats.c | 4 |
6 files changed, 13 insertions, 16 deletions
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index f1ea6f66ac6..f66da025cb7 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -214,8 +214,10 @@ static unsigned long get_symbol_pos(unsigned long addr, symbol_end = (unsigned long)_etext; } - *symbolsize = symbol_end - symbol_start; - *offset = addr - symbol_start; + if (symbolsize) + *symbolsize = symbol_end - symbol_start; + if (offset) + *offset = addr - symbol_start; return low; } diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 0207045b4f6..bee29bde6ad 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -868,13 +868,13 @@ static int __kprobes show_kprobe_addr(struct seq_file *pi, void *v) struct kprobe *p, *kp; const char *sym = NULL; unsigned int i = *(loff_t *) v; - unsigned long size, offset = 0; + unsigned long offset = 0; char *modname, namebuf[128]; head = &kprobe_table[i]; preempt_disable(); hlist_for_each_entry_rcu(p, node, head, hlist) { - sym = kallsyms_lookup((unsigned long)p->addr, &size, + sym = kallsyms_lookup((unsigned long)p->addr, NULL, &offset, &modname, namebuf); if (p->pre_handler == aggr_pre_handler) { list_for_each_entry_rcu(kp, &p->list, list) diff --git a/kernel/lockdep.c b/kernel/lockdep.c index c1e308a080b..7f573136a90 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -340,10 +340,7 @@ static const char *usage_str[] = const char * __get_key_name(struct lockdep_subclass_key *key, char *str) { - unsigned long offs, size; - char *modname; - - return kallsyms_lookup((unsigned long)key, &size, &offs, &modname, str); + return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str); } void diff --git a/kernel/module.c b/kernel/module.c index 5ee65994a3b..bf4dccadf7b 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2098,8 +2098,10 @@ static const char *get_ksymbol(struct module *mod, if (!best) return NULL; - *size = nextval - mod->symtab[best].st_value; - *offset = addr - mod->symtab[best].st_value; + if (size) + *size = nextval - mod->symtab[best].st_value; + if (offset) + *offset = addr - mod->symtab[best].st_value; return mod->strtab + mod->symtab[best].st_name; } diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index 59df5e8555a..fe9314a89f2 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -40,11 +40,9 @@ static void print_name_offset(struct seq_file *m, void *sym) { unsigned long addr = (unsigned long)sym; char namebuf[KSYM_NAME_LEN+1]; - unsigned long size, offset; const char *sym_name; - char *modname; - sym_name = kallsyms_lookup(addr, &size, &offset, &modname, namebuf); + sym_name = kallsyms_lookup(addr, NULL, NULL, NULL, namebuf); if (sym_name) SEQ_printf(m, "%s", sym_name); else diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c index 1bc4882e28e..946ed45f7d2 100644 --- a/kernel/time/timer_stats.c +++ b/kernel/time/timer_stats.c @@ -258,11 +258,9 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf, static void print_name_offset(struct seq_file *m, unsigned long addr) { char namebuf[KSYM_NAME_LEN+1]; - unsigned long size, offset; const char *sym_name; - char *modname; - sym_name = kallsyms_lookup(addr, &size, &offset, &modname, namebuf); + sym_name = kallsyms_lookup(addr, NULL, NULL, NULL, namebuf); if (sym_name) seq_printf(m, "%s", sym_name); else |