-
Notifications
You must be signed in to change notification settings - Fork 0
/
record.h
83 lines (61 loc) · 1.88 KB
/
record.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __RECORD_H
#define __RECORD_H
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/vmalloc.h>
/* 定义是否需要迁移到DRAM */
#define MIGRATE_MALICIOUS_APP
/* 设置回写的阈值 */
#define WB_THRESHOLD 5
/* 可保存 2G 左右的背包内容 */
#define sizeV 2100
typedef struct suspect_process
{
int pid;
/* 写窗口内平均写次数 */
unsigned long averageCount;
/* 写窗口内页面写次数的方差 */
unsigned long deviation;
/* 写窗口内写入的总页面数量 */
unsigned long pageCount;
struct suspect_process *next;
struct suspect_process *prev;
}SuspectProcess,*Suspect;
/* 记录恶意磨损进程 */
typedef struct malicious_process
{
int pid;
struct malicious_process *next;
}MaliciousProcess,*Malicious;
/* 记录全局写 */
typedef struct blk_write_count
{
unsigned long write_count;
char write_back_threshold;
//int pid;
}BlkWriteCount,*BWC;
extern Malicious malicious_header;
extern Suspect suspect_header;
extern struct mutex global_mutex_lock;
extern struct mutex process_mutex_lock;
extern struct mutex detect_prepare_lock;
extern BWC global_blk_write_count;
/* 用来记录恶意pid */
void init_malicious_list_lock(void);
void insert_into_malicious_process(int pid);
void delete_from_malicious_process(int pid);
void print_malicious_process_info(void);
char is_in_malicious_process_list(int pid);
void free_all_malicious_process_list(void);
/* 记录可疑进程 */
void insert_into_suspect_process(int pid, unsigned long ac, unsigned long dev, unsigned long pc);
void delete_from_suspect_process(int pid);
void print_suspect_process_info(void);
char is_in_suspect_process_list(int pid);
void free_all_suspect_process_list(void);
extern int **V;
void zeroV(void);
void initV(void);
void printV(void);
#endif