]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output-stats: remove ThreadExitPrintStats callback
authorJason Ish <jason.ish@oisf.net>
Fri, 30 Aug 2024 13:52:36 +0000 (07:52 -0600)
committerVictor Julien <victor@inliniac.net>
Sat, 31 Aug 2024 08:53:59 +0000 (10:53 +0200)
Not used.

Ticket: #7227

src/log-stats.c
src/output-json-stats.c
src/output-stats.c
src/output-stats.h
src/output.c
src/output.h
src/runmodes.c

index db07de8e0c717c550cc6208049d036a6aece90a8..76cb01cdbf3f17cb72779fde3443c6f827cfaaed 100644 (file)
@@ -284,7 +284,6 @@ static void LogStatsLogDeInitCtx(OutputCtx *output_ctx)
 
 void LogStatsLogRegister (void)
 {
-    OutputRegisterStatsModule(LOGGER_STATS, MODULE_NAME, "stats",
-        LogStatsLogInitCtx, LogStatsLogger, LogStatsLogThreadInit,
-        LogStatsLogThreadDeinit, NULL);
+    OutputRegisterStatsModule(LOGGER_STATS, MODULE_NAME, "stats", LogStatsLogInitCtx,
+            LogStatsLogger, LogStatsLogThreadInit, LogStatsLogThreadDeinit);
 }
index d7485d01f979f1c4406bd5cc25acdd328f348604..7b532d77ee9d521dc2587f25650862e8b609957b 100644 (file)
@@ -500,9 +500,9 @@ static OutputInitResult OutputStatsLogInitSub(ConfNode *conf, OutputCtx *parent_
 
 void JsonStatsLogRegister(void) {
     /* register as child of eve-log */
-    OutputRegisterStatsSubModule(LOGGER_JSON_STATS, "eve-log", MODULE_NAME,
-        "eve-log.stats", OutputStatsLogInitSub, JsonStatsLogger,
-        JsonStatsLogThreadInit, JsonStatsLogThreadDeinit, NULL);
+    OutputRegisterStatsSubModule(LOGGER_JSON_STATS, "eve-log", MODULE_NAME, "eve-log.stats",
+            OutputStatsLogInitSub, JsonStatsLogger, JsonStatsLogThreadInit,
+            JsonStatsLogThreadDeinit);
 }
 
 #ifdef UNITTESTS
index b59432bac4a23d51da4700b38f624ac68bd8950b..00fe3aaae7f2741cd3fb9a5e54c598e83538ab81 100644 (file)
@@ -44,15 +44,12 @@ typedef struct OutputStatsLogger_ {
     const char *name;
     ThreadInitFunc ThreadInit;
     ThreadDeinitFunc ThreadDeinit;
-    ThreadExitPrintStatsFunc ThreadExitPrintStats;
 } OutputStatsLogger;
 
 static OutputStatsLogger *list = NULL;
 
-int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc,
-    OutputCtx *output_ctx, ThreadInitFunc ThreadInit,
-    ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats)
+int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *output_ctx,
+        ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
 {
     OutputStatsLogger *op = SCCalloc(1, sizeof(*op));
     if (op == NULL)
@@ -63,7 +60,6 @@ int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc,
     op->name = name;
     op->ThreadInit = ThreadInit;
     op->ThreadDeinit = ThreadDeinit;
-    op->ThreadExitPrintStats = ThreadExitPrintStats;
 
     if (list == NULL)
         list = op;
@@ -170,27 +166,10 @@ static TmEcode OutputStatsLogThreadDeinit(ThreadVars *tv, void *thread_data)
     return TM_ECODE_OK;
 }
 
-static void OutputStatsLogExitPrintStats(ThreadVars *tv, void *thread_data)
-{
-    OutputStatsLoggerThreadData *op_thread_data = (OutputStatsLoggerThreadData *)thread_data;
-    OutputLoggerThreadStore *store = op_thread_data->store;
-    OutputStatsLogger *logger = list;
-
-    while (logger && store) {
-        if (logger->ThreadExitPrintStats) {
-            logger->ThreadExitPrintStats(tv, store->thread_data);
-        }
-
-        logger = logger->next;
-        store = store->next;
-    }
-}
-
 void TmModuleStatsLoggerRegister (void)
 {
     tmm_modules[TMM_STATSLOGGER].name = "__stats_logger__";
     tmm_modules[TMM_STATSLOGGER].ThreadInit = OutputStatsLogThreadInit;
-    tmm_modules[TMM_STATSLOGGER].ThreadExitPrintStats = OutputStatsLogExitPrintStats;
     tmm_modules[TMM_STATSLOGGER].ThreadDeinit = OutputStatsLogThreadDeinit;
     tmm_modules[TMM_STATSLOGGER].cap_flags = 0;
 }
