3 * modules/us_manager/us_manager.c
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * Copyright (C) Samsung Electronics, 2013
21 * 2013 Vyacheslav Cherkashin: SWAP us_manager implement
25 #include <linux/module.h>
26 #include <linux/mutex.h>
27 #include "pf/pf_group.h"
28 #include "sspt/sspt_proc.h"
30 #include <writer/event_filter.h>
32 /* FIXME: move /un/init_msg() elsewhere and remove this include */
33 #include <writer/swap_writer_module.h> /* for /un/init_msg() */
37 static DEFINE_MUTEX(mutex_inst);
38 static int flag_inst = 0;
41 static void do_usm_stop(void)
48 static int do_usm_start(void)
52 ret = register_helper();
65 mutex_lock(&mutex_inst);
67 printk("US instrumentation is not running!\n");
76 mutex_unlock(&mutex_inst);
80 EXPORT_SYMBOL_GPL(usm_stop);
86 mutex_lock(&mutex_inst);
88 printk("US instrumentation is already run!\n");
97 mutex_unlock(&mutex_inst);
101 EXPORT_SYMBOL_GPL(usm_start);
107 /* ============================================================================
109 * ============================================================================
111 static int us_filter(struct task_struct *task)
113 return !!sspt_proc_get_by_task(task);
116 static struct ev_filter ev_us_filter = {
117 .name = "traced_process_only",
121 static int init_us_filter(void)
125 ret = event_filter_register(&ev_us_filter);
129 return event_filter_set(ev_us_filter.name);
132 static void exit_us_filter(void)
134 event_filter_unregister(&ev_us_filter);
141 static int __init init_us_manager(void)
145 ret = init_us_filter();
158 static void __exit exit_us_manager(void)
160 mutex_lock(&mutex_inst);
163 mutex_unlock(&mutex_inst);
170 module_init(init_us_manager);
171 module_exit(exit_us_manager);
173 MODULE_LICENSE ("GPL");