diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-11-12 11:32:26 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-11-12 11:32:26 +0000 |
commit | 6fb512aba58bf221cdfcfc2a3df2148e8527883c (patch) | |
tree | e8ee8149ecf862068b7d70b2ec28ca04678227c6 /uisimulator/x11/io.c | |
parent | 8a727cecdbb6f4efcea3a1b98cc1463825bdc499 (diff) | |
download | rockbox-6fb512aba58bf221cdfcfc2a3df2148e8527883c.tar.gz rockbox-6fb512aba58bf221cdfcfc2a3df2148e8527883c.zip |
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/x11/io.c')
-rw-r--r-- | uisimulator/x11/io.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c index 87ef6ba4b5..2951b1f4a0 100644 --- a/uisimulator/x11/io.c +++ b/uisimulator/x11/io.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <sys/stat.h> | 23 | #include <sys/stat.h> |
24 | #include <sys/vfs.h> | ||
24 | #include <dirent.h> | 25 | #include <dirent.h> |
25 | 26 | ||
26 | #include <fcntl.h> | 27 | #include <fcntl.h> |
@@ -107,3 +108,23 @@ int x11_open(char *name, int opts) | |||
107 | } | 108 | } |
108 | return open(name, opts); | 109 | return open(name, opts); |
109 | } | 110 | } |
111 | |||
112 | void fat_size(unsigned int* size, unsigned int* free) | ||
113 | { | ||
114 | struct statfs fs; | ||
115 | |||
116 | if (!statfs(".", &fs)) { | ||
117 | DEBUGF("statfs: bsize=%d blocks=%d free=%d\n", | ||
118 | fs.f_bsize, fs.f_blocks, fs.f_bfree); | ||
119 | if (size) | ||
120 | *size = fs.f_blocks * (fs.f_bsize / 1024); | ||
121 | if (free) | ||
122 | *free = fs.f_bfree * (fs.f_bsize / 1024); | ||
123 | } | ||
124 | else { | ||
125 | if (size) | ||
126 | *size = 0; | ||
127 | if (free) | ||
128 | *free = 0; | ||
129 | } | ||
130 | } | ||