diff options
-rw-r--r-- | samples/Kconfig | 6 | ||||
-rw-r--r-- | samples/Makefile | 2 | ||||
-rw-r--r-- | samples/tracepoints/Makefile | 6 | ||||
-rw-r--r-- | samples/tracepoints/tp-samples-trace.h | 11 | ||||
-rw-r--r-- | samples/tracepoints/tracepoint-probe-sample.c | 57 | ||||
-rw-r--r-- | samples/tracepoints/tracepoint-probe-sample2.c | 44 | ||||
-rw-r--r-- | samples/tracepoints/tracepoint-sample.c | 57 |
7 files changed, 1 insertions, 182 deletions
diff --git a/samples/Kconfig b/samples/Kconfig index 7b6792a18c05..6181c2cc9ca0 100644 --- a/samples/Kconfig +++ b/samples/Kconfig | |||
@@ -5,12 +5,6 @@ menuconfig SAMPLES | |||
5 | 5 | ||
6 | if SAMPLES | 6 | if SAMPLES |
7 | 7 | ||
8 | config SAMPLE_TRACEPOINTS | ||
9 | tristate "Build tracepoints examples -- loadable modules only" | ||
10 | depends on TRACEPOINTS && m | ||
11 | help | ||
12 | This build tracepoints example modules. | ||
13 | |||
14 | config SAMPLE_TRACE_EVENTS | 8 | config SAMPLE_TRACE_EVENTS |
15 | tristate "Build trace_events examples -- loadable modules only" | 9 | tristate "Build trace_events examples -- loadable modules only" |
16 | depends on EVENT_TRACING && m | 10 | depends on EVENT_TRACING && m |
diff --git a/samples/Makefile b/samples/Makefile index 5ef08bba96ce..1a60c62e2045 100644 --- a/samples/Makefile +++ b/samples/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # Makefile for Linux samples code | 1 | # Makefile for Linux samples code |
2 | 2 | ||
3 | obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ tracepoints/ trace_events/ \ | 3 | obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ \ |
4 | hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ | 4 | hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ |
diff --git a/samples/tracepoints/Makefile b/samples/tracepoints/Makefile deleted file mode 100644 index 36479ad9ae14..000000000000 --- a/samples/tracepoints/Makefile +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | # builds the tracepoint example kernel modules; | ||
2 | # then to use one (as root): insmod <module_name.ko> | ||
3 | |||
4 | obj-$(CONFIG_SAMPLE_TRACEPOINTS) += tracepoint-sample.o | ||
5 | obj-$(CONFIG_SAMPLE_TRACEPOINTS) += tracepoint-probe-sample.o | ||
6 | obj-$(CONFIG_SAMPLE_TRACEPOINTS) += tracepoint-probe-sample2.o | ||
diff --git a/samples/tracepoints/tp-samples-trace.h b/samples/tracepoints/tp-samples-trace.h deleted file mode 100644 index 4d46be965961..000000000000 --- a/samples/tracepoints/tp-samples-trace.h +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | #ifndef _TP_SAMPLES_TRACE_H | ||
2 | #define _TP_SAMPLES_TRACE_H | ||
3 | |||
4 | #include <linux/proc_fs.h> /* for struct inode and struct file */ | ||
5 | #include <linux/tracepoint.h> | ||
6 | |||
7 | DECLARE_TRACE(subsys_event, | ||
8 | TP_PROTO(struct inode *inode, struct file *file), | ||
9 | TP_ARGS(inode, file)); | ||
10 | DECLARE_TRACE_NOARGS(subsys_eventb); | ||
11 | #endif | ||
diff --git a/samples/tracepoints/tracepoint-probe-sample.c b/samples/tracepoints/tracepoint-probe-sample.c deleted file mode 100644 index 744c0b9652a7..000000000000 --- a/samples/tracepoints/tracepoint-probe-sample.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * tracepoint-probe-sample.c | ||
3 | * | ||
4 | * sample tracepoint probes. | ||
5 | */ | ||
6 | |||
7 | #include <linux/module.h> | ||
8 | #include <linux/file.h> | ||
9 | #include <linux/dcache.h> | ||
10 | #include "tp-samples-trace.h" | ||
11 | |||
12 | /* | ||
13 | * Here the caller only guarantees locking for struct file and struct inode. | ||
14 | * Locking must therefore be done in the probe to use the dentry. | ||
15 | */ | ||
16 | static void probe_subsys_event(void *ignore, | ||
17 | struct inode *inode, struct file *file) | ||
18 | { | ||
19 | path_get(&file->f_path); | ||
20 | dget(file->f_path.dentry); | ||
21 | printk(KERN_INFO "Event is encountered with filename %s\n", | ||
22 | file->f_path.dentry->d_name.name); | ||
23 | dput(file->f_path.dentry); | ||
24 | path_put(&file->f_path); | ||
25 | } | ||
26 | |||
27 | static void probe_subsys_eventb(void *ignore) | ||
28 | { | ||
29 | printk(KERN_INFO "Event B is encountered\n"); | ||
30 | } | ||
31 | |||
32 | static int __init tp_sample_trace_init(void) | ||
33 | { | ||
34 | int ret; | ||
35 | |||
36 | ret = register_trace_subsys_event(probe_subsys_event, NULL); | ||
37 | WARN_ON(ret); | ||
38 | ret = register_trace_subsys_eventb(probe_subsys_eventb, NULL); | ||
39 | WARN_ON(ret); | ||
40 | |||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | module_init(tp_sample_trace_init); | ||
45 | |||
46 | static void __exit tp_sample_trace_exit(void) | ||
47 | { | ||
48 | unregister_trace_subsys_eventb(probe_subsys_eventb, NULL); | ||
49 | unregister_trace_subsys_event(probe_subsys_event, NULL); | ||
50 | tracepoint_synchronize_unregister(); | ||
51 | } | ||
52 | |||
53 | module_exit(tp_sample_trace_exit); | ||
54 | |||
55 | MODULE_LICENSE("GPL"); | ||
56 | MODULE_AUTHOR("Mathieu Desnoyers"); | ||
57 | MODULE_DESCRIPTION("Tracepoint Probes Samples"); | ||
diff --git a/samples/tracepoints/tracepoint-probe-sample2.c b/samples/tracepoints/tracepoint-probe-sample2.c deleted file mode 100644 index 9fcf990e5d4b..000000000000 --- a/samples/tracepoints/tracepoint-probe-sample2.c +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * tracepoint-probe-sample2.c | ||
3 | * | ||
4 | * 2nd sample tracepoint probes. | ||
5 | */ | ||
6 | |||
7 | #include <linux/module.h> | ||
8 | #include <linux/fs.h> | ||
9 | #include "tp-samples-trace.h" | ||
10 | |||
11 | /* | ||
12 | * Here the caller only guarantees locking for struct file and struct inode. | ||
13 | * Locking must therefore be done in the probe to use the dentry. | ||
14 | */ | ||
15 | static void probe_subsys_event(void *ignore, | ||
16 | struct inode *inode, struct file *file) | ||
17 | { | ||
18 | printk(KERN_INFO "Event is encountered with inode number %lu\n", | ||
19 | inode->i_ino); | ||
20 | } | ||
21 | |||
22 | static int __init tp_sample_trace_init(void) | ||
23 | { | ||
24 | int ret; | ||
25 | |||
26 | ret = register_trace_subsys_event(probe_subsys_event, NULL); | ||
27 | WARN_ON(ret); | ||
28 | |||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | module_init(tp_sample_trace_init); | ||
33 | |||
34 | static void __exit tp_sample_trace_exit(void) | ||
35 | { | ||
36 | unregister_trace_subsys_event(probe_subsys_event, NULL); | ||
37 | tracepoint_synchronize_unregister(); | ||
38 | } | ||
39 | |||
40 | module_exit(tp_sample_trace_exit); | ||
41 | |||
42 | MODULE_LICENSE("GPL"); | ||
43 | MODULE_AUTHOR("Mathieu Desnoyers"); | ||
44 | MODULE_DESCRIPTION("Tracepoint Probes Samples"); | ||
diff --git a/samples/tracepoints/tracepoint-sample.c b/samples/tracepoints/tracepoint-sample.c deleted file mode 100644 index f4d89e008c32..000000000000 --- a/samples/tracepoints/tracepoint-sample.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* tracepoint-sample.c | ||
2 | * | ||
3 | * Executes a tracepoint when /proc/tracepoint-sample is opened. | ||
4 | * | ||
5 | * (C) Copyright 2007 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/module.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/proc_fs.h> | ||
14 | #include "tp-samples-trace.h" | ||
15 | |||
16 | DEFINE_TRACE(subsys_event); | ||
17 | DEFINE_TRACE(subsys_eventb); | ||
18 | |||
19 | struct proc_dir_entry *pentry_sample; | ||
20 | |||
21 | static int my_open(struct inode *inode, struct file *file) | ||
22 | { | ||
23 | int i; | ||
24 | |||
25 | trace_subsys_event(inode, file); | ||
26 | for (i = 0; i < 10; i++) | ||
27 | trace_subsys_eventb(); | ||
28 | return -EPERM; | ||
29 | } | ||
30 | |||
31 | static const struct file_operations mark_ops = { | ||
32 | .open = my_open, | ||
33 | .llseek = noop_llseek, | ||
34 | }; | ||
35 | |||
36 | static int __init sample_init(void) | ||
37 | { | ||
38 | printk(KERN_ALERT "sample init\n"); | ||
39 | pentry_sample = proc_create("tracepoint-sample", 0444, NULL, | ||
40 | &mark_ops); | ||
41 | if (!pentry_sample) | ||
42 | return -EPERM; | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static void __exit sample_exit(void) | ||
47 | { | ||
48 | printk(KERN_ALERT "sample exit\n"); | ||
49 | remove_proc_entry("tracepoint-sample", NULL); | ||
50 | } | ||
51 | |||
52 | module_init(sample_init) | ||
53 | module_exit(sample_exit) | ||
54 | |||
55 | MODULE_LICENSE("GPL"); | ||
56 | MODULE_AUTHOR("Mathieu Desnoyers"); | ||
57 | MODULE_DESCRIPTION("Tracepoint sample"); | ||