Selaa lähdekoodia

Bug 1130: add totempg log; remove warnings; add DPRINT macro

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@954 fd59a12c-fef9-0310-b244-a6a79926bd2f
Fabien Thomas 20 vuotta sitten
vanhempi
commit
064ffb17a1
38 muutettua tiedostoa jossa 185 lisäystä ja 165 poistoa
  1. 1 1
      Makefile.inc
  2. 3 4
      exec/Makefile
  3. 1 1
      exec/aispoll.c
  4. 15 17
      exec/amf.c
  5. 1 1
      exec/amfconfig.c
  6. 12 12
      exec/amfconfig.h
  7. 1 1
      exec/cfg.c
  8. 8 21
      exec/ckpt.c
  9. 3 4
      exec/clm.c
  10. 1 1
      exec/cpg.c
  11. 1 1
      exec/evs.c
  12. 2 2
      exec/evt.c
  13. 1 1
      exec/keygen.c
  14. 2 2
      exec/lck.c
  15. 0 2
      exec/main.c
  16. 19 1
      exec/msg.c
  17. 2 0
      exec/print.c
  18. 1 0
      exec/totem.h
  19. 1 1
      exec/totemconfig.c
  20. 0 3
      exec/totemip.c
  21. 4 4
      exec/totemnet.c
  22. 24 12
      exec/totempg.c
  23. 34 28
      exec/totemsrp.c
  24. 0 5
      exec/totemsrp.h
  25. 0 4
      exec/ykd.c
  26. 8 4
      lcr/lcr_ifact.c
  27. 2 2
      lcr/libtest_a.c
  28. 2 2
      lcr/libtest_b.c
  29. 4 4
      lcr/test.c
  30. 4 3
      lib/amf.c
  31. 1 2
      lib/clm.c
  32. 7 10
      lib/evt.c
  33. 2 2
      lib/lck.c
  34. 8 0
      lib/util.h
  35. 1 1
      test/ckptbench.c
  36. 5 3
      test/testamf1.c
  37. 2 2
      test/testckpt.c
  38. 2 1
      test/testcpg.c

+ 1 - 1
Makefile.inc

@@ -62,7 +62,7 @@ endif
 	LDFLAGS += 
 endif
 ifeq (${OPENAIS_BUILD}, DEBUG) 
-	CFLAGS += -O0 -g -Wall
+	CFLAGS += -O0 -g -Wall -DDEBUG 
 	LDFLAGS += -g
 endif
 

+ 3 - 4
exec/Makefile

@@ -109,7 +109,8 @@ service_cpg.lcrso: cpg.o
 	$(CC) -bundle -bundle_loader ./aisexec -bind_at_load cpg.o -o $@
 
 objdb.lcrso: objdb.o
-	$(CC) -bundle -bundle_loader ./aisexec -bind_at_looad objdb.o -o $@
+	$(CC) -bundle -bundle_loader ./aisexec -bind_at_load objdb.o -o $@
+
 else
 
 service_evs.lcrso: evs.o
@@ -142,11 +143,9 @@ service_cpg.lcrso: cpg.o
 objdb.lcrso: objdb.o
 	$(CC) -shared -Wl,-soname,objdb.lcrso objdb.o -o $@
 
-aisexec: $(EXEC_OBJS) libtotem_pg.a
-
 endif
 
-
+aisexec: $(EXEC_OBJS) libtotem_pg.a
 	$(CC) $(LDFLAGS) $(EXEC_OBJS) $(EXEC_LIBS) -o aisexec
 
 libtotem_pg.a: $(TOTEM_OBJS)

+ 1 - 1
exec/aispoll.c

@@ -465,7 +465,7 @@ void poll_print_state (
 		if (poll_instance->poll_entries[i].ufd.fd == fd) {
 		printf ("fd %d\n", poll_instance->poll_entries[i].ufd.fd);
 		printf ("events %d\n", poll_instance->poll_entries[i].ufd.events);
-		printf ("dispatch_fn %x\n", poll_instance->poll_entries[i].dispatch_fn);
+		printf ("dispatch_fn %p\n", poll_instance->poll_entries[i].dispatch_fn);
 		printf ("prio %d\n", poll_instance->poll_entries[i].prio);
 		}
 	}

+ 15 - 17
exec/amf.c

@@ -1,4 +1,3 @@
-int waiting = 0;
 /*
  * Copyright (c) 2002-2006 MontaVista Software, Inc.
  *
@@ -88,6 +87,7 @@ struct invocation {
 struct invocation *invocation_entries = 0;
 
 int invocation_entries_size = 0;
+int waiting = 0;
 
 enum amf_response_interfaces {
 	AMF_RESPONSE_HEALTHCHECKCALLBACK = 1,
@@ -421,7 +421,7 @@ struct lcr_iface openais_amf_ver0[1] = {
 		.dependency_count	= 0,
 		.constructor		= NULL,
 		.destructor		= NULL,
-		.interfaces		= (void **)&amf_service_handler_iface,
+		.interfaces		= (void **)(void *)&amf_service_handler_iface,
 	}
 };
 
@@ -524,13 +524,13 @@ void *clc_command_run (void *context)
 	char *argv[10];
 	char *envp[10];
 	int status;
-	unsigned char cmd[1024];
-	unsigned char env_comp_binary_name[1024];
-	unsigned char env_comp_binary_path[1024];
-	unsigned char env_comp_name[1024];
-	unsigned char *binary_to_run = 0;
-	unsigned char *binary_path = 0;
-	char *clc_cli_interface;
+	char cmd[1024];
+	char env_comp_binary_name[1024];
+	char env_comp_binary_path[1024];
+	char env_comp_name[1024];
+	char *binary_to_run = NULL;
+	char *binary_path = NULL;
+	char *clc_cli_interface = NULL;
 
 	sleep (1);
 
@@ -614,7 +614,7 @@ printf ("waiting for pid %d to finish\n", pid);
 
 	strcpy (env_comp_name, "SA_AMF_COMPONENT_NAME=");
 
-	strncat (env_comp_name, clc_command_run_data->comp->name.value,
+	strncat (env_comp_name, (char *)clc_command_run_data->comp->name.value,
 		clc_command_run_data->comp->name.length);
 
 	if (cmd[0] == '\0') {
@@ -978,11 +978,11 @@ DECLARE_LIST_INIT (library_notification_send_listhead);
 
 // TODO static totempg_recovery_plug_handle amf_recovery_plug_handle;
 
+#ifdef COMPILE_OUT
 static void protectiongroup_notifications_send (
 	struct amf_comp *changedComponent,
 	SaAmfProtectionGroupChangesT changeToComponent)
 {
-#ifdef COMPILE_OUT
 	int i;
 	struct conn_info *conn_info;
 	struct list_head *list;
@@ -1022,15 +1022,15 @@ static void protectiongroup_notifications_send (
 			} /* if track flags active */
 		} /* for all track entries */
 	} /* for all connection entries */
