Closed FreddieChopin closed 5 years ago
On Sun, Jan 13, 2019 at 07:39:41AM -0800, Freddie Chopin wrote:
I'm wondering whether there is a way to obtain file system statistics, most notably the size of the file system and amount of free space (or amount of used space, doesn't matter)? Something analogous to http://man7.org/linux/man-pages/man3/statvfs.3.html in POSIX and http://elm-chan.org/fsw/ff/doc/getfree.html from FatFs?
Maybe that's the info available in
ufat_bpb
asfat_size
andfat_count
?Thanks in advance!
Hi Freddie,
There's nothing implemented, but the simplest way to accomplish this would be to read over the FAT and count the number of free clusters. If you need a function like this, I'd suggest basing it on the alloc_cluster() function in ufat.c, with the behaviour for each free cluster entry changed to increment a count instead of exiting early.
Cheers, Daniel
-- Daniel Beer dlbeer@gmail.com http://dlbeer.co.nz/ PGP: BA6E 0B26 1F89 246C E3F3 C910 1E58 C43A 160A 553B
I'm wondering whether there is a way to obtain file system statistics, most notably the size of the file system and amount of free space (or amount of used space, doesn't matter)? Something analogous to http://man7.org/linux/man-pages/man3/statvfs.3.html in POSIX and http://elm-chan.org/fsw/ff/doc/getfree.html from FatFs?
Maybe that's the info available in
ufat_bpb
asfat_size
andfat_count
?Thanks in advance!