summaryrefslogtreecommitdiff
path: root/src/sysinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysinfo.cpp')
-rw-r--r--src/sysinfo.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index 65e2e07..39d5f8c 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -355,11 +355,12 @@ namespace {
void load_disk_info()
{
+ GHashTable *devices;
glibtop_mountentry *entries;
glibtop_mountlist mountlist;
entries = glibtop_get_mountlist(&mountlist, 0);
-
+ devices = g_hash_table_new(g_str_hash, g_str_equal);
this->free_space_bytes = 0;
for (guint i = 0; i != mountlist.number; ++i) {
@@ -378,11 +379,18 @@ namespace {
if (string(entries[i].mountdir).find("/media/") == 0)
continue;
+ /* avoid adding a device more than once such as for btrfs filesystem */
+ if (g_hash_table_contains (devices, entries[i].devname))
+ continue;
+ else
+ g_hash_table_insert (devices, entries[i].devname, entries[i].mountdir);
+
glibtop_fsusage usage;
glibtop_get_fsusage(&usage, entries[i].mountdir);
this->free_space_bytes += usage.bavail * usage.block_size;
}
+ g_hash_table_destroy (devices);
g_free(entries);
}