From: Vyacheslav Cherkashin Date: Thu, 31 Mar 2016 13:34:29 +0000 (+0300) Subject: [REFACTOR] naming in img_* X-Git-Tag: submit/tizen/20161124.145503~40^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42b3b6ff535978dfc4235484595ef0d1c10a171a;p=kernel%2Fswap-modules.git [REFACTOR] naming in img_* Change-Id: I591760ac9b81337943cb8e5fa5b264f612242adb Signed-off-by: Vyacheslav Cherkashin --- diff --git a/us_manager/img/img_file.c b/us_manager/img/img_file.c index 978a78d..7f28875 100644 --- a/us_manager/img/img_file.c +++ b/us_manager/img/img_file.c @@ -67,7 +67,7 @@ static void img_file_free(struct img_file *file) list_for_each_entry_safe(ip, tmp, &file->ip_list, list) { img_del_ip_by_list(ip); - free_img_ip(ip); + img_ip_free(ip); } kfree(file); @@ -131,7 +131,7 @@ int img_file_add_ip(struct img_file *file, unsigned long addr, return 0; } - ip = create_img_ip(addr, pd); + ip = img_ip_create(addr, pd); if (ip == NULL) return -ENOMEM; img_add_ip_by_list(file, ip); @@ -159,7 +159,7 @@ int img_file_del_ip(struct img_file *file, unsigned long addr, } img_del_ip_by_list(ip); - free_img_ip(ip); + img_ip_free(ip); return 0; } diff --git a/us_manager/img/img_file.h b/us_manager/img/img_file.h index 82870e0..29e475a 100644 --- a/us_manager/img/img_file.h +++ b/us_manager/img/img_file.h @@ -35,9 +35,13 @@ struct probe_desc; * @breaf Image of file */ struct img_file { - struct list_head list; /**< For img_proc */ + /* img_proc */ + struct list_head list; /**< List for img_proc */ + + /* img_ip */ + struct list_head ip_list; /**< Head for img_ip */ + struct dentry *dentry; /**< Dentry of file */ - struct list_head ip_list; /**< For img_ip */ atomic_t use; }; diff --git a/us_manager/img/img_ip.c b/us_manager/img/img_ip.c index 7a9cc67..3d99b8d 100644 --- a/us_manager/img/img_ip.c +++ b/us_manager/img/img_ip.c @@ -35,7 +35,7 @@ * @param probe_i Pointer to the probe info data. * @return Pointer to the created img_ip struct */ -struct img_ip *create_img_ip(unsigned long addr, struct probe_desc *pd) +struct img_ip *img_ip_create(unsigned long addr, struct probe_desc *pd) { struct img_ip *ip; @@ -44,7 +44,7 @@ struct img_ip *create_img_ip(unsigned long addr, struct probe_desc *pd) return NULL; INIT_LIST_HEAD(&ip->list); - INIT_LIST_HEAD(&ip->ihead); + INIT_LIST_HEAD(&ip->sspt_head); ip->addr = addr; ip->desc = pd; @@ -57,11 +57,11 @@ struct img_ip *create_img_ip(unsigned long addr, struct probe_desc *pd) * @param ip remove object * @return Void */ -void free_img_ip(struct img_ip *ip) +void img_ip_free(struct img_ip *ip) { struct sspt_ip *p, *n; - list_for_each_entry_safe(p, n, &ip->ihead, img_list) { + list_for_each_entry_safe(p, n, &ip->sspt_head, img_list) { list_del_init(&p->img_list); p->img_ip = NULL; list_del(&p->list); diff --git a/us_manager/img/img_ip.h b/us_manager/img/img_ip.h index d5ed218..fa57531 100644 --- a/us_manager/img/img_ip.h +++ b/us_manager/img/img_ip.h @@ -34,14 +34,18 @@ * @breaf Image of instrumentation pointer */ struct img_ip { - struct list_head list; /**< For img_file */ + /* img_file */ + struct list_head list; /**< List for img_file */ + + /* sspt_ip */ + struct list_head sspt_head; /**< Head for sspt_ip */ + unsigned long addr; /**< Function address */ - struct list_head ihead; /**< List head for sspt ip */ struct probe_desc *desc; /**< Probe info */ }; -struct img_ip *create_img_ip(unsigned long addr, struct probe_desc *info); -void free_img_ip(struct img_ip *ip); +struct img_ip *img_ip_create(unsigned long addr, struct probe_desc *info); +void img_ip_free(struct img_ip *ip); /* debug */ void img_ip_print(struct img_ip *ip); diff --git a/us_manager/img/img_proc.c b/us_manager/img/img_proc.c index e699941..6132af7 100644 --- a/us_manager/img/img_proc.c +++ b/us_manager/img/img_proc.c @@ -34,7 +34,8 @@ struct img_proc { - struct list_head file_list; + /* img_file */ + struct list_head file_head; rwlock_t rwlock; }; @@ -46,13 +47,13 @@ static void img_del_file_by_list(struct img_file *file); * * @return Pointer to the created img_proc struct */ -struct img_proc *create_img_proc(void) +struct img_proc *img_proc_create(void) { struct img_proc *proc; proc = kmalloc(sizeof(*proc), GFP_ATOMIC); if (proc) { - INIT_LIST_HEAD(&proc->file_list); + INIT_LIST_HEAD(&proc->file_head); rwlock_init(&proc->rwlock); } @@ -65,12 +66,12 @@ struct img_proc *create_img_proc(void) * @param file remove object * @return Void */ -void free_img_proc(struct img_proc *proc) +void img_proc_free(struct img_proc *proc) { struct img_file *file, *tmp; write_lock(&proc->rwlock); - list_for_each_entry_safe(file, tmp, &proc->file_list, list) { + list_for_each_entry_safe(file, tmp, &proc->file_head, list) { img_del_file_by_list(file); img_file_put(file); } @@ -82,7 +83,7 @@ void free_img_proc(struct img_proc *proc) /* called with write_[lock/unlock](&proc->rwlock) */ static void img_add_file_by_list(struct img_proc *proc, struct img_file *file) { - list_add(&file->list, &proc->file_list); + list_add(&file->list, &proc->file_head); } /* called with write_[lock/unlock](&proc->rwlock) */ @@ -97,7 +98,7 @@ static struct img_file *img_file_find_get(struct img_proc *proc, { struct img_file *file; - list_for_each_entry(file, &proc->file_list, list) { + list_for_each_entry(file, &proc->file_head, list) { if (file->dentry == dentry) { img_file_get(file); return file; @@ -187,7 +188,7 @@ void img_proc_copy_to_sspt(struct img_proc *i_proc, struct sspt_proc *proc) struct img_file *i_file; read_lock(&i_proc->rwlock); - list_for_each_entry(i_file, &i_proc->file_list, list) { + list_for_each_entry(i_file, &i_proc->file_head, list) { file = sspt_proc_find_file_or_new(proc, i_file->dentry); if (file) { struct img_ip *i_ip; @@ -214,7 +215,7 @@ void img_proc_print(struct img_proc *proc) printk(KERN_INFO "### img_proc_print:\n"); read_lock(&proc->rwlock); - list_for_each_entry(file, &proc->file_list, list) { + list_for_each_entry(file, &proc->file_head, list) { img_file_print(file); } read_unlock(&proc->rwlock); diff --git a/us_manager/img/img_proc.h b/us_manager/img/img_proc.h index 70d924e..730fea0 100644 --- a/us_manager/img/img_proc.h +++ b/us_manager/img/img_proc.h @@ -32,8 +32,8 @@ struct sspt_proc; struct probe_desc; -struct img_proc *create_img_proc(void); -void free_img_proc(struct img_proc *proc); +struct img_proc *img_proc_create(void); +void img_proc_free(struct img_proc *proc); int img_proc_add_ip(struct img_proc *proc, struct dentry *dentry, unsigned long addr, struct probe_desc *pd); diff --git a/us_manager/pf/pf_group.c b/us_manager/pf/pf_group.c index 2288610..bfe86fe 100644 --- a/us_manager/pf/pf_group.c +++ b/us_manager/pf/pf_group.c @@ -87,7 +87,7 @@ static struct pf_group *pfg_create(void) if (pfg == NULL) return NULL; - pfg->i_proc = create_img_proc(); + pfg->i_proc = img_proc_create(); if (pfg->i_proc == NULL) goto create_pfg_fail; @@ -111,7 +111,7 @@ static void pfg_free(struct pf_group *pfg) { struct pl_struct *pl, *n; - free_img_proc(pfg->i_proc); + img_proc_free(pfg->i_proc); free_pf(&pfg->filter); list_for_each_entry_safe(pl, n, &pfg->proc_list, list) { sspt_proc_del_filter(pl->proc, pfg); diff --git a/us_manager/sspt/sspt_ip.c b/us_manager/sspt/sspt_ip.c index 5f116b0..b69cd21 100644 --- a/us_manager/sspt/sspt_ip.c +++ b/us_manager/sspt/sspt_ip.c @@ -53,7 +53,7 @@ struct sspt_ip *sspt_ip_create(struct img_ip *img_ip) ip->offset = img_ip->addr; ip->desc = img_ip->desc; ip->img_ip = img_ip; - list_add(&ip->img_list, &img_ip->ihead); + list_add(&ip->img_list, &img_ip->sspt_head); return ip; }