diff --git a/extmod/vfs.c b/extmod/vfs.c index 7298edab17..96d5019b37 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -34,6 +34,9 @@ #if MICROPY_VFS +#if MICROPY_VFS_POSIX +#include "extmod/vfs_posix.h" +#endif #if MICROPY_VFS_FAT #include "extmod/vfs_fat.h" #endif @@ -124,8 +127,14 @@ mp_import_stat_t mp_vfs_import_stat(const char *path) { if (vfs == MP_VFS_NONE || vfs == MP_VFS_ROOT) { return MP_IMPORT_STAT_NO_EXIST; } + + // Fast paths for known VFS types + #if MICROPY_VFS_POSIX + if (mp_obj_get_type(vfs->obj) == &mp_type_vfs_posix) { + return mp_vfs_posix_import_stat(MP_OBJ_TO_PTR(vfs->obj), path_out); + } + #endif #if MICROPY_VFS_FAT - // fast paths for known VFS types if (mp_obj_get_type(vfs->obj) == &mp_fat_vfs_type) { return fat_vfs_import_stat(MP_OBJ_TO_PTR(vfs->obj), path_out); }