[hackers] [slstatus] corrected calculations for disk space on openbsd || Tobias Tschinkowitz

From: <git_AT_suckless.org>
Date: Thu, 17 May 2018 14:40:20 +0200 (CEST)

commit 0f46c675d326435065dec2dd3a5695bd16201c9f
Author: Tobias Tschinkowitz <he4d_AT_posteo.de>
AuthorDate: Thu May 17 12:43:21 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Thu May 17 14:36:37 2018 +0200

    corrected calculations for disk space on openbsd

diff --git a/components/disk.c b/components/disk.c
index 8112981..bf69875 100644
--- a/components/disk.c
+++ b/components/disk.c
_AT_@ -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 *
_AT_@ -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 *
_AT_@ -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 *
_AT_@ -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);
 }
Received on Thu May 17 2018 - 14:40:20 CEST

This archive was generated by hypermail 2.3.0 : Thu May 17 2018 - 14:48:29 CEST