Skip to content

Commit d4ce57e

Browse files
committed
extmod/vfs: Add fast path for stating VfsPosix filesystem.
1 parent a93144c commit d4ce57e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

extmod/vfs.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434

3535
#if MICROPY_VFS
3636

37+
#if MICROPY_VFS_POSIX
38+
#include "extmod/vfs_posix.h"
39+
#endif
3740
#if MICROPY_VFS_FAT
3841
#include "extmod/vfs_fat.h"
3942
#endif
@@ -124,8 +127,14 @@ mp_import_stat_t mp_vfs_import_stat(const char *path) {
124127
if (vfs == MP_VFS_NONE || vfs == MP_VFS_ROOT) {
125128
return MP_IMPORT_STAT_NO_EXIST;
126129
}
130+
131+
// Fast paths for known VFS types
132+
#if MICROPY_VFS_POSIX
133+
if (mp_obj_get_type(vfs->obj) == &mp_type_vfs_posix) {
134+
return mp_vfs_posix_import_stat(MP_OBJ_TO_PTR(vfs->obj), path_out);
135+
}
136+
#endif
127137
#if MICROPY_VFS_FAT
128-
// fast paths for known VFS types
129138
if (mp_obj_get_type(vfs->obj) == &mp_fat_vfs_type) {
130139
return fat_vfs_import_stat(MP_OBJ_TO_PTR(vfs->obj), path_out);
131140
}

0 commit comments

Comments
 (0)