Run all changed files 68 8.c/1*.h through format.sh web util
authorZebity Spring <zebity@yahoo.com>
Thu, 16 May 2019 15:59:58 +0000 (01:59 +1000)
committerMatthias Runge <mrunge@redhat.com>
Fri, 19 Jul 2019 10:43:18 +0000 (12:43 +0200)
(cherry picked from commit 27ca3ca92a757b5c9bb3baa5a29ef352ec70b1c9)

37 files changed:
src/aggregation.c
src/amqp.c
src/amqp1.c
src/collectdctl.c
src/daemon/configfile.c
src/disk.c
src/gmond.c
src/intel_pmu.c
src/intel_rdt.c
src/interface.c
src/lua.c
src/modbus.c
src/mysql.c
src/netapp.c
src/netlink.c
src/notify_desktop.c
src/openldap.c
src/ovs_stats.c
src/perl.c
src/protocols.c
src/python.c
src/redis.c
src/routeros.c
src/rrdcached.c
src/snmp.c
src/snmp_agent.c
src/threshold.c
src/utils/cmds/cmds_test.c
src/utils/common/common.c
src/utils/dpdk/dpdk.c
src/utils/oauth/oauth.c
src/utils/ovs/ovs.c
src/varnish.c
src/virt.c
src/write_kafka.c
src/write_prometheus.c
src/write_redis.c

index 2c8ef88..7a214ca 100644 (file)
@@ -398,9 +398,10 @@ static int agg_instance_read(agg_instance_t *inst, cdtime_t t) /* {{{ */
     READ_FUNC(average, (inst->sum / ((gauge_t)inst->num)));
     READ_FUNC(min, inst->min);
     READ_FUNC(max, inst->max);
-    READ_FUNC(stddev, sqrt((((gauge_t)inst->num) * inst->squares_sum) -
-                           (inst->sum * inst->sum)) /
-                          ((gauge_t)inst->num));
+    READ_FUNC(stddev,
+              sqrt((((gauge_t)inst->num) * inst->squares_sum) -
+                   (inst->sum * inst->sum)) /
+                  ((gauge_t)inst->num));
   }
 
   /* Reset internal state. */
