ksud: report module mounted event to kernel
This commit is contained in:
@@ -152,6 +152,9 @@ pub fn on_post_data_fs() -> Result<()> {
|
|||||||
mount::AutoMountExt4::try_new(target_update_img, module_dir, false)
|
mount::AutoMountExt4::try_new(target_update_img, module_dir, false)
|
||||||
.with_context(|| "mount module image failed".to_string())?;
|
.with_context(|| "mount module image failed".to_string())?;
|
||||||
|
|
||||||
|
// tell kernel that we've mount the module, so that it can do some optimization
|
||||||
|
crate::ksu::report_module_mounted();
|
||||||
|
|
||||||
// if we are in safe mode, we should disable all modules
|
// if we are in safe mode, we should disable all modules
|
||||||
if safe_mode {
|
if safe_mode {
|
||||||
warn!("safe mode, skip post-fs-data scripts and disable all modules!");
|
warn!("safe mode, skip post-fs-data scripts and disable all modules!");
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ pub const CMD_CHECK_SAFEMODE: u64 = 9;
|
|||||||
|
|
||||||
const EVENT_POST_FS_DATA: u64 = 1;
|
const EVENT_POST_FS_DATA: u64 = 1;
|
||||||
const EVENT_BOOT_COMPLETED: u64 = 2;
|
const EVENT_BOOT_COMPLETED: u64 = 2;
|
||||||
|
const EVENT_MODULE_MOUNTED: u64 = 3;
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
pub fn grant_root() -> Result<()> {
|
pub fn grant_root() -> Result<()> {
|
||||||
@@ -339,3 +340,7 @@ pub fn report_post_fs_data() {
|
|||||||
pub fn report_boot_complete() {
|
pub fn report_boot_complete() {
|
||||||
report_event(EVENT_BOOT_COMPLETED);
|
report_event(EVENT_BOOT_COMPLETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn report_module_mounted() {
|
||||||
|
report_event(EVENT_MODULE_MOUNTED);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user