c74b8325d7cc0127f8ebfc50e1681c2a49bb8482
[kernel/swap-modules.git] / writer / swap_writer_module.h
1 /*
2  *  SWAP Writer
3  *  modules/writer/swap_writer_module.h
4  *
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.
9  *
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.
14  *
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.
18  *
19  * Copyright (C) Samsung Electronics, 2013
20  *
21  * 2013  Alexander Aksenov <a.aksenov@samsung.com>, Vyacheslav Cherkashin: 
22  *                  SWAP Writer module implement
23  *
24  */
25
26 #ifndef _SWAP_MSG_H
27 #define _SWAP_MSG_H
28
29 #include <linux/types.h>
30
31 enum PROBE_TYPE {
32         PT_US   = 1,
33         PT_KS   = 3
34 };
35
36 enum PROBE_SUB_TYPE {
37         PST_NONE        = 0x00,
38         PST_KS_FILE     = 0x01,
39         PST_KS_IPC      = 0x02,
40         PST_KS_PROCESS  = 0x04,
41         PST_KS_SIGNAL   = 0x08,
42         PST_KS_NETWORK  = 0x10,
43         PST_KS_DESC     = 0x20
44 };
45
46 struct pt_regs;
47 struct dentry;
48 struct task_struct;
49 struct vm_area_struct;
50
51 int init_msg(size_t buf_size);
52 void uninit_msg(void);
53
54 void reset_discarded(void);
55 unsigned int get_discarded_count(void);
56 void reset_seq_num(void);
57
58 int proc_info_msg(struct task_struct *task, struct dentry *dentry);
59 void terminate_msg(struct task_struct *task);
60 void pcoc_map_msg(struct vm_area_struct *vma);
61 void proc_unmap_msg(unsigned long start, unsigned long end);
62 void proc_comm_msg(struct task_struct *task);
63 int sample_msg(struct pt_regs *regs);
64
65 int entry_event(const char *fmt, unsigned long func_addr, struct pt_regs *regs,
66                 enum PROBE_TYPE pt, int sub_type);
67 int exit_event(char ret_type, struct pt_regs *regs, unsigned long func_addr,
68                unsigned long ret_addr);
69
70 int switch_entry(struct pt_regs *regs);
71 int switch_exit(struct pt_regs *regs);
72
73 int error_msg(const char *fmt, ...);
74
75 int raw_msg(char *buf, size_t len);
76
77 #endif /* _SWAP_MSG_H */