Skip to content

Commit

Permalink
Use self implemented parse_mount_info
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 authored and topjohnwu committed Feb 28, 2024
1 parent 1a70796 commit 62fc786
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 198 deletions.
133 changes: 1 addition & 132 deletions native/src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion native/src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ x509-cert = "0.2"
der = "0.7"
bytemuck = "1.14"
fdt = "0.1"
procfs = { version = "0.16", default-features = false }

[workspace.dependencies.argh]
git = "https://github.com/google/argh.git"
Expand Down
1 change: 0 additions & 1 deletion native/src/init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ cxx-gen = { workspace = true }
base = { path = "../base" }
magiskpolicy = { path = "../sepolicy" }
cxx = { workspace = true }
procfs = { workspace = true }
2 changes: 1 addition & 1 deletion native/src/init/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod ffi {
fn setup_klog();
fn inject_magisk_rc(fd: i32, tmp_dir: Utf8CStrRef);
fn switch_root(path: Utf8CStrRef);
fn is_device_mounted(dev: u64, mnt_point: &mut Vec<u8>) -> bool;
fn is_device_mounted(dev: u64, target: Pin<&mut CxxString>) -> bool;
}

unsafe extern "C++" {
Expand Down
4 changes: 2 additions & 2 deletions native/src/init/mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ static void mount_preinit_dir(string preinit_dev) {
xmkdir(PREINITMNT, 0);
bool mounted = false;
// First, find if it is already mounted
rust::Vec<uint8_t> mnt_point;
std::string mnt_point;
if (rust::is_device_mounted(dev, mnt_point)) {
// Already mounted, just bind mount
xmount((const char *) mnt_point.data(), PREINITMNT, nullptr, MS_BIND, nullptr);
xmount(mnt_point.data(), PREINITMNT, nullptr, MS_BIND, nullptr);
mounted = true;
}

Expand Down
Loading

0 comments on commit 62fc786

Please sign in to comment.