From d559ae3537010c937b89f909039536965d75fd14 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sat, 9 Jun 2018 18:39:37 +0100 Subject: [PATCH] Fix Linux disk usage. --- src/disks.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/disks.c b/src/disks.c index 27a4124..71d09c0 100644 --- a/src/disks.c +++ b/src/disks.c @@ -7,7 +7,10 @@ #include #include #include -#include + +#if defined(__linux__) + #include +#endif #if defined(__APPLE__) && defined(__MACH__) # define __MacOS__ @@ -77,15 +80,6 @@ disk_mount_point_get(const char *path) Eina_Bool disk_usage_get(const char *mountpoint, unsigned long *total, unsigned long *used) { -#if defined(__linux__) - struct statvfs stats; - - if (statvfs(mountpoint, &stats) < 0) - return EINA_FALSE; - - *total = stats.f_frsize * stats.f_blocks; - *used = stats.f_bsize * stats.f_bavail; -#elif defined(__FreeBSD__) || defined(__DragonFly__) struct statfs stats; if (statfs(mountpoint, &stats) < 0) @@ -93,7 +87,6 @@ disk_usage_get(const char *mountpoint, unsigned long *total, unsigned long *used *total = stats.f_bsize * stats.f_blocks; *used = *total - (stats.f_bsize * stats.f_bfree); -#endif return EINA_TRUE; }