aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/arch/linux/common
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2006-11-19 14:52:38 +0000
committerLeandro A. F. Pereira <leandro@hardinfo.org>2006-11-19 14:52:38 +0000
commit8708504c28caeee4bd3e95b6b6d739970863f19c (patch)
treeede48c1cf75ce7c38ffd75a5fd4eba11a0bb1020 /hardinfo2/arch/linux/common
parentf128a3b3f241c7280339a2be8f3e6c18295bb526 (diff)
Started working on report generation without GUI.
Diffstat (limited to 'hardinfo2/arch/linux/common')
-rw-r--r--hardinfo2/arch/linux/common/filesystem.h26
1 files changed, 6 insertions, 20 deletions
diff --git a/hardinfo2/arch/linux/common/filesystem.h b/hardinfo2/arch/linux/common/filesystem.h
index 79784c8f..8300f278 100644
--- a/hardinfo2/arch/linux/common/filesystem.h
+++ b/hardinfo2/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"