]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
daemon/utils_cache: remove unused functions and function args
authorEero Tamminen <eero.t.tamminen@intel.com>
Tue, 16 Jan 2024 12:57:05 +0000 (14:57 +0200)
committerEero Tamminen <eero.t.tamminen@intel.com>
Tue, 16 Jan 2024 19:16:48 +0000 (21:16 +0200)
Arg update required touching also threshold.c & write_riemann plugin.

Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/daemon/utils_cache.c
src/daemon/utils_cache.h
src/threshold.c
src/write_riemann_threshold.c

index cf2095eec12fb0190ce30e187173ea6d7490d433..03d25605ef7953ce5ee98e4e6a0754fb759fccf0 100644 (file)
@@ -670,7 +670,7 @@ int uc_get_names(char ***ret_names, cdtime_t **ret_times, size_t *ret_number) {
   return 0;
 } /* int uc_get_names */
 
-int uc_get_state(const data_set_t *ds, const value_list_t *vl) {
+int uc_get_state(const value_list_t *vl) {
   char name[6 * DATA_MAX_NAME_LEN];
   cache_entry_t *ce = NULL;
   int ret = STATE_ERROR;
@@ -692,7 +692,7 @@ int uc_get_state(const data_set_t *ds, const value_list_t *vl) {
   return ret;
 } /* int uc_get_state */
 
-int uc_set_state(const data_set_t *ds, const value_list_t *vl, int state) {
+int uc_set_state(const value_list_t *vl, int state) {
   char name[6 * DATA_MAX_NAME_LEN];
   cache_entry_t *ce = NULL;
   int ret = -1;
@@ -775,19 +775,7 @@ int uc_get_history_by_name(const char *name, gauge_t *ret_history,
   return 0;
 } /* int uc_get_history_by_name */
 
-int uc_get_history(const data_set_t *ds, const value_list_t *vl,
-                   gauge_t *ret_history, size_t num_steps, size_t num_ds) {
-  char name[6 * DATA_MAX_NAME_LEN];
-
-  if (FORMAT_VL(name, sizeof(name), vl) != 0) {
-    ERROR("utils_cache: uc_get_history: FORMAT_VL failed.");
-    return -1;
-  }
-
-  return uc_get_history_by_name(name, ret_history, num_steps, num_ds);
-} /* int uc_get_history */
-
-int uc_get_hits(const data_set_t *ds, const value_list_t *vl) {
+int uc_get_hits(const value_list_t *vl) {
   char name[6 * DATA_MAX_NAME_LEN];
   cache_entry_t *ce = NULL;
   int ret = STATE_ERROR;
@@ -809,7 +797,7 @@ int uc_get_hits(const data_set_t *ds, const value_list_t *vl) {
   return ret;
 } /* int uc_get_hits */
 
-int uc_set_hits(const data_set_t *ds, const value_list_t *vl, int hits) {
+int uc_set_hits(const value_list_t *vl, int hits) {
   char name[6 * DATA_MAX_NAME_LEN];
   cache_entry_t *ce = NULL;
   int ret = -1;
@@ -832,7 +820,7 @@ int uc_set_hits(const data_set_t *ds, const value_list_t *vl, int hits) {
   return ret;
 } /* int uc_set_hits */
 
-int uc_inc_hits(const data_set_t *ds, const value_list_t *vl, int step) {
+int uc_inc_hits(const value_list_t *vl, int step) {
   char name[6 * DATA_MAX_NAME_LEN];
   cache_entry_t *ce = NULL;
   int ret = -1;
index 9050477fc1efb11b27f0128ec1f98c6b79debdc6..880f3b18b9b12eaea57543847446821664e9dc58 100644 (file)
@@ -50,16 +50,14 @@ value_t *uc_get_value(const data_set_t *ds, const value_list_t *vl);
 size_t uc_get_size(void);
 int uc_get_names(char ***ret_names, cdtime_t **ret_times, size_t *ret_number);
 
-int uc_get_state(const data_set_t *ds, const value_list_t *vl);
-int uc_set_state(const data_set_t *ds, const value_list_t *vl, int state);
-int uc_get_hits(const data_set_t *ds, const value_list_t *vl);
-int uc_set_hits(const data_set_t *ds, const value_list_t *vl, int hits);
-int uc_inc_hits(const data_set_t *ds, const value_list_t *vl, int step);
+int uc_get_state(const value_list_t *vl);
+int uc_set_state(const value_list_t *vl, int state);
+int uc_get_hits(const value_list_t *vl);
+int uc_set_hits(const value_list_t *vl, int hits);
+int uc_inc_hits(const value_list_t *vl, int step);
 
 int uc_set_callbacks_mask(const char *name, unsigned long callbacks_mask);
 
-int uc_get_history(const data_set_t *ds, const value_list_t *vl,
-                   gauge_t *ret_history, size_t num_steps, size_t num_ds);
 int uc_get_history_by_name(const char *name, gauge_t *ret_history,
                            size_t num_steps, size_t num_ds);
 
index e74dfc2ca2587001642f3cc13ca5b2bdb856eba5..c0d3ac041e01a9aafaea9aadf17a683b6dcb92bf 100644 (file)
@@ -289,22 +289,22 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
 
   /* Check if hits matched */
   if ((th->hits != 0)) {
-    int hits = uc_get_hits(ds, vl);
+    int hits = uc_get_hits(vl);
     /* STATE_OKAY resets hits unless PERSIST_OK flag is set. Hits resets if
      * threshold is hit. */
     if (((state == STATE_OKAY) && ((th->flags & UT_FLAG_PERSIST_OK) == 0)) ||
         (hits > th->hits)) {
       DEBUG("ut_report_state: reset uc_get_hits = 0");
-      uc_set_hits(ds, vl, 0); /* reset hit counter and notify */
+      uc_set_hits(vl, 0); /* reset hit counter and notify */
     } else {
       DEBUG("ut_report_state: th->hits = %d, uc_get_hits = %d", th->hits,
-            uc_get_hits(ds, vl));
-      (void)uc_inc_hits(ds, vl, 1); /* increase hit counter */
+            uc_get_hits(vl));
+      (void)uc_inc_hits(vl, 1); /* increase hit counter */
       return 0;
     }
   } /* end check hits */
 
-  state_old = uc_get_state(ds, vl);
+  state_old = uc_get_state(vl);
 
   /* If the state didn't change, report if `persistent' is specified. If the
    * state is `okay', then only report if `persist_ok` flag is set. */
@@ -319,7 +319,7 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
   }
 
   if (state != state_old)
-    uc_set_state(ds, vl, state);
+    uc_set_state(vl, state);
 
   NOTIFICATION_INIT_VL(&n, vl);
 
@@ -476,7 +476,7 @@ static int ut_check_one_data_source(
   /* XXX: This is an experimental code, not optimized, not fast, not reliable,
    * and probably, do not work as you expect. Enjoy! :D */
   if (th->hysteresis > 0) {
-    prev_state = uc_get_state(ds, vl);
+    prev_state = uc_get_state(vl);
     /* The purpose of hysteresis is elliminating flapping state when the value
      * oscilates around the thresholds. In other words, what is important is
      * the previous state; if the new value would trigger a transition, make
index 041ed7d5ad7de462300179ab22a6a24498a77ae8..9968c44518e76e1e37fd36ede04df83f4f56a844 100644 (file)
@@ -73,7 +73,7 @@ static int ut_check_one_data_source(
 
   /* XXX: This is an experimental code, not optimized, not fast, not reliable,
    * and probably, do not work as you expect. Enjoy! :D */
-  prev_state = uc_get_state(ds, vl);
+  prev_state = uc_get_state(vl);
   if ((th->hysteresis > 0) && (prev_state != STATE_OKAY) &&
       (prev_state != STATE_UNKNOWN)) {
     switch (prev_state) {