aboutsummaryrefslogtreecommitdiff
path: root/arch/linux/common/filesystem.h
diff options
context:
space:
mode:
authorAgney Lopes Roth Ferraz <agney@debian.org>2009-03-28 22:55:02 -0300
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:48 -0500
commit1b6665085f47e0a86e4bebd5e313a2ab63600eb4 (patch)
tree6b7dedc1886b42d07cc48359470fe3f595500cc8 /arch/linux/common/filesystem.h
parent819c0c3382b06fc0f0a1679465966f811aa2e0f8 (diff)
parent4979bb6cbbbe39eb44c32530cd13f86bf44e5d77 (diff)
Import Debian changes 0.5c-1
hardinfo (0.5c-1) unstable; urgency=low * New upstream version. (Closes: #517591, #511237, #457703, #519256, #449250, #457820, #497758)
Diffstat (limited to 'arch/linux/common/filesystem.h')
-rw-r--r--arch/linux/common/filesystem.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/linux/common/filesystem.h b/arch/linux/common/filesystem.h
index d8166fc3..1eff0818 100644
--- a/arch/linux/common/filesystem.h
+++ b/arch/linux/common/filesystem.h
@@ -1,6 +1,6 @@
/*
* HardInfo - Displays System Information
- * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@linuxmag.com.br>
+ * Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,10 +51,22 @@ scan_filesystems(void)
tmp = g_strsplit(buf, " ", 0);
if (!statfs(tmp[1], &sfs)) {
+ gfloat use_ratio;
+
size = (float) sfs.f_bsize * (float) sfs.f_blocks;
avail = (float) sfs.f_bsize * (float) sfs.f_bavail;
used = size - avail;
+ if (size == 0.0f) {
+ continue;
+ }
+
+ if (avail == 0.0f) {
+ use_ratio = 100.0f;
+ } else {
+ use_ratio = 100.0f * (used / size);
+ }
+
gchar *strsize = size_human_readable(size),
*stravail = size_human_readable(avail),
*strused = size_human_readable(used);
@@ -81,9 +93,9 @@ scan_filesystems(void)
stravail);
g_hash_table_insert(moreinfo, g_strdup_printf("FS%d", ++count), strhash);
- fs_list = h_strdup_cprintf("$FS%d$%s=%s total, %s free\n",
+ fs_list = h_strdup_cprintf("$FS%d$%s=%.2f %% (%s of %s)|%s\n",
fs_list,
- count, tmp[0], strsize, stravail);
+ count, tmp[0], use_ratio, stravail, strsize, tmp[1]);
g_free(strsize);
g_free(stravail);