You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/10/23 09:02:29 UTC
[incubator-nuttx] 02/02: fs/mount: Properly handle missing FS on
the supported list
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 3819d93b4e41c80c4849697048d40010ae282c99
Author: Gustavo Henrique Nihei <gu...@espressif.com>
AuthorDate: Fri Oct 22 10:45:13 2021 -0300
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 <gu...@espressif.com>
---
fs/mount/fs_mount.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c
index 39bb8da..b0c7d2e 100644
--- a/fs/mount/fs_mount.c
+++ b/fs/mount/fs_mount.c
@@ -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)
{