FreeBSD/sys/dev/nxge/include/xgehal-mm.h
/*
 * __hal_mempool_item_priv - will return pointer on per item private space
 */
will return pointer on per item private space
will return pointer on per item private space
static inline void*
__hal_mempool_item_priv(xge_hal_mempool_t *mempool, int memblock_idx,
	        void *item, int *memblock_item_idx)
{
	ptrdiff_t offset;
	void *memblock = mempool->memblocks_arr[memblock_idx];
	xge_assert(memblock);
	offset = (int)((char * )item - (char *)memblock);
	xge_assert(offset >= 0 && offset < mempool->memblock_size);
	(*memblock_item_idx) = (int) offset / mempool->item_size;
	xge_assert((*memblock_item_idx) < mempool->items_per_memblock);
	return (char*)mempool->memblocks_priv_arr[memblock_idx] +
	            (*memblock_item_idx) * mempool->items_priv_size;
}
static inline void * __hal_mempool_item_priv ( xge_hal_mempool_t * mempool , int memblock_idx , void * item , int * memblock_item_idx ) { ptrdiff_t offset ; void * memblock = mempool -> memblocks_arr [ memblock_idx ] ; xge_assert ( memblock ) ; offset = ( int ) ( ( char * ) item - ( char * ) memblock ) ; xge_assert ( offset >= 0 && offset < mempool -> memblock_size ) ; ( * memblock_item_idx ) = ( int ) offset / mempool -> item_size ; xge_assert ( ( * memblock_item_idx ) < mempool -> items_per_memblock ) ; return ( char * ) mempool -> memblocks_priv_arr [ memblock_idx ] + ( * memblock_item_idx ) * mempool -> items_priv_size ; }
__hal_mempool_item_priv - will return pointer on per item private space
__hal_mempool_item_priv - will return pointer on per item private space