aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/arch/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'hardinfo2/arch/linux/common')
-rw-r--r--hardinfo2/arch/linux/common/boots.h7
-rw-r--r--hardinfo2/arch/linux/common/filesystem.h16
2 files changed, 17 insertions, 6 deletions
diff --git a/hardinfo2/arch/linux/common/boots.h b/hardinfo2/arch/linux/common/boots.h
index b5285a9f..8a3c11fa 100644
--- a/hardinfo2/arch/linux/common/boots.h
+++ b/hardinfo2/arch/linux/common/boots.h
@@ -47,11 +47,10 @@ scan_boots_real(void)
}
}
- tmp = g_strsplit(buffer, " ", 5);
- computer->os->boots = h_strdup_cprintf("\n%s=Kernel %s",
+ tmp = g_strsplit(buffer, " ", 0);
+ computer->os->boots = h_strdup_cprintf("\n%s %s %s %s=%s|%s",
computer->os->boots,
- tmp[4],
- tmp[3]);
+ tmp[4], tmp[5], tmp[6], tmp[7], tmp[3], tmp[8]);
g_strfreev(tmp);
}
}
diff --git a/hardinfo2/arch/linux/common/filesystem.h b/hardinfo2/arch/linux/common/filesystem.h
index b3008387..0224e962 100644
--- a/hardinfo2/arch/linux/common/filesystem.h
+++ b/hardinfo2/arch/linux/common/filesystem.h
@@ -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|%s\n",
+ fs_list = h_strdup_cprintf("$FS%d$%s=%.2f|%s|%s\n",
fs_list,
- count, tmp[0], stravail, strsize);
+ count, tmp[0], use_ratio, strsize, stravail);
g_free(strsize);
g_free(stravail);