From: Jim Meyering <meyer...@redhat.com> * exec/coroipcs.c (coroipcs_response_send) (coroipcs_dispatch_send): * exec/coroipcs.h (handler_fn_get): * include/corosync/cpg.h (cpg_deliver_fn_t, cpg_confchg_fn_t): * test/cpgbench.c (cpg_bm_confchg_fn, cpg_bm_deliver_fn): * test/testcpg.c (print_cpgname, DeliverCallback) (ConfchgCallback): * test/testcpg2.c (deliver, confch): --- exec/coroipcs.c | 4 ++-- exec/coroipcs.h | 6 +++--- include/corosync/cpg.h | 4 ++-- test/cpgbench.c | 14 +++++++------- test/testcpg.c | 28 ++++++++++++++++------------ test/testcpg2.c | 14 +++++++------- 6 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/exec/coroipcs.c b/exec/coroipcs.c index f60fc4d..7495f4c 100644 --- a/exec/coroipcs.c +++ b/exec/coroipcs.c @@ -584,7 +584,7 @@ void *coroipcs_private_data_get (void *conn) return (conn_info->private_data); } -int coroipcs_response_send (void *conn, const void *msg, int mlen) +int coroipcs_response_send (void *conn, const void *msg, size_t mlen) { struct conn_info *conn_info = (struct conn_info *)conn; struct sembuf sop; @@ -865,7 +865,7 @@ void coroipcs_refcount_dec (void *conn) pthread_mutex_unlock (&conn_info->mutex); } -int coroipcs_dispatch_send (void *conn, const void *msg, int mlen) +int coroipcs_dispatch_send (void *conn, const void *msg, size_t mlen) { struct iovec iov; diff --git a/exec/coroipcs.h b/exec/coroipcs.h index c59870d..60b63d2 100644 --- a/exec/coroipcs.h +++ b/exec/coroipcs.h @@ -6,7 +6,7 @@ * Author: Steven Dake (sd...@redhat.com) * * This software licensed under BSD license, the text of which follows: - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -77,12 +77,12 @@ extern void coroipcs_ipc_init ( extern void *coroipcs_private_data_get (void *conn); -extern int coroipcs_response_send (void *conn, const void *msg, int mlen); +extern int coroipcs_response_send (void *conn, const void *msg, size_t mlen); extern int coroipcs_response_iov_send (void *conn, const struct iovec *iov, unsigned int iov_len); -extern int coroipcs_dispatch_send (void *conn, const void *msg, int mlen); +extern int coroipcs_dispatch_send (void *conn, const void *msg, size_t mlen); extern int coroipcs_dispatch_iov_send (void *conn, const struct iovec *iov, unsigned int iov_len); diff --git a/include/corosync/cpg.h b/include/corosync/cpg.h index 49299ff..6e849d3 100644 --- a/include/corosync/cpg.h +++ b/include/corosync/cpg.h @@ -81,7 +81,7 @@ struct cpg_name { typedef void (*cpg_deliver_fn_t) ( cpg_handle_t handle, - struct cpg_name *group_name, + const struct cpg_name *group_name, uint32_t nodeid, uint32_t pid, const void *msg, @@ -89,7 +89,7 @@ typedef void (*cpg_deliver_fn_t) ( typedef void (*cpg_confchg_fn_t) ( cpg_handle_t handle, - struct cpg_name *group_name, + const struct cpg_name *group_name, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries); diff --git a/test/cpgbench.c b/test/cpgbench.c index 23f15d7..aff3acf 100644 --- a/test/cpgbench.c +++ b/test/cpgbench.c @@ -71,10 +71,10 @@ static int alarm_notice; static void cpg_bm_confchg_fn ( cpg_handle_t handle, - struct cpg_name *group_name, - struct cpg_address *member_list, int member_list_entries, - struct cpg_address *left_list, int left_list_entries, - struct cpg_address *joined_list, int joined_list_entries) + const struct cpg_name *group_name, + const struct cpg_address *member_list, size_t member_list_entries, + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries) { } @@ -82,11 +82,11 @@ static unsigned int write_count; static void cpg_bm_deliver_fn ( cpg_handle_t handle, - struct cpg_name *group_name, + const struct cpg_name *group_name, uint32_t nodeid, uint32_t pid, - void *msg, - int msg_len) + const void *msg, + size_t msg_len) { write_count++; } diff --git a/test/testcpg.c b/test/testcpg.c index 2ab68c9..8e86248 100644 --- a/test/testcpg.c +++ b/test/testcpg.c @@ -53,7 +53,7 @@ static int quit = 0; static int show_ip = 0; -static void print_cpgname (struct cpg_name *name) +static void print_cpgname (const struct cpg_name *name) { int i; @@ -64,29 +64,32 @@ static void print_cpgname (struct cpg_name *name) static void DeliverCallback ( cpg_handle_t handle, - struct cpg_name *groupName, + const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, - void *msg, - int msg_len) + const void *msg, + size_t msg_len) { if (show_ip) { struct in_addr saddr; saddr.s_addr = nodeid; - printf("DeliverCallback: message (len=%d)from node/pid %s/%d: '%s'\n", - msg_len, inet_ntoa(saddr), pid, (char *)msg); + printf("DeliverCallback: message (len=%lu)from node/pid %s/%d: '%s'\n", + (unsigned long int) msg_len, + inet_ntoa(saddr), pid, (const char *)msg); } else { - printf("DeliverCallback: message (len=%d)from node/pid %d/%d: '%s'\n", msg_len, nodeid, pid, (char *)msg); + printf("DeliverCallback: message (len=%lu)from node/pid %d/%d: '%s'\n", + (unsigned long int) msg_len, nodeid, pid, + (const char *)msg); } } static void ConfchgCallback ( cpg_handle_t handle, - struct cpg_name *groupName, - struct cpg_address *member_list, int member_list_entries, - struct cpg_address *left_list, int left_list_entries, - struct cpg_address *joined_list, int joined_list_entries) + const struct cpg_name *groupName, + const struct cpg_address *member_list, size_t member_list_entries, + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries) { int i; struct in_addr saddr; @@ -122,7 +125,8 @@ static void ConfchgCallback ( } } - printf("nodes in group now %d\n", member_list_entries); + printf("nodes in group now %lu\n", + (unsigned long int) member_list_entries); for (i=0; i<member_list_entries; i++) { if (show_ip) { saddr.s_addr = member_list[i].nodeid; diff --git a/test/testcpg2.c b/test/testcpg2.c index ee0336f..2e0ac6c 100644 --- a/test/testcpg2.c +++ b/test/testcpg2.c @@ -45,21 +45,21 @@ static void deliver( cpg_handle_t handle, - struct cpg_name *group_name, + const struct cpg_name *group_name, uint32_t nodeid, uint32_t pid, - void *msg, - int msg_len) + const void *msg, + size_t msg_len) { printf("self delivered nodeid: %x\n", nodeid); } static void confch( cpg_handle_t handle, - struct cpg_name *group_name, - struct cpg_address *member_list, int member_list_entries, - struct cpg_address *left_list, int left_list_entries, - struct cpg_address *joined_list, int joined_list_entries) + const struct cpg_name *group_name, + const struct cpg_address *member_list, size_t member_list_entries, + const struct cpg_address *left_list, size_t left_list_entries, + const struct cpg_address *joined_list, size_t joined_list_entries) { printf("confchg nodeid %x\n", member_list[0].nodeid); } -- 1.6.2.rc1.285.gc5f54 _______________________________________________ Openais mailing list Openais@lists.linux-foundation.org https://lists.linux-foundation.org/mailman/listinfo/openais