Skip to content
Snippets Groups Projects
Commit d4ce57e4 authored by Damien George's avatar Damien George
Browse files

extmod/vfs: Add fast path for stating VfsPosix filesystem.

parent a93144cb
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment