1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Björn Stenberg 2002-11-12 11:32:26 +00:00
parent 8a727cecdb
commit 6fb512aba5
5 changed files with 105 additions and 37 deletions

View file

@ -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;
}
}