From: Jérémie Galarneau Date: Thu, 21 May 2015 21:13:44 +0000 (-0400) Subject: Implement ctf text output plug-in stub X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=5dac767adc60ba7690207ebd3220e9b0837527f5;p=deliverable%2Fbabeltrace.git Implement ctf text output plug-in stub Signed-off-by: Jérémie Galarneau --- diff --git a/configure.ac b/configure.ac index 30147db1c..6acf1deb6 100644 --- a/configure.ac +++ b/configure.ac @@ -371,7 +371,8 @@ AC_CONFIG_FILES([ extras/valgrind/Makefile plugins/Makefile plugins/ctf/Makefile - plugins/ctf/ctf-reader/Makefile + plugins/ctf/reader/Makefile + plugins/ctf/text/Makefile babeltrace.pc babeltrace-ctf.pc ]) diff --git a/include/babeltrace/plugin/plugin-system.h b/include/babeltrace/plugin/plugin-system.h index fea024fdd..e66e1aba0 100644 --- a/include/babeltrace/plugin/plugin-system.h +++ b/include/babeltrace/plugin/plugin-system.h @@ -60,12 +60,10 @@ typedef struct bt_notification_iterator *( * * @param plugin Plug-in instance * @param notificattion Notification to handle + * @returns One of #bt_plugin_status values */ -typedef int (*bt_plugin_sink_handle_notification_cb)(struct bt_plugin *, - struct bt_notification *); - -typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)( - struct bt_notification_iterator *); +typedef enum bt_plugin_status (*bt_plugin_sink_handle_notification_cb)( + struct bt_plugin *, struct bt_notification *); typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)( struct bt_notification_iterator *); diff --git a/plugins/ctf/ctf-live/live.c b/plugins/ctf/ctf-live/live.c deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/ctf/ctf-reader/reader-internal.h b/plugins/ctf/ctf-reader/reader-internal.h deleted file mode 100644 index cab8edb2b..000000000 --- a/plugins/ctf/ctf-reader/reader-internal.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H -#define BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H - -/* - * BabelTrace - CTF Reader plug-in internal - * - * Copyright 2015 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 - - - -#ifdef __cplusplus -} -#endif - -#endif /* BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H */ diff --git a/plugins/ctf/ctf-reader/reader.c b/plugins/ctf/ctf-reader/reader.c deleted file mode 100644 index 5802b8b05..000000000 --- a/plugins/ctf/ctf-reader/reader.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * reader.c - * - * Babeltrace CTF Reader Plugin - * - * Copyright 2015 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 -#include -#include -#include -#include - -const char *plugin_name = "ctf"; - -struct ctf_reader { - int a; -}; - -enum bt_plugin_type bt_plugin_lib_get_type(void) -{ - return BT_PLUGIN_TYPE_SOURCE; -} - -const char *bt_plugin_lib_get_format_name(void) -{ - return plugin_name; -} - -static -void ctf_reader_destroy(struct bt_plugin *plugin) -{ - struct ctf_reader *reader; - - if (!plugin) { - return; - } - - reader = bt_plugin_get_private_data(plugin); - if (!reader) { - return; - } - - g_free(reader); -} - -static -struct bt_notification_iterator *ctf_reader_iterator_create( - struct bt_plugin *plugin) -{ - return NULL; -} - -struct bt_plugin *bt_plugin_lib_create(struct bt_object *params) -{ - struct bt_plugin *plugin = NULL; - struct ctf_reader *reader = g_new0(struct ctf_reader, 1); - - plugin = bt_plugin_source_create(plugin_name, reader, - ctf_reader_destroy, ctf_reader_iterator_create); - if (!plugin) { - goto error; - } - -end: - return plugin; -error: - if (reader) { - g_free(reader); - } - goto end; -} diff --git a/plugins/ctf/ctf-text/text.c b/plugins/ctf/ctf-text/text.c deleted file mode 100644 index e69de29bb..000000000 diff --git a/plugins/ctf/live/live.c b/plugins/ctf/live/live.c new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/ctf/reader/reader-internal.h b/plugins/ctf/reader/reader-internal.h new file mode 100644 index 000000000..cab8edb2b --- /dev/null +++ b/plugins/ctf/reader/reader-internal.h @@ -0,0 +1,40 @@ +#ifndef BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H +#define BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H + +/* + * BabelTrace - CTF Reader plug-in internal + * + * Copyright 2015 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 + + + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H */ diff --git a/plugins/ctf/reader/reader.c b/plugins/ctf/reader/reader.c new file mode 100644 index 000000000..5802b8b05 --- /dev/null +++ b/plugins/ctf/reader/reader.c @@ -0,0 +1,93 @@ +/* + * reader.c + * + * Babeltrace CTF Reader Plugin + * + * Copyright 2015 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 +#include +#include +#include +#include + +const char *plugin_name = "ctf"; + +struct ctf_reader { + int a; +}; + +enum bt_plugin_type bt_plugin_lib_get_type(void) +{ + return BT_PLUGIN_TYPE_SOURCE; +} + +const char *bt_plugin_lib_get_format_name(void) +{ + return plugin_name; +} + +static +void ctf_reader_destroy(struct bt_plugin *plugin) +{ + struct ctf_reader *reader; + + if (!plugin) { + return; + } + + reader = bt_plugin_get_private_data(plugin); + if (!reader) { + return; + } + + g_free(reader); +} + +static +struct bt_notification_iterator *ctf_reader_iterator_create( + struct bt_plugin *plugin) +{ + return NULL; +} + +struct bt_plugin *bt_plugin_lib_create(struct bt_object *params) +{ + struct bt_plugin *plugin = NULL; + struct ctf_reader *reader = g_new0(struct ctf_reader, 1); + + plugin = bt_plugin_source_create(plugin_name, reader, + ctf_reader_destroy, ctf_reader_iterator_create); + if (!plugin) { + goto error; + } + +end: + return plugin; +error: + if (reader) { + g_free(reader); + } + goto end; +} diff --git a/plugins/ctf/text/text.c b/plugins/ctf/text/text.c new file mode 100644 index 000000000..60997526c --- /dev/null +++ b/plugins/ctf/text/text.c @@ -0,0 +1,94 @@ +/* + * text.c + * + * Babeltrace CTF Text Output Plugin + * + * Copyright 2015 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 +#include +#include +#include +#include +#include + +const char *plugin_name = "ctf-text"; + +struct ctf_text { + int a; +}; + +static +void ctf_text_destroy(struct bt_plugin *plugin) +{ + struct ctf_text *text; + + if (!plugin) { + return; + } + + text = bt_plugin_get_private_data(plugin); + if (!text) { + return; + } + + g_free(text); +} + +static +int ctf_text_handle_notification(struct bt_plugin *plugin, + struct bt_notification *notification) +{ + return BT_PLUGIN_STATUS_OK; +} + +enum bt_plugin_type bt_plugin_lib_get_type(void) +{ + return BT_PLUGIN_TYPE_SINK; +} + +const char *bt_plugin_lib_get_format_name(void) +{ + return plugin_name; +} + +struct bt_plugin *bt_plugin_lib_create(struct bt_object *params) +{ + struct bt_plugin *plugin = NULL; + struct ctf_text *text = g_new0(struct ctf_text, 1); + + plugin = bt_plugin_sink_create(plugin_name, text, + ctf_text_destroy, ctf_text_handle_notification); + if (!plugin) { + goto error; + } + +end: + return plugin; +error: + if (text) { + g_free(text); + } + goto end; +}