Re: + extend-print_symbol-capability.patch added to -mm tree

From: Randy Dunlap
Date: Thu Mar 01 2007 - 21:56:10 EST


On Thu, 01 Mar 2007 18:17:56 -0800 akpm@xxxxxxxxxxxxxxxxxxxx wrote:

> Today's print_symbol function dumps a kernel symbol with printk. This
> patch extends the functionality of kallsyms.c so that the symbol lookup
> function may be used without the printk. This is useful for modules that
> want to dump symbols elsewhere, for example, to debugfs. I intend to use
> the new function call in the GFS2 file system (which will be a separate
> patch).

Hey, I've needed this one in the past. Thanks.

> ---
>
> include/linux/kallsyms.h | 10 ++++++++++
> kernel/kallsyms.c | 21 ++++++++++++++-------
> 2 files changed, 24 insertions(+), 7 deletions(-)
>
> diff -puN kernel/kallsyms.c~extend-print_symbol-capability kernel/kallsyms.c
> --- a/kernel/kallsyms.c~extend-print_symbol-capability
> +++ a/kernel/kallsyms.c

> @@ -288,6 +285,15 @@ void __print_symbol(const char *fmt, uns
> else
> sprintf(buffer, "%s+%#lx/%#lx", name, offset, size);
> }
> +}
> +
> +/* Replace "%s" in format with address, or returns -errno. */

Please fix the comment above...

> +void __print_symbol(const char *fmt, unsigned long address)
> +{
> + char buffer[KSYM_SYMBOL_LEN];
> +
> + lookup_symbol(address, buffer);
> +
> printk(fmt, buffer);
> }


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/