As a corosync-newbie it can be hard to bridge the gap between where a
particular message is sent and where the receive handler processes it,
and vice versa.
---

 exec/totemsrp.c |   16 ++++++----------
 services/cpg.c  |   30 +++++++++++++++---------------
 2 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/exec/totemsrp.c b/exec/totemsrp.c
index 93897ea..5af9f6e 100644
--- a/exec/totemsrp.c
+++ b/exec/totemsrp.c
@@ -109,10 +109,6 @@
  * SEQNO_START_TOKEN is the starting sequence number after a new configuration
  *     for a token.  This should remain zero, unless testing overflow in which
  *     case 07fffff00 or 0xffffff00 are good starting values.
- *
- * SEQNO_START_MSG is the starting sequence number after a new configuration
- *     This should remain zero, unless testing overflow in which case
- *     0x7ffff000 and 0xfffff000 are good values to start with
  */
 #define SEQNO_START_MSG 0x0
 #define SEQNO_START_TOKEN 0x0
@@ -629,12 +625,12 @@ void main_iface_change_fn (
 struct message_handlers totemsrp_message_handlers = {
        6,
        {
-               message_handler_orf_token,
-               message_handler_mcast,
-               message_handler_memb_merge_detect,
-               message_handler_memb_join,
-               message_handler_memb_commit_token,
-               message_handler_token_hold_cancel
+               message_handler_orf_token,            /* MESSAGE_TYPE_ORF_TOKEN 
*/
+               message_handler_mcast,                /* MESSAGE_TYPE_MCAST */
+               message_handler_memb_merge_detect,    /* 
MESSAGE_TYPE_MEMB_MERGE_DETECT */
+               message_handler_memb_join,            /* MESSAGE_TYPE_MEMB_JOIN 
*/
+               message_handler_memb_commit_token,    /* 
MESSAGE_TYPE_MEMB_COMMIT_TOKEN */
+               message_handler_token_hold_cancel     /* 
MESSAGE_TYPE_TOKEN_HOLD_CANCEL */
        }
 };

diff --git a/services/cpg.c b/services/cpg.c
index 82ebf2a..02eacc3 100644
--- a/services/cpg.c
+++ b/services/cpg.c
@@ -287,39 +287,39 @@ static int notify_lib_totem_membership (
  */
 static struct corosync_lib_handler cpg_lib_engine[] =
 {
-       { /* 0 */
+       { /* 0 - MESSAGE_REQ_CPG_JOIN */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_join,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_REQUIRED
        },
-       { /* 1 */
+       { /* 1 - MESSAGE_REQ_CPG_LEAVE */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_leave,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_REQUIRED
        },
-       { /* 2 */
+       { /* 2 - MESSAGE_REQ_CPG_MCAST */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_mcast,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_REQUIRED
        },
-       { /* 3 */
+       { /* 3 - MESSAGE_REQ_CPG_MEMBERSHIP */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_membership,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_NOT_REQUIRED
        },
-       { /* 4 */
+       { /* 4 - MESSAGE_REQ_CPG_LOCAL_GET */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_local_get,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_NOT_REQUIRED
        },
-       { /* 5 */
+       { /* 5 - MESSAGE_REQ_CPG_ITERATIONINITIALIZE */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_iteration_initialize,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_NOT_REQUIRED
        },
-       { /* 6 */
+       { /* 6 - MESSAGE_REQ_CPG_ITERATIONNEXT */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_iteration_next,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_NOT_REQUIRED
        },
-       { /* 7 */
+       { /* 7 - MESSAGE_REQ_CPG_ITERATIONFINALIZE */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_iteration_finalize,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_NOT_REQUIRED
        },
-       { /* 8 */
+       { /* 8 - MESSAGE_REQ_CPG_FINALIZE */
                .lib_handler_fn                         = 
message_handler_req_lib_cpg_finalize,
                .flow_control                           = 
CS_LIB_FLOW_CONTROL_REQUIRED
        },
@@ -327,27 +327,27 @@ static struct corosync_lib_handler cpg_lib_engine[] =

 static struct corosync_exec_handler cpg_exec_engine[] =
 {
-       { /* 0 */
+       { /* 0 - MESSAGE_REQ_EXEC_CPG_PROCJOIN */
                .exec_handler_fn        = message_handler_req_exec_cpg_procjoin,
                .exec_endian_convert_fn = exec_cpg_procjoin_endian_convert
        },
-       { /* 1 */
+       { /* 1 - MESSAGE_REQ_EXEC_CPG_PROCLEAVE */
                .exec_handler_fn        = 
message_handler_req_exec_cpg_procleave,
                .exec_endian_convert_fn = exec_cpg_procjoin_endian_convert
        },
-       { /* 2 */
+       { /* 2 - MESSAGE_REQ_EXEC_CPG_JOINLIST */
                .exec_handler_fn        = message_handler_req_exec_cpg_joinlist,
                .exec_endian_convert_fn = exec_cpg_joinlist_endian_convert
        },
-       { /* 3 */
+       { /* 3 - MESSAGE_REQ_EXEC_CPG_MCAST */
                .exec_handler_fn        = message_handler_req_exec_cpg_mcast,
                .exec_endian_convert_fn = exec_cpg_mcast_endian_convert
        },
-       { /* 4 */
+       { /* 4 - MESSAGE_REQ_EXEC_CPG_DOWNLIST_OLD */
                .exec_handler_fn        = 
message_handler_req_exec_cpg_downlist_old,
                .exec_endian_convert_fn = exec_cpg_downlist_endian_convert_old
        },
-       { /* 5 */
+       { /* 5 - MESSAGE_REQ_EXEC_CPG_DOWNLIST */
                .exec_handler_fn        = message_handler_req_exec_cpg_downlist,
                .exec_endian_convert_fn = exec_cpg_downlist_endian_convert
        },
From: Tim Beale <[email protected]>

Add code comment mapping for message handler defines

As a corosync-newbie it can be hard to bridge the gap between where a
particular message is sent and where the receive handler processes it,
and vice versa.
---

 exec/totemsrp.c |   16 ++++++----------
 services/cpg.c  |   30 +++++++++++++++---------------
 2 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/exec/totemsrp.c b/exec/totemsrp.c
index 93897ea..5af9f6e 100644
--- a/exec/totemsrp.c
+++ b/exec/totemsrp.c
@@ -109,10 +109,6 @@
  * SEQNO_START_TOKEN is the starting sequence number after a new configuration
  *	for a token.  This should remain zero, unless testing overflow in which
  *	case 07fffff00 or 0xffffff00 are good starting values.
- *
- * SEQNO_START_MSG is the starting sequence number after a new configuration
- *	This should remain zero, unless testing overflow in which case
- *	0x7ffff000 and 0xfffff000 are good values to start with
  */
 #define SEQNO_START_MSG 0x0
 #define SEQNO_START_TOKEN 0x0
@@ -629,12 +625,12 @@ void main_iface_change_fn (
 struct message_handlers totemsrp_message_handlers = {
 	6,
 	{
-		message_handler_orf_token,
-		message_handler_mcast,
-		message_handler_memb_merge_detect,
-		message_handler_memb_join,
-		message_handler_memb_commit_token,
-		message_handler_token_hold_cancel
+		message_handler_orf_token,            /* MESSAGE_TYPE_ORF_TOKEN */
+		message_handler_mcast,                /* MESSAGE_TYPE_MCAST */
+		message_handler_memb_merge_detect,    /* MESSAGE_TYPE_MEMB_MERGE_DETECT */
+		message_handler_memb_join,            /* MESSAGE_TYPE_MEMB_JOIN */
+		message_handler_memb_commit_token,    /* MESSAGE_TYPE_MEMB_COMMIT_TOKEN */
+		message_handler_token_hold_cancel     /* MESSAGE_TYPE_TOKEN_HOLD_CANCEL */
 	}
 };
 
diff --git a/services/cpg.c b/services/cpg.c
index 82ebf2a..02eacc3 100644
--- a/services/cpg.c
+++ b/services/cpg.c
@@ -287,39 +287,39 @@ static int notify_lib_totem_membership (
  */
 static struct corosync_lib_handler cpg_lib_engine[] =
 {
-	{ /* 0 */
+	{ /* 0 - MESSAGE_REQ_CPG_JOIN */
 		.lib_handler_fn				= message_handler_req_lib_cpg_join,
 		.flow_control				= CS_LIB_FLOW_CONTROL_REQUIRED
 	},
-	{ /* 1 */
+	{ /* 1 - MESSAGE_REQ_CPG_LEAVE */
 		.lib_handler_fn				= message_handler_req_lib_cpg_leave,
 		.flow_control				= CS_LIB_FLOW_CONTROL_REQUIRED
 	},
-	{ /* 2 */
+	{ /* 2 - MESSAGE_REQ_CPG_MCAST */
 		.lib_handler_fn				= message_handler_req_lib_cpg_mcast,
 		.flow_control				= CS_LIB_FLOW_CONTROL_REQUIRED
 	},
-	{ /* 3 */
+	{ /* 3 - MESSAGE_REQ_CPG_MEMBERSHIP */
 		.lib_handler_fn				= message_handler_req_lib_cpg_membership,
 		.flow_control				= CS_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
-	{ /* 4 */
+	{ /* 4 - MESSAGE_REQ_CPG_LOCAL_GET */
 		.lib_handler_fn				= message_handler_req_lib_cpg_local_get,
 		.flow_control				= CS_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
-	{ /* 5 */
+	{ /* 5 - MESSAGE_REQ_CPG_ITERATIONINITIALIZE */
 		.lib_handler_fn				= message_handler_req_lib_cpg_iteration_initialize,
 		.flow_control				= CS_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
-	{ /* 6 */
+	{ /* 6 - MESSAGE_REQ_CPG_ITERATIONNEXT */
 		.lib_handler_fn				= message_handler_req_lib_cpg_iteration_next,
 		.flow_control				= CS_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
-	{ /* 7 */
+	{ /* 7 - MESSAGE_REQ_CPG_ITERATIONFINALIZE */
 		.lib_handler_fn				= message_handler_req_lib_cpg_iteration_finalize,
 		.flow_control				= CS_LIB_FLOW_CONTROL_NOT_REQUIRED
 	},
-	{ /* 8 */
+	{ /* 8 - MESSAGE_REQ_CPG_FINALIZE */
 		.lib_handler_fn				= message_handler_req_lib_cpg_finalize,
 		.flow_control				= CS_LIB_FLOW_CONTROL_REQUIRED
 	},
@@ -327,27 +327,27 @@ static struct corosync_lib_handler cpg_lib_engine[] =
 
 static struct corosync_exec_handler cpg_exec_engine[] =
 {
-	{ /* 0 */
+	{ /* 0 - MESSAGE_REQ_EXEC_CPG_PROCJOIN */
 		.exec_handler_fn	= message_handler_req_exec_cpg_procjoin,
 		.exec_endian_convert_fn	= exec_cpg_procjoin_endian_convert
 	},
-	{ /* 1 */
+	{ /* 1 - MESSAGE_REQ_EXEC_CPG_PROCLEAVE */
 		.exec_handler_fn	= message_handler_req_exec_cpg_procleave,
 		.exec_endian_convert_fn	= exec_cpg_procjoin_endian_convert
 	},
-	{ /* 2 */
+	{ /* 2 - MESSAGE_REQ_EXEC_CPG_JOINLIST */
 		.exec_handler_fn	= message_handler_req_exec_cpg_joinlist,
 		.exec_endian_convert_fn	= exec_cpg_joinlist_endian_convert
 	},
-	{ /* 3 */
+	{ /* 3 - MESSAGE_REQ_EXEC_CPG_MCAST */
 		.exec_handler_fn	= message_handler_req_exec_cpg_mcast,
 		.exec_endian_convert_fn	= exec_cpg_mcast_endian_convert
 	},
-	{ /* 4 */
+	{ /* 4 - MESSAGE_REQ_EXEC_CPG_DOWNLIST_OLD */
 		.exec_handler_fn	= message_handler_req_exec_cpg_downlist_old,
 		.exec_endian_convert_fn	= exec_cpg_downlist_endian_convert_old
 	},
-	{ /* 5 */
+	{ /* 5 - MESSAGE_REQ_EXEC_CPG_DOWNLIST */
 		.exec_handler_fn	= message_handler_req_exec_cpg_downlist,
 		.exec_endian_convert_fn	= exec_cpg_downlist_endian_convert
 	},
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to