summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-03-27 19:51:48 -0700
committerGitHub <noreply@github.com>2018-03-27 19:51:48 -0700
commit6711c5c90d497ce68ea1df249d36b32bdf2f4c6c (patch)
treee4457f190841f25ab8954a057dcd8ce3ff8b4d10 /shared-module
parent1eba5804434a8acc182c23aadf5b5a5dcbe901fa (diff)
parent34f5498760452e30cb9b76e43f5ec65f36936376 (diff)
Merge pull request #712 from jepler/fslabel
Add ability to get, set filesystem label from CircuitPython
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/storage/__init__.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c
index 97a049bac..5b0bbe01e 100644
--- a/shared-module/storage/__init__.c
+++ b/shared-module/storage/__init__.c
@@ -109,19 +109,19 @@ void common_hal_storage_umount_object(mp_obj_t vfs_obj) {
mp_vfs_proxy_call(vfs, MP_QSTR_umount, 0, NULL);
}
-void common_hal_storage_umount_path(const char* mount_path) {
- // remove vfs from the mount table
- mp_obj_t *vfs_obj = NULL;
+STATIC mp_obj_t storage_object_from_path(const char* mount_path) {
for (mp_vfs_mount_t **vfsp = &MP_STATE_VM(vfs_mount_table); *vfsp != NULL; vfsp = &(*vfsp)->next) {
if (strcmp(mount_path, (*vfsp)->str) == 0) {
- vfs_obj = (*vfsp)->obj;
- break;
+ return (*vfsp)->obj;
}
}
+ mp_raise_OSError(MP_EINVAL);
+}
- if (vfs_obj == NULL) {
- mp_raise_OSError(MP_EINVAL);
- }
+void common_hal_storage_umount_path(const char* mount_path) {
+ common_hal_storage_umount_object(storage_object_from_path(mount_path));
+}
- common_hal_storage_umount_object(vfs_obj);
+mp_obj_t common_hal_storage_getmount(const char *mount_path) {
+ return storage_object_from_path(mount_path);
}