From: compudj Date: Mon, 25 Sep 2006 23:17:57 +0000 (+0000) Subject: update probe X-Git-Tag: v0.12.20~1352 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=996926d199900da9c5bad390327ca6ac3100283f;p=lttv.git update probe git-svn-id: http://ltt.polymtl.ca/svn@2137 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/tests/kernel/probe.c b/tests/kernel/probe.c index f8916a1a..5f2c484b 100644 --- a/tests/kernel/probe.c +++ b/tests/kernel/probe.c @@ -14,25 +14,43 @@ /* function to install */ #define DO_MARK1_FORMAT "%d" -asmlinkage void do_mark1(const char *format, int value) +void do_mark1(const char *format, ...) { - __mark_check_format(DO_MARK1_FORMAT, value); + va_list ap; + int value; + + va_start(ap, format); + value = va_arg(ap, int); printk("value is %d\n", value); + + va_end(ap); } -#define DO_MARK2_FORMAT "%d %s" -asmlinkage void do_mark2(const char *format, int value, const char *string) +void do_mark2(const char *format, ...) { - __mark_check_format(DO_MARK2_FORMAT, value, string); - printk("value is %d %s\n", value, string); + va_list ap; + + va_start(ap, format); + vprintk(format, ap); + va_end(ap); + printk("\n"); } #define DO_MARK3_FORMAT "%d %s %s" -asmlinkage void do_mark3(const char *format, int value, const char *s1, - const char *s2) +void do_mark3(const char *format, ...) { - __mark_check_format(DO_MARK3_FORMAT, value, s1, s2); - printk("value is %d %s %s\n", value, s1, s2); + va_list ap; + int value; + const char *s1, *s2; + + va_start(ap, format); + value = va_arg(ap, int); + s1 = va_arg(ap, const char*); + s2 = va_arg(ap, const char *); + + printk("value is %d %s %s\n", + value, s1, s2); + va_end(ap); } int init_module(void) @@ -41,7 +59,7 @@ int init_module(void) result = marker_set_probe("subsys_mark1", DO_MARK1_FORMAT, (marker_probe_func*)do_mark1); if(!result) goto end; - result = marker_set_probe("subsys_mark2", DO_MARK2_FORMAT, + result = marker_set_probe("subsys_mark2", NULL, (marker_probe_func*)do_mark2); if(!result) goto cleanup1; result = marker_set_probe("subsys_mark3", DO_MARK3_FORMAT, @@ -68,4 +86,3 @@ void cleanup_module(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Mathieu Desnoyers"); MODULE_DESCRIPTION("Probe"); - diff --git a/tests/kernel/test-mark.c b/tests/kernel/test-mark.c index 080e5a5f..223b2490 100644 --- a/tests/kernel/test-mark.c +++ b/tests/kernel/test-mark.c @@ -8,7 +8,7 @@ #include #include -volatile int x=7; +volatile int x = 7; struct proc_dir_entry *pentry = NULL; @@ -23,10 +23,8 @@ static int my_open(struct inode *inode, struct file *file) for(i=0; i<2; i++) { MARK(subsys_mark1, "%d", 1); - x=i; - barrier(); } - MARK(subsys_mark2, "%d %s", 2, "blah2"); + MARK(subsys_mark2, "%d %s %s", 2, "blah2", "blahx"); MARK(subsys_mark3, "%d %s %s", x, "blah3", "blah5"); test(NULL); test(NULL); @@ -41,8 +39,6 @@ static struct file_operations my_operations = { int init_module(void) { - unsigned int i; - pentry = create_proc_entry("testmark", 0444, NULL); if (pentry) pentry->proc_fops = &my_operations;