From 21c84cec32921e6de8feaa5496f337496379ea23 Mon Sep 17 00:00:00 2001 From: Matthias Runge Date: Fri, 19 Jul 2019 16:15:56 +0200 Subject: [PATCH] Clang-format a few files to make CI happy --- src/aggregation.c | 7 +- src/amqp1.c | 14 +- src/apache.c | 3 +- src/battery.c | 2 +- src/bind.c | 5 +- src/chrony.c | 12 +- src/collectdctl.c | 20 +- src/collectdmon.c | 8 +- src/contextswitch.c | 4 +- src/cpu.c | 24 +- src/cpusleep.c | 2 +- src/cpython.h | 2 +- src/curl.c | 3 +- src/curl_json.c | 3 +- src/curl_xml.c | 7 +- src/daemon/cmd.c | 2 +- src/daemon/collectd.c | 11 +- src/daemon/configfile.c | 14 +- src/daemon/plugin.c | 9 +- src/daemon/utils_cache.c | 3 +- src/disk.c | 20 +- src/dns.c | 3 +- src/email.c | 10 +- src/exec.c | 5 +- src/gpu_nvidia.c | 3 +- src/intel_rdt_test.c | 21 +- src/interface.c | 17 +- src/ipc.c | 4 +- src/ipvs.c | 3 +- src/java.c | 51 +-- src/libcollectdclient/client.c | 14 +- src/libcollectdclient/network_parse.c | 12 +- src/libcollectdclient/network_parse_test.c | 16 +- src/liboconfig/aux_types.h | 14 +- src/lua.c | 19 +- src/madwifi.c | 3 +- src/madwifi.h | 455 ++++++++++----------- src/match_empty_counter.c | 10 +- src/mcelog.c | 9 +- src/memcached.c | 15 +- src/memory.c | 18 +- src/modbus.c | 5 +- src/mysql.c | 6 +- src/netapp.c | 47 ++- src/netlink.c | 3 +- src/network.c | 6 +- src/nfs.c | 4 +- src/nut.c | 6 +- src/openldap.c | 3 +- src/ovs_stats.c | 4 +- src/pcie_errors.c | 4 +- src/processes.c | 20 +- src/protocols.c | 3 +- src/python.c | 16 +- src/redis.c | 3 +- src/routeros.c | 6 +- src/rrdcached.c | 3 +- src/rrdtool.c | 2 +- src/sensors.c | 4 +- src/serial.c | 3 +- src/snmp.c | 3 +- src/statsd.c | 5 +- src/swap.c | 6 +- src/tail_csv.c | 3 +- src/tape.c | 3 +- src/tcpconns.c | 14 +- src/teamspeak2.c | 3 +- src/threshold.c | 15 +- src/turbostat.c | 6 +- src/uptime.c | 6 +- src/users.c | 6 +- src/utils/cmds/cmds_test.c | 166 ++++++-- src/utils/common/common.c | 18 +- src/utils/dns/dns.c | 2 +- src/utils/dpdk/dpdk.c | 3 +- src/utils/format_json/format_json.c | 11 +- src/utils/format_json/format_json_test.c | 3 +- .../format_stackdriver/format_stackdriver_test.c | 9 +- src/utils/latency/latency.c | 32 +- src/utils/latency/latency_config.c | 3 +- src/utils/latency/latency_test.c | 41 +- src/utils/mount/mount.c | 20 +- src/utils/mount/mount.h | 2 +- src/utils/oauth/oauth_test.c | 16 +- src/utils/proc_pids/proc_pids.c | 2 +- src/utils/rrdcreate/rrdcreate.c | 2 +- src/utils/taskstats/taskstats.c | 3 +- src/utils_tail_match.h | 2 +- src/varnish.c | 8 +- src/virt.c | 182 ++++----- src/vmem.c | 3 +- src/vserver.c | 7 +- src/write_graphite.c | 3 +- src/write_http.c | 3 +- src/write_kafka.c | 10 +- src/write_mongodb.c | 10 +- src/write_prometheus.c | 3 +- 97 files changed, 939 insertions(+), 720 deletions(-) diff --git a/src/aggregation.c b/src/aggregation.c index 7a214ca3..2c8ef880 100644 --- a/src/aggregation.c +++ b/src/aggregation.c @@ -398,10 +398,9 @@ 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. */ diff --git a/src/amqp1.c b/src/amqp1.c index 601f0ae0..67c96b75 100644 --- a/src/amqp1.c +++ b/src/amqp1.c @@ -639,14 +639,16 @@ 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) { diff --git a/src/apache.c b/src/apache.c index d64e5471..4014bbaf 100644 --- a/src/apache.c +++ b/src/apache.c @@ -224,7 +224,8 @@ static int config_add(oconfig_item_t *ci) { /* callback = */ apache_read_host, /* interval = */ 0, &(user_data_t){ - .data = st, .free_func = apache_free, + .data = st, + .free_func = apache_free, }); } /* int config_add */ diff --git a/src/battery.c b/src/battery.c index 8e6c4b29..20ec2612 100644 --- a/src/battery.c +++ b/src/battery.c @@ -336,7 +336,7 @@ static int battery_read(void) /* {{{ */ return 0; } /* }}} int battery_read */ -/* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */ + /* #endif HAVE_IOKIT_IOKITLIB_H || HAVE_IOKIT_PS_IOPOWERSOURCES_H */ #elif KERNEL_LINUX /* Reads a file which contains only a number (and optionally a trailing diff --git a/src/bind.c b/src/bind.c index 29f65d40..a246f1aa 100644 --- a/src/bind.c +++ b/src/bind.c @@ -1538,8 +1538,9 @@ static int bind_init(void) /* {{{ */ curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 50L); #ifdef HAVE_CURLOPT_TIMEOUT_MS curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, - (timeout >= 0) ? (long)timeout : (long)CDTIME_T_TO_MS( - plugin_get_interval())); + (timeout >= 0) + ? (long)timeout + : (long)CDTIME_T_TO_MS(plugin_get_interval())); #endif return 0; diff --git a/src/chrony.c b/src/chrony.c index 65e3c4c8..079a3357 100644 --- a/src/chrony.c +++ b/src/chrony.c @@ -111,7 +111,9 @@ typedef enum { #define ATTRIB_PACKED #endif -typedef struct ATTRIB_PACKED { int32_t value; } tFloat; +typedef struct ATTRIB_PACKED { + int32_t value; +} tFloat; typedef struct ATTRIB_PACKED { uint32_t tv_sec_high; @@ -148,7 +150,9 @@ typedef struct ATTRIB_PACKED { Amplification) */ } tChrony_Req_Tracking; -typedef struct ATTRIB_PACKED { uint32_t f_n_sources; } tChrony_Req_N_Sources; +typedef struct ATTRIB_PACKED { + uint32_t f_n_sources; +} tChrony_Req_N_Sources; typedef struct ATTRIB_PACKED { int32_t f_index; @@ -183,7 +187,9 @@ typedef struct ATTRIB_PACKED { } tChrony_Request; /* Chrony daemon response packets */ -typedef struct ATTRIB_PACKED { uint32_t f_n_sources; } tChrony_Resp_N_Sources; +typedef struct ATTRIB_PACKED { + uint32_t f_n_sources; +} tChrony_Resp_N_Sources; typedef struct ATTRIB_PACKED { union { diff --git a/src/collectdctl.c b/src/collectdctl.c index 1ced5838..df83b50b 100644 --- a/src/collectdctl.c +++ b/src/collectdctl.c @@ -293,8 +293,9 @@ 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) { @@ -341,8 +342,9 @@ 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)); } @@ -386,8 +388,9 @@ 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; } @@ -445,8 +448,9 @@ 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 { diff --git a/src/collectdmon.c b/src/collectdmon.c index 0e2b0214..6affd3c7 100644 --- a/src/collectdmon.c +++ b/src/collectdmon.c @@ -255,8 +255,9 @@ static void check_respawn(void) { if (counter >= 10) { unsigned int time_left = 300; - syslog(LOG_ERR, "Error: collectd is respawning too fast - " - "disabled for %i seconds", + syslog(LOG_ERR, + "Error: collectd is respawning too fast - " + "disabled for %i seconds", time_left); while (((time_left = sleep(time_left)) > 0) && loop == 0) @@ -323,7 +324,8 @@ int main(int argc, char **argv) { } struct sigaction sa = { - .sa_handler = sig_int_term_handler, .sa_flags = 0, + .sa_handler = sig_int_term_handler, + .sa_flags = 0, }; sigemptyset(&sa.sa_mask); diff --git a/src/contextswitch.c b/src/contextswitch.c index acf3a74d..cf3d3dae 100644 --- a/src/contextswitch.c +++ b/src/contextswitch.c @@ -73,7 +73,7 @@ static int cs_read(void) { } cs_submit(value); -/* #endif HAVE_SYSCTLBYNAME */ + /* #endif HAVE_SYSCTLBYNAME */ #elif KERNEL_LINUX FILE *fh; @@ -116,7 +116,7 @@ static int cs_read(void) { if (status == -2) ERROR("contextswitch plugin: Unable to find context switch value."); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_PERFSTAT int status = 0; diff --git a/src/cpu.c b/src/cpu.c index e7f3c187..09d60fe4 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -251,7 +251,7 @@ static int init(void) { INFO("cpu plugin: Found %i processor%s.", (int)cpu_list_len, cpu_list_len == 1 ? "" : "s"); -/* #endif PROCESSOR_CPU_LOAD_INFO */ + /* #endif PROCESSOR_CPU_LOAD_INFO */ #elif defined(HAVE_LIBKSTAT) kstat_t *ksp_chain; @@ -267,7 +267,7 @@ static int init(void) { ksp_chain = ksp_chain->ks_next) if (strncmp(ksp_chain->ks_module, "cpu_stat", 8) == 0) ksp[numcpu++] = ksp_chain; -/* #endif HAVE_LIBKSTAT */ + /* #endif HAVE_LIBKSTAT */ #elif CAN_USE_SYSCTL size_t numcpu_size; @@ -282,7 +282,7 @@ static int init(void) { WARNING("cpu plugin: sysctl: %s", STRERRNO); return -1; } -/* #endif CAN_USE_SYSCTL */ + /* #endif CAN_USE_SYSCTL */ #elif defined(HAVE_SYSCTLBYNAME) size_t numcpu_size; @@ -307,7 +307,7 @@ static int init(void) { "%i)", numcpu); #endif -/* #endif HAVE_SYSCTLBYNAME */ + /* #endif HAVE_SYSCTLBYNAME */ #elif defined(HAVE_LIBSTATGRAB) /* nothing to initialize */ @@ -630,7 +630,7 @@ static int cpu_read(void) { cpu_stage(cpu, COLLECTD_CPU_STATE_IDLE, (derive_t)cpu_info.cpu_ticks[CPU_STATE_IDLE], now); } -/* }}} #endif PROCESSOR_CPU_LOAD_INFO */ + /* }}} #endif PROCESSOR_CPU_LOAD_INFO */ #elif defined(KERNEL_LINUX) /* {{{ */ int cpu; @@ -708,7 +708,7 @@ static int cpu_read(void) { cpu_stage(cpu, COLLECTD_CPU_STATE_NICE, (derive_t)nice_value, now); } fclose(fh); -/* }}} #endif defined(KERNEL_LINUX) */ + /* }}} #endif defined(KERNEL_LINUX) */ #elif defined(HAVE_LIBKSTAT) /* {{{ */ static cpu_stat_t cs; @@ -729,7 +729,7 @@ static int cpu_read(void) { cpu_stage(ksp[cpu]->ks_instance, COLLECTD_CPU_STATE_WAIT, (derive_t)cs.cpu_sysinfo.cpu[CPU_WAIT], now); } -/* }}} #endif defined(HAVE_LIBKSTAT) */ + /* }}} #endif defined(HAVE_LIBKSTAT) */ #elif CAN_USE_SYSCTL /* {{{ */ uint64_t cpuinfo[numcpu][CPUSTATES]; @@ -786,10 +786,10 @@ static int cpu_read(void) { cpu_stage(i, COLLECTD_CPU_STATE_INTERRUPT, (derive_t)cpuinfo[i][CP_INTR], now); } -/* }}} #endif CAN_USE_SYSCTL */ + /* }}} #endif CAN_USE_SYSCTL */ #elif defined(HAVE_SYSCTLBYNAME) && defined(HAVE_SYSCTL_KERN_CP_TIMES) /* {{{ \ - */ + */ long cpuinfo[maxcpu][CPUSTATES]; size_t cpuinfo_size; @@ -809,7 +809,7 @@ static int cpu_read(void) { cpu_stage(i, COLLECTD_CPU_STATE_INTERRUPT, (derive_t)cpuinfo[i][CP_INTR], now); } -/* }}} #endif HAVE_SYSCTL_KERN_CP_TIMES */ + /* }}} #endif HAVE_SYSCTL_KERN_CP_TIMES */ #elif defined(HAVE_SYSCTLBYNAME) /* {{{ */ long cpuinfo[CPUSTATES]; @@ -827,7 +827,7 @@ static int cpu_read(void) { cpu_stage(0, COLLECTD_CPU_STATE_SYSTEM, (derive_t)cpuinfo[CP_SYS], now); cpu_stage(0, COLLECTD_CPU_STATE_IDLE, (derive_t)cpuinfo[CP_IDLE], now); cpu_stage(0, COLLECTD_CPU_STATE_INTERRUPT, (derive_t)cpuinfo[CP_INTR], now); -/* }}} #endif HAVE_SYSCTLBYNAME */ + /* }}} #endif HAVE_SYSCTLBYNAME */ #elif defined(HAVE_LIBSTATGRAB) /* {{{ */ sg_cpu_stats *cs; @@ -844,7 +844,7 @@ static int cpu_read(void) { cpu_state(0, COLLECTD_CPU_STATE_SYSTEM, (derive_t)cs->kernel); cpu_state(0, COLLECTD_CPU_STATE_USER, (derive_t)cs->user); cpu_state(0, COLLECTD_CPU_STATE_WAIT, (derive_t)cs->iowait); -/* }}} #endif HAVE_LIBSTATGRAB */ + /* }}} #endif HAVE_LIBSTATGRAB */ #elif defined(HAVE_PERFSTAT) /* {{{ */ perfstat_id_t id; diff --git a/src/cpusleep.c b/src/cpusleep.c index b5cbe660..ee26b0b3 100644 --- a/src/cpusleep.c +++ b/src/cpusleep.c @@ -28,7 +28,7 @@ * CPU sleep is reported in milliseconds of sleep per second of wall * time. For that, the time difference between BOOT and MONOTONIC clocks * is reported using derive type. -**/ + **/ #include "collectd.h" diff --git a/src/cpython.h b/src/cpython.h index 38951c0f..11e64fa6 100644 --- a/src/cpython.h +++ b/src/cpython.h @@ -181,7 +181,7 @@ extern PyTypeObject ValuesType; typedef struct { PluginData data; - PyObject *meta; /* dict */ + PyObject *meta; /* dict */ int severity; char message[NOTIF_MAX_MSG_LEN]; } Notification; diff --git a/src/curl.c b/src/curl.c index e3e3c174..7eb48058 100644 --- a/src/curl.c +++ b/src/curl.c @@ -541,7 +541,8 @@ static int cc_config_add_page(oconfig_item_t *ci) /* {{{ */ plugin_register_complex_read(/* group = */ NULL, cb_name, cc_read_page, interval, &(user_data_t){ - .data = page, .free_func = cc_web_page_free, + .data = page, + .free_func = cc_web_page_free, }); sfree(cb_name); diff --git a/src/curl_json.c b/src/curl_json.c index 9d01e6e3..edfaf00e 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -763,7 +763,8 @@ static int cj_config_add_url(oconfig_item_t *ci) /* {{{ */ plugin_register_complex_read(/* group = */ NULL, cb_name, cj_read, interval, &(user_data_t){ - .data = db, .free_func = cj_free, + .data = db, + .free_func = cj_free, }); sfree(cb_name); } else { diff --git a/src/curl_xml.c b/src/curl_xml.c index ce6bd468..4524ac33 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -697,8 +697,8 @@ static int cx_config_add_namespace(cx_t *db, /* {{{ */ return EINVAL; } - cx_namespace_t *ns = realloc( - db->namespaces, sizeof(*db->namespaces) * (db->namespaces_num + 1)); + cx_namespace_t *ns = realloc(db->namespaces, sizeof(*db->namespaces) * + (db->namespaces_num + 1)); if (ns == NULL) { ERROR("curl_xml plugin: realloc failed."); return ENOMEM; @@ -925,7 +925,8 @@ static int cx_config_add_url(oconfig_item_t *ci) /* {{{ */ plugin_register_complex_read(/* group = */ "curl_xml", cb_name, cx_read, /* interval = */ interval, &(user_data_t){ - .data = db, .free_func = cx_free, + .data = db, + .free_func = cx_free, }); sfree(cb_name); return 0; diff --git a/src/daemon/cmd.c b/src/daemon/cmd.c index 49f9272c..09aee6ab 100644 --- a/src/daemon/cmd.c +++ b/src/daemon/cmd.c @@ -182,7 +182,7 @@ int main(int argc, char **argv) { #ifdef KERNEL_LINUX && notify_upstart() == 0 && notify_systemd() == 0 #endif - ) { + ) { pid_t pid; if ((pid = fork()) == -1) { /* error */ diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index ae2d3270..78d410ca 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -307,11 +307,12 @@ static int do_shutdown(void) { static void read_cmdline(int argc, char **argv, struct cmdline_config *config) { /* read options */ while (1) { - int c = getopt(argc, argv, "BhtTC:" + int c = getopt(argc, argv, + "BhtTC:" #if COLLECT_DAEMON - "fP:" + "fP:" #endif - ); + ); if (c == -1) break; @@ -391,7 +392,9 @@ void stop_collectd(void) { loop++; } struct cmdline_config init_config(int argc, char **argv) { struct cmdline_config config = { - .daemonize = true, .create_basedir = true, .configfile = CONFIGFILE, + .daemonize = true, + .create_basedir = true, + .configfile = CONFIGFILE, }; read_cmdline(argc, argv, &config); diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index e760fda3..1a3c4f45 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -267,7 +267,8 @@ 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; @@ -479,9 +480,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; @@ -520,9 +521,8 @@ 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; diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c index b4e5ae72..c18b2c41 100644 --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c @@ -366,7 +366,8 @@ static int create_register_callback(llist_t **list, /* {{{ */ cf->cf_callback = callback; if (ud == NULL) { cf->cf_udata = (user_data_t){ - .data = NULL, .free_func = NULL, + .data = NULL, + .free_func = NULL, }; } else { cf->cf_udata = *ud; @@ -1294,8 +1295,10 @@ EXPORT int plugin_register_flush(const char *name, plugin_flush_cb callback, /* name = */ flush_name, /* callback = */ plugin_flush_timeout_callback, /* interval = */ ctx.flush_interval, - /* user data = */ &(user_data_t){ - .data = cb, .free_func = plugin_flush_timeout_callback_free, + /* user data = */ + &(user_data_t){ + .data = cb, + .free_func = plugin_flush_timeout_callback_free, }); sfree(flush_name); diff --git a/src/daemon/utils_cache.c b/src/daemon/utils_cache.c index c53e5d14..df358d26 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -275,7 +275,8 @@ int uc_check_timeout(void) { * plugin calls the cache interface. */ for (size_t i = 0; i < expired_num; i++) { value_list_t vl = { - .time = expired[i].time, .interval = expired[i].interval, + .time = expired[i].time, + .interval = expired[i].interval, }; if (parse_identifier_vl(expired[i].key, &vl) != 0) { diff --git a/src/disk.c b/src/disk.c index ac9b79d8..c02b6aba 100644 --- a/src/disk.c +++ b/src/disk.c @@ -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,7 +272,8 @@ 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; @@ -289,7 +290,8 @@ 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; @@ -530,7 +532,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; @@ -894,7 +896,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 @@ -942,7 +944,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; @@ -969,7 +971,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; diff --git a/src/dns.c b/src/dns.c index 7fa297b8..dad0be25 100644 --- a/src/dns.c +++ b/src/dns.c @@ -324,7 +324,8 @@ static void submit_derive(const char *type, const char *type_instance, static void submit_octets(derive_t queries, derive_t responses) { value_t values[] = { - {.derive = queries}, {.derive = responses}, + {.derive = queries}, + {.derive = responses}, }; value_list_t vl = VALUE_LIST_INIT; diff --git a/src/email.c b/src/email.c index deb66006..53602053 100644 --- a/src/email.c +++ b/src/email.c @@ -174,16 +174,18 @@ static int email_config(const char *key, const char *value) { long int tmp = strtol(value, NULL, 0); if (tmp < 1) { - fprintf(stderr, "email plugin: `MaxConns' was set to invalid " - "value %li, will use default %i.\n", + fprintf(stderr, + "email plugin: `MaxConns' was set to invalid " + "value %li, will use default %i.\n", tmp, MAX_CONNS); ERROR("email plugin: `MaxConns' was set to invalid " "value %li, will use default %i.\n", tmp, MAX_CONNS); max_conns = MAX_CONNS; } else if (tmp > MAX_CONNS_LIMIT) { - fprintf(stderr, "email plugin: `MaxConns' was set to invalid " - "value %li, will use hardcoded limit %i.\n", + fprintf(stderr, + "email plugin: `MaxConns' was set to invalid " + "value %li, will use hardcoded limit %i.\n", tmp, MAX_CONNS_LIMIT); ERROR("email plugin: `MaxConns' was set to invalid " "value %li, will use hardcoded limit %i.\n", diff --git a/src/exec.c b/src/exec.c index 7e161677..9574f2c4 100644 --- a/src/exec.c +++ b/src/exec.c @@ -754,8 +754,9 @@ static void *exec_notification_one(void *arg) /* {{{ */ else if (n->severity == NOTIF_OKAY) severity = "OKAY"; - fprintf(fh, "Severity: %s\n" - "Time: %.3f\n", + fprintf(fh, + "Severity: %s\n" + "Time: %.3f\n", severity, CDTIME_T_TO_DOUBLE(n->time)); /* Print the optional fields */ diff --git a/src/gpu_nvidia.c b/src/gpu_nvidia.c index d76e503d..f176795b 100644 --- a/src/gpu_nvidia.c +++ b/src/gpu_nvidia.c @@ -54,7 +54,8 @@ static char *nv_errline = ""; #define KEY_IGNORESELECTED "IgnoreSelected" static const char *config_keys[] = { - KEY_GPUINDEX, KEY_IGNORESELECTED, + KEY_GPUINDEX, + KEY_IGNORESELECTED, }; static const unsigned int n_config_keys = STATIC_ARRAY_SIZE(config_keys); diff --git a/src/intel_rdt_test.c b/src/intel_rdt_test.c index af5672b9..fee83841 100644 --- a/src/intel_rdt_test.c +++ b/src/intel_rdt_test.c @@ -122,7 +122,8 @@ DEF_TEST(rdt_config_ngroups__one_process) { {.value.string = "proc1", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -147,7 +148,8 @@ DEF_TEST(rdt_config_ngroups__two_groups) { {.value.string = "proc21,proc22,proc23", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -178,7 +180,8 @@ DEF_TEST(rdt_config_ngroups__too_long_proc_name) { {.value.string = "_seventeen_chars_", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -200,7 +203,8 @@ DEF_TEST(rdt_config_ngroups__duplicate_proc_name_between_groups) { {.value.string = "proc21,proc,proc23", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -221,7 +225,8 @@ DEF_TEST(rdt_config_ngroups__duplicate_proc_name_in_group) { {.value.string = "proc11,proc,proc,proc14", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -244,7 +249,8 @@ DEF_TEST(rdt_config_ngroups__empty_group) { }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ @@ -265,7 +271,8 @@ DEF_TEST(rdt_config_ngroups__empty_proc_name) { {.value.string = "proc11,,proc13", .type = OCONFIG_TYPE_STRING}, }; oconfig_item_t config_item = { - .values = values, .values_num = STATIC_ARRAY_SIZE(values), + .values = values, + .values_num = STATIC_ARRAY_SIZE(values), }; /* check */ diff --git a/src/interface.c b/src/interface.c index 5367ced3..b0d9eebb 100644 --- a/src/interface.c +++ b/src/interface.c @@ -82,7 +82,9 @@ 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); @@ -160,7 +162,8 @@ 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) @@ -188,7 +191,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 @@ -226,7 +229,7 @@ static int interface_read(void) { } freeifaddrs(if_list); -/* #endif HAVE_GETIFADDRS */ + /* #endif HAVE_GETIFADDRS */ #elif KERNEL_LINUX FILE *fh; @@ -282,7 +285,7 @@ static int interface_read(void) { } fclose(fh); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT derive_t rx; @@ -332,7 +335,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; @@ -345,7 +348,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; diff --git a/src/ipc.c b/src/ipc.c index ab4b214d..93eddaf8 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -173,8 +173,8 @@ static int ipc_init(void) /* {{{ */ pagesize_g = sysconf(_SC_PAGESIZE); return 0; } -/* }}} */ -/* #endif KERNEL_LINUX */ + /* }}} */ + /* #endif KERNEL_LINUX */ #elif KERNEL_AIX static caddr_t ipc_get_info(cid_t cid, int cmd, int version, int stsize, diff --git a/src/ipvs.c b/src/ipvs.c index 0259df80..0dcc8b36 100644 --- a/src/ipvs.c +++ b/src/ipvs.c @@ -207,7 +207,8 @@ static void cipvs_submit_connections(const char *pi, const char *ti, static void cipvs_submit_if(const char *pi, const char *t, const char *ti, derive_t rx, derive_t tx) { value_t values[] = { - {.derive = rx}, {.derive = tx}, + {.derive = rx}, + {.derive = tx}, }; value_list_t vl = VALUE_LIST_INIT; diff --git a/src/java.c b/src/java.c index cf301c6b..41f49092 100644 --- a/src/java.c +++ b/src/java.c @@ -1306,7 +1306,8 @@ static jint JNICALL cjni_api_register_read(JNIEnv *jvm_env, /* {{{ */ /* group = */ NULL, cbi->name, cjni_read, /* interval = */ 0, &(user_data_t){ - .data = cbi, .free_func = cjni_callback_info_destroy, + .data = cbi, + .free_func = cjni_callback_info_destroy, }); (*jvm_env)->DeleteLocalRef(jvm_env, o_read); @@ -1325,11 +1326,11 @@ static jint JNICALL cjni_api_register_write(JNIEnv *jvm_env, /* {{{ */ DEBUG("java plugin: Registering new write callback: %s", cbi->name); - plugin_register_write( - cbi->name, cjni_write, - &(user_data_t){ - .data = cbi, .free_func = cjni_callback_info_destroy, - }); + plugin_register_write(cbi->name, cjni_write, + &(user_data_t){ + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef(jvm_env, o_write); @@ -1347,11 +1348,11 @@ static jint JNICALL cjni_api_register_flush(JNIEnv *jvm_env, /* {{{ */ DEBUG("java plugin: Registering new flush callback: %s", cbi->name); - plugin_register_flush( - cbi->name, cjni_flush, - &(user_data_t){ - .data = cbi, .free_func = cjni_callback_info_destroy, - }); + plugin_register_flush(cbi->name, cjni_flush, + &(user_data_t){ + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef(jvm_env, o_flush); @@ -1377,7 +1378,8 @@ static jint JNICALL cjni_api_register_log(JNIEnv *jvm_env, /* {{{ */ plugin_register_log(cbi->name, cjni_log, &(user_data_t){ - .data = cbi, .free_func = cjni_callback_info_destroy, + .data = cbi, + .free_func = cjni_callback_info_destroy, }); (*jvm_env)->DeleteLocalRef(jvm_env, o_log); @@ -1397,11 +1399,11 @@ static jint JNICALL cjni_api_register_notification(JNIEnv *jvm_env, /* {{{ */ DEBUG("java plugin: Registering new notification callback: %s", cbi->name); - plugin_register_notification( - cbi->name, cjni_notification, - &(user_data_t){ - .data = cbi, .free_func = cjni_callback_info_destroy, - }); + plugin_register_notification(cbi->name, cjni_notification, + &(user_data_t){ + .data = cbi, + .free_func = cjni_callback_info_destroy, + }); (*jvm_env)->DeleteLocalRef(jvm_env, o_notification); @@ -1543,16 +1545,19 @@ static JNINativeMethod jni_api_functions[] = /* {{{ */ "(Ljava/lang/String;Lorg/collectd/api/CollectdLogInterface;)I", cjni_api_register_log}, - {"registerNotification", "(Ljava/lang/String;Lorg/collectd/api/" - "CollectdNotificationInterface;)I", + {"registerNotification", + "(Ljava/lang/String;Lorg/collectd/api/" + "CollectdNotificationInterface;)I", cjni_api_register_notification}, - {"registerMatch", "(Ljava/lang/String;Lorg/collectd/api/" - "CollectdMatchFactoryInterface;)I", + {"registerMatch", + "(Ljava/lang/String;Lorg/collectd/api/" + "CollectdMatchFactoryInterface;)I", cjni_api_register_match}, - {"registerTarget", "(Ljava/lang/String;Lorg/collectd/api/" - "CollectdTargetFactoryInterface;)I", + {"registerTarget", + "(Ljava/lang/String;Lorg/collectd/api/" + "CollectdTargetFactoryInterface;)I", cjni_api_register_target}, {"log", "(ILjava/lang/String;)V", cjni_api_log}, diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index 69f97640..a8bbe2f7 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -147,7 +147,7 @@ static char *sstrerror(int errnum, char *buf, size_t buflen) { #if !HAVE_STRERROR_R snprintf(buf, buflen, "Error #%i; strerror_r is not available.", errnum); -/* #endif !HAVE_STRERROR_R */ + /* #endif !HAVE_STRERROR_R */ #elif STRERROR_R_CHAR_P { @@ -157,17 +157,19 @@ static char *sstrerror(int errnum, char *buf, size_t buflen) { if ((temp != NULL) && (temp != buf) && (temp[0] != 0)) strncpy(buf, temp, buflen); else - strncpy(buf, "strerror_r did not return " - "an error message", + strncpy(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 */ diff --git a/src/libcollectdclient/network_parse.c b/src/libcollectdclient/network_parse.c index 4c610bb0..73ef0247 100644 --- a/src/libcollectdclient/network_parse.c +++ b/src/libcollectdclient/network_parse.c @@ -293,7 +293,8 @@ static double ntohd(double val) /* {{{ */ static int parse_values(void *payload, size_t payload_size, lcc_value_list_t *state) { buffer_t *b = &(buffer_t){ - .data = payload, .len = payload_size, + .data = payload, + .len = payload_size, }; uint16_t n; @@ -401,7 +402,8 @@ static int parse_sign_sha256(void *signature, size_t signature_len, } buffer_t *b = &(buffer_t){ - .data = signature, .len = signature_len, + .data = signature, + .len = signature_len, }; uint8_t hash[32]; @@ -459,7 +461,8 @@ static int parse_encrypt_aes256(void *data, size_t data_size, } buffer_t *b = &(buffer_t){ - .data = data, .len = data_size, + .data = data, + .len = data_size, }; uint16_t username_len; @@ -508,7 +511,8 @@ static int parse_encrypt_aes256(void *data, size_t data_size, static int network_parse(void *data, size_t data_size, lcc_security_level_t sl, lcc_network_parse_options_t const *opts) { buffer_t *b = &(buffer_t){ - .data = data, .len = data_size, + .data = data, + .len = data_size, }; lcc_value_list_t state = {0}; diff --git a/src/libcollectdclient/network_parse_test.c b/src/libcollectdclient/network_parse_test.c index a638642c..519a2c53 100644 --- a/src/libcollectdclient/network_parse_test.c +++ b/src/libcollectdclient/network_parse_test.c @@ -245,16 +245,17 @@ static int test_network_parse() { uint8_t buffer[LCC_NETWORK_BUFFER_SIZE_DEFAULT]; size_t buffer_size = sizeof(buffer); if (decode_string(raw_packet_data[i], buffer, &buffer_size)) { - fprintf(stderr, "lcc_network_parse(raw_packet_data[%" PRIsz "]):" - " decoding string failed\n", + fprintf(stderr, + "lcc_network_parse(raw_packet_data[%" PRIsz "]):" + " decoding string failed\n", i); return -1; } - int status = - lcc_network_parse(buffer, buffer_size, (lcc_network_parse_options_t){ - .writer = nop_writer, - }); + int status = lcc_network_parse(buffer, buffer_size, + (lcc_network_parse_options_t){ + .writer = nop_writer, + }); if (status != 0) { fprintf(stderr, "lcc_network_parse(raw_packet_data[%" PRIsz "]) = %d, want 0\n", @@ -466,7 +467,8 @@ static int test_decrypt_aes256() { int status = decrypt_aes256( &(buffer_t){ - .data = ciphertext, .len = ciphertext_len, + .data = ciphertext, + .len = ciphertext_len, }, iv, iv_len, "admin"); if (status != 0) { diff --git a/src/liboconfig/aux_types.h b/src/liboconfig/aux_types.h index 25b81ab6..68edce80 100644 --- a/src/liboconfig/aux_types.h +++ b/src/liboconfig/aux_types.h @@ -1,17 +1,15 @@ #ifndef AUX_TYPES_H #define AUX_TYPES_H 1 -struct statement_list_s -{ - oconfig_item_t *statement; - int statement_num; +struct statement_list_s { + oconfig_item_t *statement; + int statement_num; }; typedef struct statement_list_s statement_list_t; -struct argument_list_s -{ - oconfig_value_t *argument; - int argument_num; +struct argument_list_s { + oconfig_value_t *argument; + int argument_num; }; typedef struct argument_list_s argument_list_t; diff --git a/src/lua.c b/src/lua.c index 9a43fc71..3f48a55d 100644 --- a/src/lua.c +++ b/src/lua.c @@ -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,7 +338,8 @@ 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) diff --git a/src/madwifi.c b/src/madwifi.c index 85454c3f..723f9923 100644 --- a/src/madwifi.c +++ b/src/madwifi.c @@ -534,7 +534,8 @@ static void submit_derive(const char *dev, const char *type, const char *ti1, static void submit_derive2(const char *dev, const char *type, const char *ti1, const char *ti2, derive_t val1, derive_t val2) { value_t values[] = { - {.derive = val1}, {.derive = val2}, + {.derive = val1}, + {.derive = val2}, }; submit(dev, type, ti1, ti2, values, STATIC_ARRAY_SIZE(values)); diff --git a/src/madwifi.h b/src/madwifi.h index d6a5e355..3a7c7f0d 100644 --- a/src/madwifi.h +++ b/src/madwifi.h @@ -36,166 +36,165 @@ #ifndef MADWIFI_H #define MADWIFI_H -#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ -#define IEEE80211_RATE_VAL 0x7f -#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ -#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ - +#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */ +#define IEEE80211_RATE_VAL 0x7f +#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ +#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ /* * Per/node (station) statistics available when operating as an AP. */ struct ieee80211_nodestats { - u_int32_t ns_rx_data; /* rx data frames */ - u_int32_t ns_rx_mgmt; /* rx management frames */ - u_int32_t ns_rx_ctrl; /* rx control frames */ - u_int32_t ns_rx_ucast; /* rx unicast frames */ - u_int32_t ns_rx_mcast; /* rx multi/broadcast frames */ - u_int64_t ns_rx_bytes; /* rx data count (bytes) */ - u_int64_t ns_rx_beacons; /* rx beacon frames */ - u_int32_t ns_rx_proberesp; /* rx probe response frames */ + u_int32_t ns_rx_data; /* rx data frames */ + u_int32_t ns_rx_mgmt; /* rx management frames */ + u_int32_t ns_rx_ctrl; /* rx control frames */ + u_int32_t ns_rx_ucast; /* rx unicast frames */ + u_int32_t ns_rx_mcast; /* rx multi/broadcast frames */ + u_int64_t ns_rx_bytes; /* rx data count (bytes) */ + u_int64_t ns_rx_beacons; /* rx beacon frames */ + u_int32_t ns_rx_proberesp; /* rx probe response frames */ - u_int32_t ns_rx_dup; /* rx discard because it's a dup */ - u_int32_t ns_rx_noprivacy; /* rx w/ wep but privacy off */ - u_int32_t ns_rx_wepfail; /* rx wep processing failed */ - u_int32_t ns_rx_demicfail; /* rx demic failed */ - u_int32_t ns_rx_decap; /* rx decapsulation failed */ - u_int32_t ns_rx_defrag; /* rx defragmentation failed */ - u_int32_t ns_rx_disassoc; /* rx disassociation */ - u_int32_t ns_rx_deauth; /* rx deauthentication */ - u_int32_t ns_rx_decryptcrc; /* rx decrypt failed on crc */ - u_int32_t ns_rx_unauth; /* rx on unauthorized port */ - u_int32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */ + u_int32_t ns_rx_dup; /* rx discard because it's a dup */ + u_int32_t ns_rx_noprivacy; /* rx w/ wep but privacy off */ + u_int32_t ns_rx_wepfail; /* rx wep processing failed */ + u_int32_t ns_rx_demicfail; /* rx demic failed */ + u_int32_t ns_rx_decap; /* rx decapsulation failed */ + u_int32_t ns_rx_defrag; /* rx defragmentation failed */ + u_int32_t ns_rx_disassoc; /* rx disassociation */ + u_int32_t ns_rx_deauth; /* rx deauthentication */ + u_int32_t ns_rx_decryptcrc; /* rx decrypt failed on crc */ + u_int32_t ns_rx_unauth; /* rx on unauthorized port */ + u_int32_t ns_rx_unencrypted; /* rx unecrypted w/ privacy */ - u_int32_t ns_tx_data; /* tx data frames */ - u_int32_t ns_tx_mgmt; /* tx management frames */ - u_int32_t ns_tx_ucast; /* tx unicast frames */ - u_int32_t ns_tx_mcast; /* tx multi/broadcast frames */ - u_int64_t ns_tx_bytes; /* tx data count (bytes) */ - u_int32_t ns_tx_probereq; /* tx probe request frames */ - u_int32_t ns_tx_uapsd; /* tx on uapsd queue */ + u_int32_t ns_tx_data; /* tx data frames */ + u_int32_t ns_tx_mgmt; /* tx management frames */ + u_int32_t ns_tx_ucast; /* tx unicast frames */ + u_int32_t ns_tx_mcast; /* tx multi/broadcast frames */ + u_int64_t ns_tx_bytes; /* tx data count (bytes) */ + u_int32_t ns_tx_probereq; /* tx probe request frames */ + u_int32_t ns_tx_uapsd; /* tx on uapsd queue */ - u_int32_t ns_tx_novlantag; /* tx discard due to no tag */ - u_int32_t ns_tx_vlanmismatch; /* tx discard due to of bad tag */ + u_int32_t ns_tx_novlantag; /* tx discard due to no tag */ + u_int32_t ns_tx_vlanmismatch; /* tx discard due to of bad tag */ - u_int32_t ns_tx_eosplost; /* uapsd EOSP retried out */ + u_int32_t ns_tx_eosplost; /* uapsd EOSP retried out */ - u_int32_t ns_ps_discard; /* ps discard due to of age */ + u_int32_t ns_ps_discard; /* ps discard due to of age */ - u_int32_t ns_uapsd_triggers; /* uapsd triggers */ + u_int32_t ns_uapsd_triggers; /* uapsd triggers */ - /* MIB-related state */ - u_int32_t ns_tx_assoc; /* [re]associations */ - u_int32_t ns_tx_assoc_fail; /* [re]association failures */ - u_int32_t ns_tx_auth; /* [re]authentications */ - u_int32_t ns_tx_auth_fail; /* [re]authentication failures*/ - u_int32_t ns_tx_deauth; /* deauthentications */ - u_int32_t ns_tx_deauth_code; /* last deauth reason */ - u_int32_t ns_tx_disassoc; /* disassociations */ - u_int32_t ns_tx_disassoc_code; /* last disassociation reason */ - u_int32_t ns_psq_drops; /* power save queue drops */ + /* MIB-related state */ + u_int32_t ns_tx_assoc; /* [re]associations */ + u_int32_t ns_tx_assoc_fail; /* [re]association failures */ + u_int32_t ns_tx_auth; /* [re]authentications */ + u_int32_t ns_tx_auth_fail; /* [re]authentication failures*/ + u_int32_t ns_tx_deauth; /* deauthentications */ + u_int32_t ns_tx_deauth_code; /* last deauth reason */ + u_int32_t ns_tx_disassoc; /* disassociations */ + u_int32_t ns_tx_disassoc_code; /* last disassociation reason */ + u_int32_t ns_psq_drops; /* power save queue drops */ }; /* * Summary statistics. */ struct ieee80211_stats { - u_int32_t is_rx_badversion; /* rx frame with bad version */ - u_int32_t is_rx_tooshort; /* rx frame too short */ - u_int32_t is_rx_wrongbss; /* rx from wrong bssid */ - u_int32_t is_rx_dup; /* rx discard due to it's a dup */ - u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */ - u_int32_t is_rx_mcastecho; /* rx discard due to of mcast echo */ - u_int32_t is_rx_notassoc; /* rx discard due to sta !assoc */ - u_int32_t is_rx_noprivacy; /* rx w/ wep but privacy off */ - u_int32_t is_rx_unencrypted; /* rx w/o wep and privacy on */ - u_int32_t is_rx_wepfail; /* rx wep processing failed */ - u_int32_t is_rx_decap; /* rx decapsulation failed */ - u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */ - u_int32_t is_rx_ctl; /* rx discard ctrl frames */ - u_int32_t is_rx_beacon; /* rx beacon frames */ - u_int32_t is_rx_rstoobig; /* rx rate set truncated */ - u_int32_t is_rx_elem_missing; /* rx required element missing*/ - u_int32_t is_rx_elem_toobig; /* rx element too big */ - u_int32_t is_rx_elem_toosmall; /* rx element too small */ - u_int32_t is_rx_elem_unknown; /* rx element unknown */ - u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */ - u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */ - u_int32_t is_rx_nodealloc; /* rx frame dropped */ - u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */ - u_int32_t is_rx_auth_unsupported;/* rx w/ unsupported auth alg */ - u_int32_t is_rx_auth_fail; /* rx sta auth failure */ - u_int32_t is_rx_auth_countermeasures;/* rx auth discard due to CM */ - u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */ - u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */ - u_int32_t is_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */ - u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */ - u_int32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */ - u_int32_t is_rx_deauth; /* rx deauthentication */ - u_int32_t is_rx_disassoc; /* rx disassociation */ - u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/ - u_int32_t is_rx_nobuf; /* rx failed for lack of buf */ - u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */ - u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/ - u_int32_t is_rx_bad_auth; /* rx bad auth request */ - u_int32_t is_rx_unauth; /* rx on unauthorized port */ - u_int32_t is_rx_badkeyid; /* rx w/ incorrect keyid */ - u_int32_t is_rx_ccmpreplay; /* rx seq# violation (CCMP) */ - u_int32_t is_rx_ccmpformat; /* rx format bad (CCMP) */ - u_int32_t is_rx_ccmpmic; /* rx MIC check failed (CCMP) */ - u_int32_t is_rx_tkipreplay; /* rx seq# violation (TKIP) */ - u_int32_t is_rx_tkipformat; /* rx format bad (TKIP) */ - u_int32_t is_rx_tkipmic; /* rx MIC check failed (TKIP) */ - u_int32_t is_rx_tkipicv; /* rx ICV check failed (TKIP) */ - u_int32_t is_rx_badcipher; /* rx failed due to of key type */ - u_int32_t is_rx_nocipherctx; /* rx failed due to key !setup */ - u_int32_t is_rx_acl; /* rx discard due to of acl policy */ - u_int32_t is_rx_ffcnt; /* rx fast frames */ - u_int32_t is_rx_badathtnl; /* driver key alloc failed */ - u_int32_t is_tx_nobuf; /* tx failed for lack of buf */ - u_int32_t is_tx_nonode; /* tx failed for no node */ - u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */ - u_int32_t is_tx_badcipher; /* tx failed due to of key type */ - u_int32_t is_tx_nodefkey; /* tx failed due to no defkey */ - u_int32_t is_tx_noheadroom; /* tx failed due to no space */ - u_int32_t is_tx_ffokcnt; /* tx fast frames sent success */ - u_int32_t is_tx_fferrcnt; /* tx fast frames sent success */ - u_int32_t is_scan_active; /* active scans started */ - u_int32_t is_scan_passive; /* passive scans started */ - u_int32_t is_node_timeout; /* nodes timed out inactivity */ - u_int32_t is_crypto_nomem; /* no memory for crypto ctx */ - u_int32_t is_crypto_tkip; /* tkip crypto done in s/w */ - u_int32_t is_crypto_tkipenmic; /* tkip en-MIC done in s/w */ - u_int32_t is_crypto_tkipdemic; /* tkip de-MIC done in s/w */ - u_int32_t is_crypto_tkipcm; /* tkip counter measures */ - u_int32_t is_crypto_ccmp; /* ccmp crypto done in s/w */ - u_int32_t is_crypto_wep; /* wep crypto done in s/w */ - u_int32_t is_crypto_setkey_cipher;/* cipher rejected key */ - u_int32_t is_crypto_setkey_nokey;/* no key index for setkey */ - u_int32_t is_crypto_delkey; /* driver key delete failed */ - u_int32_t is_crypto_badcipher; /* unknown cipher */ - u_int32_t is_crypto_nocipher; /* cipher not available */ - u_int32_t is_crypto_attachfail; /* cipher attach failed */ - u_int32_t is_crypto_swfallback; /* cipher fallback to s/w */ - u_int32_t is_crypto_keyfail; /* driver key alloc failed */ - u_int32_t is_crypto_enmicfail; /* en-MIC failed */ - u_int32_t is_ibss_capmismatch; /* merge failed-cap mismatch */ - u_int32_t is_ibss_norate; /* merge failed-rate mismatch */ - u_int32_t is_ps_unassoc; /* ps-poll for unassoc. sta */ - u_int32_t is_ps_badaid; /* ps-poll w/ incorrect aid */ - u_int32_t is_ps_qempty; /* ps-poll w/ nothing to send */ + u_int32_t is_rx_badversion; /* rx frame with bad version */ + u_int32_t is_rx_tooshort; /* rx frame too short */ + u_int32_t is_rx_wrongbss; /* rx from wrong bssid */ + u_int32_t is_rx_dup; /* rx discard due to it's a dup */ + u_int32_t is_rx_wrongdir; /* rx w/ wrong direction */ + u_int32_t is_rx_mcastecho; /* rx discard due to of mcast echo */ + u_int32_t is_rx_notassoc; /* rx discard due to sta !assoc */ + u_int32_t is_rx_noprivacy; /* rx w/ wep but privacy off */ + u_int32_t is_rx_unencrypted; /* rx w/o wep and privacy on */ + u_int32_t is_rx_wepfail; /* rx wep processing failed */ + u_int32_t is_rx_decap; /* rx decapsulation failed */ + u_int32_t is_rx_mgtdiscard; /* rx discard mgt frames */ + u_int32_t is_rx_ctl; /* rx discard ctrl frames */ + u_int32_t is_rx_beacon; /* rx beacon frames */ + u_int32_t is_rx_rstoobig; /* rx rate set truncated */ + u_int32_t is_rx_elem_missing; /* rx required element missing*/ + u_int32_t is_rx_elem_toobig; /* rx element too big */ + u_int32_t is_rx_elem_toosmall; /* rx element too small */ + u_int32_t is_rx_elem_unknown; /* rx element unknown */ + u_int32_t is_rx_badchan; /* rx frame w/ invalid chan */ + u_int32_t is_rx_chanmismatch; /* rx frame chan mismatch */ + u_int32_t is_rx_nodealloc; /* rx frame dropped */ + u_int32_t is_rx_ssidmismatch; /* rx frame ssid mismatch */ + u_int32_t is_rx_auth_unsupported; /* rx w/ unsupported auth alg */ + u_int32_t is_rx_auth_fail; /* rx sta auth failure */ + u_int32_t is_rx_auth_countermeasures; /* rx auth discard due to CM */ + u_int32_t is_rx_assoc_bss; /* rx assoc from wrong bssid */ + u_int32_t is_rx_assoc_notauth; /* rx assoc w/o auth */ + u_int32_t is_rx_assoc_capmismatch; /* rx assoc w/ cap mismatch */ + u_int32_t is_rx_assoc_norate; /* rx assoc w/ no rate match */ + u_int32_t is_rx_assoc_badwpaie; /* rx assoc w/ bad WPA IE */ + u_int32_t is_rx_deauth; /* rx deauthentication */ + u_int32_t is_rx_disassoc; /* rx disassociation */ + u_int32_t is_rx_badsubtype; /* rx frame w/ unknown subtype*/ + u_int32_t is_rx_nobuf; /* rx failed for lack of buf */ + u_int32_t is_rx_decryptcrc; /* rx decrypt failed on crc */ + u_int32_t is_rx_ahdemo_mgt; /* rx discard ahdemo mgt frame*/ + u_int32_t is_rx_bad_auth; /* rx bad auth request */ + u_int32_t is_rx_unauth; /* rx on unauthorized port */ + u_int32_t is_rx_badkeyid; /* rx w/ incorrect keyid */ + u_int32_t is_rx_ccmpreplay; /* rx seq# violation (CCMP) */ + u_int32_t is_rx_ccmpformat; /* rx format bad (CCMP) */ + u_int32_t is_rx_ccmpmic; /* rx MIC check failed (CCMP) */ + u_int32_t is_rx_tkipreplay; /* rx seq# violation (TKIP) */ + u_int32_t is_rx_tkipformat; /* rx format bad (TKIP) */ + u_int32_t is_rx_tkipmic; /* rx MIC check failed (TKIP) */ + u_int32_t is_rx_tkipicv; /* rx ICV check failed (TKIP) */ + u_int32_t is_rx_badcipher; /* rx failed due to of key type */ + u_int32_t is_rx_nocipherctx; /* rx failed due to key !setup */ + u_int32_t is_rx_acl; /* rx discard due to of acl policy */ + u_int32_t is_rx_ffcnt; /* rx fast frames */ + u_int32_t is_rx_badathtnl; /* driver key alloc failed */ + u_int32_t is_tx_nobuf; /* tx failed for lack of buf */ + u_int32_t is_tx_nonode; /* tx failed for no node */ + u_int32_t is_tx_unknownmgt; /* tx of unknown mgt frame */ + u_int32_t is_tx_badcipher; /* tx failed due to of key type */ + u_int32_t is_tx_nodefkey; /* tx failed due to no defkey */ + u_int32_t is_tx_noheadroom; /* tx failed due to no space */ + u_int32_t is_tx_ffokcnt; /* tx fast frames sent success */ + u_int32_t is_tx_fferrcnt; /* tx fast frames sent success */ + u_int32_t is_scan_active; /* active scans started */ + u_int32_t is_scan_passive; /* passive scans started */ + u_int32_t is_node_timeout; /* nodes timed out inactivity */ + u_int32_t is_crypto_nomem; /* no memory for crypto ctx */ + u_int32_t is_crypto_tkip; /* tkip crypto done in s/w */ + u_int32_t is_crypto_tkipenmic; /* tkip en-MIC done in s/w */ + u_int32_t is_crypto_tkipdemic; /* tkip de-MIC done in s/w */ + u_int32_t is_crypto_tkipcm; /* tkip counter measures */ + u_int32_t is_crypto_ccmp; /* ccmp crypto done in s/w */ + u_int32_t is_crypto_wep; /* wep crypto done in s/w */ + u_int32_t is_crypto_setkey_cipher; /* cipher rejected key */ + u_int32_t is_crypto_setkey_nokey; /* no key index for setkey */ + u_int32_t is_crypto_delkey; /* driver key delete failed */ + u_int32_t is_crypto_badcipher; /* unknown cipher */ + u_int32_t is_crypto_nocipher; /* cipher not available */ + u_int32_t is_crypto_attachfail; /* cipher attach failed */ + u_int32_t is_crypto_swfallback; /* cipher fallback to s/w */ + u_int32_t is_crypto_keyfail; /* driver key alloc failed */ + u_int32_t is_crypto_enmicfail; /* en-MIC failed */ + u_int32_t is_ibss_capmismatch; /* merge failed-cap mismatch */ + u_int32_t is_ibss_norate; /* merge failed-rate mismatch */ + u_int32_t is_ps_unassoc; /* ps-poll for unassoc. sta */ + u_int32_t is_ps_badaid; /* ps-poll w/ incorrect aid */ + u_int32_t is_ps_qempty; /* ps-poll w/ nothing to send */ }; /* * Retrieve per-node statistics. */ struct ieee80211req_sta_stats { - union { - /* NB: explicitly force 64-bit alignment */ - u_int8_t macaddr[IEEE80211_ADDR_LEN]; - u_int64_t pad; - } is_u; - struct ieee80211_nodestats is_stats; + union { + /* NB: explicitly force 64-bit alignment */ + u_int8_t macaddr[IEEE80211_ADDR_LEN]; + u_int64_t pad; + } is_u; + struct ieee80211_nodestats is_stats; }; /* @@ -203,105 +202,103 @@ struct ieee80211req_sta_stats { * to retrieve other data like stats, unicast key, etc. */ struct ieee80211req_sta_info { - u_int16_t isi_len; /* length (mult of 4) */ - u_int16_t isi_freq; /* MHz */ - u_int16_t isi_flags; /* channel flags */ - u_int16_t isi_state; /* state flags */ - u_int8_t isi_authmode; /* authentication algorithm */ - u_int8_t isi_rssi; - u_int16_t isi_capinfo; /* capabilities */ - u_int8_t isi_athflags; /* Atheros capabilities */ - u_int8_t isi_erp; /* ERP element */ - u_int8_t isi_macaddr[IEEE80211_ADDR_LEN]; - u_int8_t isi_nrates; /* negotiated rates */ - u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE]; - u_int8_t isi_txrate; /* index to isi_rates[] */ - u_int16_t isi_ie_len; /* IE length */ - u_int16_t isi_associd; /* assoc response */ - u_int16_t isi_txpower; /* current tx power */ - u_int16_t isi_vlan; /* vlan tag */ - u_int16_t isi_txseqs[17]; /* seq to be transmitted */ - u_int16_t isi_rxseqs[17]; /* seq previous for qos frames*/ - u_int16_t isi_inact; /* inactivity timer */ - u_int8_t isi_uapsd; /* UAPSD queues */ - u_int8_t isi_opmode; /* sta operating mode */ + u_int16_t isi_len; /* length (mult of 4) */ + u_int16_t isi_freq; /* MHz */ + u_int16_t isi_flags; /* channel flags */ + u_int16_t isi_state; /* state flags */ + u_int8_t isi_authmode; /* authentication algorithm */ + u_int8_t isi_rssi; + u_int16_t isi_capinfo; /* capabilities */ + u_int8_t isi_athflags; /* Atheros capabilities */ + u_int8_t isi_erp; /* ERP element */ + u_int8_t isi_macaddr[IEEE80211_ADDR_LEN]; + u_int8_t isi_nrates; /* negotiated rates */ + u_int8_t isi_rates[IEEE80211_RATE_MAXSIZE]; + u_int8_t isi_txrate; /* index to isi_rates[] */ + u_int16_t isi_ie_len; /* IE length */ + u_int16_t isi_associd; /* assoc response */ + u_int16_t isi_txpower; /* current tx power */ + u_int16_t isi_vlan; /* vlan tag */ + u_int16_t isi_txseqs[17]; /* seq to be transmitted */ + u_int16_t isi_rxseqs[17]; /* seq previous for qos frames*/ + u_int16_t isi_inact; /* inactivity timer */ + u_int8_t isi_uapsd; /* UAPSD queues */ + u_int8_t isi_opmode; /* sta operating mode */ - /* XXX frag state? */ - /* variable length IE data */ + /* XXX frag state? */ + /* variable length IE data */ }; - struct ath_stats { - u_int32_t ast_watchdog; /* device reset by watchdog */ - u_int32_t ast_hardware; /* fatal hardware error interrupts */ - u_int32_t ast_bmiss; /* beacon miss interrupts */ - u_int32_t ast_rxorn; /* rx overrun interrupts */ - u_int32_t ast_rxeol; /* rx eol interrupts */ - u_int32_t ast_txurn; /* tx underrun interrupts */ - u_int32_t ast_mib; /* mib interrupts */ - u_int32_t ast_tx_packets; /* packet sent on the interface */ - u_int32_t ast_tx_mgmt; /* management frames transmitted */ - u_int32_t ast_tx_discard; /* frames discarded prior to assoc */ - u_int32_t ast_tx_invalid; /* frames discarded due to is device gone */ - u_int32_t ast_tx_qstop; /* tx queue stopped because it's full */ - u_int32_t ast_tx_encap; /* tx encapsulation failed */ - u_int32_t ast_tx_nonode; /* tx failed due to of no node */ - u_int32_t ast_tx_nobuf; /* tx failed due to of no tx buffer (data) */ - u_int32_t ast_tx_nobufmgt; /* tx failed due to of no tx buffer (mgmt)*/ - u_int32_t ast_tx_xretries; /* tx failed due to of too many retries */ - u_int32_t ast_tx_fifoerr; /* tx failed due to of FIFO underrun */ - u_int32_t ast_tx_filtered; /* tx failed due to xmit filtered */ - u_int32_t ast_tx_shortretry; /* tx on-chip retries (short) */ - u_int32_t ast_tx_longretry; /* tx on-chip retries (long) */ - u_int32_t ast_tx_badrate; /* tx failed due to of bogus xmit rate */ - u_int32_t ast_tx_noack; /* tx frames with no ack marked */ - u_int32_t ast_tx_rts; /* tx frames with rts enabled */ - u_int32_t ast_tx_cts; /* tx frames with cts enabled */ - u_int32_t ast_tx_shortpre; /* tx frames with short preamble */ - u_int32_t ast_tx_altrate; /* tx frames with alternate rate */ - u_int32_t ast_tx_protect; /* tx frames with protection */ - u_int32_t ast_rx_orn; /* rx failed due to of desc overrun */ - u_int32_t ast_rx_crcerr; /* rx failed due to of bad CRC */ - u_int32_t ast_rx_fifoerr; /* rx failed due to of FIFO overrun */ - u_int32_t ast_rx_badcrypt; /* rx failed due to of decryption */ - u_int32_t ast_rx_badmic; /* rx failed due to of MIC failure */ - u_int32_t ast_rx_phyerr; /* rx PHY error summary count */ - u_int32_t ast_rx_phy[32]; /* rx PHY error per-code counts */ - u_int32_t ast_rx_tooshort; /* rx discarded due to frame too short */ - u_int32_t ast_rx_toobig; /* rx discarded due to frame too large */ - u_int32_t ast_rx_nobuf; /* rx setup failed due to of no skbuff */ - u_int32_t ast_rx_packets; /* packet recv on the interface */ - u_int32_t ast_rx_mgt; /* management frames received */ - u_int32_t ast_rx_ctl; /* control frames received */ - int8_t ast_tx_rssi; /* tx rssi of last ack */ - int8_t ast_rx_rssi; /* rx rssi from histogram */ - u_int32_t ast_be_xmit; /* beacons transmitted */ - u_int32_t ast_be_nobuf; /* no skbuff available for beacon */ - u_int32_t ast_per_cal; /* periodic calibration calls */ - u_int32_t ast_per_calfail; /* periodic calibration failed */ - u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */ - u_int32_t ast_rate_calls; /* rate control checks */ - u_int32_t ast_rate_raise; /* rate control raised xmit rate */ - u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ - u_int32_t ast_ant_defswitch; /* rx/default antenna switches */ - u_int32_t ast_ant_txswitch; /* tx antenna switches */ - u_int32_t ast_ant_rx[8]; /* rx frames with antenna */ - u_int32_t ast_ant_tx[8]; /* tx frames with antenna */ + u_int32_t ast_watchdog; /* device reset by watchdog */ + u_int32_t ast_hardware; /* fatal hardware error interrupts */ + u_int32_t ast_bmiss; /* beacon miss interrupts */ + u_int32_t ast_rxorn; /* rx overrun interrupts */ + u_int32_t ast_rxeol; /* rx eol interrupts */ + u_int32_t ast_txurn; /* tx underrun interrupts */ + u_int32_t ast_mib; /* mib interrupts */ + u_int32_t ast_tx_packets; /* packet sent on the interface */ + u_int32_t ast_tx_mgmt; /* management frames transmitted */ + u_int32_t ast_tx_discard; /* frames discarded prior to assoc */ + u_int32_t ast_tx_invalid; /* frames discarded due to is device gone */ + u_int32_t ast_tx_qstop; /* tx queue stopped because it's full */ + u_int32_t ast_tx_encap; /* tx encapsulation failed */ + u_int32_t ast_tx_nonode; /* tx failed due to of no node */ + u_int32_t ast_tx_nobuf; /* tx failed due to of no tx buffer (data) */ + u_int32_t ast_tx_nobufmgt; /* tx failed due to of no tx buffer (mgmt)*/ + u_int32_t ast_tx_xretries; /* tx failed due to of too many retries */ + u_int32_t ast_tx_fifoerr; /* tx failed due to of FIFO underrun */ + u_int32_t ast_tx_filtered; /* tx failed due to xmit filtered */ + u_int32_t ast_tx_shortretry; /* tx on-chip retries (short) */ + u_int32_t ast_tx_longretry; /* tx on-chip retries (long) */ + u_int32_t ast_tx_badrate; /* tx failed due to of bogus xmit rate */ + u_int32_t ast_tx_noack; /* tx frames with no ack marked */ + u_int32_t ast_tx_rts; /* tx frames with rts enabled */ + u_int32_t ast_tx_cts; /* tx frames with cts enabled */ + u_int32_t ast_tx_shortpre; /* tx frames with short preamble */ + u_int32_t ast_tx_altrate; /* tx frames with alternate rate */ + u_int32_t ast_tx_protect; /* tx frames with protection */ + u_int32_t ast_rx_orn; /* rx failed due to of desc overrun */ + u_int32_t ast_rx_crcerr; /* rx failed due to of bad CRC */ + u_int32_t ast_rx_fifoerr; /* rx failed due to of FIFO overrun */ + u_int32_t ast_rx_badcrypt; /* rx failed due to of decryption */ + u_int32_t ast_rx_badmic; /* rx failed due to of MIC failure */ + u_int32_t ast_rx_phyerr; /* rx PHY error summary count */ + u_int32_t ast_rx_phy[32]; /* rx PHY error per-code counts */ + u_int32_t ast_rx_tooshort; /* rx discarded due to frame too short */ + u_int32_t ast_rx_toobig; /* rx discarded due to frame too large */ + u_int32_t ast_rx_nobuf; /* rx setup failed due to of no skbuff */ + u_int32_t ast_rx_packets; /* packet recv on the interface */ + u_int32_t ast_rx_mgt; /* management frames received */ + u_int32_t ast_rx_ctl; /* control frames received */ + int8_t ast_tx_rssi; /* tx rssi of last ack */ + int8_t ast_rx_rssi; /* rx rssi from histogram */ + u_int32_t ast_be_xmit; /* beacons transmitted */ + u_int32_t ast_be_nobuf; /* no skbuff available for beacon */ + u_int32_t ast_per_cal; /* periodic calibration calls */ + u_int32_t ast_per_calfail; /* periodic calibration failed */ + u_int32_t ast_per_rfgain; /* periodic calibration rfgain reset */ + u_int32_t ast_rate_calls; /* rate control checks */ + u_int32_t ast_rate_raise; /* rate control raised xmit rate */ + u_int32_t ast_rate_drop; /* rate control dropped xmit rate */ + u_int32_t ast_ant_defswitch; /* rx/default antenna switches */ + u_int32_t ast_ant_txswitch; /* tx antenna switches */ + u_int32_t ast_ant_rx[8]; /* rx frames with antenna */ + u_int32_t ast_ant_tx[8]; /* tx frames with antenna */ }; -#define SIOCGATHSTATS (SIOCDEVPRIVATE+0) -#define SIOCGATHDIAG (SIOCDEVPRIVATE+1) -#define SIOCGATHRADARSIG (SIOCDEVPRIVATE+2) -#define SIOCGATHHALDIAG (SIOCDEVPRIVATE+3) -#define SIOCG80211STATS (SIOCDEVPRIVATE+2) +#define SIOCGATHSTATS (SIOCDEVPRIVATE + 0) +#define SIOCGATHDIAG (SIOCDEVPRIVATE + 1) +#define SIOCGATHRADARSIG (SIOCDEVPRIVATE + 2) +#define SIOCGATHHALDIAG (SIOCDEVPRIVATE + 3) +#define SIOCG80211STATS (SIOCDEVPRIVATE + 2) /* NB: require in+out parameters so cannot use wireless extensions, yech */ -#define IEEE80211_IOCTL_GETKEY (SIOCDEVPRIVATE+3) -#define IEEE80211_IOCTL_GETWPAIE (SIOCDEVPRIVATE+4) -#define IEEE80211_IOCTL_STA_STATS (SIOCDEVPRIVATE+5) -#define IEEE80211_IOCTL_STA_INFO (SIOCDEVPRIVATE+6) -#define SIOC80211IFCREATE (SIOCDEVPRIVATE+7) -#define SIOC80211IFDESTROY (SIOCDEVPRIVATE+8) -#define IEEE80211_IOCTL_SCAN_RESULTS (SIOCDEVPRIVATE+9) - +#define IEEE80211_IOCTL_GETKEY (SIOCDEVPRIVATE + 3) +#define IEEE80211_IOCTL_GETWPAIE (SIOCDEVPRIVATE + 4) +#define IEEE80211_IOCTL_STA_STATS (SIOCDEVPRIVATE + 5) +#define IEEE80211_IOCTL_STA_INFO (SIOCDEVPRIVATE + 6) +#define SIOC80211IFCREATE (SIOCDEVPRIVATE + 7) +#define SIOC80211IFDESTROY (SIOCDEVPRIVATE + 8) +#define IEEE80211_IOCTL_SCAN_RESULTS (SIOCDEVPRIVATE + 9) #endif diff --git a/src/match_empty_counter.c b/src/match_empty_counter.c index fd87b384..799e09d5 100644 --- a/src/match_empty_counter.c +++ b/src/match_empty_counter.c @@ -73,9 +73,9 @@ static int mec_match(__attribute__((unused)) const data_set_t *ds, /* {{{ */ } /* }}} int mec_match */ void module_register(void) { - fc_register_match( - "empty_counter", - (match_proc_t){ - .create = mec_create, .destroy = mec_destroy, .match = mec_match, - }); + fc_register_match("empty_counter", (match_proc_t){ + .create = mec_create, + .destroy = mec_destroy, + .match = mec_match, + }); } /* module_register */ diff --git a/src/mcelog.c b/src/mcelog.c index 0cce0c60..d71195f0 100644 --- a/src/mcelog.c +++ b/src/mcelog.c @@ -90,14 +90,16 @@ static int socket_reinit(socket_adapter_t *self); static int socket_receive(socket_adapter_t *self, FILE **p_file); static mcelog_config_t g_mcelog_config = { - .logfile = "/var/log/mcelog", .persist = false, + .logfile = "/var/log/mcelog", + .persist = false, }; static socket_adapter_t socket_adapter = { .sock_fd = -1, .unix_sock = { - .sun_family = AF_UNIX, .sun_path = "/var/run/mcelog-client", + .sun_family = AF_UNIX, + .sun_path = "/var/run/mcelog-client", }, .lock = PTHREAD_RWLOCK_INITIALIZER, .close = socket_close, @@ -523,7 +525,8 @@ static int socket_receive(socket_adapter_t *self, FILE **pp_file) { int res = -1; pthread_rwlock_rdlock(&self->lock); struct pollfd poll_fd = { - .fd = self->sock_fd, .events = POLLIN | POLLPRI, + .fd = self->sock_fd, + .events = POLLIN | POLLPRI, }; if ((res = poll(&poll_fd, 1, MCELOG_POLL_TIMEOUT)) <= 0) { diff --git a/src/memcached.c b/src/memcached.c index 0baf6c22..89dc75f3 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -171,7 +171,8 @@ static int memcached_connect_inet(memcached_t *st) { /* Wait until connection establishes */ struct pollfd pollfd = { - .fd = fd, .events = POLLOUT, + .fd = fd, + .events = POLLOUT, }; do status = poll(&pollfd, 1, MEMCACHED_CONNECT_TIMEOUT); @@ -226,7 +227,8 @@ static int memcached_query_daemon(char *buffer, size_t buffer_size, } struct pollfd pollfd = { - .fd = st->fd, .events = POLLOUT, + .fd = st->fd, + .events = POLLOUT, }; do @@ -346,7 +348,8 @@ static void submit_derive2(const char *type, const char *type_inst, derive_t value0, derive_t value1, memcached_t *st) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.derive = value0}, {.derive = value1}, + {.derive = value0}, + {.derive = value1}, }; memcached_init_vl(&vl, st); @@ -377,7 +380,8 @@ static void submit_gauge2(const char *type, const char *type_inst, gauge_t value0, gauge_t value1, memcached_t *st) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.gauge = value0}, {.gauge = value1}, + {.gauge = value0}, + {.gauge = value1}, }; memcached_init_vl(&vl, st); @@ -685,7 +689,8 @@ static int memcached_add_read_callback(memcached_t *st) { /* callback = */ memcached_read, /* interval = */ 0, &(user_data_t){ - .data = st, .free_func = memcached_free, + .data = st, + .free_func = memcached_free, }); } /* int memcached_add_read_callback */ diff --git a/src/memory.c b/src/memory.c index 4a3a7723..10bccdee 100644 --- a/src/memory.c +++ b/src/memory.c @@ -118,7 +118,7 @@ static int memory_init(void) { #if HAVE_HOST_STATISTICS port_host = mach_host_self(); host_page_size(port_host, &pagesize); -/* #endif HAVE_HOST_STATISTICS */ + /* #endif HAVE_HOST_STATISTICS */ #elif HAVE_SYSCTLBYNAME /* no init stuff */ @@ -140,7 +140,7 @@ static int memory_init(void) { return -1; } -/* #endif HAVE_LIBKSTAT */ + /* #endif HAVE_LIBKSTAT */ #elif HAVE_SYSCTL pagesize = getpagesize(); @@ -148,7 +148,7 @@ static int memory_init(void) { ERROR("memory plugin: Invalid pagesize: %i", pagesize); return -1; } -/* #endif HAVE_SYSCTL */ + /* #endif HAVE_SYSCTL */ #elif HAVE_LIBSTATGRAB /* no init stuff */ @@ -218,7 +218,7 @@ static int memory_read_internal(value_list_t *vl) { MEMORY_SUBMIT("wired", wired, "active", active, "inactive", inactive, "free", free); -/* #endif HAVE_HOST_STATISTICS */ + /* #endif HAVE_HOST_STATISTICS */ #elif HAVE_SYSCTLBYNAME /* @@ -259,7 +259,7 @@ static int memory_read_internal(value_list_t *vl) { (gauge_t)sysctl_vals[3], "active", (gauge_t)sysctl_vals[4], "inactive", (gauge_t)sysctl_vals[5], "cache", (gauge_t)sysctl_vals[6]); -/* #endif HAVE_SYSCTLBYNAME */ + /* #endif HAVE_SYSCTLBYNAME */ #elif KERNEL_LINUX FILE *fh; @@ -334,7 +334,7 @@ static int memory_read_internal(value_list_t *vl) { else MEMORY_SUBMIT("used", mem_used, "buffered", mem_buffered, "cached", mem_cached, "free", mem_free, "slab", mem_slab_total); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT /* Most of the additions here were taken as-is from the k9toolkit from @@ -406,7 +406,7 @@ static int memory_read_internal(value_list_t *vl) { MEMORY_SUBMIT("used", (gauge_t)mem_used, "free", (gauge_t)mem_free, "locked", (gauge_t)mem_lock, "kernel", (gauge_t)mem_kern, "arc", (gauge_t)arcsize, "unusable", (gauge_t)mem_unus); -/* #endif HAVE_LIBKSTAT */ + /* #endif HAVE_LIBKSTAT */ #elif HAVE_SYSCTL int mib[] = {CTL_VM, VM_METER}; @@ -430,7 +430,7 @@ static int memory_read_internal(value_list_t *vl) { MEMORY_SUBMIT("active", mem_active, "inactive", mem_inactive, "free", mem_free); -/* #endif HAVE_SYSCTL */ + /* #endif HAVE_SYSCTL */ #elif HAVE_LIBSTATGRAB sg_mem_stats *ios; @@ -441,7 +441,7 @@ static int memory_read_internal(value_list_t *vl) { MEMORY_SUBMIT("used", (gauge_t)ios->used, "cached", (gauge_t)ios->cache, "free", (gauge_t)ios->free); -/* #endif HAVE_LIBSTATGRAB */ + /* #endif HAVE_LIBSTATGRAB */ #elif HAVE_PERFSTAT perfstat_memory_total_t pmemory = {0}; diff --git a/src/modbus.c b/src/modbus.c index 5b2509b4..e36f3dae 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -341,7 +341,7 @@ static int mb_init_connection(mb_host_t *host) /* {{{ */ host->is_connected = true; return 0; } /* }}} int mb_init_connection */ -/* #endif LEGACY_LIBMODBUS */ + /* #endif LEGACY_LIBMODBUS */ #else /* if !LEGACY_LIBMODBUS */ /* Version 2.9.2 */ @@ -1078,7 +1078,8 @@ 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); diff --git a/src/mysql.c b/src/mysql.c index 7ba10f69..aafd4dbd 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -225,7 +225,8 @@ 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); @@ -354,7 +355,8 @@ 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); diff --git a/src/netapp.c b/src/netapp.c index ae49b5e2..43aaa7a7 100644 --- a/src/netapp.c +++ b/src/netapp.c @@ -643,7 +643,8 @@ 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, @@ -666,7 +667,8 @@ 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, @@ -778,9 +780,8 @@ 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, @@ -798,15 +799,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; @@ -1406,9 +1407,8 @@ 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,9 +1422,8 @@ 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 { @@ -1466,9 +1465,8 @@ 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); @@ -2798,7 +2796,8 @@ 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; diff --git a/src/netlink.c b/src/netlink.c index e8a2877f..806265a2 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -198,7 +198,8 @@ 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; diff --git a/src/network.c b/src/network.c index f6f0ac15..cf2f8114 100644 --- a/src/network.c +++ b/src/network.c @@ -1108,7 +1108,7 @@ static int parse_part_sign_sha256(sockent_t *se, /* {{{ */ return 0; } /* }}} int parse_part_sign_sha256 */ -/* #endif HAVE_GCRYPT_H */ + /* #endif HAVE_GCRYPT_H */ #else /* if !HAVE_GCRYPT_H */ static int parse_part_sign_sha256(sockent_t *se, /* {{{ */ @@ -1263,7 +1263,7 @@ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */ return 0; } /* }}} int parse_part_encr_aes256 */ -/* #endif HAVE_GCRYPT_H */ + /* #endif HAVE_GCRYPT_H */ #else /* if !HAVE_GCRYPT_H */ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */ @@ -1668,7 +1668,7 @@ static int network_set_interface(const sockent_t *se, ERROR("network plugin: setsockopt (bind-if): %s", STRERRNO); return -1; } -/* #endif HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */ + /* #endif HAVE_IF_INDEXTONAME && SO_BINDTODEVICE */ #else WARNING("network plugin: Cannot set the interface on a unicast " diff --git a/src/nfs.c b/src/nfs.c index 320caa4a..97d91259 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -322,7 +322,7 @@ static int nfs_config(const char *key, const char *value) { #if KERNEL_LINUX static int nfs_init(void) { return 0; } -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT static int nfs_init(void) { @@ -594,7 +594,7 @@ static int nfs_read(void) { return 0; } -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT static int nfs_read(void) { diff --git a/src/nut.c b/src/nut.c index ae48692b..552359e7 100644 --- a/src/nut.c +++ b/src/nut.c @@ -100,8 +100,10 @@ static int nut_add_ups(const char *name) { /* name = */ cb_name, /* callback = */ nut_read, /* interval = */ 0, - /* user_data = */ &(user_data_t){ - .data = ups, .free_func = free_nut_ups_t, + /* user_data = */ + &(user_data_t){ + .data = ups, + .free_func = free_nut_ups_t, }); sfree(cb_name); diff --git a/src/openldap.c b/src/openldap.c index 41e2ec07..cd72cdbe 100644 --- a/src/openldap.c +++ b/src/openldap.c @@ -472,7 +472,8 @@ 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 */ diff --git a/src/ovs_stats.c b/src/ovs_stats.c index 4ec14f4f..e22e851e 100644 --- a/src/ovs_stats.c +++ b/src/ovs_stats.c @@ -282,7 +282,9 @@ 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, diff --git a/src/pcie_errors.c b/src/pcie_errors.c index 63996050..b7282eac 100644 --- a/src/pcie_errors.c +++ b/src/pcie_errors.c @@ -492,7 +492,7 @@ static void pcie_dispatch_uncorrectable_errors(pcie_device_t *dev, /* Find offset of PCI Express Capability Structure * in PCI configuration space. * Returns offset, -1 if not found. -**/ + **/ static int pcie_find_cap_exp(pcie_device_t *dev) { int pos = pcie_read8(dev, PCI_CAPABILITY_LIST) & ~3; @@ -515,7 +515,7 @@ static int pcie_find_cap_exp(pcie_device_t *dev) { /* Find offset of Advanced Error Reporting Capability. * Returns AER offset, -1 if not found. -**/ + **/ static int pcie_find_ecap_aer(pcie_device_t *dev) { int pos = PCIE_ECAP_OFFSET; uint32_t header = pcie_read32(dev, pos); diff --git a/src/processes.c b/src/processes.c index ac5ec604..f83913af 100644 --- a/src/processes.c +++ b/src/processes.c @@ -757,7 +757,7 @@ static int ps_init(void) { pset_list_len = 0; return -1; } -/* #endif HAVE_THREAD_INFO */ + /* #endif HAVE_THREAD_INFO */ #elif KERNEL_LINUX pagesize_g = sysconf(_SC_PAGESIZE); @@ -771,13 +771,13 @@ static int ps_init(void) { } } #endif -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKVM_GETPROCS && \ (HAVE_STRUCT_KINFO_PROC_FREEBSD || HAVE_STRUCT_KINFO_PROC_OPENBSD) pagesize = getpagesize(); -/* #endif HAVE_LIBKVM_GETPROCS && (HAVE_STRUCT_KINFO_PROC_FREEBSD || - * HAVE_STRUCT_KINFO_PROC_OPENBSD) */ + /* #endif HAVE_LIBKVM_GETPROCS && (HAVE_STRUCT_KINFO_PROC_FREEBSD || + * HAVE_STRUCT_KINFO_PROC_OPENBSD) */ #elif HAVE_PROCINFO_H pagesize = getpagesize(); @@ -1681,7 +1681,7 @@ static int ps_read_process(long pid, process_entry_t *ps, char *state) { /* * TODO: context switch counters for Solaris -*/ + */ ps->cswitch_vol = -1; ps->cswitch_invol = -1; @@ -2013,7 +2013,7 @@ static int ps_read(void) { for (ps = list_head_g; ps != NULL; ps = ps->next) ps_submit_proc_list(ps); -/* #endif HAVE_THREAD_INFO */ + /* #endif HAVE_THREAD_INFO */ #elif KERNEL_LINUX int running = 0; @@ -2095,7 +2095,7 @@ static int ps_read(void) { ps_submit_proc_list(ps_ptr); read_fork_rate(); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD int running = 0; @@ -2250,7 +2250,7 @@ static int ps_read(void) { for (procstat_t *ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next) ps_submit_proc_list(ps_ptr); -/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */ + /* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */ #elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_OPENBSD int running = 0; @@ -2394,7 +2394,7 @@ static int ps_read(void) { for (procstat_t *ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next) ps_submit_proc_list(ps_ptr); -/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_OPENBSD */ + /* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_OPENBSD */ #elif HAVE_PROCINFO_H /* AIX */ @@ -2533,7 +2533,7 @@ static int ps_read(void) { for (procstat_t *ps = list_head_g; ps != NULL; ps = ps->next) ps_submit_proc_list(ps); -/* #endif HAVE_PROCINFO_H */ + /* #endif HAVE_PROCINFO_H */ #elif KERNEL_SOLARIS /* diff --git a/src/protocols.c b/src/protocols.c index 8d3dafa7..7bfa663c 100644 --- a/src/protocols.c +++ b/src/protocols.c @@ -41,7 +41,8 @@ * Global variables */ static const char *config_keys[] = { - "Value", "IgnoreSelected", + "Value", + "IgnoreSelected", }; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); diff --git a/src/python.c b/src/python.c index 5669f45a..70db6b6f 100644 --- a/src/python.c +++ b/src/python.c @@ -703,8 +703,9 @@ 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); @@ -774,7 +775,8 @@ 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; @@ -817,7 +819,8 @@ 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); @@ -1201,8 +1204,9 @@ 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)); diff --git a/src/redis.c b/src/redis.c index 12f68946..77ce5fb6 100644 --- a/src/redis.c +++ b/src/redis.c @@ -123,7 +123,8 @@ 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, }); } /* }}} */ diff --git a/src/routeros.c b/src/routeros.c index fa28f044..ece865b6 100644 --- a/src/routeros.c +++ b/src/routeros.c @@ -53,7 +53,8 @@ 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; @@ -442,7 +443,8 @@ 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 */ diff --git a/src/rrdcached.c b/src/rrdcached.c index 6f34e675..1e75ff83 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -426,7 +426,8 @@ 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) { diff --git a/src/rrdtool.c b/src/rrdtool.c index f30bc267..bd5943c5 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -120,7 +120,7 @@ static int srrd_update(char *filename, char *template, int argc, return status; } /* int srrd_update */ -/* #endif HAVE_THREADSAFE_LIBRRD */ + /* #endif HAVE_THREADSAFE_LIBRRD */ #else /* !HAVE_THREADSAFE_LIBRRD */ static int srrd_update(char *filename, char *template, int argc, diff --git a/src/sensors.c b/src/sensors.c index 8d1ece9a..61868e88 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -230,7 +230,7 @@ static int sensors_load_conf(void) { last_feature = fl; } /* while sensors_get_all_features */ } /* while sensors_get_detected_chips */ -/* #endif SENSORS_API_VERSION < 0x400 */ + /* #endif SENSORS_API_VERSION < 0x400 */ #elif (SENSORS_API_VERSION >= 0x400) chip_num = 0; @@ -368,7 +368,7 @@ static int sensors_read(void) { sensors_submit(plugin_instance, sensor_type_name_map[fl->type], type_instance, value); } /* for fl = first_feature .. NULL */ -/* #endif SENSORS_API_VERSION < 0x400 */ + /* #endif SENSORS_API_VERSION < 0x400 */ #elif (SENSORS_API_VERSION >= 0x400) for (featurelist_t *fl = first_feature; fl != NULL; fl = fl->next) { diff --git a/src/serial.c b/src/serial.c index aae99789..ae6f443a 100644 --- a/src/serial.c +++ b/src/serial.c @@ -33,7 +33,8 @@ static void serial_submit(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; diff --git a/src/snmp.c b/src/snmp.c index dd7e9984..aeb04fdd 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -876,7 +876,8 @@ 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."); diff --git a/src/statsd.c b/src/statsd.c index 6c7820a1..9050596f 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -606,9 +606,8 @@ static int statsd_config_timer_percentile(oconfig_item_t *ci) /* {{{ */ return ERANGE; } - tmp = - realloc(conf_timer_percentile, - sizeof(*conf_timer_percentile) * (conf_timer_percentile_num + 1)); + tmp = realloc(conf_timer_percentile, sizeof(*conf_timer_percentile) * + (conf_timer_percentile_num + 1)); if (tmp == NULL) { ERROR("statsd plugin: realloc failed."); return ENOMEM; diff --git a/src/swap.c b/src/swap.c index 9e58919e..61c9e284 100644 --- a/src/swap.c +++ b/src/swap.c @@ -150,12 +150,12 @@ static int swap_init(void) /* {{{ */ { #if KERNEL_LINUX pagesize = (derive_t)sysconf(_SC_PAGESIZE); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS /* getpagesize(3C) tells me this does not fail.. */ pagesize = (derive_t)getpagesize(); -/* #endif HAVE_SWAPCTL */ + /* #endif HAVE_SWAPCTL */ #elif defined(VM_SWAPUSAGE) /* No init stuff */ @@ -177,7 +177,7 @@ static int swap_init(void) /* {{{ */ ERROR("swap plugin: kvm_openfiles failed, %s", errbuf); return -1; } -/* #endif HAVE_LIBKVM_GETSWAPINFO */ + /* #endif HAVE_LIBKVM_GETSWAPINFO */ #elif HAVE_LIBSTATGRAB /* No init stuff */ diff --git a/src/tail_csv.c b/src/tail_csv.c index e1d473eb..ab8bf6d5 100644 --- a/src/tail_csv.c +++ b/src/tail_csv.c @@ -482,7 +482,8 @@ static int tcsv_config_add_file(oconfig_item_t *ci) { status = plugin_register_complex_read( NULL, cb_name, tcsv_read, interval, &(user_data_t){ - .data = id, .free_func = tcsv_instance_definition_destroy, + .data = id, + .free_func = tcsv_instance_definition_destroy, }); if (status != 0) { ERROR("tail_csv plugin: Registering complex read function failed."); diff --git a/src/tape.c b/src/tape.c index ccf88255..c95ebfb4 100644 --- a/src/tape.c +++ b/src/tape.c @@ -63,7 +63,8 @@ static void tape_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; diff --git a/src/tcpconns.c b/src/tcpconns.c index d01bcd23..ae08b882 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -413,7 +413,7 @@ static int conn_handle_ports(uint16_t port_local, uint16_t port_remote, #if TCP_STATE_MIN > 0 || (state < TCP_STATE_MIN) #endif - ) { + ) { NOTICE("tcpconns plugin: Ignoring connection with " "unknown state 0x%02" PRIx8 ".", state); @@ -630,10 +630,10 @@ static int conn_read_file(const char *file) { return 0; } /* int conn_read_file */ -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_SYSCTLBYNAME -/* #endif HAVE_SYSCTLBYNAME */ + /* #endif HAVE_SYSCTLBYNAME */ #elif HAVE_LIBKVM_NLIST #endif /* HAVE_LIBKVM_NLIST */ @@ -729,7 +729,7 @@ static int conn_read(void) { return 0; } /* int conn_read */ -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_SYSCTLBYNAME static int conn_read(void) { @@ -848,8 +848,8 @@ static int conn_read(void) { return 0; } -/* int conn_read */ -/* #endif HAVE_KVM_GETFILES */ + /* int conn_read */ + /* #endif HAVE_KVM_GETFILES */ #elif HAVE_LIBKVM_NLIST static int kread(u_long addr, void *buf, int size) { @@ -966,7 +966,7 @@ static int conn_read(void) { return 0; } -/* #endif HAVE_LIBKVM_NLIST */ + /* #endif HAVE_LIBKVM_NLIST */ #elif KERNEL_AIX diff --git a/src/teamspeak2.c b/src/teamspeak2.c index 1ab6e4bf..42cc54eb 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -132,7 +132,8 @@ static void tss2_submit_io(const char *plugin_instance, const char *type, */ value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.derive = rx}, {.derive = tx}, + {.derive = rx}, + {.derive = tx}, }; vl.values = values; diff --git a/src/threshold.c b/src/threshold.c index b08d353d..e74dfc2c 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -367,8 +367,9 @@ 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 " @@ -391,8 +392,9 @@ 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", @@ -425,8 +427,9 @@ 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", diff --git a/src/turbostat.c b/src/turbostat.c index ce57942d..9465ddc0 100644 --- a/src/turbostat.c +++ b/src/turbostat.c @@ -1434,9 +1434,9 @@ static void free_all_buffers(void) { package_delta = NULL; } -/********************** - * Collectd functions * - **********************/ + /********************** + * Collectd functions * + **********************/ #define DO_OR_GOTO_ERR(something) \ do { \ diff --git a/src/uptime.c b/src/uptime.c index dd33ab38..0892bda3 100644 --- a/src/uptime.c +++ b/src/uptime.c @@ -96,7 +96,7 @@ static time_t uptime_get_sys(void) { /* {{{ */ } result = (time_t)info.uptime; -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT kstat_t *ksp; @@ -136,7 +136,7 @@ static time_t uptime_get_sys(void) { /* {{{ */ } result = time(NULL) - (time_t)knp->value.ui32; -/* #endif HAVE_LIBKSTAT */ + /* #endif HAVE_LIBKSTAT */ #elif HAVE_SYS_SYSCTL_H struct timeval boottv = {0}; @@ -161,7 +161,7 @@ static time_t uptime_get_sys(void) { /* {{{ */ } result = time(NULL) - boottv.tv_sec; -/* #endif HAVE_SYS_SYSCTL_H */ + /* #endif HAVE_SYS_SYSCTL_H */ #elif HAVE_PERFSTAT int status; diff --git a/src/users.c b/src/users.c index fc03ba2c..768d4881 100644 --- a/src/users.c +++ b/src/users.c @@ -71,7 +71,7 @@ static int users_read(void) { endutxent(); users_submit(users); -/* #endif HAVE_GETUTXENT */ + /* #endif HAVE_GETUTXENT */ #elif HAVE_GETUTENT unsigned int users = 0; @@ -89,7 +89,7 @@ static int users_read(void) { endutent(); users_submit(users); -/* #endif HAVE_GETUTENT */ + /* #endif HAVE_GETUTENT */ #elif HAVE_LIBSTATGRAB sg_user_stats *us; @@ -109,7 +109,7 @@ static int users_read(void) { #else us->num_entries); #endif -/* #endif HAVE_LIBSTATGRAB */ + /* #endif HAVE_LIBSTATGRAB */ #else #error "No applicable input method." diff --git a/src/utils/cmds/cmds_test.c b/src/utils/cmds/cmds_test.c index 6470b816..edbf5c95 100644 --- a/src/utils/cmds/cmds_test.c +++ b/src/utils/cmds/cmds_test.c @@ -57,114 +57,201 @@ 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, }, /* @@ -179,10 +266,16 @@ 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, }, }; @@ -202,9 +295,10 @@ 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, diff --git a/src/utils/common/common.c b/src/utils/common/common.c index 6ee4e081..7cfd3109 100644 --- a/src/utils/common/common.c +++ b/src/utils/common/common.c @@ -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,17 +191,19 @@ 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 */ @@ -767,8 +769,8 @@ unsigned long long htonll(unsigned long long n) { #endif /* HAVE_HTONLL */ #if FP_LAYOUT_NEED_NOTHING -/* Well, we need nothing.. */ -/* #endif FP_LAYOUT_NEED_NOTHING */ + /* Well, we need nothing.. */ + /* #endif FP_LAYOUT_NEED_NOTHING */ #elif FP_LAYOUT_NEED_ENDIANFLIP || FP_LAYOUT_NEED_INTSWAP #if FP_LAYOUT_NEED_ENDIANFLIP diff --git a/src/utils/dns/dns.c b/src/utils/dns/dns.c index 6efdcea8..981828d7 100644 --- a/src/utils/dns/dns.c +++ b/src/utils/dns/dns.c @@ -466,7 +466,7 @@ static int handle_ipv6(struct ip6_hdr *ipv6, int len) { return 1; /* Success */ } /* int handle_ipv6 */ -/* #endif HAVE_IPV6 */ + /* #endif HAVE_IPV6 */ #else /* if !HAVE_IPV6 */ static int handle_ipv6(__attribute__((unused)) void *pkg, diff --git a/src/utils/dpdk/dpdk.c b/src/utils/dpdk/dpdk.c index efc39dae..7d9f7abc 100644 --- a/src/utils/dpdk/dpdk.c +++ b/src/utils/dpdk/dpdk.c @@ -704,7 +704,8 @@ 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, diff --git a/src/utils/format_json/format_json.c b/src/utils/format_json/format_json.c index b82f21dc..ac3729ac 100644 --- a/src/utils/format_json/format_json.c +++ b/src/utils/format_json/format_json.c @@ -578,12 +578,11 @@ static int format_alert(yajl_gen g, notification_t const *n) /* {{{ */ } JSON_ADD(g, "severity"); - JSON_ADD(g, - (n->severity == NOTIF_FAILURE) - ? "FAILURE" - : (n->severity == NOTIF_WARNING) - ? "WARNING" - : (n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN"); + JSON_ADD(g, (n->severity == NOTIF_FAILURE) + ? "FAILURE" + : (n->severity == NOTIF_WARNING) + ? "WARNING" + : (n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN"); JSON_ADD(g, "service"); JSON_ADD(g, "collectd"); diff --git a/src/utils/format_json/format_json_test.c b/src/utils/format_json/format_json_test.c index d0416049..30c89bb5 100644 --- a/src/utils/format_json/format_json_test.c +++ b/src/utils/format_json/format_json_test.c @@ -131,7 +131,8 @@ static int test_string(void *ctx, unsigned char const *value, static int expect_json_labels(char *json, label_t *labels, size_t labels_num) { yajl_callbacks funcs = { - .yajl_string = test_string, .yajl_map_key = test_map_key, + .yajl_string = test_string, + .yajl_map_key = test_map_key, }; test_case_t c = {labels, labels_num, NULL}; diff --git a/src/utils/format_stackdriver/format_stackdriver_test.c b/src/utils/format_stackdriver/format_stackdriver_test.c index d4935a31..0a4f268b 100644 --- a/src/utils/format_stackdriver/format_stackdriver_test.c +++ b/src/utils/format_stackdriver/format_stackdriver_test.c @@ -27,7 +27,9 @@ DEF_TEST(sd_format_metric_descriptor) { value_list_t vl = { - .host = "example.com", .plugin = "unit-test", .type = "example", + .host = "example.com", + .plugin = "unit-test", + .type = "example", }; char got[1024]; @@ -36,7 +38,10 @@ DEF_TEST(sd_format_metric_descriptor) { .ds_num = 1, .ds = &(data_source_t){ - .name = "value", .type = DS_TYPE_GAUGE, .min = NAN, .max = NAN, + .name = "value", + .type = DS_TYPE_GAUGE, + .min = NAN, + .max = NAN, }, }; EXPECT_EQ_INT( diff --git a/src/utils/latency/latency.c b/src/utils/latency/latency.c index 12ff2ca1..e32c97b8 100644 --- a/src/utils/latency/latency.c +++ b/src/utils/latency/latency.c @@ -56,22 +56,22 @@ struct latency_counter_s { }; /* -* Histogram represents the distribution of data, it has a list of "bins". -* Each bin represents an interval and has a count (frequency) of -* number of values fall within its interval. -* -* Histogram's range is determined by the number of bins and the bin width, -* There are 1000 bins and all bins have the same width of default 1 millisecond. -* When a value above this range is added, Histogram's range is increased by -* increasing the bin width (note that number of bins remains always at 1000). -* This operation of increasing bin width is little expensive as each bin need -* to be visited to update its count. To reduce frequent change of bin width, -* new bin width will be the next nearest power of 2. Example: 2, 4, 8, 16, 32, -* 64, 128, 256, 512, 1024, 2048, 5086, ... -* -* So, if the required bin width is 300, then new bin width will be 512 as it is -* the next nearest power of 2. -*/ + * Histogram represents the distribution of data, it has a list of "bins". + * Each bin represents an interval and has a count (frequency) of + * number of values fall within its interval. + * + * Histogram's range is determined by the number of bins and the bin width, + * There are 1000 bins and all bins have the same width of default 1 + * millisecond. When a value above this range is added, Histogram's range is + * increased by increasing the bin width (note that number of bins remains + * always at 1000). This operation of increasing bin width is little expensive + * as each bin need to be visited to update its count. To reduce frequent change + * of bin width, new bin width will be the next nearest power of 2. Example: 2, + * 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 5086, ... + * + * So, if the required bin width is 300, then new bin width will be 512 as it is + * the next nearest power of 2. + */ static void change_bin_width(latency_counter_t *lc, cdtime_t latency) /* {{{ */ { /* This function is called because the new value is above histogram's range. diff --git a/src/utils/latency/latency_config.c b/src/utils/latency/latency_config.c index a5ae4719..7d614e78 100644 --- a/src/utils/latency/latency_config.c +++ b/src/utils/latency/latency_config.c @@ -124,7 +124,8 @@ int latency_config(latency_config_t *conf, oconfig_item_t *ci) { int latency_config_copy(latency_config_t *dst, const latency_config_t src) { *dst = (latency_config_t){ - .percentile_num = src.percentile_num, .buckets_num = src.buckets_num, + .percentile_num = src.percentile_num, + .buckets_num = src.buckets_num, }; dst->percentile = calloc(dst->percentile_num, sizeof(*dst->percentile)); diff --git a/src/utils/latency/latency_test.c b/src/utils/latency/latency_test.c index 13250174..89544631 100644 --- a/src/utils/latency/latency_test.c +++ b/src/utils/latency/latency_test.c @@ -159,58 +159,75 @@ DEF_TEST(get_rate) { } cases[] = { { // bucket 6 is zero - DOUBLE_TO_CDTIME_T_STATIC(0.750), DOUBLE_TO_CDTIME_T_STATIC(0.875), + DOUBLE_TO_CDTIME_T_STATIC(0.750), + DOUBLE_TO_CDTIME_T_STATIC(0.875), 0.00, }, { // bucket 7 contains the t=1 update - DOUBLE_TO_CDTIME_T_STATIC(0.875), DOUBLE_TO_CDTIME_T_STATIC(1.000), + DOUBLE_TO_CDTIME_T_STATIC(0.875), + DOUBLE_TO_CDTIME_T_STATIC(1.000), 1.00, }, { // range: bucket 7 - bucket 15; contains the t=1 and t=2 updates - DOUBLE_TO_CDTIME_T_STATIC(0.875), DOUBLE_TO_CDTIME_T_STATIC(2.000), + DOUBLE_TO_CDTIME_T_STATIC(0.875), + DOUBLE_TO_CDTIME_T_STATIC(2.000), 2.00, }, { // lower bucket is only partially applied DOUBLE_TO_CDTIME_T_STATIC(0.875 + (0.125 / 4)), - DOUBLE_TO_CDTIME_T_STATIC(2.000), 1.75, + DOUBLE_TO_CDTIME_T_STATIC(2.000), + 1.75, }, { // upper bucket is only partially applied DOUBLE_TO_CDTIME_T_STATIC(0.875), - DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)), 1.75, + DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)), + 1.75, }, { // both buckets are only partially applied DOUBLE_TO_CDTIME_T_STATIC(0.875 + (0.125 / 4)), - DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)), 1.50, + DOUBLE_TO_CDTIME_T_STATIC(2.000 - (0.125 / 4)), + 1.50, }, { // lower bound is unspecified - 0, DOUBLE_TO_CDTIME_T_STATIC(2.000), 2.00, + 0, + DOUBLE_TO_CDTIME_T_STATIC(2.000), + 2.00, }, { // upper bound is unspecified - DOUBLE_TO_CDTIME_T_STATIC(125.000 - 0.125), 0, 1.00, + DOUBLE_TO_CDTIME_T_STATIC(125.000 - 0.125), + 0, + 1.00, }, { // overflow test: upper >> longest latency - DOUBLE_TO_CDTIME_T_STATIC(1.000), DOUBLE_TO_CDTIME_T_STATIC(999999), + DOUBLE_TO_CDTIME_T_STATIC(1.000), + DOUBLE_TO_CDTIME_T_STATIC(999999), 124.00, }, { // overflow test: lower > longest latency - DOUBLE_TO_CDTIME_T_STATIC(130), 0, 0.00, + DOUBLE_TO_CDTIME_T_STATIC(130), + 0, + 0.00, }, { // lower > upper => error - DOUBLE_TO_CDTIME_T_STATIC(10), DOUBLE_TO_CDTIME_T_STATIC(9), NAN, + DOUBLE_TO_CDTIME_T_STATIC(10), + DOUBLE_TO_CDTIME_T_STATIC(9), + NAN, }, { // lower == upper => zero - DOUBLE_TO_CDTIME_T_STATIC(9), DOUBLE_TO_CDTIME_T_STATIC(9), 0.00, + DOUBLE_TO_CDTIME_T_STATIC(9), + DOUBLE_TO_CDTIME_T_STATIC(9), + 0.00, }, }; diff --git a/src/utils/mount/mount.c b/src/utils/mount/mount.c index 319c6248..1d362e1d 100644 --- a/src/utils/mount/mount.c +++ b/src/utils/mount/mount.c @@ -18,7 +18,7 @@ * * Author: * Niki W. Waibel -**/ + **/ #if HAVE_CONFIG_H #include "config.h" @@ -250,14 +250,14 @@ static void uuidcache_init(void) { if (isdigit((int)s[-1])) { /* - * Note: this is a heuristic only - there is no reason - * why these devices should live in /dev. - * Perhaps this directory should be specifiable by option. - * One might for example have /devlabel with links to /dev - * for the devices that may be accessed in this way. - * (This is useful, if the cdrom on /dev/hdc must not - * be accessed.) - */ + * Note: this is a heuristic only - there is no reason + * why these devices should live in /dev. + * Perhaps this directory should be specifiable by option. + * One might for example have /devlabel with links to /dev + * for the devices that may be accessed in this way. + * (This is useful, if the cdrom on /dev/hdc must not + * be accessed.) + */ snprintf(device, sizeof(device), "%s/%s", DEVLABELDIR, ptname); if (!get_label_uuid(device, &label, uuid)) { uuidcache_addentry(sstrdup(device), label, uuid); @@ -522,7 +522,7 @@ static cu_mount_t *cu_mount_gen_getmntent(void) { #elif HAVE_SEQ_GETMNTENT #warn "This version of `getmntent' hat not yet been implemented!" -/* #endif HAVE_SEQ_GETMNTENT */ + /* #endif HAVE_SEQ_GETMNTENT */ #elif HAVE_GETMNTENT_R static cu_mount_t *cu_mount_getmntent(void) { diff --git a/src/utils/mount/mount.h b/src/utils/mount/mount.h index 5bae546e..05adcc3e 100644 --- a/src/utils/mount/mount.h +++ b/src/utils/mount/mount.h @@ -18,7 +18,7 @@ * * Author: * Niki W. Waibel -**/ + **/ /* See below for instructions how to use the public functions. */ diff --git a/src/utils/oauth/oauth_test.c b/src/utils/oauth/oauth_test.c index aa6e99a3..36f21255 100644 --- a/src/utils/oauth/oauth_test.c +++ b/src/utils/oauth/oauth_test.c @@ -35,21 +35,29 @@ struct { } cases[] = { { "{\"access_token\":\"MaeC6kaePhie1ree\",\"expires_in\":3600}", - /* status = */ 0, "MaeC6kaePhie1ree", TIME_T_TO_CDTIME_T_STATIC(3600), + /* status = */ 0, + "MaeC6kaePhie1ree", + TIME_T_TO_CDTIME_T_STATIC(3600), }, { "{\"token_type\":\"Bearer\",\"expires_in\":1800,\"access_token\":" "\"aeThiebee2gushuY\"}", - /* status = */ 0, "aeThiebee2gushuY", TIME_T_TO_CDTIME_T_STATIC(1800), + /* status = */ 0, + "aeThiebee2gushuY", + TIME_T_TO_CDTIME_T_STATIC(1800), }, { "{\"ignored_key\":\"uaph5aewaeghi1Ge\",\"expires_in\":3600}", - /* status = */ -1, NULL, 0, + /* status = */ -1, + NULL, + 0, }, { /* expires_in missing */ "{\"access_token\":\"shaephohbie9Ahch\"}", - /* status = */ -1, NULL, 0, + /* status = */ -1, + NULL, + 0, }, }; diff --git a/src/utils/proc_pids/proc_pids.c b/src/utils/proc_pids/proc_pids.c index 336a9964..fb30172c 100644 --- a/src/utils/proc_pids/proc_pids.c +++ b/src/utils/proc_pids/proc_pids.c @@ -140,7 +140,7 @@ int pids_list_contains_pid(pids_list_t *list, const pid_t pid) { * RETURN VALUE * On success, the number of read bytes (includes stripped \n). * -1 on file open error -*/ + */ static int read_proc_name(const char *procfs_path, const struct dirent *pid_entry, char *name, const size_t out_size) { diff --git a/src/utils/rrdcreate/rrdcreate.c b/src/utils/rrdcreate/rrdcreate.c index 7a2867c5..f543e11c 100644 --- a/src/utils/rrdcreate/rrdcreate.c +++ b/src/utils/rrdcreate/rrdcreate.c @@ -343,7 +343,7 @@ static int srrd_create(const char *filename, /* {{{ */ return status; } /* }}} int srrd_create */ -/* #endif HAVE_THREADSAFE_LIBRRD */ + /* #endif HAVE_THREADSAFE_LIBRRD */ #else /* !HAVE_THREADSAFE_LIBRRD */ static int srrd_create(const char *filename, /* {{{ */ diff --git a/src/utils/taskstats/taskstats.c b/src/utils/taskstats/taskstats.c index b020c06c..348f93f3 100644 --- a/src/utils/taskstats/taskstats.c +++ b/src/utils/taskstats/taskstats.c @@ -188,7 +188,8 @@ static int get_family_id(ts_t *ts) { struct genlmsghdr *genh = mnl_nlmsg_put_extra_header(nlh, sizeof(*genh)); *genh = (struct genlmsghdr){ - .cmd = CTRL_CMD_GETFAMILY, .version = 0x01, + .cmd = CTRL_CMD_GETFAMILY, + .version = 0x01, }; mnl_attr_put_strz(nlh, CTRL_ATTR_FAMILY_NAME, TASKSTATS_GENL_NAME); diff --git a/src/utils_tail_match.h b/src/utils_tail_match.h index 0217a7e8..43d3fcfa 100644 --- a/src/utils_tail_match.h +++ b/src/utils_tail_match.h @@ -131,5 +131,5 @@ int tail_match_add_match_simple(cu_tail_match_t *obj, const char *regex, * * RETURN VALUE * Zero on success, nonzero on failure. -*/ + */ int tail_match_read(cu_tail_match_t *obj); diff --git a/src/varnish.c b/src/varnish.c index 4200c21e..f4c70af8 100644 --- a/src/varnish.c +++ b/src/varnish.c @@ -1546,7 +1546,8 @@ 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; @@ -1751,7 +1752,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); @@ -1768,7 +1769,8 @@ 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; diff --git a/src/virt.c b/src/virt.c index 7e1c8663..5c894c2a 100644 --- a/src/virt.c +++ b/src/virt.c @@ -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,107 +352,99 @@ 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 */ @@ -742,7 +734,8 @@ static char *metadata_get_hostname(virDomainPtr dom) { const char *namespace = NULL; if (hm_ns == NULL) { namespace = "http://openstack.org/xmlns/libvirt/nova/1.0"; - } else { + } // namespace =hm_ns; + else { namespace = hm_ns; } @@ -957,7 +950,8 @@ 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)); @@ -1718,7 +1712,8 @@ 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)); @@ -1802,7 +1797,8 @@ 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)); } diff --git a/src/vmem.c b/src/vmem.c index 2ab7dda7..a4112bbb 100644 --- a/src/vmem.c +++ b/src/vmem.c @@ -60,7 +60,8 @@ static void submit(const char *plugin_instance, const char *type, static void submit_two(const char *plugin_instance, const char *type, const char *type_instance, derive_t c0, derive_t c1) { value_t values[] = { - {.derive = c0}, {.derive = c1}, + {.derive = c0}, + {.derive = c1}, }; submit(plugin_instance, type, type_instance, values, diff --git a/src/vserver.c b/src/vserver.c index e1d1b352..424a2189 100644 --- a/src/vserver.c +++ b/src/vserver.c @@ -57,7 +57,8 @@ static void traffic_submit(const char *plugin_instance, derive_t tx) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.derive = rx}, {.derive = tx}, + {.derive = rx}, + {.derive = tx}, }; vl.values = values; @@ -74,7 +75,9 @@ static void load_submit(const char *plugin_instance, gauge_t snum, gauge_t mnum, gauge_t lnum) { value_list_t vl = VALUE_LIST_INIT; value_t values[] = { - {.gauge = snum}, {.gauge = mnum}, {.gauge = lnum}, + {.gauge = snum}, + {.gauge = mnum}, + {.gauge = lnum}, }; vl.values = values; diff --git a/src/write_graphite.c b/src/write_graphite.c index cb6793dd..dc3b2c74 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -552,7 +552,8 @@ static int wg_config_node(oconfig_item_t *ci) { plugin_register_write(callback_name, wg_write, &(user_data_t){ - .data = cb, .free_func = wg_callback_free, + .data = cb, + .free_func = wg_callback_free, }); plugin_register_flush(callback_name, wg_flush, &(user_data_t){.data = cb}); diff --git a/src/write_http.c b/src/write_http.c index 74fdaca0..7cd19c3b 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -815,7 +815,8 @@ static int wh_config_node(oconfig_item_t *ci) /* {{{ */ callback_name, cb->location); user_data_t user_data = { - .data = cb, .free_func = wh_callback_free, + .data = cb, + .free_func = wh_callback_free, }; if (cb->send_metrics) { diff --git a/src/write_kafka.c b/src/write_kafka.c index 592d669a..09bb639a 100644 --- a/src/write_kafka.c +++ b/src/write_kafka.c @@ -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.", diff --git a/src/write_mongodb.c b/src/write_mongodb.c index 0cb1e02f..b43906e6 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -370,11 +370,11 @@ static int wm_config_node(oconfig_item_t *ci) /* {{{ */ snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name); - status = - plugin_register_write(cb_name, wm_write, - &(user_data_t){ - .data = node, .free_func = wm_config_free, - }); + status = plugin_register_write(cb_name, wm_write, + &(user_data_t){ + .data = node, + .free_func = wm_config_free, + }); INFO("write_mongodb plugin: registered write plugin %s %d", cb_name, status); } diff --git a/src/write_prometheus.c b/src/write_prometheus.c index fe3b9407..b9040223 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -156,7 +156,8 @@ 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}, }; -- 2.11.0