Loading fs_mgr/fs_mgr.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -1065,7 +1065,8 @@ static bool SupportsCheckpoint(FstabEntry* entry) { class CheckpointManager { public: CheckpointManager(int needs_checkpoint = -1) : needs_checkpoint_(needs_checkpoint) {} CheckpointManager(int needs_checkpoint = -1, bool metadata_encrypted = false) : needs_checkpoint_(needs_checkpoint), metadata_encrypted_(metadata_encrypted) {} bool NeedsCheckpoint() { if (needs_checkpoint_ != UNKNOWN) { Loading @@ -1083,7 +1084,7 @@ class CheckpointManager { return true; } if (entry->fs_mgr_flags.checkpoint_blk) { if (entry->fs_mgr_flags.checkpoint_blk && !metadata_encrypted_) { call_vdc({"checkpoint", "restoreCheckpoint", entry->blk_device}, nullptr); } Loading Loading @@ -1192,6 +1193,7 @@ class CheckpointManager { enum { UNKNOWN = -1, NO = 0, YES = 1 }; int needs_checkpoint_; bool metadata_encrypted_; std::map<std::string, std::string> device_map_; }; Loading Loading @@ -1825,11 +1827,11 @@ int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& mount_point) // in turn, and stop on 1st success, or no more match. static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name, const std::string& n_blk_device, const char* tmp_mount_point, int needs_checkpoint) { int needs_checkpoint, bool metadata_encrypted) { int mount_errors = 0; int first_mount_errno = 0; std::string mount_point; CheckpointManager checkpoint_manager(needs_checkpoint); CheckpointManager checkpoint_manager(needs_checkpoint, metadata_encrypted); AvbUniquePtr avb_handle(nullptr); if (!fstab) { Loading Loading @@ -1939,12 +1941,13 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name, } int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point) { return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1); return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1, false); } int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point, bool needs_checkpoint) { return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint); bool needs_checkpoint, bool metadata_encrypted) { return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint, metadata_encrypted); } /* Loading fs_mgr/include/fs_mgr.h +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ int fs_mgr_mount_all(android::fs_mgr::Fstab* fstab, int mount_mode); int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point); int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point, bool need_cp); char* tmp_mount_point, bool need_cp, bool metadata_encrypted); int fs_mgr_do_mount_one(const android::fs_mgr::FstabEntry& entry, const std::string& mount_point = ""); int fs_mgr_do_tmpfs_mount(const char *n_name); Loading libappfuse/FuseBridgeLoop.cc +12 −2 Original line number Diff line number Diff line Loading @@ -311,6 +311,8 @@ class BridgeEpollController : private EpollController { } }; std::recursive_mutex FuseBridgeLoop::mutex_; FuseBridgeLoop::FuseBridgeLoop() : opened_(true) { base::unique_fd epoll_fd(epoll_create1(EPOLL_CLOEXEC)); if (epoll_fd.get() == -1) { Loading @@ -328,7 +330,7 @@ bool FuseBridgeLoop::AddBridge(int mount_id, base::unique_fd dev_fd, base::uniqu std::unique_ptr<FuseBridgeEntry> bridge( new FuseBridgeEntry(mount_id, std::move(dev_fd), std::move(proxy_fd))); std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_); if (!opened_) { LOG(ERROR) << "Tried to add a mount to a closed bridge"; return false; Loading Loading @@ -372,7 +374,7 @@ void FuseBridgeLoop::Start(FuseBridgeLoopCallback* callback) { const bool wait_result = epoll_controller_->Wait(bridges_.size(), &entries); LOG(VERBOSE) << "Receive epoll events"; { std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_); if (!(wait_result && ProcessEventLocked(entries, callback))) { for (auto it = bridges_.begin(); it != bridges_.end();) { callback->OnClosed(it->second->mount_id()); Loading @@ -385,5 +387,13 @@ void FuseBridgeLoop::Start(FuseBridgeLoopCallback* callback) { } } void FuseBridgeLoop::Lock() { mutex_.lock(); } void FuseBridgeLoop::Unlock() { mutex_.unlock(); } } // namespace fuse } // namespace android libappfuse/include/libappfuse/FuseBridgeLoop.h +5 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,10 @@ class FuseBridgeLoop final { // thread from one which invokes |Start|. bool AddBridge(int mount_id, base::unique_fd dev_fd, base::unique_fd proxy_fd); static void Lock(); static void Unlock(); private: bool ProcessEventLocked(const std::unordered_set<FuseBridgeEntry*>& entries, FuseBridgeLoopCallback* callback); Loading @@ -60,7 +64,7 @@ class FuseBridgeLoop final { std::map<int, std::unique_ptr<FuseBridgeEntry>> bridges_; // Lock for multi-threading. std::mutex mutex_; static std::recursive_mutex mutex_; bool opened_; Loading libmodprobe/include/modprobe/modprobe.h +4 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class Modprobe { std::vector<std::string>* post_dependencies); void ResetModuleCount() { module_count_ = 0; } int GetModuleCount() { return module_count_; } void EnableBlacklist(bool enable); void EnableBlocklist(bool enable); void EnableVerbose(bool enable); private: Loading @@ -55,7 +55,7 @@ class Modprobe { bool ParseSoftdepCallback(const std::vector<std::string>& args); bool ParseLoadCallback(const std::vector<std::string>& args); bool ParseOptionsCallback(const std::vector<std::string>& args); bool ParseBlacklistCallback(const std::vector<std::string>& args); bool ParseBlocklistCallback(const std::vector<std::string>& args); void ParseKernelCmdlineOptions(); void ParseCfg(const std::string& cfg, std::function<bool(const std::vector<std::string>&)> f); Loading @@ -65,8 +65,8 @@ class Modprobe { std::vector<std::pair<std::string, std::string>> module_post_softdep_; std::vector<std::string> module_load_; std::unordered_map<std::string, std::string> module_options_; std::set<std::string> module_blacklist_; std::set<std::string> module_blocklist_; std::unordered_set<std::string> module_loaded_; int module_count_ = 0; bool blacklist_enabled = false; bool blocklist_enabled = false; }; Loading
fs_mgr/fs_mgr.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -1065,7 +1065,8 @@ static bool SupportsCheckpoint(FstabEntry* entry) { class CheckpointManager { public: CheckpointManager(int needs_checkpoint = -1) : needs_checkpoint_(needs_checkpoint) {} CheckpointManager(int needs_checkpoint = -1, bool metadata_encrypted = false) : needs_checkpoint_(needs_checkpoint), metadata_encrypted_(metadata_encrypted) {} bool NeedsCheckpoint() { if (needs_checkpoint_ != UNKNOWN) { Loading @@ -1083,7 +1084,7 @@ class CheckpointManager { return true; } if (entry->fs_mgr_flags.checkpoint_blk) { if (entry->fs_mgr_flags.checkpoint_blk && !metadata_encrypted_) { call_vdc({"checkpoint", "restoreCheckpoint", entry->blk_device}, nullptr); } Loading Loading @@ -1192,6 +1193,7 @@ class CheckpointManager { enum { UNKNOWN = -1, NO = 0, YES = 1 }; int needs_checkpoint_; bool metadata_encrypted_; std::map<std::string, std::string> device_map_; }; Loading Loading @@ -1825,11 +1827,11 @@ int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& mount_point) // in turn, and stop on 1st success, or no more match. static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name, const std::string& n_blk_device, const char* tmp_mount_point, int needs_checkpoint) { int needs_checkpoint, bool metadata_encrypted) { int mount_errors = 0; int first_mount_errno = 0; std::string mount_point; CheckpointManager checkpoint_manager(needs_checkpoint); CheckpointManager checkpoint_manager(needs_checkpoint, metadata_encrypted); AvbUniquePtr avb_handle(nullptr); if (!fstab) { Loading Loading @@ -1939,12 +1941,13 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name, } int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point) { return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1); return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1, false); } int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point, bool needs_checkpoint) { return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint); bool needs_checkpoint, bool metadata_encrypted) { return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint, metadata_encrypted); } /* Loading
fs_mgr/include/fs_mgr.h +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ int fs_mgr_mount_all(android::fs_mgr::Fstab* fstab, int mount_mode); int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point); int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point, bool need_cp); char* tmp_mount_point, bool need_cp, bool metadata_encrypted); int fs_mgr_do_mount_one(const android::fs_mgr::FstabEntry& entry, const std::string& mount_point = ""); int fs_mgr_do_tmpfs_mount(const char *n_name); Loading
libappfuse/FuseBridgeLoop.cc +12 −2 Original line number Diff line number Diff line Loading @@ -311,6 +311,8 @@ class BridgeEpollController : private EpollController { } }; std::recursive_mutex FuseBridgeLoop::mutex_; FuseBridgeLoop::FuseBridgeLoop() : opened_(true) { base::unique_fd epoll_fd(epoll_create1(EPOLL_CLOEXEC)); if (epoll_fd.get() == -1) { Loading @@ -328,7 +330,7 @@ bool FuseBridgeLoop::AddBridge(int mount_id, base::unique_fd dev_fd, base::uniqu std::unique_ptr<FuseBridgeEntry> bridge( new FuseBridgeEntry(mount_id, std::move(dev_fd), std::move(proxy_fd))); std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_); if (!opened_) { LOG(ERROR) << "Tried to add a mount to a closed bridge"; return false; Loading Loading @@ -372,7 +374,7 @@ void FuseBridgeLoop::Start(FuseBridgeLoopCallback* callback) { const bool wait_result = epoll_controller_->Wait(bridges_.size(), &entries); LOG(VERBOSE) << "Receive epoll events"; { std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::recursive_mutex> lock(mutex_); if (!(wait_result && ProcessEventLocked(entries, callback))) { for (auto it = bridges_.begin(); it != bridges_.end();) { callback->OnClosed(it->second->mount_id()); Loading @@ -385,5 +387,13 @@ void FuseBridgeLoop::Start(FuseBridgeLoopCallback* callback) { } } void FuseBridgeLoop::Lock() { mutex_.lock(); } void FuseBridgeLoop::Unlock() { mutex_.unlock(); } } // namespace fuse } // namespace android
libappfuse/include/libappfuse/FuseBridgeLoop.h +5 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,10 @@ class FuseBridgeLoop final { // thread from one which invokes |Start|. bool AddBridge(int mount_id, base::unique_fd dev_fd, base::unique_fd proxy_fd); static void Lock(); static void Unlock(); private: bool ProcessEventLocked(const std::unordered_set<FuseBridgeEntry*>& entries, FuseBridgeLoopCallback* callback); Loading @@ -60,7 +64,7 @@ class FuseBridgeLoop final { std::map<int, std::unique_ptr<FuseBridgeEntry>> bridges_; // Lock for multi-threading. std::mutex mutex_; static std::recursive_mutex mutex_; bool opened_; Loading
libmodprobe/include/modprobe/modprobe.h +4 −4 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class Modprobe { std::vector<std::string>* post_dependencies); void ResetModuleCount() { module_count_ = 0; } int GetModuleCount() { return module_count_; } void EnableBlacklist(bool enable); void EnableBlocklist(bool enable); void EnableVerbose(bool enable); private: Loading @@ -55,7 +55,7 @@ class Modprobe { bool ParseSoftdepCallback(const std::vector<std::string>& args); bool ParseLoadCallback(const std::vector<std::string>& args); bool ParseOptionsCallback(const std::vector<std::string>& args); bool ParseBlacklistCallback(const std::vector<std::string>& args); bool ParseBlocklistCallback(const std::vector<std::string>& args); void ParseKernelCmdlineOptions(); void ParseCfg(const std::string& cfg, std::function<bool(const std::vector<std::string>&)> f); Loading @@ -65,8 +65,8 @@ class Modprobe { std::vector<std::pair<std::string, std::string>> module_post_softdep_; std::vector<std::string> module_load_; std::unordered_map<std::string, std::string> module_options_; std::set<std::string> module_blacklist_; std::set<std::string> module_blocklist_; std::unordered_set<std::string> module_loaded_; int module_count_ = 0; bool blacklist_enabled = false; bool blocklist_enabled = false; };