+ ubt->atype = atype;
+ (*iter_output)++;
+ break;
+ }
+ case atype_sequence_nestable:
+ {
+ struct ustctl_field *uf = &fields[*iter_output];
+ struct ustctl_type *ut = &uf->type;
+
+ if (field_name) {
+ strncpy(uf->name, field_name, LTTNG_UST_SYM_NAME_LEN);
+ uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ } else {
+ uf->name[0] = '\0';
+ }
+ ut->atype = ustctl_atype_sequence_nestable;
+ strncpy(ut->u.sequence_nestable.length_name,
+ lt->u.sequence_nestable.length_name,
+ LTTNG_UST_SYM_NAME_LEN);
+ ut->u.sequence_nestable.length_name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ ut->u.sequence_nestable.alignment = lt->u.sequence_nestable.alignment;
+ (*iter_output)++;
+
+ ret = serialize_one_type(session, fields, iter_output, NULL,
+ lt->u.sequence_nestable.elem_type);
+ if (ret)
+ return -EINVAL;
+ break;
+ }
+ case atype_dynamic:
+ {
+ ret = serialize_dynamic_type(session, fields, iter_output,
+ field_name);
+ if (ret)
+ return -EINVAL;
+ break;
+ }
+ case atype_struct:
+ {
+ struct ustctl_field *uf = &fields[*iter_output];
+
+ if (field_name) {
+ strncpy(uf->name, field_name, LTTNG_UST_SYM_NAME_LEN);
+ uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ } else {
+ uf->name[0] = '\0';
+ }
+ uf->type.atype = ustctl_atype_struct;
+ uf->type.u.legacy._struct.nr_fields = lt->u.legacy._struct.nr_fields;
+ (*iter_output)++;
+
+ ret = serialize_fields(session, fields, iter_output,
+ lt->u.legacy._struct.nr_fields,
+ lt->u.legacy._struct.fields);
+ if (ret)
+ return -EINVAL;
+ break;
+ }
+ case atype_struct_nestable:
+ {
+ struct ustctl_field *uf = &fields[*iter_output];
+
+ if (field_name) {
+ strncpy(uf->name, field_name, LTTNG_UST_SYM_NAME_LEN);
+ uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ } else {
+ uf->name[0] = '\0';
+ }
+ uf->type.atype = ustctl_atype_struct_nestable;
+ uf->type.u.struct_nestable.nr_fields = lt->u.struct_nestable.nr_fields;
+ uf->type.u.struct_nestable.alignment = lt->u.struct_nestable.alignment;
+ (*iter_output)++;
+
+ ret = serialize_fields(session, fields, iter_output,
+ lt->u.struct_nestable.nr_fields,
+ lt->u.struct_nestable.fields);
+ if (ret)
+ return -EINVAL;
+ break;
+ }
+ case atype_enum_nestable:
+ {
+ struct ustctl_field *uf = &fields[*iter_output];
+ struct ustctl_type *ut = &uf->type;
+
+ if (field_name) {
+ strncpy(uf->name, field_name, LTTNG_UST_SYM_NAME_LEN);
+ uf->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ } else {
+ uf->name[0] = '\0';
+ }
+ strncpy(ut->u.enum_nestable.name, lt->u.enum_nestable.desc->name,
+ LTTNG_UST_SYM_NAME_LEN);
+ ut->u.enum_nestable.name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
+ ut->atype = ustctl_atype_enum_nestable;
+ (*iter_output)++;
+
+ ret = serialize_one_type(session, fields, iter_output, NULL,
+ lt->u.enum_nestable.container_type);
+ if (ret)
+ return -EINVAL;
+ if (session) {
+ const struct lttng_enum *_enum;
+
+ _enum = lttng_ust_enum_get_from_desc(session, lt->u.enum_nestable.desc);
+ if (!_enum)
+ return -EINVAL;
+ ut->u.enum_nestable.id = _enum->id;
+ } else {
+ ut->u.enum_nestable.id = -1ULL;
+ }