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:
commit
cabb0b7398
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
Loading…
Reference in New Issue
Block a user