lib: rename include dir to babeltrace2
[babeltrace.git] / lib / lib-logging.c
index 403c2a173a98107dc582fd9fc76aa722a55d5502..8b16a011e2b2286e60e9c509e518313ae4a14698 100644 (file)
 #include <stdint.h>
 #include <wchar.h>
 #include <glib.h>
-#include <babeltrace/lib-logging-internal.h>
-#include <babeltrace/assert-pre-internal.h>
-#include <babeltrace/common-internal.h>
-#include <babeltrace/lib-logging-internal.h>
-#include <babeltrace/value-internal.h>
-#include <babeltrace/value-internal.h>
-#include <babeltrace/object-pool-internal.h>
-#include <babeltrace/trace-ir/field-class-internal.h>
-#include <babeltrace/trace-ir/field-internal.h>
-#include <babeltrace/trace-ir/event-class-internal.h>
-#include <babeltrace/trace-ir/event-const.h>
-#include <babeltrace/trace-ir/event-internal.h>
-#include <babeltrace/trace-ir/packet-const.h>
-#include <babeltrace/trace-ir/packet-internal.h>
-#include <babeltrace/trace-ir/stream-class-internal.h>
-#include <babeltrace/trace-ir/stream-internal.h>
-#include <babeltrace/trace-ir/stream-const.h>
-#include <babeltrace/trace-ir/trace-internal.h>
-#include <babeltrace/trace-ir/trace-class-internal.h>
-#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/trace-ir/clock-snapshot-internal.h>
-#include <babeltrace/trace-ir/field-path-internal.h>
-#include <babeltrace/trace-ir/utils-internal.h>
-#include <babeltrace/graph/component-class-internal.h>
-#include <babeltrace/graph/component-class-sink-colander-internal.h>
-#include <babeltrace/graph/component-filter-internal.h>
-#include <babeltrace/graph/component-internal.h>
-#include <babeltrace/graph/component-sink-internal.h>
-#include <babeltrace/graph/component-source-internal.h>
-#include <babeltrace/graph/connection-internal.h>
-#include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/graph/message-event-internal.h>
-#include <babeltrace/graph/message-inactivity-internal.h>
-#include <babeltrace/graph/message-internal.h>
-#include <babeltrace/graph/message-iterator-internal.h>
-#include <babeltrace/graph/message-packet-internal.h>
-#include <babeltrace/graph/message-stream-internal.h>
-#include <babeltrace/graph/port-internal.h>
-#include <babeltrace/plugin/plugin-internal.h>
-#include <babeltrace/plugin/plugin-so-internal.h>
+#include <babeltrace2/lib-logging-internal.h>
+#include <babeltrace2/assert-pre-internal.h>
+#include <babeltrace2/common-internal.h>
+#include <babeltrace2/lib-logging-internal.h>
+#include <babeltrace2/value-internal.h>
+#include <babeltrace2/value-internal.h>
+#include <babeltrace2/object-pool-internal.h>
+#include <babeltrace2/trace-ir/field-class-internal.h>
+#include <babeltrace2/trace-ir/field-internal.h>
+#include <babeltrace2/trace-ir/event-class-internal.h>
+#include <babeltrace2/trace-ir/event-const.h>
+#include <babeltrace2/trace-ir/event-internal.h>
+#include <babeltrace2/trace-ir/packet-const.h>
+#include <babeltrace2/trace-ir/packet-internal.h>
+#include <babeltrace2/trace-ir/stream-class-internal.h>
+#include <babeltrace2/trace-ir/stream-internal.h>
+#include <babeltrace2/trace-ir/stream-const.h>
+#include <babeltrace2/trace-ir/trace-internal.h>
+#include <babeltrace2/trace-ir/trace-class-internal.h>
+#include <babeltrace2/trace-ir/clock-class-internal.h>
+#include <babeltrace2/trace-ir/clock-snapshot-internal.h>
+#include <babeltrace2/trace-ir/field-path-internal.h>
+#include <babeltrace2/trace-ir/utils-internal.h>
+#include <babeltrace2/graph/component-class-internal.h>
+#include <babeltrace2/graph/component-class-sink-colander-internal.h>
+#include <babeltrace2/graph/component-filter-internal.h>
+#include <babeltrace2/graph/component-internal.h>
+#include <babeltrace2/graph/component-sink-internal.h>
+#include <babeltrace2/graph/component-source-internal.h>
+#include <babeltrace2/graph/connection-internal.h>
+#include <babeltrace2/graph/graph-internal.h>
+#include <babeltrace2/graph/message-event-internal.h>
+#include <babeltrace2/graph/message-message-iterator-inactivity-internal.h>
+#include <babeltrace2/graph/message-internal.h>
+#include <babeltrace2/graph/message-iterator-internal.h>
+#include <babeltrace2/graph/message-packet-internal.h>
+#include <babeltrace2/graph/message-stream-internal.h>
+#include <babeltrace2/graph/message-stream-activity-internal.h>
+#include <babeltrace2/graph/message-discarded-items-internal.h>
+#include <babeltrace2/graph/port-internal.h>
+#include <babeltrace2/plugin/plugin-internal.h>
+#include <babeltrace2/plugin/plugin-so-internal.h>
 
 #define LIB_LOGGING_BUF_SIZE   (4096 * 4)
 
