From 210f1efb1ec52b9f371a01b8f6ae4ce2aa219472 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 13 Apr 2019 11:20:43 +0200 Subject: Show available disk space in ZFS Applied patch: https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/desktop/mate/mate-system-monitor/patches/01-zfs.patch Requires this patch on distributions of GNU/Linux: https://gitlab.gnome.org/GNOME/libgtop/merge_requests/6 Fixes #120 --- src/sysinfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp index 5c40a2e..0290e9b 100644 --- a/src/sysinfo.cpp +++ b/src/sysinfo.cpp @@ -279,6 +279,14 @@ namespace { this->free_space_bytes = 0; for (guint i = 0; i != mountlist.number; ++i) { + if ((string(entries[i].mountdir).compare("/") == 0) && \ + (string(entries[i].type).compare("zfs") == 0)) { + // Root filesystem is ZFS based: Calculate usage based on "/". + glibtop_fsusage usage; + glibtop_get_fsusage(&usage, "/"); + this->free_space_bytes = usage.bavail * usage.block_size; + break; + } if (string(entries[i].devname).find("/dev/") != 0) continue; -- cgit v1.2.1