index 2077d57..4bdb66c 100644 (file)
@@ -973,11 +973,11 @@ static int camqp_config_connection(oconfig_item_t *ci, /* {{{ */
     char cbname[128];
     ssnprintf(cbname, sizeof(cbname), "amqp/%s", conf->name);
 
-    status = plugin_register_write(cbname, camqp_write,
-                                   &(user_data_t){
-                                       .data = conf,
-                                       .free_func = camqp_config_free,
-                                   });
+    status =
+        plugin_register_write(cbname, camqp_write,
+                              &(user_data_t){
+                                  .data = conf, .free_func = camqp_config_free,
+                              });
     if (status != 0) {
       camqp_config_free(conf);
       return status;
index 67c96b7..601f0ae 100644 (file)
@@ -639,16 +639,14 @@ static int amqp1_config_instance(oconfig_item_t *ci) /* {{{ */
       status = plugin_register_notification(
           tpname, amqp1_notify,
           &(user_data_t){
-              .data = instance,
-              .free_func = amqp1_config_instance_free,
+              .data = instance, .free_func = amqp1_config_instance_free,
           });
     } else {
-      status =
-          plugin_register_write(tpname, amqp1_write,
-                                &(user_data_t){
-                                    .data = instance,
-                                    .free_func = amqp1_config_instance_free,
-                                });
+      status = plugin_register_write(
+          tpname, amqp1_write,
+          &(user_data_t){
+              .data = instance, .free_func = amqp1_config_instance_free,
+          });
     }
 
     if (status != 0) {
index df83b50..1ced583 100644 (file)
@@ -293,9 +293,8 @@ static int flush(lcc_connection_t *c, int argc, char **argv) {
                 value);
         BAIL_OUT(-1);
       } else if ((endptr != NULL) && (*endptr != '\0')) {
-        fprintf(stderr,
-                "WARNING: Ignoring trailing garbage after timeout: "
-                "%s.\n",
+        fprintf(stderr, "WARNING: Ignoring trailing garbage after timeout: "
+                        "%s.\n",
                 endptr);
       }
     } else if (strcasecmp(key, "plugin") == 0) {
@@ -342,9 +341,8 @@ static int flush(lcc_connection_t *c, int argc, char **argv) {
           char id[1024];
 
           lcc_identifier_to_string(c, id, sizeof(id), identifiers + j);
-          fprintf(stderr,
-                  "ERROR: Failed to flush plugin `%s', "
-                  "identifier `%s': %s.\n",
+          fprintf(stderr, "ERROR: Failed to flush plugin `%s', "
+                          "identifier `%s': %s.\n",
                   (plugins[i] == NULL) ? "(all)" : plugins[i], id,
                   lcc_strerror(c));
         }
@@ -388,9 +386,8 @@ static int listval(lcc_connection_t *c, int argc, char **argv) {
 
     status = lcc_identifier_to_string(c, id, sizeof(id), ret_ident + i);
     if (status != 0) {
-      fprintf(stderr,
-              "ERROR: listval: Failed to convert returned "
-              "identifier to a string: %s\n",
+      fprintf(stderr, "ERROR: listval: Failed to convert returned "
+                      "identifier to a string: %s\n",
               lcc_strerror(c));
       continue;
     }
@@ -448,9 +445,8 @@ static int putval(lcc_connection_t *c, int argc, char **argv) {
                   value);
           return -1;
         } else if ((endptr != NULL) && (*endptr != '\0')) {
-          fprintf(stderr,
-                  "WARNING: Ignoring trailing garbage after "
-                  "interval: %s.\n",
+          fprintf(stderr, "WARNING: Ignoring trailing garbage after "
+                          "interval: %s.\n",
                   endptr);
         }
       } else {
index 1a3c4f4..e760fda 100644 (file)
@@ -267,8 +267,7 @@ static int dispatch_loadplugin(oconfig_item_t *ci) {
 
   /* default to the global interval set before loading this plugin */
   plugin_ctx_t ctx = {
-      .interval = cf_get_default_interval(),
-      .name = strdup(name),
+      .interval = cf_get_default_interval(), .name = strdup(name),
   };
   if (ctx.name == NULL)
     return ENOMEM;
@@ -480,9 +479,9 @@ static int cf_ci_replace_child(oconfig_item_t *dst, oconfig_item_t *src,
     return 0;
   }
 
-  temp =
-      realloc(dst->children, sizeof(oconfig_item_t) *
-                                 (dst->children_num + src->children_num - 1));
+  temp = realloc(dst->children,
+                 sizeof(oconfig_item_t) *
+                     (dst->children_num + src->children_num - 1));
   if (temp == NULL) {
     ERROR("configfile: realloc failed.");
     return -1;
@@ -521,8 +520,9 @@ static int cf_ci_append_children(oconfig_item_t *dst, oconfig_item_t *src) {
   if ((src == NULL) || (src->children_num == 0))
     return 0;
 
-  temp = realloc(dst->children, sizeof(oconfig_item_t) *
-                                    (dst->children_num + src->children_num));
+  temp =
+      realloc(dst->children,
+              sizeof(oconfig_item_t) * (dst->children_num + src->children_num));
   if (temp == NULL) {
     ERROR("configfile: realloc failed.");
     return -1;
index ddfaaf9..ac9b79d 100644 (file)
@@ -206,7 +206,7 @@ static int disk_init(void) {
     io_master_port = MACH_PORT_NULL;
     return -1;
   }
-  /* #endif HAVE_IOKIT_IOKITLIB_H */
+/* #endif HAVE_IOKIT_IOKITLIB_H */
 
 #elif KERNEL_LINUX
 #if HAVE_LIBUDEV_H
@@ -218,7 +218,7 @@ static int disk_init(void) {
     }
   }
 #endif /* HAVE_LIBUDEV_H */
-  /* #endif KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
 
 #elif KERNEL_FREEBSD
   int rv;
@@ -233,7 +233,7 @@ static int disk_init(void) {
     ERROR("geom_stats_open() failed, returned %d", rv);
     return -1;
   }
-  /* #endif KERNEL_FREEBSD */
+/* #endif KERNEL_FREEBSD */
 
 #elif HAVE_LIBKSTAT
   kstat_t *ksp_chain;
@@ -272,8 +272,7 @@ static void disk_submit(const char *plugin_instance, const char *type,
                         derive_t read, derive_t write) {
   value_list_t vl = VALUE_LIST_INIT;
   value_t values[] = {
-      {.derive = read},
-      {.derive = write},
+      {.derive = read}, {.derive = write},
   };
 
   vl.values = values;
@@ -290,8 +289,7 @@ static void submit_io_time(char const *plugin_instance, derive_t io_time,
                            derive_t weighted_time) {
   value_list_t vl = VALUE_LIST_INIT;
   value_t values[] = {
-      {.derive = io_time},
-      {.derive = weighted_time},
+      {.derive = io_time}, {.derive = weighted_time},
   };
 
   vl.values = values;
@@ -532,7 +530,7 @@ static int disk_read(void) {
       disk_submit(disk_name, "disk_time", read_tme / 1000, write_tme / 1000);
   }
   IOObjectRelease(disk_list);
-  /* #endif HAVE_IOKIT_IOKITLIB_H */
+/* #endif HAVE_IOKIT_IOKITLIB_H */
 
 #elif KERNEL_FREEBSD
   int retry, dirty;
@@ -896,7 +894,7 @@ static int disk_read(void) {
     free(missing_ds);
   }
   fclose(fh);
-  /* #endif defined(KERNEL_LINUX) */
+/* #endif defined(KERNEL_LINUX) */
 
 #elif HAVE_LIBKSTAT
 #if HAVE_KSTAT_IO_T_WRITES && HAVE_KSTAT_IO_T_NWRITES && HAVE_KSTAT_IO_T_WTIME
@@ -944,7 +942,7 @@ static int disk_read(void) {
       disk_submit(ksp[i]->ks_name, "disk_ops", kio.KIO_ROPS, kio.KIO_WOPS);
     }
   }
-  /* #endif defined(HAVE_LIBKSTAT) */
+/* #endif defined(HAVE_LIBKSTAT) */
 
 #elif defined(HAVE_LIBSTATGRAB)
   sg_disk_io_stats *ds;
@@ -971,7 +969,7 @@ static int disk_read(void) {
     disk_submit(name, "disk_octets", ds->read_bytes, ds->write_bytes);
     ds++;
   }
-  /* #endif defined(HAVE_LIBSTATGRAB) */
+/* #endif defined(HAVE_LIBSTATGRAB) */
 
 #elif defined(HAVE_PERFSTAT)
   derive_t read_sectors;
index 1aaf86d..03dedcc 100644 (file)
@@ -659,9 +659,7 @@ static int mc_handle_metadata_msg(Ganglia_metadata_msg *msg) /* {{{ */
     break;
   }
 
-  default: {
-    return -1;
-  }
+  default: { return -1; }
   }
 
   return 0;
index 350c1e3..f04f887 100644 (file)
@@ -26,8 +26,8 @@
  *   Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
  **/
 
-#include "utils/common/common.h"
 #include "collectd.h"
+#include "utils/common/common.h"
 
 #include "utils/config_cores/config_cores.h"
 
index 38f987f..743c8bc 100644 (file)
  *   MichaÅ‚ AleksiÅ„ski <michalx.aleksinski@intel.com>
  **/
 
-#include <pqos.h>
+#include "collectd.h"
 #include "utils/common/common.h"
 #include "utils/config_cores/config_cores.h"
 #include "utils/proc_pids/proc_pids.h"
-#include "collectd.h"
+#include <pqos.h>
 
 #define RDT_PLUGIN "intel_rdt"
 
@@ -851,9 +851,9 @@ static void rdt_init_pids_monitoring() {
     }
 
     /* update global proc_pids table */
-    proc_pids_t **proc_pids =
-        realloc(g_rdt->proc_pids, (g_rdt->num_proc_pids + ng->num_names) *
-                                      sizeof(*g_rdt->proc_pids));
+    proc_pids_t **proc_pids = realloc(g_rdt->proc_pids,
+                                      (g_rdt->num_proc_pids + ng->num_names) *
+                                          sizeof(*g_rdt->proc_pids));
     if (NULL == proc_pids) {
       ERROR(RDT_PLUGIN ": Alloc error\n");
       continue;
index a18bcb4..5367ced 100644 (file)
@@ -82,9 +82,7 @@ static int pnif;
  * (Module-)Global variables
  */
 static const char *config_keys[] = {
-    "Interface",
-    "IgnoreSelected",
-    "ReportInactive",
+    "Interface", "IgnoreSelected", "ReportInactive",
 };
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
@@ -162,8 +160,7 @@ static void if_submit(const char *dev, const char *type, derive_t rx,
                       derive_t tx) {
   value_list_t vl = VALUE_LIST_INIT;
   value_t values[] = {
-      {.derive = rx},
-      {.derive = tx},
+      {.derive = rx}, {.derive = tx},
   };
 
   if (ignorelist_match(ignorelist, dev) != 0)
@@ -191,7 +188,7 @@ static int interface_read(void) {
 #define IFA_TX_PACKT ifi_opackets
 #define IFA_RX_ERROR ifi_ierrors
 #define IFA_TX_ERROR ifi_oerrors
-  /* #endif HAVE_STRUCT_IF_DATA */
+/* #endif HAVE_STRUCT_IF_DATA */
 
 #elif HAVE_STRUCT_NET_DEVICE_STATS
 #define IFA_DATA net_device_stats
@@ -229,7 +226,7 @@ static int interface_read(void) {
   }
 
   freeifaddrs(if_list);
-  /* #endif HAVE_GETIFADDRS */
+/* #endif HAVE_GETIFADDRS */
 
 #elif KERNEL_LINUX
   FILE *fh;
@@ -285,7 +282,7 @@ static int interface_read(void) {
   }
 
   fclose(fh);
-  /* #endif KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
 
 #elif HAVE_LIBKSTAT
   derive_t rx;
@@ -335,7 +332,7 @@ static int interface_read(void) {
     if ((rx != -1LL) || (tx != -1LL))
       if_submit(iname, "if_errors", rx, tx);
   }
-  /* #endif HAVE_LIBKSTAT */
+/* #endif HAVE_LIBKSTAT */
 
 #elif defined(HAVE_LIBSTATGRAB)
   sg_network_io_stats *ios;
@@ -348,7 +345,7 @@ static int interface_read(void) {
       continue;
     if_submit(ios[i].interface_name, "if_octets", ios[i].rx, ios[i].tx);
   }
-  /* #endif HAVE_LIBSTATGRAB */
+/* #endif HAVE_LIBSTATGRAB */
 
 #elif defined(HAVE_PERFSTAT)
   perfstat_id_t id;
index a87f3ea..9a43fc7 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
  *   Ruben Kerkhof <ruben at rubenkerkhof.com>
  **/
 
+#include "collectd.h"
 #include "plugin.h"
 #include "utils/common/common.h"
 #include "utils_lua.h"
-#include "collectd.h"
 
 /* Include the Lua API header files. */
 #include <lauxlib.h>
@@ -322,14 +322,14 @@ static int lua_cb_register_generic(lua_State *L, int type) /* {{{ */
   pthread_mutex_init(&cb->lock, NULL);
 
   if (PLUGIN_READ == type) {
-    int status = plugin_register_complex_read(/* group = */ "lua",
-                                              /* name      = */ function_name,
-                                              /* callback  = */ clua_read,
-                                              /* interval  = */ 0,
-                                              &(user_data_t){
-                                                  .data = cb,
-                                                  .free_func = lua_cb_free,
-                                              });
+    int status =
+        plugin_register_complex_read(/* group = */ "lua",
+                                     /* name      = */ function_name,
+                                     /* callback  = */ clua_read,
+                                     /* interval  = */ 0,
+                                     &(user_data_t){
+                                         .data = cb, .free_func = lua_cb_free,
+                                     });
 
     if (status != 0)
       return luaL_error(L, "%s", "plugin_register_complex_read failed");
@@ -338,8 +338,7 @@ static int lua_cb_register_generic(lua_State *L, int type) /* {{{ */
     int status = plugin_register_write(/* name = */ function_name,
                                        /* callback  = */ clua_write,
                                        &(user_data_t){
-                                           .data = cb,
-                                           .free_func = lua_cb_free,
+                                           .data = cb, .free_func = lua_cb_free,
                                        });
 
     if (status != 0)
index b551fac..5b2509b 100644 (file)
@@ -1078,8 +1078,7 @@ static int mb_config_add_host(oconfig_item_t *ci) /* {{{ */
                                  /* callback = */ mb_read,
                                  /* interval = */ interval,
                                  &(user_data_t){
-                                     .data = host,
-                                     .free_func = host_free,
+                                     .data = host, .free_func = host_free,
                                  });
   } else {
     host_free(host);
index aafd4db..7ba10f6 100644 (file)
@@ -225,8 +225,7 @@ static int mysql_config_database(oconfig_item_t *ci) /* {{{ */
     plugin_register_complex_read(
         /* group = */ NULL, cb_name, mysql_read, /* interval = */ 0,
         &(user_data_t){
-            .data = db,
-            .free_func = mysql_database_free,
+            .data = db, .free_func = mysql_database_free,
         });
   } else {
     mysql_database_free(db);
@@ -355,8 +354,7 @@ static void derive_submit(const char *type, const char *type_instance,
 
 static void traffic_submit(derive_t rx, derive_t tx, mysql_database_t *db) {
   value_t values[] = {
-      {.derive = rx},
-      {.derive = tx},
+      {.derive = rx}, {.derive = tx},
   };
 
   submit("mysql_octets", NULL, values, STATIC_ARRAY_SIZE(values), db);
index 43aaa7a..ae49b5e 100644 (file)
@@ -643,8 +643,7 @@ static int submit_two_derive(const char *host,
                              derive_t val0, derive_t val1, cdtime_t timestamp,
                              cdtime_t interval) {
   value_t values[] = {
-      {.derive = val0},
-      {.derive = val1},
+      {.derive = val0}, {.derive = val1},
   };
 
   return submit_values(host, plugin_inst, type, type_inst, values,
@@ -667,8 +666,7 @@ static int submit_two_gauge(const char *host, const char *plugin_inst, /* {{{ */
                             gauge_t val0, gauge_t val1, cdtime_t timestamp,
                             cdtime_t interval) {
   value_t values[] = {
-      {.gauge = val0},
-      {.gauge = val1},
+      {.gauge = val0}, {.gauge = val1},
   };
 
   return submit_values(host, plugin_inst, type, type_inst, values,
@@ -780,8 +778,9 @@ static int submit_volume_perf_data(const char *hostname, /* {{{ */
 
   /* Check for and submit disk-octet values */
   if (HAS_ALL_FLAGS(old_data->flags, CFG_VOLUME_PERF_IO) &&
-      HAS_ALL_FLAGS(new_data->flags, HAVE_VOLUME_PERF_BYTES_READ |
-                                         HAVE_VOLUME_PERF_BYTES_WRITE)) {
+      HAS_ALL_FLAGS(new_data->flags,
+                    HAVE_VOLUME_PERF_BYTES_READ |
+                        HAVE_VOLUME_PERF_BYTES_WRITE)) {
     submit_two_derive(
         hostname, plugin_instance, "disk_octets", /* type instance = */ NULL,
         (derive_t)new_data->read_bytes, (derive_t)new_data->write_bytes,
@@ -799,15 +798,15 @@ static int submit_volume_perf_data(const char *hostname, /* {{{ */
   }
 
   /* Check for, calculate and submit disk-latency values */
-  if (HAS_ALL_FLAGS(old_data->flags, CFG_VOLUME_PERF_LATENCY |
-                                         HAVE_VOLUME_PERF_OPS_READ |
-                                         HAVE_VOLUME_PERF_OPS_WRITE |
-                                         HAVE_VOLUME_PERF_LATENCY_READ |
-                                         HAVE_VOLUME_PERF_LATENCY_WRITE) &&
-      HAS_ALL_FLAGS(new_data->flags, HAVE_VOLUME_PERF_OPS_READ |
-                                         HAVE_VOLUME_PERF_OPS_WRITE |
-                                         HAVE_VOLUME_PERF_LATENCY_READ |
-                                         HAVE_VOLUME_PERF_LATENCY_WRITE)) {
+  if (HAS_ALL_FLAGS(old_data->flags,
+                    CFG_VOLUME_PERF_LATENCY | HAVE_VOLUME_PERF_OPS_READ |
+                        HAVE_VOLUME_PERF_OPS_WRITE |
+                        HAVE_VOLUME_PERF_LATENCY_READ |
+                        HAVE_VOLUME_PERF_LATENCY_WRITE) &&
+      HAS_ALL_FLAGS(new_data->flags,
+                    HAVE_VOLUME_PERF_OPS_READ | HAVE_VOLUME_PERF_OPS_WRITE |
+                        HAVE_VOLUME_PERF_LATENCY_READ |
+                        HAVE_VOLUME_PERF_LATENCY_WRITE)) {
     gauge_t latency_per_op_read;
     gauge_t latency_per_op_write;
 
@@ -1407,8 +1406,9 @@ static int cna_submit_volume_usage_data(const char *hostname, /* {{{ */
 
     ssnprintf(plugin_instance, sizeof(plugin_instance), "volume-%s", v->name);
 
-    if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
-                                    HAVE_VOLUME_USAGE_SNAP_RSVD)) {
+    if (HAS_ALL_FLAGS(v->flags,
+                      HAVE_VOLUME_USAGE_SNAP_USED |
+                          HAVE_VOLUME_USAGE_SNAP_RSVD)) {
       if (v->snap_reserved > v->snap_used) {
         snap_reserve_free = v->snap_reserved - v->snap_used;
         snap_reserve_used = v->snap_used;
@@ -1422,8 +1422,9 @@ static int cna_submit_volume_usage_data(const char *hostname, /* {{{ */
 
     /* The space used by snapshots but not reserved for them is included in
      * both, norm_used and snap_norm_used. If possible, subtract this here. */
-    if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_NORM_USED |
-                                    HAVE_VOLUME_USAGE_SNAP_USED)) {
+    if (HAS_ALL_FLAGS(v->flags,
+                      HAVE_VOLUME_USAGE_NORM_USED |
+                          HAVE_VOLUME_USAGE_SNAP_USED)) {
       if (norm_used >= snap_norm_used)
         norm_used -= snap_norm_used;
       else {
@@ -1465,8 +1466,9 @@ static int cna_submit_volume_usage_data(const char *hostname, /* {{{ */
                     "df_complex", "snap_reserved", (double)snap_reserve_free,
                     /* timestamp = */ 0, interval);
 
-    if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
-                                    HAVE_VOLUME_USAGE_SNAP_RSVD))
+    if (HAS_ALL_FLAGS(v->flags,
+                      HAVE_VOLUME_USAGE_SNAP_USED |
+                          HAVE_VOLUME_USAGE_SNAP_RSVD))
       submit_double(hostname, /* plugin instance = */ plugin_instance,
                     "df_complex", "snap_reserve_used",
                     (double)snap_reserve_used, /* timestamp = */ 0, interval);
@@ -2796,8 +2798,7 @@ static int cna_register_host(host_config_t *host) /* {{{ */
       /* callback  = */ cna_read,
       /* interval  = */ host->interval,
       &(user_data_t){
-          .data = host,
-          .free_func = (void *)free_host_config,
+          .data = host, .free_func = (void *)free_host_config,
       });
 
   return 0;
index 806265a..e8a2877 100644 (file)
@@ -198,8 +198,7 @@ static void submit_two(const char *dev, const char *type,
                        const char *type_instance, derive_t rx, derive_t tx) {
   value_list_t vl = VALUE_LIST_INIT;
   value_t values[] = {
-      {.derive = rx},
-      {.derive = tx},
+      {.derive = rx}, {.derive = tx},
   };
 
   vl.values = values;
index e430b68..266c77c 100644 (file)
@@ -102,7 +102,7 @@ static int c_notify(const notification_t *n,
 
   notification = notify_notification_new(summary, n->message, NULL
 #if NOTIFY_CHECK_VERSION(0, 7, 0)
-  );
+                                         );
 #else
                                          ,
                                          NULL);
index cd72cdb..41e2ec0 100644 (file)
@@ -472,8 +472,7 @@ static int cldap_config_add(oconfig_item_t *ci) /* {{{ */
                                       /* callback  = */ cldap_read_host,
                                       /* interval  = */ 0,
                                       &(user_data_t){
-                                          .data = st,
-                                          .free_func = cldap_free,
+                                          .data = st, .free_func = cldap_free,
                                       });
 } /* }}} int cldap_config_add */
 
index e22e851..4ec14f4 100644 (file)
@@ -282,9 +282,7 @@ static void ovs_stats_submit_interfaces(port_list_t *port) {
     }
     strjoin(devname, sizeof(devname),
             (char *[]){
-                bridge->name,
-                port->name,
-                iface->name,
+                bridge->name, port->name, iface->name,
             },
             3, ".");
     ovs_stats_submit_one(devname, "if_collisions", NULL,
index d0c9917..0a4ae71 100644 (file)
@@ -33,8 +33,8 @@
 /* do not automatically get the thread specific Perl interpreter */
 #define PERL_NO_GET_CONTEXT
 
-#include <stdbool.h>
 #include "collectd.h"
+#include <stdbool.h>
 
 #include <EXTERN.h>
 #include <perl.h>
index 7bfa663..8d3dafa 100644 (file)
@@ -41,8 +41,7 @@
  * Global variables
  */
 static const char *config_keys[] = {
-    "Value",
-    "IgnoreSelected",
+    "Value", "IgnoreSelected",
 };
 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
 
index 70db6b6..5669f45 100644 (file)
@@ -703,9 +703,8 @@ static PyObject *cpy_get_dataset(PyObject *self, PyObject *args) {
   for (size_t i = 0; i < ds->ds_num; ++i) {
     tuple = PyTuple_New(4);
     PyTuple_SET_ITEM(tuple, 0, cpy_string_to_unicode_or_bytes(ds->ds[i].name));
-    PyTuple_SET_ITEM(
-        tuple, 1,
-        cpy_string_to_unicode_or_bytes(DS_TYPE_TO_STRING(ds->ds[i].type)));
+    PyTuple_SET_ITEM(tuple, 1, cpy_string_to_unicode_or_bytes(
+                                   DS_TYPE_TO_STRING(ds->ds[i].type)));
     PyTuple_SET_ITEM(tuple, 2, float_or_none(ds->ds[i].min));
     PyTuple_SET_ITEM(tuple, 3, float_or_none(ds->ds[i].max));
     PyList_SET_ITEM(list, i, tuple);
@@ -775,8 +774,7 @@ static PyObject *cpy_register_generic_userdata(void *reg, void *handler,
 
   register_function(buf, handler,
                     &(user_data_t){
-                        .data = c,
-                        .free_func = cpy_destroy_user_data,
+                        .data = c, .free_func = cpy_destroy_user_data,
                     });
 
   ++cpy_num_callbacks;
@@ -819,8 +817,7 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args,
       /* group = */ "python", buf, cpy_read_callback,
       DOUBLE_TO_CDTIME_T(interval),
       &(user_data_t){
-          .data = c,
-          .free_func = cpy_destroy_user_data,
+          .data = c, .free_func = cpy_destroy_user_data,
       });
   ++cpy_num_callbacks;
   return cpy_string_to_unicode_or_bytes(buf);
@@ -1204,9 +1201,8 @@ static PyObject *cpy_oconfig_to_pyconfig(oconfig_item_t *ci, PyObject *parent) {
   values = PyTuple_New(ci->values_num); /* New reference. */
   for (int i = 0; i < ci->values_num; ++i) {
     if (ci->values[i].type == OCONFIG_TYPE_STRING) {
-      PyTuple_SET_ITEM(
-          values, i,
-          cpy_string_to_unicode_or_bytes(ci->values[i].value.string));
+      PyTuple_SET_ITEM(values, i, cpy_string_to_unicode_or_bytes(
+                                      ci->values[i].value.string));
     } else if (ci->values[i].type == OCONFIG_TYPE_NUMBER) {
       PyTuple_SET_ITEM(values, i,
                        PyFloat_FromDouble(ci->values[i].value.number));
index 77ce5fb..12f6894 100644 (file)
@@ -123,8 +123,7 @@ static int redis_node_add(redis_node_t *rn) /* {{{ */
       /* callback  = */ redis_read,
       /* interval  = */ 0,
       &(user_data_t){
-          .data = rn,
-          .free_func = redis_node_free,
+          .data = rn, .free_func = redis_node_free,
       });
 } /* }}} */
 
index ece865b..fa28f04 100644 (file)
@@ -53,8 +53,7 @@ static void cr_submit_io(cr_data_t *rd, const char *type, /* {{{ */
                          const char *type_instance, derive_t rx, derive_t tx) {
   value_list_t vl = VALUE_LIST_INIT;
   value_t values[] = {
-      {.derive = rx},
-      {.derive = tx},
+      {.derive = rx}, {.derive = tx},
   };
 
   vl.values = values;
@@ -443,8 +442,7 @@ static int cr_config_router(oconfig_item_t *ci) /* {{{ */
   return plugin_register_complex_read(
       /* group = */ NULL, read_name, cr_read, /* interval = */ 0,
       &(user_data_t){
-          .data = router_data,
-          .free_func = (void *)cr_free_data,
+          .data = router_data, .free_func = (void *)cr_free_data,
       });
 } /* }}} int cr_config_router */
 
index 1e75ff8..6f34e67 100644 (file)
@@ -426,8 +426,7 @@ static int rc_write(const data_set_t *ds, const value_list_t *vl,
   }
 
   char *values_array[2] = {
-      [0] = values,
-      [1] = NULL,
+          [0] = values, [1] = NULL,
   };
 
   while (42) {
index aeb04fd..dd7e998 100644 (file)
@@ -876,8 +876,7 @@ static int csnmp_config_add_host(oconfig_item_t *ci) {
   status = plugin_register_complex_read(
       /* group = */ NULL, cb_name, csnmp_read_host, interval,
       &(user_data_t){
-          .data = hd,
-          .free_func = csnmp_host_definition_destroy,
+          .data = hd, .free_func = csnmp_host_definition_destroy,
       });
   if (status != 0) {
     ERROR("snmp plugin: Registering complex read function failed.");
index d75c16e..bb4a7e4 100644 (file)
 
 #include "collectd.h"
 
-#include <regex.h>
 #include "utils/avltree/avltree.h"
 #include "utils/common/common.h"
 #include "utils_cache.h"
 #include "utils_llist.h"
+#include <regex.h>
 
 #include <net-snmp/net-snmp-config.h>
 
index e74dfc2..b08d353 100644 (file)
@@ -367,9 +367,8 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
     if (state_old == STATE_MISSING)
       ssnprintf(buf, bufsize, ": Value is no longer missing.");
     else
-      ssnprintf(buf, bufsize,
-                ": All data sources are within range again. "
-                "Current value of \"%s\" is %f.",
+      ssnprintf(buf, bufsize, ": All data sources are within range again. "
+                              "Current value of \"%s\" is %f.",
                 ds->ds[ds_index].name, values[ds_index]);
   } else if (state == STATE_UNKNOWN) {
     ERROR("ut_report_state: metric transition to UNKNOWN from a different "
@@ -392,9 +391,8 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
                   ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max,
                   ((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
       } else {
-        ssnprintf(buf, bufsize,
-                  ": Data source \"%s\" is currently "
-                  "%f. That is %s the %s threshold of %f%s.",
+        ssnprintf(buf, bufsize, ": Data source \"%s\" is currently "
+                                "%f. That is %s the %s threshold of %f%s.",
                   ds->ds[ds_index].name, values[ds_index],
                   isnan(min) ? "below" : "above",
                   (state == STATE_ERROR) ? "failure" : "warning",
@@ -427,9 +425,8 @@ static int ut_report_state(const data_set_t *ds, const value_list_t *vl,
                 (value < min) ? min : max);
     } else /* is not inverted */
     {
-      ssnprintf(buf, bufsize,
-                ": Data source \"%s\" is currently "
-                "%f. That is %s the %s threshold of %f.",
+      ssnprintf(buf, bufsize, ": Data source \"%s\" is currently "
+                              "%f. That is %s the %s threshold of %f.",
                 ds->ds[ds_index].name, values[ds_index],
                 (values[ds_index] < min) ? "below" : "above",
                 (state == STATE_ERROR) ? "failure" : "warning",
index edbf5c9..6470b81 100644 (file)
@@ -57,201 +57,114 @@ static struct {
 } parse_data[] = {
     /* Valid FLUSH commands. */
     {
-        "FLUSH",
-        NULL,
-        CMD_OK,
-        CMD_FLUSH,
+        "FLUSH", NULL, CMD_OK, CMD_FLUSH,
     },
     {
-        "FLUSH identifier=myhost/magic/MAGIC",
-        NULL,
-        CMD_OK,
-        CMD_FLUSH,
+        "FLUSH identifier=myhost/magic/MAGIC", NULL, CMD_OK, CMD_FLUSH,
     },
     {
-        "FLUSH identifier=magic/MAGIC",
-        &default_host_opts,
-        CMD_OK,
-        CMD_FLUSH,
+        "FLUSH identifier=magic/MAGIC", &default_host_opts, CMD_OK, CMD_FLUSH,
     },
     {
-        "FLUSH timeout=123 plugin=\"A\"",
-        NULL,
-        CMD_OK,
-        CMD_FLUSH,
+        "FLUSH timeout=123 plugin=\"A\"", NULL, CMD_OK, CMD_FLUSH,
     },
     /* Invalid FLUSH commands. */
     {
         /* Missing hostname; no default. */
-        "FLUSH identifier=magic/MAGIC",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "FLUSH identifier=magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
         /* Missing 'identifier' key. */
-        "FLUSH myhost/magic/MAGIC",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "FLUSH myhost/magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
         /* Invalid timeout. */
-        "FLUSH timeout=A",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "FLUSH timeout=A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
         /* Invalid identifier. */
-        "FLUSH identifier=invalid",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "FLUSH identifier=invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
         /* Invalid option. */
-        "FLUSH invalid=option",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "FLUSH invalid=option", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
 
     /* Valid GETVAL commands. */
     {
-        "GETVAL myhost/magic/MAGIC",
-        NULL,
-        CMD_OK,
-        CMD_GETVAL,
+        "GETVAL myhost/magic/MAGIC", NULL, CMD_OK, CMD_GETVAL,
     },
     {
-        "GETVAL magic/MAGIC",
-        &default_host_opts,
-        CMD_OK,
-        CMD_GETVAL,
+        "GETVAL magic/MAGIC", &default_host_opts, CMD_OK, CMD_GETVAL,
     },
 
     /* Invalid GETVAL commands. */
     {
-        "GETVAL magic/MAGIC",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "GETVAL magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "GETVAL",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "GETVAL", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "GETVAL invalid",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "GETVAL invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
 
     /* Valid LISTVAL commands. */
     {
-        "LISTVAL",
-        NULL,
-        CMD_OK,
-        CMD_LISTVAL,
+        "LISTVAL", NULL, CMD_OK, CMD_LISTVAL,
     },
 
     /* Invalid LISTVAL commands. */
     {
-        "LISTVAL invalid",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "LISTVAL invalid", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
 
     /* Valid PUTVAL commands. */
     {
-        "PUTVAL magic/MAGIC N:42",
-        &default_host_opts,
-        CMD_OK,
-        CMD_PUTVAL,
+        "PUTVAL magic/MAGIC N:42", &default_host_opts, CMD_OK, CMD_PUTVAL,
     },
     {
-        "PUTVAL myhost/magic/MAGIC N:42",
-        NULL,
-        CMD_OK,
-        CMD_PUTVAL,
+        "PUTVAL myhost/magic/MAGIC N:42", NULL, CMD_OK, CMD_PUTVAL,
     },
     {
-        "PUTVAL myhost/magic/MAGIC 1234:42",
-        NULL,
-        CMD_OK,
-        CMD_PUTVAL,
+        "PUTVAL myhost/magic/MAGIC 1234:42", NULL, CMD_OK, CMD_PUTVAL,
     },
     {
-        "PUTVAL myhost/magic/MAGIC 1234:42 2345:23",
-        NULL,
-        CMD_OK,
-        CMD_PUTVAL,
+        "PUTVAL myhost/magic/MAGIC 1234:42 2345:23", NULL, CMD_OK, CMD_PUTVAL,
     },
     {
-        "PUTVAL myhost/magic/MAGIC interval=2 1234:42",
-        NULL,
-        CMD_OK,
+        "PUTVAL myhost/magic/MAGIC interval=2 1234:42", NULL, CMD_OK,
         CMD_PUTVAL,
     },
     {
-        "PUTVAL myhost/magic/MAGIC interval=2 1234:42 interval=5 2345:23",
-        NULL,
-        CMD_OK,
-        CMD_PUTVAL,
+        "PUTVAL myhost/magic/MAGIC interval=2 1234:42 interval=5 2345:23", NULL,
+        CMD_OK, CMD_PUTVAL,
     },
 
     /* Invalid PUTVAL commands. */
     {
-        "PUTVAL magic/MAGIC N:42",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL magic/MAGIC N:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL invalid N:42",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL invalid N:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL myhost/magic/MAGIC A:42",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL myhost/magic/MAGIC A:42", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL myhost/magic/MAGIC 1234:A",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL myhost/magic/MAGIC 1234:A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL myhost/magic/MAGIC",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL myhost/magic/MAGIC", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL 1234:A",
-        NULL,
-        CMD_PARSE_ERROR,
-        CMD_UNKNOWN,
+        "PUTVAL 1234:A", NULL, CMD_PARSE_ERROR, CMD_UNKNOWN,
     },
     {
-        "PUTVAL myhost/magic/UNKNOWN 1234:42",
-        NULL,
-        CMD_PARSE_ERROR,
+        "PUTVAL myhost/magic/UNKNOWN 1234:42", NULL, CMD_PARSE_ERROR,
         CMD_UNKNOWN,
     },
     /*
@@ -266,16 +179,10 @@ static struct {
 
     /* Invalid commands. */
     {
-        "INVALID",
-        NULL,
-        CMD_UNKNOWN_COMMAND,
-        CMD_UNKNOWN,
+        "INVALID", NULL, CMD_UNKNOWN_COMMAND, CMD_UNKNOWN,
     },
     {
-        "INVALID interval=2",
-        NULL,
-        CMD_UNKNOWN_COMMAND,
-        CMD_UNKNOWN,
+        "INVALID interval=2", NULL, CMD_UNKNOWN_COMMAND, CMD_UNKNOWN,
     },
 };
 
@@ -295,10 +202,9 @@ DEF_TEST(parse) {
     memset(&cmd, 0, sizeof(cmd));
 
     status = cmd_parse(input, &cmd, parse_data[i].opts, &err);
-    ssnprintf(description, sizeof(description),
-              "cmd_parse (\"%s\", opts=%p) = "
-              "%d (type=%d [%s]); want %d "
-              "(type=%d [%s])",
+    ssnprintf(description, sizeof(description), "cmd_parse (\"%s\", opts=%p) = "
+                                                "%d (type=%d [%s]); want %d "
+                                                "(type=%d [%s])",
               parse_data[i].input, parse_data[i].opts, status, cmd.type,
               CMD_TO_STRING(cmd.type), parse_data[i].expected_status,
               parse_data[i].expected_type,
index 0d2aaae..6ee4e08 100644 (file)
@@ -181,7 +181,7 @@ char *sstrerror(int errnum, char *buf, size_t buflen) {
 
     pthread_mutex_unlock(&strerror_r_lock);
   }
-  /* #endif !HAVE_STRERROR_R */
+/* #endif !HAVE_STRERROR_R */
 
 #elif STRERROR_R_CHAR_P
   {
@@ -191,19 +191,17 @@ char *sstrerror(int errnum, char *buf, size_t buflen) {
       if ((temp != NULL) && (temp != buf) && (temp[0] != '\0'))
         sstrncpy(buf, temp, buflen);
       else
-        sstrncpy(buf,
-                 "strerror_r did not return "
-                 "an error message",
+        sstrncpy(buf, "strerror_r did not return "
+                      "an error message",
                  buflen);
     }
   }
-  /* #endif STRERROR_R_CHAR_P */
+/* #endif STRERROR_R_CHAR_P */
 
 #else
   if (strerror_r(errnum, buf, buflen) != 0) {
-    snprintf(buf, buflen,
-             "Error #%i; "
-             "Additionally, strerror_r failed.",
+    snprintf(buf, buflen, "Error #%i; "
+                          "Additionally, strerror_r failed.",
              errnum);
   }
 #endif /* STRERROR_R_CHAR_P */
index 7d9f7ab..efc39da 100644 (file)
@@ -704,8 +704,7 @@ static void dpdk_helper_check_pipe(dpdk_helper_ctx_t *phc) {
 
   /* non blocking check on helper logging pipe */
   struct pollfd fds = {
-      .fd = phc->pipes[0],
-      .events = POLLIN,
+      .fd = phc->pipes[0], .events = POLLIN,
   };
   int data_avail = poll(&fds, 1, 0);
   DEBUG("%s:dpdk_helper_check_pipe: poll data_avail=%d", phc->shm_name,
index a7ae75d..e185c43 100644 (file)
@@ -531,8 +531,7 @@ oauth_google_t oauth_create_google_json(char const *buffer, char const *scope) {
   }
 
   oauth_google_t ret = {
-      .project_id = strdup(project_id),
-      .oauth = oauth,
+      .project_id = strdup(project_id), .oauth = oauth,
   };
 
   yajl_tree_free(root);
index 52a590b..127a917 100644 (file)
@@ -785,9 +785,7 @@ static void *ovs_poll_worker(void *arg) {
   ovs_db_t *pdb = (ovs_db_t *)arg; /* pointer to OVS DB */
   ovs_json_reader_t *jreader = NULL;
   struct pollfd poll_fd = {
-      .fd = pdb->sock,
-      .events = POLLIN | POLLPRI,
-      .revents = 0,
+      .fd = pdb->sock, .events = POLLIN | POLLPRI, .revents = 0,
   };
 
   /* create JSON reader instance */
index f4c70af..4200c21 100644 (file)
@@ -1546,8 +1546,7 @@ static int varnish_init(void) /* {{{ */
       /* callback  = */ varnish_read,
       /* interval  = */ 0,
       &(user_data_t){
-          .data = conf,
-          .free_func = varnish_config_free,
+          .data = conf, .free_func = varnish_config_free,
       });
 
   return 0;
@@ -1752,7 +1751,7 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */
       !conf->collect_mgt && !conf->collect_lck && !conf->collect_mempool &&
       !conf->collect_mse
 #endif
-  ) {
+      ) {
     WARNING("Varnish plugin: No metric has been configured for "
             "instance \"%s\". Disabling this instance.",
             (conf->instance == NULL) ? "localhost" : conf->instance);
@@ -1769,8 +1768,7 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */
       /* callback  = */ varnish_read,
       /* interval  = */ 0,
       &(user_data_t){
-          .data = conf,
-          .free_func = varnish_config_free,
+          .data = conf, .free_func = varnish_config_free,
       });
 
   have_instance = true;
index 1f4172f..7e1c866 100644 (file)
@@ -131,16 +131,16 @@ static bool report_network_interfaces = true;
 static virt_notif_thread_t notif_thread;
 
 const char *domain_states[] = {
-    [VIR_DOMAIN_NOSTATE] = "no state",
-    [VIR_DOMAIN_RUNNING] = "the domain is running",
-    [VIR_DOMAIN_BLOCKED] = "the domain is blocked on resource",
-    [VIR_DOMAIN_PAUSED] = "the domain is paused by user",
-    [VIR_DOMAIN_SHUTDOWN] = "the domain is being shut down",
-    [VIR_DOMAIN_SHUTOFF] = "the domain is shut off",
-    [VIR_DOMAIN_CRASHED] = "the domain is crashed",
+        [VIR_DOMAIN_NOSTATE] = "no state",
+        [VIR_DOMAIN_RUNNING] = "the domain is running",
+        [VIR_DOMAIN_BLOCKED] = "the domain is blocked on resource",
+        [VIR_DOMAIN_PAUSED] = "the domain is paused by user",
+        [VIR_DOMAIN_SHUTDOWN] = "the domain is being shut down",
+        [VIR_DOMAIN_SHUTOFF] = "the domain is shut off",
+        [VIR_DOMAIN_CRASHED] = "the domain is crashed",
 #ifdef HAVE_DOM_STATE_PMSUSPENDED
-    [VIR_DOMAIN_PMSUSPENDED] =
-        "the domain is suspended by guest power management",
+        [VIR_DOMAIN_PMSUSPENDED] =
+            "the domain is suspended by guest power management",
 #endif
 };
 
@@ -352,99 +352,107 @@ static int map_domain_event_detail_to_reason(int event, int detail) {
 
 #define DOMAIN_STATE_REASON_MAX_SIZE 20
 const char *domain_reasons[][DOMAIN_STATE_REASON_MAX_SIZE] = {
-    [VIR_DOMAIN_NOSTATE][VIR_DOMAIN_NOSTATE_UNKNOWN] = "the reason is unknown",
-
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNKNOWN] = "the reason is unknown",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_BOOTED] =
-        "normal startup from boot",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATED] =
-        "migrated from another host",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_RESTORED] =
-        "restored from a state file",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_FROM_SNAPSHOT] =
-        "restored from snapshot",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNPAUSED] =
-        "returned from paused state",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATION_CANCELED] =
-        "returned from migration",
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_SAVE_CANCELED] =
-        "returned from failed save process",
+        [VIR_DOMAIN_NOSTATE][VIR_DOMAIN_NOSTATE_UNKNOWN] =
+            "the reason is unknown",
+
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNKNOWN] =
+            "the reason is unknown",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_BOOTED] =
+            "normal startup from boot",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATED] =
+            "migrated from another host",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_RESTORED] =
+            "restored from a state file",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_FROM_SNAPSHOT] =
+            "restored from snapshot",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_UNPAUSED] =
+            "returned from paused state",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_MIGRATION_CANCELED] =
+            "returned from migration",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_SAVE_CANCELED] =
+            "returned from failed save process",
 #ifdef HAVE_DOM_REASON_RUNNING_WAKEUP
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_WAKEUP] =
-        "returned from pmsuspended due to wakeup event",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_WAKEUP] =
+            "returned from pmsuspended due to wakeup event",
 #endif
 #ifdef HAVE_DOM_REASON_CRASHED
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_CRASHED] = "resumed from crashed",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_CRASHED] =
+            "resumed from crashed",
 #endif
 #ifdef HAVE_DOM_REASON_POSTCOPY
-    [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_POSTCOPY] =
-        "running in post-copy migration mode",
-#endif
-    [VIR_DOMAIN_BLOCKED][VIR_DOMAIN_BLOCKED_UNKNOWN] = "the reason is unknown",
-
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_UNKNOWN] = "the reason is unknown",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_USER] = "paused on user request",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_MIGRATION] =
-        "paused for offline migration",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SAVE] = "paused for save",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_DUMP] =
-        "paused for offline core dump",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_IOERROR] =
-        "paused due to a disk I/O error",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_WATCHDOG] =
-        "paused due to a watchdog event",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_FROM_SNAPSHOT] =
-        "paused after restoring from snapshot",
+        [VIR_DOMAIN_RUNNING][VIR_DOMAIN_RUNNING_POSTCOPY] =
+            "running in post-copy migration mode",
+#endif
+        [VIR_DOMAIN_BLOCKED][VIR_DOMAIN_BLOCKED_UNKNOWN] =
+            "the reason is unknown",
+
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_UNKNOWN] =
+            "the reason is unknown",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_USER] = "paused on user request",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_MIGRATION] =
+            "paused for offline migration",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SAVE] = "paused for save",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_DUMP] =
+            "paused for offline core dump",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_IOERROR] =
+            "paused due to a disk I/O error",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_WATCHDOG] =
+            "paused due to a watchdog event",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_FROM_SNAPSHOT] =
+            "paused after restoring from snapshot",
 #ifdef HAVE_DOM_REASON_PAUSED_SHUTTING_DOWN
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SHUTTING_DOWN] =
-        "paused during shutdown process",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SHUTTING_DOWN] =
+            "paused during shutdown process",
 #endif
 #ifdef HAVE_DOM_REASON_PAUSED_SNAPSHOT
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SNAPSHOT] =
-        "paused while creating a snapshot",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_SNAPSHOT] =
+            "paused while creating a snapshot",
 #endif
 #ifdef HAVE_DOM_REASON_PAUSED_CRASHED
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_CRASHED] =
-        "paused due to a guest crash",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_CRASHED] =
+            "paused due to a guest crash",
 #endif
 #ifdef HAVE_DOM_REASON_PAUSED_STARTING_UP
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_STARTING_UP] =
-        "the domain is being started",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_STARTING_UP] =
+            "the domain is being started",
 #endif
 #ifdef HAVE_DOM_REASON_POSTCOPY
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY] =
-        "paused for post-copy migration",
-    [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY_FAILED] =
-        "paused after failed post-copy",
-#endif
-    [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_UNKNOWN] =
-        "the reason is unknown",
-    [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_USER] =
-        "shutting down on user request",
-
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_UNKNOWN] = "the reason is unknown",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SHUTDOWN] = "normal shutdown",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DESTROYED] = "forced poweroff",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_CRASHED] = "domain crashed",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_MIGRATED] =
-        "migrated to another host",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SAVED] = "saved to a file",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FAILED] = "domain failed to start",
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT] =
-        "restored from a snapshot which was taken while domain was shutoff",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY] =
+            "paused for post-copy migration",
+        [VIR_DOMAIN_PAUSED][VIR_DOMAIN_PAUSED_POSTCOPY_FAILED] =
+            "paused after failed post-copy",
+#endif
+        [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_UNKNOWN] =
+            "the reason is unknown",
+        [VIR_DOMAIN_SHUTDOWN][VIR_DOMAIN_SHUTDOWN_USER] =
+            "shutting down on user request",
+
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_UNKNOWN] =
+            "the reason is unknown",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SHUTDOWN] = "normal shutdown",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DESTROYED] = "forced poweroff",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_CRASHED] = "domain crashed",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_MIGRATED] =
+            "migrated to another host",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_SAVED] = "saved to a file",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FAILED] =
+            "domain failed to start",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT] =
+            "restored from a snapshot which was taken while domain was shutoff",
 #ifdef HAVE_DOM_REASON_SHUTOFF_DAEMON
