f8e77313 |
1 | /* test-mark.c |
2 | * |
3 | */ |
4 | |
5 | #include <linux/marker.h> |
6 | #include <linux/module.h> |
7 | #include <linux/proc_fs.h> |
8 | #include <linux/sched.h> |
9 | |
abfc2016 |
10 | volatile int x=7; |
f8e77313 |
11 | |
12 | struct proc_dir_entry *pentry = NULL; |
13 | |
14 | static int my_open(struct inode *inode, struct file *file) |
15 | { |
abfc2016 |
16 | unsigned int i; |
17 | |
18 | for(i=0; i<2; i++) { |
19 | MARK(subsys_mark1, "%d", 1); |
20 | x=i; |
21 | barrier(); |
22 | } |
f8e77313 |
23 | MARK(subsys_mark2, "%d %s", 2, "blah2"); |
abfc2016 |
24 | MARK(subsys_mark3, "%d %s %s", x, "blah3", "blah5"); |
f8e77313 |
25 | |
26 | return -EPERM; |
27 | } |
28 | |
29 | |
30 | static struct file_operations my_operations = { |
7c26985b |
31 | .open = my_open, |
f8e77313 |
32 | }; |
33 | |
34 | int init_module(void) |
35 | { |
7c26985b |
36 | pentry = create_proc_entry("testmark", 0444, NULL); |
37 | if (pentry) |
38 | pentry->proc_fops = &my_operations; |
f8e77313 |
39 | return 0; |
40 | } |
41 | |
42 | void cleanup_module(void) |
43 | { |
44 | remove_proc_entry("testmark", NULL); |
45 | } |
46 | |
47 | MODULE_LICENSE("GPL"); |
48 | MODULE_AUTHOR("Mathieu Desnoyers"); |
49 | MODULE_DESCRIPTION("Marker Test"); |
50 | |