Lines Matching refs:name
20 #define DECLARE_RV_REACTING_HELPERS(name, type) \ argument
21 static char REACT_MSG_##name[1024]; \
23 static inline char *format_react_msg_##name(type curr_state, type event) \
25 snprintf(REACT_MSG_##name, 1024, \
27 #name, \
28 model_get_event_name_##name(event), \
29 model_get_state_name_##name(curr_state)); \
30 return REACT_MSG_##name; \
33 static void cond_react_##name(char *msg) \
35 if (rv_##name.react) \
36 rv_##name.react(msg); \
39 static bool rv_reacting_on_##name(void) \
46 #define DECLARE_RV_REACTING_HELPERS(name, type) \ argument
47 static inline char *format_react_msg_##name(type curr_state, type event) \
52 static void cond_react_##name(char *msg) \
57 static bool rv_reacting_on_##name(void) \
66 #define DECLARE_DA_MON_GENERIC_HELPERS(name, type) \ argument
68 DECLARE_RV_REACTING_HELPERS(name, type) \
73 static inline void da_monitor_reset_##name(struct da_monitor *da_mon) \
76 da_mon->curr_state = model_get_initial_state_##name(); \
82 static inline type da_monitor_curr_state_##name(struct da_monitor *da_mon) \
91 da_monitor_set_state_##name(struct da_monitor *da_mon, enum states_##name state) \
102 static inline void da_monitor_start_##name(struct da_monitor *da_mon) \
104 da_mon->curr_state = model_get_initial_state_##name(); \
111 static inline bool da_monitoring_##name(struct da_monitor *da_mon) \
119 static inline bool da_monitor_enabled_##name(void) \
126 if (unlikely(!rv_##name.enabled)) \
135 static inline bool da_monitor_handling_event_##name(struct da_monitor *da_mon) \
138 if (!da_monitor_enabled_##name()) \
142 if (unlikely(!da_monitoring_##name(da_mon))) \
153 #define DECLARE_DA_MON_MODEL_HANDLER_IMPLICIT(name, type) \ argument
156 da_event_##name(struct da_monitor *da_mon, enum events_##name event) \
158 type curr_state = da_monitor_curr_state_##name(da_mon); \
159 type next_state = model_get_next_state_##name(curr_state, event); \
162 da_monitor_set_state_##name(da_mon, next_state); \
164 trace_event_##name(model_get_state_name_##name(curr_state), \
165 model_get_event_name_##name(event), \
166 model_get_state_name_##name(next_state), \
167 model_is_final_state_##name(next_state)); \
172 if (rv_reacting_on_##name()) \
173 cond_react_##name(format_react_msg_##name(curr_state, event)); \
175 trace_error_##name(model_get_state_name_##name(curr_state), \
176 model_get_event_name_##name(event)); \
184 #define DECLARE_DA_MON_MODEL_HANDLER_PER_TASK(name, type) \ argument
186 static inline bool da_event_##name(struct da_monitor *da_mon, struct task_struct *tsk, \
187 enum events_##name event) \
189 type curr_state = da_monitor_curr_state_##name(da_mon); \
190 type next_state = model_get_next_state_##name(curr_state, event); \
193 da_monitor_set_state_##name(da_mon, next_state); \
195 trace_event_##name(tsk->pid, \
196 model_get_state_name_##name(curr_state), \
197 model_get_event_name_##name(event), \
198 model_get_state_name_##name(next_state), \
199 model_is_final_state_##name(next_state)); \
204 if (rv_reacting_on_##name()) \
205 cond_react_##name(format_react_msg_##name(curr_state, event)); \
207 trace_error_##name(tsk->pid, \
208 model_get_state_name_##name(curr_state), \
209 model_get_event_name_##name(event)); \
217 #define DECLARE_DA_MON_INIT_GLOBAL(name, type) \ argument
222 static struct da_monitor da_mon_##name; \
227 static struct da_monitor *da_get_monitor_##name(void) \
229 return &da_mon_##name; \
235 static void da_monitor_reset_all_##name(void) \
237 da_monitor_reset_##name(da_get_monitor_##name()); \
243 static inline int da_monitor_init_##name(void) \
245 da_monitor_reset_all_##name(); \
252 static inline void da_monitor_destroy_##name(void) \
260 #define DECLARE_DA_MON_INIT_PER_CPU(name, type) \ argument
265 static DEFINE_PER_CPU(struct da_monitor, da_mon_##name); \
270 static struct da_monitor *da_get_monitor_##name(void) \
272 return this_cpu_ptr(&da_mon_##name); \
278 static void da_monitor_reset_all_##name(void) \
283 da_mon = per_cpu_ptr(&da_mon_##name, cpu); \
284 da_monitor_reset_##name(da_mon); \
291 static inline int da_monitor_init_##name(void) \
293 da_monitor_reset_all_##name(); \
300 static inline void da_monitor_destroy_##name(void) \
308 #define DECLARE_DA_MON_INIT_PER_TASK(name, type) \ argument
314 static int task_mon_slot_##name = RV_PER_TASK_MONITOR_INIT; \
319 static inline struct da_monitor *da_get_monitor_##name(struct task_struct *tsk) \
321 return &tsk->rv[task_mon_slot_##name].da_mon; \
324 static void da_monitor_reset_all_##name(void) \
330 da_monitor_reset_##name(da_get_monitor_##name(p)); \
340 static int da_monitor_init_##name(void) \
348 task_mon_slot_##name = slot; \
350 da_monitor_reset_all_##name(); \
357 static inline void da_monitor_destroy_##name(void) \
359 if (task_mon_slot_##name == RV_PER_TASK_MONITOR_INIT) { \
360 WARN_ONCE(1, "Disabling a disabled monitor: " #name); \
363 rv_put_task_monitor_slot(task_mon_slot_##name); \
364 task_mon_slot_##name = RV_PER_TASK_MONITOR_INIT; \
372 #define DECLARE_DA_MON_MONITOR_HANDLER_IMPLICIT(name, type) \ argument
374 static inline void __da_handle_event_##name(struct da_monitor *da_mon, \
375 enum events_##name event) \
379 retval = da_event_##name(da_mon, event); \
381 da_monitor_reset_##name(da_mon); \
387 static inline void da_handle_event_##name(enum events_##name event) \
389 struct da_monitor *da_mon = da_get_monitor_##name(); \
392 retval = da_monitor_handling_event_##name(da_mon); \
396 __da_handle_event_##name(da_mon, event); \
409 static inline bool da_handle_start_event_##name(enum events_##name event) \
413 if (!da_monitor_enabled_##name()) \
416 da_mon = da_get_monitor_##name(); \
418 if (unlikely(!da_monitoring_##name(da_mon))) { \
419 da_monitor_start_##name(da_mon); \
423 __da_handle_event_##name(da_mon, event); \
434 static inline bool da_handle_start_run_event_##name(enum events_##name event) \
438 if (!da_monitor_enabled_##name()) \
441 da_mon = da_get_monitor_##name(); \
443 if (unlikely(!da_monitoring_##name(da_mon))) \
444 da_monitor_start_##name(da_mon); \
446 __da_handle_event_##name(da_mon, event); \
454 #define DECLARE_DA_MON_MONITOR_HANDLER_PER_TASK(name, type) \ argument
457 __da_handle_event_##name(struct da_monitor *da_mon, struct task_struct *tsk, \
458 enum events_##name event) \
462 retval = da_event_##name(da_mon, tsk, event); \
464 da_monitor_reset_##name(da_mon); \
471 da_handle_event_##name(struct task_struct *tsk, enum events_##name event) \
473 struct da_monitor *da_mon = da_get_monitor_##name(tsk); \
476 retval = da_monitor_handling_event_##name(da_mon); \
480 __da_handle_event_##name(da_mon, tsk, event); \
494 da_handle_start_event_##name(struct task_struct *tsk, enum events_##name event) \
498 if (!da_monitor_enabled_##name()) \
501 da_mon = da_get_monitor_##name(tsk); \
503 if (unlikely(!da_monitoring_##name(da_mon))) { \
504 da_monitor_start_##name(da_mon); \
508 __da_handle_event_##name(da_mon, tsk, event); \
516 #define DECLARE_DA_MON_GLOBAL(name, type) \ argument
518 DECLARE_AUTOMATA_HELPERS(name, type) \
519 DECLARE_DA_MON_GENERIC_HELPERS(name, type) \
520 DECLARE_DA_MON_MODEL_HANDLER_IMPLICIT(name, type) \
521 DECLARE_DA_MON_INIT_GLOBAL(name, type) \
522 DECLARE_DA_MON_MONITOR_HANDLER_IMPLICIT(name, type)
527 #define DECLARE_DA_MON_PER_CPU(name, type) \ argument
529 DECLARE_AUTOMATA_HELPERS(name, type) \
530 DECLARE_DA_MON_GENERIC_HELPERS(name, type) \
531 DECLARE_DA_MON_MODEL_HANDLER_IMPLICIT(name, type) \
532 DECLARE_DA_MON_INIT_PER_CPU(name, type) \
533 DECLARE_DA_MON_MONITOR_HANDLER_IMPLICIT(name, type)
538 #define DECLARE_DA_MON_PER_TASK(name, type) \ argument
540 DECLARE_AUTOMATA_HELPERS(name, type) \
541 DECLARE_DA_MON_GENERIC_HELPERS(name, type) \
542 DECLARE_DA_MON_MODEL_HANDLER_PER_TASK(name, type) \
543 DECLARE_DA_MON_INIT_PER_TASK(name, type) \
544 DECLARE_DA_MON_MONITOR_HANDLER_PER_TASK(name, type)