convert from svn repository: remove tags directory
[lttv.git] / trunk / tests / markers / probe-string.c
1 /* probe.c
2 *
3 * Loads a function at a marker call site.
4 *
5 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
6 *
7 * This file is released under the GPLv2.
8 * See the file COPYING for more details.
9 */
10
11 #include <linux/marker.h>
12 #include <linux/module.h>
13 #include <linux/kallsyms.h>
14
15
16 int value;
17 void *ptr;
18
19 /* function to install */
20 void do_mark1(const char *format, ...)
21 {
22 unsigned int i = 0;
23 va_list ap;
24 int control = 0;
25
26 va_start(ap, format);
27 while(1) {
28 if(control) {
29 switch(format[i]) {
30 case '\0' :
31 return;
32 case 'd' :
33 value = va_arg(ap, int);
34 case 'p' :
35 ptr = va_arg(ap, void*);
36 }
37 control = 0;
38 } else {
39 switch(format[i]) {
40 case '%' :
41 control = 1;
42 break;
43 case '\0' :
44 return;
45 default:
46 control = 0;
47 }
48 }
49 i++;
50 }
51 va_end(ap);
52 }
53
54 int init_module(void)
55 {
56 int result;
57 result = marker_set_probe("subsys_mark1", NULL,
58 do_mark1);
59 if(!result) goto end;
60
61 return 0;
62
63 end:
64 marker_remove_probe(do_mark1);
65 return -EPERM;
66 }
67
68 void cleanup_module(void)
69 {
70 marker_remove_probe(do_mark1);
71 }
72
73 MODULE_LICENSE("GPL");
74 MODULE_AUTHOR("Mathieu Desnoyers");
75 MODULE_DESCRIPTION("Probe");
This page took 0.031086 seconds and 4 git commands to generate.