MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / kallsyms.h
blob1a5dce8f934623f226d9f367c97db79c7df64442
1 /* Rewritten and vastly simplified by Rusty Russell for in-kernel
2 * module loader:
3 * Copyright 2002 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
4 */
5 #ifndef _LINUX_KALLSYMS_H
6 #define _LINUX_KALLSYMS_H
8 #include <linux/config.h>
10 #define KSYM_NAME_LEN 127
12 #ifdef CONFIG_KALLSYMS
13 /* Lookup the address for a symbol. Returns 0 if not found. */
14 unsigned long kallsyms_lookup_name(const char *name);
16 /* Lookup an address. modname is set to NULL if it's in the kernel. */
17 const char *kallsyms_lookup(unsigned long addr,
18 unsigned long *symbolsize,
19 unsigned long *offset,
20 char **modname, char *namebuf);
22 /* Replace "%s" in format with address, if found */
23 extern void __print_symbol(const char *fmt, unsigned long address);
25 #else /* !CONFIG_KALLSYMS */
27 static inline unsigned long kallsyms_lookup_name(const char *name)
29 return 0;
32 static inline const char *kallsyms_lookup(unsigned long addr,
33 unsigned long *symbolsize,
34 unsigned long *offset,
35 char **modname, char *namebuf)
37 return NULL;
40 /* Stupid that this does nothing, but I didn't create this mess. */
41 #define __print_symbol(fmt, addr)
42 #endif /*CONFIG_KALLSYMS*/
44 /* This macro allows us to keep printk typechecking */
45 static void __check_printsym_format(const char *fmt, ...)
46 __attribute__((format(printf,1,2)));
47 static inline void __check_printsym_format(const char *fmt, ...)
51 #define print_symbol(fmt, addr) \
52 do { \
53 __check_printsym_format(fmt, ""); \
54 __print_symbol(fmt, addr); \
55 } while(0)
57 #endif /*_LINUX_KALLSYMS_H*/