-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcachezoom.h
53 lines (46 loc) · 1.11 KB
/
cachezoom.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
#include "kernel/cachezoom_kernel.h"
#define OPEN_CACHEZOOM_DRV()({\
do {\
_FD_ = open("/dev/cachezoom", O_RDWR);\
if (_FD_ == -1) {\
printf("Couldn't open /dev/cachezoom\n");\
return -1;\
}\
} while(0);\
})
#define INIT_CACHEZOOM(next_dead, timer_inter, interval, target)({\
do {\
param.param_0 = next_dead;\
param.param_1 = timer_inter;\
param.param_2 = interval;\
param.param_3 = target;\
if(ioctl(_FD_, CACHEZOOM_IOCTL_INIT, ¶m)) {\
printf("IOCTL failed %d\n", errno);\
return -1;\
}\
} while(0);\
})
#define INSTALL_TIMER()({\
do {\
if(ioctl(_FD_, CACHEZOOM_IOCTL_INSTALL_TIMER, ¶m)) {\
printf("IOCTL failed %d\n", errno);\
return -1;\
}\
} while(0);\
})
#define UNINSTALL_TIMER()({\
do {\
if(ioctl(_FD_, CACHEZOOM_IOCTL_UNINSTALL_TIMER, ¶m)) {\
printf("IOCTL failed %d\n", errno);\
return -1;\
}\
} while(0);\
})
#define TEST_CACHEZOOM()({\
do {\
if(ioctl(_FD_, CACHEZOOM_IOCTL_TEST, ¶m)) {\
printf("IOCTL failed %d\n", errno);\
return -1;\
}\
} while(0);\
})