-#endif
 }
+#endif
 
+#ifdef COMPILE_OUT
 static int make_protectiongroup_notification_allcomponent (
 	struct amf_comp *changedComponent,
 	SaAmfProtectionGroupChangesT changeToComponent,
 	SaAmfProtectionGroupNotificationT **notification )
 {
-#ifdef COMPILE_OUT
 	SaAmfProtectionGroupNotificationT *protectionGroupNotification = 0;
 	int notifyEntries = 0;
 	struct amf_comp *component;
@@ -1087,9 +1087,8 @@ static int make_protectiongroup_notification_allcomponent (
 		*notification = protectionGroupNotification;
 	}
 	return (notifyEntries);
-#endif
-	return (0);
 }
+#endif
 
 #ifdef COMPILE_OUT
 static int make_protectiongroup_notification (
@@ -2822,7 +2821,6 @@ static void message_handler_req_lib_amf_response (void *conn, void *msg)
 {
 	struct req_lib_amf_response *req_lib_amf_response = (struct req_lib_amf_response *)msg;
 	struct res_lib_amf_response res_lib_amf_response;
-	struct conn_info *conn_info;
 	struct csi_set_callback_data *csi_set_callback_data;
 	struct csi_remove_callback_data *csi_remove_callback_data;
 	struct component_terminate_callback_data *component_terminate_callback_data;
@@ -2843,7 +2841,7 @@ static void message_handler_req_lib_amf_response (void *conn, void *msg)
 		goto error_exit;
 	}
 
-	log_printf (LOG_LEVEL_DEBUG, "handling response connection %p interface %x\n", conn_info, interface);
+	log_printf (LOG_LEVEL_DEBUG, "handling response connection interface %x\n", interface);
 	switch (interface) {
 	case AMF_RESPONSE_HEALTHCHECKCALLBACK:
 		healthcheck_active = (struct healthcheck_active *)data;

+ 1 - 1
exec/amfconfig.c

@@ -498,7 +498,7 @@ extern int openais_amf_config_read (char **error_string)
 
 		case AMF_HEALTHCHECK:
 			if ((loc = strstr_rs (line, "key=")) != 0) {
-				strcpy (amf_healthcheck->key.key, loc);
+				strcpy ((char *)amf_healthcheck->key.key, loc);
 				amf_healthcheck->key.keyLen = strlen (loc);
 			} else 
 			if ((loc = strstr_rs (line, "period=")) != 0) {

+ 12 - 12
exec/amfconfig.h

@@ -87,8 +87,8 @@ struct amf_unit {
 	SaAmfHAStateT assigned_ha_state;
 	SaAmfHAStateT requested_ha_state;
 
-	unsigned char clccli_path[1024];
-	unsigned char binary_path[1024];
+	char clccli_path[1024];
+	char binary_path[1024];
 
 	poll_timer_handle restart_timer;
 	int restart_count;
@@ -143,8 +143,8 @@ struct amf_group {
 	struct list_head unit_head;
 	struct list_head si_head;
 
-	unsigned char clccli_path[1024];
-	unsigned char binary_path[1024];
+	char clccli_path[1024];
+	char binary_path[1024];
 
 	unsigned int component_restart_probation;
 	unsigned int component_restart_max;
@@ -176,15 +176,15 @@ struct amf_comp {
 
 	enum clc_component_types comptype;
 
-	unsigned char clccli_path[1024];
-	unsigned char binary_path[1024];
-	unsigned char binary_name[1024];
+	char clccli_path[1024];
+	char binary_path[1024];
+	char binary_name[1024];
 
-	unsigned char instantiate_cmd[1024];
-	unsigned char terminate_cmd[1024];
-	unsigned char cleanup_cmd[1024];
-	unsigned char am_start_cmd[1024];
-	unsigned char am_stop_cmd[1024];
+	char instantiate_cmd[1024];
+	char terminate_cmd[1024];
+	char cleanup_cmd[1024];
+	char am_start_cmd[1024];
+	char am_stop_cmd[1024];
 	
 	OpenaisCfgAdministrativeStateT administrative_state;
 	OpenaisCfgOperationalStateT operational_state;

+ 1 - 1
exec/cfg.c

@@ -164,7 +164,7 @@ struct lcr_iface openais_cfg_ver0[1] = {
 		.dependency_count		= 0,
 		.constructor			= NULL,
 		.destructor			= NULL,
-		.interfaces			= (void **)&cfg_service_handler_iface,
+		.interfaces			= (void **)(void *)&cfg_service_handler_iface,
 	}
 };
 

+ 8 - 21
exec/ckpt.c

@@ -102,7 +102,7 @@ struct saCkptCheckpoint {
 	int expired;
 	int active_replica_set;
 	int sectionCount;
-	struct ckpt_refcnt ckpt_refcount[32]; // SHOULD BE PROCESSOR COUNT MAX	
+	struct ckpt_refcnt ckpt_refcount[PROCESSOR_COUNT_MAX];
 };
 
 struct iteration_entry {
@@ -520,7 +520,7 @@ struct lcr_iface openais_ckpt_ver0[1] = {
 		.dependency_count		= 0,
 		.constructor			= NULL,
 		.destructor			= NULL,
-		.interfaces			= (void **)&ckpt_service_handler_iface,
+		.interfaces			= (void **)(void *)&ckpt_service_handler_iface,
 	}
 };
 
@@ -2737,9 +2737,9 @@ static void message_handler_req_exec_ckpt_sectionwrite (
 		goto error_exit;
 	}
 
-/*
-	printf ("writing checkpoint section is %s\n", ((char *)req_lib_ckpt_sectionwrite) + sizeof (struct req_lib_ckpt_sectionwrite));
-*/
+	log_printf (LOG_LEVEL_DEBUG, "writing checkpoint section is %s\n",
+		((char *)req_lib_ckpt_sectionwrite) + sizeof (struct req_lib_ckpt_sectionwrite));
+
 	/*
 	 * Find checkpoint section to be written
 	 */
@@ -3326,19 +3326,6 @@ static void message_handler_req_lib_ckpt_sectioncreate (
 				iovecs[1].iov_len);
 		}
 	
-#ifdef DEBUG
-printf ("LIBRARY SECTIONCREATE string is %s len is %d\n", (unsigned char *)iovecs[1].iov_base,
-	iovecs[1].iov_len);
-printf ("|\n");
-{ int i;
-	char *abc = iovecs[1].iov_base;
-for (i = 0; i < 14;i++) {
-
-	printf ("%c ", abc[i]);
-}
-}
-printf ("|\n");
-#endif
 		if (iovecs[1].iov_len > 0) {
 			log_printf (LOG_LEVEL_DEBUG, "IOV_BASE is %p\n", iovecs[1].iov_base);
 			assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 2, TOTEMPG_AGREED) == 0);
@@ -3757,7 +3744,7 @@ static void message_handler_req_lib_ckpt_sectioniterationinitialize (
 	}
 
 	res = hdb_handle_get (&ckpt_pd->iteration_hdb, iteration_handle,
-		(void **)&iteration_instance);
+		(void **)(void *)&iteration_instance);
 	if (res != 0) {
 		hdb_handle_destroy (&ckpt_pd->iteration_hdb, iteration_handle);
 		goto error_exit;
@@ -3841,7 +3828,7 @@ static void message_handler_req_lib_ckpt_sectioniterationfinalize (
 
 	res = hdb_handle_get (&ckpt_pd->iteration_hdb,
 		req_lib_ckpt_sectioniterationfinalize->iteration_handle,
-		(void **)&iteration_instance);
+		(void **)(void *)&iteration_instance);
 	if (res != 0) {
 		error = SA_AIS_ERR_LIBRARY;
 		goto error_exit;
@@ -3884,7 +3871,7 @@ static void message_handler_req_lib_ckpt_sectioniterationnext (
 	log_printf (LOG_LEVEL_DEBUG, "section iteration next\n");
 	res = hdb_handle_get (&ckpt_pd->iteration_hdb,
 		req_lib_ckpt_sectioniterationnext->iteration_handle,
-		(void **)&iteration_instance);
+		(void **)(void *)&iteration_instance);
 	if (res != 0) {
 		error = SA_AIS_ERR_LIBRARY;
 		goto error_exit;

+ 3 - 4
exec/clm.c

@@ -231,7 +231,7 @@ struct lcr_iface openais_clm_ver0[1] = {
 		.dependency_count		= 0,
 		.constructor			= NULL,
 		.destructor				= NULL,
-		.interfaces				= (void **)&clm_service_handler_iface,
+		.interfaces				= (void **)(void *)&clm_service_handler_iface,
 	}
 };
 
@@ -264,10 +264,10 @@ static int clm_exec_init_fn (struct openais_config *openais_config)
 	sprintf ((char *)thisClusterNode.nodeAddress.value, "%s", totemip_print (this_ip));
 	thisClusterNode.nodeAddress.length = strlen ((char *)thisClusterNode.nodeAddress.value);
 	if (this_ip->family == AF_INET) {
-	thisClusterNode.nodeAddress.family = SA_CLM_AF_INET;
+		thisClusterNode.nodeAddress.family = SA_CLM_AF_INET;
 	} else
 	if (this_ip->family == AF_INET6) {
-	thisClusterNode.nodeAddress.family = SA_CLM_AF_INET6;
+		thisClusterNode.nodeAddress.family = SA_CLM_AF_INET6;
 	} else {
 		assert (0);
 	}
@@ -275,7 +275,6 @@ static int clm_exec_init_fn (struct openais_config *openais_config)
 	strcpy ((char *)thisClusterNode.nodeName.value, (char *)thisClusterNode.nodeAddress.value);
 	thisClusterNode.nodeName.length = thisClusterNode.nodeAddress.length;
 	thisClusterNode.nodeId = this_ip->nodeid;
-	printf ("setting B to %x\n", this_ip->nodeid);
 	thisClusterNode.member = 1;
 	{
 #if defined(OPENAIS_LINUX)

+ 1 - 1
exec/cpg.c

@@ -263,7 +263,7 @@ struct lcr_iface openais_cpg_ver0[1] = {
 		.dependency_count		= 0,
 		.constructor			= NULL,
 		.destructor			= NULL,
-		.interfaces			= (void **)&cpg_service_handler_iface,
+		.interfaces			= (void **)(void *)&cpg_service_handler_iface,
 	}
 };
 

+ 1 - 1
exec/evs.c

@@ -178,7 +178,7 @@ struct lcr_iface openais_evs_ver0[1] = {
 		.dependency_count	= 0,
 		.constructor		= NULL,
 		.destructor		= NULL,
-		.interfaces		= (void **)&evs_service_handler_iface,
+		.interfaces		= (void **)(void *)&evs_service_handler_iface,
 	}
 };
 

+ 2 - 2
exec/evt.c

@@ -245,7 +245,7 @@ struct lcr_iface openais_evt_ver0[1] = {
 		.dependency_count		= 0,
 		.constructor			= NULL,
 		.destructor				= NULL,
-		.interfaces				= (void **)&evt_service_handler_iface,
+		.interfaces				= (void **)(void *)&evt_service_handler_iface,
 	}
 };
 
@@ -3341,7 +3341,7 @@ static void evt_chan_open_finish(struct open_chan_pending *ocp,
 	unsigned int ret = 0;
 	unsigned int timer_del_status = 0;
 	void *ptr = 0;
-	uint32_t handle;
+	uint32_t handle = 0;
 	struct libevt_pd *esip;
 
 	esip = (struct libevt_pd *)openais_conn_private_data_get(ocp->ocp_conn);

+ 1 - 1
exec/keygen.c

@@ -52,7 +52,7 @@ int main (void) {
 		exit (1);
 	}
 
-	printf ("Gathering %lu bits for key from /dev/random.\n", sizeof (key) * 8);
+	printf ("Gathering %lu bits for key from /dev/random.\n", (unsigned long)(sizeof (key) * 8));
 	random_fd = open ("/dev/random", O_RDONLY);
 	if (random_fd == -1) {
 		perror ("Is /dev/random present? Opening /dev/random");

+ 2 - 2
exec/lck.c

@@ -319,7 +319,7 @@ struct lcr_iface openais_lck_ver0[1] = {
 		.dependency_count		= 0,
 		.constructor			= NULL,
 		.destructor			= NULL,
-		.interfaces			= (void **)&lck_service_handler_iface,
+		.interfaces			= (void **)(void *)&lck_service_handler_iface,
 	}
 };
 
@@ -684,7 +684,7 @@ static void message_handler_req_exec_lck_resourceopen (
 			list_init (&resource_cleanup->list);
 			list_init (&resource_cleanup->resource_lock_list_head);
 			resource_cleanup->resource = resource;
-printf ("resource is %p\n", resource);
+			log_printf (LOG_LEVEL_DEBUG, "resource is %p\n", resource);
 			resource_cleanup->resource_handle = req_exec_lck_resourceopen->resource_handle;
 			list_add (
 				&resource_cleanup->list,

+ 0 - 2
exec/main.c

@@ -1020,7 +1020,6 @@ static void aisexec_mempool_init (void)
 
 static void aisexec_tty_detach (void)
 {
-#define DEBUG
 #ifndef DEBUG
 	/*
 	 * Disconnect from TTY if this is not a debug run
@@ -1039,7 +1038,6 @@ static void aisexec_tty_detach (void)
 			break;
 	}
 #endif
-#undef DEBUG
 }
 
 static void aisexec_libais_bind (int *server_fd)

+ 19 - 1
exec/msg.c

@@ -468,7 +468,7 @@ struct lcr_iface openais_msg_ver0[1] = {
 		.dependency_count	= 0,
 		.constructor		= NULL,
 		.destructor		= NULL,
-		.interfaces		= (void **)&msg_service_handler_iface,
+		.interfaces		= (void **)(void *)&msg_service_handler_iface,
 	}
 };
 
@@ -873,18 +873,22 @@ static void message_handler_req_exec_msg_queuestatusget (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_queuestatusget *req_exec_msg_queuestatusget =
 		(struct req_exec_msg_queuestatusget *)message;
 	struct res_lib_msg_queueclose res_lib_msg_queuestatusget;
+#endif
 }
 
 static void message_handler_req_exec_msg_queueunlink (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_queueunlink *req_exec_msg_queueunlink =
 		(struct req_exec_msg_queueunlink *)message;
 	struct res_lib_msg_queueclose res_lib_msg_queueunlink;
+#endif
 }
 
 static void message_handler_req_exec_msg_queuegroupcreate (
@@ -1055,63 +1059,77 @@ static void message_handler_req_exec_msg_queuegrouptrack (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_queuegrouptrack *req_exec_msg_queuegrouptrack =
 		(struct req_exec_msg_queuegrouptrack *)message;
 	struct res_lib_msg_queueclose res_lib_msg_queuegrouptrack;
+#endif
 }
 
 static void message_handler_req_exec_msg_queuegrouptrackstop (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_queuegrouptrackstop *req_exec_msg_queuegrouptrackstop =
 		(struct req_exec_msg_queuegrouptrackstop *)message;
 	struct res_lib_msg_queueclose res_lib_msg_queuegrouptrackstop;
+#endif
 }
 
 static void message_handler_req_exec_msg_messagesend (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_messagesend *req_exec_msg_messagesend =
 		(struct req_exec_msg_messagesend *)message;
 	struct res_lib_msg_queueclose res_lib_msg_messagesend;
+#endif
 }
 
 static void message_handler_req_exec_msg_messageget (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_messageget *req_exec_msg_messageget =
 		(struct req_exec_msg_messageget *)message;
 	struct res_lib_msg_queueclose res_lib_msg_messageget;
+#endif
 }
 
 static void message_handler_req_exec_msg_messagecancel (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_messagecancel *req_exec_msg_messagecancel =
 		(struct req_exec_msg_messagecancel *)message;
 	struct res_lib_msg_queueclose res_lib_msg_messagecancel;
+#endif
 }
 
 static void message_handler_req_exec_msg_messagesendreceive (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_messagesendreceive *req_exec_msg_messagesendreceive =
 		(struct req_exec_msg_messagesendreceive *)message;
 	struct res_lib_msg_queueclose res_lib_msg_messagesendreceive;
+#endif
 }
 
 static void message_handler_req_exec_msg_messagereply (
 	void *message,
 	struct totem_ip_address *source_addr)
 {
+#if 0
 	struct req_exec_msg_messagereply *req_exec_msg_messagereply =
 		(struct req_exec_msg_messagereply *)message;
 	struct res_lib_msg_queueclose res_lib_msg_messagereply;
+#endif
 }
 
 

+ 2 - 0
exec/print.c

@@ -185,9 +185,11 @@ void internal_log_printf (int logclass, char *string, ...)
 	}
 	if (logmode & LOG_MODE_FILE && log_file_fp != 0) {
 		fprintf (log_file_fp, "%s", log_string);
+		fflush (log_file_fp);
 	}
 	if (logmode & LOG_MODE_STDERR) {
 		fprintf (stderr, "%s", log_string);
+		fflush (stderr);
 	}
 	fflush (stdout);
 

+ 1 - 0
exec/totem.h

@@ -38,6 +38,7 @@
 #define MESSAGE_SIZE_MAX			256000
 #define PROCESSOR_COUNT_MAX			32
 #define FRAME_SIZE_MAX				9000
+#define TRANSMITS_ALLOWED			16
 #define SEND_THREADS_MAX			16
 
 /*

+ 1 - 1
exec/totemconfig.c

@@ -235,7 +235,7 @@ extern int totem_config_read (
 				if (interface_max == totem_config->interface_count) {
 					sprintf (error_reason,
 						"%d is too many interfaces in %s/network.conf",
-						 OPENAIS_CONFDIR, totem_config->interface_count);
+						totem_config->interface_count, OPENAIS_CONFDIR);
 					goto parse_error;
 				}
 				res = totemip_parse (&totem_config->interfaces[totem_config->interface_count].bindnet, loc);

+ 0 - 3
exec/totemip.c

@@ -355,7 +355,6 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 			/* Retrieve mask
 			 */
 			if (ioctl(id_fd, SIOCGIFNETMASK, &ifrb) < 0) {
-				printf ("couldn't do ioctl\n");
 				break;
 			}
 			intf_addr_mask = (struct sockaddr_in *)&ifrb.ifr_addr;
@@ -370,7 +369,6 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 				/* Get inteface state
 				 */
 				if (ioctl(id_fd, SIOCGIFFLAGS, &ifrb) < 0) {
-					printf ("couldn't do ioctl\n");
 					break;
 				}
 				*interface_up = ifrb.ifr_flags & IFF_UP;
@@ -379,7 +377,6 @@ int totemip_iface_check(struct totem_ip_address *bindnet,
 				 */
 #ifdef SIOCGIFINDEX
 				if (ioctl(id_fd, SIOCGIFINDEX, &ifrb) < 0) {
-					printf ("couldn't do ioctl\n");
 					break;
 				}
 				*interface_num = ifrb.ifr_index;

+ 4 - 4
exec/totemnet.c

@@ -67,7 +67,7 @@
 
 #include "crypto.h"
 
-#define MCAST_SOCKET_BUFFER_SIZE (16 * 9000) /* where 16 is the transmits allowed, 9000 is mtu size */
+#define MCAST_SOCKET_BUFFER_SIZE (TRANSMITS_ALLOWED * FRAME_SIZE_MAX) 
 
 #define NETIF_STATE_REPORT_UP		1	
 #define NETIF_STATE_REPORT_DOWN		2
@@ -84,7 +84,7 @@ struct security_header {
 } __attribute__((packed));
 
 struct totemnet_mcast_thread_state {
-	unsigned char iobuf[9000];
+	unsigned char iobuf[FRAME_SIZE_MAX];
 	prng_state prng_state;
 };
 
@@ -668,7 +668,8 @@ static int net_deliver_fn (
 
 		res = authenticate_and_decrypt (instance, iovec);
 		if (res == -1) {
-			printf ("Invalid packet data\n");
+			instance->totemnet_log_printf (instance->totemnet_log_level_security,
+				"Invalid packet data\n");
 			iovec->iov_len = FRAME_SIZE_MAX;
 			return 0;
 		}
@@ -1278,7 +1279,6 @@ int totemnet_processor_count_set (
 	}
 
 	instance->my_memb_entries = processor_count;
-printf ("PCCCCCCCCCCCCCCCCOUNT %d\n", processor_count);
 	poll_timer_delete (instance->totemnet_poll_handle,
 		instance->timer_netif_check_timeout);
 	if (processor_count == 1) {

+ 24 - 12
exec/totempg.c

@@ -102,6 +102,7 @@ struct totempg_mcast_header {
 	short type;
 };
 
+
 /*
  * totempg_mcast structure
  *
@@ -139,6 +140,16 @@ static unsigned short mcast_packed_msg_lens[FRAME_SIZE_MAX];
 
 static int mcast_packed_msg_count = 0;
 
+/*
+ * Function and data used to log messages
+ */
+static int totempg_log_level_security;
+static int totempg_log_level_error;
+static int totempg_log_level_warning;
+static int totempg_log_level_notice;
+static int totempg_log_level_debug;
+static void (*totempg_log_printf) (int level, char *format, ...) = NULL;
+
 struct totem_config *totempg_totem_config;
 
 struct assembly {
@@ -472,13 +483,6 @@ static void totempg_deliver_fn (
 		iov_len -= 2;
 	}
 
-/*
-printf ("Message fragmented %d count %d\n", mcast->fragmented, mcast->msg_count);
-	for (i = 0; i < mcast->msg_count; i++) {
-		printf ("len[%d] = %d\n", i, msg_lens[i]);
-	}
-*/
-
 	/*
 	 * If the last message in the buffer is a fragment, then we
 	 * can't deliver it.  We'll first deliver the full messages
@@ -489,7 +493,6 @@ printf ("Message fragmented %d count %d\n", mcast->fragmented, mcast->msg_count)
 	continuation = mcast->continuation;
 	iov_delv.iov_base = &assembly->data[0];
 	iov_delv.iov_len = assembly->index + msg_lens[0];
-//	printf ("%d %d %d\n", msg_count, continuation, assembly->last_frag_num);
 
 	/*
 	 * Make sure that if this message is a continuation, that it
@@ -505,15 +508,17 @@ printf ("Message fragmented %d count %d\n", mcast->fragmented, mcast->msg_count)
 	if (continuation) {
 
 		if (continuation != assembly->last_frag_num) {
-			printf("Message continuation doesn't match previous frag e: %u - a: %u\n",
-					assembly->last_frag_num, continuation);
+			totempg_log_printf (totempg_log_level_error,
+				"Message continuation doesn't match previous frag e: %u - a: %u\n",
+				assembly->last_frag_num, continuation);
 			continuation = 0;
 		}
 
 		if ((assembly->index == 0) ||
 							(!continuation && assembly->index)) {
-			printf("Throwing away broken message: continuation %u, index %u\n",
-					continuation, assembly->index);
+			totempg_log_printf (totempg_log_level_error,
+				"Throwing away broken message: continuation %u, index %u\n",
+				continuation, assembly->index);
 			continuation = 0;
 		}
 		
@@ -611,6 +616,12 @@ int totempg_initialize (
 	int res;
 
 	totempg_totem_config = totem_config;
+	totempg_log_level_security = totem_config->totem_logging_configuration.log_level_security;
+	totempg_log_level_error = totem_config->totem_logging_configuration.log_level_error;
+	totempg_log_level_warning = totem_config->totem_logging_configuration.log_level_warning;
+	totempg_log_level_notice = totem_config->totem_logging_configuration.log_level_notice;
+	totempg_log_level_debug = totem_config->totem_logging_configuration.log_level_debug;
+	totempg_log_printf = totem_config->totem_logging_configuration.log_printf;
 
 	fragmentation_data = malloc (TOTEMPG_PACKET_SIZE);
 	if (fragmentation_data == 0) {
@@ -879,6 +890,7 @@ int totempg_groups_initialize (
 	instance->groups = 0;
 	instance->groups_cnt = 0;
 
+
 	hdb_handle_put (&totempg_groups_instance_database, *handle);
 
 	pthread_mutex_unlock (&totempg_mutex);

+ 34 - 28
exec/totemsrp.c

@@ -1,4 +1,3 @@
-#define TRANSMITS_ALLOWED 16
 /*
  * Copyright (c) 2003-2005 MontaVista Software, Inc.
  *
@@ -86,7 +85,7 @@
 #define QUEUE_RTR_ITEMS_SIZE_MAX		256 /* allow 512 retransmit items */
 #define RETRANS_MESSAGE_QUEUE_SIZE_MAX	500 /* allow 500 messages to be queued */
 #define RECEIVED_MESSAGE_QUEUE_SIZE_MAX	500 /* allow 500 messages to be queued */
-#define MAXIOVS					5	
+#define MAXIOVS							5	
 #define RETRANSMIT_ENTRIES_MAX			30
 #define MISSING_MCAST_WINDOW			128
 
@@ -1710,7 +1709,7 @@ int totemsrp_mcast (
 	}
 	
 	if (queue_is_full (&instance->new_message_queue)) {
-printf ("queue full\n");
+		instance->totemsrp_log_printf (instance->totemsrp_log_level_warning, "queue full\n");
 		return (-1);
 	}
 	for (j = 0, i = 0; i < iov_len; i++) {
@@ -1823,7 +1822,7 @@ static int orf_token_remcast (
 
 	res = sq_in_range (sort_queue, seq);
 	if (res == 0) {
-printf ("sq not in range\n");
+		instance->totemsrp_log_printf (instance->totemsrp_log_level_debug, "sq not in range\n");
 		return (-1);
 	}
 	
@@ -1859,8 +1858,9 @@ static void messages_free (
 	unsigned int release_to;
 	unsigned int range = 0;
 
-//printf ("aru %x last aru %x my high delivered %x last releaed %x\n",
-//		token_aru, instance->my_last_aru, instance->my_high_delivered, instance->last_released);
+	instance->totemsrp_log_printf (instance->totemsrp_log_level_debug,
+		"aru %x last aru %x my high delivered %x last released %x\n",
+		token_aru, instance->my_last_aru, instance->my_high_delivered, instance->last_released);
 
 	release_to = token_aru;
 	if (sq_lt_compare (instance->my_last_aru, release_to)) {
@@ -2127,7 +2127,10 @@ static int orf_token_rtr (
 	 * Add messages to retransmit to RTR list
 	 * but only retry if there is room in the retransmit list
 	 */
-//printf ("high seq %x aru %x\n", instance->my_high_seq_received, instance->my_aru);
+
+	instance->totemsrp_log_printf (instance->totemsrp_log_level_debug,
+		"high seq %x aru %x\n", instance->my_high_seq_received, instance->my_aru);
+
 	range = instance->my_high_seq_received - instance->my_aru;
 	assert (range < 100000);
 
@@ -2511,7 +2514,8 @@ static void memb_ring_id_create_or_load (
 		umask(0);
 		fd = open (filename, O_CREAT|O_RDWR, 0777);
 		if (fd == -1) {
-			printf ("couldn't create file %d %s\n", fd, strerror(errno));
+			instance->totemsrp_log_printf (instance->totemsrp_log_level_warning,
+				"Couldn't create %s %s\n", filename, strerror (errno));
 		}
 		res = write (fd, &memb_ring_id->seq, sizeof (unsigned long long));
 		assert (res == sizeof (unsigned long long));
@@ -2696,19 +2700,19 @@ static int message_handler_orf_token (
 	struct timeval tv_current;
 	struct timeval tv_diff;
 
-gettimeofday (&tv_current, NULL);
-timersub (&tv_current, &tv_old, &tv_diff);
-memcpy (&tv_old, &tv_current, sizeof (struct timeval));
+	gettimeofday (&tv_current, NULL);
+	timersub (&tv_current, &tv_old, &tv_diff);
+	memcpy (&tv_old, &tv_current, sizeof (struct timeval));
 
-if ((((float)tv_diff.tv_usec) / 100.0) > 5.0) {
-printf ("OTHERS %0.4f ms\n", ((float)tv_diff.tv_usec) / 100.0);
-}
+	if ((((float)tv_diff.tv_usec) / 100.0) > 5.0) {
+		printf ("OTHERS %0.4f ms\n", ((float)tv_diff.tv_usec) / 100.0);
+	}
 #endif
 
 #ifdef RANDOM_DROP
-if (random()%100 < 10) {
-	return (0);
-}
+	if (random()%100 < 10) {
+		return (0);
+	}
 #endif
 
 	if (endian_conversion_needed) {
@@ -2852,7 +2856,8 @@ if (random()%100 < 10) {
 		if (instance->my_aru_count > instance->totem_config->fail_to_recv_const &&
 			!totemip_equal(&token->aru_addr, &instance->my_id)) {
 			
-printf ("FAILED TO RECEIVE\n");
+			instance->totemsrp_log_printf (instance->totemsrp_log_level_error,
+				"FAILED TO RECEIVE\n");
 // TODO if we fail to receive, it may be possible to end with a gather
 // state of proc == failed = 0 entries
 			memb_set_merge (&token->aru_addr, 1,
@@ -2931,12 +2936,12 @@ printf ("FAILED TO RECEIVE\n");
 			token_send (instance, token, forward_token); 
 
 #ifdef GIVEINFO
-gettimeofday (&tv_current, NULL);
-timersub (&tv_current, &tv_old, &tv_diff);
-memcpy (&tv_old, &tv_current, sizeof (struct timeval));
-if ((((float)tv_diff.tv_usec) / 100.0) > 5.0) {
-printf ("I held %0.4f ms\n", ((float)tv_diff.tv_usec) / 100.0);
-}
+			gettimeofday (&tv_current, NULL);
+			timersub (&tv_current, &tv_old, &tv_diff);
+			memcpy (&tv_old, &tv_current, sizeof (struct timeval));
+			if ((((float)tv_diff.tv_usec) / 100.0) > 5.0) {
+				printf ("I held %0.4f ms\n", ((float)tv_diff.tv_usec) / 100.0);
+			}
 #endif
 			if (instance->memb_state == MEMB_STATE_OPERATIONAL) {
 				messages_deliver_to_app (instance, 0,
@@ -3532,15 +3537,16 @@ static int message_handler_memb_commit_token (
 	if (memb_commit_token->token_seq > 0 &&
 		instance->my_token_seq >= memb_commit_token->token_seq) {
 
-		printf ("already received commit token %d %d\n",
+		instance->totemsrp_log_printf (instance->totemsrp_log_level_notice,
+			"already received commit token %d %d\n",
 			memb_commit_token->token_seq, instance->my_token_seq);
 		return (0);
 	}
 */
 #ifdef RANDOM_DROP
-if (random()%100 < 10) {
-	return (0);
-}
+	if (random()%100 < 10) {
+		return (0);
+	}
 #endif
 	switch (instance->memb_state) {
 		case MEMB_STATE_OPERATIONAL:

+ 0 - 5
exec/totemsrp.h

@@ -37,11 +37,6 @@
 #include "totem.h"
 #include "aispoll.h"
 
-#define HEADERSIZE 78
-
-//#define TOTEMSRP_PACKET_SIZE_MAX	1404
-#define TOTEMSRP_PACKET_SIZE_MAX	9000 - HEADERSIZE
-
 typedef unsigned int totemsrp_handle;
 
 /*

+ 0 - 4
exec/ykd.c

@@ -281,14 +281,12 @@ int decide (void)
 {
 	int i;
 
-printf ("decide 1\n");
 	/*
 	 * Determine if there is a subquorum
 	 */
 	if (subquorum (view_list, view_list_entries, last_primary_max) == 0) {
 		return (0);
 	}
-printf ("decide 2\n");
 
 	for (i = 0; i < ambiguous_sessions_max_entries; i++) {
 		if (subquorum (view_list, view_list_entries, &ambiguous_sessions_max[i]) == 0) {
@@ -296,7 +294,6 @@ printf ("decide 2\n");
 		}
 		
 	}
-printf ("decide 3\n");
 	return (1);
 }
 
@@ -356,7 +353,6 @@ static void ykd_deliver_fn (
 		return;
 	}
 	if (endian_conversion_required) {
-	printf ("endian convert\n");
 		ykd_state_endian_convert ((struct ykd_state *)msg_state);
 	}
 

+ 8 - 4
lcr/lcr_ifact.c

@@ -65,7 +65,11 @@ static struct hdb_handle_database lcr_iface_instance_database = {
 
 static unsigned int g_component_handle;
 
+#ifdef OPENAIS_LINUX
 static int lcr_select_so (const struct dirent *dirent)
+#else
+static int lcr_select_so (struct dirent *dirent)
+#endif
 {
 	unsigned int len;
 
@@ -85,7 +89,7 @@ static inline struct lcr_component_instance *lcr_comp_find (
 	int *iface_number)
 {
 	struct lcr_component_instance *instance;
-	unsigned int component_handle;
+	unsigned int component_handle = 0;
 	int i;
 
 	/*
@@ -93,7 +97,7 @@ static inline struct lcr_component_instance *lcr_comp_find (
 	 */
 	hdb_iterator_reset (&lcr_component_instance_database);
 	while (hdb_iterator_next (&lcr_component_instance_database,
-		(void **)&instance, &component_handle) == 0) {
+		(void **)(void *)&instance, &component_handle) == 0) {
 
 		for (i = 0; i < instance->iface_count; i++) {
 			if ((strcmp (instance->ifaces[i].name, iface_name) == 0) &&
@@ -113,14 +117,14 @@ static inline int lcr_lib_loaded (
 	char *library_name)
 {
 	struct lcr_component_instance *instance;
-	unsigned int component_handle;
+	unsigned int component_handle = 0;
 
 	/*
 	 * Try to find interface in already loaded component
 	 */
 	hdb_iterator_reset (&lcr_component_instance_database);
 	while (hdb_iterator_next (&lcr_component_instance_database,
-		(void **)&instance, &component_handle) == 0) {
+		(void **)(void *)&instance, &component_handle) == 0) {
 
 		if (strcmp (instance->library_name, library_name) == 0) {
 			return (1);

+ 2 - 2
lcr/libtest_a.c

@@ -91,7 +91,7 @@ static struct lcr_iface iface1[2] = {
 		.dependency_count	= 0,
 		.constructor		= iface1_constructor,
 		.destructor		= iface1_destructor,
-		.interfaces		= (void **)&iface_list,
+		.interfaces		= (void **)(void *)&iface_list,
 	},
 	/* version 1 */
 	{
@@ -103,7 +103,7 @@ static struct lcr_iface iface1[2] = {
 		.dependency_count	= 0,
 		.constructor		= iface1_ver1_constructor,
 		.destructor		= iface1_ver1_destructor,
-		.interfaces		= (void **)&iface_ver1_list
+		.interfaces		= (void **)(void *)&iface_ver1_list
 	}
 };
 

+ 2 - 2
lcr/libtest_b.c

@@ -93,7 +93,7 @@ struct lcr_iface iface1[2]= {
 		.dependency_count	= 0,
 		.constructor		= iface1_constructor,
 		.destructor		= iface1_destructor,
-		.interfaces		= (void **)&iface_list,
+		.interfaces		= (void **)(void *)&iface_list,
 	},
 	/*
 	 * Version 1
@@ -107,7 +107,7 @@ struct lcr_iface iface1[2]= {
 		.dependency_count	= 0,
 		.constructor		= iface1_ver1_constructor,
 		.destructor		= iface1_ver1_destructor,
-		.interfaces		= (void **)&iface_ver1_list
+		.interfaces		= (void **)(void *)&iface_ver1_list
 	}
 };
 

+ 4 - 4
lcr/test.c

@@ -54,28 +54,28 @@ int main (void) {
 		&a_ifact_handle_ver0,
 		"A_iface1",
 		0, /* version 0 */
-		(void **)&a_iface_ver0,
+		(void **)(void *)&a_iface_ver0,
 		(void *)0xaaaa0000);
 
 	lcr_ifact_reference (
 		&b_ifact_handle_ver0,
 		"B_iface1",
 		0, /* version 0 */
-		(void **)&b_iface_ver0,
+		(void **)(void *)&b_iface_ver0,
 		(void *)0xbbbb0000);
 
 	lcr_ifact_reference (
 		&a_ifact_handle_ver1,
 		"A_iface1",
 		1, /* version 1 */
-		(void **)&a_iface_ver1,
+		(void **)(void *)&a_iface_ver1,
 		(void *)0xaaaa1111);
 
 	lcr_ifact_reference (
 		&b_ifact_handle_ver1,
 		"B_iface1",
 		1, /* version 1 */
-		(void **)&b_iface_ver1,
+		(void **)(void *)&b_iface_ver1,
 		(void *)0xbbbb1111);
 
 	a_iface_ver0->func1();

+ 4 - 3
lib/amf.c

@@ -521,7 +521,8 @@ saAmfComponentNameGet (
 		goto error_exit;
 	}
 
-	strcpy (compName->value, env_value);
+	strncpy ((char *)compName->value, env_value, SA_MAX_NAME_LENGTH-1);
+	compName->value[SA_MAX_NAME_LENGTH-1] = '\0';
 	compName->length = strlen (env_value);
 
 error_exit:
@@ -918,13 +919,13 @@ saAmfComponentErrorReport (
 		sizeof (SaNameT));
 	req_lib_amf_componenterrorreport.errorDetectionTime = errorDetectionTime;
 
-printf ("start error report\n");
+    DPRINT (("start error report\n"));
 	error = saSendReceiveReply (amfInstance->response_fd,
 		&req_lib_amf_componenterrorreport,
 		sizeof (struct req_lib_amf_componenterrorreport),
 		&res_lib_amf_componenterrorreport,
 		sizeof (struct res_lib_amf_componenterrorreport));
-printf ("end error report\n");
+    DPRINT (("end error report\n"));
 
 	error = res_lib_amf_componenterrorreport.header.error;
 

+ 1 - 2
lib/clm.c

@@ -502,8 +502,7 @@ saClmClusterTrackStop (
 
 	req_lib_clm_trackstop.header.size = sizeof (struct req_lib_clm_trackstop);
 	req_lib_clm_trackstop.header.id = MESSAGE_REQ_CLM_TRACKSTOP;
-printf ("cluster track stop\n");
-
+	DPRINT (("cluster track stop\n"));
 	error = saHandleInstanceGet (&clmHandleDatabase, clmHandle,
 		(void *)&clmInstance);
 	if (error != SA_AIS_OK) {

+ 7 - 10
lib/evt.c

@@ -545,8 +545,8 @@ static SaAisErrorT make_event(SaEvtEventHandleT *event_handle,
 		edi->edi_patterns.patterns[i].allocatedSize = pat->patternSize;
 		edi->edi_patterns.patterns[i].pattern = malloc(pat->patternSize);
 		if (!edi->edi_patterns.patterns[i].pattern) {
-			printf("make_event: couldn't alloc %llu bytes\n",
-				(unsigned long long)pat->patternSize);
+            DPRINT (("make_event: couldn't alloc %llu bytes\n",
+				(unsigned long long)pat->patternSize));
 			saHandleDestroy(&event_handle_db, *event_handle);
 			error =  SA_AIS_ERR_LIBRARY;
 			goto make_evt_done_put2;
@@ -726,7 +726,7 @@ saEvtDispatch(
  			error = saSendRetry(evti->ei_response_fd, &res, sizeof(res));
  
 			if (error != SA_AIS_OK) {
-				printf("MESSAGE_RES_EVT_AVAILABLE: send failed: %d\n", error);
+				DPRINT (("MESSAGE_RES_EVT_AVAILABLE: send failed: %d\n", error));
  				pthread_mutex_unlock(&evti->ei_response_mutex);
 					break;
 			}
@@ -734,8 +734,7 @@ saEvtDispatch(
  			pthread_mutex_unlock(&evti->ei_response_mutex);
 
 			if (error != SA_AIS_OK) {
-				printf("MESSAGE_RES_EVT_AVAILABLE: receive failed: %d\n", 
-						error);
+				DPRINT (("MESSAGE_RES_EVT_AVAILABLE: receive failed: %d\n", error));
 				break;
 			}
 			/*
@@ -743,7 +742,7 @@ saEvtDispatch(
  			 * grabbed it.
 			 */
 			if (evt->led_head.error == SA_AIS_ERR_NOT_EXIST) {
-				// printf("MESSAGE_RES_EVT_AVAILABLE: No event data\n");
+                DPRINT (("MESSAGE_RES_EVT_AVAILABLE: No event data\n"));
 				error = SA_AIS_OK;
 				break;
 			}
@@ -760,8 +759,7 @@ saEvtDispatch(
 				if (error == SA_AIS_ERR_TRY_AGAIN) {
 					evti->ei_data_available = 1;
 				} else {
-					printf("MESSAGE_RES_EVT_AVAILABLE: Error returned: %d\n",
-						error);
+					DPRINT (("MESSAGE_RES_EVT_AVAILABLE: Error returned: %d\n", error));
 				}
 				break;
 			}
@@ -816,8 +814,7 @@ saEvtDispatch(
 			break;
 
 		default:
-			printf("Dispatch: Bad message type 0x%x\n",
-					dispatch_data.header.id);
+			DPRINT (("Dispatch: Bad message type 0x%x\n", dispatch_data.header.id));
 			error = SA_AIS_ERR_LIBRARY;	
 			goto dispatch_put;
 		}

+ 2 - 2
lib/lck.c

@@ -339,7 +339,7 @@ saLckDispatch (
 	int cont = 1; /* always continue do loop except when set to 0 */
 	struct message_overlay dispatch_data;
 	struct res_lib_lck_lockwaitercallback *res_lib_lck_lockwaitercallback;
-	struct res_lib_lck_resourceopenasync *res_lib_lck_resourceopenasync;
+	struct res_lib_lck_resourceopenasync *res_lib_lck_resourceopenasync = NULL;
 	struct res_lib_lck_resourcelockasync *res_lib_lck_resourcelockasync;
 	struct res_lib_lck_resourceunlockasync *res_lib_lck_resourceunlockasync;
 
@@ -473,7 +473,7 @@ saLckDispatch (
 			}
 			break;
 		case MESSAGE_RES_LCK_RESOURCELOCKASYNC:
-printf ("grant\n");
+			DPRINT (("grant\n"));
 			if (callbacks.saLckLockGrantCallback == NULL) {
 				continue;
 			}

+ 8 - 0
lib/util.h

@@ -42,6 +42,14 @@
 
 #include "../include/ipc_gen.h"
 
+/* Debug macro
+ */
+#ifdef DEBUG
+	#define DPRINT(s) printf s
+#else
+	#define DPRINT(s)
+#endif
+		
 #ifdef SO_NOSIGPIPE
 #ifndef MSG_NOSIGNAL
 #define MSG_NOSIGNAL 0

+ 1 - 1
test/ckptbench.c

@@ -232,7 +232,7 @@ int main (void) {
 		"Initial Data #0",
 		strlen ("Initial Data #0") + 1);
 
-	size = 200000;
+	size = 1;
 
 	for (i = 0; i < 50; i++) { /* number of repetitions - up to 50k */
 		ckpt_benchmark (checkpointHandle, size);

+ 5 - 3
test/testamf1.c

@@ -70,8 +70,6 @@ void setSanameT (SaNameT *name, char *str) {
 	memcpy (name->value, str, name->length);
 }
 
-static int health_flag = -1;
-static unsigned int healthcheck_count = 0;
 static unsigned int healthcheck_no = 0;
 
 int stop = 0;
@@ -150,6 +148,10 @@ void CSISetCallback (
 		printf (" requested to enter hastate SA_AMF_STANDBY.\n");
 		saAmfResponse (handle, invocation, SA_AIS_OK);
 		break;
+	case SA_AMF_HA_QUIESCED:
+		break;
+	case SA_AMF_HA_QUIESCING:
+		break;
 	}
 }
 
@@ -157,7 +159,7 @@ void CSIRemoveCallback (
 	SaInvocationT invocation,
 	const SaNameT *compName,
 	const SaNameT *csiName,
-	const SaAmfCSIFlagsT *csiFlags)
+	SaAmfCSIFlagsT csiFlags)
 {
 	int res;
 

+ 2 - 2
test/testckpt.c

@@ -283,7 +283,7 @@ int main (void) {
 	printf ("%s: checkpoint section expiration set\n",
 		get_test_output (error, SA_AIS_OK));
 
-printf ("Please wait, testing expiry of checkpoint sections.\n");
+	printf ("Please wait, testing expiry of checkpoint sections.\n");
 	do {
 	error = saCkptCheckpointRead (checkpointHandle,
 		ReadVectorElements,
@@ -292,7 +292,7 @@ printf ("Please wait, testing expiry of checkpoint sections.\n");
 	} while (error != SA_AIS_ERR_NOT_EXIST);
 	gettimeofday (&tv_end, NULL);
 	timersub (&tv_end, &tv_start, &tv_elapsed);
-	printf ("Elapsed Time to expiry is %ld.%ld (should be about %d seconds)\n", tv_elapsed.tv_sec, tv_elapsed.tv_usec, SECONDS_TO_EXPIRE);
+	printf ("Elapsed Time to expiry is %ld.%ld (should be about %d seconds)\n", tv_elapsed.tv_sec, (unsigned long)tv_elapsed.tv_usec, SECONDS_TO_EXPIRE);
 
 	error = saCkptCheckpointRetentionDurationSet (checkpointHandle,
 						      5000000000LL);

+ 2 - 1
test/testcpg.c

@@ -37,6 +37,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <unistd.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/select.h>
@@ -145,7 +146,7 @@ int main (int argc, char *argv[]) {
 			char inbuf[132];
 			struct iovec iov;
 
-			gets(inbuf);
+			fgets(inbuf, sizeof(inbuf), stdin);
 			if (strncmp(inbuf, "EXIT", 4) == 0) {
 				cpg_leave(handle, &group_name);
 			}