From: Simon Marchi Date: Fri, 9 Feb 2024 21:24:07 +0000 (-0500) Subject: lib: rename bt_resolve_field_path_context to bt_resolve_field_xref_context X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=7a49c48cf3500a538c09b0a0fb677d5fada16490;p=babeltrace.git lib: rename bt_resolve_field_path_context to bt_resolve_field_xref_context In preparation to sharing some code with the field location resolving, rename bt_resolve_field_path_context to bt_resolve_field_xref_context, which will be used by both kinds of field cross-reference resolving. Move it to its own file, which will be included by both. Change-Id: Ia6b7e9fa9de76d16fa0244a66597c3a1bfb30271 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/7303 Tested-by: jenkins Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/7327 --- diff --git a/src/Makefile.am b/src/Makefile.am index e3c8e478..771c9de5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -466,6 +466,7 @@ lib_libbabeltrace2_la_SOURCES = \ lib/trace-ir/packet.h \ lib/trace-ir/resolve-field-path.c \ lib/trace-ir/resolve-field-path.h \ + lib/trace-ir/resolve-field-xref.h \ lib/trace-ir/stream.c \ lib/trace-ir/stream-class.c \ lib/trace-ir/stream-class.h \ diff --git a/src/lib/trace-ir/event-class.c b/src/lib/trace-ir/event-class.c index 76ad226b..63ab7133 100644 --- a/src/lib/trace-ir/event-class.c +++ b/src/lib/trace-ir/event-class.c @@ -281,7 +281,7 @@ bt_event_class_set_specific_context_field_class( { int ret; struct bt_stream_class *stream_class; - struct bt_resolve_field_path_context resolve_ctx = { + struct bt_resolve_field_xref_context resolve_ctx = { .packet_context = NULL, .event_common_context = NULL, .event_specific_context = field_class, @@ -347,7 +347,7 @@ bt_event_class_set_payload_field_class( { int ret; struct bt_stream_class *stream_class; - struct bt_resolve_field_path_context resolve_ctx = { + struct bt_resolve_field_xref_context resolve_ctx = { .packet_context = NULL, .event_common_context = NULL, .event_specific_context = NULL, diff --git a/src/lib/trace-ir/resolve-field-path.c b/src/lib/trace-ir/resolve-field-path.c index 46f6f14f..0cbbaf93 100644 --- a/src/lib/trace-ir/resolve-field-path.c +++ b/src/lib/trace-ir/resolve-field-path.c @@ -121,7 +121,7 @@ end: static struct bt_field_path *find_field_class_in_ctx(struct bt_field_class *fc, - struct bt_resolve_field_path_context *ctx) + struct bt_resolve_field_xref_context *ctx) { struct bt_field_path *field_path = NULL; int ret; @@ -201,7 +201,8 @@ end: BT_ASSERT_COND_DEV_FUNC static inline struct bt_field_class *borrow_root_field_class( - struct bt_resolve_field_path_context *ctx, enum bt_field_path_scope scope) + struct bt_resolve_field_xref_context *ctx, + enum bt_field_path_scope scope) { switch (scope) { case BT_FIELD_PATH_SCOPE_PACKET_CONTEXT: @@ -261,7 +262,7 @@ static inline bool target_field_path_in_different_scope_has_struct_fc_only( struct bt_field_path *src_field_path, struct bt_field_path *tgt_field_path, - struct bt_resolve_field_path_context *ctx) + struct bt_resolve_field_xref_context *ctx) { bool is_valid = true; uint64_t i = 0; @@ -300,7 +301,7 @@ BT_ASSERT_COND_DEV_FUNC static inline bool lca_is_structure_field_class(struct bt_field_path *src_field_path, struct bt_field_path *tgt_field_path, - struct bt_resolve_field_path_context *ctx) + struct bt_resolve_field_xref_context *ctx) { bool is_valid = true; struct bt_field_class *src_fc; @@ -356,7 +357,7 @@ BT_ASSERT_COND_DEV_FUNC static inline bool lca_to_target_has_struct_fc_only(struct bt_field_path *src_field_path, struct bt_field_path *tgt_field_path, - struct bt_resolve_field_path_context *ctx) + struct bt_resolve_field_xref_context *ctx) { bool is_valid = true; struct bt_field_class *src_fc; @@ -419,7 +420,7 @@ BT_ASSERT_COND_DEV_FUNC static inline bool field_path_is_valid(struct bt_field_class *src_fc, struct bt_field_class *tgt_fc, - struct bt_resolve_field_path_context *ctx) + struct bt_resolve_field_xref_context *ctx) { bool is_valid = true; struct bt_field_path *src_field_path = find_field_class_in_ctx( @@ -495,7 +496,7 @@ end: static struct bt_field_path *resolve_field_path(struct bt_field_class *src_fc, struct bt_field_class *tgt_fc, - struct bt_resolve_field_path_context *ctx, + struct bt_resolve_field_xref_context *ctx, const char *api_func) { BT_ASSERT_PRE_DEV_FROM_FUNC(api_func, "valid-field-class", @@ -506,7 +507,7 @@ struct bt_field_path *resolve_field_path(struct bt_field_class *src_fc, } int bt_resolve_field_paths(struct bt_field_class *fc, - struct bt_resolve_field_path_context *ctx, + struct bt_resolve_field_xref_context *ctx, const char *api_func) { int ret = 0; diff --git a/src/lib/trace-ir/resolve-field-path.h b/src/lib/trace-ir/resolve-field-path.h index 1f8cced4..f5867a70 100644 --- a/src/lib/trace-ir/resolve-field-path.h +++ b/src/lib/trace-ir/resolve-field-path.h @@ -13,16 +13,11 @@ #include #include #include +#include "resolve-field-xref.h" -struct bt_resolve_field_path_context { - struct bt_field_class *packet_context; - struct bt_field_class *event_common_context; - struct bt_field_class *event_specific_context; - struct bt_field_class *event_payload; -}; - -int bt_resolve_field_paths(struct bt_field_class *field_class, - struct bt_resolve_field_path_context *ctx, +int bt_resolve_field_paths( + struct bt_field_class *field_class, + struct bt_resolve_field_xref_context *ctx, const char *api_func); #endif /* BABELTRACE_LIB_TRACE_IR_RESOLVE_FIELD_PATH_H */ diff --git a/src/lib/trace-ir/resolve-field-xref.h b/src/lib/trace-ir/resolve-field-xref.h new file mode 100644 index 00000000..98f50e15 --- /dev/null +++ b/src/lib/trace-ir/resolve-field-xref.h @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright 2016-2018 Philippe Proulx + */ + +#ifndef BABELTRACE_LIB_TRACE_IR_RESOLVE_FIELD_XREF_H +#define BABELTRACE_LIB_TRACE_IR_RESOLVE_FIELD_XREF_H + +#include "lib/func-status.h" + +struct bt_resolve_field_xref_context { + struct bt_field_class *packet_context; + struct bt_field_class *event_common_context; + struct bt_field_class *event_specific_context; + struct bt_field_class *event_payload; +}; + +#endif /* BABELTRACE_LIB_TRACE_IR_RESOLVE_FIELD_XREF_H */ diff --git a/src/lib/trace-ir/stream-class.c b/src/lib/trace-ir/stream-class.c index c9970861..7ad12108 100644 --- a/src/lib/trace-ir/stream-class.c +++ b/src/lib/trace-ir/stream-class.c @@ -300,7 +300,7 @@ bt_stream_class_set_packet_context_field_class( struct bt_field_class *field_class) { int ret; - struct bt_resolve_field_path_context resolve_ctx = { + struct bt_resolve_field_xref_context resolve_ctx = { .packet_context = field_class, .event_common_context = NULL, .event_specific_context = NULL, @@ -365,7 +365,7 @@ bt_stream_class_set_event_common_context_field_class( struct bt_field_class *field_class) { int ret; - struct bt_resolve_field_path_context resolve_ctx = { + struct bt_resolve_field_xref_context resolve_ctx = { .packet_context = NULL, .event_common_context = field_class, .event_specific_context = NULL,