tracepoint.c: Move add_callsite/remove_callsite further down in file
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 7 Oct 2013 13:30:52 +0000 (09:30 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 7 Oct 2013 13:41:19 +0000 (09:41 -0400)
In preparation for calling disable_tracepoint() from those functions.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/tracepoint.c

index b46bd84b6ded50bb193b71ce1a8e13dfbc829650..e68ca58be07ff59703e7fa4ead0f2627587ca9b9 100644 (file)
@@ -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.
This page took 0.02678 seconds and 4 git commands to generate.