Loading fs_mgr/fs_mgr_overlayfs.cpp +4 −13 Original line number Diff line number Diff line Loading @@ -120,13 +120,9 @@ bool fs_mgr_is_dir(const std::string& path) { return !stat(path.c_str(), &st) && S_ISDIR(st.st_mode); } // Similar test as overlayfs workdir= validation in the kernel for read-write // validation, except we use fs_mgr_work. Covers space and storage issues. bool fs_mgr_dir_is_writable(const std::string& path) { auto test_directory = path + "/fs_mgr_work"; rmdir(test_directory.c_str()); auto ret = !mkdir(test_directory.c_str(), 0700); return ret | !rmdir(test_directory.c_str()); bool fs_mgr_rw_access(const std::string& path) { if (path.empty()) return false; return access(path.c_str(), R_OK | W_OK) == 0; } // At less than 1% or 8MB of free space return value of false, Loading Loading @@ -280,7 +276,7 @@ std::string fs_mgr_get_overlayfs_candidate(const std::string& mount_point) { if (!fs_mgr_is_dir(upper)) continue; auto work = dir + kWorkName; if (!fs_mgr_is_dir(work)) continue; if (!fs_mgr_dir_is_writable(work)) continue; if (!fs_mgr_rw_access(work)) continue; return dir; } return ""; Loading Loading @@ -317,11 +313,6 @@ const std::string fs_mgr_mount_point(const std::string& mount_point) { return "/system"; } bool fs_mgr_rw_access(const std::string& path) { if (path.empty()) return false; return access(path.c_str(), R_OK | W_OK) == 0; } constexpr char kOverlayfsFileContext[] = "u:object_r:overlayfs_file:s0"; class AutoSetFsCreateCon final { Loading Loading
fs_mgr/fs_mgr_overlayfs.cpp +4 −13 Original line number Diff line number Diff line Loading @@ -120,13 +120,9 @@ bool fs_mgr_is_dir(const std::string& path) { return !stat(path.c_str(), &st) && S_ISDIR(st.st_mode); } // Similar test as overlayfs workdir= validation in the kernel for read-write // validation, except we use fs_mgr_work. Covers space and storage issues. bool fs_mgr_dir_is_writable(const std::string& path) { auto test_directory = path + "/fs_mgr_work"; rmdir(test_directory.c_str()); auto ret = !mkdir(test_directory.c_str(), 0700); return ret | !rmdir(test_directory.c_str()); bool fs_mgr_rw_access(const std::string& path) { if (path.empty()) return false; return access(path.c_str(), R_OK | W_OK) == 0; } // At less than 1% or 8MB of free space return value of false, Loading Loading @@ -280,7 +276,7 @@ std::string fs_mgr_get_overlayfs_candidate(const std::string& mount_point) { if (!fs_mgr_is_dir(upper)) continue; auto work = dir + kWorkName; if (!fs_mgr_is_dir(work)) continue; if (!fs_mgr_dir_is_writable(work)) continue; if (!fs_mgr_rw_access(work)) continue; return dir; } return ""; Loading Loading @@ -317,11 +313,6 @@ const std::string fs_mgr_mount_point(const std::string& mount_point) { return "/system"; } bool fs_mgr_rw_access(const std::string& path) { if (path.empty()) return false; return access(path.c_str(), R_OK | W_OK) == 0; } constexpr char kOverlayfsFileContext[] = "u:object_r:overlayfs_file:s0"; class AutoSetFsCreateCon final { Loading