-    [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DAEMON] =
-        "daemon decides to kill domain during reconnection processing",
+        [VIR_DOMAIN_SHUTOFF][VIR_DOMAIN_SHUTOFF_DAEMON] =
+            "daemon decides to kill domain during reconnection processing",
 #endif
 
-    [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_UNKNOWN] = "the reason is unknown",
+        [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_UNKNOWN] =
+            "the reason is unknown",
 #ifdef VIR_DOMAIN_CRASHED_PANICKED
-    [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_PANICKED] = "domain panicked",
+        [VIR_DOMAIN_CRASHED][VIR_DOMAIN_CRASHED_PANICKED] = "domain panicked",
 #endif
 
 #ifdef HAVE_DOM_STATE_PMSUSPENDED
-    [VIR_DOMAIN_PMSUSPENDED][VIR_DOMAIN_PMSUSPENDED_UNKNOWN] =
-        "the reason is unknown",
+        [VIR_DOMAIN_PMSUSPENDED][VIR_DOMAIN_PMSUSPENDED_UNKNOWN] =
+            "the reason is unknown",
 #endif
 };
 #endif /* HAVE_DOM_REASON */
@@ -949,8 +957,7 @@ static void memory_stats_submit(gauge_t value, virDomainPtr dom,
 static void submit_derive2(const char *type, derive_t v0, derive_t v1,
                            virDomainPtr dom, const char *devname) {
   value_t values[] = {
-      {.derive = v0},
-      {.derive = v1},
+      {.derive = v0}, {.derive = v1},
   };
 
   submit(dom, type, devname, values, STATIC_ARRAY_SIZE(values));
@@ -1711,8 +1718,7 @@ static int submit_domain_state(virDomainPtr domain) {
   }
 
   value_t values[] = {
-      {.gauge = (gauge_t)domain_state},
-      {.gauge = (gauge_t)domain_reason},
+      {.gauge = (gauge_t)domain_state}, {.gauge = (gauge_t)domain_reason},
   };
 
   submit(domain, "domain_state", NULL, values, STATIC_ARRAY_SIZE(values));
@@ -1796,8 +1802,7 @@ static int get_memory_stats(virDomainPtr domain) {
 
   if (min_flt > 0 || maj_flt > 0) {
     value_t values[] = {
-        {.gauge = (gauge_t)min_flt},
-        {.gauge = (gauge_t)maj_flt},
+        {.gauge = (gauge_t)min_flt}, {.gauge = (gauge_t)maj_flt},
     };
     submit(domain, "ps_pagefaults", NULL, values, STATIC_ARRAY_SIZE(values));
   }
index 09bb639..592d669 100644 (file)
@@ -413,11 +413,11 @@ static void kafka_config_topic(rd_kafka_conf_t *conf,
   ssnprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
             tctx->topic_name);
 
-  status = plugin_register_write(callback_name, kafka_write,
-                                 &(user_data_t){
-                                     .data = tctx,
-                                     .free_func = kafka_topic_context_free,
-                                 });
+  status = plugin_register_write(
+      callback_name, kafka_write,
+      &(user_data_t){
+          .data = tctx, .free_func = kafka_topic_context_free,
+      });
   if (status != 0) {
     WARNING("write_kafka plugin: plugin_register_write (\"%s\") "
             "failed with status %i.",
index b904022..fe3b940 100644 (file)
@@ -156,8 +156,7 @@ static char *format_labels(char *buffer, size_t buffer_size,
 #define LABEL_BUFFER_SIZE (LABEL_KEY_SIZE + LABEL_VALUE_SIZE + 4)
 
   char *labels[3] = {
-      (char[LABEL_BUFFER_SIZE]){0},
-      (char[LABEL_BUFFER_SIZE]){0},
+      (char[LABEL_BUFFER_SIZE]){0}, (char[LABEL_BUFFER_SIZE]){0},
       (char[LABEL_BUFFER_SIZE]){0},
   };
 
index 32005cd..880323c 100644 (file)
@@ -242,11 +242,11 @@ static int wr_config_node(oconfig_item_t *ci) /* {{{ */
 
     ssnprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
 
-    status = plugin_register_write(cb_name, wr_write,
-                                   &(user_data_t){
-                                       .data = node,
-                                       .free_func = wr_config_free,
-                                   });
+    status =
+        plugin_register_write(cb_name, wr_write,
+                              &(user_data_t){
+                                  .data = node, .free_func = wr_config_free,
+                              });
   }
 
   if (status != 0)