You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Add log_ok() for log().ok()
This commit is contained in:
@@ -66,7 +66,7 @@ impl MagiskInit {
|
||||
let orig_init = FsPath::from(unsafe { Utf8CStr::from_ptr_unchecked(self.backup_init()) });
|
||||
|
||||
if orig_init.exists() {
|
||||
orig_init.rename_to(FsPath::from(cstr!("/init"))).log().ok();
|
||||
orig_init.rename_to(FsPath::from(cstr!("/init"))).log_ok();
|
||||
} else {
|
||||
// If the backup init is missing, this means that the boot ramdisk
|
||||
// was created from scratch, and the real init is in a separate CPIO,
|
||||
@@ -151,7 +151,7 @@ pub unsafe extern "C" fn main(
|
||||
}
|
||||
|
||||
if getpid() == 1 {
|
||||
MagiskInit::new(argv).start().log().ok();
|
||||
MagiskInit::new(argv).start().log_ok();
|
||||
}
|
||||
|
||||
1
|
||||
|
||||
+13
-19
@@ -76,26 +76,20 @@ pub fn is_device_mounted(dev: u64, target: Pin<&mut CxxString>) -> bool {
|
||||
impl MagiskInit {
|
||||
pub(crate) fn prepare_data(&self) {
|
||||
debug!("Setup data tmp");
|
||||
fn inner() -> LoggedResult<()> {
|
||||
FsPath::from(cstr!("/data")).mkdir(0o755)?;
|
||||
unsafe {
|
||||
mount(
|
||||
raw_cstr!("magisk"),
|
||||
raw_cstr!("/data"),
|
||||
raw_cstr!("tmpfs"),
|
||||
0,
|
||||
raw_cstr!("mode=755").cast(),
|
||||
)
|
||||
}
|
||||
.as_os_err()?;
|
||||
FsPath::from(cstr!("/data")).mkdir(0o755).log_ok();
|
||||
unsafe {
|
||||
mount(
|
||||
raw_cstr!("magisk"),
|
||||
raw_cstr!("/data"),
|
||||
raw_cstr!("tmpfs"),
|
||||
0,
|
||||
raw_cstr!("mode=755").cast(),
|
||||
)
|
||||
}.as_os_err().log_ok();
|
||||
|
||||
FsPath::from(cstr!("/init")).copy_to(FsPath::from(cstr!("/data/magiskinit")))?;
|
||||
FsPath::from(cstr!("/.backup")).copy_to(FsPath::from(cstr!("/data/.backup")))?;
|
||||
FsPath::from(cstr!("/overlay.d")).copy_to(FsPath::from(cstr!("/data/overlay.d")))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
inner().ok();
|
||||
FsPath::from(cstr!("/init")).copy_to(FsPath::from(cstr!("/data/magiskinit"))).log_ok();
|
||||
FsPath::from(cstr!("/.backup")).copy_to(FsPath::from(cstr!("/data/.backup"))).log_ok();
|
||||
FsPath::from(cstr!("/overlay.d")).copy_to(FsPath::from(cstr!("/data/overlay.d"))).log_ok();
|
||||
}
|
||||
|
||||
pub(crate) fn exec_init(&self) {
|
||||
|
||||
@@ -116,14 +116,14 @@ impl MagiskInit {
|
||||
debug!("Patch @ {:#010X} [{}] -> [{}]", off, from, to);
|
||||
}
|
||||
if let Ok(mut dest) = dest.create(O_CREAT | O_WRONLY, 0) {
|
||||
dest.write_all(map.as_ref()).log().ok();
|
||||
dest.write_all(map.as_ref()).log_ok();
|
||||
} else {
|
||||
error!("Failed to create {}", dest);
|
||||
}
|
||||
} else {
|
||||
error!("Failed to open {} for hexpatch", src);
|
||||
}
|
||||
clone_attr(src, dest).log().ok();
|
||||
clone_attr(src, dest).log_ok();
|
||||
unsafe {
|
||||
mount(dest.as_ptr(), src.as_ptr(), null(), MS_BIND, null())
|
||||
.as_os_err()
|
||||
|
||||
Reference in New Issue
Block a user