[ofw] patch: Add g_ to global variables and remove g from local(p_port_mgr).

Tzachi Dar tzachid at mellanox.co.il
Tue Oct 28 02:20:13 PDT 2008


Applied to trunk and branch on 1698 and 1699
 
Thanks
Tzachi


________________________________

	From: ofw-bounces at lists.openfabrics.org
[mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Tzachi Dar
	Sent: Monday, October 27, 2008 4:57 PM
	To: ofw at lists.openfabrics.org
	Subject: [ofw] patch: Add g_ to global variables and remove g
from local(p_port_mgr).
	
	
	Renaming of variables only checkin.
	 
	Index: Q:/projinf3/trunk/core/bus/kernel/bus_port_mgr.c
	
===================================================================
	--- Q:/projinf3/trunk/core/bus/kernel/bus_port_mgr.c (revision
3371)
	+++ Q:/projinf3/trunk/core/bus/kernel/bus_port_mgr.c (revision
3372)
	@@ -288,43 +288,43 @@
	 {
	  ib_api_status_t  status;
	  cl_status_t   cl_status;
	- port_mgr_t   *gp_port_mgr;
	+ port_mgr_t   *p_port_mgr;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	  CL_ASSERT( p_bfi->p_port_mgr == NULL );
	 
	- gp_port_mgr = cl_zalloc( sizeof( port_mgr_t ) );
	- if( !gp_port_mgr )
	+ p_port_mgr = cl_zalloc( sizeof( port_mgr_t ) );
	+ if( !p_port_mgr )
	  {
	   BUS_TRACE_EXIT( BUS_DBG_ERROR,
	    ("Failed to allocate port manager.\n") );
	   return IB_INSUFFICIENT_MEMORY;
	  }
	- p_bfi->p_port_mgr = gp_port_mgr;
	+ p_bfi->p_port_mgr = p_port_mgr;
	 
	  /* Construct the load service. */
	- cl_obj_construct( &gp_port_mgr->obj, AL_OBJ_TYPE_LOADER );
	- p_bfi->p_port_mgr_obj = &gp_port_mgr->obj;
	- cl_mutex_construct( &gp_port_mgr->pdo_mutex );
	- cl_qlist_init( &gp_port_mgr->port_list );
	+ cl_obj_construct( &p_port_mgr->obj, AL_OBJ_TYPE_LOADER );
	+ p_bfi->p_port_mgr_obj = &p_port_mgr->obj;
	+ cl_mutex_construct( &p_port_mgr->pdo_mutex );
	+ cl_qlist_init( &p_port_mgr->port_list );
	 
	- cl_status = cl_mutex_init( &gp_port_mgr->pdo_mutex );
	+ cl_status = cl_mutex_init( &p_port_mgr->pdo_mutex );
	  if( cl_status != CL_SUCCESS )
	  {
	-  free_port_mgr( &gp_port_mgr->obj );
	+  free_port_mgr( &p_port_mgr->obj );
	   BUS_TRACE_EXIT( BUS_DBG_ERROR,
	    ("cl_mutex_init returned %#x.\n", cl_status) );
	   return ib_convert_cl_status( cl_status );
	  }
	 
	  /* Initialize the load service object. */
	- cl_status = cl_obj_init( &gp_port_mgr->obj, CL_DESTROY_SYNC,
	+ cl_status = cl_obj_init( &p_port_mgr->obj, CL_DESTROY_SYNC,
	         destroying_port_mgr, NULL, free_port_mgr );
	 
	  if( cl_status != CL_SUCCESS )
	  {
	-  free_port_mgr( &gp_port_mgr->obj );
	+  free_port_mgr( &p_port_mgr->obj );
	   BUS_TRACE_EXIT( BUS_DBG_ERROR,
	    ("cl_obj_init returned %#x.\n", cl_status) );
	   return ib_convert_cl_status( cl_status );
	@@ -336,11 +336,11 @@
	  {
	   BUS_TRACE_EXIT( BUS_DBG_ERROR,
	    ("bus_reg_port_pnp returned %s.\n", ib_get_err_str(status))
);
	-  free_port_mgr( &gp_port_mgr->obj );
	+  free_port_mgr( &p_port_mgr->obj );
	   return status;
	  }
	 
	- *pp_port_mgr = gp_port_mgr;
	+ *pp_port_mgr = p_port_mgr;
	 
	  BUS_EXIT( BUS_DBG_PNP );
	  return IB_SUCCESS;
	@@ -356,7 +356,7 @@
	 {
	  ib_api_status_t   status;
	  bus_filter_t   *p_bfi;
	- port_mgr_t    *gp_port_mgr;
	+ port_mgr_t    *p_port_mgr;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	@@ -366,13 +366,13 @@
	   BUS_PRINT(BUS_DBG_PNP, ("Failed to find p_bfi by obj %p?\n",
p_obj));
	   return;
	  }
	- gp_port_mgr = p_bfi->p_port_mgr;
	+ p_port_mgr = p_bfi->p_port_mgr;
	 
	  BUS_PRINT(BUS_DBG_PNP, ("%s obj %p port_mgr %p port_mgr_obj
%p\n",
	-   p_bfi->whoami,p_obj,gp_port_mgr, p_bfi->p_port_mgr_obj) );
	+   p_bfi->whoami,p_obj,p_port_mgr, p_bfi->p_port_mgr_obj) );
	 
	  CL_ASSERT( (void*)p_bfi->p_port_mgr ==
(void*)p_bfi->p_port_mgr_obj );
	- CL_ASSERT( gp_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t,
obj ) );
	+ CL_ASSERT( p_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj
) );
	 
	  /* Deregister for port PnP events if this is the last Port
manager. */
	  if ( get_bfi_count() == 1 && bus_globals.h_pnp_port ) {
	@@ -396,7 +396,7 @@
	  bus_pdo_ext_t *p_ext;
	  cl_list_item_t *p_list_item;
	  bus_filter_t *p_bfi;
	- port_mgr_t  *gp_port_mgr;
	+ port_mgr_t  *p_port_mgr;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	@@ -406,15 +406,15 @@
	   BUS_PRINT(BUS_DBG_PNP, ("No p_bfi for port obj %p?\n",
p_obj));
	   return;
	  }
	- gp_port_mgr = p_bfi->p_port_mgr;
	- if ( !gp_port_mgr ) {
	+ p_port_mgr = p_bfi->p_port_mgr;
	+ if ( !p_port_mgr ) {
	   // if create fails & then free is called, p_bfi->p_port_mgr
== NULL
	   return;
	  }
	- CL_ASSERT( gp_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t,
obj ) );
	+ CL_ASSERT( p_port_mgr == PARENT_STRUCT( p_obj, port_mgr_t, obj
) );
	 
	  BUS_PRINT(BUS_DBG_PNP, ("%s obj %p port_mgr %p port_mgr_obj
%p\n",
	-   p_bfi->whoami, p_obj,gp_port_mgr,
	+   p_bfi->whoami, p_obj,p_port_mgr,
	    p_bfi->p_port_mgr_obj) );
	 
	  BUS_PRINT( BUS_DBG_PNP,
	@@ -423,11 +423,11 @@
	   * Mark all IPoIB PDOs as no longer present.  This will cause
them
	   * to be removed when they process the IRP_MN_REMOVE_DEVICE.
	   */
	- p_list_item = cl_qlist_remove_head( &gp_port_mgr->port_list );
	- while( p_list_item != cl_qlist_end( &gp_port_mgr->port_list )
)
	+ p_list_item = cl_qlist_remove_head( &p_port_mgr->port_list );
	+ while( p_list_item != cl_qlist_end( &p_port_mgr->port_list ) )
	  {
	   p_ext = PARENT_STRUCT( p_list_item, bus_pdo_ext_t, list_item
);
	-  p_list_item = cl_qlist_remove_head( &gp_port_mgr->port_list
);
	+  p_list_item = cl_qlist_remove_head( &p_port_mgr->port_list );
	   if( p_ext->cl_ext.pnp_state == SurpriseRemoved )
	   {
	    CL_ASSERT( !p_ext->b_present );
	@@ -456,9 +456,9 @@
	   IoDeleteDevice( p_ext->cl_ext.p_self_do );
	  }
	 
	- cl_mutex_destroy( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_destroy( &p_port_mgr->pdo_mutex );
	  cl_obj_deinit( p_obj );
	- cl_free( gp_port_mgr );
	+ cl_free( p_port_mgr );
	 
	  p_bfi->p_port_mgr = NULL;
	  p_bfi->p_port_mgr_obj = NULL;
	@@ -483,12 +483,12 @@
	   */
	  if ( !bus_globals.h_pnp_port )
	  {
	-  ExAcquireFastMutexUnsafe(&ControlMutex);
	+  ExAcquireFastMutexUnsafe(&g_ControlMutex);
	   if ( !bus_globals.h_pnp_port ) {
	    bus_globals.h_pnp_port = (ib_pnp_handle_t)1; /* block others
*/
	    need_pnp_reg = TRUE;
	   }
	-  ExReleaseFastMutexUnsafe(&ControlMutex);
	+  ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	   if ( need_pnp_reg )
	   {
	@@ -555,7 +555,7 @@
	 {
	  NTSTATUS   status;
	  bus_filter_t  *p_bfi;
	- port_mgr_t   *gp_port_mgr;
	+ port_mgr_t   *p_port_mgr;
	  DEVICE_RELATIONS *p_rel;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	@@ -565,15 +565,15 @@
	  /* special case guid == 0 - walk all bus filter instances */
	  if ( ca_guid == 0ULL ) {
	   BUS_PRINT(BUS_DBG_PNP, ("CA_guid 0\n"));
	-  for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++) {
	-   gp_port_mgr = p_bfi->p_port_mgr;
	-   if ( !gp_port_mgr )
	+  for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
	+   p_port_mgr = p_bfi->p_port_mgr;
	+   if ( !p_port_mgr )
	     continue;
	-   cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	-   status = bus_get_relations( &gp_port_mgr->port_list,
	+   cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	+   status = bus_get_relations( &p_port_mgr->port_list,
	           p_bfi->ca_guid,
	           p_irp );
	-   cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+   cl_mutex_release( &p_port_mgr->pdo_mutex );
	   }
	 
	   p_rel = (DEVICE_RELATIONS*)p_irp->IoStatus.Information;
	@@ -591,16 +591,16 @@
	   BUS_EXIT( BUS_DBG_PNP );
	   return STATUS_NO_SUCH_DEVICE;
	  }
	- gp_port_mgr = p_bfi->p_port_mgr;
	+ p_port_mgr = p_bfi->p_port_mgr;
	 
	  BUS_PRINT(BUS_DBG_PNP, ("%s for ca_guid %I64x port_mgr %p\n",
	-       p_bfi->whoami, ca_guid, gp_port_mgr) );
	- if (!gp_port_mgr)
	+       p_bfi->whoami, ca_guid, p_port_mgr) );
	+ if (!p_port_mgr)
	   return STATUS_NO_SUCH_DEVICE;
	 
	- cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	- status = bus_get_relations( &gp_port_mgr->port_list, ca_guid,
p_irp );
	- cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	+ status = bus_get_relations( &p_port_mgr->port_list, ca_guid,
p_irp );
	+ cl_mutex_release( &p_port_mgr->pdo_mutex );
	 
	  BUS_EXIT( BUS_DBG_PNP );
	  return STATUS_SUCCESS;
	@@ -616,13 +616,13 @@
	  bus_port_ext_t *p_port_ext;
	  bus_pdo_ext_t *p_pdo_ext = NULL;
	  size_t   n_devs = 0;
	- port_mgr_t  *gp_port_mgr = p_bfi->p_port_mgr;
	- cl_qlist_t  *p_pdo_list = &gp_port_mgr->port_list;
	+ port_mgr_t  *p_port_mgr = p_bfi->p_port_mgr;
	+ cl_qlist_t  *p_pdo_list = &p_port_mgr->port_list;
	  port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	- if ( !gp_port_mgr ) {
	+ if ( !p_port_mgr ) {
	   // if free_port_mgr has been called , p_bfi->p_port_mgr ==
NULL 
	   // this will cause crash on cl_mutex_acquire
	   // (leo) i'm not sure when it happens, but i saw it happened
	@@ -630,7 +630,7 @@
	   goto end;
	  }
	 
	- cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	  
	  /* Count the number of child devices. */
	  for( p_list_item = cl_qlist_head( p_pdo_list );
	@@ -692,7 +692,7 @@
	   status = IB_NOT_FOUND;
	  }
	 
	- cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_release( &p_port_mgr->pdo_mutex );
	 
	 end:
	  BUS_EXIT( BUS_DBG_PNP );
	@@ -776,7 +776,7 @@
	  pkey_conf_t  *cur_conf; 
	  pkey_array_t *cur_pkeys = NULL;
	  bus_filter_t *p_bfi;
	- port_mgr_t  *gp_port_mgr;
	+ port_mgr_t  *p_port_mgr;
	  port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	@@ -812,7 +812,7 @@
	      p_bfi->whoami, p_bfi->ca_guid, 
	      p_pnp_rec->p_port_attr->port_num,p_ctx));
	  }
	- gp_port_mgr = p_bfi->p_port_mgr;
	+ p_port_mgr = p_bfi->p_port_mgr;
	 
	  if( !bus_globals.b_report_port_nic )
	  {
	@@ -914,10 +914,10 @@
	    p_port_ext->port_guid.pkey = cur_pkeys->pkey_array[num_pdo
-1];
	 
	   /* Store the device extension in the port vector for future
queries. */
	-  cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	-  cl_qlist_insert_tail( &gp_port_mgr->port_list,
	+  cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	+  cl_qlist_insert_tail( &p_port_mgr->port_list,
	          &p_port_ext->pdo.list_item );
	-  cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+  cl_mutex_release( &p_port_mgr->pdo_mutex );
	 
	   /*
	    * Set the context of the PNP event. The context is passed in
for future
	@@ -947,19 +947,19 @@
	 * return: cl_status
	
************************************************************************
*************/
	 cl_status_t _port_mgr_pkey_rem( IN pkey_array_t *pkeys,
	-        IN port_mgr_t  *gp_port_mgr )
	+        IN port_mgr_t  *p_port_mgr )
	 {
	 
	  uint16_t    cnt;
	  cl_list_item_t  *p_list_item;
	  bus_port_ext_t  *p_port_ext;
	  bus_pdo_ext_t  *p_pdo_ext = NULL;
	- cl_qlist_t*   p_pdo_list = &gp_port_mgr->port_list;
	+ cl_qlist_t*   p_pdo_list = &p_port_mgr->port_list;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	  p_port_ext = NULL;
	- cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	  
	  /* Count the number of child devices. */
	  for( p_list_item = cl_qlist_head( p_pdo_list );
	@@ -982,7 +982,7 @@
	    }
	   }
	  }
	- cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_release( &p_port_mgr->pdo_mutex );
	 
	  /* Tell the PnP Manager to rescan for the HCA's bus relations.
*/
	  IoInvalidateDeviceRelations(
	@@ -1000,15 +1000,15 @@
	  boolean_t  GO;
	  int    success_cnt=0;
	 
	- for(p_bfi=&bus_filters[0]; p_bfi <
&bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	+ for(p_bfi=&g_bus_filters[0]; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	  {
	   if ( !p_bfi->p_bus_ext )
	    continue;
	   GO = FALSE;
	-  ExAcquireFastMutexUnsafe(&ControlMutex);
	+  ExAcquireFastMutexUnsafe(&g_ControlMutex);
	   if ( p_bfi->ca_guid && p_bfi->p_port_mgr )
	    GO = TRUE;
	-  ExReleaseFastMutexUnsafe(&ControlMutex);
	+  ExReleaseFastMutexUnsafe(&g_ControlMutex);
	   if ( GO == FALSE )
	    continue;
	   status = _port_mgr_pkey_rem( pkeys, p_bfi->p_port_mgr );
	@@ -1028,20 +1028,20 @@
	
************************************************************************
*************/
	 cl_status_t _port_mgr_pkey_add( IN pkey_array_t *req_pkeys,
	         IN bus_filter_t *p_bfi,
	-        IN port_mgr_t  *gp_port_mgr )
	+        IN port_mgr_t  *p_port_mgr )
	 {
	  uint16_t    cnt;
	  NTSTATUS            status;
	  cl_list_item_t  *p_list_item;
	  bus_port_ext_t  *p_port_ext, *pkey_port_ext,
*pmatched_guid_ext;
	  DEVICE_OBJECT       *p_pdo[MAX_NUM_PKEY];
	- cl_qlist_t*   p_pdo_list = &gp_port_mgr->port_list;
	+ cl_qlist_t*   p_pdo_list = &p_port_mgr->port_list;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	  pmatched_guid_ext = NULL;
	  p_port_ext = NULL;
	- cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	  
	  /* Count the number of child devices. */
	  for( p_list_item = cl_qlist_head( p_pdo_list );
	@@ -1067,7 +1067,7 @@
	     pmatched_guid_ext = p_port_ext;
	   }
	  }
	- cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_release( &p_port_mgr->pdo_mutex );
	 
	  if (!pmatched_guid_ext)
	  {
	@@ -1119,10 +1119,10 @@
	   pkey_port_ext->port_guid.pkey = req_pkeys->pkey_array[cnt];
	   pkey_port_ext->pdo.is_partition_pdo = TRUE;
	   /* Store the device extension in the port vector for future
queries. */
	-  cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	-  cl_qlist_insert_tail( &gp_port_mgr->port_list,
	+  cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	+  cl_qlist_insert_tail( &p_port_mgr->port_list,
	    &pkey_port_ext->pdo.list_item );
	-  cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+  cl_mutex_release( &p_port_mgr->pdo_mutex );
	  }
	 
	  /* Tell the PnP Manager to rescan for the HCA's bus relations.
*/
	@@ -1144,15 +1144,15 @@
	  boolean_t  GO;
	  int    success_cnt=0;
	 
	- for(p_bfi=&bus_filters[0]; p_bfi <
&bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	+ for(p_bfi=&g_bus_filters[0]; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	  {
	   if ( !p_bfi->p_bus_ext )
	    continue;
	   GO = FALSE;
	-  ExAcquireFastMutexUnsafe(&ControlMutex);
	+  ExAcquireFastMutexUnsafe(&g_ControlMutex);
	   if ( p_bfi->ca_guid && p_bfi->p_port_mgr )
	    GO = TRUE;
	-  ExReleaseFastMutexUnsafe(&ControlMutex);
	+  ExReleaseFastMutexUnsafe(&g_ControlMutex);
	   if ( GO == FALSE )
	    continue;
	   status = _port_mgr_pkey_add( pkeys, p_bfi, p_bfi->p_port_mgr
);
	@@ -1168,7 +1168,7 @@
	  IN    ib_pnp_port_rec_t*  p_pnp_rec )
	 {
	  bus_pdo_ext_t *p_ext;
	- port_mgr_t  *gp_port_mgr;
	+ port_mgr_t  *p_port_mgr;
	  bus_filter_t *p_bfi;
	  port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context;
	 
	@@ -1199,7 +1199,7 @@
	   return;
	  }
	 
	- gp_port_mgr = p_bfi->p_port_mgr;
	+ p_port_mgr = p_bfi->p_port_mgr;
	 
	  /* Within the PNP record's context is the port extension ptr;
	   * see port_was_hibernated().
	@@ -1223,7 +1223,7 @@
	  // Don't crash if p_ext->p_parent_ext is NULL
	  CL_ASSERT((p_ext->p_parent_ext == NULL) || p_bfi ==
p_ext->p_parent_ext->bus_filter);
	  
	- cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	  CL_ASSERT( p_ext->h_ca );
	 
	  if( p_ext->b_hibernating )
	@@ -1258,7 +1258,7 @@
	 
	 hca_deref:
	  deref_al_obj( &p_ext->h_ca->obj );
	- cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_release( &p_port_mgr->pdo_mutex );
	 
	  BUS_EXIT( BUS_DBG_PNP );
	 }
	@@ -1333,19 +1333,19 @@
	 {
	  bus_port_ext_t *p_ext;
	  POWER_STATE  po_state;
	- port_mgr_t  *gp_port_mgr;
	+ port_mgr_t  *p_port_mgr;
	 
	  BUS_ENTER( BUS_DBG_PNP );
	 
	  p_ext = p_dev_obj->DeviceExtension;
	- gp_port_mgr = p_ext->pdo.p_parent_ext->bus_filter->p_port_mgr;
	+ p_port_mgr = p_ext->pdo.p_parent_ext->bus_filter->p_port_mgr;
	 
	  /* Remove this PDO from its list. */
	- cl_mutex_acquire( &gp_port_mgr->pdo_mutex );
	+ cl_mutex_acquire( &p_port_mgr->pdo_mutex );
	  BUS_TRACE( BUS_DBG_PNP, ("Removing port from vector: PDO %p,
ext %p\n",
	     p_dev_obj, p_ext) );
	- cl_qlist_remove_item( &gp_port_mgr->port_list,
&p_ext->pdo.list_item );
	- cl_mutex_release( &gp_port_mgr->pdo_mutex );
	+ cl_qlist_remove_item( &p_port_mgr->port_list,
&p_ext->pdo.list_item );
	+ cl_mutex_release( &p_port_mgr->pdo_mutex );
	  po_state.DeviceState = PowerDeviceD3;
	  PoSetPowerState( p_ext->pdo.cl_ext.p_pdo, DevicePowerState,
po_state );
	 
	Index: Q:/projinf3/trunk/core/bus/kernel/bus_driver.c
	
===================================================================
	--- Q:/projinf3/trunk/core/bus/kernel/bus_driver.c (revision
3371)
	+++ Q:/projinf3/trunk/core/bus/kernel/bus_driver.c (revision
3372)
	@@ -799,10 +799,10 @@
	  // Mutex to synchronize multiple threads creating & deleting 
	  // control deviceobjects. 
	 
	- ExInitializeFastMutex(&ControlMutex);
	- bfi_InstanceCount = 0;
	- memset(  __out_bcount(sizeof(bus_filters)) (void*)bus_filters,
0,
	-   sizeof(bus_filters) );
	+ ExInitializeFastMutex(&g_ControlMutex);
	+ g_bfi_InstanceCount = 0;
	+ memset(  __out_bcount(sizeof(g_bus_filters))
(void*)g_bus_filters, 0,
	+   sizeof(g_bus_filters) );
	 
	  BUS_EXIT( BUS_DBG_DRV );
	  return STATUS_SUCCESS;
	Index: Q:/projinf3/trunk/core/bus/kernel/bus_pnp.c
	
===================================================================
	--- Q:/projinf3/trunk/core/bus/kernel/bus_pnp.c (revision 3371)
	+++ Q:/projinf3/trunk/core/bus/kernel/bus_pnp.c (revision 3372)
	@@ -51,9 +51,9 @@
	 static UNICODE_STRING al_ifc_name;
	 static UNICODE_STRING ci_ifc_name;
	 
	-FAST_MUTEX    ControlMutex;
	-ULONG     bfi_InstanceCount;
	-bus_filter_t   bus_filters[MAX_BUS_FILTERS];
	+FAST_MUTEX    g_ControlMutex;
	+ULONG     g_bfi_InstanceCount;
	+bus_filter_t   g_bus_filters[MAX_BUS_FILTERS];
	 
	 extern ib_al_handle_t gh_al; // NULL if AL needs init.
	 
	@@ -334,7 +334,7 @@
	   return status;
	  }
	 
	- ExAcquireFastMutexUnsafe(&ControlMutex);
	+ ExAcquireFastMutexUnsafe(&g_ControlMutex);
	  if ( !gh_al ) {
	   /* Initialize AL */
	   ib_status = al_initialize();
	@@ -343,12 +343,12 @@
	    al_cleanup();
	    BUS_TRACE_EXIT( BUS_DBG_ERROR, ("al_initialize returned
%s.\n",
	        ib_get_err_str(ib_status)) );
	-   ExReleaseFastMutexUnsafe(&ControlMutex);
	+   ExReleaseFastMutexUnsafe(&g_ControlMutex);
	    return STATUS_UNSUCCESSFUL;
	   }
	   AL_init_here = TRUE;
	  }
	- ExReleaseFastMutexUnsafe(&ControlMutex);
	+ ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	  /* Initialize the port manager. */
	  ib_status = create_port_mgr( p_ext->bus_filter,
&p_ext->p_port_mgr );
	@@ -1252,9 +1252,9 @@
	 
	  CL_ASSERT((obj_type == BFI_PORT_MGR_OBJ) || (obj_type ==
BFI_IOU_MGR_OBJ));
	 
	-    ExAcquireFastMutexUnsafe(&ControlMutex);
	+    ExAcquireFastMutexUnsafe(&g_ControlMutex);
	 
	- for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++) {
	+ for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
	 
	   if ( !p_bfi->p_bus_ext )
	    continue;
	@@ -1272,13 +1272,13 @@
	    }
	   }
	  }
	- ExReleaseFastMutexUnsafe(&ControlMutex);
	+ ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	  BUS_PRINT( BUS_DBG_PNP,
	     ("%s() cl_obj %p type %s_MGR_OBJ --> bfi[%d] %p\n",
	     __FUNCTION__,p_obj,
	     (obj_type == BFI_PORT_MGR_OBJ ? "PORT": "IOU"),
	-    (matched ? (matched - bus_filters) : (-1)), matched ) );
	+    (matched ? (matched - g_bus_filters) : (-1)), matched ) );
	 
	  return matched;
	 }
	@@ -1295,16 +1295,16 @@
	 
	  if ( ca_guid == 0ULL )
	  {
	-  matched = bus_filters;
	+  matched = g_bus_filters;
	   BUS_PRINT( BUS_DBG_PNP, ("%s() ERR guid %I64x -> bfi[0]
%p\n",
	         __FUNCTION__, ca_guid, matched) );
	   CL_ASSERT( ca_guid );
	   return matched;
	  }
	 
	- ExAcquireFastMutexUnsafe(&ControlMutex);
	+ ExAcquireFastMutexUnsafe(&g_ControlMutex);
	 
	- for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++)
	+ for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	  {
	   if ( !p_bfi->p_bus_ext )
	    continue;
	@@ -1315,7 +1315,7 @@
	    break;
	   }
	  }
	- ExReleaseFastMutexUnsafe(&ControlMutex);
	+ ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	 #if DBG
	  if ( !matched )
	@@ -1351,14 +1351,14 @@
	 
	  if ( ca_guid == 0ULL )
	  {
	-  matched = bus_filters;
	+  matched = g_bus_filters;
	   BUS_PRINT( BUS_DBG_PNP, ("%s() ERR guid 0x%I64x -> bfi[0]
%p\n",
	      __FUNCTION__, ca_guid, matched) );
	   CL_ASSERT( ca_guid );
	   return matched;
	  }
	 
	- for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++)
	+ for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	  {
	   if ( !p_bfi->p_bus_ext )
	    continue;
	@@ -1376,9 +1376,9 @@
	   */
	  if ( !matched )
	  {
	-  ExAcquireFastMutexUnsafe(&ControlMutex);
	+  ExAcquireFastMutexUnsafe(&g_ControlMutex);
	 
	-  for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++)
	+  for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	   {
	    if ( !p_bfi->p_bus_ext )
	     continue; // not allocated.
	@@ -1391,13 +1391,13 @@
	     break;
	    }
	   }
	-  ExReleaseFastMutexUnsafe(&ControlMutex);
	+  ExReleaseFastMutexUnsafe(&g_ControlMutex);
	  }
	 
	  BUS_PRINT( BUS_DBG_PNP,
	     ("%s()%sguid 0x%I64x @ bfi[%d] %p \n",
	     __FUNCTION__, (ca_bound ? "SET ":" "), ca_guid,
	-    (matched ? (matched - bus_filters) : (-1)), matched ) );
	+    (matched ? (matched - g_bus_filters) : (-1)), matched ) );
	 
	  return matched;
	 }
	@@ -1413,10 +1413,10 @@
	      * IoCreateDeviceSecure & IoCreateSymbolicLink must be
