~aleteoryx/muditaos

adc3d34aed70ff0f6f9e1e33eb8d2e8ba85408ea — Lucjan Bryndza 5 years ago 9269d9c
[EGD-5334] Fix phone crash when MTP access

Fix phone crash when accessing file when new filesystem is used
M module-bsp/board/rt1051/bsp/usb => module-bsp/board/rt1051/bsp/usb +1 -1
@@ 1,1 1,1 @@
Subproject commit 43e882e21180a7fceb724a43aa0f72850bbb4a22
Subproject commit 24a4bfec9c9c62246a7ef521ea752e683c7bd2d7

M module-vfs/drivers/src/purefs/fs/filesystem_littlefs.cpp => module-vfs/drivers/src/purefs/fs/filesystem_littlefs.cpp +4 -1
@@ 282,14 282,17 @@ namespace purefs::fs::drivers
        }
        auto lerr = lfs_fs_size(vmnt->lfs_mount());
        if (lerr >= 0) {
            const auto cfg = vmnt->lfs_config();
            std::memset(&stat, 0, sizeof stat);
            stat.f_blocks  = cfg->block_count;
            stat.f_bfree   = stat.f_blocks - lerr;
            stat.f_bavail  = stat.f_bfree;
            lerr           = 0;
            const auto cfg = vmnt->lfs_config();
            stat.f_bsize   = cfg->prog_size;
            stat.f_frsize  = cfg->block_size;
            stat.f_blocks  = cfg->block_count;
            stat.f_namemax = PATH_MAX;
            stat.f_flag    = vmnt->flags();
        }
        return lfs_to_errno(lerr);
    }

M module-vfs/drivers/src/purefs/fs/filesystem_vfat.cpp => module-vfs/drivers/src/purefs/fs/filesystem_vfat.cpp +1 -1
@@ 236,7 236,7 @@ namespace purefs::fs::drivers
        stat.f_blocks  = (fatfs->n_fatent - 2);
        stat.f_bfree   = xfree;
        stat.f_bavail  = xfree;
        stat.f_flag    = 0; // TODO: Flags later
        stat.f_flag    = vmnt->flags();
        stat.f_files   = 0;
        stat.f_ffree   = 0;
        stat.f_favail  = 0;

M module-vfs/include/user/purefs/fs/filesystem.hpp => module-vfs/include/user/purefs/fs/filesystem.hpp +6 -0
@@ 197,6 197,9 @@ namespace purefs::fs
        inline auto invoke_fops(iaccess acc, T Base::*method, std::string_view path, Args &&... args) const
            -> decltype((static_cast<Base *>(nullptr)->*method)(nullptr, {}, std::forward<Args>(args)...))
        {
            if (path.empty()) {
                return -ENOENT;
            }
            const auto abspath     = absolute_path(path);
            auto [mountp, pathpos] = find_mount_point(abspath);
            if (!mountp) {


@@ 219,6 222,9 @@ namespace purefs::fs
                                        Args &&... args) const
            -> decltype((static_cast<Base *>(nullptr)->*method)(nullptr, {}, {}, std::forward<Args>(args)...))
        {
            if (path.empty() || path2.empty()) {
                return -ENOENT;
            }
            const auto abspath     = absolute_path(path);
            const auto abspath2    = absolute_path(path2);
            auto [mountp, pathpos] = find_mount_point(abspath);