[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [RFCPATCH] port cluster stable3 to latest corosync API (untested)



Hi Ladies and Gents,

this is a preliminary patch to port cman/ccs and cpg users to the new
corosync API. It was mostly a mechanical work based on original Chrissie
patch for cman.

It is _untested_ and on top of:

corosync svn r2125
openais  svn r1847

The changes are mostly int -> size_t and add consts around.

You have to triple check everything I have done because some of the
const char *data get re-casted to something else and then modified
(in some cases I have seen endian conversions happening on the same
const buffer).

Also, we don't see build warning/errors by lack of int -> size_t
conversions. I might have missed some around even if i did try to catch
them all.

Everything builds without warning except some log_printf format
messages.

Let's try to get this sorted by mid next week.

Thanks
Fabio

PS I'll probably test the patch today and if i find issue, post updates
to it.
diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
index 1fbbc76..c40541b 100644
--- a/cman/daemon/ais.c
+++ b/cman/daemon/ais.c
@@ -16,7 +16,11 @@
 
 /* corosync headers */
 #include <corosync/corotypes.h>
-#include <corosync/ipc_gen.h>
+#include <corosync/corotypes.h>
+#include <corosync/coroipc_types.h>
+#include <corosync/coroipcc.h>
+#include <corosync/corodefs.h>
+#include <corosync/mar_gen.h>
 #include <corosync/engine/coroapi.h>
 #include <corosync/engine/logsys.h>
 #include <corosync/engine/quorum.h>
@@ -62,7 +66,7 @@ static struct corosync_tpg_group cman_group[1] = {
         { .group          = "CMAN", .group_len      = 4},
 };
 
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
 
 /* This structure is tacked onto the start of a cluster message packet for our
  * own nefarious purposes. */
@@ -82,11 +86,11 @@ struct cl_protheader {
 static int cman_exit_fn(void *conn_info);
 static int cman_exec_init_fn(struct corosync_api_v1 *api);
 static void cman_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);
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
+			    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 void cman_deliver_fn(unsigned int nodeid, const struct iovec *iovec, unsigned int iov_len,
 			    int endian_conversion_required);
 static void cman_quorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t report);
 
