Przeglądaj źródła

coroapi.h: change lib_handler_fn's *msg to be const

Make a tiny type change and watch it propagate.
* include/corosync/engine/coroapi.h
(struct corosync_lib_handler) [lib_handler_fn]: Change type
of 2nd parameter: s/void *msg/const void *msg/.
Propagate the above into cfg.c and votequorum.c:
* services/cfg.c (message_handler_req_lib_cfg_get_node_addrs):
Constification exposed a bug in this function whereby it mistakenly
modified storage through its now-const *msg parameter.  Since it
did that solely to store a temporary result, we've changed it
to use a local variable instead.
* services/votequorum.c (message_handler_req_lib_votequorum_setvotes):
Likewise.
* exec/vsf_quorum.c: add const to msg param.
* services/evs.c: Likewise.
* services/pload.c: Likewise.
* services/cpg.c: Likewise.
* services/confdb.c: Likewise.
* exec/coroipcs.h: signature of coroipcs_handler_fn_lvalue must match
that of lib_handler_fn; noted via main.c.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2047 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 lat temu
rodzic
commit
e002172704
9 zmienionych plików z 280 dodań i 198 usunięć
  1. 1 1
      exec/coroipcs.h
  2. 12 7
      exec/vsf_quorum.c
  3. 1 1
      include/corosync/engine/coroapi.h
  4. 42 41
      services/cfg.c
  5. 95 53
      services/confdb.c
  6. 33 23
      services/cpg.c
  7. 23 23
      services/evs.c
  8. 3 3
      services/pload.c
  9. 70 46
      services/votequorum.c

+ 1 - 1
exec/coroipcs.h

@@ -43,7 +43,7 @@ struct iovec;
 
 typedef int (*coroipcs_init_fn_lvalue) (void *conn);
 typedef int (*coroipcs_exit_fn_lvalue) (void *conn);
-typedef void (*coroipcs_handler_fn_lvalue) (void *conn, void *msg);
+typedef void (*coroipcs_handler_fn_lvalue) (void *conn, const void *msg);
 
 struct coroipcs_init_state {
 	const char *socket_name;

+ 12 - 7
exec/vsf_quorum.c

@@ -81,9 +81,12 @@ struct internal_callback_pd {
 	void *context;
 };
 
-static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg);
-static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg);
-static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg);
+static void message_handler_req_lib_quorum_getquorate (void *conn,
+						       const void *msg);
+static void message_handler_req_lib_quorum_trackstart (void *conn,
+						       const void *msg);
+static void message_handler_req_lib_quorum_trackstop (void *conn,
+						      const void *msg);
 static void send_library_notification(void *conn);
 static void send_internal_notification(void);
 static int quorum_exec_init_fn (struct corosync_api_v1 *api);
@@ -394,7 +397,8 @@ static void send_library_notification(void *conn)
 	return;
 }
 
-static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg)
+static void message_handler_req_lib_quorum_getquorate (void *conn,
+						       const void *msg)
 {
 	struct res_lib_quorum_getquorate res_lib_quorum_getquorate;
 
@@ -409,9 +413,10 @@ static void message_handler_req_lib_quorum_getquorate (void *conn, void *msg)
 }
 
 
-static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg)
+static void message_handler_req_lib_quorum_trackstart (void *conn,
+						       const void *msg)
 {
-	struct req_lib_quorum_trackstart *req_lib_quorum_trackstart = (struct req_lib_quorum_trackstart *)msg;
+	const struct req_lib_quorum_trackstart *req_lib_quorum_trackstart = msg;
 	mar_res_header_t res;
 	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
 
@@ -446,7 +451,7 @@ static void message_handler_req_lib_quorum_trackstart (void *conn, void *msg)
 	corosync_api->ipc_response_send(conn, &res, sizeof(mar_res_header_t));
 }
 
-static void message_handler_req_lib_quorum_trackstop (void *conn, void *msg)
+static void message_handler_req_lib_quorum_trackstop (void *conn, const void *msg)
 {
 	mar_res_header_t res;
 	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);

+ 1 - 1
include/corosync/engine/coroapi.h

