@@ -98,7 +98,7 @@ STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_
98
98
return MP_OBJ_FROM_PTR (vfs );
99
99
}
100
100
101
- STATIC void verify_fs_writable (fs_user_mount_t * vfs ) {
101
+ STATIC void filesystem_lock_raise (fs_user_mount_t * vfs ) {
102
102
if (!filesystem_lock (vfs )) {
103
103
mp_raise_OSError (MP_EROFS );
104
104
}
@@ -229,7 +229,7 @@ STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_in
229
229
230
230
// check if path is a file or directory
231
231
if ((fno .fattrib & AM_DIR ) == attr ) {
232
- verify_fs_writable (self );
232
+ filesystem_lock_raise (self );
233
233
res = f_unlink (& self -> fatfs , path );
234
234
filesystem_unlock (self );
235
235
@@ -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_
257
257
const char * old_path = mp_obj_str_get_str (path_in );
258
258
const char * new_path = mp_obj_str_get_str (path_out );
259
259
260
- verify_fs_writable (self );
260
+ filesystem_lock_raise (self );
261
261
FRESULT res = f_rename (& self -> fatfs , old_path , new_path );
262
262
if (res == FR_EXIST ) {
263
263
// 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);
278
278
STATIC mp_obj_t fat_vfs_mkdir (mp_obj_t vfs_in , mp_obj_t path_o ) {
279
279
mp_obj_fat_vfs_t * self = MP_OBJ_TO_PTR (vfs_in );
280
280
const char * path = mp_obj_str_get_str (path_o );
281
- verify_fs_writable (self );
281
+ filesystem_lock_raise (self );
282
282
FRESULT res = f_mkdir (& self -> fatfs , path );
283
283
filesystem_unlock (self );
284
284
if (res == FR_OK ) {
@@ -495,7 +495,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getlabel_obj, vfs_fat_getlabel);
495
495
STATIC mp_obj_t vfs_fat_setlabel (mp_obj_t self_in , mp_obj_t label_in ) {
496
496
fs_user_mount_t * self = MP_OBJ_TO_PTR (self_in );
497
497
const char * label_str = mp_obj_str_get_str (label_in );
498
- verify_fs_writable (self );
498
+ filesystem_lock_raise (self );
499
499
FRESULT res = f_setlabel (& self -> fatfs , label_str );
500
500
filesystem_unlock (self );
501
501
if (res != FR_OK ) {
0 commit comments