called at
	      * PASSIVE_LEVEL.
	   */
	- ExAcquireFastMutexUnsafe(&ControlMutex);
	+ ExAcquireFastMutexUnsafe(&g_ControlMutex);
	 
	  // find 1st unused bfi slot.
	- for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++)
	+ for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++)
	  {
	   if ( !p_bfi->p_bus_ext )
	   {
	@@ -1426,17 +1426,17 @@
	     */
	    p_bfi->p_bus_ext = (bus_fdo_ext_t*)p_driver_obj;
	    matched = p_bfi;
	-   *p_instance_count = ++bfi_InstanceCount; // record in-use
	+   *p_instance_count = ++g_bfi_InstanceCount; // record in-use
	    break;
	   }
	  }
	- ExReleaseFastMutexUnsafe(&ControlMutex);
	+ ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	 #if DBG
	  RtlStringCbPrintfA ( p_bfi->whoami,
	        sizeof(p_bfi->whoami),
	        "bfi-%d",
	-       (bfi_InstanceCount - 1) );
	+       (g_bfi_InstanceCount - 1) );
	 
	  p_bfi->magic = BFI_MAGIC;
	 #endif
	@@ -1453,11 +1453,11 @@
	 {
	  int remaining;
	 
	- ExAcquireFastMutexUnsafe(&ControlMutex);
	+ ExAcquireFastMutexUnsafe(&g_ControlMutex);
	  p_bfi->p_bus_ext = NULL;
	  p_bfi->ca_guid = 0ULL;
	- remaining = --bfi_InstanceCount; // one less bfi in-use
	- ExReleaseFastMutexUnsafe(&ControlMutex);
	+ remaining = --g_bfi_InstanceCount; // one less bfi in-use
	+ ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	  return remaining;
	 }
	@@ -1467,9 +1467,9 @@
	 {
	  int ic;
	 
	- ExAcquireFastMutexUnsafe(&ControlMutex);
	- ic = bfi_InstanceCount;
	- ExReleaseFastMutexUnsafe(&ControlMutex);
	+ ExAcquireFastMutexUnsafe(&g_ControlMutex);
	+ ic = g_bfi_InstanceCount;
	+ ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	  return ic;
	 }
	Index: Q:/projinf3/trunk/core/bus/kernel/bus_driver.h
	
