aboutsummaryrefslogtreecommitdiff
path: root/extmod/vfs.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-06-06 13:12:23 +1000
committerDamien George <damien.p.george@gmail.com>2018-06-06 14:28:23 +1000
commitd4ce57e4e320a717db1a231f2e6c1e92afaafde0 (patch)
tree8bc7c737cd622aeef4dd2d04a329b8fa984f7e0b /extmod/vfs.c
parenta93144cb65c4e68cba137aa82413c56e0a409d81 (diff)
extmod/vfs: Add fast path for stating VfsPosix filesystem.
Diffstat (limited to 'extmod/vfs.c')
-rw-r--r--extmod/vfs.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/extmod/vfs.c b/extmod/vfs.c
index 7298edab1..96d5019b3 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);
}