-static char __thread lib_logging_buf[LIB_LOGGING_BUF_SIZE];
+static __thread char lib_logging_buf[LIB_LOGGING_BUF_SIZE];
 
 #define BUF_APPEND(_fmt, ...)                                          \
        do {                                                            \
@@ -98,10 +100,12 @@ static char __thread lib_logging_buf[LIB_LOGGING_BUF_SIZE];
 
 #define PRFIELD_GSTRING(_expr) PRFIELD((_expr) ? (_expr)->str : NULL)
 
+#define TMP_PREFIX_LEN 64
 #define SET_TMP_PREFIX(_prefix2)                                       \
        do {                                                            \
-               strcpy(tmp_prefix, prefix);                             \
-               strcat(tmp_prefix, (_prefix2));                         \
+               snprintf(tmp_prefix, TMP_PREFIX_LEN - 1, "%s%s",        \
+                       prefix, (_prefix2));                            \
+               tmp_prefix[TMP_PREFIX_LEN - 1] = '\0';                  \
        } while (0)
 
 static inline void format_component(char **buf_ch, bool extended,
@@ -183,7 +187,7 @@ static inline void format_array_field_class(char **buf_ch,
 static inline void format_field_class(char **buf_ch, bool extended,
                const char *prefix, const struct bt_field_class *field_class)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s",
                PRFIELD(bt_common_field_class_type_string(field_class->type)));
@@ -407,24 +411,34 @@ static inline void format_field_path(char **buf_ch, bool extended,
 {
        uint64_t i;
 
-       if (field_path->indexes) {
-               BT_ASSERT(field_path->indexes);
-               BUF_APPEND(", %sindex-count=%u",
-                       PRFIELD(field_path->indexes->len));
+       if (field_path->items) {
+               BT_ASSERT(field_path->items);
+               BUF_APPEND(", %sitem-count=%u",
+                       PRFIELD(field_path->items->len));
        }
 
-       if (!extended || !field_path->indexes) {
+       if (!extended || !field_path->items) {
                return;
        }
 
        BUF_APPEND(", %spath=[%s",
                PRFIELD(bt_common_scope_string(field_path->root)));
 
-       for (i = 0; i < field_path->indexes->len; i++) {
-               uint64_t index = bt_field_path_get_index_by_index_inline(
-                       field_path, i);
-
-               BUF_APPEND(", %" PRIu64, index);
+       for (i = 0; i < bt_field_path_get_item_count(field_path); i++) {
+               const struct bt_field_path_item *fp_item =
+                       bt_field_path_borrow_item_by_index_const(field_path, i);
+
+               switch (bt_field_path_item_get_type(fp_item)) {
+               case BT_FIELD_PATH_ITEM_TYPE_INDEX:
+                       BUF_APPEND(", %" PRIu64,
+                               bt_field_path_item_index_get_index(fp_item));
+                       break;
+               case BT_FIELD_PATH_ITEM_TYPE_CURRENT_ARRAY_ELEMENT:
+                       BUF_APPEND("%s", ", <CUR>");
+                       break;
+               default:
+                       abort();
+               }
        }
 
        BUF_APPEND("%s", "]");
@@ -433,8 +447,6 @@ static inline void format_field_path(char **buf_ch, bool extended,
 static inline void format_trace_class(char **buf_ch, bool extended,
                const char *prefix, const struct bt_trace_class *trace_class)
 {
-       char tmp_prefix[64];
-
        if (trace_class->name.value) {
                BUF_APPEND(", %sname=\"%s\"",
                        PRFIELD(trace_class->name.value));
@@ -455,19 +467,14 @@ static inline void format_trace_class(char **buf_ch, bool extended,
                        PRFIELD(trace_class->stream_classes->len));
        }
 
-       BUF_APPEND(", %spacket-header-fc-addr=%p, "
-               "%sassigns-auto-sc-id=%d",
-               PRFIELD(trace_class->packet_header_fc),
+       BUF_APPEND(", %sassigns-auto-sc-id=%d",
                PRFIELD(trace_class->assigns_automatic_stream_class_id));
-       SET_TMP_PREFIX("phf-pool-");
-       format_object_pool(buf_ch, extended, prefix,
-               &trace_class->packet_header_field_pool);
 }
 
 static inline void format_trace(char **buf_ch, bool extended,
                const char *prefix, const struct bt_trace *trace)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        if (trace->name.value) {
                BUF_APPEND(", %sname=\"%s\"", PRFIELD(trace->name.value));
@@ -484,8 +491,6 @@ static inline void format_trace(char **buf_ch, bool extended,
                        PRFIELD(trace->streams->len));
        }
 
-       BUF_APPEND(", %sis-static=%d", PRFIELD(trace->is_static));
-
        if (!trace->class) {
                return;
        }
@@ -500,7 +505,7 @@ static inline void format_stream_class(char **buf_ch, bool extended,
                const struct bt_stream_class *stream_class)
 {
        const struct bt_trace_class *trace_class;
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %sid=%" PRIu64, PRFIELD(stream_class->id));
 
@@ -521,9 +526,8 @@ static inline void format_stream_class(char **buf_ch, bool extended,
        }
 
        BUF_APPEND(", %spacket-context-fc-addr=%p, "
-               "%sevent-header-fc-addr=%p, %sevent-common-context-fc-addr=%p",
+               "%sevent-common-context-fc-addr=%p",
                PRFIELD(stream_class->packet_context_fc),
-               PRFIELD(stream_class->event_header_fc),
                PRFIELD(stream_class->event_common_context_fc));
        trace_class = bt_stream_class_borrow_trace_class_inline(stream_class);
        if (!trace_class) {
@@ -531,24 +535,25 @@ static inline void format_stream_class(char **buf_ch, bool extended,
        }
 
        BUF_APPEND(", %sassigns-auto-ec-id=%d, %sassigns-auto-stream-id=%d, "
-               "%spackets-have-discarded-ev-counter-snapshot=%d, "
-               "%spackets-have-packet-counter-snapshot=%d, "
-               "%spackets-have-default-begin-cs=%d, "
-               "%spackets-have-default-end-cs=%d",
+               "%spackets-have-default-beginning-cs=%d, "
+               "%spackets-have-default-end-cs=%d, "
+               "%ssupports-discarded-events=%d, "
+               "%sdiscarded-events-have-default-cs=%d, "
+               "%ssupports-discarded-packets=%d, "
+               "%sdiscarded-packets-have-default-cs=%d",
                PRFIELD(stream_class->assigns_automatic_event_class_id),
                PRFIELD(stream_class->assigns_automatic_stream_id),
-               PRFIELD(stream_class->packets_have_discarded_event_counter_snapshot),
-               PRFIELD(stream_class->packets_have_packet_counter_snapshot),
-               PRFIELD(stream_class->packets_have_default_beginning_cs),
-               PRFIELD(stream_class->packets_have_default_end_cs));
+               PRFIELD(stream_class->packets_have_beginning_default_clock_snapshot),
+               PRFIELD(stream_class->packets_have_end_default_clock_snapshot),
+               PRFIELD(stream_class->supports_discarded_events),
+               PRFIELD(stream_class->discarded_events_have_default_clock_snapshots),
+               PRFIELD(stream_class->supports_discarded_packets),
+               PRFIELD(stream_class->discarded_packets_have_default_clock_snapshots));
        BUF_APPEND(", %strace-class-addr=%p", PRFIELD(trace_class));
        SET_TMP_PREFIX("trace-class-");
        format_trace_class(buf_ch, false, tmp_prefix, trace_class);
-       SET_TMP_PREFIX("ehf-pool-");
-       format_object_pool(buf_ch, extended, prefix,
-               &stream_class->event_header_field_pool);
        SET_TMP_PREFIX("pcf-pool-");
-       format_object_pool(buf_ch, extended, prefix,
+       format_object_pool(buf_ch, extended, tmp_prefix,
                &stream_class->packet_context_field_pool);
 }
 
@@ -557,7 +562,7 @@ static inline void format_event_class(char **buf_ch, bool extended,
 {
        const struct bt_stream_class *stream_class;
        const struct bt_trace_class *trace_class;
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %sid=%" PRIu64, PRFIELD(event_class->id));
 
@@ -604,7 +609,8 @@ static inline void format_event_class(char **buf_ch, bool extended,
        SET_TMP_PREFIX("trace-class-");
        format_trace_class(buf_ch, false, tmp_prefix, trace_class);
        SET_TMP_PREFIX("event-pool-");
-       format_object_pool(buf_ch, extended, prefix, &event_class->event_pool);
+       format_object_pool(buf_ch, extended, tmp_prefix,
+               &event_class->event_pool);
 }
 
 static inline void format_stream(char **buf_ch, bool extended,
@@ -613,7 +619,7 @@ static inline void format_stream(char **buf_ch, bool extended,
        const struct bt_stream_class *stream_class;
        const struct bt_trace_class *trace_class = NULL;
        const struct bt_trace *trace = NULL;
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %sid=%" PRIu64, PRFIELD(stream->id));
 
@@ -647,7 +653,7 @@ static inline void format_stream(char **buf_ch, bool extended,
        }
 
        SET_TMP_PREFIX("packet-pool-");
-       format_object_pool(buf_ch, extended, prefix, &stream->packet_pool);
+       format_object_pool(buf_ch, extended, tmp_prefix, &stream->packet_pool);
 }
 
 static inline void format_packet(char **buf_ch, bool extended,
@@ -655,44 +661,20 @@ static inline void format_packet(char **buf_ch, bool extended,
 {
        const struct bt_stream *stream;
        const struct bt_trace_class *trace_class;
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        if (!extended) {
                return;
        }
 
-       BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
-               "%scontext-field-addr=%p",
+       BUF_APPEND(", %sis-frozen=%d, %scontext-field-addr=%p",
                PRFIELD(packet->frozen),
-               PRFIELD(packet->header_field ? packet->header_field->field : NULL),
                PRFIELD(packet->context_field ? packet->context_field->field : NULL));
        stream = bt_packet_borrow_stream_const(packet);
        if (!stream) {
                return;
        }
 
-       if (packet->default_beginning_cs) {
-               SET_TMP_PREFIX("default-begin-cs-");
-               format_clock_snapshot(buf_ch, true, tmp_prefix,
-                       packet->default_beginning_cs);
-       }
-
-       if (packet->default_end_cs) {
-               SET_TMP_PREFIX("default-end-cs-");
-               format_clock_snapshot(buf_ch, true, tmp_prefix,
-                       packet->default_end_cs);
-       }
-
-       if (packet->discarded_event_counter_snapshot.base.avail) {
-               BUF_APPEND(", %sdiscarded-ev-counter-snapshot=%" PRIu64,
-                       PRFIELD(packet->discarded_event_counter_snapshot.value));
-       }
-
-       if (packet->packet_counter_snapshot.base.avail) {
-               BUF_APPEND(", %spacket-counter-snapshot=%" PRIu64,
-                       PRFIELD(packet->packet_counter_snapshot.value));
-       }
-
        BUF_APPEND(", %sstream-addr=%p", PRFIELD(stream));
        SET_TMP_PREFIX("stream-");
        format_stream(buf_ch, false, tmp_prefix, stream);
@@ -713,19 +695,17 @@ static inline void format_event(char **buf_ch, bool extended,
        const struct bt_stream *stream;
        const struct bt_trace_class *trace_class;
        const struct bt_stream_class *stream_class;
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        if (!extended) {
                return;
        }
 
-       BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, "
+       BUF_APPEND(", %sis-frozen=%d, "
                "%scommon-context-field-addr=%p, "
                "%sspecific-context-field-addr=%p, "
                "%spayload-field-addr=%p, ",
                PRFIELD(event->frozen),
-               PRFIELD(event->header_field ?
-                       event->header_field->field : NULL),
                PRFIELD(event->common_context_field),
                PRFIELD(event->specific_context_field),
                PRFIELD(event->payload_field));
@@ -755,12 +735,6 @@ static inline void format_event(char **buf_ch, bool extended,
                }
        }
 
-       if (event->default_cs) {
-               SET_TMP_PREFIX("default-cs-");
-               format_clock_snapshot(buf_ch, true, tmp_prefix,
-                       event->default_cs);
-       }
-
        packet = bt_event_borrow_packet_const(event);
        if (!packet) {
                return;
@@ -782,7 +756,7 @@ static inline void format_event(char **buf_ch, bool extended,
 static inline void format_clock_class(char **buf_ch, bool extended,
                const char *prefix, const struct bt_clock_class *clock_class)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        if (clock_class->name.value) {
                BUF_APPEND(", %sname=\"%s\"", PRFIELD(clock_class->name.value));
@@ -805,22 +779,23 @@ static inline void format_clock_class(char **buf_ch, bool extended,
 
        BUF_APPEND(", %sis-frozen=%d, %sprecision=%" PRIu64 ", "
                "%soffset-s=%" PRId64 ", "
-               "%soffset-cycles=%" PRIu64 ", %sis-absolute=%d, "
+               "%soffset-cycles=%" PRIu64 ", %sorigin-is-unix-epoch=%d, "
                "%sbase-offset-ns=%" PRId64,
                PRFIELD(clock_class->frozen), PRFIELD(clock_class->precision),
                PRFIELD(clock_class->offset_seconds),
                PRFIELD(clock_class->offset_cycles),
-               PRFIELD(clock_class->is_absolute),
+               PRFIELD(clock_class->origin_is_unix_epoch),
                PRFIELD(clock_class->base_offset.value_ns));
 
        SET_TMP_PREFIX("cs-pool-");
-       format_object_pool(buf_ch, extended, prefix, &clock_class->cs_pool);
+       format_object_pool(buf_ch, extended, tmp_prefix,
+               &clock_class->cs_pool);
 }
 
 static inline void format_clock_snapshot(char **buf_ch, bool extended,
                const char *prefix, const struct bt_clock_snapshot *clock_snapshot)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
        BUF_APPEND(", %svalue=%" PRIu64 ", %sns-from-origin=%" PRId64,
                PRFIELD(clock_snapshot->value_cycles),
                PRFIELD(clock_snapshot->ns_from_origin));
@@ -858,11 +833,16 @@ static inline void format_value(char **buf_ch, bool extended,
                BUF_APPEND(", %svalue=%d", PRFIELD(val));
                break;
        }
-       case BT_VALUE_TYPE_INTEGER:
+       case BT_VALUE_TYPE_UNSIGNED_INTEGER:
        {
-               int64_t val = bt_value_integer_get(value);
-
-               BUF_APPEND(", %svalue=%" PRId64, PRFIELD(val));
+               BUF_APPEND(", %svalue=%" PRIu64,
+                       PRFIELD(bt_value_unsigned_integer_get(value)));
+               break;
+       }
+       case BT_VALUE_TYPE_SIGNED_INTEGER:
+       {
+               BUF_APPEND(", %svalue=%" PRId64,
+                       PRFIELD(bt_value_signed_integer_get(value)));
                break;
        }
        case BT_VALUE_TYPE_REAL:
@@ -903,7 +883,7 @@ static inline void format_value(char **buf_ch, bool extended,
 static inline void format_message(char **buf_ch, bool extended,
                const char *prefix, const struct bt_message *msg)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s",
                PRFIELD(bt_message_type_string(msg->type)));
@@ -923,55 +903,101 @@ static inline void format_message(char **buf_ch, bool extended,
 
                if (msg_event->event) {
                        SET_TMP_PREFIX("event-");
-                       format_event(buf_ch, true, tmp_prefix, msg_event->event);
+                       format_event(buf_ch, true, tmp_prefix,
+                               msg_event->event);
+               }
+
+               if (msg_event->default_cs) {
+                       SET_TMP_PREFIX("default-cs-");
+                       format_clock_snapshot(buf_ch, true, tmp_prefix,
+                               msg_event->default_cs);
                }
 
                break;
        }
        case BT_MESSAGE_TYPE_STREAM_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_END:
        {
-               const struct bt_message_stream_beginning *msg_stream =
-                       (const void *) msg;
+               const struct bt_message_stream *msg_stream = (const void *) msg;
 
                if (msg_stream->stream) {
                        SET_TMP_PREFIX("stream-");
-                       format_stream(buf_ch, true, tmp_prefix, msg_stream->stream);
+                       format_stream(buf_ch, true, tmp_prefix,
+                               msg_stream->stream);
                }
 
                break;
        }
-       case BT_MESSAGE_TYPE_STREAM_END:
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
+       case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
        {
-               const struct bt_message_stream_end *msg_stream =
+               const struct bt_message_stream_activity *msg_stream_activity =
                        (const void *) msg;
 
-               if (msg_stream->stream) {
+               if (msg_stream_activity->stream) {
                        SET_TMP_PREFIX("stream-");
-                       format_stream(buf_ch, true, tmp_prefix, msg_stream->stream);
+                       format_stream(buf_ch, true, tmp_prefix,
+                               msg_stream_activity->stream);
+               }
+
+               BUF_APPEND(", %sdefault-cs-state=%s",
+                       PRFIELD(bt_message_stream_activity_clock_snapshot_state_string(
+                               msg_stream_activity->default_cs_state)));
+
+               if (msg_stream_activity->default_cs) {
+                       SET_TMP_PREFIX("default-cs-");
+                       format_clock_snapshot(buf_ch, true, tmp_prefix,
+                               msg_stream_activity->default_cs);
                }
 
                break;
        }
        case BT_MESSAGE_TYPE_PACKET_BEGINNING:
+       case BT_MESSAGE_TYPE_PACKET_END:
        {
-               const struct bt_message_packet_beginning *msg_packet =
-                       (const void *) msg;
+               const struct bt_message_packet *msg_packet = (const void *) msg;
 
                if (msg_packet->packet) {
                        SET_TMP_PREFIX("packet-");
-                       format_packet(buf_ch, true, tmp_prefix, msg_packet->packet);
+                       format_packet(buf_ch, true, tmp_prefix,
+                               msg_packet->packet);
+               }
+
+               if (msg_packet->default_cs) {
+                       SET_TMP_PREFIX("default-cs-");
+                       format_clock_snapshot(buf_ch, true, tmp_prefix,
+                               msg_packet->default_cs);
                }
 
                break;
        }
-       case BT_MESSAGE_TYPE_PACKET_END:
+       case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
+       case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
        {
-               const struct bt_message_packet_end *msg_packet =
+               const struct bt_message_discarded_items *msg_disc_items =
                        (const void *) msg;
 
-               if (msg_packet->packet) {
-                       SET_TMP_PREFIX("packet-");
-                       format_packet(buf_ch, true, tmp_prefix, msg_packet->packet);
+               if (msg_disc_items->stream) {
+                       SET_TMP_PREFIX("stream-");
+                       format_stream(buf_ch, true, tmp_prefix,
+                               msg_disc_items->stream);
+               }
+
+               if (msg_disc_items->default_begin_cs) {
+                       SET_TMP_PREFIX("default-begin-cs-");
+                       format_clock_snapshot(buf_ch, true, tmp_prefix,
+                               msg_disc_items->default_begin_cs);
+               }
+
+               if (msg_disc_items->default_end_cs) {
+                       SET_TMP_PREFIX("default-end-cs-");
+                       format_clock_snapshot(buf_ch, true, tmp_prefix,
+                               msg_disc_items->default_end_cs);
+               }
+
+               if (msg_disc_items->count.base.avail) {
+                       BUF_APPEND(", %scount=%" PRIu64,
+                               PRFIELD(msg_disc_items->count.value));
                }
 
                break;
@@ -996,7 +1022,7 @@ static inline void format_component_class(char **buf_ch, bool extended,
                const char *prefix,
                const struct bt_component_class *comp_class)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s, %sname=\"%s\"",
                PRFIELD(bt_component_class_type_string(comp_class->type)),
@@ -1023,7 +1049,7 @@ static inline void format_component_class(char **buf_ch, bool extended,
 static inline void format_component(char **buf_ch, bool extended,
                const char *prefix, const struct bt_component *component)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %sname=\"%s\"",
                PRFIELD_GSTRING(component->name));
@@ -1052,7 +1078,7 @@ static inline void format_component(char **buf_ch, bool extended,
 static inline void format_port(char **buf_ch, bool extended,
                const char *prefix, const struct bt_port *port)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s, %sname=\"%s\"",
                PRFIELD(bt_port_type_string(port->type)),
@@ -1071,7 +1097,7 @@ static inline void format_port(char **buf_ch, bool extended,
 static inline void format_connection(char **buf_ch, bool extended,
                const char *prefix, const struct bt_connection *connection)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        if (!extended) {
                return;
@@ -1093,9 +1119,13 @@ static inline void format_connection(char **buf_ch, bool extended,
 static inline void format_graph(char **buf_ch, bool extended,
                const char *prefix, const struct bt_graph *graph)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
-       BUF_APPEND(", %sis-canceled=%d", PRFIELD(graph->canceled));
+       BUF_APPEND(", %sis-canceled=%d, %scan-consume=%d, "
+               "%sconfig-state=%s",
+               PRFIELD(graph->canceled),
+               PRFIELD(graph->can_consume),
+               PRFIELD(bt_graph_configuration_state_string(graph->config_state)));
 
        if (!extended) {
                return;
@@ -1112,13 +1142,13 @@ static inline void format_graph(char **buf_ch, bool extended,
        }
 
        SET_TMP_PREFIX("en-pool-");
-       format_object_pool(buf_ch, extended, prefix,
+       format_object_pool(buf_ch, extended, tmp_prefix,
                &graph->event_msg_pool);
        SET_TMP_PREFIX("pbn-pool-");
-       format_object_pool(buf_ch, extended, prefix,
+       format_object_pool(buf_ch, extended, tmp_prefix,
                &graph->packet_begin_msg_pool);
        SET_TMP_PREFIX("pen-pool-");
-       format_object_pool(buf_ch, extended, prefix,
+       format_object_pool(buf_ch, extended, tmp_prefix,
                &graph->packet_end_msg_pool);
 }
 
@@ -1127,7 +1157,7 @@ static inline void format_message_iterator(char **buf_ch,
                const struct bt_message_iterator *iterator)
 {
        const char *type;
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        if (iterator->type == BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT) {
                type = "BT_MESSAGE_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT";
@@ -1191,7 +1221,7 @@ static inline void format_message_iterator(char **buf_ch,
 static inline void format_plugin(char **buf_ch, bool extended,
                const char *prefix, const struct bt_plugin *plugin)
 {
-       char tmp_prefix[64];
+       char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s", PRFIELD(bt_plugin_type_string(plugin->type)));
 
@@ -1376,7 +1406,6 @@ update_fmt:
        *out_fmt_ch = fmt_ch;
 }
 
-BT_HIDDEN
 void bt_lib_log(const char *func, const char *file, unsigned line,
                int lvl, const char *tag, const char *fmt, ...)
 {
This page took 0.031328 seconds and 4 git commands to generate.