add 'swap_ksyms' module
[kernel/swap-modules.git] / ksyms / ksyms.h
1 #ifndef __KSYMS_H__
2 #define __KSYMS_H__
3
4 /*
5  *  Dynamic Binary Instrumentation Module based on KProbes
6  *  modules/ksyms/ksyms.h
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  * Copyright (C) Samsung Electronics, 2013
23  *
24  * 2013         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
25  *
26  */
27
28 #include <linux/version.h>
29 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
30 #include <linux/autoconf.h>
31 #else
32 #include <generated/autoconf.h>
33 #endif
34
35 #include <linux/kallsyms.h>
36
37 #ifdef CONFIG_KALLSYMS
38
39 static int swap_get_ksyms(void)
40 {
41         return 0;
42 }
43
44 static void swap_put_ksyms(void)
45 {
46 }
47
48 static unsigned long swap_ksyms(const char *name)
49 {
50         return kallsyms_lookup_name(name);
51 }
52
53 #else /* !CONFIG_KALLSYMS */
54
55 int swap_get_ksyms(void);
56 void swap_put_ksyms(void);
57 unsigned long swap_ksyms(const char *name);
58
59 #endif /*CONFIG_KALLSYMS*/
60
61 #endif /*__KSYMS_H__*/