X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Flib-logging.c;h=b595263cf60967d08b192e05c6db24e86fec91d9;hb=92fed4e1f98f18e4edbfdf5adfe57741a3260b5d;hp=d09b176d41dde24d38995f96a75c6e45f8adc73c;hpb=44c440bc5fe8219cc17d1b786d91fd83c4c9860a;p=babeltrace.git diff --git a/lib/lib-logging.c b/lib/lib-logging.c index d09b176d..b595263c 100644 --- a/lib/lib-logging.c +++ b/lib/lib-logging.c @@ -33,19 +33,20 @@ #include #include #include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -89,6 +90,8 @@ static char __thread lib_logging_buf[LIB_LOGGING_BUF_SIZE]; #define PRFIELD(_expr) prefix, (_expr) +#define PRFIELD_GSTRING(_expr) PRFIELD((_expr) ? (_expr)->str : NULL) + #define SET_TMP_PREFIX(_prefix2) \ do { \ strcpy(tmp_prefix, prefix); \ @@ -147,131 +150,131 @@ static inline void format_object_pool(char **buf_ch, bool extended, } } -static inline void format_integer_field_type(char **buf_ch, +static inline void format_integer_field_class(char **buf_ch, bool extended, const char *prefix, - struct bt_field_type *field_type) + struct bt_field_class *field_class) { - struct bt_field_type_integer *int_ft = (void *) field_type; + struct bt_field_class_integer *int_fc = (void *) field_class; BUF_APPEND(", %srange-size=%" PRIu64 ", %sbase=%s", - PRFIELD(int_ft->range), - PRFIELD(bt_common_field_type_integer_preferred_display_base_string(int_ft->base))); + PRFIELD(int_fc->range), + PRFIELD(bt_common_field_class_integer_preferred_display_base_string(int_fc->base))); } -static inline void format_array_field_type(char **buf_ch, +static inline void format_array_field_class(char **buf_ch, bool extended, const char *prefix, - struct bt_field_type *field_type) + struct bt_field_class *field_class) { - struct bt_field_type_array *array_ft = (void *) field_type; + struct bt_field_class_array *array_fc = (void *) field_class; - BUF_APPEND(", %selement-ft-addr=%p, %selement-ft-id=%s", - PRFIELD(array_ft->element_ft), - PRFIELD(bt_common_field_type_id_string(array_ft->element_ft->id))); + BUF_APPEND(", %selement-fc-addr=%p, %selement-fc-type=%s", + PRFIELD(array_fc->element_fc), + PRFIELD(bt_common_field_class_type_string(array_fc->element_fc->type))); } -static inline void format_field_type(char **buf_ch, bool extended, - const char *prefix, struct bt_field_type *field_type) +static inline void format_field_class(char **buf_ch, bool extended, + const char *prefix, struct bt_field_class *field_class) { char tmp_prefix[64]; - BUF_APPEND(", %sid=%s", - PRFIELD(bt_common_field_type_id_string(field_type->id))); + BUF_APPEND(", %stype=%s", + PRFIELD(bt_common_field_class_type_string(field_class->type))); if (extended) { - BUF_APPEND(", %sis-frozen=%d", PRFIELD(field_type->frozen)); + BUF_APPEND(", %sis-frozen=%d", PRFIELD(field_class->frozen)); BUF_APPEND(", %sis-part-of-trace=%d", - PRFIELD(field_type->part_of_trace)); + PRFIELD(field_class->part_of_trace)); } else { return; } - switch (field_type->id) { - case BT_FIELD_TYPE_ID_UNSIGNED_INTEGER: - case BT_FIELD_TYPE_ID_SIGNED_INTEGER: + switch (field_class->type) { + case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER: { - format_integer_field_type(buf_ch, extended, prefix, field_type); + format_integer_field_class(buf_ch, extended, prefix, field_class); break; } - case BT_FIELD_TYPE_ID_REAL: + case BT_FIELD_CLASS_TYPE_REAL: { - struct bt_field_type_real *real_ft = (void *) field_type; + struct bt_field_class_real *real_fc = (void *) field_class; BUF_APPEND(", %sis-single-precision=%d", - PRFIELD(real_ft->is_single_precision)); + PRFIELD(real_fc->is_single_precision)); break; } - case BT_FIELD_TYPE_ID_UNSIGNED_ENUMERATION: - case BT_FIELD_TYPE_ID_SIGNED_ENUMERATION: + case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION: + case BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION: { - struct bt_field_type_enumeration *enum_ft = - (void *) field_type; + struct bt_field_class_enumeration *enum_fc = + (void *) field_class; - format_integer_field_type(buf_ch, extended, prefix, field_type); + format_integer_field_class(buf_ch, extended, prefix, field_class); BUF_APPEND(", %smapping-count=%u", - PRFIELD(enum_ft->mappings->len)); + PRFIELD(enum_fc->mappings->len)); break; } - case BT_FIELD_TYPE_ID_STRUCTURE: + case BT_FIELD_CLASS_TYPE_STRUCTURE: { - struct bt_field_type_structure *struct_ft = - (void *) field_type; + struct bt_field_class_structure *struct_fc = + (void *) field_class; - if (struct_ft->common.named_fts) { + if (struct_fc->common.named_fcs) { BUF_APPEND(", %smember-count=%u", - PRFIELD(struct_ft->common.named_fts->len)); + PRFIELD(struct_fc->common.named_fcs->len)); } break; } - case BT_FIELD_TYPE_ID_STATIC_ARRAY: + case BT_FIELD_CLASS_TYPE_STATIC_ARRAY: { - struct bt_field_type_static_array *array_ft = - (void *) field_type; + struct bt_field_class_static_array *array_fc = + (void *) field_class; - format_array_field_type(buf_ch, extended, prefix, field_type); - BUF_APPEND(", %slength=%" PRIu64, PRFIELD(array_ft->length)); + format_array_field_class(buf_ch, extended, prefix, field_class); + BUF_APPEND(", %slength=%" PRIu64, PRFIELD(array_fc->length)); break; } - case BT_FIELD_TYPE_ID_DYNAMIC_ARRAY: + case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY: { - struct bt_field_type_dynamic_array *array_ft = - (void *) field_type; + struct bt_field_class_dynamic_array *array_fc = + (void *) field_class; - format_array_field_type(buf_ch, extended, prefix, field_type); + format_array_field_class(buf_ch, extended, prefix, field_class); - if (array_ft->length_ft) { - SET_TMP_PREFIX("length-ft-"); - format_field_type(buf_ch, extended, tmp_prefix, - array_ft->length_ft); + if (array_fc->length_fc) { + SET_TMP_PREFIX("length-fc-"); + format_field_class(buf_ch, extended, tmp_prefix, + array_fc->length_fc); } - if (array_ft->length_field_path) { + if (array_fc->length_field_path) { SET_TMP_PREFIX("length-field-path-"); format_field_path(buf_ch, extended, tmp_prefix, - array_ft->length_field_path); + array_fc->length_field_path); } break; } - case BT_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_CLASS_TYPE_VARIANT: { - struct bt_field_type_variant *var_ft = (void *) field_type; + struct bt_field_class_variant *var_fc = (void *) field_class; - if (var_ft->common.named_fts) { + if (var_fc->common.named_fcs) { BUF_APPEND(", %soption-count=%u", - PRFIELD(var_ft->common.named_fts->len)); + PRFIELD(var_fc->common.named_fcs->len)); } - if (var_ft->selector_ft) { - SET_TMP_PREFIX("selector-ft-"); - format_field_type(buf_ch, extended, tmp_prefix, - var_ft->selector_ft); + if (var_fc->selector_fc) { + SET_TMP_PREFIX("selector-fc-"); + format_field_class(buf_ch, extended, tmp_prefix, + var_fc->selector_fc); } - if (var_ft->selector_field_path) { + if (var_fc->selector_field_path) { SET_TMP_PREFIX("selector-field-path-"); format_field_path(buf_ch, extended, tmp_prefix, - var_ft->selector_field_path); + var_fc->selector_field_path); } break; @@ -285,19 +288,19 @@ static inline void format_field_integer_extended(char **buf_ch, const char *prefix, struct bt_field *field) { struct bt_field_integer *integer = (void *) field; - struct bt_field_type_integer *field_type = (void *) field->type; + struct bt_field_class_integer *field_class = (void *) field->class; const char *fmt = NULL; - BT_ASSERT(field_type); + BT_ASSERT(field_class); - if (field_type->base == BT_FIELD_TYPE_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL) { + if (field_class->base == BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL) { fmt = ", %svalue=%" PRIo64; - } else if (field_type->base == BT_FIELD_TYPE_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL) { + } else if (field_class->base == BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL) { fmt = ", %svalue=%" PRIx64; } - if (field_type->common.id == BT_FIELD_TYPE_ID_SIGNED_INTEGER || - field_type->common.id == BT_FIELD_TYPE_ID_SIGNED_ENUMERATION) { + if (field_class->common.type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || + field_class->common.type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION) { if (!fmt) { fmt = ", %svalue=%" PRId64; } @@ -321,36 +324,36 @@ static inline void format_field(char **buf_ch, bool extended, BUF_APPEND(", %sis-frozen=%d", PRFIELD(field->frozen)); } - BUF_APPEND(", %stype-addr=%p", PRFIELD(field->type)); + BUF_APPEND(", %sclass-addr=%p", PRFIELD(field->class)); - if (!field->type) { + if (!field->class) { return; } - BUF_APPEND(", %stype-id=%s", - PRFIELD(bt_common_field_type_id_string(field->type->id))); + BUF_APPEND(", %sclass-type=%s", + PRFIELD(bt_common_field_class_type_string(field->class->type))); if (!extended || !field->is_set) { return; } - switch (field->type->id) { - case BT_FIELD_TYPE_ID_UNSIGNED_INTEGER: - case BT_FIELD_TYPE_ID_SIGNED_INTEGER: - case BT_FIELD_TYPE_ID_UNSIGNED_ENUMERATION: - case BT_FIELD_TYPE_ID_SIGNED_ENUMERATION: + switch (field->class->type) { + case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER: + case BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION: + case BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION: { format_field_integer_extended(buf_ch, prefix, field); break; } - case BT_FIELD_TYPE_ID_REAL: + case BT_FIELD_CLASS_TYPE_REAL: { struct bt_field_real *real_field = (void *) field; BUF_APPEND(", %svalue=%f", PRFIELD(real_field->value)); break; } - case BT_FIELD_TYPE_ID_STRING: + case BT_FIELD_CLASS_TYPE_STRING: { struct bt_field_string *str = (void *) field; @@ -362,8 +365,8 @@ static inline void format_field(char **buf_ch, bool extended, break; } - case BT_FIELD_TYPE_ID_STATIC_ARRAY: - case BT_FIELD_TYPE_ID_DYNAMIC_ARRAY: + case BT_FIELD_CLASS_TYPE_STATIC_ARRAY: + case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY: { struct bt_field_array *array_field = (void *) field; @@ -376,7 +379,7 @@ static inline void format_field(char **buf_ch, bool extended, break; } - case BT_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_CLASS_TYPE_VARIANT: { struct bt_field_variant *var_field = (void *) field; @@ -446,9 +449,9 @@ static inline void format_trace(char **buf_ch, bool extended, PRFIELD(trace->streams->len)); } - BUF_APPEND(", %spacket-header-ft-addr=%p, %sis-static=%d, " + BUF_APPEND(", %spacket-header-fc-addr=%p, %sis-static=%d, " "%sassigns-auto-sc-id=%d", - PRFIELD(trace->packet_header_ft), + PRFIELD(trace->packet_header_fc), PRFIELD(trace->is_static), PRFIELD(trace->assigns_automatic_stream_class_id)); SET_TMP_PREFIX("phf-pool-"); @@ -480,11 +483,11 @@ static inline void format_stream_class(char **buf_ch, bool extended, PRFIELD(stream_class->event_classes->len)); } - BUF_APPEND(", %spacket-context-ft-addr=%p, " - "%sevent-header-ft-addr=%p, %sevent-common-context-ft-addr=%p", - PRFIELD(stream_class->packet_context_ft), - PRFIELD(stream_class->event_header_ft), - PRFIELD(stream_class->event_common_context_ft)); + BUF_APPEND(", %spacket-context-fc-addr=%p, " + "%sevent-header-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 = bt_stream_class_borrow_trace_inline(stream_class); if (!trace) { return; @@ -543,9 +546,9 @@ static inline void format_event_class(char **buf_ch, bool extended, PRFIELD(event_class->emf_uri.value)); } - BUF_APPEND(", %sspecific-context-ft-addr=%p, %spayload-ft-addr=%p", - PRFIELD(event_class->specific_context_ft), - PRFIELD(event_class->payload_ft)); + BUF_APPEND(", %sspecific-context-fc-addr=%p, %spayload-fc-addr=%p", + PRFIELD(event_class->specific_context_fc), + PRFIELD(event_class->payload_fc)); stream_class = bt_event_class_borrow_stream_class(event_class); if (!stream_class) { @@ -597,11 +600,6 @@ static inline void format_stream(char **buf_ch, bool extended, return; } - trace = (void *) bt_object_borrow_parent(&stream->base); - if (!trace) { - return; - } - BUF_APPEND(", %strace-addr=%p", PRFIELD(trace)); SET_TMP_PREFIX("trace-"); format_trace(buf_ch, false, tmp_prefix, trace); @@ -680,7 +678,7 @@ static inline void format_event(char **buf_ch, bool extended, BUF_APPEND(", %sis-frozen=%d, %sheader-field-addr=%p, " "%scommon-context-field-addr=%p, " - "%specific-scontext-field-addr=%p, " + "%sspecific-context-field-addr=%p, " "%spayload-field-addr=%p, ", PRFIELD(event->frozen), PRFIELD(event->header_field ? @@ -786,17 +784,21 @@ static inline void format_clock_value(char **buf_ch, bool extended, } BUF_APPEND(", %sis-set=%d", PRFIELD(clock_value->is_set)); - BUF_APPEND(", %sclock-class-addr=%p", - PRFIELD(clock_value->clock_class)); - SET_TMP_PREFIX("clock-class-"); - format_clock_class(buf_ch, false, tmp_prefix, clock_value->clock_class); + + if (clock_value->clock_class) { + BUF_APPEND(", %sclock-class-addr=%p", + PRFIELD(clock_value->clock_class)); + SET_TMP_PREFIX("clock-class-"); + format_clock_class(buf_ch, false, tmp_prefix, + clock_value->clock_class); + } } static inline void format_value(char **buf_ch, bool extended, const char *prefix, struct bt_value *value) { BUF_APPEND(", %stype=%s", - PRFIELD(bt_value_type_string(bt_value_get_type(value)))); + PRFIELD(bt_common_value_type_string(bt_value_get_type(value)))); if (!extended) { return; @@ -805,39 +807,35 @@ static inline void format_value(char **buf_ch, bool extended, switch (bt_value_get_type(value)) { case BT_VALUE_TYPE_BOOL: { - bt_bool val; + bt_bool val = bt_value_bool_get(value); - (void) bt_value_bool_get(value, &val); BUF_APPEND(", %svalue=%d", PRFIELD(val)); break; } case BT_VALUE_TYPE_INTEGER: { - int64_t val; + int64_t val = bt_value_integer_get(value); - (void) bt_value_integer_get(value, &val); BUF_APPEND(", %svalue=%" PRId64, PRFIELD(val)); break; } - case BT_VALUE_TYPE_FLOAT: + case BT_VALUE_TYPE_REAL: { - double val; + double val = bt_value_real_get(value); - (void) bt_value_float_get(value, &val); BUF_APPEND(", %svalue=%f", PRFIELD(val)); break; } case BT_VALUE_TYPE_STRING: { - const char *val; + const char *val = bt_value_string_get(value); - (void) bt_value_string_get(value, &val); BUF_APPEND(", %spartial-value=\"%.32s\"", PRFIELD(val)); break; } case BT_VALUE_TYPE_ARRAY: { - int64_t count = bt_value_array_size(value); + int64_t count = bt_value_array_get_size(value); BT_ASSERT(count >= 0); BUF_APPEND(", %selement-count=%" PRId64, PRFIELD(count)); @@ -845,7 +843,7 @@ static inline void format_value(char **buf_ch, bool extended, } case BT_VALUE_TYPE_MAP: { - int64_t count = bt_value_map_size(value); + int64_t count = bt_value_map_get_size(value); BT_ASSERT(count >= 0); BUF_APPEND(", %selement-count=%" PRId64, PRFIELD(count)); @@ -876,8 +874,11 @@ static inline void format_notification(char **buf_ch, bool extended, { struct bt_notification_event *notif_event = (void *) notif; - SET_TMP_PREFIX("event-"); - format_event(buf_ch, true, tmp_prefix, notif_event->event); + if (notif_event->event) { + SET_TMP_PREFIX("event-"); + format_event(buf_ch, true, tmp_prefix, notif_event->event); + } + break; } case BT_NOTIFICATION_TYPE_STREAM_BEGIN: @@ -885,8 +886,11 @@ static inline void format_notification(char **buf_ch, bool extended, struct bt_notification_stream_begin *notif_stream = (void *) notif; - SET_TMP_PREFIX("stream-"); - format_stream(buf_ch, true, tmp_prefix, notif_stream->stream); + if (notif_stream->stream) { + SET_TMP_PREFIX("stream-"); + format_stream(buf_ch, true, tmp_prefix, notif_stream->stream); + } + break; } case BT_NOTIFICATION_TYPE_STREAM_END: @@ -894,8 +898,11 @@ static inline void format_notification(char **buf_ch, bool extended, struct bt_notification_stream_end *notif_stream = (void *) notif; - SET_TMP_PREFIX("stream-"); - format_stream(buf_ch, true, tmp_prefix, notif_stream->stream); + if (notif_stream->stream) { + SET_TMP_PREFIX("stream-"); + format_stream(buf_ch, true, tmp_prefix, notif_stream->stream); + } + break; } case BT_NOTIFICATION_TYPE_PACKET_BEGIN: @@ -903,8 +910,11 @@ static inline void format_notification(char **buf_ch, bool extended, struct bt_notification_packet_begin *notif_packet = (void *) notif; - SET_TMP_PREFIX("packet-"); - format_packet(buf_ch, true, tmp_prefix, notif_packet->packet); + if (notif_packet->packet) { + SET_TMP_PREFIX("packet-"); + format_packet(buf_ch, true, tmp_prefix, notif_packet->packet); + } + break; } case BT_NOTIFICATION_TYPE_PACKET_END: @@ -912,8 +922,11 @@ static inline void format_notification(char **buf_ch, bool extended, struct bt_notification_packet_end *notif_packet = (void *) notif; - SET_TMP_PREFIX("packet-"); - format_packet(buf_ch, true, tmp_prefix, notif_packet->packet); + if (notif_packet->packet) { + SET_TMP_PREFIX("packet-"); + format_packet(buf_ch, true, tmp_prefix, notif_packet->packet); + } + break; } default: @@ -928,7 +941,7 @@ static inline void format_plugin_so_shared_lib_handle(char **buf_ch, BUF_APPEND(", %saddr=%p", PRFIELD(handle)); if (handle->path) { - BUF_APPEND(", %spath=\"%s\"", PRFIELD(handle->path->str)); + BUF_APPEND(", %spath=\"%s\"", PRFIELD_GSTRING(handle->path)); } } @@ -939,11 +952,11 @@ static inline void format_component_class(char **buf_ch, bool extended, BUF_APPEND(", %stype=%s, %sname=\"%s\"", PRFIELD(bt_component_class_type_string(comp_class->type)), - PRFIELD(comp_class->name ? comp_class->name->str : NULL)); + PRFIELD_GSTRING(comp_class->name)); if (comp_class->description) { BUF_APPEND(", %spartial-descr=\"%.32s\"", - PRFIELD(comp_class->description->str)); + PRFIELD_GSTRING(comp_class->description)); } if (!extended) { @@ -964,9 +977,14 @@ static inline void format_component(char **buf_ch, bool extended, { char tmp_prefix[64]; - BUF_APPEND(", %sname=\"%s\"", PRFIELD(component->name->str)); - SET_TMP_PREFIX("class-"); - format_component_class(buf_ch, extended, tmp_prefix, component->class); + BUF_APPEND(", %sname=\"%s\"", + PRFIELD_GSTRING(component->name)); + + if (component->class) { + SET_TMP_PREFIX("class-"); + format_component_class(buf_ch, extended, tmp_prefix, + component->class); + } if (!extended) { return; @@ -990,7 +1008,7 @@ static inline void format_port(char **buf_ch, bool extended, BUF_APPEND(", %stype=%s, %sname=\"%s\"", PRFIELD(bt_port_type_string(port->type)), - PRFIELD(port->name->str)); + PRFIELD_GSTRING(port->name)); if (!extended) { return; @@ -1063,10 +1081,10 @@ static inline void format_notification_iterator(char **buf_ch, const char *type; char tmp_prefix[64]; - if (iterator->type == BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION) { - type = "BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION"; - } else if (iterator->type == BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT) { - type = "BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT"; + if (iterator->type == BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT) { + type = "BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT"; + } else if (iterator->type == BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT) { + type = "BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT"; } else { type = "(unknown)"; } @@ -1074,41 +1092,47 @@ static inline void format_notification_iterator(char **buf_ch, BUF_APPEND(", %stype=%s", PRFIELD(type)); switch (iterator->type) { - case BT_NOTIFICATION_ITERATOR_TYPE_PRIVATE_CONNECTION: + case BT_NOTIFICATION_ITERATOR_TYPE_SELF_COMPONENT_PORT_INPUT: { - struct bt_notification_iterator_private_connection * - iter_priv_conn = (void *) iterator; + struct bt_self_component_port_input_notification_iterator * + port_in_iter = (void *) iterator; - if (iter_priv_conn->upstream_component) { + if (port_in_iter->upstream_component) { SET_TMP_PREFIX("upstream-comp-"); format_component(buf_ch, false, tmp_prefix, - iter_priv_conn->upstream_component); + port_in_iter->upstream_component); } - if (iter_priv_conn->upstream_port) { + if (port_in_iter->upstream_port) { SET_TMP_PREFIX("upstream-port-"); format_port(buf_ch, false, tmp_prefix, - iter_priv_conn->upstream_port); + port_in_iter->upstream_port); } - if (iter_priv_conn->connection) { + if (port_in_iter->connection) { SET_TMP_PREFIX("upstream-conn-"); format_connection(buf_ch, false, tmp_prefix, - iter_priv_conn->connection); + port_in_iter->connection); } break; } - case BT_NOTIFICATION_ITERATOR_TYPE_OUTPUT_PORT: + case BT_NOTIFICATION_ITERATOR_TYPE_PORT_OUTPUT: { - struct bt_notification_iterator_output_port *iter_output_port = + struct bt_port_output_notification_iterator *port_out_iter = (void *) iterator; - SET_TMP_PREFIX("graph-"); - format_graph(buf_ch, false, tmp_prefix, - iter_output_port->graph); - SET_TMP_PREFIX("colander-comp-"); - format_component(buf_ch, false, tmp_prefix, - iter_output_port->colander); + if (port_out_iter->graph) { + SET_TMP_PREFIX("graph-"); + format_graph(buf_ch, false, tmp_prefix, + port_out_iter->graph); + } + + if (port_out_iter->colander) { + SET_TMP_PREFIX("colander-comp-"); + format_component(buf_ch, false, tmp_prefix, + (void *) port_out_iter->colander); + } + break; } default: @@ -1117,7 +1141,7 @@ static inline void format_notification_iterator(char **buf_ch, } static inline void format_plugin(char **buf_ch, bool extended, - const char *prefix, struct bt_plugin *plugin) + const char *prefix, const struct bt_plugin *plugin) { char tmp_prefix[64]; @@ -1125,12 +1149,12 @@ static inline void format_plugin(char **buf_ch, bool extended, if (plugin->info.path_set) { BUF_APPEND(", %spath=\"%s\"", - PRFIELD(plugin->info.path->str)); + PRFIELD_GSTRING(plugin->info.path)); } if (plugin->info.name_set) { BUF_APPEND(", %sname=\"%s\"", - PRFIELD(plugin->info.name->str)); + PRFIELD_GSTRING(plugin->info.name)); } if (!extended) { @@ -1139,12 +1163,12 @@ static inline void format_plugin(char **buf_ch, bool extended, if (plugin->info.author_set) { BUF_APPEND(", %sauthor=\"%s\"", - PRFIELD(plugin->info.author->str)); + PRFIELD_GSTRING(plugin->info.author)); } if (plugin->info.license_set) { BUF_APPEND(", %slicense=\"%s\"", - PRFIELD(plugin->info.license->str)); + PRFIELD_GSTRING(plugin->info.license)); } if (plugin->info.version_set) { @@ -1156,9 +1180,11 @@ static inline void format_plugin(char **buf_ch, bool extended, plugin->info.version.extra->str : ""); } - BUF_APPEND(", %sis-frozen=%d, %scomp-class-count=%u", - PRFIELD(plugin->frozen), - PRFIELD(plugin->comp_classes->len)); + BUF_APPEND(", %ssrc-comp-class-count=%u, %sflt-comp-class-count=%u, " + "%ssink-comp-class-count=%u", + PRFIELD(plugin->src_comp_classes->len), + PRFIELD(plugin->flt_comp_classes->len), + PRFIELD(plugin->sink_comp_classes->len)); if (plugin->spec_data) { struct bt_plugin_so_spec_data *spec_data = @@ -1225,7 +1251,7 @@ static inline void handle_conversion_specifier_bt(void *priv_data, switch (*fmt_ch) { case 'F': - format_field_type(buf_ch, extended, prefix, obj); + format_field_class(buf_ch, extended, prefix, obj); break; case 'f': format_field(buf_ch, extended, prefix, obj);