[Openais] Proposed change to default nodeid generation

Andrew Beekhof beekhof at gmail.com
Wed Oct 1 01:38:52 PDT 2008


Revised patch that makes dropping the high bit optional

--- whitetank-svn/exec/totem.h	2008-08-13 22:38:15.000000000 +0200
+++ whitetank-dev/exec/totem.h	2008-10-01 10:35:18.000000000 +0200
@@ -89,6 +89,7 @@ struct totem_config {
 	struct totem_interface *interfaces;
 	int interface_count;
 	unsigned int node_id;
+	unsigned int clear_node_high_bit;

 	/*
 	 * key information
--- whitetank-svn/exec/totemconfig.c	2008-08-13 22:38:15.000000000 +0200
+++ whitetank-dev/exec/totemconfig.c	2008-10-01 10:34:31.000000000 +0200
@@ -173,6 +170,7 @@ extern int totem_config_read (
 		 * Get interface node id
 		 */
 		objdb_get_int (objdb, object_totem_handle, "nodeid", &totem_config->node_id);
+		objdb_get_int (objdb,object_totem_handle, "clear_node_high_bit",
&totem_config->clear_node_high_bit);

 		objdb_get_int (objdb,object_totem_handle, "threads", &totem_config->threads);

Binary files whitetank-svn/exec/totemconfig.o and
whitetank-dev/exec/totemconfig.o differ
Binary files whitetank-svn/exec/totemip.o and
whitetank-dev/exec/totemip.o differ
Binary files whitetank-svn/exec/totemmrp.o and
whitetank-dev/exec/totemmrp.o differ
--- whitetank-svn/exec/totemnet.c	2008-08-13 22:38:15.000000000 +0200
+++ whitetank-dev/exec/totemnet.c	2008-10-01 10:35:44.000000000 +0200
@@ -1227,6 +1227,15 @@ int totemnet_initialize (

 	instance->totemnet_poll_handle = poll_handle;

+	if(instance->totem_config->node_id == 0) {	
+		int32_t nodeid = 0;
+		memcpy (&nodeid, instance->totem_interface->bindnet.addr, sizeof (int32_t));
+		if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
+			nodeid = 0 - nodeid;
+		}
+		instance->totem_config->node_id = nodeid;
+	}
+
 	instance->totem_interface->bindnet.nodeid = instance->totem_config->node_id;

 	instance->context = context;


More information about the Openais mailing list