summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-01-27 15:10:09 +1100
committerDamien George <damien.p.george@gmail.com>2017-01-27 17:19:06 +1100
commitdcb9ea72157f1d9f3b0dc306c2c31cbd647f5ee1 (patch)
tree2c93fc3589bb3a5879d24ace7a7e55a124a90db3 /py/runtime.c
parent32a1138b9f66b76808906064a76c5f9533cc825c (diff)
extmod: Add generic VFS sub-system.
This provides mp_vfs_XXX functions (eg mount, open, listdir) which are agnostic to the underlying filesystem type, and just require an object with the relevant filesystem-like methods (eg .mount, .open, .listidr) which can then be mounted. These mp_vfs_XXX functions would typically be used by a port to implement the "uos" module, and mp_vfs_open would be the builtin open function. This feature is controlled by MICROPY_VFS, disabled by default.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 0ccfd8d87..e6aef21d7 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -105,6 +105,12 @@ void mp_init(void) {
memset(MP_STATE_VM(fs_user_mount), 0, sizeof(MP_STATE_VM(fs_user_mount)));
#endif
+ #if MICROPY_VFS
+ // initialise the VFS sub-system
+ MP_STATE_VM(vfs_cur) = NULL;
+ MP_STATE_VM(vfs_mount_table) = NULL;
+ #endif
+
#if MICROPY_PY_THREAD_GIL
mp_thread_mutex_init(&MP_STATE_VM(gil_mutex));
#endif