[openib-general] [PATCH] OpenSM/memory allocation: Deprecate cl_malloc/zalloc/free and use malloc/free directly
Hal Rosenstock
halr at voltaire.com
Wed May 24 10:44:48 PDT 2006
OpenSM/memory allocation: Deprecate cl_malloc/zalloc/free and friends,
and use malloc/free directly
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
Index: osm/include/opensm/osm_port.h
===================================================================
--- osm/include/opensm/osm_port.h (revision 7470)
+++ osm/include/opensm/osm_port.h (working copy)
@@ -50,9 +50,9 @@
#ifndef _OSM_PORT_H_
#define _OSM_PORT_H_
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_qmap.h>
-#include <complib/cl_memory.h>
#include <iba/ib_types.h>
#include <opensm/osm_base.h>
#include <opensm/osm_subnet.h>
@@ -1374,7 +1374,7 @@ osm_port_delete(
IN OUT osm_port_t** const pp_port )
{
osm_port_destroy( *pp_port );
- cl_free( *pp_port );
+ free( *pp_port );
*pp_port = NULL;
}
/*
Index: osm/include/opensm/osm_rand_fwd_tbl.h
===================================================================
--- osm/include/opensm/osm_rand_fwd_tbl.h (revision 7470)
+++ osm/include/opensm/osm_rand_fwd_tbl.h (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -50,8 +50,8 @@
#ifndef _OSM_RAND_FWD_TBL_H_
#define _OSM_RAND_FWD_TBL_H_
+#include <stdlib.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_base.h>
#ifdef __cplusplus
@@ -125,7 +125,7 @@ osm_rand_tbl_delete(
/*
TO DO - This is a place holder function only!
*/
- cl_free( *pp_tbl );
+ free( *pp_tbl );
*pp_tbl = NULL;
}
/*
Index: osm/include/complib/cl_memory.h
===================================================================
--- osm/include/complib/cl_memory.h (revision 7470)
+++ osm/include/complib/cl_memory.h (working copy)
@@ -96,7 +96,7 @@ BEGIN_C_DECLS
*
* SYNOPSIS
*/
-void
+void __attribute__((deprecated))
__cl_mem_track(
IN const boolean_t start );
/*
@@ -135,7 +135,7 @@ __cl_mem_track(
*
* SYNOPSIS
*/
-void
+void __attribute__((deprecated))
cl_mem_display( void );
/*
* RETURN VALUE
@@ -162,7 +162,7 @@ cl_mem_display( void );
*
* SYNOPSIS
*/
-boolean_t
+boolean_t __attribute__((deprecated))
cl_mem_check( void );
/*
* RETURN VALUE
@@ -189,7 +189,7 @@ cl_mem_check( void );
*
* SYNOPSIS
*/
-void*
+void __attribute__((deprecated)) *
__cl_malloc_trk(
IN const char* const p_file_name,
IN const int32_t line_num,
@@ -232,7 +232,7 @@ __cl_malloc_trk(
*
* SYNOPSIS
*/
-void*
+void __attribute__((deprecated)) *
__cl_zalloc_trk(
IN const char* const p_file_name,
IN const int32_t line_num,
@@ -274,7 +274,7 @@ __cl_zalloc_trk(
*
* SYNOPSIS
*/
-void*
+void __attribute__((deprecated)) *
__cl_malloc_ntrk(
IN const size_t size );
/*
@@ -308,7 +308,7 @@ __cl_malloc_ntrk(
*
* SYNOPSIS
*/
-void*
+void __attribute__((deprecated)) *
__cl_zalloc_ntrk(
IN const size_t bytes );
/*
@@ -341,7 +341,7 @@ __cl_zalloc_ntrk(
*
* SYNOPSIS
*/
-void
+void __attribute__((deprecated))
__cl_free_trk(
IN const char* const p_file_name,
IN const int32_t line_num,
@@ -384,7 +384,7 @@ __cl_free_trk(
*
* SYNOPSIS
*/
-void
+void __attribute__((deprecated))
__cl_free_ntrk(
IN void* const p_memory );
/*
@@ -418,7 +418,7 @@ __cl_free_ntrk(
*
* SYNOPSIS
*/
-void*
+void __attribute__((deprecated)) *
cl_malloc(
IN const size_t size );
/*
@@ -449,7 +449,7 @@ cl_malloc(
*
* SYNOPSIS
*/
-void*
+void __attribute__((deprecated)) *
cl_zalloc(
IN const size_t size );
/*
@@ -480,7 +480,7 @@ cl_zalloc(
*
* SYNOPSIS
*/
-void
+void __attribute__((deprecated))
cl_free(
IN void* const p_memory );
/*
Index: osm/include/complib/cl_memtrack.h
===================================================================
--- osm/include/complib/cl_memtrack.h (revision 7470)
+++ osm/include/complib/cl_memtrack.h (working copy)
@@ -79,7 +79,7 @@ typedef struct _cl_mem_tracker
/* List to manage free headers. */
cl_qlist_t free_hdr_list;
-} cl_mem_tracker_t;
+} cl_mem_tracker_t __attribute__((deprecated));
#define FILE_NAME_LENGTH 64
@@ -93,7 +93,7 @@ typedef struct _cl_malloc_hdr
char file_name[FILE_NAME_LENGTH];
int32_t line_num;
-} cl_malloc_hdr_t;
+} cl_malloc_hdr_t __attribute__((deprecated));
extern cl_mem_tracker_t *gp_mem_tracker;
Index: osm/include/vendor/osm_vendor_mlx_svc.h
===================================================================
--- osm/include/vendor/osm_vendor_mlx_svc.h (revision 7470)
+++ osm/include/vendor/osm_vendor_mlx_svc.h (working copy)
@@ -40,7 +40,6 @@
#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <vendor/osm_vendor_mlx_defs.h>
#ifdef __cplusplus
@@ -191,9 +190,10 @@ osmv_mad_copy(IN const ib_mad_t *p_mad)
uint8_t *p_copy;
CL_ASSERT(p_mad);
- p_copy = cl_zalloc(MAD_BLOCK_SIZE);
+ p_copy = malloc(MAD_BLOCK_SIZE);
if (NULL != p_copy) {
+ memset(p_copy, 0, MAD_BLOCK_SIZE);
memcpy(p_copy, p_mad, MAD_BLOCK_SIZE);
}
Index: osm/libvendor/osm_vendor_mlx_ts.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_ts.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_ts.c (working copy)
@@ -51,6 +51,7 @@
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#include <vendor/osm_vendor_api.h>
@@ -58,7 +59,6 @@
#include <vendor/osm_vendor_mlx_dispatcher.h>
#include <vendor/osm_vendor_mlx_svc.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_ts_useraccess.h>
typedef struct _osmv_TOPSPIN_transport_mgr_ {
@@ -187,7 +187,7 @@ osmv_transport_init(IN osm_bind_info_t *
char device_file[16];
int device_fd;
int ts_ioctl_ret;
- osmv_TOPSPIN_transport_mgr_t* p_mgr = cl_zalloc(sizeof(osmv_TOPSPIN_transport_mgr_t));
+ osmv_TOPSPIN_transport_mgr_t* p_mgr = malloc(sizeof(osmv_TOPSPIN_transport_mgr_t));
int qpn;
if (!p_mgr)
@@ -195,6 +195,8 @@ osmv_transport_init(IN osm_bind_info_t *
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_mgr, 0, sizeof(osmv_TOPSPIN_transport_mgr_t));
+
/* open TopSpin file device */
/* HACK: assume last char in hostid is the HCA index */
sprintf(device_file, "/dev/ts_ua%u", hca_idx);
@@ -414,7 +416,7 @@ osmv_transport_done(IN const osm_bind_ha
/* seems the only way to abort a blocking read is to make it read something */
__osm_transport_gen_dummy_mad(p_bo);
cl_thread_destroy(&(p_tpot_mgr->receiver));
- cl_free(p_tpot_mgr);
+ free(p_tpot_mgr);
}
static void
Index: osm/libvendor/osm_vendor_mtl_transaction_mgr.c
===================================================================
--- osm/libvendor/osm_vendor_mtl_transaction_mgr.c (revision 7470)
+++ osm/libvendor/osm_vendor_mtl_transaction_mgr.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -40,7 +40,7 @@
#endif /* HAVE_CONFIG_H */
#include <math.h>
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <opensm/osm_helper.h>
#include <opensm/osm_log.h>
#include <vendor/osm_vendor.h>
@@ -279,7 +279,7 @@ osm_transaction_mgr_init( IN osm_vendor_
CL_ASSERT( p_vend->p_transaction_mgr == NULL );
(osm_transaction_mgr_t*)p_vend->p_transaction_mgr =
- (osm_transaction_mgr_t * ) cl_malloc( sizeof( osm_transaction_mgr_t ) );
+ (osm_transaction_mgr_t * ) malloc( sizeof( osm_transaction_mgr_t ) );
trans_mgr_p = (osm_transaction_mgr_t*)p_vend->p_transaction_mgr;
@@ -289,12 +289,12 @@ osm_transaction_mgr_init( IN osm_vendor_
/* initialize the qlist */
trans_mgr_p->madw_reqs_list_p =
- ( cl_qlist_t * ) cl_malloc( sizeof( cl_qlist_t ) );
+ ( cl_qlist_t * ) malloc( sizeof( cl_qlist_t ) );
cl_qlist_init( trans_mgr_p->madw_reqs_list_p);
/* initialize the qmap */
trans_mgr_p->madw_by_tid_map_p =
- ( cl_qmap_t * ) cl_malloc( sizeof( cl_qmap_t ) );
+ ( cl_qmap_t * ) malloc( sizeof( cl_qmap_t ) );
cl_qmap_init( trans_mgr_p->madw_by_tid_map_p );
/* create the timer used by the madw_req_list */
@@ -352,12 +352,12 @@ osm_transaction_mgr_destroy ( IN osm_ven
p_map_item = &(osm_madw_req_p->map_item);
cl_qmap_remove_item(trans_mgr_p->madw_by_tid_map_p, p_map_item);
/* free the item */
- cl_free(osm_madw_req_p);
+ free(osm_madw_req_p);
p_list_item = cl_qlist_remove_head(trans_mgr_p->madw_reqs_list_p);
}
/* free the qlist and qmap */
- cl_free(trans_mgr_p->madw_reqs_list_p );
- cl_free(trans_mgr_p->madw_by_tid_map_p );
+ free(trans_mgr_p->madw_reqs_list_p );
+ free(trans_mgr_p->madw_by_tid_map_p );
/* reliease and destroy the lock */
cl_spinlock_release( &trans_mgr_p->transaction_mgr_lock );
cl_spinlock_destroy( &(trans_mgr_p->transaction_mgr_lock) );
@@ -365,7 +365,7 @@ osm_transaction_mgr_destroy ( IN osm_ven
cl_timer_trim(&trans_mgr_p->madw_list_timer, 1);
cl_timer_destroy( &trans_mgr_p->madw_list_timer );
/* free the transaction_manager object */
- cl_free(trans_mgr_p);
+ free(trans_mgr_p);
trans_mgr_p = NULL; }
OSM_LOG_EXIT( p_vend->p_log );
@@ -398,7 +398,7 @@ osm_transaction_mgr_insert_madw( IN osm_
timeout = (uint64_t)(p_vend->timeout) * 1000; /* change the miliseconds value of timeout to microseconds. */
waking_time = timeout + cl_get_time_stamp();
- osm_madw_req_p = (osm_madw_req_t *)cl_malloc( sizeof (osm_madw_req_t) );
+ osm_madw_req_p = (osm_madw_req_t *)malloc( sizeof (osm_madw_req_t) );
osm_madw_req_p->p_madw = p_madw;
osm_madw_req_p->waking_time = waking_time;
@@ -476,7 +476,7 @@ osm_transaction_mgr_erase_madw( IN osm_v
"Removed TID:<0x%"PRIx64">.\n", p_mad->trans_id );
/* free the item */
- cl_free(osm_madw_req_p);
+ free(osm_madw_req_p);
}
else
{
Index: osm/libvendor/osm_pkt_randomizer.c
===================================================================
--- osm/libvendor/osm_pkt_randomizer.c (revision 7470)
+++ osm/libvendor/osm_pkt_randomizer.c (working copy)
@@ -58,8 +58,6 @@
#include <unistd.h>
#endif
-#include <complib/cl_memory.h>
-
/**********************************************************************
* Return TRUE if the path is in a fault path, and FALSE otherwise.
* By in a fault path the meaning is that there is a path in the fault
@@ -284,7 +282,7 @@ osm_pkt_randomizer_init(
OSM_LOG_ENTER( p_log, osm_pkt_randomizer_init );
- *pp_pkt_randomizer = cl_zalloc( sizeof( osm_pkt_randomizer_t ) );
+ *pp_pkt_randomizer = malloc( sizeof( osm_pkt_randomizer_t ) );
if ( *pp_pkt_randomizer == NULL )
{
res = IB_INSUFFICIENT_MEMORY;
@@ -317,14 +315,17 @@ osm_pkt_randomizer_init(
/* allocate the fault_dr_paths variable */
/* It is the number of the paths that will be saved as fault = osm_pkt_num_unstable_links */
- (*pp_pkt_randomizer)->fault_dr_paths = cl_zalloc( sizeof( osm_dr_path_t ) *
- (*pp_pkt_randomizer)->osm_pkt_num_unstable_links );
+ (*pp_pkt_randomizer)->fault_dr_paths = malloc( sizeof( osm_dr_path_t ) *
+ (*pp_pkt_randomizer)->osm_pkt_num_unstable_links );
if ( (*pp_pkt_randomizer)->fault_dr_paths == NULL )
{
res = IB_INSUFFICIENT_MEMORY;
goto Exit;
}
+ memset( (*pp_pkt_randomizer)->fault_dr_paths, 0,
+ sizeof( osm_dr_path_t ) * (*pp_pkt_randomizer)->osm_pkt_num_unstable_links );
+
Exit:
OSM_LOG_EXIT( p_log );
return (res);
@@ -341,8 +342,8 @@ osm_pkt_randomizer_destroy(
if ( *pp_pkt_randomizer != NULL )
{
- cl_free( (*pp_pkt_randomizer)->fault_dr_paths );
- cl_free( *pp_pkt_randomizer );
+ free( (*pp_pkt_randomizer)->fault_dr_paths );
+ free( *pp_pkt_randomizer );
}
OSM_LOG_EXIT( p_log );
}
Index: osm/libvendor/osm_vendor_mlx_hca.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_hca.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_hca.c (working copy)
@@ -46,8 +46,8 @@
#include <vapi_types.h>
#include <evapi.h>
#include <vendor/osm_vendor_api.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_log.h>
+#include <stdlib.h>
#include <stdio.h>
/********************************************************************************
@@ -130,8 +130,8 @@ __osm_vendor_get_ca_ids( IN osm_vendor_t
/* allocate and really call - user of this function needs to deallocate it */
*p_hca_ids =
- ( VAPI_hca_id_t * ) cl_malloc( *p_num_guids *
- sizeof( VAPI_hca_id_t ) );
+ ( VAPI_hca_id_t * ) malloc( *p_num_guids *
+ sizeof( VAPI_hca_id_t ) );
/* now call it really */
vapi_res = EVAPI_list_hcas( *p_num_guids, p_num_guids, *p_hca_ids );
@@ -221,15 +221,15 @@ __osm_ca_info_init( IN osm_vendor_t * co
memcpy( &( p_ca_info->guid ), hca_cap.node_guid, 8 * sizeof( u_int8_t ) );
p_ca_info->attr_size = 1;
p_ca_info->p_attr =
- ( ib_ca_attr_t * ) cl_malloc( sizeof( ib_ca_attr_t ) );
+ ( ib_ca_attr_t * ) malloc( sizeof( ib_ca_attr_t ) );
memcpy( &( p_ca_info->p_attr->ca_guid ), hca_cap.node_guid,
8 * sizeof( u_int8_t ) );
/* now obtain the attributes of the ports */
p_ca_info->p_attr->num_ports = hca_cap.phys_port_num;
p_ca_info->p_attr->p_port_attr =
- ( ib_port_attr_t * ) cl_malloc( hca_cap.phys_port_num *
- sizeof( ib_port_attr_t ) );
+ ( ib_port_attr_t * ) malloc( hca_cap.phys_port_num *
+ sizeof( ib_port_attr_t ) );
for( port_num = 0; port_num < p_ca_info->p_attr->num_ports; port_num++ )
{
@@ -250,7 +250,7 @@ __osm_ca_info_init( IN osm_vendor_t * co
VAPI_query_hca_gid_tbl( hca_hndl, port_num + 1, 0, &maxNumGids,
NULL );
p_port_gid =
- ( IB_gid_t * ) cl_malloc( maxNumGids * sizeof( IB_gid_t ) );
+ ( IB_gid_t * ) malloc( maxNumGids * sizeof( IB_gid_t ) );
vapi_res =
VAPI_query_hca_gid_tbl( hca_hndl, port_num + 1, maxNumGids,
@@ -270,7 +270,7 @@ __osm_ca_info_init( IN osm_vendor_t * co
p_ca_info->p_attr->p_port_attr[port_num].link_state = hca_port.state;
p_ca_info->p_attr->p_port_attr[port_num].sm_lid = hca_port.sm_lid;
- cl_free( p_port_gid );
+ free( p_port_gid );
}
status = IB_SUCCESS;
@@ -299,14 +299,14 @@ osm_ca_info_destroy( IN osm_vendor_t * c
{
if(0 != p_ca->p_attr->num_ports)
{
- cl_free( p_ca->p_attr->p_port_attr );
+ free( p_ca->p_attr->p_port_attr );
}
- cl_free( p_ca->p_attr);
+ free( p_ca->p_attr);
}
}
- cl_free( p_ca_info );
+ free( p_ca_info );
OSM_LOG_EXIT( p_vend->p_log );
}
@@ -349,7 +349,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
}
/* Allocate an array big enough to hold the ca info objects*/
- p_ca_infos = cl_zalloc( ca_count * sizeof( osm_ca_info_t ) );
+ p_ca_infos = malloc( ca_count * sizeof( osm_ca_info_t ) );
if( p_ca_infos == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -358,6 +358,8 @@ osm_vendor_get_all_port_attr( IN osm_ven
goto Exit;
}
+ memset( p_ca_infos, 0, ca_count * sizeof( osm_ca_info_t ) );
+
/*
* For each CA, retrieve the CA info attributes
*/
@@ -409,7 +411,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
Exit:
if( p_ca_ids )
- cl_free( p_ca_ids );
+ free( p_ca_ids );
if ( p_ca_infos )
{
@@ -504,7 +506,7 @@ osm_vendor_get_guid_ca_and_port(
VAPI_query_hca_gid_tbl( hca_hndl, portIdx + 1, 0, &maxNumGids,
NULL );
p_port_gid =
- ( IB_gid_t * ) cl_malloc( maxNumGids * sizeof( IB_gid_t ) );
+ ( IB_gid_t * ) malloc( maxNumGids * sizeof( IB_gid_t ) );
/* get the port guid */
vapi_res =
@@ -533,7 +535,7 @@ osm_vendor_get_guid_ca_and_port(
goto Exit;
}
- cl_free( p_port_gid );
+ free( p_port_gid );
p_port_gid = NULL;
} /* ALL PORTS */
} /* all HCAs */
@@ -546,9 +548,9 @@ osm_vendor_get_guid_ca_and_port(
Exit:
if( p_ca_ids != NULL )
- cl_free( p_ca_ids );
+ free( p_ca_ids );
if( p_port_gid != NULL )
- cl_free( p_port_gid );
+ free( p_port_gid );
OSM_LOG_EXIT( p_vend->p_log );
return ( status );
}
Index: osm/libvendor/osm_vendor_mlx_sa.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_sa.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_sa.c (working copy)
@@ -40,8 +40,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_debug.h>
#include <complib/cl_timer.h>
#include <vendor/osm_vendor_api.h>
@@ -181,7 +181,7 @@ __osmv_sa_mad_rcv_cb(
Exit:
/* free the copied query request if found */
- if (p_query_req_copy) cl_free(p_query_req_copy);
+ if (p_query_req_copy) free(p_query_req_copy);
/* put back the request madw */
if (p_req_madw)
@@ -227,7 +227,7 @@ __osmv_sa_mad_err_cb(
if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)
cl_event_signal( &p_bind->sync_event );
- if (p_query_req_copy) cl_free(p_query_req_copy);
+ if (p_query_req_copy) free(p_query_req_copy);
OSM_LOG_EXIT( p_bind->p_log );
}
@@ -289,7 +289,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(
/* allocate the attributes */
p_attr_array =
- (ib_port_attr_t *)cl_malloc(sizeof(ib_port_attr_t)*num_ports);
+ (ib_port_attr_t *)malloc(sizeof(ib_port_attr_t)*num_ports);
/* obtain the attributes */
status = osm_vendor_get_all_port_attr(p_vend, p_attr_array, &num_ports);
@@ -300,7 +300,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(
"Fail to get port attributes (error: %s)\n",
ib_get_err_str(status)
);
- cl_free(p_attr_array);
+ free(p_attr_array);
goto Exit;
}
@@ -321,7 +321,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(
}
}
- cl_free(p_attr_array);
+ free(p_attr_array);
Exit:
OSM_LOG_EXIT( p_vend->p_log );
@@ -361,7 +361,7 @@ osmv_bind_sa(
/* allocate the new sa bind info */
p_sa_bind_info =
- (osmv_sa_bind_info_t *)cl_malloc(sizeof(osmv_sa_bind_info_t));
+ (osmv_sa_bind_info_t *)malloc(sizeof(osmv_sa_bind_info_t));
if (! p_sa_bind_info)
{
osm_log( p_log, OSM_LOG_ERROR,
@@ -389,7 +389,7 @@ osmv_bind_sa(
if (p_sa_bind_info->h_bind == OSM_BIND_INVALID_HANDLE)
{
- cl_free(p_sa_bind_info);
+ free(p_sa_bind_info);
p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
osm_log( p_log, OSM_LOG_ERROR,
"osmv_bind_sa: ERR 0506: "
@@ -406,7 +406,7 @@ osmv_bind_sa(
&p_sa_bind_info->sm_lid);
if (status != IB_SUCCESS)
{
- cl_free(p_sa_bind_info);
+ free(p_sa_bind_info);
p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
osm_log( p_log, OSM_LOG_ERROR,
"osmv_bind_sa: ERR 0507: "
@@ -424,7 +424,7 @@ osmv_bind_sa(
"cl_init_event failed: %s\n",
ib_get_err_str(cl_status)
);
- cl_free(p_sa_bind_info);
+ free(p_sa_bind_info);
p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
}
@@ -586,7 +586,7 @@ __osmv_send_sa_req(
To store on the MADW we cast it into what opensm has:
p_madw->context.arb_context.context1
*/
- p_query_req_copy = cl_malloc(sizeof(*p_query_req_copy));
+ p_query_req_copy = malloc(sizeof(*p_query_req_copy));
*p_query_req_copy = *p_query_req;
p_madw->context.arb_context.context1 = p_query_req_copy;
Index: osm/libvendor/osm_vendor_mlx_hca_pfs.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_hca_pfs.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_hca_pfs.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -43,8 +43,8 @@
#undef IN
#undef OUT
#include <vendor/osm_vendor_api.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_log.h>
+#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
@@ -516,14 +516,14 @@ __osm_ca_info_init( IN osm_vendor_t * co
/* set size of attributes and allocate them */
p_ca_info->attr_size = 1;
- p_ca_info->p_attr = ( ib_ca_attr_t * ) cl_malloc( sizeof( ib_ca_attr_t ) );
+ p_ca_info->p_attr = ( ib_ca_attr_t * ) malloc( sizeof( ib_ca_attr_t ) );
p_ca_info->p_attr->ca_guid = p_ca_info->guid;
p_ca_info->p_attr->num_ports = pfs_ca_info.num_ports;
/* now obtain the attributes of the ports */
p_ca_info->p_attr->p_port_attr =
- ( ib_port_attr_t * ) cl_malloc( pfs_ca_info.num_ports * sizeof( ib_port_attr_t ) );
+ ( ib_port_attr_t * ) malloc( pfs_ca_info.num_ports * sizeof( ib_port_attr_t ) );
/* get all the ports info */
for( port_num = 1; port_num <= pfs_ca_info.num_ports; port_num++ )
@@ -581,14 +581,14 @@ osm_ca_info_destroy( IN osm_vendor_t * c
{
if(0 != p_ca->p_attr->num_ports)
{
- cl_free( p_ca->p_attr->p_port_attr );
+ free( p_ca->p_attr->p_port_attr );
}
- cl_free( p_ca->p_attr);
+ free( p_ca->p_attr);
}
}
- cl_free( p_ca_info );
+ free( p_ca_info );
OSM_LOG_EXIT( p_vend->p_log );
}
@@ -628,7 +628,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
}
/* Allocate an array big enough to hold the ca info objects*/
- p_ca_infos = cl_zalloc( ca_count * sizeof( osm_ca_info_t ) );
+ p_ca_infos = malloc( ca_count * sizeof( osm_ca_info_t ) );
if( p_ca_infos == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -637,6 +637,8 @@ osm_vendor_get_all_port_attr( IN osm_ven
goto Exit;
}
+ memset( p_ca_infos, 0, ca_count * sizeof( osm_ca_info_t ) );
+
/*
* For each CA, retrieve the CA info attributes
*/
Index: osm/libvendor/osm_vendor_ibumad_sa.c
===================================================================
--- osm/libvendor/osm_vendor_ibumad_sa.c (revision 7470)
+++ osm/libvendor/osm_vendor_ibumad_sa.c (working copy)
@@ -38,13 +38,12 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <vendor/osm_vendor_api.h>
#include <vendor/osm_vendor_sa_api.h>
#include <sys/time.h>
-#include <complib/cl_memory.h>
-
#define MAX_PORTS 64
/*****************************************************************************
@@ -180,7 +179,7 @@ __osmv_sa_mad_rcv_cb(
Exit:
/* free the copied query request if found */
- if (p_query_req_copy) cl_free(p_query_req_copy);
+ if (p_query_req_copy) free(p_query_req_copy);
OSM_LOG_EXIT( p_bind->p_log );
}
@@ -221,7 +220,7 @@ __osmv_sa_mad_err_cb(
if ((p_query_req_copy->flags & OSM_SA_FLAGS_SYNC) == OSM_SA_FLAGS_SYNC)
cl_event_signal( &p_bind->sync_event );
- if (p_query_req_copy) cl_free(p_query_req_copy);
+ if (p_query_req_copy) free(p_query_req_copy);
OSM_LOG_EXIT( p_bind->p_log );
}
@@ -282,7 +281,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(
/* allocate the attributes */
p_attr_array =
- (ib_port_attr_t *)cl_malloc(sizeof(ib_port_attr_t)*num_ports);
+ (ib_port_attr_t *)malloc(sizeof(ib_port_attr_t)*num_ports);
/* obtain the attributes */
status = osm_vendor_get_all_port_attr(p_vend, p_attr_array, &num_ports);
@@ -293,7 +292,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(
"Failed to get port attributes (error: %s)\n",
ib_get_err_str(status)
);
- cl_free(p_attr_array);
+ free(p_attr_array);
goto Exit;
}
@@ -314,7 +313,7 @@ __osmv_get_lid_and_sm_lid_by_port_guid(
}
}
- cl_free(p_attr_array);
+ free(p_attr_array);
Exit:
OSM_LOG_EXIT( p_vend->p_log );
@@ -354,7 +353,7 @@ osmv_bind_sa(
/* allocate the new sa bind info */
p_sa_bind_info =
- (osmv_sa_bind_info_t *)cl_malloc(sizeof(osmv_sa_bind_info_t));
+ (osmv_sa_bind_info_t *)malloc(sizeof(osmv_sa_bind_info_t));
if (! p_sa_bind_info)
{
osm_log( p_log, OSM_LOG_ERROR,
@@ -382,7 +381,7 @@ osmv_bind_sa(
if (p_sa_bind_info->h_bind == OSM_BIND_INVALID_HANDLE)
{
- cl_free(p_sa_bind_info);
+ free(p_sa_bind_info);
p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
osm_log( p_log, OSM_LOG_ERROR,
"osmv_bind_sa: ERR 5506: "
@@ -399,7 +398,7 @@ osmv_bind_sa(
&p_sa_bind_info->sm_lid);
if (status != IB_SUCCESS)
{
- cl_free(p_sa_bind_info);
+ free(p_sa_bind_info);
p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
osm_log( p_log, OSM_LOG_ERROR,
"osmv_bind_sa: ERR 5507: "
@@ -417,7 +416,7 @@ osmv_bind_sa(
"cl_init_event failed: %s\n",
ib_get_err_str(cl_status)
);
- cl_free(p_sa_bind_info);
+ free(p_sa_bind_info);
p_sa_bind_info = OSM_BIND_INVALID_HANDLE;
}
@@ -576,7 +575,7 @@ __osmv_send_sa_req(
To store on the MADW we cast it into what opensm has:
p_madw->context.ni_context.node_guid
*/
- p_query_req_copy = cl_malloc(sizeof(*p_query_req_copy));
+ p_query_req_copy = malloc(sizeof(*p_query_req_copy));
*p_query_req_copy = *p_query_req;
p_madw->context.ni_context.node_guid =
(ib_net64_t)(long)p_query_req_copy;
Index: osm/libvendor/osm_vendor_mlx_txn.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_txn.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_txn.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -38,7 +38,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <vendor/osm_vendor_mlx.h>
#include <vendor/osm_vendor_mlx_defs.h>
@@ -86,12 +86,13 @@ osmv_txn_init(IN osm_bind_handle_t
osm_log( p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
"Starting transaction 0x%llX (key=0x%llX)\n", tid, key);
- p_txn = cl_zalloc(sizeof(osmv_txn_ctx_t));
+ p_txn = malloc(sizeof(osmv_txn_ctx_t));
if (! p_txn)
{
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_txn, 0, sizeof(osmv_txn_ctx_t));
p_txn->p_log = p_bo->txn_mgr.p_log;
p_txn->tid = tid;
p_txn->key = key;
@@ -113,7 +114,7 @@ osmv_txn_init(IN osm_bind_handle_t
return IB_SUCCESS;
insert_txn_failed:
- cl_free(p_txn);
+ free(p_txn);
OSM_LOG_EXIT( p_bo->p_vendor->p_log );
return st;
@@ -132,13 +133,15 @@ osmv_txn_init_rmpp_sender(IN osm_bind_ha
osmv_txn_remove_timeout_ev(h_bind, osmv_txn_get_key(p_txn));
p_txn->rmpp_txfr.rmpp_state = OSMV_TXN_RMPP_SENDER;
- p_txn->rmpp_txfr.p_rmpp_send_ctx = cl_zalloc(sizeof(osmv_rmpp_send_ctx_t));
+ p_txn->rmpp_txfr.p_rmpp_send_ctx = malloc(sizeof(osmv_rmpp_send_ctx_t));
if (!p_txn->rmpp_txfr.p_rmpp_send_ctx)
{
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_txn->rmpp_txfr.p_rmpp_send_ctx, 0, sizeof(osmv_rmpp_send_ctx_t));
+
st = osmv_rmpp_send_ctx_init(p_txn->rmpp_txfr.p_rmpp_send_ctx,
(void*)p_madw->p_mad,
p_madw->mad_size,
@@ -171,7 +174,7 @@ osmv_txn_init_rmpp_receiver(IN osm_bind_
p_txn->rmpp_txfr.rmpp_state = OSMV_TXN_RMPP_RECEIVER;
p_txn->rmpp_txfr.is_rmpp_init_by_peer = is_init_by_peer;
- p_txn->rmpp_txfr.p_rmpp_recv_ctx = cl_zalloc(sizeof(osmv_rmpp_recv_ctx_t));
+ p_txn->rmpp_txfr.p_rmpp_recv_ctx = malloc(sizeof(osmv_rmpp_recv_ctx_t));
if (!p_txn->rmpp_txfr.p_rmpp_recv_ctx)
{
@@ -180,6 +183,8 @@ osmv_txn_init_rmpp_receiver(IN osm_bind_
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_txn->rmpp_txfr.p_rmpp_recv_ctx, 0, sizeof(osmv_rmpp_recv_ctx_t));
+
st = osmv_rmpp_recv_ctx_init(p_txn->rmpp_txfr.p_rmpp_recv_ctx,p_txn->p_log);
return st;
@@ -271,7 +276,7 @@ osmv_txn_done(IN osm_bind_handle_t h_bin
osmv_rmpp_recv_ctx_done(p_ctx->rmpp_txfr.p_rmpp_recv_ctx);
}
- cl_free(p_ctx);
+ free(p_ctx);
OSM_LOG_EXIT(p_bo->p_vendor->p_log);
}
@@ -327,12 +332,14 @@ osmv_txnmgr_init(IN osmv_txn_mgr_t *p_tx
{
cl_status_t cl_st = CL_SUCCESS;
- p_tx_mgr->p_event_wheel = cl_zalloc(sizeof(cl_event_wheel_t));
+ p_tx_mgr->p_event_wheel = malloc(sizeof(cl_event_wheel_t));
if (!p_tx_mgr->p_event_wheel)
{
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_tx_mgr->p_event_wheel, 0, sizeof(cl_event_wheel_t));
+
cl_event_wheel_construct(p_tx_mgr->p_event_wheel);
/* NOTE! We are using an extended constructor.
@@ -342,18 +349,20 @@ osmv_txnmgr_init(IN osmv_txn_mgr_t *p_tx
cl_st = cl_event_wheel_init_ex(p_tx_mgr->p_event_wheel, p_log, p_lock);
if (cl_st != CL_SUCCESS)
{
- cl_free(p_tx_mgr->p_event_wheel);
+ free(p_tx_mgr->p_event_wheel);
return (ib_api_status_t)cl_st;
}
- p_tx_mgr->p_txn_map = cl_zalloc(sizeof(cl_qmap_t));
+ p_tx_mgr->p_txn_map = malloc(sizeof(cl_qmap_t));
if (!p_tx_mgr->p_txn_map)
{
cl_event_wheel_destroy(p_tx_mgr->p_event_wheel);
- cl_free(p_tx_mgr->p_event_wheel);
+ free(p_tx_mgr->p_event_wheel);
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_tx_mgr->p_txn_map, 0, sizeof(cl_qmap_t));
+
cl_qmap_init(p_tx_mgr->p_txn_map);
p_tx_mgr->p_log = p_log;
@@ -366,10 +375,10 @@ osmv_txnmgr_done(IN osm_bind_handle_t
osmv_bind_obj_t* p_bo = (osmv_bind_obj_t*)h_bind;
__osmv_txn_all_done(h_bind);
- cl_free(p_bo->txn_mgr.p_txn_map);
+ free(p_bo->txn_mgr.p_txn_map);
cl_event_wheel_destroy(p_bo->txn_mgr.p_event_wheel);
- cl_free(p_bo->txn_mgr.p_event_wheel);
+ free(p_bo->txn_mgr.p_event_wheel);
}
ib_api_status_t
@@ -430,7 +439,7 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr
CL_ASSERT(p_txn);
key = osmv_txn_get_key(p_txn);
- p_obj = cl_zalloc(sizeof(cl_map_obj_t));
+ p_obj = malloc(sizeof(cl_map_obj_t));
if (NULL == p_obj)
return IB_INSUFFICIENT_MEMORY;
@@ -438,6 +447,8 @@ __osmv_txnmgr_insert_txn(IN osmv_txn_mgr
"__osmv_txnmgr_insert_txn: "
"Inserting key: 0x%llX to map ptr:%p\n", key, p_tx_mgr->p_txn_map );
+ memset(p_obj, 0, sizeof(cl_map_obj_t));
+
cl_qmap_set_obj(p_obj,p_txn);
/* assuming lookup with this key was made and the result was IB_NOT_FOUND */
cl_qmap_insert(p_tx_mgr->p_txn_map, key, &p_obj->item);
@@ -484,7 +495,7 @@ __osmv_txnmgr_remove_txn(IN osmv_txn_mg
p_obj = PARENT_STRUCT(p_item, cl_map_obj_t,item);
*pp_txn = cl_qmap_obj(p_obj);
- cl_free(p_obj);
+ free(p_obj);
OSM_LOG_EXIT(p_tx_mgr->p_log);
return IB_SUCCESS;
@@ -506,7 +517,7 @@ __osmv_txn_all_done(osm_bind_handle_t
p_obj = PARENT_STRUCT(p_item,cl_map_obj_t,item);
p_txn = (osmv_txn_ctx_t*)cl_qmap_obj(p_obj);
osmv_txn_done(h_bind, osmv_txn_get_key(p_txn), FALSE);
- cl_free(p_obj);
+ free(p_obj);
/* assuming osmv_txn_done has removed the txn from the map */
p_item = cl_qmap_head(p_bo->txn_mgr.p_txn_map);
}
Index: osm/libvendor/osm_vendor_ibumad.c
===================================================================
--- osm/libvendor/osm_vendor_ibumad.c (revision 7470)
+++ osm/libvendor/osm_vendor_ibumad.c (working copy)
@@ -58,12 +58,12 @@
#ifdef OSM_VENDOR_INTF_OPENIB
#include <unistd.h>
+#include <stdlib.h>
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qlist.h>
#include <complib/cl_thread.h>
#include <complib/cl_math.h>
@@ -507,7 +507,7 @@ osm_vendor_new(
goto Exit;
}
- p_vend = cl_zalloc( sizeof(*p_vend) );
+ p_vend = malloc( sizeof(*p_vend) );
if( p_vend == NULL )
{
osm_log( p_log, OSM_LOG_ERROR,
@@ -516,8 +516,10 @@ osm_vendor_new(
goto Exit;
}
+ memset( p_vend, 0, sizeof(*p_vend) );
+
if (osm_vendor_init( p_vend, p_log, timeout ) < 0) {
- cl_free( p_vend );
+ free( p_vend );
p_vend = NULL;
}
@@ -550,7 +552,7 @@ osm_vendor_delete(
cl_event_destroy( &p_ur->signal );
cl_spinlock_destroy( &(*pp_vend)->cb_lock );
cl_spinlock_destroy( &(*pp_vend)->match_tbl_lock );
- cl_free( *pp_vend );
+ free( *pp_vend );
*pp_vend = NULL;
}
@@ -826,13 +828,14 @@ osm_vendor_bind(
goto Exit;
}
- if (!(p_bind = cl_zalloc( sizeof(*p_bind) ))) {
+ if (!(p_bind = malloc( sizeof(*p_bind) ))) {
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 5425: "
"Unable to allocate internal bind object\n" );
goto Exit;
}
+ memset( p_bind, 0, sizeof(*p_bind) );
p_bind->p_vend = p_vend;
p_bind->port_id = umad_port_id;
p_bind->client_context = context;
@@ -880,7 +883,7 @@ osm_vendor_bind(
"osm_vendor_bind: ERR 5426: "
"Unable to register class %u version %u\n",
p_user_bind->mad_class, p_user_bind->class_version);
- cl_free(p_bind);
+ free(p_bind);
p_bind = 0;
goto Exit;
}
@@ -892,7 +895,7 @@ osm_vendor_bind(
"bad agent id %u or duplicate agent for class %u vers %u\n",
p_bind->agent_id, p_user_bind->mad_class,
p_user_bind->class_version);
- cl_free(p_bind);
+ free(p_bind);
p_bind = 0;
goto Exit;
}
@@ -909,7 +912,7 @@ osm_vendor_bind(
"osm_vendor_bind: ERR 5428: "
"Unable to register class 1 version %u\n",
p_user_bind->class_version);
- cl_free(p_bind);
+ free(p_bind);
p_bind = 0;
goto Exit;
}
@@ -920,7 +923,7 @@ osm_vendor_bind(
"osm_vendor_bind: ERR 5429: "
"bad agent id %u or duplicate agent for class 1 vers %u\n",
p_bind->agent_id1, p_user_bind->class_version);
- cl_free(p_bind);
+ free(p_bind);
p_bind = 0;
goto Exit;
}
Index: osm/libvendor/osm_vendor_mlx_sar.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_sar.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_sar.c (working copy)
@@ -38,10 +38,10 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <vendor/osm_vendor_mlx_sar.h>
-#include <complib/cl_memory.h>
ib_api_status_t
osmv_rmpp_sar_init(osmv_rmpp_sar_t* p_sar, void* p_arbt_mad,
@@ -161,21 +161,10 @@ osmv_rmpp_sar_reassemble_arbt_mad(osmv_r
p_mad= (char*)p_mad+space_left;
}
- cl_free(buf_tmp);
- cl_free(p_obj);
+ free(buf_tmp);
+ free(p_obj);
}
return IB_SUCCESS;
}
-
-
-
-
-
-
-
-
-
-
-
Index: osm/libvendor/osm_vendor_mlx_sim.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_sim.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_sim.c (working copy)
@@ -51,6 +51,7 @@
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#include <vendor/osm_vendor_api.h>
@@ -58,7 +59,6 @@
#include <vendor/osm_vendor_mlx_dispatcher.h>
#include <vendor/osm_vendor_mlx_svc.h>
-#include <complib/cl_memory.h>
/* the simulator messages definition */
#include <ibmgtsim/ibms_client_api.h>
@@ -149,7 +149,7 @@ osmv_transport_init(IN osm_bind_info_t *
IN osmv_bind_obj_t *p_bo)
{
ibms_conn_handle_t conHdl; /* the connection we talk to the simulator through */
- osmv_ibms_transport_mgr_t* p_mgr = cl_zalloc(sizeof(osmv_ibms_transport_mgr_t));
+ osmv_ibms_transport_mgr_t* p_mgr = malloc(sizeof(osmv_ibms_transport_mgr_t));
int qpn;
int ibms_status;
uint64_t port_guid;
@@ -159,6 +159,8 @@ osmv_transport_init(IN osm_bind_info_t *
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_mgr, 0, sizeof(osmv_ibms_transport_mgr_t));
+
/* create the client socket connected to the simulator */
/* also perform the "connect" message - such that we
validate the target guid */
@@ -343,7 +345,7 @@ osmv_transport_done(IN const osm_bind_ha
ibms_disconnect(p_tpot_mgr->conHdl);
/* seems the only way to abort a blocking read is to make it read something */
- cl_free(p_tpot_mgr);
+ free(p_tpot_mgr);
}
static void
Index: osm/libvendor/osm_vendor_umadt.c
===================================================================
--- osm/libvendor/osm_vendor_umadt.c (revision 7470)
+++ osm/libvendor/osm_vendor_umadt.c (working copy)
@@ -59,11 +59,11 @@
#ifdef OSM_VENDOR_INTF_UMADT
+#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qlist.h>
#include <complib/cl_thread.h>
#include <complib/cl_timer.h>
@@ -153,9 +153,11 @@ osm_vendor_new(
OSM_LOG_ENTER( p_log, osm_vendor_new );
- p_umadt_obj = cl_zalloc(sizeof(umadt_obj_t));
+ p_umadt_obj = malloc(sizeof(umadt_obj_t));
if( p_umadt_obj )
{
+ memset( p_umadt_obj, 0, sizeof(umadt_obj_t) );
+
status = osm_vendor_init( (osm_vendor_t*)p_umadt_obj, p_log,
timeout );
if( status != IB_SUCCESS )
@@ -201,7 +203,7 @@ osm_vendor_delete(
p_mad_bind_info = (mad_bind_info_t*)p_list_item;
}
dlclose(p_umadt_obj->umadt_handle);
- cl_free(p_umadt_obj);
+ free(p_umadt_obj);
*pp_vend = NULL;
OSM_LOG_EXIT( p_umadt_obj->p_log );
@@ -354,8 +356,8 @@ osm_vendor_get_ports(
}
pPortAttributesList =
- ( IB_PORT_ATTRIBUTES * ) cl_zalloc ( caAttributes.
- PortAttributesListSize );
+ ( IB_PORT_ATTRIBUTES * ) malloc ( caAttributes.
+ PortAttributesListSize );
if ( pPortAttributesList == NULL )
{
@@ -389,7 +391,7 @@ osm_vendor_get_ports(
pPortAttributesList = pPortAttributesList->Next;
p_port_guid++;
}
- cl_free (caAttributes.PortAttributesList);
+ free (caAttributes.PortAttributesList);
p_umadt_obj->IbtInterface.Vpi.CloseCA ( caHandle );
free_guids = free_guids - caAttributes.Ports ;
@@ -441,12 +443,15 @@ osm_vendor_get(
p_vend_wrap->direction = SEND;
return( (ib_mad_t*)&p_madt_struct->IBMad );
#endif /* 0 */
- p_mad = (ib_mad_t*)cl_zalloc( mad_size );
- if ( !p_mad)
+ p_mad = (ib_mad_t*)malloc( mad_size );
+ if ( !p_mad )
{
p_vend_wrap->p_madt_struct = NULL;
return NULL;
}
+
+ memset(p_mad, 0, mad_size);
+
p_vend_wrap->p_madt_struct = NULL;
p_vend_wrap->direction = SEND;
p_vend_wrap->size =mad_size;
@@ -489,7 +494,7 @@ osm_vendor_put(
/* For a send the PostSend released the MAD with Umadt. Simply dealloacte the */
/* local memory that was allocated on the osm_vendor_get() call. */
/* */
- cl_free(p_mad);
+ free(p_mad);
#if 0
Status = p_umadt_obj->uMadtInterface.uMadtReleaseSendMad(p_mad_bind_info->umadt_handle,
p_vend_wrap->p_madt_struct);
@@ -584,17 +589,21 @@ osm_vendor_send(
p_mad->trans_id = cl_ntoh64(p_mad->trans_id)<<24;
/* */
- /* Creat a transaction context for this send and save the TID and client context. */
+ /* Create a transaction context for this send and save the TID and client context. */
/* */
if ( resp_expected )
{
- p_trans_context = cl_zalloc(sizeof(trans_context_t));
+ p_trans_context = malloc(sizeof(trans_context_t));
CL_ASSERT(p_trans_context);
- p_trans_context->trans_id = p_mad->trans_id;
- p_trans_context->context = transaction_context;
- p_trans_context->sent_time = cl_get_time_stamp();
+ if (p_trans_context)
+ {
+ memset(p_trans_context, 0, sizeof(trans_context_t));
+ p_trans_context->trans_id = p_mad->trans_id;
+ p_trans_context->context = transaction_context;
+ p_trans_context->sent_time = cl_get_time_stamp();
+ }
cl_spinlock_acquire(&p_mad_bind_info->trans_ctxt_lock);
cl_qlist_insert_tail(&p_mad_bind_info->trans_ctxt_list,
@@ -774,9 +783,12 @@ osm_vendor_bind(
CL_ASSERT( mad_recv_callback );
/* Allocate memory for registering the handle. */
- p_mad_bind_info = (mad_bind_info_t*)cl_zalloc(sizeof(*p_mad_bind_info));
-
- p_umadt_reg_class = &p_mad_bind_info->umadt_reg_class ;
+ p_mad_bind_info = (mad_bind_info_t*)malloc(sizeof(*p_mad_bind_info));
+ if (p_mad_bind_info)
+ {
+ memset(p_mad_bind_info, 0, sizeof(*p_mad_bind_info));
+ p_umadt_reg_class = &p_mad_bind_info->umadt_reg_class;
+ }
p_umadt_reg_class->PortGuid = cl_ntoh64( p_osm_bind_info->port_guid );
p_umadt_reg_class->ClassId = p_osm_bind_info->mad_class;
p_umadt_reg_class->ClassVersion = p_osm_bind_info->class_version;
@@ -797,7 +809,7 @@ osm_vendor_bind(
&p_mad_bind_info->umadt_handle);
if (Status != FSUCCESS)
{
- cl_free(p_mad_bind_info);
+ free(p_mad_bind_info);
OSM_LOG_EXIT( p_umadt_obj->p_log );
return( OSM_BIND_INVALID_HANDLE );
}
@@ -875,7 +887,7 @@ osm_vendor_unbind(IN osm_bind_handle_t h
p_next_list_item = cl_qlist_next(p_list_item);
cl_qlist_remove_item(&p_mad_bind_info->trans_ctxt_list,
p_list_item);
- cl_free(p_list_item);
+ free(p_list_item);
p_list_item = p_next_list_item;
}
cl_spinlock_release(&p_mad_bind_info->trans_ctxt_lock);
@@ -887,12 +899,12 @@ osm_vendor_unbind(IN osm_bind_handle_t h
p_next_list_item = cl_qlist_next(p_list_item);
cl_qlist_remove_item(&p_mad_bind_info->timeout_list,
p_list_item);
- cl_free(p_list_item);
+ free(p_list_item);
p_list_item = p_next_list_item;
}
cl_spinlock_release(&p_mad_bind_info->timeout_list_lock);
- cl_free(p_mad_bind_info);
+ free(p_mad_bind_info);
}
/**********************************************************************
@@ -1025,7 +1037,7 @@ __mad_recv_processor(
transaction_context =((trans_context_t*)p_list_item)->context;
cl_qlist_remove_item(&p_mad_bind_info->trans_ctxt_list,
p_list_item);
- cl_free(p_list_item);
+ free(p_list_item);
}
cl_spinlock_release(&p_mad_bind_info->trans_ctxt_lock);
((ib_mad_t*)p_osm_madw->p_mad)->trans_id = cl_ntoh64(p_osm_madw->p_mad->trans_id>>24);
@@ -1137,7 +1149,7 @@ __osm_vendor_timer_callback(
p_next_list_item = cl_qlist_next(p_list_item);
cl_qlist_remove_item(&p_mad_bind_info->timeout_list,
p_list_item);
- cl_free(p_list_item);
+ free(p_list_item);
p_list_item = p_next_list_item;
}
Index: osm/libvendor/osm_vendor_mlx_rmpp_ctx.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_rmpp_ctx.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_rmpp_ctx.c (working copy)
@@ -38,10 +38,10 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
#include <complib/cl_qlist.h>
-#include <complib/cl_memory.h>
#include <vendor/osm_vendor_mlx_rmpp_ctx.h>
#include <vendor/osm_vendor_mlx_svc.h>
@@ -91,7 +91,7 @@ osmv_rmpp_send_ctx_done(IN osmv_rmpp_sen
CL_ASSERT(p_ctx);
cl_event_destroy(&p_ctx->event);
osmv_rmpp_sar_done(&p_ctx->sar);
- cl_free(p_ctx);
+ free(p_ctx);
}
@@ -211,9 +211,10 @@ osmv_rmpp_recv_ctx_init(osmv_rmpp_recv_c
p_ctx->is_sa_mad = FALSE;
- p_ctx->p_rbuf = cl_zalloc(sizeof(cl_qlist_t));
+ p_ctx->p_rbuf = malloc(sizeof(cl_qlist_t));
if (p_ctx->p_rbuf)
{
+ memset(p_ctx->p_rbuf, 0, sizeof(cl_qlist_t));
cl_qlist_init(p_ctx->p_rbuf);
p_ctx->expected_seg = 1;
} else st= IB_INSUFFICIENT_MEMORY;
@@ -237,16 +238,16 @@ osmv_rmpp_recv_ctx_done(IN osmv_rmpp_rec
p_obj = PARENT_STRUCT(p_list_item,cl_list_obj_t,list_item);
- cl_free(cl_qlist_obj(p_obj));
- cl_free(p_obj);
+ free(cl_qlist_obj(p_obj));
+ free(p_obj);
p_list_item = cl_qlist_remove_head(p_ctx->p_rbuf);
}
osmv_rmpp_sar_done(&p_ctx->sar);
- cl_free(p_ctx->p_rbuf);
- cl_free(p_ctx);
+ free(p_ctx->p_rbuf);
+ free(p_ctx);
}
@@ -260,20 +261,22 @@ osmv_rmpp_recv_ctx_store_mad_seg(IN osmv
OSM_LOG_ENTER(p_recv_ctx->p_log, osmv_rmpp_recv_ctx_store_mad_seg);
CL_ASSERT(p_recv_ctx);
- p_list_mad= cl_zalloc(MAD_BLOCK_SIZE);
+ p_list_mad= malloc(MAD_BLOCK_SIZE);
if (NULL == p_list_mad)
{
return IB_INSUFFICIENT_MEMORY;
}
- memcpy(p_list_mad,p_mad,MAD_BLOCK_SIZE);
+ memset(p_list_mad, 0, MAD_BLOCK_SIZE);
+ memcpy(p_list_mad, p_mad, MAD_BLOCK_SIZE);
- p_obj = cl_zalloc(sizeof(cl_list_obj_t));
+ p_obj = malloc(sizeof(cl_list_obj_t));
if (NULL == p_obj)
{
- cl_free(p_list_mad);
+ free(p_list_mad);
return IB_INSUFFICIENT_MEMORY;
}
- cl_qlist_set_obj(p_obj,p_list_mad);
+ memset(p_obj, 0, sizeof(cl_list_obj_t));
+ cl_qlist_set_obj(p_obj, p_list_mad);
cl_qlist_insert_tail(p_recv_ctx->p_rbuf,&p_obj->list_item);
Index: osm/libvendor/osm_vendor_mtl_hca_guid.c
===================================================================
--- osm/libvendor/osm_vendor_mtl_hca_guid.c (revision 7470)
+++ osm/libvendor/osm_vendor_mtl_hca_guid.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -42,10 +42,10 @@
#if defined(OSM_VENDOR_INTF_MTL) | defined(OSM_VENDOR_INTF_TS)
#undef IN
#undef OUT
+#include <stdlib.h>
#include <vapi_types.h>
#include <evapi.h>
#include <vendor/osm_vendor_api.h>
-#include <iba/complib/cl_memory.h>
#include <opensm/osm_log.h>
#include <stdio.h>
@@ -148,8 +148,8 @@ __osm_vendor_get_ca_ids( IN osm_vendor_t
/* allocate and really call - user of this function needs to deallocate it */
*p_hca_ids =
- ( VAPI_hca_id_t * ) cl_malloc( *p_num_guids *
- sizeof( VAPI_hca_id_t ) );
+ ( VAPI_hca_id_t * ) malloc( *p_num_guids *
+ sizeof( VAPI_hca_id_t ) );
/* now call it really */
vapi_res = EVAPI_list_hcas( *p_num_guids, p_num_guids, *p_hca_ids );
@@ -239,15 +239,15 @@ __osm_ca_info_init( IN osm_vendor_t * co
memcpy( &( p_ca_info->guid ), hca_cap.node_guid, 8 * sizeof( u_int8_t ) );
p_ca_info->attr_size = 1;
p_ca_info->p_attr =
- ( ib_ca_attr_t * ) cl_malloc( sizeof( ib_ca_attr_t ) );
+ ( ib_ca_attr_t * ) malloc( sizeof( ib_ca_attr_t ) );
memcpy( &( p_ca_info->p_attr->ca_guid ), hca_cap.node_guid,
8 * sizeof( u_int8_t ) );
/* now obtain the attributes of the ports */
p_ca_info->p_attr->num_ports = hca_cap.phys_port_num;
p_ca_info->p_attr->p_port_attr =
- ( ib_port_attr_t * ) cl_malloc( hca_cap.phys_port_num *
- sizeof( ib_port_attr_t ) );
+ ( ib_port_attr_t * ) malloc( hca_cap.phys_port_num *
+ sizeof( ib_port_attr_t ) );
for( port_num = 0; port_num < p_ca_info->p_attr->num_ports; port_num++ )
{
@@ -268,7 +268,7 @@ __osm_ca_info_init( IN osm_vendor_t * co
VAPI_query_hca_gid_tbl( hca_hndl, port_num + 1, 0, &maxNumGids,
NULL );
p_port_gid =
- ( IB_gid_t * ) cl_malloc( maxNumGids * sizeof( IB_gid_t ) );
+ ( IB_gid_t * ) malloc( maxNumGids * sizeof( IB_gid_t ) );
vapi_res =
VAPI_query_hca_gid_tbl( hca_hndl, port_num + 1, maxNumGids,
@@ -288,7 +288,7 @@ __osm_ca_info_init( IN osm_vendor_t * co
p_ca_info->p_attr->p_port_attr[port_num].link_state = hca_port.state;
p_ca_info->p_attr->p_port_attr[port_num].sm_lid = hca_port.sm_lid;
- cl_free( p_port_gid );
+ free( p_port_gid );
}
status = IB_SUCCESS;
@@ -309,12 +309,12 @@ osm_ca_info_destroy( IN osm_vendor_t * c
{
if( p_ca_info->p_attr->num_ports )
{
- cl_free( p_ca_info->p_attr->p_port_attr );
+ free( p_ca_info->p_attr->p_port_attr );
}
- cl_free( p_ca_info->p_attr );
+ free( p_ca_info->p_attr );
}
- cl_free( p_ca_info );
+ free( p_ca_info );
OSM_LOG_EXIT( p_vend->p_log );
}
@@ -359,7 +359,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
}
/* we keep track of all the CAs in this info array */
- p_vend->p_ca_info = cl_zalloc( ca_count * sizeof( *p_vend->p_ca_info ) );
+ p_vend->p_ca_info = malloc( ca_count * sizeof( *p_vend->p_ca_info ) );
if( p_vend->p_ca_info == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -368,6 +368,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
goto Exit;
}
+ memset( p_vend->p_ca_info, 0, ca_count * sizeof( *p_vend->p_ca_info ) );
p_vend->ca_count = ca_count;
/*
@@ -433,7 +434,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
*p_num_ports = total_ports;
if( p_ca_ids )
- cl_free( p_ca_ids );
+ free( p_ca_ids );
OSM_LOG_EXIT( p_vend->p_log );
return ( status );
@@ -521,7 +522,7 @@ osm_vendor_get_guid_ca_and_port( IN osm_
VAPI_query_hca_gid_tbl( hca_hndl, portIdx + 1, 0, &maxNumGids,
NULL );
p_port_gid =
- ( IB_gid_t * ) cl_malloc( maxNumGids * sizeof( IB_gid_t ) );
+ ( IB_gid_t * ) malloc( maxNumGids * sizeof( IB_gid_t ) );
/* get the port guid */
vapi_res =
@@ -549,7 +550,7 @@ osm_vendor_get_guid_ca_and_port( IN osm_
goto Exit;
}
- cl_free( p_port_gid );
+ free( p_port_gid );
p_port_gid = NULL;
} /* ALL PORTS */
} /* all HCAs */
@@ -562,9 +563,9 @@ osm_vendor_get_guid_ca_and_port( IN osm_
Exit:
if( p_ca_ids != NULL )
- cl_free( p_ca_ids );
+ free( p_ca_ids );
if( p_port_gid != NULL )
- cl_free( p_port_gid );
+ free( p_port_gid );
OSM_LOG_EXIT( p_vend->p_log );
return ( status );
}
Index: osm/libvendor/osm_vendor_test.c
===================================================================
--- osm/libvendor/osm_vendor_test.c (revision 7470)
+++ osm/libvendor/osm_vendor_test.c (working copy)
@@ -56,8 +56,8 @@
#ifdef OSM_VENDOR_INTF_TEST
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_log.h>
#include <vendor/osm_vendor_test.h>
#include <vendor/osm_vendor_api.h>
@@ -89,7 +89,7 @@ osm_vendor_delete(
CL_ASSERT( pp_vend );
osm_vendor_destroy( *pp_vend );
- cl_free( *pp_vend );
+ free( *pp_vend );
*pp_vend = NULL;
}
@@ -125,9 +125,11 @@ osm_vendor_new(
CL_ASSERT( p_log );
- p_vend = cl_zalloc( sizeof(*p_vend) );
+ p_vend = malloc( sizeof(*p_vend) );
if( p_vend != NULL )
{
+ memset( p_vend, 0, sizeof(*p_vend) );
+
status = osm_vendor_init( p_vend, p_log, timeout );
if( status != IB_SUCCESS )
{
@@ -158,12 +160,15 @@ osm_vendor_get(
/*
Simply malloc the MAD off the heap.
*/
- p_mad = (ib_mad_t*)cl_zalloc( size );
+ p_mad = (ib_mad_t*)malloc( size );
osm_log( p_vend->p_log, OSM_LOG_VERBOSE,
"osm_vendor_get: "
"MAD %p.\n", p_mad );
+ if (p_mad)
+ memset( p_mad, 0, size );
+
OSM_LOG_EXIT( p_vend->p_log );
return( p_mad );
}
@@ -191,7 +196,7 @@ osm_vendor_put(
/*
Return the MAD to the heap.
*/
- cl_free( p_mad );
+ free( p_mad );
OSM_LOG_EXIT( p_vend->p_log );
}
@@ -249,9 +254,10 @@ osm_vendor_bind(
UNUSED_PARAM( mad_recv_callback );
UNUSED_PARAM( context );
- h_bind = (osm_bind_handle_t)cl_zalloc(sizeof(*h_bind) );
+ h_bind = (osm_bind_handle_t)malloc(sizeof(*h_bind) );
if( h_bind != NULL )
{
+ memset(h_bind, 0, sizeof(*h_bind));
h_bind->p_vend = p_vend;
h_bind->port_guid = p_bind_info->port_guid;
h_bind->mad_class = p_bind_info->mad_class;
Index: osm/libvendor/osm_vendor_mlx_ibmgt.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_ibmgt.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_ibmgt.c (working copy)
@@ -46,9 +46,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <ib_mgt.h>
-#include <complib/cl_memory.h>
#include <complib/cl_event.h>
#include <vendor/osm_vendor_mlx_transport.h>
#include <vendor/osm_vendor_mlx_dispatcher.h>
@@ -127,11 +127,12 @@ osmv_transport_init(IN osm_bind_info_t *
osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
"osmv_transport_init: first bind() for the vendor\n");
p_bo->p_vendor->p_transport_info
- = (osmv_IBMGT_transport_info_t*) cl_zalloc(sizeof(osmv_IBMGT_transport_info_t));
+ = (osmv_IBMGT_transport_info_t*) malloc(sizeof(osmv_IBMGT_transport_info_t));
if (NULL == p_bo->p_vendor->p_transport_info)
{
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_bo->p_vendor->p_transport_info, 0, sizeof(osmv_IBMGT_transport_info_t));
p_tpot_info = (osmv_IBMGT_transport_info_t*)(p_bo->p_vendor->p_transport_info);
p_tpot_info->smi_h = 0xffffffff;
@@ -155,17 +156,19 @@ osmv_transport_init(IN osm_bind_info_t *
/* allocate transport mgr */
- p_mgr = cl_zalloc(sizeof(osmv_IBMGT_transport_mgr_t));
+ p_mgr = malloc(sizeof(osmv_IBMGT_transport_mgr_t));
if (NULL == p_mgr)
{
- cl_free(p_tpot_info);
+ free(p_tpot_info);
osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
"osmv_transport_init: ERR 7201: "
"alloc failed \n");
return IB_INSUFFICIENT_MEMORY;
}
- p_bo->p_transp_mgr = p_mgr ;
+ memset(p_mgr, 0, sizeof(osmv_IBMGT_transport_mgr_t));
+
+ p_bo->p_transp_mgr = p_mgr;
switch ( p_info->mad_class ) {
case IB_MCLASS_SUBN_LID:
@@ -198,7 +201,7 @@ osmv_transport_init(IN osm_bind_info_t *
"osmv_transport_init: ERR 7202: "
"IB_MGT_get_handle for smi failed \n");
st = IB_ERROR;
- cl_free(p_mgr);
+ free(p_mgr);
goto Exit;
}
@@ -213,12 +216,12 @@ osmv_transport_init(IN osm_bind_info_t *
"osmv_transport_init: ERR 7203: "
"IB_MGT_bind_sm failed \n");
st = IB_ERROR;
- cl_free( p_mgr);
+ free( p_mgr);
goto Exit;
}
/* init smi list */
- p_tpot_info->p_smi_list = cl_zalloc(sizeof(cl_qlist_t));
+ p_tpot_info->p_smi_list = malloc(sizeof(cl_qlist_t));
if (NULL == p_tpot_info->p_smi_list)
{
osm_log(p_bo->p_vendor->p_log, OSM_LOG_ERROR,
@@ -226,9 +229,10 @@ osmv_transport_init(IN osm_bind_info_t *
"alloc failed \n");
IB_MGT_unbind_sm(p_tpot_info->smi_h);
IB_MGT_release_handle(p_tpot_info->smi_h);
- cl_free(p_mgr);
+ free(p_mgr);
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_tpot_info->p_smi_list, 0, sizeof(cl_qlist_t));
cl_qlist_init(p_tpot_info->p_smi_list);
osm_log(p_bo->p_vendor->p_log, OSM_LOG_DEBUG,
@@ -248,17 +252,19 @@ osmv_transport_init(IN osm_bind_info_t *
);
IB_MGT_unbind_sm(p_tpot_info->smi_h);
IB_MGT_release_handle(p_tpot_info->smi_h);
- cl_free(p_tpot_info->p_smi_list);
- cl_free(p_mgr);
+ free(p_tpot_info->p_smi_list);
+ free(p_mgr);
st= IB_ERROR;
goto Exit;
}
}
/* insert to list of smi's - for raising callbacks later on */
- p_obj = cl_zalloc(sizeof(cl_list_obj_t));
- cl_qlist_set_obj(p_obj,p_bo);
- cl_qlist_insert_tail(p_tpot_info->p_smi_list,&p_obj->list_item);
+ p_obj = malloc(sizeof(cl_list_obj_t));
+ if (p_obj)
+ memset(p_obj, 0, sizeof(cl_list_obj_t));
+ cl_qlist_set_obj(p_obj, p_bo);
+ cl_qlist_insert_tail(p_tpot_info->p_smi_list, &p_obj->list_item);
break;
@@ -278,7 +284,7 @@ osmv_transport_init(IN osm_bind_info_t *
"osmv_transport_init: ERR 7207: "
"IB_MGT_get_handle for gsi failed \n");
st = IB_ERROR;
- cl_free(p_mgr);
+ free(p_mgr);
goto Exit;
}
}
@@ -293,21 +299,24 @@ osmv_transport_init(IN osm_bind_info_t *
"osmv_transport_init: ERR 7208: "
"IB_MGT_bind_gsi_class failed \n");
st = IB_ERROR;
- cl_free( p_mgr);
+ free( p_mgr);
goto Exit;
}
- p_tpot_info->gsi_mgmt_lists[p_info->mad_class] = cl_zalloc(sizeof(cl_qlist_t));
+ p_tpot_info->gsi_mgmt_lists[p_info->mad_class] = malloc(sizeof(cl_qlist_t));
if (NULL == p_tpot_info->gsi_mgmt_lists[p_info->mad_class])
{
IB_MGT_unbind_gsi_class(p_tpot_info->gsi_h,p_info->mad_class);
- cl_free(p_mgr);
+ free(p_mgr);
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_tpot_info->gsi_mgmt_lists[p_info->mad_class], 0, sizeof(cl_qlist_t));
cl_qlist_init(p_tpot_info->gsi_mgmt_lists[p_info->mad_class]);
}
/* insert to list of smi's - for raising callbacks later on */
- p_obj = cl_zalloc(sizeof(cl_list_obj_t));
+ p_obj = malloc(sizeof(cl_list_obj_t));
+ if (p_obj)
+ memset(p_obj, 0, sizeof(cl_list_obj_t));
cl_qlist_set_obj(p_obj,p_bo);
cl_qlist_insert_tail(p_tpot_info->gsi_mgmt_lists[p_info->mad_class],&p_obj->list_item);
@@ -322,8 +331,8 @@ osmv_transport_init(IN osm_bind_info_t *
if (ret != IB_SUCCESS)
{
IB_MGT_unbind_gsi_class(p_tpot_info->gsi_h,p_mgr->mgmt_class);
- cl_free(p_tpot_info->gsi_mgmt_lists[p_mgr->mgmt_class]);
- cl_free(p_mgr);
+ free(p_tpot_info->gsi_mgmt_lists[p_mgr->mgmt_class]);
+ free(p_mgr);
st= IB_ERROR;
goto Exit;
}
@@ -334,7 +343,7 @@ osmv_transport_init(IN osm_bind_info_t *
osm_log(p_log, OSM_LOG_ERROR,
"osmv_transport_init: ERR 7209: unrecognized mgmt class \n" );
st = IB_ERROR;
- cl_free( p_mgr);
+ free( p_mgr);
goto Exit;
}
@@ -523,12 +532,12 @@ osmv_transport_done(IN const osm_bind_ha
CL_ASSERT(p_item != cl_qlist_end(p_list));
cl_qlist_remove_item(p_list,p_item);
- if (p_obj) cl_free(p_obj);
+ if (p_obj) free(p_obj);
/* no one is binded to smi anymore - we can free the list, unbind & realease the hndl*/
if (cl_is_qlist_empty(p_list) == TRUE)
{
- cl_free(p_list);
+ free(p_list);
p_list = NULL;
ret = IB_MGT_unbind_sm(p_tpot_info->smi_h);
@@ -566,12 +575,12 @@ osmv_transport_done(IN const osm_bind_ha
CL_ASSERT(p_item != cl_qlist_end(p_list));
cl_qlist_remove_item(p_list,p_item);
- if (p_obj) cl_free(p_obj);
+ if (p_obj) free(p_obj);
/* no one is binded to this class anymore - we can free the list and unbind this class*/
if (cl_is_qlist_empty(p_list) == TRUE)
{
- cl_free(p_list);
+ free(p_list);
p_list = NULL;
ret = IB_MGT_unbind_gsi_class(p_tpot_info->gsi_h,p_mgr->mgmt_class);
@@ -604,7 +613,7 @@ osmv_transport_done(IN const osm_bind_ha
}
}/* end switch */
- cl_free(p_mgr);
+ free(p_mgr);
}
Index: osm/libvendor/osm_vendor_mlx_hca_sim.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_hca_sim.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_hca_sim.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -44,8 +44,8 @@
#undef OUT
#include <vendor/osm_vendor_api.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_log.h>
+#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
@@ -560,14 +560,14 @@ __osm_ca_info_init( IN osm_vendor_t * co
/* set size of attributes and allocate them */
p_ca_info->attr_size = 1;
- p_ca_info->p_attr = ( ib_ca_attr_t * ) cl_malloc( sizeof( ib_ca_attr_t ) );
+ p_ca_info->p_attr = ( ib_ca_attr_t * ) malloc( sizeof( ib_ca_attr_t ) );
p_ca_info->p_attr->ca_guid = p_ca_info->guid;
p_ca_info->p_attr->num_ports = sim_ca_info.num_ports;
/* now obtain the attributes of the ports */
p_ca_info->p_attr->p_port_attr =
- ( ib_port_attr_t * ) cl_malloc( sim_ca_info.num_ports * sizeof( ib_port_attr_t ) );
+ ( ib_port_attr_t * ) malloc( sim_ca_info.num_ports * sizeof( ib_port_attr_t ) );
/* get all the ports info */
for( port_num = 1; port_num <= sim_ca_info.num_ports; port_num++ )
@@ -625,14 +625,14 @@ osm_ca_info_destroy( IN osm_vendor_t * c
{
if(0 != p_ca->p_attr->num_ports)
{
- cl_free( p_ca->p_attr->p_port_attr );
+ free( p_ca->p_attr->p_port_attr );
}
- cl_free( p_ca->p_attr);
+ free( p_ca->p_attr);
}
}
- cl_free( p_ca_info );
+ free( p_ca_info );
OSM_LOG_EXIT( p_vend->p_log );
}
@@ -671,7 +671,7 @@ osm_vendor_get_all_port_attr( IN osm_ven
}
/* Allocate an array big enough to hold the ca info objects*/
- p_ca_infos = cl_zalloc( ca_count * sizeof( osm_ca_info_t ) );
+ p_ca_infos = malloc( ca_count * sizeof( osm_ca_info_t ) );
if( p_ca_infos == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -680,6 +680,8 @@ osm_vendor_get_all_port_attr( IN osm_ven
goto Exit;
}
+ memset( p_ca_infos, 0, ca_count * sizeof( osm_ca_info_t ) );
+
/*
* For each CA, retrieve the CA info attributes
*/
Index: osm/libvendor/osm_vendor_ts.c
===================================================================
--- osm/libvendor/osm_vendor_ts.c (revision 7470)
+++ osm/libvendor/osm_vendor_ts.c (working copy)
@@ -40,10 +40,10 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <vendor/osm_vendor_ts.h>
#include <vendor/osm_vendor_api.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_subnet.h>
#include <opensm/osm_opensm.h>
@@ -227,7 +227,7 @@ osm_vendor_delete( IN osm_vendor_t ** co
CL_ASSERT( pp_vend );
osm_vendor_destroy( *pp_vend );
- cl_free( *pp_vend );
+ free( *pp_vend );
*pp_vend = NULL;
}
@@ -272,9 +272,11 @@ osm_vendor_new(
CL_ASSERT( p_log );
- p_vend = cl_zalloc( sizeof( *p_vend ) );
+ p_vend = malloc( sizeof( *p_vend ) );
if( p_vend != NULL )
{
+ memset( p_vend, 0, sizeof( *p_vend ) );
+
status = osm_vendor_init( p_vend, p_log, timeout );
if( status != IB_SUCCESS )
{
@@ -717,7 +719,7 @@ osm_vendor_get( IN osm_bind_handle_t h_b
p_vw->size = mad_size;
/* allocate it */
- p_mad = ( ib_mad_t * ) cl_zalloc( p_vw->size );
+ p_mad = ( ib_mad_t * ) malloc( p_vw->size );
if( p_mad == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -774,7 +776,7 @@ osm_vendor_put(
*/
/* free the mad but the wrapper is part of the madw object */
- cl_free( p_vw->p_mad_buf );
+ free( p_vw->p_mad_buf );
p_vw->p_mad_buf = NULL;
p_madw = PARENT_STRUCT( p_vw, osm_madw_t, vend_wrap);
p_madw->p_mad = NULL;
Index: osm/libvendor/osm_vendor_mlx_anafa.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_anafa.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_anafa.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -40,6 +40,7 @@
#endif /* HAVE_CONFIG_H */
#include <sys/ioctl.h>
+#include <stdlib.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -55,7 +56,6 @@
#include <vendor/osm_vendor_mlx_sender.h>
#include <vendor/osm_pkt_randomizer.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_ts_useraccess.h>
/**
@@ -86,8 +86,9 @@ osm_vendor_new (IN osm_log_t * const p_l
CL_ASSERT (p_log);
- p_vend = cl_zalloc (sizeof (*p_vend));
+ p_vend = malloc (sizeof (*p_vend));
if (p_vend != NULL) {
+ memset(p_vend, 0, sizeof (*p_vend));
status = osm_vendor_init (p_vend, p_log, timeout);
if (status != IB_SUCCESS) {
osm_vendor_delete (&p_vend);
@@ -134,14 +135,14 @@ osm_vendor_delete (IN osm_vendor_t ** co
__osm_vendor_internal_unbind (bind_h);
- cl_free (p_obj);
+ free (p_obj);
/*removing from list */
p_item = cl_qlist_remove_head (&((*pp_vend)->bind_handles));
}
}
if (NULL != ((*pp_vend)->p_transport_info)) {
- cl_free ((*pp_vend)->p_transport_info);
+ free ((*pp_vend)->p_transport_info);
(*pp_vend)->p_transport_info = NULL;
}
@@ -150,7 +151,7 @@ osm_vendor_delete (IN osm_vendor_t ** co
osm_pkt_randomizer_destroy (&((*pp_vend)->p_pkt_randomizer),
p_log);
- cl_free (*pp_vend);
+ free (*pp_vend);
*pp_vend = NULL;
OSM_LOG_EXIT (p_log);
@@ -177,11 +178,13 @@ osm_vendor_init (IN osm_vendor_t * const
p_vend->ttime_timeout = timeout * OSMV_TXN_TIMEOUT_FACTOR;
p_vend->p_transport_info = (osmv_TOPSPIN_ANAFA_transport_info_t *)
- cl_zalloc (sizeof (osmv_TOPSPIN_ANAFA_transport_info_t));
+ malloc (sizeof (osmv_TOPSPIN_ANAFA_transport_info_t));
if (!p_vend->p_transport_info) {
return IB_ERROR;
}
+ memset(p_vend->p_transport_info, 0, sizeof (osmv_TOPSPIN_ANAFA_transport_info_t));
+
/* update the run_randomizer flag */
if (getenv ("OSM_PKT_DROP_RATE") != NULL
&& atol (getenv ("OSM_PKT_DROP_RATE")) != 0) {
@@ -247,7 +250,7 @@ osm_vendor_bind (IN osm_vendor_t * const
return OSM_BIND_INVALID_HANDLE;
}
- p_bo = cl_zalloc (sizeof (osmv_bind_obj_t));
+ p_bo = malloc (sizeof (osmv_bind_obj_t));
if (NULL == p_bo) {
osm_log (p_bo->p_vendor->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 7403: "
@@ -255,6 +258,7 @@ osm_vendor_bind (IN osm_vendor_t * const
return OSM_BIND_INVALID_HANDLE;
}
+ memset (p_bo, 0, sizeof (osmv_bind_obj_t));
p_bo->p_vendor = p_vend;
p_bo->recv_cb = mad_recv_callback;
p_bo->send_err_cb = send_err_callback;
@@ -276,7 +280,7 @@ osm_vendor_bind (IN osm_vendor_t * const
osm_log (p_bo->p_vendor->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 7405: "
"could not initialize the spinlock ...\n");
- cl_free (p_bo);
+ free (p_bo);
return OSM_BIND_INVALID_HANDLE;
}
@@ -288,7 +292,7 @@ osm_vendor_bind (IN osm_vendor_t * const
"osm_vendor_bind: ERR 7406: "
"osmv_txnmgr_init failed \n");
cl_spinlock_destroy (&p_bo->lock);
- cl_free (p_bo);
+ free (p_bo);
return OSM_BIND_INVALID_HANDLE;
}
@@ -300,12 +304,12 @@ osm_vendor_bind (IN osm_vendor_t * const
"osmv_transport_init failed \n");
osmv_txnmgr_done ((osm_bind_handle_t) p_bo);
cl_spinlock_destroy (&p_bo->lock);
- cl_free (p_bo);
+ free (p_bo);
return OSM_BIND_INVALID_HANDLE;
}
/* insert bind handle into db */
- p_obj = cl_zalloc (sizeof (cl_list_obj_t));
+ p_obj = malloc (sizeof (cl_list_obj_t));
if (NULL == p_obj) {
osm_log (p_bo->p_vendor->p_log, OSM_LOG_ERROR,
@@ -315,9 +319,11 @@ osm_vendor_bind (IN osm_vendor_t * const
osmv_transport_done (p_bo->p_transp_mgr);
osmv_txnmgr_done ((osm_bind_handle_t) p_bo);
cl_spinlock_destroy (&p_bo->lock);
- cl_free (p_bo);
+ free (p_bo);
return OSM_BIND_INVALID_HANDLE;
}
+ if (p_obj)
+ memset (p_obj, 0, sizeof (cl_list_obj_t));
cl_qlist_set_obj (p_obj, p_bo);
cl_qlist_insert_head (&p_vend->bind_handles, &p_obj->list_item);
@@ -357,7 +363,7 @@ osm_vendor_unbind (IN osm_bind_handle_t
CL_ASSERT (p_item != cl_qlist_end (p_bh_list));
cl_qlist_remove_item (p_bh_list, p_item);
- cl_free (p_obj);
+ free (p_obj);
__osm_vendor_internal_unbind (h_bind);
@@ -391,7 +397,7 @@ osm_vendor_get (IN osm_bind_handle_t h_b
}
/* allocate it */
- p_mad = (ib_mad_t *) cl_zalloc (act_mad_size);
+ p_mad = (ib_mad_t *) malloc (act_mad_size);
if (p_mad == NULL) {
osm_log (p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_get: ERR 7409: "
@@ -399,6 +405,8 @@ osm_vendor_get (IN osm_bind_handle_t h_b
goto Exit;
}
+ memset (p_mad, 0, act_mad_size);
+
if (osm_log_get_level (p_vend->p_log) >= OSM_LOG_DEBUG) {
osm_log (p_vend->p_log, OSM_LOG_DEBUG,
"osm_vendor_get: "
@@ -547,7 +555,7 @@ osm_vendor_put (IN osm_bind_handle_t h_b
"osm_vendor_put: " "Retiring MAD %p.\n", p_vw->p_mad);
}
- cl_free (p_vw->p_mad);
+ free (p_vw->p_mad);
p_vw->p_mad = NULL;
OSM_LOG_EXIT (p_vend->p_log);
@@ -656,7 +664,7 @@ __osm_vendor_internal_unbind (osm_bind_h
the client - and the client might use them
cl_spinlock_destroy(&p_bo->lock);
- cl_free(p_bo);
+ free(p_bo);
*/
OSM_LOG_EXIT (p_log);
Index: osm/libvendor/osm_vendor_mtl.c
===================================================================
--- osm/libvendor/osm_vendor_mtl.c (revision 7470)
+++ osm/libvendor/osm_vendor_mtl.c (working copy)
@@ -43,8 +43,8 @@
#ifdef OSM_VENDOR_INTF_MTL
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_helper.h>
#include <opensm/osm_log.h>
/* HACK - I do not know how to prevent complib from loading kernel H files */
@@ -306,7 +306,7 @@ osm_vendor_delete( IN osm_vendor_t ** co
CL_ASSERT( pp_vend );
osm_vendor_destroy( *pp_vend );
- cl_free( *pp_vend );
+ free( *pp_vend );
*pp_vend = NULL;
}
@@ -337,7 +337,7 @@ osm_vendor_init( IN osm_vendor_t * const
*/
ib_mgt_hdl_p =
( osm_vendor_mgt_bind_t * )
- cl_malloc( sizeof( osm_vendor_mgt_bind_t ) );
+ malloc( sizeof( osm_vendor_mgt_bind_t ) );
if( ib_mgt_hdl_p == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -376,9 +376,10 @@ osm_vendor_new(
CL_ASSERT( p_log );
- p_vend = cl_zalloc( sizeof( *p_vend ) );
+ p_vend = malloc( sizeof( *p_vend ) );
if( p_vend != NULL )
{
+ memset( p_vend, 0, sizeof( *p_vend ) );
status = osm_vendor_init( p_vend, p_log, timeout );
if( status != IB_SUCCESS )
{
@@ -675,7 +676,7 @@ osm_vendor_bind( IN osm_vendor_t * const
}
/* create the bind object tracking this binding */
- p_bind = (osm_mtl_bind_info_t *)cl_malloc( sizeof(osm_mtl_bind_info_t) );
+ p_bind = (osm_mtl_bind_info_t *)malloc( sizeof(osm_mtl_bind_info_t) );
memset(p_bind, 0, sizeof(osm_mtl_bind_info_t));
if( p_bind == NULL )
{
@@ -736,7 +737,7 @@ osm_vendor_bind( IN osm_vendor_t * const
&( ib_mgt_hdl_p->smi_mads_hdl ) );
if( IB_MGT_OK != mgt_ret )
{
- cl_free( p_bind );
+ free( p_bind );
p_bind = NULL;
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3C16: "
@@ -748,7 +749,7 @@ osm_vendor_bind( IN osm_vendor_t * const
mgt_ret = IB_MGT_bind_sm( ib_mgt_hdl_p->smi_mads_hdl );
if( IB_MGT_OK != mgt_ret )
{
- cl_free( p_bind );
+ free( p_bind );
p_bind = NULL;
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3C17: "
@@ -790,7 +791,7 @@ osm_vendor_bind( IN osm_vendor_t * const
&( ib_mgt_hdl_p->gsi_mads_hdl ) );
if( IB_MGT_OK != mgt_ret )
{
- cl_free( p_bind );
+ free( p_bind );
p_bind = NULL;
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3C20: "
@@ -804,7 +805,7 @@ osm_vendor_bind( IN osm_vendor_t * const
p_user_bind->mad_class );
if( IB_MGT_OK != mgt_ret )
{
- cl_free( p_bind );
+ free( p_bind );
p_bind = NULL;
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3C22: "
@@ -837,7 +838,7 @@ osm_vendor_bind( IN osm_vendor_t * const
if( IB_MGT_OK != mgt_ret )
{
- cl_free( p_bind );
+ free( p_bind );
p_bind = NULL;
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3C23: "
@@ -875,7 +876,7 @@ osm_vendor_get( IN osm_bind_handle_t h_b
p_vw->size = MAD_BLOCK_SIZE;
/* allocate it */
- mad_p = ( ib_mad_t * ) cl_zalloc( p_vw->size );
+ mad_p = ( ib_mad_t * ) malloc( p_vw->size );
if( mad_p == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -931,7 +932,7 @@ osm_vendor_put( IN osm_bind_handle_t h_b
*/
/* free the mad but the wrapper is part of the madw object */
- cl_free( p_vw->mad_buf_p );
+ free( p_vw->mad_buf_p );
p_vw->mad_buf_p = NULL;
p_madw = PARENT_STRUCT( p_vw, osm_madw_t, vend_wrap);
p_madw->p_mad = NULL;
Index: osm/libvendor/osm_vendor_al.c
===================================================================
--- osm/libvendor/osm_vendor_al.c (revision 7470)
+++ osm/libvendor/osm_vendor_al.c (working copy)
@@ -59,8 +59,8 @@
#ifdef OSM_VENDOR_INTF_AL
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qlist.h>
#include <complib/cl_thread.h>
#include <complib/cl_math.h>
@@ -415,7 +415,7 @@ osm_vendor_new(
OSM_LOG_ENTER( p_log, osm_vendor_new );
- p_vend = cl_zalloc( sizeof(*p_vend) );
+ p_vend = malloc( sizeof(*p_vend) );
if( p_vend == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -424,10 +424,12 @@ osm_vendor_new(
goto Exit;
}
+ memset( p_vend, 0, sizeof(*p_vend) );
+
status = osm_vendor_init( p_vend, p_log, timeout );
if( status != IB_SUCCESS )
{
- cl_free( p_vend );
+ free( p_vend );
p_vend = NULL;
}
@@ -444,7 +446,7 @@ osm_vendor_delete(
{
/* TO DO - fill this in */
ib_close_al( (*pp_vend)->h_al );
- cl_free( *pp_vend );
+ free( *pp_vend );
*pp_vend = NULL;
}
@@ -483,7 +485,7 @@ __osm_ca_info_init(
CL_ASSERT( p_ca_info->attr_size );
- p_ca_info->p_attr = cl_malloc( p_ca_info->attr_size );
+ p_ca_info->p_attr = malloc( p_ca_info->attr_size );
if( p_ca_info->p_attr == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -519,9 +521,9 @@ osm_ca_info_destroy(
OSM_LOG_ENTER( p_vend->p_log, osm_ca_info_destroy );
if( p_ca_info->p_attr )
- cl_free( p_ca_info->p_attr );
+ free( p_ca_info->p_attr );
- cl_free( p_ca_info );
+ free( p_ca_info );
OSM_LOG_EXIT( p_vend->p_log );
}
@@ -540,10 +542,12 @@ osm_ca_info_new(
CL_ASSERT( ca_guid );
- p_ca_info = cl_zalloc( sizeof(*p_ca_info) );
+ p_ca_info = malloc( sizeof(*p_ca_info) );
if( p_ca_info == NULL )
goto Exit;
+ memset( p_ca_info, 0, sizeof(*p_ca_info) );
+
status = __osm_ca_info_init( p_vend, p_ca_info, ca_guid );
if( status != IB_SUCCESS )
{
@@ -591,7 +595,7 @@ __osm_vendor_get_ca_guids(
goto Exit;
}
- *p_guids = cl_malloc( *p_num_guids * sizeof(**p_guids) );
+ *p_guids = malloc( *p_num_guids * sizeof(**p_guids) );
if( *p_guids == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -681,7 +685,7 @@ osm_vendor_get_all_port_attr(
*/
status = __osm_vendor_get_ca_guids( p_vend, &p_ca_guid, &ca_count );
- p_vend->p_ca_info = cl_zalloc( ca_count * sizeof(*p_vend->p_ca_info) );
+ p_vend->p_ca_info = malloc( ca_count * sizeof(*p_vend->p_ca_info) );
if( p_vend->p_ca_info == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -690,6 +694,7 @@ osm_vendor_get_all_port_attr(
goto Exit;
}
+ memset( p_vend->p_ca_info, 0, ca_count * sizeof(*p_vend->p_ca_info) );
p_vend->ca_count = ca_count;
/*
@@ -748,7 +753,7 @@ osm_vendor_get_all_port_attr(
Exit:
if( p_ca_guid )
- cl_free( p_ca_guid );
+ free( p_ca_guid );
OSM_LOG_EXIT( p_vend->p_log );
return( status );
@@ -1003,7 +1008,7 @@ osm_vendor_bind(
}
}
- p_bind = cl_zalloc( sizeof(*p_bind) );
+ p_bind = malloc( sizeof(*p_bind) );
if( p_bind == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -1012,6 +1017,7 @@ osm_vendor_bind(
goto Exit;
}
+ memset( p_bind, 0, sizeof(*p_bind) );
p_bind->p_vend = p_vend;
p_bind->client_context = context;
p_bind->port_num = osm_vendor_get_port_num( p_vend, port_guid );
@@ -1055,7 +1061,7 @@ osm_vendor_bind(
if( status != IB_SUCCESS )
{
- cl_free( p_bind );
+ free( p_bind );
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3B19: "
"Unable to get QP handle (%s).\n",
@@ -1088,7 +1094,7 @@ osm_vendor_bind(
if( status != IB_SUCCESS )
{
- cl_free( p_bind );
+ free( p_bind );
osm_log( p_vend->p_log, OSM_LOG_ERROR,
"osm_vendor_bind: ERR 3B21: "
"Unable to register QP0 MAD service (%s).\n",
Index: osm/libvendor/osm_vendor_mlx_ts_anafa.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_ts_anafa.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_ts_anafa.c (working copy)
@@ -52,6 +52,7 @@
#include <fcntl.h>
#include <stddef.h>
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#include <vendor/osm_vendor_api.h>
@@ -60,7 +61,6 @@
#include <vendor/osm_vendor_mlx_dispatcher.h>
#include <vendor/osm_vendor_mlx_svc.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_ts_useraccess.h>
static void
@@ -186,11 +186,13 @@ osmv_transport_init (
(osmv_TOPSPIN_ANAFA_transport_info_t *) p_bo->p_vendor->
p_transport_info;
- p_mgr = cl_zalloc (sizeof (osmv_TOPSPIN_ANAFA_transport_mgr_t));
+ p_mgr = malloc (sizeof (osmv_TOPSPIN_ANAFA_transport_mgr_t));
if (!p_mgr) {
return IB_INSUFFICIENT_MEMORY;
}
+ memset(p_mgr, 0, sizeof (osmv_TOPSPIN_ANAFA_transport_mgr_t));
+
/* open TopSpin file device */
device_fd = open (device_file, O_RDWR);
if (device_fd < 0) {
@@ -355,7 +357,7 @@ osmv_transport_done (IN const osm_bind_h
/* pthread_cancel (p_tpot_mgr->receiver.osd.id); */
cl_thread_destroy (&(p_tpot_mgr->receiver));
- cl_free (p_tpot_mgr);
+ free (p_tpot_mgr);
}
static void
Index: osm/libvendor/osm_vendor_mlx.c
===================================================================
--- osm/libvendor/osm_vendor_mlx.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx.c (working copy)
@@ -38,6 +38,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <vendor/osm_vendor_mlx.h>
#include <vendor/osm_vendor_mlx_transport.h>
@@ -45,7 +46,6 @@
#include <vendor/osm_vendor_mlx_sender.h>
#include <vendor/osm_vendor_mlx_hca.h>
#include <vendor/osm_pkt_randomizer.h>
-#include <complib/cl_memory.h>
/**
* FORWARD REFERENCES
@@ -78,9 +78,11 @@ osm_vendor_new(
CL_ASSERT( p_log );
- p_vend = cl_zalloc( sizeof( *p_vend ) );
+ p_vend = malloc( sizeof( *p_vend ) );
if ( p_vend != NULL )
{
+ memset( p_vend, 0, sizeof( *p_vend ) );
+
status = osm_vendor_init( p_vend, p_log, timeout );
if ( status != IB_SUCCESS )
{
@@ -126,14 +128,14 @@ osm_vendor_delete( IN osm_vendor_t ** co
__osm_vendor_internal_unbind(bind_h);
- cl_free(p_obj);
+ free(p_obj);
/*removing from list */
p_item = cl_qlist_remove_head(&((*pp_vend)->bind_handles));
}
if (NULL != ((*pp_vend)->p_transport_info))
{
- cl_free((*pp_vend)->p_transport_info);
+ free((*pp_vend)->p_transport_info);
(*pp_vend)->p_transport_info = NULL;
}
@@ -141,7 +143,7 @@ osm_vendor_delete( IN osm_vendor_t ** co
if ( (*pp_vend)->run_randomizer == TRUE )
osm_pkt_randomizer_destroy( &((*pp_vend)->p_pkt_randomizer), p_log );
- cl_free( *pp_vend );
+ free( *pp_vend );
*pp_vend = NULL;
OSM_LOG_EXIT( p_log );
@@ -223,7 +225,7 @@ osm_vendor_bind(
return OSM_BIND_INVALID_HANDLE;
}
- p_bo = cl_zalloc(sizeof(osmv_bind_obj_t));
+ p_bo = malloc(sizeof(osmv_bind_obj_t));
if (NULL == p_bo)
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -231,6 +233,7 @@ osm_vendor_bind(
return OSM_BIND_INVALID_HANDLE;
}
+ memset(p_bo, 0, sizeof(osmv_bind_obj_t));
p_bo->p_vendor = p_vend;
p_bo->recv_cb = mad_recv_callback;
p_bo->send_err_cb = send_err_callback;
@@ -257,7 +260,7 @@ osm_vendor_bind(
"Fail to find port number of port guid:0x%016"PRIx64"\n",
p_bind_info->port_guid
);
- cl_free(p_bo);
+ free(p_bo);
return OSM_BIND_INVALID_HANDLE;
}
@@ -275,7 +278,7 @@ osm_vendor_bind(
osm_log(p_bo->p_vendor->p_log,OSM_LOG_ERROR,
"osm_vendor_bind: ERR 7305: "
"could not initialize the spinlock ...\n");
- cl_free(p_bo);
+ free(p_bo);
return OSM_BIND_INVALID_HANDLE;
}
@@ -287,7 +290,7 @@ osm_vendor_bind(
"osm_vendor_bind: ERR 7306: "
"osmv_txnmgr_init failed \n");
cl_spinlock_destroy(&p_bo->lock);
- cl_free(p_bo);
+ free(p_bo);
return OSM_BIND_INVALID_HANDLE;
}
@@ -299,12 +302,12 @@ osm_vendor_bind(
"osmv_transport_init failed \n");
osmv_txnmgr_done((osm_bind_handle_t) p_bo);
cl_spinlock_destroy(&p_bo->lock);
- cl_free(p_bo);
+ free(p_bo);
return OSM_BIND_INVALID_HANDLE;
}
/* insert bind handle into db */
- p_obj = cl_zalloc(sizeof(cl_list_obj_t));
+ p_obj = malloc(sizeof(cl_list_obj_t));
if (NULL == p_obj)
{
@@ -315,9 +318,10 @@ osm_vendor_bind(
osmv_transport_done(p_bo->p_transp_mgr);
osmv_txnmgr_done((osm_bind_handle_t) p_bo);
cl_spinlock_destroy(&p_bo->lock);
- cl_free(p_bo);
+ free(p_bo);
return OSM_BIND_INVALID_HANDLE;
}
+ memset(p_obj, 0, sizeof(cl_list_obj_t));
cl_qlist_set_obj(p_obj, p_bo);
cl_qlist_insert_head(&p_vend->bind_handles,&p_obj->list_item);
@@ -357,7 +361,7 @@ osm_vendor_unbind(IN osm_bind_handle_t
CL_ASSERT(p_item != cl_qlist_end(p_bh_list));
cl_qlist_remove_item(p_bh_list,p_item);
- if (p_obj) cl_free(p_obj);
+ if (p_obj) free(p_obj);
if (h_bind != 0)
{
@@ -398,7 +402,7 @@ osm_vendor_get( IN osm_bind_handle_t h_b
}
/* allocate it */
- p_mad = ( ib_mad_t * ) cl_zalloc( act_mad_size );
+ p_mad = ( ib_mad_t * ) malloc( act_mad_size );
if ( p_mad == NULL )
{
osm_log( p_vend->p_log, OSM_LOG_ERROR,
@@ -407,6 +411,8 @@ osm_vendor_get( IN osm_bind_handle_t h_b
goto Exit;
}
+ memset( p_mad, 0, act_mad_size );
+
if ( osm_log_get_level( p_vend->p_log ) >= OSM_LOG_DEBUG )
{
osm_log( p_vend->p_log, OSM_LOG_DEBUG,
@@ -583,7 +589,7 @@ osm_vendor_put(
"osm_vendor_put: " "Retiring MAD %p.\n", p_vw->p_mad );
}
- cl_free( p_vw->p_mad );
+ free( p_vw->p_mad );
p_vw->p_mad = NULL;
OSM_LOG_EXIT( p_vend->p_log );
@@ -708,7 +714,7 @@ __osm_vendor_internal_unbind(osm_bind_ha
the client - and the client might use them
cl_spinlock_destroy(&p_bo->lock);
- cl_free(p_bo);
+ free(p_bo);
*/
OSM_LOG_EXIT(p_log);
Index: osm/libvendor/osm_vendor_mlx_hca_anafa.c
===================================================================
--- osm/libvendor/osm_vendor_mlx_hca_anafa.c (revision 7470)
+++ osm/libvendor/osm_vendor_mlx_hca_anafa.c (working copy)
@@ -43,11 +43,11 @@
#undef IN
#undef OUT
+#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <vendor/osm_vendor_api.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_log.h>
#include <sys/ioctl.h>
@@ -110,7 +110,7 @@ __osm_ca_info_init (IN osm_vendor_t * co
p_ca_info->attr.num_ports = 1;
p_ca_info->attr.p_port_attr =
- (ib_port_attr_t *) cl_malloc (1 * sizeof (ib_port_attr_t));
+ (ib_port_attr_t *) malloc (1 * sizeof (ib_port_attr_t));
port_info.port = 1;
ioctl_ret =
Index: osm/complib/cl_timer.c
===================================================================
--- osm/complib/cl_timer.c (revision 7470)
+++ osm/complib/cl_timer.c (working copy)
@@ -48,9 +48,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_timer.h>
-#include <complib/cl_memory.h>
#include <sys/time.h>
#include <sys/errno.h>
#include <stdio.h>
@@ -83,9 +83,11 @@ __cl_timer_prov_create( void )
{
CL_ASSERT( gp_timer_prov == NULL );
- gp_timer_prov = cl_zalloc( sizeof(cl_timer_prov_t) );
+ gp_timer_prov = malloc( sizeof(cl_timer_prov_t) );
if( !gp_timer_prov )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( gp_timer_prov, 0, sizeof(cl_timer_prov_t) );
cl_qlist_init( &gp_timer_prov->queue );
@@ -122,7 +124,7 @@ __cl_timer_prov_destroy( void )
pthread_cond_destroy( &gp_timer_prov->cond );
/* Free the memory and reset the global pointer. */
- cl_free( gp_timer_prov );
+ free( gp_timer_prov );
gp_timer_prov = NULL;
}
Index: osm/complib/cl_dispatcher.c
===================================================================
--- osm/complib/cl_dispatcher.c (revision 7470)
+++ osm/complib/cl_dispatcher.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -51,7 +51,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <complib/cl_dispatcher.h>
#include <complib/cl_timer.h>
@@ -161,7 +161,7 @@ cl_disp_shutdown(
/* Free all registration info. */
while( !cl_is_qlist_empty( &p_disp->reg_list ) )
- cl_free( cl_qlist_remove_head( &p_disp->reg_list ) );
+ free( cl_qlist_remove_head( &p_disp->reg_list ) );
}
/********************************************************************
@@ -253,12 +253,16 @@ cl_disp_register(
}
/* Get a registration info from the pool. */
- p_reg = (cl_disp_reg_info_t*)cl_zalloc( sizeof(cl_disp_reg_info_t) );
+ p_reg = (cl_disp_reg_info_t*)malloc( sizeof(cl_disp_reg_info_t) );
if( !p_reg )
{
cl_spinlock_release( &p_disp->lock );
return( NULL );
}
+ else
+ {
+ memset( p_reg, 0, sizeof(cl_disp_reg_info_t) );
+ }
p_reg->p_disp = p_disp;
p_reg->ref_cnt = 0;
@@ -276,7 +280,7 @@ cl_disp_register(
status = cl_ptr_vector_set( &p_disp->reg_vec, msg_id, p_reg );
if( status != CL_SUCCESS )
{
- cl_free( p_reg );
+ free( p_reg );
cl_spinlock_release( &p_disp->lock );
return( NULL );
}
@@ -323,7 +327,7 @@ cl_disp_unregister(
/* Remove the registrant from the list. */
cl_qlist_remove_item( &p_disp->reg_list, (cl_list_item_t*)p_reg );
/* Return the registration info to the pool */
- cl_free( p_reg );
+ free( p_reg );
cl_spinlock_release( &p_disp->lock );
}
Index: osm/complib/cl_ptr_vector.c
===================================================================
--- osm/complib/cl_ptr_vector.c (revision 7470)
+++ osm/complib/cl_ptr_vector.c (working copy)
@@ -51,9 +51,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_ptr_vector.h>
-#include <complib/cl_memory.h>
void
@@ -113,7 +113,7 @@ cl_ptr_vector_destroy(
/* Destroy the page vector. */
if( p_vector->p_ptr_array )
{
- cl_free( (void*)p_vector->p_ptr_array );
+ free( (void*)p_vector->p_ptr_array );
p_vector->p_ptr_array = NULL;
}
}
@@ -214,9 +214,11 @@ cl_ptr_vector_set_capacity(
}
/* Allocate our pointer array. */
- p_new_ptr_array = cl_zalloc( new_capacity * sizeof(void*) );
+ p_new_ptr_array = malloc( new_capacity * sizeof(void*) );
if( !p_new_ptr_array )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( p_new_ptr_array, 0, new_capacity * sizeof(void*) );
if( p_vector->p_ptr_array )
{
@@ -225,7 +227,7 @@ cl_ptr_vector_set_capacity(
p_vector->capacity * sizeof(void*) );
/* Free the old pointer array. */
- cl_free( (void*)p_vector->p_ptr_array );
+ free( (void*)p_vector->p_ptr_array );
}
/* Set the new array. */
Index: osm/complib/cl_perf.c
===================================================================
--- osm/complib/cl_perf.c (revision 7470)
+++ osm/complib/cl_perf.c (working copy)
@@ -51,6 +51,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
/*
@@ -64,7 +65,6 @@
#include <complib/cl_perf.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
@@ -108,10 +108,13 @@ __cl_perf_init(
/* Allocate an array of counters. */
p_perf->size = num_counters;
p_perf->data_array = (cl_perf_data_t*)
- cl_zalloc( sizeof(cl_perf_data_t) * num_counters );
+ malloc( sizeof(cl_perf_data_t) * num_counters );
if( !p_perf->data_array )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( p_perf->data_array, 0,
+ sizeof(cl_perf_data_t) * num_counters );
/* Initialize the user's counters. */
for( i = 0; i < num_counters; i++ )
@@ -223,7 +226,7 @@ __cl_perf_destroy(
for( i = 0; i < p_perf->size; i++ )
cl_spinlock_destroy( &p_perf->data_array[i].lock );
- cl_free( p_perf->data_array );
+ free( p_perf->data_array );
p_perf->data_array = NULL;
p_perf->state = CL_UNINITIALIZED;
Index: osm/complib/cl_threadpool.c
===================================================================
--- osm/complib/cl_threadpool.c (revision 7470)
+++ osm/complib/cl_threadpool.c (working copy)
@@ -51,10 +51,10 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_threadpool.h>
#include <complib/cl_atomic.h>
-#include <complib/cl_memory.h>
void
@@ -151,7 +151,7 @@ cl_thread_pool_init(
for( i = 0; i < count; i++ )
{
/* Create a new thread. */
- p_thread = (cl_thread_t*)cl_malloc( sizeof(cl_thread_t) );
+ p_thread = (cl_thread_t*)malloc( sizeof(cl_thread_t) );
if( !p_thread )
{
cl_thread_pool_destroy( p_thread_pool );
@@ -229,7 +229,7 @@ cl_thread_pool_destroy(
p_thread =
(cl_thread_t*)cl_list_remove_head( &p_thread_pool->thread_list );
cl_thread_destroy( p_thread );
- cl_free( p_thread );
+ free( p_thread );
}
}
Index: osm/complib/cl_vector.c
===================================================================
--- osm/complib/cl_vector.c (revision 7470)
+++ osm/complib/cl_vector.c (working copy)
@@ -51,9 +51,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_vector.h>
-#include <complib/cl_memory.h>
/*
@@ -316,12 +316,12 @@ cl_vector_destroy(
/* Deallocate the pages */
while( !cl_is_qlist_empty( &p_vector->alloc_list ) )
- cl_free( cl_qlist_remove_head( &p_vector->alloc_list ) );
+ free( cl_qlist_remove_head( &p_vector->alloc_list ) );
/* Destroy the page vector. */
if( p_vector->p_ptr_array )
{
- cl_free( p_vector->p_ptr_array );
+ free( p_vector->p_ptr_array );
p_vector->p_ptr_array = NULL;
}
}
@@ -406,9 +406,11 @@ cl_vector_set_capacity(
}
/* Allocate our pointer array. */
- p_new_ptr_array = cl_zalloc( new_capacity * sizeof(void*) );
+ p_new_ptr_array = malloc( new_capacity * sizeof(void*) );
if( !p_new_ptr_array )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( p_new_ptr_array, 0, new_capacity * sizeof(void*) );
if( p_vector->p_ptr_array )
{
@@ -417,7 +419,7 @@ cl_vector_set_capacity(
p_vector->capacity * sizeof(void*) );
/* Free the old pointer array. */
- cl_free( p_vector->p_ptr_array );
+ free( p_vector->p_ptr_array );
}
/* Set the new array. */
@@ -431,9 +433,11 @@ cl_vector_set_capacity(
/* Determine the allocation size for the new array elements. */
alloc_size = new_elements * p_vector->element_size;
- p_buf = (cl_list_item_t*)cl_zalloc( alloc_size + sizeof(cl_list_item_t) );
+ p_buf = (cl_list_item_t*)malloc( alloc_size + sizeof(cl_list_item_t) );
if( !p_buf )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( p_buf, 0, alloc_size + sizeof(cl_list_item_t) );
cl_qlist_insert_tail( &p_vector->alloc_list, p_buf );
/* Advance the buffer pointer past the list item. */
Index: osm/complib/cl_event_wheel.c
===================================================================
--- osm/complib/cl_event_wheel.c (revision 7470)
+++ osm/complib/cl_event_wheel.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -40,7 +40,7 @@
#endif /* HAVE_CONFIG_H */
#include <math.h>
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <complib/cl_event_wheel.h>
#include <complib/cl_debug.h>
@@ -130,7 +130,7 @@ __cl_event_wheel_callback( IN void* cont
cl_qlist_remove_head(&p_event_wheel->events_wheel);
/* delete the event info object - allocated by cl_event_wheel_reg */
- cl_free(p_event);
+ free(p_event);
}
else
{
@@ -330,7 +330,7 @@ cl_event_wheel_destroy(
/* remove it from the map */
p_map_item = &(p_event->map_item);
cl_qmap_remove_item(&p_event_wheel->events_map, p_map_item);
- cl_free(p_event); /* allocated by cl_event_wheel_reg */
+ free(p_event); /* allocated by cl_event_wheel_reg */
p_list_item = cl_qlist_remove_head(&p_event_wheel->events_wheel);
}
@@ -387,7 +387,7 @@ cl_event_wheel_reg(
{
/* make a new one */
p_event = (cl_event_wheel_reg_info_t *)
- cl_malloc( sizeof (cl_event_wheel_reg_info_t) );
+ malloc( sizeof (cl_event_wheel_reg_info_t) );
p_event->num_regs = 0;
}
@@ -504,7 +504,7 @@ cl_event_wheel_unreg(
"Removed key:0x%"PRIx64"\n", key );
/* free the item */
- cl_free(p_event);
+ free(p_event);
}
else
{
Index: osm/complib/cl_pool.c
===================================================================
--- osm/complib/cl_pool.c (revision 7470)
+++ osm/complib/cl_pool.c (working copy)
@@ -52,12 +52,12 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_qcomppool.h>
#include <complib/cl_comppool.h>
#include <complib/cl_qpool.h>
#include <complib/cl_pool.h>
-#include <complib/cl_memory.h>
#include <complib/cl_math.h>
@@ -116,11 +116,14 @@ cl_qcpool_init(
* Allocate the array of component sizes and component pointers all
* in one allocation.
*/
- p_pool->component_sizes = (size_t*)cl_zalloc(
+ p_pool->component_sizes = (size_t*)malloc(
(sizeof(size_t) + sizeof(void*)) * num_components );
if( !p_pool->component_sizes )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( p_pool->component_sizes, 0,
+ (sizeof(size_t) + sizeof(void*)) * num_components );
/* Calculate the pointer to the array of pointers, used for callbacks. */
p_pool->p_components =
@@ -213,11 +216,11 @@ cl_qcpool_destroy(
/* Free all alocated memory blocks. */
while( !cl_is_qlist_empty( &p_pool->alloc_list ) )
- cl_free( cl_qlist_remove_head( &p_pool->alloc_list ) );
+ free( cl_qlist_remove_head( &p_pool->alloc_list ) );
if( p_pool->component_sizes )
{
- cl_free( p_pool->component_sizes );
+ free( p_pool->component_sizes );
p_pool->component_sizes = NULL;
}
}
@@ -256,11 +259,14 @@ cl_qcpool_grow(
/* Allocate the buffer for the new objects. */
p_objects = (uint8_t*)
- cl_zalloc( sizeof(cl_list_item_t) + (obj_size * obj_count) );
+ malloc( sizeof(cl_list_item_t) + (obj_size * obj_count) );
/* Make sure the allocation succeeded. */
if( !p_objects )
return( CL_INSUFFICIENT_MEMORY );
+ else
+ memset( p_objects, 0,
+ sizeof(cl_list_item_t) + (obj_size * obj_count) );
/* Insert the allocation in our list. */
cl_qlist_insert_tail( &p_pool->alloc_list, (cl_list_item_t*)p_objects );
Index: osm/osmtest/osmtest.c
===================================================================
--- osm/osmtest/osmtest.c (revision 7470)
+++ osm/osmtest/osmtest.c (working copy)
@@ -64,7 +64,6 @@
#include <sys/time.h>
#endif
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include "osmtest.h"
#ifndef __WIN__
@@ -460,21 +459,21 @@ osmtest_destroy( IN osmtest_t * const p_
{
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
- cl_free( p_item );
+ free( p_item );
}
p_next_item = cl_qmap_head( &p_osmt->exp_subn.mgrp_mlid_tbl );
while( p_next_item != cl_qmap_end( &p_osmt->exp_subn.mgrp_mlid_tbl ) )
{
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
- cl_free( p_item );
+ free( p_item );
}
p_next_item = cl_qmap_head( &p_osmt->exp_subn.node_guid_tbl );
while( p_next_item != cl_qmap_end( &p_osmt->exp_subn.node_guid_tbl ) )
{
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
- cl_free( p_item );
+ free( p_item );
}
p_next_item = cl_qmap_head( &p_osmt->exp_subn.node_lid_tbl );
@@ -482,7 +481,7 @@ osmtest_destroy( IN osmtest_t * const p_
{
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
- cl_free( p_item );
+ free( p_item );
}
p_next_item = cl_qmap_head( &p_osmt->exp_subn.path_tbl );
@@ -490,14 +489,14 @@ osmtest_destroy( IN osmtest_t * const p_
{
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
- cl_free( p_item );
+ free( p_item );
}
p_next_item = cl_qmap_head( &p_osmt->exp_subn.port_key_tbl );
while( p_next_item != cl_qmap_end( &p_osmt->exp_subn.port_key_tbl ) )
{
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
- cl_free( p_item );
+ free( p_item );
}
osm_log_destroy( &p_osmt->log );
Index: osm/osmtest/include/osmtest_subnet.h
===================================================================
--- osm/osmtest/include/osmtest_subnet.h (revision 7470)
+++ osm/osmtest/include/osmtest_subnet.h (working copy)
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -47,7 +48,7 @@
#ifndef _OSMTEST_SUBNET_H_
#define _OSMTEST_SUBNET_H_
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <complib/cl_qmap.h>
#include <opensm/osm_log.h>
#include <vendor/osm_vendor_api.h>
@@ -121,14 +122,16 @@ node_new( void )
{
node_t *p_obj;
- p_obj = cl_zalloc( sizeof( *p_obj ) );
+ p_obj = malloc( sizeof( *p_obj ) );
+ if (p_obj)
+ memset( p_obj, 0, sizeof( *p_obj ) );
return ( p_obj );
}
static inline void
node_delete( IN node_t * p_obj )
{
- cl_free( p_obj );
+ free( p_obj );
}
/****s* Subnet Database/port_t
@@ -179,14 +182,16 @@ port_new( void )
{
port_t *p_obj;
- p_obj = cl_zalloc( sizeof( *p_obj ) );
+ p_obj = malloc( sizeof( *p_obj ) );
+ if (p_obj)
+ memset( p_obj, 0, sizeof( *p_obj ) );
return ( p_obj );
}
static inline void
port_delete( IN port_t * p_obj )
{
- cl_free( p_obj );
+ free( p_obj );
}
static inline uint64_t
@@ -268,14 +273,16 @@ path_new( void )
{
path_t *p_obj;
- p_obj = cl_zalloc( sizeof( *p_obj ) );
+ p_obj = malloc( sizeof( *p_obj ) );
+ if (p_obj)
+ memset( p_obj, 0, sizeof( *p_obj ) );
return ( p_obj );
}
static inline void
path_delete( IN path_t * p_obj )
{
- cl_free( p_obj );
+ free( p_obj );
}
/****s* Subnet Database/subnet_t
Index: osm/osmtest/osmt_service.c
===================================================================
--- osm/osmtest/osmt_service.c (revision 7470)
+++ osm/osmtest/osmt_service.c (working copy)
@@ -60,7 +60,6 @@
#include <stdlib.h>
#include <string.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include "osmtest.h"
ib_api_status_t
@@ -1055,7 +1054,7 @@ osmt_get_all_services_and_check_names( I
OSM_LOG_ENTER(&p_osmt->log, osmt_get_all_services_and_check_names );
/* Prepare tracker for the checked names */
- p_checked_names = (uint8_t*)cl_malloc(sizeof(uint8_t)*num_of_valid_names);
+ p_checked_names = (uint8_t*)malloc(sizeof(uint8_t)*num_of_valid_names);
for (j = 0 ; j < num_of_valid_names ; j++)
{
p_checked_names[j] = 0;
Index: osm/osmtest/main.c
===================================================================
--- osm/osmtest/main.c (revision 7470)
+++ osm/osmtest/main.c (working copy)
@@ -1,6 +1,6 @@
/*
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
- * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
@@ -47,7 +47,6 @@
#include <stdlib.h>
#include <getopt.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include "osmtest.h"
/********************************************************************
@@ -120,7 +119,6 @@ show_usage( )
" -d0 - Unused.\n"
" -d1 - Do not scan/compare path records.\n"
" -d2 - Force log flushing after each log message.\n"
- " -d3 - Use mem tracking.\n"
" Without -d, no debug options are enabled\n\n" );
printf( "-m <LID in hex>\n"
"--max_lid <LID in hex>\n"
@@ -307,7 +305,6 @@ main( int argc,
uint32_t log_flags = OSM_LOG_ERROR | OSM_LOG_INFO;
int32_t vendor_debug=0;
char flow_name[64];
- boolean_t mem_track = FALSE;
uint32_t next_option;
const char *const short_option = "f:l:m:M:d:g:s:t:i:pcvVh";
@@ -559,9 +556,7 @@ main( int argc,
opt.force_log_flush = TRUE;
break;
case 3:
- printf( "Use Mem Tracking\n" );
- mem_track = TRUE;
- break;
+ /* Used to be memory tracking */
default:
printf( "Unknown value %ld (ignored)\n", strtol( optarg, NULL, 0 ) );
break;
@@ -591,7 +586,6 @@ main( int argc,
printf( "\tFlow = %s\n", flow_name );
- if (mem_track) __cl_mem_track(TRUE);
if (vendor_debug)
osm_vendor_set_debug(osm_test.p_vendor, vendor_debug);
@@ -634,8 +628,6 @@ main( int argc,
}
osmtest_destroy( &osm_test );
- if (mem_track) cl_mem_display();
-
complib_exit();
Exit:
Index: osm/osmtest/osmt_multicast.c
===================================================================
--- osm/osmtest/osmt_multicast.c (revision 7470)
+++ osm/osmtest/osmt_multicast.c (working copy)
@@ -53,7 +53,6 @@
#include <stdlib.h>
#include <string.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include <complib/cl_map.h>
#include "osmtest.h"
@@ -157,7 +156,7 @@ osmt_query_mcast( IN osmtest_t * const p
p_item = p_next_item;
p_next_item = cl_qmap_next( p_item );
cl_qmap_remove_item(&p_osmt->exp_subn.mgrp_mlid_tbl,p_item);
- cl_free( p_item );
+ free( p_item );
}
@@ -197,7 +196,7 @@ osmt_query_mcast( IN osmtest_t * const p
status = IB_ERROR;
goto Exit;
}
- p_mgrp = (osmtest_mgrp_t*)cl_malloc( sizeof(*p_mgrp) );
+ p_mgrp = (osmtest_mgrp_t*)malloc( sizeof(*p_mgrp) );
if (!p_mgrp)
{
osm_log( &p_osmt->log, OSM_LOG_ERROR,
Index: osm/opensm/osm_port.c
===================================================================
--- osm/opensm/osm_port.c (revision 7470)
+++ osm/opensm/osm_port.c (working copy)
@@ -53,7 +53,6 @@
#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_debug.h>
#include <iba/ib_types.h>
#include <opensm/osm_port.h>
@@ -88,7 +87,7 @@ osm_physp_destroy(
/* free the SL2VL Tables */
num_slvl = cl_ptr_vector_get_size(&p_physp->slvl_by_port);
for (i = 0; i < num_slvl; i++)
- cl_free(cl_ptr_vector_get(&p_physp->slvl_by_port, i));
+ free(cl_ptr_vector_get(&p_physp->slvl_by_port, i));
cl_ptr_vector_destroy(&p_physp->slvl_by_port);
/* free the P_Key Tables */
@@ -142,7 +141,9 @@ osm_physp_init(
cl_ptr_vector_init( &p_physp->slvl_by_port, num_slvl, 1);
for (i = 0; i < num_slvl; i++)
{
- p_slvl = (ib_slvl_table_t *)cl_zalloc(sizeof(ib_slvl_table_t));
+ p_slvl = (ib_slvl_table_t *)malloc(sizeof(ib_slvl_table_t));
+ if (p_slvl)
+ memset(p_slvl, 0, sizeof(ib_slvl_table_t));
cl_ptr_vector_set(&p_physp->slvl_by_port, i, p_slvl);
}
@@ -238,9 +239,12 @@ osm_port_new(
*/
size = p_ni->num_ports;
- p_port = cl_zalloc( sizeof(*p_port) + sizeof(void *) * size );
+ p_port = malloc( sizeof(*p_port) + sizeof(void *) * size );
if( p_port != NULL )
+ {
+ memset( p_port, 0, sizeof(*p_port) + sizeof(void *) * size );
osm_port_init( p_port, p_ni, p_parent_node );
+ }
return( p_port );
}
@@ -706,7 +710,7 @@ osm_physp_replace_dr_path_with_alternate
BFS from OSM port until we find the target physp but avoid
going through mapped ports
*/
- p_nextPortsList = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_nextPortsList = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_nextPortsList );
cl_list_init( p_nextPortsList, 10 );
@@ -741,7 +745,7 @@ osm_physp_replace_dr_path_with_alternate
{
next_list_is_full = FALSE;
p_currPortsList = p_nextPortsList;
- p_nextPortsList = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_nextPortsList = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_nextPortsList );
cl_list_init( p_nextPortsList, 10 );
p_physp = (osm_physp_t*)cl_list_remove_head( p_currPortsList );
@@ -806,13 +810,13 @@ osm_physp_replace_dr_path_with_alternate
}
}
cl_list_destroy( p_currPortsList );
- cl_free(p_currPortsList);
+ free(p_currPortsList);
}
/* cleanup */
Exit:
cl_list_destroy( p_nextPortsList );
- cl_free( p_nextPortsList );
+ free( p_nextPortsList );
cl_map_destroy( &physp_map );
cl_map_destroy( &visited_map );
}
Index: osm/opensm/osm_state_mgr.c
===================================================================
--- osm/opensm/osm_state_mgr.c (revision 7470)
+++ osm/opensm/osm_state_mgr.c (working copy)
@@ -54,7 +54,6 @@
#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_passivelock.h>
#include <complib/cl_debug.h>
#include <opensm/osm_state_mgr.h>
@@ -1086,7 +1085,7 @@ osm_topology_file_create(
CL_PLOCK_ACQUIRE( p_mgr->p_lock );
file_name =
- ( char * )cl_malloc( strlen( p_mgr->p_subn->opt.dump_files_dir ) + 12 );
+ ( char * )malloc( strlen( p_mgr->p_subn->opt.dump_files_dir ) + 12 );
CL_ASSERT( file_name );
@@ -1232,7 +1231,7 @@ osm_topology_file_create(
fclose( rc );
Exit:
- cl_free( file_name );
+ free( file_name );
OSM_LOG_EXIT( p_mgr->p_log );
}
@@ -1450,7 +1449,7 @@ __process_idle_time_queue_done(
}
- cl_free( p_process_item );
+ free( p_process_item );
OSM_LOG_EXIT( p_mgr->p_log );
return;
@@ -2976,7 +2975,7 @@ osm_state_mgr_process_idle(
OSM_LOG_ENTER( p_mgr->p_log, osm_state_mgr_process_idle );
- p_idle_item = cl_zalloc( sizeof( osm_idle_item_t ) );
+ p_idle_item = malloc( sizeof( osm_idle_item_t ) );
if( p_idle_item == NULL )
{
osm_log( p_mgr->p_log, OSM_LOG_ERROR,
@@ -2985,6 +2984,7 @@ osm_state_mgr_process_idle(
return IB_ERROR;
}
+ memset( p_idle_item, 0, sizeof( osm_idle_item_t ) );
p_idle_item->pfn_start = pfn_start;
p_idle_item->pfn_done = pfn_done;
p_idle_item->context1 = context1;
Index: osm/opensm/osm_subnet.c
===================================================================
--- osm/opensm/osm_subnet.c (revision 7470)
+++ osm/opensm/osm_subnet.c (working copy)
@@ -51,8 +51,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_debug.h>
#include <opensm/osm_subnet.h>
#include <opensm/osm_opensm.h>
@@ -137,7 +137,7 @@ osm_subn_destroy(
{
p_rsm = p_next_rsm;
p_next_rsm = (osm_remote_sm_t*)cl_qmap_next( &p_rsm->map_item );
- cl_free( p_rsm );
+ free( p_rsm );
}
p_next_prtn = (osm_prtn_t*)cl_qmap_head( &p_subn->prtn_pkey_tbl );
@@ -634,7 +634,7 @@ __osm_subn_opts_unpack_charp(
p_key, p_val_str);
printf(buff);
cl_log_event("OpenSM", LOG_INFO, buff, NULL, 0);
- *p_val = (char *)cl_malloc( strlen(p_val_str) +1 );
+ *p_val = (char *)malloc( strlen(p_val_str) +1 );
strcpy( *p_val, p_val_str);
}
}
Index: osm/opensm/osm_db_files.c
===================================================================
--- osm/opensm/osm_db_files.c (revision 7470)
+++ osm/opensm/osm_db_files.c (working copy)
@@ -50,7 +50,6 @@
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <opensm/st.h>
#include <opensm/osm_db.h>
@@ -146,8 +145,8 @@ osm_db_domain_destroy(
cl_spinlock_destroy( &p_domain_imp->lock );
st_free_table( p_domain_imp->p_hash );
- cl_free( p_domain_imp->file_name );
- cl_free( p_domain_imp );
+ free( p_domain_imp->file_name );
+ free( p_domain_imp );
}
/***************************************************************************
@@ -161,10 +160,10 @@ osm_db_destroy(
while ((p_domain = cl_list_remove_head( &p_db->domains )) != NULL )
{
osm_db_domain_destroy( p_domain );
- cl_free( p_domain );
+ free( p_domain );
}
cl_list_destroy( &p_db->domains );
- cl_free( p_db->p_db_imp );
+ free( p_db->p_db_imp );
}
/***************************************************************************
@@ -179,7 +178,7 @@ osm_db_init(
OSM_LOG_ENTER( p_log, osm_db_init );
- p_db_imp = (osm_db_imp_t *)cl_malloc(sizeof(osm_db_imp_t));
+ p_db_imp = (osm_db_imp_t *)malloc(sizeof(osm_db_imp_t));
CL_ASSERT( p_db_imp != NULL);
p_db_imp->db_dir_name = getenv("OSM_CACHE_DIR");
@@ -233,18 +232,18 @@ osm_db_domain_init(
OSM_LOG_ENTER( p_log, osm_db_domain_init );
/* allocate a new domain object */
- p_domain = (osm_db_domain_t *)cl_malloc(sizeof(osm_db_domain_t));
+ p_domain = (osm_db_domain_t *)malloc(sizeof(osm_db_domain_t));
CL_ASSERT( p_domain != NULL );
p_domain_imp =
- (osm_db_domain_imp_t *)cl_malloc(sizeof(osm_db_domain_imp_t));
+ (osm_db_domain_imp_t *)malloc(sizeof(osm_db_domain_imp_t));
CL_ASSERT( p_domain_imp != NULL );
dir_name_len = strlen(((osm_db_imp_t*)p_db->p_db_imp)->db_dir_name);
/* set the domain file name */
p_domain_imp->file_name =
- (char *)cl_malloc(sizeof(char)*(dir_name_len) + strlen(domain_name) + 2);
+ (char *)malloc(sizeof(char)*(dir_name_len) + strlen(domain_name) + 2);
CL_ASSERT(p_domain_imp->file_name != NULL);
strcpy(p_domain_imp->file_name,((osm_db_imp_t*)p_db->p_db_imp)->db_dir_name);
strcat(p_domain_imp->file_name,domain_name);
@@ -257,8 +256,8 @@ osm_db_domain_init(
"osm_db_domain_init: ERR 6102: "
" Failed to open the db file:%s\n",
p_domain_imp->file_name);
- cl_free(p_domain_imp);
- cl_free(p_domain);
+ free(p_domain_imp);
+ free(p_domain);
p_domain = NULL;
goto Exit;
}
@@ -364,19 +363,19 @@ osm_db_restore(
goto EndParsing;
}
- p_key = (char *)cl_malloc(sizeof(char)*(strlen(p_first_word) + 1));
+ p_key = (char *)malloc(sizeof(char)*(strlen(p_first_word) + 1));
strcpy(p_key, p_first_word);
p_rest_of_line = strtok_r(NULL, "\n", &p_last);
if (p_rest_of_line != NULL)
{
p_accum_val =
- (char*)cl_malloc(sizeof(char)*(strlen(p_rest_of_line) + 1));
+ (char*)malloc(sizeof(char)*(strlen(p_rest_of_line) + 1));
strcpy(p_accum_val, p_rest_of_line);
}
else
{
- p_accum_val = (char*)cl_malloc(2);
+ p_accum_val = (char*)malloc(2);
strcpy(p_accum_val, "\0");
}
}
@@ -429,9 +428,9 @@ osm_db_restore(
/* accumulate into the value */
p_prev_val = p_accum_val;
p_accum_val =
- (char *)cl_malloc(strlen(p_prev_val) + strlen(sLine) + 1);
+ (char *)malloc(strlen(p_prev_val) + strlen(sLine) + 1);
strcpy(p_accum_val, p_prev_val);
- cl_free(p_prev_val);
+ free(p_prev_val);
strcat(p_accum_val, sLine);
}
} /* in key */
@@ -473,7 +472,7 @@ osm_db_store(
p_domain_imp = (osm_db_domain_imp_t *)p_domain->p_domain_imp;
p_tmp_file_name =
- (char *)cl_malloc(sizeof(char)*(strlen(p_domain_imp->file_name)+8));
+ (char *)malloc(sizeof(char)*(strlen(p_domain_imp->file_name)+8));
strcpy(p_tmp_file_name, p_domain_imp->file_name);
strcat(p_tmp_file_name,".tmp");
@@ -514,7 +513,7 @@ osm_db_store(
}
Exit:
cl_spinlock_release( &p_domain_imp->lock );
- cl_free(p_tmp_file_name);
+ free(p_tmp_file_name);
OSM_LOG_EXIT( p_log );
return status;
}
@@ -526,8 +525,8 @@ osm_db_store(
int
__osm_clear_tbl_entry(st_data_t key, st_data_t val, st_data_t arg)
{
- cl_free((char*)key);
- cl_free((char*)val);
+ free((char*)key);
+ free((char*)val);
return ST_DELETE;
}
@@ -625,17 +624,18 @@ osm_db_update(
else
{
/* need to allocate the key */
- p_new_key = cl_malloc(sizeof(char)*(strlen(p_key) + 1));
+ p_new_key = malloc(sizeof(char)*(strlen(p_key) + 1));
strcpy(p_new_key, p_key);
}
/* need to arange a new copy of the value */
- p_new_val = cl_malloc(sizeof(char)*(strlen(p_val) + 1));
+ p_new_val = malloc(sizeof(char)*(strlen(p_val) + 1));
strcpy(p_new_val, p_val);
st_insert(p_domain_imp->p_hash, (st_data_t)p_new_key, (st_data_t)p_new_val);
- if (p_prev_val) cl_free(p_prev_val);
+ if (p_prev_val)
+ free(p_prev_val);
cl_spinlock_release( &p_domain_imp->lock );
@@ -674,8 +674,8 @@ osm_db_delete(
}
else
{
- cl_free(p_key);
- cl_free(p_prev_val);
+ free(p_key);
+ free(p_prev_val);
res = 0;
}
}
Index: osm/opensm/osm_node.c
===================================================================
--- osm/opensm/osm_node.c (revision 7470)
+++ osm/opensm/osm_node.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -51,7 +51,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <iba/ib_types.h>
#include <opensm/osm_node.h>
#include <opensm/osm_madw.h>
@@ -120,9 +120,10 @@ osm_node_new(
*/
size = p_ni->num_ports;
- p_node = cl_zalloc( sizeof(*p_node) + sizeof(osm_physp_t) * size );
+ p_node = malloc( sizeof(*p_node) + sizeof(osm_physp_t) * size );
if( p_node != NULL )
{
+ memset( p_node, 0, sizeof(*p_node) + sizeof(osm_physp_t) * size );
p_node->node_info = *p_ni;
p_node->physp_tbl_size = size + 1;
@@ -174,7 +175,7 @@ osm_node_delete(
IN OUT osm_node_t** const p_node )
{
osm_node_destroy( *p_node );
- cl_free( *p_node );
+ free( *p_node );
*p_node = NULL;
}
Index: osm/opensm/osm_mcm_info.c
===================================================================
--- osm/opensm/osm_mcm_info.c (revision 7470)
+++ osm/opensm/osm_mcm_info.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -51,7 +51,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <opensm/osm_mcm_info.h>
/**********************************************************************
@@ -82,9 +82,10 @@ osm_mcm_info_new(
{
osm_mcm_info_t* p_mcm;
- p_mcm = (osm_mcm_info_t*)cl_zalloc( sizeof(*p_mcm) );
+ p_mcm = (osm_mcm_info_t*)malloc( sizeof(*p_mcm) );
if( p_mcm )
{
+ memset(p_mcm, 0, sizeof(*p_mcm) );
osm_mcm_info_init( p_mcm, mlid );
}
@@ -98,6 +99,6 @@ osm_mcm_info_delete(
IN osm_mcm_info_t* const p_mcm )
{
osm_mcm_info_destroy( p_mcm );
- cl_free( p_mcm );
+ free( p_mcm );
}
Index: osm/opensm/osm_inform.c
===================================================================
--- osm/opensm/osm_inform.c (revision 7470)
+++ osm/opensm/osm_inform.c (working copy)
@@ -49,9 +49,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include <complib/cl_timer.h>
#include <opensm/osm_sa_informinfo.h>
#include <opensm/osm_helper.h>
@@ -83,7 +83,7 @@ void
osm_infr_destroy(
IN osm_infr_t* const p_infr )
{
- cl_free(p_infr);
+ free(p_infr);
}
/**********************************************************************
@@ -112,7 +112,7 @@ osm_infr_new(
CL_ASSERT(p_infr_rec);
- p_infr = (osm_infr_t*)cl_malloc( sizeof(osm_infr_t) );
+ p_infr = (osm_infr_t*)malloc( sizeof(osm_infr_t) );
if( p_infr )
{
osm_infr_construct( p_infr );
Index: osm/opensm/osm_service.c
===================================================================
--- osm/opensm/osm_service.c (revision 7470)
+++ osm/opensm/osm_service.c (working copy)
@@ -49,9 +49,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include <complib/cl_timer.h>
#include <opensm/osm_service.h>
@@ -70,7 +69,7 @@ void
osm_svcr_destroy(
IN osm_svcr_t* const p_svcr )
{
- cl_free( p_svcr);
+ free( p_svcr);
}
/**********************************************************************
@@ -102,7 +101,7 @@ osm_svcr_new(
CL_ASSERT(p_svc_rec);
- p_svcr = (osm_svcr_t*)cl_malloc( sizeof(*p_svcr) );
+ p_svcr = (osm_svcr_t*)malloc( sizeof(*p_svcr) );
if( p_svcr )
{
osm_svcr_construct( p_svcr );
Index: osm/opensm/osm_switch.c
===================================================================
--- osm/opensm/osm_switch.c (revision 7470)
+++ osm/opensm/osm_switch.c (working copy)
@@ -51,8 +51,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_math.h>
#include <iba/ib_types.h>
#include <opensm/osm_switch.h>
@@ -104,13 +104,15 @@ osm_switch_init(
status = osm_fwd_tbl_init( &p_sw->fwd_tbl, p_si );
- p_sw->p_prof = cl_zalloc( sizeof(*p_sw->p_prof) * num_ports );
+ p_sw->p_prof = malloc( sizeof(*p_sw->p_prof) * num_ports );
if( p_sw->p_prof == NULL )
{
status = IB_INSUFFICIENT_MEMORY;
goto Exit;
}
+ memset( p_sw->p_prof, 0, sizeof(*p_sw->p_prof) * num_ports );
+
status = osm_mcast_tbl_init( &p_sw->mcast_tbl,
osm_node_get_num_physp( p_node ), cl_ntoh16( p_si->mcast_cap ) );
if( status != IB_SUCCESS )
@@ -131,7 +133,7 @@ osm_switch_destroy(
{
/* free memory to avoid leaks */
osm_mcast_tbl_destroy( &p_sw->mcast_tbl );
- cl_free( p_sw->p_prof );
+ free( p_sw->p_prof );
osm_fwd_tbl_destroy( &p_sw->fwd_tbl );
osm_lid_matrix_destroy( &p_sw->lmx );
}
@@ -143,7 +145,7 @@ osm_switch_delete(
IN OUT osm_switch_t** const pp_sw )
{
osm_switch_destroy( *pp_sw );
- cl_free( *pp_sw );
+ free( *pp_sw );
*pp_sw = NULL;
}
@@ -157,9 +159,10 @@ osm_switch_new(
ib_api_status_t status;
osm_switch_t *p_sw;
- p_sw = (osm_switch_t*)cl_zalloc( sizeof(*p_sw) );
+ p_sw = (osm_switch_t*)malloc( sizeof(*p_sw) );
if( p_sw )
{
+ memset( p_sw, 0, sizeof(*p_sw) );
status = osm_switch_init( p_sw, p_node, p_madw );
if( status != IB_SUCCESS )
osm_switch_delete( &p_sw );
Index: osm/opensm/osm_sminfo_rcv.c
===================================================================
--- osm/opensm/osm_sminfo_rcv.c (revision 7470)
+++ osm/opensm/osm_sminfo_rcv.c (working copy)
@@ -51,9 +51,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qmap.h>
#include <complib/cl_passivelock.h>
#include <complib/cl_debug.h>
@@ -638,7 +638,7 @@ __osm_sminfo_rcv_process_get_response(
p_sm = (osm_remote_sm_t*)cl_qmap_get( p_sm_tbl, port_guid );
if( p_sm == (osm_remote_sm_t*)cl_qmap_end( p_sm_tbl ) )
{
- p_sm = cl_malloc( sizeof(*p_sm) );
+ p_sm = malloc( sizeof(*p_sm) );
if( p_sm == NULL )
{
osm_log( p_rcv->p_log, OSM_LOG_ERROR,
Index: osm/opensm/osm_multicast.c
===================================================================
--- osm/opensm/osm_multicast.c (revision 7470)
+++ osm/opensm/osm_multicast.c (working copy)
@@ -49,8 +49,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_multicast.h>
#include <opensm/osm_mcm_port.h>
#include <opensm/osm_mtree.h>
@@ -107,7 +107,7 @@ osm_mgrp_destroy(
/* destroy the mtree_node structure */
osm_mtree_destroy(p_mgrp->p_root);
- cl_free(p_mgrp);
+ free(p_mgrp);
}
/**********************************************************************
@@ -135,7 +135,7 @@ osm_mgrp_new(
{
osm_mgrp_t* p_mgrp;
- p_mgrp = (osm_mgrp_t*)cl_malloc( sizeof(*p_mgrp) );
+ p_mgrp = (osm_mgrp_t*)malloc( sizeof(*p_mgrp) );
if( p_mgrp )
osm_mgrp_init( p_mgrp, mlid );
Index: osm/opensm/osm_mtree.c
===================================================================
--- osm/opensm/osm_mtree.c (revision 7470)
+++ osm/opensm/osm_mtree.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
*
@@ -50,7 +50,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <complib/cl_debug.h>
#include <opensm/osm_mtree.h>
@@ -83,8 +83,8 @@ osm_mtree_node_new(
{
osm_mtree_node_t *p_mtn;
- p_mtn = cl_malloc( sizeof(osm_mtree_node_t) +
- sizeof(void*) * (osm_switch_get_num_ports( p_sw ) - 1) );
+ p_mtn = malloc( sizeof(osm_mtree_node_t) +
+ sizeof(void*) * (osm_switch_get_num_ports( p_sw ) - 1) );
if( p_mtn != NULL )
osm_mtree_node_init( p_mtn, p_sw );
@@ -109,7 +109,7 @@ osm_mtree_destroy(
(p_mtn->child_array[i] != OSM_MTREE_LEAF) )
osm_mtree_destroy(p_mtn->child_array[i]);
- cl_free( p_mtn );
+ free( p_mtn );
}
/**********************************************************************
Index: osm/opensm/osm_mcast_mgr.c
===================================================================
--- osm/opensm/osm_mcast_mgr.c (revision 7470)
+++ osm/opensm/osm_mcast_mgr.c (working copy)
@@ -51,9 +51,9 @@
#endif /* HAVE_CONFIG_H */
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_debug.h>
#include <opensm/osm_mcast_mgr.h>
#include <opensm/osm_multicast.h>
@@ -88,9 +88,12 @@ __osm_mcast_work_obj_new(
qlist.
see cl_qlist_insert_tail(): CL_ASSERT(p_list_item->p_list != p_list)
*/
- p_obj = cl_zalloc( sizeof( *p_obj ) );
+ p_obj = malloc( sizeof( *p_obj ) );
if( p_obj )
+ {
+ memset( p_obj, 0, sizeof( *p_obj ) );
p_obj->p_port = (osm_port_t*)p_port;
+ }
return( p_obj );
}
@@ -101,7 +104,7 @@ static void
__osm_mcast_work_obj_delete(
IN osm_mcast_work_obj_t* p_wobj )
{
- cl_free( p_wobj );
+ free( p_wobj );
}
/**********************************************************************
@@ -123,7 +126,7 @@ __osm_mcast_mgr_purge_tree_node(
}
- cl_free( p_mtn );
+ free( p_mtn );
}
/**********************************************************************
@@ -738,7 +741,7 @@ __osm_mcast_mgr_branch(
TO DO - this list array could probably be moved
inside the switch element to save on malloc thrashing.
*/
- list_array = cl_zalloc( sizeof(cl_qlist_t) * max_children );
+ list_array = malloc( sizeof(cl_qlist_t) * max_children );
if( list_array == NULL )
{
osm_log( p_mgr->p_log, OSM_LOG_ERROR,
@@ -748,6 +751,8 @@ __osm_mcast_mgr_branch(
goto Exit;
}
+ memset( list_array, 0, sizeof(cl_qlist_t) * max_children );
+
for( i = 0; i < max_children; i++ )
cl_qlist_init( &list_array[i] );
@@ -875,7 +880,7 @@ __osm_mcast_mgr_branch(
}
}
- cl_free( list_array );
+ free( list_array );
Exit:
OSM_LOG_EXIT( p_mgr->p_log );
return( p_mtn );
@@ -1395,7 +1400,7 @@ osm_mcast_mgr_dump_mcast_routes(
goto Exit;
file_name =
- (char*)cl_malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + 12);
+ (char*)malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + 12);
CL_ASSERT(file_name);
@@ -1457,7 +1462,7 @@ osm_mcast_mgr_dump_mcast_routes(
Exit:
if (file_name)
- cl_free(file_name);
+ free(file_name);
OSM_LOG_EXIT( p_mgr->p_log );
}
@@ -1639,7 +1644,7 @@ osm_mcast_mgr_process_mgrp_cb(
memcpy(&mlid, &p_ctxt->mlid, sizeof(mlid));
/* we can destroy the context now */
- cl_free(p_ctxt);
+ free(p_ctxt);
/* we need a lock to make sure the p_mgrp is not change other ways */
CL_PLOCK_EXCL_ACQUIRE( p_mgr->p_lock );
Index: osm/opensm/osm_sm.c
===================================================================
--- osm/opensm/osm_sm.c (revision 7470)
+++ osm/opensm/osm_sm.c (working copy)
@@ -55,8 +55,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qmap.h>
#include <complib/cl_passivelock.h>
#include <complib/cl_debug.h>
@@ -261,7 +261,7 @@ osm_sm_destroy(
cl_event_destroy( &p_sm->subnet_up_event );
if( p_sm->p_report_buf != NULL )
- cl_free( p_sm->p_report_buf );
+ free( p_sm->p_report_buf );
osm_log( p_sm->p_log, OSM_LOG_SYS, "Exiting SM\n" ); /* Format Waived */
OSM_LOG_EXIT( p_sm->p_log );
@@ -295,7 +295,7 @@ osm_sm_init(
p_sm->p_disp = p_disp;
p_sm->p_lock = p_lock;
- p_sm->p_report_buf = cl_malloc( OSM_REPORT_BUF_SIZE );
+ p_sm->p_report_buf = malloc( OSM_REPORT_BUF_SIZE );
if( p_sm->p_report_buf == NULL )
{
osm_log( p_sm->p_log, OSM_LOG_ERROR,
@@ -596,7 +596,7 @@ __osm_sm_mgrp_connect(
* isn't busy trying to do something else.
*/
ctx2 =
- ( osm_mcast_mgr_ctxt_t * ) cl_malloc( sizeof( osm_mcast_mgr_ctxt_t ) );
+ ( osm_mcast_mgr_ctxt_t * ) malloc( sizeof( osm_mcast_mgr_ctxt_t ) );
memcpy( &ctx2->mlid, &p_mgrp->mlid, sizeof( p_mgrp->mlid ) );
ctx2->req_type = req_type;
ctx2->port_guid = port_guid;
@@ -629,7 +629,7 @@ __osm_sm_mgrp_disconnect(
* isn't busy trying to do something else.
*/
ctx2 =
- ( osm_mcast_mgr_ctxt_t * ) cl_malloc( sizeof( osm_mcast_mgr_ctxt_t ) );
+ ( osm_mcast_mgr_ctxt_t * ) malloc( sizeof( osm_mcast_mgr_ctxt_t ) );
memcpy( &ctx2->mlid, &p_mgrp->mlid, sizeof( p_mgrp->mlid ) );
ctx2->req_type = OSM_MCAST_REQ_TYPE_LEAVE;
ctx2->port_guid = port_guid;
Index: osm/opensm/osm_lin_fwd_tbl.c
===================================================================
--- osm/opensm/osm_lin_fwd_tbl.c (revision 7470)
+++ osm/opensm/osm_lin_fwd_tbl.c (working copy)
@@ -51,8 +51,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_math.h>
#include <iba/ib_types.h>
#include <opensm/osm_lin_fwd_tbl.h>
@@ -78,7 +78,7 @@ osm_lin_tbl_new(
so add 1 to the end of the range here for this assert.
*/
CL_ASSERT( size <= IB_LID_UCAST_END_HO + 1 );
- p_tbl = (osm_lin_fwd_tbl_t*)cl_malloc(
+ p_tbl = (osm_lin_fwd_tbl_t*)malloc(
__osm_lin_tbl_compute_obj_size( size ) );
/*
@@ -98,6 +98,6 @@ void
osm_lin_tbl_delete(
IN osm_lin_fwd_tbl_t** const pp_tbl )
{
- cl_free( *pp_tbl );
+ free( *pp_tbl );
*pp_tbl = NULL;
}
Index: osm/opensm/osm_prtn.c
===================================================================
--- osm/opensm/osm_prtn.c (revision 7470)
+++ osm/opensm/osm_prtn.c (working copy)
@@ -49,12 +49,12 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_opensm.h>
#include <opensm/osm_partition.h>
#include <opensm/osm_node.h>
@@ -73,9 +73,11 @@ osm_prtn_t* osm_prtn_new(
IN const char *name,
IN const uint16_t pkey )
{
- osm_prtn_t *p = cl_zalloc(sizeof(*p));
+ osm_prtn_t *p = malloc(sizeof(*p));
if (!p)
return NULL;
+
+ memset(p, 0, sizeof(*p));
p->pkey = pkey;
cl_map_construct(&p->full_guid_tbl);
cl_map_init(&p->full_guid_tbl, 32);
@@ -99,7 +101,7 @@ void osm_prtn_delete(
cl_map_destroy(&p->full_guid_tbl);
cl_map_remove_all(&p->part_guid_tbl);
cl_map_destroy(&p->part_guid_tbl);
- cl_free(p);
+ free(p);
*pp_prtn = NULL;
}
Index: osm/opensm/osm_ucast_mgr.c
===================================================================
--- osm/opensm/osm_ucast_mgr.c (revision 7470)
+++ osm/opensm/osm_ucast_mgr.c (working copy)
@@ -55,9 +55,9 @@
#endif /* HAVE_CONFIG_H */
#include <unistd.h>
+#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qmap.h>
#include <complib/cl_debug.h>
#include <opensm/osm_ucast_mgr.h>
@@ -231,7 +231,7 @@ osm_ucast_mgr_dump_ucast_routes(
goto Exit;
file_name =
- (char*)cl_malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + 10);
+ (char*)malloc(strlen(p_mgr->p_subn->opt.dump_files_dir) + 10);
CL_ASSERT(file_name);
@@ -332,7 +332,7 @@ osm_ucast_mgr_dump_ucast_routes(
Exit:
if (file_name)
- cl_free(file_name);
+ free(file_name);
OSM_LOG_EXIT( p_mgr->p_log );
}
@@ -642,7 +642,7 @@ __osm_ucast_mgr_process_port(
OSM_LOG_ENTER( p_mgr->p_log, __osm_ucast_mgr_process_port );
- remote_sys_guids = cl_zalloc( sizeof(uint64_t) * lids_per_port );
+ remote_sys_guids = malloc( sizeof(uint64_t) * lids_per_port );
if( remote_sys_guids == NULL )
{
osm_log( p_mgr->p_log, OSM_LOG_ERROR,
@@ -651,7 +651,9 @@ __osm_ucast_mgr_process_port(
goto Exit;
}
- remote_node_guids = cl_zalloc( sizeof(uint64_t) * lids_per_port );
+ memset( remote_sys_guids, 0, sizeof(uint64_t) * lids_per_port );
+
+ remote_node_guids = malloc( sizeof(uint64_t) * lids_per_port );
if( remote_node_guids == NULL )
{
osm_log( p_mgr->p_log, OSM_LOG_ERROR,
@@ -660,6 +662,8 @@ __osm_ucast_mgr_process_port(
goto Exit;
}
+ memset(remote_node_guids, 0, sizeof(uint64_t) * lids_per_port );
+
osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
/* If the lids are zero - then there was some problem with the initialization.
@@ -789,9 +793,9 @@ __osm_ucast_mgr_process_port(
Exit:
if (remote_sys_guids)
- cl_free(remote_sys_guids);
+ free(remote_sys_guids);
if (remote_node_guids)
- cl_free(remote_node_guids);
+ free(remote_node_guids);
OSM_LOG_EXIT( p_mgr->p_log );
}
Index: osm/opensm/osm_ucast_updn.c
===================================================================
--- osm/opensm/osm_ucast_updn.c (revision 7470)
+++ osm/opensm/osm_ucast_updn.c (working copy)
@@ -50,7 +50,7 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
-#include <complib/cl_memory.h>
+#include <stdlib.h>
#include <complib/cl_debug.h>
#include <complib/cl_qmap.h>
#include <opensm/osm_switch.h>
@@ -118,13 +118,16 @@ __updn_create_updn_next_step_t(IN updn_s
{
updn_next_step_t *p_next_step;
- p_next_step = (updn_next_step_t*) cl_zalloc(sizeof(*p_next_step));
+ p_next_step = (updn_next_step_t*) malloc(sizeof(*p_next_step));
CL_ASSERT (p_next_step != NULL);
+ if (p_next_step)
+ {
+ memset(p_next_step, 0, sizeof(*p_next_step));
+ p_next_step->state = state;
+ p_next_step->p_sw = p_sw;
+ }
- p_next_step->state = state;
- p_next_step->p_sw = p_sw;
return p_next_step;
-
}
/**********************************************************************
@@ -142,7 +145,7 @@ __updn_update_rank(
p_updn_rank = (updn_rank_t*) cl_qmap_get(p_guid_rank_tbl, guid_index);
if (p_updn_rank == (updn_rank_t*) cl_qmap_end(p_guid_rank_tbl))
{
- p_updn_rank = (updn_rank_t*) cl_malloc(sizeof(updn_rank_t));
+ p_updn_rank = (updn_rank_t*) malloc(sizeof(updn_rank_t));
CL_ASSERT (p_updn_rank);
p_updn_rank->rank = rank;
@@ -181,7 +184,7 @@ __updn_bfs_by_node(IN osm_subn_t *p_subn
OSM_LOG_ENTER( &(osm.log), __updn_bfs_by_node);
/* Init the list pointers */
- p_nextList = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_nextList = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_nextList );
cl_list_init( p_nextList, 10 );
p_currList = p_nextList;
@@ -293,7 +296,7 @@ __updn_bfs_by_node(IN osm_subn_t *p_subn
"__updn_bfs_by_node:"
"Starting a new iteration with %d elements in current list\n", cl_list_count(p_currList));
/* Init the switch directed list */
- p_nextList = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_nextList = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_nextList );
cl_list_init( p_nextList, 10 );
/* Go over all current list items till it's empty */
@@ -433,19 +436,19 @@ __updn_bfs_by_node(IN osm_subn_t *p_subn
}
}
}
- cl_free (p_updn_switch);
+ free (p_updn_switch);
p_updn_switch = (updn_next_step_t*)cl_list_remove_head( p_currList );
}
/* Cleanup p_currList */
cl_list_destroy( p_currList );
- cl_free (p_currList);
+ free (p_currList);
/* Reassign p_currList to p_nextList */
p_currList = p_nextList;
}
/* Cleanup p_currList - Had the pointer to cl_list_t */
cl_list_destroy( p_currList );
- cl_free (p_currList);
+ free (p_currList);
osm_log(&(osm.log), OSM_LOG_VERBOSE,
"__updn_bfs_by_node:"
"BFS the subnet ]\n");
@@ -471,22 +474,22 @@ updn_destroy(
"guid = 0x%" PRIx64 " rank = %u\n",
cl_ntoh64(cl_qmap_key(p_map_item)), ((updn_rank_t *)p_map_item)->rank);
cl_qmap_remove_item( &p_updn->guid_rank_tbl, p_map_item);
- cl_free( (updn_rank_t *)p_map_item);
+ free( (updn_rank_t *)p_map_item);
p_map_item = cl_qmap_head( &p_updn->guid_rank_tbl);
}
/* free the array of guids */
if (p_updn->updn_ucast_reg_inputs.guid_list)
- cl_free(p_updn->updn_ucast_reg_inputs.guid_list);
+ free(p_updn->updn_ucast_reg_inputs.guid_list);
/* destroy the list of root nodes */
while ((p_guid_list_item = cl_list_remove_head( p_updn->p_root_nodes )))
- cl_free( p_guid_list_item );
+ free( p_guid_list_item );
cl_list_remove_all( p_updn->p_root_nodes );
cl_list_destroy( p_updn->p_root_nodes );
- cl_free ( p_updn->p_root_nodes );
- cl_free (p_updn);
+ free ( p_updn->p_root_nodes );
+ free (p_updn);
}
updn_t*
@@ -495,7 +498,9 @@ updn_construct(void)
updn_t* p_updn;
OSM_LOG_ENTER( &(osm.log), updn_construct);
- p_updn = cl_zalloc(sizeof(updn_t));
+ p_updn = malloc(sizeof(updn_t));
+ if (p_updn)
+ memset(p_updn, 0, sizeof(updn_t));
OSM_LOG_EXIT( &(osm.log) );
return(p_updn);
}
@@ -522,7 +527,7 @@ updn_init(
}
p_updn->state = UPDN_INIT;
cl_qmap_init( &p_updn->guid_rank_tbl);
- p_list = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_list = (cl_list_t*)malloc(sizeof(cl_list_t));
if (!p_list)
{
status = IB_ERROR;
@@ -563,7 +568,7 @@ updn_init(
/* Skip Empty Lines anywhere in the file - only one char means the Null termination */
if (strlen(line) > 1)
{
- p_tmp = cl_malloc(sizeof(uint64_t));
+ p_tmp = malloc(sizeof(uint64_t));
*p_tmp = strtoull(line, NULL, 16);
cl_list_insert_tail(osm.p_updn_ucast_routing->p_root_nodes, p_tmp);
}
@@ -636,7 +641,7 @@ updn_subn_rank(
"Ranking starts from GUID 0x%" PRIx64 "\n", root_guid);
/* Init the list pointers */
- p_nextList = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_nextList = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_nextList );
cl_list_init( p_nextList, 10 );
p_currList = p_nextList;
@@ -691,7 +696,7 @@ updn_subn_rank(
while (!cl_is_list_empty(p_currList))
{
rank++;
- p_nextList = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_nextList = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_nextList );
cl_list_init( p_nextList, 10 );
p_physp = (osm_physp_t*)cl_list_remove_head( p_currList );
@@ -749,7 +754,7 @@ updn_subn_rank(
}
/* First free the allocation of cl_list pointer then reallocate */
cl_list_destroy( p_currList );
- cl_free(p_currList);
+ free(p_currList);
/* p_currList is empty - need to assign it to p_nextList */
p_currList = p_nextList;
}
@@ -759,7 +764,7 @@ updn_subn_rank(
"BFS the subnet ]\n");
cl_list_destroy( p_currList );
- cl_free(p_currList);
+ free(p_currList);
/* Print Summary of ranking */
osm_log(&(osm.log), OSM_LOG_VERBOSE,
@@ -901,7 +906,7 @@ osm_subn_calc_up_down_min_hop_table(
"guid = 0x%" PRIx64 " rank = %u\n",
cl_ntoh64(cl_qmap_key(p_map_item)), ((updn_rank_t *)p_map_item)->rank);
cl_qmap_remove_item( &p_updn->guid_rank_tbl, p_map_item);
- cl_free( (updn_rank_t *)p_map_item);
+ free( (updn_rank_t *)p_map_item);
p_map_item = cl_qmap_head( &p_updn->guid_rank_tbl);
}
@@ -954,15 +959,18 @@ void __osm_updn_convert_list2array(IN up
p_updn->updn_ucast_reg_inputs.num_guids = cl_list_count(
p_updn->p_root_nodes);
if (p_updn->updn_ucast_reg_inputs.guid_list)
- cl_free(p_updn->updn_ucast_reg_inputs.guid_list);
- p_updn->updn_ucast_reg_inputs.guid_list = (uint64_t *)cl_zalloc(
+ free(p_updn->updn_ucast_reg_inputs.guid_list);
+ p_updn->updn_ucast_reg_inputs.guid_list = (uint64_t *)malloc(
p_updn->updn_ucast_reg_inputs.num_guids*sizeof(uint64_t));
+ if (p_updn->updn_ucast_reg_inputs.guid_list)
+ memset(p_updn->updn_ucast_reg_inputs.guid_list, 0,
+ p_updn->updn_ucast_reg_inputs.num_guids*sizeof(uint64_t));
if (!cl_is_list_empty(p_updn->p_root_nodes))
{
while( (p_guid = (uint64_t*)cl_list_remove_head(p_updn->p_root_nodes)) )
{
p_updn->updn_ucast_reg_inputs.guid_list[i] = *p_guid;
- cl_free(p_guid);
+ free(p_guid);
i++;
}
max_num = i;
@@ -1033,7 +1041,7 @@ osm_updn_find_root_nodes_by_min_hop( OUT
cl_map_init( &ca_by_lid_map, 10 );
/* EZ:
- p_ca_list = (cl_list_t*)cl_malloc(sizeof(cl_list_t));
+ p_ca_list = (cl_list_t*)malloc(sizeof(cl_list_t));
cl_list_construct( p_ca_list );
cl_list_init( p_ca_list, 10 );
*/
@@ -1052,7 +1060,7 @@ osm_updn_find_root_nodes_by_min_hop( OUT
self_lid_ho = cl_ntoh16( osm_physp_get_base_lid(p_physp) );
numCas++;
/* EZ:
- self = cl_malloc(sizeof(uint16_t));
+ self = malloc(sizeof(uint16_t));
*self = self_lid_ho;
cl_list_insert_tail(p_ca_list, self);
*/
@@ -1120,7 +1128,7 @@ osm_updn_find_root_nodes_by_min_hop( OUT
if ( p_updn_hist == (updn_hist_t*)cl_qmap_end( &min_hop_hist))
{
/* New entry in the histogram , first create it */
- p_updn_hist = (updn_hist_t*) cl_malloc(sizeof(updn_hist_t));
+ p_updn_hist = (updn_hist_t*) malloc(sizeof(updn_hist_t));
CL_ASSERT (p_updn_hist);
p_updn_hist->bar_value = 1;
cl_qmap_insert(&min_hop_hist, (uint64_t)hop_val, &p_updn_hist->map_item);
@@ -1176,14 +1184,14 @@ osm_updn_find_root_nodes_by_min_hop( OUT
while ( p_updn_hist != (updn_hist_t*)cl_qmap_end( &min_hop_hist ) )
{
cl_qmap_remove_item( &min_hop_hist, (cl_map_item_t*)p_updn_hist );
- cl_free( p_updn_hist );
+ free( p_updn_hist );
p_updn_hist = (updn_hist_t*) cl_qmap_head( &min_hop_hist );
}
/* If thd conditions are valid insert the root node to the list */
if ( (numHopBarsOverThd1 == 1) && (numHopBarsOverThd2 == 1) )
{
- p_guid = cl_malloc(sizeof(uint64_t));
+ p_guid = malloc(sizeof(uint64_t));
*p_guid = cl_ntoh64(osm_node_get_node_guid(p_sw->p_node));
osm_log (&(osm.log), OSM_LOG_DEBUG,
"osm_updn_find_root_nodes_by_min_hop: "
Index: osm/opensm/osm_mcast_tbl.c
===================================================================
--- osm/opensm/osm_mcast_tbl.c (revision 7470)
+++ osm/opensm/osm_mcast_tbl.c (working copy)
@@ -51,8 +51,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_math.h>
#include <iba/ib_types.h>
#include <opensm/osm_mcast_tbl.h>
@@ -102,12 +102,14 @@ osm_mcast_tbl_init(
since it is (and must be) defined that way the table structure
in order to create a pointer to a two dimensional array.
*/
- p_tbl->p_mask_tbl = cl_zalloc( p_tbl->num_entries *
- (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8 );
+ p_tbl->p_mask_tbl = malloc( p_tbl->num_entries *
+ (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8 );
if( p_tbl->p_mask_tbl == NULL )
return( IB_INSUFFICIENT_MEMORY );
+ memset(p_tbl->p_mask_tbl, 0,
+ p_tbl->num_entries * (IB_MCAST_POSITION_MAX + 1) * IB_MCAST_MASK_SIZE / 8 );
return( IB_SUCCESS );
}
@@ -117,7 +119,7 @@ void
osm_mcast_tbl_destroy(
IN osm_mcast_tbl_t* const p_tbl )
{
- cl_free( p_tbl->p_mask_tbl );
+ free( p_tbl->p_mask_tbl );
}
/**********************************************************************
Index: osm/opensm/osm_pkey.c
===================================================================
--- osm/opensm/osm_pkey.c (revision 7470)
+++ osm/opensm/osm_pkey.c (working copy)
@@ -52,7 +52,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <complib/cl_debug.h>
#include <iba/ib_types.h>
#include <opensm/osm_pkey.h>
@@ -81,12 +80,12 @@ void osm_pkey_tbl_destroy(
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 ));
+ free(cl_ptr_vector_get( &p_pkey_tbl->blocks, i ));
cl_ptr_vector_destroy( &p_pkey_tbl->blocks );
num_blocks = (uint16_t)(cl_ptr_vector_get_size( &p_pkey_tbl->new_blocks ));
for (i = 0; i < num_blocks; i++)
- cl_free(cl_ptr_vector_get( &p_pkey_tbl->new_blocks, i ));
+ free(cl_ptr_vector_get( &p_pkey_tbl->new_blocks, i ));
cl_ptr_vector_destroy( &p_pkey_tbl->new_blocks );
cl_map_remove_all( &p_pkey_tbl->keys );
@@ -120,9 +119,10 @@ void osm_pkey_tbl_sync_new_blocks(
if ( b < new_blocks )
p_new_block = cl_ptr_vector_get(&p_pkey_tbl->new_blocks, b);
else {
- p_new_block = (ib_pkey_table_t *)cl_zalloc(sizeof(*p_new_block));
+ p_new_block = (ib_pkey_table_t *)malloc(sizeof(*p_new_block));
if (!p_new_block)
break;
+ memset(p_new_block, 0, sizeof(*p_new_block));
cl_ptr_vector_set(&((osm_pkey_tbl_t *)p_pkey_tbl)->new_blocks, b, p_new_block);
}
memcpy(p_new_block, p_block, sizeof(*p_new_block));
@@ -150,7 +150,9 @@ int osm_pkey_tbl_set(
if ( !p_pkey_block )
{
- p_pkey_block = (ib_pkey_table_t *)cl_zalloc(sizeof(ib_pkey_table_t));
+ p_pkey_block = (ib_pkey_table_t *)malloc(sizeof(ib_pkey_table_t));
+ if (p_pkey_block)
+ memset(p_pkey_block, 0, sizeof(ib_pkey_table_t));
cl_ptr_vector_set( &p_pkey_tbl->blocks, block, p_pkey_block );
}
Index: osm/opensm/osm_mcm_port.c
===================================================================
--- osm/opensm/osm_mcm_port.c (revision 7470)
+++ osm/opensm/osm_mcm_port.c (working copy)
@@ -51,8 +51,8 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
-#include <complib/cl_memory.h>
#include <opensm/osm_mcm_port.h>
/**********************************************************************
@@ -105,7 +105,7 @@ osm_mcm_port_new(
{
osm_mcm_port_t* p_mcm;
- p_mcm = cl_malloc( sizeof(*p_mcm) );
+ p_mcm = malloc( sizeof(*p_mcm) );
if( p_mcm )
{
osm_mcm_port_init( p_mcm, p_port_gid,
@@ -124,5 +124,5 @@ osm_mcm_port_delete(
CL_ASSERT( p_mcm );
osm_mcm_port_destroy( p_mcm );
- cl_free( p_mcm );
+ free( p_mcm );
}
Index: osm/opensm/osm_log.c
===================================================================
--- osm/opensm/osm_log.c (revision 7470)
+++ osm/opensm/osm_log.c (working copy)
@@ -58,7 +58,6 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <complib/cl_memory.h>
#ifndef WIN32
#include <sys/time.h>
@@ -142,15 +141,6 @@ osm_log(
/* SYS messages go to the log anyways */
if (p_log->level & verbosity)
{
-#ifdef _MEM_DEBUG_MODE_
- /* If we are running in MEM_DEBUG_MODE then
- the cl_mem_check will be called on every run */
- if (cl_mem_check() == FALSE)
- {
- fprintf( p_log->out_port, "*** MEMORY ERROR!!! ***\n" );
- CL_ASSERT(0);
- }
-#endif
va_start( args, p_str );
vsprintf( buffer, p_str, args );
Index: osm/opensm/osm_db_pack.c
===================================================================
--- osm/opensm/osm_db_pack.c (revision 7470)
+++ osm/opensm/osm_db_pack.c (working copy)
@@ -40,9 +40,9 @@
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
-#include <complib/cl_memory.h>
#include <complib/cl_debug.h>
#include <opensm/osm_db_pack.h>
+
static inline void
__osm_pack_guid(uint64_t guid, char *p_guid_str)
{
@@ -110,7 +110,7 @@ osm_db_guid2lid_guids(
while ( (p_key = cl_list_remove_head( &keys )) != NULL )
{
- p_guid_elem = (osm_db_guid_elem_t*)cl_malloc(sizeof(osm_db_guid_elem_t));
+ p_guid_elem = (osm_db_guid_elem_t*)malloc(sizeof(osm_db_guid_elem_t));
CL_ASSERT( p_guid_elem != NULL );
p_guid_elem->guid = __osm_unpack_guid(p_key);
Index: osm/opensm/main.c
===================================================================
--- osm/opensm/main.c (revision 7470)
+++ osm/opensm/main.c (working copy)
@@ -59,7 +59,6 @@
#include <opensm/osm_opensm.h>
#include <complib/cl_types.h>
#include <complib/cl_debug.h>
-#include <complib/cl_memory.h>
#include <vendor/osm_vendor_api.h>
#include <opensm/osm_ucast_updn.h>
#include <opensm/osm_console.h>
@@ -292,7 +291,6 @@ show_usage(void)
" -d1 - Force single threaded dispatching\n"
" -d2 - Force log flushing after each log message\n"
" -d3 - Disable multicast support\n"
- " -d4 - Put OpenSM in memory tracking mode\n"
" -d10 - Put OpenSM in testability mode\n"
" Without -d, no debug options are enabled\n\n" );
printf( "-h\n"
@@ -518,7 +516,6 @@ main(
uint32_t log_flags = OSM_LOG_DEFAULT_LEVEL;
uint32_t temp, dbg_lvl;
boolean_t run_once_flag = FALSE;
- boolean_t mem_track = FALSE;
int32_t vendor_debug = 0;
uint32_t next_option;
#if 0
@@ -692,10 +689,10 @@ main(
printf(" Debug mode: Disable multicast support\n");
opt.disable_multicast = TRUE;
}
- else if(dbg_lvl == 4)
- {
- mem_track = TRUE;
- }
+ /*
+ * NOTE: Debug level 4 used to be used for memory tracking
+ * but this is now deprecated
+ */
else if(dbg_lvl == 5)
{
vendor_debug++;
@@ -825,9 +822,6 @@ main(
/* Done with options description */
printf("-------------------------------------------------\n");
- if (mem_track)
- __cl_mem_track(TRUE);
-
opt.log_flags = log_flags;
if (vendor_debug)
@@ -952,8 +946,6 @@ main(
Exit:
osm_opensm_destroy( &osm );
- if (mem_track) cl_mem_display();
-
complib_exit();
exit( 0 );
Index: osm/opensm/osm_sa_mcmember_record.c
===================================================================
--- osm/opensm/osm_sa_mcmember_record.c (revision 7470)
+++ osm/opensm/osm_sa_mcmember_record.c (working copy)
@@ -55,9 +55,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qmap.h>
#include <complib/cl_passivelock.h>
#include <complib/cl_debug.h>
@@ -325,7 +325,9 @@ __get_new_mlid(
/* track all used mlids in the array (by mlid index) */
used_mlids_array =
- (uint8_t *)cl_zalloc(sizeof(uint8_t)*max_num_mlids);
+ (uint8_t *)malloc(sizeof(uint8_t)*max_num_mlids);
+ if (used_mlids_array)
+ memset(used_mlids_array, 0, sizeof(uint8_t)*max_num_mlids);
if (!used_mlids_array)
return 0;
@@ -383,7 +385,7 @@ __get_new_mlid(
mlid = 0;
}
- cl_free(used_mlids_array);
+ free(used_mlids_array);
Exit:
OSM_LOG_EXIT(p_rcv->p_log);
Index: osm/opensm/osm_drop_mgr.c
===================================================================
--- osm/opensm/osm_drop_mgr.c (revision 7470)
+++ osm/opensm/osm_drop_mgr.c (working copy)
@@ -53,7 +53,6 @@
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qmap.h>
#include <complib/cl_passivelock.h>
#include <complib/cl_debug.h>
@@ -196,7 +195,7 @@ __osm_drop_mgr_remove_port(
"__osm_drop_mgr_remove_port: "
"Cleaned sm for port guid\n" );
- cl_free(p_sm);
+ free(p_sm);
}
osm_port_get_lid_range_ho( p_port, &min_lid_ho, &max_lid_ho );
Index: osm/opensm/osm_lid_mgr.c
===================================================================
--- osm/opensm/osm_lid_mgr.c (revision 7470)
+++ osm/opensm/osm_lid_mgr.c (working copy)
@@ -90,9 +90,9 @@
# include <config.h>
#endif /* HAVE_CONFIG_H */
+#include <stdlib.h>
#include <string.h>
#include <iba/ib_types.h>
-#include <complib/cl_memory.h>
#include <complib/cl_qmap.h>
#include <complib/cl_debug.h>
#include <opensm/osm_lid_mgr.h>
@@ -137,7 +137,7 @@ osm_lid_mgr_destroy(
p_item = cl_qlist_remove_head( &p_mgr->free_ranges );
while ( p_item != cl_qlist_end( &p_mgr->free_ranges ) )
{
- cl_free((osm_lid_mgr_range_t *)p_item);
+ free((osm_lid_mgr_range_t *)p_item);
p_item = cl_qlist_remove_head( &p_mgr->free_ranges );
}
OSM_LOG_EXIT( p_mgr->p_log );
@@ -399,7 +399,7 @@ __osm_lid_mgr_init_sweep(
p_item = cl_qlist_remove_head( &p_mgr->free_ranges );
while ( p_item != cl_qlist_end( &p_mgr->free_ranges ) )
{
- cl_free( (osm_lid_mgr_range_t *)p_item );
+ free( (osm_lid_mgr_range_t *)p_item );
p_item = cl_qlist_remove_head( &p_mgr->free_ranges );
}
@@ -417,7 +417,7 @@ __osm_lid_mgr_init_sweep(
"__osm_lid_mgr_init_sweep: "
"Skipping all lids as we are reassigning them\n");
p_range =
- (osm_lid_mgr_range_t *)cl_malloc(sizeof(osm_lid_mgr_range_t));
+ (osm_lid_mgr_range_t *)malloc(sizeof(osm_lid_mgr_range_t));
p_range->min_lid = 1;
goto AfterScanningLids;
}
@@ -596,7 +596,7 @@ __osm_lid_mgr_init_sweep(
else
{
p_range =
- (osm_lid_mgr_range_t *)cl_malloc(sizeof(osm_lid_mgr_range_t));
+ (osm_lid_mgr_range_t *)malloc(sizeof(osm_lid_mgr_range_t));
p_range->min_lid = lid;
p_range->max_lid = lid;
}
@@ -622,7 +622,7 @@ __osm_lid_mgr_init_sweep(
if (!p_range)
{
p_range =
- (osm_lid_mgr_range_t *)cl_malloc(sizeof(osm_lid_mgr_range_t));
+ (osm_lid_mgr_range_t *)malloc(sizeof(osm_lid_mgr_range_t));
/*
The p_range can be NULL in one of 2 cases:
1. If max_defined_lid == 0. In this case, we want the entire range.
More information about the general
mailing list