From 181e0e0878aac10dd9a6651842fbb59c4fed7a9b Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 20 Mar 2010 12:45:54 +0000 Subject: Switch to using statvfs for simulated fat_size(). This makes io.c build on opensolaris, and also removes special ifdefing for freebsd and OS X. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25256 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/io.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index d3fe1a997f..20f5a368f4 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -25,14 +25,8 @@ #include #include #include -#ifdef __FreeBSD__ -#include -#include -#elif defined(__APPLE__) -#include -#include -#elif !defined(WIN32) -#include +#ifndef WIN32 +#include #endif #ifdef WIN32 @@ -472,15 +466,15 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) *free = free_clusters * secperclus / 2 * (bytespersec / 512); } #else - struct statfs fs; + struct statvfs vfs; - if (!statfs(".", &fs)) { - DEBUGF("statfs: bsize=%d blocks=%ld free=%ld\n", - (int)fs.f_bsize, fs.f_blocks, fs.f_bfree); + if (!statvfs(".", &vfs)) { + DEBUGF("statvfs: frsize=%d blocks=%ld free=%ld\n", + (int)vfs.f_frsize, (long)vfs.f_blocks, (long)vfs.f_bfree); if (size) - *size = fs.f_blocks * (fs.f_bsize / 1024); + *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); if (free) - *free = fs.f_bfree * (fs.f_bsize / 1024); + *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); } #endif else { -- cgit v1.2.3