updated package versions
[minix.git] / include / minix / sef.h
blobe2fe145f3955903e171eeee7c562dddf358f7f53
1 /* Prototypes for System Event Framework (SEF) functions. */
3 #ifndef _SEF_H
4 #define _SEF_H
6 /* SEF entry points for system processes. */
7 _PROTOTYPE( void sef_startup, (void) );
8 _PROTOTYPE( int sef_receive, (endpoint_t src, message *m_ptr) );
10 /* SEF Debug. */
11 #include <stdio.h>
12 #define sef_dprint printf
13 #define sef_debug_begin() (void)(NULL)
14 #define sef_debug_end() fflush(stdout)
16 /*===========================================================================*
17 * SEF Init *
18 *===========================================================================*/
19 /* What to intercept. */
20 #define INTERCEPT_SEF_INIT_REQUESTS 1
21 #define IS_SEF_INIT_REQUEST(mp) ((mp)->m_type == RS_INIT \
22 && (mp)->m_source == RS_PROC_NR)
24 /* Type definitions. */
25 typedef struct {
26 int rproctab_gid;
27 } sef_init_info_t;
29 /* Callback type definitions. */
30 typedef int(*sef_cb_init_fresh_t)(int type, sef_init_info_t *info);
31 typedef int(*sef_cb_init_lu_t)(int type, sef_init_info_t *info);
32 typedef int(*sef_cb_init_restart_t)(int type, sef_init_info_t *info);
34 /* Callback registration helpers. */
35 _PROTOTYPE( void sef_setcb_init_fresh, (sef_cb_init_fresh_t cb));
36 _PROTOTYPE( void sef_setcb_init_lu, (sef_cb_init_lu_t cb));
37 _PROTOTYPE( void sef_setcb_init_restart, (sef_cb_init_restart_t cb));
39 /* Predefined callback implementations. */
40 _PROTOTYPE( int sef_cb_init_fresh_null, (int type, sef_init_info_t *info) );
41 _PROTOTYPE( int sef_cb_init_lu_null, (int type, sef_init_info_t *info) );
42 _PROTOTYPE( int sef_cb_init_restart_null, (int type, sef_init_info_t *info) );
44 _PROTOTYPE( int sef_cb_init_restart_fail, (int type, sef_init_info_t *info) );
46 /* Macros for predefined callback implementations. */
47 #define SEF_CB_INIT_FRESH_NULL sef_cb_init_fresh_null
48 #define SEF_CB_INIT_LU_NULL sef_cb_init_lu_null
49 #define SEF_CB_INIT_RESTART_NULL sef_cb_init_restart_null
51 #define SEF_CB_INIT_FRESH_DEFAULT sef_cb_init_fresh_null
52 #define SEF_CB_INIT_LU_DEFAULT sef_cb_init_lu_null
53 #define SEF_CB_INIT_RESTART_DEFAULT sef_cb_init_restart_null
55 /* Init types. */
56 #define SEF_INIT_FRESH 0 /* init fresh */
57 #define SEF_INIT_LU 1 /* init after live update */
58 #define SEF_INIT_RESTART 2 /* init after restart */
60 /* Debug. */
61 #define SEF_INIT_DEBUG_DEFAULT 0
63 #ifndef SEF_INIT_DEBUG
64 #define SEF_INIT_DEBUG SEF_INIT_DEBUG_DEFAULT
65 #endif
67 #define sef_init_dprint sef_dprint
68 #define sef_init_debug_begin sef_debug_begin
69 #define sef_init_debug_end sef_debug_end
71 /*===========================================================================*
72 * SEF Ping *
73 *===========================================================================*/
74 /* What to intercept. */
75 #define INTERCEPT_SEF_PING_REQUESTS 1
76 #define IS_SEF_PING_REQUEST(mp) (is_notify((mp)->m_type) \
77 && (mp)->m_source == RS_PROC_NR)
79 /* Callback type definitions. */
80 typedef void(*sef_cb_ping_reply_t)(message *m_ptr);
82 /* Callback registration helpers. */
83 _PROTOTYPE( void sef_setcb_ping_reply, (sef_cb_ping_reply_t cb));
85 /* Predefined callback implementations. */
86 _PROTOTYPE( void sef_cb_ping_reply_null, (message *m_ptr) );
88 _PROTOTYPE( void sef_cb_ping_reply_pong, (message *m_ptr) );
90 /* Macros for predefined callback implementations. */
91 #define SEF_CB_PING_REPLY_NULL sef_cb_ping_reply_null
93 #define SEF_CB_PING_REPLY_DEFAULT sef_cb_ping_reply_pong
95 /* Debug. */
96 #define SEF_PING_DEBUG_DEFAULT 0
98 #ifndef SEF_PING_DEBUG
99 #define SEF_PING_DEBUG SEF_PING_DEBUG_DEFAULT
100 #endif
102 #define sef_ping_dprint sef_dprint
103 #define sef_ping_debug_begin sef_debug_begin
104 #define sef_ping_debug_end sef_debug_end
106 /*===========================================================================*
107 * SEF Live update *
108 *===========================================================================*/
109 /* What to intercept. */
110 #define INTERCEPT_SEF_LU_REQUESTS 1
111 #define IS_SEF_LU_REQUEST(mp) ((mp)->m_type == RS_LU_PREPARE \
112 && (mp)->m_source == RS_PROC_NR)
114 /* Global helpers. */
115 _PROTOTYPE( void sef_lu_ready, (int result) );
117 /* Callback type definitions. */
118 typedef void(*sef_cb_lu_prepare_t)(int);
119 typedef int(*sef_cb_lu_state_isvalid_t)(int);
120 typedef void(*sef_cb_lu_state_changed_t)(int, int);
121 typedef void(*sef_cb_lu_state_dump_t)(int);
122 typedef int(*sef_cb_lu_ready_pre_t)(int);
124 /* Callback registration helpers. */
125 _PROTOTYPE( void sef_setcb_lu_prepare, (sef_cb_lu_prepare_t cb) );
126 _PROTOTYPE( void sef_setcb_lu_state_isvalid, (sef_cb_lu_state_isvalid_t cb) );
127 _PROTOTYPE( void sef_setcb_lu_state_changed, (sef_cb_lu_state_changed_t cb) );
128 _PROTOTYPE( void sef_setcb_lu_state_dump, (sef_cb_lu_state_dump_t cb) );
129 _PROTOTYPE( void sef_setcb_lu_ready_pre, (sef_cb_lu_ready_pre_t cb) );
131 /* Predefined callback implementations. */
132 _PROTOTYPE( void sef_cb_lu_prepare_null, (int state) );
133 _PROTOTYPE( int sef_cb_lu_state_isvalid_null, (int state) );
134 _PROTOTYPE( void sef_cb_lu_state_changed_null, (int old_state, int state) );
135 _PROTOTYPE( void sef_cb_lu_state_dump_null, (int state) );
136 _PROTOTYPE( int sef_cb_lu_ready_pre_null, (int result) );
138 _PROTOTYPE( void sef_cb_lu_prepare_always_ready, (int state) );
139 _PROTOTYPE( int sef_cb_lu_state_isvalid_standard, (int state) );
141 /* Macros for predefined callback implementations. */
142 #define SEF_CB_LU_PREPARE_NULL sef_cb_lu_prepare_null
143 #define SEF_CB_LU_STATE_ISVALID_NULL sef_cb_lu_state_isvalid_null
144 #define SEF_CB_LU_STATE_CHANGED_NULL sef_cb_lu_state_changed_null
145 #define SEF_CB_LU_STATE_DUMP_NULL sef_cb_lu_state_dump_null
146 #define SEF_CB_LU_READY_PRE_NULL sef_cb_lu_ready_pre_null
148 #define SEF_CB_LU_PREPARE_DEFAULT sef_cb_lu_prepare_null
149 #define SEF_CB_LU_STATE_ISVALID_DEFAULT sef_cb_lu_state_isvalid_null
150 #define SEF_CB_LU_STATE_CHANGED_DEFAULT sef_cb_lu_state_changed_null
151 #define SEF_CB_LU_STATE_DUMP_DEFAULT sef_cb_lu_state_dump_null
152 #define SEF_CB_LU_READY_PRE_DEFAULT sef_cb_lu_ready_pre_null
154 /* Standard live update states. */
155 #define SEF_LU_STATE_NULL 0 /* null state */
156 #define SEF_LU_STATE_WORK_FREE 1 /* no work in progress */
157 #define SEF_LU_STATE_REQUEST_FREE 2 /* no request in progress */
158 #define SEF_LU_STATE_PROTOCOL_FREE 3 /* no protocol in progress */
159 #define SEF_LU_STATE_CUSTOM_BASE (SEF_LU_STATE_PROTOCOL_FREE+1)
160 #define SEF_LU_STATE_IS_STANDARD(s) ((s) > SEF_LU_STATE_NULL \
161 && (s) < SEF_LU_STATE_CUSTOM_BASE)
163 /* Debug. */
164 #define SEF_LU_DEBUG_DEFAULT 1
166 #ifndef SEF_LU_DEBUG
167 #define SEF_LU_DEBUG SEF_LU_DEBUG_DEFAULT
168 #endif
170 #define sef_lu_dprint sef_dprint
171 #define sef_lu_debug_begin sef_debug_begin
172 #define sef_lu_debug_end sef_debug_end
174 #endif /* _SEF_H */