summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2010-03-20 12:45:54 +0000
committerJens Arnold <amiconn@rockbox.org>2010-03-20 12:45:54 +0000
commit181e0e0878aac10dd9a6651842fbb59c4fed7a9b (patch)
treeb611699d63da028cfb46d7294d5cfa00ab8f0ebf
parentabce1b9927d7d2f9ae69fae1e35c4a400db7e9cf (diff)
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
-rw-r--r--uisimulator/common/io.c22
1 files 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 <stdarg.h>
#include <sys/stat.h>
#include <time.h>
-#ifdef __FreeBSD__
-#include <sys/param.h>
-#include <sys/mount.h>
-#elif defined(__APPLE__)
-#include <sys/param.h>
-#include <sys/mount.h>
-#elif !defined(WIN32)
-#include <sys/vfs.h>
+#ifndef WIN32
+#include <sys/statvfs.h>
#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 {