kernel/manager: No longer need to add unmounting for default mount points
This commit is contained in:
@@ -33,44 +33,12 @@ static struct umount_entry *find_entry_locked(const char *path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_default_entries(void)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
const struct {
|
|
||||||
const char *path;
|
|
||||||
int flags;
|
|
||||||
} defaults[] = {
|
|
||||||
{ "/odm", 0 },
|
|
||||||
{ "/system", 0 },
|
|
||||||
{ "/vendor", 0 },
|
|
||||||
{ "/product", 0 },
|
|
||||||
{ "/system_ext", 0 },
|
|
||||||
{ "/data/adb/modules", MNT_DETACH },
|
|
||||||
{ "/debug_ramdisk", MNT_DETACH },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i = 0; i < ARRAY_SIZE(defaults); i++) {
|
|
||||||
ret = ksu_umount_manager_add(defaults[i].path,
|
|
||||||
defaults[i].flags,
|
|
||||||
true); // is_default = true
|
|
||||||
if (ret) {
|
|
||||||
pr_err("Failed to add default entry: %s, ret=%d\n",
|
|
||||||
defaults[i].path, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pr_info("Initialized %zu default umount entries\n", ARRAY_SIZE(defaults));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ksu_umount_manager_init(void)
|
int ksu_umount_manager_init(void)
|
||||||
{
|
{
|
||||||
INIT_LIST_HEAD(&g_umount_mgr.entry_list);
|
INIT_LIST_HEAD(&g_umount_mgr.entry_list);
|
||||||
spin_lock_init(&g_umount_mgr.lock);
|
spin_lock_init(&g_umount_mgr.lock);
|
||||||
|
|
||||||
return init_default_entries();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ksu_umount_manager_exit(void)
|
void ksu_umount_manager_exit(void)
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ private val SPACING_LARGE = 16.dp
|
|||||||
data class UmountPathEntry(
|
data class UmountPathEntry(
|
||||||
val path: String,
|
val path: String,
|
||||||
val flags: Int,
|
val flags: Int,
|
||||||
val isDefault: Boolean
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@@ -291,10 +290,7 @@ fun UmountPathCard(
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Folder,
|
imageVector = Icons.Filled.Folder,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = if (entry.isDefault)
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
MaterialTheme.colorScheme.primary
|
|
||||||
else
|
|
||||||
MaterialTheme.colorScheme.secondary,
|
|
||||||
modifier = Modifier.size(24.dp)
|
modifier = Modifier.size(24.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -311,17 +307,11 @@ fun UmountPathCard(
|
|||||||
append(context.getString(R.string.flags))
|
append(context.getString(R.string.flags))
|
||||||
append(": ")
|
append(": ")
|
||||||
append(entry.flags.toUmountFlagName(context))
|
append(entry.flags.toUmountFlagName(context))
|
||||||
if (entry.isDefault) {
|
|
||||||
append(" | ")
|
|
||||||
append(context.getString(R.string.default_entry))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entry.isDefault) {
|
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@@ -343,7 +333,6 @@ fun UmountPathCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AddUmountPathDialog(
|
fun AddUmountPathDialog(
|
||||||
@@ -404,11 +393,10 @@ private fun parseUmountPaths(output: String): List<UmountPathEntry> {
|
|||||||
|
|
||||||
return lines.drop(2).mapNotNull { line ->
|
return lines.drop(2).mapNotNull { line ->
|
||||||
val parts = line.trim().split(Regex("\\s+"))
|
val parts = line.trim().split(Regex("\\s+"))
|
||||||
if (parts.size >= 3) {
|
if (parts.size >= 2) {
|
||||||
UmountPathEntry(
|
UmountPathEntry(
|
||||||
path = parts[0],
|
path = parts[0],
|
||||||
flags = parts[1].toIntOrNull() ?: -1,
|
flags = parts[1].toIntOrNull() ?: -1
|
||||||
isDefault = parts[2].equals("Yes", ignoreCase = true)
|
|
||||||
)
|
)
|
||||||
} else null
|
} else null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
use anyhow::{Context, Result};
|
|
||||||
use log::{info, warn};
|
|
||||||
use std::path::Path;
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
use crate::kpm;
|
use crate::kpm;
|
||||||
use crate::module::{handle_updated_modules, prune_modules};
|
use crate::module::{handle_updated_modules, prune_modules};
|
||||||
@@ -9,6 +6,9 @@ use crate::{
|
|||||||
assets, defs, ksucalls, metamodule, restorecon,
|
assets, defs, ksucalls, metamodule, restorecon,
|
||||||
utils::{self},
|
utils::{self},
|
||||||
};
|
};
|
||||||
|
use anyhow::{Context, Result};
|
||||||
|
use log::{info, warn};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
pub fn on_post_data_fs() -> Result<()> {
|
pub fn on_post_data_fs() -> Result<()> {
|
||||||
ksucalls::report_post_fs_data();
|
ksucalls::report_post_fs_data();
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ impl UmountManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_umount_manager() -> Result<UmountManager> {
|
pub fn init_umount_manager() -> Result<UmountManager> {
|
||||||
let mut manager = UmountManager::new(None)?;
|
let manager = UmountManager::new(None)?;
|
||||||
|
|
||||||
if !Path::new(CONFIG_FILE).exists() {
|
if !Path::new(CONFIG_FILE).exists() {
|
||||||
manager.save_config()?;
|
manager.save_config()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user