pool/thread: remove unused InitData argument

Only used in unittests, not by production code.
pull/15429/head
Victor Julien 4 months ago
parent d0ad6ddf19
commit af6ec14688

@ -569,7 +569,7 @@ TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv)
segment_thread_pool = PoolThreadInit(1, /* thread */
0, /* unlimited */
stream_config.prealloc_segments, sizeof(TcpSegment), TcpSegmentPoolAlloc,
TcpSegmentPoolInit, NULL, TcpSegmentPoolCleanup);
TcpSegmentPoolInit, TcpSegmentPoolCleanup);
ra_ctx->segment_thread_pool_id = 0;
SCLogDebug("pool size %d, thread segment_thread_pool_id %d",
PoolThreadSize(segment_thread_pool),

@ -856,7 +856,7 @@ void StreamTcpInitConfig(bool quiet)
ssn_pool = PoolThreadInit(1, /* thread */
0, /* unlimited */
stream_config.prealloc_sessions, sizeof(TcpSession), StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL, StreamTcpSessionPoolCleanup);
StreamTcpSessionPoolInit, StreamTcpSessionPoolCleanup);
}
SCMutexUnlock(&ssn_pool_mutex);
}
@ -6221,7 +6221,7 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
ssn_pool = PoolThreadInit(1, /* thread */
0, /* unlimited */
stream_config.prealloc_sessions, sizeof(TcpSession), StreamTcpSessionPoolAlloc,
StreamTcpSessionPoolInit, NULL, StreamTcpSessionPoolCleanup);
StreamTcpSessionPoolInit, StreamTcpSessionPoolCleanup);
stt->ssn_pool_id = 0;
SCLogDebug("pool size %d, thread ssn_pool_id %d", PoolThreadSize(ssn_pool), stt->ssn_pool_id);
} else {

@ -42,7 +42,7 @@
* Other params are as for PoolInit()
*/
PoolThread *PoolThreadInit(int threads, uint32_t size, uint32_t prealloc_size, uint32_t elt_size,
void *(*Alloc)(void), int (*Init)(void *, void *), void *InitData, void (*Cleanup)(void *))
void *(*Alloc)(void), int (*Init)(void *, void *), void (*Cleanup)(void *))
{
sc_errno = SC_OK;
@ -76,7 +76,7 @@ PoolThread *PoolThreadInit(int threads, uint32_t size, uint32_t prealloc_size, u
// SCLogDebug("size %u prealloc_size %u elt_size %u Alloc %p Init %p InitData %p Cleanup %p Free %p",
// size, prealloc_size, elt_size,
// Alloc, Init, InitData, Cleanup, Free);
e->pool = PoolInit(size, prealloc_size, elt_size, Alloc, Init, InitData, Cleanup);
e->pool = PoolInit(size, prealloc_size, elt_size, Alloc, Init, NULL, Cleanup);
SCMutexUnlock(&e->lock);
if (e->pool == NULL) {
SCLogDebug("error");
@ -241,9 +241,7 @@ int PoolThreadTestInit(void *data, void *allocdata)
if (!data)
return 0;
memset(data,0x00,sizeof(allocdata));
struct PoolThreadTestData *pdata = data;
pdata->abc = *(int *)allocdata;
memset(data, 0x00, sizeof(allocdata));
return 1;
}
@ -255,7 +253,7 @@ void PoolThreadTestFree(void *data)
static int PoolThreadTestInit01(void)
{
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, NULL, NULL, NULL);
10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
FAIL_IF(pt == NULL);
PoolThreadFree(pt);
PASS;
@ -263,10 +261,8 @@ static int PoolThreadTestInit01(void)
static int PoolThreadTestInit02(void)
{
int i = 123;
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, &i, PoolThreadTestFree);
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, PoolThreadTestFree);
FAIL_IF(pt == NULL);
PoolThreadFree(pt);
PASS;
@ -275,7 +271,7 @@ static int PoolThreadTestInit02(void)
static int PoolThreadTestGet01(void)
{
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, NULL, NULL, NULL);
10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
FAIL_IF(pt == NULL);
void *data = PoolThreadGetById(pt, 3);
@ -290,10 +286,8 @@ static int PoolThreadTestGet01(void)
static int PoolThreadTestGet02(void)
{
int i = 123;
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, &i, PoolThreadTestFree);
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, PoolThreadTestFree);
FAIL_IF_NULL(pt);
void *data = PoolThreadGetById(pt, 3);
@ -302,18 +296,14 @@ static int PoolThreadTestGet02(void)
struct PoolThreadTestData *pdata = data;
FAIL_IF_NOT (pdata->res == 3);
FAIL_IF_NOT (pdata->abc == 123);
PoolThreadFree(pt);
PASS;
}
static int PoolThreadTestReturn01(void)
{
int i = 123;
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, &i, PoolThreadTestFree);
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, PoolThreadTestFree);
FAIL_IF_NULL(pt);
void *data = PoolThreadGetById(pt, 3);
@ -322,8 +312,6 @@ static int PoolThreadTestReturn01(void)
struct PoolThreadTestData *pdata = data;
FAIL_IF_NOT (pdata->res == 3);
FAIL_IF_NOT (pdata->abc == 123);
FAIL_IF_NOT (pt->array[3].pool->outstanding == 1);
PoolThreadReturn(pt, data);
@ -337,7 +325,7 @@ static int PoolThreadTestReturn01(void)
static int PoolThreadTestGrow01(void)
{
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, NULL, NULL, NULL);
10, 5, 10, PoolThreadTestAlloc, NULL, NULL);
FAIL_IF_NULL(pt);
FAIL_IF(PoolThreadExpand(pt) < 0);
@ -347,10 +335,8 @@ static int PoolThreadTestGrow01(void)
static int PoolThreadTestGrow02(void)
{
int i = 123;
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, &i, PoolThreadTestFree);
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, PoolThreadTestFree);
FAIL_IF_NULL(pt);
FAIL_IF(PoolThreadExpand(pt) < 0);
@ -360,10 +346,8 @@ static int PoolThreadTestGrow02(void)
static int PoolThreadTestGrow03(void)
{
int i = 123;
PoolThread *pt = PoolThreadInit(4, /* threads */
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, &i, PoolThreadTestFree);
10, 5, 10, PoolThreadTestAlloc, PoolThreadTestInit, PoolThreadTestFree);
FAIL_IF_NULL(pt);
FAIL_IF(PoolThreadExpand(pt) < 0);
@ -373,8 +357,6 @@ static int PoolThreadTestGrow03(void)
struct PoolThreadTestData *pdata = data;
FAIL_IF_NOT(pdata->res == 4);
FAIL_IF_NOT(pdata->abc == 123);
FAIL_IF_NOT(pt->array[4].pool->outstanding == 1);
PoolThreadReturn(pt, data);

@ -66,7 +66,7 @@ void PoolThreadRegisterTests(void);
* \param threads number of threads to use this
* \retval pt thread pool or NULL on error */
PoolThread *PoolThreadInit(int threads, uint32_t size, uint32_t prealloc_size, uint32_t elt_size,
void *(*Alloc)(void), int (*Init)(void *, void *), void *InitData, void (*Cleanup)(void *));
void *(*Alloc)(void), int (*Init)(void *, void *), void (*Cleanup)(void *));
/** \brief grow a thread pool by one
* \note copies settings from initial PoolThreadInit() call

Loading…
Cancel
Save