[REFACTOR] move and rename uninstall_us_proc_probes()
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 20 May 2013 12:50:00 +0000 (16:50 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 20 May 2013 12:53:38 +0000 (16:53 +0400)
rename:
uninstall_us_proc_probes() --> sspt_proc_uninstall()

move:
from src/modules/driver/us_proc_inst.c
to src/modules/driver/sspt/sspt_proc.c

driver/helper.c
driver/sspt/sspt_proc.c
driver/sspt/sspt_proc.h
driver/us_proc_inst.c
driver/us_proc_inst.h

index 7138df5..0b9d868 100644 (file)
@@ -89,7 +89,7 @@ static struct kretprobe pf_kretprobe = {
 
 static void recover_child(struct task_struct *child_task, struct sspt_proc *proc)
 {
-       uninstall_us_proc_probes(child_task, proc, US_DISARM);
+       sspt_proc_uninstall(proc, child_task, US_DISARM);
        dbi_disarm_urp_inst_for_task(current, child_task);
 }
 
@@ -147,7 +147,7 @@ static int mr_pre_handler(struct kprobe *p, struct pt_regs *regs)
 
        proc = sspt_proc_get_by_task(task);
        if (proc) {
-               int ret = uninstall_us_proc_probes(task, proc, US_UNREGS_PROBE);
+               int ret = sspt_proc_uninstall(proc, task, US_UNREGS_PROBE);
                if (ret != 0) {
                        printk("failed to uninstall IPs (%d)!\n", ret);
                }
index 93c72a3..44c81fa 100644 (file)
@@ -22,6 +22,7 @@
  *
  */
 
+#include "sspt.h"
 #include "sspt_proc.h"
 #include "sspt_page.h"
 #include <linux/slab.h>
@@ -253,3 +254,19 @@ void sspt_proc_install(struct sspt_proc *proc)
 
        mm_read_unlock(mm, atomic, lock);
 }
+
+int sspt_proc_uninstall(struct sspt_proc *proc, struct task_struct *task, enum US_FLAGS flag)
+{
+       int err = 0;
+       struct sspt_file *file;
+
+       list_for_each_entry_rcu(file, &proc->file_list, list) {
+               err = sspt_file_uninstall(file, task, flag);
+               if (err != 0) {
+                       printk("ERROR sspt_proc_uninstall: err=%d\n", err);
+                       return err;
+               }
+       }
+
+       return err;
+}
index 453e004..cbd151e 100644 (file)
@@ -59,5 +59,6 @@ struct sspt_file *sspt_proc_find_file_or_new(struct sspt_proc *proc,
 
 void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr);
 void sspt_proc_install(struct sspt_proc *proc);
+int sspt_proc_uninstall(struct sspt_proc *proc, struct task_struct *task, enum US_FLAGS flag);
 
 #endif /* __SSPT_PROC__ */
index 51025e8..6ab82ce 100644 (file)
@@ -162,7 +162,7 @@ int deinst_usr_space_proc (void)
        for_each_process(task) {
                proc = sspt_proc_get_by_task(task);
                if (proc) {
-                       int ret = uninstall_us_proc_probes(task, proc, US_UNREGS_PROBE);
+                       int ret = sspt_proc_uninstall(proc, task, US_UNREGS_PROBE);
                        if (ret) {
                                EPRINTF ("failed to uninstall IPs (%d)!", ret);
                        }
@@ -222,22 +222,6 @@ int inst_usr_space_proc (void)
 
 void print_vma(struct mm_struct *mm);
 
-int uninstall_us_proc_probes(struct task_struct *task, struct sspt_proc *proc, enum US_FLAGS flag)
-{
-       int err = 0;
-       struct sspt_file *file;
-
-       list_for_each_entry_rcu(file, &proc->file_list, list) {
-               err = sspt_file_uninstall(file, task, flag);
-               if (err != 0) {
-                       // TODO:
-                       return err;
-               }
-       }
-
-       return err;
-}
-
 void print_vma(struct mm_struct *mm)
 {
        struct vm_area_struct *vma;
index f85a692..2b16dfd 100644 (file)
@@ -51,7 +51,6 @@ int install_otg_ip(unsigned long addr,
                        unsigned long jp_handler,
                        uretprobe_handler_t rp_handler);
 
-int uninstall_us_proc_probes(struct task_struct *task, struct sspt_proc *proc, enum US_FLAGS flag);
 int check_vma(struct vm_area_struct *vma);
 
 #endif /* !defined(__US_PROC_INST_H__) */