Rename: field type -> field class
[babeltrace.git] / plugins / ctf / common / metadata / ctf-meta-validate.c
index 4898390710549b5b5e2f852a0c8583b170c664e2..16c6532e40d984cffba7fbc0c875bbade50c8edb 100644 (file)
@@ -29,8 +29,8 @@ static
 int validate_stream_class(struct ctf_stream_class *sc)
 {
        int ret = 0;
-       struct ctf_field_type_int *int_ft;
-       struct ctf_field_type *ft;
+       struct ctf_field_class_int *int_fc;
+       struct ctf_field_class *fc;
        bool has_total_size = false;
        bool has_content_size = false;
 
@@ -38,96 +38,96 @@ int validate_stream_class(struct ctf_stream_class *sc)
                goto end;
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->packet_context_ft, "timestamp_begin");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid packet context field type: "
-                               "`timestamp_begin` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->packet_context_fc, "timestamp_begin");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid packet context field class: "
+                               "`timestamp_begin` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`timestamp_begin` member is signed.");
                        goto invalid;
                }
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->packet_context_ft, "timestamp_end");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid packet context field type: "
-                               "`timestamp_end` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->packet_context_fc, "timestamp_end");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid packet context field class: "
+                               "`timestamp_end` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`timestamp_end` member is signed.");
                        goto invalid;
                }
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->packet_context_ft, "events_discarded");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid packet context field type: "
-                               "`events_discarded` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->packet_context_fc, "events_discarded");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid packet context field class: "
+                               "`events_discarded` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`events_discarded` member is signed.");
                        goto invalid;
                }
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->packet_context_ft, "packet_seq_num");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid packet context field type: "
-                               "`packet_seq_num` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->packet_context_fc, "packet_seq_num");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid packet context field class: "
+                               "`packet_seq_num` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`packet_seq_num` member is signed.");
                        goto invalid;
                }
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->packet_context_ft, "packet_size");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid packet context field type: "
-                               "`packet_size` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->packet_context_fc, "packet_size");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid packet context field class: "
+                               "`packet_size` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`packet_size` member is signed.");
                        goto invalid;
                }
@@ -135,20 +135,20 @@ int validate_stream_class(struct ctf_stream_class *sc)
                has_total_size = true;
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->packet_context_ft, "content_size");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid packet context field type: "
-                               "`content_size` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->packet_context_fc, "content_size");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid packet context field class: "
+                               "`content_size` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`content_size` member is signed.");
                        goto invalid;
                }
@@ -157,32 +157,32 @@ int validate_stream_class(struct ctf_stream_class *sc)
        }
 
        if (has_content_size && !has_total_size) {
-                       BT_LOGE_STR("Invalid packet context field type: "
+                       BT_LOGE_STR("Invalid packet context field class: "
                                "`content_size` member exists without "
                                "`packet_size` member.");
                        goto invalid;
        }
 
-       ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-               (void *) sc->event_header_ft, "id");
-       if (ft) {
-               if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                               ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                       BT_LOGE_STR("Invalid event header field type: "
-                               "`id` member is not an integer field type.");
+       fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+               (void *) sc->event_header_fc, "id");
+       if (fc) {
+               if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                               fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                       BT_LOGE_STR("Invalid event header field class: "
+                               "`id` member is not an integer field class.");
                        goto invalid;
                }
 
-               int_ft = (void *) ft;
+               int_fc = (void *) fc;
 
