kernel: fmt
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#include "linux/uidgid.h"
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/memory.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kprobes.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/kprobes.h>
|
||||
#include <linux/memory.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/slab.h>
|
||||
#include <asm-generic/errno-base.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/uidgid.h>
|
||||
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/fdtable.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/fs_struct.h>
|
||||
#include <linux/namei.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
#include <linux/delay.h> // msleep
|
||||
|
||||
@@ -35,14 +35,14 @@ static struct workqueue_struct *ksu_workqueue;
|
||||
static struct work_struct ksu_save_work;
|
||||
static struct work_struct ksu_load_work;
|
||||
|
||||
bool persistent_allow_list();
|
||||
bool persistent_allow_list(void);
|
||||
|
||||
bool ksu_allow_uid(uid_t uid, bool allow) {
|
||||
|
||||
// find the node first!
|
||||
struct perm_data* p;
|
||||
struct list_head* pos;
|
||||
bool result;
|
||||
struct perm_data *p = NULL;
|
||||
struct list_head *pos = NULL;
|
||||
bool result = false;
|
||||
list_for_each(pos, &allow_list) {
|
||||
p = list_entry(pos, struct perm_data, list);
|
||||
pr_info("ksu_allow_uid :%d, allow: %d\n", p->uid, p->allow);
|
||||
@@ -73,8 +73,8 @@ exit:
|
||||
}
|
||||
|
||||
bool ksu_is_allow_uid(uid_t uid) {
|
||||
struct perm_data* p;
|
||||
struct list_head* pos;
|
||||
struct perm_data *p = NULL;
|
||||
struct list_head *pos = NULL;
|
||||
list_for_each(pos, &allow_list) {
|
||||
p = list_entry(pos, struct perm_data, list);
|
||||
pr_info("uid :%d, allow: %d\n", p->uid, p->allow);
|
||||
@@ -87,8 +87,8 @@ bool ksu_is_allow_uid(uid_t uid) {
|
||||
}
|
||||
|
||||
bool ksu_get_allow_list(int *array, int *length, bool allow) {
|
||||
struct perm_data* p;
|
||||
struct list_head* pos;
|
||||
struct perm_data *p = NULL;
|
||||
struct list_head *pos = NULL;
|
||||
int i = 0;
|
||||
list_for_each(pos, &allow_list) {
|
||||
p = list_entry(pos, struct perm_data, list);
|
||||
@@ -102,15 +102,10 @@ bool ksu_get_allow_list(int* array, int* length, bool allow) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void do_persistent_allow_list(struct work_struct *work)
|
||||
{
|
||||
struct perm_data* p;
|
||||
struct list_head* pos;
|
||||
loff_t off;
|
||||
void do_persistent_allow_list(struct work_struct *work) {
|
||||
struct perm_data *p = NULL;
|
||||
struct list_head *pos = NULL;
|
||||
loff_t off = 0;
|
||||
|
||||
struct file *fp = filp_open("/data/adb/ksu_list", O_WRONLY | O_CREAT, 0644);
|
||||
|
||||
@@ -132,9 +127,9 @@ void do_persistent_allow_list(struct work_struct *work)
|
||||
|
||||
void do_load_allow_list(struct work_struct *work) {
|
||||
|
||||
loff_t off;
|
||||
ssize_t ret;
|
||||
struct file* fp;
|
||||
loff_t off = 0;
|
||||
ssize_t ret = 0;
|
||||
struct file *fp = NULL;
|
||||
|
||||
fp = filp_open("/data/adb/", O_RDONLY, 0);
|
||||
if (IS_ERR(fp)) {
|
||||
@@ -157,7 +152,7 @@ void do_load_allow_list(struct work_struct *work) {
|
||||
|
||||
while (true) {
|
||||
u32 uid;
|
||||
bool allow;
|
||||
bool allow = false;
|
||||
ret = kernel_read(fp, &uid, sizeof(uid), &off);
|
||||
pr_info("kernel read ret: %d, off: %ld\n", ret, off);
|
||||
if (ret <= 0) {
|
||||
@@ -182,17 +177,17 @@ static int init_work(void) {
|
||||
}
|
||||
|
||||
// make sure allow list works cross boot
|
||||
bool persistent_allow_list() {
|
||||
bool persistent_allow_list(void) {
|
||||
queue_work(ksu_workqueue, &ksu_save_work);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool load_allow_list() {
|
||||
bool load_allow_list(void) {
|
||||
queue_work(ksu_workqueue, &ksu_load_work);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ksu_allowlist_init() {
|
||||
bool ksu_allowlist_init(void) {
|
||||
|
||||
INIT_LIST_HEAD(&allow_list);
|
||||
|
||||
@@ -203,7 +198,7 @@ bool ksu_allowlist_init() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ksu_allowlist_exit() {
|
||||
bool ksu_allowlist_exit(void) {
|
||||
|
||||
destroy_workqueue(ksu_workqueue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user