Cleanup persist props code

This commit is contained in:
topjohnwu
2023-09-06 15:52:14 -07:00
parent 1d7cff7703
commit 35b3c8ba5c
7 changed files with 116 additions and 113 deletions
+10 -9
View File
@@ -5,9 +5,7 @@ use base::Utf8CStr;
use cert::read_certificate;
use daemon::{daemon_entry, find_apk_path, get_magiskd, zygisk_entry, MagiskD};
use logging::{android_logging, magisk_logging, zygisk_logging};
use resetprop::persist::{
persist_delete_prop, persist_get_prop, persist_get_props, persist_set_prop,
};
use resetprop::{persist_delete_prop, persist_get_prop, persist_get_props, persist_set_prop};
mod cert;
#[path = "../include/consts.rs"]
@@ -19,12 +17,15 @@ mod resetprop;
#[cxx::bridge]
pub mod ffi {
extern "C++" {
pub type prop_cb;
include!("resetprop/resetprop.hpp");
#[cxx_name = "prop_cb"]
type PropCb;
unsafe fn get_prop_rs(name: *const c_char, persist: bool) -> String;
unsafe fn prop_cb_exec(cb: Pin<&mut PropCb>, name: *const c_char, value: *const c_char);
include!("../base/files.hpp");
pub unsafe fn get_prop_rs(name: *const c_char, persist: bool) -> String;
pub unsafe fn prop_cb_exec(cb: *mut prop_cb, name: *const c_char, value: *const c_char);
pub unsafe fn clone_attr(src: *const c_char, dst: *const c_char);
unsafe fn clone_attr(src: *const c_char, dst: *const c_char);
}
extern "Rust" {
@@ -34,8 +35,8 @@ pub mod ffi {
fn zygisk_logging();
fn find_apk_path(pkg: &[u8], data: &mut [u8]) -> usize;
fn read_certificate(fd: i32, version: i32) -> Vec<u8>;
unsafe fn persist_get_prop(name: *const c_char, prop_cb: *mut prop_cb);
unsafe fn persist_get_props(prop_cb: *mut prop_cb);
unsafe fn persist_get_prop(name: *const c_char, prop_cb: Pin<&mut PropCb>);
unsafe fn persist_get_props(prop_cb: Pin<&mut PropCb>);
unsafe fn persist_delete_prop(name: *const c_char) -> bool;
unsafe fn persist_set_prop(name: *const c_char, value: *const c_char) -> bool;
}