lib: rename "begin" to "beginning" when used as a noun
[babeltrace.git] / plugins / ctf / common / notif-iter / notif-iter.c
index 259bb5cdc5f4d6b11c85403edaa04cff865390c1..501c3004dcbabd0e2a5f9d04506ac66cb2793107 100644 (file)
@@ -56,7 +56,7 @@ struct stack_entry {
         *
         * Field is borrowed.
         */
-       struct bt_private_field *base;
+       struct bt_field *base;
 
        /* Index of next field to set */
        size_t index;
@@ -111,7 +111,7 @@ struct bt_notif_iter {
         * This is set by read_dscope_begin_state() and contains the
         * value of one of the pointers in `dscopes` below.
         */
-       struct bt_private_field *cur_dscope_field;
+       struct bt_field *cur_dscope_field;
 
        /*
         * True if we're done filling a string field from a text
@@ -127,34 +127,34 @@ struct bt_notif_iter {
        } meta;
 
        /* Current packet header field wrapper (NULL if not created yet) */
-       struct bt_private_packet_header_field *packet_header_field;
+       struct bt_packet_header_field *packet_header_field;
 
        /* Current packet header field wrapper (NULL if not created yet) */
-       struct bt_private_packet_context_field *packet_context_field;
+       struct bt_packet_context_field *packet_context_field;
 
        /* Current event header field (NULL if not created yet) */
-       struct bt_private_event_header_field *event_header_field;
+       struct bt_event_header_field *event_header_field;
 
        /* Current packet (NULL if not created yet) */
-       struct bt_private_packet *packet;
+       struct bt_packet *packet;
 
        /* Current stream (NULL if not set yet) */
-       struct bt_private_stream *stream;
+       struct bt_stream *stream;
 
        /* Current event (NULL if not created yet) */
-       struct bt_private_event *event;
+       struct bt_event *event;
 
        /* Current event notification (NULL if not created yet) */
-       struct bt_private_notification *event_notif;
+       struct bt_notification *event_notif;
 
        /* Database of current dynamic scopes */
        struct {
-               struct bt_private_field *trace_packet_header;
-               struct bt_private_field *stream_packet_context;
-               struct bt_private_field *event_header;
-               struct bt_private_field *event_common_context;
-               struct bt_private_field *event_spec_context;
-               struct bt_private_field *event_payload;
+               struct bt_field *trace_packet_header;
+               struct bt_field *stream_packet_context;
+               struct bt_field *event_header;
+               struct bt_field *event_common_context;
+               struct bt_field *event_spec_context;
+               struct bt_field *event_payload;
        } dscopes;
 
        /* Current state */
@@ -325,7 +325,7 @@ void stack_destroy(struct stack *stack)
 }
 
 static
-void stack_push(struct stack *stack, struct bt_private_field *base)
+void stack_push(struct stack *stack, struct bt_field *base)
 {
        struct stack_entry *entry;
 
@@ -520,7 +520,7 @@ enum bt_notif_iter_status read_dscope_begin_state(
                struct bt_notif_iter *notit,
                struct ctf_field_class *dscope_fc,
                enum state done_state, enum state continue_state,
-               struct bt_private_field *dscope_field)
+               struct bt_field *dscope_field)
 {
        enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
        enum bt_bfcr_status bfcr_status;
@@ -619,7 +619,7 @@ void release_event_dscopes(struct bt_notif_iter *notit)
        notit->dscopes.event_header = NULL;
 
        if (notit->event_header_field) {
-               bt_private_event_header_field_release(notit->event_header_field);
+               bt_event_header_field_release(notit->event_header_field);
                notit->event_header_field = NULL;
        }
 
@@ -634,14 +634,14 @@ void release_all_dscopes(struct bt_notif_iter *notit)
        notit->dscopes.trace_packet_header = NULL;
 
        if (notit->packet_header_field) {
-               bt_private_packet_header_field_release(notit->packet_header_field);
+               bt_packet_header_field_release(notit->packet_header_field);
                notit->packet_header_field = NULL;
        }
 
        notit->dscopes.stream_packet_context = NULL;
 
        if (notit->packet_context_field) {
-               bt_private_packet_context_field_release(notit->packet_context_field);
+               bt_packet_context_field_release(notit->packet_context_field);
                notit->packet_context_field = NULL;
        }
 
@@ -661,7 +661,7 @@ enum bt_notif_iter_status read_packet_header_begin_state(
                goto end;
        }
 
-       /* Packet header class is common to the whole trace. */
+       /* Packet header class is common to the whole trace class. */
        packet_header_fc = notit->meta.tc->packet_header_fc;
        if (!packet_header_fc) {
                notit->state = STATE_AFTER_TRACE_PACKET_HEADER;
@@ -672,8 +672,8 @@ enum bt_notif_iter_status read_packet_header_begin_state(
 
        if (packet_header_fc->in_ir) {
                /*
-                * Create free packet header field from trace. This
-                * field is going to be moved to the packet once we
+                * Create free packet header field from trace class.
+                * This field is going to be moved to the packet once we
                 * create it. We cannot create the packet now because:
                 *
                 * 1. A packet is created from a stream.
@@ -682,16 +682,16 @@ enum bt_notif_iter_status read_packet_header_begin_state(
                 *    the ID of the stream class to select.
                 */
                notit->packet_header_field =
-                       bt_private_packet_header_field_create(
+                       bt_packet_header_field_create(
                                notit->meta.tc->ir_tc);
                if (!notit->packet_header_field) {
-                       BT_LOGE_STR("Cannot create packet header field wrapper from trace.");
+                       BT_LOGE_STR("Cannot create packet header field wrapper from trace class.");
                        ret = BT_NOTIF_ITER_STATUS_ERROR;
                        goto end;
                }
 
                notit->dscopes.trace_packet_header =
-                       bt_private_packet_header_field_borrow_field(
+                       bt_packet_header_field_borrow_field(
                                notit->packet_header_field);
                BT_ASSERT(notit->dscopes.trace_packet_header);
        }
@@ -700,20 +700,17 @@ enum bt_notif_iter_status read_packet_header_begin_state(
        notit->cur_event_class_id = -1;
        notit->cur_data_stream_id = -1;
        BT_LOGV("Decoding packet header field:"
-               "notit-addr=%p, trace-addr=%p, trace-name=\"%s\", fc-addr=%p",
-               notit, notit->meta.tc,
-               notit->meta.tc->name->str, packet_header_fc);
+               "notit-addr=%p, trace-class-addr=%p, fc-addr=%p",
+               notit, notit->meta.tc, packet_header_fc);
        ret = read_dscope_begin_state(notit, packet_header_fc,
                STATE_AFTER_TRACE_PACKET_HEADER,
                STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE,
                notit->dscopes.trace_packet_header);
        if (ret < 0) {
                BT_LOGW("Cannot decode packet header field: "
-                       "notit-addr=%p, trace-addr=%p, "
-                       "trace-name=\"%s\", fc-addr=%p",
-                       notit, notit->meta.tc,
-                       notit->meta.tc->name->str,
-                       packet_header_fc);
+                       "notit-addr=%p, trace-class-addr=%p, "
+                       "fc-addr=%p",
+                       notit, notit->meta.tc, packet_header_fc);
        }
 
 end:
@@ -742,25 +739,22 @@ enum bt_notif_iter_status set_current_stream_class(struct bt_notif_iter *notit)
                if (notit->meta.tc->stream_classes->len != 1) {
                        BT_LOGW("Need exactly one stream class since there's "
                                "no stream class ID field: "
-                               "notit-addr=%p, trace-name=\"%s\"",
-                               notit, notit->meta.tc->name->str);
+                               "notit-addr=%p", notit);
                        status = BT_NOTIF_ITER_STATUS_ERROR;
                        goto end;
                }
 
                new_stream_class = notit->meta.tc->stream_classes->pdata[0];
                notit->cur_stream_class_id = new_stream_class->id;
-               goto end;
        }
 
        new_stream_class = ctf_trace_class_borrow_stream_class_by_id(
                notit->meta.tc, notit->cur_stream_class_id);
        if (!new_stream_class) {
-               BT_LOGW("No stream class with ID of stream class ID to use in trace: "
+               BT_LOGW("No stream class with ID of stream class ID to use in trace class: "
                        "notit-addr=%p, stream-class-id=%" PRIu64 ", "
-                       "trace-addr=%p, trace-name=\"%s\"",
-                       notit, notit->cur_stream_class_id, notit->meta.tc,
-                       notit->meta.tc->name->str);
+                       "trace-class-addr=%p",
+                       notit, notit->cur_stream_class_id, notit->meta.tc);
                status = BT_NOTIF_ITER_STATUS_ERROR;
                goto end;
        }
@@ -772,13 +766,12 @@ enum bt_notif_iter_status set_current_stream_class(struct bt_notif_iter *notit)
                                "prev-stream-class-id=%" PRId64 ", "
                                "next-stream-class-addr=%p, "
                                "next-stream-class-id=%" PRId64 ", "
-                               "trace-addr=%p, trace-name=\"%s\"",
+                               "trace-addr=%p",
                                notit, notit->meta.sc,
                                notit->meta.sc->id,
                                new_stream_class,
                                new_stream_class->id,
-                               notit->meta.tc,
-                               notit->meta.tc->name->str);
+                               notit->meta.tc);
                        status = BT_NOTIF_ITER_STATUS_ERROR;
                        goto end;
                }
