struct lttng_kernel_channel_buffer *chan);
void lttng_event_enabler_session_add(struct lttng_kernel_session *session,
struct lttng_event_recorder_enabler *event_enabler);
-void lttng_event_enabler_destroy(struct lttng_event_recorder_enabler *event_enabler);
-
-int lttng_event_enabler_enable(struct lttng_event_enabler_common *event_enabler);
-int lttng_event_enabler_disable(struct lttng_event_enabler_common *event_enabler);
struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
struct lttng_event_notifier_group *event_notifier_group,
enum lttng_enabler_format_type format_type,
struct lttng_kernel_abi_event_notifier *event_notifier_param);
-
-int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler_common *event_enabler,
- struct lttng_kernel_abi_filter_bytecode __user *bytecode);
int lttng_event_notifier_enabler_attach_capture_bytecode(
struct lttng_event_notifier_enabler *event_notifier_enabler,
struct lttng_kernel_abi_capture_bytecode __user *bytecode);
+int lttng_event_enabler_enable(struct lttng_event_enabler_common *event_enabler);
+int lttng_event_enabler_disable(struct lttng_event_enabler_common *event_enabler);
+int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler_common *event_enabler,
+ struct lttng_kernel_abi_filter_bytecode __user *bytecode);
+void lttng_event_enabler_destroy(struct lttng_event_enabler_common *event_enabler);
+
int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
struct lttng_event_enabler_common *enabler);
static void lttng_session_lazy_sync_event_enablers(struct lttng_kernel_session *session);
static void lttng_session_sync_event_enablers(struct lttng_kernel_session *session);
-static void lttng_event_notifier_enabler_destroy(struct lttng_event_notifier_enabler *event_notifier_enabler);
static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
static void lttng_event_enabler_sync(struct lttng_event_enabler_common *event_enabler);
struct lttng_kernel_channel_buffer_private *chan_priv, *tmpchan_priv;
struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
struct lttng_metadata_stream *metadata_stream;
- struct lttng_event_recorder_enabler *event_enabler, *tmp_event_enabler;
+ struct lttng_event_recorder_enabler *event_recorder_enabler, *tmp_event_recorder_enabler;
int ret;
mutex_lock(&sessions_mutex);
ret = lttng_syscalls_destroy_event(chan_priv->pub);
WARN_ON(ret);
}
- list_for_each_entry_safe(event_enabler, tmp_event_enabler,
+ list_for_each_entry_safe(event_recorder_enabler, tmp_event_recorder_enabler,
&session->priv->enablers_head, node)
- lttng_event_enabler_destroy(event_enabler);
+ lttng_event_enabler_destroy(&event_recorder_enabler->parent);
list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->priv->events, node)
_lttng_event_destroy(&event_recorder_priv->pub->parent);
list_for_each_entry_safe(chan_priv, tmpchan_priv, &session->priv->chan, node) {
list_for_each_entry_safe(event_notifier_enabler, tmp_event_notifier_enabler,
&event_notifier_group->enablers_head, node)
- lttng_event_notifier_enabler_destroy(event_notifier_enabler);
+ lttng_event_enabler_destroy(&event_notifier_enabler->parent);
list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
&event_notifier_group->event_notifiers_head, node)
}
}
-void lttng_event_enabler_destroy(struct lttng_event_recorder_enabler *event_enabler)
+void lttng_event_enabler_destroy(struct lttng_event_enabler_common *event_enabler)
{
- lttng_enabler_destroy(lttng_event_recorder_enabler_as_enabler(event_enabler));
+ switch (event_enabler->enabler_type) {
+ case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ {
+ struct lttng_event_recorder_enabler *event_recorder_enabler =
+ container_of(event_enabler, struct lttng_event_recorder_enabler, parent);
- if (event_enabler->published)
- list_del(&event_enabler->node);
- kfree(event_enabler);
+ lttng_enabler_destroy(event_enabler);
+ if (event_recorder_enabler->published)
+ list_del(&event_recorder_enabler->node);
+ kfree(event_recorder_enabler);
+ break;
+ }
+ case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
+ {
+ struct lttng_event_notifier_enabler *event_notifier_enabler =
+ container_of(event_enabler, struct lttng_event_notifier_enabler, parent);
+
+ list_del(&event_notifier_enabler->node);
+ lttng_enabler_destroy(event_enabler);
+ kfree(event_notifier_enabler);
+ break;
+ }
+ default:
+ WARN_ON_ONCE(1);
+ }
}
struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
return ret;
}
-static
-void lttng_event_notifier_enabler_destroy(
- struct lttng_event_notifier_enabler *event_notifier_enabler)
-{
- if (!event_notifier_enabler) {
- return;
- }
-
- list_del(&event_notifier_enabler->node);
-
- lttng_enabler_destroy(lttng_event_notifier_enabler_as_enabler(event_notifier_enabler));
- kfree(event_notifier_enabler);
-}
-
/*
* lttng_session_sync_event_enablers should be called just before starting a
* session.
}
event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
WARN_ON_ONCE(!event_recorder);
- lttng_event_enabler_destroy(event_enabler);
+ lttng_event_enabler_destroy(&event_enabler->parent);
if (IS_ERR(event_recorder)) {
/*
* If something goes wrong in event registration
return -ENOMEM;
}
event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
- lttng_event_enabler_destroy(event_enabler);
+ lttng_event_enabler_destroy(&event_enabler->parent);
WARN_ON_ONCE(!event_recorder);
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
WARN_ON_ONCE(!event_recorder);
- lttng_event_enabler_destroy(event_enabler);
+ lttng_event_enabler_destroy(&event_enabler->parent);
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
}
event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
WARN_ON_ONCE(!event_recorder);
- lttng_event_enabler_destroy(event_enabler);
+ lttng_event_enabler_destroy(&event_enabler->parent);
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
}
event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
WARN_ON_ONCE(!event_recorder);
- lttng_event_enabler_destroy(event_enabler);
+ lttng_event_enabler_destroy(&event_enabler->parent);
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}