kernel: refactor umount functions for improved logging and clarity
Co-authored-by: rsuntk <rsuntk@yukiprjkt.my.id> Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
@@ -977,17 +977,13 @@ static bool should_umount(struct path *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KSU_HAS_PATH_UMOUNT
|
#ifdef KSU_HAS_PATH_UMOUNT
|
||||||
static int ksu_umount_mnt(struct path *path, int flags)
|
static void ksu_path_umount(const char *mnt, struct path *path, int flags)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) || defined(KSU_UMOUNT)
|
int err = path_umount(path, flags);
|
||||||
return path_umount(path, flags);
|
pr_info("%s: path: %s ret: %d\n", __func__, mnt, err);
|
||||||
#else
|
|
||||||
// TODO: umount for non GKI kernel
|
|
||||||
return -ENOSYS;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int ksu_sys_umount(const char *mnt, int flags)
|
static void ksu_sys_umount(const char *mnt, int flags)
|
||||||
{
|
{
|
||||||
char __user *usermnt = (char __user *)mnt;
|
char __user *usermnt = (char __user *)mnt;
|
||||||
|
|
||||||
@@ -999,7 +995,7 @@ static int ksu_sys_umount(const char *mnt, int flags)
|
|||||||
long ret = sys_umount(usermnt, flags); // cuz asmlinkage long sys##name
|
long ret = sys_umount(usermnt, flags); // cuz asmlinkage long sys##name
|
||||||
#endif
|
#endif
|
||||||
set_fs(old_fs);
|
set_fs(old_fs);
|
||||||
pr_info("%s: path: %s code: %d \n", __func__, usermnt, ret);
|
pr_info("%s: path: %s ret: %d \n", __func__, usermnt, ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1032,13 +1028,10 @@ static void ksu_try_umount(const char *mnt, bool check_mnt, int flags)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KSU_HAS_PATH_UMOUNT
|
#ifdef KSU_HAS_PATH_UMOUNT
|
||||||
err = ksu_umount_mnt(&path, flags);
|
ksu_path_umount(mnt, &path, flags);
|
||||||
#else
|
#else
|
||||||
err = ksu_sys_umount(mnt, flags);
|
ksu_sys_umount(mnt, flags);
|
||||||
#endif
|
#endif
|
||||||
if (err) {
|
|
||||||
pr_warn("umount %s failed: %d\n", mnt, err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT
|
#ifdef CONFIG_KSU_SUSFS_TRY_UMOUNT
|
||||||
|
|||||||
Reference in New Issue
Block a user