lib: do not allow any mapped clock class in trace's packet header FT
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 20 Dec 2017 22:33:15 +0000 (17:33 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 03:32:02 +0000 (23:32 -0400)
commit726106d3366acf096ca256a4cc12707f3561f06a
tree79853b866edb537d6273782a1f228b5638cda2c4
parent0e1c5a6c9a9375ca968acc15f52497d0af1536a6
lib: do not allow any mapped clock class in trace's packet header FT

Do not allow any integer field type to be mapped to a clock class within
the packet header field type of a trace.

This is one of the steps to ensure that a given stream class has only
one (if any) mapped clock class, recursively. More than one clock class
for a given stream class was never well supported anyway in CTF 1.8
because you cannot have multiple `timestamp_begin` and `timestamp_end`
fields.

It's also weird to have a clock value update in the packet header
because we don't have the value of `timestamp_begin` yet. Where would
this value be "located" on the timeline if `timestamp_begin` is the
absolute beginning timestamp of the packet containing said header?
Unless it is always the exact same value as `timestamp_begin` (which is
useless), it does not fit with the clock value update mechanism where,
as fields are decoded (or encoded), a given clock's value must be
updated monotonically: if the clock value found in the packet header is
less than `timestamp_begin`, then its lower bound is not
`timestamp_begin`.

The check is performed whenever the trace is about to be frozen (this
freezes the packet header field type) on success, that is:

* bt_trace_add_stream_class()
* bt_trace_set_is_static()

The check uses the new bt_validate_single_clock_class() internal
function. This one makes sure that a given field type recursively
contains only one clock class. You pass the expected clock class to the
function, or NULL so that the function sets it for you. In the trace
packet header field type case, even if this function returns 0
(success), that is, the field contains _at most_ one clock class, we
check that the returned expected clock class is still NULL to make sure
the field type in fact contains none.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
include/Makefile.am
include/babeltrace/ctf-ir/utils-internal.h [new file with mode: 0644]
lib/ctf-ir/trace.c
lib/ctf-ir/utils.c
This page took 0.024717 seconds and 4 git commands to generate.