ARM: tizen_tm1_defconfig: Enable missing features related with CGROUPS
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / kernel / swap / kprobe / swap_kprobes_deps.h
1 /**
2  * @file kprobe/swap_kprobes_deps.h
3  * @author Alexey Gerenkov <a.gerenkov@samsung.com> User-Space Probes initial implementation;
4  * Support x86/ARM/MIPS for both user and kernel spaces.
5  * @author Ekaterina Gorelkina <e.gorelkina@samsung.com>: redesign module for separating core and arch parts
6  *
7  * @section LICENSE
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * @section COPYRIGHT
24  *
25  * Copyright (C) Samsung Electronics, 2006-2010
26  *
27  * @section DESCRIPTION
28  *
29  * SWAP kprobe kernel-dependent dependencies.
30  */
31
32 #ifndef _SWAP_KPROBES_DEPS_H
33 #define _SWAP_KPROBES_DEPS_H
34
35 #include <linux/version.h>      /* LINUX_VERSION_CODE, KERNEL_VERSION() */
36 #include <linux/hugetlb.h>
37 #include <linux/mempolicy.h>
38 #include <linux/highmem.h>
39 #include <linux/pagemap.h>
40 #include <ksyms/ksyms.h>
41
42 #define DECLARE_NODE_PTR_FOR_HLIST(var_name)
43 #define swap_hlist_for_each_entry_rcu(tpos, pos, head, member) \
44         hlist_for_each_entry_rcu(tpos, head, member)
45 #define swap_hlist_for_each_entry_safe(tpos, pos, n, head, member) \
46         hlist_for_each_entry_safe(tpos, n, head, member)
47 #define swap_hlist_for_each_entry(tpos, pos, head, member) \
48         hlist_for_each_entry(tpos, head, member)
49
50
51
52 /*
53  * TODO: possibly unnided
54  *       check and remove swap_preempt_enable_no_resched() call
55  */
56
57 #define swap_preempt_enable_no_resched() preempt_enable_no_resched()
58
59
60
61 /* --------------------- Declaration of module dependencies ----------------- */
62
63 #define DECLARE_MOD_FUNC_DEP(name, ret, ...) ret(*__ref_##name)(__VA_ARGS__)
64 #define DECLARE_MOD_CB_DEP(name, ret, ...) ret(*name)(__VA_ARGS__)
65
66
67 /* ---------------- Implementation of module dependencies wrappers ---------- */
68
69 #define DECLARE_MOD_DEP_WRAPPER(name, ret, ...) ret name(__VA_ARGS__)
70 #define IMP_MOD_DEP_WRAPPER(name, ...) \
71 { \
72         return __ref_##name(__VA_ARGS__); \
73 }
74
75
76 /* --------------------- Module dependencies initialization ----------------- */
77
78 #define INIT_MOD_DEP_VAR(dep, name) \
79 { \
80         __ref_##dep = (void *) swap_ksyms(#name); \
81         if (!__ref_##dep) { \
82                 DBPRINTF(#name " is not found! Oops. Where is it?"); \
83                 return -ESRCH; \
84         } \
85 }
86
87 #define INIT_MOD_DEP_CB(dep, name) \
88 { \
89         dep = (void *) swap_ksyms(#name); \
90         if (!dep) { \
91                 DBPRINTF(#name " is not found! Oops. Where is it?"); \
92                 return -ESRCH; \
93         } \
94 }
95
96
97 int init_module_dependencies(void);
98
99 int access_process_vm_atomic(struct task_struct *tsk, unsigned long addr,
100                              void *buf, int len, int write);
101
102 #define read_proc_vm_atomic(tsk, addr, buf, len) \
103         access_process_vm_atomic(tsk, addr, buf, len, 0)
104 #define write_proc_vm_atomic(tsk, addr, buf, len) \
105         access_process_vm_atomic(tsk, addr, buf, len, 1)
106 int page_present(struct mm_struct *mm, unsigned long addr);
107
108 unsigned long swap_do_mmap_pgoff(struct file *file, unsigned long addr,
109                                  unsigned long len, unsigned long prot,
110                                  unsigned long flags, unsigned long pgoff,
111                                  unsigned long *populate);
112
113
114 #endif /* _SWAP_KPROBES_DEPS_H */