Skip to content

Commit 95c4ffb

Browse files
committed
Rename verify_fs_writable to filesystem_lock_raise
1 parent 69105b2 commit 95c4ffb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

extmod/vfs_fat.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
278278
STATIC 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);
495495
STATIC 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) {

supervisor/filesystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fs_user_mount_t *filesystem_for_path(const char *path_in, const char **path_unde
5252
bool filesystem_native_fatfs(fs_user_mount_t *fs_mount);
5353

5454
// We have two levels of locking. filesystem_* calls grab a shared blockdev lock to allow
55-
// CircuitPython's fatfs code edit the blocks. blockdev_* class grab a lock to mutate blocks
55+
// CircuitPython's fatfs code to edit the blocks. blockdev_* class grab a lock to mutate blocks
5656
// directly, excluding any filesystem_* locks.
5757

5858
bool filesystem_lock(fs_user_mount_t *fs_mount);

0 commit comments

Comments
 (0)