===================================================================
	--- Q:/projinf3/trunk/core/bus/kernel/bus_driver.h (revision
3371)
	+++ Q:/projinf3/trunk/core/bus/kernel/bus_driver.h (revision
3372)
	@@ -218,7 +218,7 @@
	 
	 /*
	  * Each instance of a bus filter on an HCA device stack
(InfiniBandController)
	- * populates a bus_filter_t slot in
bus_filters[MAX_BUS_FILTERS]; see
	+ * populates a bus_filter_t slot in
g_bus_filters[MAX_BUS_FILTERS]; see
	  * bus_add_device(). Therefore MAX_BUS_FILTERS represents the
MAX number of
	  * HCA's supported in a single system.
	  */
	@@ -253,9 +253,9 @@
	 
	 } bus_filter_t;
	 
	-extern bus_filter_t bus_filters[MAX_BUS_FILTERS];
	-extern ULONG bfi_InstanceCount;
	-extern FAST_MUTEX ControlMutex; // serializes InstanceCount &
bus_filters
	+extern bus_filter_t g_bus_filters[MAX_BUS_FILTERS];
	+extern ULONG g_bfi_InstanceCount;
	+extern FAST_MUTEX g_ControlMutex; // serializes InstanceCount &
g_bus_filters
	 
	 extern bus_filter_t *alloc_bfi( IN DRIVER_OBJECT *, OUT int *
);
	 extern int free_bfi( IN bus_filter_t *p_bfi );
	Index: Q:/projinf3/trunk/core/bus/kernel/bus_iou_mgr.c
	
