summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/fsusermount.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/fsusermount.c')
-rw-r--r--extmod/fsusermount.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/extmod/fsusermount.c b/extmod/fsusermount.c
index 3265465c54..4ce731d171 100644
--- a/extmod/fsusermount.c
+++ b/extmod/fsusermount.c
@@ -34,7 +34,7 @@
#include "lib/fatfs/ff.h"
#include "fsusermount.h"
-STATIC mp_obj_t fatfs_mount_mkfs(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args, bool mkfs) {
+fs_user_mount_t *fatfs_mount_mkfs(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args, bool mkfs) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_readonly, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
{ MP_QSTR_mkfs, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
@@ -67,6 +67,7 @@ STATIC mp_obj_t fatfs_mount_mkfs(mp_uint_t n_args, const mp_obj_t *pos_args, mp_
if (res != FR_OK) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "can't umount"));
}
+ return NULL;
} else {
// mount
size_t i = 0;
@@ -128,6 +129,7 @@ mkfs_error:
goto mkfs_error;
}
MP_STATE_PORT(fs_user_mount)[i] = NULL;
+ return NULL;
}
} else {
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "can't mount"));
@@ -144,12 +146,13 @@ mkfs_error:
f_getfree(vfs->str, &nclst, &fatfs);
printf(" on %s with %u bytes free\n", vfs->str, (uint)(nclst * fatfs->csize * 512));
*/
+ return vfs;
}
- return mp_const_none;
}
STATIC mp_obj_t fatfs_mount(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- return fatfs_mount_mkfs(n_args, pos_args, kw_args, false);
+ fatfs_mount_mkfs(n_args, pos_args, kw_args, false);
+ return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(fsuser_mount_obj, 2, fatfs_mount);
@@ -191,7 +194,8 @@ STATIC mp_obj_t fatfs_umount(mp_obj_t bdev_or_path_in) {
MP_DEFINE_CONST_FUN_OBJ_1(fsuser_umount_obj, fatfs_umount);
STATIC mp_obj_t fatfs_mkfs(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
- return fatfs_mount_mkfs(n_args, pos_args, kw_args, true);
+ fatfs_mount_mkfs(n_args, pos_args, kw_args, true);
+ return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_KW(fsuser_mkfs_obj, 2, fatfs_mkfs);