aboutsummaryrefslogtreecommitdiff
path: root/extmod/vfs_fat.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-01-27 22:42:06 +1100
committerDamien George <damien.p.george@gmail.com>2017-01-27 23:22:15 +1100
commit8aa8a0a660451e8eafc4aa0bca2116d561cebe4a (patch)
tree2972ec53ee81cc4038067aaeac772277d2a9d3ef /extmod/vfs_fat.c
parent3f6b4e08e38d3205f7a5a21f7ff81ab9f3c3c497 (diff)
extmod/vfs_fat: Use SECSIZE macro to determine FatFs sector size.
Diffstat (limited to 'extmod/vfs_fat.c')
-rw-r--r--extmod/vfs_fat.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 45f2991da..a6f2ae806 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -45,6 +45,12 @@
#include "extmod/fsusermount.h"
#include "timeutils.h"
+#if _MAX_SS == _MIN_SS
+#define SECSIZE(fs) (_MIN_SS)
+#else
+#define SECSIZE(fs) ((fs)->ssize)
+#endif
+
#define mp_obj_fat_vfs_t fs_user_mount_t
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) {
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[0] = MP_OBJ_NEW_SMALL_INT(fatfs->csize * SECSIZE(fatfs)); // 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