summaryrefslogtreecommitdiff
path: root/components/disk.c
diff options
context:
space:
mode:
authorTobias Tschinkowitz <he4d@posteo.de>2018-05-17 12:43:21 +0200
committerAaron Marcher <me@drkhsh.at>2018-05-17 14:36:37 +0200
commit0f46c675d326435065dec2dd3a5695bd16201c9f (patch)
treeb13079fdaa69b6c91e563fefe5553e0dd03c297d /components/disk.c
parent1b3fafd77ed332e423c174f175416e14090cef75 (diff)
corrected calculations for disk space on openbsd
Diffstat (limited to 'components/disk.c')
-rw-r--r--components/disk.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/disk.c b/components/disk.c
index 8112981..bf69875 100644
--- a/components/disk.c
+++ b/components/disk.c
@@ -17,7 +17,7 @@ disk_free(const char *mnt)
}
return bprintf("%f",
- (float)fs.f_bsize * (float)fs.f_bfree / 1024 / 1024 / 1024);
+ (float)fs.f_frsize * (float)fs.f_bavail / 1024 / 1024 / 1024);
}
const char *
@@ -31,7 +31,7 @@ disk_perc(const char *mnt)
}
return bprintf("%d", (int)(100 *
- (1.0f - ((float)fs.f_bfree / (float)fs.f_blocks))));
+ (1.0f - ((float)fs.f_bavail / (float)fs.f_blocks))));
}
const char *
@@ -45,7 +45,7 @@ disk_total(const char *mnt)
}
return bprintf("%f",
- (float)fs.f_bsize * (float)fs.f_blocks / 1024 / 1024 / 1024);
+ (float)fs.f_frsize * (float)fs.f_blocks / 1024 / 1024 / 1024);
}
const char *
@@ -59,6 +59,6 @@ disk_used(const char *mnt)
}
return bprintf("%f",
- (float)fs.f_bsize * ((float)fs.f_blocks -
+ (float)fs.f_frsize * ((float)fs.f_blocks -
(float)fs.f_bfree) / 1024 / 1024 / 1024);
}