summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-02-22 21:55:48 +0000
committerJens Arnold <amiconn@rockbox.org>2005-02-22 21:55:48 +0000
commit78724269a591d75cb11439a64302557be2b51f3c (patch)
treef382b9e919b92c60988d808a75216ce556dcd5ef
parent49df765c18c5d5c7a95b1406d37ece32cd45f481 (diff)
downloadrockbox-78724269a591d75cb11439a64302557be2b51f3c.tar.gz
rockbox-78724269a591d75cb11439a64302557be2b51f3c.zip
Proper disk statistics for the win32 simulator.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6042 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/common/io.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c
index 33f1091314..f735c23a70 100644
--- a/uisimulator/common/io.c
+++ b/uisimulator/common/io.c
@@ -256,8 +256,15 @@ off_t sim_filesize(int fd)
void fat_size(unsigned int* size, unsigned int* free)
{
#ifdef WIN32
- *size = 2049;
- *free = 1037;
+ long secperclus, bytespersec, free_clusters, num_clusters;
+
+ if (GetDiskFreeSpace(NULL, &secperclus, &bytespersec, &free_clusters,
+ &num_clusters)) {
+ if (size)
+ *size = num_clusters * secperclus / 2 * (bytespersec / 512);
+ if (free)
+ *free = free_clusters * secperclus / 2 * (bytespersec / 512);
+ }
#else
struct statfs fs;
@@ -269,13 +276,13 @@ void fat_size(unsigned int* size, unsigned int* free)
if (free)
*free = fs.f_bfree * (fs.f_bsize / 1024);
}
+#endif
else {
if (size)
*size = 0;
if (free)
*free = 0;
}
-#endif
}
int sim_fsync(int fd)