From: Mathieu Desnoyers Date: Mon, 7 Oct 2013 13:30:52 +0000 (-0400) Subject: tracepoint.c: Move add_callsite/remove_callsite further down in file X-Git-Tag: v2.2.2~10 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4a8f9fe6a3fb242ce5cdb905d7f9f24a8fb5df6b;p=lttng-ust.git tracepoint.c: Move add_callsite/remove_callsite further down in file In preparation for calling disable_tracepoint() from those functions. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index b46bd84b..e68ca58b 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -310,42 +310,6 @@ static void remove_tracepoint(struct tracepoint_entry *e) free(e); } -/* - * Add the callsite to the callsite hash table. Must be called with - * tracepoint mutex held. - */ -static void add_callsite(struct tracepoint_lib * lib, struct tracepoint *tp) -{ - struct cds_hlist_head *head; - struct callsite_entry *e; - const char *name = tp->name; - size_t name_len = strlen(name); - uint32_t hash; - - if (name_len > LTTNG_UST_SYM_NAME_LEN - 1) { - WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name, LTTNG_UST_SYM_NAME_LEN - 1); - name_len = LTTNG_UST_SYM_NAME_LEN - 1; - } - hash = jhash(name, name_len, 0); - head = &callsite_table[hash & (CALLSITE_TABLE_SIZE - 1)]; - e = zmalloc(sizeof(struct callsite_entry)); - assert(e); - cds_hlist_add_head(&e->hlist, head); - e->tp = tp; - cds_list_add(&e->node, &lib->callsites); -} - -/* - * Remove the callsite from the callsite hash table and from lib - * callsite list. Must be called with tracepoint mutex held. - */ -static void remove_callsite(struct callsite_entry *e) -{ - cds_hlist_del(&e->hlist); - cds_list_del(&e->node); - free(e); -} - /* * Sets the probe callback corresponding to one tracepoint. */ @@ -394,6 +358,42 @@ static void disable_tracepoint(struct tracepoint *elem) rcu_assign_pointer(elem->probes, NULL); } +/* + * Add the callsite to the callsite hash table. Must be called with + * tracepoint mutex held. + */ +static void add_callsite(struct tracepoint_lib * lib, struct tracepoint *tp) +{ + struct cds_hlist_head *head; + struct callsite_entry *e; + const char *name = tp->name; + size_t name_len = strlen(name); + uint32_t hash; + + if (name_len > LTTNG_UST_SYM_NAME_LEN - 1) { + WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name, LTTNG_UST_SYM_NAME_LEN - 1); + name_len = LTTNG_UST_SYM_NAME_LEN - 1; + } + hash = jhash(name, name_len, 0); + head = &callsite_table[hash & (CALLSITE_TABLE_SIZE - 1)]; + e = zmalloc(sizeof(struct callsite_entry)); + assert(e); + cds_hlist_add_head(&e->hlist, head); + e->tp = tp; + cds_list_add(&e->node, &lib->callsites); +} + +/* + * Remove the callsite from the callsite hash table and from lib + * callsite list. Must be called with tracepoint mutex held. + */ +static void remove_callsite(struct callsite_entry *e) +{ + cds_hlist_del(&e->hlist); + cds_list_del(&e->node); + free(e); +} + /* * Enable/disable all callsites based on the state of a specific * tracepoint entry.