X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/80fc20d1d69b14f36ad9bb64d8af38481cbf1ff5..cf2b604507a71c61e757d7bf85458c7300eb3cf5:/components/disk.c diff --git a/components/disk.c b/components/disk.c index f4031ea..f3c96d5 100644 --- a/components/disk.c +++ b/components/disk.c @@ -16,8 +16,7 @@ disk_free(const char *mnt) return NULL; } - return bprintf("%f", - (float)fs.f_frsize * (float)fs.f_bavail / 1024 / 1024 / 1024); + return fmt_human(fs.f_frsize * fs.f_bavail, 1024); } const char * @@ -44,8 +43,7 @@ disk_total(const char *mnt) return NULL; } - return bprintf("%f", - (float)fs.f_frsize * (float)fs.f_blocks / 1024 / 1024 / 1024); + return fmt_human(fs.f_frsize * fs.f_blocks, 1024); } const char * @@ -58,7 +56,5 @@ disk_used(const char *mnt) return NULL; } - return bprintf("%f", - (float)fs.f_frsize * ((float)fs.f_blocks - - (float)fs.f_bfree) / 1024 / 1024 / 1024); + return fmt_human(fs.f_frsize * (fs.f_blocks - fs.f_bfree), 1024); }