key.name = event->attr.name;
key.filter = (struct lttng_filter_bytecode *) event->filter;
- key.loglevel_type = event->attr.loglevel;
+ key.loglevel_type = event->attr.loglevel_type;
+ key.loglevel_value = event->attr.loglevel;
key.exclusion = event->exclusion;
node_ptr = cds_lfht_add_unique(ht->ht,
rcu_read_lock();
uevent = trace_ust_find_event(uchan->events, event->name, filter,
- event->loglevel, exclusion);
+ event->loglevel_type, event->loglevel, exclusion);
if (!uevent) {
uevent = trace_ust_create_event(event, filter_expression,
filter, exclusion, internal_event);
}
/*
- * The loglevel is hardcoded with 0 here since the agent ust event is set
- * with the loglevel type to ALL thus the loglevel stays 0. The event's
- * filter is the one handling the loglevel for agent.
+ * Agent UST event has its loglevel type forced to
+ * LTTNG_UST_LOGLEVEL_ALL. The actual loglevel type/value filtering
+ * happens thanks to an UST filter. The following -1 is actually
+ * ignored since the type is LTTNG_UST_LOGLEVEL_ALL.
*/
uevent = trace_ust_find_event(uchan->events, (char *) ust_event_name,
- aevent->filter, 0, NULL);
+ aevent->filter, LTTNG_UST_LOGLEVEL_ALL, -1, NULL);
/* If the agent event exists, it must be available on the UST side. */
assert(uevent);
goto no_match;
}
- /* Event loglevel. */
- if (ev_loglevel_value != key->loglevel_type) {
- if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL
- && key->loglevel_type == 0 && ev_loglevel_value == -1) {
+ /* Event loglevel value and type. */
+ if (event->attr.loglevel_type == key->loglevel_type) {
+ /* Same loglevel type. */
+ if (key->loglevel_type != LTTNG_UST_LOGLEVEL_ALL) {
/*
- * Match is accepted. This is because on event creation, the
- * loglevel is set to -1 if the event loglevel type is ALL so 0 and
- * -1 are accepted for this loglevel type since 0 is the one set by
- * the API when receiving an enable event.
+ * Loglevel value must also match since the loglevel
+ * type is not all.
*/
- } else {
- goto no_match;
+ if (ev_loglevel_value != key->loglevel_value) {
+ goto no_match;
+ }
}
+ } else {
+ /* Loglevel type is different: no match. */
+ goto no_match;
}
/* Only one of the filters is NULL, fail. */
*/
struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
char *name, struct lttng_filter_bytecode *filter,
- int loglevel_value, struct lttng_event_exclusion *exclusion)
+ enum lttng_ust_loglevel_type loglevel_type, int loglevel_value,
+ struct lttng_event_exclusion *exclusion)
{
struct lttng_ht_node_str *node;
struct lttng_ht_iter iter;
key.name = name;
key.filter = filter;
- key.loglevel_type = loglevel_value;
+ key.loglevel_type = loglevel_type;
+ key.loglevel_value = loglevel_value;
key.exclusion = exclusion;
cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
const char *name;
const struct lttng_filter_bytecode *filter;
enum lttng_ust_loglevel_type loglevel_type;
+ int loglevel_value;
const struct lttng_event_exclusion *exclusion;
};
*/
struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
char *name, struct lttng_filter_bytecode *filter,
- int loglevel_value, struct lttng_event_exclusion *exclusion);
+ enum lttng_ust_loglevel_type loglevel_type, int loglevel_value,
+ struct lttng_event_exclusion *exclusion);
struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
char *name);
struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
{
return 0;
}
-static inline struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
+static inline
+struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
char *name, struct lttng_filter_bytecode *filter,
- int loglevel_value, struct lttng_event_exclusion *exclusion)
+ enum lttng_ust_loglevel_type loglevel_type, int loglevel_value,
+ struct lttng_event_exclusion *exclusion)
{
return NULL;
}