mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
sys/vfs: add vfs_unmount_by_path()
This commit is contained in:
parent
ae0bd73914
commit
ff4c738e2d
@ -920,6 +920,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
|
||||
*
|
||||
|
@ -1167,4 +1167,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