| 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 | |
| 10 | int x=7; |
| 11 | |
| 12 | struct proc_dir_entry *pentry = NULL; |
| 13 | |
| 14 | static int my_open(struct inode *inode, struct file *file) |
| 15 | { |
| 16 | MARK(subsys_mark1, "%d", 1); |
| 17 | MARK(subsys_mark2, "%d %s", 2, "blah2"); |
| 18 | MARK(subsys_mark3, "%d %s", x, "blah3"); |
| 19 | |
| 20 | return -EPERM; |
| 21 | } |
| 22 | |
| 23 | |
| 24 | static struct file_operations my_operations = { |
| 25 | .open = my_open, |
| 26 | }; |
| 27 | |
| 28 | int init_module(void) |
| 29 | { |
| 30 | pentry = create_proc_entry("testmark", 0444, NULL); |
| 31 | if(pentry) |
| 32 | pentry->proc_fops = &my_operations; |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | void cleanup_module(void) |
| 37 | { |
| 38 | remove_proc_entry("testmark", NULL); |
| 39 | } |
| 40 | |
| 41 | MODULE_LICENSE("GPL"); |
| 42 | MODULE_AUTHOR("Mathieu Desnoyers"); |
| 43 | MODULE_DESCRIPTION("Marker Test"); |
| 44 | |