Skip to content

Commit 8aa8a0a

Browse files
committed
extmod/vfs_fat: Use SECSIZE macro to determine FatFs sector size.
1 parent 3f6b4e0 commit 8aa8a0a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

extmod/vfs_fat.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
#include "extmod/fsusermount.h"
4646
#include "timeutils.h"
4747

48+
#if _MAX_SS == _MIN_SS
49+
#define SECSIZE(fs) (_MIN_SS)
50+
#else
51+
#define SECSIZE(fs) ((fs)->ssize)
52+
#endif
53+
4854
#define mp_obj_fat_vfs_t fs_user_mount_t
4955

5056
STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
@@ -267,7 +273,7 @@ STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
267273

268274
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL));
269275

270-
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * fatfs->ssize); // f_bsize
276+
t->items[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * SECSIZE(fatfs)); // f_bsize
271277
t->items[1] = t->items[0]; // f_frsize
272278
t->items[2] = MP_OBJ_NEW_SMALL_INT((fatfs->n_fatent - 2) * fatfs->csize); // f_blocks
273279
t->items[3] = MP_OBJ_NEW_SMALL_INT(nclst); // f_bfree

0 commit comments

Comments
 (0)