sef: Naming refactory.

Change-Id: Id313e73fde577e48a17f2c16c808c9156a1be804
This commit is contained in:
Cristiano Giuffrida 2014-09-28 18:53:31 +02:00 committed by David van Moolenbroek
parent dd09614042
commit e6f5b0cc65
4 changed files with 41 additions and 41 deletions

View file

@ -5,12 +5,12 @@
#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,
@ -48,13 +48,13 @@ static int process_init(int type, sef_init_info_t *info)
/* 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:
@ -67,7 +67,7 @@ static int process_init(int type, sef_init_info_t *info)
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;
}
@ -128,7 +128,7 @@ int do_sef_init_request(message *m_ptr)
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;
}
/*===========================================================================*
@ -137,7 +137,7 @@ void sef_setcb_init_fresh(sef_cb_init_t 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;
}
/*===========================================================================*
@ -146,7 +146,7 @@ void sef_setcb_init_lu(sef_cb_init_t 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;
}
/*===========================================================================*
@ -155,7 +155,7 @@ void sef_setcb_init_restart(sef_cb_init_t 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;
}
/*===========================================================================*
@ -197,7 +197,7 @@ int sef_cb_init_reset(int UNUSED(type), sef_init_info_t *UNUSED(info))
*===========================================================================*/
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;
}

View file

@ -9,14 +9,14 @@ static int sef_lu_flags;
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,
@ -64,7 +64,7 @@ void do_sef_lu_before_receive(void)
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
@ -73,7 +73,7 @@ void do_sef_lu_before_receive(void)
*/
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);
@ -98,9 +98,9 @@ int do_sef_lu_request(message *m_ptr)
/* 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 {
@ -115,7 +115,7 @@ int do_sef_lu_request(message *m_ptr)
* 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);
}
}
@ -148,7 +148,7 @@ static void sef_lu_ready(int result)
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. */
@ -164,7 +164,7 @@ static void sef_lu_ready(int result)
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();
@ -181,7 +181,7 @@ static void sef_lu_ready(int result)
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);
}
}
@ -191,7 +191,7 @@ static void sef_lu_ready(int result)
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;
}
/*===========================================================================*
@ -200,7 +200,7 @@ void sef_setcb_lu_prepare(sef_cb_lu_prepare_t 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;
}
/*===========================================================================*
@ -209,7 +209,7 @@ void sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_t 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;
}
/*===========================================================================*
@ -218,7 +218,7 @@ void sef_setcb_lu_state_changed(sef_cb_lu_state_changed_t 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;
}
/*===========================================================================*
@ -227,7 +227,7 @@ void sef_setcb_lu_state_dump(sef_cb_lu_state_dump_t 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;
}
/*===========================================================================*
@ -236,7 +236,7 @@ void sef_setcb_lu_state_save(sef_cb_lu_state_save_t 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;
}
/*===========================================================================*
@ -315,7 +315,7 @@ int sef_cb_lu_prepare_never_ready(int UNUSED(state))
*===========================================================================*/
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;
}

View file

@ -3,9 +3,9 @@
#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
};
@ -31,7 +31,7 @@ int do_sef_ping_request(message *m_ptr)
#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);
@ -43,7 +43,7 @@ int do_sef_ping_request(message *m_ptr)
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;
}
/*===========================================================================*

View file

@ -4,10 +4,10 @@
#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
};
@ -47,10 +47,10 @@ static void process_sigmgr_signals(void)
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;
}
}
@ -77,7 +77,7 @@ static void process_sigmgr_self_signals(sigset_t sigset)
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);
}
}
}
@ -99,7 +99,7 @@ int do_sef_signal_request(message *m_ptr)
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) {
@ -125,7 +125,7 @@ int do_sef_signal_request(message *m_ptr)
#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. */
@ -138,7 +138,7 @@ int do_sef_signal_request(message *m_ptr)
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;
}
/*===========================================================================*
@ -147,7 +147,7 @@ void sef_setcb_signal_handler(sef_cb_signal_handler_t 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;
}
/*===========================================================================*