Переглянути джерело

cleanup some shared datatypes.

(Logical change 1.150)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@532 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 21 роки тому
батько
коміт
20f0520e8d
14 змінених файлів з 58 додано та 102 видалено
  1. 2 2
      exec/amf.c
  2. 4 4
      exec/ckpt.c
  3. 2 2
      exec/clm.c
  4. 2 2
      exec/evs.c
  5. 4 4
      exec/evt.c
  6. 1 1
      exec/handlers.h
  7. 1 1
      exec/main.c
  8. 1 1
      exec/parse.h
  9. 5 5
      exec/sync.c
  10. 1 1
      exec/sync.h
  11. 8 7
      exec/totempg.c
  12. 4 24
      exec/totempg.h
  13. 17 17
      exec/totemsrp.c
  14. 6 31
      exec/totemsrp.h

+ 2 - 2
exec/amf.c

@@ -238,7 +238,7 @@ static void amf_confchg_njoin (
 	void *data);
 
 static int amf_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
     struct in_addr *left_list, void *left_list_private,
@@ -1898,7 +1898,7 @@ void amf_confchg_nleave (struct saAmfComponent *component ,void *data)
 }
 
 static int amf_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
     struct in_addr *left_list, void *left_list_private,

+ 4 - 4
exec/ckpt.c

