diff options
| author | Damien George <damien@micropython.org> | 2024-05-27 11:49:06 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-05-27 12:44:02 +1000 |
| commit | c0a25a69eb9532396c7ff06dd8ab506403aba4a2 (patch) | |
| tree | 8cf191775587f3e26556e22bfb2f34e65bd30cbe | |
| parent | fbf811474af1c5a7c4c03743b11b248151199a36 (diff) | |
extmod/modos: Only sync FAT filesystems using disk_ioctl.
Eventually this needs to be made a generic call to the underlying VFS. But
for now this prevents `disk_ioctl()` crashing on non-FAT filesystems.
Signed-off-by: Damien George <damien@micropython.org>
| -rw-r--r-- | extmod/modos.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/extmod/modos.c b/extmod/modos.c index eda359b97..7f1e31fba 100644 --- a/extmod/modos.c +++ b/extmod/modos.c @@ -76,8 +76,9 @@ static mp_obj_t mp_os_sync(void) { #if MICROPY_VFS_FAT for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) { - // this assumes that vfs->obj is fs_user_mount_t with block device functions - disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL); + if (mp_obj_is_type(vfs->obj, &mp_fat_vfs_type)) { + disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL); + } } #endif return mp_const_none; |
