From 6cdbfd7a28f6e3ead89ccb4359fe4062c5f0a94c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 30 Aug 2016 00:21:15 -0400 Subject: [PATCH] Add notification utility library MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- configure.ac | 1 + .../notification/notification-internal.h | 2 +- .../plugin/notification/notification.h | 2 +- lib/plugin-system/Makefile.am | 2 ++ lib/plugin-system/notification/Makefile.am | 7 ++++ lib/plugin-system/notification/notification.c | 33 +++++++++++++++++++ 6 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 lib/plugin-system/notification/Makefile.am create mode 100644 lib/plugin-system/notification/notification.c diff --git a/configure.ac b/configure.ac index 01043fbd..5ad18a00 100644 --- a/configure.ac +++ b/configure.ac @@ -362,6 +362,7 @@ AC_CONFIG_FILES([ lib/Makefile lib/prio_heap/Makefile lib/plugin-system/Makefile + lib/plugin-system/notification/Makefile include/Makefile bindings/Makefile bindings/python/Makefile diff --git a/include/babeltrace/plugin/notification/notification-internal.h b/include/babeltrace/plugin/notification/notification-internal.h index a59d5035..2b5b291b 100644 --- a/include/babeltrace/plugin/notification/notification-internal.h +++ b/include/babeltrace/plugin/notification/notification-internal.h @@ -27,7 +27,7 @@ * SOFTWARE. */ -#include +#include #include #include #include diff --git a/include/babeltrace/plugin/notification/notification.h b/include/babeltrace/plugin/notification/notification.h index b8b87a44..487c737e 100644 --- a/include/babeltrace/plugin/notification/notification.h +++ b/include/babeltrace/plugin/notification/notification.h @@ -66,7 +66,7 @@ enum bt_notification_type { /** End of trace notification, see eot.h */ BT_NOTIFICATION_TYPE_END_OF_TRACE = 7, - BT_NOTIFICATION_TYPE_NR, + BT_NOTIFICATION_TYPE_NR, /* Not part of ABI. */ }; /** diff --git a/lib/plugin-system/Makefile.am b/lib/plugin-system/Makefile.am index 9fa9d933..e3f9614e 100644 --- a/lib/plugin-system/Makefile.am +++ b/lib/plugin-system/Makefile.am @@ -1,5 +1,7 @@ AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include +SUBDIRS = notification + noinst_LTLIBRARIES = libplugin-system.la # Plug-in system library diff --git a/lib/plugin-system/notification/Makefile.am b/lib/plugin-system/notification/Makefile.am new file mode 100644 index 00000000..255659a1 --- /dev/null +++ b/lib/plugin-system/notification/Makefile.am @@ -0,0 +1,7 @@ +AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include + +noinst_LTLIBRARIES = libplugin-system-notification.la + +# Plug-in system library +libplugin_system_notification_la_SOURCES = \ + notification.c diff --git a/lib/plugin-system/notification/notification.c b/lib/plugin-system/notification/notification.c new file mode 100644 index 00000000..a8bb0882 --- /dev/null +++ b/lib/plugin-system/notification/notification.c @@ -0,0 +1,33 @@ +/* + * Babeltrace Plug-in Notification + * + * 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 + +enum bt_notification_type bt_notification_get_type( + struct bt_notification *notification) +{ + return notification ? notification->type : BT_NOTIFICATION_TYPE_UNKNOWN; +} -- 2.34.1