1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff/* 37219820Sjeff * Abstract: 38219820Sjeff * Declaration of the pool. 39219820Sjeff * The pool manages a pool of objects. 40219820Sjeff * The pool can grow to meet demand, limited only by system memory. 41219820Sjeff */ 42219820Sjeff 43219820Sjeff#ifndef _CL_POOL_H_ 44219820Sjeff#define _CL_POOL_H_ 45219820Sjeff 46219820Sjeff#include <complib/cl_qcomppool.h> 47219820Sjeff 48219820Sjeff#ifdef __cplusplus 49219820Sjeff# define BEGIN_C_DECLS extern "C" { 50219820Sjeff# define END_C_DECLS } 51219820Sjeff#else /* !__cplusplus */ 52219820Sjeff# define BEGIN_C_DECLS 53219820Sjeff# define END_C_DECLS 54219820Sjeff#endif /* __cplusplus */ 55219820Sjeff 56219820SjeffBEGIN_C_DECLS 57219820Sjeff/****h* Component Library/Pool 58219820Sjeff* NAME 59219820Sjeff* Pool 60219820Sjeff* 61219820Sjeff* DESCRIPTION 62219820Sjeff* The pool provides a self-contained and self-sustaining pool 63219820Sjeff* of user defined objects. 64219820Sjeff* 65219820Sjeff* To aid in object oriented design, the pool provides the user 66219820Sjeff* the ability to specify callbacks that are invoked for each object for 67219820Sjeff* construction, initialization, and destruction. Constructor and destructor 68219820Sjeff* callback functions may not fail. 69219820Sjeff* 70219820Sjeff* A pool does not return memory to the system as the user returns 71219820Sjeff* objects to the pool. The only method of returning memory to the system is 72219820Sjeff* to destroy the pool. 73219820Sjeff* 74219820Sjeff* The Pool functions operate on a cl_pool_t structure which should be treated 75219820Sjeff* as opaque and should be manipulated only through the provided functions. 76219820Sjeff* 77219820Sjeff* SEE ALSO 78219820Sjeff* Structures: 79219820Sjeff* cl_pool_t 80219820Sjeff* 81219820Sjeff* Callbacks: 82219820Sjeff* cl_pfn_pool_init_t, cl_pfn_pool_dtor_t 83219820Sjeff* 84219820Sjeff* Initialization/Destruction: 85219820Sjeff* cl_pool_construct, cl_pool_init, cl_pool_destroy 86219820Sjeff* 87219820Sjeff* Manipulation: 88219820Sjeff* cl_pool_get, cl_pool_put, cl_pool_grow 89219820Sjeff* 90219820Sjeff* Attributes: 91219820Sjeff* cl_is_pool_inited, cl_pool_count 92219820Sjeff*********/ 93219820Sjeff/****d* Component Library: Pool/cl_pfn_pool_init_t 94219820Sjeff* NAME 95219820Sjeff* cl_pfn_pool_init_t 96219820Sjeff* 97219820Sjeff* DESCRIPTION 98219820Sjeff* The cl_pfn_pool_init_t function type defines the prototype for 99219820Sjeff* functions used as initializers for objects being allocated by a 100219820Sjeff* pool. 101219820Sjeff* 102219820Sjeff* SYNOPSIS 103219820Sjeff*/ 104219820Sjefftypedef cl_status_t 105219820Sjeff (*cl_pfn_pool_init_t) (IN void *const p_object, IN void *context); 106219820Sjeff/* 107219820Sjeff* PARAMETERS 108219820Sjeff* p_object 109219820Sjeff* [in] Pointer to an object to initialize. 110219820Sjeff* 111219820Sjeff* context 112219820Sjeff* [in] Context provided in a call to cl_pool_init. 113219820Sjeff* 114219820Sjeff* RETURN VALUES 115219820Sjeff* Return CL_SUCCESS to indicates that initialization of the object 116219820Sjeff* was successful and initialization of further objects may continue. 117219820Sjeff* 118219820Sjeff* Other cl_status_t values will be returned by cl_pool_init 119219820Sjeff* and cl_pool_grow. 120219820Sjeff* 121219820Sjeff* NOTES 122219820Sjeff* This function type is provided as function prototype reference for 123219820Sjeff* the function provided by the user as an optional parameter to the 124219820Sjeff* cl_pool_init function. 125219820Sjeff* 126219820Sjeff* The initializer is invoked once per allocated object, allowing the user 127219820Sjeff* to trap initialization failures. Returning a status other than CL_SUCCESS 128219820Sjeff* aborts a grow operation, initiated either through cl_pool_init or 129219820Sjeff* cl_pool_grow, and causes the initiating function to fail. 130219820Sjeff* Any non-CL_SUCCESS status will be returned by the function that initiated 131219820Sjeff* the grow operation. 132219820Sjeff* 133219820Sjeff* SEE ALSO 134219820Sjeff* Pool, cl_pool_init, cl_pool_grow 135219820Sjeff*********/ 136219820Sjeff 137219820Sjeff/****d* Component Library: Pool/cl_pfn_pool_dtor_t 138219820Sjeff* NAME 139219820Sjeff* cl_pfn_pool_dtor_t 140219820Sjeff* 141219820Sjeff* DESCRIPTION 142219820Sjeff* The cl_pfn_pool_dtor_t function type defines the prototype for 143219820Sjeff* functions used as destructor for objects being deallocated by a 144219820Sjeff* pool. 145219820Sjeff* 146219820Sjeff* SYNOPSIS 147219820Sjeff*/ 148219820Sjefftypedef void 149219820Sjeff (*cl_pfn_pool_dtor_t) (IN void *const p_object, IN void *context); 150219820Sjeff/* 151219820Sjeff* PARAMETERS 152219820Sjeff* p_object 153219820Sjeff* [in] Pointer to an object to destruct. 154219820Sjeff* 155219820Sjeff* context 156219820Sjeff* [in] Context provided in the call to cl_pool_init. 157219820Sjeff* 158219820Sjeff* RETURN VALUE 159219820Sjeff* This function does not return a value. 160219820Sjeff* 161219820Sjeff* NOTES 162219820Sjeff* This function type is provided as function prototype reference for 163219820Sjeff* the function provided by the user as an optional parameter to the 164219820Sjeff* cl_pool_init function. 165219820Sjeff* 166219820Sjeff* The destructor is invoked once per allocated object, allowing the user 167219820Sjeff* to perform any necessary cleanup. Users should not attempt to deallocate 168219820Sjeff* the memory for the object, as the pool manages object 169219820Sjeff* allocation and deallocation. 170219820Sjeff* 171219820Sjeff* SEE ALSO 172219820Sjeff* Pool, cl_pool_init 173219820Sjeff*********/ 174219820Sjeff 175219820Sjeff/****s* Component Library: Pool/cl_pool_t 176219820Sjeff* NAME 177219820Sjeff* cl_pool_t 178219820Sjeff* 179219820Sjeff* DESCRIPTION 180219820Sjeff* pool structure. 181219820Sjeff* 182219820Sjeff* The cl_pool_t structure should be treated as opaque and should be 183219820Sjeff* manipulated only through the provided functions. 184219820Sjeff* 185219820Sjeff* SYNOPSIS 186219820Sjeff*/ 187219820Sjefftypedef struct _cl_pool { 188219820Sjeff cl_qcpool_t qcpool; 189219820Sjeff cl_pfn_pool_init_t pfn_init; 190219820Sjeff cl_pfn_pool_dtor_t pfn_dtor; 191219820Sjeff const void *context; 192219820Sjeff} cl_pool_t; 193219820Sjeff/* 194219820Sjeff* FIELDS 195219820Sjeff* qcpool 196219820Sjeff* Quick composite pool that manages all objects. 197219820Sjeff* 198219820Sjeff* pfn_init 199219820Sjeff* Pointer to the user's initializer callback, used by the pool 200219820Sjeff* to translate the quick composite pool's initializer callback to 201219820Sjeff* a pool initializer callback. 202219820Sjeff* 203219820Sjeff* pfn_dtor 204219820Sjeff* Pointer to the user's destructor callback, used by the pool 205219820Sjeff* to translate the quick composite pool's destructor callback to 206219820Sjeff* a pool destructor callback. 207219820Sjeff* 208219820Sjeff* context 209219820Sjeff* User's provided context for callback functions, used by the pool 210219820Sjeff* to when invoking callbacks. 211219820Sjeff* 212219820Sjeff* SEE ALSO 213219820Sjeff* Pool 214219820Sjeff*********/ 215219820Sjeff 216219820Sjeff/****f* Component Library: Pool/cl_pool_construct 217219820Sjeff* NAME 218219820Sjeff* cl_pool_construct 219219820Sjeff* 220219820Sjeff* DESCRIPTION 221219820Sjeff* The cl_pool_construct function constructs a pool. 222219820Sjeff* 223219820Sjeff* SYNOPSIS 224219820Sjeff*/ 225219820Sjeffvoid cl_pool_construct(IN cl_pool_t * const p_pool); 226219820Sjeff/* 227219820Sjeff* PARAMETERS 228219820Sjeff* p_pool 229219820Sjeff* [in] Pointer to a cl_pool_t structure whose state to initialize. 230219820Sjeff* 231219820Sjeff* RETURN VALUE 232219820Sjeff* This function does not return a value. 233219820Sjeff* 234219820Sjeff* NOTES 235219820Sjeff* Allows calling cl_pool_init, cl_pool_destroy, and cl_is_pool_inited. 236219820Sjeff* 237219820Sjeff* Calling cl_pool_construct is a prerequisite to calling any other 238219820Sjeff* pool function except cl_pool_init. 239219820Sjeff* 240219820Sjeff* SEE ALSO 241219820Sjeff* Pool, cl_pool_init, cl_pool_destroy, cl_is_pool_inited 242219820Sjeff*********/ 243219820Sjeff 244219820Sjeff/****f* Component Library: Pool/cl_is_pool_inited 245219820Sjeff* NAME 246219820Sjeff* cl_is_pool_inited 247219820Sjeff* 248219820Sjeff* DESCRIPTION 249219820Sjeff* The cl_is_pool_inited function returns whether a pool was successfully 250219820Sjeff* initialized. 251219820Sjeff* 252219820Sjeff* SYNOPSIS 253219820Sjeff*/ 254219820Sjeffstatic inline uint32_t cl_is_pool_inited(IN const cl_pool_t * const p_pool) 255219820Sjeff{ 256219820Sjeff /* CL_ASSERT that a non-null pointer is provided. */ 257219820Sjeff CL_ASSERT(p_pool); 258219820Sjeff return (cl_is_qcpool_inited(&p_pool->qcpool)); 259219820Sjeff} 260219820Sjeff 261219820Sjeff/* 262219820Sjeff* PARAMETERS 263219820Sjeff* p_pool 264219820Sjeff* [in] Pointer to a cl_pool_t structure whose initialization state 265219820Sjeff* to check. 266219820Sjeff* 267219820Sjeff* RETURN VALUES 268219820Sjeff* TRUE if the pool was initialized successfully. 269219820Sjeff* 270219820Sjeff* FALSE otherwise. 271219820Sjeff* 272219820Sjeff* NOTES 273219820Sjeff* Allows checking the state of a pool to determine if invoking member 274219820Sjeff* functions is appropriate. 275219820Sjeff* 276219820Sjeff* SEE ALSO 277219820Sjeff* Pool 278219820Sjeff*********/ 279219820Sjeff 280219820Sjeff/****f* Component Library: Pool/cl_pool_init 281219820Sjeff* NAME 282219820Sjeff* cl_pool_init 283219820Sjeff* 284219820Sjeff* DESCRIPTION 285219820Sjeff* The cl_pool_init function initializes a pool for use. 286219820Sjeff* 287219820Sjeff* SYNOPSIS 288219820Sjeff*/ 289219820Sjeffcl_status_t 290219820Sjeffcl_pool_init(IN cl_pool_t * const p_pool, 291219820Sjeff IN const size_t min_count, 292219820Sjeff IN const size_t max_count, 293219820Sjeff IN const size_t grow_size, 294219820Sjeff IN const size_t object_size, 295219820Sjeff IN cl_pfn_pool_init_t pfn_initializer OPTIONAL, 296219820Sjeff IN cl_pfn_pool_dtor_t pfn_destructor OPTIONAL, 297219820Sjeff IN const void *const context); 298219820Sjeff/* 299219820Sjeff* PARAMETERS 300219820Sjeff* p_pool 301219820Sjeff* [in] Pointer to a cl_pool_t structure to initialize. 302219820Sjeff* 303219820Sjeff* min_count 304219820Sjeff* [in] Minimum number of objects that the pool should support. All 305219820Sjeff* necessary allocations to allow storing the minimum number of items 306219820Sjeff* are performed at initialization time, and all necessary callbacks 307219820Sjeff* invoked. 308219820Sjeff* 309219820Sjeff* max_count 310219820Sjeff* [in] Maximum number of objects to which the pool is allowed to grow. 311219820Sjeff* A value of zero specifies no maximum. 312219820Sjeff* 313219820Sjeff* grow_size 314219820Sjeff* [in] Number of objects to allocate when incrementally growing the pool. 315219820Sjeff* A value of zero disables automatic growth. 316219820Sjeff* 317219820Sjeff* object_size 318219820Sjeff* [in] Size, in bytes, of each object. 319219820Sjeff* 320219820Sjeff* pfn_initializer 321219820Sjeff* [in] Initialization callback to invoke for every new object when 322219820Sjeff* growing the pool. This parameter is optional and may be NULL. 323219820Sjeff* See the cl_pfn_pool_init_t function type declaration for details 324219820Sjeff* about the callback function. 325219820Sjeff* 326219820Sjeff* pfn_destructor 327219820Sjeff* [in] Destructor callback to invoke for every object before memory for 328219820Sjeff* that object is freed. This parameter is optional and may be NULL. 329219820Sjeff* See the cl_pfn_pool_dtor_t function type declaration for details 330219820Sjeff* about the callback function. 331219820Sjeff* 332219820Sjeff* context 333219820Sjeff* [in] Value to pass to the callback functions to provide context. 334219820Sjeff* 335219820Sjeff* RETURN VALUES 336219820Sjeff* CL_SUCCESS if the pool was initialized successfully. 337219820Sjeff* 338219820Sjeff* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the 339219820Sjeff* pool. 340219820Sjeff* 341219820Sjeff* CL_INVALID_SETTING if a the maximum size is non-zero and less than the 342219820Sjeff* minimum size. 343219820Sjeff* 344219820Sjeff* Other cl_status_t value returned by optional initialization callback function 345219820Sjeff* specified by the pfn_initializer parameter. 346219820Sjeff* 347219820Sjeff* NOTES 348219820Sjeff* cl_pool_init initializes, and if necessary, grows the pool to 349219820Sjeff* the capacity desired. 350219820Sjeff* 351219820Sjeff* SEE ALSO 352219820Sjeff* Pool, cl_pool_construct, cl_pool_destroy, 353219820Sjeff* cl_pool_get, cl_pool_put, cl_pool_grow, 354219820Sjeff* cl_pool_count, cl_pfn_pool_init_t, cl_pfn_pool_dtor_t 355219820Sjeff*********/ 356219820Sjeff 357219820Sjeff/****f* Component Library: Pool/cl_pool_destroy 358219820Sjeff* NAME 359219820Sjeff* cl_pool_destroy 360219820Sjeff* 361219820Sjeff* DESCRIPTION 362219820Sjeff* The cl_pool_destroy function destroys a pool. 363219820Sjeff* 364219820Sjeff* SYNOPSIS 365219820Sjeff*/ 366219820Sjeffstatic inline void cl_pool_destroy(IN cl_pool_t * const p_pool) 367219820Sjeff{ 368219820Sjeff CL_ASSERT(p_pool); 369219820Sjeff cl_qcpool_destroy(&p_pool->qcpool); 370219820Sjeff} 371219820Sjeff 372219820Sjeff/* 373219820Sjeff* PARAMETERS 374219820Sjeff* p_pool 375219820Sjeff* [in] Pointer to a cl_pool_t structure to destroy. 376219820Sjeff* 377219820Sjeff* RETURN VALUE 378219820Sjeff* This function does not return a value. 379219820Sjeff* 380219820Sjeff* NOTES 381219820Sjeff* All memory allocated for objects is freed. The destructor callback, 382219820Sjeff* if any, will be invoked for every allocated object. Further operations 383219820Sjeff* on the pool should not be attempted after cl_pool_destroy 384219820Sjeff* is invoked. 385219820Sjeff* 386219820Sjeff* This function should only be called after a call to 387219820Sjeff* cl_pool_construct or cl_pool_init. 388219820Sjeff* 389219820Sjeff* In a debug build, cl_pool_destroy asserts that all objects are in 390219820Sjeff* the pool. 391219820Sjeff* 392219820Sjeff* SEE ALSO 393219820Sjeff* Pool, cl_pool_construct, cl_pool_init 394219820Sjeff*********/ 395219820Sjeff 396219820Sjeff/****f* Component Library: Pool/cl_pool_count 397219820Sjeff* NAME 398219820Sjeff* cl_pool_count 399219820Sjeff* 400219820Sjeff* DESCRIPTION 401219820Sjeff* The cl_pool_count function returns the number of available objects 402219820Sjeff* in a pool. 403219820Sjeff* 404219820Sjeff* SYNOPSIS 405219820Sjeff*/ 406219820Sjeffstatic inline size_t cl_pool_count(IN cl_pool_t * const p_pool) 407219820Sjeff{ 408219820Sjeff CL_ASSERT(p_pool); 409219820Sjeff return (cl_qcpool_count(&p_pool->qcpool)); 410219820Sjeff} 411219820Sjeff 412219820Sjeff/* 413219820Sjeff* PARAMETERS 414219820Sjeff* p_pool 415219820Sjeff* [in] Pointer to a cl_pool_t structure for which the number of 416219820Sjeff* available objects is requested. 417219820Sjeff* 418219820Sjeff* RETURN VALUE 419219820Sjeff* Returns the number of objects available in the specified pool. 420219820Sjeff* 421219820Sjeff* SEE ALSO 422219820Sjeff* Pool 423219820Sjeff*********/ 424219820Sjeff 425219820Sjeff/****f* Component Library: Pool/cl_pool_get 426219820Sjeff* NAME 427219820Sjeff* cl_pool_get 428219820Sjeff* 429219820Sjeff* DESCRIPTION 430219820Sjeff* The cl_pool_get function retrieves an object from a pool. 431219820Sjeff* 432219820Sjeff* SYNOPSIS 433219820Sjeff*/ 434219820Sjeffstatic inline void *cl_pool_get(IN cl_pool_t * const p_pool) 435219820Sjeff{ 436219820Sjeff cl_pool_obj_t *p_pool_obj; 437219820Sjeff 438219820Sjeff CL_ASSERT(p_pool); 439219820Sjeff 440219820Sjeff p_pool_obj = (cl_pool_obj_t *) cl_qcpool_get(&p_pool->qcpool); 441219820Sjeff if (!p_pool_obj) 442219820Sjeff return (NULL); 443219820Sjeff 444219820Sjeff CL_ASSERT(p_pool_obj->p_object); 445219820Sjeff return ((void *)p_pool_obj->p_object); 446219820Sjeff} 447219820Sjeff 448219820Sjeff/* 449219820Sjeff* PARAMETERS 450219820Sjeff* p_pool 451219820Sjeff* [in] Pointer to a cl_pool_t structure from which to retrieve 452219820Sjeff* an object. 453219820Sjeff* 454219820Sjeff* RETURN VALUES 455219820Sjeff* Returns a pointer to an object. 456219820Sjeff* 457219820Sjeff* Returns NULL if the pool is empty and can not be grown automatically. 458219820Sjeff* 459219820Sjeff* NOTES 460219820Sjeff* cl_pool_get returns the object at the head of the pool. If the pool is 461219820Sjeff* empty, it is automatically grown to accommodate this request unless the 462219820Sjeff* grow_size parameter passed to the cl_pool_init function was zero. 463219820Sjeff* 464219820Sjeff* SEE ALSO 465219820Sjeff* Pool, cl_pool_get_tail, cl_pool_put, cl_pool_grow, cl_pool_count 466219820Sjeff*********/ 467219820Sjeff 468219820Sjeff/****f* Component Library: Pool/cl_pool_put 469219820Sjeff* NAME 470219820Sjeff* cl_pool_put 471219820Sjeff* 472219820Sjeff* DESCRIPTION 473219820Sjeff* The cl_pool_put function returns an object to a pool. 474219820Sjeff* 475219820Sjeff* SYNOPSIS 476219820Sjeff*/ 477219820Sjeffstatic inline void 478219820Sjeffcl_pool_put(IN cl_pool_t * const p_pool, IN void *const p_object) 479219820Sjeff{ 480219820Sjeff cl_pool_obj_t *p_pool_obj; 481219820Sjeff 482219820Sjeff CL_ASSERT(p_pool); 483219820Sjeff CL_ASSERT(p_object); 484219820Sjeff 485219820Sjeff /* Calculate the offset to the list object representing this object. */ 486219820Sjeff p_pool_obj = (cl_pool_obj_t *) 487219820Sjeff (((uint8_t *) p_object) - sizeof(cl_pool_obj_t)); 488219820Sjeff 489219820Sjeff /* good sanity check */ 490219820Sjeff CL_ASSERT(p_pool_obj->p_object == p_object); 491219820Sjeff 492219820Sjeff cl_qcpool_put(&p_pool->qcpool, &p_pool_obj->pool_item); 493219820Sjeff} 494219820Sjeff 495219820Sjeff/* 496219820Sjeff* PARAMETERS 497219820Sjeff* p_pool 498219820Sjeff* [in] Pointer to a cl_pool_t structure to which to return 499219820Sjeff* an object. 500219820Sjeff* 501219820Sjeff* p_object 502219820Sjeff* [in] Pointer to an object to return to the pool. 503219820Sjeff* 504219820Sjeff* RETURN VALUE 505219820Sjeff* This function does not return a value. 506219820Sjeff* 507219820Sjeff* NOTES 508219820Sjeff* cl_pool_put places the returned object at the head of the pool. 509219820Sjeff* 510219820Sjeff* The object specified by the p_object parameter must have been 511219820Sjeff* retrieved from the pool by a previous call to cl_pool_get. 512219820Sjeff* 513219820Sjeff* SEE ALSO 514219820Sjeff* Pool, cl_pool_put_tail, cl_pool_get 515219820Sjeff*********/ 516219820Sjeff 517219820Sjeff/****f* Component Library: Pool/cl_pool_grow 518219820Sjeff* NAME 519219820Sjeff* cl_pool_grow 520219820Sjeff* 521219820Sjeff* DESCRIPTION 522219820Sjeff* The cl_pool_grow function grows a pool by 523219820Sjeff* the specified number of objects. 524219820Sjeff* 525219820Sjeff* SYNOPSIS 526219820Sjeff*/ 527219820Sjeffstatic inline cl_status_t 528219820Sjeffcl_pool_grow(IN cl_pool_t * const p_pool, IN const size_t obj_count) 529219820Sjeff{ 530219820Sjeff CL_ASSERT(p_pool); 531219820Sjeff return (cl_qcpool_grow(&p_pool->qcpool, obj_count)); 532219820Sjeff} 533219820Sjeff 534219820Sjeff/* 535219820Sjeff* PARAMETERS 536219820Sjeff* p_pool 537219820Sjeff* [in] Pointer to a cl_pool_t structure whose capacity to grow. 538219820Sjeff* 539219820Sjeff* obj_count 540219820Sjeff* [in] Number of objects by which to grow the pool. 541219820Sjeff* 542219820Sjeff* RETURN VALUES 543219820Sjeff* CL_SUCCESS if the pool grew successfully. 544219820Sjeff* 545219820Sjeff* CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the 546219820Sjeff* pool. 547219820Sjeff* 548219820Sjeff* cl_status_t value returned by optional initialization callback function 549219820Sjeff* specified by the pfn_initializer parameter passed to the 550219820Sjeff* cl_pool_init function. 551219820Sjeff* 552219820Sjeff* NOTES 553219820Sjeff* It is not necessary to call cl_pool_grow if the pool is 554219820Sjeff* configured to grow automatically. 555219820Sjeff* 556219820Sjeff* SEE ALSO 557219820Sjeff* Pool 558219820Sjeff*********/ 559219820Sjeff 560219820SjeffEND_C_DECLS 561219820Sjeff#endif /* _CL_POOL_H_ */ 562