They only "validate" what we can assert anyway.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
BT_HIDDEN
void bt_component_filter_destroy(struct bt_component *component);
-/**
- * Validate a filter component.
- *
- * @param component Filter component instance to validate
- * @returns One of #bt_component_status
- */
-BT_HIDDEN
-enum bt_component_status bt_component_filter_validate(
- struct bt_component *component);
-
#endif /* BABELTRACE_COMPONENT_FILTER_INTERNAL_H */
BT_HIDDEN
void bt_component_sink_destroy(struct bt_component *component);
-/**
- * Validate a sink component.
- *
- * @param component Sink component instance to validate
- * @returns One of #bt_component_status
- */
-BT_HIDDEN
-enum bt_component_status bt_component_sink_validate(
- struct bt_component *component);
-
/**
* Process one event, consuming from sources as needed.
*
BT_HIDDEN
void bt_component_source_destroy(struct bt_component *component);
-/**
- * Validate a source component.
- *
- * @param component Source component instance to validate
- * @returns One of #bt_component_status
- */
-BT_HIDDEN
-enum bt_component_status bt_component_source_validate(
- struct bt_component *component);
-
#endif /* BABELTRACE_COMPONENT_SOURCE_INTERNAL_H */
const enum bt_notification_type *notification_types,
struct bt_connection *connection);
-/**
- * Validate a notification iterator.
- *
- * @param iterator Notification iterator instance
- * @returns One of #bt_component_status values
- */
-BT_HIDDEN
-enum bt_notification_iterator_status bt_notification_iterator_validate(
- struct bt_notification_iterator *iterator);
-
BT_HIDDEN
void bt_notification_iterator_finalize(
struct bt_notification_iterator *iterator);
[BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_destroy,
};
-static
-enum bt_component_status (* const component_validation_funcs[])(
- struct bt_component *) = {
- [BT_COMPONENT_CLASS_TYPE_SOURCE] = bt_component_source_validate,
- [BT_COMPONENT_CLASS_TYPE_SINK] = bt_component_sink_validate,
- [BT_COMPONENT_CLASS_TYPE_FILTER] = bt_component_filter_validate,
-};
-
static
void bt_component_destroy(struct bt_object *obj)
{
}
}
- ret = component_validation_funcs[type](component);
- if (ret != BT_COMPONENT_STATUS_OK) {
- BT_LOGW("Component is invalid: status=%s",
- bt_component_status_string(ret));
- BT_PUT(component);
- goto end;
- }
-
BT_LOGD_STR("Freezing component class.");
bt_component_class_freeze(component->class);
BT_LOGD("Created component from component class: "
struct bt_private_connection *private_connection,
const enum bt_notification_type *notification_types)
{
- enum bt_notification_iterator_status ret_iterator;
enum bt_component_class_type upstream_comp_class_type;
struct bt_notification_iterator *iterator = NULL;
struct bt_port *upstream_port = NULL;
}
}
- ret_iterator = bt_notification_iterator_validate(iterator);
- if (ret_iterator != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
- BT_LOGW("Notification iterator is invalid: status=%s",
- bt_notification_iterator_status_string(ret_iterator));
- goto error;
- }
-
g_ptr_array_add(connection->iterators, iterator);
BT_LOGD("Created notification iterator from connection: "
"conn-addr=%p, upstream-port-addr=%p, "
return filter ? &filter->parent : NULL;
}
-BT_HIDDEN
-enum bt_component_status bt_component_filter_validate(
- struct bt_component *component)
-{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
- if (!component) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (!component->class) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- /* Enforce iterator limits. */
-end:
- return ret;
-}
-
int64_t bt_component_filter_get_input_port_count(
struct bt_component *component)
{
return iterator;
}
-BT_HIDDEN
-enum bt_notification_iterator_status bt_notification_iterator_validate(
- struct bt_notification_iterator *iterator)
-{
- enum bt_notification_iterator_status ret =
- BT_NOTIFICATION_ITERATOR_STATUS_OK;
-
- if (!iterator) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
- goto end;
- }
-end:
- return ret;
-}
-
void *bt_private_notification_iterator_get_user_data(
struct bt_private_notification_iterator *private_iterator)
{
#include <babeltrace/graph/component-internal.h>
#include <babeltrace/graph/notification.h>
-BT_HIDDEN
-enum bt_component_status bt_component_sink_validate(
- struct bt_component *component)
-{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
- if (!component) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (!component->class) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (component->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-end:
- return ret;
-}
-
BT_HIDDEN
void bt_component_sink_destroy(struct bt_component *component)
{
#include <babeltrace/graph/notification-iterator.h>
#include <babeltrace/graph/notification-iterator-internal.h>
-BT_HIDDEN
-enum bt_component_status bt_component_source_validate(
- struct bt_component *component)
-{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
-
- if (!component) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (!component->class) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
- if (component->class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
- ret = BT_COMPONENT_STATUS_INVALID;
- goto end;
- }
-
-end:
- return ret;
-}
-
BT_HIDDEN
void bt_component_source_destroy(struct bt_component *component)
{