sink.ctf.fs: write option field classes and fields
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 13 Aug 2019 00:16:09 +0000 (20:16 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
commitc25f8e53dc25a23d21d3e54a171b4c2dee0bd7eb
treeba380604f27eb4c78755c91279ba1d96ec9307e1
parent8f51247532cd8f116cf8650bd154b5585ea19827
sink.ctf.fs: write option field classes and fields

This patch makes a `sink.ctf.fs` component handle option field classes
and fields. Because CTF 1.8 has no option field class type, it makes a
best effort and translates it to a variant field class with two
options:

* An empty structure field class (option field contains nothing).
* The optional field class itself.

The tag field class is always generated before the variant field class
and is an 8-bit unsigned enumeration field class.

For example, a `sink.ctf.fs` component would translate an optional
string field class to:

    /*
     * This enumeration field class and the following variant field
     * class were a trace IR option field class.
     */
    enum : integer { size = 8; align = 8; } {
        none = 0,
        content = 1,
    } __module_name_tag;
    variant <__module_name_tag> {
        struct { } none;
        string { encoding = UTF8; } content;
    } module_name;

When a `src.ctf.fs` component reads a trace generated by `sink.ctf.fs`
where the input trace IR contained option field classes, the
corresponding variant field classes will stay variant field classes; the
source component has no way to determine if the metadata describes an
option field class or a genuine variant field class. However, the CTF
1.8 to CTF 1.8 scenario will always be unambiguous because a
`src.ctf.fs` component never creates option field classes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ib83e011f73795d70cd8545f55ea87e0bf10b68bc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1901
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/plugins/ctf/fs-sink/fs-sink-ctf-meta.h
src/plugins/ctf/fs-sink/fs-sink-stream.c
src/plugins/ctf/fs-sink/translate-ctf-ir-to-tsdl.c
src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c
This page took 0.027411 seconds and 4 git commands to generate.