@@ -98,7 +98,7 @@ STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_
9898 return MP_OBJ_FROM_PTR (vfs );
9999}
100100
101- STATIC void verify_fs_writable (fs_user_mount_t * vfs ) {
101+ STATIC void filesystem_lock_raise (fs_user_mount_t * vfs ) {
102102 if (!filesystem_lock (vfs )) {
103103 mp_raise_OSError (MP_EROFS );
104104 }
@@ -229,7 +229,7 @@ STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_in
229229
230230 // check if path is a file or directory
231231 if ((fno .fattrib & AM_DIR ) == attr ) {
232- verify_fs_writable (self );
232+ filesystem_lock_raise (self );
233233 res = f_unlink (& self -> fatfs , path );
234234 filesystem_unlock (self );
235235
@@ -257,7 +257,7 @@ STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_
257257 const char * old_path = mp_obj_str_get_str (path_in );
258258 const char * new_path = mp_obj_str_get_str (path_out );
259259
260- verify_fs_writable (self );
260+ filesystem_lock_raise (self );
261261 FRESULT res = f_rename (& self -> fatfs , old_path , new_path );
262262 if (res == FR_EXIST ) {
263263 // if new_path exists then try removing it (but only if it's a file)
@@ -278,7 +278,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_rename_obj, fat_vfs_rename);
278278STATIC mp_obj_t fat_vfs_mkdir (mp_obj_t vfs_in , mp_obj_t path_o ) {
279279 mp_obj_fat_vfs_t * self = MP_OBJ_TO_PTR (vfs_in );
280280 const char * path = mp_obj_str_get_str (path_o );
281- verify_fs_writable (self );
281+ filesystem_lock_raise (self );
282282 FRESULT res = f_mkdir (& self -> fatfs , path );
283283 filesystem_unlock (self );
284284 if (res == FR_OK ) {
@@ -495,7 +495,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
495495STATIC mp_obj_t vfs_fat_setlabel (mp_obj_t self_in , mp_obj_t label_in ) {
496496 fs_user_mount_t * self = MP_OBJ_TO_PTR (self_in );
497497 const char * label_str = mp_obj_str_get_str (label_in );
498- verify_fs_writable (self );
498+ filesystem_lock_raise (self );
499499 FRESULT res = f_setlabel (& self -> fatfs , label_str );
500500 filesystem_unlock (self );
501501 if (res != FR_OK ) {
0 commit comments