if swap.ini has undefined path to lib or app driver will return this wrong path
[kernel/swap-modules.git] / driver / ec_ioctl.h
1 ////////////////////////////////////////////////////////////////////////////////////
2 //
3 //      FILE:           ec_module.h
4 //
5 //      DESCRIPTION:
6 //
7 //      SEE ALSO:       N/A
8 //      AUTHOR:         L.Komkov, S.Dianov, A.Gerenkov
9 //      COMPANY NAME:   Samsung Research Center in Moscow
10 //      DEPT NAME:      Advanced Software Group 
11 //      CREATED:        2008.02.15
12 //      VERSION:        1.0
13 //      REVISION DATE:  2008.12.02
14 //
15 ////////////////////////////////////////////////////////////////////////////////////
16
17 #if !defined(ec_ioctl_h)
18 #define ec_ioctl_h
19
20 #include "ec_info.h"            // ec_info_t
21 #include "picl.h"
22
23 typedef enum
24 {
25         // modes
26         EC_IOCTL_SET_EC_MODE,
27         EC_IOCTL_GET_EC_MODE,
28
29         // buffer manipulation
30         EC_IOCTL_SET_BUFFER_SIZE,
31         EC_IOCTL_GET_BUFFER_SIZE,
32         EC_IOCTL_RESET_BUFFER,
33
34         // probes management
35         EC_IOCTL_SELECT_PROBE,
36         EC_IOCTL_DESELECT_PROBE,
37         EC_IOCTL_GET_PROBE_INFO,
38         EC_IOCTL_ADD_PROBE,
39         EC_IOCTL_SET_APPDEPS,
40         EC_IOCTL_SET_PROFILEBUNDLE,
41         //EC_IOCTL_REMOVE_PROBE,
42         EC_IOCTL_RESET_PROBES,
43         EC_IOCTL_SET_COMPLEX_PROBES,
44
45         // tracing
46         EC_IOCTL_ATTACH,        // attaches selected probes
47         EC_IOCTL_ACTIVATE,      // START
48
49         // stop is common for both tracing and profiling
50         EC_IOCTL_STOP_AND_DETACH,       // STOP (and detach for TRACING)
51
52         // kernel to user notification delivery
53         EC_IOCTL_WAIT_NOTIFICATION,
54
55         // get ec_info
56         EC_IOCTL_GET_EC_INFO,
57         EC_IOCTL_GET_COMPLEX_STATUS,
58         EC_IOCTL_CONSUME_BUFFER,
59
60         // conditions
61         EC_IOCTL_UPDATE_CONDS,
62
63         //user space event      
64         EC_IOCTL_US_EVENT,
65
66         //event format
67         EC_IOCTL_SET_EVENT_MASK,
68         EC_IOCTL_GET_EVENT_MASK,
69
70         // pre-defined user space probes
71         EC_IOCTL_SET_PREDEF_UPROBES,    
72         EC_IOCTL_GET_PREDEF_UPROBES,
73         EC_IOCTL_GET_PREDEF_UPROBES_SIZE,
74
75         EC_IOCTL_SET_PID,
76
77         // error consist of wrong path to apps or libs
78         EC_IOCTL_GET_LAST_ERROR,
79 } EC_IOCTL_CMD;
80
81 typedef struct
82 {
83         unsigned notification_count;
84         ec_info_t *p_ec_info;
85 } ioctl_wait_notification_t;
86
87 typedef struct
88 {
89         int m_signedInt;
90         unsigned int m_unsignedInt;
91         long m_signedLong;
92         unsigned long m_unsignedLong;
93         char* m_ptrChar;
94 } ioctl_general_t;
95
96 typedef enum
97 {
98         OPERATION_ANY,          // means do not check value
99         OPERATION_EQUAL,
100         OPERATION_NOT_EQUAL,
101         OPERATION_LESS,
102         OPERATION_GREATER
103 } operation_t;
104
105 typedef struct
106 {
107         unsigned m_condition_always_false;
108         unsigned m_op_time;
109         unsigned m_op_pid;
110         unsigned m_op_tid;
111         unsigned m_op_probe_id;
112 //      char     m_probe_name[SWAP_COMMON_STRING_SIZE];
113         unsigned m_op_record_type;
114         unsigned m_time_sec;
115         unsigned m_time_usec;
116         unsigned m_pid;
117         unsigned m_tid;
118         unsigned m_probe_id;
119         unsigned m_record_type;
120 } condition_t;
121
122
123
124 // condition matching any event
125 #define CONDITION_ANY \
126 { \
127     .m_condition_always_false = 0, \
128         .m_op_time = OPERATION_ANY, \
129         .m_op_pid = OPERATION_ANY, \
130         .m_op_tid = OPERATION_ANY, \
131         .m_op_probe_id = OPERATION_ANY, \
132         .m_op_record_type = OPERATION_ANY, \
133 } \
134
135 // never matching condition
136 #define CONDITION_FALSE \
137 { \
138     .m_condition_always_false = 1, \
139         .m_op_time = OPERATION_ANY, \
140         .m_op_pid = OPERATION_ANY, \
141         .m_op_tid = OPERATION_ANY, \
142         .m_op_probe_id = OPERATION_ANY, \
143         .m_op_record_type = OPERATION_ANY, \
144 } \
145
146 // default start condition - start immediately
147 #define DEFAULT_START_CONDITION CONDITION_ANY
148 // default stop condition - never stop
149 #define DEFAULT_STOP_CONDITION CONDITION_FALSE
150
151
152 typedef struct
153 {
154         unsigned count;
155         int *p_pids;
156 } ioctl_set_pids_to_ignore_t;
157
158
159 typedef struct
160 {
161         char *name;
162         unsigned long addr;
163         char type;
164         unsigned long size;
165         signed char reg;        // -1 - memory, 0..127 - register number  
166         long off;
167 } ioctl_usr_space_vtp_t;
168
169 typedef struct
170 {
171         //char *name;
172         //unsigned name_len;
173         unsigned long addr;
174 } ioctl_usr_space_ip_t;
175
176 typedef struct
177 {
178         char *path;
179         //unsigned path_len;
180         unsigned ips_count;
181         ioctl_usr_space_ip_t *p_ips;
182         unsigned vtps_count;
183         ioctl_usr_space_vtp_t *p_vtps;
184 } ioctl_usr_space_lib_t;
185
186 typedef struct
187 {
188         char *path;
189         //unsigned path_len;
190         unsigned libs_count;
191         ioctl_usr_space_lib_t *p_libs;
192 } ioctl_inst_usr_space_proc_t;
193
194 typedef struct
195 {
196         char *proc_name;
197         unsigned count;
198 } ioctl_set_proc_to_ignore_t;
199
200 typedef struct
201 {
202         char *data;
203         unsigned len;
204 } ioctl_us_event_t;
205  
206 // exclude entry events
207 #define IOCTL_EMASK_ENTRY       0x01
208 // exclude exit events
209 #define IOCTL_EMASK_EXIT        0x02
210 // timestamp
211 #define IOCTL_EMASK_TIME        0x04
212 // PID
213 #define IOCTL_EMASK_PID         0x08
214 // TID
215 #define IOCTL_EMASK_TID         0x10
216 // CPU
217 #define IOCTL_EMASK_CPU         0x20
218 // Args
219 #define IOCTL_EMASK_ARGS        0x40
220
221 typedef struct
222 {
223         unsigned probes_count;
224         char *p_probes;
225 } ioctl_predef_uprobes_info_t;
226
227
228 #endif /* !defined(ec_ioctl_h) */