tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / kernel / swap / us_manager / pf / proc_filters.h
1 /**
2  * @file us_manager/pf/proc_filters.h
3  * @author Vyacheslav Cherkashin <v.cherkashin@samsung.com>
4  *
5  * @section LICENSE
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * @section COPYRIGHT
21  * Copyright (C) Samsung Electronics, 2013
22  */
23
24
25 #ifndef _PROC_FILTERS_H
26 #define _PROC_FILTERS_H
27
28 #include <linux/types.h>
29
30 struct dentry;
31 struct task_struct;
32
33 /**
34  * @struct proc_filter
35  * @breaf Filter for process
36  */
37 struct proc_filter {
38         /** Callback for filtering */
39         struct task_struct *(*call)(struct proc_filter *self,
40                                     struct task_struct *task);
41         void *data;             /**< Data of callback */
42         void *priv;             /**< Private data */
43 };
44
45 /**
46  * @def check_task_f @hideinitializer
47  * Call filter on the task
48  *
49  * @param filter Pointer to the proc_filter struct
50  * @param task Pointer to the task_struct struct
51  */
52 #define check_task_f(filter, task) ((filter)->call(filter, task))
53
54 void set_pf_by_dentry(struct proc_filter *pf, struct dentry *dentry,
55                       void *priv);
56 void set_pf_by_tgid(struct proc_filter *pf, pid_t tgid, void *priv);
57 int set_pf_by_comm(struct proc_filter *pf, char *comm, void *priv);
58 void set_pf_dumb(struct proc_filter *pf, void *priv);
59
60
61 int check_pf_by_dentry(struct proc_filter *filter, struct dentry *dentry);
62 int check_pf_by_tgid(struct proc_filter *filter, pid_t tgid);
63 int check_pf_by_comm(struct proc_filter *filter, char *comm);
64 int check_pf_dumb(struct proc_filter *filter);
65 void *get_pf_priv(struct proc_filter *filter);
66
67 void free_pf(struct proc_filter *filter);
68
69 int ignore_pf(struct proc_filter *filter);
70
71 #endif /* _PROC_FILTERS_H */