1321936Shselasky/* 2321936Shselasky * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3321936Shselasky * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4321936Shselasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5321936Shselasky * 6321936Shselasky * This software is available to you under a choice of one of two 7321936Shselasky * licenses. You may choose to be licensed under the terms of the GNU 8321936Shselasky * General Public License (GPL) Version 2, available from the file 9321936Shselasky * COPYING in the main directory of this source tree, or the 10321936Shselasky * OpenIB.org BSD license below: 11321936Shselasky * 12321936Shselasky * Redistribution and use in source and binary forms, with or 13321936Shselasky * without modification, are permitted provided that the following 14321936Shselasky * conditions are met: 15321936Shselasky * 16321936Shselasky * - Redistributions of source code must retain the above 17321936Shselasky * copyright notice, this list of conditions and the following 18321936Shselasky * disclaimer. 19321936Shselasky * 20321936Shselasky * - Redistributions in binary form must reproduce the above 21321936Shselasky * copyright notice, this list of conditions and the following 22321936Shselasky * disclaimer in the documentation and/or other materials 23321936Shselasky * provided with the distribution. 24321936Shselasky * 25321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32321936Shselasky * SOFTWARE. 33321936Shselasky * 34321936Shselasky */ 35321936Shselasky 36321936Shselasky/* 37321936Shselasky * Abstract: 38321936Shselasky * Declaration of the pool. 39321936Shselasky * The pool manages a pool of objects. 40321936Shselasky * The pool can grow to meet demand, limited only by system memory. 41321936Shselasky */ 42321936Shselasky 43321936Shselasky#ifndef _CL_POOL_H_ 44321936Shselasky#define _CL_POOL_H_ 45321936Shselasky 46321936Shselasky#include <complib/cl_qcomppool.h> 47321936Shselasky 48321936Shselasky#ifdef __cplusplus 49321936Shselasky# define BEGIN_C_DECLS extern "C" { 50321936Shselasky# define END_C_DECLS } 51321936Shselasky#else /* !__cplusplus */ 52321936Shselasky# define BEGIN_C_DECLS 53321936Shselasky# define END_C_DECLS 54321936Shselasky#endif /* __cplusplus */ 55321936Shselasky 56321936ShselaskyBEGIN_C_DECLS 57321936Shselasky/****h* Component Library/Pool 58321936Shselasky* NAME 59321936Shselasky* Pool 60321936Shselasky* 61321936Shselasky* DESCRIPTION 62321936Shselasky* The pool provides a self-contained and self-sustaining pool 63321936Shselasky* of user defined objects. 64321936Shselasky* 65321936Shselasky* To aid in object oriented design, the pool provides the user 66321936Shselasky* the ability to specify callbacks that are invoked for each object for 67321936Shselasky* construction, initialization, and destruction. Constructor and destructor 68321936Shselasky* callback functions may not fail. 69321936Shselasky* 70321936Shselasky* A pool does not return memory to the system as the user returns 71321936Shselasky* objects to the pool. The only method of returning memory to the system is 72321936Shselasky* to destroy the pool. 73321936Shselasky* 74321936Shselasky* The Pool functions operate on a cl_pool_t structure which should be treated 75321936Shselasky* as opaque and should be manipulated only through the provided functions. 76321936Shselasky* 77321936Shselasky* SEE ALSO 78321936Shselasky* Structures: 79321936Shselasky* cl_pool_t 80321936Shselasky* 81321936Shselasky* Callbacks: 82321936Shselasky* cl_pfn_pool_init_t, cl_pfn_pool_dtor_t 83321936Shselasky* 84321936Shselasky* Initialization/Destruction: 85321936Shselasky* cl_pool_construct, cl_pool_init, cl_pool_destroy 86321936Shselasky* 87321936Shselasky* Manipulation: 88321936Shselasky* cl_pool_get, cl_pool_put, cl_pool_grow 89321936Shselasky* 90321936Shselasky* Attributes: 91321936Shselasky* cl_is_pool_inited, cl_pool_count 92321936Shselasky*********/ 93321936Shselasky/****d* Component Library: Pool/cl_pfn_pool_init_t 94321936Shselasky* NAME 95321936Shselasky* cl_pfn_pool_init_t 96321936Shselasky* 97321936Shselasky* DESCRIPTION 98321936Shselasky* The cl_pfn_pool_init_t function type defines the prototype for 99321936Shselasky* functions used as initializers for objects being allocated by a 100321936Shselasky* pool. 101321936Shselasky* 102321936Shselasky* SYNOPSIS 103321936Shselasky*/ 104321936Shselaskytypedef cl_status_t 105321936Shselasky (*cl_pfn_pool_init_t) (IN void *const p_object, IN void *context); 106321936Shselasky/* 107321936Shselasky* PARAMETERS 108321936Shselasky* p_object 109321936Shselasky* [in] Pointer to an object to initialize. 110321936Shselasky* 111321936Shselasky* context 112321936Shselasky* [in] Context provided in a call to cl_pool_init. 113321936Shselasky* 114321936Shselasky* RETURN VALUES 115321936Shselasky* Return CL_SUCCESS to indicates that initialization of the object 116321936Shselasky* was successful and initialization of further objects may continue. 117321936Shselasky* 118321936Shselasky* Other cl_status_t values will be returned by cl_pool_init 119321936Shselasky* and cl_pool_grow. 120321936Shselasky* 121321936Shselasky* NOTES 122321936Shselasky* This function type is provided as function prototype reference for 123321936Shselasky* the function provided by the user as an optional parameter to the 124321936Shselasky* cl_pool_init function. 125321936Shselasky* 126321936Shselasky* The initializer is invoked once per allocated object, allowing the user 127321936Shselasky* to trap initialization failures. Returning a status other than CL_SUCCESS 128321936Shselasky* aborts a grow operation, initiated either through cl_pool_init or 129321936Shselasky* cl_pool_grow, and causes the initiating function to fail. 130321936Shselasky* Any non-CL_SUCCESS status will be returned by the function that initiated 131321936Shselasky* the grow operation. 132321936Shselasky* 133321936Shselasky* SEE ALSO 134321936Shselasky* Pool, cl_pool_init, cl_pool_grow 135321936Shselasky*********/ 136321936Shselasky 137321936Shselasky/****d* Component Library: Pool/cl_pfn_pool_dtor_t 138321936Shselasky* NAME 139321936Shselasky* cl_pfn_pool_dtor_t 140321936Shselasky* 141321936Shselasky* DESCRIPTION 142321936Shselasky* The cl_pfn_pool_dtor_t function type defines the prototype for 143321936Shselasky* functions used as destructor for objects being deallocated by a 144321936Shselasky* pool. 145321936Shselasky* 146321936Shselasky* SYNOPSIS 147321936Shselasky*/ 148321936Shselaskytypedef void 149321936Shselasky (*cl_pfn_pool_dtor_t) (IN void *const p_object, IN void *context); 150321936Shselasky/* 151321936Shselasky* PARAMETERS 152321936Shselasky* p_object 153321936Shselasky* [in] Pointer to an object to destruct. 154321936Shselasky* 155321936Shselasky* context 156321936Shselasky* [in] Context provided in the call to cl_pool_init. 157321936Shselasky* 158321936Shselasky* RETURN VALUE 159321936Shselasky* This function does not return a value. 160321936Shselasky* 161321936Shselasky* NOTES 162321936Shselasky* This function type is provided as function prototype reference for 163321936Shselasky* the function provided by the user as an optional parameter to the 164321936Shselasky* cl_pool_init function. 165321936Shselasky* 166321936Shselasky* The destructor is invoked once per allocated object, allowing the user 167321936Shselasky* to perform any necessary cleanup. Users should not attempt to deallocate 168321936Shselasky* the memory for the object, as the pool manages object 169321936Shselasky* allocation and deallocation. 170321936Shselasky* 171321936Shselasky* SEE ALSO 172321936Shselasky* Pool, cl_pool_init 173321936Shselasky*********/ 174321936Shselasky 175321936Shselasky/****s* Component Library: Pool/cl_pool_t 176321936Shselasky* NAME 177321936Shselasky* cl_pool_t 178321936Shselasky* 179321936Shselasky* DESCRIPTION 180321936Shselasky* pool structure. 181321936Shselasky* 182321936Shselasky* The cl_pool_t structure should be treated as opaque and should be 183321936Shselasky* manipulated only through the provided functions. 184321936Shselasky* 185321936Shselasky* SYNOPSIS 186321936Shselasky*/ 187321936Shselaskytypedef struct _cl_pool { 188321936Shselasky cl_qcpool_t qcpool; 189321936Shselasky cl_pfn_pool_init_t pfn_init; 190321936Shselasky cl_pfn_pool_dtor_t pfn_dtor; 191321936Shselasky const void *context; 192321936Shselasky} cl_pool_t; 193321936Shselasky/* 194321936Shselasky* FIELDS 195321936Shselasky* qcpool 196321936Shselasky* Quick composite pool that manages all objects. 197321936Shselasky* 198321936Shselasky* pfn_init 199321936Shselasky* Pointer to the user's initializer callback, used by the pool 200321936Shselasky* to translate the quick composite pool's initializer callback to 201321936Shselasky* a pool initializer callback. 202321936Shselasky* 203321936Shselasky* pfn_dtor 204321936Shselasky* Pointer to the user's destructor callback, used by the pool 205321936Shselasky* to translate the quick composite pool's destructor callback to 206321936Shselasky* a pool destructor callback. 207321936Shselasky* 208321936Shselasky* context 209321936Shselasky* User's provided context for callback functions, used by the pool 210321936Shselasky* to when invoking callbacks. 211321936Shselasky* 212321936Shselasky* SEE ALSO 213321936Shselasky* Pool 214321936Shselasky*********/ 215321936Shselasky 216321936Shselasky/****f* Component Library: Pool/cl_pool_construct 217321936Shselasky* NAME 218321936Shselasky* cl_pool_construct 219321936Shselasky* 220321936Shselasky* DESCRIPTION 221321936Shselasky* The cl_pool_construct function constructs a pool. 222321936Shselasky* 223321936Shselasky* SYNOPSIS 224321936Shselasky*/ 225321936Shselaskyvoid cl_pool_construct(IN cl_pool_t * const p_pool); 226321936Shselasky/* 227321936Shselasky* PARAMETERS 228321936Shselasky* p_pool 229321936Shselasky* [in] Pointer to a cl_pool_t structure whose state to initialize. 230321936Shselasky* 231321936Shselasky* RETURN VALUE 232321936Shselasky* This function does not return a value. 233321936Shselasky* 234321936Shselasky* NOTES 235321936Shselasky* Allows calling cl_pool_init, cl_pool_destroy, and cl_is_pool_inited. 236321936Shselasky* 237321936Shselasky* Calling cl_pool_construct is a prerequisite to calling any other 238321936Shselasky* pool function except cl_pool_init. 239321936Shselasky* 240321936Shselasky* SEE ALSO 241321936Shselasky* Pool, cl_pool_init, cl_pool_destroy, cl_is_pool_inited 242321936Shselasky*********/ 243321936Shselasky 244321936Shselasky/****f* Component Library: Pool/cl_is_pool_inited 245321936Shselasky* NAME 246321936Shselasky* cl_is_pool_inited 247321936Shselasky* 248321936Shselasky* DESCRIPTION 249321936Shselasky* The cl_is_pool_inited function returns whether a pool was successfully 250321936Shselasky* initialized. 251321936Shselasky* 252321936Shselasky* SYNOPSIS 253321936Shselasky*/ 254321936Shselaskystatic inline uint32_t cl_is_pool_inited(IN const cl_pool_t * const p_pool) 255321936Shselasky{ 256321936Shselasky /* CL_ASSERT that a non-null pointer is provided. */ 257321936Shselasky CL_ASSERT(p_pool); 258321936Shselasky return (cl_is_qcpool_inited(&p_pool->qcpool)); 259321936Shselasky} 260321936Shselasky 261321936Shselasky/* 262321936Shselasky* PARAMETERS 263321936Shselasky* p_pool 264321936Shselasky* [in] Pointer to a cl_pool_t structure whose initialization state 265321936Shselasky* to check. 266321936Shselasky* 267321936Shselasky* RETURN VALUES 268321936Shselasky* TRUE if the pool was initialized successfully. 269321936Shselasky* 270321936Shselasky* FALSE otherwise. 271321936Shselasky* 272321936Shselasky* NOTES 273321936Shselasky* Allows checking the state of a pool to determine if invoking member 274321936Shselasky* functions is appropriate. 275321936Shselasky* 276321936Shselasky* SEE ALSO 277321936Shselasky* Pool 278321936Shselasky*********/ 279321936Shselasky 280321936Shselasky/****f* Component Library: Pool/cl_pool_init 281321936Shselasky* NAME 282321936Shselasky* cl_pool_init 283321936Shselasky* 284321936Shselasky* DESCRIPTION 285321936Shselasky* The cl_pool_init function initializes a pool for use. 286321936Shselasky* 287321936Shselasky* SYNOPSIS 288321936Shselasky*/ 289321936Shselaskycl_status_t 290321936Shselaskycl_pool_init(IN cl_pool_t * const p_pool, 291321936Shselasky IN const size_t min_count, 292321936Shselasky IN const size_t max_count, 293321936Shselasky IN const size_t grow_size, 294321936Shselasky IN const size_t object_size, 295321936Shselasky IN cl_pfn_pool_init_t pfn_initializer OPTIONAL, 296321936Shselasky IN cl_pfn_pool_dtor_t pfn_destructor OPTIONAL, 297321936Shselasky IN const void *const context); 298321936Shselasky/* 299321936Shselasky* PARAMETERS 300321936Shselasky* p_pool 301321936Shselasky* [in] Pointer to a cl_pool_t structure to initialize. 302321936Shselasky* 303321936Shselasky* min_count 304321936Shselasky* [in] Minimum number of objects that the pool should support. All 305321936Shselasky* necessary allocations to allow storing the minimum number of items 306321936Shselasky* are performed at initialization time, and all necessary callbacks 307321936Shselasky* invoked. 308321936Shselasky* 309321936Shselasky* max_count 310321936Shselasky* [in] Maximum number of objects to which the pool is allowed to grow. 311321936Shselasky* A value of zero specifies no maximum. 312321936Shselasky* 313321936Shselasky* grow_size 314321936Shselasky* [in] Number of objects to allocate when incrementally growing the pool. 315321936Shselasky* A value of zero disables automatic growth. 316321936Shselasky* 317321936Shselasky* object_size 318321936Shselasky* [in] Size, in bytes, of each object. 319321936Shselasky* 320321936Shselasky* pfn_initializer 321321936Shselasky* [in] Initialization callback to invoke for every new object when 322321936Shselasky* growing the pool. This parameter is optional and may be NULL. 323321936Shselasky* See the cl_pfn_pool_init_t function type declaration for details 324321936Shselasky* about the callback function. 325321936Shselasky* 326321936Shselasky* pfn_destructor 327321936Shselasky* [in] Destructor callback to invoke for every object before memory for 328321936Shselasky* that object is freed. This parameter is optional and may be NULL. 329321936Shselasky* See the cl_pfn_pool_dtor_t function type declaration for details 330321936Shselasky* about the callback function. 331321936Shselasky* 332321936Shselasky* context 333321936Shselasky* [in] Value to pass to the callback functions to provide context. 334321936Shselasky* 335321936Shselasky* RETURN VALUES 336321936Shselasky* CL_SUCCESS if the pool was initialized successfully. 337321936Shselasky* 338321936Shselasky* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the 339321936Shselasky* pool. 340321936Shselasky* 341321936Shselasky* CL_INVALID_SETTING if a the maximum size is non-zero and less than the 342321936Shselasky* minimum size. 343321936Shselasky* 344321936Shselasky* Other cl_status_t value returned by optional initialization callback function 345321936Shselasky* specified by the pfn_initializer parameter. 346321936Shselasky* 347321936Shselasky* NOTES 348321936Shselasky* cl_pool_init initializes, and if necessary, grows the pool to 349321936Shselasky* the capacity desired. 350321936Shselasky* 351321936Shselasky* SEE ALSO 352321936Shselasky* Pool, cl_pool_construct, cl_pool_destroy, 353321936Shselasky* cl_pool_get, cl_pool_put, cl_pool_grow, 354321936Shselasky* cl_pool_count, cl_pfn_pool_init_t, cl_pfn_pool_dtor_t 355321936Shselasky*********/ 356321936Shselasky 357321936Shselasky/****f* Component Library: Pool/cl_pool_destroy 358321936Shselasky* NAME 359321936Shselasky* cl_pool_destroy 360321936Shselasky* 361321936Shselasky* DESCRIPTION 362321936Shselasky* The cl_pool_destroy function destroys a pool. 363321936Shselasky* 364321936Shselasky* SYNOPSIS 365321936Shselasky*/ 366321936Shselaskystatic inline void cl_pool_destroy(IN cl_pool_t * const p_pool) 367321936Shselasky{ 368321936Shselasky CL_ASSERT(p_pool); 369321936Shselasky cl_qcpool_destroy(&p_pool->qcpool); 370321936Shselasky} 371321936Shselasky 372321936Shselasky/* 373321936Shselasky* PARAMETERS 374321936Shselasky* p_pool 375321936Shselasky* [in] Pointer to a cl_pool_t structure to destroy. 376321936Shselasky* 377321936Shselasky* RETURN VALUE 378321936Shselasky* This function does not return a value. 379321936Shselasky* 380321936Shselasky* NOTES 381321936Shselasky* All memory allocated for objects is freed. The destructor callback, 382321936Shselasky* if any, will be invoked for every allocated object. Further operations 383321936Shselasky* on the pool should not be attempted after cl_pool_destroy 384321936Shselasky* is invoked. 385321936Shselasky* 386321936Shselasky* This function should only be called after a call to 387321936Shselasky* cl_pool_construct or cl_pool_init. 388321936Shselasky* 389321936Shselasky* In a debug build, cl_pool_destroy asserts that all objects are in 390321936Shselasky* the pool. 391321936Shselasky* 392321936Shselasky* SEE ALSO 393321936Shselasky* Pool, cl_pool_construct, cl_pool_init 394321936Shselasky*********/ 395321936Shselasky 396321936Shselasky/****f* Component Library: Pool/cl_pool_count 397321936Shselasky* NAME 398321936Shselasky* cl_pool_count 399321936Shselasky* 400321936Shselasky* DESCRIPTION 401321936Shselasky* The cl_pool_count function returns the number of available objects 402321936Shselasky* in a pool. 403321936Shselasky* 404321936Shselasky* SYNOPSIS 405321936Shselasky*/ 406321936Shselaskystatic inline size_t cl_pool_count(IN cl_pool_t * const p_pool) 407321936Shselasky{ 408321936Shselasky CL_ASSERT(p_pool); 409321936Shselasky return (cl_qcpool_count(&p_pool->qcpool)); 410321936Shselasky} 411321936Shselasky 412321936Shselasky/* 413321936Shselasky* PARAMETERS 414321936Shselasky* p_pool 415321936Shselasky* [in] Pointer to a cl_pool_t structure for which the number of 416321936Shselasky* available objects is requested. 417321936Shselasky* 418321936Shselasky* RETURN VALUE 419321936Shselasky* Returns the number of objects available in the specified pool. 420321936Shselasky* 421321936Shselasky* SEE ALSO 422321936Shselasky* Pool 423321936Shselasky*********/ 424321936Shselasky 425321936Shselasky/****f* Component Library: Pool/cl_pool_get 426321936Shselasky* NAME 427321936Shselasky* cl_pool_get 428321936Shselasky* 429321936Shselasky* DESCRIPTION 430321936Shselasky* The cl_pool_get function retrieves an object from a pool. 431321936Shselasky* 432321936Shselasky* SYNOPSIS 433321936Shselasky*/ 434321936Shselaskystatic inline void *cl_pool_get(IN cl_pool_t * const p_pool) 435321936Shselasky{ 436321936Shselasky cl_pool_obj_t *p_pool_obj; 437321936Shselasky 438321936Shselasky CL_ASSERT(p_pool); 439321936Shselasky 440321936Shselasky p_pool_obj = (cl_pool_obj_t *) cl_qcpool_get(&p_pool->qcpool); 441321936Shselasky if (!p_pool_obj) 442321936Shselasky return (NULL); 443321936Shselasky 444321936Shselasky CL_ASSERT(p_pool_obj->p_object); 445321936Shselasky return ((void *)p_pool_obj->p_object); 446321936Shselasky} 447321936Shselasky 448321936Shselasky/* 449321936Shselasky* PARAMETERS 450321936Shselasky* p_pool 451321936Shselasky* [in] Pointer to a cl_pool_t structure from which to retrieve 452321936Shselasky* an object. 453321936Shselasky* 454321936Shselasky* RETURN VALUES 455321936Shselasky* Returns a pointer to an object. 456321936Shselasky* 457321936Shselasky* Returns NULL if the pool is empty and can not be grown automatically. 458321936Shselasky* 459321936Shselasky* NOTES 460321936Shselasky* cl_pool_get returns the object at the head of the pool. If the pool is 461321936Shselasky* empty, it is automatically grown to accommodate this request unless the 462321936Shselasky* grow_size parameter passed to the cl_pool_init function was zero. 463321936Shselasky* 464321936Shselasky* SEE ALSO 465321936Shselasky* Pool, cl_pool_get_tail, cl_pool_put, cl_pool_grow, cl_pool_count 466321936Shselasky*********/ 467321936Shselasky 468321936Shselasky/****f* Component Library: Pool/cl_pool_put 469321936Shselasky* NAME 470321936Shselasky* cl_pool_put 471321936Shselasky* 472321936Shselasky* DESCRIPTION 473321936Shselasky* The cl_pool_put function returns an object to a pool. 474321936Shselasky* 475321936Shselasky* SYNOPSIS 476321936Shselasky*/ 477321936Shselaskystatic inline void 478321936Shselaskycl_pool_put(IN cl_pool_t * const p_pool, IN void *const p_object) 479321936Shselasky{ 480321936Shselasky cl_pool_obj_t *p_pool_obj; 481321936Shselasky 482321936Shselasky CL_ASSERT(p_pool); 483321936Shselasky CL_ASSERT(p_object); 484321936Shselasky 485321936Shselasky /* Calculate the offset to the list object representing this object. */ 486321936Shselasky p_pool_obj = (cl_pool_obj_t *) 487321936Shselasky (((uint8_t *) p_object) - sizeof(cl_pool_obj_t)); 488321936Shselasky 489321936Shselasky /* good sanity check */ 490321936Shselasky CL_ASSERT(p_pool_obj->p_object == p_object); 491321936Shselasky 492321936Shselasky cl_qcpool_put(&p_pool->qcpool, &p_pool_obj->pool_item); 493321936Shselasky} 494321936Shselasky 495321936Shselasky/* 496321936Shselasky* PARAMETERS 497321936Shselasky* p_pool 498321936Shselasky* [in] Pointer to a cl_pool_t structure to which to return 499321936Shselasky* an object. 500321936Shselasky* 501321936Shselasky* p_object 502321936Shselasky* [in] Pointer to an object to return to the pool. 503321936Shselasky* 504321936Shselasky* RETURN VALUE 505321936Shselasky* This function does not return a value. 506321936Shselasky* 507321936Shselasky* NOTES 508321936Shselasky* cl_pool_put places the returned object at the head of the pool. 509321936Shselasky* 510321936Shselasky* The object specified by the p_object parameter must have been 511321936Shselasky* retrieved from the pool by a previous call to cl_pool_get. 512321936Shselasky* 513321936Shselasky* SEE ALSO 514321936Shselasky* Pool, cl_pool_put_tail, cl_pool_get 515321936Shselasky*********/ 516321936Shselasky 517321936Shselasky/****f* Component Library: Pool/cl_pool_grow 518321936Shselasky* NAME 519321936Shselasky* cl_pool_grow 520321936Shselasky* 521321936Shselasky* DESCRIPTION 522321936Shselasky* The cl_pool_grow function grows a pool by 523321936Shselasky* the specified number of objects. 524321936Shselasky* 525321936Shselasky* SYNOPSIS 526321936Shselasky*/ 527321936Shselaskystatic inline cl_status_t 528321936Shselaskycl_pool_grow(IN cl_pool_t * const p_pool, IN const size_t obj_count) 529321936Shselasky{ 530321936Shselasky CL_ASSERT(p_pool); 531321936Shselasky return (cl_qcpool_grow(&p_pool->qcpool, obj_count)); 532321936Shselasky} 533321936Shselasky 534321936Shselasky/* 535321936Shselasky* PARAMETERS 536321936Shselasky* p_pool 537321936Shselasky* [in] Pointer to a cl_pool_t structure whose capacity to grow. 538321936Shselasky* 539321936Shselasky* obj_count 540321936Shselasky* [in] Number of objects by which to grow the pool. 541321936Shselasky* 542321936Shselasky* RETURN VALUES 543321936Shselasky* CL_SUCCESS if the pool grew successfully. 544321936Shselasky* 545321936Shselasky* CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the 546321936Shselasky* pool. 547321936Shselasky* 548321936Shselasky* cl_status_t value returned by optional initialization callback function 549321936Shselasky* specified by the pfn_initializer parameter passed to the 550321936Shselasky* cl_pool_init function. 551321936Shselasky* 552321936Shselasky* NOTES 553321936Shselasky* It is not necessary to call cl_pool_grow if the pool is 554321936Shselasky* configured to grow automatically. 555321936Shselasky* 556321936Shselasky* SEE ALSO 557321936Shselasky* Pool 558321936Shselasky*********/ 559321936Shselasky 560321936ShselaskyEND_C_DECLS 561321936Shselasky#endif /* _CL_POOL_H_ */ 562