Просмотр исходного кода

knet: Change nodeids to 8 bit for new knet compatibility

I've also put an assert in totemknet_member_add() to check
for invalid nodeids. Later on we need to fix the rest of the
corosync code to only use 8bit nodeids (or force people to use
UDPU if they want large nodeids).

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Christine Caulfield 9 лет назад
Родитель
Сommit
d9df98ceba
1 измененных файлов с 9 добавлено и 6 удалено
  1. 9 6
      exec/totemknet.c

+ 9 - 6
exec/totemknet.c

@@ -237,10 +237,10 @@ static int dst_host_filter_callback_fn(void *private_data,
 				       const unsigned char *outdata,
 				       ssize_t outdata_len,
 				       uint8_t tx_rx,
-				       uint16_t this_host_id,
-				       uint16_t src_host_id,
+				       uint8_t this_host_id,
+				       uint8_t src_host_id,
 				       int8_t *channel,
-				       uint16_t *dst_host_ids,
+				       uint8_t *dst_host_ids,
 				       size_t *dst_host_ids_entries)
 {
 	struct totem_message_header *header = (struct totem_message_header *)outdata;
@@ -269,7 +269,7 @@ static void socket_error_callback_fn(void *private_data, int datafd, int8_t chan
 	}
 }
 
-static void host_change_callback_fn(void *private_data, uint16_t host_id, uint8_t reachable, uint8_t remote, uint8_t external)
+static void host_change_callback_fn(void *private_data, uint8_t host_id, uint8_t reachable, uint8_t remote, uint8_t external)
 {
 	struct totemknet_instance *instance = (struct totemknet_instance *)private_data;
 
@@ -383,7 +383,7 @@ int totemknet_ifaces_get (void *knet_context,
 {
 	struct totemknet_instance *instance = (struct totemknet_instance *)knet_context;
 	struct knet_link_status link_status;
-	uint16_t host_list[KNET_MAX_HOST];
+	uint8_t host_list[KNET_MAX_HOST];
 	size_t num_hosts;
 	int i,j;
 	char *ptr;
@@ -559,7 +559,7 @@ static void totemknet_refresh_config(
 	uint32_t value;
 	uint32_t link_no;
 	size_t num_nodes;
-	uint16_t host_ids[KNET_MAX_HOST];
+	uint8_t host_ids[KNET_MAX_HOST];
 	int i;
 	int err;
 	char path[ICMAP_KEYNAME_MAXLEN];
@@ -1032,6 +1032,9 @@ int totemknet_member_add (
 		return 0; /* Don't add ourself, we send loopback messages directly */
 	}
 
+	/* Temp code to catch nodeids that are too big for knet */
+	assert(member->nodeid < 256);
+
 	/* Keep track of the number of links */
 	if (link_no > instance->num_links) {
 		instance->num_links = link_no;