X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Ffs-src%2Fmetadata.c;h=1576a9e76f2242ebd16bce7ce52f85a51f03ce32;hb=c4f23e30bf67d2523163614bc9461d84cbe1ae80;hp=08545027c088cf5488a7c3be84fbd0b6caad8e46;hpb=350ad6c1c5f45a4e90c33e3c1354125c209bbf02;p=babeltrace.git diff --git a/src/plugins/ctf/fs-src/metadata.c b/src/plugins/ctf/fs-src/metadata.c index 08545027..1576a9e7 100644 --- a/src/plugins/ctf/fs-src/metadata.c +++ b/src/plugins/ctf/fs-src/metadata.c @@ -23,13 +23,17 @@ * SOFTWARE. */ +#define BT_COMP_LOG_SELF_COMP self_comp +#define BT_LOG_OUTPUT_LEVEL log_level +#define BT_LOG_TAG "PLUGIN/SRC.CTF.FS/META" +#include "logging/comp-logging.h" + #include #include #include -#include #include "common/assert.h" #include -#include "compat/uuid.h" +#include "common/uuid.h" #include "compat/memstream.h" #include @@ -38,9 +42,6 @@ #include "metadata.h" #include "../common/metadata/decoder.h" -#define BT_LOG_TAG "PLUGIN/SRC.CTF.FS/META" -#include "logging.h" - BT_HIDDEN FILE *ctf_fs_metadata_open_file(const char *trace_path) { @@ -59,9 +60,10 @@ end: return fp; } -static struct ctf_fs_file *get_file(const char *trace_path) +static struct ctf_fs_file *get_file(const char *trace_path, + bt_logging_level log_level, bt_self_component *self_comp) { - struct ctf_fs_file *file = ctf_fs_file_create(); + struct ctf_fs_file *file = ctf_fs_file_create(log_level, self_comp); if (!file) { goto error; @@ -88,36 +90,42 @@ end: BT_HIDDEN int ctf_fs_metadata_set_trace_class( - bt_self_component_source *self_comp, + bt_self_component *self_comp, struct ctf_fs_trace *ctf_fs_trace, struct ctf_fs_metadata_config *config) { int ret = 0; struct ctf_fs_file *file = NULL; struct ctf_metadata_decoder_config decoder_config = { + .log_level = ctf_fs_trace->log_level, + .self_comp = self_comp, .clock_class_offset_s = config ? config->clock_class_offset_s : 0, .clock_class_offset_ns = config ? config->clock_class_offset_ns : 0, + .force_clock_class_origin_unix_epoch = + config ? config->force_clock_class_origin_unix_epoch : false, + .create_trace_class = true, }; + bt_logging_level log_level = ctf_fs_trace->log_level; - file = get_file(ctf_fs_trace->path->str); + file = get_file(ctf_fs_trace->path->str, log_level, self_comp); if (!file) { - BT_LOGE("Cannot create metadata file object"); + BT_COMP_LOGE("Cannot create metadata file object."); ret = -1; goto end; } - ctf_fs_trace->metadata->decoder = ctf_metadata_decoder_create(self_comp, - config ? &decoder_config : NULL); + ctf_fs_trace->metadata->decoder = ctf_metadata_decoder_create( + &decoder_config); if (!ctf_fs_trace->metadata->decoder) { - BT_LOGE("Cannot create metadata decoder object"); + BT_COMP_LOGE("Cannot create metadata decoder object."); ret = -1; goto end; } - ret = ctf_metadata_decoder_decode(ctf_fs_trace->metadata->decoder, - file->fp); + ret = ctf_metadata_decoder_append_content( + ctf_fs_trace->metadata->decoder, file->fp); if (ret) { - BT_LOGE("Cannot decode metadata file"); + BT_COMP_LOGE("Cannot update metadata decoder's content."); goto end; } @@ -145,9 +153,7 @@ int ctf_fs_metadata_init(struct ctf_fs_metadata *metadata) BT_HIDDEN void ctf_fs_metadata_fini(struct ctf_fs_metadata *metadata) { - if (metadata->text) { - free(metadata->text); - } + free(metadata->text); if (metadata->trace_class) { BT_TRACE_CLASS_PUT_REF_AND_RESET(metadata->trace_class);