Commit | Line | Data |
---|---|---|
9dad1eb8 PMF |
1 | /* |
2 | * LTT core in-kernel infrastructure. | |
3 | * | |
4 | * Copyright 2006 - Mathieu Desnoyers mathieu.desnoyers@polymtl.ca | |
5 | * | |
8fc2d8db PMF |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2.1 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
9dad1eb8 PMF |
19 | */ |
20 | ||
b6bf28ec PMF |
21 | //ust// #include <linux/ltt-core.h> |
22 | //ust// #include <linux/percpu.h> | |
23 | //ust// #include <linux/module.h> | |
24 | //ust// #include <linux/debugfs.h> | |
fbca6b62 | 25 | #include <ust/kernelcompat.h> |
b6bf28ec | 26 | #include "tracercore.h" |
9dad1eb8 PMF |
27 | |
28 | /* Traces structures */ | |
29 | struct ltt_traces ltt_traces = { | |
30 | .setup_head = LIST_HEAD_INIT(ltt_traces.setup_head), | |
31 | .head = LIST_HEAD_INIT(ltt_traces.head), | |
32 | }; | |
b6bf28ec | 33 | //ust// EXPORT_SYMBOL(ltt_traces); |
9dad1eb8 PMF |
34 | |
35 | /* Traces list writer locking */ | |
36 | static DEFINE_MUTEX(ltt_traces_mutex); | |
37 | ||
38 | /* dentry of ltt's root dir */ | |
b6bf28ec PMF |
39 | //ust// static struct dentry *ltt_root_dentry; |
40 | //ust// struct dentry *get_ltt_root(void) | |
41 | //ust// { | |
42 | //ust// if (!ltt_root_dentry) { | |
43 | //ust// ltt_root_dentry = debugfs_create_dir(LTT_ROOT, NULL); | |
44 | //ust// if (!ltt_root_dentry) | |
45 | //ust// printk(KERN_ERR "LTT : create ltt root dir failed\n"); | |
46 | //ust// } | |
47 | //ust// return ltt_root_dentry; | |
48 | //ust// } | |
49 | //ust// EXPORT_SYMBOL_GPL(get_ltt_root); | |
9dad1eb8 PMF |
50 | |
51 | void ltt_lock_traces(void) | |
52 | { | |
53 | mutex_lock(<t_traces_mutex); | |
54 | } | |
b6bf28ec | 55 | //ust// EXPORT_SYMBOL_GPL(ltt_lock_traces); |
9dad1eb8 PMF |
56 | |
57 | void ltt_unlock_traces(void) | |
58 | { | |
59 | mutex_unlock(<t_traces_mutex); | |
60 | } | |
b6bf28ec | 61 | //ust// EXPORT_SYMBOL_GPL(ltt_unlock_traces); |
9dad1eb8 | 62 | |
b6bf28ec PMF |
63 | //ust// DEFINE_PER_CPU(unsigned int, ltt_nesting); |
64 | //ust// EXPORT_PER_CPU_SYMBOL(ltt_nesting); | |
bb07823d | 65 | unsigned int ltt_nesting; |
9dad1eb8 PMF |
66 | |
67 | int ltt_run_filter_default(void *trace, uint16_t eID) | |
68 | { | |
69 | return 1; | |
70 | } | |
71 | ||
72 | /* This function pointer is protected by a trace activation check */ | |
73 | ltt_run_filter_functor ltt_run_filter = ltt_run_filter_default; | |
b6bf28ec | 74 | //ust// EXPORT_SYMBOL_GPL(ltt_run_filter); |
9dad1eb8 PMF |
75 | |
76 | void ltt_filter_register(ltt_run_filter_functor func) | |
77 | { | |
78 | ltt_run_filter = func; | |
79 | } | |
b6bf28ec | 80 | //ust// EXPORT_SYMBOL_GPL(ltt_filter_register); |
9dad1eb8 PMF |
81 | |
82 | void ltt_filter_unregister(void) | |
83 | { | |
84 | ltt_run_filter = ltt_run_filter_default; | |
85 | } | |
b6bf28ec | 86 | //ust// EXPORT_SYMBOL_GPL(ltt_filter_unregister); |