From ace2683492f3ec71ac3c1f28d432ddf0b0b27b7b Mon Sep 17 00:00:00 2001 From: dongjiuzhu1 Date: Thu, 11 Jan 2024 15:34:05 +0800 Subject: [PATCH] fs/mount: add ftl proxy to mount block filesystem on mtd device Signed-off-by: dongjiuzhu1 --- fs/mount/fs_mount.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 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); +#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; + 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