2
0
mirror of https://github.com/topjohnwu/Magisk synced 2025-09-05 17:25:22 +00:00

Move more I/O operations into Rust

This commit is contained in:
topjohnwu
2023-09-26 20:18:37 -07:00
parent 5d07d0b964
commit a55d570213
13 changed files with 470 additions and 257 deletions

View File

@@ -164,11 +164,11 @@ void module_node::mount() {
void tmpfs_node::mount() {
string src = mirror_path();
const string &dest = node_path();
file_attr a{};
const char *src_path;
if (access(src.data(), F_OK) == 0)
getattr(src.data(), &a);
src_path = src.data();
else
getattr(parent()->node_path().data(), &a);
src_path = parent()->node_path().data();
if (!isa<tmpfs_node>(parent())) {
auto worker_dir = MAGISKTMP + "/" WORKERDIR + dest;
mkdirs(worker_dir.data(), 0);
@@ -177,7 +177,7 @@ void tmpfs_node::mount() {
// We don't need another layer of tmpfs if parent is tmpfs
mkdir(dest.data(), 0);
}
setattr(dest.data(), &a);
clone_attr(src_path, dest.data());
dir_node::mount();
}