From: Jérémie Galarneau Date: Thu, 25 Feb 2016 17:30:57 +0000 (-0500) Subject: Implement bt_component_sink_set_handle_notification_cb X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=952ebadee3ef6bb5a23d74e31e5a7aca40619515;p=deliverable%2Fbabeltrace.git Implement bt_component_sink_set_handle_notification_cb Signed-off-by: Jérémie Galarneau --- diff --git a/lib/plugin-system/sink.c b/lib/plugin-system/sink.c index c1d1df066..7067e06ed 100644 --- a/lib/plugin-system/sink.c +++ b/lib/plugin-system/sink.c @@ -142,3 +142,26 @@ enum bt_component_status bt_component_sink_register_notification_type( end: return ret; } + +enum bt_component_status bt_component_sink_set_handle_notification_cb( + struct bt_component *component, + bt_component_sink_handle_notification_cb handle_notification) +{ + 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; + } + + sink = container_of(component, struct bt_component_sink, parent); + sink->handle_notification = handle_notification; +end: + return ret; +}