#include <string.h>
/* SEF Init callbacks. */
-static struct sef_cbs {
+static struct sef_init_cbs {
sef_cb_init_t sef_cb_init_fresh;
sef_cb_init_t sef_cb_init_lu;
sef_cb_init_t sef_cb_init_restart;
sef_cb_init_response_t sef_cb_init_response;
-} sef_cbs = {
+} sef_init_cbs = {
SEF_CB_INIT_FRESH_DEFAULT,
SEF_CB_INIT_LU_DEFAULT,
SEF_CB_INIT_RESTART_DEFAULT,
/* Let the callback code handle the specific initialization type. */
switch(type) {
case SEF_INIT_FRESH:
- result = sef_cbs.sef_cb_init_fresh(type, info);
+ result = sef_init_cbs.sef_cb_init_fresh(type, info);
break;
case SEF_INIT_LU:
- result = sef_cbs.sef_cb_init_lu(type, info);
+ result = sef_init_cbs.sef_cb_init_lu(type, info);
break;
case SEF_INIT_RESTART:
- result = sef_cbs.sef_cb_init_restart(type, info);
+ result = sef_init_cbs.sef_cb_init_restart(type, info);
break;
default:
m.m_source = sef_self_endpoint;
m.m_type = RS_INIT;
m.m_rs_init.result = result;
- r = sef_cbs.sef_cb_init_response(&m);
+ r = sef_init_cbs.sef_cb_init_response(&m);
return r;
}
void sef_setcb_init_fresh(sef_cb_init_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_init_fresh = cb;
+ sef_init_cbs.sef_cb_init_fresh = cb;
}
/*===========================================================================*
void sef_setcb_init_lu(sef_cb_init_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_init_lu = cb;
+ sef_init_cbs.sef_cb_init_lu = cb;
}
/*===========================================================================*
void sef_setcb_init_restart(sef_cb_init_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_init_restart = cb;
+ sef_init_cbs.sef_cb_init_restart = cb;
}
/*===========================================================================*
void sef_setcb_init_response(sef_cb_init_response_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_init_response = cb;
+ sef_init_cbs.sef_cb_init_response = cb;
}
/*===========================================================================*
*===========================================================================*/
int sef_cb_init_crash(int UNUSED(type), sef_init_info_t *UNUSED(info))
{
- panic("Simulating a crash at initialization time...");
+ panic("Simulating a crash at initialization time...\n");
return OK;
}
extern __attribute__((weak)) int st_do_state_cleanup(void);
/* SEF Live update callbacks. */
-static struct sef_cbs {
+static struct sef_lu_cbs {
sef_cb_lu_prepare_t sef_cb_lu_prepare;
sef_cb_lu_state_isvalid_t sef_cb_lu_state_isvalid;
sef_cb_lu_state_changed_t sef_cb_lu_state_changed;
sef_cb_lu_state_dump_t sef_cb_lu_state_dump;
sef_cb_lu_state_save_t sef_cb_lu_state_save;
sef_cb_lu_response_t sef_cb_lu_response;
-} sef_cbs = {
+} sef_lu_cbs = {
SEF_CB_LU_PREPARE_DEFAULT,
SEF_CB_LU_STATE_ISVALID_DEFAULT,
SEF_CB_LU_STATE_CHANGED_DEFAULT,
sef_lu_debug_begin();
sef_lu_dprint("%s, cycle=%d. Dumping state variables:\n",
sef_debug_header(), sef_lu_debug_cycle);
- sef_cbs.sef_cb_lu_state_dump(sef_lu_state);
+ sef_lu_cbs.sef_cb_lu_state_dump(sef_lu_state);
sef_lu_debug_end();
#endif
*/
r = OK;
if(sef_lu_state != SEF_LU_STATE_WORK_FREE) {
- r = sef_cbs.sef_cb_lu_prepare(sef_lu_state);
+ r = sef_lu_cbs.sef_cb_lu_prepare(sef_lu_state);
}
if(r == OK) {
sef_lu_ready(OK);
/* Otherwise only accept live update requests with a valid state. */
is_valid_state = SEF_LU_ALWAYS_ALLOW_DEBUG_STATES && SEF_LU_STATE_IS_DEBUG(state);
- is_valid_state = is_valid_state || sef_cbs.sef_cb_lu_state_isvalid(state, flags);
+ is_valid_state = is_valid_state || sef_lu_cbs.sef_cb_lu_state_isvalid(state, flags);
if(!is_valid_state) {
- if(sef_cbs.sef_cb_lu_state_isvalid == SEF_CB_LU_STATE_ISVALID_DEFAULT) {
+ if(sef_lu_cbs.sef_cb_lu_state_isvalid == SEF_CB_LU_STATE_ISVALID_DEFAULT) {
sef_lu_ready(ENOSYS);
}
else {
* handle the rest.
*/
if(old_state != sef_lu_state) {
- sef_cbs.sef_cb_lu_state_changed(old_state, sef_lu_state);
+ sef_lu_cbs.sef_cb_lu_state_changed(old_state, sef_lu_state);
}
}
if (st_do_state_cleanup)
r = st_do_state_cleanup();
if(r == OK) {
- r = sef_cbs.sef_cb_lu_state_save(sef_lu_state, sef_lu_flags);
+ r = sef_lu_cbs.sef_cb_lu_state_save(sef_lu_state, sef_lu_flags);
}
if(r != OK) {
/* Abort update in case of error. */
m.m_type = RS_LU_PREPARE;
m.m_rs_update.state = sef_lu_state;
m.m_rs_update.result = result;
- r = sef_cbs.sef_cb_lu_response(&m);
+ r = sef_lu_cbs.sef_cb_lu_response(&m);
#if SEF_LU_DEBUG
sef_lu_debug_begin();
old_state = sef_lu_state;
sef_lu_state = SEF_LU_STATE_NULL;
if(old_state != sef_lu_state) {
- sef_cbs.sef_cb_lu_state_changed(old_state, sef_lu_state);
+ sef_lu_cbs.sef_cb_lu_state_changed(old_state, sef_lu_state);
}
}
void sef_setcb_lu_prepare(sef_cb_lu_prepare_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_lu_prepare = cb;
+ sef_lu_cbs.sef_cb_lu_prepare = cb;
}
/*===========================================================================*
void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_lu_state_isvalid = cb;
+ sef_lu_cbs.sef_cb_lu_state_isvalid = cb;
}
/*===========================================================================*
void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_lu_state_changed = cb;
+ sef_lu_cbs.sef_cb_lu_state_changed = cb;
}
/*===========================================================================*
void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_lu_state_dump = cb;
+ sef_lu_cbs.sef_cb_lu_state_dump = cb;
}
/*===========================================================================*
void sef_setcb_lu_state_save(sef_cb_lu_state_save_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_lu_state_save = cb;
+ sef_lu_cbs.sef_cb_lu_state_save = cb;
}
/*===========================================================================*
void sef_setcb_lu_response(sef_cb_lu_response_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_lu_response = cb;
+ sef_lu_cbs.sef_cb_lu_response = cb;
}
/*===========================================================================*
*===========================================================================*/
int sef_cb_lu_prepare_crash(int UNUSED(state))
{
- panic("Simulating a crash at update prepare time...");
+ panic("Simulating a crash at update prepare time...\n");
return OK;
}
#include <minix/sysutil.h>
/* SEF Ping callbacks. */
-static struct sef_cbs {
+static struct sef_ping_cbs {
sef_cb_ping_reply_t sef_cb_ping_reply;
-} sef_cbs = {
+} sef_ping_cbs = {
SEF_CB_PING_REPLY_DEFAULT
};
#endif
/* Let the callback code handle the request. */
- sef_cbs.sef_cb_ping_reply(m_ptr->m_source);
+ sef_ping_cbs.sef_cb_ping_reply(m_ptr->m_source);
/* Return OK not to let anybody else intercept the request. */
return(OK);
void sef_setcb_ping_reply(sef_cb_ping_reply_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_ping_reply = cb;
+ sef_ping_cbs.sef_cb_ping_reply = cb;
}
/*===========================================================================*
#include <minix/sysutil.h>
/* SEF Signal callbacks. */
-static struct sef_cbs {
+static struct sef_signal_cbs {
sef_cb_signal_handler_t sef_cb_signal_handler;
sef_cb_signal_manager_t sef_cb_signal_manager;
-} sef_cbs = {
+} sef_signal_cbs = {
SEF_CB_SIGNAL_HANDLER_DEFAULT,
SEF_CB_SIGNAL_MANAGER_DEFAULT
};
assert(s >= 0);
if(s) {
/* Let the callback code process the signal. */
- r = sef_cbs.sef_cb_signal_manager(target, signo);
+ r = sef_signal_cbs.sef_cb_signal_manager(target, signo);
/* Stop if process is gone. */
- if(r == EDEADSRCDST) {
+ if(r == EDEADEPT) {
break;
}
}
assert(s >= 0);
if(s) {
/* Let the callback code process the signal. */
- sef_cbs.sef_cb_signal_handler(signo);
+ sef_signal_cbs.sef_cb_signal_handler(signo);
}
}
}
assert(s >= 0);
if (s) {
/* Let the callback code handle the kernel signal. */
- sef_cbs.sef_cb_signal_handler(signo);
+ sef_signal_cbs.sef_cb_signal_handler(signo);
/* Handle SIGKSIG for a signal manager. */
if(signo == SIGKSIG) {
#endif
/* Let the callback code handle the signal. */
- sef_cbs.sef_cb_signal_handler(signo);
+ sef_signal_cbs.sef_cb_signal_handler(signo);
}
/* Return OK not to let anybody else intercept the request. */
void sef_setcb_signal_handler(sef_cb_signal_handler_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_signal_handler = cb;
+ sef_signal_cbs.sef_cb_signal_handler = cb;
}
/*===========================================================================*
void sef_setcb_signal_manager(sef_cb_signal_manager_t cb)
{
assert(cb != NULL);
- sef_cbs.sef_cb_signal_manager = cb;
+ sef_signal_cbs.sef_cb_signal_manager = cb;
}
/*===========================================================================*