see previous patches.
Index: services/evt.c
===================================================================
--- services/evt.c	(revision 1778)
+++ services/evt.c	(working copy)
@@ -110,10 +110,10 @@
 
 static void evt_conf_change(
 		enum totem_configuration_type configuration_type,
-		unsigned int *member_list, int member_list_entries,
-		unsigned int *left_list, int left_list_entries,
-		unsigned int *joined_list, int joined_list_entries,
-		struct memb_ring_id *ring_id);
+		const unsigned int *member_list, size_t member_list_entries,
+		const unsigned int *left_list, size_t left_list_entries,
+		const unsigned int *joined_list, size_t joined_list_entries,
+		const struct memb_ring_id *ring_id);
 
 static int evt_lib_init(void *conn);
 static int evt_lib_exit(void *conn);
@@ -197,7 +197,7 @@
 
 static void evt_remote_evt(void *msg, unsigned int nodeid);
 static void evt_remote_recovery_evt(void *msg, unsigned int nodeid);
-static void evt_remote_chan_op(void *msg, unsigned int nodeid);
+static void evt_remote_chan_op(const void *msg, unsigned int nodeid);
 
 static struct corosync_exec_handler evt_exec_engine[] = {
 	{
@@ -517,8 +517,8 @@
  * Next unlink ID
  */
 static uint64_t	base_unlink_id = 0;
-inline uint64_t
-next_chan_unlink_id()
+static inline uint64_t
+next_chan_unlink_id(void)
 {
 	uint64_t uid = my_node_id;
 	uid = (uid << 32ULL) | base_unlink_id;
@@ -723,9 +723,9 @@
 	mar_evt_event_filter_array_t *filta =
 			(mar_evt_event_filter_array_t *)req->ics_filter_data;
 	mar_evt_event_filter_array_t *filters;
-	mar_evt_event_filter_t *filt = (void *)filta + sizeof(mar_evt_event_filter_array_t);
-	SaUint8T *str = (void *)filta + sizeof(mar_evt_event_filter_array_t) +
-			(sizeof(mar_evt_event_filter_t) * filta->filters_number);
+	mar_evt_event_filter_t *filt = (mar_evt_event_filter_t *)((char *)filta + sizeof(mar_evt_event_filter_array_t));
+	SaUint8T *str = (SaUint8T *)((char *)filta + sizeof(mar_evt_event_filter_array_t) +
+			(sizeof(mar_evt_event_filter_t) * filta->filters_number));
 	int i;
 	int j;
 
@@ -769,7 +769,7 @@
 	return SA_AIS_OK;
 }
 
-SaTimeT clust_time_now(void)
+static SaTimeT clust_time_now(void)
 {
 	struct timeval tv;
 	SaTimeT time_now;
@@ -800,7 +800,7 @@
  * Look up a channel in the global channel list
  */
 static struct event_svr_channel_instance *
-find_channel(mar_name_t *chan_name, uint64_t unlink_id)
+find_channel(const mar_name_t *chan_name, uint64_t unlink_id)
 {
 	struct list_head *l, *head;
 	struct event_svr_channel_instance *eci;
@@ -831,7 +831,7 @@
  * Find the last unlinked version of a channel.
  */
 static struct event_svr_channel_instance *
-find_last_unlinked_channel(mar_name_t *chan_name)
+find_last_unlinked_channel(const mar_name_t *chan_name)
 {
 	struct list_head *l;
 	struct event_svr_channel_instance *eci;
@@ -853,7 +853,7 @@
 /*
  * Create and initialize a channel instance structure
  */
-static struct event_svr_channel_instance *create_channel(mar_name_t *cn)
+static struct event_svr_channel_instance *create_channel(const mar_name_t *cn)
 {
 	struct event_svr_channel_instance *eci;
 	eci = (struct event_svr_channel_instance *) malloc(sizeof(*eci));
@@ -953,7 +953,7 @@
 /*
  * Scan the list of channels and dump the open count info.
  */
-static void dump_all_chans()
+static void dump_all_chans(void)
 {
 	struct list_head *l;
 	struct event_svr_channel_instance *eci;
@@ -969,7 +969,7 @@
 /*
  * Scan the list of channels and zero out the open counts
  */
-static void zero_chan_open_counts()
+static void zero_chan_open_counts(void)
 {
 	struct list_head *l;
 	struct event_svr_channel_instance *eci;
@@ -1333,7 +1333,7 @@
  */
 #define NODE_HASH_SIZE 256
 static struct member_node_data *nl[NODE_HASH_SIZE] = {0};
-inline int
+static inline int
 hash_sock_addr(unsigned int nodeid)
 {
 	return nodeid & (NODE_HASH_SIZE - 1);
@@ -1415,7 +1415,7 @@
  * way there is a recovery node chosen for each original partition in case
  * of a merge.
  */
-static struct member_node_data* oldest_node()
+static struct member_node_data* oldest_node(void)
 {
 	struct member_node_data *mn = 0;
 	struct member_node_data *oldest = 0;
@@ -1451,7 +1451,7 @@
  * a new node.
  */
 static int check_last_event(
-	struct lib_event_data *evtpkt,
+	const struct lib_event_data *evtpkt,
 	unsigned int nodeid)
 {
 	struct member_node_data *nd;
@@ -1491,7 +1491,7 @@
  * upper 32 bits of the event ID to make sure that we can generate a cluster
  * wide unique event ID for a given event.
  */
-SaAisErrorT set_event_id(mar_uint32_t node_id)
+static SaAisErrorT set_event_id(mar_uint32_t node_id)
 {
 	SaAisErrorT err = SA_AIS_OK;
 	if (base_id_top) {
@@ -1882,7 +1882,7 @@
 	}
 
 }
-inline void notify_event(void *conn)
+static inline void notify_event(void *conn)
 {
 	struct libevt_pd *esip;
 
@@ -2077,8 +2077,8 @@
  * - fill in some channel info
  */
 static struct event_data *
-make_local_event(struct lib_event_data *p,
-			struct event_svr_channel_instance *eci)
+make_local_event(const struct lib_event_data *p,
+	struct event_svr_channel_instance *eci)
 {
 	struct event_data *ed;
 	mar_evt_event_pattern_t *eps;
@@ -2523,7 +2523,7 @@
  * - See if there are any events with retetion times that need to be delivered
  *      because of the new subscription.
  */
-static char *filter_types[] = {
+static const char *filter_types[] = {
 	"INVALID FILTER TYPE",
 	"SA_EVT_PREFIX_FILTER",
 	"SA_EVT_SUFFIX_FILTER",
@@ -2929,10 +2929,10 @@
  */
 static void evt_conf_change(
 		enum totem_configuration_type configuration_type,
-		unsigned int *member_list, int member_list_entries,
-		unsigned int *left_list, int left_list_entries,
-		unsigned int *joined_list, int joined_list_entries,
-		struct memb_ring_id *ring_id)
+		const unsigned int *member_list, size_t member_list_entries,
+		const unsigned int *left_list, size_t left_list_entries,
+		const unsigned int *joined_list, size_t joined_list_entries,
+		const struct memb_ring_id *ring_id)
 {
 	log_printf(RECOVERY_DEBUG, "Evt conf change %d\n",
 			configuration_type);
@@ -3332,8 +3332,8 @@
 /*
  * Calculate the remaining retention time of a received event during recovery
  */
-inline mar_time_t calc_retention_time(mar_time_t retention,
-								mar_time_t received, mar_time_t now)
+static inline mar_time_t calc_retention_time(mar_time_t retention,
+	mar_time_t received, mar_time_t now)
 {
 	if ((received < now) && ((now - received) < retention)) {
 		return retention - (now - received);
@@ -3687,9 +3687,9 @@
  * Used to communicate channel opens/closes, clear retention time,
  * config change updates...
  */
-static void evt_remote_chan_op(void *msg, unsigned int nodeid)
+static void evt_remote_chan_op(const void *msg, unsigned int nodeid)
 {
-	struct req_evt_chan_command *cpkt = msg;
+	const struct req_evt_chan_command *cpkt = msg;
 	unsigned int local_node = {SA_CLM_LOCAL_NODE_ID};
 	SaClmClusterNodeT *cn, *my_node;
 	struct member_node_data *mn;
Index: services/amf.c
===================================================================
--- services/amf.c	(revision 1778)
+++ services/amf.c	(working copy)
@@ -179,10 +179,10 @@
 struct corosync_api_v1 *api;
 static void amf_confchg_fn (
 	enum totem_configuration_type configuration_type,
-	unsigned int *member_list, int member_list_entries,
-	unsigned int *left_list, int left_list_entries,
-	unsigned int *joined_list, int joined_list_entries,
-	struct memb_ring_id *ring_id);
+	const unsigned int *member_list, size_t member_list_entries,
+	const unsigned int *left_list, size_t left_list_entries,
+	const unsigned int *joined_list, size_t joined_list_entries,
+	const struct memb_ring_id *ring_id);
 static int amf_lib_exit_fn (void *conn);
 static int amf_exec_init_fn (struct corosync_api_v1 *corosync_api);
 static int amf_lib_init_fn (void *conn);
@@ -1333,10 +1333,10 @@
  */
 static void amf_confchg_fn (
 	enum totem_configuration_type configuration_type,
-	unsigned int *member_list, int member_list_entries,
-	unsigned int *left_list, int left_list_entries,
-	unsigned int *joined_list, int joined_list_entries,
-	struct memb_ring_id *ring_id)
+	const unsigned int *member_list, size_t member_list_entries,
+	const unsigned int *left_list, size_t left_list_entries,
+	const unsigned int *joined_list, size_t joined_list_entries,
+	const struct memb_ring_id *ring_id)
 {
 	ENTER ();
 
Index: services/lck.c
===================================================================
--- services/lck.c	(revision 1778)
+++ services/lck.c	(working copy)
@@ -143,11 +143,11 @@
 static unsigned int my_lowest_nodeid = 0;
 
 static void message_handler_req_exec_lck_resourceopen (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_resourceclose (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_resourcelock (
@@ -155,27 +155,27 @@
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_resourceunlock (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_resourcelockorphan (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_lockpurge (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_sync_resource (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_sync_resource_lock (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_exec_lck_sync_resource_refcount (
-	void *message,
+	const void *message,
 	unsigned int nodeid);
 
 static void message_handler_req_lib_lck_resourceopen (
@@ -249,10 +249,10 @@
 
 static void lck_confchg_fn (
 	enum totem_configuration_type configuration_type,
-	unsigned int *member_list, int member_list_entries,
-	unsigned int *left_list, int left_list_entries,
-	unsigned int *joined_list, int joined_list_entries,
-	struct memb_ring_id *ring_id);
+	const unsigned int *member_list, size_t member_list_entries,
+	const unsigned int *left_list, size_t left_list_entries,
+	const unsigned int *joined_list, size_t joined_list_entries,
+	const struct memb_ring_id *ring_id);
 
 struct lck_pd {
 	struct list_head resource_list;
@@ -1005,10 +1005,10 @@
 
 static void lck_confchg_fn (
 	enum totem_configuration_type configuration_type,
-	unsigned int *member_list, int member_list_entries,
-	unsigned int *left_list, int left_list_entries,
-	unsigned int *joined_list, int joined_list_entries,
-	struct memb_ring_id *ring_id)
+	const unsigned int *member_list, size_t member_list_entries,
+	const unsigned int *left_list, size_t left_list_entries,
+	const unsigned int *joined_list, size_t joined_list_entries,
+	const struct memb_ring_id *ring_id)
 {
 	unsigned int i, j;
 
@@ -1048,7 +1048,7 @@
 
 static struct resource *lck_resource_find (
 	struct list_head *head,
-	mar_name_t *name)
+	const mar_name_t *name)
 {
 	struct list_head *resource_list;
 	struct resource *resource;
@@ -1068,7 +1068,7 @@
 
 static struct resource_lock *lck_resource_lock_find (
 	struct resource *resource,
-	mar_message_source_t *source,
+	const mar_message_source_t *source,
 	SaLckLockIdT lock_id)
 {
 	struct list_head *list;
@@ -1089,7 +1089,7 @@
 	return (0);
 }
 
-struct resource_cleanup *lck_resource_cleanup_find (
+static struct resource_cleanup *lck_resource_cleanup_find (
 	void *conn,
 	SaLckResourceHandleT resource_handle)
 {
@@ -1110,7 +1110,7 @@
 	return (0);
 }
 
-int lck_resource_close (mar_name_t *resource_name)
+static int lck_resource_close (const mar_name_t *resource_name)
 {
 	struct req_exec_lck_resourceclose req_exec_lck_resourceclose;
 	struct iovec iovec;
@@ -1130,7 +1130,7 @@
 	return (-1);
 }
 
-void resource_lock_orphan (struct resource_lock *resource_lock)
+static void resource_lock_orphan (struct resource_lock *resource_lock)
 {
 	struct req_exec_lck_resourcelockorphan req_exec_lck_resourcelockorphan;
 	struct iovec iovec;
@@ -1156,7 +1156,7 @@
 	assert (api->totem_mcast (&iovec, 1, TOTEM_AGREED) == 0);
 }
 
-void lck_resource_cleanup_lock_remove (
+static void lck_resource_cleanup_lock_remove (
 	struct resource_cleanup *resource_cleanup)
 {
 	struct list_head *list;
@@ -1188,7 +1188,7 @@
 
 }
 
-void lck_resource_cleanup_remove (
+static void lck_resource_cleanup_remove (
 	void *conn,
 	SaLckResourceHandleT resource_handle)
 {
@@ -1301,11 +1301,11 @@
 }
 
 static void message_handler_req_exec_lck_resourceopen (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_resourceopen *req_exec_lck_resourceopen =
-		(struct req_exec_lck_resourceopen *)message;
+	const struct req_exec_lck_resourceopen *req_exec_lck_resourceopen =
+		message;
 	struct res_lib_lck_resourceopen res_lib_lck_resourceopen;
 	struct res_lib_lck_resourceopenasync res_lib_lck_resourceopenasync;
 	struct resource *resource;
@@ -1417,11 +1417,11 @@
 }
 
 static void message_handler_req_exec_lck_resourceclose (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_resourceclose *req_exec_lck_resourceclose =
-		(struct req_exec_lck_resourceclose *)message;
+	const struct req_exec_lck_resourceclose *req_exec_lck_resourceclose =
+		message;
 	struct res_lib_lck_resourceclose res_lib_lck_resourceclose;
 	struct resource *resource = 0;
 	SaAisErrorT error = SA_AIS_OK;
@@ -1461,7 +1461,7 @@
 	}
 }
 
-void waiter_notification_send (struct resource_lock *resource_lock)
+static void waiter_notification_send (struct resource_lock *resource_lock)
 {
 	struct res_lib_lck_lockwaitercallback res_lib_lck_lockwaitercallback;
 
@@ -1488,7 +1488,7 @@
 		sizeof (struct res_lib_lck_lockwaitercallback));
 }
 
-void waiter_notification_list_send (struct list_head *list_notify_head)
+static void waiter_notification_list_send (struct list_head *list_notify_head)
 {
 	struct list_head *list;
 	struct resource_lock *resource_lock;
@@ -1502,8 +1502,8 @@
 	}
 }
 
-void resource_lock_async_deliver (
-	mar_message_source_t *source,
+static void resource_lock_async_deliver (
+	const mar_message_source_t *source,
 	struct resource_lock *resource_lock,
 	SaAisErrorT error)
 {
@@ -1527,8 +1527,8 @@
 	}
 }
 
-void lock_response_deliver (
-	mar_message_source_t *source,
+static void lock_response_deliver (
+	const mar_message_source_t *source,
 	struct resource_lock *resource_lock,
 	SaAisErrorT error)
 {
@@ -1555,7 +1555,7 @@
 /*
  * Queue a lock if resource flags allow it
  */
-void lock_queue (
+static void lock_queue (
 	struct resource *resource,
 	struct resource_lock *resource_lock)
 {
@@ -1594,7 +1594,7 @@
 		grant all pr pending locks to pr granted list
 */
 #define SA_LCK_LOCK_NO_STATUS 0
-void lock_algorithm (
+static void lock_algorithm (
 	struct resource *resource,
 	struct resource_lock *resource_lock)
 {
@@ -1640,7 +1640,7 @@
  *		if pr pending list has locks
  *			assign all pr pending locks to pr granted lock list
  */
-void unlock_algorithm (
+static void unlock_algorithm (
 	struct resource *resource,
 	struct resource_lock *resource_lock)
 {
@@ -1723,7 +1723,7 @@
 	unsigned int nodeid)
 {
 	struct req_exec_lck_resourcelock *req_exec_lck_resourcelock =
-		(struct req_exec_lck_resourcelock *)message;
+		message;
 	struct resource *resource = 0;
 	struct resource_lock *resource_lock = 0;
 	struct resource_cleanup *resource_cleanup = 0;
@@ -1835,11 +1835,11 @@
 }
 
 static void message_handler_req_exec_lck_resourceunlock (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_resourceunlock *req_exec_lck_resourceunlock =
-		(struct req_exec_lck_resourceunlock *)message;
+	const struct req_exec_lck_resourceunlock *req_exec_lck_resourceunlock =
+		message;
 	struct res_lib_lck_resourceunlock res_lib_lck_resourceunlock;
 	struct res_lib_lck_resourceunlockasync res_lib_lck_resourceunlockasync;
 	struct resource *resource = NULL;
@@ -1898,11 +1898,11 @@
 }
 
 static void message_handler_req_exec_lck_resourcelockorphan (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_resourcelockorphan *req_exec_lck_resourcelockorphan =
-		(struct req_exec_lck_resourcelockorphan *)message;
+	const struct req_exec_lck_resourcelockorphan *req_exec_lck_resourcelockorphan =
+		message;
 	struct resource *resource = 0;
 	struct resource_lock *resource_lock = 0;
 
@@ -1928,11 +1928,11 @@
 }
 
 static void message_handler_req_exec_lck_lockpurge (
-	void *msg,
+	const void *msg,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_lockpurge *req_exec_lck_lockpurge =
-		(struct req_exec_lck_lockpurge *)msg;
+	const struct req_exec_lck_lockpurge *req_exec_lck_lockpurge =
+		msg;
 	struct res_lib_lck_lockpurge res_lib_lck_lockpurge;
 	struct resource *resource = 0;
 	SaAisErrorT error = SA_AIS_OK;
@@ -1962,11 +1962,11 @@
 }
 
 static void message_handler_req_exec_lck_sync_resource (
-	void *msg,
+	const void *msg,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_sync_resource *req_exec_lck_sync_resource =
-		(struct req_exec_lck_sync_resource *)msg;
+	const struct req_exec_lck_sync_resource *req_exec_lck_sync_resource =
+		msg;
 	struct resource *resource;
 
 	log_printf (LOG_LEVEL_NOTICE, "EXEC request: sync resource %s\n",
@@ -2006,11 +2006,11 @@
 }
 
 static void message_handler_req_exec_lck_sync_resource_lock (
-	void *msg,
+	const void *msg,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_sync_resource_lock *req_exec_lck_sync_resource_lock =
-		(struct req_exec_lck_sync_resource_lock *)msg;
+	const struct req_exec_lck_sync_resource_lock *req_exec_lck_sync_resource_lock =
+		msg;
 	struct resource_lock *resource_lock;
 	struct resource *resource;
 
@@ -2080,11 +2080,11 @@
 }
 
 static void message_handler_req_exec_lck_sync_resource_refcount (
-	void *message,
+	const void *message,
 	unsigned int nodeid)
 {
-	struct req_exec_lck_sync_resource_refcount *req_exec_lck_sync_resource_refcount
-		= (struct req_exec_lck_sync_resource_refcount *)message;
+	const struct req_exec_lck_sync_resource_refcount *req_exec_lck_sync_resource_refcount
+		= message;
 	struct resource *resource;
 	unsigned int i, j;
 
_______________________________________________
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to