-
- return NULL;
-}
-
-static
-int reset_event_decl_types(struct ctx *ctx,
- struct bt_ctf_event_class *event_class)
-{
- int ret = 0;
- _BT_CTF_FIELD_TYPE_INIT(decl);
-
- /* Event context */
- decl = bt_ctf_field_type_structure_create();
- if (!decl) {
- _PERROR("%s", "cannot create initial, empty event context structure");
- ret = -ENOMEM;
- goto error;
- }
-
- ret = bt_ctf_event_class_set_context_type(event_class, decl);
- BT_PUT(decl);
- if (ret) {
- _PERROR("%s", "cannot set initial, empty event context structure");
- goto error;
- }
-
- /* Event payload */
- decl = bt_ctf_field_type_structure_create();
- if (!decl) {
- _PERROR("%s", "cannot create initial, empty event payload structure");
- ret = -ENOMEM;
- goto error;
- }
-
- ret = bt_ctf_event_class_set_payload_type(event_class, decl);
- BT_PUT(decl);
- if (ret) {
- _PERROR("%s", "cannot set initial, empty event payload structure");
- goto error;
- }
-
- return 0;
-
-error:
- BT_PUT(decl);
-
- return ret;
-}
-
-static
-int reset_stream_decl_types(struct ctx *ctx,
- struct bt_ctf_stream_class *stream_class)
-{
- int ret = 0;
- _BT_CTF_FIELD_TYPE_INIT(decl);
-
- /* Packet context */
- decl = bt_ctf_field_type_structure_create();
- if (!decl) {
- _PERROR("%s", "cannot create initial, empty packet context structure");
- ret = -ENOMEM;
- goto error;
- }
-
- ret = bt_ctf_stream_class_set_packet_context_type(stream_class, decl);
- BT_PUT(decl);
- if (ret) {
- _PERROR("%s", "cannot set initial, empty packet context structure");
- goto error;
- }
-
- /* Event header */
- decl = bt_ctf_field_type_structure_create();
- if (!decl) {
- _PERROR("%s", "cannot create initial, empty event header structure");
- ret = -ENOMEM;
- goto error;
- }
-
- ret = bt_ctf_stream_class_set_event_header_type(stream_class, decl);
- BT_PUT(decl);
- if (ret) {
- _PERROR("%s", "cannot set initial, empty event header structure");
- goto error;
- }
-
- /* Event context */
- decl = bt_ctf_field_type_structure_create();
- if (!decl) {
- _PERROR("%s", "cannot create initial, empty stream event context structure");
- ret = -ENOMEM;
- goto error;
- }
-
- ret = bt_ctf_stream_class_set_event_context_type(stream_class, decl);
- BT_PUT(decl);
- if (ret) {
- _PERROR("%s", "cannot set initial, empty stream event context structure");
- goto error;
- }
-
- return 0;
-
-error:
- BT_PUT(decl);
-
- return ret;
-}
-
-static
-struct bt_ctf_stream_class *create_reset_stream_class(struct ctx *ctx)
-{
- int ret;
- struct bt_ctf_stream_class *stream_class;
-
- stream_class = bt_ctf_stream_class_create(NULL);
- if (!stream_class) {
- _PERROR("%s", "cannot create stream class");
- goto error;
- }
-
- /*
- * Set packet context, event header, and event context to empty
- * structures to override the default ones.
- */
- ret = reset_stream_decl_types(ctx, stream_class);
- if (ret) {
- goto error;
- }
-
- return stream_class;
-
-error:
- BT_PUT(stream_class);
-