diff options
author | Jens Arnold <amiconn@rockbox.org> | 2010-03-20 12:45:54 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2010-03-20 12:45:54 +0000 |
commit | 181e0e0878aac10dd9a6651842fbb59c4fed7a9b (patch) | |
tree | b611699d63da028cfb46d7294d5cfa00ab8f0ebf /uisimulator | |
parent | abce1b9927d7d2f9ae69fae1e35c4a400db7e9cf (diff) | |
download | rockbox-181e0e0878aac10dd9a6651842fbb59c4fed7a9b.tar.gz rockbox-181e0e0878aac10dd9a6651842fbb59c4fed7a9b.zip |
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
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/io.c | 22 |
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 @@ | |||
25 | #include <stdarg.h> | 25 | #include <stdarg.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <time.h> | 27 | #include <time.h> |
28 | #ifdef __FreeBSD__ | 28 | #ifndef WIN32 |
29 | #include <sys/param.h> | 29 | #include <sys/statvfs.h> |
30 | #include <sys/mount.h> | ||
31 | #elif defined(__APPLE__) | ||
32 | #include <sys/param.h> | ||
33 | #include <sys/mount.h> | ||
34 | #elif !defined(WIN32) | ||
35 | #include <sys/vfs.h> | ||
36 | #endif | 30 | #endif |
37 | 31 | ||
38 | #ifdef WIN32 | 32 | #ifdef WIN32 |
@@ -472,15 +466,15 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) | |||
472 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); | 466 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); |
473 | } | 467 | } |
474 | #else | 468 | #else |
475 | struct statfs fs; | 469 | struct statvfs vfs; |
476 | 470 | ||
477 | if (!statfs(".", &fs)) { | 471 | if (!statvfs(".", &vfs)) { |
478 | DEBUGF("statfs: bsize=%d blocks=%ld free=%ld\n", | 472 | DEBUGF("statvfs: frsize=%d blocks=%ld free=%ld\n", |
479 | (int)fs.f_bsize, fs.f_blocks, fs.f_bfree); | 473 | (int)vfs.f_frsize, (long)vfs.f_blocks, (long)vfs.f_bfree); |
480 | if (size) | 474 | if (size) |
481 | *size = fs.f_blocks * (fs.f_bsize / 1024); | 475 | *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); |
482 | if (free) | 476 | if (free) |
483 | *free = fs.f_bfree * (fs.f_bsize / 1024); | 477 | *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); |
484 | } | 478 | } |
485 | #endif | 479 | #endif |
486 | else { | 480 | else { |