X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=df.c;h=7fb319e0ba866746d7e223a4114b0f4f986dc17e;hp=c0c42f87af6c495db89c61f24c38a7e38d31f268;hb=45ae697d187c12a7ed40ae71b6a8adeda4b32b6c;hpb=985ee856a76b6cf415b2342dcfb44ac9192e5483 diff --git a/df.c b/df.c index c0c42f8..7fb319e 100644 --- a/df.c +++ b/df.c @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include #include #include @@ -6,13 +7,14 @@ #include #include "gcc-compat.h" -#include "error.h" -#include "string.h" +#include "log.h" +#include "err.h" +#include "str.h" #include "df.h" int get_disk_space(const char *path, struct disk_space *result) { - /* using floats allows to not care about integer overflows */ + /* With floats we don't need to care about integer overflows. */ float total_blocks, available_blocks, blocksize; float total_inodes, available_inodes; @@ -33,3 +35,10 @@ int get_disk_space(const char *path, struct disk_space *result) result->percent_free_inodes = 100.0 * available_inodes / total_inodes + 0.5; return 1; } + +void log_disk_space(struct disk_space *ds) +{ + DSS_INFO_LOG(("free: %uM/%uM (%u%%), %u%% inodes unused\n", + ds->free_mb, ds->total_mb, ds->percent_free, + ds->percent_free_inodes)); +}