X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fdf.c;h=5b3fbd28edcc0f58c6db34bc90a53391c3675f55;hp=d8108e3f80bcbf6cd91da5337787efc63e901eaf;hb=54619dc85fd308b21ed09a0271e5c7383c7921b9;hpb=4e89060ceb1a14ec7f9abfe9caa6b0da7e76bd5c diff --git a/src/df.c b/src/df.c index d8108e3f..5b3fbd28 100644 --- a/src/df.c +++ b/src/df.c @@ -23,10 +23,10 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" -#include "utils_ignorelist.h" -#include "utils_mount.h" +#include "utils/common/common.h" +#include "utils/ignorelist/ignorelist.h" +#include "utils/mount/mount.h" #if HAVE_STATVFS #if HAVE_SYS_STATVFS_H @@ -51,9 +51,9 @@ static const char *config_keys[] = { "ReportByDevice", "ReportInodes", "ValuesAbsolute", "ValuesPercentage"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static ignorelist_t *il_device = NULL; -static ignorelist_t *il_mountpoint = NULL; -static ignorelist_t *il_fstype = NULL; +static ignorelist_t *il_device; +static ignorelist_t *il_mountpoint; +static ignorelist_t *il_fstype; static bool by_device; static bool report_inodes; @@ -99,28 +99,28 @@ static int df_config(const char *key, const char *value) { return 0; } else if (strcasecmp(key, "ReportByDevice") == 0) { if (IS_TRUE(value)) - by_device = 1; + by_device = true; return 0; } else if (strcasecmp(key, "ReportInodes") == 0) { if (IS_TRUE(value)) - report_inodes = 1; + report_inodes = true; else - report_inodes = 0; + report_inodes = false; return 0; } else if (strcasecmp(key, "ValuesAbsolute") == 0) { if (IS_TRUE(value)) - values_absolute = 1; + values_absolute = true; else - values_absolute = 0; + values_absolute = false; return 0; } else if (strcasecmp(key, "ValuesPercentage") == 0) { if (IS_TRUE(value)) - values_percentage = 1; + values_percentage = true; else - values_percentage = 0; + values_percentage = false; return 0; } @@ -225,12 +225,10 @@ static int df_read(void) { if (strcmp(mnt_ptr->dir, "/") == 0) sstrncpy(disk_name, "root", sizeof(disk_name)); else { - int len; - sstrncpy(disk_name, mnt_ptr->dir + 1, sizeof(disk_name)); - len = strlen(disk_name); + size_t len = strlen(disk_name); - for (int i = 0; i < len; i++) + for (size_t i = 0; i < len; i++) if (disk_name[i] == '/') disk_name[i] = '-'; }