summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-11-12 11:32:26 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-11-12 11:32:26 +0000
commit6fb512aba58bf221cdfcfc2a3df2148e8527883c (patch)
treee8ee8149ecf862068b7d70b2ec28ca04678227c6 /uisimulator
parent8a727cecdbb6f4efcea3a1b98cc1463825bdc499 (diff)
downloadrockbox-6fb512aba58bf221cdfcfc2a3df2148e8527883c.zip
rockbox-6fb512aba58bf221cdfcfc2a3df2148e8527883c.tar.gz
rockbox-6fb512aba58bf221cdfcfc2a3df2148e8527883c.tar.bz2
rockbox-6fb512aba58bf221cdfcfc2a3df2148e8527883c.tar.xz
Added disk space to Info menu item. (Players press + to see it.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2837 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/x11/io.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c
index 87ef6ba..2951b1f 100644
--- a/uisimulator/x11/io.c
+++ b/uisimulator/x11/io.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/vfs.h>
#include <dirent.h>
#include <fcntl.h>
@@ -107,3 +108,23 @@ int x11_open(char *name, int opts)
}
return open(name, opts);
}
+
+void fat_size(unsigned int* size, unsigned int* free)
+{
+ struct statfs fs;
+
+ if (!statfs(".", &fs)) {
+ DEBUGF("statfs: bsize=%d blocks=%d free=%d\n",
+ fs.f_bsize, fs.f_blocks, fs.f_bfree);
+ if (size)
+ *size = fs.f_blocks * (fs.f_bsize / 1024);
+ if (free)
+ *free = fs.f_bfree * (fs.f_bsize / 1024);
+ }
+ else {
+ if (size)
+ *size = 0;
+ if (free)
+ *free = 0;
+ }
+}