kernel: By default, MNT_DETACH is used as the value for the mount point.

This commit is contained in:
ShirkNeko
2025-11-07 13:37:09 +08:00
parent 4769065cfc
commit 03a164ebb7
3 changed files with 10 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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,
},

View File

@@ -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,
},
]