diff options
author | Damien George <damien.p.george@gmail.com> | 2019-09-07 14:03:41 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-10-29 12:12:37 +1100 |
commit | 9aabb6c01ba4166bb389e28b55f21614fca5aa7f (patch) | |
tree | 86f6fa790f32bdcd612d5f3024eae267cb1c4321 /extmod/vfs.h | |
parent | ece4e21a55609163466d96875c60bb7f1556c468 (diff) |
extmod: Factor out block-device struct to make independent of fatfs.
Diffstat (limited to 'extmod/vfs.h')
-rw-r--r-- | extmod/vfs.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/extmod/vfs.h b/extmod/vfs.h index 730dea043..85b020faa 100644 --- a/extmod/vfs.h +++ b/extmod/vfs.h @@ -38,6 +38,12 @@ #define MP_S_IFDIR (0x4000) #define MP_S_IFREG (0x8000) +// these are the values for mp_vfs_blockdev_t.flags +#define MP_BLOCKDEV_FLAG_NATIVE (0x0001) // readblocks[2]/writeblocks[2] contain native func +#define MP_BLOCKDEV_FLAG_FREE_OBJ (0x0002) // fs_user_mount_t obj should be freed on umount +#define MP_BLOCKDEV_FLAG_HAVE_IOCTL (0x0004) // new protocol with ioctl +#define MP_BLOCKDEV_FLAG_NO_FILESYSTEM (0x0008) // the block device has no filesystem on it + // constants for block protocol ioctl #define BP_IOCTL_INIT (1) #define BP_IOCTL_DEINIT (2) @@ -50,6 +56,20 @@ 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_blockdev_t { + uint16_t flags; + mp_obj_t readblocks[4]; + mp_obj_t writeblocks[4]; + // new protocol uses just ioctl, old uses sync (optional) and count + union { + mp_obj_t ioctl[4]; + struct { + mp_obj_t sync[2]; + mp_obj_t count[2]; + } old; + } u; +} mp_vfs_blockdev_t; + typedef struct _mp_vfs_mount_t { const char *str; // mount point with leading / size_t len; |