__attribute__((visibility("hidden")));
/*
- * Enable a `struct lttng_event_enabler` object and all events related to this
+ * Enable a `struct lttng_event_enabler_common` object and all events related to this
* enabler.
*/
-int lttng_event_enabler_enable(struct lttng_event_enabler_session_common *enabler)
+int lttng_event_enabler_enable(struct lttng_event_enabler_common *enabler)
__attribute__((visibility("hidden")));
/*
- * Disable a `struct lttng_event_enabler` object and all events related to this
+ * Disable a `struct lttng_event_enabler_common` object and all events related to this
* enabler.
*/
-int lttng_event_enabler_disable(struct lttng_event_enabler_session_common *enabler)
+int lttng_event_enabler_disable(struct lttng_event_enabler_common *enabler)
__attribute__((visibility("hidden")));
/*
struct lttng_ust_abi_event_notifier *event_notifier_param)
__attribute__((visibility("hidden")));
-/*
- * Enable a `struct lttng_event_notifier_enabler` object and all event
- * notifiers related to this enabler.
- */
-int lttng_event_notifier_enabler_enable(
- struct lttng_event_notifier_enabler *event_notifier_enabler)
- __attribute__((visibility("hidden")));
-
-/*
- * Disable a `struct lttng_event_notifier_enabler` object and all event
- * notifiers related to this enabler.
- */
-int lttng_event_notifier_enabler_disable(
- struct lttng_event_notifier_enabler *event_notifier_enabler)
- __attribute__((visibility("hidden")));
-
/*
* Attach filter bytecode program to `struct lttng_event_notifier_enabler` and
* all event notifiers related to this 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);
bool lttng_ust_validate_event_name(const struct lttng_ust_event_desc *desc)
{
return event_notifier_enabler;
}
-int lttng_event_enabler_enable(struct lttng_event_enabler_session_common *event_enabler)
+int lttng_event_enabler_enable(struct lttng_event_enabler_common *event_enabler)
{
- event_enabler->parent.enabled = 1;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
-
+ event_enabler->enabled = 1;
+ lttng_event_enabler_sync(event_enabler);
return 0;
}
-int lttng_event_enabler_disable(struct lttng_event_enabler_session_common *event_enabler)
+int lttng_event_enabler_disable(struct lttng_event_enabler_common *event_enabler)
{
- event_enabler->parent.enabled = 0;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
-
+ event_enabler->enabled = 0;
+ lttng_event_enabler_sync(event_enabler);
return 0;
}
return 0;
}
-int lttng_event_notifier_enabler_enable(
- struct lttng_event_notifier_enabler *event_notifier_enabler)
-{
- lttng_event_notifier_enabler_as_enabler(event_notifier_enabler)->enabled = 1;
- lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group);
-
- return 0;
-}
-
-int lttng_event_notifier_enabler_disable(
- struct lttng_event_notifier_enabler *event_notifier_enabler)
-{
- lttng_event_notifier_enabler_as_enabler(event_notifier_enabler)->enabled = 0;
- lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group);
-
- return 0;
-}
-
int lttng_event_notifier_enabler_attach_filter_bytecode(
struct lttng_event_notifier_enabler *event_notifier_enabler,
struct lttng_ust_bytecode_node **bytecode)
lttng_session_sync_event_enablers(session);
}
+static
+void lttng_event_enabler_sync(struct lttng_event_enabler_common *event_enabler)
+{
+ switch (event_enabler->enabler_type) {
+ case LTTNG_EVENT_ENABLER_TYPE_RECORDER: /* Fall-through */
+ case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
+ {
+ struct lttng_event_enabler_session_common *event_enabler_session =
+ caa_container_of(event_enabler, struct lttng_event_enabler_session_common, parent);
+ lttng_session_lazy_sync_event_enablers(event_enabler_session->chan->session);
+ break;
+ }
+ case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
+ {
+ struct lttng_event_notifier_enabler *event_notifier_enabler =
+ caa_container_of(event_enabler, struct lttng_event_notifier_enabler, parent);
+ lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group);
+ break;
+ }
+ default:
+ WARN_ON_ONCE(1);
+ }
+}
+
/*
* Update all sessions with the given app context.
* Called with ust lock held.
event_notifier_enabler,
(struct lttng_ust_bytecode_node **) arg);
case LTTNG_UST_ABI_ENABLE:
- return lttng_event_notifier_enabler_enable(event_notifier_enabler);
+ return lttng_event_enabler_enable(&event_notifier_enabler->parent);
case LTTNG_UST_ABI_DISABLE:
- return lttng_event_notifier_enabler_disable(event_notifier_enabler);
+ return lttng_event_enabler_disable(&event_notifier_enabler->parent);
default:
return -EINVAL;
}
return lttng_event_enabler_attach_context(enabler,
(struct lttng_ust_abi_context *) arg);
case LTTNG_UST_ABI_ENABLE:
- return lttng_event_enabler_enable(enabler);
+ return lttng_event_enabler_enable(&enabler->parent);
case LTTNG_UST_ABI_DISABLE:
- return lttng_event_enabler_disable(enabler);
+ return lttng_event_enabler_disable(&enabler->parent);
case LTTNG_UST_ABI_FILTER:
{
int ret;