[Spread-cvs] commit: r659 - trunk/daemon
jonathan at spread.org
jonathan at spread.org
Sun Jan 19 12:07:44 EST 2014
Author: jonathan
Date: 2014-01-19 12:07:44 -0500 (Sun, 19 Jan 2014)
New Revision: 659
Modified:
trunk/daemon/membership.c
trunk/daemon/membership.h
trunk/daemon/prot_body.h
trunk/daemon/protocol.c
Log:
Fix function prototype warnings on windows by defining _event callback functions with correct prototype and calling them or the direct functions as needed
Modified: trunk/daemon/membership.c
===================================================================
--- trunk/daemon/membership.c 2014-01-19 17:04:44 UTC (rev 658)
+++ trunk/daemon/membership.c 2014-01-19 17:07:44 UTC (rev 659)
@@ -112,14 +112,19 @@
static void Memb_handle_foreign( sys_scatter *scat );
static void Memb_handle_form1 ( sys_scatter *scat );
static void Memb_handle_form2 ( sys_scatter *scat );
-static void Shift_to_op(int dmy, void *dmy_ptr);
-static void Shift_to_seg(int dmy, void *dmy_ptr);
-static void Gather_or_represented(int dmy, void *dmy_ptr);
-static void Shift_to_gather();
-static void Shift_to_represented();
-static void Form_or_fail(int dmy, void *dmy_ptr);
-static void Scast_alive(int dmy, void *dmy_ptr);
-static void Send_join(int dmy, void *dmy_ptr);
+static void Shift_to_op(void);
+static void Shift_to_seg(void);
+static void Gather_or_represented(void);
+static void Shift_to_seg_event(int dmy, void *dmy_ptr);
+static void Gather_or_represented_event(int dmy, void *dmy_ptr);
+static void Shift_to_gather(void);
+static void Shift_to_represented(void);
+static void Form_or_fail(void);
+static void Scast_alive(int code);
+static void Send_join(void);
+static void Form_or_fail_event(int dmy, void *dmy_ptr);
+static void Scast_alive_event(int code, void *dmy_ptr);
+static void Send_join_event(int dmy, void *dmy_ptr);
static int Insert_member( members_info *m, int32 proc_id );
static int Insert_rep( reps_info *r, rep_info rep );
static int32 Smallest_member( members_info *m, int *index );
@@ -141,7 +146,7 @@
int32 current_subnet;
int i, num_seg;
- Shift_to_op(0, NULL);
+ Shift_to_op();
GlobalStatus.membership_changes = 0;
My = Conf_my();
@@ -239,7 +244,7 @@
Send_pack.elements[0].len = sizeof(packet_header);
Send_pack.elements[0].buf = (char *)pack_ptr;
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
}
void Memb_signal_conf_reload(void)
@@ -361,7 +366,7 @@
if( Conf_id_in_conf( &Membership, pack_ptr->proc_id ) != -1 )
{
/* sender belongs to my ring - my token is lost */
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
/* update my F_members list */
Insert_member( &F_members, pack_ptr->proc_id );
}
@@ -376,7 +381,7 @@
case REPRESENTED:
Alarm( MEMB, "Handle_alive in REPRESENTED\n");
- E_queue( Shift_to_seg, 0, NULL, Rep_timeout );
+ E_queue( Shift_to_seg_event, 0, NULL, Rep_timeout );
break;
@@ -390,7 +395,7 @@
if( ! Token_alive ) Insert_member( &F_members, pack_ptr->proc_id );
else if( Conf_id_in_conf( &Membership, pack_ptr->proc_id ) != -1 ){
/* sender belongs to my ring - my token is lost */
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
/* update my F_members list */
Insert_member( &F_members, pack_ptr->proc_id );
}
@@ -413,7 +418,7 @@
*/
if( Conf_id_in_conf( &Future_membership, pack_ptr->proc_id ) != -1 )
{
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
/* update my F_members list */
Insert_member( &F_members, pack_ptr->proc_id );
}
@@ -482,7 +487,7 @@
* packet which will force the membership change.
*/
if ( Conf_num_segments( Cn ) > 1 )
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
}
break;
@@ -496,7 +501,7 @@
Shift_to_represented();
for( i=0; i < members_ptr->num_members; i++ )
if( members_ptr->members[i] == My.id ) break;
- Scast_alive( 1, NULL );
+ Scast_alive( 1 );
}else{
/* no need to remember this join */
}
@@ -514,10 +519,10 @@
My_seg_rep, pack_ptr->proc_id );
My_seg_rep = pack_ptr->proc_id;
}
- E_queue( Shift_to_seg, 0, NULL, Rep_timeout );
+ E_queue( Shift_to_seg_event, 0, NULL, Rep_timeout );
for( i=0; i < members_ptr->num_members; i++ )
if( members_ptr->members[i] == My.id ) break;
- Scast_alive( 1, NULL );
+ Scast_alive( 1 );
}else{
/* if My_seg_rep is determined - send it to this guy */
/* My_seg_rep can be undetermined if it did not issue a join yet */
@@ -546,7 +551,7 @@
}
/* if sender is my Smallest rep - advance Gather_timeout */
if( Smallest_rep( &F_reps, &dummy ) == reps_ptr->reps[0].proc_id )
- E_queue( Form_or_fail, 0, NULL, Gather_timeout );
+ E_queue( Form_or_fail_event, 0, NULL, Gather_timeout );
break;
@@ -562,7 +567,7 @@
*/
if( Conf_id_in_conf( &Future_membership, pack_ptr->proc_id ) != -1 )
{
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
/* update my F_members list */
Insert_member( &F_members, pack_ptr->proc_id );
}
@@ -640,7 +645,7 @@
}
if( Conf_leader( &Membership ) == My.id )
{
- Memb_lookup_new_members(0, NULL);
+ Memb_lookup_new_members();
}else if( Conf_seg_leader( &Membership, My.seg_index ) == My.id &&
(!Foreign_found) ){
/*
@@ -761,7 +766,7 @@
}
}
-void Memb_token_loss(int dmy, void *dmy_ptr)
+void Memb_token_loss(void)
{
rep_info temp_rep;
int i;
@@ -861,11 +866,11 @@
}
Token_alive = 0;
- E_dequeue( Memb_token_loss, 0, NULL );
- E_dequeue( Send_join, 0, NULL );
- E_dequeue( Form_or_fail, 0, NULL );
- E_dequeue( Prot_token_hurry, 0, NULL );
- E_dequeue( Memb_lookup_new_members, 0, NULL );
+ E_dequeue( Memb_token_loss_event, 0, NULL );
+ E_dequeue( Send_join_event, 0, NULL );
+ E_dequeue( Form_or_fail_event, 0, NULL );
+ E_dequeue( Prot_token_hurry_event, 0, NULL );
+ E_dequeue( Memb_lookup_new_members_event, 0, NULL );
Last_token->type = 0;
Last_token->seq = 0;
Last_token->aru = 0;
@@ -876,11 +881,16 @@
Conf_append_id_to_seg(&Membership.segments[My.seg_index], My.id);
Alarmp( SPLOG_WARNING, MEMB, "Memb_token_loss: ############### I lost my token, state was %d\n\n", State);
- Shift_to_seg(0, NULL);
+ Shift_to_seg();
}
-static void Shift_to_op(int dmy, void *dmy_ptr)
+void Memb_token_loss_event(int dmy, void *dmy_ptr)
{
+ Memb_token_loss();
+}
+
+static void Shift_to_op(void)
+{
State = OP;
GlobalStatus.state = OP;
@@ -889,7 +899,7 @@
}
}
-static void Shift_to_seg(int dmy, void *dmy_ptr)
+static void Shift_to_seg(void)
{
State = SEG;
GlobalStatus.state = SEG;
@@ -897,12 +907,17 @@
F_members.num_members = 1;
F_members.members[0] = My.id;
F_members.num_pending = 0;
- E_queue( Scast_alive, 0, NULL, Zero_timeout );
- E_queue( Gather_or_represented, 0, NULL, Seg_timeout );
+ E_queue( Scast_alive_event, 0, NULL, Zero_timeout );
+ E_queue( Gather_or_represented_event, 0, NULL, Seg_timeout );
}
-static void Gather_or_represented(int dmy, void *dmy_ptr)
+static void Shift_to_seg_event(int dmy, void *dmy_ptr)
{
+ Shift_to_seg();
+}
+
+static void Gather_or_represented(void)
+{
int dummy;
My_seg_rep = -1;
@@ -915,8 +930,13 @@
}
}
-static void Shift_to_gather()
+static void Gather_or_represented_event(int dmy, void *dmy_ptr)
{
+ Gather_or_represented();
+}
+
+static void Shift_to_gather(void)
+{
State = GATHER;
GlobalStatus.state = GATHER;
@@ -927,23 +947,23 @@
F_reps.reps[0].type = RING_REP;
else F_reps.reps[0].type = SEG_REP;
- E_dequeue( Scast_alive, 0, NULL );
- E_dequeue( Memb_lookup_new_members, 0, NULL );
- E_queue( Send_join, 0, NULL, Zero_timeout );
- E_queue( Form_or_fail, 0, NULL, Gather_timeout );
+ E_dequeue( Scast_alive_event, 0, NULL );
+ E_dequeue( Memb_lookup_new_members_event, 0, NULL );
+ E_queue( Send_join_event, 0, NULL, Zero_timeout );
+ E_queue( Form_or_fail_event, 0, NULL, Gather_timeout );
}
-static void Shift_to_represented()
+static void Shift_to_represented(void)
{
State = REPRESENTED;
GlobalStatus.state = REPRESENTED;
- E_dequeue( Scast_alive, 0, NULL );
- E_dequeue( Gather_or_represented, 0, NULL );
- E_queue( Shift_to_seg, 0, NULL, Rep_timeout );
+ E_dequeue( Scast_alive_event, 0, NULL );
+ E_dequeue( Gather_or_represented_event, 0, NULL );
+ E_queue( Shift_to_seg_event, 0, NULL, Rep_timeout );
}
-static void Form_or_fail(int dmy, void *dmy_ptr)
+static void Form_or_fail(void)
{
rep_info temp_rep;
@@ -955,9 +975,9 @@
if( Token_alive && F_reps.num_reps == 1 )
{
/* clear everything and go back to op */
- E_dequeue( Send_join, 0, NULL);
- E_queue( Memb_lookup_new_members, 0, NULL, Lookup_timeout );
- Shift_to_op(0, NULL);
+ E_dequeue( Send_join_event, 0, NULL);
+ E_queue( Memb_lookup_new_members_event, 0, NULL, Lookup_timeout );
+ Shift_to_op();
}else{
/* create and send form token */
Create_form1();
@@ -967,9 +987,9 @@
{
/* clear everything and go back to op */
Alarm( MEMB, "Form_or_fail:failed, return to OP\n");
- E_dequeue( Send_join, 0, NULL );
- E_queue( Memb_lookup_new_members, 0, NULL, Lookup_timeout );
- Shift_to_op(0, NULL);
+ E_dequeue( Send_join_event, 0, NULL );
+ E_queue( Memb_lookup_new_members_event, 0, NULL, Lookup_timeout );
+ Shift_to_op();
}else{
Alarm( MEMB, "Form_or_fail: failed to gather\n");
/* failed to gather again */
@@ -991,8 +1011,13 @@
}
}
-static void Scast_alive( int code, void *dummy )
+static void Form_or_fail_event(int dmy, void *dmy_ptr)
{
+ Form_or_fail();
+}
+
+static void Scast_alive( int code)
+{
packet_header *pack_ptr;
Alarm( MEMB, "Scast_alive: State is %d\n", State);
@@ -1007,11 +1032,16 @@
Send_pack.num_elements = 2;
Net_scast( My.seg_index, &Send_pack );
if( code == 0 )
- E_queue( Scast_alive, 0, NULL, Alive_timeout );
+ E_queue( Scast_alive_event, 0, NULL, Alive_timeout );
}
-static void Send_join(int dmy, void *dmy_ptr)
+static void Scast_alive_event( int code, void *dummy )
{
+ Scast_alive(code);
+}
+
+static void Send_join(void)
+{
packet_header *pack_ptr;
int i;
@@ -1038,11 +1068,16 @@
Net_ucast( Potential_reps.reps[i].proc_id, &Send_pack );
}
- E_queue( Send_join, 0, NULL, Join_timeout );
+ E_queue( Send_join_event, 0, NULL, Join_timeout );
}
-void Memb_lookup_new_members(int dmy, void *dmy_ptr)
+static void Send_join_event(int dmy, void *dmy_ptr)
{
+ Send_join();
+}
+
+void Memb_lookup_new_members(void)
+{
packet_header *pack_ptr;
int num_missing;
int i,j;
@@ -1096,6 +1131,11 @@
if( num_missing ) Shift_to_gather();
}
+void Memb_lookup_new_members_event(int dmy, void *dmy_ptr)
+{
+ Memb_lookup_new_members();
+}
+
static int Insert_member( members_info *m, int32 proc_id )
{
int i;
@@ -1470,9 +1510,9 @@
Net_ucast_token( My.id, &send_scat );
}
- E_dequeue( Send_join, 0, NULL );
- E_queue( Memb_token_loss, 0, NULL, Form_timeout );
- E_dequeue( Prot_token_hurry, 0, NULL );
+ E_dequeue( Send_join_event, 0, NULL );
+ E_queue( Memb_token_loss_event, 0, NULL, Form_timeout );
+ E_dequeue( Prot_token_hurry_event, 0, NULL );
Token_alive = 0;
State = FORM;
@@ -1873,11 +1913,11 @@
Net_ucast_token( m_info->members[0], &send_scat );
}
- E_dequeue( Send_join, 0, NULL );
- E_dequeue( Form_or_fail, 0, NULL );
- E_dequeue( Shift_to_seg, 0, NULL );
- E_queue( Memb_token_loss, 0, NULL, Form_timeout );
- E_dequeue( Prot_token_hurry, 0, NULL );
+ E_dequeue( Send_join_event, 0, NULL );
+ E_dequeue( Form_or_fail_event, 0, NULL );
+ E_dequeue( Shift_to_seg_event, 0, NULL );
+ E_queue( Memb_token_loss_event, 0, NULL, Form_timeout );
+ E_dequeue( Prot_token_hurry_event, 0, NULL );
Token_alive = 0;
State = FORM;
@@ -2077,7 +2117,7 @@
Token_rounds = 1;
}
Token_alive = 1;
- E_queue( Memb_token_loss, 0, NULL, Token_timeout );
+ E_queue( Memb_token_loss_event, 0, NULL, Token_timeout );
Received_token_rounds = 0; /* ### Used for priority switching*/
Last_token->type = 0;
@@ -2362,11 +2402,11 @@
Foreign_found = 0;
if( Conf_leader( &Membership ) == My.id )
- E_queue( Memb_lookup_new_members, 0, NULL, Lookup_timeout );
+ E_queue( Memb_lookup_new_members_event, 0, NULL, Lookup_timeout );
printf("Membership id is ( %d, %d)\n", Membership_id.proc_id, Membership_id.time );
printf("%c", Conf_print( &Membership ) );
- Shift_to_op(0, NULL);
+ Shift_to_op();
}
void Flip_members( members_info *members_ptr )
Modified: trunk/daemon/membership.h
===================================================================
--- trunk/daemon/membership.h 2014-01-19 17:04:44 UTC (rev 658)
+++ trunk/daemon/membership.h 2014-01-19 17:07:44 UTC (rev 659)
@@ -57,8 +57,10 @@
int Memb_token_alive();
void Memb_handle_message( sys_scatter *scat );
void Memb_handle_token( sys_scatter *scat );
-void Memb_token_loss(int dmy, void *dmy_ptr);
-void Memb_lookup_new_members(int dmy, void *dmy_ptr);
+void Memb_token_loss(void);
+void Memb_lookup_new_members(void);
+void Memb_token_loss_event(int dmy, void *dmy_ptr);
+void Memb_lookup_new_members_event(int dmy, void *dmy_ptr);
void Memb_signal_conf_reload();
void Memb_commit();
Modified: trunk/daemon/prot_body.h
===================================================================
--- trunk/daemon/prot_body.h 2014-01-19 17:04:44 UTC (rev 658)
+++ trunk/daemon/prot_body.h 2014-01-19 17:07:44 UTC (rev 659)
@@ -98,7 +98,8 @@
ext sp_time Lookup_timeout;
ext int Wide_network;
-void Prot_token_hurry(int dmy, void *dmy_ptr);
+void Prot_token_hurry(void);
+void Prot_token_hurry_event(int dmy, void *dmy_ptr);
void Discard_packets();
void Prot_initiate_conf_reload( int code, void *data );
bool Prot_need_conf_reload( void );
Modified: trunk/daemon/protocol.c
===================================================================
--- trunk/daemon/protocol.c 2014-01-19 17:04:44 UTC (rev 658)
+++ trunk/daemon/protocol.c 2014-01-19 17:07:44 UTC (rev 659)
@@ -337,10 +337,10 @@
return;
}
if (Memb_token_alive() ) {
- E_queue( Memb_token_loss, 0, NULL, Token_timeout );
+ E_queue( Memb_token_loss_event, 0, NULL, Token_timeout );
if( Conf_leader( Memb_active_ptr() ) == My.id )
{
- E_queue( Prot_token_hurry, 0, NULL, Hurry_timeout );
+ E_queue( Prot_token_hurry_event, 0, NULL, Hurry_timeout );
}
}
@@ -571,7 +571,7 @@
Alarm( PROTOCOL,
"Prot_handle_token: not leader, asked to retrans %d %d\n",
Get_arq(Token->type), val );
- Prot_token_hurry(0, NULL);
+ Prot_token_hurry();
}else{
Alarm( PROTOCOL,
"Prot_handle_token: not leader, swallow same token %d %d\n",
@@ -761,9 +761,9 @@
Token_rounds++;
if( Conf_leader( Memb_active_ptr() ) == My.id )
- E_queue( Prot_token_hurry, 0, NULL, Hurry_timeout );
+ E_queue( Prot_token_hurry_event, 0, NULL, Hurry_timeout );
- E_queue( Memb_token_loss, 0, NULL, Token_timeout );
+ E_queue( Memb_token_loss_event, 0, NULL, Token_timeout );
/* Send any packets remaining in queue */
Prot_flush_bcast(&Send_pack_queue);
@@ -813,7 +813,7 @@
Alarmp( SPLOG_ERROR, PRINT, "\trtr_len: %d\n", Last_token->rtr_len );
Alarmp( SPLOG_ERROR, PRINT, "\tconf_hash: %d\n", Last_token->conf_hash );
- Memb_token_loss(0, NULL);
+ Memb_token_loss();
}
GlobalStatus.highest_seq = Highest_seq;
@@ -896,7 +896,7 @@
Conf_reload_singleton_state_begin();
}
- E_queue( Memb_token_loss, 0, NULL, Zero_timeout );
+ E_queue( Memb_token_loss_event, 0, NULL, Zero_timeout );
}
@@ -1643,7 +1643,7 @@
GlobalStatus.gstate, Conf_num_procs( &Reg_membership) );
}
Net_clear_partition();
- E_queue( Memb_lookup_new_members, 0, NULL, Zero_timeout);
+ E_queue( Memb_lookup_new_members_event, 0, NULL, Zero_timeout);
Conf_reload_singleton_state_end();
}
@@ -1745,12 +1745,12 @@
* to send.
*/
Token_counter = 0;
- Prot_token_hurry(0, NULL);
+ Prot_token_hurry();
}
}
}
-void Prot_token_hurry(int dmy, void *dmy_ptr)
+void Prot_token_hurry(void)
{
/* asked to send token again (almost lost) */
@@ -1766,7 +1766,7 @@
val = Get_retrans(Last_token->type);
val++;
Last_token->type = Set_retrans( Last_token->type, val );
- E_queue( Prot_token_hurry, 0, NULL, Hurry_timeout );
+ E_queue( Prot_token_hurry_event, 0, NULL, Hurry_timeout );
GlobalStatus.token_hurry++;
}
/* sending token */
@@ -1788,6 +1788,11 @@
Get_arq(Last_token->type), Get_retrans(Last_token->type) );
}
+void Prot_token_hurry_event(int dmy, void *dmy_ptr)
+{
+ Prot_token_hurry();
+}
+
void Prot_set_prev_proc(configuration *memb)
{
Prev_proc_id = Conf_previous(memb);
More information about the Spread-cvs
mailing list