fs/mount: Properly handle missing FS on the supported list

Instead of reporting the failure to find a given FS, nx_mount was
reporting a failure to find the block driver, even when the actual block
driver exists.

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2021-10-22 10:45:13 -03:00 committed by Xiang Xiao
parent c019533d7a
commit 3819d93b4e

View File

@ -266,11 +266,9 @@ int nx_mount(FAR const char *source, FAR const char *target,
FAR const void *data)
{
#if defined(BDFS_SUPPORT) || defined(MDFS_SUPPORT) || defined(NODFS_SUPPORT)
#if defined(BDFS_SUPPORT) || defined(MDFS_SUPPORT)
FAR struct inode *drvr_inode = NULL;
#endif
FAR struct inode *mountpt_inode;
FAR const struct mountpt_operations *mops;
FAR const struct mountpt_operations *mops = NULL;
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
struct inode_search_s desc;
#endif
@ -283,13 +281,14 @@ int nx_mount(FAR const char *source, FAR const char *target,
/* Find the specified filesystem. Try the block driver filesystems first */
#ifdef BDFS_SUPPORT
if (source != NULL &&
find_blockdriver(source, mountflags, &drvr_inode) >= 0)
{
/* Find the block based file system */
#ifdef BDFS_SUPPORT
mops = mount_findfs(g_bdfsmap, filesystemtype);
#endif /* BDFS_SUPPORT */
if (mops == NULL)
{
ferr("ERROR: Failed to find block based file system %s\n",
@ -299,14 +298,14 @@ int nx_mount(FAR const char *source, FAR const char *target,
goto errout_with_inode;
}
}
else
#endif /* BDFS_SUPPORT */
#ifdef MDFS_SUPPORT
if (source != NULL && (ret = find_mtddriver(source, &drvr_inode)) >= 0)
else if (source != NULL &&
(ret = find_mtddriver(source, &drvr_inode)) >= 0)
{
/* Find the MTD based file system */
#ifdef MDFS_SUPPORT
mops = mount_findfs(g_mdfsmap, filesystemtype);
#endif /* MDFS_SUPPORT */
if (mops == NULL)
{
ferr("ERROR: Failed to find MTD based file system %s\n",
@ -317,7 +316,6 @@ int nx_mount(FAR const char *source, FAR const char *target,
}
}
else
#endif /* MDFS_SUPPORT */
#ifdef NODFS_SUPPORT
if ((mops = mount_findfs(g_nonbdfsmap, filesystemtype)) != NULL)
{