Make tmpfs mount of magic mount atomic

This avoid system libraries disappear temporarily during magic mount,
which causes some dynamic executables fails to run during post-fs-data.
This commit is contained in:
LoveSy
2023-12-08 13:59:02 +08:00
committed by John Wu
parent d49b02b274
commit 1fd49e4987
2 changed files with 26 additions and 18 deletions
+7 -1
View File
@@ -45,6 +45,8 @@ public:
// Don't call the following two functions before prepare
const string &node_path();
const string worker_path();
string mirror_path() { return mirror_dir + node_path(); }
virtual void mount() = 0;
@@ -67,7 +69,7 @@ protected:
delete other;
}
void create_and_mount(const char *reason, const string &src);
void create_and_mount(const char *reason, const string &src, bool ro=false);
// Use bit 7 of _file_type for exist status
bool exist() const { return static_cast<bool>(_file_type & (1 << 7)); }
@@ -314,3 +316,7 @@ const string &node_entry::node_path() {
_node_path = _parent->node_path() + '/' + _name;
return _node_path;
}
const string node_entry::worker_path() {
return get_magisk_tmp() + "/"s WORKERDIR + node_path();
}