[CLEAN] Remove unused code 20/65720/2
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 11 Apr 2016 09:34:09 +0000 (12:34 +0300)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 15 Apr 2016 12:26:04 +0000 (15:26 +0300)
Change-Id: Ie2ce4582acfa5cef8fc9321f9f4a8ae8ece38f4b
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
uprobe/arch/arm/swap-asm/swap_uprobes.c
uprobe/arch/arm/swap-asm/swap_uprobes.h
uprobe/arch/x86/swap-asm/swap_uprobes.c
uprobe/arch/x86/swap-asm/swap_uprobes.h
uprobe/swap_uprobes.c
uprobe/swap_uprobes.h

index e99bc9b..771906d 100644 (file)
@@ -708,27 +708,18 @@ unsigned long arch_tramp_by_ri(struct uretprobe_instance *ri)
  * negative error code on error.
  */
 int arch_disarm_urp_inst(struct uretprobe_instance *ri,
-                        struct task_struct *task, unsigned long tr)
+                        struct task_struct *task)
 {
        struct pt_regs *uregs = task_pt_regs(ri->task);
        unsigned long ra = swap_get_ret_addr(uregs);
-       unsigned long *tramp;
+       unsigned long *tramp = (unsigned long *)arch_tramp_by_ri(ri);
        unsigned long *sp = (unsigned long *)((long)ri->sp & ~1);
        unsigned long *stack = sp - RETPROBE_STACK_DEPTH + 1;
        unsigned long *found = NULL;
        unsigned long *buf[RETPROBE_STACK_DEPTH];
-       unsigned long vaddr;
+       unsigned long vaddr = (unsigned long)ri->rp->up.addr;
        int i, retval;
 
-       if (tr == 0) {
-               vaddr = (unsigned long)ri->rp->up.addr;
-               tramp = (unsigned long *)arch_tramp_by_ri(ri);
-       } else {
-               /* ri - invalid */
-               vaddr = 0;
-               tramp = (unsigned long *)tr;
-       }
-
        /* check stack */
        retval = read_proc_vm_atomic(task, (unsigned long)stack,
                                     buf, sizeof(buf));
index fdf7fde..5077261 100644 (file)
@@ -89,8 +89,7 @@ static inline int longjmp_break_uhandler(struct uprobe *p, struct pt_regs *regs)
 void arch_opcode_analysis_uretprobe(struct uretprobe *rp);
 int arch_prepare_uretprobe(struct uretprobe_instance *ri, struct pt_regs *regs);
 int arch_disarm_urp_inst(struct uretprobe_instance *ri,
-                        struct task_struct *task, unsigned long tr);
-unsigned long arch_tramp_by_ri(struct uretprobe_instance *ri);
+                        struct task_struct *task);
 
 unsigned long arch_get_trampoline_addr(struct uprobe *p, struct pt_regs *regs);
 void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs);
