diff options
author | Agney Lopes Roth Ferraz <agney@debian.org> | 2007-04-09 11:45:31 -0300 |
---|---|---|
committer | Simon Quigley <tsimonq2@ubuntu.com> | 2017-06-19 14:38:41 -0500 |
commit | adb3993ba087ede46f62d5f018e17b07e99b5260 (patch) | |
tree | 67b4fa7e224f09d21eb76060422ca23e50e6dfe0 /arch/linux/common/filesystem.h | |
parent | b3e31ae3787c8806f48c85a52bba9aa3554e2c07 (diff) | |
parent | 11b8179a57e675c6672cbe649c655230ae3e9744 (diff) |
Import Debian changes 0.4.2.1-1
hardinfo (0.4.2.1-1) unstable; urgency=low
* New upstream release.
* Fixed segfault on device entry (Closes: #387955)
Diffstat (limited to 'arch/linux/common/filesystem.h')
-rw-r--r-- | arch/linux/common/filesystem.h | 26 |
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" |