@@ -799,15 +792,16 @@ static inline
 enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit)
 {
        enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct bt_private_stream *stream = NULL;
+       struct bt_stream *stream = NULL;
 
        BT_LOGV("Calling user function (get stream): notit-addr=%p, "
                "stream-class-addr=%p, stream-class-id=%" PRId64,
                notit, notit->meta.sc,
                notit->meta.sc->id);
-       stream = bt_object_get_ref(notit->medium.medops.borrow_stream(
+       stream = notit->medium.medops.borrow_stream(
                notit->meta.sc->ir_sc, notit->cur_data_stream_id,
-               notit->medium.data));
+               notit->medium.data);
+       bt_object_get_ref(stream);
        BT_LOGV("User function returned: stream-addr=%p", stream);
        if (!stream) {
                BT_LOGW_STR("User function failed to return a stream object "
@@ -834,7 +828,7 @@ static inline
 enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit)
 {
        enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct bt_private_packet *packet = NULL;
+       struct bt_packet *packet = NULL;
 
        BT_LOGV("Creating packet for packet notification: "
                "notit-addr=%p", notit);
@@ -847,7 +841,7 @@ enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit)
 
        /* Create packet */
        BT_ASSERT(notit->stream);
-       packet = bt_private_packet_create(notit->stream);
+       packet = bt_packet_create(notit->stream);
        if (!packet) {
                BT_LOGE("Cannot create packet from stream: "
                        "notit-addr=%p, stream-addr=%p, "
@@ -918,7 +912,7 @@ enum bt_notif_iter_status read_packet_context_begin_state(
                 * (bt_notif_iter_borrow_packet_header_context_fields()).
                 */
                notit->packet_context_field =
-                       bt_private_packet_context_field_create(
+                       bt_packet_context_field_create(
                                notit->meta.sc->ir_sc);
                if (!notit->packet_context_field) {
                        BT_LOGE_STR("Cannot create packet context field wrapper from stream class.");
@@ -927,7 +921,7 @@ enum bt_notif_iter_status read_packet_context_begin_state(
                }
 
                notit->dscopes.stream_packet_context =
-                       bt_private_packet_context_field_borrow_field(
+                       bt_packet_context_field_borrow_field(
                                notit->packet_context_field);
                BT_ASSERT(notit->dscopes.stream_packet_context);
        }
@@ -1096,16 +1090,16 @@ enum bt_notif_iter_status read_event_header_begin_state(
        if (event_header_fc->in_ir) {
                BT_ASSERT(!notit->event_header_field);
                notit->event_header_field =
-                       bt_private_event_header_field_create(
+                       bt_event_header_field_create(
                                notit->meta.sc->ir_sc);
                if (!notit->event_header_field) {
-                       BT_LOGE_STR("Cannot create event header field wrapper from trace.");
+                       BT_LOGE_STR("Cannot create event header field wrapper from trace class.");
                        status = BT_NOTIF_ITER_STATUS_ERROR;
                        goto end;
                }
 
                notit->dscopes.event_header =
-                       bt_private_event_header_field_borrow_field(
+                       bt_event_header_field_borrow_field(
                                notit->event_header_field);
                BT_ASSERT(notit->dscopes.event_header);
        }
@@ -1157,15 +1151,13 @@ enum bt_notif_iter_status set_current_event_class(struct bt_notif_iter *notit)
                if (notit->meta.sc->event_classes->len != 1) {
                        BT_LOGW("Need exactly one event class since there's "
                                "no event class ID field: "
-                               "notit-addr=%p, trace-name=\"%s\"",
-                               notit, notit->meta.tc->name->str);
+                               "notit-addr=%p", notit);
                        status = BT_NOTIF_ITER_STATUS_ERROR;
                        goto end;
                }
 
                new_event_class = notit->meta.sc->event_classes->pdata[0];
                notit->cur_event_class_id = new_event_class->id;
-               goto end;
        }
 
        new_event_class = ctf_stream_class_borrow_event_class_by_id(
@@ -1174,9 +1166,9 @@ enum bt_notif_iter_status set_current_event_class(struct bt_notif_iter *notit)
                BT_LOGW("No event class with ID of event class ID to use in stream class: "
                        "notit-addr=%p, stream-class-id=%" PRIu64 ", "
                        "event-class-id=%" PRIu64 ", "
-                       "trace-addr=%p, trace-name=\"%s\"",
+                       "trace-class-addr=%p",
                        notit, notit->meta.sc->id, notit->cur_event_class_id,
-                       notit->meta.tc, notit->meta.tc->name->str);
+                       notit->meta.tc);
                status = BT_NOTIF_ITER_STATUS_ERROR;
                goto end;
        }
@@ -1198,7 +1190,7 @@ enum bt_notif_iter_status set_current_event_notification(
                struct bt_notif_iter *notit)
 {
        enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
-       struct bt_private_notification *notif = NULL;
+       struct bt_notification *notif = NULL;
 
        BT_ASSERT(notit->meta.ec);
        BT_ASSERT(notit->packet);
@@ -1208,7 +1200,7 @@ enum bt_notif_iter_status set_current_event_notification(
                notit->meta.ec->name->str,
                notit->packet);
        BT_ASSERT(notit->notif_iter);
-       notif = bt_private_notification_event_create(notit->notif_iter,
+       notif = bt_notification_event_create(notit->notif_iter,
                notit->meta.ec->ir_ec, notit->packet);
        if (!notif) {
                BT_LOGE("Cannot create event notification: "
@@ -1247,7 +1239,7 @@ enum bt_notif_iter_status after_event_header_state(
                goto end;
        }
 
-       notit->event = bt_private_notification_event_borrow_event(
+       notit->event = bt_notification_event_borrow_event(
                notit->event_notif);
        BT_ASSERT(notit->event);
 
@@ -1255,7 +1247,7 @@ enum bt_notif_iter_status after_event_header_state(
                int ret;
 
                BT_ASSERT(notit->event);
-               ret = bt_private_event_move_header_field(notit->event,
+               ret = bt_event_move_header_field(notit->event,
                        notit->event_header_field);
                if (ret) {
                        status = BT_NOTIF_ITER_STATUS_ERROR;
@@ -1269,7 +1261,7 @@ enum bt_notif_iter_status after_event_header_state(
                 * the same value as the event header field within
                 * notit->event.
                 */
-               BT_ASSERT(bt_private_event_borrow_header_field(
+               BT_ASSERT(bt_event_borrow_header_field(
                        notit->event) == notit->dscopes.event_header);
        }
 
@@ -1295,7 +1287,7 @@ enum bt_notif_iter_status read_event_common_context_begin_state(
        if (event_common_context_fc->in_ir) {
                BT_ASSERT(!notit->dscopes.event_common_context);
                notit->dscopes.event_common_context =
-                       bt_private_event_borrow_common_context_field(
+                       bt_event_borrow_common_context_field(
                                notit->event);
                BT_ASSERT(notit->dscopes.event_common_context);
        }
@@ -1348,7 +1340,7 @@ enum bt_notif_iter_status read_event_spec_context_begin_state(
        if (event_spec_context_fc->in_ir) {
                BT_ASSERT(!notit->dscopes.event_spec_context);
                notit->dscopes.event_spec_context =
-                       bt_private_event_borrow_specific_context_field(
+                       bt_event_borrow_specific_context_field(
                                notit->event);
                BT_ASSERT(notit->dscopes.event_spec_context);
        }
@@ -1404,7 +1396,7 @@ enum bt_notif_iter_status read_event_payload_begin_state(
        if (event_payload_fc->in_ir) {
                BT_ASSERT(!notit->dscopes.event_payload);
                notit->dscopes.event_payload =
-                       bt_private_event_borrow_payload_field(
+                       bt_event_borrow_payload_field(
                                notit->event);
                BT_ASSERT(notit->dscopes.event_payload);
        }
@@ -1586,17 +1578,17 @@ void bt_notif_iter_reset(struct bt_notif_iter *notit)
        notit->cur_dscope_field = NULL;
 
        if (notit->packet_header_field) {
-               bt_private_packet_header_field_release(notit->packet_header_field);
+               bt_packet_header_field_release(notit->packet_header_field);
                notit->packet_header_field = NULL;
        }
 
        if (notit->packet_context_field) {
-               bt_private_packet_context_field_release(notit->packet_context_field);
+               bt_packet_context_field_release(notit->packet_context_field);
                notit->packet_context_field = NULL;
        }
 
        if (notit->event_header_field) {
-               bt_private_event_header_field_release(notit->event_header_field);
+               bt_event_header_field_release(notit->event_header_field);
                notit->event_header_field = NULL;
        }
 
@@ -1679,44 +1671,41 @@ end:
 }
 
 static
-struct bt_private_field *borrow_next_field(struct bt_notif_iter *notit)
+struct bt_field *borrow_next_field(struct bt_notif_iter *notit)
 {
-       struct bt_private_field *next_field = NULL;
-       struct bt_private_field *base_field;
-       struct bt_private_field_class *base_fc;
+       struct bt_field *next_field = NULL;
+       struct bt_field *base_field;
+       const struct bt_field_class *base_fc;
        size_t index;
 
        BT_ASSERT(!stack_empty(notit->stack));
        index = stack_top(notit->stack)->index;
        base_field = stack_top(notit->stack)->base;
        BT_ASSERT(base_field);
-       base_fc = bt_private_field_borrow_class(base_field);
+       base_fc = bt_field_borrow_class_const(base_field);
        BT_ASSERT(base_fc);
 
-       switch (bt_field_class_get_type(
-               bt_private_field_class_borrow_field_class(base_fc))) {
+       switch (bt_field_class_get_type(base_fc)) {
        case BT_FIELD_CLASS_TYPE_STRUCTURE:
        {
                BT_ASSERT(index <
                        bt_field_class_structure_get_member_count(
-                               bt_private_field_class_borrow_field_class(
-                                       bt_private_field_borrow_class(
-                                               base_field))));
+                               bt_field_borrow_class_const(
+                                               base_field)));
                next_field =
-                       bt_private_field_structure_borrow_member_field_by_index(
+                       bt_field_structure_borrow_member_field_by_index(
                                base_field, index);
                break;
        }
        case BT_FIELD_CLASS_TYPE_STATIC_ARRAY:
        case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY:
-               BT_ASSERT(index < bt_field_array_get_length(
-                       bt_private_field_borrow_field(base_field)));
-               next_field = bt_private_field_array_borrow_element_field_by_index(
+               BT_ASSERT(index < bt_field_array_get_length(base_field));
+               next_field = bt_field_array_borrow_element_field_by_index(
                        base_field, index);
                break;
        case BT_FIELD_CLASS_TYPE_VARIANT:
                BT_ASSERT(index == 0);
-               next_field = bt_private_field_variant_borrow_selected_option_field(
+               next_field = bt_field_variant_borrow_selected_option_field(
                        base_field);
                break;
        default:
@@ -1775,7 +1764,7 @@ enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
 {
        struct bt_notif_iter *notit = data;
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       struct bt_private_field *field = NULL;
+       struct bt_field *field = NULL;
        struct ctf_field_class_int *int_fc = (void *) fc;
 
        BT_LOGV("Unsigned integer function called from BFCR: "
@@ -1844,13 +1833,12 @@ update_def_clock:
 
        field = borrow_next_field(notit);
        BT_ASSERT(field);
-       BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(
-               bt_private_field_borrow_field(field)) ==
-               BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER ||
-               bt_field_get_class_type(bt_private_field_borrow_field(field)) ==
-               BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION);
-       bt_private_field_unsigned_integer_set_value(field, value);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER ||
+                 bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION);
+       bt_field_unsigned_integer_set_value(field, value);
        stack_top(notit->stack)->index++;
 
 end:
@@ -1864,7 +1852,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
        int ret;
        struct bt_notif_iter *notit = data;
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       struct bt_private_field *string_field = NULL;
+       struct bt_field *string_field = NULL;
        struct ctf_field_class_int *int_fc = (void *) fc;
        char str[2] = {'\0', '\0'};
 
@@ -1890,13 +1878,12 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
        }
 
        string_field = stack_top(notit->stack)->base;
-       BT_ASSERT(bt_field_get_class_type(
-               bt_private_field_borrow_field(string_field)) ==
-               BT_FIELD_CLASS_TYPE_STRING);
+       BT_ASSERT(bt_field_get_class_type(string_field) ==
+                 BT_FIELD_CLASS_TYPE_STRING);
 
        /* Append character */
        str[0] = (char) value;
-       ret = bt_private_field_string_append_with_length(string_field, str, 1);
+       ret = bt_field_string_append_with_length(string_field, str, 1);
        if (ret) {
                BT_LOGE("Cannot append character to string field's value: "
                        "notit-addr=%p, field-addr=%p, ret=%d",
@@ -1914,7 +1901,7 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
                struct ctf_field_class *fc, void *data)
 {
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       struct bt_private_field *field = NULL;
+       struct bt_field *field = NULL;
        struct bt_notif_iter *notit = data;
        struct ctf_field_class_int *int_fc = (void *) fc;
 
@@ -1935,13 +1922,12 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
 
        field = borrow_next_field(notit);
        BT_ASSERT(field);
-       BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(
-               bt_private_field_borrow_field(field)) ==
-               BT_FIELD_CLASS_TYPE_SIGNED_INTEGER ||
-               bt_field_get_class_type(bt_private_field_borrow_field(field)) ==
-               BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
-       bt_private_field_signed_integer_set_value(field, value);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_SIGNED_INTEGER ||
+                 bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
+       bt_field_signed_integer_set_value(field, value);
        stack_top(notit->stack)->index++;
 
 end:
@@ -1953,7 +1939,7 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value,
                struct ctf_field_class *fc, void *data)
 {
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       struct bt_private_field *field = NULL;
+       struct bt_field *field = NULL;
        struct bt_notif_iter *notit = data;
 
        BT_LOGV("Floating point number function called from BFCR: "
@@ -1963,11 +1949,10 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value,
        BT_ASSERT(fc->in_ir);
        field = borrow_next_field(notit);
        BT_ASSERT(field);
-       BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(
-               bt_private_field_borrow_field(field)) ==
-               BT_FIELD_CLASS_TYPE_REAL);
-       bt_private_field_real_set_value(field, value);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_REAL);
+       bt_field_real_set_value(field, value);
        stack_top(notit->stack)->index++;
        return status;
 }
@@ -1976,7 +1961,7 @@ static
 enum bt_bfcr_status bfcr_string_begin_cb(
                struct ctf_field_class *fc, void *data)
 {
-       struct bt_private_field *field = NULL;
+       struct bt_field *field = NULL;
        struct bt_notif_iter *notit = data;
        int ret;
 
@@ -1988,11 +1973,10 @@ enum bt_bfcr_status bfcr_string_begin_cb(
        BT_ASSERT(fc->in_ir);
        field = borrow_next_field(notit);
        BT_ASSERT(field);
-       BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc);
-       BT_ASSERT(bt_field_get_class_type(
-               bt_private_field_borrow_field(field)) ==
-               BT_FIELD_CLASS_TYPE_STRING);
-       ret = bt_private_field_string_clear(field);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_get_class_type(field) ==
+                 BT_FIELD_CLASS_TYPE_STRING);
+       ret = bt_field_string_clear(field);
        BT_ASSERT(ret == 0);
 
        /*
@@ -2009,7 +1993,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value,
                size_t len, struct ctf_field_class *fc, void *data)
 {
        enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
-       struct bt_private_field *field = NULL;
+       struct bt_field *field = NULL;
        struct bt_notif_iter *notit = data;
        int ret;
 
@@ -2023,7 +2007,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value,
        BT_ASSERT(field);
 
        /* Append current substring */
-       ret = bt_private_field_string_append_with_length(field, value, len);
+       ret = bt_field_string_append_with_length(field, value, len);
        if (ret) {
                BT_LOGE("Cannot append substring to string field's value: "
                        "notit-addr=%p, field-addr=%p, string-length=%zu, "
@@ -2060,7 +2044,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb(
                struct ctf_field_class *fc, void *data)
 {
        struct bt_notif_iter *notit = data;
-       struct bt_private_field *field;
+       struct bt_field *field;
 
        BT_LOGV("Compound (beginning) function called from BFCR: "
                "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, "
@@ -2082,7 +2066,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb(
 
        /* Push field */
        BT_ASSERT(field);
-       BT_ASSERT(bt_private_field_borrow_class(field) == fc->ir_fc);
+       BT_ASSERT(bt_field_borrow_class_const(field) == fc->ir_fc);
        stack_push(notit->stack, field);
 
        /*
@@ -2096,11 +2080,10 @@ enum bt_bfcr_status bfcr_compound_begin_cb(
                if (array_fc->is_text) {
                        int ret;
 
-                       BT_ASSERT(bt_field_get_class_type(
-                               bt_private_field_borrow_field(field)) ==
-                               BT_FIELD_CLASS_TYPE_STRING);
+                       BT_ASSERT(bt_field_get_class_type(field) ==
+                                 BT_FIELD_CLASS_TYPE_STRING);
                        notit->done_filling_string = false;
-                       ret = bt_private_field_string_clear(field);
+                       ret = bt_field_string_clear(field);
                        BT_ASSERT(ret == 0);
                        bt_bfcr_set_unsigned_int_cb(notit->bfcr,
                                bfcr_unsigned_int_char_cb);
@@ -2126,7 +2109,7 @@ enum bt_bfcr_status bfcr_compound_end_cb(
        }
 
        BT_ASSERT(!stack_empty(notit->stack));
-       BT_ASSERT(bt_private_field_borrow_class(stack_top(notit->stack)->base) ==
+       BT_ASSERT(bt_field_borrow_class_const(stack_top(notit->stack)->base) ==
                fc->ir_fc);
 
        /*
@@ -2139,8 +2122,7 @@ enum bt_bfcr_status bfcr_compound_end_cb(
 
                if (array_fc->is_text) {
                        BT_ASSERT(bt_field_get_class_type(
-                               bt_private_field_borrow_field(
-                                       stack_top(notit->stack)->base)) ==
+                               stack_top(notit->stack)->base) ==
                                BT_FIELD_CLASS_TYPE_STRING);
                        bt_bfcr_set_unsigned_int_cb(notit->bfcr,
                                bfcr_unsigned_int_cb);
@@ -2162,7 +2144,7 @@ end:
 static
 int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
 {
-       struct bt_private_field *seq_field;
+       struct bt_field *seq_field;
        struct bt_notif_iter *notit = data;
        struct ctf_field_class_sequence *seq_fc = (void *) fc;
        int64_t length = -1;
@@ -2172,7 +2154,7 @@ int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
                seq_fc->stored_length_index);
        seq_field = stack_top(notit->stack)->base;
        BT_ASSERT(seq_field);
-       ret = bt_private_field_dynamic_array_set_length(seq_field, (uint64_t) length);
+       ret = bt_field_dynamic_array_set_length(seq_field, (uint64_t) length);
        if (ret) {
                BT_LOGE("Cannot set dynamic array field's length field: "
                        "notit-addr=%p, field-addr=%p, "
@@ -2242,9 +2224,9 @@ struct ctf_field_class *bfcr_borrow_variant_selected_field_class_cb(
                var_fc, (uint64_t) option_index);
 
        if (selected_option->fc->in_ir) {
-               struct bt_private_field *var_field = stack_top(notit->stack)->base;
+               struct bt_field *var_field = stack_top(notit->stack)->base;
 
-               ret = bt_private_field_variant_select_option_field(
+               ret = bt_field_variant_select_option_field(
                        var_field, option_index);
                if (ret) {
                        BT_LOGW("Cannot select variant field's option field: "
@@ -2264,26 +2246,25 @@ end:
 static
 void set_event_default_clock_value(struct bt_notif_iter *notit)
 {
-       struct bt_private_event *event =
-               bt_private_notification_event_borrow_event(
+       struct bt_event *event =
+               bt_notification_event_borrow_event(
                        notit->event_notif);
-       struct bt_stream_class *sc = bt_private_stream_class_borrow_stream_class(
-               notit->meta.sc->ir_sc);
+       struct bt_stream_class *sc = notit->meta.sc->ir_sc;
 
        BT_ASSERT(event);
 
        if (bt_stream_class_borrow_default_clock_class(sc)) {
-               bt_private_event_set_default_clock_value(event,
+               bt_event_set_default_clock_value(event,
                        notit->default_clock_val);
        }
 }
 
 static
 void notify_new_stream(struct bt_notif_iter *notit,
-               struct bt_private_notification **notification)
+               struct bt_notification **notification)
 {
        enum bt_notif_iter_status status;
-       struct bt_private_notification *ret = NULL;
+       struct bt_notification *ret = NULL;
 
        status = set_current_stream(notit);
        if (status != BT_NOTIF_ITER_STATUS_OK) {
@@ -2293,7 +2274,7 @@ void notify_new_stream(struct bt_notif_iter *notit,
 
        BT_ASSERT(notit->stream);
        BT_ASSERT(notit->notif_iter);
-       ret = bt_private_notification_stream_begin_create(notit->notif_iter,
+       ret = bt_notification_stream_beginning_create(notit->notif_iter,
                notit->stream);
        if (!ret) {
                BT_LOGE("Cannot create stream beginning notification: "
@@ -2308,9 +2289,9 @@ end:
 
 static
 void notify_end_of_stream(struct bt_notif_iter *notit,
-               struct bt_private_notification **notification)
+               struct bt_notification **notification)
 {
-       struct bt_private_notification *ret;
+       struct bt_notification *ret;
 
        if (!notit->stream) {
                BT_LOGE("Cannot create stream for stream notification: "
@@ -2319,7 +2300,7 @@ void notify_end_of_stream(struct bt_notif_iter *notit,
        }
 
        BT_ASSERT(notit->notif_iter);
-       ret = bt_private_notification_stream_end_create(notit->notif_iter,
+       ret = bt_notification_stream_end_create(notit->notif_iter,
                notit->stream);
        if (!ret) {
                BT_LOGE("Cannot create stream beginning notification: "
@@ -2332,12 +2313,12 @@ void notify_end_of_stream(struct bt_notif_iter *notit,
 
 static
 void notify_new_packet(struct bt_notif_iter *notit,
-               struct bt_private_notification **notification)
+               struct bt_notification **notification)
 {
        int ret;
        enum bt_notif_iter_status status;
-       struct bt_private_notification *notif = NULL;
-       struct bt_stream_class *sc;
+       struct bt_notification *notif = NULL;
+       const struct bt_stream_class *sc;
 
        status = set_current_packet(notit);
        if (status != BT_NOTIF_ITER_STATUS_OK) {
@@ -2345,35 +2326,35 @@ void notify_new_packet(struct bt_notif_iter *notit,
        }
 
        BT_ASSERT(notit->packet);
-       sc = bt_private_stream_class_borrow_stream_class(notit->meta.sc->ir_sc);
+       sc = notit->meta.sc->ir_sc;
        BT_ASSERT(sc);
 
        if (bt_stream_class_packets_have_discarded_event_counter_snapshot(sc)) {
                BT_ASSERT(notit->snapshots.discarded_events != UINT64_C(-1));
-               bt_private_packet_set_discarded_event_counter_snapshot(
+               bt_packet_set_discarded_event_counter_snapshot(
                        notit->packet, notit->snapshots.discarded_events);
        }
 
        if (bt_stream_class_packets_have_packet_counter_snapshot(sc)) {
                BT_ASSERT(notit->snapshots.packets != UINT64_C(-1));
-               bt_private_packet_set_packet_counter_snapshot(
+               bt_packet_set_packet_counter_snapshot(
                        notit->packet, notit->snapshots.packets);
        }
 
        if (bt_stream_class_packets_have_default_beginning_clock_value(sc)) {
                BT_ASSERT(notit->snapshots.beginning_clock != UINT64_C(-1));
-               bt_private_packet_set_default_beginning_clock_value(
+               bt_packet_set_default_beginning_clock_value(
                        notit->packet, notit->snapshots.beginning_clock);
        }
 
        if (bt_stream_class_packets_have_default_end_clock_value(sc)) {
                BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1));
-               bt_private_packet_set_default_end_clock_value(
+               bt_packet_set_default_end_clock_value(
                        notit->packet, notit->snapshots.end_clock);
        }
 
        if (notit->packet_header_field) {
-               ret = bt_private_packet_move_header_field(
+               ret = bt_packet_move_header_field(
                        notit->packet, notit->packet_header_field);
                if (ret) {
                        goto end;
@@ -2386,13 +2367,13 @@ void notify_new_packet(struct bt_notif_iter *notit,
                 * the same value as the packet header field within
                 * notit->packet.
                 */
-               BT_ASSERT(bt_private_packet_borrow_header_field(
+               BT_ASSERT(bt_packet_borrow_header_field(
                        notit->packet) ==
                        notit->dscopes.trace_packet_header);
        }
 
        if (notit->packet_context_field) {
-               ret = bt_private_packet_move_context_field(
+               ret = bt_packet_move_context_field(
                        notit->packet, notit->packet_context_field);
                if (ret) {
                        goto end;
@@ -2405,13 +2386,13 @@ void notify_new_packet(struct bt_notif_iter *notit,
                 * the same value as the packet header field within
                 * notit->packet.
                 */
-               BT_ASSERT(bt_private_packet_borrow_context_field(
+               BT_ASSERT(bt_packet_borrow_context_field(
                        notit->packet) ==
                        notit->dscopes.stream_packet_context);
        }
 
        BT_ASSERT(notit->notif_iter);
-       notif = bt_private_notification_packet_begin_create(notit->notif_iter,
+       notif = bt_notification_packet_beginning_create(notit->notif_iter,
                notit->packet);
        if (!notif) {
                BT_LOGE("Cannot create packet beginning notification: "
@@ -2428,9 +2409,9 @@ end:
 
 static
 void notify_end_of_packet(struct bt_notif_iter *notit,
-               struct bt_private_notification **notification)
+               struct bt_notification **notification)
 {
-       struct bt_private_notification *notif;
+       struct bt_notification *notif;
 
        if (!notit->packet) {
                return;
@@ -2442,7 +2423,7 @@ void notify_end_of_packet(struct bt_notif_iter *notit,
        }
 
        BT_ASSERT(notit->notif_iter);
-       notif = bt_private_notification_packet_end_create(notit->notif_iter,
+       notif = bt_notification_packet_end_create(notit->notif_iter,
                notit->packet);
        if (!notif) {
                BT_LOGE("Cannot create packet end notification: "
@@ -2483,8 +2464,8 @@ struct bt_notif_iter *bt_notif_iter_create(struct ctf_trace_class *tc,
        BT_ASSERT(medops.request_bytes);
        BT_ASSERT(medops.borrow_stream);
        BT_LOGD("Creating CTF plugin notification iterator: "
-               "trace-addr=%p, trace-name=\"%s\", max-request-size=%zu, "
-               "data=%p", tc, tc->name->str, max_request_sz, data);
+               "trace-addr=%p, max-request-size=%zu, "
+               "data=%p", tc, max_request_sz, data);
        notit = g_new0(struct bt_notif_iter, 1);
        if (!notit) {
                BT_LOGE_STR("Failed to allocate one CTF plugin notification iterator.");
@@ -2511,10 +2492,9 @@ struct bt_notif_iter *bt_notif_iter_create(struct ctf_trace_class *tc,
 
        bt_notif_iter_reset(notit);
        BT_LOGD("Created CTF plugin notification iterator: "
-               "trace-addr=%p, trace-name=\"%s\", max-request-size=%zu, "
+               "trace-addr=%p, max-request-size=%zu, "
                "data=%p, notit-addr=%p",
-               tc, tc->name->str, max_request_sz, data,
-               notit);
+               tc, max_request_sz, data, notit);
        notit->cur_packet_offset = 0;
 
 end:
@@ -2554,7 +2534,7 @@ void bt_notif_iter_destroy(struct bt_notif_iter *notit)
 enum bt_notif_iter_status bt_notif_iter_get_next_notification(
                struct bt_notif_iter *notit,
                struct bt_self_notification_iterator *notif_iter,
-               struct bt_private_notification **notification)
+               struct bt_notification **notification)
 {
        enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
 
@@ -2656,8 +2636,8 @@ end:
 BT_HIDDEN
 enum bt_notif_iter_status bt_notif_iter_borrow_packet_header_context_fields(
                struct bt_notif_iter *notit,
-               struct bt_private_field **packet_header_field,
-               struct bt_private_field **packet_context_field)
+               struct bt_field **packet_header_field,
+               struct bt_field **packet_context_field)
 {
        int ret;
        enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK;
This page took 0.042457 seconds and 4 git commands to generate.