Skip to content

Commit b89ac9d

Browse files
committed
stmhal/moduos: Implement total-number-of-blocks field in statvfs.
1 parent b1537a5 commit b89ac9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stmhal/moduos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ STATIC mp_obj_t os_statvfs(mp_obj_t path_in) {
307307

308308
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * 512); // f_bsize - block size
309309
t->items[1] = t->items[0]; // f_frsize - fragment size
310-
t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // f_blocks - total number of blocks
310+
t->items[2] = MP_OBJ_NEW_SMALL_INT((fatfs->n_fatent - 2) * fatfs->csize); // f_blocks - total number of blocks
311311
t->items[3] = MP_OBJ_NEW_SMALL_INT(nclst); // f_bfree - number of free blocks
312312
t->items[4] = t->items[3]; // f_bavail - free blocks avail to unpriviledged users
313313
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // f_files - # inodes

0 commit comments

Comments
 (0)