62ddaec38d25199c5325e879871de81c30e2ce68
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / kernel / swap / us_manager / probes / probe_info_new.h
1 #ifndef _PROBE_INFO_NEW_H
2 #define _PROBE_INFO_NEW_H
3
4 /*
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Copyright (C) Samsung Electronics, 2015
20  *
21  * 2015         Vyacheslav Cherkashin <v.cherkashin@samsung.com>
22  *
23  */
24
25
26 #include <kprobe/swap_kprobes.h>
27 #include <uprobe/swap_uprobes.h>
28 #include "probes.h"
29
30
31 struct dentry;
32 struct pf_group;
33
34
35 struct probe_info_new {
36         enum probe_t type;
37         union {
38                 struct {
39                         kprobe_pre_handler_t handler;
40                 } p;
41
42                 struct {
43                         uretprobe_handler_t entry_handler;
44                         uretprobe_handler_t ret_handler;
45                         /*
46                          * FIXME: make dynamic size,
47                          *        currently data_size = sizeof(void *)
48                          */
49                         size_t data_size;
50                 } rp;
51         } u;
52
53         /* private */
54         struct probe_info *info;
55 };
56
57
58 struct probe_new {
59         unsigned long offset;
60         struct probe_info_new *info;
61 };
62
63
64 #define MAKE_UPROBE(_handler)                           \
65         {                                               \
66                 .type = SWAP_NEW_UP,                    \
67                 .u.p.handler = _handler                 \
68         }
69
70 #define MAKE_URPROBE(_entry, _ret, _size)               \
71         {                                               \
72                 .type = SWAP_NEW_URP,                   \
73                 .u.rp.entry_handler = _entry,           \
74                 .u.rp.ret_handler = _ret,               \
75                 .u.rp.data_size = _size                 \
76         }
77
78 struct probe_info_otg {
79         struct probe_info info;
80         struct probe_info_new *data;    /* field 'data[0]' in probe_info struct */
81 };
82
83 void pin_set_probe(struct probe_info_otg *otg, unsigned long vaddr);
84
85 int pin_register(struct probe_new *probe, struct pf_group *pfg,
86                  struct dentry *dentry);
87 int pin_unregister(struct probe_new *probe, struct pf_group *pfg,
88                    struct dentry *dentry);
89
90
91 int pin_init(void);
92 void pin_exit(void);
93
94
95 #endif /* _PROBE_INFO_NEW_H */