mirror of
https://github.com/pikami/slstatus.git
synced 2024-12-02 16:25:42 +00:00
disk_perc: Simplify
This commit is contained in:
parent
b3330d849d
commit
4fc4983502
@ -23,7 +23,6 @@ disk_free(const char *mnt)
|
|||||||
const char *
|
const char *
|
||||||
disk_perc(const char *mnt)
|
disk_perc(const char *mnt)
|
||||||
{
|
{
|
||||||
int perc;
|
|
||||||
struct statvfs fs;
|
struct statvfs fs;
|
||||||
|
|
||||||
if (statvfs(mnt, &fs) < 0) {
|
if (statvfs(mnt, &fs) < 0) {
|
||||||
@ -31,9 +30,8 @@ disk_perc(const char *mnt)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
perc = 100 * (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks));
|
return bprintf("%d", 100 *
|
||||||
|
(1.0f - ((float)fs.f_bfree / (float)fs.f_blocks)));
|
||||||
return bprintf("%d", perc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
Loading…
Reference in New Issue
Block a user