fix remove_proc_subtree

This commit is contained in:
zy
2023-12-01 11:31:46 +08:00
parent 4be788ed42
commit 031c0bc8c5

View File

@@ -5,7 +5,7 @@
#include <linux/types.h>
#include <linux/uaccess.h>
#define PROC_DIR = "variable_monitor"
const char* proc_dir = "variable_monitor";
int def_interval_ns = DEFAULT_INTERVAL_NS;
int dump_reset_sec = DEFAULT_DUMP_RESET_SEC;
@@ -67,7 +67,7 @@ static const struct proc_ops proc_dump_reset_sec_ops = {
int monitor_proc_init(void) {
struct proc_dir_entry *dir;
dir = proc_mkdir(PROC_DIR, NULL);
dir = proc_mkdir(proc_dir, NULL);
if (!dir) {
pr_err("variable_monitor: failed to create /proc directory\n");
return -ENOMEM;
@@ -80,8 +80,8 @@ int monitor_proc_init(void) {
}
int monitor_proc_exit(void) {
remove_proc_entry("def_interval_ns", NULL);
remove_proc_entry("dump_reset_sec", NULL);
remove_proc_subtree(PROC_DIR, NULL);
// remove_proc_entry("def_interval_ns", NULL);
// remove_proc_entry("dump_reset_sec", NULL);
remove_proc_subtree(proc_dir, NULL);
return 0;
}