@@ -176,7 +176,7 @@ static int recovery_abort = 0;
 static struct memb_ring_id saved_ring_id;
 
 static int ckpt_confchg_fn(
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private,
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -758,7 +758,7 @@ static void ckpt_recovery_process_members_exit(struct in_addr *left_list, int le
 }
 
 static int ckpt_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
 	struct in_addr *left_list, void *left_list_private,
@@ -768,7 +768,7 @@ static int ckpt_confchg_fn (
 	struct memb_ring_id *ring_id) 
 {
 
-	if (configuration_type == TOTEMPG_CONFIGURATION_REGULAR) {
+	if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
 #ifdef TODO	
 		totempg_recovery_plug_unplug (ckpt_checkpoint_recovery_plug_handle);	
 #endif
@@ -777,7 +777,7 @@ static int ckpt_confchg_fn (
 		}
 	}	
 
-	else if (configuration_type == TOTEMPG_CONFIGURATION_TRANSITIONAL) {
+	else if (configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
 		ckpt_recovery_process_members_exit(left_list, left_list_entries);
 		recovery_state = SYNCHRONY_STATE_STARTED;
 		recovery_abort = 0;

+ 2 - 2
exec/clm.c

@@ -101,7 +101,7 @@ SaClmClusterNodeT *clm_get_by_nodeid (struct in_addr node_id)
 static int clm_exec_init_fn (void);
 
 static int clm_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
     struct in_addr *left_list, void *left_list_private,
@@ -389,7 +389,7 @@ static int clm_nodejoin_send (void)
 }
 
 static int clm_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
     struct in_addr *left_list, void *left_list_private,

+ 2 - 2
exec/evs.c

@@ -70,7 +70,7 @@ static DECLARE_LIST_INIT (confchg_notify);
 static int evs_executive_initialize (void);
 
 static int evs_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
     struct in_addr *left_list, void *left_list_private,
@@ -151,7 +151,7 @@ static int evs_exit_fn (struct conn_info *conn_info)
 }
 
 static int evs_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
     struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
     struct in_addr *left_list, void *left_list_private,

+ 4 - 4
exec/evt.c

@@ -81,7 +81,7 @@ static int lib_evt_event_data_get(struct conn_info *conn_info,
 		void *message);
 
 static int evt_conf_change(
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private,
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -2695,7 +2695,7 @@ static void remove_chan_open_info(SaClmNodeIdT node_id)
  * received for each node for the detection of duplicate events.
  */
 static int evt_conf_change(
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private,
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -2726,7 +2726,7 @@ static int evt_conf_change(
 	 * we only care about the final membership from the regular
 	 * configuration.
 	 */
-	if (configuration_type == TOTEMPG_CONFIGURATION_TRANSITIONAL) {
+	if (configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
 
 		left_member_count = left_list_entries;
 
@@ -2747,7 +2747,7 @@ static int evt_conf_change(
 		}
 	}
 
-	if (configuration_type == TOTEMPG_CONFIGURATION_REGULAR) {
+	if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
 
 		joined_member_count = joined_list_entries;
 		total_member_count = member_list_entries;

+ 1 - 1
exec/handlers.h

@@ -51,7 +51,7 @@ struct service_handler {
 	int (**aisexec_handler_fns) (void *msg, struct in_addr source_addr, int endian_conversion_needed);
 	int aisexec_handler_fns_count;
 	int (*confchg_fn) (
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private,
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,

+ 1 - 1
exec/main.c

@@ -736,7 +736,7 @@ static void deliver_fn (
 }
 
 static void confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
 	struct in_addr *left_list, void *left_list_private,

+ 1 - 1
exec/parse.h

@@ -59,7 +59,7 @@ struct openais_config {
 	/*
 	 * network
 	 */
-    struct totempg_interface *interfaces;
+    struct totem_interface *interfaces;
     int interface_count;
 	struct sockaddr_in mcast_addr;
 

+ 5 - 5
exec/sync.c

@@ -84,7 +84,7 @@ static void sync_barrier_start (struct memb_ring_id *ring_id);
 
 static void sync_service_init (struct memb_ring_id *ring_id);
 
-static int sync_service_process (enum totempg_callback_token_type type, void *data);
+static int sync_service_process (enum totem_callback_token_type type, void *data);
 
 struct req_exec_sync_barrier_start {
 	struct req_header header;
@@ -119,13 +119,13 @@ static void sync_service_init (struct memb_ring_id *ring_id)
 	sync_callbacks[sync_recovery_index].sync_init ();
 	totemsrp_callback_token_destroy (&sync_callback_token_handle);
 	totemsrp_callback_token_create (&sync_callback_token_handle,
-		TOTEMPG_CALLBACK_TOKEN_SENT,
+		TOTEM_CALLBACK_TOKEN_SENT,
 		0, /* don't delete after callback */
 		sync_service_process,
 		(void *)ring_id);
 }
 
-static int sync_service_process (enum totempg_callback_token_type type, void *data)
+static int sync_service_process (enum totem_callback_token_type type, void *data)
 {
 	int res;
 	struct memb_ring_id *ring_id = (struct memb_ring_id *)data;
@@ -160,7 +160,7 @@ void sync_register (struct sync_callbacks *callbacks, int callback_count,
 }
 
 void sync_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
 	struct in_addr *left_list, void *left_list_private,
@@ -171,7 +171,7 @@ void sync_confchg_fn (
 {
 	int i;
 
-	if (configuration_type != TOTEMPG_CONFIGURATION_REGULAR) {
+	if (configuration_type != TOTEM_CONFIGURATION_REGULAR) {
 		return;
 	}
 

+ 1 - 1
exec/sync.h

@@ -50,7 +50,7 @@ void sync_register (struct sync_callbacks *callbacks, int callback_count,
 	void (*synchronization_completed) (void));
 
 void sync_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
 	struct in_addr *left_list, void *left_list_private,

+ 8 - 7
exec/totempg.c

@@ -143,7 +143,7 @@ static void (*app_deliver_fn) (
 		int endian_conversion_required) = 0;
 
 static void (*app_confchg_fn) (
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private, 
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -190,7 +190,7 @@ static struct assembly *find_assembly (struct in_addr addr)
 }
 
 static void totempg_confchg_fn (
-	enum totempg_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private, 
 		int member_list_entries,
 	struct in_addr *left_list, void *left_list_private,
@@ -400,7 +400,7 @@ void totempg_log_printf_init (
 
 void *callback_token_received_handle;
 
-int callback_token_received_fn (enum totemsrp_callback_token_type type,
+int callback_token_received_fn (enum totem_callback_token_type type,
 	void *data)
 {
 	struct totempg_mcast mcast;
@@ -440,7 +440,7 @@ int callback_token_received_fn (enum totemsrp_callback_token_type type,
  */
 int totempg_initialize (
 	struct sockaddr_in *sockaddr_mcast,
-	struct totempg_interface *interfaces,
+	struct totem_interface *interfaces,
 	int interface_count,
 	poll_handle *poll_handle,
 	unsigned char *private_key,
@@ -453,7 +453,7 @@ int totempg_initialize (
 		int iov_len,
 		int endian_conversion_required),
 	void (*confchg_fn) (
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private, 
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -467,7 +467,8 @@ int totempg_initialize (
 	app_deliver_fn = deliver_fn;
 	app_confchg_fn = confchg_fn;
 
-	res = totemsrp_initialize (sockaddr_mcast, (struct totemsrp_interface *)interfaces,
+	res = totemsrp_initialize (sockaddr_mcast,
+		interfaces,
 		interface_count,
 		poll_handle,
 		private_key, private_key_len,
@@ -475,7 +476,7 @@ int totempg_initialize (
 		totempg_deliver_fn, totempg_confchg_fn);
  
 	totemsrp_callback_token_create (&callback_token_received_handle, 
-		TOTEMSRP_CALLBACK_TOKEN_RECEIVED,
+		TOTEM_CALLBACK_TOKEN_RECEIVED,
 		0,
 		callback_token_received_fn,
 		0);

+ 4 - 24
exec/totempg.h

@@ -44,21 +44,6 @@
 #define TOTEMPG_AGREED			0
 #define TOTEMPG_SAFE			1
 
-enum totempg_configuration_type {
-	TOTEMPG_CONFIGURATION_REGULAR,
-	TOTEMPG_CONFIGURATION_TRANSITIONAL	
-};
-
-/*
- * This represents an interface that TOTEMPG binds to
- */
-struct totempg_interface {
-	struct sockaddr_in bindnet;
-	struct sockaddr_in boundto;
-};
-
-extern poll_handle *totempg_poll_handle;
-
 /*
  * Totem Single Ring Protocol
  * depends on poll abstraction, POSIX, IPV4
@@ -79,7 +64,7 @@ void totempg_log_printf_init (
  */
 int totempg_initialize (
 	struct sockaddr_in *sockaddr_mcast,
-	struct totempg_interface *interfaces,
+	struct totem_interface *interfaces,
 	int interface_count,
 	poll_handle *poll_handle,
 	unsigned char *private_key,
@@ -92,7 +77,7 @@ int totempg_initialize (
 		int iov_len,
 		int endian_conversion_required),
 	void (*confchg_fn) (
-		enum totempg_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private, 
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -115,17 +100,12 @@ int totempg_mcast (
 int totempg_send_ok (
 	int msg_size);
 
-enum totempg_callback_token_type {
-        TOTEMPG_CALLBACK_TOKEN_RECEIVED = 1,
-        TOTEMPG_CALLBACK_TOKEN_SENT = 2
-};
-	
 void totempg_token_callback_destroy (void *handle);
 
 int totempg_token_callback_create (void **handle_out,
-	enum totempg_callback_token_type type,
+	enum totem_callback_token_type type,
 	int delete,
-	int (*callback_fn) (enum totempg_callback_token_type type, void *),
+	int (*callback_fn) (enum totem_callback_token_type type, void *),
 	void *data);
 
 #endif /* TOTEMPG_H_DEFINED */

+ 17 - 17
exec/totemsrp.c

@@ -211,8 +211,8 @@ static unsigned int my_old_high_seq_delivered = 0;
 
 struct token_callback_instance {
 	struct list_head list;
-	int (*callback_fn) (enum totemsrp_callback_token_type type, void *);
-	enum totemsrp_callback_token_type callback_type;
+	int (*callback_fn) (enum totem_callback_token_type type, void *);
+	enum totem_callback_token_type callback_type;
 	int delete;
 	void *data;
 };
@@ -417,7 +417,7 @@ void (*totemsrp_deliver_fn) (
 	int endian_conversion_required) = 0;
 
 void (*totemsrp_confchg_fn) (
-	enum totemsrp_configuration_type configuration_type,
+	enum totem_configuration_type configuration_type,
 	struct in_addr *member_list, void *member_list_private,
 		int member_list_entries,
 	struct in_addr *left_list, void *left_list_private,
@@ -518,7 +518,7 @@ void print_msg (unsigned char *msg, int size)
  */
 int totemsrp_initialize (
 	struct sockaddr_in *sockaddr_mcast,
-	struct totemsrp_interface *interfaces,
+	struct totem_interface *interfaces,
 	int interface_count,
 	poll_handle *poll_handle,
 	unsigned char *private_key,
@@ -531,7 +531,7 @@ int totemsrp_initialize (
 		int iov_len,
 		int endian_conversion_required),
 	void (*confchg_fn) (
-		enum totemsrp_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private,
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -1036,7 +1036,7 @@ static void memb_state_operational_enter (void)
 	/*
 	 * Deliver transitional configuration to application
 	 */
-	totemsrp_confchg_fn (TOTEMSRP_CONFIGURATION_TRANSITIONAL,
+	totemsrp_confchg_fn (TOTEM_CONFIGURATION_TRANSITIONAL,
 		my_trans_memb_list, 0, my_trans_memb_entries,
 		left_list, 0, left_list_entries,
 		0, 0, 0, &my_ring_id);
@@ -1048,7 +1048,7 @@ static void memb_state_operational_enter (void)
 	/*
 	 * Deliver regular configuration to application
 	 */
-	totemsrp_confchg_fn (TOTEMSRP_CONFIGURATION_REGULAR,
+	totemsrp_confchg_fn (TOTEM_CONFIGURATION_REGULAR,
 		my_new_memb_list, 0, my_new_memb_entries,
 		0, 0, 0,
 		joined_list, 0, joined_list_entries, &my_ring_id);
@@ -2466,9 +2466,9 @@ void print_stats (void)
 }
 
 int totemsrp_callback_token_create (void **handle_out,
-	enum totemsrp_callback_token_type type,
+	enum totem_callback_token_type type,
 	int delete,
-	int (*callback_fn) (enum totemsrp_callback_token_type type, void *),
+	int (*callback_fn) (enum totem_callback_token_type type, void *),
 	void *data)
 {
 	struct token_callback_instance *handle;
@@ -2483,10 +2483,10 @@ int totemsrp_callback_token_create (void **handle_out,
 	handle->callback_type = type;
 	handle->delete = delete;
 	switch (type) {
-	case TOTEMSRP_CALLBACK_TOKEN_RECEIVED:
+	case TOTEM_CALLBACK_TOKEN_RECEIVED:
 		list_add (&handle->list, &token_callback_received_listhead);
 		break;
-	case TOTEMSRP_CALLBACK_TOKEN_SENT:
+	case TOTEM_CALLBACK_TOKEN_SENT:
 		list_add (&handle->list, &token_callback_sent_listhead);
 		break;
 	}
@@ -2506,7 +2506,7 @@ void totemsrp_callback_token_destroy (void **handle_out)
 	}
 }
 
-void totemsrp_callback_token_type (void *handle)
+void totem_callback_token_type (void *handle)
 {
 	struct token_callback_instance *token_callback_instance = (struct token_callback_instance *)handle;
 
@@ -2514,7 +2514,7 @@ void totemsrp_callback_token_type (void *handle)
 	free (token_callback_instance);
 }
 
-void token_callbacks_execute (enum totemsrp_callback_token_type type)
+void token_callbacks_execute (enum totem_callback_token_type type)
 {
 	struct list_head *list;
 	struct list_head *list_next;
@@ -2523,10 +2523,10 @@ void token_callbacks_execute (enum totemsrp_callback_token_type type)
 	int res;
 
 	switch (type) {
-	case TOTEMSRP_CALLBACK_TOKEN_RECEIVED:
+	case TOTEM_CALLBACK_TOKEN_RECEIVED:
 		callback_listhead = &token_callback_received_listhead;
 		break;
-	case TOTEMSRP_CALLBACK_TOKEN_SENT:
+	case TOTEM_CALLBACK_TOKEN_SENT:
 		callback_listhead = &token_callback_sent_listhead;
 		break;
 	default:
@@ -2659,7 +2659,7 @@ if (random () % 100 < 10) {
 	} while (nfds == 1);
 
 
-	token_callbacks_execute (TOTEMSRP_CALLBACK_TOKEN_RECEIVED);
+	token_callbacks_execute (TOTEM_CALLBACK_TOKEN_RECEIVED);
 
 	switch (memb_state) {
 	case MEMB_STATE_COMMIT:
@@ -2820,7 +2820,7 @@ printf ("I held %0.4f ms\n", ((float)tv_diff.tv_usec) / 100.0);
 				reset_token_retransmit_timeout (); // REVIEWED
 			}
 
-			token_callbacks_execute (TOTEMSRP_CALLBACK_TOKEN_SENT);
+			token_callbacks_execute (TOTEM_CALLBACK_TOKEN_SENT);
 		}
 		break;
 	}

+ 6 - 31
exec/totemsrp.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2004 MontaVista Software, Inc.
+ * Copyright (c) 2003-2005 MontaVista Software, Inc.
  *
  * All rights reserved.
  *
@@ -34,30 +34,10 @@
 #ifndef TOTEMSRP_H_DEFINED
 #define TOTEMSRP_H_DEFINED
 
+#include "totem.h"
 #include "aispoll.h"
 
 #define TOTEMSRP_PACKET_SIZE_MAX	1408
-#define PROCESSOR_COUNT_MAX			16
-
-enum totemsrp_configuration_type {
-	TOTEMSRP_CONFIGURATION_REGULAR,
-	TOTEMSRP_CONFIGURATION_TRANSITIONAL	
-};
-
-struct memb_ring_id {
-	struct in_addr rep;
-	unsigned long long seq;
-} __attribute__((packed));
-
-/*
- * This represents an interface that TOTEMSRP binds to
- */
-struct totemsrp_interface {
-	struct sockaddr_in bindnet;
-	struct sockaddr_in boundto;
-};
-
-extern poll_handle *totemsrp_poll_handle;
 
 /*
  * Totem Single Ring Protocol
@@ -79,7 +59,7 @@ void totemsrp_log_printf_init (
  */
 int totemsrp_initialize (
 	struct sockaddr_in *sockaddr_mcast,
-	struct totemsrp_interface *interfaces,
+	struct totem_interface *interfaces,
 	int interface_count,
 	poll_handle *poll_handle,
 	unsigned char *private_key,
@@ -93,7 +73,7 @@ int totemsrp_initialize (
 		int iov_len,
 		int endian_conversion_required),
 	void (*confchg_fn) (
-		enum totemsrp_configuration_type configuration_type,
+		enum totem_configuration_type configuration_type,
 		struct in_addr *member_list, void *member_list_private, 
 			int member_list_entries,
 		struct in_addr *left_list, void *left_list_private,
@@ -115,16 +95,11 @@ int totemsrp_mcast (
  */
 int totemsrp_avail (void);
 
-enum totemsrp_callback_token_type {
-	TOTEMSRP_CALLBACK_TOKEN_RECEIVED = 1,
-	TOTEMSRP_CALLBACK_TOKEN_SENT = 2
-};
-
 int totemsrp_callback_token_create (
 	void **handle_out,
-	enum totemsrp_callback_token_type type,
+	enum totem_callback_token_type type,
 	int delete,
-	int (*callback_fn) (enum totemsrp_callback_token_type type, void *),
+	int (*callback_fn) (enum totem_callback_token_type type, void *),
 	void *data);
 
 void totemsrp_callback_token_destroy (