Lines Matching refs:pool

44 static void pool_destroy(KXLDArrayPool *pool, size_t capacity);
71 * out the array structure. This will cause a new pool of sufficient size
73 * pool.
104 * In either case, we need to set up a pool of the requested size, and
106 * pools into the new pool.
134 * zero or one pool. Calling this on an array with more than one pool is an
141 KXLDArrayPool *pool = NULL;
148 pool = STAILQ_FIRST(&array->pools);
149 if (pool) {
153 bzero(pool->buffer, array->pool_capacity);
157 pool = pool_create(array->pool_capacity);
158 require_action(pool, finish, rval=KERN_RESOURCE_SHORTAGE);
159 STAILQ_INSERT_HEAD(&array->pools, pool, entries);
161 pool->nitems = nitems;
178 KXLDArrayPool *pool = NULL, *rval = NULL;
180 pool = kxld_alloc(sizeof(*pool));
181 require(pool, finish);
183 pool->buffer = kxld_page_alloc(capacity);
184 require(pool->buffer, finish);
185 bzero(pool->buffer, capacity);
187 rval = pool;
188 pool = NULL;
191 if (pool) pool_destroy(pool, capacity);
198 pool_destroy(KXLDArrayPool *pool, size_t capacity)
200 if (pool) {
201 if (pool->buffer) kxld_page_free(pool->buffer, capacity);
202 kxld_free(pool, sizeof(*pool));
222 * pool. If the array has more than one pool or the array is too small,
237 /* Copy the data from the source pools to the single destination pool. */
254 KXLDArrayPool *pool = NULL;
257 STAILQ_FOREACH(pool, &array->pools, entries) {
258 pool->nitems = 0;
269 KXLDArrayPool *pool = NULL;
273 STAILQ_FOREACH(pool, &array->pools, entries) {
274 bzero(pool->buffer, array->pool_capacity);
284 KXLDArrayPool *pool = NULL, *tmp = NULL;
287 STAILQ_FOREACH_SAFE(pool, &array->pools, entries, tmp) {
288 STAILQ_REMOVE(&array->pools, pool, kxld_array_pool, entries);
289 pool_destroy(pool, array->pool_capacity);
300 KXLDArrayPool *pool = NULL;
307 STAILQ_FOREACH(pool, &array->pools, entries) {
308 if (idx < pool->nitems) {
309 item = (void *) (pool->buffer + (array->itemsize * idx));
325 KXLDArrayPool *pool = NULL;
332 STAILQ_FOREACH(pool, &array->pools, entries) {
334 item = (void *) (pool->buffer + (array->itemsize * idx));
351 KXLDArrayPool *pool = NULL;
363 STAILQ_FOREACH(pool, &array->pools, entries) {
364 if (pool->buffer <= it && it < pool->buffer + array->pool_capacity) {
365 diff = it - pool->buffer;
389 KXLDArrayPool *pool = NULL;
394 pool = pool_create(array->pool_capacity);
395 require_action(pool, finish, rval=KERN_FAILURE);
397 STAILQ_INSERT_TAIL(&array->pools, pool, entries);
412 * Sets the number of items for the array and each pool. Returns zero if there
419 KXLDArrayPool *pool = NULL;
422 /* Set the number of items for each pool */
425 STAILQ_FOREACH(pool, &array->pools, entries) {
427 pool->nitems = array->pool_maxitems;
430 pool->nitems = pool_nitems;
445 KXLDArrayPool *pool = NULL;
458 * single pool (for now).
463 pool = STAILQ_FIRST(&array->pools);
464 require_action(pool, finish, rval=KERN_FAILURE);
466 dst = pool->buffer;
469 src = pool->buffer;
472 nitems = pool->nitems - idx - 1;
475 --pool->nitems;
478 dst = pool->buffer;
479 dst += pool->nitems * array->itemsize;