@@ -557,7 +557,7 @@ struct corosync_api_v1 {
 #define SERVICE_HANDLER_MAXIMUM_COUNT 64
 
 struct corosync_lib_handler {
-	void (*lib_handler_fn) (void *conn, void *msg);
+	void (*lib_handler_fn) (void *conn, const void *msg);
 	int response_size;
 	int response_id;
 	enum cs_lib_flow_control flow_control;

+ 42 - 41
services/cfg.c

@@ -123,55 +123,55 @@ static void exec_cfg_killnode_endian_convert (void *msg);
 
 static void message_handler_req_lib_cfg_ringstatusget (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_ringreenable (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_statetrack (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_statetrackstop (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_administrativestateset (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_administrativestateget (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_serviceload (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_serviceunload (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_killnode (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_tryshutdown (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_replytoshutdown (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_get_node_addrs (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 static void message_handler_req_lib_cfg_local_get (
 	void *conn,
-	void *msg);
+	const void *msg);
 
 /*
  * Service Handler Definition
@@ -635,13 +635,13 @@ static void message_handler_req_exec_cfg_shutdown (
  */
 static void message_handler_req_lib_cfg_ringstatusget (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 	struct res_lib_cfg_ringstatusget res_lib_cfg_ringstatusget;
 	struct totem_ip_address interfaces[INTERFACE_MAX];
 	unsigned int iface_count;
 	char **status;
-	char *totem_ip_string;
+	const char *totem_ip_string;
 	unsigned int i;
 
 	ENTER();
@@ -659,7 +659,8 @@ static void message_handler_req_lib_cfg_ringstatusget (
 	res_lib_cfg_ringstatusget.interface_count = iface_count;
 
 	for (i = 0; i < iface_count; i++) {
-		totem_ip_string = (char *)api->totem_ip_print (&interfaces[i]);
+		totem_ip_string
+		  = (const char *)api->totem_ip_print (&interfaces[i]);
 		strcpy ((char *)&res_lib_cfg_ringstatusget.interface_status[i],
 			status[i]);
 		strcpy ((char *)&res_lib_cfg_ringstatusget.interface_name[i],
@@ -675,7 +676,7 @@ static void message_handler_req_lib_cfg_ringstatusget (
 
 static void message_handler_req_lib_cfg_ringreenable (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 	struct req_exec_cfg_ringreenable req_exec_cfg_ringreenable;
 	struct iovec iovec;
@@ -697,7 +698,7 @@ static void message_handler_req_lib_cfg_ringreenable (
 
 static void message_handler_req_lib_cfg_statetrack (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 	struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cfg_statetrack res_lib_cfg_statetrack;
@@ -733,7 +734,7 @@ static void message_handler_req_lib_cfg_statetrack (
 
 static void message_handler_req_lib_cfg_statetrackstop (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 	struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
 //	struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message;
@@ -745,7 +746,7 @@ static void message_handler_req_lib_cfg_statetrackstop (
 
 static void message_handler_req_lib_cfg_administrativestateset (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 //	struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message;
 
@@ -754,7 +755,7 @@ static void message_handler_req_lib_cfg_administrativestateset (
 }
 static void message_handler_req_lib_cfg_administrativestateget (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 //	struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message;
 	ENTER();
@@ -763,16 +764,15 @@ static void message_handler_req_lib_cfg_administrativestateget (
 
 static void message_handler_req_lib_cfg_serviceload (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
-	struct req_lib_cfg_serviceload *req_lib_cfg_serviceload =
-		(struct req_lib_cfg_serviceload *)msg;
+	const struct req_lib_cfg_serviceload *req_lib_cfg_serviceload = msg;
 	struct res_lib_cfg_serviceload res_lib_cfg_serviceload;
 
 	ENTER();
 	api->service_link_and_init (
 		api,
-		(char *)req_lib_cfg_serviceload->service_name,
+		(const char *)req_lib_cfg_serviceload->service_name,
 		req_lib_cfg_serviceload->service_ver);
 
 	res_lib_cfg_serviceload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD;
@@ -787,16 +787,15 @@ static void message_handler_req_lib_cfg_serviceload (
 
 static void message_handler_req_lib_cfg_serviceunload (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
-	struct req_lib_cfg_serviceunload *req_lib_cfg_serviceunload =
-		(struct req_lib_cfg_serviceunload *)msg;
+	const struct req_lib_cfg_serviceunload *req_lib_cfg_serviceunload = msg;
 	struct res_lib_cfg_serviceunload res_lib_cfg_serviceunload;
 
 	ENTER();
 	api->service_unlink_and_exit (
 		api,
-		(char *)req_lib_cfg_serviceunload->service_name,
+		(const char *)req_lib_cfg_serviceunload->service_name,
 		req_lib_cfg_serviceunload->service_ver);
 	res_lib_cfg_serviceunload.header.id = MESSAGE_RES_CFG_SERVICEUNLOAD;
 	res_lib_cfg_serviceunload.header.size = sizeof (struct res_lib_cfg_serviceunload);
@@ -811,9 +810,9 @@ static void message_handler_req_lib_cfg_serviceunload (
 
 static void message_handler_req_lib_cfg_killnode (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
-	struct req_lib_cfg_killnode *req_lib_cfg_killnode = (struct req_lib_cfg_killnode *)msg;
+	const struct req_lib_cfg_killnode *req_lib_cfg_killnode = msg;
 	struct res_lib_cfg_killnode res_lib_cfg_killnode;
 	struct req_exec_cfg_killnode req_exec_cfg_killnode;
 	struct iovec iovec;
@@ -845,10 +844,10 @@ static void message_handler_req_lib_cfg_killnode (
 
 static void message_handler_req_lib_cfg_tryshutdown (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 	struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
-	struct req_lib_cfg_tryshutdown *req_lib_cfg_tryshutdown = (struct req_lib_cfg_tryshutdown *)msg;
+	const struct req_lib_cfg_tryshutdown *req_lib_cfg_tryshutdown = msg;
 	struct res_lib_cfg_tryshutdown res_lib_cfg_tryshutdown;
 	struct list_head *iter;
 
@@ -978,10 +977,10 @@ static void message_handler_req_lib_cfg_tryshutdown (
 
 static void message_handler_req_lib_cfg_replytoshutdown (
 	void *conn,
-	void *msg)
+	const void *msg)
 {
 	struct cfg_info *ci = (struct cfg_info *)api->ipc_private_data_get (conn);
-	struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = (struct req_lib_cfg_replytoshutdown *)msg;
+	const struct req_lib_cfg_replytoshutdown *req_lib_cfg_replytoshutdown = msg;
 	struct res_lib_cfg_replytoshutdown res_lib_cfg_replytoshutdown;
 	int status = CS_OK;
 
@@ -1012,7 +1011,8 @@ exit_fn:
 	LEAVE();
 }
 
-static void message_handler_req_lib_cfg_get_node_addrs (void *conn, void *msg)
+static void message_handler_req_lib_cfg_get_node_addrs (void *conn,
+							const void *msg)
 {
 	struct totem_ip_address node_ifs[INTERFACE_MAX];
 	char buf[PIPE_BUF];
@@ -1020,13 +1020,14 @@ static void message_handler_req_lib_cfg_get_node_addrs (void *conn, void *msg)
 	unsigned int num_interfaces = 0;
 	int ret = CS_OK;
 	int i;
-	struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = (struct req_lib_cfg_get_node_addrs *)msg;
+	const struct req_lib_cfg_get_node_addrs *req_lib_cfg_get_node_addrs = msg;
 	struct res_lib_cfg_get_node_addrs *res_lib_cfg_get_node_addrs = (struct res_lib_cfg_get_node_addrs *)buf;
+	unsigned int nodeid = req_lib_cfg_get_node_addrs->nodeid;
 
-	if (req_lib_cfg_get_node_addrs->nodeid == 0)
-		req_lib_cfg_get_node_addrs->nodeid = api->totem_nodeid_get();
+	if (nodeid == 0)
+		nodeid = api->totem_nodeid_get();
 
-	api->totem_ifaces_get(req_lib_cfg_get_node_addrs->nodeid, node_ifs, &status, &num_interfaces);
+	api->totem_ifaces_get(nodeid, node_ifs, &status, &num_interfaces);
 
 	res_lib_cfg_get_node_addrs->header.size = sizeof(struct res_lib_cfg_get_node_addrs) + (num_interfaces * TOTEMIP_ADDRLEN);
 	res_lib_cfg_get_node_addrs->header.id = MESSAGE_RES_CFG_GET_NODE_ADDRS;
@@ -1044,7 +1045,7 @@ static void message_handler_req_lib_cfg_get_node_addrs (void *conn, void *msg)
 	api->ipc_response_send(conn, res_lib_cfg_get_node_addrs, res_lib_cfg_get_node_addrs->header.size);
 }
 
-static void message_handler_req_lib_cfg_local_get (void *conn, void *message)
+static void message_handler_req_lib_cfg_local_get (void *conn, const void *msg)
 {
 	struct res_lib_cfg_local_get res_lib_cfg_local_get;
 

+ 95 - 53
services/confdb.c

@@ -62,28 +62,45 @@ static int confdb_exec_init_fn (
 static int confdb_lib_init_fn (void *conn);
 static int confdb_lib_exit_fn (void *conn);
 
-static void message_handler_req_lib_confdb_object_create (void *conn, void *message);
-static void message_handler_req_lib_confdb_object_destroy (void *conn, void *message);
-static void message_handler_req_lib_confdb_object_find_destroy (void *conn, void *message);
-
-static void message_handler_req_lib_confdb_key_create (void *conn, void *message);
-static void message_handler_req_lib_confdb_key_get (void *conn, void *message);
-static void message_handler_req_lib_confdb_key_replace (void *conn, void *message);
-static void message_handler_req_lib_confdb_key_delete (void *conn, void *message);
-static void message_handler_req_lib_confdb_key_iter (void *conn, void *message);
-
-static void message_handler_req_lib_confdb_key_increment (void *conn, void *message);
-static void message_handler_req_lib_confdb_key_decrement (void *conn, void *message);
-
-static void message_handler_req_lib_confdb_object_iter (void *conn, void *message);
-static void message_handler_req_lib_confdb_object_find (void *conn, void *message);
-
-static void message_handler_req_lib_confdb_object_parent_get (void *conn, void *message);
-static void message_handler_req_lib_confdb_write (void *conn, void *message);
-static void message_handler_req_lib_confdb_reload (void *conn, void *message);
-
-static void message_handler_req_lib_confdb_track_start (void *conn, void *message);
-static void message_handler_req_lib_confdb_track_stop (void *conn, void *message);
+static void message_handler_req_lib_confdb_object_create (void *conn,
+							  const void *message);
+static void message_handler_req_lib_confdb_object_destroy (void *conn,
+							   const void *message);
+static void message_handler_req_lib_confdb_object_find_destroy (void *conn,
+								const void *message);
+
+static void message_handler_req_lib_confdb_key_create (void *conn,
+						       const void *message);
+static void message_handler_req_lib_confdb_key_get (void *conn,
+						    const void *message);
+static void message_handler_req_lib_confdb_key_replace (void *conn,
+							const void *message);
+static void message_handler_req_lib_confdb_key_delete (void *conn,
+						       const void *message);
+static void message_handler_req_lib_confdb_key_iter (void *conn,
+						     const void *message);
+
+static void message_handler_req_lib_confdb_key_increment (void *conn,
+							  const void *message);
+static void message_handler_req_lib_confdb_key_decrement (void *conn,
+							  const void *message);
+
+static void message_handler_req_lib_confdb_object_iter (void *conn,
+							const void *message);
+static void message_handler_req_lib_confdb_object_find (void *conn,
+							const void *message);
+
+static void message_handler_req_lib_confdb_object_parent_get (void *conn,
+							      const void *message);
+static void message_handler_req_lib_confdb_write (void *conn,
+						  const void *message);
+static void message_handler_req_lib_confdb_reload (void *conn,
+						   const void *message);
+
+static void message_handler_req_lib_confdb_track_start (void *conn,
+							const void *message);
+static void message_handler_req_lib_confdb_track_stop (void *conn,
+						       const void *message);
 
 static void confdb_notify_lib_of_key_change(
 	object_change_type_t change_type,
@@ -293,9 +310,11 @@ static int confdb_lib_exit_fn (void *conn)
 	return (0);
 }
 
-static void message_handler_req_lib_confdb_object_create (void *conn, void *message)
+static void message_handler_req_lib_confdb_object_create (void *conn,
+							  const void *message)
 {
-	struct req_lib_confdb_object_create *req_lib_confdb_object_create = (struct req_lib_confdb_object_create *)message;
+	const struct req_lib_confdb_object_create *req_lib_confdb_object_create
+	  = message;
 	struct res_lib_confdb_object_create res_lib_confdb_object_create;
 	hdb_handle_t object_handle;
 	int ret = CS_OK;
@@ -313,9 +332,11 @@ static void message_handler_req_lib_confdb_object_create (void *conn, void *mess
 	api->ipc_response_send(conn, &res_lib_confdb_object_create, sizeof(res_lib_confdb_object_create));
 }
 
-static void message_handler_req_lib_confdb_object_destroy (void *conn, void *message)
+static void message_handler_req_lib_confdb_object_destroy (void *conn,
+							   const void *message)
 {
-	struct req_lib_confdb_object_destroy *req_lib_confdb_object_destroy = (struct req_lib_confdb_object_destroy *)message;
+	const struct req_lib_confdb_object_destroy *req_lib_confdb_object_destroy
+	  = message;
 	mar_res_header_t res;
 	int ret = CS_OK;
 
@@ -328,9 +349,11 @@ static void message_handler_req_lib_confdb_object_destroy (void *conn, void *mes
 	api->ipc_response_send(conn, &res, sizeof(res));
 }
 
-static void message_handler_req_lib_confdb_object_find_destroy (void *conn, void *message)
+static void message_handler_req_lib_confdb_object_find_destroy (void *conn,
+								const void *message)
 {
-	struct req_lib_confdb_object_find_destroy *req_lib_confdb_object_find_destroy = (struct req_lib_confdb_object_find_destroy *)message;
+	const struct req_lib_confdb_object_find_destroy
+	  *req_lib_confdb_object_find_destroy = message;
 	mar_res_header_t res;
 	int ret = CS_OK;
 
@@ -344,9 +367,11 @@ static void message_handler_req_lib_confdb_object_find_destroy (void *conn, void
 }
 
 
-static void message_handler_req_lib_confdb_key_create (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_create (void *conn,
+						       const void *message)
 {
-	struct req_lib_confdb_key_create *req_lib_confdb_key_create = (struct req_lib_confdb_key_create *)message;
+	const struct req_lib_confdb_key_create *req_lib_confdb_key_create
+	  = message;
 	mar_res_header_t res;
 	int ret = CS_OK;
 
@@ -363,9 +388,10 @@ static void message_handler_req_lib_confdb_key_create (void *conn, void *message
 	api->ipc_response_send(conn, &res, sizeof(res));
 }
 
-static void message_handler_req_lib_confdb_key_get (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_get (void *conn,
+						    const void *message)
 {
-	struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message;
+	const struct req_lib_confdb_key_get *req_lib_confdb_key_get = message;
 	struct res_lib_confdb_key_get res_lib_confdb_key_get;
 	size_t value_len;
 	void *value;
@@ -388,9 +414,10 @@ static void message_handler_req_lib_confdb_key_get (void *conn, void *message)
 	api->ipc_response_send(conn, &res_lib_confdb_key_get, sizeof(res_lib_confdb_key_get));
 }
 
-static void message_handler_req_lib_confdb_key_increment (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_increment (void *conn,
+							  const void *message)
 {
-	struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message;
+	const struct req_lib_confdb_key_get *req_lib_confdb_key_get = message;
 	struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec;
 	int ret = CS_OK;
 
@@ -406,9 +433,10 @@ static void message_handler_req_lib_confdb_key_increment (void *conn, void *mess
 	api->ipc_response_send(conn, &res_lib_confdb_key_incdec, sizeof(res_lib_confdb_key_incdec));
 }
 
-static void message_handler_req_lib_confdb_key_decrement (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_decrement (void *conn,
+							  const void *message)
 {
-	struct req_lib_confdb_key_get *req_lib_confdb_key_get = (struct req_lib_confdb_key_get *)message;
+	const struct req_lib_confdb_key_get *req_lib_confdb_key_get = message;
 	struct res_lib_confdb_key_incdec res_lib_confdb_key_incdec;
 	int ret = CS_OK;
 
@@ -424,7 +452,8 @@ static void message_handler_req_lib_confdb_key_decrement (void *conn, void *mess
 	api->ipc_response_send(conn, &res_lib_confdb_key_incdec, sizeof(res_lib_confdb_key_incdec));
 }
 
-static void message_handler_req_lib_confdb_key_replace (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_replace (void *conn,
+							const void *message)
 {
 	const struct req_lib_confdb_key_replace *req_lib_confdb_key_replace
 	  = message;
@@ -444,9 +473,11 @@ static void message_handler_req_lib_confdb_key_replace (void *conn, void *messag
 	api->ipc_response_send(conn, &res, sizeof(res));
 }
 
-static void message_handler_req_lib_confdb_key_delete (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_delete (void *conn,
+						       const void *message)
 {
-	struct req_lib_confdb_key_delete *req_lib_confdb_key_delete = (struct req_lib_confdb_key_delete *)message;
+	const struct req_lib_confdb_key_delete *req_lib_confdb_key_delete
+	  = message;
 	mar_res_header_t res;
 	int ret = CS_OK;
 
@@ -461,9 +492,11 @@ static void message_handler_req_lib_confdb_key_delete (void *conn, void *message
 	api->ipc_response_send(conn, &res, sizeof(res));
 }
 
-static void message_handler_req_lib_confdb_object_parent_get (void *conn, void *message)
+static void message_handler_req_lib_confdb_object_parent_get (void *conn,
+							      const void *message)
 {
-	struct req_lib_confdb_object_parent_get *req_lib_confdb_object_parent_get = (struct req_lib_confdb_object_parent_get *)message;
+	const struct req_lib_confdb_object_parent_get
+	  *req_lib_confdb_object_parent_get = message;
 	struct res_lib_confdb_object_parent_get res_lib_confdb_object_parent_get;
 	hdb_handle_t object_handle;
 	int ret = CS_OK;
@@ -480,9 +513,10 @@ static void message_handler_req_lib_confdb_object_parent_get (void *conn, void *
 }
 
 
-static void message_handler_req_lib_confdb_key_iter (void *conn, void *message)
+static void message_handler_req_lib_confdb_key_iter (void *conn,
+						     const void *message)
 {
-	struct req_lib_confdb_key_iter *req_lib_confdb_key_iter = (struct req_lib_confdb_key_iter *)message;
+	const struct req_lib_confdb_key_iter *req_lib_confdb_key_iter = message;
 	struct res_lib_confdb_key_iter res_lib_confdb_key_iter;
 	void *key_name;
 	size_t key_name_len;
@@ -510,9 +544,11 @@ static void message_handler_req_lib_confdb_key_iter (void *conn, void *message)
 	api->ipc_response_send(conn, &res_lib_confdb_key_iter, sizeof(res_lib_confdb_key_iter));
 }
 
-static void message_handler_req_lib_confdb_object_iter (void *conn, void *message)
+static void message_handler_req_lib_confdb_object_iter (void *conn,
+							const void *message)
 {
-	struct req_lib_confdb_object_iter *req_lib_confdb_object_iter = (struct req_lib_confdb_object_iter *)message;
+	const struct req_lib_confdb_object_iter *req_lib_confdb_object_iter
+	  = message;
 	struct res_lib_confdb_object_iter res_lib_confdb_object_iter;
 	size_t object_name_len;
 	int ret = CS_OK;
@@ -544,9 +580,11 @@ static void message_handler_req_lib_confdb_object_iter (void *conn, void *messag
 	api->ipc_response_send(conn, &res_lib_confdb_object_iter, sizeof(res_lib_confdb_object_iter));
 }
 
-static void message_handler_req_lib_confdb_object_find (void *conn, void *message)
+static void message_handler_req_lib_confdb_object_find (void *conn,
+							const void *message)
 {
-	struct req_lib_confdb_object_find *req_lib_confdb_object_find = (struct req_lib_confdb_object_find *)message;
+	const struct req_lib_confdb_object_find *req_lib_confdb_object_find
+	  = message;
 	struct res_lib_confdb_object_find res_lib_confdb_object_find;
 	int ret = CS_OK;
 
@@ -573,7 +611,8 @@ static void message_handler_req_lib_confdb_object_find (void *conn, void *messag
 	api->ipc_response_send(conn, &res_lib_confdb_object_find, sizeof(res_lib_confdb_object_find));
 }
 
-static void message_handler_req_lib_confdb_write (void *conn, void *message)
+static void message_handler_req_lib_confdb_write (void *conn,
+						  const void *message)
 {
 	struct res_lib_confdb_write res_lib_confdb_write;
 	int ret = CS_OK;
@@ -594,9 +633,10 @@ static void message_handler_req_lib_confdb_write (void *conn, void *message)
 	api->ipc_response_send(conn, &res_lib_confdb_write, sizeof(res_lib_confdb_write));
 }
 
-static void message_handler_req_lib_confdb_reload (void *conn, void *message)
+static void message_handler_req_lib_confdb_reload (void *conn,
+						   const void *message)
 {
-	struct req_lib_confdb_reload *req_lib_confdb_reload = (struct req_lib_confdb_reload *)message;
+	const struct req_lib_confdb_reload *req_lib_confdb_reload = message;
 	struct res_lib_confdb_reload res_lib_confdb_reload;
 	int ret = CS_OK;
 	const char *error_string = NULL;
@@ -683,9 +723,10 @@ static void confdb_notify_lib_of_destroyed_object(
 }
 
 
-static void message_handler_req_lib_confdb_track_start (void *conn, void *message)
+static void message_handler_req_lib_confdb_track_start (void *conn,
+							const void *message)
 {
-	struct req_lib_confdb_object_track_start *req = (struct req_lib_confdb_object_track_start *)message;
+	const struct req_lib_confdb_object_track_start *req = message;
 	mar_res_header_t res;
 
 	api->object_track_start(req->object_handle,
@@ -701,7 +742,8 @@ static void message_handler_req_lib_confdb_track_start (void *conn, void *messag
 	api->ipc_response_send(conn, &res, sizeof(res));
 }
 
-static void message_handler_req_lib_confdb_track_stop (void *conn, void *message)
+static void message_handler_req_lib_confdb_track_stop (void *conn,
+						       const void *message)
 {
 	mar_res_header_t res;
 

+ 33 - 23
services/cpg.c

@@ -158,21 +158,26 @@ static void exec_cpg_mcast_endian_convert (void *msg);
 
 static void exec_cpg_downlist_endian_convert (void *msg);
 
-static void message_handler_req_lib_cpg_join (void *conn, void *message);
+static void message_handler_req_lib_cpg_join (void *conn, const void *message);
 
-static void message_handler_req_lib_cpg_leave (void *conn, void *message);
+static void message_handler_req_lib_cpg_leave (void *conn, const void *message);
 
-static void message_handler_req_lib_cpg_mcast (void *conn, void *message);
+static void message_handler_req_lib_cpg_mcast (void *conn, const void *message);
 
-static void message_handler_req_lib_cpg_membership (void *conn, void *message);
+static void message_handler_req_lib_cpg_membership (void *conn,
+						    const void *message);
 
-static void message_handler_req_lib_cpg_trackstart (void *conn, void *message);
+static void message_handler_req_lib_cpg_trackstart (void *conn,
+						    const void *message);
 
-static void message_handler_req_lib_cpg_trackstop (void *conn, void *message);
+static void message_handler_req_lib_cpg_trackstop (void *conn,
+						   const void *message);
 
-static void message_handler_req_lib_cpg_local_get (void *conn, void *message);
+static void message_handler_req_lib_cpg_local_get (void *conn,
+						   const void *message);
 
-static void message_handler_req_lib_cpg_groups_get (void *conn, void *message);
+static void message_handler_req_lib_cpg_groups_get (void *conn,
+						    const void *message);
 
 static int cpg_node_joinleave_send (struct group_info *gi, struct process_info *pi, int fn, int reason);
 
@@ -681,7 +686,7 @@ static void cpg_confchg_fn (
 /* Can byteswap join & leave messages */
 static void exec_cpg_procjoin_endian_convert (void *msg)
 {
-	struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = (struct req_exec_cpg_procjoin *)msg;
+	struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = msg;
 
 	req_exec_cpg_procjoin->pid = swab32(req_exec_cpg_procjoin->pid);
 	swab_mar_cpg_name_t (&req_exec_cpg_procjoin->group_name);
@@ -705,7 +710,7 @@ static void exec_cpg_joinlist_endian_convert (void *msg_v)
 
 static void exec_cpg_downlist_endian_convert (void *msg)
 {
-	struct req_exec_cpg_downlist *req_exec_cpg_downlist = (struct req_exec_cpg_downlist *)msg;
+	struct req_exec_cpg_downlist *req_exec_cpg_downlist = msg;
 	unsigned int i;
 
 	req_exec_cpg_downlist->left_nodes = swab32(req_exec_cpg_downlist->left_nodes);
@@ -718,7 +723,7 @@ static void exec_cpg_downlist_endian_convert (void *msg)
 
 static void exec_cpg_mcast_endian_convert (void *msg)
 {
-	struct req_exec_cpg_mcast *req_exec_cpg_mcast = (struct req_exec_cpg_mcast *)msg;
+	struct req_exec_cpg_mcast *req_exec_cpg_mcast = msg;
 
 	swab_mar_req_header_t (&req_exec_cpg_mcast->header);
 	swab_mar_cpg_name_t (&req_exec_cpg_mcast->group_name);
@@ -1016,9 +1021,9 @@ static int cpg_lib_init_fn (void *conn)
 }
 
 /* Join message from the library */
-static void message_handler_req_lib_cpg_join (void *conn, void *message)
+static void message_handler_req_lib_cpg_join (void *conn, const void *message)
 {
-	struct req_lib_cpg_join *req_lib_cpg_join = (struct req_lib_cpg_join *)message;
+	const struct req_lib_cpg_join *req_lib_cpg_join = message;
 	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cpg_join res_lib_cpg_join;
 	struct group_info *gi;
@@ -1055,7 +1060,7 @@ join_err:
 }
 
 /* Leave message from the library */
-static void message_handler_req_lib_cpg_leave (void *conn, void *message)
+static void message_handler_req_lib_cpg_leave (void *conn, const void *message)
 {
 	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct res_lib_cpg_leave res_lib_cpg_leave;
@@ -1084,9 +1089,9 @@ leave_ret:
 }
 
 /* Mcast message from the library */
-static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
+static void message_handler_req_lib_cpg_mcast (void *conn, const void *message)
 {
-	struct req_lib_cpg_mcast *req_lib_cpg_mcast = (struct req_lib_cpg_mcast *)message;
+	const struct req_lib_cpg_mcast *req_lib_cpg_mcast = message;
 	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 	struct group_info *gi = pi->group;
 	struct iovec req_exec_cpg_iovec[2];
@@ -1132,7 +1137,8 @@ static void message_handler_req_lib_cpg_mcast (void *conn, void *message)
 		sizeof(res_lib_cpg_mcast));
 }
 
-static void message_handler_req_lib_cpg_membership (void *conn, void *message)
+static void message_handler_req_lib_cpg_membership (void *conn,
+						    const void *message)
 {
 	struct process_info *pi = (struct process_info *)api->ipc_private_data_get (conn);
 
@@ -1150,9 +1156,10 @@ static void message_handler_req_lib_cpg_membership (void *conn, void *message)
 }
 
 
-static void message_handler_req_lib_cpg_trackstart (void *conn, void *message)
+static void message_handler_req_lib_cpg_trackstart (void *conn,
+						    const void *message)
 {
-	struct req_lib_cpg_trackstart *req_lib_cpg_trackstart = (struct req_lib_cpg_trackstart *)message;
+	const struct req_lib_cpg_trackstart *req_lib_cpg_trackstart = message;
 	struct res_lib_cpg_trackstart res_lib_cpg_trackstart;
 	struct group_info *gi;
 	struct process_info *otherpi;
@@ -1177,9 +1184,10 @@ tstart_ret:
 	api->ipc_response_send(conn, &res_lib_cpg_trackstart, sizeof(res_lib_cpg_trackstart));
 }
 
-static void message_handler_req_lib_cpg_trackstop (void *conn, void *message)
+static void message_handler_req_lib_cpg_trackstop (void *conn,
+						   const void *message)
 {
-	struct req_lib_cpg_trackstop *req_lib_cpg_trackstop = (struct req_lib_cpg_trackstop *)message;
+	const struct req_lib_cpg_trackstop *req_lib_cpg_trackstop = message;
 	struct res_lib_cpg_trackstop res_lib_cpg_trackstop;
 	struct process_info *otherpi;
 	struct group_info *gi;
@@ -1204,7 +1212,8 @@ tstop_ret:
 	api->ipc_response_send(conn, &res_lib_cpg_trackstop.header, sizeof(res_lib_cpg_trackstop));
 }
 
-static void message_handler_req_lib_cpg_local_get (void *conn, void *message)
+static void message_handler_req_lib_cpg_local_get (void *conn,
+						   const void *message)
 {
 	struct res_lib_cpg_local_get res_lib_cpg_local_get;
 
@@ -1217,7 +1226,8 @@ static void message_handler_req_lib_cpg_local_get (void *conn, void *message)
 		sizeof(res_lib_cpg_local_get));
 }
 
-static void message_handler_req_lib_cpg_groups_get (void *conn, void *message)
+static void message_handler_req_lib_cpg_groups_get (void *conn,
+						    const void *message)
 {
 	struct res_lib_cpg_groups_get res_lib_cpg_groups_get;
 

+ 23 - 23
services/evs.c

@@ -7,7 +7,7 @@
  * Author: Steven Dake (sdake@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:
  *
@@ -83,11 +83,11 @@ static void message_handler_req_exec_mcast (const void *msg, unsigned int nodeid
 
 static void req_exec_mcast_endian_convert (void *msg);
 
-static void message_handler_req_evs_join (void *conn, void *msg);
-static void message_handler_req_evs_leave (void *conn, void *msg);
-static void message_handler_req_evs_mcast_joined (void *conn, void *msg);
-static void message_handler_req_evs_mcast_groups (void *conn, void *msg);
-static void message_handler_req_evs_membership_get (void *conn, void *msg);
+static void message_handler_req_evs_join (void *conn, const void *msg);
+static void message_handler_req_evs_leave (void *conn, const void *msg);
+static void message_handler_req_evs_mcast_joined (void *conn, const void *msg);
+static void message_handler_req_evs_mcast_groups (void *conn, const void *msg);
+static void message_handler_req_evs_membership_get (void *conn, const void *msg);
 
 static int evs_lib_init_fn (void *conn);
 static int evs_lib_exit_fn (void *conn);
@@ -98,7 +98,7 @@ struct evs_pd {
 	struct list_head list;
 	void *conn;
 };
-	
+
 static struct corosync_api_v1 *api;
 
 static struct corosync_lib_handler evs_lib_engine[] =
@@ -147,7 +147,7 @@ struct corosync_service_engine evs_service_engine = {
 	.name			= "corosync extended virtual synchrony service",
 	.id			= EVS_SERVICE,
 	.private_data_size	= sizeof (struct evs_pd),
-	.flow_control		= CS_LIB_FLOW_CONTROL_REQUIRED, 
+	.flow_control		= CS_LIB_FLOW_CONTROL_REQUIRED,
 	.lib_init_fn		= evs_lib_init_fn,
 	.lib_exit_fn		= evs_lib_exit_fn,
 	.lib_engine		= evs_lib_engine,
@@ -277,10 +277,10 @@ static int evs_lib_exit_fn (void *conn)
 	return (0);
 }
 
-static void message_handler_req_evs_join (void *conn, void *msg)
+static void message_handler_req_evs_join (void *conn, const void *msg)
 {
 	cs_error_t error = CS_OK;
-	struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)msg;
+	const struct req_lib_evs_join *req_lib_evs_join = msg;
 	struct res_lib_evs_join res_lib_evs_join;
 	void *addr;
 	struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
@@ -290,7 +290,7 @@ static void message_handler_req_evs_join (void *conn, void *msg)
 		goto exit_error;
 	}
 
-	addr = realloc (evs_pd->groups, sizeof (struct evs_group) * 
+	addr = realloc (evs_pd->groups, sizeof (struct evs_group) *
 		(evs_pd->group_entries + req_lib_evs_join->group_entries));
 	if (addr == NULL) {
 		error = CS_ERR_NO_MEMORY;
@@ -313,9 +313,9 @@ exit_error:
 		sizeof (struct res_lib_evs_join));
 }
 
-static void message_handler_req_evs_leave (void *conn, void *msg)
+static void message_handler_req_evs_leave (void *conn, const void *msg)
 {
-	struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)msg;
+	const struct req_lib_evs_leave *req_lib_evs_leave = msg;
 	struct res_lib_evs_leave res_lib_evs_leave;
 	cs_error_t error = CS_OK;
 	int error_index;
@@ -359,10 +359,10 @@ static void message_handler_req_evs_leave (void *conn, void *msg)
 		sizeof (struct res_lib_evs_leave));
 }
 
-static void message_handler_req_evs_mcast_joined (void *conn, void *msg)
+static void message_handler_req_evs_mcast_joined (void *conn, const void *msg)
 {
 	cs_error_t error = CS_ERR_TRY_AGAIN;
-	struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)msg;
+	const struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = msg;
 	struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
 	struct iovec req_exec_evs_mcast_iovec[3];
 	struct req_exec_evs_mcast req_exec_evs_mcast;
@@ -399,14 +399,14 @@ static void message_handler_req_evs_mcast_joined (void *conn, void *msg)
 		sizeof (struct res_lib_evs_mcast_joined));
 }
 
-static void message_handler_req_evs_mcast_groups (void *conn, void *msg)
+static void message_handler_req_evs_mcast_groups (void *conn, const void *msg)
 {
 	cs_error_t error = CS_ERR_TRY_AGAIN;
-	struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)msg;
+	const struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = msg;
 	struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
 	struct iovec req_exec_evs_mcast_iovec[3];
 	struct req_exec_evs_mcast req_exec_evs_mcast;
-	char *msg_addr;
+	const char *msg_addr;
 	int res;
 
 	req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) +
@@ -418,17 +418,17 @@ static void message_handler_req_evs_mcast_groups (void *conn, void *msg)
 	req_exec_evs_mcast.msg_len = req_lib_evs_mcast_groups->msg_len;
 	req_exec_evs_mcast.group_entries = req_lib_evs_mcast_groups->group_entries;
 
-	msg_addr = (char *)req_lib_evs_mcast_groups +
-		sizeof (struct req_lib_evs_mcast_groups) + 
+	msg_addr = (const char *)req_lib_evs_mcast_groups +
+		sizeof (struct req_lib_evs_mcast_groups) +
 		(sizeof (struct evs_group) * req_lib_evs_mcast_groups->group_entries);
 
 	req_exec_evs_mcast_iovec[0].iov_base = (char *)&req_exec_evs_mcast;
 	req_exec_evs_mcast_iovec[0].iov_len = sizeof (req_exec_evs_mcast);
 	req_exec_evs_mcast_iovec[1].iov_base = (char *)&req_lib_evs_mcast_groups->groups;
 	req_exec_evs_mcast_iovec[1].iov_len = sizeof (struct evs_group) * req_lib_evs_mcast_groups->group_entries;
-	req_exec_evs_mcast_iovec[2].iov_base = msg_addr;
+	req_exec_evs_mcast_iovec[2].iov_base = (void *) msg_addr; /* discard const */
 	req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_groups->msg_len;
-	
+
 	res = api->totem_mcast (req_exec_evs_mcast_iovec, 3, TOTEM_AGREED);
 	if (res == 0) {
 		error = CS_OK;
@@ -442,7 +442,7 @@ static void message_handler_req_evs_mcast_groups (void *conn, void *msg)
 		sizeof (struct res_lib_evs_mcast_groups));
 }
 
-static void message_handler_req_evs_membership_get (void *conn, void *msg)
+static void message_handler_req_evs_membership_get (void *conn, const void *msg)
 {
 	struct res_lib_evs_membership_get res_lib_evs_membership_get;
 

+ 3 - 3
services/pload.c

@@ -91,7 +91,7 @@ static void req_exec_pload_start_endian_convert (void *msg);
 
 static void req_exec_pload_mcast_endian_convert (void *msg);
 
-static void message_handler_req_pload_start (void *conn, void *msg);
+static void message_handler_req_pload_start (void *conn, const void *msg);
 
 static int pload_lib_init_fn (void *conn);
 
@@ -232,9 +232,9 @@ static int pload_lib_exit_fn (void *conn)
 	return (0);
 }
 
-static void message_handler_req_pload_start (void *conn, void *msg)
+static void message_handler_req_pload_start (void *conn, const void *msg)
 {
-	struct req_lib_pload_start *req_lib_pload_start = (struct req_lib_pload_start *)msg;
+	const struct req_lib_pload_start *req_lib_pload_start = msg;
 	struct req_exec_pload_start req_exec_pload_start;
 	struct iovec iov;
 

+ 70 - 46
services/votequorum.c

@@ -188,37 +188,48 @@ static int quorum_lib_init_fn (void *conn);
 static int quorum_lib_exit_fn (void *conn);
 
 static void message_handler_req_exec_quorum_nodeinfo (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_quorum_reconfigure (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_quorum_killnode (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 
-static void message_handler_req_lib_votequorum_getinfo (void *conn, void *message);
+static void message_handler_req_lib_votequorum_getinfo (void *conn,
+							const void *message);
 
-static void message_handler_req_lib_votequorum_setexpected (void *conn, void *message);
+static void message_handler_req_lib_votequorum_setexpected (void *conn,
+							    const void *message);
 
-static void message_handler_req_lib_votequorum_setvotes (void *conn, void *message);
+static void message_handler_req_lib_votequorum_setvotes (void *conn,
+							 const void *message);
 
-static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void *message);
+static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
+							       const void *message);
 
-static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, void *message);
+static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn,
+								 const void *message);
 
-static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *message);
+static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
+							   const void *message);
 
-static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *message);
+static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn,
+							      const void *message);
 
-static void message_handler_req_lib_votequorum_setstate (void *conn, void *message);
+static void message_handler_req_lib_votequorum_setstate (void *conn,
+							 const void *message);
 
-static void message_handler_req_lib_votequorum_leaving (void *conn, void *message);
-static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg);
-static void message_handler_req_lib_votequorum_trackstop (void *conn, void *msg);
+static void message_handler_req_lib_votequorum_leaving (void *conn,
+							const void *message);
+static void message_handler_req_lib_votequorum_trackstart (void *conn,
+							   const void *msg);
+static void message_handler_req_lib_votequorum_trackstop (void *conn,
+							  const void *msg);
 
 static int quorum_exec_send_nodeinfo(void);
 static int quorum_exec_send_reconfigure(int param, int nodeid, int value);
@@ -463,7 +474,7 @@ static inline void objdb_get_int(const struct corosync_api_v1 *corosync,
 	}
 }
 
-static int votequorum_send_message(void *message, int len)
+static int votequorum_send_message(const void *message, size_t len)
 {
 	struct iovec iov[2];
 	struct q_protheader header;
@@ -476,7 +487,7 @@ static int votequorum_send_message(void *message, int len)
 
 	iov[0].iov_base = &header;
 	iov[0].iov_len  = sizeof(header);
-	iov[1].iov_base = message;
+	iov[1].iov_base = (void *) message;
 	iov[1].iov_len  = len;
 
 	return corosync_api->tpg_joined_mcast(group_handle, iov, 2, TOTEM_AGREED);
@@ -952,7 +963,7 @@ static void quorum_confchg_fn (
 
 static void exec_quorum_nodeinfo_endian_convert (void *msg)
 {
-	struct req_exec_quorum_nodeinfo *nodeinfo = (struct req_exec_quorum_nodeinfo *)msg;
+	struct req_exec_quorum_nodeinfo *nodeinfo = msg;
 
 	nodeinfo->votes = swab32(nodeinfo->votes);
 	nodeinfo->expected_votes = swab32(nodeinfo->expected_votes);
@@ -965,14 +976,14 @@ static void exec_quorum_nodeinfo_endian_convert (void *msg)
 
 static void exec_quorum_reconfigure_endian_convert (void *msg)
 {
-	struct req_exec_quorum_reconfigure *reconfigure = (struct req_exec_quorum_reconfigure *)msg;
+	struct req_exec_quorum_reconfigure *reconfigure = msg;
 	reconfigure->nodeid = swab32(reconfigure->nodeid);
 	reconfigure->value = swab32(reconfigure->value);
 }
 
 static void exec_quorum_killnode_endian_convert (void *msg)
 {
-	struct req_exec_quorum_killnode *killnode = (struct req_exec_quorum_killnode *)msg;
+	struct req_exec_quorum_killnode *killnode = msg;
 	killnode->reason = swab16(killnode->reason);
 	killnode->nodeid = swab32(killnode->nodeid);
 }
@@ -1021,10 +1032,10 @@ static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, unsigned
 }
 
 static void message_handler_req_exec_quorum_nodeinfo (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_quorum_nodeinfo *req_exec_quorum_nodeinfo = (struct req_exec_quorum_nodeinfo *)message;
+	const struct req_exec_quorum_nodeinfo *req_exec_quorum_nodeinfo = message;
 	struct cluster_node *node;
 	int old_votes;
 	int old_expected;
@@ -1089,10 +1100,10 @@ static void message_handler_req_exec_quorum_nodeinfo (
 }
 
 static void message_handler_req_exec_quorum_killnode (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_quorum_killnode *req_exec_quorum_killnode = (struct req_exec_quorum_killnode *)message;
+	const struct req_exec_quorum_killnode *req_exec_quorum_killnode = message;
 
 	if (req_exec_quorum_killnode->nodeid == corosync_api->totem_nodeid_get()) {
 		log_printf(LOG_CRIT, "Killed by node %d: %s\n", nodeid, kill_reason(req_exec_quorum_killnode->reason));
@@ -1103,10 +1114,10 @@ static void message_handler_req_exec_quorum_killnode (
 }
 
 static void message_handler_req_exec_quorum_reconfigure (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_quorum_reconfigure *req_exec_quorum_reconfigure = (struct req_exec_quorum_reconfigure *)message;
+	const struct req_exec_quorum_reconfigure *req_exec_quorum_reconfigure = message;
 	struct cluster_node *node;
 	struct list_head *nodelist;
 
@@ -1174,9 +1185,9 @@ static void leaving_timer_fn(void *arg)
 }
 
 /* Message from the library */
-static void message_handler_req_lib_votequorum_getinfo (void *conn, void *message)
+static void message_handler_req_lib_votequorum_getinfo (void *conn, const void *message)
 {
-	struct req_lib_votequorum_getinfo *req_lib_votequorum_getinfo = (struct req_lib_votequorum_getinfo *)message;
+	const struct req_lib_votequorum_getinfo *req_lib_votequorum_getinfo = message;
 	struct res_lib_votequorum_getinfo res_lib_votequorum_getinfo;
 	struct cluster_node *node;
 	unsigned int highest_expected = 0;
@@ -1240,9 +1251,9 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, void *messag
 }
 
 /* Message from the library */
-static void message_handler_req_lib_votequorum_setexpected (void *conn, void *message)
+static void message_handler_req_lib_votequorum_setexpected (void *conn, const void *message)
 {
-	struct req_lib_votequorum_setexpected *req_lib_votequorum_setexpected = (struct req_lib_votequorum_setexpected *)message;
+	const struct req_lib_votequorum_setexpected *req_lib_votequorum_setexpected = message;
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	cs_error_t error = CS_OK;
 	unsigned int newquorum;
@@ -1279,19 +1290,21 @@ error_exit:
 }
 
 /* Message from the library */
-static void message_handler_req_lib_votequorum_setvotes (void *conn, void *message)
+static void message_handler_req_lib_votequorum_setvotes (void *conn, const void *message)
 {
-	struct req_lib_votequorum_setvotes *req_lib_votequorum_setvotes = (struct req_lib_votequorum_setvotes *)message;
+	const struct req_lib_votequorum_setvotes *req_lib_votequorum_setvotes = message;
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	struct cluster_node *node;
 	unsigned int newquorum;
 	unsigned int total_votes;
 	unsigned int saved_votes;
 	cs_error_t error = CS_OK;
+	unsigned int nodeid;
 
 	ENTER();
 
-	node = find_node_by_nodeid(req_lib_votequorum_setvotes->nodeid);
+	nodeid = req_lib_votequorum_setvotes->nodeid;
+	node = find_node_by_nodeid(nodeid);
 	if (!node) {
 		error = CS_ERR_NAME_NOT_FOUND;
 		goto error_exit;
@@ -1309,10 +1322,11 @@ static void message_handler_req_lib_votequorum_setvotes (void *conn, void *messa
 		goto error_exit;
 	}
 
-	if (!req_lib_votequorum_setvotes->nodeid)
-		req_lib_votequorum_setvotes->nodeid = corosync_api->totem_nodeid_get();
+	if (!nodeid)
+		nodeid = corosync_api->totem_nodeid_get();
 
-	quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, req_lib_votequorum_setvotes->nodeid, req_lib_votequorum_setvotes->votes);
+	quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, nodeid,
+				     req_lib_votequorum_setvotes->votes);
 
 error_exit:
 	/* send status */
@@ -1323,7 +1337,7 @@ error_exit:
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_leaving (void *conn, void *message)
+static void message_handler_req_lib_votequorum_leaving (void *conn, const void *message)
 {
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	cs_error_t error = CS_OK;
@@ -1370,9 +1384,11 @@ static void quorum_device_timer_fn(void *arg)
 }
 
 
-static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void *message)
+static void message_handler_req_lib_votequorum_qdisk_register (void *conn,
+							       const void *message)
 {
-	struct req_lib_votequorum_qdisk_register *req_lib_votequorum_qdisk_register = (struct req_lib_votequorum_qdisk_register *)message;
+	const struct req_lib_votequorum_qdisk_register
+	  *req_lib_votequorum_qdisk_register = message;
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	cs_error_t error = CS_OK;
 
@@ -1397,7 +1413,8 @@ static void message_handler_req_lib_votequorum_qdisk_register (void *conn, void
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, void *message)
+static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn,
+								 const void *message)
 {
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	cs_error_t error = CS_OK;
@@ -1424,9 +1441,11 @@ static void message_handler_req_lib_votequorum_qdisk_unregister (void *conn, voi
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *message)
+static void message_handler_req_lib_votequorum_qdisk_poll (void *conn,
+							   const void *message)
 {
-	struct req_lib_votequorum_qdisk_poll *req_lib_votequorum_qdisk_poll = (struct req_lib_votequorum_qdisk_poll *)message;
+	const struct req_lib_votequorum_qdisk_poll
+	  *req_lib_votequorum_qdisk_poll = message;
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	cs_error_t error = CS_OK;
 
@@ -1464,7 +1483,8 @@ static void message_handler_req_lib_votequorum_qdisk_poll (void *conn, void *mes
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *message)
+static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn,
+							      const void *message)
 {
 	struct res_lib_votequorum_qdisk_getinfo res_lib_votequorum_qdisk_getinfo;
 	cs_error_t error = CS_OK;
@@ -1493,7 +1513,8 @@ static void message_handler_req_lib_votequorum_qdisk_getinfo (void *conn, void *
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_setstate (void *conn, void *message)
+static void message_handler_req_lib_votequorum_setstate (void *conn,
+							 const void *message)
 {
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	cs_error_t error = CS_OK;
@@ -1511,9 +1532,11 @@ static void message_handler_req_lib_votequorum_setstate (void *conn, void *messa
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg)
+static void message_handler_req_lib_votequorum_trackstart (void *conn,
+							   const void *msg)
 {
-	struct req_lib_votequorum_trackstart *req_lib_votequorum_trackstart = (struct req_lib_votequorum_trackstart *)msg;
+	const struct req_lib_votequorum_trackstart
+	  *req_lib_votequorum_trackstart = msg;
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
 
@@ -1550,7 +1573,8 @@ static void message_handler_req_lib_votequorum_trackstart (void *conn, void *msg
 	LEAVE();
 }
 
-static void message_handler_req_lib_votequorum_trackstop (void *conn, void *msg)
+static void message_handler_req_lib_votequorum_trackstop (void *conn,
+							  const void *msg)
 {
 	struct res_lib_votequorum_status res_lib_votequorum_status;
 	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);