From caea78e5a395c1a49000441108a685b74f6fd852 Mon Sep 17 00:00:00 2001 From: ldy Date: Tue, 1 Apr 2025 04:49:28 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0skip=20mount=20point?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ldy --- services/fs_manager/mount.cpp | 14 ++++++++++++-- services/include/fs_manager/mount.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/services/fs_manager/mount.cpp b/services/fs_manager/mount.cpp index f2f6ca83..72b25a67 100644 --- a/services/fs_manager/mount.cpp +++ b/services/fs_manager/mount.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include "log/dump.h" @@ -33,6 +34,16 @@ using Updater::Utils::SplitString; static std::string g_defaultUpdaterFstab = ""; static Fstab *g_fstab = nullptr; static const std::string PARTITION_PATH = "/dev/block/by-name"; +static std::unordered_set g_skipMountPointList = {"/", "/tmp", "/sdcard", INTERNAL_DATA_PATH}; + +void AddSkipMountPoint(const std::string &mountPoint) +{ + if (g_skipMountPointList.find(mountPoint) != g_skipMountPointList.end()) { + return; + } + LOG(INFO) << "add skip mount point " << mountPoint; + g_skipMountPointList.insert(mountPoint); +} static std::string GetFstabFile() { @@ -337,8 +348,7 @@ int SetupPartitions(bool isMountData) for (const FstabItem *item = g_fstab->head; item != nullptr; item = item->next) { std::string mountPoint(item->mountPoint); std::string fsType(item->fsType); - if (mountPoint == "/" || mountPoint == "/tmp" || fsType == "none" || - mountPoint == "/sdcard" || mountPoint == INTERNAL_DATA_PATH) { + if (g_skipMountPointList.find(mountPoint) != g_skipMountPointList.end() || fsType == "none") { continue; } diff --git a/services/include/fs_manager/mount.h b/services/include/fs_manager/mount.h index c63c1e53..11db14a9 100644 --- a/services/include/fs_manager/mount.h +++ b/services/include/fs_manager/mount.h @@ -31,6 +31,7 @@ int MountSdcard(std::string &mountPoint, std::string &path); int SetupPartitions(bool isMountData = true); const std::string GetBlockDeviceByMountPoint(const std::string &mountPoint); const std::vector GetBlockDevicesByMountPoint(const std::string &mountPoint); +void AddSkipMountPoint(const std::string &mountPoint); #ifndef UPDATE_PATCH_SHARED MountStatus GetMountStatusForPath(const std::string &path); #endif -- Gitee