aboutsummaryrefslogtreecommitdiff
path: root/extmod/vfs.h
diff options
context:
space:
mode:
authorDamien George2018-06-06 14:24:23 +1000
committerDamien George2018-06-06 14:33:42 +1000
commitc117effddd1f9ffd902a9712cf0ae7413696dc66 (patch)
treeb14d54474360c11580a55fe4ea28a11efb2646cc /extmod/vfs.h
parentfadd6bbe436df73a8a0d15fa9b7e743707ee7c36 (diff)
extmod/vfs: Introduce a C-level VFS protocol, with fast import_stat.
Following other C-level protocols, this VFS protocol is added to help abstract away implementation details of the underlying VFS in an efficient way. As a starting point, the import_stat function is put into this protocol so that the VFS sub-system does not need to know about every VFS implementation in order to do an efficient stat for importing files. In the future it might be worth adding other functions to this protocol.
Diffstat (limited to 'extmod/vfs.h')
-rw-r--r--extmod/vfs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/vfs.h b/extmod/vfs.h
index f2efdbe79..730dea043 100644
--- a/extmod/vfs.h
+++ b/extmod/vfs.h
@@ -45,6 +45,11 @@
#define BP_IOCTL_SEC_COUNT (4)
#define BP_IOCTL_SEC_SIZE (5)
+// At the moment the VFS protocol just has import_stat, but could be extended to other methods
+typedef struct _mp_vfs_proto_t {
+ mp_import_stat_t (*import_stat)(void *self, const char *path);
+} mp_vfs_proto_t;
+
typedef struct _mp_vfs_mount_t {
const char *str; // mount point with leading /
size_t len;