-               if (int_ft->is_signed) {
-                       BT_LOGE_STR("Invalid event header field type: "
+               if (int_fc->is_signed) {
+                       BT_LOGE_STR("Invalid event header field class: "
                                "`id` member is signed.");
                        goto invalid;
                }
        } else {
                if (sc->event_classes->len > 1) {
-                       BT_LOGE_STR("Invalid event header field type: "
+                       BT_LOGE_STR("Invalid event header field class: "
                                "missing `id` member as there's "
                                "more than one event class.");
                        goto invalid;
@@ -202,139 +202,139 @@ BT_HIDDEN
 int ctf_trace_class_validate(struct ctf_trace_class *ctf_tc)
 {
        int ret = 0;
-       struct ctf_field_type_int *int_ft;
+       struct ctf_field_class_int *int_fc;
        uint64_t i;
 
        if (!ctf_tc->is_translated) {
-               struct ctf_field_type *ft;
-
-               ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-                       (void *) ctf_tc->packet_header_ft, "magic");
-               if (ft) {
-                       struct ctf_named_field_type *named_ft =
-                               ctf_field_type_struct_borrow_member_by_index(
-                                       (void *) ctf_tc->packet_header_ft,
+               struct ctf_field_class *fc;
+
+               fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+                       (void *) ctf_tc->packet_header_fc, "magic");
+               if (fc) {
+                       struct ctf_named_field_class *named_fc =
+                               ctf_field_class_struct_borrow_member_by_index(
+                                       (void *) ctf_tc->packet_header_fc,
                                        0);
 
-                       if (named_ft->ft != ft) {
-                               BT_LOGE_STR("Invalid packet header field type: "
+                       if (named_fc->fc != fc) {
+                               BT_LOGE_STR("Invalid packet header field class: "
                                        "`magic` member is not the first member.");
                                goto invalid;
                        }
 
-                       if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                                       ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`magic` member is not an integer field type.");
+                       if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                                       fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`magic` member is not an integer field class.");
                                goto invalid;
                        }
 
-                       int_ft = (void *) ft;
+                       int_fc = (void *) fc;
 
-                       if (int_ft->is_signed) {
-                               BT_LOGE_STR("Invalid packet header field type: "
+                       if (int_fc->is_signed) {
+                               BT_LOGE_STR("Invalid packet header field class: "
                                        "`magic` member is signed.");
                                goto invalid;
                        }
 
-                       if (int_ft->base.size != 32) {
-                               BT_LOGE_STR("Invalid packet header field type: "
+                       if (int_fc->base.size != 32) {
+                               BT_LOGE_STR("Invalid packet header field class: "
                                        "`magic` member is not 32-bit.");
                                goto invalid;
                        }
                }
 
-               ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-                       (void *) ctf_tc->packet_header_ft, "stream_id");
-               if (ft) {
-                       if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                                       ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`stream_id` member is not an integer field type.");
+               fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+                       (void *) ctf_tc->packet_header_fc, "stream_id");
+               if (fc) {
+                       if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                                       fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`stream_id` member is not an integer field class.");
                                goto invalid;
                        }
 
-                       int_ft = (void *) ft;
+                       int_fc = (void *) fc;
 
-                       if (int_ft->is_signed) {
-                               BT_LOGE_STR("Invalid packet header field type: "
+                       if (int_fc->is_signed) {
+                               BT_LOGE_STR("Invalid packet header field class: "
                                        "`stream_id` member is signed.");
                                goto invalid;
                        }
                } else {
                        if (ctf_tc->stream_classes->len > 1) {
-                               BT_LOGE_STR("Invalid packet header field type: "
+                               BT_LOGE_STR("Invalid packet header field class: "
                                        "missing `stream_id` member as there's "
                                        "more than one stream class.");
                                goto invalid;
                        }
                }
 
-               ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-                       (void *) ctf_tc->packet_header_ft,
+               fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+                       (void *) ctf_tc->packet_header_fc,
                        "stream_instance_id");
-               if (ft) {
-                       if (ft->id != CTF_FIELD_TYPE_ID_INT &&
-                                       ft->id != CTF_FIELD_TYPE_ID_ENUM) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`stream_instance_id` member is not an integer field type.");
+               if (fc) {
+                       if (fc->id != CTF_FIELD_CLASS_ID_INT &&
+                                       fc->id != CTF_FIELD_CLASS_ID_ENUM) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`stream_instance_id` member is not an integer field class.");
                                goto invalid;
                        }
 
-                       int_ft = (void *) ft;
+                       int_fc = (void *) fc;
 
-                       if (int_ft->is_signed) {
-                               BT_LOGE_STR("Invalid packet header field type: "
+                       if (int_fc->is_signed) {
+                               BT_LOGE_STR("Invalid packet header field class: "
                                        "`stream_instance_id` member is signed.");
                                goto invalid;
                        }
                }
 
-               ft = ctf_field_type_struct_borrow_member_field_type_by_name(
-                       (void *) ctf_tc->packet_header_ft, "uuid");
-               if (ft) {
-                       struct ctf_field_type_array *array_ft = (void *) ft;
+               fc = ctf_field_class_struct_borrow_member_field_class_by_name(
+                       (void *) ctf_tc->packet_header_fc, "uuid");
+               if (fc) {
+                       struct ctf_field_class_array *array_fc = (void *) fc;
 
-                       if (ft->id != CTF_FIELD_TYPE_ID_ARRAY) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`uuid` member is not an array field type.");
+                       if (fc->id != CTF_FIELD_CLASS_ID_ARRAY) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`uuid` member is not an array field class.");
                                goto invalid;
                        }
 
-                       array_ft = (void *) ft;
+                       array_fc = (void *) fc;
 
-                       if (array_ft->length != 16) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`uuid` member is not a 16-element array field type.");
+                       if (array_fc->length != 16) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`uuid` member is not a 16-element array field class.");
                                goto invalid;
                        }
 
-                       if (array_ft->base.elem_ft->id != CTF_FIELD_TYPE_ID_INT) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`uuid` member's element field type is not "
-                                       "an integer field type.");
+                       if (array_fc->base.elem_fc->id != CTF_FIELD_CLASS_ID_INT) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`uuid` member's element field class is not "
+                                       "an integer field class.");
                                goto invalid;
                        }
 
-                       int_ft = (void *) array_ft->base.elem_ft;
+                       int_fc = (void *) array_fc->base.elem_fc;
 
-                       if (int_ft->is_signed) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`uuid` member's element field type "
-                                       "is a signed integer field type.");
+                       if (int_fc->is_signed) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`uuid` member's element field class "
+                                       "is a signed integer field class.");
                                goto invalid;
                        }
 
-                       if (int_ft->base.size != 8) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`uuid` member's element field type "
-                                       "is not an 8-bit integer field type.");
+                       if (int_fc->base.size != 8) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`uuid` member's element field class "
+                                       "is not an 8-bit integer field class.");
                                goto invalid;
                        }
 
-                       if (int_ft->base.base.alignment != 8) {
-                               BT_LOGE_STR("Invalid packet header field type: "
-                                       "`uuid` member's element field type's "
+                       if (int_fc->base.base.alignment != 8) {
+                               BT_LOGE_STR("Invalid packet header field class: "
+                                       "`uuid` member's element field class's "
                                        "alignment is not 8.");
                                goto invalid;
                        }
This page took 0.036621 seconds and 4 git commands to generate.