index e850e31..fedc68f 100644 (file)
@@ -239,16 +239,11 @@ static bool put_long(struct task_struct *task,
  * negative error code on error.
  */
 int arch_disarm_urp_inst(struct uretprobe_instance *ri,
-                        struct task_struct *task, unsigned long tr)
+                        struct task_struct *task)
 {
        unsigned long ret_addr;
        unsigned long sp = (unsigned long)ri->sp;
-       unsigned long tramp_addr;
-
-       if (tr == 0)
-               tramp_addr = arch_tramp_by_ri(ri);
-       else
-               tramp_addr = tr; /* ri - invalid */
+       unsigned long tramp_addr = trampoline_addr(&ri->rp->up);
 
        if (get_long(task, sp, &ret_addr)) {
                printk(KERN_INFO "---> %s (%d/%d): failed to read stack from %08lx\n",
index 3a65547..dad735b 100644 (file)
@@ -94,8 +94,7 @@ static inline int arch_opcode_analysis_uretprobe(struct uretprobe *rp)
 
 int arch_prepare_uretprobe(struct uretprobe_instance *ri, struct pt_regs *regs);
 int arch_disarm_urp_inst(struct uretprobe_instance *ri,
-                        struct task_struct *task, unsigned long tr);
-unsigned long arch_tramp_by_ri(struct uretprobe_instance *ri);
+                        struct task_struct *task);
 unsigned long arch_get_trampoline_addr(struct uprobe *p, struct pt_regs *regs);
 void arch_set_orig_ret_addr(unsigned long orig_ret_addr, struct pt_regs *regs);
 void arch_remove_uprobe(struct uprobe *up);
index 73fde0c..4039811 100644 (file)
@@ -78,41 +78,6 @@ void print_uprobe_hash_table(void)
 }
 #endif
 
-
-struct uinst_info *uinst_info_create(unsigned long vaddr,
-                                    kprobe_opcode_t opcode)
-{
-       struct uinst_info *uinst;
-
-       uinst = kmalloc(sizeof(*uinst), GFP_ATOMIC);
-       if (uinst) {
-               INIT_HLIST_NODE(&uinst->hlist);
-               uinst->vaddr = vaddr;
-               uinst->opcode = opcode;
-       } else {
-               pr_err("Cannot allocate memory for uinst\n");
-       }
-
-       return uinst;
-}
-EXPORT_SYMBOL_GPL(uinst_info_create);
-
-void uinst_info_destroy(struct uinst_info *uinst)
-{
-       kfree(uinst);
-}
-EXPORT_SYMBOL_GPL(uinst_info_destroy);
-
-void uinst_info_disarm(struct uinst_info *uinst, struct task_struct *task)
-{
-       struct uprobe p;
-
-       p.addr = (uprobe_opcode_t *)uinst->vaddr;
-       p.opcode = uinst->opcode;
-       arch_disarm_uprobe(&p, task);
-}
-EXPORT_SYMBOL_GPL(uinst_info_disarm);
-
 /*
  * Keep all fields in the uprobe consistent
  */
@@ -899,7 +864,7 @@ void __swap_unregister_uretprobe(struct uretprobe *rp, int disarm)
        mutex_lock(&urp_mtx);
        while ((ri = get_used_urp_inst(rp)) != NULL) {
                /* FIXME: arch_disarm_urp_inst() for no current context */
-               if (arch_disarm_urp_inst(ri, ri->task, 0) != 0)
+               if (arch_disarm_urp_inst(ri, ri->task) != 0)
                        printk(KERN_INFO "%s (%d/%d): "
                               "cannot disarm urp instance (%08lx)\n",
                               ri->task->comm, ri->task->tgid, ri->task->pid,
@@ -971,43 +936,6 @@ void swap_ujprobe_return(void)
 }
 EXPORT_SYMBOL_GPL(swap_ujprobe_return);
 
-
-static struct urinst_info *urinst_info_create(struct uretprobe_instance *ri)
-{
-       struct urinst_info *urinst;
-
-       urinst = kmalloc(sizeof(*urinst), GFP_ATOMIC);
-       if (urinst) {
-               INIT_HLIST_NODE(&urinst->hlist);
-               urinst->task = ri->task;
-               urinst->sp = (unsigned long)ri->sp;
-               urinst->tramp = arch_tramp_by_ri(ri);
-               urinst->ret_addr = (unsigned long)ri->ret_addr;
-       } else {
-               pr_err("Cannot allocate memory for urinst\n");
-       }
-
-       return urinst;
-}
-
-static void urinst_info_destroy(struct urinst_info *urinst)
-{
-       kfree(urinst);
-}
-
-static void urinst_info_disarm(struct urinst_info *urinst, struct task_struct *task)
-{
-       struct uretprobe_instance ri;
-       unsigned long tramp = urinst->tramp;
-
-       /* set necessary data*/
-       ri.task = urinst->task;
-       ri.sp = (kprobe_opcode_t *)urinst->sp;
-       ri.ret_addr = (kprobe_opcode_t *)urinst->ret_addr;
-
-       arch_disarm_urp_inst(&ri, task, tramp);
-}
-
 void swap_uretprobe_free_task(struct task_struct *armed,
                              struct task_struct *will_disarm, bool recycle)
 {
@@ -1022,7 +950,7 @@ void swap_uretprobe_free_task(struct task_struct *armed,
                        continue;
 
                if (will_disarm)
-                       arch_disarm_urp_inst(ri, will_disarm, 0);
+                       arch_disarm_urp_inst(ri, will_disarm);
 
                if (recycle)
                        recycle_urp_inst(ri);
@@ -1031,57 +959,6 @@ void swap_uretprobe_free_task(struct task_struct *armed,
 }
 EXPORT_SYMBOL_GPL(swap_uretprobe_free_task);
 
-void urinst_info_get_current_hlist(struct hlist_head *head, bool recycle)
-{
-       struct task_struct *task = current;
-       struct uretprobe_instance *ri;
-       struct hlist_head *hhead;
-       struct hlist_node *n;
-       struct hlist_node *last = NULL;
-       DECLARE_NODE_PTR_FOR_HLIST(node);
-
-       mutex_lock(&urp_mtx);
-       hhead = uretprobe_inst_table_head(task->mm);
-       swap_hlist_for_each_entry_safe(ri, node, n, hhead, hlist) {
-               if (task == ri->task) {
-                       struct urinst_info *urinst;
-
-                       urinst = urinst_info_create(ri);
-                       if (urinst) {
-                               if (last)
-                                       hlist_add_after(last, &urinst->hlist);
-                               else
-                                       hlist_add_head(&urinst->hlist, head);
-
-                               last = &urinst->hlist;
-                       }
-
-                       if (recycle)
-                               recycle_urp_inst(ri);
-               }
-       }
-       mutex_unlock(&urp_mtx);
-}
-EXPORT_SYMBOL_GPL(urinst_info_get_current_hlist);
-
-void urinst_info_put_current_hlist(struct hlist_head *head,
-                                 struct task_struct *task)
-{
-       struct urinst_info *urinst;
-       struct hlist_node *tmp;
-       DECLARE_NODE_PTR_FOR_HLIST(node);
-
-       swap_hlist_for_each_entry_safe(urinst, node, tmp, head, hlist) {
-               /* check on disarm */
-               if (task)
-                       urinst_info_disarm(urinst, task);
-
-               hlist_del(&urinst->hlist);
-               urinst_info_destroy(urinst);
-       }
-}
-EXPORT_SYMBOL_GPL(urinst_info_put_current_hlist);
-
 
 static int once(void)
 {
index 8ea4a55..01b996e 100644 (file)
@@ -96,31 +96,6 @@ struct uprobe {
        struct slot_manager *sm;             /**< Pointer to slot manager */
 };
 
-struct uinst_info {
-       struct hlist_node hlist;
-
-       unsigned long vaddr;
-       kprobe_opcode_t opcode;
-};
-
-struct urinst_info {
-       struct hlist_node hlist;
-
-       struct task_struct *task;
-       unsigned long sp;
-       unsigned long tramp;
-       unsigned long ret_addr;
-};
-
-struct uinst_info *uinst_info_create(unsigned long vaddr,
-                                    kprobe_opcode_t opcode);
-void uinst_info_destroy(struct uinst_info *uinst);
-void uinst_info_disarm(struct uinst_info *uinst, struct task_struct *task);
-
-
-void urinst_info_get_current_hlist(struct hlist_head *head, bool recycle);
-void urinst_info_put_current_hlist(struct hlist_head *head,
-                                 struct task_struct *task);
 
 void swap_uretprobe_free_task(struct task_struct *task,
                              struct task_struct *dtask, bool recycle);