porting/dpl_lib/src/dpl_mem.c
/**
 * Mallocs a block of memory and initializes an mbuf pool to use it.  The
 * specified block_size indicates the size of an mbuf acquired from the pool if
 * it contains a pkthdr.
 *
 * @param mempool               The mempool to initialize.
 * @param mbuf_pool             The mbuf pool to initialize.
 * @param num_blocks            The total number of mbufs in the pool.
 * @param block_size            The size of each mbuf.
 * @param name                  The name to give the mempool.
 * @param out_buf               On success, this points to the malloced memory.
 *                                  Pass NULL if you don't need this
 *                                  information.
 *
 * @return                      0 on success;
 *                              DPL_ENOMEM on malloc failure;
 *                              Other OS code on unexpected error.
 */
Mallocs a block of memory and initializes an mbuf pool to use it.  The
specified block_size indicates the size of an mbuf acquired from the pool if
it contains a pkthdr.

@param mempool               The mempool to initialize.
@param mbuf_pool             The mbuf pool to initialize.
@param num_blocks            The total number of mbufs in the pool.
@param block_size            The size of each mbuf.
@param name                  The name to give the mempool.
@param out_buf               On success, this points to the malloced memory.
Pass NULL if you don't need this
information.

@return                      0 on success;
DPL_ENOMEM on malloc failure;
Other OS code on unexpected error.
Mallocs a block of memory and initializes an mbuf pool to use it . The specified block_size indicates the size of an mbuf acquired from the pool if it contains a pkthdr . @param mempool The mempool to initialize . @param mbuf_pool The mbuf pool to initialize . @param num_blocks The total number of mbufs in the pool . @param block_size The size of each mbuf . @param name The name to give the mempool . @param out_buf On success this points to the malloced memory . Pass NULL if you don ' t need this information . @return 0 on success ; DPL_ENOMEM on malloc failure ; Other OS code on unexpected error .
int
mem_malloc_mbufpkt_pool(struct dpl_mempool *mempool,
                        struct dpl_mbuf_pool *mbuf_pool, int num_blocks,
                        int block_size, char *name,
                        void **out_buf)
{
    int rc;
    rc = mem_malloc_mbuf_pool(mempool, mbuf_pool, num_blocks,
                              block_size + sizeof (struct dpl_mbuf_pkthdr),
                              name, out_buf);
    return rc;
}
int mem_malloc_mbufpkt_pool ( struct dpl_mempool * mempool , struct dpl_mbuf_pool * mbuf_pool , int num_blocks , int block_size , char * name , void * * out_buf ) { int rc ; rc = mem_malloc_mbuf_pool ( mempool , mbuf_pool , num_blocks , block_size + sizeof ( struct dpl_mbuf_pkthdr ) , name , out_buf ) ; return rc ; }
Mallocs a block of memory and initializes an mbuf pool to use it.
Mallocs a block of memory and initializes an mbuf pool to use it .