X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Ftracepoint.c;h=62aaf418ee405437d02c7edc37c6ba7841045d20;hb=956c6fab1fd3200697383908040e6c2aab02e5dd;hp=a14c8b34303e43dc40be48cd3aefcd89a31c2197;hpb=67e5f39161d80ea3d972a37ecf76f45a260c480d;p=lttng-ust.git diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index a14c8b34..62aaf418 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -37,7 +38,7 @@ #include #include "tracepoint-internal.h" -#include "ltt-tracer-core.h" +#include "lttng-tracer-core.h" #include "jhash.h" #include "error.h" @@ -77,7 +78,7 @@ static CDS_LIST_HEAD(libs); * Tracepoint hash table, containing the active tracepoints. * Protected by tracepoint mutex. */ -#define TRACEPOINT_HASH_BITS 6 +#define TRACEPOINT_HASH_BITS 12 #define TRACEPOINT_TABLE_SIZE (1 << TRACEPOINT_HASH_BITS) static struct cds_hlist_head tracepoint_table[TRACEPOINT_TABLE_SIZE]; @@ -137,13 +138,15 @@ static void debug_print_probes(struct tracepoint_entry *entry) static void * tracepoint_entry_add_probe(struct tracepoint_entry *entry, - void *probe, void *data) + void (*probe)(void), void *data) { int nr_probes = 0; struct tracepoint_probe *old, *new; - WARN_ON(!probe); - + if (!probe) { + WARN_ON(1); + return ERR_PTR(-EINVAL); + } debug_print_probes(entry); old = entry->probes; if (old) { @@ -169,8 +172,8 @@ tracepoint_entry_add_probe(struct tracepoint_entry *entry, } static void * -tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe, - void *data) +tracepoint_entry_remove_probe(struct tracepoint_entry *entry, + void (*probe)(void), void *data) { int nr_probes = 0, nr_del = 0, i; struct tracepoint_probe *old, *new; @@ -182,11 +185,14 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe, debug_print_probes(entry); /* (N -> M), (N > 1, M >= 0) probes */ - for (nr_probes = 0; old[nr_probes].func; nr_probes++) { - if (!probe || - (old[nr_probes].func == probe && - old[nr_probes].data == data)) - nr_del++; + if (probe) { + for (nr_probes = 0; old[nr_probes].func; nr_probes++) { + if (old[nr_probes].func == probe && + old[nr_probes].data == data) + nr_del++; + } + } else { + nr_del = nr_probes; } if (nr_probes - nr_del == 0) { @@ -203,8 +209,7 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe, if (new == NULL) return ERR_PTR(-ENOMEM); for (i = 0; old[i].func; i++) - if (probe && - (old[i].func != probe || old[i].data != data)) + if (old[i].func != probe || old[i].data != data) new[j++] = old[i]; new[nr_probes - nr_del].func = NULL; entry->refcount = nr_probes - nr_del; @@ -390,7 +395,7 @@ static void tracepoint_update_probes(void) } static struct tracepoint_probe * -tracepoint_add_probe(const char *name, void *probe, void *data, +tracepoint_add_probe(const char *name, void (*probe)(void), void *data, const char *signature) { struct tracepoint_entry *entry; @@ -417,8 +422,8 @@ tracepoint_add_probe(const char *name, void *probe, void *data, * The probe address must at least be aligned on the architecture pointer size. * Called with the tracepoint mutex held. */ -int __tracepoint_probe_register(const char *name, void *probe, void *data, - const char *signature) +int __tracepoint_probe_register(const char *name, void (*probe)(void), + void *data, const char *signature) { void *old; int ret = 0; @@ -439,7 +444,8 @@ end: return ret; } -static void *tracepoint_remove_probe(const char *name, void *probe, void *data) +static void *tracepoint_remove_probe(const char *name, void (*probe)(void), + void *data) { struct tracepoint_entry *entry; void *old; @@ -461,7 +467,8 @@ static void *tracepoint_remove_probe(const char *name, void *probe, void *data) * @probe: probe function pointer * @probe: probe data pointer */ -int __tracepoint_probe_unregister(const char *name, void *probe, void *data) +int __tracepoint_probe_unregister(const char *name, void (*probe)(void), + void *data) { void *old; int ret = 0; @@ -498,7 +505,7 @@ static void tracepoint_add_old_probes(void *old) * * caller must call tracepoint_probe_update_all() */ -int tracepoint_probe_register_noupdate(const char *name, void *probe, +int tracepoint_probe_register_noupdate(const char *name, void (*probe)(void), void *data, const char *signature) { void *old; @@ -524,7 +531,7 @@ end: * caller must call tracepoint_probe_update_all() * Called with the tracepoint mutex held. */ -int tracepoint_probe_unregister_noupdate(const char *name, void *probe, +int tracepoint_probe_unregister_noupdate(const char *name, void (*probe)(void), void *data) { void *old;