index 56ad2cb78faf1cde5d2c6e0e5a58b8597719ebfd..7b18a6f0beed8b2fa7b80c87a7acf056113834c6 100644 (file)
@@ -49,9 +49,8 @@ TmEcode OutputStatsLog(ThreadVars *tv, void *thread_data, StatsTable *st);
 
 typedef int (*StatsLogger)(ThreadVars *, void *thread_data, const StatsTable *);
 
-int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc,
-    OutputCtx *, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats);
+int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *,
+        ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
 
 void TmModuleStatsLoggerRegister (void);
 
index 33e82d60a76efb1c40f2adf3a8bf1a8d9ee03640..3d1a9edd2d612e551ddcce14bae80280adbd502a 100644 (file)
@@ -539,10 +539,9 @@ error:
  *
  * \retval Returns 0 on success, -1 on failure.
  */
-void OutputRegisterStatsModule(LoggerId id, const char *name,
-    const char *conf_name, OutputInitFunc InitFunc, StatsLogger StatsLogFunc,
-    ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats)
+void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name,
+        OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
+        ThreadDeinitFunc ThreadDeinit)
 {
     if (unlikely(StatsLogFunc == NULL)) {
         goto error;
@@ -560,7 +559,6 @@ void OutputRegisterStatsModule(LoggerId id, const char *name,
     module->StatsLogFunc = StatsLogFunc;
     module->ThreadInit = ThreadInit;
     module->ThreadDeinit = ThreadDeinit;
-    module->ThreadExitPrintStats = ThreadExitPrintStats;
     TAILQ_INSERT_TAIL(&output_modules, module, entries);
 
     SCLogDebug("Stats logger \"%s\" registered.", name);
@@ -577,11 +575,9 @@ error:
  *
  * \retval Returns 0 on success, -1 on failure.
  */
-void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name,
-    const char *name, const char *conf_name, OutputInitSubFunc InitFunc,
-    StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
-    ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats)
+void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name,
+        const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc,
+        ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit)
 {
     if (unlikely(StatsLogFunc == NULL)) {
         goto error;
@@ -600,7 +596,6 @@ void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name,
     module->StatsLogFunc = StatsLogFunc;
     module->ThreadInit = ThreadInit;
     module->ThreadDeinit = ThreadDeinit;
-    module->ThreadExitPrintStats = ThreadExitPrintStats;
     TAILQ_INSERT_TAIL(&output_modules, module, entries);
 
     SCLogDebug("Stats logger \"%s\" registered.", name);
index d393ff41823b62789332212b9b314f49a4e3d20e..966b9a07c64d8b3965020223174606c3b8105a8a 100644 (file)
@@ -133,17 +133,12 @@ void OutputRegisterStreamingModule(LoggerId id, const char *name, const char *co
         enum OutputStreamingType stream_type, ThreadInitFunc ThreadInit,
         ThreadDeinitFunc ThreadDeinit);
 
-void OutputRegisterStatsModule(LoggerId id, const char *name,
-    const char *conf_name, OutputInitFunc InitFunc,
-    StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
-    ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats);
-void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name,
-    const char *name, const char *conf_name,
-    OutputInitSubFunc InitFunc,
-    StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
-    ThreadDeinitFunc ThreadDeinit,
-    ThreadExitPrintStatsFunc ThreadExitPrintStats);
+void OutputRegisterStatsModule(LoggerId id, const char *name, const char *conf_name,
+        OutputInitFunc InitFunc, StatsLogger StatsLogFunc, ThreadInitFunc ThreadInit,
+        ThreadDeinitFunc ThreadDeinit);
+void OutputRegisterStatsSubModule(LoggerId id, const char *parent_name, const char *name,
+        const char *conf_name, OutputInitSubFunc InitFunc, StatsLogger StatsLogFunc,
+        ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit);
 
 OutputModule *OutputGetModuleByConfName(const char *name);
 void OutputDeregisterAll(void);
index ae844fc08615a7602f3fb5456dfbf0b6d2f6c71e..9a2f20d5e81eb79d07b6b17eec0fa4c3ff8aabc8 100644 (file)
@@ -606,9 +606,8 @@ static void SetupOutput(
     }
     /* stats logger doesn't run in the packet path */
     if (module->StatsLogFunc) {
-        OutputRegisterStatsLogger(module->name, module->StatsLogFunc,
-            output_ctx,module->ThreadInit, module->ThreadDeinit,
-            module->ThreadExitPrintStats);
+        OutputRegisterStatsLogger(module->name, module->StatsLogFunc, output_ctx,
+                module->ThreadInit, module->ThreadDeinit);
         return;
     }