Add bt_component_source_validate() implementation
[babeltrace.git] / lib / plugin-system / source.c
index 97992aac56ebdf60fbf38bd01c84b27e9388bdf3..5ec8e4007b63449ae77a76ef5760839fab077aef 100644 (file)
@@ -37,7 +37,31 @@ BT_HIDDEN
 enum bt_component_status bt_component_source_validate(
                struct bt_component *component)
 {
-       return BT_COMPONENT_STATUS_OK;
+       enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+       struct bt_component_source *source;
+
+       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_TYPE_SOURCE) {
+               ret = BT_COMPONENT_STATUS_INVALID;
+               goto end;
+       }
+
+       source = container_of(component, struct bt_component_source, parent);
+       if (source->init_iterator) {
+               ret = BT_COMPONENT_STATUS_INVALID;
+               goto end;
+       }
+end:
+       return ret;
 }
 
 BT_HIDDEN
This page took 0.02629 seconds and 4 git commands to generate.