kernel: clean code
This commit is contained in:
15
kernel/ksu.c
15
kernel/ksu.c
@@ -3,7 +3,9 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/version.h>
|
||||
#include <generated/utsrelease.h>
|
||||
#include <generated/compile.h>
|
||||
#include <linux/version.h> /* LINUX_VERSION_CODE, KERNEL_VERSION macros */
|
||||
|
||||
#include "allowlist.h"
|
||||
#include "feature.h"
|
||||
@@ -40,6 +42,9 @@ void sukisu_custom_config_exit(void)
|
||||
|
||||
int __init kernelsu_init(void)
|
||||
{
|
||||
pr_info("Initialized on: %s (%s) with driver version: %u\n",
|
||||
UTS_RELEASE, UTS_MACHINE, KSU_VERSION);
|
||||
|
||||
#ifdef CONFIG_KSU_DEBUG
|
||||
pr_alert("*************************************************************");
|
||||
pr_alert("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **");
|
||||
@@ -64,11 +69,7 @@ int __init kernelsu_init(void)
|
||||
|
||||
ksu_throne_tracker_init();
|
||||
|
||||
#ifdef KSU_KPROBES_HOOK
|
||||
ksu_ksud_init();
|
||||
#else
|
||||
pr_alert("KPROBES is disabled, KernelSU may not work, please check https://kernelsu.org/guide/how-to-integrate-for-non-gki.html");
|
||||
#endif
|
||||
|
||||
#ifdef MODULE
|
||||
#ifndef CONFIG_KSU_DEBUG
|
||||
@@ -89,11 +90,7 @@ void kernelsu_exit(void)
|
||||
|
||||
destroy_workqueue(ksu_workqueue);
|
||||
|
||||
|
||||
|
||||
#ifdef KSU_KPROBES_HOOK
|
||||
ksu_ksud_exit();
|
||||
#endif
|
||||
|
||||
ksu_syscall_hook_manager_exit();
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ struct manager_list_info {
|
||||
|
||||
bool ksu_queue_work(struct work_struct *work);
|
||||
|
||||
#if 0
|
||||
static inline int startswith(char *s, char *prefix)
|
||||
{
|
||||
return strncmp(s, prefix, strlen(prefix));
|
||||
@@ -56,5 +57,6 @@ static inline int endswith(const char *s, const char *t)
|
||||
return 1;
|
||||
return strcmp(s + slen - tlen, t);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -717,8 +717,6 @@ static const struct ksu_ioctl_cmd_map ksu_ioctl_handlers[] = {
|
||||
{ .cmd = 0, .name = NULL, .handler = NULL, .perm_check = NULL} // Sentine
|
||||
};
|
||||
|
||||
#ifdef KSU_KPROBES_HOOK
|
||||
|
||||
struct ksu_install_fd_tw {
|
||||
struct callback_head cb;
|
||||
int __user *outp;
|
||||
@@ -776,6 +774,7 @@ int ksu_handle_sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef KSU_KPROBES_HOOK
|
||||
// Reboot hook for installing fd
|
||||
static int reboot_handler_pre(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
@@ -812,7 +811,8 @@ void ksu_supercalls_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void ksu_supercalls_exit(void){
|
||||
void ksu_supercalls_exit(void)
|
||||
{
|
||||
#ifdef KSU_KPROBES_HOOK
|
||||
unregister_kprobe(&reboot_kp);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user