nfsd: take file and mnt write in nfs4_upgrade_open
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / kallsyms.h
CommitLineData
1da177e4
LT
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
7
40e48eed 8#include <linux/errno.h>
5a75983e 9#include <linux/stddef.h>
1da177e4 10
9281acea
TH
11#define KSYM_NAME_LEN 128
12#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
13 2*(BITS_PER_LONG*3/10) + (MODULE_NAME_LEN - 1) + 1)
1da177e4
LT
14
15#ifdef CONFIG_KALLSYMS
16/* Lookup the address for a symbol. Returns 0 if not found. */
17unsigned long kallsyms_lookup_name(const char *name);
18
ffc50891
FBH
19extern int kallsyms_lookup_size_offset(unsigned long addr,
20 unsigned long *symbolsize,
21 unsigned long *offset);
22
1da177e4
LT
23/* Lookup an address. modname is set to NULL if it's in the kernel. */
24const char *kallsyms_lookup(unsigned long addr,
25 unsigned long *symbolsize,
26 unsigned long *offset,
27 char **modname, char *namebuf);
28
42e38083
RP
29/* Look up a kernel symbol and return it in a text buffer. */
30extern int sprint_symbol(char *buffer, unsigned long address);
31
32/* Look up a kernel symbol and print it to the kernel messages. */
1da177e4
LT
33extern void __print_symbol(const char *fmt, unsigned long address);
34
9d65cb4a 35int lookup_symbol_name(unsigned long addr, char *symname);
a5c43dae 36int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
9d65cb4a 37
1da177e4
LT
38#else /* !CONFIG_KALLSYMS */
39
40static inline unsigned long kallsyms_lookup_name(const char *name)
41{
42 return 0;
43}
44
ffc50891
FBH
45static inline int kallsyms_lookup_size_offset(unsigned long addr,
46 unsigned long *symbolsize,
47 unsigned long *offset)
48{
49 return 0;
50}
51
1da177e4
LT
52static inline const char *kallsyms_lookup(unsigned long addr,
53 unsigned long *symbolsize,
54 unsigned long *offset,
55 char **modname, char *namebuf)
56{
57 return NULL;
58}
59
42e38083
RP
60static inline int sprint_symbol(char *buffer, unsigned long addr)
61{
62 *buffer = '\0';
63 return 0;
64}
65
9d65cb4a
AD
66static inline int lookup_symbol_name(unsigned long addr, char *symname)
67{
68 return -ERANGE;
69}
70
a5c43dae
AD
71static inline int lookup_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name)
72{
73 return -ERANGE;
74}
75
1da177e4
LT
76/* Stupid that this does nothing, but I didn't create this mess. */
77#define __print_symbol(fmt, addr)
78#endif /*CONFIG_KALLSYMS*/
79
80/* This macro allows us to keep printk typechecking */
81static void __check_printsym_format(const char *fmt, ...)
82__attribute__((format(printf,1,2)));
83static inline void __check_printsym_format(const char *fmt, ...)
84{
85}
1da177e4 86
b02454f4
HC
87static inline void print_symbol(const char *fmt, unsigned long addr)
88{
89 __check_printsym_format(fmt, "");
90 __print_symbol(fmt, (unsigned long)
91 __builtin_extract_return_addr((void *)addr));
92}
1da177e4 93
a442ac51
LT
94/*
95 * Pretty-print a function pointer.
96 *
97 * ia64 and ppc64 function pointers are really function descriptors,
98 * which contain a pointer the real address.
99 */
100static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
101{
102#if defined(CONFIG_IA64) || defined(CONFIG_PPC64)
103 addr = *(void **)addr;
104#endif
105 print_symbol(fmt, (unsigned long)addr);
106}
107
8d8fdf5c
HC
108#ifndef CONFIG_64BIT
109#define print_ip_sym(ip) \
110do { \
111 printk("[<%08lx>]", ip); \
112 print_symbol(" %s\n", ip); \
113} while(0)
114#else
115#define print_ip_sym(ip) \
116do { \
117 printk("[<%016lx>]", ip); \
118 print_symbol(" %s\n", ip); \
119} while(0)
120#endif
121
1da177e4 122#endif /*_LINUX_KALLSYMS_H*/