Use fs size from statvfs if the backend did not provide it

This commit is contained in:
Davide Andreoli 2015-01-10 21:10:38 +01:00
parent 63017167e0
commit 1208a59790
1 changed files with 5 additions and 2 deletions

View File

@ -495,7 +495,7 @@ places_run_fm(const char *directory)
/* Internals */
static unsigned long long
_places_free_space_get(const char *mount)
_places_free_space_get(const char *mount, Volume *vol)
{
struct statvfs s;
@ -503,6 +503,9 @@ _places_free_space_get(const char *mount)
if (statvfs(mount, &s) != 0)
return 0;
if ((vol->size == 0) && (s.f_blocks))
vol->size = (unsigned long long)s.f_blocks * (unsigned long long)s.f_frsize;
return (unsigned long long)s.f_bavail * (unsigned long long)s.f_frsize;
}
@ -516,7 +519,7 @@ _places_poller(void *data)
EINA_LIST_FOREACH(volumes, l, vol)
if (vol->valid && vol->mounted)
{
new = _places_free_space_get(vol->mount_point);
new = _places_free_space_get(vol->mount_point, vol);
// redraw only if the size has changed more that 1Mb
if (abs(new - vol->free_space) > 1024 * 1024)
{