===================================================================
	--- Q:/projinf3/trunk/core/bus/kernel/bus_iou_mgr.c (revision
3371)
	+++ Q:/projinf3/trunk/core/bus/kernel/bus_iou_mgr.c (revision
3372)
	@@ -483,13 +483,13 @@
	   */
	  if ( !bus_globals.h_pnp_iou )
	  {
	-  ExAcquireFastMutexUnsafe(&ControlMutex);
	+  ExAcquireFastMutexUnsafe(&g_ControlMutex);
	   if ( !bus_globals.h_pnp_iou )
	   {
	    bus_globals.h_pnp_iou = (ib_pnp_handle_t)1; /* block others
*/ 
	    need_pnp_reg = TRUE;
	   }
	-  ExReleaseFastMutexUnsafe(&ControlMutex);
	+  ExReleaseFastMutexUnsafe(&g_ControlMutex);
	 
	   if ( need_pnp_reg )
	   {
	@@ -564,7 +564,7 @@
	 
	  /* special case guid == 0 - walk all bus filter instances */
	  if ( ca_guid == 0ULL ) {
	-  for(p_bfi=bus_filters; p_bfi < &bus_filters[MAX_BUS_FILTERS];
p_bfi++) {
	+  for(p_bfi=g_bus_filters; p_bfi <
&g_bus_filters[MAX_BUS_FILTERS]; p_bfi++) {
	    gp_iou_mgr = p_bfi->p_iou_mgr;
	    if ( !gp_iou_mgr )
	     continue;
	
	 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081028/2f10118a/attachment.html>


More information about the ofw mailing list