From e5be10efe4d5543ba697c7e607ca0a5c33fa3ccb Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 20 Nov 2018 23:55:52 -0500 Subject: [PATCH] Trace IR and notification APIs: split into private and public APIs Signed-off-by: Philippe Proulx --- include/Makefile.am | 22 +- include/babeltrace/babeltrace.h | 20 +- include/babeltrace/graph/component-internal.h | 9 + include/babeltrace/graph/component.h | 8 +- include/babeltrace/graph/notification-event.h | 12 - .../graph/notification-inactivity.h | 15 - .../babeltrace/graph/notification-iterator.h | 7 - .../babeltrace/graph/notification-packet.h | 31 -- .../babeltrace/graph/notification-stream.h | 41 --- .../graph/private-notification-event.h | 52 ++++ .../graph/private-notification-inactivity.h | 48 +++ .../graph/private-notification-packet.h | 58 ++++ .../graph/private-notification-stream.h | 66 +++++ .../clock.h => graph/private-notification.h} | 27 +- include/babeltrace/graph/private-port.h | 4 + include/babeltrace/trace-ir/clock-class.h | 26 -- include/babeltrace/trace-ir/clock-value.h | 2 - include/babeltrace/trace-ir/event-class.h | 25 -- include/babeltrace/trace-ir/event-internal.h | 2 +- include/babeltrace/trace-ir/event.h | 12 - include/babeltrace/trace-ir/field-classes.h | 63 ---- include/babeltrace/trace-ir/field-path.h | 2 - include/babeltrace/trace-ir/fields.h | 29 -- include/babeltrace/trace-ir/packet.h | 28 -- .../babeltrace/trace-ir/private-clock-class.h | 79 +++++ .../babeltrace/trace-ir/private-event-class.h | 88 ++++++ ...t-field.h => private-event-header-field.h} | 23 +- include/babeltrace/trace-ir/private-event.h | 78 +++++ .../trace-ir/private-field-classes.h | 151 ++++++++++ include/babeltrace/trace-ir/private-fields.h | 97 ++++++ ...field.h => private-packet-context-field.h} | 23 +- ...-field.h => private-packet-header-field.h} | 23 +- include/babeltrace/trace-ir/private-packet.h | 88 ++++++ .../trace-ir/private-stream-class.h | 128 ++++++++ include/babeltrace/trace-ir/private-stream.h | 60 ++++ include/babeltrace/trace-ir/private-trace.h | 122 ++++++++ include/babeltrace/trace-ir/stream-class.h | 44 --- include/babeltrace/trace-ir/stream.h | 12 - include/babeltrace/trace-ir/trace.h | 40 --- lib/graph/component.c | 13 +- lib/graph/iterator.c | 3 +- lib/graph/notification/event.c | 19 +- lib/graph/notification/inactivity.c | 12 +- lib/graph/notification/notification.c | 7 + lib/graph/notification/packet.c | 29 +- lib/graph/notification/stream.c | 45 ++- lib/trace-ir/clock-class.c | 49 +++- lib/trace-ir/event-class.c | 83 ++++-- lib/trace-ir/event-header-field.c | 14 +- lib/trace-ir/event.c | 55 +++- lib/trace-ir/field-classes.c | 263 +++++++++++------ lib/trace-ir/field-path.c | 1 + lib/trace-ir/fields.c | 95 ++++-- lib/trace-ir/packet-context-field.c | 16 +- lib/trace-ir/packet-header-field.c | 14 +- lib/trace-ir/packet.c | 71 +++-- lib/trace-ir/resolve-field-path.c | 1 + lib/trace-ir/stream-class.c | 158 +++++++--- lib/trace-ir/stream.c | 37 ++- lib/trace-ir/trace.c | 110 +++++-- plugins/ctf/common/metadata/ast.h | 2 +- .../ctf/common/metadata/ctf-meta-translate.c | 195 +++++++------ .../ctf-meta-update-default-clock-classes.c | 15 +- .../ctf/common/metadata/ctf-meta-visitors.h | 2 +- plugins/ctf/common/metadata/ctf-meta.h | 23 +- plugins/ctf/common/metadata/decoder.c | 2 +- plugins/ctf/common/metadata/decoder.h | 2 +- .../ctf/common/metadata/visitor-generate-ir.c | 60 ++-- plugins/ctf/common/notif-iter/notif-iter.c | 276 ++++++++++-------- plugins/ctf/common/notif-iter/notif-iter.h | 10 +- plugins/ctf/fs-src/data-stream-file.c | 26 +- plugins/ctf/fs-src/data-stream-file.h | 13 +- plugins/ctf/fs-src/fs.c | 47 +-- plugins/ctf/fs-src/fs.h | 8 +- plugins/ctf/fs-src/query.c | 8 +- plugins/libctfcopytrace/ctfcopytrace.c | 6 +- plugins/text/dmesg/dmesg.c | 111 +++---- tests/lib/test_bt_notification_iterator.c | 218 +++++++------- tests/lib/test_trace_ir_ref.c | 206 +++++++------ 79 files changed, 2651 insertions(+), 1339 deletions(-) create mode 100644 include/babeltrace/graph/private-notification-event.h create mode 100644 include/babeltrace/graph/private-notification-inactivity.h create mode 100644 include/babeltrace/graph/private-notification-packet.h create mode 100644 include/babeltrace/graph/private-notification-stream.h rename include/babeltrace/{trace-ir/clock.h => graph/private-notification.h} (71%) create mode 100644 include/babeltrace/trace-ir/private-clock-class.h create mode 100644 include/babeltrace/trace-ir/private-event-class.h rename include/babeltrace/trace-ir/{packet-context-field.h => private-event-header-field.h} (68%) create mode 100644 include/babeltrace/trace-ir/private-event.h create mode 100644 include/babeltrace/trace-ir/private-field-classes.h create mode 100644 include/babeltrace/trace-ir/private-fields.h rename include/babeltrace/trace-ir/{packet-header-field.h => private-packet-context-field.h} (67%) rename include/babeltrace/trace-ir/{event-header-field.h => private-packet-header-field.h} (68%) create mode 100644 include/babeltrace/trace-ir/private-packet.h create mode 100644 include/babeltrace/trace-ir/private-stream-class.h create mode 100644 include/babeltrace/trace-ir/private-stream.h create mode 100644 include/babeltrace/trace-ir/private-trace.h diff --git a/include/Makefile.am b/include/Makefile.am index 5af4a446..842a63d6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -122,13 +122,22 @@ babeltracetraceirinclude_HEADERS = \ babeltrace/trace-ir/clock-value.h \ babeltrace/trace-ir/event-class.h \ babeltrace/trace-ir/event.h \ - babeltrace/trace-ir/event-header-field.h \ - babeltrace/trace-ir/field-path.h \ babeltrace/trace-ir/field-classes.h \ + babeltrace/trace-ir/field-path.h \ babeltrace/trace-ir/fields.h \ babeltrace/trace-ir/packet.h \ - babeltrace/trace-ir/packet-context-field.h \ - babeltrace/trace-ir/packet-header-field.h \ + babeltrace/trace-ir/private-clock-class.h \ + babeltrace/trace-ir/private-event-class.h \ + babeltrace/trace-ir/private-event-header-field.h \ + babeltrace/trace-ir/private-event.h \ + babeltrace/trace-ir/private-field-classes.h \ + babeltrace/trace-ir/private-fields.h \ + babeltrace/trace-ir/private-packet-context-field.h \ + babeltrace/trace-ir/private-packet-header-field.h \ + babeltrace/trace-ir/private-packet.h \ + babeltrace/trace-ir/private-stream-class.h \ + babeltrace/trace-ir/private-stream.h \ + babeltrace/trace-ir/private-trace.h \ babeltrace/trace-ir/stream-class.h \ babeltrace/trace-ir/stream.h \ babeltrace/trace-ir/trace.h @@ -168,6 +177,11 @@ babeltracegraphinclude_HEADERS = \ babeltrace/graph/private-connection-notification-iterator.h \ babeltrace/graph/private-connection-private-notification-iterator.h \ babeltrace/graph/private-connection.h \ + babeltrace/graph/private-notification-event.h \ + babeltrace/graph/private-notification-inactivity.h \ + babeltrace/graph/private-notification-packet.h \ + babeltrace/graph/private-notification-stream.h \ + babeltrace/graph/private-notification.h \ babeltrace/graph/private-port.h \ babeltrace/graph/query-executor.h diff --git a/include/babeltrace/babeltrace.h b/include/babeltrace/babeltrace.h index f1738a29..2cf04c80 100644 --- a/include/babeltrace/babeltrace.h +++ b/include/babeltrace/babeltrace.h @@ -66,14 +66,23 @@ #include #include #include -#include #include #include #include #include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -109,6 +118,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include diff --git a/include/babeltrace/graph/component-internal.h b/include/babeltrace/graph/component-internal.h index 13e632ed..682b250e 100644 --- a/include/babeltrace/graph/component-internal.h +++ b/include/babeltrace/graph/component-internal.h @@ -45,6 +45,8 @@ struct bt_component_destroy_listener { void *data; }; +struct bt_graph; + struct bt_component { struct bt_object base; struct bt_component_class *class; @@ -76,6 +78,13 @@ struct bt_private_component *bt_private_component_from_component( return (void *) component; } +static inline +struct bt_graph *bt_component_borrow_graph(struct bt_component *comp) +{ + BT_ASSERT(comp); + return (void *) bt_object_borrow_parent(&comp->base); +} + BT_HIDDEN enum bt_component_status bt_component_create( struct bt_component_class *component_class, diff --git a/include/babeltrace/graph/component.h b/include/babeltrace/graph/component.h index c35685aa..efcb9848 100644 --- a/include/babeltrace/graph/component.h +++ b/include/babeltrace/graph/component.h @@ -87,13 +87,7 @@ bt_bool bt_component_is_sink(struct bt_component *component) BT_COMPONENT_CLASS_TYPE_SINK; } -extern struct bt_graph *bt_component_borrow_graph(struct bt_component *component); - -static inline -struct bt_graph *bt_component_get_graph(struct bt_component *component) -{ - return bt_object_get_ref(bt_component_borrow_graph(component)); -} +extern bt_bool bt_component_graph_is_canceled(struct bt_component *component); #ifdef __cplusplus } diff --git a/include/babeltrace/graph/notification-event.h b/include/babeltrace/graph/notification-event.h index 888ab038..563a5fd0 100644 --- a/include/babeltrace/graph/notification-event.h +++ b/include/babeltrace/graph/notification-event.h @@ -2,8 +2,6 @@ #define BABELTRACE_GRAPH_NOTIFICATION_EVENT_H /* - * BabelTrace - Plug-in Event Notification - * * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -27,22 +25,12 @@ * SOFTWARE. */ -/* For bt_object_get_ref() */ -#include - #ifdef __cplusplus extern "C" { #endif struct bt_notification; -struct bt_private_connection_private_notification_iterator; struct bt_event; -struct bt_event_class; - -extern -struct bt_notification *bt_notification_event_create( - struct bt_private_connection_private_notification_iterator *notification_iterator, - struct bt_event_class *event_class, struct bt_packet *packet); extern struct bt_event *bt_notification_event_borrow_event( struct bt_notification *notification); diff --git a/include/babeltrace/graph/notification-inactivity.h b/include/babeltrace/graph/notification-inactivity.h index 5de4dd28..947634cf 100644 --- a/include/babeltrace/graph/notification-inactivity.h +++ b/include/babeltrace/graph/notification-inactivity.h @@ -23,27 +23,12 @@ * SOFTWARE. */ -#include - -/* For bt_bool */ -#include - #ifdef __cplusplus extern "C" { #endif struct bt_notification; -struct bt_private_connection_private_notification_iterator; struct bt_clock_value; -struct bt_clock_class; - -extern -struct bt_notification *bt_notification_inactivity_create( - struct bt_private_connection_private_notification_iterator *notification_iterator, - struct bt_clock_class *default_clock_class); - -extern int bt_notification_inactivity_set_default_clock_value( - struct bt_notification *notif, uint64_t raw_value); extern struct bt_clock_value *bt_notification_inactivity_borrow_default_clock_value( struct bt_notification *notif); diff --git a/include/babeltrace/graph/notification-iterator.h b/include/babeltrace/graph/notification-iterator.h index bcf6a659..dc6f8706 100644 --- a/include/babeltrace/graph/notification-iterator.h +++ b/include/babeltrace/graph/notification-iterator.h @@ -2,8 +2,6 @@ #define BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_H /* - * BabelTrace - Notification Iterator - * * Copyright 2015 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -27,11 +25,6 @@ * SOFTWARE. */ -/* For bt_object_get_ref() */ -#include - -#include - #ifdef __cplusplus extern "C" { #endif diff --git a/include/babeltrace/graph/notification-packet.h b/include/babeltrace/graph/notification-packet.h index 356d2b4c..4380c64a 100644 --- a/include/babeltrace/graph/notification-packet.h +++ b/include/babeltrace/graph/notification-packet.h @@ -2,8 +2,6 @@ #define BABELTRACE_GRAPH_NOTIFICATION_PACKET_H /* - * BabelTrace - Plug-in Packet-related Notifications - * * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -27,48 +25,19 @@ * SOFTWARE. */ -/* For bt_object_get_ref() */ -#include - #ifdef __cplusplus extern "C" { #endif struct bt_notification; -struct bt_private_connection_private_notification_iterator; struct bt_packet; -extern -struct bt_notification *bt_notification_packet_begin_create( - struct bt_private_connection_private_notification_iterator *notification_iterator, - struct bt_packet *packet); - -extern -struct bt_notification *bt_notification_packet_end_create( - struct bt_private_connection_private_notification_iterator *notification_iterator, - struct bt_packet *packet); - - extern struct bt_packet *bt_notification_packet_begin_borrow_packet( struct bt_notification *notification); -static inline -struct bt_packet *bt_notification_packet_begin_get_packet( - struct bt_notification *notification) -{ - return bt_object_get_ref(bt_notification_packet_begin_borrow_packet(notification)); -} - extern struct bt_packet *bt_notification_packet_end_borrow_packet( struct bt_notification *notification); -static inline -struct bt_packet *bt_notification_packet_end_get_packet( - struct bt_notification *notification) -{ - return bt_object_get_ref(bt_notification_packet_end_borrow_packet(notification)); -} - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/graph/notification-stream.h b/include/babeltrace/graph/notification-stream.h index 67881e79..4283e32f 100644 --- a/include/babeltrace/graph/notification-stream.h +++ b/include/babeltrace/graph/notification-stream.h @@ -2,8 +2,6 @@ #define BABELTRACE_GRAPH_NOTIFICATION_STREAM_H /* - * BabelTrace - Plug-in Stream-related Notifications - * * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -27,63 +25,24 @@ * SOFTWARE. */ -#include - -/* For bt_object_get_ref() */ -#include - -/* For bt_bool */ -#include - #ifdef __cplusplus extern "C" { #endif struct bt_notification; struct bt_private_connection_private_notification_iterator; -struct bt_clock_class; struct bt_clock_value; struct bt_stream; -extern -struct bt_notification *bt_notification_stream_begin_create( - struct bt_private_connection_private_notification_iterator *notification_iterator, - struct bt_stream *stream); - -extern -struct bt_notification *bt_notification_stream_end_create( - struct bt_private_connection_private_notification_iterator *notification_iterator, - struct bt_stream *stream); - extern struct bt_stream *bt_notification_stream_begin_borrow_stream( struct bt_notification *notification); -static inline -struct bt_stream *bt_notification_stream_begin_get_stream( - struct bt_notification *notification) -{ - return bt_object_get_ref(bt_notification_stream_begin_borrow_stream(notification)); -} - -extern int bt_notification_stream_begin_set_default_clock_value( - struct bt_notification *notif, uint64_t value_cycles); - extern struct bt_clock_value *bt_notification_stream_begin_borrow_default_clock_value( struct bt_notification *notif); extern struct bt_stream *bt_notification_stream_end_borrow_stream( struct bt_notification *notification); -static inline -struct bt_stream *bt_notification_stream_end_get_stream( - struct bt_notification *notification) -{ - return bt_object_get_ref(bt_notification_stream_end_borrow_stream(notification)); -} - -extern int bt_notification_stream_end_set_default_clock_value( - struct bt_notification *notif, uint64_t value_cycles); - extern struct bt_clock_value *bt_notification_stream_end_borrow_default_clock_value( struct bt_notification *notif); diff --git a/include/babeltrace/graph/private-notification-event.h b/include/babeltrace/graph/private-notification-event.h new file mode 100644 index 00000000..c9a6ed47 --- /dev/null +++ b/include/babeltrace/graph/private-notification-event.h @@ -0,0 +1,52 @@ +#ifndef BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_EVENT_H +#define BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_EVENT_H + +/* + * Copyright 2016 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_private_notification; +struct bt_private_connection_private_notification_iterator; +struct bt_private_event; +struct bt_private_packet; +struct bt_private_event_class; + +extern +struct bt_private_notification *bt_private_notification_event_create( + struct bt_private_connection_private_notification_iterator *notification_iterator, + struct bt_private_event_class *event_class, + struct bt_private_packet *packet); + +extern struct bt_private_event * +bt_private_notification_event_borrow_private_event( + struct bt_private_notification *notification); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_EVENT_H */ diff --git a/include/babeltrace/graph/private-notification-inactivity.h b/include/babeltrace/graph/private-notification-inactivity.h new file mode 100644 index 00000000..ca6555ff --- /dev/null +++ b/include/babeltrace/graph/private-notification-inactivity.h @@ -0,0 +1,48 @@ +#ifndef BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_INACTIVITY_H +#define BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_INACTIVITY_H + +/* + * Copyright 2017 Philippe Proulx + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_private_notification; +struct bt_private_connection_private_notification_iterator; +struct bt_clock_class; + +extern +struct bt_private_notification *bt_private_notification_inactivity_create( + struct bt_private_connection_private_notification_iterator *notification_iterator, + struct bt_clock_class *default_clock_class); + +extern int bt_private_notification_inactivity_set_default_clock_value( + struct bt_private_notification *notif, uint64_t raw_value); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_INACTIVITY_H */ diff --git a/include/babeltrace/graph/private-notification-packet.h b/include/babeltrace/graph/private-notification-packet.h new file mode 100644 index 00000000..a3971d44 --- /dev/null +++ b/include/babeltrace/graph/private-notification-packet.h @@ -0,0 +1,58 @@ +#ifndef BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_PACKET_H +#define BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_PACKET_H + +/* + * Copyright 2016 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_private_notification; +struct bt_private_connection_private_notification_iterator; +struct bt_private_packet; + +extern +struct bt_private_notification *bt_private_notification_packet_begin_create( + struct bt_private_connection_private_notification_iterator *notification_iterator, + struct bt_private_packet *packet); + +extern +struct bt_private_notification *bt_private_notification_packet_end_create( + struct bt_private_connection_private_notification_iterator *notification_iterator, + struct bt_private_packet *packet); + +extern struct bt_private_packet * +bt_private_notification_packet_begin_borrow_private_packet( + struct bt_private_notification *notification); + +extern struct bt_private_packet * +bt_private_notification_packet_end_borrow_private_packet( + struct bt_private_notification *notification); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_PACKET_H */ diff --git a/include/babeltrace/graph/private-notification-stream.h b/include/babeltrace/graph/private-notification-stream.h new file mode 100644 index 00000000..524fd29c --- /dev/null +++ b/include/babeltrace/graph/private-notification-stream.h @@ -0,0 +1,66 @@ +#ifndef BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_STREAM_H +#define BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_STREAM_H + +/* + * Copyright 2016 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_private_notification; +struct bt_private_connection_private_notification_iterator; +struct bt_private_stream; + +extern +struct bt_private_notification *bt_private_notification_stream_begin_create( + struct bt_private_connection_private_notification_iterator *notification_iterator, + struct bt_private_stream *stream); + +extern +struct bt_private_notification *bt_private_notification_stream_end_create( + struct bt_private_connection_private_notification_iterator *notification_iterator, + struct bt_private_stream *stream); + +extern struct bt_private_stream * +bt_private_notification_stream_begin_borrow_private_stream( + struct bt_private_notification *notification); + +extern int bt_private_notification_stream_begin_set_default_clock_value( + struct bt_private_notification *notif, uint64_t value_cycles); + +extern struct bt_private_stream * +bt_private_notification_stream_end_borrow_private_stream( + struct bt_private_notification *notification); + +extern int bt_private_notification_stream_end_set_default_clock_value( + struct bt_private_notification *notif, uint64_t value_cycles); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_STREAM_H */ diff --git a/include/babeltrace/trace-ir/clock.h b/include/babeltrace/graph/private-notification.h similarity index 71% rename from include/babeltrace/trace-ir/clock.h rename to include/babeltrace/graph/private-notification.h index 2fcf48f8..60d3e316 100644 --- a/include/babeltrace/trace-ir/clock.h +++ b/include/babeltrace/graph/private-notification.h @@ -1,10 +1,8 @@ -#ifndef BABELTRACE_TRACE_IR_CLOCK_H -#define BABELTRACE_TRACE_IR_CLOCK_H +#ifndef BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_H +#define BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_H /* - * BabelTrace - Trace IR: Clock - * - * Copyright 2018 Jérémie Galarneau + * Copyright 2015 Jérémie Galarneau * * Author: Jérémie Galarneau * @@ -25,11 +23,20 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * The Common Trace Format (CTF) Specification is available at - * http://www.efficios.com/ctf */ -#include +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_notification; +struct bt_private_notification; + +extern struct bt_notification *bt_notification_borrow_from_private( + struct bt_private_notification *priv_notif); + +#ifdef __cplusplus +} +#endif -#endif /* BABELTRACE_TRACE_IR_CLOCK_H */ +#endif /* BABELTRACE_GRAPH_PRIVATE_NOTIFICATION_H */ diff --git a/include/babeltrace/graph/private-port.h b/include/babeltrace/graph/private-port.h index 264de482..32dc463f 100644 --- a/include/babeltrace/graph/private-port.h +++ b/include/babeltrace/graph/private-port.h @@ -34,12 +34,16 @@ struct bt_private_connection; struct bt_port *bt_port_borrow_from_private( struct bt_private_port *private_port); + extern struct bt_private_connection *bt_private_port_get_private_connection( struct bt_private_port *private_port); + extern struct bt_private_component *bt_private_port_get_private_component( struct bt_private_port *private_port); + extern enum bt_port_status bt_private_port_remove_from_component( struct bt_private_port *private_port); + extern void *bt_private_port_get_user_data( struct bt_private_port *private_port); diff --git a/include/babeltrace/trace-ir/clock-class.h b/include/babeltrace/trace-ir/clock-class.h index f06a2b00..4ca27183 100644 --- a/include/babeltrace/trace-ir/clock-class.h +++ b/include/babeltrace/trace-ir/clock-class.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_CLOCK_CLASS_H /* - * BabelTrace - Trace IR: Clock class - * * Copyright 2013, 2014 Jérémie Galarneau * Copyright 2017-2018 Philippe Proulx * @@ -41,49 +39,25 @@ extern "C" { #endif struct bt_clock_class; -struct bt_clock_value; - -extern struct bt_clock_class *bt_clock_class_create(void); extern const char *bt_clock_class_get_name(struct bt_clock_class *clock_class); -extern int bt_clock_class_set_name(struct bt_clock_class *clock_class, - const char *name); - extern const char *bt_clock_class_get_description( struct bt_clock_class *clock_class); -extern int bt_clock_class_set_description(struct bt_clock_class *clock_class, - const char *description); - extern uint64_t bt_clock_class_get_frequency( struct bt_clock_class *clock_class); -extern int bt_clock_class_set_frequency(struct bt_clock_class *clock_class, - uint64_t freq); - extern uint64_t bt_clock_class_get_precision( struct bt_clock_class *clock_class); -extern int bt_clock_class_set_precision(struct bt_clock_class *clock_class, - uint64_t precision); - extern void bt_clock_class_get_offset(struct bt_clock_class *clock_class, int64_t *seconds, uint64_t *cycles); -extern int bt_clock_class_set_offset(struct bt_clock_class *clock_class, - int64_t seconds, uint64_t cycles); - extern bt_bool bt_clock_class_is_absolute(struct bt_clock_class *clock_class); -extern int bt_clock_class_set_is_absolute(struct bt_clock_class *clock_class, - bt_bool is_absolute); - extern bt_uuid bt_clock_class_get_uuid(struct bt_clock_class *clock_class); -extern int bt_clock_class_set_uuid(struct bt_clock_class *clock_class, - bt_uuid uuid); - extern int bt_clock_class_cycles_to_ns_from_origin( struct bt_clock_class *clock_class, uint64_t cycles, int64_t *ns_from_origin); diff --git a/include/babeltrace/trace-ir/clock-value.h b/include/babeltrace/trace-ir/clock-value.h index 0676fa01..c726f6ae 100644 --- a/include/babeltrace/trace-ir/clock-value.h +++ b/include/babeltrace/trace-ir/clock-value.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_CLOCK_VALUE_H /* - * BabelTrace - Trace IR: Clock class - * * Copyright 2013, 2014 Jérémie Galarneau * Copyright 2017 Philippe Proulx * diff --git a/include/babeltrace/trace-ir/event-class.h b/include/babeltrace/trace-ir/event-class.h index 39ae9160..769a8043 100644 --- a/include/babeltrace/trace-ir/event-class.h +++ b/include/babeltrace/trace-ir/event-class.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_EVENT_CLASS_H /* - * BabelTrace - Trace IR: Event class - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -62,49 +60,26 @@ enum bt_event_class_log_level { BT_EVENT_CLASS_LOG_LEVEL_DEBUG, }; -extern struct bt_event_class *bt_event_class_create( - struct bt_stream_class *stream_class); - -extern struct bt_event_class *bt_event_class_create_with_id( - struct bt_stream_class *stream_class, uint64_t id); - extern struct bt_stream_class *bt_event_class_borrow_stream_class( struct bt_event_class *event_class); extern const char *bt_event_class_get_name(struct bt_event_class *event_class); -extern int bt_event_class_set_name(struct bt_event_class *event_class, - const char *name); - extern uint64_t bt_event_class_get_id(struct bt_event_class *event_class); extern enum bt_property_availability bt_event_class_get_log_level( struct bt_event_class *event_class, enum bt_event_class_log_level *log_level); -extern int bt_event_class_set_log_level(struct bt_event_class *event_class, - enum bt_event_class_log_level log_level); - extern const char *bt_event_class_get_emf_uri( struct bt_event_class *event_class); -extern int bt_event_class_set_emf_uri(struct bt_event_class *event_class, - const char *emf_uri); - extern struct bt_field_class *bt_event_class_borrow_specific_context_field_class( struct bt_event_class *event_class); -extern int bt_event_class_set_specific_context_field_class( - struct bt_event_class *event_class, - struct bt_field_class *field_class); - extern struct bt_field_class *bt_event_class_borrow_payload_field_class( struct bt_event_class *event_class); -extern int bt_event_class_set_payload_field_class( - struct bt_event_class *event_class, - struct bt_field_class *field_class); - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/trace-ir/event-internal.h b/include/babeltrace/trace-ir/event-internal.h index 45f79387..11676fed 100644 --- a/include/babeltrace/trace-ir/event-internal.h +++ b/include/babeltrace/trace-ir/event-internal.h @@ -50,7 +50,7 @@ #include #define BT_ASSERT_PRE_EVENT_HOT(_event) \ - BT_ASSERT_PRE_HOT((_event), "Event", ": %!+e", (_event)) + BT_ASSERT_PRE_HOT(((struct bt_event *) (_event)), "Event", ": %!+e", (_event)) struct bt_event { struct bt_object base; diff --git a/include/babeltrace/trace-ir/event.h b/include/babeltrace/trace-ir/event.h index 574af841..edf99856 100644 --- a/include/babeltrace/trace-ir/event.h +++ b/include/babeltrace/trace-ir/event.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_EVENT_H /* - * BabelTrace - Trace IR: Event - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,9 +28,6 @@ * http://www.efficios.com/ctf */ -#include -#include - /* For enum bt_clock_value_status */ #include @@ -41,7 +36,6 @@ extern "C" { #endif struct bt_event; -struct bt_event_header_field; struct bt_clock_value; struct bt_event_class; struct bt_field; @@ -55,9 +49,6 @@ extern struct bt_stream *bt_event_borrow_stream(struct bt_event *event); extern struct bt_field *bt_event_borrow_header_field(struct bt_event *event); -extern int bt_event_move_header(struct bt_event *event, - struct bt_event_header_field *header); - extern struct bt_field *bt_event_borrow_common_context_field( struct bt_event *event); @@ -66,9 +57,6 @@ extern struct bt_field *bt_event_borrow_specific_context_field( extern struct bt_field *bt_event_borrow_payload_field(struct bt_event *event); -extern int bt_event_set_default_clock_value(struct bt_event *event, - uint64_t value_cycles); - extern enum bt_clock_value_status bt_event_borrow_default_clock_value( struct bt_event *event, struct bt_clock_value **clock_value); diff --git a/include/babeltrace/trace-ir/field-classes.h b/include/babeltrace/trace-ir/field-classes.h index 1a5ae540..e394c2b1 100644 --- a/include/babeltrace/trace-ir/field-classes.h +++ b/include/babeltrace/trace-ir/field-classes.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_FIELD_CLASSES_H /* - * BabelTrace - Trace IR: Event field classes - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,9 +28,6 @@ * http://www.efficios.com/ctf */ -/* For bt_object_get_ref() */ -#include - /* For bt_bool */ #include @@ -73,37 +68,16 @@ enum bt_field_class_integer_preferred_display_base { extern enum bt_field_class_type bt_field_class_get_type( struct bt_field_class *field_class); -extern struct bt_field_class *bt_field_class_unsigned_integer_create(void); - -extern struct bt_field_class *bt_field_class_signed_integer_create(void); - extern uint64_t bt_field_class_integer_get_field_value_range( struct bt_field_class *field_class); -extern int bt_field_class_integer_set_field_value_range( - struct bt_field_class *field_class, uint64_t size); - extern enum bt_field_class_integer_preferred_display_base bt_field_class_integer_get_preferred_display_base( struct bt_field_class *field_class); -extern int bt_field_class_integer_set_preferred_display_base( - struct bt_field_class *field_class, - enum bt_field_class_integer_preferred_display_base base); - -extern struct bt_field_class *bt_field_class_real_create(void); - extern bt_bool bt_field_class_real_is_single_precision( struct bt_field_class *field_class); -extern int bt_field_class_real_set_is_single_precision( - struct bt_field_class *field_class, - bt_bool is_single_precision); - -extern struct bt_field_class *bt_field_class_unsigned_enumeration_create(void); - -extern struct bt_field_class *bt_field_class_signed_enumeration_create(void); - extern uint64_t bt_field_class_enumeration_get_mapping_count( struct bt_field_class *field_class); @@ -141,18 +115,6 @@ extern int bt_field_class_signed_enumeration_get_mapping_labels_by_value( bt_field_class_enumeration_mapping_label_array *label_array, uint64_t *count); -extern int bt_field_class_unsigned_enumeration_map_range( - struct bt_field_class *field_class, const char *label, - uint64_t range_lower, uint64_t range_upper); - -extern int bt_field_class_signed_enumeration_map_range( - struct bt_field_class *field_class, const char *label, - int64_t range_lower, int64_t range_upper); - -extern struct bt_field_class *bt_field_class_string_create(void); - -extern struct bt_field_class *bt_field_class_structure_create(void); - extern uint64_t bt_field_class_structure_get_member_count( struct bt_field_class *field_class); @@ -164,17 +126,6 @@ extern struct bt_field_class *bt_field_class_structure_borrow_member_field_class_by_name( struct bt_field_class *field_class, const char *name); -extern int bt_field_class_structure_append_member( - struct bt_field_class *struct_field_class, const char *name, - struct bt_field_class *field_class); - -extern struct bt_field_class *bt_field_class_static_array_create( - struct bt_field_class *elem_field_class, - uint64_t length); - -extern struct bt_field_class *bt_field_class_dynamic_array_create( - struct bt_field_class *elem_field_class); - extern struct bt_field_class *bt_field_class_array_borrow_element_field_class( struct bt_field_class *field_class); @@ -185,20 +136,10 @@ extern struct bt_field_path * bt_field_class_dynamic_array_borrow_length_field_path( struct bt_field_class *field_class); -extern int bt_field_class_dynamic_array_set_length_field_class( - struct bt_field_class *field_class, - struct bt_field_class *length_field_class); - -extern struct bt_field_class *bt_field_class_variant_create(void); - extern struct bt_field_path * bt_field_class_variant_borrow_selector_field_path( struct bt_field_class *field_class); -extern int bt_field_class_variant_set_selector_field_class( - struct bt_field_class *field_class, - struct bt_field_class *selector_field_class); - extern uint64_t bt_field_class_variant_get_option_count( struct bt_field_class *field_class); @@ -211,10 +152,6 @@ struct bt_field_class *bt_field_class_variant_borrow_option_field_class_by_name( struct bt_field_class *field_class, const char *name); -extern int bt_field_class_variant_append_option( - struct bt_field_class *var_field_class, - const char *name, struct bt_field_class *field_class); - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/trace-ir/field-path.h b/include/babeltrace/trace-ir/field-path.h index 2556a6fb..4c3a8573 100644 --- a/include/babeltrace/trace-ir/field-path.h +++ b/include/babeltrace/trace-ir/field-path.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_FIELD_PATH_H /* - * BabelTrace - Trace IR: Field path - * * Copyright 2016-2018 Philippe Proulx * * Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/include/babeltrace/trace-ir/fields.h b/include/babeltrace/trace-ir/fields.h index 754d95d2..1a95f731 100644 --- a/include/babeltrace/trace-ir/fields.h +++ b/include/babeltrace/trace-ir/fields.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_FIELDS_H /* - * Babeltrace - Trace IR: Event Fields - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -32,9 +30,6 @@ #include -/* For bt_bool */ -#include - /* For enum bt_field_class_type */ #include @@ -44,7 +39,6 @@ extern "C" { struct bt_field; struct bt_field_class; -struct bt_field_class_enumeration_mapping_iterator; extern struct bt_field_class *bt_field_borrow_class(struct bt_field *field); @@ -52,18 +46,10 @@ extern enum bt_field_class_type bt_field_get_class_type(struct bt_field *field); extern int64_t bt_field_signed_integer_get_value(struct bt_field *field); -extern void bt_field_signed_integer_set_value(struct bt_field *field, - int64_t value); - extern uint64_t bt_field_unsigned_integer_get_value(struct bt_field *field); -extern void bt_field_unsigned_integer_set_value(struct bt_field *field, - uint64_t value); - extern double bt_field_real_get_value(struct bt_field *field); -extern void bt_field_real_set_value(struct bt_field *field, double value); - extern int bt_field_unsigned_enumeration_get_mapping_labels( struct bt_field *field, bt_field_class_enumeration_mapping_label_array *label_array, @@ -78,15 +64,6 @@ extern const char *bt_field_string_get_value(struct bt_field *field); extern uint64_t bt_field_string_get_length(struct bt_field *field); -extern int bt_field_string_set_value(struct bt_field *field, const char *value); - -extern int bt_field_string_append(struct bt_field *field, const char *value); - -extern int bt_field_string_append_with_length(struct bt_field *field, - const char *value, uint64_t length); - -extern int bt_field_string_clear(struct bt_field *field); - extern struct bt_field *bt_field_structure_borrow_member_field_by_index( struct bt_field *field, uint64_t index); @@ -98,12 +75,6 @@ extern uint64_t bt_field_array_get_length(struct bt_field *field); extern struct bt_field *bt_field_array_borrow_element_field_by_index( struct bt_field *field, uint64_t index); -extern int bt_field_dynamic_array_set_length(struct bt_field *field, - uint64_t length); - -extern int bt_field_variant_select_option_field(struct bt_field *field, - uint64_t index); - extern uint64_t bt_field_variant_get_selected_option_field_index( struct bt_field *field); diff --git a/include/babeltrace/trace-ir/packet.h b/include/babeltrace/trace-ir/packet.h index 15730161..30d48d6a 100644 --- a/include/babeltrace/trace-ir/packet.h +++ b/include/babeltrace/trace-ir/packet.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_PACKET_H /* - * BabelTrace - Trace IR: Stream packet - * * Copyright 2016 Philippe Proulx * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -46,56 +44,30 @@ struct bt_packet_context_field; struct bt_stream; struct bt_clock_value; -extern struct bt_packet *bt_packet_create(struct bt_stream *stream); - extern struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet); extern struct bt_field *bt_packet_borrow_header_field(struct bt_packet *packet); -extern -int bt_packet_move_header_field(struct bt_packet *packet, - struct bt_packet_header_field *header); - extern struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet); -extern -int bt_packet_move_context_field(struct bt_packet *packet, - struct bt_packet_context_field *context); - extern enum bt_clock_value_status bt_packet_borrow_default_beginning_clock_value( struct bt_packet *packet, struct bt_clock_value **clock_value); -extern -int bt_packet_set_default_beginning_clock_value(struct bt_packet *packet, - uint64_t value_cycles); - extern enum bt_clock_value_status bt_packet_borrow_default_end_clock_valeu( struct bt_packet *packet, struct bt_clock_value **clock_value); -extern -int bt_packet_set_default_end_clock_value(struct bt_packet *packet, - uint64_t value_cycles); - extern enum bt_property_availability bt_packet_get_discarded_event_counter_snapshot( struct bt_packet *packet, uint64_t *value); -extern -int bt_packet_set_discarded_event_counter_snapshot(struct bt_packet *packet, - uint64_t value); - extern enum bt_property_availability bt_packet_get_packet_counter_snapshot( struct bt_packet *packet, uint64_t *value); -extern -int bt_packet_set_packet_counter_snapshot(struct bt_packet *packet, - uint64_t value); - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/trace-ir/private-clock-class.h b/include/babeltrace/trace-ir/private-clock-class.h new file mode 100644 index 00000000..72ac937d --- /dev/null +++ b/include/babeltrace/trace-ir/private-clock-class.h @@ -0,0 +1,79 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_CLOCK_CLASS_H +#define BABELTRACE_TRACE_IR_PRIVATE_CLOCK_CLASS_H + +/* + * Copyright 2013, 2014 Jérémie Galarneau + * Copyright 2017-2018 Philippe Proulx + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#include + +/* For bt_bool, bt_uuid */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_clock_class; +struct bt_private_clock_class; + +extern struct bt_clock_class *bt_clock_class_borrow_from_private( + struct bt_private_clock_class *priv_clock_class); + +extern struct bt_private_clock_class *bt_private_clock_class_create(void); + +extern int bt_private_clock_class_set_name( + struct bt_private_clock_class *clock_class, + const char *name); + +extern int bt_private_clock_class_set_description( + struct bt_private_clock_class *clock_class, + const char *description); + +extern int bt_private_clock_class_set_frequency( + struct bt_private_clock_class *clock_class, uint64_t freq); + +extern int bt_private_clock_class_set_precision( + struct bt_private_clock_class *clock_class, + uint64_t precision); + +extern int bt_private_clock_class_set_offset( + struct bt_private_clock_class *clock_class, + int64_t seconds, uint64_t cycles); + +extern int bt_private_clock_class_set_is_absolute( + struct bt_private_clock_class *clock_class, + bt_bool is_absolute); + +extern int bt_private_clock_class_set_uuid( + struct bt_private_clock_class *clock_class, bt_uuid uuid); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_CLOCK_CLASS_H */ diff --git a/include/babeltrace/trace-ir/private-event-class.h b/include/babeltrace/trace-ir/private-event-class.h new file mode 100644 index 00000000..60251983 --- /dev/null +++ b/include/babeltrace/trace-ir/private-event-class.h @@ -0,0 +1,88 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_EVENT_CLASS_H +#define BABELTRACE_TRACE_IR_PRIVATE_EVENT_CLASS_H + +/* + * Copyright 2013, 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +/* For enum bt_event_class_log_level */ +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_event_class; +struct bt_private_event_class; +struct bt_private_stream_class; + +extern struct bt_event_class *bt_event_class_borrow_from_private( + struct bt_private_event_class *priv_event_class); + +extern struct bt_private_event_class *bt_private_event_class_create( + struct bt_private_stream_class *stream_class); + +extern struct bt_private_event_class *bt_private_event_class_create_with_id( + struct bt_private_stream_class *stream_class, uint64_t id); + +extern struct bt_private_stream_class * +bt_private_event_class_borrow_private_stream_class( + struct bt_private_event_class *event_class); + +extern int bt_private_event_class_set_name( + struct bt_private_event_class *event_class, const char *name); + +extern int bt_private_event_class_set_log_level( + struct bt_private_event_class *event_class, + enum bt_event_class_log_level log_level); + +extern int bt_private_event_class_set_emf_uri( + struct bt_private_event_class *event_class, + const char *emf_uri); + +extern struct bt_private_field_class * +bt_private_event_class_borrow_specific_context_private_field_class( + struct bt_private_event_class *event_class); + +extern int bt_private_event_class_set_specific_context_private_field_class( + struct bt_private_event_class *event_class, + struct bt_private_field_class *field_class); + +extern struct bt_private_field_class * +bt_private_event_class_borrow_payload_private_field_class( + struct bt_private_event_class *event_class); + +extern int bt_private_event_class_set_payload_private_field_class( + struct bt_private_event_class *event_class, + struct bt_private_field_class *field_class); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_EVENT_CLASS_H */ diff --git a/include/babeltrace/trace-ir/packet-context-field.h b/include/babeltrace/trace-ir/private-event-header-field.h similarity index 68% rename from include/babeltrace/trace-ir/packet-context-field.h rename to include/babeltrace/trace-ir/private-event-header-field.h index b21f82b9..ab7e827e 100644 --- a/include/babeltrace/trace-ir/packet-context-field.h +++ b/include/babeltrace/trace-ir/private-event-header-field.h @@ -1,5 +1,5 @@ -#ifndef BABELTRACE_TRACE_IR_PACKET_CONTEXT_FIELD_H -#define BABELTRACE_TRACE_IR_PACKET_CONTEXT_FIELD_H +#ifndef BABELTRACE_TRACE_IR_PRIVATE_EVENT_HEADER_FIELD_H +#define BABELTRACE_TRACE_IR_PRIVATE_EVENT_HEADER_FIELD_H /* * Copyright 2018 Philippe Proulx @@ -30,23 +30,24 @@ extern "C" { #endif -struct bt_stream_class; -struct bt_packet_context_field; -struct bt_field; +struct bt_private_stream_class; +struct bt_private_event_header_field; +struct bt_private_field; extern -struct bt_packet_context_field *bt_packet_context_field_create( - struct bt_stream_class *stream_class); +struct bt_private_event_header_field *bt_private_event_header_field_create( + struct bt_private_stream_class *stream_class); extern -struct bt_field *bt_packet_context_field_borrow_field( - struct bt_packet_context_field *field); +struct bt_private_field *bt_private_event_header_field_borrow_private_field( + struct bt_private_event_header_field *field); extern -void bt_packet_context_field_release(struct bt_packet_context_field *field); +void bt_private_event_header_field_release( + struct bt_private_event_header_field *field); #ifdef __cplusplus } #endif -#endif /* BABELTRACE_TRACE_IR_PACKET_CONTEXT_FIELD_H */ +#endif /* BABELTRACE_TRACE_IR_PRIVATE_EVENT_HEADER_FIELD_H */ diff --git a/include/babeltrace/trace-ir/private-event.h b/include/babeltrace/trace-ir/private-event.h new file mode 100644 index 00000000..3cca3052 --- /dev/null +++ b/include/babeltrace/trace-ir/private-event.h @@ -0,0 +1,78 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_EVENT_H +#define BABELTRACE_TRACE_IR_PRIVATE_EVENT_H + +/* + * Copyright 2013, 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_private_event; +struct bt_private_event_header_field; +struct bt_private_event_class; +struct bt_private_field; +struct bt_private_packet; + +extern struct bt_event *bt_event_borrow_from_private( + struct bt_private_event *priv_event); + +extern struct bt_private_event_class *bt_private_event_borrow_class( + struct bt_private_event *event); + +extern struct bt_private_packet *bt_private_event_borrow_packet( + struct bt_private_event *event); + +extern struct bt_private_stream *bt_private_event_borrow_stream( + struct bt_private_event *event); + +extern struct bt_private_field *bt_private_event_borrow_header_private_field( + struct bt_private_event *event); + +extern int bt_private_event_move_private_header_field( + struct bt_private_event *event, + struct bt_private_event_header_field *header); + +extern struct bt_private_field * +bt_private_event_borrow_common_context_private_field( + struct bt_private_event *event); + +extern struct bt_private_field * +bt_private_event_borrow_specific_context_private_field( + struct bt_private_event *event); + +extern struct bt_private_field *bt_private_event_borrow_payload_private_field( + struct bt_private_event *event); + +extern int bt_private_event_set_default_clock_value( + struct bt_private_event *event, uint64_t value_cycles); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_EVENT_H */ diff --git a/include/babeltrace/trace-ir/private-field-classes.h b/include/babeltrace/trace-ir/private-field-classes.h new file mode 100644 index 00000000..7463d3dc --- /dev/null +++ b/include/babeltrace/trace-ir/private-field-classes.h @@ -0,0 +1,151 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_FIELD_CLASSES_H +#define BABELTRACE_TRACE_IR_PRIVATE_FIELD_CLASSES_H + +/* + * Copyright 2013, 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +/* For bt_bool */ +#include + +/* For enum bt_field_class_integer_preferred_display_base */ +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_field_class; +struct bt_private_field_class; +struct bt_private_field_path; +struct bt_private_field_class_signed_enumeration_mapping_ranges; +struct bt_private_field_class_unsigned_enumeration_mapping_ranges; + +extern struct bt_field_class *bt_field_class_borrow_from_private( + struct bt_private_field_class *priv_field_class); + +extern struct bt_private_field_class * +bt_private_field_class_unsigned_integer_create(void); + +extern struct bt_private_field_class * +bt_private_field_class_signed_integer_create(void); + +extern int bt_private_field_class_integer_set_field_value_range( + struct bt_private_field_class *field_class, uint64_t size); + +extern int bt_private_field_class_integer_set_preferred_display_base( + struct bt_private_field_class *field_class, + enum bt_field_class_integer_preferred_display_base base); + +extern struct bt_private_field_class *bt_private_field_class_real_create(void); + +extern int bt_private_field_class_real_set_is_single_precision( + struct bt_private_field_class *field_class, + bt_bool is_single_precision); + +extern struct bt_private_field_class * +bt_private_field_class_unsigned_enumeration_create(void); + +extern struct bt_private_field_class * +bt_private_field_class_signed_enumeration_create(void); + +extern uint64_t bt_private_field_class_enumeration_get_mapping_count( + struct bt_private_field_class *field_class); + +extern int bt_private_field_class_unsigned_enumeration_map_range( + struct bt_private_field_class *field_class, const char *label, + uint64_t range_lower, uint64_t range_upper); + +extern int bt_private_field_class_signed_enumeration_map_range( + struct bt_private_field_class *field_class, const char *label, + int64_t range_lower, int64_t range_upper); + +extern struct bt_private_field_class * +bt_private_field_class_string_create(void); + +extern struct bt_private_field_class * +bt_private_field_class_structure_create(void); + +extern void bt_private_field_class_structure_borrow_private_member_by_index( + struct bt_private_field_class *struct_field_class, + uint64_t index, const char **name, + struct bt_private_field_class **field_class); + +extern +struct bt_private_field_class * +bt_private_field_class_structure_borrow_member_private_field_class_by_name( + struct bt_private_field_class *field_class, const char *name); + +extern int bt_private_field_class_structure_append_private_member( + struct bt_private_field_class *struct_field_class, + const char *name, struct bt_private_field_class *field_class); + +extern struct bt_private_field_class * +bt_private_field_class_static_array_create( + struct bt_private_field_class *elem_field_class, + uint64_t length); + +extern struct bt_private_field_class * +bt_private_field_class_dynamic_array_create( + struct bt_private_field_class *elem_field_class); + +extern struct bt_private_field_class * +bt_private_field_class_array_borrow_element_private_field_class( + struct bt_private_field_class *field_class); + +extern int bt_private_field_class_dynamic_array_set_length_private_field_class( + struct bt_private_field_class *field_class, + struct bt_private_field_class *length_field_class); + +extern struct bt_private_field_class * +bt_private_field_class_variant_create(void); + +extern int bt_private_field_class_variant_set_selector_private_field_class( + struct bt_private_field_class *field_class, + struct bt_private_field_class *selector_field_class); + +extern void bt_private_field_class_variant_borrow_private_option_by_index( + struct bt_private_field_class *variant_field_class, + uint64_t index, const char **name, + struct bt_private_field_class **field_class); + +extern +struct bt_private_field_class * +bt_private_field_class_variant_borrow_option_private_field_class_by_name( + struct bt_private_field_class *field_class, const char *name); + +extern int bt_private_field_class_variant_append_private_option( + struct bt_private_field_class *var_field_class, + const char *name, struct bt_private_field_class *field_class); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_FIELD_CLASSES_H */ diff --git a/include/babeltrace/trace-ir/private-fields.h b/include/babeltrace/trace-ir/private-fields.h new file mode 100644 index 00000000..4edc8636 --- /dev/null +++ b/include/babeltrace/trace-ir/private-fields.h @@ -0,0 +1,97 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_FIELDS_H +#define BABELTRACE_TRACE_IR_PRIVATE_FIELDS_H + +/* + * Copyright 2013, 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_field; +struct bt_private_field; +struct bt_private_field_class; + +extern struct bt_field *bt_field_borrow_from_private( + struct bt_private_field *priv_field); + +extern struct bt_private_field_class *bt_private_field_borrow_private_class( + struct bt_private_field *field); + +extern void bt_private_field_signed_integer_set_value( + struct bt_private_field *field, int64_t value); + +extern void bt_private_field_unsigned_integer_set_value( + struct bt_private_field *field, uint64_t value); + +extern void bt_private_field_real_set_value(struct bt_private_field *field, + double value); + +extern int bt_private_field_string_set_value(struct bt_private_field *field, + const char *value); + +extern int bt_private_field_string_append(struct bt_private_field *field, + const char *value); + +extern int bt_private_field_string_append_with_length( + struct bt_private_field *field, + const char *value, uint64_t length); + +extern int bt_private_field_string_clear(struct bt_private_field *field); + +extern struct bt_private_field * +bt_private_field_structure_borrow_member_private_field_by_index( + struct bt_private_field *field, uint64_t index); + +extern struct bt_private_field * +bt_private_field_structure_borrow_member_private_field_by_name( + struct bt_private_field *field, const char *name); + +extern struct bt_private_field * +bt_private_field_array_borrow_element_private_field_by_index( + struct bt_private_field *field, uint64_t index); + +extern int bt_private_field_dynamic_array_set_length( + struct bt_private_field *field, uint64_t length); + +extern int bt_private_field_variant_select_option_private_field( + struct bt_private_field *field, uint64_t index); + +extern uint64_t bt_private_field_variant_get_selected_option_private_field_index( + struct bt_private_field *field); + +extern struct bt_private_field * +bt_private_field_variant_borrow_selected_option_private_field( + struct bt_private_field *field); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_FIELDS_H */ diff --git a/include/babeltrace/trace-ir/packet-header-field.h b/include/babeltrace/trace-ir/private-packet-context-field.h similarity index 67% rename from include/babeltrace/trace-ir/packet-header-field.h rename to include/babeltrace/trace-ir/private-packet-context-field.h index 605b1b8f..08ce931c 100644 --- a/include/babeltrace/trace-ir/packet-header-field.h +++ b/include/babeltrace/trace-ir/private-packet-context-field.h @@ -1,5 +1,5 @@ -#ifndef BABELTRACE_TRACE_IR_PACKET_HEADER_FIELD_H -#define BABELTRACE_TRACE_IR_PACKET_HEADER_FIELD_H +#ifndef BABELTRACE_TRACE_IR_PRIVATE_PACKET_CONTEXT_FIELD_H +#define BABELTRACE_TRACE_IR_PRIVATE_PACKET_CONTEXT_FIELD_H /* * Copyright 2018 Philippe Proulx @@ -30,23 +30,24 @@ extern "C" { #endif -struct bt_trace; -struct bt_packet_header_field; -struct bt_field; +struct bt_private_stream_class; +struct bt_private_packet_context_field; +struct bt_private_field; extern -struct bt_packet_header_field *bt_packet_header_field_create( - struct bt_trace *trace); +struct bt_private_packet_context_field *bt_private_packet_context_field_create( + struct bt_private_stream_class *stream_class); extern -struct bt_field *bt_packet_header_field_borrow_field( - struct bt_packet_header_field *field); +struct bt_private_field *bt_private_packet_context_field_borrow_private_field( + struct bt_private_packet_context_field *field); extern -void bt_packet_header_field_release(struct bt_packet_header_field *field); +void bt_private_packet_context_field_release( + struct bt_private_packet_context_field *field); #ifdef __cplusplus } #endif -#endif /* BABELTRACE_TRACE_IR_PACKET_HEADER_FIELD_H */ +#endif /* BABELTRACE_TRACE_IR_PRIVATE_PACKET_CONTEXT_FIELD_H */ diff --git a/include/babeltrace/trace-ir/event-header-field.h b/include/babeltrace/trace-ir/private-packet-header-field.h similarity index 68% rename from include/babeltrace/trace-ir/event-header-field.h rename to include/babeltrace/trace-ir/private-packet-header-field.h index fa3719ed..4e616425 100644 --- a/include/babeltrace/trace-ir/event-header-field.h +++ b/include/babeltrace/trace-ir/private-packet-header-field.h @@ -1,5 +1,5 @@ -#ifndef BABELTRACE_TRACE_IR_EVENT_HEADER_FIELD_H -#define BABELTRACE_TRACE_IR_EVENT_HEADER_FIELD_H +#ifndef BABELTRACE_TRACE_IR_PRIVATE_PACKET_HEADER_FIELD_H +#define BABELTRACE_TRACE_IR_PRIVATE_PACKET_HEADER_FIELD_H /* * Copyright 2018 Philippe Proulx @@ -30,23 +30,24 @@ extern "C" { #endif -struct bt_stream_class; -struct bt_event_header_field; -struct bt_field; +struct bt_private_trace; +struct bt_private_packet_header_field; +struct bt_private_field; extern -struct bt_event_header_field *bt_event_header_field_create( - struct bt_stream_class *stream_class); +struct bt_private_packet_header_field *bt_private_packet_header_field_create( + struct bt_private_trace *trace); extern -struct bt_field *bt_event_header_field_borrow_field( - struct bt_event_header_field *field); +struct bt_private_field *bt_private_packet_header_field_borrow_private_field( + struct bt_private_packet_header_field *field); extern -void bt_event_header_field_release(struct bt_event_header_field *field); +void bt_private_packet_header_field_release( + struct bt_private_packet_header_field *field); #ifdef __cplusplus } #endif -#endif /* BABELTRACE_TRACE_IR_EVENT_HEADER_FIELD_H */ +#endif /* BABELTRACE_TRACE_IR_PRIVATE_PACKET_HEADER_FIELD_H */ diff --git a/include/babeltrace/trace-ir/private-packet.h b/include/babeltrace/trace-ir/private-packet.h new file mode 100644 index 00000000..fab1fa73 --- /dev/null +++ b/include/babeltrace/trace-ir/private-packet.h @@ -0,0 +1,88 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_PACKET_H +#define BABELTRACE_TRACE_IR_PRIVATE_PACKET_H + +/* + * Copyright 2016 Philippe Proulx + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_packet; +struct bt_private_packet; +struct bt_private_packet_header_field; +struct bt_private_packet_context_field; +struct bt_private_stream; + +extern struct bt_packet *bt_packet_borrow_from_private( + struct bt_private_packet *priv_packet); + +extern struct bt_private_packet *bt_private_packet_create( + struct bt_private_stream *stream); + +extern struct bt_private_stream *bt_private_packet_borrow_private_stream( + struct bt_private_packet *packet); + +extern +struct bt_private_field *bt_private_packet_borrow_header_private_field( + struct bt_private_packet *packet); + +extern +int bt_private_packet_move_private_header_field( + struct bt_private_packet *packet, + struct bt_private_packet_header_field *header); + +extern +struct bt_private_field *bt_private_packet_borrow_context_private_field( + struct bt_private_packet *packet); + +extern +int bt_private_packet_move_private_context_field( + struct bt_private_packet *packet, + struct bt_private_packet_context_field *context); + +extern +int bt_private_packet_set_default_beginning_clock_value( + struct bt_private_packet *packet, uint64_t value_cycles); + +extern +int bt_private_packet_set_default_end_clock_value( + struct bt_private_packet *packet, uint64_t value_cycles); + +extern +int bt_private_packet_set_discarded_event_counter_snapshot( + struct bt_private_packet *packet, uint64_t value); + +extern +int bt_private_packet_set_packet_counter_snapshot( + struct bt_private_packet *packet, uint64_t value); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_PACKET_H */ diff --git a/include/babeltrace/trace-ir/private-stream-class.h b/include/babeltrace/trace-ir/private-stream-class.h new file mode 100644 index 00000000..e251b267 --- /dev/null +++ b/include/babeltrace/trace-ir/private-stream-class.h @@ -0,0 +1,128 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_STREAM_CLASS_H +#define BABELTRACE_TRACE_IR_PRIVATE_STREAM_CLASS_H + +/* + * Copyright 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#include + +/* For bt_bool */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_stream_class; +struct bt_private_stream_class; +struct bt_private_trace; +struct bt_private_event_class; +struct bt_private_clock_class; + +extern struct bt_stream_class *bt_stream_class_borrow_from_private( + struct bt_private_stream_class *priv_stream_class); + +extern struct bt_private_stream_class *bt_private_stream_class_create( + struct bt_private_trace *trace); + +extern struct bt_private_stream_class *bt_private_stream_class_create_with_id( + struct bt_private_trace *trace, uint64_t id); + +extern struct bt_private_trace *bt_private_stream_class_borrow_private_trace( + struct bt_private_stream_class *stream_class); + +extern int bt_private_stream_class_set_name( + struct bt_private_stream_class *stream_class, + const char *name); + +extern int bt_private_stream_class_set_assigns_automatic_event_class_id( + struct bt_private_stream_class *stream_class, bt_bool value); + +extern int bt_private_stream_class_set_assigns_automatic_stream_id( + struct bt_private_stream_class *stream_class, bt_bool value); + +extern struct bt_private_field_class * +bt_private_stream_class_borrow_packet_context_private_field_class( + struct bt_private_stream_class *stream_class); + +extern int bt_private_stream_class_set_packet_context_private_field_class( + struct bt_private_stream_class *stream_class, + struct bt_private_field_class *field_class); + +extern struct bt_private_field_class * +bt_private_stream_class_borrow_event_header_private_field_class( + struct bt_private_stream_class *stream_class); + +extern int bt_private_stream_class_set_event_header_private_field_class( + struct bt_private_stream_class *stream_class, + struct bt_private_field_class *field_class); + +extern struct bt_private_field_class * +bt_private_stream_class_borrow_event_common_context_private_field_class( + struct bt_private_stream_class *stream_class); + +extern int +bt_private_stream_class_set_event_common_context_private_field_class( + struct bt_private_stream_class *stream_class, + struct bt_private_field_class *field_class); + +extern struct bt_private_event_class * +bt_private_stream_class_borrow_private_event_class_by_index( + struct bt_private_stream_class *stream_class, uint64_t index); + +extern struct bt_private_event_class * +bt_private_stream_class_borrow_private_event_class_by_id( + struct bt_private_stream_class *stream_class, uint64_t id); + +extern int bt_private_stream_class_set_default_clock_class( + struct bt_private_stream_class *stream_class, + struct bt_clock_class *clock_class); + +extern bt_bool bt_private_stream_class_default_clock_is_always_known( + struct bt_private_stream_class *stream_class); + +extern int +bt_private_stream_class_set_packets_have_discarded_event_counter_snapshot( + struct bt_private_stream_class *stream_class, bt_bool value); + +extern int +bt_private_stream_class_set_packets_have_packet_counter_snapshot( + struct bt_private_stream_class *stream_class, bt_bool value); + +extern int +bt_private_stream_class_set_packets_have_default_beginning_clock_value( + struct bt_private_stream_class *stream_class, bt_bool value); + +extern int +bt_private_stream_class_set_packets_have_default_end_clock_value( + struct bt_private_stream_class *stream_class, bt_bool value); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_STREAM_CLASS_H */ diff --git a/include/babeltrace/trace-ir/private-stream.h b/include/babeltrace/trace-ir/private-stream.h new file mode 100644 index 00000000..6a8d0bb3 --- /dev/null +++ b/include/babeltrace/trace-ir/private-stream.h @@ -0,0 +1,60 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_STREAM_H +#define BABELTRACE_TRACE_IR_PRIVATE_STREAM_H + +/* + * Copyright 2013, 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_stream; +struct bt_private_stream; +struct bt_private_stream_class; + +extern struct bt_stream *bt_stream_borrow_from_private( + struct bt_private_stream *priv_stream); + +extern struct bt_private_stream *bt_private_stream_create( + struct bt_private_stream_class *stream_class); + +extern struct bt_private_stream *bt_private_stream_create_with_id( + struct bt_private_stream_class *stream_class, uint64_t id); + +extern struct bt_private_stream_class *bt_private_stream_borrow_private_class( + struct bt_private_stream *stream); + +extern int bt_private_stream_set_name(struct bt_private_stream *stream, + const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_STREAM_H */ diff --git a/include/babeltrace/trace-ir/private-trace.h b/include/babeltrace/trace-ir/private-trace.h new file mode 100644 index 00000000..a3651162 --- /dev/null +++ b/include/babeltrace/trace-ir/private-trace.h @@ -0,0 +1,122 @@ +#ifndef BABELTRACE_TRACE_IR_PRIVATE_TRACE_H +#define BABELTRACE_TRACE_IR_PRIVATE_TRACE_H + +/* + * Copyright 2014 Jérémie Galarneau + * + * Author: Jérémie Galarneau + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The Common Trace Format (CTF) Specification is available at + * http://www.efficios.com/ctf + */ + +/* For bt_bool, bt_uuid */ +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct bt_trace; +struct bt_private_trace; +struct bt_private_stream; +struct bt_private_stream_class; +struct bt_private_field_class; +struct bt_private_value; +struct bt_private_packet_header_field; + +typedef void (* bt_private_trace_is_static_listener)( + struct bt_private_trace *trace, void *data); + +typedef void (* bt_private_trace_listener_removed)( + struct bt_private_trace *trace, void *data); + +extern struct bt_trace *bt_trace_borrow_from_private( + struct bt_private_trace *priv_trace); + +extern struct bt_private_trace *bt_private_trace_create(void); + +extern int bt_private_trace_set_assigns_automatic_stream_class_id( + struct bt_private_trace *trace, bt_bool value); + +extern int bt_private_trace_set_name(struct bt_private_trace *trace, + const char *name); + +extern int bt_private_trace_set_uuid(struct bt_private_trace *trace, + bt_uuid uuid); + +extern void bt_private_trace_borrow_private_environment_entry_by_index( + struct bt_private_trace *trace, uint64_t index, + const char **name, struct bt_private_value **value); + +extern struct bt_private_value * +bt_private_trace_borrow_private_environment_entry_value_by_name( + struct bt_private_trace *trace, const char *name); + +extern int bt_private_trace_set_private_environment_entry_integer( + struct bt_private_trace *trace, const char *name, + int64_t value); + +extern int bt_private_trace_set_private_environment_entry_string( + struct bt_private_trace *trace, const char *name, + const char *value); + +extern struct bt_private_field_class * +bt_private_trace_borrow_packet_header_private_field_class( + struct bt_private_trace *trace); + +extern int bt_private_trace_set_packet_header_private_field_class( + struct bt_private_trace *trace, + struct bt_private_field_class *packet_header_field_class); + +extern struct bt_private_stream_class * +bt_private_trace_borrow_private_stream_class_by_index( + struct bt_private_trace *trace, uint64_t index); + +extern struct bt_private_stream_class * +bt_private_trace_borrow_private_stream_class_by_id( + struct bt_private_trace *trace, uint64_t id); + +extern struct bt_private_stream * +bt_private_trace_borrow_private_stream_by_index( + struct bt_private_trace *trace, uint64_t index); + +extern struct bt_private_stream *bt_private_trace_borrow_stream_by_id( + struct bt_private_trace *trace, uint64_t id); + +extern int bt_private_trace_make_static(struct bt_private_trace *trace); + +extern int bt_private_trace_add_is_static_listener( + struct bt_private_trace *trace, + bt_private_trace_is_static_listener listener, + bt_private_trace_listener_removed listener_removed, void *data, + uint64_t *listener_id); + +extern int bt_private_trace_remove_is_static_listener( + struct bt_private_trace *trace, uint64_t listener_id); + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TRACE_IR_PRIVATE_TRACE_H */ diff --git a/include/babeltrace/trace-ir/stream-class.h b/include/babeltrace/trace-ir/stream-class.h index 444b007d..6b7bdd35 100644 --- a/include/babeltrace/trace-ir/stream-class.h +++ b/include/babeltrace/trace-ir/stream-class.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_STREAM_CLASS_H /* - * BabelTrace - Trace IR: Stream Class - * * Copyright 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -46,57 +44,31 @@ struct bt_clock_class; struct bt_event_header_field; struct bt_packet_context_field; -extern struct bt_stream_class *bt_stream_class_create(struct bt_trace *trace); - -extern struct bt_stream_class *bt_stream_class_create_with_id( - struct bt_trace *trace, uint64_t id); - extern struct bt_trace *bt_stream_class_borrow_trace( struct bt_stream_class *stream_class); extern const char *bt_stream_class_get_name( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_name(struct bt_stream_class *stream_class, - const char *name); - extern bt_bool bt_stream_class_assigns_automatic_event_class_id( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_assigns_automatic_event_class_id( - struct bt_stream_class *stream_class, bt_bool value); - extern bt_bool bt_stream_class_assigns_automatic_stream_id( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_assigns_automatic_stream_id( - struct bt_stream_class *stream_class, bt_bool value); - extern uint64_t bt_stream_class_get_id(struct bt_stream_class *stream_class); extern struct bt_field_class *bt_stream_class_borrow_packet_context_field_class( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_packet_context_field_class( - struct bt_stream_class *stream_class, - struct bt_field_class *field_class); - extern struct bt_field_class * bt_stream_class_borrow_event_header_field_class( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_event_header_field_class( - struct bt_stream_class *stream_class, - struct bt_field_class *field_class); - extern struct bt_field_class * bt_stream_class_borrow_event_common_context_field_class( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_event_common_context_field_class( - struct bt_stream_class *stream_class, - struct bt_field_class *field_class); - extern uint64_t bt_stream_class_get_event_class_count( struct bt_stream_class *stream_class); @@ -106,10 +78,6 @@ extern struct bt_event_class *bt_stream_class_borrow_event_class_by_index( extern struct bt_event_class *bt_stream_class_borrow_event_class_by_id( struct bt_stream_class *stream_class, uint64_t id); -extern int bt_stream_class_set_default_clock_class( - struct bt_stream_class *stream_class, - struct bt_clock_class *clock_class); - extern struct bt_clock_class *bt_stream_class_borrow_default_clock_class( struct bt_stream_class *stream_class); @@ -119,27 +87,15 @@ extern bt_bool bt_stream_class_default_clock_is_always_known( extern bt_bool bt_stream_class_packets_have_discarded_event_counter_snapshot( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_packets_have_discarded_event_counter_snapshot( - struct bt_stream_class *stream_class, bt_bool value); - extern bt_bool bt_stream_class_packets_have_packet_counter_snapshot( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_packets_have_packet_counter_snapshot( - struct bt_stream_class *stream_class, bt_bool value); - extern bt_bool bt_stream_class_packets_have_default_beginning_clock_value( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_packets_have_default_beginning_clock_value( - struct bt_stream_class *stream_class, bt_bool value); - extern bt_bool bt_stream_class_packets_have_default_end_clock_value( struct bt_stream_class *stream_class); -extern int bt_stream_class_set_packets_have_default_end_clock_value( - struct bt_stream_class *stream_class, bt_bool value); - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/trace-ir/stream.h b/include/babeltrace/trace-ir/stream.h index 839c0a31..3ed0205e 100644 --- a/include/babeltrace/trace-ir/stream.h +++ b/include/babeltrace/trace-ir/stream.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_STREAM_H /* - * BabelTrace - Trace IR: Stream - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,9 +28,6 @@ * http://www.efficios.com/ctf */ -/* For enum bt_property_availability */ -#include - #include #ifdef __cplusplus @@ -42,17 +37,10 @@ extern "C" { struct bt_stream; struct bt_stream_class; -extern struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class); - -extern struct bt_stream *bt_stream_create_with_id( - struct bt_stream_class *stream_class, uint64_t id); - extern struct bt_stream_class *bt_stream_borrow_class(struct bt_stream *stream); extern const char *bt_stream_get_name(struct bt_stream *stream); -extern int bt_stream_set_name(struct bt_stream *stream, const char *name); - extern uint64_t bt_stream_get_id(struct bt_stream *stream); #ifdef __cplusplus diff --git a/include/babeltrace/trace-ir/trace.h b/include/babeltrace/trace-ir/trace.h index 67fc1d98..a2a05202 100644 --- a/include/babeltrace/trace-ir/trace.h +++ b/include/babeltrace/trace-ir/trace.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_TRACE_H /* - * BabelTrace - Trace IR: Trace - * * Copyright 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -44,30 +42,14 @@ struct bt_stream; struct bt_stream_class; struct bt_field_class; struct bt_value; -struct bt_packet_header_field; - -typedef void (* bt_trace_is_static_listener)( - struct bt_trace *trace, void *data); - -typedef void (* bt_trace_listener_removed)( - struct bt_trace *trace, void *data); - -extern struct bt_trace *bt_trace_create(void); extern bt_bool bt_trace_assigns_automatic_stream_class_id( struct bt_trace *trace); -extern int bt_trace_set_assigns_automatic_stream_class_id( - struct bt_trace *trace, bt_bool value); - extern const char *bt_trace_get_name(struct bt_trace *trace); -extern int bt_trace_set_name(struct bt_trace *trace, const char *name); - extern bt_uuid bt_trace_get_uuid(struct bt_trace *trace); -extern int bt_trace_set_uuid(struct bt_trace *trace, bt_uuid uuid); - extern uint64_t bt_trace_get_environment_entry_count(struct bt_trace *trace); extern void bt_trace_borrow_environment_entry_by_index( @@ -77,20 +59,9 @@ extern void bt_trace_borrow_environment_entry_by_index( extern struct bt_value *bt_trace_borrow_environment_entry_value_by_name( struct bt_trace *trace, const char *name); -extern int bt_trace_set_environment_entry_integer( - struct bt_trace *trace, const char *name, - int64_t value); - -extern int bt_trace_set_environment_entry_string( - struct bt_trace *trace, const char *name, - const char *value); - extern struct bt_field_class *bt_trace_borrow_packet_header_field_class( struct bt_trace *trace); -extern int bt_trace_set_packet_header_field_class(struct bt_trace *trace, - struct bt_field_class *packet_header_field_class); - extern uint64_t bt_trace_get_stream_class_count(struct bt_trace *trace); extern struct bt_stream_class *bt_trace_borrow_stream_class_by_index( @@ -109,17 +80,6 @@ extern struct bt_stream *bt_trace_borrow_stream_by_id( extern bt_bool bt_trace_is_static(struct bt_trace *trace); -extern int bt_trace_make_static(struct bt_trace *trace); - -extern int bt_trace_add_is_static_listener( - struct bt_trace *trace, - bt_trace_is_static_listener listener, - bt_trace_listener_removed listener_removed, void *data, - uint64_t *listener_id); - -extern int bt_trace_remove_is_static_listener( - struct bt_trace *trace, uint64_t listener_id); - #ifdef __cplusplus } #endif diff --git a/lib/graph/component.c b/lib/graph/component.c index 170a88fa..6da601c8 100644 --- a/lib/graph/component.c +++ b/lib/graph/component.c @@ -1,8 +1,4 @@ /* - * component.c - * - * Babeltrace Plugin Component - * * Copyright 2015 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -213,7 +209,7 @@ struct bt_port *bt_component_add_port( /* * Notify the graph's creator that a new port was added. */ - graph = bt_component_get_graph(component); + graph = bt_object_get_ref(bt_component_borrow_graph(component)); if (graph) { bt_graph_notify_port_added(graph, new_port); BT_OBJECT_PUT_REF_AND_RESET(graph); @@ -373,9 +369,10 @@ void bt_component_set_graph(struct bt_component *component, graph ? &graph->base : NULL); } -struct bt_graph *bt_component_borrow_graph(struct bt_component *component) +bt_bool bt_component_graph_is_canceled(struct bt_component *component) { - return (struct bt_graph *) bt_object_borrow_parent(&component->base); + return bt_graph_is_canceled( + (void *) bt_object_borrow_parent(&component->base)); } static @@ -508,7 +505,7 @@ void bt_component_remove_port_by_index(struct bt_component *component, /* * Notify the graph's creator that a port is removed. */ - graph = bt_component_get_graph(component); + graph = bt_object_get_ref(bt_component_borrow_graph(component)); if (graph) { bt_graph_notify_port_removed(graph, component, port); BT_OBJECT_PUT_REF_AND_RESET(graph); diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index c709eae4..11aca63b 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -882,7 +883,7 @@ struct bt_notification_iterator *bt_output_port_notification_iterator_create( output_port_comp = bt_port_get_component(output_port); BT_ASSERT_PRE(output_port_comp, "Output port has no component: %!+p", output_port); - graph = bt_component_get_graph(output_port_comp); + graph = bt_object_get_ref(bt_component_borrow_graph(output_port_comp)); BT_ASSERT(graph); /* Create notification iterator */ diff --git a/lib/graph/notification/event.c b/lib/graph/notification/event.c index aec13e6c..18f6a4ac 100644 --- a/lib/graph/notification/event.c +++ b/lib/graph/notification/event.c @@ -1,6 +1,4 @@ /* - * Babeltrace Plug-in Event Notification - * * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -35,11 +33,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -76,11 +76,13 @@ end: return (void *) notification; } -struct bt_notification *bt_notification_event_create( +struct bt_private_notification *bt_private_notification_event_create( struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_event_class *event_class, - struct bt_packet *packet) + struct bt_private_event_class *priv_event_class, + struct bt_private_packet *priv_packet) { + struct bt_event_class *event_class = (void *) priv_event_class; + struct bt_packet *packet = (void *) priv_packet; struct bt_notification_event *notification = NULL; struct bt_event *event; struct bt_graph *graph; @@ -199,3 +201,10 @@ struct bt_event *bt_notification_event_borrow_event( struct bt_notification_event, parent); return event_notification->event; } + +struct bt_private_event *bt_private_notification_event_borrow_private_event( + struct bt_private_notification *notification) +{ + return (void *) bt_notification_event_borrow_event( + (void *) notification); +} diff --git a/lib/graph/notification/inactivity.c b/lib/graph/notification/inactivity.c index 605942e7..3ca527c8 100644 --- a/lib/graph/notification/inactivity.c +++ b/lib/graph/notification/inactivity.c @@ -28,9 +28,11 @@ #include #include #include +#include #include #include #include +#include static void bt_notification_inactivity_destroy(struct bt_object *obj) @@ -47,7 +49,7 @@ void bt_notification_inactivity_destroy(struct bt_object *obj) g_free(notification); } -struct bt_notification *bt_notification_inactivity_create( +struct bt_private_notification *bt_private_notification_inactivity_create( struct bt_private_connection_private_notification_iterator *notif_iter, struct bt_clock_class *default_clock_class) { @@ -79,12 +81,14 @@ error: BT_OBJECT_PUT_REF_AND_RESET(ret_notif); end: - return ret_notif; + return (void *) ret_notif; } -int bt_notification_inactivity_set_default_clock_value( - struct bt_notification *notif, uint64_t value_cycles) +int bt_private_notification_inactivity_set_default_clock_value( + struct bt_private_notification *priv_notif, + uint64_t value_cycles) { + struct bt_notification *notif = (void *) priv_notif; struct bt_notification_inactivity *inactivity = (void *) notif; BT_ASSERT_PRE_NON_NULL(notif, "Notification"); diff --git a/lib/graph/notification/notification.c b/lib/graph/notification/notification.c index f049118c..e6b6af52 100644 --- a/lib/graph/notification/notification.c +++ b/lib/graph/notification/notification.c @@ -27,6 +27,7 @@ #define BT_LOG_TAG "NOTIF" #include +#include #include #include #include @@ -74,3 +75,9 @@ void bt_notification_unlink_graph(struct bt_notification *notif) BT_ASSERT(notif); notif->graph = NULL; } + +struct bt_notification *bt_notification_borrow_from_private( + struct bt_private_notification *priv_notif) +{ + return (void *) priv_notif; +} diff --git a/lib/graph/notification/packet.c b/lib/graph/notification/packet.c index acf0ce5f..6752bee0 100644 --- a/lib/graph/notification/packet.c +++ b/lib/graph/notification/packet.c @@ -1,6 +1,4 @@ /* - * Babeltrace Plug-in Packet-related Notifications - * * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -34,8 +32,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -65,10 +65,11 @@ end: return (void *) notification; } -struct bt_notification *bt_notification_packet_begin_create( +struct bt_private_notification *bt_private_notification_packet_begin_create( struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_packet *packet) + struct bt_private_packet *priv_packet) { + struct bt_packet *packet = (void *) priv_packet; struct bt_notification_packet_begin *notification = NULL; struct bt_stream *stream; struct bt_stream_class *stream_class; @@ -162,6 +163,14 @@ struct bt_packet *bt_notification_packet_begin_borrow_packet( return packet_begin->packet; } +struct bt_private_packet * +bt_private_notification_packet_begin_borrow_private_packet( + struct bt_private_notification *notification) +{ + return (void *) bt_notification_packet_begin_borrow_packet( + (void *) notification); +} + BT_HIDDEN struct bt_notification *bt_notification_packet_end_new(struct bt_graph *graph) { @@ -186,10 +195,11 @@ end: return (void *) notification; } -struct bt_notification *bt_notification_packet_end_create( +struct bt_private_notification *bt_private_notification_packet_end_create( struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_packet *packet) + struct bt_private_packet *priv_packet) { + struct bt_packet *packet = (void *) priv_packet; struct bt_notification_packet_end *notification = NULL; struct bt_stream *stream; struct bt_stream_class *stream_class; @@ -281,3 +291,10 @@ struct bt_packet *bt_notification_packet_end_borrow_packet( struct bt_notification_packet_end, parent); return packet_end->packet; } + +struct bt_private_packet *bt_private_notification_packet_end_borrow_packet( + struct bt_private_notification *notification) +{ + return (void *) bt_notification_packet_end_borrow_packet( + (void *) notification); +} diff --git a/lib/graph/notification/stream.c b/lib/graph/notification/stream.c index 54293b42..523e8142 100644 --- a/lib/graph/notification/stream.c +++ b/lib/graph/notification/stream.c @@ -1,6 +1,4 @@ /* - * Babeltrace Plug-in Stream-related Notifications - * * Copyright 2016 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -32,9 +30,11 @@ #include #include #include +#include #include #include #include +#include #include static @@ -55,10 +55,11 @@ void bt_notification_stream_end_destroy(struct bt_object *obj) g_free(notification); } -struct bt_notification *bt_notification_stream_end_create( +struct bt_private_notification *bt_private_notification_stream_end_create( struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_stream *stream) + struct bt_private_stream *priv_stream) { + struct bt_stream *stream = (void *) priv_stream; struct bt_notification_stream_end *notification; struct bt_stream_class *stream_class; @@ -91,7 +92,8 @@ struct bt_notification *bt_notification_stream_end_create( stream_class, bt_stream_class_get_name(stream_class), bt_stream_class_get_id(stream_class), notification); - return ¬ification->parent; + + return (void *) ¬ification->parent; error: return NULL; } @@ -109,10 +111,19 @@ struct bt_stream *bt_notification_stream_end_borrow_stream( return stream_end->stream; } -int bt_notification_stream_end_set_default_clock_value( - struct bt_notification *notif, uint64_t value_cycles) +struct bt_private_stream *bt_private_notification_stream_end_borrow_stream( + struct bt_private_notification *notification) +{ + return (void *) bt_notification_stream_end_borrow_stream( + (void *) notification); +} + +int bt_private_notification_stream_end_set_default_clock_value( + struct bt_private_notification *priv_notif, + uint64_t value_cycles) { int ret = 0; + struct bt_notification *notif = (void *) priv_notif; struct bt_notification_stream_end *se_notif = (void *) notif; BT_ASSERT_PRE_NON_NULL(notif, "Notification"); @@ -167,10 +178,11 @@ void bt_notification_stream_begin_destroy(struct bt_object *obj) g_free(notification); } -struct bt_notification *bt_notification_stream_begin_create( +struct bt_private_notification *bt_private_notification_stream_begin_create( struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_stream *stream) + struct bt_private_stream *priv_stream) { + struct bt_stream *stream = (void *) priv_stream; struct bt_notification_stream_begin *notification; struct bt_stream_class *stream_class; @@ -203,7 +215,7 @@ struct bt_notification *bt_notification_stream_begin_create( stream_class, bt_stream_class_get_name(stream_class), bt_stream_class_get_id(stream_class), notification); - return ¬ification->parent; + return (void *) ¬ification->parent; error: return NULL; } @@ -221,10 +233,19 @@ struct bt_stream *bt_notification_stream_begin_borrow_stream( return stream_begin->stream; } -int bt_notification_stream_begin_set_default_clock_value( - struct bt_notification *notif, uint64_t value_cycles) +struct bt_private_stream *bt_private_notification_stream_begin_borrow_stream( + struct bt_private_notification *notification) +{ + return (void *) bt_notification_stream_begin_borrow_stream( + (void *) notification); +} + +int bt_private_notification_stream_begin_set_default_clock_value( + struct bt_private_notification *priv_notif, + uint64_t value_cycles) { int ret = 0; + struct bt_notification *notif = (void *) priv_notif; struct bt_notification_stream_begin *sb_notif = (void *) notif; BT_ASSERT_PRE_NON_NULL(notif, "Notification"); diff --git a/lib/trace-ir/clock-class.c b/lib/trace-ir/clock-class.c index 7c63d66e..d77b121a 100644 --- a/lib/trace-ir/clock-class.c +++ b/lib/trace-ir/clock-class.c @@ -1,8 +1,4 @@ /* - * clock-class.c - * - * Babeltrace trace IR - Clock class - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -106,7 +102,7 @@ end: return; } -struct bt_clock_class *bt_clock_class_create(void) +struct bt_private_clock_class *bt_private_clock_class_create(void) { int ret; struct bt_clock_class *clock_class = NULL; @@ -153,7 +149,7 @@ error: BT_OBJECT_PUT_REF_AND_RESET(clock_class); end: - return clock_class; + return (void *) clock_class; } const char *bt_clock_class_get_name( @@ -163,9 +159,12 @@ const char *bt_clock_class_get_name( return clock_class->name.value; } -int bt_clock_class_set_name(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_name( + struct bt_private_clock_class *priv_clock_class, const char *name) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_NON_NULL(name, "Name"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); @@ -181,9 +180,12 @@ const char *bt_clock_class_get_description(struct bt_clock_class *clock_class) return clock_class->description.value; } -int bt_clock_class_set_description(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_description( + struct bt_private_clock_class *priv_clock_class, const char *descr) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_NON_NULL(descr, "Description"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); @@ -200,9 +202,12 @@ uint64_t bt_clock_class_get_frequency(struct bt_clock_class *clock_class) return clock_class->frequency; } -int bt_clock_class_set_frequency(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_frequency( + struct bt_private_clock_class *priv_clock_class, uint64_t frequency) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); BT_ASSERT_PRE(frequency != UINT64_C(-1) && frequency != 0, @@ -223,9 +228,12 @@ uint64_t bt_clock_class_get_precision(struct bt_clock_class *clock_class) return clock_class->precision; } -int bt_clock_class_set_precision(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_precision( + struct bt_private_clock_class *priv_clock_class, uint64_t precision) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); BT_ASSERT_PRE(precision != UINT64_C(-1), @@ -246,9 +254,12 @@ void bt_clock_class_get_offset(struct bt_clock_class *clock_class, *cycles = clock_class->offset_cycles; } -int bt_clock_class_set_offset(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_offset( + struct bt_private_clock_class *priv_clock_class, int64_t seconds, uint64_t cycles) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); BT_ASSERT_PRE(cycles < clock_class->frequency, @@ -267,9 +278,12 @@ bt_bool bt_clock_class_is_absolute(struct bt_clock_class *clock_class) return (bool) clock_class->is_absolute; } -int bt_clock_class_set_is_absolute(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_is_absolute( + struct bt_private_clock_class *priv_clock_class, bt_bool is_absolute) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); clock_class->is_absolute = (bool) is_absolute; @@ -284,9 +298,12 @@ bt_uuid bt_clock_class_get_uuid(struct bt_clock_class *clock_class) return clock_class->uuid.value; } -int bt_clock_class_set_uuid(struct bt_clock_class *clock_class, +int bt_private_clock_class_set_uuid( + struct bt_private_clock_class *priv_clock_class, bt_uuid uuid) { + struct bt_clock_class *clock_class = (void *) priv_clock_class; + BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_NON_NULL(uuid, "UUID"); BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class); @@ -327,3 +344,9 @@ int bt_clock_class_cycles_to_ns_from_origin(struct bt_clock_class *clock_class, return ret; } + +struct bt_clock_class *bt_clock_class_borrow_from_private( + struct bt_private_clock_class *priv_clock_class) +{ + return (void *) priv_clock_class; +} diff --git a/lib/trace-ir/event-class.c b/lib/trace-ir/event-class.c index 895557aa..9574a9da 100644 --- a/lib/trace-ir/event-class.c +++ b/lib/trace-ir/event-class.c @@ -1,8 +1,4 @@ /* - * event-class.c - * - * Babeltrace trace IR - Event class - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -34,9 +30,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -53,7 +51,8 @@ #include #define BT_ASSERT_PRE_EVENT_CLASS_HOT(_ec) \ - BT_ASSERT_PRE_HOT((_ec), "Event class", ": %!+E", (_ec)) + BT_ASSERT_PRE_HOT(((struct bt_event_class *) (_ec)), \ + "Event class", ": %!+E", (_ec)) static void destroy_event_class(struct bt_object *obj) @@ -167,24 +166,28 @@ end: return event_class; } -struct bt_event_class *bt_event_class_create( - struct bt_stream_class *stream_class) +struct bt_private_event_class *bt_private_event_class_create( + struct bt_private_stream_class *priv_stream_class) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE(stream_class->assigns_automatic_event_class_id, "Stream class does not automatically assigns event class IDs: " "%![sc-]+S", stream_class); - return create_event_class_with_id(stream_class, + return (void *) create_event_class_with_id((void *) stream_class, (uint64_t) stream_class->event_classes->len); } -struct bt_event_class *bt_event_class_create_with_id( - struct bt_stream_class *stream_class, uint64_t id) +struct bt_private_event_class *bt_private_event_class_create_with_id( + struct bt_private_stream_class *priv_stream_class, uint64_t id) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE(!stream_class->assigns_automatic_event_class_id, "Stream class automatically assigns event class IDs: " "%![sc-]+S", stream_class); - return create_event_class_with_id(stream_class, id); + return (void *) create_event_class_with_id((void *) stream_class, id); } const char *bt_event_class_get_name(struct bt_event_class *event_class) @@ -193,9 +196,11 @@ const char *bt_event_class_get_name(struct bt_event_class *event_class) return event_class->name.value; } -int bt_event_class_set_name(struct bt_event_class *event_class, +int bt_private_event_class_set_name(struct bt_private_event_class *priv_event_class, const char *name) { + struct bt_event_class *event_class = (void *) priv_event_class; + BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); BT_ASSERT_PRE_NON_NULL(name, "Name"); BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class); @@ -222,9 +227,12 @@ enum bt_property_availability bt_event_class_get_log_level( return event_class->log_level.base.avail; } -int bt_event_class_set_log_level(struct bt_event_class *event_class, +int bt_private_event_class_set_log_level( + struct bt_private_event_class *priv_event_class, enum bt_event_class_log_level log_level) { + struct bt_event_class *event_class = (void *) priv_event_class; + BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class); bt_property_uint_set(&event_class->log_level, @@ -239,9 +247,12 @@ const char *bt_event_class_get_emf_uri(struct bt_event_class *event_class) return event_class->emf_uri.value; } -int bt_event_class_set_emf_uri(struct bt_event_class *event_class, +int bt_private_event_class_set_emf_uri( + struct bt_private_event_class *priv_event_class, const char *emf_uri) { + struct bt_event_class *event_class = (void *) priv_event_class; + BT_ASSERT_PRE_NON_NULL(event_class, "Event class"); BT_ASSERT_PRE_NON_NULL(emf_uri, "EMF URI"); BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class); @@ -258,6 +269,14 @@ struct bt_stream_class *bt_event_class_borrow_stream_class( return bt_event_class_borrow_stream_class_inline(event_class); } +struct bt_private_stream_class * +bt_private_event_class_borrow_private_stream_class( + struct bt_private_event_class *event_class) +{ + return (void *) bt_event_class_borrow_stream_class( + (void *) event_class); +} + struct bt_field_class *bt_event_class_borrow_specific_context_field_class( struct bt_event_class *event_class) { @@ -265,11 +284,21 @@ struct bt_field_class *bt_event_class_borrow_specific_context_field_class( return event_class->specific_context_fc; } -int bt_event_class_set_specific_context_field_class( - struct bt_event_class *event_class, - struct bt_field_class *field_class) +struct bt_private_field_class * +bt_private_event_class_borrow_specific_context_private_field_class( + struct bt_private_event_class *event_class) +{ + return (void *) bt_event_class_borrow_specific_context_field_class( + (void *) event_class); +} + +int bt_private_event_class_set_specific_context_private_field_class( + struct bt_private_event_class *priv_event_class, + struct bt_private_field_class *priv_field_class) { int ret; + struct bt_event_class *event_class = (void *) priv_event_class; + struct bt_field_class *field_class = (void *) priv_field_class; struct bt_stream_class *stream_class; struct bt_trace *trace; struct bt_resolve_field_path_context resolve_ctx = { @@ -320,10 +349,20 @@ struct bt_field_class *bt_event_class_borrow_payload_field_class( return event_class->payload_fc; } -int bt_event_class_set_payload_field_class(struct bt_event_class *event_class, - struct bt_field_class *field_class) +struct bt_private_field_class *bt_private_event_class_borrow_payload_private_field_class( + struct bt_private_event_class *event_class) +{ + return (void *) bt_event_class_borrow_payload_field_class( + (void *) event_class); +} + +int bt_private_event_class_set_payload_private_field_class( + struct bt_private_event_class *priv_event_class, + struct bt_private_field_class *priv_field_class) { int ret; + struct bt_event_class *event_class = (void *) priv_event_class; + struct bt_field_class *field_class = (void *) priv_field_class; struct bt_stream_class *stream_class; struct bt_trace *trace; struct bt_resolve_field_path_context resolve_ctx = { @@ -375,3 +414,9 @@ void _bt_event_class_freeze(struct bt_event_class *event_class) BT_LIB_LOGD("Freezing event class: %!+E", event_class); event_class->frozen = true; } + +struct bt_event_class *bt_event_class_borrow_from_private( + struct bt_private_event_class *priv_event_class) +{ + return (void *) priv_event_class; +} diff --git a/lib/trace-ir/event-header-field.c b/lib/trace-ir/event-header-field.c index eb8b2575..37061174 100644 --- a/lib/trace-ir/event-header-field.c +++ b/lib/trace-ir/event-header-field.c @@ -24,14 +24,14 @@ #include #include -#include +#include #include #include #include #include -struct bt_field *bt_event_header_field_borrow_field( - struct bt_event_header_field *header_field) +struct bt_private_field *bt_private_event_header_field_borrow_private_field( + struct bt_private_event_header_field *header_field) { struct bt_field_wrapper *field_wrapper = (void *) header_field; @@ -39,7 +39,8 @@ struct bt_field *bt_event_header_field_borrow_field( return (void *) field_wrapper->field; } -void bt_event_header_field_release(struct bt_event_header_field *header_field) +void bt_private_event_header_field_release( + struct bt_private_event_header_field *header_field) { struct bt_field_wrapper *field_wrapper = (void *) header_field; @@ -55,9 +56,10 @@ void bt_event_header_field_release(struct bt_event_header_field *header_field) bt_field_wrapper_destroy(field_wrapper); } -struct bt_event_header_field *bt_event_header_field_create( - struct bt_stream_class *stream_class) +struct bt_private_event_header_field *bt_private_event_header_field_create( + struct bt_private_stream_class *priv_stream_class) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; struct bt_field_wrapper *field_wrapper; BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); diff --git a/lib/trace-ir/event.c b/lib/trace-ir/event.c index 2df8fe8c..c2f772a5 100644 --- a/lib/trace-ir/event.c +++ b/lib/trace-ir/event.c @@ -1,8 +1,4 @@ /* - * event.c - * - * Babeltrace trace IR - Event - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -36,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -220,24 +217,48 @@ struct bt_field *bt_event_borrow_header_field(struct bt_event *event) return event->header_field ? event->header_field->field : NULL; } +struct bt_private_field *bt_private_event_borrow_header_private_field( + struct bt_private_event *event) +{ + return (void *) bt_event_borrow_header_field((void *) event); +} + struct bt_field *bt_event_borrow_common_context_field(struct bt_event *event) { BT_ASSERT_PRE_NON_NULL(event, "Event"); return event->common_context_field; } +struct bt_private_field *bt_private_event_borrow_common_context_private_field( + struct bt_private_event *event) +{ + return (void *) bt_event_borrow_common_context_field((void *) event); +} + struct bt_field *bt_event_borrow_specific_context_field(struct bt_event *event) { BT_ASSERT_PRE_NON_NULL(event, "Event"); return event->specific_context_field; } +struct bt_private_field *bt_private_event_borrow_specific_context_private_field( + struct bt_private_event *event) +{ + return (void *) bt_event_borrow_specific_context_field((void *) event); +} + struct bt_field *bt_event_borrow_payload_field(struct bt_event *event) { BT_ASSERT_PRE_NON_NULL(event, "Event"); return event->payload_field; } +struct bt_private_field *bt_private_event_borrow_payload_private_field( + struct bt_private_event *event) +{ + return (void *) bt_event_borrow_payload_field((void *) event); +} + static void release_event_header_field(struct bt_field_wrapper *field_wrapper, struct bt_event *event) @@ -291,9 +312,10 @@ void bt_event_destroy(struct bt_event *event) g_free(event); } -int bt_event_set_default_clock_value(struct bt_event *event, - uint64_t value_cycles) +int bt_private_event_set_default_clock_value( + struct bt_private_event *priv_event, uint64_t value_cycles) { + struct bt_event *event = (void *) priv_event; struct bt_stream_class *sc; BT_ASSERT_PRE_NON_NULL(event, "Event"); @@ -325,11 +347,20 @@ struct bt_packet *bt_event_borrow_packet(struct bt_event *event) return event->packet; } -int bt_event_move_header(struct bt_event *event, - struct bt_event_header_field *header_field) +struct bt_private_packet *bt_private_event_borrow_packet( + struct bt_private_event *event) +{ + return (void *) bt_event_borrow_packet((void *) event); +} + +int bt_private_event_move_private_header_field( + struct bt_private_event *priv_event, + struct bt_private_event_header_field *priv_header_field) { struct bt_stream_class *stream_class; - struct bt_field_wrapper *field_wrapper = (void *) header_field; + struct bt_event *event = (void *) priv_event; + struct bt_event_class *event_class = (void *) event_class; + struct bt_field_wrapper *field_wrapper = (void *) priv_header_field; BT_ASSERT_PRE_NON_NULL(event, "Event"); BT_ASSERT_PRE_NON_NULL(field_wrapper, "Header field"); @@ -347,3 +378,9 @@ int bt_event_move_header(struct bt_event *event, event->header_field = field_wrapper; return 0; } + +struct bt_event *bt_event_borrow_from_private( + struct bt_private_event *priv_event) +{ + return (void *) priv_event; +} diff --git a/lib/trace-ir/field-classes.c b/lib/trace-ir/field-classes.c index 4aa36f1a..b2cee6e1 100644 --- a/lib/trace-ir/field-classes.c +++ b/lib/trace-ir/field-classes.c @@ -1,8 +1,4 @@ /* - * field-classes.c - * - * Babeltrace trace IR - Event Types - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,9 +26,11 @@ #include #include +#include #include #include #include +#include #include #include #include @@ -79,7 +77,7 @@ static void destroy_integer_field_class(struct bt_object *obj) { BT_ASSERT(obj); - BT_LIB_LOGD("Destroying integer field classe object: %!+F", obj); + BT_LIB_LOGD("Destroying integer field class object: %!+F", obj); g_free(obj); } @@ -88,16 +86,16 @@ struct bt_field_class *create_integer_field_class(enum bt_field_class_type type) { struct bt_field_class_integer *int_fc = NULL; - BT_LOGD("Creating default integer field classe object: type=%s", + BT_LOGD("Creating default integer field class object: type=%s", bt_common_field_class_type_string(type)); int_fc = g_new0(struct bt_field_class_integer, 1); if (!int_fc) { - BT_LOGE_STR("Failed to allocate one integer field classe."); + BT_LOGE_STR("Failed to allocate one integer field class."); goto error; } init_integer_field_class(int_fc, type, destroy_integer_field_class); - BT_LIB_LOGD("Created integer field classe object: %!+F", int_fc); + BT_LIB_LOGD("Created integer field class object: %!+F", int_fc); goto end; error: @@ -107,14 +105,17 @@ end: return (void *) int_fc; } -struct bt_field_class *bt_field_class_unsigned_integer_create(void) +struct bt_private_field_class * +bt_private_field_class_unsigned_integer_create(void) { - return create_integer_field_class(BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER); + return (void *) create_integer_field_class( + BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER); } -struct bt_field_class *bt_field_class_signed_integer_create(void) +struct bt_private_field_class *bt_private_field_class_signed_integer_create(void) { - return create_integer_field_class(BT_FIELD_CLASS_TYPE_SIGNED_INTEGER); + return (void *) create_integer_field_class( + BT_FIELD_CLASS_TYPE_SIGNED_INTEGER); } uint64_t bt_field_class_integer_get_field_value_range( @@ -136,26 +137,27 @@ bool size_is_valid_for_enumeration_field_class(struct bt_field_class *fc, return true; } -int bt_field_class_integer_set_field_value_range( - struct bt_field_class *fc, uint64_t size) +int bt_private_field_class_integer_set_field_value_range( + struct bt_private_field_class *priv_fc, uint64_t size) { + struct bt_field_class *fc = (void *) priv_fc; struct bt_field_class_integer *int_fc = (void *) fc; BT_ASSERT_PRE_NON_NULL(fc, "Field class"); BT_ASSERT_PRE_FC_IS_INT(fc, "Field class"); BT_ASSERT_PRE_FC_HOT(fc, "Field class"); BT_ASSERT_PRE(size <= 64, - "Unsupported size for integer field classe's field value range " + "Unsupported size for integer field class's field value range " "(maximum is 64): size=%" PRIu64, size); BT_ASSERT_PRE( int_fc->common.type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || int_fc->common.type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || size_is_valid_for_enumeration_field_class(fc, size), - "Invalid field value range for enumeration field classe: " + "Invalid field value range for enumeration field class: " "at least one of the current mapping ranges contains values " "which are outside this range: %!+F, size=%" PRIu64, fc, size); int_fc->range = size; - BT_LIB_LOGV("Set integer field classe's field value range: %!+F", fc); + BT_LIB_LOGV("Set integer field class's field value range: %!+F", fc); return 0; } @@ -169,16 +171,18 @@ bt_field_class_integer_get_preferred_display_base(struct bt_field_class *fc) return int_fc->base; } -int bt_field_class_integer_set_preferred_display_base(struct bt_field_class *fc, +int bt_private_field_class_integer_set_preferred_display_base( + struct bt_private_field_class *priv_fc, enum bt_field_class_integer_preferred_display_base base) { + struct bt_field_class *fc = (void *) priv_fc; struct bt_field_class_integer *int_fc = (void *) fc; BT_ASSERT_PRE_NON_NULL(fc, "Field class"); BT_ASSERT_PRE_FC_IS_INT(fc, "Field class"); BT_ASSERT_PRE_FC_HOT(fc, "Field class"); int_fc->base = base; - BT_LIB_LOGV("Set integer field classe's preferred display base: %!+F", fc); + BT_LIB_LOGV("Set integer field class's preferred display base: %!+F", fc); return 0; } @@ -203,7 +207,7 @@ void destroy_enumeration_field_class(struct bt_object *obj) struct bt_field_class_enumeration *fc = (void *) obj; BT_ASSERT(fc); - BT_LIB_LOGD("Destroying enumeration field classe object: %!+F", fc); + BT_LIB_LOGD("Destroying enumeration field class object: %!+F", fc); if (fc->mappings) { uint64_t i; @@ -228,11 +232,11 @@ struct bt_field_class *create_enumeration_field_class(enum bt_field_class_type t { struct bt_field_class_enumeration *enum_fc = NULL; - BT_LOGD("Creating default enumeration field classe object: type=%s", + BT_LOGD("Creating default enumeration field class object: type=%s", bt_common_field_class_type_string(type)); enum_fc = g_new0(struct bt_field_class_enumeration, 1); if (!enum_fc) { - BT_LOGE_STR("Failed to allocate one enumeration field classe."); + BT_LOGE_STR("Failed to allocate one enumeration field class."); goto error; } @@ -251,7 +255,7 @@ struct bt_field_class *create_enumeration_field_class(enum bt_field_class_type t goto error; } - BT_LIB_LOGD("Created enumeration field classe object: %!+F", enum_fc); + BT_LIB_LOGD("Created enumeration field class object: %!+F", enum_fc); goto end; error: @@ -261,15 +265,17 @@ end: return (void *) enum_fc; } -struct bt_field_class *bt_field_class_unsigned_enumeration_create(void) +struct bt_private_field_class * +bt_private_field_class_unsigned_enumeration_create(void) { - return create_enumeration_field_class( + return (void *) create_enumeration_field_class( BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION); } -struct bt_field_class *bt_field_class_signed_enumeration_create(void) +struct bt_private_field_class * +bt_private_field_class_signed_enumeration_create(void) { - return create_enumeration_field_class( + return (void *) create_enumeration_field_class( BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION); } @@ -508,7 +514,7 @@ int add_mapping_to_enumeration_field_class(struct bt_field_class *fc, mapping->ranges->len - 1); range->lower.u = lower; range->upper.u = upper; - BT_LIB_LOGV("Added mapping to enumeration field classe: " + BT_LIB_LOGV("Added mapping to enumeration field class: " "%![fc-]+F, label=\"%s\", lower-unsigned=%" PRIu64 ", " "upper-unsigned=%" PRIu64, fc, label, lower, upper); @@ -516,10 +522,11 @@ end: return ret; } -int bt_field_class_unsigned_enumeration_map_range( - struct bt_field_class *fc, const char *label, +int bt_private_field_class_unsigned_enumeration_map_range( + struct bt_private_field_class *priv_fc, const char *label, uint64_t range_lower, uint64_t range_upper) { + struct bt_field_class *fc = (void *) priv_fc; struct bt_field_class_enumeration *enum_fc = (void *) fc; BT_ASSERT_PRE_NON_NULL(fc, "Field class"); @@ -531,20 +538,21 @@ int bt_field_class_unsigned_enumeration_map_range( range_lower, range_upper); BT_ASSERT_PRE(bt_util_value_is_in_range_unsigned(enum_fc->common.range, range_lower), - "Range's lower bound is outside the enumeration field classe's value range: " + "Range's lower bound is outside the enumeration field class's value range: " "%![fc-]+F, lower=%" PRIu64, fc, range_lower); BT_ASSERT_PRE(bt_util_value_is_in_range_unsigned(enum_fc->common.range, range_upper), - "Range's upper bound is outside the enumeration field classe's value range: " + "Range's upper bound is outside the enumeration field class's value range: " "%![fc-]+F, upper=%" PRIu64, fc, range_upper); return add_mapping_to_enumeration_field_class(fc, label, range_lower, range_upper); } -int bt_field_class_signed_enumeration_map_range( - struct bt_field_class *fc, const char *label, +int bt_private_field_class_signed_enumeration_map_range( + struct bt_private_field_class *priv_fc, const char *label, int64_t range_lower, int64_t range_upper) { + struct bt_field_class *fc = (void *) priv_fc; struct bt_field_class_enumeration *enum_fc = (void *) fc; BT_ASSERT_PRE_NON_NULL(fc, "Field class"); @@ -556,11 +564,11 @@ int bt_field_class_signed_enumeration_map_range( range_lower, range_upper); BT_ASSERT_PRE(bt_util_value_is_in_range_signed(enum_fc->common.range, range_lower), - "Range's lower bound is outside the enumeration field classe's value range: " + "Range's lower bound is outside the enumeration field class's value range: " "%![fc-]+F, lower=%" PRId64, fc, range_lower); BT_ASSERT_PRE(bt_util_value_is_in_range_signed(enum_fc->common.range, range_upper), - "Range's upper bound is outside the enumeration field classe's value range: " + "Range's upper bound is outside the enumeration field class's value range: " "%![fc-]+F, upper=%" PRId64, fc, range_upper); return add_mapping_to_enumeration_field_class(fc, label, range_lower, range_upper); @@ -570,24 +578,24 @@ static void destroy_real_field_class(struct bt_object *obj) { BT_ASSERT(obj); - BT_LIB_LOGD("Destroying real field classe object: %!+F", obj); + BT_LIB_LOGD("Destroying real field class object: %!+F", obj); g_free(obj); } -struct bt_field_class *bt_field_class_real_create(void) +struct bt_private_field_class *bt_private_field_class_real_create(void) { struct bt_field_class_real *real_fc = NULL; - BT_LOGD_STR("Creating default real field classe object."); + BT_LOGD_STR("Creating default real field class object."); real_fc = g_new0(struct bt_field_class_real, 1); if (!real_fc) { - BT_LOGE_STR("Failed to allocate one real field classe."); + BT_LOGE_STR("Failed to allocate one real field class."); goto error; } init_field_class((void *) real_fc, BT_FIELD_CLASS_TYPE_REAL, destroy_real_field_class); - BT_LIB_LOGD("Created real field classe object: %!+F", real_fc); + BT_LIB_LOGD("Created real field class object: %!+F", real_fc); goto end; error: @@ -606,16 +614,18 @@ bt_bool bt_field_class_real_is_single_precision(struct bt_field_class *fc) return real_fc->is_single_precision; } -int bt_field_class_real_set_is_single_precision(struct bt_field_class *fc, +int bt_private_field_class_real_set_is_single_precision( + struct bt_private_field_class *priv_fc, bt_bool is_single_precision) { + struct bt_field_class *fc = (void *) priv_fc; struct bt_field_class_real *real_fc = (void *) fc; BT_ASSERT_PRE_NON_NULL(fc, "Field class"); BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class"); BT_ASSERT_PRE_FC_HOT(fc, "Field class"); real_fc->is_single_precision = (bool) is_single_precision; - BT_LIB_LOGV("Set real field classe's \"is single precision\" property: " + BT_LIB_LOGV("Set real field class's \"is single precision\" property: " "%!+F", fc); return 0; } @@ -651,7 +661,7 @@ static void finalize_named_field_class(struct bt_named_field_class *named_fc) { BT_ASSERT(named_fc); - BT_LIB_LOGD("Finalizing named field classe: " + BT_LIB_LOGD("Finalizing named field class: " "addr=%p, name=\"%s\", %![fc-]+F", named_fc, named_fc->name ? named_fc->name->str : NULL, named_fc->fc); @@ -660,7 +670,7 @@ void finalize_named_field_class(struct bt_named_field_class *named_fc) g_string_free(named_fc->name, TRUE); } - BT_LOGD_STR("Putting named field classe's field classe."); + BT_LOGD_STR("Putting named field class's field class."); bt_object_put_ref(named_fc->fc); } @@ -691,20 +701,20 @@ static void destroy_structure_field_class(struct bt_object *obj) { BT_ASSERT(obj); - BT_LIB_LOGD("Destroying string field classe object: %!+F", obj); + BT_LIB_LOGD("Destroying string field class object: %!+F", obj); finalize_named_field_classes_container((void *) obj); g_free(obj); } -struct bt_field_class *bt_field_class_structure_create(void) +struct bt_private_field_class *bt_private_field_class_structure_create(void) { int ret; struct bt_field_class_structure *struct_fc = NULL; - BT_LOGD_STR("Creating default structure field classe object."); + BT_LOGD_STR("Creating default structure field class object."); struct_fc = g_new0(struct bt_field_class_structure, 1); if (!struct_fc) { - BT_LOGE_STR("Failed to allocate one structure field classe."); + BT_LOGE_STR("Failed to allocate one structure field class."); goto error; } @@ -714,7 +724,7 @@ struct bt_field_class *bt_field_class_structure_create(void) goto error; } - BT_LIB_LOGD("Created structure field classe object: %!+F", struct_fc); + BT_LIB_LOGD("Created structure field class object: %!+F", struct_fc); goto end; error: @@ -739,7 +749,7 @@ int append_named_field_class_to_container_field_class( BT_ASSERT_PRE_NON_NULL(fc, "Field class"); BT_ASSERT_PRE(!bt_g_hash_table_contains(container_fc->name_to_index, name), - "Duplicate member/option name in structure/variant field classe: " + "Duplicate member/option name in structure/variant field class: " "%![container-fc-]+F, name=\"%s\"", container_fc, name); name_str = g_string_new(name); if (!name_str) { @@ -762,13 +772,16 @@ end: return ret; } -int bt_field_class_structure_append_member(struct bt_field_class *fc, - const char *name, struct bt_field_class *member_fc) +int bt_private_field_class_structure_append_private_member( + struct bt_private_field_class *priv_fc, + const char *name, struct bt_private_field_class *member_fc) { + struct bt_field_class *fc = (void *) priv_fc; + BT_ASSERT_PRE_NON_NULL(fc, "Field class"); BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE, "Field class"); return append_named_field_class_to_container_field_class((void *) fc, - name, member_fc); + name, (void *) member_fc); } uint64_t bt_field_class_structure_get_member_count(struct bt_field_class *fc) @@ -807,6 +820,14 @@ void bt_field_class_structure_borrow_member_by_index( index, name, out_fc); } +void bt_private_field_class_structure_borrow_private_member_by_index( + struct bt_private_field_class *fc, uint64_t index, + const char **name, struct bt_private_field_class **out_fc) +{ + bt_field_class_structure_borrow_member_by_index((void *) fc, + index, name, (void *) out_fc); +} + static struct bt_field_class *borrow_field_class_from_container_field_class_by_name( struct bt_field_class_named_field_class_container *fc, @@ -841,28 +862,36 @@ struct bt_field_class *bt_field_class_structure_borrow_member_field_class_by_nam name); } +struct bt_private_field_class * +bt_private_field_class_structure_borrow_member_private_field_class_by_name( + struct bt_private_field_class *fc, const char *name) +{ + return (void *) bt_field_class_structure_borrow_member_field_class_by_name( + (void *) fc, name); +} + static void destroy_variant_field_class(struct bt_object *obj) { struct bt_field_class_variant *fc = (void *) obj; BT_ASSERT(fc); - BT_LIB_LOGD("Destroying variant field classe object: %!+F", fc); + BT_LIB_LOGD("Destroying variant field class object: %!+F", fc); finalize_named_field_classes_container((void *) fc); BT_LOGD_STR("Putting selector field path."); bt_object_put_ref(fc->selector_field_path); g_free(fc); } -struct bt_field_class *bt_field_class_variant_create(void) +struct bt_private_field_class *bt_private_field_class_variant_create(void) { int ret; struct bt_field_class_variant *var_fc = NULL; - BT_LOGD_STR("Creating default variant field classe object."); + BT_LOGD_STR("Creating default variant field class object."); var_fc = g_new0(struct bt_field_class_variant, 1); if (!var_fc) { - BT_LOGE_STR("Failed to allocate one variant field classe."); + BT_LOGE_STR("Failed to allocate one variant field class."); goto error; } @@ -872,7 +901,7 @@ struct bt_field_class *bt_field_class_variant_create(void) goto error; } - BT_LIB_LOGD("Created variant field classe object: %!+F", var_fc); + BT_LIB_LOGD("Created variant field class object: %!+F", var_fc); goto end; error: @@ -882,28 +911,33 @@ end: return (void *) var_fc; } -int bt_field_class_variant_set_selector_field_class( - struct bt_field_class *fc, struct bt_field_class *selector_fc) +int bt_private_field_class_variant_set_selector_private_field_class( + struct bt_private_field_class *priv_fc, + struct bt_private_field_class *selector_fc) { + struct bt_field_class *fc = (void *) priv_fc; struct bt_field_class_variant *var_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Variant field classe"); - BT_ASSERT_PRE_NON_NULL(selector_fc, "Selector field classe"); + BT_ASSERT_PRE_NON_NULL(fc, "Variant field class"); + BT_ASSERT_PRE_NON_NULL(selector_fc, "Selector field class"); BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class"); - BT_ASSERT_PRE_FC_IS_ENUM(selector_fc, "Selector field classe"); - BT_ASSERT_PRE_FC_HOT(fc, "Variant field classe"); - var_fc->selector_fc = selector_fc; - bt_field_class_freeze(selector_fc); + BT_ASSERT_PRE_FC_IS_ENUM(selector_fc, "Selector field class"); + BT_ASSERT_PRE_FC_HOT(fc, "Variant field class"); + var_fc->selector_fc = (void *) selector_fc; + bt_field_class_freeze((void *) selector_fc); return 0; } -int bt_field_class_variant_append_option(struct bt_field_class *fc, - const char *name, struct bt_field_class *option_fc) +int bt_private_field_class_variant_append_private_option( + struct bt_private_field_class *priv_fc, + const char *name, struct bt_private_field_class *option_fc) { + struct bt_field_class *fc = (void *) priv_fc; + BT_ASSERT_PRE_NON_NULL(fc, "Field class"); BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class"); return append_named_field_class_to_container_field_class((void *) fc, - name, option_fc); + name, (void *) option_fc); } struct bt_field_class *bt_field_class_variant_borrow_option_field_class_by_name( @@ -915,6 +949,14 @@ struct bt_field_class *bt_field_class_variant_borrow_option_field_class_by_name( name); } +struct bt_private_field_class * +bt_private_field_class_variant_borrow_option_private_field_class_by_name( + struct bt_private_field_class *fc, const char *name) +{ + return (void *) bt_field_class_variant_borrow_option_field_class_by_name( + (void *) fc, name); +} + uint64_t bt_field_class_variant_get_option_count(struct bt_field_class *fc) { struct bt_field_class_variant *var_fc = (void *) fc; @@ -934,6 +976,14 @@ void bt_field_class_variant_borrow_option_by_index( index, name, out_fc); } +void bt_private_field_class_variant_borrow_private_option_by_index( + struct bt_private_field_class *fc, uint64_t index, + const char **name, struct bt_private_field_class **out_fc) +{ + bt_field_class_variant_borrow_option_by_index((void *) fc, + index, name, (void *) out_fc); +} + struct bt_field_path *bt_field_class_variant_borrow_selector_field_path( struct bt_field_class *fc) { @@ -960,7 +1010,7 @@ static void finalize_array_field_class(struct bt_field_class_array *array_fc) { BT_ASSERT(array_fc); - BT_LOGD_STR("Putting element field classe."); + BT_LOGD_STR("Putting element field class."); bt_object_put_ref(array_fc->element_fc); } @@ -968,28 +1018,31 @@ static void destroy_static_array_field_class(struct bt_object *obj) { BT_ASSERT(obj); - BT_LIB_LOGD("Destroying static array field classe object: %!+F", obj); + BT_LIB_LOGD("Destroying static array field class object: %!+F", obj); finalize_array_field_class((void *) obj); g_free(obj); } -struct bt_field_class *bt_field_class_static_array_create( - struct bt_field_class *element_fc, uint64_t length) +struct bt_private_field_class * +bt_private_field_class_static_array_create( + struct bt_private_field_class *priv_element_fc, + uint64_t length) { + struct bt_field_class *element_fc = (void *) priv_element_fc; struct bt_field_class_static_array *array_fc = NULL; - BT_ASSERT_PRE_NON_NULL(element_fc, "Element field classe"); - BT_LOGD_STR("Creating default static array field classe object."); + BT_ASSERT_PRE_NON_NULL(element_fc, "Element field class"); + BT_LOGD_STR("Creating default static array field class object."); array_fc = g_new0(struct bt_field_class_static_array, 1); if (!array_fc) { - BT_LOGE_STR("Failed to allocate one static array field classe."); + BT_LOGE_STR("Failed to allocate one static array field class."); goto error; } init_array_field_class((void *) array_fc, BT_FIELD_CLASS_TYPE_STATIC_ARRAY, destroy_static_array_field_class, element_fc); array_fc->length = length; - BT_LIB_LOGD("Created static array field classe object: %!+F", array_fc); + BT_LIB_LOGD("Created static array field class object: %!+F", array_fc); goto end; error: @@ -1009,6 +1062,14 @@ struct bt_field_class *bt_field_class_array_borrow_element_field_class( return array_fc->element_fc; } +struct bt_private_field_class * +bt_private_field_class_array_borrow_element_field_class( + struct bt_private_field_class *fc) +{ + return (void *) bt_field_class_array_borrow_element_field_class( + (void *) fc); +} + uint64_t bt_field_class_static_array_get_length(struct bt_field_class *fc) { struct bt_field_class_static_array *array_fc = (void *) fc; @@ -1025,29 +1086,30 @@ void destroy_dynamic_array_field_class(struct bt_object *obj) struct bt_field_class_dynamic_array *fc = (void *) obj; BT_ASSERT(fc); - BT_LIB_LOGD("Destroying dynamic array field classe object: %!+F", fc); + BT_LIB_LOGD("Destroying dynamic array field class object: %!+F", fc); finalize_array_field_class((void *) fc); BT_LOGD_STR("Putting length field path."); bt_object_put_ref(fc->length_field_path); g_free(fc); } -struct bt_field_class *bt_field_class_dynamic_array_create( - struct bt_field_class *element_fc) +struct bt_private_field_class *bt_private_field_class_dynamic_array_create( + struct bt_private_field_class *priv_element_fc) { + struct bt_field_class *element_fc = (void *) priv_element_fc; struct bt_field_class_dynamic_array *array_fc = NULL; - BT_ASSERT_PRE_NON_NULL(element_fc, "Element field classe"); - BT_LOGD_STR("Creating default dynamic array field classe object."); + BT_ASSERT_PRE_NON_NULL(element_fc, "Element field class"); + BT_LOGD_STR("Creating default dynamic array field class object."); array_fc = g_new0(struct bt_field_class_dynamic_array, 1); if (!array_fc) { - BT_LOGE_STR("Failed to allocate one dynamic array field classe."); + BT_LOGE_STR("Failed to allocate one dynamic array field class."); goto error; } init_array_field_class((void *) array_fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, destroy_dynamic_array_field_class, element_fc); - BT_LIB_LOGD("Created dynamic array field classe object: %!+F", array_fc); + BT_LIB_LOGD("Created dynamic array field class object: %!+F", array_fc); goto end; error: @@ -1057,17 +1119,20 @@ end: return (void *) array_fc; } -int bt_field_class_dynamic_array_set_length_field_class(struct bt_field_class *fc, - struct bt_field_class *length_fc) +int bt_private_field_class_dynamic_array_set_length_private_field_class( + struct bt_private_field_class *priv_fc, + struct bt_private_field_class *priv_length_fc) { + struct bt_field_class *fc = (void *) priv_fc; + struct bt_field_class *length_fc = (void *) priv_length_fc; struct bt_field_class_dynamic_array *array_fc = (void *) fc; - BT_ASSERT_PRE_NON_NULL(fc, "Dynamic array field classe"); - BT_ASSERT_PRE_NON_NULL(length_fc, "Length field classe"); + BT_ASSERT_PRE_NON_NULL(fc, "Dynamic array field class"); + BT_ASSERT_PRE_NON_NULL(length_fc, "Length field class"); BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, "Field class"); - BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(length_fc, "Length field classe"); - BT_ASSERT_PRE_FC_HOT(fc, "Dynamic array field classe"); + BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(length_fc, "Length field class"); + BT_ASSERT_PRE_FC_HOT(fc, "Dynamic array field class"); array_fc->length_fc = length_fc; bt_field_class_freeze(length_fc); return 0; @@ -1088,24 +1153,24 @@ static void destroy_string_field_class(struct bt_object *obj) { BT_ASSERT(obj); - BT_LIB_LOGD("Destroying string field classe object: %!+F", obj); + BT_LIB_LOGD("Destroying string field class object: %!+F", obj); g_free(obj); } -struct bt_field_class *bt_field_class_string_create(void) +struct bt_private_field_class *bt_private_field_class_string_create(void) { struct bt_field_class_string *string_fc = NULL; - BT_LOGD_STR("Creating default string field classe object."); + BT_LOGD_STR("Creating default string field class object."); string_fc = g_new0(struct bt_field_class_string, 1); if (!string_fc) { - BT_LOGE_STR("Failed to allocate one string field classe."); + BT_LOGE_STR("Failed to allocate one string field class."); goto error; } init_field_class((void *) string_fc, BT_FIELD_CLASS_TYPE_STRING, destroy_string_field_class); - BT_LIB_LOGD("Created string field classe object: %!+F", string_fc); + BT_LIB_LOGD("Created string field class object: %!+F", string_fc); goto end; error: @@ -1164,3 +1229,9 @@ void _bt_field_class_make_part_of_trace(struct bt_field_class *fc) break; } } + +struct bt_field_class *bt_field_class_borrow_from_private( + struct bt_private_field_class *priv_field_class) +{ + return (void *) priv_field_class; +} diff --git a/lib/trace-ir/field-path.c b/lib/trace-ir/field-path.c index d6414e89..2534facf 100644 --- a/lib/trace-ir/field-path.c +++ b/lib/trace-ir/field-path.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/lib/trace-ir/fields.c b/lib/trace-ir/fields.c index fc1d0042..d374d0a0 100644 --- a/lib/trace-ir/fields.c +++ b/lib/trace-ir/fields.c @@ -1,8 +1,4 @@ /* - * fields.c - * - * Babeltrace trace IR - Event Fields - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,6 +26,7 @@ #include #include +#include #include #include #include @@ -192,6 +189,12 @@ struct bt_field_class *bt_field_borrow_class(struct bt_field *field) return field->class; } +struct bt_private_field_class *bt_private_field_borrow_private_class( + struct bt_private_field *field) +{ + return (void *) bt_field_borrow_class((void *) field); +} + enum bt_field_class_type bt_field_get_class_type(struct bt_field *field) { BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -489,8 +492,10 @@ int64_t bt_field_signed_integer_get_value(struct bt_field *field) return int_field->value.i; } -void bt_field_signed_integer_set_value(struct bt_field *field, int64_t value) +void bt_private_field_signed_integer_set_value( + struct bt_private_field *priv_field, int64_t value) { + struct bt_field *field = (void *) priv_field; struct bt_field_integer *int_field = (void *) field; BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -514,9 +519,10 @@ uint64_t bt_field_unsigned_integer_get_value(struct bt_field *field) return int_field->value.u; } -void bt_field_unsigned_integer_set_value(struct bt_field *field, - uint64_t value) +void bt_private_field_unsigned_integer_set_value( + struct bt_private_field *priv_field, uint64_t value) { + struct bt_field *field = (void *) priv_field; struct bt_field_integer *int_field = (void *) field; BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -540,8 +546,10 @@ double bt_field_real_get_value(struct bt_field *field) return real_field->value; } -void bt_field_real_set_value(struct bt_field *field, double value) +void bt_private_field_real_set_value(struct bt_private_field *priv_field, + double value) { + struct bt_field *field = (void *) priv_field; struct bt_field_real *real_field = (void *) field; BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -610,27 +618,33 @@ uint64_t bt_field_string_get_length(struct bt_field *field) return string_field->length; } -int bt_field_string_set_value(struct bt_field *field, const char *value) +int bt_private_field_string_set_value(struct bt_private_field *priv_field, + const char *value) { + struct bt_field *field = (void *) priv_field; + BT_ASSERT_PRE_NON_NULL(field, "Field"); BT_ASSERT_PRE_NON_NULL(value, "Value"); BT_ASSERT_PRE_FIELD_HOT(field, "Field"); BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING, "Field"); - bt_field_string_clear(field); - return bt_field_string_append_with_length(field, value, + bt_private_field_string_clear(priv_field); + return bt_private_field_string_append_with_length(priv_field, value, (uint64_t) strlen(value)); } -int bt_field_string_append(struct bt_field *field, const char *value) +int bt_private_field_string_append(struct bt_private_field *field, + const char *value) { - return bt_field_string_append_with_length(field, value, - (uint64_t) strlen(value)); + return bt_private_field_string_append_with_length(field, + value, (uint64_t) strlen(value)); } -int bt_field_string_append_with_length(struct bt_field *field, +int bt_private_field_string_append_with_length( + struct bt_private_field *priv_field, const char *value, uint64_t length) { + struct bt_field *field = (void *) priv_field; struct bt_field_string *string_field = (void *) field; char *data; uint64_t new_length; @@ -660,8 +674,9 @@ int bt_field_string_append_with_length(struct bt_field *field, return 0; } -int bt_field_string_clear(struct bt_field *field) +int bt_private_field_string_clear(struct bt_private_field *priv_field) { + struct bt_field *field = (void *) priv_field; struct bt_field_string *string_field = (void *) field; BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -682,10 +697,11 @@ uint64_t bt_field_array_get_length(struct bt_field *field) return array_field->length; } -int bt_field_dynamic_array_set_length(struct bt_field *field, - uint64_t length) +int bt_private_field_dynamic_array_set_length( + struct bt_private_field *priv_field, uint64_t length) { int ret = 0; + struct bt_field *field = (void *) priv_field; struct bt_field_array *array_field = (void *) field; BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -737,6 +753,14 @@ struct bt_field *bt_field_array_borrow_element_field_by_index( return array_field->fields->pdata[index]; } +struct bt_private_field * +bt_private_field_array_borrow_element_private_field_by_index( + struct bt_private_field *field, uint64_t index) +{ + return (void *) bt_field_array_borrow_element_field_by_index( + (void *) field, index); +} + struct bt_field *bt_field_structure_borrow_member_field_by_index( struct bt_field *field, uint64_t index) { @@ -749,6 +773,14 @@ struct bt_field *bt_field_structure_borrow_member_field_by_index( return struct_field->fields->pdata[index]; } +struct bt_private_field * +bt_private_field_structure_borrow_member_private_field_by_index( + struct bt_private_field *field, uint64_t index) +{ + return (void *) bt_field_structure_borrow_member_field_by_index( + (void *) field, index); +} + struct bt_field *bt_field_structure_borrow_member_field_by_name( struct bt_field *field, const char *name) { @@ -776,6 +808,14 @@ end: return ret_field; } +struct bt_private_field * +bt_private_field_structure_borrow_member_private_field_by_name( + struct bt_private_field *field, const char *name) +{ + return (void *) bt_field_structure_borrow_member_field_by_name( + (void *) field, name); +} + struct bt_field *bt_field_variant_borrow_selected_option_field( struct bt_field *field) { @@ -789,9 +829,18 @@ struct bt_field *bt_field_variant_borrow_selected_option_field( return var_field->selected_field; } -int bt_field_variant_select_option_field(struct bt_field *field, - uint64_t index) +struct bt_private_field * +bt_private_field_variant_borrow_selected_option_private_field( + struct bt_private_field *field) { + return (void *) bt_field_variant_borrow_selected_option_field( + (void *) field); +} + +int bt_private_field_variant_select_option_private_field( + struct bt_private_field *priv_field, uint64_t index) +{ + struct bt_field *field = (void *) priv_field; struct bt_field_variant *var_field = (void *) field; BT_ASSERT_PRE_NON_NULL(field, "Field"); @@ -1102,3 +1151,9 @@ bool array_field_is_set(struct bt_field *field) end: return is_set; } + +struct bt_field *bt_field_borrow_from_private( + struct bt_private_field *priv_field) +{ + return (void *) priv_field; +} diff --git a/lib/trace-ir/packet-context-field.c b/lib/trace-ir/packet-context-field.c index a8eddee6..967ba52c 100644 --- a/lib/trace-ir/packet-context-field.c +++ b/lib/trace-ir/packet-context-field.c @@ -25,21 +25,22 @@ #include #include -#include +#include #include #include #include -struct bt_field *bt_packet_context_field_borrow_field( - struct bt_packet_context_field *context_field) +struct bt_private_field *bt_private_packet_context_field_borrow_private_field( + struct bt_private_packet_context_field *context_field) { struct bt_field_wrapper *field_wrapper = (void *) context_field; BT_ASSERT_PRE_NON_NULL(field_wrapper, "Packet context field"); - return field_wrapper->field; + return (void *) field_wrapper->field; } -void bt_packet_context_field_release(struct bt_packet_context_field *context_field) +void bt_private_packet_context_field_release( + struct bt_private_packet_context_field *context_field) { struct bt_field_wrapper *field_wrapper = (void *) context_field; @@ -55,9 +56,10 @@ void bt_packet_context_field_release(struct bt_packet_context_field *context_fie bt_field_wrapper_destroy(field_wrapper); } -struct bt_packet_context_field *bt_packet_context_field_create( - struct bt_stream_class *stream_class) +struct bt_private_packet_context_field *bt_private_packet_context_field_create( + struct bt_private_stream_class *priv_stream_class) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; struct bt_field_wrapper *field_wrapper; BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); diff --git a/lib/trace-ir/packet-header-field.c b/lib/trace-ir/packet-header-field.c index 3a484dc8..b02704bc 100644 --- a/lib/trace-ir/packet-header-field.c +++ b/lib/trace-ir/packet-header-field.c @@ -25,13 +25,13 @@ #include #include -#include +#include #include #include #include -struct bt_field *bt_packet_header_field_borrow_field( - struct bt_packet_header_field *header_field) +struct bt_private_field *bt_private_packet_header_field_borrow_private_field( + struct bt_private_packet_header_field *header_field) { struct bt_field_wrapper *field_wrapper = (void *) header_field; @@ -39,7 +39,8 @@ struct bt_field *bt_packet_header_field_borrow_field( return (void *) field_wrapper->field; } -void bt_packet_header_field_release(struct bt_packet_header_field *header_field) +void bt_private_packet_header_field_release( + struct bt_private_packet_header_field *header_field) { struct bt_field_wrapper *field_wrapper = (void *) header_field; @@ -55,10 +56,11 @@ void bt_packet_header_field_release(struct bt_packet_header_field *header_field) bt_field_wrapper_destroy(field_wrapper); } -struct bt_packet_header_field *bt_packet_header_field_create( - struct bt_trace *trace) +struct bt_private_packet_header_field *bt_private_packet_header_field_create( + struct bt_private_trace *priv_trace) { struct bt_field_wrapper *field_wrapper; + struct bt_trace *trace = (void *) priv_trace; BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE(trace->packet_header_fc, diff --git a/lib/trace-ir/packet.c b/lib/trace-ir/packet.c index a6a12235..f4443453 100644 --- a/lib/trace-ir/packet.c +++ b/lib/trace-ir/packet.c @@ -1,8 +1,4 @@ /* - * packet.c - * - * Babeltrace trace IR - Stream packet - * * Copyright 2016 Philippe Proulx * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -29,6 +25,7 @@ #include #include +#include #include #include #include @@ -53,18 +50,36 @@ struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet) return packet->stream; } +struct bt_private_stream *bt_private_packet_borrow_private_stream( + struct bt_private_packet *packet) +{ + return (void *) bt_packet_borrow_stream((void *) packet); +} + struct bt_field *bt_packet_borrow_header_field(struct bt_packet *packet) { BT_ASSERT_PRE_NON_NULL(packet, "Packet"); return packet->header_field ? packet->header_field->field : NULL; } +struct bt_private_field *bt_private_packet_borrow_header_private_field( + struct bt_private_packet *packet) +{ + return (void *) bt_packet_borrow_header_field((void *) packet); +} + struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet) { BT_ASSERT_PRE_NON_NULL(packet, "Packet"); return packet->context_field ? packet->context_field->field : NULL; } +struct bt_private_field *bt_private_packet_borrow_context_private_field( + struct bt_private_packet *packet) +{ + return (void *) bt_packet_borrow_context_field((void *) packet); +} + BT_HIDDEN void _bt_packet_set_is_frozen(struct bt_packet *packet, bool is_frozen) { @@ -303,8 +318,10 @@ end: return packet; } -struct bt_packet *bt_packet_create(struct bt_stream *stream) +struct bt_private_packet *bt_private_packet_create( + struct bt_private_stream *priv_stream) { + struct bt_stream *stream = (void *) priv_stream; struct bt_packet *packet = NULL; BT_ASSERT_PRE_NON_NULL(stream, "Stream"); @@ -322,12 +339,14 @@ struct bt_packet *bt_packet_create(struct bt_stream *stream) } end: - return packet; + return (void *) packet; } -int bt_packet_move_header_field(struct bt_packet *packet, - struct bt_packet_header_field *header_field) +int bt_private_packet_move_private_header_field( + struct bt_private_packet *priv_packet, + struct bt_private_packet_header_field *header_field) { + struct bt_packet *packet = (void *) priv_packet; struct bt_trace *trace; struct bt_field_wrapper *field_wrapper = (void *) header_field; @@ -353,9 +372,11 @@ int bt_packet_move_header_field(struct bt_packet *packet, return 0; } -int bt_packet_move_context_field(struct bt_packet *packet, - struct bt_packet_context_field *context_field) +int bt_private_packet_move_private_context_field( + struct bt_private_packet *priv_packet, + struct bt_private_packet_context_field *context_field) { + struct bt_packet *packet = (void *) priv_packet; struct bt_stream_class *stream_class; struct bt_field_wrapper *field_wrapper = (void *) context_field; @@ -381,9 +402,11 @@ int bt_packet_move_context_field(struct bt_packet *packet, return 0; } -int bt_packet_set_default_beginning_clock_value(struct bt_packet *packet, +int bt_private_packet_set_default_beginning_clock_value( + struct bt_private_packet *priv_packet, uint64_t value_cycles) { + struct bt_packet *packet = (void *) priv_packet; struct bt_stream_class *sc; BT_ASSERT_PRE_NON_NULL(packet, "Packet"); @@ -400,7 +423,7 @@ int bt_packet_set_default_beginning_clock_value(struct bt_packet *packet, BT_ASSERT(packet->default_beginning_cv); bt_clock_value_set_value_inline(packet->default_beginning_cv, value_cycles); BT_LIB_LOGV("Set packet's default beginning clock value: " - "%![packet-]+a, value=%" PRIu64, value_cycles); + "%![packet-]+a, value=%" PRIu64, packet, value_cycles); return 0; } @@ -413,9 +436,11 @@ enum bt_clock_value_status bt_packet_borrow_default_beginning_clock_value( return BT_CLOCK_VALUE_STATUS_KNOWN; } -int bt_packet_set_default_end_clock_value(struct bt_packet *packet, +int bt_private_packet_set_default_end_clock_value( + struct bt_private_packet *priv_packet, uint64_t value_cycles) { + struct bt_packet *packet = (void *) priv_packet; struct bt_stream_class *sc; BT_ASSERT_PRE_NON_NULL(packet, "Packet"); @@ -432,7 +457,7 @@ int bt_packet_set_default_end_clock_value(struct bt_packet *packet, BT_ASSERT(packet->default_end_cv); bt_clock_value_set_value_inline(packet->default_end_cv, value_cycles); BT_LIB_LOGV("Set packet's default end clock value: " - "%![packet-]+a, value=%" PRIu64, value_cycles); + "%![packet-]+a, value=%" PRIu64, packet, value_cycles); return 0; } @@ -454,9 +479,11 @@ enum bt_property_availability bt_packet_get_discarded_event_counter_snapshot( return packet->discarded_event_counter_snapshot.base.avail; } -int bt_packet_set_discarded_event_counter_snapshot(struct bt_packet *packet, - uint64_t value) +int bt_private_packet_set_discarded_event_counter_snapshot( + struct bt_private_packet *priv_packet, uint64_t value) { + struct bt_packet *packet = (void *) priv_packet; + BT_ASSERT_PRE_NON_NULL(packet, "Packet"); BT_ASSERT_PRE_PACKET_HOT(packet); BT_ASSERT_PRE(packet->stream->class->packets_have_discarded_event_counter_snapshot, @@ -475,9 +502,11 @@ enum bt_property_availability bt_packet_get_packet_counter_snapshot( return packet->packet_counter_snapshot.base.avail; } -int bt_packet_set_packet_counter_snapshot(struct bt_packet *packet, - uint64_t value) +int bt_private_packet_set_packet_counter_snapshot( + struct bt_private_packet *priv_packet, uint64_t value) { + struct bt_packet *packet = (void *) priv_packet; + BT_ASSERT_PRE_NON_NULL(packet, "Packet"); BT_ASSERT_PRE_PACKET_HOT(packet); BT_ASSERT_PRE(packet->stream->class->packets_have_packet_counter_snapshot, @@ -486,3 +515,9 @@ int bt_packet_set_packet_counter_snapshot(struct bt_packet *packet, bt_property_uint_set(&packet->packet_counter_snapshot, value); return 0; } + +struct bt_packet *bt_packet_borrow_from_private( + struct bt_private_packet *priv_packet) +{ + return (void *) priv_packet; +} diff --git a/lib/trace-ir/resolve-field-path.c b/lib/trace-ir/resolve-field-path.c index 32b289d1..1b690be7 100644 --- a/lib/trace-ir/resolve-field-path.c +++ b/lib/trace-ir/resolve-field-path.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include diff --git a/lib/trace-ir/stream-class.c b/lib/trace-ir/stream-class.c index cc51cced..8c5133b1 100644 --- a/lib/trace-ir/stream-class.c +++ b/lib/trace-ir/stream-class.c @@ -1,8 +1,4 @@ /* - * stream-class.c - * - * Babeltrace trace IR - Stream Class - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -35,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -180,24 +178,29 @@ end: return stream_class; } -struct bt_stream_class *bt_stream_class_create(struct bt_trace *trace) +struct bt_private_stream_class *bt_private_stream_class_create( + struct bt_private_trace *priv_trace) { + struct bt_trace *trace = (void *) priv_trace; + BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE(trace->assigns_automatic_stream_class_id, "Trace does not automatically assigns stream class IDs: " "%![sc-]+t", trace); - return create_stream_class_with_id(trace, + return (void *) create_stream_class_with_id(trace, (uint64_t) trace->stream_classes->len); } -struct bt_stream_class *bt_stream_class_create_with_id( - struct bt_trace *trace, uint64_t id) +struct bt_private_stream_class *bt_private_stream_class_create_with_id( + struct bt_private_trace *priv_trace, uint64_t id) { + struct bt_trace *trace = (void *) priv_trace; + BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE(!trace->assigns_automatic_stream_class_id, "Trace automatically assigns stream class IDs: " "%![sc-]+t", trace); - return create_stream_class_with_id(trace, id); + return (void *) create_stream_class_with_id(trace, id); } struct bt_trace *bt_stream_class_borrow_trace(struct bt_stream_class *stream_class) @@ -206,15 +209,24 @@ struct bt_trace *bt_stream_class_borrow_trace(struct bt_stream_class *stream_cla return bt_stream_class_borrow_trace_inline(stream_class); } +struct bt_private_trace *bt_private_stream_class_borrow_trace( + struct bt_private_stream_class *stream_class) +{ + return (void *) bt_stream_class_borrow_trace((void *) stream_class); +} + const char *bt_stream_class_get_name(struct bt_stream_class *stream_class) { BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); return stream_class->name.value; } -int bt_stream_class_set_name(struct bt_stream_class *stream_class, +int bt_private_stream_class_set_name( + struct bt_private_stream_class *priv_stream_class, const char *name) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_NON_NULL(name, "Name"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); @@ -245,17 +257,25 @@ struct bt_event_class *bt_stream_class_borrow_event_class_by_index( return g_ptr_array_index(stream_class->event_classes, index); } +struct bt_private_event_class * +bt_private_stream_class_borrow_private_event_class_by_index( + struct bt_private_stream_class *stream_class, uint64_t index) +{ + return (void *) bt_stream_class_borrow_event_class_by_index( + (void *) stream_class, index); +} + struct bt_event_class *bt_stream_class_borrow_event_class_by_id( - struct bt_stream_class *trace, uint64_t id) + struct bt_stream_class *stream_class, uint64_t id) { struct bt_event_class *event_class = NULL; uint64_t i; - BT_ASSERT_PRE_NON_NULL(trace, "Trace"); + BT_ASSERT_PRE_NON_NULL(stream_class, "Trace"); - for (i = 0; i < trace->event_classes->len; i++) { + for (i = 0; i < stream_class->event_classes->len; i++) { struct bt_event_class *event_class_candidate = - g_ptr_array_index(trace->event_classes, i); + g_ptr_array_index(stream_class->event_classes, i); if (event_class_candidate->id == id) { event_class = event_class_candidate; @@ -267,6 +287,14 @@ end: return event_class; } +struct bt_private_event_class * +bt_private_stream_class_borrow_private_event_class_by_id( + struct bt_private_stream_class *stream_class, uint64_t id) +{ + return (void *) bt_stream_class_borrow_event_class_by_id( + (void *) stream_class, id); +} + struct bt_field_class *bt_stream_class_borrow_packet_context_field_class( struct bt_stream_class *stream_class) { @@ -274,11 +302,21 @@ struct bt_field_class *bt_stream_class_borrow_packet_context_field_class( return stream_class->packet_context_fc; } -int bt_stream_class_set_packet_context_field_class( - struct bt_stream_class *stream_class, - struct bt_field_class *field_class) +struct bt_private_field_class * +bt_private_stream_class_borrow_packet_context_private_field_class( + struct bt_private_stream_class *stream_class) +{ + return (void *) bt_stream_class_borrow_packet_context_field_class( + (void *) stream_class); +} + +int bt_private_stream_class_set_packet_context_private_field_class( + struct bt_private_stream_class *priv_stream_class, + struct bt_private_field_class *priv_field_class) { int ret; + struct bt_stream_class *stream_class = (void *) priv_stream_class; + struct bt_field_class *field_class = (void *) priv_field_class; struct bt_resolve_field_path_context resolve_ctx = { .packet_header = NULL, .packet_context = field_class, @@ -320,11 +358,21 @@ struct bt_field_class *bt_stream_class_borrow_event_header_field_class( return stream_class->event_header_fc; } -int bt_stream_class_set_event_header_field_class( - struct bt_stream_class *stream_class, - struct bt_field_class *field_class) +struct bt_private_field_class * +bt_private_stream_class_borrow_event_header_private_field_class( + struct bt_private_stream_class *stream_class) +{ + return (void *) bt_stream_class_borrow_event_header_field_class( + (void *) stream_class); +} + +int bt_private_stream_class_set_event_header_private_field_class( + struct bt_private_stream_class *priv_stream_class, + struct bt_private_field_class *priv_field_class) { int ret; + struct bt_stream_class *stream_class = (void *) priv_stream_class; + struct bt_field_class *field_class = (void *) priv_field_class; struct bt_resolve_field_path_context resolve_ctx = { .packet_header = NULL, .packet_context = NULL, @@ -367,11 +415,21 @@ struct bt_field_class *bt_stream_class_borrow_event_common_context_field_class( return stream_class->event_common_context_fc; } -int bt_stream_class_set_event_common_context_field_class( - struct bt_stream_class *stream_class, - struct bt_field_class *field_class) +struct bt_private_field_class * +bt_private_stream_class_borrow_event_common_context_private_field_class( + struct bt_private_stream_class *stream_class) +{ + return (void *) bt_stream_class_borrow_event_common_context_field_class( + (void *) stream_class); +} + +int bt_private_stream_class_set_event_common_context_private_field_class( + struct bt_private_stream_class *priv_stream_class, + struct bt_private_field_class *priv_field_class) { int ret; + struct bt_stream_class *stream_class = (void *) priv_stream_class; + struct bt_field_class *field_class = (void *) priv_field_class; struct bt_resolve_field_path_context resolve_ctx = { .packet_header = NULL, .packet_context = NULL, @@ -417,10 +475,12 @@ void _bt_stream_class_freeze(struct bt_stream_class *stream_class) stream_class->frozen = true; } -int bt_stream_class_set_default_clock_class( - struct bt_stream_class *stream_class, +int bt_private_stream_class_set_default_clock_class( + struct bt_private_stream_class *priv_stream_class, struct bt_clock_class *clock_class) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); @@ -446,9 +506,12 @@ bt_bool bt_stream_class_assigns_automatic_event_class_id( return (bt_bool) stream_class->assigns_automatic_event_class_id; } -int bt_stream_class_set_assigns_automatic_event_class_id( - struct bt_stream_class *stream_class, bt_bool value) +int bt_private_stream_class_set_assigns_automatic_event_class_id( + struct bt_private_stream_class *priv_stream_class, + bt_bool value) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); stream_class->assigns_automatic_event_class_id = (bool) value; @@ -464,9 +527,12 @@ bt_bool bt_stream_class_assigns_automatic_stream_id( return (bt_bool) stream_class->assigns_automatic_stream_id; } -int bt_stream_class_set_assigns_automatic_stream_id( - struct bt_stream_class *stream_class, bt_bool value) +int bt_private_stream_class_set_assigns_automatic_stream_id( + struct bt_private_stream_class *priv_stream_class, + bt_bool value) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); stream_class->assigns_automatic_stream_id = (bool) value; @@ -482,9 +548,12 @@ bt_bool bt_stream_class_packets_have_discarded_event_counter_snapshot( return (bt_bool) stream_class->packets_have_discarded_event_counter_snapshot; } -int bt_stream_class_set_packets_have_discarded_event_counter_snapshot( - struct bt_stream_class *stream_class, bt_bool value) +int bt_private_stream_class_set_packets_have_discarded_event_counter_snapshot( + struct bt_private_stream_class *priv_stream_class, + bt_bool value) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); stream_class->packets_have_discarded_event_counter_snapshot = @@ -502,9 +571,12 @@ bt_bool bt_stream_class_packets_have_packet_counter_snapshot( return (bt_bool) stream_class->packets_have_packet_counter_snapshot; } -int bt_stream_class_set_packets_have_packet_counter_snapshot( - struct bt_stream_class *stream_class, bt_bool value) +int bt_private_stream_class_set_packets_have_packet_counter_snapshot( + struct bt_private_stream_class *priv_stream_class, + bt_bool value) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); stream_class->packets_have_packet_counter_snapshot = @@ -522,9 +594,12 @@ bt_bool bt_stream_class_packets_have_default_beginning_clock_value( return (bt_bool) stream_class->packets_have_default_beginning_cv; } -int bt_stream_class_set_packets_have_default_beginning_clock_value( - struct bt_stream_class *stream_class, bt_bool value) +int bt_private_stream_class_set_packets_have_default_beginning_clock_value( + struct bt_private_stream_class *priv_stream_class, + bt_bool value) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); BT_ASSERT_PRE(!value || stream_class->default_clock_class, @@ -544,9 +619,12 @@ bt_bool bt_stream_class_packets_have_default_end_clock_value( return (bt_bool) stream_class->packets_have_default_end_cv; } -int bt_stream_class_set_packets_have_default_end_clock_value( - struct bt_stream_class *stream_class, bt_bool value) +int bt_private_stream_class_set_packets_have_default_end_clock_value( + struct bt_private_stream_class *priv_stream_class, + bt_bool value) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class); BT_ASSERT_PRE(!value || stream_class->default_clock_class, @@ -565,3 +643,9 @@ bt_bool bt_stream_class_default_clock_is_always_known( /* BT_CLOCK_VALUE_STATUS_UNKNOWN is not supported as of 2.0 */ return BT_TRUE; } + +struct bt_stream_class *bt_stream_class_borrow_from_private( + struct bt_private_stream_class *priv_stream_class) +{ + return (void *) priv_stream_class; +} diff --git a/lib/trace-ir/stream.c b/lib/trace-ir/stream.c index 53f1ad74..546b5c44 100644 --- a/lib/trace-ir/stream.c +++ b/lib/trace-ir/stream.c @@ -1,8 +1,4 @@ /* - * stream.c - * - * Babeltrace trace IR - Stream - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,6 +26,7 @@ #include #include +#include #include #include #include @@ -146,8 +143,10 @@ end: return stream; } -struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class) +struct bt_private_stream *bt_private_stream_create( + struct bt_private_stream_class *priv_stream_class) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; uint64_t id; BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class"); @@ -157,16 +156,19 @@ struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class) id = bt_trace_get_automatic_stream_id( bt_stream_class_borrow_trace_inline(stream_class), stream_class); - return create_stream_with_id(stream_class, id); + return (void *) create_stream_with_id(stream_class, id); } -struct bt_stream *bt_stream_create_with_id(struct bt_stream_class *stream_class, +struct bt_private_stream *bt_private_stream_create_with_id( + struct bt_private_stream_class *priv_stream_class, uint64_t id) { + struct bt_stream_class *stream_class = (void *) priv_stream_class; + BT_ASSERT_PRE(!stream_class->assigns_automatic_stream_id, "Stream class automatically assigns stream IDs: " "%![sc-]+S", stream_class); - return create_stream_with_id(stream_class, id); + return (void *) create_stream_with_id(stream_class, id); } struct bt_stream_class *bt_stream_borrow_class(struct bt_stream *stream) @@ -175,20 +177,29 @@ struct bt_stream_class *bt_stream_borrow_class(struct bt_stream *stream) return stream->class; } +struct bt_private_stream_class *bt_private_stream_borrow_private_class( + struct bt_private_stream *priv_stream) +{ + return (void *) bt_stream_borrow_class((void *) priv_stream); +} + const char *bt_stream_get_name(struct bt_stream *stream) { BT_ASSERT_PRE_NON_NULL(stream, "Stream class"); return stream->name.value; } -int bt_stream_set_name(struct bt_stream *stream, const char *name) +int bt_private_stream_set_name(struct bt_private_stream *priv_stream, + const char *name) { + struct bt_stream *stream = (void *) priv_stream; + BT_ASSERT_PRE_NON_NULL(stream, "Clock class"); BT_ASSERT_PRE_NON_NULL(name, "Name"); BT_ASSERT_PRE_STREAM_HOT(stream); g_string_assign(stream->name.str, name); stream->name.value = stream->name.str->str; - BT_LIB_LOGV("Set stream class's name: %!+S", stream); + BT_LIB_LOGV("Set stream class's name: %!+s", stream); return 0; } @@ -206,3 +217,9 @@ void _bt_stream_freeze(struct bt_stream *stream) BT_LIB_LOGD("Freezing stream: %!+s", stream); stream->frozen = true; } + +struct bt_stream *bt_stream_borrow_from_private( + struct bt_private_stream *priv_stream) +{ + return (void *) priv_stream; +} diff --git a/lib/trace-ir/trace.c b/lib/trace-ir/trace.c index afc37d9c..5c0546fe 100644 --- a/lib/trace-ir/trace.c +++ b/lib/trace-ir/trace.c @@ -1,8 +1,4 @@ /* - * trace.c - * - * Babeltrace trace IR - Trace - * * Copyright 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -30,6 +26,7 @@ #include #include +#include #include #include #include @@ -59,8 +56,8 @@ #include struct bt_trace_is_static_listener_elem { - bt_trace_is_static_listener func; - bt_trace_listener_removed removed; + bt_private_trace_is_static_listener func; + bt_private_trace_listener_removed removed; void *data; }; @@ -87,7 +84,7 @@ void destroy_trace(struct bt_object *obj) struct bt_trace_is_static_listener_elem, i); if (elem.removed) { - elem.removed(trace, elem.data); + elem.removed((void *) trace, elem.data); } } @@ -131,7 +128,7 @@ void free_packet_header_field(struct bt_field_wrapper *field_wrapper, bt_field_wrapper_destroy(field_wrapper); } -struct bt_trace *bt_trace_create(void) +struct bt_private_trace *bt_private_trace_create(void) { struct bt_trace *trace = NULL; int ret; @@ -202,7 +199,7 @@ error: BT_OBJECT_PUT_REF_AND_RESET(trace); end: - return trace; + return (void *) trace; } const char *bt_trace_get_name(struct bt_trace *trace) @@ -211,8 +208,11 @@ const char *bt_trace_get_name(struct bt_trace *trace) return trace->name.value; } -int bt_trace_set_name(struct bt_trace *trace, const char *name) +int bt_private_trace_set_name(struct bt_private_trace *priv_trace, + const char *name) { + struct bt_trace *trace = (void *) priv_trace; + BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE_NON_NULL(name, "Name"); BT_ASSERT_PRE_TRACE_HOT(trace); @@ -228,8 +228,10 @@ bt_uuid bt_trace_get_uuid(struct bt_trace *trace) return trace->uuid.value; } -int bt_trace_set_uuid(struct bt_trace *trace, bt_uuid uuid) +int bt_private_trace_set_uuid(struct bt_private_trace *priv_trace, bt_uuid uuid) { + struct bt_trace *trace = (void *) priv_trace; + BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE_NON_NULL(uuid, "UUID"); BT_ASSERT_PRE_TRACE_HOT(trace); @@ -276,11 +278,13 @@ int set_environment_entry(struct bt_trace *trace, const char *name, return ret; } -int bt_trace_set_environment_entry_string(struct bt_trace *trace, +int bt_private_trace_set_private_environment_entry_string( + struct bt_private_trace *priv_trace, const char *name, const char *value) { int ret; struct bt_private_value *value_obj; + struct bt_trace *trace = (void *) priv_trace; BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE_NON_NULL(name, "Name"); @@ -300,11 +304,13 @@ end: return ret; } -int bt_trace_set_environment_entry_integer( - struct bt_trace *trace, const char *name, int64_t value) +int bt_private_trace_set_private_environment_entry_integer( + struct bt_private_trace *priv_trace, + const char *name, int64_t value) { int ret; struct bt_private_value *value_obj; + struct bt_trace *trace = (void *) priv_trace; BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE_NON_NULL(name, "Name"); @@ -349,6 +355,14 @@ void bt_trace_borrow_environment_entry_by_index( BT_ASSERT(*name); } +void bt_private_trace_borrow_private_environment_entry_by_index( + struct bt_private_trace *trace, uint64_t index, + const char **name, struct bt_private_value **value) +{ + bt_trace_borrow_environment_entry_by_index((void *) trace, + index, name, (void *) value); +} + struct bt_value *bt_trace_borrow_environment_entry_value_by_name( struct bt_trace *trace, const char *name) { @@ -359,6 +373,14 @@ struct bt_value *bt_trace_borrow_environment_entry_value_by_name( name)); } +struct bt_private_value * +bt_private_trace_borrow_private_environment_entry_value_by_name( + struct bt_private_trace *trace, const char *name) +{ + return (void *) bt_trace_borrow_environment_entry_value_by_name( + (void *) trace, name); +} + uint64_t bt_trace_get_stream_count(struct bt_trace *trace) { BT_ASSERT_PRE_NON_NULL(trace, "Trace"); @@ -373,6 +395,12 @@ struct bt_stream *bt_trace_borrow_stream_by_index( return g_ptr_array_index(trace->streams, index); } +struct bt_private_stream *bt_private_trace_borrow_private_stream_by_index( + struct bt_private_trace *trace, uint64_t index) +{ + return (void *) bt_trace_borrow_stream_by_index((void *) trace, index); +} + struct bt_stream *bt_trace_borrow_stream_by_id( struct bt_trace *trace, uint64_t id) { @@ -395,6 +423,12 @@ end: return stream; } +struct bt_private_stream *bt_private_trace_borrow_private_stream_by_id( + struct bt_private_trace *trace, uint64_t id) +{ + return (void *) bt_trace_borrow_stream_by_id((void *) trace, id); +} + uint64_t bt_trace_get_stream_class_count(struct bt_trace *trace) { BT_ASSERT_PRE_NON_NULL(trace, "Trace"); @@ -409,6 +443,14 @@ struct bt_stream_class *bt_trace_borrow_stream_class_by_index( return g_ptr_array_index(trace->stream_classes, index); } +struct bt_private_stream_class * +bt_private_trace_borrow_private_stream_class_by_index( + struct bt_private_trace *trace, uint64_t index) +{ + return (void *) bt_trace_borrow_stream_class_by_index( + (void *) trace, index); +} + struct bt_stream_class *bt_trace_borrow_stream_class_by_id( struct bt_trace *trace, uint64_t id) { @@ -431,6 +473,13 @@ end: return stream_class; } +struct bt_private_stream_class * +bt_private_trace_borrow_private_stream_class_by_id( + struct bt_private_trace *trace, uint64_t id) +{ + return (void *) bt_trace_borrow_stream_class_by_id((void *) trace, id); +} + struct bt_field_class *bt_trace_borrow_packet_header_field_class( struct bt_trace *trace) { @@ -438,10 +487,13 @@ struct bt_field_class *bt_trace_borrow_packet_header_field_class( return trace->packet_header_fc; } -int bt_trace_set_packet_header_field_class(struct bt_trace *trace, - struct bt_field_class *field_class) +int bt_private_trace_set_packet_header_private_field_class( + struct bt_private_trace *priv_trace, + struct bt_private_field_class *priv_field_class) { int ret; + struct bt_trace *trace = (void *) priv_trace; + struct bt_field_class *field_class = (void *) priv_field_class; struct bt_resolve_field_path_context resolve_ctx = { .packet_header = field_class, .packet_context = NULL, @@ -479,8 +531,9 @@ bt_bool bt_trace_is_static(struct bt_trace *trace) return (bt_bool) trace->is_static; } -int bt_trace_make_static(struct bt_trace *trace) +int bt_private_trace_make_static(struct bt_private_trace *priv_trace) { + struct bt_trace *trace = (void *) priv_trace; uint64_t i; BT_ASSERT_PRE_NON_NULL(trace, "Trace"); @@ -495,18 +548,20 @@ int bt_trace_make_static(struct bt_trace *trace) struct bt_trace_is_static_listener_elem, i); if (elem.func) { - elem.func(trace, elem.data); + elem.func((void *) trace, elem.data); } } return 0; } -int bt_trace_add_is_static_listener(struct bt_trace *trace, - bt_trace_is_static_listener listener, - bt_trace_listener_removed listener_removed, void *data, +int bt_private_trace_add_is_static_listener( + struct bt_private_trace *priv_trace, + bt_private_trace_is_static_listener listener, + bt_private_trace_listener_removed listener_removed, void *data, uint64_t *listener_id) { + struct bt_trace *trace = (void *) priv_trace; uint64_t i; struct bt_trace_is_static_listener_elem new_elem = { .func = listener, @@ -558,9 +613,10 @@ bool has_listener_id(struct bt_trace *trace, uint64_t listener_id) listener_id))->func != NULL; } -int bt_trace_remove_is_static_listener( - struct bt_trace *trace, uint64_t listener_id) +int bt_private_trace_remove_is_static_listener( + struct bt_private_trace *priv_trace, uint64_t listener_id) { + struct bt_trace *trace = (void *) priv_trace; struct bt_trace_is_static_listener_elem *elem; BT_ASSERT_PRE_NON_NULL(trace, "Trace"); @@ -583,7 +639,7 @@ int bt_trace_remove_is_static_listener( "%![trace-]+t, listener-id=%" PRIu64, trace, listener_id); trace->in_remove_listener = true; - elem->removed(trace, elem->data); + elem->removed((void *) trace, elem->data); trace->in_remove_listener = false; } @@ -611,9 +667,11 @@ bt_bool bt_trace_assigns_automatic_stream_class_id(struct bt_trace *trace) return (bt_bool) trace->assigns_automatic_stream_class_id; } -int bt_trace_set_assigns_automatic_stream_class_id( - struct bt_trace *trace, bt_bool value) +int bt_private_trace_set_assigns_automatic_stream_class_id( + struct bt_private_trace *priv_trace, bt_bool value) { + struct bt_trace *trace = (void *) priv_trace; + BT_ASSERT_PRE_NON_NULL(trace, "Trace"); BT_ASSERT_PRE_TRACE_HOT(trace); trace->assigns_automatic_stream_class_id = (bool) value; diff --git a/plugins/ctf/common/metadata/ast.h b/plugins/ctf/common/metadata/ast.h index 601f046d..b2212fff 100644 --- a/plugins/ctf/common/metadata/ast.h +++ b/plugins/ctf/common/metadata/ast.h @@ -324,7 +324,7 @@ struct ctf_visitor_generate_ir *ctf_visitor_generate_ir_create( void ctf_visitor_generate_ir_destroy(struct ctf_visitor_generate_ir *visitor); BT_HIDDEN -struct bt_trace *ctf_visitor_generate_ir_get_ir_trace( +struct bt_private_trace *ctf_visitor_generate_ir_get_ir_trace( struct ctf_visitor_generate_ir *visitor); BT_HIDDEN diff --git a/plugins/ctf/common/metadata/ctf-meta-translate.c b/plugins/ctf/common/metadata/ctf-meta-translate.c index 08b7499e..eee4998d 100644 --- a/plugins/ctf/common/metadata/ctf-meta-translate.c +++ b/plugins/ctf/common/metadata/ctf-meta-translate.c @@ -26,33 +26,35 @@ #include "ctf-meta-visitors.h" static inline -struct bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, +struct bt_private_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec); static inline void ctf_field_class_int_set_props(struct ctf_field_class_int *fc, - struct bt_field_class *ir_fc) + struct bt_private_field_class *ir_fc) { int ret; - ret = bt_field_class_integer_set_field_value_range(ir_fc, fc->base.size); + ret = bt_private_field_class_integer_set_field_value_range(ir_fc, + fc->base.size); BT_ASSERT(ret == 0); - ret = bt_field_class_integer_set_preferred_display_base(ir_fc, + ret = bt_private_field_class_integer_set_preferred_display_base(ir_fc, fc->disp_base); BT_ASSERT(ret == 0); } static inline -struct bt_field_class *ctf_field_class_int_to_ir(struct ctf_field_class_int *fc) +struct bt_private_field_class *ctf_field_class_int_to_ir( + struct ctf_field_class_int *fc) { - struct bt_field_class *ir_fc; + struct bt_private_field_class *ir_fc; if (fc->is_signed) { - ir_fc = bt_field_class_signed_integer_create(); + ir_fc = bt_private_field_class_signed_integer_create(); } else { - ir_fc = bt_field_class_unsigned_integer_create(); + ir_fc = bt_private_field_class_unsigned_integer_create(); } BT_ASSERT(ir_fc); @@ -61,16 +63,17 @@ struct bt_field_class *ctf_field_class_int_to_ir(struct ctf_field_class_int *fc) } static inline -struct bt_field_class *ctf_field_class_enum_to_ir(struct ctf_field_class_enum *fc) +struct bt_private_field_class *ctf_field_class_enum_to_ir( + struct ctf_field_class_enum *fc) { int ret; - struct bt_field_class *ir_fc; + struct bt_private_field_class *ir_fc; uint64_t i; if (fc->base.is_signed) { - ir_fc = bt_field_class_signed_enumeration_create(); + ir_fc = bt_private_field_class_signed_enumeration_create(); } else { - ir_fc = bt_field_class_unsigned_enumeration_create(); + ir_fc = bt_private_field_class_unsigned_enumeration_create(); } BT_ASSERT(ir_fc); @@ -81,11 +84,11 @@ struct bt_field_class *ctf_field_class_enum_to_ir(struct ctf_field_class_enum *f ctf_field_class_enum_borrow_mapping_by_index(fc, i); if (fc->base.is_signed) { - ret = bt_field_class_signed_enumeration_map_range( + ret = bt_private_field_class_signed_enumeration_map_range( ir_fc, mapping->label->str, mapping->range.lower.i, mapping->range.upper.i); } else { - ret = bt_field_class_unsigned_enumeration_map_range( + ret = bt_private_field_class_unsigned_enumeration_map_range( ir_fc, mapping->label->str, mapping->range.lower.u, mapping->range.upper.u); } @@ -97,17 +100,17 @@ struct bt_field_class *ctf_field_class_enum_to_ir(struct ctf_field_class_enum *f } static inline -struct bt_field_class *ctf_field_class_float_to_ir( +struct bt_private_field_class *ctf_field_class_float_to_ir( struct ctf_field_class_float *fc) { - struct bt_field_class *ir_fc; + struct bt_private_field_class *ir_fc; int ret; - ir_fc = bt_field_class_real_create(); + ir_fc = bt_private_field_class_real_create(); BT_ASSERT(ir_fc); if (fc->base.size == 32) { - ret = bt_field_class_real_set_is_single_precision(ir_fc, + ret = bt_private_field_class_real_set_is_single_precision(ir_fc, BT_TRUE); BT_ASSERT(ret == 0); } @@ -116,24 +119,26 @@ struct bt_field_class *ctf_field_class_float_to_ir( } static inline -struct bt_field_class *ctf_field_class_string_to_ir( +struct bt_private_field_class *ctf_field_class_string_to_ir( struct ctf_field_class_string *fc) { - struct bt_field_class *ir_fc = bt_field_class_string_create(); + struct bt_private_field_class *ir_fc = + bt_private_field_class_string_create(); BT_ASSERT(ir_fc); return ir_fc; } static inline -struct bt_field_class *ctf_field_class_struct_to_ir( +struct bt_private_field_class *ctf_field_class_struct_to_ir( struct ctf_field_class_struct *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { int ret; - struct bt_field_class *ir_fc = bt_field_class_structure_create(); + struct bt_private_field_class *ir_fc = + bt_private_field_class_structure_create(); uint64_t i; BT_ASSERT(ir_fc); @@ -141,7 +146,7 @@ struct bt_field_class *ctf_field_class_struct_to_ir( for (i = 0; i < fc->members->len; i++) { struct ctf_named_field_class *named_fc = ctf_field_class_struct_borrow_member_by_index(fc, i); - struct bt_field_class *member_ir_fc; + struct bt_private_field_class *member_ir_fc; if (!named_fc->fc->in_ir) { continue; @@ -149,8 +154,8 @@ struct bt_field_class *ctf_field_class_struct_to_ir( member_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec); BT_ASSERT(member_ir_fc); - ret = bt_field_class_structure_append_member(ir_fc, - named_fc->name->str, member_ir_fc); + ret = bt_private_field_class_structure_append_private_member( + ir_fc, named_fc->name->str, member_ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(member_ir_fc); } @@ -159,13 +164,13 @@ struct bt_field_class *ctf_field_class_struct_to_ir( } static inline -struct bt_field_class *borrow_ir_ft_from_field_path( +struct bt_private_field_class *borrow_ir_ft_from_field_path( struct ctf_field_path *field_path, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_field_class *ir_fc = NULL; + struct bt_private_field_class *ir_fc = NULL; struct ctf_field_class *fc = ctf_field_path_borrow_field_class( field_path, tc, sc, ec); @@ -179,31 +184,32 @@ struct bt_field_class *borrow_ir_ft_from_field_path( } static inline -struct bt_field_class *ctf_field_class_variant_to_ir( +struct bt_private_field_class *ctf_field_class_variant_to_ir( struct ctf_field_class_variant *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { int ret; - struct bt_field_class *ir_fc = bt_field_class_variant_create(); + struct bt_private_field_class *ir_fc = + bt_private_field_class_variant_create(); uint64_t i; BT_ASSERT(ir_fc); - ret = bt_field_class_variant_set_selector_field_class(ir_fc, - borrow_ir_ft_from_field_path(&fc->tag_path, tc, sc, ec)); + ret = bt_private_field_class_variant_set_selector_private_field_class( + ir_fc, borrow_ir_ft_from_field_path(&fc->tag_path, tc, sc, ec)); BT_ASSERT(ret == 0); for (i = 0; i < fc->options->len; i++) { struct ctf_named_field_class *named_fc = ctf_field_class_variant_borrow_option_by_index(fc, i); - struct bt_field_class *option_ir_fc; + struct bt_private_field_class *option_ir_fc; BT_ASSERT(named_fc->fc->in_ir); option_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec); BT_ASSERT(option_ir_fc); - ret = bt_field_class_variant_append_option(ir_fc, - named_fc->name->str, option_ir_fc); + ret = bt_private_field_class_variant_append_private_option( + ir_fc, named_fc->name->str, option_ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(option_ir_fc); } @@ -212,24 +218,25 @@ struct bt_field_class *ctf_field_class_variant_to_ir( } static inline -struct bt_field_class *ctf_field_class_array_to_ir( +struct bt_private_field_class *ctf_field_class_array_to_ir( struct ctf_field_class_array *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_field_class *ir_fc; - struct bt_field_class *elem_ir_fc; + struct bt_private_field_class *ir_fc; + struct bt_private_field_class *elem_ir_fc; if (fc->base.is_text) { - ir_fc = bt_field_class_string_create(); + ir_fc = bt_private_field_class_string_create(); BT_ASSERT(ir_fc); goto end; } elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec); BT_ASSERT(elem_ir_fc); - ir_fc = bt_field_class_static_array_create(elem_ir_fc, fc->length); + ir_fc = bt_private_field_class_static_array_create(elem_ir_fc, + fc->length); BT_ASSERT(ir_fc); bt_object_put_ref(elem_ir_fc); @@ -238,29 +245,30 @@ end: } static inline -struct bt_field_class *ctf_field_class_sequence_to_ir( +struct bt_private_field_class *ctf_field_class_sequence_to_ir( struct ctf_field_class_sequence *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { int ret; - struct bt_field_class *ir_fc; - struct bt_field_class *elem_ir_fc; + struct bt_private_field_class *ir_fc; + struct bt_private_field_class *elem_ir_fc; if (fc->base.is_text) { - ir_fc = bt_field_class_string_create(); + ir_fc = bt_private_field_class_string_create(); BT_ASSERT(ir_fc); goto end; } elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec); BT_ASSERT(elem_ir_fc); - ir_fc = bt_field_class_dynamic_array_create(elem_ir_fc); + ir_fc = bt_private_field_class_dynamic_array_create(elem_ir_fc); BT_ASSERT(ir_fc); bt_object_put_ref(elem_ir_fc); BT_ASSERT(ir_fc); - ret = bt_field_class_dynamic_array_set_length_field_class(ir_fc, + ret = bt_private_field_class_dynamic_array_set_length_private_field_class( + ir_fc, borrow_ir_ft_from_field_path(&fc->length_path, tc, sc, ec)); BT_ASSERT(ret == 0); @@ -269,12 +277,12 @@ end: } static inline -struct bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, +struct bt_private_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_field_class *ir_fc = NULL; + struct bt_private_field_class *ir_fc = NULL; BT_ASSERT(fc); BT_ASSERT(fc->in_ir); @@ -334,12 +342,12 @@ end: } static inline -struct bt_field_class *scope_ctf_field_class_to_ir(struct ctf_field_class *fc, +struct bt_private_field_class *scope_ctf_field_class_to_ir(struct ctf_field_class *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_field_class *ir_fc = NULL; + struct bt_private_field_class *ir_fc = NULL; if (!fc) { goto end; @@ -389,30 +397,30 @@ end: } static inline -struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, - struct bt_stream_class *ir_sc, struct ctf_trace_class *tc, +struct bt_private_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, + struct bt_private_stream_class *ir_sc, struct ctf_trace_class *tc, struct ctf_stream_class *sc) { int ret; - struct bt_event_class *ir_ec = NULL; + struct bt_private_event_class *ir_ec = NULL; if (ec->is_translated) { - ir_ec = bt_stream_class_borrow_event_class_by_id( + ir_ec = bt_private_stream_class_borrow_private_event_class_by_id( ir_sc, ec->id); BT_ASSERT(ir_ec); goto end; } - ir_ec = bt_event_class_create_with_id(ir_sc, ec->id); + ir_ec = bt_private_event_class_create_with_id(ir_sc, ec->id); BT_ASSERT(ir_ec); bt_object_put_ref(ir_ec); if (ec->spec_context_fc) { - struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( ec->spec_context_fc, tc, sc, ec); if (ir_fc) { - ret = bt_event_class_set_specific_context_field_class( + ret = bt_private_event_class_set_specific_context_private_field_class( ir_ec, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -420,11 +428,11 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, } if (ec->payload_fc) { - struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( ec->payload_fc, tc, sc, ec); if (ir_fc) { - ret = bt_event_class_set_payload_field_class(ir_ec, + ret = bt_private_event_class_set_payload_private_field_class(ir_ec, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -432,17 +440,17 @@ struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, } if (ec->name->len > 0) { - ret = bt_event_class_set_name(ir_ec, ec->name->str); + ret = bt_private_event_class_set_name(ir_ec, ec->name->str); BT_ASSERT(ret == 0); } if (ec->emf_uri->len > 0) { - ret = bt_event_class_set_emf_uri(ir_ec, ec->emf_uri->str); + ret = bt_private_event_class_set_emf_uri(ir_ec, ec->emf_uri->str); BT_ASSERT(ret == 0); } if (ec->log_level != -1) { - ret = bt_event_class_set_log_level(ir_ec, ec->log_level); + ret = bt_private_event_class_set_log_level(ir_ec, ec->log_level); BT_ASSERT(ret == 0); } @@ -455,29 +463,30 @@ end: static inline -struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, - struct bt_trace *ir_trace, struct ctf_trace_class *tc) +struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, + struct bt_private_trace *ir_trace, struct ctf_trace_class *tc) { int ret; - struct bt_stream_class *ir_sc = NULL; + struct bt_private_stream_class *ir_sc = NULL; struct ctf_field_class_int *int_fc; if (sc->is_translated) { - ir_sc = bt_trace_borrow_stream_class_by_id(ir_trace, sc->id); + ir_sc = bt_private_trace_borrow_private_stream_class_by_id( + ir_trace, sc->id); BT_ASSERT(ir_sc); goto end; } - ir_sc = bt_stream_class_create_with_id(ir_trace, sc->id); + ir_sc = bt_private_stream_class_create_with_id(ir_trace, sc->id); BT_ASSERT(ir_sc); bt_object_put_ref(ir_sc); if (sc->packet_context_fc) { - struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( sc->packet_context_fc, tc, sc, NULL); if (ir_fc) { - ret = bt_stream_class_set_packet_context_field_class( + ret = bt_private_stream_class_set_packet_context_private_field_class( ir_sc, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -485,38 +494,38 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, } if (sc->event_header_fc) { - struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( sc->event_header_fc, tc, sc, NULL); if (ir_fc) { - ret = bt_stream_class_set_event_header_field_class(ir_sc, - ir_fc); + ret = bt_private_stream_class_set_event_header_private_field_class( + ir_sc, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); } } if (sc->event_common_context_fc) { - struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( sc->event_common_context_fc, tc, sc, NULL); if (ir_fc) { - ret = bt_stream_class_set_event_common_context_field_class( + ret = bt_private_stream_class_set_event_common_context_private_field_class( ir_sc, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); } } - ret = bt_stream_class_set_assigns_automatic_event_class_id(ir_sc, + ret = bt_private_stream_class_set_assigns_automatic_event_class_id(ir_sc, BT_FALSE); BT_ASSERT(ret == 0); - ret = bt_stream_class_set_assigns_automatic_stream_id(ir_sc, BT_FALSE); + ret = bt_private_stream_class_set_assigns_automatic_stream_id(ir_sc, BT_FALSE); BT_ASSERT(ret == 0); if (sc->default_clock_class) { - ret = bt_stream_class_set_default_clock_class(ir_sc, - sc->default_clock_class); + ret = bt_private_stream_class_set_default_clock_class(ir_sc, + bt_clock_class_borrow_from_private(sc->default_clock_class)); BT_ASSERT(ret == 0); } @@ -524,7 +533,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, "events_discarded"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_DISC_EV_REC_COUNTER_SNAPSHOT) { - ret = bt_stream_class_set_packets_have_discarded_event_counter_snapshot( + ret = bt_private_stream_class_set_packets_have_discarded_event_counter_snapshot( ir_sc, BT_TRUE); BT_ASSERT(ret == 0); } @@ -534,7 +543,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, "packet_seq_num"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_COUNTER_SNAPSHOT) { - ret = bt_stream_class_set_packets_have_packet_counter_snapshot( + ret = bt_private_stream_class_set_packets_have_packet_counter_snapshot( ir_sc, BT_TRUE); BT_ASSERT(ret == 0); } @@ -544,7 +553,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, "timestamp_begin"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_BEGINNING_TIME) { - ret = bt_stream_class_set_packets_have_default_beginning_clock_value( + ret = bt_private_stream_class_set_packets_have_default_beginning_clock_value( ir_sc, BT_TRUE); BT_ASSERT(ret == 0); } @@ -554,7 +563,7 @@ struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, "timestamp_end"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_END_TIME) { - ret = bt_stream_class_set_packets_have_default_end_clock_value( + ret = bt_private_stream_class_set_packets_have_default_end_clock_value( ir_sc, BT_TRUE); BT_ASSERT(ret == 0); } @@ -568,7 +577,7 @@ end: } static inline -int ctf_trace_class_to_ir(struct bt_trace *ir_trace, +int ctf_trace_class_to_ir(struct bt_private_trace *ir_trace, struct ctf_trace_class *tc) { int ret = 0; @@ -579,26 +588,26 @@ int ctf_trace_class_to_ir(struct bt_trace *ir_trace, } if (tc->packet_header_fc) { - struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( tc->packet_header_fc, tc, NULL, NULL); if (ir_fc) { - ret = bt_trace_set_packet_header_field_class(ir_trace, - ir_fc); + ret = bt_private_trace_set_packet_header_private_field_class( + ir_trace, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); } } if (tc->name->len > 0) { - ret = bt_trace_set_name(ir_trace, tc->name->str); + ret = bt_private_trace_set_name(ir_trace, tc->name->str); if (ret) { goto end; } } if (tc->is_uuid_set) { - ret = bt_trace_set_uuid(ir_trace, tc->uuid); + ret = bt_private_trace_set_uuid(ir_trace, tc->uuid); if (ret) { goto end; } @@ -610,12 +619,12 @@ int ctf_trace_class_to_ir(struct bt_trace *ir_trace, switch (env_entry->type) { case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT: - ret = bt_trace_set_environment_entry_integer( + ret = bt_private_trace_set_private_environment_entry_integer( ir_trace, env_entry->name->str, env_entry->value.i); break; case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_STR: - ret = bt_trace_set_environment_entry_string( + ret = bt_private_trace_set_private_environment_entry_string( ir_trace, env_entry->name->str, env_entry->value.str->str); break; @@ -628,7 +637,7 @@ int ctf_trace_class_to_ir(struct bt_trace *ir_trace, } } - ret = bt_trace_set_assigns_automatic_stream_class_id(ir_trace, + ret = bt_private_trace_set_assigns_automatic_stream_class_id(ir_trace, BT_FALSE); if (ret) { goto end; @@ -642,7 +651,7 @@ end: } BT_HIDDEN -int ctf_trace_class_translate(struct bt_trace *ir_trace, +int ctf_trace_class_translate(struct bt_private_trace *ir_trace, struct ctf_trace_class *tc) { int ret = 0; @@ -656,7 +665,7 @@ int ctf_trace_class_translate(struct bt_trace *ir_trace, for (i = 0; i < tc->stream_classes->len; i++) { uint64_t j; struct ctf_stream_class *sc = tc->stream_classes->pdata[i]; - struct bt_stream_class *ir_sc; + struct bt_private_stream_class *ir_sc; ir_sc = ctf_stream_class_to_ir(sc, ir_trace, tc); if (!ir_sc) { @@ -666,7 +675,7 @@ int ctf_trace_class_translate(struct bt_trace *ir_trace, for (j = 0; j < sc->event_classes->len; j++) { struct ctf_event_class *ec = sc->event_classes->pdata[j]; - struct bt_event_class *ir_ec; + struct bt_private_event_class *ir_ec; ir_ec = ctf_event_class_to_ir(ec, ir_sc, tc, sc); if (!ir_ec) { diff --git a/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c b/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c index 2bd10f1d..e6ac8e59 100644 --- a/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c +++ b/plugins/ctf/common/metadata/ctf-meta-update-default-clock-classes.c @@ -27,7 +27,7 @@ static inline int find_mapped_clock_class(struct ctf_field_class *fc, - struct bt_clock_class **clock_class) + struct bt_private_clock_class **clock_class) { int ret = 0; uint64_t i; @@ -48,8 +48,12 @@ int find_mapped_clock_class(struct ctf_field_class *fc, BT_LOGE("Stream class contains more than one " "clock class: expected-cc-name=\"%s\", " "other-cc-name=\"%s\"", - bt_clock_class_get_name(*clock_class), - bt_clock_class_get_name(int_fc->mapped_clock_class)); + bt_clock_class_get_name( + bt_clock_class_borrow_from_private( + *clock_class)), + bt_clock_class_get_name( + bt_clock_class_borrow_from_private( + int_fc->mapped_clock_class))); ret = -1; goto end; } @@ -120,7 +124,8 @@ int update_stream_class_default_clock_class( struct ctf_stream_class *stream_class) { int ret = 0; - struct bt_clock_class *clock_class = stream_class->default_clock_class; + struct bt_private_clock_class *clock_class = + stream_class->default_clock_class; uint64_t i; ret = find_mapped_clock_class(stream_class->packet_context_fc, @@ -171,7 +176,7 @@ int ctf_trace_class_update_default_clock_classes(struct ctf_trace_class *ctf_tc) { uint64_t i; int ret = 0; - struct bt_clock_class *clock_class = NULL; + struct bt_private_clock_class *clock_class = NULL; ret = find_mapped_clock_class(ctf_tc->packet_header_fc, &clock_class); diff --git a/plugins/ctf/common/metadata/ctf-meta-visitors.h b/plugins/ctf/common/metadata/ctf-meta-visitors.h index caeddf32..f4c93b74 100644 --- a/plugins/ctf/common/metadata/ctf-meta-visitors.h +++ b/plugins/ctf/common/metadata/ctf-meta-visitors.h @@ -24,7 +24,7 @@ BT_HIDDEN int ctf_trace_class_resolve_field_classes(struct ctf_trace_class *tc); BT_HIDDEN -int ctf_trace_class_translate(struct bt_trace *ir_trace, +int ctf_trace_class_translate(struct bt_private_trace *ir_trace, struct ctf_trace_class *tc); BT_HIDDEN diff --git a/plugins/ctf/common/metadata/ctf-meta.h b/plugins/ctf/common/metadata/ctf-meta.h index 557ba7e9..9ceef820 100644 --- a/plugins/ctf/common/metadata/ctf-meta.h +++ b/plugins/ctf/common/metadata/ctf-meta.h @@ -66,7 +66,7 @@ struct ctf_field_class { bool in_ir; /* Weak, set during translation. NULL if `in_ir` is false below. */ - struct bt_field_class *ir_fc; + struct bt_private_field_class *ir_fc; }; struct ctf_field_class_bit_array { @@ -84,7 +84,7 @@ struct ctf_field_class_int { int64_t storing_index; /* Owned by this */ - struct bt_clock_class *mapped_clock_class; + struct bt_private_clock_class *mapped_clock_class; }; struct ctf_range { @@ -198,7 +198,7 @@ struct ctf_event_class { struct ctf_field_class *payload_fc; /* Weak, set during translation */ - struct bt_event_class *ir_ec; + struct bt_private_event_class *ir_ec; }; struct ctf_stream_class { @@ -224,10 +224,10 @@ struct ctf_stream_class { GHashTable *event_classes_by_id; /* Owned by this */ - struct bt_clock_class *default_clock_class; + struct bt_private_clock_class *default_clock_class; /* Weak, set during translation */ - struct bt_stream_class *ir_sc; + struct bt_private_stream_class *ir_sc; }; enum ctf_trace_class_env_entry_type { @@ -258,7 +258,7 @@ struct ctf_trace_class { uint64_t stored_value_count; - /* Array of `struct bt_clock_class *` (owned by this) */ + /* Array of `struct bt_private_clock_class *` (owned by this) */ GPtrArray *clock_classes; /* Array of `struct ctf_stream_class *` */ @@ -270,7 +270,7 @@ struct ctf_trace_class { bool is_translated; /* Weak, set during translation */ - struct bt_trace *ir_tc; + struct bt_private_trace *ir_tc; }; static inline @@ -1548,18 +1548,19 @@ end: } static inline -struct bt_clock_class *ctf_trace_class_borrow_clock_class_by_name( +struct bt_private_clock_class *ctf_trace_class_borrow_clock_class_by_name( struct ctf_trace_class *tc, const char *name) { uint64_t i; - struct bt_clock_class *ret_cc = NULL; + struct bt_private_clock_class *ret_cc = NULL; BT_ASSERT(tc); BT_ASSERT(name); for (i = 0; i < tc->clock_classes->len; i++) { - struct bt_clock_class *cc = tc->clock_classes->pdata[i]; - const char *cc_name = bt_clock_class_get_name(cc); + struct bt_private_clock_class *cc = tc->clock_classes->pdata[i]; + const char *cc_name = bt_clock_class_get_name( + bt_clock_class_borrow_from_private(cc)); BT_ASSERT(cc_name); if (strcmp(cc_name, name) == 0) { diff --git a/plugins/ctf/common/metadata/decoder.c b/plugins/ctf/common/metadata/decoder.c index 38733ae3..85a9fbe1 100644 --- a/plugins/ctf/common/metadata/decoder.c +++ b/plugins/ctf/common/metadata/decoder.c @@ -556,7 +556,7 @@ end: } BT_HIDDEN -struct bt_trace *ctf_metadata_decoder_get_ir_trace( +struct bt_private_trace *ctf_metadata_decoder_get_ir_trace( struct ctf_metadata_decoder *mdec) { return ctf_visitor_generate_ir_get_ir_trace(mdec->visitor); diff --git a/plugins/ctf/common/metadata/decoder.h b/plugins/ctf/common/metadata/decoder.h index 51d3a185..171cbb35 100644 --- a/plugins/ctf/common/metadata/decoder.h +++ b/plugins/ctf/common/metadata/decoder.h @@ -89,7 +89,7 @@ enum ctf_metadata_decoder_status ctf_metadata_decoder_decode( struct ctf_metadata_decoder *metadata_decoder, FILE *fp); BT_HIDDEN -struct bt_trace *ctf_metadata_decoder_get_ir_trace( +struct bt_private_trace *ctf_metadata_decoder_get_ir_trace( struct ctf_metadata_decoder *mdec); BT_HIDDEN diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index 8f817cc6..2a33575a 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -194,7 +194,7 @@ struct ctx_decl_scope { */ struct ctx { /* Trace IR trace being filled (owned by this) */ - struct bt_trace *trace; + struct bt_private_trace *trace; /* CTF meta trace being filled (owned by this) */ struct ctf_trace_class *ctf_tc; @@ -590,7 +590,7 @@ struct ctx *ctx_create(const struct ctf_metadata_decoder_config *decoder_config, goto error; } - ctx->trace = bt_trace_create(); + ctx->trace = bt_private_trace_create(); if (!ctx->trace) { BT_LOGE_STR("Cannot create empty trace."); goto error; @@ -2365,7 +2365,7 @@ int visit_integer_decl(struct ctx *ctx, int signedness = 0; struct ctf_node *expression; uint64_t alignment = 0, size = 0; - struct bt_clock_class *mapped_clock_class = NULL; + struct bt_private_clock_class *mapped_clock_class = NULL; enum ctf_encoding encoding = CTF_ENCODING_NONE; enum bt_field_class_integer_preferred_display_base base = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL; @@ -3576,7 +3576,7 @@ static int auto_map_field_to_trace_clock_class(struct ctx *ctx, struct ctf_field_class *fc) { - struct bt_clock_class *clock_class_to_map_to = NULL; + struct bt_private_clock_class *clock_class_to_map_to = NULL; struct ctf_field_class_int *int_fc = (void *) fc; int ret = 0; uint64_t clock_class_count; @@ -3604,12 +3604,12 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx, * implicit one at 1 GHz, named `default`, and use this clock * class. */ - clock_class_to_map_to = bt_clock_class_create(); + clock_class_to_map_to = bt_private_clock_class_create(); BT_ASSERT(clock_class_to_map_to); - ret = bt_clock_class_set_frequency(clock_class_to_map_to, + ret = bt_private_clock_class_set_frequency(clock_class_to_map_to, UINT64_C(1000000000)); BT_ASSERT(ret == 0); - ret = bt_clock_class_set_name(clock_class_to_map_to, + ret = bt_private_clock_class_set_name(clock_class_to_map_to, "default"); BT_ASSERT(ret == 0); g_ptr_array_add(ctx->ctf_tc->clock_classes, @@ -4368,7 +4368,7 @@ error: static int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, - struct bt_clock_class *clock, int *set, int64_t *offset_seconds, + struct bt_private_clock_class *clock, int *set, int64_t *offset_seconds, uint64_t *offset_cycles) { int ret = 0; @@ -4407,7 +4407,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_clock_class_set_name(clock, right); + ret = bt_private_clock_class_set_name(clock, right); if (ret) { _BT_LOGE_NODE(entry_node, "cannot set clock class's name"); @@ -4433,7 +4433,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_clock_class_set_uuid(clock, uuid); + ret = bt_private_clock_class_set_uuid(clock, uuid); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's UUID."); @@ -4460,7 +4460,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_clock_class_set_description(clock, right); + ret = bt_private_clock_class_set_description(clock, right); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's description."); @@ -4496,7 +4496,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_clock_class_set_frequency(clock, freq); + ret = bt_private_clock_class_set_frequency(clock, freq); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's frequency."); @@ -4523,7 +4523,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_clock_class_set_precision(clock, precision); + ret = bt_private_clock_class_set_precision(clock, precision); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's precision."); @@ -4587,7 +4587,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_clock_class_set_is_absolute(clock, ret); + ret = bt_private_clock_class_set_is_absolute(clock, ret); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's absolute flag."); @@ -4638,7 +4638,8 @@ void calibrate_clock_class_offsets(int64_t *offset_seconds, } static -void apply_clock_class_offset(struct ctx *ctx, struct bt_clock_class *clock) +void apply_clock_class_offset(struct ctx *ctx, + struct bt_private_clock_class *clock) { int ret; uint64_t freq; @@ -4674,8 +4675,10 @@ void apply_clock_class_offset(struct ctx *ctx, struct bt_clock_class *clock) offset_s_to_apply += extra_s; } - freq = bt_clock_class_get_frequency(clock); - bt_clock_class_get_offset(clock, &cur_offset_s, &cur_offset_cycles); + freq = bt_clock_class_get_frequency( + bt_clock_class_borrow_from_private(clock)); + bt_clock_class_get_offset(bt_clock_class_borrow_from_private(clock), + &cur_offset_s, &cur_offset_cycles); /* Apply offsets */ cur_offset_s += offset_s_to_apply; @@ -4688,7 +4691,7 @@ void apply_clock_class_offset(struct ctx *ctx, struct bt_clock_class *clock) calibrate_clock_class_offsets(&cur_offset_s, &cur_offset_cycles, freq); /* Set final offsets */ - ret = bt_clock_class_set_offset(clock, cur_offset_s, cur_offset_cycles); + ret = bt_private_clock_class_set_offset(clock, cur_offset_s, cur_offset_cycles); BT_ASSERT(ret == 0); end: @@ -4700,7 +4703,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) { int ret = 0; int set = 0; - struct bt_clock_class *clock; + struct bt_private_clock_class *clock; struct ctf_node *entry_node; struct bt_list_head *decl_list = &clock_node->u.clock.declaration_list; const char *clock_class_name; @@ -4715,7 +4718,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) clock_node->visited = TRUE; /* CTF 1.8's default frequency for a clock class is 1 GHz */ - clock = bt_clock_class_create(); + clock = bt_private_clock_class_create(); if (!clock) { _BT_LOGE_NODE(clock_node, "Cannot create default clock class."); @@ -4724,7 +4727,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) } /* CTF: not absolute by default */ - ret = bt_clock_class_set_is_absolute(clock, BT_FALSE); + ret = bt_private_clock_class_set_is_absolute(clock, BT_FALSE); if (ret) { _BT_LOGE_NODE(clock_node, "Cannot set clock class's absolute flag."); @@ -4749,7 +4752,8 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) goto end; } - clock_class_name = bt_clock_class_get_name(clock); + clock_class_name = bt_clock_class_get_name( + bt_clock_class_borrow_from_private(clock)); BT_ASSERT(clock_class_name); if (ctx->is_lttng && strcmp(clock_class_name, "monotonic") == 0) { /* @@ -4758,7 +4762,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) * it's a condition to be able to sort notifications * from different sources. */ - ret = bt_clock_class_set_is_absolute(clock, BT_TRUE); + ret = bt_private_clock_class_set_is_absolute(clock, BT_TRUE); if (ret) { _BT_LOGE_NODE(clock_node, "Cannot set clock class's absolute flag."); @@ -4770,10 +4774,12 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) * Adjust offsets so that the part in cycles is less than the * frequency (move to the part in seconds). */ - freq = bt_clock_class_get_frequency(clock); + freq = bt_clock_class_get_frequency( + bt_clock_class_borrow_from_private(clock)); calibrate_clock_class_offsets(&offset_seconds, &offset_cycles, freq); - BT_ASSERT(offset_cycles < bt_clock_class_get_frequency(clock)); - ret = bt_clock_class_set_offset(clock, offset_seconds, offset_cycles); + BT_ASSERT(offset_cycles < bt_clock_class_get_frequency( + bt_clock_class_borrow_from_private(clock))); + ret = bt_private_clock_class_set_offset(clock, offset_seconds, offset_cycles); BT_ASSERT(ret == 0); apply_clock_class_offset(ctx, clock); g_ptr_array_add(ctx->ctf_tc->clock_classes, bt_object_get_ref(clock)); @@ -4927,7 +4933,7 @@ void ctf_visitor_generate_ir_destroy(struct ctf_visitor_generate_ir *visitor) } BT_HIDDEN -struct bt_trace *ctf_visitor_generate_ir_get_ir_trace( +struct bt_private_trace *ctf_visitor_generate_ir_get_ir_trace( struct ctf_visitor_generate_ir *visitor) { struct ctx *ctx = (void *) visitor; diff --git a/plugins/ctf/common/notif-iter/notif-iter.c b/plugins/ctf/common/notif-iter/notif-iter.c index 8fa8877b..cc1707ea 100644 --- a/plugins/ctf/common/notif-iter/notif-iter.c +++ b/plugins/ctf/common/notif-iter/notif-iter.c @@ -56,7 +56,7 @@ struct stack_entry { * * Field is borrowed. */ - struct bt_field *base; + struct bt_private_field *base; /* Index of next field to set */ size_t index; @@ -111,7 +111,7 @@ struct bt_notif_iter { * This is set by read_dscope_begin_state() and contains the * value of one of the pointers in `dscopes` below. */ - struct bt_field *cur_dscope_field; + struct bt_private_field *cur_dscope_field; /* * True if we're done filling a string field from a text @@ -127,34 +127,34 @@ struct bt_notif_iter { } meta; /* Current packet header field wrapper (NULL if not created yet) */ - struct bt_packet_header_field *packet_header_field; + struct bt_private_packet_header_field *packet_header_field; /* Current packet header field wrapper (NULL if not created yet) */ - struct bt_packet_context_field *packet_context_field; + struct bt_private_packet_context_field *packet_context_field; /* Current event header field (NULL if not created yet) */ - struct bt_event_header_field *event_header_field; + struct bt_private_event_header_field *event_header_field; /* Current packet (NULL if not created yet) */ - struct bt_packet *packet; + struct bt_private_packet *packet; /* Current stream (NULL if not set yet) */ - struct bt_stream *stream; + struct bt_private_stream *stream; /* Current event (NULL if not created yet) */ - struct bt_event *event; + struct bt_private_event *event; /* Current event notification (NULL if not created yet) */ - struct bt_notification *event_notif; + struct bt_private_notification *event_notif; /* Database of current dynamic scopes */ struct { - struct bt_field *trace_packet_header; - struct bt_field *stream_packet_context; - struct bt_field *event_header; - struct bt_field *event_common_context; - struct bt_field *event_spec_context; - struct bt_field *event_payload; + struct bt_private_field *trace_packet_header; + struct bt_private_field *stream_packet_context; + struct bt_private_field *event_header; + struct bt_private_field *event_common_context; + struct bt_private_field *event_spec_context; + struct bt_private_field *event_payload; } dscopes; /* Current state */ @@ -325,7 +325,7 @@ void stack_destroy(struct stack *stack) } static -void stack_push(struct stack *stack, struct bt_field *base) +void stack_push(struct stack *stack, struct bt_private_field *base) { struct stack_entry *entry; @@ -520,7 +520,7 @@ enum bt_notif_iter_status read_dscope_begin_state( struct bt_notif_iter *notit, struct ctf_field_class *dscope_fc, enum state done_state, enum state continue_state, - struct bt_field *dscope_field) + struct bt_private_field *dscope_field) { enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; enum bt_bfcr_status bfcr_status; @@ -619,7 +619,7 @@ void release_event_dscopes(struct bt_notif_iter *notit) notit->dscopes.event_header = NULL; if (notit->event_header_field) { - bt_event_header_field_release(notit->event_header_field); + bt_private_event_header_field_release(notit->event_header_field); notit->event_header_field = NULL; } @@ -634,14 +634,14 @@ void release_all_dscopes(struct bt_notif_iter *notit) notit->dscopes.trace_packet_header = NULL; if (notit->packet_header_field) { - bt_packet_header_field_release(notit->packet_header_field); + bt_private_packet_header_field_release(notit->packet_header_field); notit->packet_header_field = NULL; } notit->dscopes.stream_packet_context = NULL; if (notit->packet_context_field) { - bt_packet_context_field_release(notit->packet_context_field); + bt_private_packet_context_field_release(notit->packet_context_field); notit->packet_context_field = NULL; } @@ -681,8 +681,9 @@ enum bt_notif_iter_status read_packet_header_begin_state( * 3. We need the packet header field's content to know * the ID of the stream class to select. */ - notit->packet_header_field = bt_packet_header_field_create( - notit->meta.tc->ir_tc); + notit->packet_header_field = + bt_private_packet_header_field_create( + notit->meta.tc->ir_tc); if (!notit->packet_header_field) { BT_LOGE_STR("Cannot create packet header field wrapper from trace."); ret = BT_NOTIF_ITER_STATUS_ERROR; @@ -690,7 +691,8 @@ enum bt_notif_iter_status read_packet_header_begin_state( } notit->dscopes.trace_packet_header = - bt_packet_header_field_borrow_field(notit->packet_header_field); + bt_private_packet_header_field_borrow_private_field( + notit->packet_header_field); BT_ASSERT(notit->dscopes.trace_packet_header); } @@ -797,7 +799,7 @@ static inline enum bt_notif_iter_status set_current_stream(struct bt_notif_iter *notit) { enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; - struct bt_stream *stream = NULL; + struct bt_private_stream *stream = NULL; BT_LOGV("Calling user function (get stream): notit-addr=%p, " "stream-class-addr=%p, stream-class-id=%" PRId64, @@ -832,7 +834,7 @@ static inline enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit) { enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; - struct bt_packet *packet = NULL; + struct bt_private_packet *packet = NULL; BT_LOGV("Creating packet for packet notification: " "notit-addr=%p", notit); @@ -845,7 +847,7 @@ enum bt_notif_iter_status set_current_packet(struct bt_notif_iter *notit) /* Create packet */ BT_ASSERT(notit->stream); - packet = bt_packet_create(notit->stream); + packet = bt_private_packet_create(notit->stream); if (!packet) { BT_LOGE("Cannot create packet from stream: " "notit-addr=%p, stream-addr=%p, " @@ -916,7 +918,8 @@ enum bt_notif_iter_status read_packet_context_begin_state( * (bt_notif_iter_borrow_packet_header_context_fields()). */ notit->packet_context_field = - bt_packet_context_field_create(notit->meta.sc->ir_sc); + bt_private_packet_context_field_create( + notit->meta.sc->ir_sc); if (!notit->packet_context_field) { BT_LOGE_STR("Cannot create packet context field wrapper from stream class."); status = BT_NOTIF_ITER_STATUS_ERROR; @@ -924,7 +927,8 @@ enum bt_notif_iter_status read_packet_context_begin_state( } notit->dscopes.stream_packet_context = - bt_packet_context_field_borrow_field(notit->packet_context_field); + bt_private_packet_context_field_borrow_private_field( + notit->packet_context_field); BT_ASSERT(notit->dscopes.stream_packet_context); } @@ -1091,8 +1095,9 @@ enum bt_notif_iter_status read_event_header_begin_state( if (event_header_fc->in_ir) { BT_ASSERT(!notit->event_header_field); - notit->event_header_field = bt_event_header_field_create( - notit->meta.sc->ir_sc); + notit->event_header_field = + bt_private_event_header_field_create( + notit->meta.sc->ir_sc); if (!notit->event_header_field) { BT_LOGE_STR("Cannot create event header field wrapper from trace."); status = BT_NOTIF_ITER_STATUS_ERROR; @@ -1100,7 +1105,8 @@ enum bt_notif_iter_status read_event_header_begin_state( } notit->dscopes.event_header = - bt_event_header_field_borrow_field(notit->event_header_field); + bt_private_event_header_field_borrow_private_field( + notit->event_header_field); BT_ASSERT(notit->dscopes.event_header); } @@ -1192,7 +1198,7 @@ enum bt_notif_iter_status set_current_event_notification( struct bt_notif_iter *notit) { enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; - struct bt_notification *notif = NULL; + struct bt_private_notification *notif = NULL; BT_ASSERT(notit->meta.ec); BT_ASSERT(notit->packet); @@ -1202,7 +1208,7 @@ enum bt_notif_iter_status set_current_event_notification( notit->meta.ec->name->str, notit->packet); BT_ASSERT(notit->notif_iter); - notif = bt_notification_event_create(notit->notif_iter, + notif = bt_private_notification_event_create(notit->notif_iter, notit->meta.ec->ir_ec, notit->packet); if (!notif) { BT_LOGE("Cannot create event notification: " @@ -1241,14 +1247,15 @@ enum bt_notif_iter_status after_event_header_state( goto end; } - notit->event = bt_notification_event_borrow_event(notit->event_notif); + notit->event = bt_private_notification_event_borrow_private_event( + notit->event_notif); BT_ASSERT(notit->event); if (notit->event_header_field) { int ret; BT_ASSERT(notit->event); - ret = bt_event_move_header(notit->event, + ret = bt_private_event_move_private_header_field(notit->event, notit->event_header_field); if (ret) { status = BT_NOTIF_ITER_STATUS_ERROR; @@ -1262,8 +1269,8 @@ enum bt_notif_iter_status after_event_header_state( * the same value as the event header field within * notit->event. */ - BT_ASSERT(bt_event_borrow_header_field(notit->event) == - notit->dscopes.event_header); + BT_ASSERT(bt_private_event_borrow_header_private_field( + notit->event) == notit->dscopes.event_header); } notit->state = STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN; @@ -1288,7 +1295,8 @@ enum bt_notif_iter_status read_event_common_context_begin_state( if (event_common_context_fc->in_ir) { BT_ASSERT(!notit->dscopes.event_common_context); notit->dscopes.event_common_context = - bt_event_borrow_common_context_field(notit->event); + bt_private_event_borrow_common_context_private_field( + notit->event); BT_ASSERT(notit->dscopes.event_common_context); } @@ -1339,8 +1347,9 @@ enum bt_notif_iter_status read_event_spec_context_begin_state( if (event_spec_context_fc->in_ir) { BT_ASSERT(!notit->dscopes.event_spec_context); - notit->dscopes.event_spec_context = bt_event_borrow_specific_context_field( - notit->event); + notit->dscopes.event_spec_context = + bt_private_event_borrow_specific_context_private_field( + notit->event); BT_ASSERT(notit->dscopes.event_spec_context); } @@ -1394,8 +1403,9 @@ enum bt_notif_iter_status read_event_payload_begin_state( if (event_payload_fc->in_ir) { BT_ASSERT(!notit->dscopes.event_payload); - notit->dscopes.event_payload = bt_event_borrow_payload_field( - notit->event); + notit->dscopes.event_payload = + bt_private_event_borrow_payload_private_field( + notit->event); BT_ASSERT(notit->dscopes.event_payload); } @@ -1576,17 +1586,17 @@ void bt_notif_iter_reset(struct bt_notif_iter *notit) notit->cur_dscope_field = NULL; if (notit->packet_header_field) { - bt_packet_header_field_release(notit->packet_header_field); + bt_private_packet_header_field_release(notit->packet_header_field); notit->packet_header_field = NULL; } if (notit->packet_context_field) { - bt_packet_context_field_release(notit->packet_context_field); + bt_private_packet_context_field_release(notit->packet_context_field); notit->packet_context_field = NULL; } if (notit->event_header_field) { - bt_event_header_field_release(notit->event_header_field); + bt_private_event_header_field_release(notit->event_header_field); notit->event_header_field = NULL; } @@ -1669,39 +1679,43 @@ end: } static -struct bt_field *borrow_next_field(struct bt_notif_iter *notit) +struct bt_private_field *borrow_next_field(struct bt_notif_iter *notit) { - struct bt_field *next_field = NULL; - struct bt_field *base_field; - struct bt_field_class *base_fc; + struct bt_private_field *next_field = NULL; + struct bt_private_field *base_field; + struct bt_private_field_class *base_fc; size_t index; BT_ASSERT(!stack_empty(notit->stack)); index = stack_top(notit->stack)->index; base_field = stack_top(notit->stack)->base; BT_ASSERT(base_field); - base_fc = bt_field_borrow_class(base_field); + base_fc = bt_private_field_borrow_private_class(base_field); BT_ASSERT(base_fc); - switch (bt_field_class_get_type(base_fc)) { + switch (bt_field_class_get_type(bt_field_class_borrow_from_private(base_fc))) { case BT_FIELD_CLASS_TYPE_STRUCTURE: { BT_ASSERT(index < bt_field_class_structure_get_member_count( - bt_field_borrow_class(base_field))); - next_field = bt_field_structure_borrow_member_field_by_index( - base_field, index); + bt_field_class_borrow_from_private( + bt_private_field_borrow_private_class( + base_field)))); + next_field = + bt_private_field_structure_borrow_member_private_field_by_index( + base_field, index); break; } case BT_FIELD_CLASS_TYPE_STATIC_ARRAY: case BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY: - BT_ASSERT(index < bt_field_array_get_length(base_field)); - next_field = bt_field_array_borrow_element_field_by_index( + BT_ASSERT(index < bt_field_array_get_length( + bt_field_borrow_from_private(base_field))); + next_field = bt_private_field_array_borrow_element_private_field_by_index( base_field, index); break; case BT_FIELD_CLASS_TYPE_VARIANT: BT_ASSERT(index == 0); - next_field = bt_field_variant_borrow_selected_option_field( + next_field = bt_private_field_variant_borrow_selected_option_private_field( base_field); break; default: @@ -1760,7 +1774,7 @@ enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value, { struct bt_notif_iter *notit = data; enum bt_bfcr_status status = BT_BFCR_STATUS_OK; - struct bt_field *field = NULL; + struct bt_private_field *field = NULL; struct ctf_field_class_int *int_fc = (void *) fc; BT_LOGV("Unsigned integer function called from BFCR: " @@ -1829,10 +1843,13 @@ update_def_clock: field = borrow_next_field(notit); BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc); - BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || - bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION); - bt_field_unsigned_integer_set_value(field, value); + BT_ASSERT(bt_private_field_borrow_private_class(field) == fc->ir_fc); + BT_ASSERT(bt_field_get_class_type( + bt_field_borrow_from_private(field)) == + BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || + bt_field_get_class_type(bt_field_borrow_from_private(field)) == + BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION); + bt_private_field_unsigned_integer_set_value(field, value); stack_top(notit->stack)->index++; end: @@ -1846,7 +1863,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value, int ret; struct bt_notif_iter *notit = data; enum bt_bfcr_status status = BT_BFCR_STATUS_OK; - struct bt_field *string_field = NULL; + struct bt_private_field *string_field = NULL; struct ctf_field_class_int *int_fc = (void *) fc; char str[2] = {'\0', '\0'}; @@ -1872,11 +1889,13 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value, } string_field = stack_top(notit->stack)->base; - BT_ASSERT(bt_field_get_class_type(string_field) == BT_FIELD_CLASS_TYPE_STRING); + BT_ASSERT(bt_field_get_class_type( + bt_field_borrow_from_private(string_field)) == + BT_FIELD_CLASS_TYPE_STRING); /* Append character */ str[0] = (char) value; - ret = bt_field_string_append_with_length(string_field, str, 1); + ret = bt_private_field_string_append_with_length(string_field, str, 1); if (ret) { BT_LOGE("Cannot append character to string field's value: " "notit-addr=%p, field-addr=%p, ret=%d", @@ -1894,7 +1913,7 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value, struct ctf_field_class *fc, void *data) { enum bt_bfcr_status status = BT_BFCR_STATUS_OK; - struct bt_field *field = NULL; + struct bt_private_field *field = NULL; struct bt_notif_iter *notit = data; struct ctf_field_class_int *int_fc = (void *) fc; @@ -1915,10 +1934,13 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value, field = borrow_next_field(notit); BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc); - BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || - bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION); - bt_field_signed_integer_set_value(field, value); + BT_ASSERT(bt_private_field_borrow_private_class(field) == fc->ir_fc); + BT_ASSERT(bt_field_get_class_type( + bt_field_borrow_from_private(field)) == + BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || + bt_field_get_class_type(bt_field_borrow_from_private(field)) == + BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION); + bt_private_field_signed_integer_set_value(field, value); stack_top(notit->stack)->index++; end: @@ -1930,7 +1952,7 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value, struct ctf_field_class *fc, void *data) { enum bt_bfcr_status status = BT_BFCR_STATUS_OK; - struct bt_field *field = NULL; + struct bt_private_field *field = NULL; struct bt_notif_iter *notit = data; BT_LOGV("Floating point number function called from BFCR: " @@ -1940,9 +1962,11 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value, BT_ASSERT(fc->in_ir); field = borrow_next_field(notit); BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc); - BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_REAL); - bt_field_real_set_value(field, value); + BT_ASSERT(bt_private_field_borrow_private_class(field) == fc->ir_fc); + BT_ASSERT(bt_field_get_class_type( + bt_field_borrow_from_private(field)) == + BT_FIELD_CLASS_TYPE_REAL); + bt_private_field_real_set_value(field, value); stack_top(notit->stack)->index++; return status; } @@ -1951,7 +1975,7 @@ static enum bt_bfcr_status bfcr_string_begin_cb( struct ctf_field_class *fc, void *data) { - struct bt_field *field = NULL; + struct bt_private_field *field = NULL; struct bt_notif_iter *notit = data; int ret; @@ -1963,9 +1987,11 @@ enum bt_bfcr_status bfcr_string_begin_cb( BT_ASSERT(fc->in_ir); field = borrow_next_field(notit); BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc); - BT_ASSERT(bt_field_get_class_type(field) == BT_FIELD_CLASS_TYPE_STRING); - ret = bt_field_string_clear(field); + BT_ASSERT(bt_private_field_borrow_private_class(field) == fc->ir_fc); + BT_ASSERT(bt_field_get_class_type( + bt_field_borrow_from_private(field)) == + BT_FIELD_CLASS_TYPE_STRING); + ret = bt_private_field_string_clear(field); BT_ASSERT(ret == 0); /* @@ -1982,7 +2008,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value, size_t len, struct ctf_field_class *fc, void *data) { enum bt_bfcr_status status = BT_BFCR_STATUS_OK; - struct bt_field *field = NULL; + struct bt_private_field *field = NULL; struct bt_notif_iter *notit = data; int ret; @@ -1996,7 +2022,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value, BT_ASSERT(field); /* Append current substring */ - ret = bt_field_string_append_with_length(field, value, len); + ret = bt_private_field_string_append_with_length(field, value, len); if (ret) { BT_LOGE("Cannot append substring to string field's value: " "notit-addr=%p, field-addr=%p, string-length=%zu, " @@ -2033,7 +2059,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb( struct ctf_field_class *fc, void *data) { struct bt_notif_iter *notit = data; - struct bt_field *field; + struct bt_private_field *field; BT_LOGV("Compound (beginning) function called from BFCR: " "notit-addr=%p, bfcr-addr=%p, fc-addr=%p, " @@ -2055,7 +2081,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb( /* Push field */ BT_ASSERT(field); - BT_ASSERT(bt_field_borrow_class(field) == fc->ir_fc); + BT_ASSERT(bt_private_field_borrow_private_class(field) == fc->ir_fc); stack_push(notit->stack, field); /* @@ -2069,10 +2095,11 @@ enum bt_bfcr_status bfcr_compound_begin_cb( if (array_fc->is_text) { int ret; - BT_ASSERT(bt_field_get_class_type(field) == + BT_ASSERT(bt_field_get_class_type( + bt_field_borrow_from_private(field)) == BT_FIELD_CLASS_TYPE_STRING); notit->done_filling_string = false; - ret = bt_field_string_clear(field); + ret = bt_private_field_string_clear(field); BT_ASSERT(ret == 0); bt_bfcr_set_unsigned_int_cb(notit->bfcr, bfcr_unsigned_int_char_cb); @@ -2098,7 +2125,7 @@ enum bt_bfcr_status bfcr_compound_end_cb( } BT_ASSERT(!stack_empty(notit->stack)); - BT_ASSERT(bt_field_borrow_class(stack_top(notit->stack)->base) == + BT_ASSERT(bt_private_field_borrow_private_class(stack_top(notit->stack)->base) == fc->ir_fc); /* @@ -2111,8 +2138,9 @@ enum bt_bfcr_status bfcr_compound_end_cb( if (array_fc->is_text) { BT_ASSERT(bt_field_get_class_type( - stack_top(notit->stack)->base) == - BT_FIELD_CLASS_TYPE_STRING); + bt_field_borrow_from_private( + stack_top(notit->stack)->base)) == + BT_FIELD_CLASS_TYPE_STRING); bt_bfcr_set_unsigned_int_cb(notit->bfcr, bfcr_unsigned_int_cb); } @@ -2133,7 +2161,7 @@ end: static int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data) { - struct bt_field *seq_field; + struct bt_private_field *seq_field; struct bt_notif_iter *notit = data; struct ctf_field_class_sequence *seq_fc = (void *) fc; int64_t length = -1; @@ -2143,7 +2171,7 @@ int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data) seq_fc->stored_length_index); seq_field = stack_top(notit->stack)->base; BT_ASSERT(seq_field); - ret = bt_field_dynamic_array_set_length(seq_field, (uint64_t) length); + ret = bt_private_field_dynamic_array_set_length(seq_field, (uint64_t) length); if (ret) { BT_LOGE("Cannot set dynamic array field's length field: " "notit-addr=%p, field-addr=%p, " @@ -2213,10 +2241,10 @@ struct ctf_field_class *bfcr_borrow_variant_selected_field_class_cb( var_fc, (uint64_t) option_index); if (selected_option->fc->in_ir) { - struct bt_field *var_field = stack_top(notit->stack)->base; + struct bt_private_field *var_field = stack_top(notit->stack)->base; - ret = bt_field_variant_select_option_field(var_field, - option_index); + ret = bt_private_field_variant_select_option_private_field( + var_field, option_index); if (ret) { BT_LOGW("Cannot select variant field's option field: " "notit-addr=%p, var-field-addr=%p, " @@ -2235,14 +2263,16 @@ end: static void set_event_default_clock_value(struct bt_notif_iter *notit) { - struct bt_event *event = bt_notification_event_borrow_event( - notit->event_notif); - struct bt_stream_class *sc = notit->meta.sc->ir_sc; + struct bt_private_event *event = + bt_private_notification_event_borrow_private_event( + notit->event_notif); + struct bt_stream_class *sc = bt_stream_class_borrow_from_private( + notit->meta.sc->ir_sc); BT_ASSERT(event); if (bt_stream_class_borrow_default_clock_class(sc)) { - int ret = bt_event_set_default_clock_value(event, + int ret = bt_private_event_set_default_clock_value(event, notit->default_clock_val); BT_ASSERT(ret == 0); @@ -2251,10 +2281,10 @@ void set_event_default_clock_value(struct bt_notif_iter *notit) static void notify_new_stream(struct bt_notif_iter *notit, - struct bt_notification **notification) + struct bt_private_notification **notification) { enum bt_notif_iter_status status; - struct bt_notification *ret = NULL; + struct bt_private_notification *ret = NULL; status = set_current_stream(notit); if (status != BT_NOTIF_ITER_STATUS_OK) { @@ -2264,7 +2294,7 @@ void notify_new_stream(struct bt_notif_iter *notit, BT_ASSERT(notit->stream); BT_ASSERT(notit->notif_iter); - ret = bt_notification_stream_begin_create(notit->notif_iter, + ret = bt_private_notification_stream_begin_create(notit->notif_iter, notit->stream); if (!ret) { BT_LOGE("Cannot create stream beginning notification: " @@ -2279,9 +2309,9 @@ end: static void notify_end_of_stream(struct bt_notif_iter *notit, - struct bt_notification **notification) + struct bt_private_notification **notification) { - struct bt_notification *ret; + struct bt_private_notification *ret; if (!notit->stream) { BT_LOGE("Cannot create stream for stream notification: " @@ -2290,7 +2320,7 @@ void notify_end_of_stream(struct bt_notif_iter *notit, } BT_ASSERT(notit->notif_iter); - ret = bt_notification_stream_end_create(notit->notif_iter, + ret = bt_private_notification_stream_end_create(notit->notif_iter, notit->stream); if (!ret) { BT_LOGE("Cannot create stream beginning notification: " @@ -2303,11 +2333,11 @@ void notify_end_of_stream(struct bt_notif_iter *notit, static void notify_new_packet(struct bt_notif_iter *notit, - struct bt_notification **notification) + struct bt_private_notification **notification) { int ret; enum bt_notif_iter_status status; - struct bt_notification *notif = NULL; + struct bt_private_notification *notif = NULL; struct bt_stream_class *sc; status = set_current_packet(notit); @@ -2316,40 +2346,40 @@ void notify_new_packet(struct bt_notif_iter *notit, } BT_ASSERT(notit->packet); - sc = notit->meta.sc->ir_sc; + sc = bt_stream_class_borrow_from_private(notit->meta.sc->ir_sc); BT_ASSERT(sc); if (bt_stream_class_packets_have_discarded_event_counter_snapshot(sc)) { BT_ASSERT(notit->snapshots.discarded_events != UINT64_C(-1)); - ret = bt_packet_set_discarded_event_counter_snapshot( + ret = bt_private_packet_set_discarded_event_counter_snapshot( notit->packet, notit->snapshots.discarded_events); BT_ASSERT(ret == 0); } if (bt_stream_class_packets_have_packet_counter_snapshot(sc)) { BT_ASSERT(notit->snapshots.packets != UINT64_C(-1)); - ret = bt_packet_set_packet_counter_snapshot( + ret = bt_private_packet_set_packet_counter_snapshot( notit->packet, notit->snapshots.packets); BT_ASSERT(ret == 0); } if (bt_stream_class_packets_have_default_beginning_clock_value(sc)) { BT_ASSERT(notit->snapshots.beginning_clock != UINT64_C(-1)); - ret = bt_packet_set_default_beginning_clock_value( + ret = bt_private_packet_set_default_beginning_clock_value( notit->packet, notit->snapshots.beginning_clock); BT_ASSERT(ret == 0); } if (bt_stream_class_packets_have_default_end_clock_value(sc)) { BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1)); - ret = bt_packet_set_default_end_clock_value( + ret = bt_private_packet_set_default_end_clock_value( notit->packet, notit->snapshots.end_clock); BT_ASSERT(ret == 0); } if (notit->packet_header_field) { - ret = bt_packet_move_header_field(notit->packet, - notit->packet_header_field); + ret = bt_private_packet_move_private_header_field( + notit->packet, notit->packet_header_field); if (ret) { goto end; } @@ -2361,13 +2391,14 @@ void notify_new_packet(struct bt_notif_iter *notit, * the same value as the packet header field within * notit->packet. */ - BT_ASSERT(bt_packet_borrow_header_field(notit->packet) == + BT_ASSERT(bt_private_packet_borrow_header_private_field( + notit->packet) == notit->dscopes.trace_packet_header); } if (notit->packet_context_field) { - ret = bt_packet_move_context_field(notit->packet, - notit->packet_context_field); + ret = bt_private_packet_move_private_context_field( + notit->packet, notit->packet_context_field); if (ret) { goto end; } @@ -2379,12 +2410,13 @@ void notify_new_packet(struct bt_notif_iter *notit, * the same value as the packet header field within * notit->packet. */ - BT_ASSERT(bt_packet_borrow_context_field(notit->packet) == + BT_ASSERT(bt_private_packet_borrow_context_private_field( + notit->packet) == notit->dscopes.stream_packet_context); } BT_ASSERT(notit->notif_iter); - notif = bt_notification_packet_begin_create(notit->notif_iter, + notif = bt_private_notification_packet_begin_create(notit->notif_iter, notit->packet); if (!notif) { BT_LOGE("Cannot create packet beginning notification: " @@ -2401,9 +2433,9 @@ end: static void notify_end_of_packet(struct bt_notif_iter *notit, - struct bt_notification **notification) + struct bt_private_notification **notification) { - struct bt_notification *notif; + struct bt_private_notification *notif; if (!notit->packet) { return; @@ -2415,7 +2447,7 @@ void notify_end_of_packet(struct bt_notif_iter *notit, } BT_ASSERT(notit->notif_iter); - notif = bt_notification_packet_end_create(notit->notif_iter, + notif = bt_private_notification_packet_end_create(notit->notif_iter, notit->packet); if (!notif) { BT_LOGE("Cannot create packet end notification: " @@ -2527,7 +2559,7 @@ void bt_notif_iter_destroy(struct bt_notif_iter *notit) enum bt_notif_iter_status bt_notif_iter_get_next_notification( struct bt_notif_iter *notit, struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_notification **notification) + struct bt_private_notification **notification) { enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; @@ -2629,8 +2661,8 @@ end: BT_HIDDEN enum bt_notif_iter_status bt_notif_iter_borrow_packet_header_context_fields( struct bt_notif_iter *notit, - struct bt_field **packet_header_field, - struct bt_field **packet_context_field) + struct bt_private_field **packet_header_field, + struct bt_private_field **packet_context_field) { int ret; enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; diff --git a/plugins/ctf/common/notif-iter/notif-iter.h b/plugins/ctf/common/notif-iter/notif-iter.h index a504da94..81418628 100644 --- a/plugins/ctf/common/notif-iter/notif-iter.h +++ b/plugins/ctf/common/notif-iter/notif-iter.h @@ -228,8 +228,8 @@ struct bt_notif_iter_medium_ops { * @returns Stream instance (weak reference) or * \c NULL on error */ - struct bt_stream * (* borrow_stream)( - struct bt_stream_class *stream_class, + struct bt_private_stream * (* borrow_stream)( + struct bt_private_stream_class *stream_class, int64_t stream_id, void *data); }; @@ -288,7 +288,7 @@ BT_HIDDEN enum bt_notif_iter_status bt_notif_iter_get_next_notification( struct bt_notif_iter *notit, struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_notification **notification); + struct bt_private_notification **notification); /** * Returns the first packet header and context fields. This function @@ -305,8 +305,8 @@ enum bt_notif_iter_status bt_notif_iter_get_next_notification( BT_HIDDEN enum bt_notif_iter_status bt_notif_iter_borrow_packet_header_context_fields( struct bt_notif_iter *notit, - struct bt_field **packet_header_field, - struct bt_field **packet_context_field); + struct bt_private_field **packet_header_field, + struct bt_private_field **packet_context_field); struct bt_notif_iter_packet_properties { uint64_t exp_packet_total_size; diff --git a/plugins/ctf/fs-src/data-stream-file.c b/plugins/ctf/fs-src/data-stream-file.c index 9f7b7972..1e4356d6 100644 --- a/plugins/ctf/fs-src/data-stream-file.c +++ b/plugins/ctf/fs-src/data-stream-file.c @@ -173,15 +173,17 @@ end: } static -struct bt_stream *medop_borrow_stream( - struct bt_stream_class *stream_class, int64_t stream_id, +struct bt_private_stream *medop_borrow_stream( + struct bt_private_stream_class *stream_class, int64_t stream_id, void *data) { struct ctf_fs_ds_file *ds_file = data; - struct bt_stream_class *ds_file_stream_class; - struct bt_stream *stream = NULL; + struct bt_private_stream_class *ds_file_stream_class; + struct bt_private_stream *stream = NULL; + + ds_file_stream_class = bt_private_stream_borrow_private_class( + ds_file->stream); - ds_file_stream_class = bt_stream_borrow_class(ds_file->stream); if (stream_class != ds_file_stream_class) { /* * Not supported: two packets described by two different @@ -291,10 +293,11 @@ struct ctf_fs_ds_index_entry *ctf_fs_ds_index_add_new_entry( } static -int convert_cycles_to_ns(struct bt_clock_class *clock_class, +int convert_cycles_to_ns(struct bt_private_clock_class *clock_class, uint64_t cycles, int64_t *ns) { - return bt_clock_class_cycles_to_ns_from_origin(clock_class, cycles, ns); + return bt_clock_class_cycles_to_ns_from_origin( + bt_clock_class_borrow_from_private(clock_class), cycles, ns); } static @@ -623,7 +626,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create( struct ctf_fs_trace *ctf_fs_trace, struct bt_private_connection_private_notification_iterator *pc_notif_iter, struct bt_notif_iter *notif_iter, - struct bt_stream *stream, const char *path) + struct bt_private_stream *stream, const char *path) { int ret; const size_t page_size = bt_common_get_page_size(); @@ -691,7 +694,6 @@ void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file) return; } - bt_object_put_ref(ds_file->cc_prio_map); bt_object_put_ref(ds_file->stream); (void) ds_file_munmap(ds_file); @@ -705,7 +707,7 @@ void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *ds_file) BT_HIDDEN enum bt_notification_iterator_status ctf_fs_ds_file_next( struct ctf_fs_ds_file *ds_file, - struct bt_notification **notif) + struct bt_private_notification **notif) { enum bt_notif_iter_status notif_iter_status; enum bt_notification_iterator_status status; @@ -739,8 +741,8 @@ enum bt_notification_iterator_status ctf_fs_ds_file_next( BT_HIDDEN int ctf_fs_ds_file_borrow_packet_header_context_fields( struct ctf_fs_ds_file *ds_file, - struct bt_field **packet_header_field, - struct bt_field **packet_context_field) + struct bt_private_field **packet_header_field, + struct bt_private_field **packet_context_field) { enum bt_notif_iter_status notif_iter_status; int ret = 0; diff --git a/plugins/ctf/fs-src/data-stream-file.h b/plugins/ctf/fs-src/data-stream-file.h index 075b8293..e403656e 100644 --- a/plugins/ctf/fs-src/data-stream-file.h +++ b/plugins/ctf/fs-src/data-stream-file.h @@ -97,10 +97,7 @@ struct ctf_fs_ds_file { struct ctf_fs_file *file; /* Owned by this */ - struct bt_stream *stream; - - /* Owned by this */ - struct bt_clock_class_priority_map *cc_prio_map; + struct bt_private_stream *stream; /* Weak */ struct bt_notif_iter *notif_iter; @@ -133,13 +130,13 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create( struct ctf_fs_trace *ctf_fs_trace, struct bt_private_connection_private_notification_iterator *pc_notif_iter, struct bt_notif_iter *notif_iter, - struct bt_stream *stream, const char *path); + struct bt_private_stream *stream, const char *path); BT_HIDDEN int ctf_fs_ds_file_borrow_packet_header_context_fields( struct ctf_fs_ds_file *ds_file, - struct bt_field **packet_header_field, - struct bt_field **packet_context_field); + struct bt_private_field **packet_header_field, + struct bt_private_field **packet_context_field); BT_HIDDEN void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream); @@ -147,7 +144,7 @@ void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream); BT_HIDDEN enum bt_notification_iterator_status ctf_fs_ds_file_next( struct ctf_fs_ds_file *ds_file, - struct bt_notification **notif); + struct bt_private_notification **notif); BT_HIDDEN struct ctf_fs_ds_index *ctf_fs_ds_file_build_index( diff --git a/plugins/ctf/fs-src/fs.c b/plugins/ctf/fs-src/fs.c index 405a1838..e3fa27e7 100644 --- a/plugins/ctf/fs-src/fs.c +++ b/plugins/ctf/fs-src/fs.c @@ -93,10 +93,12 @@ enum bt_notification_iterator_status ctf_fs_iterator_next_one( struct bt_notification **notif) { enum bt_notification_iterator_status status; + struct bt_private_notification *priv_notif; int ret; BT_ASSERT(notif_iter_data->ds_file); - status = ctf_fs_ds_file_next(notif_iter_data->ds_file, notif); + status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif); + *notif = bt_notification_borrow_from_private(priv_notif); if (status == BT_NOTIFICATION_ITERATOR_STATUS_OK && bt_notification_get_type(*notif) == @@ -109,7 +111,8 @@ enum bt_notification_iterator_status ctf_fs_iterator_next_one( */ BT_OBJECT_PUT_REF_AND_RESET(*notif); status = ctf_fs_ds_file_next(notif_iter_data->ds_file, - notif); + &priv_notif); + *notif = bt_notification_borrow_from_private(priv_notif); BT_ASSERT(status != BT_NOTIFICATION_ITERATOR_STATUS_END); goto end; } else { @@ -154,7 +157,8 @@ enum bt_notification_iterator_status ctf_fs_iterator_next_one( goto end; } - status = ctf_fs_ds_file_next(notif_iter_data->ds_file, notif); + status = ctf_fs_ds_file_next(notif_iter_data->ds_file, &priv_notif); + *notif = bt_notification_borrow_from_private(priv_notif); /* * If we get a notification, we expect to get a @@ -179,7 +183,8 @@ enum bt_notification_iterator_status ctf_fs_iterator_next_one( BT_NOTIFICATION_TYPE_STREAM_BEGIN); BT_OBJECT_PUT_REF_AND_RESET(*notif); status = ctf_fs_ds_file_next(notif_iter_data->ds_file, - notif); + &priv_notif); + *notif = bt_notification_borrow_from_private(priv_notif); BT_ASSERT(status != BT_NOTIFICATION_ITERATOR_STATUS_END); } } @@ -516,7 +521,7 @@ void ctf_fs_ds_file_group_destroy(struct ctf_fs_ds_file_group *ds_file_group) static struct ctf_fs_ds_file_group *ctf_fs_ds_file_group_create( struct ctf_fs_trace *ctf_fs_trace, - struct bt_stream_class *stream_class, + struct bt_private_stream_class *stream_class, uint64_t stream_instance_id) { struct ctf_fs_ds_file_group *ds_file_group; @@ -607,9 +612,9 @@ end: static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, - struct bt_graph *graph, const char *path) + const char *path) { - struct bt_stream_class *stream_class = NULL; + struct bt_private_stream_class *stream_class = NULL; int64_t stream_instance_id = -1; int64_t begin_ns = -1; struct ctf_fs_ds_file_group *ds_file_group = NULL; @@ -655,7 +660,8 @@ int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, if (props.snapshots.beginning_clock != UINT64_C(-1)) { BT_ASSERT(sc->default_clock_class); ret = bt_clock_class_cycles_to_ns_from_origin( - sc->default_clock_class, + bt_clock_class_borrow_from_private( + sc->default_clock_class), props.snapshots.beginning_clock, &begin_ns); if (ret) { BT_LOGE("Cannot convert clock cycles to nanoseconds from origin (`%s`).", @@ -761,8 +767,7 @@ end: } static -int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace, - struct bt_graph *graph) +int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace) { int ret = 0; const char *basename; @@ -827,7 +832,7 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace, continue; } - ret = add_ds_file_to_ds_file_group(ctf_fs_trace, graph, + ret = add_ds_file_to_ds_file_group(ctf_fs_trace, file->path->str); if (ret) { BT_LOGE("Cannot add stream file `%s` to stream file group", @@ -857,13 +862,13 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace, if (ds_file_group->stream_id == UINT64_C(-1)) { /* No stream ID: use 0 */ - ds_file_group->stream = bt_stream_create_with_id( + ds_file_group->stream = bt_private_stream_create_with_id( ds_file_group->stream_class, ctf_fs_trace->next_stream_id); ctf_fs_trace->next_stream_id++; } else { /* Specific stream ID */ - ds_file_group->stream = bt_stream_create_with_id( + ds_file_group->stream = bt_private_stream_create_with_id( ds_file_group->stream_class, (uint64_t) ds_file_group->stream_id); } @@ -876,7 +881,8 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace, goto error; } - ret = bt_stream_set_name(ds_file_group->stream, name->str); + ret = bt_private_stream_set_name(ds_file_group->stream, + name->str); if (ret) { BT_LOGE("Cannot set stream's name: " "addr=%p, stream-name=\"%s\"", @@ -908,8 +914,7 @@ end: BT_HIDDEN struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name, - struct ctf_fs_metadata_config *metadata_config, - struct bt_graph *graph) + struct ctf_fs_metadata_config *metadata_config) { struct ctf_fs_trace *ctf_fs_trace; int ret; @@ -946,7 +951,7 @@ struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name, goto error; } - ret = create_ds_file_groups(ctf_fs_trace, graph); + ret = create_ds_file_groups(ctf_fs_trace); if (ret) { goto error; } @@ -956,7 +961,7 @@ struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name, * trace needs. There won't be any more. Therefore it is safe to * make this trace static. */ - (void) bt_trace_make_static(ctf_fs_trace->metadata->trace); + (void) bt_private_trace_make_static(ctf_fs_trace->metadata->trace); goto end; @@ -1188,13 +1193,9 @@ int create_ctf_fs_traces(struct ctf_fs_component *ctf_fs, tn_node = g_list_next(tn_node)) { GString *trace_path = tp_node->data; GString *trace_name = tn_node->data; - struct bt_graph *graph = bt_component_borrow_graph( - bt_component_borrow_from_private(ctf_fs->priv_comp)); - BT_ASSERT(graph); ctf_fs_trace = ctf_fs_trace_create(trace_path->str, - trace_name->str, &ctf_fs->metadata_config, - graph); + trace_name->str, &ctf_fs->metadata_config); if (!ctf_fs_trace) { BT_LOGE("Cannot create trace for `%s`.", trace_path->str); diff --git a/plugins/ctf/fs-src/fs.h b/plugins/ctf/fs-src/fs.h index 26e796a7..95711d66 100644 --- a/plugins/ctf/fs-src/fs.h +++ b/plugins/ctf/fs-src/fs.h @@ -53,7 +53,7 @@ struct ctf_fs_metadata { struct ctf_metadata_decoder *decoder; /* Owned by this */ - struct bt_trace *trace; + struct bt_private_trace *trace; /* Weak (owned by `decoder` above) */ struct ctf_trace_class *tc; @@ -111,10 +111,10 @@ struct ctf_fs_ds_file_group { GPtrArray *ds_file_infos; /* Owned by this */ - struct bt_stream_class *stream_class; + struct bt_private_stream_class *stream_class; /* Owned by this */ - struct bt_stream *stream; + struct bt_private_stream *stream; /* Stream (instance) ID; -1ULL means none */ uint64_t stream_id; @@ -166,7 +166,7 @@ struct bt_component_class_query_method_return ctf_fs_query( BT_HIDDEN struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name, - struct ctf_fs_metadata_config *config, struct bt_graph *graph); + struct ctf_fs_metadata_config *config); BT_HIDDEN void ctf_fs_trace_destroy(struct ctf_fs_trace *trace); diff --git a/plugins/ctf/fs-src/query.c b/plugins/ctf/fs-src/query.c index 2a587d7b..d7c9824d 100644 --- a/plugins/ctf/fs-src/query.c +++ b/plugins/ctf/fs-src/query.c @@ -229,7 +229,8 @@ end: } static -int add_stream_ids(struct bt_private_value *info, struct bt_stream *stream) +int add_stream_ids(struct bt_private_value *info, + struct bt_stream *stream) { int ret = 0; int64_t stream_class_id, stream_instance_id; @@ -335,7 +336,8 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group, goto end; } - ret = add_stream_ids(group_info, group->stream); + ret = add_stream_ids(group_info, + bt_stream_borrow_from_private(group->stream)); if (ret) { goto end; } @@ -382,7 +384,7 @@ int populate_trace_info(const char *trace_path, const char *trace_name, goto end; } - trace = ctf_fs_trace_create(trace_path, trace_name, NULL, NULL); + trace = ctf_fs_trace_create(trace_path, trace_name, NULL); if (!trace) { BT_LOGE("Failed to create fs trace at \'%s\'", trace_path); ret = -1; diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 145770f5..316f8884 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -260,7 +260,7 @@ struct bt_event_class *ctf_copy_event_class(FILE *err, name = bt_event_class_get_name(event_class); - writer_event_class = bt_event_class_create(name); + writer_event_class = bt_private_event_class_create(name); BT_ASSERT(writer_event_class); id = bt_event_class_get_id(event_class); @@ -278,7 +278,7 @@ struct bt_event_class *ctf_copy_event_class(FILE *err, goto error; } - ret = bt_event_class_set_log_level(writer_event_class, log_level); + ret = bt_private_event_class_set_log_level(writer_event_class, log_level); if (ret) { BT_LOGE_STR("Failed to set log_level."); goto error; @@ -286,7 +286,7 @@ struct bt_event_class *ctf_copy_event_class(FILE *err, emf_uri = bt_event_class_get_emf_uri(event_class); if (emf_uri) { - ret = bt_event_class_set_emf_uri(writer_event_class, + ret = bt_private_event_class_set_emf_uri(writer_event_class, emf_uri); if (ret) { BT_LOGE_STR("Failed to set emf uri."); diff --git a/plugins/text/dmesg/dmesg.c b/plugins/text/dmesg/dmesg.c index 6659fd1e..964ad831 100644 --- a/plugins/text/dmesg/dmesg.c +++ b/plugins/text/dmesg/dmesg.c @@ -49,7 +49,7 @@ struct dmesg_notif_iter { char *linebuf; size_t linebuf_len; FILE *fp; - struct bt_notification *tmp_event_notif; + struct bt_private_notification *tmp_event_notif; enum { STATE_EMIT_STREAM_BEGINNING, @@ -68,35 +68,35 @@ struct dmesg_component { bt_bool no_timestamp; } params; - struct bt_trace *trace; - struct bt_stream_class *stream_class; - struct bt_event_class *event_class; - struct bt_stream *stream; - struct bt_packet *packet; - struct bt_clock_class *clock_class; - struct bt_clock_class_priority_map *cc_prio_map; + struct bt_private_trace *trace; + struct bt_private_stream_class *stream_class; + struct bt_private_event_class *event_class; + struct bt_private_stream *stream; + struct bt_private_packet *packet; + struct bt_private_clock_class *clock_class; }; static -struct bt_field_class *create_event_payload_fc(void) +struct bt_private_field_class *create_event_payload_fc(void) { - struct bt_field_class *root_fc = NULL; - struct bt_field_class *fc = NULL; + struct bt_private_field_class *root_fc = NULL; + struct bt_private_field_class *fc = NULL; int ret; - root_fc = bt_field_class_structure_create(); + root_fc = bt_private_field_class_structure_create(); if (!root_fc) { BT_LOGE_STR("Cannot create an empty structure field class object."); goto error; } - fc = bt_field_class_string_create(); + fc = bt_private_field_class_string_create(); if (!fc) { BT_LOGE_STR("Cannot create a string field class object."); goto error; } - ret = bt_field_class_structure_append_member(root_fc, "str", fc); + ret = bt_private_field_class_structure_append_private_member(root_fc, + "str", fc); if (ret) { BT_LOGE("Cannot add `str` member to structure field class: " "ret=%d", ret); @@ -116,12 +116,12 @@ end: static int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) { - struct bt_field_class *fc = NULL; + struct bt_private_field_class *fc = NULL; const char *trace_name = NULL; gchar *basename = NULL; int ret = 0; - dmesg_comp->trace = bt_trace_create(); + dmesg_comp->trace = bt_private_trace_create(); if (!dmesg_comp->trace) { BT_LOGE_STR("Cannot create an empty trace object."); goto error; @@ -140,42 +140,45 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) } if (trace_name) { - ret = bt_trace_set_name(dmesg_comp->trace, trace_name); + ret = bt_private_trace_set_name(dmesg_comp->trace, trace_name); if (ret) { BT_LOGE("Cannot set trace's name: name=\"%s\"", trace_name); goto error; } } - dmesg_comp->stream_class = bt_stream_class_create(dmesg_comp->trace); + dmesg_comp->stream_class = bt_private_stream_class_create( + dmesg_comp->trace); if (!dmesg_comp->stream_class) { BT_LOGE_STR("Cannot create a stream class object."); goto error; } if (has_ts) { - dmesg_comp->clock_class = bt_clock_class_create(); + dmesg_comp->clock_class = bt_private_clock_class_create(); if (!dmesg_comp->clock_class) { BT_LOGE_STR("Cannot create clock class."); goto error; } - ret = bt_stream_class_set_default_clock_class( - dmesg_comp->stream_class, dmesg_comp->clock_class); + ret = bt_private_stream_class_set_default_clock_class( + dmesg_comp->stream_class, + bt_clock_class_borrow_from_private( + dmesg_comp->clock_class)); if (ret) { BT_LOGE_STR("Cannot set stream class's default clock class."); goto error; } } - dmesg_comp->event_class = bt_event_class_create( + dmesg_comp->event_class = bt_private_event_class_create( dmesg_comp->stream_class); if (!dmesg_comp->event_class) { BT_LOGE_STR("Cannot create an event class object."); goto error; } - ret = bt_event_class_set_name(dmesg_comp->event_class, "string"); + ret = bt_private_event_class_set_name(dmesg_comp->event_class, "string"); if (ret) { BT_LOGE_STR("Cannot set event class's name."); goto error; @@ -187,7 +190,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) goto error; } - ret = bt_event_class_set_payload_field_class(dmesg_comp->event_class, fc); + ret = bt_private_event_class_set_payload_private_field_class(dmesg_comp->event_class, fc); if (ret) { BT_LOGE_STR("Cannot set event class's event payload field class."); goto error; @@ -266,19 +269,19 @@ int create_packet_and_stream(struct dmesg_component *dmesg_comp) { int ret = 0; - dmesg_comp->stream = bt_stream_create(dmesg_comp->stream_class); + dmesg_comp->stream = bt_private_stream_create(dmesg_comp->stream_class); if (!dmesg_comp->stream) { BT_LOGE_STR("Cannot create stream object."); goto error; } - dmesg_comp->packet = bt_packet_create(dmesg_comp->stream); + dmesg_comp->packet = bt_private_packet_create(dmesg_comp->stream); if (!dmesg_comp->packet) { BT_LOGE_STR("Cannot create packet object."); goto error; } - ret = bt_trace_make_static(dmesg_comp->trace); + ret = bt_private_trace_make_static(dmesg_comp->trace); if (ret) { BT_LOGE_STR("Cannot make trace static."); goto error; @@ -344,7 +347,6 @@ void destroy_dmesg_component(struct dmesg_component *dmesg_comp) bt_object_put_ref(dmesg_comp->event_class); bt_object_put_ref(dmesg_comp->stream); bt_object_put_ref(dmesg_comp->clock_class); - bt_object_put_ref(dmesg_comp->cc_prio_map); g_free(dmesg_comp); } @@ -418,12 +420,12 @@ void dmesg_finalize(struct bt_private_component *priv_comp) } static -struct bt_notification *create_init_event_notif_from_line( +struct bt_private_notification *create_init_event_notif_from_line( struct dmesg_notif_iter *notif_iter, const char *line, const char **new_start) { - struct bt_event *event; - struct bt_notification *notif = NULL; + struct bt_private_event *event; + struct bt_private_notification *notif = NULL; bool has_timestamp = false; unsigned long sec, usec, msec; unsigned int year, mon, mday, hour, min; @@ -493,18 +495,18 @@ skip_ts: goto error; } - notif = bt_notification_event_create(notif_iter->pc_notif_iter, + notif = bt_private_notification_event_create(notif_iter->pc_notif_iter, dmesg_comp->event_class, dmesg_comp->packet); if (!notif) { BT_LOGE_STR("Cannot create event notification."); goto error; } - event = bt_notification_event_borrow_event(notif); + event = bt_private_notification_event_borrow_private_event(notif); BT_ASSERT(event); if (dmesg_comp->clock_class) { - ret = bt_event_set_default_clock_value(event, ts); + ret = bt_private_event_set_default_clock_value(event, ts); BT_ASSERT(ret == 0); } @@ -518,17 +520,18 @@ end: } static -int fill_event_payload_from_line(const char *line, struct bt_event *event) +int fill_event_payload_from_line(const char *line, + struct bt_private_event *event) { - struct bt_field *ep_field = NULL; - struct bt_field *str_field = NULL; + struct bt_private_field *ep_field = NULL; + struct bt_private_field *str_field = NULL; size_t len; int ret; - ep_field = bt_event_borrow_payload_field(event); + ep_field = bt_private_event_borrow_payload_private_field(event); BT_ASSERT(ep_field); - str_field = bt_field_structure_borrow_member_field_by_index(ep_field, - 0); + str_field = bt_private_field_structure_borrow_member_private_field_by_index( + ep_field, 0); if (!str_field) { BT_LOGE_STR("Cannot borrow `timestamp` field from event payload structure field."); goto error; @@ -540,13 +543,13 @@ int fill_event_payload_from_line(const char *line, struct bt_event *event) len--; } - ret = bt_field_string_clear(str_field); + ret = bt_private_field_string_clear(str_field); if (ret) { BT_LOGE_STR("Cannot clear string field object."); goto error; } - ret = bt_field_string_append_with_length(str_field, line, len); + ret = bt_private_field_string_append_with_length(str_field, line, len); if (ret) { BT_LOGE("Cannot append value to string field object: " "len=%zu", len); @@ -563,11 +566,11 @@ end: } static -struct bt_notification *create_notif_from_line( +struct bt_private_notification *create_notif_from_line( struct dmesg_notif_iter *dmesg_notif_iter, const char *line) { - struct bt_event *event = NULL; - struct bt_notification *notif = NULL; + struct bt_private_event *event = NULL; + struct bt_private_notification *notif = NULL; const char *new_start; int ret; @@ -578,7 +581,7 @@ struct bt_notification *create_notif_from_line( goto error; } - event = bt_notification_event_borrow_event(notif); + event = bt_private_notification_event_borrow_private_event(notif); BT_ASSERT(event); ret = fill_event_payload_from_line(new_start, event); if (ret) { @@ -678,7 +681,7 @@ void dmesg_notif_iter_finalize( static enum bt_notification_iterator_status dmesg_notif_iter_next_one( struct dmesg_notif_iter *dmesg_notif_iter, - struct bt_notification **notif) + struct bt_private_notification **notif) { ssize_t len; struct dmesg_component *dmesg_comp; @@ -758,13 +761,13 @@ handle_state: switch (dmesg_notif_iter->state) { case STATE_EMIT_STREAM_BEGINNING: BT_ASSERT(dmesg_notif_iter->tmp_event_notif); - *notif = bt_notification_stream_begin_create( + *notif = bt_private_notification_stream_begin_create( dmesg_notif_iter->pc_notif_iter, dmesg_comp->stream); dmesg_notif_iter->state = STATE_EMIT_PACKET_BEGINNING; break; case STATE_EMIT_PACKET_BEGINNING: BT_ASSERT(dmesg_notif_iter->tmp_event_notif); - *notif = bt_notification_packet_begin_create( + *notif = bt_private_notification_packet_begin_create( dmesg_notif_iter->pc_notif_iter, dmesg_comp->packet); dmesg_notif_iter->state = STATE_EMIT_EVENT; break; @@ -774,12 +777,12 @@ handle_state: dmesg_notif_iter->tmp_event_notif = NULL; break; case STATE_EMIT_PACKET_END: - *notif = bt_notification_packet_end_create( + *notif = bt_private_notification_packet_end_create( dmesg_notif_iter->pc_notif_iter, dmesg_comp->packet); dmesg_notif_iter->state = STATE_EMIT_STREAM_END; break; case STATE_EMIT_STREAM_END: - *notif = bt_notification_stream_end_create( + *notif = bt_private_notification_stream_end_create( dmesg_notif_iter->pc_notif_iter, dmesg_comp->stream); dmesg_notif_iter->state = STATE_DONE; break; @@ -811,7 +814,11 @@ enum bt_notification_iterator_status dmesg_notif_iter_next( uint64_t i = 0; while (i < capacity && status == BT_NOTIFICATION_ITERATOR_STATUS_OK) { - status = dmesg_notif_iter_next_one(dmesg_notif_iter, ¬ifs[i]); + struct bt_private_notification *priv_notif; + + status = dmesg_notif_iter_next_one(dmesg_notif_iter, + &priv_notif); + notifs[i] = bt_notification_borrow_from_private(priv_notif); if (status == BT_NOTIFICATION_ITERATOR_STATUS_OK) { i++; } diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c index 609bb4e3..988f84e7 100644 --- a/tests/lib/test_bt_notification_iterator.c +++ b/tests/lib/test_bt_notification_iterator.c @@ -21,39 +21,8 @@ #include #include #include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include "tap/tap.h" @@ -87,14 +56,20 @@ static enum test current_test; static GArray *test_events; static struct bt_graph *graph; static struct bt_private_connection_private_notification_iterator *cur_notif_iter; -static struct bt_stream_class *src_stream_class; -static struct bt_event_class *src_event_class; -static struct bt_stream *src_stream1; -static struct bt_stream *src_stream2; -static struct bt_packet *src_stream1_packet1; -static struct bt_packet *src_stream1_packet2; -static struct bt_packet *src_stream2_packet1; -static struct bt_packet *src_stream2_packet2; +static struct bt_private_stream_class *src_stream_class; +static struct bt_private_event_class *src_event_class; +static struct bt_private_stream *src_stream1; +static struct bt_private_stream *src_stream2; +static struct bt_private_packet *src_stream1_packet1; +static struct bt_private_packet *src_stream1_packet2; +static struct bt_private_packet *src_stream2_packet1; +static struct bt_private_packet *src_stream2_packet2; +static struct bt_stream *pub_src_stream1; +static struct bt_stream *pub_src_stream2; +static struct bt_packet *pub_src_stream1_packet1; +static struct bt_packet *pub_src_stream1_packet2; +static struct bt_packet *pub_src_stream2_packet1; +static struct bt_packet *pub_src_stream2_packet2; enum { SEQ_END = -1, @@ -273,31 +248,41 @@ bool compare_test_events(const struct test_event *expected_events) static void init_static_data(void) { - struct bt_trace *trace; + struct bt_private_trace *trace; /* Test events */ test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event)); BT_ASSERT(test_events); /* Metadata */ - trace = bt_trace_create(); + trace = bt_private_trace_create(); BT_ASSERT(trace); - src_stream_class = bt_stream_class_create(trace); + src_stream_class = bt_private_stream_class_create(trace); BT_ASSERT(src_stream_class); - src_event_class = bt_event_class_create(src_stream_class); + src_event_class = bt_private_event_class_create(src_stream_class); BT_ASSERT(src_event_class); - src_stream1 = bt_stream_create(src_stream_class); + src_stream1 = bt_private_stream_create(src_stream_class); BT_ASSERT(src_stream1); - src_stream2 = bt_stream_create(src_stream_class); + pub_src_stream1 = bt_stream_borrow_from_private(src_stream1); + src_stream2 = bt_private_stream_create(src_stream_class); BT_ASSERT(src_stream2); - src_stream1_packet1 = bt_packet_create(src_stream1); + pub_src_stream2 = bt_stream_borrow_from_private(src_stream2); + src_stream1_packet1 = bt_private_packet_create(src_stream1); BT_ASSERT(src_stream1_packet1); - src_stream1_packet2 = bt_packet_create(src_stream1); + pub_src_stream1_packet1 = bt_packet_borrow_from_private( + src_stream1_packet1); + src_stream1_packet2 = bt_private_packet_create(src_stream1); BT_ASSERT(src_stream1_packet2); - src_stream2_packet1 = bt_packet_create(src_stream2); + pub_src_stream1_packet2 = bt_packet_borrow_from_private( + src_stream1_packet2); + src_stream2_packet1 = bt_private_packet_create(src_stream2); BT_ASSERT(src_stream2_packet1); - src_stream2_packet2 = bt_packet_create(src_stream2); + pub_src_stream2_packet1 = bt_packet_borrow_from_private( + src_stream2_packet1); + src_stream2_packet2 = bt_private_packet_create(src_stream2); BT_ASSERT(src_stream2_packet2); + pub_src_stream2_packet2 = bt_packet_borrow_from_private( + src_stream2_packet2); if (debug) { fprintf(stderr, ":: stream 1: %p\n", src_stream1); @@ -371,56 +356,68 @@ static void src_iter_next_seq_one(struct src_iter_user_data *user_data, struct bt_notification **notif) { - struct bt_packet *event_packet = NULL; + struct bt_private_packet *event_packet = NULL; switch (user_data->seq[user_data->at]) { case SEQ_STREAM1_BEGIN: - *notif = bt_notification_stream_begin_create(cur_notif_iter, - src_stream1); + *notif = bt_notification_borrow_from_private( + bt_private_notification_stream_begin_create( + cur_notif_iter, src_stream1)); break; case SEQ_STREAM2_BEGIN: - *notif = bt_notification_stream_begin_create(cur_notif_iter, - src_stream2); + *notif = bt_notification_borrow_from_private( + bt_private_notification_stream_begin_create( + cur_notif_iter, src_stream2)); break; case SEQ_STREAM1_END: - *notif = bt_notification_stream_end_create(cur_notif_iter, - src_stream1); + *notif = bt_notification_borrow_from_private( + bt_private_notification_stream_end_create( + cur_notif_iter, src_stream1)); break; case SEQ_STREAM2_END: - *notif = bt_notification_stream_end_create(cur_notif_iter, - src_stream2); + *notif = bt_notification_borrow_from_private( + bt_private_notification_stream_end_create( + cur_notif_iter, src_stream2)); break; case SEQ_STREAM1_PACKET1_BEGIN: - *notif = bt_notification_packet_begin_create(cur_notif_iter, - src_stream1_packet1); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_begin_create( + cur_notif_iter, src_stream1_packet1)); break; case SEQ_STREAM1_PACKET2_BEGIN: - *notif = bt_notification_packet_begin_create(cur_notif_iter, - src_stream1_packet2); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_begin_create( + cur_notif_iter, src_stream1_packet2)); break; case SEQ_STREAM2_PACKET1_BEGIN: - *notif = bt_notification_packet_begin_create(cur_notif_iter, - src_stream2_packet1); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_begin_create( + cur_notif_iter, src_stream2_packet1)); break; case SEQ_STREAM2_PACKET2_BEGIN: - *notif = bt_notification_packet_begin_create(cur_notif_iter, - src_stream2_packet2); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_begin_create( + cur_notif_iter, src_stream2_packet2)); break; case SEQ_STREAM1_PACKET1_END: - *notif = bt_notification_packet_end_create(cur_notif_iter, - src_stream1_packet1); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_end_create( + cur_notif_iter, src_stream1_packet1)); break; case SEQ_STREAM1_PACKET2_END: - *notif = bt_notification_packet_end_create(cur_notif_iter, - src_stream1_packet2); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_end_create( + cur_notif_iter, src_stream1_packet2)); break; case SEQ_STREAM2_PACKET1_END: - *notif = bt_notification_packet_end_create(cur_notif_iter, - src_stream2_packet1); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_end_create( + cur_notif_iter, src_stream2_packet1)); break; case SEQ_STREAM2_PACKET2_END: - *notif = bt_notification_packet_end_create(cur_notif_iter, - src_stream2_packet2); + *notif = bt_notification_borrow_from_private( + bt_private_notification_packet_end_create( + cur_notif_iter, src_stream2_packet2)); break; case SEQ_EVENT_STREAM1_PACKET1: event_packet = src_stream1_packet1; @@ -439,8 +436,9 @@ void src_iter_next_seq_one(struct src_iter_user_data *user_data, } if (event_packet) { - *notif = bt_notification_event_create(cur_notif_iter, - src_event_class, event_packet); + *notif = bt_notification_borrow_from_private( + bt_private_notification_event_create( + cur_notif_iter, src_event_class, event_packet)); } BT_ASSERT(*notif); @@ -795,22 +793,22 @@ static void test_no_auto_notifs(void) { const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = pub_src_stream1, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = pub_src_stream2, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = pub_src_stream2, .packet = pub_src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream2, .packet = pub_src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = pub_src_stream2, .packet = pub_src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = pub_src_stream1, .packet = pub_src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = pub_src_stream2, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = pub_src_stream1, .packet = pub_src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = pub_src_stream1, .packet = NULL, }, { .type = TEST_EV_TYPE_END, }, { .type = TEST_EV_TYPE_SENTINEL, }, }; @@ -823,22 +821,22 @@ static void test_output_port_notification_iterator(void) { const struct test_event expected_test_events[] = { - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream1, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = src_stream2, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream2, .packet = src_stream2_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream2, .packet = src_stream2_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet1, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream2, .packet = src_stream2_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream2, .packet = NULL, }, - { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = src_stream1, .packet = src_stream1_packet2, }, - { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = src_stream1, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = pub_src_stream1, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN, .stream = pub_src_stream2, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = pub_src_stream2, .packet = pub_src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream2, .packet = pub_src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = pub_src_stream1, .packet = pub_src_stream1_packet1, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = pub_src_stream2, .packet = pub_src_stream2_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN, .stream = pub_src_stream1, .packet = pub_src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_EVENT, .stream = pub_src_stream1, .packet = pub_src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = pub_src_stream2, .packet = NULL, }, + { .type = TEST_EV_TYPE_NOTIF_PACKET_END, .stream = pub_src_stream1, .packet = pub_src_stream1_packet2, }, + { .type = TEST_EV_TYPE_NOTIF_STREAM_END, .stream = pub_src_stream1, .packet = NULL, }, { .type = TEST_EV_TYPE_END, }, { .type = TEST_EV_TYPE_SENTINEL, }, }; @@ -860,7 +858,7 @@ void test_output_port_notification_iterator(void) upstream_port = bt_component_source_get_output_port_by_name(src_comp, "out"); notif_iter = bt_output_port_notification_iterator_create(upstream_port, NULL); - ok(notif_iter, "bt_output_port_notification_iterator_create() succeeds"); + ok(notif_iter, "bt_private_output_port_notification_iterator_create() succeeds"); bt_object_put_ref(upstream_port); /* Consume the notification iterator */ diff --git a/tests/lib/test_trace_ir_ref.c b/tests/lib/test_trace_ir_ref.c index 39dcd80a..47aaeac5 100644 --- a/tests/lib/test_trace_ir_ref.c +++ b/tests/lib/test_trace_ir_ref.c @@ -20,20 +20,7 @@ */ #include "tap/tap.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include #include #include @@ -42,11 +29,11 @@ #define NR_TESTS 37 struct user { - struct bt_trace *tc; - struct bt_stream_class *sc; - struct bt_event_class *ec; - struct bt_stream *stream; - struct bt_event *event; + struct bt_private_trace *tc; + struct bt_private_stream_class *sc; + struct bt_private_event_class *ec; + struct bt_private_stream *stream; + struct bt_private_event *event; }; struct writer_user { @@ -76,33 +63,33 @@ static const size_t WRITER_USER_NR_ELEMENTS = * - uint16_t payload_16; * - uint32_t payload_32; */ -static struct bt_field_class *create_integer_struct(void) +static struct bt_private_field_class *create_integer_struct(void) { int ret; - struct bt_field_class *structure = NULL; - struct bt_field_class *ui8 = NULL, *ui16 = NULL, *ui32 = NULL; + struct bt_private_field_class *structure = NULL; + struct bt_private_field_class *ui8 = NULL, *ui16 = NULL, *ui32 = NULL; - structure = bt_field_class_structure_create(); + structure = bt_private_field_class_structure_create(); BT_ASSERT(structure); - ui8 = bt_field_class_unsigned_integer_create(); + ui8 = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(ui8); - ret = bt_field_class_integer_set_field_value_range(ui8, 8); + ret = bt_private_field_class_integer_set_field_value_range(ui8, 8); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(structure, + ret = bt_private_field_class_structure_append_private_member(structure, "payload_8", ui8); BT_ASSERT(ret == 0); - ui16 = bt_field_class_unsigned_integer_create(); + ui16 = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(ui16); - ret = bt_field_class_integer_set_field_value_range(ui16, 16); + ret = bt_private_field_class_integer_set_field_value_range(ui16, 16); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(structure, + ret = bt_private_field_class_structure_append_private_member(structure, "payload_16", ui16); BT_ASSERT(ret == 0); - ui32 = bt_field_class_unsigned_integer_create(); + ui32 = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(ui32); - ret = bt_field_class_integer_set_field_value_range(ui32, 32); + ret = bt_private_field_class_integer_set_field_value_range(ui32, 32); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(structure, + ret = bt_private_field_class_structure_append_private_member(structure, "payload_32", ui32); BT_ASSERT(ret == 0); BT_OBJECT_PUT_REF_AND_RESET(ui8); @@ -146,21 +133,21 @@ static struct bt_ctf_field_type *create_writer_integer_struct(void) * - uint16_t payload_16; * - uint32_t payload_32; */ -static struct bt_event_class *create_simple_event(struct bt_stream_class *sc, - const char *name) +static struct bt_private_event_class *create_simple_event( + struct bt_private_stream_class *sc, const char *name) { int ret; - struct bt_event_class *event = NULL; - struct bt_field_class *payload = NULL; + struct bt_private_event_class *event = NULL; + struct bt_private_field_class *payload = NULL; BT_ASSERT(name); - event = bt_event_class_create(sc); + event = bt_private_event_class_create(sc); BT_ASSERT(event); - ret = bt_event_class_set_name(event, name); + ret = bt_private_event_class_set_name(event, name); BT_ASSERT(ret == 0); payload = create_integer_struct(); BT_ASSERT(payload); - ret = bt_event_class_set_payload_field_class(event, payload); + ret = bt_private_event_class_set_payload_private_field_class(event, payload); BT_ASSERT(ret == 0); BT_OBJECT_PUT_REF_AND_RESET(payload); return event; @@ -176,26 +163,27 @@ static struct bt_event_class *create_simple_event(struct bt_stream_class *sc, * - uint16_t payload_16; * - uint32_t payload_32; */ -static struct bt_event_class *create_complex_event(struct bt_stream_class *sc, +static struct bt_private_event_class *create_complex_event( + struct bt_private_stream_class *sc, const char *name) { int ret; - struct bt_event_class *event = NULL; - struct bt_field_class *inner = NULL, *outer = NULL; + struct bt_private_event_class *event = NULL; + struct bt_private_field_class *inner = NULL, *outer = NULL; BT_ASSERT(name); - event = bt_event_class_create(sc); + event = bt_private_event_class_create(sc); BT_ASSERT(event); - ret = bt_event_class_set_name(event, name); + ret = bt_private_event_class_set_name(event, name); BT_ASSERT(ret == 0); outer = create_integer_struct(); BT_ASSERT(outer); inner = create_integer_struct(); BT_ASSERT(inner); - ret = bt_field_class_structure_append_member(outer, + ret = bt_private_field_class_structure_append_private_member(outer, "payload_struct", inner); BT_ASSERT(ret == 0); - ret = bt_event_class_set_payload_field_class(event, outer); + ret = bt_private_event_class_set_payload_private_field_class(event, outer); BT_ASSERT(ret == 0); BT_OBJECT_PUT_REF_AND_RESET(inner); BT_OBJECT_PUT_REF_AND_RESET(outer); @@ -203,121 +191,121 @@ static struct bt_event_class *create_complex_event(struct bt_stream_class *sc, } static void set_stream_class_field_classes( - struct bt_stream_class *stream_class) + struct bt_private_stream_class *stream_class) { - struct bt_field_class *packet_context_type; - struct bt_field_class *event_header_type; - struct bt_field_class *fc; + struct bt_private_field_class *packet_context_type; + struct bt_private_field_class *event_header_type; + struct bt_private_field_class *fc; int ret; - packet_context_type = bt_field_class_structure_create(); + packet_context_type = bt_private_field_class_structure_create(); BT_ASSERT(packet_context_type); - fc = bt_field_class_unsigned_integer_create(); + fc = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(fc); - ret = bt_field_class_integer_set_field_value_range(fc, 32); + ret = bt_private_field_class_integer_set_field_value_range(fc, 32); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(packet_context_type, + ret = bt_private_field_class_structure_append_private_member(packet_context_type, "packet_size", fc); BT_ASSERT(ret == 0); bt_object_put_ref(fc); - fc = bt_field_class_unsigned_integer_create(); + fc = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(fc); - ret = bt_field_class_integer_set_field_value_range(fc, 32); + ret = bt_private_field_class_integer_set_field_value_range(fc, 32); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(packet_context_type, + ret = bt_private_field_class_structure_append_private_member(packet_context_type, "content_size", fc); BT_ASSERT(ret == 0); bt_object_put_ref(fc); - event_header_type = bt_field_class_structure_create(); + event_header_type = bt_private_field_class_structure_create(); BT_ASSERT(event_header_type); - fc = bt_field_class_unsigned_integer_create(); + fc = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(fc); - ret = bt_field_class_integer_set_field_value_range(fc, 32); + ret = bt_private_field_class_integer_set_field_value_range(fc, 32); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(event_header_type, + ret = bt_private_field_class_structure_append_private_member(event_header_type, "id", fc); BT_ASSERT(ret == 0); bt_object_put_ref(fc); - ret = bt_stream_class_set_packet_context_field_class(stream_class, - packet_context_type); + ret = bt_private_stream_class_set_packet_context_private_field_class( + stream_class, packet_context_type); BT_ASSERT(ret == 0); - ret = bt_stream_class_set_event_header_field_class(stream_class, - event_header_type); + ret = bt_private_stream_class_set_event_header_private_field_class( + stream_class, event_header_type); BT_ASSERT(ret == 0); bt_object_put_ref(packet_context_type); bt_object_put_ref(event_header_type); } -static void create_sc1(struct bt_trace *trace) +static void create_sc1(struct bt_private_trace *trace) { int ret; - struct bt_event_class *ec1 = NULL, *ec2 = NULL; - struct bt_stream_class *sc1 = NULL, *ret_stream = NULL; + struct bt_private_event_class *ec1 = NULL, *ec2 = NULL; + struct bt_private_stream_class *sc1 = NULL, *ret_stream = NULL; - sc1 = bt_stream_class_create(trace); + sc1 = bt_private_stream_class_create(trace); BT_ASSERT(sc1); - ret = bt_stream_class_set_name(sc1, "sc1"); + ret = bt_private_stream_class_set_name(sc1, "sc1"); BT_ASSERT(ret == 0); set_stream_class_field_classes(sc1); ec1 = create_complex_event(sc1, "ec1"); BT_ASSERT(ec1); ec2 = create_simple_event(sc1, "ec2"); BT_ASSERT(ec2); - ret_stream = bt_event_class_borrow_stream_class(ec1); + ret_stream = bt_private_event_class_borrow_private_stream_class(ec1); ok(ret_stream == sc1, "Borrow parent stream SC1 from EC1"); - ret_stream = bt_event_class_borrow_stream_class(ec2); + ret_stream = bt_private_event_class_borrow_private_stream_class(ec2); ok(ret_stream == sc1, "Borrow parent stream SC1 from EC2"); BT_OBJECT_PUT_REF_AND_RESET(ec1); BT_OBJECT_PUT_REF_AND_RESET(ec2); BT_OBJECT_PUT_REF_AND_RESET(sc1); } -static void create_sc2(struct bt_trace *trace) +static void create_sc2(struct bt_private_trace *trace) { int ret; - struct bt_event_class *ec3 = NULL; - struct bt_stream_class *sc2 = NULL, *ret_stream = NULL; + struct bt_private_event_class *ec3 = NULL; + struct bt_private_stream_class *sc2 = NULL, *ret_stream = NULL; - sc2 = bt_stream_class_create(trace); + sc2 = bt_private_stream_class_create(trace); BT_ASSERT(sc2); - ret = bt_stream_class_set_name(sc2, "sc2"); + ret = bt_private_stream_class_set_name(sc2, "sc2"); BT_ASSERT(ret == 0); set_stream_class_field_classes(sc2); ec3 = create_simple_event(sc2, "ec3"); - ret_stream = bt_event_class_borrow_stream_class(ec3); + ret_stream = bt_private_event_class_borrow_private_stream_class(ec3); ok(ret_stream == sc2, "Borrow parent stream SC2 from EC3"); BT_OBJECT_PUT_REF_AND_RESET(ec3); BT_OBJECT_PUT_REF_AND_RESET(sc2); } -static void set_trace_packet_header(struct bt_trace *trace) +static void set_trace_packet_header(struct bt_private_trace *trace) { - struct bt_field_class *packet_header_type; - struct bt_field_class *fc; + struct bt_private_field_class *packet_header_type; + struct bt_private_field_class *fc; int ret; - packet_header_type = bt_field_class_structure_create(); + packet_header_type = bt_private_field_class_structure_create(); BT_ASSERT(packet_header_type); - fc = bt_field_class_unsigned_integer_create(); + fc = bt_private_field_class_unsigned_integer_create(); BT_ASSERT(fc); - ret = bt_field_class_integer_set_field_value_range(fc, 32); + ret = bt_private_field_class_integer_set_field_value_range(fc, 32); BT_ASSERT(ret == 0); - ret = bt_field_class_structure_append_member(packet_header_type, + ret = bt_private_field_class_structure_append_private_member(packet_header_type, "stream_id", fc); BT_ASSERT(ret == 0); bt_object_put_ref(fc); - ret = bt_trace_set_packet_header_field_class(trace, + ret = bt_private_trace_set_packet_header_private_field_class(trace, packet_header_type); BT_ASSERT(ret == 0); bt_object_put_ref(packet_header_type); } -static struct bt_trace *create_tc1(void) +static struct bt_private_trace *create_tc1(void) { - struct bt_trace *tc1 = NULL; + struct bt_private_trace *tc1 = NULL; - tc1 = bt_trace_create(); + tc1 = bt_private_trace_create(); BT_ASSERT(tc1); set_trace_packet_header(tc1); create_sc1(tc1); @@ -325,20 +313,20 @@ static struct bt_trace *create_tc1(void) return tc1; } -static void init_weak_refs(struct bt_trace *tc, - struct bt_trace **tc1, - struct bt_stream_class **sc1, - struct bt_stream_class **sc2, - struct bt_event_class **ec1, - struct bt_event_class **ec2, - struct bt_event_class **ec3) +static void init_weak_refs(struct bt_private_trace *tc, + struct bt_private_trace **tc1, + struct bt_private_stream_class **sc1, + struct bt_private_stream_class **sc2, + struct bt_private_event_class **ec1, + struct bt_private_event_class **ec2, + struct bt_private_event_class **ec3) { *tc1 = tc; - *sc1 = bt_trace_borrow_stream_class_by_index(tc, 0); - *sc2 = bt_trace_borrow_stream_class_by_index(tc, 1); - *ec1 = bt_stream_class_borrow_event_class_by_index(*sc1, 0); - *ec2 = bt_stream_class_borrow_event_class_by_index(*sc1, 1); - *ec3 = bt_stream_class_borrow_event_class_by_index(*sc2, 0); + *sc1 = bt_private_trace_borrow_private_stream_class_by_index(tc, 0); + *sc2 = bt_private_trace_borrow_private_stream_class_by_index(tc, 1); + *ec1 = bt_private_stream_class_borrow_private_event_class_by_index(*sc1, 0); + *ec2 = bt_private_stream_class_borrow_private_event_class_by_index(*sc1, 1); + *ec3 = bt_private_stream_class_borrow_private_event_class_by_index(*sc2, 0); } static void test_example_scenario(void) @@ -350,9 +338,9 @@ static void test_example_scenario(void) * of expected reference counts without affecting them by taking * "real" references to the objects. */ - struct bt_trace *tc1 = NULL, *weak_tc1 = NULL; - struct bt_stream_class *weak_sc1 = NULL, *weak_sc2 = NULL; - struct bt_event_class *weak_ec1 = NULL, *weak_ec2 = NULL, + struct bt_private_trace *tc1 = NULL, *weak_tc1 = NULL; + struct bt_private_stream_class *weak_sc1 = NULL, *weak_sc2 = NULL; + struct bt_private_event_class *weak_ec1 = NULL, *weak_ec2 = NULL, *weak_ec3 = NULL; struct user user_a = { 0 }, user_b = { 0 }, user_c = { 0 }; @@ -379,7 +367,9 @@ static void test_example_scenario(void) "TC1 reference count is 1"); /* User A acquires a reference to SC2 from TC1. */ - user_a.sc = bt_object_get_ref(bt_trace_borrow_stream_class_by_index(user_a.tc, 1)); + user_a.sc = bt_object_get_ref( + bt_private_trace_borrow_private_stream_class_by_index( + user_a.tc, 1)); ok(user_a.sc, "User A acquires SC2 from TC1"); ok(bt_object_get_ref_count((void *) weak_tc1) == 2, "TC1 reference count is 2"); @@ -388,7 +378,8 @@ static void test_example_scenario(void) /* User A acquires a reference to EC3 from SC2. */ user_a.ec = bt_object_get_ref( - bt_stream_class_borrow_event_class_by_index(user_a.sc, 0)); + bt_private_stream_class_borrow_private_event_class_by_index( + user_a.sc, 0)); ok(user_a.ec, "User A acquires EC3 from SC2"); ok(bt_object_get_ref_count((void *) weak_tc1) == 2, "TC1 reference count is 2"); @@ -436,7 +427,8 @@ static void test_example_scenario(void) /* User C acquires a reference to EC1. */ diag("User C acquires a reference to EC1"); user_c.ec = bt_object_get_ref( - bt_stream_class_borrow_event_class_by_index(user_b.sc, 0)); + bt_private_stream_class_borrow_private_event_class_by_index( + user_b.sc, 0)); ok(bt_object_get_ref_count((void *) weak_ec1) == 1, "EC1 reference count is 1"); ok(bt_object_get_ref_count((void *) weak_sc1) == 2, -- 2.34.1