@@ -246,7 +250,7 @@ int comms_send_message(void *buf, int len,
 }
 
 // This assumes the iovec has only one element ... is it true ??
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
+static void cman_deliver_fn(unsigned int nodeid, const struct iovec *iovec, unsigned int iov_len,
 			    int endian_conversion_required)
 {
 	struct cl_protheader *header = iovec->iov_base;
@@ -272,15 +276,15 @@ static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_le
 }
 
 static void cman_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)
 {
 	int i;
 	static int last_memb_count = 0;
-	static int saved_left_list_entries;
-	static int saved_left_list_size;
+	static size_t saved_left_list_entries;
+	static size_t saved_left_list_size;
 	static unsigned int *saved_left_list = NULL;
 
 	P_AIS("confchg_fn called type = %d, seq=%lld\n", configuration_type, ring_id->seq);
@@ -303,7 +307,7 @@ static void cman_confchg_fn(enum totem_configuration_type configuration_type,
 			saved_left_list_size = left_list_entries*2;
 			saved_left_list = malloc(sizeof(int) * saved_left_list_size);
 			if (!saved_left_list) {
-				log_printf(LOG_LEVEL_CRIT, "cannot allocate memory for confchg message");
+				log_printf(LOGSYS_LEVEL_CRIT, "cannot allocate memory for confchg message");
 				exit(3);
 			}
 		}
@@ -311,7 +315,7 @@ static void cman_confchg_fn(enum totem_configuration_type configuration_type,
 			saved_left_list_size = left_list_entries*2;
 			saved_left_list = realloc(saved_left_list, sizeof(int) * saved_left_list_size);
 			if (!saved_left_list) {
-				log_printf(LOG_LEVEL_CRIT, "cannot reallocate memory for confchg message");
+				log_printf(LOGSYS_LEVEL_CRIT, "cannot reallocate memory for confchg message");
 				exit(3);
 			}
 		}
diff --git a/cman/daemon/barrier.c b/cman/daemon/barrier.c
index 54df19a..1f414aa 100644
--- a/cman/daemon/barrier.c
+++ b/cman/daemon/barrier.c
@@ -16,7 +16,11 @@
 #include <netinet/in.h>
 #include <sys/errno.h>
 
-#include <corosync/ipc_gen.h>
+#include <corosync/corotypes.h>
+#include <corosync/coroipc_types.h>
+#include <corosync/coroipcc.h>
+#include <corosync/corodefs.h>
+#include <corosync/mar_gen.h>
 #include <corosync/engine/coroapi.h>
 #include <corosync/engine/logsys.h>
 #include "list.h"
@@ -31,7 +35,7 @@
 
 extern int we_are_a_cluster_member;
 
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
 
 /* A barrier */
 struct cl_barrier {
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index a7bf92f..5af4437 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -398,7 +398,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 		return -1;
 
 	for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
-		socklen_t salen;
+		socklen_t salen = 0;
 
 		/* Restore this */
 		strcpy(nodename2, nodename);
@@ -964,11 +964,11 @@ static int copy_config_tree(struct objdb_iface_ver0 *objdb, hdb_handle_t source_
 	hdb_handle_t new_object;
 	hdb_handle_t find_handle;
 	char object_name[1024];
-	int object_name_len;
+	size_t object_name_len;
 	void *key_name;
-	int key_name_len;
+	size_t key_name_len;
 	void *key_value;
-	int key_value_len;
+	size_t key_value_len;
 	int res;
 
 	/* Create new parent object if necessary */
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index eac221a..ed2dd90 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -7,7 +7,11 @@
 #include <errno.h>
 #include <netdb.h>
 
-#include <corosync/ipc_gen.h>
+#include <corosync/corotypes.h>
+#include <corosync/coroipc_types.h>
+#include <corosync/coroipcc.h>
+#include <corosync/corodefs.h>
+#include <corosync/mar_gen.h>
 #include <corosync/engine/coroapi.h>
 #include <corosync/engine/logsys.h>
 
@@ -22,7 +26,7 @@
 #include "nodelist.h"
 #include "ais.h"
 
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
 
 /* Local vars - things we get from ccs */
        int two_node;
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index ac8d33e..0fe66af 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -20,7 +20,11 @@
 #include <sys/errno.h>
 #include <dlfcn.h>
 
-#include <corosync/ipc_gen.h>
+#include <corosync/corotypes.h>
+#include <corosync/coroipc_types.h>
+#include <corosync/coroipcc.h>
+#include <corosync/corodefs.h>
+#include <corosync/mar_gen.h>
 #include <corosync/engine/coroapi.h>
 #include <corosync/engine/logsys.h>
 #include "list.h"
@@ -37,7 +41,7 @@
 #include "ais.h"
 
 #define max(a,b) (((a) > (b)) ? (a) : (b))
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
 
 /* Reference counting for cluster applications */
 static int use_count;
@@ -1143,7 +1147,7 @@ static int do_cmd_unregister_quorum_device(char *cmdbuf, int *retlen)
 static int reread_config(int new_version)
 {
 	int read_err;
-	char *reload_err = NULL;
+	const char *reload_err = NULL;
 
 	wanted_config_version = new_version;
 
@@ -1530,9 +1534,9 @@ int send_to_userport(unsigned char fromport, unsigned char toport,
 	return ret;
 }
 
-void cman_send_confchg(unsigned int *member_list, int member_list_entries,
-		       unsigned int *left_list, int left_list_entries,
-		       unsigned int *joined_list, int joined_list_entries)
+void cman_send_confchg(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)
 {
 	char buf[sizeof(struct sock_confchg_message) +
 		 (member_list_entries+left_list_entries+joined_list_entries) * sizeof(int)];
diff --git a/cman/daemon/commands.h b/cman/daemon/commands.h
index 5d325ad..7b51309 100644
--- a/cman/daemon/commands.h
+++ b/cman/daemon/commands.h
@@ -18,9 +18,9 @@ extern void add_ais_node(int nodeid, uint64_t incarnation, int total_members);
 extern void del_ais_node(int nodeid);
 extern void add_ccs_node(char *name, int nodeid, int votes, int expected_votes);
 extern void override_expected(int expected);
-extern void cman_send_confchg(unsigned int *member_list, int member_list_entries,
-			      unsigned int *left_list, int left_list_entries,
-			      unsigned int *joined_list, int joined_list_entries);
+extern void cman_send_confchg(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);
 
 
 extern void clear_reread_flags(void);
diff --git a/cman/daemon/daemon.c b/cman/daemon/daemon.c
index 1de5964..c67ea21 100644
--- a/cman/daemon/daemon.c
+++ b/cman/daemon/daemon.c
@@ -17,7 +17,11 @@
 #include <netinet/in.h>
 #include <sys/errno.h>
 
-#include <corosync/ipc_gen.h>
+#include <corosync/corotypes.h>
+#include <corosync/coroipc_types.h>
+#include <corosync/coroipcc.h>
+#include <corosync/corodefs.h>
+#include <corosync/mar_gen.h>
 #include <corosync/engine/coroapi.h>
 #include <corosync/engine/logsys.h>
 #include <corosync/totem/coropoll.h>
@@ -32,7 +36,7 @@
 #include "ais.h"
 #include "cman.h"
 
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
 
 struct queued_reply
 {
diff --git a/cman/daemon/logging.c b/cman/daemon/logging.c
index c18e40f..e81dcec 100644
--- a/cman/daemon/logging.c
+++ b/cman/daemon/logging.c
@@ -15,15 +15,15 @@
 #include "cnxman-private.h"
 #include "logging.h"
 
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
+LOGSYS_DECLARE_SUBSYS (CMAN_NAME);
 
 int subsys_mask = 0;
 
 void set_debuglog(int subsystems)
 {
 	if (subsystems)
-		logsys_config_subsys_set(CMAN_NAME, 0, LOG_LEVEL_DEBUG);
+		logsys_config_mode_set(CMAN_NAME, LOGSYS_LEVEL_DEBUG);
 	else
-		logsys_config_subsys_set(CMAN_NAME, 0, LOG_LEVEL_INFO);
+		logsys_config_mode_set(CMAN_NAME, LOGSYS_LEVEL_INFO);
 	subsys_mask = subsystems;
 }
diff --git a/cman/daemon/logging.h b/cman/daemon/logging.h
index 23ecb90..f9ca506 100644
--- a/cman/daemon/logging.h
+++ b/cman/daemon/logging.h
@@ -11,7 +11,7 @@ extern void set_debuglog(int subsystems);
 
 extern int subsys_mask;
 
-#define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(LOG_LEVEL_DEBUG, "barrier: " fmt, ## args)
-#define P_MEMB(fmt, args...)    if (subsys_mask & CMAN_DEBUG_MEMB) log_printf(LOG_LEVEL_DEBUG, "memb: " fmt, ## args)
-#define P_DAEMON(fmt, args...)  if (subsys_mask & CMAN_DEBUG_DAEMON) log_printf(LOG_LEVEL_DEBUG , "daemon: " fmt, ## args)
-#define P_AIS(fmt, args...)     if (subsys_mask & CMAN_DEBUG_AIS) log_printf(LOG_LEVEL_DEBUG, "ais " fmt, ## args)
+#define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(LOGSYS_LEVEL_DEBUG, "barrier: " fmt, ## args)
+#define P_MEMB(fmt, args...)    if (subsys_mask & CMAN_DEBUG_MEMB) log_printf(LOGSYS_LEVEL_DEBUG, "memb: " fmt, ## args)
+#define P_DAEMON(fmt, args...)  if (subsys_mask & CMAN_DEBUG_DAEMON) log_printf(LOGSYS_LEVEL_DEBUG , "daemon: " fmt, ## args)
+#define P_AIS(fmt, args...)     if (subsys_mask & CMAN_DEBUG_AIS) log_printf(LOGSYS_LEVEL_DEBUG, "ais " fmt, ## args)
diff --git a/config/libs/libccsconfdb/fullxpath.c b/config/libs/libccsconfdb/fullxpath.c
index 7d9a86e..994c8d8 100644
--- a/config/libs/libccsconfdb/fullxpath.c
+++ b/config/libs/libccsconfdb/fullxpath.c
@@ -51,11 +51,9 @@ static int dump_objdb_buff(confdb_handle_t dump_handle, hdb_handle_t cluster_han
 	hdb_handle_t object_handle;
 	char temp[PATH_MAX];
 	char object_name[PATH_MAX];
-	int object_name_len;
 	char key_name[PATH_MAX];
-	int key_name_len;
 	char key_value[PATH_MAX];
-	int key_value_len;
+	size_t key_value_len = 0, key_name_len = 0, object_name_len = 0;
 	int res;
 
 	res = confdb_key_iter_start(dump_handle, parent_object_handle);
diff --git a/config/libs/libccsconfdb/libccs.c b/config/libs/libccsconfdb/libccs.c
index c24bead..05d08c3 100644
--- a/config/libs/libccsconfdb/libccs.c
+++ b/config/libs/libccsconfdb/libccs.c
@@ -60,9 +60,10 @@ static hdb_handle_t find_libccs_handle(confdb_handle_t handle)
 
 static hdb_handle_t find_ccs_handle(confdb_handle_t handle, int ccs_handle)
 {
-	int res, datalen = 0, found = 0;
+	int res, found = 0;
 	hdb_handle_t libccs_handle = 0, connection_handle = 0;
 	char data[128];
+	size_t datalen = 0;
 
 	libccs_handle = find_libccs_handle(handle);
 	if (libccs_handle == -1)
@@ -113,7 +114,7 @@ static int get_running_config_version(confdb_handle_t handle, int *config_versio
 {
 	hdb_handle_t cluster_handle;
 	char data[128];
-	int datalen = 0;
+	size_t datalen = 0;
 	int ret = -1;
 
 	if (confdb_object_find_start(handle, OBJECT_PARENT_HANDLE) != CS_OK) {
@@ -145,7 +146,7 @@ static int get_stored_config_version(confdb_handle_t handle,
 				     hdb_handle_t connection_handle, int *config_version)
 {
 	char data[128];
-	int datalen = 0;
+	size_t datalen = 0;
 	int ret = -1;
 
 	if (confdb_key_get
@@ -165,7 +166,7 @@ static int set_stored_config_version(confdb_handle_t handle,
 			      hdb_handle_t connection_handle, int new_version)
 {
 	char temp[PATH_MAX];
-	int templen = 0;
+	size_t templen = 0;
 	char data[128];
 
 	memset(data, 0, sizeof(data));
@@ -303,7 +304,7 @@ static hdb_handle_t get_ccs_handle(confdb_handle_t handle, int *ccs_handle,
 int get_previous_query(confdb_handle_t handle, hdb_handle_t connection_handle,
 		       char *previous_query, hdb_handle_t *query_handle)
 {
-	int datalen;
+	size_t datalen = 0;
 
 	if (confdb_key_get
 	    (handle, connection_handle, "previous_query",
@@ -323,7 +324,7 @@ int set_previous_query(confdb_handle_t handle, hdb_handle_t connection_handle,
 		       char *previous_query, hdb_handle_t query_handle)
 {
 	char temp[PATH_MAX];
-	int templen;
+	size_t templen = 0;
 	unsigned int temphandle;
 
 	if (confdb_key_get
@@ -409,7 +410,8 @@ static int check_cluster_name(int ccs_handle, const char *cluster_name)
 	confdb_handle_t handle = 0;
 	hdb_handle_t cluster_handle;
 	char data[128];
-	int found = 0, datalen = 0;
+	int found = 0;
+	size_t datalen = 0;
 
 	handle = confdb_connect();
 	if (handle < 0)
@@ -464,7 +466,7 @@ static int _ccs_get(int desc, const char *query, char **rtn, int list)
 	confdb_handle_t handle = 0;
 	hdb_handle_t connection_handle = 0;
 	char data[128];
-	int datalen = 0;
+	size_t datalen = 0;
 	int fullxpathint = 0;
 
 	*rtn = NULL;
@@ -580,7 +582,7 @@ int ccs_disconnect(int desc)
 	hdb_handle_t connection_handle = 0;
 	int ret;
 	char data[128];
-	int datalen = 0;
+	size_t datalen = 0;
 	int fullxpathint = 0;
 
 	handle = confdb_connect();
diff --git a/config/libs/libccsconfdb/xpathlite.c b/config/libs/libccsconfdb/xpathlite.c
index 855a323..0c3a46d 100644
--- a/config/libs/libccsconfdb/xpathlite.c
+++ b/config/libs/libccsconfdb/xpathlite.c
@@ -89,7 +89,7 @@ static int path_dive(confdb_handle_t handle, hdb_handle_t *query_handle,
 
 			char *start = NULL, *middle = NULL, *end = NULL;
 			char data[PATH_MAX];
-			int datalen;
+			size_t datalen = 0;
 
 			/*
 			 * those ones should be always good because
@@ -222,13 +222,13 @@ static int get_data(confdb_handle_t handle, hdb_handle_t connection_handle,
 		    hdb_handle_t query_handle, hdb_handle_t *list_handle,
 		    char **rtn, char *curpos, int list, int is_oldlist)
 {
-	int datalen, cmp;
+	int cmp;
 	char data[PATH_MAX];
 	char resval[PATH_MAX];
 	char keyval[PATH_MAX];
-	int keyvallen = PATH_MAX;
 	hdb_handle_t new_obj_handle;
 	unsigned int value = 0;
+	size_t datalen = 0, keyvallen = PATH_MAX;
 
 	memset(data, 0, PATH_MAX);
 	memset(resval, 0, PATH_MAX);
diff --git a/config/tools/ldap/confdb2ldif.c b/config/tools/ldap/confdb2ldif.c
index e57f32e..115bcaf 100644
--- a/config/tools/ldap/confdb2ldif.c
+++ b/config/tools/ldap/confdb2ldif.c
@@ -59,11 +59,11 @@ static void print_config_tree(confdb_handle_t handle, hdb_handle_t parent_object
 {
 	hdb_handle_t object_handle;
 	char object_name[1024];
-	int object_name_len;
+	size_t object_name_len;
 	char key_name[1024];
-	int key_name_len;
+	size_t key_name_len;
 	char key_value[1024];
-	int key_value_len;
+	size_t key_value_len;
 	char cumulative_dn[4096];
 	int res;
 	int i;
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 5d6aa96..dbc5a67 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -1079,9 +1079,12 @@ void process_fd_changes(void)
 }
 
 static int add_change(struct fd *fd,
-		      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_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,
 		      struct change **cg_out)
 {
 	struct change *cg;
@@ -1195,7 +1198,7 @@ static void add_victims_init(struct fd *fd, struct change *cg)
 	}
 }
 
-static int we_left(struct cpg_address *left_list, int left_list_entries)
+static int we_left(const struct cpg_address *left_list, size_t left_list_entries)
 {
 	int i;
 
@@ -1206,10 +1209,14 @@ static int we_left(struct cpg_address *left_list, int left_list_entries)
 	return 0;
 }
 
-static void confchg_cb(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)
+static void confchg_cb(cpg_handle_t handle,
+		       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)
 {
 	struct fd *fd;
 	struct change *cg;
@@ -1267,8 +1274,10 @@ static void fd_header_in(struct fd_header *hd)
 	hd->msgdata     = le32_to_cpu(hd->msgdata);
 }
 
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       uint32_t nodeid, uint32_t pid, void *data, int len)
+static void deliver_cb(cpg_handle_t handle,
+		       const struct cpg_name *group_name,
+		       uint32_t nodeid, uint32_t pid,
+		       const void *data, size_t len)
 {
 	struct fd *fd;
 	struct fd_header *hd;
@@ -1742,8 +1751,10 @@ int set_protocol(void)
    kernel state and they can skip fencing us if we're a victim.  (We have
    to check for that uncontrolled state before calling setup_cpg, obviously.) */
 
-static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int len)
+static void deliver_cb_daemon(cpg_handle_t handle,
+			      const struct cpg_name *group_name,
+			      uint32_t nodeid, uint32_t pid,
+			      const void *data, size_t len)
 {
 	struct fd_header *hd;
 
@@ -1764,10 +1775,14 @@ static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
 	}
 }
 
-static void confchg_cb_daemon(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)
+static void confchg_cb_daemon(cpg_handle_t handle,
+			      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)
 {
 	int i;
 
diff --git a/group/daemon/cpg.c b/group/daemon/cpg.c
index 43c8ddd..56e71ab 100644
--- a/group/daemon/cpg.c
+++ b/group/daemon/cpg.c
@@ -609,8 +609,10 @@ group_t *find_group_by_handle(cpg_handle_t h)
 	return NULL;
 }
 
-void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int data_len)
+void deliver_cb(cpg_handle_t handle,
+		const struct cpg_name *group_name,
+		uint32_t nodeid, uint32_t pid,
+		const void *data, size_t data_len)
 {
 	group_t *g;
 	struct save_msg *save;
@@ -742,10 +744,14 @@ void process_confchg(void)
 	}
 }
 
-void confchg_cb(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)
+void confchg_cb(cpg_handle_t handle,
+	        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)
 {
 	group_t *g;
 	char *name = "unknown";
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index 1231ec9..5e0a252 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -1175,9 +1175,12 @@ void process_lockspace_changes(void)
 }
 
 static int add_change(struct lockspace *ls,
-		      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_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,
 		      struct change **cg_out)
 {
 	struct change *cg;
@@ -1274,7 +1277,7 @@ static int add_change(struct lockspace *ls,
 	return error;
 }
 
-static int we_left(struct cpg_address *left_list, int left_list_entries)
+static int we_left(const struct cpg_address *left_list, size_t left_list_entries)
 {
 	int i;
 
@@ -1285,10 +1288,14 @@ static int we_left(struct cpg_address *left_list, int left_list_entries)
 	return 0;
 }
 
-static void confchg_cb(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)
+static void confchg_cb(cpg_handle_t handle,
+		       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)
 {
 	struct lockspace *ls;
 	struct change *cg;
@@ -1349,8 +1356,10 @@ static void dlm_header_in(struct dlm_header *hd)
 	hd->msgdata     = le32_to_cpu(hd->msgdata);
 }
 
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       uint32_t nodeid, uint32_t pid, void *data, int len)
+static void deliver_cb(cpg_handle_t handle,
+		       const struct cpg_name *group_name,
+		       uint32_t nodeid, uint32_t pid,
+		       const void *data, size_t len)
 {
 	struct lockspace *ls;
 	struct dlm_header *hd;
@@ -1945,8 +1954,10 @@ int set_protocol(void)
 	return 0;
 }
 
-static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int len)
+static void deliver_cb_daemon(cpg_handle_t handle,
+			      const struct cpg_name *group_name,
+			      uint32_t nodeid, uint32_t pid,
+			      const void *data, size_t len)
 {
 	struct dlm_header *hd;
 
@@ -1967,10 +1978,14 @@ static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
 	}
 }
 
-static void confchg_cb_daemon(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)
+static void confchg_cb_daemon(cpg_handle_t handle,
+			      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)
 {
 	int i;
 
diff --git a/group/dlm_controld/deadlock.c b/group/dlm_controld/deadlock.c
index 4d93420..05b2241 100644
--- a/group/dlm_controld/deadlock.c
+++ b/group/dlm_controld/deadlock.c
@@ -1076,9 +1076,9 @@ static void node_left(struct lockspace *ls, int nodeid, int reason)
 static void purge_locks(struct lockspace *ls, int nodeid);
 
 void deadlk_confchg(struct lockspace *ls,
-		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_address *member_list, int member_list_entries,
+		const struct cpg_address *left_list, int left_list_entries,
+		const struct cpg_address *joined_list, int joined_list_entries)
 {
 	int i;
 
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index 60c48cd..8933db7 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -257,9 +257,9 @@ void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len);
 void receive_cycle_end(struct lockspace *ls, struct dlm_header *hd, int len);
 void receive_cancel_lock(struct lockspace *ls, struct dlm_header *hd, int len);
 void deadlk_confchg(struct lockspace *ls,
-	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_address *member_list, int member_list_entries,
+	const struct cpg_address *left_list, int left_list_entries,
+	const struct cpg_address *joined_list, int joined_list_entries);
 
 
 /* main.c */
diff --git a/group/gfs_controld/cpg-new.c b/group/gfs_controld/cpg-new.c
index f15e3e5..94e22d9 100644
--- a/group/gfs_controld/cpg-new.c
+++ b/group/gfs_controld/cpg-new.c
@@ -2329,9 +2329,12 @@ void process_mountgroups(void)
 }
 
 static int add_change(struct mountgroup *mg,
-		      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_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,
 		      struct change **cg_out)
 {
 	struct change *cg;
@@ -2429,7 +2432,7 @@ static int add_change(struct mountgroup *mg,
 	return error;
 }
 
-static int we_left(struct cpg_address *left_list, int left_list_entries)
+static int we_left(const struct cpg_address *left_list, size_t left_list_entries)
 {
 	int i;
 
@@ -2440,10 +2443,14 @@ static int we_left(struct cpg_address *left_list, int left_list_entries)
 	return 0;
 }
 
-static void confchg_cb(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)
+static void confchg_cb(cpg_handle_t handle,
+		       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)
 {
 	struct mountgroup *mg;
 	struct change *cg;
@@ -2522,8 +2529,10 @@ static int gfs_header_check(struct gfs_header *hd, int nodeid)
 	return 0;
 }
 
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       uint32_t nodeid, uint32_t pid, void *data, int len)
+static void deliver_cb(cpg_handle_t handle,
+		       const struct cpg_name *group_name,
+		       uint32_t nodeid, uint32_t pid,
+		       const void *data, size_t len)
 {
 	struct mountgroup *mg;
 	struct gfs_header *hd;
@@ -3133,8 +3142,10 @@ int set_protocol(void)
 	return 0;
 }
 
-static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int len)
+static void deliver_cb_daemon(cpg_handle_t handle,
+			      const struct cpg_name *group_name,
+			      uint32_t nodeid, uint32_t pid,
+			      const void *data, size_t len)
 {
 	struct gfs_header *hd;
 
@@ -3160,10 +3171,14 @@ static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
 	}
 }
 
-static void confchg_cb_daemon(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)
+static void confchg_cb_daemon(cpg_handle_t handle,
+			      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)
 {
 	int i;
 
diff --git a/group/gfs_controld/cpg-old.c b/group/gfs_controld/cpg-old.c
index 6daaa9a..20b4cd3 100644
--- a/group/gfs_controld/cpg-old.c
+++ b/group/gfs_controld/cpg-old.c
@@ -168,7 +168,7 @@ static void notify_mount_client(struct mountgroup *mg)
 /* we can receive recovery_status messages from other nodes doing start before
    we actually process the corresponding start callback ourselves */
 
-void save_message_old(struct mountgroup *mg, char *buf, int len, int from,
+void save_message_old(struct mountgroup *mg, const char *buf, size_t len, int from,
 		      int type)
 {
 	struct save_msg *sm;
@@ -250,7 +250,7 @@ void send_withdraw_old(struct mountgroup *mg)
 	free(buf);
 }
 
-static void receive_withdraw(struct mountgroup *mg, char *buf, int len, int from)
+static void receive_withdraw(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct mg_member *memb;
 
@@ -316,7 +316,7 @@ static void send_recovery_status(struct mountgroup *mg)
    the journal for a failed node.  The first has really recovered it,
    the rest have found the fs clean and report success. */
 
-static void _receive_recovery_status(struct mountgroup *mg, char *buf, int len,
+static void _receive_recovery_status(struct mountgroup *mg, const char *buf, size_t len,
 			      int from)
 {
 	struct mg_member *memb;
@@ -437,7 +437,7 @@ void send_mount_status_old(struct mountgroup *mg)
 	free(buf);
 }
 
-static void _receive_mount_status(struct mountgroup *mg, char *buf, int len,
+static void _receive_mount_status(struct mountgroup *mg, const char *buf, size_t len,
 				  int from)
 {
 	struct mg_member *memb, *us;
@@ -503,7 +503,7 @@ static void _receive_mount_status(struct mountgroup *mg, char *buf, int len,
 	}
 }
 
-static void receive_mount_status(struct mountgroup *mg, char *buf, int len,
+static void receive_mount_status(struct mountgroup *mg, const char *buf, size_t len,
 				 int from)
 {
 	log_group(mg, "receive_mount_status from %d len %d last_cb %d",
@@ -546,7 +546,7 @@ static void process_saved_mount_status(struct mountgroup *mg)
 	}
 }
 
-static void receive_recovery_status(struct mountgroup *mg, char *buf, int len,
+static void receive_recovery_status(struct mountgroup *mg, const char *buf, size_t len,
 			     int from)
 {
 	switch (mg->last_callback) {
@@ -588,7 +588,7 @@ static void send_recovery_done(struct mountgroup *mg)
 	free(buf);
 }
 
-static void receive_recovery_done(struct mountgroup *mg, char *buf, int len,
+static void receive_recovery_done(struct mountgroup *mg, const char *buf, size_t len,
 				  int from)
 {
 	struct mg_member *memb, *safe;
@@ -637,7 +637,7 @@ void send_remount_old(struct mountgroup *mg, struct gfsc_mount_args *ma)
 	free(buf);
 }
 
-static void receive_remount(struct mountgroup *mg, char *buf, int len, int from)
+static void receive_remount(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct mg_member *memb;
 	char *options;
@@ -879,7 +879,7 @@ static int assign_journal(struct mountgroup *mg, struct mg_member *new)
 	return 0;
 }
 
-static void _receive_options(struct mountgroup *mg, char *buf, int len,
+static void _receive_options(struct mountgroup *mg, const char *buf, size_t len,
 			     int from)
 {
 	struct mg_member *memb;
@@ -912,7 +912,7 @@ static void _receive_options(struct mountgroup *mg, char *buf, int len,
 	assign_journal(mg, memb);
 }
 
-static void receive_options(struct mountgroup *mg, char *buf, int len, int from)
+static void receive_options(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct gdlm_header *hd = (struct gdlm_header *)buf;
 	struct mg_member *memb;
@@ -1046,7 +1046,7 @@ static void received_our_jid(struct mountgroup *mg)
 	notify_mount_client(mg);
 }
 
-static void _receive_journals(struct mountgroup *mg, char *buf, int len,
+static void _receive_journals(struct mountgroup *mg, const char *buf, size_t len,
 			      int from)
 {
 	struct mg_member *memb, *memb2;
@@ -1114,7 +1114,7 @@ static void _receive_journals(struct mountgroup *mg, char *buf, int len,
 	received_our_jid(mg);
 }
 
-static void receive_journals(struct mountgroup *mg, char *buf, int len,
+static void receive_journals(struct mountgroup *mg, const char *buf, size_t len,
 			     int from)
 {
 	struct gdlm_header *hd = (struct gdlm_header *)buf;
@@ -2229,11 +2229,12 @@ int do_terminate(struct mountgroup *mg)
 	return 0;
 }
 
-static void do_deliver(int nodeid, char *data, int len)
+static void do_deliver(int nodeid, const char *data, size_t len)
 {
 	struct mountgroup *mg;
 	struct gdlm_header *hd;
 
+	/* FIXME: data is supposed to be const. recasting here voids the const */
 	hd = (struct gdlm_header *) data;
 
 	mg = find_mg(hd->name);
@@ -2325,8 +2326,10 @@ static void do_deliver(int nodeid, char *data, int len)
 	}
 }
 
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int data_len)
+static void deliver_cb(cpg_handle_t handle,
+		       const struct cpg_name *group_name,
+		       uint32_t nodeid, uint32_t pid,
+		       const void *data, size_t data_len)
 {
 	do_deliver(nodeid, data, data_len);
 }
@@ -2336,10 +2339,14 @@ static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
    Is it possible for a node to have been cleared from the members_gone list
    before this confchg is processed? */
 
-static void confchg_cb(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)
+static void confchg_cb(cpg_handle_t handle,
+		       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)
 {
 	struct mountgroup *mg;
 	int i, nodeid;
diff --git a/group/gfs_controld/gfs_daemon.h b/group/gfs_controld/gfs_daemon.h
index c4dc2be..6ec4609 100644
--- a/group/gfs_controld/gfs_daemon.h
+++ b/group/gfs_controld/gfs_daemon.h
@@ -248,7 +248,7 @@ void process_cpg_old(int ci);
 int gfs_join_mountgroup_old(struct mountgroup *mg, struct gfsc_mount_args *ma);
 void do_leave_old(char *name, int mnterr);
 int send_group_message_old(struct mountgroup *mg, int len, char *buf);
-void save_message_old(struct mountgroup *mg, char *buf, int len, int from,
+void save_message_old(struct mountgroup *mg, const char *buf, size_t len, int from,
 	int type);
 void send_withdraw_old(struct mountgroup *mg);
 int process_recovery_uevent_old(char *name, int jid, int status, int first);
@@ -303,10 +303,10 @@ int setup_plocks(void);
 void close_plocks(void);
 void process_plocks(int ci);
 int limit_plocks(void);
-void receive_plock(struct mountgroup *mg, char *buf, int len, int from);
-void receive_own(struct mountgroup *mg, char *buf, int len, int from);
-void receive_sync(struct mountgroup *mg, char *buf, int len, int from);
-void receive_drop(struct mountgroup *mg, char *buf, int len, int from);
+void receive_plock(struct mountgroup *mg, const char *buf, size_t len, int from);
+void receive_own(struct mountgroup *mg, const char *buf, size_t len, int from);
+void receive_sync(struct mountgroup *mg, const char *buf, size_t len, int from);
+void receive_drop(struct mountgroup *mg, const char *buf, size_t len, int from);
 void process_saved_plocks(struct mountgroup *mg);
 int unlink_checkpoint(struct mountgroup *mg);
 void store_plocks(struct mountgroup *mg, int nodeid);
diff --git a/group/gfs_controld/plock.c b/group/gfs_controld/plock.c
index 1cff9c4..00bf21d 100644
--- a/group/gfs_controld/plock.c
+++ b/group/gfs_controld/plock.c
@@ -739,7 +739,7 @@ static void __receive_plock(struct mountgroup *mg, struct dlm_plock_info *in,
    set save_plocks (when we see our options message) can be ignored because it
    should be reflected in the checkpointed state. */
 
-static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from)
+static void _receive_plock(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct dlm_plock_info info;
 	struct gdlm_header *hd = (struct gdlm_header *) buf;
@@ -859,7 +859,7 @@ static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from)
 	}
 }
 
-void receive_plock(struct mountgroup *mg, char *buf, int len, int from)
+void receive_plock(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	if (mg->save_plocks) {
 		save_message_old(mg, buf, len, from, MSG_PLOCK);
@@ -1025,7 +1025,7 @@ static void send_pending_plocks(struct mountgroup *mg, struct resource *r)
 	}
 }
 
-static void _receive_own(struct mountgroup *mg, char *buf, int len, int from)
+static void _receive_own(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct gdlm_header *hd = (struct gdlm_header *) buf;
 	struct dlm_plock_info info;
@@ -1145,7 +1145,7 @@ static void _receive_own(struct mountgroup *mg, char *buf, int len, int from)
 	}
 }
 
-void receive_own(struct mountgroup *mg, char *buf, int len, int from)
+void receive_own(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	if (mg->save_plocks) {
 		save_message_old(mg, buf, len, from, MSG_PLOCK_OWN);
@@ -1192,7 +1192,7 @@ static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
 		  in->nodeid, in->pid, (unsigned long long)in->owner);
 }
 
-static void _receive_sync(struct mountgroup *mg, char *buf, int len, int from)
+static void _receive_sync(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct dlm_plock_info info;
 	struct gdlm_header *hd = (struct gdlm_header *) buf;
@@ -1226,7 +1226,7 @@ static void _receive_sync(struct mountgroup *mg, char *buf, int len, int from)
 		add_waiter(mg, r, &info);
 }
 
-void receive_sync(struct mountgroup *mg, char *buf, int len, int from)
+void receive_sync(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct gdlm_header *hd = (struct gdlm_header *) buf;
 
@@ -1238,7 +1238,7 @@ void receive_sync(struct mountgroup *mg, char *buf, int len, int from)
 	_receive_sync(mg, buf, len, from);
 }
 
-static void _receive_drop(struct mountgroup *mg, char *buf, int len, int from)
+static void _receive_drop(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	struct dlm_plock_info info;
 	struct resource *r;
@@ -1289,7 +1289,7 @@ static void _receive_drop(struct mountgroup *mg, char *buf, int len, int from)
 	}
 }
 
-void receive_drop(struct mountgroup *mg, char *buf, int len, int from)
+void receive_drop(struct mountgroup *mg, const char *buf, size_t len, int from)
 {
 	if (mg->save_plocks) {
 		save_message_old(mg, buf, len, from, MSG_PLOCK_DROP);

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]