diff options
| author | Damien George <damien.p.george@gmail.com> | 2017-01-27 17:17:54 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2017-01-27 17:21:45 +1100 |
| commit | 6c23c7587f1c02f58e9246ec59fe4f6544728b50 (patch) | |
| tree | 14ab47dccc6e572fbe53f7b460d01d892c4daf53 /extmod/vfs.c | |
| parent | fb3ae1784e1905709f82aadb7f1c8994682f9759 (diff) | |
extmod/vfs: Add ability for VFS sub-system to import using VfsFat.
Diffstat (limited to 'extmod/vfs.c')
| -rw-r--r-- | extmod/vfs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/extmod/vfs.c b/extmod/vfs.c index 2880271c6..0cba0bc58 100644 --- a/extmod/vfs.c +++ b/extmod/vfs.c @@ -31,6 +31,7 @@ #include "py/objstr.h" #include "py/mperrno.h" #include "extmod/vfs.h" +#include "extmod/vfs_fat.h" #if MICROPY_VFS @@ -114,6 +115,12 @@ mp_import_stat_t mp_vfs_import_stat(const char *path) { if (vfs == VFS_NONE || vfs == VFS_ROOT) { return MP_IMPORT_STAT_NO_EXIST; } + #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); + } + #endif // TODO delegate to vfs.stat() method return MP_IMPORT_STAT_NO_EXIST; } |
