[REFACTOR] move /un/register_usprobe()
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 3 Jun 2013 07:36:23 +0000 (11:36 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 3 Jun 2013 07:36:23 +0000 (11:36 +0400)
from src/modules/driver/us_proc_inst.c
to src/modules/driver/sspt/sspt.h

driver/sspt/sspt.h
driver/us_proc_inst.c
driver/us_proc_inst.h

index 982c6a5..cb26600 100644 (file)
@@ -97,7 +97,45 @@ enum US_FLAGS {
 
 static inline int sspt_register_usprobe(struct us_ip *ip)
 {
-       return register_usprobe(ip);
+       int ret = 0;
+
+       ip->jprobe.priv_arg = ip;
+       ip->jprobe.up.task = ip->page->file->proc->task;
+       ip->jprobe.up.sm = ip->page->file->proc->sm;
+       ret = dbi_register_ujprobe(&ip->jprobe);
+       if (ret) {
+               if (ret == -ENOEXEC) {
+                       pack_event_info(ERR_MSG_ID, RECORD_ENTRY, "dp",
+                                       0x1,
+                                       ip->jprobe.up.kp.addr);
+               }
+               printk("dbi_register_ujprobe() failure %d\n", ret);
+               return ret;
+       }
+
+       if (ip->flag_retprobe) {
+               ip->retprobe.priv_arg = ip;
+               ip->retprobe.up.task = ip->page->file->proc->task;
+               ip->retprobe.up.sm = ip->page->file->proc->sm;
+               ret = dbi_register_uretprobe(&ip->retprobe);
+               if (ret) {
+                       printk("dbi_register_uretprobe() failure %d\n", ret);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
+static inline int do_unregister_usprobe(struct us_ip *ip)
+{
+       dbi_unregister_ujprobe(&ip->jprobe);
+
+       if (ip->flag_retprobe) {
+               dbi_unregister_uretprobe(&ip->retprobe);
+       }
+
+       return 0;
 }
 
 static inline int sspt_unregister_usprobe(struct task_struct *task, struct us_ip *ip, enum US_FLAGS flag)
@@ -106,7 +144,7 @@ static inline int sspt_unregister_usprobe(struct task_struct *task, struct us_ip
 
        switch (flag) {
        case US_UNREGS_PROBE:
-               err = unregister_usprobe(ip);
+               err = do_unregister_usprobe(ip);
                break;
        case US_DISARM:
                disarm_uprobe(&ip->jprobe.up.kp, task);
index 511acf6..356c79b 100644 (file)
@@ -184,52 +184,3 @@ void print_vma(struct mm_struct *mm)
        }
        printk("### print_vma:  END\n");
 }
-
-int register_usprobe(struct us_ip *ip)
-{
-       int ret = 0;
-
-       ip->jprobe.priv_arg = ip;
-       ip->jprobe.up.task = ip->page->file->proc->task;
-       ip->jprobe.up.sm = ip->page->file->proc->sm;
-       ret = dbi_register_ujprobe(&ip->jprobe);
-       if (ret) {
-               if (ret == -ENOEXEC) {
-                       pack_event_info(ERR_MSG_ID, RECORD_ENTRY, "dp",
-                                       0x1,
-                                       ip->jprobe.up.kp.addr);
-               }
-               DPRINTF ("dbi_register_ujprobe() failure %d", ret);
-               return ret;
-       }
-
-       /* FIXME:
-        * Save opcode info into retprobe, for later
-        * check for instructions w\o obvious return
-        */
-       memcpy(&ip->retprobe.up.kp.opcode, &ip->jprobe.up.kp.opcode, sizeof(kprobe_opcode_t));
-
-       if (ip->flag_retprobe) {
-               ip->retprobe.priv_arg = ip;
-               ip->retprobe.up.task = ip->page->file->proc->task;
-               ip->retprobe.up.sm = ip->page->file->proc->sm;
-               ret = dbi_register_uretprobe(&ip->retprobe);
-               if (ret) {
-                       EPRINTF ("dbi_register_uretprobe() failure %d", ret);
-                       return ret;
-               }
-       }
-
-       return 0;
-}
-
-int unregister_usprobe(struct us_ip *ip)
-{
-       dbi_unregister_ujprobe(&ip->jprobe);
-
-       if (ip->flag_retprobe) {
-               dbi_unregister_uretprobe(&ip->retprobe);
-       }
-
-       return 0;
-}
index b8675fd..3bf2fd4 100644 (file)
@@ -42,9 +42,6 @@ enum US_FLAGS;
 
 int is_us_instrumentation(void);
 
-int register_usprobe(struct us_ip *ip);
-int unregister_usprobe(struct us_ip *ip);
-
 struct dentry *dentry_by_path(const char *path);
 int check_vma(struct vm_area_struct *vma);