mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 03:20:46 -05:00
Run through clippy and rustfmt
This commit is contained in:
@@ -3,10 +3,10 @@ use crate::logging::setup_klog;
|
||||
use crate::mount::is_rootfs;
|
||||
use crate::twostage::hexpatch_init_for_second_stage;
|
||||
use base::libc::{basename, getpid, mount, umask};
|
||||
use base::{LibcReturn, LoggedResult, ResultExt, cstr, info, raw_cstr, nix, Utf8CStr};
|
||||
use base::nix::mount::MsFlags;
|
||||
use base::{LibcReturn, LoggedResult, ResultExt, Utf8CStr, cstr, info, nix, raw_cstr};
|
||||
use std::ffi::{CStr, c_char};
|
||||
use std::ptr::null;
|
||||
use base::nix::mount::MsFlags;
|
||||
|
||||
impl MagiskInit {
|
||||
fn new(argv: *mut *mut c_char) -> Self {
|
||||
@@ -60,8 +60,8 @@ impl MagiskInit {
|
||||
MsFlags::MS_REMOUNT,
|
||||
Some(cstr!("size=100%")),
|
||||
)
|
||||
.check_os_err("mount", Some("/data"), Some("tmpfs"))
|
||||
.log_ok();
|
||||
.check_os_err("mount", Some("/data"), Some("tmpfs"))
|
||||
.log_ok();
|
||||
}
|
||||
|
||||
cstr!("/init").unmount().ok();
|
||||
|
||||
@@ -81,14 +81,19 @@ impl MagiskInit {
|
||||
|
||||
if use_rootfs {
|
||||
cstr!("/magisk").mkdir(0o755).log_ok();
|
||||
rootfs_magisktmp = cstr!("/magisk").bind_mount_to(cstr!("/data"), false)
|
||||
rootfs_magisktmp = cstr!("/magisk")
|
||||
.bind_mount_to(cstr!("/data"), false)
|
||||
.is_ok();
|
||||
}
|
||||
|
||||
if rootfs_magisktmp {
|
||||
cstr!("/init").rename_to(cstr!("/magisk/magiskinit")).log_ok();
|
||||
cstr!("/init")
|
||||
.rename_to(cstr!("/magisk/magiskinit"))
|
||||
.log_ok();
|
||||
cstr!("/.backup").copy_to(cstr!("/magisk/.backup")).ok();
|
||||
cstr!("/overlay.d").rename_to(cstr!("/magisk/overlay.d")).ok();
|
||||
cstr!("/overlay.d")
|
||||
.rename_to(cstr!("/magisk/overlay.d"))
|
||||
.ok();
|
||||
} else {
|
||||
nix::mount::mount(
|
||||
Some(cstr!("magisk")),
|
||||
@@ -97,8 +102,8 @@ impl MagiskInit {
|
||||
MsFlags::empty(),
|
||||
Some(cstr!("mode=755")),
|
||||
)
|
||||
.check_os_err("mount", Some("/data"), Some("tmpfs"))
|
||||
.log_ok();
|
||||
.check_os_err("mount", Some("/data"), Some("tmpfs"))
|
||||
.log_ok();
|
||||
|
||||
cstr!("/init").copy_to(cstr!("/data/magiskinit")).ok();
|
||||
cstr!("/.backup").copy_to(cstr!("/data/.backup")).ok();
|
||||
|
||||
@@ -86,7 +86,9 @@ impl MagiskInit {
|
||||
}
|
||||
|
||||
// Binding mounting from rootfs is not supported before Linux 3.12
|
||||
cstr!("/sdcard").create(OFlag::O_RDONLY | OFlag::O_CLOEXEC, 0).log_ok();
|
||||
cstr!("/sdcard")
|
||||
.create(OFlag::O_RDONLY | OFlag::O_CLOEXEC, 0)
|
||||
.log_ok();
|
||||
cstr!("/data/magiskinit")
|
||||
.bind_mount_to(cstr!("/sdcard"), false)
|
||||
.log_ok();
|
||||
|
||||
Reference in New Issue
Block a user