Lines Matching refs:pool
112 LLLINK(smm_buffer) pool;
132 static void free_pool(struct smm_pool * pool);
284 struct smm_pool * pool = mbuf->props.pool; in smm_map() local
285 void * map = pool->map; in smm_map()
287 if(pool->map_outdated) { in smm_map()
289 if(pool->map != NULL) { in smm_map()
290 munmap(pool->map, pool->map_size); in smm_map()
294 pool->props.size, in smm_map()
297 pool->props.fd, in smm_map()
302 pool->map = NULL; in smm_map()
305 pool->map = map; in smm_map()
306 pool->map_size = pool->props.size; in smm_map()
307 pool->map_outdated = false; in smm_map()
393 struct smm_pool * buf_pool = buf->props.pool; in calc_buffer_size()
399 buf_sz = (LL_NEXT(buf, pool)->props.offset - buf->props.offset); in calc_buffer_size()
426 LL_FOREACH(buf, &smm_instance.active->allocd, pool) { in get_from_pool()
435 (LL_NEXT(buf, pool)->props.group == NULL)) { in get_from_pool()
437 LL_NEXT(buf, pool)->props.offset -= (buf_sz - grp->size); in get_from_pool()
533 struct smm_pool * pool = buf->props.pool; in return_to_pool() local
549 if(smm_instance.active == pool) { in return_to_pool()
554 if((buf != LL_LAST(&pool->allocd)) && in return_to_pool()
555 (LL_NEXT(buf, pool)->props.group == NULL)) { in return_to_pool()
556 free_buffer(LL_NEXT(buf, pool)); in return_to_pool()
558 if((buf != LL_FIRST(&pool->allocd)) && in return_to_pool()
559 (LL_PREV(buf, pool)->props.group == NULL)) { in return_to_pool()
560 buf = LL_PREV(buf, pool); in return_to_pool()
561 pool = buf->props.pool; in return_to_pool()
562 free_buffer(LL_NEXT(buf, pool)); in return_to_pool()
566 if((buf == LL_FIRST(&pool->allocd)) && in return_to_pool()
567 (buf == LL_LAST(&pool->allocd))) { in return_to_pool()
572 smm_instance.cbs.free_pool(smm_instance.cbs.ctx, &pool->props); in return_to_pool()
575 free_pool(pool); in return_to_pool()
576 if(smm_instance.active == pool) { in return_to_pool()
585 struct smm_pool * pool; in alloc_pool() local
590 pool = malloc(sizeof(struct smm_pool)); in alloc_pool()
591 if(pool != NULL) { in alloc_pool()
595 pool->props.fd = shm_open(name, in alloc_pool()
598 if(pool->props.fd >= 0) { in alloc_pool()
600 pool->props.size = 0; in alloc_pool()
601 pool->map = NULL; in alloc_pool()
602 pool->map_size = 0; in alloc_pool()
603 pool->map_outdated = false; in alloc_pool()
604 LL_INIT(&pool->allocd); in alloc_pool()
617 free(pool); in alloc_pool()
618 pool = NULL; in alloc_pool()
622 return pool; in alloc_pool()
626 void free_pool(struct smm_pool * pool) in free_pool() argument
628 if(pool->map != NULL) { in free_pool()
629 munmap(pool->map, pool->map_size); in free_pool()
632 close(pool->props.fd); in free_pool()
633 free(pool); in free_pool()
654 LL_ENQUEUE(&smm_instance.active->allocd, buf, pool); in alloc_buffer()
657 LL_INSERT_AFTER(&smm_instance.active->allocd, last, buf, pool); in alloc_buffer()
667 struct smm_pool * buf_pool = buf->props.pool; in free_buffer()
670 LL_REMOVE(&buf_pool->allocd, buf, pool); in free_buffer()