2925d7f6ffa0564fa106ca5f5a660fe6a3ff28a7
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / kernel / swap / us_manager / sspt / sspt_filter.c
1 #include <linux/list.h>
2 #include <linux/slab.h>
3 #include "sspt_filter.h"
4 #include "sspt_proc.h"
5 #include "../pf/pf_group.h"
6
7
8 struct sspt_filter *sspt_filter_create(struct sspt_proc *proc,
9                                        struct pf_group *pfg)
10 {
11         struct sspt_filter *fl;
12
13         fl = kmalloc(sizeof(*fl), GFP_ATOMIC);
14         if (fl == NULL)
15                 return NULL;
16
17         INIT_LIST_HEAD(&fl->list);
18
19         fl->proc = proc;
20         fl->pfg = pfg;
21         fl->pfg_is_inst = false;
22
23         return fl;
24 }
25
26 void sspt_filter_free(struct sspt_filter *fl)
27 {
28         if (fl->pfg_is_inst) {
29                 struct pfg_msg_cb *cb = pfg_msg_cb_get(fl->pfg);
30
31                 if (cb && cb->msg_term)
32                         cb->msg_term(fl->proc->task);
33         }
34
35         kfree(fl);
36 }