Code: Select all
>>> os.statvfs('/')
(32768, 32768, 30212096, 472032, 472032, 0, 0, 0, 0, 255)
https://raw.githubusercontent.com/hosak ... /vfs_fat.c
I found this section of code (please scroll down):
Code: Select all
STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
(void)vfs_in;
const char *path = mp_obj_str_get_str(path_in);
FATFS *fatfs;
DWORD nclst;
FRESULT res = f_getfree(path, &nclst, &fatfs);
if (FR_OK != res) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError,
MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * fatfs->ssize); // f_bsize
t->items[1] = t->items[0]; // f_frsize
t->items[2] = MP_OBJ_NEW_SMALL_INT((fatfs->n_fatent - 2) * fatfs->csize); // f_blocks
t->items[3] = MP_OBJ_NEW_SMALL_INT(nclst); // f_bfree
t->items[4] = t->items[3]; // f_bavail
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // f_files
t->items[6] = MP_OBJ_NEW_SMALL_INT(0); // f_ffree
t->items[7] = MP_OBJ_NEW_SMALL_INT(0); // f_favail
t->items[8] = MP_OBJ_NEW_SMALL_INT(0); // f_flags
t->items[9] = MP_OBJ_NEW_SMALL_INT(_MAX_LFN); // f_namemax
return MP_OBJ_FROM_PTR(t);
}
Does that look correct?>>> blocksize = 32768
>>> freeblocks = 472032
>>> blocksize * freeblocks
15467544576
>>> megabyte = 1024 * 1024
>>> 15467544576 / megabyte
14751.0
Thanks,
J