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 asmlinkage
void do_mark1(const char *format
, int value
)
19 __mark_check_format(DO_MARK1_FORMAT
, value
);
20 printk("value is %d\n", value
);
23 #define DO_MARK2_FORMAT "%d %s"
24 asmlinkage
void do_mark2(const char *format
, int value
, const char *string
)
26 __mark_check_format(DO_MARK2_FORMAT
, value
, string
);
27 printk("value is %d %s\n", value
, string
);
30 #define DO_MARK3_FORMAT "%d %s %s"
31 asmlinkage
void do_mark3(const char *format
, int value
, const char *s1
,
34 __mark_check_format(DO_MARK3_FORMAT
, value
, s1
, s2
);
35 printk("value is %d %s %s\n", value
, s1
, s2
);
41 result
= marker_set_probe("subsys_mark1", DO_MARK1_FORMAT
,
42 (marker_probe_func
*)do_mark1
);
44 result
= marker_set_probe("subsys_mark2", DO_MARK2_FORMAT
,
45 (marker_probe_func
*)do_mark2
);
46 if(!result
) goto cleanup1
;
47 result
= marker_set_probe("subsys_mark3", DO_MARK3_FORMAT
,
48 (marker_probe_func
*)do_mark3
);
49 if(!result
) goto cleanup2
;
54 marker_remove_probe((marker_probe_func
*)do_mark2
);
56 marker_remove_probe((marker_probe_func
*)do_mark1
);
61 void cleanup_module(void)
63 marker_remove_probe((marker_probe_func
*)do_mark1
);
64 marker_remove_probe((marker_probe_func
*)do_mark2
);
65 marker_remove_probe((marker_probe_func
*)do_mark3
);
68 MODULE_LICENSE("GPL");
69 MODULE_AUTHOR("Mathieu Desnoyers");
70 MODULE_DESCRIPTION("Probe");
This page took 0.031647 seconds and 5 git commands to generate.