3 * Loads a function at a marker call site.
5 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
7 * This file is released under the GPLv2.
8 * See the file COPYING for more details.
11 #include <linux/marker.h>
12 #include <linux/module.h>
13 #include <linux/kallsyms.h>
15 /* function to install */
16 #define DO_MARK1_FORMAT "%d"
17 void do_mark1(const char *format
, ...)
23 value
= va_arg(ap
, int);
24 printk("value is %d\n", value
);
29 void do_mark2(const char *format
, ...)
39 #define DO_MARK3_FORMAT "%d %s %s"
40 void do_mark3(const char *format
, ...)
47 value
= va_arg(ap
, int);
48 s1
= va_arg(ap
, const char*);
49 s2
= va_arg(ap
, const char *);
51 printk("value is %d %s %s\n",
59 result
= marker_set_probe("subsys_mark1", DO_MARK1_FORMAT
,
60 (marker_probe_func
*)do_mark1
);
62 result
= marker_set_probe("subsys_mark2", NULL
,
63 (marker_probe_func
*)do_mark2
);
64 if(!result
) goto cleanup1
;
65 result
= marker_set_probe("subsys_mark3", DO_MARK3_FORMAT
,
66 (marker_probe_func
*)do_mark3
);
67 if(!result
) goto cleanup2
;
72 marker_remove_probe((marker_probe_func
*)do_mark2
);
74 marker_remove_probe((marker_probe_func
*)do_mark1
);
79 void cleanup_module(void)
81 marker_remove_probe((marker_probe_func
*)do_mark1
);
82 marker_remove_probe((marker_probe_func
*)do_mark2
);
83 marker_remove_probe((marker_probe_func
*)do_mark3
);
86 MODULE_LICENSE("GPL");
87 MODULE_AUTHOR("Mathieu Desnoyers");
88 MODULE_DESCRIPTION("Probe");
This page took 0.030811 seconds and 4 git commands to generate.