X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fctf-ir%2Ftrace.c;h=067e7db903d0937d494f6aecaa909270313bf06d;hb=5acf2ae6bdfb2bc6fa88e250a87ccc6ba3546d89;hp=b850b4ffe6e35495fcc07bad3eea2c2105a41a75;hpb=c1e730febb17c72e96c356d54b8df31d5c0c0b94;p=babeltrace.git diff --git a/lib/ctf-ir/trace.c b/lib/ctf-ir/trace.c index b850b4ff..067e7db9 100644 --- a/lib/ctf-ir/trace.c +++ b/lib/ctf-ir/trace.c @@ -389,7 +389,8 @@ int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace, { int ret = 0; - if (!trace || !bt_ctf_clock_class_is_valid(clock_class)) { + if (!trace || trace->is_static || + !bt_ctf_clock_class_is_valid(clock_class)) { ret = -1; goto end; } @@ -457,7 +458,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, int event_class_count; struct bt_ctf_trace *current_parent_trace = NULL; - if (!trace || !stream_class) { + if (!trace || !stream_class || trace->is_static) { ret = -1; goto end; } @@ -1300,3 +1301,33 @@ end: bt_put(trace_packet_header_type); return ret; } + +bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace) +{ + bool is_static = false; + + if (!trace) { + goto end; + } + + is_static = trace->is_static; + +end: + return is_static; +} + +int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace) +{ + int ret = 0; + + if (!trace) { + ret = -1; + goto end; + } + + trace->is_static = true; + bt_ctf_trace_freeze(trace); + +end: + return ret; +}