[ofw] RE: patches for depreciated ExAllocatePool() calls

Smith, Stan stan.smith at intel.com
Mon Dec 17 09:27:18 PST 2007


Leonid Keller wrote:
> Looks good.
> Just check the alignment of the following lines (, when you break the
> call in two or more lines).
> There also unnecessary empty lines, e.g.:
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> +
>>> sizeof(WCHAR) * sizeof(p_ext->desc),
>>> +
>>> 'sedq' );

Will check alignment. The mailer did a real hack job on patch lines in
the email body,
Even more so than the diff output.

Nonetheless, I'll verify alignment.
While on the topic, if it looks right in Visual Studio (tabstops=4) what
other alignment points might I check?

Thanks,

Stan.
 
> 
>> -----Original Message-----
>> From: ofw-bounces at lists.openfabrics.org
>> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Tzachi Dar
>> Sent: Monday, December 17, 2007 3:39 PM
>> To: Smith, Stan
>> Cc: ofw at lists.openfabrics.org
>> Subject: [ofw] RE: patches for depreciated ExAllocatePool() calls
>> 
>> Seems fine by me.
>> By the way which compiler are you using?
>> 
>> Thanks
>> Tzachi
>> 
>>> -----Original Message-----
>>> From: Smith, Stan [mailto:stan.smith at intel.com]
>>> Sent: Friday, December 14, 2007 6:55 PM
>>> To: Tzachi Dar
>>> Cc: ofw at lists.openfabrics.org
>>> Subject: patches for depreciated ExAllocatePool() calls
>>> 
>>> Hello,
>>>   Would you kindly take a look at the proposed patches which replace
>>> ExAllocatePool() calls with ExAllocatePoolWithTag() calls.
>>> The Windows Server 2008 compiler complains loudly about the
>>> depreciated call ExAllocatePool(). Tags are loosely based on the
>>> function name. Attempting to reduce compilation noise in order to
>>> clearly see the 'real' issues. 
>>> 
>>> Formatting in the patch file is not expanding tabs correctly,
>>> although when the file is patched and viewed from Vstudio the
>>> formatting is correct. 
>>> 
>>> Patched files have been tested on Win2k3 x86, x64 & ia64.
>>> IPoIB & DAPL tests have run successfully.
>>> 
>>> If you agree these patches are correct, I will push the modified
>>> files to svn. 
>>> 
>>> Thanks,
>>> 
>>> Stan.
>>> 
>>> Signed off by Stan.Smith at intel.com
>>> 
>>> diff U3 core/bus/kernel/bus_iou_mgr.c core/bus/kernel/bus_iou_mgr.c
>>> --- core/bus/kernel/bus_iou_mgr.c	Fri Oct 12 13:10:15 2007
>>> +++ core/bus/kernel/bus_iou_mgr.c	Thu Dec 13 11:49:57 2007 @@
>>>  	-971,7 +971,7 @@ }
>>> 
>>>  	/* Device ID is "IBA\SID_<sid> where <sid> is the IPoIB Service
>>> ID. */ -	p_string = ExAllocatePool( PagedPool, IOU_DEV_ID_SIZE );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, IOU_DEV_ID_SIZE,
>>>  	'didq' ); if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1016,7 +1016,7 @@
>>>  		return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, IOU_HW_ID_SIZE );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, IOU_HW_ID_SIZE,
>>>  	'dihq' ); if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1070,7 +1070,7 @@
>>> 
>>>  	UNUSED_PARAM( p_dev_obj );
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(IOU_COMPAT_ID) );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(IOU_COMPAT_ID), 'dicq' );
>>>  	if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1106,7 +1106,7 @@
>>>  	}
>>> 
>>>  	/* The instance ID is the port GUID. */
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(WCHAR) * 33 );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, sizeof(WCHAR) * 33,
>>>  	'diuq' ); if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1152,8 +1152,9 @@
>>>  	}
>>> 
>>>  	/* The instance ID is the port GUID. */
>>> -	p_string =
>>> -		ExAllocatePool( PagedPool, sizeof(WCHAR) *
>>> sizeof(p_ext->desc) );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> +
>>> sizeof(WCHAR) * sizeof(p_ext->desc),
>>> +
>>> 'sedq' );
>>>  	if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1197,7 +1198,7 @@
>>>  		return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, IOU_LOCATION_SIZE );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, IOU_LOCATION_SIZE,
>>>  	'colq' ); if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1236,7 +1237,7 @@
>>> 
>>>  	*p_action = IrpComplete;
>>> 
>>> -	p_bus_info = ExAllocatePool( PagedPool,
>>> sizeof(PNP_BUS_INFORMATION) );
>>> +	p_bus_info = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(PNP_BUS_INFORMATION), 'subq' );
>>>  	if( !p_bus_info )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> diff U3 core/bus/kernel/bus_port_mgr.c
>>> core/bus/kernel/bus_port_mgr.c ---
>>> core/bus/kernel/bus_port_mgr.c	Fri Oct 12 13:10:15 2007 +++
>>>  	core/bus/kernel/bus_port_mgr.c	Thu Dec 13 11:27:15 2007 @@
-966,7
>>> +966,7 @@ } 
>>> 
>>>  	/* Device ID is "IBA\SID_<sid> where <sid> is the IPoIB Service
>>> ID. */ -	p_string = ExAllocatePool( PagedPool,
>>> sizeof(IPOIB_DEVICE_ID) ); +	p_string =
ExAllocatePoolWithTag(
>>> PagedPool, sizeof(IPOIB_DEVICE_ID), 'vedq' );
>>>  	if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1000,7 +1000,7 @@
>>>  		return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(IPOIB_HARDWARE_ID)
);
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(IPOIB_HARDWARE_ID), 'ihqp' );
>>>  	if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1027,7 +1027,7 @@
>>> 
>>>  	UNUSED_PARAM( p_dev_obj );
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(IPOIB_COMPAT_ID) );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(IPOIB_COMPAT_ID), 'icqp' );
>>>  	if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1063,7 +1063,7 @@
>>>  	}
>>> 
>>>  	/* The instance ID is the port GUID. */
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(WCHAR) * 17 );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, sizeof(WCHAR) * 17,
>>>  	'iuqp' ); if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1108,7 +1108,7 @@
>>> 
>>> 
>>>  	/* The instance ID is the port GUID. */
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(IPOIB_DESCRIPTION)
);
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(IPOIB_DESCRIPTION), 'edqp' );
>>>  	if( !p_string )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1171,7 +1171,7 @@
>>>  		return STATUS_INSUFFICIENT_RESOURCES;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, size );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, size, 'olqp' ); 
>>>  	if( !p_string ) {
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> @@ -1224,7 +1224,7 @@
>>> 
>>>  	*p_action = IrpComplete;
>>> 
>>> -	p_bus_info = ExAllocatePool( PagedPool,
>>> sizeof(PNP_BUS_INFORMATION) );
>>> +	p_bus_info = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(PNP_BUS_INFORMATION), 'ibqp' );
>>>  	if( !p_bus_info )
>>>  	{
>>>  		BUS_TRACE_EXIT( BUS_DBG_ERROR,
>>> diff U3 core/complib/kernel/cl_memory_osd.c
>>> core/complib/kernel/cl_memory_osd.c
>>> --- core/complib/kernel/cl_memory_osd.c	Fri Oct 12 13:10:13 2007
>>> +++ core/complib/kernel/cl_memory_osd.c	Thu Dec 13 11:29:35 2007
@@
>>>  	-41,12 +41,12 @@ if( pageable )
>>>  	{
>>>  		CL_ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );
>>> -		return( ExAllocatePool( PagedPool, size ) );
>>> +		return( ExAllocatePoolWithTag( PagedPool, size, 'virp' )
);
>>>  	}
>>>  	else
>>>  	{
>>>  		CL_ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL );
>>> -		return( ExAllocatePool( NonPagedPool, size ) );
>>> +		return( ExAllocatePoolWithTag( NonPagedPool, size,
'virp' ) );
>>>  	}
>>>  }
>>> 
>>> @@ -56,5 +56,5 @@
>>>  	IN	void* const	p_memory )
>>>  {
>>>  	CL_ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL ); -
ExFreePool(
>>> p_memory ); +	ExFreePoolWithTag( p_memory, 'virp' );
>>>  }
>>> diff U3 core/complib/kernel/cl_pnp_po.c
>>> core/complib/kernel/cl_pnp_po.c
>>> --- core/complib/kernel/cl_pnp_po.c	Fri Oct 12 13:10:13 2007
>>> +++ core/complib/kernel/cl_pnp_po.c	Thu Dec 13 11:30:32 2007 @@
>>>  		-1207,7 +1207,7 @@ alloc_size += (sizeof(PDEVICE_OBJECT)
*
>>> p_old_rel->Count); 
>>> 
>>>  	/* Allocate the new relations structure. */
>>> -	p_rel = ExAllocatePool( PagedPool, alloc_size );
>>> +	p_rel = ExAllocatePoolWithTag( PagedPool, alloc_size, 'ralc' );
>>>  	p_irp->IoStatus.Information = (ULONG_PTR)p_rel;
>>>  	if( !p_rel )
>>>  	{
>>> diff U3 core/iou/kernel/iou_ioc_mgr.c core/iou/kernel/iou_ioc_mgr.c
>>> --- core/iou/kernel/iou_ioc_mgr.c	Fri Oct 12 13:10:29 2007
>>> +++ core/iou/kernel/iou_ioc_mgr.c	Thu Dec 13 11:36:46 2007 @@
>>>  		-823,7 +823,7 @@ return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, IOC_DEV_ID_SIZE );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, IOC_DEV_ID_SIZE,
>>>  	'didq' ); if( !p_string )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR,
>> IOU_DBG_ERROR, @@ -875,7 +875,7
>>> @@
>>>  		return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, IOC_HW_ID_SIZE );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, IOC_HW_ID_SIZE,
>>>  	'ihqi' ); if( !p_string )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR,
>> IOU_DBG_ERROR, @@ -967,7 +967,7
>>> @@
>>>  		return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool, IOC_COMPAT_ID_SIZE );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, IOC_COMPAT_ID_SIZE,
>>>  	'icqi' ); if( !p_string )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR, @@
-1032,7
>>>  	+1032,7 @@ }
>>> 
>>>  	/* The instance ID is the port GUID. */
>>> -	p_string = ExAllocatePool( PagedPool, sizeof(WCHAR) * 33 );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool, sizeof(WCHAR) * 33,
>>>  	'iuqi' ); if( !p_string )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR, @@
-1078,8
>>>  		+1078,9 @@ return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool(
>>> -		PagedPool, sizeof(WCHAR) *
>>> sizeof(p_ext->info.profile.id_string) );
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> +
>>> sizeof(WCHAR) * sizeof(p_ext->info.profile.id_string), +
>>> 'edqi');
>>>  	if( !p_string )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR, @@
-1142,9
>>>  		+1143,9 @@ return STATUS_NO_SUCH_DEVICE;
>>>  	}
>>> 
>>> -	p_string = ExAllocatePool( PagedPool,
>>> -		max( IOC_LOCATION_SIZE,
>>> -		sizeof( WCHAR ) * ( sizeof(
>>> p_ext->info.profile.id_string ) + 1 )));
>>> +	p_string = ExAllocatePoolWithTag( PagedPool,
>>> +		max( IOC_LOCATION_SIZE, sizeof( WCHAR ) * ( sizeof(
>>> p_ext->info.profile.id_string ) + 1 )),
>>> +		'olqi');
>>>  	if( !p_string )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR, @@
-1201,7
>>> +1202,7 @@ 
>>> 
>>>  	*p_action = IrpComplete;
>>> 
>>> -	p_iou_info = ExAllocatePool( PagedPool,
>>> sizeof(PNP_BUS_INFORMATION) );
>>> +	p_iou_info = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(PNP_BUS_INFORMATION), 'ibqi' );
>>>  	if( !p_iou_info )
>>>  	{
>>>  		IOU_PRINT_EXIT( TRACE_LEVEL_ERROR, IOU_DBG_ERROR, diff
U3
>>> hw/mt23108/kernel/hca_driver.c hw/mt23108/kernel/hca_driver.c
>>> --- hw/mt23108/kernel/hca_driver.c	Fri Oct 12 13:11:31 2007
>>> +++ hw/mt23108/kernel/hca_driver.c	Thu Dec 13 11:38:44 2007 @@
>>> -664,7 +664,7 @@ 
>>> 
>>>  	HCA_ENTER( HCA_DBG_PNP );
>>> 
>>> -	p_ifc = ExAllocatePool( PagedPool, sizeof(ci_interface_t) );
>>> +	p_ifc = ExAllocatePoolWithTag( PagedPool,
>>> sizeof(ci_interface_t), 'fiha' );
>>>  	if( !p_ifc )
>>>  	{
>>>  		HCA_TRACE_EXIT( HCA_DBG_ERROR,
>>> diff U3 hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_mem.c
>>> hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_mem.c
>>> --- hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_mem.c
>>> Fri Oct 12
>>> 13:11:10 2007
>>> +++ hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_mem.c
>>> Thu Dec 13
>>> 11:44:59 2007
>>> @@ -912,7 +912,7 @@
>>>  	if (flags)
>>>  		return
>>> (MT_virt_addr_t)ExAllocatePoolWithTag(NonPagedPool,size,flags); 
>>> else -		return
>>> (MT_virt_addr_t)ExAllocatePool(NonPagedPool,size);
>>> +		return
>>> (MT_virt_addr_t)ExAllocatePoolWithTag(NonPagedPool,size,'amOM');  }
>>> 
>>> 
>>> /*************************************************************
>>> **********
>>> *******
>>> diff U3 hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.c
>>> hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.c
>>> --- hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.c Fri Oct 12
>>> 13:11:07 2007 +++ hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.c
>>> Thu Dec 13 10:36:21 2007 @@ -49,7 +49,7 @@
>>>  {
>>>  	g_pDbgData->m_nExAllocCount++;
>>>      MdKdPrint( DBGLVL_HIGH,("MdExAllocatePool() nExAllocCount =
>>> %d\n", g_pDbgData->m_nExAllocCount ));
>>> -	return ExAllocatePool(  PoolType, NumberOfBytes );
>>> +	return ExAllocatePoolWithTag(  PoolType, NumberOfBytes, 'xEdM'
);
>>> 
>>>  }
>>> 
>>> @@ -63,7 +63,7 @@
>>>  {
>>>  	g_pDbgData->m_nExAllocCount--;
>>>      MdKdPrint( DBGLVL_HIGH,("MdExFreePool() nExAllocCount = %d\n",
>>> g_pDbgData->m_nExAllocCount ));
>>> -	ExFreePool(  p );
>>> +	ExFreePoolWithTag(  p, 'xEdM' );
>>>  }
>>> 
>>> 
>>> diff U3 hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.h
>>> hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.h
>>> --- hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.h Fri Oct 12
>>> 13:11:07 2007 +++ hw/mt23108/vapi/mlxsys/os_dep/win/tdriver/MdDbg.h
>>> Thu Dec 13 11:47:33 2007 @@ -225,8 +225,8 @@
>>>  #define MdStringForPnpMnFunc( mnfunc )  #define
>>> MdStringForIrpMjFunc( mjfunc ) 
>>> 
>>> -#define MdExAllocatePool( typ, siz )  ExAllocatePool( typ, siz )
>>> -#define MdExFreePool( p )   ExFreePool( p )
>>> +#define MdExAllocatePool( typ, siz )  ExAllocatePoolWithTag(
>>> typ, siz,
>>> 'xEdM' )
>>> +#define MdExFreePool( p )   ExFreePoolWithTag( p, 'xEdM' )
>>> 
>>> 
>>>  #endif /* DBG */
>>> diff U3 hw/mthca/kernel/hca_pnp.c hw/mthca/kernel/hca_pnp.c
>>> --- hw/mthca/kernel/hca_pnp.c	Fri Oct 12 13:10:55 2007
>>> +++ hw/mthca/kernel/hca_pnp.c	Thu Dec 13 11:40:53 2007 @@
-431,7
>>>  	+431,7 @@ HCA_ENTER( HCA_DBG_PNP );
>>> 
>>>  	pIfc =
>>> -		(ci_interface_t*)ExAllocatePool( PagedPool,
>>> sizeof(ci_interface_t) );
>>> +		(ci_interface_t*)ExAllocatePoolWithTag( PagedPool,
>>> sizeof(ci_interface_t), 'pnpa' );
>>>  	if( !pIfc )
>>>  	{
>>>  		HCA_PRINT( TRACE_LEVEL_ERROR,HCA_DBG_PNP, @@
>>> -564,8 +564,8 @@
>>>  	if (!p_ext->al_sym_name.Buffer) {
>>>  		p_ext->al_sym_name.Length =
>>> pNotify->SymbolicLinkName->Length;
>>>  		p_ext->al_sym_name.MaximumLength =
>>> pNotify->SymbolicLinkName->MaximumLength;
>>> -		p_ext->al_sym_name.Buffer = ExAllocatePool(
>>> NonPagedPool,
>>> -			p_ext->al_sym_name.MaximumLength *
>>> sizeof(wchar_t) );
>>> +		p_ext->al_sym_name.Buffer = ExAllocatePoolWithTag(
>>> NonPagedPool,
>>> +			p_ext->al_sym_name.MaximumLength *
>>> sizeof(wchar_t), 'cfin' );
>>>  		if (!p_ext->al_sym_name.Buffer)
>>>  		{
>>>  			HCA_PRINT( TRACE_LEVEL_ERROR
>>> ,HCA_DBG_PNP ,("allocation of sym IBAL name failed.\n"));
>>> 
>> _______________________________________________
>> ofw mailing list
>> ofw at lists.openfabrics.org
>> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw




More information about the ofw mailing list