From: Philippe Proulx Date: Thu, 24 Aug 2017 20:40:55 +0000 (-0400) Subject: Remove notification iterator seeking API until it's supported X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=3bfc4183e4026c21bad8c817125b1f6d31d6d89d Remove notification iterator seeking API until it's supported Remove everything related to seeking a notification iterator until the actual seeking operation is supported by the library. This ensures that Babeltrace 2.0 plugins (including third-party ones) do not have seeking methods until we are sure about the correct API. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/graph/component-class-filter.h b/include/babeltrace/graph/component-class-filter.h index 9c1ee942..aa9b6c0b 100644 --- a/include/babeltrace/graph/component-class-filter.h +++ b/include/babeltrace/graph/component-class-filter.h @@ -47,11 +47,6 @@ int bt_component_class_filter_set_notification_iterator_finalize_method( struct bt_component_class *component_class, bt_component_class_notification_iterator_finalize_method notification_iterator_finalize_method); -extern -int bt_component_class_filter_set_notification_iterator_seek_time_method( - struct bt_component_class *component_class, - bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method); - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/graph/component-class-internal.h b/include/babeltrace/graph/component-class-internal.h index 02671eaf..95ec9706 100644 --- a/include/babeltrace/graph/component-class-internal.h +++ b/include/babeltrace/graph/component-class-internal.h @@ -75,7 +75,6 @@ struct bt_component_class_iterator_methods { bt_component_class_notification_iterator_init_method init; bt_component_class_notification_iterator_finalize_method finalize; bt_component_class_notification_iterator_next_method next; - bt_component_class_notification_iterator_seek_time_method seek_time; }; struct bt_component_class_source { diff --git a/include/babeltrace/graph/component-class-source.h b/include/babeltrace/graph/component-class-source.h index ebb6593a..c89b44bc 100644 --- a/include/babeltrace/graph/component-class-source.h +++ b/include/babeltrace/graph/component-class-source.h @@ -47,11 +47,6 @@ int bt_component_class_source_set_notification_iterator_finalize_method( struct bt_component_class *component_class, bt_component_class_notification_iterator_finalize_method notification_iterator_finalize_method); -extern -int bt_component_class_source_set_notification_iterator_seek_time_method( - struct bt_component_class *component_class, - bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method); - #ifdef __cplusplus } #endif diff --git a/include/babeltrace/graph/component-class.h b/include/babeltrace/graph/component-class.h index 466bd549..19f50876 100644 --- a/include/babeltrace/graph/component-class.h +++ b/include/babeltrace/graph/component-class.h @@ -88,11 +88,6 @@ typedef void (*bt_component_class_notification_iterator_finalize_method)( typedef struct bt_notification_iterator_next_return (*bt_component_class_notification_iterator_next_method)( struct bt_private_notification_iterator *private_notification_iterator); -typedef enum bt_notification_iterator_status - (*bt_component_class_notification_iterator_seek_time_method)( - struct bt_private_notification_iterator *private_notification_iterator, - int64_t time); - typedef struct bt_component_class_query_return (*bt_component_class_query_method)( struct bt_component_class *component_class, struct bt_query_executor *query_executor, diff --git a/include/babeltrace/graph/notification-iterator.h b/include/babeltrace/graph/notification-iterator.h index 03b84d97..29d787a9 100644 --- a/include/babeltrace/graph/notification-iterator.h +++ b/include/babeltrace/graph/notification-iterator.h @@ -2,7 +2,7 @@ #define BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_H /* - * BabelTrace - Plug-in Notification Iterator + * BabelTrace - Notification Iterator * * Copyright 2015 Jérémie Galarneau * @@ -58,23 +58,6 @@ enum bt_notification_iterator_status { BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED = -2, }; -/** - * Notification iterator seek reference. - */ -enum bt_notification_iterator_seek_origin { - /** Seek at a time relative to the beginning of the trace. */ - BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_BEGIN = 0, - - /** Seek at a time relative to the current position. */ - BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_CURRENT = 1, - - /** Seek at a time relative to the end of the trace. */ - BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_END = 2, - - /** Seek at a time relative to EPOCH. */ - BT_NOTIFICATION_ITERATOR_SEEK_ORIGIN_EPOCH = 3, -}; - /** * Get current notification at iterator's position. * @@ -103,29 +86,6 @@ extern struct bt_notification *bt_notification_iterator_get_notification( extern enum bt_notification_iterator_status bt_notification_iterator_next(struct bt_notification_iterator *iterator); -/** - * Seek iterator to time. - * - * Sets the iterator's position for the trace associated with the iterator. - * The new position is computed by adding \p time to the position specified - * by \p seek_origin. - * - * time is expressed in nanoseconds. - * - * @param iterator Iterator instance - * @param seek_origin One of #bt_notification_iterator_seek_type values. - * @returns One of #bt_notification_iterator_status values; - * if \iterator does not support seeking, - * #BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED is - * returned. - * - * @see bt_notification_iterator_get_notification() - */ -extern enum bt_notification_iterator_status bt_notification_iterator_seek_time( - struct bt_notification_iterator *iterator, - enum bt_notification_iterator_seek_origin seek_origin, - int64_t time); - extern struct bt_component *bt_notification_iterator_get_component( struct bt_notification_iterator *iterator); diff --git a/include/babeltrace/plugin/plugin-dev.h b/include/babeltrace/plugin/plugin-dev.h index 40f46348..f99dca02 100644 --- a/include/babeltrace/plugin/plugin-dev.h +++ b/include/babeltrace/plugin/plugin-dev.h @@ -183,7 +183,6 @@ enum __bt_plugin_component_class_descriptor_attribute_type { BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_PORT_DISCONNECTED_METHOD = 8, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD = 9, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD = 10, - BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD = 11, }; /* Component class attribute (internal use) */ @@ -231,9 +230,6 @@ struct __bt_plugin_component_class_descriptor_attribute { /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD */ bt_component_class_notification_iterator_finalize_method notif_iter_finalize_method; - - /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD */ - bt_component_class_notification_iterator_seek_time_method notif_iter_seek_time_method; } value; } __attribute__((packed)); @@ -870,18 +866,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD, _id, _comp_class_id, source, _x) -/* - * Defines an iterator seek time method attribute attached to a specific - * source component class descriptor. - * - * _id: Plugin descriptor ID (C identifier). - * _comp_class_id: Component class descriptor ID (C identifier). - * _x: Iterator seek time method - * (bt_component_class_notification_iterator_seek_time_method). - */ -#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \ - __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, source, _x) - /* * Defines an iterator initialization method attribute attached to a * specific filter component class descriptor. @@ -906,18 +890,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(_id, _comp_class_id, _x) \ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_finalize_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_FINALIZE_METHOD, _id, _comp_class_id, filter, _x) -/* - * Defines an iterator seek time method attribute attached to a specific - * filter component class descriptor. - * - * _id: Plugin descriptor ID (C identifier). - * _comp_class_id: Component class descriptor ID (C identifier). - * _x: Iterator seek time method - * (bt_component_class_notification_iterator_seek_time_method). - */ -#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \ - __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, filter, _x) - /* * Defines a plugin descriptor with an automatic ID. * @@ -1296,18 +1268,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(_name, _x) \ BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x) -/* - * Defines an iterator seek time method attribute attached to a source - * component class descriptor which is attached to the automatic plugin - * descriptor. - * - * _name: Component class name (C identifier). - * _x: Iterator seek time method - * (bt_component_class_notification_iterator_seek_time_method). - */ -#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \ - BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x) - /* * Defines an iterator initialization method attribute attached to a * filter component class descriptor which is attached to the automatic @@ -1332,18 +1292,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ #define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(_name, _x) \ BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD_WITH_ID(auto, _name, _x) -/* - * Defines an iterator seek time method attribute attached to a filter - * component class descriptor which is attached to the automatic plugin - * descriptor. - * - * _name: Component class name (C identifier). - * _x: Iterator seek time method - * (bt_component_class_notification_iterator_seek_time_method). - */ -#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \ - BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x) - #define BT_PLUGIN_MODULE() \ static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_dummy __BT_PLUGIN_DESCRIPTOR_ATTRS = NULL; \ _BT_HIDDEN extern struct __bt_plugin_descriptor const *__BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL __BT_PLUGIN_DESCRIPTOR_BEGIN_EXTRA; \ diff --git a/lib/graph/component-class.c b/lib/graph/component-class.c index 53435750..997b3937 100644 --- a/lib/graph/component-class.c +++ b/lib/graph/component-class.c @@ -606,59 +606,6 @@ end: return ret; } -int bt_component_class_source_set_notification_iterator_seek_time_method( - struct bt_component_class *component_class, - bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method) -{ - struct bt_component_class_source *source_class; - int ret = 0; - - if (!component_class) { - BT_LOGW_STR("Invalid parameter: component class is NULL."); - ret = -1; - goto end; - } - - if (!notification_iterator_seek_time_method) { - BT_LOGW_STR("Invalid parameter: method is NULL."); - ret = -1; - goto end; - } - - if (component_class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) { - BT_LOGW("Invalid parameter: component class is not a source component class: " - "addr=%p, name=\"%s\", type=%s", - component_class, - bt_component_class_get_name(component_class), - bt_component_class_type_string(component_class->type)); - ret = -1; - goto end; - } - - if (component_class->frozen) { - BT_LOGW("Invalid parameter: component class is frozen: " - "addr=%p, name=\"%s\", type=%s", - component_class, - bt_component_class_get_name(component_class), - bt_component_class_type_string(component_class->type)); - ret = -1; - goto end; - } - - source_class = container_of(component_class, - struct bt_component_class_source, parent); - source_class->methods.iterator.seek_time = - notification_iterator_seek_time_method; - BT_LOGV("Set source component class's notification iterator seek time method: " - "addr=%p, name=\"%s\", method-addr=%p", - component_class, - bt_component_class_get_name(component_class), - notification_iterator_seek_time_method); - -end: - return ret; -} - int bt_component_class_filter_set_notification_iterator_init_method( struct bt_component_class *component_class, bt_component_class_notification_iterator_init_method notification_iterator_init_method) @@ -764,59 +711,6 @@ end: return ret; } -int bt_component_class_filter_set_notification_iterator_seek_time_method( - struct bt_component_class *component_class, - bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method) -{ - struct bt_component_class_filter *filter_class; - int ret = 0; - - if (!component_class) { - BT_LOGW_STR("Invalid parameter: component class is NULL."); - ret = -1; - goto end; - } - - if (!notification_iterator_seek_time_method) { - BT_LOGW_STR("Invalid parameter: method is NULL."); - ret = -1; - goto end; - } - - if (component_class->type != BT_COMPONENT_CLASS_TYPE_FILTER) { - BT_LOGW("Invalid parameter: component class is not a filter component class: " - "addr=%p, name=\"%s\", type=%s", - component_class, - bt_component_class_get_name(component_class), - bt_component_class_type_string(component_class->type)); - ret = -1; - goto end; - } - - if (component_class->frozen) { - BT_LOGW("Invalid parameter: component class is frozen: " - "addr=%p, name=\"%s\", type=%s", - component_class, - bt_component_class_get_name(component_class), - bt_component_class_type_string(component_class->type)); - ret = -1; - goto end; - } - - filter_class = container_of(component_class, - struct bt_component_class_filter, parent); - filter_class->methods.iterator.seek_time = - notification_iterator_seek_time_method; - BT_LOGV("Set filter component class's notification iterator seek time method: " - "addr=%p, name=\"%s\", method-addr=%p", - component_class, - bt_component_class_get_name(component_class), - notification_iterator_seek_time_method); - -end: - return ret; -} - int bt_component_class_set_description( struct bt_component_class *component_class, const char *description) diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index f5dd6d70..1f1f0cdd 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -2252,13 +2252,3 @@ bt_private_notification_iterator_get_private_component( bt_notification_iterator_get_component( bt_notification_iterator_from_private(private_iterator))); } - -enum bt_notification_iterator_status bt_notification_iterator_seek_time( - struct bt_notification_iterator *iterator, - enum bt_notification_iterator_seek_origin seek_origin, - int64_t time) -{ - enum bt_notification_iterator_status ret = - BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED; - return ret; -} diff --git a/lib/plugin/plugin-so.c b/lib/plugin/plugin-so.c index c656a35e..1d0425ba 100644 --- a/lib/plugin/plugin-so.c +++ b/lib/plugin/plugin-so.c @@ -466,10 +466,6 @@ enum bt_plugin_status bt_plugin_so_init( cc_full_descr->iterator_methods.finalize = cur_cc_descr_attr->value.notif_iter_finalize_method; break; - case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD: - cc_full_descr->iterator_methods.seek_time = - cur_cc_descr_attr->value.notif_iter_seek_time_method; - break; default: /* * WARN-level logging because @@ -690,18 +686,6 @@ enum bt_plugin_status bt_plugin_so_init( goto end; } } - - if (cc_full_descr->iterator_methods.seek_time) { - ret = bt_component_class_source_set_notification_iterator_seek_time_method( - comp_class, - cc_full_descr->iterator_methods.seek_time); - if (ret) { - BT_LOGE_STR("Cannot set source component class's notification iterator seek to time method."); - status = BT_PLUGIN_STATUS_ERROR; - BT_PUT(comp_class); - goto end; - } - } break; case BT_COMPONENT_CLASS_TYPE_FILTER: if (cc_full_descr->iterator_methods.init) { @@ -727,18 +711,6 @@ enum bt_plugin_status bt_plugin_so_init( goto end; } } - - if (cc_full_descr->iterator_methods.seek_time) { - ret = bt_component_class_filter_set_notification_iterator_seek_time_method( - comp_class, - cc_full_descr->iterator_methods.seek_time); - if (ret) { - BT_LOGE_STR("Cannot set filter component class's notification iterator seek to time method."); - status = BT_PLUGIN_STATUS_ERROR; - BT_PUT(comp_class); - goto end; - } - } break; case BT_COMPONENT_CLASS_TYPE_SINK: break; diff --git a/plugins/utils/plugin.c b/plugins/utils/plugin.c index be39891b..e28dd66b 100644 --- a/plugins/utils/plugin.c +++ b/plugins/utils/plugin.c @@ -64,8 +64,6 @@ BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(trimmer, trimmer_iterator_init); BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(trimmer, trimmer_iterator_finalize); -BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(trimmer, - trimmer_iterator_seek_time); /* flt.utils.muxer */ BT_PLUGIN_FILTER_COMPONENT_CLASS(muxer, muxer_notif_iter_next); diff --git a/plugins/utils/trimmer/iterator.c b/plugins/utils/trimmer/iterator.c index fd0ef2a5..d8d8b0c6 100644 --- a/plugins/utils/trimmer/iterator.c +++ b/plugins/utils/trimmer/iterator.c @@ -635,11 +635,3 @@ end: bt_put(component); return ret; } - -BT_HIDDEN -enum bt_notification_iterator_status trimmer_iterator_seek_time( - struct bt_private_notification_iterator *iterator, - int64_t time) -{ - return BT_NOTIFICATION_ITERATOR_STATUS_OK; -} diff --git a/plugins/utils/trimmer/iterator.h b/plugins/utils/trimmer/iterator.h index 3b35dbd4..dc0dcccb 100644 --- a/plugins/utils/trimmer/iterator.h +++ b/plugins/utils/trimmer/iterator.h @@ -54,9 +54,4 @@ BT_HIDDEN struct bt_notification_iterator_next_return trimmer_iterator_next( struct bt_private_notification_iterator *iterator); -BT_HIDDEN -enum bt_notification_iterator_status trimmer_iterator_seek_time( - struct bt_private_notification_iterator *iterator, - int64_t time); - #endif /* BABELTRACE_PLUGIN_TRIMMER_ITERATOR_H */ diff --git a/tests/lib/test-plugin-plugins/sfs.c b/tests/lib/test-plugin-plugins/sfs.c index b66baead..d70fbc92 100644 --- a/tests/lib/test-plugin-plugins/sfs.c +++ b/tests/lib/test-plugin-plugins/sfs.c @@ -50,13 +50,6 @@ static struct bt_notification_iterator_next_return dummy_iterator_next_method( return next_return; } -static enum bt_notification_iterator_status dummy_iterator_seek_time_method( - struct bt_private_notification_iterator *private_iterator, - int64_t time) -{ - return BT_NOTIFICATION_ITERATOR_STATUS_OK; -} - static struct bt_component_class_query_return query_method( struct bt_component_class *component_class, struct bt_query_executor *query_exec, @@ -89,8 +82,6 @@ BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(source, dummy_iterator_init_method); BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(source, dummy_iterator_finalize_method); -BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(source, - dummy_iterator_seek_time_method); BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume); BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink."); @@ -107,6 +98,4 @@ BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(filter, dummy_iterator_init_method); BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_FINALIZE_METHOD(filter, dummy_iterator_finalize_method); -BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(filter, - dummy_iterator_seek_time_method); BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD(filter, query_method);