X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-probes.c;h=f95391fd0c0c3790c58ada4a82a4f8e43065f82a;hb=c08fa736f5e9d57bf93d217fa69745cb7e98a2d5;hp=b5a7fc8024401da8d19d0f132a122bd63c1c64c9;hpb=33a39a3cd074931ab3a2eaff6eb8807091cf8172;p=lttng-modules.git diff --git a/lttng-probes.c b/lttng-probes.c index b5a7fc80..f95391fd 100644 --- a/lttng-probes.c +++ b/lttng-probes.c @@ -1,23 +1,10 @@ -/* +/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) + * * lttng-probes.c * * Holds LTTng probes registry. * * Copyright (C) 2010-2012 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -25,7 +12,7 @@ #include #include -#include "lttng-events.h" +#include /* * probe list is protected by sessions lock. @@ -44,6 +31,10 @@ static LIST_HEAD(lazy_probe_init); */ static int lazy_nesting; +DEFINE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack); + +EXPORT_PER_CPU_SYMBOL_GPL(lttng_dynamic_len_stack); + /* * Called under sessions lock. */ @@ -60,6 +51,14 @@ int check_event_provider(struct lttng_probe_desc *desc) desc->provider, provider_name_len)) return 0; /* provider mismatch */ + /* + * The event needs to contain at least provider name + _ + + * one or more letter. + */ + if (strlen(desc->event_desc[i]->name) <= provider_name_len + 1) + return 0; /* provider mismatch */ + if (desc->event_desc[i]->name[provider_name_len] != '_') + return 0; /* provider mismatch */ } return 1; } @@ -243,10 +242,12 @@ static void *tp_list_start(struct seq_file *m, loff_t *pos) { struct lttng_probe_desc *probe_desc; + struct list_head *probe_list; int iter = 0, i; lttng_lock_sessions(); - list_for_each_entry(probe_desc, &_probe_list, head) { + probe_list = lttng_get_probe_list_head(); + list_for_each_entry(probe_desc, probe_list, head) { for (i = 0; i < probe_desc->nr_events; i++) { if (iter++ >= *pos) return (void *) probe_desc->event_desc[i]; @@ -260,10 +261,12 @@ static void *tp_list_next(struct seq_file *m, void *p, loff_t *ppos) { struct lttng_probe_desc *probe_desc; + struct list_head *probe_list; int iter = 0, i; (*ppos)++; - list_for_each_entry(probe_desc, &_probe_list, head) { + probe_list = lttng_get_probe_list_head(); + list_for_each_entry(probe_desc, probe_list, head) { for (i = 0; i < probe_desc->nr_events; i++) { if (iter++ >= *ppos) return (void *) probe_desc->event_desc[i]; @@ -310,3 +313,12 @@ const struct file_operations lttng_tracepoint_list_fops = { .llseek = seq_lseek, .release = seq_release, }; + +int lttng_probes_init(void) +{ + int cpu; + + for_each_possible_cpu(cpu) + per_cpu_ptr(<tng_dynamic_len_stack, cpu)->offset = 0; + return 0; +}