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/nuttx.git

commit ace2683492f3ec71ac3c1f28d432ddf0b0b27b7b
Author: dongjiuzhu1 <[email protected]>
AuthorDate: Thu Jan 11 15:34:05 2024 +0800

    fs/mount: add ftl proxy to mount block filesystem on mtd device
    
    Signed-off-by: dongjiuzhu1 <[email protected]>
---
 fs/mount/fs_mount.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c
index e6a2ce703a..6d81502c5d 100644
--- a/fs/mount/fs_mount.c
+++ b/fs/mount/fs_mount.c
@@ -140,9 +140,6 @@ extern const struct mountpt_operations g_mnemofs_operations;
 
 static const struct fsmap_t g_mdfsmap[] =
 {
-#ifdef CONFIG_FS_ROMFS
-    { "romfs", &g_romfs_operations },
-#endif
 #ifdef CONFIG_FS_SPIFFS
     { "spiffs", &g_spiffs_operations },
 #endif
@@ -334,11 +331,28 @@ int nx_mount(FAR const char *source, FAR const char 
*target,
 #endif /* MDFS_SUPPORT */
       if (mops == NULL)
         {
-          ferr("ERROR: Failed to find MTD based file system %s\n",
-               filesystemtype);
-
-          ret = -ENODEV;
-          goto errout_with_inode;
+#ifdef BDFS_SUPPORT
+          mops = mount_findfs(g_bdfsmap, filesystemtype);
+#endif /* BDFS_SUPPORT */
+          if (mops == NULL)
+            {
+              ferr("ERROR: Failed to find MTD based file system %s\n",
+                   filesystemtype);
+
+              ret = -ENODEV;
+              goto errout_with_inode;
+            }
+#ifdef CONFIG_MTD
+          else
+            {
+              inode_release(drvr_inode);
+              ret = mtd_proxy(source, mountflags, &drvr_inode);
+              if (ret < 0)
+                {
+                  goto errout_with_inode;
+                }
+            }
+#endif
         }
     }
   else

Reply via email to