Просмотр исходного кода

cpg.c: resolve almost all warnings

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1917 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 лет назад
Родитель
Сommit
1919ff31c7
4 измененных файлов с 19 добавлено и 19 удалено
  1. 1 1
      exec/main.c
  2. 1 1
      exec/main.h
  3. 3 3
      include/corosync/engine/coroapi.h
  4. 14 14
      services/cpg.c

+ 1 - 1
exec/main.c

@@ -481,7 +481,7 @@ int main_mcast (
 	return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee));
 	return (totempg_groups_mcast_joined (corosync_group_handle, iovec, iov_len, guarantee));
 }
 }
 
 
-int message_source_is_local (mar_message_source_t *source)
+int message_source_is_local (const mar_message_source_t *source)
 {
 {
 	int ret = 0;
 	int ret = 0;
 
 

+ 1 - 1
exec/main.h

@@ -62,6 +62,6 @@ extern int main_mcast (
 
 
 extern void message_source_set (mar_message_source_t *source, void *conn);
 extern void message_source_set (mar_message_source_t *source, void *conn);
 
 
-extern int message_source_is_local (mar_message_source_t *source);
+extern int message_source_is_local (const mar_message_source_t *source);
 
 
 #endif /* MAIN_H_DEFINED */
 #endif /* MAIN_H_DEFINED */

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

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2008 Red Hat, Inc.
+ * Copyright (c) 2008, 2009 Red Hat, Inc.
  *
  *
  * All rights reserved.
  * All rights reserved.
  *
  *
@@ -386,7 +386,7 @@ struct corosync_api_v1 {
 	 */
 	 */
 	void (*ipc_source_set) (mar_message_source_t *source, void *conn);
 	void (*ipc_source_set) (mar_message_source_t *source, void *conn);
 
 
-	int (*ipc_source_is_local) (mar_message_source_t *source);
+	int (*ipc_source_is_local) (const mar_message_source_t *source);
 
 
 	void *(*ipc_private_data_get) (void *conn);
 	void *(*ipc_private_data_get) (void *conn);
 
 
@@ -557,7 +557,7 @@ struct corosync_lib_handler {
 };
 };
 
 
 struct corosync_exec_handler {
 struct corosync_exec_handler {
-	void (*exec_handler_fn) (void *msg, unsigned int nodeid);
+	void (*exec_handler_fn) (const void *msg, unsigned int nodeid);
 	void (*exec_endian_convert_fn) (void *msg);
 	void (*exec_endian_convert_fn) (void *msg);
 };
 };
 
 

+ 14 - 14
services/cpg.c

@@ -131,11 +131,11 @@ static int cpg_lib_init_fn (void *conn);
 static int cpg_lib_exit_fn (void *conn);
 static int cpg_lib_exit_fn (void *conn);
 
 
 static void message_handler_req_exec_cpg_procjoin (
 static void message_handler_req_exec_cpg_procjoin (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 	unsigned int nodeid);
 
 
 static void message_handler_req_exec_cpg_procleave (
 static void message_handler_req_exec_cpg_procleave (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 	unsigned int nodeid);
 
 
 static void message_handler_req_exec_cpg_joinlist (
 static void message_handler_req_exec_cpg_joinlist (
@@ -143,11 +143,11 @@ static void message_handler_req_exec_cpg_joinlist (
 	unsigned int nodeid);
 	unsigned int nodeid);
 
 
 static void message_handler_req_exec_cpg_mcast (
 static void message_handler_req_exec_cpg_mcast (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 	unsigned int nodeid);
 
 
 static void message_handler_req_exec_cpg_downlist (
 static void message_handler_req_exec_cpg_downlist (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 	unsigned int nodeid);
 
 
 static void exec_cpg_procjoin_endian_convert (void *msg);
 static void exec_cpg_procjoin_endian_convert (void *msg);
@@ -780,10 +780,10 @@ local_join:
 }
 }
 
 
 static void message_handler_req_exec_cpg_downlist (
 static void message_handler_req_exec_cpg_downlist (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 	unsigned int nodeid)
 {
 {
-	struct req_exec_cpg_downlist *req_exec_cpg_downlist = (struct req_exec_cpg_downlist *)message;
+	const struct req_exec_cpg_downlist *req_exec_cpg_downlist = message;
 	int i;
 	int i;
 	struct list_head removed_list;
 	struct list_head removed_list;
 
 
@@ -813,10 +813,10 @@ static void message_handler_req_exec_cpg_downlist (
 }
 }
 
 
 static void message_handler_req_exec_cpg_procjoin (
 static void message_handler_req_exec_cpg_procjoin (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 	unsigned int nodeid)
 {
 {
-	struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = (struct req_exec_cpg_procjoin *)message;
+	const struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = message;
 
 
 	log_printf(LOG_LEVEL_DEBUG, "got procjoin message from cluster node %d\n", nodeid);
 	log_printf(LOG_LEVEL_DEBUG, "got procjoin message from cluster node %d\n", nodeid);
 
 
@@ -826,10 +826,10 @@ static void message_handler_req_exec_cpg_procjoin (
 }
 }
 
 
 static void message_handler_req_exec_cpg_procleave (
 static void message_handler_req_exec_cpg_procleave (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 	unsigned int nodeid)
 {
 {
-	struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = (struct req_exec_cpg_procjoin *)message;
+	const struct req_exec_cpg_procjoin *req_exec_cpg_procjoin = message;
 	struct group_info *gi;
 	struct group_info *gi;
 	struct process_info *pi;
 	struct process_info *pi;
 	struct list_head *iter;
 	struct list_head *iter;
@@ -895,10 +895,10 @@ static void message_handler_req_exec_cpg_joinlist (
 }
 }
 
 
 static void message_handler_req_exec_cpg_mcast (
 static void message_handler_req_exec_cpg_mcast (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 	unsigned int nodeid)
 {
 {
-	struct req_exec_cpg_mcast *req_exec_cpg_mcast = (struct req_exec_cpg_mcast *)message;
+	const struct req_exec_cpg_mcast *req_exec_cpg_mcast = message;
 	struct res_lib_cpg_deliver_callback *res_lib_cpg_mcast;
 	struct res_lib_cpg_deliver_callback *res_lib_cpg_mcast;
 	int msglen = req_exec_cpg_mcast->msglen;
 	int msglen = req_exec_cpg_mcast->msglen;
 	char buf[sizeof(*res_lib_cpg_mcast) + msglen];
 	char buf[sizeof(*res_lib_cpg_mcast) + msglen];
@@ -922,8 +922,8 @@ static void message_handler_req_exec_cpg_mcast (
 	}
 	}
 	memcpy(&res_lib_cpg_mcast->group_name, &gi->group_name,
 	memcpy(&res_lib_cpg_mcast->group_name, &gi->group_name,
 		sizeof(mar_cpg_name_t));
 		sizeof(mar_cpg_name_t));
-	memcpy(&res_lib_cpg_mcast->message, (char*)message+sizeof(*req_exec_cpg_mcast),
-		msglen);
+	memcpy(&res_lib_cpg_mcast->message,
+	       (const char*)message+sizeof(*req_exec_cpg_mcast), msglen);
 
 
 	/* Send to all interested members */
 	/* Send to all interested members */
 	for (iter = gi->members.next; iter != &gi->members; iter = iter->next) {
 	for (iter = gi->members.next; iter != &gi->members; iter = iter->next) {