From ec9234cd682510ad4b56faceb977865437de9378 Mon Sep 17 00:00:00 2001 From: Zebity Spring Date: Fri, 12 Jul 2019 23:09:51 +1000 Subject: [PATCH] Run contrib/format.sh across entire *.h/*.c source tree (1st of 2) --- 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/plugin.c | 9 +- src/daemon/utils_cache.c | 3 +- src/dns.c | 3 +- src/email.c | 10 +- src/exec.c | 5 +- src/gpu_nvidia.c | 3 +- src/intel_rdt_test.c | 21 +- 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/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/network.c | 6 +- src/nfs.c | 4 +- src/nut.c | 6 +- src/pcie_errors.c | 4 +- src/processes.c | 20 +- src/sensors.c | 4 +- src/serial.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/turbostat.c | 6 +- src/uptime.c | 6 +- src/users.c | 6 +- src/utils/common/common.c | 18 +- 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/taskstats/taskstats.c | 3 +- src/utils_tail_match.h | 2 +- src/vmem.c | 3 +- src/vserver.c | 7 +- src/write_graphite.c | 3 +- src/write_http.c | 3 +- src/write_mongodb.c | 10 +- 69 files changed, 586 insertions(+), 487 deletions(-) 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/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 e63a20e5..351c3a0f 100644 --- a/src/daemon/utils_cache.c +++ b/src/daemon/utils_cache.c @@ -279,7 +279,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/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/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/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 eb804d1d..c00f53e4 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); @@ -692,7 +696,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/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/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/sensors.c b/src/sensors.c index 8d1ece9a..90f30f0c 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/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/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/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/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/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/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_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); } -- 2.11.0