[openib-general] [PATCH] osm: port to WinIB stack - 64 bits

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Sun Oct 15 07:31:43 PDT 2006


Hi Hal

This patch fixes a few data type problems with OSM on 
64-bit Windows machines.
The changes are done in the following files:

  opensm/osm_prtn_config.c
  opensm/osm_pkey.c
  opensm/osm_qos.c

Note that the casting is done on the calculation result, 
wich is string lenght, index in table, or index in string,
so it's ok to 'downcast' the value.

The patch is for trunk only.

Yevgeny

Signed-off-by:  Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>

Index: opensm/osm_prtn_config.c
===================================================================
--- opensm/osm_prtn_config.c	(revision 9820)
+++ opensm/osm_prtn_config.c	(working copy)
@@ -254,7 +254,7 @@ static int parse_name_token(char *str, c
 		p++;
 
 	q = p + strlen(p);
-	len += q - str + 1;
+	len += (int)(q - str) + 1;
 	while ( q != p &&
 		( *q == '\0' || *q == ' ' || *q == '\t' || *q == '\n'))
 		*q-- = '\0';
@@ -293,7 +293,7 @@ static int parse_part_conf(struct part_c
 	if (*p == '\t' || *p == '\0' || *p == '\n')
 		p++;
 
-	len += p - str;
+	len += (int)(p - str);
 	str = p;
 
 	if (conf->p_prtn)
Index: opensm/osm_pkey.c
===================================================================
--- opensm/osm_pkey.c	(revision 9820)
+++ opensm/osm_pkey.c	(working copy)
@@ -297,7 +297,7 @@ osm_pkey_tbl_get_block_and_idx(
 	(p_pkey < block->pkey_entry + IB_NUM_PKEY_ELEMENTS_IN_BLOCK))
     {
 	*p_block_idx = block_index;
-	*p_pkey_idx = p_pkey - block->pkey_entry;
+	*p_pkey_idx = (uint8_t)(p_pkey - block->pkey_entry);
 	return(IB_SUCCESS);
     }
   }
Index: opensm/osm_qos.c
===================================================================
--- opensm/osm_qos.c	(revision 9820)
+++ opensm/osm_qos.c	(working copy)
@@ -399,7 +399,7 @@ static int parse_one_unsigned(char *str,
 	*val = strtoul(str, &end, 0);
 	if (*end)
 		end++;
-	return end - str;
+	return (int)(end - str);
 }
 
 static int parse_vlarb_entry(char *str, ib_vl_arb_element_t * e)
@@ -410,7 +410,7 @@ static int parse_vlarb_entry(char *str, 
 	e->vl = val % 15;
 	p += parse_one_unsigned(p, ',', &val);
 	e->weight = (uint8_t)val;
-	return p - str;
+	return (int)(p - str);
 }
 
 static int parse_sl2vl_entry(char *str, uint8_t * raw)
@@ -420,7 +420,7 @@ static int parse_sl2vl_entry(char *str, 
 	p += parse_one_unsigned(p, ',', &val1);
 	p += parse_one_unsigned(p, ',', &val2);
 	*raw = (val1 << 4) | (val2 & 0xf);
-	return p - str;
+	return (int)(p - str);
 }
 
 static void qos_build_config(struct qos_config *cfg,





More information about the general mailing list