1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18109 from benpicco/vfs_unmount_by_path

sys/vfs: add vfs_unmount_by_path()
This commit is contained in:
benpicco 2022-05-17 20:25:18 +02:00 committed by GitHub
commit cabb0b7398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -926,6 +926,18 @@ int vfs_mount(vfs_mount_t *mountp);
*/
int vfs_mount_by_path(const char *path);
/**
* @brief Unmount a file system with a pre-configured mount path
*
* @note This assumes mount points have been configured with @ref VFS_AUTO_MOUNT.
*
* @param[in] path Path of the pre-configured mount point
*
* @return 0 on success
* @return <0 on error
*/
int vfs_unmount_by_path(const char *path);
/**
* @brief Rename a file
*

View File

@ -1197,4 +1197,15 @@ int vfs_mount_by_path(const char *path)
return -ENOENT;
}
int vfs_unmount_by_path(const char *path)
{
for (unsigned i = 0; i < MOUNTPOINTS_NUMOF; ++i) {
if (strcmp(path, vfs_mountpoints_xfa[i].mount_point) == 0) {
return vfs_umount(&vfs_mountpoints_xfa[i]);
}
}
return -ENOENT;
}
/** @} */