mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-21 10:58:31 +00:00
Move BootConfig::print to rust
This commit is contained in:
parent
c99f4a591b
commit
563f0d5ad5
@ -158,18 +158,6 @@ void BootConfig::set(const kv_pairs &kv) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
void BootConfig::print() const noexcept {
|
||||
LOGD("skip_initramfs=[%d]\n", skip_initramfs);
|
||||
LOGD("force_normal_boot=[%d]\n", force_normal_boot);
|
||||
LOGD("rootwait=[%d]\n", rootwait);
|
||||
LOGD("slot=[%s]\n", slot.data());
|
||||
LOGD("dt_dir=[%s]\n", dt_dir.data());
|
||||
LOGD("fstab_suffix=[%s]\n", fstab_suffix.data());
|
||||
LOGD("hardware=[%s]\n", hardware.data());
|
||||
LOGD("hardware.platform=[%s]\n", hardware_plat.data());
|
||||
LOGD("emulator=[%d]\n", emulator);
|
||||
}
|
||||
|
||||
#define read_dt(name, key) \
|
||||
ssprintf(file_name, sizeof(file_name), "%s/" name, dt_dir.data()); \
|
||||
if (access(file_name, R_OK) == 0) { \
|
||||
|
20
native/src/init/getinfo.rs
Normal file
20
native/src/init/getinfo.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use std::ffi::CStr;
|
||||
use base::debug;
|
||||
use crate::ffi::BootConfig;
|
||||
|
||||
impl BootConfig {
|
||||
pub(crate) fn print(&self) {
|
||||
debug!("skip_initramfs=[{}]", self.skip_initramfs);
|
||||
debug!("force_normal_boot=[{}]", self.force_normal_boot);
|
||||
debug!("rootwait=[{}]", self.rootwait);
|
||||
unsafe {
|
||||
debug!("slot=[{:?}]", CStr::from_ptr(self.slot.as_ptr()));
|
||||
debug!("dt_dir=[{:?}]", CStr::from_ptr(self.dt_dir.as_ptr()));
|
||||
debug!("fstab_suffix=[{:?}]", CStr::from_ptr(self.fstab_suffix.as_ptr()));
|
||||
debug!("hardware=[{:?}]", CStr::from_ptr(self.hardware.as_ptr()));
|
||||
debug!("hardware.platform=[{:?}]", CStr::from_ptr(self.hardware_plat.as_ptr()));
|
||||
}
|
||||
debug!("emulator=[{}]", self.emulator);
|
||||
debug!("partition_map=[{:?}]", self.partition_map);
|
||||
}
|
||||
}
|
@ -18,9 +18,11 @@ use std::ptr::null as nullptr;
|
||||
mod logging;
|
||||
mod mount;
|
||||
mod rootdir;
|
||||
mod getinfo;
|
||||
|
||||
#[cxx::bridge]
|
||||
pub mod ffi {
|
||||
#[derive(Debug)]
|
||||
struct KeyValue {
|
||||
key: String,
|
||||
value: String,
|
||||
@ -57,6 +59,7 @@ pub mod ffi {
|
||||
}
|
||||
|
||||
extern "Rust" {
|
||||
fn print(self: &BootConfig);
|
||||
fn prepare_data(self: &MagiskInit);
|
||||
fn exec_init(self: &MagiskInit);
|
||||
}
|
||||
@ -68,7 +71,6 @@ pub mod ffi {
|
||||
#[cxx_name = "Utf8CStr"]
|
||||
type Utf8CStrRef<'a> = base::ffi::Utf8CStrRef<'a>;
|
||||
fn init(self: &mut BootConfig);
|
||||
fn print(self: &BootConfig);
|
||||
type kv_pairs;
|
||||
fn set(self: &mut BootConfig, config: &kv_pairs);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user