mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
vfs: introduce vfs_format_by_path()
This commit is contained in:
parent
7f5c932f07
commit
855a359058
@ -898,6 +898,21 @@ int vfs_closedir(vfs_DIR *dirp);
|
||||
*/
|
||||
int vfs_format(vfs_mount_t *mountp);
|
||||
|
||||
/**
|
||||
* @brief Format a file system
|
||||
*
|
||||
* The file system must not be mounted in order to be formatted.
|
||||
* Call @ref vfs_unmount_by_path first if necessary.
|
||||
*
|
||||
* @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_format_by_path(const char *path);
|
||||
|
||||
/**
|
||||
* @brief Mount a file system
|
||||
*
|
||||
|
@ -1208,4 +1208,15 @@ int vfs_unmount_by_path(const char *path)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
int vfs_format_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_format(&vfs_mountpoints_xfa[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
Loading…
Reference in New Issue
Block a user