X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmetadata%2Fvisitor-generate-ir.c;h=a7ea0f0978f87cae6316560a3b026a8f936c88a0;hb=d6701381e38348beced306a0ad9947fb3fb8ad82;hp=604388b4cf2e17cf005a05ca9b9ab60911280f8f;hpb=498e7994d60bd0e9f63c3d5c0fd00eec77ba7c34;p=babeltrace.git diff --git a/src/plugins/ctf/common/metadata/visitor-generate-ir.c b/src/plugins/ctf/common/metadata/visitor-generate-ir.c index 604388b4..a7ea0f09 100644 --- a/src/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/src/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -1,30 +1,10 @@ /* - * ctf-visitor-generate-ir.c + * SPDX-License-Identifier: MIT * - * Common Trace Format metadata visitor (generates CTF IR objects). - * - * Based on older ctf-visitor-generate-io-struct.c. - * - * Copyright 2010 - Mathieu Desnoyers - * Copyright 2015-2018 - Philippe Proulx - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Copyright 2010 Mathieu Desnoyers + * Copyright 2015-2018 Philippe Proulx * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Common Trace Format metadata visitor (generates CTF IR objects). */ #define BT_COMP_LOG_SELF_COMP (ctx->log_cfg.self_comp) @@ -3741,6 +3721,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) _BT_COMP_LOGE_NODE(node, "Stream class has a `id` attribute, " "but trace has no packet header field class."); + ret = -EINVAL; goto error; } @@ -3750,6 +3731,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) _BT_COMP_LOGE_NODE(node, "Stream class has a `id` attribute, " "but trace's packet header field class has no `stream_id` field."); + ret = -EINVAL; goto error; } @@ -3758,6 +3740,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) _BT_COMP_LOGE_NODE(node, "Stream class has a `id` attribute, " "but trace's packet header field class's `stream_id` field is not an integer field class."); + ret = -EINVAL; goto error; } } else { @@ -3852,6 +3835,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) if (val != 1) { _BT_COMP_LOGE_NODE(node, "Invalid trace's `minor` attribute: expecting 1."); + ret = -EINVAL; goto error; } @@ -3876,6 +3860,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) if (val != 8) { _BT_COMP_LOGE_NODE(node, "Invalid trace's `minor` attribute: expecting 8."); + ret = -EINVAL; goto error; } @@ -4887,6 +4872,13 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor, goto end; } + /* Update structure/array/sequence alignments */ + ret = ctf_trace_class_update_alignments(ctx->ctf_tc); + if (ret) { + ret = -EINVAL; + goto end; + } + /* Resolve sequence lengths and variant tags */ ret = ctf_trace_class_resolve_field_classes(ctx->ctf_tc, &ctx->log_cfg); if (ret) {