X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fmd.c;h=016e6b0cbe5ef5370465f392453413b50f42054a;hp=94965e6e42a7d71a96acd3a097735de6b0efd6bc;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=79963d13c1884d1d92667cc502ad20758b084a12 diff --git a/src/md.c b/src/md.c index 94965e6e..016e6b0c 100644 --- a/src/md.c +++ b/src/md.c @@ -46,31 +46,27 @@ static int md_config(const char *key, const char *value) { if (ignorelist == NULL) ignorelist = ignorelist_create(/* invert = */ 1); if (ignorelist == NULL) - return (1); + return 1; if (strcasecmp(key, "Device") == 0) { ignorelist_add(ignorelist, value); } else if (strcasecmp(key, "IgnoreSelected") == 0) { ignorelist_set_invert(ignorelist, IS_TRUE(value) ? 0 : 1); } else { - return (-1); + return -1; } - return (0); + return 0; } static void md_submit(const int minor, const char *type_instance, gauge_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = value; - - vl.values = values; + vl.values = &(value_t){.gauge = value}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "md", sizeof(vl.plugin)); - ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", minor); + snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", minor); sstrncpy(vl.type, "md_disks", sizeof(vl.type)); sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance)); @@ -153,7 +149,7 @@ static int md_read(void) { char errbuf[1024]; WARNING("md: Unable to open %s: %s", PROC_DISKSTATS, sstrerror(errno, errbuf, sizeof(errbuf))); - return (-1); + return -1; } /* Iterate md devices */ @@ -184,14 +180,14 @@ static int md_read(void) { * major/minor, but that again can be tricky if the filesystem * with the device file is mounted using the "nodev" option. */ - ssnprintf(path, sizeof(path), "%s/%s", DEV_DIR, name); + snprintf(path, sizeof(path), "%s/%s", DEV_DIR, name); md_process(minor, path); } fclose(fh); - return (0); + return 0; } /* int md_read */ void module_register(void) {