Sfoglia il codice sorgente

defect 988
The totem SRP handle is passed up the entire stack is not needed past certain
functions.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@860 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 20 anni fa
parent
commit
175ead199e
8 ha cambiato i file con 34 aggiunte e 34 eliminazioni
  1. 3 0
      exec/ckpt.c
  2. 1 7
      exec/main.c
  3. 7 14
      exec/sync.c
  4. 1 1
      exec/sync.h
  5. 1 4
      exec/totemmrp.c
  6. 1 2
      exec/totemmrp.h
  7. 18 3
      exec/totempg.c
  8. 2 3
      exec/totempg.h

+ 3 - 0
exec/ckpt.c

@@ -1527,6 +1527,9 @@ error_exit:
 		if (error == SA_AIS_OK) {
 			checkpoint_cleanup = malloc (sizeof (struct checkpoint_cleanup));
 			if (checkpoint_cleanup == 0) {
+				list_del (&ckptCheckpoint->list);
+				list_del (&ckptCheckpointSection->list);
+				free (ckptCheckpointSection);
 				free (ckptCheckpoint);
 				error = SA_AIS_ERR_NO_MEMORY;
 			} else {

+ 1 - 7
exec/main.c

@@ -100,8 +100,6 @@ struct sync_callbacks sync_callbacks[5];
 
 int sync_callback_count;
 
-totemsrp_handle totemsrp_handle_in;
-
 #define AIS_SERVICE_HANDLERS_COUNT 6
 #define AIS_SERVICE_HANDLER_AISEXEC_FUNCTIONS_MAX 50
 
@@ -755,8 +753,6 @@ error_disconnect:
 	return (res);
 }
 
-extern void print_stats (totemsrp_handle totemsrp_handle);
-
 void sigintr_handler (int signum)
 {
 
@@ -775,7 +771,6 @@ void sigintr_handler (int signum)
 #endif
 
 	totempg_finalize ();
-//	print_stats (totemsrp_handle_in);
 	ais_done (AIS_DONE_EXIT);
 }
 
@@ -832,7 +827,7 @@ void aisexec_sync_fns_build (void)
 			sync_callback_count++;
 		}
 	}
-	sync_register (totemsrp_handle_in, sync_callbacks, sync_callback_count, sync_completed);
+	sync_register (sync_callbacks, sync_callback_count, sync_completed);
 }
 
 char delivery_data[MESSAGE_SIZE_MAX];
@@ -1144,7 +1139,6 @@ int main (int argc, char **argv)
 
 	totempg_initialize (
 		aisexec_poll_handle,
-		&totemsrp_handle_in,
 		&openais_config.totem_config,
 		deliver_fn,
 		confchg_fn);

+ 7 - 14
exec/sync.c

@@ -53,7 +53,7 @@
 #include "main.h"
 #include "sync.h"
 #include "totempg.h"
-#include "totemsrp.h"
+#include "totempg.h"
 #include "print.h"
 
 #define LOG_SERVICE LOG_SERVICE_SYNC
