[openib-general] [PATCH] Opensm - fix casting for windows

Yael Kalka yael at mellanox.co.il
Mon Feb 6 01:27:59 PST 2006


Hi Hal,

The following patch adds some missing casts and fixes object types to
fix compilation errors in the windows stack, aadds some changes in
osm_db_file.c to match the windows stack.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: opensm/osm_db_pack.c
===================================================================
--- opensm/osm_db_pack.c	(revision 5307)
+++ opensm/osm_db_pack.c	(working copy)
@@ -80,13 +80,13 @@ __osm_unpack_lids(
   if (! p_num) return 1;
   tmp = strtoul(p_num, NULL, 0);
   CL_ASSERT( tmp < 0x10000 );
-  *p_min_lid = tmp;
+  *p_min_lid = (uint16_t)tmp;
 
   p_num = strtok_r(NULL, " \t", &p_next);
   if (! p_num) return 1;
   tmp = strtoul(p_num, NULL, 0);
   CL_ASSERT( tmp < 0x10000 );
-  *p_max_lid = tmp;
+  *p_max_lid = (uint16_t)tmp;
   
   return 0;
 }
Index: opensm/osm_lid_mgr.c
===================================================================
--- opensm/osm_lid_mgr.c	(revision 5307)
+++ opensm/osm_lid_mgr.c	(working copy)
@@ -742,7 +742,7 @@ void
 {
   cl_ptr_vector_t *p_discovered_vec = &p_mgr->p_subn->port_lid_tbl;
   uint16_t         lid, min_lid, max_lid;
-  uint16_t         max_tbl_lid = cl_ptr_vector_get_size( p_discovered_vec );
+  uint16_t         max_tbl_lid = (uint16_t)(cl_ptr_vector_get_size( p_discovered_vec ));
 
   osm_port_get_lid_range_ho(p_port, &min_lid, &max_lid);
   for (lid = min_lid; lid <= max_lid; lid++)
Index: opensm/osm_pkey.c
===================================================================
--- opensm/osm_pkey.c	(revision 5307)
+++ opensm/osm_pkey.c	(working copy)
@@ -76,7 +76,7 @@ void osm_pkey_tbl_destroy( 
   IN osm_pkey_tbl_t *p_pkey_tbl)
 {
   uint16_t num_blocks, i;
-  num_blocks = cl_ptr_vector_get_size( &p_pkey_tbl->blocks );
+  num_blocks = (uint16_t)(cl_ptr_vector_get_size( &p_pkey_tbl->blocks ));
   for (i = 0; i < num_blocks; i++)
     cl_free(cl_ptr_vector_get( &p_pkey_tbl->blocks, i ));
   cl_ptr_vector_destroy( &p_pkey_tbl->blocks );
@@ -202,7 +202,8 @@ osm_physp_share_pkey(
   IN const osm_physp_t*  const p_physp_1,
   IN const osm_physp_t*  const p_physp_2 ) {
 
-  ib_net16_t *pkey1, *pkey2, pkey1_base, pkey2_base;
+  ib_net16_t *pkey1, *pkey2;
+  uint64_t pkey1_base, pkey2_base;
   const osm_pkey_tbl_t *pkey_tbl1, *pkey_tbl2;
   cl_map_iterator_t map_iter1, map_iter2;
 
Index: opensm/osm_pkey_mgr.c
===================================================================
--- opensm/osm_pkey_mgr.c	(revision 5307)
+++ opensm/osm_pkey_mgr.c	(working copy)
@@ -234,7 +234,7 @@ osm_pkey_mgr_process(
    osm_node_t *p_node;
    osm_node_t *p_next_node;
 
-   uint32_t port_num;
+   uint8_t port_num;
    osm_physp_t *p_physp;
    osm_signal_t result = OSM_SIGNAL_DONE;
 
Index: opensm/osm_trap_rcv.c
===================================================================
--- opensm/osm_trap_rcv.c	(revision 5307)
+++ opensm/osm_trap_rcv.c	(working copy)
@@ -135,7 +135,7 @@ osm_trap_rcv_aging_tracker_callback(
     /* We got an exit flag - do nothing */
     return 0;
 
-  lid = (uint16_t)cl_ntoh16(( key & 0x0000FFFF00000000ULL) >> 32);
+  lid = cl_ntoh16((uint16_t)(( key & 0x0000FFFF00000000ULL) >> 32));
   port_num = (uint8_t)(( key & 0x00FF000000000000ULL) >> 48);
 
   p_physp = __get_physp_by_lid_and_num( p_rcv, lid, port_num );
Index: opensm/osm_ucast_updn.c
===================================================================
--- opensm/osm_ucast_updn.c	(revision 5307)
+++ opensm/osm_ucast_updn.c	(working copy)
@@ -620,7 +620,8 @@ updn_subn_rank(
 {
   /* Init local vars */
   osm_port_t *p_root_port=NULL;
-  uint8_t tbl_size,rank=base_rank;
+  uint16_t tbl_size;
+  uint8_t rank=base_rank;
   osm_physp_t   *p_physp, *p_remote_physp,*p_physp_temp;
   cl_list_t     *p_currList,*p_nextList;
   cl_status_t did_cause_update;
@@ -639,7 +640,7 @@ updn_subn_rank(
   p_currList = p_nextList;
 
   /* Check valid subnet & guid */
-  tbl_size = cl_qmap_count(&(osm.subn.port_guid_tbl));
+  tbl_size = (uint16_t)(cl_qmap_count(&(osm.subn.port_guid_tbl)));
   if (tbl_size == 0)
   {
     osm_log(&(osm.log), OSM_LOG_ERROR,
@@ -1078,7 +1079,7 @@ osm_updn_find_root_nodes_by_min_hop( OUT
     uint8_t hop_val;
     uint16_t numHopBarsOverThd1 = 0;
     uint16_t numHopBarsOverThd2 = 0;
-    float thd1,thd2;
+    double thd1,thd2;
 
     p_sw = p_next_sw;
     /* Roll to the next switch */




More information about the general mailing list