+ return "(unknown)";
+ }
+}
+
+static inline
+enum bt_graph_status bt_graph_configure(struct bt_graph *graph)
+{
+ enum bt_graph_status status = BT_GRAPH_STATUS_OK;
+ uint64_t i;
+
+ BT_ASSERT(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY);
+
+ if (likely(graph->config_state ==
+ BT_GRAPH_CONFIGURATION_STATE_CONFIGURED)) {
+ goto end;
+ }
+
+#ifdef BT_ASSERT_PRE
+ BT_ASSERT_PRE(graph->has_sink, "Graph has no sink component: %!+g", graph);
+#endif
+
+ graph->config_state = BT_GRAPH_CONFIGURATION_STATE_PARTIALLY_CONFIGURED;
+
+ for (i = 0; i < graph->components->len; i++) {
+ struct bt_component *comp = graph->components->pdata[i];
+ struct bt_component_sink *comp_sink = (void *) comp;
+ struct bt_component_class_sink *comp_cls_sink =
+ (void *) comp->class;
+
+ if (comp->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
+ continue;
+ }
+
+ if (comp_sink->graph_is_configured_method_called) {
+ continue;
+ }
+
+ if (comp_cls_sink->methods.graph_is_configured) {
+ enum bt_self_component_status comp_status;
+
+#ifdef BT_LIB_LOGD
+ BT_LIB_LOGD("Calling user's \"graph is configured\" method: "
+ "%![graph-]+g, %![comp-]+c",
+ graph, comp);
+#endif
+
+ comp_status = comp_cls_sink->methods.graph_is_configured(
+ (void *) comp_sink);
+
+#ifdef BT_LIB_LOGD
+ BT_LIB_LOGD("User method returned: status=%s",
+ bt_self_component_status_string(comp_status));