+static const struct ec_config_schema ec_node_seq_subschema[] = {
+ {
+ .desc = "A child node which is part of the sequence.",
+ .type = EC_CONFIG_TYPE_NODE,
+ },
+};
+
+static const struct ec_config_schema ec_node_seq_schema[] = {
+ {
+ .key = "children",
+ .desc = "The list of children nodes, to be parsed in sequence.",
+ .type = EC_CONFIG_TYPE_LIST,
+ .subschema = ec_node_seq_subschema,
+ .subschema_len = EC_COUNT_OF(ec_node_seq_subschema),
+ },
+};
+
+static int ec_node_seq_set_config(struct ec_node *gen_node,
+ const struct ec_config *config)
+{
+ struct ec_node_seq *node = (struct ec_node_seq *)gen_node;
+ const struct ec_config *children = NULL, *child;
+ struct ec_node **table = NULL;
+ size_t n, i;
+
+ children = ec_config_dict_get(config, "children");
+ if (children == NULL) {
+ errno = EINVAL;
+ goto fail;
+ }
+
+ n = 0;
+ TAILQ_FOREACH(child, &children->list, next)
+ n++;
+
+ table = ec_malloc(n * sizeof(*table));
+ if (table == NULL)
+ goto fail;
+
+ n = 0;
+ TAILQ_FOREACH(child, &children->list, next) {
+ table[n] = ec_node_clone(child->node);
+ n++;
+ }
+
+ for (i = 0; i < node->len; i++)
+ ec_node_free(node->table[i]);
+ ec_free(node->table);
+ node->table = table;
+ node->len = n;
+
+ return 0;
+
+fail:
+ if (table != NULL) {
+ for (i = 0; i < n; i++)
+ ec_node_free(table[i]);
+ }
+ ec_free(table);
+ return -1;
+}
+