diff options
Diffstat (limited to 'uisimulator/common')
-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 { |