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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:21 +0000 (11:58 -0400)
commitc27259b025303a64f2c1ae387bf9e34b95e401bb
tree33389ed4882f77ccc031b53ae281c9aa1c2e9d52
parent423fc6f7d2b3d05207c8c79bd10b620bf98740f8
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.025015 seconds and 4 git commands to generate.