From 03a164ebb78d6dd6e49bf0794f890e27033b939c Mon Sep 17 00:00:00 2001 From: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Date: Fri, 7 Nov 2025 13:37:09 +0800 Subject: [PATCH] kernel: By default, MNT_DETACH is used as the value for the mount point. --- kernel/umount_manager.c | 3 +++ userspace/ksud/src/cli.rs | 2 +- userspace/ksud/src/umount_manager.rs | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/umount_manager.c b/kernel/umount_manager.c index a3c3ac74..b6465ea0 100644 --- a/kernel/umount_manager.c +++ b/kernel/umount_manager.c @@ -109,6 +109,9 @@ int ksu_umount_manager_add(const char *path, bool check_mnt, int flags, bool is_ unsigned long irqflags; int ret = 0; + if (flags == -1) + flags = MNT_DETACH; + if (!path || strlen(path) == 0 || strlen(path) >= 256) { return -EINVAL; } diff --git a/userspace/ksud/src/cli.rs b/userspace/ksud/src/cli.rs index ce67a6cb..b88aa4f3 100644 --- a/userspace/ksud/src/cli.rs +++ b/userspace/ksud/src/cli.rs @@ -361,7 +361,7 @@ enum Umount { check_mnt: bool, /// Umount flags (0 or 8 for MNT_DETACH) - #[arg(long, default_value = "0")] + #[arg(long, default_value = "-1")] flags: i32, }, diff --git a/userspace/ksud/src/umount_manager.rs b/userspace/ksud/src/umount_manager.rs index e30a76cf..5f9627e4 100644 --- a/userspace/ksud/src/umount_manager.rs +++ b/userspace/ksud/src/umount_manager.rs @@ -87,7 +87,11 @@ impl UmountManager { } pub fn add_entry(&mut self, path: &str, check_mnt: bool, flags: i32) -> Result<()> { - let exists = self.defaults.iter().chain(&self.config.entries).any(|e| e.path == path); + let exists = self + .defaults + .iter() + .chain(&self.config.entries) + .any(|e| e.path == path); if exists { return Err(anyhow!("Entry already exists: {}", path)); } @@ -166,7 +170,7 @@ impl UmountManager { UmountEntry { path: "/data/adb/modules".to_string(), check_mnt: false, - flags: 0x00000002, // MNT_DETACH + flags: -1, is_default: true, }, ]