#include <babeltrace/compiler.h>
#include <babeltrace/plugin/sink-internal.h>
#include <babeltrace/plugin/component-internal.h>
+#include <babeltrace/plugin/notification/notification.h>
static
void bt_component_sink_destroy(struct bt_component *component)
struct bt_component_sink *sink = NULL;
if (!component || !notification) {
- ret = BT_COMPONENT_STATUS_INVAL;
+ ret = BT_COMPONENT_STATUS_INVALID;
goto end;
}
end:
return ret;
}
+
+enum bt_component_status bt_component_sink_register_notification_type(
+ struct bt_component *component, enum bt_notification_type type)
+{
+ enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+ struct bt_component_sink *sink = NULL;
+
+ if (!component) {
+ ret = BT_COMPONENT_STATUS_INVALID;
+ goto end;
+ }
+
+ if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) {
+ ret = BT_COMPONENT_STATUS_UNSUPPORTED;
+ goto end;
+ }
+
+ if (type <= BT_NOTIFICATION_TYPE_UNKNOWN ||
+ type >= BT_NOTIFICATION_TYPE_NR) {
+ ret = BT_COMPONENT_STATUS_INVALID;
+ goto end;
+ }
+ sink = container_of(component, struct bt_component_sink, parent);
+ if (type == BT_NOTIFICATION_TYPE_ALL) {
+ sink->registered_notifications_mask = ~(notification_mask_t) 0;
+ } else {
+ sink->registered_notifications_mask |=
+ (notification_mask_t) 1 << type;
+ }
+end:
+ return ret;
+}