diff --git a/services/fs_manager/mount.cpp b/services/fs_manager/mount.cpp index f2f6ca837a20da091ae7f7be5dfda7ecc966b7e8..72b25a6753ee344c30a05a4ebb5a587586ce3e11 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 c63c1e53e30816bb62b47b5db81313010f2c3d7d..11db14a98efe13943ca866b5ec071c5a3768fb10 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