diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/print_disk_info.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/print_disk_info.c b/src/print_disk_info.c index 5f510a0..4c23c7a 100644 --- a/src/print_disk_info.c +++ b/src/print_disk_info.c @@ -73,9 +73,9 @@ static bool below_threshold(struct statvfs buf, const char *prefix_type, const c } else if (strcasecmp(threshold_type, "percentage_avail") == 0) { return 100.0 * (double)buf.f_bavail / (double)buf.f_blocks < low_threshold; } else if (strcasecmp(threshold_type, "bytes_free") == 0) { - return (double)buf.f_bsize * (double)buf.f_bfree < low_threshold; + return (double)buf.f_frsize * (double)buf.f_bfree < low_threshold; } else if (strcasecmp(threshold_type, "bytes_avail") == 0) { - return (double)buf.f_bsize * (double)buf.f_bavail < low_threshold; + return (double)buf.f_frsize * (double)buf.f_bavail < low_threshold; } else if (threshold_type[0] != '\0' && strncasecmp(threshold_type + 1, "bytes_", strlen("bytes_")) == 0) { uint64_t base = strcasecmp(prefix_type, "decimal") == 0 ? DECIMAL_BASE : BINARY_BASE; double factor = 1; @@ -187,10 +187,10 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch char string_percentage_used[STRING_SIZE]; char string_percentage_avail[STRING_SIZE]; - print_bytes_human(string_free, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bfree, prefix_type); - print_bytes_human(string_used, (uint64_t)buf.f_bsize * ((uint64_t)buf.f_blocks - (uint64_t)buf.f_bfree), prefix_type); - print_bytes_human(string_total, (uint64_t)buf.f_bsize * (uint64_t)buf.f_blocks, prefix_type); - print_bytes_human(string_avail, (uint64_t)buf.f_bsize * (uint64_t)buf.f_bavail, prefix_type); + print_bytes_human(string_free, (uint64_t)buf.f_frsize * (uint64_t)buf.f_bfree, prefix_type); + print_bytes_human(string_used, (uint64_t)buf.f_frsize * ((uint64_t)buf.f_blocks - (uint64_t)buf.f_bfree), prefix_type); + print_bytes_human(string_total, (uint64_t)buf.f_frsize * (uint64_t)buf.f_blocks, prefix_type); + print_bytes_human(string_avail, (uint64_t)buf.f_frsize * (uint64_t)buf.f_bavail, prefix_type); snprintf(string_percentage_free, STRING_SIZE, "%.01f%s", 100.0 * (double)buf.f_bfree / (double)buf.f_blocks, pct_mark); snprintf(string_percentage_used_of_avail, STRING_SIZE, "%.01f%s", 100.0 * (double)(buf.f_blocks - buf.f_bavail) / (double)buf.f_blocks, pct_mark); snprintf(string_percentage_used, STRING_SIZE, "%.01f%s", 100.0 * (double)(buf.f_blocks - buf.f_bfree) / (double)buf.f_blocks, pct_mark); |