lib: rename bt_resolve_field_path_context to bt_resolve_field_xref_context
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 9 Feb 2024 21:24:07 +0000 (16:24 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7303
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7327

src/Makefile.am
src/lib/trace-ir/event-class.c
src/lib/trace-ir/resolve-field-path.c
src/lib/trace-ir/resolve-field-path.h
src/lib/trace-ir/resolve-field-xref.h [new file with mode: 0644]
src/lib/trace-ir/stream-class.c

index e3c8e4787cfd41e9429ff6b1b287238442fd2b01..771c9de56fa13b2890ba891e1afddd4acfcef69c 100644 (file)
@@ -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 \
index 76ad226bf2b532425c2d8b2a372cf360c9a43dea..63ab71334653b123b107c1f5c681f7c49fb3be39 100644 (file)
@@ -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,
index 46f6f14fa54e39dd27b67040bda976a02fcaf913..0cbbaf93e39b6be8b523e471348cb8a063568d2c 100644 (file)
@@ -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;
index 1f8cced44692532cebfa198db5bf3be9efc0f557..f5867a7056a47a67b013074c47757da89d10fdbc 100644 (file)
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field-path.h>
 #include <glib.h>
+#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 (file)
index 0000000..98f50e1
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright 2016-2018 Philippe Proulx <pproulx@efficios.com>
+ */
+
+#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 */
index c997086101cee2a48707d976beb8fd4ff9d6be4e..7ad1210851c9b4bc76ebfa0b24ed2004bda4bc33 100644 (file)
@@ -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,
This page took 0.031003 seconds and 4 git commands to generate.