#include <babeltrace/ctf-ir/validation-internal.h>
#include <babeltrace/ctf-ir/visitor-internal.h>
#include <babeltrace/ctf-ir/utils.h>
+#include <babeltrace/ctf-ir/utils-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/values.h>
#include <babeltrace/values-internal.h>
return is_valid;
}
+static
+int check_packet_header_type_has_no_clock_class(struct bt_trace *trace)
+{
+ int ret = 0;
+
+ if (trace->packet_header_type) {
+ struct bt_clock_class *clock_class = NULL;
+
+ ret = bt_validate_single_clock_class(trace->packet_header_type,
+ &clock_class);
+ bt_put(clock_class);
+ if (ret || clock_class) {
+ BT_LOGW("Trace's packet header field type cannot "
+ "contain a field type which is mapped to "
+ "a clock class: "
+ "trace-addr=%p, trace-name=\"%s\", "
+ "clock-class-name=\"%s\"",
+ trace, bt_trace_get_name(trace),
+ clock_class ?
+ bt_clock_class_get_name(clock_class) :
+ NULL);
+ ret = -1;
+ }
+ }
+
+ return ret;
+}
+
int bt_trace_add_stream_class(struct bt_trace *trace,
struct bt_stream_class *stream_class)
{
}
}
+ ret = check_packet_header_type_has_no_clock_class(trace);
+ if (ret) {
+ /* check_packet_header_type_has_no_clock_class() logs errors */
+ goto end;
+ }
+
/*
* We're about to freeze both the trace and the stream class.
* Also, each event class contained in this stream class are
goto end;
}
+ ret = check_packet_header_type_has_no_clock_class(trace);
+ if (ret) {
+ /* check_packet_header_type_has_no_clock_class() logs errors */
+ goto end;
+ }
+
trace->is_static = BT_TRUE;
bt_trace_freeze(trace);
BT_LOGV("Set trace static: addr=%p, name=\"%s\"",