From: Vyacheslav Cherkashin Date: Thu, 12 Sep 2013 12:42:49 +0000 (+0400) Subject: [REFACTOR] remove unused code X-Git-Tag: Tizen_SDK_2.3~287 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d16519a64a4c361a8a0a2f60fd44e98250f22fd7;p=kernel%2Fswap-modules.git [REFACTOR] remove unused code Change-Id: I558930dc85581831d34b22727f12d54ceaf55360 Signed-off-by: Vyacheslav Cherkashin --- diff --git a/us_manager/sspt/ip.c b/us_manager/sspt/ip.c index 700a519..3d88915 100644 --- a/us_manager/sspt/ip.c +++ b/us_manager/sspt/ip.c @@ -60,14 +60,10 @@ struct us_ip *create_ip(unsigned long offset, const char *args) INIT_LIST_HEAD(&ip->list); ip->offset = offset; - ip->got_addr = 0; - ip->flag_got = 1; - /* TODO: or copy args?! */ ip->args = args; /* retprobe */ - ip->flag_retprobe = 1; ip->retprobe.handler = ret_handler; ip->retprobe.entry_handler = entry_handler; diff --git a/us_manager/sspt/ip.h b/us_manager/sspt/ip.h index 25e589f..37ed4fa 100644 --- a/us_manager/sspt/ip.h +++ b/us_manager/sspt/ip.h @@ -26,23 +26,9 @@ */ #include -//#include "../../kprobe/dbi_kprobes.h" #include -// TODO: tmp struct ip_data -struct ip_data { - unsigned long offset; - unsigned long got_addr; - - kprobe_pre_entry_handler_t pre_handler; - unsigned long jp_handler; - uretprobe_handler_t rp_handler; - - unsigned flag_retprobe:1; -}; - struct sspt_page; -struct sspt_file; struct us_ip { struct list_head list; @@ -52,10 +38,6 @@ struct us_ip { char *args; unsigned long offset; - unsigned long got_addr; - - unsigned flag_retprobe:1; - unsigned flag_got:1; }; diff --git a/us_manager/sspt/sspt.h b/us_manager/sspt/sspt.h index 6cc5c0f..afab4ca 100644 --- a/us_manager/sspt/sspt.h +++ b/us_manager/sspt/sspt.h @@ -30,56 +30,12 @@ #include "sspt_file.h" #include "sspt_proc.h" #include "sspt_debug.h" -#include "us_proc_types.h" #include #include #include -static void print_proc_probes(const struct sspt_proc *proc); - -struct sspt_proc; - -static inline struct sspt_proc *get_file_probes(inst_us_proc_t *task_inst_info) -{ - int i, ret; - struct pf_group *pfg; - - pfg = get_pf_group_by_dentry(task_inst_info->m_f_dentry, - task_inst_info->m_f_dentry); - - for (i = 0; i < task_inst_info->libs_count; ++i) { - int k, j; - us_proc_lib_t *p_libs = &task_inst_info->p_libs[i]; - struct dentry *dentry = p_libs->m_f_dentry; - char *path = p_libs->path; - char *name = strrchr(path, '/'); - name = name ? name + 1 : path; - - for (k = 0; k < p_libs->ips_count; ++k) { - us_proc_ip_t *ip = &p_libs->p_ips[k]; - unsigned long got_addr = 0; - - for (j = 0; j < p_libs->plt_count; ++j) { - if (ip->offset == p_libs->p_plt[j].func_addr) { - got_addr = p_libs->p_plt[j].got_addr; - break; - } - } - - ret = pf_register_probe(pfg, dentry, ip->offset, "dddd"); - if (ret) - printk("### ERROR: pf_register_probe ret=%d\n", ret); - } - } - - printk("####### get END #######\n"); - - pfg_print(pfg); - - return NULL; -} static int check_vma(struct vm_area_struct *vma) { @@ -90,35 +46,29 @@ static int check_vma(struct vm_area_struct *vma) static inline int sspt_register_usprobe(struct us_ip *ip) { - int ret = 0; + int ret; /* for retuprobe */ ip->retprobe.up.task = ip->page->file->proc->task; ip->retprobe.up.sm = ip->page->file->proc->sm; - if (ip->flag_retprobe) { - ret = dbi_register_uretprobe(&ip->retprobe); - if (ret) { - struct sspt_file *file = ip->page->file; - char *name = file->dentry->d_iname; - unsigned long addr =ip->retprobe.up.kp.addr; - unsigned long offset = addr - file->vm_start; - - printk("dbi_register_uretprobe() failure %d (%s:%x|%x)\n", - ret, name, offset, ip->retprobe.up.kp.opcode); + ret = dbi_register_uretprobe(&ip->retprobe); + if (ret) { + struct sspt_file *file = ip->page->file; + char *name = file->dentry->d_iname; + unsigned long addr =ip->retprobe.up.kp.addr; + unsigned long offset = addr - file->vm_start; - return ret; - } + printk("dbi_register_uretprobe() failure %d (%s:%x|%x)\n", + ret, name, offset, ip->retprobe.up.kp.opcode); } - return 0; + return ret; } static inline int do_unregister_usprobe(struct us_ip *ip) { - if (ip->flag_retprobe) { - dbi_unregister_uretprobe(&ip->retprobe); - } + dbi_unregister_uretprobe(&ip->retprobe); return 0; } diff --git a/us_manager/sspt/us_proc_types.h b/us_manager/sspt/us_proc_types.h deleted file mode 100644 index 5ccb127..0000000 --- a/us_manager/sspt/us_proc_types.h +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef __US_PROC_TYPES_H__ -#define __US_PROC_TYPES_H__ - -/* - * SWAP uprobe manager - * modules/us_manager/sspt/us_proc_types.h - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Copyright (C) Samsung Electronics, 2013 - * - * 2013 Alexander Aksenov : Porting structures - * declarations from old driver - * - */ - -typedef struct -{ - struct list_head list; - char *name; - int installed; - struct jprobe jprobe; - struct kretprobe retprobe; - unsigned long offset; - unsigned long got_addr; - - unsigned flag_retprobe:1; - unsigned flag_got:1; -} us_proc_ip_t; - -typedef struct -{ - int installed; - struct jprobe jprobe; - unsigned long addr; - struct list_head list; -} us_proc_vtp_t; - -typedef struct -{ - unsigned func_addr; - unsigned got_addr; - unsigned real_func_addr; -} us_proc_plt_t; - -typedef struct -{ - char *path; - char *path_dyn; - struct dentry *m_f_dentry; - unsigned ips_count; - us_proc_ip_t *p_ips; - unsigned vtps_count; - us_proc_vtp_t *p_vtps; - int loaded; - unsigned plt_count; - us_proc_plt_t *p_plt; - unsigned long vma_start; - unsigned long vma_end; - unsigned vma_flag; -} us_proc_lib_t; - -typedef struct { - char *path; - struct dentry *m_f_dentry; - pid_t tgid; - unsigned unres_ips_count; - unsigned unres_vtps_count; - int is_plt; - unsigned libs_count; - us_proc_lib_t *p_libs; - - // new_dpf - struct sspt_proc *pp; -} inst_us_proc_t; - -#endif /* __US_PROC_TYPES_H__ */