* SOFTWARE.
*/
+#define BT_COMP_LOG_SELF_COMP (stream->trace->fs_sink->self_comp)
#define BT_LOG_OUTPUT_LEVEL (stream->log_level)
#define BT_LOG_TAG "PLUGIN/SINK.CTF.FS/STREAM"
-#include "logging/log.h"
+#include "plugins/comp-logging.h"
#include <babeltrace2/babeltrace.h>
#include <stdio.h>
#include "ctfser/ctfser.h"
#include "compat/endian.h"
+#include "fs-sink.h"
#include "fs-sink-trace.h"
#include "fs-sink-stream.h"
#include "translate-trace-ir-to-ctf-ir.h"
stream->prev_packet_state.end_cs = UINT64_C(-1);
stream->prev_packet_state.discarded_events_counter = UINT64_C(-1);
stream->prev_packet_state.seq_num = UINT64_C(-1);
- ret = try_translate_stream_class_trace_ir_to_ctf_ir(trace->tc,
- bt_stream_borrow_class_const(ir_stream), &stream->sc,
- stream->log_level);
+ ret = try_translate_stream_class_trace_ir_to_ctf_ir(trace->fs_sink,
+ trace->tc, bt_stream_borrow_class_const(ir_stream),
+ &stream->sc);
if (ret) {
goto error;
}
ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
UINT64_C(0xc1fc1fc1), 8, 32, BYTE_ORDER);
if (ret) {
- BT_LOGE("Error writing packet header magic: stream-file-name=%s",
+ BT_COMP_LOGE("Error writing packet header magic: stream-file-name=%s",
stream->file_name->str);
goto end;
}
ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
(uint64_t) stream->sc->tc->uuid[i], 8, 8, BYTE_ORDER);
if (ret) {
- BT_LOGE("Error writing packet header UUID: stream-file-name=%s",
+ BT_COMP_LOGE("Error writing packet header UUID: stream-file-name=%s",
stream->file_name->str);
goto end;
}
ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
bt_stream_class_get_id(stream->sc->ir_sc), 8, 64, BYTE_ORDER);
if (ret) {
- BT_LOGE("Error writing packet header stream class id: "
+ BT_COMP_LOGE("Error writing packet header stream class id: "
"stream-file-name=%s, stream-class-id=%"PRIu64,
stream->file_name->str,
bt_stream_class_get_id(stream->sc->ir_sc));
ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
bt_stream_get_id(stream->ir_stream), 8, 64, BYTE_ORDER);
if (ret) {
- BT_LOGE("Error writing packet header stream id: "
+ BT_COMP_LOGE("Error writing packet header stream id: "
"stream-file-name=%s, stream-id=%"PRIu64,
stream->file_name->str,
bt_stream_get_id(stream->ir_stream));
* SOFTWARE.
*/
+#define BT_COMP_LOG_SELF_COMP (trace->fs_sink->self_comp)
#define BT_LOG_OUTPUT_LEVEL (trace->log_level)
#define BT_LOG_TAG "PLUGIN/SINK.CTF.FS/TRACE"
-#include "logging/log.h"
+#include "plugins/comp-logging.h"
#include <babeltrace2/babeltrace.h>
#include <stdio.h>
* the format.
*/
if (!g_time_val_from_iso8601(datetime, &tv)) {
- BT_LOGI("Couldn't parse datetime as ISO 8601: date=\"%s\"", datetime);
+ BT_COMP_LOGI("Couldn't parse datetime as ISO 8601: date=\"%s\"", datetime);
goto end;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_buffering_id");
if (!v || !bt_value_is_signed_integer(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"tracer_buffering_id\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"tracer_buffering_id\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "isa_length");
if (!v || !bt_value_is_signed_integer(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"isa_length\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"isa_length\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "procname");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"procname\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"procname\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "vpid");
if (!v || !bt_value_is_signed_integer(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"vpid\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"vpid\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "vpid_datetime");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"vpid_datetime\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"vpid_datetime\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_name");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"tracer_name\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"tracer_name\"");
goto error;
}
if (!g_str_equal(tracer_name, "lttng-ust")
&& !g_str_equal(tracer_name, "lttng-modules")) {
- BT_LOGI("Unrecognized tracer name: name=\"%s\"", tracer_name);
+ BT_COMP_LOGI("Unrecognized tracer name: name=\"%s\"", tracer_name);
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_major");
if (!v || !bt_value_is_signed_integer(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"tracer_major\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"tracer_major\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_minor");
if (!v || !bt_value_is_signed_integer(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"tracer_minor\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"tracer_minor\"");
goto error;
}
tracer_minor = bt_value_signed_integer_get(v);
if (!(tracer_major >= 3 || (tracer_major == 2 && tracer_minor >= 11))) {
- BT_LOGI("Unsupported LTTng version for automatic trace path: major=%" PRId64 ", minor=%" PRId64,
+ BT_COMP_LOGI("Unsupported LTTng version for automatic trace path: major=%" PRId64 ", minor=%" PRId64,
tracer_major, tracer_minor);
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "hostname");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"tracer_hostname\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"tracer_hostname\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "trace_name");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"trace_name\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"trace_name\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "trace_creation_datetime");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"trace_creation_datetime\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"trace_creation_datetime\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "domain");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"domain\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"domain\"");
goto error;
}
v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_buffering_scheme");
if (!v || !bt_value_is_string(v)) {
- BT_LOGI_STR("Couldn't get environment value: name=\"tracer_buffering_scheme\"");
+ BT_COMP_LOGI_STR("Couldn't get environment value: name=\"tracer_buffering_scheme\"");
goto error;
}
}
} else {
/* Unknown buffering scheme. */
- BT_LOGI("Unknown buffering scheme: tracer_buffering_scheme=\"%s\"", tracer_buffering_scheme);
+ BT_COMP_LOGI("Unknown buffering scheme: tracer_buffering_scheme=\"%s\"", tracer_buffering_scheme);
goto error;
}
} else if (!g_str_equal(domain, "kernel")) {
/* Unknown domain. */
- BT_LOGI("Unknown domain: domain=\"%s\"", domain);
+ BT_COMP_LOGI("Unknown domain: domain=\"%s\"", domain);
goto error;
}
BT_ASSERT(trace->metadata_path);
fh = fopen(trace->metadata_path->str, "wb");
if (!fh) {
- BT_LOGF_ERRNO("In trace destruction listener: "
+ BT_COMP_LOGF_ERRNO("In trace destruction listener: "
"cannot open metadata file for writing: ",
": path=\"%s\"", trace->metadata_path->str);
abort();
len = fwrite(tsdl->str, sizeof(*tsdl->str), tsdl->len, fh);
if (len != tsdl->len) {
- BT_LOGF_ERRNO("In trace destruction listener: "
+ BT_COMP_LOGF_ERRNO("In trace destruction listener: "
"cannot write metadata file: ",
": path=\"%s\"", trace->metadata_path->str);
abort();
int ret = fclose(fh);
if (ret != 0) {
- BT_LOGW_ERRNO("In trace destruction listener: "
+ BT_COMP_LOGW_ERRNO("In trace destruction listener: "
"cannot close metadata file: ",
": path=\"%s\"", trace->metadata_path->str);
}
trace->ir_trace = ir_trace;
trace->ir_trace_destruction_listener_id = UINT64_C(-1);
trace->tc = translate_trace_class_trace_ir_to_ctf_ir(
- bt_trace_borrow_class_const(ir_trace),
- fs_sink->log_level);
+ fs_sink, bt_trace_borrow_class_const(ir_trace));
if (!trace->tc) {
goto error;
}
BT_ASSERT(trace->path);
ret = g_mkdir_with_parents(trace->path->str, 0755);
if (ret) {
- BT_LOGE_ERRNO("Cannot create directories for trace directory",
+ BT_COMP_LOGE_ERRNO("Cannot create directories for trace directory",
": path=\"%s\"", trace->path->str);
goto error;
}
* SOFTWARE.
*/
+#define BT_COMP_LOG_SELF_COMP (fs_sink->self_comp)
#define BT_LOG_OUTPUT_LEVEL (fs_sink->log_level)
#define BT_LOG_TAG "PLUGIN/SINK.CTF.FS"
-#include "logging/log.h"
+#include "plugins/comp-logging.h"
#include <babeltrace2/babeltrace.h>
#include <stdio.h>
ret = g_mkdir_with_parents(fs_sink->output_dir_path->str, 0755);
if (ret) {
- BT_LOGE_ERRNO("Cannot create directories for output directory",
+ BT_COMP_LOGE_ERRNO(
+ "Cannot create directories for output directory",
": output-dir-path=\"%s\"",
fs_sink->output_dir_path->str);
status = BT_SELF_COMPONENT_STATUS_ERROR;
value = bt_value_map_borrow_entry_value_const(params, "path");
if (!value) {
- BT_LOGE_STR("Missing mandatory `path` parameter.");
+ BT_COMP_LOGE_STR("Missing mandatory `path` parameter.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
if (!bt_value_is_string(value)) {
- BT_LOGE_STR("`path` parameter: expecting a string.");
+ BT_COMP_LOGE_STR("`path` parameter: expecting a string.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"assume-single-trace");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`assume-single-trace` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`assume-single-trace` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"ignore-discarded-events");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`ignore-discarded-events` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`ignore-discarded-events` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"ignore-discarded-packets");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`ignore-discarded-packets` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`ignore-discarded-packets` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
"quiet");
if (value) {
if (!bt_value_is_bool(value)) {
- BT_LOGE_STR("`quiet` parameter: expecting a boolean.");
+ BT_COMP_LOGE_STR("`quiet` parameter: expecting a boolean.");
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
}
fs_sink = g_new0(struct fs_sink_comp, 1);
if (!fs_sink) {
- BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+ BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
"Failed to allocate one CTF FS sink structure.");
status = BT_SELF_COMPONENT_STATUS_NOMEM;
goto end;
}
fs_sink->log_level = log_level;
+ fs_sink->self_comp = self_comp;
fs_sink->output_dir_path = g_string_new(NULL);
- fs_sink->self_comp = self_comp_sink;
status = configure_component(fs_sink, params);
if (status != BT_SELF_COMPONENT_STATUS_OK) {
/* configure_component() logs errors */
if (fs_sink->assume_single_trace &&
g_file_test(fs_sink->output_dir_path->str,
G_FILE_TEST_EXISTS)) {
- BT_LOGE("Single trace mode, but output path exists: "
+ BT_COMP_LOGE("Single trace mode, but output path exists: "
"output-path=\"%s\"", fs_sink->output_dir_path->str);
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
fs_sink->traces = g_hash_table_new_full(g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) fs_sink_trace_destroy);
if (!fs_sink->traces) {
- BT_LOGE_STR("Failed to allocate one GHashTable.");
+ BT_COMP_LOGE_STR("Failed to allocate one GHashTable.");
status = BT_SELF_COMPONENT_STATUS_NOMEM;
goto end;
}
if (G_UNLIKELY(!trace)) {
if (fs_sink->assume_single_trace &&
g_hash_table_size(fs_sink->traces) > 0) {
- BT_LOGE("Single trace mode, but getting more than one trace: "
+ BT_COMP_LOGE("Single trace mode, but getting more than one trace: "
"stream-name=\"%s\"",
bt_stream_get_name(ir_stream));
goto end;
goto end;
}
- ret = try_translate_event_class_trace_ir_to_ctf_ir(stream->sc,
- bt_event_borrow_class_const(ir_event), &ec,
- fs_sink->log_level);
+ ret = try_translate_event_class_trace_ir_to_ctf_ir(fs_sink,
+ stream->sc, bt_event_borrow_class_const(ir_event), &ec);
if (ret) {
status = BT_SELF_COMPONENT_STATUS_ERROR;
goto end;
if (stream->discarded_events_state.beginning_cs !=
expected_cs) {
- BT_LOGE("Incompatible discarded events message: "
+ BT_COMP_LOGE("Incompatible discarded events message: "
"unexpected beginning time: "
"beginning-cs-val=%" PRIu64 ", "
"expected-beginning-cs-val=%" PRIu64 ", "
* this case.
*/
if (stream->prev_packet_state.end_cs == UINT64_C(-1)) {
- BT_LOGE("Incompatible discarded packets message "
+ BT_COMP_LOGE("Incompatible discarded packets message "
"occuring before the stream's first packet: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
if (stream->discarded_packets_state.beginning_cs !=
stream->prev_packet_state.end_cs) {
- BT_LOGE("Incompatible discarded packets message: "
+ BT_COMP_LOGE("Incompatible discarded packets message: "
"unexpected beginning time: "
"beginning-cs-val=%" PRIu64 ", "
"expected-beginning-cs-val=%" PRIu64 ", "
if (stream->discarded_packets_state.end_cs !=
expected_end_cs) {
- BT_LOGE("Incompatible discarded packets message: "
+ BT_COMP_LOGE("Incompatible discarded packets message: "
"unexpected end time: "
"end-cs-val=%" PRIu64 ", "
"expected-end-cs-val=%" PRIu64 ", "
expected_cs = bt_clock_snapshot_get_value(cs);
if (stream->discarded_events_state.end_cs != expected_cs) {
- BT_LOGE("Incompatible discarded events message: "
+ BT_COMP_LOGE("Incompatible discarded events message: "
"unexpected end time: "
"end-cs-val=%" PRIu64 ", "
"expected-end-cs-val=%" PRIu64 ", "
if (!fs_sink->ignore_discarded_events &&
bt_stream_class_discarded_events_have_default_clock_snapshots(ir_sc) &&
!packets_have_beginning_end_cs) {
- BT_LOGE("Unsupported stream: discarded events have "
+ BT_COMP_LOGE("Unsupported stream: discarded events have "
"default clock snapshots, but packets have no "
"beginning and/or end default clock snapshots: "
"stream-addr=%p, "
if (!fs_sink->ignore_discarded_packets &&
bt_stream_class_discarded_packets_have_default_clock_snapshots(ir_sc) &&
!packets_have_beginning_end_cs) {
- BT_LOGE("Unsupported stream: discarded packets have "
+ BT_COMP_LOGE("Unsupported stream: discarded packets have "
"default clock snapshots, but packets have no "
"beginning and/or end default clock snapshots: "
"stream-addr=%p, "
goto end;
}
- BT_LOGI("Created new, empty stream file: "
+ BT_COMP_LOGI("Created new, empty stream file: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream), bt_stream_get_name(ir_stream),
goto end;
}
- BT_LOGI("Closing stream file: "
+ BT_COMP_LOGI("Closing stream file: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream), bt_stream_get_name(ir_stream),
}
if (fs_sink->ignore_discarded_events) {
- BT_LOGI("Ignoring discarded events message: "
+ BT_COMP_LOGI("Ignoring discarded events message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
}
if (stream->discarded_events_state.in_range) {
- BT_LOGE("Unsupported contiguous discarded events message: "
+ BT_COMP_LOGE("Unsupported contiguous discarded events message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
*/
if (stream->packet_state.is_open &&
stream->sc->discarded_events_has_ts) {
- BT_LOGE("Unsupported discarded events message with "
+ BT_COMP_LOGE("Unsupported discarded events message with "
"default clock snapshots occuring within a packet: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
}
if (fs_sink->ignore_discarded_packets) {
- BT_LOGI("Ignoring discarded packets message: "
+ BT_COMP_LOGI("Ignoring discarded packets message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
}
if (stream->discarded_packets_state.in_range) {
- BT_LOGE("Unsupported contiguous discarded packets message: "
+ BT_COMP_LOGE("Unsupported contiguous discarded packets message: "
"stream-id=%" PRIu64 ", stream-name=\"%s\", "
"trace-name=\"%s\", path=\"%s/%s\"",
bt_stream_get_id(ir_stream),
break;
case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
/* Ignore */
- BT_LOGD_STR("Ignoring message iterator inactivity message.");
+ BT_COMP_LOGD_STR("Ignoring message iterator inactivity message.");
break;
case BT_MESSAGE_TYPE_STREAM_BEGINNING:
status = handle_stream_beginning_msg(
case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
/* Not supported by CTF 1.8 */
- BT_LOGD_STR("Ignoring stream activity message.");
+ BT_COMP_LOGD_STR("Ignoring stream activity message.");
break;
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
status = handle_discarded_events_msg(
BT_MESSAGE_PUT_REF_AND_RESET(msgs[i]);
if (status != BT_SELF_COMPONENT_STATUS_OK) {
- BT_LOGE("Failed to handle message: "
+ BT_COMP_LOGE("Failed to handle message: "
"generated CTF traces could be incomplete: "
"output-dir-path=\"%s\"",
fs_sink->output_dir_path->str);
struct fs_sink_comp {
bt_logging_level log_level;
- bt_self_component_sink *self_comp;
+ bt_self_component *self_comp;
/* Owned by this */
bt_self_component_port_input_message_iterator *upstream_iter;
* SOFTWARE.
*/
+#define BT_COMP_LOG_SELF_COMP (ctx->self_comp)
#define BT_LOG_OUTPUT_LEVEL (ctx->log_level)
#define BT_LOG_TAG "PLUGIN/SINK.CTF.FS/TRANSLATE-TRACE-IR-TO-CTF-IR"
-#include "logging/log.h"
+#include "plugins/comp-logging.h"
#include <babeltrace2/babeltrace.h>
#include "common/macros.h"
#include <string.h>
#include <glib.h>
+#include "fs-sink.h"
#include "fs-sink-ctf-meta.h"
struct field_path_elem {
struct ctx {
bt_logging_level log_level;
+ bt_self_component *self_comp;
/* Weak */
struct fs_sink_ctf_stream_class *cur_sc;
is_reserved_member_name(ir_name, "timestamp_end") ||
is_reserved_member_name(ir_name, "events_discarded") ||
is_reserved_member_name(ir_name, "packet_seq_num")) {
- BT_LOGE("Unsupported reserved TSDL structure field class member "
+ BT_COMP_LOGE("Unsupported reserved TSDL structure field class member "
"or variant field class option name: name=\"%s\"",
ir_name);
ret = -1;
ret = fs_sink_ctf_protect_name(field_path_elem->name);
if (ret) {
- BT_LOGE("Unsupported non-TSDL structure field class member "
+ BT_COMP_LOGE("Unsupported non-TSDL structure field class member "
"or variant field class option name: name=\"%s\"",
ir_name);
goto end;
ret = cur_path_stack_push(ctx, i, name, memb_ir_fc,
(void *) struct_fc);
if (ret) {
- BT_LOGE("Cannot translate structure field class member: "
+ BT_COMP_LOGE("Cannot translate structure field class member: "
"name=\"%s\"", name);
goto end;
}
ret = translate_field_class(ctx);
if (ret) {
- BT_LOGE("Cannot translate structure field class member: "
+ BT_COMP_LOGE("Cannot translate structure field class member: "
"name=\"%s\"", name);
goto end;
}
opt);
ret = cur_path_stack_push(ctx, i, name, opt_ir_fc, (void *) fc);
if (ret) {
- BT_LOGE("Cannot translate variant field class option: "
+ BT_COMP_LOGE("Cannot translate variant field class option: "
"name=\"%s\"", name);
goto end;
}
ret = translate_field_class(ctx);
if (ret) {
- BT_LOGE("Cannot translate variant field class option: "
+ BT_COMP_LOGE("Cannot translate variant field class option: "
"name=\"%s\"", name);
goto end;
}
ret = cur_path_stack_push(ctx, UINT64_C(-1), NULL, elem_ir_fc,
(void *) fc);
if (ret) {
- BT_LOGE_STR("Cannot translate static array field class element.");
+ BT_COMP_LOGE_STR("Cannot translate static array field class element.");
goto end;
}
ret = translate_field_class(ctx);
if (ret) {
- BT_LOGE_STR("Cannot translate static array field class element.");
+ BT_COMP_LOGE_STR("Cannot translate static array field class element.");
goto end;
}
ret = cur_path_stack_push(ctx, UINT64_C(-1), NULL, elem_ir_fc,
(void *) fc);
if (ret) {
- BT_LOGE_STR("Cannot translate dynamic array field class element.");
+ BT_COMP_LOGE_STR("Cannot translate dynamic array field class element.");
goto end;
}
ret = translate_field_class(ctx);
if (ret) {
- BT_LOGE_STR("Cannot translate dynamic array field class element.");
+ BT_COMP_LOGE_STR("Cannot translate dynamic array field class element.");
goto end;
}
BT_ASSERT(ctx->cur_path->len == 0);
ret = cur_path_stack_push(ctx, UINT64_C(-1), NULL, ir_fc, NULL);
if (ret) {
- BT_LOGE("Cannot translate scope structure field class: "
+ BT_COMP_LOGE("Cannot translate scope structure field class: "
"scope=%d", scope);
goto end;
}
ret = translate_structure_field_class_members(ctx, (void *) *fc, ir_fc);
if (ret) {
- BT_LOGE("Cannot translate scope structure field class: "
+ BT_COMP_LOGE("Cannot translate scope structure field class: "
"scope=%d", scope);
goto end;
}
}
static inline
-void ctx_init(struct ctx *ctx, bt_logging_level log_level)
+void ctx_init(struct ctx *ctx, struct fs_sink_comp *fs_sink)
{
memset(ctx, 0, sizeof(struct ctx));
ctx->cur_path = g_array_new(FALSE, TRUE,
sizeof(struct field_path_elem));
BT_ASSERT(ctx->cur_path);
- ctx->log_level = log_level;
+ ctx->log_level = fs_sink->log_level;
+ ctx->self_comp = fs_sink->self_comp;
}
static inline
}
static
-int translate_event_class(struct fs_sink_ctf_stream_class *sc,
+int translate_event_class(struct fs_sink_comp *fs_sink,
+ struct fs_sink_ctf_stream_class *sc,
const bt_event_class *ir_ec,
- struct fs_sink_ctf_event_class **out_ec,
- bt_logging_level log_level)
+ struct fs_sink_ctf_event_class **out_ec)
{
int ret = 0;
struct ctx ctx;
BT_ASSERT(sc);
BT_ASSERT(ir_ec);
- ctx_init(&ctx, log_level);
+ ctx_init(&ctx, fs_sink);
ec = fs_sink_ctf_event_class_create(sc, ir_ec);
BT_ASSERT(ec);
ctx.cur_sc = sc;
BT_HIDDEN
int try_translate_event_class_trace_ir_to_ctf_ir(
+ struct fs_sink_comp *fs_sink,
struct fs_sink_ctf_stream_class *sc,
const bt_event_class *ir_ec,
- struct fs_sink_ctf_event_class **out_ec,
- bt_logging_level log_level)
+ struct fs_sink_ctf_event_class **out_ec)
{
int ret = 0;
goto end;
}
- ret = translate_event_class(sc, ir_ec, out_ec, log_level);
+ ret = translate_event_class(fs_sink, sc, ir_ec, out_ec);
end:
return ret;
}
static
-int translate_stream_class(struct fs_sink_ctf_trace_class *tc,
+int translate_stream_class(struct fs_sink_comp *fs_sink,
+ struct fs_sink_ctf_trace_class *tc,
const bt_stream_class *ir_sc,
- struct fs_sink_ctf_stream_class **out_sc,
- bt_logging_level log_level)
+ struct fs_sink_ctf_stream_class **out_sc)
{
int ret = 0;
struct ctx ctx;
BT_ASSERT(tc);
BT_ASSERT(ir_sc);
- ctx_init(&ctx, log_level);
+ ctx_init(&ctx, fs_sink);
*out_sc = fs_sink_ctf_stream_class_create(tc, ir_sc);
BT_ASSERT(*out_sc);
BT_HIDDEN
int try_translate_stream_class_trace_ir_to_ctf_ir(
+ struct fs_sink_comp *fs_sink,
struct fs_sink_ctf_trace_class *tc,
const bt_stream_class *ir_sc,
- struct fs_sink_ctf_stream_class **out_sc,
- bt_logging_level log_level)
+ struct fs_sink_ctf_stream_class **out_sc)
{
int ret = 0;
uint64_t i;
}
}
- ret = translate_stream_class(tc, ir_sc, out_sc, log_level);
+ ret = translate_stream_class(fs_sink, tc, ir_sc, out_sc);
end:
return ret;
BT_HIDDEN
struct fs_sink_ctf_trace_class *translate_trace_class_trace_ir_to_ctf_ir(
- const bt_trace_class *ir_tc, bt_logging_level log_level)
+ struct fs_sink_comp *fs_sink, const bt_trace_class *ir_tc)
{
uint64_t count;
uint64_t i;
ir_tc, i, &name, &val);
if (!fs_sink_ctf_ist_valid_identifier(name)) {
- BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level,
- BT_LOG_TAG,
+ BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, fs_sink->log_level,
+ fs_sink->self_comp,
"Unsupported trace class's environment entry name: "
"name=\"%s\"", name);
goto end;
case BT_VALUE_TYPE_STRING:
break;
default:
- BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level,
- BT_LOG_TAG,
+ BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, fs_sink->log_level,
+ fs_sink->self_comp,
"Unsupported trace class's environment entry value type: "
"type=%s",
bt_common_value_type_string(
#include "common/macros.h"
#include <babeltrace2/babeltrace.h>
+#include "fs-sink.h"
#include "fs-sink-ctf-meta.h"
BT_HIDDEN
int try_translate_event_class_trace_ir_to_ctf_ir(
+ struct fs_sink_comp *fs_sink,
struct fs_sink_ctf_stream_class *sc,
const bt_event_class *ir_ec,
- struct fs_sink_ctf_event_class **out_ec,
- bt_logging_level log_level);
+ struct fs_sink_ctf_event_class **out_ec);
BT_HIDDEN
int try_translate_stream_class_trace_ir_to_ctf_ir(
+ struct fs_sink_comp *fs_sink,
struct fs_sink_ctf_trace_class *tc,
const bt_stream_class *ir_sc,
- struct fs_sink_ctf_stream_class **out_sc,
- bt_logging_level log_level);
+ struct fs_sink_ctf_stream_class **out_sc);
BT_HIDDEN
struct fs_sink_ctf_trace_class *translate_trace_class_trace_ir_to_ctf_ir(
- const bt_trace_class *ir_tc, bt_logging_level log_level);
+ struct fs_sink_comp *fs_sink, const bt_trace_class *ir_tc);
#endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_TRANSLATE_TRACE_IR_TO_CTF_IR_H */