@@ -65,8 +65,6 @@ struct barrier_data {
 
 static struct memb_ring_id *sync_ring_id;
 
-static totemsrp_handle sync_totemsrp_handle;
-
 static struct sync_callbacks *sync_callbacks;
 
 static int sync_callback_count;
@@ -123,7 +121,7 @@ static int sync_barrier_send (struct memb_ring_id *ring_id)
 
 void sync_start_init (struct memb_ring_id *ring_id)
 {
-	totemsrp_callback_token_create (sync_totemsrp_handle,
+	totempg_callback_token_create (
 		&sync_callback_token_handle,
 		TOTEM_CALLBACK_TOKEN_SENT,
 		0, /* don't delete after callback */
@@ -134,13 +132,12 @@ void sync_start_init (struct memb_ring_id *ring_id)
 static void sync_service_init (struct memb_ring_id *ring_id)
 {
 	sync_callbacks[sync_recovery_index].sync_init ();
-	totemsrp_callback_token_destroy (sync_totemsrp_handle,
-		&sync_callback_token_handle);
+	totempg_callback_token_destroy (&sync_callback_token_handle);
 
 	/*
 	 * Create the token callback for the processing
 	 */
-	totemsrp_callback_token_create (sync_totemsrp_handle,
+	totempg_callback_token_create (
 		&sync_callback_token_handle,
 		TOTEM_CALLBACK_TOKEN_SENT,
 		0, /* don't delete after callback */
@@ -158,8 +155,7 @@ static int sync_start_process (enum totem_callback_token_type type, void *data)
 		/*
 		 * Delete the token callback for the barrier
 		 */
-		totemsrp_callback_token_destroy (sync_totemsrp_handle,
-			&sync_callback_token_handle);
+		totempg_callback_token_destroy (&sync_callback_token_handle);
 	}
 	return (0);
 }
@@ -182,8 +178,7 @@ static int sync_service_process (enum totem_callback_token_type type, void *data
 	 * This sync is complete so activate and start next service sync
 	 */
 	sync_callbacks[sync_recovery_index].sync_activate ();
-	totemsrp_callback_token_destroy (sync_totemsrp_handle,
-		&sync_callback_token_handle);
+	totempg_callback_token_destroy (&sync_callback_token_handle);
 	sync_recovery_index += 1;
 
 	if (sync_recovery_index > sync_callback_count) {
@@ -195,12 +190,10 @@ static int sync_service_process (enum totem_callback_token_type type, void *data
 }
 
 void sync_register (
-	totemsrp_handle handle,
 	struct sync_callbacks *callbacks,
 	int callback_count,
 	void (*synchronization_completed) (void))
 {
-	sync_totemsrp_handle = handle;
 	sync_callbacks = callbacks;
 	sync_callback_count = callback_count;
 	sync_synchronization_completed = synchronization_completed;
@@ -221,7 +214,7 @@ void sync_confchg_fn (
 
 	sync_processing = 1;
 
-	totemsrp_callback_token_destroy (sync_totemsrp_handle, &sync_callback_token_handle);
+	totempg_callback_token_destroy (&sync_callback_token_handle);
 
 	sync_ring_id = ring_id;
 

+ 1 - 1
exec/sync.h

@@ -46,7 +46,7 @@ struct sync_callbacks {
 	void (*sync_abort) (void);
 };
 
-void sync_register (totemsrp_handle handle,
+void sync_register (
 	struct sync_callbacks *callbacks,
 	int callback_count,
 	void (*synchronization_completed) (void));

+ 1 - 4
exec/totemmrp.c

@@ -103,7 +103,6 @@ void totemmrp_confchg_fn (
  */
 int totemmrp_initialize (
 	poll_handle poll_handle,
-	totemsrp_handle *totemsrp_handle,
 	struct totem_config *totem_config,
 
 	void (*deliver_fn) (
@@ -129,8 +128,6 @@ int totemmrp_initialize (
 		totemmrp_deliver_fn,
 		totemmrp_confchg_fn);
 
-	*totemsrp_handle = totemsrp_handle_in;
-
 	return (result);
 }
 
@@ -169,7 +166,7 @@ int totemmrp_callback_token_create (
 }
 
 void totemmrp_callback_token_destroy (
-	void **handle_out)
+	void *handle_out)
 {
 	totemsrp_callback_token_destroy (totemsrp_handle_in, handle_out);
 }

+ 1 - 2
exec/totemmrp.h

@@ -59,7 +59,6 @@ void totemmrp_log_printf_init (
  */
 int totemmrp_initialize (
 	poll_handle poll_handle,
-	totemsrp_handle *totemsrp_handle,
 	struct totem_config *totem_config,
 
 	void (*deliver_fn) (
@@ -97,7 +96,7 @@ int totemmrp_callback_token_create (
 	void *data);
 
 void totemmrp_callback_token_destroy (
-	void **handle_out);
+	void *handle_out);
 
 void totemmrp_new_msg_signal (void);
 

+ 18 - 3
exec/totempg.c

@@ -459,7 +459,6 @@ int callback_token_received_fn (enum totem_callback_token_type type,
  */
 int totempg_initialize (
 	poll_handle poll_handle,
-	totemsrp_handle *totemsrp_handle,
 	struct totem_config *totem_config,
 
 	void (*deliver_fn) (
@@ -489,9 +488,9 @@ int totempg_initialize (
 
 	res = totemmrp_initialize (
 		poll_handle,
-		totemsrp_handle,
 		totem_config,
-		totempg_deliver_fn, totempg_confchg_fn);
+		totempg_deliver_fn,
+		totempg_confchg_fn);
 
 	totemmrp_callback_token_create (
 		&callback_token_received_handle, 
@@ -682,6 +681,22 @@ int totempg_send_ok (
 
 	return (avail >= total);
 }
+int totempg_callback_token_create (
+	void **handle_out,
+	enum totem_callback_token_type type,
+	int delete,
+	int (*callback_fn) (enum totem_callback_token_type type, void *),
+	void *data)
+{
+	return totemmrp_callback_token_create (handle_out, type, delete, callback_fn, data);
+}
+
+void totempg_callback_token_destroy (
+	void *handle_out)
+{
+	totemmrp_callback_token_destroy (handle_out);
+}
+
 /*
  *	vi: set autoindent tabstop=4 shiftwidth=4 :
  */

+ 2 - 3
exec/totempg.h

@@ -53,7 +53,6 @@
  */
 int totempg_initialize (
 	poll_handle poll_handle,
-	totemsrp_handle *totemsrp_handle,
 	struct totem_config *totem_config,
 
 	void (*deliver_fn) (
@@ -85,9 +84,9 @@ int totempg_mcast (
 int totempg_send_ok (
 	int msg_size);
 
-void totempg_token_callback_destroy (void *handle);
+void totempg_callback_token_destroy (void *handle);
 
-int totempg_token_callback_create (void **handle_out,
+int totempg_callback_token_create (void **handle_out,
 	enum totem_callback_token_type type,
 	int delete,
 	int (*callback_fn) (enum totem_callback_token_type type, void *),