8000 Fix unix build · ladyada/circuitpython@69105b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 69105b2

Browse files
committed
Fix unix build
1 parent ddf9aec commit 69105b2

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

supervisor/stub/filesystem.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ void filesystem_set_writable_by_usb(fs_user_mount_t *vfs, bool usb_writable) {
5555
return;
5656
}
5757

58-
bool filesystem_is_writable_by_python(fs_user_mount_t *vfs) {
59-
(void)vfs;
60-
return true;
61-
}
62-
6358
bool filesystem_is_writable_by_usb(fs_user_mount_t *vfs) {
6459
return true;
6560
}
@@ -78,3 +73,32 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu
7873
bool filesystem_present(void) {
7974
return false;
8075
}
76+
77+
bool filesystem_lock(fs_user_mount_t *fs_mount) {
78+
if (fs_mount->lock_count == 0 && !blockdev_lock(fs_mount)) {
79+
return false;
80+
}
81+
fs_mount->lock_count += 1;
82+
return true;
83+
}
84+
85+
void filesystem_unlock(fs_user_mount_t *fs_mount) {
86+
assert(fs_mount->lock_count > 0);
87+
fs_mount->lock_count -= 1;
88+
if (fs_mount->lock_count == 0) {
89+
blockdev_unlock(fs_mount);
90+
}
91+
}
92+
93+
bool blockdev_lock(fs_user_mount_t *fs_mount) {
94+
if ((fs_mount->blockdev.flags & MP_BLOCKDEV_FLAG_LOCKED) != 0) {
95+
return false;
96+
}
97+
fs_mount->blockdev.flags |= MP_BLOCKDEV_FLAG_LOCKED;
98+
return true;
99+
}
100+
101+
void blockdev_unlock(fs_user_mount_t *fs_mount) {
102+
assert(fs_mount->blockdev.flags & MP_BLOCKDEV_FLAG_LOCKED);
103+
fs_mount->blockdev.flags &= ~MP_BLOCKDEV_FLAG_LOCKED;
104+
}

0 commit comments

Comments
 (0)
0