aboutsummaryrefslogtreecommitdiff
path: root/arch/linux/common/filesystem.h
diff options
context:
space:
mode:
authorSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:41 -0500
committerSimon Quigley <tsimonq2@ubuntu.com>2017-06-19 14:38:41 -0500
commit11b8179a57e675c6672cbe649c655230ae3e9744 (patch)
tree2919c366d51e154e65279156fef5b4f97b8fd2f9 /arch/linux/common/filesystem.h
parent720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 (diff)
Import Upstream version 0.4.2.1
Diffstat (limited to 'arch/linux/common/filesystem.h')
-rw-r--r--arch/linux/common/filesystem.h26
1 files changed, 6 insertions, 20 deletions
diff --git a/arch/linux/common/filesystem.h b/arch/linux/common/filesystem.h
index 79784c8f..8300f278 100644
--- a/arch/linux/common/filesystem.h
+++ b/arch/linux/common/filesystem.h
@@ -20,25 +20,9 @@
* Distributed under the terms of GNU GPL 2.
*/
#include <sys/vfs.h>
-#define KB 1024
-#define MB 1048576
-#define GB 1073741824
static gchar *fs_list = NULL;
-static gchar *
-fs_human_readable(gfloat size)
-{
- if (size < KB)
- return g_strdup_printf("%.1f B", size);
- if (size < MB)
- return g_strdup_printf("%.1f KiB", size / KB);
- if (size < GB)
- return g_strdup_printf("%.1f MiB", size / MB);
-
- return g_strdup_printf("%.1f GiB", size / GB);
-}
-
static void
scan_filesystems(void)
{
@@ -63,16 +47,18 @@ scan_filesystems(void)
avail = (float) sfs.f_bsize * (float) sfs.f_bavail;
used = size - avail;
- gchar *strsize = fs_human_readable(size),
- *stravail = fs_human_readable(avail),
- *strused = fs_human_readable(used);
+ gchar *strsize = size_human_readable(size),
+ *stravail = size_human_readable(avail),
+ *strused = size_human_readable(used);
gchar *strhash;
if ((strhash = g_hash_table_lookup(moreinfo, tmp[0]))) {
g_hash_table_remove(moreinfo, tmp[0]);
g_free(strhash);
}
-
+
+ strreplace(tmp[0], "#", '_');
+
strhash = g_strdup_printf("[%s]\n"
"Filesystem=%s\n"
"Mounted As=%s\n"