Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Runtime Verification.
0004  *
0005  * For futher information, see: kernel/trace/rv/rv.c.
0006  */
0007 #ifndef _LINUX_RV_H
0008 #define _LINUX_RV_H
0009 
0010 #define MAX_DA_NAME_LEN 24
0011 
0012 #ifdef CONFIG_RV
0013 /*
0014  * Deterministic automaton per-object variables.
0015  */
0016 struct da_monitor {
0017     bool        monitoring;
0018     unsigned int    curr_state;
0019 };
0020 
0021 /*
0022  * Per-task RV monitors count. Nowadays fixed in RV_PER_TASK_MONITORS.
0023  * If we find justification for more monitors, we can think about
0024  * adding more or developing a dynamic method. So far, none of
0025  * these are justified.
0026  */
0027 #define RV_PER_TASK_MONITORS        1
0028 #define RV_PER_TASK_MONITOR_INIT    (RV_PER_TASK_MONITORS)
0029 
0030 /*
0031  * Futher monitor types are expected, so make this a union.
0032  */
0033 union rv_task_monitor {
0034     struct da_monitor da_mon;
0035 };
0036 
0037 #ifdef CONFIG_RV_REACTORS
0038 struct rv_reactor {
0039     const char      *name;
0040     const char      *description;
0041     void            (*react)(char *msg);
0042 };
0043 #endif
0044 
0045 struct rv_monitor {
0046     const char      *name;
0047     const char      *description;
0048     bool            enabled;
0049     int         (*enable)(void);
0050     void            (*disable)(void);
0051     void            (*reset)(void);
0052 #ifdef CONFIG_RV_REACTORS
0053     void            (*react)(char *msg);
0054 #endif
0055 };
0056 
0057 bool rv_monitoring_on(void);
0058 int rv_unregister_monitor(struct rv_monitor *monitor);
0059 int rv_register_monitor(struct rv_monitor *monitor);
0060 int rv_get_task_monitor_slot(void);
0061 void rv_put_task_monitor_slot(int slot);
0062 
0063 #ifdef CONFIG_RV_REACTORS
0064 bool rv_reacting_on(void);
0065 int rv_unregister_reactor(struct rv_reactor *reactor);
0066 int rv_register_reactor(struct rv_reactor *reactor);
0067 #endif /* CONFIG_RV_REACTORS */
0068 
0069 #endif /* CONFIG_RV */
0070 #endif /* _LINUX_RV_H */