[REFACTOR] remove sspt_*_copy()
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 13 Jun 2013 14:08:57 +0000 (18:08 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Thu, 13 Jun 2013 14:08:57 +0000 (18:08 +0400)
functions:
sspt_proc_copy()
sspt_file_copy()
sspt_page_copy()
copy_ip()

us_manager/sspt/ip.c
us_manager/sspt/ip.h
us_manager/sspt/sspt_file.c
us_manager/sspt/sspt_file.h
us_manager/sspt/sspt_page.c
us_manager/sspt/sspt_page.h
us_manager/sspt/sspt_proc.c
us_manager/sspt/sspt_proc.h

index f29f08e..b1a11aa 100644 (file)
@@ -60,26 +60,6 @@ static inline void set_ip_got_addr(struct us_ip *ip, unsigned long got_addr)
        ip->got_addr = got_addr;
 }
 
-struct us_ip *copy_ip(const struct us_ip *ip)
-{
-       struct us_ip *new_ip = create_ip(ip->offset);
-
-       if (new_ip == NULL) {
-               printk("us_proc_ip_copy: No enough memory\n");
-               return NULL;
-       }
-
-       // jprobe
-       set_ip_jp_handler(new_ip, ip->jprobe.pre_entry, ip->jprobe.entry);
-
-       // retprobe
-       if (ip->flag_retprobe) {
-               set_ip_rp_handler(new_ip, ip->retprobe.handler);
-       }
-
-       return new_ip;
-}
-
 struct us_ip *create_ip_by_ip_data(struct ip_data *ip_d)
 {
        struct us_ip *ip = create_ip(ip_d->offset);
index 0079d7c..1c94326 100644 (file)
@@ -60,7 +60,6 @@ struct us_ip {
 
 
 struct us_ip *create_ip(unsigned long offset);
-struct us_ip *copy_ip(const struct us_ip *ip);
 struct us_ip *create_ip_by_ip_data(struct ip_data *ip_d);
 void free_ip(struct us_ip *ip);
 
index c1ca5ab..42745a7 100644 (file)
@@ -94,51 +94,6 @@ static void sspt_add_page(struct sspt_file *file, struct sspt_page *page)
                                file->page_probes_hash_bits)]);
 }
 
-struct sspt_file *sspt_file_copy(const struct sspt_file *file)
-{
-       struct sspt_file *file_out;
-
-       if (file == NULL) {
-               printk("### WARNING: file_p == NULL\n");
-               return NULL;
-       }
-
-       file_out = kmalloc(sizeof(*file_out), GFP_ATOMIC);
-       if (file_out) {
-               struct sspt_page *page = NULL;
-               struct hlist_node *node = NULL;
-               struct hlist_head *head = NULL;
-               int i, table_size;
-               INIT_LIST_HEAD(&file_out->list);
-               file_out->proc = NULL;
-               file_out->dentry = file->dentry;
-               file_out->name = file->name;
-               file_out->loaded = 0;
-               file_out->vm_start = 0;
-               file_out->vm_end = 0;
-
-               file_out->page_probes_hash_bits = file->page_probes_hash_bits;
-               table_size = (1 << file_out->page_probes_hash_bits);
-
-               file_out->page_probes_table =
-                               kmalloc(sizeof(*file_out->page_probes_table)*table_size, GFP_ATOMIC);
-
-               for (i = 0; i < table_size; ++i) {
-                       INIT_HLIST_HEAD(&file_out->page_probes_table[i]);
-               }
-
-               // copy pages
-               for (i = 0; i < table_size; ++i) {
-                       head = &file->page_probes_table[i];
-                       swap_hlist_for_each_entry(page, node, head, hlist) {
-                               sspt_add_page(file_out, sspt_page_copy(page));
-                       }
-               }
-       }
-
-       return file_out;
-}
-
 static struct sspt_page *sspt_find_page(struct sspt_file *file, unsigned long offset)
 {
        struct hlist_node *node;
index b8c2aff..064e65a 100644 (file)
@@ -45,7 +45,6 @@ struct sspt_file {
 
 
 struct sspt_file *sspt_file_create(char *name, struct dentry *dentry, int page_cnt);
-struct sspt_file *sspt_file_copy(const struct sspt_file *file);
 void sspt_file_free(struct sspt_file *file);
 
 struct sspt_page *sspt_find_page_mapped(struct sspt_file *file, unsigned long page);
index c58c485..38404a9 100644 (file)
@@ -67,33 +67,6 @@ static void sspt_list_del_ip(struct us_ip *ip)
        list_del(&ip->list);
 }
 
-struct sspt_page *sspt_page_copy(const struct sspt_page *page)
-{
-       struct us_ip *ip, *new_ip;
-       struct sspt_page *new_page = kmalloc(sizeof(*new_page), GFP_ATOMIC);
-
-       if (new_page) {
-               INIT_LIST_HEAD(&new_page->ip_list);
-               list_for_each_entry(ip, &page->ip_list, list) {
-                       new_ip = copy_ip(ip);
-                       if (new_ip == NULL) {
-                               sspt_page_free(new_page);
-                               return NULL;
-                       }
-
-                       sspt_list_add_ip(new_page, new_ip);
-               }
-
-               new_page->offset = page->offset;
-               new_page->install = 0;
-               spin_lock_init(&new_page->lock);
-               INIT_HLIST_NODE(&new_page->hlist);
-               new_page->file = NULL;
-       }
-
-       return new_page;
-}
-
 void sspt_add_ip(struct sspt_page *page, struct us_ip *ip)
 {
        struct us_ip *ip_tmp;
index 8a4d3c2..d62969d 100644 (file)
@@ -44,7 +44,6 @@ struct sspt_page {
 };
 
 struct sspt_page *sspt_page_create(unsigned long offset);
-struct sspt_page *sspt_page_copy(const struct sspt_page *page);
 void sspt_page_free(struct sspt_page *page);
 
 void sspt_add_ip(struct sspt_page *page, struct us_ip *ip);
index 8ade9dd..fa3cb5b 100644 (file)
@@ -150,18 +150,6 @@ void sspt_proc_add_ip_data(struct sspt_proc *proc, struct dentry* dentry,
        sspt_file_add_ip(file, ip_d);
 }
 
-struct sspt_proc *sspt_proc_copy(struct sspt_proc *proc, struct task_struct *task)
-{
-       struct sspt_file *file;
-       struct sspt_proc *proc_out = sspt_proc_create(task);
-
-       list_for_each_entry(file, &proc->file_list, list) {
-               sspt_proc_add_file(proc_out, sspt_file_copy(file));
-       }
-
-       return proc_out;
-}
-
 struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc, struct dentry *dentry)
 {
        struct sspt_file *file;
index 51939e8..ea89d79 100644 (file)
@@ -47,7 +47,6 @@ struct sspt_proc {
 
 
 struct sspt_proc *sspt_proc_create(struct task_struct *task);
-struct sspt_proc *sspt_proc_copy(struct sspt_proc *proc, struct task_struct *task);
 void sspt_proc_free(struct sspt_proc *proc);
 
 struct sspt_proc *sspt_proc_get_by_task(struct task_struct *task);