* [PATCH BlueZ v4 0/8] Remove support for external plugins
@ 2024-01-29 14:44 Emil Velikov via B4 Relay
2024-01-29 14:44 ` [PATCH BlueZ v4 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Emil Velikov
Hello everyone,
With v4 we have moved from pre-processor to compilation checking for the
external plugins support.
Namely, as we build without one the dead-code elimination will discard
all the relevant code. Ultimately this means we compile check both paths
in order to catch mistakes. Thanks to Luiz for the suggestion.
Link to the previous revision can be found below.
Thanks
Emil
- Link to v3: https://lore.kernel.org/r/20240125-rm-ext-plugins-v3-0-d141f7870bb6@gmail.com
---
Emil Velikov (8):
configure, README: introduce --enable-external-plugins
obexd: factor out external plugin support
bluetoothd: remove external-dummy plugin
bluetoothd: convert external sixaxis plugin to builtin
bluetoothd: factor out external plugin support
bluetoothd: don't export internal API
bluetoothd: change plugin loading alike obexd
android: export only (android) entrypoint from the modules
Makefile.am | 17 ++----
Makefile.obexd | 2 +
Makefile.plugins | 8 ++-
README | 13 +++++
android/Makefile.am | 3 ++
android/hal-audio.c | 1 +
android/hal-bluetooth.c | 1 +
android/hal-sco.c | 1 +
configure.ac | 10 ++++
obexd/src/obexd.h | 2 +-
obexd/src/plugin.c | 89 ++++++++++++++++++++-----------
obexd/src/plugin.h | 4 ++
plugins/external-dummy.c | 28 ----------
src/btd.h | 2 +-
src/plugin.c | 135 ++++++++++++++++++++++++++++-------------------
src/plugin.h | 4 ++
16 files changed, 188 insertions(+), 132 deletions(-)
---
base-commit: 0de32f67f685b95c35a5c2f1206081af89bd88b6
change-id: 20240116-rm-ext-plugins-ba0b852a492b
Best regards,
--
Emil Velikov <emil.l.velikov@gmail.com>
^ permalink raw reply [flat|nested] 18+ messages in thread* [PATCH BlueZ v4 1/8] configure, README: introduce --enable-external-plugins 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 17:27 ` Remove support for external plugins bluez.test.bot 2024-01-29 14:44 ` [PATCH BlueZ v4 2/8] obexd: factor out external plugin support Emil Velikov via B4 Relay ` (7 subsequent siblings) 8 siblings, 1 reply; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> As the README chunk says, disabled by default, since they rely on internal API/ABI and can break at any point. Instead everyone affected should work and upstream their plugin into the bluez project. --- README | 13 +++++++++++++ configure.ac | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/README b/README index 7de7045a8..6c0777046 100644 --- a/README +++ b/README @@ -249,6 +249,19 @@ For a working system, certain configuration options need to be enabled: systems. The behavior of the deprecated tools may be unstable or simply don't work anymore. + --enable-external-plugins + + Enable support for external plugins + + By default external plugins for bluetoothd and obexd are not + supported and thus disabled. + + External plugins require access to internal, undocumented and + unversioned API in said daemons. As such they can break at any + time. If you have such plugins, enable this option and work + actively with the community to make said plugin part of the + upstream bluez project. + --enable-nfc This option enable NFC pairing support. diff --git a/configure.ac b/configure.ac index b4d362494..5eb7ee0e0 100644 --- a/configure.ac +++ b/configure.ac @@ -364,6 +364,16 @@ AC_ARG_ENABLE(deprecated, AS_HELP_STRING([--enable-deprecated], [enable_deprecated=${enableval}]) AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes") +AC_ARG_ENABLE(external-plugsin, AS_HELP_STRING([--enable-external-plugins], + [enable support for external plugins]), + [enable_external_plugins=${enableval}]) +AM_CONDITIONAL(EXTERNAL_PLUGINS, test "${enable_external_plugins}" = "yes") +if (test "${enable_external_plugins}" = "yes"); then + AC_DEFINE(EXTERNAL_PLUGINS, 1, [Define if external plugin support is required]) +else + AC_DEFINE(EXTERNAL_PLUGINS, 0, [Define if external plugin support is required]) +fi + AC_ARG_ENABLE(sixaxis, AS_HELP_STRING([--enable-sixaxis], [enable sixaxis plugin]), [enable_sixaxis=${enableval}]) AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" && -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* RE: Remove support for external plugins 2024-01-29 14:44 ` [PATCH BlueZ v4 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay @ 2024-01-29 17:27 ` bluez.test.bot 0 siblings, 0 replies; 18+ messages in thread From: bluez.test.bot @ 2024-01-29 17:27 UTC (permalink / raw) To: linux-bluetooth, devnull+emil.l.velikov.gmail.com [-- Attachment #1: Type: text/plain, Size: 3964 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=820935 ---Test result--- Test Summary: CheckPatch FAIL 3.64 seconds GitLint PASS 2.33 seconds BuildEll PASS 24.08 seconds BluezMake PASS 732.29 seconds MakeCheck PASS 13.76 seconds MakeDistcheck PASS 164.26 seconds CheckValgrind PASS 226.32 seconds CheckSmatch PASS 329.54 seconds bluezmakeextell PASS 107.29 seconds IncrementalBuild PASS 5502.72 seconds ScanBuild PASS 928.77 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v4,2/8] obexd: factor out external plugin support WARNING:IS_ENABLED_CONFIG: IS_ENABLED(x) is normally used as IS_ENABLED(CONFIG_x) #127: FILE: obexd/src/plugin.c:37: +#define IS_ENABLED(x) (x) WARNING:IS_ENABLED_CONFIG: IS_ENABLED(EXTERNAL_PLUGINS) is normally used as IS_ENABLED(CONFIG_EXTERNAL_PLUGINS) #253: FILE: obexd/src/plugin.c:200: + if IS_ENABLED(EXTERNAL_PLUGINS) /github/workspace/src/src/13535810.patch total: 0 errors, 2 warnings, 166 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13535810.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v4,5/8] bluetoothd: factor out external plugin support WARNING:IS_ENABLED_CONFIG: IS_ENABLED(x) is normally used as IS_ENABLED(CONFIG_x) #127: FILE: src/plugin.c:29: +#define IS_ENABLED(x) (x) WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #239: FILE: src/plugin.c:186: + * plugins are loaded. */ WARNING:IS_ENABLED_CONFIG: IS_ENABLED(EXTERNAL_PLUGINS) is normally used as IS_ENABLED(CONFIG_EXTERNAL_PLUGINS) #258: FILE: src/plugin.c:205: + if IS_ENABLED(EXTERNAL_PLUGINS) /github/workspace/src/src/13535813.patch total: 0 errors, 3 warnings, 178 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13535813.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v4,7/8] bluetoothd: change plugin loading alike obexd WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else #108: FILE: src/plugin.c:52: + if (err == -ENOSYS || err == -ENOTSUP) /github/workspace/src/src/13535815.patch total: 0 errors, 1 warnings, 106 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13535815.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 2/8] obexd: factor out external plugin support 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 3/8] bluetoothd: remove external-dummy plugin Emil Velikov via B4 Relay ` (6 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> As a whole all plugins should be built-in, otherwise they would be using internal, undocumented, unversioned, unstable API. Flesh out the external plugin support into a few blocks and simplify the normal path. Guard the external plugin support behind a runtime check, which will be dead-code eliminated in the default case. Hide the internal API (omit export-dynamic) when built without external plugins. --- Makefile.obexd | 2 ++ obexd/src/obexd.h | 2 +- obexd/src/plugin.c | 89 ++++++++++++++++++++++++++++++++++++------------------ obexd/src/plugin.h | 4 +++ 4 files changed, 66 insertions(+), 31 deletions(-) diff --git a/Makefile.obexd b/Makefile.obexd index 363295d0e..0e50b1fa4 100644 --- a/Makefile.obexd +++ b/Makefile.obexd @@ -92,7 +92,9 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \ $(ICAL_LIBS) $(DBUS_LIBS) $(LIBEBOOK_LIBS) \ $(LIBEDATASERVER_LIBS) $(GLIB_LIBS) -ldl +if EXTERNAL_PLUGINS obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic +endif obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \ $(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \ diff --git a/obexd/src/obexd.h b/obexd/src/obexd.h index fe312a65b..af5265da5 100644 --- a/obexd/src/obexd.h +++ b/obexd/src/obexd.h @@ -18,7 +18,7 @@ #define OBEX_MAS (1 << 8) #define OBEX_MNS (1 << 9) -gboolean plugin_init(const char *pattern, const char *exclude); +void plugin_init(const char *pattern, const char *exclude); void plugin_cleanup(void); gboolean manager_init(void); diff --git a/obexd/src/plugin.c b/obexd/src/plugin.c index a3eb24753..14327782d 100644 --- a/obexd/src/plugin.c +++ b/obexd/src/plugin.c @@ -34,6 +34,8 @@ #define PLUGINFLAG (RTLD_NOW) #endif +#define IS_ENABLED(x) (x) + static GSList *plugins = NULL; struct obex_plugin { @@ -41,7 +43,8 @@ struct obex_plugin { const struct obex_plugin_desc *desc; }; -static gboolean add_plugin(void *handle, const struct obex_plugin_desc *desc) +static gboolean add_external_plugin(void *handle, + const struct obex_plugin_desc *desc) { struct obex_plugin *plugin; @@ -66,6 +69,25 @@ static gboolean add_plugin(void *handle, const struct obex_plugin_desc *desc) return TRUE; } +static void add_plugin(const struct obex_plugin_desc *desc) +{ + struct obex_plugin *plugin; + + plugin = g_try_new0(struct obex_plugin, 1); + if (plugin == NULL) + return; + + plugin->desc = desc; + + if (desc->init() < 0) { + g_free(plugin); + return; + } + + plugins = g_slist_append(plugins, plugin); + DBG("Plugin %s loaded", desc->name); +} + static gboolean check_plugin(const struct obex_plugin_desc *desc, char **patterns, char **excludes) { @@ -93,42 +115,22 @@ static gboolean check_plugin(const struct obex_plugin_desc *desc, } -#include "builtin.h" - -gboolean plugin_init(const char *pattern, const char *exclude) +static void external_plugin_init(char **patterns, char **excludes) { - char **patterns = NULL; - char **excludes = NULL; GDir *dir; const char *file; - unsigned int i; - if (strlen(PLUGINDIR) == 0) - return FALSE; + info("Using external plugins is not officially supported.\n"); + info("Consider upstreaming your plugins into the BlueZ project."); - if (pattern) - patterns = g_strsplit_set(pattern, ":, ", -1); - - if (exclude) - excludes = g_strsplit_set(exclude, ":, ", -1); - - DBG("Loading builtin plugins"); - - for (i = 0; __obex_builtin[i]; i++) { - if (check_plugin(__obex_builtin[i], - patterns, excludes) == FALSE) - continue; - - add_plugin(NULL, __obex_builtin[i]); - } + if (strlen(PLUGINDIR) == 0) + return; DBG("Loading plugins %s", PLUGINDIR); dir = g_dir_open(PLUGINDIR, 0, NULL); if (!dir) { - g_strfreev(patterns); - g_strfreev(excludes); - return FALSE; + return; } while ((file = g_dir_read_name(dir)) != NULL) { @@ -164,15 +166,42 @@ gboolean plugin_init(const char *pattern, const char *exclude) continue; } - if (add_plugin(handle, desc) == FALSE) + if (add_external_plugin(handle, desc) == FALSE) dlclose(handle); } g_dir_close(dir); +} + +#include "builtin.h" + +void plugin_init(const char *pattern, const char *exclude) +{ + char **patterns = NULL; + char **excludes = NULL; + unsigned int i; + + if (pattern) + patterns = g_strsplit_set(pattern, ":, ", -1); + + if (exclude) + excludes = g_strsplit_set(exclude, ":, ", -1); + + DBG("Loading builtin plugins"); + + for (i = 0; __obex_builtin[i]; i++) { + if (check_plugin(__obex_builtin[i], + patterns, excludes) == FALSE) + continue; + + add_plugin(__obex_builtin[i]); + } + + if IS_ENABLED(EXTERNAL_PLUGINS) + external_plugin_init(patterns, excludes); + g_strfreev(patterns); g_strfreev(excludes); - - return TRUE; } void plugin_cleanup(void) diff --git a/obexd/src/plugin.h b/obexd/src/plugin.h index a91746cbc..e1756b9bf 100644 --- a/obexd/src/plugin.h +++ b/obexd/src/plugin.h @@ -20,10 +20,14 @@ struct obex_plugin_desc { #name, init, exit \ }; #else +#if EXTERNAL_PLUGINS #define OBEX_PLUGIN_DEFINE(name,init,exit) \ extern struct obex_plugin_desc obex_plugin_desc \ __attribute__ ((visibility("default"))); \ const struct obex_plugin_desc obex_plugin_desc = { \ #name, init, exit \ }; +#else +#error "Requested non built-in plugin, while external plugins is disabled" +#endif #endif -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 3/8] bluetoothd: remove external-dummy plugin 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 2/8] obexd: factor out external plugin support Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 4/8] bluetoothd: convert external sixaxis plugin to builtin Emil Velikov via B4 Relay ` (5 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> The external plugins infra is getting deprecated and disabled by default. Remove this dummy plugin. --- Makefile.am | 8 -------- plugins/external-dummy.c | 28 ---------------------------- 2 files changed, 36 deletions(-) diff --git a/Makefile.am b/Makefile.am index 59603a0b7..9e35d7fd9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -289,14 +289,6 @@ builtin_ldadd = include Makefile.plugins -if MAINTAINER_MODE -plugin_LTLIBRARIES += plugins/external-dummy.la -plugins_external_dummy_la_SOURCES = plugins/external-dummy.c -plugins_external_dummy_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ - -no-undefined -plugins_external_dummy_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden -endif - pkglibexec_PROGRAMS += src/bluetoothd src_bluetoothd_SOURCES = $(builtin_sources) \ diff --git a/plugins/external-dummy.c b/plugins/external-dummy.c deleted file mode 100644 index 1c209e8b7..000000000 --- a/plugins/external-dummy.c +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "src/plugin.h" -#include "src/log.h" - -static int dummy_init(void) -{ - DBG(""); - - return 0; -} - -static void dummy_exit(void) -{ - DBG(""); -} - -BLUETOOTH_PLUGIN_DEFINE(external_dummy, VERSION, - BLUETOOTH_PLUGIN_PRIORITY_LOW, dummy_init, dummy_exit) -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 4/8] bluetoothd: convert external sixaxis plugin to builtin 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay ` (2 preceding siblings ...) 2024-01-29 14:44 ` [PATCH BlueZ v4 3/8] bluetoothd: remove external-dummy plugin Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 5/8] bluetoothd: factor out external plugin support Emil Velikov via B4 Relay ` (4 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> Convert the only known external plugin to built-in. It's a tiny 20K binary that distros ship a separate package for. Make it a builtin, which allows distros to drop the separate package, it also enables us to compile out support for external modules - both in terms of extra code and hide the internal bluetoothd API. This means that libudev.so is pulled in, which is fine since its ABI has been stable for over a decade. --- Makefile.plugins | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile.plugins b/Makefile.plugins index 5880ed0df..7cf66fd59 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -110,11 +110,9 @@ builtin_modules += battery builtin_sources += profiles/battery/battery.c if SIXAXIS -plugin_LTLIBRARIES += plugins/sixaxis.la -plugins_sixaxis_la_SOURCES = plugins/sixaxis.c -plugins_sixaxis_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -plugins_sixaxis_la_LIBADD = $(UDEV_LIBS) -plugins_sixaxis_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden +builtin_modules += sixaxis +builtin_sources += plugins/sixaxis.c +builtin_ldadd += $(UDEV_LIBS) endif if BAP -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 5/8] bluetoothd: factor out external plugin support 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay ` (3 preceding siblings ...) 2024-01-29 14:44 ` [PATCH BlueZ v4 4/8] bluetoothd: convert external sixaxis plugin to builtin Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 6/8] bluetoothd: don't export internal API Emil Velikov via B4 Relay ` (3 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> As a whole all plugins should be built-in, otherwise they would be using internal, undocumented, unversioned, unstable API. Flesh out the external plugin support and simplify the normal path. Guard the external plugin support behind a runtime check, which will be dead-code eliminated in the default case. --- Makefile.am | 4 --- src/btd.h | 2 +- src/plugin.c | 92 +++++++++++++++++++++++++++++++++++++----------------------- src/plugin.h | 4 +++ 4 files changed, 62 insertions(+), 40 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9e35d7fd9..2d5650ced 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,11 +51,7 @@ EXTRA_DIST += src/org.bluez.service plugindir = $(libdir)/bluetooth/plugins -if MAINTAINER_MODE -build_plugindir = $(abs_top_srcdir)/plugins/.libs -else build_plugindir = $(plugindir) -endif if MANPAGES man_MANS = diff --git a/src/btd.h b/src/btd.h index b7e7ebd61..7166e2168 100644 --- a/src/btd.h +++ b/src/btd.h @@ -155,7 +155,7 @@ struct btd_opts { extern struct btd_opts btd_opts; -gboolean plugin_init(const char *enable, const char *disable); +void plugin_init(const char *enable, const char *disable); void plugin_cleanup(void); void rfkill_init(void); diff --git a/src/plugin.c b/src/plugin.c index 2a29a888e..b6a84299a 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -26,6 +26,8 @@ #include "src/log.h" #include "src/btd.h" +#define IS_ENABLED(x) (x) + static GSList *plugins = NULL; struct bluetooth_plugin { @@ -42,7 +44,7 @@ static int compare_priority(gconstpointer a, gconstpointer b) return plugin2->desc->priority - plugin1->desc->priority; } -static gboolean add_plugin(void *handle, +static gboolean add_external_plugin(void *handle, const struct bluetooth_plugin_desc *desc) { struct bluetooth_plugin *plugin; @@ -72,6 +74,21 @@ static gboolean add_plugin(void *handle, return TRUE; } +static void add_plugin(const struct bluetooth_plugin_desc *desc) +{ + struct bluetooth_plugin *plugin; + + DBG("Loading %s plugin", desc->name); + + plugin = g_try_new0(struct bluetooth_plugin, 1); + if (plugin == NULL) + return; + + plugin->desc = desc; + + plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); +} + static gboolean enable_plugin(const char *name, char **cli_enable, char **cli_disable) { @@ -98,48 +115,23 @@ static gboolean enable_plugin(const char *name, char **cli_enable, return TRUE; } -#include "src/builtin.h" -gboolean plugin_init(const char *enable, const char *disable) +static void external_plugin_init(char **cli_disabled, char **cli_enabled) { - GSList *list; GDir *dir; const char *file; - char **cli_disabled, **cli_enabled; - unsigned int i; - - /* Make a call to BtIO API so its symbols got resolved before the - * plugins are loaded. */ - bt_io_error_quark(); - - if (enable) - cli_enabled = g_strsplit_set(enable, ", ", -1); - else - cli_enabled = NULL; - - if (disable) - cli_disabled = g_strsplit_set(disable, ", ", -1); - else - cli_disabled = NULL; - - DBG("Loading builtin plugins"); - - for (i = 0; __bluetooth_builtin[i]; i++) { - if (!enable_plugin(__bluetooth_builtin[i]->name, cli_enabled, - cli_disabled)) - continue; - add_plugin(NULL, __bluetooth_builtin[i]); - } + info("Using external plugins is not officially supported.\n"); + info("Consider upstreaming your plugins into the BlueZ project."); if (strlen(PLUGINDIR) == 0) - goto start; + return; DBG("Loading plugins %s", PLUGINDIR); dir = g_dir_open(PLUGINDIR, 0, NULL); if (!dir) - goto start; + return; while ((file = g_dir_read_name(dir)) != NULL) { const struct bluetooth_plugin_desc *desc; @@ -174,13 +166,45 @@ gboolean plugin_init(const char *enable, const char *disable) continue; } - if (add_plugin(handle, desc) == FALSE) + if (add_external_plugin(handle, desc) == FALSE) dlclose(handle); } g_dir_close(dir); +} + +#include "src/builtin.h" + +void plugin_init(const char *enable, const char *disable) +{ + GSList *list; + char **cli_disabled = NULL; + char **cli_enabled = NULL; + unsigned int i; + + /* Make a call to BtIO API so its symbols got resolved before the + * plugins are loaded. */ + bt_io_error_quark(); + + if (enable) + cli_enabled = g_strsplit_set(enable, ", ", -1); + + if (disable) + cli_disabled = g_strsplit_set(disable, ", ", -1); + + DBG("Loading builtin plugins"); + + for (i = 0; __bluetooth_builtin[i]; i++) { + if (!enable_plugin(__bluetooth_builtin[i]->name, cli_enabled, + cli_disabled)) + continue; + + add_plugin(__bluetooth_builtin[i]); + } + + if IS_ENABLED(EXTERNAL_PLUGINS) + external_plugin_init(cli_enabled, cli_disabled); -start: for (list = plugins; list; list = list->next) { struct bluetooth_plugin *plugin = list->data; int err; @@ -201,8 +225,6 @@ start: g_strfreev(cli_enabled); g_strfreev(cli_disabled); - - return TRUE; } void plugin_cleanup(void) diff --git a/src/plugin.h b/src/plugin.h index 8d0903f2d..b484ed378 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -28,6 +28,7 @@ struct bluetooth_plugin_desc { #name, version, priority, init, exit \ }; #else +#if EXTERNAL_PLUGINS #define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \ extern struct btd_debug_desc __start___debug[] \ __attribute__ ((weak, visibility("hidden"))); \ @@ -40,4 +41,7 @@ struct bluetooth_plugin_desc { #name, version, priority, init, exit, \ __start___debug, __stop___debug \ }; +#else +#error "Requested non built-in plugin, while external plugins is disabled" +#endif #endif -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 6/8] bluetoothd: don't export internal API 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay ` (4 preceding siblings ...) 2024-01-29 14:44 ` [PATCH BlueZ v4 5/8] bluetoothd: factor out external plugin support Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd Emil Velikov via B4 Relay ` (2 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> ... when building without external plugins. --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 2d5650ced..2b1b9acdf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -289,7 +289,6 @@ pkglibexec_PROGRAMS += src/bluetoothd src_bluetoothd_SOURCES = $(builtin_sources) \ $(attrib_sources) $(btio_sources) \ - src/bluetooth.ver \ src/main.c src/log.h src/log.c \ src/backtrace.h src/backtrace.c \ src/rfkill.c src/btd.h src/sdpd.h \ @@ -321,8 +320,12 @@ src_bluetoothd_LDADD = lib/libbluetooth-internal.la \ src/libshared-glib.la \ $(BACKTRACE_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) -ldl -lrt \ $(builtin_ldadd) + +if EXTERNAL_PLUGINS +src_bluetoothd_SOURCES += src/bluetooth.ver src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \ -Wl,--version-script=$(srcdir)/src/bluetooth.ver +endif src_bluetoothd_CPPFLAGS = $(AM_CPPFLAGS) -DBLUETOOTH_PLUGIN_BUILTIN \ -DPLUGINDIR=\""$(build_plugindir)"\" \ -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay ` (5 preceding siblings ...) 2024-01-29 14:44 ` [PATCH BlueZ v4 6/8] bluetoothd: don't export internal API Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 15:37 ` Paul Menzel 2024-01-29 14:44 ` [PATCH BlueZ v4 8/8] android: export only (android) entrypoint from the modules Emil Velikov via B4 Relay 2024-01-29 19:00 ` [PATCH BlueZ v4 0/8] Remove support for external plugins patchwork-bot+bluetooth 8 siblings, 1 reply; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> Currently, we print "Loading foobar" for every plugin, before we try the respective init() callback. Instead we handle the latter in a bunch, at the end of the process. Do the init() call early, print "Loaded" once it's actually successful and drop the no-longer "active" tracking. --- src/plugin.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index b6a84299a..e6d05be4c 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -32,7 +32,6 @@ static GSList *plugins = NULL; struct bluetooth_plugin { void *handle; - gboolean active; const struct bluetooth_plugin_desc *desc; }; @@ -44,6 +43,22 @@ static int compare_priority(gconstpointer a, gconstpointer b) return plugin2->desc->priority - plugin1->desc->priority; } +static int init_plugin(const struct bluetooth_plugin_desc *desc) +{ + int err; + + err = desc->init(); + if (err < 0) { + if (err == -ENOSYS || err == -ENOTSUP) + warn("System does not support %s plugin", + desc->name); + else + error("Failed to init %s plugin", + desc->name); + } + return err; +} + static gboolean add_external_plugin(void *handle, const struct bluetooth_plugin_desc *desc) { @@ -57,19 +72,22 @@ static gboolean add_external_plugin(void *handle, return FALSE; } - DBG("Loading %s plugin", desc->name); - plugin = g_try_new0(struct bluetooth_plugin, 1); if (plugin == NULL) return FALSE; plugin->handle = handle; - plugin->active = FALSE; plugin->desc = desc; + if (init_plugin(desc) < 0) { + g_free(plugin); + return FALSE; + } + __btd_enable_debug(desc->debug_start, desc->debug_stop); plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); + DBG("Plugin %s loaded", desc->name); return TRUE; } @@ -86,7 +104,13 @@ static void add_plugin(const struct bluetooth_plugin_desc *desc) plugin->desc = desc; + if (init_plugin(desc) < 0) { + g_free(plugin); + return; + } + plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); + DBG("Plugin %s loaded", desc->name); } static gboolean enable_plugin(const char *name, char **cli_enable, @@ -177,7 +201,6 @@ static void external_plugin_init(char **cli_disabled, char **cli_enabled) void plugin_init(const char *enable, const char *disable) { - GSList *list; char **cli_disabled = NULL; char **cli_enabled = NULL; unsigned int i; @@ -205,24 +228,6 @@ void plugin_init(const char *enable, const char *disable) if IS_ENABLED(EXTERNAL_PLUGINS) external_plugin_init(cli_enabled, cli_disabled); - for (list = plugins; list; list = list->next) { - struct bluetooth_plugin *plugin = list->data; - int err; - - err = plugin->desc->init(); - if (err < 0) { - if (err == -ENOSYS || err == -ENOTSUP) - warn("System does not support %s plugin", - plugin->desc->name); - else - error("Failed to init %s plugin", - plugin->desc->name); - continue; - } - - plugin->active = TRUE; - } - g_strfreev(cli_enabled); g_strfreev(cli_disabled); } @@ -236,7 +241,7 @@ void plugin_cleanup(void) for (list = plugins; list; list = list->next) { struct bluetooth_plugin *plugin = list->data; - if (plugin->active == TRUE && plugin->desc->exit) + if (plugin->desc->exit) plugin->desc->exit(); if (plugin->handle != NULL) -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd 2024-01-29 14:44 ` [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd Emil Velikov via B4 Relay @ 2024-01-29 15:37 ` Paul Menzel 2024-01-29 16:22 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 18+ messages in thread From: Paul Menzel @ 2024-01-29 15:37 UTC (permalink / raw) To: Emil Velikov; +Cc: linux-bluetooth, emil.l.velikov Dear Emil, Thank you for your patches. Am 29.01.24 um 15:44 schrieb Emil Velikov via B4 Relay: > From: Emil Velikov <emil.velikov@collabora.com> > > Currently, we print "Loading foobar" for every plugin, before we try the > respective init() callback. Instead we handle the latter in a bunch, at > the end of the process. Excuse my ignorance, but would you be so kind to state the problem. It’s causing confusion to have `Loading foobar`, in case it fails? It clutters the output or uses unnecessory resources? > Do the init() call early, print "Loaded" once it's actually successful > and drop the no-longer "active" tracking. It would help me, if you pasted the logs without and with your patch. Kind regards, Paul > --- > src/plugin.c | 53 +++++++++++++++++++++++++++++------------------------ > 1 file changed, 29 insertions(+), 24 deletions(-) > > diff --git a/src/plugin.c b/src/plugin.c > index b6a84299a..e6d05be4c 100644 > --- a/src/plugin.c > +++ b/src/plugin.c > @@ -32,7 +32,6 @@ static GSList *plugins = NULL; > > struct bluetooth_plugin { > void *handle; > - gboolean active; > const struct bluetooth_plugin_desc *desc; > }; > > @@ -44,6 +43,22 @@ static int compare_priority(gconstpointer a, gconstpointer b) > return plugin2->desc->priority - plugin1->desc->priority; > } > > +static int init_plugin(const struct bluetooth_plugin_desc *desc) > +{ > + int err; > + > + err = desc->init(); > + if (err < 0) { > + if (err == -ENOSYS || err == -ENOTSUP) > + warn("System does not support %s plugin", > + desc->name); > + else > + error("Failed to init %s plugin", > + desc->name); > + } > + return err; > +} > + > static gboolean add_external_plugin(void *handle, > const struct bluetooth_plugin_desc *desc) > { > @@ -57,19 +72,22 @@ static gboolean add_external_plugin(void *handle, > return FALSE; > } > > - DBG("Loading %s plugin", desc->name); > - > plugin = g_try_new0(struct bluetooth_plugin, 1); > if (plugin == NULL) > return FALSE; > > plugin->handle = handle; > - plugin->active = FALSE; > plugin->desc = desc; > > + if (init_plugin(desc) < 0) { > + g_free(plugin); > + return FALSE; > + } > + > __btd_enable_debug(desc->debug_start, desc->debug_stop); > > plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); > + DBG("Plugin %s loaded", desc->name); > > return TRUE; > } > @@ -86,7 +104,13 @@ static void add_plugin(const struct bluetooth_plugin_desc *desc) > > plugin->desc = desc; > > + if (init_plugin(desc) < 0) { > + g_free(plugin); > + return; > + } > + > plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); > + DBG("Plugin %s loaded", desc->name); > } > > static gboolean enable_plugin(const char *name, char **cli_enable, > @@ -177,7 +201,6 @@ static void external_plugin_init(char **cli_disabled, char **cli_enabled) > > void plugin_init(const char *enable, const char *disable) > { > - GSList *list; > char **cli_disabled = NULL; > char **cli_enabled = NULL; > unsigned int i; > @@ -205,24 +228,6 @@ void plugin_init(const char *enable, const char *disable) > if IS_ENABLED(EXTERNAL_PLUGINS) > external_plugin_init(cli_enabled, cli_disabled); > > - for (list = plugins; list; list = list->next) { > - struct bluetooth_plugin *plugin = list->data; > - int err; > - > - err = plugin->desc->init(); > - if (err < 0) { > - if (err == -ENOSYS || err == -ENOTSUP) > - warn("System does not support %s plugin", > - plugin->desc->name); > - else > - error("Failed to init %s plugin", > - plugin->desc->name); > - continue; > - } > - > - plugin->active = TRUE; > - } > - > g_strfreev(cli_enabled); > g_strfreev(cli_disabled); > } > @@ -236,7 +241,7 @@ void plugin_cleanup(void) > for (list = plugins; list; list = list->next) { > struct bluetooth_plugin *plugin = list->data; > > - if (plugin->active == TRUE && plugin->desc->exit) > + if (plugin->desc->exit) > plugin->desc->exit(); > > if (plugin->handle != NULL) > ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd 2024-01-29 15:37 ` Paul Menzel @ 2024-01-29 16:22 ` Luiz Augusto von Dentz 2024-01-29 17:47 ` Emil Velikov 0 siblings, 1 reply; 18+ messages in thread From: Luiz Augusto von Dentz @ 2024-01-29 16:22 UTC (permalink / raw) To: Paul Menzel; +Cc: Emil Velikov, linux-bluetooth, emil.l.velikov Hi Paul, On Mon, Jan 29, 2024 at 10:37 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote: > > Dear Emil, > > > Thank you for your patches. > > Am 29.01.24 um 15:44 schrieb Emil Velikov via B4 Relay: > > From: Emil Velikov <emil.velikov@collabora.com> > > > > Currently, we print "Loading foobar" for every plugin, before we try the > > respective init() callback. Instead we handle the latter in a bunch, at > > the end of the process. > > Excuse my ignorance, but would you be so kind to state the problem. It’s > causing confusion to have `Loading foobar`, in case it fails? It > clutters the output or uses unnecessory resources? To me it sounds quite clear that he is refering to the fact that obexd prints it a little differently so he is just trying to align the behavior of the daemons. > > Do the init() call early, print "Loaded" once it's actually successful > > and drop the no-longer "active" tracking. > > It would help me, if you pasted the logs without and with your patch. > > > Kind regards, > > Paul > > > > --- > > src/plugin.c | 53 +++++++++++++++++++++++++++++------------------------ > > 1 file changed, 29 insertions(+), 24 deletions(-) > > > > diff --git a/src/plugin.c b/src/plugin.c > > index b6a84299a..e6d05be4c 100644 > > --- a/src/plugin.c > > +++ b/src/plugin.c > > @@ -32,7 +32,6 @@ static GSList *plugins = NULL; > > > > struct bluetooth_plugin { > > void *handle; > > - gboolean active; > > const struct bluetooth_plugin_desc *desc; > > }; > > > > @@ -44,6 +43,22 @@ static int compare_priority(gconstpointer a, gconstpointer b) > > return plugin2->desc->priority - plugin1->desc->priority; > > } > > > > +static int init_plugin(const struct bluetooth_plugin_desc *desc) > > +{ > > + int err; > > + > > + err = desc->init(); > > + if (err < 0) { > > + if (err == -ENOSYS || err == -ENOTSUP) > > + warn("System does not support %s plugin", > > + desc->name); > > + else > > + error("Failed to init %s plugin", > > + desc->name); > > + } > > + return err; > > +} > > + > > static gboolean add_external_plugin(void *handle, > > const struct bluetooth_plugin_desc *desc) > > { > > @@ -57,19 +72,22 @@ static gboolean add_external_plugin(void *handle, > > return FALSE; > > } > > > > - DBG("Loading %s plugin", desc->name); > > - > > plugin = g_try_new0(struct bluetooth_plugin, 1); > > if (plugin == NULL) > > return FALSE; > > > > plugin->handle = handle; > > - plugin->active = FALSE; > > plugin->desc = desc; > > > > + if (init_plugin(desc) < 0) { > > + g_free(plugin); > > + return FALSE; > > + } > > + > > __btd_enable_debug(desc->debug_start, desc->debug_stop); > > > > plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); > > + DBG("Plugin %s loaded", desc->name); > > > > return TRUE; > > } > > @@ -86,7 +104,13 @@ static void add_plugin(const struct bluetooth_plugin_desc *desc) > > > > plugin->desc = desc; > > > > + if (init_plugin(desc) < 0) { > > + g_free(plugin); > > + return; > > + } > > + > > plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); > > + DBG("Plugin %s loaded", desc->name); > > } > > > > static gboolean enable_plugin(const char *name, char **cli_enable, > > @@ -177,7 +201,6 @@ static void external_plugin_init(char **cli_disabled, char **cli_enabled) > > > > void plugin_init(const char *enable, const char *disable) > > { > > - GSList *list; > > char **cli_disabled = NULL; > > char **cli_enabled = NULL; > > unsigned int i; > > @@ -205,24 +228,6 @@ void plugin_init(const char *enable, const char *disable) > > if IS_ENABLED(EXTERNAL_PLUGINS) > > external_plugin_init(cli_enabled, cli_disabled); > > > > - for (list = plugins; list; list = list->next) { > > - struct bluetooth_plugin *plugin = list->data; > > - int err; > > - > > - err = plugin->desc->init(); > > - if (err < 0) { > > - if (err == -ENOSYS || err == -ENOTSUP) > > - warn("System does not support %s plugin", > > - plugin->desc->name); > > - else > > - error("Failed to init %s plugin", > > - plugin->desc->name); > > - continue; > > - } > > - > > - plugin->active = TRUE; > > - } > > - > > g_strfreev(cli_enabled); > > g_strfreev(cli_disabled); > > } > > @@ -236,7 +241,7 @@ void plugin_cleanup(void) > > for (list = plugins; list; list = list->next) { > > struct bluetooth_plugin *plugin = list->data; > > > > - if (plugin->active == TRUE && plugin->desc->exit) > > + if (plugin->desc->exit) > > plugin->desc->exit(); > > > > if (plugin->handle != NULL) > > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd 2024-01-29 16:22 ` Luiz Augusto von Dentz @ 2024-01-29 17:47 ` Emil Velikov 0 siblings, 0 replies; 18+ messages in thread From: Emil Velikov @ 2024-01-29 17:47 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: Paul Menzel, Emil Velikov, linux-bluetooth Hello team, On Mon, 29 Jan 2024 at 16:22, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > > To me it sounds quite clear that he is refering to the fact that obexd > prints it a little differently so he is just trying to align the > behavior of the daemons. > Precisely - we do basic alignment across the two daemons. Both in terms of code as well as logging pattern. Although if that's not wanted, please drop this patch. There's a reason why I kept it near the end of the series ;-) Re-sending the series for the comma in 8/8 seems excessive IMHO. If there are other concerns, I'd be happy to respin the lot. Otherwise I think it's simpler if Luiz fixes it on applying. Thanks Emil ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH BlueZ v4 8/8] android: export only (android) entrypoint from the modules 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay ` (6 preceding siblings ...) 2024-01-29 14:44 ` [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd Emil Velikov via B4 Relay @ 2024-01-29 14:44 ` Emil Velikov via B4 Relay 2024-01-29 15:38 ` Paul Menzel 2024-01-29 19:00 ` [PATCH BlueZ v4 0/8] Remove support for external plugins patchwork-bot+bluetooth 8 siblings, 1 reply; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-29 14:44 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> The android specific modules, have a designated HMI entrypoint. Hide everything else with -fvisibility=hidden. --- android/Makefile.am | 3 +++ android/hal-audio.c | 1 + android/hal-bluetooth.c | 1 + android/hal-sco.c | 1 + 4 files changed, 6 insertions(+) diff --git a/android/Makefile.am b/android/Makefile.am index 309910147..e3756e89c 100644 --- a/android/Makefile.am +++ b/android/Makefile.am @@ -96,6 +96,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \ android/hal-log.h \ android/hal-ipc.h android/hal-ipc.c \ android/hal-utils.h android/hal-utils.c +android_bluetooth_default_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden android_bluetooth_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android android_bluetooth_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ -no-undefined @@ -195,6 +196,7 @@ android_audio_a2dp_default_la_SOURCES = android/audio-msg.h \ android/hardware/audio_effect.h \ android/hardware/hardware.h \ android/system/audio.h +android_audio_a2dp_default_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden android_audio_a2dp_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android \ $(SBC_CFLAGS) android_audio_a2dp_default_la_LIBADD = $(SBC_LIBS) -lrt @@ -212,6 +214,7 @@ android_audio_sco_default_la_SOURCES = android/hal-log.h \ android/audio_utils/resampler.c \ android/audio_utils/resampler.h \ android/system/audio.h +android_audio_sco_default_la_CFLAGS = $(AM_CFLAGS) -fvisibility=hidden android_audio_sco_default_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/android android_audio_sco_default_la_LIBADD = $(SPEEXDSP_LIBS) -lrt android_audio_sco_default_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version \ diff --git a/android/hal-audio.c b/android/hal-audio.c index d37d6098c..f3d9b40a6 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -1618,6 +1618,7 @@ static struct hw_module_methods_t hal_module_methods = { .open = audio_open, }; +__attribute__ ((visibility("default"))) struct audio_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index d4442e620..7d1e5ac63 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -1117,6 +1117,7 @@ static struct hw_module_methods_t bluetooth_module_methods = { .open = open_bluetooth, }; +__attribute__ ((visibility("default"))) struct hw_module_t HAL_MODULE_INFO_SYM = { .tag = HARDWARE_MODULE_TAG, .version_major = 1, diff --git a/android/hal-sco.c b/android/hal-sco.c index d7c08a68b..3d66ad357 100644 --- a/android/hal-sco.c +++ b/android/hal-sco.c @@ -1507,6 +1507,7 @@ static struct hw_module_methods_t hal_module_methods = { .open = sco_open, }; +__attribute__ ((visibility("default"))) struct audio_module HAL_MODULE_INFO_SYM = { .common = { .tag = HARDWARE_MODULE_TAG, -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH BlueZ v4 8/8] android: export only (android) entrypoint from the modules 2024-01-29 14:44 ` [PATCH BlueZ v4 8/8] android: export only (android) entrypoint from the modules Emil Velikov via B4 Relay @ 2024-01-29 15:38 ` Paul Menzel 0 siblings, 0 replies; 18+ messages in thread From: Paul Menzel @ 2024-01-29 15:38 UTC (permalink / raw) To: Emil Velikov; +Cc: emil.l.velikov, linux-bluetooth Dear Emil, Thank you for your patches. One small nit. Am 29.01.24 um 15:44 schrieb Emil Velikov via B4 Relay: > From: Emil Velikov <emil.velikov@collabora.com> > > The android specific modules, have a designated HMI entrypoint. Hide The comma seems superfluous. > everything else with -fvisibility=hidden. > --- > android/Makefile.am | 3 +++ > android/hal-audio.c | 1 + > android/hal-bluetooth.c | 1 + > android/hal-sco.c | 1 + > 4 files changed, 6 insertions(+) […] Kind regards, Paul ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH BlueZ v4 0/8] Remove support for external plugins 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay ` (7 preceding siblings ...) 2024-01-29 14:44 ` [PATCH BlueZ v4 8/8] android: export only (android) entrypoint from the modules Emil Velikov via B4 Relay @ 2024-01-29 19:00 ` patchwork-bot+bluetooth 8 siblings, 0 replies; 18+ messages in thread From: patchwork-bot+bluetooth @ 2024-01-29 19:00 UTC (permalink / raw) To: Emil Velikov via B4 Relay; +Cc: linux-bluetooth, emil.velikov Hello: This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Mon, 29 Jan 2024 14:44:14 +0000 you wrote: > Hello everyone, > > With v4 we have moved from pre-processor to compilation checking for the > external plugins support. > > Namely, as we build without one the dead-code elimination will discard > all the relevant code. Ultimately this means we compile check both paths > in order to catch mistakes. Thanks to Luiz for the suggestion. > > [...] Here is the summary with links: - [BlueZ,v4,1/8] configure, README: introduce --enable-external-plugins https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2a5c9cf632e6 - [BlueZ,v4,2/8] obexd: factor out external plugin support https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=004b5b28a04c - [BlueZ,v4,3/8] bluetoothd: remove external-dummy plugin https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1db7a00e35c4 - [BlueZ,v4,4/8] bluetoothd: convert external sixaxis plugin to builtin https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9f71892b63f6 - [BlueZ,v4,5/8] bluetoothd: factor out external plugin support https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=109cc8a0f6aa - [BlueZ,v4,6/8] bluetoothd: don't export internal API https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7a1d3c7c4bc7 - [BlueZ,v4,7/8] bluetoothd: change plugin loading alike obexd https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f174724c76c6 - [BlueZ,v4,8/8] android: export only (android) entrypoint from the modules https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f59f4902bc4e You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH BlueZ v3 1/8] configure, README: introduce --enable-external-plugins @ 2024-01-25 0:07 Emil Velikov via B4 Relay 2024-01-25 3:15 ` Remove support for external plugins bluez.test.bot 0 siblings, 1 reply; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-25 0:07 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> As the README chunk says, disabled by default, since they rely on internal API/ABI and can break at any point. Instead everyone affected should work and upstream their plugin into the bluez project. --- README | 13 +++++++++++++ configure.ac | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/README b/README index 7de7045a8..6c0777046 100644 --- a/README +++ b/README @@ -249,6 +249,19 @@ For a working system, certain configuration options need to be enabled: systems. The behavior of the deprecated tools may be unstable or simply don't work anymore. + --enable-external-plugins + + Enable support for external plugins + + By default external plugins for bluetoothd and obexd are not + supported and thus disabled. + + External plugins require access to internal, undocumented and + unversioned API in said daemons. As such they can break at any + time. If you have such plugins, enable this option and work + actively with the community to make said plugin part of the + upstream bluez project. + --enable-nfc This option enable NFC pairing support. diff --git a/configure.ac b/configure.ac index cab5da581..5e353a1d6 100644 --- a/configure.ac +++ b/configure.ac @@ -364,6 +364,16 @@ AC_ARG_ENABLE(deprecated, AS_HELP_STRING([--enable-deprecated], [enable_deprecated=${enableval}]) AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes") +AC_ARG_ENABLE(external-plugsin, AS_HELP_STRING([--enable-external-plugins], + [enable support for external plugins]), + [enable_external_plugins=${enableval}]) +AM_CONDITIONAL(EXTERNAL_PLUGINS, test "${enable_external_plugins}" = "yes") +if (test "${enable_external_plugins}" = "yes"); then + AC_DEFINE(EXTERNAL_PLUGINS, 1, [Define if external plugin support is required]) +else + AC_DEFINE(EXTERNAL_PLUGINS, 0, [Define if external plugin support is required]) +fi + AC_ARG_ENABLE(sixaxis, AS_HELP_STRING([--enable-sixaxis], [enable sixaxis plugin]), [enable_sixaxis=${enableval}]) AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" && -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* RE: Remove support for external plugins 2024-01-25 0:07 [PATCH BlueZ v3 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay @ 2024-01-25 3:15 ` bluez.test.bot 0 siblings, 0 replies; 18+ messages in thread From: bluez.test.bot @ 2024-01-25 3:15 UTC (permalink / raw) To: linux-bluetooth, devnull+emil.l.velikov.gmail.com [-- Attachment #1: Type: text/plain, Size: 3791 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=819668 ---Test result--- Test Summary: CheckPatch FAIL 2.89 seconds GitLint PASS 1.83 seconds BuildEll PASS 23.99 seconds BluezMake PASS 735.43 seconds MakeCheck PASS 11.83 seconds MakeDistcheck PASS 163.54 seconds CheckValgrind PASS 226.28 seconds CheckSmatch PASS 330.80 seconds bluezmakeextell PASS 107.89 seconds IncrementalBuild PASS 5466.84 seconds ScanBuild PASS 954.84 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v3,2/8] obexd: factor out external plugin support WARNING:LONG_LINE: line length of 86 exceeds 80 columns #134: FILE: obexd/src/plugin.c:47: +static gboolean add_external_plugin(void *handle, const struct obex_plugin_desc *desc) /github/workspace/src/src/13529768.patch total: 0 errors, 1 warnings, 176 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13529768.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v3,5/8] bluetoothd: factor out external plugin support WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #243: FILE: src/plugin.c:190: + * plugins are loaded. */ WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #318: FILE: src/plugin.h:51: +#define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \ + const struct bluetooth_plugin_desc \ + __bluetooth_builtin_ ## name = { \ + #name, priority, init, exit \ + }; /github/workspace/src/src/13529772.patch total: 0 errors, 2 warnings, 211 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13529772.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v3,7/8] bluetoothd: change plugin loading alike obexd WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else #108: FILE: src/plugin.c:52: + if (err == -ENOSYS || err == -ENOTSUP) /github/workspace/src/src/13529774.patch total: 0 errors, 1 warnings, 106 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13529774.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH BlueZ v2 1/8] configure, README: introduce --enable-external-plugins @ 2024-01-24 16:07 Emil Velikov via B4 Relay 2024-01-24 18:17 ` Remove support for external plugins bluez.test.bot 0 siblings, 1 reply; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-24 16:07 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> As the README chunk says, disabled by default, since they rely on internal API/ABI and can break at any point. Instead everyone affected should work and upstream their plugin into the bluez project. --- README | 13 +++++++++++++ configure.ac | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/README b/README index 7de7045a8..6c0777046 100644 --- a/README +++ b/README @@ -249,6 +249,19 @@ For a working system, certain configuration options need to be enabled: systems. The behavior of the deprecated tools may be unstable or simply don't work anymore. + --enable-external-plugins + + Enable support for external plugins + + By default external plugins for bluetoothd and obexd are not + supported and thus disabled. + + External plugins require access to internal, undocumented and + unversioned API in said daemons. As such they can break at any + time. If you have such plugins, enable this option and work + actively with the community to make said plugin part of the + upstream bluez project. + --enable-nfc This option enable NFC pairing support. diff --git a/configure.ac b/configure.ac index cab5da581..5e353a1d6 100644 --- a/configure.ac +++ b/configure.ac @@ -364,6 +364,16 @@ AC_ARG_ENABLE(deprecated, AS_HELP_STRING([--enable-deprecated], [enable_deprecated=${enableval}]) AM_CONDITIONAL(DEPRECATED, test "${enable_deprecated}" = "yes") +AC_ARG_ENABLE(external-plugsin, AS_HELP_STRING([--enable-external-plugins], + [enable support for external plugins]), + [enable_external_plugins=${enableval}]) +AM_CONDITIONAL(EXTERNAL_PLUGINS, test "${enable_external_plugins}" = "yes") +if (test "${enable_external_plugins}" = "yes"); then + AC_DEFINE(EXTERNAL_PLUGINS, 1, [Define if external plugin support is required]) +else + AC_DEFINE(EXTERNAL_PLUGINS, 0, [Define if external plugin support is required]) +fi + AC_ARG_ENABLE(sixaxis, AS_HELP_STRING([--enable-sixaxis], [enable sixaxis plugin]), [enable_sixaxis=${enableval}]) AM_CONDITIONAL(SIXAXIS, test "${enable_sixaxis}" = "yes" && -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* RE: Remove support for external plugins 2024-01-24 16:07 [PATCH BlueZ v2 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay @ 2024-01-24 18:17 ` bluez.test.bot 0 siblings, 0 replies; 18+ messages in thread From: bluez.test.bot @ 2024-01-24 18:17 UTC (permalink / raw) To: linux-bluetooth, devnull+emil.l.velikov.gmail.com [-- Attachment #1: Type: text/plain, Size: 35655 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=819552 ---Test result--- Test Summary: CheckPatch FAIL 3.26 seconds GitLint PASS 1.73 seconds BuildEll PASS 23.93 seconds BluezMake FAIL 88.22 seconds MakeCheck FAIL 1153.77 seconds MakeDistcheck PASS 162.09 seconds CheckValgrind FAIL 65.04 seconds CheckSmatch FAIL 152.12 seconds bluezmakeextell FAIL 56.11 seconds IncrementalBuild FAIL 4778.58 seconds ScanBuild FAIL 645.83 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v2,2/8] obexd: factor out external plugin support WARNING:LONG_LINE: line length of 86 exceeds 80 columns #134: FILE: obexd/src/plugin.c:47: +static gboolean add_external_plugin(void *handle, const struct obex_plugin_desc *desc) /github/workspace/src/src/13529366.patch total: 0 errors, 1 warnings, 176 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13529366.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v2,5/8] bluetoothd: factor out external plugin support WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #243: FILE: src/plugin.c:190: + * plugins are loaded. */ WARNING:TRAILING_SEMICOLON: macros should not use a trailing semicolon #318: FILE: src/plugin.h:51: +#define BLUETOOTH_PLUGIN_DEFINE(name, version, priority, init, exit) \ + const struct bluetooth_plugin_desc \ + __bluetooth_builtin_ ## name = { \ + #name, priority, init, exit \ + }; /github/workspace/src/src/13529369.patch total: 0 errors, 2 warnings, 211 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13529369.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v2,7/8] bluetoothd: change plugin loading alike obexd WARNING:ENOSYS: ENOSYS means 'invalid syscall nr' and nothing else #108: FILE: src/plugin.c:52: + if (err == -ENOSYS || err == -ENOTSUP) /github/workspace/src/src/13529372.patch total: 0 errors, 1 warnings, 105 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13529372.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. ############################## Test: BluezMake - FAIL Desc: Build BlueZ Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12763:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12763 | int main(int argc, char *argv[]) | ^~~~ src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10852: src/bluetoothd-plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4641: all] Error 2 ############################## Test: MakeCheck - FAIL Desc: Run Bluez Make Check Output: unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10852: src/bluetoothd-plugin.o] Error 1 make: *** [Makefile:12118: check] Error 2 ############################## Test: CheckValgrind - FAIL Desc: Run Bluez Make Check with Valgrind Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12763:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12763 | int main(int argc, char *argv[]) | ^~~~ src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10852: src/bluetoothd-plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:12118: check] Error 2 ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:276:25: warning: Variable length array is used. src/shared/gatt-server.c:619:25: warning: Variable length array is used. src/shared/gatt-server.c:718:25: warning: Variable length array is used. src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:276:25: warning: Variable length array is used. src/shared/gatt-server.c:619:25: warning: Variable length array is used. src/shared/gatt-server.c:718:25: warning: Variable length array is used. src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:216:15: warning: array of flexible structures ./lib/bluetooth.h:221:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' android/avctp.c:505:34: warning: Variable length array is used. android/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. android/avrcp-lib.c:1085:34: warning: Variable length array is used. android/avrcp-lib.c:1583:34: warning: Variable length array is used. android/avrcp-lib.c:1612:34: warning: Variable length array is used. android/avrcp-lib.c:1638:34: warning: Variable length array is used. src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10852: src/bluetoothd-plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4641: all] Error 2 ############################## Test: bluezmakeextell - FAIL Desc: Build Bluez with External ELL Output: src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10852: src/bluetoothd-plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4641: all] Error 2 ############################## Test: IncrementalBuild - FAIL Desc: Incremental build with the patches in the series Output: [BlueZ,v2,7/8] bluetoothd: change plugin loading alike obexd tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12763:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12763 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10849: src/bluetoothd-plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4638: all] Error 2 ############################## Test: ScanBuild - FAIL Desc: Run Scan Build Output: src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:993:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1099:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1291:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1356:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1631:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1636:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2140:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2148:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3237:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3259:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 12 warnings generated. src/shared/shell.c:1228:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt') if (c != opt->options[index - offset].val) { ^~~~~~~~~~~~ 1 warning generated. src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:993:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1099:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1291:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1356:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1631:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1636:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2140:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2148:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3237:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3259:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 12 warnings generated. src/shared/shell.c:1228:13: warning: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt') if (c != opt->options[index - offset].val) { ^~~~~~~~~~~~ 1 warning generated. tools/hciattach.c:816:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:864:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:886:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:908:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:929:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:973:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 6)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 warnings generated. src/oui.c:50:2: warning: Value stored to 'hwdb' is never read hwdb = udev_hwdb_unref(hwdb); ^ ~~~~~~~~~~~~~~~~~~~~~ src/oui.c:53:2: warning: Value stored to 'udev' is never read udev = udev_unref(udev); ^ ~~~~~~~~~~~~~~~~ 2 warnings generated. tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp' if (fds[i].fd == sock) ^~~ tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined dh->ts_sec = htobl(frm.ts.tv_sec); ^ ~~~~~~~~~~~~~~~~~~~~ tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value if (be32toh(dp.flags) & 0x02) { ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value frm.data_len = be32toh(dp.len); ^~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value opcode = be32toh(dp.flags) & 0xffff; ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined frm.data_len = btohs(dh.len); ^ ~~~~~~~~~~~~~ tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined frm.len = frm.data_len; ^ ~~~~~~~~~~~~ tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value ts = be64toh(ph.ts); ^~~~~~~~~~~~~~ /usr/include/endian.h:51:22: note: expanded from macro 'be64toh' # define be64toh(x) __bswap_64 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value frm.in = be32toh(dp.flags) & 0x01; ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined frm.in = dh.in; ^ ~~~~~ tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' fd = open(file, open_flags, 0644); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 warnings generated. tools/rfcomm.c:228:3: warning: Value stored to 'i' is never read i = execvp(cmdargv[0], cmdargv); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:228:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' i = execvp(cmdargv[0], cmdargv); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:348:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:491:14: warning: Assigned value is garbage or undefined req.channel = raddr.rc_channel; ^ ~~~~~~~~~~~~~~~~ tools/rfcomm.c:509:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 warnings generated. src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ 3 warnings generated. tools/ciptool.c:350:7: warning: 5th function call argument is an uninitialized value sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int' uint32_t *value_int = malloc(sizeof(int)); ~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~ tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value free(allocArray[i]); ^~~~~~~~~~~~~~~~~~~ tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name' return add_service(0, &si); ^~~~~~~~~~~~~~~~~~~~~~~~~~ tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc' return -1; ^~~~~~~~~ 4 warnings generated. tools/avtest.c:225:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:235:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:244:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:258:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:265:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:272:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:279:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:291:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:295:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:304:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:308:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:317:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:324:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:346:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:350:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:359:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:363:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:376:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:380:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:387:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:397:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:562:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:570:3: warning: Value stored to 'len' is never read len = write(sk, buf, invalid ? 2 : 3); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:584:3: warning: Value stored to 'len' is never read len = write(sk, buf, 4 + sizeof(media_transport)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:597:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:607:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:619:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:634:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:646:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:655:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:662:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:698:2: warning: Value stored to 'len' is never read len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 warnings generated. tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull' tcp_port = atoi(optarg); ^~~~~~~~~~~~ tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull' if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3)) ^~~~~~~~~~~~~~ 2 warnings generated. tools/create-image.c:76:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:84:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:92:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:105:2: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ 4 warnings generated. tools/btgatt-client.c:1597:2: warning: Value stored to 'argv' is never read argv += optind; ^ ~~~~~~ 1 warning generated. tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read argv -= optind; ^ ~~~~~~ 1 warning generated. tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read ptr = fgets(result, sizeof(result), fp); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value chr_write(chr, value, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_RDONLY | O_NOCTTY, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. tools/test-runner.c:945:2: warning: 2nd function call argument is an uninitialized value printf("Running command %s\n", cmdname ? cmdname : argv[0]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read bit = 0; ^ ~ tools/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' memcpy(cp->data, ad_data, ad_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' pElem = malloc(sizeof(uint16_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' pElem = malloc(sizeof(uint32_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ 2 warnings generated. android/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value g_free(text[i]); ^~~~~~~~~~~~~~~ 1 warning generated. profiles/health/hdp.c:644:3: warning: Use of memory after it is freed hdp_tmp_dc_data_unref(dc_data); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ profiles/health/hdp.c:800:19: warning: Use of memory after it is freed path = g_strdup(chan->path); ^~~~~~~~~~ profiles/health/hdp.c:1779:6: warning: Use of memory after it is freed hdp_tmp_dc_data_ref(hdp_conn), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ profiles/health/hdp.c:1836:30: warning: Use of memory after it is freed reply = g_dbus_create_error(data->msg, ERROR_INTERFACE ".HealthError", ^~~~~~~~~ 4 warnings generated. profiles/health/hdp_util.c:1052:2: warning: Use of memory after it is freed conn_data->func(conn_data->data, gerr); ^~~~~~~~~~~~~~~ 1 warning generated. attrib/gatt.c:970:2: warning: Potential leak of memory pointed to by 'long_write' return prepare_write(long_write); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' pElem = malloc(sizeof(uint16_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' pElem = malloc(sizeof(uint32_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ 2 warnings generated. src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ 3 warnings generated. src/sdp-client.c:353:14: warning: Access to field 'cb' results in a dereference of a null pointer (*ctxt)->cb = cb; ~~~~~~~~~~~~^~~~ 1 warning generated. src/gatt-database.c:1154:10: warning: Value stored to 'bits' during its initialization is never read uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING, ^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/plugin.c: In function ‘init_plugin’: src/plugin.c:59:1: error: no return statement in function returning non-void [-Werror=return-type] 59 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:10849: src/bluetoothd-plugin.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4638: all] Error 2 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH BlueZ 1/8] obexd: remove support for external plugins @ 2024-01-16 14:18 Emil Velikov via B4 Relay 2024-01-16 16:47 ` Remove " bluez.test.bot 0 siblings, 1 reply; 18+ messages in thread From: Emil Velikov via B4 Relay @ 2024-01-16 14:18 UTC (permalink / raw) To: linux-bluetooth; +Cc: Emil Velikov From: Emil Velikov <emil.velikov@collabora.com> A while ago all the plugins were converted to built-in, although the external machinery remained - remove it. In practise, this means we no longer need to export obexd internal API (fix coming in later patch). AFACIT supporting third-party plugins was never a supported use-case. Glancing around - no Linux distros seem to ship plugins, these days. --- Makefile.obexd | 6 +---- obexd/src/obexd.h | 2 +- obexd/src/plugin.c | 73 +++++------------------------------------------------- obexd/src/plugin.h | 9 ------- 4 files changed, 8 insertions(+), 82 deletions(-) diff --git a/Makefile.obexd b/Makefile.obexd index 5d1a4ff65..2774f3aec 100644 --- a/Makefile.obexd +++ b/Makefile.obexd @@ -11,8 +11,6 @@ EXTRA_DIST += obexd/src/obex.service.in obexd/src/org.bluez.obex.service if OBEX -obex_plugindir = $(libdir)/obex/plugins - obexd_builtin_modules = obexd_builtin_sources = obexd_builtin_nodist = @@ -89,9 +87,7 @@ obexd_src_obexd_LDADD = lib/libbluetooth-internal.la \ obexd_src_obexd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \ - $(ICAL_CFLAGS) -DOBEX_PLUGIN_BUILTIN \ - -DPLUGINDIR=\""$(obex_plugindir)"\" \ - -D_FILE_OFFSET_BITS=64 \ + $(ICAL_CFLAGS) -D_FILE_OFFSET_BITS=64 \ -I$(builddir)/lib -I$(builddir)/obexd/src obexd_src_obexd_CFLAGS = $(AM_CFLAGS) -fPIC diff --git a/obexd/src/obexd.h b/obexd/src/obexd.h index fe312a65b..af5265da5 100644 --- a/obexd/src/obexd.h +++ b/obexd/src/obexd.h @@ -18,7 +18,7 @@ #define OBEX_MAS (1 << 8) #define OBEX_MNS (1 << 9) -gboolean plugin_init(const char *pattern, const char *exclude); +void plugin_init(const char *pattern, const char *exclude); void plugin_cleanup(void); gboolean manager_init(void); diff --git a/obexd/src/plugin.c b/obexd/src/plugin.c index 0df9d5258..185adac78 100644 --- a/obexd/src/plugin.c +++ b/obexd/src/plugin.c @@ -37,33 +37,29 @@ static GSList *plugins = NULL; struct obex_plugin { - void *handle; struct obex_plugin_desc *desc; }; -static gboolean add_plugin(void *handle, struct obex_plugin_desc *desc) +static void add_plugin(struct obex_plugin_desc *desc) { struct obex_plugin *plugin; if (desc->init == NULL) - return FALSE; + return; plugin = g_try_new0(struct obex_plugin, 1); if (plugin == NULL) - return FALSE; + return; - plugin->handle = handle; plugin->desc = desc; if (desc->init() < 0) { g_free(plugin); - return FALSE; + return; } plugins = g_slist_append(plugins, plugin); DBG("Plugin %s loaded", desc->name); - - return TRUE; } static gboolean check_plugin(struct obex_plugin_desc *desc, @@ -95,17 +91,12 @@ static gboolean check_plugin(struct obex_plugin_desc *desc, #include "builtin.h" -gboolean plugin_init(const char *pattern, const char *exclude) +void plugin_init(const char *pattern, const char *exclude) { char **patterns = NULL; char **excludes = NULL; - GDir *dir; - const char *file; unsigned int i; - if (strlen(PLUGINDIR) == 0) - return FALSE; - if (pattern) patterns = g_strsplit_set(pattern, ":, ", -1); @@ -119,60 +110,11 @@ gboolean plugin_init(const char *pattern, const char *exclude) patterns, excludes) == FALSE) continue; - add_plugin(NULL, __obex_builtin[i]); + add_plugin(__obex_builtin[i]); } - DBG("Loading plugins %s", PLUGINDIR); - - dir = g_dir_open(PLUGINDIR, 0, NULL); - if (!dir) { - g_strfreev(patterns); - g_strfreev(excludes); - return FALSE; - } - - while ((file = g_dir_read_name(dir)) != NULL) { - struct obex_plugin_desc *desc; - void *handle; - char *filename; - - if (g_str_has_prefix(file, "lib") == TRUE || - g_str_has_suffix(file, ".so") == FALSE) - continue; - - filename = g_build_filename(PLUGINDIR, file, NULL); - - handle = dlopen(filename, PLUGINFLAG); - if (handle == NULL) { - error("Can't load plugin %s: %s", filename, - dlerror()); - g_free(filename); - continue; - } - - g_free(filename); - - desc = dlsym(handle, "obex_plugin_desc"); - if (desc == NULL) { - error("Can't load plugin description: %s", dlerror()); - dlclose(handle); - continue; - } - - if (check_plugin(desc, patterns, excludes) == FALSE) { - dlclose(handle); - continue; - } - - if (add_plugin(handle, desc) == FALSE) - dlclose(handle); - } - - g_dir_close(dir); g_strfreev(patterns); g_strfreev(excludes); - - return TRUE; } void plugin_cleanup(void) @@ -187,9 +129,6 @@ void plugin_cleanup(void) if (plugin->desc->exit) plugin->desc->exit(); - if (plugin->handle != NULL) - dlclose(plugin->handle); - g_free(plugin); } diff --git a/obexd/src/plugin.h b/obexd/src/plugin.h index 703878460..2df66c79b 100644 --- a/obexd/src/plugin.h +++ b/obexd/src/plugin.h @@ -14,16 +14,7 @@ struct obex_plugin_desc { void (*exit) (void); }; -#ifdef OBEX_PLUGIN_BUILTIN #define OBEX_PLUGIN_DEFINE(name, init, exit) \ struct obex_plugin_desc __obex_builtin_ ## name = { \ #name, init, exit \ }; -#else -#define OBEX_PLUGIN_DEFINE(name,init,exit) \ - extern struct obex_plugin_desc obex_plugin_desc \ - __attribute__ ((visibility("default"))); \ - struct obex_plugin_desc obex_plugin_desc = { \ - #name, init, exit \ - }; -#endif -- 2.43.0 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* RE: Remove support for external plugins 2024-01-16 14:18 [PATCH BlueZ 1/8] obexd: remove " Emil Velikov via B4 Relay @ 2024-01-16 16:47 ` bluez.test.bot 0 siblings, 0 replies; 18+ messages in thread From: bluez.test.bot @ 2024-01-16 16:47 UTC (permalink / raw) To: linux-bluetooth, devnull+emil.l.velikov.gmail.com [-- Attachment #1: Type: text/plain, Size: 947 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=817230 ---Test result--- Test Summary: CheckPatch PASS 3.87 seconds GitLint PASS 2.60 seconds BuildEll PASS 23.85 seconds BluezMake PASS 702.42 seconds MakeCheck PASS 11.69 seconds MakeDistcheck PASS 159.11 seconds CheckValgrind PASS 221.12 seconds CheckSmatch PASS 326.34 seconds bluezmakeextell PASS 106.35 seconds IncrementalBuild PASS 5304.46 seconds ScanBuild PASS 928.69 seconds --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-01-29 19:00 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-29 14:44 [PATCH BlueZ v4 0/8] Remove support for external plugins Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay 2024-01-29 17:27 ` Remove support for external plugins bluez.test.bot 2024-01-29 14:44 ` [PATCH BlueZ v4 2/8] obexd: factor out external plugin support Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 3/8] bluetoothd: remove external-dummy plugin Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 4/8] bluetoothd: convert external sixaxis plugin to builtin Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 5/8] bluetoothd: factor out external plugin support Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 6/8] bluetoothd: don't export internal API Emil Velikov via B4 Relay 2024-01-29 14:44 ` [PATCH BlueZ v4 7/8] bluetoothd: change plugin loading alike obexd Emil Velikov via B4 Relay 2024-01-29 15:37 ` Paul Menzel 2024-01-29 16:22 ` Luiz Augusto von Dentz 2024-01-29 17:47 ` Emil Velikov 2024-01-29 14:44 ` [PATCH BlueZ v4 8/8] android: export only (android) entrypoint from the modules Emil Velikov via B4 Relay 2024-01-29 15:38 ` Paul Menzel 2024-01-29 19:00 ` [PATCH BlueZ v4 0/8] Remove support for external plugins patchwork-bot+bluetooth -- strict thread matches above, loose matches on Subject: below -- 2024-01-25 0:07 [PATCH BlueZ v3 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay 2024-01-25 3:15 ` Remove support for external plugins bluez.test.bot 2024-01-24 16:07 [PATCH BlueZ v2 1/8] configure, README: introduce --enable-external-plugins Emil Velikov via B4 Relay 2024-01-24 18:17 ` Remove support for external plugins bluez.test.bot 2024-01-16 14:18 [PATCH BlueZ 1/8] obexd: remove " Emil Velikov via B4 Relay 2024-01-16 16:47 ` Remove " bluez.test.bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).